diff --git a/.github/workflows/common_check.yml b/.github/workflows/common_check.yml
index 0daadba85c..0a90c2ba45 100644
--- a/.github/workflows/common_check.yml
+++ b/.github/workflows/common_check.yml
@@ -12,80 +12,121 @@ jobs:
steps:
- name: check out repository
uses: actions/checkout@v3
+
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
+
- name: execute check styles
run: python tests/code-style/check.py
unit-tests:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - name: Use Node.js 14
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libatk1.0-0 libcups2 libatk-bridge2.0-0 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libnss3 libgbm1 libasound2
+
+ - name: check out repository
+ uses: actions/checkout@v3
+
+ - name: Use Node.js 18
uses: actions/setup-node@v1
with:
- node-version: 14
+ node-version: 18
+
- name: Run unit tests
run: |
- npm install -g grunt-cli node-qunit-puppeteer
+ npm install grunt-cli node-qunit-puppeteer
npm install --prefix build
- grunt --gruntfile build/Gruntfile.js develop
- node-qunit-puppeteer tests/common/api/api.html
- node-qunit-puppeteer tests/common/color-mods/color-mods.html
- node-qunit-puppeteer tests/cell/shortcuts/shortcuts.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/FormulaTests.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/PivotTests.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/CopyPasteTests.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/SheetStructureTests.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/autoFilterTests.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/UserProtectedRangesTest.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/FormulaTrace.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/GoalSeekTests.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/NumFormatParse.html
- node-qunit-puppeteer tests/cell/spreadsheet-calculation/DataValidationTests.html
- node-qunit-puppeteer tests/word/unit-tests/paragraphContentPos.html
- node-qunit-puppeteer tests/word/content-control/block-level/cursorAndSelection.html
- node-qunit-puppeteer tests/word/content-control/inline-level/cursorAndSelection.html
- node-qunit-puppeteer tests/word/content-control/inline-level/checkbox.html
- node-qunit-puppeteer tests/word/document-calculation/floating-position/drawing.html
- node-qunit-puppeteer tests/word/document-calculation/paragraph.html
- node-qunit-puppeteer tests/word/document-calculation/table/correctBadTable.html
- node-qunit-puppeteer tests/word/document-calculation/table/flowTablePosition.html
- node-qunit-puppeteer tests/word/document-calculation/table/pageBreak.html
- node-qunit-puppeteer tests/word/document-calculation/table/table-header.html
- node-qunit-puppeteer tests/word/document-calculation/textShaper/textShaper.html
- node-qunit-puppeteer tests/word/document-calculation/text-hyphenator/text-hyphenator.html
- node-qunit-puppeteer tests/word/forms/forms.html
- node-qunit-puppeteer tests/word/forms/complexForm.html
- node-qunit-puppeteer tests/word/numbering/numberingApplicator.html
- node-qunit-puppeteer tests/word/numbering/numberingCalculation.html
- node-qunit-puppeteer tests/word/numbering/numberingAutocorrect.html
- node-qunit-puppeteer tests/word/api/api.html
- node-qunit-puppeteer tests/word/api/textInput.html
- node-qunit-puppeteer tests/word/styles/displayStyle.html
- node-qunit-puppeteer tests/word/styles/paraPr.html
- node-qunit-puppeteer tests/word/styles/styleApplicator.html
- node-qunit-puppeteer tests/word/plugins/pluginsApi.html
- node-qunit-puppeteer tests/word/revisions/paragraph.html
- node-qunit-puppeteer tests/word/merge-documents/mergeDocuments.html
- node-qunit-puppeteer tests/word/shortcuts/shortcuts.html
- node-qunit-puppeteer tests/slide/shortcuts/shortcuts.html
+ node node_modules/grunt-cli/bin/grunt --gruntfile build/Gruntfile.js develop
+ node node_modules/node-qunit-puppeteer/cli.js tests/common/api/api.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/common/color-mods/color-mods.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/shortcuts/shortcuts.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/FormulaTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/PivotTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/CopyPasteTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/SheetStructureTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/autoFilterTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/UserProtectedRangesTest.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/FormulaTrace.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/GoalSeekTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/NumFormatParse.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/DataValidationTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/conditionalFormattingTests.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/ExternalReference.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/cell/spreadsheet-calculation/SheetMemoryTest.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/unit-tests/paragraphContentPos.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/unit-tests/deleted-text-recovery.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/content-control/block-level/cursorAndSelection.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/content-control/inline-level/checkbox.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/content-control/inline-level/cursorAndSelection.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/content-control/inline-level/date-time.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/floating-position/drawing.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/paragraph.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/table/correctBadTable.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/table/flowTablePosition.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/table/pageBreak.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/table/table-header.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/textShaper/textShaper.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/document-calculation/text-hyphenator/text-hyphenator.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/forms/forms.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/forms/complexForm.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/numbering/numberingApplicator.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/numbering/numberingCalculation.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/numbering/numberingAutocorrect.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/api/api.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/api/cross-ref.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/api/textInput.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/styles/displayStyle.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/styles/paraPr.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/styles/styleApplicator.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/text-autocorrection/as-you-type.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/plugins/pluginsApi.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/revisions/paragraph.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/merge-documents/mergeDocuments.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/word/shortcuts/shortcuts.html 30000 "--no-sandbox"
+ node node_modules/node-qunit-puppeteer/cli.js tests/slide/shortcuts/shortcuts.html 30000 "--no-sandbox"
builder-tests:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - name: Use Node.js 12
+ - name: check out repository
+ uses: actions/checkout@v4
+ with:
+ path: sdkjs
+
+ - name: check out repository sdkjs-forms current branch
+ id: sdkjs-forms
+ uses: actions/checkout@v4
+ continue-on-error: true
+ with:
+ repository: ONLYOFFICE/sdkjs-forms
+ token: ${{ secrets.READ_PAT }}
+ path: sdkjs-forms
+ ref: ${{ github.ref }}
+ - name: check out repository sdkjs-forms master branch
+ if: steps.sdkjs-forms.outcome != 'success'
+ uses: actions/checkout@v4
+ with:
+ repository: ONLYOFFICE/sdkjs-forms
+ token: ${{ secrets.READ_PAT }}
+ path: sdkjs-forms
+ ref: master
+
+ - name: Use Node.js 18
uses: actions/setup-node@v1
with:
- node-version: 12
+ node-version: 18
+
- name: Run builder tests
run: |
- npm install -g grunt-cli
- npm install --prefix build
- grunt --level=WHITESPACE_ONLY --base build --gruntfile build/Gruntfile.js
- docker run -v $PWD/deploy/sdkjs/common:/opt/onlyoffice/documentbuilder/sdkjs/common \
- -v $PWD/deploy/sdkjs/word:/opt/onlyoffice/documentbuilder/sdkjs/word \
- -v $PWD/deploy/sdkjs/cell:/opt/onlyoffice/documentbuilder/sdkjs/cell \
- -v $PWD/deploy/sdkjs/slide:/opt/onlyoffice/documentbuilder/sdkjs/slide \
- onlyoffice/doc-builder-testing:next-release rake rspec_critical
+ cd sdkjs
+ npm install grunt-cli
+ npm install --prefix build
+ node node_modules/grunt-cli/bin/grunt --level=WHITESPACE_ONLY --addon=sdkjs-forms --base build --gruntfile build/Gruntfile.js
+ docker run -v $PWD/deploy/sdkjs/common:/opt/onlyoffice/documentbuilder/sdkjs/common \
+ -v $PWD/deploy/sdkjs/word:/opt/onlyoffice/documentbuilder/sdkjs/word \
+ -v $PWD/deploy/sdkjs/cell:/opt/onlyoffice/documentbuilder/sdkjs/cell \
+ -v $PWD/deploy/sdkjs/slide:/opt/onlyoffice/documentbuilder/sdkjs/slide \
+ onlyoffice/doc-builder-testing:next-release rake rspec_critical
diff --git a/.github/workflows/dev_check.yml b/.github/workflows/dev_check.yml
index c1e11db6dc..1b132e5b4c 100644
--- a/.github/workflows/dev_check.yml
+++ b/.github/workflows/dev_check.yml
@@ -22,10 +22,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - name: Use Node.js 14
+ - name: Use Node.js 20
uses: actions/setup-node@v1
with:
- node-version: 14
+ node-version: 20
- name: Run unit tests
run: |
npm install -g grunt-cli node-qunit-puppeteer
@@ -44,9 +44,14 @@ jobs:
node-qunit-puppeteer tests/cell/spreadsheet-calculation/GoalSeekTests.html
node-qunit-puppeteer tests/cell/spreadsheet-calculation/NumFormatParse.html
node-qunit-puppeteer tests/cell/spreadsheet-calculation/DataValidationTests.html
+ node-qunit-puppeteer tests/cell/spreadsheet-calculation/conditionalFormattingTests.html
+ node-qunit-puppeteer tests/cell/spreadsheet-calculation/ExternalReference.html
node-qunit-puppeteer tests/word/unit-tests/paragraphContentPos.html
+ node-qunit-puppeteer tests/word/unit-tests/deleted-text-recovery.html
node-qunit-puppeteer tests/word/content-control/block-level/cursorAndSelection.html
+ node-qunit-puppeteer tests/word/content-control/inline-level/checkbox.html
node-qunit-puppeteer tests/word/content-control/inline-level/cursorAndSelection.html
+ node-qunit-puppeteer tests/word/content-control/inline-level/date-time.html
node-qunit-puppeteer tests/word/document-calculation/floating-position/drawing.html
node-qunit-puppeteer tests/word/document-calculation/paragraph.html
node-qunit-puppeteer tests/word/document-calculation/table/correctBadTable.html
@@ -60,11 +65,14 @@ jobs:
node-qunit-puppeteer tests/word/numbering/numberingCalculation.html
node-qunit-puppeteer tests/word/numbering/numberingAutocorrect.html
node-qunit-puppeteer tests/word/api/api.html
+ node-qunit-puppeteer tests/word/api/cross-ref.html
node-qunit-puppeteer tests/word/api/textInput.html
node-qunit-puppeteer tests/word/styles/displayStyle.html
node-qunit-puppeteer tests/word/styles/paraPr.html
node-qunit-puppeteer tests/word/styles/styleApplicator.html
+ node-qunit-puppeteer tests/word/text-autocorrection/as-you-type.html
node-qunit-puppeteer tests/word/plugins/pluginsApi.html
+ node-qunit-puppeteer tests/word/revisions/document-content.html
node-qunit-puppeteer tests/word/revisions/paragraph.html
node-qunit-puppeteer tests/word/merge-documents/mergeDocuments.html
node-qunit-puppeteer tests/word/shortcuts/shortcuts.html
@@ -72,18 +80,25 @@ jobs:
builder-tests:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
+ with:
+ path: sdkjs
+ - uses: actions/checkout@v4
+ with:
+ repository: ONLYOFFICE/sdkjs-forms
+ path: sdkjs-forms
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
- node-version: 12
+ node-version: 12
- name: Run builder tests
run: |
- npm install -g grunt-cli
- npm install --prefix build
- grunt --level=WHITESPACE_ONLY --base build --gruntfile build/Gruntfile.js
- docker run -v $PWD/deploy/sdkjs/common:/opt/onlyoffice/documentbuilder/sdkjs/common \
- -v $PWD/deploy/sdkjs/word:/opt/onlyoffice/documentbuilder/sdkjs/word \
- -v $PWD/deploy/sdkjs/cell:/opt/onlyoffice/documentbuilder/sdkjs/cell \
- -v $PWD/deploy/sdkjs/slide:/opt/onlyoffice/documentbuilder/sdkjs/slide \
- onlyoffice/doc-builder-testing:develop-latest rake rspec_critical
+ cd sdkjs
+ npm install -g grunt-cli
+ npm install --prefix build
+ grunt --level=WHITESPACE_ONLY --addon=sdkjs-forms --base build --gruntfile build/Gruntfile.js
+ docker run -v $PWD/deploy/sdkjs/common:/opt/onlyoffice/documentbuilder/sdkjs/common \
+ -v $PWD/deploy/sdkjs/word:/opt/onlyoffice/documentbuilder/sdkjs/word \
+ -v $PWD/deploy/sdkjs/cell:/opt/onlyoffice/documentbuilder/sdkjs/cell \
+ -v $PWD/deploy/sdkjs/slide:/opt/onlyoffice/documentbuilder/sdkjs/slide \
+ onlyoffice/doc-builder-testing:next-release rake rspec_critical
diff --git a/.gitignore b/.gitignore
index 087fc940fe..91eb3abfe4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ package-lock.json
*/node_modules
*/package-lock.json
connector
+tests/package*
diff --git a/build/Gruntfile.js b/build/Gruntfile.js
index 35a9f9f8c3..6aad99ce14 100644
--- a/build/Gruntfile.js
+++ b/build/Gruntfile.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -76,7 +76,13 @@ module.exports = function(grunt) {
function writeScripts(config, name) {
const develop = '../develop/sdkjs/';
const fileName = 'scripts.js';
- const files = ['../vendor/polyfill.js', '../common/applyDocumentChanges.js', '../common/AllFonts.js'].concat(getFilesMin(config), getFilesAll(config));
+ let files = ['../vendor/polyfill.js', '../common/AllFonts.js'];
+ if (grunt.option('compiled')) {
+ //todo set window['AscNotLoadAllScript'] = false; (in applyDocumentChanges.js)
+ files.push(deploy + name + '/sdk-all-min.js');
+ } else {
+ files = files.concat(['../common/applyDocumentChanges.js'], getFilesMin(config), getFilesAll(config));
+ }
fixUrl(files, '../../../../sdkjs/build/');
grunt.file.write(path.join(develop, name, fileName), 'var sdk_scripts = [\n\t"' + files.join('",\n\t"') + '"\n];');
diff --git a/build/build-develop-addons-sdk-advanced.py b/build/build-develop-addons-sdk-advanced.py
new file mode 100644
index 0000000000..c6e9569b75
--- /dev/null
+++ b/build/build-develop-addons-sdk-advanced.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+import sys
+sys.path.append('../../build_tools/scripts')
+import base
+import traceback
+
+try:
+ base.cmd_in_dir('.', "npm", ["install", "-g", "grunt-cli"])
+ base.cmd_in_dir('.', "npm", ["ci"])
+
+ base.cmd_in_dir('.', "grunt", ["--level=ADVANCED", "--addon=sdkjs-forms", "--addon=sdkjs-ooxml"])
+ base.cmd_in_dir('.', "grunt", ["develop", "--compiled", "--addon=sdkjs-forms", "--addon=sdkjs-ooxml"])
+
+ input("Press Enter to continue...")
+ exit(0)
+except SystemExit:
+ input("Ignoring SystemExit. Press Enter to continue...")
+ exit(0)
+except KeyboardInterrupt:
+ pass
+except:
+ input("Unexpected error. " + traceback.format_exc() + "Press Enter to continue...")
+ exit(0)
diff --git a/build/build-develop-addons-sdk-whitespace.py b/build/build-develop-addons-sdk-whitespace.py
new file mode 100644
index 0000000000..b47e31dc7d
--- /dev/null
+++ b/build/build-develop-addons-sdk-whitespace.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+import sys
+sys.path.append('../../build_tools/scripts')
+import base
+import traceback
+
+try:
+ base.cmd_in_dir('.', "npm", ["install", "-g", "grunt-cli"])
+ base.cmd_in_dir('.', "npm", ["ci"])
+
+ base.cmd_in_dir('.', "grunt", ["--level=WHITESPACE_ONLY", "--addon=sdkjs-forms", "--addon=sdkjs-ooxml"])
+ base.cmd_in_dir('.', "grunt", ["develop", "--compiled", "--addon=sdkjs-forms", "--addon=sdkjs-ooxml"])
+
+ input("Press Enter to continue...")
+ exit(0)
+except SystemExit:
+ input("Ignoring SystemExit. Press Enter to continue...")
+ exit(0)
+except KeyboardInterrupt:
+ pass
+except:
+ input("Unexpected error. " + traceback.format_exc() + "Press Enter to continue...")
+ exit(0)
diff --git a/build/build-develop-addons.bat b/build/build-develop-addons.bat
deleted file mode 100644
index 2900ef2868..0000000000
--- a/build/build-develop-addons.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-CD /D %~dp0
-call npm install -g grunt-cli
-call npm ci
-
-call grunt --level=WHITESPACE_ONLY --addon=sdkjs-forms --addon=sdkjs-ooxml
-call grunt develop --addon=sdkjs-forms --addon=sdkjs-ooxml
-
-pause
\ No newline at end of file
diff --git a/build/build-develop-addons.py b/build/build-develop-addons.py
new file mode 100644
index 0000000000..d029eb7402
--- /dev/null
+++ b/build/build-develop-addons.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+import sys
+sys.path.append('../../build_tools/scripts')
+import base
+import traceback
+
+try:
+ base.cmd_in_dir('.', "npm", ["install", "-g", "grunt-cli"])
+ base.cmd_in_dir('.', "npm", ["ci"])
+
+ base.cmd_in_dir('.', "grunt", ["--level=WHITESPACE_ONLY", "--addon=sdkjs-forms", "--addon=sdkjs-ooxml"])
+ base.cmd_in_dir('.', "grunt", ["develop", "--addon=sdkjs-forms", "--addon=sdkjs-ooxml"])
+
+ input("Press Enter to continue...")
+ exit(0)
+except SystemExit:
+ input("Ignoring SystemExit. Press Enter to continue...")
+ exit(0)
+except KeyboardInterrupt:
+ pass
+except:
+ input("Unexpected error. " + traceback.format_exc() + "Press Enter to continue...")
+ exit(0)
diff --git a/build/deserializer/deserialize.js b/build/deserializer/deserialize.js
index a88fd5ed47..ca49f25aa8 100644
--- a/build/deserializer/deserialize.js
+++ b/build/deserializer/deserialize.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -12,7 +12,7 @@
* 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 20A-12 Ernesta Birznieka-Upisha
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
diff --git a/build/deserializer/download-maps.js b/build/deserializer/download-maps.js
index 2dedefa5d6..302b1a2178 100644
--- a/build/deserializer/download-maps.js
+++ b/build/deserializer/download-maps.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -12,7 +12,7 @@
* 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 20A-12 Ernesta Birznieka-Upisha
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
@@ -36,7 +36,7 @@ const {S3Client, GetObjectCommand} = require("@aws-sdk/client-s3");
async function run(accessKeyId, secretAccessKey, inputFile = "unique.txt", mapsDir = "maps", region = "eu-west-1",
endpoint = "https://s3.eu-west-1.amazonaws.com", bucketName = "repo-doc-onlyoffice-com",
- keyPrefix = "closure-maps/commercial/{version}") {
+ keyPrefix = "closure-maps/sdkjs/commercial/{version}") {
if (!accessKeyId || !secretAccessKey) {
console.error(`missing arguments.USAGE: download-maps.js [accessKeyId] [secretAccessKey] [inputFile=${inputFile}] [mapsDir=${mapsDir}] [region=${region}] [endpoint=${endpoint}] [bucketName=${bucketName}] [keyPrefix=${keyPrefix}]`);
console.error(`inputFile must contain at least one line like: "/7.5.1-23/sdkjs/"`);
diff --git a/build/deserializer/parse-json-log-dir.js b/build/deserializer/parse-json-log-dir.js
index ff546cbb18..943bf98567 100644
--- a/build/deserializer/parse-json-log-dir.js
+++ b/build/deserializer/parse-json-log-dir.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -12,7 +12,7 @@
* 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 20A-12 Ernesta Birznieka-Upisha
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
diff --git a/cell/Local/api.js b/cell/Local/api.js
index 85c2c17305..d35c6985f6 100644
--- a/cell/Local/api.js
+++ b/cell/Local/api.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -49,20 +49,6 @@ var c_oAscError = Asc.c_oAscError;
var asc = window["Asc"];
var spreadsheet_api = asc['spreadsheet_api'];
- spreadsheet_api.prototype._onNeedParams = function(data, opt_isPassword)
- {
- var type;
- var options;
- if (opt_isPassword) {
- type = Asc.c_oAscAdvancedOptionsID.DRM;
- } else {
- type = Asc.c_oAscAdvancedOptionsID.CSV;
- var cp = JSON.parse("{\"codepage\":46,\"delimiter\":1}");
- cp['encodings'] = AscCommon.getEncodingParams();
- options = new AscCommon.asc_CAdvancedOptions(cp);
- }
- this.handlers.trigger("asc_onAdvancedOptions", type, options);
- };
spreadsheet_api.prototype.asc_addImageDrawingObject = function(urls, imgProp, token)
{
var ws = this.wb.getWorksheet();
@@ -290,6 +276,13 @@ var c_oAscError = Asc.c_oAscError;
let nativeOptions = options.advancedOptions.asc_getNativeOptions();
if (nativeOptions)
printOptionsObj["nativeOptions"] = nativeOptions;
+
+ // adjustPrint
+ printOptionsObj["adjustOptions"] = {};
+ if (null != options.advancedOptions.asc_getStartPageIndex())
+ printOptionsObj["adjustOptions"]["startPageIndex"] = options.advancedOptions.asc_getStartPageIndex();
+ if (null != options.advancedOptions.asc_getEndPageIndex())
+ printOptionsObj["adjustOptions"]["endPageIndex"] = options.advancedOptions.asc_getEndPageIndex();
}
printOptions = JSON.stringify(printOptionsObj);
diff --git a/cell/api.js b/cell/api.js
index 9ae657e29a..9d292ce3be 100644
--- a/cell/api.js
+++ b/cell/api.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -484,20 +484,10 @@ var editor;
};
spreadsheet_api.prototype.asc_Copy = function() {
- if (window["AscDesktopEditor"])
- {
- window["asc_desktop_copypaste"](this, "Copy");
- return true;
- }
return AscCommon.g_clipboardBase.Button_Copy();
};
spreadsheet_api.prototype.asc_Paste = function() {
- if (window["AscDesktopEditor"])
- {
- window["asc_desktop_copypaste"](this, "Paste");
- return true;
- }
if (!AscCommon.g_clipboardBase.IsWorking()) {
return AscCommon.g_clipboardBase.Button_Paste();
}
@@ -562,7 +552,7 @@ var editor;
if (typeof Blob !== 'undefined' && typeof FileReader !== 'undefined') {
AscCommon.loadFileContent(url['output.txt'], function (httpRequest) {
var cp = {
- 'codepage': AscCommon.c_oAscCodePageUtf8, "delimiter": AscCommon.c_oAscCsvDelimiter.Comma,
+ 'codepage': AscCommon.c_oAscCodePageNone, "delimiter": AscCommon.c_oAscCsvDelimiter.Comma,
'encodings': AscCommon.getEncodingParams()
};
@@ -602,7 +592,7 @@ var editor;
function wrapper_callback(data) {
let bom = AscCommon.getEncodingByBOM(data);
let cp = {
- 'codepage': AscCommon.c_oAscCodePageNone !== bom.encoding ? bom.encoding : AscCommon.c_oAscCodePageUtf8,
+ 'codepage': bom.encoding,
"delimiter": AscCommon.c_oAscCsvDelimiter.Comma,
'encodings': AscCommon.getEncodingParams(),
'data': AscCommon.c_oAscCodePageNone !== bom.encoding ? data.subarray(bom.size) : data
@@ -930,11 +920,6 @@ var editor;
};
spreadsheet_api.prototype.asc_Cut = function() {
- if (window["AscDesktopEditor"])
- {
- window["asc_desktop_copypaste"](this, "Cut");
- return true;
- }
return AscCommon.g_clipboardBase.Button_Cut();
};
@@ -1329,25 +1314,33 @@ var editor;
if (t.handlers.hasTrigger("asc_onAdvancedOptions")) {
// ToDo разделитель пока только "," http://bugzilla.onlyoffice.com/show_bug.cgi?id=31009
var cp = {
- 'codepage': AscCommon.c_oAscCodePageUtf8, "delimiter": AscCommon.c_oAscCsvDelimiter.Comma,
+ 'codepage': AscCommon.c_oAscCodePageNone, "delimiter": AscCommon.c_oAscCsvDelimiter.Comma,
'encodings': AscCommon.getEncodingParams()
};
if (data && typeof Blob !== 'undefined' && typeof FileReader !== 'undefined') {
- AscCommon.loadFileContent(data, function(httpRequest) {
- if (httpRequest && httpRequest.response) {
- let data = httpRequest.response;
- var dataUint = new Uint8Array(data);
- var bom = AscCommon.getEncodingByBOM(dataUint);
- if (AscCommon.c_oAscCodePageNone !== bom.encoding) {
- cp['codepage'] = bom.encoding;
- data = dataUint.subarray(bom.size);
- }
- cp['data'] = data;
- t.handlers.trigger("asc_onAdvancedOptions", c_oAscAdvancedOptionsID.CSV, new AscCommon.asc_CAdvancedOptions(cp));
+ function applyBuffer(dataUint) {
+ var bom = AscCommon.getEncodingByBOM(dataUint);
+ if (AscCommon.c_oAscCodePageNone !== bom.encoding) {
+ cp['codepage'] = bom.encoding;
+ cp['data'] = dataUint.subarray(bom.size);
} else {
- t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
+ cp['data'] = dataUint;
}
- }, "arraybuffer");
+ }
+ if (data.buffer) {
+ applyBuffer(data);
+ t.handlers.trigger("asc_onAdvancedOptions", c_oAscAdvancedOptionsID.CSV, new AscCommon.asc_CAdvancedOptions(cp));
+ } else {
+ AscCommon.loadFileContent(data, function(httpRequest) {
+ if (httpRequest && httpRequest.response) {
+ let data = httpRequest.response;
+ applyBuffer(new Uint8Array(data));
+ t.handlers.trigger("asc_onAdvancedOptions", c_oAscAdvancedOptionsID.CSV, new AscCommon.asc_CAdvancedOptions(cp));
+ } else {
+ t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
+ }
+ }, "arraybuffer");
+ }
} else {
t.handlers.trigger("asc_onAdvancedOptions", c_oAscAdvancedOptionsID.CSV, new AscCommon.asc_CAdvancedOptions(cp));
}
@@ -1765,6 +1758,7 @@ var editor;
if(this.wb.MobileTouchManager) {
this.wb.MobileTouchManager.Destroy();
}
+ this.sendEvent("asc_onCloseFile");
};
spreadsheet_api.prototype.openDocumentFromZip = function (wb, data) {
@@ -1794,39 +1788,51 @@ var editor;
var doc = new openXml.OpenXmlPackage(jsZlib, null);
var reader, i, j;
- //core
- var coreXmlPart = doc.getPartByRelationshipType(openXml.Types.coreFileProperties.relationType);
- if (coreXmlPart) {
- var contentCore = coreXmlPart.getDocumentContent();
- if (contentCore) {
- wb.Core = new AscCommon.CCore();
- reader = new StaxParser(contentCore, coreXmlPart, xmlParserContext);
- wb.Core.fromXml(reader, true);
- }
- }
-
- //app
- var appXmlPart = doc.getPartByRelationshipType(openXml.Types.extendedFileProperties.relationType);
- if (appXmlPart) {
- var contentApp = appXmlPart.getDocumentContent();
- if (contentApp) {
- wb.App = new AscCommon.CApp();
- reader = new StaxParser(contentApp, appXmlPart, xmlParserContext);
- wb.App.fromXml(reader, true);
- }
- }
-
//workbook
wbPart = doc.getPartByRelationshipType(openXml.Types.workbook.relationType);
if (wbPart) {
var contentWorkbook = wbPart.getDocumentContent();
wbXml = new AscCommonExcel.CT_Workbook(wb);
reader = new StaxParser(contentWorkbook, wbPart, xmlParserContext);
- wbXml.fromXml(reader);
+ if (t.isOpenOOXInBrowser) {
+ wbXml.fromXml(reader);
+ } else {
+ wbXml.fromXmlSimple(reader);
+ }
}
-
if (t.isOpenOOXInBrowser) {
+ //core
+ var coreXmlPart = doc.getPartByRelationshipType(openXml.Types.coreFileProperties.relationType);
+ if (coreXmlPart) {
+ var contentCore = coreXmlPart.getDocumentContent();
+ if (contentCore) {
+ wb.Core = new AscCommon.CCore();
+ reader = new StaxParser(contentCore, coreXmlPart, xmlParserContext);
+ wb.Core.fromXml(reader, true);
+ }
+ }
+
+ //app
+ var appXmlPart = doc.getPartByRelationshipType(openXml.Types.extendedFileProperties.relationType);
+ if (appXmlPart) {
+ var contentApp = appXmlPart.getDocumentContent();
+ if (contentApp) {
+ wb.App = new AscCommon.CApp();
+ reader = new StaxParser(contentApp, appXmlPart, xmlParserContext);
+ wb.App.fromXml(reader, true);
+ }
+ }
+ //metadata
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ let metaData = wbPart.getPartByRelationshipType(openXml.Types.metadata.relationType);
+ if (metaData) {
+ let contentMetaData = metaData.getDocumentContent();
+ wb.metadata = new AscCommonExcel.CMetadata();
+ reader = new StaxParser(contentMetaData, metaData, xmlParserContext);
+ wb.metadata.fromXml(reader);
+ }
+ }
//theme
var workbookThemePart = wbPart.getPartByRelationshipType(openXml.Types.theme.relationType);
@@ -3233,22 +3239,30 @@ var editor;
}
}
- if (this.isMobileVersion) {
+ if (this.isUseOldMobileVersion()) {
this.wb.defaults.worksheetView.halfSelection = true;
this.wb.defaults.worksheetView.activeCellBorderColor = new CColor(79, 158, 79);
var _container = document.getElementById(this.HtmlElementName);
if (_container) {
_container.style.overflow = "hidden";
}
- this.wb.MobileTouchManager = new AscCommonExcel.CMobileTouchManager({eventsElement: "cell_mobile_element"});
- this.wb.MobileTouchManager.Init(this);
// input context must be created!!!
var _areaId = AscCommon.g_inputContext.HtmlArea.id;
var _element = document.getElementById(_areaId);
_element.parentNode.parentNode.style.zIndex = 10;
+ }
+
+ if ((typeof AscCommonExcel.CMobileTouchManager) !== "undefined")
+ {
+ this.wb.MobileTouchManager = new AscCommonExcel.CMobileTouchManager({eventsElement: "cell_mobile_element", desktopMode : !this.isUseOldMobileVersion()});
+ this.wb.MobileTouchManager.Init(this);
+
+ if (this.isUseOldMobileVersion())
+ this.wb.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);
- this.wb.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);
+ if (this.controller)
+ this.wb.MobileTouchManager.addClickElement([this.controller.element]);
}
this.asc_CheckGuiControlColors();
@@ -3369,10 +3383,6 @@ var editor;
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["OnSave"]();
}
- if (t.disconnectOnSave) {
- t.CoAuthoringApi.disconnect(t.disconnectOnSave.code, t.disconnectOnSave.reason);
- t.disconnectOnSave = null;
- }
if (t.canUnlockDocument) {
t._unlockDocument();
@@ -3417,7 +3427,12 @@ var editor;
this.wbModel.setActive(where);
this.wb.updateWorksheetByModel();
this.wb.showWorksheet();
+ this.wbModel.dependencyFormulas.lockRecal();
History.EndTransaction();
+ if (this.wbModel.dependencyFormulas.changedCell) {
+ this.wbModel.dependencyFormulas.changedCell = null;
+ }
+ this.wbModel.dependencyFormulas.unlockRecal();
// Посылаем callback об изменении списка листов
this.sheetsChanged();
this.inkDrawer.endSilentMode();
@@ -3812,8 +3827,8 @@ var editor;
}
t.wbModel.handleChartsOnWorksheetsRemove(arrSheets);
t.wb.updateWorksheetByModel();
+ History.EndTransaction();
t.wb.showWorksheet();
- History.EndTransaction();
// Посылаем callback об изменении списка листов
t.sheetsChanged();
}
@@ -3828,7 +3843,7 @@ var editor;
if (arrBooks.length) {
this.sendSheetsToOtherBooks(where, arrNames, arrSheets, arrBooks);
this.asc_deleteWorksheet(arrSheets.slice());
- } else if (window["AscDesktopEditor"]) {
+ } else if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsLocalFile"]()) {
this.copyToNewWorkbook(arrSheets);
}
this.removeDocumentInfoEvent();
@@ -3897,7 +3912,7 @@ var editor;
if (arrBooks) {
if (arrBooks.length) {
this.sendSheetsToOtherBooks(where, arrNames, arrSheets, arrBooks);
- } else if (window["AscDesktopEditor"]) {
+ } else if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsLocalFile"]()) {
this.copyToNewWorkbook(arrSheets);
}
this.removeDocumentInfoEvent();
@@ -4465,6 +4480,10 @@ var editor;
this.wb.getWorksheet().changeSheetViewSettings(AscCH.historyitem_Worksheet_SetShowFormulas, value);
};
+ spreadsheet_api.prototype.asc_setRightToLeft = function (value) {
+ this.wb.getWorksheet().changeSheetViewSettings(AscCH.historyitem_Worksheet_SetRightToLeft, value);
+ };
+
spreadsheet_api.prototype.asc_getShowFormulas = function () {
let ws = this.wb.getWorksheet();
return ws.model && ws.model.getShowFormulas();
@@ -4503,7 +4522,7 @@ var editor;
oSmartArt.setWorksheet(oWSModel);
oSmartArt.addToDrawingObjects(undefined, AscCommon.c_oAscCellAnchorType.cellanchorTwoCell);
oSmartArt.checkDrawingBaseCoords();
- oSmartArt.fitFontSize();
+ oSmartArt.generateDrawingPart();
oController.checkChartTextSelection();
oController.resetSelection();
oSmartArt.select(oController, 0);
@@ -6490,7 +6509,7 @@ var editor;
};
spreadsheet_api.prototype.getGraphicController = function () {
- var ws = this.wb.getWorksheet();
+ var ws = this.wb && this.wb.getWorksheet();
return ws && ws.objectRender && ws.objectRender.controller;
};
@@ -6863,6 +6882,14 @@ var editor;
_adjustPrint.asc_setIgnorePrintArea(true);
}
+ if (_options["adjustOptions"])
+ {
+ if (_options["adjustOptions"]["startPageIndex"])
+ _adjustPrint.asc_setStartPageIndex(_options["adjustOptions"]["startPageIndex"]);
+ if (_options["adjustOptions"]["endPageIndex"])
+ _adjustPrint.asc_setEndPageIndex(_options["adjustOptions"]["endPageIndex"]);
+ }
+
_adjustPrint.asc_setPrintType(Asc.c_oAscPrintType.EntireWorkbook);
var ws, newPrintOptions;
@@ -7054,7 +7081,7 @@ var editor;
spreadsheet_api.prototype.canRunBuilderScript = function() {
return this.asc_canPaste();
};
- spreadsheet_api.prototype.onEndBuilderScript = function() {
+ spreadsheet_api.prototype._onEndBuilderScript = function(callback) {
let needDraw = null;
if (this.wb && this.wb.customFunctionEngine && this.wb.customFunctionEngine.needRecalculate) {
if (this.wbModel.addCustomFunctionToChanged()) {
@@ -7067,7 +7094,10 @@ var editor;
const ws = this.wb && this.wb.getWorksheet();
ws && ws.draw();
}
-
+
+ if (callback)
+ callback(true);
+
return true;
};
@@ -7274,16 +7304,17 @@ var editor;
return name;
};
/**
- * @param {CT_pivotTableDefinition} opt_pivotTable
+ * @param {CT_pivotTableDefinition} opt_pivotTable
+ * @param {row: number, col: number} opt_activeCell
* @return {boolean} Success
*/
- spreadsheet_api.prototype.asc_pivotShowDetails = function(opt_pivotTable) {
+ spreadsheet_api.prototype.asc_pivotShowDetails = function(opt_pivotTable, opt_activeCell) {
if (this.collaborativeEditing.getGlobalLock() || !this.canEdit()) {
return false;
}
let t = this;
let ws = this.wbModel.getActiveWs();
- let activeCell = ws.selectionRange.activeCell;
+ let activeCell = opt_activeCell || ws.selectionRange.activeCell;
let pivotTable = opt_pivotTable || ws.getPivotTable(activeCell.col, activeCell.row);
if (!pivotTable) {
return false;
@@ -7347,6 +7378,7 @@ var editor;
var t = this;
if (Asc.CT_pivotTableDefinition.prototype.isValidDataRef(dataRef)) {
var wb = this.wbModel;
+ var pivot;
this._isLockedAddWorksheets(function(res) {
if (res) {
History.Create_NewPoint();
@@ -7354,7 +7386,7 @@ var editor;
var worksheets = t._addWorksheetsWithoutLock([newSheetName], wb.getActive());
var ws = worksheets[0];
var range = new Asc.Range(AscCommonExcel.NEW_PIVOT_COL, AscCommonExcel.NEW_PIVOT_ROW, AscCommonExcel.NEW_PIVOT_COL, AscCommonExcel.NEW_PIVOT_ROW);
- t._asc_insertPivot(wb, dataRef, ws, range, false);
+ pivot = t._asc_insertPivot(wb, dataRef, ws, range, false);
History.EndTransaction();
} else {
//todo
@@ -7364,8 +7396,10 @@ var editor;
} else {
this.sendEvent('asc_onError', c_oAscError.ID.PivotLabledColumns, c_oAscError.Level.NoCritical);
}
+ // добавил возвращение таблицы, для методов билдера
+ return pivot;
};
- spreadsheet_api.prototype.asc_insertPivotExistingWorksheet = function(dataRef, pivotRef) {
+ spreadsheet_api.prototype.asc_insertPivotExistingWorksheet = function(dataRef, pivotRef, confirmation) {
if (!Asc.CT_pivotTableDefinition.prototype.isValidDataRef(dataRef)) {
this.sendEvent('asc_onError', c_oAscError.ID.PivotLabledColumns, c_oAscError.Level.NoCritical);
return;
@@ -7383,8 +7417,9 @@ var editor;
}
this.wb.updateWorksheetByModel();
this.wb.showWorksheet();
- this._asc_insertPivot(wb, dataRef, ws, location.bbox, false);
+ return this._asc_insertPivot(wb, dataRef, ws, location.bbox, confirmation);
}
+ return null;
};
spreadsheet_api.prototype._asc_insertPivot = function(wb, dataRef, ws, bbox, confirmation) {
var t = this;
@@ -9261,6 +9296,29 @@ var editor;
return ws && ws.cleanFillHandleProps();
};
+ /**
+ * Returns values of calculation options
+ * @returns {asc_CCalcSettings}
+ */
+ spreadsheet_api.prototype.asc_GetCalcSettings = function () {
+ let wbModel = this.wbModel
+ if (!wbModel) {
+ return;
+ }
+ let res = new Asc.asc_CCalcSettings();
+
+ res.asc_initSettings(wbModel);
+
+ return res;
+ };
+ /**
+ * Updates the calculation options.
+ * @param {asc_CCalcSettings} oCalcSettings - The calculation options changed from UI.
+ */
+ spreadsheet_api.prototype.asc_UpdateCalcSettings = function (oCalcSettings) {
+ this.wb.updateCalcSettings(oCalcSettings);
+ };
+
spreadsheet_api.prototype.addCustomFunction = function(func, options) {
let wb = this.wb;
if (!wb) {
@@ -9418,11 +9476,64 @@ var editor;
}
};
+ spreadsheet_api.prototype.asc_SetSmoothScrolling = function(val) {
+ let wb = this.wb;
+ if (!wb) {
+ return;
+ }
+ return wb.setSmoothScrolling(val);
+ };
+ spreadsheet_api.prototype.asc_GetSmoothScrolling = function() {
+ let wb = this.wb;
+ if (!wb) {
+ return;
+ }
+ return wb.getSmoothScrolling();
+ };
+ spreadsheet_api.prototype.getCustomProperties = function() {
+ let oWBModel = this.wbModel;
+ if(!oWBModel)
+ return null;
+ return oWBModel.CustomProperties;
+ };
+
+ spreadsheet_api.prototype.addCustomProperty = function(name, type, value) {
+ let oCustomProperties = this.getCustomProperties();
+ if(!oCustomProperties) return;
+
+ this.checkObjectsLock([oCustomProperties.Id], function(bNoLock) {
+ if(bNoLock) {
+ AscCommon.History.Create_NewPoint();
+ oCustomProperties.AddProperty(name, type, value);
+ }
+ });
+ };
+ spreadsheet_api.prototype.modifyCustomProperty = function(idx, name, type, value) {
+ let oCustomProperties = this.getCustomProperties();
+ if(!oCustomProperties) return;
+
+ this.checkObjectsLock([oCustomProperties.Id], function(bNoLock) {
+ if(bNoLock) {
+ AscCommon.History.Create_NewPoint();
+ oCustomProperties.ModifyProperty(idx, name, type, value);
+ }
+ });
+ };
+ spreadsheet_api.prototype.removeCustomProperty = function(idx) {
+ let oCustomProperties = this.getCustomProperties();
+ if(!oCustomProperties) return;
+ this.checkObjectsLock([oCustomProperties.Id], function(bNoLock) {
+ if(bNoLock) {
+ AscCommon.History.Create_NewPoint();
+ oCustomProperties.RemoveProperty(idx);
+ }
+ });
+ };
/*
* Export
* -----------------------------------------------------------------------------
@@ -9588,6 +9699,8 @@ var editor;
prot["asc_setShowZeros"] = prot.asc_setShowZeros;
prot["asc_setShowFormulas"] = prot.asc_setShowFormulas;
prot["asc_getShowFormulas"] = prot.asc_getShowFormulas;
+ prot["asc_setRightToLeft"] = prot.asc_setRightToLeft;
+
// Defined Names
@@ -10001,15 +10114,18 @@ var editor;
prot["asc_GetEditableFunctions"]= prot.asc_GetEditableFunctions;
- prot["asc_StartGoalSeek"]= prot.asc_StartGoalSeek;
- prot["asc_CloseGoalClose"]= prot.asc_CloseGoalClose;
- prot["asc_PauseGoalSeek"]= prot.asc_PauseGoalSeek;
- prot["asc_ContinueGoalSeek"]= prot.asc_ContinueGoalSeek;
- prot["asc_StepGoalSeek"]= prot.asc_StepGoalSeek;
+ prot["asc_StartGoalSeek"] = prot.asc_StartGoalSeek;
+ prot["asc_CloseGoalClose"] = prot.asc_CloseGoalClose;
+ prot["asc_PauseGoalSeek"] = prot.asc_PauseGoalSeek;
+ prot["asc_ContinueGoalSeek"] = prot.asc_ContinueGoalSeek;
+ prot["asc_StepGoalSeek"] = prot.asc_StepGoalSeek;
+
+ prot["asc_GetSeriesSettings"] = prot.asc_GetSeriesSettings;
+ prot["asc_FillCells"] = prot.asc_FillCells;
+ prot["asc_CancelFillCells"] = prot.asc_CancelFillCells;
- prot["asc_GetSeriesSettings"]= prot.asc_GetSeriesSettings;
- prot["asc_FillCells"]= prot.asc_FillCells;
- prot["asc_CancelFillCells"]= prot.asc_CancelFillCells;
+ prot["asc_GetCalcSettings"] = prot.asc_GetCalcSettings;
+ prot["asc_UpdateCalcSettings"] = prot.asc_UpdateCalcSettings;
prot["asc_getCustomFunctionInfo"]= prot.asc_getCustomFunctionInfo;
@@ -10017,6 +10133,8 @@ var editor;
prot["asc_getOpeningDocumentsList"]= prot.asc_getOpeningDocumentsList;
prot["asc_isSupportCopySheetsBetweenBooks"]= prot.asc_isSupportCopySheetsBetweenBooks;
+ prot["asc_SetSmoothScrolling"]= prot.asc_SetSmoothScrolling;
+ prot["asc_GetSmoothScrolling"]= prot.asc_GetSmoothScrolling;
diff --git a/cell/apiBuilder.js b/cell/apiBuilder.js
index 646a53cf8f..ee3358bcfe 100644
--- a/cell/apiBuilder.js
+++ b/cell/apiBuilder.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -54,6 +54,7 @@
* @property {ApiComment[]} AllComments - Returns all comments from the current workbook including comments from all worksheets.
* @property {ReferenceStyle} ReferenceStyle - Returns or sets the reference style.
* @property {ApiWorksheetFunction} WorksheetFunction - Returns an object that represents the function list.
+ * @property {ApiPivotTable[]} PivotTables - Returns all pivot tables.
*/
var Api = window["Asc"]["spreadsheet_api"];
@@ -88,6 +89,7 @@
* @property {Array} Comments - Returns all comments from the current worksheet.
* @property {ApiFreezePanes} FreezePanes - Returns the freeze panes for the current worksheet.
* @property {ApiProtectedRange[]} AllProtectedRanges - Returns all protected ranges from the current worksheet.
+ * @property {ApiPivotTable[]} PivotTables - Returns all pivot tables from the current worksheet.
*/
function ApiWorksheet(worksheet) {
this.worksheet = worksheet;
@@ -131,6 +133,7 @@
* @property {'xlDownward' | 'xlHorizontal' | 'xlUpward' | 'xlVertical'} Orientation - Sets an angle to the current cell range.
* @property {ApiAreas} Areas - Returns a collection of the areas.
* @property {ApiCharacters} Characters - Returns the ApiCharacters object that represents a range of characters within the object text. Use the ApiCharacters object to format characters within a text string.
+ * @property {ApiPivotTable | null} PivotTable - Returns the ApiPivotTable object that represents the pivot table report containing the upper-left corner of the specified range.
*/
function ApiRange(range, areas) {
this.range = range;
@@ -169,17 +172,7 @@
ApiImage.prototype = Object.create(ApiDrawing.prototype);
ApiImage.prototype.constructor = ApiImage;
- /**
- * Class representing a chart.
- * @constructor
- */
- function ApiChart(oChart) {
- ApiDrawing.call(this, oChart);
- this.Chart = oChart;
- }
- ApiChart.prototype = Object.create(ApiDrawing.prototype);
- ApiChart.prototype.constructor = ApiChart;
/**
* Class representing an OLE object.
@@ -221,26 +214,30 @@
* "slateBlue" | "slateGray" | "slateGrey" | "snow" | "springGreen" | "steelBlue" | "tan" | "teal" |
* "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whiteSmoke" | "yellow" |
* "yellowGreen")} PresetColor
- * */
+ * @see office-js-api/Examples/Enumerations/PresetColor.js
+ */
/**
* Possible values for the position of chart tick labels (either horizontal or vertical).
- * * "none" - does not display the selected tick labels.
- * * "nextTo" - sets the position of the selected tick labels next to the main label.
- * * "low" - sets the position of the selected tick labels in the part of the chart with lower values.
- * * "high" - sets the position of the selected tick labels in the part of the chart with higher values.
+ * "none" - does not display the selected tick labels.
+ * "nextTo" - sets the position of the selected tick labels next to the main label.
+ * "low" - sets the position of the selected tick labels in the part of the chart with lower values.
+ * "high" - sets the position of the selected tick labels in the part of the chart with higher values.
* @typedef {("none" | "nextTo" | "low" | "high")} TickLabelPosition
- * **/
+ * @see office-js-api/Examples/Enumerations/TickLabelPosition.js
+ */
/**
* The page orientation type.
* @typedef {("xlLandscape" | "xlPortrait")} PageOrientation
- * */
+ * @see office-js-api/Examples/Enumerations/PageOrientation.js
+ */
/**
* The type of tick mark appearance.
* @typedef {("cross" | "in" | "none" | "out")} TickMark
- * */
+ * @see office-js-api/Examples/Enumerations/TickMark.js
+ */
/**
* Text transform type.
@@ -250,11 +247,13 @@
* | "textDoubleWave1" | "textFadeDown" | "textFadeLeft" | "textFadeRight" | "textFadeUp" | "textInflate" | "textInflateBottom" | "textInflateTop"
* | "textPlain" | "textRingInside" | "textRingOutside" | "textSlantDown" | "textSlantUp" | "textStop" | "textTriangle" | "textTriangleInverted"
* | "textWave1" | "textWave2" | "textWave4" | "textNoShape")} TextTransform
- * */
+ * @see office-js-api/Examples/Enumerations/TextTransform.js
+ */
/**
* Axis position in the chart.
* @typedef {("top" | "bottom" | "right" | "left")} AxisPos
+ * @see office-js-api/Examples/Enumerations/AxisPos.js
*/
/**
@@ -263,12 +262,14 @@
* "0.00E+00" | "# ?/?" | "# ??/??" | "m/d/yyyy" | "d-mmm-yy" | "d-mmm" | "mmm-yy" | "h:mm AM/PM" |
* "h:mm:ss AM/PM" | "h:mm" | "h:mm:ss" | "m/d/yyyy h:mm" | "#,##0_);(#,##0)" | "#,##0_);[Red](#,##0)" |
* "#,##0.00_);(#,##0.00)" | "#,##0.00_);[Red](#,##0.00)" | "mm:ss" | "[h]:mm:ss" | "mm:ss.0" | "##0.0E+0" | "@")} NumFormat
+ * @see office-js-api/Examples/Enumerations/NumFormat.js
*/
/**
- * The cell references type.
+ * The cell reference type.
* @typedef {('xlA1' | 'xlR1C1')} ReferenceStyle
- * */
+ * @see office-js-api/Examples/Enumerations/ReferenceStyle.js
+ */
//TODO not support "xlPasteAllMergingConditionalFormats" / "xlPasteAllUsingSourceTheme" / "xlPasteValidation"
/**
@@ -277,13 +278,21 @@
* | "xlPasteColumnWidths" | "xlPasteComments"
* | "xlPasteFormats" | "xlPasteFormulas" | "xlPasteFormulasAndNumberFormats"
* | "xlPasteValues" | "xlPasteValuesAndNumberFormats" )} PasteType
- * */
+ * @see office-js-api/Examples/Enumerations/PasteType.js
+ */
/**
- * Specifies how numeric data will be calculated with the destinations cells on the worksheet.
+ * The mathematical operation which will be applied to the copied data.
* @typedef {("xlPasteSpecialOperationAdd" | "xlPasteSpecialOperationDivide" | "xlPasteSpecialOperationMultiply"|
* "xlPasteSpecialOperationNone" | "xlPasteSpecialOperationSubtract" )} PasteSpecialOperation
- * */
+ * @see office-js-api/Examples/Enumerations/PasteSpecialOperation.js
+ */
+
+ /**
+ * Specifies how to shift cells to replace deleted cells.
+ * @typedef {("up" | "left")} DeleteShiftDirection
+ * @see office-js-api/Examples/Enumerations/DeleteShiftDirection.js
+ */
/**
* Class representing a base class for the color types.
@@ -293,9 +302,11 @@
this.color = color;
}
/**
- * Returns the color number.
+ * Returns a color value in RGB format.
* @memberof ApiColor
+ * @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiColor/Methods/GetRGB.js
*/
ApiColor.prototype.GetRGB = function () {
if (!this.color) {
@@ -361,6 +372,134 @@
}
}
+ /**
+ * Class representing a pivot table.
+ * @constructor
+ * @property {string} Name - Returns or sets a name of the pivot table.
+ * @property {boolean} ColumnGrand - Returns or sets the Grand Totals setting for the pivot table columns.
+ * @property {boolean} RowGrand - Returns or sets the Grand Totals setting for the pivot table rows.
+ * @property {boolean} DisplayFieldCaptions - Returns or sets the setting which specifies whether to display field headers for rows and columns.
+ * @property {string} Title - Returns or sets the pivot table title.
+ * @property {string} Description - Returns or sets the pivot table description.
+ * @property {string} StyleName - Returns or sets the pivot table style name.
+ * @property {ApiWorksheet} Parent - Returns the parent object for the current pivot table.
+ * @property {boolean} ShowTableStyleRowHeaders - Returns or sets the setting which specifies whether the row headers of the pivot table will be highlighted with the special formatting.
+ * @property {boolean} ShowTableStyleColumnHeaders - Returns or sets the setting which specifies whether the column headers of the pivot table will be highlighted with the special formatting.
+ * @property {boolean} ShowTableStyleRowStripes - Returns or sets the setting which specifies whether the background color alternation for odd and even rows will be enabled for the pivot table.
+ * @property {boolean} ShowTableStyleColumnStripes - Returns or sets the setting which specifies whether the background color alternation for odd and even columns will be enabled for the pivot table.
+ * @property {ApiRange} Source - Returns or sets the source range for the pivot table.
+ * @property {ApiRange | null} ColumnRange - Returns a Range object that represents the column area in the pivot table report.
+ * @property {ApiRange | null} RowRange - Returns a Range object that represents the row area in the pivot table report.
+ * @property {ApiRange} DataBodyRange - Returns a Range object that represents the range of values in the pivot table.
+ * @property {ApiRange | null} TableRange1 - Returns a Range object that represents the entire pivot table report, but doesn't include page fields.
+ * @property {ApiRange | null} TableRange2 - Returns a Range object that represents the entire pivot table report, including page fields.
+ * @property {string} GrandTotalName - Returns or sets the text string label that is displayed in the grand total column or row heading in the specified pivot table report.
+ * @property {boolean} RepeatAllLabels - Specifies whether to repeat item labels for all pivot fields in the specified pivot table.
+ * @property {object} RowAxisLayout - Sets the way the specified pivot table items appear — in table format or in outline format.
+ * @property {boolean} LayoutBlankLine - Sets the setting which specifies whether to insert blank rows after each item in the pivot table.
+ * @property {boolean} LayoutSubtotals - Sets the setting which specifies whether to show subtotals in the pivot table.
+ * @property {number} SubtotalLocation - Sets the layout subtotal location.
+ * @property {ApiPivotField[]} PivotFields - Returns all pivot fields in the pivot table.
+ * @property {ApiPivotField[]} ColumnFields - Returns an array that is currently displayed as column fields in the pivot table.
+ * @property {ApiPivotField[]} DataFields - Returns an array that is currently displayed as data fields in the pivot table.
+ * @property {ApiPivotField[]} HiddenFields - Returns an array that represents all hidden fields in the pivot table.
+ * @property {ApiPivotField[]} VisibleFields - Returns an array that represents all visible fields in the pivot table.
+ * @property {ApiPivotField[]} PageFields - Returns an array that is currently displayed as page fields in the pivot table.
+ * @property {ApiPivotField[]} RowFields - Returns an array that is currently displayed as row fields in the pivot table.
+ */
+ function ApiPivotTable(pivot, api) {
+ /** @type {CT_pivotTableDefinition} */
+ this.pivot = pivot;
+ this.api = api;
+ }
+
+ /**
+ * Class representing a pivot table field.
+ * @constructor
+ * @property {number} Position - Returns or sets a value that represents the position of the field (first, second, third, and so on) among all the fields in its orientation (Rows, Columns, Pages, Data).
+ * @property {number} Orientation - Returns or sets a pivot field orientation value that represents the location of the field in the specified pivot table report.
+ * @property {string} Caption - Returns or sets a value that represents the label text for the pivot field.
+ * @property {string} Name - Returns or sets a value representing the object name.
+ * @property {string} Value - Returns or sets a value representing the name of the specified field in the pivot table report.
+ * @property {string} SourceName - Returns a source name for the pivot table field.
+ * @property {number} Index - Returns an index for the pivot table field.
+ * @property {ApiPivotTable} Table - Returns the ApiPivotTable object which represents the pivot table for the current field.
+ * @property {ApiPivotTable} Parent - Returns the parent object for the current field.
+ * @property {boolean} LayoutCompactRow - Returns or sets the setting which specifies whether a pivot table field is compacted.
+ * @property {number} LayoutForm - Returns or sets the way the specified pivot table items appear — in table format or in outline format.
+ * @property {boolean} LayoutPageBreak - Returns or sets the setting which specifies whether to insert a page break after each field.
+ * @property {boolean} ShowingInAxis - Returns the setting which specifies whether the pivot table field is currently visible in the pivot table.
+ * @property {boolean} RepeatLabels - Returns or sets the setting which specifies whether to repeat items labels at each row.
+ * @property {boolean} LayoutBlankLine - Returns and sets the setting which specifies whether to insert blank rows after each item.
+ * @property {boolean} ShowAllItems - Returns or sets the setting which specifies whether to show items with no data.
+ * @property {boolean} LayoutSubtotals - Returns or sets the setting which specifies whether to show subtotals.
+ * @property {number} LayoutSubtotalLocation - Returns or sets the layout subtotal location.
+ * @property {string} SubtotalName - Returns or sets the text label displayed in the subtotal column or row heading in the specified pivot table report.
+ * @property {object} Subtotals - Returns or sets the subtotals.
+ * @property {number} Formula - Returns or sets a value that represents the object's formula.
+ * @property {boolean} DragToColumn - Returns or sets the setting which specifies whether the specified field can be dragged to the column position.
+ * @property {boolean} DragToRow - Returns or sets the setting which specifies whether the specified field can be dragged to the row position.
+ * @property {boolean} DragToData - Returns or sets the setting which specifies whether the specified field can be dragged to the data position.
+ * @property {boolean} DragToPage - Returns or sets the setting which specifies whether the specified field can be dragged to the page position.
+ * @property {string | null} NumberFormat - Returns or sets a value that represents the format code for the object.
+ * @property {string | number} CurrentPage - Returns the current page which is displayed for the page field (valid only for page fields).
+ * @property {ApiPivotItem | ApiPivotItem[]} PivotItems - Returns an object that represents either a single pivot table item (the ApiPivotItem object)
+ * or a collection of all the visible and hidden items (an array of the ApiPivotItem objects) in the specified field.
+ */
+ function ApiPivotField(table, index, pivotField) {
+ /** @type {ApiPivotTable} */
+ this.table = table;
+ /** @type {number} */
+ this.index = index;
+ /** @type {CT_PivotField} */
+ this.pivotField = pivotField;
+ }
+
+ /**
+ * Class representing a pivot table data field.
+ * @constructor
+ * @extends ApiPivotField
+ * @property {DataConsolidateFunctionType} Function - Returns or sets a function for the data field.
+ * @property {number} Position - Returns or sets a value that represents the data field position within a category.
+ * @property {PivotFieldOrientationType} Orientation - Returns a data field orientation value
+ * that represents the data field location in the specified pivot table report.
+ * @property {string} Name - Returns or sets a value representing the object name.
+ * @property {string} Value - Returns or sets a value representing the name of the specified data field in the pivot table report.
+ * @property {string} Caption - Returns or sets a value that represents the label text for the data field.
+ * @property {string | null} NumberFormat - Returns or sets a value that represents the format code for the object.
+ * @property {number} Index - Returns an index of the data field.
+ * @property {ApiPivotField} PivotField - Returns the pivot field from which the data field was created.
+ */
+ function ApiPivotDataField(table, dataIndex, dataField) {
+ const pivotIndex = dataField.asc_getIndex();
+ const pivotField = table.pivot.asc_getPivotFields()[pivotIndex];
+ ApiPivotField.call(this, table, pivotIndex, pivotField);
+ /** @type {number} */
+ this.dataIndex = dataIndex;
+ /** @type {CT_DataField} */
+ this.dataField = dataField;
+
+ }
+ ApiPivotDataField.prototype = Object.create(ApiPivotField.prototype);
+ ApiPivotDataField.prototype.constructor = ApiPivotDataField;
+
+ /**
+ * Class representing a pivot table field item.
+ * @constructor
+ * @property {string} Name - Returns a name of the pivot item.
+ * @property {string} Caption - Returns a caption of the pivot item.
+ * @property {string} Value - Returns a name of the specified item in the pivot table field.
+ * @property {string} Parent - Returns a parent of the pivot item.
+ * @property {string} Field - Returns a field of the pivot item.
+ */
+ function ApiPivotItem(field, item) {
+ /** @type{ApiPivotField} */
+ this.field = field;
+ /** @type{CT_Item} */
+ this.pivotItem = item;
+ }
+
+
/**
* Class representing characters in an object that contains text.
* @constructor
@@ -404,9 +543,11 @@
/**
* Returns a class formatted according to the instructions contained in the format expression.
* @memberof Api
+ * @typeofeditors ["CSE"]
* @param {string} expression - Any valid expression.
* @param {string} [format] - A valid named or user-defined format expression.
* @returns {string}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/Format.js
*/
Api.prototype.Format = function (expression, format) {
format = null == format ? '' : format;
@@ -439,7 +580,7 @@
Api.prototype.AddCustomFunction = function (fCustom) {
// get parsedJSDoc from a macros (we receive it from the Api class)
// take the first element and validate it
- const parsedJSDoc = this.parsedJSDoc.shift();
+ const parsedJSDoc = this.parsedJSDoc && this.parsedJSDoc.shift();
const isValidJsDoc = parsedJSDoc ? private_ValidateParamsForCustomFunction(parsedJSDoc) : false;
//const isValidOptions = options ? private_ValidateParamsForCustomFunction(options) : false;
if (!isValidJsDoc/* && !isValidOptions*/) {
@@ -518,20 +659,38 @@
};
/**
- * Remove a custom function.
+ * Registers a new custom functions library (see the SetCustomFunctions plugin method).
+ * The description of the function parameters and result is specified using JSDoc. The @customfunction tag is required in JSDoc.
+ * Parameters and results can be specified as the number / string / bool / any / number[][] / string[][] / bool[][] / any[][] types.
+ * Parameters can be required or optional. A user can also set a default value.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @param {string} sName - The library name.
+ * @param {Function} Func - The custom functions library code.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/Api/Methods/AddCustomFunction.js
+ */
+ Api.prototype.AddCustomFunctionLibrary = function(sName, Func) {
+ this.addCustomFunctionsLibrary(sName, Func);
+ };
+
+ /**
+ * Removes a custom function.
* @memberof Api
* @typeofeditors ["CSE"]
* @param {string} sName - The name of a custom function.
* @returns {boolean} - returns false if such a function does not exist.
+ * @see office-js-api/Examples/{Editor}/Api/Methods/RemoveCustomFunction.js
*/
Api.prototype.RemoveCustomFunction = function (sName) {
return this.removeCustomFunction(sName);
};
/**
- * Clear all custom functions.
+ * Clears all custom functions.
* @memberof Api
* @typeofeditors ["CSE"]
- * @returns {boolean} - returns false if such a functions does not exist.
+ * @returns {boolean} - returns false if such functions do not exist.
+ * @see office-js-api/Examples/{Editor}/Api/Methods/ClearCustomFunctions.js
*/
Api.prototype.ClearCustomFunctions = function () {
return this.clearCustomFunctions();
@@ -542,6 +701,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @param {string} sName - The name of a new worksheet.
+ * @see office-js-api/Examples/{Editor}/Api/Methods/AddSheet.js
*/
Api.prototype.AddSheet = function (sName) {
if (this.GetSheet(sName))
@@ -555,6 +715,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiWorksheet[]}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetSheets.js
*/
Api.prototype.GetSheets = function () {
var result = [];
@@ -574,6 +735,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @param {number} LCID - The locale specified.
+ * @see office-js-api/Examples/{Editor}/Api/Methods/SetLocale.js
*/
Api.prototype.SetLocale = function (LCID) {
this.asc_setLocale(LCID, null, null);
@@ -584,6 +746,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetLocale.js
*/
Api.prototype.GetLocale = function () {
return this.asc_getLocale();
@@ -594,6 +757,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiWorksheet}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetActiveSheet.js
*/
Api.prototype.GetActiveSheet = function () {
var index = this.wbModel.getActive();
@@ -611,6 +775,7 @@
* @typeofeditors ["CSE"]
* @param {string | number} nameOrIndex - Sheet name or sheet index.
* @returns {ApiWorksheet | null}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetSheet.js
*/
Api.prototype.GetSheet = function (nameOrIndex) {
var ws = ('string' === typeof nameOrIndex) ? this.wbModel.getWorksheetByName(nameOrIndex) :
@@ -623,6 +788,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {string[]}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetThemesColors.js
*/
Api.prototype.GetThemesColors = function () {
var result = [];
@@ -639,6 +805,7 @@
* @typeofeditors ["CSE"]
* @param {string} sTheme - The color scheme that will be set to the current spreadsheet.
* @returns {boolean} - returns false if sTheme isn't a string.
+ * @see office-js-api/Examples/{Editor}/Api/Methods/SetThemeColors.js
*/
Api.prototype.SetThemeColors = function (sTheme) {
if ('string' === typeof sTheme) {
@@ -652,6 +819,7 @@
* Creates a new history point.
* @memberof Api
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/Api/Methods/CreateNewHistoryPoint.js
*/
Api.prototype.CreateNewHistoryPoint = function () {
History.Create_NewPoint();
@@ -665,6 +833,7 @@
* @param {byte} g - Green color component value.
* @param {byte} b - Blue color component value.
* @returns {ApiColor}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/CreateColorFromRGB.js
*/
Api.prototype.CreateColorFromRGB = function (r, g, b) {
return new ApiColor(AscCommonExcel.createRgbColor(r, g, b));
@@ -676,6 +845,7 @@
* @typeofeditors ["CSE"]
* @param {PresetColor} sPresetColor - A preset selected from the list of the available color preset names.
* @returns {ApiColor}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/CreateColorByName.js
*/
Api.prototype.CreateColorByName = function (sPresetColor) {
var rgb = AscFormat.mapPrstColor[sPresetColor];
@@ -689,6 +859,7 @@
* @param {ApiRange} Range1 - One of the intersecting ranges. At least two Range objects must be specified.
* @param {ApiRange} Range2 - One of the intersecting ranges. At least two Range objects must be specified.
* @returns {ApiRange | null}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/Intersect.js
*/
Api.prototype.Intersect = function (Range1, Range2) {
let result = null;
@@ -710,6 +881,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetSelection.js
*/
Api.prototype.GetSelection = function () {
return this.GetActiveSheet().GetSelection();
@@ -729,6 +901,7 @@
* Example: "Sheet1!$A$1:$B$2".
* @param {boolean} isHidden - Defines if the range name is hidden or not.
* @returns {boolean} - returns false if sName or sRef are invalid.
+ * @see office-js-api/Examples/{Editor}/Api/Methods/AddDefName.js
*/
Api.prototype.AddDefName = function (sName, sRef, isHidden) {
return private_AddDefName(this.wbModel, sName, sRef, null, isHidden);
@@ -740,6 +913,7 @@
* @typeofeditors ["CSE"]
* @param {string} defName - The range name.
* @returns {ApiName}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetDefName.js
*/
Api.prototype.GetDefName = function (defName) {
if (defName && typeof defName === "string") {
@@ -752,6 +926,7 @@
* Saves changes to the specified document.
* @memberof Api
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/Api/Methods/Save.js
*/
Api.prototype.Save = function () {
this.SaveAfterMacros = true;
@@ -763,6 +938,7 @@
* @typeofeditors ["CSE"]
* @param {string} sRange - The range of cells from the current sheet.
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetRange.js
*/
Api.prototype.GetRange = function (sRange) {
var ws;
@@ -781,6 +957,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiWorksheetFunction}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetWorksheetFunction.js
*/
Api.prototype.GetWorksheetFunction = function () {
if (!this.oWorksheetFunction) {
@@ -1254,6 +1431,10 @@
"YIELD": "yield"
};
+ /**
+ * Class representing a worksheet function.
+ * @constructor
+ */
function ApiWorksheetFunction(api) {
this.api = api;
}
@@ -1333,9 +1514,12 @@
if (!func) {
return;
}
+ let sendException = function () {
+ throwException(new Error('Arguments count error.'));
+ };
let argsCount = arg.length;
if (!func.checkArguments(argsCount)) {
- throwException(new Error('Arguments count error.'));
+ sendException();
return null;
}
@@ -1348,16 +1532,57 @@
newArguments.push(new AscCommonExcel.cString(arg[i]));
} else if ('boolean' === typeof arg[i]) {
newArguments.push(new AscCommonExcel.cBool(arg[i]));
- } else if (arg[i] instanceof ApiRange ) {
+ } else if (arg[i] instanceof ApiRange) {
//cArea/cRef/cArea3D/cRef3d
if (arg[i].range && arg[i].range.bbox && arg[i].range.worksheet) {
newArguments.push(new AscCommonExcel.cArea3D(arg[i].range.bbox.getName(), arg[i].range.worksheet, arg[i].range.worksheet));
} else {
- throwException(new Error('Arguments type error.'));
+ sendException();
+ return null;
+ }
+ } else if (Array.isArray(arg[i])) {
+ //cArea/cRef/cArea3D/cRef3d
+ if (arg[i] && arg[i].length) {
+
+ let elem = arg[i];
+ let checkedArray = AscCommonExcel.cArray.prototype.checkValidArray.call(null, elem, true);
+ if (checkedArray) {
+ let newArray = new AscCommonExcel.cArray();
+ let bFillRes = newArray.fillFromArray(checkedArray, function (_elem) {
+ if ('number' === typeof _elem) {
+ return new AscCommonExcel.cNumber(_elem);
+ } else if ('string' === typeof _elem) {
+ return new AscCommonExcel.cString(_elem);
+ } else if ('boolean' === typeof _elem) {
+ return new AscCommonExcel.cBool(_elem);
+ }
+ return null;
+ });
+ if (bFillRes && newArray.isValidArray()) {
+ newArguments.push(newArray);
+ } else {
+ sendException();
+ return null;
+ }
+ } else {
+ sendException();
+ return null;
+ }
+ } else {
+ sendException();
return null;
}
+ } else if (arg[i] instanceof ApiName) {
+ let _name = arg[i].GetName && arg[i].GetName();
+ let _ws = arg[i].DefName && arg[i].DefName.parsedRef && arg[i].DefName.parsedRef.ws;
+ if (_name && _ws) {
+ let oName = new AscCommonExcel.cName(_name, _ws);
+ let nameRes = oName.getValue && oName.getValue();
+ newArguments.push(nameRes);
+ }
+
} else {
- throwException(new Error('Arguments type error.'));
+ sendException();
return null;
}
}
@@ -1374,14 +1599,15 @@
return null;
}
-
+ let isArray = null;
if (AscCommonExcel.cElementType.cell === result.type || AscCommonExcel.cElementType.cell3D === result.type) {
result = result.getValue();
if (AscCommonExcel.cElementType.empty === result.type) {
result = new AscCommonExcel.cNumber(0);
}
} else if (AscCommonExcel.cElementType.array === result.type) {
- result = result.getElement(0);
+ result = result.toArray(true, null, null, true);
+ isArray = true;
} else if (AscCommonExcel.cElementType.cellsRange === result.type || AscCommonExcel.cElementType.cellsRange3D === result.type) {
if (AscCommonExcel.cElementType.cellsRange === result.type) {
result = result.getValue2(0, 0);
@@ -1390,9 +1616,15 @@
}
}
- if (result && result.getValue) {
- result = result.getValue();
- } else {
+ if (!isArray && result) {
+ if (result.type === AscCommonExcel.cElementType.bool) {
+ result = result.toBool();
+ } else if (result.getValue) {
+ result = result.getValue();
+ }
+ }
+
+ if (result == null) {
throwException(new Error('Result type error.'));
return null;
}
@@ -1466,96 +1698,111 @@
};
/**
- * For Double-byte character set (DBCS) languages, the function changes full-width (double-byte) characters to half-width (single-byte) characters.
+ * For double-byte character set (DBCS) languages, the function changes full-width (double-byte) characters to half-width (single-byte) characters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text or a reference to a cell containing the text to change.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ASC.js
*/
ApiWorksheetFunction.prototype.ASC = function (arg1) {
return this.private_calculateFunction("ASC", arguments);
};
/**
- * Returns the character specified by the code number from the character set for your computer.
+ * Returns the character specified by the code number from your computer's character set.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number between 1 and 255 specifying which character you want.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number between 1 and 255 specifying a character from the computer character set.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHAR.js
*/
ApiWorksheetFunction.prototype.CHAR = function (arg1) {
return this.private_calculateFunction("CHAR", arguments);
};
/**
- * Removes all nonprintable characters from text.
+ * Removes all the nonprintable characters from the text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is any worksheet information from which you want to remove nonprintable characters.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - A string from which nonprintable characters will be removed.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CLEAN.js
*/
ApiWorksheetFunction.prototype.CLEAN = function (arg1) {
return this.private_calculateFunction("CLEAN", arguments);
};
/**
- * Returns a numeric code for the first character in a text string, in the character set used by your computer.
+ * Returns the code number from your computer's character set for the first character in the specified text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text for which you want the code of the first character.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text for which to get the code of the first character.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CODE.js
*/
ApiWorksheetFunction.prototype.CODE = function (arg1) {
return this.private_calculateFunction("CODE", arguments);
};
/**
- * Joins several text strings into one text string.
+ * Combines multiple text strings into one text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg_n - Up to 255 data values that will be combined.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CONCATENATE.js
*/
ApiWorksheetFunction.prototype.CONCATENATE = function () {
return this.private_calculateFunction("CONCATENATE", arguments);
};
/**
- * Converts a number to text, using currency format.
+ * Converts a number to text, using a currency format $#.##.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number, a reference to a cell containing a number, or a formula that evaluates to a number.
- * @param {?number} arg2 Is the number of digits to the right of the decimal point. The number is rounded as necessary; if omitted, Decimals = 2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string} arg1 - A number, a reference to a cell containing a number, or a formula that returns a number.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number of digits to the right of the decimal point. The number is rounded as necessary.
+ * If it is omitted, the function will assume it to be 2.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DOLLAR.js
*/
ApiWorksheetFunction.prototype.DOLLAR = function (arg1, arg2) {
return this.private_calculateFunction("DOLLAR", arguments);
};
/**
- * Checks whether two text strings are exactly the same, and returns TRUE or FALSE. EXACT is case-sensitive.
+ * Checks whether two text strings are exactly the same, and returns true or false. This function is case-sensitive.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the first text string.
- * @param {string} arg2 Is the second text string.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The first text string.
+ * @param {ApiRange | ApiName | string} arg2 - The second text string.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EXACT.js
*/
ApiWorksheetFunction.prototype.EXACT = function (arg1, arg2) {
return this.private_calculateFunction("EXACT", arguments);
};
/**
- * Returns the starting position of one text string within another text string. FIND is case-sensitive.
+ * Returns the starting position of one text string within another text string. This function is case-sensitive.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text you want to find. Use double quotes (empty text) to match the first character in Within_text; wildcard characters not allowed.
- * @param {string} arg2 Is the text containing the text you want to find.
- * @param {?number} arg3 Specifies the character at which to start the search. The first character in Within_text is character number 1. If omitted, Start_num = 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text to find. Use double quotes (empty text) to match the first character in the search string.
+ * Wildcard characters are not allowed.
+ * @param {ApiRange | ApiName | string} arg2 - The text containing the text to find.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - Specifies the character at which to start the search. The first character in the search string is character number 1.
+ * If omitted, this parameter is equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FIND.js
*/
ApiWorksheetFunction.prototype.FIND = function (arg1, arg2, arg3) {
return this.private_calculateFunction("FIND", arguments);
};
/**
- * Finds the specified substring (string-1) within a string (string-2) and is intended for languages the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Finds the specified substring within another string and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @param {string} arg2.
- * @param {?number} arg3.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text to find. Use double quotes (empty text) to match the first character in the search string.
+ * Wildcard characters are not allowed.
+ * @param {ApiRange | ApiName | string} arg2 - The text containing the text to find.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - Specifies the character at which to start the search. The first character in the search string is character number 1.
+ * If omitted, this parameter is equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FINDB.js
*/
ApiWorksheetFunction.prototype.FINDB = function (arg1, arg2, arg3) {
return this.private_calculateFunction("FINDB", arguments);
@@ -1564,10 +1811,11 @@
* Rounds a number to the specified number of decimals and returns the result as text with or without commas.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number you want to round and convert to text.
- * @param {?number} arg2 Is the number of digits to the right of the decimal point. If omitted, Decimals = 2.
- * @param {?boolean} arg3 Is a logical value: do not display commas in the returned text = TRUE; do display commas in the returned text = FALSE or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number to round and convert to text.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of digits to the right of the decimal point. If omitted, the function will assume it to be 2.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - Specifies whether do display commas in the returned text (false or omitted) or not (true).
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FIXED.js
*/
ApiWorksheetFunction.prototype.FIXED = function (arg1, arg2, arg3) {
return this.private_calculateFunction("FIXED", arguments);
@@ -1576,20 +1824,22 @@
* Returns the specified number of characters from the start of a text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text string containing the characters you want to extract.
- * @param {?number} arg2 Specifies how many characters you want LEFT to extract; 1 if omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text string containing the characters to extract.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number of the substring characters. It must be greater than or equal to 0.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LEFT.js
*/
ApiWorksheetFunction.prototype.LEFT = function (arg1, arg2) {
return this.private_calculateFunction("LEFT", arguments);
};
/**
- * Extracts the substring from the specified string starting from the left character and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Extracts the substring from the specified string starting from the left character and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @param {?number} arg2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text string containing the characters to extract.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number of the substring characters, based on bytes.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LEFTB.js
*/
ApiWorksheetFunction.prototype.LEFTB = function (arg1, arg2) {
return this.private_calculateFunction("LEFTB", arguments);
@@ -1598,18 +1848,20 @@
* Returns the number of characters in a text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text whose length you want to find. Spaces count as characters.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text whose length will be returned. Spaces are considered as characters.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LEN.js
*/
ApiWorksheetFunction.prototype.LEN = function (arg1) {
return this.private_calculateFunction("LEN", arguments);
};
/**
- * Analyses the specified string and returns the number of characters it contains and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Analyses the specified string and returns the number of characters it contains and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text whose length will be returned. Spaces are considered as characters.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LENB.js
*/
ApiWorksheetFunction.prototype.LENB = function (arg1) {
return this.private_calculateFunction("LENB", arguments);
@@ -1618,8 +1870,9 @@
* Converts all letters in a text string to lowercase.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text you want to convert to lowercase. Characters in Text that are not letters are not changed.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text to convert to lowercase. The text characters that are not letters are not changed.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOWER.js
*/
ApiWorksheetFunction.prototype.LOWER = function (arg1) {
return this.private_calculateFunction("LOWER", arguments);
@@ -1628,44 +1881,48 @@
* Returns the characters from the middle of a text string, given a starting position and length.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text string from which you want to extract the characters.
- * @param {number} arg2 Is the position of the first character you want to extract. The first character in Text is 1.
- * @param {number} arg3 Specifies how many characters to return from Text.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text string from which to extract the characters.
+ * @param {ApiRange | ApiName | number} arg2 - The position of the first character to extract. The first text character is 1.
+ * @param {ApiRange | ApiName | number} arg3 - A number of the characters to extract.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MID.js
*/
ApiWorksheetFunction.prototype.MID = function (arg1, arg2, arg3) {
return this.private_calculateFunction("MID", arguments);
};
/**
- * Extracts the characters from the specified string starting from any position and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Extracts the characters from the specified string starting from any position and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @param {number} arg2.
- * @param {number} arg3.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text string from which to extract the characters.
+ * @param {ApiRange | ApiName | number} arg2 - The position of the first character to extract. The first text character is 1.
+ * @param {ApiRange | ApiName | number} arg3 - A number of the characters to extract, based on bytes.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MIDB.js
*/
ApiWorksheetFunction.prototype.MIDB = function (arg1, arg2, arg3) {
return this.private_calculateFunction("MIDB", arguments);
};
/**
- * Converts text to number in a locale-independent manner.
+ * Converts text to a number, in a locale-independent way.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the string representing the number you want to convert.
- * @param {?string} arg2 Is the character used as the decimal separator in the string.
- * @param {?string} arg3 Is the character used as the group separator in the string.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The string representing a number to convert.
+ * @param {?ApiRange | ?ApiName | ?string} arg2 - The character used as the decimal separator in the string.
+ * @param {?ApiRange | ?ApiName | ?string} arg3 - The character used as the group separator in the string.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NUMBERVALUE.js
*/
ApiWorksheetFunction.prototype.NUMBERVALUE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("NUMBERVALUE", arguments);
};
/**
- * Converts a text string to proper case; the first letter in each word to uppercase, and all other letters to lowercase.
+ * Converts a text string to proper case: the first letter in each word to uppercase, and all other letters to lowercase.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is text enclosed in quotation marks, a formula that returns text, or a reference to a cell containing text to partially capitalize.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text enclosed in quotation marks, a formula that returns text, or a reference to a cell containing text to partially capitalize.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PROPER.js
*/
ApiWorksheetFunction.prototype.PROPER = function (arg1) {
return this.private_calculateFunction("PROPER", arguments);
@@ -1674,35 +1931,38 @@
* Replaces part of a text string with a different text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is text in which you want to replace some characters.
- * @param {number} arg2 Is the position of the character in Old_text that you want to replace with New_text.
- * @param {number} arg3 Is the number of characters in Old_text that you want to replace.
- * @param {string} arg4 Is the text that will replace characters in Old_text.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text where some characters will be replaced.
+ * @param {ApiRange | ApiName | number} arg2 - The position of the character in the original text that will be replaced with the new text.
+ * @param {ApiRange | ApiName | number} arg3 - The number of characters in the original text that will be replaced.
+ * @param {ApiRange | ApiName | string} arg4 - The text that will replace characters in the original text.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/REPLACE.js
*/
ApiWorksheetFunction.prototype.REPLACE = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("REPLACE", arguments);
};
/**
- * Replaces a set of characters, based on the number of characters and the start position you specify, with a new set of characters and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Replaces a set of characters, based on the number of characters and the start position specified, with a new set of characters and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @param {number} arg2.
- * @param {number} arg3.
- * @param {string} arg4.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text where some characters will be replaced.
+ * @param {ApiRange | ApiName | number} arg2 - The position of the character in the original text that will be replaced with the new text.
+ * @param {ApiRange | ApiName | number} arg3 - The number of characters in the original text that will be replaced, based on bytes.
+ * @param {ApiRange | ApiName | string} arg4 - The text that will replace characters in the original text.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/REPLACEB.js
*/
ApiWorksheetFunction.prototype.REPLACEB = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("REPLACEB", arguments);
};
/**
- * Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.
+ * Repeats text a given number of times. Use this function to fill a cell with a number of instances of a text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text you want to repeat.
- * @param {number} arg2 Is a positive number specifying the number of times to repeat text.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text that will be repeated.
+ * @param {ApiRange | ApiName | number} arg2 - A positive number specifying the number of times to repeat text.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/REPT.js
*/
ApiWorksheetFunction.prototype.REPT = function (arg1, arg2) {
return this.private_calculateFunction("REPT", arguments);
@@ -1711,20 +1971,22 @@
* Returns the specified number of characters from the end of a text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text string that contains the characters you want to extract.
- * @param {?number} arg2 Specifies how many characters you want to extract, 1 if omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text string that contains the characters to extract.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number of the substring characters. If it is omitted, the function will assume it to be 1.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RIGHT.js
*/
ApiWorksheetFunction.prototype.RIGHT = function (arg1, arg2) {
return this.private_calculateFunction("RIGHT", arguments);
};
/**
- * Extracts a substring from a string starting from the right-most character, based on the specified number of characters and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Extracts a substring from a string starting from the right-most character, based on the specified number of characters and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @param {?number} arg2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text string that contains the characters to extract.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number of the substring characters, based on bytes.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RIGHTB.js
*/
ApiWorksheetFunction.prototype.RIGHTB = function (arg1, arg2) {
return this.private_calculateFunction("RIGHTB", arguments);
@@ -1733,22 +1995,24 @@
* Returns the number of the character at which a specific character or text string is first found, reading left to right (not case-sensitive).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text you want to find. You can use the ? and * wildcard characters; use ~? and ~* to find the ? and * characters.
- * @param {string} arg2 Is the text in which you want to search for Find_text.
- * @param {?number} arg3 Is the character number in Within_text, counting from the left, at which you want to start searching. If omitted, 1 is used.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text to find. The ? and * wildcard characters can be used. Use ~? and ~* to find the ? and * characters.
+ * @param {ApiRange | ApiName | string} arg2 - The text where to search for the specified text.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - The character number in the search text, counting from the left, at which to start searching. If omitted, 1 is used.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SEARCH.js
*/
ApiWorksheetFunction.prototype.SEARCH = function (arg1, arg2, arg3) {
return this.private_calculateFunction("SEARCH", arguments);
};
/**
- * Returns the location of the specified substring in a string and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc..
+ * Returns the location of the specified substring in a string and is intended for languages that use the double-byte character set (DBCS) like Japanese, Chinese, Korean etc.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1.
- * @param {string} arg2.
- * @param {?number} arg3.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text to find. The ? and * wildcard characters can be used. Use ~? and ~* to find the ? and * characters.
+ * @param {ApiRange | ApiName | string} arg2 - The text where to search for the specified text.
+ * @param {?ApiRange | ApiName | ?number} arg3 - The character number in the search text, counting from the left, at which to start searching. If omitted, 1 is used.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SEARCHB.js
*/
ApiWorksheetFunction.prototype.SEARCHB = function (arg1, arg2, arg3) {
return this.private_calculateFunction("SEARCHB", arguments);
@@ -1757,11 +2021,12 @@
* Replaces existing text with new text in a text string.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text or the reference to a cell containing text in which you want to substitute characters.
- * @param {string} arg2 Is the existing text you want to replace. If the case of Old_text does not match the case of text, SUBSTITUTE will not replace the text.
- * @param {string} arg3 Is the text you want to replace Old_text with.
- * @param {?string} arg4 Specifies which occurrence of Old_text you want to replace. If omitted, every instance of Old_text is replaced.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text or the reference to a cell containing text in which the characters will be substituted.
+ * @param {ApiRange | ApiName | string} arg2 - The existing text to replace. If the case of the original text does not match the case of text, the function will not replace the text.
+ * @param {ApiRange | ApiName | string} arg3 - The text to replace the original text with.
+ * @param {?ApiRange | ?ApiName | ?string} arg4 - Specifies which occurrence of the original text to replace. If omitted, every instance of the original text will be replaced.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SUBSTITUTE.js
*/
ApiWorksheetFunction.prototype.SUBSTITUTE = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("SUBSTITUTE", arguments);
@@ -1770,8 +2035,9 @@
* Checks whether a value is text, and returns the text if it is, or returns double quotes (empty text) if it is not.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to test.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string | boolean} arg1 - The value to test.
+ * @returns {ApiRange | ApiName | string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/T.js
*/
ApiWorksheetFunction.prototype.T = function (arg1) {
return this.private_calculateFunction("T", arguments);
@@ -1780,9 +2046,10 @@
* Converts a value to text in a specific number format.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a number, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.
- * @param {string} arg2 Is a number format in text form from the Category box on the Number tab in the Format Cells dialog box.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string} arg1 - A number, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.
+ * @param {ApiRange | ApiName | string} arg2 - A number format in the text form from the Number format combo box on the Home tab.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TEXT.js
*/
ApiWorksheetFunction.prototype.TEXT = function (arg1, arg2) {
return this.private_calculateFunction("TEXT", arguments);
@@ -1791,8 +2058,9 @@
* Removes all spaces from a text string except for single spaces between words.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text from which you want spaces removed.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text from which the spaces will be removed.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TRIM.js
*/
ApiWorksheetFunction.prototype.TRIM = function (arg1) {
return this.private_calculateFunction("TRIM", arguments);
@@ -1801,8 +2069,9 @@
* Returns the Unicode character referenced by the given numeric value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the Unicode number representing a character.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The Unicode number representing a character.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/UNICHAR.js
*/
ApiWorksheetFunction.prototype.UNICHAR = function (arg1) {
return this.private_calculateFunction("UNICHAR", arguments);
@@ -1811,8 +2080,9 @@
* Returns the number (code point) corresponding to the first character of the text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the character that you want the Unicode value of.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The character for which the Unicode value will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/UNICODE.js
*/
ApiWorksheetFunction.prototype.UNICODE = function (arg1) {
return this.private_calculateFunction("UNICODE", arguments);
@@ -1821,8 +2091,9 @@
* Converts a text string to all uppercase letters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text you want converted to uppercase, a reference or a text string.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text which will be converted to uppercase, a reference or a text string.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/UPPER.js
*/
ApiWorksheetFunction.prototype.UPPER = function (arg1) {
return this.private_calculateFunction("UPPER", arguments);
@@ -1831,56 +2102,74 @@
* Converts a text string that represents a number to a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the text enclosed in quotation marks or a reference to a cell containing the text you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text enclosed in quotation marks or a reference to a cell containing the text which will be converted to a number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VALUE.js
*/
ApiWorksheetFunction.prototype.VALUE = function (arg1) {
return this.private_calculateFunction("VALUE", arguments);
};
/**
- * Returns the average of the absolute deviations of data points from their mean. Arguments can be numbers or names, arrays or references that contain numbers.
+ * Returns the average of the absolute deviations of data points from their mean.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | number[]} args - Up to 255 numeric values for which the average of the absolute deviations will be returned. The first argument is required,
+ * subsequent arguments are optional. Arguments can be numbers, names, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AVEDEV.js
*/
ApiWorksheetFunction.prototype.AVEDEV = function () {
return this.private_calculateFunction("AVEDEV", arguments);
};
/**
- * Returns the average (arithmetic mean) of its arguments, which can be numbers or names, arrays or references that contain numbers.
+ * Returns the average (arithmetic mean) of the specified arguments.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | number[]} args - Up to 255 numeric values for which the average value will be returned. The first argument is required,
+ * subsequent arguments are optional. Arguments can be numbers, names, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AVERAGE.js
*/
ApiWorksheetFunction.prototype.AVERAGE = function () {
return this.private_calculateFunction("AVERAGE", arguments);
};
/**
- * Returns the average (arithmetic mean) of its arguments, evaluating text and FALSE in arguments as 0; TRUE evaluates as 1. Arguments can be numbers, names, arrays or references.
+ * Returns the average (arithmetic mean) of the specified arguments, evaluating text and false in arguments as 0; true evaluates as 1.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string | number[]} args - Up to 255 numeric values for which the average value will be returned. The first argument is required,
+ * subsequent arguments are optional. Arguments can be numbers, text, or logical values, such as true and false, names, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AVERAGEA.js
*/
ApiWorksheetFunction.prototype.AVERAGEA = function () {
return this.private_calculateFunction("AVERAGEA", arguments);
};
/**
- * Finds average (arithmetic mean) for the cells specified by a given condition or criteria.
+ * Finds the average (arithmetic mean) for the cells specified by a given condition or criteria.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells you want evaluated.
- * @param {any} arg2 Is the condition or criteria in the form of a number, expression, or text that defines which cells will be used to find the average.
- * @param {?ApiRange} arg3 Are the actual cells to be used to find the average. If omitted, the cells in range are used.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells which will be evaluated.
+ * @param {ApiRange | ApiName | number | string} arg2 - The condition or criteria in the form of a number, expression, or text that defines which cells will be used to find the average.
+ * @param {?ApiRange | ?ApiName} arg3 - The actual cells to be used to find the average. If omitted, the cells in the range are used.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AVERAGEIF.js
*/
ApiWorksheetFunction.prototype.AVERAGEIF = function (arg1, arg2, arg3) {
return this.private_calculateFunction("AVERAGEIF", arguments);
};
/**
- * Finds average (arithmetic mean) for the cells specified by a given set of conditions or criteria.
+ * Finds the average (arithmetic mean) for the cells specified by a given set of conditions or criteria.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells which will be evaluated.
+ * @param {ApiRange | ApiName | number | string} arg2 - The first condition or criteria in the form of a number, expression, or text that defines which cells will be used to find the average.
+ * @param {?ApiRange | ?ApiName} arg3 - The actual cells to be used to find the average. If omitted, the cells in the range are used.
+ * @param {?ApiRange | ?ApiName | ?number | ?string} arg4 - Up to 127 additional conditions or criteria in the form of a number, expression, or text that defines which cells will be used to find the average.
+ * These arguments are optional.
+ * @param {?ApiRange | ?ApiName} arg5 - Up to 127 actual ranges to be used to find the average. If omitted, the cells in the range are used. These arguments are optional.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AVERAGEIFS.js
*/
ApiWorksheetFunction.prototype.AVERAGEIFS = function () {
return this.private_calculateFunction("AVERAGEIFS", arguments);
@@ -1889,12 +2178,13 @@
* Returns the cumulative beta probability density function.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value between A and B at which to evaluate the function.
- * @param {number} arg2 Is a parameter to the distribution and must be greater than 0.
- * @param {number} arg3 Is a parameter to the distribution and must be greater than 0.
- * @param {?number} arg4 Is an optional lower bound to the interval of x. If omitted, A = 0.
- * @param {?number} arg5 Is an optional upper bound to the interval of x. If omitted, B = 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value between A and B at which to evaluate the function.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution which must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution which must be greater than 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An optional lower bound to the interval of x (A). If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional upper bound to the interval of x (B). If omitted, it is equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BETADIST.js
*/
ApiWorksheetFunction.prototype.BETADIST = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("BETADIST", arguments);
@@ -1903,41 +2193,44 @@
* Returns the beta probability distribution function.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value between A and B at which to evaluate the function.
- * @param {number} arg2 Is a parameter to the distribution and must be greater than 0.
- * @param {number} arg3 Is a parameter to the distribution and must be greater than 0.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
- * @param {?number} arg5 Is an optional lower bound to the interval of x. If omitted, A = 0.
- * @param {?number} arg6 Is an optional upper bound to the interval of x. If omitted, B = 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value between A and B at which to evaluate the function.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution which must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution which must be greater than 0.
+ * @param {ApiRange | ApiName | boolean} arg4 - Specifies if this is the cumulative distribution function (true) or the probability density function (false).
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional lower bound to the interval of x (A). If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - An optional upper bound to the interval of x (B). If omitted, it is equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BETA_DIST.js
*/
ApiWorksheetFunction.prototype.BETA_DIST = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("BETA.DIST", arguments);
};
/**
- * Returns the inverse of the cumulative beta probability density function (BETA.DIST).
+ * Returns the inverse of the cumulative beta probability density function (BETA_DIST).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the beta distribution.
- * @param {number} arg2 Is a parameter to the distribution and must be greater than 0.
- * @param {number} arg3 Is a parameter to the distribution and must be greater than 0.
- * @param {?number} arg4 Is an optional lower bound to the interval of x. If omitted, A = 0.
- * @param {?number} arg5 Is an optional upper bound to the interval of x. If omitted, B = 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the beta distribution.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution which must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution which must be greater than 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An optional lower bound to the interval of x (A). If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional upper bound to the interval of x (B). If omitted, it is equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BETA_INV.js
*/
ApiWorksheetFunction.prototype.BETA_INV = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("BETA.INV", arguments);
};
/**
- * Returns the inverse of the cumulative beta probability density function (BETADIST).
+ * Returns the inverse of the cumulative beta probability density function for a specified beta distribution (BETADIST).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the beta distribution.
- * @param {number} arg2 Is a parameter to the distribution and must be greater than 0.
- * @param {number} arg3 Is a parameter to the distribution and must be greater than 0.
- * @param {?number} arg4 Is an optional lower bound to the interval of x. If omitted, A = 0.
- * @param {?number} arg5 Is an optional upper bound to the interval of x. If omitted, B = 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the beta distribution.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution which must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution which must be greater than 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An optional lower bound to the interval of x (A). If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional upper bound to the interval of x (B). If omitted, it is equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BETAINV.js
*/
ApiWorksheetFunction.prototype.BETAINV = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("BETAINV", arguments);
@@ -1946,11 +2239,12 @@
* Returns the individual term binomial distribution probability.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of successes in trials.
- * @param {number} arg2 Is the number of independent trials.
- * @param {number} arg3 Is the probability of success on each trial.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of successes in trials.
+ * @param {ApiRange | ApiName | number} arg2 - The number of independent trials.
+ * @param {ApiRange | ApiName | number} arg3 - The probability of success on each trial.
+ * @param {ApiRange | ApiName | boolean} arg4 - Specifies if this is the cumulative distribution function (true) or the probability mass function (false).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BINOMDIST.js
*/
ApiWorksheetFunction.prototype.BINOMDIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("BINOMDIST", arguments);
@@ -1959,11 +2253,12 @@
* Returns the individual term binomial distribution probability.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of successes in trials.
- * @param {number} arg2 Is the number of independent trials.
- * @param {number} arg3 Is the probability of success on each trial.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of successes in trials.
+ * @param {ApiRange | ApiName | number} arg2 - The number of independent trials.
+ * @param {ApiRange | ApiName | number} arg3 - The probability of success on each trial.
+ * @param {ApiRange | ApiName | boolean} arg4 - Specifies if this is the cumulative distribution function (true) or the probability mass function (false).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BINOM_DIST.js
*/
ApiWorksheetFunction.prototype.BINOM_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("BINOM.DIST", arguments);
@@ -1972,11 +2267,13 @@
* Returns the probability of a trial result using a binomial distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of independent trials.
- * @param {number} arg2 Is the probability of success on each trial.
- * @param {number} arg3 Is the number of successes in trials.
- * @param {?number} arg4 If provided this function returns the probability that the number of successful trials shall lie between number_s and number_s2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of independent trials.
+ * @param {ApiRange | ApiName | number} arg2 - The probability of success on each trial.
+ * @param {ApiRange | ApiName | number} arg3 - The minimum number of successes in the trials to calculate probability for, a numeric value greater than or equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The maximum number of successes in the trials to calculate probability for,
+ * a numeric value greater than the minimum number of successes and less than or equal to trials.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BINOM_DIST_RANGE.js
*/
ApiWorksheetFunction.prototype.BINOM_DIST_RANGE = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("BINOM.DIST.RANGE", arguments);
@@ -1985,10 +2282,11 @@
* Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of Bernoulli trials.
- * @param {number} arg2 Is the probability of success on each trial, a number between 0 and 1 inclusive.
- * @param {number} arg3 Is the criterion value, a number between 0 and 1 inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of Bernoulli trials.
+ * @param {ApiRange | ApiName | number} arg2 - The probability of success on each trial, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg3 - The criterion value, a number between 0 and 1 inclusive.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BINOM_INV.js
*/
ApiWorksheetFunction.prototype.BINOM_INV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("BINOM.INV", arguments);
@@ -1997,9 +2295,10 @@
* Returns the right-tailed probability of the chi-squared distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which you want to evaluate the distribution, a nonnegative number.
- * @param {number} arg2 Is the number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which the distribution will be evaluated, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHIDIST.js
*/
ApiWorksheetFunction.prototype.CHIDIST = function (arg1, arg2) {
return this.private_calculateFunction("CHIDIST", arguments);
@@ -2008,9 +2307,10 @@
* Returns the inverse of the right-tailed probability of the chi-squared distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the chi-squared distribution, a value between 0 and 1 inclusive.
- * @param {number} arg2 Is the number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the chi-squared distribution, a value between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHIINV.js
*/
ApiWorksheetFunction.prototype.CHIINV = function (arg1, arg2) {
return this.private_calculateFunction("CHIINV", arguments);
@@ -2019,10 +2319,12 @@
* Returns the left-tailed probability of the chi-squared distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which you want to evaluate the distribution, a nonnegative number.
- * @param {number} arg2 Is the number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {boolean} arg3 Is a logical value for the function to return: the cumulative distribution function = TRUE; the probability density function = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which the distribution will be evaluated, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | boolean} arg3 - A logical value that determines the form of the function. If this argument is equal to true,
+ * the cumulative distribution function is returned; if it is equal to false, the probability density function is returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHISQ_DIST.js
*/
ApiWorksheetFunction.prototype.CHISQ_DIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CHISQ.DIST", arguments);
@@ -2031,9 +2333,10 @@
* Returns the right-tailed probability of the chi-squared distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which you want to evaluate the distribution, a nonnegative number.
- * @param {number} arg2 Is the number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which the distribution will be evaluated, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHISQ_DIST_RT.js
*/
ApiWorksheetFunction.prototype.CHISQ_DIST_RT = function (arg1, arg2) {
return this.private_calculateFunction("CHISQ.DIST.RT", arguments);
@@ -2042,9 +2345,10 @@
* Returns the inverse of the left-tailed probability of the chi-squared distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the chi-squared distribution, a value between 0 and 1 inclusive.
- * @param {number} arg2 Is the number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the chi-squared distribution, a value between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2- The number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHISQ_INV.js
*/
ApiWorksheetFunction.prototype.CHISQ_INV = function (arg1, arg2) {
return this.private_calculateFunction("CHISQ.INV", arguments);
@@ -2053,9 +2357,10 @@
* Returns the inverse of the right-tailed probability of the chi-squared distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the chi-squared distribution, a value between 0 and 1 inclusive.
- * @param {number} arg2 Is the number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the chi-squared distribution, a value between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The number of degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHISQ_INV_RT.js
*/
ApiWorksheetFunction.prototype.CHISQ_INV_RT = function (arg1, arg2) {
return this.private_calculateFunction("CHISQ.INV.RT", arguments);
@@ -2079,9 +2384,10 @@
* Returns the test for independence: the value from the chi-squared distribution for the statistic and the appropriate degrees of freedom.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the range of data that contains observations to test against expected values.
- * @param {any} arg2 Is the range of data that contains the ratio of the product of row totals and column totals to the grand total.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string | boolean} arg1 - The range of data that contains observations to test against expected values.
+ * @param {ApiRange | ApiName | number | string | boolean} arg2 - The range of data that contains the ratio of the product of row totals and column totals to the grand total.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHITEST.js
*/
ApiWorksheetFunction.prototype.CHITEST = function (arg1, arg2) {
return this.private_calculateFunction("CHITEST", arguments);
@@ -2102,10 +2408,11 @@
* Returns the confidence interval for a population mean, using a normal distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the significance level used to compute the confidence level, a number greater than 0 and less than 1.
- * @param {number} arg2 Is the population standard deviation for the data range and is assumed to be known. Standard_dev must be greater than 0.
- * @param {number} arg3 Is the sample size.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The significance level used to compute the confidence level, a number greater than 0 and less than 1.
+ * @param {ApiRange | ApiName | number} arg2 - The population standard deviation for the data range and is assumed to be known. This value must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The sample size.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CONFIDENCE.js
*/
ApiWorksheetFunction.prototype.CONFIDENCE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CONFIDENCE", arguments);
@@ -2114,22 +2421,24 @@
* Returns the confidence interval for a population mean, using a normal distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the significance level used to compute the confidence level, a number greater than 0 and less than 1.
- * @param {number} arg2 Is the population standard deviation for the data range and is assumed to be known. Standard_dev must be greater than 0.
- * @param {number} arg3 Is the sample size.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The significance level used to compute the confidence level, a number greater than 0 and less than 1.
+ * @param {ApiRange | ApiName | number} arg2 - The population standard deviation for the data range and is assumed to be known. This value must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The sample size.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CONFIDENCE_NORM.js
*/
ApiWorksheetFunction.prototype.CONFIDENCE_NORM = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CONFIDENCE.NORM", arguments);
};
/**
- * Returns the confidence interval for a population mean, using a Student's T distribution.
+ * Returns the confidence interval for a population mean, using a Student's t distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the significance level used to compute the confidence level, a number greater than 0 and less than 1.
- * @param {number} arg2 Is the population standard deviation for the data range and is assumed to be known. Standard_dev must be greater than 0.
- * @param {number} arg3 Is the sample size.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The significance level used to compute the confidence level, a number greater than 0 and less than 1.
+ * @param {ApiRange | ApiName | number} arg2 - The population standard deviation for the data range and is assumed to be known. This value must be greater than 0.
+ * @param {ApiRange | ApiName | number} arg3 - The sample size.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CONFIDENCE_T.js
*/
ApiWorksheetFunction.prototype.CONFIDENCE_T = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CONFIDENCE.T", arguments);
@@ -2147,49 +2456,62 @@
// return this.private_calculateFunction("CORREL", arguments);
// };
/**
- * Counts the number of cells in a range that contain numbers.
+ * Counts a number of cells in a range that contains numbers ignoring empty cells or those contaning text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {string | number | boolean | ApiRange | array | ApiName} args - Up to 255 items, or ranges to count numbers.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values and text representations of numbers, ranges, names, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUNT.js
*/
ApiWorksheetFunction.prototype.COUNT = function () {
return this.private_calculateFunction("COUNT", arguments);
};
/**
- * Counts the number of cells in a range that are not empty.
+ * Counts a number of cells in a range that are not empty.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {string | number | boolean | ApiRange | array | ApiName} args - Up to 255 items, or ranges to count values.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values, text strings, ranges, names, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUNTA.js
*/
ApiWorksheetFunction.prototype.COUNTA = function () {
return this.private_calculateFunction("COUNTA", arguments);
};
/**
- * Counts the number of empty cells in a specified range of cells.
+ * Counts a number of empty cells in a specified range of cells.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range from which you want to count the empty cells.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range to count the empty cells.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUNTBLANK.js
*/
ApiWorksheetFunction.prototype.COUNTBLANK = function (arg1) {
return this.private_calculateFunction("COUNTBLANK", arguments);
};
/**
- * Counts the number of cells within a range that meet the given condition.
+ * Counts a number of cells within a range that meet the given condition.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells from which you want to count nonblank cells.
- * @param {any} arg2 Is the condition in the form of a number, expression, or text that defines which cells will be counted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells to count nonblank cells.
+ * @param {ApiRange | ApiName | number | string} arg2 - The condition in the form of a number, expression, or text that defines which cells will be counted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUNTIF.js
*/
ApiWorksheetFunction.prototype.COUNTIF = function (arg1, arg2) {
return this.private_calculateFunction("COUNTIF", arguments);
};
/**
- * Counts the number of cells specified by a given set of conditions or criteria.
+ * Counts a number of cells specified by a given set of conditions or criteria.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The first range of cells to count nonblank cells.
+ * @param {ApiRange | ApiName | number | string} arg2 - The first condition in the form of a number, expression, or text that defines which cells will be counted.
+ * @param {ApiRange | ApiName} arg3 - Up to 127 additional ranges of cells to count nonblank cells. This argument is optional.
+ * @param {ApiRange | ApiName | number | string} arg4 - Up to 127 additional conditions in the form of a number, expression, or text that define which cells will be counted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUNTIFS.js
*/
ApiWorksheetFunction.prototype.COUNTIFS = function () {
return this.private_calculateFunction("COUNTIFS", arguments);
@@ -2237,10 +2559,11 @@
* Returns the smallest value for which the cumulative binomial distribution is greater than or equal to a criterion value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of Bernoulli trials.
- * @param {number} arg2 Is the probability of success on each trial, a number between 0 and 1 inclusive.
- * @param {number} arg3 Is the criterion value, a number between 0 and 1 inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of Bernoulli trials.
+ * @param {ApiRange | ApiName | number} arg2 - The probability of success on each trial, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg3 - The criterion value, a number between 0 and 1 inclusive.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CRITBINOM.js
*/
ApiWorksheetFunction.prototype.CRITBINOM = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CRITBINOM", arguments);
@@ -2249,7 +2572,10 @@
* Returns the sum of squares of deviations of data points from their sample mean.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | number[]} args - Up to 255 numerical values for which to find the sum of squares of deviations.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DEVSQ.js
*/
ApiWorksheetFunction.prototype.DEVSQ = function () {
return this.private_calculateFunction("DEVSQ", arguments);
@@ -2258,10 +2584,12 @@
* Returns the exponential distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value of the function, a nonnegative number.
- * @param {number} arg2 Is the parameter value, a positive number.
- * @param {boolean} arg3 Is a logical value for the function to return: the cumulative distribution function = TRUE; the probability density function = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value of the x function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The lambda parameter value, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg3 - A logical value that determines the function form. If this parameter is true,
+ * the function will return the cumulative distribution function, if it is false, it will return the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EXPON_DIST.js
*/
ApiWorksheetFunction.prototype.EXPON_DIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("EXPON.DIST", arguments);
@@ -2270,10 +2598,12 @@
* Returns the exponential distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value of the function, a nonnegative number.
- * @param {number} arg2 Is the parameter value, a positive number.
- * @param {boolean} arg3 Is a logical value for the function to return: the cumulative distribution function = TRUE; the probability density function = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value of the x function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The lambda parameter value, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg3 - A logical value that determines the function form. If this parameter is true,
+ * the function will return the cumulative distribution function, if it is false, it will return the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EXPONDIST.js
*/
ApiWorksheetFunction.prototype.EXPONDIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("EXPONDIST", arguments);
@@ -2282,11 +2612,13 @@
* Returns the (left-tailed) F probability distribution (degree of diversity) for two data sets.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a nonnegative number.
- * @param {number} arg2 Is the numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {number} arg3 Is the denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {boolean} arg4 Is a logical value for the function to return: the cumulative distribution function = TRUE; the probability density function = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | number} arg3 - The denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value that determines the function form. If this parameter is true,
+ * the function will return the cumulative distribution function, if it is false, it will return the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/F_DIST.js
*/
ApiWorksheetFunction.prototype.F_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("F.DIST", arguments);
@@ -2295,10 +2627,11 @@
* Returns the (right-tailed) F probability distribution (degree of diversity) for two data sets.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a nonnegative number.
- * @param {number} arg2 Is the numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {number} arg3 Is the denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | number} arg3 - The denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FDIST.js
*/
ApiWorksheetFunction.prototype.FDIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("FDIST", arguments);
@@ -2307,10 +2640,11 @@
* Returns the (right-tailed) F probability distribution (degree of diversity) for two data sets.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a nonnegative number.
- * @param {number} arg2 Is the numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {number} arg3 Is the denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | number} arg3 - The denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/F_DIST_RT.js
*/
ApiWorksheetFunction.prototype.F_DIST_RT = function (arg1, arg2, arg3) {
return this.private_calculateFunction("F.DIST.RT", arguments);
@@ -2319,10 +2653,11 @@
* Returns the inverse of the (left-tailed) F probability distribution: if p = F.DIST(x,...), then F.INV(p,...) = x.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the F cumulative distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is the numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {number} arg3 Is the denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the F cumulative distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | number} arg3 - The denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/F_INV.js
*/
ApiWorksheetFunction.prototype.F_INV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("F.INV", arguments);
@@ -2331,10 +2666,11 @@
* Returns the inverse of the (right-tailed) F probability distribution: if p = FDIST(x,...), then FINV(p,...) = x.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the F cumulative distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is the numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {number} arg3 Is the denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the F cumulative distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | number} arg3 - The denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FINV.js
*/
ApiWorksheetFunction.prototype.FINV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("FINV", arguments);
@@ -2343,10 +2679,11 @@
* Returns the inverse of the (right-tailed) F probability distribution: if p = F.DIST.RT(x,...), then F.INV.RT(p,...) = x.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the F cumulative distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is the numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @param {number} arg3 Is the denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the F cumulative distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The numerator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @param {ApiRange | ApiName | number} arg3 - The denominator degrees of freedom, a number between 1 and 10^10, excluding 10^10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/F_INV_RT.js
*/
ApiWorksheetFunction.prototype.F_INV_RT = function (arg1, arg2, arg3) {
return this.private_calculateFunction("F.INV.RT", arguments);
@@ -2355,8 +2692,9 @@
* Returns the Fisher transformation.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want the transformation, a number between -1 and 1, excluding -1 and 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for the transformation, a number between -1 and 1, excluding -1 and 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FISHER.js
*/
ApiWorksheetFunction.prototype.FISHER = function (arg1) {
return this.private_calculateFunction("FISHER", arguments);
@@ -2365,8 +2703,9 @@
* Returns the inverse of the Fisher transformation: if y = FISHER(x), then FISHERINV(y) = x.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want to perform the inverse of the transformation.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to perform the inverse of the transformation.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FISHERINV.js
*/
ApiWorksheetFunction.prototype.FISHERINV = function (arg1) {
return this.private_calculateFunction("FISHERINV", arguments);
@@ -2376,7 +2715,7 @@
// * Calculates, or predicts, a future value along a linear trend by using existing values.
// * @memberof ApiWorksheetFunction
// * @typeofeditors ["CSE"]
- // * @param {number} arg1 Is the data point for which you want to predict a value and must be a numeric value.
+ // * @param {ApiRange | ApiName | number} arg1 Is the data point for which you want to predict a value and must be a numeric value.
// * @param {any} arg2 Is the dependent array or range of numeric data.
// * @param {any} arg3 Is the independent array or range of numeric data. The variance of Known_x's must not be zero.
// * @returns {number | string | boolean}
@@ -2385,60 +2724,99 @@
// return this.private_calculateFunction("FORECAST", arguments);
// };
/**
- * Returns the forecasted value for a specific future target date using exponential smoothing method..
+ * A numeric value that specifies which function should be used to aggregate identical time values in the timeline data range.
+ * 1 (or omitted) - AVERAGE.
+ * 2 - COUNT.
+ * 3 - COUNTA.
+ * 4 - MAX.
+ * 5 - MEDIAN.
+ * 6 - MIN.
+ * 7 - SUM.
+ * @typedef {(1 | 2 | 3 | 4 | 5 | 6 | 7)} Aggregation
+ * @see office-js-api/Examples/Enumerations/Aggregation.js
+ */
+
+ /**
+ * Сalculates or predicts a future value based on existing (historical) values by using the AAA version of the Exponential Smoothing (ETS) algorithm.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1.
- * @param {ApiRange} arg2.
- * @param {ApiRange} arg3.
- * @param {?number} arg4.
- * @param {?number} arg5.
- * @param {?number} arg6.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A date for which a new value will be predicted. Must be after the last date in the timeline.
+ * @param {ApiRange | ApiName | number[]} arg2 - A range or an array of numeric data that determines the historical values for which a new point will be predicted.
+ * @param {ApiRange | ApiName} arg3 - A range of date/time values that correspond to the historical values.
+ * The timeline range must be of the same size as the second argument. Date/time values must have a constant step between them and can't be zero.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An optional numeric value that specifies the length of the seasonal pattern. The default value of 1 indicates seasonality is detected automatically.
+ * The 0 value means no seasonality.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional numeric value to handle missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - An optional numeric value to aggregate multiple values with the same time stamp.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FORECAST_ETS.js
*/
ApiWorksheetFunction.prototype.FORECAST_ETS = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("FORECAST.ETS", arguments);
};
/**
- * Returns a confidence interval for the forecast value at the specified target date..
+ * Returns a confidence interval for the forecast value at the specified target date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the data point for which Microsoft Excel predicts a value. It should carry on the pattern of values in the timeline..
- * @param {ApiRange} arg2 Is the array or range of numeric data you're predicting..
- * @param {ApiRange} arg3 Is the independent array or range of numeric data. The dates in the timeline must have a consistent step between them and can't be zero..
- * @param {?number} arg4 Is a number between 0 and 1 that shows the confidence level for the calculated confidence interval. The default value is .95..
- * @param {?number} arg5 Is an optional numeric value that indicates the length of the seasonal pattern. The default value of 1 indicates seasonality is detected automatically..
- * @param {?number} arg6 Is an optional value for handling missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros..
- * @param {?number} arg7 Is an optional numeric value for aggregating multiple values with the same time stamp. If blank, Microsoft Excel .
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A date for which a new value will be predicted. Must be after the last date in the timeline.
+ * @param {ApiRange | ApiName | number[]} arg2 - A range or an array of numeric data that determines the historical values for which a new point will be predicted.
+ * @param {ApiRange | ApiName} arg3 - A range of date/time values that correspond to the historical values.
+ * The timeline range must be of the same size as the second argument. Date/time values must have a constant step between them and can't be zero.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - A number between 0 and 1 that shows the confidence level for the calculated confidence interval. The default value is .95.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional numeric value that specifies the length of the seasonal pattern. The default value of 1 indicates seasonality is detected automatically.
+ * The 0 value means no seasonality.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - An optional numeric value to handle missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros.
+ * @param {?ApiRange | ?ApiName | ?number} arg7 - An optional numeric value to aggregate multiple values with the same time stamp.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FORECAST_ETS_CONFINT.js
*/
ApiWorksheetFunction.prototype.FORECAST_ETS_CONFINT = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
return this.private_calculateFunction("FORECAST.ETS.CONFINT", arguments);
};
/**
- * Returns the length of the repetitive pattern an application detects for the specified time series..
+ * Returns the length of the repetitive pattern an application detects for the specified time series.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the array or range of numeric data you're predicting..
- * @param {ApiRange} arg2 Is the independent array or range of numeric data. The dates in the timeline must have a consistent step between them and can't be zero..
- * @param {?number} arg3 Is an optional value for handling missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros..
- * @param {?number} arg4 Is an optional numeric value for aggregating multiple values with the same time stamp. If blank, Microsoft Excel averages the values..
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - A range or an array of numeric data that determines the historical values for which a new point will be predicted.
+ * @param {ApiRange | ApiName} arg2 - A range of date/time values that correspond to the historical values.
+ * The timeline range must be of the same size as the second argument. Date/time values must have a constant step between them and can't be zero.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - An optional numeric value to handle missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An optional numeric value to aggregate multiple values with the same time stamp.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FORECAST_ETS_SEASONALITY.js
*/
ApiWorksheetFunction.prototype.FORECAST_ETS_SEASONALITY = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("FORECAST.ETS.SEASONALITY", arguments);
};
+
/**
- * Returns the requested statistic for the forecast..
+ * A numeric value between 1 and 8 that specifies which statistic will be returned.
+ * 1 - Alpha parameter of ETS algorithm - the base value parameter.
+ * 2 - Beta parameter of ETS algorithm - the trend value parameter.
+ * 3 - Gamma parameter of ETS algorithm - the seasonality value parameter.
+ * 4 - MASE (mean absolute scaled error) metric - a measure of the accuracy of forecasts.
+ * 5 - SMAPE (symmetric mean absolute percentage error) metric - a measure of the accuracy based on percentage errors.
+ * 6 - MAE (mean absolute error) metric - a measure of the accuracy of forecasts.
+ * 7 - RMSE (root mean squared error) metric - a measure of the differences between predicted and observed values.
+ * 8 - Step size detected in the timeline.
+ * @typedef {(1 | 2 | 3 | 4 | 5 | 6 | 7 | 8)} StatisticType
+ * @see office-js-api/Examples/Enumerations/StatisticType.js
+ */
+
+ /**
+ * Returns the requested statistic for the forecast.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the array or range of numeric data you're predicting..
- * @param {ApiRange} arg2 Is the independent array or range of numeric data. The dates in the timeline must have a consistent step between them and can't be zero..
- * @param {number} arg3 Is a number between 1 and 8, indicating which statistic Microsoft Excel will return for the calculated forecast..
- * @param {?number} arg4 Is an optional numeric value that indicates the length of the seasonal pattern. The default value of 1 indicates seasonality is detected automatically..
- * @param {?number} arg5 Is an optional value for handling missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros..
- * @param {?number} arg6 Is an optional numeric value for aggregating multiple values with the same time stamp. If blank, Microsoft Excel averages the values..
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - A range or an array of numeric data that determines the historical values for which a new point will be predicted.
+ * @param {ApiRange | ApiName} arg2 - A range of date/time values that correspond to the historical values.
+ * The timeline range must be of the same size as the second argument. Date/time values must have a constant step between them and can't be zero.
+ * @param {ApiRange | ApiName | number} arg3 - A number between 1 and 8, indicating which statistic will be returned for the calculated forecast.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An optional numeric value that specifies the length of the seasonal pattern. The default value of 1 indicates seasonality is detected automatically.
+ * The 0 value means no seasonality.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - An optional numeric value to handle missing values. The default value of 1 replaces missing values by interpolation, and 0 replaces them with zeros.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - An optional numeric value to aggregate multiple values with the same time stamp.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FORECAST_ETS_STAT.js
*/
ApiWorksheetFunction.prototype.FORECAST_ETS_STAT = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("FORECAST.ETS.STAT", arguments);
@@ -2448,7 +2826,7 @@
// * Calculates, or predicts, a future value along a linear trend by using existing values.
// * @memberof ApiWorksheetFunction
// * @typeofeditors ["CSE"]
- // * @param {number} arg1 Is the data point for which you want to predict a value and must be a numeric value.
+ // * @param {ApiRange | ApiName | number} arg1 Is the data point for which you want to predict a value and must be a numeric value.
// * @param {any} arg2 Is the dependent array or range of numeric data.
// * @param {any} arg3 Is the independent array or range of numeric data. The variance of Known_x's must not be zero.
// * @returns {number | string | boolean}
@@ -2457,12 +2835,13 @@
// return this.private_calculateFunction("FORECAST.LINEAR", arguments);
// };
/**
- * Calculates how often values occur within a range of values and then returns a vertical array of numbers that have one more element than Bins_array.
+ * Calculates how often values occur within a range of values and then returns the first value of the returned vertical array of numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is an array of or reference to a set of values for which you want to count frequencies (blanks and text are ignored).
- * @param {ApiRange} arg2 Is an array of or reference to intervals into which you want to group the values in data_array.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - An array of values or the selected range for which the frequencies will be counted (blanks and text are ignored).
+ * @param {ApiRange | ApiName | number[]} arg2 - An array of intervals or the selected range into which the values in the first range will be grouped.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FREQUENCY.js
*/
ApiWorksheetFunction.prototype.FREQUENCY = function (arg1, arg2) {
return this.private_calculateFunction("FREQUENCY", arguments);
@@ -2492,11 +2871,12 @@
// return this.private_calculateFunction("F.TEST", arguments);
// };
/**
- * Returns the Gamma function value.
+ * Returns the gamma function value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want to calculate Gamma.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the gamma function will be calculated.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMA.js
*/
ApiWorksheetFunction.prototype.GAMMA = function (arg1) {
return this.private_calculateFunction("GAMMA", arguments);
@@ -2505,11 +2885,13 @@
* Returns the gamma distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which you want to evaluate the distribution, a nonnegative number.
- * @param {number} arg2 Is a parameter to the distribution, a positive number.
- * @param {number} arg3 Is a parameter to the distribution, a positive number. If beta = 1, GAMMA.DIST returns the standard gamma distribution.
- * @param {boolean} arg4 Is a logical value: return the cumulative distribution function = TRUE; return the probability mass function = FALSE or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which the distribution will be calculated, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution, a positive number. If this parameter is equal to 1, the function returns the standard gamma distribution.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true> or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function. If it is false, the function returns the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMA_DIST.js
*/
ApiWorksheetFunction.prototype.GAMMA_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("GAMMA.DIST", arguments);
@@ -2518,11 +2900,13 @@
* Returns the gamma distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which you want to evaluate the distribution, a nonnegative number.
- * @param {number} arg2 Is a parameter to the distribution, a positive number.
- * @param {number} arg3 Is a parameter to the distribution, a positive number. If beta = 1, GAMMADIST returns the standard gamma distribution.
- * @param {boolean} arg4 Is a logical value: return the cumulative distribution function = TRUE; return the probability mass function = FALSE or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which the distribution will be calculated, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution, a positive number. If this parameter is equal to 1, the function returns the standard gamma distribution.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true> or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function. If it is false, the function returns the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMADIST.js
*/
ApiWorksheetFunction.prototype.GAMMADIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("GAMMADIST", arguments);
@@ -2531,10 +2915,11 @@
* Returns the inverse of the gamma cumulative distribution: if p = GAMMA.DIST(x,...), then GAMMA.INV(p,...) = x.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the probability associated with the gamma distribution, a number between 0 and 1, inclusive.
- * @param {number} arg2 Is a parameter to the distribution, a positive number.
- * @param {number} arg3 Is a parameter to the distribution, a positive number. If beta = 1, GAMMA.INV returns the inverse of the standard gamma distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The probability associated with the gamma distribution, a number between 0 and 1, inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution, a positive number. If this parameter is equal to 1, the function returns the standard gamma distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMA_INV.js
*/
ApiWorksheetFunction.prototype.GAMMA_INV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("GAMMA.INV", arguments);
@@ -2543,10 +2928,11 @@
* Returns the inverse of the gamma cumulative distribution: if p = GAMMADIST(x,...), then GAMMAINV(p,...) = x.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the probability associated with the gamma distribution, a number between 0 and 1, inclusive.
- * @param {number} arg2 Is a parameter to the distribution, a positive number.
- * @param {number} arg3 Is a parameter to the distribution, a positive number. If beta = 1, GAMMAINV returns the inverse of the standard gamma distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The probability associated with the gamma distribution, a number between 0 and 1, inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution, a positive number. If this parameter is equal to 1, the function returns the standard gamma distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMAINV.js
*/
ApiWorksheetFunction.prototype.GAMMAINV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("GAMMAINV", arguments);
@@ -2555,8 +2941,9 @@
* Returns the natural logarithm of the gamma function.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want to calculate GAMMALN, a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the natural logarithm of the gamma function will be calculated, a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMALN.js
*/
ApiWorksheetFunction.prototype.GAMMALN = function (arg1) {
return this.private_calculateFunction("GAMMALN", arguments);
@@ -2565,40 +2952,47 @@
* Returns the natural logarithm of the gamma function.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want to calculate GAMMALN.PRECISE, a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the natural logarithm of the gamma function will be calculated, a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAMMALN_PRECISE.js
*/
ApiWorksheetFunction.prototype.GAMMALN_PRECISE = function (arg1) {
return this.private_calculateFunction("GAMMALN.PRECISE", arguments);
};
/**
- * Returns 0.5 less than the standard normal cumulative distribution.
+ * Calculates the probability that a member of a standard normal population will fall between the mean and arg1 standard deviations from the mean.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the distribution will be calculated.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GAUSS.js
*/
ApiWorksheetFunction.prototype.GAUSS = function (arg1) {
return this.private_calculateFunction("GAUSS", arguments);
};
/**
- * Returns the geometric mean of an array or range of positive numeric data.
+ * Returns the geometric mean of positive numeric data.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | number[] | ApiName} args - Up to 255 numeric values for which the geometric mean will be calculated.
+ * Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GEOMEAN.js
*/
ApiWorksheetFunction.prototype.GEOMEAN = function () {
return this.private_calculateFunction("GEOMEAN", arguments);
};
/**
- * Returns numbers in an exponential growth trend matching known data points.
+ * Calculates predicted exponential growth by using existing data.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the set of y-values you already know in the relationship y = b*m^x, an array or range of positive numbers.
- * @param {?ApiRange} arg2 Is an optional set of x-values that you may already know in the relationship y = b*m^x, an array or range the same size as Known_y's.
- * @param {?ApiRange} arg3 Are new x-values for which you want GROWTH to return corresponding y-values.
- * @param {?boolean} arg4 Is a logical value: the constant b is calculated normally if Const = TRUE; b is set equal to 1 if Const = FALSE or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The set of y-values from the y = b*m^x equation, an array or range of positive numbers.
+ * @param {?ApiRange | ?ApiName | ?number[]} arg2 - An optional set of x-values from the y = b*m^x equation, an array or range of positive numbers that has the same size as the set of y-values.
+ * @param {?ApiRange | ?ApiName | ?number[]} arg3 - New x-values for which the function will return the corresponding y-values.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg4 - A logical value: the constant b is calculated normally if this parameter is set to true,
+ * and b is set equal to 1 if the parameter is false or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GROWTH.js
*/
ApiWorksheetFunction.prototype.GROWTH = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("GROWTH", arguments);
@@ -2607,7 +3001,10 @@
* Returns the harmonic mean of a data set of positive numbers: the reciprocal of the arithmetic mean of reciprocals.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | number[] | ApiName} args - Up to 255 numeric values for which the harmonic mean will be calculated.
+ * Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HARMEAN.js
*/
ApiWorksheetFunction.prototype.HARMEAN = function () {
return this.private_calculateFunction("HARMEAN", arguments);
@@ -2616,11 +3013,12 @@
* Returns the hypergeometric distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of successes in the sample.
- * @param {number} arg2 Is the size of the sample.
- * @param {number} arg3 Is the number of successes in the population.
- * @param {number} arg4 Is the population size.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of successes in the sample.
+ * @param {ApiRange | ApiName | number} arg2 - The size of the sample.
+ * @param {ApiRange | ApiName | number} arg3 - The number of successes in the population.
+ * @param {ApiRange | ApiName | number} arg4 - The population size.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HYPGEOMDIST.js
*/
ApiWorksheetFunction.prototype.HYPGEOMDIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("HYPGEOMDIST", arguments);
@@ -2629,12 +3027,14 @@
* Returns the hypergeometric distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of successes in the sample.
- * @param {number} arg2 Is the size of the sample.
- * @param {number} arg3 Is the number of successes in the population.
- * @param {number} arg4 Is the population size.
- * @param {boolean} arg5 Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of successes in the sample.
+ * @param {ApiRange | ApiName | number} arg2 - The size of the sample.
+ * @param {ApiRange | ApiName | number} arg3 - The number of successes in the population.
+ * @param {ApiRange | ApiName | number} arg4 - The population size.
+ * @param {ApiRange | ApiName | boolean} arg5 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function. If it is false, the function returns the probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HYPGEOM_DIST.js
*/
ApiWorksheetFunction.prototype.HYPGEOM_DIST = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("HYPGEOM.DIST", arguments);
@@ -2655,7 +3055,10 @@
* Returns the kurtosis of a data set.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | number[] | ApiName} args - Up to 255 numeric values for which the kurtosis will be calculated.
+ * Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/KURT.js
*/
ApiWorksheetFunction.prototype.KURT = function () {
return this.private_calculateFunction("KURT", arguments);
@@ -2664,9 +3067,10 @@
* Returns the k-th largest value in a data set. For example, the fifth largest number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data for which you want to determine the k-th largest value.
- * @param {number} arg2 Is the position (from the largest) in the array or cell range of the value to return.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data for which the k-th largest value will be determined.
+ * @param {ApiRange | ApiName | number} arg2 - The position (from the largest) in the array or cell range of data to return.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LARGE.js
*/
ApiWorksheetFunction.prototype.LARGE = function (arg1, arg2) {
return this.private_calculateFunction("LARGE", arguments);
@@ -2675,11 +3079,14 @@
* Returns statistics that describe a linear trend matching known data points, by fitting a straight line using the least squares method.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the set of y-values you already know in the relationship y = mx + b.
- * @param {?ApiRange} arg2 Is an optional set of x-values that you may already know in the relationship y = mx + b.
- * @param {?boolean} arg3 Is a logical value: the constant b is calculated normally if Const = TRUE or omitted; b is set equal to 0 if Const = FALSE.
- * @param {?boolean} arg4 Is a logical value: return additional regression statistics = TRUE; return m-coefficients and the constant b = FALSE or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The set of y-values from the y = mx + b equation.
+ * @param {?ApiRange | ?ApiName} arg2 - An optional set of x-values from the y = mx + b equation.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - A logical value: the constant b is calculated normally if this parameter is set to true or omitted,
+ * and b is set equal to 0 if the parameter is false.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg4 - A logical value: return additional regression statistics if this parameter is set to true,
+ * and return m-coefficients and the constant b if the parameter is false or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LINEST.js
*/
ApiWorksheetFunction.prototype.LINEST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("LINEST", arguments);
@@ -2688,60 +3095,69 @@
* Returns statistics that describe an exponential curve matching known data points.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the set of y-values you already know in the relationship y = b*m^x.
- * @param {?ApiRange} arg2 Is an optional set of x-values that you may already know in the relationship y = b*m^x.
- * @param {?boolean} arg3 Is a logical value: the constant b is calculated normally if Const = TRUE or omitted; b is set equal to 1 if Const = FALSE.
- * @param {?boolean} arg4 Is a logical value: return additional regression statistics = TRUE; return m-coefficients and the constant b = FALSE or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | ApiRange} arg1 - The set of y-values from the y = b*m^x equation.
+ * @param {?ApiRange | ?ApiName | ?ApiRange} arg2 - An optional set of x-values from the y = b*m^x equation.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - A logical value: the constant b is calculated normally if this parameter is set to true or omitted,
+ * and b is set equal to 1 if the parameter is false.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg4 - A logical value: return additional regression statistics if this parameter is set to true,
+ * and return m-coefficients and the constant b if the parameter is false or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOGEST.js
*/
ApiWorksheetFunction.prototype.LOGEST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("LOGEST", arguments);
};
/**
- * Returns the inverse of the lognormal cumulative distribution function of x, where ln(x) is normally distributed with parameters Mean and Standard_dev.
+ * Returns the inverse of the lognormal cumulative distribution function of x, where ln(x) is normally distributed with the specified parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the lognormal distribution, a number between 0 and 1, inclusive.
- * @param {number} arg2 Is the mean of ln(x).
- * @param {number} arg3 Is the standard deviation of ln(x), a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the lognormal distribution, a number between 0 and 1, inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The mean of ln(x).
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of ln(x), a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOGINV.js
*/
ApiWorksheetFunction.prototype.LOGINV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("LOGINV", arguments);
};
/**
- * Returns the lognormal distribution of x, where ln(x) is normally distributed with parameters Mean and Standard_dev.
+ * Returns the lognormal distribution of x, where ln(x) is normally distributed with the specified parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a positive number.
- * @param {number} arg2 Is the mean of ln(x).
- * @param {number} arg3 Is the standard deviation of ln(x), a positive number.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a positive number.
+ * @param {ApiRange | ApiName | number} arg2 - The mean of ln(x).
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of ln(x), a positive number.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOGNORM_DIST.js
*/
ApiWorksheetFunction.prototype.LOGNORM_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("LOGNORM.DIST", arguments);
};
/**
- * Returns the inverse of the lognormal cumulative distribution function of x, where ln(x) is normally distributed with parameters Mean and Standard_dev.
+ * Returns the inverse of the lognormal cumulative distribution function of x, where ln(x) is normally distributed with the specified parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability associated with the lognormal distribution, a number between 0 and 1, inclusive.
- * @param {number} arg2 Is the mean of ln(x).
- * @param {number} arg3 Is the standard deviation of ln(x), a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability associated with the lognormal distribution, a number between 0 and 1, inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The mean of ln(x).
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of ln(x), a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOGNORM_INV.js
*/
ApiWorksheetFunction.prototype.LOGNORM_INV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("LOGNORM.INV", arguments);
};
/**
- * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters Mean and Standard_dev.
+ * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with the specified parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a positive number.
- * @param {number} arg2 Is the mean of ln(x).
- * @param {number} arg3 Is the standard deviation of ln(x), a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a positive number.
+ * @param {ApiRange | ApiName | number} arg2 - The mean of ln(x).
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of ln(x), a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOGNORMDIST.js
*/
ApiWorksheetFunction.prototype.LOGNORMDIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("LOGNORMDIST", arguments);
@@ -2750,7 +3166,10 @@
* Returns the largest value in a set of values. Ignores logical values and text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | array | ApiRange | ApiName} args - Up to 255 numeric values for which the largest number will be returned.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MAX.js
*/
ApiWorksheetFunction.prototype.MAX = function () {
return this.private_calculateFunction("MAX", arguments);
@@ -2759,7 +3178,10 @@
* Returns the largest value in a set of values. Does not ignore logical values and text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | array | ApiName} args - Up to 255 values (number, text, logical value) for which the largest value will be returned.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values and text representations of numbers, names, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MAXA.js
*/
ApiWorksheetFunction.prototype.MAXA = function () {
return this.private_calculateFunction("MAXA", arguments);
@@ -2768,7 +3190,10 @@
* Returns the median, or the number in the middle of the set of given numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiRange | array | ApiName} args - Up to 255 numeric values for which the median will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MEDIAN.js
*/
ApiWorksheetFunction.prototype.MEDIAN = function () {
return this.private_calculateFunction("MEDIAN", arguments);
@@ -2777,7 +3202,10 @@
* Returns the smallest number in a set of values. Ignores logical values and text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiRange | array | ApiName} args - Up to 255 numeric values for which the smallest number will be returned.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MIN.js
*/
ApiWorksheetFunction.prototype.MIN = function () {
return this.private_calculateFunction("MIN", arguments);
@@ -2786,7 +3214,10 @@
* Returns the smallest value in a set of values. Does not ignore logical values and text.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | array | ApiName} args - Up to 255 values (number, text, logical value) for which the smallest value will be returned.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values and text representations of numbers, names, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MINA.js
*/
ApiWorksheetFunction.prototype.MINA = function () {
return this.private_calculateFunction("MINA", arguments);
@@ -2822,26 +3253,30 @@
// return this.private_calculateFunction("MODE.SNGL", arguments);
// };
/**
- * Returns the negative binomial distribution, the probability that there will be Number_f failures before the Number_s-th success, with Probability_s probability of a success.
+ * Returns the negative binomial distribution, the probability that there will be the specified number of failures before the last success, with the specified probability of a success.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of failures.
- * @param {number} arg2 Is the threshold number of successes.
- * @param {number} arg3 Is the probability of a success; a number between 0 and 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of failures.
+ * @param {ApiRange | ApiName | number} arg2 - The threshold number of successes.
+ * @param {ApiRange | ApiName | number} arg3 - The probability of a success; a number between 0 and 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NEGBINOMDIST.js
*/
ApiWorksheetFunction.prototype.NEGBINOMDIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("NEGBINOMDIST", arguments);
};
/**
- * Returns the negative binomial distribution, the probability that there will be Number_f failures before the Number_s-th success, with Probability_s probability of a success.
+ * Returns the negative binomial distribution, the probability that there will be the specified number of failures before the last success, with the specified probability of a success.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of failures.
- * @param {number} arg2 Is the threshold number of successes.
- * @param {number} arg3 Is the probability of a success; a number between 0 and 1.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of failures.
+ * @param {ApiRange | ApiName | number} arg2 - The threshold number of successes.
+ * @param {ApiRange | ApiName | number} arg3 - The probability of a success; a number between 0 and 1.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NEGBINOM_DIST.js
*/
ApiWorksheetFunction.prototype.NEGBINOM_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("NEGBINOM.DIST", arguments);
@@ -2850,11 +3285,14 @@
* Returns the normal cumulative distribution for the specified mean and standard deviation.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want the distribution.
- * @param {number} arg2 Is the arithmetic mean of the distribution.
- * @param {number} arg3 Is the standard deviation of the distribution, a positive number.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the distribution will be returned.
+ * @param {ApiRange | ApiName | number} arg2 - The arithmetic mean of the distribution.
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of the distribution, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORMDIST.js
*/
ApiWorksheetFunction.prototype.NORMDIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("NORMDIST", arguments);
@@ -2863,11 +3301,14 @@
* Returns the normal distribution for the specified mean and standard deviation.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want the distribution.
- * @param {number} arg2 Is the arithmetic mean of the distribution.
- * @param {number} arg3 Is the standard deviation of the distribution, a positive number.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the distribution will be returned.
+ * @param {ApiRange | ApiName | number} arg2 - The arithmetic mean of the distribution.
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of the distribution, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORM_DIST.js
*/
ApiWorksheetFunction.prototype.NORM_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("NORM.DIST", arguments);
@@ -2876,10 +3317,11 @@
* Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is the arithmetic mean of the distribution.
- * @param {number} arg3 Is the standard deviation of the distribution, a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The arithmetic mean of the distribution.
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of the distribution, a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORMINV.js
*/
ApiWorksheetFunction.prototype.NORMINV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("NORMINV", arguments);
@@ -2888,10 +3330,11 @@
* Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is the arithmetic mean of the distribution.
- * @param {number} arg3 Is the standard deviation of the distribution, a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - The arithmetic mean of the distribution.
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of the distribution, a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORM_INV.js
*/
ApiWorksheetFunction.prototype.NORM_INV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("NORM.INV", arguments);
@@ -2900,8 +3343,9 @@
* Returns the standard normal cumulative distribution (has a mean of zero and a standard deviation of one).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the distribution will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORMSDIST.js
*/
ApiWorksheetFunction.prototype.NORMSDIST = function (arg1) {
return this.private_calculateFunction("NORMSDIST", arguments);
@@ -2910,9 +3354,12 @@
* Returns the standard normal distribution (has a mean of zero and a standard deviation of one).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value for which you want the distribution.
- * @param {boolean} arg2 Is a logical value for the function to return: the cumulative distribution function = TRUE; the probability density function = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which the distribution will be returned.
+ * @param {ApiRange | ApiName | boolean} arg2 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORM_S_DIST.js
*/
ApiWorksheetFunction.prototype.NORM_S_DIST = function (arg1, arg2) {
return this.private_calculateFunction("NORM.S.DIST", arguments);
@@ -2921,8 +3368,9 @@
* Returns the inverse of the standard normal cumulative distribution (has a mean of zero and a standard deviation of one).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORMSINV.js
*/
ApiWorksheetFunction.prototype.NORMSINV = function (arg1) {
return this.private_calculateFunction("NORMSINV", arguments);
@@ -2931,8 +3379,9 @@
* Returns the inverse of the standard normal cumulative distribution (has a mean of zero and a standard deviation of one).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A probability corresponding to the normal distribution, a number between 0 and 1 inclusive.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NORM_S_INV.js
*/
ApiWorksheetFunction.prototype.NORM_S_INV = function (arg1) {
return this.private_calculateFunction("NORM.S.INV", arguments);
@@ -2954,9 +3403,10 @@
* Returns the k-th percentile of values in a range.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data that defines relative standing.
- * @param {number} arg2 Is the percentile value that is between 0 through 1, inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data that defines relative standing.
+ * @param {ApiRange | ApiName | number} arg2 - The percentile value that is equal to 0 but less than or equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERCENTILE.js
*/
ApiWorksheetFunction.prototype.PERCENTILE = function (arg1, arg2) {
return this.private_calculateFunction("PERCENTILE", arguments);
@@ -2965,9 +3415,10 @@
* Returns the k-th percentile of values in a range, where k is in the range 0..1, exclusive.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data that defines relative standing.
- * @param {number} arg2 Is the percentile value that is between 0 through 1, inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data that defines relative standing.
+ * @param {ApiRange | ApiName | number} arg2 - The percentile value that is greater than 0 but less than 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERCENTILE_EXC.js
*/
ApiWorksheetFunction.prototype.PERCENTILE_EXC = function (arg1, arg2) {
return this.private_calculateFunction("PERCENTILE.EXC", arguments);
@@ -2976,9 +3427,10 @@
* Returns the k-th percentile of values in a range, where k is in the range 0..1, inclusive.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data that defines relative standing.
- * @param {number} arg2 Is the percentile value that is between 0 through 1, inclusive.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data that defines relative standing.
+ * @param {ApiRange | ApiName | number} arg2 - The percentile value that is equal to 0 but less than or equal to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERCENTILE_INC.js
*/
ApiWorksheetFunction.prototype.PERCENTILE_INC = function (arg1, arg2) {
return this.private_calculateFunction("PERCENTILE.INC", arguments);
@@ -2987,34 +3439,37 @@
* Returns the rank of a value in a data set as a percentage of the data set.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data with numeric values that defines relative standing.
- * @param {number} arg2 Is the value for which you want to know the rank.
- * @param {?number} arg3 Is an optional value that identifies the number of significant digits for the returned percentage, three digits if omitted (0.xxx%).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data with numeric values that defines relative standing.
+ * @param {ApiRange | ApiName | number} arg2 - The value for which the rank will be returned.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - An optional value that identifies the number of significant digits for the returned percentage, three digits if omitted (0.xxx%).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERCENTRANK.js
*/
ApiWorksheetFunction.prototype.PERCENTRANK = function (arg1, arg2, arg3) {
return this.private_calculateFunction("PERCENTRANK", arguments);
};
/**
- * Returns the rank of a value in a data set as a percentage of the data set as a percentage (0..1, exclusive) of the data set.
+ * Returns the rank of a value in a data set as a percentage (0..1, exclusive) of the data set.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data with numeric values that defines relative standing.
- * @param {number} arg2 Is the value for which you want to know the rank.
- * @param {?number} arg3 Is an optional value that identifies the number of significant digits for the returned percentage, three digits if omitted (0.xxx%).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data with numeric values that defines relative standing.
+ * @param {ApiRange | ApiName | number} arg2 - The value for which the rank will be returned.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - An optional value that identifies the number of significant digits for the returned percentage, three digits if omitted (0.xxx%).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERCENTRANK_EXC.js
*/
ApiWorksheetFunction.prototype.PERCENTRANK_EXC = function (arg1, arg2, arg3) {
return this.private_calculateFunction("PERCENTRANK.EXC", arguments);
};
/**
- * Returns the rank of a value in a data set as a percentage of the data set as a percentage (0..1, inclusive) of the data set.
+ * Returns the rank of a value in a data set as a percentage (0..1, inclusive) of the data set.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data with numeric values that defines relative standing.
- * @param {number} arg2 Is the value for which you want to know the rank.
- * @param {?number} arg3 Is an optional value that identifies the number of significant digits for the returned percentage, three digits if omitted (0.xxx%).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of data with numeric values that defines relative standing.
+ * @param {ApiRange | ApiName | number} arg2 - The value for which the rank will be returned.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - An optional value that identifies the number of significant digits for the returned percentage, three digits if omitted (0.xxx%).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERCENTRANK_INC.js
*/
ApiWorksheetFunction.prototype.PERCENTRANK_INC = function (arg1, arg2, arg3) {
return this.private_calculateFunction("PERCENTRANK.INC", arguments);
@@ -3023,9 +3478,10 @@
* Returns the number of permutations for a given number of objects that can be selected from the total objects.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the total number of objects.
- * @param {number} arg2 Is the number of objects in each permutation.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The total number of objects.
+ * @param {ApiRange | ApiName | number} arg2 - The number of objects in each permutation.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERMUT.js
*/
ApiWorksheetFunction.prototype.PERMUT = function (arg1, arg2) {
return this.private_calculateFunction("PERMUT", arguments);
@@ -3034,9 +3490,10 @@
* Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the total number of objects.
- * @param {number} arg2 Is the number of objects in each permutation.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The total number of objects.
+ * @param {ApiRange | ApiName | number} arg2 - The number of objects in each permutation.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PERMUTATIONA.js
*/
ApiWorksheetFunction.prototype.PERMUTATIONA = function (arg1, arg2) {
return this.private_calculateFunction("PERMUTATIONA", arguments);
@@ -3045,8 +3502,9 @@
* Returns the value of the density function for a standard normal distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number for which you want the density of the standard normal distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number for which the density of the standard normal distribution will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PHI.js
*/
ApiWorksheetFunction.prototype.PHI = function (arg1) {
return this.private_calculateFunction("PHI", arguments);
@@ -3055,10 +3513,13 @@
* Returns the Poisson distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of events.
- * @param {number} arg2 Is the expected numeric value, a positive number.
- * @param {boolean} arg3 Is a logical value: for the cumulative Poisson probability, use TRUE; for the Poisson probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of events.
+ * @param {ApiRange | ApiName | number} arg2 - The expected numeric value, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg3 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative Poisson probability.
+ * If it is false, the function returns the Poisson probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/POISSON.js
*/
ApiWorksheetFunction.prototype.POISSON = function (arg1, arg2, arg3) {
return this.private_calculateFunction("POISSON", arguments);
@@ -3067,10 +3528,13 @@
* Returns the Poisson distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of events.
- * @param {number} arg2 Is the expected numeric value, a positive number.
- * @param {boolean} arg3 Is a logical value: for the cumulative Poisson probability, use TRUE; for the Poisson probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of events.
+ * @param {ApiRange | ApiName | number} arg2 - The expected numeric value, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg3 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative Poisson probability.
+ * If it is false, the function returns the Poisson probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/POISSON_DIST.js
*/
ApiWorksheetFunction.prototype.POISSON_DIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("POISSON.DIST", arguments);
@@ -3082,8 +3546,8 @@
// * @typeofeditors ["CSE"]
// * @param {any} arg1 Is the range of numeric values of x with which there are associated probabilities.
// * @param {any} arg2 Is the set of probabilities associated with values in X_range, values between 0 and 1 and excluding 0.
- // * @param {number} arg3 Is the lower bound on the value for which you want a probability.
- // * @param {?number} arg4 Is the optional upper bound on the value. If omitted, PROB returns the probability that X_range values are equal to Lower_limit.
+ // * @param {ApiRange | ApiName | number} arg3 Is the lower bound on the value for which you want a probability.
+ // * @param {?ApiRange | ?ApiName | ?number} arg4 Is the optional upper bound on the value. If omitted, PROB returns the probability that X_range values are equal to Lower_limit.
// * @returns {number | string | boolean}
// */
// ApiWorksheetFunction.prototype.PROB = function (arg1, arg2, arg3, arg4) {
@@ -3093,9 +3557,10 @@
* Returns the quartile of a data set.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or cell range of numeric values for which you want the quartile value.
- * @param {number} arg2 Is a number: minimum value = 0; 1st quartile = 1; median value = 2; 3rd quartile = 3; maximum value = 4.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or cell range of numeric values for which the quartile value will be returned.
+ * @param {ApiRange | ApiName | number} arg2 - The quartile value to return: minimum value = 0; 1st quartile = 1; median value = 2; 3rd quartile = 3; maximum value = 4.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/QUARTILE.js
*/
ApiWorksheetFunction.prototype.QUARTILE = function (arg1, arg2) {
return this.private_calculateFunction("QUARTILE", arguments);
@@ -3104,9 +3569,10 @@
* Returns the quartile of a data set, based on percentile values from 0..1, exclusive.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or cell range of numeric values for which you want the quartile value.
- * @param {number} arg2 Is a number: minimum value = 0; 1st quartile = 1; median value = 2; 3rd quartile = 3; maximum value = 4.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or cell range of numeric values for which the quartile value will be returned.
+ * @param {ApiRange | ApiName | number} arg2 - The quartile value to return: 1st quartile = 1; median value = 2; 3rd quartile = 3.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/QUARTILE_EXC.js
*/
ApiWorksheetFunction.prototype.QUARTILE_EXC = function (arg1, arg2) {
return this.private_calculateFunction("QUARTILE.EXC", arguments);
@@ -3115,9 +3581,10 @@
* Returns the quartile of a data set, based on percentile values from 0..1, inclusive.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or cell range of numeric values for which you want the quartile value.
- * @param {number} arg2 Is a number: minimum value = 0; 1st quartile = 1; median value = 2; 3rd quartile = 3; maximum value = 4.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or cell range of numeric values for which the quartile value will be returned.
+ * @param {ApiRange | ApiName | number} arg2 - The quartile value to return: minimum value = 0; 1st quartile = 1; median value = 2; 3rd quartile = 3; maximum value = 4.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/QUARTILE_INC.js
*/
ApiWorksheetFunction.prototype.QUARTILE_INC = function (arg1, arg2) {
return this.private_calculateFunction("QUARTILE.INC", arguments);
@@ -3126,34 +3593,40 @@
* Returns the rank of a number in a list of numbers: its size relative to other values in the list.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number for which you want to find the rank.
- * @param {ApiRange} arg2 Is an array of, or a reference to, a list of numbers. Nonnumeric values are ignored.
- * @param {?boolean} arg3 Is a number: rank in the list sorted descending = 0 or omitted; rank in the list sorted ascending = any nonzero value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number for which the rank will be returned.
+ * @param {ApiRange | ApiName | number[]} arg2 - An array or range of numbers. Nonnumeric values are ignored.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - The numeric value that specifyes how to order the numbers. If it is 0 or omitted, the rank in the list will be sorted in descending order.
+ * Any other numeric value means that the rank in the list will be sorted in ascending order.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RANK.js
*/
ApiWorksheetFunction.prototype.RANK = function (arg1, arg2, arg3) {
return this.private_calculateFunction("RANK", arguments);
};
/**
- * Returns the rank of a number in a list of numbers: its size relative to other values in the list; if more than one value has the same rank, the average rank is returned.
+ * Returns the rank of a number in a list of numbers: its size relative to other values in the list. If more than one value has the same rank, the average rank is returned.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number for which you want to find the rank.
- * @param {ApiRange} arg2 Is an array of, or a reference to, a list of numbers. Nonnumeric values are ignored.
- * @param {?boolean} arg3 Is a number: rank in the list sorted descending = 0 or omitted; rank in the list sorted ascending = any nonzero value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number for which the rank will be returned.
+ * @param {ApiRange | ApiName | number[]} arg2 - An array or range of numbers. Nonnumeric values are ignored.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - The numeric value that specifyes how to order the numbers. If it is 0 or omitted, the rank in the list will be sorted in descending order.
+ * Any other numeric value means that the rank in the list will be sorted in ascending order.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RANK_AVG.js
*/
ApiWorksheetFunction.prototype.RANK_AVG = function (arg1, arg2, arg3) {
return this.private_calculateFunction("RANK.AVG", arguments);
};
/**
- * Returns the rank of a number in a list of numbers: its size relative to other values in the list; if more than one value has the same rank, the top rank of that set of values is returned.
+ * Returns the rank of a number in a list of numbers: its size relative to other values in the list. If more than one value has the same rank, the top rank of that set of values is returned.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number for which you want to find the rank.
- * @param {ApiRange} arg2 Is an array of, or a reference to, a list of numbers. Nonnumeric values are ignored.
- * @param {?boolean} arg3 Is a number: rank in the list sorted descending = 0 or omitted; rank in the list sorted ascending = any nonzero value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number for which the rank will be returned.
+ * @param {ApiRange | ApiName | number[]} arg2 - An array or range of numbers. Nonnumeric values are ignored.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - The numeric value that specifyes how to order the numbers. If it is 0 or omitted, the rank in the list will be sorted in descending order.
+ * Any other numeric value means that the rank in the list will be sorted in ascending order.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RANK_EQ.js
*/
ApiWorksheetFunction.prototype.RANK_EQ = function (arg1, arg2, arg3) {
return this.private_calculateFunction("RANK.EQ", arguments);
@@ -3172,19 +3645,25 @@
// };
/**
- * Returns the skewness of a distribution: a characterisation of the degree of asymmetry of a distribution around its mean.
+ * Returns the skewness of a distribution: a characterization of the degree of asymmetry of a distribution around its mean.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiName | number[] | ApiRange} args - Up to 255 numeric values for which the skewness of a distribution will be returned.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SKEW.js
*/
ApiWorksheetFunction.prototype.SKEW = function () {
return this.private_calculateFunction("SKEW", arguments);
};
/**
- * Returns the skewness of a distribution based on a population: a characterisation of the degree of asymmetry of a distribution around its mean.
+ * Returns the skewness of a distribution based on a population: a characterization of the degree of asymmetry of a distribution around its mean.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiName | number[] | ApiRange} args - Up to 255 numeric values for which the skewness of a distribution will be returned.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SKEW_P.js
*/
ApiWorksheetFunction.prototype.SKEW_P = function () {
return this.private_calculateFunction("SKEW.P", arguments);
@@ -3205,9 +3684,10 @@
* Returns the k-th smallest value in a data set. For example, the fifth smallest number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is an array or range of numerical data for which you want to determine the k-th smallest value.
- * @param {number} arg2 Is the position (from the smallest) in the array or range of the value to return.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - An array or range of numerical data for which the k-th smallest value will be determined.
+ * @param {ApiRange | ApiName | number} arg2 - The position (from the smallest) in the range of the value to return.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SMALL.js
*/
ApiWorksheetFunction.prototype.SMALL = function (arg1, arg2) {
return this.private_calculateFunction("SMALL", arguments);
@@ -3216,10 +3696,11 @@
* Returns a normalised value from a distribution characterised by a mean and standard deviation.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value you want to normalize.
- * @param {number} arg2 Is the arithmetic mean of the distribution.
- * @param {number} arg3 Is the standard deviation of the distribution, a positive number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to normalize.
+ * @param {ApiRange | ApiName | number} arg2 - The arithmetic mean of the distribution.
+ * @param {ApiRange | ApiName | number} arg3 - The standard deviation of the distribution, a positive number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STANDARDIZE.js
*/
ApiWorksheetFunction.prototype.STANDARDIZE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("STANDARDIZE", arguments);
@@ -3228,7 +3709,10 @@
* Estimates standard deviation based on a sample (ignores logical values and text in the sample).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number[] | number | ApiName | ApiRange} args - Up to 255 numeric values for which the standard deviation will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STDEV.js
*/
ApiWorksheetFunction.prototype.STDEV = function () {
return this.private_calculateFunction("STDEV", arguments);
@@ -3237,16 +3721,22 @@
* Estimates standard deviation based on a sample (ignores logical values and text in the sample).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number[] | number | ApiName | ApiRange} args - Up to 255 numeric values for which the standard deviation will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STDEV_S.js
*/
ApiWorksheetFunction.prototype.STDEV_S = function () {
return this.private_calculateFunction("STDEV.S", arguments);
};
/**
- * Estimates standard deviation based on a sample, including logical values and text. Text and the logical value FALSE have the value 0; the logical value TRUE has the value 1.
+ * Estimates standard deviation based on a sample, including logical values and text. Text and the false logical value have the value 0; the true logical value has the value 1.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number[] | number | string | boolean | ApiRange | ApiName} args - Up to 255 values for which the standard deviation will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values, text strings, names, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STDEVA.js
*/
ApiWorksheetFunction.prototype.STDEVA = function () {
return this.private_calculateFunction("STDEVA", arguments);
@@ -3255,7 +3745,10 @@
* Calculates standard deviation based on the entire population given as arguments (ignores logical values and text).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number[] | number | ApiName | ApiRange} args - Up to 255 numeric values for which the standard deviation will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STDEVP.js
*/
ApiWorksheetFunction.prototype.STDEVP = function () {
return this.private_calculateFunction("STDEVP", arguments);
@@ -3264,16 +3757,23 @@
* Calculates standard deviation based on the entire population given as arguments (ignores logical values and text).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number[] | number | ApiName | ApiRange} args - Up to 255 numeric values for which the standard deviation will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STDEV_P.js
*/
ApiWorksheetFunction.prototype.STDEV_P = function () {
return this.private_calculateFunction("STDEV.P", arguments);
};
/**
- * Calculates standard deviation based on an entire population, including logical values and text. Text and the logical value FALSE have the value 0; the logical value TRUE has the value 1.
+ * Calculates standard deviation based on the entire population, including logical values and text.
+ * Text and the false logical value have the value 0; the true logical value has the value 1.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number[] | number | string | boolean | ApiRange | ApiName} args - Up to 255 values for which the standard deviation will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values, text strings, names, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/STDEVPA.js
*/
ApiWorksheetFunction.prototype.STDEVPA = function () {
return this.private_calculateFunction("STDEVPA", arguments);
@@ -3294,10 +3794,11 @@
* Returns the Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the numeric value at which to evaluate the distribution.
- * @param {number} arg2 Is an integer indicating the number of degrees of freedom that characterize the distribution.
- * @param {number} arg3 Specifies the number of distribution tails to return: one-tailed distribution = 1; two-tailed distribution = 2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value at which to evaluate the distribution.
+ * @param {ApiRange | ApiName | number} arg2 - An integer indicating the number of degrees of freedom that characterize the distribution.
+ * @param {ApiRange | ApiName | number} arg3 - Specifies the number of distribution tails to return: one-tailed distribution = 1; two-tailed distribution = 2.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TDIST.js
*/
ApiWorksheetFunction.prototype.TDIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("TDIST", arguments);
@@ -3306,10 +3807,13 @@
* Returns the left-tailed Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the numeric value at which to evaluate the distribution.
- * @param {number} arg2 Is an integer indicating the number of degrees of freedom that characterize the distribution.
- * @param {boolean} arg3 Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value at which to evaluate the distribution.
+ * @param {ApiRange | ApiName | number} arg2 - An integer indicating the number of degrees of freedom that characterize the distribution.
+ * @param {ApiRange | ApiName | boolean} arg3 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability density function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/T_DIST.js
*/
ApiWorksheetFunction.prototype.T_DIST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("T.DIST", arguments);
@@ -3318,9 +3822,10 @@
* Returns the two-tailed Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the numeric value at which to evaluate the distribution.
- * @param {number} arg2 Is an integer indicating the number of degrees of freedom that characterize the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value at which to evaluate the distribution.
+ * @param {ApiRange | ApiName | number} arg2 - An integer indicating the number of degrees of freedom that characterize the distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/T_DIST_2T.js
*/
ApiWorksheetFunction.prototype.T_DIST_2T = function (arg1, arg2) {
return this.private_calculateFunction("T.DIST.2T", arguments);
@@ -3329,9 +3834,10 @@
* Returns the right-tailed Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the numeric value at which to evaluate the distribution.
- * @param {number} arg2 Is an integer indicating the number of degrees of freedom that characterize the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value at which to evaluate the distribution.
+ * @param {ApiRange | ApiName | number} arg2 - An integer indicating the number of degrees of freedom that characterize the distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/T_DIST_RT.js
*/
ApiWorksheetFunction.prototype.T_DIST_RT = function (arg1, arg2) {
return this.private_calculateFunction("T.DIST.RT", arguments);
@@ -3340,9 +3846,10 @@
* Returns the left-tailed inverse of the Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is a positive integer indicating the number of degrees of freedom to characterize the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - A positive integer indicating the number of degrees of freedom to characterize the distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/T_INV.js
*/
ApiWorksheetFunction.prototype.T_INV = function (arg1, arg2) {
return this.private_calculateFunction("T.INV", arguments);
@@ -3351,9 +3858,10 @@
* Returns the two-tailed inverse of the Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is a positive integer indicating the number of degrees of freedom to characterize the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - A positive integer indicating the number of degrees of freedom to characterize the distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/T_INV_2T.js
*/
ApiWorksheetFunction.prototype.T_INV_2T = function (arg1, arg2) {
return this.private_calculateFunction("T.INV.2T", arguments);
@@ -3362,9 +3870,10 @@
* Returns the two-tailed inverse of the Student's t-distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
- * @param {number} arg2 Is a positive integer indicating the number of degrees of freedom to characterize the distribution.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive.
+ * @param {ApiRange | ApiName | number} arg2 - A positive integer indicating the number of degrees of freedom to characterize the distribution.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TINV.js
*/
ApiWorksheetFunction.prototype.TINV = function (arg1, arg2) {
return this.private_calculateFunction("TINV", arguments);
@@ -3373,11 +3882,13 @@
* Returns numbers in a linear trend matching known data points, using the least squares method.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is a range or array of y-values you already know in the relationship y = mx + b.
- * @param {?ApiRange} arg2 Is an optional range or array of x-values that you know in the relationship y = mx + b, an array the same size as Known_y's.
- * @param {?ApiRange} arg3 Is a range or array of new x-values for which you want TREND to return corresponding y-values.
- * @param {?boolean} arg4 Is a logical value: the constant b is calculated normally if Const = TRUE or omitted; b is set equal to 0 if Const = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - A range or array of y-values from the y = mx + b equation.
+ * @param {?ApiRange | ?ApiName | number[]} arg2 - An optional range or array of x-values from the y = mx + b equation, an array of the same size as an array of y-values.
+ * @param {?ApiRange | ?ApiName | number[]} arg3 - A range or array of new x-values for which this function will return corresponding y-values.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg4 - A logical value: the constant b is calculated normally if this parameter is set to true or omitted,
+ * and b is set equal to 0 if the parameter is false.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TREND.js
*/
ApiWorksheetFunction.prototype.TREND = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("TREND", arguments);
@@ -3386,9 +3897,10 @@
* Returns the mean of the interior portion of a set of data values.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the range or array of values to trim and average.
- * @param {number} arg2 Is the fractional number of data points to exclude from the top and bottom of the data set.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - The array or range of values to trim and average.
+ * @param {ApiRange | ApiName | number} arg2 - The fractional number of data points to exclude from the top and bottom of the data set.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TRIMMEAN.js
*/
ApiWorksheetFunction.prototype.TRIMMEAN = function (arg1, arg2) {
return this.private_calculateFunction("TRIMMEAN", arguments);
@@ -3400,8 +3912,8 @@
// * @typeofeditors ["CSE"]
// * @param {any} arg1 Is the first data set.
// * @param {any} arg2 Is the second data set.
- // * @param {number} arg3 Specifies the number of distribution tails to return: one-tailed distribution = 1; two-tailed distribution = 2.
- // * @param {number} arg4 Is the kind of t-test: paired = 1, two-sample equal variance (homoscedastic) = 2, two-sample unequal variance = 3.
+ // * @param {ApiRange | ApiName | number} arg3 Specifies the number of distribution tails to return: one-tailed distribution = 1; two-tailed distribution = 2.
+ // * @param {ApiRange | ApiName | number} arg4 Is the kind of t-test: paired = 1, two-sample equal variance (homoscedastic) = 2, two-sample unequal variance = 3.
// * @returns {number | string | boolean}
// */
// ApiWorksheetFunction.prototype.TTEST = function (arg1, arg2, arg3, arg4) {
@@ -3414,8 +3926,8 @@
// * @typeofeditors ["CSE"]
// * @param {any} arg1 Is the first data set.
// * @param {any} arg2 Is the second data set.
- // * @param {number} arg3 Specifies the number of distribution tails to return: one-tailed distribution = 1; two-tailed distribution = 2.
- // * @param {number} arg4 Is the kind of t-test: paired = 1, two-sample equal variance (homoscedastic) = 2, two-sample unequal variance = 3.
+ // * @param {ApiRange | ApiName | number} arg3 Specifies the number of distribution tails to return: one-tailed distribution = 1; two-tailed distribution = 2.
+ // * @param {ApiRange | ApiName | number} arg4 Is the kind of t-test: paired = 1, two-sample equal variance (homoscedastic) = 2, two-sample unequal variance = 3.
// * @returns {number | string | boolean}
// */
// ApiWorksheetFunction.prototype.T_TEST = function (arg1, arg2, arg3, arg4) {
@@ -3425,16 +3937,22 @@
* Estimates variance based on a sample (ignores logical values and text in the sample).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiName | ApiRange | number[]} args - Up to 255 numeric values for which the variance will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VAR.js
*/
ApiWorksheetFunction.prototype.VAR = function () {
return this.private_calculateFunction("VAR", arguments);
};
/**
- * Estimates variance based on a sample, including logical values and text. Text and the logical value FALSE have the value 0; the logical value TRUE has the value 1.
+ * Estimates variance based on a sample, including logical values and text. Text and the false logical value have the value 0; the true logical value has the value 1.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | array | ApiName} args - Up to 255 values for which the variance will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values or text representations of numbers, names, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VARA.js
*/
ApiWorksheetFunction.prototype.VARA = function () {
return this.private_calculateFunction("VARA", arguments);
@@ -3443,7 +3961,10 @@
* Calculates variance based on the entire population (ignores logical values and text in the population).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiName | ApiRange | number[]} args - Up to 255 numeric values for which the variance will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VARP.js
*/
ApiWorksheetFunction.prototype.VARP = function () {
return this.private_calculateFunction("VARP", arguments);
@@ -3452,7 +3973,10 @@
* Calculates variance based on the entire population (ignores logical values and text in the population).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiName | ApiRange | number[]} args - Up to 255 numeric values for which the variance will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VAR_P.js
*/
ApiWorksheetFunction.prototype.VAR_P = function () {
return this.private_calculateFunction("VAR.P", arguments);
@@ -3461,16 +3985,22 @@
* Estimates variance based on a sample (ignores logical values and text in the sample).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiName | ApiRange | number[]} args - Up to 255 numeric values for which the variance will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VAR_S.js
*/
ApiWorksheetFunction.prototype.VAR_S = function () {
return this.private_calculateFunction("VAR.S", arguments);
};
/**
- * Calculates variance based on the entire population, including logical values and text. Text and the logical value FALSE have the value 0; the logical value TRUE has the value 1.
+ * Calculates variance based on the entire population, including logical values and text. Text and the false logical value have the value 0; the true logical value has the value 1.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | array | ApiName} args - Up to 255 values for which the variance will be calculated.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values or text representations of numbers, names, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VARPA.js
*/
ApiWorksheetFunction.prototype.VARPA = function () {
return this.private_calculateFunction("VARPA", arguments);
@@ -3479,11 +4009,14 @@
* Returns the Weibull distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a nonnegative number.
- * @param {number} arg2 Is a parameter to the distribution, a positive number.
- * @param {number} arg3 Is a parameter to the distribution, a positive number.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/WEIBULL.js
*/
ApiWorksheetFunction.prototype.WEIBULL = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("WEIBULL", arguments);
@@ -3492,11 +4025,14 @@
* Returns the Weibull distribution.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value at which to evaluate the function, a nonnegative number.
- * @param {number} arg2 Is a parameter to the distribution, a positive number.
- * @param {number} arg3 Is a parameter to the distribution, a positive number.
- * @param {boolean} arg4 Is a logical value: for the cumulative distribution function, use TRUE; for the probability mass function, use FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function, a nonnegative number.
+ * @param {ApiRange | ApiName | number} arg2 - The alpha parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | number} arg3 - The beta parameter of the distribution, a positive number.
+ * @param {ApiRange | ApiName | boolean} arg4 - A logical value (true or false) that determines the function form.
+ * If it is true, the function returns the cumulative distribution function.
+ * If it is false, the function returns the probability mass function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/WEIBULL_DIST.js
*/
ApiWorksheetFunction.prototype.WEIBULL_DIST = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("WEIBULL.DIST", arguments);
@@ -3505,10 +4041,11 @@
* Returns the one-tailed P-value of a z-test.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data against which to test X.
- * @param {number} arg2 Is the value to test.
- * @param {?number} arg3 Is the population (known) standard deviation. If omitted, the sample standard deviation is used.
- * @returns {number | string | boolean}
+ * @param {number[] | ApiRange | ApiName} arg1 - The array or range of data against which to test X.
+ * @param {ApiRange | ApiName | number} arg2 - The value to test.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - The population (known) standard deviation. If omitted, the sample standard deviation is used.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ZTEST.js
*/
ApiWorksheetFunction.prototype.ZTEST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("ZTEST", arguments);
@@ -3517,22 +4054,24 @@
* Returns the one-tailed P-value of a z-test.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the array or range of data against which to test X.
- * @param {number} arg2 Is the value to test.
- * @param {?number} arg3 Is the population (known) standard deviation. If omitted, the sample standard deviation is used.
- * @returns {number | string | boolean}
+ * @param {number[] | ApiRange} arg1 - The array or range of data against which to test X.
+ * @param {ApiRange | ApiName | number} arg2 - The value to test.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - The population (known) standard deviation. If omitted, the sample standard deviation is used.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/Z_TEST.js
*/
ApiWorksheetFunction.prototype.Z_TEST = function (arg1, arg2, arg3) {
return this.private_calculateFunction("Z.TEST", arguments);
};
/**
- * Returns the number that represents the date in the date-time code.
+ * Returns a number that represents the date in the date-time code.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number from 1900 or 1904 (depending on the workbook's date system) to 9999.
- * @param {number} arg2 Is a number from 1 to 12 representing the month of the year.
- * @param {number} arg3 Is a number from 1 to 31 representing the day of the month.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number from 1900 or 1904 (depending on the workbook's date system) to 9999.
+ * @param {ApiRange | ApiName | number} arg2 - A number from 1 to 12 representing the month of the year.
+ * @param {ApiRange | ApiName | number} arg3 - A number from 1 to 31 representing the day of the month.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DATE.js
*/
ApiWorksheetFunction.prototype.DATE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DATE", arguments);
@@ -3541,29 +4080,32 @@
* Converts a date in the form of text to a number that represents the date in the date-time code.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is text that represents a date in a Microsoft Excel date format, between 1/1/1900 or 1/1/1904 (depending on the workbook's date system) and 12/31/9999.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The text that represents a date, between 1/1/1900 or 1/1/1904 (depending on the workbook's date system) and 12/31/9999.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DATEVALUE.js
*/
ApiWorksheetFunction.prototype.DATEVALUE = function (arg1) {
return this.private_calculateFunction("DATEVALUE", arguments);
};
/**
- * Returns the day of the month, a number from 1 to 31..
+ * Returns the day of the date given in the numerical format, a number from 1 to 31.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number in the date-time code used by Microsoft Excel.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number in the date-time code.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DAY.js
*/
ApiWorksheetFunction.prototype.DAY = function (arg1) {
return this.private_calculateFunction("DAY", arguments);
};
/**
- * Returns the number of days between the two dates..
+ * Returns the number of days between the two dates.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Start_date and end_date are the two dates between which you want to know the number of days.
- * @param {number} arg2 Start_date and end_date are the two dates between which you want to know the number of days.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Start date from which days will be counted.
+ * @param {ApiRange | ApiName | number} arg2 - End date until which days will be counted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DAYS.js
*/
ApiWorksheetFunction.prototype.DAYS = function (arg1, arg2) {
return this.private_calculateFunction("DAYS", arguments);
@@ -3572,42 +4114,50 @@
* Returns the number of days between two dates based on a 360-day year (twelve 30-day months).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Start_date and end_date are the two dates between which you want to know the number of days.
- * @param {number} arg2 Start_date and end_date are the two dates between which you want to know the number of days.
- * @param {?boolean} arg3 Is a logical value specifying the calculation method: U.S. (NASD) = FALSE or omitted; European = TRUE..
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Start date from which days will be counted.
+ * @param {ApiRange | ApiName | number} arg2 - End date until which days will be counted.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg3 - A logical value that specifies whether to use the U.S. (NASD) (false or omitted) or European (true) method in the calculation.
+ * According to the European method, the start and end dates that occur on the 31st of a month become equal to the 30th of the same month.
+ * According to the U.S. method, the start date is the last day of a month, it becomes equal to the 30th of the same month.
+ * If the end date is the last day of a month and the start date is earlier than the 30th of a month, the end date becomes equal to the 1st of the next month.
+ * Otherwise the end date becomes equal to the 30th of the same month.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DAYS360.js
*/
ApiWorksheetFunction.prototype.DAYS360 = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DAYS360", arguments);
};
/**
- * Returns the serial number of the date that is the indicated number of months before or after the start date.
+ * Returns the serial number of the date which comes the indicated number of months before or after the start date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is the number of months before or after start_date.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - The number of months before or after the start date.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EDATE.js
*/
ApiWorksheetFunction.prototype.EDATE = function (arg1, arg2) {
return this.private_calculateFunction("EDATE", arguments);
};
/**
- * Returns the serial number of the last day of the month before or after a specified number of months.
+ * Returns the serial number of the last day of the month before or after the specified number of months.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is the number of months before or after the start_date.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - The number of months before or after the start date.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EOMONTH.js
*/
ApiWorksheetFunction.prototype.EOMONTH = function (arg1, arg2) {
return this.private_calculateFunction("EOMONTH", arguments);
};
/**
- * Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.)..
+ * Returns the hour as a number from 0 (12:00 A.M.) to 23 (11:00 P.M.).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number in the date-time code used by Microsoft Excel, or text in time format, such as 16:48:00 or 4:48:00 PM.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string} arg1 - A number in the date-time code, or text in the time format, such as "16:48:00" or "4:48:00 PM", or a result of other formulas or functions.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HOUR.js
*/
ApiWorksheetFunction.prototype.HOUR = function (arg1) {
return this.private_calculateFunction("HOUR", arguments);
@@ -3616,28 +4166,31 @@
* Returns the ISO week number in the year for a given date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the date-time code used by Microsoft Excel for date and time calculation.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The date-time code used for date and time calculation.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISOWEEKNUM.js
*/
ApiWorksheetFunction.prototype.ISOWEEKNUM = function (arg1) {
return this.private_calculateFunction("ISOWEEKNUM", arguments);
};
/**
- * Returns the minute, a number from 0 to 59..
+ * Returns the minute, a number from 0 to 59.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number in the date-time code used by Microsoft Excel or text in time format, such as 16:48:00 or 4:48:00 PM.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string} arg1 - A number in the date-time code, or text in the time format, such as "16:48:00" or "4:48:00 PM", or a result of other formulas or functions.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MINUTE.js
*/
ApiWorksheetFunction.prototype.MINUTE = function (arg1) {
return this.private_calculateFunction("MINUTE", arguments);
};
/**
- * Returns the month, a number from 1 (January) to 12 (December)..
+ * Returns the month, a number from 1 (January) to 12 (December).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number in the date-time code used by Microsoft Excel.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1- A number in the date-time code.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MONTH.js
*/
ApiWorksheetFunction.prototype.MONTH = function (arg1) {
return this.private_calculateFunction("MONTH", arguments);
@@ -3646,10 +4199,11 @@
* Returns the number of whole workdays between two dates.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is a serial date number that represents the end date.
- * @param {?any} arg3 Is an optional set of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - A serial date number that represents the end date.
+ * @param {?ApiRange | number[]} arg3 - An optional range or array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NETWORKDAYS.js
*/
ApiWorksheetFunction.prototype.NETWORKDAYS = function (arg1, arg2, arg3) {
return this.private_calculateFunction("NETWORKDAYS", arguments);
@@ -3658,42 +4212,46 @@
* Returns the number of whole workdays between two dates with custom weekend parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is a serial date number that represents the end date.
- * @param {?number} arg3 Is a number or string specifying when weekends occur.
- * @param {?any} arg4 Is an optional set of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - A serial date number that represents the end date.
+ * @param {?ApiRange | ?ApiName | ?number | ?string} arg3 - A number or string specifying when weekends occur.
+ * @param {?ApiRange | number[]} arg4 - An optional range or array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NETWORKDAYS_INTL.js
*/
ApiWorksheetFunction.prototype.NETWORKDAYS_INTL = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("NETWORKDAYS.INTL", arguments);
};
/**
- * Returns the current date and time formatted as a date and time..
+ * Returns the current date and time in the MM/dd/yy hh:mm format.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NOW.js
*/
ApiWorksheetFunction.prototype.NOW = function () {
return this.private_calculateFunction("NOW", arguments);
};
/**
- * Returns the second, a number from 0 to 59..
+ * Returns the second, a number from 0 to 59.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number in the date-time code used by Microsoft Excel or text in time format, such as 16:48:23 or 4:48:47 PM.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string} arg1 - A number in the date-time code, or text in the time format, such as "16:48:00" or "4:48:00 PM", or a result of other formulas or functions.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SECOND.js
*/
ApiWorksheetFunction.prototype.SECOND = function (arg1) {
return this.private_calculateFunction("SECOND", arguments);
};
/**
- * Converts hours, minutes and seconds given as numbers to a serial number, formatted with a time format.
+ * Converts hours, minutes and seconds given as numbers to a serial number, formatted with the time format.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number from 0 to 23 representing the hour.
- * @param {number} arg2 Is a number from 0 to 59 representing the minute.
- * @param {number} arg3 Is a number from 0 to 59 representing the second.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number from 0 to 23 representing the hour.
+ * @param {ApiRange | ApiName | number} arg2 - A number from 0 to 59 representing the minute.
+ * @param {ApiRange | ApiName | number} arg3 - A number from 0 to 59 representing the second.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TIME.js
*/
ApiWorksheetFunction.prototype.TIME = function (arg1, arg2, arg3) {
return this.private_calculateFunction("TIME", arguments);
@@ -3702,28 +4260,32 @@
* Converts a text time to a serial number for a time, a number from 0 (12:00:00 AM) to 0.999988426 (11:59:59 PM). Format the number with a time format after entering the formula.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a text string that gives a time in any one of the Microsoft Excel time formats (date information in the string is ignored).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - A text string that represents a time in one of the time formats (date information in the string is ignored).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TIMEVALUE.js
*/
ApiWorksheetFunction.prototype.TIMEVALUE = function (arg1) {
return this.private_calculateFunction("TIMEVALUE", arguments);
};
/**
- * Returns the current date formatted as a date..
+ * Returns the current date in the MM/dd/yy format.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TODAY.js
*/
ApiWorksheetFunction.prototype.TODAY = function () {
return this.private_calculateFunction("TODAY", arguments);
};
/**
- * Returns a number from 1 to 7 identifying the day of the week of a date..
+ * Returns a number from 1 to 7 identifying the day of the week of the specified date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number that represents a date.
- * @param {?number} arg2 Is a number: for Sunday=1 through Saturday=7, use 1; for Monday=1 through Sunday=7, use 2; for Monday=0 through Sunday=6, use 3.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number that represents a date, or a result of other formulas or functions.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number that determines the type of return value: 1 - returns a number from 1 (Sunday) to 7 (Saturday);
+ * 2 - returns a number from 1 (Monday) to 7 (Sunday); 3 - returns a number from 0 (Monday) to 6 (Sunday).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/WEEKDAY.js
*/
ApiWorksheetFunction.prototype.WEEKDAY = function (arg1, arg2) {
return this.private_calculateFunction("WEEKDAY", arguments);
@@ -3732,9 +4294,10 @@
* Returns the week number in the year.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the date-time code used by Microsoft Excel for date and time calculation.
- * @param {?any} arg2 Is a number (1 or 2) that determines the type of the return value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The date-time code used for date and time calculation.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number (1 or 2) that determines the type of the return value: Sunday (1) or Monday (2).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/WEEKNUM.js
*/
ApiWorksheetFunction.prototype.WEEKNUM = function (arg1, arg2) {
return this.private_calculateFunction("WEEKNUM", arguments);
@@ -3743,10 +4306,11 @@
* Returns the serial number of the date before or after a specified number of workdays.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is the number of nonweekend and non-holiday days before or after start_date.
- * @param {?any} arg3 Is an optional array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - The number of nonweekend and non-holiday days before or after the start date. A positive value for days yields a future date; a negative value yields a past date.
+ * @param {?ApiRange | ApiName | number[]} arg3 - An optional range or array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/WORKDAY.js
*/
ApiWorksheetFunction.prototype.WORKDAY = function (arg1, arg2, arg3) {
return this.private_calculateFunction("WORKDAY", arguments);
@@ -3755,33 +4319,36 @@
* Returns the serial number of the date before or after a specified number of workdays with custom weekend parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is the number of nonweekend and non-holiday days before or after start_date.
- * @param {?number} arg3 Is a number or string specifying when weekends occur.
- * @param {?any} arg4 Is an optional array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - The number of nonweekend and non-holiday days before or after the start date. A positive value for days yields a future date; a negative value yields a past date.
+ * @param {?ApiRange | ?ApiName | ?number | ?string} arg3 - A number or string specifying when weekends occur.
+ * @param {?ApiRange | ?ApiName | &number[]} arg4 - An optional range or array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/WORKDAY_INTL.js
*/
ApiWorksheetFunction.prototype.WORKDAY_INTL = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("WORKDAY.INTL", arguments);
};
/**
- * Returns the year of a date, an integer in the range 1900-9999..
+ * Returns the year of a date, an integer in the range 1900-9999.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is a number in the date-time code used by Microsoft Excel.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number in the date-time code, or a result of other formulas or functions.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/YEAR.js
*/
ApiWorksheetFunction.prototype.YEAR = function (arg1) {
return this.private_calculateFunction("YEAR", arguments);
};
/**
- * Returns the year fraction representing the number of whole days between start_date and end_date.
+ * Returns the year fraction representing the number of whole days between the start date and end date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a serial date number that represents the start date.
- * @param {any} arg2 Is a serial date number that represents the end date.
- * @param {?any} arg3 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A serial date number that represents the start date.
+ * @param {ApiRange | ApiName | number} arg2 - A serial date number that represents the end date.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - The type of day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/YEARFRAC.js
*/
ApiWorksheetFunction.prototype.YEARFRAC = function (arg1, arg2, arg3) {
return this.private_calculateFunction("YEARFRAC", arguments);
@@ -3790,9 +4357,10 @@
* Returns the modified Bessel function In(x).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value at which to evaluate the function.
- * @param {any} arg2 Is the order of the Bessel function.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function.
+ * @param {ApiRange | ApiName | number} arg2 - The order of the Bessel function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BESSELI.js
*/
ApiWorksheetFunction.prototype.BESSELI = function (arg1, arg2) {
return this.private_calculateFunction("BESSELI", arguments);
@@ -3801,9 +4369,10 @@
* Returns the Bessel function Jn(x).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value at which to evaluate the function.
- * @param {any} arg2 Is the order of the Bessel function.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function.
+ * @param {ApiRange | ApiName | number} arg2 - The order of the Bessel function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BESSELJ.js
*/
ApiWorksheetFunction.prototype.BESSELJ = function (arg1, arg2) {
return this.private_calculateFunction("BESSELJ", arguments);
@@ -3812,9 +4381,10 @@
* Returns the modified Bessel function Kn(x).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value at which to evaluate the function.
- * @param {any} arg2 Is the order of the function.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function.
+ * @param {ApiRange | ApiName | number} arg2 - The order of the function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BESSELK.js
*/
ApiWorksheetFunction.prototype.BESSELK = function (arg1, arg2) {
return this.private_calculateFunction("BESSELK", arguments);
@@ -3823,9 +4393,10 @@
* Returns the Bessel function Yn(x).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value at which to evaluate the function.
- * @param {any} arg2 Is the order of the function.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value at which to evaluate the function.
+ * @param {ApiRange | ApiName | number} arg2 - The order of the function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BESSELY.js
*/
ApiWorksheetFunction.prototype.BESSELY = function (arg1, arg2) {
return this.private_calculateFunction("BESSELY", arguments);
@@ -3834,8 +4405,9 @@
* Converts a binary number to decimal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the binary number you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The binary number which will be convertrd.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BIN2DEC.js
*/
ApiWorksheetFunction.prototype.BIN2DEC = function (arg1) {
return this.private_calculateFunction("BIN2DEC", arguments);
@@ -3844,9 +4416,10 @@
* Converts a binary number to hexadecimal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the binary number you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The binary number which will be convertrd.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BIN2HEX.js
*/
ApiWorksheetFunction.prototype.BIN2HEX = function (arg1, arg2) {
return this.private_calculateFunction("BIN2HEX", arguments);
@@ -3855,64 +4428,70 @@
* Converts a binary number to octal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the binary number you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The binary number which will be convertrd.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BIN2OCT.js
*/
ApiWorksheetFunction.prototype.BIN2OCT = function (arg1, arg2) {
return this.private_calculateFunction("BIN2OCT", arguments);
};
/**
- * Returns a bitwise 'And' of two numbers.
+ * Returns a bitwise "AND" of two numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the decimal representation of the binary number you want to evaluate.
- * @param {number} arg2 Is the decimal representation of the binary number you want to evaluate.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The first decimal representation of the binary number to evaluate.
+ * @param {ApiRange | ApiName | number} arg2 - The second decimal representation of the binary number to evaluate.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BITAND.js
*/
ApiWorksheetFunction.prototype.BITAND = function (arg1, arg2) {
return this.private_calculateFunction("BITAND", arguments);
};
/**
- * Returns a number shifted left by shift_amount bits.
+ * Returns a number shifted left by the specified number of bits.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the decimal representation of the binary number you want to evaluate.
- * @param {number} arg2 Is the number of bits that you want to shift Number left by.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The decimal representation of the binary number to evaluate.
+ * @param {ApiRange | ApiName | number} arg2 - The number of bits by which the number will be shifted left.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BITLSHIFT.js
*/
ApiWorksheetFunction.prototype.BITLSHIFT = function (arg1, arg2) {
return this.private_calculateFunction("BITLSHIFT", arguments);
};
/**
- * Returns a bitwise 'Or' of two numbers.
+ * Returns a bitwise "OR" of two numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the decimal representation of the binary number you want to evaluate.
- * @param {number} arg2 Is the decimal representation of the binary number you want to evaluate.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The first decimal representation of the binary number to evaluate.
+ * @param {ApiRange | ApiName | number} arg2 - The second decimal representation of the binary number to evaluate.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BITOR.js
*/
ApiWorksheetFunction.prototype.BITOR = function (arg1, arg2) {
return this.private_calculateFunction("BITOR", arguments);
};
/**
- * Returns a number shifted right by shift_amount bits.
+ * Returns a number shifted right by the specified number of bits.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the decimal representation of the binary number you want to evaluate.
- * @param {number} arg2 Is the number of bits that you want to shift Number right by.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The decimal representation of the binary number to evaluate.
+ * @param {ApiRange | ApiName | number} arg2 - The number of bits by which the number will be shifted right.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BITRSHIFT.js
*/
ApiWorksheetFunction.prototype.BITRSHIFT = function (arg1, arg2) {
return this.private_calculateFunction("BITRSHIFT", arguments);
};
/**
- * Returns a bitwise 'Exclusive Or' of two numbers.
+ * Returns a bitwise "XOR" (Exclusive Or) of two numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the decimal representation of the binary number you want to evaluate.
- * @param {number} arg2 Is the decimal representation of the binary number you want to evaluate.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The first decimal representation of the binary number to evaluate.
+ * @param {ApiRange | ApiName | number} arg2 - The second decimal representation of the binary number to evaluate.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BITXOR.js
*/
ApiWorksheetFunction.prototype.BITXOR = function (arg1, arg2) {
return this.private_calculateFunction("BITXOR", arguments);
@@ -3921,10 +4500,12 @@
* Converts real and imaginary coefficients into a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the real coefficient of the complex number.
- * @param {any} arg2 Is the imaginary coefficient of the complex number.
- * @param {?any} arg3 Is the suffix for the imaginary component of the complex number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The real coefficient of the complex number.
+ * @param {ApiRange | ApiName | number} arg2 - The imaginary coefficient of the complex number.
+ * @param {?ApiRange | ?ApiName | ?string} arg3 - The suffix for the imaginary component of the complex number. It can be either "i" or "j" in lowercase.
+ * If it is omitted, the function will assume suffix to be "i".
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COMPLEX.js
*/
ApiWorksheetFunction.prototype.COMPLEX = function (arg1, arg2, arg3) {
return this.private_calculateFunction("COMPLEX", arguments);
@@ -3933,10 +4514,11 @@
* Converts a number from one measurement system to another.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value in from_units to convert.
- * @param {any} arg2 Is the units for number.
- * @param {any} arg3 Is the units for the result.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value in the specified units to be converted.
+ * @param {ApiRange | ApiName | string} arg2 - The original measurement unit.
+ * @param {ApiRange | ApiName | string} arg3 - The units for the result.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CONVERT.js
*/
ApiWorksheetFunction.prototype.CONVERT = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CONVERT", arguments);
@@ -3945,9 +4527,10 @@
* Converts a decimal number to binary.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the decimal integer you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The decimal integer to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DEC2BIN.js
*/
ApiWorksheetFunction.prototype.DEC2BIN = function (arg1, arg2) {
return this.private_calculateFunction("DEC2BIN", arguments);
@@ -3956,9 +4539,10 @@
* Converts a decimal number to hexadecimal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the decimal integer you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The decimal integer to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DEC2HEX.js
*/
ApiWorksheetFunction.prototype.DEC2HEX = function (arg1, arg2) {
return this.private_calculateFunction("DEC2HEX", arguments);
@@ -3967,83 +4551,91 @@
* Converts a decimal number to octal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the decimal integer you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Te decimal integer to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DEC2OCT.js
*/
ApiWorksheetFunction.prototype.DEC2OCT = function (arg1, arg2) {
return this.private_calculateFunction("DEC2OCT", arguments);
};
/**
- * Tests whether two numbers are equal.
+ * Tests whether two numbers are equal. The function returns 1 if the numbers are equal and 0 otherwise.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the first number.
- * @param {?any} arg2 Is the second number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The first number.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The second number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DELTA.js
*/
ApiWorksheetFunction.prototype.DELTA = function (arg1, arg2) {
return this.private_calculateFunction("DELTA", arguments);
};
/**
- * Returns the error function.
+ * Returns the error function integrated between the specified lower and upper limits.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the lower bound for integrating ERF.
- * @param {?any} arg2 Is the upper bound for integrating ERF.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The lower bound for integrating the error function.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The upper bound for integrating the error function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ERF.js
*/
ApiWorksheetFunction.prototype.ERF = function (arg1, arg2) {
return this.private_calculateFunction("ERF", arguments);
};
/**
- * Returns the error function.
+ * Returns the error function integrated between 0 and the specified lower limit.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the lower bound for integrating ERF.PRECISE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The lower bound for integrating the error function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ERF_PRECISE.js
*/
ApiWorksheetFunction.prototype.ERF_PRECISE = function (arg1) {
return this.private_calculateFunction("ERF.PRECISE", arguments);
};
/**
- * Returns the complementary error function.
+ * Returns the complementary error function integrated between the specified lower limit and infinity.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the lower bound for integrating ERF.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The lower bound for integrating the complementary error function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ERFC.js
*/
ApiWorksheetFunction.prototype.ERFC = function (arg1) {
return this.private_calculateFunction("ERFC", arguments);
};
/**
- * Returns the complementary error function.
+ * Returns the complementary error function integrated between the specified lower limit and infinity.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the lower bound for integrating ERFC.PRECISE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The lower bound for integrating the complementary error function.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ERFC_PRECISE.js
*/
ApiWorksheetFunction.prototype.ERFC_PRECISE = function (arg1) {
return this.private_calculateFunction("ERFC.PRECISE", arguments);
};
/**
- * Tests whether a number is greater than a threshold value.
+ * Tests whether a number is greater than a threshold value. The function returns 1 if the number is greater than or equal to the threshold value and 0 otherwise.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to test against step.
- * @param {?any} arg2 Is the threshold value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to test against step.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The threshold value.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GESTEP.js
*/
ApiWorksheetFunction.prototype.GESTEP = function (arg1, arg2) {
return this.private_calculateFunction("GESTEP", arguments);
};
/**
- * Converts a Hexadecimal number to binary.
+ * Converts a hexadecimal number to binary.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the hexadecimal number you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The hexadecimal number to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HEX2BIN.js
*/
ApiWorksheetFunction.prototype.HEX2BIN = function (arg1, arg2) {
return this.private_calculateFunction("HEX2BIN", arguments);
@@ -4052,8 +4644,9 @@
* Converts a hexadecimal number to decimal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the hexadecimal number you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The hexadecimal number to convert.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HEX2DEC.js
*/
ApiWorksheetFunction.prototype.HEX2DEC = function (arg1) {
return this.private_calculateFunction("HEX2DEC", arguments);
@@ -4062,9 +4655,10 @@
* Converts a hexadecimal number to octal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the hexadecimal number you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The hexadecimal number to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HEX2OCT.js
*/
ApiWorksheetFunction.prototype.HEX2OCT = function (arg1, arg2) {
return this.private_calculateFunction("HEX2OCT", arguments);
@@ -4073,8 +4667,9 @@
* Returns the absolute value (modulus) of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the absolute value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMABS.js
*/
ApiWorksheetFunction.prototype.IMABS = function (arg1) {
return this.private_calculateFunction("IMABS", arguments);
@@ -4083,18 +4678,20 @@
* Returns the imaginary coefficient of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the imaginary coefficient.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMAGINARY.js
*/
ApiWorksheetFunction.prototype.IMAGINARY = function (arg1) {
return this.private_calculateFunction("IMAGINARY", arguments);
};
/**
- * Returns the argument q, an angle expressed in radians.
+ * Returns the argument Theta, an angle expressed in radians.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the argument.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMARGUMENT.js
*/
ApiWorksheetFunction.prototype.IMARGUMENT = function (arg1) {
return this.private_calculateFunction("IMARGUMENT", arguments);
@@ -4103,8 +4700,9 @@
* Returns the complex conjugate of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the conjugate.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMCONJUGATE.js
*/
ApiWorksheetFunction.prototype.IMCONJUGATE = function (arg1) {
return this.private_calculateFunction("IMCONJUGATE", arguments);
@@ -4113,8 +4711,9 @@
* Returns the cosine of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the cosine.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMCOS.js
*/
ApiWorksheetFunction.prototype.IMCOS = function (arg1) {
return this.private_calculateFunction("IMCOS", arguments);
@@ -4123,8 +4722,9 @@
* Returns the hyperbolic cosine of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the hyperbolic cosine.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMCOSH.js
*/
ApiWorksheetFunction.prototype.IMCOSH = function (arg1) {
return this.private_calculateFunction("IMCOSH", arguments);
@@ -4133,8 +4733,9 @@
* Returns the cotangent of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the cotangent.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMCOT.js
*/
ApiWorksheetFunction.prototype.IMCOT = function (arg1) {
return this.private_calculateFunction("IMCOT", arguments);
@@ -4143,8 +4744,9 @@
* Returns the cosecant of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the cosecant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMCSC.js
*/
ApiWorksheetFunction.prototype.IMCSC = function (arg1) {
return this.private_calculateFunction("IMCSC", arguments);
@@ -4153,8 +4755,9 @@
* Returns the hyperbolic cosecant of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the hyperbolic cosecant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMCSCH.js
*/
ApiWorksheetFunction.prototype.IMCSCH = function (arg1) {
return this.private_calculateFunction("IMCSCH", arguments);
@@ -4163,9 +4766,10 @@
* Returns the quotient of two complex numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the complex numerator or dividend.
- * @param {any} arg2 Is the complex denominator or divisor.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The complex numerator or dividend in the x + yi or x + yj form.
+ * @param {ApiRange | ApiName | number} arg2 - The complex denominator or divisor in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMDIV.js
*/
ApiWorksheetFunction.prototype.IMDIV = function (arg1, arg2) {
return this.private_calculateFunction("IMDIV", arguments);
@@ -4174,8 +4778,9 @@
* Returns the exponential of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the exponential.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMEXP.js
*/
ApiWorksheetFunction.prototype.IMEXP = function (arg1) {
return this.private_calculateFunction("IMEXP", arguments);
@@ -4184,8 +4789,9 @@
* Returns the natural logarithm of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the natural logarithm.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMLN.js
*/
ApiWorksheetFunction.prototype.IMLN = function (arg1) {
return this.private_calculateFunction("IMLN", arguments);
@@ -4194,8 +4800,9 @@
* Returns the base-10 logarithm of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the common logarithm.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMLOG10.js
*/
ApiWorksheetFunction.prototype.IMLOG10 = function (arg1) {
return this.private_calculateFunction("IMLOG10", arguments);
@@ -4204,8 +4811,9 @@
* Returns the base-2 logarithm of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the base-2 logarithm.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMLOG2.js
*/
ApiWorksheetFunction.prototype.IMLOG2 = function (arg1) {
return this.private_calculateFunction("IMLOG2", arguments);
@@ -4214,18 +4822,21 @@
* Returns a complex number raised to an integer power.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number you want to raise to a power.
- * @param {any} arg2 Is the power to which you want to raise the complex number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @param {ApiRange | ApiName | number} arg2 - The power to which the complex number will be raised.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMPOWER.js
*/
ApiWorksheetFunction.prototype.IMPOWER = function (arg1, arg2) {
return this.private_calculateFunction("IMPOWER", arguments);
};
/**
- * Returns the product of 1 to 255 complex numbers.
+ * Returns the product of the specified complex numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} args - Up to 255 complex numbers expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMPRODUCT.js
*/
ApiWorksheetFunction.prototype.IMPRODUCT = function () {
return this.private_calculateFunction("IMPRODUCT", arguments);
@@ -4234,8 +4845,9 @@
* Returns the real coefficient of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the real coefficient.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMREAL.js
*/
ApiWorksheetFunction.prototype.IMREAL = function (arg1) {
return this.private_calculateFunction("IMREAL", arguments);
@@ -4244,8 +4856,9 @@
* Returns the secant of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the secant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSEC.js
*/
ApiWorksheetFunction.prototype.IMSEC = function (arg1) {
return this.private_calculateFunction("IMSEC", arguments);
@@ -4254,8 +4867,9 @@
* Returns the hyperbolic secant of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the hyperbolic secant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSECH.js
*/
ApiWorksheetFunction.prototype.IMSECH = function (arg1) {
return this.private_calculateFunction("IMSECH", arguments);
@@ -4264,8 +4878,9 @@
* Returns the sine of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the sine.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSIN.js
*/
ApiWorksheetFunction.prototype.IMSIN = function (arg1) {
return this.private_calculateFunction("IMSIN", arguments);
@@ -4274,8 +4889,9 @@
* Returns the hyperbolic sine of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the hyperbolic sine.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSINH.js
*/
ApiWorksheetFunction.prototype.IMSINH = function (arg1) {
return this.private_calculateFunction("IMSINH", arguments);
@@ -4284,28 +4900,32 @@
* Returns the square root of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the square root.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSQRT.js
*/
ApiWorksheetFunction.prototype.IMSQRT = function (arg1) {
return this.private_calculateFunction("IMSQRT", arguments);
};
/**
- * Returns the difference of two complex numbers.
+ * Returns the difference of two complex numbers expressed in the x + yi or x + yj form.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the complex number from which to subtract inumber2.
- * @param {any} arg2 Is the complex number to subtract from inumber1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The complex number from which to subtract the second number.
+ * @param {ApiRange | ApiName | number} arg2 - The complex number to subtract from the first number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSUB.js
*/
ApiWorksheetFunction.prototype.IMSUB = function (arg1, arg2) {
return this.private_calculateFunction("IMSUB", arguments);
};
/**
- * Returns the sum of complex numbers.
+ * Returns the sum of the specified complex numbers.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} args - Up to 255 complex numbers expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMSUM.js
*/
ApiWorksheetFunction.prototype.IMSUM = function () {
return this.private_calculateFunction("IMSUM", arguments);
@@ -4314,8 +4934,9 @@
* Returns the tangent of a complex number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a complex number for which you want the tangent.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A complex number expressed in the x + yi or x + yj form.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IMTAN.js
*/
ApiWorksheetFunction.prototype.IMTAN = function (arg1) {
return this.private_calculateFunction("IMTAN", arguments);
@@ -4324,9 +4945,10 @@
* Converts an octal number to binary.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the octal number you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The octal number to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/OCT2BIN.js
*/
ApiWorksheetFunction.prototype.OCT2BIN = function (arg1, arg2) {
return this.private_calculateFunction("OCT2BIN", arguments);
@@ -4335,8 +4957,9 @@
* Converts an octal number to decimal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the octal number you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The octal number to convert.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/OCT2DEC.js
*/
ApiWorksheetFunction.prototype.OCT2DEC = function (arg1) {
return this.private_calculateFunction("OCT2DEC", arguments);
@@ -4345,21 +4968,23 @@
* Converts an octal number to hexadecimal.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the octal number you want to convert.
- * @param {?any} arg2 Is the number of characters to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The octal number to convert.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 -The number of characters to use.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/OCT2HEX.js
*/
ApiWorksheetFunction.prototype.OCT2HEX = function (arg1, arg2) {
return this.private_calculateFunction("OCT2HEX", arguments);
};
/**
- * Averages the values in a column in a list or database that match conditions you specify.
+ * Averages the values in a field (column) of records in a list or database that match conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DAVERAGE.js
*/
ApiWorksheetFunction.prototype.DAVERAGE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DAVERAGE", arguments);
@@ -4368,10 +4993,11 @@
* Counts the cells containing numbers in the field (column) of records in the database that match the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DCOUNT.js
*/
ApiWorksheetFunction.prototype.DCOUNT = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DCOUNT", arguments);
@@ -4380,10 +5006,11 @@
* Counts nonblank cells in the field (column) of records in the database that match the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1- The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DCOUNTA.js
*/
ApiWorksheetFunction.prototype.DCOUNTA = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DCOUNTA", arguments);
@@ -4392,10 +5019,11 @@
* Extracts from a database a single record that matches the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DGET.js
*/
ApiWorksheetFunction.prototype.DGET = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DGET", arguments);
@@ -4404,10 +5032,11 @@
* Returns the largest number in the field (column) of records in the database that match the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DMAX.js
*/
ApiWorksheetFunction.prototype.DMAX = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DMAX", arguments);
@@ -4416,10 +5045,11 @@
* Returns the smallest number in the field (column) of records in the database that match the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DMIN.js
*/
ApiWorksheetFunction.prototype.DMIN = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DMIN", arguments);
@@ -4428,34 +5058,37 @@
* Multiplies the values in the field (column) of records in the database that match the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DPRODUCT.js
*/
ApiWorksheetFunction.prototype.DPRODUCT = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DPRODUCT", arguments);
};
/**
- * Estimates the standard deviation based on a sample from selected database entries.
+ * Estimates the standard deviation based on a sample from the selected database entries.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DSTDEV.js
*/
ApiWorksheetFunction.prototype.DSTDEV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DSTDEV", arguments);
};
/**
- * Calculates the standard deviation based on the entire population of selected database entries.
+ * Calculates the standard deviation based on the entire population of the selected database entries.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DSTDEVP.js
*/
ApiWorksheetFunction.prototype.DSTDEVP = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DSTDEVP", arguments);
@@ -4464,51 +5097,56 @@
* Adds the numbers in the field (column) of records in the database that match the conditions you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DSUM.js
*/
ApiWorksheetFunction.prototype.DSUM = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DSUM", arguments);
};
/**
- * Estimates variance based on a sample from selected database entries.
+ * Estimates variance based on a sample from the selected database entries.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DVAR.js
*/
ApiWorksheetFunction.prototype.DVAR = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DVAR", arguments);
};
/**
- * Calculates variance based on the entire population of selected database entries.
+ * Calculates variance based on the entire population of the selected database entries.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells that makes up the list or database. A database is a list of related data.
- * @param {number} arg2 Is either the label of the column in double quotation marks or a number that represents the column's position in the list.
- * @param {string} arg3 Is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells that makes up the list or database. A database is a list of related data.
+ * @param {ApiRange | ApiName | number | string} arg2 - The column which is used in the function. Either the label of the column in double quotation marks or a number that represents the column's position in the list.
+ * @param {ApiRange | ApiName} arg3 - The range of cells that contains the conditions you specify. The range includes at least one column label and at least one cell below the column label for a condition.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DVARP.js
*/
ApiWorksheetFunction.prototype.DVARP = function (arg1, arg2, arg3) {
return this.private_calculateFunction("DVARP", arguments);
};
/**
- * Returns the accrued interest for a security that pays periodic interest..
+ * Returns the accrued interest for a security that pays periodic interest.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's issue date, expressed as a serial date number.
- * @param {any} arg2 Is the security's first interest date, expressed as a serial date number.
- * @param {any} arg3 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg4 Is the security's annual coupon rate.
- * @param {any} arg5 Is the security's par value.
- * @param {any} arg6 Is the number of coupon payments per year.
- * @param {?any} arg7 Is the type of day count basis to use.
- * @param {?any} arg8 Is a logical value: to accrued interest from issue date = TRUE or omitted; to calculate from last coupon payment date = FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The issue date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The date when the first interest is paid, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg4 - The annual coupon rate of the security.
+ * @param {ApiRange | ApiName | number} arg5 - The par value of the security.
+ * @param {ApiRange | ApiName | number} arg6 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg7 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @param {?ApiRange | ?ApiName | ?number} arg8 - A logical value: true (1) or omitted returns the accrued interest from the issue date to the settlement date.
+ * false (0) returns the accrued interest from the first interest date to the settlement date.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ACCRINT.js
*/
ApiWorksheetFunction.prototype.ACCRINT = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
return this.private_calculateFunction("ACCRINT", arguments);
@@ -4517,44 +5155,47 @@
* Returns the accrued interest for a security that pays interest at maturity.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's issue date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's annual coupon rate.
- * @param {any} arg4 Is the security's par value.
- * @param {?any} arg5 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The issue date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The annual coupon rate of the security.
+ * @param {ApiRange | ApiName | number} arg4 - The par value of the security.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ACCRINTM.js
*/
ApiWorksheetFunction.prototype.ACCRINTM = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("ACCRINTM", arguments);
};
/**
- * Returns the prorated linear depreciation of an asset for each accounting period..
+ * Returns the prorated linear depreciation of an asset for each accounting period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1.
- * @param {any} arg2.
- * @param {any} arg3.
- * @param {any} arg4.
- * @param {any} arg5.
- * @param {any} arg6.
- * @param {?any} arg7.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The date when asset is purchased.
+ * @param {ApiRange | ApiName | number} arg3 - The date when the first period ends.
+ * @param {ApiRange | ApiName | number} arg4 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg5 - The period for which the depreciation will be calculated.
+ * @param {ApiRange | ApiName | number} arg6 - The rate of depreciation.
+ * @param {?ApiRange | ?ApiName | ?number} arg7 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AMORDEGRC.js
*/
ApiWorksheetFunction.prototype.AMORDEGRC = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
return this.private_calculateFunction("AMORDEGRC", arguments);
};
/**
- * Returns the prorated linear depreciation of an asset for each accounting period..
+ * Returns the prorated linear depreciation of an asset for each accounting period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the cost of the asset.
- * @param {any} arg2 Is the date the asset is purchased.
- * @param {any} arg3 Is the date of the end of the first period.
- * @param {any} arg4 Is the salvage value at the end of life of the asset..
- * @param {any} arg5 Is the period.
- * @param {any} arg6 Is the rate of depreciation.
- * @param {?any} arg7 Year_basis : 0 for year of 360 days, 1 for actual, 3 for year of 365 days..
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The date when asset is purchased.
+ * @param {ApiRange | ApiName | number} arg3 - The date when the first period ends.
+ * @param {ApiRange | ApiName | number} arg4 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg5 - The period for which the depreciation will be calculated.
+ * @param {ApiRange | ApiName | number} arg6 - The rate of depreciation.
+ * @param {?ApiRange | ?ApiName | ?number} arg7 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AMORLINC.js
*/
ApiWorksheetFunction.prototype.AMORLINC = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
return this.private_calculateFunction("AMORLINC", arguments);
@@ -4563,11 +5204,12 @@
* Returns the number of days from the beginning of the coupon period to the settlement date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the number of coupon payments per year.
- * @param {?any} arg4 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUPDAYBS.js
*/
ApiWorksheetFunction.prototype.COUPDAYBS = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("COUPDAYBS", arguments);
@@ -4576,11 +5218,12 @@
* Returns the number of days in the coupon period that contains the settlement date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the number of coupon payments per year.
- * @param {?any} arg4 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUPDAYS.js
*/
ApiWorksheetFunction.prototype.COUPDAYS = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("COUPDAYS", arguments);
@@ -4589,11 +5232,12 @@
* Returns the number of days from the settlement date to the next coupon date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the number of coupon payments per year.
- * @param {?any} arg4 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUPDAYSNC.js
*/
ApiWorksheetFunction.prototype.COUPDAYSNC = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("COUPDAYSNC", arguments);
@@ -4602,11 +5246,12 @@
* Returns the next coupon date after the settlement date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the number of coupon payments per year.
- * @param {?any} arg4 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUPNCD.js
*/
ApiWorksheetFunction.prototype.COUPNCD = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("COUPNCD", arguments);
@@ -4615,11 +5260,12 @@
* Returns the number of coupons payable between the settlement date and maturity date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the number of coupon payments per year.
- * @param {?any} arg4 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUPNUM.js
*/
ApiWorksheetFunction.prototype.COUPNUM = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("COUPNUM", arguments);
@@ -4628,11 +5274,12 @@
* Returns the previous coupon date before the settlement date.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the number of coupon payments per year.
- * @param {?any} arg4 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COUPPCD.js
*/
ApiWorksheetFunction.prototype.COUPPCD = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("COUPPCD", arguments);
@@ -4641,13 +5288,14 @@
* Returns the cumulative interest paid between two periods.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the interest rate.
- * @param {any} arg2 Is the total number of payment periods.
- * @param {any} arg3 Is the present value.
- * @param {any} arg4 Is the first period in the calculation.
- * @param {any} arg5 Is the last period in the calculation.
- * @param {any} arg6 Is the timing of the payment.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate for the investment.
+ * @param {ApiRange | ApiName | number} arg2 - The total number of payment periods.
+ * @param {ApiRange | ApiName | number} arg3 - A present value of the payments.
+ * @param {ApiRange | ApiName | number} arg4 - The first period included into the calculation.
+ * @param {ApiRange | ApiName | number} arg5 - The last period included into the calculation.
+ * @param {ApiRange | ApiName | number} arg6 - The timing of the payment.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CUMIPMT.js
*/
ApiWorksheetFunction.prototype.CUMIPMT = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("CUMIPMT", arguments);
@@ -4656,13 +5304,14 @@
* Returns the cumulative principal paid on a loan between two periods.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the interest rate.
- * @param {any} arg2 Is the total number of payment periods.
- * @param {any} arg3 Is the present value.
- * @param {any} arg4 Is the first period in the calculation.
- * @param {any} arg5 Is the last period in the calculation.
- * @param {any} arg6 Is the timing of the payment.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate for the investment.
+ * @param {ApiRange | ApiName | number} arg2 - The total number of payment periods.
+ * @param {ApiRange | ApiName | number} arg3 - A present value of the payments.
+ * @param {ApiRange | ApiName | number} arg4 - The first period included into the calculation.
+ * @param {ApiRange | ApiName | number} arg5 - The last period included into the calculation.
+ * @param {ApiRange | ApiName | number} arg6 - The timing of the payment.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CUMPRINC.js
*/
ApiWorksheetFunction.prototype.CUMPRINC = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("CUMPRINC", arguments);
@@ -4671,12 +5320,13 @@
* Returns the depreciation of an asset for a specified period using the fixed-declining balance method.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the initial cost of the asset.
- * @param {number} arg2 Is the salvage value at the end of the life of the asset.
- * @param {number} arg3 Is the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
- * @param {number} arg4 Is the period for which you want to calculate the depreciation. Period must use the same units as Life.
- * @param {?number} arg5 Is the number of months in the first year. If month is omitted, it is assumed to be 12.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The initial cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg3 - The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
+ * @param {ApiRange | ApiName | number} arg4 - The period for which the depreciation will be calculated. Period must use the same units as the useful life of the asset.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The number of months in the first year. If this parameter is omitted, it is assumed to be 12.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DB.js
*/
ApiWorksheetFunction.prototype.DB = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("DB", arguments);
@@ -4685,12 +5335,13 @@
* Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the initial cost of the asset.
- * @param {number} arg2 Is the salvage value at the end of the life of the asset.
- * @param {number} arg3 Is the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
- * @param {number} arg4 Is the period for which you want to calculate the depreciation. Period must use the same units as Life.
- * @param {?number} arg5 Is the rate at which the balance declines. If Factor is omitted, it is assumed to be 2 (the double-declining balance method).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The initial cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg3 - The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
+ * @param {ApiRange | ApiName | number} arg4 - The period for which the depreciation will be calculated. Period must use the same units as the useful life of the asset.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The rate at which the balance declines. If this parameter is omitted, it is assumed to be 2 (the double-declining balance method).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DDB.js
*/
ApiWorksheetFunction.prototype.DDB = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("DDB", arguments);
@@ -4699,12 +5350,13 @@
* Returns the discount rate for a security.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's price per $100 face value.
- * @param {any} arg4 Is the security's redemption value per $100 face value.
- * @param {?any} arg5 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The purchase price of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg4 - The redemption value of the security, per $100 par value.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DISC.js
*/
ApiWorksheetFunction.prototype.DISC = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("DISC", arguments);
@@ -4713,9 +5365,10 @@
* Converts a dollar price, expressed as a fraction, into a dollar price, expressed as a decimal number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a number expressed as a fraction.
- * @param {any} arg2 Is the integer to use in the denominator of the fraction.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A number expressed as a fraction.
+ * @param {ApiRange | ApiName | number} arg2 - The integer to use in the denominator of the fraction.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DOLLARDE.js
*/
ApiWorksheetFunction.prototype.DOLLARDE = function (arg1, arg2) {
return this.private_calculateFunction("DOLLARDE", arguments);
@@ -4724,9 +5377,10 @@
* Converts a dollar price, expressed as a decimal number, into a dollar price, expressed as a fraction.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a decimal number.
- * @param {any} arg2 Is the integer to use in the denominator of a fraction.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A decimal number.
+ * @param {ApiRange | ApiName | number} arg2 - The integer to use in the denominator of a fraction.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DOLLARFR.js
*/
ApiWorksheetFunction.prototype.DOLLARFR = function (arg1, arg2) {
return this.private_calculateFunction("DOLLARFR", arguments);
@@ -4735,13 +5389,14 @@
* Returns the annual duration of a security with periodic interest payments.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's annual coupon rate.
- * @param {any} arg4 Is the security's annual yield.
- * @param {any} arg5 Is the number of coupon payments per year.
- * @param {?any} arg6 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The annual coupon rate of the security.
+ * @param {ApiRange | ApiName | number} arg4 - The annual yield of the security.
+ * @param {ApiRange | ApiName | number} arg5 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DURATION.js
*/
ApiWorksheetFunction.prototype.DURATION = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("DURATION", arguments);
@@ -4750,9 +5405,10 @@
* Returns the effective annual interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the nominal interest rate.
- * @param {any} arg2 Is the number of compounding periods per year.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The nominal interest rate.
+ * @param {ApiRange | ApiName | number} arg2 - The number of compounding periods per year.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EFFECT.js
*/
ApiWorksheetFunction.prototype.EFFECT = function (arg1, arg2) {
return this.private_calculateFunction("EFFECT", arguments);
@@ -4761,12 +5417,13 @@
* Returns the future value of an investment based on periodic, constant payments and a constant interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Is the total number of payment periods in the investment.
- * @param {number} arg3 Is the payment made each period; it cannot change over the life of the investment.
- * @param {?number} arg4 Is the present value, or the lump-sum amount that a series of future payments is worth now. If omitted, Pv = 0.
- * @param {?number} arg5 Is a value representing the timing of payment: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The total number of payment periods in the investment.
+ * @param {ApiRange | ApiName | number} arg3 - The payment made each period; it cannot change over the life of the investment.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The present value, or the lump-sum amount that a series of future payments is worth now. If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - A value representing the timing of payment: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FV.js
*/
ApiWorksheetFunction.prototype.FV = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("FV", arguments);
@@ -4775,9 +5432,10 @@
* Returns the future value of an initial principal after applying a series of compound interest rates.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the present value.
- * @param {any} arg2 Is an array of interest rates to apply.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The present value of an investment.
+ * @param {number[] | ApiRange | ApiName} arg2 - An array of interest rates to apply.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FVSCHEDULE.js
*/
ApiWorksheetFunction.prototype.FVSCHEDULE = function (arg1, arg2) {
return this.private_calculateFunction("FVSCHEDULE", arguments);
@@ -4786,12 +5444,13 @@
* Returns the interest rate for a fully invested security.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the amount invested in the security.
- * @param {any} arg4 Is the amount to be received at maturity.
- * @param {?any} arg5 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The amount invested in the security.
+ * @param {ApiRange | ApiName | number} arg4 - The amount to be received at maturity.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/INTRATE.js
*/
ApiWorksheetFunction.prototype.INTRATE = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("INTRATE", arguments);
@@ -4800,13 +5459,14 @@
* Returns the interest payment for a given period for an investment, based on periodic, constant payments and a constant interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Is the period for which you want to find the interest and must be in the range 1 to Nper.
- * @param {number} arg3 Is the total number of payment periods in an investment.
- * @param {number} arg4 Is the present value, or the lump-sum amount that a series of future payments is worth now.
- * @param {?number} arg5 Is the future value, or a cash balance you want to attain after the last payment is made. If omitted, Fv = 0.
- * @param {?number} arg6 Is a logical value representing the timing of payment: at the end of the period = 0 or omitted, at the beginning of the period = 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The period for which the interest will be returned. It must be in the range from 1 to the total number of payments.
+ * @param {ApiRange | ApiName | number} arg3 - The total number of payment periods in an investment.
+ * @param {ApiRange | ApiName | number} arg4 - The present value, or the lump-sum amount that a series of future payments is worth now.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The future value, or a cash balance which will be attained after the last payment is made. If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - A logical value representing the timing of payment: at the end of the period = 0 or omitted, at the beginning of the period = 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IPMT.js
*/
ApiWorksheetFunction.prototype.IPMT = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("IPMT", arguments);
@@ -4815,9 +5475,10 @@
* Returns the internal rate of return for a series of cash flows.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is an array or a reference to cells that contain numbers for which you want to calculate the internal rate of return.
- * @param {?number} arg2 Is a number that you guess is close to the result of IRR; 0.1 (10 percent) if omitted.
- * @returns {number | string | boolean}
+ * @param {number[] | ApiRange} arg1 - A range or array of cells that contain numbers for which the internal rate of return will be calculated.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - An estimate at what the internal rate of return will be. If it is omitted, the function will assume guess to be 0.1 (10 percent).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IRR.js
*/
ApiWorksheetFunction.prototype.IRR = function (arg1, arg2) {
return this.private_calculateFunction("IRR", arguments);
@@ -4826,26 +5487,28 @@
* Returns the interest paid during a specific period of an investment.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Period for which you want to find the interest.
- * @param {number} arg3 Number of payment periods in an investment.
- * @param {number} arg4 Lump sum amount that a series of future payments is right now.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The period for which the interest will be retuned. It must be in the range from 1 to the total number of payments.
+ * @param {ApiRange | ApiName | number} arg3 - The total number of payment periods in an investment.
+ * @param {ApiRange | ApiName | number} arg4 - The present value, or the lump-sum amount that a series of future payments is worth now.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISPMT.js
*/
ApiWorksheetFunction.prototype.ISPMT = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("ISPMT", arguments);
};
/**
- * Returns the Macauley modified duration for a security with an assumed par value of $100.
+ * Returns the modified Macauley duration of a security with an assumed par value of $100.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's annual coupon rate.
- * @param {any} arg4 Is the security's annual yield.
- * @param {any} arg5 Is the number of coupon payments per year.
- * @param {?any} arg6 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The annual coupon rate of the security.
+ * @param {ApiRange | ApiName | number} arg4 - The annual yield of the security.
+ * @param {ApiRange | ApiName | number} arg5 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MDURATION.js
*/
ApiWorksheetFunction.prototype.MDURATION = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("MDURATION", arguments);
@@ -4854,10 +5517,11 @@
* Returns the internal rate of return for a series of periodic cash flows, considering both cost of investment and interest on reinvestment of cash.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is an array or a reference to cells that contain numbers that represent a series of payments (negative) and income (positive) at regular periods.
- * @param {number} arg2 Is the interest rate you pay on the money used in the cash flows.
- * @param {number} arg3 Is the interest rate you receive on the cash flows as you reinvest them.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - A range or array of cells that contain numbers that represent a series of payments (negative) and income (positive) at regular periods.
+ * @param {ApiRange | ApiName | number} arg2 - The interest rate paid on the money used in the cash flows.
+ * @param {ApiRange | ApiName | number} arg3 - The interest rate received on the cash reinvestment.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MIRR.js
*/
ApiWorksheetFunction.prototype.MIRR = function (arg1, arg2, arg3) {
return this.private_calculateFunction("MIRR", arguments);
@@ -4866,9 +5530,10 @@
* Returns the annual nominal interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the effective interest rate.
- * @param {any} arg2 Is the number of compounding periods per year.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The effective interest rate of the security.
+ * @param {ApiRange | ApiName | number} arg2 - The number of compounding periods per year.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NOMINAL.js
*/
ApiWorksheetFunction.prototype.NOMINAL = function (arg1, arg2) {
return this.private_calculateFunction("NOMINAL", arguments);
@@ -4877,12 +5542,13 @@
* Returns the number of periods for an investment based on periodic, constant payments and a constant interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Is the payment made each period; it cannot change over the life of the investment.
- * @param {number} arg3 Is the present value, or the lump-sum amount that a series of future payments is worth now.
- * @param {?number} arg4 Is the future value, or a cash balance you want to attain after the last payment is made. If omitted, zero is used.
- * @param {?number} arg5 Is a logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The payment made each period; it cannot change over the life of the investment.
+ * @param {ApiRange | ApiName | number} arg3 - Te present value, or the lump-sum amount that a series of future payments is worth now.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The future value, or a cash balance which will be attained after the last payment is made. If omitted, zero is used.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - A logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NPER.js
*/
ApiWorksheetFunction.prototype.NPER = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("NPER", arguments);
@@ -4891,7 +5557,11 @@
* Returns the net present value of an investment based on a discount rate and a series of future payments (negative values) and income (positive values).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The discount rate.
+ * @param {number | ApiRange | number[]} args - Up to 255 arguments representing future payments (negative values) and income (positive values).
+ * The first argument is required, the subsequent values are optional. Arguments can be numbers, ranges, arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NPV.js
*/
ApiWorksheetFunction.prototype.NPV = function () {
return this.private_calculateFunction("NPV", arguments);
@@ -4900,16 +5570,17 @@
* Returns the price per $100 face value of a security with an odd first period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's issue date, expressed as a serial date number.
- * @param {any} arg4 Is the security's first coupon date, expressed as a serial date number.
- * @param {any} arg5 Is the security's interest rate.
- * @param {any} arg6 Is the security's annual yield.
- * @param {any} arg7 Is the security's redemption value per $100 face value.
- * @param {any} arg8 Is the number of coupon payments per year.
- * @param {?any} arg9 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The issue date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg4 - The first coupon date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg5 - The interest rate of the security.
+ * @param {ApiRange | ApiName | number} arg6 - The annual yield of the security.
+ * @param {ApiRange | ApiName | number} arg7 - The redemption value of the security, per $100 face value.
+ * @param {ApiRange | ApiName | number} arg8 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg9 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ODDFPRICE.js
*/
ApiWorksheetFunction.prototype.ODDFPRICE = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
return this.private_calculateFunction("ODDFPRICE", arguments);
@@ -4918,16 +5589,17 @@
* Returns the yield of a security with an odd first period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's issue date, expressed as a serial date number.
- * @param {any} arg4 Is the security's first coupon date, expressed as a serial date number.
- * @param {any} arg5 Is the security's interest rate.
- * @param {any} arg6 Is the security's price.
- * @param {any} arg7 Is the security's redemption value per $100 face value.
- * @param {any} arg8 Is the number of coupon payments per year.
- * @param {?any} arg9 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The issue date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg4 - The first coupon date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg5 - The interest rate of the security.
+ * @param {ApiRange | ApiName | number} arg6 - The purchase price of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg7 - The redemption value of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg8 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg9 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ODDFYIELD.js
*/
ApiWorksheetFunction.prototype.ODDFYIELD = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
return this.private_calculateFunction("ODDFYIELD", arguments);
@@ -4936,15 +5608,16 @@
* Returns the price per $100 face value of a security with an odd last period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's last coupon date, expressed as a serial date number.
- * @param {any} arg4 Is the security's interest rate.
- * @param {any} arg5 Is the security's annual yield.
- * @param {any} arg6 Is the security's redemption value per $100 face value.
- * @param {any} arg7 Is the number of coupon payments per year.
- * @param {?any} arg8 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The last coupon date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg5 - The interest rate of the security.
+ * @param {ApiRange | ApiName | number} arg5 - The annual yield of the security.
+ * @param {ApiRange | ApiName | number} arg6 - The redemption value of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg8 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg9 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ODDLPRICE.js
*/
ApiWorksheetFunction.prototype.ODDLPRICE = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
return this.private_calculateFunction("ODDLPRICE", arguments);
@@ -4953,15 +5626,16 @@
* Returns the yield of a security with an odd last period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's last coupon date, expressed as a serial date number.
- * @param {any} arg4 Is the security's interest rate.
- * @param {any} arg5 Is the security's price.
- * @param {any} arg6 Is the security's redemption value per $100 face value.
- * @param {any} arg7 Is the number of coupon payments per year.
- * @param {?any} arg8 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The last coupon date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg5 - The interest rate of the security.
+ * @param {ApiRange | ApiName | number} arg6 - The purchase price of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg6 - The redemption value of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg8 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg9 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ODDLYIELD.js
*/
ApiWorksheetFunction.prototype.ODDLYIELD = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
return this.private_calculateFunction("ODDLYIELD", arguments);
@@ -4970,10 +5644,11 @@
* Returns the number of periods required by an investment to reach a specified value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period..
- * @param {number} arg2 Is the present value of the investment.
- * @param {number} arg3 Is the desired future value of the investment.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period.
+ * @param {ApiRange | ApiName | number} arg2 - The present value of the investment.
+ * @param {ApiRange | ApiName | number} arg3 - The desired future value of the investment.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PDURATION.js
*/
ApiWorksheetFunction.prototype.PDURATION = function (arg1, arg2, arg3) {
return this.private_calculateFunction("PDURATION", arguments);
@@ -4982,12 +5657,13 @@
* Calculates the payment for a loan based on constant payments and a constant interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period for the loan. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Is the total number of payments for the loan.
- * @param {number} arg3 Is the present value: the total amount that a series of future payments is worth now.
- * @param {?number} arg4 Is the future value, or a cash balance you want to attain after the last payment is made, 0 (zero) if omitted.
- * @param {?number} arg5 Is a logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period for the loan. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The total number of payments for the loan.
+ * @param {ApiRange | ApiName | number} arg3 - The present value: the total amount that a series of future payments is worth now.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The future value, or a cash balance which will be attained after the last payment is made. If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - A logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PMT.js
*/
ApiWorksheetFunction.prototype.PMT = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("PMT", arguments);
@@ -4996,58 +5672,62 @@
* Returns the payment on the principal for a given investment based on periodic, constant payments and a constant interest rate.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Specifies the period and must be in the range 1 to nper.
- * @param {number} arg3 Is the total number of payment periods in an investment.
- * @param {number} arg4 Is the present value: the total amount that a series of future payments is worth now.
- * @param {?number} arg5 Is the future value, or cash balance you want to attain after the last payment is made.
- * @param {?number} arg6 Is a logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The period for which the principal payment will be returned. It must be in the range from 1 to to the total number of payment periods.
+ * @param {ApiRange | ApiName | number} arg3 - The total number of payment periods in an investment.
+ * @param {ApiRange | ApiName | number} arg4 - The present value: the total amount that a series of future payments is worth now.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The future value, or cash balance which will be attained after the last payment is made.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - A logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PPMT.js
*/
ApiWorksheetFunction.prototype.PPMT = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("PPMT", arguments);
};
/**
- * Returns the price per $100 face value of a security that pays periodic interest.
+ * Returns the price per $100 face value for a security that pays periodic interest.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's annual coupon rate.
- * @param {any} arg4 Is the security's annual yield.
- * @param {any} arg5 Is the security's redemption value per $100 face value.
- * @param {any} arg6 Is the number of coupon payments per year.
- * @param {?any} arg7 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The annual coupon rate of the security.
+ * @param {ApiRange | ApiName | number} arg4 - The annual yield of the security.
+ * @param {ApiRange | ApiName | number} arg5 - The redemption value of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg6 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg7 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PRICE.js
*/
ApiWorksheetFunction.prototype.PRICE = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
return this.private_calculateFunction("PRICE", arguments);
};
/**
- * Returns the price per $100 face value of a discounted security.
+ * Returns the price per $100 face value for a discounted security.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's discount rate.
- * @param {any} arg4 Is the security's redemption value per $100 face value.
- * @param {?any} arg5 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The discount rate of the security.
+ * @param {ApiRange | ApiName | number} arg4 - The redemption value of the security, per $100 par value.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PRICEDISC.js
*/
ApiWorksheetFunction.prototype.PRICEDISC = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("PRICEDISC", arguments);
};
/**
- * Returns the price per $100 face value of a security that pays interest at maturity.
+ * Returns the price per $100 face value for a security that pays interest at maturity.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's issue date, expressed as a serial date number.
- * @param {any} arg4 Is the security's interest rate at date of issue.
- * @param {any} arg5 Is the security's annual yield.
- * @param {?any} arg6 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The issue date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg4 - The security interest rate at the issue date.
+ * @param {ApiRange | ApiName | number} arg5 - The annual yield of the security.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PRICEMAT.js
*/
ApiWorksheetFunction.prototype.PRICEMAT = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("PRICEMAT", arguments);
@@ -5056,27 +5736,29 @@
* Returns the present value of an investment: the total amount that a series of future payments is worth now.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
- * @param {number} arg2 Is the total number of payment periods in an investment.
- * @param {number} arg3 Is the payment made each period and cannot change over the life of the investment.
- * @param {?number} arg4 Is the future value, or a cash balance you want to attain after the last payment is made.
- * @param {?number} arg5 Is a logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The interest rate per period. For example, use 6%/4 for quarterly payments at 6% APR.
+ * @param {ApiRange | ApiName | number} arg2 - The total number of payment periods in an investment.
+ * @param {ApiRange | ApiName | number} arg3 - The payment made each period and cannot change over the life of the investment.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The future value, or a cash balance which will be attained after the last payment is made. If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - A logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PV.js
*/
ApiWorksheetFunction.prototype.PV = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("PV", arguments);
};
/**
- * Returns the interest rate per period of a loan or an investment. For example, use 6%/4 for quarterly payments at 6% APR.
+ * Returns the interest rate per period for a loan or an investment. For example, use 6%/4 for quarterly payments at 6% APR.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the total number of payment periods for the loan or investment.
- * @param {number} arg2 Is the payment made each period and cannot change over the life of the loan or investment.
- * @param {number} arg3 Is the present value: the total amount that a series of future payments is worth now.
- * @param {?number} arg4 Is the future value, or a cash balance you want to attain after the last payment is made. If omitted, uses Fv = 0.
- * @param {?number} arg5 Is a logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
- * @param {?number} arg6 Is your guess for what the rate will be; if omitted, Guess = 0.1 (10 percent).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The total number of payment periods for the loan or investment.
+ * @param {ApiRange | ApiName | number} arg2 - The payment made each period and cannot change over the life of the loan or investment.
+ * @param {ApiRange | ApiName | number} arg3 - The present value: the total amount that a series of future payments is worth now.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - The future value, or a cash balance which will be attained after the last payment is made. If omitted, it is equal to 0.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - A logical value: payment at the beginning of the period = 1; payment at the end of the period = 0 or omitted.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - An estimate at what the rate will be. If it is omitted, the function will assume guess to be 0.1 (10 percent).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RATE.js
*/
ApiWorksheetFunction.prototype.RATE = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("RATE", arguments);
@@ -5085,12 +5767,13 @@
* Returns the amount received at maturity for a fully invested security.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the amount invested in the security.
- * @param {any} arg4 Is the security's discount rate.
- * @param {?any} arg5 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The security settlement date, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The amount invested in the security.
+ * @param {ApiRange | ApiName | number} arg4 - The security discount rate.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RECEIVED.js
*/
ApiWorksheetFunction.prototype.RECEIVED = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("RECEIVED", arguments);
@@ -5099,10 +5782,11 @@
* Returns an equivalent interest rate for the growth of an investment.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number of periods for the investment.
- * @param {number} arg2 Is the present value of the investment.
- * @param {number} arg3 Is the future value of the investment.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number of periods for the investment.
+ * @param {ApiRange | ApiName | number} arg2 - The present value of the investment.
+ * @param {ApiRange | ApiName | number} arg3 - The future value of the investment.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RRI.js
*/
ApiWorksheetFunction.prototype.RRI = function (arg1, arg2, arg3) {
return this.private_calculateFunction("RRI", arguments);
@@ -5111,10 +5795,11 @@
* Returns the straight-line depreciation of an asset for one period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the initial cost of the asset.
- * @param {number} arg2 Is the salvage value at the end of the life of the asset.
- * @param {number} arg3 Is the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The initial cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg3 - The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SLN.js
*/
ApiWorksheetFunction.prototype.SLN = function (arg1, arg2, arg3) {
return this.private_calculateFunction("SLN", arguments);
@@ -5123,11 +5808,12 @@
* Returns the sum-of-years' digits depreciation of an asset for a specified period.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the initial cost of the asset.
- * @param {number} arg2 Is the salvage value at the end of the life of the asset.
- * @param {number} arg3 Is the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
- * @param {number} arg4 Is the period and must use the same units as Life.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The initial cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg3 - The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
+ * @param {ApiRange | ApiName | number} arg4 - The period for which the depreciation will be calculated. It must use the same units as the useful life of the asset.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SYD.js
*/
ApiWorksheetFunction.prototype.SYD = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("SYD", arguments);
@@ -5136,50 +5822,55 @@
* Returns the bond-equivalent yield for a treasury bill.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the Treasury bill's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the Treasury bill's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the Treasury bill's discount rate.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The settlement date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The discount rate of the Treasury bill.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TBILLEQ.js
*/
ApiWorksheetFunction.prototype.TBILLEQ = function (arg1, arg2, arg3) {
return this.private_calculateFunction("TBILLEQ", arguments);
};
/**
- * Returns the price per $100 face value for a treasury bill.
+ * Returns the price per $100 face value for a Treasury bill.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the Treasury bill's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the Treasury bill's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the Treasury bill's discount rate.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The settlement date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The discount rate of the Treasury bill.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TBILLPRICE.js
*/
ApiWorksheetFunction.prototype.TBILLPRICE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("TBILLPRICE", arguments);
};
/**
- * Returns the yield for a treasury bill.
+ * Returns the yield for a Treasury bill.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the Treasury bill's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the Treasury bill's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the Treasury Bill's price per $100 face value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The settlement date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The purchase price of the Treasury bill, per $100 par value.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TBILLYIELD.js
*/
ApiWorksheetFunction.prototype.TBILLYIELD = function (arg1, arg2, arg3) {
return this.private_calculateFunction("TBILLYIELD", arguments);
};
/**
- * Returns the depreciation of an asset for any period you specify, including partial periods, using the double-declining balance method or some other method you specify.
+ * Returns the depreciation of an asset for any specified period, including partial periods, using the double-declining balance method or some other method specified.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the initial cost of the asset.
- * @param {number} arg2 Is the salvage value at the end of the life of the asset.
- * @param {number} arg3 Is the number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
- * @param {number} arg4 Is the starting period for which you want to calculate the depreciation, in the same units as Life.
- * @param {number} arg5 Is the ending period for which you want to calculate the depreciation, in the same units as Life.
- * @param {?number} arg6 Is the rate at which the balance declines, 2 (double-declining balance) if omitted.
- * @param {?boolean} arg7 Switch to straight-line depreciation when depreciation is greater than the declining balance = FALSE or omitted; do not switch = TRUE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The initial cost of the asset.
+ * @param {ApiRange | ApiName | number} arg2 - The salvage value of the asset at the end of its lifetime.
+ * @param {ApiRange | ApiName | number} arg3 - The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
+ * @param {ApiRange | ApiName | number} arg4 - The starting period for which the depreciation will be calculated, in the same units as the useful life of the asset.
+ * @param {ApiRange | ApiName | number} arg5 - The ending period for which the depreciation will be calculated, in the same units as the useful life of the asset.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The rate at which the balance declines. If it is omitted, the function will assume it to be 2
+ * @param {?ApiRange | ?ApiName | ?boolean} arg7 - Specifies whether to use straight-line depreciation when depreciation is greater than the declining balance calculation (false or omitted).
+ * If it is set to true, the function uses the declining balance method.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VDB.js
*/
ApiWorksheetFunction.prototype.VDB = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
return this.private_calculateFunction("VDB", arguments);
@@ -5188,10 +5879,11 @@
* Returns the internal rate of return for a schedule of cash flows.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a series of cash flows that correspond to a schedule of payments in dates.
- * @param {any} arg2 Is a schedule of payment dates that corresponds to the cash flow payments.
- * @param {?any} arg3 Is a number that you guess is close to the result of XIRR.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - A range that contains the series of cash flows that corresponds to a schedule of payments in dates.
+ * @param {ApiRange | ApiName} arg2 - A range that contains the schedule of payment dates that corresponds to the cash flow payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - An estimate at what the internal rate of return will be. If it is omitted, the function will assume guess to be 0.1 (10 percent).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/XIRR.js
*/
ApiWorksheetFunction.prototype.XIRR = function (arg1, arg2, arg3) {
return this.private_calculateFunction("XIRR", arguments);
@@ -5200,10 +5892,11 @@
* Returns the net present value for a schedule of cash flows.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the discount rate to apply to the cash flows.
- * @param {any} arg2 Is a series of cash flows that correspond to a schedule of payments in dates.
- * @param {any} arg3 Is a schedule of payment dates that corresponds to the cash flow payments.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The discount rate to apply to the cash flows.
+ * @param {ApiRange | ApiName} arg2 - A range that contains the series of cash flows that corresponds to a schedule of payments in dates.
+ * @param {ApiRange | ApiName} arg3 - A range that contains the schedule of payment dates that corresponds to the cash flow payments.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/XNPV.js
*/
ApiWorksheetFunction.prototype.XNPV = function (arg1, arg2, arg3) {
return this.private_calculateFunction("XNPV", arguments);
@@ -5212,28 +5905,30 @@
* Returns the yield on a security that pays periodic interest.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's annual coupon rate.
- * @param {any} arg4 Is the security's price per $100 face value.
- * @param {any} arg5 Is the security's redemption value per $100 face value.
- * @param {any} arg6 Is the number of coupon payments per year.
- * @param {?any} arg7 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The settlement date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The annual coupon rate of the security.
+ * @param {ApiRange | ApiName | number} arg4 - The purchase price of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg5 - The redemption value of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg6 - The number of interest payments per year. The possible values are: 1 for annual payments, 2 for semiannual payments, 4 for quarterly payments.
+ * @param {?ApiRange | ?ApiName | ?number} arg7 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/YIELD.js
*/
ApiWorksheetFunction.prototype.YIELD = function (arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
return this.private_calculateFunction("YIELD", arguments);
};
/**
- * Returns the annual yield for a discounted security. For example, a treasury bill.
+ * Returns the annual yield for a discounted security. For example, a Treasury bill.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's price per $100 face value.
- * @param {any} arg4 Is the security's redemption value per $100 face value.
- * @param {?any} arg5 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The settlement date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The purchase price of the security, per $100 par value.
+ * @param {ApiRange | ApiName | number} arg4 - The redemption value of the security, per $100 par value.
+ * @param {?ApiRange | ?ApiName | ?number} arg5 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/YIELDDISC.js
*/
ApiWorksheetFunction.prototype.YIELDDISC = function (arg1, arg2, arg3, arg4, arg5) {
return this.private_calculateFunction("YIELDDISC", arguments);
@@ -5242,13 +5937,14 @@
* Returns the annual yield of a security that pays interest at maturity.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the security's settlement date, expressed as a serial date number.
- * @param {any} arg2 Is the security's maturity date, expressed as a serial date number.
- * @param {any} arg3 Is the security's issue date, expressed as a serial date number.
- * @param {any} arg4 Is the security's interest rate at date of issue.
- * @param {any} arg5 Is the security's price per $100 face value.
- * @param {?any} arg6 Is the type of day count basis to use.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The settlement date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg2 - The maturity date of the Treasury bill, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg3 - The issue date of the security, expressed as a serial date number.
+ * @param {ApiRange | ApiName | number} arg4 - The interest rate of the security at the issue date.
+ * @param {ApiRange | ApiName | number} arg5 - The purchase price of the security, per $100 par value.
+ * @param {?ApiRange | ?ApiName | ?number} arg6 - The day count basis to use: 0 or omitted - US (NASD) 30/360; 1 - Actual/actual; 2 - Actual/360; 3 - Actual/365; 4 - European 30/360.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/YIELDMAT.js
*/
ApiWorksheetFunction.prototype.YIELDMAT = function (arg1, arg2, arg3, arg4, arg5, arg6) {
return this.private_calculateFunction("YIELDMAT", arguments);
@@ -5257,18 +5953,20 @@
* Returns the absolute value of a number, a number without its sign.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the real number for which you want the absolute value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The real number for which the absolute value will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ABS.js
*/
ApiWorksheetFunction.prototype.ABS = function (arg1) {
return this.private_calculateFunction("ABS", arguments);
};
/**
- * Returns the arccosine of a number, in radians in the range 0 to Pi. The arccosine is the angle whose cosine is Number.
+ * Returns the arccosine of a number, in radians in the range from 0 to Pi. The arccosine is the angle whose cosine is a number specified in the parameters.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the cosine of the angle you want and must be from -1 to 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle cosine. It must be from -1 to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ACOS.js
*/
ApiWorksheetFunction.prototype.ACOS = function (arg1) {
return this.private_calculateFunction("ACOS", arguments);
@@ -5277,18 +5975,20 @@
* Returns the inverse hyperbolic cosine of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number equal to or greater than 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number equal to or greater than 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ACOSH.js
*/
ApiWorksheetFunction.prototype.ACOSH = function (arg1) {
return this.private_calculateFunction("ACOSH", arguments);
};
/**
- * Returns the arccotangent of a number, in radians in the range 0 to Pi..
+ * Returns the arccotangent of a number, in radians in the range from 0 to Pi.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the cotangent of the angle you want.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle cotangent.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ACOT.js
*/
ApiWorksheetFunction.prototype.ACOT = function (arg1) {
return this.private_calculateFunction("ACOT", arguments);
@@ -5297,8 +5997,9 @@
* Returns the inverse hyperbolic cotangent of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the hyperbolic cotangent of the angle that you want.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle hyperbolic cotangent. It must be less than -1 or greater than 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ACOTH.js
*/
ApiWorksheetFunction.prototype.ACOTH = function (arg1) {
return this.private_calculateFunction("ACOTH", arguments);
@@ -5307,7 +6008,17 @@
* Returns an aggregate in a list or database.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A numeric value that specifies which function to use: 1 - AVERAGE, 2 - COUNT, 3 - COUNTA, 4 - MAX, 5 - MIN,
+ * 6 - PRODUCT, 7 - STDEV.S, 8 - STDEV.P, 9 - SUM, 10 - VAR.S, 11 - VAR.P, 12 - MEDIAN, 13 - MODE.SNGL, 14 - LARGE,
+ * 15 - SMALL, 16 - PERCENTILE.INC, 17 - QUARTILE.INC, 18 - PERCENTILE.EXC, 19 - QUARTILE.EXC.
+ * @param {ApiRange | ApiName | number} arg2 - A numeric value that specifies which values should be ignored: 0 or omitted - nested SUBTOTAL and AGGREGATE functions,
+ * 1 - hidden rows, nested SUBTOTAL and AGGREGATE functions, 2 - error values, nested SUBTOTAL and AGGREGATE functions,
+ * 3 - hidden rows, error values, nested SUBTOTAL and AGGREGATE functions, 4 - nothing, 5 - hidden rows, 6 - error values, 7 - hidden rows and error values.
+ * @param {number | ApiRange | number[]} arg3 - The first numeric value for which the aggregate value will be returned.
+ * @param {number | ApiRange | number[]} args - Up to 253 numeric values or a range of cells containing the values for which the aggregate value will be returned.
+ * Arguments can be numbers, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AGGREGATE.js
*/
ApiWorksheetFunction.prototype.AGGREGATE = function () {
return this.private_calculateFunction("AGGREGATE", arguments);
@@ -5316,18 +6027,20 @@
* Converts a Roman numeral to Arabic.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the Roman numeral you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The Roman numeral to convert.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ARABIC.js
*/
ApiWorksheetFunction.prototype.ARABIC = function (arg1) {
return this.private_calculateFunction("ARABIC", arguments);
};
/**
- * Returns the arcsine of a number in radians, in the range -Pi/2 to Pi/2.
+ * Returns the arcsine of a number in radians, in the range from -Pi/2 to Pi/2.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the sine of the angle you want and must be from -1 to 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle sine. It must be from -1 to 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ASIN.js
*/
ApiWorksheetFunction.prototype.ASIN = function (arg1) {
return this.private_calculateFunction("ASIN", arguments);
@@ -5336,18 +6049,20 @@
* Returns the inverse hyperbolic sine of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number equal to or greater than 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number equal to or greater than 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ASINH.js
*/
ApiWorksheetFunction.prototype.ASINH = function (arg1) {
return this.private_calculateFunction("ASINH", arguments);
};
/**
- * Returns the arctangent of a number in radians, in the range -Pi/2 to Pi/2.
+ * Returns the arctangent of a number in radians, in the range from -Pi/2 to Pi/2.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the tangent of the angle you want.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle tangent.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ATAN.js
*/
ApiWorksheetFunction.prototype.ATAN = function (arg1) {
return this.private_calculateFunction("ATAN", arguments);
@@ -5356,9 +6071,10 @@
* Returns the arctangent of the specified x and y coordinates, in radians between -Pi and Pi, excluding -Pi.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the x-coordinate of the point.
- * @param {number} arg2 Is the y-coordinate of the point.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The x coordinate of the point.
+ * @param {ApiRange | ApiName | number} arg2 - The y coordinate of the point.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ATAN2.js
*/
ApiWorksheetFunction.prototype.ATAN2 = function (arg1, arg2) {
return this.private_calculateFunction("ATAN2", arguments);
@@ -5367,8 +6083,9 @@
* Returns the inverse hyperbolic tangent of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number between -1 and 1 excluding -1 and 1.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number between -1 and 1 excluding -1 and 1.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ATANH.js
*/
ApiWorksheetFunction.prototype.ATANH = function (arg1) {
return this.private_calculateFunction("ATANH", arguments);
@@ -5377,10 +6094,11 @@
* Converts a number into a text representation with the given radix (base).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number that you want to convert.
- * @param {number} arg2 Is the base Radix that you want to convert the number into.
- * @param {?number} arg3 Is the minimum length of the returned string. If omitted leading zeros are not added.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number to convert.
+ * @param {ApiRange | ApiName | number} arg2 - The base radix into which the number will be converted. An integer greater than or equal to 2 and less than or equal to 36.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - The minimum length of the returned string. An integer greater than or equal to 0 and less than 256. If omitted, leading zeros are not added to the result.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/BASE.js
*/
ApiWorksheetFunction.prototype.BASE = function (arg1, arg2, arg3) {
return this.private_calculateFunction("BASE", arguments);
@@ -5389,9 +6107,10 @@
* Rounds a number up, to the nearest multiple of significance.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value you want to round.
- * @param {number} arg2 Is the multiple to which you want to round.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round up.
+ * @param {ApiRange | ApiName | number} arg2 - The multiple of significance to round up to.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CEILING.js
*/
ApiWorksheetFunction.prototype.CEILING = function (arg1, arg2) {
return this.private_calculateFunction("CEILING", arguments);
@@ -5400,21 +6119,24 @@
* Rounds a number up, to the nearest integer or to the nearest multiple of significance.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value you want to round.
- * @param {?number} arg2 Is the multiple to which you want to round.
- * @param {?number} arg3 When given and nonzero this function will round away from zero.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round up.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The multiple of significance to round up to. If it is omitted, the default value of 1 is used.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - Specifies if negative numbers are rounded towards or away from zero. If it is omitted or set to 0, negative numbers are rounded towards zero.
+ * If any other numeric value is specified, negative numbers are rounded away from zero.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CEILING_MATH.js
*/
ApiWorksheetFunction.prototype.CEILING_MATH = function (arg1, arg2, arg3) {
return this.private_calculateFunction("CEILING.MATH", arguments);
};
/**
- * Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance.
+ * Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance. The number is always rounded up regardless of its sing.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1.
- * @param {?number} arg2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round up.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The multiple of significance to round up to. If it is omitted, the default value of 1 is used. If it is set to zero, the function returns 0.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CEILING_PRECISE.js
*/
ApiWorksheetFunction.prototype.CEILING_PRECISE = function (arg1, arg2) {
return this.private_calculateFunction("CEILING.PRECISE", arguments);
@@ -5423,9 +6145,10 @@
* Returns the number of combinations for a given number of items.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the total number of items.
- * @param {number} arg2 Is the number of items in each combination.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The total number of items, a numeric value greater than or equal to 0.
+ * @param {ApiRange | ApiName | number} arg2 - The number of items in each combination, a numeric value greater than or equal to 0 but less than the total number of items.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COMBIN.js
*/
ApiWorksheetFunction.prototype.COMBIN = function (arg1, arg2) {
return this.private_calculateFunction("COMBIN", arguments);
@@ -5434,9 +6157,10 @@
* Returns the number of combinations with repetitions for a given number of items.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the total number of items.
- * @param {number} arg2 Is the number of items in each combination.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The total number of items, a numeric value greater than or equal to 0.
+ * @param {ApiRange | ApiName | number} arg2 - The number of items in each combination, a numeric value greater than or equal to 0 but less than the total number of items.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COMBINA.js
*/
ApiWorksheetFunction.prototype.COMBINA = function (arg1, arg2) {
return this.private_calculateFunction("COMBINA", arguments);
@@ -5445,8 +6169,9 @@
* Returns the cosine of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the cosine.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the cosine will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COS.js
*/
ApiWorksheetFunction.prototype.COS = function (arg1) {
return this.private_calculateFunction("COS", arguments);
@@ -5455,8 +6180,9 @@
* Returns the hyperbolic cosine of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number for which the hyperbolic cosine will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COSH.js
*/
ApiWorksheetFunction.prototype.COSH = function (arg1) {
return this.private_calculateFunction("COSH", arguments);
@@ -5465,8 +6191,9 @@
* Returns the cotangent of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the cotangent.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the cotangent will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COT.js
*/
ApiWorksheetFunction.prototype.COT = function (arg1) {
return this.private_calculateFunction("COT", arguments);
@@ -5475,8 +6202,9 @@
* Returns the hyperbolic cotangent of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the hyperbolic cotangent.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the hyperbolic cotangent will be calculated. Its absolute value must be less than 2^27.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COTH.js
*/
ApiWorksheetFunction.prototype.COTH = function (arg1) {
return this.private_calculateFunction("COTH", arguments);
@@ -5485,8 +6213,9 @@
* Returns the cosecant of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the cosecant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the cosecant will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CSC.js
*/
ApiWorksheetFunction.prototype.CSC = function (arg1) {
return this.private_calculateFunction("CSC", arguments);
@@ -5495,8 +6224,9 @@
* Returns the hyperbolic cosecant of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the hyperbolic cosecant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the hyperbolic cosecant will be calculated. Its absolute value must be less than 2^27.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CSCH.js
*/
ApiWorksheetFunction.prototype.CSCH = function (arg1) {
return this.private_calculateFunction("CSCH", arguments);
@@ -5505,9 +6235,10 @@
* Converts a text representation of a number in a given base into a decimal number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the number that you want to convert.
- * @param {number} arg2 Is the base Radix of the number you are converting.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string} arg1 - The number to convert. The string lenght must be less than or equal to 255 characters.
+ * @param {ApiRange | ApiName | number} arg2 - The base Radix of the number that is converting. An integer greater than or equal to 2 and less than or equal to 36.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DECIMAL.js
*/
ApiWorksheetFunction.prototype.DECIMAL = function (arg1, arg2) {
return this.private_calculateFunction("DECIMAL", arguments);
@@ -5516,19 +6247,21 @@
* Converts radians to degrees.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians that you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians to convert.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/DEGREES.js
*/
ApiWorksheetFunction.prototype.DEGREES = function (arg1) {
return this.private_calculateFunction("DEGREES", arguments);
};
/**
- * Rounds the number up to the nearest multiple of significance.
+ * Rounds the number up to the nearest multiple of significance. Negative numbers are rounded towards zero.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1.
- * @param {number} arg2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round up.
+ * @param {ApiRange | ApiName | number} arg2 - The multiple of significance to round up to.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ECMA_CEILING.js
*/
ApiWorksheetFunction.prototype.ECMA_CEILING = function (arg1, arg2) {
return this.private_calculateFunction("ECMA.CEILING", arguments);
@@ -5537,28 +6270,31 @@
* Rounds a positive number up and negative number down to the nearest even integer.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value to round.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round up.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EVEN.js
*/
ApiWorksheetFunction.prototype.EVEN = function (arg1) {
return this.private_calculateFunction("EVEN", arguments);
};
/**
- * Returns e raised to the power of a given number.
+ * Returns the e constant raised to the power of a given number. The e constant is equal to 2.71828182845904, the base of the natural logarithm.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the exponent applied to the base e. The constant e equals 2.71828182845904, the base of the natural logarithm.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The exponent applied to the base e.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/EXP.js
*/
ApiWorksheetFunction.prototype.EXP = function (arg1) {
return this.private_calculateFunction("EXP", arguments);
};
/**
- * Returns the factorial of a number, equal to 1*2*3*...* Number.
+ * Returns the factorial of a number, which is equal to 1*2*3*...* number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the nonnegative number you want the factorial of.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The nonnegative number for which the factorial will be calculated.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FACT.js
*/
ApiWorksheetFunction.prototype.FACT = function (arg1) {
return this.private_calculateFunction("FACT", arguments);
@@ -5567,8 +6303,9 @@
* Returns the double factorial of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value for which to return the double factorial.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value for which to return the double factorial.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FACTDOUBLE.js
*/
ApiWorksheetFunction.prototype.FACTDOUBLE = function (arg1) {
return this.private_calculateFunction("FACTDOUBLE", arguments);
@@ -5577,20 +6314,22 @@
* Rounds a number down to the nearest multiple of significance.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the numeric value you want to round.
- * @param {number} arg2 Is the multiple to which you want to round. Number and Significance must either both be positive or both be negative.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value to round down.
+ * @param {ApiRange | ApiName | number} arg2 - The multiple of significance to round down to. The number to round down and the multiple of significance must have the same sign.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FLOOR.js
*/
ApiWorksheetFunction.prototype.FLOOR = function (arg1, arg2) {
return this.private_calculateFunction("FLOOR", arguments);
};
/**
- * Returns a number that is rounded down to the nearest integer or to the nearest multiple of significance.
+ * Returns a number that is rounded down to the nearest integer or to the nearest multiple of significance. The number is always rounded down regardless of its sign.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1.
- * @param {?number} arg2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value to round down.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The multiple of significance to round down to. If it is omitted, the default value of 1 is used. If it is set to zero, the function returns 0.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FLOOR_PRECISE.js
*/
ApiWorksheetFunction.prototype.FLOOR_PRECISE = function (arg1, arg2) {
return this.private_calculateFunction("FLOOR.PRECISE", arguments);
@@ -5599,10 +6338,12 @@
* Rounds a number down, to the nearest integer or to the nearest multiple of significance.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value you want to round.
- * @param {?number} arg2 Is the multiple to which you want to round.
- * @param {?number} arg3 When given and nonzero this function will round towards zero.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value to round down.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The multiple of significance to round down to. If it is omitted, the default value of 1 is used.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - Specifies if negative numbers are rounded towards or away from zero. If it is omitted or set to 0, negative numbers are rounded away from zero.
+ * If any other numeric value is specified, negative numbers are rounded towards zero.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FLOOR_MATH.js
*/
ApiWorksheetFunction.prototype.FLOOR_MATH = function (arg1, arg2, arg3) {
return this.private_calculateFunction("FLOOR.MATH", arguments);
@@ -5611,7 +6352,9 @@
* Returns the greatest common divisor.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} args - Up to 255 numeric values for which the greatest common divisor will be returned. The first argument is required, subsequent arguments are optional.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/GCD.js
*/
ApiWorksheetFunction.prototype.GCD = function () {
return this.private_calculateFunction("GCD", arguments);
@@ -5620,19 +6363,22 @@
* Rounds a number down to the nearest integer.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the real number you want to round down to an integer.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The real number to round down to an integer.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/INT.js
*/
ApiWorksheetFunction.prototype.INT = function (arg1) {
return this.private_calculateFunction("INT", arguments);
};
/**
- * Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance regardless of the sign of the number. However, if the number or the significance is zero, zero is returned..
+ * Returns a number that is rounded up to the nearest integer or to the nearest multiple of significance regardless of the sign of the number.
+ * The number is always rounded up regardless of its sing.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1.
- * @param {?number} arg2.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The numeric value to round up.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The multiple of significance to round up to. If it is omitted, the default value of 1 is used. If it is set to zero, the function returns 0.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISO_CEILING.js
*/
ApiWorksheetFunction.prototype.ISO_CEILING = function (arg1, arg2) {
return this.private_calculateFunction("ISO.CEILING", arguments);
@@ -5641,7 +6387,9 @@
* Returns the least common multiple.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} args - Up to 255 numeric values for which the least common multiple will be returned. The first argument is required, subsequent arguments are optional.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LCM.js
*/
ApiWorksheetFunction.prototype.LCM = function () {
return this.private_calculateFunction("LCM", arguments);
@@ -5650,19 +6398,21 @@
* Returns the natural logarithm of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the positive real number for which you want the natural logarithm.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The positive real number for which the natural logarithm will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LN.js
*/
ApiWorksheetFunction.prototype.LN = function (arg1) {
return this.private_calculateFunction("LN", arguments);
};
/**
- * Returns the logarithm of a number to the base you specify.
+ * Returns the logarithm of a number to the specified base.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the positive real number for which you want the logarithm.
- * @param {?number} arg2 Is the base of the logarithm; 10 if omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The positive real number for which the logarithm will be returned.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - The logarithm base. If omitted, it is equal to 10.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOG.js
*/
ApiWorksheetFunction.prototype.LOG = function (arg1, arg2) {
return this.private_calculateFunction("LOG", arguments);
@@ -5671,8 +6421,9 @@
* Returns the base-10 logarithm of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the positive real number for which you want the base-10 logarithm.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The positive real number for which the base-10 logarithm will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOG10.js
*/
ApiWorksheetFunction.prototype.LOG10 = function (arg1) {
return this.private_calculateFunction("LOG10", arguments);
@@ -5715,9 +6466,10 @@
* Returns the remainder after a number is divided by a divisor.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number for which you want to find the remainder after the division is performed.
- * @param {number} arg2 Is the number by which you want to divide Number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number to divide and find the remainder.
+ * @param {ApiRange | ApiName | number} arg2 - The number to divide by.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MOD.js
*/
ApiWorksheetFunction.prototype.MOD = function (arg1, arg2) {
return this.private_calculateFunction("MOD", arguments);
@@ -5726,18 +6478,21 @@
* Returns a number rounded to the desired multiple.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to round.
- * @param {any} arg2 Is the multiple to which you want to round number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round.
+ * @param {ApiRange | ApiName | number} arg2 - The multiple to round the number to.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MROUND.js
*/
ApiWorksheetFunction.prototype.MROUND = function (arg1, arg2) {
return this.private_calculateFunction("MROUND", arguments);
};
/**
- * Returns the multinomial of a set of numbers.
+ * Returns the ratio of the factorial of a sum of numbers to the product of factorials.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} args - Up to 255 numeric values for which the multinomial will be returned. The first argument is required, subsequent arguments are optional.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MULTINOMIAL.js
*/
ApiWorksheetFunction.prototype.MULTINOMIAL = function () {
return this.private_calculateFunction("MULTINOMIAL", arguments);
@@ -5746,8 +6501,9 @@
* Returns the unit matrix for the specified dimension.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is an integer specifying the dimension of the unit matrix that you want to return.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - An integer specifying the dimension of the unit matrix to be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MUNIT.js
*/
ApiWorksheetFunction.prototype.MUNIT = function (arg1) {
return this.private_calculateFunction("MUNIT", arguments);
@@ -5756,17 +6512,19 @@
* Rounds a positive number up and negative number down to the nearest odd integer.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the value to round.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to round.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ODD.js
*/
ApiWorksheetFunction.prototype.ODD = function (arg1) {
return this.private_calculateFunction("ODD", arguments);
};
/**
- * Returns the value of Pi, 3.14159265358979, accurate to 15 digits.
+ * Returns the mathematical constant pi, equal to 3.14159265358979, accurate to 15 digits.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PI.js
*/
ApiWorksheetFunction.prototype.PI = function () {
return this.private_calculateFunction("PI", arguments);
@@ -5775,9 +6533,10 @@
* Returns the result of a number raised to a power.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the base number, any real number.
- * @param {number} arg2 Is the exponent, to which the base number is raised.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The base number. It can be any real number.
+ * @param {ApiRange | ApiName | number} arg2 - The exponent to which the base number is raised.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/POWER.js
*/
ApiWorksheetFunction.prototype.POWER = function (arg1, arg2) {
return this.private_calculateFunction("POWER", arguments);
@@ -5786,7 +6545,10 @@
* Multiplies all the numbers given as arguments.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | ApiRange | number[]} args - Up to 255 numeric values that will be multiplied. The first argument is required, subsequent arguments are optional.
+ * Arguments can be numbers, ranges, or arrays of numbers.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/PRODUCT.js
*/
ApiWorksheetFunction.prototype.PRODUCT = function () {
return this.private_calculateFunction("PRODUCT", arguments);
@@ -5795,9 +6557,10 @@
* Returns the integer portion of a division.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the dividend.
- * @param {any} arg2 Is the divisor.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The dividend, a numeric value.
+ * @param {ApiRange | ApiName | number} arg2 - The divisor, a numeric value.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/QUOTIENT.js
*/
ApiWorksheetFunction.prototype.QUOTIENT = function (arg1, arg2) {
return this.private_calculateFunction("QUOTIENT", arguments);
@@ -5806,8 +6569,9 @@
* Converts degrees to radians.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is an angle in degrees that you want to convert.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - An angle in degrees to convert.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RADIANS.js
*/
ApiWorksheetFunction.prototype.RADIANS = function (arg1) {
return this.private_calculateFunction("RADIANS", arguments);
@@ -5816,29 +6580,32 @@
* Returns a random number greater than or equal to 0 and less than 1, evenly distributed (changes on recalculation).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RAND.js
*/
ApiWorksheetFunction.prototype.RAND = function () {
return this.private_calculateFunction("RAND", arguments);
};
/**
- * Returns a random number between the numbers you specify.
+ * Returns a random number between the numbers specified.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the smallest integer RANDBETWEEN will return.
- * @param {any} arg2 Is the largest integer RANDBETWEEN will return.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The smallest integer value.
+ * @param {ApiRange | ApiName | number} arg2 - The largest integer value.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/RANDBETWEEN.js
*/
ApiWorksheetFunction.prototype.RANDBETWEEN = function (arg1, arg2) {
return this.private_calculateFunction("RANDBETWEEN", arguments);
};
/**
- * Converts an Arabic numeral to Roman, as text.
+ * Converts an arabic numeral to a roman numeral in the string format.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the Arabic numeral you want to convert.
- * @param {?number} arg2 Is the number specifying the type of Roman numeral you want..
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A numeric value greater than or equal to 1 and less than 3999.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A roman numeral type: 0 - classic, 1 - more concise, 2 - more concise, 3 - more concise, 4 - simplified.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ROMAN.js
*/
ApiWorksheetFunction.prototype.ROMAN = function (arg1, arg2) {
return this.private_calculateFunction("ROMAN", arguments);
@@ -5847,20 +6614,24 @@
* Rounds a number to a specified number of digits.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number you want to round.
- * @param {number} arg2 Is the number of digits to which you want to round. Negative rounds to the left of the decimal point; zero to the nearest integer.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number to round.
+ * @param {ApiRange | ApiName | number} arg2 - The number of digits to round to. If this argument is negative, the number will be rounded to the left of the decimal point.
+ * If it is equal to zero, the number will be rounded to the nearest integer.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ROUND.js
*/
ApiWorksheetFunction.prototype.ROUND = function (arg1, arg2) {
return this.private_calculateFunction("ROUND", arguments);
};
/**
- * Rounds a number down, towards zero.
+ * Rounds a number down, toward zero.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number that you want rounded down.
- * @param {number} arg2 Is the number of digits to which you want to round. Negative rounds to the left of the decimal point; zero or omitted, to the nearest integer.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number that will be rounded down.
+ * @param {ApiRange | ApiName | number} arg2 - The number of digits to round to. If this argument is negative, the number will be rounded to the left of the decimal point.
+ * If it is equal to zero, the number will be rounded to the nearest integer.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ROUNDDOWN.js
*/
ApiWorksheetFunction.prototype.ROUNDDOWN = function (arg1, arg2) {
return this.private_calculateFunction("ROUNDDOWN", arguments);
@@ -5869,9 +6640,11 @@
* Rounds a number up, away from zero.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number that you want rounded up.
- * @param {number} arg2 Is the number of digits to which you want to round. Negative rounds to the left of the decimal point; zero or omitted, to the nearest integer.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number that will be rounded up.
+ * @param {ApiRange | ApiName | number} arg2 - The number of digits to round to. If this argument is negative, the number will be rounded to the left of the decimal point.
+ * If it is equal to zero, the number will be rounded to the nearest integer.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ROUNDUP.js
*/
ApiWorksheetFunction.prototype.ROUNDUP = function (arg1, arg2) {
return this.private_calculateFunction("ROUNDUP", arguments);
@@ -5880,8 +6653,9 @@
* Returns the secant of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the secant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the secant will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SEC.js
*/
ApiWorksheetFunction.prototype.SEC = function (arg1) {
return this.private_calculateFunction("SEC", arguments);
@@ -5890,8 +6664,9 @@
* Returns the hyperbolic secant of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the hyperbolic secant.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the hyperbolic secant will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SECH.js
*/
ApiWorksheetFunction.prototype.SECH = function (arg1) {
return this.private_calculateFunction("SECH", arguments);
@@ -5900,21 +6675,23 @@
* Returns the sum of a power series based on the formula.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the input value to the power series.
- * @param {any} arg2 Is the initial power to which you want to raise x.
- * @param {any} arg3 Is the step by which to increase n for each term in the series.
- * @param {any} arg4 Is a set of coefficients by which each successive power of x is multiplied.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The input value to the power series.
+ * @param {ApiRange | ApiName | number} arg2 - The initial power to which x will be raised.
+ * @param {ApiRange | ApiName | number} arg3 - The step by which to increase n for each term in the series.
+ * @param {ApiRange | ApiName | number} arg4 - A set of coefficients by which each successive power of x is multiplied.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SERIESSUM.js
*/
ApiWorksheetFunction.prototype.SERIESSUM = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("SERIESSUM", arguments);
};
/**
- * Returns the sign of a number: 1 if the number is positive, zero if the number is zero, or -1 if the number is negative.
+ * Returns the sign of a number: 1 if the number is positive, 0 if the number is zero, or -1 if the number is negative.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SIGN.js
*/
ApiWorksheetFunction.prototype.SIGN = function (arg1) {
return this.private_calculateFunction("SIGN", arguments);
@@ -5923,8 +6700,9 @@
* Returns the sine of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the sine. Degrees * PI()/180 = radians.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the sine will be returned. If your argument is in degrees, multiply it by PI()/180.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SIN.js
*/
ApiWorksheetFunction.prototype.SIN = function (arg1) {
return this.private_calculateFunction("SIN", arguments);
@@ -5933,8 +6711,9 @@
* Returns the hyperbolic sine of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number for which the hyperbolic sine will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SINH.js
*/
ApiWorksheetFunction.prototype.SINH = function (arg1) {
return this.private_calculateFunction("SINH", arguments);
@@ -5943,27 +6722,37 @@
* Returns the square root of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number for which you want the square root.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number for which the square root will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SQRT.js
*/
ApiWorksheetFunction.prototype.SQRT = function (arg1) {
return this.private_calculateFunction("SQRT", arguments);
};
/**
- * Returns the square root of (number * Pi).
+ * Returns the square root of (number * pi).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the number by which p is multiplied.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number by which pi is multiplied.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SQRTPI.js
*/
ApiWorksheetFunction.prototype.SQRTPI = function (arg1) {
return this.private_calculateFunction("SQRTPI", arguments);
};
+
/**
* Returns a subtotal in a list or database.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - A numeric value that specifies which function to use for the subtotal: 1 (101) - AVERAGE, 2 (102) - COUNT,
+ * 3 (103) - COUNTA, 4 (104) - MAX, 5 (105) - MIN,
+ * 6 (106) - PRODUCT, 7 (107) - STDEV, 8 (108) - STDEVP, 9 (109) - SUM, 10 (110) - VAR, 11 (111) - VARP.
+ * 1-11 includes manually-hidden rows, while 101-111 excludes them;
+ * filtered-out cells are always excluded.
+ * @param {ApiRange | ApiName} args - Up to 255 ranges containing the values for which the subtotal will be returned. The first argument is required, subsequent arguments are optional.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SUBTOTAL.js
*/
ApiWorksheetFunction.prototype.SUBTOTAL = function () {
return this.private_calculateFunction("SUBTOTAL", arguments);
@@ -5972,7 +6761,10 @@
* Adds all the numbers in a range of cells.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | string | number | boolean | array} args - Up to 255 numeric values to add. The first argument is required, subsequent arguments are optional.
+ * Arguments can be numbers, logical values, text representations of numbers, ranges, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SUM.js
*/
ApiWorksheetFunction.prototype.SUM = function () {
return this.private_calculateFunction("SUM", arguments);
@@ -5981,10 +6773,11 @@
* Adds the cells specified by a given condition or criteria.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is the range of cells you want evaluated.
- * @param {any} arg2 Is the condition or criteria in the form of a number, expression, or text that defines which cells will be added.
- * @param {?ApiRange} arg3 Are the actual cells to sum. If omitted, the cells in range are used.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells to be evaluated.
+ * @param {ApiRange | ApiName | number | string} arg2 - The condition or criteria in the form of a number, expression, or text that defines which cells will be added.
+ * @param {?ApiRange | ?ApiName} arg3 - The range to sum. If omitted, the cells in range are used.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SUMIF.js
*/
ApiWorksheetFunction.prototype.SUMIF = function (arg1, arg2, arg3) {
return this.private_calculateFunction("SUMIF", arguments);
@@ -5993,7 +6786,14 @@
* Adds the cells specified by a given set of conditions or criteria.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - The range of cells to be evaluated.
+ * @param {ApiRange | ApiName | number | string} arg2 - The first condition or criteria in the form of a number, expression, or text that defines which cells will be added.
+ * @param {?ApiRange | ?ApiName} arg3 - The first range to sum. If omitted, the cells in range are used.
+ * @param {ApiRange | ApiName | number | string} arg4 - Up to 127 additional conditions or criteria in the form of a number, expression, or text that defines which cells will be added.
+ * These arguments are optional.
+ * @param {?ApiRange | ?ApiName} arg5 - Up to 127 actual ranges to be used to be added. If omitted, the cells in the range are used. These arguments are optional.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SUMIFS.js
*/
ApiWorksheetFunction.prototype.SUMIFS = function () {
return this.private_calculateFunction("SUMIFS", arguments);
@@ -6009,10 +6809,14 @@
// return this.private_calculateFunction("SUMPRODUCT", arguments);
// };
/**
- * Returns the sum of the squares of the arguments. The arguments can be numbers, arrays, names or references to cells that contain numbers.
+ * Returns the sum of the squares of the arguments.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | number | string | boolean | ApiName | array} args - Up to 255 numeric values for which the sum of the squares will be calculated.
+ * The first argument is required, subsequent arguments are optional.
+ * The arguments can be numbers, names, logical values or text representations of numbers, ranges of cells that contain numbers, or arrays.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SUMSQ.js
*/
ApiWorksheetFunction.prototype.SUMSQ = function () {
return this.private_calculateFunction("SUMSQ", arguments);
@@ -6057,8 +6861,9 @@
* Returns the tangent of an angle.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the angle in radians for which you want the tangent. Degrees * PI()/180 = radians.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The angle in radians for which the tangent will be returned. If the argument is in degrees, multiply it by PI()/180.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TAN.js
*/
ApiWorksheetFunction.prototype.TAN = function (arg1) {
return this.private_calculateFunction("TAN", arguments);
@@ -6067,8 +6872,9 @@
* Returns the hyperbolic tangent of a number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is any real number.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - Any real number for which the hyperbolic tangent will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TANH.js
*/
ApiWorksheetFunction.prototype.TANH = function (arg1) {
return this.private_calculateFunction("TANH", arguments);
@@ -6077,9 +6883,10 @@
* Truncates a number to an integer by removing the decimal, or fractional, part of the number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {number} arg1 Is the number you want to truncate.
- * @param {?number} arg2 Is a number specifying the precision of the truncation, 0 (zero) if omitted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The number which will be truncated.
+ * @param {?ApiRange | ?ApiName | ?number} arg2 - A number specifying the precision of the truncation. If this argument is omitted, it is equal to 0 (zero).
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TRUNC.js
*/
ApiWorksheetFunction.prototype.TRUNC = function (arg1, arg2) {
return this.private_calculateFunction("TRUNC", arguments);
@@ -6088,41 +6895,50 @@
* Chooses a value or action to perform from a list of values, based on an index number.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The position of the value in the list of values, a numeric value greater than or equal to 1 but less than the number of values in the list of values.
+ * @param {number | string | ApiRange | ApiName} args - Up to 254 values or the selected range of cells to analyze.
+ * The first argument is required, subsequent arguments are optional. Arguments can be numbers, ranges, names, or text strings.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/CHOOSE.js
*/
ApiWorksheetFunction.prototype.CHOOSE = function () {
return this.private_calculateFunction("CHOOSE", arguments);
};
/**
- * Returns the number of columns in an array or reference.
+ * Returns the number of columns in the cell range.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is an array or array formula, or a reference to a range of cells for which you want the number of columns.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number[]} arg1 - A range or array of cells for which the number of columns will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/COLUMNS.js
*/
ApiWorksheetFunction.prototype.COLUMNS = function (arg1) {
return this.private_calculateFunction("COLUMNS", arguments);
};
/**
- * Looks for a value in the top row of a table or array of values and returns the value in the same column from a row you specify.
+ * Looks for a value in the top row of a table or array of values and returns the value in the same column from the specified row.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to be found in the first row of the table and can be a value, a reference, or a text string.
- * @param {number} arg2 Is a table of text, numbers, or logical values in which data is looked up. Table_array can be a reference to a range or a range name.
- * @param {number} arg3 Is the row number in table_array from which the matching value should be returned. The first row of values in the table is row 1.
- * @param {?boolean} arg4 Is a logical value: to find the closest match in the top row (sorted in ascending order) = TRUE or omitted; find an exact match = FALSE.
- * @returns {number | string | boolean}
+ * @param {number | string | ApiRange | ApiName} arg1 - The value to be found in the first row of the table and can be a value, a reference, or a text string.
+ * @param {ApiRange | ApiName} arg2 - A table of text, numbers, or logical values in which data is looked up. The data is sorted in ascending order.
+ * This argument can be a range of cells or a range name.
+ * @param {ApiRange | ApiName | number} arg3 - The row number in data table from which the matching value should be returned. The first row of values in the table is row 1.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg4 - A logical value which specifies whether to find the closest match in the top row (sorted in ascending order) (true or omitted)
+ * or find an exact match (false).
+ * @returns {number | string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HLOOKUP.js
*/
ApiWorksheetFunction.prototype.HLOOKUP = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("HLOOKUP", arguments);
};
/**
- * Creates a shortcut or jump that opens a document stored on your hard drive, a network server, or on the Internet.
+ * Creates a shortcut that jumps to another location in the current workbook, or opens a document stored on your hard drive, a network server, or on the Internet.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {string} arg1 Is the text giving the path and file name to the document to be opened, a hard drive location, UNC address, or URL path.
- * @param {?any} arg2 Is text or a number that is displayed in the cell. If omitted, the cell displays the Link_location text.
- * @returns {number | string | boolean}
+ * @param {string | ApiRange | ApiName} arg1 - The text giving the path and file name to the document to be opened, a hard drive location, UNC address, or URL path.
+ * @param {?string | ?ApiRange | ?number | ?ApiName} arg2 - Text or a number that is displayed in the cell. If omitted, the cell displays the link location text.
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/HYPERLINK.js
*/
ApiWorksheetFunction.prototype.HYPERLINK = function (arg1, arg2) {
return this.private_calculateFunction("HYPERLINK", arguments);
@@ -6131,45 +6947,58 @@
* Returns a value or reference of the cell at the intersection of a particular row and column, in a given range.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is a range of cells or an array constant..
- * @param {number} arg2 Selects the row in Array or Reference from which to return a value. If omitted, Column_num is required.
- * @param {?number} arg3 Selects the column in Array or Reference from which to return a value. If omitted, Row_num is required.
- * @param {?any} arg4 Is a reference to one or more cell ranges.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | array} arg1 - A range of cells or an array constant.
+ * @param {ApiRange | ApiName | number} arg2 - The row in the range from which to return a value. If omitted, the column number is required.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - The column in the range from which to return a value. If omitted, the row number is required.
+ * @param {?ApiRange | ?ApiName | ?number} arg4 - An area to use in case the range contains several ranges. If it is omitted, the function will assume argument to be 1.
+ * @returns {number | string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/INDEX.js
*/
ApiWorksheetFunction.prototype.INDEX = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("INDEX", arguments);
};
/**
- * Looks up a value either from a one-row or one-column range or from an array. Provided for backwards compatibility.
+ * Looks up a value either from a one-row or one-column range. Provided for backwards compatibility.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a value that LOOKUP searches for in Lookup_vector and can be a number, text, a logical value, or a name or reference to a value.
- * @param {ApiRange} arg2 Is a range that contains only one row or one column of text, numbers, or logical values, placed in ascending order.
- * @param {?ApiRange} arg3 Is a range that contains only one row or column, the same size as Lookup_vector.
+ * @param {number | string | boolean | ApiRange | ApiName} arg1 - A value that is searched for in the first vector. It can be a number, text, a logical value, or a name or reference to a value.
+ * @param {ApiRange | ApiName} arg2 - A range that contains only one row or one column of text, numbers, or logical values, placed in ascending order.
+ * @param {?ApiRange | ?ApiName} arg3 - A range that contains only one row or column. It must be the same size as the first vector.
* @returns {number | string | boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/LOOKUP.js
*/
ApiWorksheetFunction.prototype.LOOKUP = function (arg1, arg2, arg3) {
return this.private_calculateFunction("LOOKUP", arguments);
};
+
+ /**
+ * The match type.
+ * * -1 - The values must be sorted in descending order. If the exact match is not found, the function will return the smallest value that is greater than the searched value.
+ * * 0 - The values can be sorted in any order. If the exact match is not found, the function will return the #N/A error.
+ * * 1 (or omitted) - The values must be sorted in ascending order. If the exact match is not found, the function will return the largest value that is less than the searched value.
+ * @typedef {(-1 | 0 | 1)} MatchType
+ * */
+
/**
- * Returns the relative position of an item in an array that matches a specified value in a specified order.
+ * Returns the relative position of an item in a range that matches the specified value in the specified order.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you use to find the value you want in the array, a number, text, or logical value, or a reference to one of these.
- * @param {number} arg2 Is a contiguous range of cells containing possible lookup values, an array of values, or a reference to an array.
- * @param {?number} arg3 Is a number 1, 0, or -1 indicating which value to return..
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | ApiName} arg1 - The value to be matched in the range. It can be a number, text, or logical value, or a reference to one of these.
+ * @param {ApiRange | ApiName | array} arg2 - A contiguous range of cells or an array containing possible lookup values.
+ * @param {?ApiRange | ?ApiName | ?number} arg3 - A number 1, 0, or -1 indicating which value to return.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/MATCH.js
*/
ApiWorksheetFunction.prototype.MATCH = function (arg1, arg2, arg3) {
return this.private_calculateFunction("MATCH", arguments);
};
/**
- * Returns the number of rows in a reference or array.
+ * Returns the number of rows in a range.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is an array, an array formula, or a reference to a range of cells for which you want the number of rows.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | array} arg1 - A range of cells or an array for which the number of rows will be returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ROWS.js
*/
ApiWorksheetFunction.prototype.ROWS = function (arg1) {
return this.private_calculateFunction("ROWS", arguments);
@@ -6178,170 +7007,211 @@
* Converts a vertical range of cells to a horizontal range, or vice versa.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is a range of cells on a worksheet or an array of values that you want to transpose.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | array} arg1 - A range of cells on a worksheet or an array that will be transposed.
+ * @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TRANSPOSE.js
*/
ApiWorksheetFunction.prototype.TRANSPOSE = function (arg1) {
return this.private_calculateFunction("TRANSPOSE", arguments);
};
/**
- * Looks for a value in the leftmost column of a table and then returns a value in the same row from a column that you specify. By default, the table must be sorted in an ascending order.
+ * Looks for a value in the leftmost column of a table and then returns a value in the same row from the specified column. By default, the table must be sorted in an ascending order.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to be found in the first column of the table, and can be a value, a reference, or a text string.
- * @param {number} arg2 Is a table of text, numbers, or logical values, in which data is retrieved. Table_array can be a reference to a range or a range name.
- * @param {number} arg3 Is the column number in table_array from which the matching value should be returned. The first column of values in the table is column 1.
- * @param {?boolean} arg4 Is a logical value: to find the closest match in the first column (sorted in ascending order) = TRUE or omitted; find an exact match = FALSE.
- * @returns {number | string | boolean}
+ * @param {number | string | ApiRange | ApiName} arg1 - The value to be found in the first column of the table. It can be a value, a reference, or a text string.
+ * @param {ApiRange | ApiName} arg2 - A table of text, numbers, or logical values, in which data is retrieved. It can be a range of cells.
+ * @param {ApiRange | ApiName | number} arg3 - The column number in the data table from which the matching value should be returned. The first column of values in the table is column 1.
+ * @param {?ApiRange | ?ApiName | ?boolean} arg4 - A logical value that specifies whether to find the closest match in the first column (sorted in ascending order) (true or omitted)
+ * or find an exact match (false).
+ * @returns {number | string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/VLOOKUP.js
*/
ApiWorksheetFunction.prototype.VLOOKUP = function (arg1, arg2, arg3, arg4) {
return this.private_calculateFunction("VLOOKUP", arguments);
};
+
/**
- * Returns a number matching an error value..
+ * The error value.
+ * * "#NULL!" - 1
+ * * "#DIV/0!" - 2
+ * * "#VALUE!" - 3
+ * * "#REF!" - 4
+ * * "#NAME?" - 5
+ * * "#NUM!" - 6
+ * * "#N/A" - 7
+ * * "#GETTING_DATA" - 8
+ * * "Other" - "#N/A"
+ * @typedef {("#NULL!" | "#DIV/0!" | "#VALUE!" | "#REF!" | "#NAME?" | "#NUM!" | "#N/A" | "#GETTING_DATA")} ErrorValue
+ * */
+
+ /**
+ * Returns a number matching an error value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the error value for which you want the identifying number, and can be an actual error value or a reference to a cell containing an error value.
- * @returns {number | string | boolean}
+ * @param {ErrorValue | ApiRange | ApiName} arg1 - The error value for which the identifying number will be returned. It can be an actual error value or a reference to a cell containing an error value.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ERROR_TYPE.js
*/
ApiWorksheetFunction.prototype.ERROR_TYPE = function (arg1) {
return this.private_calculateFunction("ERROR.TYPE", arguments);
};
/**
- * Checks whether a value is an error other than #N/A, and returns TRUE or FALSE.
+ * Checks whether a value is an error other than #N/A, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISERR.js
*/
ApiWorksheetFunction.prototype.ISERR = function (arg1) {
return this.private_calculateFunction("ISERR", arguments);
};
/**
- * Checks whether a value is an error, and returns TRUE or FALSE.
+ * Checks whether a value is an error, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | ApiRange | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISERROR.js
*/
ApiWorksheetFunction.prototype.ISERROR = function (arg1) {
return this.private_calculateFunction("ISERROR", arguments);
};
/**
- * Returns TRUE if the number is even.
+ * Returns true if a number is even.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to test.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to test.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISEVEN.js
*/
ApiWorksheetFunction.prototype.ISEVEN = function (arg1) {
return this.private_calculateFunction("ISEVEN", arguments);
};
/**
- * Checks whether a reference is to a cell containing a formula, and returns TRUE or FALSE.
+ * Checks whether a reference to a cell contains a formula, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {ApiRange} arg1 Is a reference to the cell you want to test. Reference can be a cell reference, a formula, or name that refers to a cell.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName} arg1 - A cell range to test. This argument can be a range or a range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISFORMULA.js
*/
ApiWorksheetFunction.prototype.ISFORMULA = function (arg1) {
return this.private_calculateFunction("ISFORMULA", arguments);
};
/**
- * Checks whether a value is a logical value (TRUE or FALSE), and returns TRUE or FALSE.
+ * Checks whether a value is a logical value (true or false), and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | string | number | boolean | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISLOGICAL.js
*/
ApiWorksheetFunction.prototype.ISLOGICAL = function (arg1) {
return this.private_calculateFunction("ISLOGICAL", arguments);
};
/**
- * Checks whether a value is #N/A, and returns TRUE or FALSE.
+ * Checks whether a value is #N/A, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | string | number | boolean | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISNA.js
*/
ApiWorksheetFunction.prototype.ISNA = function (arg1) {
return this.private_calculateFunction("ISNA", arguments);
};
/**
- * Checks whether a value is not text (blank cells are not text), and returns TRUE or FALSE.
+ * Checks whether a value is not text (blank cells are not text), and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want tested: a cell; a formula; or a name referring to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | string | number | boolean | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISNONTEXT.js
*/
ApiWorksheetFunction.prototype.ISNONTEXT = function (arg1) {
return this.private_calculateFunction("ISNONTEXT", arguments);
};
/**
- * Checks whether a value is a number, and returns TRUE or FALSE.
+ * Checks whether a value is a number, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | string | number | boolean | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISNUMBER.js
*/
ApiWorksheetFunction.prototype.ISNUMBER = function (arg1) {
return this.private_calculateFunction("ISNUMBER", arguments);
};
/**
- * Returns TRUE if the number is odd.
+ * Returns true if a number is odd.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value to test.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number} arg1 - The value to test.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISODD.js
*/
ApiWorksheetFunction.prototype.ISODD = function (arg1) {
return this.private_calculateFunction("ISODD", arguments);
};
/**
- * Checks whether a value is a reference, and returns TRUE or FALSE.
+ * Checks whether a value is a reference, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | string | number | boolean | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISREF.js
*/
ApiWorksheetFunction.prototype.ISREF = function (arg1) {
return this.private_calculateFunction("ISREF", arguments);
};
/**
- * Checks whether a value is text, and returns TRUE or FALSE.
+ * Checks whether a value is text, and returns true or false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want to test. Value can refer to a cell, a formula, or a name that refers to a cell, formula, or value.
- * @returns {number | string | boolean}
+ * @param {ApiRange | string | number | boolean | ApiName} arg1 - The value to test.
+ * The value can be an empty cell, error, logical value, text, number, range, or range name.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/ISTEXT.js
*/
ApiWorksheetFunction.prototype.ISTEXT = function (arg1) {
return this.private_calculateFunction("ISTEXT", arguments);
};
/**
- * Converts non-number value to a number, dates to serial numbers, TRUE to 1, anything else to 0 (zero).
+ * Converts a value to a number, dates to serial numbers, true to 1, error to {@link global#ErrorValue ErrorValue}, anything else to 0 (zero).
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is the value you want converted.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string | boolean} arg1 - The value to be converted. The value can be a logical value, text, or number.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/N.js
*/
ApiWorksheetFunction.prototype.N = function (arg1) {
return this.private_calculateFunction("N", arguments);
};
/**
- * Returns the error value #N/A (value not available).
+ * Returns the #N/A error value which means "no value is available".
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NA.js
*/
ApiWorksheetFunction.prototype.NA = function () {
return this.private_calculateFunction("NA", arguments);
};
/**
- * Returns the sheet number of the referenced sheet.
+ * Returns the sheet number of the reference sheet.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {?string} arg1 Is the name of a sheet or a reference that you want the sheet number of. If omitted the number of the sheet containing the function is returned.
- * @returns {number | string | boolean}
+ * @param {?string | ?ApiRange | ?ApiName} arg1 - The name of a sheet or a reference for which the sheet number will be returned. If omitted the number of the sheet containing the function is returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SHEET.js
*/
ApiWorksheetFunction.prototype.SHEET = function (arg1) {
return this.private_calculateFunction("SHEET", arguments);
@@ -6350,8 +7220,9 @@
* Returns the number of sheets in a reference.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {?ApiRange} arg1 Is a reference for which you want to know the number of sheets it contains. If omitted the number of sheets in the workbook containing the function is returned.
- * @returns {number | string | boolean}
+ * @param {?ApiRange | ?ApiName} arg1 - A reference for which the number of sheets will be returned. If omitted the number of sheets in the workbook containing the function is returned.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/SHEETS.js
*/
ApiWorksheetFunction.prototype.SHEETS = function (arg1) {
return this.private_calculateFunction("SHEETS", arguments);
@@ -6360,97 +7231,110 @@
* Returns an integer representing the data type of a value: number = 1; text = 2; logical value = 4; error value = 16; array = 64; compound data = 128.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Can be any value.
- * @returns {number | string | boolean}
+ * @param {number | string | boolean | array | ApiRange | ApiName} arg1 - A value to test.
+ * @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TYPE.js
*/
ApiWorksheetFunction.prototype.TYPE = function (arg1) {
return this.private_calculateFunction("TYPE", arguments);
};
/**
- * Checks whether all arguments are TRUE, and returns TRUE if all arguments are TRUE.
+ * Checks whether all conditions in a test are true.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | string | ApiRange | boolean | ApiName} args - A condition to check.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/AND.js
*/
ApiWorksheetFunction.prototype.AND = function () {
return this.private_calculateFunction("AND", arguments);
};
/**
- * Returns the logical value FALSE.
+ * Returns the false logical value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/FALSE.js
*/
ApiWorksheetFunction.prototype.FALSE = function () {
return this.private_calculateFunction("FALSE", arguments);
};
/**
- * Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE.
+ * Checks whether a condition is met, and returns one value if true, and another value if false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {boolean} arg1 Is any value or expression that can be evaluated to TRUE or FALSE.
- * @param {any} arg2 Is the value that is returned if Logical_test is TRUE. If omitted, TRUE is returned. You can nest up to seven IF functions.
- * @param {?any} arg3 Is the value that is returned if Logical_test is FALSE. If omitted, FALSE is returned.
+ * @param {number | string | ApiRange | ApiName | boolean} arg1 - Any value or expression that can be evaluated to true or false.
+ * @param {number | string | ApiRange | ApiName | boolean} arg2 - The value that is returned if the condition is true. If omitted, true is returned. You can nest up to seven IF functions.
+ * @param {?ApiRange | ?ApiName | ?number | ?string | ?boolean} arg3 - The value that is returned if the condition is false. If omitted, false is returned.
* @returns {number | string | boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IF.js
*/
ApiWorksheetFunction.prototype.IF = function (arg1, arg2, arg3) {
return this.private_calculateFunction("IF", arguments);
};
/**
- * Returns value_if_error if expression is an error and the value of the expression itself otherwise.
+ * Checks if there is an error in the formula in the first argument. The function returns the result of the formula if there is no error, or the value specified in the second argument if there is one.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is any value or expression or reference.
- * @param {any} arg2 Is any value or expression or reference.
+ * @param {ApiRange | ApiName | number | string | boolean} arg1 - The value, expression, or reference that is checked for an error.
+ * @param {ApiRange | ApiName | number | string | boolean} arg2 - The value to be returned if the formula evaluates to an error. The following errors are evaluated: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, #NULL!.
* @returns {number | string | boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IFERROR.js
*/
ApiWorksheetFunction.prototype.IFERROR = function (arg1, arg2) {
return this.private_calculateFunction("IFERROR", arguments);
};
/**
- * Returns the value you specify if the expression resolves to #N/A, otherwise returns the result of the expression.
+ * Checks if there is an error in the formula in the first argument. The function returns the specified value if the formula returns the #N/A error value, otherwise returns the result of the formula.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {any} arg1 Is any value or expression or reference.
- * @param {any} arg2 Is any value or expression or reference.
+ * @param {ApiRange | ApiName | number | string | boolean} arg1 - The value, expression, or reference that is checked for an error.
+ * @param {ApiRange | ApiName | number | string | boolean} arg2 - The value to return if the formula evaluates to the #N/A error value.
* @returns {number | string | boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/IFNA.js
*/
ApiWorksheetFunction.prototype.IFNA = function (arg1, arg2) {
return this.private_calculateFunction("IFNA", arguments);
};
/**
- * Changes FALSE to TRUE, or TRUE to FALSE.
+ * Checks if the specified logical value is true or false. The function returns true if the argument is false and false if the argument is true.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @param {boolean} arg1 Is a value or expression that can be evaluated to TRUE or FALSE.
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | number | string | boolean} arg1 - A value or expression that can be evaluated to true or false.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/NOT.js
*/
ApiWorksheetFunction.prototype.NOT = function (arg1) {
return this.private_calculateFunction("NOT", arguments);
};
/**
- * Checks whether any of the arguments are TRUE, and returns TRUE or FALSE. Returns FALSE only if all arguments are FALSE.
+ * Checks whether any of the arguments are true. Returns false only if all arguments are false.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {number | string | ApiRange | ApiName | boolean} args - A condition to check.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/OR.js
*/
ApiWorksheetFunction.prototype.OR = function () {
return this.private_calculateFunction("OR", arguments);
};
/**
- * Returns the logical value TRUE.
+ * Returns the true logical value.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/TRUE.js
*/
ApiWorksheetFunction.prototype.TRUE = function () {
return this.private_calculateFunction("TRUE", arguments);
};
/**
- * Returns a logical 'Exclusive Or' of all arguments.
+ * Returns the logical Exclusive Or value of all arguments. The function returns true when the number of true inputs is odd and false when the number of true inputs is even.
* @memberof ApiWorksheetFunction
* @typeofeditors ["CSE"]
- * @returns {number | string | boolean}
+ * @param {ApiRange | ApiName | boolean | array} args - The conditions to check.
+ * @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheetFunction/Methods/XOR.js
*/
ApiWorksheetFunction.prototype.XOR = function () {
return this.private_calculateFunction("XOR", arguments);
@@ -6565,6 +7449,7 @@
* @param {number} nSheet - The sheet index.
* @param {boolean} [bWithFormat=false] - Specifies that the data will be received with the format.
* @returns {string[][]}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetMailMergeData.js
*/
Api.prototype.GetMailMergeData = function (nSheet, bWithFormat) {
if (bWithFormat !== true)
@@ -6587,6 +7472,7 @@
* @typeofeditors ["CSE"]
* @param {Function} fLogger - A function which specifies the logger object for checking recalculation of formulas.
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/RecalculateAllFormulas.js
*/
Api.prototype.RecalculateAllFormulas = function (fLogger) {
var formulas = this.wbModel.getAllFormulas(true);
@@ -6647,8 +7533,10 @@
if (formula.parent && nRow !== undefined && nCol !== undefined) {
var cell = formula.ws.getCell3(nRow, nCol);
var oldValue = cell.getValue();
+ let caTemp = formula.ca;
formula.setFormula(formula.getFormula());
formula.parse();
+ formula.ca = caTemp;
var formulaRes = formula.calculate();
var newValue = formula.simplifyRefType(formulaRes, formula.ws, nRow, nCol);
if (fLogger) {
@@ -6668,6 +7556,127 @@
}
};
+ /**
+ * Inserts the specified pivot table into an existing worksheet.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @param {ApiRange} dataRef - The source data range.
+ * @param {ApiRange} pivotRef - A range in which the pivot table will be located.
+ * @param {bool} confirmation - Specifies whether to replace the data in the specified pivot table range (if it exists) or create a dialog box for this (if it exists).
+ * @returns {ApiPivotTable}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/Api/Methods/InsertPivotExistingWorksheet.js
+ */
+ Api.prototype.InsertPivotExistingWorksheet = function (dataRef, pivotRef, confirmation) {
+ if (dataRef) {
+ dataRef = dataRef.GetWorksheet().GetName() + "!" + dataRef.GetAddress(true, true);
+ } else {
+ var options = this.asc_getAddPivotTableOptions();
+ dataRef = options.range;
+ }
+ if (pivotRef) {
+ pivotRef = pivotRef.GetWorksheet().GetName() + "!" + pivotRef.GetAddress(true, true);
+ } else {
+ private_MakeError('"pivotRef" is undefined.');
+ }
+ var pivot = this.asc_insertPivotExistingWorksheet(dataRef, pivotRef, confirmation);
+ if (pivot) {
+ return new ApiPivotTable(pivot, this);
+ }
+ private_MakeError('Error! Bad pivotRef!');
+ };
+
+ /**
+ * Inserts the specified pivot table into a new worksheet.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @param {ApiRange} dataRef - The source data range.
+ * @param {ApiRange} [newSheetName] - A new worksheet name.
+ * @returns {ApiPivotTable}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/Api/Methods/InsertPivotNewWorksheet.js
+ */
+ Api.prototype.InsertPivotNewWorksheet = function (dataRef, newSheetName) {
+ if (dataRef) {
+ dataRef = dataRef.GetWorksheet().GetName() + "!" + dataRef.GetAddress(true, true);
+ } else {
+ var options = this.asc_getAddPivotTableOptions();
+ dataRef = options.range;
+ }
+ if (!newSheetName) {
+ var items = [], wc = this.asc_getWorksheetsCount();
+ while (wc--) {
+ items.push(this.asc_getWorksheetName(wc).toLowerCase());
+ }
+
+ var index = 0, name;
+ while(++index < 1000) {
+ name = 'Sheet' + index;
+ if (items.indexOf(name.toLowerCase()) < 0) break;
+ }
+
+ newSheetName = name;
+ }
+ var pivot = this.asc_insertPivotNewWorksheet(dataRef, newSheetName);
+ if (pivot) {
+ return new ApiPivotTable(pivot, this);
+ }
+ private_MakeError('An error occurred while creating the pivot table!');
+ };
+
+ /**
+ * Returns a pivot table by its name, or null if it does not exist.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The pivot table name.
+ * @returns {ApiPivotTable|null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/Api/Methods/GetPivotByName.js
+ */
+ Api.prototype.GetPivotByName = function (name) {
+ var res = null;
+ if (typeof name == "string" && name.trim().length) {
+ var pivot = this.wbModel.getPivotTableByName( name.trim() );
+ if (pivot)
+ res = new ApiPivotTable(pivot, this);
+ }
+ return res;
+ };
+
+ /**
+ * Refreshes all pivot tables.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/Api/Methods/RefreshAllPivots.js
+ */
+ Api.prototype.RefreshAllPivots = function () {
+ this.asc_refreshAllPivots();
+ };
+
+ /**
+ * Returns all pivot tables.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotTable[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/Api/Methods/GetAllPivotTables.js
+ */
+ Api.prototype.GetAllPivotTables = function () {
+ var res = [];
+ var sheets = this.GetSheets();
+ sheets.forEach(function(ws) {
+ res = res.concat( ws.GetAllPivotTables() )
+ });
+ return res;
+ };
+
+ Object.defineProperty(Api.prototype, "PivotTables", {
+ get: function () {
+ return this.GetAllPivotTables();
+ }
+ });
+
/**
* Subscribes to the specified event and calls the callback function when the event fires.
* @function
@@ -6676,6 +7685,7 @@
* @param {string} eventName - The event name.
* @param {function} callback - Function to be called when the event fires.
* @fires Api#onWorksheetChange
+ * @see office-js-api/Examples/{Editor}/Api/Methods/attachEvent.js
*/
Api.prototype["attachEvent"] = Api.prototype.attachEvent;
@@ -6686,6 +7696,7 @@
* @typeofeditors ["CSE"]
* @param {string} eventName - The event name.
* @fires Api#onWorksheetChange
+ * @see office-js-api/Examples/{Editor}/Api/Methods/detachEvent.js
*/
Api.prototype["detachEvent"] = Api.prototype.detachEvent;
@@ -6697,6 +7708,7 @@
* @param {string} sAuthor - The author's name (optional).
* @returns {ApiComment | null}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/Api/Methods/AddComment.js
*/
Api.prototype.AddComment = function (sText, sAuthor) {
let result = null;
@@ -6722,6 +7734,7 @@
* @typeofeditors ["CSE"]
* @param {string} sId - The comment ID.
* @returns {?ApiComment}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetCommentById.js
*/
Api.prototype.GetCommentById = function (sId) {
let comment = this.asc_findComment(sId);
@@ -6736,6 +7749,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiComment[]}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetComments.js
*/
Api.prototype.GetComments = function () {
var comments = [];
@@ -6756,6 +7770,7 @@
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiComment[]}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetAllComments.js
*/
Api.prototype.GetAllComments = function () {
let aApiComments = this.GetComments();
@@ -6775,6 +7790,7 @@
/**
* Specifies a type of freeze panes.
* @typedef {("row" | "column" | "cell" | null )} FreezePaneType
+ * @see office-js-api/Examples/Enumerations/FreezePaneType.js
*/
/**
@@ -6783,6 +7799,7 @@
* @typeofeditors ["CSE"]
* @param {FreezePaneType} FreezePaneType - The freeze panes type ("null" to unfreeze).
* @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/Api/Methods/SetFreezePanesType.js
*/
Api.prototype.SetFreezePanesType = function (FreezePaneType) {
if (typeof FreezePaneType === 'string' || FreezePaneType === null) {
@@ -6818,6 +7835,7 @@
* @typeofeditors ["CSE"]
* @returns {FreezePaneType} FreezePaneType - The freeze panes type ("null" if there are no freeze panes).
* @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetFreezePanesType.js
*/
Api.prototype.GetFreezePanesType = function () {
let cell = this.wb.getWorksheet().topLeftFrozenCell;
@@ -6850,21 +7868,25 @@
});
/**
- * Returns the cell references style.
+ * Returns the cell reference style.
* @memberof Api
* @typeofeditors ["CSE"]
- * @returns {ReferenceStyle}
- * */
+ * @returns {ReferenceStyle} - The cell reference style.
+ * @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetReferenceStyle.js
+ */
Api.prototype.GetReferenceStyle = function () {
let bReferenceStyle = this.asc_getR1C1Mode();
return bReferenceStyle ? "xlR1C1" : "xlA1";
};
/**
- * Sets the cell references style.
+ * Sets the cell reference style.
* @memberof Api
* @typeofeditors ["CSE"]
- * @param {ReferenceStyle} sReferenceStyle - Type of reference style
+ * @param {ReferenceStyle} sReferenceStyle - The cell reference style.
+ * @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/Api/Methods/SetReferenceStyle.js
*/
Api.prototype.SetReferenceStyle = function (sReferenceStyle) {
let bReferenceMode = null;
@@ -6894,11 +7916,92 @@
});
+ /**
+ * Returns the document information:
+ * Application - the application the document has been created with.
+ * CreatedRaw - the date and time when the file was created.
+ * Created - the parsed date and time when the file was created.
+ * LastModifiedRaw - the date and time when the file was last modified.
+ * LastModified - the parsed date and time when the file was last modified.
+ * LastModifiedBy - the name of the user who has made the latest change to the document.
+ * Autrors - the persons who has created the file.
+ * Title - this property allows you to simplify your documents classification.
+ * Tags - this property allows you to simplify your documents classification.
+ * Subject - this property allows you to simplify your documents classification.
+ * Comment - this property allows you to simplify your documents classification.
+ * @memberof Api
+ * @typeofeditors ["CSE"]
+ * @returns {object}
+ * @see office-js-api/Examples/{Editor}/Api/Methods/GetDocumentInfo.js
+ */
+ Api.prototype.GetDocumentInfo = function()
+ {
+ const oDocInfo = {
+ Application: '',
+ CreatedRaw: null,
+ Created: '',
+ LastModifiedRaw: null,
+ LastModified: '',
+ LastModifiedBy: '',
+ Autrors: [],
+ Title: '',
+ Tags: '',
+ Subject: '',
+ Comment: ''
+ };
+
+ let props = (this) ? this.asc_getAppProps() : null;
+ oDocInfo.Application = (props.asc_getApplication() || '') + (props.asc_getAppVersion() ? ' ' : '') + (props.asc_getAppVersion() || '');
+
+ let langCode = 1033; // en-US
+ let langName = 'en-us';
+ if (AscCommon.g_oDefaultCultureInfo.Name) {
+ langName = AscCommon.g_oDefaultCultureInfo.Name.replace('_', '-').toLowerCase();
+ } else if (this.defaultLanguage && window['Common']) {
+ langCode = this.defaultLanguage;
+ langName = window['Common']['util']['LanguageInfo']['getLocalLanguageName'](langCode)[0].toLowerCase();
+
+ }
+
+ props = this.asc_getCoreProps();
+ oDocInfo.CreatedRaw = props.asc_getCreated();
+ oDocInfo.LastModifiedRaw = props.asc_getModified();
+
+ try {
+ if (oDocInfo.CreatedRaw)
+ oDocInfo.Created = (oDocInfo.CreatedRaw.toLocaleString(langName, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' +oDocInfo. CreatedRaw.toLocaleString(langName, {timeStyle: 'short'}));
+
+ if (oDocInfo.LastModifiedRaw)
+ oDocInfo.LastModified = (oDocInfo.LastModifiedRaw.toLocaleString(langName, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + oDocInfo.LastModifiedRaw.toLocaleString(langName, {timeStyle: 'short'}));
+ } catch (e) {
+ langName = 'en';
+ if (oDocInfo.CreatedRaw)
+ oDocInfo.Created = (oDocInfo.CreatedRaw.toLocaleString(langName, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + oDocInfo.CreatedRaw.toLocaleString(langName, {timeStyle: 'short'}));
+
+ if (oDocInfo.LastModifiedRaw)
+ oDocInfo.LastModified = (oDocInfo.LastModifiedRaw.toLocaleString(langName, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + oDocInfo.LastModifiedRaw.toLocaleString(langName, {timeStyle: 'short'}));
+ }
+
+ const LastModifiedBy = props.asc_getLastModifiedBy();
+ oDocInfo.LastModifiedBy = AscCommon.UserInfoParser.getParsedName(LastModifiedBy);
+
+ oDocInfo.Title = (props.asc_getTitle() || '');
+ oDocInfo.Tags = (props.asc_getKeywords() || '');
+ oDocInfo.Subject = (props.asc_getSubject() || '');
+ oDocInfo.Comment = (props.asc_getDescription() || '');
+
+ const authors = props.asc_getCreator();
+ if (authors)
+ oDocInfo.Autrors = authors.split(/\s*[,;]\s*/);
+
+ return oDocInfo;
+ };
/**
* Returns the state of sheet visibility.
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetVisible.js
*/
ApiWorksheet.prototype.GetVisible = function () {
return !this.worksheet.getHidden();
@@ -6909,6 +8012,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {boolean} isVisible - Specifies if the sheet is visible or not.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetVisible.js
*/
ApiWorksheet.prototype.SetVisible = function (isVisible) {
this.worksheet.setHidden(!isVisible);
@@ -6926,6 +8030,7 @@
* Makes the current sheet active.
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetActive.js
*/
ApiWorksheet.prototype.SetActive = function () {
this.worksheet.workbook.setActive(this.worksheet.index);
@@ -6941,6 +8046,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetActiveCell.js
*/
ApiWorksheet.prototype.GetActiveCell = function () {
let cell = this.worksheet.getCell3(this.worksheet.selectionRange.activeCell.row, this.worksheet.selectionRange.activeCell.col);
@@ -6961,6 +8067,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetSelection.js
*/
ApiWorksheet.prototype.GetSelection = function () {
var r = this.worksheet.selectionRange.getLast();
@@ -6984,6 +8091,7 @@
* @param {number} row - The row number or the cell number (if only row is defined).
* @param {number} col - The column number.
* @returns {ApiRange | null}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetCells.js
*/
ApiWorksheet.prototype.GetCells = function (row, col) {
let result;
@@ -7039,6 +8147,7 @@
* @typeofeditors ["CSE"]
* @param {string | number} value - Specifies the rows range in the string or number format.
* @returns {ApiRange | null}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetRows.js
*/
ApiWorksheet.prototype.GetRows = function (value) {
if (typeof value === "undefined") {
@@ -7078,6 +8187,7 @@
* @typeofeditors ["CSE"]
* @param {string} sRange - Specifies the columns range in the string format.
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetCols.js
*/
ApiWorksheet.prototype.GetCols = function (sRange) {
if (sRange.indexOf(':') == -1) {
@@ -7096,10 +8206,14 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetUsedRange.js
*/
ApiWorksheet.prototype.GetUsedRange = function () {
- var rEnd = this.worksheet.getRowsCount() - 1;
- var cEnd = this.worksheet.getColsCount() - 1;
+ const ws = this.worksheet;
+ const eot = ws.findEOT(true);
+ const rEnd = eot.row;
+ const cEnd = eot.col;
+
return new ApiRange(this.worksheet.getRange3(0, 0, (rEnd < 0) ? 0 : rEnd,
(cEnd < 0) ? 0 : cEnd));
};
@@ -7114,6 +8228,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetName.js
*/
ApiWorksheet.prototype.GetName = function () {
return this.worksheet.getName();
@@ -7124,6 +8239,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {string} sName - The name which will be displayed for the current sheet at the sheet tab.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetName.js
*/
ApiWorksheet.prototype.SetName = function (sName) {
let sOldName = this.worksheet.getName();
@@ -7149,6 +8265,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetIndex.js
*/
ApiWorksheet.prototype.GetIndex = function () {
return this.worksheet.getIndex();
@@ -7167,6 +8284,7 @@
* @param {string | ApiRange} Range1 - The range of cells from the current sheet.
* @param {string | ApiRange} Range2 - The range of cells from the current sheet.
* @returns {ApiRange | null} - returns null if such a range does not exist.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetRange.js
*/
ApiWorksheet.prototype.GetRange = function (Range1, Range2) {
var Range, r1, c1, r2, c2;
@@ -7206,6 +8324,7 @@
* @param {number} nRow - The row number.
* @param {number} nCol - The column number.
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetRangeByNumber.js
*/
ApiWorksheet.prototype.GetRangeByNumber = function (nRow, nCol) {
return new ApiRange(this.worksheet.getCell3(nRow, nCol));
@@ -7217,6 +8336,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {string} sRange - The range of cells from the current sheet which will be formatted as a table.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/FormatAsTable.js
*/
ApiWorksheet.prototype.FormatAsTable = function (sRange) {
this.worksheet.autoFilters.addAutoFilter('TableStyleLight9', AscCommonExcel.g_oRangeCache.getAscRange(sRange));
@@ -7231,6 +8351,7 @@
* @param {number} nColumn - The number of the column to set the width to.
* @param {number} nWidth - The width of the column divided by 7 pixels.
* @param {boolean} [bWithotPaddings=false] - Specifies whether nWidth will be set without standard paddings.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetColumnWidth.js
*/
ApiWorksheet.prototype.SetColumnWidth = function (nColumn, nWidth, bWithotPaddings) {
if (bWithotPaddings) {
@@ -7247,6 +8368,7 @@
* @typeofeditors ["CSE"]
* @param {number} nRow - The number of the row to set the height to.
* @param {number} nHeight - The height of the row measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetRowHeight.js
*/
ApiWorksheet.prototype.SetRowHeight = function (nRow, nHeight) {
this.worksheet.setRowHeight(nHeight, nRow, nRow, true);
@@ -7257,6 +8379,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {boolean} isDisplayed - Specifies whether the current sheet gridlines must be displayed or not. The default value is true.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetDisplayGridlines.js
*/
ApiWorksheet.prototype.SetDisplayGridlines = function (isDisplayed) {
this.worksheet.setDisplayGridlines(!!isDisplayed);
@@ -7267,6 +8390,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {boolean} isDisplayed - Specifies whether the current sheet row/column headers must be displayed or not. The default value is true.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetDisplayHeadings.js
*/
ApiWorksheet.prototype.SetDisplayHeadings = function (isDisplayed) {
this.worksheet.setDisplayHeadings(!!isDisplayed);
@@ -7277,6 +8401,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {number} nPoints - The left margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetLeftMargin.js
*/
ApiWorksheet.prototype.SetLeftMargin = function (nPoints) {
nPoints = (typeof nPoints !== 'number') ? 0 : nPoints;
@@ -7287,6 +8412,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {number} - The left margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetLeftMargin.js
*/
ApiWorksheet.prototype.GetLeftMargin = function () {
return this.worksheet.PagePrintOptions.pageMargins.asc_getLeft();
@@ -7305,6 +8431,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {number} nPoints - The right margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetRightMargin.js
*/
ApiWorksheet.prototype.SetRightMargin = function (nPoints) {
nPoints = (typeof nPoints !== 'number') ? 0 : nPoints;
@@ -7315,6 +8442,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {number} - The right margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetRightMargin.js
*/
ApiWorksheet.prototype.GetRightMargin = function () {
return this.worksheet.PagePrintOptions.pageMargins.asc_getRight();
@@ -7333,6 +8461,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {number} nPoints - The top margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetTopMargin.js
*/
ApiWorksheet.prototype.SetTopMargin = function (nPoints) {
nPoints = (typeof nPoints !== 'number') ? 0 : nPoints;
@@ -7343,6 +8472,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {number} - The top margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetTopMargin.js
*/
ApiWorksheet.prototype.GetTopMargin = function () {
return this.worksheet.PagePrintOptions.pageMargins.asc_getTop();
@@ -7361,6 +8491,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {number} nPoints - The bottom margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetBottomMargin.js
*/
ApiWorksheet.prototype.SetBottomMargin = function (nPoints) {
nPoints = (typeof nPoints !== 'number') ? 0 : nPoints;
@@ -7371,6 +8502,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {number} - The bottom margin size measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetBottomMargin.js
*/
ApiWorksheet.prototype.GetBottomMargin = function () {
return this.worksheet.PagePrintOptions.pageMargins.asc_getBottom();
@@ -7389,7 +8521,8 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {PageOrientation} sPageOrientation - The page orientation type.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetPageOrientation.js
+ */
ApiWorksheet.prototype.SetPageOrientation = function (sPageOrientation) {
this.worksheet.PagePrintOptions.pageSetup.asc_setOrientation('xlLandscape' === sPageOrientation ? 1 : 0);
};
@@ -7399,7 +8532,8 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {PageOrientation}
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetPageOrientation.js
+ */
ApiWorksheet.prototype.GetPageOrientation = function () {
var PageOrientation = this.worksheet.PagePrintOptions.pageSetup.asc_getOrientation();
return (PageOrientation) ? 'xlLandscape' : 'xlPortrait';
@@ -7420,7 +8554,8 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {boolean} - Specifies whether the current sheet row/column headings must be printed or not.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetPrintHeadings.js
+ */
ApiWorksheet.prototype.GetPrintHeadings = function () {
return this.worksheet.PagePrintOptions.asc_getHeadings();
};
@@ -7430,7 +8565,8 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {boolean} bPrint - Specifies whether the current sheet row/column headers must be printed or not.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetPrintHeadings.js
+ */
ApiWorksheet.prototype.SetPrintHeadings = function (bPrint) {
this.worksheet.PagePrintOptions.asc_setHeadings(!!bPrint);
};
@@ -7449,7 +8585,8 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {boolean} - True if cell gridlines are printed on this page.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetPrintGridlines.js
+ */
ApiWorksheet.prototype.GetPrintGridlines = function () {
return this.worksheet.PagePrintOptions.asc_getGridLines();
};
@@ -7459,7 +8596,8 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @param {boolean} bPrint - Defines if cell gridlines are printed on this page or not.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetPrintGridlines.js
+ */
ApiWorksheet.prototype.SetPrintGridlines = function (bPrint) {
this.worksheet.PagePrintOptions.asc_setGridLines(!!bPrint);
};
@@ -7478,6 +8616,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiName[]}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetDefNames.js
*/
ApiWorksheet.prototype.GetDefNames = function () {
var res = this.worksheet.workbook.getDefinedNamesWS(this.worksheet.getId());
@@ -7497,6 +8636,7 @@
* @typeofeditors ["CSE"]
* @param {string} defName - The worksheet name.
* @returns {ApiName | null} - returns null if definition name doesn't exist.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetDefName.js
*/
ApiWorksheet.prototype.GetDefName = function (defName) {
if (defName && typeof defName === "string") {
@@ -7516,6 +8656,7 @@
* Example: "Sheet1!$A$1:$B$2".
* @param {boolean} isHidden - Defines if the range name is hidden or not.
* @returns {boolean} - returns false if sName or sRef are invalid.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddDefName.js
*/
ApiWorksheet.prototype.AddDefName = function (sName, sRef, isHidden) {
return private_AddDefName(this.worksheet.workbook, sName, sRef, this.worksheet.getIndex(), isHidden);
@@ -7532,6 +8673,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiComment[]}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetComments.js
*/
ApiWorksheet.prototype.GetComments = function () {
var comments = [];
@@ -7550,6 +8692,7 @@
* Deletes the current worksheet.
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/Delete.js
*/
ApiWorksheet.prototype.Delete = function () {
this.worksheet.workbook.oApi.asc_deleteWorksheet([this.worksheet.getIndex()]);
@@ -7564,7 +8707,8 @@
* @param {string} subAddress - The link subaddress to insert internal sheet hyperlinks.
* @param {string} sScreenTip - The screen tip text.
* @param {string} sTextToDisplay - The link text that will be displayed on the sheet.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/SetHyperlink.js
+ */
ApiWorksheet.prototype.SetHyperlink = function (sRange, sAddress, subAddress, sScreenTip, sTextToDisplay) {
var range = new ApiRange(this.worksheet.getRange2(sRange));
var address;
@@ -7622,6 +8766,7 @@
* @param {number} nFromRow - The number of the row where the beginning of the chart will be placed.
* @param {EMU} nRowOffset - The offset from the nFromRow row to the upper part of the chart measured in English measure units.
* @returns {ApiChart}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddChart.js
*/
ApiWorksheet.prototype.AddChart =
function (sDataRange, bInRows, sType, nStyleIndex, nExtX, nExtY, nFromCol, nColOffset, nFromRow, nRowOffset) {
@@ -7643,7 +8788,7 @@
oChart.setStyle(nStyleIndex);
}
oChart.recalculateReferences();
- return new ApiChart(oChart);
+ return Asc.editor.private_CreateApiChart(oChart);
};
@@ -7664,7 +8809,8 @@
* @param {number} nFromRow - The number of the row where the beginning of the shape will be placed.
* @param {EMU} nRowOffset - The offset from the nFromRow row to the upper part of the shape measured in English measure units.
* @returns {ApiShape}
- * */
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddShape.js
+ */
ApiWorksheet.prototype.AddShape = function (sType, nWidth, nHeight, oFill, oStroke, nFromCol, nColOffset, nFromRow, nRowOffset) {
var oShape = AscFormat.builder_CreateShape(sType, nWidth / 36000, nHeight / 36000, oFill.UniFill, oStroke.Ln, null, this.worksheet.workbook.theme, this.worksheet.getDrawingDocument(), false, this.worksheet);
private_SetCoords(oShape, this.worksheet, nWidth, nHeight, nFromCol, nColOffset, nFromRow, nRowOffset);
@@ -7684,6 +8830,7 @@
* @param {number} nFromRow - The number of the row where the beginning of the image will be placed.
* @param {EMU} nRowOffset - The offset from the nFromRow row to the upper part of the image measured in English measure units.
* @returns {ApiImage}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddImage.js
*/
ApiWorksheet.prototype.AddImage = function (sImageSrc, nWidth, nHeight, nFromCol, nColOffset, nFromRow, nRowOffset) {
var oImage = AscFormat.DrawingObjectsController.prototype.createImage(sImageSrc, 0, 0, nWidth / 36000, nHeight / 36000);
@@ -7708,6 +8855,7 @@
* @param {EMU} [nColOffset=0] - The offset from the nFromCol column to the left part of the Text Art object measured in English measure units.
* @param {EMU} [nRowOffset=0] - The offset from the nFromRow row to the upper part of the Text Art object measured in English measure units.
* @returns {ApiDrawing}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddWordArt.js
*/
ApiWorksheet.prototype.AddWordArt = function (oTextPr, sText, sTransform, oFill, oStroke, nRotAngle, nWidth, nHeight, nFromCol, nFromRow, nColOffset, nRowOffset) {
oTextPr = oTextPr && oTextPr.TextPr ? oTextPr.TextPr : null;
@@ -7743,6 +8891,7 @@
* @param {number} nFromRow - The number of the row where the beginning of the OLE object will be placed.
* @param {EMU} nRowOffset - The offset from the nFromRow row to the upper part of the OLE object measured in English measure units.
* @returns {ApiOleObject}
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddOleObject.js
*/
ApiWorksheet.prototype.AddOleObject = function (sImageSrc, nWidth, nHeight, sData, sAppId, nFromCol, nColOffset, nFromRow, nRowOffset) {
if (typeof sImageSrc === "string" && sImageSrc.length > 0 && typeof sData === "string"
@@ -7765,6 +8914,7 @@
* @param {string} sImageUrl - The image source where the image to be inserted should be taken from (currently only internet URL or Base64 encoded images are supported).
* @param {EMU} nWidth - The image width in English measure units.
* @param {EMU} nHeight - The image height in English measure units.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/ReplaceCurrentImage.js
*/
ApiWorksheet.prototype.ReplaceCurrentImage = function (sImageUrl, nWidth, nHeight) {
let oWorksheet = Asc['editor'].wb.getWorksheet();
@@ -7780,6 +8930,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiDrawing[]}.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetAllDrawings.js
*/
ApiWorksheet.prototype.GetAllDrawings = function () {
var allDrawings = this.worksheet.Drawings;
@@ -7798,6 +8949,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiImage[]}.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetAllImages.js
*/
ApiWorksheet.prototype.GetAllImages = function () {
var allDrawings = this.worksheet.Drawings;
@@ -7816,6 +8968,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiShape[]}.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetAllShapes.js
*/
ApiWorksheet.prototype.GetAllShapes = function () {
var allDrawings = this.worksheet.Drawings;
@@ -7834,6 +8987,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiChart[]}.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetAllCharts.js
*/
ApiWorksheet.prototype.GetAllCharts = function () {
var allDrawings = this.worksheet.Drawings;
@@ -7841,7 +8995,7 @@
for (var nDrawing = 0; nDrawing < allDrawings.length; nDrawing++) {
if (allDrawings[nDrawing].graphicObject && allDrawings[nDrawing].isChart()) {
- allApiDrawings.push(new ApiChart(allDrawings[nDrawing].graphicObject));
+ allApiDrawings.push(Asc.editor.private_CreateApiChart(allDrawings[nDrawing].graphicObject));
}
}
return allApiDrawings;
@@ -7852,6 +9006,7 @@
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiOleObject[]}.
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetAllOleObjects.js
*/
ApiWorksheet.prototype.GetAllOleObjects = function () {
var allDrawings = this.worksheet.Drawings;
@@ -7871,6 +9026,7 @@
* @typeofeditors ["CSE"]
* @param {ApiWorksheet} before - The sheet before which the current sheet will be placed. You cannot specify "before" if you specify "after".
* @param {ApiWorksheet} after - The sheet after which the current sheet will be placed. You cannot specify "after" if you specify "before".
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/Move.js
*/
ApiWorksheet.prototype.Move = function (before, after) {
let bb = before instanceof ApiWorksheet;
@@ -7885,35 +9041,93 @@
};
/**
- * Returns the freeze panes from the current worksheet.
+ * Returns a pivot table by its name from the current worksheet, or null if it does not exist.
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
- * @returns {ApiFreezePanes}
- * @since 8.0.0
+ * @param {string} name - The pivot table name.
+ * @returns {ApiPivotTable|null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/ApiWorksheet/Methods/GetPivotByName.js
*/
- ApiWorksheet.prototype.GetFreezePanes = function () {
- return new ApiFreezePanes(this.worksheet);
+ ApiWorksheet.prototype.GetPivotByName = function (name) {
+ var res = null;
+ if (name) {
+ var pivot = this.worksheet.getPivotTableByName(name);
+ if (pivot)
+ res = new ApiPivotTable(pivot, this.worksheet.workbook.oApi);
+ }
+ return res;
};
- Object.defineProperty(ApiWorksheet.prototype, "FreezePanes", {
+ /**
+ * Returns all pivot tables from the current worksheet.
+ * @memberof ApiWorksheet
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotTable[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/ApiWorksheet/Methods/GetAllPivotTables.js
+ */
+ ApiWorksheet.prototype.GetAllPivotTables = function () {
+ var res = [];
+ var ws = this.worksheet;
+ ws.pivotTables.forEach(function(piv) {
+ res.push( new ApiPivotTable(piv, ws.workbook.oApi) );
+ });
+ return res;
+ };
+
+ Object.defineProperty(ApiWorksheet.prototype, "PivotTables", {
get: function () {
- return this.GetFreezePanes();
+ return this.GetAllPivotTables();
}
});
/**
- * Creates a protected range of the specified type from the selected data range of the current sheet.
+ * Refreshes all pivot tables on the current worksheet.
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
- * @param {string} sTitle - The title which will be displayed for the current protected range.
- * @param {string} sDataRange - The selected cell range which will be used to get the data for the protected range.
- * @returns {ApiProtectedRange | null}
- * @since 8.1.0
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/ApiWorksheet/Methods/RefreshAllPivots.js
*/
- ApiWorksheet.prototype.AddProtectedRange = function (sTitle, sDataRange) {
- let isValidTitle = typeof (sTitle) === 'string' && sTitle.trim() !== '';
- let isValidRef = typeof (sDataRange) === 'string' && sDataRange.trim() !== '';
- let result = null;
+ ApiWorksheet.prototype.RefreshAllPivots = function () {
+ const t = this;
+ this.worksheet.pivotTables.forEach(function(pivot) {
+ pivot.asc_refresh(t.worksheet.workbook.oApi);
+ });
+ };
+
+ /**
+ * Returns the freeze panes from the current worksheet.
+ * @memberof ApiWorksheet
+ * @typeofeditors ["CSE"]
+ * @returns {ApiFreezePanes}
+ * @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetFreezePanes.js
+ */
+ ApiWorksheet.prototype.GetFreezePanes = function () {
+ return new ApiFreezePanes(this.worksheet);
+ };
+
+ Object.defineProperty(ApiWorksheet.prototype, "FreezePanes", {
+ get: function () {
+ return this.GetFreezePanes();
+ }
+ });
+
+ /**
+ * Creates a protected range of the specified type from the selected data range of the current sheet.
+ * @memberof ApiWorksheet
+ * @typeofeditors ["CSE"]
+ * @param {string} sTitle - The title which will be displayed for the current protected range.
+ * @param {string} sDataRange - The selected cell range which will be used to get the data for the protected range.
+ * @returns {ApiProtectedRange | null}
+ * @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/AddProtectedRange.js
+ */
+ ApiWorksheet.prototype.AddProtectedRange = function (sTitle, sDataRange) {
+ let isValidTitle = typeof (sTitle) === 'string' && sTitle.trim() !== '';
+ let isValidRef = typeof (sDataRange) === 'string' && sDataRange.trim() !== '';
+ let result = null;
if (isValidTitle && isValidRef) {
let settings = new Asc.CUserProtectedRange(this.worksheet);
settings.asc_setName(sTitle);
@@ -7933,8 +9147,9 @@
settings.asc_setUsers(users);
}
}
- if (this.worksheet.editUserProtectedRanges(null, settings, true)) {
- result = new ApiProtectedRange(settings);
+ let editRes = this.worksheet.editUserProtectedRanges(null, settings, true);
+ if (typeof editRes === "object") {
+ result = new ApiProtectedRange(editRes);
} else {
logError(new Error('Protected range cannot be added.'));
}
@@ -7953,6 +9168,7 @@
* @param {string} sTitle - The title of the protected range that will be returned.
* @returns {ApiProtectedRange | null}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetProtectedRange.js
*/
ApiWorksheet.prototype.GetProtectedRange = function (sTitle) {
let isValidTitle = typeof (sTitle) === 'string' && sTitle.trim() !== '';
@@ -7976,6 +9192,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiProtectedRange[] | null}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/GetAllProtectedRanges.js
*/
ApiWorksheet.prototype.GetAllProtectedRanges = function () {
let protectedRanges = this.worksheet && this.worksheet.workbook && this.worksheet.workbook.oApi.asc_getUserProtectedRanges(this.worksheet.sName);
@@ -7998,11 +9215,12 @@
});
/**
- * Pastes the contents of the Clipboard onto the sheet.
- * @memberof ApiRange
+ * Pastes the contents of the clipboard to the current sheet.
+ * @memberof ApiWorksheet
* @typeofeditors ["CSE"]
- * @param {ApiRange?} [destination] - Object that specifies where the Clipboard contents should be pasted. If this argument is omitted, the current selection is used.
+ * @param {ApiRange?} [destination] - The cell range where the clipboard contents should be pasted. If this argument is omitted, the current selection is used.
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiWorksheet/Methods/Paste.js
*/
ApiWorksheet.prototype.Paste = function (destination) {
var oApi = Asc["editor"];
@@ -8030,38 +9248,45 @@
/**
* Specifies the cell border position.
* @typedef {("DiagonalDown" | "DiagonalUp" | "Bottom" | "Left" | "Right" | "Top" | "InsideHorizontal" | "InsideVertical")} BordersIndex
+ * @see office-js-api/Examples/Enumerations/BordersIndex.js
*/
/**
* Specifies the line style used to form the cell border.
* @typedef {("None" | "Double" | "Hair" | "DashDotDot" | "DashDot" | "Dotted" | "Dashed" | "Thin" | "MediumDashDotDot" | "SlantDashDot" | "MediumDashDot" | "MediumDashed" | "Medium" | "Thick")} LineStyle
+ * @see office-js-api/Examples/Enumerations/LineStyle.js
*/
//TODO xlManual param
/**
* Specifies the sort order.
* @typedef {("xlAscending" | "xlDescending")} SortOrder
- * */
+ * @see office-js-api/Examples/Enumerations/SortOrder.js
+ */
//TODO xlGuess param
/**
* Specifies whether the first row of the sort range contains the header information.
* @typedef {("xlNo" | "xlYes")} SortHeader
- * */
+ * @see office-js-api/Examples/Enumerations/SortHeader.js
+ */
/**
* Specifies if the sort should be by row or column.
* @typedef {("xlSortColumns" | "xlSortRows")} SortOrientation
- * */
+ * @see office-js-api/Examples/Enumerations/SortOrientation.js
+ */
/**
* Specifies the range angle.
* @typedef {("xlDownward" | "xlHorizontal" | "xlUpward" | "xlVertical")} Angle
+ * @see office-js-api/Examples/Enumerations/Angle.js
*/
/**
* Specifies the direction of end in the specified range.
* @typedef {("xlUp" | "xlDown" | "xlToRight" | "xlToLeft")} Direction
+ * @see office-js-api/Examples/Enumerations/Direction.js
*/
/**
@@ -8069,6 +9294,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {"range"}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetClassType.js
*/
ApiRange.prototype.GetClassType = function () {
return "range";
@@ -8079,6 +9305,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetRow.js
*/
ApiRange.prototype.GetRow = function () {
return (this.range.bbox.r1 + 1);
@@ -8093,6 +9320,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetCol.js
*/
ApiRange.prototype.GetCol = function () {
return (this.range.bbox.c1 + 1);
@@ -8107,6 +9335,7 @@
* Clears the current range.
* @memberof ApiRange
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Clear.js
*/
ApiRange.prototype.Clear = function () {
let range = this.range,
@@ -8127,6 +9356,7 @@
* @typeofeditors ["CSE"]
* @param {number} nRow - The row number (starts counting from 1, the 0 value returns an error).
* @returns {ApiRange | null}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetRows.js
*/
ApiRange.prototype.GetRows = function (nRow) {
let result = null;
@@ -8157,6 +9387,7 @@
* @typeofeditors ["CSE"]
* @param {number} nCol - The column number. *
* @returns {ApiRange | null}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetCols.js
*/
ApiRange.prototype.GetCols = function (nCol) {
let result = null;
@@ -8187,6 +9418,7 @@
* @typeofeditors ["CSE"]
* @param {Direction} direction - The direction of end in the specified range. *
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/End.js
*/
ApiRange.prototype.End = function (direction) {
let bbox = this.range.bbox;
@@ -8254,6 +9486,7 @@
* @param {number} row - The row number or the cell number (if only row is defined).
* @param {number} col - The column number.
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetCells.js
*/
ApiRange.prototype.GetCells = function (row, col) {
let bbox = this.range.bbox;
@@ -8298,6 +9531,7 @@
* @typeofeditors ["CSE"]
* @param {number} nRow - The row number.
* @param {number} nCol - The column number.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetOffset.js
*/
ApiRange.prototype.SetOffset = function (nRow, nCol) {
this.range.setOffset({row: nRow, col: nCol});
@@ -8313,6 +9547,7 @@
* @param {boolean} External - Defines if the range is in the current file or not.
* @param {range} RelativeTo - The range which the current range is relative to.
* @returns {string | null} - returns address of range as string.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetAddress.js
*/
ApiRange.prototype.GetAddress = function (RowAbs, ColAbs, RefStyle, External, RelativeTo) {
// todo поправить, чтобы возвращал адреса всех areas внутри range
@@ -8366,6 +9601,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetCount.js
*/
ApiRange.prototype.GetCount = function () {
var range = this.range.bbox;
@@ -8400,6 +9636,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {string | string[][]}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetValue.js
*/
ApiRange.prototype.GetValue = function () {
var bbox = this.range.bbox;
@@ -8427,7 +9664,8 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {string | bool | number | Array[] | Array[][]} data - The general value for the cell or cell range.
- * @return {boolean} - returns false if such a range does not exist.
+ * @returns {boolean} - returns false if such a range does not exist.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetValue.js
*/
ApiRange.prototype.SetValue = function (data) {
if (!this.range)
@@ -8501,7 +9739,8 @@
* Returns a formula of the specified range.
* @typeofeditors ["CSE"]
* @memberof ApiRange
- * @return {string | string[][]} - return Value2 property (value without format) if formula doesn't exist.
+ * @returns {string | string[][]} - return Value2 property (value without format) if formula doesn't exist.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetFormula.js
*/
ApiRange.prototype.GetFormula = function () {
if (this.range.isFormula())
@@ -8523,7 +9762,8 @@
* Returns the Value2 property (value without format) of the specified range.
* @typeofeditors ["CSE"]
* @memberof ApiRange
- * @return {string | string[][]}
+ * @returns {string | string[][]}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetValue2.js
*/
ApiRange.prototype.GetValue2 = function () {
var bbox = this.range.bbox;
@@ -8559,7 +9799,8 @@
* Returns the text of the specified range.
* @typeofeditors ["CSE"]
* @memberof ApiRange
- * @return {string | string[][]}
+ * @returns {string | string[][]}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetText.js
*/
ApiRange.prototype.GetText = function () {
var bbox = this.range.bbox;
@@ -8596,6 +9837,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {ApiColor} oColor - The color object which specifies the color to be set to the text in the cell / cell range.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetFontColor.js
*/
ApiRange.prototype.SetFontColor = function (oColor) {
this.range.setFontcolor(oColor.color);
@@ -8611,6 +9853,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {boolean} - returns true if the values in the range specified are hidden.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetHidden.js
*/
ApiRange.prototype.GetHidden = function () {
var range = this.range;
@@ -8632,6 +9875,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {boolean} isHidden - Specifies if the values in the current range are hidden or not.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetHidden.js
*/
ApiRange.prototype.SetHidden = function (isHidden) {
var range = this.range;
@@ -8661,6 +9905,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetColumnWidth.js
*/
ApiRange.prototype.GetColumnWidth = function () {
var ws = this.range.worksheet;
@@ -8675,6 +9920,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {number} nWidth - The width of the column divided by 7 pixels.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetColumnWidth.js
*/
ApiRange.prototype.SetColumnWidth = function (nWidth) {
this.range.worksheet.setColWidth(nWidth, this.range.bbox.c1, this.range.bbox.c2);
@@ -8707,6 +9953,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {pt} - The row height in the range specified, measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetRowHeight.js
*/
ApiRange.prototype.GetRowHeight = function () {
return this.range.worksheet.getRowHeight(this.range.bbox.r1);
@@ -8717,6 +9964,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {pt} nHeight - The row height in the current range measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetRowHeight.js
*/
ApiRange.prototype.SetRowHeight = function (nHeight) {
this.range.worksheet.setRowHeight(nHeight, this.range.bbox.r1, this.range.bbox.r2, true);
@@ -8745,6 +9993,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {number} nSize - The font size value measured in points.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetFontSize.js
*/
ApiRange.prototype.SetFontSize = function (nSize) {
this.range.setFontsize(nSize);
@@ -8760,6 +10009,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {string} sName - The font family name used for the current cell range.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetFontName.js
*/
ApiRange.prototype.SetFontName = function (sName) {
this.range.setFontname(sName);
@@ -8776,6 +10026,7 @@
* @typeofeditors ["CSE"]
* @param {'center' | 'bottom' | 'top' | 'distributed' | 'justify'} sAligment - The vertical alignment that will be applied to the cell contents.
* @returns {boolean} - return false if sAligment doesn't exist.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetAlignVertical.js
*/
ApiRange.prototype.SetAlignVertical = function (sAligment) {
switch (sAligment) {
@@ -8817,6 +10068,7 @@
* @typeofeditors ["CSE"]
* @param {'left' | 'right' | 'center' | 'justify'} sAlignment - The horizontal alignment that will be applied to the cell contents.
* @returns {boolean} - return false if sAligment doesn't exist.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetAlignHorizontal.js
*/
ApiRange.prototype.SetAlignHorizontal = function (sAlignment) {
switch (sAlignment) {
@@ -8853,6 +10105,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {boolean} isBold - Specifies that the contents of the current cell / cell range are displayed bold.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetBold.js
*/
ApiRange.prototype.SetBold = function (isBold) {
this.range.setBold(!!isBold);
@@ -8868,6 +10121,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {boolean} isItalic - Specifies that the contents of the current cell / cell range are displayed italicized.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetItalic.js
*/
ApiRange.prototype.SetItalic = function (isItalic) {
this.range.setItalic(!!isItalic);
@@ -8884,11 +10138,12 @@
* @typeofeditors ["CSE"]
* @param {'none' | 'single' | 'singleAccounting' | 'double' | 'doubleAccounting'} undelineType - Specifies the type of the
* line displayed under the characters. The following values are available:
- * * "none" - for no underlining;
- * * "single" - for a single line underlining the cell contents;
- * * "singleAccounting" - for a single line underlining the cell contents but not protruding beyond the cell borders;
- * * "double" - for a double line underlining the cell contents;
- * * "doubleAccounting" - for a double line underlining the cell contents but not protruding beyond the cell borders.
+ * "none" - for no underlining;
+ * "single" - for a single line underlining the cell contents;
+ * "singleAccounting" - for a single line underlining the cell contents but not protruding beyond the cell borders;
+ * "double" - for a double line underlining the cell contents;
+ * "doubleAccounting" - for a double line underlining the cell contents but not protruding beyond the cell borders.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetUnderline.js
*/
ApiRange.prototype.SetUnderline = function (undelineType) {
var val;
@@ -8923,6 +10178,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {boolean} isStrikeout - Specifies if the contents of the current cell / cell range are displayed struck through.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetStrikeout.js
*/
ApiRange.prototype.SetStrikeout = function (isStrikeout) {
this.range.setStrikeout(!!isStrikeout);
@@ -8938,6 +10194,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {boolean} isWrap - Specifies if the words in the cell will be wrapped to fit the cell size.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetWrap.js
*/
ApiRange.prototype.SetWrap = function (isWrap) {
this.range.setWrap(!!isWrap);
@@ -8948,6 +10205,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetWrapText.js
*/
ApiRange.prototype.GetWrapText = function () {
return this.range.getAlign().getWrap();
@@ -8967,6 +10225,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {ApiColor} oColor - The color object which specifies the color to be set to the background in the cell / cell range.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetFillColor.js
*/
ApiRange.prototype.SetFillColor = function (oColor) {
this.range.setFillColor('No Fill' === oColor ? null : oColor.color);
@@ -8976,6 +10235,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {ApiColor|'No Fill'} - return 'No Fill' when the color to the background in the cell / cell range is null.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetFillColor.js
*/
ApiRange.prototype.GetFillColor = function () {
var oColor = this.range.getFillColor();
@@ -8995,6 +10255,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {string | null} This property returns null if all cells in the specified range don't have the same number format.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetNumberFormat.js
*/
ApiRange.prototype.GetNumberFormat = function () {
var bbox = this.range.bbox;
@@ -9017,6 +10278,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {string} sFormat - Specifies the mask applied to the number in the cell.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetNumberFormat.js
*/
ApiRange.prototype.SetNumberFormat = function (sFormat) {
this.range.setNumFormat(sFormat);
@@ -9037,6 +10299,7 @@
* @param {BordersIndex} bordersIndex - Specifies the cell border position.
* @param {LineStyle} lineStyle - Specifies the line style used to form the cell border.
* @param {ApiColor} oColor - The color object which specifies the color to be set to the cell border.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetBorders.js
*/
ApiRange.prototype.SetBorders = function (bordersIndex, lineStyle, oColor) {
var borders = new AscCommonExcel.Border();
@@ -9078,6 +10341,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} isAcross - When set to true, the cells within the selected range will be merged along the rows,
* but remain split in the columns. When set to false, the whole selected range of cells will be merged into a single cell.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Merge.js
*/
ApiRange.prototype.Merge = function (isAcross) {
if (isAcross) {
@@ -9095,6 +10359,7 @@
* Splits the selected merged cell range into the single cells.
* @memberof ApiRange
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/UnMerge.js
*/
ApiRange.prototype.UnMerge = function () {
this.range.unmerge();
@@ -9124,6 +10389,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {Function} fCallback - A function which will be executed for each cell.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/ForEach.js
*/
ApiRange.prototype.ForEach = function (fCallback) {
if (fCallback instanceof Function) {
@@ -9141,6 +10407,7 @@
* @param {string} sText - The comment text.
* @param {string} sAuthor - The author's name (optional).
* @returns {ApiComment | null} - returns false if comment can't be added.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/AddComment.js
*/
ApiRange.prototype.AddComment = function (sText, sAuthor) {
let result = null;
@@ -9169,6 +10436,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {ApiWorksheet}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetWorksheet.js
*/
ApiRange.prototype.GetWorksheet = function () {
return new ApiWorksheet(this.range.worksheet);
@@ -9184,6 +10452,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {ApiName}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetDefName.js
*/
ApiRange.prototype.GetDefName = function () {
var defName = this.range.worksheet.getName() + "!" + this.range.bbox.getAbsName();
@@ -9205,6 +10474,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @returns {ApiComment | null} - returns null if range does not consist of one cell.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetComment.js
*/
ApiRange.prototype.GetComment = function () {
if (!this.range.isOneCell()) {
@@ -9225,6 +10495,7 @@
* Selects the current range.
* @memberof ApiRange
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Select.js
*/
ApiRange.prototype.Select = function () {
if (this.range.worksheet.getId() === this.range.worksheet.workbook.getActiveWs().getId()) {
@@ -9245,7 +10516,8 @@
* Returns the current range angle.
* @memberof ApiRange
* @typeofeditors ["CSE"]
- * @return {Angle}
+ * @returns {Angle}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetOrientation.js
*/
ApiRange.prototype.GetOrientation = function () {
return this.range.getAngle();
@@ -9256,6 +10528,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {Angle} angle - Specifies the range angle.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetOrientation.js
*/
ApiRange.prototype.SetOrientation = function (angle) {
switch (angle) {
@@ -9296,6 +10569,7 @@
* @param {SortOrder} sSortOrder3 - The sort order for the values specified in Key3.
* @param {SortHeader} sHeader - Specifies whether the first row contains header information.
* @param {SortOrientation} sOrientation - Specifies if the sort should be by row (default) or column.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/SetSort.js
*/
ApiRange.prototype.SetSort = function (key1, sSortOrder1, key2, /*Type,*/ sSortOrder2, key3, sSortOrder3, sHeader, /*OrderCustom, MatchCase,*/ sOrientation/*, SortMethod, DataOption1, DataOption2, DataOption3*/) {
var ws = this.range.worksheet;
@@ -9379,7 +10653,8 @@
* Deletes the Range object.
* @memberof ApiRange
* @typeofeditors ["CSE"]
- * @param {?string} shift - Specifies how to shift cells to replace the deleted cells ("up", "left").
+ * @param {?DeleteShiftDirection} shift - Specifies how to shift cells to replace the deleted cells.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Delete.js
*/
ApiRange.prototype.Delete = function (shift) {
let preDeleteAction = function() {
@@ -9389,7 +10664,7 @@
wsView._cleanCache(lockRange);
};
let val;
- let ws = this.Worksheet.worksheet;
+ let ws = this.GetWorksheet().worksheet;
let wsView = Asc['editor'].wb.getWorksheet(ws.getIndex());
let cellCommentator = wsView.cellCommentator;
let bbox = this.range.bbox;
@@ -9402,7 +10677,7 @@
let cols = bbox.c2 - bbox.c1 + 1;
shift = (rows <= cols) ? "up" : "left";
}
- if (shift == "up") {
+ if (shift === "up") {
val = Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop;
lockRange = ws.getRange3(bbox.r1, bbox.c1, bbox.r2, AscCommon.gc_nMaxCol0);
this.range.deleteCellsShiftUp(preDeleteAction);
@@ -9418,6 +10693,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {?string} shift - Specifies which way to shift the cells ("right", "down").
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Insert.js
*/
ApiRange.prototype.Insert = function (shift) {
if (shift && shift.toLocaleLowerCase) {
@@ -9440,6 +10716,7 @@
* @typeofeditors ["CSE"]
* @param {?bool} bRows - Specifies if the width of the columns will be autofit.
* @param {?bool} bCols - Specifies if the height of the rows will be autofit.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/AutoFit.js
*/
ApiRange.prototype.AutoFit = function (bRows, bCols) {
var index = this.range.worksheet.getIndex();
@@ -9454,7 +10731,8 @@
* Returns a collection of the ranges.
* @memberof ApiRange
* @typeofeditors ["CSE"]
- * @return {ApiAreas}
+ * @returns {ApiAreas}
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetAreas.js
*/
ApiRange.prototype.GetAreas = function () {
return new ApiAreas(this.areas || [this.range], this);
@@ -9466,10 +10744,11 @@
});
/**
- * Copies the range to the specified range or to the Clipboard.
+ * Copies the range to the specified range or to the clipboard.
* @memberof ApiRange
* @typeofeditors ["CSE"]
- * @param {ApiRange?} [destination] - Specifies the new range to which the specified range will be copied. If this argument is omitted, Onlyoffice copies the range to the Clipboard.
+ * @param {ApiRange?} [destination] - Specifies the new range to which the specified range will be copied. If this argument is omitted, the range will be copied to the clipboard.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Copy.js
*/
ApiRange.prototype.Copy = function (destination) {
var oApi = Asc["editor"];
@@ -9481,7 +10760,7 @@
let bbox = destination.range.bbox;
let range = destination.range.worksheet.getRange3(bbox.r1, bbox.c1, (bbox.r1 + rows), (bbox.c1 + cols));
this.range.move(range.bbox, true, destination.range.worksheet);
- AscCommon.g_clipboardBase && AscCommon.g_clipboardBase.ClearBuffer();
+ //AscCommon.g_clipboardBase && AscCommon.g_clipboardBase.ClearBuffer();
} else {
logError(new Error('Invalid destination'));
}
@@ -9495,10 +10774,12 @@
};
/**
- * Cuts the range to the specified range or to the Clipboard.
+ * Cuts the range and save it to the clipboard or paste it to the specified range.
* @memberof ApiRange
* @typeofeditors ["CSE"]
- * @param {ApiRange?} [destination] - Specifies the new range to which the specified range will be cuted. If this argument is omitted, Onlyoffice copies the range to the Clipboard.
+ * @param {ApiRange?} [destination] - Specifies the new range to which the cut range will be pasted. If this argument is omitted, the range will be copied to the clipboard.
+ * @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Cut.js
*/
ApiRange.prototype.Cut = function (destination) {
var oApi = Asc["editor"];
@@ -9510,7 +10791,7 @@
let bbox = destination.range.bbox;
let range = destination.range.worksheet.getRange3(bbox.r1, bbox.c1, (bbox.r1 + rows), (bbox.c1 + cols));
this.range.move(range.bbox, false, destination.range.worksheet);
- AscCommon.g_clipboardBase && AscCommon.g_clipboardBase.ClearBuffer();
+ //AscCommon.g_clipboardBase && AscCommon.g_clipboardBase.ClearBuffer();
} else {
logError(new Error('Invalid destination'));
}
@@ -9530,6 +10811,7 @@
* @memberof ApiRange
* @typeofeditors ["CSE"]
* @param {ApiRange} rangeFrom - Specifies the range to be pasted to the current range
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Paste.js
*/
ApiRange.prototype.Paste = function (rangeFrom) {
if (rangeFrom && rangeFrom instanceof ApiRange) {
@@ -9545,13 +10827,15 @@
};
/**
- * Pastes the Range object to the specified range.
+ * Pastes the Range object to the specified range using the special paste options.
* @memberof ApiRange
* @typeofeditors ["CSE"]
- * @param {PasteType} [sPasteType="xlPasteAll"] - Type of special paste
- * @param {PasteSpecialOperation} [sPasteSpecialOperation="xlPasteSpecialOperationNone"] - Operation of special paste
- * @param {boolean} bSkipBlanks [bSkipBlanks=false] - Case sensitive or not. The default value is "false".
- * @param {boolean} bTranspose [bTranspose=false] - Case sensitive or not. The default value is "false".
+ * @param {PasteType} [sPasteType="xlPasteAll"] - Paste option.
+ * @param {PasteSpecialOperation} [sPasteSpecialOperation="xlPasteSpecialOperationNone"] - The mathematical operation which will be applied to the copied data.
+ * @param {boolean} bSkipBlanks [bSkipBlanks=false] - Specifies whether to avoid replacing values in the paste area when blank cells occur in the copy area.
+ * @param {boolean} bTranspose [bTranspose=false] - Specifies whether the pasted data will be transposed from rows to columns.
+ * @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/PasteSpecial.js
*/
ApiRange.prototype.PasteSpecial = function (sPasteType, sPasteSpecialOperation, bSkipBlanks, bTranspose) {
if (sPasteType && typeof sPasteType !== 'string') {
@@ -9646,24 +10930,58 @@
});
};
+ /**
+ * Returns the ApiPivotTable object that represents the pivot table report containing the upper-left corner of the specified range.
+ * @memberof ApiRange
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotTable | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/Cell/ApiRange/Methods/GetPivotTable.js
+ */
+ ApiRange.prototype.GetPivotTable = function() {
+ var bbox = this.range.isOneCell() ? this.range.bbox : this.range.worksheet.getRange3(this.range.bbox.r1, this.range.bbox.c1, this.range.bbox.r1, this.range.bbox.c1).bbox;
+ var pivotTables = this.range.worksheet.pivotTables;
+ var foundTable = null;
+ for (var i = 0; i < pivotTables.length; i++) {
+ var table = pivotTables[i];
+ if (table.intersection(bbox)) {
+ foundTable = new ApiPivotTable(table, this.range.worksheet.workbook.oApi);
+ break;
+ }
+ }
+ return foundTable;
+ };
+
+ Object.defineProperty(ApiRange.prototype, "PivotTable", {
+ get: function () {
+ return this.GetPivotTable();
+ }
+ });
+
+
+
/**
* Search data type (formulas or values).
* @typedef {("xlFormulas" | "xlValues")} XlFindLookIn
+ * @see office-js-api/Examples/Enumerations/XlFindLookIn.js
*/
/**
* Specifies whether the whole search text or any part of the search text is matched.
* @typedef {("xlWhole" | "xlPart")} XlLookAt
+ * @see office-js-api/Examples/Enumerations/XlLookAt.js
*/
/**
* Range search order - by rows or by columns.
* @typedef {("xlByRows" | "xlByColumns")} XlSearchOrder
+ * @see office-js-api/Examples/Enumerations/XlSearchOrder.js
*/
/**
* Range search direction - next match or previous match.
* @typedef {("xlNext" | "xlPrevious")} XlSearchDirection
+ * @see office-js-api/Examples/Enumerations/XlSearchDirection.js
*/
/**
@@ -9676,6 +10994,7 @@
* @property {XlSearchOrder} SearchOrder - Range search order - by rows or by columns.
* @property {XlSearchDirection} SearchDirection - Range search direction - next match or previous match.
* @property {boolean} MatchCase - Case sensitive or not. The default value is "false".
+ * @see office-js-api/Examples/Enumerations/SearchData.js
*/
/**
@@ -9688,6 +11007,7 @@
* @property {XlSearchDirection} SearchDirection - Range search direction - next match or previous match.
* @property {boolean} MatchCase - Case sensitive or not. The default value is "false".
* @property {boolean} ReplaceAll - Specifies if all the found data will be replaced or not. The default value is "true".
+ * @see office-js-api/Examples/Enumerations/ReplaceData.js
*/
/**
@@ -9708,6 +11028,7 @@
* @param {XlSearchDirection} SearchDirection - Range search direction - next match or previous match.
* @param {boolean} MatchCase - Case sensitive or not. The default value is "false".
* @returns {ApiRange | null} - Returns null if the current range does not contain such text.
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Find.js
*/
ApiRange.prototype.Find = function (oSearchData) {
let What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase;
@@ -9774,6 +11095,7 @@
* @param {ApiRange} After - The cell after which the search will start. If this argument is not specified, the search starts from the last cell found.
* @returns {ApiRange | null} - Returns null if the range does not contain such text.
*
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/FindNext.js
*/
ApiRange.prototype.FindNext = function (After) {
if (this._searchOptions) {
@@ -9814,6 +11136,7 @@
* @param {ApiRange} Before - The cell before which the search will start. If this argument is not specified, the search starts from the last cell found.
* @returns {ApiRange | null} - Returns null if the range does not contain such text.
*
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/FindPrevious.js
*/
ApiRange.prototype.FindPrevious = function (Before) {
if (this._searchOptions) {
@@ -9864,6 +11187,7 @@
* @param {XlSearchDirection} SearchDirection - Range search direction - next match or previous match.
* @param {boolean} MatchCase - Case sensitive or not. The default value is "false".
* @param {boolean} ReplaceAll - Specifies if all the found data will be replaced or not. The default value is "true".
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/Replace.js
*/
ApiRange.prototype.Replace = function (oReplaceData) {
let What, Replacement, LookAt, SearchOrder, SearchDirection, MatchCase, ReplaceAll;
@@ -9930,8 +11254,9 @@
* @typeofeditors ["CSE"]
* @param {number} Start - The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
* @param {number} Length - The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).
- * @return {ApiCharacters}
+ * @returns {ApiCharacters}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiRange/Methods/GetCharacters.js
*/
ApiRange.prototype.GetCharacters = function (Start, Length) {
let options = {
@@ -9973,6 +11298,7 @@
* @memberof ApiDrawing
* @typeofeditors ["CSE"]
* @returns {"drawing"}
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/GetClassType.js
*/
ApiDrawing.prototype.GetClassType = function () {
return "drawing";
@@ -9984,6 +11310,7 @@
* @typeofeditors ["CSE"]
* @param {EMU} nWidth - The object width measured in English measure units.
* @param {EMU} nHeight - The object height measured in English measure units.
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/SetSize.js
*/
ApiDrawing.prototype.SetSize = function (nWidth, nHeight) {
var fWidth = nWidth / 36000.0;
@@ -10006,7 +11333,8 @@
* @param {EMU} nColOffset - The offset from the nFromCol column to the left part of the drawing object measured in English measure units.
* @param {number} nFromRow - The number of the row where the beginning of the drawing object will be placed.
* @param {EMU} nRowOffset - The offset from the nFromRow row to the upper part of the drawing object measured in English measure units.
- * */
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/SetPosition.js
+ */
ApiDrawing.prototype.SetPosition = function (nFromCol, nColOffset, nFromRow, nRowOffset) {
var extX = null, extY = null;
if (this.Drawing.drawingBase) {
@@ -10034,6 +11362,7 @@
* @memberof ApiDrawing
* @typeofeditors ["CDE", "CPE", "CSE"]
* @returns {EMU}
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/GetWidth.js
*/
ApiDrawing.prototype.GetWidth = function () {
return private_MM2EMU(this.Drawing.GetWidth());
@@ -10043,6 +11372,7 @@
* @memberof ApiDrawing
* @typeofeditors ["CDE", "CPE", "CSE"]
* @returns {EMU}
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/GetHeight.js
*/
ApiDrawing.prototype.GetHeight = function () {
return private_MM2EMU(this.Drawing.GetHeight());
@@ -10050,9 +11380,9 @@
/**
* Returns the lock value for the specified lock type of the current drawing.
* @typeofeditors ["CSE"]
- * @param {"noGrp" | "noUngrp" | "noSelect" | "noRot" | "noChangeAspect" | "noMove" | "noResize" | "noEditPoints" | "noAdjustHandles"
- * | "noChangeArrowheads" | "noChangeShapeType" | "noDrilldown" | "noTextEdit" | "noCrop" | "txBox"} sType - Lock type in the string format.
+ * @param {DrawingLockType} sType - Lock type in the string format.
* @returns {bool}
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/GetLockValue.js
*/
ApiDrawing.prototype.GetLockValue = function (sType) {
var nLockType = private_GetDrawingLockType(sType);
@@ -10069,10 +11399,10 @@
/**
* Sets the lock value to the specified lock type of the current drawing.
* @typeofeditors ["CSE"]
- * @param {"noGrp" | "noUngrp" | "noSelect" | "noRot" | "noChangeAspect" | "noMove" | "noResize" | "noEditPoints" | "noAdjustHandles"
- * | "noChangeArrowheads" | "noChangeShapeType" | "noDrilldown" | "noTextEdit" | "noCrop" | "txBox"} sType - Lock type in the string format.
+ * @param {DrawingLockType} sType - Lock type in the string format.
* @param {bool} bValue - Specifies if the specified lock is applied to the current drawing.
* @returns {bool}
+ * @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/SetLockValue.js
*/
ApiDrawing.prototype.SetLockValue = function (sType, bValue) {
var nLockType = private_GetDrawingLockType(sType);
@@ -10101,6 +11431,7 @@
* @memberof ApiImage
* @typeofeditors ["CDE", "CSE"]
* @returns {"image"}
+ * @see office-js-api/Examples/{Editor}/ApiImage/Methods/GetClassType.js
*/
ApiImage.prototype.GetClassType = function () {
return "image";
@@ -10117,6 +11448,7 @@
* @memberof ApiShape
* @typeofeditors ["CSE"]
* @returns {"shape"}
+ * @see office-js-api/Examples/{Editor}/ApiShape/Methods/GetClassType.js
*/
ApiShape.prototype.GetClassType = function () {
return "shape";
@@ -10127,6 +11459,7 @@
* @memberof ApiShape
* @typeofeditors ["CSE"]
* @returns {?ApiDocumentContent}
+ * @see office-js-api/Examples/{Editor}/ApiShape/Methods/GetContent.js
*/
ApiShape.prototype.GetContent = function () {
var oApi = Asc["editor"];
@@ -10141,6 +11474,7 @@
* @memberof ApiShape
* @typeofeditors ["CSE"]
* @returns {?ApiDocumentContent}
+ * @see office-js-api/Examples/{Editor}/ApiShape/Methods/GetDocContent.js
*/
ApiShape.prototype.GetDocContent = function () {
var oApi = Asc["editor"];
@@ -10156,6 +11490,7 @@
* @typeofeditors ["CSE"]
* @param {"top" | "center" | "bottom" } sVerticalAlign - The vertical alignment type for the shape inner contents.
* @returns {boolean} - returns false if shape or aligment doesn't exist.
+ * @see office-js-api/Examples/{Editor}/ApiShape/Methods/SetVerticalTextAlign.js
*/
ApiShape.prototype.SetVerticalTextAlign = function (sVerticalAlign) {
if (this.Shape) {
@@ -10187,281 +11522,32 @@
//
//------------------------------------------------------------------------------------------------------------------
- /**
- * Returns a type of the ApiChart class.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @returns {"chart"}
- */
- ApiChart.prototype.GetClassType = function () {
- return "chart";
- };
-
- /**
- * Specifies the chart title with the specified parameters.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {string} sTitle - The title which will be displayed for the current chart.
- * @param {pt} nFontSize - The text size value measured in points.
- * @param {?bool} bIsBold - Specifies if the chart title is written in bold font or not.
- */
- ApiChart.prototype.SetTitle = function (sTitle, nFontSize, bIsBold) {
- AscFormat.builder_SetChartTitle(this.Chart, sTitle, nFontSize, bIsBold);
- };
-
- /**
- * Specifies the chart horizontal axis title.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {string} sTitle - The title which will be displayed for the horizontal axis of the current chart.
- * @param {pt} nFontSize - The text size value measured in points.
- * @param {?bool} bIsBold - Specifies if the horizontal axis title is written in bold font or not.
- * */
- ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize, bIsBold) {
- AscFormat.builder_SetChartHorAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
- };
-
- /**
- * Specifies the chart vertical axis title.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {string} sTitle - The title which will be displayed for the vertical axis of the current chart.
- * @param {pt} nFontSize - The text size value measured in points.
- * @param {?bool} bIsBold - Specifies if the vertical axis title is written in bold font or not.
- * */
- ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize, bIsBold) {
- AscFormat.builder_SetChartVertAxisTitle(this.Chart, sTitle, nFontSize, bIsBold);
- };
-
-
- /**
- * Specifies the direction of the data displayed on the vertical axis.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {boolean} bIsMinMax - The true
value sets the normal data direction for the vertical axis (from minimum to maximum).
- * The false
value sets the inverted data direction for the vertical axis (from maximum to minimum).
- * */
- ApiChart.prototype.SetVerAxisOrientation = function (bIsMinMax) {
- AscFormat.builder_SetChartVertAxisOrientation(this.Chart, bIsMinMax);
- };
-
-
- /**
- * Specifies the major tick mark for the horizontal axis.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {TickMark} sTickMark - The type of tick mark appearance.
- * */
- ApiChart.prototype.SetHorAxisMajorTickMark = function (sTickMark) {
- AscFormat.builder_SetChartHorAxisMajorTickMark(this.Chart, sTickMark);
- };
-
- /**
- * Specifies the minor tick mark for the horizontal axis.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {TickMark} sTickMark - The type of tick mark appearance.
- * */
- ApiChart.prototype.SetHorAxisMinorTickMark = function (sTickMark) {
- AscFormat.builder_SetChartHorAxisMinorTickMark(this.Chart, sTickMark);
- };
-
- /**
- * Specifies the major tick mark for the vertical axis.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {TickMark} sTickMark - The type of tick mark appearance.
- * */
- ApiChart.prototype.SetVertAxisMajorTickMark = function (sTickMark) {
- AscFormat.builder_SetChartVerAxisMajorTickMark(this.Chart, sTickMark);
- };
-
- /**
- * Specifies the minor tick mark for the vertical axis.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {TickMark} sTickMark - The type of tick mark appearance.
- * */
- ApiChart.prototype.SetVertAxisMinorTickMark = function (sTickMark) {
- AscFormat.builder_SetChartVerAxisMinorTickMark(this.Chart, sTickMark);
- };
-
- /**
- * Specifies the direction of the data displayed on the horizontal axis.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {boolean} bIsMinMax - The true
value sets the normal data direction for the horizontal axis
- * (from minimum to maximum). The false
value sets the inverted data direction for the horizontal axis (from maximum to minimum).
- * */
- ApiChart.prototype.SetHorAxisOrientation = function (bIsMinMax) {
- AscFormat.builder_SetChartHorAxisOrientation(this.Chart, bIsMinMax);
- };
-
- /**
- * Specifies the chart legend position.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {"left" | "top" | "right" | "bottom" | "none"} sLegendPos - The position of the chart legend inside the chart window.
- * */
- ApiChart.prototype.SetLegendPos = function (sLegendPos) {
- if (sLegendPos === "left" || sLegendPos === "top" || sLegendPos === "right" || sLegendPos === "bottom" || sLegendPos === "none")
- AscFormat.builder_SetChartLegendPos(this.Chart, sLegendPos);
- else
- AscFormat.builder_SetChartLegendPos(this.Chart, "none");
- };
-
- /**
- * Specifies the legend font size.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {pt} nFontSize - The text size value measured in points.
- * */
- ApiChart.prototype.SetLegendFontSize = function (nFontSize) {
- AscFormat.builder_SetLegendFontSize(this.Chart, nFontSize);
- };
-
- /**
- * Specifies which chart data labels are shown for the chart.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {boolean} bShowSerName - Whether to show or hide the source table column names used for the data which the chart will be build from.
- * @param {boolean} bShowCatName - Whether to show or hide the source table row names used for the data which the chart will be build from.
- * @param {boolean} bShowVal - Whether to show or hide the chart data values.
- * @param {boolean} bShowPercent - Whether to show or hide the percent for the data values (works with stacked chart types).
- * */
- ApiChart.prototype.SetShowDataLabels = function (bShowSerName, bShowCatName, bShowVal, bShowPercent) {
- AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName, bShowCatName, bShowVal, bShowPercent);
- };
-
- /**
- * Spicifies the show options for the data labels.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {number} nSeriesIndex - The series index from the array of the data used to build the chart from.
- * @param {number} nPointIndex - The point index from this series.
- * @param {boolean} bShowSerName - Whether to show or hide the source table column names used for the data which the chart will be build from.
- * @param {boolean} bShowCatName - Whether to show or hide the source table row names used for the data which the chart will be build from.
- * @param {boolean} bShowVal - Whether to show or hide the chart data values.
- * @param {boolean} bShowPercent - Whether to show or hide the percent for the data values (works with stacked chart types).
- * */
- ApiChart.prototype.SetShowPointDataLabel = function (nSeriesIndex, nPointIndex, bShowSerName, bShowCatName, bShowVal, bShowPercent) {
- AscFormat.builder_SetShowPointDataLabel(this.Chart, nSeriesIndex, nPointIndex, bShowSerName, bShowCatName, bShowVal, bShowPercent);
- };
-
- /**
- * Sets the possible values for the position of the chart tick labels in relation to the main vertical label or the chart data values.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {TickLabelPosition} sTickLabelPosition - The type for the position of chart vertical tick labels.
- * */
- ApiChart.prototype.SetVertAxisTickLabelPosition = function (sTickLabelPosition) {
- AscFormat.builder_SetChartVertAxisTickLablePosition(this.Chart, sTickLabelPosition);
- };
- /**
- * Sets the possible values for the position of the chart tick labels in relation to the main horizontal label or the chart data values.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {TickLabelPosition} sTickLabelPosition - The type for the position of chart horizontal tick labels.
- * */
- ApiChart.prototype.SetHorAxisTickLabelPosition = function (sTickLabelPosition) {
- AscFormat.builder_SetChartHorAxisTickLablePosition(this.Chart, sTickLabelPosition);
- };
- /**
- * Specifies the visual properties of the major vertical gridline.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {?ApiStroke} oStroke - The stroke used to create the element shadow.
- * */
- ApiChart.prototype.SetMajorVerticalGridlines = function (oStroke) {
- AscFormat.builder_SetVerAxisMajorGridlines(this.Chart, oStroke ? oStroke.Ln : null);
- };
- /**
- * Specifies the visual properties of the minor vertical gridline.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {?ApiStroke} oStroke - The stroke used to create the element shadow.
- * */
- ApiChart.prototype.SetMinorVerticalGridlines = function (oStroke) {
- AscFormat.builder_SetVerAxisMinorGridlines(this.Chart, oStroke ? oStroke.Ln : null);
- };
- /**
- * Specifies the visual properties of the major horizontal gridline.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {?ApiStroke} oStroke - The stroke used to create the element shadow.
- * */
- ApiChart.prototype.SetMajorHorizontalGridlines = function (oStroke) {
- AscFormat.builder_SetHorAxisMajorGridlines(this.Chart, oStroke ? oStroke.Ln : null);
- };
- /**
- * Specifies the visual properties of the minor vertical gridline.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {?ApiStroke} oStroke - The stroke used to create the element shadow.
- */
- ApiChart.prototype.SetMinorHorizontalGridlines = function (oStroke) {
- AscFormat.builder_SetHorAxisMinorGridlines(this.Chart, oStroke ? oStroke.Ln : null);
- };
- /**
- * Specifies the font size to the horizontal axis labels.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {pt} nFontSize - The text size value measured in points.
- */
- ApiChart.prototype.SetHorAxisLablesFontSize = function (nFontSize) {
- AscFormat.builder_SetHorAxisFontSize(this.Chart, nFontSize);
- };
- /**
- * Specifies the font size to the vertical axis labels.
- * @memberof ApiChart
- * @typeofeditors ["CSE"]
- * @param {pt} nFontSize - The text size value measured in points.
- */
- ApiChart.prototype.SetVertAxisLablesFontSize = function (nFontSize) {
- AscFormat.builder_SetVerAxisFontSize(this.Chart, nFontSize);
- };
- /**
- * Sets a style to the current chart by style ID.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param nStyleId - One of the styles available in the editor.
- * @returns {boolean}
- */
- ApiChart.prototype.ApplyChartStyle = function (nStyleId) {
- if (typeof (nStyleId) !== "number" || nStyleId < 0)
- return false;
- var nChartType = this.Chart.getChartType();
- var aStyle = AscCommon.g_oChartStyles[nChartType] && AscCommon.g_oChartStyles[nChartType][nStyleId];
- if (aStyle) {
- this.Chart.applyChartStyleByIds(aStyle);
- return true;
- }
- return false;
- };
+ let ApiChart = AscBuilder.ApiChart;
/**
* Sets values from the specified range to the specified series.
* @memberof ApiChart
* @typeofeditors ["CSE"]
* @param {string} sRange - A range of cells from the sheet with series values. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column,
- * * "Example series".
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column,
+ * "Example series".
* @param {number} nSeria - The index of the chart series.
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetSeriaValues.js
*/
ApiChart.prototype.SetSeriaValues = function (sRange, nSeria) {
return this.Chart.SetSeriaValues(sRange, nSeria);
@@ -10472,11 +11558,12 @@
* @memberof ApiChart
* @typeofeditors ["CSE"]
* @param {string} sRange - A range of cells from the sheet with series x-axis values. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column,
- * * "Example series".
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column,
+ * "Example series".
* @param {number} nSeria - The index of the chart series.
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetSeriaXValues.js
*/
ApiChart.prototype.SetSeriaXValues = function (sRange, nSeria) {
return this.Chart.SetSeriaXValues(sRange, nSeria);
@@ -10487,11 +11574,12 @@
* @memberof ApiChart
* @typeofeditors ["CSE"]
* @param {string} sNameRange - The series name. Can be a range of cells or usual text. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column,
- * * "Example series".
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column,
+ * "Example series".
* @param {number} nSeria - The index of the chart series.
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetSeriaName.js
*/
ApiChart.prototype.SetSeriaName = function (sNameRange, nSeria) {
return this.Chart.SetSeriaName(sNameRange, nSeria);
@@ -10502,8 +11590,9 @@
* @memberof ApiChart
* @typeofeditors ["CSE"]
* @param {string} sRange - A range of cells from the sheet with the category names. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column.
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column.
+ * @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetCatFormula.js
*/
ApiChart.prototype.SetCatFormula = function (sRange) {
return this.Chart.SetCatFormula(sRange);
@@ -10514,15 +11603,16 @@
* @memberof ApiChart
* @typeofeditors ["CSE"]
* @param {string} sNameRange - The series name. Can be a range of cells or usual text. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column,
- * * "Example series".
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column,
+ * "Example series".
* @param {string} sValuesRange - A range of cells from the sheet with series values. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column.
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column.
* @param {string} [sXValuesRange=undefined] - A range of cells from the sheet with series x-axis values. It is used with the scatter charts only. For example:
- * * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
- * * "A1:A5" - must be a single cell, row or column.
+ * "'sheet 1'!$A$2:$A$5" - must be a single cell, row or column,
+ * "A1:A5" - must be a single cell, row or column.
+ * @see office-js-api/Examples/{Editor}/ApiChart/Methods/AddSeria.js
*/
ApiChart.prototype.AddSeria = function (sNameRange, sValuesRange, sXValuesRange) {
if (this.Chart.isScatterChartType() && typeof (sXValuesRange) === "string" && sXValuesRange !== "") {
@@ -10531,303 +11621,86 @@
this.Chart.addSeries(sNameRange, sValuesRange);
};
- /**
- * Removes the specified series from the current chart.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {number} nSeria - The index of the chart series.
- * @returns {boolean}
- */
- ApiChart.prototype.RemoveSeria = function (nSeria) {
- return this.Chart.RemoveSeria(nSeria);
- };
+
+
+
+
+
+ //------------------------------------------------------------------------------------------------------------------
+ //
+ // ApiOleObject
+ //
+ //------------------------------------------------------------------------------------------------------------------
/**
- * Sets the fill to the chart plot area.
- * @memberof ApiChart
+ * Returns a type of the ApiOleObject class.
+ * @memberof ApiOleObject
* @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiFill} oFill - The fill type used to fill the plot area.
- * @returns {boolean}
+ * @returns {"oleObject"}
+ * @see office-js-api/Examples/{Editor}/ApiOleObject/Methods/GetClassType.js
*/
- ApiChart.prototype.SetPlotAreaFill = function (oFill) {
- if (!oFill || !oFill.GetClassType || oFill.GetClassType() !== "fill")
- return false;
-
- this.Chart.SetPlotAreaFill(oFill.UniFill);
- return true;
+ ApiOleObject.prototype.GetClassType = function () {
+ return "oleObject";
};
/**
- * Sets the outline to the chart plot area.
- * @memberof ApiChart
+ * Sets the data to the current OLE object.
+ * @memberof ApiOleObject
* @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiStroke} oStroke - The stroke used to create the plot area outline.
+ * @param {string} sData - The OLE object string data.
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiOleObject/Methods/SetData.js
*/
- ApiChart.prototype.SetPlotAreaOutLine = function (oStroke) {
- if (!oStroke || !oStroke.GetClassType || oStroke.GetClassType() !== "stroke")
+ ApiOleObject.prototype.SetData = function (sData) {
+ if (typeof (sData) !== "string" || sData === "")
return false;
- this.Chart.SetPlotAreaOutLine(oStroke.Ln);
+ this.Drawing.setData(sData);
return true;
};
/**
- * Sets the fill to the specified chart series.
- * @memberof ApiChart
+ * Returns the string data from the current OLE object.
+ * @memberof ApiOleObject
* @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiFill} oFill - The fill type used to fill the series.
- * @param {number} nSeries - The index of the chart series.
- * @param {boolean} [bAll=false] - Specifies if the fill will be applied to all series.
- * @returns {boolean}
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiOleObject/Methods/GetData.js
*/
- ApiChart.prototype.SetSeriesFill = function (oFill, nSeries, bAll) {
- if (!oFill || !oFill.GetClassType || oFill.GetClassType() !== "fill")
- return false;
+ ApiOleObject.prototype.GetData = function () {
+ if (typeof (this.Drawing.m_sData) === "string")
+ return this.Drawing.m_sData;
- return this.Chart.SetSeriesFill(oFill.UniFill, nSeries, bAll);
+ return "";
};
/**
- * Sets the outline to the specified chart series.
- * @memberof ApiChart
+ * Sets the application ID to the current OLE object.
+ * @memberof ApiOleObject
* @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiStroke} oStroke - The stroke used to create the series outline.
- * @param {number} nSeries - The index of the chart series.
- * @param {boolean} [bAll=false] - Specifies if the outline will be applied to all series.
+ * @param {string} sAppId - The application ID associated with the current OLE object.
* @returns {boolean}
+ * @see office-js-api/Examples/{Editor}/ApiOleObject/Methods/SetApplicationId.js
*/
- ApiChart.prototype.SetSeriesOutLine = function (oStroke, nSeries, bAll) {
- if (!oStroke || !oStroke.GetClassType || oStroke.GetClassType() !== "stroke")
+ ApiOleObject.prototype.SetApplicationId = function (sAppId) {
+ if (typeof (sAppId) !== "string" || sAppId === "")
return false;
- return this.Chart.SetSeriesOutLine(oStroke.Ln, nSeries, bAll);
+ this.Drawing.setApplicationId(sAppId);
+ return true;
};
/**
- * Sets the fill to the data point in the specified chart series.
- * @memberof ApiChart
+ * Returns the application ID from the current OLE object.
+ * @memberof ApiOleObject
* @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiFill} oFill - The fill type used to fill the data point.
- * @param {number} nSeries - The index of the chart series.
- * @param {number} nDataPoint - The index of the data point in the specified chart series.
- * @param {boolean} [bAllSeries=false] - Specifies if the fill will be applied to the specified data point in all series.
- * @returns {boolean}
+ * @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiOleObject/Methods/GetApplicationId.js
*/
- ApiChart.prototype.SetDataPointFill = function (oFill, nSeries, nDataPoint, bAllSeries) {
- if (!oFill || !oFill.GetClassType || oFill.GetClassType() !== "fill")
- return false;
+ ApiOleObject.prototype.GetApplicationId = function () {
+ if (typeof (this.Drawing.m_sApplicationId) === "string")
+ return this.Drawing.m_sApplicationId;
- return this.Chart.SetDataPointFill(oFill.UniFill, nSeries, nDataPoint, bAllSeries);
- };
-
- /**
- * Sets the outline to the data point in the specified chart series.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiStroke} oStroke - The stroke used to create the data point outline.
- * @param {number} nSeries - The index of the chart series.
- * @param {number} nDataPoint - The index of the data point in the specified chart series.
- * @param {boolean} bAllSeries - Specifies if the outline will be applied to the specified data point in all series.
- * @returns {boolean}
- */
- ApiChart.prototype.SetDataPointOutLine = function (oStroke, nSeries, nDataPoint, bAllSeries) {
- if (!oStroke || !oStroke.GetClassType || oStroke.GetClassType() !== "stroke")
- return false;
-
- return this.Chart.SetDataPointOutLine(oStroke.Ln, nSeries, nDataPoint, bAllSeries);
- };
-
- /**
- * Sets the fill to the marker in the specified chart series.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiFill} oFill - The fill type used to fill the marker.
- * @param {number} nSeries - The index of the chart series.
- * @param {number} nMarker - The index of the marker in the specified chart series.
- * @param {boolean} [bAllMarkers=false] - Specifies if the fill will be applied to all markers in the specified chart series.
- * @returns {boolean}
- */
- ApiChart.prototype.SetMarkerFill = function (oFill, nSeries, nMarker, bAllMarkers) {
- if (!oFill || !oFill.GetClassType || oFill.GetClassType() !== "fill")
- return false;
-
- return this.Chart.SetMarkerFill(oFill.UniFill, nSeries, nMarker, bAllMarkers);
- };
-
- /**
- * Sets the outline to the marker in the specified chart series.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiStroke} oStroke - The stroke used to create the marker outline.
- * @param {number} nSeries - The index of the chart series.
- * @param {number} nMarker - The index of the marker in the specified chart series.
- * @param {boolean} [bAllMarkers=false] - Specifies if the outline will be applied to all markers in the specified chart series.
- * @returns {boolean}
- */
- ApiChart.prototype.SetMarkerOutLine = function (oStroke, nSeries, nMarker, bAllMarkers) {
- if (!oStroke || !oStroke.GetClassType || oStroke.GetClassType() !== "stroke")
- return false;
-
- return this.Chart.SetMarkerOutLine(oStroke.Ln, nSeries, nMarker, bAllMarkers);
- };
-
- /**
- * Sets the fill to the chart title.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiFill} oFill - The fill type used to fill the title.
- * @returns {boolean}
- */
- ApiChart.prototype.SetTitleFill = function (oFill) {
- if (!oFill || !oFill.GetClassType || oFill.GetClassType() !== "fill")
- return false;
-
- return this.Chart.SetTitleFill(oFill.UniFill);
- };
-
- /**
- * Sets the outline to the chart title.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiStroke} oStroke - The stroke used to create the title outline.
- * @returns {boolean}
- */
- ApiChart.prototype.SetTitleOutLine = function (oStroke) {
- if (!oStroke || !oStroke.GetClassType || oStroke.GetClassType() !== "stroke")
- return false;
-
- return this.Chart.SetTitleOutLine(oStroke.Ln);
- };
-
- /**
- * Sets the fill to the chart legend.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiFill} oFill - The fill type used to fill the legend.
- * @returns {boolean}
- */
- ApiChart.prototype.SetLegendFill = function (oFill) {
- if (!oFill || !oFill.GetClassType || oFill.GetClassType() !== "fill")
- return false;
-
- return this.Chart.SetLegendFill(oFill.UniFill);
- };
-
- /**
- * Sets the outline to the chart legend.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {ApiStroke} oStroke - The stroke used to create the legend outline.
- * @returns {boolean}
- */
- ApiChart.prototype.SetLegendOutLine = function (oStroke) {
- if (!oStroke || !oStroke.GetClassType || oStroke.GetClassType() !== "stroke")
- return false;
-
- return this.Chart.SetLegendOutLine(oStroke.Ln);
- };
-
- /**
- * Sets the specified numeric format to the axis values.
- * @memberof ApiChart
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {NumFormat | String} sFormat - Numeric format (can be custom format).
- * @param {AxisPos} - Axis position.
- * @returns {boolean}
- */
- ApiChart.prototype.SetAxieNumFormat = function (sFormat, sAxiePos) {
- var nAxiePos = -1;
- switch (sAxiePos) {
- case "bottom":
- nAxiePos = AscFormat.AX_POS_B;
- break;
- case "left":
- nAxiePos = AscFormat.AX_POS_L;
- break;
- case "right":
- nAxiePos = AscFormat.AX_POS_R;
- break;
- case "top":
- nAxiePos = AscFormat.AX_POS_T;
- break;
- default:
- return false;
- }
-
- return this.Chart.SetAxieNumFormat(sFormat, nAxiePos);
- };
-
- //------------------------------------------------------------------------------------------------------------------
- //
- // ApiOleObject
- //
- //------------------------------------------------------------------------------------------------------------------
-
- /**
- * Returns a type of the ApiOleObject class.
- * @memberof ApiOleObject
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @returns {"oleObject"}
- */
- ApiOleObject.prototype.GetClassType = function () {
- return "oleObject";
- };
-
- /**
- * Sets the data to the current OLE object.
- * @memberof ApiOleObject
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {string} sData - The OLE object string data.
- * @returns {boolean}
- */
- ApiOleObject.prototype.SetData = function (sData) {
- if (typeof (sData) !== "string" || sData === "")
- return false;
-
- this.Drawing.setData(sData);
- return true;
- };
-
- /**
- * Returns the string data from the current OLE object.
- * @memberof ApiOleObject
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @returns {string}
- */
- ApiOleObject.prototype.GetData = function () {
- if (typeof (this.Drawing.m_sData) === "string")
- return this.Drawing.m_sData;
-
- return "";
- };
-
- /**
- * Sets the application ID to the current OLE object.
- * @memberof ApiOleObject
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @param {string} sAppId - The application ID associated with the current OLE object.
- * @returns {boolean}
- */
- ApiOleObject.prototype.SetApplicationId = function (sAppId) {
- if (typeof (sAppId) !== "string" || sAppId === "")
- return false;
-
- this.Drawing.setApplicationId(sAppId);
- return true;
- };
-
- /**
- * Returns the application ID from the current OLE object.
- * @memberof ApiOleObject
- * @typeofeditors ["CDE", "CPE", "CSE"]
- * @returns {string}
- */
- ApiOleObject.prototype.GetApplicationId = function () {
- if (typeof (this.Drawing.m_sApplicationId) === "string")
- return this.Drawing.m_sApplicationId;
-
- return "";
+ return "";
};
//------------------------------------------------------------------------------------------------------------------
@@ -10841,6 +11714,7 @@
* @memberof ApiColor
* @typeofeditors ["CSE"]
* @returns {"color"}
+ * @see office-js-api/Examples/{Editor}/ApiColor/Methods/GetClassType.js
*/
ApiColor.prototype.GetClassType = function () {
return "color";
@@ -10857,6 +11731,7 @@
* @memberof ApiName
* @typeofeditors ["CSE"]
* @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiName/Methods/GetName.js
*/
ApiName.prototype.GetName = function () {
if (this.DefName) {
@@ -10872,6 +11747,7 @@
* @typeofeditors ["CSE"]
* @param {string} sName - New name for the range.
* @returns {boolean} - returns false if sName is invalid.
+ * @see office-js-api/Examples/{Editor}/ApiName/Methods/SetName.js
*/
ApiName.prototype.SetName = function (sName) {
if (!sName || typeof sName !== 'string' || !this.DefName) {
@@ -10904,6 +11780,7 @@
* Deletes the DefName object.
* @memberof ApiName
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiName/Methods/Delete.js
*/
ApiName.prototype.Delete = function () {
this.DefName.wb.delDefinesNames(this.DefName.getAscCDefName(false));
@@ -10915,6 +11792,7 @@
* @typeofeditors ["CSE"]
* @param {string} sRef - The range reference which must contain the sheet name, followed by sign ! and a range of cells.
* Example: "Sheet1!$A$1:$B$2".
+ * @see office-js-api/Examples/{Editor}/ApiName/Methods/SetRefersTo.js
*/
ApiName.prototype.SetRefersTo = function (sRef) {
this.DefName.setRef(sRef);
@@ -10925,6 +11803,7 @@
* @memberof ApiName
* @typeofeditors ["CSE"]
* @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiName/Methods/GetRefersTo.js
*/
ApiName.prototype.GetRefersTo = function () {
return (this.DefName) ? this.DefName.ref : this.DefName;
@@ -10944,6 +11823,7 @@
* @memberof ApiName
* @typeofeditors ["CSE"]
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiName/Methods/GetRefersToRange.js
*/
ApiName.prototype.GetRefersToRange = function () {
var range;
@@ -10970,6 +11850,7 @@
* @memberof ApiComment
* @typeofeditors ["CSE"]
* @returns {"comment"}
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetClassType.js
*/
ApiComment.prototype.GetClassType = function () {
return "comment";
@@ -10980,6 +11861,7 @@
* @memberof ApiComment
* @typeofeditors ["CSE"]
* @returns {string}
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetText.js
*/
ApiComment.prototype.GetText = function () {
return this.Comment.asc_getText();
@@ -10991,6 +11873,7 @@
* @typeofeditors ["CSE"]
* @param {string} text - New text for comment.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/SetText.js
*/
ApiComment.prototype.SetText = function (text) {
if (typeof text === 'string' && text.trim() !== '') {
@@ -11014,6 +11897,7 @@
* @typeofeditors ["CSE"]
* @returns {string}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetId.js
*/
ApiComment.prototype.GetId = function () {
return this.Comment.asc_getId();
@@ -11031,6 +11915,7 @@
* @typeofeditors ["CSE"]
* @returns {string}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetAuthorName.js
*/
ApiComment.prototype.GetAuthorName = function () {
return this.Comment.asc_getUserName();
@@ -11042,6 +11927,7 @@
* @typeofeditors ["CSE"]
* @param {string} sAuthorName - The comment author's name.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/SetAuthorName.js
*/
ApiComment.prototype.SetAuthorName = function (sAuthorName) {
this.Comment.asc_putUserName(sAuthorName);
@@ -11063,6 +11949,7 @@
* @typeofeditors ["CSE"]
* @returns {string}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetUserId.js
*/
ApiComment.prototype.GetUserId = function () {
return this.Comment.asc_getUserId();
@@ -11074,6 +11961,7 @@
* @typeofeditors ["CSE"]
* @param {string} sUserId - The user ID of the comment author.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/SetUserId.js
*/
ApiComment.prototype.SetUserId = function (sUserId) {
this.Comment.asc_putUserId(sUserId);
@@ -11095,6 +11983,7 @@
* @typeofeditors ["CSE"]
* @returns {boolean}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/IsSolved.js
*/
ApiComment.prototype.IsSolved = function () {
return this.Comment.getSolved();
@@ -11106,6 +11995,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} bSolved - Specifies if a comment is solved or not.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/SetSolved.js
*/
ApiComment.prototype.SetSolved = function (bSolved) {
this.Comment.setSolved(bSolved);
@@ -11127,6 +12017,7 @@
* @typeofeditors ["CSE"]
* @returns {Number}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetTimeUTC.js
*/
ApiComment.prototype.GetTimeUTC = function () {
let nTime = parseInt(this.Comment.asc_getOnlyOfficeTime());
@@ -11141,6 +12032,7 @@
* @typeofeditors ["CSE"]
* @param {Number | String} nTimeStamp - The timestamp of the comment creation in UTC format.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/SetTimeUTC.js
*/
ApiComment.prototype.SetTimeUTC = function (timeStamp) {
let nTime = parseInt(timeStamp);
@@ -11167,6 +12059,7 @@
* @typeofeditors ["CSE"]
* @returns {Number}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetTime.js
*/
ApiComment.prototype.GetTime = function () {
let nTime = parseInt(this.Comment.asc_getTime());
@@ -11181,6 +12074,7 @@
* @typeofeditors ["CSE"]
* @param {Number | String} nTimeStamp - The timestamp of the comment creation in the current time zone format.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/SetTime.js
*/
ApiComment.prototype.SetTime = function (timeStamp) {
let nTime = parseInt(timeStamp);
@@ -11207,6 +12101,7 @@
* @typeofeditors ["CSE"]
* @returns {String | null}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetQuoteText.js
*/
ApiComment.prototype.GetQuoteText = function () {
let text = null;
@@ -11229,6 +12124,7 @@
* @typeofeditors ["CSE"]
* @returns {Number?}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetRepliesCount.js
*/
ApiComment.prototype.GetRepliesCount = function () {
return this.Comment.asc_getRepliesCount()
@@ -11247,6 +12143,7 @@
* @param {Number} [nIndex = 0] - The comment reply index.
* @returns {ApiCommentReply?}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/GetReply.js
*/
ApiComment.prototype.GetReply = function (nIndex) {
if (typeof (nIndex) != "number" || nIndex < 0 || nIndex >= this.GetRepliesCount())
@@ -11268,6 +12165,7 @@
* @param {String} sUserId - The user ID of the comment reply author (optional).
* @param {Number} [nPos=this.GetRepliesCount()] - The comment reply position.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/AddReply.js
*/
ApiComment.prototype.AddReply = function (sText, sAuthorName, sUserId, nPos) {
if (typeof (sText) !== "string" || sText.trim() === "")
@@ -11297,6 +12195,7 @@
* @param {Number} [nCount = 1] - A number of comment replies to remove.
* @param {boolean} [bRemoveAll = false] - Specifies whether to remove all comment replies or not.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/RemoveReplies.js
*/
ApiComment.prototype.RemoveReplies = function (nPos, nCount, bRemoveAll) {
if (typeof (nPos) !== "number" || nPos < 0 || nPos > this.GetRepliesCount())
@@ -11321,6 +12220,7 @@
* Deletes the ApiComment object.
* @memberof ApiComment
* @typeofeditors ["CSE"]
+ * @see office-js-api/Examples/{Editor}/ApiComment/Methods/Delete.js
*/
ApiComment.prototype.Delete = function () {
this.WB.Api.asc_removeComment(this.Comment.asc_getId());
@@ -11343,6 +12243,7 @@
* @typeofeditors ["CSE"]
* @returns {"commentReply"}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/GetClassType.js
*/
ApiCommentReply.prototype.GetClassType = function () {
return "commentReply";
@@ -11354,6 +12255,7 @@
* @typeofeditors ["CSE"]
* @returns {string}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/GetText.js
*/
ApiCommentReply.prototype.GetText = function () {
return this.Data.asc_getText();
@@ -11365,6 +12267,7 @@
* @typeofeditors ["CSE"]
* @param {string} sText - The comment reply text.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/SetText.js
*/
ApiCommentReply.prototype.SetText = function (sText) {
this.Data.asc_putText(sText);
@@ -11386,6 +12289,7 @@
* @typeofeditors ["CSE"]
* @returns {string}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/GetAuthorName.js
*/
ApiCommentReply.prototype.GetAuthorName = function () {
return this.Data.asc_getUserName();
@@ -11397,6 +12301,7 @@
* @typeofeditors ["CSE"]
* @param {string} sAuthorName - The comment reply author's name.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/SetAuthorName.js
*/
ApiCommentReply.prototype.SetAuthorName = function (sAuthorName) {
this.Data.asc_putUserName(sAuthorName);
@@ -11418,6 +12323,7 @@
* @typeofeditors ["CSE"]
* @returns {string}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/GetUserId.js
*/
ApiCommentReply.prototype.GetUserId = function () {
return this.Data.asc_getUserId();
@@ -11429,6 +12335,7 @@
* @typeofeditors ["CSE"]
* @param {string} sUserId - The user ID of the comment reply author.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/SetUserId.js
*/
ApiCommentReply.prototype.SetUserId = function (sUserId) {
this.Data.asc_putUserId(sUserId);
@@ -11450,6 +12357,7 @@
* @typeofeditors ["CSE"]
* @returns {Number}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/GetTimeUTC.js
*/
ApiCommentReply.prototype.GetTimeUTC = function () {
let nTime = parseInt(this.Data.asc_getOnlyOfficeTime());
@@ -11464,6 +12372,7 @@
* @typeofeditors ["CSE"]
* @param {Number | String} nTimeStamp - The timestamp of the comment reply creation in UTC format.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/SetTimeUTC.js
*/
ApiCommentReply.prototype.SetTimeUTC = function (timeStamp) {
let nTime = parseInt(timeStamp);
@@ -11490,6 +12399,7 @@
* @typeofeditors ["CSE"]
* @returns {Number}
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/GetTime.js
*/
ApiCommentReply.prototype.GetTime = function () {
let nTime = parseInt(this.Data.asc_getTime());
@@ -11504,6 +12414,7 @@
* @typeofeditors ["CSE"]
* @param {Number | String} nTimeStamp - The timestamp of the comment reply creation in the current time zone format.
* @since 7.5.0
+ * @see office-js-api/Examples/{Editor}/ApiCommentReply/Methods/SetTime.js
*/
ApiCommentReply.prototype.SetTime = function (timeStamp) {
let nTime = parseInt(timeStamp);
@@ -11539,6 +12450,7 @@
* @memberof ApiAreas
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiAreas/Methods/GetCount.js
*/
ApiAreas.prototype.GetCount = function () {
return this.Items.length;
@@ -11556,6 +12468,7 @@
* @typeofeditors ["CSE"]
* @param {number} ind - The index number of the object.
* @returns {ApiRange}
+ * @see office-js-api/Examples/{Editor}/ApiAreas/Methods/GetItem.js
*/
ApiAreas.prototype.GetItem = function (ind) {
return this.Items[ind - 1] || null;
@@ -11566,6 +12479,7 @@
* @memberof ApiAreas
* @typeofeditors ["CSE"]
* @returns {number}
+ * @see office-js-api/Examples/{Editor}/ApiAreas/Methods/GetParent.js
*/
ApiAreas.prototype.GetParent = function () {
return this._parent;
@@ -11589,6 +12503,7 @@
* @typeofeditors ["CSE"]
* @returns {number}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/GetCount.js
*/
ApiCharacters.prototype.GetCount = function () {
return this._options.length < 0 ? 0 : this._options.length;
@@ -11606,6 +12521,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiRange}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/GetParent.js
*/
ApiCharacters.prototype.GetParent = function () {
return this._parent;
@@ -11622,6 +12538,7 @@
* @memberof ApiCharacters
* @typeofeditors ["CSE"]
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/Delete.js
*/
ApiCharacters.prototype.Delete = function () {
if (this._options.start <= this._options.len) {
@@ -11659,6 +12576,7 @@
* @typeofeditors ["CSE"]
* @param {string} String - The string to insert.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/Insert.js
*/
ApiCharacters.prototype.Insert = function (String) {
this.Delete();
@@ -11721,6 +12639,7 @@
* @typeofeditors ["CSE"]
* @param {string} Caption - A string value that represents the text of the specified range of characters.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/SetCaption.js
*/
ApiCharacters.prototype.SetCaption = function (Caption) {
this.Insert(Caption);
@@ -11732,6 +12651,7 @@
* @typeofeditors ["CSE"]
* @returns {string} - A string value that represents the text of the specified range of characters.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/GetCaption.js
*/
ApiCharacters.prototype.GetCaption = function () {
let value = this._parent.range.getValue();
@@ -11756,6 +12676,7 @@
* @typeofeditors ["CSE"]
* @param {string} Text - The text to be set.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/SetText.js
*/
ApiCharacters.prototype.SetText = function (Text) {
this.Insert(Text)
@@ -11767,6 +12688,7 @@
* @typeofeditors ["CSE"]
* @returns {string} - The text of the specified range of characters.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/GetText.js
*/
ApiCharacters.prototype.GetText = function () {
return this.GetCaption();
@@ -11787,6 +12709,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiFont}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiCharacters/Methods/GetFont.js
*/
ApiCharacters.prototype.GetFont = function () {
return new ApiFont(this);
@@ -11811,6 +12734,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiCharacters} - The parent ApiCharacters object.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetParent.js
*/
ApiFont.prototype.GetParent = function () {
return this._object;
@@ -11828,6 +12752,7 @@
* @typeofeditors ["CSE"]
* @returns {boolean | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetBold.js
*/
ApiFont.prototype.GetBold = function () {
if (this._object instanceof ApiCharacters) {
@@ -11861,6 +12786,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} isBold - Specifies that the text characters are displayed bold.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetBold.js
*/
ApiFont.prototype.SetBold = function (isBold) {
if (typeof isBold !== 'boolean') {
@@ -11909,6 +12835,7 @@
* @typeofeditors ["CSE"]
* @returns {boolean | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetItalic.js
*/
ApiFont.prototype.GetItalic = function () {
if (this._object instanceof ApiCharacters) {
@@ -11942,6 +12869,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} isItalic - Specifies that the text characters are displayed italic.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetItalic.js
*/
ApiFont.prototype.SetItalic = function (isItalic) {
if (typeof isItalic !== 'boolean') {
@@ -11990,6 +12918,7 @@
* @typeofeditors ["CSE"]
* @returns {number | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetSize.js
*/
ApiFont.prototype.GetSize = function () {
if (this._object instanceof ApiCharacters) {
@@ -12023,6 +12952,7 @@
* @typeofeditors ["CSE"]
* @param {number} Size - Font size.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetSize.js
*/
ApiFont.prototype.SetSize = function (Size) {
if (typeof Size !== 'number' || Size < 0 || Size > 409) {
@@ -12071,6 +13001,7 @@
* @typeofeditors ["CSE"]
* @returns {boolean | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetStrikethrough.js
*/
ApiFont.prototype.GetStrikethrough = function () {
if (this._object instanceof ApiCharacters) {
@@ -12104,6 +13035,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} isStrikethrough - Specifies that the text characters are displayed strikethrough.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetStrikethrough.js
*/
ApiFont.prototype.SetStrikethrough = function (isStrikethrough) {
if (typeof isStrikethrough !== 'boolean') {
@@ -12149,6 +13081,7 @@
/**
* Underline type.
* @typedef {("xlUnderlineStyleDouble" | "xlUnderlineStyleDoubleAccounting" | "xlUnderlineStyleNone" | "xlUnderlineStyleSingle" | "xlUnderlineStyleSingleAccounting")} XlUnderlineStyle
+ * @see office-js-api/Examples/Enumerations/XlUnderlineStyle.js
*/
/**
@@ -12157,6 +13090,7 @@
* @typeofeditors ["CSE"]
* @returns {XlUnderlineStyle | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetUnderline.js
*/
ApiFont.prototype.GetUnderline = function () {
if (this._object instanceof ApiCharacters) {
@@ -12216,6 +13150,7 @@
* @typeofeditors ["CSE"]
* @param {XlUnderlineStyle} Underline - Underline type.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetUnderline.js
*/
ApiFont.prototype.SetUnderline = function (Underline) {
if (typeof Underline !== 'string') {
@@ -12289,6 +13224,7 @@
* @typeofeditors ["CSE"]
* @returns {boolean | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetSubscript.js
*/
ApiFont.prototype.GetSubscript = function () {
if (this._object instanceof ApiCharacters) {
@@ -12322,6 +13258,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} isSubscript - Specifies that the text characters are displayed subscript.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetSubscript.js
*/
ApiFont.prototype.SetSubscript = function (isSubscript) {
if (typeof isSubscript !== 'boolean') {
@@ -12370,6 +13307,7 @@
* @typeofeditors ["CSE"]
* @returns {boolean | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetSuperscript.js
*/
ApiFont.prototype.GetSuperscript = function () {
if (this._object instanceof ApiCharacters) {
@@ -12403,6 +13341,7 @@
* @typeofeditors ["CSE"]
* @param {boolean} isSuperscript - Specifies that the text characters are displayed superscript.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetSuperscript.js
*/
ApiFont.prototype.SetSuperscript = function (isSuperscript) {
if (typeof isSuperscript !== 'boolean') {
@@ -12451,6 +13390,7 @@
* @typeofeditors ["CSE"]
* @returns {string | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetName.js
*/
ApiFont.prototype.GetName = function () {
if (this._object instanceof ApiCharacters) {
@@ -12484,6 +13424,7 @@
* @typeofeditors ["CSE"]
* @param {string} FontName - Font name.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetName.js
*/
ApiFont.prototype.SetName = function (FontName) {
if (typeof FontName !== 'string') {
@@ -12533,6 +13474,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiColor | null}
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/GetColor.js
*/
ApiFont.prototype.GetColor = function () {
if (this._object instanceof ApiCharacters) {
@@ -12566,6 +13508,7 @@
* @typeofeditors ["CSE"]
* @param {ApiColor} Color - Font color.
* @since 7.4.0
+ * @see office-js-api/Examples/{Editor}/ApiFont/Methods/SetColor.js
*/
ApiFont.prototype.SetColor = function (Color) {
if (!Color instanceof ApiColor) {
@@ -12622,6 +13565,7 @@
* @typeofeditors ["CSE"]
* @param {ApiRange | String} frozenRange - A range that represents the cells to be frozen.
* @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/ApiFreezePanes/Methods/FreezeAt.js
*/
ApiFreezePanes.prototype.FreezeAt = function (frozenRange) {
let api = this.ws.workbook.oApi;
@@ -12643,6 +13587,7 @@
* @typeofeditors ["CSE"]
* @param {Number?} [count=0] - Optional number of columns to freeze, or zero to unfreeze all columns.
* @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/ApiFreezePanes/Methods/FreezeColumns.js
*/
ApiFreezePanes.prototype.FreezeColumns = function (count) {
let api = this.ws.workbook.oApi;
@@ -12662,6 +13607,7 @@
* @typeofeditors ["CSE"]
* @param {Number?} [count=0] - Optional number of rows to freeze, or zero to unfreeze all rows.
* @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/ApiFreezePanes/Methods/FreezeRows.js
*/
ApiFreezePanes.prototype.FreezeRows = function (count) {
let api = this.ws.workbook.oApi;
@@ -12681,6 +13627,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiRange | null} - Returns null if there is no frozen pane.
* @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/ApiFreezePanes/Methods/GetLocation.js
*/
ApiFreezePanes.prototype.GetLocation = function () {
let result = null;
@@ -12707,6 +13654,18 @@
return result;
};
+ /**
+ * Removes all frozen panes in the current worksheet.
+ * @memberof ApiFreezePanes
+ * @typeofeditors ["CSE"]
+ * @since 8.0.0
+ * @see office-js-api/Examples/{Editor}/ApiFreezePanes/Methods/Unfreeze.js
+ */
+ ApiFreezePanes.prototype.Unfreeze = function () {
+ if (!!this.ws.workbook.oApi.wb.getWorksheet().topLeftFrozenCell)
+ this.ws.workbook.oApi.asc_freezePane(undefined);
+ };
+
/**
* Class representing a user-protected range.
* @constructor
@@ -12720,8 +13679,9 @@
* @memberof ApiProtectedRange
* @typeofeditors ["CSE"]
* @param {string} sTitle - The title which will be displayed for the current protected range.
- * @return {boolean} - Returns false if a user doesn't have permission to modify the protected range.
+ * @returns {boolean} - Returns false if a user doesn't have permission to modify the protected range.
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/SetTitle.js
*/
ApiProtectedRange.prototype.SetTitle = function (sTitle) {
let isValidTitle = typeof (sTitle) === 'string' && sTitle.trim() !== '';
@@ -12731,7 +13691,11 @@
if (worksheet) {
let newProtectedRange = this.protectedRange.clone(this.protectedRange._ws, true);
newProtectedRange.asc_setName(sTitle);
- if (worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true)) {
+ let editRes = worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true);
+ if (typeof editRes === "object") {
+ this.protectedRange = editRes;
+ }
+ if (editRes) {
result = true;
}
}
@@ -12744,8 +13708,9 @@
* @memberof ApiProtectedRange
* @typeofeditors ["CSE"]
* @param {string} sRange - The cell range which will be set for the current protected range.
- * @return {boolean} - Returns false if a user doesn't have permission to modify the protected range.
+ * @returns {boolean} - Returns false if a user doesn't have permission to modify the protected range.
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/SetRange.js
*/
ApiProtectedRange.prototype.SetRange = function (sRange) {
let isValidRange = typeof (sRange) === 'string' && sRange.trim() !== '';
@@ -12755,7 +13720,11 @@
if (worksheet) {
let newProtectedRange = this.protectedRange.clone(this.protectedRange._ws, true);
newProtectedRange.asc_setRef(sRange);
- if (worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true)) {
+ let editRes = worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true);
+ if (typeof editRes === "object") {
+ this.protectedRange = editRes;
+ }
+ if (editRes) {
result = true;
}
}
@@ -12766,6 +13735,7 @@
/**
* Specifies the user type of the protected range.
* @typedef {("CanEdit" | "CanView" | "NotView")} ProtectedRangeUserType
+ * @see office-js-api/Examples/Enumerations/ProtectedRangeUserType.js
*/
@@ -12778,6 +13748,7 @@
* @param {ProtectedRangeUserType} protectedRangeUserType - The user type of the protected range.
* @returns {ApiProtectedRangeUserInfo | null} - Returns null if a user doesn't have permission to modify the protected range.
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/AddUser.js
*/
ApiProtectedRange.prototype.AddUser = function (sId, sName, protectedRangeUserType) {
let isValidIdTitle = typeof (sId) === 'string' && sId.trim() !== '';
@@ -12800,10 +13771,16 @@
newUser.asc_setType(nType);
let users = this.protectedRange.asc_getUsers();
+ if (!users) {
+ users = [];
+ }
users.push(newUser);
newProtectedRange.asc_setUsers(users);
- worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true);
- result = new ApiProtectedRangeUserInfo(result, this.protectedRange);
+ let editRes = worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true);
+ if (typeof editRes === "object") {
+ this.protectedRange = editRes;
+ }
+ result = new ApiProtectedRangeUserInfo(newUser, this.protectedRange);
}
}
return result;
@@ -12812,9 +13789,11 @@
/**
* Removes a user from the current protected range.
* @memberof ApiProtectedRange
+ * @typeofeditors ["CSE"]
* @param {string} sId - The user ID.
* @returns {bool}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/DeleteUser.js
*/
ApiProtectedRange.prototype.DeleteUser = function (sId) {
let isValidId = typeof (sId) === 'string' && sId.trim() !== '';
@@ -12851,6 +13830,7 @@
* @typeofeditors ["CSE"]
* @returns {ApiProtectedRangeUserInfo[] | null}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/GetAllUsers.js
*/
ApiProtectedRange.prototype.GetAllUsers = function () {
let worksheet = this.protectedRange._ws;
@@ -12876,6 +13856,7 @@
* @param {ProtectedRangeUserType} protectedRangeUserType - The user type of the protected range.
* @returns {bool}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/SetAnyoneType.js
*/
ApiProtectedRange.prototype.SetAnyoneType = function (protectedRangeUserType) {
let nType = Asc.c_oSerUserProtectedRangeType.edit;
@@ -12890,7 +13871,11 @@
if (worksheet) {
let newProtectedRange = this.protectedRange.clone(this.protectedRange._ws, true);
newProtectedRange.asc_setType(nType);
- if (worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true)) {
+ let editRes = worksheet.editUserProtectedRanges(this.protectedRange, newProtectedRange, true);
+ if (typeof editRes === "object") {
+ this.protectedRange = editRes;
+ }
+ if (editRes) {
result = true;
}
}
@@ -12901,9 +13886,11 @@
/**
* Returns an object that represents a user from the current protected range.
* @memberof ApiProtectedRange
+ * @typeofeditors ["CSE"]
* @param {string} sId - The user ID.
* @returns {ApiProtectedRangeUserInfo | null}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRange/Methods/GetUser.js
*/
ApiProtectedRange.prototype.GetUser = function (sId) {
let isValidRange = typeof (sId) === 'string' && sId.trim() !== '';
@@ -12935,6 +13922,7 @@
* @typeofeditors ["CSE"]
* @returns {string | null}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRangeUserInfo/Methods/GetName.js
*/
ApiProtectedRangeUserInfo.prototype.GetName = function () {
//the sets methods are available from the parent
@@ -12948,6 +13936,7 @@
* @typeofeditors ["CSE"]
* @returns {ProtectedRangeUserType}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRangeUserInfo/Methods/GetType.js
*/
ApiProtectedRangeUserInfo.prototype.GetType = function () {
let nType = this.userInfo.asc_getType();
@@ -12967,89 +13956,3131 @@
* @typeofeditors ["CSE"]
* @returns {string | null}
* @since 8.1.0
+ * @see office-js-api/Examples/{Editor}/ApiProtectedRangeUserInfo/Methods/GetId.js
*/
ApiProtectedRangeUserInfo.prototype.GetId = function () {
return this.userInfo.asc_getId();
};
+ //------------------------------------------------------------------------------------------------------------------
+ //
+ // ApiPivotTable
+ //
+ //------------------------------------------------------------------------------------------------------------------
- Api.prototype["Format"] = Api.prototype.Format;
- Api.prototype["AddSheet"] = Api.prototype.AddSheet;
- Api.prototype["GetSheets"] = Api.prototype.GetSheets;
- Api.prototype["GetActiveSheet"] = Api.prototype.GetActiveSheet;
- Api.prototype["GetLocale"] = Api.prototype.GetLocale;
- Api.prototype["SetLocale"] = Api.prototype.SetLocale;
- Api.prototype["GetSheet"] = Api.prototype.GetSheet;
- Api.prototype["GetThemesColors"] = Api.prototype.GetThemesColors;
- Api.prototype["SetThemeColors"] = Api.prototype.SetThemeColors;
- Api.prototype["CreateNewHistoryPoint"] = Api.prototype.CreateNewHistoryPoint;
- Api.prototype["CreateColorFromRGB"] = Api.prototype.CreateColorFromRGB;
- Api.prototype["CreateColorByName"] = Api.prototype.CreateColorByName;
- Api.prototype["Intersect"] = Api.prototype.Intersect;
- Api.prototype["GetSelection"] = Api.prototype.GetSelection;
- Api.prototype["AddDefName"] = Api.prototype.AddDefName;
- Api.prototype["GetDefName"] = Api.prototype.GetDefName;
- Api.prototype["Save"] = Api.prototype.Save;
- Api.prototype["GetMailMergeData"] = Api.prototype.GetMailMergeData;
-
- Api.prototype["GetRange"] = Api.prototype.GetRange;
-
- Api.prototype["RecalculateAllFormulas"] = Api.prototype.RecalculateAllFormulas;
- Api.prototype["AddComment"] = Api.prototype.AddComment;
- Api.prototype["GetComments"] = Api.prototype.GetComments;
- Api.prototype["GetAllComments"] = Api.prototype.GetAllComments;
- Api.prototype["GetCommentById"] = Api.prototype.GetCommentById;
- Api.prototype["SetFreezePanesType"] = Api.prototype.SetFreezePanesType;
- Api.prototype["GetFreezePanesType"] = Api.prototype.GetFreezePanesType;
+ /* Methods */
- Api.prototype["AddCustomFunction"] = Api.prototype.AddCustomFunction;
- Api.prototype["RemoveCustomFunction"] = Api.prototype.RemoveCustomFunction;
+ /**
+ * Adds a data field to the pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string} field - The index number or name of the data field.
+ * @returns {ApiPivotDataField}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/AddDataField.js
+ */
+ ApiPivotTable.prototype.AddDataField = function (field) {
+ let pivotIndex = -1;
+ const pivotFields = this.pivot.asc_getPivotFields();
+ if (typeof field === 'string') {
+ pivotIndex = this.pivot.getFieldIndexByValue(field);
+ } else if (typeof field === 'number') {
+ pivotIndex = field - 1;
+ } else {
+ private_MakeError('Bad field indentifier type.')
+ return null;
+ }
+ if (pivotFields[pivotIndex]) {
+ this.pivot.asc_addDataField(this.api, pivotIndex);
+ const dataFields = this.pivot.asc_getDataFields();
+ return new ApiPivotDataField(this, dataFields.length - 1, dataFields[dataFields.length - 1]);
+ }
+ private_MakeError("Field with such an identifier does not exist.");
+ return null;
+ };
+ /**
+ * Adds the row, column, and page fields to the pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {Object} options - The settings for adding row, column, and page fields to the pivot table report.
+ * @param {number | string | number[] | string[]} [options.rows] - An array of field names or IDs to be added as rows or added to the category axis.
+ * @param {number | string | number[] | string[]} [options.columns] - An array of field names or IDs to be added as columns or added to the series axis.
+ * @param {number | string | number[] | string[]} [options.pages] - An array of field names or IDs to be added as pages or added to the page area.
+ * @param {boolean} [options.addToTable] - Specifies whether to apply fields only to the pivot table reports. If this parameter is set to true,
+ * the specified fields will be added to the report (none of the existing fields are replaced).
+ * If false, the existing fields will be replaced with the new fields. The default value is false.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/AddFields.js
+ */
+ ApiPivotTable.prototype.AddFields = function (options) {
+ options['rows'] = options['rows'] != null ? options['rows'] : [];
+ options['columns'] = options['columns'] != null ? options['columns'] : [];
+ options['pages'] = options['pages'] != null ? options['pages'] : [];
+
+ const rows = Array.isArray(options['rows']) ? options['rows'] : [options['rows']];
+ const cols = Array.isArray(options['columns']) ? options['columns'] : [options['columns']];
+ const pages = Array.isArray(options['pages']) ? options['pages'] : [options['pages']];
+ const cacheFields = this.pivot.asc_getCacheFields();
+ const t = this;
+
+ function processField(field, callback) {
+ let index = null;
+ if (typeof field == "number" && field > 0 && field - 1 < cacheFields.length) {
+ index = field - 1;
+ } else if (typeof field == "string") {
+ index = t.pivot.getFieldIndexByValue(field.trim());
+ if (index < 0) {
+ index = null;
+ }
+ }
+ if (index !== null) {
+ callback(index);
+ } else {
+ private_MakeError("There is no field with such an identifier.");
+ }
+ }
- Api.prototype["GetReferenceStyle"] = Api.prototype.GetReferenceStyle;
- Api.prototype["SetReferenceStyle"] = Api.prototype.SetReferenceStyle;
+ if (!options.addToTable) {
+ const pivotFields = this.GetPivotFields()
+ pivotFields.forEach(function (pivotField) {
+ pivotField.Remove()
+ })
- Api.prototype["GetWorksheetFunction"] = Api.prototype.GetWorksheetFunction;
-
- ApiWorksheet.prototype["GetVisible"] = ApiWorksheet.prototype.GetVisible;
- ApiWorksheet.prototype["SetVisible"] = ApiWorksheet.prototype.SetVisible;
- ApiWorksheet.prototype["SetActive"] = ApiWorksheet.prototype.SetActive;
- ApiWorksheet.prototype["GetActiveCell"] = ApiWorksheet.prototype.GetActiveCell;
- ApiWorksheet.prototype["GetSelection"] = ApiWorksheet.prototype.GetSelection;
- ApiWorksheet.prototype["GetCells"] = ApiWorksheet.prototype.GetCells;
- ApiWorksheet.prototype["GetCols"] = ApiWorksheet.prototype.GetCols;
- ApiWorksheet.prototype["GetRows"] = ApiWorksheet.prototype.GetRows;
- ApiWorksheet.prototype["GetUsedRange"] = ApiWorksheet.prototype.GetUsedRange;
- ApiWorksheet.prototype["GetName"] = ApiWorksheet.prototype.GetName;
- ApiWorksheet.prototype["SetName"] = ApiWorksheet.prototype.SetName;
- ApiWorksheet.prototype["GetIndex"] = ApiWorksheet.prototype.GetIndex;
- ApiWorksheet.prototype["GetRange"] = ApiWorksheet.prototype.GetRange;
- ApiWorksheet.prototype["GetRangeByNumber"] = ApiWorksheet.prototype.GetRangeByNumber;
- ApiWorksheet.prototype["FormatAsTable"] = ApiWorksheet.prototype.FormatAsTable;
- ApiWorksheet.prototype["SetColumnWidth"] = ApiWorksheet.prototype.SetColumnWidth;
- ApiWorksheet.prototype["SetRowHeight"] = ApiWorksheet.prototype.SetRowHeight;
- ApiWorksheet.prototype["SetDisplayGridlines"] = ApiWorksheet.prototype.SetDisplayGridlines;
- ApiWorksheet.prototype["SetDisplayHeadings"] = ApiWorksheet.prototype.SetDisplayHeadings;
- ApiWorksheet.prototype["SetLeftMargin"] = ApiWorksheet.prototype.SetLeftMargin;
- ApiWorksheet.prototype["GetLeftMargin"] = ApiWorksheet.prototype.GetLeftMargin;
- ApiWorksheet.prototype["SetRightMargin"] = ApiWorksheet.prototype.SetRightMargin;
- ApiWorksheet.prototype["GetRightMargin"] = ApiWorksheet.prototype.GetRightMargin;
- ApiWorksheet.prototype["SetTopMargin"] = ApiWorksheet.prototype.SetTopMargin;
- ApiWorksheet.prototype["GetTopMargin"] = ApiWorksheet.prototype.GetTopMargin;
- ApiWorksheet.prototype["SetBottomMargin"] = ApiWorksheet.prototype.SetBottomMargin;
- ApiWorksheet.prototype["GetBottomMargin"] = ApiWorksheet.prototype.GetBottomMargin;
- ApiWorksheet.prototype["SetPageOrientation"] = ApiWorksheet.prototype.SetPageOrientation;
- ApiWorksheet.prototype["GetPageOrientation"] = ApiWorksheet.prototype.GetPageOrientation;
- ApiWorksheet.prototype["GetPrintHeadings"] = ApiWorksheet.prototype.GetPrintHeadings;
- ApiWorksheet.prototype["SetPrintHeadings"] = ApiWorksheet.prototype.SetPrintHeadings;
- ApiWorksheet.prototype["GetPrintGridlines"] = ApiWorksheet.prototype.GetPrintGridlines;
- ApiWorksheet.prototype["SetPrintGridlines"] = ApiWorksheet.prototype.SetPrintGridlines;
- ApiWorksheet.prototype["GetDefNames"] = ApiWorksheet.prototype.GetDefNames;
- ApiWorksheet.prototype["GetDefName"] = ApiWorksheet.prototype.GetDefName;
- ApiWorksheet.prototype["AddDefName"] = ApiWorksheet.prototype.AddDefName;
- ApiWorksheet.prototype["GetComments"] = ApiWorksheet.prototype.GetComments;
- ApiWorksheet.prototype["Delete"] = ApiWorksheet.prototype.Delete;
- ApiWorksheet.prototype["SetHyperlink"] = ApiWorksheet.prototype.SetHyperlink;
- ApiWorksheet.prototype["AddChart"] = ApiWorksheet.prototype.AddChart;
+ }
+ rows.forEach(function(row) {
+ processField(row, function(index) {
+ t.pivot.asc_addRowField(t.api, index);
+ });
+ });
+ cols.forEach(function(col) {
+ processField(col, function(index) {
+ t.pivot.asc_addColField(t.api, index);
+ });
+ });
+ pages.forEach(function(page) {
+ processField(page, function(index) {
+ t.pivot.asc_addPageField(t.api, index);
+ });
+ });
+ };
+ /**
+ * Deletes all filters currently applied to the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/ClearAllFilters.js
+ */
+ ApiPivotTable.prototype.ClearAllFilters = function () {
+ this.pivot.asc_removeFilters(this.api);
+ };
+ /**
+ * Clears the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/ClearTable.js
+ */
+ ApiPivotTable.prototype.ClearTable = function () {
+ const ws = this.pivot.worksheet;
+ const name = this.pivot.asc_getName();
+ const range = this.pivot.getRange();
+ const bbox = new Asc.Range(range.c1, range.r1, range.c1, range.r1);
+ const dataRef = this.pivot.cacheDefinition.cacheSource.worksheetSource.getDataRef();
+ let index = -1;
+ for (let i = 0; i < ws.pivotTables.length; i += 1) {
+ if (ws.pivotTables[i].Get_Id() === this.pivot.Get_Id()) {
+ index = i;
+ break;
+ }
+ }
+ if (index !== -1) {
+ ws._deletePivotTable(ws.pivotTables, this.pivot, index);
+ this.pivot = this.api._asc_insertPivot(ws.workbook, dataRef, ws, bbox, false);
+ this.pivot.asc_setName(name);
+ return;
+ }
+ private_MakeError("Unknown error!");
+ };
+ /**
+ * Returns the value for the data field in a pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string[]} items - Describes a single cell in the pivot table report.
+ * For example, "'Estimated Costs' Tables May", which shows the estimated costs for tables in May
+ * (Data field = Costs, Product = Tables, Month = May).
+ * @returns {number | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetData.js
+ */
+ ApiPivotTable.prototype.GetData = function (items) {
+ const params = this.pivot.asc_getDataToGetPivotData(items);
+ const cell = this.pivot.getCellByGetPivotDataParams(params);
+ if (cell) {
+ return this.pivot.worksheet.getCell3(cell.row, cell.col).getValue();
+ }
+ private_MakeError('There is no data with that params.');
+ return null;
+ };
+ /**
+ * Returns a Range object with information about a data item in the pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string} [dataField] - The name of the field containing the data for the PivotTable.
+ * @param {string[]} [fieldItemsArray] - An array of field items from the pivot table.
+ * @returns {ApiRange}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetPivotData.js
+ */
+ ApiPivotTable.prototype.GetPivotData = function (dataField, fieldItemsArray) {
+ const cell = this.pivot.getCellByGetPivotDataParams({
+ dataFieldName: dataField,
+ optParams: fieldItemsArray
+ });
+ if (cell) {
+ return new ApiRange(this.pivot.worksheet.getCell3(cell.row, cell.col));
+ }
+ return null;
+ };
+ /**
+ * Returns a collection that represents either a single pivot table field
+ * or a collection of both the visible and hidden fields in the pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string | number} [field] - The name or index of the field to be returned.
+ * @returns {ApiPivotField[] | ApiPivotField | ApiPivotDataField | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetPivotFields.js
+ */
+ ApiPivotTable.prototype.GetPivotFields = function (field) {
+ const pivotFields = this.pivot.asc_getPivotFields();
+ if (field != null) {
+ let pivotIndex = -1;
+ if (typeof field === 'number') {
+ pivotIndex = field - 1;
+ if (pivotFields[pivotIndex]) {
+ return new ApiPivotField(this, pivotIndex, pivotFields[pivotIndex]);
+ }
+ } else if (typeof field === 'string') {
+ pivotIndex = this.pivot.getFieldIndexByValue(field.trim());
+ if (pivotIndex !== -1) {
+ return new ApiPivotField(this, pivotIndex, pivotFields[pivotIndex]);
+ }
+ return this.GetDataFields(field);
+ }
+ }
+ const t = this;
+ return pivotFields.map(function(pivotField, i) {
+ return new ApiPivotField(t, i, pivotField);
+ });
+ };
+ Object.defineProperty(ApiPivotTable.prototype, "PivotFields", {
+ get: function (field) {
+ this.GetPivotFields(field);
+ }
+ });
+ /**
+ * Returns the value of a pivot table cell.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number} rowLine - The position of the pivot line (a line of rows in the pivot table) on the row area.
+ * @param {number} colLine - The position of the pivot line (a line of columns in the pivot table) on the column area.
+ * @returns {number | string | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/PivotValueCell.js
+ */
+ ApiPivotTable.prototype.PivotValueCell = function (rowLine, colLine) {
+ if (rowLine > 0 && colLine > 0) {
+ const pivotRange = this.pivot.getRange();
+ const location = this.pivot.location;
+ const baseCol = pivotRange.c1 + location.firstDataCol;
+ const baseRow = pivotRange.r1 + location.firstDataRow;
+ const curRow = rowLine + baseRow - 1;
+ const curCol = colLine + baseCol - 1;
+ if (curRow <= pivotRange.r2 && curCol <= pivotRange.c2) {
+ return this.pivot.worksheet.getCell3(curRow, curCol).getValue();
+ }
+ }
+ private_MakeError('Cell is out of range');
+ return null;
+ };
+ /**
+ * Shows details of the pivot table cell.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number} rowLine - The position of the pivot line (a line of rows in the pivot table) on the row area.
+ * @param {number} colLine - The position of the pivot line (a line of columns in the pivot table) on the column area.
+ * @returns {boolean} - Returns true if the operation is successful.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/ShowDetails.js
+ */
+ ApiPivotTable.prototype.ShowDetails = function (rowLine, colLine) {
+ if (rowLine > 0 && colLine > 0) {
+ const pivotRange = this.pivot.getRange();
+ const location = this.pivot.location;
+ const baseCol = pivotRange.c1 + location.firstDataCol;
+ const baseRow = pivotRange.r1 + location.firstDataRow;
+ const curRow = rowLine + baseRow - 1;
+ const curCol = colLine + baseCol - 1;
+ if (curRow <= pivotRange.r2 && curCol <= pivotRange.c2) {
+ return this.api.asc_pivotShowDetails(this.pivot, {row: curRow, col: curCol});
+ }
+ }
+ private_MakeError('Cell is out of range');
+ return false;
+ };
+ /**
+ * Refreshes the pivot table report from the source data.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/RefreshTable.js
+ */
+ ApiPivotTable.prototype.RefreshTable = function () {
+ this.pivot.asc_refresh(this.api);
+ };
+ /**
+ * Updates the current pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/Update.js
+ */
+ ApiPivotTable.prototype.Update = function () {
+ this.pivot.asc_refresh(this.api);
+ };
+ /**
+ * Specifies whether to repeat item labels for all pivot fields in the specified pivot table.
+ * @memberof ApiPivotTable
+ * @param {boolean} repeat - Specifies whether to repeat all field item labels in a pivot table report.
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetRepeatAllLabels.js
+ */
+ ApiPivotTable.prototype.SetRepeatAllLabels = function (repeat) {
+ if (typeof repeat == "boolean") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setFillDownLabelsDefault(repeat);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "repeat".');
+ }
+ };
+ Object.defineProperty(ApiPivotTable.prototype, "RepeatAllLabels", {
+ set: function (repeat) {
+ this.SetRepeatAllLabels(repeat);
+ }
+ });
+ /**
+ * Sets the way the specified pivot table items appear — in table format or in outline format.
+ * @memberof ApiPivotTable
+ * @param {PivotLayoutType} type - The layout type of the pivot table report.
+ * @param {boolean} compact - Specifies whether the pivot table items will be displayed in the compact form.
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetRowAxisLayout.js
+ */
+ ApiPivotTable.prototype.SetRowAxisLayout = function (type, compact) {
+ let props = null;
+ if (typeof type === "string" && (type === "Tabular" || type === "Outline")) {
+ props = new Asc.CT_pivotTableDefinition();
+ props.asc_setOutline((type == "Outline"));
+ } else {
+ private_MakeError('Invalid type of "type" or invalid value.');
+ }
+ if (compact != null) {
+ if (typeof compact === "boolean") {
+ if (!props) {
+ props = new Asc.CT_pivotTableDefinition();
+ }
+ props.asc_setCompact(compact);
+ } else {
+ private_MakeError('Invalid type of "compact".');
+ }
+ }
+ if (props) {
+ this.pivot.asc_set(this.api, props);
+ }
+ };
+ Object.defineProperty(ApiPivotTable.prototype, "RowAxisLayout", {
+ set: function (type, compact) {
+ this.SetRowAxisLayout(type, compact);
+ }
+ });
+ /**
+ * The type of the pivot table subtotal layout.
+ * @typedef { "Hidden" | "Top" | "Bottom" } PivotSubtotalLayoutType
+ */
+ /**
+ * Sets the layout subtotal location in the pivot table.
+ * @memberof ApiPivotTable
+ * @param {PivotSubtotalLayoutType} type - The type of the pivot table subtotal layout.
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetSubtotalLocation.js
+ */
+ ApiPivotTable.prototype.SetSubtotalLocation = function (type) {
+ if ( typeof type == "string" && (type === "Hidden" || type === "Bottom" || type === "Top") ) {
+ const props = new Asc.CT_pivotTableDefinition();
+ if (type == "Hidden") {
+ props.asc_setDefaultSubtotal(false);
+ } else {
+ props.asc_setDefaultSubtotal(true);
+ props.asc_setSubtotalTop( (type == "Top") );
+ }
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "type" or invalid value.');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "SubtotalLocation", {
+ set: function (type) {
+ this.SetSubtotalLocation(type);
+ }
+ });
+ /**
+ * Removes the specified field from all the pivot table categories.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string} identifier - The index number or name of the field.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/RemoveField.js
+ */
+ ApiPivotTable.prototype.RemoveField = function (identifier) {
+ const pivotField = this.GetPivotFields(identifier);
+ if (pivotField) {
+ this.pivot.asc_removeField(this.api, pivotField.index);
+ }
+ };
+
+ /**
+ * The direction to move the pivot table field.
+ * @typedef { "Up" | "Down" | "Begin" | "End" } PivotMoveFieldType
+ */
+ /**
+ * The pivot field orientation type.
+ * @typedef {"Rows" | "Columns" | "Filters" | "Values" | "Hidden" } PivotFieldOrientationType
+ */
+
+ /**
+ * Moves the specified field from one category to another.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string} identifier - The index number or name of the field.
+ * @param {PivotMoveFieldType | PivotFieldOrientationType} type - The direction to move the pivot table field,
+ * or the pivot field orientation type.
+ * @param {number} [index] - The field index in a new category.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/MoveField.js
+ */
+ ApiPivotTable.prototype.MoveField = function (identifier, type, index) {
+ const pivotField = this.GetPivotFields(identifier);
+ if (pivotField) {
+ pivotField.Move(type, index)
+ }
+ };
+ /**
+ * Selects the current pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/Select.js
+ */
+ ApiPivotTable.prototype.Select = function () {
+ this.pivot.asc_select(this.api);
+ };
+
+ /* Attributes */
+
+ /**
+ * Returns a collection that is currently displayed as column fields in the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string | undefined} field - The name or index of the field to be returned.
+ * @returns {ApiPivotField[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetColumnFields.js
+ */
+ ApiPivotTable.prototype.GetColumnFields = function (field) {
+ const pivotFields = this.pivot.asc_getPivotFields();
+ const colFields = this.pivot.asc_getColumnFields();
+ const t = this;
+ return colFields.map(function(colField, i) {
+ const index = colField.asc_getIndex();
+ return new ApiPivotField(t, index, pivotFields[index]);
+ });
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ColumnFields", {
+ get: function (field) {
+ return this.GetColumnFields(field);
+ }
+ });
+ /**
+ * Returns a collection that represents either a single pivot table data field
+ * or a collection of all visible data fields.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string |undefined} field - The name or index of the field to be returned.
+ * @returns {ApiPivotDataField[] | ApiPivotDataField | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetDataFields.js
+ */
+ ApiPivotTable.prototype.GetDataFields = function (field) {
+ const dataFields = this.pivot.asc_getDataFields();
+ if (field != null) {
+ let dataIndex = -1;
+ if (typeof field === 'number') {
+ dataIndex = field - 1;
+ const dataField = dataFields[dataIndex];
+ if (dataField) {
+ return new ApiPivotDataField(this, dataIndex, dataField)
+ }
+ } else if (typeof field === 'string') {
+ const dataIndex = this.pivot.dataFields.getIndexByName(field.trim())
+ if (dataIndex !== -1) {
+ return new ApiPivotDataField(this, dataIndex, dataFields[dataIndex]);
+ }
+ }
+ private_MakeError("A field with such an identifier does not exist.");
+ return null;
+ }
+ const t = this;
+ return dataFields.map(function(dataField, i) {
+ return new ApiPivotDataField(t, i, dataField);
+ });
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "DataFields", {
+ get: function (field) {
+ return this.GetDataFields(field);
+ }
+ });
+
+ /**
+ * Returns an array that represents all the hidden fields in the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotField[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetHiddenFields.js
+ */
+ ApiPivotTable.prototype.GetHiddenFields = function () {
+ var fields = this.pivot.asc_getPivotFields();
+ var hidden = [];
+ for (var i = 0; i < fields.length; i++)
+ if (fields[i].axis === null && !fields[i].dataField)
+ hidden.push( new ApiPivotField(this, i, fields[i]));
+
+ return hidden;
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "HiddenFields", {
+ get: function () {
+ return this.GetHiddenFields();
+ }
+ });
+
+ /**
+ * Returns an array that represents all the visible fields in the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotField[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetVisibleFields.js
+ */
+ ApiPivotTable.prototype.GetVisibleFields = function () {
+ const pivotFields = this.pivot.asc_getPivotFields();
+ const visible = [];
+ for (var i = 0; i < pivotFields.length; i++) {
+ if (pivotFields[i].axis !== null && !pivotFields[i].dataField) {
+ visible.push( new ApiPivotField(this, i, pivotFields[i]) );
+ }
+ }
+ return visible.concat(this.GetDataFields());
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "VisibleFields", {
+ get: function () {
+ return this.GetVisibleFields();
+ }
+ });
+
+ /**
+ * Returns a collection that represents either a single pivot table page field
+ * or a collection of all visible page fields.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string |undefined} field - The name or index of the field to be returned.
+ * @returns {ApiPivotField[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetPageFields.js
+ */
+ ApiPivotTable.prototype.GetPageFields = function (field) {
+ const pivotFields = this.pivot.asc_getPivotFields();
+ const pageFields = this.pivot.asc_getPageFields();
+ const t = this;
+ return pageFields.map(function(pageField, i) {
+ const index = pageField.asc_getIndex();
+ return new ApiPivotField(t, index, pivotFields[index]);
+ });
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "PageFields", {
+ get: function (field) {
+ return this.GetPageFields(field);
+ }
+ });
+ /**
+ * Returns a collection that is currently displayed as row fields in the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {number | string |undefined} field - The name or index of the field to be returned.
+ * @returns {ApiPivotField[]}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetRowFields.js
+ */
+ ApiPivotTable.prototype.GetRowFields = function (field) {
+ const pivotFields = this.pivot.asc_getPivotFields();
+ const rowFields = this.pivot.asc_getRowFields();
+ const t = this;
+ return rowFields.map(function(rowField, i) {
+ const index = rowField.asc_getIndex();
+ return new ApiPivotField(t, index, pivotFields[index]);
+ });
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "RowFields", {
+ get: function () {
+ return this.GetRowFields();
+ }
+ });
+ /**
+ * Returns the pivot table name.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetName.js
+ */
+ ApiPivotTable.prototype.GetName = function () {
+ return this.pivot.asc_getName();
+ };
+
+ /**
+ * Sets the pivot table name.
+ * @memberof ApiPivotTable
+ * @param {string} name - The pivot table name.
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetName.js
+ */
+ ApiPivotTable.prototype.SetName = function (name) {
+ if (typeof name == "string" && name.trim().length) {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setName(name.trim());
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "name" or "name" is empty.');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "Name", {
+ get: function () {
+ return this.GetName();
+ },
+ set: function (name) {
+ this.SetName(name);
+ }
+ });
+
+ /**
+ * Returns the Grand Totals setting of the pivot table columns.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetColumnGrand.js
+ */
+ ApiPivotTable.prototype.GetColumnGrand = function () {
+ return this.pivot.asc_getColGrandTotals();
+ };
+
+ /**
+ * Sets the Grand Totals setting to the pivot table columns.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether to display the grand totals for columns.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetColumnGrand.js
+ */
+ ApiPivotTable.prototype.SetColumnGrand = function (show) {
+ if (typeof show == "boolean") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setColGrandTotals(show);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ColumnGrand", {
+ get: function () {
+ return this.GetColumnGrand();
+ },
+ set: function (show) {
+ this.SetColumnGrand(show);
+ }
+ });
+
+ /**
+ * Returns the Grand Totals setting of the pivot table rows.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetRowGrand.js
+ */
+ ApiPivotTable.prototype.GetRowGrand = function () {
+ return this.pivot.asc_getRowGrandTotals();
+ };
+
+ /**
+ * Sets the Grand Totals setting to the pivot table rows.
+ * @memberof ApiPivotTable
+ * @param {boolean} show - Specifies whether to display the grand totals for rows.
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetRowGrand.js
+ */
+ ApiPivotTable.prototype.SetRowGrand = function (show) {
+ if (typeof show == "boolean") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setRowGrandTotals(show);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "RowGrand", {
+ get: function () {
+ return this.GetRowGrand();
+ },
+ set: function (show) {
+ this.SetRowGrand(show);
+ }
+ });
+
+ /**
+ * Specifies how the report filter fields are located.
+ * @typedef {"OverThenDown" | "DownThenOver"} FieldsInReportFilterType
+ */
+
+ /**
+ * Returns the pivot table display fields in the report filter area settings.
+ * The returned object has the following structure: {Type: FieldsInReportFilterType, ReportFilterFields: number},
+ * where Type specifies how the report filter fields are located, ReportFilterFields defines a number of the report filter fields.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {object}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetDisplayFieldsInReportFilterArea.js
+ */
+ ApiPivotTable.prototype.GetDisplayFieldsInReportFilterArea = function () {
+ return {
+ "Type": (this.pivot.asc_getPageOverThenDown() ? "OverThenDown" : "DownThenOver"),
+ "ReportFilterFields": this.pivot.asc_getPageWrap()
+ };
+ };
+
+ /**
+ * Sets the pivot table display fields in the report filter area settings.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {FieldsInReportFilterType} type - Specifies how the report filter fields are located.
+ * @param {number} fields - A number of the report filter fields.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetDisplayFieldsInReportFilterArea.js
+ */
+ ApiPivotTable.prototype.SetDisplayFieldsInReportFilterArea = function (type, fields) {
+ var props = null;
+ if (type != undefined) {
+ if ( typeof type == "string" && (type == 'OverThenDown' || type == 'DownThenOver') ) {
+ props = new Asc.CT_pivotTableDefinition();
+ props.asc_setPageOverThenDown( (type == 'OverThenDown') );
+ } else {
+ private_MakeError('Invalid type of "type".');
+ }
+ }
+
+ if (fields != undefined) {
+ if (typeof fields == "number" && fields >= 0 && fields <= 255) {
+ if (!props)
+ props = new Asc.CT_pivotTableDefinition();
+
+ props.asc_setPageWrap(fields);
+ } else {
+ private_MakeError('Invalid type of "fields" or invalid value.');
+ }
+ }
+
+ if (props)
+ this.pivot.asc_set(this.api, props);
+ };
+
+ /**
+ * Returns the setting which specifies whether to display field headers for rows and columns.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetDisplayFieldCaptions.js
+ */
+ ApiPivotTable.prototype.GetDisplayFieldCaptions = function () {
+ return this.pivot.asc_getShowHeaders();
+ };
+
+ /**
+ * Returns the setting which specifies whether to display field headers for rows and columns.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether to display field headers for rows and columns.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetDisplayFieldCaptions.js
+ */
+ ApiPivotTable.prototype.SetDisplayFieldCaptions = function (show) {
+ if (typeof show == "boolean") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setShowHeaders(show);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "DisplayFieldCaptions", {
+ get: function () {
+ return this.GetDisplayFieldCaptions ();
+ },
+ set: function (show) {
+ this.SetDisplayFieldCaptions (show);
+ }
+ });
+
+ /**
+ * Returns the pivot table title.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTitle.js
+ */
+ ApiPivotTable.prototype.GetTitle = function () {
+ return this.pivot.asc_getTitle() || "";
+ };
+
+ /**
+ * Sets the pivot table title.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string} title - The pivot table title.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetTitle.js
+ */
+ ApiPivotTable.prototype.SetTitle = function (title) {
+ if (typeof title == "string") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setTitle(title.trim());
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "title".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "Title", {
+ get: function () {
+ return this.GetTitle();
+ },
+ set: function (title) {
+ this.SetTitle(title);
+ }
+ });
+
+ /**
+ * Returns the pivot table description.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetDescription.js
+ */
+ ApiPivotTable.prototype.GetDescription = function () {
+ return this.pivot.asc_getDescription() || "";
+ };
+
+ /**
+ * Sets the pivot table description.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string} description - The pivot table description.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetDescription.js
+ */
+ ApiPivotTable.prototype.SetDescription = function (description) {
+ if (typeof description == "string") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setDescription(description.trim());
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "description".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "Description", {
+ get: function () {
+ return this.GetDescription();
+ },
+ set: function (description) {
+ this.SetDescription(description);
+ }
+ });
+
+ /**
+ * Returns the pivot table style name.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetStyleName.js
+ */
+ ApiPivotTable.prototype.GetStyleName = function () {
+ return this.pivot.asc_getStyleInfo().asc_getName();
+ };
+
+ /**
+ * Sets the pivot table style name.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The pivot table style name.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetStyleName.js
+ */
+ ApiPivotTable.prototype.SetStyleName = function (name) {
+ if (typeof name == "string" && name.trim().length) {
+ this.pivot.asc_getStyleInfo().asc_setName(this.api, this.pivot, name.trim());
+ } else {
+ private_MakeError('Invalid type of "name" or "name" is empty.');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "StyleName", {
+ get: function () {
+ return this.GetStyleName();
+ },
+ set: function (name) {
+ this.SetStyleName(name);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the row headers of the pivot table will be highlighted with the special formatting.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTableStyleRowHeaders.js
+ */
+ ApiPivotTable.prototype.GetTableStyleRowHeaders = function () {
+ return this.pivot.asc_getStyleInfo().asc_getShowRowHeaders();
+ };
+
+ /**
+ * Sets the setting which specifies whether the row headers of the pivot table will be highlighted with the special formatting.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether the row headers of the pivot table will be highlighted with the special formatting.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetTableStyleRowHeaders.js
+ */
+ ApiPivotTable.prototype.SetTableStyleRowHeaders = function (show) {
+ if (typeof show == "boolean") {
+ this.pivot.asc_getStyleInfo().asc_setShowRowHeaders(this.api, this.pivot, show);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ShowTableStyleRowHeaders", {
+ get: function () {
+ return this.GetTableStyleRowHeaders();
+ },
+ set: function (show) {
+ this.SetTableStyleRowHeaders(show);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the column headers of the pivot table will be highlighted with the special formatting.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTableStyleColumnHeaders.js
+ */
+ ApiPivotTable.prototype.GetTableStyleColumnHeaders = function () {
+ return this.pivot.asc_getStyleInfo().asc_getShowColHeaders();
+ };
+
+ /**
+ * Sets the setting which specifies whether the column headers of the pivot table will be highlighted with the special formatting.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether the column headers of the pivot table will be highlighted with the special formatting.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetTableStyleColumnHeaders.js
+ */
+ ApiPivotTable.prototype.SetTableStyleColumnHeaders = function (show) {
+ if (typeof show == "boolean") {
+ this.pivot.asc_getStyleInfo().asc_setShowColHeaders(this.api, this.pivot, show);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ShowTableStyleColumnHeaders", {
+ get: function () {
+ return this.GetTableStyleColumnHeaders();
+ },
+ set: function (show) {
+ this.SetTableStyleColumnHeaders(show);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the background color alternation for odd and even rows will be enabled for the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTableStyleRowStripes.js
+ */
+ ApiPivotTable.prototype.GetTableStyleRowStripes = function () {
+ return this.pivot.asc_getStyleInfo().asc_getShowRowStripes();
+ };
+
+ /**
+ * Sets the setting which specifies whether the background color alternation for odd and even rows will be enabled for the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether the background color alternation for odd and even rows will be enabled for the pivot table.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetTableStyleRowStripes.js
+ */
+ ApiPivotTable.prototype.SetTableStyleRowStripes = function (show) {
+ if (typeof show == "boolean") {
+ this.pivot.asc_getStyleInfo().asc_setShowRowStripes(this.api, this.pivot, show);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ShowTableStyleRowStripes", {
+ get: function () {
+ return this.GetTableStyleRowStripes();
+ },
+ set: function (show) {
+ this.SetTableStyleRowStripes(show);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the background color alternation for odd and even columns will be enabled for the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTableStyleColumnStripes.js
+ */
+ ApiPivotTable.prototype.GetTableStyleColumnStripes = function () {
+ return this.pivot.asc_getStyleInfo().asc_getShowColStripes();
+ };
+
+ /**
+ * Sets the setting which specifies whether the background color alternation for odd and even columns will be enabled for the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether the background color alternation for odd and even columns will be enabled for the pivot table.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetTableStyleColumnStripes.js
+ */
+ ApiPivotTable.prototype.SetTableStyleColumnStripes = function (show) {
+ if (typeof show == "boolean") {
+ this.pivot.asc_getStyleInfo().asc_setShowColStripes(this.api, this.pivot, show);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ShowTableStyleColumnStripes", {
+ get: function () {
+ return this.GetTableStyleColumnStripes();
+ },
+ set: function (show) {
+ this.SetTableStyleColumnStripes(show);
+ }
+ });
+
+ /**
+ * Returns the source range for the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiRange}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetSource.js
+ */
+ ApiPivotTable.prototype.GetSource = function () {
+ var location = this.pivot.getDataLocation();
+ return new ApiRange( location.ws.getRange3(location.bbox.r1, location.bbox.c1, location.bbox.r2, location.bbox.c2) );
+ };
+
+ /**
+ * Sets the source range for the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {ApiRange} source - The range where the pivot table will be located.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetSource.js
+ */
+ ApiPivotTable.prototype.SetSource = function (source) {
+ if (source instanceof ApiRange) {
+ var ref = source.GetWorksheet().GetName() + "!" + source.GetAddress(true, true);
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setDataRef(ref);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Source must be instance of ApiRange.');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "Source", {
+ get: function () {
+ return this.GetSource();
+ },
+ set: function (source) {
+ this.SetSource(source);
+ }
+ });
+
+ /**
+ * Returns a Range object that represents the column area in the pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiRange | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetColumnRange.js
+ */
+ ApiPivotTable.prototype.GetColumnRange = function () {
+ const res = this.pivot.asc_getColumnRange();
+ if (res) {
+ return new ApiRange(res);
+ }
+ return null;
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "ColumnRange", {
+ get: function () {
+ return this.GetColumnRange();
+ }
+ });
+
+ /**
+ * Returns a Range object that represents the row area in the pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiRange | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetRowRange.js
+ */
+ ApiPivotTable.prototype.GetRowRange = function () {
+ const res = this.pivot.asc_getRowRange();
+ if (res) {
+ return new ApiRange(res);
+ }
+ return null;
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "RowRange", {
+ get: function () {
+ return this.GetRowRange();
+ }
+ });
+
+ /**
+ * Returns a Range object that represents the range of values in the pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiRange}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetDataBodyRange.js
+ */
+ ApiPivotTable.prototype.GetDataBodyRange = function () {
+ const res = this.pivot.asc_getDataBodyRange();
+ if (res) {
+ return new ApiRange(res);
+ }
+ return null;
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "DataBodyRange", {
+ get: function () {
+ return this.GetDataBodyRange();
+ }
+ });
+
+ /**
+ * Returns a Range object that represents the entire pivot table report, but doesn't include page fields.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiRange | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTableRange1.js
+ */
+ ApiPivotTable.prototype.GetTableRange1 = function () {
+ var ref = (this.pivot.location ? this.pivot.location.ref : null);
+ return (ref ? new ApiRange( this.pivot.worksheet.getRange3(ref.r1, ref.c1, ref.r2, ref.c2) ) : null);
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "TableRange1", {
+ get: function () {
+ return this.GetTableRange1();
+ }
+ });
+
+ /**
+ * Returns a Range object that represents the entire pivot table report, including page fields.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiRange | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetTableRange2.js
+ */
+ ApiPivotTable.prototype.GetTableRange2 = function () {
+ var ref = (this.pivot.location ? this.pivot.location.ref : null);
+ var firsPFP, lastPFP;
+ if (this.pivot.pageFieldsPositions.length) {
+ firsPFP = this.pivot.pageFieldsPositions[0];
+ lastPFP = this.pivot.pageFieldsPositions[ (this.pivot.pageFieldsPositions.length - 1) ];
+ }
+ var r1, c1, r2, c2;
+ if (ref) {
+ r1 = (firsPFP ? Math.min(firsPFP.row, ref.r1) : ref.r1);
+ c1 = (firsPFP ? Math.min(firsPFP.col, ref.c1) : ref.c1);
+ r2 = (lastPFP ? Math.max(lastPFP.row, ref.r2) : ref.r2);
+ c2 = (lastPFP ? Math.max( (lastPFP.col + 1), ref.c2 ) : ref.c2);
+ }
+ return (ref ? new ApiRange( this.pivot.worksheet.getRange3(r1, c1, r2, c2) ) : null);
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "TableRange2", {
+ get: function () {
+ return this.GetTableRange2();
+ }
+ });
+
+ /**
+ * Returns the text string label that is displayed in the grand total column or row heading in the specified pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetGrandTotalName.js
+ */
+ ApiPivotTable.prototype.GetGrandTotalName = function () {
+ return ( this.pivot.asc_getGrandTotalCaption() || AscCommon.translateManager.getValue(AscCommonExcel.GRAND_TOTAL_CAPTION) );
+ };
+
+ /**
+ * Sets the text string label that is displayed in the grand total column or row heading in the specified pivot table report.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The grand total name.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetGrandTotalName.js
+ */
+ ApiPivotTable.prototype.SetGrandTotalName = function (name) {
+ if (typeof name == "string") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setGrandTotalCaption( name.trim() );
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "name".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "GrandTotalName", {
+ get: function () {
+ return this.GetGrandTotalName();
+ },
+ set: function (name) {
+ this.SetGrandTotalName(name);
+ }
+ });
+ /**
+ * Sets the setting which specifies whether to insert blank rows after each item.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} insert - Specifies whether to insert blank rows after each item.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetLayoutBlankLine.js
+ */
+ ApiPivotTable.prototype.SetLayoutBlankLine = function (insert) {
+ if (typeof insert == "boolean") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setInsertBlankRow(insert);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "insert".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "LayoutBlankLine", {
+ set: function (insert) {
+ this.SetLayoutBlankLine(insert);
+ }
+ });
+
+ /**
+ * Sets the setting which specifies whether to show subtotals.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether to show subtotals.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/SetLayoutSubtotals.js
+ */
+ ApiPivotTable.prototype.SetLayoutSubtotals = function (show) {
+ if (typeof show == "boolean") {
+ var props = new Asc.CT_pivotTableDefinition();
+ props.asc_setDefaultSubtotal(show);
+ this.pivot.asc_set(this.api, props);
+ } else {
+ private_MakeError('Invalid type of "show".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "LayoutSubtotals", {
+ set: function (show) {
+ this.SetLayoutSubtotals(show);
+ }
+ });
+
+ /**
+ * Returns the parent object for the current pivot table.
+ * @memberof ApiPivotTable
+ * @typeofeditors ["CSE"]
+ * @returns {ApiWorksheet} - The parent object for the current pivot table.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotTable/Methods/GetParent.js
+ */
+ ApiPivotTable.prototype.GetParent = function () {
+ return new ApiWorksheet(this.pivot.worksheet);
+ };
+
+ Object.defineProperty(ApiPivotTable.prototype, "Parent", {
+ set: function () {
+ this.GetParent();
+ }
+ });
+
+ //------------------------------------------------------------------------------------------------------------------
+ //
+ // ApiPivotDataField
+ //
+ //------------------------------------------------------------------------------------------------------------------
+
+ /** Methods */
+
+ /**
+ * Removes the current data field from the category.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/Remove.js
+ */
+ ApiPivotDataField.prototype.Remove = function () {
+ this.table.pivot.asc_removeDataField(this.table.api, this.index, this.dataIndex);
+ };
+ /**
+ * Moves the current data field inside the category.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {PivotMoveFieldType | PivotFieldOrientationType} type - The direction to move the pivot table field,
+ * or the pivot field orientation type.
+ * @param {number} [index] - The index of the data field in a new category.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/Move.js
+ */
+ ApiPivotDataField.prototype.Move = function (type, index) {
+ function getIndexTo(type, indexFrom, fields) {
+ switch (type) {
+ case "Up":
+ return (indexFrom > 0) ? indexFrom - 1 : indexFrom;
+ case "Down":
+ return (indexFrom < fields.length - 1) ? indexFrom + 1 : fields.length - 1;
+ case "Begin":
+ return 0;
+ case "End":
+ return fields.length - 1;
+ default:
+ return null;
+ }
+ }
+ switch (type) {
+ case "Rows":
+ this.table.pivot.asc_moveToRowField(this.table.api, this.index, this.dataIndex, index);
+ break;
+ case "Columns":
+ this.table.pivot.asc_moveToColField(this.table.api, this.index, this.dataIndex, index);
+ break;
+ case "Filters":
+ this.table.pivot.asc_moveToPageField(this.table.api, this.index, this.dataIndex, index);
+ break;
+ case "Values":
+ this.SetPosition(index);
+ break;
+ default:
+ const fields = this.table.pivot.asc_getDataFields();
+ let indexFrom = this.dataIndex;
+ let indexTo = getIndexTo(type, indexFrom, fields);
+ if (indexTo != null) {
+ this.SetPosition(indexTo + 1);
+ } else {
+ private_MakeError("Bad move type.");
+ }
+ break;
+ }
+ }
+
+ /** Attributes */
+
+ /**
+ * The type of calculation to perform on the data field items.
+ * @typedef {"Average" | "CountNumbers" | "Count" | "Max" | "Min" | "Product" |
+ * "StdDev" | "StdDevP" | "Sum" | "Var" | "VarP"} DataConsolidateFunctionType
+ */
+
+ /**
+ * Sets a function to the current data field.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {DataConsolidateFunctionType} func - The function to perform in the added data field.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/SetFunction.js
+ */
+ ApiPivotDataField.prototype.SetFunction = function (func) {
+ const field = new Asc.CT_DataField();
+ switch (func) {
+ case "Average":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Average);
+ break;
+ case "Count":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Count);
+ break;
+ case "CountNumbers":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.CountNums);
+ break;
+ case "Max":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Max);
+ break;
+ case "Min":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Min);
+ break;
+ case "Product":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Product);
+ break;
+ case "StdDev":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.StdDev);
+ break;
+ case "StdDevP":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.StdDevp);
+ break;
+ case "Sum":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Sum);
+ break;
+ case "Var":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Var);
+ break;
+ case "VarP":
+ field.asc_setSubtotal(Asc.c_oAscDataConsolidateFunction.Varp);
+ break;
+ default:
+ private_MakeError('Invalid function type.');
+ return;
+ }
+ this.dataField.asc_set(this.table.api, this.table.pivot, this.dataIndex, field);
+ };
+ /**
+ * Returns a function performed in the data field.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {DataConsolidateFunctionType} func - The function performed in the added data field.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetFunction.js
+ */
+ ApiPivotDataField.prototype.GetFunction = function () {
+ const subtotal = this.dataField.asc_getSubtotal();
+ switch (subtotal) {
+ case Asc.c_oAscDataConsolidateFunction.Average:
+ return "Average";
+ case Asc.c_oAscDataConsolidateFunction.Count:
+ return "Count";
+ case Asc.c_oAscDataConsolidateFunction.CountNums:
+ return "CountNumbers";
+ case Asc.c_oAscDataConsolidateFunction.Max:
+ return "Max";
+ case Asc.c_oAscDataConsolidateFunction.Min:
+ return "Min";
+ case Asc.c_oAscDataConsolidateFunction.Product:
+ return "Product";
+ case Asc.c_oAscDataConsolidateFunction.StdDev:
+ return "StdDev";
+ case Asc.c_oAscDataConsolidateFunction.StdDevP:
+ return "StdDevP";
+ case Asc.c_oAscDataConsolidateFunction.Sum:
+ return "Sum";
+ case Asc.c_oAscDataConsolidateFunction.Var:
+ return "Var";
+ case Asc.c_oAscDataConsolidateFunction.VarP:
+ return "VarP";
+ }
+ };
+
+ /**
+ * Returns a value that represents the data field position within a category.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {number}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetPosition.js
+ */
+ ApiPivotDataField.prototype.GetPosition = function () {
+ return this.dataIndex + 1;
+ };
+
+ /**
+ * Sets a value that represents the data field position within a category.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {number} position - The data field position.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/SetPosition.js
+ */
+ ApiPivotDataField.prototype.SetPosition = function (position) {
+ const dataFields = this.table.pivot.asc_getDataFields();
+ if (typeof position === "number") {
+ if (dataFields[position] && this.index !== position - 1) {
+ this.table.pivot.asc_moveDataField(this.table.api, this.dataIndex, position - 1);
+ this.dataIndex = position - 1;
+ } else {
+ private_MakeError('Invalid position (out of range or the same).');
+ }
+ } else {
+ private_MakeError('Invalid type of "position".');
+ }
+ };
+
+ Object.defineProperty(ApiPivotDataField.prototype, "Position", {
+ get: function () {
+ return this.GetPosition();
+ },
+ set: function (position) {
+ this.SetPosition(position);
+ }
+ });
+ /**
+ * Returns a data field orientation value that represents the data field location in the specified pivot table report.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {PivotFieldOrientationType}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetOrientation.js
+ */
+ ApiPivotDataField.prototype.GetOrientation = function () {
+ if (this.dataField) {
+ return "Values";
+ }
+ return null;
+ };
+ Object.defineProperty(ApiPivotDataField.prototype, "Orientation", {
+ get: function () {
+ return this.GetOrientation();
+ },
+ });
+ /**
+ * Returns a value representing the name of the specified data field in the pivot table report.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetValue.js
+ */
+ ApiPivotDataField.prototype.GetValue = function () {
+ return this.GetName();
+ };
+
+ /**
+ * Sets a value representing the name of the specified data field in the pivot table report.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The name of the specified field in the pivot table report.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/SetValue.js
+ */
+ ApiPivotDataField.prototype.SetValue = function (name) {
+ this.SetName(name);
+ };
+
+ Object.defineProperty(ApiPivotDataField.prototype, "Value", {
+ get: function () {
+ return this.GetValue();
+ },
+ set: function (name) {
+ this.SetValue(name);
+ }
+ });
+ /**
+ * Returns a value that represents the label text for the data field.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetCaption.js
+ */
+ ApiPivotDataField.prototype.GetCaption = function () {
+ return this.GetName();
+ };
+ /**
+ * Sets a value that represents the label text for the data field.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {string} caption - The label text for the data field.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/SetCaption.js
+ */
+ ApiPivotDataField.prototype.SetCaption = function (caption) {
+ return this.SetName(caption);
+ };
+
+ Object.defineProperty(ApiPivotDataField.prototype, "Caption", {
+ get: function () {
+ return this.GetCaption();
+ },
+ set: function(caption) {
+ this.SetCaption(caption);
+ }
+ });
+
+ /**
+ * Returns a value representing the object name.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetName.js
+ */
+ ApiPivotDataField.prototype.GetName = function () {
+ return this.dataField.asc_getName();
+ };
+
+ /**
+ * Sets a value representing the object name.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The object name.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/SetName.js
+ */
+ ApiPivotDataField.prototype.SetName = function (name) {
+ if (typeof name === 'string' && name.length > 0) {
+ const field = new Asc.CT_DataField();
+ field.asc_setName(name);
+ this.dataField.asc_set(this.table.api, this.table.pivot, this.dataIndex, field);
+ } else {
+ private_MakeError('Bad name type or empty.');
+ }
+
+ };
+
+ Object.defineProperty(ApiPivotDataField.prototype, "Name", {
+ get: function () {
+ return this.GetName();
+ },
+ set: function (name) {
+ this.SetName(name);
+ }
+ });
+ /**
+ * Returns a value that represents the format code for the object.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {string | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetNumberFormat.js
+ */
+ ApiPivotDataField.prototype.GetNumberFormat = function () {
+ return this.dataField.asc_getNumFormat();
+ };
+ /**
+ * Sets a value that represents the format code for the object.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @param {string} format - The format code for the object.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/SetNumberFormat.js
+ */
+ ApiPivotDataField.prototype.SetNumberFormat = function (format) {
+ const newField = new Asc.CT_DataField();
+ newField.asc_setNumFormat(format);
+ this.dataField.asc_set(this.table.api, this.table.pivot, this.dataIndex, newField);
+ };
+ Object.defineProperty(ApiPivotDataField.prototype, "NumberFormat", {
+ get: function () {
+ return this.GetNumberFormat();
+ },
+ set: function (format) {
+ return this.SetNumberFormat(format);
+ }
+ });
+ /**
+ * Returns an index of the data field.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {number}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetIndex.js
+ */
+ ApiPivotDataField.prototype.GetIndex = function () {
+ return this.dataIndex + 1;
+ };
+
+ Object.defineProperty(ApiPivotDataField.prototype, "Index", {
+ get: function () {
+ return this.GetIndex();
+ }
+ });
+ /**
+ * Returns the pivot field from which the data field was created.
+ * @memberof ApiPivotDataField
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotField}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotDataField/Methods/GetPivotField.js
+ */
+ ApiPivotDataField.prototype.GetPivotField = function () {
+ return new ApiPivotField(this.table, this.index, this.pivotField);
+ };
+
+ Object.defineProperty(ApiPivotDataField.prototype, "PivotField", {
+ get: function () {
+ return this.GetPivotField();
+ }
+ });
+
+ //------------------------------------------------------------------------------------------------------------------
+ //
+ // ApiPivotField
+ //
+ //------------------------------------------------------------------------------------------------------------------
+
+ /** Methods */
+
+ /**
+ * Deletes all filters currently applied to the pivot field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/ClearAllFilters.js
+ */
+ ApiPivotField.prototype.ClearAllFilters = function () {
+ this.table.pivot.removeFiltersWithLock(this.table.api, [this.index], false);
+ };
+ /**
+ * Deletes all label filters or all date filters from the pivot filters collection.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/ClearLabelFilters.js
+ */
+ ApiPivotField.prototype.ClearLabelFilters = function () {
+ this.table.pivot.asc_removePivotFilter(this.table.api, this.index, false, true, false);
+ };
+ /**
+ * Deletes all manual filters from the pivot filters collection.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/ClearManualFilters.js
+ */
+ ApiPivotField.prototype.ClearManualFilters = function () {
+ this.table.pivot.asc_removePivotFilter(this.table.api, this.index, true, false, false);
+ };
+ /**
+ * Deletes all value filters from the pivot filters collection.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/ClearValueFilters.js
+ */
+ ApiPivotField.prototype.ClearValueFilters = function () {
+ this.table.pivot.asc_removePivotFilter(this.table.api, this.index, false, false, true);
+ };
+ /**
+ * Returns an object that represents either a single pivot table item (the ApiPivotItem object)
+ * or a collection of all the visible and hidden items (an array of the ApiPivotItem objects) in the specified field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {number} [index] - The item index.
+ * @returns {ApiPivotItem[] | ApiPivotItem | null}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetPivotItems.js
+ */
+ ApiPivotField.prototype.GetPivotItems = function (index) {
+ const pivotFields = this.table.pivot.asc_getPivotFields();
+ const pivotField = pivotFields[this.index];
+ if (index != null) {
+ const item = pivotField[index];
+ if (item && item.t === Asc.c_oAscItemType.Data) {
+ return new ApiPivotItem(this, item);
+ }
+ private_MakeError('Invalid item index.');
+ return null;
+ }
+ const items = pivotField.getItems();
+ const t = this;
+ return items.filter(function (item) {
+ return Asc.c_oAscItemType.Data === item.t;
+ }).map(function (item, index) {
+ return new ApiPivotItem(t, item);
+ })
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "PivotItems", {
+ get: function (index) {
+ return this.GetPivotItems(index);
+ }
+ });
+ /**
+ * Moves the current pivot field inside the category.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {PivotMoveFieldType | PivotFieldOrientationType} type - The direction to move the pivot table field,
+ * or the pivot field orientation type.
+ * @param {number | undefined} index - The field index in a new category.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/Move.js
+ */
+ ApiPivotField.prototype.Move = function (type, index) {
+ function getIndexTo(type, indexFrom, fields) {
+ switch (type) {
+ case "Up":
+ return (indexFrom > 0) ? indexFrom - 1 : indexFrom;
+ case "Down":
+ return (indexFrom < fields.length - 1) ? indexFrom + 1 : fields.length - 1;
+ case "Begin":
+ return 0;
+ case "End":
+ return fields.length - 1;
+ default:
+ return null;
+ }
+ }
+ if (index == null) {
+ index = 0;
+ }
+ switch (type) {
+ case "Rows":
+ if (this.pivotField.axis !== Asc.c_oAscAxis.AxisRow) {
+ this.table.pivot.asc_moveToRowField(this.table.api, this.index, undefined, index - 1);
+ } else {
+ this.SetPosition(index)
+ }
+ break;
+ case "Columns":
+ if (this.pivotField.axis !== Asc.c_oAscAxis.AxisCol) {
+ this.table.pivot.asc_moveToColField(this.table.api, this.index, undefined, index - 1);
+ } else {
+ this.SetPosition(index)
+ }
+ break;
+ case "Filters":
+ if (this.pivotField.axis !== Asc.c_oAscAxis.AxisPage) {
+ this.table.pivot.asc_moveToPageField(this.table.api, this.index, undefined, index - 1);
+ } else {
+ this.SetPosition(index)
+ }
+ break;
+ case "Values":
+ this.table.pivot.asc_moveToDataField(this.table.api, this.index, undefined, index - 1);
+ break;
+ case "Hidden":
+ this.Remove();
+ break;
+ default:
+ const fields = this.table.pivot.getAxisFields(this.pivotField.axis);
+ if (fields) {
+ let indexFrom = null;
+ for (let i = 0; i < fields.length; i += 1) {
+ if (fields[i].asc_getIndex() === this.index) {
+ indexFrom = i;
+ break;
+ }
+ }
+ let indexTo = getIndexTo(type, indexFrom, fields);
+ if (indexTo != null) {
+ this.SetPosition(indexTo + 1);
+ } else {
+ private_MakeError("Bad move type.");
+ }
+ } else {
+ private_MakeError("Field is hidden.");
+ }
+ break;
+ }
+ };
+ /**
+ * Removes the current pivot field from the pivot table.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/Remove.js
+ */
+ ApiPivotField.prototype.Remove = function () {
+ this.table.pivot.asc_removeNoDataField(this.table.api, this.index);
+ };
+
+ /** Attributes */
+
+ /**
+ * Returns a value that represents the position of the field (first, second, third, and so on)
+ * among all the fields in its orientation (Rows, Columns, Pages, Data).
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {number}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetPosition.js
+ */
+ ApiPivotField.prototype.GetPosition = function () {
+ const fields = this.table.pivot.getAxisFields(this.pivotField.axis);
+ if (fields) {
+ for (let i = 0; i < fields.length; i += 1) {
+ if (fields[i].asc_getIndex() === this.index) {
+ return i + 1;
+ }
+ }
+ }
+ private_MakeError('The field is hidden.\n' +
+ 'If you need to get the position of the data field then use ApiPivotDataField.GetPosition.\n' +
+ 'See ApiPivotTable.GetDataFields or ApiPivotTable.GetPivotFields with dataField identifier to get ' +
+ 'ApiPivotDataField object');
+ };
+
+ /**
+ * Sets a value that represents the position of the field (first, second, third, and so on)
+ * among all the fields in its orientation (Rows, Columns, Pages, Data).
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {number} position - The field position.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetPosition.js
+ */
+ ApiPivotField.prototype.SetPosition = function (position) {
+ if (typeof position == "number") {
+ if (this.pivotField.axis === null) {
+ private_MakeError('The field is hidden.\n' +
+ 'If you need to set the position of the data field then use ApiPivotDataField.SetPosition.\n' +
+ 'See ApiPivotTable.GetDataFields or ApiPivotTable.GetPivotFields with dataField identifier to get ' +
+ 'ApiPivotDataField object');
+ return;
+ }
+ if (!this.table.pivot.moveFieldInAxis(this.table.api, this.index, this.pivotField.axis, position - 1)) {
+ private_MakeError('Invalid position (out of range or the same).')
+ }
+ } else {
+ private_MakeError('Invalid type of "position".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Position", {
+ get: function () {
+ return this.GetPosition();
+ },
+ set: function (position) {
+ this.SetPosition(position);
+ }
+ });
+
+ /**
+ * Returns a pivot field orientation value that represents the location
+ * of the field in the specified pivot table report.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {PivotFieldOrientationType}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetOrientation.js
+ */
+ ApiPivotField.prototype.GetOrientation = function () {
+ if (this.pivotField.axis === Asc.c_oAscAxis.AxisRow) {
+ return "Rows";
+ } else if (this.pivotField.axis === Asc.c_oAscAxis.AxisCol) {
+ return "Columns";
+ } else if (this.pivotField.axis === Asc.c_oAscAxis.AxisPage) {
+ return "Filters"
+ } else {
+ return "Hidden"
+ }
+ };
+
+ /**
+ * Sets a pivot field orientation value that represents the location
+ * of the field in the specified pivot table report.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {PivotFieldOrientationType} type - The pivot field orientation type.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetOrientation.js
+ */
+ ApiPivotField.prototype.SetOrientation = function (type) {
+ switch (type) {
+ case "Rows":
+ if (this.pivotField.axis !== Asc.c_oAscAxis.AxisRow) {
+ this.table.pivot.asc_moveToRowField(this.table.api, this.index);
+ } else {
+ private_MakeError('The field already has that orientation.')
+ }
+ break;
+ case "Columns":
+ if (this.pivotField.axis !== Asc.c_oAscAxis.AxisCol) {
+ this.table.pivot.asc_moveToColField(this.table.api, this.index);
+ } else {
+ private_MakeError('The field already has that orientation.')
+ }
+ break;
+ case "Filters":
+ if (this.pivotField.axis !== Asc.c_oAscAxis.AxisPage) {
+ this.table.pivot.asc_moveToPageField(this.table.api, this.index);
+ } else {
+ private_MakeError('The field already has that orientation.')
+ }
+ break;
+ case "Values":
+ this.table.pivot.asc_moveToDataField(this.table.api, this.index);
+ break;
+ case "Hidden":
+ this.Remove();
+ break;
+ default:
+ private_MakeError('Invalid "type" value.');
+ break;
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Orientation", {
+ get: function () {
+ return this.GetOrientation();
+ },
+ set: function (type) {
+ this.SetOrientation(type);
+ }
+ });
+ /**
+ * Returns a value representing the name of the specified field in the pivot table report.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetValue.js
+ */
+ ApiPivotField.prototype.GetValue = function () {
+ return this.GetName();
+ };
+
+ /**
+ * Sets a value representing the name of the specified field in the pivot table report.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The name of the specified field in the pivot table report.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetValue.js
+ */
+ ApiPivotField.prototype.SetValue = function (name) {
+ this.SetName(name)
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Value", {
+ get: function () {
+ return this.GetValue();
+ },
+ set: function (name) {
+ this.SetValue(name);
+ }
+ });
+ /**
+ * Returns a value that represents the label text for the pivot field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetCaption.js
+ */
+ ApiPivotField.prototype.GetCaption = function () {
+ return this.GetName();
+ };
+ /**
+ * Sets a value that represents the label text for the pivot field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {string} caption - The label text for the pivot field.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetCaption.js
+ */
+ ApiPivotField.prototype.SetCaption = function (caption) {
+ return this.SetName(caption);
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Caption", {
+ get: function () {
+ return this.GetCaption();
+ },
+ set: function(caption) {
+ this.SetCaption(caption);
+ }
+ });
+
+ /**
+ * Returns a value representing the object name.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetName.js
+ */
+ ApiPivotField.prototype.GetName = function () {
+ return this.pivotField.asc_getName() || this.GetSourceName();
+ };
+
+ /**
+ * Sets a value representing the object name.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {string} name - The object name.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetName.js
+ */
+ ApiPivotField.prototype.SetName = function (name) {
+ if (typeof name === 'string' && name.length > 0) {
+ const field = new Asc.CT_PivotField();
+ field.asc_setName(name);
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Bad name type or empty.');
+ }
+
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Name", {
+ get: function () {
+ return this.GetName();
+ },
+ set: function (name) {
+ this.SetName(name);
+ }
+ });
+ /**
+ * Returns a source name for the pivot table field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetSourceName.js
+ */
+ ApiPivotField.prototype.GetSourceName = function () {
+ return this.table.pivot.getCacheFieldName(this.index);
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "SourceName", {
+ get: function () {
+ return this.GetSourceName();
+ }
+ });
+
+ /**
+ * Returns an index for the pivot table field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {number}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetIndex.js
+ */
+ ApiPivotField.prototype.GetIndex = function () {
+ return this.index + 1;
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Index", {
+ get: function () {
+ return this.GetIndex();
+ }
+ });
+
+ /**
+ * Returns the ApiPivotTable object which represents the pivot table for the current field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotTable}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetTable.js
+ */
+ ApiPivotField.prototype.GetTable = function () {
+ return this.table;
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Table", {
+ get: function () {
+ return this.GetTable();
+ }
+ });
+
+ /**
+ * Returns the parent object for the current field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotTable}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetParent.js
+ */
+ ApiPivotField.prototype.GetParent = function () {
+ return this.table;
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Parent", {
+ get: function () {
+ return this.GetParent();
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether a pivot table field is compacted.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetLayoutCompactRow.js
+ */
+ ApiPivotField.prototype.GetLayoutCompactRow = function () {
+ const pivField = this.table.pivot.asc_getPivotFields()[this.index];
+ return (pivField.asc_getOutline() && pivField.asc_getCompact());
+ };
+
+ /**
+ * Sets the setting which specifies whether a pivot table field is compacted.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} compact - Specifies whether a pivot table field is compacted.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetLayoutCompactRow.js
+ */
+ ApiPivotField.prototype.SetLayoutCompactRow = function (compact) {
+ if (typeof compact == "boolean") {
+ const field = new Asc.CT_PivotField();
+ const pivField = this.table.pivot.asc_getPivotFields()[this.index];
+ field.asc_setCompact( (pivField.asc_getOutline() && compact) );
+ pivField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "compact".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "LayoutCompactRow", {
+ get: function () {
+ return this.GetLayoutCompactRow();
+ },
+ set: function (compact) {
+ this.SetLayoutCompactRow(compact);
+ }
+ });
+
+ /**
+ * The layout type of the pivot table report.
+ * @typedef {"Tabular" | "Outline"} PivotLayoutType
+ */
+
+ /**
+ * Returns the way the specified pivot table items appear — in table format or in outline format.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {PivotLayoutType}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetLayoutForm.js
+ */
+ ApiPivotField.prototype.GetLayoutForm = function () {
+ return this.pivotField.asc_getOutline() ? "Outline" : "Tabular";
+ };
+
+ /**
+ * Sets the way the specified pivot table items appear — in table format or in outline format.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {PivotLayoutType} type - The layout type of the pivot table report.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetLayoutForm.js
+ */
+ ApiPivotField.prototype.SetLayoutForm = function (type) {
+ if (type === "Tabular" || type === "Outline") {
+ const newField = new Asc.CT_PivotField();
+ newField.asc_setOutline(type === "Outline");
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, newField);
+ } else {
+ private_MakeError('Invalid type of "type" or invalid value.')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "LayoutForm", {
+ get: function () {
+ return this.GetLayoutForm();
+ },
+ set: function (type) {
+ this.SetLayoutForm(type);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether to insert a page break after each field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetLayoutPageBreak.js
+ */
+ ApiPivotField.prototype.GetLayoutPageBreak = function () {
+ return this.pivotField.insertPageBreak;
+ };
+
+ /**
+ * Sets the setting which specifies whether to insert a page break after each field.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} insert - Specifies whether to insert a page break after each field.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetLayoutPageBreak.js
+ */
+ ApiPivotField.prototype.SetLayoutPageBreak = function (insert) {
+ if ( typeof insert == "boolean") {
+ this.pivotField.insertPageBreak = insert;
+ } else {
+ private_MakeError('Invalid type of "insert".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "LayoutPageBreak", {
+ get: function () {
+ return this.GetLayoutPageBreak();
+ },
+ set: function (type) {
+ this.SetLayoutPageBreak(type);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the pivot table field is currently visible in the pivot table.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetShowingInAxis.js
+ */
+ ApiPivotField.prototype.GetShowingInAxis = function () {
+ return this.pivotField.axis !== null || this.pivotField.dataField;
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "ShowingInAxis", {
+ get: function () {
+ return this.GetShowingInAxis();
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether to repeat items labels at each row.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetRepeatLabels.js
+ */
+ ApiPivotField.prototype.GetRepeatLabels = function () {
+ return this.pivotField.asc_getFillDownLabelsDefault();
+ };
+
+ /**
+ * Sets the setting which specifies whether to repeat items labels at each row.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} repeat - Specifies whether to repeat items labels at each row.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetRepeatLabels.js
+ */
+ ApiPivotField.prototype.SetRepeatLabels = function (repeat) {
+ if (typeof repeat == "boolean") {
+ const field = new Asc.CT_PivotField();
+ field.asc_setFillDownLabelsDefault(repeat);
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "repeat".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "RepeatLabels", {
+ get: function () {
+ return this.GetRepeatLabels();
+ },
+ set: function (repeat) {
+ this.SetRepeatLabels(repeat);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether to insert blank rows after each item.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetLayoutBlankLine.js
+ */
+ ApiPivotField.prototype.GetLayoutBlankLine = function () {
+ return this.pivotField.asc_getInsertBlankRow();
+ };
+
+ /**
+ * Sets the setting which specifies whether to insert blank rows after each item.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} insert - Specifies whether to insert blank rows after each item.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetLayoutBlankLine.js
+ */
+ ApiPivotField.prototype.SetLayoutBlankLine = function (insert) {
+ if (typeof insert == "boolean") {
+ const field = new Asc.CT_PivotField();
+ field.asc_setInsertBlankRow(insert);
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "insert".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "LayoutBlankLine", {
+ get: function () {
+ return this.GetLayoutBlankLine();
+ },
+ set: function (insert) {
+ this.SetLayoutBlankLine(insert);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether to show items with no data.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetShowAllItems.js
+ */
+ ApiPivotField.prototype.GetShowAllItems = function () {
+ return this.pivotField.asc_getShowAll();
+ };
+
+ /**
+ * Sets the setting which specifies whether to show items with no data.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether to show items with no data.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetShowAllItems.js
+ */
+ ApiPivotField.prototype.SetShowAllItems = function (show) {
+ if (typeof show == "boolean") {
+ const field = new Asc.CT_PivotField();
+ field.asc_setShowAll(show);
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "show".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "ShowAllItems", {
+ get: function () {
+ return this.GetShowAllItems();
+ },
+ set: function (show) {
+ this.SetShowAllItems(show);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether to show subtotals.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetLayoutSubtotals.js
+ */
+ ApiPivotField.prototype.GetLayoutSubtotals = function () {
+ return this.pivotField.asc_getDefaultSubtotal();
+ };
+
+ /**
+ * Sets the setting which specifies whether to show subtotals.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} show - Specifies whether to show subtotals.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetLayoutSubtotals.js
+ */
+ ApiPivotField.prototype.SetLayoutSubtotals = function (show) {
+ if (typeof show == "boolean") {
+ const field = new Asc.CT_PivotField();
+ field.asc_setDefaultSubtotal(show);
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "show".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "LayoutSubtotals", {
+ get: function () {
+ return this.GetLayoutSubtotals();
+ },
+ set: function (show) {
+ this.SetLayoutSubtotals(show);
+ }
+ });
+
+ /**
+ * The layout subtotal location.
+ * @typedef { "Top" | "Bottom" } LayoutSubtotalLocationType
+ */
+
+ /**
+ * Returns the layout subtotal location.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {LayoutSubtotalLocationType}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetLayoutSubtotalLocation.js
+ */
+ ApiPivotField.prototype.GetLayoutSubtotalLocation = function () {
+ return ( this.pivotField.asc_getSubtotalTop() ? "Top" : "Bottom" );
+ };
+
+ /**
+ * Sets the layout subtotal location.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {LayoutSubtotalLocationType} type - The layout subtotal location.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetLayoutSubtotalLocation.js
+ */
+ ApiPivotField.prototype.SetLayoutSubtotalLocation = function (type) {
+ if (typeof type == "string" && ( type == "Top" || type == "Bottom")) {
+ const field = new Asc.CT_PivotField();
+ field.asc_setSubtotalTop( (type == "Top") );
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "type" or invalid value.')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "LayoutSubtotalLocation", {
+ get: function () {
+ return this.GetLayoutSubtotalLocation();
+ },
+ set: function (type) {
+ this.SetLayoutSubtotalLocation(type);
+ }
+ });
+
+ /**
+ * Returns the text label displayed in the subtotal column or row heading in the specified pivot table report.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetSubtotalName.js
+ */
+ ApiPivotField.prototype.GetSubtotalName = function () {
+ return (this.pivotField.subtotalCaption);
+ };
+
+ /**
+ * Sets the text label displayed in the subtotal column or row heading in the specified pivot table report.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {string} caption - The text label displayed in the subtotal column or row heading.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetSubtotalName.js
+ */
+ ApiPivotField.prototype.SetSubtotalName = function (caption) {
+ if ( typeof caption == "string") {
+ const field = new Asc.CT_PivotField();
+ field.subtotalCaption = caption.trim();
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ } else {
+ private_MakeError('Invalid type of "caption".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "SubtotalName", {
+ get: function () {
+ return this.GetSubtotalName();
+ },
+ set: function (caption) {
+ this.SetSubtotalName(caption);
+ }
+ });
+
+ /**
+ * Subtotal pivot field types (functions for subtotals).
+ * @typedef {Object} PivotFieldSubtotals
+ * @property {boolean} Sum - Specififes whether the SUM function will be used.
+ * @property {boolean} Count - Specififes whether the COUNTA function will be used.
+ * @property {boolean} Average - Specififes whether the AVERAGE function will be used.
+ * @property {boolean} Max - Specififes whether the MAX function will be used.
+ * @property {boolean} Min - Specififes whether the MIN function will be used.
+ * @property {boolean} Product - Specififes whether the PRODUCT function will be used.
+ * @property {boolean} CountNumbers - Specififes whether the COUNT function will be used.
+ * @property {boolean} StdDev - Specififes whether the STDEV function will be used.
+ * @property {boolean} StdDevP - Specififes whether the STDEV.P function will be used.
+ * @property {boolean} Var - Specififes whether the VAR function will be used.
+ * @property {boolean} VarP - Specififes whether the VAR.P function will be used.
+ */
+
+ /**
+ * Returns an object that represents all subtotals.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {PivotFieldSubtotals}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetSubtotals.js
+ */
+ ApiPivotField.prototype.GetSubtotals = function () {
+ const res = {
+ 'Sum': false,
+ 'Count': false,
+ 'Average': false,
+ 'Max': false,
+ 'Min': false,
+ 'Product': false,
+ 'CountNumbers': false,
+ 'StdDev': false,
+ 'StdDevP': false,
+ 'Var': false,
+ 'VarP': false
+ };
+ if (this.pivotField.asc_getDefaultSubtotal()) {
+ const subtotals = this.pivotField.asc_getSubtotals();
+ for (var i = 0; i < subtotals.length; i++) {
+ switch (subtotals[i]) {
+ case Asc.c_oAscItemType.Sum:
+ res['Sum'] = true;
+ break;
+ case Asc.c_oAscItemType.CountA:
+ res['Count'] = true;
+ break;
+ case Asc.c_oAscItemType.Avg:
+ res['Average'] = true;
+ break;
+ case Asc.c_oAscItemType.Max:
+ res['Max'] = true;
+ break;
+ case Asc.c_oAscItemType.Min:
+ res['Min'] = true;
+ break;
+ case Asc.c_oAscItemType.Product:
+ res['Product'] = true;
+ break;
+ case Asc.c_oAscItemType.Count:
+ res['CountNumbers'] = true;
+ break;
+ case Asc.c_oAscItemType.StdDev:
+ res['StdDev'] = true;
+ break;
+ case Asc.c_oAscItemType.StdDevP:
+ res['StdDevP'] = true;
+ break;
+ case Asc.c_oAscItemType.Var:
+ res['Var'] = true;
+ break;
+ case Asc.c_oAscItemType.VarP:
+ res['VarP'] = true;
+ break;
+ }
+ }
+ }
+ return res;
+ };
+
+ /**
+ * Sets an object that represents all subtotals.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {PivotFieldSubtotals} subtotals - An object that represents all subtotals or some of them.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetSubtotals.js
+ */
+ ApiPivotField.prototype.SetSubtotals = function (subtotals) {
+ if (typeof subtotals == "object") {
+ const field = new Asc.CT_PivotField();
+ const arr = [];
+ if (this.pivotField.asc_getDefaultSubtotal()) {
+ if (subtotals.hasOwnProperty('Sum') && subtotals['Sum']) {
+ arr.push(Asc.c_oAscItemType.Sum);
+ }
+ if (subtotals.hasOwnProperty('Count') && subtotals['Count']) {
+ arr.push(Asc.c_oAscItemType.CountA);
+ }
+ if (subtotals.hasOwnProperty('Average') && subtotals['Average']) {
+ arr.push(Asc.c_oAscItemType.Avg);
+ }
+ if (subtotals.hasOwnProperty('Max') && subtotals['Max']) {
+ arr.push(Asc.c_oAscItemType.Max);
+ }
+ if (subtotals.hasOwnProperty('Min') && subtotals['Min']) {
+ arr.push(Asc.c_oAscItemType.Min);
+ }
+ if (subtotals.hasOwnProperty('Product') && subtotals['Product']) {
+ arr.push(Asc.c_oAscItemType.Product);
+ }
+ if (subtotals.hasOwnProperty('CountNumbers') && subtotals['CountNumbers']) {
+ arr.push(Asc.c_oAscItemType.Count);
+ }
+ if (subtotals.hasOwnProperty('StdDev') && subtotals['StdDev']) {
+ arr.push(Asc.c_oAscItemType.StdDev);
+ }
+ if (subtotals.hasOwnProperty('StdDevP') && subtotals['StdDevP']) {
+ arr.push(Asc.c_oAscItemType.StdDevP);
+ }
+ if (subtotals.hasOwnProperty('Var') && subtotals['Var']) {
+ arr.push(Asc.c_oAscItemType.Var);
+ }
+ if (subtotals.hasOwnProperty('VarP') && subtotals['VarP']) {
+ arr.push(Asc.c_oAscItemType.VarP);
+ }
+ }
+ if (arr.length) {
+ field.asc_setSubtotals(arr);
+ this.pivotField.asc_set(this.table.api, this.table.pivot, this.index, field);
+ }
+ } else {
+ private_MakeError('Invalid type of "subtotals".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Subtotals", {
+ get: function () {
+ return this.GetSubtotals();
+ },
+ set: function (subtotals) {
+ this.SetSubtotals(subtotals);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the specified field can be dragged to the column position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetDragToColumn.js
+ */
+ ApiPivotField.prototype.GetDragToColumn = function () {
+ return this.pivotField.dragToCol;
+ };
+
+ /**
+ * Sets the setting which specifies whether the specified field can be dragged to the column position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} flag - Specifies whether the specified field can be dragged to the column position.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetDragToColumn.js
+ */
+ ApiPivotField.prototype.SetDragToColumn = function (flag) {
+ if (typeof flag == "boolean") {
+ this.pivotField.dragToCol = flag;
+ } else {
+ private_MakeError('Invalid type of "flag".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "DragToColumn", {
+ get: function () {
+ return this.GetDragToColumn();
+ },
+ set: function (flag) {
+ this.SetDragToColumn(flag);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the specified field can be dragged to the row position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetDragToRow.js
+ */
+ ApiPivotField.prototype.GetDragToRow = function () {
+ return this.pivotField.dragToRow;
+ };
+
+ /**
+ * Sets the setting which specifies whether the specified field can be dragged to the row position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} flag - Specifies whether the specified field can be dragged to the row position.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetDragToRow.js
+ */
+ ApiPivotField.prototype.SetDragToRow = function (flag) {
+ if (typeof flag == "boolean") {
+ this.pivotField.dragToRow = flag;
+ } else {
+ private_MakeError('Invalid type of "flag".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "DragToRow", {
+ get: function () {
+ return this.GetDragToRow();
+ },
+ set: function (flag) {
+ this.SetDragToRow(flag);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the specified field can be dragged to the data position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetDragToData.js
+ */
+ ApiPivotField.prototype.GetDragToData = function () {
+ return this.pivotField.dragToData;
+ };
+
+ /**
+ * Sets the setting which specifies whether the specified field can be dragged to the data position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} flag - Specifies whether the specified field can be dragged to the data position.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetDragToData.js
+ */
+ ApiPivotField.prototype.SetDragToData = function (flag) {
+ if (typeof flag == "boolean") {
+ this.pivotField.dragToData = flag;
+ } else {
+ private_MakeError('Invalid type of "flag".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "DragToData", {
+ get: function () {
+ return this.GetDragToData();
+ },
+ set: function (flag) {
+ this.SetDragToData(flag);
+ }
+ });
+
+ /**
+ * Returns the setting which specifies whether the specified field can be dragged to the page position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {boolean}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetDragToPage.js
+ */
+ ApiPivotField.prototype.GetDragToPage = function () {
+ return this.pivotField.dragToPage;
+ };
+
+ /**
+ * Sets the setting which specifies whether the specified field can be dragged to the page position.
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @param {boolean} flag - Specifies whether the specified field can be dragged to the page position.
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/SetDragToPage.js
+ */
+ ApiPivotField.prototype.SetDragToPage = function (flag) {
+ if (typeof flag == "boolean") {
+ this.pivotField.dragToPage = flag;
+ } else {
+ private_MakeError('Invalid type of "flag".')
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "DragToPage", {
+ get: function () {
+ return this.GetDragToPage();
+ },
+ set: function (flag) {
+ this.SetDragToPage(flag);
+ }
+ });
+
+ /**
+ * Returns the current page which is displayed for the page field (valid only for page fields).
+ * @memberof ApiPivotField
+ * @typeofeditors ["CSE"]
+ * @returns {string | number}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotField/Methods/GetCurrentPage.js
+ */
+ ApiPivotField.prototype.GetCurrentPage = function () {
+ const pageFields = this.table.pivot.asc_getPageFields();
+ const t = this;
+ const pageIndex = pageFields.findIndex(function(pageField) {
+ return pageField.asc_getIndex() === t.index;
+ });
+ if (this.pivotField.axis === Asc.c_oAscAxis.AxisPage) {
+ const val = this.table.pivot.getPageFieldCellValue(pageIndex);
+ return val.text || val.number || val.multiText;
+ } else {
+ private_MakeError("It is not possible from this field.");
+ }
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "CurrentPage", {
+ get: function () {
+ return this.GetCurrentPage();
+ }
+ });
+
+ ApiPivotField.prototype.GetFunction = function () {
+ private_MakeError('This method can only be called on a data field.\n' +
+ 'See ApiPivotTable.GetDataFields or ApiPivotTable.GetPivotFields with dataField identifier to get ApiPivotDataField object');
+ return null;
+ };
+ ApiPivotField.prototype.SetFunction = function () {
+ private_MakeError('This method can only be called on a data field.\n' +
+ 'See ApiPivotTable.GetDataFields or ApiPivotTable.GetPivotFields with dataField identifier to get ApiPivotDataField object');
+ return null;
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "Function", {
+ get: function () {
+ return this.GetFunction();
+ },
+ set: function () {
+ this.SetFunction()
+ }
+ });
+
+ ApiPivotField.prototype.GetNumberFormat = function () {
+ private_MakeError('This method can only be called on a data field.\n' +
+ 'See ApiPivotTable.GetDataFields or ApiPivotTable.GetPivotFields with dataField identifier to get ApiPivotDataField object');
+ return null;
+ };
+ ApiPivotField.prototype.SetNumberFormat = function () {
+ private_MakeError('This method can only be called on a data field.\n' +
+ 'See ApiPivotTable.GetDataFields or ApiPivotTable.GetPivotFields with dataField identifier to get ApiPivotDataField object');
+ return null;
+ };
+
+ Object.defineProperty(ApiPivotField.prototype, "NumberFormat", {
+ get: function () {
+ return this.GetNumberFormat();
+ },
+ set: function () {
+ this.SetNumberFormat()
+ }
+ });
+
+ //------------------------------------------------------------------------------------------------------------------
+ //
+ // ApiPivotItem
+ //
+ //------------------------------------------------------------------------------------------------------------------
+
+ /* Attributes */
+
+ /**
+ * Returns a name of the pivot item.
+ * @memberof ApiPivotItem
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotItem/Methods/GetName.js
+ */
+ ApiPivotItem.prototype.GetName = function () {
+ if (this.pivotItem.n) {
+ return this.pivotItem.n;
+ }
+ const pivot = this.field.table.pivot;
+ const cacheField = pivot.asc_getCacheFields()[this.field.index];
+ const sharedItem = cacheField.getGroupOrSharedItem(this.pivotItem.x);
+ if (sharedItem) {
+ return sharedItem.getCellValue().getTextValue();
+ }
+ };
+
+ Object.defineProperty(ApiPivotItem.prototype, "Name", {
+ get: function () {
+ return this.GetName();
+ }
+ });
+
+ /**
+ * Returns a caption of the pivot item.
+ * @memberof ApiPivotItem
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotItem/Methods/GetCaption.js
+ */
+ ApiPivotItem.prototype.GetCaption = function () {
+ return this.GetName();
+ };
+
+ Object.defineProperty(ApiPivotItem.prototype, "Caption", {
+ get: function () {
+ return this.GetCaption();
+ }
+ });
+
+ /**
+ * Returns a name of the specified item in the pivot table field.
+ * @memberof ApiPivotItem
+ * @typeofeditors ["CSE"]
+ * @returns {string}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotItem/Methods/GetValue.js
+ */
+ ApiPivotItem.prototype.GetValue = function () {
+ return this.GetName();
+ };
+
+ Object.defineProperty(ApiPivotItem.prototype, "Value", {
+ get: function () {
+ return this.GetValue();
+ }
+ });
+
+ /**
+ * Returns a parent of the pivot item.
+ * @memberof ApiPivotItem
+ * @typeofeditors ["CSE"]
+ * @returns {ApiPivotField}
+ * @since 8.2.0
+ * @see office-js-api/Examples/{Editor}/ApiPivotItem/Methods/GetParent.js
+ */
+ ApiPivotItem.prototype.GetParent = function () {
+ return this.field;
+ };
+
+ Object.defineProperty(ApiPivotItem.prototype, "Parent", {
+ get: function () {
+ return this.GetParent();
+ }
+ });
+
+ Api.prototype["Format"] = Api.prototype.Format;
+ Api.prototype["AddSheet"] = Api.prototype.AddSheet;
+ Api.prototype["GetSheets"] = Api.prototype.GetSheets;
+ Api.prototype["GetActiveSheet"] = Api.prototype.GetActiveSheet;
+ Api.prototype["GetLocale"] = Api.prototype.GetLocale;
+ Api.prototype["SetLocale"] = Api.prototype.SetLocale;
+ Api.prototype["GetSheet"] = Api.prototype.GetSheet;
+ Api.prototype["GetThemesColors"] = Api.prototype.GetThemesColors;
+ Api.prototype["SetThemeColors"] = Api.prototype.SetThemeColors;
+ Api.prototype["CreateNewHistoryPoint"] = Api.prototype.CreateNewHistoryPoint;
+ Api.prototype["CreateColorFromRGB"] = Api.prototype.CreateColorFromRGB;
+ Api.prototype["CreateColorByName"] = Api.prototype.CreateColorByName;
+ Api.prototype["Intersect"] = Api.prototype.Intersect;
+ Api.prototype["GetSelection"] = Api.prototype.GetSelection;
+ Api.prototype["AddDefName"] = Api.prototype.AddDefName;
+ Api.prototype["GetDefName"] = Api.prototype.GetDefName;
+ Api.prototype["Save"] = Api.prototype.Save;
+ Api.prototype["GetMailMergeData"] = Api.prototype.GetMailMergeData;
+
+ Api.prototype["GetRange"] = Api.prototype.GetRange;
+
+ Api.prototype["RecalculateAllFormulas"] = Api.prototype.RecalculateAllFormulas;
+ Api.prototype["AddComment"] = Api.prototype.AddComment;
+ Api.prototype["GetComments"] = Api.prototype.GetComments;
+ Api.prototype["GetAllComments"] = Api.prototype.GetAllComments;
+ Api.prototype["GetCommentById"] = Api.prototype.GetCommentById;
+ Api.prototype["SetFreezePanesType"] = Api.prototype.SetFreezePanesType;
+ Api.prototype["GetFreezePanesType"] = Api.prototype.GetFreezePanesType;
+ Api.prototype["GetDocumentInfo"] = Api.prototype.GetDocumentInfo;
+
+ Api.prototype["AddCustomFunction"] = Api.prototype.AddCustomFunction;
+ Api.prototype["RemoveCustomFunction"] = Api.prototype.RemoveCustomFunction;
+ Api.prototype["ClearCustomFunctions"] = Api.prototype.ClearCustomFunctions;
+ Api.prototype["AddCustomFunctionLibrary"] = Api.prototype.AddCustomFunctionLibrary;
+
+ Api.prototype["GetReferenceStyle"] = Api.prototype.GetReferenceStyle;
+ Api.prototype["SetReferenceStyle"] = Api.prototype.SetReferenceStyle;
+
+ Api.prototype["GetWorksheetFunction"] = Api.prototype.GetWorksheetFunction;
+ Api.prototype["InsertPivotExistingWorksheet"] = Api.prototype.InsertPivotExistingWorksheet;
+ Api.prototype["InsertPivotNewWorksheet"] = Api.prototype.InsertPivotNewWorksheet;
+ Api.prototype["GetPivotByName"] = Api.prototype.GetPivotByName;
+ Api.prototype["RefreshAllPivots"] = Api.prototype.RefreshAllPivots;
+ Api.prototype["GetAllPivotTables"] = Api.prototype.GetAllPivotTables;
+
+ ApiWorksheet.prototype["GetVisible"] = ApiWorksheet.prototype.GetVisible;
+ ApiWorksheet.prototype["SetVisible"] = ApiWorksheet.prototype.SetVisible;
+ ApiWorksheet.prototype["SetActive"] = ApiWorksheet.prototype.SetActive;
+ ApiWorksheet.prototype["GetActiveCell"] = ApiWorksheet.prototype.GetActiveCell;
+ ApiWorksheet.prototype["GetSelection"] = ApiWorksheet.prototype.GetSelection;
+ ApiWorksheet.prototype["GetCells"] = ApiWorksheet.prototype.GetCells;
+ ApiWorksheet.prototype["GetCols"] = ApiWorksheet.prototype.GetCols;
+ ApiWorksheet.prototype["GetRows"] = ApiWorksheet.prototype.GetRows;
+ ApiWorksheet.prototype["GetUsedRange"] = ApiWorksheet.prototype.GetUsedRange;
+ ApiWorksheet.prototype["GetName"] = ApiWorksheet.prototype.GetName;
+ ApiWorksheet.prototype["SetName"] = ApiWorksheet.prototype.SetName;
+ ApiWorksheet.prototype["GetIndex"] = ApiWorksheet.prototype.GetIndex;
+ ApiWorksheet.prototype["GetRange"] = ApiWorksheet.prototype.GetRange;
+ ApiWorksheet.prototype["GetRangeByNumber"] = ApiWorksheet.prototype.GetRangeByNumber;
+ ApiWorksheet.prototype["FormatAsTable"] = ApiWorksheet.prototype.FormatAsTable;
+ ApiWorksheet.prototype["SetColumnWidth"] = ApiWorksheet.prototype.SetColumnWidth;
+ ApiWorksheet.prototype["SetRowHeight"] = ApiWorksheet.prototype.SetRowHeight;
+ ApiWorksheet.prototype["SetDisplayGridlines"] = ApiWorksheet.prototype.SetDisplayGridlines;
+ ApiWorksheet.prototype["SetDisplayHeadings"] = ApiWorksheet.prototype.SetDisplayHeadings;
+ ApiWorksheet.prototype["SetLeftMargin"] = ApiWorksheet.prototype.SetLeftMargin;
+ ApiWorksheet.prototype["GetLeftMargin"] = ApiWorksheet.prototype.GetLeftMargin;
+ ApiWorksheet.prototype["SetRightMargin"] = ApiWorksheet.prototype.SetRightMargin;
+ ApiWorksheet.prototype["GetRightMargin"] = ApiWorksheet.prototype.GetRightMargin;
+ ApiWorksheet.prototype["SetTopMargin"] = ApiWorksheet.prototype.SetTopMargin;
+ ApiWorksheet.prototype["GetTopMargin"] = ApiWorksheet.prototype.GetTopMargin;
+ ApiWorksheet.prototype["SetBottomMargin"] = ApiWorksheet.prototype.SetBottomMargin;
+ ApiWorksheet.prototype["GetBottomMargin"] = ApiWorksheet.prototype.GetBottomMargin;
+ ApiWorksheet.prototype["SetPageOrientation"] = ApiWorksheet.prototype.SetPageOrientation;
+ ApiWorksheet.prototype["GetPageOrientation"] = ApiWorksheet.prototype.GetPageOrientation;
+ ApiWorksheet.prototype["GetPrintHeadings"] = ApiWorksheet.prototype.GetPrintHeadings;
+ ApiWorksheet.prototype["SetPrintHeadings"] = ApiWorksheet.prototype.SetPrintHeadings;
+ ApiWorksheet.prototype["GetPrintGridlines"] = ApiWorksheet.prototype.GetPrintGridlines;
+ ApiWorksheet.prototype["SetPrintGridlines"] = ApiWorksheet.prototype.SetPrintGridlines;
+ ApiWorksheet.prototype["GetDefNames"] = ApiWorksheet.prototype.GetDefNames;
+ ApiWorksheet.prototype["GetDefName"] = ApiWorksheet.prototype.GetDefName;
+ ApiWorksheet.prototype["AddDefName"] = ApiWorksheet.prototype.AddDefName;
+ ApiWorksheet.prototype["GetComments"] = ApiWorksheet.prototype.GetComments;
+ ApiWorksheet.prototype["Delete"] = ApiWorksheet.prototype.Delete;
+ ApiWorksheet.prototype["SetHyperlink"] = ApiWorksheet.prototype.SetHyperlink;
+ ApiWorksheet.prototype["AddChart"] = ApiWorksheet.prototype.AddChart;
ApiWorksheet.prototype["AddShape"] = ApiWorksheet.prototype.AddShape;
ApiWorksheet.prototype["AddImage"] = ApiWorksheet.prototype.AddImage;
ApiWorksheet.prototype["AddOleObject"] = ApiWorksheet.prototype.AddOleObject;
@@ -13066,6 +17097,9 @@
ApiWorksheet.prototype["GetProtectedRange"] = ApiWorksheet.prototype.GetProtectedRange;
ApiWorksheet.prototype["GetAllProtectedRanges"] = ApiWorksheet.prototype.GetAllProtectedRanges;
ApiWorksheet.prototype["Paste"] = ApiWorksheet.prototype.Paste;
+ ApiWorksheet.prototype["GetPivotByName"] = ApiWorksheet.prototype.GetPivotByName;
+ ApiWorksheet.prototype["GetAllPivotTables"] = ApiWorksheet.prototype.GetAllPivotTables;
+ ApiWorksheet.prototype["RefreshAllPivots"] = ApiWorksheet.prototype.RefreshAllPivots;
ApiRange.prototype["GetClassType"] = ApiRange.prototype.GetClassType;
ApiRange.prototype["GetRow"] = ApiRange.prototype.GetRow;
@@ -13130,6 +17164,7 @@
ApiRange.prototype["Replace"] = ApiRange.prototype.Replace;
ApiRange.prototype["GetCharacters"] = ApiRange.prototype.GetCharacters;
ApiRange.prototype["PasteSpecial"] = ApiRange.prototype.PasteSpecial;
+ ApiRange.prototype["GetPivotTable"] = ApiRange.prototype.GetPivotTable;
ApiDrawing.prototype["GetClassType"] = ApiDrawing.prototype.GetClassType;
@@ -13147,52 +17182,19 @@
ApiShape.prototype["GetContent"] = ApiShape.prototype.GetContent;
ApiShape.prototype["SetVerticalTextAlign"] = ApiShape.prototype.SetVerticalTextAlign;
- ApiChart.prototype["GetClassType"] = ApiChart.prototype.GetClassType;
- ApiChart.prototype["SetTitle"] = ApiChart.prototype.SetTitle;
- ApiChart.prototype["SetHorAxisTitle"] = ApiChart.prototype.SetHorAxisTitle;
- ApiChart.prototype["SetVerAxisTitle"] = ApiChart.prototype.SetVerAxisTitle;
- ApiChart.prototype["SetVerAxisOrientation"] = ApiChart.prototype.SetVerAxisOrientation;
- ApiChart.prototype["SetHorAxisOrientation"] = ApiChart.prototype.SetHorAxisOrientation;
- ApiChart.prototype["SetLegendPos"] = ApiChart.prototype.SetLegendPos;
- ApiChart.prototype["SetLegendFontSize"] = ApiChart.prototype.SetLegendFontSize;
- ApiChart.prototype["SetShowDataLabels"] = ApiChart.prototype.SetShowDataLabels;
- ApiChart.prototype["SetShowPointDataLabel"] = ApiChart.prototype.SetShowPointDataLabel;
- ApiChart.prototype["SetVertAxisTickLabelPosition"] = ApiChart.prototype.SetVertAxisTickLabelPosition;
- ApiChart.prototype["SetHorAxisTickLabelPosition"] = ApiChart.prototype.SetHorAxisTickLabelPosition;
-
- ApiChart.prototype["SetHorAxisMajorTickMark"] = ApiChart.prototype.SetHorAxisMajorTickMark;
- ApiChart.prototype["SetHorAxisMinorTickMark"] = ApiChart.prototype.SetHorAxisMinorTickMark;
- ApiChart.prototype["SetVertAxisMajorTickMark"] = ApiChart.prototype.SetVertAxisMajorTickMark;
- ApiChart.prototype["SetVertAxisMinorTickMark"] = ApiChart.prototype.SetVertAxisMinorTickMark;
-
-
-
- ApiChart.prototype["SetMajorVerticalGridlines"] = ApiChart.prototype.SetMajorVerticalGridlines;
- ApiChart.prototype["SetMinorVerticalGridlines"] = ApiChart.prototype.SetMinorVerticalGridlines;
- ApiChart.prototype["SetMajorHorizontalGridlines"] = ApiChart.prototype.SetMajorHorizontalGridlines;
- ApiChart.prototype["SetMinorHorizontalGridlines"] = ApiChart.prototype.SetMinorHorizontalGridlines;
- ApiChart.prototype["SetHorAxisLablesFontSize"] = ApiChart.prototype.SetHorAxisLablesFontSize;
- ApiChart.prototype["SetVertAxisLablesFontSize"] = ApiChart.prototype.SetVertAxisLablesFontSize;
- ApiChart.prototype["ApplyChartStyle"] = ApiChart.prototype.ApplyChartStyle;
+
+
ApiChart.prototype["SetSeriaValues"] = ApiChart.prototype.SetSeriaValues;
ApiChart.prototype["SetSeriaXValues"] = ApiChart.prototype.SetSeriaXValues;
ApiChart.prototype["SetSeriaName"] = ApiChart.prototype.SetSeriaName;
ApiChart.prototype["SetCatFormula"] = ApiChart.prototype.SetCatFormula;
ApiChart.prototype["AddSeria"] = ApiChart.prototype.AddSeria;
- ApiChart.prototype["RemoveSeria"] = ApiChart.prototype.RemoveSeria;
- ApiChart.prototype["SetPlotAreaFill"] = ApiChart.prototype.SetPlotAreaFill;
- ApiChart.prototype["SetPlotAreaOutLine"] = ApiChart.prototype.SetPlotAreaOutLine;
- ApiChart.prototype["SetSeriesFill"] = ApiChart.prototype.SetSeriesFill;
- ApiChart.prototype["SetSeriesOutLine"] = ApiChart.prototype.SetSeriesOutLine;
- ApiChart.prototype["SetDataPointFill"] = ApiChart.prototype.SetDataPointFill;
- ApiChart.prototype["SetDataPointOutLine"] = ApiChart.prototype.SetDataPointOutLine;
- ApiChart.prototype["SetMarkerFill"] = ApiChart.prototype.SetMarkerFill;
- ApiChart.prototype["SetMarkerOutLine"] = ApiChart.prototype.SetMarkerOutLine;
- ApiChart.prototype["SetTitleFill"] = ApiChart.prototype.SetTitleFill;
- ApiChart.prototype["SetTitleOutLine"] = ApiChart.prototype.SetTitleOutLine;
- ApiChart.prototype["SetLegendFill"] = ApiChart.prototype.SetLegendFill;
- ApiChart.prototype["SetLegendOutLine"] = ApiChart.prototype.SetLegendOutLine;
- ApiChart.prototype["SetAxieNumFormat"] = ApiChart.prototype.SetAxieNumFormat;
+ ApiChart.prototype["SetSize"] = ApiChart.prototype.SetSize = ApiDrawing.prototype.SetSize;
+ ApiChart.prototype["SetPosition"] = ApiChart.prototype.SetPosition = ApiDrawing.prototype.SetPosition;
+ ApiChart.prototype["GetWidth"] = ApiChart.prototype.GetWidth = ApiDrawing.prototype.GetWidth;
+ ApiChart.prototype["GetHeight"] = ApiChart.prototype.GetHeight = ApiDrawing.prototype.GetHeight;
+ ApiChart.prototype["GetLockValue"] = ApiChart.prototype.GetLockValue = ApiDrawing.prototype.GetLockValue;
+ ApiChart.prototype["SetLockValue"] = ApiChart.prototype.SetLockValue = ApiDrawing.prototype.SetLockValue;
ApiOleObject.prototype["GetClassType"] = ApiOleObject.prototype.GetClassType;
ApiOleObject.prototype["SetData"] = ApiOleObject.prototype.SetData;
@@ -13236,6 +17238,7 @@
ApiCommentReply.prototype["GetClassType"] = ApiCommentReply.prototype.GetClassType;
ApiCommentReply.prototype["GetText"] = ApiCommentReply.prototype.GetText;
+ ApiCommentReply.prototype["SetText"] = ApiCommentReply.prototype.SetText;
ApiCommentReply.prototype["SetTextGetAuthorName"] = ApiCommentReply.prototype.SetTextGetAuthorName;
ApiCommentReply.prototype["GetAuthorName"] = ApiCommentReply.prototype.GetAuthorName;
ApiCommentReply.prototype["SetAuthorName"] = ApiCommentReply.prototype.SetAuthorName;
@@ -13294,6 +17297,7 @@
ApiProtectedRange.prototype["AddUser"] = ApiProtectedRange.prototype.AddUser;
ApiProtectedRange.prototype["DeleteUser"] = ApiProtectedRange.prototype.DeleteUser;
ApiProtectedRange.prototype["GetAllUsers"] = ApiProtectedRange.prototype.GetAllUsers;
+ ApiProtectedRange.prototype["SetAnyoneType"] = ApiProtectedRange.prototype.SetAnyoneType;
ApiProtectedRange.prototype["GetUser"] = ApiProtectedRange.prototype.GetUser;
ApiProtectedRangeUserInfo.prototype["GetName"] = ApiProtectedRangeUserInfo.prototype.GetName;
@@ -13345,6 +17349,7 @@
ApiWorksheetFunction.prototype["CHIDIST"] = ApiWorksheetFunction.prototype.CHIDIST;
ApiWorksheetFunction.prototype["CHIINV"] = ApiWorksheetFunction.prototype.CHIINV;
ApiWorksheetFunction.prototype["CONFIDENCE"] = ApiWorksheetFunction.prototype.CONFIDENCE;
+ ApiWorksheetFunction.prototype["CHITEST"] = ApiWorksheetFunction.prototype.CHITEST;
ApiWorksheetFunction.prototype["COUNT"] = ApiWorksheetFunction.prototype.COUNT;
ApiWorksheetFunction.prototype["COUNTA"] = ApiWorksheetFunction.prototype.COUNTA;
ApiWorksheetFunction.prototype["COUNTBLANK"] = ApiWorksheetFunction.prototype.COUNTBLANK;
@@ -13655,7 +17660,10 @@
ApiWorksheetFunction.prototype["BETA_DIST"] = ApiWorksheetFunction.prototype.BETA_DIST;
ApiWorksheetFunction.prototype["BETA_INV"] = ApiWorksheetFunction.prototype.BETA_INV;
ApiWorksheetFunction.prototype["BINOM_DIST"] = ApiWorksheetFunction.prototype.BINOM_DIST;
+ ApiWorksheetFunction.prototype["BINOM_DIST_RANGE"]= ApiWorksheetFunction.prototype.BINOM_DIST_RANGE;
ApiWorksheetFunction.prototype["BINOM_INV"] = ApiWorksheetFunction.prototype.BINOM_INV;
+ ApiWorksheetFunction.prototype["CHISQ_DIST"] = ApiWorksheetFunction.prototype.CHISQ_DIST;
+ ApiWorksheetFunction.prototype["CHISQ_DIST_RT"] = ApiWorksheetFunction.prototype.CHISQ_DIST_RT;
ApiWorksheetFunction.prototype["CHISQ_INV"] = ApiWorksheetFunction.prototype.CHISQ_INV;
ApiWorksheetFunction.prototype["CHISQ_INV_RT"] = ApiWorksheetFunction.prototype.CHISQ_INV_RT;
ApiWorksheetFunction.prototype["CONFIDENCE_NORM"] = ApiWorksheetFunction.prototype.CONFIDENCE_NORM;
@@ -13702,7 +17710,156 @@
ApiWorksheetFunction.prototype["FLOOR_MATH"] = ApiWorksheetFunction.prototype.FLOOR_MATH;
ApiWorksheetFunction.prototype["ISO_CEILING"] = ApiWorksheetFunction.prototype.ISO_CEILING;
ApiWorksheetFunction.prototype["ERROR_TYPE"] = ApiWorksheetFunction.prototype.ERROR_TYPE;
-
+ ApiWorksheetFunction.prototype["FORECAST_ETS_CONFINT"] = ApiWorksheetFunction.prototype.FORECAST_ETS_CONFINT;
+ ApiWorksheetFunction.prototype["FORECAST_ETS_SEASONALITY"] = ApiWorksheetFunction.prototype.FORECAST_ETS_SEASONALITY;
+ ApiWorksheetFunction.prototype["FORECAST_ETS_STAT"] = ApiWorksheetFunction.prototype.FORECAST_ETS_STAT;
+ ApiWorksheetFunction.prototype["F_DIST_RT"] = ApiWorksheetFunction.prototype.F_DIST_RT;
+ ApiWorksheetFunction.prototype["F_INV_RT"] = ApiWorksheetFunction.prototype.F_INV_RT;
+ ApiWorksheetFunction.prototype["NORM_S_DIST"] = ApiWorksheetFunction.prototype.NORM_S_DIST;
+ ApiWorksheetFunction.prototype["NORM_S_INV"] = ApiWorksheetFunction.prototype.NORM_S_INV;
+ ApiWorksheetFunction.prototype["T_DIST_2T"] = ApiWorksheetFunction.prototype.T_DIST_2T;
+ ApiWorksheetFunction.prototype["T_DIST_RT"] = ApiWorksheetFunction.prototype.T_DIST_RT;
+ ApiWorksheetFunction.prototype["T_INV_2T"] = ApiWorksheetFunction.prototype.T_INV_2T;
+
+
+ ApiPivotTable.prototype["AddDataField"] = ApiPivotTable.prototype.AddDataField;
+ ApiPivotTable.prototype["AddFields"] = ApiPivotTable.prototype.AddFields;
+ ApiPivotTable.prototype["ClearAllFilters"] = ApiPivotTable.prototype.ClearAllFilters;
+ ApiPivotTable.prototype["ClearTable"] = ApiPivotTable.prototype.ClearTable
+ ApiPivotTable.prototype["GetData"] = ApiPivotTable.prototype.GetData;
+ ApiPivotTable.prototype["GetPivotData"] = ApiPivotTable.prototype.GetPivotData;
+ ApiPivotTable.prototype["GetPivotFields"] = ApiPivotTable.prototype.GetPivotFields;
+ ApiPivotTable.prototype["PivotValueCell"] = ApiPivotTable.prototype.PivotValueCell;
+ ApiPivotTable.prototype["ShowDetails"] = ApiPivotTable.prototype.ShowDetails;
+ ApiPivotTable.prototype["RefreshTable"] = ApiPivotTable.prototype.RefreshTable;
+ ApiPivotTable.prototype["Update"] = ApiPivotTable.prototype.Update;
+ ApiPivotTable.prototype["SetRepeatAllLabels"] = ApiPivotTable.prototype.SetRepeatAllLabels;
+ ApiPivotTable.prototype["SetRowAxisLayout"] = ApiPivotTable.prototype.SetRowAxisLayout;
+ ApiPivotTable.prototype["SetSubtotalLocation"] = ApiPivotTable.prototype.SetSubtotalLocation;
+ ApiPivotTable.prototype["RemoveField"] = ApiPivotTable.prototype.RemoveField;
+ ApiPivotTable.prototype["MoveField"] = ApiPivotTable.prototype.MoveField;
+ ApiPivotTable.prototype["Select"] = ApiPivotTable.prototype.Select;
+ ApiPivotTable.prototype["GetColumnFields"] = ApiPivotTable.prototype.GetColumnFields;
+ ApiPivotTable.prototype["GetDataFields"] = ApiPivotTable.prototype.GetDataFields;
+ ApiPivotTable.prototype["GetHiddenFields"] = ApiPivotTable.prototype.GetHiddenFields;
+ ApiPivotTable.prototype["GetVisibleFields"] = ApiPivotTable.prototype.GetVisibleFields;
+ ApiPivotTable.prototype["GetPageFields"] = ApiPivotTable.prototype.GetPageFields;
+ ApiPivotTable.prototype["GetRowFields"] = ApiPivotTable.prototype.GetRowFields;
+ ApiPivotTable.prototype["GetName"] = ApiPivotTable.prototype.GetName;
+ ApiPivotTable.prototype["SetName"] = ApiPivotTable.prototype.SetName;
+ ApiPivotTable.prototype["GetColumnGrand"] = ApiPivotTable.prototype.GetColumnGrand;
+ ApiPivotTable.prototype["SetColumnGrand"] = ApiPivotTable.prototype.SetColumnGrand;
+ ApiPivotTable.prototype["GetRowGrand"] = ApiPivotTable.prototype.GetRowGrand;
+ ApiPivotTable.prototype["SetRowGrand"] = ApiPivotTable.prototype.SetRowGrand;
+ ApiPivotTable.prototype["GetDisplayFieldsInReportFilterArea"] = ApiPivotTable.prototype.GetDisplayFieldsInReportFilterArea;
+ ApiPivotTable.prototype["SetDisplayFieldsInReportFilterArea"] = ApiPivotTable.prototype.SetDisplayFieldsInReportFilterArea;
+ ApiPivotTable.prototype["GetDisplayFieldCaptions"] = ApiPivotTable.prototype.GetDisplayFieldCaptions;
+ ApiPivotTable.prototype["SetDisplayFieldCaptions"] = ApiPivotTable.prototype.SetDisplayFieldCaptions;
+ ApiPivotTable.prototype["GetTitle"] = ApiPivotTable.prototype.GetTitle;
+ ApiPivotTable.prototype["SetTitle"] = ApiPivotTable.prototype.SetTitle;
+ ApiPivotTable.prototype["GetDescription"] = ApiPivotTable.prototype.GetDescription;
+ ApiPivotTable.prototype["SetDescription"] = ApiPivotTable.prototype.SetDescription;
+ ApiPivotTable.prototype["GetStyleName"] = ApiPivotTable.prototype.GetStyleName;
+ ApiPivotTable.prototype["SetStyleName"] = ApiPivotTable.prototype.SetStyleName;
+ ApiPivotTable.prototype["GetTableStyleRowHeaders"] = ApiPivotTable.prototype.GetTableStyleRowHeaders;
+ ApiPivotTable.prototype["SetTableStyleRowHeaders"] = ApiPivotTable.prototype.SetTableStyleRowHeaders;
+ ApiPivotTable.prototype["GetTableStyleColumnHeaders"] = ApiPivotTable.prototype.GetTableStyleColumnHeaders;
+ ApiPivotTable.prototype["SetTableStyleColumnHeaders"] = ApiPivotTable.prototype.SetTableStyleColumnHeaders;
+ ApiPivotTable.prototype["GetTableStyleRowStripes"] = ApiPivotTable.prototype.GetTableStyleRowStripes;
+ ApiPivotTable.prototype["SetTableStyleRowStripes"] = ApiPivotTable.prototype.SetTableStyleRowStripes;
+ ApiPivotTable.prototype["GetTableStyleColumnStripes"] = ApiPivotTable.prototype.GetTableStyleColumnStripes;
+ ApiPivotTable.prototype["SetTableStyleColumnStripes"] = ApiPivotTable.prototype.SetTableStyleColumnStripes;
+ ApiPivotTable.prototype["GetSource"] = ApiPivotTable.prototype.GetSource;
+ ApiPivotTable.prototype["SetSource"] = ApiPivotTable.prototype.SetSource;
+ ApiPivotTable.prototype["GetColumnRange"] = ApiPivotTable.prototype.GetColumnRange;
+ ApiPivotTable.prototype["GetRowRange"] = ApiPivotTable.prototype.GetRowRange;
+ ApiPivotTable.prototype["GetDataBodyRange"] = ApiPivotTable.prototype.GetDataBodyRange;
+ ApiPivotTable.prototype["GetTableRange1"] = ApiPivotTable.prototype.GetTableRange1;
+ ApiPivotTable.prototype["GetTableRange2"] = ApiPivotTable.prototype.GetTableRange2;
+ ApiPivotTable.prototype["GetGrandTotalName"] = ApiPivotTable.prototype.GetGrandTotalName;
+ ApiPivotTable.prototype["SetGrandTotalName"] = ApiPivotTable.prototype.SetGrandTotalName;
+ ApiPivotTable.prototype["SetLayoutBlankLine"] = ApiPivotTable.prototype.SetLayoutBlankLine;
+ ApiPivotTable.prototype["SetLayoutSubtotals"] = ApiPivotTable.prototype.SetLayoutSubtotals;
+ ApiPivotTable.prototype["GetParent"] = ApiPivotTable.prototype.GetParent;
+
+ ApiPivotDataField.prototype["Remove"] = ApiPivotDataField.prototype.Remove;
+ ApiPivotDataField.prototype["Move"] = ApiPivotDataField.prototype.Move;
+ ApiPivotDataField.prototype["SetFunction"] = ApiPivotDataField.prototype.SetFunction;
+ ApiPivotDataField.prototype["GetFunction"] = ApiPivotDataField.prototype.GetFunction;
+ ApiPivotDataField.prototype["GetPosition"] = ApiPivotDataField.prototype.GetPosition;
+ ApiPivotDataField.prototype["SetPosition"] = ApiPivotDataField.prototype.SetPosition;
+ ApiPivotDataField.prototype["GetOrientation"] = ApiPivotDataField.prototype.GetOrientation;
+ ApiPivotDataField.prototype["GetValue"] = ApiPivotDataField.prototype.GetValue;
+ ApiPivotDataField.prototype["SetValue"] = ApiPivotDataField.prototype.SetValue;
+ ApiPivotDataField.prototype["GetCaption"] = ApiPivotDataField.prototype.GetCaption;
+ ApiPivotDataField.prototype["SetCaption"] = ApiPivotDataField.prototype.SetCaption;
+ ApiPivotDataField.prototype["GetName"] = ApiPivotDataField.prototype.GetName;
+ ApiPivotDataField.prototype["SetName"] = ApiPivotDataField.prototype.SetName;
+ ApiPivotDataField.prototype["GetNumberFormat"] = ApiPivotDataField.prototype.GetNumberFormat;
+ ApiPivotDataField.prototype["SetNumberFormat"] = ApiPivotDataField.prototype.SetNumberFormat;
+ ApiPivotDataField.prototype["GetIndex"] = ApiPivotDataField.prototype.GetIndex;
+ ApiPivotDataField.prototype["GetPivotField"] = ApiPivotDataField.prototype.GetPivotField;
+
+ ApiPivotField.prototype["ClearAllFilters"] = ApiPivotField.prototype.ClearAllFilters;
+ ApiPivotField.prototype["ClearLabelFilters"] = ApiPivotField.prototype.ClearLabelFilters;
+ ApiPivotField.prototype["ClearManualFilters"] = ApiPivotField.prototype.ClearManualFilters;
+ ApiPivotField.prototype["ClearValueFilters"] = ApiPivotField.prototype.ClearValueFilters;
+ ApiPivotField.prototype["GetPivotItems"] = ApiPivotField.prototype.GetPivotItems;
+ ApiPivotField.prototype["Move"] = ApiPivotField.prototype.Move;
+ ApiPivotField.prototype["Remove"] = ApiPivotField.prototype.Remove;
+ ApiPivotField.prototype["GetPosition"] = ApiPivotField.prototype.GetPosition;
+ ApiPivotField.prototype["SetPosition"] = ApiPivotField.prototype.SetPosition;
+ ApiPivotField.prototype["GetOrientation"] = ApiPivotField.prototype.GetOrientation;
+ ApiPivotField.prototype["SetOrientation"] = ApiPivotField.prototype.SetOrientation;
+ ApiPivotField.prototype["GetValue"] = ApiPivotField.prototype.GetValue;
+ ApiPivotField.prototype["SetValue"] = ApiPivotField.prototype.SetValue;
+ ApiPivotField.prototype["GetCaption"] = ApiPivotField.prototype.GetCaption;
+ ApiPivotField.prototype["SetCaption"] = ApiPivotField.prototype.SetCaption;
+ ApiPivotField.prototype["GetName"] = ApiPivotField.prototype.GetName;
+ ApiPivotField.prototype["SetName"] = ApiPivotField.prototype.SetName;
+ ApiPivotField.prototype["GetSourceName"] = ApiPivotField.prototype.GetSourceName;
+ ApiPivotField.prototype["GetIndex"] = ApiPivotField.prototype.GetIndex;
+ ApiPivotField.prototype["GetTable"] = ApiPivotField.prototype.GetTable;
+ ApiPivotField.prototype["GetParent"] = ApiPivotField.prototype.GetParent;
+ ApiPivotField.prototype["GetLayoutCompactRow"] = ApiPivotField.prototype.GetLayoutCompactRow;
+ ApiPivotField.prototype["SetLayoutCompactRow"] = ApiPivotField.prototype.SetLayoutCompactRow;
+ ApiPivotField.prototype["GetLayoutForm"] = ApiPivotField.prototype.GetLayoutForm;
+ ApiPivotField.prototype["SetLayoutForm"] = ApiPivotField.prototype.SetLayoutForm;
+ ApiPivotField.prototype["GetLayoutPageBreak"] = ApiPivotField.prototype.GetLayoutPageBreak;
+ ApiPivotField.prototype["SetLayoutPageBreak"] = ApiPivotField.prototype.SetLayoutPageBreak;
+ ApiPivotField.prototype["GetShowingInAxis"] = ApiPivotField.prototype.GetShowingInAxis;
+ ApiPivotField.prototype["GetRepeatLabels"] = ApiPivotField.prototype.GetRepeatLabels;
+ ApiPivotField.prototype["SetRepeatLabels"] = ApiPivotField.prototype.SetRepeatLabels;
+ ApiPivotField.prototype["GetLayoutBlankLine"] = ApiPivotField.prototype.GetLayoutBlankLine;
+ ApiPivotField.prototype["SetLayoutBlankLine"] = ApiPivotField.prototype.SetLayoutBlankLine;
+ ApiPivotField.prototype["GetShowAllItems"] = ApiPivotField.prototype.GetShowAllItems;
+ ApiPivotField.prototype["SetShowAllItems"] = ApiPivotField.prototype.SetShowAllItems;
+ ApiPivotField.prototype["GetLayoutSubtotals"] = ApiPivotField.prototype.GetLayoutSubtotals;
+ ApiPivotField.prototype["SetLayoutSubtotals"] = ApiPivotField.prototype.SetLayoutSubtotals;
+ ApiPivotField.prototype["GetLayoutSubtotalLocation"] = ApiPivotField.prototype.GetLayoutSubtotalLocation;
+ ApiPivotField.prototype["SetLayoutSubtotalLocation"] = ApiPivotField.prototype.SetLayoutSubtotalLocation;
+ ApiPivotField.prototype["GetSubtotalName"] = ApiPivotField.prototype.GetSubtotalName;
+ ApiPivotField.prototype["SetSubtotalName"] = ApiPivotField.prototype.SetSubtotalName;
+ ApiPivotField.prototype["GetSubtotals"] = ApiPivotField.prototype.GetSubtotals;
+ ApiPivotField.prototype["SetSubtotals"] = ApiPivotField.prototype.SetSubtotals;
+ ApiPivotField.prototype["GetDragToColumn"] = ApiPivotField.prototype.GetDragToColumn;
+ ApiPivotField.prototype["SetDragToColumn"] = ApiPivotField.prototype.SetDragToColumn;
+ ApiPivotField.prototype["GetDragToRow"] = ApiPivotField.prototype.GetDragToRow;
+ ApiPivotField.prototype["SetDragToRow"] = ApiPivotField.prototype.SetDragToRow;
+ ApiPivotField.prototype["GetDragToData"] = ApiPivotField.prototype.GetDragToData;
+ ApiPivotField.prototype["SetDragToData"] = ApiPivotField.prototype.SetDragToData;
+ ApiPivotField.prototype["GetDragToPage"] = ApiPivotField.prototype.GetDragToPage;
+ ApiPivotField.prototype["SetDragToPage"] = ApiPivotField.prototype.SetDragToPage;
+ ApiPivotField.prototype["GetCurrentPage"] = ApiPivotField.prototype.GetCurrentPage;
+ ApiPivotField.prototype["GetNumberFormat"] = ApiPivotField.prototype.GetNumberFormat;
+ ApiPivotField.prototype["SetNumberFormat"] = ApiPivotField.prototype.SetNumberFormat;
+ ApiPivotField.prototype["SetFunction"] = ApiPivotField.prototype.SetFunction;
+ ApiPivotField.prototype["GetFunction"] = ApiPivotField.prototype.GetFunction;
+
+ ApiPivotItem.prototype["GetName"] = ApiPivotItem.prototype.GetName;
+ ApiPivotItem.prototype["GetCaption"] = ApiPivotItem.prototype.GetCaption;
+ ApiPivotItem.prototype["GetValue"] = ApiPivotItem.prototype.GetValue;
+ ApiPivotItem.prototype["GetParent"] = ApiPivotItem.prototype.GetParent;
function private_SetCoords(oDrawing, oWorksheet, nExtX, nExtY, nFromCol, nColOffset, nFromRow, nRowOffset, pos) {
oDrawing.x = 0;
@@ -13923,4 +18080,9 @@
oldSelection && oldSelection.Select(true);
}
+ function private_MakeError(message) {
+ console.error(new Error(message) );
+ };
+
}(window, null));
+
diff --git a/cell/apiDefines.js b/cell/apiDefines.js
index b9451c45da..34ac9c63ca 100644
--- a/cell/apiDefines.js
+++ b/cell/apiDefines.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -116,7 +116,8 @@ var c_oAscSelectionDialogType = {
var c_oAscScrollType = {
ScrollVertical: 1,
- ScrollHorizontal: 2
+ ScrollHorizontal: 2,
+ ScrollInitRowsColsCount: 4
};
var c_oAscHyperlinkType = {
@@ -365,7 +366,8 @@ var c_oAscVisibleAreaOleEditorBorderColor = new CColor(32, 139, 255);
sheetRename: 4,
sheetChangeIndex: 5,
markModifiedSearch: 6,
- mergeRange: 7
+ mergeRange: 7,
+ removeRows: 8
};
var c_oAscLockNameFrozenPane = "frozenPane";
@@ -637,6 +639,12 @@ var c_oAscPopUpSelectorType = {
changeSeries : 1 // fill right click mouse - series menu
};
+ var c_oAscCalcMode = {
+ auto: 0,
+ autoNoTable: 1,
+ manual: 2
+ };
+
//----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].c_oAscDrawDepOptions = c_oAscDrawDepOptions;
@@ -1093,4 +1101,10 @@ var c_oAscPopUpSelectorType = {
prot['common'] = prot.common;
prot['changeSeries'] = prot.changeSeries;
+ window['Asc']['c_oAscCalcMode'] = window['Asc'].c_oAscCalcMode = c_oAscCalcMode;
+ prot = c_oAscCalcMode;
+ prot['auto'] = prot.auto;
+ prot['autoNoTable'] = prot.autoNoTable;
+ prot['manual'] = prot.manual;
+
})(window);
diff --git a/cell/api_plugins.js b/cell/api_plugins.js
index f7e679faba..e29fa05266 100644
--- a/cell/api_plugins.js
+++ b/cell/api_plugins.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -51,6 +51,7 @@
* @property {string} Time - The time when the comment was posted (in milliseconds).
* @property {boolean} Solved - Specifies if the comment is resolved (**true**) or not (**false**).
* @property {CommentData[]} Replies - An array containing the comment replies represented as the *CommentData* object.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/CommentData.js
*/
/**
@@ -61,6 +62,7 @@
* @param {CommentData} oCommentData - An object which contains the comment data.
* @return {string | null} - The comment ID in the string format or null if the comment cannot be added.
* @since 7.3.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddComment.js
*/
Api.prototype["pluginMethod_AddComment"] = function (oCommentData) {
if (!oCommentData)
@@ -86,6 +88,7 @@
* @param {CommentData} oCommentData - An object which contains the new comment data.
* @return {boolean}
* @since 7.3.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ChangeComment.js
*/
Api.prototype["pluginMethod_ChangeComment"] = function (sId, oCommentData) {
if (!oCommentData)
@@ -108,6 +111,7 @@
* @typeofeditors ["CSE"]
* @alias RemoveComments
* @since 7.3.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveComments.js
*/
Api.prototype["pluginMethod_RemoveComments"] = function (arrIds) {
for (let comm in arrIds) {
@@ -125,6 +129,7 @@
* @alias GetAllComments
* @returns {comment[]} - An array of comment objects containing the comment data.
* @since 8.1.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetAllComments.js
*/
Api.prototype["pluginMethod_GetAllComments"] = function()
{
@@ -152,7 +157,14 @@
{
// DISABLE FOR NATIVE VERSION
if (window["NATIVE_EDITOR_ENJINE"])
- return;
+ {
+ if (!window.localStorage)
+ {
+ window.localStorage = {};
+ window.localStorage.getItem = function(key) { return this[key]; };
+ window.localStorage.setItem = function(key, value) { this[key] = value; };
+ }
+ }
if (undefined === obj)
obj = AscCommon.getLocalStorageItem(customFunctionsStorageId);
@@ -180,13 +192,66 @@
this.recalculateCustomFunctions();
};
+ Api.prototype.addCustomFunctionsLibrary = function(sName, Func)
+ {
+ // DISABLE FOR NATIVE VERSION
+ if (window["NATIVE_EDITOR_ENJINE"])
+ {
+ if (!window.localStorage)
+ {
+ window.localStorage = {};
+ window.localStorage.getItem = function(key) { return this[key]; };
+ window.localStorage.setItem = function(key, value) { this[key] = value; };
+ }
+ }
+
+ let currentValue = AscCommon.getLocalStorageItem(customFunctionsStorageId);
+ let libraryString = "(" + Func.toString() + ")()";
+ if (!currentValue)
+ {
+ currentValue = {
+ "macrosArray" : [{
+ "name": sName,
+ "value": libraryString
+ }]
+ };
+ }
+ else
+ {
+ let arr = currentValue["macrosArray"];
+ if (arr)
+ {
+ let isChanged = false;
+ for (let i = 0, len = arr.length; i < len; i++)
+ {
+ if (arr[i]["name"] === sName)
+ {
+ isChanged = true;
+ arr[i]["value"] = libraryString;
+ }
+ }
+ if (!isChanged)
+ {
+ arr.push({
+ "name" : sName,
+ "value" : libraryString
+ });
+ }
+ }
+ }
+
+ AscCommon.setLocalStorageItem(customFunctionsStorageId, currentValue);
+ this.registerCustomFunctionsLibrary(currentValue);
+ };
+
/**
- * Returns local custom functions library.
+ * Returns a library of local custom functions.
* @memberof Api
* @typeofeditors ["CSE"]
* @alias GetCustomFunctions
- * @return {string} The custom functions library as json.
+ * @return {string} A library of custom functions in JSON format.
* @since 8.1.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetCustomFunctions.js
*/
Api.prototype["pluginMethod_GetCustomFunctions"] = function()
{
@@ -203,12 +268,13 @@
};
/**
- * Update local custom functions library
+ * Updates a library of local custom functions.
* @memberof Api
* @typeofeditors ["CSE"]
* @alias SetCustomFunctions
- * @param {string} jsonString - The custom functions library.
+ * @param {string} jsonString - A library of custom functions in JSON format.
* @since 8.1.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SetCustomFunctions.js
*/
Api.prototype["pluginMethod_SetCustomFunctions"] = function(jsonString)
{
@@ -226,3 +292,5 @@
};
})(window);
+
+
diff --git a/cell/document/empty.js b/cell/document/empty.js
index 53bc53f9d4..2b54deaac4 100644
--- a/cell/document/empty.js
+++ b/cell/document/empty.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/fromToJSON.js b/cell/fromToJSON.js
index 4b0c2a3150..9beb5b40f0 100644
--- a/cell/fromToJSON.js
+++ b/cell/fromToJSON.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/graphics/DrawingContext.js b/cell/graphics/DrawingContext.js
index 7ed912e96c..4b08b0aee8 100644
--- a/cell/graphics/DrawingContext.js
+++ b/cell/graphics/DrawingContext.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/graphics/pdfprinter.js b/cell/graphics/pdfprinter.js
index 7d34b07469..3639fa31fa 100644
--- a/cell/graphics/pdfprinter.js
+++ b/cell/graphics/pdfprinter.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/CellComment.js b/cell/model/CellComment.js
index e26e3de660..df97498094 100644
--- a/cell/model/CellComment.js
+++ b/cell/model/CellComment.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -634,6 +634,9 @@ CCellCommentator.prototype.isLockedComment = function(oComment, callbackFunc) {
return;
}
+
+ this.worksheet._startRtlRendering(this.drawingCtx);
+
this.drawingCtx.setFillStyle(this.commentIconColor);
var commentCell, mergedRange, nCol, nRow, x, y, metrics;
var aComments = this.model.aComments;
@@ -654,6 +657,12 @@ CCellCommentator.prototype.isLockedComment = function(oComment, callbackFunc) {
if (0 === metrics.width || 0 === metrics.height) {
continue;
}
+
+ let isClip = false;
+ if (this.worksheet._clipDrawingRect(this.drawingCtx, new Asc.Range(nCol, nRow, nCol, nRow))) {
+ isClip = true;
+ }
+
x = metrics.left + metrics.width;
y = metrics.top;
this.drawingCtx.beginPath();
@@ -661,8 +670,14 @@ CCellCommentator.prototype.isLockedComment = function(oComment, callbackFunc) {
this.drawingCtx.lineTo(x - borderW, y);
this.drawingCtx.lineTo(x - borderW, y + size);
this.drawingCtx.fill();
+
+ if (isClip) {
+ this.drawingCtx.RemoveClipRect();
+ }
}
}
+
+ this.worksheet._endRtlRendering();
};
CCellCommentator.prototype.updateActiveComment = function () {
@@ -848,7 +863,14 @@ CCellCommentator.prototype.cleanLastSelection = function() {
var lastComment = this.findComment(this.lastSelectedId);
if (lastComment && (metrics = this.worksheet.getCellMetrics(lastComment.nCol, lastComment.nRow, true))) {
var extraOffset = 1;
- this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width - extraOffset, metrics.height - extraOffset);
+ let x = this.worksheet.checkRtl(metrics.left);
+ let y = metrics.top;
+ let width = metrics.width - extraOffset;
+ if (this.worksheet.getRightToLeft()) {
+ x -= width;
+ }
+ let height = metrics.height - extraOffset;
+ this.overlayCtx.clearRect(x, y, width, height);
}
}
};
@@ -918,23 +940,28 @@ CCellCommentator.prototype.cleanLastSelection = function() {
var left = mergedRange ? mergedRange.c2 : comment.nCol;
var top = mergedRange ? mergedRange.r1 : comment.nRow;
+ let scrollCorrectX = this.worksheet.getHorizontalScrollCorrect();
+ let scrollCorrectY = this.worksheet.getScrollCorrect();
var frozenOffset = this.worksheet.getFrozenPaneOffset();
if (this.worksheet.topLeftFrozenCell) {
if (comment.nCol < fvc) {
frozenOffset.offsetX = 0;
fvc = 0;
+ scrollCorrectX = 0;
}
if (comment.nRow < fvr) {
frozenOffset.offsetY = 0;
fvr = 0;
+ scrollCorrectY = 0;
}
}
- pos.dReverseLeftPX = this.worksheet._getColLeft(left) - this.worksheet._getColLeft(fvc) +
- headerCellsOffset.left + frozenOffset.offsetX;
- pos.dLeftPX = pos.dReverseLeftPX + this.worksheet.getColumnWidth(left, 0);
+ pos.dReverseLeftPX = this.worksheet.checkRtl(this.worksheet._getColLeft(left) - this.worksheet._getColLeft(fvc) +
+ headerCellsOffset.left + frozenOffset.offsetX - scrollCorrectX);
+ let colWidth = (this.worksheet.getRightToLeft() ? -1 : 1) * this.worksheet.getColumnWidth(left, 0);
+ pos.dLeftPX = pos.dReverseLeftPX + colWidth;
pos.dTopPX = this.worksheet._getRowTop(top) + ((this.worksheet._getRowHeight(top) / 2) | 0) -
- this.worksheet._getRowTop(fvr) + headerCellsOffset.top + frozenOffset.offsetY;
+ this.worksheet._getRowTop(fvr) + headerCellsOffset.top + frozenOffset.offsetY - scrollCorrectY;
pos.dLeftPX = AscCommon.AscBrowser.convertToRetinaValue(pos.dLeftPX);
pos.dTopPX = AscCommon.AscBrowser.convertToRetinaValue(pos.dTopPX);
@@ -949,7 +976,14 @@ CCellCommentator.prototype.cleanLastSelection = function() {
var comment = this.findComment(this.lastSelectedId);
if (comment && !this._checkHidden(comment) &&
(metrics = this.worksheet.getCellMetrics(comment.asc_getCol(), comment.asc_getRow(), true))) {
- this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width, metrics.height);
+ let x = this.worksheet.checkRtl(metrics.left);
+ let y = metrics.top;
+ let width = metrics.width;
+ if (this.worksheet.getRightToLeft()) {
+ x -= width;
+ }
+ let height = metrics.height;
+ this.overlayCtx.clearRect(x, y, width, height);
}
}
};
@@ -1004,13 +1038,31 @@ CCellCommentator.prototype.selectComment = function(id) {
metrics = this.worksheet.getCellMetrics(col, row, true);
if (metrics) {
+
+ let isClip = false;
+ let mc = this.model.getMergedByCell(row, col);
+ if (this.worksheet._clipDrawingRect(this.overlayCtx, mc ? mc : new Asc.Range(col, row, col, row))) {
+ isClip = true;
+ }
+
var extraOffset = 1;
this.overlayCtx.ctx.globalAlpha = 0.2;
this.overlayCtx.beginPath();
- this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width - extraOffset, metrics.height - extraOffset);
+ let x = this.worksheet.checkRtl(metrics.left);
+ let y = metrics.top;
+ let width = metrics.width - extraOffset;
+ if (this.worksheet.getRightToLeft()) {
+ x -= width;
+ }
+ let height = metrics.height - extraOffset;
+ this.overlayCtx.clearRect(x, y, width, height);
this.overlayCtx.setFillStyle(this.commentFillColor);
- this.overlayCtx.fillRect(metrics.left, metrics.top, metrics.width - extraOffset, metrics.height - extraOffset);
+ this.overlayCtx.fillRect(x, y, width, height);
this.overlayCtx.ctx.globalAlpha = 1;
+
+ if (isClip) {
+ this.overlayCtx.RemoveClipRect();
+ }
}
}
};
diff --git a/cell/model/CellInfo.js b/cell/model/CellInfo.js
index ffc800c319..f07461b58d 100644
--- a/cell/model/CellInfo.js
+++ b/cell/model/CellInfo.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/CollaborativeEditing.js b/cell/model/CollaborativeEditing.js
index 84d45b05be..4f0e1c3716 100644
--- a/cell/model/CollaborativeEditing.js
+++ b/cell/model/CollaborativeEditing.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/ConditionalFormatting.js b/cell/model/ConditionalFormatting.js
index 2281c658da..75bf96e5db 100644
--- a/cell/model/ConditionalFormatting.js
+++ b/cell/model/ConditionalFormatting.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/DataValidation.js b/cell/model/DataValidation.js
index 3ad63f26dd..df39e357b5 100644
--- a/cell/model/DataValidation.js
+++ b/cell/model/DataValidation.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/DrawingObjects/DrawingDocument.js b/cell/model/DrawingObjects/DrawingDocument.js
index 568c1527e5..6aab122b27 100644
--- a/cell/model/DrawingObjects/DrawingDocument.js
+++ b/cell/model/DrawingObjects/DrawingDocument.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/DrawingObjects/Format/ChartSpacePrototype.js b/cell/model/DrawingObjects/Format/ChartSpacePrototype.js
index 80943c42b1..cc6c608525 100644
--- a/cell/model/DrawingObjects/Format/ChartSpacePrototype.js
+++ b/cell/model/DrawingObjects/Format/ChartSpacePrototype.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -38,7 +38,6 @@
var CShape = AscFormat.CShape;
var CChartSpace = AscFormat.CChartSpace;
-CChartSpace.prototype.getDrawingObjectsController = CShape.prototype.getDrawingObjectsController;
CChartSpace.prototype.getEditorType = function()
{
return 0;
diff --git a/cell/model/DrawingObjects/Format/GroupPrototype.js b/cell/model/DrawingObjects/Format/GroupPrototype.js
index 677b9624a4..d4429bbb2b 100644
--- a/cell/model/DrawingObjects/Format/GroupPrototype.js
+++ b/cell/model/DrawingObjects/Format/GroupPrototype.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -113,8 +113,6 @@ CGroupShape.prototype.recalcBounds = function()
this.recalcInfo.recalculateBounds = true;
};
-CGroupShape.prototype.getDrawingObjectsController = CShape.prototype.getDrawingObjectsController;
-
CGroupShape.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
CGroupShape.prototype.convertPixToMM = CShape.prototype.convertPixToMM;
CGroupShape.prototype.getHierarchy = CShape.prototype.getHierarchy;
@@ -252,4 +250,18 @@ CGroupShape.prototype.recalculate = function()
this.worksheet.contentChanges.Refresh();
}
};
+ CGroupShape.prototype.checkDrawingPartWithHistory = function() {
+ for (let i = 0; i < this.spTree.length; i++) {
+ if (this.spTree[i].checkDrawingPartWithHistory) {
+ this.spTree[i].checkDrawingPartWithHistory();
+ }
+ }
+ };
+ CGroupShape.prototype.generateLocalDrawingPart = function() {
+ for (let i = 0; i < this.spTree.length; i++) {
+ if (this.spTree[i].generateLocalDrawingPart) {
+ this.spTree[i].generateLocalDrawingPart();
+ }
+ }
+ };
})(window);
diff --git a/cell/model/DrawingObjects/Format/ImagePrototype.js b/cell/model/DrawingObjects/Format/ImagePrototype.js
index 1de724fd16..09d39e5f0c 100644
--- a/cell/model/DrawingObjects/Format/ImagePrototype.js
+++ b/cell/model/DrawingObjects/Format/ImagePrototype.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -45,7 +45,6 @@ CImageShape.prototype.getParentObjects = CShape.prototype.getParentObjects;
CImageShape.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
CImageShape.prototype.recalculateBounds = CShape.prototype.recalculateBounds;
CImageShape.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
-CImageShape.prototype.getDrawingObjectsController = CShape.prototype.getDrawingObjectsController;
CImageShape.prototype.getEditorType = function()
{
return 0;
diff --git a/cell/model/DrawingObjects/Format/ShapePrototype.js b/cell/model/DrawingObjects/Format/ShapePrototype.js
index 69420a793f..95150a898f 100644
--- a/cell/model/DrawingObjects/Format/ShapePrototype.js
+++ b/cell/model/DrawingObjects/Format/ShapePrototype.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -820,6 +820,11 @@ CShape.prototype.Get_Worksheet = function()
{
return this.worksheet;
};
+CShape.prototype.checkDrawingPartWithHistory = function () {
+ if (this.isObjectInSmartArt()) {
+ return this.group.group.checkDrawingPartWithHistory(this);
+ }
+};
diff --git a/cell/model/DrawingObjects/GlobalCounters.js b/cell/model/DrawingObjects/GlobalCounters.js
index 151fb5893d..2e8d7a897e 100644
--- a/cell/model/DrawingObjects/GlobalCounters.js
+++ b/cell/model/DrawingObjects/GlobalCounters.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/DrawingObjects/Graphics.js b/cell/model/DrawingObjects/Graphics.js
index bc0ab5ddf8..a34782c541 100644
--- a/cell/model/DrawingObjects/Graphics.js
+++ b/cell/model/DrawingObjects/Graphics.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/_xlfnFunctions.js b/cell/model/FormulaObjects/_xlfnFunctions.js
index a59fe0164c..bf78d0a897 100644
--- a/cell/model/FormulaObjects/_xlfnFunctions.js
+++ b/cell/model/FormulaObjects/_xlfnFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/cubeFunctions.js b/cell/model/FormulaObjects/cubeFunctions.js
index 7daa5cbe70..eca45af970 100644
--- a/cell/model/FormulaObjects/cubeFunctions.js
+++ b/cell/model/FormulaObjects/cubeFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/databaseFunctions.js b/cell/model/FormulaObjects/databaseFunctions.js
index 698f02885a..aa15275c1a 100644
--- a/cell/model/FormulaObjects/databaseFunctions.js
+++ b/cell/model/FormulaObjects/databaseFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/dateandtimeFunctions.js b/cell/model/FormulaObjects/dateandtimeFunctions.js
index b6b55863ac..fd35d6ef17 100644
--- a/cell/model/FormulaObjects/dateandtimeFunctions.js
+++ b/cell/model/FormulaObjects/dateandtimeFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1196,6 +1196,7 @@ function (window, undefined) {
}
let val = arg0.getValue();
+ val = parseInt(val);
if (val < 0) {
return new cError(cErrorType.not_numeric);
} else if (!AscCommon.bDate1904) {
@@ -2203,10 +2204,10 @@ function (window, undefined) {
cWORKDAY_INTL.prototype.argumentsMin = 2;
cWORKDAY_INTL.prototype.argumentsMax = 4;
cWORKDAY_INTL.prototype.numFormat = AscCommonExcel.cNumFormatNone;
- cWORKDAY_INTL.prototype.arrayIndexes = {2: 0, 3: 1};
+ cWORKDAY_INTL.prototype.arrayIndexes = {0: AscCommonExcel.arrayIndexesType.range, 1: AscCommonExcel.arrayIndexesType.range, 3: 1};
cWORKDAY_INTL.prototype.argumentsType = [argType.any, argType.any, argType.number, argType.any];
//TODO в данном случае есть различия с ms. при 3 и 4 аргументах - замена результата на ошибку не происходит.
- cWORKDAY_INTL.prototype.returnValueType = AscCommonExcel.cReturnFormulaType.value_replace_area;
+ // cWORKDAY_INTL.prototype.returnValueType = AscCommonExcel.cReturnFormulaType.value_replace_area;
cWORKDAY_INTL.prototype.Calculate = function (arg) {
//TODO проблема с формулами следующего типа - WORKDAY.INTL(8,60,"0000000")
let t = this;
@@ -2214,6 +2215,11 @@ function (window, undefined) {
let oArguments = this._prepareArguments(tempArgs, arguments[1]);
let argClone = oArguments.args;
+ if ((arg[0] && (arg[0].type === cElementType.cellsRange || arg[0].type === cElementType.cellsRange3D)) ||
+ (arg[1] && (arg[1].type === cElementType.cellsRange || arg[1].type === cElementType.cellsRange3D))) {
+ return new cError(cErrorType.wrong_value_type);
+ }
+
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
diff --git a/cell/model/FormulaObjects/engineeringFunctions.js b/cell/model/FormulaObjects/engineeringFunctions.js
index 52f7914cad..e1ecafde47 100644
--- a/cell/model/FormulaObjects/engineeringFunctions.js
+++ b/cell/model/FormulaObjects/engineeringFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/financialFunctions.js b/cell/model/FormulaObjects/financialFunctions.js
index e4c1b45a67..ac0ebc5aa8 100644
--- a/cell/model/FormulaObjects/financialFunctions.js
+++ b/cell/model/FormulaObjects/financialFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -494,6 +494,7 @@ function (window, undefined) {
cACCRINT.prototype.returnValueType = AscCommonExcel.cReturnFormulaType.value_replace_area;
cACCRINT.prototype.argumentsType = [argType.any, argType.any, argType.any, argType.any, argType.any, argType.any, argType.any, argType.any];
cACCRINT.prototype.Calculate = function (arg) {
+ // the ACCRINT formula in ms does not always match the calculation using the formula manually
let issue = arg[0],
firstInterest = arg[1],
settlement = arg[2],
@@ -677,6 +678,12 @@ function (window, undefined) {
basis = Math.floor(basis.getValue());
calcMethod = calcMethod.toBool();
+ // checking for out-of-date dates
+ let maxDate = AscCommonExcel.getMaxDate();
+ if (issue > maxDate || firstInterest > maxDate || settlement > maxDate) {
+ return new cError(cErrorType.not_numeric);
+ }
+
if (issue < startRangeCurrentDateSystem || issue <= 0 || issue >= settlement || firstInterest < startRangeCurrentDateSystem ||
settlement < startRangeCurrentDateSystem || rate <= 0 || par <= 0 || basis < 0 ||
basis > 4 || (frequency != 1 && frequency != 2 && frequency != 4) || (!calcMethod && firstInterest < 366 / frequency)) {
@@ -692,13 +699,19 @@ function (window, undefined) {
return newDate;
}
+ // The function calculates accrued interest on a security on which interest is paid at a certain frequency
+ // Argument calc_method = 0 (we calculate the accumulated interest from the first payment date (first_interest) to the date of purchase of the security (settlement))
+ // calc_method = 1 (we calculate the accumulated interest from the issue date to the date of purchase of the security (settlement))
+ // calc_method = 0 is taken into account only if the date of the first payment (first_interest) is greater than the release date (issue)
+
// exception for 1900/1/29 date
let iss = issue === 60 ? new Date(Date.UTC(1900, 1, 29)) : AscCommonExcel.getCorrectDate(issue),
fInter = firstInterest === 60 ? new Date(Date.UTC(1900, 1, 29)) : AscCommonExcel.getCorrectDate(firstInterest),
settl = settlement === 60 ? new Date(Date.UTC(1900, 1, 29)) : AscCommonExcel.getCorrectDate(settlement),
numMonths = 12 / frequency,
numMonthsNeg = -numMonths,
- endMonth = fInter.lastDayOfMonth(), coupPCD, firstDate, startDate, endDate, res, days, coupDays;
+ endMonth = fInter.lastDayOfMonth() || (fInter.getUTCDate() === 30 && basis === AscCommonExcel.DayCountBasis.UsPsa30_360),
+ coupPCD, firstDate, startDate, endDate, res, days, coupDays;
let mainCoupPcd = lcl_GetCouppcd(iss, fInter, frequency);
// if the first coupon period === 0, return 0 as in MS
@@ -725,16 +738,25 @@ function (window, undefined) {
// if first coup period, get date difference by default
if (mainCoupPcd < iss) {
- days = AscCommonExcel.diffDate(firstDate, settl, basis)
- } else if (mainCoupPcd >= iss) {
+ days = AscCommonExcel.diffDate(firstDate, settl, basis).getValue();
+ } else {
days = AscCommonExcel.days360(firstDate, settl, basis, true);
}
+
+ // if the first date was greater, change the sign of the day difference to minus
+ days = Math.abs(days) * (firstDate > settl ? -1 : 1);
coupDays = getcoupdays(coupPCD, fInter, frequency, basis).getValue();
res = days / coupDays;
startDate = new cDate(coupPCD);
endDate = iss;
-
+
+ // res - the coefficient that we use in the formula res * par * rate / frequency
+ // is found by iterating from the first coupon date to the issue date of the bond
+ // 1 step equals the number of months in the coupon period (12, 6, 3)
+ // at each iteration, the issue date and the current coupon date (with the step) are checked, and depending on the result, a number is added to the coefficient:
+ // - 1 or 0 depending on the calc_method used
+ // - or a fraction - the result of dividing the difference in days between the previous step's date and the current date by the number of days in the coupon period
while (!(numMonthsNeg > 0 ? startDate >= iss : startDate <= iss)) {
endDate = startDate;
startDate = addMonth(startDate, numMonthsNeg, endMonth);
@@ -744,8 +766,7 @@ function (window, undefined) {
coupDays = getcoupdays(startDate, endDate, frequency, basis).getValue();
} else {
days = AscCommonExcel.diffDate(firstDate, endDate, basis).getValue();
- coupDays = (basis == AscCommonExcel.DayCountBasis.Actual365) ? (365 / frequency) :
- AscCommonExcel.diffDate(startDate, endDate, basis).getValue();
+ coupDays = (basis == AscCommonExcel.DayCountBasis.Actual365) ? (365 / frequency) : AscCommonExcel.diffDate(startDate, endDate, basis).getValue();
}
res += (iss <= startDate) ? calcMethod : days / coupDays;
@@ -3585,61 +3606,61 @@ function (window, undefined) {
cODDFYIELD.prototype.argumentsType = [argType.any, argType.any, argType.any, argType.any, argType.any, argType.any,
argType.any, argType.any, argType.any];
cODDFYIELD.prototype.Calculate = function (arg) {
- var settlement = arg[0], maturity = arg[1], issue = arg[2], first_coupon = arg[3], rate = arg[4], pr = arg[5],
+ let settlement = arg[0], maturity = arg[1], issue = arg[2], first_coupon = arg[3], rate = arg[4], pr = arg[5],
redemption = arg[6], frequency = arg[7],
basis = arg[8] && !(arg[8] instanceof cEmpty) ? arg[8] : new cNumber(0);
- if (settlement instanceof cArea || settlement instanceof cArea3D) {
+ if (settlement.type === cElementType.cellsRange || settlement.type === cElementType.cellsRange3D) {
settlement = settlement.cross(arguments[1]);
- } else if (settlement instanceof cArray) {
+ } else if (settlement.type === cElementType.array) {
settlement = settlement.getElementRowCol(0, 0);
}
- if (maturity instanceof cArea || maturity instanceof cArea3D) {
+ if (maturity.type === cElementType.cellsRange || maturity.type === cElementType.cellsRange3D) {
maturity = maturity.cross(arguments[1]);
- } else if (maturity instanceof cArray) {
+ } else if (maturity.type === cElementType.array) {
maturity = maturity.getElementRowCol(0, 0);
}
- if (issue instanceof cArea || issue instanceof cArea3D) {
+ if (issue.type === cElementType.cellsRange || issue.type === cElementType.cellsRange3D) {
issue = issue.cross(arguments[1]);
- } else if (issue instanceof cArray) {
+ } else if (issue.type === cElementType.array) {
issue = issue.getElementRowCol(0, 0);
}
- if (first_coupon instanceof cArea || first_coupon instanceof cArea3D) {
+ if (first_coupon.type === cElementType.cellsRange || first_coupon.type === cElementType.cellsRange3D) {
first_coupon = first_coupon.cross(arguments[1]);
- } else if (first_coupon instanceof cArray) {
+ } else if (first_coupon.type === cElementType.array) {
first_coupon = first_coupon.getElementRowCol(0, 0);
}
- if (rate instanceof cArea || rate instanceof cArea3D) {
+ if (rate.type === cElementType.cellsRange || rate.type === cElementType.cellsRange3D) {
rate = rate.cross(arguments[1]);
- } else if (rate instanceof cArray) {
+ } else if (rate.type === cElementType.array) {
rate = rate.getElementRowCol(0, 0);
}
- if (pr instanceof cArea || pr instanceof cArea3D) {
+ if (pr.type === cElementType.cellsRange || pr.type === cElementType.cellsRange3D) {
pr = pr.cross(arguments[1]);
- } else if (pr instanceof cArray) {
+ } else if (pr.type === cElementType.array) {
pr = pr.getElementRowCol(0, 0);
}
- if (redemption instanceof cArea || redemption instanceof cArea3D) {
+ if (redemption.type === cElementType.cellsRange || redemption.type === cElementType.cellsRange3D) {
redemption = redemption.cross(arguments[1]);
- } else if (redemption instanceof cArray) {
+ } else if (redemption.type === cElementType.array) {
redemption = redemption.getElementRowCol(0, 0);
}
- if (frequency instanceof cArea || frequency instanceof cArea3D) {
+ if (frequency.type === cElementType.cellsRange || frequency.type === cElementType.cellsRange3D) {
frequency = frequency.cross(arguments[1]);
- } else if (frequency instanceof cArray) {
+ } else if (frequency.type === cElementType.array) {
frequency = frequency.getElementRowCol(0, 0);
}
- if (basis instanceof cArea || basis instanceof cArea3D) {
+ if (basis.type === cElementType.cellsRange || basis.type === cElementType.cellsRange3D) {
basis = basis.cross(arguments[1]);
- } else if (basis instanceof cArray) {
+ } else if (basis.type === cElementType.array) {
basis = basis.getElementRowCol(0, 0);
}
@@ -3653,31 +3674,31 @@ function (window, undefined) {
frequency = frequency.tocNumber();
basis = basis.tocNumber();
- if (settlement instanceof cError) {
+ if (settlement.type === cElementType.error) {
return settlement;
}
- if (maturity instanceof cError) {
+ if (maturity.type === cElementType.error) {
return maturity;
}
- if (issue instanceof cError) {
+ if (issue.type === cElementType.error) {
return issue;
}
- if (first_coupon instanceof cError) {
+ if (first_coupon.type === cElementType.error) {
return first_coupon;
}
- if (rate instanceof cError) {
+ if (rate.type === cElementType.error) {
return rate;
}
- if (pr instanceof cError) {
+ if (pr.type === cElementType.error) {
return pr;
}
- if (redemption instanceof cError) {
+ if (redemption.type === cElementType.error) {
return redemption;
}
- if (frequency instanceof cError) {
+ if (frequency.type === cElementType.error) {
return frequency;
}
- if (basis instanceof cError) {
+ if (basis.type === cElementType.error) {
return basis;
}
@@ -3716,7 +3737,7 @@ function (window, undefined) {
x = xN;
}
if (isNaN(x) || Infinity == Math.abs(x)) {
- var max = Number.MAX_VALUE, min = -Number.MAX_VALUE, step = 1.6,
+ let max = Number.MAX_VALUE, min = -Number.MAX_VALUE, step = 1.6,
low = guess - 0.01 <= min ? min + g_Eps : guess - 0.01,
high = guess + 0.01 >= max ? max - g_Eps : guess + 0.01, i, xBegin, xEnd, x, y, currentIter = 0;
@@ -3743,7 +3764,7 @@ function (window, undefined) {
return new cError(cErrorType.not_numeric);
}
- var fXbegin = iterF(xBegin), fXend = iterF(xEnd), fXi, xI;
+ let fXbegin = iterF(xBegin), fXend = iterF(xEnd), fXi, xI;
if (Math.abs(fXbegin) < g_Eps) {
return new cNumber(fXbegin);
@@ -5508,7 +5529,7 @@ function (window, undefined) {
cXIRR.prototype.returnValueType = AscCommonExcel.cReturnFormulaType.value_replace_area;
cXIRR.prototype.argumentsType = [argType.any, argType.any, argType.any];
cXIRR.prototype.Calculate = function (arg) {
- var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : new cNumber(0.1);
+ let arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : new cNumber(0.1);
function xirrFunction(values, dates, rate) {
var D_0 = dates[0], r = rate + 1, res = values[0];
@@ -5529,8 +5550,13 @@ function (window, undefined) {
function xirr2(_values, _dates, _rate) {
- var arr0 = _values[0], arr1 = _dates[0];
-
+
+ if (_values.length === 0 || _dates.length === 0) {
+ return new cError(cErrorType.not_numeric);
+ }
+
+ let arr0 = _values[0], arr1 = _dates[0];
+
if (arr0 instanceof cError) {
return arr0;
}
@@ -5643,9 +5669,26 @@ function (window, undefined) {
}
- var _dates = [], _values = [];
+ if (arg0.type === cElementType.error) {
+ return arg0;
+ }
+ if (arg1.type === cElementType.error) {
+ return arg1;
+ }
+ if (arg2.type === cElementType.error) {
+ return arg2;
+ }
+
+ if (arg0.type === cElementType.empty || arg1.type === cElementType.empty) {
+ return new cError(cErrorType.not_available);
+ }
+
+ let _dates = [], _values = [];
- if (arg0 instanceof cArea) {
+ if (arg0.type === cElementType.cellsRange || arg0.type === cElementType.cellsRange3D) {
+ if (arg0.type === cElementType.cellsRange3D && !arg0.isSingleSheet()) {
+ return new cError(cErrorType.wrong_value_type);
+ }
arg0.foreach2(function (c) {
if (c instanceof cNumber) {
_values.push(c);
@@ -5654,8 +5697,8 @@ function (window, undefined) {
} else {
_values.push(new cError(cErrorType.wrong_value_type));
}
- });
- } else if (arg0 instanceof cArray) {
+ })
+ } else if (arg0.type === cElementType.array) {
arg0.foreach(function (c) {
if (c instanceof cNumber) {
_values.push(c);
@@ -5665,21 +5708,17 @@ function (window, undefined) {
_values.push(new cError(cErrorType.wrong_value_type));
}
})
- } else if (arg0 instanceof cArea3D) {
- if (arg0.isSingleSheet()) {
- _values = arg0.getMatrix()[0];
- } else {
- return new cError(cErrorType.wrong_value_type);
- }
} else {
- if (!(arg0 instanceof cNumber)) {
+ if (!(arg0.type === cElementType.number)) {
return new cError(cErrorType.wrong_value_type)
- } else {
- _values[0] = arg0;
}
+ _values[0] = arg0;
}
- if (arg1 instanceof cArea) {
+ if (arg1.type === cElementType.cellsRange || arg1.type === cElementType.cellsRange3D) {
+ if (arg1.type === cElementType.cellsRange3D && !arg1.isSingleSheet()) {
+ return new cError(cErrorType.wrong_value_type);
+ }
arg1.foreach2(function (c) {
if (c instanceof cNumber) {
_dates.push(c);
@@ -5688,8 +5727,8 @@ function (window, undefined) {
} else {
_dates.push(new cError(cErrorType.wrong_value_type));
}
- });
- } else if (arg1 instanceof cArray) {
+ })
+ } else if (arg1.type === cElementType.array) {
arg1.foreach(function (c) {
if (c instanceof cNumber) {
_dates.push(c);
@@ -5699,18 +5738,11 @@ function (window, undefined) {
_dates.push(new cError(cErrorType.wrong_value_type));
}
})
- } else if (arg1 instanceof cArea3D) {
- if (arg1.isSingleSheet()) {
- _dates = arg1.getMatrix()[0];
- } else {
- return new cError(cErrorType.wrong_value_type);
- }
} else {
- if (!(arg1 instanceof cNumber)) {
+ if (!(arg1.type === cElementType.number)) {
return new cError(cErrorType.wrong_value_type)
- } else {
- _dates[0] = arg1;
}
+ _dates[0] = arg1;
}
if (arg2 instanceof AscCommonExcel.cRef || arg2 instanceof AscCommonExcel.cRef3D) {
@@ -5736,7 +5768,7 @@ function (window, undefined) {
return arg2;
}
- var res = xirr2(_values, _dates, arg2);
+ let res = xirr2(_values, _dates, arg2);
res.numFormat = 9;
return res;
diff --git a/cell/model/FormulaObjects/informationFunctions.js b/cell/model/FormulaObjects/informationFunctions.js
index 601096fe47..2ab9b630c3 100644
--- a/cell/model/FormulaObjects/informationFunctions.js
+++ b/cell/model/FormulaObjects/informationFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/logicalFunctions.js b/cell/model/FormulaObjects/logicalFunctions.js
index 747b77f33a..06bfae56fd 100644
--- a/cell/model/FormulaObjects/logicalFunctions.js
+++ b/cell/model/FormulaObjects/logicalFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/FormulaObjects/lookupandreferenceFunctions.js b/cell/model/FormulaObjects/lookupandreferenceFunctions.js
index 5a1971af14..09d076d575 100644
--- a/cell/model/FormulaObjects/lookupandreferenceFunctions.js
+++ b/cell/model/FormulaObjects/lookupandreferenceFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -628,31 +628,112 @@ function (window, undefined) {
if (_arg0 < 1 || _arg0 > arg.length - 1) {
return new cError(cErrorType.wrong_value_type);
}
-
- let returnVal = arg[Math.floor(_arg0)];
- if (returnVal.type === cElementType.cell || returnVal.type === cElementType.cell3D) {
- returnVal = returnVal.getValue();
- } else if (returnVal.type === cElementType.cellsRange || returnVal.type === cElementType.cellsRange3D) {
- returnVal = returnVal.cross(args[1]);
- }
- return returnVal;
+ return arg[Math.floor(_arg0)];
}
return new cError(cErrorType.wrong_value_type);
}
- if (cElementType.array === arg0.type) {
+ if (cElementType.array === arg0.type || cElementType.cellsRange === arg0.type || cElementType.cellsRange3D === arg0.type) {
+ // TODO refactor
// go through the array and return result for each element
let resArr = new cArray();
- arg0.foreach(function(elem, r, c) {
- if (!resArr.array[r]) {
+ let tempArraySize, maxArraySize = arg0.getDimensions();
+ let arg0Rows = maxArraySize.row, arg0Cols = maxArraySize.col;
+
+ // get max array size by first loop
+ arg0.foreach2(function (elem) {
+ let chosenArgument = chooseArgument(elem);
+ if (chosenArgument && chosenArgument.type === cElementType.cellsRange || chosenArgument.type === cElementType.cellsRange3D || chosenArgument.type === cElementType.array) {
+ tempArraySize = chosenArgument.getDimensions();
+ maxArraySize.row = tempArraySize.row > maxArraySize.row ? tempArraySize.row : maxArraySize.row;
+ maxArraySize.col = tempArraySize.col > maxArraySize.col ? tempArraySize.col : maxArraySize.col;
+ }
+ });
+
+ for (let r = 0; r < arg0Rows; r++) {
+ for (let c = 0; c < arg0Cols; c++) {
+ let elem = arg0.getValue2(r, c);
+ let chosenArgument = chooseArgument(elem);
+ let argDimensions = chosenArgument.getDimensions();
+ let singleRow = arg0Rows === 1;
+ let singleCol = arg0Cols === 1;
+ let tempArr = [];
+
+ if (singleRow || singleCol) {
+ // if the first argument has one row or column we need to fully take this row or column and pass it to the resulting array
+ for (let i = 0; i < (singleRow ? maxArraySize.row : maxArraySize.col); i++) {
+ let elemFromChosenArgument;
+ if (chosenArgument.type === cElementType.array || chosenArgument.type === cElementType.cellsRange || chosenArgument.type === cElementType.cellsRange3D) {
+ if (argDimensions.col === 1) {
+ // return elem from first col
+ elemFromChosenArgument = chosenArgument.getElementRowCol ? chosenArgument.getElementRowCol(singleRow ? i : r, 0) : chosenArgument.getValueByRowCol(singleRow ? i : r, 0);
+ } else if (argDimensions.row === 1) {
+ // return elem from first row
+ elemFromChosenArgument = chosenArgument.getElementRowCol ? chosenArgument.getElementRowCol(0, singleRow ? c : i) : chosenArgument.getValueByRowCol(0, singleRow ? c : i);
+ } else {
+ // return r/c elem
+ elemFromChosenArgument = chosenArgument.getElementRowCol ? chosenArgument.getElementRowCol(singleRow ? i : r, singleRow ? c : i) : chosenArgument.getValueByRowCol(singleRow ? i : r, singleRow ? c : i);
+ }
+
+ // if we go outside the range, we must return the #N/A error to the array
+ if ((singleRow && argDimensions.row - 1 !== 0 && argDimensions.row - 1 < i) || (singleCol && argDimensions.col - 1 !== 0 && argDimensions.col - 1 < i)) {
+ elemFromChosenArgument = new cError(cErrorType.not_available);
+ }
+ } else {
+ elemFromChosenArgument = chosenArgument;
+ }
+
+ // undefined can be obtained when accessing an empty cell in the range, in which case we need to return cEmpty
+ if (elemFromChosenArgument === undefined) {
+ elemFromChosenArgument = new cEmpty();
+ }
+
+ singleRow ? tempArr.push([elemFromChosenArgument]) : tempArr.push(elemFromChosenArgument);
+ }
+ singleRow ? resArr.pushCol(tempArr, 0) : resArr.pushRow([tempArr], 0);
+ } else {
+ // get r/c part from chosen argument
+ let elemFromChosenArgument;
+ if (chosenArgument.type === cElementType.array || chosenArgument.type === cElementType.cellsRange || chosenArgument.type === cElementType.cellsRange3D) {
+ if (argDimensions.row === 1) {
+ elemFromChosenArgument = chosenArgument.getElementRowCol ? chosenArgument.getElementRowCol(0, c) : chosenArgument.getValueByRowCol(0, c);
+ } else if (argDimensions.col === 1) {
+ elemFromChosenArgument = chosenArgument.getElementRowCol ? chosenArgument.getElementRowCol(r, 0) : chosenArgument.getValueByRowCol(r, 0);
+ } else {
+ elemFromChosenArgument = chosenArgument.getElementRowCol ? chosenArgument.getElementRowCol(r, c) : chosenArgument.getValueByRowCol(r, c);
+ }
+ if (argDimensions.col - 1 !== 0 && argDimensions.col - 1 < c) {
+ elemFromChosenArgument = new cError(cErrorType.not_available);
+ }
+ } else {
+ elemFromChosenArgument = chosenArgument;
+ }
+
+ // undefined can be obtained when accessing an empty cell in the range, in which case we need to return cEmpty
+ if (elemFromChosenArgument === undefined) {
+ elemFromChosenArgument = new cEmpty();
+ }
+
+ if (!resArr.array[r]) {
+ resArr.addRow();
+ }
+ resArr.addElement(elemFromChosenArgument);
+ }
+ }
+ }
+
+ if (resArr.getRowCount() < maxArraySize.row) {
+ // fill the rest of array with #N/A error
+ for (let i = resArr.getRowCount(); i < maxArraySize.row; i++) {
resArr.addRow();
+ for (let j = 0; j < resArr.getCountElementInRow(); j++) {
+ resArr.addElement(new cError(cErrorType.not_available));
+ }
}
+ }
- let res = chooseArgument(elem);
- resArr.addElement(res);
- });
return resArr;
}
@@ -999,7 +1080,7 @@ function (window, undefined) {
for (let i = 0; i < rows; i++) {
for (let j = 0; j < columns; j++) {
- let val = arg1.getValueByRowCol ? arg1.getValueByRowCol(i, j, true) : arg1.getElementRowCol(i, j);
+ let val = arg1.getValueByRowCol ? arg1.getValueByRowCol(i, j) : arg1.getElementRowCol(i, j, true);
val = val.tocBool();
val = val.toBool ? val.toBool() : new cError(cErrorType.wrong_value_type);
@@ -1064,10 +1145,10 @@ function (window, undefined) {
}
if (rangeMode) {
- const initialArrayDimensions = arg0.getDimensions(),
+ const initialArrayDimensions = arg0.getDimensions(true),
initRows = initialArrayDimensions.row,
initColumns = initialArrayDimensions.col,
- lookingArrayDimensions = arg1.getDimensions();
+ lookingArrayDimensions = arg1.getDimensions(true);
// check for matching array sizes
if (lookingArrayDimensions.row === 1 && lookingArrayDimensions.col === initColumns) {
@@ -1173,7 +1254,7 @@ function (window, undefined) {
if (cElementType.cell !== pivot_table_ref.type && cElementType.cell3D !== pivot_table_ref.type && cElementType.cellsRange !== pivot_table_ref.type && cElementType.cellsRange3D !== pivot_table_ref.type) {
return refError;
}
- let worksheet = pivot_table_ref.ws;
+ let worksheet = pivot_table_ref.getWS();
let bbox = pivot_table_ref.getBBox0();
let pivotTables = worksheet.getPivotTablesIntersectingRange(bbox);
@@ -1275,18 +1356,45 @@ function (window, undefined) {
cHLOOKUP.prototype.name = 'HLOOKUP';
cHLOOKUP.prototype.argumentsMin = 3;
cHLOOKUP.prototype.argumentsMax = 4;
- cHLOOKUP.prototype.arrayIndexes = {1: 1, 2: 1};
+ cHLOOKUP.prototype.arrayIndexes = {0: 1, 1: 1, 2: 1};
cHLOOKUP.prototype.argumentsType = [argType.any, argType.number, argType.number, argType.logical];
cHLOOKUP.prototype.Calculate = function (arg) {
- //TODO с excel есть несоостветствие - в тестовом файле - E11:H13
- if(this.bArrayFormula) {
- //исключение, когда в формуле массива берется из одного аргумента только 1 элемент
- if(cElementType.cellsRange3D === arg[2].type || cElementType.cellsRange === arg[2].type) {
- arg[2] = arg[2].getValue2(0,0);
- } else if(cElementType.array === arg[2].type) {
+ let retArr = new cArray();
+ let error = false;
+ if (arg[0].type === cElementType.array) {
+ if (arg[2] && arg[2].type === cElementType.cellsRange || arg[2].type === cElementType.cellsRange3D || arg[2].type === cElementType.array) {
arg[2] = arg[2].getValue2(0,0);
}
+ let dimension = arg[0].getDimensions();
+ for (let r = 0; r < dimension.row; r++) {
+ retArr.addRow();
+ for (let c = 0; c < dimension.col; c++) {
+ retArr.addElement(g_oHLOOKUPCache.calculate([arg[0].getValue2(r, c), arg[1], arg[2], arg[3]], arguments[1]));
+ }
+ }
+
+ return retArr;
+ }
+
+ if (arg[2] && (arg[2].type === cElementType.array)) {
+ let dimension = arg[2].getDimensions();
+ for (let r = 0; r < dimension.row; r++) {
+ retArr.addRow();
+ for (let c = 0; c < dimension.col; c++) {
+ if (!error) {
+ let res = g_oHLOOKUPCache.calculate([arg[0], arg[1], arg[2].getValue2(r, c), arg[3]], arguments[1]);
+ if (res.type === cElementType.error) {
+ error = true
+ }
+ retArr.addElement(res);
+ } else {
+ break
+ }
+ }
+ }
+ return error ? new cError(cErrorType.bad_reference) : retArr;
}
+
return g_oHLOOKUPCache.calculate(arg, arguments[1]);
};
@@ -1364,8 +1472,8 @@ function (window, undefined) {
cINDEX.prototype.arrayIndexes = {0: 1};
cINDEX.prototype.argumentsType = [argType.reference, argType.number, argType.number];
cINDEX.prototype.Calculate = function (arg) {
- var arg0 = arg[0], arg1 = arg[1] && (cElementType.empty !== arg[1].type) ? arg[1] : new cNumber(1),
- arg2 = arg[2] && (cElementType.empty !== arg[2].type) ? arg[2] : new cNumber(1),
+ let arg0 = arg[0], arg1 = arg[1] && (cElementType.empty !== arg[1].type) ? arg[1] : new cNumber(0),
+ arg2 = arg[2] && (cElementType.empty !== arg[2].type) ? arg[2] : new cNumber(0),
arg3 = arg[3] && (cElementType.empty !== arg[3].type) ? arg[3] : new cNumber(1), res;
if (cElementType.cellsRange3D === arg0.type) {
@@ -1411,11 +1519,11 @@ function (window, undefined) {
return new cError(cErrorType.wrong_value_type);
}
- var generateArray = function (_from, row, col) {
- var ret = null;
- var _colCount = _from.getCountElementInRow();
- var _rowCount = _from.rowCount;
- var i;
+ const generateArray = function (_from, row, col) {
+ let ret = null;
+ let _colCount = _from.getCountElementInRow();
+ let _rowCount = _from.rowCount;
+ let i;
row = row !== undefined ? Math.ceil(row) : row;
col = col !== undefined ? Math.ceil(col) : col;
if (undefined !== row) {
@@ -1453,77 +1561,71 @@ function (window, undefined) {
};
AscCommonExcel.executeInR1C1Mode(false, function () {
- if (cElementType.array === arg0.type) {
- if ((!arg[1] || arg1 === 0) && (!arg[2] || arg2 === 0)) {
- //возвращаем массив
- res = arg0;
- } else if (!arg[2] || arg2 === 0) {
- //возращаем массив из arg1 строки
- res = generateArray(arg0, arg1);
- } else if (!arg[1] || arg1 === 0) {
- //возращаем массив из arg2 столбца
- res = generateArray(arg0, undefined, arg2);
- } else if(undefined === arg[2] && 1 === arg0.rowCount) {//если последний аргумент опущен, и выделенa 1 строка
- res = arg0.getValue2(0, (0 === arg1) ? 0 : arg1 - 1);
- } else if(undefined === arg[2] && 1 === arg0.getCountElementInRow()) {//если последний аргумент опущен, и выделен 1 столбец
- res = arg0.getValue2((0 === arg1) ? 0 : arg1 - 1, 0);
- } else {
- res = arg0.getValue2((1 === arg0.rowCount || 0 === arg1) ? 0 : arg1 - 1, 0 === arg2 ? 0 : arg2 - 1);
- }
- } else if (cElementType.cellsRange === arg0.type) {
- var ws = arg0.getWS(), bbox = arg0.getBBox0();
-
- if(cElementType.empty === arg[1].type) {
- arg1 = 0;
- }
-
- var diffArg1 = arg1 === 0 ? 0 : 1;
- var diffArg2 = arg2 === 0 ? 0 : 1;
- if(undefined === arg[2] && bbox.r1 === bbox.r2) {//если последний аргумент опущен, и выделенa 1 строка
- if (arg1 > Math.abs(bbox.c1 - bbox.c2) + 1) {
- res = new cError(cErrorType.bad_reference);
- } else {
- res = new Asc.Range(bbox.c1 + arg1 - diffArg1, bbox.r1, bbox.c1 + arg1 - diffArg1, bbox.r1);
- res = new cRef(res.getName(), ws);
- }
- } else if(undefined === arg[2] && bbox.c1 === bbox.c2 && arg1 > 0) {//если последний аргумент опущен, и выделен 1 столбец
- if (arg1 > Math.abs(bbox.r1 - bbox.r2) + 1) {
- res = new cError(cErrorType.bad_reference);
+ let dimension = arg0.getDimensions();
+ let isSingleRowCol = (dimension.row > 1 && dimension.col > 1) ? false : true;
+ let isByColumn = (dimension.row > 1) ? true : false;
+ let isArray = cElementType.array === arg0.type;
+
+ let diffArg1 = arg1 === 0 ? 0 : 1;
+ let diffArg2 = arg2 === 0 ? 0 : 1;
+
+ if (arg[2] !== undefined && (arg1 > dimension.row || arg2 > dimension.col)) {
+ /* if the col_num and row_num in the arguments is greater than the array size, return an error */
+ res = new cError(cErrorType.bad_reference);
+ } else if (!isArray && arg[2] === undefined && !isSingleRowCol) {
+ /* if the second arg is ommited and range(exactly reference) is two dimensional, return an error */
+ res = new cError(cErrorType.bad_reference);
+ } else if (cElementType.array === arg0.type || cElementType.cellsRange === arg0.type) {
+ let ws = arg0.getWS ? arg0.getWS() : null, bbox = arg0.getBBox0 ? arg0.getBBox0() : null;
+
+ if (!isSingleRowCol) {
+ /* r&c > 1 */
+ if (arg1 === 0 && arg2 === 0) {
+ res = arg0;
+ } else if (arg1 === 0) {
+ // return full column
+ if (isArray) {
+ res = generateArray(arg0, undefined, arg2);
+ } else {
+ res = new Asc.Range(bbox.c1 + arg2 - diffArg2, bbox.r1, bbox.c1 + arg2 - diffArg2, bbox.r2);
+ res = new cArea(res.getName(), ws);
+ }
+ } else if (arg2 === 0) {
+ // return full row
+ if (isArray) {
+ res = generateArray(arg0, arg1, undefined);
+ } else {
+ res = new Asc.Range(bbox.c1, bbox.r1 + arg1 - diffArg1, bbox.c2, bbox.r1 + arg1 - diffArg1);
+ res = new cArea(res.getName(), ws);
+ }
} else {
- res = new Asc.Range(bbox.c1, bbox.r1 + arg1 - diffArg1, bbox.c1, bbox.r1 + arg1 - diffArg1);
- res = new cRef(res.getName(), ws);
- }
- } else if(undefined === arg[2] && Math.abs(bbox.r1 - bbox.r2) + 1 > 1 && Math.abs(bbox.c1 - bbox.c2) + 1 > 1) {//если последний аргумент опущен, и выделен более 1 строки и более 1 столбца
- //так себя ведёт excel в случае с cellsArea
- res = new cError(cErrorType.bad_reference);
- } else if (bbox.r1 === bbox.r2) {/*одна строка*/
- res = new Asc.Range(bbox.c1 + arg2 - 1, bbox.r1, bbox.c1 + arg2 - 1, bbox.r1);
- res = new cRef(res.getName(), ws);
- } else {
- if (0 === arg1 && arg2 > 0) {
- if (arg2 > Math.abs(bbox.c1 - bbox.c2) + 1) {
- res = new cError(cErrorType.bad_reference);
+ if (isArray) {
+ res = arg0.getValue2(arg1 > 0 ? arg1 - 1 : 0, arg2 > 0 ? arg2 - 1 : 0);
} else {
- if (0 === arg2 || undefined === arg[2] || cElementType.empty === arg[2].type) {
- res = new Asc.Range(bbox.c1 + arg2 - 1, bbox.r1, bbox.c2 + arg2 - 1, bbox.r2);
- } else {
- res = new Asc.Range(bbox.c1 + arg2 - 1, bbox.r1, bbox.c1 + arg2 - 1, bbox.r2);
- }
- res = res.isOneCell() ? new cRef(res.getName(),ws) : new cArea(res.getName(), ws);
+ res = new Asc.Range(bbox.c1 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1, bbox.c1 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1);
+ res = new cRef(res.getName(), ws);
}
- } else if ((0 === arg2 || undefined === arg[2] || cElementType.empty === arg[2].type) && arg1 > 0) {
- if (arg1 > Math.abs(bbox.r1 - bbox.r2) + 1) {
- res = new cError(cErrorType.bad_reference);
+ }
+ } else {
+ /* r|c === 1 */
+ if (arg[2] === undefined && ((isByColumn && arg1 > dimension.row) || (!isByColumn && arg1 > dimension.col))) {
+ res = new cError(cErrorType.bad_reference);
+ } else if (arg1 === 0 && isByColumn) {
+ // res = isByColumn ? arg0 : arg0.getValue2(1, arg2);
+ res = arg0;
+ } else if (undefined !== arg[2] && arg2 === 0 && !isByColumn) {
+ res = arg0;
+ } else if (undefined === arg[2] && dimension.row === 1) {
+ // if the last argument is omitted and 1 line is selected
+ if (isArray) {
+ res = arg0.getValue2(0, arg1 > 0 ? arg1 - 1 : 0);
} else {
- res = new Asc.Range(bbox.c1 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1, bbox.c2 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1);
- res = res.isOneCell() ? new cRef(res.getName(),ws) : new cArea(res.getName(), ws);
+ res = new Asc.Range(bbox.c1 + arg1 - diffArg1, bbox.r1, bbox.c1 + arg1 - diffArg1, bbox.r1);
+ res = new cRef(res.getName(), ws);
}
- } else if ((0 === arg1 || undefined === arg[1] || cElementType.empty === arg[1].type) && (0 === arg2 || undefined === arg[2] || cElementType.empty === arg[2].type)) {
- res = new Asc.Range(bbox.c1 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1, bbox.c2 + arg2 - diffArg2, bbox.r2 + arg1 - diffArg1);
- res = res.isOneCell() ? new cRef(res.getName(),ws) : new cArea(res.getName(), ws);
} else {
- if (arg1 > Math.abs(bbox.r1 - bbox.r2) + 1 || arg2 > Math.abs(bbox.c1 - bbox.c2) + 1) {
- res = new cError(cErrorType.bad_reference);
+ if (isArray) {
+ res = arg0.getValue2(arg1 > 0 ? arg1 - 1 : 0, arg2 > 0 ? arg2 - 1 : 0);
} else {
res = new Asc.Range(bbox.c1 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1, bbox.c1 + arg2 - diffArg2, bbox.r1 + arg1 - diffArg1);
res = new cRef(res.getName(), ws);
@@ -1658,9 +1760,26 @@ function (window, undefined) {
cLOOKUP.prototype.name = 'LOOKUP';
cLOOKUP.prototype.argumentsMin = 2;
cLOOKUP.prototype.argumentsMax = 3;
- cLOOKUP.prototype.arrayIndexes = {1: 1, 2: 1};
+ cLOOKUP.prototype.arrayIndexes = {0: 1, 1: 1, 2: 1};
cLOOKUP.prototype.argumentsType = [argType.any, argType.reference, argType.reference];
cLOOKUP.prototype.Calculate = function (arg) {
+
+ if (!AscCommonExcel.bIsSupportDynamicArrays && arg[0].type === cElementType.cellsRange || arg[0].type === cElementType.cellsRange3D) {
+ arg[0] = arg[0].isOneElement() ? arg[0].getFirstElement() : arg[0].cross(arguments[1]);
+ } else if (arg[0].type === cElementType.array) {
+ let retArr = new cArray();
+ let dimension = arg[0].getDimensions();
+
+ for (let r = 0; r < dimension.row; r++) {
+ retArr.addRow();
+ for (let c = 0; c < dimension.col; c++) {
+ retArr.addElement(g_oLOOKUPCache.calculate([arg[0].getValue2(r, c), arg[1], arg[2]], arguments[1]));
+ }
+ }
+ return retArr;
+ }
+
+
return g_oLOOKUPCache.calculate(arg, arguments[1]);
};
@@ -2756,23 +2875,31 @@ function (window, undefined) {
}
VHLOOKUPCache.prototype.calculate = function (arg, argument1) {
- var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
- var arg3 = arg[3] ? arg[3].tocBool().value : true;
- var opt_xlookup = arg[4] !== undefined;
- var opt_arg4, opt_arg5;
+ let arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
+ let arg3 = arg[3] ? arg[3].tocBool().value : true;
+ let opt_xlookup = arg[4] !== undefined;
+ let opt_arg4, opt_arg5;
if (opt_xlookup) {
opt_arg4 = arg[4];
opt_arg5 = arg[5];
}
- var t = this, number, valueForSearching, r, c, res = -1, min, regexp, count;
+ let t = this, number, valueForSearching, r, c, res = -1, min, regexp, count;
if (!opt_xlookup) {
- number = arg2.getValue() - 1;
- if (cElementType.array === arg2.type) {
- var arg2Val = arg2.getElementRowCol(0, 0);
- number = arg2Val ? arg2Val.getValue() - 1 : number;
+ if (cElementType.cell3D === arg2.type || cElementType.cell === arg2.type) {
+ arg2 = arg2.getValue();
+ } else if (cElementType.array === arg2.type) {
+ arg2 = arg2.getElementRowCol(0, 0);
+ } else if (cElementType.cellsRange === arg2.type || cElementType.cellsRange3D === arg2.type) {
+ arg2 = arg2.cross(argument1);
+ }
+
+ if (cElementType.error === arg2.type) {
+ return arg2;
}
+ number = arg2.getValue() - 1;
+
if (isNaN(number)) {
return new cError(cErrorType.bad_reference);
}
@@ -2789,7 +2916,7 @@ function (window, undefined) {
return arg0;
}
- var arg0Val;
+ let arg0Val;
if (cElementType.array === arg0.type) {
arg0Val = arg0.getElementRowCol(0, 0);
valueForSearching = ('' + arg0Val.getValue()).toLowerCase();
@@ -2812,41 +2939,50 @@ function (window, undefined) {
return new cError(cErrorType.not_available);
}
- //TODO hlookup не правильно работает если первый агумент массив - раскомментировать тесты для hlookup
- var found = false;
+ let found = false;
+ let arg0ValType = arg0Val.type
if (cElementType.array === arg1.type && !opt_xlookup) {
// ToDo
if (cElementType.string === arg0.type) {
regexp = searchRegExp(valueForSearching);
}
- arg1.foreach(function (elem, r, c) {
- var v = ('' + elem.getValue()).toLowerCase();
- var i = t.bHor ? c : r;
- if (0 === i) {
- min = v;
- }
+ let arrayToSearch, row, col, res = -1;
+ let dimension = arg1.getDimensions();
+
+ row = this.bHor ? 0 : dimension.row;
+ col = this.bHor ? dimension.col : 0;
+
+ if (this.bHor) {
+ arrayToSearch = arg1.getRow(0);
+ } else {
+ arrayToSearch = arg1.getCol(0);
+ }
+
+ if (arrayToSearch) {
if (arg3) {
- if (valueForSearching === v) {
- res = i;
- found = true;
- } else if (valueForSearching > v && !found) {
- res = i;
- }
+ // approximate(binary) search
+ res = _func.binarySearch(arg0Val, arrayToSearch, false);
} else {
- if (cElementType.string === arg0.type) {
- if (regexp.test(v)) {
+ // exact (simple) search
+ for (let i = 0; i < arrayToSearch.length; i++) {
+ let elem = arrayToSearch[i];
+ let elemValue = elem.getValue();
+
+ if (elem.type === cElementType.string) {
+ elemValue = elemValue.toLowerCase();
+ }
+
+ if ((elem.type === arg0ValType) && elemValue === arg0Val.getValue()) {
res = i;
+ break
}
- } else if (valueForSearching === v) {
- res = i;
}
}
- min = Math.min(min, v);
- });
+ }
- if (/*min > valueForSearching ||*/ -1 === res) {
+ if (-1 === res) {
return new cError(cErrorType.not_available);
}
@@ -2860,12 +2996,12 @@ function (window, undefined) {
return arg1.getElementRowCol(r, c);
}
- var range;
+ let range;
if (cElementType.cell === arg1.type || cElementType.cell3D === arg1.type ||
cElementType.cellsRange === arg1.type || cElementType.cellsRange3D === arg1.type) {
range = arg1.getRange();
} else if (cElementType.array === arg1.type && opt_xlookup) {
- var _cacheElem = {elements: []};
+ let _cacheElem = {elements: []};
arg1.foreach(function (elem, r, c) {
if (elem && elem.type === cElementType.string) {
elem.value = elem.value.toLowerCase();
@@ -2879,15 +3015,15 @@ function (window, undefined) {
return new cError(cErrorType.bad_reference);
}
- var bb = range.getBBox0();
+ let bb = range.getBBox0();
count = this.bHor ? (bb.r2 - bb.r1) : (bb.c2 - bb.c1);
if (number > count) {
return new cError(cErrorType.bad_reference);
}
- var ws = arg1.getWS();
+ let ws = arg1.getWS();
r = this.bHor ? bb.r1 : bb.r2;
c = this.bHor ? bb.c2 : bb.c1;
- var oSearchRange = ws.getRange3(bb.r1, bb.c1, r, c);
+ let oSearchRange = ws.getRange3(bb.r1, bb.c1, r, c);
res = this._get(oSearchRange, arg0Val, arg3, opt_arg4, opt_arg5);
@@ -2901,7 +3037,7 @@ function (window, undefined) {
r = this.bHor ? bb.r1 + number : res;
c = this.bHor ? res : bb.c1 + number;
- var resVal;
+ let resVal;
arg1.getWS()._getCellNoEmpty(r, c, function (cell) {
resVal = checkTypeCell(cell);
});
@@ -3021,8 +3157,9 @@ function (window, undefined) {
//из обработанных элементов выбираем те, которые больше(меньше) -> из них уже ищем наименьший(наибольший)
//т.е. в итоге получаем следующий наименьший/наибольший элемент
const _binarySearch = function (revert) {
+ let canCompare;
+
i = 0;
-
//TODO проверить обратный поиск
if (revert) {
j = length - 1;
@@ -3049,12 +3186,22 @@ function (window, undefined) {
k = Math.floor((i + j) / 2);
elem = cacheArray[k];
val = elem.v;
+ canCompare = true;
if (val.type === cElementType.empty) {
val = val.tocBool();
}
+
+ if (valueForSearching.type !== val.type) {
+ if (valueForSearching.type !== cElementType.string && val.type !== cElementType.string) {
+ canCompare = true;
+ } else {
+ canCompare = false;
+ }
+ }
+
if (_compareValues(valueForSearching, val, "=")) {
return elem.i;
- } else if (_compareValues(valueForSearching, val, "<")) {
+ } else if (canCompare && _compareValues(valueForSearching, val, "<")) {
j = k - 1;
opt_arg4 !== undefined && addNextOptVal(elem, valueForSearching, true);
} else {
@@ -4060,19 +4207,46 @@ function (window, undefined) {
cVLOOKUP.prototype.name = 'VLOOKUP';
cVLOOKUP.prototype.argumentsMin = 3;
cVLOOKUP.prototype.argumentsMax = 4;
- cVLOOKUP.prototype.arrayIndexes = {1: 1, 2: {0: 0}};
+ cVLOOKUP.prototype.arrayIndexes = {/*0: 1,*/ 1: 1, /*2: 1*/};
cVLOOKUP.prototype.numFormat = AscCommonExcel.cNumFormatNone;
+ // cVLOOKUP.prototype.returnValueType = AscCommonExcel.cReturnFormulaType.value_replace_area;
cVLOOKUP.prototype.argumentsType = [argType.any, argType.number, argType.number, argType.logical];
cVLOOKUP.prototype.Calculate = function (arg) {
+ let retArr = new cArray();
+ let error = false;
- if(this.bArrayFormula) {
- //в случае когда первый аргумент - массив
- //исключение, когда в формуле массива берется из одного аргумента только 1 элемент
- if(cElementType.cellsRange3D === arg[2].type || cElementType.cellsRange === arg[2].type) {
- arg[2] = arg[2].getValue2(0,0);
- } else if(cElementType.array === arg[2].type) {
+ if (arg[0].type === cElementType.array) {
+ if (arg[2] && arg[2].type === cElementType.cellsRange || arg[2].type === cElementType.cellsRange3D || arg[2].type === cElementType.array) {
arg[2] = arg[2].getValue2(0,0);
}
+ let dimension = arg[0].getDimensions();
+ for (let r = 0; r < dimension.row; r++) {
+ retArr.addRow();
+ for (let c = 0; c < dimension.col; c++) {
+ retArr.addElement(g_oVLOOKUPCache.calculate([arg[0].getValue2(r, c), arg[1], arg[2], arg[3]], arguments[1]));
+ }
+ }
+
+ return retArr;
+ }
+
+ if (arg[2] && (arg[2].type === cElementType.array)) {
+ let dimension = arg[2].getDimensions();
+ for (let r = 0; r < dimension.row; r++) {
+ retArr.addRow();
+ for (let c = 0; c < dimension.col; c++) {
+ if (!error) {
+ let res = g_oVLOOKUPCache.calculate([arg[0], arg[1], arg[2].getValue2(r, c), arg[3]], arguments[1]);
+ if (res.type === cElementType.error) {
+ error = true;
+ }
+ retArr.addElement(res);
+ } else {
+ break;
+ }
+ }
+ }
+ return error ? new cError(cErrorType.bad_reference) : retArr
}
return g_oVLOOKUPCache.calculate(arg, arguments[1]);
@@ -4382,7 +4556,12 @@ function (window, undefined) {
if (arg1.type === arg1.empty) {
return new cError(cErrorType.wrong_value_type);
}
- arg1 = arg1.toArray();
+
+ if (arg1.type === cElementType.cellsRange3D) {
+ arg1 = arg1.toArray()[0];
+ } else {
+ arg1 = arg1.toArray();
+ }
//Excel returns a #NUM when array is too large.
let elemCount = arg1.length * arg1[0].length;
diff --git a/cell/model/FormulaObjects/mathematicFunctions.js b/cell/model/FormulaObjects/mathematicFunctions.js
index f78c7fc874..902fdfbc31 100644
--- a/cell/model/FormulaObjects/mathematicFunctions.js
+++ b/cell/model/FormulaObjects/mathematicFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -82,7 +82,7 @@ function (window, undefined) {
cCOTH, cCSC, cCSCH, cDECIMAL, cDEGREES, cECMA_CEILING, cEVEN, cEXP, cFACT, cFACTDOUBLE, cFLOOR, cFLOOR_PRECISE,
cFLOOR_MATH, cGCD, cINT, cISO_CEILING, cLCM, cLN, cLOG, cLOG10, cMDETERM, cMINVERSE, cMMULT, cMOD, cMROUND,
cMULTINOMIAL, cMUNIT, cODD, cPI, cPOWER, cPRODUCT, cQUOTIENT, cRADIANS, cRAND, cRANDARRAY, cRANDBETWEEN, cROMAN, cROUND, cROUNDDOWN,
- cROUNDUP, cSEC, cSECH, cSERIESSUM, cSIGN, cSIN, cSINH, cSQRT, cSQRTPI, cSUBTOTAL, cSUM, cSUMIF, cSUMIFS,
+ cROUNDUP, cSEC, cSECH, cSERIESSUM, cSIGN, cSIN, cSINGLE, cSINH, cSQRT, cSQRTPI, cSUBTOTAL, cSUM, cSUMIF, cSUMIFS,
cSUMPRODUCT, cSUMSQ, cSUMX2MY2, cSUMX2PY2, cSUMXMY2, cTAN, cTANH, cTRUNC, cSEQUENCE);
var cSubTotalFunctionType = {
@@ -389,21 +389,21 @@ function (window, undefined) {
cAGGREGATE.prototype.isXLFN = true;
cAGGREGATE.prototype.argumentsType = [argType.number, argType.number, [argType.reference]];
//TODO начиная со 3 аргумента все оставшиеся - массивы
- cAGGREGATE.prototype.arrayIndexes = {2: 1, 3: 1, 4: 1, 5: 1, 6: 1};
+ cAGGREGATE.prototype.arrayIndexes = {1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1};
cAGGREGATE.prototype.Calculate = function (arg) {
- var oArguments = this._prepareArguments([arg[0], arg[1]], arguments[1]);
- var argClone = oArguments.args;
+ let oArguments = this._prepareArguments([arg[0], arg[1]], arguments[1]);
+ let argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
- var argError;
+ let argError;
if (argError = this._checkErrorArg(argClone)) {
return argError;
}
- var nFunc = argClone[0].getValue();
- var f = null;
+ let nFunc = argClone[0].getValue();
+ let f = null;
switch (nFunc) {
case AGGREGATE_FUNC_AVE:
f = AscCommonExcel.cAVERAGE.prototype;
@@ -482,10 +482,10 @@ function (window, undefined) {
return new cError(cErrorType.wrong_value_type);
}
- var nOption = argClone[1].getValue();
- var ignoreHiddenRows = false;
- var ignoreErrorsVal = false;
- var ignoreNestedStAg = false;
+ let nOption = argClone[1].getValue();
+ let ignoreHiddenRows = false;
+ let ignoreErrorsVal = false;
+ let ignoreNestedStAg = false;
switch (nOption) {
case 0 : // ignore nested SUBTOTAL and AGGREGATE functions
ignoreNestedStAg = true;
@@ -519,20 +519,20 @@ function (window, undefined) {
return new cError(cErrorType.not_numeric);
}
- var res;
+ let res;
if (f) {
- var oldExcludeHiddenRows = f.excludeHiddenRows;
- var oldExcludeErrorsVal = f.excludeErrorsVal;
- var oldIgnoreNestedStAg = f.excludeNestedStAg;
+ let oldExcludeHiddenRows = f.excludeHiddenRows;
+ let oldExcludeErrorsVal = f.excludeErrorsVal;
+ let oldIgnoreNestedStAg = f.excludeNestedStAg;
f.excludeHiddenRows = ignoreHiddenRows;
f.excludeErrorsVal = ignoreErrorsVal;
f.excludeNestedStAg = ignoreNestedStAg;
- var newArgs = [];
+ let newArgs = [];
//14 - 19 особенные функции, требующие второго аргумента
- var doNotCheckRef = nFunc >= 14 && nFunc <= 19;
- for (var i = 2; i < arg.length; i++) {
+ let doNotCheckRef = nFunc >= 14 && nFunc <= 19;
+ for (let i = 2; i < arg.length; i++) {
//аргумент может быть только ссылка на ячейку или диапазон ячеек
//в противном случае - ошибка
if (doNotCheckRef || this.checkRef(arg[i])) {
@@ -4322,6 +4322,8 @@ function (window, undefined) {
cROUNDUP.prototype.argumentsType = [argType.number, argType.number];
cROUNDUP.prototype.Calculate = function (arg) {
function roundupHelper(number, num_digits) {
+ let fractionalPart = number.toString().split(".")[1];
+
if (num_digits > AscCommonExcel.cExcelMaxExponent) {
if (Math.abs(number) >= 1e-100 || num_digits <= 98303) {
return new cNumber(number);
@@ -4332,6 +4334,8 @@ function (window, undefined) {
return new cNumber(number);
}
return new cError(cErrorType.not_numeric);
+ } else if (fractionalPart && fractionalPart.length === num_digits) {
+ return new cNumber(number);
}
let sign = number >= 0 ? 1 : -1,
@@ -4671,6 +4675,32 @@ function (window, undefined) {
return arg0;
};
+ /**
+ * @constructor
+ * @extends {AscCommonExcel.cBaseFunction}
+ */
+ function cSINGLE() {
+ }
+
+ //***array-formula***
+ cSINGLE.prototype = Object.create(cBaseFunction.prototype);
+ cSINGLE.prototype.constructor = cSINGLE;
+ cSINGLE.prototype.name = 'SINGLE';
+ cSINGLE.prototype.argumentsMin = 1;
+ cSINGLE.prototype.argumentsMax = 1;
+ cSINGLE.prototype.argumentsType = [argType.any];
+ cSINGLE.prototype.arrayIndexes = {0: 1};
+ cSINGLE.prototype.isXLFN = true;
+ cSINGLE.prototype.Calculate = function (arg) {
+ let arg0 = arg[0];
+ if (arg0.type === cElementType.cellsRange || arg0.type === cElementType.cellsRange3D) {
+ arg0 = arg0.cross(arguments[1]);
+ } else if (arg0.type === cElementType.array) {
+ arg0 = arg0.getElement(0);
+ }
+ return arg0;
+ };
+
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
@@ -4966,9 +4996,10 @@ function (window, undefined) {
cSUMIF.prototype.argumentsMin = 2;
cSUMIF.prototype.argumentsMax = 3;
cSUMIF.prototype.arrayIndexes = {0: 1, 2: 1};
+ cSUMIF.prototype.exactTypes = {0: 1};
cSUMIF.prototype.argumentsType = [argType.reference, argType.any, argType.reference];
cSUMIF.prototype.Calculate = function (arg) {
- var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : arg[0], _sum = 0, matchingInfo;
+ let arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : arg[0], _sum = 0, matchingInfo;
if (cElementType.cell !== arg0.type && cElementType.cell3D !== arg0.type &&
cElementType.cellsRange !== arg0.type) {
if (cElementType.cellsRange3D === arg0.type) {
@@ -4999,7 +5030,9 @@ function (window, undefined) {
arg1 = arg1.getElementRowCol(0, 0);
}
- arg1 = arg1.tocString();
+ if (cElementType.string !== arg1.type) {
+ arg1 = arg1.tocString();
+ }
if (cElementType.string !== arg1.type) {
return new cError(cErrorType.wrong_value_type);
@@ -5007,9 +5040,9 @@ function (window, undefined) {
matchingInfo = AscCommonExcel.matchingValue(arg1);
if (cElementType.cellsRange === arg0.type || cElementType.cell === arg0.type) {
- var arg0Matrix = arg0.getMatrix(), arg2Matrix = arg2.getMatrix(), valMatrix2;
- for (var i = 0; i < arg0Matrix.length; i++) {
- for (var j = 0; j < arg0Matrix[i].length; j++) {
+ let arg0Matrix = arg0.getMatrix(), arg2Matrix = arg[2] ? arg2.getMatrix() : arg0Matrix, valMatrix2;
+ for (let i = 0; i < arg0Matrix.length; i++) {
+ for (let j = 0; j < arg0Matrix[i].length; j++) {
if (arg2Matrix[i] && (valMatrix2 = arg2Matrix[i][j]) && cElementType.number === valMatrix2.type &&
AscCommonExcel.matching(arg0Matrix[i][j], matchingInfo)) {
_sum += valMatrix2.getValue();
@@ -5098,6 +5131,7 @@ function (window, undefined) {
cSUMIFS.prototype.name = 'SUMIFS';
cSUMIFS.prototype.argumentsMin = 3;
cSUMIFS.prototype.arrayIndexes = {0: 1, 1: 1, 3: 1, 5: 1, 7: 1};
+ cSUMIFS.prototype.exactTypes = {0: 1, 1: 1}; // in this function every odd argument is should be checked for type reference
cSUMIFS.prototype.argumentsType = [argType.reference, [argType.reference, argType.any]];
cSUMIFS.prototype.Calculate = function (arg) {
let arg0 = arg[0];
@@ -5256,6 +5290,24 @@ function (window, undefined) {
cSUMIFS.prototype.checkArguments = function (countArguments) {
return 1 === countArguments % 2 && cBaseFunction.prototype.checkArguments.apply(this, arguments);
};
+ cSUMIFS.prototype.checkArgumentsTypes = function (args) {
+ // check first element, then all odd ones
+ if (!cBaseFunction.prototype.checkArgumentsTypes.call(this, [args[0]])) {
+ return false
+ }
+
+ for (let i = 1; i < args.length; i += 2) {
+ // check reference type for each odd element
+ let oddArgument = args[i];
+ if (oddArgument && this.exactTypes[1]) {
+ if (oddArgument.type !== cElementType.cellsRange && oddArgument.type !== cElementType.cellsRange3D
+ && oddArgument.type !== cElementType.cell && oddArgument.type !== cElementType.cell3D) {
+ return false
+ }
+ }
+ }
+ return true;
+ };
/**
* @constructor
diff --git a/cell/model/FormulaObjects/parserFormula.js b/cell/model/FormulaObjects/parserFormula.js
index 25bea8dd47..38b46ad007 100644
--- a/cell/model/FormulaObjects/parserFormula.js
+++ b/cell/model/FormulaObjects/parserFormula.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -48,8 +48,9 @@ function (window, undefined) {
var parserHelp = AscCommon.parserHelp;
var g_oFormatParser = AscCommon.g_oFormatParser;
var CellAddress = AscCommon.CellAddress;
- var cDate = Asc.cDate;
+ var cDate = Asc.cDate;
var bIsSupportArrayFormula = true;
+ var bIsSupportDynamicArrays = false;
var c_oAscError = Asc.c_oAscError;
@@ -71,9 +72,10 @@ function (window, undefined) {
var TOK_SUBTYPE_UNION = 15;
- var arrayFunctionsMap = {"SUMPRODUCT": 1, "FILTER": 1, "SUM": 1, "LOOKUP": 1};
+ var arrayFunctionsMap = {"SUMPRODUCT": 1, "FILTER": 1, "SUM": 1, "LOOKUP": 1, "AGGREGATE": 1};
var importRangeLinksState = {importRangeLinks: null, startBuildImportRangeLinks: null};
+ const aExcludeRecursiveFomulas = ['ISFORMULA', 'SHEETS', 'AREAS', 'COLUMN', 'COLUMNS', 'ROW', 'ROWS'];
function getArrayCopy(arr) {
var newArray = [];
@@ -471,6 +473,7 @@ function (window, undefined) {
return typedArr;
}
+
/** @enum */
var cElementType = {
number : 0,
@@ -504,7 +507,8 @@ var cErrorType = {
not_numeric : 6,
not_available : 7,
getting_data : 8,
- array_not_calc : 9
+ array_not_calc : 9,
+ cannot_be_spilled : 10
};
//добавляю константу cReturnFormulaType для корректной обработки формул массива
// value - функция умеет возвращать только значение(не массив)
@@ -517,6 +521,7 @@ var cErrorType = {
// area_to_ref - заменяем area на массив ссылок на ячейку(REF)
// replace_only_array - в случае с Area - оставляем его в аргументах и рассчитываем только 1 значение(аналогично array)
// replace_only_array - в слуае с массивом - обрабатываем стандартно по элементам
+// dynamic_array - в отличие от обычного массива такой тип будут использовать формулы которые могут не иметь в аргументах диапазонов/массивов, но при этом будут их возвращать(прим. SEQUENCE)
/** @enum */
var cReturnFormulaType = {
@@ -525,7 +530,25 @@ var cReturnFormulaType = {
array: 2,
area_to_ref: 3,
replace_only_array: 4,
- setArrayRefAsArg: 5//для row/column если нет аргументов
+ setArrayRefAsArg: 5, //для row/column если нет аргументов
+ dynamic_array: 6
+};
+
+/*
+ arrayIndexesType - an supporting structure that shows what type of data (associated only with arrays) we expect to see in the argument
+ There are functions whose arguments only work with a certain type
+ For example, the argument can process an array, but a range with the same data will not be processed (as in the WORKDAY_INTL function for the first two arguments)
+ Each type is used to obtain that type in its pure form in a function, for example:
+ If the data type is array, we process only ranges, and pass the arrays unchanged into the formula
+ If the data type is range, we process only arrays, and pass ranges unchanged to the formula
+ If the data type is any - any data type is passed unchanged to the formula (analogous to the previous use of arrayIndex in the format {0: 1, 1: 1})
+*/
+
+/** @enum */
+const arrayIndexesType = {
+ array: 0,
+ any: 1,
+ range: 2,
};
var cExcelSignificantDigits = 15; //количество цифр в числе после запятой
@@ -541,6 +564,12 @@ var cNumFormatFirstCell = -1;
var cNumFormatNone = -2;
var cNumFormatNull = -3;
var g_nFormulaStringMaxLength = 255;
+var c_nMaxDate1900 = 2958465;
+var c_nMaxDate1904 = c_nMaxDate1900 - (c_Date1900Const - c_Date1904Const) + 1;
+
+function getMaxDate () {
+ return AscCommon.bDate1904 ? c_nMaxDate1904 : c_nMaxDate1900; // Maximum date used in calculations in ms (equivalent 31/12/9999)
+}
// set type weight of base types
@@ -636,7 +665,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return res;
};
- cBaseType.prototype.toArray = function (putValue, checkOnError, fPrepareElem) {
+ cBaseType.prototype.toArray = function (putValue, checkOnError, fPrepareElem, bSaveBoolean) {
let arr = [];
if (this.getMatrix) {
arr = this.getMatrix();
@@ -660,7 +689,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
}
if (putValue) {
- arr[i][j] = arr[i][j].getValue();
+ if (bSaveBoolean && arr[i][j].type === cElementType.bool) {
+ arr[i][j] = arr[i][j].toBool();
+ } else {
+ arr[i][j] = arr[i][j].getValue();
+ }
}
}
}
@@ -917,6 +950,13 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this.errorType = cErrorType.array_not_calc;
break;
}
+ case cErrorLocal["spill"]:
+ case cErrorOrigin["spill"]:
+ case cErrorType.cannot_be_spilled: {
+ this.value = "#SPILL!";
+ this.errorType = cErrorType.cannot_be_spilled;
+ break;
+ }
}
return this;
@@ -978,6 +1018,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
case cErrorType.array_not_calc: {
return cErrorLocal["calc"];
}
+ case cErrorOrigin["spill"]:
+ case cErrorType.cannot_be_spilled: {
+ return cErrorLocal["spill"];
+ }
}
return cErrorLocal["na"];
};
@@ -1024,6 +1068,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
res = cErrorType.array_not_calc;
break;
}
+ case cErrorOrigin["spill"]: {
+ res = cErrorType.cannot_be_spilled;
+ break;
+ }
default: {
res = cErrorType.not_available;
break;
@@ -1074,6 +1122,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
res = cErrorOrigin["calc"];
break;
}
+ case cErrorType.cannot_be_spilled: {
+ res = cErrorOrigin["spill"];
+ break;
+ }
default:
res = cErrorType.not_available;
break;
@@ -1260,8 +1312,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
cArea.prototype.foreach2 = function (action) {
var r = this.getRange();
if (r) {
- r._foreach2(function (cell) {
- action(checkTypeCell(cell), cell);
+ r._foreach2(function (cell, row, col) {
+ action(checkTypeCell(cell), cell, row, col);
});
}
};
@@ -1763,8 +1815,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
var _r = this.range(_wsA);
for (var i = 0; i < _r.length; i++) {
if (_r[i]) {
- _r[i]._foreach2(function (cell) {
- action(checkTypeCell(cell));
+ _r[i]._foreach2(function (cell, row, col) {
+ action(checkTypeCell(cell), cell, row, col);
});
}
}
@@ -1983,13 +2035,19 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return !!this.getRange();
};
cRef3D.prototype.getValue = function () {
- var _r = this.getRange();
+ const t = this;
+ let _r = this.getRange();
if (!_r) {
return new cError(cErrorType.bad_reference);
}
var res;
_r.getLeftTopCellNoEmpty(function (cell) {
- res = checkTypeCell(cell);
+ if (!cell && t.externalLink) {
+ // if we refer to a non-existent cell in external data, return a #REF error
+ res = new cError(cErrorType.bad_reference);
+ } else {
+ res = checkTypeCell(cell);
+ }
});
return res;
};
@@ -2273,8 +2331,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return this._toString(true);
};
cStrucTable.prototype._toString = function (isLocal) {
- var tblStr, columns_1, columns_2;
- var table = this.wb.getDefinesNames(this.tableName, null);
+ // file works with "#This Row" - user with "@"
+ // isLocal - change "#This Row", to "@"
+ const table = this.wb.getDefinesNames(this.tableName, null);
+ let tblStr, columns_1, columns_2;
if (!table) {
tblStr = this.tableName;
} else {
@@ -2282,42 +2342,80 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
if (this.oneColumnIndex) {
+ // TODO add this.isCrossSign to use?
columns_1 = this.oneColumnIndex.name.replace(/([#[\]])/g, "'$1");
+
+ if (this.isDynamic && isLocal) {
+ columns_1 = "@" + columns_1;
+ } else if (this.isDynamic) {
+ columns_1 = "[" + this._buildLocalTableString(AscCommon.FormulaTablePartInfo.thisRow, isLocal) + "]" +
+ FormulaSeparators.functionArgumentSeparatorDef + "[" + columns_1 + "]";
+ }
+
tblStr += "[" + columns_1 + "]";
} else if (this.colStartIndex && this.colEndIndex) {
columns_1 = this.colStartIndex.name.replace(/([#[\]])/g, "'$1");
columns_2 = this.colEndIndex.name.replace(/([#[\]])/g, "'$1");
tblStr += "[[" + columns_1 + "]:[" + columns_2 + "]]";
} else if (null != this.reservedColumnIndex) {
- tblStr += "[" + this._buildLocalTableString(this.reservedColumnIndex, isLocal) + "]";
+ if (this.isDynamic && isLocal && this.reservedColumnIndex === AscCommon.FormulaTablePartInfo.thisRow) {
+ tblStr += "[" + "@" + "]";
+ } else if (this.isDynamic) {
+ tblStr += "[" + this._buildLocalTableString(this.reservedColumnIndex, isLocal) + "]";
+ }
} else if (this.hdtIndexes || this.hdtcstartIndex || this.hdtcendIndex) {
tblStr += '[';
- var i;
- for (i = 0; i < this.hdtIndexes.length; ++i) {
- if (0 != i) {
- if (isLocal) {
- tblStr += FormulaSeparators.functionArgumentSeparator;
- } else {
- tblStr += FormulaSeparators.functionArgumentSeparatorDef;
- }
+ let i;
+
+ if (this.hdtIndexes.length > 0 && this.isDynamic && isLocal && this.hdtIndexes[0] === AscCommon.FormulaTablePartInfo.thisRow) {
+ let hdtcstart = this.hdtcstartIndex ? this.hdtcstartIndex.name.replace(/([#[\]])/g, "'$1") : null;
+ let hdtcend = this.hdtcendIndex ? this.hdtcendIndex.name.replace(/([#[\]])/g, "'$1") : null;
+
+ tblStr += "@";
+ if (hdtcstart && !hdtcend) {
+ // if one column is selected
+ tblStr += hdtcstart;
+ } else if (hdtcstart && hdtcend) {
+ // if multiple columns are selected
+ tblStr += '[' + hdtcstart + ']';
+ tblStr += ':[' + hdtcend + ']';
}
- tblStr += "[" + this._buildLocalTableString(this.hdtIndexes[i], isLocal) + "]";
- }
- if (this.hdtcstartIndex) {
- if (this.hdtIndexes.length > 0) {
- if (isLocal) {
- tblStr += FormulaSeparators.functionArgumentSeparator;
+
+ } else {
+ for (i = 0; i < this.hdtIndexes.length; ++i) {
+ if (0 != i) {
+ if (isLocal) {
+ tblStr += FormulaSeparators.functionArgumentSeparator;
+ } else {
+ tblStr += FormulaSeparators.functionArgumentSeparatorDef;
+ }
+ }
+
+ if (this.hdtcstartIndex === null && this.hdtIndexes.length === 1) {
+ // If the formula contains a single hdt index, remove the inner brackets =Table[[#Headers|#All|#Data|#Totals]]
+ tblStr += this._buildLocalTableString(this.hdtIndexes[i], isLocal);
} else {
- tblStr += FormulaSeparators.functionArgumentSeparatorDef;
+ tblStr += "[" + this._buildLocalTableString(this.hdtIndexes[i], isLocal) + "]";
}
}
- var hdtcstart = this.hdtcstartIndex.name.replace(/([#[\]])/g, "'$1");
- tblStr += "[" + hdtcstart + "]";
- if (this.hdtcendIndex) {
- var hdtcend = this.hdtcendIndex.name.replace(/([#[\]])/g, "'$1");
- tblStr += ":[" + hdtcend + "]";
+
+ if (this.hdtcstartIndex) {
+ if (this.hdtIndexes.length > 0) {
+ if (isLocal) {
+ tblStr += FormulaSeparators.functionArgumentSeparator;
+ } else {
+ tblStr += FormulaSeparators.functionArgumentSeparatorDef;
+ }
+ }
+ let hdtcstart = this.hdtcstartIndex.name.replace(/([#[\]])/g, "'$1");
+ tblStr += "[" + hdtcstart + "]";
+ if (this.hdtcendIndex) {
+ let hdtcend = this.hdtcendIndex.name.replace(/([#[\]])/g, "'$1");
+ tblStr += ":[" + hdtcend + "]";
+ }
}
}
+
tblStr += ']';
} else if (!isLocal) {
tblStr += '[]';
@@ -2325,11 +2423,15 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return tblStr;
};
cStrucTable.prototype._parseVal = function (val) {
- var bRes = true, startCol, endCol;
+ let bRes = true, startCol, endCol;
this.tableName = val['tableName'];
if (val['oneColumn']) {
startCol = val['oneColumn'].replace(/'([#[\]])/g, '$1');
- this.oneColumnIndex = this.wb.getTableIndexColumnByName(this.tableName, startCol);
+ if (startCol[0] === "@") {
+ this.isDynamic = true;
+ }
+
+ this.oneColumnIndex = this.wb.getTableIndexColumnByName(this.tableName, this.isDynamic ? startCol.slice(1) : startCol);
bRes = !!this.oneColumnIndex;
} else if (val['columnRange']) {
startCol = val['colStart'].replace(/'([#[\]])/g, '$1');
@@ -2349,11 +2451,17 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
} else if (val['hdtcc']) {
this.hdtIndexes = [];
- var hdtcstart = val['hdtcstart'];
- var hdtcend = val['hdtcend'];
- var re = /\[(.*?)\]/ig, m;
+ let hdtcstart = val['hdtcstart'];
+ let hdtcend = val['hdtcend'];
+ let re = /\[(.*?)\]|\@/ig, m;
+
+ let isCross;
+ if (val['hdt'] === "@") {
+ isCross = true;
+ }
+
while (null !== (m = re.exec(val['hdt']))) {
- var param = parserHelp.getColumnTypeByName(m[1]);
+ let param = parserHelp.getColumnTypeByName(isCross ? m[0] : m[1]);
if (AscCommon.FormulaTablePartInfo.thisRow == param ||
AscCommon.FormulaTablePartInfo.headers == param || AscCommon.FormulaTablePartInfo.totals == param) {
this.isDynamic = true;
@@ -2379,8 +2487,32 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
var isThisRow = false;
var tableData, refName;
if (this.oneColumnIndex) {
- paramObj.param = AscCommon.FormulaTablePartInfo.columns;
- paramObj.startCol = this.oneColumnIndex.name;
+ if (this.isDynamic) {
+ /* this row */
+ isThisRow = true;
+ paramObj.param = AscCommon.FormulaTablePartInfo.thisRow;
+ let thisRow = this.wb.getTableRangeForFormula(this.tableName, paramObj);
+
+ let thisCol;
+ if (thisRow) {
+ paramObj.param = AscCommon.FormulaTablePartInfo.columns;
+ paramObj.startCol = this.oneColumnIndex.name;
+ paramObj.endCol = null;
+ thisCol = this.wb.getTableRangeForFormula(this.tableName, paramObj);
+ }
+
+ if (!thisRow || !thisCol) {
+ return this._createAreaError(isThisRow);
+ }
+
+ range = new Asc.Range(thisCol.range.c1, thisRow.range.r1, thisCol.range.c2, thisRow.range.r2);
+
+ tableData = thisCol;
+ tableData.range = range;
+ } else {
+ paramObj.param = AscCommon.FormulaTablePartInfo.columns;
+ paramObj.startCol = this.oneColumnIndex.name;
+ }
} else if (this.colStartIndex && this.colEndIndex) {
paramObj.param = AscCommon.FormulaTablePartInfo.columns;
paramObj.startCol = this.colStartIndex.name;
@@ -2640,13 +2772,17 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
}
};
+ cStrucTable.prototype.getRange = function () {
+ return this.area && this.area.getRange && this.area.getRange();
+ };
/**
* @constructor
* @extends {cName}
*/
- function cName3D(val, ws) {
+ function cName3D(val, ws, externalLink) {
cName.call(this, val, ws);
+ this.externalLink = externalLink;
}
cName3D.prototype = Object.create(cName.prototype);
@@ -2659,15 +2795,21 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
} else {
ws = this.ws;
}
- var oRes = new cName3D(this.value, ws);
+ var oRes = new cName3D(this.value, ws, this.externalLink);
this.cloneTo(oRes);
return oRes;
};
+
cName3D.prototype.toString = function () {
- return parserHelp.getEscapeSheetName(this.ws.getName()) + "!" + cName.prototype.toString.call(this);
+ var exPath = this.getExternalLinkStr(this.externalLink);
+ return parserHelp.getEscapeSheetName(exPath + this.ws.getName()) + "!" + cName.prototype.toString.call(this);
};
cName3D.prototype.toLocaleString = function () {
- return parserHelp.getEscapeSheetName(this.ws.getName()) + "!" + cName.prototype.toLocaleString.call(this);
+ var exPath = this.getExternalLinkStr(this.externalLink, true);
+ return parserHelp.getEscapeSheetName(exPath + this.ws.getName()) + "!" + cName.prototype.toLocaleString.call(this);
+ };
+ cName3D.prototype.getWsId = function () {
+ return this.ws && this.ws.Id;
};
/**
@@ -2680,6 +2822,9 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this.rowCount = 0;
this.countElementInRow = [];
this.countElement = 0;
+
+ this.realSize = null;
+ this.missedValue = null;
}
cArray.prototype = Object.create(cBaseType.prototype);
@@ -2725,8 +2870,14 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
return col;
};
- cArray.prototype.getElementRowCol = function (row, col) {
+ cArray.prototype.getElementRowCol = function (row, col, checkRealSize) {
if (row > this.rowCount || col > this.getCountElementInRow()) {
+ if (checkRealSize && this.realSize && row <= this.realSize.row && col <= this.realSize.col) {
+ if (this.missedValue) {
+ return this.missedValue
+ }
+ return new cEmpty();
+ }
return new cError(cErrorType.not_available);
}
return this.array[row] && this.array[row][col] ? this.array[row][col] : new cEmpty();
@@ -2778,19 +2929,40 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
cArray.prototype.getCountElement = function () {
return this.countElement;
};
- cArray.prototype.getCountElementInRow = function () {
- return this.countElementInRow[0];
+ cArray.prototype.getCountElementInRow = function (getRealSize) {
+ return getRealSize && this.realSize ? this.realSize.col : this.countElementInRow[0];
};
- cArray.prototype.getRowCount = function () {
- return this.rowCount;
+ cArray.prototype.getRowCount = function (getRealSize) {
+ return getRealSize && this.realSize ? this.realSize.row : this.rowCount;
};
cArray.prototype.geMaxElementInRow = function () {
return Math.max.apply(null, this.countElementInRow);
};
+ cArray.prototype.getRealArraySize = function () {
+ if (!this.realSize) {
+ return;
+ }
+
+ return this.realSize;
+ };
+ cArray.prototype.getMissedValue = function () {
+ if (!this.missedValue) {
+ return;
+ }
+
+ return this.missedValue;
+ };
+ cArray.prototype.setRealArraySize = function (row, col) {
+ if (row > 0 && col > 0) {
+ this.realSize = {row: row, col: col}
+ }
+ };
cArray.prototype.tocNumber = function () {
- var retArr = new cArray();
- for (var ir = 0; ir < this.rowCount; ir++, retArr.addRow()) {
- for (var ic = 0; ic < this.countElementInRow[ir]; ic++) {
+ let retArr = new cArray();
+ retArr.realSize = this.getRealArraySize();
+ retArr.missedValue = this.getMissedValue();
+ for (let ir = 0; ir < this.rowCount; ir++, retArr.addRow()) {
+ for (let ic = 0; ic < this.countElementInRow[ir]; ic++) {
retArr.addElement(this.array[ir][ic].tocNumber());
}
if (ir === this.rowCount - 1) {
@@ -2902,13 +3074,26 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return this.array;
};
- cArray.prototype.fillFromArray = function (arr) {
- this.array = arr;
- this.rowCount = arr.length;
- for (var i = 0; i < arr.length; i++) {
- this.countElementInRow[i] = arr[i].length;
- this.countElement += arr[i].length;
+ cArray.prototype.fillFromArray = function (arr, fChangeElems) {
+ if (arr && arr.length !== undefined) {
+ this.array = arr;
+ this.rowCount = arr.length;
+ for (var i = 0; i < arr.length; i++) {
+ this.countElementInRow[i] = arr[i].length;
+ this.countElement += arr[i].length;
+ if (fChangeElems){
+ for (let j = 0; j < arr[i].length; j++) {
+ let changeRes = fChangeElems(arr[i][j]);
+ if (changeRes !== null) {
+ arr[i][j] = changeRes;
+ } else {
+ return null;
+ }
+ }
+ }
+ }
}
+ return true;
};
cArray.prototype.fillEmptyFromRange = function (range) {
if(!range) {
@@ -2922,8 +3107,9 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
}
};
- cArray.prototype.getDimensions = function () {
- return {col: this.getCountElementInRow(), row: this.getRowCount()};
+ cArray.prototype.getDimensions = function (getRealSize) {
+ let realSize = getRealSize ? this.getRealArraySize() : false;
+ return {col: realSize ? realSize.col : this.getCountElementInRow(), row: realSize ? realSize.row : this.getRowCount()};
};
cArray.prototype.fillMatrix = function (replace_empty) {
let maxColCount = Math.max.apply(null, this.countElementInRow);
@@ -2940,7 +3126,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this.countElement += this.array[i].length;
}
};
- cArray.prototype.recalculate = function () {
+ cArray.prototype.recalculateOld = function () {
this.rowCount = this.array.length;
this.countElementInRow = [];
this.countElement = 0;
@@ -2949,6 +3135,23 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this.countElement += this.array[i].length;
}
};
+ cArray.prototype.recalculate = function (row) {
+ this.rowCount = this.array.length;
+ if (row === undefined) {
+ // full recalculation of the number of elements in the entire array, long execution
+ this.countElementInRow = [];
+ this.countElement = 0;
+ for (let i = 0; i < this.array.length; i++) {
+ this.countElementInRow[i] = this.array[i].length;
+ this.countElement += this.array[i].length;
+ }
+ } else {
+ // changing only the affected values (by row)
+ let lookingRow = this.array[row];
+ this.countElementInRow[row] = lookingRow.length;
+ this.countElement += lookingRow.length;
+ }
+ };
cArray.prototype.pushCol = function (matrix, colNum) {
for (let i = 0; i < matrix.length; i++) {
if (matrix[i] && matrix[i][colNum]) {
@@ -2960,10 +3163,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
this.recalculate();
};
- cArray.prototype.pushRow = function (matrix, colNum) {
- if (matrix && matrix[colNum]) {
- this.array.push(matrix[colNum]);
- this.recalculate();
+ cArray.prototype.pushRow = function (matrix, rowNum) {
+ if (matrix && matrix[rowNum]) {
+ this.array.push(matrix[rowNum]);
+ this.recalculate(this.array.length - 1);
}
};
cArray.prototype.crop = function (row, col) {
@@ -2992,6 +3195,34 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
cArray.prototype.getFirstElement = function () {
return this.getElementRowCol(0,0);
};
+ //check two-dimensional array
+ cArray.prototype.checkValidArray = function (array, bConvertToValid) {
+ if (!array || !array.length) {
+ return false;
+ }
+ let isOneDimensional = null;
+ for (let i = 0; i < array.length; i++) {
+ if (Array.isArray(array[i])) {
+ if (isOneDimensional) {
+ return false;
+ }
+ for (let j = 0; j < array[i].length; j++) {
+ if (Array.isArray(array[i][j])) {
+ return false;
+ }
+ }
+ isOneDimensional = false;
+ } else if (isOneDimensional === null) {
+ isOneDimensional = true;
+ }
+ }
+ if (isOneDimensional && bConvertToValid) {
+ let temp = [];
+ temp.push(array);
+ array = temp;
+ }
+ return array;
+ };
@@ -3111,8 +3342,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
res = new cArray();
for (var iRow = 0; iRow < rowCount; iRow++, iRow < rowCount ? res.addRow() : true) {
for (var iCol = 0; iCol < colCount; iCol++) {
- var elem1 = matrix1 ? matrix1.getElementRowCol(dimension1.row === 1 ? 0 : iRow, dimension1.col === 1 ? 0 : iCol) : operand1;
- var elem2 = matrix2 ? matrix2.getElementRowCol(dimension2.row === 1 ? 0 : iRow, dimension2.col === 1 ? 0 : iCol) : operand2;
+ var elem1 = matrix1 ? matrix1.getElementRowCol(dimension1.row === 1 ? 0 : iRow, dimension1.col === 1 ? 0 : iCol, true) : operand1;
+ var elem2 = matrix2 ? matrix2.getElementRowCol(dimension2.row === 1 ? 0 : iRow, dimension2.col === 1 ? 0 : iCol, true) : operand2;
res.addElement(func(elem1, elem2));
}
}
@@ -3558,6 +3789,19 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
var res = null;
var t = this;
+ let dynamicRange = null, dynamicArraySize = null;
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ if (!parserFormula.dynamicRange && !parserFormula.ref) {
+ dynamicArraySize = this.getDynamicArraySize(arg);
+ if (dynamicArraySize && parserFormula.parent && parserFormula.parent.nCol != null && parserFormula.parent.nRow != null) {
+ dynamicRange = Asc.Range(parserFormula.parent.nCol, parserFormula.parent.nRow, dynamicArraySize.width + parserFormula.parent.nCol - 1, dynamicArraySize.height + parserFormula.parent.nRow - 1);
+ // parserFormula.ref = dynamicRange;
+ parserFormula.dynamicRange = dynamicRange;
+ this.bArrayFormula = true;
+ }
+ }
+ }
+
var functionsCanReturnArray = ["index"];
var returnFormulaType = this.returnValueType;
@@ -3575,15 +3819,16 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
//добавлен специальный тип для функции сT, она использует из области всегда первый аргумент
var replaceOnlyArray = cReturnFormulaType.replace_only_array === returnFormulaType;
- var checkArrayIndex = function(index) {
- var res = false;
+ // Проверка должен ли элемент поступать в формулу без изменени?
+ const checkArrayIndex = function(index) {
+ let res = false;
if(arrayIndexes) {
- if(1 === arrayIndexes[index]) {
+ if(arrayIndexes[index] === arrayIndexesType.any) {
res = true;
} else if(typeof arrayIndexes[index] === "object") {
//для данной проверки запрашиваем у объекта 0 индекс, там хранится значение индекса аргумента
//от которого зависит стоит ли вопринимать данный аргумент как массив или нет
- var tempsArgIndex = arrayIndexes[index][0];
+ let tempsArgIndex = arrayIndexes[index][0];
if(undefined !== tempsArgIndex && arg[tempsArgIndex]) {
if(cElementType.cellsRange === arg[tempsArgIndex].type || cElementType.cellsRange3D === arg[tempsArgIndex].type || cElementType.array === arg[tempsArgIndex].type) {
res = true;
@@ -3594,9 +3839,18 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return res;
};
- var checkOneRowCol = function() {
- var res = false;
- for (var j = 0; j < argumentsCount; j++) {
+ const checkArayIndexType = function(index, argType) {
+ // check for type of argument - whether array and range can be processed or just one of them
+ let res = false;
+ if(arrayIndexes && argType === arrayIndexes[index]) {
+ res = true;
+ }
+ return res;
+ };
+
+ const checkOneRowCol = function() {
+ let res = false;
+ for (let j = 0; j < argumentsCount; j++) {
if(cElementType.array === arg[j].type) {
if(1 === arg[j].getRowCount() || 1 === arg[j].getCountElementInRow()) {
res = true;
@@ -3629,7 +3883,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
_checkArrayIndex = checkArrayIndex(j);
if (!_checkArrayIndex) {
if (cElementType.cellsRange === tempArg.type || cElementType.cellsRange3D === tempArg.type) {
- if (replaceAreaByValue) {
+ if (checkArayIndexType(j, arrayIndexesType.range)) {
+ // transfer range to argument without changing
+ tempArg = tempArg;
+ } else if (replaceAreaByValue) {
tempArg = tempArg.cross(opt_bbox);
} else if (replaceAreaByRefs) {
//добавляю специальные заглушки для функций row/column
@@ -3650,18 +3907,21 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
tempArg = window['AscCommonExcel'].convertAreaToArray(tempArg);
}
}
- }
- if (cElementType.array === tempArg.type && !_checkArrayIndex) {
- //пытаемся найти массив, которые имеет более 1 столбца и более 1 строки
- if (!firstArray) {
- firstArray = tempArg;
- } else if((1 === firstArray.getRowCount() || 1 === firstArray.getCountElementInRow()) && 1 !== tempArg.getRowCount() && 1 !== tempArg.getCountElementInRow()) {
- firstArray = tempArg;
- } else if((1 === firstArray.getRowCount() && 1 === firstArray.getCountElementInRow()) && (1 !== tempArg.getRowCount() || 1 !== tempArg.getCountElementInRow())){
- firstArray = tempArg;
+ if (cElementType.array === tempArg.type) {
+ if (checkArayIndexType(j, arrayIndexesType.array)) {
+ // transfer array to argument without changing
+ tempArg = tempArg;
+ } else if (!firstArray) { //пытаемся найти массив, которые имеет более 1 столбца и более 1 строки
+ firstArray = tempArg;
+ } else if((1 === firstArray.getRowCount() || 1 === firstArray.getCountElementInRow()) && 1 !== tempArg.getRowCount() && 1 !== tempArg.getCountElementInRow()) {
+ firstArray = tempArg;
+ } else if((1 === firstArray.getRowCount() && 1 === firstArray.getCountElementInRow()) && (1 !== tempArg.getRowCount() || 1 !== tempArg.getCountElementInRow())){
+ firstArray = tempArg;
+ }
}
}
+
tempArgs.push(tempArg);
}
@@ -3713,7 +3973,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
if (0 === argumentsCount && parserFormula.ref) {
temp_opt_bbox = new Asc.Range(c + parserFormula.ref.c1, r + parserFormula.ref.r1, c + parserFormula.ref.c1, r + parserFormula.ref.r1);
}
- array.addElement(t.Calculate(newArgs, temp_opt_bbox, opt_defName, parserFormula.ws, null, _row, _col));
+ array.addElement(t.Calculate(newArgs, temp_opt_bbox, opt_defName, parserFormula.ws, null, _row ? _row : r, _col ? _col : c));
};
if (firstArray.foreach) {
@@ -3740,9 +4000,122 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
}
+ if (AscCommonExcel.bIsSupportDynamicArrays && (dynamicRange || dynamicArraySize)) {
+ // parserFormula.ref = null;
+ this.bArrayFormula = null;
+ }
+
return res;
};
+ cBaseFunction.prototype.checkFormulaArray2 = function (arg, opt_bbox, opt_defName, parserFormula, bIsSpecialFunction, argumentsCount) {
+ // if (AscCommonExcel.bIsSupportDynamicArrays) {
+ const t = this;
+ let res = null;
+ let functionsCanReturnArray = ["index"];
+
+ let returnFormulaType = this.returnValueType;
+ if (cReturnFormulaType.setArrayRefAsArg === returnFormulaType) {
+ // todo check if this situation occurs
+ if (arg.length === 0 && parserFormula.ref) {
+ res = this.Calculate([new cArea(parserFormula.ref.getName(), parserFormula.ws)], opt_bbox, opt_defName, parserFormula.ws);
+ } else {
+ return null;
+ }
+ }
+
+ let arrayIndexes = this.arrayIndexes;
+ let replaceAreaByValue = cReturnFormulaType.value_replace_area === returnFormulaType;
+ let replaceAreaByRefs = cReturnFormulaType.area_to_ref === returnFormulaType;
+ let replaceOnlyArray = cReturnFormulaType.replace_only_array === returnFormulaType;
+
+ const checkArrayIndex = function(index) {
+ let res = false;
+ if(arrayIndexes) {
+ if(1 === arrayIndexes[index]) {
+ res = true;
+ } else if(typeof arrayIndexes[index] === "object") {
+ // for this situation check object 0 for an index, the value of the argument index is stored there
+ // which determines whether a given argument should be treated as an array or not
+ let tempsArgIndex = arrayIndexes[index][0];
+ if(undefined !== tempsArgIndex && arg[tempsArgIndex]) {
+ if(cElementType.cellsRange === arg[tempsArgIndex].type || cElementType.cellsRange3D === arg[tempsArgIndex].type || cElementType.array === arg[tempsArgIndex].type) {
+ res = true;
+ }
+ }
+ }
+ }
+ return res;
+ };
+ if((!returnFormulaType || replaceAreaByValue || replaceAreaByRefs || arrayIndexes || replaceOnlyArray)) {
+ if (functionsCanReturnArray.indexOf(this.name.toLowerCase()) !== -1) {
+ let _tmp = this.Calculate(arg, opt_bbox, opt_defName, this.ws, bIsSpecialFunction);
+ if (_tmp && _tmp.type === cElementType.array) {
+ return _tmp;
+ }
+ }
+
+ let tempArgs = [], tempArg, firstArray, _checkArrayIndex;
+ for (let j = 0; j < argumentsCount; j++) {
+ tempArg = arg[j];
+
+ _checkArrayIndex = checkArrayIndex(j);
+ if (!_checkArrayIndex) {
+ if (/*cElementType.cellsRange === tempArg.type || cElementType.cellsRange3D === tempArg.type ||*/ cElementType.array === tempArg.type) {
+ res = true
+ }
+ }
+ if (res) {
+ return res;
+ }
+
+ tempArgs.push(tempArg);
+ }
+ }
+
+ return res;
+ // }
+ };
+
+ cBaseFunction.prototype.getDynamicArraySize = function (arg) {
+
+ if (!AscCommonExcel.bIsSupportDynamicArrays || this.returnValueType === AscCommonExcel.cReturnFormulaType.array) {
+ return null;
+ }
+
+ let width = 1, height = 1;
+ for (let i = 0; i < arg.length; i++) {
+ if (!this.arrayIndexes || !this.arrayIndexes[i]) {
+ let objSize = arg[i].getDimensions();
+ if (objSize) {
+ height = Math.max(objSize.row, height);
+ width = Math.max(objSize.col, width);
+ }
+ }
+ }
+
+ if (width !== 1 || height !== 1) {
+ return {width: width, height: height};
+ }
+ return null;
+ };
+ cBaseFunction.prototype.checkArgumentsTypes = function (args) {
+ if (args) {
+ let length = args.length;
+ for (let i = 0; i < length; i++) {
+ let arg = args[i];
+ if (arg && this.exactTypes[i] && this.argumentsType && this.argumentsType[i] !== undefined) {
+ // check types
+ if (this.argumentsType[i] === Asc.c_oAscFormulaArgumentType.reference && (arg.type !== cElementType.cellsRange && arg.type !== cElementType.cellsRange3D
+ && arg.type !== cElementType.cell && arg.type !== cElementType.cell3D)) {
+ return false;
+ }
+ // todo add other data types for arguments to the check, if the function requires it
+ }
+ }
+ }
+ return true;
+ };
/** @constructor */
function cUnknownFunction(name) {
@@ -5306,27 +5679,52 @@ _func[cElementType.array][cElementType.array] = function ( arg0, arg1, what, bbo
_func[cElementType.array][cElementType.number] = _func[cElementType.array][cElementType.string] =
_func[cElementType.array][cElementType.bool] = _func[cElementType.array][cElementType.error] =
_func[cElementType.array][cElementType.empty] = function ( arg0, arg1, what ) {
- var res = new cArray();
- arg0.foreach( function ( elem, r ) {
+ let res = new cArray(), realArraySize, rowDiff, colDiff, funcResult, arrayDimensions = arg0.getDimensions();
+
+ if (arg0.realSize && arg0.missedValue) {
+ realArraySize = arg0.getRealArraySize();
+ rowDiff = realArraySize.row - arg0.getRowCount();
+ colDiff = realArraySize.col - arg0.getCountElementInRow();
+ funcResult = _func[arg0.missedValue.type][arg1.type](arg0.missedValue, arg1, what);
+
+ // set realSize to res
+ res.setRealArraySize(realArraySize.row, realArraySize.col);
+ res.missedValue = funcResult;
+ }
+
+ arg0.foreach( function ( elem, r ) {
if ( !res.array[r] ) {
res.addRow();
}
res.addElement( _func[elem.type][arg1.type]( elem, arg1, what ) );
} );
+
return res;
};
-
_func[cElementType.number][cElementType.array] = _func[cElementType.string][cElementType.array] =
_func[cElementType.bool][cElementType.array] = _func[cElementType.error][cElementType.array] =
_func[cElementType.empty][cElementType.array] = function ( arg0, arg1, what ) {
- var res = new cArray();
- arg1.foreach( function ( elem, r ) {
+ let res = new cArray(), realArraySize, rowDiff, colDiff, funcResult, arrayDimensions = arg1.getDimensions();
+
+ if (arg1.realSize && arg1.missedValue) {
+ realArraySize = arg1.getRealArraySize();
+ rowDiff = realArraySize.row - arg1.getRowCount();
+ colDiff = realArraySize.col - arg1.getCountElementInRow();
+ funcResult = _func[arg0.type][arg1.missedValue.type](arg0, arg1.missedValue, what);
+
+ // set realSize to res
+ res.setRealArraySize(realArraySize.row, realArraySize.col);
+ res.missedValue = funcResult;
+ }
+
+ arg1.foreach( function ( elem, r ) {
if ( !res.array[r] ) {
res.addRow();
}
res.addElement( _func[arg0.type][elem.type]( arg0, elem, what ) );
} );
+
return res;
};
@@ -5833,6 +6231,13 @@ _func[cElementType.cell3D] = _func[cElementType.cell];
return res;
};
+ function CalculateResult(checkOnError) {
+ this.checkOnError = checkOnError;
+ this.error = null;
+ }
+ CalculateResult.prototype.setError = function(error) {
+ this.error = error;
+ };
var g_defParseResult = new ParseResult(undefined, undefined);
@@ -5936,6 +6341,19 @@ function parserFormula( formula, parent, _ws ) {
}
};
parserFormula.prototype._changeExternalLink = function(data) {
+ let existedWs = data.existedWs;
+ for (let i = 0; i < this.outStack.length; i++) {
+ let elem = this.outStack[i];
+ if (elem.type === cElementType.cell3D) {
+ this.outStack[i] = new AscCommonExcel.cRef3D(elem.value, existedWs ? existedWs : elem.ws, data.data.to);
+ } else if (elem.type === cElementType.cellsRange3D) {
+ this.outStack[i] = new AscCommonExcel.cArea3D(elem.value, existedWs ? existedWs : elem.wsFrom, existedWs ? existedWs : elem.wsTo, data.data.to);
+ } else if (elem.type === cElementType.name3D) {
+ this.outStack[i] = new AscCommonExcel.cName3D(elem.value, existedWs ? existedWs : elem.ws, data.data.to);
+ }
+ }
+ };
+ parserFormula.prototype._changeExternalLinkOld = function(data) {
for (var i = 0; i < this.outStack.length; i++) {
if (this.outStack[i].type === cElementType.cell3D || this.outStack[i].type === cElementType.cellsRange3D || this.outStack[i].type === cElementType.name3D) {
if (this.outStack[i].externalLink == data.data.from) {
@@ -6020,6 +6438,7 @@ function parserFormula( formula, parent, _ws ) {
}
oRes.isParsed = this.isParsed;
oRes.ref = this.ref;
+ oRes.ca = this.ca;
return oRes;
};
parserFormula.prototype.getParent = function() {
@@ -6655,10 +7074,10 @@ function parserFormula( formula, parent, _ws ) {
return true;
};
- var parseCommaAndArgumentsUnion = function () {
+ const parseCommaAndArgumentsUnion = function () {
wasLeftParentheses = false;
wasRigthParentheses = false;
- var stackLength = elemArr.length, top_elem = null, top_elem_arg_pos;
+ let stackLength = elemArr.length, top_elem = null, top_elem_arg_pos;
if (elemArr.length !== 0 && elemArr[stackLength - 1].name === "(" &&
((!elemArr[stackLength - 2]) || (elemArr[stackLength - 2] && elemArr[stackLength - 2].type !== cElementType.func))) {
@@ -6826,6 +7245,66 @@ function parserFormula( formula, parent, _ws ) {
parseResult.operand_expected = false;
return true;
};
+ const isRecursiveFormula = function (found_operand, parserFormula) {
+ const nOperandType = found_operand.type;
+ let oRange = null;
+ let bRecursiveCell = parserFormula.ca;
+
+ if (parserFormula.getParent() == null) {
+ return bRecursiveCell;
+ }
+ if (parserFormula.ca) {
+ return bRecursiveCell;
+ }
+ if (levelFuncMap.length && levelFuncMap[currentFuncLevel] && aExcludeRecursiveFomulas.includes(levelFuncMap[currentFuncLevel].func.name)) {
+ return bRecursiveCell;
+ }
+ if (nOperandType === cElementType.cellsRange) {
+ oRange = found_operand.getRange();
+ return oRange.containCell2(parserFormula.getParent());
+ }
+ if (nOperandType === cElementType.cellsRange3D) {
+ const oParentCell = parserFormula.getParent();
+ if (!(oParentCell instanceof AscCommonExcel.CCellWithFormula)) {
+ return false;
+ }
+ const aRanges = found_operand.getRanges().filter(function (oRange) {
+ return oParentCell.ws.getId() === oRange.worksheet.getId();
+ });
+
+ for (let i = 0, length = aRanges.length; i < length; i++) {
+ if (aRanges[i].containCell2(oParentCell)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ if (nOperandType === cElementType.name || nOperandType === cElementType.name3D) {
+ const oElemValue = found_operand.getValue();
+ const oElemType = oElemValue.type;
+ let aRef = [cElementType.cell, cElementType.cell3D, cElementType.cellsRange, cElementType.cellsRange3D];
+ if (!aRef.includes(oElemType)) {
+ return bRecursiveCell;
+ }
+ oRange = oElemValue.getRange();
+ if (oElemType === cElementType.cellsRange || oElemType === cElementType.cellsRange3D) {
+ return oRange.containCell2(parserFormula.getParent());
+ }
+ } else if (nOperandType === cElementType.table) {
+ let oRefElem = found_operand.toRef();
+ oRange = oRefElem.getRange();
+ } else {
+ oRange = found_operand.getRange();
+ }
+
+ oRange._foreachNoEmpty(function (oCell) {
+ if (!bRecursiveCell) {
+ bRecursiveCell = oCell.checkRecursiveFormula(parserFormula.getParent());
+ }
+ });
+
+ return bRecursiveCell;
+ };
var parseOperands = function () {
found_operand = null;
@@ -6889,7 +7368,9 @@ function parserFormula( formula, parent, _ws ) {
}
var wsF, wsT;
- var externalLink = _3DRefTmp[3];
+ let sheetName = _3DRefTmp[1];
+ let externalLink = _3DRefTmp[3];
+ let isExternalRefExist;
//check on add to this document
let thisTitle = externalLink && window["Asc"]["editor"] && window["Asc"]["editor"].DocInfo && window["Asc"]["editor"].DocInfo.get_Title();
if (thisTitle === externalLink) {
@@ -6906,18 +7387,31 @@ function parserFormula( formula, parent, _ws ) {
if (!parseResult.externalReferenesNeedAdd[externalLink]) {
parseResult.externalReferenesNeedAdd[externalLink] = [];
}
- parseResult.externalReferenesNeedAdd[externalLink].push({sheet: _3DRefTmp[1]});
+ parseResult.externalReferenesNeedAdd[externalLink].push({sheet: sheetName /*_3DRefTmp[1]*/});
+ } else {
+ isExternalRefExist = true;
+ let externalName = _3DRefTmp[3];
+ if (!parseResult.externalReferenesNeedAdd) {
+ parseResult.externalReferenesNeedAdd = [];
+ }
+ if (!parseResult.externalReferenesNeedAdd[externalName]) {
+ parseResult.externalReferenesNeedAdd[externalName] = [];
+ }
+ parseResult.externalReferenesNeedAdd[externalName].push({sheet: sheetName /*_3DRefTmp[1]*/});
}
}
- wsF = t.wb.getExternalWorksheet(externalLink, _3DRefTmp[1]);
+ wsF = sheetName ? t.wb.getExternalWorksheet(externalLink, sheetName /*_3DRefTmp[1]*/) : null;
wsT = wsF;
} else {
- wsF = t.wb.getWorksheetByName(_3DRefTmp[1]);
+ wsF = t.wb.getWorksheetByName(sheetName/*_3DRefTmp[1]*/);
wsT = (null !== _3DRefTmp[2]) ? t.wb.getWorksheetByName(_3DRefTmp[2]) : wsF;
}
- if (!(wsF && wsT) && !externalLink) {
+ // if it's impossible to get a sheet from an external file, but the file itself is exist, then we return an error about incorrectly entering the formula
+ let wsNotExist = externalLink && isExternalRefExist && !wsF;
+
+ if ((!(wsF && wsT) && !externalLink) /*|| wsNotExist*/) {
parseResult.setError(c_oAscError.ID.FrmlWrongReferences);
if (!ignoreErrors) {
t.outStack = [];
@@ -6938,6 +7432,9 @@ function parserFormula( formula, parent, _ws ) {
found_operand = new cArea3D(ph.real_str ? ph.real_str.toUpperCase() : ph.operand_str.toUpperCase(), wsF, wsT, externalLink);
}
parseResult.addRefPos(prevCurrPos, ph.pCurrPos, t.outStack.length, found_operand);
+ if (local || (local === false && digitDelim === false)) { // local and digitDelim with value false using only for copypaste mode.
+ t.ca = isRecursiveFormula(found_operand, t);
+ }
} else if (parserHelp.isRef.call(ph, t.Formula, ph.pCurrPos)) {
if (!(wsF && wsT)) {
//for edit formula mode
@@ -6949,10 +7446,16 @@ function parserFormula( formula, parent, _ws ) {
found_operand = new cRef3D(ph.real_str ? ph.real_str.toUpperCase() : ph.operand_str.toUpperCase(), wsF, externalLink);
}
parseResult.addRefPos(prevCurrPos, ph.pCurrPos, t.outStack.length, found_operand);
+ if (local || (local === false && digitDelim === false)) { // local and digitDelim with value false using only for copypaste mode.
+ t.ca = isRecursiveFormula(found_operand, t);
+ }
} else {
parserHelp.isName.call(ph, t.Formula, ph.pCurrPos);
- found_operand = new cName3D(ph.operand_str, wsF);
+ found_operand = new cName3D(ph.operand_str, wsF, externalLink);
parseResult.addRefPos(prevCurrPos, ph.pCurrPos, t.outStack.length, found_operand);
+ if (local || (local === false && digitDelim === false)) { // local and digitDelim with value false using only for copypaste mode.
+ t.ca = isRecursiveFormula(found_operand, t);
+ }
}
}
@@ -6962,6 +7465,9 @@ function parserFormula( formula, parent, _ws ) {
}
found_operand = new cArea(ph.real_str ? ph.real_str.toUpperCase() : ph.operand_str.toUpperCase(), t.ws);
parseResult.addRefPos(ph.pCurrPos - ph.operand_str.length, ph.pCurrPos, t.outStack.length, found_operand);
+ if (local || (local === false && digitDelim === false)) { // local and digitDelim with value false using only for copypaste mode.
+ t.ca = isRecursiveFormula(found_operand, t);
+ }
}
/* Referens to cell A4 */ else if (parserHelp.isRef.call(ph, t.Formula, ph.pCurrPos)) {
if (!_checkReferenceCount(1)) {
@@ -6969,6 +7475,10 @@ function parserFormula( formula, parent, _ws ) {
}
found_operand = new cRef(ph.real_str ? ph.real_str.toUpperCase() : ph.operand_str.toUpperCase(), t.ws);
parseResult.addRefPos(ph.pCurrPos - ph.operand_str.length, ph.pCurrPos, t.outStack.length, found_operand);
+
+ if (local || (local === false && digitDelim === false)) { // local and digitDelim with value false using only for copypaste mode.
+ t.ca = isRecursiveFormula(found_operand, t);
+ }
} else if (_tableTMP = parserHelp.isTable.call(ph, t.Formula, ph.pCurrPos, local)) {
found_operand = cStrucTable.prototype.createFromVal(_tableTMP, t.wb, t.ws, tablesMap);
@@ -7026,6 +7536,12 @@ function parserFormula( formula, parent, _ws ) {
needAssemble = true;
}
parseResult.addRefPos(ph.pCurrPos - ph.operand_str.length, ph.pCurrPos, t.outStack.length, found_operand, true);
+ if (local || (local === false && digitDelim === false)) { // local and digitDelim with value false using only for copypaste mode.
+ t.ca = isRecursiveFormula(found_operand, t);
+ }
+ if (t.ca && defName && defName.parsedRef) {
+ defName.parsedRef.ca = t.ca;
+ }
}
/* Numbers*/ else if (parserHelp.isNumber.call(ph, t.Formula, ph.pCurrPos, digitDelim)) {
@@ -7304,48 +7820,176 @@ function parserFormula( formula, parent, _ws ) {
}
};
- parserFormula.prototype.calculateCycleError = function () {
- this.value = new cError(cErrorType.bad_reference);
- this._endCalculate();
- return this.value;
- };
- parserFormula.prototype.calculate = function (opt_defName, opt_bbox, opt_offset, checkMultiSelect) {
- if (this.outStack.length < 1) {
- this.value = new cError(cErrorType.wrong_name);
- this._endCalculate();
- return this.value;
- }
- if (!opt_bbox && this.parent && this.parent.onFormulaEvent) {
- opt_bbox = this.parent.onFormulaEvent(AscCommon.c_oNotifyParentType.GetRangeCell);
- }
- if (!opt_bbox) {
- opt_bbox = new Asc.Range(0, 0, 0, 0);
- }
-
- var elemArr = [], _tmp, numFormat = cNumFormatFirstCell, currentElement = null, bIsSpecialFunction, argumentsCount, defNameCalcArr, defNameArgCount = 0;
- for (var i = 0; i < this.outStack.length; i++) {
- currentElement = this.outStack[i];
- if (currentElement.name === "(") {
- continue;
- }
- if(currentElement.type === cElementType.specialFunctionStart){
- bIsSpecialFunction = true;
- continue;
- }
- if(currentElement.type === cElementType.specialFunctionEnd){
- bIsSpecialFunction = false;
- continue;
- }
- if("number" === typeof(currentElement)){
- continue;
+ parserFormula.prototype.findRefByOutStack = function (forceCheck) {
+ if (AscCommonExcel.bIsSupportDynamicArrays || forceCheck) {
+ // using outStack, look at all the arguments in the formulas and compare them with the arrayIndex positions for this formula
+ // go through the stack in the same order as .calculate method
+ if (this.ref) {
+ return true;
}
- //TODO пока проставляю у каждого элемента флаг для рассчетов. пересмотреть
- //***array-formula***
- currentElement.bArrayFormula = null;
- if(this.ref) {
- currentElement.bArrayFormula = true;
- }
+ if (this.outStack && this.outStack.length > 0) {
+ let elemArr = [], _tmp, currentElement = null, bIsSpecialFunction, argumentsCount, defNameCalcArr, defNameArgCount = 0;
+ let length = this.outStack.length;
+ let isRef, opt_bbox;
+
+ if (!opt_bbox && this.parent && this.parent.onFormulaEvent) {
+ opt_bbox = this.parent.onFormulaEvent(AscCommon.c_oNotifyParentType.GetRangeCell);
+ }
+ if (!opt_bbox) {
+ opt_bbox = new Asc.Range(0, 0, 0, 0);
+ }
+
+ if (length === 1) {
+ let singleElem = this.outStack[0];
+ if (singleElem.type === cElementType.cellsRange || singleElem.type === cElementType.cellsRange3D || singleElem.type === cElementType.array) {
+ isRef = true;
+ } else if (singleElem.type === cElementType.name || singleElem.type === cElementType.name3D) {
+ // let defName = singleElem.getDefName();
+ let defNameResult = singleElem.Calculate(null, opt_bbox, true);
+ if (defNameResult && defNameResult.type === cElementType.array || defNameResult.type === cElementType.cellsRange || defNameResult.type === cElementType.cellsRange3D) {
+ isRef = true;
+ }
+ } else if (singleElem.type === cElementType.table) {
+ let tableArea = singleElem.toRef(opt_bbox);
+ if (tableArea && tableArea.type === cElementType.cellsRange || tableArea.type === cElementType.cellsRange3D || tableArea.type === cElementType.array) {
+ isRef = true;
+ }
+ }
+
+ if (isRef) {
+ return isRef;
+ }
+ }
+
+ for (let i = 0; i < this.outStack.length; i++) {
+ currentElement = this.outStack[i];
+ if (!currentElement) {
+ continue;
+ }
+
+ if(currentElement.name === "(" || currentElement.type === cElementType.specialFunctionStart || currentElement.type === cElementType.specialFunctionEnd || "number" === typeof(currentElement)) {
+ continue;
+ }
+
+ if (currentElement.type === cElementType.operator || currentElement.type === cElementType.func) {
+ argumentsCount = "number" === typeof(this.outStack[i - 1]) ? this.outStack[i - 1] : currentElement.argumentsCurrent;
+ if (argumentsCount < 0) {
+ argumentsCount = -argumentsCount;
+ currentElement.bArrayFormula = true;
+ }
+ if (elemArr.length < argumentsCount) {
+ // elemArr = [];
+ // todo test these cases
+ return false;
+ } else if (argumentsCount + defNameArgCount > currentElement.argumentsMax) {
+ // elemArr = [];
+ // todo test these cases
+ return false;
+ } else {
+ // if operator - check whether each of the arguments is a range or an array
+ let isOperator = currentElement.type === cElementType.operator;
+ let arg = [];
+ for (let i = 0; i < argumentsCount + defNameArgCount; i++) {
+ if ("number" === typeof(elemArr[elemArr.length - 1])) {
+ elemArr.pop();
+ }
+ let tempElem = elemArr.pop();
+ if (isOperator && (tempElem.type === cElementType.cellsRange || tempElem.type === cElementType.cellsRange3D || tempElem.type === cElementType.array)) {
+ isRef = true;
+ }
+
+ // arg.unshift(elemArr.pop());
+ arg.unshift(tempElem);
+ }
+
+ let isCanExpand = null;
+ if (currentElement.type === cElementType.func) {
+ isCanExpand = cBaseFunction.prototype.checkFormulaArray2.call(currentElement, arg, opt_bbox, null, this, bIsSpecialFunction, argumentsCount);
+ } else if (currentElement.type === cElementType.operator && currentElement.bArrayFormula) {
+ bIsSpecialFunction = true;
+ }
+
+ if(isCanExpand) {
+ isRef = true;
+ } else {
+ /* results of SEQUENCE, RANDARRAY etc... can return an array when using regular values in arguments */
+ _tmp = currentElement.Calculate(arg, opt_bbox, null, this.ws, bIsSpecialFunction);
+ }
+
+ if (isRef || (_tmp && (_tmp.type === cElementType.array /*|| _tmp.type === cElementType.cellsRange || _tmp.type === cElementType.cellsRange3D*/))) {
+ return true;
+ }
+
+ defNameArgCount = 0;
+ elemArr.push(_tmp);
+ }
+ } else if (currentElement.type === cElementType.name || currentElement.type === cElementType.name3D) {
+ // let defName = currentElement.getDefName();
+ defNameCalcArr = currentElement.Calculate(null, opt_bbox, true);
+ defNameArgCount = [];
+ if(defNameCalcArr && defNameCalcArr.length) {
+ defNameArgCount = defNameCalcArr.length - 1;
+ for(let j = 0; j < defNameCalcArr.length; j++) {
+ elemArr.push(defNameCalcArr[j]);
+ }
+ } else {
+ elemArr.push(defNameCalcArr);
+ }
+ } else if (currentElement.type === cElementType.table) {
+ elemArr.push(currentElement.toRef(opt_bbox));
+ } else {
+ elemArr.push(currentElement);
+ }
+ }
+
+ return isRef;
+ }
+ return false;
+ }
+ };
+ parserFormula.prototype.calculate = function (opt_defName, opt_bbox, opt_offset, checkMultiSelect, opt_oCalculateResult) {
+ if (this.outStack.length < 1) {
+ this.value = new cError(cErrorType.wrong_name);
+ this._endCalculate();
+ return this.value;
+ }
+ if (!opt_bbox && this.parent && this.parent.onFormulaEvent) {
+ opt_bbox = this.parent.onFormulaEvent(AscCommon.c_oNotifyParentType.GetRangeCell);
+ }
+ if (!opt_bbox) {
+ opt_bbox = new Asc.Range(0, 0, 0, 0);
+ }
+
+ var elemArr = [], _tmp, numFormat = cNumFormatFirstCell, currentElement = null, bIsSpecialFunction, argumentsCount, defNameCalcArr, defNameArgCount = 0;
+ for (var i = 0; i < this.outStack.length; i++) {
+ currentElement = this.outStack[i];
+ if (currentElement.name === "(") {
+ continue;
+ }
+ if(currentElement.type === cElementType.specialFunctionStart){
+ bIsSpecialFunction = true;
+ continue;
+ }
+ if(currentElement.type === cElementType.specialFunctionEnd){
+ bIsSpecialFunction = false;
+ continue;
+ }
+ if("number" === typeof(currentElement)){
+ continue;
+ }
+
+ //TODO пока проставляю у каждого элемента флаг для рассчетов. пересмотреть
+ //***array-formula***
+ currentElement.bArrayFormula = null;
+ if(this.ref) {
+ currentElement.bArrayFormula = true;
+ }
+
+ /* concatenation should be done as an array formula - via ref */
+ if (currentElement.name && currentElement.name === "&") {
+ currentElement.bArrayFormula = true;
+ }
if (currentElement.type === cElementType.operator || currentElement.type === cElementType.func) {
argumentsCount = "number" === typeof(this.outStack[i - 1]) ? this.outStack[i - 1] : currentElement.argumentsCurrent;
@@ -7378,7 +8022,16 @@ function parserFormula( formula, parent, _ws ) {
//если данная функция не может возвращать массив, проходимся по всем элементам аргументов и формируем массив
var formulaArray = null;
if (currentElement.type === cElementType.func) {
- formulaArray = cBaseFunction.prototype.checkFormulaArray.call(currentElement, arg, opt_bbox, opt_defName, this, bIsSpecialFunction, argumentsCount);
+ // checkArgumentsTypes before calculate
+ if (opt_oCalculateResult && opt_oCalculateResult.checkOnError && currentElement.exactTypes && !currentElement.checkArgumentsTypes(arg)) {
+ this.value = new cError(cErrorType.null_value);
+ this._endCalculate();
+ opt_oCalculateResult.setError(c_oAscError.ID.FrmlOperandExpected);
+ return this.value;
+ } else {
+ formulaArray = cBaseFunction.prototype.checkFormulaArray.call(currentElement, arg, opt_bbox, opt_defName, this, bIsSpecialFunction, argumentsCount);
+ }
+
} else if (currentElement.type === cElementType.operator && currentElement.bArrayFormula) {
bIsSpecialFunction = true;
}
@@ -7423,14 +8076,53 @@ function parserFormula( formula, parent, _ws ) {
}
}
+ // ref(CSE) - legacy array-formula
+ // dynamic range(DAF) - newest dynamic array-formula
+ // Differences:
+ // The DAF formula is entered into one cell and is completed by simply pressing enter 'spill' occurs automatically
+ // In the case of CSE, you must select the range in advance and press the cse combination after entering the formula
+ // The DAF size automatically changes when the data in the original range changes. Dynamic range reference is written in D2# format
+ // DAF is edited in the first cell (parent) of the range; to edit cse we need to select the entire previously created range
+ // In CSE we cannot delete previously created rows, but DAF can be edited
+ // CSE can expand to all cells except the same CSE arrays, tables, pivot tables
+ // DAF can only expand to completely empty cells(empty values)
+
+ let isRangeCanFitIntoCells;
//TODO заглушка для парсинга множественного диапазона в _xlnm.Print_Area. Сюда попадаем только в одном случае - из функции findCell для отображения диапазона области печати
if(checkMultiSelect && elemArr.length > 1 && this.parent && this.parent instanceof window['AscCommonExcel'].DefName /*&& this.parent.name === "_xlnm.Print_Area"*/) {
this.value = elemArr;
+
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ // check further dynamic range
+ isRangeCanFitIntoCells = this.checkDynamicRangeByElement(this.value, opt_bbox);
+ if (!isRangeCanFitIntoCells) {
+ this.aca = true;
+ this.ca = true;
+ this.value = new cError(cErrorType.cannot_be_spilled);
+ } else {
+ this.ca = false;
+ this.aca = false;
+ }
+ }
+
this._endCalculate();
} else {
this.value = elemArr.pop();
- this.value.numFormat = numFormat;
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ // check further dynamic range
+ isRangeCanFitIntoCells = this.checkDynamicRangeByElement(this.value, opt_bbox);
+ if (!isRangeCanFitIntoCells) {
+ this.aca = true;
+ this.ca = true;
+ this.value = new cError(cErrorType.cannot_be_spilled);
+ } else {
+ this.ca = false;
+ this.aca = false;
+ }
+ }
+
+ this.value.numFormat = numFormat;
//***array-formula***
//для обработки формулы массива
//передаётся последним параметром cell и временно подменяется parent у parserFormula для того, чтобы поменялось значение в элементе массива
@@ -8165,6 +8857,21 @@ function parserFormula( formula, parent, _ws ) {
}
}
}
+
+ if (this.importFunctionsRangeLinks) {
+ for (let i in this.importFunctionsRangeLinks) {
+ let externalLink = this.wb.getExternalLinkByName(i);
+ if (externalLink) {
+ for (let j in this.importFunctionsRangeLinks[i]) {
+ let _rangeInfo = this.importFunctionsRangeLinks[i][j];
+ let _ws = externalLink.worksheets[_rangeInfo.sheet];
+ if (_ws) {
+ this._buildDependenciesRef(_ws.getId(), AscCommonExcel.g_oRangeCache.getRangesFromSqRef(_rangeInfo.range)[0], null, false);
+ }
+ }
+ }
+ }
+ }
};
parserFormula.prototype._buildDependenciesRef = function(wsId, bbox, isDefName, isStart) {
if (this.isTable) {
@@ -8247,7 +8954,8 @@ function parserFormula( formula, parent, _ws ) {
for (var i = 0; i < this.outStack.length; i++) {
var elem = this.outStack[i];
if (cElementType.cell === elem.type || cElementType.cell3D === elem.type ||
- cElementType.cellsRange === elem.type || cElementType.cellsRange3D === elem.type) {
+ cElementType.cellsRange === elem.type || cElementType.cellsRange3D === elem.type
+ || cElementType.table === elem.type) {
res = elem.getRange();
break;
}
@@ -8280,6 +8988,11 @@ function parserFormula( formula, parent, _ws ) {
parserFormula.prototype.getArrayFormulaRef = function() {
return this.ref;
};
+ parserFormula.prototype.getDynamicRef = function() {
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ return this.dynamicRange;
+ }
+ };
parserFormula.prototype.setArrayFormulaRef = function(ref) {
this.ref = ref;
};
@@ -8325,7 +9038,7 @@ function parserFormula( formula, parent, _ws ) {
return false;
};
parserFormula.prototype.simplifyRefType = function (val, opt_ws, opt_row, opt_col) {
- var ref = this.getArrayFormulaRef(), row, col;
+ let ref = this.getArrayFormulaRef(), dynamicRef = this.getDynamicRef(), row, col;
if (val == null) {
return;
@@ -8359,20 +9072,25 @@ function parserFormula( formula, parent, _ws ) {
}
} else if (cElementType.cellsRange === val.type || cElementType.cellsRange3D === val.type) {
if (opt_ws) {
- var range;
+ let range;
if (ref) {
range = val.getRange();
if (range) {
- var bbox = range.bbox;
- var rowCount = bbox.r2 - bbox.r1 + 1;
- var colCount = bbox.c2 - bbox.c1 + 1;
+ let bbox = range.bbox;
+ let rowCount = bbox.r2 - bbox.r1 + 1,
+ colCount = bbox.c2 - bbox.c1 + 1;
+
row = 1 === rowCount ? 0 : opt_row - ref.r1;
col = 1 === colCount ? 0 : opt_col - ref.c1;
if (row > rowCount - 1 || col > colCount - 1) {
val = null;
} else {
val = val.getValueByRowCol(row, col);
+ if (!val) {
+ val = new cEmpty();
+ }
}
+
if (!val) {
val = new window['AscCommonExcel'].cError(window['AscCommonExcel'].cErrorType.not_available);
}
@@ -8424,66 +9142,784 @@ function parserFormula( formula, parent, _ws ) {
return false;
};
+ parserFormula.prototype.setDynamicRef = function (range) {
+ if (!range) {
+ return
+ }
+ this.ref = range;
+ this.dynamicRange = range;
+ };
+
+ parserFormula.prototype.checkDynamicRange = function () {
+ /* this function checks if the current value in formula can fit in the cells */
+ if (!this.dynamicRange) {
+ return true
+ }
+
+ if (this.value && (this.value.type !== cElementType.array && this.value.type !== cElementType.cellsRange)) {
+ return true
+ } else if (this.value && (this.value.type === cElementType.array || this.value.type === cElementType.cellsRange)) {
+ // go through the range and see if the array can fit into it
+ let dimensions = this.value.getDimensions(),
+ mainCell = this.parent, isHaveNonEmptyCell;
+
+ if (this.value.isOneElement()) {
+ return true
+ }
+
+ if (mainCell) {
+ const t = this;
+ let rangeRow = mainCell.nRow,
+ rangeCol = mainCell.nCol;
+
+ for (let i = rangeRow; i < (rangeRow + dimensions.row); i++) {
+ for (let j = rangeCol; j < (rangeCol + dimensions.col); j++) {
+ if (i === rangeRow && j === rangeCol) {
+ continue
+ }
+ this.ws._getCellNoEmpty(i, j, function(cell) {
+ if (cell) {
+ let formula = cell.getFormulaParsed();
+ let dynamicRangeFromCell = formula && formula.getDynamicRef();
+ if (formula && dynamicRangeFromCell) {
+ // check if cell belong to current dynamicRange
+ // this is necessary so that spill errors do not occur during the second check of the range (since the values in it have already been entered earlier)
+ if (!t.dynamicRange.isEqual(dynamicRangeFromCell)) {
+ // if the cell is part of another dynamic range, then the range that is in the area of the previous range is displayed (except for the first cell, but we do not check it)
+ // that is, if one of the ranges is “lower” or “to the right” in the editor, then it will be displayed, and the other will receive a SPILL error
+ isHaveNonEmptyCell = true
+ }
+ } else if (cell.formulaParsed || !cell.isEmptyTextString()) {
+ isHaveNonEmptyCell = true
+ }
+ }
+ });
+ if (isHaveNonEmptyCell) {
+ return false
+ }
+ }
+ }
+ return true
+ }
+ }
+
+ return false
+ };
+
+ parserFormula.prototype.checkDynamicRangeByElement = function (element, parentCell) {
+ /* this function checks if element can fit in the cells */
+ if (!element || !parentCell) {
+ return true;
+ }
+
+ if (element.type !== cElementType.array && element.type !== cElementType.cellsRange && element.type !== cElementType.cellsRange3D) {
+ return true;
+ } else if (element.type === cElementType.array || element.type === cElementType.cellsRange || element.type === cElementType.cellsRange3D) {
+ // go through the range and see if the array can fit into it
+ let dimensions = element.getDimensions(), isHaveNonEmptyCell;
+
+ if (element.isOneElement()) {
+ return true
+ }
+
+ // todo if an element is defname, it has no parent element?
+ const t = this;
+ let rangeRow = parentCell.r1,
+ rangeCol = parentCell.c1;
+
+ let supposedDynamicRange = this.ws.getRange3(rangeRow, rangeCol, (rangeRow + dimensions.row) - 1, (rangeCol + dimensions.col) - 1);
+ for (let i = rangeRow; i < (rangeRow + dimensions.row); i++) {
+ for (let j = rangeCol; j < (rangeCol + dimensions.col); j++) {
+ if (i === rangeRow && j === rangeCol) {
+ continue
+ }
+ this.ws._getCellNoEmpty(i, j, function(cell) {
+ if (cell) {
+ let formula = cell.getFormulaParsed();
+ let dynamicRangeFromCell = formula && formula.getDynamicRef();
+ if (formula && dynamicRangeFromCell) {
+ // check if cell belong to current dynamicRange
+ // this is necessary so that spill errors do not occur during the second check of the range (since the values in it have already been entered earlier)
+ if (!supposedDynamicRange.bbox.isEqual(dynamicRangeFromCell)) {
+ // if the cell is part of another dynamic range, then the range that is in the area of the previous range is displayed (except for the first cell, but we do not check it)
+ // that is, if one of the ranges is “lower” or “to the right” in the editor, then it will be displayed, and the other will receive a SPILL error
+ isHaveNonEmptyCell = true
+ }
+ } else if (cell.formulaParsed || !cell.isEmptyTextString()) {
+ isHaveNonEmptyCell = true
+ }
+ }
+ });
+ if (isHaveNonEmptyCell) {
+ return false
+ }
+ }
+ }
+ return true
+ }
+
+ return false
+ };
+
+ /**
+ * Class representative an iterative calculations logic
+ * @constructor
+ */
function CalcRecursion() {
- this.level = 0;
- this.elemsPart = [];
- this.elems = [];
- this.isForceBacktracking = false;
- this.isProcessRecursion = false;
+ this.nLevel = 0;
+ this.bIsForceBacktracking = false;
+ this.bIsProcessRecursion = false;
+ this.aElems = [];
+ this.aElemsPart = [];
+
+ this.nIterStep = 1;
+ this.oStartCellIndex = null;
+ this.nRecursionCounter = 0;
+ this.oGroupChangedCells = null;
+ this.oPrevIterResult = null;
+ this.oDiffBetweenIter = null;
+ this.bShowCycleWarn = true;
+ this.oRecursionCells = null;
+ this.nCellPasteValue = null; // for paste recursive cell
+
+ this.bIsEnabledRecursion = null;
+ this.nMaxIterations = null; // Max iterations of recursion calculations. Default value: 100.
+ this.nRelativeError = null; // Relative error between current and previous cell value. Default value: 1e-3.
+ this.nCalcMode = Asc.c_oAscCalcMode.auto; // Calculation mode. Default value: Asc.c_oAscCalcMode.auto
+ /*for chrome63(real maximum call stack size is 12575) nMaxRecursion that cause exception is 783
+ by measurement: stack size in doctrenderer is one fourth smaller than chrome*/
+ this.nMaxRecursion = 300; // Default value: 300
}
- //for chrome63(real maximum call stack size is 12575) MAXRECURSION that cause excaption is 783
- //by measurement: stack size in doctrenderer is one fourth smaller than chrome
- CalcRecursion.prototype.MAXRECURSION = 300;
+ /**
+ * Method returns maximum recursion level.
+ * @memberof CalcRecursion
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getMaxRecursion = function () {
+ return this.nMaxRecursion;
+ };
+ /**
+ * Method sets a flag who recognizes recursion needs force backtracking.
+ * Uses if level of recursion exceeds max level.
+ * @memberof CalcRecursion
+ * @param {boolean} bIsForceBacktracking
+ */
+ CalcRecursion.prototype.setIsForceBacktracking = function (bIsForceBacktracking) {
+ if (!this.getIsForceBacktracking()) {
+ this.aElemsPart = [];
+ this.aElems.push(this.aElemsPart);
+ }
+ this.bIsForceBacktracking = bIsForceBacktracking;
+ };
+ /**
+ * Method returns a flag who recognizes recursion needs force backtracking.
+ * Uses if level of recursion exceeds max level.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.getIsForceBacktracking = function () {
+ return this.bIsForceBacktracking;
+ };
+ /**
+ * Method sets a flag who recognizes work with aElems in _checkDirty method is already in process.
+ * @memberof CalcRecursion
+ * @param {boolean} bIsProcessRecursion
+ */
+ CalcRecursion.prototype.setIsProcessRecursion = function (bIsProcessRecursion) {
+ this.bIsProcessRecursion = bIsProcessRecursion;
+ };
+ /**
+ * Method returns a flag who recognizes work with aElems in _checkDirty method is already in process.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.getIsProcessRecursion = function () {
+ return this.bIsProcessRecursion;
+ }
+ /**
+ * Method increases recursion level. Uses for tracking a level of recursion in _checkDirty method.
+ * @memberof CalcRecursion
+ */
CalcRecursion.prototype.incLevel = function () {
+ this.nLevel++;
+ };
+ /**
+ * Method decreases recursion level. Uses for actualizes a level of recursion
+ * in case when one of recursion is finished. Uses in _checkDirty method.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.decLevel = function () {
+ this.nLevel--;
+ };
+ /**
+ * Method returns level of recursion in _checkDirty method.
+ * @memberof CalcRecursion
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getLevel = function () {
+ return this.nLevel;
+ };
+ /**
+ * Method checks the level of recursion exceeds max level or not.
+ * Uses in _checkDirty method.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.checkLevel = function () {
if (this.getIsForceBacktracking()) {
return false;
}
- var res = this.level <= CalcRecursion.prototype.MAXRECURSION;
- if (res) {
- this.level++;
- } else {
+
+ let res = this.getLevel() <= this.getMaxRecursion();
+ if (!res) {
this.setIsForceBacktracking(true);
}
+
return res;
};
- CalcRecursion.prototype.decLevel = function () {
- this.level--;
- };
- CalcRecursion.prototype.getLevel = function () {
- return this.level;
- };
- CalcRecursion.prototype.insert = function (val) {
- this.elemsPart.push(val);
+ /**
+ * Method inserts cells which need to be processed in _checkDirty method again.
+ * Uses for formula chains that reached max recursion level.
+ * @memberof CalcRecursion
+ * @param {{ws:Worksheet, nRow:number, nCol:number}} oCellCoordinate
+ */
+ CalcRecursion.prototype.insert = function (oCellCoordinate) {
+ this.aElemsPart.push(oCellCoordinate);
};
- CalcRecursion.prototype.foreachInReverse = function (callback) {
- for (var i = this.elems.length - 1; i >= 0; --i) {
- var elemsPart = this.elems[i];
- for (var j = 0; j < elemsPart.length; ++j) {
- callback(elemsPart[j]);
+ /**
+ * Method executes callback for each cell from aElems in reverse order.
+ * aElems stores cell coordinates which need to be processed in _checkDirty method again.
+ * @memberof CalcRecursion
+ * @param {Function} fCallback
+ */
+ CalcRecursion.prototype.foreachInReverse = function (fCallback) {
+ for (let i = this.aElems.length - 1; i >= 0; i--) {
+ let aElemsPart = this.aElems[i];
+ for (let j = 0, length = aElemsPart.length; j < length; j++) {
+ fCallback(aElemsPart[j]);
if (this.getIsForceBacktracking()) {
return;
}
}
}
};
- CalcRecursion.prototype.setIsForceBacktracking = function (val) {
- if (!this.isForceBacktracking) {
- this.elemsPart = [];
- this.elems.push(this.elemsPart);
+ /**
+ * Method increases iteration step.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.incIterStep = function () {
+ this.nIterStep++;
+ };
+ /**
+ * Method resets iteration step.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.resetIterStep = function () {
+ this.nIterStep = 1;
+ };
+ /**
+ * Method returns iteration step.
+ * @memberof CalcRecursion
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getIterStep = function () {
+ return this.nIterStep;
+ };
+ /**
+ * Method increments recursion counter.
+ * Uses for control recursion level of initStartCellForIterCalc and enableCalcFormulas method of Cell class.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.incRecursionCounter = function () {
+ this.nRecursionCounter++;
+ };
+ /**
+ * Method decrements recursion counter.
+ * Uses for control recursion level of initStartCellForIterCalc and enableCalcFormulas method of Cell class.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.decRecursionCounter = function () {
+ this.nRecursionCounter--;
+ };
+ /**
+ * Method resets recursion counter.
+ * Uses for control recursion level of initStartCellForIterCalc method.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.resetRecursionCounter = function () {
+ if (this.getRecursionCounter() > 0) {
+ this.decRecursionCounter();
+ } else if (this.getIsForceBacktracking()) {
+ this.setIsForceBacktracking(false);
+ }
+ };
+ /**
+ * Method checks the recursion counter exceeds max level of recursion or not.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.checkRecursionCounter = function () {
+ if (this.getIsForceBacktracking()) {
+ return true;
+ }
+
+ let bRecursionExceeded = g_cCalcRecursion.getRecursionCounter() >= g_cCalcRecursion.getMaxRecursion();
+
+ if (bRecursionExceeded) {
+ this.setIsForceBacktracking(true);
+ }
+
+ return bRecursionExceeded;
+ }
+ /**
+ * Method returns recursion counter.
+ * Uses for control recursion level of initStartCellForIterCalc method.
+ * @memberof CalcRecursion
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getRecursionCounter = function () {
+ return this.nRecursionCounter;
+ };
+ /**
+ * Method sets a flag who recognizes an iteration calculations setting is enabled or not.
+ * @memberof CalcRecursion
+ * @param {boolean} bIsEnabledRecursion
+ */
+ CalcRecursion.prototype.setIsEnabledRecursion = function (bIsEnabledRecursion) {
+ this.bIsEnabledRecursion = bIsEnabledRecursion;
+ };
+ /**
+ * Method returns a flag who recognizes an iteration calculations setting is enabled or not.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.getIsEnabledRecursion = function () {
+ return this.bIsEnabledRecursion;
+ };
+ /**
+ * Method sets index of start cell. This cell is a start and finish point of iteration for a recursion formula.
+ * Uses for only with enabled iterative calculations setting.
+ * @memberof CalcRecursion
+ * @param {{cellId: number, wsName: string}|null} oStartCellIndex
+ */
+ CalcRecursion.prototype.setStartCellIndex = function (oStartCellIndex) {
+ this.oStartCellIndex = oStartCellIndex;
+ };
+ /**
+ * Method returns index of start cell. This cell is a start and finish point of iteration for a recursion formula.
+ * Uses for only with enabled iterative calculations setting.
+ * @memberof CalcRecursion
+ * @returns {{cellId: number, wsName: string}}
+ */
+ CalcRecursion.prototype.getStartCellIndex = function () {
+ return this.oStartCellIndex;
+ };
+ /**
+ * Method sets a maximum iterations.
+ * @memberof CalcRecursion
+ * @param {number} nMaxIterations
+ */
+ CalcRecursion.prototype.setMaxIterations = function (nMaxIterations) {
+ this.nMaxIterations = nMaxIterations;
+ };
+ /**
+ * Method returns a maximum iterations.
+ * @memberof CalcRecursion
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getMaxIterations = function () {
+ return this.nMaxIterations;
+ };
+ /**
+ * Method sets a relative error.
+ * @memberof CalcRecursion
+ * @param {number} nRelativeError
+ */
+ CalcRecursion.prototype.setRelativeError = function (nRelativeError) {
+ this.nRelativeError = nRelativeError;
+ };
+ /**
+ * Method returns a relative error.
+ * @memberof CalcRecursion
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getRelativeError = function () {
+ return this.nRelativeError;
+ };
+ /**
+ * Method sets a calculation mode.
+ * @memberof CalcRecursion
+ * @param {Asc.c_oAscCalcMode} nCalcMode
+ */
+ CalcRecursion.prototype.setCalcMode = function (nCalcMode) {
+ this.nCalcMode = nCalcMode;
+ };
+ /**
+ * Method returns a calculation mode.
+ * @memberof CalcRecursion
+ * @returns {Asc.c_oAscCalcMode}
+ */
+ CalcRecursion.prototype.getCalcMode = function () {
+ return this.nCalcMode;
+ };
+ /**
+ * Method sets a grouped changed cells.
+ * @memberof CalcRecursion
+ * @param {{wsName:{cellId: {cellId: number, wsName: string}[]}}|null} oGroupChangedCells
+ */
+ CalcRecursion.prototype.setGroupChangedCells = function (oGroupChangedCells) {
+ this.oGroupChangedCells = oGroupChangedCells;
+ };
+ /**
+ * Method returns a grouped changed cells.
+ * @memberof CalcRecursion
+ * @returns {{wsName:{cellId: {cellId: number, wsName: string}[]}}|null}
+ */
+ CalcRecursion.prototype.getGroupChangedCells = function () {
+ return this.oGroupChangedCells;
+ };
+ /**
+ * Method initializes an object for grouped changed cells.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ */
+ CalcRecursion.prototype.initGroupChangedCells = function (oCell) {
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ let oGroupChangedCell = {};
+ oGroupChangedCell[sCellWsName] = {};
+ this.setGroupChangedCells(oGroupChangedCell);
+ };
+ /**
+ * Method returns an array of cells with recursive formula.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ * @returns {{cellId: number, wsName: string}[]}
+ */
+ CalcRecursion.prototype.getRecursiveCells = function (oCell) {
+ const oGroupChangedCell = this.getGroupChangedCells();
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+
+ if (oGroupChangedCell == null) {
+ return [];
+ }
+ for (let sSheetName in oGroupChangedCell) {
+ let oGroupChangedSheet = oGroupChangedCell[sSheetName];
+ for (let sLinkedCellIndex in oGroupChangedSheet) {
+ const aLinkedCells = oGroupChangedSheet[sLinkedCellIndex];
+ let bHasCell = aLinkedCells.some(function (oCellIndex) {
+ return oCellIndex.cellId === nCellIndex && oCellIndex.wsName === sCellWsName;
+ })
+ if (bHasCell) {
+ return aLinkedCells;
+ }
+ }
+ }
+
+ return [];
+ };
+ /**
+ * Method updates start cell index.
+ * @memberof CalcRecursion
+ * @param {{cellId: number, wsName: string}[]} aRecursiveCells
+ */
+ CalcRecursion.prototype.updateStartCellIndex = function (aRecursiveCells) {
+ if (!aRecursiveCells.length) {
+ this.setStartCellIndex(null);
+ return;
+ }
+
+ const START_CELL_INDEX = 0;
+ const oStartCellIdFromArr = aRecursiveCells[START_CELL_INDEX];
+ const oStartCellIndex = this.getStartCellIndex();
+ if (oStartCellIndex && oStartCellIdFromArr.cellId === oStartCellIndex.cellId && oStartCellIdFromArr.wsName === oStartCellIndex.wsName) {
+ return;
}
- this.isForceBacktracking = val;
+ this.setStartCellIndex(oStartCellIdFromArr);
};
- CalcRecursion.prototype.getIsForceBacktracking = function () {
- return this.isForceBacktracking;
+ /**
+ * Method adds array with recursive cells in the group changed cells object.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ * @param {{cellId: number, wsName: string}[]} aRecursiveCells
+ */
+ CalcRecursion.prototype.addRecursiveCells = function (oCell, aRecursiveCells) {
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+ let oGroupChangedCell = this.getGroupChangedCells();
+
+ if (oGroupChangedCell == null) {
+ this.initGroupChangedCells(oCell);
+ oGroupChangedCell = this.getGroupChangedCells();
+ }
+ if (!oGroupChangedCell.hasOwnProperty(sCellWsName)) {
+ oGroupChangedCell[sCellWsName] = {};
+ }
+ oGroupChangedCell[sCellWsName][nCellIndex] = aRecursiveCells;
};
- CalcRecursion.prototype.setIsProcessRecursion = function (val) {
- this.isProcessRecursion = val;
+ /**
+ * Method updates array with recursive cells in the group changed cells object.
+ * @memberof CalcRecursion
+ * @param {{cellId: number, wsName: string}} oCellIndex
+ * @param {{cellId: number, wsName: string}[]} aRecursiveCells
+ */
+ CalcRecursion.prototype.updateRecursiveCells = function (oCellIndex, aRecursiveCells) {
+ const oGroupChangedCell = this.getGroupChangedCells();
+ const sCellWsName = oCellIndex.wsName;
+ const nCellIndex = oCellIndex.cellId;
+
+ oGroupChangedCell[sCellWsName][nCellIndex] = aRecursiveCells;
};
- CalcRecursion.prototype.getIsProcessRecursion = function () {
- return this.isProcessRecursion;
+ /**
+ * Method removes array with recursive cells in the group changed cells object.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ */
+ CalcRecursion.prototype.removeRecursionCell = function (oCell) {
+ const oGroupChangedCell = this.getGroupChangedCells();
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+ if (!oGroupChangedCell[sCellWsName] || !oGroupChangedCell[sCellWsName][nCellIndex]) {
+ return;
+ }
+ delete oGroupChangedCell[sCellWsName][nCellIndex];
+ };
+ /**
+ * Method sets a previous iteration result.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ */
+ CalcRecursion.prototype.setPrevIterResult = function (oCell) {
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+ const sWsName = oCell.ws.getName().toLowerCase();
+
+ if (this.oPrevIterResult == null) {
+ this.oPrevIterResult = {};
+ }
+ if (!this.oPrevIterResult.hasOwnProperty(sWsName)) {
+ this.oPrevIterResult[sWsName] = {};
+ }
+ this.oPrevIterResult[sWsName][nCellIndex] = oCell.getNumberValue();
};
- var g_cCalcRecursion = new CalcRecursion();
+ /**
+ * Method returns a previous iteration result.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getPrevIterResult = function (oCell) {
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+ const sWsName = oCell.ws.getName().toLowerCase();
+ const oPrevIterResult = this.oPrevIterResult;
+
+ if (oPrevIterResult == null) {
+ return NaN;
+ }
+ if (!oPrevIterResult.hasOwnProperty(sWsName) || !oPrevIterResult[sWsName].hasOwnProperty(nCellIndex)) {
+ return NaN;
+ }
+
+ return oPrevIterResult[sWsName][nCellIndex];
+ };
+ /**
+ * Method clears a previous iteration results.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.clearPrevIterResult = function () {
+ this.oPrevIterResult = null;
+ };
+ /**
+ * Method sets result of a difference between iterations.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ * @param {number} nResult
+ */
+ CalcRecursion.prototype.setDiffBetweenIter = function (oCell, nResult) {
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+ const sWsName = oCell.ws.getName().toLowerCase();
+
+ if (this.oDiffBetweenIter == null) {
+ this.oDiffBetweenIter = {};
+ }
+ if (!this.oDiffBetweenIter.hasOwnProperty(sWsName)) {
+ this.oDiffBetweenIter[sWsName] = {};
+ }
+ this.oDiffBetweenIter[sWsName][nCellIndex] = nResult;
+ }
+ /**
+ * Method calculates a result of a difference between iterations.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ */
+ CalcRecursion.prototype.calcDiffBetweenIter = function (oCell) {
+ const nPrevIterResult = this.getPrevIterResult(oCell);
+ const nCurrentIterResult = oCell.getNumberValue();
+ const nChainLength = this.getRecursiveCells(oCell).length;
+
+ if (this.getIterStep() <= nChainLength && nCurrentIterResult === nPrevIterResult) {
+ return;
+ }
+ this.setDiffBetweenIter(oCell, Math.abs(nCurrentIterResult - nPrevIterResult));
+ };
+ /**
+ * Method returns a result of a difference between iterations.
+ * @memberof CalcRecursion
+ * @param {Cell} oCell
+ * @returns {number}
+ */
+ CalcRecursion.prototype.getDiffBetweenIter = function (oCell) {
+ const nCellIndex = AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol);
+ const sWsName = oCell.ws.getName().toLowerCase();
+ const oDiffBetweenIter = this.oDiffBetweenIter;
+
+ if (oDiffBetweenIter == null) {
+ return NaN;
+ }
+ if (!oDiffBetweenIter.hasOwnProperty(sWsName) || !oDiffBetweenIter[sWsName].hasOwnProperty(nCellIndex)) {
+ return NaN;
+ }
+
+ return oDiffBetweenIter[sWsName][nCellIndex];
+ };
+ /**
+ * Method clears a result of a difference between iterations.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.clearDiffBetweenIter = function () {
+ this.oDiffBetweenIter = null;
+ };
+ /**
+ * Method returns a flag that checks a recursive call is needed.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.needRecursiveCall = function () {
+ if (!this.getIsEnabledRecursion()) {
+ return false;
+ }
+ const oGroupChangedCells = this.getGroupChangedCells();
+ const bMaxStepNotExceeded = this.getIterStep() <= this.getMaxIterations();
+ let bHasRecursiveCell = false;
+
+ for (let sSheetName in oGroupChangedCells) {
+ let oGroupChangedSheet = oGroupChangedCells[sSheetName];
+ for (let sCellIndex in oGroupChangedSheet) {
+ let aRecursiveCells = oGroupChangedSheet[sCellIndex];
+ if (aRecursiveCells.length) {
+ bHasRecursiveCell = true;
+ break;
+ }
+ }
+ if (bHasRecursiveCell) {
+ break;
+ }
+ }
+
+ return bHasRecursiveCell && bMaxStepNotExceeded;
+ };
+ /**
+ * Method initializes calculation properties.
+ * @memberof CalcRecursion
+ * @param {CCalcPr} oCalcPr
+ */
+ CalcRecursion.prototype.initCalcProperties = function (oCalcPr) {
+ const oCalcSettings = Asc.editor.asc_GetCalcSettings(); // Object with default values
+
+ if (!oCalcSettings) {
+ return;
+ }
+ this.setIsEnabledRecursion(oCalcPr.getIterate() ? oCalcPr.getIterate() : oCalcSettings.asc_getIterativeCalc());
+ this.setRelativeError(oCalcPr.getIterateDelta() != null ? oCalcPr.getIterateDelta() : oCalcSettings.asc_getMaxChange());
+ this.setMaxIterations(oCalcPr.getIterateCount() ? oCalcPr.getIterateCount() : oCalcSettings.asc_getMaxIterations());
+ if (oCalcPr.getCalcMode()) {
+ this.setCalcMode(oCalcPr.getCalcMode());
+ }
+ };
+ /**
+ * Method returns a flag who recognizes show warn about cycle reference error or not.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.getShowCycleWarn = function () {
+ return this.bShowCycleWarn;
+ };
+ /**
+ * Method sets a flag who recognizes show warn about cycle reference error or not.
+ * @memberof CalcRecursion
+ * @param {boolean} bShowCycleWarn
+ */
+ CalcRecursion.prototype.setShowCycleWarn = function (bShowCycleWarn) {
+ this.bShowCycleWarn = bShowCycleWarn;
+ };
+ /**
+ * Method adds an index of a recursive cell to the list of recursive cells.
+ * @memberof CalcRecursion
+ * @param {number} nCellIndex
+ */
+ CalcRecursion.prototype.addRecursiveCell = function (nCellIndex) {
+ if (!this.oRecursionCells) {
+ this.oRecursionCells = {};
+ }
+
+ this.oRecursionCells[nCellIndex] = true;
+ };
+ /**
+ * Method checks a cell is recursive or not by index of cell.
+ * @memberof CalcRecursion
+ * @param {number} nCellId
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.isRecursiveCell = function (nCellId) {
+ return !!(this.oRecursionCells && this.oRecursionCells[nCellId]);
+ };
+ /**
+ * Method clears a list of recursive cells.
+ * @memberof CalcRecursion
+ */
+ CalcRecursion.prototype.clearRecursionCells = function () {
+ this.oRecursionCells = null;
+ };
+ /**
+ * Method finds recursive cell by parserFormula.
+ * @memberof CalcRecursion
+ * @param {parserFormula} oParserFormula
+ */
+ CalcRecursion.prototype.findRecursionCell = function (oParserFormula) {
+ const oThis = this;
+ const oParentCell = oParserFormula.getParent();
+
+ if (!(oParentCell instanceof AscCommonExcel.CCellWithFormula)) {
+ return;
+ }
+ oParserFormula.ws._getCell(oParentCell.nRow, oParentCell.nCol, function (oCell) {
+ if (oCell.isFormula()) {
+ oCell.initStartCellForIterCalc(); // check cell has recursion formula
+ if (oThis.getStartCellIndex()) {
+ oThis.addRecursiveCell(AscCommonExcel.getCellIndex(oCell.nRow, oCell.nCol));
+ oThis.setStartCellIndex(null);
+ }
+ }
+ });
+ };
+ /**
+ * Method sets a value from a copying cell for a paste cell.
+ * @memberof CalcRecursion
+ * @param {number|null} nCellPasteValue
+ */
+ CalcRecursion.prototype.setCellPasteValue = function (nCellPasteValue) {
+ this.nCellPasteValue = nCellPasteValue;
+ };
+ /**
+ * Method gets a value from a copying cell for a paste cell.
+ * @memberof CalcRecursion
+ * @returns {number|null}
+ */
+ CalcRecursion.prototype.getCellPasteValue = function () {
+ return this.nCellPasteValue;
+ };
+
+ const g_cCalcRecursion = new CalcRecursion();
function parseNum(str) {
if (str.indexOf("x") > -1 || str == "" || str.match(/^\s+$/))//исключаем запись числа в 16-ричной форме из числа.
@@ -8951,9 +10387,12 @@ function parserFormula( formula, parent, _ws ) {
}
function convertAreaToArray(area){
- var retArr = new cArray(), _arg0;
- var dimension = area.getDimensions();
- var ws;
+ let retArr = new cArray(), _arg0;
+ let dimension = area.getDimensions();
+
+ retArr.realSize = {row: dimension.row, col: dimension.col}
+
+ let ws;
if(cElementType.cellsRange3D === area.type) {
ws = area.wsFrom;
area = area.getMatrixNoEmpty()[0];
@@ -8963,14 +10402,36 @@ function parserFormula( formula, parent, _ws ) {
}
if (dimension) {
- var oBBox = dimension.bbox, minC = Math.min( ws.getColDataLength(), oBBox.c2 ), minR = Math.min( ws.cellsByColRowsCount - 1, oBBox.r2 );
- var rowCount = (minR - oBBox.r1) >= 0 ? minR - oBBox.r1 + 1 : 0;
- var colCount = (minC - oBBox.c1) >= 0 ? minC - oBBox.c1 + 1 : 0;
+ let oBBox = dimension.bbox,
+ minC = Math.min( ws.getColDataLength(), oBBox.c2 ),
+ minR = Math.min( ws.cellsByColRowsCount - 1, oBBox.r2 ),
+ rowCount = (minR - oBBox.r1) >= 0 ? minR - oBBox.r1 + 1 : 0,
+ colCount = (minC - oBBox.c1) >= 0 ? minC - oBBox.c1 + 1 : 0;
+
+ if (rowCount < dimension.row || colCount < dimension.col) {
+ retArr.missedValue = new cEmpty();
+ } else {
+ retArr.realSize = null;
+ }
+
+ if (area && area.length < 1) {
+ // let emptyElem = new cEmpty();
+ // if array is empty - add info about range size and set missedValue
+ retArr.setRealArraySize(dimension.row, dimension.col);
+ retArr.missedValue = new cEmpty();
- for ( var iRow = 0; iRow < rowCount; iRow++, iRow < rowCount ? retArr.addRow() : true ) {
- for ( var iCol = 0; iCol < colCount; iCol++ ) {
- _arg0 = area[iRow] && area[iRow][iCol] ? area[iRow][iCol] : new cEmpty();
- retArr.addElement(_arg0);
+ /* we add one element to the array so as not to return a completely empty array to the formula */
+ if (!retArr.countElement) {
+ retArr.addRow();
+ retArr.addElement(retArr.missedValue);
+ }
+
+ } else {
+ for ( let iRow = 0; iRow < rowCount; iRow++, iRow < rowCount ? retArr.addRow() : true ) {
+ for ( let iCol = 0; iCol < colCount; iCol++ ) {
+ _arg0 = area[iRow] && area[iRow][iCol] ? area[iRow][iCol] : new cEmpty();
+ retArr.addElement(_arg0);
+ }
}
}
}
@@ -9023,161 +10484,135 @@ function parserFormula( formula, parent, _ws ) {
function specialFuncArrayToArray(arg0, arg1, what) {
let retArr = null, _arg0, _arg1;
let iRow, iCol;
- if (arg0.getRowCount() === arg1.getRowCount() && 1 === arg0.getCountElementInRow()) {
+
+ let arg0RowCount = arg0.getRowCount(true),
+ arg0ColCount = arg0.getCountElementInRow(true),
+ arg1RowCount = arg1.getRowCount(true),
+ arg1ColCount = arg1.getCountElementInRow(true);
+
+ if (arg0RowCount === arg1RowCount && 1 === arg0ColCount) {
retArr = new cArray();
- for (iRow = 0; iRow < arg1.getRowCount(); iRow++, iRow < arg1.getRowCount() ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arg1.getCountElementInRow(); iCol++) {
- _arg0 = arg0.getElementRowCol(iRow, 0);
- _arg1 = arg1.getElementRowCol(iRow, iCol);
+ for (iRow = 0; iRow < arg1RowCount; iRow++, iRow < arg1RowCount ? retArr.addRow() : true) {
+ for (iCol = 0; iCol < arg1ColCount; iCol++) {
+ _arg0 = arg0.getElementRowCol(iRow, 0, true);
+ _arg1 = arg1.getElementRowCol(iRow, iCol, true);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
- } else if (arg0.getRowCount() === arg1.getRowCount() && 1 === arg1.getCountElementInRow()) {
+ } else if (arg0RowCount === arg1RowCount && 1 === arg1ColCount) {
retArr = new cArray();
- for (iRow = 0; iRow < arg0.getRowCount(); iRow++, iRow < arg0.getRowCount() ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arg0.getCountElementInRow(); iCol++) {
- _arg0 = arg0.getElementRowCol(iRow, iCol);
- _arg1 = arg1.getElementRowCol(iRow, 0);
+ for (iRow = 0; iRow < arg0RowCount; iRow++, iRow < arg0RowCount ? retArr.addRow() : true) {
+ for (iCol = 0; iCol < arg0ColCount; iCol++) {
+ _arg0 = arg0.getElementRowCol(iRow, iCol, true);
+ _arg1 = arg1.getElementRowCol(iRow, 0, true);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
- } else if (arg0.getCountElementInRow() === arg1.getCountElementInRow() && 1 === arg0.getRowCount()) {
+ } else if (arg0ColCount === arg1ColCount && 1 === arg0RowCount) {
retArr = new cArray();
- for (iRow = 0; iRow < arg1.getRowCount(); iRow++, iRow < arg1.getRowCount() ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arg1.getCountElementInRow(); iCol++) {
- _arg0 = arg0.getElementRowCol(0, iCol);
- _arg1 = arg1.getElementRowCol(iRow, iCol);
+ for (iRow = 0; iRow < arg1RowCount; iRow++, iRow < arg1RowCount ? retArr.addRow() : true) {
+ for (iCol = 0; iCol < arg1ColCount; iCol++) {
+ _arg0 = arg0.getElementRowCol(0, iCol, true);
+ _arg1 = arg1.getElementRowCol(iRow, iCol, true);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
- } else if (arg0.getCountElementInRow() === arg1.getCountElementInRow() && 1 === arg1.getRowCount()) {
+ } else if (arg0ColCount === arg1ColCount && 1 === arg1RowCount) {
retArr = new cArray();
- for (iRow = 0; iRow < arg0.getRowCount(); iRow++, iRow < arg0.getRowCount() ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arg0.getCountElementInRow(); iCol++) {
- _arg0 = arg0.getElementRowCol(iRow, iCol);
- _arg1 = arg1.getElementRowCol(0, iCol);
+ for (iRow = 0; iRow < arg0RowCount; iRow++, iRow < arg0RowCount ? retArr.addRow() : true) {
+ for (iCol = 0; iCol < arg0ColCount; iCol++) {
+ _arg0 = arg0.getElementRowCol(iRow, iCol, true);
+ _arg1 = arg1.getElementRowCol(0, iCol, true);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
- } else if (1 === arg0.getCountElementInRow() && 1 === arg1.getRowCount()) {
+ } else if (1 === arg0ColCount && 1 === arg1RowCount) {
retArr = new cArray();
- for (iRow = 0; iRow < arg0.getRowCount(); iRow++, iRow < arg0.getRowCount() ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arg1.getCountElementInRow(); iCol++) {
- _arg0 = arg0.getElementRowCol(iRow, 0);
- _arg1 = arg1.getElementRowCol(0, iCol);
+ for (iRow = 0; iRow < arg0RowCount; iRow++, iRow < arg0RowCount ? retArr.addRow() : true) {
+ for (iCol = 0; iCol < arg1ColCount; iCol++) {
+ _arg0 = arg0.getElementRowCol(iRow, 0, true);
+ _arg1 = arg1.getElementRowCol(0, iCol, true);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
- } else if (1 === arg1.getCountElementInRow() && 1 === arg0.getRowCount()) {
+ } else if (1 === arg1ColCount && 1 === arg0RowCount) {
retArr = new cArray();
- for (iRow = 0; iRow < arg1.getRowCount(); iRow++, iRow < arg1.getRowCount() ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arg0.getCountElementInRow(); iCol++) {
- _arg0 = arg0.getElementRowCol(0, iCol);
- _arg1 = arg1.getElementRowCol(iRow, 0);
+ for (iRow = 0; iRow < arg1RowCount; iRow++, iRow < arg1RowCount ? retArr.addRow() : true) {
+ for (iCol = 0; iCol < arg0ColCount; iCol++) {
+ _arg0 = arg0.getElementRowCol(0, iCol, true);
+ _arg1 = arg1.getElementRowCol(iRow, 0, true);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
- } else if (arg0.getCountElement() !== arg1.getCountElement()) {
- let arg0Copy = new cArray(), arg1Copy = new cArray();
+ } else if (arg0.getCountElement() !== arg1.getCountElement() || arg0RowCount !== arg1RowCount || arg0ColCount !== arg1ColCount) {
let errNA = new cError(cErrorType.not_available);
- arg0Copy.fillFromArray(arg0.array);
- arg1Copy.fillFromArray(arg1.array);
-
// if there is only one element in the range, get this element and call the function again
if (arg0.isOneElement()) {
- arg0Copy = arg0.getFirstElement();
- return _func[arg0Copy.type][arg1.type](arg0Copy, arg1, what);
+ let arg0FirstElem = arg0.getFirstElement();
+ return _func[arg0FirstElem.type][arg1.type](arg0FirstElem, arg1, what);
} else if (arg1.isOneElement()) {
- arg1Copy = arg1.getFirstElement();
- return _func[arg0.type][arg1Copy.type](arg0, arg1Copy, what);
+ let arg1FirstElem = arg1.getFirstElement();
+ return _func[arg0.type][arg1FirstElem.type](arg0, arg1FirstElem, what);
}
- let arg0Dimensions = arg0.getDimensions(),
- arg1Dimensions = arg1.getDimensions();
+ // Logic:
+ // find the effective range (the one that is involved in the calculations)
+ // calculate it
+ // then fill the remaining rows and columns with N/A errors
- let arrayMaxRows = Math.max(arg0.getRowCount(), arg1.getRowCount()),
- arrayMaxCols = Math.max(arg0.getCountElementInRow(), arg1.getCountElementInRow());
- retArr = new cArray();
-
- // The logic for creating the final array when the argument sizes do not match:
- // If we have arrays consisting of a single row/column, we fill a copy of that array with these columns/rows (up to the maximum number of rows/columns).
- // Then we redefine dimensions based on the copies.
- // Next, we iterate over the missing columns (those that are less than maxCol) and fill the missing columns with #N/A errors (for correct calculations, as in normal conditions, an empty cell would return cEmpty).
- // We do the same for rows, but we fill them entirely since they are completely empty.
- // Then, we fill the final array with two loops, with its dimensions being maxRows and maxCols.
- // In MS returns the maximum RowCol in the dynamic array.
+ let arrayMaxRows = Math.max(arg0RowCount, arg1RowCount), arrayMaxCols = Math.max(arg0ColCount, arg1ColCount);
+ retArr = new cArray();
+ retArr.setRealArraySize(arrayMaxRows, arrayMaxCols);
- // check if we have single row/col in arg0
- if ((arg0Dimensions.row === 1 && arrayMaxRows > 1) || (arg0Dimensions.col === 1 && arrayMaxCols > 1)) {
- if (arg0Dimensions.row === 1) {
- let firstRow = arg0._getRow(0);
- for (let i = 1; i < arrayMaxRows; i++) {
- arg0Copy.pushRow(firstRow, 0);
- }
- } else if (arg0Dimensions.col === 1) {
- let firstCol = arg0._getCol(0);
- for (let i = 1; i < arrayMaxCols; i++) {
- arg0Copy.pushCol(firstCol, 0);
- }
- }
- }
+ // arg0RowCount, arg0ColCount, arg1RowCount, arg1ColCount
+ let usefulCol = Math.min(arg0ColCount, arg1ColCount),
+ usefulRow = Math.min(arg0RowCount, arg1RowCount),
+ arg0Dimensions = arg0.getDimensions(),
+ arg1Dimensions = arg1.getDimensions();
- // check arg0 col dimensions and fill missing positions with errors
- arg0Dimensions = arg0Copy.getDimensions();
- if (arg0Dimensions.col < arrayMaxCols) {
- // fill the cols with N/A
- let errArray = new Array(arg0Dimensions.row).fill([errNA]);
- for (let i = arg0Dimensions.col; i < arrayMaxCols; i++) {
- arg0Copy.pushCol(errArray, 0);
- }
- }
- // check arg0 row dimensions and fill missing positions with errors
- if (arg0Dimensions.row < arrayMaxRows) {
- // fill rows with N/A
- let errArray = new Array(arrayMaxCols).fill(errNA);
- for (let i = arg0Dimensions.row; i < arrayMaxRows; i++) {
- arg0Copy.pushRow([errArray], 0);
+ // if we have one of the element with single row|col, set the value to be obtained from this particular row or column
+ let fromArg0Row, fromArg1Row, fromArg0Col, fromArg1Col;
+ if (arg0Dimensions.row === 1 && arrayMaxRows > 1) {
+ // arg1.row more than arg0.row
+ usefulRow = arrayMaxRows;
+ fromArg0Row = 0;
+ }
+ if (arg1Dimensions.row === 1 && arrayMaxRows > 1) {
+ // arg0.row more than arg1.row
+ usefulRow = arrayMaxRows;
+ fromArg1Row = 0;
+ }
+ if (arg0Dimensions.col === 1 && arrayMaxCols > 1) {
+ // arg1.col more than arg0.col
+ usefulCol = arrayMaxCols;
+ fromArg0Col = 0;
+ }
+ if (arg1Dimensions.col === 1 && arrayMaxCols > 1) {
+ // arg0.col more than arg1.col
+ usefulCol = arrayMaxCols;
+ fromArg1Col = 0;
+ }
+
+ // fill the array
+ for (let iRow = 0; iRow < arrayMaxRows; iRow++, iRow < usefulRow ? retArr.addRow() : true) {
+ if (iRow >= usefulRow) {
+ // fill row with N/A and continue
+ let errRow = new Array(arrayMaxCols).fill(errNA);
+ retArr.pushRow([errRow], 0);
+ continue
}
- }
- // check if we have single row/col in arg1
- if ((arg1Dimensions.row === 1 && arrayMaxRows > 1) || (arg1Dimensions.col === 1 && arrayMaxCols > 1)) {
- if (arg1Dimensions.row === 1) {
- for (let i = 0; i < arrayMaxRows; i++) {
- arg1Copy.pushRow(arg1._getRow(0), 0);
- }
- } else if (arg1Dimensions.col === 1) {
- let firstCol = arg0._getCol(0);
- for (let i = 1; i < arrayMaxCols; i++) {
- arg0Copy.pushCol(firstCol, 0);
+ for (let iCol = 0; iCol < arrayMaxCols; iCol++) {
+ if (iCol >= usefulCol) {
+ // add N/A error and continue
+ retArr.addElement(errNA);
+ continue
}
- }
- }
- // check arg1 col dimensions and fill missing positions with errors
- arg1Dimensions = arg1Copy.getDimensions();
- if (arg1Dimensions.col < arrayMaxCols) {
- // fill cols with N/A
- let errArray = new Array(arg1Dimensions.row).fill([errNA]);
- for (let i = arg1Dimensions.col; i < arrayMaxCols; i++) {
- arg1Copy.pushCol(errArray, 0);
- }
- }
- // check arg1 row dimensions and fill missing positions with errors
- if (arg1Dimensions.row < arrayMaxRows) {
- // fill rows with N/A
- let errArray = new Array(arrayMaxCols).fill(errNA);
- for (let i = arg1Dimensions.row; i < arrayMaxRows; i++) {
- arg1Copy.pushRow([errArray], 0);
- }
- }
+ _arg0 = arg0.getElementRowCol(fromArg0Row !== undefined ? fromArg0Row : iRow, fromArg0Col !== undefined ? fromArg0Col : iCol, true);
+ _arg1 = arg1.getElementRowCol(fromArg1Row !== undefined ? fromArg1Row : iRow, fromArg1Col !== undefined ? fromArg1Col : iCol, true);
- // fill result array
- for (iRow = 0; iRow < arrayMaxRows; iRow++, iRow < arrayMaxRows ? retArr.addRow() : true) {
- for (iCol = 0; iCol < arrayMaxCols; iCol++) {
- _arg0 = arg0Copy.getElementRowCol(iRow, iCol);
- _arg1 = arg1Copy.getElementRowCol(iRow, iCol);
retArr.addElement(_func[_arg0.type][_arg1.type](_arg0, _arg1, what));
}
}
@@ -9201,8 +10636,12 @@ function parserFormula( formula, parent, _ws ) {
window['AscCommonExcel'].g_cCalcRecursion = g_cCalcRecursion;
window['AscCommonExcel'].g_ProcessShared = false;
window['AscCommonExcel'].cReturnFormulaType = cReturnFormulaType;
+ window['AscCommonExcel'].arrayIndexesType = arrayIndexesType;
window['AscCommonExcel'].bIsSupportArrayFormula = bIsSupportArrayFormula;
+ window['AscCommonExcel'].bIsSupportDynamicArrays = bIsSupportDynamicArrays;
+
+ window['AscCommonExcel'].aExcludeRecursiveFomulas = aExcludeRecursiveFomulas;
window['AscCommonExcel'].cNumber = cNumber;
window['AscCommonExcel'].cString = cString;
@@ -9238,6 +10677,7 @@ function parserFormula( formula, parent, _ws ) {
window['AscCommonExcel'].parserFormula = parserFormula;
window['AscCommonExcel'].ParseResult = ParseResult;
+ window['AscCommonExcel'].CalculateResult = CalculateResult;
window['AscCommonExcel'].parseNum = parseNum;
window['AscCommonExcel'].matching = matching;
@@ -9253,6 +10693,7 @@ function parserFormula( formula, parent, _ws ) {
window['AscCommonExcel'].convertAreaToArray = convertAreaToArray;
window['AscCommonExcel'].convertAreaToArrayRefs = convertAreaToArrayRefs;
window['AscCommonExcel'].getArrayHelper = getArrayHelper;
+ window['AscCommonExcel'].getMaxDate = getMaxDate;
window['AscCommonExcel'].importRangeLinksState = importRangeLinksState;
diff --git a/cell/model/FormulaObjects/statisticalFunctions.js b/cell/model/FormulaObjects/statisticalFunctions.js
index 924abb74ce..6d4aa0d5c4 100644
--- a/cell/model/FormulaObjects/statisticalFunctions.js
+++ b/cell/model/FormulaObjects/statisticalFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -3449,7 +3449,8 @@ function (window, undefined) {
if (fTarget <= this.maRange[this.mnCount - 1].X) {
var n = (fTarget - this.maRange[0].X) / this.mfStepSize;
var fInterpolate = Math.fmod(fTarget - this.maRange[0].X, this.mfStepSize);
- rForecast = this.maRange[n].Y;
+ // rForecast = this.maRange[n].Y;
+ rForecast = this.maRange[n] ? this.maRange[n].Y : 0;
if (fInterpolate >= this.cfMinABCResolution) {
var fInterpolateFactor = fInterpolate / this.mfStepSize;
@@ -4028,13 +4029,14 @@ function (window, undefined) {
cAVERAGEIF.prototype.argumentsMin = 2;
cAVERAGEIF.prototype.argumentsMax = 3;
cAVERAGEIF.prototype.arrayIndexes = {0: 1, 2: 1};
+ cAVERAGEIF.prototype.exactTypes = {0: 1, 2: 1};
cAVERAGEIF.prototype.argumentsType = [argType.reference, argType.any, argType.reference];
cAVERAGEIF.prototype.Calculate = function (arg) {
- var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : arg[0], _sum = 0, _count = 0, matchingInfo, ws;
+ let arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : arg[0], _sum = 0, _count = 0, matchingInfo, ws;
if ((cElementType.cell !== arg0.type && cElementType.cell3D !== arg0.type && cElementType.cellsRange !==
- arg0.type) ||
+ arg0.type && cElementType.cellsRange3D !== arg0.type) ||
(cElementType.cell !== arg2.type && cElementType.cell3D !== arg2.type && cElementType.cellsRange !==
- arg2.type)) {
+ arg2.type && cElementType.cellsRange3D !== arg2.type)) {
return new cError(cErrorType.wrong_value_type);
}
@@ -4050,17 +4052,17 @@ function (window, undefined) {
return new cError(cErrorType.wrong_value_type);
}
- var r = arg0.getRange();
- var r2 = arg2.getRange();
+ let r = arg0.getRange(), r2 = arg2.getRange();
+
ws = arg0.getWS();
matchingInfo = AscCommonExcel.matchingValue(arg1);
- if (cElementType.cellsRange === arg0.type) {
- arg0.foreach2(function (v, cell) {
+ if (cElementType.cellsRange === arg0.type || cElementType.cellsRange3D === arg0.type) {
+ arg0.foreach2(function (v, cell, row, col) {
if (matching(v, matchingInfo)) {
- var offset = cell.getOffset3(r.bbox.c1 + 1, r.bbox.r1 + 1);
+ let offset = new AscCommon.CellBase(row - r.bbox.r1, col - r.bbox.c1);
r2.setOffset(offset);
- var val;
+ let val;
ws._getCellNoEmpty(r2.bbox.r1, r2.bbox.c1, function (cell) {
val = checkTypeCell(cell);
});
@@ -4077,10 +4079,7 @@ function (window, undefined) {
})
} else {
if (matching(arg0.getValue(), matchingInfo)) {
- var val;
- ws._getCellNoEmpty(r.bbox.r1, r2.bbox.c1, function (cell) {
- val = checkTypeCell(cell);
- });
+ let val = arg2.getFirstElement ? arg2.getFirstElement() : arg2.getValue();
if (cElementType.number === val.type) {
_sum += val.getValue();
_count++;
@@ -5196,9 +5195,12 @@ function (window, undefined) {
arg1 = arg1.getElementRowCol(0, 0);
}
- arg1 = arg1.tocString();
- if (cElementType.string !== arg1.type) {
- return new cError(cErrorType.wrong_value_type);
+ if (arg1.type === cElementType.cell || arg1.type === cElementType.cell3D) {
+ arg1 = arg1.getValue();
+ }
+
+ if (arg1.type === cElementType.empty) {
+ arg1 = arg1.tocNumber();
}
argNextDimension = arg0.getDimensions();
@@ -6227,6 +6229,7 @@ function (window, undefined) {
cFORECAST_ETS.prototype.name = 'FORECAST.ETS';
cFORECAST_ETS.prototype.argumentsMin = 3;
cFORECAST_ETS.prototype.argumentsMax = 6;
+ cFORECAST_ETS.prototype.arrayIndexes = {1: 1, 2: 1};
cFORECAST_ETS.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cFORECAST_ETS.prototype.argumentsType = [argType.number, argType.reference, argType.reference, argType.number, argType.number, argType.number];
cFORECAST_ETS.prototype.Calculate = function (arg) {
@@ -6236,18 +6239,26 @@ function (window, undefined) {
[null, cElementType.array, cElementType.array]);
let argClone = oArguments.args;
+ if (!argClone[0]) {
+ return new cError(cErrorType.not_numeric);
+ }
+
+ if (argClone[0].type && argClone[0].type !== cElementType.number) {
+ argClone[0] = argClone[0].tocNumber();
+ }
+
argClone[3] = argClone[3] ? argClone[3].tocNumber() : new cNumber(1);
argClone[4] = argClone[4] ? argClone[4].tocNumber() : new cNumber(1);
argClone[5] = argClone[5] ? argClone[5].tocNumber() : new cNumber(1);
-
- argClone[0] = argClone[0].getMatrix && argClone[0].getMatrix();
-
let argError;
if (argError = this._checkErrorArg(argClone)) {
return argError;
}
+ /* if the first argument is not an array or range, then convert it to a standard two-dimensional array with one value */
+ argClone[0] = argClone[0].getMatrix ? argClone[0].getMatrix() : argClone[0].toArray();
+
let pTMat = argClone[0],
pMatY = argClone[1],
pMatX = argClone[2],
@@ -6255,6 +6266,9 @@ function (window, undefined) {
bDataCompletion = argClone[4].getValue(),
nAggregation = argClone[5].getValue();
+ if (pMatY.length === 0 || pMatX.length === 0) {
+ return new cError(cErrorType.division_by_zero);
+ }
if (nAggregation < 1 || nAggregation > 7) {
return new cError(cErrorType.not_numeric);
}
@@ -6303,36 +6317,49 @@ function (window, undefined) {
cFORECAST_ETS_CONFINT.prototype.name = 'FORECAST.ETS.CONFINT';
cFORECAST_ETS_CONFINT.prototype.argumentsMin = 3;
cFORECAST_ETS_CONFINT.prototype.argumentsMax = 7;
+ cFORECAST_ETS_CONFINT.prototype.arrayIndexes = {1: 1, 2: 1};
cFORECAST_ETS_CONFINT.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cFORECAST_ETS_CONFINT.prototype.argumentsType = [argType.number, argType.reference, argType.reference, argType.number, argType.number,
argType.number, argType.number];
cFORECAST_ETS_CONFINT.prototype.Calculate = function (arg) {
-
//результаты данной фукнции соответсвуют результатам LO, но отличаются от MS!!!
- var oArguments = this._prepareArguments(arg, arguments[1], true,
+
+ let oArguments = this._prepareArguments(arg, arguments[1], true,
[null, cElementType.array, cElementType.array]);
- var argClone = oArguments.args;
+ let argClone = oArguments.args;
+
+ if (!argClone[0]) {
+ return new cError(cErrorType.not_numeric);
+ }
+
+ if (argClone[0].type && argClone[0].type !== cElementType.number) {
+ argClone[0] = argClone[0].tocNumber();
+ }
argClone[3] = argClone[3] ? argClone[3].tocNumber() : new cNumber(0.95);
argClone[4] = argClone[4] ? argClone[4].tocNumber() : new cNumber(1);
argClone[5] = argClone[5] ? argClone[5].tocNumber() : new cNumber(1);
argClone[6] = argClone[6] ? argClone[6].tocNumber() : new cNumber(1);
-
- argClone[0] = argClone[0].getMatrix();
-
- var argError;
+ let argError;
if (argError = this._checkErrorArg(argClone)) {
return argError;
}
- var pTMat = argClone[0];
- var pMatY = argClone[1];
- var pMatX = argClone[2];
- var fPILevel = argClone[3].getValue();
- var nSmplInPrd = argClone[4].getValue();
- var bDataCompletion = argClone[5].getValue();
- var nAggregation = argClone[6].getValue();
+ /* if the first argument is not an array or range, then convert it to a standard two-dimensional array with one value */
+ argClone[0] = argClone[0].getMatrix ? argClone[0].getMatrix() : argClone[0].toArray();
+
+ let pTMat = argClone[0],
+ pMatY = argClone[1],
+ pMatX = argClone[2],
+ fPILevel = argClone[3].getValue(),
+ nSmplInPrd = argClone[4].getValue(),
+ bDataCompletion = argClone[5].getValue(),
+ nAggregation = argClone[6].getValue();
+
+ if (pMatY.length === 0 || pMatX.length === 0) {
+ return new cError(cErrorType.division_by_zero);
+ }
if (fPILevel < 0 || fPILevel > 1) {
return new cError(cErrorType.not_numeric);
@@ -6344,8 +6371,8 @@ function (window, undefined) {
return new cError(cErrorType.not_numeric);
}
- var aETSCalc = new ScETSForecastCalculation(pMatX.length);
- var isError = aETSCalc.PreprocessDataRange(pMatX, pMatY, nSmplInPrd, bDataCompletion, nAggregation, pTMat);
+ let aETSCalc = new ScETSForecastCalculation(pMatX.length);
+ let isError = aETSCalc.PreprocessDataRange(pMatX, pMatY, nSmplInPrd, bDataCompletion, nAggregation, pTMat);
if (!isError) {
///*,( eETSType != etsStatAdd && eETSType != etsStatMult ? pTMat : nullptr ),eETSType )
return new cError(cErrorType.wrong_value_type);
@@ -6356,7 +6383,7 @@ function (window, undefined) {
/*SCSIZE nC, nR;
pTMat->GetDimensions( nC, nR );
ScMatrixRef pPIMat = GetNewMat( nC, nR );*/
- var pPIMat = null;
+ let pPIMat = null;
if (nSmplInPrd === 0) {
pPIMat = aETSCalc.GetEDSPredictionIntervals(pTMat, fPILevel);
} else {
diff --git a/cell/model/FormulaObjects/textanddataFunctions.js b/cell/model/FormulaObjects/textanddataFunctions.js
index 7b5c32cc53..0ea192de5b 100644
--- a/cell/model/FormulaObjects/textanddataFunctions.js
+++ b/cell/model/FormulaObjects/textanddataFunctions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -189,7 +189,7 @@ function (window, undefined) {
cARRAYTOTEXT.prototype.isXLFN = true;
cARRAYTOTEXT.prototype.argumentsMin = 1;
cARRAYTOTEXT.prototype.argumentsMax = 2;
- cARRAYTOTEXT.prototype.arrayIndexes = {0: 1, 1: 1};
+ cARRAYTOTEXT.prototype.arrayIndexes = {0: 1};
cARRAYTOTEXT.prototype.argumentsType = [argType.reference, argType.number];
cARRAYTOTEXT.prototype.Calculate = function (arg) {
function arrayToTextGeneral(args, isRange) {
@@ -890,7 +890,7 @@ function (window, undefined) {
cFIND.prototype.argumentsMax = 3;
cFIND.prototype.argumentsType = [argType.text, argType.text, argType.number];
cFIND.prototype.Calculate = function (arg) {
- var arg0 = arg[0], arg1 = arg[1], arg2 = arg.length === 3 ? arg[2] : null, res, str, searchStr,
+ let arg0 = arg[0], arg1 = arg[1], arg2 = arg.length === 3 ? arg[2] : null, res, str, searchStr,
pos = -1;
if (arg0.type === cElementType.cellsRange || arg0.type === cElementType.cellsRange3D) {
@@ -938,7 +938,10 @@ function (window, undefined) {
}
str = arg1.toLocaleString();
- searchStr = RegExp.escape(arg0.toLocaleString());
+ // searchStr = RegExp.escape(arg0.toLocaleString()); // doesn't work with strings like """ String""" , it's return ""\ String"" instead "" String""
+ //TODO need review. bugs 50869; 68343
+ searchStr = arg0.toLocaleString().replace(/\"\"/g, "\"");
+ searchStr = RegExp.escape(searchStr);
if (arg2) {
diff --git a/cell/model/FormulaObjects/traceDependents.js b/cell/model/FormulaObjects/traceDependents.js
index 79a5a06a1c..f62f67b5a4 100644
--- a/cell/model/FormulaObjects/traceDependents.js
+++ b/cell/model/FormulaObjects/traceDependents.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -72,6 +72,8 @@ function (window, undefined) {
// isCalculated: null
// }
};
+ this.aPassedPrecedents = null;
+ this.aPassedDependents = null;
this._lockChangeDocument = null;
}
@@ -296,11 +298,13 @@ function (window, undefined) {
for (let i in allDefNamesListeners) {
if (allDefNamesListeners.hasOwnProperty(i) && i.toLowerCase() === defName.toLowerCase()) {
for (let listener in allDefNamesListeners[i].listeners) {
- // TODO возможно стоить добавить все слушатели сразу в curListener
+ // TODO maybe add all listeners in 'curListener' at once
+ // listener can be: cell, range, table, named range - there will be unique processing for each case
let elem = allDefNamesListeners[i].listeners[listener];
let isArea = elem.ref ? true : false;
let is3D = elem.ws.Id ? elem.ws.Id !== ws.Id : false;
let isIntersect;
+
if (isArea && !is3D && !isCurrentCellHeader) {
if (defNameRange) {
let defBBox = defNameRange.getBBox0();
@@ -311,6 +315,7 @@ function (window, undefined) {
isIntersect = elem.ref.contains(cellAddress.col - colShift, cellAddress.row - rowShift);
}
+
if (isIntersect) {
// decompose all elements into dependencies
let areaIndexes = getAllAreaIndexes(elem);
@@ -321,9 +326,9 @@ function (window, undefined) {
t._setPrecedents(areaIndexes[index], cellIndex);
}
}
- continue;
}
}
+ continue;
}
let parentCellIndex = getParentIndex(elem.parent);
@@ -342,7 +347,6 @@ function (window, undefined) {
} else {
continue;
}
- // continue;
} else if (!elem.Formula.includes("Headers") && isCurrentCellHeader) {
continue;
}
@@ -372,9 +376,9 @@ function (window, undefined) {
setSharedTableIntersection(ws.getTableByName(defName).getRangeWithoutHeaderFooter(), currentCellRange, elem.shared);
continue;
}
- t._setDependents(cellIndex, parentCellIndex);
- t._setPrecedents(parentCellIndex, cellIndex);
}
+ t._setDependents(cellIndex, parentCellIndex);
+ t._setPrecedents(parentCellIndex, cellIndex);
}
}
}
@@ -384,9 +388,9 @@ function (window, undefined) {
if (!range) {
return;
}
- for (let i = range.c1; i <= range.c2; i++) {
- for (let j = range.r1; j <= range.r2; j++) {
- let index = AscCommonExcel.getCellIndex(j, i);
+ for (let c = range.c1; c <= range.c2; c++) {
+ for (let r = range.r1; r <= range.r2; r++) {
+ let index = AscCommonExcel.getCellIndex(r, c);
indexes.push(index);
}
}
@@ -513,6 +517,7 @@ function (window, undefined) {
if (!this.dependents[cellIndex]) {
// if dependents by cellIndex didn't exist, create it
this.dependents[cellIndex] = {};
+ let parentCellIndex = null;
for (let i in cellListeners) {
if (cellListeners.hasOwnProperty(i)) {
let parent = cellListeners[i].parent;
@@ -564,7 +569,7 @@ function (window, undefined) {
}
}
- let parentCellIndex = getParentIndex(parent);
+ parentCellIndex = getParentIndex(parent);
if (parentCellIndex === null) {
//if (parentCellIndex === null || (typeof(parentCellIndex) === "number" && isNaN(parentCellIndex))) {
continue;
@@ -573,7 +578,7 @@ function (window, undefined) {
this._setPrecedents(parentCellIndex, cellIndex, true);
}
}
- if (Object.keys(this.dependents[cellIndex]).length === 0) {
+ if (Object.keys(this.dependents[cellIndex]).length === 0 && cellIndex !== parentCellIndex) {
delete this.dependents[cellIndex];
this.ws.workbook.handlers.trigger("asc_onError", c_oAscError.ID.TraceDependentsNoFormulas, c_oAscError.Level.NoCritical);
}
@@ -581,9 +586,16 @@ function (window, undefined) {
if (this.checkCircularReference(cellIndex, true)) {
return;
}
+ if (this.checkPassedDependents(cellIndex)) {
+ return;
+ }
// if dependents by cellIndex aldready exist, check current tree
let currentIndex = Object.keys(this.dependents[cellIndex])[0];
let isUpdated = false;
+ let bCellHasNotTrace = false;
+ if (Object.keys(this.dependents[cellIndex]).length === 0) {
+ bCellHasNotTrace = true;
+ }
for (let i in cellListeners) {
if (cellListeners.hasOwnProperty(i)) {
let parent = cellListeners[i].parent;
@@ -611,7 +623,7 @@ function (window, undefined) {
}
// if the child cell does not yet have a dependency with listeners, create it
- if (!this._getDependents(cellIndex, elemCellIndex)) {
+ if (!this._getDependents(cellIndex, elemCellIndex) && cellIndex !== elemCellIndex) {
this._setDependents(cellIndex, elemCellIndex);
this._setPrecedents(elemCellIndex, cellIndex, true);
isUpdated = true;
@@ -620,11 +632,18 @@ function (window, undefined) {
}
if (!isUpdated) {
+ this.setPassedDependents(cellIndex);
for (let i in this.dependents[cellIndex]) {
if (this.dependents[cellIndex].hasOwnProperty(i)) {
- this._calculateDependents(i, curListener, true);
+ this._calculateDependents(+i, curListener, true);
}
}
+ if (!isSecondCall) {
+ this.clearPassedDependents();
+ }
+ }
+ if (Object.keys(this.dependents[cellIndex]).length === 0 && bCellHasNotTrace) {
+ this.ws.workbook.handlers.trigger("asc_onError", c_oAscError.ID.TraceDependentsNoFormulas, c_oAscError.Level.NoCritical);
}
}
} else if (!isSecondCall) {
@@ -641,6 +660,9 @@ function (window, undefined) {
if (!this.dependents[from]) {
this.dependents[from] = {};
}
+ if (from === to) {
+ return;
+ }
this.dependents[from][to] = 1;
};
TraceDependentsManager.prototype._setDefaultData = function () {
@@ -701,9 +723,9 @@ function (window, undefined) {
}
let area = areas[areaName];
- for (let i = area.range.r1; i <= area.range.r2; i++) {
- for (let j = area.range.c1; j <= area.range.c2; j++) {
- let index = AscCommonExcel.getCellIndex(i, j);
+ for (let r = area.range.r1; r <= area.range.r2; r++) {
+ for (let c = area.range.c1; c <= area.range.c2; c++) {
+ let index = AscCommonExcel.getCellIndex(r, c);
indexes.push(index);
}
}
@@ -907,7 +929,11 @@ function (window, undefined) {
let currentCellIndex = AscCommonExcel.getCellIndex(row, col);
let formulaInfoObject = this.checkUnrecordedAndFormNewStack(currentCellIndex, formulaParsed), isHaveUnrecorded,
newOutStack;
+ let bCellHasNotTrace = false;
+ if (this.precedents[currentCellIndex] && Object.keys(this.precedents[currentCellIndex]).length === 0) {
+ bCellHasNotTrace = true;
+ }
if (formulaInfoObject) {
isHaveUnrecorded = formulaInfoObject.isHaveUnrecorded;
newOutStack = formulaInfoObject.newOutStack;
@@ -935,6 +961,8 @@ function (window, undefined) {
isArea = elemType === cElementType.cellsRange || elemType === cElementType.name,
isDefName = elemType === cElementType.name || elemType === cElementType.name3D,
isTable = elemType === cElementType.table, areaName;
+ let bPinCell = false;
+ let sValue = null;
if (elemType === cElementType.cell || is3D || isArea || isDefName || isTable) {
let cellRange = new asc_Range(col, row, col, row), elemRange, elemCellIndex;
@@ -954,6 +982,8 @@ function (window, undefined) {
} else if (elemRange.isOneCell()) {
isArea = false;
}
+ sValue = elemValue.value;
+ bPinCell = sValue.includes("$");
} else if (isTable) {
let currentWsId = elem.ws.Id,
elemWsId = elem.area.ws ? elem.area.ws.Id : elem.area.wsFrom.Id;
@@ -962,6 +992,8 @@ function (window, undefined) {
elemRange = elem.area.bbox ? elem.area.bbox : (elem.area.range ? elem.area.range.bbox : null);
isArea = ref ? true : !elemRange.isOneCell();
} else {
+ sValue = elem.value;
+ bPinCell = sValue.includes("$");
elemRange = elem.range.bbox ? elem.range.bbox : elem.bbox;
}
@@ -989,6 +1021,20 @@ function (window, undefined) {
}
}
}
+ } else if (bPinCell) {
+ const FIRST_INDEX_VALUE = 0;
+ let nIndex = sValue.indexOf("$");
+ if (nIndex === FIRST_INDEX_VALUE) {
+ sValue = sValue.slice(nIndex + 1);
+ let bStaticCell = sValue.includes("$");
+ if (bStaticCell) {
+ elemCellIndex = AscCommonExcel.getCellIndex(elemRange.r1, elemRange.c1);
+ } else {
+ elemCellIndex = AscCommonExcel.getCellIndex(elemRange.r1 + (row - base.nRow), elemRange.c1);
+ }
+ } else {
+ elemCellIndex = AscCommonExcel.getCellIndex(elemRange.r1, elemRange.c1 + (col - base.nCol));
+ }
} else {
elemCellIndex = AscCommonExcel.getCellIndex(elemRange.r1 + (row - base.nRow), elemRange.c1 + (col - base.nCol));
}
@@ -1060,7 +1106,11 @@ function (window, undefined) {
if (this.checkCircularReference(currentCellIndex, false)) {
return;
}
+ if (this.checkPassedPrecedents(currentCellIndex)) {
+ return;
+ }
this.setPrecedentsLoop(true);
+ this.setPassedPrecedents(currentCellIndex);
let isHavePrecedents = false;
// check first level, then if function return false, check second, third and so on
for (let i in this.precedents[currentCellIndex]) {
@@ -1074,6 +1124,12 @@ function (window, undefined) {
}
this.setPrecedentsLoop(false);
+ if (!isSecondCall) {
+ this.clearPassedPrecedents();
+ }
+ }
+ if (Object.keys(this.precedents[currentCellIndex]).length === 0 && bCellHasNotTrace) {
+ this.ws.workbook.handlers.trigger("asc_onError", c_oAscError.ID.TracePrecedentsNoValidReference, c_oAscError.Level.NoCritical);
}
};
TraceDependentsManager.prototype.checkUnrecordedAndFormNewStack = function (cellIndex, formulaParsed) {
@@ -1252,6 +1308,9 @@ function (window, undefined) {
if (!this.precedents[from]) {
this.precedents[from] = {};
}
+ if (from === to) {
+ return;
+ }
// TODO calculated: 1, not_calculated: 2
// TODO isAreaHeader: "A3:B4"
// this.precedents[from][to] = isDependent ? 2 : 1;
@@ -1357,9 +1416,17 @@ function (window, undefined) {
} else {
this._lockChangeDocument = null;
let t = this;
- if (arg2) {
- for (let col = arg2.c1; col <= arg2.c2; col++) {
- for (let row = arg2.r1; row <= arg2.r2; row++) {
+ if (t.isHaveData() && arg2) {
+ if (Asc.c_oAscSelectionType.RangeMax === arg2.getType()) {
+ t.clearAll();
+ break;
+ }
+
+ let maxRowToClear = t.ws.nRowsCount ? Math.min(t.ws.nRowsCount, arg2.r2) : arg2.r2,
+ maxColToClear = t.ws.nColsCount ? Math.min(t.ws.nColsCount, arg2.c2) : arg2.c2;
+
+ for (let col = arg2.c1; col <= maxColToClear; col++) {
+ for (let row = arg2.r1; row <= maxRowToClear; row++) {
if (!(arg2.c1 === col && arg2.r1 === row)) {
t.clearCellTraces(row, col);
}
@@ -1399,6 +1466,59 @@ function (window, undefined) {
}
}
};
+ /**
+ * Sets passed precedents cells index for recursive calls
+ * @memberof TraceDependentsManager
+ * @param {number} currentCellIndex
+ */
+ TraceDependentsManager.prototype.setPassedPrecedents = function (currentCellIndex) {
+ if (!this.aPassedPrecedents) {
+ this.aPassedPrecedents = [];
+ }
+ this.aPassedPrecedents.push(currentCellIndex);
+ };
+ /**
+ * Checks current cell index is already passed in recursive calls
+ * @memberof TraceDependentsManager
+ * @param {number} currentCellIndex
+ * @returns {boolean}
+ */
+ TraceDependentsManager.prototype.checkPassedPrecedents = function (currentCellIndex) {
+ return !!(this.aPassedPrecedents && this.aPassedPrecedents.includes(currentCellIndex));
+ };
+ /**
+ * Clears attribute of passed precedents
+ * @memberof TraceDependentsManager
+ */
+ TraceDependentsManager.prototype.clearPassedPrecedents = function () {
+ this.aPassedPrecedents = null;
+ };
+ /**
+ * Sets passed dependents cells index for recursive calls
+ * @memberof TraceDependentsManager
+ * @param {number} currentCellIndex
+ */
+ TraceDependentsManager.prototype.setPassedDependents = function (currentCellIndex) {
+ if (!this.aPassedDependents) {
+ this.aPassedDependents = [];
+ }
+ this.aPassedDependents.push(currentCellIndex);
+ };
+ /**
+ * Checks current cell index is already passed in recursive calls
+ * @memberof TraceDependentsManager
+ * @param {number} currentCellIndex
+ * @returns {boolean}
+ */
+ TraceDependentsManager.prototype.checkPassedDependents = function (currentCellIndex) {
+ return !!(this.aPassedDependents && this.aPassedDependents.includes(currentCellIndex));
+ };
+ /**
+ * Clears attribute of passed dependents
+ */
+ TraceDependentsManager.prototype.clearPassedDependents = function () {
+ this.aPassedDependents = null;
+ };
//------------------------------------------------------------export---------------------------------------------------
diff --git a/cell/model/HeaderFooter.js b/cell/model/HeaderFooter.js
index 1b148b112f..49c752865c 100644
--- a/cell/model/HeaderFooter.js
+++ b/cell/model/HeaderFooter.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/History.js b/cell/model/History.js
index 44de4bdaef..6d9b3f8cc2 100644
--- a/cell/model/History.js
+++ b/cell/model/History.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -53,6 +53,9 @@ function (window, undefined) {
window['AscCH'].historyitem_Workbook_Date1904 = 11;
window['AscCH'].historyitem_Workbook_ChangeExternalReference = 12;
window['AscCH'].historyitem_Workbook_TimelineCacheDelete = 13;
+ window['AscCH'].historyitem_Workbook_CalcPr_iterate = 14;
+ window['AscCH'].historyitem_Workbook_CalcPr_iterateCount = 15;
+ window['AscCH'].historyitem_Workbook_CalcPr_iterateDelta = 16;
window['AscCH'].historyitem_Worksheet_RemoveCell = 1;
window['AscCH'].historyitem_Worksheet_RemoveRows = 2;
@@ -76,6 +79,7 @@ function (window, undefined) {
window['AscCH'].historyitem_Worksheet_SetTabColor = 27;
window['AscCH'].historyitem_Worksheet_RowHide = 28;
// Frozen cell
+ window['AscCH'].historyitem_Worksheet_SetRightToLeft = 29;
window['AscCH'].historyitem_Worksheet_ChangeFrozenCell = 30;
window['AscCH'].historyitem_Worksheet_SetDisplayGridlines = 31;
window['AscCH'].historyitem_Worksheet_SetDisplayHeadings = 32;
@@ -264,6 +268,8 @@ function (window, undefined) {
window['AscCH'].historyitem_PivotTable_FormatsRemoveField = 63;
window['AscCH'].historyitem_PivotTable_FormatsAddRowField = 64;
window['AscCH'].historyitem_PivotTable_FormatsAddColField = 65;
+ window['AscCH'].historyitem_PivotTable_SetGrandTotalCaption = 59;
+ window['AscCH'].historyitem_PivotTable_PivotFieldSetSubtotalCaption = 60;
window['AscCH'].historyitem_SharedFormula_ChangeFormula = 1;
window['AscCH'].historyitem_SharedFormula_ChangeShared = 2;
@@ -570,9 +576,13 @@ CHistory.prototype.RedoAdd = function(oRedoObjectParam, Class, Type, sheetid, ra
if(changedObject){
var fChangesClass = AscDFH.changesFactory[nChangesType];
if (fChangesClass){
+ let color = null;
+ if (AscCommon.CollaborativeEditing.isCollaboration())
+ color = new CDocumentColor(255, 255, 255);
+
var oChange = new fChangesClass(changedObject);
oChange.ReadFromBinary(Data.oBinaryReader);
- oChange.Load(new CDocumentColor(255, 255, 255));
+ oChange.Load(color);
}
}
}
diff --git a/cell/model/NamedSheetViews.js b/cell/model/NamedSheetViews.js
index 8ff94c802f..5d823a2fc8 100644
--- a/cell/model/NamedSheetViews.js
+++ b/cell/model/NamedSheetViews.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/PivotTables.js b/cell/model/PivotTables.js
index 695970be99..188bd5e4f5 100644
--- a/cell/model/PivotTables.js
+++ b/cell/model/PivotTables.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -2721,6 +2721,10 @@ function PivotTableChanged() {
this.style = false;
this.data = false;
}
+
+/**
+ * @constructor
+ */
function CT_pivotTableDefinition(setDefaults) {
//Attributes
this.name = null;
@@ -2798,6 +2802,7 @@ function CT_pivotTableDefinition(setDefaults) {
this.rowItems = null;
this.colFields = null;
this.colItems = null;
+ /**@type {CT_PageFields} */
this.pageFields = null;
/**@type {CT_DataFields} */
this.dataFields = null;
@@ -3843,7 +3848,7 @@ CT_pivotTableDefinition.prototype.fillAutoFiltersOptions = function (autoFilterO
var pivotFilter = this.getPivotFilter(index);
if (pivotFilter) {
filterObj.convertFromFilterColumn(pivotFilter.autoFilter.FilterColumns[0], false);
- } else if(values.some(function(elem) {return !elem.visible;})){
+ } else if(null !== pageFieldItem || values.some(function(elem) {return !elem.visible;})){
filterObj.type = Asc.c_oAscAutoFilterTypes.Filters;
}
var pivotDataFields = [this.getPivotFieldName(index)];
@@ -4258,6 +4263,9 @@ CT_pivotTableDefinition.prototype.asc_getColGrandTotals = function () {
CT_pivotTableDefinition.prototype.asc_getShowHeaders = function () {
return this.showHeaders;
};
+CT_pivotTableDefinition.prototype.asc_getGrandTotalCaption = function () {
+ return this.grandTotalCaption;
+};
CT_pivotTableDefinition.prototype.asc_getUseAutoFormatting = function () {
return this.useAutoFormatting;
};
@@ -4327,6 +4335,9 @@ CT_pivotTableDefinition.prototype.asc_select = function (api) {
CT_pivotTableDefinition.prototype.asc_getDataRef = function() {
return this.cacheDefinition && this.cacheDefinition.getDataRef() || '';
};
+CT_pivotTableDefinition.prototype.asc_getFieldIndexByName = function(name) {
+ return this.cacheDefinition && this.cacheDefinition.getFieldIndexByName(name);
+};
CT_pivotTableDefinition.prototype.getDataLocation = function() {
return this.cacheDefinition && this.cacheDefinition.getDataLocation();
};
@@ -5168,6 +5179,9 @@ CT_pivotTableDefinition.prototype.asc_set = function (api, newVal) {
if (null !== newVal.showHeaders) {
pivot.asc_setShowHeaders(newVal.showHeaders, true);
}
+ if (null !== newVal.grandTotalCaption) {
+ pivot.asc_setGrandTotalCaption(newVal.grandTotalCaption, true);
+ }
if (null !== newVal.compact) {
pivot.setCompact(newVal.compact, true);
}
@@ -5236,6 +5250,10 @@ CT_pivotTableDefinition.prototype.asc_setShowHeaders = function(newVal, addToHis
setTableProperty(this, this.showHeaders, newVal, addToHistory, AscCH.historyitem_PivotTable_SetShowHeaders, true);
this.showHeaders = newVal;
};
+CT_pivotTableDefinition.prototype.asc_setGrandTotalCaption = function(newVal, addToHistory) {
+ setTableProperty(this, this.grandTotalCaption, newVal, addToHistory, AscCH.historyitem_PivotTable_SetGrandTotalCaption, true);
+ this.grandTotalCaption = newVal;
+};
CT_pivotTableDefinition.prototype.asc_setCompact = function(newVal, addToHistory) {
setTableProperty(this, this.compact, newVal, addToHistory, AscCH.historyitem_PivotTable_SetCompact, true);
this.compact = newVal;
@@ -5582,7 +5600,10 @@ CT_pivotTableDefinition.prototype.asc_removeDataField = function(api, pivotIndex
pivot.removeDataFieldAndReIndex(pivotIndex, dataIndex, true);
});
};
-CT_pivotTableDefinition.prototype.asc_moveToPageField = function(api, pivotIndex, dataIndex) {
+// во всех методах asc_moveTo добавил ещё один параметр для выставления индекса в новом типе. потому что с интерфейса оно приходит как dataIndex.
+// и из-за этого есть баг, что поле всегда добавляется в конец списка и ещё один баг (например: при перемещии из поля values последнего поля в другой тип на первую позицию,
+// удаляется не то поле и получается 2 одинаковых поля). Данная правка решает эти проблемы, нужно только в интерфейсе внести правки.
+CT_pivotTableDefinition.prototype.asc_moveToPageField = function(api, pivotIndex, dataIndex, indexTo) {
if (st_VALUES === pivotIndex) {
return;
}
@@ -5596,10 +5617,10 @@ CT_pivotTableDefinition.prototype.asc_moveToPageField = function(api, pivotIndex
if (undefined === deleteIndex && undefined !== dataIndex) {
pivot.removeDataFieldAndReIndex(pivotIndex, dataIndex, true);
}
- pivot.addPageField(pivotIndex, undefined, true);
+ pivot.addPageField(pivotIndex, indexTo, true);
});
};
-CT_pivotTableDefinition.prototype.asc_moveToRowField = function(api, pivotIndex, dataIndex) {
+CT_pivotTableDefinition.prototype.asc_moveToRowField = function(api, pivotIndex, dataIndex, indexTo) {
var pivotField = this.asc_getPivotFields()[pivotIndex];
if (pivotField && !pivotField.dragToRow) {
//todo The field you are moving cannot be placed in thet PivotTable area
@@ -5618,11 +5639,11 @@ CT_pivotTableDefinition.prototype.asc_moveToRowField = function(api, pivotIndex,
if (undefined === deleteIndex && undefined !== dataIndex) {
pivot.removeDataFieldAndReIndex(pivotIndex, dataIndex, true);
}
- pivot.addRowField(pivotIndex, undefined, true);
+ pivot.addRowField(pivotIndex, indexTo, true);
}
});
};
-CT_pivotTableDefinition.prototype.asc_moveToColField = function(api, pivotIndex, dataIndex) {
+CT_pivotTableDefinition.prototype.asc_moveToColField = function(api, pivotIndex, dataIndex, indexTo) {
var pivotField = this.asc_getPivotFields()[pivotIndex];
if (pivotField && !pivotField.dragToCol) {
//todo The field you are moving cannot be placed in thet PivotTable area
@@ -5641,11 +5662,11 @@ CT_pivotTableDefinition.prototype.asc_moveToColField = function(api, pivotIndex,
if (undefined === deleteIndex && undefined !== dataIndex) {
pivot.removeDataFieldAndReIndex(pivotIndex, dataIndex, true);
}
- pivot.addColField(pivotIndex, undefined, true);
+ pivot.addColField(pivotIndex, indexTo, true);
}
});
};
-CT_pivotTableDefinition.prototype.asc_moveToDataField = function(api, pivotIndex, dataIndex) {
+CT_pivotTableDefinition.prototype.asc_moveToDataField = function(api, pivotIndex, dataIndex, indexTo) {
if (st_VALUES === pivotIndex) {
return;
}
@@ -5659,7 +5680,7 @@ CT_pivotTableDefinition.prototype.asc_moveToDataField = function(api, pivotIndex
if (undefined === deleteIndex && undefined !== dataIndex) {
pivot.removeDataFieldAndReIndex(pivotIndex, dataIndex, true);
}
- pivot.addDataFieldAndReIndex(pivotIndex, undefined, true);
+ pivot.addDataFieldAndReIndex(pivotIndex, indexTo, true);
pivot.addValuesField(true);
});
};
@@ -6602,19 +6623,47 @@ CT_pivotTableDefinition.prototype.asc_removeFilters = function(api) {
this.removeFiltersWithLock(api, flds, false);
}
};
+CT_pivotTableDefinition.prototype.asc_removePivotFilter = function (api, fld, opt_clearManualFilters, opt_clearLabelFilters, opt_clearValueFilters, confirmation) {
+ let flds = [];
+ let autoFilterObject = new Asc.AutoFiltersOptions();
+ this.fillAutoFiltersOptions(autoFilterObject, fld);
+ if (autoFilterObject.filter && autoFilterObject.filter.type !== Asc.c_oAscAutoFilterTypes.None) {
+ if (autoFilterObject.filter.type === Asc.c_oAscAutoFilterTypes.Filters) {
+ if (opt_clearManualFilters) {
+ flds.push(fld);
+ }
+ } else {
+ let pivotFilter = this.getPivotFilter(fld);
+ if (pivotFilter && pivotFilter.isValueFilter()) {
+ if (opt_clearValueFilters) {
+ flds.push(fld);
+ }
+ } else {
+ if (opt_clearLabelFilters) {
+ flds.push(fld);
+ }
+ }
+ }
+ }
+ this.removeFiltersWithLock(api, flds, confirmation);
+};
CT_pivotTableDefinition.prototype.removeFiltersWithLock = function(api, flds, confirmation) {
var t = this, changeRes;
- api._changePivotAndConnectedBySlicerWithLock(this, flds, function() {
+ let fldsWithFilter = flds.filter(function (fld) {
+ return t.hasFilter(fld);
+ });
+ if (0 === fldsWithFilter.length) {
+ return;
+ }
+ api._changePivotAndConnectedBySlicerWithLock(this, fldsWithFilter, function() {
History.Create_NewPoint();
History.StartTransaction();
api.wbModel.dependencyFormulas.lockRecal();
- for (var i = 0; i < flds.length; ++i) {
- if (t.hasFilter(flds[i])) {
- changeRes = t.removeFilterWithSlicer(api, flds[i], confirmation);
- if (c_oAscError.ID.No !== changeRes.error || c_oAscError.ID.No !== changeRes.warning) {
- break;
- }
+ for (var i = 0; i < fldsWithFilter.length; ++i) {
+ changeRes = t.removeFilterWithSlicer(api, fldsWithFilter[i], confirmation);
+ if (c_oAscError.ID.No !== changeRes.error || c_oAscError.ID.No !== changeRes.warning) {
+ break;
}
}
api.wbModel.dependencyFormulas.unlockRecal();
@@ -7766,10 +7815,10 @@ CT_pivotTableDefinition.prototype.getGetPivotParamsByActiveCell = function(activ
const rowItems = this.getRowItems();
const colItems = this.getColItems();
const dataFields = this.asc_getDataFields();
- const cacheFieds = this.asc_getCacheFields();
+ const cacheFileds = this.asc_getCacheFields();
const indexes = this.getItemsIndexesByActiveCell(row, col);
const dataIndex = Math.max(rowItems[indexes.rowItemIndex].i, colItems[indexes.colItemIndex].i);
- const dataFieldName = dataFields.length === 1 ? cacheFieds[dataFields[dataIndex].fld].asc_getName() : dataFields[dataIndex].asc_getName();
+ const dataFieldName = dataFields.length === 1 ? cacheFileds[dataFields[dataIndex].fld].asc_getName() : dataFields[dataIndex].asc_getName();
const itemMapArray = this.getNoFilterItemFieldsMapArray(indexes.rowItemIndex, indexes.colItemIndex);
if (!itemMapArray){
return null;
@@ -7782,7 +7831,7 @@ CT_pivotTableDefinition.prototype.getGetPivotParamsByActiveCell = function(activ
itemMapArray.forEach(function(item) {
const fieldIndex = item[0];
const fieldItemIndex = item[1];
- const cacheField = cacheFieds[fieldIndex];
+ const cacheField = cacheFileds[fieldIndex];
const result = t.getGetPivotParam(cacheField, fieldItemIndex);
resultOptParams.push(cacheField.asc_getName(), result.value);
resultOptParamsFormula.push('"' + cacheField.asc_getName() + '"', result.formulaValue);
@@ -8264,6 +8313,183 @@ CT_pivotTableDefinition.prototype.asc_canShowDetails = function(row, col) {
CT_pivotTableDefinition.prototype.getFormatting = function(query) {
return this.formatsManager.get(query);
};
+/**
+ * @param {string} itemString
+ * @return {number}
+ */
+CT_pivotTableDefinition.prototype.findFieldByItem = function(itemString) {
+ const cacheFields = this.asc_getCacheFields();
+ const pivotFields = this.asc_getPivotFields();
+ for (let i = 0; i < cacheFields.length; i += 1) {
+ const cacheField = cacheFields[i];
+ const pivotField = pivotFields[i];
+ if (pivotField.findFieldItemByTextValue(cacheField, itemString)) {
+ return i;
+ }
+ }
+ return null;
+};
+/**
+ * @param {string[]} items
+ * @return {GetPivotDataParams}
+ */
+CT_pivotTableDefinition.prototype.asc_getDataToGetPivotData = function(items) {
+ const getPivotDataParams = {
+ dataFieldName: null,
+ optParams: []
+ };
+ const optParamsMap = new Map();
+ const cacheFields = this.asc_getCacheFields();
+ for (let i = 0; i < items.length; i += 1) {
+ const reg = /^(\w+)\[(\w+)\]/;
+ const match = reg.exec(items[i]);
+ if (match !== null && match[1] && match[2]) {
+ const fieldIndex = this.getFieldIndexByValue(match[1]);
+ if (fieldIndex === null || optParamsMap.has(fieldIndex)) {
+ return null;
+ }
+ optParamsMap.set(fieldIndex, items[i]);
+ getPivotDataParams.optParams.push(cacheFields[fieldIndex].name, match[2]);
+ continue;
+ }
+ if (this.dataFields.getIndexByName(items[i]) !== -1 || this.findDataFieldByFldName(items[i]) !== -1) {
+ if (getPivotDataParams.dataFieldName !== null) {
+ return null;
+ }
+ getPivotDataParams.dataFieldName = items[i];
+ } else {
+ const fieldIndex = this.findFieldByItem(items[i]);
+ if (fieldIndex === null || optParamsMap.has(fieldIndex)) {
+ return null;
+ }
+ optParamsMap.set(fieldIndex, items[i]);
+ getPivotDataParams.optParams.push(cacheFields[fieldIndex].name, items[i]);
+ }
+ }
+ if (!getPivotDataParams.dataFieldName) {
+ const dataFields = this.asc_getDataFields();
+ if (dataFields.length > 1) {
+ return null;
+ }
+ getPivotDataParams.dataFieldName = dataFields[0] && dataFields[0].name;
+ }
+ return getPivotDataParams;
+};
+/**
+ * @return {Range}
+ */
+CT_pivotTableDefinition.prototype.asc_getRowRange = function() {
+ let res = null;
+ if (this.getRowFieldsCount()) {
+ const range = this.getRange();
+ const location = this.location;
+ const r1 = range.r1 + location.firstDataRow - 1;
+ const r2 = range.r2;
+ const c1 = range.c1;
+ const c2 = range.c1 + location.firstDataCol - 1;
+ res = this.worksheet.getRange3(r1, c1, r2, c2);
+ }
+ return res;
+};
+/**
+ * @return {Range}
+ */
+CT_pivotTableDefinition.prototype.asc_getColumnRange = function() {
+ let res = null;
+ if (this.getColumnFieldsCount()) {
+ const range = this.getRange();
+ const location = this.location;
+ const c1 = range.c1 + location.firstDataCol;
+ const c2 = range.c2;
+ const r1 = range.r1;
+ const r2 = range.r1 + location.firstDataRow - 1;
+ res = this.worksheet.getRange3(r1, c1, r2, c2)
+ }
+ return res;
+};
+/**
+ * @return {Range}
+ */
+CT_pivotTableDefinition.prototype.asc_getDataBodyRange = function() {
+ const range = this.getRange();
+ const location = this.location;
+ const r1 = range.r1 + location.firstDataRow;
+ const r2 = range.r2;
+ const c1 = range.c1 + location.firstDataCol;
+ const c2 = range.c2;
+ return this.worksheet.getRange3(r1, c1, r2, c2);
+};
+/**
+ * Return fieldIndex by Pivot Field name.
+ * @param {string} index
+ * @return {number}
+ */
+CT_pivotTableDefinition.prototype.getFieldIndexByValue = function(value) {
+ const pivotFields = this.asc_getPivotFields();
+ const cacheFields = this.asc_getCacheFields();
+ for (let i = 0; i < pivotFields.length; i += 1) {
+ const pivotField = pivotFields[i];
+ const cacheField = cacheFields[i];
+ const name = pivotField.name || cacheField.name;
+ if (value.toLowerCase() === name.toLowerCase()) {
+ return i;
+ }
+ }
+ return -1;
+};
+/**
+ * @param {c_oAscAxis} axis
+ * @return {CT_Field[] | CT_PageField[] | null}
+ */
+CT_pivotTableDefinition.prototype.getAxisFields = function(axis) {
+ if (axis != null) {
+ switch (axis) {
+ case c_oAscAxis.AxisCol:
+ return this.asc_getColumnFields();
+ case c_oAscAxis.AxisRow:
+ return this.asc_getRowFields();
+ case c_oAscAxis.AxisPage:
+ return this.asc_getPageFields();
+ default:
+ return null;
+ }
+ }
+ return null;
+};
+/**
+ * @param {spreadsheet_api} api
+ * @param {number} pivotIndex
+ * @param {c_oAscAxis} axis
+ * @param {number} position
+ * @return {boolean}
+ */
+CT_pivotTableDefinition.prototype.moveFieldInAxis = function(api, pivotIndex, axis, position) {
+ function getCurPos(fields) {
+ for (let i = 0; i < fields.length; i += 1) {
+ if (fields[i].asc_getIndex() === pivotIndex) {
+ return i;
+ }
+ }
+ }
+ const fields = this.getAxisFields(axis);
+ const curPos = getCurPos(fields);
+ if (fields[position] && curPos !== position) {
+ switch (axis) {
+ case c_oAscAxis.AxisCol:
+ this.asc_moveColField(api, curPos, position);
+ return true;
+ case c_oAscAxis.AxisRow:
+ this.asc_moveRowField(api, curPos, position);
+ return true;
+ case c_oAscAxis.AxisPage:
+ this.asc_movePageField(api, curPos, position);
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+};
/**
* @typedef PivotFormatsCollectionItem
@@ -12750,6 +12976,10 @@ CT_Tuples.prototype.toXml = function(writer, name) {
}
writer.WriteXmlNodeEnd(name);
};
+
+/**
+ * @constructor
+ */
function CT_PivotField(setDefaults) {
//Attributes
this.name = null;
@@ -13831,6 +14061,9 @@ CT_PivotField.prototype.asc_set = function (api, pivot, index, newVal) {
if (null !== newVal.ascNumFormat) {
field.setNumFormat(newVal.ascNumFormat, pivot, index, true);
}
+ if (null !== newVal.subtotalCaption) {
+ field.asc_setSubtotalCaption(newVal.subtotalCaption, pivot, index, true);
+ }
field.checkSubtotal();
});
}
@@ -13870,6 +14103,10 @@ CT_PivotField.prototype.asc_setSubtotalTop = function (newVal, pivot, index, add
setFieldProperty(pivot, index, this.subtotalTop, newVal, addToHistory, AscCH.historyitem_PivotTable_PivotFieldSetSubtotalTop, true);
this.subtotalTop = newVal;
};
+CT_PivotField.prototype.asc_setSubtotalCaption = function (newVal, pivot, index, addToHistory) {
+ setFieldProperty(pivot, index, this.subtotalCaption, newVal, addToHistory, AscCH.historyitem_PivotTable_PivotFieldSetSubtotalCaption, true);
+ this.subtotalCaption = newVal;
+};
CT_PivotField.prototype.asc_setShowAll = function (newVal, pivot, index, addToHistory) {
setFieldProperty(pivot, index, this.showAll, newVal, addToHistory, AscCH.historyitem_PivotTable_PivotFieldSetShowAll, true);
this.showAll = newVal;
@@ -14361,10 +14598,15 @@ CT_PageField.prototype.asc_getName = function () {
CT_PageField.prototype.asc_getIndex = function () {
return this.fld || 0;
};
+
+/**
+ * @constructor
+ */
function CT_DataField(setDefaults) {
//Attributes
this.name = null;
this.fld = null;
+ /** @type {c_oAscDataConsolidateFunction} */
this.subtotal = null;
this.showDataAs = null;
this.baseField = null;
@@ -14490,6 +14732,9 @@ CT_DataField.prototype.asc_getName = function () {
CT_DataField.prototype.asc_getIndex = function () {
return this.fld || 0;
};
+/**
+ * @return {c_oAscDataConsolidateFunction}
+ */
CT_DataField.prototype.asc_getSubtotal = function () {
return this.subtotal;
};
@@ -20199,8 +20444,10 @@ prot["asc_getPageOverThenDown"] = prot.asc_getPageOverThenDown;
prot["asc_getRowGrandTotals"] = prot.asc_getRowGrandTotals;
prot["asc_getColGrandTotals"] = prot.asc_getColGrandTotals;
prot["asc_getShowHeaders"] = prot.asc_getShowHeaders;
+prot["asc_getGrandTotalCaption"] = prot.asc_getGrandTotalCaption;
prot["asc_getUseAutoFormatting"] = prot.asc_getUseAutoFormatting;
prot["asc_getDataRef"] = prot.asc_getDataRef;
+prot["asc_getFieldIndexByName"] = prot.asc_getFieldIndexByName;
prot["asc_getTitle"] = prot.asc_getTitle;
prot["asc_getDescription"] = prot.asc_getDescription;
prot["asc_getStyleInfo"] = prot.asc_getStyleInfo;
@@ -20221,6 +20468,7 @@ prot["asc_setColGrandTotals"] = prot.asc_setColGrandTotals;
prot["asc_setPageOverThenDown"] = prot.asc_setPageOverThenDown;
prot["asc_setPageWrap"] = prot.asc_setPageWrap;
prot["asc_setShowHeaders"] = prot.asc_setShowHeaders;
+prot["asc_setGrandTotalCaption"] = prot.asc_setGrandTotalCaption;
prot["asc_setUseAutoFormatting"] = prot.asc_setUseAutoFormatting;
prot["asc_setCompact"] = prot.asc_setCompact;
prot["asc_setOutline"] = prot.asc_setOutline;
@@ -20253,6 +20501,12 @@ prot["asc_refresh"] = prot.asc_refresh;
prot["asc_getFieldGroupType"] = prot.asc_getFieldGroupType;
prot["asc_canExpandCollapseByActiveCell"] = prot.asc_canExpandCollapseByActiveCell;
prot["asc_setExpandCollapseByActiveCell"] = prot.asc_setExpandCollapseByActiveCell;
+prot["asc_getDataToGetPivotData"] = prot.asc_getDataToGetPivotData;
+prot["asc_getColumnRange"] = prot.asc_getColumnRange;
+prot["asc_getDataBodyRange"] = prot.asc_getDataBodyRange;
+prot["asc_getRowRange"] = prot.asc_getRowRange;
+prot["asc_removePivotFilter"] = prot.asc_removePivotFilter;
+
window["Asc"]["CT_PivotTableStyle"] = window['Asc'].CT_PivotTableStyle = CT_PivotTableStyle;
prot = CT_PivotTableStyle.prototype;
diff --git a/cell/model/Serialize.js b/cell/model/Serialize.js
index 0849e343af..00e6b6f196 100644
--- a/cell/model/Serialize.js
+++ b/cell/model/Serialize.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -275,7 +275,8 @@
FileSharing: 25,
ExternalLinksAutoRefresh: 26,
TimelineCaches: 27,
- TimelineCache: 28
+ TimelineCache: 28,
+ Metadata: 29
};
/** @enum */
var c_oSerWorkbookPrTypes =
@@ -431,7 +432,10 @@
Value: 3,
Formula: 4,
RefRowCol: 5,
- ValueText: 6
+ ValueText: 6,
+ ValueCache: 7,
+ CellMetadata: 8,
+ ValueMetadata: 9
};
/** @enum */
var c_oSerFormulaTypes =
@@ -949,7 +953,8 @@
Chart2: 10,
ObjectName: 11,
EditAs: 12,
- ClientData: 14
+ ClientData: 14,
+ pptxDrawingAlternative: 0x99
};
var c_oSer_DrawingClientDataType =
@@ -1070,7 +1075,13 @@
SheetDataRowCell: 14,
SheetDataRowCellRef: 15,
SheetDataRowCellType: 16,
- SheetDataRowCellValue: 17
+ SheetDataRowCellValue: 17,
+ AlternateUrls : 18,
+ AbsoluteUrl : 19,
+ RelativeUrl : 20,
+ ExternalAlternateUrlsDriveId : 21,
+ ExternalAlternateUrlsItemId : 22,
+ ValueMetadata : 23
};
var c_oSer_HeaderFooter = {
AlignWithMargins: 0,
@@ -1261,6 +1272,117 @@
TimelineStyleElementDxfId : 6
};
+
+ var c_oSer_Metadata =
+ {
+ MetadataTypes: 0,
+ MetadataStrings: 1,
+ MdxMetadata: 2,
+ CellMetadata: 3,
+ ValueMetadata: 4,
+ FutureMetadata: 5
+ };
+ var c_oSer_MetadataType =
+ {
+ MetadataType: 0,
+ Name: 1,
+ MinSupportedVersion: 2,
+ GhostRow: 3,
+ GhostCol: 4,
+ Edit: 5,
+ Delete: 6,
+ Copy: 7,
+ PasteAll: 8,
+ PasteFormulas: 9,
+ PasteValues: 10,
+ PasteFormats: 11,
+ PasteComments: 12,
+ PasteDataValidation: 13,
+ PasteBorders: 14,
+ PasteColWidths: 15,
+ PasteNumberFormats: 16,
+ Merge: 17,
+ SplitFirst: 18,
+ SplitAll: 19,
+ RowColShift: 30,
+ ClearAll: 21,
+ ClearFormats: 22,
+ ClearContents: 23,
+ ClearComments: 24,
+ Assign: 25,
+ Coerce: 26,
+ CellMeta: 27
+ };
+ var c_oSer_MetadataString =
+ {
+ MetadataString: 0
+
+ };
+ var c_oSer_MetadataBlock =
+ {
+ MetadataBlock: 0,
+ MetadataRecord: 1,
+ MetadataRecordType: 2,
+ MetadataRecordValue: 3
+ };
+ var c_oSer_FutureMetadataBlock =
+ {
+ Name: 0,
+ FutureMetadataBlock: 1,
+ RichValueBlock: 2,
+ DynamicArrayProperties: 3,
+ DynamicArray: 4,
+ CollapsedArray: 5
+ };
+ var c_oSer_MdxMetadata =
+ {
+ Mdx: 0,
+ NameIndex: 1,
+ FunctionTag: 2,
+ MdxTuple: 3,
+ MdxSet: 4,
+ MdxKPI: 5,
+ MdxMemeberProp: 6
+ };
+ var c_oSer_MetadataMdxTuple =
+ {
+ IndexCount: 0,
+ CultureCurrency: 1,
+ StringIndex: 2,
+ NumFmtIndex: 3,
+ BackColor: 4,
+ ForeColor: 5,
+ Italic: 6,
+ Underline: 7,
+ Strike: 8,
+ Bold: 9,
+ MetadataStringIndex: 10
+ };
+ var c_oSer_MetadataStringIndex =
+ {
+ StringIsSet: 0,
+ IndexValue: 1
+ };
+ var c_oSer_MetadataMdxSet =
+ {
+ Count: 0,
+ Index: 1,
+ SortOrder: 2,
+ MetadataStringIndex: 3
+ };
+ var c_oSer_MetadataMdxKPI =
+ {
+ NameIndex: 0,
+ Index: 1,
+ Property: 2
+ };
+ var c_oSer_MetadataMemberProperty =
+ {
+ NameIndex: 0,
+ Index: 1
+ };
+
+
/** @enum */
var EBorderStyle =
{
@@ -1843,6 +1965,13 @@
return res;
}
+ function checkMaxCellLength(text) {
+ if (text && text.length > Asc.c_oAscMaxCellOrCommentLength) {
+ text = text.slice(0, Asc.c_oAscMaxCellOrCommentLength);
+ }
+ return text;
+ }
+
//TODO копия кода из serialize2
function BinaryCustomsTableWriter(memory, CustomXmls)
{
@@ -3528,6 +3657,10 @@
this.bs.WriteItem(c_oSerWorkbookTypes.TimelineCaches, function () {oThis.WriteTimelineCaches(oThis.wb.timelineCaches);});
}
+ if (this.wb.metadata) {
+ this.bs.WriteItem(c_oSerWorkbookTypes.Metadata, function () {oThis.WriteMetadata(oThis.wb.metadata);});
+ }
+
};
this.WriteWorkbookPr = function()
{
@@ -3883,7 +4016,7 @@
if (externalReference.referenceData) {
if (externalReference.referenceData["fileKey"]) {
oThis.memory.WriteByte(c_oSerWorkbookTypes.ExternalFileId);
- var fileKey = externalReference.referenceData["fileKey"];
+ var fileKey = externalReference.referenceData["fileKey"] + "";
oThis.memory.WriteString2(encodeXmlPath(fileKey, true, true));
}
if (externalReference.referenceData["instanceId"]) {
@@ -3951,12 +4084,12 @@
var oThis = this;
if (null != definedName.Name) {
this.bs.WriteItem(c_oSer_ExternalLinkTypes.DefinedNameName, function() {
- oThis.memory.WriteString2(definedName.Name);
+ oThis.memory.WriteString3(definedName.Name);
});
}
if (null != definedName.RefersTo) {
this.bs.WriteItem(c_oSer_ExternalLinkTypes.DefinedNameRefersTo, function() {
- oThis.memory.WriteString2(definedName.RefersTo);
+ oThis.memory.WriteString3(definedName.RefersTo);
});
}
if (null != definedName.SheetId) {
@@ -4023,8 +4156,537 @@
oThis.memory.WriteByte(c_oSer_ExternalLinkTypes.SheetDataRowCellValue);
oThis.memory.WriteString2(cell.CellValue);
}
+ if (null != cell.vm) {
+ this.bs.WriteItem(c_oSer_ExternalLinkTypes.ValueMetadata, function () {
+ oThis.memory.WriteULong(cell.vm);
+ });
+ }
+ };
+
+
+ //****write metadata****
+ this.WriteMetadata = function (pMetadata) {
+ if (!pMetadata) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMetadata.metadataTypes) {
+ this.bs.WriteItem(c_oSer_Metadata.MetadataTypes, function () {
+ oThis.WriteMetadataTypes(pMetadata.metadataTypes);
+ });
+ }
+ if (pMetadata.metadataTypes) {
+ this.bs.WriteItem(c_oSer_Metadata.MetadataStrings, function () {
+ oThis.WriteMetadataStrings(pMetadata.metadataTypes);
+ });
+ }
+ if (pMetadata.mdxMetadata) {
+ this.bs.WriteItem(c_oSer_Metadata.MdxMetadata, function () {
+ oThis.WriteMdxMetadata(pMetadata.mdxMetadata);
+ });
+ }
+ if (pMetadata.cellMetadata) {
+ this.bs.WriteItem(c_oSer_Metadata.CellMetadata, function () {
+ oThis.WriteMetadataBlocks(pMetadata.cellMetadata);
+ });
+ }
+ if (pMetadata.valueMetadata) {
+ this.bs.WriteItem(c_oSer_Metadata.ValueMetadata, function () {
+ oThis.WriteMetadataBlocks(pMetadata.valueMetadata);
+ });
+ }
+ if (pMetadata.aFutureMetadata) {
+ for (let i = 0; i < pMetadata.aFutureMetadata.length; ++i) {
+ this.bs.WriteItem(c_oSer_Metadata.FutureMetadata, function () {
+ oThis.WriteFutureMetadata(pMetadata.aFutureMetadata[i]);
+ });
+ }
+ }
+ };
+ this.WriteMetadataTypes = function (pMetadataTypes) {
+ if (!pMetadataTypes) {
+ return;
+ }
+
+ var oThis = this;
+ for (let i = 0; i < pMetadataTypes.length; ++i) {
+ this.bs.WriteItem(c_oSer_MetadataType.MetadataType, function () {
+ oThis.WriteMetadataType(pMetadataTypes[i]);
+ });
+ }
};
+ this.WriteMetadataType = function (pMetadataType) {
+ if (!pMetadataType) {
+ return;
+ }
+ var oThis = this;
+ if (pMetadataType.name != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Name, function () {
+ oThis.memory.WriteString3(pMetadataType.name);
+ });
+ }
+ if (pMetadataType.minSupportedVersion != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.MinSupportedVersion, function () {
+ oThis.memory.WriteLong(pMetadataType.minSupportedVersion);
+ });
+ }
+ if (pMetadataType.ghostRow != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.GhostRow, function () {
+ oThis.memory.WriteBool(pMetadataType.ghostRow);
+ });
+ }
+ if (pMetadataType.ghostCol != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.GhostCol, function () {
+ oThis.memory.WriteBool(pMetadataType.ghostCol);
+ });
+ }
+ if (pMetadataType.edit != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Edit, function () {
+ oThis.memory.WriteBool(pMetadataType.edit);
+ });
+ }
+ if (pMetadataType.delete != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Delete, function () {
+ oThis.memory.WriteBool(pMetadataType.delete);
+ });
+ }
+ if (pMetadataType.copy != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Copy, function () {
+ oThis.memory.WriteBool(pMetadataType.copy);
+ });
+ }
+ if (pMetadataType.pasteAll != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteAll, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteAll);
+ });
+ }
+ if (pMetadataType.pasteFormulas != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteFormulas, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteFormulas);
+ });
+ }
+ if (pMetadataType.pasteValues != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteValues, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteValues);
+ });
+ }
+ if (pMetadataType.pasteFormats != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteFormats, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteFormats);
+ });
+ }
+ if (pMetadataType.pasteComments != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteComments, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteComments);
+ });
+ }
+ if (pMetadataType.pasteDataValidation != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteDataValidation, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteDataValidation);
+ });
+ }
+ if (pMetadataType.pasteBorders != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteBorders, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteBorders);
+ });
+ }
+ if (pMetadataType.pasteColWidths != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteColWidths, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteColWidths);
+ });
+ }
+ if (pMetadataType.pasteNumberFormats != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.PasteNumberFormats, function () {
+ oThis.memory.WriteBool(pMetadataType.pasteNumberFormats);
+ });
+ }
+ if (pMetadataType.merge != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Merge, function () {
+ oThis.memory.WriteBool(pMetadataType.merge);
+ });
+ }
+ if (pMetadataType.splitFirst != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.SplitFirst, function () {
+ oThis.memory.WriteBool(pMetadataType.splitFirst);
+ });
+ }
+ if (pMetadataType.SplitAll != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.SplitAll, function () {
+ oThis.memory.WriteBool(pMetadataType.splitAll);
+ });
+ }
+ if (pMetadataType.rowColShift != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.RowColShift, function () {
+ oThis.memory.WriteBool(pMetadataType.rowColShift);
+ });
+ }
+ if (pMetadataType.clearAll != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.ClearAll, function () {
+ oThis.memory.WriteBool(pMetadataType.clearAll);
+ });
+ }
+ if (pMetadataType.clearFormats != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.ClearFormats, function () {
+ oThis.memory.WriteBool(pMetadataType.clearFormats);
+ });
+ }
+ if (pMetadataType.clearContents != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.ClearContents, function () {
+ oThis.memory.WriteBool(pMetadataType.clearContents);
+ });
+ }
+ if (pMetadataType.clearComments != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.ClearComments, function () {
+ oThis.memory.WriteBool(pMetadataType.clearComments);
+ });
+ }
+ if (pMetadataType.assign != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Assign, function () {
+ oThis.memory.WriteBool(pMetadataType.assign);
+ });
+ }
+ if (pMetadataType.coerce != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.Coerce, function () {
+ oThis.memory.WriteBool(pMetadataType.coerce);
+ });
+ }
+ if (pMetadataType.cellMeta != null) {
+ this.bs.WriteItem(c_oSer_MetadataType.CellMeta, function () {
+ oThis.memory.WriteBool(pMetadataType.cellMeta);
+ });
+ }
+ };
+ this.WriteMetadataStrings = function (pMetadataStrings) {
+ if (!pMetadataStrings) {
+ return;
+ }
+
+ var oThis = this;
+ for (let i = 0; i < pMetadataStrings.length; ++i) {
+ if (pMetadataStrings[i] && pMetadataStrings[i].v) {
+ this.bs.WriteItem(c_oSer_MetadataString.MetadataString, function () {
+ oThis.memory.WriteString3(pMetadataStrings[i].v);
+ });
+ }
+ }
+ };
+ this.WriteMdxMetadata = function (pMdxMetadata) {
+ if (!pMdxMetadata) {
+ return;
+ }
+
+ var oThis = this;
+ for (let i = 0; i < pMdxMetadata.length; ++i) {
+ if (!pMdxMetadata[i]) {
+ continue;
+ }
+
+ this.bs.WriteItem(c_oSer_MdxMetadata.Mdx, function () {
+ oThis.WriteMdx(pMdxMetadata[i]);
+ });
+ }
+ };
+ this.WriteMdx = function (pMdx) {
+ if (!pMdx) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMdx.n != null) {
+ this.bs.WriteItem(c_oSer_MdxMetadata.NameIndex, function () {
+ oThis.memory.WriteLong(pMdx.n);
+ });
+ }
+ if (pMdx.f) {
+ this.bs.WriteItem(c_oSer_MdxMetadata.FunctionTag, function () {
+ oThis.memory.WriteByte(pMdx.f);
+ });
+ }
+ if (pMdx.mdxTuple) {
+ this.bs.WriteItem(c_oSer_MdxMetadata.MdxTuple, function () {
+ oThis.WriteMdxTuple(pMdx.mdxTuple);
+ });
+ }
+ if (pMdx.mdxSet) {
+ this.bs.WriteItem(c_oSer_MdxMetadata.MdxSet, function () {
+ oThis.WriteMdxSet(pMdx.mdxSet);
+ });
+ }
+ if (pMdx.mdxKPI) {
+ this.bs.WriteItem(c_oSer_MdxMetadata.MdxKPI, function () {
+ oThis.WriteMdxKPI(pMdx.mdxKPI);
+ });
+ }
+ if (pMdx.mdxMemeberProp) {
+ this.bs.WriteItem(c_oSer_MdxMetadata.MdxMemeberProp, function () {
+ oThis.WriteMdxMemeberProp(pMdx.mdxMemeberProp);
+ });
+ }
+ };
+ this.WriteMdxTuple = function (pMdxTuple) {
+ if (!pMdxTuple) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMdxTuple.c) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.IndexCount, function () {
+ oThis.memory.WriteLong(pMdxTuple.c);
+ });
+ }
+ if (pMdxTuple.ct) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.CultureCurrency, function () {
+ oThis.memory.WriteString3(pMdxTuple.ct);
+ });
+ }
+ if (pMdxTuple.si) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.StringIndex, function () {
+ oThis.memory.WriteLong(pMdxTuple.si);
+ });
+ }
+ if (pMdxTuple.fi) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.NumFmtIndex, function () {
+ oThis.memory.WriteLong(pMdxTuple.fi);
+ });
+ }
+ if (pMdxTuple.bc) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.BackColor, function () {
+ oThis.memory.WriteLong(pMdxTuple.bc);
+ });
+ }
+ if (pMdxTuple.fc) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.ForeColor, function () {
+ oThis.memory.WriteLong(pMdxTuple.fc);
+ });
+ }
+ if (pMdxTuple.i) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.Italic, function () {
+ oThis.memory.WriteLong(pMdxTuple.i);
+ });
+ }
+ if (pMdxTuple.b) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.Bold, function () {
+ oThis.memory.WriteBool(pMdxTuple.b);
+ });
+ }
+ if (pMdxTuple.u) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.Underline, function () {
+ oThis.memory.WriteBool(pMdxTuple.u);
+ });
+ }
+ if (pMdxTuple.st) {
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.Strike, function () {
+ oThis.memory.WriteBool(pMdxTuple.st);
+ });
+ }
+ if (pMdxTuple.metadataStringIndexes) {
+ for (let i = 0; i < pMdxTuple.metadataStringIndexes.length; ++i) {
+ if (!pMdxTuple.metadataStringIndexes[i]) {
+ continue;
+ }
+
+ this.bs.WriteItem(c_oSer_MetadataMdxTuple.MetadataStringIndex, function () {
+ oThis.WriteMetadataStringIndex(pMdxTuple.metadataStringIndexes[i]);
+ });
+ }
+ }
+ };
+ this.WriteMetadataStringIndex = function (pStringIndex) {
+ if (!pStringIndex) {
+ return;
+ }
+
+ var oThis = this;
+ if (pStringIndex.x) {
+ this.bs.WriteItem(c_oSer_MetadataStringIndex.IndexValue, function () {
+ oThis.memory.WriteLong(pStringIndex.x);
+ });
+ }
+ if (pStringIndex.s) {
+ this.bs.WriteItem(c_oSer_MetadataStringIndex.StringIsSet, function () {
+ oThis.memory.WriteLong(pStringIndex.s);
+ });
+ }
+ };
+ this.WriteMdxSet = function (pMdxSet) {
+ if (!pMdxSet) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMdxSet.c) {
+ this.bs.WriteItem(c_oSer_MetadataMdxSet.Count, function () {
+ oThis.memory.WriteLong(pMdxSet.c);
+ });
+ }
+ if (pMdxSet.ns) {
+ this.bs.WriteItem(c_oSer_MetadataMdxSet.Index, function () {
+ oThis.memory.WriteLong(pMdxSet.ns);
+ });
+ }
+ if (pMdxSet.o) {
+ this.bs.WriteItem(c_oSer_MetadataMdxSet.SortOrder, function () {
+ oThis.memory.WriteByte(pMdxSet.o);
+ });
+ }
+ if (pMdxSet.metadataStringIndexes) {
+ for (let i = 0; i < pMdxSet.metadataStringIndexes.length; ++i) {
+ if (!pMdxSet.metadataStringIndexes[i]) {
+ continue;
+ }
+
+ this.bs.WriteItem(c_oSer_MetadataMdxSet.MetadataStringIndex, function () {
+ oThis.WriteMetadataStringIndex(pMdxSet.metadataStringIndexes[i]);
+ });
+ }
+ }
+ };
+ this.WriteMdxKPI = function (pMdxKPI) {
+ if (!pMdxKPI) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMdxKPI.n) {
+ this.bs.WriteItem(c_oSer_MetadataMdxKPI.NameIndex, function () {
+ oThis.memory.WriteLong(pMdxKPI.n);
+ });
+ }
+ if (pMdxKPI.np) {
+ this.bs.WriteItem(c_oSer_MetadataMdxKPI.Index, function () {
+ oThis.memory.WriteLong(pMdxKPI.np);
+ });
+ }
+ if (pMdxKPI.p) {
+ this.bs.WriteItem(c_oSer_MetadataMdxKPI.Property, function () {
+ oThis.memory.WriteByte(pMdxKPI.p);
+ });
+
+ }
+ };
+ this.WriteMdxMemeberProp = function (pMdxMemeberProp) {
+ if (!pMdxMemeberProp) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMdxMemeberProp.n) {
+ this.bs.WriteItem(c_oSer_MetadataMemberProperty.NameIndex, function () {
+ oThis.memory.WriteLong(pMdxMemeberProp.n);
+ });
+ }
+ if (pMdxMemeberProp.np) {
+ this.bs.WriteItem(c_oSer_MetadataMemberProperty.Index, function () {
+ oThis.memory.WriteLong(pMdxMemeberProp.np);
+ });
+ }
+ };
+ this.WriteMetadataBlocks = function (aMetadataBlocks) {
+ if (!aMetadataBlocks) {
+ return;
+ }
+
+ var oThis = this;
+ for (let i = 0; i < aMetadataBlocks.length; ++i) {
+ if (!aMetadataBlocks[i]) {
+ continue;
+ }
+
+ this.bs.WriteItem(c_oSer_MetadataBlock.MetadataBlock, function () {
+ oThis.WriteMetadataBlock(aMetadataBlocks[i]);
+ });
+ }
+ };
+ this.WriteMetadataBlock = function (metadataBlock) {
+ if (!metadataBlock) {
+ return;
+ }
+
+ var oThis = this;
+ this.bs.WriteItem(c_oSer_MetadataBlock.MetadataRecord, function () {
+ oThis.WriteMetadataRecord(metadataBlock);
+ });
+ };
+ this.WriteMetadataRecord = function (pMetadataRecord) {
+ if (!pMetadataRecord) {
+ return;
+ }
+
+ var oThis = this;
+ if (pMetadataRecord.t) {
+ this.bs.WriteItem(c_oSer_MetadataBlock.MetadataRecordType, function () {
+ oThis.memory.WriteLong(pMetadataRecord.t);
+ });
+ }
+ if (pMetadataRecord.v) {
+ this.bs.WriteItem(c_oSer_MetadataBlock.MetadataRecordValue, function () {
+ oThis.memory.WriteLong(pMetadataRecord.v);
+ });
+ }
+ };
+ this.WriteFutureMetadataBlock = function (pFutureMetadataBlock) {
+ if (!pFutureMetadataBlock || !pFutureMetadataBlock.extLst) {
+ return;
+ }
+
+ var oThis = this;
+ for (let i = 0; i < pFutureMetadataBlock.extLst.length; ++i) {
+ if (!pFutureMetadataBlock.extLst[i]) {
+ continue;
+ }
+
+ if (pFutureMetadataBlock.extLst[i].dynamicArrayProperties) {
+
+ this.bs.WriteItem(c_oSer_FutureMetadataBlock.DynamicArrayProperties, function () {
+
+ if (pFutureMetadataBlock.extLst[i].dynamicArrayProperties.fDynamic) {
+ oThis.bs.WriteItem(c_oSer_FutureMetadataBlock.DynamicArray, function () {
+ oThis.memory.WriteBool(pFutureMetadataBlock.extLst[i].dynamicArrayProperties.fDynamic);
+ });
+
+ }
+ if (pFutureMetadataBlock.extLst[i].dynamicArrayProperties.fCollapsed) {
+ oThis.bs.WriteItem(c_oSer_FutureMetadataBlock.CollapsedArray, function () {
+ oThis.memory.WriteBool(pFutureMetadataBlock.extLst[i].dynamicArrayProperties.fCollapsed);
+ });
+ }
+ });
+ }
+
+ if ((pFutureMetadataBlock.extLst[i].richValueBlock) && (pFutureMetadataBlock.extLst[i].richValueBlock.i)) {
+ oThis.bs.WriteItem(c_oSer_FutureMetadataBlock.RichValueBlock, function () {
+ oThis.memory.WriteLong(pFutureMetadataBlock.extLst[i].richValueBlock.i);
+ });
+ }
+ }
+ };
+ this.WriteFutureMetadata = function (pFutureMetadata) {
+ if (!pFutureMetadata) {
+ return;
+ }
+
+ var oThis = this;
+ if (pFutureMetadata.name) {
+ oThis.bs.WriteItem(c_oSer_FutureMetadataBlock.Name, function () {
+ oThis.memory.WriteString3(pFutureMetadata.name);
+ });
+ }
+ if (pFutureMetadata.futureMetadataBlocks) {
+ for (let i = 0; i < pFutureMetadata.futureMetadataBlocks.length; ++i) {
+ if (!pFutureMetadata.futureMetadataBlocks[i]) {
+ continue;
+ }
+
+ this.bs.WriteItem(c_oSer_FutureMetadataBlock.FutureMetadataBlock, function () {
+ oThis.WriteFutureMetadataBlock(pFutureMetadata.futureMetadataBlocks[i]);
+ });
+ }
+ }
+ };
+
+
this.WriteComments = function(aComments) {
var t = this;
for (var i = 0; i < aComments.length; ++i) {
@@ -4772,6 +5434,8 @@
this.bs.WriteItem(c_oSer_SheetView.TopLeftCell, function(){oThis.memory.WriteString3(oSheetView.topLeftCell.getName());});
if (null !== oSheetView.view && !oThis.isCopyPaste)
this.bs.WriteItem(c_oSer_SheetView.View, function(){oThis.memory.WriteByte(oSheetView.view);});
+ if (null !== oSheetView.rightToLeft && !oThis.isCopyPaste)
+ this.bs.WriteItem(c_oSer_SheetView.RightToLeft, function(){oThis.memory.WriteBool(oSheetView.rightToLeft);});
};
this.WriteSheetViewPane = function (oPane) {
var oThis = this;
@@ -6337,7 +7001,7 @@
pptx_content_writer.BinaryFileWriter.ImportFromMemory(old);
}});
}
- if (this.wb.CustomProperties) {
+ if (this.wb.CustomProperties && this.wb.CustomProperties.hasProperties()) {
this.WriteTable(c_oSerTableTypes.CustomProperties, {Write: function(){
var old = new AscCommon.CMemory(true);
pptx_content_writer.BinaryFileWriter.ExportToMemory(old);
@@ -7233,7 +7897,7 @@
{
if(null == tempValue.text)
tempValue.text = "";
- tempValue.text += this.stream.GetString2LE(length);
+ tempValue.text = checkMaxCellLength(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
@@ -7256,7 +7920,7 @@
{
if(null == oRun.text)
oRun.text = "";
- oRun.text += this.stream.GetString2LE(length);
+ oRun.text = checkMaxCellLength(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
@@ -8150,6 +8814,13 @@
return oThis.ReadTimelineCaches(t, l, oThis.oWorkbook.timelineCaches);
});
}
+ /*else if (c_oSerWorkbookTypes.Metadata === type)
+ {
+ this.oWorkbook.metadata = new AscCommonExcel.CMetadata();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadata(t, l, oThis.oWorkbook.metadata);
+ });
+ }*/
else
res = c_oSerConstants.ReadUnknown;
return res;
@@ -8315,7 +8986,7 @@
}
return res;
- }
+ };
this.ReadTimelinePivotFilter = function (type, length, oTimelinePivotFilter) {
let res = c_oSerConstants.ReadOk;
@@ -8341,6 +9012,408 @@
return res;
};
+ //****metadata****
+ this.ReadMetadata = function (type, length, pMetadata) {
+ var oThis = this;
+ let res = c_oSerConstants.ReadOk;
+ if (c_oSer_Metadata.MetadataTypes === type) {
+ if (!pMetadata.metadataTypes) {
+ pMetadata.metadataTypes = [];
+ }
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataTypes(t, l, pMetadata.metadataTypes);
+ });
+ } else if (c_oSer_Metadata.MetadataStrings === type) {
+ if (!pMetadata.metadataStrings) {
+ pMetadata.metadataStrings = [];
+ }
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataStrings(t, l, pMetadata.metadataStrings);
+ });
+ } else if (c_oSer_Metadata.MdxMetadata === type) {
+ if (!pMetadata.mdxMetadata) {
+ pMetadata.mdxMetadata = [];
+ }
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMdxMetadata(t, l, pMetadata.mdxMetadata);
+ });
+ } else if (c_oSer_Metadata.CellMetadata === type) {
+ if (!pMetadata.cellMetadata) {
+ pMetadata.cellMetadata = [];
+ }
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataBlocks(t, l, pMetadata.cellMetadata);
+ });
+ } else if (c_oSer_Metadata.ValueMetadata === type) {
+ if (!pMetadata.valueMetadata) {
+ pMetadata.valueMetadata = [];
+ }
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataBlocks(t, l, pMetadata.valueMetadata);
+ });
+ } else if (c_oSer_Metadata.FutureMetadata === type) {
+ if (!pMetadata.aFutureMetadata) {
+ pMetadata.aFutureMetadata = [];
+ }
+ let pMetadataRecord = new AscCommonExcel.CFutureMetadata();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadFutureMetadata(t, l, pMetadataRecord);
+ });
+ pMetadata.aFutureMetadata.push(pMetadataRecord);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMetadataTypes = function (type, length, aMetadataTypes) {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataType.MetadataType === type) {
+ var metadataType = new AscCommonExcel.CMetadataType();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataType(t, l, metadataType);
+ });
+ aMetadataTypes.push(metadataType);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+
+ this.ReadMetadataType = function (type, length, pMetadataType) {
+ var res = c_oSerConstants.ReadOk;
+
+ if (c_oSer_MetadataType.Name === type) {
+ pMetadataType.name = this.stream.GetString2LE(length);
+ } else if (c_oSer_MetadataType.MinSupportedVersion === type) {
+ pMetadataType.minSupportedVersion = this.stream.GetULong();
+ } else if (c_oSer_MetadataType.GhostRow === type) {
+ pMetadataType.ghostRow = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.GhostCol === type) {
+ pMetadataType.ghostCol = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.Edit === type) {
+ pMetadataType.edit = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.Delete === type) {
+ pMetadataType.delete = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.Copy === type) {
+ pMetadataType.copy = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteAll === type) {
+ pMetadataType.pasteAll = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteFormulas === type) {
+ pMetadataType.pasteFormulas = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteValues === type) {
+ pMetadataType.pasteValues = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteFormats === type) {
+ pMetadataType.pasteFormats = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteComments === type) {
+ pMetadataType.pasteComments = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteDataValidation === type) {
+ pMetadataType.pasteDataValidation = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteBorders === type) {
+ pMetadataType.pasteBorders = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteColWidths === type) {
+ pMetadataType.pasteColWidths = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.PasteNumberFormats === type) {
+ pMetadataType.pasteNumberFormats = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.Merge === type) {
+ pMetadataType.merge = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.SplitFirst === type) {
+ pMetadataType.splitFirst = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.SplitAll === type) {
+ pMetadataType.splitAll = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.RowColShift === type) {
+ pMetadataType.rowColShift = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.ClearAll === type) {
+ pMetadataType.clearAll = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.ClearFormats === type) {
+ pMetadataType.clearFormats = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.ClearContents === type) {
+ pMetadataType.clearContents = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.ClearComments === type) {
+ pMetadataType.clearComments = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.Assign === type) {
+ pMetadataType.assign = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.Coerce === type) {
+ pMetadataType.coerce = this.stream.GetBool();
+ } else if (c_oSer_MetadataType.CellMeta === type) {
+ pMetadataType.cellMeta = this.stream.GetBool();
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMetadataStrings = function (type, length, aMetadataStrings) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataString.MetadataString === type) {
+ let pMetadataString = new AscCommonExcel.CMetadataString();
+ pMetadataString.v = this.stream.GetString2LE(length);
+ aMetadataStrings.push(pMetadataString);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMdxMetadata = function (type, length, aMdxMetadata) {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MdxMetadata.Mdx === type) {
+ let pMdx = new AscCommonExcel.CMdx();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMdx(t, l, pMdx);
+ });
+ aMdxMetadata.push(pMdx);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMdx = function (type, length, pMdx) {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MdxMetadata.NameIndex === type) {
+ pMdx.n = this.stream.GetULong();
+ } else if (c_oSer_MdxMetadata.FunctionTag === type) {
+ //pMdx.F.SetValueFromByte(this.stream.GetUChar());
+ pMdx.f = this.stream.GetUChar();
+ } else if (c_oSer_MdxMetadata.MdxTuple === type) {
+ //READ1_DEF(length, res, this.ReadMdxTuple, pMdx.MdxTuple.GetPovarer());
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMdx(t, l, pMdx.mdxTuple);
+ });
+ } else if (c_oSer_MdxMetadata.MdxSet === type) {
+ //READ1_DEF(length, res, this.ReadMdxSet, pMdx.MdxSet.GetPovarer());
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMdx(t, l, pMdx.mdxSet);
+ });
+ } else if (c_oSer_MdxMetadata.MdxKPI === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMdx(t, l, pMdx.mdxKPI);
+ });
+ } else if (c_oSer_MdxMetadata.MdxMemeberProp === type) {
+ //READ1_DEF(length, res, this.ReadMdxMemeberProp, pMdx.MdxMemeberProp.GetPovarer());
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMdx(t, l, pMdx.mdxMemeberProp);
+ });
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ //TODO CMetadataBlock -> CMetadataRecord array leto array???
+ this.ReadMetadataBlocks = function (type, length, aMetadataBlocks) {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataBlock.MetadataBlock === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataBlock(t, l, aMetadataBlocks);
+ });
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMetadataBlock = function (type, length, aMetadataBlocks) {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataBlock.MetadataRecord === type) {
+ let pMetadataRecord = new AscCommonExcel.CMetadataRecord();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataRecord(t, l, pMetadataRecord);
+ });
+ aMetadataBlocks.push(pMetadataRecord);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMetadataRecord = function (type, length, pMetadataRecord) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataBlock.MetadataRecordType === type) {
+ pMetadataRecord.t = this.stream.GetULong();
+ } else if (c_oSer_MetadataBlock.MetadataRecordValue === type) {
+ pMetadataRecord.v = this.stream.GetULong();
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadDynamicArrayProperties = function (type, length, pDynamicArrayProperties) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_FutureMetadataBlock.DynamicArray === type) {
+ pDynamicArrayProperties.fDynamic = this.stream.GetBool();
+ } else if (c_oSer_FutureMetadataBlock.CollapsedArray === type) {
+ pDynamicArrayProperties.fCollapsed = this.stream.GetBool();
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ }
+ this.ReadMetadataStringIndex = function (type, length, pStringIndex) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataStringIndex.StringIsSet === type) {
+ pStringIndex.s = this.stream.GetULong();
+ } else if (c_oSer_MetadataStringIndex.IndexValue === type) {
+ pStringIndex.x = this.stream.GetULong();
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ }
+ this.ReadMdxMemeberProp = function (type, length, pMdxMemeberProp) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataMemberProperty.NameIndex === type) {
+ pMdxMemeberProp.n = this.stream.GetULong();
+ } else if (c_oSer_MetadataMemberProperty.Index === type) {
+ pMdxMemeberProp.np = this.stream.GetULong();
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ }
+ this.ReadMdxKPI = function (type, length, pMetadataRecord) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataMdxKPI.NameIndex === type) {
+ pMetadataRecord.n = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxKPI.Index === type) {
+ pMetadataRecord.np = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxKPI.Property === type) {
+ //pMdxKPI.P.Init();
+ //pMdxKPI.P.SetValueFromByte(this.stream.GetUChar());
+ pMetadataRecord.op = this.stream.GetUChar();
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadMdxSet = function (type, length, pMdxSet)
+ {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataMdxSet.Count === type)
+ {
+ pMdxSet.c = this.stream.GetULong();
+ }
+ else if (c_oSer_MetadataMdxSet.Index === type)
+ {
+ pMdxSet.ns = this.stream.GetULong();
+ }
+ else if (c_oSer_MetadataMdxSet.SortOrder === type)
+ {
+ //pMdxSet.O.Init();
+ //pMdxSet.O.SetValueFromByte(this.stream.GetUChar());
+ pMdxSet.o = this.stream.GetUChar();
+ }
+ else if (c_oSer_MetadataMdxSet.MetadataStringIndex === type)
+ {
+ let pMetadataStringIndex = new AscCommonExcel.CMetadataStringIndex();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataStringIndex(t, l, pMetadataStringIndex);
+ });
+ pMdxSet.metadataStringIndexes.push(pMetadataStringIndex);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+ };
+ this.ReadMdxTuple = function (type, length, pMdxTuple) {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_MetadataMdxTuple.IndexCount === type) {
+ pMdxTuple.c = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxTuple.StringIndex === type) {
+ pMdxTuple.si = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxTuple.CultureCurrency === type) {
+ pMdxTuple.ct = this.stream.GetString2LE(length);
+ } else if (c_oSer_MetadataMdxTuple.NumFmtIndex === type) {
+ pMdxTuple.fi = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxTuple.BackColor === type) {
+ pMdxTuple.bc = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxTuple.ForeColor === type) {
+ pMdxTuple.fc = this.stream.GetULong();
+ } else if (c_oSer_MetadataMdxTuple.Italic === type) {
+ pMdxTuple.i = this.stream.GetBool();
+ } else if (c_oSer_MetadataMdxTuple.Bold === type) {
+ pMdxTuple.b = this.stream.GetBool();
+ } else if (c_oSer_MetadataMdxTuple.Underline === type) {
+ pMdxTuple.u = this.stream.GetBool();
+ } else if (c_oSer_MetadataMdxTuple.Strike === type) {
+ pMdxTuple.st = this.stream.GetBool();
+ } else if (c_oSer_MetadataMdxTuple.MetadataStringIndex === type) {
+ let pMetadataStringIndex = new AscCommonExcel.CMetadataStringIndex();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadMetadataStringIndex(t, l, pMetadataStringIndex);
+ });
+ pMdxTuple.metadataStringIndexes.push(pMetadataStringIndex);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+ };
+ this.ReadFutureMetadata = function (type, length, pCFutureMetadata)
+ {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+
+ if (c_oSer_FutureMetadataBlock.Name === type)
+ {
+ pCFutureMetadata.name = this.stream.GetString2LE(length);
+ }
+ else if (c_oSer_FutureMetadataBlock.FutureMetadataBlock === type)
+ {
+ if (!pCFutureMetadata.futureMetadataBlocks) {
+ pCFutureMetadata.futureMetadataBlocks = [];
+ }
+ let pFutureMetadataBlock = new AscCommonExcel.CFutureMetadataBlock();
+ if (!pFutureMetadataBlock.extLst) {
+ pFutureMetadataBlock.extLst = [];
+ }
+ let elemExtList = new AscCommonExcel.CMetadataBlockExt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadFutureMetadataBlock(t, l, elemExtList);
+ });
+ pFutureMetadataBlock.extLst.push(elemExtList);
+ pCFutureMetadata.futureMetadataBlocks.push(pFutureMetadataBlock);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+ };
+ this.ReadFutureMetadataBlock = function (type, length, pFutureMetadataBlock)
+ {
+ var oThis = this;
+ var res = c_oSerConstants.ReadOk;
+ if (c_oSer_FutureMetadataBlock.RichValueBlock === type)
+ {
+ /*let pExt = new Asc.COfficeArtExtension();
+ pExt.m_sUri = L"{3e2802c4-a4d2-4d8b-9148-e3be6c30e623}";
+ pExt.RichValueBlock.Init();
+ pExt.RichValueBlock.I = this.stream.GetULong();*/
+
+ let richValueBlock = new AscCommonExcel.CRichValueBlock();
+ richValueBlock.i = this.stream.GetULong();
+ pFutureMetadataBlock.richValueBlock = richValueBlock;
+ }
+ else if (c_oSer_FutureMetadataBlock.DynamicArrayProperties === type)
+ {
+
+ /*OOX.Drawing.COfficeArtExtension* pExt = new OOX.Drawing.COfficeArtExtension();
+ pExt.m_sUri = L"{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}";
+ pExt.DynamicArrayProperties.Init();
+
+ READ1_DEF(length, res, this.ReadDynamicArrayProperties, pExt.DynamicArrayProperties.GetPovarer());
+ pFutureMetadataBlock.ExtLst.m_arrExt.push_back(pExt);*/
+
+ let pExt = new AscCommonExcel.CDynamicArrayProperties();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadDynamicArrayProperties(t, l, pExt);
+ });
+ pFutureMetadataBlock.dynamicArrayProperties = pExt;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+ };
+
this.ReadWorkbookPr = function(type, length, WorkbookPr)
{
var res = c_oSerConstants.ReadOk;
@@ -9791,7 +10864,14 @@
} else {
oCell.setValueNumberInternal(val);
}
+ } /*else if (c_oSerCellTypes.CellMetadata === type)
+ {
+ oCell.cm = this.stream.GetULong();
}
+ else if (c_oSerCellTypes.ValueMetadata === type)
+ {
+ oCell.vm = this.stream.GetULong();
+ }*/
else
res = c_oSerConstants.ReadUnknown;
return res;
@@ -9913,6 +10993,24 @@
else if ( c_oSer_DrawingType.pptxDrawing == type )
{
oDrawing.graphicObject = this.ReadPptxDrawing();
+
+ if(oDrawing.graphicObject && !oDrawing.graphicObject.isSupported())
+ {
+ let nPos = this.bcr.stream.cur;
+ let type_ = this.bcr.stream.GetUChar();
+ let length_ = this.bcr.stream.GetULongLE();
+ this.bcr.stream.Seek2(nPos);
+ if(type_ === c_oSer_DrawingType.pptxDrawingAlternative)
+ {
+ res = oThis.bcr.Read1(length_, function(t,l){
+ if(t === c_oSer_DrawingType.pptxDrawingAlternative){
+ oDrawing.graphicObject = pptx_content_loader.ReadGraphicObject2(oThis.stream, oThis.curWorksheet, oThis.curWorksheet.getDrawingDocument());
+ return c_oSerConstants.ReadOk;
+ }
+ return c_oSerConstants.ReadUnknown;
+ });
+ }
+ }
}
else if( c_oSer_DrawingType.ClientData == type ) {
var oClientData = new AscFormat.CClientData();
@@ -10408,7 +11506,7 @@
} else if (c_oSer_SheetView.DefaultGridColor === type) {
this.stream.GetBool();
} else if (c_oSer_SheetView.RightToLeft === type) {
- this.stream.GetBool();
+ oSheetView.rightToLeft = this.stream.GetBool();
} else if (c_oSer_SheetView.ShowFormulas === type) {
oSheetView.showFormulas = this.stream.GetBool();
} else if (c_oSer_SheetView.ShowGridLines === type) {
@@ -11392,7 +12490,6 @@
case c_oSerTableTypes.CustomProperties:
this.stream.Seek2(mtiOffBits);
fileStream = this.stream.ToFileStream();
- wb.CustomProperties = new AscCommon.CCustomProperties();
wb.CustomProperties.fromStream(fileStream);
this.stream.FromFileStream(fileStream);
break;
@@ -12772,7 +13869,7 @@
InitOpenManager.prototype.ParseNum = function(oNum, oNumFmts, _useNumId) {
var oRes = new AscCommonExcel.Num();
var useNumId = false;
- if (null != oNum && null != oNum.f) {
+ if (null != oNum && oNum.f) {//Excel ignors empty format. bug 70667
oRes.f = oNum.f;
} else {
var sStandartNumFormat = AscCommonExcel.aStandartNumFormats[oNum.id];
@@ -13309,7 +14406,7 @@
this.newDefinedNames = [];
}
- CT_Workbook.prototype.fromXml = function (reader) {
+ CT_Workbook.prototype.fromXmlSimple = function (reader) {
if (!reader.ReadNextNode()) {
return;
}
diff --git a/cell/model/Slicer.js b/cell/model/Slicer.js
index 9bd5687690..f81eff9f97 100644
--- a/cell/model/Slicer.js
+++ b/cell/model/Slicer.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/UndoRedo.js b/cell/model/UndoRedo.js
index 2b1c7cd444..2ce36ef3cd 100644
--- a/cell/model/UndoRedo.js
+++ b/cell/model/UndoRedo.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -748,14 +748,15 @@ function (window, undefined) {
}
};
- function UndoRedoData_CellValueData(sFormula, oValue, formulaRef) {
+ function UndoRedoData_CellValueData(sFormula, oValue, formulaRef, bCa) {
this.formula = sFormula;
this.formulaRef = formulaRef;
this.value = oValue;
+ this.ca = bCa;
}
UndoRedoData_CellValueData.prototype.Properties = {
- formula: 0, value: 1, formulaRef: 2
+ formula: 0, value: 1, formulaRef: 2, ca: 3
};
UndoRedoData_CellValueData.prototype.isEqual = function (val) {
if (null == val) {
@@ -784,13 +785,12 @@ function (window, undefined) {
switch (nType) {
case this.Properties.formula:
return this.formula;
- break;
case this.Properties.value:
return this.value;
- break;
case this.Properties.formulaRef:
return this.formulaRef ? new UndoRedoData_BBox(this.formulaRef) : null;
- break;
+ case this.Properties.ca:
+ return this.ca;
}
return null;
};
@@ -805,6 +805,9 @@ function (window, undefined) {
case this.Properties.formulaRef:
this.formulaRef = value ? new Asc.Range(value.c1, value.r1, value.c2, value.r2) : null;
break;
+ case this.Properties.ca:
+ this.ca = value;
+ break;
}
};
@@ -2515,7 +2518,7 @@ function (window, undefined) {
wb.oApi.asc_RemoveTraceArrows(Asc.c_oAscRemoveArrowsType.all);
}
} else if (AscCH.historyitem_Workbook_Calculate === Type) {
- if (!bUndo) {
+ if (!bUndo && wb.bCollaborativeChanges) {
wb.calculate(Data.elem, nSheetId);
}
} else if (bUndo && AscCH.historyitem_Workbook_PivotWorksheetSource === Type) {
@@ -2564,6 +2567,15 @@ function (window, undefined) {
} else {
wb.onTimelineCacheDelete(Data.from.name);
}
+ } else if (AscCH.historyitem_Workbook_CalcPr_iterate === Type) {
+ wb.calcPr.setIterate(bUndo ? Data.from : Data.to);
+ AscCommonExcel.g_cCalcRecursion.initCalcProperties(wb.calcPr);
+ } else if (AscCH.historyitem_Workbook_CalcPr_iterateCount === Type) {
+ wb.calcPr.setIterateCount(bUndo ? Data.from : Data.to);
+ AscCommonExcel.g_cCalcRecursion.initCalcProperties(wb.calcPr);
+ } else if (AscCH.historyitem_Workbook_CalcPr_iterateDelta === Type) {
+ wb.calcPr.setIterateDelta(bUndo ? Data.from : Data.to);
+ AscCommonExcel.g_cCalcRecursion.initCalcProperties(wb.calcPr);
}
};
UndoRedoWorkbook.prototype.forwardTransformationIsAffect = function (Type) {
@@ -4110,6 +4122,9 @@ function (window, undefined) {
case AscCH.historyitem_PivotTable_SetShowHeaders:
pivotTable.asc_setShowHeaders(value);
break;
+ case AscCH.historyitem_PivotTable_SetGrandTotalCaption:
+ pivotTable.asc_setGrandTotalCaption(value);
+ break;
case AscCH.historyitem_PivotTable_SetCompact:
pivotTable.asc_setCompact(value);
break;
@@ -4365,6 +4380,9 @@ function (window, undefined) {
case AscCH.historyitem_PivotTable_PivotFieldSetSubtotalTop:
field.asc_setSubtotalTop(value, pivotTable, index);
break;
+ case AscCH.historyitem_PivotTable_PivotFieldSetSubtotalCaption:
+ field.asc_setSubtotalCaption(value, pivotTable, index);
+ break;
case AscCH.historyitem_PivotTable_PivotFieldSetShowAll:
field.asc_setShowAll(value, pivotTable, index);
break;
diff --git a/cell/model/Workbook.js b/cell/model/Workbook.js
index 622785159d..191b84b977 100644
--- a/cell/model/Workbook.js
+++ b/cell/model/Workbook.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -47,7 +47,6 @@
var g_oCellAddressUtils = AscCommon.g_oCellAddressUtils;
var CellAddress = AscCommon.CellAddress;
var isRealObject = AscCommon.isRealObject;
- var History = AscCommon.History;
var cBoolLocal = AscCommon.cBoolLocal;
var cErrorLocal = AscCommon.cErrorLocal;
var cErrorOrigin = AscCommon.cErrorOrigin;
@@ -563,7 +562,7 @@
this.parsedRef.setFormulaString(this.ref = eventData.assemble);
this.wb.dependencyFormulas.addToChangedDefName(this);
var newUndoName = this.getUndoDefName();
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_DefinedNamesChangeUndo,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_DefinedNamesChangeUndo,
null, null, new UndoRedoData_FromTo(oldUndoName, newUndoName), true);
}
}
@@ -600,6 +599,7 @@
this.volatileListeners = {};
this.defNameListeners = {};
this.tempGetByCells = [];
+ this.volatileArrays = {}; // contains all daf formulas on the sheet that could not be expanded (vm="1")
//set dirty
this.isInCalc = false;
this.changedCell = null;
@@ -813,6 +813,7 @@
if (this.volatileListeners) {
for (var listenerId in this.volatileListeners) {
listeners[listenerId] = this.volatileListeners[listenerId];
+ g_cCalcRecursion.findRecursionCell(this.volatileListeners[listenerId]);
}
}
if(tableNamesMap){
@@ -853,7 +854,7 @@
}
},
changeExternalLink: function(prepared) {
- var notifyData = {type: c_oNotifyType.ChangeExternalLink, data: prepared.data, preparedData: prepared.preparedData};
+ var notifyData = {type: c_oNotifyType.ChangeExternalLink, data: prepared.data, preparedData: prepared.preparedData, existedWs: prepared.existedWs};
for (var listenerId in prepared.listeners) {
prepared.listeners[listenerId].notify(notifyData);
}
@@ -1081,7 +1082,7 @@
} else {
res = this.addDefName(newUndoName.name, newUndoName.ref, newUndoName.sheetId, false, newUndoName.type, newUndoName.isXLNM);
}
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
if (res && oldUndoName) {
if (oldUndoName.name != newUndoName.name) {
this.buildDependency();
@@ -1098,7 +1099,7 @@
res.setUndoDefName(newUndoName);
}
}
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_DefinedNamesChange, null, null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_DefinedNamesChange, null, null,
new UndoRedoData_FromTo(oldUndoName, newUndoName));
if (!this.wb.bUndoChanges && !this.wb.bRedoChanges) {
@@ -1294,11 +1295,11 @@
var newUndoName = defName.getUndoDefName();
var ref = table.getRangeWithoutHeaderFooter();
newUndoName.ref = defName.ref.split('!')[0] + '!' + ref.getAbsName();
- History.TurnOff();
+ AscCommon.History.TurnOff();
this.editDefinesNames(oldUndoName, newUndoName);
var notifyData = {type: c_oNotifyType.ChangeDefName, from: oldUndoName, to: newUndoName};
this._broadcastDefName(defName.name, notifyData);
- History.TurnOn();
+ AscCommon.History.TurnOn();
this.addToChangedDefName(defName);
this.calcTree();
}
@@ -1309,9 +1310,9 @@
var oldUndoName = defName.getUndoDefName();
var newUndoName = defName.getUndoDefName();
newUndoName.name = newName;
- History.TurnOff();
+ AscCommon.History.TurnOff();
this.editDefinesNames(oldUndoName, newUndoName);
- History.TurnOn();
+ AscCommon.History.TurnOn();
}
},
delTableName: function(tableName, bConvertTableFormulaToRef) {
@@ -1341,6 +1342,25 @@
}
this.calcTree();
},
+ addToVolatileArrays: function(formula) {
+ if (!this.volatileArrays) {
+ this.volatileArrays = {};
+ }
+ let listenerId = formula.getListenerId();
+ this.volatileArrays[listenerId] = formula;
+ },
+ getVolatileArrays: function() {
+ if (!this.volatileArrays) {
+ return
+ }
+
+ return this.volatileArrays
+ },
+ endListeningVolatileArray: function(listenerId) {
+ if (listenerId) {
+ delete this.volatileArrays[listenerId];
+ }
+ },
//set dirty
addToChangedRange2: function(sheetId, bbox) {
if (!this.changedRange) {
@@ -1564,8 +1584,19 @@
this._broadcastRanges(notifyData);
}
this._broadcastCellsEnd();
-
- this._calculateDirty();
+ do {
+ this._calculateDirty();
+ if (g_cCalcRecursion.getIsEnabledRecursion()) {
+ g_cCalcRecursion.incIterStep();
+ }
+ } while (g_cCalcRecursion.needRecursiveCall());
+ g_cCalcRecursion.resetIterStep();
+ g_cCalcRecursion.setStartCellIndex(null);
+ g_cCalcRecursion.setGroupChangedCells(null);
+ g_cCalcRecursion.clearPrevIterResult();
+ g_cCalcRecursion.clearDiffBetweenIter();
+ this.changedCell = null;
+ this.changedRange = null;
this.updateSharedFormulas();
//copy cleanCellCache to prevent recursion in trigger("cleanCellCache")
var tmpCellCache = this.cleanCellCache;
@@ -1663,8 +1694,8 @@
var defName = this._delDefName(name, sheetId);
if (defName) {
if (null != historyType) {
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, historyType, null, null,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, historyType, null, null,
new UndoRedoData_FromTo(defName.getUndoDefName(), null));
}
@@ -1853,26 +1884,156 @@
this.tempGetByCells = [];
},
-
-
+ /**
+ * Method starts preparing for calculate cells with formula. Recognizes what cells need to calculate.
+ * @memberof DependencyGraph
+ * @private
+ */
_calculateDirty: function() {
- var t = this;
-
+ const t = this;
+ const aCycleCells = [];
let needUpdateCells = [];
-
- this._foreachChanged(function (cell) {
- if (cell && cell.isFormula()) {
- cell.setIsDirty(true);
+ this._foreachChanged(function (oCell) {
+ if (oCell && oCell.isFormula()) {
+ const oFormulaParsed = oCell.getFormulaParsed();
+ // Logic for iterative calculation
+ if (g_cCalcRecursion.getIsEnabledRecursion()) {
+ const nThisCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ const aRecursiveCells = g_cCalcRecursion.getRecursiveCells(oCell);
+
+ g_cCalcRecursion.updateStartCellIndex(aRecursiveCells);
+ if (!g_cCalcRecursion.getStartCellIndex()) {
+ oCell.initStartCellForIterCalc();
+ }
+ let oStartCellIndex = g_cCalcRecursion.getStartCellIndex();
+ if (oStartCellIndex) {
+ // Fill 0 value for empty cells with recursive formula.
+ if (oCell.getNumberValue() == null && (oCell.getValueText() == null || oCell.getValueText() === '#NUM!')) {
+ if (oCell.getType() !== CellValueType.Number) {
+ oCell.setTypeInternal(CellValueType.Number);
+ }
+ oCell.setValueNumberInternal(0);
+ }
+ // Check result of the formula is convergent
+ let nDiffBetweenIter = g_cCalcRecursion.getDiffBetweenIter(oCell);
+ if (!isNaN(nDiffBetweenIter) && nDiffBetweenIter < g_cCalcRecursion.getRelativeError()) {
+ g_cCalcRecursion.removeRecursionCell(oCell);
+ if (g_cCalcRecursion.getPrevIterResult(oCell) !== 0 && g_cCalcRecursion.getIterStep() === 2) {
+ oCell.setValueNumberInternal(g_cCalcRecursion.getPrevIterResult(oCell));
+ }
+ return;
+ } else {
+ // Check diff of linked cell
+ let bLinkCellConvergent = false;
+ oCell.changeLinkedCell(function (oLinkedCell) {
+ const nLinkedDiff = g_cCalcRecursion.getDiffBetweenIter(oLinkedCell);
+ if (!isNaN(nLinkedDiff) && nLinkedDiff < g_cCalcRecursion.getRelativeError()) {
+ bLinkCellConvergent = true;
+ }
+ }, false);
+ if (bLinkCellConvergent) {
+ g_cCalcRecursion.removeRecursionCell(oCell);
+ return;
+ }
+ }
+ // Save current value of cell as result of previous iteration
+ g_cCalcRecursion.setPrevIterResult(oCell);
+ // Fill the array with linked cells from the recursive formula
+ if (!aRecursiveCells.length && oStartCellIndex.cellId === nThisCellIndex && oStartCellIndex.wsName === sCellWsName) {
+ aRecursiveCells.unshift(oStartCellIndex); // The first element of the array is always a start cell.
+ oCell.changeLinkedCell(function (oCell) {
+ let oCellIndex = {
+ cellId: getCellIndex(oCell.nRow, oCell.nCol),
+ wsName: oCell.ws.getName().toLowerCase()
+ };
+ let aPrevRecursiveCell = g_cCalcRecursion.getRecursiveCells(oCell);
+ if (aPrevRecursiveCell.length) {
+ const oPrevStartCellIndex = aPrevRecursiveCell[0];
+ aPrevRecursiveCell = aPrevRecursiveCell.filter(function (oPrevCellIndex) {
+ return oPrevCellIndex.cellId !== oCellIndex.cellId || oPrevCellIndex.wsName !== oCellIndex.wsName;
+ })
+ g_cCalcRecursion.updateRecursiveCells(oPrevStartCellIndex, aPrevRecursiveCell);
+ }
+ let bDuplicateElem = aRecursiveCells.some(function (oElem) {
+ return oElem.cellId === oCellIndex.cellId && oElem.wsName === oCellIndex.wsName;
+ });
+ if (bDuplicateElem) {
+ return true;
+ }
+ aRecursiveCells.push(oCellIndex);
+ }, true);
+ g_cCalcRecursion.addRecursiveCells(oCell, aRecursiveCells);
+ }
+ // Disable calculating formula for linked cells
+ let bRecursiveCell = aRecursiveCells.some(function(oCellIndex) {
+ return oCellIndex.cellId === nThisCellIndex && oCellIndex.wsName === sCellWsName;
+ });
+ if ((nThisCellIndex !== oStartCellIndex.cellId || oStartCellIndex.wsName !== sCellWsName) && bRecursiveCell) {
+ oCell.setIsDirty(false);
+ return;
+ }
+ } else if (g_cCalcRecursion.getIterStep() > 1 && oCell.getValueWithoutFormat() && !oFormulaParsed.ca) {
+ oCell.setIsDirty(false);
+ return;
+ }
+ } else if (oFormulaParsed.ca === true) {
+ oCell.initStartCellForIterCalc();
+ if (g_cCalcRecursion.getStartCellIndex()) {
+ aCycleCells.push(oCell);
+ if (oCell.getNumberValue() == null && (oCell.getValueText() == null || oCell.getValueText() === '#NUM!')) {
+ if (oCell.getType() !== CellValueType.Number) {
+ oCell.setTypeInternal(CellValueType.Number);
+ }
+ oCell.setValueNumberInternal(0);
+ }
+ oCell.setIsDirty(false);
+ return;
+ }
+ g_cCalcRecursion.setStartCellIndex(null);
+ }
+ oCell.setIsDirty(true);
}
});
+ if (aCycleCells.length && g_cCalcRecursion.getShowCycleWarn()) {
+ const oApi = Asc.editor;
+ oApi.sendEvent("asc_onError", c_oAscError.ID.CircularReference, c_oAscError.Level.NoCritical);
+ g_cCalcRecursion.setShowCycleWarn(false);
+ }
+ if (!aCycleCells.length && !g_cCalcRecursion.getShowCycleWarn()) {
+ g_cCalcRecursion.setShowCycleWarn(true);
+ }
AscCommonExcel.importRangeLinksState.startBuildImportRangeLinks = false;
- this._foreachChanged(function(cell){
- cell && cell._checkDirty();
+ this._foreachChanged(function (oCell) {
+ oCell && oCell._checkDirty();
+ if (oCell.formulaParsed && AscCommonExcel.bIsSupportDynamicArrays && (oCell.formulaParsed.getDynamicRef() || oCell.formulaParsed.getArrayFormulaRef()) && oCell.formulaParsed.aca && oCell.formulaParsed.ca) {
+ t.addToVolatileArrays(oCell.formulaParsed);
+ }
+ // Enable calculating formula for next cell in chain
+ if (g_cCalcRecursion.getIsEnabledRecursion() && oCell.isFormula()) {
+ const nThisCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ const aRecursiveCells = g_cCalcRecursion.getRecursiveCells(oCell);
+ let bLinkedCell = aRecursiveCells.some(function (oCellIndex) {
+ return oCellIndex.cellId === nThisCellIndex && oCellIndex.wsName === sCellWsName;
+ });
+ if (aRecursiveCells.length && bLinkedCell) {
+ oCell.changeLinkedCell(function (oCell) {
+ const nCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
+ const sCellWsName = oCell.ws.getName().toLowerCase();
+ let bLinkedCell = aRecursiveCells.some(function (oCellIndex) {
+ return oCellIndex.cellId === nCellIndex && oCellIndex.wsName === sCellWsName;
+ });
+ if (bLinkedCell && !oCell.getIsDirty()) {
+ oCell.setIsDirty(true);
+ }
+ }, false);
+ g_cCalcRecursion.calcDiffBetweenIter(oCell);
+ }
+ }
});
- this.changedCell = null;
- this.changedRange = null;
if (AscCommonExcel.importRangeLinksState.importRangeLinks) {
//need update
@@ -1923,7 +2084,6 @@
} else {
AscCommonExcel.importRangeLinksState.startBuildImportRangeLinks = null;
}
-
},
_foreachChanged: function(callback) {
var sheetId, changedSheet, ws, bbox;
@@ -2359,7 +2519,11 @@
this.nActive = 0;
this.App = null;
this.Core = null;
- this.CustomProperties = null;
+
+ AscFormat.ExecuteNoHistory(function () {
+ this.CustomProperties = new AscCommon.CCustomProperties();
+ }, this, [], true);
+
this.theme = null;
this.clrSchemeMap = null;
@@ -2382,11 +2546,8 @@
this.bRedoChanges = false;
this.aCollaborativeChangeElements = [];
this.externalReferences = [];
- this.calcPr = {
- calcId: null, calcMode: null, fullCalcOnLoad: null, refMode: null, iterate: null, iterateCount: null,
- iterateDelta: null, fullPrecision: null, calcCompleted: null, calcOnSave: null, concurrentCalc: null,
- concurrentManualCount: null, forceFullCalc: null
- };
+ this.calcPr = new AscCommonExcel.CCalcPr();
+
this.connections = null;
this.wsHandlers = null;
@@ -2416,6 +2577,8 @@
this.timelineCaches = [];
this.TimelineStyles = null;
+
+ this.metadata = null;
}
Workbook.prototype.init=function(tableCustomFunc, tableIds, sheetIds, bNoBuildDep, bSnapshot){
if(this.nActive < 0)
@@ -2454,6 +2617,10 @@
this.timelineCaches.forEach(function(elem){
elem.initPostOpen(tableIds, sheetIds);
});
+ //external references
+ this.externalReferences.forEach(function(elem){
+ elem && elem.initPostOpen && elem.initPostOpen();
+ });
//show active if it hidden
var wsActive = this.getActiveWs();
if (wsActive && wsActive.getHidden()) {
@@ -2466,6 +2633,8 @@
if (bSnapshot) {
this.snapshot = this._getSnapshot();
}
+
+ g_cCalcRecursion.initCalcProperties(this.calcPr);
};
Workbook.prototype.addImages = function (aImages, obj) {
const oApi = Asc.editor;
@@ -2479,7 +2648,7 @@
const oSmartArtId = oSmartArtGroup && oSmartArtGroup.Id;
this.checkObjectsLock([oSmartArtId], function (bLock) {
if (bLock) {
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
oController.resetSelection();
oPlaceholderTarget.applyImagePlaceholderCallback && oPlaceholderTarget.applyImagePlaceholderCallback(aImages, obj);
oController.selectObject(oSmartArtGroup, 0);
@@ -2523,6 +2692,7 @@
AscCommon.pptx_content_loader.Reader.ImageMapChecker = AscCommon.pptx_content_loader.ImageMapChecker;
var context = xmlParserContext;
context.loadDataLinks();
+ context.ClearSmartArts();
}
};
Workbook.prototype.preparePivotForSerialization=function(pivotCaches, isCopyPaste){
@@ -2652,8 +2822,8 @@
};
Workbook.prototype.createWorksheet=function(indexBefore, sName, sId){
this.dependencyFormulas.lockRecal();
- History.Create_NewPoint();
- History.TurnOff();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.TurnOff();
var wsActive = this.getActiveWs();
var oNewWorksheet = new Worksheet(this, this.aWorksheets.length, sId);
if (this.checkValidSheetName(sName))
@@ -2668,12 +2838,13 @@
}
this.aWorksheetsById[oNewWorksheet.getId()] = oNewWorksheet;
this._updateWorksheetIndexes(wsActive);
- History.TurnOn();
+ AscCommon.History.TurnOn();
this._insertWorksheetFormula(oNewWorksheet.index);
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetAdd, null, null, new UndoRedoData_SheetAdd(indexBefore, oNewWorksheet.getName(), null, oNewWorksheet.getId()));
- History.SetSheetUndo(wsActive.getId());
- History.SetSheetRedo(oNewWorksheet.getId());
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetAdd, null, null, new UndoRedoData_SheetAdd(indexBefore, oNewWorksheet.getName(), null, oNewWorksheet.getId()));
+ AscCommon.History.SetSheetUndo(wsActive.getId());
+ AscCommon.History.SetSheetRedo(oNewWorksheet.getId());
this.dependencyFormulas.unlockRecal();
+ g_cCalcRecursion.clearRecursionCells();
return oNewWorksheet;
};
Workbook.prototype.copyWorksheet=function(index, insertBefore, sName, sId, bFromRedo, tableNames, opt_sheet, opt_base64){
@@ -2682,7 +2853,7 @@
if(index >= 0 && index < this.aWorksheets.length){
//buildRecalc вызываем чтобы пересчиталося cwf(может быть пустым если сделать сдвиг формул и скопировать лист)
this.dependencyFormulas.buildDependency();
- History.TurnOff();
+ AscCommon.History.TurnOff();
var wsActive = this.getActiveWs();
var wsFrom = opt_sheet ? opt_sheet : this.aWorksheets[index];
var newSheet = new Worksheet(this, -1, sId);
@@ -2711,7 +2882,7 @@
newSheet.copyFromFormulas(renameParams);
newSheet.initPostOpen(this.wsHandlers, {}, {});
- History.TurnOn();
+ AscCommon.History.TurnOn();
this.dependencyFormulas.copyDefNameByWorksheet(wsFrom, newSheet, renameParams, opt_sheet);
if (opt_sheet /*&& !bFromRedo*/) {
@@ -2731,11 +2902,11 @@
if(!bFromRedo && opt_sheet) {
opt_sheet_binary = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(wsFrom, null, null, true);
}
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetAdd, null, null, new UndoRedoData_SheetAdd(insertBefore, newSheet.getName(), wsFrom.getId(), newSheet.getId(), tableNames, opt_sheet_binary));*/
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetAdd, null, null, new UndoRedoData_SheetAdd(insertBefore, newSheet.getName(), wsFrom.getId(), newSheet.getId(), tableNames, opt_sheet_binary));*/
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetAdd, null, null, new UndoRedoData_SheetAdd(insertBefore, newSheet.getName(), wsFrom.getId(), newSheet.getId(), tableNames, opt_base64));
- History.SetSheetUndo(wsActive.getId());
- History.SetSheetRedo(newSheet.getId());
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetAdd, null, null, new UndoRedoData_SheetAdd(insertBefore, newSheet.getName(), wsFrom.getId(), newSheet.getId(), tableNames, opt_base64));
+ AscCommon.History.SetSheetUndo(wsActive.getId());
+ AscCommon.History.SetSheetRedo(newSheet.getId());
newSheet.copyFromAfterInsert(wsFrom);
if(!(bFromRedo === true))
{
@@ -2818,7 +2989,7 @@
this._insertWorksheetFormula(indexTo);
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetMove, null, null, new UndoRedoData_FromTo(indexFrom, indexTo));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetMove, null, null, new UndoRedoData_FromTo(indexFrom, indexTo));
this.dependencyFormulas.unlockRecal();
if (!this.bUndoChanges && !this.bRedoChanges) {
@@ -2889,10 +3060,10 @@
if (null != oVisibleWs)
wsActive = oVisibleWs;
}
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetRemove, null, null, new AscCommonExcel.UndoRedoData_SheetRemove(nIndex, removedSheetId, removedSheet));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_SheetRemove, null, null, new AscCommonExcel.UndoRedoData_SheetRemove(nIndex, removedSheetId, removedSheet));
if (null != oVisibleWs) {
- History.SetSheetUndo(removedSheetId);
- History.SetSheetRedo(wsActive.getId());
+ AscCommon.History.SetSheetUndo(removedSheetId);
+ AscCommon.History.SetSheetRedo(wsActive.getId());
}
if(null != outputParams)
{
@@ -2903,6 +3074,7 @@
this.dependencyFormulas.unlockRecal();
this.handlers && this.handlers.trigger("asc_onSheetDeleted", nIndex);
this.handlers && this.handlers.trigger("changeDocument", AscCommonExcel.docChangedType.sheetRemove, nIndex);
+ g_cCalcRecursion.clearRecursionCells();
return wsActive.getIndex();
}
return -1;
@@ -3037,9 +3209,11 @@
AscCommonExcel.executeInR1C1Mode(false, function () {
for (let i = 0; i < formulas.length; ++i) {
let formula = formulas[i];
+ let caTemp = formula.ca;
formula.removeDependencies();
formula.setFormula(formula.getFormula());
formula.parse();
+ formula.ca = caTemp;
formula.buildDependencies();
}
});
@@ -3053,11 +3227,11 @@
}
this.dependencyFormulas.notifyChanged(formulas);
this.dependencyFormulas.calcTree();
- History.Create_NewPoint();
- History.StartTransaction();
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_Calculate, sheetId,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_Calculate, sheetId,
null, new AscCommonExcel.UndoRedoData_SingleProperty(type));
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Workbook.prototype.checkDefName = function (checkName, scope) {
return this.dependencyFormulas.checkDefName(checkName, scope);
@@ -3143,7 +3317,7 @@
// Пересчитываем позиции
AscCommon.CollaborativeEditing.Refresh_DCChanges();
- var aActions = this.aCollaborativeActions.concat(History.GetSerializeArray());
+ var aActions = this.aCollaborativeActions.concat(AscCommon.History.GetSerializeArray());
if(aActions.length > 0)
{
var oMemory = new AscCommon.CMemory();
@@ -3212,7 +3386,7 @@
return res;
};
Workbook.prototype._forwardTransformation = function(wbSnapshot, changesMine, changesTheir) {
- History.TurnOff();
+ AscCommon.History.TurnOff();
//first mine changes to resolve conflict sheet names
var res1 = this._forwardTransformationGetTransform(wbSnapshot, changesTheir, changesMine);
var res2 = this._forwardTransformationGetTransform(wbSnapshot, changesMine, changesTheir);
@@ -3235,7 +3409,7 @@
ws.setName(res1.renameSheet[oldName]);
}
}
- History.TurnOn();
+ AscCommon.History.TurnOn();
};
Workbook.prototype._forwardTransformationGetTransform = function(wbSnapshot, changesMaster, changesModify) {
var res = {modify: [], renameSheet: {}};
@@ -3407,7 +3581,7 @@
Workbook.prototype.DeserializeHistory = function(aChanges, fCallback, oColor){
var oThis = this;
//сохраняем те изменения, которые были до приема данных, потому что дальше undo/redo будет очищено
- this.aCollaborativeActions = this.aCollaborativeActions.concat(History.GetSerializeArray());
+ this.aCollaborativeActions = this.aCollaborativeActions.concat(AscCommon.History.GetSerializeArray());
if(aChanges.length > 0)
{
this.bCollaborativeChanges = true;
@@ -3445,8 +3619,8 @@
oFormulaLocaleInfo.Parse = false;
oFormulaLocaleInfo.DigitSep = false;
AscFonts.IsCheckSymbols = true;
- History.Clear();
- History.TurnOff();
+ AscCommon.History.Clear();
+ AscCommon.History.TurnOff();
var history = new AscCommon.CHistory();
history.init(this);
history.Create_NewPoint();
@@ -3504,7 +3678,7 @@
oFormulaLocaleInfo.Parse = true;
oFormulaLocaleInfo.DigitSep = true;
history.UndoRedoEnd(null, oRedoObjectParam, false);
- History.TurnOn();
+ AscCommon.History.TurnOn();
oThis.bCollaborativeChanges = false;
//make snapshot for faormulas
oThis.snapshot = oThis._getSnapshot();
@@ -3533,12 +3707,12 @@
}
}
- History.Clear();
- History.Create_NewPoint();
- History.SetSelection(null);
- History.SetSelectionRedo(null);
+ AscCommon.History.Clear();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.SetSelection(null);
+ AscCommon.History.SetSelectionRedo(null);
oRedoObjectParam = new AscCommonExcel.RedoObjectParam();
- History.UndoRedoPrepare(oRedoObjectParam, false);
+ AscCommon.History.UndoRedoPrepare(oRedoObjectParam, false);
}
var stream = new AscCommon.FT_Stream2(data, data.length);
@@ -3565,7 +3739,7 @@
item.Deserialize(stream);
if ((null != item.oClass || (item.oData && typeof item.oData.sChangedObjectId === "string")) && null != item.nActionType){
AscCommonExcel.executeInR1C1Mode(false, function () {
- History.RedoAdd(oRedoObjectParam, item.oClass, item.nActionType, item.nSheetId, item.oRange, item.oData);
+ AscCommon.History.RedoAdd(oRedoObjectParam, item.oClass, item.nActionType, item.nSheetId, item.oRange, item.oData);
});
}
@@ -3575,8 +3749,8 @@
}
if(isFull){
- History.UndoRedoEnd(null, oRedoObjectParam, false);
- History.Clear();
+ AscCommon.History.UndoRedoEnd(null, oRedoObjectParam, false);
+ AscCommon.History.Clear();
oRedoObjectParam = null;
}
this.bCollaborativeChanges = false;
@@ -3734,9 +3908,9 @@
{
return;
}
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
//не делаем Duplicate потому что предполагаем что схема не будет менять частями, а только обьектом целиком.
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeColorScheme, null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeColorScheme, null,
null, new AscCommonExcel.UndoRedoData_ClrScheme(this.theme.themeElements.clrScheme, scheme));
this.theme.changeColorScheme(scheme);
this.rebuildColors();
@@ -3748,9 +3922,9 @@
if(!scheme) {
return;
}
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
//не делаем Duplicate потому что предполагаем что схема не будет менять частями, а только обьектом целиком.
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeColorScheme, null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeColorScheme, null,
null, new AscCommonExcel.UndoRedoData_ClrScheme(this.theme.themeElements.clrScheme, scheme));
this.theme.changeColorScheme(scheme);
this.rebuildColors();
@@ -4093,8 +4267,8 @@
};
Workbook.prototype.deleteSlicersByTable = function (tableName, doDelDefName) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
for(var i = 0; i < this.aWorksheets.length; ++i) {
var wsSlicers = this.aWorksheets[i].getSlicersByTableName(tableName);
@@ -4105,7 +4279,7 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Workbook.prototype.deleteTimelinesByPivotTable = function (sheetId, pivotName) {
@@ -4140,7 +4314,7 @@
for(let i = 0; i < this.timelineCaches.length; ++i) {
if (this.timelineCaches[i].sourceName === sName) {
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_TimelineCacheDelete,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_TimelineCacheDelete,
null, null, new UndoRedoData_FromTo(this.timelineCaches[i], null));
}
this.timelineCaches.splice(i, 1);
@@ -4177,7 +4351,7 @@
}
};
Workbook.prototype.handleChartsOnWorksheetsRemove = function (aWorksheets) {
- if(!History.CanAddChanges()) {
+ if(!AscCommon.History.CanAddChanges()) {
return;
}
var aRefsToChange = [];
@@ -4251,7 +4425,7 @@
this.changeSheetNameInRefs(oData.refs, sOldName, sNewName);
};
Workbook.prototype.handleChartsOnMoveRange = function (oRangeFrom, oRangeTo, isInsertCol) {
- if(!History.CanAddChanges()) {
+ if(!AscCommon.History.CanAddChanges()) {
return;
}
var aRefsToResize = [];
@@ -4489,7 +4663,7 @@
var updateSheet = this.getActiveWs();
var updateRange = new Asc.Range(0, 0, updateSheet.getColsCount(), updateSheet.getRowsCount());
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_Date1904,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_Date1904,
updateSheet.getId(), updateRange, new UndoRedoData_FromTo(oldVal, val));
}
};
@@ -4526,8 +4700,8 @@
Workbook.prototype.addCellWatches = function (ws, range) {
if (ws && range) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
//TODO protection!
var maxCellWatchesCount = Asc.c_nAscMaxAddCellWatchesCount;
@@ -4546,7 +4720,7 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
/*if (!this.bUndoChanges && !this.bRedoChanges) {
this.handlers.trigger("asc_onUpdateCellWatches");
@@ -4555,8 +4729,8 @@
};
Workbook.prototype.delCellWatches = function (aCellWatches, addToHistory, opt_remove_all) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
//TODO protection!
var i;
@@ -4571,7 +4745,7 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
/*if (!this.bUndoChanges && !this.bRedoChanges) {
this.handlers.trigger("asc_onUpdateCellWatches");
@@ -4734,8 +4908,8 @@
//пока предполагаю, что здесь будет массив asc_CExternalReference
if (arr) {
var isChanged = false;
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
for (var i = 0; i < arr.length; i++) {
var eRIndex = this.getExternalLinkIndexByName(arr[i].externalReference.Id);
if (eRIndex != null) {
@@ -4772,7 +4946,7 @@
}
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
if (isChanged) {
this.handlers && this.handlers.trigger("asc_onUpdateExternalReferenceList");
@@ -4786,7 +4960,7 @@
//this.reIndexExternalReferencesLinks(index - 1);
this._removeExternalReference(index - 1);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
null, null, new UndoRedoData_FromTo(from, null));
}
}
@@ -4810,7 +4984,7 @@
if (index != null) {
var from = this.externalReferences[index - 1].clone();
this.externalReferences[index - 1] = to;
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
null, null, new UndoRedoData_FromTo(from, to));
}
};
@@ -4819,7 +4993,7 @@
if (arr && arr.length) {
for (var i = 0; i < arr.length; i++) {
this.externalReferences.push(arr[i]);
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
null, null, new UndoRedoData_FromTo(null, arr[i]));
}
this.handlers && this.handlers.trigger("asc_onUpdateExternalReferenceList");
@@ -4852,25 +5026,28 @@
Workbook.prototype.removeExternalReferenceBySheet = function (sheetId) {
//пока предполагаю, что здесь будет массив asc_CExternalReference
- var index = this.getExternalLinkIndexBySheetId(sheetId);
+ let index = this.getExternalLinkIndexBySheetId(sheetId);
if (index !== null) {
- var eR = this.externalReferences[index - 1];
- if (eR.SheetNames.length === 1) {
- //удаляем ссылку
- this.removeExternalReference(index, true);
- } else {
- var to = eR.clone();
- eR.removeSheetById(sheetId);
- this.changeExternalReference(index, eR);
- }
+ let eR = this.externalReferences[index - 1];
+ // If there are no more listeners for the external document, delete the external link
+ this.removeExternalReference(index, true);
+
+ // if (eR.SheetNames.length === 1) {
+ // //удаляем ссылку
+ // this.removeExternalReference(index, true);
+ // } else {
+ // let to = eR.clone();
+ // eR.removeSheetById(sheetId);
+ // this.changeExternalReference(index, eR);
+ // }
this.handlers && this.handlers.trigger("asc_onUpdateExternalReferenceList");
}
};
- Workbook.prototype.getExternalReferenceById = function (id) {
+ Workbook.prototype.getExternalReferenceById = function (id, returnIndex) {
for (var i = 0; i < this.externalReferences.length; i++) {
if (this.externalReferences[i].Id === id) {
- return this.externalReferences[i];
+ return returnIndex ? i : this.externalReferences[i];
}
}
return null;
@@ -5246,7 +5423,7 @@
this.bExcludeHiddenRows = false;
this.bIgnoreWriteFormulas = false;
this.mergeManager = new RangeDataManager(function(data, from, to){
- if(History.Is_On() && (null != from || null != to))
+ if(AscCommon.History.Is_On() && (null != from || null != to))
{
if(null != from)
from = from.clone();
@@ -5255,7 +5432,7 @@
var oHistoryRange = from;
if(null == oHistoryRange)
oHistoryRange = to;
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeMerge, oThis.getId(), oHistoryRange, new UndoRedoData_FromTo(new UndoRedoData_BBox(from), new UndoRedoData_BBox(to)));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeMerge, oThis.getId(), oHistoryRange, new UndoRedoData_FromTo(new UndoRedoData_BBox(from), new UndoRedoData_BBox(to)));
}
//расширяем границы
if(null != to){
@@ -5269,7 +5446,7 @@
});
this.mergeManager.worksheet = this;
this.hyperlinkManager = new RangeDataManager(function(data, from, to, oChangeParam){
- if(History.Is_On() && (null != from || null != to))
+ if(AscCommon.History.Is_On() && (null != from || null != to))
{
if(null != from)
from = from.clone();
@@ -5281,7 +5458,7 @@
var oHistoryData = null;
if(null == from || null == to)
oHistoryData = data.clone();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeHyperlink, oThis.getId(), oHistoryRange, new AscCommonExcel.UndoRedoData_FromToHyperlink(from, to, oHistoryData));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeHyperlink, oThis.getId(), oHistoryRange, new AscCommonExcel.UndoRedoData_FromToHyperlink(from, to, oHistoryData));
}
if (null != to)
data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2);
@@ -5359,6 +5536,7 @@
this.bFillHandleRightClick = false;
this.activeFillType = null;
this.timelines = [];
+ this.changedArrays = null;
}
Worksheet.prototype.getCompiledStyle = function (row, col, opt_cell, opt_styleComponents) {
@@ -5631,7 +5809,7 @@
}
}
- if(renameSheetMap && History.Is_On()) {
+ if(renameSheetMap && AscCommon.History.Is_On()) {
//пишем в историю для того, чтобы для случая redo не делать отложенное действия для всех листов
var _oldF = parsed.Formula;
parsed.parse(null, null, null, null, renameSheetMap);
@@ -5641,7 +5819,7 @@
var DataNew = cell.getValueData();
DataNew.formula = _newF;
if (false == DataOld.isEqual(DataNew)) {
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue,
cell.ws.getId(), new Asc.Range(cell.nCol, cell.nRow, cell.nCol, cell.nRow),
new UndoRedoData_CellSimpleData(cell.nRow, cell.nCol, DataOld, DataNew));
}
@@ -6225,12 +6403,12 @@
if(name.length <= g_nSheetNameMaxLength)
{
var lastName = this.sName;
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var prepared = this.workbook.dependencyFormulas.prepareChangeSheet(this.getId(), {rename: {from: lastName, to: name}});
this.sName = name;
this.workbook.dependencyFormulas.changeSheet(prepared);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Rename, this.getId(), null, new UndoRedoData_FromTo(lastName, name));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Rename, this.getId(), null, new UndoRedoData_FromTo(lastName, name));
this.workbook.dependencyFormulas.calcTree();
if (!this.workbook.bUndoChanges && !this.workbook.bRedoChanges) {
@@ -6250,8 +6428,8 @@
if (!this.sheetPr)
this.sheetPr = new AscCommonExcel.asc_CSheetPr();
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetTabColor, this.getId(), null,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetTabColor, this.getId(), null,
new UndoRedoData_FromTo(this.sheetPr.TabColor ? this.sheetPr.TabColor.clone() : null, color ? color.clone() : null));
this.sheetPr.TabColor = color;
@@ -6282,25 +6460,25 @@
wb.handlers && wb.handlers.trigger("undoRedoHideSheet", nNewIndex);
}
}
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Hide, this.getId(), null, new UndoRedoData_FromTo(bOldHidden, hidden));
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Hide, this.getId(), null, new UndoRedoData_FromTo(bOldHidden, hidden));
if (null != oVisibleWs) {
- History.SetSheetUndo(wsActive.getId());
- History.SetSheetRedo(oVisibleWs.getId());
+ AscCommon.History.SetSheetUndo(wsActive.getId());
+ AscCommon.History.SetSheetRedo(oVisibleWs.getId());
}
}
};
Worksheet.prototype.getSheetView = function () {
return this.sheetViews[0];
};
- Worksheet.prototype.getSheetViewSettings = function () {
- return this.sheetViews[0].clone();
+ Worksheet.prototype.getSheetViewSettings = function (bNotClone) {
+ return bNotClone ? this.sheetViews[0] : this.sheetViews[0].clone();
};
Worksheet.prototype.setDisplayGridlines = function (value) {
var view = this.sheetViews[0];
if (value !== view.showGridLines) {
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetDisplayGridlines,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetDisplayGridlines,
this.getId(), null, new UndoRedoData_FromTo(view.showGridLines, value));
view.showGridLines = value;
@@ -6313,8 +6491,8 @@
Worksheet.prototype.setDisplayHeadings = function (value) {
var view = this.sheetViews[0];
if (value !== view.showRowColHeaders) {
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetDisplayHeadings,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetDisplayHeadings,
this.getId(), null, new UndoRedoData_FromTo(view.showRowColHeaders, value));
view.showRowColHeaders = value;
@@ -6327,8 +6505,8 @@
Worksheet.prototype.setShowZeros = function (value) {
var view = this.sheetViews[0];
if (value !== view.showZeros) {
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetShowZeros,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetShowZeros,
this.getId(), null, new UndoRedoData_FromTo(view.showZeros, value));
view.showZeros = value;
@@ -6342,8 +6520,8 @@
Worksheet.prototype.setShowFormulas = function (value) {
var view = this.sheetViews[0];
if (value !== view.showFormulas) {
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetShowFormulas,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetShowFormulas,
this.getId(), new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromTo(view.showFormulas, value));
view.showFormulas = value;
@@ -6353,6 +6531,20 @@
}
}
};
+ Worksheet.prototype.setRightToLeft = function (value) {
+ var view = this.sheetViews[0];
+ if (value !== view.rightToLeft) {
+ /*AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetShowFormulas,
+ this.getId(), new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromTo(view.showFormulas, value));*/
+ view.rightToLeft = value;
+
+ this.workbook.handlers.trigger("changeSheetViewSettings", this.getId(), AscCH.historyitem_Worksheet_SetRightToLeft);
+ if (!this.workbook.bCollaborativeChanges) {
+ this.workbook.handlers.trigger("asc_onUpdateSheetViewSettings");
+ }
+ }
+ };
Worksheet.prototype.getShowFormulas = function () {
var view = this.sheetViews[0];
return view && view.showFormulas;
@@ -6472,7 +6664,7 @@
Worksheet.prototype._removeRows=function(start, stop){
var t = this;
this.workbook.dependencyFormulas.lockRecal();
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
//start, stop 0 based
var nDif = -(stop - start + 1);
var oActualRange = new Asc.Range(0, start, gc_nMaxCol0, stop);
@@ -6485,12 +6677,12 @@
this.updateUserProtectedRangesOffset(oActualRange, offset);
}
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oActualRange, offset);
this.updateSparklineGroupOffset(oActualRange, offset);
this.updateConditionalFormattingOffset(oActualRange, offset);
this.updateProtectedRangeOffset(oActualRange, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
var collapsedInfo = null, lastRowIndex;
@@ -6499,7 +6691,7 @@
var oOldProps = row.getHeightProp();
lastRowIndex = row.index;
if (false === oOldProps.isEqual(oDefRowPr))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, t.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.getIndex(), true, oOldProps, oDefRowPr));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, t.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.getIndex(), true, oOldProps, oDefRowPr));
row.setStyle(null);
if(!t.workbook.bRedoChanges) {
@@ -6534,12 +6726,13 @@
});
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes && renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RemoveRows, this.getId(), new Asc.Range(0, start, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(true, start, stop));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RemoveRows, this.getId(), new Asc.Range(0, start, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(true, start, stop));
this.autoFilters.redrawStylesTables(redrawTablesArr);
if (this.workbook.handlers) {
- this.workbook.handlers.trigger("changeDocument", AscCommonExcel.docChangedType.sheetContent, this, new Asc.Range(0, start, gc_nMaxCol0, gc_nMaxRow0), this.getId());
+ this.workbook.handlers.trigger("changeDocument", AscCommonExcel.docChangedType.sheetContent, this, new Asc.Range(0, start, gc_nMaxCol0, stop), this.getId());
+ this.workbook.handlers.trigger("changeDocument", AscCommonExcel.docChangedType.removeRows, this, new Asc.Range(0, start, gc_nMaxCol0, stop), this.getId());
}
this.workbook.dependencyFormulas.unlockRecal();
@@ -6576,7 +6769,7 @@
var t = this;
this.workbook.dependencyFormulas.lockRecal();
var oActualRange = new Asc.Range(0, index, gc_nMaxCol0, index + count - 1);
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var offset = new AscCommon.CellBase(count, 0);
//renameDependencyNodes before move cells to store current location in history
var renameRes = this.renameDependencyNodes(offset, oActualRange);
@@ -6586,12 +6779,12 @@
this.updateUserProtectedRangesOffset(oActualRange, offset);
}
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oActualRange, offset);
this.updateSparklineGroupOffset(oActualRange, offset);
this.updateConditionalFormattingOffset(oActualRange, offset);
this.updateProtectedRangeOffset(oActualRange, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
this._updateFormulasParents(index, 0, gc_nMaxRow0, gc_nMaxCol0, oActualRange, offset, renameRes.shiftedShared);
@@ -6626,7 +6819,7 @@
}
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddRows, this.getId(), new Asc.Range(0, index, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(true, index, index + count - 1));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddRows, this.getId(), new Asc.Range(0, index, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(true, index, index + count - 1));
this.autoFilters.redrawStylesTables(redrawTablesArr);
if (this.workbook.handlers) {
@@ -6654,7 +6847,7 @@
Worksheet.prototype._removeCols=function(start, stop){
var t = this;
this.workbook.dependencyFormulas.lockRecal();
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
//start, stop 0 based
var nDif = -(stop - start + 1), i, j, length;
var oActualRange = new Asc.Range(start, 0, stop, gc_nMaxRow0);
@@ -6667,12 +6860,12 @@
this.updateUserProtectedRangesOffset(oActualRange, offset);
}
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oActualRange, offset);
this.updateSparklineGroupOffset(oActualRange, offset);
this.updateConditionalFormattingOffset(oActualRange, offset);
this.updateProtectedRangeOffset(oActualRange, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
var collapsedInfo = null, lastRowIndex;
@@ -6681,7 +6874,7 @@
var nIndex = col.getIndex();
var oOldProps = col.getWidthProp();
if(false === oOldProps.isEqual(oDefColPr))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, t.getId(), new Asc.Range(nIndex, 0, nIndex, gc_nMaxRow0), new UndoRedoData_IndexSimpleProp(nIndex, false, oOldProps, oDefColPr));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, t.getId(), new Asc.Range(nIndex, 0, nIndex, gc_nMaxRow0), new UndoRedoData_IndexSimpleProp(nIndex, false, oOldProps, oDefColPr));
col.setStyle(null);
lastRowIndex = col.index;
@@ -6717,7 +6910,7 @@
}
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RemoveCols, this.getId(), new Asc.Range(start, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(false, start, stop));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RemoveCols, this.getId(), new Asc.Range(start, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(false, start, stop));
this.autoFilters.redrawStylesTables(redrawTablesArr);
if (this.workbook.handlers) {
@@ -6735,7 +6928,7 @@
Worksheet.prototype._insertColsBefore=function(index, count){
this.workbook.dependencyFormulas.lockRecal();
var oActualRange = new Asc.Range(index, 0, index + count - 1, gc_nMaxRow0);
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var offset = new AscCommon.CellBase(0, count);
//renameDependencyNodes before move cells to store current location in history
var renameRes = this.renameDependencyNodes(offset, oActualRange);
@@ -6745,12 +6938,12 @@
this.updateUserProtectedRangesOffset(oActualRange, offset);
}
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oActualRange, offset);
this.updateSparklineGroupOffset(oActualRange, offset);
this.updateConditionalFormattingOffset(oActualRange, offset);
this.updateProtectedRangeOffset(oActualRange, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
this._updateFormulasParents(0, index, gc_nMaxRow0, gc_nMaxCol0, oActualRange, offset, renameRes.shiftedShared);
@@ -6782,7 +6975,7 @@
if (null == oPrevCol && null != this.oAllCol)
oPrevCol = this.oAllCol;
if (null != oPrevCol) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
for (var i = index; i < index + count; ++i) {
var oNewCol = oPrevCol.clone();
oNewCol.setHidden(null);
@@ -6790,7 +6983,7 @@
oNewCol.index = i;
this.aCols[i] = oNewCol;
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
var prevCellsByCol = index > 0 ? this.cellsByCol[index - 1] : null;
if (prevCellsByCol) {
@@ -6807,7 +7000,7 @@
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddCols, this.getId(), new Asc.Range(index, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(false, index, index + count - 1));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddCols, this.getId(), new Asc.Range(index, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(false, index, index + count - 1));
this.autoFilters.redrawStylesTables(redrawTablesArr);
if (this.workbook.handlers) {
@@ -6864,14 +7057,14 @@
return;
if(null == stop)
stop = start;
- History.Create_NewPoint();
- /*var oSelection = History.GetSelection();
+ AscCommon.History.Create_NewPoint();
+ /*var oSelection = AscCommon.History.GetSelection();
if(null != oSelection)
{
oSelection = oSelection.clone();
oSelection.assign(start, 0, stop, gc_nMaxRow0);
- History.SetSelection(oSelection);
- History.SetSelectionRedo(oSelection);
+ AscCommon.History.SetSelection(oSelection);
+ AscCommon.History.SetSelectionRedo(oSelection);
}*/
var bNotAddCollapsed = true == this.workbook.bUndoChanges || true == this.workbook.bRedoChanges || this.bExcludeCollapsed;
@@ -6895,7 +7088,7 @@
oThis.initColumn(col);
var oNewProps = col.getWidthProp();
if(false == oOldProps.isEqual(oNewProps))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, oThis.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, oThis.getId(),
col._getUpdateRange(),
new UndoRedoData_IndexSimpleProp(col.index, false, oOldProps, oNewProps));
}
@@ -6941,7 +7134,7 @@
return;
if(null == stop)
stop = start;
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var oThis = this, outlineLevel;
var bNotAddCollapsed = true == this.workbook.bUndoChanges || true == this.workbook.bRedoChanges || this.bExcludeCollapsed;
var _summaryRight = this.sheetPr ? this.sheetPr.SummaryRight : true;
@@ -6975,7 +7168,7 @@
}
var oNewProps = col.getWidthProp();
if(false == oOldProps.isEqual(oNewProps))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, oThis.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, oThis.getId(),
col._getUpdateRange(),
new UndoRedoData_IndexSimpleProp(col.index, false, oOldProps, oNewProps));
}
@@ -7030,7 +7223,7 @@
var oNewProps = col.getCollapsed();
if(oOldProps !== oNewProps) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CollapsedCol, oThis.getId(), col._getUpdateRange(), new UndoRedoData_IndexSimpleProp(col.index, true, oOldProps, oNewProps));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CollapsedCol, oThis.getId(), col._getUpdateRange(), new UndoRedoData_IndexSimpleProp(col.index, true, oOldProps, oNewProps));
}
};
@@ -7045,8 +7238,8 @@
this.sheetPr = new AscCommonExcel.asc_CSheetPr();
}
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetSummaryRight, this.getId(), null,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetSummaryRight, this.getId(), null,
new UndoRedoData_FromTo(this.sheetPr.SummaryRight, val));
this.sheetPr.SummaryRight = val;
@@ -7056,8 +7249,8 @@
this.sheetPr = new AscCommonExcel.asc_CSheetPr();
}
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetSummaryBelow, this.getId(), null,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetSummaryBelow, this.getId(), null,
new UndoRedoData_FromTo(this.sheetPr.SummaryBelow, val));
this.sheetPr.SummaryBelow = val;
@@ -7068,8 +7261,8 @@
this.sheetPr = new AscCommonExcel.asc_CSheetPr();
}
- History.Create_NewPoint();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetFitToPage, this.getId(), null,
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetFitToPage, this.getId(), null,
new UndoRedoData_FromTo(this.sheetPr.FitToPage, val));
this.sheetPr.FitToPage = val;
@@ -7110,7 +7303,7 @@
return;
if(null == stop)
stop = start;
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var oThis = this;
var fProcessCol = function(col){
var oOldProps = col.getWidthProp();
@@ -7125,7 +7318,7 @@
oThis.initColumn(col);
var oNewProps = col.getWidthProp();
if(false == oOldProps.isEqual(oNewProps))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, oThis.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, oThis.getId(),
col._getUpdateRange(),
new UndoRedoData_IndexSimpleProp(col.index, false, oOldProps, oNewProps));
};
@@ -7192,15 +7385,15 @@
return;
if(null == stop)
stop = start;
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var oThis = this, i;
- /*var oSelection = History.GetSelection();
+ /*var oSelection = AscCommon.History.GetSelection();
if(null != oSelection)
{
oSelection = oSelection.clone();
oSelection.assign(0, start, gc_nMaxCol0, stop);
- History.SetSelection(oSelection);
- History.SetSelectionRedo(oSelection);
+ AscCommon.History.SetSelection(oSelection);
+ AscCommon.History.SetSelectionRedo(oSelection);
}*/
var prevRow;
var bNotAddCollapsed = true == this.workbook.bUndoChanges || true == this.workbook.bRedoChanges || this.bExcludeCollapsed;
@@ -7224,7 +7417,7 @@
row.setHidden(false);
var oNewProps = row.getHeightProp();
if(false === oOldProps.isEqual(oNewProps))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
}
};
if(0 == start && gc_nMaxRow0 == stop)
@@ -7300,7 +7493,7 @@
if(startIndex !== null)
{
updateRange = new Asc.Range(0, startIndex, gc_nMaxCol0, endIndex);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide, oThis.getId(), updateRange, new UndoRedoData_FromToRowCol(bHidden, startIndex, endIndex));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide, oThis.getId(), updateRange, new UndoRedoData_FromToRowCol(bHidden, startIndex, endIndex));
}
startIndex = row.index;
@@ -7337,7 +7530,7 @@
if(startIndex !== null)//заносим последние строки
{
updateRange = new Asc.Range(0, startIndex, gc_nMaxCol0, endIndex);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide, oThis.getId(),updateRange, new UndoRedoData_FromToRowCol(bHidden, startIndex, endIndex));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide, oThis.getId(),updateRange, new UndoRedoData_FromToRowCol(bHidden, startIndex, endIndex));
}
}
};
@@ -7347,14 +7540,14 @@
var rowsArr = this.autoFilters.splitRangeByFilters(start, stop);
if (rowsArr) {
var j;
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
if (rowsArr[0] && rowsArr[0].length) {
- var oldLocalChange = History.LocalChange;
- History.LocalChange = true;
+ var oldLocalChange = AscCommon.History.LocalChange;
+ AscCommon.History.LocalChange = true;
for (j = 0; j < rowsArr[0].length; j++) {
doHide(rowsArr[0][j].start, rowsArr[0][j].stop, true)
}
- History.LocalChange = oldLocalChange;
+ AscCommon.History.LocalChange = oldLocalChange;
}
if (rowsArr[1] && rowsArr[1].length) {
for (j = 0; j < rowsArr[1].length; j++) {
@@ -7363,7 +7556,7 @@
}
}
} else {
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
doHide(start, stop)
}
@@ -7380,7 +7573,7 @@
var oNewProps = row.getCollapsed();
if(oOldProps !== oNewProps) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CollapsedRow, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CollapsedRow, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
}
if(bSave) {
row.saveContent(true);
@@ -7428,7 +7621,7 @@
return;
if(null == stop)
stop = start;
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var oThis = this, i;
var isDefaultProp = (true == bBestFit && oDefaultMetrics.RowHeight == height);
var fProcessRow = function(row){
@@ -7440,7 +7633,7 @@
row.setHeight(height);
var oNewProps = row.getHeightProp();
if(false == oOldProps.isEqual(oNewProps))
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, oThis.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(row.index, true, oOldProps, oNewProps));
}
};
if(0 == start && gc_nMaxRow0 == stop) {
@@ -7506,9 +7699,10 @@
it.release();
};
Worksheet.prototype.getCellForValidation=function(row, col, array, formula, callback, isCopyPaste, byRef){
- var cell = new Cell(this);
- cell.setRowCol(row, col);
- //todo cell.xf
+ let cell;
+ this._getCell(row, col, function (_cell) {
+ cell = _cell.clone();
+ });
cell.setValueForValidation(array, formula, callback, isCopyPaste, byRef);
return cell;
};
@@ -7522,8 +7716,11 @@
var oUndoRedoData_CellData = new AscCommonExcel.UndoRedoData_CellData(cell.getValueData(), null);
if (null != cell.xfs)
oUndoRedoData_CellData.style = cell.xfs.clone();
+ if (cell.formulaParsed) {
+ cell.checkRemoveExternalReferences(null, cell.formulaParsed);
+ }
cell.setFormulaInternal(null);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RemoveCell, sheetId, new Asc.Range(nCol, nRow, nCol, nRow), new UndoRedoData_CellSimpleData(nRow, nCol, oUndoRedoData_CellData, null));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RemoveCell, sheetId, new Asc.Range(nCol, nRow, nCol, nRow), new UndoRedoData_CellSimpleData(nRow, nCol, oUndoRedoData_CellData, null));
}
t.workbook.dependencyFormulas.addToChangedCell(cell);
@@ -7784,7 +7981,7 @@
}
var i, elem, bbox, data, wsFrom = this;
var intersection = oBBoxFrom.intersectionSimple(oBBoxTo);
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
//merged
var merged = wsFrom.mergeManager.get(oBBoxFrom).inner;
var mergedToRemove;
@@ -7806,7 +8003,7 @@
wsFrom.hyperlinkManager.removeElement(hyperlinks[i]);
}
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
res.merged = merged;
res.hyperlinks = hyperlinks;
return res;
@@ -7814,7 +8011,7 @@
Worksheet.prototype._moveMergedAndHyperlinks = function(prepared, oBBoxFrom, oBBoxTo, copyRange, wsTo, offset) {
var i, elem, bbox, data;
var intersection = oBBoxFrom.intersectionSimple(oBBoxTo);
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
for (i = 0; i < prepared.merged.length; i++) {
elem = prepared.merged[i];
bbox = copyRange ? elem.bbox.clone() : elem.bbox;
@@ -7837,7 +8034,7 @@
wsTo.hyperlinkManager.add(bbox, data);
}
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
};
Worksheet.prototype._moveCleanRanges = function(oBBoxFrom, oBBoxTo, copyRange, wsTo) {
//удаляем to через историю, для undo
@@ -7907,13 +8104,13 @@
}
}
// ToDo возможно нужно уменьшить диапазон обновления
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_MoveRange,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_MoveRange,
this.getId(), new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0),
new UndoRedoData_FromTo(new UndoRedoData_BBox(oBBoxFrom), new UndoRedoData_BBox(oBBoxTo), copyRange, wsTo.getId()));
if(moveToOtherSheet) {
//сделано для того, чтобы происходил пересчет/обновление данных на другом листе
//таким образом заносим диапазон обновления в UpdateRigions
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Null, wsTo.getId(), oBBoxTo, new UndoRedoData_FromTo(null, null));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Null, wsTo.getId(), oBBoxTo, new UndoRedoData_FromTo(null, null));
}
var shiftedArrayFormula = {};
@@ -7931,7 +8128,7 @@
var preMoveCell = {nRow: cell.nRow - offset.row, nCol: cell.nCol - offset.col};
var isFirstCellArray = formula.checkFirstCellArray(preMoveCell) && !shiftedArrayFormula[formula.getListenerId()];
if (copyRange) {
- History.TurnOff();
+ AscCommon.History.TurnOff();
//***array-formula***
if(!arrayFormula || (arrayFormula && isFirstCellArray)) {
newFormula = oThis._moveCellsFormula(cell, formula, cellWithFormula, copyRange, oBBoxFrom, wsTo);
@@ -7952,7 +8149,7 @@
} else if(arrayFormula && oldNewArrayFormulaMap[formula.getListenerId()]) {
cell.setFormulaInternal(oldNewArrayFormulaMap[formula.getListenerId()], !isClearFromArea);
}
- History.TurnOn();
+ AscCommon.History.TurnOn();
} else {
//***array-formula***
//TODO возможно стоит это делать в dependencyFormulas.move
@@ -8015,8 +8212,8 @@
if (oBBoxFrom.isEqual(oBBoxTo) && this === wsTo)
return;
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
this.workbook.dependencyFormulas.lockRecal();
var offset = new AscCommon.CellBase(oBBoxTo.r1 - oBBoxFrom.r1, oBBoxTo.c1 - oBBoxFrom.c1);
@@ -8042,7 +8239,7 @@
}
this.workbook.dependencyFormulas.unlockRecal();
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
return true;
};
Worksheet.prototype._shiftCellsLeft=function(oBBox){
@@ -8057,12 +8254,12 @@
var renameRes = this.renameDependencyNodes(offset, oBBox);
var redrawTablesArr = this.autoFilters.insertColumn( oBBox, dif );
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oBBox, offset);
this.updateSparklineGroupOffset(oBBox, offset);
this.updateConditionalFormattingOffset(oBBox, offset);
this.updateProtectedRangeOffset(oBBox, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
if (false == this.workbook.bUndoChanges && false == this.workbook.bRedoChanges) {
this.updatePivotOffset(oBBox, offset);
@@ -8084,7 +8281,7 @@
}
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsLeft, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsLeft, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
this.autoFilters.redrawStylesTables(redrawTablesArr);
if (this.workbook.handlers) {
@@ -8103,12 +8300,12 @@
var renameRes = this.renameDependencyNodes(offset, oBBox);
var redrawTablesArr = this.autoFilters.insertRows("delCell", oBBox, c_oAscDeleteOptions.DeleteCellsAndShiftTop);
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oBBox, offset);
this.updateSparklineGroupOffset(oBBox, offset);
this.updateConditionalFormattingOffset(oBBox, offset);
this.updateProtectedRangeOffset(oBBox, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
if (false == this.workbook.bUndoChanges && false == this.workbook.bRedoChanges) {
this.updatePivotOffset(oBBox, offset);
@@ -8127,7 +8324,7 @@
}
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsTop, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsTop, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
this.autoFilters.redrawStylesTables(redrawTablesArr);
if (this.workbook.handlers) {
@@ -8145,12 +8342,12 @@
var renameRes = this.renameDependencyNodes(offset, oBBox);
var redrawTablesArr = this.autoFilters.insertColumn( oBBox, dif, displayNameFormatTable );
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oBBox, offset);
this.updateSparklineGroupOffset(oBBox, offset);
this.updateConditionalFormattingOffset(oBBox, offset);
this.updateProtectedRangeOffset(oBBox, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
if (false == this.workbook.bUndoChanges && false == this.workbook.bRedoChanges) {
this.updatePivotOffset(oBBox, offset);
@@ -8191,7 +8388,7 @@
}
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsRight, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsRight, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
this.autoFilters.redrawStylesTables(redrawTablesArr);
@@ -8220,12 +8417,12 @@
this._updateFormulasParents(oActualRange.r1, oActualRange.c1, oActualRange.r2, oActualRange.c2, oBBox, offset, renameRes.shiftedShared);
if (false == this.workbook.bUndoChanges && (false == this.workbook.bRedoChanges || this.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
this.updateSortStateOffset(oBBox, offset);
this.updateSparklineGroupOffset(oBBox, offset);
this.updateConditionalFormattingOffset(oBBox, offset);
this.updateProtectedRangeOffset(oBBox, offset);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
var borders;
@@ -8258,7 +8455,7 @@
}
//notifyChanged after move cells to get new locations(for intersect ranges)
this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsBottom, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsBottom, this.getId(), oActualRange, new UndoRedoData_BBox(oBBox));
//пока перенес добавление только последней строки(в данном случае порядок занесения в истрию должен быть именно в таком порядке)
//TODO возможно стоит полностью перенести сюда обработку для ф/т и а/ф
@@ -8522,7 +8719,7 @@
Worksheet.prototype.removeSparklines = function (range) {
for (var i = this.aSparklineGroups.length - 1; i > -1; --i) {
if (this.aSparklineGroups[i].remove(range)) {
- History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(this.aSparklineGroups[i]));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(this.aSparklineGroups[i]));
this.aSparklineGroups.splice(i, 1);
}
}
@@ -8530,14 +8727,14 @@
Worksheet.prototype.removeSparklineGroups = function (range) {
for (var i = this.aSparklineGroups.length - 1; i > -1; --i) {
if (-1 !== this.aSparklineGroups[i].intersectionSimple(range)) {
- History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(this.aSparklineGroups[i]));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(this.aSparklineGroups[i]));
this.aSparklineGroups.splice(i, 1);
}
}
};
Worksheet.prototype.addSparklineGroups = function (sparklineGroups) {
if (sparklineGroups) {
- History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(sparklineGroups, true));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(sparklineGroups, true));
this.insertSparklineGroup(sparklineGroups);
}
};
@@ -10022,7 +10219,7 @@
this.clearPivotTableCell(pivotTable);
}
this.clearPivotTableStyle(pivotTable);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_PivotDelete, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_PivotDelete, this.getId(), null,
new AscCommonExcel.UndoRedoData_PivotTableRedo(pivotTable.Get_Id(), pivotTable, null));
this.pivotTables.splice(index, 1);
};
@@ -10159,7 +10356,7 @@
}
this.pivotTables.push(pivotTable);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_PivotAdd, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_PivotAdd, this.getId(), null,
new AscCommonExcel.UndoRedoData_BinaryWrapper(pivotTable));
}
};
@@ -10659,7 +10856,7 @@
Worksheet.prototype._deleteSortState = function () {
var oldSortState = this.sortState.clone();
this.sortState = null;
- History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, this.getId(), null,
new AscCommonExcel.UndoRedoData_SortState(oldSortState, null));
return true;
};
@@ -10884,8 +11081,8 @@
Worksheet.prototype.insertSlicer = function (name, obj_name, type, pivotTable, slicerCacheDefinition) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
//TODO недостаточно ли вместо всей данной длинной структуры использовать только tableId(name) и columnName?
var slicer = new window['Asc'].CT_slicer(this);
@@ -10894,7 +11091,7 @@
this.aSlicers.push(slicer);
var oCache = slicer.getCacheDefinition();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SlicerAdd, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SlicerAdd, this.getId(), null,
new AscCommonExcel.UndoRedoData_FromTo(null, slicer));
if (isNewCache) {
@@ -10907,20 +11104,20 @@
this.workbook.editDefinesNames(null, newDefName);
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
return slicer;
};
Worksheet.prototype.deleteSlicer = function (name, doDelDefName) {
var res = false;
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
var slicerObj = this.getSlicerIndexByName(name);
if (null !== slicerObj) {
this.aSlicers.splice(slicerObj.index, 1);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SlicerDelete, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SlicerDelete, this.getId(), null,
new AscCommonExcel.UndoRedoData_FromTo(slicerObj.obj, null));
this.workbook.onSlicerDelete(name);
res = true;
@@ -10937,7 +11134,7 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
return res;
};
@@ -11076,14 +11273,14 @@
var slicers = this.getSlicersByTableColName(tableName, oldVal);
if (slicers) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
for (var i = 0; i < slicers.length; i++) {
slicers[i].setTableColName(oldVal, newVal);
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
}
};
@@ -11094,14 +11291,14 @@
var slicers = this.workbook.getSlicersByTableName(oldVal);
if (slicers) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
for (var i = 0; i < slicers.length; i++) {
slicers[i].setTableName(newVal);
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
}
};
@@ -11146,8 +11343,8 @@
};
Worksheet.prototype.deleteSlicersByTable = function (tableName) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
var slicers = this.workbook.getSlicersByTableName(tableName);
if (slicers) {
@@ -11156,12 +11353,12 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Worksheet.prototype.deleteSlicersByTableCol = function (tableName, colMap) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
for (var j in colMap) {
var slicers = this.getSlicersByTableColName(tableName, j);
@@ -11172,7 +11369,7 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Worksheet.prototype.changeSlicerCacheName = function (oldVal, newVal) {
@@ -11182,14 +11379,14 @@
var slicers = this.getSlicersByCacheName(oldVal);
if (slicers) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
for (var i = 0; i < slicers.length; i++) {
slicers[i].setCacheName(newVal);
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
}
};
@@ -11294,7 +11491,7 @@
}
if (!doNotAddHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SheetViewDelete, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SheetViewDelete, this.getId(), null,
new AscCommonExcel.UndoRedoData_NamedSheetViewRedo(namedSheetView.Get_Id(), namedSheetView, null));
}
@@ -11308,7 +11505,7 @@
sheetView.ws = this;
this.aNamedSheetViews.push(sheetView);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SheetViewAdd, this.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SheetViewAdd, this.getId(), null,
new AscCommonExcel.UndoRedoData_BinaryWrapper(sheetView));
}
};
@@ -11568,7 +11765,7 @@
this.aConditionalFormattingRules.push(val);
this.cleanConditionalFormattingRangeIterator();
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CFRuleAdd, this.getId(), val.getUnionRange(), new AscCommonExcel.UndoRedoData_CF(val.id, null, val.clone ? val.clone() : val));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CFRuleAdd, this.getId(), val.getUnionRange(), new AscCommonExcel.UndoRedoData_CF(val.id, null, val.clone ? val.clone() : val));
}
};
@@ -11621,7 +11818,7 @@
this.aConditionalFormattingRules.splice(oRule.index, 1);
this.cleanConditionalFormattingRangeIterator();
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CFRuleDelete, this.getId(), oRule.val.getUnionRange(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_CFRuleDelete, this.getId(), oRule.val.getUnionRange(),
new AscCommonExcel.UndoRedoData_CF(id, oRule.val));
}
if (oRule.ranges) {
@@ -11793,7 +11990,7 @@
var oldValue = view.topLeftCell ? view.topLeftCell.clone() : null;
view.topLeftCell = val;
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetTopLeftCell,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetTopLeftCell,
this.getId(), null, new UndoRedoData_FromTo(oldValue ? new UndoRedoData_BBox(oldValue) : oldValue, val ? new UndoRedoData_BBox(val) : val));
}
}
@@ -11813,8 +12010,8 @@
//? activeRange
sortState.Ref = new Asc.Range(selection.c1, selection.r1, selection.c2, selection.r2);
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
var columnSort = props.columnSort;
sortState.ColumnSort = !columnSort;
@@ -11880,12 +12077,12 @@
}
if(obj) {
- History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, t.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, t.getId(), null,
new AscCommonExcel.UndoRedoData_SortState(obj.sortState ? obj.sortState.clone() : null, sortState ? sortState.clone() : null, true, obj.DisplayName));
obj.SortState = sortState;
} else {
- History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, t.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, t.getId(), null,
new AscCommonExcel.UndoRedoData_SortState(t.sortState ? t.sortState.clone() : null, sortState ? sortState.clone() : null));
sortState._hasHeaders = props.hasHeaders;
@@ -11900,7 +12097,7 @@
}
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Worksheet.prototype._doSort = function (range, nOption, nStartRowCol, sortColor, opt_guessHeader, opt_by_row, opt_custom_sort) {
@@ -12145,7 +12342,7 @@
Worksheet.prototype.checkProtectedRangeName = function (name) {
var res = c_oAscDefinedNameReason.OK;
//TODO пересмотреть проверку на rx_defName
- if (!AscCommon.rx_defName.test(name.toLowerCase()) || name.length > g_nDefNameMaxLength) {
+ if (!AscCommon.rx_protectedRangeName.test(name.toLowerCase()) || name.length > g_nDefNameMaxLength) {
return c_oAscDefinedNameReason.WrongName;
}
@@ -12329,7 +12526,7 @@
this.aProtectedRanges.push(val);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddProtectedRange,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddProtectedRange,
this.getId(), /*val.getUnionRange()*/null,
new AscCommonExcel.UndoRedoData_ProtectedRange(val.Id, null, val));
}
@@ -12340,7 +12537,7 @@
if (protectedRange) {
this.aProtectedRanges.splice(protectedRange.index, 1);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_DelProtectedRange,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_DelProtectedRange,
this.getId(), /*oRule.val.getUnionRange()*/null,
new AscCommonExcel.UndoRedoData_ProtectedRange(id, protectedRange.val));
}
@@ -12602,7 +12799,7 @@
let fromData = oFromBreak && new AscCommonExcel.UndoRedoData_RowColBreaks(from, oFromBreak.min, oFromBreak.max, oFromBreak.man, oFromBreak.pt, byCol);
let toData = new AscCommonExcel.UndoRedoData_RowColBreaks(to, min, max, man, pt, byCol);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeRowColBreaks, this.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeRowColBreaks, this.getId(),
null, new AscCommonExcel.UndoRedoData_FromTo(fromData, toData));
}
@@ -12639,7 +12836,7 @@
for (let i = 0; i < aBreaks.length; i++) {
let fromData = new AscCommonExcel.UndoRedoData_RowColBreaks(aBreaks[i].id, aBreaks[i].min, aBreaks[i].max, aBreaks[i].man, aBreaks[i].pt, byCol);
if (_breaks.removeBreak(aBreaks[i].id)) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeRowColBreaks, t.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeRowColBreaks, t.getId(),
null, new AscCommonExcel.UndoRedoData_FromTo(fromData, null));
i--;
}
@@ -12688,7 +12885,7 @@
this.aCellWatches.push(cellWatch);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddCellWatch, this.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_AddCellWatch, this.getId(),
null, new AscCommonExcel.UndoRedoData_FromTo(null, new AscCommonExcel.UndoRedoData_BBox(ref)));
}
@@ -12700,7 +12897,7 @@
if (ref.isEqual(this.aCellWatches[i].r)) {
this.aCellWatches.splice(i, 1);
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_DelCellWatch,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_DelCellWatch,
this.getId(), null,
new AscCommonExcel.UndoRedoData_FromTo(new AscCommonExcel.UndoRedoData_BBox(ref), null));
}
@@ -12713,7 +12910,7 @@
Worksheet.prototype.deleteCellWatches = function (addToHistory) {
if (addToHistory) {
for (var i = 0; i < this.aCellWatches.length; i++) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_DelCellWatch,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_DelCellWatch,
this.getId(), null,
new AscCommonExcel.UndoRedoData_FromTo(new AscCommonExcel.UndoRedoData_BBox(this.aCellWatches[i].r), null));
}
@@ -12762,8 +12959,10 @@
return false;
}
+ let newRes;
if (oldObj || newObj) {
let cloneNewOnj = newObj && newObj.clone();
+ newRes = cloneNewOnj;
if (cloneNewOnj) {
cloneNewOnj.Id = newObj.Id;
cloneNewOnj._ws = this;
@@ -12792,13 +12991,13 @@
} else if (newObj && newObj.ref) {
updateRange = newObj.ref.clone();
}
-
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeUserProtectedRange, this.getId(), updateRange,
+
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ChangeUserProtectedRange, this.getId(), updateRange,
new UndoRedoData_FromTo(oldObj, newObj));
}
}
- return true;
+ return newRes ? newRes : true;
};
Worksheet.prototype.deleteUserProtectedRanges = function (range) {
@@ -13023,13 +13222,13 @@
if (oldValue !== val) {
sheetView.view = val;
if (addToHistory) {
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetSheetViewType,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetSheetViewType,
this.getId(), null, new UndoRedoData_FromTo(oldValue, val));
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
}
this.workbook.handlers && this.workbook.handlers.trigger("asc_updateSheetViewType", this.index);
@@ -13098,7 +13297,7 @@
for (let i = 0; i < this.timelines.length; i++) {
if (this.timelines[i].name === name) {
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_TimelineDelete,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_TimelineDelete,
this.getId(), null, new UndoRedoData_FromTo(this.timelines[i], null));
}
@@ -13117,6 +13316,181 @@
return false;
};
+ Worksheet.prototype.addChangedArray = function (rangeName, arrayInfo) {
+ if (!rangeName || !arrayInfo) {
+ return
+ }
+
+ if (!this.changedArrays) {
+ this.changedArrays = {};
+ }
+
+ if (!this.changedArrays[rangeName]) {
+ this.changedArrays[rangeName] = arrayInfo
+ }
+ };
+ Worksheet.prototype.getChangedArrayList = function () {
+ if (!this.changedArrays) {
+ return
+ }
+
+ return this.changedArrays
+ };
+ Worksheet.prototype.removeFromChangedArrayList = function (name) {
+ if (!this.changedArrays) {
+ return
+ }
+
+ return this.changedArrays[name]
+ };
+ Worksheet.prototype.clearChangedArrayList = function () {
+ this.changedArrays = null;
+ };
+ Worksheet.prototype.recalculateVolatileArrays = function () {
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ const ws = this;
+
+ // recalculate all volatile arrays on page
+ if (ws && ws.workbook && ws.workbook.dependencyFormulas) {
+ let depGraph = ws.workbook.dependencyFormulas;
+ // get volatileArraysList
+ let volatileArrayList = depGraph.getVolatileArrays();
+ if (volatileArrayList) {
+ for (let listenerId in volatileArrayList) {
+ let formula = volatileArrayList[listenerId];
+ let formulaResult = formula.calculate();
+ let firstCellRef = formula.parent && new Asc.Range(formula.parent.nCol, formula.parent.nRow, formula.parent.nCol, formula.parent.nRow);
+ if (!(formula.aca && formula.ca)) {
+ // array can expand, setValue for each cell except first
+ let dimensions = formulaResult.getDimensions();
+ let newRef = new Asc.Range(firstCellRef.c1, firstCellRef.r1, firstCellRef.c1 + dimensions.col - 1, firstCellRef.r1 + dimensions.row - 1);
+ formula.setDynamicRef(newRef);
+ if (newRef) {
+ for (let row = newRef.r1; row <= newRef.r2; row++) {
+ for (let col = newRef.c1; col <= newRef.c2; col++) {
+ // if (row === newRef.r1 && col === newRef.c1) {
+ // continue
+ // }
+ // get cell and setPF to it
+ ws._getCell(row, col, function(cell) {
+ cell && cell.setFormulaInternal(formula);
+ });
+ }
+ }
+ }
+ depGraph.addToChangedRange2(formula.getWs().getId(), formula.getDynamicRef());
+ depGraph.endListeningVolatileArray(listenerId);
+ } else {
+ formula.setDynamicRef(firstCellRef);
+ ws._getCell(firstCellRef.r1, firstCellRef.c1, function(cell) {
+ cell && cell.setFormulaInternal(formula);
+ });
+
+ depGraph.addToChangedRange2(formula.getWs().getId(), formula.getArrayFormulaRef());
+ }
+ }
+ }
+ }
+ }
+ };
+ Worksheet.prototype.getRefDynamicInfo = function (formula, calculateResult) {
+ if (formula) {
+ let applyByArray = true, ctrlKey = true, dynamicRange = null, cannotChangeFormulaArray = false;
+
+ if (formula.ref) {
+ dynamicRange = formula.ref;
+ } else {
+ let tempRef = new Asc.Range(formula.parent.nCol, formula.parent.nRow, formula.parent.nCol, formula.parent.nRow);
+ formula.ref = tempRef;
+
+ let formulaResult = formula.calculate(null, null, null, null, calculateResult);
+ let arraySize = formulaResult.getDimensions(true);
+ let newR2 = (formula.parent.nRow + arraySize.row) > AscCommon.gc_nMaxRow ? AscCommon.gc_nMaxRow - 1 : (formula.parent.nRow + arraySize.row - 1);
+ let newC2 = (formula.parent.nCol + arraySize.col) > AscCommon.gc_nMaxCol ? AscCommon.gc_nMaxCol - 1 : (formula.parent.nCol + arraySize.col - 1);
+
+ if (formulaResult.type !== cElementType.array) {
+ return false;
+ }
+
+ let tempDynamicSelectionRange = this.getRange3(formula.parent.nRow, formula.parent.nCol, newR2, newC2);
+ tempDynamicSelectionRange._foreachNoEmpty(function (cell) {
+ let ref = cell.formulaParsed && cell.formulaParsed.ref ? cell.formulaParsed.ref : null;
+
+ if (ref && !tempDynamicSelectionRange.bbox.containsRange(ref)) {
+ cannotChangeFormulaArray = true;
+ return false;
+ }
+ });
+
+ if (tempDynamicSelectionRange.bbox.isOneCell() && (formulaResult.type !== cElementType.array && formulaResult.type !== cElementType.cellsRange && formulaResult.type !== cElementType.cellsRange3D)) {
+ applyByArray = false;
+ ctrlKey = false;
+ }
+
+ dynamicRange = tempDynamicSelectionRange.bbox;
+ }
+
+ return {applyByArray: applyByArray, ctrlKey: ctrlKey, dynamicRange: dynamicRange, cannotChangeFormulaArray: cannotChangeFormulaArray};
+ }
+ };
+
+ Worksheet.prototype.findEOT = function (bCheckStyles) {
+ var maxCols = this.getColsCount();
+ var maxRows = this.getRowsCount();
+ var lastC = -1, lastR = -1;
+
+ let t = this;
+ let _cell = null;
+ let _getCell = function (_col, _row) {
+ if (_col < 0 || _col > gc_nMaxCol0 || _row < 0 || _row > gc_nMaxRow0) {
+ return null;
+ }
+
+ return t.getCell3(_row, _col);
+ };
+ let _isCellNullText = function (_col, _row) {
+ let c = _col;
+ _cell = null;
+ if (row !== undefined) {
+ c = _getCell(_col, _row);
+ _cell = c;
+ }
+ return null === c || c.isNullText();
+ };
+
+ let isEmptyCell = function () {
+ if (_cell) {
+ if (_cell.hasMerged()) {
+ return false;
+ } else {
+ var ws = _cell.worksheet;
+ var nRow = _cell.bbox.r1;
+ var nCol = _cell.bbox.c1;
+ var xfs;
+ ws._getCellNoEmpty(nRow, nCol, function (oCell) {
+ xfs = ws.getCompiledStyle(nRow, nCol, oCell);
+ });
+ if (xfs) {
+ return false;
+ }
+ }
+ }
+ return true;
+ };
+
+ for (var col = 0; col < maxCols; ++col) {
+ for (var row = 0; row < maxRows; ++row) {
+ if (!_isCellNullText(col, row) || (bCheckStyles && !isEmptyCell())) {
+ lastC = Math.max(lastC, col);
+ lastR = Math.max(lastR, row);
+ }
+ }
+ }
+
+ return new AscCommon.CellBase(lastR, lastC);
+ };
+
+
//-------------------------------------------------------------------------------------------------
var g_nCellOffsetFlag = 0;
var g_nCellOffsetXf = g_nCellOffsetFlag + 1;
@@ -13149,6 +13523,9 @@
this.isDirty = false;
this.isCalc = false;
+ this.cm = null;
+ this.vm = null;
+
this._hasChanged = false;
}
Cell.prototype.clear = function(keepIndex) {
@@ -13171,15 +13548,18 @@
this.isDirty = false;
this.isCalc = false;
+ this.cm = null;
+ this.vm = null;
+
this._hasChanged = true;
};
Cell.prototype.clearDataKeepXf = function(border) {
var xfs = this.xfs;
this.clearData();
this.xfs = xfs;
- History.TurnOff();
+ AscCommon.History.TurnOff();
this.setBorder(border);
- History.TurnOn();
+ AscCommon.History.TurnOn();
};
Cell.prototype.saveContent = function(opt_inCaseOfChange) {
if (this.hasRowCol() && (!opt_inCaseOfChange || this._hasChanged)) {
@@ -13320,6 +13700,9 @@
AscCommonExcel.executeInR1C1Mode(false, function () {
newFormula.parse();
});
+ if (parsed.ca) { // For recursive formulas
+ newFormula.ca = parsed.ca;
+ }
var arrayFormulaRef = parsed.getArrayFormulaRef();
if(arrayFormulaRef) {
newFormula.setArrayFormulaRef(arrayFormulaRef);
@@ -13455,15 +13838,15 @@
this.textIndex = null;
this._hasChanged = true;
};
- Cell.prototype.setValue=function(val,callback, isCopyPaste, byRef, ignoreHyperlink) {
+ Cell.prototype.setValue=function(val,callback, isCopyPaste, byRef, ignoreHyperlink, dynamicRange) {
var ws = this.ws;
var wb = ws.workbook;
var DataOld = null;
- if (History.Is_On()) {
+ if (AscCommon.History.Is_On()) {
DataOld = this.getValueData();
}
var isFirstArrayFormulaCell = byRef && this.nCol === byRef.c1 && this.nRow === byRef.r1;
- var newFP = this.setValueGetParsed(val, callback, isCopyPaste, byRef);
+ var newFP = this.setValueGetParsed(val, callback, isCopyPaste, byRef, dynamicRange);
if (undefined === newFP) {
return;
}
@@ -13477,6 +13860,9 @@
this.setFormulaInternal(newFP);
if(byRef) {
if(isFirstArrayFormulaCell) {
+ if (dynamicRange) {
+ this.setDynamicArrayFlags();
+ }
wb.dependencyFormulas.addToBuildDependencyArray(newFP);
}
} else {
@@ -13492,22 +13878,35 @@
}
wb.dependencyFormulas.addToChangedCell(this);
} else {
- wb.dependencyFormulas.addToChangedCell(this);
+ // when deleting a cell value we get here
+ if (oldFP && oldFP.dynamicRange) {
+ isFirstArrayFormulaCell = this.nCol === oldFP.dynamicRange.c1 && this.nRow === oldFP.dynamicRange.r1;
+ // we check here and add the range with daf to the dependency sheet
+ if (isFirstArrayFormulaCell) {
+ wb.dependencyFormulas.addToChangedRange2(oldFP.getWs().getId(), oldFP.getDynamicRef());
+ }
+ } else {
+ wb.dependencyFormulas.addToChangedCell(this);
+ }
if (this.ws.workbook.handlers) {
this.ws.workbook.handlers.trigger("changeDocument", AscCommonExcel.docChangedType.cellValue, this, null, this.ws.getId());
}
}
var DataNew = null;
- if (History.Is_On()) {
+ if (g_cCalcRecursion.getCellPasteValue() != null) {
+ this.setValueNumberInternal(g_cCalcRecursion.getCellPasteValue());
+ g_cCalcRecursion.setCellPasteValue(null);
+ }
+ if (AscCommon.History.Is_On()) {
DataNew = this.getValueData();
}
- if (History.Is_On() && false == DataOld.isEqual(DataNew)) {
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(),
+ if (AscCommon.History.Is_On() && false == DataOld.isEqual(DataNew)) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(),
new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow),
new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
}
- //sortDependency вызывается ниже History.Add(AscCH.historyitem_Cell_ChangeValue, потому что в ней может быть выставлен формат ячейки(если это текстовый, то принимая изменения формула станет текстом)
+ //sortDependency вызывается ниже AscCommon.History.Add(AscCH.historyitem_Cell_ChangeValue, потому что в ней может быть выставлен формат ячейки(если это текстовый, то принимая изменения формула станет текстом)
this.ws.workbook.sortDependency();
if (!this.ws.workbook.dependencyFormulas.isLockRecal()) {
this._adjustCellFormat();
@@ -13586,20 +13985,58 @@
//3. проверям, не ссылаются ли на эти ссылки кто-то другой
if (externalLinks && fOld) {
let listenerId = fOld.getListenerId();
- for (i in externalLinks) {
- if (null != listenerId) {
- let sheetId = externalLinks[i];
- let sheetContainer = fOld.wb && fOld.wb.dependencyFormulas && fOld.wb.dependencyFormulas.sheetListeners && fOld.wb.dependencyFormulas.sheetListeners[sheetId];
- if (sheetContainer && Object.keys(sheetContainer.cellMap).length === 0) {
- //если есть ссылки на внешние источники, необходимо их удалить
- this.ws && this.ws.workbook && this.ws.workbook.removeExternalReferenceBySheet(sheetId);
+
+ for (let link in externalLinks) {
+ // check all external link listeners
+ // let erIndex = this.getExternalLinkIndexBySheetId(sheetId);
+ // let eR = this.ws.workbook.externalReferences[+index - 1];
+ let index = this.ws.workbook.getExternalLinkIndexBySheetId(externalLinks[link]);
+ let eR = this.ws.workbook.externalReferences[index - 1];
+
+ if (eR && null != listenerId) {
+ let hasListeners;
+ for (let ws in eR.worksheets) {
+ // if listeners are found, then we interrupt the cycle and move on to the next external link
+ if (hasListeners) {
+ break
+ }
+
+ let wsId = eR.worksheets[ws].getId();
+ let sheetContainer = fOld.wb && fOld.wb.dependencyFormulas && fOld.wb.dependencyFormulas.sheetListeners && fOld.wb.dependencyFormulas.sheetListeners[wsId];
+
+ if (sheetContainer) {
+ if (Object.keys(sheetContainer.cellMap).length === 0 && Object.keys(sheetContainer.areaMap).length === 0) {
+ hasListeners = false;
+ } else {
+ hasListeners = true;
+ }
+ }
+ }
+
+ if (!hasListeners) {
+ this.ws && this.ws.workbook && this.ws.workbook.removeExternalReference(index, true);
}
}
}
}
+
+ // //3. проверям, не ссылаются ли на эти ссылки кто-то другой
+ // if (externalLinks && fOld) {
+ // let listenerId = fOld.getListenerId();
+ // for (i in externalLinks) {
+ // if (null != listenerId) {
+ // let sheetId = externalLinks[i];
+ // let sheetContainer = fOld.wb && fOld.wb.dependencyFormulas && fOld.wb.dependencyFormulas.sheetListeners && fOld.wb.dependencyFormulas.sheetListeners[sheetId];
+ // if (sheetContainer && Object.keys(sheetContainer.cellMap).length === 0) {
+ // //если есть ссылки на внешние источники, необходимо их удалить
+ // this.ws && this.ws.workbook && this.ws.workbook.removeExternalReferenceBySheet(sheetId);
+ // }
+ // }
+ // }
+ // }
};
- Cell.prototype.setValueGetParsed=function(val,callback, isCopyPaste, byRef) {
+ Cell.prototype.setValueGetParsed=function(val,callback, isCopyPaste, byRef, dynamicRange) {
var ws = this.ws;
var wb = ws.workbook;
var bIsTextFormat = false;
@@ -13664,8 +14101,14 @@
}
} else {
newFP.setFormulaString(newFP.assemble());
+ //***dynamic-array-formula***
+ if(byRef && dynamicRange) {
+ newFP.dynamicRange = dynamicRange;
+ newFP.ref = byRef;
+ this.ws.formulaArrayLink = newFP;
+ }
//***array-formula***
- if(byRef) {
+ else if(byRef) {
newFP.ref = byRef;
this.ws.formulaArrayLink = newFP;
}
@@ -13677,7 +14120,7 @@
};
Cell.prototype.setValue2=function(array){
var DataOld = null;
- if(History.Is_On())
+ if(AscCommon.History.Is_On())
DataOld = this.getValueData();
//[{text:"",format:TextFormat},{}...]
var xfTableAndCond = this.getCompiledStyleCustom(true, false, true);
@@ -13688,10 +14131,10 @@
this.ws.workbook.dependencyFormulas.addToChangedCell(this);
this.ws.workbook.sortDependency();
var DataNew = null;
- if(History.Is_On())
+ if(AscCommon.History.Is_On())
DataNew = this.getValueData();
- if(History.Is_On() && false == DataOld.isEqual(DataNew))
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
+ if(AscCommon.History.Is_On() && false == DataOld.isEqual(DataNew))
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
//todo не должны удаляться ссылки, если сделать merge ее части.
if(this.isNullTextString())
{
@@ -13718,54 +14161,66 @@
}
};
Cell.prototype.setFormulaTemplate = function(bHistoryUndo, action) {
- var DataOld = null;
- var DataNew = null;
- if (History.Is_On())
+ let DataOld = null;
+ let DataNew = null;
+ let cellIndex = getCellIndex(this.nRow, this.nCol);
+ if (AscCommon.History.Is_On()) {
DataOld = this.getValueData();
+ }
- this.cleanText();
+ if (!g_cCalcRecursion.isRecursiveCell(cellIndex)) {
+ this.cleanText();
+ }
action(this);
- if (History.Is_On()) {
+ if (AscCommon.History.Is_On()) {
DataNew = this.getValueData();
- if (false == DataOld.isEqual(DataNew)){
- var typeHistory = bHistoryUndo ? AscCH.historyitem_Cell_ChangeValueUndo : AscCH.historyitem_Cell_ChangeValue;
- History.Add(AscCommonExcel.g_oUndoRedoCell, typeHistory, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew), bHistoryUndo);}
+ if (DataOld.isEqual(DataNew) === false){
+ let typeHistory = bHistoryUndo ? AscCH.historyitem_Cell_ChangeValueUndo : AscCH.historyitem_Cell_ChangeValue;
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, typeHistory, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew), bHistoryUndo);}
}
};
- Cell.prototype.setFormula = function(formula, bHistoryUndo, formulaRef) {
+ Cell.prototype.setFormula = function(formula, bHistoryUndo, formulaRef, caProps) {
var cellWithFormula = new CCellWithFormula(this.ws, this.nRow, this.nCol);
var parser = new parserFormula(formula, cellWithFormula, this.ws);
+ if (caProps && caProps.ca) {
+ parser.ca = caProps.ca;
+ }
if(formulaRef) {
parser.setArrayFormulaRef(formulaRef);
this.ws.getRange3(formulaRef.r1, formulaRef.c1, formulaRef.r2, formulaRef.c2)._foreachNoEmpty(function(cell){
cell.setFormulaParsed(parser, bHistoryUndo);
});
} else {
- this.setFormulaParsed(parser, bHistoryUndo);
+ this.setFormulaParsed(parser, bHistoryUndo, caProps);
}
};
- Cell.prototype.setFormulaParsed = function(parsed, bHistoryUndo) {
+ Cell.prototype.setFormulaParsed = function(parsed, bHistoryUndo, caProps) {
this.setFormulaTemplate(bHistoryUndo, function(cell){
cell.setFormulaInternal(parsed);
cell.ws.workbook.dependencyFormulas.addToBuildDependencyCell(cell);
+ if (caProps && caProps.oldValue != null) {
+ cell.setValueNumberInternal(caProps.oldValue);
+ }
});
};
Cell.prototype.setFormulaInternal = function(formula, dontTouchPrev) {
if (!dontTouchPrev && this.formulaParsed) {
- var shared = this.formulaParsed.getShared();
- var arrayFormula = this.formulaParsed.getArrayFormulaRef();
+ let shared = this.formulaParsed.getShared();
+ let arrayFormula = this.formulaParsed.getArrayFormulaRef();
+ let dynamicRange = this.formulaParsed.getDynamicRef();
if (shared) {
if (shared.ref.isOnTheEdge(this.nCol, this.nRow)) {
this.ws.workbook.dependencyFormulas.addToChangedShared(this.formulaParsed);
}
var index = this.ws.workbook.workbookFormulas.add(this.formulaParsed).getIndexNumber();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_RemoveSharedFormula, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_RemoveSharedFormula, this.ws.getId(),
new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, index, null), true);
} else if(arrayFormula && this.formulaParsed.checkFirstCellArray(this)) {
//***array-formula***
var fText = "=" + this.formulaParsed.getFormula();
- History.Add(AscCommonExcel.g_oUndoRedoArrayFormula, AscCH.historyitem_ArrayFromula_DeleteFormula, this.ws.getId(),
+ this.formulaParsed.removeDependencies();
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoArrayFormula, AscCH.historyitem_ArrayFromula_DeleteFormula, this.ws.getId(),
new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new AscCommonExcel.UndoRedoData_ArrayFormula(arrayFormula, fText), true);
} else {
this.formulaParsed.removeDependencies();
@@ -13809,7 +14264,7 @@
this.correctValueByType();
this._hasChanged = true;
var DataNew = this.getValueData();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
}
return type;
};
@@ -13824,7 +14279,7 @@
if (changedText) {
let dataNew = this._cloneMultiText();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeArrayValueFormat,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeArrayValueFormat,
this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow),
new UndoRedoData_CellSimpleData(this.nRow, this.nCol, dataOld, dataNew));
}
@@ -13843,9 +14298,9 @@
var oStyle;
var newVal = this.ws.workbook.CellStyles._prepareCellStyle(val);
var oRes = this.ws.workbook.oStyleManager.setCellStyle(this, newVal);
- if(History.Is_On()) {
+ if(AscCommon.History.Is_On()) {
var oldStyleName = this.ws.workbook.CellStyles.getStyleNameByXfId(oRes.oldVal);
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Style, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldStyleName, val));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Style, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldStyleName, val));
// Выставляем стиль
oStyle = this.ws.workbook.CellStyles.getStyleByXfId(oRes.newVal);
@@ -13865,8 +14320,8 @@
};
Cell.prototype.setNum=function(val){
var oRes = this.ws.workbook.oStyleManager.setNum(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Num, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Num, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.getShiftedNumFormat=function(nShift, dDigitsCount){
let newNumFormat;
@@ -13901,18 +14356,18 @@
if(null != this.multiText && false == this.ws.workbook.bUndoChanges && false == this.ws.workbook.bRedoChanges)
{
var oldVal = null;
- if(History.Is_On())
+ if(AscCommon.History.Is_On())
oldVal = this.getValueData();
this.setValueTextInternal(AscCommonExcel.getStringFromMultiText(this.multiText));
- if(History.Is_On())
+ if(AscCommon.History.Is_On())
{
var newVal = this.getValueData();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, newVal));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, newVal));
}
}
}
var oRes = this.ws.workbook.oStyleManager.setFont(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
{
var oldVal = null;
if(null != oRes.oldVal)
@@ -13920,71 +14375,71 @@
var newVal = null;
if(null != oRes.newVal)
newVal = oRes.newVal.clone();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetFont, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, newVal));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetFont, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, newVal));
}
};
Cell.prototype.setFontname=function(val){
var oRes = this.ws.workbook.oStyleManager.setFontname(this, val);
this._setFontProp(function(format){return val != format.getName();}, function(format){format.setName(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fontname, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fontname, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setFontsize=function(val){
var oRes = this.ws.workbook.oStyleManager.setFontsize(this, val);
this._setFontProp(function(format){return val != format.getSize();}, function(format){format.setSize(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fontsize, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fontsize, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setFontcolor=function(val){
var oRes = this.ws.workbook.oStyleManager.setFontcolor(this, val);
this._setFontProp(function(format){return val != format.getColor();}, function(format){format.setColor(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fontcolor, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fontcolor, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setBold=function(val){
var oRes = this.ws.workbook.oStyleManager.setBold(this, val);
this._setFontProp(function(format){return val != format.getBold();}, function(format){format.setBold(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Bold, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Bold, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setItalic=function(val){
var oRes = this.ws.workbook.oStyleManager.setItalic(this, val);
this._setFontProp(function(format){return val != format.getItalic();}, function(format){format.setItalic(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Italic, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Italic, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setUnderline=function(val){
var oRes = this.ws.workbook.oStyleManager.setUnderline(this, val);
this._setFontProp(function(format){return val != format.getUnderline();}, function(format){format.setUnderline(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Underline, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Underline, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setStrikeout=function(val){
var oRes = this.ws.workbook.oStyleManager.setStrikeout(this, val);
this._setFontProp(function(format){return val != format.getStrikeout();}, function(format){format.setStrikeout(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Strikeout, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Strikeout, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setFontAlign=function(val){
var oRes = this.ws.workbook.oStyleManager.setFontAlign(this, val);
this._setFontProp(function(format){return val != format.getVerticalAlign();}, function(format){format.setVerticalAlign(val);});
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_FontAlign, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_FontAlign, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setAlignVertical=function(val){
var oRes = this.ws.workbook.oStyleManager.setAlignVertical(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_AlignVertical, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_AlignVertical, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setAlignHorizontal=function(val){
var oRes = this.ws.workbook.oStyleManager.setAlignHorizontal(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_AlignHorizontal, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_AlignHorizontal, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setFill=function(val){
var oRes = this.ws.workbook.oStyleManager.setFill(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fill, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Fill, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setFillColor=function(val){
var fill = new AscCommonExcel.Fill();
@@ -13993,67 +14448,67 @@
};
Cell.prototype.setBorder=function(val){
var oRes = this.ws.workbook.oStyleManager.setBorder(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal){
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal){
var oldVal = null;
if(null != oRes.oldVal)
oldVal = oRes.oldVal.clone();
var newVal = null;
if(null != oRes.newVal)
newVal = oRes.newVal.clone();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Border, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, newVal));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Border, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, newVal));
}
};
Cell.prototype.setShrinkToFit=function(val){
var oRes = this.ws.workbook.oStyleManager.setShrinkToFit(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ShrinkToFit, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ShrinkToFit, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setWrap=function(val){
var oRes = this.ws.workbook.oStyleManager.setWrap(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Wrap, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Wrap, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setAngle=function(val){
var oRes = this.ws.workbook.oStyleManager.setAngle(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Angle, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Angle, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setIndent=function(val){
var oRes = this.ws.workbook.oStyleManager.setIndent(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Indent, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Indent, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setQuotePrefix=function(val){
var oRes = this.ws.workbook.oStyleManager.setQuotePrefix(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetQuotePrefix, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetQuotePrefix, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setApplyProtection=function(val){
var oRes = this.ws.workbook.oStyleManager.setApplyProtection(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetApplyProtection, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetApplyProtection, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setLocked=function(val){
var oRes = this.ws.workbook.oStyleManager.setLocked(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetLocked, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetLocked, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setHiddenFormulas=function(val){
var oRes = this.ws.workbook.oStyleManager.setHiddenFormulas(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetHidden, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetHidden, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setPivotButton=function(val){
var oRes = this.ws.workbook.oStyleManager.setPivotButton(this, val);
- if(History.Is_On() && oRes.oldVal != oRes.newVal)
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetPivotButton, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
+ if(AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetPivotButton, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oRes.oldVal, oRes.newVal));
};
Cell.prototype.setStyle=function(xfs){
var oldVal = this.xfs;
this.setStyleInternal(xfs);
- if(History.Is_On() && oldVal != this.xfs)
+ if(AscCommon.History.Is_On() && oldVal != this.xfs)
{
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetStyle, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, this.xfs));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_SetStyle, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, oldVal, this.xfs));
}
};
Cell.prototype.setStyleInternal = function(xfs) {
@@ -14276,32 +14731,46 @@
this._checkDirty();
var formula = this.isFormula() ? this.getFormula() : null;
var formulaRef;
+ let ca;
if(formula) {
var parser = this.getFormulaParsed();
if(parser) {
- formulaRef = this.getFormulaParsed().getArrayFormulaRef();
+ formulaRef = parser.getArrayFormulaRef();
+ ca = parser.ca;
}
}
- return new UndoRedoData_CellValueData(formula, new AscCommonExcel.CCellValue(this), formulaRef);
+ return new UndoRedoData_CellValueData(formula, new AscCommonExcel.CCellValue(this), formulaRef, ca);
};
Cell.prototype.setValueData = function(Val){
//значения устанавляваются через setValue, чтобы пересчитались формулы
- if(null != Val.formula)
- this.setFormula(Val.formula, null, Val.formulaRef);
- else if(null != Val.value)
- {
+ if (null != Val.formula) {
+ let caProps = {
+ ca: Val.ca,
+ oldValue: Val.value.number
+ };
+ this.setFormula(Val.formula, null, Val.formulaRef, caProps);
+ } else if (null != Val.value) {
var DataOld = null;
var DataNew = null;
- if (History.Is_On())
+ if (AscCommon.History.Is_On())
DataOld = this.getValueData();
- this.setFormulaInternal(null);
+ if (this.formulaParsed && this.formulaParsed.getDynamicRef()) {
+ this.ws.workbook.dependencyFormulas.addToChangedRange2(this.formulaParsed.getWs().getId(), this.formulaParsed.getDynamicRef());
+ if (Val.value.getTextValue()) {
+ // non empty val, delete PF from cell
+ this.setFormulaInternal(null);
+ }
+ } else {
+ this.setFormulaInternal(null);
+ this.ws.workbook.dependencyFormulas.addToChangedCell(this);
+ }
+
this._setValueData(Val.value);
- this.ws.workbook.dependencyFormulas.addToChangedCell(this);
this.ws.workbook.sortDependency();
- if (History.Is_On()) {
+ if (AscCommon.History.Is_On()) {
DataNew = this.getValueData();
if (false == DataOld.isEqual(DataNew))
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, DataOld, DataNew));
}
}
else
@@ -14314,53 +14783,529 @@
Cell.prototype.getQuotePrefix = function () {
return this.xfs && this.xfs.getQuotePrefix();
};
- Cell.prototype._checkDirty = function(){
- var t = this;
- if (this.getIsDirty()) {
- if (g_cCalcRecursion.incLevel()) {
- var isCalc = this.getIsCalc();
- this.setIsCalc(true);
- var calculatedArrayFormulas = [];
- this.processFormula(function(parsed) {
- if (!isCalc) {
- //***array-formula***
- //добавлен последний параметр для обработки формулы массива
- if(parsed.getArrayFormulaRef()) {
- var listenerId = parsed.getListenerId();
- if(parsed.checkFirstCellArray(t) && !calculatedArrayFormulas[listenerId]) {
- parsed.calculate();
- calculatedArrayFormulas[listenerId] = 1;
- } else {
- if(null === parsed.value && !calculatedArrayFormulas[listenerId]) {
- parsed.calculate();
- calculatedArrayFormulas[listenerId] = 1;
- }
- var oldParent = parsed.parent;
- parsed.parent = new AscCommonExcel.CCellWithFormula(t.ws, t.nRow, t.nCol);
- parsed._endCalculate();
- parsed.parent = oldParent;
- }
- } else {
- parsed.calculate();
+ /**
+ * Checks "areaMap" belongs formula that ignores recursion rules
+ * @param {[]} aOutStack
+ * @param {object} oAreaMap
+ * @returns {boolean}
+ * @private
+ */
+ function _isExcludeFormula(aOutStack, oAreaMap) {
+ const aExcludeFormulas = AscCommonExcel.aExcludeRecursiveFomulas;
+ for (let i = 0, length = aOutStack.length; i < length; i++) {
+ const oElem = aOutStack[i];
+ if (oElem.type === cElementType.func && aExcludeFormulas.includes(oElem.name)) {
+ let nIndexOfArgCount = i - 1;
+ let nArgCount = aOutStack[nIndexOfArgCount];
+ let nStartArgIndex = nIndexOfArgCount - nArgCount;
+ let bBelongToFormula = false;
+ for (let j = nStartArgIndex; j < nIndexOfArgCount; j++) {
+ let oArgElem = aOutStack[j];
+ let oBbox = null;
+ let aRef = [cElementType.cell, cElementType.cell3D, cElementType.cellsRange, cElementType.cellsRange3D];
+ if (!aRef.includes(oArgElem.type)) {
+ continue;
+ }
+ if (oArgElem.type === cElementType.name || oArgElem.type === cElementType.name3D) {
+ const oElemValue = oArgElem.getValue();
+ if (!aRef.includes(oElemValue.type)) {
+ continue;
+ }
+ oBbox = oElemValue.getBBox0();
+ } else {
+ oBbox = oArgElem.getBBox0();
+ }
+ bBelongToFormula = oBbox.containsRange(oAreaMap.bbox);
+ if (bBelongToFormula) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Method returns listeners of cell
+ * @returns {object}
+ */
+ Cell.prototype.getListeners = function () {
+ const ws = this.ws;
+ const oDepFormulas = ws.workbook.dependencyFormulas;
+
+ if (!oDepFormulas || !oDepFormulas.sheetListeners.hasOwnProperty(ws.Id)) {
+ return null;
+ }
+
+ const nCellIndex = getCellIndex(this.nRow, this.nCol);
+ const oFormulaParsed = this.getFormulaParsed();
+ if (oFormulaParsed && !oFormulaParsed.ca) {
+ return null;
+ }
+ const aOutStack = oFormulaParsed && oFormulaParsed.outStack;
+ const oBaseFunction = aOutStack && aOutStack.find(function (oElem) {
+ return oElem.type === cElementType.func;
+ });
+ let sAreaIndex = null;
+ // Logic for recognizing area listeners
+ if (aOutStack && aOutStack.length && oBaseFunction) {
+ const aElementTypes = [
+ cElementType.cell,
+ cElementType.cellsRange,
+ cElementType.cellsRange3D,
+ cElementType.name,
+ cElementType.name3D,
+ cElementType.table
+ ];
+ let oOutStackElem = aOutStack.find(function (oElem) {
+ return aElementTypes.includes(oElem.type);
+ });
+ if (oOutStackElem && (oOutStackElem.type === cElementType.cellsRange || oOutStackElem.type === cElementType.cellsRange3D)) {
+ let oElemRange = oOutStackElem.getRange();
+ if (oElemRange && oElemRange.containCell2(this)) {
+ sAreaIndex = oOutStackElem.value.replace(/\$/g, "");
+ }
+ } else if (oOutStackElem && (oOutStackElem.type === cElementType.name || oOutStackElem.type === cElementType.name3D)) {
+ let oRef = oOutStackElem.toRef();
+ if (oRef.type === cElementType.cellsRange || oRef.type === cElementType.cellsRange3D) {
+ sAreaIndex = oRef.value.replace(/\$/g, "");
+ }
+ }
+ }
+ const oSheetListeners = oDepFormulas.sheetListeners[ws.Id];
+ if (sAreaIndex && oSheetListeners.areaMap.hasOwnProperty(sAreaIndex)) {
+ return oSheetListeners.areaMap[sAreaIndex];
+ } else if (oSheetListeners.cellMap.hasOwnProperty(nCellIndex)) {
+ return oSheetListeners.cellMap[nCellIndex];
+ } else if (aOutStack && aOutStack.length) {
+ for (let nIndex in oSheetListeners.areaMap) {
+ if (oSheetListeners.areaMap[nIndex].bbox.contains(this.nCol, this.nRow)
+ && !_isExcludeFormula(aOutStack, oSheetListeners.areaMap[nIndex])) {
+ return oSheetListeners.areaMap[nIndex];
+ }
+ }
+ }
+ };
+
+ /**
+ * Iterative extract listeners of a cell
+ * @param fAction {Function} Action on the listener.
+ * @param oCell {Cell}
+ * @param oListeners {object}
+ * @private
+ */
+ function _foreachListeners(fAction, oCell, oListeners) {
+ for (let i in oListeners) {
+ let oListenerCell = oListeners[i].getParent();
+ let nListenerCellIndex = null;
+ if (oListenerCell instanceof DefName) {
+ if (!oListeners[i].ca) {
+ continue;
+ }
+ let oParserRef = oListenerCell.parsedRef;
+ let aRef = [cElementType.cell, cElementType.cell3D, cElementType.cellsRange, cElementType.cellsRange3D];
+ let oOutStackElem = oParserRef.outStack.find(function (oElem) {
+ return aRef.includes(oElem.type);
+ });
+ let oRange = oOutStackElem && oOutStackElem.getRange();
+ if (oRange && oRange.isOneCell()) {
+ nListenerCellIndex = getCellIndex(oRange.bbox.r1, oRange.bbox.c1);
+ let oWs = oRange.worksheet;
+ oWs._getCell(oRange.bbox.r1, oRange.bbox.c1, function (oCell) {
+ oListenerCell = oCell;
+ });
+ } else if (oRange) {
+ oRange._foreachNoEmpty(function (oCell) {
+ if (oCell.isFormula()) {
+ nListenerCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
+ oListenerCell = oCell;
+ return true; // break loop;
+ }
+ })
+ }
+ } else {
+ nListenerCellIndex = getCellIndex(oListenerCell.nRow, oListenerCell.nCol);
+ }
+ if (nListenerCellIndex == null || isNaN(nListenerCellIndex)) {
+ continue;
+ }
+ if (oListenerCell instanceof Asc.CT_WorksheetSource) {
+ continue;
+ }
+ let oRes = fAction(nListenerCellIndex, oListenerCell, oCell);
+ if (oRes != null) {
+ return;
+ }
+ }
+ }
+ /**
+ * Method finds a start cell index of recursion formula.
+ * Uses for only with enabled iterative calculations setting.
+ * @param {Cell} [oPrevCell] - Previous cell in recursion.
+ * @param {Cell} [oFirstCell] - First cell in recursion.
+ * @param {Cell[]} [aPassedCells] - Passed cells in recursion.
+ * @memberof Cell
+ */
+ Cell.prototype.initStartCellForIterCalc = function (oPrevCell, oFirstCell, aPassedCells) {
+ if(g_cCalcRecursion.checkRecursionCounter()) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+ const nCellIndex = getCellIndex(this.nRow, this.nCol);
+ const oCellListeners = this.getListeners();
+ if (!oCellListeners) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+ const oListeners = oCellListeners.listeners;
+ let oCellFromListener = null;
+ let nPrevCellIndex = oPrevCell ? getCellIndex(oPrevCell.nRow, oPrevCell.nCol) : null;
+ oFirstCell = oFirstCell || this;
+ let nFirstCellIndex = getCellIndex(oFirstCell.nRow, oFirstCell.nCol);
+ aPassedCells = aPassedCells || [];
+ _foreachListeners(function (nListenerCellIndex, oListenerCell, oThis) {
+ if (nCellIndex === nListenerCellIndex && oThis.ws.getName() === oListenerCell.ws.getName()) {
+ g_cCalcRecursion.setStartCellIndex({cellId: nCellIndex, wsName: oThis.ws.getName().toLowerCase()});
+ g_cCalcRecursion.resetRecursionCounter();
+ return true;
+ } else if (nPrevCellIndex != null && nListenerCellIndex === nPrevCellIndex && oPrevCell.ws.getName() === oListenerCell.ws.getName()) {
+ let sPrevCellWsName = oPrevCell.ws.getName().toLowerCase();
+ let sThisCellWsName = oThis.ws.getName().toLowerCase();
+ let sCellProp = sPrevCellWsName !== sThisCellWsName ? sThisCellWsName : nCellIndex.toString();
+ let sPrevCellProp = sPrevCellWsName !== sThisCellWsName ? sPrevCellWsName : nPrevCellIndex.toString();
+ if (sPrevCellProp < sCellProp) {
+ g_cCalcRecursion.setStartCellIndex({cellId: nPrevCellIndex, wsName: sPrevCellWsName});
+ } else {
+ g_cCalcRecursion.setStartCellIndex({cellId: nCellIndex, wsName: sThisCellWsName});
+ }
+ g_cCalcRecursion.resetRecursionCounter();
+ return true;
+ } else if (nFirstCellIndex === nListenerCellIndex && oFirstCell.ws.getName() === oListenerCell.ws.getName()) {
+ g_cCalcRecursion.setStartCellIndex({cellId: nFirstCellIndex, wsName: oFirstCell.ws.getName().toLowerCase()});
+ g_cCalcRecursion.resetRecursionCounter();
+ return true;
+ } else {
+ let oWs = oListenerCell.ws;
+ oWs._getCell(oListenerCell.nRow, oListenerCell.nCol, function (oCell) {
+ oCellFromListener = oCell;
+ });
+ let bPassedCell = aPassedCells.some(function (oPassedCell) {
+ let nPassedCellIndex = getCellIndex(oPassedCell.nRow, oPassedCell.nCol);
+ let nCellIndex = getCellIndex(oCellFromListener.nRow, oCellFromListener.nCol);
+ return nPassedCellIndex === nCellIndex && oPassedCell.ws.getName() === oCellFromListener.ws.getName();
+ });
+ if (bPassedCell) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+ aPassedCells.push(oCellFromListener);
+ g_cCalcRecursion.incRecursionCounter();
+ oCellFromListener.initStartCellForIterCalc(oThis, oFirstCell, aPassedCells);
+ g_cCalcRecursion.resetRecursionCounter();
+ if (g_cCalcRecursion.getStartCellIndex() != null) {
+ return true;
+ }
+ }
+ }, this, oListeners);
+ };
+ /**
+ * Function returns an array of reference cells from outStack attribute of parserFormula class.
+ * @param {parserFormula} oFormulaParsed
+ * @returns {[]}
+ * @private
+ */
+ function _getRefElements(oFormulaParsed) {
+ const aRefElements = [];
+ for (let i = 0, length = oFormulaParsed.getOutStackSize(); i < length; i++) {
+ const oOutStackElem = oFormulaParsed.getOutStackElem(i);
+ const nElemType = oOutStackElem.type;
+ const b3D = nElemType === cElementType.cell3D || nElemType === cElementType.cellsRange3D || nElemType === cElementType.name3D;
+ const bArea = nElemType === cElementType.cellsRange || nElemType === cElementType.name;
+ const bDefName = nElemType === cElementType.name || nElemType === cElementType.name3D;
+ const bTable = nElemType === cElementType.table;
+
+ if (nElemType === cElementType.cell || b3D || bArea || bDefName || bTable) {
+ aRefElements.push(oOutStackElem);
+ }
+ }
+
+ return aRefElements;
+ }
+
+ /**
+ * Iterative extract reference elements from outStack attribute of parserFormula class.
+ * @param {Function} fAction - Action with reference element
+ * @param {[]} aRefElements
+ * @private
+ */
+ function _foreachRefElements (fAction, aRefElements) {
+ if (!aRefElements.length) {
+ return;
+ }
+ let nLastIndex = aRefElements.length - 1;
+ for (let i = 0; i < aRefElements.length; i++) {
+ let oRefElement = aRefElements[i];
+ let nRefType = oRefElement.type;
+ let oRange = null;
+
+ if (nRefType === cElementType.name || nRefType === cElementType.name3D) {
+ const oElemValue = oRefElement.getValue();
+ const oElemType = oElemValue.type;
+ let aRef = [cElementType.cell, cElementType.cell3D, cElementType.cellsRange, cElementType.cellsRange3D];
+ if (!aRef.includes(oElemType)) {
+ return;
+ }
+ oRange = oElemValue.getRange();
+ } else if (nRefType === cElementType.table) {
+ let oRefElem = oRefElement.toRef();
+ oRange = oRefElem.getRange();
+ } else {
+ oRange = oRefElement.getRange();
+ }
+ let oRes = fAction(oRange, nLastIndex, i);
+ if (oRes != null) {
+ return;
+ }
+ }
+ }
+
+ /**
+ * Changes ca flag of cell from listener.
+ * Function is recursive.
+ * @param {Cell} oSourceCell
+ * @private
+ */
+ function _changeCellsFromListener (oSourceCell) {
+ if (g_cCalcRecursion.checkRecursionCounter()) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+ const oCellListeners = oSourceCell.getListeners();
+ if (!oCellListeners) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+ const oListeners = oCellListeners.listeners;
+ _foreachListeners(function (nListenerCellId, oListenerCellWithFormula, oCell) {
+ const oWs = oCell.ws;
+ let oListenerCell = null;
+ oWs._getCell(oListenerCellWithFormula.nRow, oListenerCellWithFormula.nCol, function (oCell) {
+ oListenerCell = oCell;
+ })
+ if (!oListenerCell.isFormula()) {
+ return;
+ }
+ const oFormulaParsed = oListenerCell.getFormulaParsed();
+ if (oFormulaParsed.ca) {
+ return;
+ }
+ oFormulaParsed.ca = true;
+ if (oListenerCell.getListeners()) {
+ g_cCalcRecursion.incRecursionCounter();
+ _changeCellsFromListener(oListenerCell);
+ }
+ }, oSourceCell, oListeners);
+ g_cCalcRecursion.resetRecursionCounter();
+ }
+ /**
+ * Method checks is cell has recursive formula.
+ * Recursion method
+ * @param {CCellWithFormula} oCellWithFormula
+ * @param {Cell[]} [aPassedCell]
+ * @returns {boolean}
+ */
+ Cell.prototype.checkRecursiveFormula = function (oCellWithFormula, aPassedCell) {
+ if (g_cCalcRecursion.checkRecursionCounter()) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return false;
+ }
+ if (oCellWithFormula == null) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return false;
+ }
+
+ const nCellIndexFromOperand = getCellIndex(this.nRow, this.nCol);
+ const nCellIndexFromFormula = getCellIndex(oCellWithFormula.nRow, oCellWithFormula.nCol);
+ if (isNaN(nCellIndexFromFormula)) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return false;
+ }
+ if (nCellIndexFromOperand === nCellIndexFromFormula && this.ws.getName() === oCellWithFormula.ws.getName()) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return true;
+ }
+
+ if (!this.isFormula()) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return false;
+ }
+ const oFormulaParsed = this.getFormulaParsed();
+ if (oFormulaParsed.ca) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return true;
+ }
+ const aRefElements = _getRefElements(oFormulaParsed);
+ const oThis = this;
+ let bRecursiveFormula = false;
+ aPassedCell = aPassedCell || [];
+ _foreachRefElements(function (oRange) {
+ oRange._foreachNoEmpty(function (oCell) {
+ let nCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
+ let bCellIsPassed = aPassedCell.some(function (oElem) {
+ let nElemIndex = getCellIndex(oElem.nRow, oElem.nCol);
+ return nCellIndex === nElemIndex && oElem.ws.getName() === oCell.ws.getName();
+ });
+ if (nCellIndexFromFormula === nCellIndex && oCell.ws.getName() === oCellWithFormula.ws.getName()) {
+ bRecursiveFormula = true;
+ return true; // break loop
+ } else if (!bRecursiveFormula && oCell.isFormula() && !bCellIsPassed) {
+ g_cCalcRecursion.incRecursionCounter();
+ aPassedCell.push(oCell);
+ bRecursiveFormula = oCell.checkRecursiveFormula(oCellWithFormula, aPassedCell);
+ }
+ if (bRecursiveFormula) {
+ return true; // break loop
+ }
+ });
+ if (bRecursiveFormula) {
+ if (g_cCalcRecursion.getRecursionCounter() === 0 && aPassedCell.length) {
+ const oWs = oThis.ws;
+ let oSourceCell = null;
+ oWs._getCell(oCellWithFormula.nRow, oCellWithFormula.nCol, function (oCell) {
+ oSourceCell = oCell;
+ });
+ _changeCellsFromListener(oSourceCell);
+ }
+ oFormulaParsed.ca = true;
+ return true;
+ }
+ }, aRefElements);
+
+ g_cCalcRecursion.resetRecursionCounter();
+ return bRecursiveFormula;
+ };
+ /**
+ * Method modifies linked cell.
+ * @param {function} fAction - Callback function with logic for modifying cell.
+ * @param {boolean} bRecursiveCall - Changed all linked cells or only nearby cell.
+ * @memberof Cell
+ */
+ Cell.prototype.changeLinkedCell = function (fAction, bRecursiveCall) {
+ const oThis = this;
+ const nThisIndex = getCellIndex(this.nRow, this.nCol);
+ const oFormulaParsed = this.getFormulaParsed();
+
+ if (!oFormulaParsed) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+ if (g_cCalcRecursion.checkRecursionCounter()) {
+ g_cCalcRecursion.resetRecursionCounter();
+ return;
+ }
+
+ const aRefElements = _getRefElements(oFormulaParsed);
+ _foreachRefElements(function (oRange, nLastRefElemIndex, nIndex) {
+ oRange._foreachNoEmpty(function(oCell) {
+ let nCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
+ let sCellWsName = oCell.ws.getName().toLowerCase();
+ let sThisWsName = oThis.ws.getName().toLowerCase();
+ if (!oCell.isFormula()) {
+ return;
+ }
+ if ((nCellIndex !== nThisIndex && nCellIndex > nThisIndex) || sCellWsName > sThisWsName) {
+ let res = fAction(oCell);
+ if (res != null) {
+ return true;
+ }
+ if (bRecursiveCall) {
+ g_cCalcRecursion.incRecursionCounter();
+ oCell.changeLinkedCell(fAction, true);
+ }
+ } else if (nIndex === nLastRefElemIndex && nCellIndex === nThisIndex && sCellWsName === sThisWsName) {
+ // Try to find listener with linked cell.
+ const oCellListeners = oCell.getListeners();
+ if (!oCellListeners) {
+ return;
+ }
+ const oListeners = oCellListeners.listeners;
+ _foreachListeners(function (nListenerCellIndex, oListenerCell, oThis) {
+ let sThisWsName = oThis.ws.getName().toLowerCase();
+ let sListenerWsName = oListenerCell.ws.getName().toLowerCase();
+ if (nListenerCellIndex !== nCellIndex || sThisWsName !== sListenerWsName) {
+ let oWs = oListenerCell.ws;
+ oWs._getCell(oListenerCell.nRow, oListenerCell.nCol, function (oCell) {
+ if (oCell.isFormula()) {
+ let res = fAction(oCell);
+ if (res != null) {
+ return;
+ }
+ if (bRecursiveCall) {
+ g_cCalcRecursion.incRecursionCounter();
+ oCell.changeLinkedCell(fAction, true);
+ }
+ }
+ });
+ return true;
+ }
+ }, oCell, oListeners);
+ }
+ });
+ }, aRefElements);
+ g_cCalcRecursion.resetRecursionCounter();
+ };
+ /**
+ * Method calculates cells with formula aren't calculated yet.
+ * @memberof Cell
+ * @private
+ */
+ Cell.prototype._checkDirty = function() {
+ const t = this;
+ // Checks cell contains formula or formula is not calculated yet
+ if (this.getIsDirty()) {
+ if (g_cCalcRecursion.checkLevel()) {
+ g_cCalcRecursion.incLevel();
+ const isCalc = this.getIsCalc();
+ this.setIsCalc(true);
+ const calculatedArrayFormulas = [];
+ this.processFormula(function(parsed) {
+ if (!isCalc) {
+ //***array-formula***
+ //добавлен последний параметр для обработки формулы массива
+ if(parsed.getArrayFormulaRef()) {
+ const listenerId = parsed.getListenerId();
+ if(parsed.checkFirstCellArray(t) && !calculatedArrayFormulas[listenerId]) {
+ parsed.calculate();
+ calculatedArrayFormulas[listenerId] = 1;
+ } else {
+ if(null === parsed.value && !calculatedArrayFormulas[listenerId]) {
+ parsed.calculate();
+ calculatedArrayFormulas[listenerId] = 1;
+ }
+
+ let oldParent = parsed.parent;
+ parsed.parent = new AscCommonExcel.CCellWithFormula(t.ws, t.nRow, t.nCol);
+ parsed._endCalculate();
+ parsed.parent = oldParent;
+ }
+ } else {
+ parsed.calculate();
}
- } else {
- parsed.calculateCycleError();
}
});
g_cCalcRecursion.decLevel();
if (g_cCalcRecursion.getIsForceBacktracking()) {
g_cCalcRecursion.insert({ws: this.ws, nRow: this.nRow, nCol: this.nCol});
- if (0 === g_cCalcRecursion.getLevel() && !g_cCalcRecursion.getIsProcessRecursion()) {
+ if (g_cCalcRecursion.getLevel() === 0 && !g_cCalcRecursion.getIsProcessRecursion()) {
g_cCalcRecursion.setIsProcessRecursion(true);
do {
g_cCalcRecursion.setIsForceBacktracking(false);
- g_cCalcRecursion.foreachInReverse(function(elem) {
- elem.ws._getCellNoEmpty(elem.nRow, elem.nCol, function(cell) {
- if(cell && cell.getIsDirty()){
- cell.setIsCalc(false);
- cell._checkDirty();
+ g_cCalcRecursion.foreachInReverse(function(oElem) {
+ oElem.ws._getCellNoEmpty(oElem.nRow, oElem.nCol, function(oCell) {
+ if(oCell && oCell.getIsDirty()) {
+ oCell.setIsCalc(false);
+ oCell._checkDirty();
}
});
});
@@ -14466,7 +15411,7 @@
case cElementType.empty:
//=A1:A3
this.setTypeInternal(CellValueType.Number);
- this.setValueNumberInternal(res.getValue());
+ this.setValueNumberInternal(res.tocNumber().getValue());
break;
default:
this.setTypeInternal(CellValueType.String);
@@ -14867,12 +15812,12 @@
if(this._minimizeMultiText(false))
{
var DataNew = this.getValueData();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow,this.nCol, backupObj, DataNew));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow,this.nCol, backupObj, DataNew));
}
else
{
var DataNew = this._cloneMultiText();
- History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeArrayValueFormat, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, backupObj.value.multiText, DataNew));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeArrayValueFormat, this.ws.getId(), new Asc.Range(this.nCol, this.nRow, this.nCol, this.nRow), new UndoRedoData_CellSimpleData(this.nRow, this.nCol, backupObj.value.multiText, DataNew));
}
}
bRes = true;
@@ -14975,6 +15920,9 @@
case cErrorOrigin["calc"]:
return cErrorLocal["calc"];
break;
+ case cErrorOrigin["spill"]:
+ return cErrorLocal["spill"];
+ break;
}
return cErrorLocal["nil"];
};
@@ -15060,9 +16008,9 @@
var end = stream.XlsbReadRecordLength() + stream.GetCurPos();
this.setRowCol(row, stream.GetULongLE() & 0x3FFF);
- var nStyleRef = stream.GetULongLE();
- if (0 !== (nStyleRef & 0xFFFFFF)) {
- var xf = aCellXfs[nStyleRef & 0xFFFFF];
+ var nFlags2 = stream.GetULongLE();
+ if (0 !== (nFlags2 & 0xFFFFFF)) {
+ var xf = aCellXfs[nFlags2 & 0xFFFFF];
if (xf) {
this.setStyle(xf);
}
@@ -15142,6 +16090,14 @@
this.setValueTextInternal(text);
}
}
+ if (0 !== (nFlags2 & 0x2000000))
+ {
+ this.setCm(stream.GetULong());
+ }
+ if (0 !== (nFlags2 & 0x4000000))
+ {
+ this.setVm(stream.GetULong());
+ }
stream.Seek2(end);
};
@@ -15275,11 +16231,18 @@
stream.XlsbStartRecord(type, len);
stream.WriteULong(this.nCol & 0x3FFF);
- var nStyle = 0;
+ var nFlags2 = 0;
if (null !== nXfsId) {
- nStyle = nXfsId;
+ nFlags2 = nXfsId;
}
- stream.WriteULong(nStyle);
+ if (this.cm != null) {
+ nFlags2 |= 0x2000000;
+ }
+ if (this.vm != null) {
+ nFlags2 |= 0x4000000;
+ }
+ stream.WriteULong(nFlags2);
+
//todo RkNumber
switch (type) {
case AscCommonExcel.XLSB.rt_CELL_REAL:
@@ -15338,10 +16301,21 @@
if (formulaToWrite) {
flags = this.toXLSBFormula(stream, formulaToWrite, isBlankFormula);
}
+
+
stream.WriteUShort(flags);
+
if (formulaToWrite) {
flags = this.toXLSBFormulaExt(stream, formulaToWrite);
}
+
+ if (this.cm != null) {
+ stream.WriteULong(this.cm);
+ }
+ if (this.vm != null) {
+ stream.WriteULong(this.vm);
+ }
+
stream.XlsbEndRecord();
};
Cell.prototype.readAttributes = function(attr, uq) {
@@ -15444,6 +16418,20 @@
stream.WriteULong(formulaToWrite.si);
}
};
+ Cell.prototype.setDynamicArrayFlags = function () {
+ this.cm = 1;
+ // this.vm = 1;
+ // todo prop vm - determines the order in which dynamic arrays are expanded?
+ // presumably the metadata it refers to contains the estimated size of the array
+ // the size of the array is unique and has its own number in the order of initialization on the page
+ // for example array 3x1 initialized before than array 2x1 will have the number 1 in vm prop
+ };
+ Cell.prototype.setCm = function(val) {
+ this.cm = val;
+ };
+ Cell.prototype.setVm = function(val) {
+ this.vm = val;
+ };
//-------------------------------------------------------------------------------------------------
function CCellWithFormula(ws, row, col) {
@@ -15492,7 +16480,7 @@
var shared = parsed.getShared();
if (shared) {
var index = wb.workbookFormulas.add(parsed).getIndexNumber();
- History.Add(AscCommonExcel.g_oUndoRedoSharedFormula, AscCH.historyitem_SharedFormula_ChangeFormula, null, null, new UndoRedoData_IndexSimpleProp(index, false, parsed.getFormulaRaw(), eventData.assemble), true);
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoSharedFormula, AscCH.historyitem_SharedFormula_ChangeFormula, null, null, new UndoRedoData_IndexSimpleProp(index, false, parsed.getFormulaRaw(), eventData.assemble), true);
wb.dependencyFormulas.addToChangedRange2(this.ws.getId(), shared.ref);
} else {
this.ws._getCell(this.nRow, this.nCol, function(cell) {
@@ -16064,9 +17052,9 @@
return new Range(this.worksheet, r1, c1, r2, c2);
}
};
- Range.prototype.setValue=function(val, callback, isCopyPaste, byRef, ignoreHyperlink){
- History.Create_NewPoint();
- History.StartTransaction();
+ Range.prototype.setValue=function(val, callback, isCopyPaste, byRef, ignoreHyperlink, dynamicRange){
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
//не хотелось бы вводить дополнительный параметр, поэтому если byRef == null
//то в качестве значения придёт формула, которой необходимо сделать offset в зависимости от range
//при вызове данной функции обратить внимание на параметр byRef
@@ -16089,13 +17077,14 @@
var offset = new AscCommon.CellBase(cell.nRow - activeCell.row, cell.nCol - activeCell.col);
_val = "=" + _formula.changeOffset(offset, null, true).assembleLocale(AscCommonExcel.cFormulaFunctionToLocale, true, true);
}
- cell.setValue(_val, callback, isCopyPaste, byRef, ignoreHyperlink);
+ // when creating new array formulas, it is necessary to transfer information about the dynamic array because regular ref is used
+ cell.setValue(_val, callback, isCopyPaste, byRef, ignoreHyperlink, dynamicRange);
});
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype.setValue2=function(array, pushOnlyFirstMergedCell){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
//[{"text":"qwe","format":{"b":true, "i":false, "u":Asc.EUnderline.underlineNone, "s":false, "fn":"Arial", "fs": 12, "c": 0xff00ff, "va": "subscript" }},{}...]
/*
Устанавливаем значение в Range ячеек. В отличае от setValue, сюда мы попадаем только в случае ввода значения отличного от формулы. Таким образом, если в ячейке была формула, то для нее в графе очищается список ячеек от которых зависела. После чего выставляем флаг о необходимости пересчета.
@@ -16113,20 +17102,20 @@
// if(cell.isEmpty())
// cell.Remove();
});
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
this.worksheet.workbook.oApi.onWorksheetChange(this.bbox);
};
Range.prototype.setValueData = function(val){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
this._foreach(function(cell){
cell.setValueData(val);
});
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype.setCellStyle=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var oStyle;
@@ -16154,7 +17143,7 @@
if (val === null) {
return;
}
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16194,7 +17183,7 @@
this.setNumFormatPivot(val);
};
Range.prototype.setNum = function(val) {
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16215,7 +17204,7 @@
});
};
Range.prototype.getShiftedNumFormat=function(nShift, dDigitsCount){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
let newNumFormat;
this._setPropertyNoEmpty(null, null, function(cell, nRow0, nCol0, nRowStart, nColStart){
newNumFormat = cell.getShiftedNumFormat(nShift, dDigitsCount);
@@ -16223,7 +17212,7 @@
return newNumFormat;
};
Range.prototype.setFont=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16245,7 +17234,7 @@
});
};
Range.prototype.setFontname=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16267,7 +17256,7 @@
});
};
Range.prototype.setFontsize=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16289,7 +17278,7 @@
});
};
Range.prototype.setFontcolor=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16311,7 +17300,7 @@
});
};
Range.prototype.setBold=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16333,7 +17322,7 @@
});
};
Range.prototype.setItalic=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16355,7 +17344,7 @@
});
};
Range.prototype.setUnderline=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16377,7 +17366,7 @@
});
};
Range.prototype.setStrikeout=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16399,7 +17388,7 @@
});
};
Range.prototype.setFontAlign=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16421,7 +17410,7 @@
});
};
Range.prototype.setAlignVertical=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16443,7 +17432,7 @@
});
};
Range.prototype.setAlignHorizontal=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16465,7 +17454,7 @@
});
};
Range.prototype.setFill=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16492,8 +17481,8 @@
return this.setFill(fill);
};
Range.prototype.setBorderSrc=function(border){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
if (null == border)
border = new Border();
this.createCellOnRowColCross();
@@ -16515,7 +17504,7 @@
function(cell){
cell.setBorder(border.clone());
});
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype._setBorderMerge=function(bLeft, bTop, bRight, bBottom, oNewBorder, oCurBorder){
var oTargetBorder = new Border();
@@ -16634,7 +17623,7 @@
Range.prototype.setBorder=function(border){
//border = null очисть border
//"ih" - внутренние горизонтальные, "iv" - внутренние вертикальные
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
var _this = this;
var oBBox = this.bbox;
this.createCellOnRowColCross();
@@ -16684,7 +17673,7 @@
}
};
Range.prototype.setShrinkToFit=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16706,7 +17695,7 @@
});
};
Range.prototype.setWrap=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16728,7 +17717,7 @@
});
};
Range.prototype.setAngle=function(val){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16753,7 +17742,7 @@
if (val < 0) {
return;
}
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16773,7 +17762,7 @@
});
};
Range.prototype.setApplyProtection = function (val) {
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16793,7 +17782,7 @@
});
};
Range.prototype.setLocked = function (val) {
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16813,7 +17802,7 @@
});
};
Range.prototype.setHiddenFormulas = function (val) {
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16833,7 +17822,7 @@
});
};
Range.prototype.setType=function(type){
- History.Create_NewPoint();
+ AscCommon.History.Create_NewPoint();
this.createCellOnRowColCross();
var fSetProperty = this._setProperty;
var nRangeType = this._getRangeType();
@@ -16845,13 +17834,13 @@
});
};
Range.prototype.changeTextCase=function(type){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
this._setPropertyNoEmpty(null, null,function(cell){
cell.changeTextCase(type);
});
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype.getType=function(){
var type;
@@ -17304,12 +18293,12 @@
if(null == type)
type = Asc.c_oAscMergeOptions.Merge;
var oBBox = this.bbox;
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
if(oBBox.r1 == oBBox.r2 && oBBox.c1 == oBBox.c2){
if(type == Asc.c_oAscMergeOptions.MergeCenter)
this.setAlignHorizontal(AscCommon.align_Center);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
return;
}
if(this.hasMerged())
@@ -17319,7 +18308,7 @@
{
//сбрасываем AlignHorizontal
this.setAlignHorizontal(null);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
return;
}
}
@@ -17632,14 +18621,14 @@
}
this.worksheet.workbook.handlers.trigger("changeDocument", AscCommonExcel.docChangedType.mergeRange, null, this.bbox, this.worksheet.getId());
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype.unmerge=function(bOnlyInRange){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
if(false == this.worksheet.workbook.bUndoChanges && false == this.worksheet.workbook.bRedoChanges)
this.worksheet.mergeManager.remove(this.bbox);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype._getHyperlinks=function(){
var nRangeType = this._getRangeType();
@@ -17732,8 +18721,8 @@
}
if(false == bExist)
{
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
if(false == this.worksheet.workbook.bUndoChanges && false == this.worksheet.workbook.bRedoChanges)
{
//удаляем ссылки с тем же адресом
@@ -17756,21 +18745,21 @@
}
if(false == this.worksheet.workbook.bUndoChanges && false == this.worksheet.workbook.bRedoChanges)
this.worksheet.hyperlinkManager.add(val.Ref.getBBox0(), val);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
}
};
Range.prototype.removeHyperlink = function (elem, removeStyle) {
var bbox = this.bbox;
if(false == this.worksheet.workbook.bUndoChanges && false == this.worksheet.workbook.bRedoChanges)
{
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
var oChangeParam = { removeStyle: removeStyle };
if(elem)
this.worksheet.hyperlinkManager.removeElement(elem, oChangeParam);
else
this.worksheet.hyperlinkManager.remove(bbox, !bbox.isOneCell(), oChangeParam);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
}
};
Range.prototype.deleteCellsShiftUp=function(preDeleteAction){
@@ -17845,12 +18834,12 @@
var mergeManager = this.worksheet.mergeManager;
this.worksheet.workbook.dependencyFormulas.lockRecal();
//todo вставить предупреждение, что будет unmerge
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
var oShiftGet = null;
if (false == this.worksheet.workbook.bUndoChanges && (false == this.worksheet.workbook.bRedoChanges || this.worksheet.workbook.bCollaborativeChanges))
{
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
oShiftGet = mergeManager.shiftGet(this.bbox, true);
var aMerged = oShiftGet.elems;
if(null != aMerged.outer && aMerged.outer.length > 0)
@@ -17868,7 +18857,7 @@
if(bChanged)
oShiftGet = null;
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
//сдвигаем ячейки
if(bLeft)
@@ -17887,12 +18876,12 @@
}
if (false == this.worksheet.workbook.bUndoChanges && (false == this.worksheet.workbook.bRedoChanges || this.worksheet.workbook.bCollaborativeChanges))
{
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
mergeManager.shift(this.bbox, !bLeft, true, oShiftGet);
this.worksheet.hyperlinkManager.shift(this.bbox, !bLeft, true);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
this.worksheet.workbook.dependencyFormulas.unlockRecal();
return true;
};
@@ -17956,12 +18945,12 @@
var mergeManager = this.worksheet.mergeManager;
this.worksheet.workbook.dependencyFormulas.lockRecal();
//todo вставить предупреждение, что будет unmerge
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
var oShiftGet = null;
if (false == this.worksheet.workbook.bUndoChanges && (false == this.worksheet.workbook.bRedoChanges || this.worksheet.workbook.bCollaborativeChanges))
{
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
oShiftGet = mergeManager.shiftGet(this.bbox, false);
var aMerged = oShiftGet.elems;
if(null != aMerged.outer && aMerged.outer.length > 0)
@@ -17979,7 +18968,7 @@
if(bChanged)
oShiftGet = null;
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
//сдвигаем ячейки
if(bUp)
@@ -17998,12 +18987,12 @@
}
if (false == this.worksheet.workbook.bUndoChanges && (false == this.worksheet.workbook.bRedoChanges || this.worksheet.workbook.bCollaborativeChanges))
{
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
mergeManager.shift(this.bbox, !bUp, false, oShiftGet);
this.worksheet.hyperlinkManager.shift(this.bbox, !bUp, false);
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
this.worksheet.workbook.dependencyFormulas.unlockRecal();
return true;
};
@@ -18031,8 +19020,8 @@
return null;
};
Range.prototype.cleanFormat=function(){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
this.unmerge();
this._setPropertyNoEmpty(function(row){
row.setStyle(null);
@@ -18047,22 +19036,33 @@
// if(cell.isEmpty())
// cell.Remove();
});
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
- Range.prototype.cleanText=function(){
+ Range.prototype.cleanText = function () {
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
+ this._setPropertyNoEmpty(null, null,
+ function (cell, nRow0, nCol0, nRowStart, nColStart) {
+ cell.setValue("");
+ // if(cell.isEmpty())
+ // cell.Remove();
+ });
+ AscCommon.History.EndTransaction();
+ };
+ Range.prototype.cleanTextExceptFirst = function () {
History.Create_NewPoint();
History.StartTransaction();
this._setPropertyNoEmpty(null, null,
- function(cell, nRow0, nCol0, nRowStart, nColStart){
- cell.setValue("");
- // if(cell.isEmpty())
- // cell.Remove();
- });
+ function (cell, nRow0, nCol0, nRowStart, nColStart) {
+ if (!(cell.nRow === nRowStart && cell.nCol === nColStart)) {
+ cell.setValue("");
+ }
+ });
History.EndTransaction();
};
Range.prototype.cleanAll=function(){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
this.unmerge();
//удаляем только гиперссылки, которые полностью лежат в области
var aHyperlinks = this.worksheet.hyperlinkManager.get(this.bbox);
@@ -18082,16 +19082,16 @@
});
this.worksheet.workbook.dependencyFormulas.calcTree();
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype.cleanHyperlinks=function(){
- History.Create_NewPoint();
- History.StartTransaction();
+ AscCommon.History.Create_NewPoint();
+ AscCommon.History.StartTransaction();
//удаляем только гиперссылки, которые полностью лежат в области
var aHyperlinks = this.worksheet.hyperlinkManager.get(this.bbox);
for(var i = 0, length = aHyperlinks.inner.length; i < length; ++i)
this.removeHyperlink(aHyperlinks.inner[i]);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
};
Range.prototype.sort = function (nOption, nStartRowCol, sortColor, opt_guessHeader, opt_by_row, opt_custom_sort) {
var bbox = this.bbox;
@@ -18226,20 +19226,20 @@
}
}
- History.Create_NewPoint();
- var oSelection = History.GetSelection();
+ AscCommon.History.Create_NewPoint();
+ var oSelection = AscCommon.History.GetSelection();
if (null != oSelection) {
oSelection = oSelection.clone();
oSelection.assign(nColFirst0, nRowFirst0, nLastCol0, nLastRow0);
- History.SetSelection(oSelection);
- History.SetSelectionRedo(oSelection);
+ AscCommon.History.SetSelection(oSelection);
+ AscCommon.History.SetSelectionRedo(oSelection);
}
var oUndoRedoBBox = new UndoRedoData_BBox({r1: nRowFirst0, c1: nColFirst0, r2: nLastRow0, c2: nLastCol0});
oRes = new AscCommonExcel.UndoRedoData_SortData(oUndoRedoBBox, aSortData, opt_by_row);
this._sortByArray(oUndoRedoBBox, aSortData, null, opt_by_row);
var range = opt_by_row ? new Asc.Range(nColFirst0, 0, nLastCol0, gc_nMaxRow0) : new Asc.Range(0, nRowFirst0, gc_nMaxCol0, nLastRow0);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Sort, this.worksheet.getId(), range, oRes)
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_Sort, this.worksheet.getId(), range, oRes)
}
this.worksheet.workbook.dependencyFormulas.unlockRecal();
return oRes;
@@ -18595,7 +19595,7 @@
//сортируются только одинарные гиперссылки, все неодинарные оставляем
var aSortedHyperlinks = [], hyp;
if (false == this.worksheet.workbook.bUndoChanges && (false == this.worksheet.workbook.bRedoChanges || this.worksheet.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
var aHyperlinks = this.worksheet.hyperlinkManager.get(this.bbox);
for (i = 0, length = aHyperlinks.inner.length; i < length; i++) {
var elem = aHyperlinks.inner[i];
@@ -18617,7 +19617,7 @@
}
}
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
var tempRange = this.worksheet.getRange3(oBBox.r1, oBBox.c1, oBBox.r2, oBBox.c2);
@@ -18689,7 +19689,7 @@
}
if (false == this.worksheet.workbook.bUndoChanges && (false == this.worksheet.workbook.bRedoChanges || this.worksheet.workbook.bCollaborativeChanges)) {
- History.LocalChange = true;
+ AscCommon.History.LocalChange = true;
//восстанавливаем удаленые гиперссылки
if (aSortedHyperlinks.length > 0) {
for (i = 0, length = aSortedHyperlinks.length; i < length; i++) {
@@ -18697,7 +19697,7 @@
this.worksheet.hyperlinkManager.add(hyp.Ref.getBBox0(), hyp);
}
}
- History.LocalChange = false;
+ AscCommon.History.LocalChange = false;
}
};
Range.prototype.fillData=function(data){
@@ -18864,20 +19864,20 @@
var oCanPromote = _canPromote(from, wsFrom, to, wsTo, false, 1, 1, bVertical, nIndex);
if(null != oCanPromote)
{
- History.Create_NewPoint();
- var oSelection = History.GetSelection();
+ AscCommon.History.Create_NewPoint();
+ var oSelection = AscCommon.History.GetSelection();
if(null != oSelection)
{
oSelection = oSelection.clone();
oSelection.assign(from.c1, from.r1, from.c2, from.r2);
- History.SetSelection(oSelection);
+ AscCommon.History.SetSelection(oSelection);
}
- var oSelectionRedo = History.GetSelectionRedo();
+ var oSelectionRedo = AscCommon.History.GetSelectionRedo();
if(null != oSelectionRedo)
{
oSelectionRedo = oSelectionRedo.clone();
oSelectionRedo.assign(to.c1, to.r1, to.c2, to.r2);
- History.SetSelectionRedo(oSelectionRedo);
+ AscCommon.History.SetSelectionRedo(oSelectionRedo);
}
//удаляем merge ячейки в to(после _canPromote должны остаться только inner)
wsTo.mergeManager.remove(to, true);
@@ -18937,15 +19937,15 @@
var nWidth = oBBox.c2 - oBBox.c1 + 1;
var nHeight = oBBox.r2 - oBBox.r1 + 1;
- History.Create_NewPoint();
- var oSelection = History.GetSelection();
+ AscCommon.History.Create_NewPoint();
+ var oSelection = AscCommon.History.GetSelection();
if(null != oSelection)
{
oSelection = oSelection.clone();
oSelection.assign(oBBox.c1, oBBox.r1, oBBox.c2, oBBox.r2);
- History.SetSelection(oSelection);
+ AscCommon.History.SetSelection(oSelection);
}
- var oSelectionRedo = History.GetSelectionRedo();
+ var oSelectionRedo = AscCommon.History.GetSelectionRedo();
if(null != oSelectionRedo)
{
oSelectionRedo = oSelectionRedo.clone();
@@ -18978,7 +19978,7 @@
oSelectionRedo.assign(oBBox.c1 + nIndex, oBBox.r1, oBBox.c2, oBBox.r2);
}
}
- History.SetSelectionRedo(oSelectionRedo);
+ AscCommon.History.SetSelectionRedo(oSelectionRedo);
}
_promoteFromTo(oBBox, this.worksheet, oCanPromote.to, this.worksheet, true, oCanPromote, bCtrl, bVertical, nIndex);
};
@@ -19108,7 +20108,7 @@
const oDefaultCultureInfo = AscCommon.g_oDefaultCultureInfo;
wb.dependencyFormulas.lockRecal();
- History.StartTransaction();
+ AscCommon.History.StartTransaction();
var oldExcludeHiddenRows = wsFrom.bExcludeHiddenRows;
if(wsFrom.autoFilters.bIsExcludeHiddenRows(from, wsFrom.selectionRange.activeCell)){
@@ -19151,7 +20151,7 @@
var oOldProps = row.getHeightProp();
if (false === oOldProps.isEqual(oNewProps)) {
row.setHeightProp(oNewProps);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, wsTo.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(nCurIndex, true, oOldProps, oNewProps));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp, wsTo.getId(), row._getUpdateRange(), new UndoRedoData_IndexSimpleProp(nCurIndex, true, oOldProps, oNewProps));
}
}
});
@@ -19197,7 +20197,7 @@
if (false == oOldProps.isEqual(oNewProps)) {
col.setWidthProp(oNewProps);
wsTo.initColumn(col);
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, wsTo.getId(), new Asc.Range(nCurIndex, 0, nCurIndex, gc_nMaxRow0), new UndoRedoData_IndexSimpleProp(nCurIndex, false, oOldProps, oNewProps));
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ColProp, wsTo.getId(), new Asc.Range(nCurIndex, 0, nCurIndex, gc_nMaxRow0), new UndoRedoData_IndexSimpleProp(nCurIndex, false, oOldProps, oNewProps));
}
}
}
@@ -19481,7 +20481,7 @@
var rangeFormulaArray = oCopyCell.ws.getRange3(intersectionTo.r1, intersectionTo.c1, intersectionTo.r2, intersectionTo.c2);
rangeFormulaArray.setValue("=" + _p_.assemble(true), function (r) {}, null, intersectionTo);
- History.Add(AscCommonExcel.g_oUndoRedoArrayFormula,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoArrayFormula,
AscCH.historyitem_ArrayFromula_AddFormula, oCopyCell.ws.getId(),
new Asc.Range(intersectionTo.c1, intersectionTo.r1, intersectionTo.c2, intersectionTo.r2),
new AscCommonExcel.UndoRedoData_ArrayFormula(intersectionTo, "=" + oCopyCell.getFormulaParsed().assemble(true)));
@@ -19493,7 +20493,12 @@
_p_ = oFromCell.getFormulaParsed().clone(null, oFromCell, this);
offset = oCopyCell.getOffset2(oFromCell.getName());
assemb = _p_.changeOffset(offset).assemble(true);
- oCopyCell.setFormula(assemb);
+ let oCaProps = {};
+ if (_p_.ca) { // for recursion formulas
+ oCaProps.ca = _p_.ca;
+ oCaProps.oldValue = oFromCell.getNumberValue();
+ }
+ oCopyCell.setFormula(assemb, null, null, oCaProps);
}
}
@@ -19665,7 +20670,7 @@
}
wsFrom.excludeHiddenRows(oldExcludeHiddenRows);
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
wb.dependencyFormulas.unlockRecal();
}
Range.prototype.createCellOnRowColCross=function(){
@@ -19706,69 +20711,208 @@
this.worksheet._moveRange(this.bbox, oBBoxTo, copyRange, wsTo);
};
- function RowIterator() {
+ function SweepLineRowIterator() {
+ this.cellsByCol = null;
+ this.row = -1;
+ this.col = -1;
+ this.colData = null;
+
+ this.colDatas = [];
+ this.colDatasCol = [];
+ this.colDatasIndex = 0;
+
+ this.toInsert = [];
+ this.toInsertIndex = 0;
+ this.toDelete = [];
+ this.toDeleteIndex = 0;
+
+ this.r1 = [];
+ this.r1Index = 0;
+ this.r2 = [];
+ this.r2Index = 0;
}
- RowIterator.prototype.init = function(ws, r1, c1, c2) {
- this.ws = ws;
- this.cell = new Cell(ws);
- this.c1 = c1;
- this.c2 = Math.min(c2, ws.getColDataLength() - 1);
- this.indexRow = r1;
- this.indexCol = 0;
+ SweepLineRowIterator.prototype.init = function (cellsByCol, r1, c1, c2) {
+ this.cellsByCol = cellsByCol;
+ this.row = r1 - 1;
+ this.col = -1;
+ this.colData = null;
this.colDatas = [];
- this.colDatasIndex = [];
- for (var i = this.c1; i <= this.c2; i++) {
- var colData = this.ws.getColDataNoEmpty(i);
- if (colData) {
- this.colDatas.push(colData);
- this.colDatasIndex.push(i);
+ this.colDatasCol = [];
+ this.colDatasIndex = 0;
+
+ this.toInsert = [];
+ this.toInsertIndex = 0;
+ this.toDelete = [];
+ this.toDeleteIndex = 0;
+ this.r1 = [];
+ this.r1Index = 0;
+ this.r2 = [];
+ this.r2Index = 0;
+
+ c2 = Math.min(c2, this.cellsByCol.length - 1);
+ for (let i = c1; i <= c2; i++) {
+ let colData = this.cellsByCol[i];
+ if (colData && r1 <= colData.getMaxIndex()) {
+ //minIndex is max of
+ let elem = {col: i, minIndex: Math.max(r1, colData.getMinIndex()), maxIndex: colData.getMaxIndex(), isInserted: false}
+ this.r1.push(elem);
+ this.r2.push(elem);
+ }
+ }
+ //Array.sort is stable in all browsers
+ //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
+ this.r1.sort(function (a, b) {
+ return a.minIndex - b.minIndex
+ });
+ this.r2.sort(function (a, b) {
+ return a.maxIndex - b.maxIndex
+ });
+ };
+ SweepLineRowIterator.prototype.setRow = function (row) {
+ while (this.row < row) {
+ //structure of r1 and r2 forces rows to be changed with fixed step
+ this.nextRow();
+ if (this.row < row) {
+ while (this.nextCol()) {
+ }
}
}
+ }
+ SweepLineRowIterator.prototype.nextRow = function () {
+ this.row++;
+ this.col = -1;
+ this.colData = null;
+ this.colDatasIndex = 0;
+ while (this.r1Index < this.r1.length && this.row >= this.r1[this.r1Index].minIndex) {
+ let elem = this.r1[this.r1Index];
+ if (this.row <= elem.maxIndex) {
+ elem.isInserted = true;
+ this.toInsert.push(elem.col);
+ }
+ this.r1Index++;
+ }
+ while (this.r2Index < this.r2.length && this.row > this.r2[this.r2Index].maxIndex) {
+ let elem = this.r2[this.r2Index];
+ if (elem.isInserted) {
+ this.toDelete.push(elem.col);
+ }
+ this.r2Index++;
+ }
+ }
+ SweepLineRowIterator.prototype.nextCol = function () {
+ this.col = -1;
+ this.colData = null;
+ if (this.colDatasIndex < this.colDatasCol.length) {
+ this.col = this.colDatasCol[this.colDatasIndex];
+ this.colData = this.colDatas[this.colDatasIndex];
+ this.colDatasIndex++;
+ //delete
+ let toDeleteOld = this.toDeleteIndex;
+ while (this.toDeleteIndex < this.toDelete.length && this.toDelete[this.toDeleteIndex] === this.col) {
+ this.toDeleteIndex++;
+ if (this.colDatasIndex < this.colDatasCol.length) {
+ this.col = this.colDatasCol[this.colDatasIndex];
+ this.colData = this.colDatas[this.colDatasIndex];
+ this.colDatasIndex++;
+ } else {
+ this.col = -1;
+ this.colData = undefined;
+ }
+ }
+ if (toDeleteOld !== this.toDeleteIndex) {
+ let deleteCount = this.toDeleteIndex - toDeleteOld;
+ this.colDatasIndex -= -1 === this.col ? deleteCount : deleteCount + 1;
+ this.colDatas.splice(this.colDatasIndex, deleteCount);
+ this.colDatasCol.splice(this.colDatasIndex, deleteCount);
+ if (this.colDatasIndex < this.colDatasCol.length) {
+ this.col = this.colDatasCol[this.colDatasIndex];
+ this.colData = this.colDatas[this.colDatasIndex];
+ this.colDatasIndex++;
+ } else {
+ this.col = -1;
+ this.colData = undefined;
+ }
+ }
+ }
+ //insert
+ let toInsertOld = this.toInsertIndex;
+ if (-1 !== this.col) {
+ while (this.toInsertIndex < this.toInsert.length && this.toInsert[this.toInsertIndex] < this.col) {
+ this.toInsertIndex++;
+ }
+ } else {
+ this.toInsertIndex = this.toInsert.length;
+ }
+ if (toInsertOld !== this.toInsertIndex) {
+ let cols = [];
+ let datas = [];
+ for (let i = toInsertOld; i < this.toInsertIndex; ++i) {
+ let curCol = this.toInsert[i];
+ let colData = this.cellsByCol[curCol];
+ if (colData && this.row <= colData.getMaxIndex()) {
+ cols.push(curCol);
+ datas.push(colData);
+ }
+ }
+ if (-1 !== this.col) {
+ this.colDatasIndex--;
+ }
+ this.colDatas.splice.apply(this.colDatas, [this.colDatasIndex, 0].concat(datas));
+ this.colDatasCol.splice.apply(this.colDatasCol, [this.colDatasIndex, 0].concat(cols));
+
+ if (this.colDatasIndex < this.colDatasCol.length) {
+ this.col = this.colDatasCol[this.colDatasIndex];
+ this.colData = this.colDatas[this.colDatasIndex];
+ this.colDatasIndex++;
+ } else {
+ this.col = -1;
+ this.colData = undefined;
+ }
+ }
+ return -1 !== this.col;
+ };
+
+ function RowIterator() {
+ }
+
+ RowIterator.prototype.init = function (ws, r1, c1, c2) {
+ this.ws = ws;
+ this.cell = new Cell(ws);
this.ws.workbook.loadCells.push(this.cell);
+
+ this.iter = new SweepLineRowIterator();
+ this.iter.init(ws.cellsByCol, r1, c1, c2);
};
- RowIterator.prototype.release = function() {
+ RowIterator.prototype.release = function () {
this.cell.saveContent(true);
this.ws.workbook.loadCells.pop();
};
- RowIterator.prototype.setRow = function(index) {
- this.indexRow = index;
- this.indexCol = 0;
+ RowIterator.prototype.setRow = function (index) {
+ this.iter.setRow(index);
};
- RowIterator.prototype.next = function() {
+ RowIterator.prototype.next = function () {
var wb = this.ws.workbook;
this.cell.saveContent(true);
- for (; this.indexCol < this.colDatasIndex.length; this.indexCol++) {
- var colData = this.colDatas[this.indexCol];
- var nCol = this.colDatasIndex[this.indexCol];
- if (colData.hasIndex(this.indexRow)) {
- var targetCell = null;
- for (var k = 0; k < wb.loadCells.length - 1; ++k) {
- var elem = wb.loadCells[k];
- if (elem.nRow == this.indexRow && elem.nCol == nCol && this.ws === elem.ws) {
- targetCell = elem;
- break;
- }
- }
- if (null === targetCell) {
- if (this.cell.loadContent(this.indexRow, nCol, colData)) {
- this.indexCol++;
- return this.cell;
- }
- } else {
- this.indexCol++;
- return targetCell;
+ while (this.iter.nextCol()) {
+ var nRow = this.iter.row;
+ var nCol = this.iter.col;
+ var colData = this.iter.colData;
+ var targetCell = null;
+ for (var k = 0; k < wb.loadCells.length - 1; ++k) {
+ var elem = wb.loadCells[k];
+ if (elem.nRow === nRow && elem.nCol === nCol && this.ws === elem.ws) {
+ targetCell = elem;
+ break;
}
- } else if (colData.getMaxIndex() < this.indexRow) {
- //splice by one element is too slow
- var endIndex = this.indexCol + 1;
- while (endIndex < this.colDatasIndex.length && this.colDatas[endIndex].getMaxIndex() < this.indexRow) {
- endIndex++;
+ }
+ if (null === targetCell) {
+ if (this.cell.loadContent(nRow, nCol, colData)) {
+ return this.cell;
}
- this.colDatas.splice(this.indexCol, endIndex - this.indexCol);
- this.colDatasIndex.splice(this.indexCol, endIndex - this.indexCol);
- this.indexCol--;
+ } else {
+ return targetCell;
}
}
};
@@ -19798,6 +20942,7 @@
this.nColLength = this.bbox.c2 - this.bbox.c1 + 1;
}
this.bFillHandleRightClick = false;
+ this.bOneSelectedCell = false;
}
PromoteHelper.prototype = {
add: function(nRow, nCol, nVal, bDelimiter, sPrefix, padding, bDate, oAdditional, aTimePeriods){
@@ -19815,6 +20960,15 @@
this.oDataRow[nRow] = row;
}
row[nCol] = new cDataRow(nCol, nVal, bDelimiter, sPrefix, padding, bDate, oAdditional, aTimePeriods);
+ // Checking Date format has Date & Time
+ if (bDate && oAdditional.xfs && oAdditional.xfs.num && oAdditional.xfs.num.getFormat()) {
+ let oNumFormat = oNumFormatCache.get(oAdditional.xfs.num.getFormat());
+ if (oNumFormat.isTimeFormat() && oNumFormat.isDateFormat()) {
+ row[nCol].setIsDateTime(true);
+ } else if (oNumFormat.isTimeFormat() && !oNumFormat.isDateFormat()) {
+ row[nCol].setIsTime(true);
+ }
+ }
},
isOnlyIntegerSequence: function(){
var bRes = true;
@@ -19944,7 +21098,7 @@
var nMaxPadding = 0;
//анализируем последовательность, если числа расположены не на одинаковом расстоянии, то считаем их сплошной последовательностью
//последовательность с промежутками может быть только целочисленной
- for(var i = 0, length = aCurSequence.length; i < length; i++) {
+ for(let i = 0, length = aCurSequence.length; i < length; i++) {
var data = aCurSequence[i];
var nCurX = data.getCol();
let nCurVal = data.getVal();
@@ -19984,7 +21138,7 @@
var bExistSpace = false;
nPrevX = null;
var aDigits = [];
- for(var i = 0, length = aCurSequence.length; i < length; i++) {
+ for (let i = 0, length = aCurSequence.length; i < length; i++) {
var data = aCurSequence[i];
data.setPadding(nMaxPadding);
var nCurX = data.getCol();
@@ -19995,25 +21149,93 @@
bExistSpace = true;
var y = data.getVal();
//даты автозаполняем только по целой части
- if(data.getIsDate())
+ if(data.getIsDate() && !data.getIsDateTime() && !data.getIsMixedDateFormat() && !data.getIsTime()) {
y = parseInt(y);
+ }
aDigits.push({x: x, y: y});
nPrevX = nCurX;
}
if(aDigits.length > 0) {
- var oSequence = this._promoteSequence(aDigits);
- if(1 == aDigits.length && this.bReverse) {
- //меняем коэффициенты для случая одного числа в последовательности, иначе она в любую сторону будет возрастающей
- oSequence.a1 *= -1;
+ let bMixedDateFormat = oFirstData.getIsMixedDateFormat();
+ let bTime = oFirstData.getIsTime();
+ let oSequence = null;
+
+ if (bMixedDateFormat) {
+ /* In a mixed date format, the promotion sequence should be calculated similarly to the Date format.
+ But, the original array should be saved to use the time portion of the cell with the Date & Time format
+ as a constant value for the correct sequence. */
+ let aIntDigits = aDigits.map(function (elem) {
+ return {x: elem.x, y: parseInt(elem.y)};
+ });
+ oSequence = this._promoteSequence(aIntDigits);
+ } else {
+ oSequence = this._promoteSequence(aDigits);
+ }
+ if (aDigits.length === 1) {
+ this.setIsOneSelectedCell(true);
+ if (bTime) {
+ // For one selected cell, step for Time format must be 1 hour.
+ // The time component of a serial value increases by 1/86,400 each second.
+ oSequence.a1 = (1 / 86400) * 3600;
+ }
+ if (this.bReverse) {
+ //меняем коэффициенты для случая одного числа в последовательности, иначе она в любую сторону будет возрастающей
+ oSequence.a1 *= -1;
+ if (bTime && oSequence.a0 === 0) {
+ oSequence.a0 = 1;
+ }
+ }
}
- var bIsIntegerSequence = oSequence.a1 != parseInt(oSequence.a1);
//для дат и чисел с префиксом автозаполняются только целочисленные последовательности
+ let bIsNotIntegerSequence = oSequence.a1 !== parseInt(oSequence.a1);
let sPrefix = oFirstData.getPrefix();
let bDate = oFirstData.getIsDate();
+ let bDateTime = oFirstData.getIsDateTime();
let bDelimiter = oFirstData.getDelimiter();
- if(!((null != sPrefix || true == bDate) && bIsIntegerSequence)) {
- if(false == bWithSpace && bExistSpace) {
- for(var i = nMinIndex; i <= nMaxIndex; i++) {
+ // For Date format
+ let bStepForDateIsZero = bDate && oSequence.a1 === 0;
+ let bIntStartValue = bDate && oSequence.a0 === parseInt(oSequence.a0);
+ // For Date & Time format
+ let bDayOfDateDiff = aDigits.length > 1 ? Math.floor(aDigits[0].y) !== Math.floor(aDigits[1].y) : true;
+ let bDateTimeSeqIsCorrect = aDigits[0].y.toFixed(3) === oSequence.a0.toFixed(3);
+ // If Date & Time format hasn't diff in days of date, but sequence by time is not correct we use step = 0
+ // and start sequence point is equal first element of aDigits or for reverse sequence the last element of aDigit.
+ if (bDateTime && !bDayOfDateDiff && !bDateTimeSeqIsCorrect && (oSequence.a1 < 1 && oSequence.a1 > -1)) {
+ oSequence.a0 = this.bReverse ? aDigits[aDigits.length - 1].y : aDigits[0].y;
+ oSequence.a1 = parseInt(oSequence.a1);
+ }
+ if (bMixedDateFormat) {
+ // The start element needs to add part of the time from the first (or last for reverse sequences) cell
+ // with Date & Time format from the selected range.
+ let aDigitsWithDateTime = aDigits.filter(function(item) {
+ return item.y !== parseInt(item.y);
+ });
+ let nDateTimeVal = this.bReverse ? aDigitsWithDateTime[aDigitsWithDateTime.length - 1].y : aDigitsWithDateTime[0].y;
+ let nTimePart = nDateTimeVal - parseInt(nDateTimeVal);
+ oSequence.a0 = parseInt(oSequence.a0) + nTimePart;
+ }
+ if (bTime && bDayOfDateDiff && aDigits.length > 1) {
+ if (this.bReverse && aDigits[0].y - aDigits[aDigits.length - 1].y >= 1) {
+ let nDateVal = parseInt(aDigits[aDigits.length - 1].y)
+ oSequence.a0 = (oSequence.a0 - parseInt(oSequence.a0)) + nDateVal;
+ }
+ oSequence.a1 = oSequence.a1 - parseInt(oSequence.a1);
+ }
+ if(!((sPrefix != null || (bDate && !bDateTime && !bMixedDateFormat && !bTime)) && bIsNotIntegerSequence)) {
+ // If for Date or Date & Time format the sequence is not correct or sequence step is 0, skip work with oSequence
+ if (bDate) {
+ if (bStepForDateIsZero && !bDateTime && !bMixedDateFormat) {
+ return;
+ }
+ if (!bIntStartValue && !bDateTime && !bTime) {
+ return;
+ }
+ if (bDateTime && bDayOfDateDiff && !bDateTimeSeqIsCorrect) {
+ return;
+ }
+ }
+ if(!bWithSpace && bExistSpace) {
+ for (let i = nMinIndex; i <= nMaxIndex; i++) {
var data = row[i];
if(null == data) {
data = new cDataRow(i, null, bDelimiter, sPrefix, null, bDate);
@@ -20023,7 +21245,7 @@
}
}
else {
- for(var i = 0, length = aCurSequence.length; i < length; i++) {
+ for(let i = 0, length = aCurSequence.length; i < length; i++) {
var nCurX = aCurSequence[i].nCol;
if(null != nCurX)
row[nCurX].setSequence(oSequence);
@@ -20053,6 +21275,17 @@
for(var j = 0, length2 = aSortIndex.length; j < length2; j++) {
var nColIndex = aSortIndex[j];
var rowData = row[nColIndex];
+ let rowDataNext = nColIndex + 1 < length2 && row[nColIndex + 1];
+ let bDate = rowData.getIsDate();
+ let bDateTime = rowData.getIsDateTime();
+ let bDateNextRow = rowDataNext && rowDataNext.getIsDate();
+ let bDateTimeNextRow = rowDataNext && rowDataNext.getIsDateTime();
+ if ((bDate && bDateTime && bDateNextRow && !bDateTimeNextRow) || (bDate && !bDateTime && bDateNextRow && bDateTimeNextRow)) {
+ let nFirstColIndex = aSortIndex[0];
+ let oFirstRowData = row[nFirstColIndex];
+ oFirstRowData.setIsMixedDateFormat(true);
+ oFirstRowData.setIsDateTime(false);
+ }
var bAddToSequence = false;
let nVal = rowData.getVal();
let bDelimiter = rowData.getDelimiter();
@@ -20083,18 +21316,28 @@
this.oCurRow = this.oDataRow[index];
this.nCurColIndex = 0;
},
- getNext: function(){
- var oRes = null;
+ getNext: function() {
+ let oRes = null;
if(this.oCurRow) {
- var oRes = this.oCurRow[this.nCurColIndex];
- if(null != oRes) {
+ oRes = this.oCurRow[this.nCurColIndex];
+ if(oRes != null) {
oRes.setCurValue(null);
- if(null != oRes.getSequence()) {
- var sequence = oRes.getSequence();
- if((oRes.getIsDate() && !oRes.getTimePeriods()) || null != oRes.getPrefix())
- oRes.setCurValue( Math.abs(sequence.a1 * sequence.nX + sequence.a0));
- else
+ if(oRes.getSequence() != null) {
+ let sequence = oRes.getSequence();
+ if(oRes.getPrefix() != null) {
+ oRes.setCurValue(Math.abs(sequence.a1 * sequence.nX + sequence.a0));
+ } else if (oRes.getIsDate() && !oRes.getTimePeriods()) {
+ let nCurValue = sequence.a1 * sequence.nX + sequence.a0;
+ if (nCurValue >= 0 || (oRes.getIsDateTime() && parseInt(sequence.a1) !== sequence.a1)) {
+ oRes.setCurValue(nCurValue);
+ } else if (oRes.getIsTime() && nCurValue < 0) {
+ // Reset nX and start from beginning
+ sequence.nX = this.getIsOneSelectedCell() ? 1 : 0;
+ oRes.setCurValue(sequence.a1 * sequence.nX + sequence.a0);
+ }
+ } else {
oRes.setCurValue(sequence.a1 * sequence.nX + sequence.a0);
+ }
sequence.nX++;
}
}
@@ -20109,6 +21352,12 @@
},
setFillHandleRightClick: function (bFillHandleRightClick) {
this.bFillHandleRightClick = bFillHandleRightClick;
+ },
+ getIsOneSelectedCell: function () {
+ return this.bOneSelectedCell;
+ },
+ setIsOneSelectedCell: function (bOneSelectedCell) {
+ this.bOneSelectedCell = bOneSelectedCell;
}
};
@@ -20244,6 +21493,7 @@
}
//-------------------------------------------------------------------------------------------------
/**
+ * Class represents data using for calculating a sequence of filling cells in autofill.
* @constructor
*/
function cDataRow(nCol, nVal, bDelimiter, sPrefix, nPadding, bDate, oAdditional, aTimePeriods) {
@@ -20253,50 +21503,172 @@
this.sPrefix = sPrefix;
this.nPadding = nPadding;
this.bDate = bDate;
+ this.bDateTime = false;
+ this.bTime = false;
+ this.bMixedDateFormat = false;
this.oAdditional = oAdditional;
this.aTimePeriods = aTimePeriods;
this.oSequence = null;
this.nCurValue = null;
}
+
+ /**
+ * Method returns column number
+ * @memberof cDataRow
+ * @returns {number}
+ */
cDataRow.prototype.getCol = function() {
return this.nCol;
};
+ /**
+ * Method returns value of current cell
+ * @memberof cDataRow
+ * @returns {number}
+ */
cDataRow.prototype.getVal = function() {
return this.nVal;
};
+ /**
+ * Method returns flag which checks cell has delimiter.
+ * @memberof cDataRow
+ * @returns {boolean}
+ */
cDataRow.prototype.getDelimiter = function() {
return this.bDelimiter;
};
+ /**
+ * Method returns prefix of current cell
+ * @memberof cDataRow
+ * @returns {string}
+ */
cDataRow.prototype.getPrefix = function () {
return this.sPrefix;
};
+ /**
+ * Method returns padding of current cell
+ * @memberof cDataRow
+ * @returns {number}
+ */
cDataRow.prototype.getPadding = function() {
return this.nPadding;
};
+ /**
+ * Method sets padding of current cell
+ * @memberof cDataRow
+ * @param {number} nPadding
+ */
cDataRow.prototype.setPadding = function(nPadding) {
this.nPadding = nPadding;
};
+ /**
+ * Method returns flag which recognizes a current cell has format Date or not.
+ * @memberof cDataRow
+ * @returns {boolean}
+ */
cDataRow.prototype.getIsDate = function() {
return this.bDate;
};
+ /**
+ * Method returns flag which recognizes a current cell has format Date & Time or not.
+ * @memberof cDataRow
+ * @returns {boolean}
+ */
+ cDataRow.prototype.getIsDateTime = function() {
+ return this.bDateTime;
+ };
+ /**
+ * Method sets flag which recognizes a current cell has format Date & Time or not.
+ * @memberof cDataRow
+ * @param {boolean} bDateTime
+ */
+ cDataRow.prototype.setIsDateTime = function(bDateTime) {
+ this.bDateTime = bDateTime;
+ };
+ /**
+ * Method returns flag which recognizes a current cell has mixed format of Dates or not.
+ * @memberof cDataRow
+ * @returns {boolean}
+ */
+ cDataRow.prototype.getIsMixedDateFormat = function () {
+ return this.bMixedDateFormat;
+ };
+ /**
+ * Method sets flag which recognizes a current cell has mixed format of Dates or not.
+ * @memberof cDataRow
+ * @param {boolean} bMixedDateFormat
+ */
+ cDataRow.prototype.setIsMixedDateFormat = function (bMixedDateFormat) {
+ this.bMixedDateFormat = bMixedDateFormat;
+ };
+ /**
+ * Method returns flag which recognizes a current cell has format Time or not.
+ * @memberof cDataRow
+ * @returns {boolean}
+ */
+ cDataRow.prototype.getIsTime = function() {
+ return this.bTime;
+ };
+ /**
+ * Method sets flag which recognizes a current cell has format Time or not.
+ * @param {boolean} bTime
+ */
+ cDataRow.prototype.setIsTime = function(bTime) {
+ this.bTime = bTime;
+ };
+ /**
+ * Method returns additional data
+ * @memberof cDataRow
+ * @returns {Cell}
+ */
cDataRow.prototype.getAdditional = function() {
return this.oAdditional;
};
+ /**
+ * Method returns array of time periods
+ * @memberof cDataRow
+ * @returns {[]}
+ */
cDataRow.prototype.getTimePeriods = function () {
return this.aTimePeriods;
};
+ /**
+ * Method returns sequence of calculated step and start cell. For fill next cells in autofill.
+ * @memberof cDataRow
+ * @returns {null|object}
+ */
cDataRow.prototype.getSequence = function() {
return this.oSequence;
};
+ /**
+ * Method sets sequence of calculated step and start cell. For fill next cells in autofill.
+ * @memberof cDataRow
+ * @param {object} oSequence
+ */
cDataRow.prototype.setSequence = function (oSequence) {
this.oSequence = oSequence;
};
+ /**
+ * Method returns the current calculated value for cell who need to be filled.
+ * @memberof cDataRow
+ * @returns {number}
+ */
cDataRow.prototype.getCurValue = function() {
return this.nCurValue;
};
+ /**
+ * Method sets the current calculated value for cell who need to be filled.
+ * @memberof cDataRow
+ * @param {number} nCurValue
+ */
cDataRow.prototype.setCurValue = function(nCurValue) {
this.nCurValue = nCurValue;
};
+ /**
+ * Method compares 2 DataRow objects for equality
+ * @memberof cDataRow
+ * @param {cDataRow} oComparedRowData
+ * @returns {boolean}
+ */
cDataRow.prototype.compare = function(oComparedRowData) {
let sComparedTimePeriods = oComparedRowData.getTimePeriods() ? oComparedRowData.getTimePeriods().join() : null;
let sTimePeriods = this.getTimePeriods() ? this.getTimePeriods().join() : null;
@@ -20309,7 +21681,12 @@
return bComparedDelimiter === bDelimiter && sComparedPrefix === sPrefix && bComparedDate === bDate && sComparedTimePeriods === sTimePeriods;
};
-
+ /**
+ * Method compares bDate and Prefix for equality between two DataRow objects.
+ * @memberof cDataRow
+ * @param {cDataRow} oComparedRowData
+ * @returns {boolean}
+ */
cDataRow.prototype.prefixDataCompare = function(oComparedRowData) {
let sComparedPrefix = oComparedRowData.getPrefix();
let sPrefix = this.getPrefix();
@@ -20765,14 +22142,14 @@
let nWidth = oBBox.c2 - oBBox.c1 + 1;
let nHeight = oBBox.r2 - oBBox.r1 + 1;
- History.Create_NewPoint();
- let oSelection = History.GetSelection();
+ AscCommon.History.Create_NewPoint();
+ let oSelection = AscCommon.History.GetSelection();
if (null != oSelection) {
oSelection = oSelection.clone();
oSelection.assign(oBBox.c1, oBBox.r1, oBBox.c2, oBBox.r2);
- History.SetSelection(oSelection);
+ AscCommon.History.SetSelection(oSelection);
}
- let oSelectionRedo = History.GetSelectionRedo();
+ let oSelectionRedo = AscCommon.History.GetSelectionRedo();
if (null != oSelectionRedo) {
oSelectionRedo = oSelectionRedo.clone();
if (this.getVertical()) {
@@ -20788,7 +22165,7 @@
oSelectionRedo.assign(oBBox.c1, oBBox.r1, oBBox.c1 + nIndex - 1, oBBox.r2);
}
}
- History.SetSelectionRedo(oSelectionRedo);
+ AscCommon.History.SetSelectionRedo(oSelectionRedo);
}
};
@@ -21226,7 +22603,7 @@
let aFilledCells = this.getFilledCells();
if (aFilledCells.length) {
this.initHistoryPoint();
- History.StartTransaction();
+ AscCommon.History.StartTransaction();
for (let i = 0, length = aFilledCells.length; i < length; i++) {
let oToRange = aFilledCells[i].oToRange;
let oFilledRange = aFilledCells[i].oFilledRange;
@@ -21238,7 +22615,7 @@
}
_mergeCells(oFilledRange, oToRange);
}
- History.EndTransaction();
+ AscCommon.History.EndTransaction();
} else if (oMergedFrom.all.length) {
let oApi = Asc.editor;
oApi.sendEvent("asc_onError", c_oAscError.ID.CannotFillRange, c_oAscError.Level.NoCritical);
@@ -21281,5 +22658,6 @@
window['AscCommonExcel'].changeTextCase = changeTextCase;
window['AscCommonExcel'].g_sNewSheetNamePattern = g_sNewSheetNamePattern;
window['AscCommonExcel'].CSerial = CSerial;
+ window['AscCommonExcel'].SweepLineRowIterator = SweepLineRowIterator;
})(window);
diff --git a/cell/model/WorkbookElems.js b/cell/model/WorkbookElems.js
index 0d1e9d4fc1..8345a29a88 100644
--- a/cell/model/WorkbookElems.js
+++ b/cell/model/WorkbookElems.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -42,11 +42,11 @@ var FormulaTablePartInfo = AscCommon.FormulaTablePartInfo;
var parserHelp = AscCommon.parserHelp;
var gc_nMaxRow0 = AscCommon.gc_nMaxRow0;
var gc_nMaxCol0 = AscCommon.gc_nMaxCol0;
- var History = AscCommon.History;
var c_oAscPrintDefaultSettings = AscCommon.c_oAscPrintDefaultSettings;
var UndoRedoDataTypes = AscCommonExcel.UndoRedoDataTypes;
var UndoRedoData_IndexSimpleProp = AscCommonExcel.UndoRedoData_IndexSimpleProp;
+var UndoRedoData_FromTo = AscCommonExcel.UndoRedoData_FromTo;
var UndoRedoData_Layout = AscCommonExcel.UndoRedoData_Layout;
@@ -6374,8 +6374,8 @@ StyleManager.prototype =
Col.prototype.setStyle = function (xfs) {
var oldVal = this.xfs;
this.setStyleInternal(xfs);
- if (History.Is_On() && oldVal !== this.xfs) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_SetStyle, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oldVal !== this.xfs) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_SetStyle, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oldVal, this.xfs));
}
};
@@ -6386,9 +6386,9 @@ StyleManager.prototype =
var oStyle;
var newVal = this.ws.workbook.CellStyles._prepareCellStyle(val);
var oRes = this.ws.workbook.oStyleManager.setCellStyle(this, newVal);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
var oldStyleName = this.ws.workbook.CellStyles.getStyleNameByXfId(oRes.oldVal);
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_SetCellStyle, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_SetCellStyle, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oldStyleName, val));
// Выставляем стиль
@@ -6410,21 +6410,21 @@ StyleManager.prototype =
};
Col.prototype.setNumFormat = function (val) {
var oRes = this.ws.workbook.oStyleManager.setNum(this, new Num({f: val}));
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Num, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Num, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setNum = function (val) {
var oRes = this.ws.workbook.oStyleManager.setNum(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Num, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Num, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setFont = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFont(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
var oldVal = null;
if (null != oRes.oldVal) {
oldVal = oRes.oldVal.clone();
@@ -6433,90 +6433,90 @@ StyleManager.prototype =
if (null != oRes.newVal) {
newVal = oRes.newVal.clone();
}
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_SetFont, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_SetFont, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oldVal, newVal));
}
};
Col.prototype.setFontname = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontname(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fontname, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fontname, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setFontsize = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontsize(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fontsize, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fontsize, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setFontcolor = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontcolor(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fontcolor, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fontcolor, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setBold = function (val) {
var oRes = this.ws.workbook.oStyleManager.setBold(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Bold, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Bold, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setItalic = function (val) {
var oRes = this.ws.workbook.oStyleManager.setItalic(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Italic, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Italic, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setUnderline = function (val) {
var oRes = this.ws.workbook.oStyleManager.setUnderline(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Underline, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Underline, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setStrikeout = function (val) {
var oRes = this.ws.workbook.oStyleManager.setStrikeout(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Strikeout, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Strikeout, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setFontAlign = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontAlign(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_FontAlign, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_FontAlign, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setAlignVertical = function (val) {
var oRes = this.ws.workbook.oStyleManager.setAlignVertical(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_AlignVertical, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_AlignVertical, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setAlignHorizontal = function (val) {
var oRes = this.ws.workbook.oStyleManager.setAlignHorizontal(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_AlignHorizontal, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_AlignHorizontal, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setFill = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFill(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fill, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Fill, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setBorder = function (val) {
var oRes = this.ws.workbook.oStyleManager.setBorder(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
var oldVal = null;
if (null != oRes.oldVal) {
oldVal = oRes.oldVal.clone();
@@ -6525,56 +6525,56 @@ StyleManager.prototype =
if (null != oRes.newVal) {
newVal = oRes.newVal.clone();
}
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Border, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Border, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oldVal, newVal));
}
};
Col.prototype.setShrinkToFit = function (val) {
var oRes = this.ws.workbook.oStyleManager.setShrinkToFit(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_ShrinkToFit, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_ShrinkToFit, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setWrap = function (val) {
var oRes = this.ws.workbook.oStyleManager.setWrap(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Wrap, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Wrap, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setAngle = function (val) {
var oRes = this.ws.workbook.oStyleManager.setAngle(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Angle, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Angle, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setIndent = function (val) {
var oRes = this.ws.workbook.oStyleManager.setIndent(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Indent, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Indent, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setApplyProtection = function (val) {
var oRes = this.ws.workbook.oStyleManager.setApplyProtection(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_ApplyProtection, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_ApplyProtection, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setLocked = function (val) {
var oRes = this.ws.workbook.oStyleManager.setLocked(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Locked, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Locked, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Col.prototype.setHiddenFormulas = function (val) {
var oRes = this.ws.workbook.oStyleManager.setHiddenFormulas(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_HiddenFormulas, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_HiddenFormulas, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
@@ -6612,8 +6612,8 @@ StyleManager.prototype =
//this._hasChanged = true;
}
- if (!notAddHistory && History.Is_On() && oldVal != this.outlineLevel) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_GroupCol, this.ws.getId(), this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oldVal, this.outlineLevel));
+ if (!notAddHistory && AscCommon.History.Is_On() && oldVal != this.outlineLevel) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_GroupCol, this.ws.getId(), this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, false, oldVal, this.outlineLevel));
}
};
Col.prototype.getOutlineLevel = function () {
@@ -6783,8 +6783,8 @@ StyleManager.prototype =
Row.prototype.setStyle = function (xfs) {
var oldVal = this.xfs;
this.setStyleInternal(xfs);
- if (History.Is_On() && oldVal !== this.xfs) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetStyle, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oldVal !== this.xfs) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetStyle, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oldVal, this.xfs));
}
};
@@ -6796,9 +6796,9 @@ StyleManager.prototype =
var oStyle;
var newVal = this.ws.workbook.CellStyles._prepareCellStyle(val);
var oRes = this.ws.workbook.oStyleManager.setCellStyle(this, newVal);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
var oldStyleName = this.ws.workbook.CellStyles.getStyleNameByXfId(oRes.oldVal);
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetCellStyle, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetCellStyle, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oldStyleName, val));
// Выставляем стиль
@@ -6820,21 +6820,21 @@ StyleManager.prototype =
};
Row.prototype.setNumFormat = function (val) {
var oRes = this.ws.workbook.oStyleManager.setNum(this, new Num({f: val}));
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Num, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Num, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setNum = function (val) {
var oRes = this.ws.workbook.oStyleManager.setNum(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Num, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Num, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setFont = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFont(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
var oldVal = null;
if (null != oRes.oldVal) {
oldVal = oRes.oldVal.clone();
@@ -6843,90 +6843,90 @@ StyleManager.prototype =
if (null != oRes.newVal) {
newVal = oRes.newVal.clone();
}
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetFont, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetFont, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oldVal, newVal));
}
};
Row.prototype.setFontname = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontname(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontname, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontname, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setFontsize = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontsize(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontsize, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontsize, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setFontcolor = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontcolor(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontcolor, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontcolor, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setBold = function (val) {
var oRes = this.ws.workbook.oStyleManager.setBold(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Bold, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Bold, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setItalic = function (val) {
var oRes = this.ws.workbook.oStyleManager.setItalic(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Italic, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Italic, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setUnderline = function (val) {
var oRes = this.ws.workbook.oStyleManager.setUnderline(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Underline, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Underline, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setStrikeout = function (val) {
var oRes = this.ws.workbook.oStyleManager.setStrikeout(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Strikeout, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Strikeout, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setFontAlign = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFontAlign(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_FontAlign, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_FontAlign, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setAlignVertical = function (val) {
var oRes = this.ws.workbook.oStyleManager.setAlignVertical(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_AlignVertical, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_AlignVertical, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setAlignHorizontal = function (val) {
var oRes = this.ws.workbook.oStyleManager.setAlignHorizontal(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_AlignHorizontal, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_AlignHorizontal, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setFill = function (val) {
var oRes = this.ws.workbook.oStyleManager.setFill(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fill, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fill, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setBorder = function (val) {
var oRes = this.ws.workbook.oStyleManager.setBorder(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
var oldVal = null;
if (null != oRes.oldVal) {
oldVal = oRes.oldVal.clone();
@@ -6935,56 +6935,56 @@ StyleManager.prototype =
if (null != oRes.newVal) {
newVal = oRes.newVal.clone();
}
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Border, this.ws.getId(),
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Border, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oldVal, newVal));
}
};
Row.prototype.setShrinkToFit = function (val) {
var oRes = this.ws.workbook.oStyleManager.setShrinkToFit(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_ShrinkToFit, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_ShrinkToFit, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setWrap = function (val) {
var oRes = this.ws.workbook.oStyleManager.setWrap(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Wrap, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Wrap, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setAngle = function (val) {
var oRes = this.ws.workbook.oStyleManager.setAngle(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Angle, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Angle, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setIndent = function (val) {
var oRes = this.ws.workbook.oStyleManager.setIndent(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Indent, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Indent, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setApplyProtection = function (val) {
var oRes = this.ws.workbook.oStyleManager.setApplyProtection(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_ApplyProtection, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_ApplyProtection, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setLocked = function (val) {
var oRes = this.ws.workbook.oStyleManager.setLocked(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Locked, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Locked, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
Row.prototype.setHiddenFormulas = function (val) {
var oRes = this.ws.workbook.oStyleManager.setHiddenFormulas(this, val);
- if (History.Is_On() && oRes.oldVal != oRes.newVal) {
- History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_HiddenFormulas, this.ws.getId(),
+ if (AscCommon.History.Is_On() && oRes.oldVal != oRes.newVal) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_HiddenFormulas, this.ws.getId(),
this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oRes.oldVal, oRes.newVal));
}
};
@@ -7025,8 +7025,8 @@ StyleManager.prototype =
this._hasChanged = true;
}
- if(!notAddHistory && History.Is_On() && oldProps != this.outlineLevel) {
- History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_GroupRow, this.ws.getId(), this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oldProps, this.outlineLevel));
+ if(!notAddHistory && AscCommon.History.Is_On() && oldProps != this.outlineLevel) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_GroupRow, this.ws.getId(), this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index, true, oldProps, this.outlineLevel));
}
};
Row.prototype.getOutlineLevel = function () {
@@ -7408,14 +7408,14 @@ function RangeDataManagerElem(bbox, data)
this.initData = null;
var t = this;
AscCommonExcel.executeInR1C1Mode(false, function () {
- History.TurnOff();
+ AscCommon.History.TurnOff();
for (var i = 0; i < initData.length; ++i) {
var range = t.worksheet.getRange2(initData[i]);
if (null != range) {
range.mergeOpen();
}
}
- History.TurnOn();
+ AscCommon.History.TurnOn();
});
}
};
@@ -7750,13 +7750,13 @@ function RangeDataManagerElem(bbox, data)
this.arrSparklines[i].updateWorksheet(worksheet.sName, oldWorksheet.sName);
newSparklines.push(this.arrSparklines[i].clone());
}
- History.Add(new AscDFH.CChangesSparklinesChangeData(this, oldSparklines, newSparklines));
+ AscCommon.History.Add(new AscDFH.CChangesSparklinesChangeData(this, oldSparklines, newSparklines));
}
};
sparklineGroup.prototype.checkProperty = function (propOld, propNew, type, fChangeConstructor) {
if (null !== propNew && propOld !== propNew) {
- History.Add(new fChangeConstructor(this, type, propOld, propNew));
+ AscCommon.History.Add(new fChangeConstructor(this, type, propOld, propNew));
return propNew;
}
return propOld;
@@ -7809,7 +7809,7 @@ function RangeDataManagerElem(bbox, data)
res.arrSparklines.push(this.arrSparklines[i].clone());
newSparklines.push(this.arrSparklines[i].clone());
}
- History.Add(new AscDFH.CChangesSparklinesChangeData(res, null, newSparklines));
+ AscCommon.History.Add(new AscDFH.CChangesSparklinesChangeData(res, null, newSparklines));
}
return res;
@@ -7865,7 +7865,7 @@ function RangeDataManagerElem(bbox, data)
sparklineGroup.prototype.remove = function (range) {
for (var i = 0; i < this.arrSparklines.length; ++i) {
if (this.arrSparklines[i].checkInRange(range)) {
- History.Add(new AscDFH.CChangesSparklinesRemoveData(this, this.arrSparklines[i]));
+ AscCommon.History.Add(new AscDFH.CChangesSparklinesRemoveData(this, this.arrSparklines[i]));
this.arrSparklines.splice(i, 1);
--i;
}
@@ -7950,7 +7950,7 @@ function RangeDataManagerElem(bbox, data)
for (i = 0; i < this.arrSparklines.length; i++) {
newPr.push(this.arrSparklines[i].clone());
}
- History.Add(new AscDFH.CChangesSparklinesChangeData(this, oldPr, newPr));
+ AscCommon.History.Add(new AscDFH.CChangesSparklinesChangeData(this, oldPr, newPr));
}
};
sparklineGroup.prototype.isValidDataRef = function (dataRange, locationRange) {
@@ -8258,7 +8258,7 @@ function RangeDataManagerElem(bbox, data)
};
sparklineGroup.prototype.asc_getStyles = function (type) {
- History.TurnOff();
+ AscCommon.History.TurnOff();
var aRet = [];
var nStyleIndex = -1;
var oSparklineGroup = this.clone(true);
@@ -8288,7 +8288,7 @@ function RangeDataManagerElem(bbox, data)
aRet.push(canvas.toDataURL("image/png"));
}
aRet.push(nStyleIndex);
- History.TurnOn();
+ AscCommon.History.TurnOn();
return aRet;
};
@@ -9031,11 +9031,13 @@ function RangeDataManagerElem(bbox, data)
if (handleSelectionRange.c1 === this.Ref.c1 && handleSelectionRange.c2 === this.Ref.c2) {
//all row
//Table1[@]
+
return this.DisplayName + "[" + AscCommon.cStrucTableReservedWords.at + "]";
} else {
//part of row
//Table1[@[Column2]:[Column3]]
//Table1[@Column1]
+
return this.DisplayName + "[" + AscCommon.cStrucTableReservedWords.at + getColumnNameRange(startCol, endCol) + "]";
}
}
@@ -9771,7 +9773,7 @@ function RangeDataManagerElem(bbox, data)
}
if (addToHistory) {
- History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, ws.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, ws.getId(), null,
new AscCommonExcel.UndoRedoData_SortState(oldSortState, this.clone()));
}
};
@@ -9851,7 +9853,7 @@ function RangeDataManagerElem(bbox, data)
}
if (addToHistory && null != to) {
- History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, ws.getId(), null,
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoSortState, AscCH.historyitem_SortState_Add, ws.getId(), null,
new AscCommonExcel.UndoRedoData_SortState(oldSortState, this.clone()));
}
};
@@ -13040,8 +13042,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageMargins.prototype.asc_setLeft = function (newVal) {
var oldVal = this.left;
this.left = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.left) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Left, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.left) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Left, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13050,8 +13052,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageMargins.prototype.asc_setRight = function (newVal) {
var oldVal = this.right;
this.right = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.right) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Right, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.right) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Right, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13060,8 +13062,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageMargins.prototype.asc_setTop = function (newVal) {
var oldVal = this.top;
this.top = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.top) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Top, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.top) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Top, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13070,8 +13072,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageMargins.prototype.asc_setBottom = function (newVal) {
var oldVal = this.bottom;
this.bottom = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.bottom) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Bottom, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.bottom) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Bottom, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13081,16 +13083,16 @@ function RangeDataManagerElem(bbox, data)
asc_CPageMargins.prototype.asc_setHeader = function (newVal) {
var oldVal = this.header;
this.header = newVal;
- /*if (this.ws && History.Is_On() && oldVal !== this.top) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Top, this.ws.getId(),
+ /*if (this.ws && AscCommon.History.Is_On() && oldVal !== this.top) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Top, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}*/
};
asc_CPageMargins.prototype.asc_setFooter = function (newVal) {
var oldVal = this.footer;
this.footer = newVal;
- /*if (this.ws && History.Is_On() && oldVal !== this.bottom) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Bottom, this.ws.getId(),
+ /*if (this.ws && AscCommon.History.Is_On() && oldVal !== this.bottom) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Bottom, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}*/
};
@@ -13179,8 +13181,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageSetup.prototype.asc_setOrientation = function (newVal) {
var oldVal = this.orientation;
this.orientation = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.orientation) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Orientation, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.orientation) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Orientation, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13189,8 +13191,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageSetup.prototype.asc_setWidth = function (newVal) {
var oldVal = this.width;
this.width = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.width) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Width, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.width) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Width, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13199,8 +13201,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageSetup.prototype.asc_setHeight = function (newVal) {
var oldVal = this.height;
this.height = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.height) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Height, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.height) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Height, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13217,8 +13219,8 @@ function RangeDataManagerElem(bbox, data)
}
this.firstPageNumber = newVal;
this.useFirstPageNumber = true;
- if (this.ws && History.Is_On() && (oldVal !== this.firstPageNumber || oldValUse !== this.useFirstPageNumber)) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_FirstPageNumber, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && (oldVal !== this.firstPageNumber || oldValUse !== this.useFirstPageNumber)) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_FirstPageNumber, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
};
@@ -13250,8 +13252,8 @@ function RangeDataManagerElem(bbox, data)
var oldVal = this.fitToWidth;
this.fitToWidth = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.fitToWidth) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_FitToWidth, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.fitToWidth) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_FitToWidth, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13267,8 +13269,8 @@ function RangeDataManagerElem(bbox, data)
var oldVal = this.fitToHeight;
this.fitToHeight = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.fitToHeight) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_FitToHeight, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.fitToHeight) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_FitToHeight, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13310,8 +13312,8 @@ function RangeDataManagerElem(bbox, data)
asc_CPageSetup.prototype.asc_setScale = function (newVal) {
var oldVal = this.scale;
this.scale = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.scale) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Scale, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.scale) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Scale, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
let wb = this.ws && this.ws.workbook && this.ws.workbook;
@@ -13537,40 +13539,40 @@ function RangeDataManagerElem(bbox, data)
asc_CPageOptions.prototype.asc_setGridLines = function (newVal) {
let oldVal = this.gridLines;
this.gridLines = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.gridLines) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_GridLines, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.gridLines) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_GridLines, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
};
asc_CPageOptions.prototype.asc_setHeadings = function (newVal) {
let oldVal = this.headings;
this.headings = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.headings) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Headings, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.headings) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_Headings, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
};
asc_CPageOptions.prototype.asc_setHorizontalCentered = function (newVal) {
let oldVal = this.horizontalCentered;
this.horizontalCentered = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.horizontalCentered) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_HorizontalCentered, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.horizontalCentered) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_HorizontalCentered, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
};
asc_CPageOptions.prototype.asc_setVerticalCentered = function (newVal) {
let oldVal = this.verticalCentered;
this.verticalCentered = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.verticalCentered) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_VerticalCentered, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.verticalCentered) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_VerticalCentered, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
};
asc_CPageOptions.prototype.asc_setGridLinesSet = function (newVal) {
/*let oldVal = this.verticalCentered;
this.verticalCentered = newVal;
- if (this.ws && History.Is_On() && oldVal !== this.verticalCentered) {
- History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_VerticalCentered, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On() && oldVal !== this.verticalCentered) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoLayout, AscCH.historyitem_Layout_VerticalCentered, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}*/
};
@@ -13679,8 +13681,8 @@ function RangeDataManagerElem(bbox, data)
this.evenFooter.setType(Asc.c_oAscPageHFType && Asc.c_oAscPageHFType.evenFooter);
}
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Footer_Even, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Footer_Even, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13698,8 +13700,8 @@ function RangeDataManagerElem(bbox, data)
this.evenHeader.setType(Asc.c_oAscPageHFType && Asc.c_oAscPageHFType.evenHeader);
}
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Header_Even, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Header_Even, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13717,8 +13719,8 @@ function RangeDataManagerElem(bbox, data)
this.firstFooter.setType(Asc.c_oAscPageHFType && Asc.c_oAscPageHFType.firstFooter);
}
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Footer_First, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Footer_First, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13736,8 +13738,8 @@ function RangeDataManagerElem(bbox, data)
this.firstHeader.setType(Asc.c_oAscPageHFType && Asc.c_oAscPageHFType.firstHeader);
}
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Header_First, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Header_First, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13755,8 +13757,8 @@ function RangeDataManagerElem(bbox, data)
this.oddFooter.setType(Asc.c_oAscPageHFType && Asc.c_oAscPageHFType.oddFooter);
}
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Footer_Odd, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Footer_Odd, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13774,8 +13776,8 @@ function RangeDataManagerElem(bbox, data)
this.oddHeader.setType(Asc.c_oAscPageHFType && Asc.c_oAscPageHFType.oddHeader);
}
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Header_Odd, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Header_Odd, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13788,8 +13790,8 @@ function RangeDataManagerElem(bbox, data)
if(!compareValues(oldVal, newVal) && !defaultVal) {
this.alignWithMargins = newVal;
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Align_With_Margins, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Align_With_Margins, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13801,8 +13803,8 @@ function RangeDataManagerElem(bbox, data)
if(!compareValues(oldVal, newVal)) {
this.scaleWithDoc = newVal;
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Scale_With_Doc, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Scale_With_Doc, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13815,8 +13817,8 @@ function RangeDataManagerElem(bbox, data)
if(!compareValues(oldVal, newVal) && !defaultVal) {
this.differentFirst = newVal;
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Different_First, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Different_First, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -13829,8 +13831,8 @@ function RangeDataManagerElem(bbox, data)
if(!compareValues(oldVal, newVal) && !defaultVal) {
this.differentOddEven = newVal;
- if (this.ws && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Different_Odd_Even, this.ws.getId(),
+ if (this.ws && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoHeaderFooter, AscCH.historyitem_Different_Odd_Even, this.ws.getId(),
null, new UndoRedoData_Layout(oldVal, newVal));
}
}
@@ -14583,16 +14585,21 @@ function RangeDataManagerElem(bbox, data)
var trueZoom = kF * AscCommon.AscBrowser.retinaPixelRatio;
var _height = Math.floor(height * kF);
var _width = Math.floor(width * kF);
+ var borderWidth = 1;
if (trueZoom !== this.pageZoom) {
this.pageZoom = trueZoom;
- this.ctx.canvas.style.height = _height + 2 + "px";
- this.ctx.canvas.style.width = _width + 2 + "px";
+ this.ctx.canvas.style.height = _height + "px";
+ this.ctx.canvas.style.width = _width + borderWidth * 2 + "px";
this.ctx.canvas.height = AscCommon.AscBrowser.convertToRetinaValue(_height, true);
this.ctx.canvas.width = AscCommon.AscBrowser.convertToRetinaValue(_width, true);
isChangeForZoom = true;
}
- this.ctx.canvas.style.marginLeft = canvasWidth/2 - _width / 2 + "px";
- this.ctx.canvas.style.marginTop = canvasHeight/2 - _height / 2 + canvasTopPadding * kF + "px";
+ this.ctx.canvas.style.marginLeft = Math.floor(canvasWidth/2 - _width / 2) + "px";
+ let topMargin = Math.floor(canvasHeight/2 - _height / 2 + canvasTopPadding * kF);
+ if (topMargin + _height > canvasHeight) {
+ topMargin = canvasHeight - _height;
+ }
+ this.ctx.canvas.style.marginTop = topMargin + "px";
kF = trueZoom;
@@ -14844,7 +14851,7 @@ function RangeDataManagerElem(bbox, data)
var i;
var length = r.GetLong();
for (i = 0; i < length; ++i) {
- var definedName = new ExternalDefinedName();
+ var definedName = new ExternalDefinedName(this);
definedName.Read_FromBinary2(r);
if(!this.DefinedNames) {
this.DefinedNames = [];
@@ -14951,7 +14958,7 @@ function RangeDataManagerElem(bbox, data)
if (this.DefinedNames) {
for (var i = 0; i < this.DefinedNames.length; i++) {
- newObj.DefinedNames.push(this.DefinedNames[i].clone);
+ newObj.DefinedNames.push(this.DefinedNames[i].clone());
}
}
@@ -14984,10 +14991,51 @@ function RangeDataManagerElem(bbox, data)
return newObj;
};
- ExternalReference.prototype.updateData = function (arr, oPortalData) {
+ ExternalReference.prototype.initPostOpen = function () {
+ let res = null;
+ if (this.DefinedNames && this.DefinedNames.length) {
+ for (let i = 0; i < this.DefinedNames.length; i++) {
+ this.DefinedNames[i].parent = this;
+ }
+ }
+ this.initWorksheetsFromSheetDataSet();
+ this.initWorkbook();
+
+ return res;
+ };
+
+ ExternalReference.prototype.getDefinedNamesBySheetIndex = function (index) {
+ let res = null;
+ if (this.DefinedNames && this.DefinedNames.length) {
+ for (let i = 0; i < this.DefinedNames.length; i++) {
+ if (this.DefinedNames[i].SheetId === index) {
+ if (!res) {
+ res = [];
+ }
+ res.push(this.DefinedNames[i]);
+ }
+ }
+ }
+ return res;
+ };
+
+ ExternalReference.prototype.removeSheetByName = function (sheetName) {
+ if (sheetName != null) {
+ let index = this.getSheetByName(sheetName);
+ if (index != null) {
+ this.SheetNames.splice(index, 1);
+ this.SheetDataSet.splice(index, 1);
+ delete this.worksheets[sheetName];
+ }
+ }
+ };
+
+ ExternalReference.prototype.updateData = function (arr, oPortalData, noData) {
var t = this;
var isChanged = false;
var cloneER = this.clone();
+
+ let existedWsArray = [];
for (var i = 0; i < arr.length; i++) {
//если есть this.worksheets, если нет - проверить и обработать
var sheetName = arr[i].sName;
@@ -15002,6 +15050,17 @@ function RangeDataManagerElem(bbox, data)
//меняем лист
AscFormat.ExecuteNoHistory(function(){
AscCommonExcel.executeInR1C1Mode(false, function () {
+
+ let defNames = wsTo.workbook && wsTo.workbook.dependencyFormulas && wsTo.workbook.dependencyFormulas.defNames;
+ wsTo.workbook.dependencyFormulas._foreachDefName(function (defName) {
+ var api_sheet = Asc['editor'];
+ var wb = api_sheet.wbModel;
+ let realWb = defName.wb;
+ defName.wb = wb;
+ defName.onFormulaEvent(AscCommon.c_oNotifyParentType.Change);
+ defName.wb = realWb;
+ });
+
var oAllRange = wsTo.getRange3(0, 0, wsTo.getRowsCount(), wsTo.getColsCount());
oAllRange.cleanAll();
wsTo.copyFrom(arr[i], wsTo.sName);
@@ -15014,12 +15073,29 @@ function RangeDataManagerElem(bbox, data)
if (index != null) {
var externalSheetDataSet = this.SheetDataSet[index];
if (externalSheetDataSet) {
- if (externalSheetDataSet.updateFromSheet(t.worksheets[sheetName])) {
+ if (externalSheetDataSet.updateFromSheet(t.worksheets[sheetName], noData)) {
isChanged = true;
}
}
+ let externalDefName = this.getDefinedNamesBySheetIndex(index);
+ if (externalDefName) {
+ for (let i = 0; i < externalDefName.length; i++) {
+ if (externalDefName[i].updateFromSheet(t.worksheets[sheetName], noData)) {
+ isChanged = true;
+ }
+ }
+ }
}
}
+ existedWsArray.push(sheetName);
+ }
+
+ // delete all non-existent sheets in ExternalReference
+ for (let wsName in this.worksheets) {
+ if (!existedWsArray.includes(wsName)) {
+ // throw an error if we referenced to one of the deleted sheets?
+ this.removeSheetByName(wsName);
+ }
}
var oReferenceData = oPortalData && oPortalData["referenceData"];
@@ -15031,13 +15107,13 @@ function RangeDataManagerElem(bbox, data)
//path also can changed
var path = oPortalData && oPortalData["path"];
if (path && this.Id !== path) {
- let isNotUpdate = (AscCommonExcel.importRangeLinksState && AscCommonExcel.importRangeLinksState.notUpdateIdMap[this.Id]) || this.notUpdateId;
+ let isNotUpdate = (AscCommonExcel.importRangeLinksState && AscCommonExcel.importRangeLinksState.notUpdateIdMap && AscCommonExcel.importRangeLinksState.notUpdateIdMap[this.Id]) || this.notUpdateId;
!isNotUpdate && this.setId(path);
isChanged = true;
}
- if (isChanged && History.Is_On()) {
- History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
+ if (isChanged && AscCommon.History.Is_On()) {
+ AscCommon.History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_ChangeExternalReference,
null, null, new AscCommonExcel.UndoRedoData_FromTo(cloneER, this));
}
};
@@ -15193,6 +15269,9 @@ function RangeDataManagerElem(bbox, data)
//клонируем все данные из SheetDataSet в данный темповый Worksheet
+ if (!sheetDataSet || !sheetDataSet.Row) {
+ return;
+ }
for (var i = 0; i < sheetDataSet.Row.length; i++) {
if (!sheetDataSet.Row[i] || !sheetDataSet.Row[i].Cell) {
continue;
@@ -15215,6 +15294,24 @@ function RangeDataManagerElem(bbox, data)
}
};
+ ExternalReference.prototype.initWorkbook = function () {
+ if (this.DefinedNames) {
+ let wb = this.getWb();
+ for (let i = 0; i < this.DefinedNames.length; i++) {
+ let defName = this.DefinedNames[i];
+ let ws = this.getSheetByIndex(defName.SheetId);
+ if (ws != null) {
+ //on parse name3d use g_DefNameWorksheet
+ let RealDefNameWorksheet = AscCommonExcel.g_DefNameWorksheet;
+ AscCommonExcel.g_DefNameWorksheet = ws;
+ let oDefName = new Asc.asc_CDefName(defName.Name, defName.RefersTo);
+ wb.editDefinesNames(null, oDefName);
+ AscCommonExcel.g_DefNameWorksheet = RealDefNameWorksheet;
+ }
+ }
+ }
+ };
+
ExternalReference.prototype.getSheetByName = function (val) {
for (var i = 0; i < this.SheetNames.length; i++) {
//если есть this.worksheets, если нет - проверить и обработать
@@ -15225,6 +15322,14 @@ function RangeDataManagerElem(bbox, data)
return null;
};
+ ExternalReference.prototype.getSheetByIndex = function (val) {
+ let sheetName = this.SheetNames[val];
+ if (sheetName != null) {
+ return this.worksheets && this.worksheets[sheetName];
+ }
+ return null;
+ };
+
ExternalReference.prototype.getSheetBySheetId = function (sheetId) {
if (this.worksheets) {
for (var i in this.worksheets) {
@@ -15274,6 +15379,38 @@ function RangeDataManagerElem(bbox, data)
}
};
+ ExternalReference.prototype.initDefinedName = function (val) {
+ if (!val) {
+ return;
+ }
+
+ const index = this.getSheetByName(val.ws.sName);
+ const name = val.value;
+
+ //check on exist
+ if (this.getDefName(name, index)) {
+ return;
+ }
+
+ let defName = new ExternalDefinedName(this);
+ defName.Name = name;
+ defName.SheetId = index;
+ this.addDefName(defName);
+ };
+
+ ExternalReference.prototype.addDefName = function (defName) {
+ this.DefinedNames.push(defName);
+ };
+
+ ExternalReference.prototype.getDefName = function (name, sheetId) {
+ for (let i in this.DefinedNames) {
+ if (this.DefinedNames[i] && this.DefinedNames[i].SheetId === sheetId && this.DefinedNames[i].Name === name) {
+ return this.DefinedNames[i];
+ }
+ }
+ return null;
+ };
+
ExternalReference.prototype.removeSheetById = function (sheetId) {
if (sheetId != null) {
var sheetName = this.getSheetBySheetId(sheetId);
@@ -15294,7 +15431,7 @@ function RangeDataManagerElem(bbox, data)
this.referenceData = {};
}
this.referenceData["instanceId"] = portalName;
- this.referenceData["fileKey"] = fileId;
+ this.referenceData["fileKey"] = fileId + "";
};
ExternalReference.prototype.setId = function (id) {
@@ -15341,6 +15478,27 @@ function RangeDataManagerElem(bbox, data)
return sPath;
};
+ ExternalReference.prototype.addDataSetFrom = function (eR) {
+ if (!eR.SheetDataSet) {
+ return;
+ }
+ for (let i = 0; i < eR.SheetDataSet.length; i++) {
+ let _sheetId = eR.SheetDataSet[i].SheetId;
+ let sheetName = eR.SheetNames[_sheetId];
+ if (sheetName) {
+ let sheetDataSet = this.getSheetDataSetByName(sheetName);
+ if (sheetDataSet) {
+ //add new from eR to this
+ sheetDataSet.addFrom(eR.SheetDataSet[i])
+ } else {
+ //add new structure
+
+ }
+ }
+ }
+ };
+
+
function asc_CExternalReference() {
this.type = null;
@@ -15476,7 +15634,7 @@ function RangeDataManagerElem(bbox, data)
}
};
- ExternalSheetDataSet.prototype.updateFromSheet = function(sheet) {
+ ExternalSheetDataSet.prototype.updateFromSheet = function(sheet, noData) {
var isChanged = false;
if (sheet) {
var t = this;
@@ -15495,13 +15653,19 @@ function RangeDataManagerElem(bbox, data)
var range = sheet.getRange2(externalCell.Ref);
range._foreach(function (cell) {
- let changedCell = externalCell.initFromCell(cell, true);
+ let changedCell = externalCell.initFromCell(cell, true, noData);
if (!isChanged) {
isChanged = changedCell;
}
var api_sheet = Asc['editor'];
var wb = api_sheet.wbModel;
+
+ /* if we haven't received data from an external source, put #REF error for all cells */
+ if (noData) {
+ cell._setValue("#REF!");
+ }
+
wb.dependencyFormulas.addToChangedCell(cell);
});
}
@@ -15552,6 +15716,18 @@ function RangeDataManagerElem(bbox, data)
return row;
};
+ ExternalSheetDataSet.prototype.addFrom = function(oSheetDataSet) {
+ var row = null;
+
+ for (var i = 0; i < oSheetDataSet.Row.length; i++) {
+ if (!this.Row[i]) {
+ this.Row[i] = oSheetDataSet.Row[i].clone();
+ }
+ }
+
+ return row;
+ };
+
function ExternalRow() {
@@ -15675,7 +15851,7 @@ function RangeDataManagerElem(bbox, data)
return newObj;
};
- ExternalCell.prototype.initFromCell = function(cell, bUpdate) {
+ ExternalCell.prototype.initFromCell = function(cell, bUpdate, noData) {
var isChanged = false;
if (cell) {
var t = this;
@@ -15685,7 +15861,7 @@ function RangeDataManagerElem(bbox, data)
});
}
- var newVal = cell.getValue();
+ let newVal = noData ? "#REF" : cell.getValue();
if (this.CellValue !== newVal) {
isChanged = true;
this.CellValue = newVal;
@@ -15704,6 +15880,11 @@ function RangeDataManagerElem(bbox, data)
cellValueType = Asc.ECellTypeType.celltypeError;
break;
}
+
+ if (noData) {
+ cellValueType = Asc.ECellTypeType.celltypeError;
+ }
+
if (this.CellType !== cellValueType) {
this.CellType = cellValueType;
isChanged = true;
@@ -15746,10 +15927,12 @@ function RangeDataManagerElem(bbox, data)
return res;
};
- function ExternalDefinedName() {
+ function ExternalDefinedName(parent) {
this.Name = null;
this.RefersTo = null;
this.SheetId = null;
+
+ this.parent = parent;
}
ExternalDefinedName.prototype.Read_FromBinary2 = function(r) {
@@ -15764,21 +15947,21 @@ function RangeDataManagerElem(bbox, data)
}
};
ExternalDefinedName.prototype.Write_ToBinary2 = function(w) {
- if (null != this.Ref) {
+ if (null != this.Name) {
w.WriteBool(true);
w.WriteString2(this.Name);
} else {
w.WriteBool(false);
}
- if (null != this.CellType) {
+ if (null != this.RefersTo) {
w.WriteBool(true);
w.WriteString2(this.RefersTo);
} else {
w.WriteBool(false);
}
- if (null != this.CellValue) {
+ if (null != this.SheetId) {
w.WriteBool(true);
w.WriteString2(this.SheetId);
} else {
@@ -15786,15 +15969,45 @@ function RangeDataManagerElem(bbox, data)
}
};
ExternalDefinedName.prototype.clone = function () {
- var newObj = new ExternalDefinedName();
+ var newObj = new ExternalDefinedName(this);
newObj.Name = this.Name;
newObj.RefersTo = this.RefersTo;
newObj.SheetId = this.SheetId;
+ newObj.parent = this.parent;
+
return newObj;
};
+ ExternalDefinedName.prototype.updateFromSheet = function(sheet) {
+ var isChanged = false;
+ if (sheet) {
+ //sheet.workbook.dependencyFormulas.defNames
+ //check on sheet name and def name
+ let defNames = sheet.workbook && sheet.workbook.dependencyFormulas && sheet.workbook.dependencyFormulas.defNames;
+ let thisSheet = defNames && this.parent.SheetNames[this.SheetId];
+ if (thisSheet) {
+ if (defNames.sheet[thisSheet]) {
+ if (defNames.sheet[thisSheet][this.Name]) {
+ isChanged = true;
+ }
+ }
+ if (!isChanged) {
+ if (defNames.wb[this.Name]) {
+ this.RefersTo = defNames.wb[this.Name].getRef();
+ //need init from range + updateFromSheet from data set
+ if (this.RefersTo) {
+ this.parent.updateSheetData(thisSheet, sheet, [AscCommonExcel.g_oRangeCache.getAscRange(this.RefersTo.split("!")[1])]);
+ }
+
+ isChanged = true;
+ }
+ }
+ }
+ }
+ return isChanged;
+ };
//CellWatch
function CCellWatch(ws) {
@@ -17066,6 +17279,548 @@ function RangeDataManagerElem(bbox, data)
return res;
};
+ /**
+ * Class representing "Formulas" properties specifies calculation options
+ * @constructor
+ */
+ function CCalcPr() {
+ this.calcId = null;
+ this.calcMode = null;
+ this.fullCalcOnLoad = null;
+ this.refMode = null;
+ this.iterate = null;
+ this.iterateCount = null;
+ this.iterateDelta = null;
+ this.fullPrecision = null;
+ this.calcCompleted = null;
+ this.calcOnSave = null;
+ this.concurrentCalc = null;
+ this.concurrentManualCount = null;
+ this.forceFullCalc = null;
+ }
+
+ /**
+ * Method clones calculation options
+ * @memberof CCalcPr
+ * @returns {CCalcPr}
+ */
+ CCalcPr.prototype.clone = function () {
+ var res = new CCalcPr();
+
+ res.calcId = this.calcId;
+ res.calcMode = this.calcMode;
+ res.fullCalcOnLoad = this.fullCalcOnLoad;
+ res.refMode = this.refMode;
+ res.iterate = this.iterate;
+ res.iterateCount = this.iterateCount;
+ res.iterateDelta = this.iterateDelta;
+ res.fullPrecision = this.fullPrecision;
+ res.calcCompleted = this.calcCompleted;
+ res.calcOnSave = this.calcOnSave;
+ res.concurrentCalc = this.concurrentCalc;
+ res.concurrentManualCount = this.concurrentManualCount;
+ res.forceFullCalc = this.forceFullCalc;
+
+ return res;
+ };
+ /**
+ * Method returns "iterate" attribute specifies whether the application should attempt to calculate formulas
+ * that contain circular references.
+ * @memberof CCalcPr
+ * @returns {boolean}
+ */
+ CCalcPr.prototype.getIterate = function () {
+ return this.iterate;
+ };
+ /**
+ * Method returns "iterateCount" attribute specifies the number of iterations attempts when calculating a
+ * workbook with circular references, when the "iterate" attribute is true.
+ * @memberof CCalcPr
+ * @returns {number}
+ */
+ CCalcPr.prototype.getIterateCount = function () {
+ return this.iterateCount;
+ };
+ /**
+ * Method returns "iterateDelta" attribute specifies the maximum change for iterative calculations.
+ * @memberof CCalcPr
+ * @returns {number}
+ */
+ CCalcPr.prototype.getIterateDelta = function () {
+ return this.iterateDelta;
+ };
+ /**
+ * Method returns "calcMode" attribute specifies when the application should calculate formulas in the workbook.
+ * @memberof CCalcPr
+ * @returns {Asc.c_oAscCalcMode}
+ */
+ CCalcPr.prototype.getCalcMode = function () {
+ return this.calcMode;
+ };
+ /**
+ * Method sets "iterate" attribute specifies whether the application should attempt to calculate formulas
+ * that contain circular references.
+ * @memberof CCalcPr
+ * @param {boolean} bIterate
+ */
+ CCalcPr.prototype.setIterate = function (bIterate) {
+ const DEFAULT_ITERATE = false;
+ this.iterate = DEFAULT_ITERATE !== bIterate ? bIterate : null;
+ };
+ /**
+ * Method sets "iterateCount" attribute specifies the number of iterations attempts when calculating a
+ * workbook with circular references, when the "iterate" attribute is true.
+ * @memberof CCalcPr
+ * @param {number} nIterateCount
+ */
+ CCalcPr.prototype.setIterateCount = function (nIterateCount) {
+ const DEFAULT_ITER_COUNT = 100;
+ this.iterateCount = DEFAULT_ITER_COUNT !== nIterateCount ? nIterateCount : null;
+ };
+ /**
+ * Method sets "iterateDelta" attribute specifies the maximum change for iterative calculations.
+ * @memberof CCalcPr
+ * @param {number} nIterateDelta
+ */
+ CCalcPr.prototype.setIterateDelta = function (nIterateDelta) {
+ const DEFAULT_ITER_DELTA = 1e-3;
+ this.iterateDelta = DEFAULT_ITER_DELTA !== nIterateDelta ? nIterateDelta : null;
+ };
+ /**
+ * Method updates calcPr attributes
+ * @memberof CCalcPr
+ * @param {asc_CCalcSettings} oCalcSettings
+ * @param {Workbook} oWbModel
+ */
+ CCalcPr.prototype.updateCalcProperties = function (oCalcSettings, oWbModel) {
+ let bIterativeCalc = oCalcSettings.asc_getIterativeCalc();
+ let nMaxIterations = oCalcSettings.asc_getMaxIterations();
+ let nMaxChange = oCalcSettings.asc_getMaxChange();
+
+ let bOldIterate = this.getIterate();
+ let nOldIterateCount = this.getIterateCount();
+ let nOldIterateDelta = this.getIterateDelta();
+
+ this.setIterate(bIterativeCalc);
+ this.setIterateCount(nMaxIterations);
+ this.setIterateDelta(nMaxChange);
+
+ if (History.Is_On()) {
+ let oUpdateSheet = oWbModel.getActiveWs();
+ let oUpdateRange = new Asc.Range(0, 0, oUpdateSheet.getColsCount(), oUpdateSheet.getRowsCount());
+
+ if (this.getIterate() !== bOldIterate) {
+ History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_CalcPr_iterate,
+ oUpdateSheet.getId(), oUpdateRange, new UndoRedoData_FromTo(bOldIterate, this.getIterate()));
+ }
+ if (this.getIterateCount() !== nOldIterateCount) {
+ History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_CalcPr_iterateCount,
+ oUpdateSheet.getId(), oUpdateRange, new UndoRedoData_FromTo(nOldIterateCount, this.getIterateCount()));
+ }
+ if (this.getIterateDelta() !== nOldIterateDelta) {
+ History.Add(AscCommonExcel.g_oUndoRedoWorkbook, AscCH.historyitem_Workbook_CalcPr_iterateDelta,
+ oUpdateSheet.getId(), oUpdateRange, new UndoRedoData_FromTo(nOldIterateDelta, this.getIterateDelta()));
+ }
+ }
+ };
+
+ /**
+ * Class representing calculation settings for UI interface
+ * @constructor
+ */
+ function asc_CCalcSettings() {
+ // Default values if calcPr is empty
+ this.bIterativeCalc = false;
+ this.nMaxIterations = 100;
+ this.nMaxChange = 1e-3;
+ }
+
+ /**
+ * Method sets "Enable iterative calculation" setting
+ * @memberof asc_CCalcSettings
+ * @param {boolean} bIterativeCalc
+ */
+ asc_CCalcSettings.prototype.asc_setIterativeCalc = function (bIterativeCalc) {
+ this.bIterativeCalc = bIterativeCalc
+ };
+ /**
+ * Method returns "Enable iterative calculation" setting
+ * @memberof asc_CCalcSettings
+ * @returns {boolean}
+ */
+ asc_CCalcSettings.prototype.asc_getIterativeCalc = function () {
+ return this.bIterativeCalc;
+ };
+ /**
+ * Method sets "Maximum iterations" setting
+ * @memberof asc_CCalcSettings
+ * @param {number} nMaxIterations
+ */
+ asc_CCalcSettings.prototype.asc_setMaxIterations = function (nMaxIterations) {
+ this.nMaxIterations = nMaxIterations;
+ };
+ /**
+ * Method returns "Maximum iterations" setting
+ * @memberof asc_CCalcSettings
+ * @returns {number}
+ */
+ asc_CCalcSettings.prototype.asc_getMaxIterations = function () {
+ return this.nMaxIterations;
+ };
+ /**
+ * Method sets "Maximum change" setting
+ * @memberof asc_CCalcSettings
+ * @param {number} nMaxChange
+ */
+ asc_CCalcSettings.prototype.asc_setMaxChange = function (nMaxChange) {
+ this.nMaxChange = nMaxChange;
+ };
+ /**
+ * Method returns "Maximum change" setting
+ * @memberof asc_CCalcSettings
+ * @returns {number}
+ */
+ asc_CCalcSettings.prototype.asc_getMaxChange = function () {
+ return this.nMaxChange;
+ };
+ /**
+ * Method initializes settings according CalcPr
+ * @memberof asc_CCalcSettings
+ * @param {Workbook} oWbModel
+ */
+ asc_CCalcSettings.prototype.asc_initSettings = function (oWbModel) {
+ const oCalcPr = oWbModel.calcPr;
+ if (oCalcPr.getIterate() != null) {
+ this.asc_setIterativeCalc(oCalcPr.getIterate());
+ }
+ if (oCalcPr.getIterateCount() != null) {
+ this.asc_setMaxIterations(oCalcPr.getIterateCount());
+ }
+ if (oCalcPr.getIterateDelta() != null) {
+ this.asc_setMaxChange(oCalcPr.getIterateDelta());
+ }
+ };
+ /**
+ * Method checks if the given CalcPr object is equal to the current object.
+ * @memberof asc_CCalcSettings
+ * @param {CCalcPr} oCalcPr - The CalcPr to compare with.
+ * @returns {boolean} - True if the objects are equal, false otherwise.
+ */
+ asc_CCalcSettings.prototype.asc_isEqual = function (oCalcPr) {
+ const DEFAULT_ITERATE = false;
+ const DEFAULT_MAX_ITERATE = 100;
+ const DEFAULT_MAX_CHANGE = 1e-3;
+
+ const bIterativeCalcEqual = this.asc_getIterativeCalc() === oCalcPr.getIterate();
+ const bMaxIterationEqual = this.asc_getMaxIterations() === oCalcPr.getIterateCount();
+ const bMaxChangeEqual = this.asc_getMaxChange() === oCalcPr.getIterateDelta();
+ const bIterCalcDefaultVal = this.asc_getIterativeCalc() === DEFAULT_ITERATE && oCalcPr.getIterate() == null;
+ const bMaxIterDefaultVal = this.asc_getMaxIterations() === DEFAULT_MAX_ITERATE && oCalcPr.getIterateCount() == null;
+ const bMaxChangeDefaultVal = this.asc_getMaxChange() === DEFAULT_MAX_CHANGE && oCalcPr.getIterateDelta() == null;
+
+ return (bIterativeCalcEqual && bMaxIterationEqual && bMaxChangeEqual) ||
+ (bIterCalcDefaultVal && bMaxIterDefaultVal && bMaxChangeDefaultVal);
+ };
+
+ //****metadata****
+ function CMetadata() {
+ this.metadataTypes = null;
+ this.metadataStrings = null;
+ this.mdxMetadata = null;
+ this.cellMetadata = null;
+ this.valueMetadata = null;
+
+ this.aFutureMetadata = null;
+ }
+ CMetadata.prototype.clone = function () {
+ let res = new CMetadata();
+
+ res.metadataTypes = this.metadataTypes && this.metadataTypes.clone();
+ res.metadataStrings = this.metadataStrings && this.metadataStrings.clone();
+ res.mdxMetadata = this.mdxMetadata && this.mdxMetadata.clone();
+ res.cellMetadata = this.cellMetadata && this.cellMetadata.clone(); // CMetadataRecord.clone
+ res.valueMetadata = this.valueMetadata && this.valueMetadata.clone(); // CMetadataRecord.clone
+
+ res.aFutureMetadata = this.aFutureMetadata && this.aFutureMetadata.clone();
+
+ return res;
+ };
+
+ function CFutureMetadata() {
+ this.name = null;
+ this.futureMetadataBlocks = null;
+ }
+ CFutureMetadata.prototype.clone = function () {
+ let res = new CFutureMetadata();
+
+ res.name = this.name;
+ res.futureMetadataBlocks = this.futureMetadataBlocks && this.futureMetadataBlocks.clone();
+
+ return res;
+ };
+
+ function CMetadataType() {
+ this.minSupportedVersion = null;
+ this.ghostRow = null;
+ this.ghostCol = null;
+ this.edit = null;
+ this.delete = null;
+ this.copy = null;
+ this.pasteAll = null;
+ this.pasteFormulas = null;
+ this.pasteValues = null;
+ this.pasteFormats = null;
+ this.pasteComments = null;
+ this.pasteDataValidation = null;
+ this.pasteBorders = null;
+ this.pasteColWidths = null;
+ this.pasteNumberFormats = null;
+ this.merge = null;
+ this.splitFirst = null;
+ this.splitAll = null;
+ this.rowColShift = null;
+ this.clearAll = null;
+ this.clearFormats = null;
+ this.clearContents = null;
+ this.clearComments = null;
+ this.assign = null;
+ this.coerce = null;
+ this.cellMeta = null;
+ }
+ CMetadataType.prototype.clone = function () {
+ let res = new CMetadataType();
+
+ res.minSupportedVersion = this.minSupportedVersion;
+ res.ghostRow = this.ghostRow;
+ res.ghostCol = this.ghostCol;
+ res.edit = this.edit;
+ res.delete = this.delete;
+ res.copy = this.copy;
+ res.pasteAll = this.pasteAll;
+ res.pasteFormulas = this.pasteFormulas;
+ res.pasteValues = this.pasteValues;
+ res.pasteFormats = this.pasteFormats;
+ res.pasteComments = this.pasteComments;
+ res.pasteDataValidation = this.pasteDataValidation;
+ res.pasteBorders = this.pasteBorders;
+ res.pasteColWidths = this.pasteColWidths;
+ res.pasteNumberFormats = this.pasteNumberFormats;
+ res.merge = this.merge;
+ res.splitFirst = this.splitFirst;
+ res.splitAll = this.splitAll;
+ res.rowColShift = this.rowColShift;
+ res.clearAll = this.clearAll;
+ res.clearFormats = this.clearFormats;
+ res.clearContents = this.clearContents;
+ res.clearComments = this.clearComments;
+ res.assign = this.assign;
+ res.coerce = this.coerce;
+ res.cellMeta = this.cellMeta;
+
+ return res;
+ };
+
+ function CMetadataString() {
+ this.v = null;
+ }
+ CMetadataString.prototype.clone = function () {
+ let res = new CMetadataString();
+
+ res.v = this.v;
+
+ return res;
+ };
+
+ function CMdx() {
+ this.mdxTuple = null;
+ this.mdxSet = null;
+ this.mdxKPI = null;
+ this.mdxMemeberProp = null;
+
+ this.n = null;
+ this.f = null;
+ }
+ CMdx.prototype.clone = function () {
+ let res = new CMdx();
+
+ res.mdxTuple = this.mdxTuple && this.mdxTuple.clone();
+ res.mdxSet = this.mdxSet && this.mdxSet.clone();
+ res.mdxKPI = this.mdxKPI && this.mdxKPI.clone();
+
+ res.mdxMemeberProp = this.mdxMemeberProp && this.mdxMemeberProp.clone();
+
+ res.n = this.n;
+ res.f = this.f;
+
+ return res;
+ };
+
+ function CMdxTuple() {
+ this.c = null;
+ this.ct = null;
+ this.si = null;
+ this.fi = null;
+ this.bc = null;
+ this.fc = null;
+ this.i = null;
+ this.u = null;
+ this.st = null;
+ this.b = null;
+
+ this.metadataStringIndexes = null;
+ }
+ CMdxTuple.prototype.clone = function () {
+ let res = new CMdxTuple();
+
+ res.c = this.c;
+ res.ct = this.ct;
+ res.si = this.si;
+ res.fi = this.fi;
+ res.bc = this.bc;
+ res.fc = this.fc;
+ res.i = this.i;
+ res.u = this.u;
+ res.st = this.st;
+ res.b = this.b;
+
+ res.metadataStringIndexes = this.metadataStringIndexes && this.metadataStringIndexes.clone();
+
+ return res;
+ };
+
+ function CMdxSet() {
+ this.ns = null;
+ this.c = null;
+ this.o = null;
+
+ this.metadataStringIndexes = null;
+ }
+ CMdxSet.prototype.clone = function () {
+ let res = new CMdxSet();
+
+ res.ns = this.ns;
+ res.c = this.c;
+ res.o = this.o;
+
+ res.metadataStringIndexes = this.metadataStringIndexes && this.metadataStringIndexes.clone();
+
+ return res;
+ };
+
+ function CMetadataStringIndex() {
+ this.x = null;
+ this.s = null;
+
+ }
+ CMetadataStringIndex.prototype.clone = function () {
+ let res = new CMetadataStringIndex();
+
+ res.x = this.x;
+ res.s = this.s;
+
+ return res;
+ };
+
+ function CMdxMemeberProp() {
+ this.n = null;
+ this.np = null;
+
+ }
+ CMdxMemeberProp.prototype.clone = function () {
+ let res = new CMdxMemeberProp();
+
+ res.n = this.n;
+ res.np = this.np;
+
+ return res;
+ };
+
+ function CMdxKPI() {
+ this.n = null;
+ this.np = null;
+ this.p = null;
+ }
+ CMdxKPI.prototype.clone = function () {
+ let res = new CMdxKPI();
+
+ res.n = this.n;
+ res.np = this.np;
+ res.p = this.p;
+
+ return res;
+ };
+
+ function CMetadataBlock() {
+ this.elems = null;
+ }
+ CMetadataBlock.prototype.clone = function () {
+ let res = new CMetadataBlock();
+
+ res.elems = this.elems;
+
+ return res;
+ };
+
+ function CMetadataRecord() {
+ this.t = null;
+ this.v = null;
+ }
+ CMetadataRecord.prototype.clone = function () {
+ let res = new CMetadataRecord();
+
+ res.t = this.t;
+ res.v = this.v;
+
+ return res;
+ };
+
+ function CFutureMetadataBlock() {
+ this.extLst = null;
+ }
+ CFutureMetadataBlock.prototype.clone = function () {
+ let res = new CFutureMetadataBlock();
+
+ res.extLst = this.extLst && this.extLst.clone();
+
+ return res;
+ };
+
+ function CMetadataBlockExt() {
+ this.richValueBlock = null;
+ this.dynamicArrayProperties = null;
+ }
+ CMetadataBlockExt.prototype.clone = function () {
+ let res = new CMetadataBlockExt();
+
+ res.richValueBlock = this.richValueBlock && this.richValueBlock.clone();
+ res.dynamicArrayProperties = this.dynamicArrayProperties && this.dynamicArrayProperties.clone();
+
+ return res;
+ };
+ //TODO move to extensions?
+ function CDynamicArrayProperties() {
+ this.fDynamic = null;
+ this.fCollapsed = null;
+ }
+ CDynamicArrayProperties.prototype.clone = function () {
+ let res = new CDynamicArrayProperties();
+
+ res.fDynamic = this.fDynamic;
+ res.fCollapsed = this.fCollapsed;
+
+ return res;
+ };
+
+ function CRichValueBlock() {
+ this.i = null;
+ }
+ CRichValueBlock.prototype.clone = function () {
+ let res = new CRichValueBlock();
+
+ res.i = this.i;
+
+ return res;
+ };
function CCustomFunctionEngine(wb) {
this.wb = wb;
@@ -17283,7 +18038,7 @@ function RangeDataManagerElem(bbox, data)
if (!aArgs) {
return argsInfo;
}
-
+
let paramsMap = {};
if (params) {
for (let i in params) {
@@ -18334,6 +19089,35 @@ function RangeDataManagerElem(bbox, data)
window["AscCommonExcel"].CTimelineStyleElement = CTimelineStyleElement;
window["AscCommonExcel"].CTimelinePivotFilter = CTimelinePivotFilter;
+ window["AscCommonExcel"].CCalcPr = CCalcPr;
+
+ window["Asc"]["asc_CCalcSettings"] = window["Asc"].asc_CCalcSettings = asc_CCalcSettings;
+ prot = asc_CCalcSettings.prototype;
+ prot["asc_getIterativeCalc"] = prot.asc_getIterativeCalc;
+ prot["asc_getMaxIterations"] = prot.asc_getMaxIterations;
+ prot["asc_getMaxChange"] = prot.asc_getMaxChange;
+
+ prot["asc_setIterativeCalc"] = prot.asc_setIterativeCalc;
+ prot["asc_setMaxIterations"] = prot.asc_setMaxIterations;
+ prot["asc_setMaxChange"] = prot.asc_setMaxChange;
+ prot["asc_initSettings"] = prot.asc_initSettings;
+
+ window["AscCommonExcel"].CMetadata = CMetadata;
+ window["AscCommonExcel"].CMetadataType = CMetadataType;
+ window["AscCommonExcel"].CMetadataString = CMetadataString;
+ window["AscCommonExcel"].CFutureMetadata = CFutureMetadata;
+ window["AscCommonExcel"].CMdx = CMdx;
+ window["AscCommonExcel"].CMdxTuple = CMdxTuple;
+ window["AscCommonExcel"].CMdxSet = CMdxSet;
+ window["AscCommonExcel"].CMetadataStringIndex = CMetadataStringIndex;
+ window["AscCommonExcel"].CMdxMemeberProp = CMdxMemeberProp;
+ window["AscCommonExcel"].CMdxKPI = CMdxKPI;
+ window["AscCommonExcel"].CMetadataBlock = CMetadataBlock;
+ window["AscCommonExcel"].CMetadataRecord = CMetadataRecord;
+ window["AscCommonExcel"].CFutureMetadataBlock = CFutureMetadataBlock;
+ window["AscCommonExcel"].CMetadataBlockExt = CMetadataBlockExt;
+ window["AscCommonExcel"].CDynamicArrayProperties = CDynamicArrayProperties;
+ window["AscCommonExcel"].CRichValueBlock = CRichValueBlock;
window["AscCommonExcel"].CCustomFunctionEngine = CCustomFunctionEngine;
window["AscCommonExcel"].CCustomFunctionInfo = CCustomFunctionInfo;
diff --git a/cell/model/WorkbookProtection.js b/cell/model/WorkbookProtection.js
index 06931c8e00..48f65368dc 100644
--- a/cell/model/WorkbookProtection.js
+++ b/cell/model/WorkbookProtection.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/autofilters.js b/cell/model/autofilters.js
index 6c59e0b844..241c3fc727 100644
--- a/cell/model/autofilters.js
+++ b/cell/model/autofilters.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/model/clipboard.js b/cell/model/clipboard.js
index f9128c823d..44f8d05a84 100644
--- a/cell/model/clipboard.js
+++ b/cell/model/clipboard.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1629,7 +1629,7 @@
},
pasteFromBinary: function (worksheet, binary, isCellEditMode, isPasteAll) {
- var base64 = null, base64FromWord = null, base64FromPresentation = null, t = this;
+ var base64 = null, base64FromWord = null, base64FromPresentation = null, base64FromPDF = null, t = this;
if (binary.indexOf("xslData;") > -1) {
base64 = binary.split('xslData;')[1];
@@ -1637,6 +1637,8 @@
base64FromWord = binary.split('docData;')[1];
} else if (binary.indexOf("pptData;") > -1) {
base64FromPresentation = binary.split('pptData;')[1];
+ } else if (binary.indexOf("pdfData;") > -1) {
+ base64FromPDF = binary.split('pdfData;')[1];
}
var result = false;
@@ -1654,6 +1656,9 @@
} else if (base64FromPresentation) {
result = this._pasteFromBinaryPresentation(worksheet, base64FromPresentation, isIntoShape, isCellEditMode);
worksheet.workbook.handlers.trigger("cleanCopyData", true);
+ } else if (base64FromPDF) {
+ result = this._pasteFromBinaryPDF(worksheet, base64FromPDF, isIntoShape, isCellEditMode);
+ worksheet.workbook.handlers.trigger("cleanCopyData", true);
}
return result;
@@ -2220,6 +2225,236 @@
return {content: presentationSelectedContent, fonts: fonts, images: arr_Images};
},
+ _pasteFromBinaryPDF: function (worksheet, base64, isIntoShape, isCellEditMode) {
+ pptx_content_loader.Clear();
+
+ let _stream = AscFormat.CreateBinaryReader(base64, 0, base64.length);
+ let stream = new AscCommon.FileStream(_stream.data, _stream.size);
+ let p_url = stream.GetString2();
+ let t = this;
+
+ let bIsMultipleContent = stream.GetBool();
+
+ let selectedContent2 = [], i;
+ let multipleParamsCount = stream.GetULong();
+ for (i = 0; i < multipleParamsCount; i++) {
+ selectedContent2.push(this._readPDFSelectedContent(stream, worksheet));
+ }
+
+ let specialOptionsArr = [];
+ let specialProps = Asc.c_oSpecialPasteProps;
+ if (2 === multipleParamsCount) {
+ specialOptionsArr = [specialProps.sourceformatting];
+ } else if (3 === multipleParamsCount) {
+ specialOptionsArr = [specialProps.sourceformatting, specialProps.picture];
+ }
+
+ let pasteObj = selectedContent2[0] ? selectedContent2[0] : selectedContent2[1];
+
+ if (window['AscCommon'].g_specialPasteHelper.specialPasteStart) {
+ let props = window['AscCommon'].g_specialPasteHelper.specialPasteProps.property;
+ switch (props) {
+ case Asc.c_oSpecialPasteProps.picture: {
+ if (selectedContent2[2]) {
+ pasteObj = selectedContent2[2];
+ }
+ break;
+ }
+ }
+ }
+
+ let arr_Images, fonts, content = null;
+ if (pasteObj) {
+ arr_Images = pasteObj.images;
+ fonts = pasteObj.fonts;
+ content = pasteObj.content;
+ }
+
+ if (null === content) {
+ window['AscCommon'].g_specialPasteHelper.CleanButtonInfo();
+ window['AscCommon'].g_specialPasteHelper.Paste_Process_End();
+ return;
+ }
+
+ if (content.DocContent) {
+ let docContent = content.DocContent.Elements;
+
+ if (isCellEditMode) {
+ let text = this._getTextFromWord(docContent);
+ window['AscCommon'].g_specialPasteHelper.Paste_Process_End();
+ return text;
+ } else if (isIntoShape) {
+ let callback = function (isSuccess) {
+ if (isSuccess) {
+ t._insertBinaryIntoShapeContent(worksheet, docContent);
+ }
+ window['AscCommon'].g_specialPasteHelper.Paste_Process_End();
+ };
+
+ worksheet.objectRender.controller.checkPasteInText(callback);
+ return true;
+ } else {
+ History.TurnOff();
+ let oPasteFromBinaryWord = new pasteFromBinaryWord(this, worksheet, true);
+
+ let oTempDrawingDocument = window["Asc"]["editor"].wbModel.getDrawingDocument();
+ let newCDocument = new CDocument(oTempDrawingDocument, false);
+ newCDocument.bFromDocument = true;
+ newCDocument.theme = window["Asc"]["editor"].wbModel.theme;
+
+ let newContent = [];
+ for (i = 0; i < docContent.length; i++) {
+ if (type_Paragraph === docContent[i].GetType())//paragraph
+ {
+ docContent[i] = AscFormat.ConvertParagraphToWord(docContent[i], newCDocument);
+ docContent[i].bFromDocument = true;
+ newContent.push(docContent[i]);
+ } else if (type_Table === docContent[i].GetType())//table
+ {
+ //TODO вырезать из таблицы параграфы
+ }
+ }
+ docContent = newContent;
+
+ History.TurnOn();
+
+ oPasteFromBinaryWord._paste(worksheet, {content: docContent});
+ }
+ } else if (content.Drawings) {
+
+ if (isCellEditMode) {
+ return "";
+ }
+
+ window['AscCommon'].g_specialPasteHelper.CleanButtonInfo();
+ specialProps = window['AscCommon'].g_specialPasteHelper.buttonInfo;
+ if (specialOptionsArr.length > 1) {
+ specialProps.asc_setOptions(specialOptionsArr);
+ }
+
+ let arr_shapes = content.Drawings;
+ if (arr_shapes && arr_shapes.length && !(window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor)) {
+ if (content.Drawings.length === selectedContent2[1].content.Drawings.length) {
+ let oEndContent = {
+ Drawings: []
+ };
+ let oSourceContent = {
+ Drawings: []
+ };
+ for (i = 0; i < content.Drawings.length; ++i) {
+ oEndContent.Drawings.push({Drawing: content.Drawings[i].graphicObject});
+ oSourceContent.Drawings.push({Drawing: selectedContent2[1].content.Drawings[i].graphicObject});
+ }
+ AscFormat.checkDrawingsTransformBeforePaste(oEndContent, oSourceContent, null);
+ }
+ let newFonts = {};
+ for (i = 0; i < arr_shapes.length; i++) {
+ arr_shapes[i].graphicObject.getAllFonts(newFonts);
+ }
+
+ let aPastedImages = arr_Images;
+ worksheet._loadFonts(newFonts, function () {
+ if (aPastedImages && aPastedImages.length) {
+ t._loadImagesOnServer(aPastedImages, function () {
+ t._insertImagesFromBinary(worksheet, {Drawings: arr_shapes}, isIntoShape, true);
+ });
+ } else {
+ t._insertImagesFromBinary(worksheet, {Drawings: arr_shapes}, isIntoShape, true);
+ }
+ });
+ } else {
+ window['AscCommon'].g_specialPasteHelper.buttonInfo.clean();
+ }
+
+ return true;
+ }
+ },
+
+ _readPDFSelectedContent: function (stream, worksheet) {
+
+ var oPdfSelContent = null;
+ var fonts = [];
+ var arr_Images = {};
+ var oThis = this;
+
+ var loader = new AscCommon.BinaryPPTYLoader();
+ loader.presentation = worksheet.model;
+ loader.DrawingDocument = worksheet.getDrawingDocument();
+ loader.stream = stream;
+
+ var readContent = function () {
+ History.TurnOff();
+ var docContent = AscCommon.PasteProcessor.prototype.ReadPresentationText.call(this, stream, worksheet);
+ History.TurnOn();
+
+ if (docContent.length === 0) {
+ return;
+ }
+ oPdfSelContent.DocContent = new AscCommonWord.CSelectedContent();
+ oPdfSelContent.DocContent.Elements = docContent;
+
+ //перебираем шрифты
+ for (var i in oThis.oFonts) {
+ fonts.push(new AscFonts.CFont(i));
+ }
+ };
+
+ var readDrawings = function () {
+
+ var objects = oThis.ReadPresentationShapes(stream, worksheet);
+ oPdfSelContent.Drawings = objects.arrShapes;
+
+ var arr_shapes = objects.arrShapes;
+ var font_map = {}, i;
+ for (i = 0; i < arr_shapes.length; ++i) {
+ if (arr_shapes[i].graphicObject.getAllFonts) {
+ arr_shapes[i].graphicObject.getAllFonts(font_map);
+ }
+ }
+
+ for (i in font_map) {
+ fonts.push(new AscFonts.CFont(i));
+ }
+
+ arr_Images = objects.arrImages;
+ };
+
+ var skip1 = function () {
+ var selected_objs = loader.stream.GetULong();
+
+ for (var i = 0; i < selected_objs; ++i) {
+ loader.stream.GetUChar();
+ loader.stream.SkipRecord();
+ }
+ };
+
+ var first_content = stream.GetString2();
+ if (first_content === "SelectedContent") {
+ var countContent = stream.GetULong();
+ for (var i = 0; i < countContent; i++) {
+ if (null === oPdfSelContent) {
+ oPdfSelContent = window["AscPDF"] && window["AscPDF"].PDFSelectedContent ? new window["AscPDF"].PDFSelectedContent() : {};
+ }
+ var first_string = stream.GetString2();
+ switch (first_string) {
+ case "DocContent": {
+ readContent(stream, worksheet);
+ break;
+ }
+ case "Drawings": {
+ readDrawings();
+ break;
+ }
+ default: {
+ skip1();
+ }
+ }
+ }
+ }
+
+ return {content: oPdfSelContent, fonts: fonts, images: arr_Images};
+ },
+
_insertBinaryIntoShapeContent: function (worksheet, content, isConvertToPPTX) {
if (!content || !content.length) {
return;
@@ -2497,6 +2732,7 @@
}
oDrawing.addToDrawingObjects();
oDrawing.checkDrawingBaseCoords();
+ oDrawing.generateSmartArtDrawingPart();
oDrawing.recalculate();
oDrawing.select(ws.objectRender.controller, 0);
}
@@ -2670,6 +2906,7 @@
graphicObject.setDrawingBaseType(nAnchorType);
if (graphicObject.checkExtentsByDocContent) {
graphicObject.checkDrawingBaseCoords();
+ graphicObject.generateSmartArtDrawingPart();
graphicObject.checkExtentsByDocContent();
}
aDrawings.push(graphicObject);
@@ -2875,7 +3112,7 @@
},
_getClassBinaryFromHtml: function (node) {
- var base64 = null, base64FromWord = null, base64FromPresentation = null;
+ var base64 = null, base64FromWord = null, base64FromPresentation = null, base64FromPDF;
var classNode = AscCommon.searchBinaryClass(node);
if (classNode != null) {
@@ -2887,6 +3124,8 @@
base64FromWord = cL[i].split('docData;')[1];
} else if (cL[i].indexOf("pptData;") > -1) {
base64FromPresentation = cL[i].split('pptData;')[1];
+ } else if (cL[i].indexOf("pdfData;") > -1) {
+ base64FromPDF = cL[i].split('pdfData;')[1];
}
}
}
@@ -4478,7 +4717,7 @@
formatBorders.initDefault();
}
//top border for cell
- if (top === cellTable.top && (!formatBorders.t || formatBorders.t.isEmpty()) && borders.Top.Value !== 0/*border_None*/) {
+ if (top === cellTable.top && (!formatBorders.t || formatBorders.t.isEmpty()) && borders.Top.Value !== AscWord.BorderType.none) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Top.Size, 3, 1));
if (null !== borderStyleName) {
formatBorders.t = new AscCommonExcel.BorderProp();
@@ -4487,7 +4726,7 @@
}
}
//left border for cell
- if (left === cellTable.left && (!formatBorders.l || formatBorders.l.isEmpty()) && borders.Left.Value !== 0/*border_None*/) {
+ if (left === cellTable.left && (!formatBorders.l || formatBorders.l.isEmpty()) && borders.Left.Value !== AscWord.BorderType.none) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Left.Size, 3, 1));
if (null !== borderStyleName) {
formatBorders.l = new AscCommonExcel.BorderProp();
@@ -4497,7 +4736,7 @@
}
//bottom border for cell
if (top === cellTable.top + heightCell - 1 && (!formatBorders.b || formatBorders.b.isEmpty()) &&
- borders.Bottom.Value !== 0/*border_None*/) {
+ borders.Bottom.Value !== AscWord.BorderType.none) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Bottom.Size, 3, 1));
if (null !== borderStyleName) {
formatBorders.b = new AscCommonExcel.BorderProp();
@@ -4507,7 +4746,7 @@
}
//right border for cell
if (left === cellTable.left + widthCell - 1 && (!formatBorders.r || formatBorders.r.isEmpty()) &&
- borders.Right.Value !== 0/*border_None*/) {
+ borders.Right.Value !== AscWord.BorderType.none) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Right.Size, 3, 1));
if (null !== borderStyleName) {
formatBorders.r = new AscCommonExcel.BorderProp();
diff --git a/cell/model/protectRange.js b/cell/model/protectRange.js
index b148862415..6ea1f6a3b5 100644
--- a/cell/model/protectRange.js
+++ b/cell/model/protectRange.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -12,7 +12,7 @@
* 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 20A-12 Ernesta Birznieka-Upisha
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
diff --git a/cell/model/whatIfAnalysis.js b/cell/model/whatIfAnalysis.js
index 4fb1dabc6a..032388ee2a 100644
--- a/cell/model/whatIfAnalysis.js
+++ b/cell/model/whatIfAnalysis.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/utils/utils.js b/cell/utils/utils.js
index 0fb57ee466..8010f87f30 100644
--- a/cell/utils/utils.js
+++ b/cell/utils/utils.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -2067,6 +2067,9 @@
}
function getFragmentsText(f) {
+ if (!f) {
+ return "";
+ }
return f.reduce(function (pv, cv) {
if (null === cv.getFragmentText()) {
cv.initText();
@@ -2076,6 +2079,9 @@
}
function getFragmentsLength(f) {
+ if (!f) {
+ return;
+ }
return f.length > 0 ? f.reduce(function (pv, cv) {
if (null === cv.getFragmentText()) {
cv.initText();
@@ -2085,18 +2091,27 @@
}
function getFragmentsCharCodes(f) {
+ if (!f) {
+ return;
+ }
return f.reduce(function (pv, cv) {
return pv.concat(cv.getCharCodes());
- }, "");
+ }, []);
}
function getFragmentsCharCodesLength(f) {
+ if (!f) {
+ return 0;
+ }
return f.length > 0 ? f.reduce(function (pv, cv) {
return pv + cv.getCharCodes().length;
}, 0) : 0;
}
function getFragmentsTextFromCode(f) {
+ if (!f) {
+ return "";
+ }
return f.reduce(function (pv, cv) {
if (null === cv.getFragmentText()) {
cv.initText();
@@ -2385,6 +2400,14 @@
var oMatrix = new AscCommon.CMatrix();
oMatrix.tx = rect._x;
oMatrix.ty = rect._y;
+ //TODO !!!rtl print
+ let api = window.Asc.editor;
+ let wb = api && api.wb;
+ let ws = wb.getWorksheet();
+ if (ws && ws.getRightToLeft()) {
+ oMatrix.sx = -1;
+ oMatrix.tx = (ws.getCtxWidth() * vector_koef) - oMatrix.tx;
+ }
graphics.transform3(oMatrix);
var shapeDrawer = new AscCommon.CShapeDrawer();
shapeDrawer.Graphics = graphics;
@@ -3092,6 +3115,7 @@
this.zoomScale = 100;
this.showZeros = null;
+ this.rightToLeft = null;
this.showFormulas = null;
this.topLeftCell = null;
@@ -3114,6 +3138,7 @@
}
result.showZeros = this.showZeros;
result.topLeftCell = this.topLeftCell;
+ result.rightToLeft = this.rightToLeft;
result.showFormulas = this.showFormulas;
return result;
},
@@ -3140,6 +3165,9 @@
asc_getShowFormulas: function () {
return false !== this.showFormulas;
},
+ asc_getRightToLeft: function () {
+ return this.rightToLeft;
+ },
asc_setShowGridLines: function (val) {
this.showGridLines = val;
},
@@ -3154,6 +3182,9 @@
},
asc_setShowFormulas: function (val) {
this.showFormulas = val;
+ },
+ asc_setRightToLeft: function (val) {
+ this.rightToLeft = val;
}
};
@@ -3892,8 +3923,8 @@
}
};
- cDate.prototype.getDateString = function (api) {
- return api.asc_getLocaleExample(AscCommon.getShortDateFormat(), this.getExcelDate());
+ cDate.prototype.getDateString = function (api, bLocal) {
+ return api.asc_getLocaleExample(AscCommon.getShortDateFormat(), this.getExcelDate(bLocal));
};
cDate.prototype.getTimeString = function (api) {
return api.asc_getLocaleExample(AscCommon.getShortTimeFormat(), this.getExcelDateWithTime() - this.getTimezoneOffset() / (60 * 24));
@@ -4070,6 +4101,8 @@
prot["asc_setShowRowColHeaders"] = prot.asc_setShowRowColHeaders;
prot["asc_setShowZeros"] = prot.asc_setShowZeros;
prot["asc_setShowFormulas"] = prot.asc_setShowFormulas;
+ prot["asc_setRightToLeft"] = prot.asc_setRightToLeft;
+ prot["asc_getRightToLeft"] = prot.asc_getRightToLeft;
window["AscCommonExcel"].asc_CPane = asc_CPane;
window["AscCommonExcel"].asc_CSheetPr = asc_CSheetPr;
diff --git a/cell/view/CellEditorView.js b/cell/view/CellEditorView.js
index 659a9270e6..92c35034f5 100644
--- a/cell/view/CellEditorView.js
+++ b/cell/view/CellEditorView.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -162,8 +162,8 @@ function (window, undefined) {
/** @type RegExp */
this.rangeChars = ["=", "-", "+", "*", "/", "(", "{", "<", ">", "^", "!", "&", ":", " ", "."];
- this.reNotFormula = new XRegExp("[^\\p{L}\\\\_\\#\\]\\[\\p{N}\\.\"\]", "i");
- this.reFormula = new XRegExp("^([\\p{L}\\\\_\\]\\[][\\p{L}\\\\_\\#\\]\\[\\p{N}\\.]*)", "i");
+ this.reNotFormula = new XRegExp("[^\\p{L}\\\\_\\#\\]\\[\\p{N}\\.\"\@]", "i");
+ this.reFormula = new XRegExp("^([\\p{L}\\\\_\\]\\[][\\p{L}\\\\_\\#\\]\\[\\p{N}\\.@]*)", "i");
this.defaults = {
padding: padding,
@@ -422,8 +422,6 @@ function (window, undefined) {
this.End_CompositeInput();
}
- AscCommon.StartIntervalDrawText(false);
-
if (saveValue) {
// Пересчет делаем всегда для не пустой ячейки или если были изменения. http://bugzilla.onlyoffice.com/show_bug.cgi?id=34864
if (0 < this.undoList.length || 0 < AscCommonExcel.getFragmentsCharCodesLength(this.options.fragments)) {
@@ -483,6 +481,10 @@ function (window, undefined) {
if (this.isFormula()) {
return;
}
+ if (!this.options.fragments) {
+ return;
+ }
+
this.startAction();
var t = this, opt = t.options, begin, end, i, first, last;
@@ -541,6 +543,9 @@ function (window, undefined) {
if (this.isFormula()) {
return;
}
+ if (!this.options.fragments) {
+ return;
+ }
var t = this, opt = t.options;
if (t.selectionBegin !== t.selectionEnd) {
@@ -556,6 +561,9 @@ function (window, undefined) {
CellEditor.prototype._changeFragments = function (fragmentsMap) {
let opt = this.options;
+ if (!opt.fragments) {
+ return;
+ }
this.startAction();
if (fragmentsMap) {
let _undoFragments = {};
@@ -953,7 +961,8 @@ function (window, undefined) {
bboxOper = null;
r = this._parseResult.refPos[index];
oper = r.oper;
- if (cElementType.table === oper.type || cElementType.name === oper.type || cElementType.name3D === oper.type) {
+ if ((cElementType.table === oper.type || cElementType.name === oper.type ||
+ cElementType.name3D === oper.type) && oper.externalLink == null) {
oper = r.oper.toRef(bbox);
if (oper instanceof AscCommonExcel.cError) {
continue;
@@ -1260,9 +1269,9 @@ function (window, undefined) {
//получаю строку без двухбайтовых символов и её отдаю регулярке
//позиции всех функций должны совпадать
//остаётся вопрос с аргументами, которые могут содержать двухбайтовые символы
- s = this.options.fragments.reduce(function (pv, cv) {
+ s = this.options.fragments ? this.options.fragments.reduce(function (pv, cv) {
return pv + AscCommonExcel.convertUnicodeToSimpleString(cv.getCharCodes());
- }, "");
+ }, "") : "";
if (isFormula) {
let obj = this._getFunctionByString(this.cursorPos, s);
@@ -1363,7 +1372,7 @@ function (window, undefined) {
CellEditor.prototype._expand = function () {
var bottom, tm;
var doAdjust = false, fragments = this._getRenderFragments();
- if (0 < fragments.length) {
+ if (fragments && 0 < fragments.length) {
bottom = this.bottom;
this.bottom = this.sides.b[this.sides.bi];
@@ -1537,11 +1546,13 @@ function (window, undefined) {
if (!window['IS_NATIVE_EDITOR']) {
let _width = this._originalCanvasWidth ? this._originalCanvasWidth : ctx.getWidth();
- ctx.setFillStyle(opt.background)
- .fillRect(0, 0, _width, ctx.getHeight());
+ if (opt.background) {
+ ctx.setFillStyle(opt.background);
+ }
+ ctx.fillRect(0, 0, _width, ctx.getHeight());
}
- if (opt.fragments.length > 0) {
+ if (opt.fragments && opt.fragments.length > 0) {
t.textRender.render(undefined, t._getContentLeft(), dy || 0, t._getContentWidth(), opt.font.getColor());
}
};
@@ -1855,14 +1866,14 @@ function (window, undefined) {
var l = Math.min(s1.length, s2.length);
var i1 = 0, i2;
- while (i1 < l && s1.charAt(i1) === s2.charAt(i1)) {
+ while (i1 < l && s1[i1] === s2[i1]) {
++i1;
}
i2 = i1 + 1;
if (i2 >= l) {
i2 = Math.max(s1.length, s2.length);
} else {
- while (i2 < l && s1.charAt(i1) !== s2.charAt(i2)) {
+ while (i2 < l && s1[i1] !== s2[i2]) {
++i2;
}
}
@@ -1891,6 +1902,9 @@ function (window, undefined) {
};
CellEditor.prototype._getContentPosition = function () {
+ if (!this.textFlags) {
+ return this.defaults.padding;
+ }
switch (this.textFlags.textAlign) {
case AscCommon.align_Right:
return this.right - this.left - this.defaults.padding - 1;
@@ -1920,6 +1934,10 @@ function (window, undefined) {
this.sAutoComplete = null;
+ if (!opt.fragments) {
+ return;
+ }
+
if (this.selectionBegin !== this.selectionEnd) {
var copyFragment = this._findFragmentToInsertInto(Math.min(this.selectionBegin, this.selectionEnd) + 1);
if (copyFragment && !this.newTextFormat) {
@@ -2035,6 +2053,9 @@ function (window, undefined) {
if (b === e) {
return;
}
+ if (!opt.fragments) {
+ return;
+ }
this.startAction();
@@ -2122,6 +2143,9 @@ function (window, undefined) {
if (!fragments) {
fragments = this.options.fragments;
}
+ if (!fragments) {
+ return;
+ }
for (i = 0, begin = 0; i < fragments.length; ++i) {
end = begin + fragments[i].getCharCodesLength();
@@ -2141,6 +2165,9 @@ function (window, undefined) {
if (!fragments) {
fragments = this.options.fragments;
}
+ if (!fragments) {
+ return;
+ }
for (i = 0, begin = 0; i < fragments.length; ++i) {
end = begin + fragments[i].getCharCodesLength();
@@ -2164,6 +2191,9 @@ function (window, undefined) {
if (!fragments) {
fragments = this.options.fragments;
}
+ if (!fragments) {
+ return;
+ }
if (pos > f.begin && pos < f.end) {
fr = fragments[f.index];
@@ -2221,6 +2251,10 @@ function (window, undefined) {
CellEditor.prototype._addFragments = function (f, pos) {
var t = this, opt = t.options, fr;
+ if (!opt.fragments) {
+ return;
+ }
+
fr = t._findFragment(pos);
if (fr && pos < fr.end) {
t._splitFragment(fr, pos);
@@ -2245,6 +2279,9 @@ function (window, undefined) {
if (!fragments) {
fragments = this.options.fragments;
}
+ if (!fragments) {
+ return;
+ }
for (i = 0; i < fragments.length;) {
if (fragments[i].getCharCodesLength() < 1 && fragments.length > 1) {
@@ -2269,6 +2306,10 @@ function (window, undefined) {
CellEditor.prototype._cleanFragments = function (fr) {
var t = this, i, s, f, wrap = t.textFlags.wrapText || t.textFlags.wrapOnlyNL;
+ if (!fr) {
+ return;
+ }
+
for (i = 0; i < fr.length; ++i) {
s = fr[i].getCharCodes();
if (!wrap && -1 !== window["Asc"].search(s, function (val) {
@@ -2363,7 +2404,7 @@ function (window, undefined) {
let _redoFragments = {};
for (let i in _fragments) {
if (_fragments.hasOwnProperty(i)) {
- if (this.options.fragments[i]) {
+ if (this.options.fragments && this.options.fragments[i]) {
_redoFragments[i] = this.options.fragments[i].clone();
}
}
@@ -2389,6 +2430,7 @@ function (window, undefined) {
var applyByArray = t.textFlags && t.textFlags.ctrlKey;
if (!applyByArray && success) {
t.handlers.trigger("applyCloseEvent", event);
+ AscCommon.StartIntervalDrawText(false);
}
};
this.close(true, callback);
@@ -2421,7 +2463,7 @@ function (window, undefined) {
}
var xfs = new AscCommonExcel.CellXfs();
- xfs.setFont(this.newTextFormat || this.options.fragments[f.index].format);
+ xfs.setFont(this.newTextFormat || (this.options.fragments && this.options.fragments[f.index].format));
this.handlers.trigger("updateEditorSelectionInfo", xfs);
};
@@ -2795,7 +2837,7 @@ function (window, undefined) {
case 186: // ctrl + (shift) + ;
if (ctrlKey) {
var oDate = new Asc.cDate();
- t._addChars(event.shiftKey ? oDate.getTimeString(api) : oDate.getDateString(api));
+ t._addChars(event.shiftKey ? oDate.getTimeString(api) : oDate.getDateString(api, true));
event.stopPropagation();
event.preventDefault();
}
@@ -3050,7 +3092,7 @@ function (window, undefined) {
return {x: event.pageX, y: event.pageY};
}
- var offs = this.canvasOverlay.getBoundingClientRect();
+ var offs = AscCommon.UI.getBoundingClientRect(this.canvasOverlay);
var x = (((event.pageX * AscBrowser.zoom) >> 0) - offs.left) / this.kx;
var y = (((event.pageY * AscBrowser.zoom) >> 0) - offs.top) / this.ky;
@@ -3155,6 +3197,12 @@ function (window, undefined) {
this.skipKeyPress = val;
};
CellEditor.prototype.getText = function (start, len) {
+ if (start == null) {
+ start = 0;
+ }
+ if (len == null) {
+ len = this.textRender.getCharsCount();
+ }
let chars = this.textRender.getChars(start, len);
let res = "";
for (let i in chars) {
diff --git a/cell/view/CellTextRender.js b/cell/view/CellTextRender.js
index 1d8df96b59..307299c57d 100644
--- a/cell/view/CellTextRender.js
+++ b/cell/view/CellTextRender.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/view/DrawingObjectsController.js b/cell/view/DrawingObjectsController.js
index fd48e350e0..8bb7c09936 100644
--- a/cell/view/DrawingObjectsController.js
+++ b/cell/view/DrawingObjectsController.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/view/EventsController.js b/cell/view/EventsController.js
index d05efa93ab..8ebb82155c 100644
--- a/cell/view/EventsController.js
+++ b/cell/view/EventsController.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -154,7 +154,7 @@
return;
}
- if (this.view.Api.isMobileVersion) {
+ if (this.view.Api.isUseOldMobileVersion()) {
/*раньше события на ресайз вызывался из меню через контроллер. теперь контроллер в меню не доступен, для ресайза подписываемся на глобальный ресайз от window.*/
window.addEventListener("resize", function () {
self._onWindowResize.apply(self, arguments);
@@ -434,7 +434,7 @@
settings.isVerticalScroll = true;
settings.isHorizontalScroll = false;
this.vsbApi.canvasH = null;
- this.reinitScrollY(settings, ws.getFirstVisibleRow(true), ws.getVerticalScrollRange(), ws.getVerticalScrollMax());
+ this.reinitScrollY(settings, ws.workbook.getSmoothScrolling() ? ws.getFirstVisibleRowSmoothScroll(true) : ws.getFirstVisibleRow(true), ws.getVerticalScrollRange(), ws.getVerticalScrollMax());
this.vsbApi.settings = settings;
}
if (this.hsbApi) {
@@ -444,7 +444,7 @@
settings.isVerticalScroll = false;
settings.isHorizontalScroll = true;
this.hsbApi.canvasW = null;
- this.reinitScrollX(settings, ws.getFirstVisibleCol(true), ws.getHorizontalScrollRange(), ws.getHorizontalScrollMax());
+ this.reinitScrollX(settings, ws.workbook.getSmoothScrolling() ? ws.getFirstVisibleColSmoothScroll(true) : ws.getFirstVisibleCol(true), ws.getHorizontalScrollRange(), ws.getHorizontalScrollMax());
this.hsbApi.settings = settings;
}
};
@@ -456,7 +456,15 @@
this.vsb = document.createElement('div');
this.vsb.id = "ws-v-scrollbar";
this.vsb.style.backgroundColor = AscCommon.GlobalSkin.ScrollBackgroundColor;
- this.widget.appendChild(this.vsb);
+ //TODO test rtl
+ /*if (window.rightToleft) {
+ this.vsb.style.left = "0px";
+ this.widget.prepend(this.vsb);
+ this.widget.children[1].style.left = this.vsb.clientWidth + "px";
+ this.widget.children[1].style.overflow = "visible"
+ } else {*/
+ this.widget.appendChild(this.vsb);
+ //}
if (!this.vsbApi) {
settings = this.createScrollSettings();
@@ -1331,9 +1339,13 @@
};
if ((dc !== 0 || dr !== 0) && false === t.handlers.trigger("isGlobalLockEditCell")) {
+ const wb = window["Asc"]["editor"].wb;
+ let ws = wb.getWorksheet();
+ if (ws && ws.getRightToLeft()) {
+ dc = -dc;
+ }
if (isChangeVisibleAreaMode) {
t.handlers.trigger("changeVisibleArea", !shiftKey, dc, dr, false, function (d) {
- const wb = window["Asc"]["editor"].wb;
if (t.targetInfo) {
wb._onUpdateWorksheet(t.targetInfo.coordX, t.targetInfo.coordY, false);
}
@@ -1354,7 +1366,8 @@
if (t.targetInfo) {
wb._onUpdateWorksheet(t.targetInfo.coordX, t.targetInfo.coordY, false);
}
- t.scroll(d);
+ const ws = wb.getWorksheet();
+ t.scroll(ws.convertOffsetToSmooth(d));
_checkLastTab();
});
}
@@ -1621,6 +1634,17 @@
/** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseDown = function (event) {
+ let touchManager = this.view.Api.wb.MobileTouchManager;
+ if (touchManager && touchManager.checkTouchEvent(event))
+ {
+ touchManager.startTouchingInProcess();
+ let res = touchManager.mainOnTouchStart(event);
+ touchManager.stopTouchingInProcess();
+ return res;
+ }
+ if (touchManager)
+ touchManager.checkMouseFocus(event);
+
var t = this;
asc["editor"].checkInterfaceElementBlur();
var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
@@ -1851,6 +1875,15 @@
/** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseUp = function (event) {
+ let touchManager = this.view.Api.wb.MobileTouchManager;
+ if (touchManager && touchManager.checkTouchEvent(event))
+ {
+ touchManager.startTouchingInProcess();
+ let res = touchManager.mainOnTouchEnd(event);
+ touchManager.stopTouchingInProcess();
+ return res;
+ }
+
var button = AscCommon.getMouseButton(event);
AscCommon.global_mouseEvent.UnLockMouse();
@@ -1943,6 +1976,15 @@
/** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseMove = function (event) {
+ let touchManager = this.view.Api.wb.MobileTouchManager;
+ if (touchManager && touchManager.checkTouchEvent(event))
+ {
+ touchManager.startTouchingInProcess();
+ let res = touchManager.mainOnTouchMove(event);
+ touchManager.stopTouchingInProcess();
+ return res;
+ }
+
var t = this;
var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var coord = t._getCoordinates(event);
@@ -2068,44 +2110,78 @@
var self = this;
var deltaX = 0, deltaY = 0;
- if (undefined !== event.wheelDelta && 0 !== event.wheelDelta) {
- deltaY = -1 * event.wheelDelta / 40;
- } else if (undefined !== event.detail && 0 !== event.detail) {
- // FF
- deltaY = event.detail;
- } else if (undefined !== event.deltaY && 0 !== event.deltaY) {
- // FF
- //ограничиваем шаг из-за некорректного значения deltaY после обновления FF
- //TODO необходимо пересмотреть. нужны корректные значения и учетом системного шага.
- var _maxDelta = 3;
- if (AscCommon.AscBrowser.isMozilla && Math.abs(event.deltaY) > _maxDelta) {
- deltaY = Math.sign(event.deltaY) * _maxDelta;
- } else {
- deltaY = event.deltaY;
+
+ const wb = window["Asc"]["editor"].wb;
+ //TODO for mac touchpads. need review
+ if (wb.smoothScroll && AscCommon.AscBrowser.isMacOs) {
+ var delta = 0;
+
+ if (undefined != event.wheelDelta && event.wheelDelta != 0) {
+ delta = -45 * event.wheelDelta / 120;
+ }
+ {
+ delta = 45 * event.detail / 3;
}
- }
- if (undefined !== event.deltaX && 0 !== event.deltaX) {
- deltaX = event.deltaX;
- }
- if (event.axis !== undefined && event.axis === event.HORIZONTAL_AXIS) {
- deltaX = deltaY;
- deltaY = 0;
- }
- if (undefined !== event.wheelDeltaX && 0 !== event.wheelDeltaX) {
- // Webkit
- deltaX = -1 * event.wheelDeltaX / 40;
- }
- if (undefined !== event.wheelDeltaY && 0 !== event.wheelDeltaY) {
+ // New school multidimensional scroll (touchpads) deltas
+ deltaY = delta;
+
+
// Webkit
- deltaY = -1 * event.wheelDeltaY / 40;
+ if (undefined !== event.wheelDeltaY && 0 !== event.wheelDeltaY) {
+ deltaY = -45 * event.wheelDeltaY / 120;
+ }
+ if (undefined !== event.wheelDeltaX && 0 !== event.wheelDeltaX) {
+ deltaX = -45 * event.wheelDeltaX / 120;
+ }
+
+
+ deltaX >>= 0;
+ deltaY >>= 0;
+
+ deltaX = (deltaX / wb.getWorksheet().getHScrollStep()) * AscCommon.AscBrowser.retinaPixelRatio;
+ deltaY = (deltaY / wb.getWorksheet().getVScrollStep()) * AscCommon.AscBrowser.retinaPixelRatio;
+ } else {
+ if (undefined !== event.wheelDelta && 0 !== event.wheelDelta) {
+ deltaY = -1 * event.wheelDelta / 40;
+ } else if (undefined !== event.detail && 0 !== event.detail) {
+ // FF
+ deltaY = event.detail;
+ } else if (undefined !== event.deltaY && 0 !== event.deltaY) {
+ // FF
+ //ограничиваем шаг из-за некорректного значения deltaY после обновления FF
+ //TODO необходимо пересмотреть. нужны корректные значения и учетом системного шага.
+ var _maxDelta = 3;
+ if (AscCommon.AscBrowser.isMozilla && Math.abs(event.deltaY) > _maxDelta) {
+ deltaY = Math.sign(event.deltaY) * _maxDelta;
+ } else {
+ deltaY = event.deltaY;
+ }
+ }
+ if (undefined !== event.deltaX && 0 !== event.deltaX) {
+ deltaX = event.deltaX;
+ }
+ if (event.axis !== undefined && event.axis === event.HORIZONTAL_AXIS) {
+ deltaX = deltaY;
+ deltaY = 0;
+ }
+
+ if (undefined !== event.wheelDeltaX && 0 !== event.wheelDeltaX) {
+ // Webkit
+ deltaX = -1 * event.wheelDeltaX / 40;
+ }
+ if (undefined !== event.wheelDeltaY && 0 !== event.wheelDeltaY) {
+ // Webkit
+ deltaY = -1 * event.wheelDeltaY / 40;
+ }
}
+
if (event.shiftKey) {
deltaX = deltaY;
deltaY = 0;
}
- if (this.smoothWheelCorrector) {
+ if (this.smoothWheelCorrector && !wb.smoothScroll) {
deltaX = this.smoothWheelCorrector.get_DeltaX(deltaX);
deltaY = this.smoothWheelCorrector.get_DeltaY(deltaY);
}
@@ -2118,11 +2194,15 @@
this.handlers.trigger("updateWorksheet", /*x*/undefined, /*y*/undefined, /*ctrlKey*/undefined,
function () {
if (deltaX && (!self.smoothWheelCorrector || !self.smoothWheelCorrector.isBreakX())) {
- deltaX = Math.sign(deltaX) * Math.ceil(Math.abs(deltaX / 3));
+ if (!wb.smoothScroll) {
+ deltaX = Math.sign(deltaX) * Math.ceil(Math.abs(deltaX / 3));
+ }
self.scrollHorizontal(deltaX, event);
}
if (deltaY && (!self.smoothWheelCorrector || !self.smoothWheelCorrector.isBreakY())) {
- deltaY = Math.sign(deltaY) * Math.ceil(Math.abs(deltaY * self.settings.wheelScrollLinesV / 3));
+ if (!wb.smoothScroll) {
+ deltaY = Math.sign(deltaY) * Math.ceil(Math.abs(deltaY * self.settings.wheelScrollLinesV / 3));
+ }
self.scrollVertical(deltaY, event);
}
self._onMouseMove(event);
@@ -2158,7 +2238,7 @@
return event.coord;
}
- var offs = this.element.getBoundingClientRect();
+ var offs = AscCommon.UI.getBoundingClientRect(this.element);
var x = ((event.pageX * AscBrowser.zoom) >> 0) - offs.left;
var y = ((event.pageY * AscBrowser.zoom) >> 0) - offs.top;
diff --git a/cell/view/HandlerList.js b/cell/view/HandlerList.js
index 601a0d7073..b702716037 100644
--- a/cell/view/HandlerList.js
+++ b/cell/view/HandlerList.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/cell/view/StringRender.js b/cell/view/StringRender.js
index 8a83272501..4201bdbdcb 100644
--- a/cell/view/StringRender.js
+++ b/cell/view/StringRender.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -125,8 +125,8 @@
oRes.c = (undefined !== this.c) ? this.c.clone() : undefined;
oRes.lm = (undefined !== this.lm) ? this.lm.clone() : undefined;
oRes.fm = (undefined !== this.fm) ? this.fm.clone() : undefined;
- oRes.fsz = (undefined !== this.fsz) ? this.fsz.clone() : undefined;
oRes.font = (undefined !== this.font) ? this.font.clone() : undefined;
+ oRes.fsz = this.fsz;
oRes.va = this.va;
oRes.nl = this.nl;
oRes.hp = this.hp;
diff --git a/cell/view/WorkbookView.js b/cell/view/WorkbookView.js
index 971c9cce91..567c544d0e 100644
--- a/cell/view/WorkbookView.js
+++ b/cell/view/WorkbookView.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -331,6 +331,8 @@
this.customFunctionEngine = null;
+ this.smoothScroll = true;
+
return this;
}
@@ -352,10 +354,10 @@
if (null != this.element) {
if (!this.Api.VersionHistory && !this.Api.isEditOleMode) {
this.element.innerHTML = '
\
-
\
-
\
-
\
-
\
+
\
+
\
+
\
+
\
\
';
@@ -391,7 +393,7 @@
this.mainGraphics = new AscCommon.CGraphics();
this.trackOverlay = new AscCommon.COverlay();
this.trackOverlay.IsCellEditor = true;
- if(this.Api.isMobileVersion) {
+ if(/*this.Api.isMobileVersion*/true) {
this.mainOverlay = new AscCommon.COverlay();
this.mainOverlay.IsCellEditor = true;
}
@@ -407,6 +409,11 @@
this.stringRender = new AscCommonExcel.StringRender(this.buffers.main);
+ //need clean previous fonts settings, next in _calcMaxDigitWidth do setFont and reinstall setupFontSize/...
+ if (this.Api.VersionHistory) {
+ AscCommonExcel.resetDrawingContextFonts();
+ }
+
// Мерить нужно только со 100% и один раз для всего документа
this._calcMaxDigitWidth();
@@ -1245,13 +1252,13 @@
var ws = this.getWorksheet();
if (AscCommonExcel.c_oAscScrollType.ScrollHorizontal & type) {
- this.controller.reinitScrollX(this.controller.hsbApi.settings, ws.getFirstVisibleCol(true), ws.getHorizontalScrollRange(), ws.getHorizontalScrollMax());
+ this.controller.reinitScrollX(this.controller.hsbApi.settings, this.getSmoothScrolling() ? ws.getFirstVisibleColSmoothScroll(true) : ws.getFirstVisibleCol(true), ws.getHorizontalScrollRange(), ws.getHorizontalScrollMax());
}
if (AscCommonExcel.c_oAscScrollType.ScrollVertical & type) {
- this.controller.reinitScrollY(this.controller.vsbApi.settings, ws.getFirstVisibleRow(true), ws.getVerticalScrollRange(), ws.getVerticalScrollMax());
+ this.controller.reinitScrollY(this.controller.vsbApi.settings, this.getSmoothScrolling() ? ws.getFirstVisibleRowSmoothScroll(true) : ws.getFirstVisibleRow(true), ws.getVerticalScrollRange(), ws.getVerticalScrollMax());
}
- if (this.Api.isMobileVersion) {
+ if (this.MobileTouchManager) {
this.MobileTouchManager.Resize();
}
};
@@ -1270,21 +1277,41 @@
}
};
- WorkbookView.prototype._onScrollY = function(pos, initRowsCount) {
- var ws = this.getWorksheet();
- var delta = asc_round(pos - ws.getFirstVisibleRow(true));
- if (delta !== 0) {
- ws.scrollVertical(delta, this.cellEditor, initRowsCount);
- }
- };
+ WorkbookView.prototype._onScrollY = function (pos, initRowsCount, bDefaultStep) {
+ let ws = this.getWorksheet();
+ let t = this;
+ let doScroll = function () {
+ var delta = !t.getSmoothScrolling() ? (asc_round(pos - ws.getFirstVisibleRow(true))) : (pos - ws.getFirstVisibleRowSmoothScroll(true));
+ if (delta !== 0) {
+ ws.scrollVertical(delta, t.cellEditor, initRowsCount);
+ }
+ }
+ if (bDefaultStep) {
+ ws.executeScrollDefaultStep(function () {
+ doScroll();
+ })
+ } else {
+ doScroll();
+ }
+ };
- WorkbookView.prototype._onScrollX = function(pos, initColsCount) {
- var ws = this.getWorksheet();
- var delta = asc_round(pos - ws.getFirstVisibleCol(true));
- if (delta !== 0) {
- ws.scrollHorizontal(delta, this.cellEditor, initColsCount);
- }
- };
+ WorkbookView.prototype._onScrollX = function (pos, initColsCount, bDefaultStep) {
+ let ws = this.getWorksheet();
+ let t = this;
+ let doScroll = function () {
+ var delta = !t.getSmoothScrolling() ? (asc_round(pos - ws.getFirstVisibleCol(true))) : (pos - ws.getFirstVisibleColSmoothScroll(true));
+ if (delta !== 0) {
+ ws.scrollHorizontal(delta, t.cellEditor, initColsCount);
+ }
+ }
+ if (bDefaultStep) {
+ ws.executeScrollDefaultStep(function () {
+ doScroll();
+ })
+ } else {
+ doScroll();
+ }
+ };
WorkbookView.prototype._onSetSelection = function(range) {
var ws = this.getWorksheet();
@@ -2055,6 +2082,8 @@
}
t.setCellEditMode(true);
t.hideSpecialPasteButton();
+ t.handlers.trigger("asc_onToggleAutoCorrectOptions");
+
ws.openCellEditor(t.cellEditor, enterOptions, selectionRange);
t.input.disabled = false;
@@ -2435,6 +2464,7 @@
});
}
+ this.checkScrollRtl(ws.getRightToLeft());
this._onScrollReinitialize(AscCommonExcel.c_oAscScrollType.ScrollVertical | AscCommonExcel.c_oAscScrollType.ScrollHorizontal);
// Zoom теперь на каждом листе одинаковый, не отправляем смену
@@ -2836,6 +2866,7 @@
} else if (defName.type === Asc.c_oAscDefNameType.table && 0 === fName.indexOf(defNameStr.toLowerCase())) {
if (-1 !== fName.indexOf("[")) {
var tableNameParse = fName.split("[");
+ // add only columns to the dropdown menu if @ the last element
if (tableNameParse[0] && 0 === defNameStr.toLowerCase().indexOf(tableNameParse[0])) {
//ищем совпадения по названию столбцов
var table = this.model.getTableByName(defNameStr);
@@ -2846,7 +2877,15 @@
for (let j = 0; j < table.TableColumns.length; j++) {
_str = table.TableColumns[j].Name;
_type = c_oAscPopUpSelectorType.TableColumnName;
- if (sTableInner === "" || 0 === _str.toLowerCase().indexOf(sTableInner)) {
+
+ let newStr;
+ if (sTableInner[0] === "@") {
+ newStr = sTableInner.slice(1);
+ if (newStr === "" || 0 === _str.toLowerCase().indexOf(newStr)) {
+ arrResult.push(getCompleteMenu(_str, _type));
+ }
+ }
+ else if (sTableInner === "" || 0 === _str.toLowerCase().indexOf(sTableInner)) {
arrResult.push(getCompleteMenu(_str, _type));
}
}
@@ -2877,6 +2916,10 @@
}
fPos += defNameStr.length + (fName.length - defNameStr.length - sTableInner.length);
_lastFNameLength = sTableInner.length;
+ // shift for fPos for correct work when we use result from dropdown menu
+ if (sTableInner[0] === "@") {
+ fPos++
+ }
}
}
}
@@ -2911,6 +2954,11 @@
}
tmp = this.cellEditor.skipTLUpdate;
this.cellEditor.skipTLUpdate = false;
+
+ if (type === c_oAscPopUpSelectorType.TableThisRow) {
+ this.skipHelpSelector = false;
+ }
+
this.cellEditor.replaceText(this.lastFPos, this.lastFNameLength, type === c_oAscPopUpSelectorType.TableThisRow ? "@" : name);
this.cellEditor.skipTLUpdate = tmp;
} else if (false === this.cellEditor.insertFormula(name, isNotFunction)) {
@@ -3028,7 +3076,7 @@
let funcCalc = ws.calculateWizardFormula(_name + '(' + sArguments + ')');
_res.functionResult = funcCalc.str;
if (funcCalc.obj && funcCalc.obj.type !== AscCommonExcel.cElementType.error) {
- _res.formulaResult = ws.calculateWizardFormula(t.cellEditor._formula).str;
+ _res.formulaResult = ws.calculateWizardFormula(t.cellEditor.getText().substring(1)).str;
}
}
@@ -3078,7 +3126,7 @@
let trueName = oFormulaList[name] && oFormulaList[name].prototype && oFormulaList[name].prototype.name;
if (allowCompleteFunctions[trueName]) {
- cellRange = wsView.autoCompleteFormula(trueName);
+ cellRange = wsView.autoCompleteFormula(trueName, t.isWizardMode);
}
t.cellEditor.insertFormula(name, null, cellRange && !cellRange.notEditCell && cellRange.text);
@@ -4418,16 +4466,19 @@
WorkbookView.prototype.IsSelectionUse = function () {
return !this.getWorksheet().getSelectionShape();
};
- WorkbookView.prototype.GetSelectionRectsBounds = function () {
+ WorkbookView.prototype.GetSelectionRectsBounds = function (checkVisibleRange) {
var ws = this.getWorksheet();
if (ws.getSelectionShape()) {
return null;
}
var range = ws.model.getSelection().getLast();
+ if (checkVisibleRange && !range.intersectionSimple(ws.visibleRange)) {
+ return null;
+ }
var type = range.getType();
- var l = ws.getCellLeft(range.c1, 3);
- var t = ws.getCellTop(range.r1, 3);
+ var l = ws.getCellLeft(range.c1, 3) - ws.getHorizontalScrollCorrect(3);
+ var t = ws.getCellTop(range.r1, 3) - ws.getScrollCorrect(3);
var offset = ws.getCellsOffset(3);
@@ -4435,9 +4486,9 @@
X: asc.c_oAscSelectionType.RangeRow === type ? -offset.left : l - offset.left,
Y: asc.c_oAscSelectionType.RangeCol === type ? -offset.top : t - offset.top,
W: asc.c_oAscSelectionType.RangeRow === type ? offset.left :
- ws.getCellLeft(range.c2, 3) - l + ws.getColumnWidth(range.c2, 3),
+ ws.getCellLeft(range.c2, 3) - l + ws.getColumnWidth(range.c2, 3) - ws.getHorizontalScrollCorrect(3),
H: asc.c_oAscSelectionType.RangeCol === type ? offset.top :
- ws.getCellTop(range.r2, 3) - t + ws.getRowHeight(range.r2, 3),
+ ws.getCellTop(range.r2, 3) - t + ws.getRowHeight(range.r2, 3) - ws.getScrollCorrect(3),
T: type
};
};
@@ -5327,9 +5378,60 @@
var updatedReferences = [];
for (var i = 0; i < _arrAfterPromise.length; i++) {
- let externalReferenceId = _arrAfterPromise[i].externalReferenceId;
+ // eR - current External Reference
+ let eRId = _arrAfterPromise[i].externalReferenceId;
let stream = _arrAfterPromise[i].stream;
- let eR = t.model.getExternalReferenceById(externalReferenceId);
+
+ let oPortalData = _arrAfterPromise[i].data;
+ let path = oPortalData && oPortalData["path"];
+ //if after update get short path, check on added such link
+ let eR = t.model.getExternalReferenceById(eRId);
+
+ let externalReferenceId = eRId;
+ if (path && externalReferenceId !== path) {
+ let isNotUpdate = (AscCommonExcel.importRangeLinksState && AscCommonExcel.importRangeLinksState.notUpdateIdMap && AscCommonExcel.importRangeLinksState.notUpdateIdMap[this.Id]) || this.notUpdateId;
+ if (!isNotUpdate) {
+ eR = t.model.getExternalReferenceById(path);
+ //need remove added new link with externalReferenceId id
+ if (eR) {
+ let eRAdded = t.model.getExternalReferenceById(externalReferenceId);
+ if (eRAdded) {
+ let indexFrom = t.model.getExternalReferenceById(externalReferenceId, true);
+ let indexTo = t.model.getExternalReferenceById(path, true);
+
+ for (let wsName in eRAdded.worksheets) {
+ let existedWs = eR.worksheets[wsName];
+ let prepared = t.model.dependencyFormulas.prepareChangeSheet(eRAdded.worksheets[wsName].getId(), {from: indexFrom + 1, to: indexTo + 1});
+
+ prepared.existedWs = existedWs;
+ t.model.dependencyFormulas.changeExternalLink(prepared);
+
+ //add to history after updated formula
+ for (let listenerId in prepared.listeners) {
+ let f = prepared.listeners[listenerId];
+ let parent = f.parent;
+ if (parent instanceof AscCommonExcel.CCellWithFormula) {
+ let cell = parent.ws && parent.ws.getCell3(parent.nRow, parent.nCol);
+ if (cell) {
+ let sF = prepared.listeners[listenerId].assemble();
+ if (sF) {
+ cell.setValue("=" + sF);
+ }
+ }
+ }
+ }
+ }
+ eR.addDataSetFrom(eRAdded);
+ t.model.removeExternalReferences([eRAdded.getAscLink()]);
+ }
+ }
+ }
+ }
+
+ if (!eR) {
+ eR = t.model.getExternalReferenceById(externalReferenceId);
+ }
+
if (stream && eR) {
updatedReferences.push(eR);
//TODO если внутри не zip, отправляем на конвертацию в xlsx, далее повторно обрабатываем - позже реализовать
@@ -5379,7 +5481,11 @@
oBinaryFileReader.Read(binaryData, wb);
});
});
-
+ //g_DefNameWorksheet use on parse def name ref. here need use external ws.
+ let RealDefNameWorksheet = AscCommonExcel.g_DefNameWorksheet;
+ AscCommonExcel.g_DefNameWorksheet = new AscCommonExcel.Worksheet(wb, -1);
+ wb.dependencyFormulas.initOpen();
+ AscCommonExcel.g_DefNameWorksheet = RealDefNameWorksheet;
if (wb.aWorksheets) {
eR && eR.updateData(wb.aWorksheets, _arrAfterPromise[i].data);
}
@@ -5395,10 +5501,22 @@
eR && eR.updateData(updatedData, _arrAfterPromise[i].data);
}
}
- } else {
- if (eR) {
- t.model.handlers.trigger("asc_onErrorUpdateExternalReference", eR.Id);
+ } else if (eR) {
+ /*
+ if we haven't received data from an external source
+ leave the link in the wb.externalReferernces array and assign the values as an error #REF
+ */
+
+ if (eR.worksheets) {
+ let arr = [];
+ for (let i in eR.worksheets) {
+ arr.push(eR.worksheets[i]);
+ }
+
+ eR.updateData(arr, _arrAfterPromise[i].data, /* noData */ true);
}
+
+ t.model.handlers.trigger("asc_onErrorUpdateExternalReference", eR.Id);
}
}
@@ -5647,6 +5765,7 @@
wsChangingCell = this.model.getWorksheetByName(sSheetName);
}
}
+ sExpectedValue = sExpectedValue.replace(/,/g, ".");
let t = this;
let callback = function (isSuccess) {
@@ -5760,6 +5879,36 @@
}
this.customFunctionEngine.add(func, options);
};
+ /**
+ * Updates calculating settings properties
+ * @memberof WorkbookView
+ * @param {asc_CCalcSettings} oCalcSettings
+ */
+ WorkbookView.prototype.updateCalcSettings = function (oCalcSettings) {
+ if (this.collaborativeEditing.getGlobalLock() || !window["Asc"]["editor"].canEdit()) {
+ return;
+ }
+ const oCalcPr = this.model.calcPr;
+ if (!oCalcSettings || oCalcSettings.asc_isEqual(oCalcPr)) {
+ return;
+ }
+
+ const ws = this.getWorksheet();
+ const oThis = this;
+ const callback = function (isSuccess) {
+ const g_cCalcRecursion = AscCommonExcel.g_cCalcRecursion;
+ History.Create_NewPoint();
+ History.StartTransaction();
+ oCalcPr.updateCalcProperties(oCalcSettings, oThis.model);
+ g_cCalcRecursion.initCalcProperties(oCalcPr);
+ History.EndTransaction();
+
+ ws._updateRange(new Asc.Range(0, 0, ws.model.getColsCount(), ws.model.getRowsCount()), true);
+ ws.draw();
+ };
+
+ callback();
+ };
WorkbookView.prototype.initCustomEngine = function() {
if (!this.customFunctionEngine) {
@@ -5767,7 +5916,38 @@
}
};
+ WorkbookView.prototype.setSmoothScrolling = function(val) {
+ if (this.smoothScroll !== val) {
+ this.smoothScroll = val;
+ for (var i in this.wsViews) {
+ var item = this.wsViews[i];
+ item.setScrollCorrect(null);
+ item.setHorizontalScrollCorrect(null);
+ item.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollVertical;
+ item.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollHorizontal;
+ item._reinitializeScroll();
+ }
+ var ws = this.getWorksheet();
+ ws.draw();
+ }
+ };
+ WorkbookView.prototype.getSmoothScrolling = function() {
+ return this.smoothScroll;
+ };
+
+ WorkbookView.prototype.checkScrollRtl = function(val) {
+ let controller = this.controller;
+ let hsbApi = controller && controller.hsbApi;
+ let ctx = hsbApi && hsbApi.context;
+ if (ctx) {
+ if (val) {
+ ctx.setTransform(-1,0,0,1,hsbApi.canvasW,0);
+ } else {
+ ctx.setTransform(1,0,0,1,0,0);
+ }
+ }
+ };
//временно добавляю сюда. в идеале - использовать общий класс из документов(или сделать базовый, от него наследоваться) - CDocumentSearch
function CDocumentSearchExcel(wb) {
@@ -6028,8 +6208,12 @@
if (-1 !== this.CurId) {
return this.Direction ? this.CurId + 1 : this.CurId - 1;
} else {
- let ws = this.wb.getActiveWS();
- let selectionRange = (this.props && this.props.selectionRange) || ws.selectionRange || ws.copySelection;
+ // it's necessary because into the docbuilder "this.wb.wsActive" is "-1" and search doesn't work
+ let ws = this.wb.model.getActiveWs();
+ if (!ws) {
+ ws = this.wb && this.wb.model && this.wb.model.getActiveWs && this.wb.model.getActiveWs();
+ }
+ let selectionRange = (this.props && this.props.selectionRange) || (ws && ws.selectionRange) || (ws && ws.copySelection);
let activeCell = this.props.activeCell ? this.props.activeCell : selectionRange.activeCell;
if (this.props && this.props.lastSearchElem) {
@@ -6066,7 +6250,7 @@
let sheetArr = [];
let checkElem = function (indexElem, index) {
//нужный нам лист
- if (ws.sName === t.Elements[indexElem].sheet) {
+ if (ws && ws.sName === t.Elements[indexElem].sheet) {
let prevNextI = bReverse ? indexArr[index - 1] : indexArr[index + 1];
let prevNextElemRowCol = getRowCol(t.Elements[prevNextI]);
@@ -6137,6 +6321,9 @@
case AscCommonExcel.docChangedType.rangeValues:
this.changeRangeValue(arg1, arg2);
break;
+ case AscCommonExcel.docChangedType.removeRows:
+ this.changeRemoveRows(arg1, arg2);
+ break;
case AscCommonExcel.docChangedType.sheetContent:
this.changeSheetContent(arg1, arg2);
break;
@@ -6172,6 +6359,22 @@
}
}
};
+ CDocumentSearchExcel.prototype.changeRemoveRows = function (ws, range) {
+ if (this.isNotEmpty()) {
+ for (let i in this.Elements) {
+ if (this.Elements[i].index === ws.index && this.Elements[i].row > range.r2) {
+ let keyOld = this.Elements[i].index + "-" + this.Elements[i].col + "-" + this.Elements[i].row;
+
+ this.Elements[i].row = this.Elements[i].row - (range.r2 - range.r1 + 1);
+
+ let keyNew = this.Elements[i].index + "-" + this.Elements[i].col + "-" + this.Elements[i].row;
+ let oldId = this.mapFindCells[keyOld];
+ delete this.mapFindCells[keyOld];
+ this.mapFindCells[keyNew] = oldId;
+ }
+ }
+ }
+ };
CDocumentSearchExcel.prototype.changeRangeValue = function (bbox, ws) {
if (this.wb.Api.selectSearchingResults && bbox && this.props) {
let t = this;
diff --git a/cell/view/WorksheetView.js b/cell/view/WorksheetView.js
index 4b7d332699..2faf1046c6 100644
--- a/cell/view/WorksheetView.js
+++ b/cell/view/WorksheetView.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -123,7 +123,7 @@
var kCurHyperlink = "pointer";
// Курсор для перемещения области выделения
var kCurMove = "move";
- var kCurSEResize = "se-resize";
+ var kCurSEResize = /*window.rightToleft ? "sw-resize" :*/ "se-resize";
var kCurNEResize = "ne-resize";
var kCurAutoFilter = "pointer";
var kCurEWResize = "ew-resize";
@@ -147,6 +147,8 @@
//limit rows for prepare metrics. if more then limit -> metrics will prepare dynamic
var nMaxPrintRows = 150000;
+
+
function getMergeType(merged) {
var res = c_oAscMergeType.none;
if (null !== merged) {
@@ -517,6 +519,9 @@
this.cellPasteHelper = new CCellPasteHelper(this);
+ this.vScrollPxStep = null;
+ this.hScrollPxStep = null;
+
this._init();
return this;
@@ -535,6 +540,7 @@
this.model.updatePivotTablesStyle(null);
this._cleanCellsTextMetricsCache();
this._prepareCellTextMetricsCache();
+
// initializing is completed
this.handlers.trigger("initialized");
};
@@ -585,6 +591,8 @@
this._initColsCount();
this.model.initColumns();
+
+ this._initScrollStep();
};
WorksheetView.prototype.createImageFromMaxRange = function () {
@@ -1035,6 +1043,19 @@
return old !== this.nColsCount;
};
+ WorksheetView.prototype._initScrollStep = function () {
+ let isMobileVersion = this.workbook && this.workbook.Api && this.workbook.Api.isMobileVersion;
+ if (isMobileVersion) {
+ let oView = this.workbook && this.workbook.controller && this.workbook.controller.settings;
+ let defaultStep = 10;
+ this.vScrollPxStep = oView ? oView.vscrollStep : defaultStep;
+ this.hScrollPxStep = oView ? oView.hscrollStep : defaultStep;
+ } else {
+ this.vScrollPxStep = this.defaultRowHeightPx;
+ this.hScrollPxStep = this.defaultColWidthPx;
+ }
+ };
+
WorksheetView.prototype.getCellEditMode = function () {
return this.workbook.isCellEditMode;
};
@@ -1073,8 +1094,8 @@
vr = this.visibleRange;
}
- offsetX += this._getColLeft(vr.c1) - this.cellsLeft;
- offsetY += this._getRowTop(vr.r1) - this.cellsTop;
+ offsetX += this._getOffsetX(vr.c1, true);
+ offsetY += this._getOffsetY(vr.r1, true);
return vr.contains(col, row) ? new asc_VR(vr, offsetX, offsetY) : null;
};
@@ -1086,8 +1107,8 @@
if (opt_check_merge && (mc = this.model.getMergedByCell(row, col))) {
col = mc.c1;
row = mc.r1;
- _width = (this._getColLeft(mc.c2 + 1) - this._getColLeft(mc.c1)) - vr.offsetX;
- _height = (this._getRowTop(mc.r2 + 1) - this._getRowTop(mc.r1)) - vr.offsetY;
+ _width = (this._getColLeft(mc.c2 + 1) - this._getColLeft(mc.c1));
+ _height = (this._getRowTop(mc.r2 + 1) - this._getRowTop(mc.r1));
} else {
_width = this._getColumnWidth(col);
_height = this._getRowHeight(row);
@@ -1130,11 +1151,111 @@
return this.visibleRange.r1 - tmp;
};
+ WorksheetView.prototype.getFirstVisibleRowSmoothScroll = function (allowPane) {
+ var frozenVisibleRangeHeight = 0;
+ if (allowPane && this.topLeftFrozenCell) {
+ let tmp = this.topLeftFrozenCell.getRow0();
+ frozenVisibleRangeHeight = this._getRowTop(tmp) - this.cellsTop;
+ }
+
+ //new scroll - calculate height before vr
+ let beforeVisibleRangeHeight = this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+
+
+ beforeVisibleRangeHeight += this.getScrollCorrect();
+ let defaultScrollPxStep = Asc.round(this.getVScrollStep());
+ return defaultScrollPxStep === 0 ? 0 : ((beforeVisibleRangeHeight - frozenVisibleRangeHeight)/defaultScrollPxStep);
+ };
+
+ WorksheetView.prototype.getVerticalSmoothScrollRange = function (bCheckEqual) {
+ var offsetFrozen = this.getFrozenPaneOffset(true, false);
+ var ctxH = this.drawingCtx.getHeight() - offsetFrozen.offsetY - this.cellsTop;
+ for (var h = 0, i = this.nRowsCount - 1; i >= 0; --i) {
+ h += this._getRowHeight(i);
+ if (h >= ctxH) {
+ if (bCheckEqual && h > ctxH) {
+ i++;
+ }
+ break;
+ }
+ }
+
+ var frozenVisibleRangeHeight = 0;
+ if (this.topLeftFrozenCell) {
+ let tmp = this.topLeftFrozenCell.getRow0();
+ frozenVisibleRangeHeight = this._getRowTop(tmp) - this.cellsTop;
+ }
+ //TODO
+ /*if (gc_nMaxRow === this.nRowsCount || this.model.isDefaultHeightHidden()) {
+ tmp -= 1;
+ }*/
+ let isMobileVersion = this.workbook && this.workbook.Api && this.workbook.Api.isMobileVersion;
+ let row = Math.max(0, i); // Диапазон скрола должен быть меньше количества строк, чтобы не было прибавления строк при перетаскивании бегунка
+ let defaultScrollPxStep = Asc.round(this.getVScrollStep());
+ let beforeVisibleRangeHeight = this._getRowTop(row) - this.cellsTop;
+ if (isMobileVersion || AscCommonExcel.c_oAscScrollType.ScrollInitRowsColsCount & this.scrollType) {
+ beforeVisibleRangeHeight += this.getScrollCorrect();
+ }
+ return defaultScrollPxStep === 0 ? 0 : ((beforeVisibleRangeHeight - frozenVisibleRangeHeight)/defaultScrollPxStep);
+ };
+
+ WorksheetView.prototype.getFirstVisibleColSmoothScroll = function (allowPane) {
+ var frozenVisibleRangeWidth = 0;
+ if (allowPane && this.topLeftFrozenCell) {
+ let tmp = this.topLeftFrozenCell.getCol0();
+ frozenVisibleRangeWidth = this._getColLeft(tmp) - this.cellsLeft;
+ }
+
+ //new scroll - calculate height before vr
+ let beforeVisibleRangeWidth = this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+
+
+ beforeVisibleRangeWidth += this.getHorizontalScrollCorrect();
+ let defaultScrollPxStep = Asc.round(this.getHScrollStep());
+ return defaultScrollPxStep === 0 ? 0 : ((beforeVisibleRangeWidth - frozenVisibleRangeWidth)/defaultScrollPxStep);
+ };
+
+ WorksheetView.prototype.getHorizontalSmoothScrollRange = function (/*bCheckEqual*/) {
+ var offsetFrozen = this.getFrozenPaneOffset(false, true);
+ var ctxW = this.drawingCtx.getWidth() - offsetFrozen.offsetX - this.cellsLeft;
+ for (var h = 0, i = this.nColsCount - 1; i >= 0; --i) {
+ h += this._getColumnWidth(i);
+ if (h >= ctxW) {
+ /*if (bCheckEqual && h > ctxH) {
+ i++;
+ }*/
+ break;
+ }
+ }
+
+ var frozenVisibleRangeWidth = 0;
+ if (this.topLeftFrozenCell) {
+ let tmp = this.topLeftFrozenCell.getCol0();
+ frozenVisibleRangeWidth = this._getColLeft(tmp) - this.cellsLeft;
+ }
+ //TODO
+ /*if (gc_nMaxRow === this.nRowsCount || this.model.isDefaultHeightHidden()) {
+ tmp -= 1;
+ }*/
+ let isMobileVersion = this.workbook && this.workbook.Api && this.workbook.Api.isMobileVersion;
+ let col = Math.max(0, i); // Диапазон скрола должен быть меньше количества строк, чтобы не было прибавления строк при перетаскивании бегунка
+ let defaultScrollPxStep = Asc.round(this.getHScrollStep());
+ let beforeVisibleRangeWidth = this._getColLeft(col) - this.cellsLeft;
+ if (isMobileVersion || AscCommonExcel.c_oAscScrollType.ScrollInitRowsColsCount & this.scrollType) {
+ beforeVisibleRangeWidth += this.getHorizontalScrollCorrect();
+ }
+
+ return defaultScrollPxStep === 0 ? 0 : ((beforeVisibleRangeWidth - frozenVisibleRangeWidth)/defaultScrollPxStep);
+ };
+
WorksheetView.prototype.getLastVisibleRow = function () {
return this.visibleRange.r2;
};
WorksheetView.prototype.getHorizontalScrollRange = function () {
+ if (this.workbook.getSmoothScrolling()) {
+ return this.getHorizontalSmoothScrollRange();
+ }
var offsetFrozen = this.getFrozenPaneOffset(false, true);
var ctxW = this.drawingCtx.getWidth() - offsetFrozen.offsetX - this.cellsLeft;
for (var w = 0, i = this.nColsCount - 1; i >= 0; --i) {
@@ -1154,6 +1275,9 @@
};
WorksheetView.prototype.getVerticalScrollRange = function (bCheckEqual) {
+ if (this.workbook.getSmoothScrolling()) {
+ return this.getVerticalSmoothScrollRange(bCheckEqual);
+ }
var offsetFrozen = this.getFrozenPaneOffset(true, false);
var ctxH = this.drawingCtx.getHeight() - offsetFrozen.offsetY - this.cellsTop;
for (var h = 0, i = this.nRowsCount - 1; i >= 0; --i) {
@@ -1199,17 +1323,31 @@
};
};
- WorksheetView.prototype._getColLeft = function (i) {
+ WorksheetView.prototype._getColLeft = function (i, saveRealRightToLeft, ctx) {
+ ctx = ctx || this.drawingCtx;
this._updateColumnPositions();
+ let realRightToleft = this.getRightToLeft();
+ if (!saveRealRightToLeft) {
+ this.setRightToLeft(false);
+ }
+
var l = this.cols.length;
- return this.cellsLeft + ((i < l) ? this.cols[i].left : (((0 === l) ? 0 :
- this.cols[l - 1].left + this.cols[l - 1].width) + (!this.model.isDefaultWidthHidden()) *
- Asc.round(this.defaultColWidthPx * this.getZoom(true) * this.getRetinaPixelRatio()) * (i - l)));
+ let defaultWidth = Asc.round(this.defaultColWidthPx * this.getZoom(true) * this.getRetinaPixelRatio());
+ let posReal = this.cellsLeft + ((i < l) ? this.cols[i].left : (((0 === l) ? 0 :
+ this.cols[l - 1].left + this.cols[l - 1].width) + (!this.model.isDefaultWidthHidden()) * defaultWidth * (i - l)));
+
+ if (this.getRightToLeft()) {
+ posReal = (this.getCtxWidth(ctx)) - posReal - (i < l ? this.cols[i].width : defaultWidth);
+ }
+
+ this.setRightToLeft(realRightToleft);
+
+ return posReal;
};
- WorksheetView.prototype.getCellLeft = function (column, units) {
+ WorksheetView.prototype.getCellLeft = function (column, units, saveRealRtl) {
var u = units >= 0 && units <= 3 ? units : 0;
- return this._getColLeft(column) * asc_getcvt(0/*px*/, u, this._getPPIX());
+ return this._getColLeft(column, saveRealRtl) * asc_getcvt(0/*px*/, u, this._getPPIX());
};
WorksheetView.prototype._getRowHeightReal = function (i) {
@@ -1241,38 +1379,64 @@
return this._getRowTop(row) * asc_getcvt(0/*px*/, u, this._getPPIY());
};
- WorksheetView.prototype.getCellLeftRelative = function (col, units) {
+ WorksheetView.prototype.getCellLeftRelative = function (col, units, checkFrozenOffset) {
if (col < 0 || col >= this.nColsCount) {
return null;
}
// С учетом видимой области
var offsetX = 0;
+ let frozenOffset = null;
if (this.topLeftFrozenCell) {
var cFrozen = this.topLeftFrozenCell.getCol0();
- offsetX = (col < cFrozen) ? 0 : this._getColLeft(this.visibleRange.c1) - this._getColLeft(cFrozen);
+ if (col < cFrozen) {
+ offsetX = 0;
+ } else {
+ frozenOffset = this._getColLeft(cFrozen);
+ offsetX = this._getColLeft(this.visibleRange.c1) - frozenOffset + this.getHorizontalScrollCorrect();
+ }
} else {
- offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+ offsetX = this._getOffsetX();
}
var u = units >= 0 && units <= 3 ? units : 0;
- return (this._getColLeft(col) - offsetX) * asc_getcvt(0/*px*/, u, this._getPPIX());
+ let _left = this._getColLeft(col) - offsetX;
+ if (_left < this.cellsLeft) {
+ _left = this.cellsLeft;
+ }
+ if (checkFrozenOffset && frozenOffset && _left < frozenOffset) {
+ _left = frozenOffset;
+ }
+ return _left * asc_getcvt(0/*px*/, u, this._getPPIX());
};
- WorksheetView.prototype.getCellTopRelative = function (row, units) {
+ WorksheetView.prototype.getCellTopRelative = function (row, units, checkFrozenOffset) {
if (row < 0 || row >= this.nRowsCount) {
return null;
}
// С учетом видимой области
var offsetY = 0;
+ let frozenOffset = null;
if (this.topLeftFrozenCell) {
var rFrozen = this.topLeftFrozenCell.getRow0();
- offsetY = (row < rFrozen) ? 0 : this._getRowTop(this.visibleRange.r1) - this._getRowTop(rFrozen);
+ if (row < rFrozen) {
+ offsetY = 0;
+ } else {
+ frozenOffset = this._getRowTop(rFrozen);
+ offsetY = this._getRowTop(this.visibleRange.r1) - frozenOffset + this.getScrollCorrect();
+ }
} else {
- offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ offsetY = this._getOffsetY();
}
var u = units >= 0 && units <= 3 ? units : 0;
- return (this._getRowTop(row) - offsetY) * asc_getcvt(0/*px*/, u, this._getPPIY());
+ let _top = this._getRowTop(row) - offsetY;
+ if (_top < this.cellsTop) {
+ _top = this.cellsTop;
+ }
+ if (checkFrozenOffset && frozenOffset && _top < frozenOffset) {
+ _top = frozenOffset;
+ }
+ return _top * asc_getcvt(0/*px*/, u, this._getPPIY());
};
WorksheetView.prototype._getColumnWidthInner = function (i) {
@@ -1392,6 +1556,20 @@
this.updateResize = false;
this.objectRender.resizeCanvas();
+ if (this.getRightToLeft()) {
+ AscFormat.ExecuteNoHistory(function () {
+ let drawings = this.objectRender.controller.getDrawingObjects();
+ for (var i = 0; i < drawings.length; ++i) {
+ if (!drawings[i].group) {
+ AscFormat.CheckSpPrXfrm3(drawings[i], true);
+ } else {
+ AscFormat.CheckSpPrXfrm(drawings[i], true);
+ }
+ }
+ this.objectRender.controller.recalculate(true);
+ }, this, []);
+ }
+
if (editor) {
editor.move();
}
@@ -1423,6 +1601,8 @@
};
WorksheetView.prototype.changeZoom = function (isUpdate, changeZoomOnPrint) {
+ this.setScrollCorrect(0);
+ this.setHorizontalScrollCorrect(0);
if (isUpdate || changeZoomOnPrint) {
this.isZooming = true;
this.notUpdateRowHeight = true;
@@ -1470,8 +1650,8 @@
this.updateZoom = false;
};
- WorksheetView.prototype.getSheetViewSettings = function () {
- return this.model.getSheetViewSettings();
+ WorksheetView.prototype.getSheetViewSettings = function (bNotClone) {
+ return this.model.getSheetViewSettings(bNotClone);
};
WorksheetView.prototype.getFrozenPaneOffset = function (noX, noY) {
@@ -1499,6 +1679,9 @@
if (this.model.getSheetProtection(Asc.c_oAscSheetProtectType.formatColumns)) {
return;
}
+ if (this.getRightToLeft()) {
+ x2 = this.getCtxWidth() - x2;
+ }
var viewMode = this.handlers.trigger('getViewMode');
var t = this;
// Учитываем координаты точки, где мы начали изменение размера
@@ -1516,7 +1699,7 @@
}
}
}
- var offsetX = t._getColLeft(c1) - t.cellsLeft;
+ var offsetX = t._getOffsetX(c1);
offsetX -= offsetFrozenX;
var x1 = t._getColLeft(col) - offsetX - gridlineSize;
@@ -1657,7 +1840,7 @@
}
}
}
- var offsetY = this._getRowTop(r1) - t.cellsTop;
+ var offsetY = this._getOffsetY(r1);
offsetY -= offsetFrozenY;
var y1 = this._getRowTop(row) - offsetY - gridlineSize;
@@ -1828,8 +2011,82 @@
}
};
+ WorksheetView.prototype._getAutocompleteValues = function () {
+ const t = this;
+ let canExecuteFormula;
+ /* setRows|setCols - arrays with positions of all real elements */
+ /* setNumberRows|setNumberCols - arrays with positions of all "numeric" elements */
+ let setCols = [], setRows = [], setNumberCols = [], setNumberRows = [];
+ let selection = this.model.getSelection();
+ let selectionRange = selection.getLast();
+ let mergedRange = this.model.getMergedByCell(selectionRange.r1, selectionRange.c1);
+ if (mergedRange && mergedRange.isEqual(selectionRange)) {
+ // There is no need to do anything for one cell
+ return null;
+ }
+
+ if (c_oAscSelectionType.RangeMax === selectionRange.getType()) {
+ return null;
+ }
+
+ let c2 = Math.min(selectionRange.c2, this.nColsCount - 1);
+ let r2 = Math.min(selectionRange.r2, this.nRowsCount - 1);
+ for (let c = selectionRange.c1; c <= c2; ++c) {
+ for (let r = selectionRange.r1; r <= r2; ++r) {
+ let cellCache = this._getCellTextCache(c, r, true);
+ if (cellCache) {
+ if (!canExecuteFormula) {
+ this.model._getCellNoEmpty(r, c, function (cell) {
+ if (cell && !cell.isNullText() && cell.type !== CellValueType.String) {
+ let xfs = cell.getCompiledStyle();
+ let numFormatStr, info;
+ if (xfs && xfs.num) {
+ // numFormatStr = xfs.num.getNumFormat();
+ info = xfs.asc_getNumFormatInfo();
+ }
+
+ if (!info) {
+ canExecuteFormula = true
+ } else if (info && info.type !== Asc.c_oAscNumFormatType.Date && info.type !== Asc.c_oAscNumFormatType.LongDate
+ && info.type !== Asc.c_oAscNumFormatType.None && info.type !== Asc.c_oAscNumFormatType.Text) {
+ canExecuteFormula = true
+ }
+
+ }
+ });
+ }
+
+ if (cellCache.cellType !== CellValueType.String) {
+ if (setNumberRows.indexOf(r) === -1) {
+ setNumberRows.push(r);
+ }
+ if (setNumberCols.indexOf(c) === -1) {
+ setNumberCols.push(c);
+ }
+ }
+
+ if (setRows.indexOf(r) === -1) {
+ setRows.push(r);
+ }
+ if (setCols.indexOf(c) === -1) {
+ setCols.push(c);
+ }
+ }
+ }
+ }
+
+ if (canExecuteFormula && (setRows.length > 0 || setCols.length > 0) && (setNumberRows.length > 0 || setNumberCols.length > 0)) {
+ // return an object with information about the positions of real and only numeric values
+ return {
+ allExistedValPos: {arrCols: setCols.sort(fSortAscending), arrRows: setRows.sort(fSortAscending)},
+ allNumberPos: {arrCols: setNumberCols.sort(fSortAscending), arrRows: setNumberRows.sort(fSortAscending)}
+ };
+ } else {
+ return null;
+ }
+ };
// Autocomplete formula with range if possible
- WorksheetView.prototype.autoCompleteFormula = function (functionName) {
+ WorksheetView.prototype.autoCompleteFormula = function (functionName, callFromWizard) {
const t = this;
// ToDo autoComplete with multiselect
let selection = this.model.getSelection();
@@ -1847,10 +2104,11 @@
let c = activeCell.col - 1;
let cell, cellType, isNumberFormat;
let result = {};
- // Get all numeric values in the range
- let hasNumber = this._getValuesPositionsInRange(true);
+ // let hasNumber = this._getValuesPositionsInRange(true);
+ let hasNumber = !callFromWizard && this._getAutocompleteValues(); // Get all valid values for autocomplete according to the cell format and type
+
// Get all non-empty values in the range
- let realValues = this._getValuesPositionsInRange();
+ // let realValues = this._getValuesPositionsInRange();
let val, text;
/*
@@ -1871,6 +2129,9 @@
if (hasNumber) {
let i;
+ let realValues = hasNumber.allExistedValPos;
+ hasNumber = hasNumber.allNumberPos;
+
// Are there numeric values in the last row and column
let hasNumberInLastColumn = (ar.c2 === hasNumber.arrCols[hasNumber.arrCols.length - 1]);
let hasNumberInLastRow = (ar.r2 === hasNumber.arrRows[hasNumber.arrRows.length - 1]);
@@ -2094,7 +2355,12 @@
result.notEditCell = true;
return result;
}
- }
+ } else {
+ // change selection to the last cell if the values in the range are not valid in the autocomplete formula
+ if (!result.text && !result.notEditCell) {
+ selection.setActiveCell(ar.r2, ar.c2);
+ }
+ }
// Ищем первую ячейку с числом
for (; r >= vr.r1; --r) {
@@ -2635,6 +2901,7 @@
WorksheetView.prototype._calcVisibleColumns = function () {
var w = this.drawingCtx.getWidth();
var sumW = this.topLeftFrozenCell ? this._getColLeft(this.topLeftFrozenCell.getCol0()) : this.cellsLeft;
+ sumW -= this.getHorizontalScrollCorrect();
for (var i = this.visibleRange.c1, f = false; i < this.nColsCount && sumW < w; ++i) {
sumW += this._getColumnWidth(i);
f = true;
@@ -2646,6 +2913,7 @@
WorksheetView.prototype._calcVisibleRows = function () {
var h = this.drawingCtx.getHeight();
var sumH = this.topLeftFrozenCell ? this._getRowTop(this.topLeftFrozenCell.getRow0()) : this.cellsTop;
+ sumH -= this.getScrollCorrect();
for (var i = this.visibleRange.r1, f = false; i < this.nRowsCount && sumH < h; ++i) {
sumH += this._getRowHeight(i);
f = true;
@@ -2761,6 +3029,16 @@
}
let isOnlyFirstPage = adjustPrint && adjustPrint.isOnlyFirstPage;
+
+ if (!isOnlyFirstPage) {
+ let printOptionsJson = this.workbook && this.workbook.getPrintOptionsJson();
+ let curPrintOptionsJson = (printOptionsJson && printOptionsJson["spreadsheetLayout"]) ? printOptionsJson["spreadsheetLayout"] : printOptionsJson;
+ let thumbnailFirst = curPrintOptionsJson && curPrintOptionsJson["thumbnail"] && curPrintOptionsJson["thumbnail"]["first"];
+ if (thumbnailFirst === true || (typeof thumbnailFirst === "string" && thumbnailFirst.toLowerCase() === "true")) {
+ isOnlyFirstPage = true;
+ }
+ }
+
let pageMargins, pageSetup, pageGridLines, pageHeadings;
if (pageOptions) {
pageMargins = pageOptions.asc_getPageMargins();
@@ -3451,6 +3729,12 @@
indexPrintPage = recalcIndexPrintPage(indexPrintPage);
+ let vector_koef = AscCommonExcel.vector_koef / t.getZoom();
+ if (AscCommon.AscBrowser.isCustomScaling()) {
+ vector_koef /= t.getRetinaPixelRatio();
+ }
+
+
this.stringRender.fontNeedUpdate = true;
if (null === printPagesData) {
// Напечатаем пустую страницу
@@ -3469,16 +3753,32 @@
}
drawingCtx.EndPage && drawingCtx.EndPage();
} else {
+ if (this.getRightToLeft()) {
+ let renderingSettings = this.getRenderingSettings();
+ if (!renderingSettings) {
+ renderingSettings = this.initRenderingSettings();
+ }
+ renderingSettings && renderingSettings.setCtxWidth(printPagesData.pageWidth / vector_koef);
+ renderingSettings && renderingSettings.setPageLeftOffset(printPagesData.leftFieldInPx);
+ let pageRightField = c_oAscPrintDefaultSettings.PageRightField;
+ renderingSettings && renderingSettings.setPageRightOffset(pageRightField / vector_koef);
+ this.objectRender.updateDrawingsTransform({target: c_oTargetType.ColumnResize, col: 0});
+ }
+
drawingCtx.BeginPage && drawingCtx.BeginPage(printPagesData.pageWidth, printPagesData.pageHeight);
//special thumbnail split
let printOptionsJson = this.workbook && this.workbook.getPrintOptionsJson();
- if (printOptionsJson && printOptionsJson["thumbnail"] && printOptionsJson["thumbnail"]["first"] === true) {
+ let curPrintOptionsJson = (printOptionsJson && printOptionsJson["spreadsheetLayout"]) ? printOptionsJson["spreadsheetLayout"] : printOptionsJson;
+ let thumbnailFirst = curPrintOptionsJson && curPrintOptionsJson["thumbnail"] && curPrintOptionsJson["thumbnail"]["first"];
+ if (thumbnailFirst === true || (typeof thumbnailFirst === "string" && thumbnailFirst.toLowerCase() === "true")) {
let thumbnailMaxRowCount = 100;
let currentRowCount = (printPagesData.pageRange.r2 - printPagesData.pageRange.r1) + (printPagesData.titleRowRange ? (printPagesData.titleRowRange.r2 - printPagesData.titleRowRange.r1) : 0);
if (currentRowCount > thumbnailMaxRowCount) {
- this.initRenderingSettings();
let renderingSettings = this.getRenderingSettings();
+ if (!renderingSettings) {
+ renderingSettings = this.initRenderingSettings();
+ }
let splitNumber = 2;
renderingSettings && renderingSettings.setSplitRowBG(splitNumber);
}
@@ -3518,6 +3818,19 @@
leftDiff / mmToPx, topDiff / mmToPx);
}
+ if (t.getRightToLeft()) {
+ if (!_transform) {
+ _transform = new AscCommon.CMatrix();
+ }
+ transformMatrix = new AscCommon.CMatrix();
+ transformMatrix.sx = -1;
+ transformMatrix.tx = t.getCtxWidth() * (drawingCtx instanceof AscCommonExcel.CPdfPrinter ? vector_koef : 1);
+ let newTransformMatrix = _transform.Multiply(transformMatrix);
+ drawingCtx.setTransform(newTransformMatrix.sx, newTransformMatrix.shy, newTransformMatrix.shx, newTransformMatrix.sy, newTransformMatrix.tx, newTransformMatrix.ty);
+ drawingCtx.updateTransforms && drawingCtx.updateTransforms();
+ }
+
+
let offsetCols = printPagesData.startOffsetPx;
//range = printPagesData.pageRange;
let offsetX = t._getColLeft(range.c1) - printPagesData.leftFieldInPx + offsetCols - titleWidth;
@@ -3755,7 +4068,10 @@
}
this.stringRender.resetTransform(drawingCtx);
this.setRenderingSettings(null);
+ this.pageWidth = null;
drawingCtx.EndPage && drawingCtx.EndPage();
+
+ this.getRightToLeft() && this.objectRender.updateDrawingsTransform({target: c_oTargetType.ColumnResize, col: 0});
}
};
@@ -3803,7 +4119,11 @@
var calcScale = this.calcPrintScale(width, height);
if(!isNaN(calcScale)) {
+ let realLockDraw = this.lockDraw;
+ //TODO add lock draw here. need review all draw calls(try to replace on recalculate)
+ this.lockDraw = true;
this._setPrintScale(calcScale);
+ this.lockDraw = realLockDraw;
}
//TODO нужно ли в данном случае лочить?
@@ -4195,6 +4515,7 @@
this._recalculate();
this.handlers.trigger("checkLastWork");
this._clean();
+ this._startRtlRendering();
this._drawCorner();
this._drawColumnHeaders(null);
this._drawRowHeaders(null);
@@ -4206,6 +4527,7 @@
this._drawFrozenPaneLines();
this._fixSelectionOfMergedCells();
this._drawElements(this.af_drawButtons);
+ this._endRtlRendering();
this.cellCommentator.drawCommentCells();
this.objectRender.showDrawingObjects();
if (this.overlayCtx) {
@@ -4249,10 +4571,12 @@
WorksheetView.prototype._activateOverlayCtx = function () {
this.drawingCtx = this.buffers.overlay;
+ this._startRtlRendering();
};
WorksheetView.prototype._deactivateOverlayCtx = function () {
- this.drawingCtx = this.buffers.main;
+ this._endRtlRendering();
+ this.drawingCtx = this.buffers.main;
};
WorksheetView.prototype._doCleanHighlightedHeaders = function () {
@@ -4350,6 +4674,15 @@
.setFillStyle(activeNamedSheetView ? this.settings.header.cornerColorSheetView : this.settings.header.cornerColor)
.fill();
};
+ WorksheetView.prototype._drawText = function (stringRender, ctx, textX, textY, textW, color) {
+ stringRender.render(ctx, /*window.rightToleft ? (ctx.getWidth() - textX - textW) : */textX, textY, textW, color);
+ return stringRender;
+ };
+ WorksheetView.prototype._fillText = function (ctx, text, x, y, maxWidth, charWidths, angle) {
+ ctx.fillText(text, x, y, maxWidth, charWidths, angle);
+ return ctx;
+
+ };
/** Рисует заголовки видимых колонок */
WorksheetView.prototype._drawColumnHeaders = function (drawingCtx, start, end, style, offsetXForDraw, offsetYForDraw) {
@@ -4363,14 +4696,16 @@
}
var vr = this.visibleRange;
- var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : this._getColLeft(vr.c1) - this.cellsLeft;
+ var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : this._getOffsetX();
var offsetY = (undefined !== offsetYForDraw) ? offsetYForDraw : this.headersTop;
+ let clipRectX = this.cellsLeft;
if (!drawingCtx && this.topLeftFrozenCell && undefined === offsetXForDraw) {
var cFrozen = this.topLeftFrozenCell.getCol0();
if (start < vr.c1) {
- offsetX = this._getColLeft(0) - this.cellsLeft;
+ offsetX = this._getOffsetY(0, true);
} else {
offsetX -= this._getColLeft(cFrozen) - this._getColLeft(0);
+ clipRectX = this._getColLeft(cFrozen);
}
}
@@ -4386,6 +4721,15 @@
this._setDefaultFont(drawingCtx);
+ var ctx = this.drawingCtx;
+ var ctxW = ctx.getWidth();
+ var ctxH = ctx.getHeight();
+
+ let isUseMainClip = (window["IS_NATIVE_EDITOR"] !== true);
+
+ if (isUseMainClip)
+ ctx.AddClipRect(clipRectX, this.headersTop - this.groupHeight, ctxW, ctxH);
+
// draw column headers
var l = this._getColLeft(start) - offsetX, w;
for (var i = start; i <= end; ++i) {
@@ -4393,6 +4737,9 @@
this._drawHeader(drawingCtx, l, offsetY, w, this.headersHeight, style, true, i);
l += w;
}
+
+ if (isUseMainClip)
+ ctx.RemoveClipRect();
};
/** Рисует заголовки видимых строк */
@@ -4402,13 +4749,15 @@
}
var vr = this.visibleRange;
var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : this.headersLeft;
- var offsetY = (undefined !== offsetYForDraw) ? offsetYForDraw : this._getRowTop(vr.r1) - this.cellsTop;
+ var offsetY = (undefined !== offsetYForDraw) ? offsetYForDraw : this._getOffsetY();
+ let clipRectY = this.cellsTop;
if (!drawingCtx && this.topLeftFrozenCell && undefined === offsetYForDraw) {
var rFrozen = this.topLeftFrozenCell.getRow0();
if (start < vr.r1) {
- offsetY = this._getRowTop(0) - this.cellsTop;
+ offsetY = this._getOffsetY(0, true);
} else {
offsetY -= this._getRowTop(rFrozen) - this._getRowTop(0);
+ clipRectY = this._getRowTop(rFrozen);
}
}
@@ -4424,6 +4773,14 @@
this._setDefaultFont(drawingCtx);
+ var ctx = this.drawingCtx;
+ var ctxW = ctx.getWidth();
+ var ctxH = ctx.getHeight();
+
+ let isUseMainClip = (window["IS_NATIVE_EDITOR"] !== true);
+
+ if (isUseMainClip)
+ ctx.AddClipRect(this.headersLeft - this.groupWidth, clipRectY, ctxW, ctxH);
// draw row headers
var t = this._getRowTop(start) - offsetY, h;
for (var i = start; i <= end; ++i) {
@@ -4431,6 +4788,8 @@
this._drawHeader(drawingCtx, offsetX, t, this.headersWidth, h, style, false, i);
t += h;
}
+ if (isUseMainClip)
+ ctx.RemoveClipRect();
};
/**
@@ -4526,7 +4885,7 @@
}
};
let drawLeftBorder = function (_selected) {
- if (style !== kHeaderDefault && isColHeader) {
+ if ((style !== kHeaderDefault || t.getRightToLeft()) && isColHeader) {
// Select col (left border)
ctx.lineVerPrevPx(x, y, y2);
}
@@ -4572,7 +4931,7 @@
let x1Diff = 0;
let x2Diff = 0;
if (_selected) {
- x1Diff = (isFirstRowSelection ? (_toRetina(1) + 1) : 1);
+ x1Diff = (isFirstRowSelection ? (_toRetina(1) + 1) : (1 - t.getRightToLeftOffset()));
x2Diff = (isFirstRowSelection ? _toRetina(1) : 0);
}
ctx.lineHorPrevPx(x - x1Diff, y2, x2 + x2Diff);
@@ -4625,7 +4984,22 @@
var textY = this._calcTextVertPos(y, h, bl, tm, Asc.c_oAscVAlign.Bottom);
ctx.AddClipRect(x, y, w, h);
- ctx.setFillStyle(color).fillText(text, textX, textY + Asc.round(tm.baseline * this.getZoom()), undefined, sr.charWidths);
+ ctx.setFillStyle(color);
+
+ let charsWidth = 0;
+ if (this.getRightToLeft()) {
+ for (let i in sr.charWidths) {
+ charsWidth += sr.charWidths[i];
+ }
+ textX = textX + charsWidth;
+ if (ctx.Transform) {
+ ctx.DocumentRenderer.transform(1, 0, 0, 1, 0, 0);
+ textX = this.getCtxWidth() - textX;
+ }
+ }
+
+ this._fillText(ctx, text, textX, textY + Asc.round(tm.baseline * this.getZoom()), undefined, sr.charWidths);
+
ctx.RemoveClipRect();
};
@@ -4878,7 +5252,7 @@
};
WorksheetView.prototype._cleanColumnHeaders = function (colStart, colEnd) {
- var offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+ var offsetX = this._getOffsetX();
var l, w, i, cFrozen = 0;
if (this.topLeftFrozenCell) {
cFrozen = this.topLeftFrozenCell.getCol0();
@@ -4910,7 +5284,7 @@
}
}
if (0 !== cFrozen) {
- offsetX = this._getColLeft(0) - this.cellsLeft;
+ offsetX = this._getOffsetX(0, true);
// Почистим для pane
colStart = Math.max(0, colStart);
colEnd = Math.min(cFrozen, colEnd);
@@ -4926,7 +5300,7 @@
};
WorksheetView.prototype._cleanRowHeaders = function (rowStart, rowEnd) {
- var offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ var offsetY = this._getOffsetY();
var t, h, i, rFrozen = 0;
if (this.topLeftFrozenCell) {
rFrozen = this.topLeftFrozenCell.getRow0();
@@ -4944,7 +5318,7 @@
//by clean down thin border
let correctX = 0;
let correctY = -1*(_toRetina(1) + 1);
- let correctW = (this.getRetinaPixelRatio() >= 2 ? _toRetina(1) : 0);
+ let correctW = (this.getRetinaPixelRatio() >= 2 ? _toRetina(1) : 0) + 2 * this.getRightToLeftOffset();
let correctH = _toRetina(2) + 1;
var rowStartTmp = Math.max(this.visibleRange.r1, rowStart);
@@ -4958,7 +5332,7 @@
}
}
if (0 !== rFrozen) {
- offsetY = this._getRowTop(0) - this.cellsTop;
+ offsetY = this._getOffsetY(0, true);
// Почистим для pane
rowStart = Math.max(0, rowStart);
rowEnd = Math.min(rFrozen, rowEnd);
@@ -5004,8 +5378,8 @@
let ctx = drawingCtx || this.drawingCtx;
let widthCtx = (width) ? width / printScale : ctx.getWidth() / printScale;
let heightCtx = (height) ? height / printScale : ctx.getHeight() / printScale;
- let offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
- let offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ let offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getOffsetX();
+ let offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getOffsetY();
if (!drawingCtx && this.topLeftFrozenCell) {
if (undefined === leftFieldInPx) {
let cFrozen = this.topLeftFrozenCell.getCol0();
@@ -5016,6 +5390,14 @@
offsetY -= this._getRowTop(rFrozen) - this._getRowTop(0);
}
}
+
+ let isClip;
+ if (!drawingCtx && !window['IS_NATIVE_EDITOR']) {
+ if (this._clipDrawingRect(ctx, range, clipType.range)) {
+ isClip = true;
+ }
+ }
+
let x1 = this._getColLeft(range.c1) - offsetX;
let y1 = this._getRowTop(range.r1) - offsetY;
let x2 = Math.min(this._getColLeft(range.c2 + 1) - offsetX, widthCtx);
@@ -5076,17 +5458,303 @@
ctx.fillRect(x1, y1, x2 - x1, y2 - y1);
}
+ if (!drawingCtx && !window['IS_NATIVE_EDITOR'] && isClip) {
+ ctx.RemoveClipRect();
+ }
+
//this._drawPageBreakPreviewLines(drawingCtx, range, leftFieldInPx, topFieldInPx, width, height);
};
+ let clipType = {
+ groupRows: 0,
+ groupCols: 1,
+ groupAll: 2,
+ headersRows: 3,
+ headersCols: 4,
+ headersAll: 5,
+ range: 6
+ };
+ WorksheetView.prototype._clipDrawingRect = function (drawingCtx, range, type) {
+ let ctxW = drawingCtx.getWidth();
+ let ctxH = drawingCtx.getHeight();
+
+ if (range === undefined) {
+ range = this.visibleRange;
+ }
+ if (type === undefined) {
+ type = clipType.range;
+ }
+
+ let frozenOffsetX = 0;
+ let frozenOffsetY = 0;
+ let isFrozenRows = null;
+ let isFrozenCols = null;
+ if (this.topLeftFrozenCell) {
+ //if (undefined === offsetXForDraw) {
+ let cFrozen = this.topLeftFrozenCell.getCol0();
+ if (range.c1 < cFrozen) {
+ isFrozenCols = true;
+ }
+ frozenOffsetX = this._getColLeft(cFrozen) - this.cellsLeft;
+ //}
+ //if (undefined === offsetYForDraw) {
+ let rFrozen = this.topLeftFrozenCell.getRow0();
+ frozenOffsetY = this._getRowTop(rFrozen) - this.cellsTop;
+ if (range.r1 < rFrozen) {
+ isFrozenRows = true;
+ }
+ //}
+ }
+
+ let _case = 0;
+ let clipX, clipY, clipWidth, clipHeight;
+
+ switch (type) {
+ case clipType.groupRows:
+ if (!this.groupWidth) {
+ return false;
+ }
+ //clip rows group bar
+ clipX = this.headersLeft - this.groupWidth;
+ clipY = (!isFrozenRows && frozenOffsetY) ? (this.cellsTop + frozenOffsetY) : this.cellsTop;
+ clipWidth = this.groupWidth;
+ clipHeight = ctxH;
+ _case = -1;
+
+ break;
+ case clipType.groupCols:
+ if (!this.groupHeight) {
+ return false;
+ }
+ //clip cols group bar
+ clipX = (!isFrozenCols && frozenOffsetX) ? (this.cellsLeft + frozenOffsetX) : this.cellsLeft;
+ clipY = this.headersTop - this.groupHeight;
+ clipWidth = ctxW;
+ clipHeight = this.groupHeight;
+ _case = -2;
+
+ break;
+ case clipType.groupAll:
+ if (!this.groupHeight) {
+ return false;
+ }
+ //clip all include groups bar
+ clipX = this.headersLeft - this.groupWidth;
+ clipY = this.headersTop - this.groupHeight;
+ clipWidth = ctxW;
+ clipHeight = ctxH;
+ _case = -3;
+
+ break;
+ case clipType.headersRows:
+ if (!this.model.getSheetView().asc_getShowRowColHeaders()) {
+ return false;
+ }
+
+ clipX = this.headersLeft;
+ clipY = isFrozenRows ? (this.cellsTop + frozenOffsetY) : this.cellsTop;
+ clipWidth = this.headersWidth;
+ clipHeight = ctxH;
+ _case = -4;
+
+ break;
+ case clipType.headersCols:
+ if (!this.model.getSheetView().asc_getShowRowColHeaders()) {
+ return false;
+ }
+
+ clipX = isFrozenCols ? (this.cellsLeft + frozenOffsetX) : this.cellsLeft;
+ clipY = this.headersTop;
+ clipWidth = ctxW;
+ clipHeight = this.headersHeight;
+ _case = -5;
+
+ break;
+ case clipType.headersAll:
+ if (!this.model.getSheetView().asc_getShowRowColHeaders()) {
+ return false;
+ }
+
+ clipX = this.headersLeft;
+ clipY = this.headersTop;
+ clipWidth = ctxW;
+ clipHeight = ctxH;
+ _case = -6;
+
+ break;
+ case clipType.range:
+ let x1 = this._getColLeft(range.c1);
+ let x2 = this._getColLeft(range.c2 + 1);
+ let y1 = this._getRowTop(range.r1);
+ let y2 = this._getRowTop(range.r2 + 1);
+ let width = x2 - x1;
+ let height = y2 - y1;
+ let offsetX = this._getOffsetX();
+ let offsetY = this._getOffsetY();
+
+ let t = this;
+ let doSimpleClip = function () {
+ let heightOffset = 0;
+ if (y1 - offsetY < t.cellsTop) {
+ heightOffset = t.cellsTop - (y1 - offsetY);
+ }
+ let widthOffset = 0;
+ if (x1 - offsetX < t.cellsLeft) {
+ widthOffset = t.cellsLeft - (x1 - offsetX);
+ }
+ clipX = x1 - offsetX + widthOffset + t.getRightToLeftOffset();
+ clipY = y1 - offsetY + heightOffset;
+ clipWidth = width - widthOffset;
+ clipHeight = height - heightOffset;
+ };
+
+
+ if (!frozenOffsetX && !frozenOffsetY) {
+ //not frozen panes
+ doSimpleClip();
+ _case = 1;
+ } else if (frozenOffsetX && !frozenOffsetY) {
+ //only cols frozen
+ let heightOffset = 0;
+ if (y1 - offsetY < this.cellsTop) {
+ heightOffset = this.cellsTop - (y1 - offsetY);
+ }
+ if (!isFrozenCols) {
+ //outside frozen area
+ let screenX = x1 - offsetX + frozenOffsetX;
+ let widthOffset = 0;
+ if (screenX < frozenOffsetX + this.cellsLeft) {
+ widthOffset = (frozenOffsetX + this.cellsLeft) - screenX;
+ }
+
+ clipX = screenX + widthOffset;
+ clipY = y1 - offsetY + heightOffset;
+ clipWidth = width - widthOffset;
+ clipHeight = height - heightOffset;
+ _case = 2;
+ } else {
+ //inside frozen area
+ clipX = x1;
+ clipY = y1 - offsetY + heightOffset;
+ clipWidth = width;
+ clipHeight = height - heightOffset;
+ _case = 3;
+ }
+ } else if (!frozenOffsetX && frozenOffsetY) {
+ //only rows frozen
+ let widthOffset = 0;
+ if (x1 - offsetX < this.cellsLeft) {
+ widthOffset = this.cellsLeft - (x1 - offsetX);
+ }
+ if (!isFrozenRows) {
+ //outside frozen area
+ let screenY = y1 - offsetY + frozenOffsetY;
+ let heightOffset = 0;
+ if (screenY < frozenOffsetY + this.cellsTop) {
+ heightOffset = (frozenOffsetY + this.cellsTop) - screenY;
+ }
+
+ clipX = x1 - offsetX + widthOffset;
+ clipY = screenY + heightOffset;
+ clipWidth = width - widthOffset;
+ clipHeight = height - heightOffset;
+ _case = 4
+ } else {
+ //inside frozen area
+ clipX = x1 - offsetX + widthOffset;
+ clipY = y1;
+ clipWidth = width - widthOffset;
+ clipHeight = height;
+ _case = 5;
+ }
+ } else if (frozenOffsetX && frozenOffsetY) {
+ if (!isFrozenRows && !isFrozenCols) {
+ let screenX = x1 - offsetX + frozenOffsetX;
+ let widthOffset = 0;
+ if (screenX < frozenOffsetX + this.cellsLeft) {
+ widthOffset = (frozenOffsetX + this.cellsLeft) - screenX;
+ }
+
+ let screenY = y1 - offsetY + frozenOffsetY;
+ let heightOffset = 0;
+ if (screenY < frozenOffsetY + this.cellsTop) {
+ heightOffset = (frozenOffsetY + this.cellsTop) - screenY;
+ }
+
+ clipX = screenX + widthOffset;
+ clipY = screenY + heightOffset;
+ clipWidth = width - widthOffset;
+ clipHeight = height - heightOffset;
+
+ _case = 6
+ } else if (isFrozenRows && !isFrozenCols) {
+
+ let screenX = x1 - offsetX + frozenOffsetX;
+ let widthOffset = 0;
+ if (screenX < frozenOffsetX + this.cellsLeft) {
+ widthOffset = (frozenOffsetX + this.cellsLeft) - screenX;
+ }
+
+ let screenY = y1 - offsetY + frozenOffsetY;
+ let heightOffset = 0;
+ if (screenY < frozenOffsetY + this.cellsTop) {
+ heightOffset = (frozenOffsetY + this.cellsTop) - screenY;
+ }
+
+ clipX = screenX + widthOffset;
+ clipY = y1;
+ clipWidth = width - widthOffset;
+ clipHeight = height;
+
+ _case = 7;
+ } else if (!isFrozenRows && isFrozenCols) {
+ let screenX = x1 - offsetX + frozenOffsetX;
+ let widthOffset = 0;
+ if (screenX < frozenOffsetX + this.cellsLeft) {
+ widthOffset = (frozenOffsetX + this.cellsLeft) - screenX;
+ }
+
+ let screenY = y1 - offsetY + frozenOffsetY;
+ let heightOffset = 0;
+ if (screenY < frozenOffsetY + this.cellsTop) {
+ heightOffset = (frozenOffsetY + this.cellsTop) - screenY;
+ }
+
+ clipX = x1;
+ clipY = screenY + heightOffset;
+ clipWidth = width;
+ clipHeight = height - heightOffset;
+
+ _case = 8;
+ } else if (isFrozenRows && isFrozenCols) {
+ clipX = x1;
+ clipY = y1;
+ clipWidth = width;
+ clipHeight = height;
+
+ _case = 9;
+ }
+ }
+
+ break;
+ }
+
+ drawingCtx.AddClipRect(clipX, clipY, clipWidth, clipHeight);
+ //for test
+ //console.log(" range: " + range.getName() + " clipX: " + clipX + " clipY: " + clipY + " clipWidth: " + clipWidth + " clipHeight: " + clipHeight + " caset: " + caset)
+ //drawingCtx.setLineWidth(3).setStrokeStyle(AscCommonExcel.c_oAscCoAuthoringOtherBorderColor).strokeRect(clipX + 1, clipY + 1, clipWidth - 1, clipHeight - 1);
+
+ return true;
+ };
+
WorksheetView.prototype._drawCellsAndBorders = function (drawingCtx, range, offsetXForDraw, offsetYForDraw) {
if (range === undefined) {
range = this.visibleRange;
}
let left, top, cFrozen, rFrozen;
- let offsetX = (undefined === offsetXForDraw) ? this._getColLeft(this.visibleRange.c1) - this.cellsLeft : offsetXForDraw;
- let offsetY = (undefined === offsetYForDraw) ? this._getRowTop(this.visibleRange.r1) - this.cellsTop : offsetYForDraw;
+ let offsetX = (undefined === offsetXForDraw) ? this._getOffsetX() : offsetXForDraw;
+ let offsetY = (undefined === offsetYForDraw) ? this._getOffsetY() : offsetYForDraw;
if (!drawingCtx && this.topLeftFrozenCell) {
if (undefined === offsetXForDraw) {
cFrozen = this.topLeftFrozenCell.getCol0();
@@ -5098,15 +5766,11 @@
}
}
+ let isClip = null;
if (!drawingCtx && !window['IS_NATIVE_EDITOR']) {
- left = this._getColLeft(range.c1);
- top = this._getRowTop(range.r1);
- // set clipping rect to cells area
- this.drawingCtx.save()
- .beginPath()
- .rect(left - offsetX, top - offsetY, Math.min(this._getColLeft(range.c2 + 1) - left, this.drawingCtx.getWidth() - this.cellsLeft),
- Math.min(this._getRowTop(range.r2 + 1) - top, this.drawingCtx.getHeight() - this.cellsTop))
- .clip();
+ if (this._clipDrawingRect(this.drawingCtx, range, clipType.range)) {
+ isClip = true;
+ }
}
this._prepareCellTextMetricsCache(range);
@@ -5145,7 +5809,7 @@
this.drawTraceArrows(range, offsetX, offsetY, [drawingCtx]);
}
- if (!drawingCtx && !window['IS_NATIVE_EDITOR']) {
+ if (isClip) {
// restore canvas' original clipping range
this.drawingCtx.restore();
}
@@ -5213,7 +5877,7 @@
var fillGrid = findFillColor || hasFill;
findFillColor = findFillColor || (!hasFill && mc && this.settings.cells.defaultState.background);
- var x = this._getColLeft(col) - (fillGrid ? 1 : 0);
+ var x = this._getColLeft(col) - (fillGrid ? 1 : 0) + this.getRightToLeftOffset();
var y = top - (fillGrid ? 1 : 0);
var w = width + (fillGrid ? +1 : -1) + mwidth;
var h = height + (fillGrid ? +1 : -1) + mheight;
@@ -5262,10 +5926,28 @@
drawCells[i] = 1;
}
}
+
+ let _originalMatrix;
+ let _ctx = drawingCtx || this.drawingCtx;
+ if (this.getRightToLeft()) {
+ _originalMatrix = _ctx.Transform ? _ctx.Transform.CreateDublicate() : _ctx._mbt.clone();
+ let _transform = new AscCommon.CMatrix();
+ let transformMatrix = _transform.CreateDublicate ? _transform.CreateDublicate() : _transform.clone();
+
+ _ctx.setTransform(1, transformMatrix.shy, transformMatrix.shx, transformMatrix.sy, transformMatrix.tx, transformMatrix.ty);
+ _ctx.updateTransforms && _ctx.updateTransforms();
+ }
+
// draw text
for (i in drawCells) {
this._drawCellText(drawingCtx, cfIterator, i >> 0, row, colStart, colEnd, offsetX, offsetY);
}
+
+ if (_originalMatrix) {
+ _ctx.setTransform(_originalMatrix.sx, _originalMatrix.shy, _originalMatrix.shx,
+ _originalMatrix.sy, _originalMatrix.tx, _originalMatrix.ty);
+ _ctx.updateTransforms && _ctx.updateTransforms();
+ }
};
WorksheetView.prototype._getCellCF = function (cfIterator, c, row, col, type) {
@@ -5433,6 +6115,9 @@
&& AscCommon.align_Center !== cellHA)) {
cellHA = AscCommon.align_Left;
}
+ if (this.getRightToLeft()) {
+ rect._x = this.getCtxWidth(ctx) - rect._x - rect._width;
+ }
rect._x = this._calcTextHorizPos(rect._x, rect._x + rect._width, tm, cellHA);
rect._y = this._calcTextVertPos(rect._y, rect._height, bl, tm, align.getAlignVertical());
var dScale = asc_getcvt(0, 3, this._getPPIX());
@@ -5461,6 +6146,7 @@
var oMatrix = new AscCommon.CMatrix();
oMatrix.tx = rect._x;
oMatrix.ty = rect._y;
+
graphics.transform3(oMatrix);
var shapeDrawer = new AscCommon.CShapeDrawer();
shapeDrawer.Graphics = graphics;
@@ -5483,7 +6169,7 @@
return true;
}
- var x = this._getColLeft(col) - offsetX + 1;
+ var x = this._getColLeft(col) - offsetX + 1 + 2*this.getRightToLeftOffset();
width -= 3; // indent
top += 1 - offsetY;
@@ -5513,6 +6199,10 @@
return null;
}
+ if (this.getRightToLeft()) {
+ offsetX = -offsetX;
+ }
+
var c = this._getVisibleCell(col, row);
if (false === this.model.getSheetView().asc_getShowZeros() && c.getValue() === "0") {
@@ -5543,15 +6233,21 @@
}
}
- var x1 = this._getColLeft(colL) - offsetX;
+ var x1 = this.checkRtl(this._getColLeft(colL), ctx) - offsetX;
var y1 = this._getRowTop(rowT) - offsetY;
- var w = this._getColLeft(colR + 1) - offsetX - x1;
+ var w = this.checkRtl(this._getColLeft(colR + 1), ctx) - offsetX - x1;
var h = this._getRowTop(rowB + 1) - offsetY - y1;
var x2 = x1 + w - (isTrimmedR ? 0 : gridlineSize);
var y2 = y1 + h;
var bl = y2 - Asc.round(
(isMerged ? (ct.metrics.height - ct.metrics.baseline) : this._getRowDescender(rowB)) * this.getZoom());
- var x1ct = isMerged ? x1 : this._getColLeft(col) - offsetX;
+ if (this.getRightToLeft()) {
+ let temp = x1;
+ x1 = x2;
+ x2 = temp;
+ w = -w;
+ }
+ var x1ct = isMerged ? x1 : this._getColLeft(col, true, ctx) - offsetX;
var x2ct = isMerged ? x2 : x1ct + this._getColumnWidth(col) - gridlineSize;
var textX = this._calcTextHorizPos(x1ct, x2ct, ct.metrics, ct.cellHA);
var textY = this._calcTextVertPos(y1, h, bl, ct.metrics, ct.cellVA);
@@ -5565,7 +6261,7 @@
if (ct.angle) {
- xb1 = this._getColLeft(col) - offsetX;
+ xb1 = this._getColLeft(col, true, ctx) - offsetX;
yb1 = this._getRowTop(row) - offsetY;
wb = this._getColumnWidth(col);
hb = this._getRowHeight(row);
@@ -5574,7 +6270,11 @@
txtRotW = ct.textBound.width + xb1 - ct.textBound.offsetX;
if (isMerged) {
- wb = this._getColLeft(colR + 1) - this._getColLeft(colL);
+ wb = this._getColLeft(colR + 1, null, ctx) - this._getColLeft(colL, null, ctx);
+ if (this.getRightToLeft()) {
+ xb1 += this._getColumnWidth(col) - wb;
+ }
+
hb = this._getRowTop(rowB + 1) - this._getRowTop(rowT);
ctx.AddClipRect(xb1, yb1, wb, hb);
clipUse = true;
@@ -5603,7 +6303,7 @@
if (0 == colLeft) {
break;
}
- if (txtRotX >= this._getColLeft(colLeft)) {
+ if (txtRotX >= this._getColLeft(colLeft, true, ctx)) {
break;
}
--colLeft;
@@ -5618,7 +6318,7 @@
--colRight;
break;
}
- if (txtRotW <= this._getColLeft(colRight)) {
+ if (txtRotW <= this._getColLeft(colRight, true, ctx)) {
--colRight;
break;
}
@@ -5679,7 +6379,7 @@
}
}
- this.stringRender.render(drawingCtx, 0, 0, textW, color);
+ this._drawText(this.stringRender, drawingCtx, 0, 0, textW, color);
this.stringRender.resetTransform(isPrintPreview ? null : drawingCtx);
if (transformMatrix) {
@@ -5731,7 +6431,8 @@
}
}
}
- this.stringRender.restoreInternalState(ct.state).render(drawingCtx, textX, textY, textW, color);
+
+ this._drawText(this.stringRender.restoreInternalState(ct.state), drawingCtx, textX, textY, textW, color)
ctx.RemoveClipRect();
}
@@ -6230,8 +6931,8 @@
var t = this;
var ctx = drawingCtx || this.drawingCtx;
- var offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
- var offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ var offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getOffsetX();
+ var offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getOffsetY();
var frozenX = 0, frozenY = 0, cFrozen, rFrozen;
if (!drawingCtx && this.topLeftFrozenCell) {
@@ -6337,7 +7038,7 @@
let _y2 = Math.min(tY1 + textHeight * _zoom, y2);
if (_x1 < _x2 && _y1 < _y2) {
ctx.AddClipRect(x1, y1, x2 - x1, y2 - y1);
- this.stringRender.render(undefined, tX1, tY1, 100, this.settings.activeCellBorderColor);
+ this._drawText(this.stringRender, undefined, tX1, tY1, 100, this.settings.activeCellBorderColor);
ctx.RemoveClipRect();
}
}
@@ -6457,10 +7158,10 @@
switch (type) {
case c_oAscBorderType.Hor:
- ctx.lineHor(x1, y1, x2);
+ ctx.lineHor(x1 + t.getRightToLeftOffset(), y1, x2 + t.getRightToLeftOffset());
break;
case c_oAscBorderType.Ver:
- ctx.lineVer(x1, y1, y2);
+ ctx.lineVer(x1 + 2*t.getRightToLeftOffset(), y1, y2);
break;
case c_oAscBorderType.Diag:
ctx.lineDiag(x1, y1, x2, y2);
@@ -6651,11 +7352,15 @@
*/
if (bCur.borders.dd) {
// draw diagonal line l,t - r,b
- drawBorder(c_oAscBorderType.Diag, bCur.borders.d, x1 - 1, y1 - 1, x2Diagonal, y2Diagonal);
+ if (bCur.borders.d && bCur.borders.d.w > 0) {
+ drawBorder(c_oAscBorderType.Diag, bCur.borders.d, x1 - 1, y1 - 1, x2Diagonal, y2Diagonal);
+ }
}
if (bCur.borders.du) {
// draw diagonal line l,b - r,t
- drawBorder(c_oAscBorderType.Diag, bCur.borders.d, x1 - 1, y2Diagonal, x2Diagonal, y1 - 1);
+ if (bCur.borders.d && bCur.borders.d.w > 0) {
+ drawBorder(c_oAscBorderType.Diag, bCur.borders.d, x1 - 1, y2Diagonal, x2Diagonal, y1 - 1);
+ }
}
// ToDo Clip diagonal borders
//ctx.restore();
@@ -6769,8 +7474,8 @@
var tmpRange, offsetX, offsetY;
if ( 0 < row && 0 < col ) {
- offsetX = this._getColLeft(0) - this.cellsLeft;
- offsetY = this._getRowTop(0) - this.cellsTop;
+ offsetX = this._getOffsetX(0, true);
+ offsetY = this._getOffsetY(0, true)
tmpRange = new asc_Range( 0, 0, col - 1, row - 1 );
if ( !noCells ) {
this._drawGrid( null, tmpRange, offsetX, offsetY );
@@ -6782,7 +7487,7 @@
if ( 0 < row ) {
row -= 1;
offsetX = undefined;
- offsetY = this._getRowTop(0) - this.cellsTop;
+ offsetY = this._getOffsetY(0, true);
tmpRange = new asc_Range( this.visibleRange.c1, 0, this.visibleRange.c2, row );
this._drawRowHeaders( null, 0, row, kHeaderDefault, offsetX, offsetY );
if ( !noCells ) {
@@ -6794,7 +7499,7 @@
}
if ( 0 < col ) {
col -= 1;
- offsetX = this._getColLeft(0) - this.cellsLeft;
+ offsetX = this._getOffsetX(0, true);
offsetY = undefined;
tmpRange = new asc_Range( 0, this.visibleRange.r1, col, this.visibleRange.r2 );
this._drawColumnHeaders( null, 0, col, kHeaderDefault, offsetX, offsetY );
@@ -6808,6 +7513,31 @@
}
};
+ WorksheetView.prototype._getOffsetY = function (nRow, checkFrozen) {
+ if (nRow == null) {
+ nRow = this.visibleRange.r1
+ }
+ let scrollCorrect = this.getScrollCorrect();
+ let frozenRow = checkFrozen && this.topLeftFrozenCell && this.topLeftFrozenCell.getRow0();
+ if (frozenRow && frozenRow > nRow) {
+ scrollCorrect = 0;
+ }
+ return this._getRowTop(nRow) - this.cellsTop + scrollCorrect;
+ };
+
+ WorksheetView.prototype._getOffsetX = function (nCol, checkFrozen) {
+ if (nCol == null) {
+ nCol = this.visibleRange.c1
+ }
+ let scrollCorrect = this.getHorizontalScrollCorrect();
+ let frozenCol = checkFrozen && this.topLeftFrozenCell && this.topLeftFrozenCell.getCol0();
+ if (frozenCol && frozenCol > nCol) {
+ scrollCorrect = 0;
+ }
+
+ return this._getColLeft(nCol != null ? nCol : this.visibleRange.c1) - this.cellsLeft + scrollCorrect;
+ };
+
/** Рисует закрепление областей */
WorksheetView.prototype._drawFrozenPaneLines = function (drawingCtx) {
// Возможно стоит отрисовывать на overlay, а не на основной канве
@@ -6819,8 +7549,8 @@
ctx.setLineWidth(1).setStrokeStyle(color).beginPath();
var fHorLine, fVerLine;
if (isLocked) {
- fHorLine = ctx.dashLineCleverHor;
- fVerLine = ctx.dashLineCleverVer;
+ fHorLine = this._dashLineCleverHor;
+ fVerLine = this._dashLineCleverVer;
} else {
fHorLine = ctx.lineHorPrevPx;
fVerLine = ctx.lineVerPrevPx;
@@ -6830,26 +7560,38 @@
var row = this.topLeftFrozenCell.getRow0();
var col = this.topLeftFrozenCell.getCol0();
if (0 < row) {
- fHorLine.apply(ctx, [0, this._getRowTop(row), ctx.getWidth()]);
+ fHorLine.apply(ctx, [0, this._getRowTop(row), ctx.getWidth(), this]);
} else {
- fHorLine.apply(ctx, [this.headersLeft, this.headersTop + this.headersHeight, this.headersLeft + this.headersWidth]);
+ fHorLine.apply(ctx, [this.headersLeft, this.headersTop + this.headersHeight, this.headersLeft + this.headersWidth, this]);
}
if (0 < col) {
- fVerLine.apply(ctx, [this._getColLeft(col), 0, ctx.getHeight()]);
+ fVerLine.apply(ctx, [this._getColLeft(col), 0, ctx.getHeight(), this]);
} else {
- fVerLine.apply(ctx, [this.headersLeft + this.headersWidth, this.headersTop, this.headersTop + this.headersHeight]);
+ fVerLine.apply(ctx, [this.headersLeft + this.headersWidth, this.headersTop, this.headersTop + this.headersHeight, this]);
}
ctx.stroke();
} else if (this.model.getSheetView().asc_getShowRowColHeaders()) {
- fHorLine.apply(ctx, [this.headersLeft, this.headersTop + this.headersHeight, this.headersLeft + this.headersWidth]);
- fVerLine.apply(ctx, [this.headersWidth + this.headersLeft, this.headersTop, this.headersTop + this.headersHeight]);
+ fHorLine.apply(ctx, [this.headersLeft + this.getRightToLeftOffset(), this.headersTop + this.headersHeight, this.headersLeft + this.headersWidth, this]);
+ fVerLine.apply(ctx, [this.headersWidth + this.headersLeft, this.headersTop, this.headersTop + this.headersHeight, this]);
ctx.stroke();
}
};
+ WorksheetView.prototype._dashLineCleverVer = function (x, y1, y2, _this) {
+ let ctx = this;
+ ctx.dashLineCleverVer(_this.getRightToLeft() ? (_this.getCtxWidth(ctx) - x) : x, y1, y2)
+ return ctx;
+ };
+
+ WorksheetView.prototype._dashLineCleverHor = function (x1, y, x2, _this) {
+ let ctx = this;
+ ctx.dashLineCleverHor(_this.getRightToLeft() ? (_this.getCtxWidth(ctx) - x2) : x1, y, _this.getRightToLeft() ? (_this.getCtxWidth(ctx) - x1) : x2)
+ return ctx;
+ };
+
WorksheetView.prototype.drawFrozenGuides = function ( x, y, target ) {
var data, offsetFrozen;
var ctx = this.overlayCtx;
@@ -6864,7 +7606,7 @@
data.col += 1;
if ( 0 <= data.col && data.col < this.nColsCount ) {
var h = ctx.getHeight();
- var offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+ var offsetX = this._getOffsetX();
offsetFrozen = this.getFrozenPaneOffset( false, true );
offsetX -= offsetFrozen.offsetX;
ctx.setFillPattern( this.settings.ptrnLineDotted1 )
@@ -6878,7 +7620,7 @@
data.row += 1;
if ( 0 <= data.row && data.row < this.nRowsCount ) {
var w = ctx.getWidth();
- var offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ var offsetY = this._getOffsetY();
offsetFrozen = this.getFrozenPaneOffset( true, false );
offsetY -= offsetFrozen.offsetY;
ctx.setFillPattern( this.settings.ptrnLineDotted1 )
@@ -7153,8 +7895,8 @@
let dashThickLine = AscCommonExcel.selectionLineType.DashThick & selectionLineType;
if (isDashLine || dashThickLine) {
- fHorLine = ctx.dashLineCleverHor;
- fVerLine = ctx.dashLineCleverVer;
+ fHorLine = this._dashLineCleverHor;
+ fVerLine = this._dashLineCleverVer;
} else {
fHorLine = ctx.lineHorPrevPx;
fVerLine = ctx.lineVerPrevPx;
@@ -7220,17 +7962,18 @@
ctx.setLineWidth(widthLine).setStrokeStyle(strokeColor);
ctx.beginPath();
+
if (drawTopSide && !firstRow) {
- fHorLine.apply(ctx, [x1 - !isDashLine * (2 + isRetina * 1) + _diff, y1, x2 + !isDashLine * (1 + isRetina * 1) - _diff]);
+ fHorLine.apply(ctx, [x1 - !isDashLine * (2 + isRetina * 1) + _diff + this.getRightToLeftOffset()*1, y1, x2 + !isDashLine * (1 + isRetina * 1) - _diff + this.getRightToLeftOffset()*1, this]);
}
if (drawBottomSide) {
- fHorLine.apply(ctx, [x1, y2 + !isDashLine * 1 - thinLineDiff, x2]);
+ fHorLine.apply(ctx, [x1, y2 + !isDashLine * 1 - thinLineDiff, x2, this]);
}
if (drawLeftSide && !firstCol) {
- fVerLine.apply(ctx, [x1, y1, y2 + !isDashLine * (1 + isRetina * 1) - _diff]);
+ fVerLine.apply(ctx, [x1 - this.getRightToLeftOffset()*1, y1, y2 + !isDashLine * (1 + isRetina * 1) - _diff, this]);
}
if (drawRightSide) {
- fVerLine.apply(ctx, [x2 + !isDashLine * 1 - thinLineDiff, y1, y2 + !isDashLine * (1 + isRetina * 1)]);
+ fVerLine.apply(ctx, [x2 + !isDashLine * 1 - thinLineDiff -this.getRightToLeftOffset()*1, y1, y2 + !isDashLine * (1 + isRetina * 1), this]);
}
ctx.closePath().stroke();
}
@@ -7259,20 +8002,22 @@
ctx.setStrokeStyle(colorN);
ctx.beginPath();
if (drawTopSide) {
- fHorLine.apply(ctx, [x1 + isRetina * 1, y1 + 1 + isRetina * !firstRow * 1, x2 - 1 - isRetina * 1]);
+ fHorLine.apply(ctx, [x1 + isRetina * 1 + this.getRightToLeftOffset()*1, y1 + 1 + isRetina * !firstRow * 1, x2 - 1 - isRetina * 1 + this.getRightToLeftOffset()*1, ctx]);
}
if (drawBottomSide) {
- fHorLine.apply(ctx, [x1 + isRetina * 1, y2 - 1 - isRetina * 1, x2 - 1 - isRetina * 1]);
+ fHorLine.apply(ctx, [x1 + isRetina * 1+ this.getRightToLeftOffset()*1, y2 - 1 - isRetina * 1, x2 - 1 - isRetina * 1+ this.getRightToLeftOffset()*1, ctx]);
}
if (drawLeftSide) {
- fVerLine.apply(ctx, [x1 + 1 + isRetina * !firstCol * 1, y1 + isRetina * 1, y2 - 2 - isRetina * !firstCol * 1]);
+ fVerLine.apply(ctx, [x1 + 1 + isRetina * !firstCol * 1, y1 + isRetina * 1, y2 - 2 - isRetina * !firstCol * 1, ctx]);
}
if (drawRightSide) {
- fVerLine.apply(ctx, [x2 - 1 - isRetina * 1, y1 + isRetina * 1, y2 - 2 - isRetina * 1]);
+ fVerLine.apply(ctx, [x2 - 1 - isRetina * 1, y1 + isRetina * 1, y2 - 2 - isRetina * 1, ctx]);
}
ctx.closePath().stroke();
}
+
+
// Отрисовка квадратов для move/resize
let isResize = AscCommonExcel.selectionLineType.Resize & selectionLineType;
let isPromote = AscCommonExcel.selectionLineType.Promote & selectionLineType;
@@ -7286,11 +8031,11 @@
ctx.setFillStyle(colorN);
if (drawRightSide && drawBottomSide) {
- ctx.fillRect(x2 - diffBorder, y2 - diffBorder, sizeBorder, sizeBorder);
+ ctx.fillRect(x2 - diffBorder + this.getRightToLeftOffset()*1, y2 - diffBorder, sizeBorder, sizeBorder);
}
ctx.setFillStyle(strokeColor);
if (drawRightSide && drawBottomSide) {
- ctx.fillRect(x2 - diff, y2 - diff, size, size);
+ ctx.fillRect(x2 - diff + this.getRightToLeftOffset()*1, y2 - diff, size, size);
}
if (isResize) {
@@ -7321,8 +8066,8 @@
/**Отрисовывает диапазон с заданными параметрами*/
WorksheetView.prototype._drawElements = function (drawFunction) {
var cFrozen = 0, rFrozen = 0, args = Array.prototype.slice.call(arguments, 1),
- offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft,
- offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop, res;
+ offsetX = this._getOffsetX(),
+ offsetY = this._getOffsetY(), res;
if (this.topLeftFrozenCell) {
cFrozen = this.topLeftFrozenCell.getCol0();
rFrozen = this.topLeftFrozenCell.getRow0();
@@ -7333,21 +8078,42 @@
rFrozen -= 1;
if (0 <= cFrozen && 0 <= rFrozen) {
oFrozenRange = new asc_Range(0, 0, cFrozen, rFrozen);
- res = drawFunction.call(this, oFrozenRange, this._getColLeft(0) - this.cellsLeft, this._getRowTop(0) - this.cellsTop, args);
+ res = drawFunction.call(this, oFrozenRange, this._getColLeft(0) - this.cellsLeft, this._getOffsetY(0, true), args);
if (!res) {
return;
}
}
if (0 <= cFrozen) {
oFrozenRange = new asc_Range(0, this.visibleRange.r1, cFrozen, this.visibleRange.r2);
- res = drawFunction.call(this, oFrozenRange, this._getColLeft(0) - this.cellsLeft, offsetY, args);
- if (!res) {
- return;
- }
+
+ let clipX = this._getColLeft(oFrozenRange.c1) - offsetX + this.getHorizontalScrollCorrect();
+ let clipY = this._getRowTop(oFrozenRange.r1) - offsetY + this.getScrollCorrect();
+ let clipW = this._getColLeft(this.visibleRange.c2 + 1) - this._getColLeft(oFrozenRange.c1);
+ let clipH = this._getRowTop(this.visibleRange.r2 + 1) - this._getRowTop(oFrozenRange.r1);
+
+ this.overlayCtx.save().beginPath()
+ .rect(clipX, clipY, clipW, clipH)
+ .clip();
+ res = drawFunction.call(this, oFrozenRange, this._getColLeft(0) - this.cellsLeft, offsetY, args);
+ this.overlayCtx.restore();
+
+ if (!res) {
+ return;
+ }
}
if (0 <= rFrozen) {
oFrozenRange = new asc_Range(this.visibleRange.c1, 0, this.visibleRange.c2, rFrozen);
- res = drawFunction.call(this, oFrozenRange, offsetX, this._getRowTop(0) - this.cellsTop, args);
+ let clipX = this._getColLeft(oFrozenRange.c1) - offsetX + this.getHorizontalScrollCorrect();
+ let clipY = this._getRowTop(oFrozenRange.r1) - offsetY + this.getScrollCorrect();
+ let clipW = this._getColLeft(this.visibleRange.c2 + 1) - this._getColLeft(oFrozenRange.c1);
+ let clipH = this._getRowTop(this.visibleRange.r2 + 1) - this._getRowTop(oFrozenRange.r1);
+
+ this.overlayCtx.save().beginPath()
+ .rect(clipX, clipY, clipW, clipH)
+ .clip();
+ res = drawFunction.call(this, oFrozenRange, offsetX, this._getOffsetY(0, true), args);
+ this.overlayCtx.restore();
+
if (!res) {
return;
}
@@ -7355,7 +8121,16 @@
}
// Можно вместо call попользовать apply, но тогда нужно каждый раз соединять массив аргументов и 3 объекта
+ let clipX = this._getColLeft(this.visibleRange.c1) - offsetX + this.getHorizontalScrollCorrect();
+ let clipY = this._getRowTop(this.visibleRange.r1) - offsetY + this.getScrollCorrect();
+ let clipW = this._getColLeft(this.visibleRange.c2 + 1) - this._getColLeft(this.visibleRange.c1);
+ let clipH = this._getRowTop(this.visibleRange.r2 + 1) - this._getRowTop(this.visibleRange.r1);
+
+ this.overlayCtx.save().beginPath()
+ .rect(clipX, clipY, clipW, clipH)
+ .clip();
drawFunction.call(this, this.visibleRange, offsetX, offsetY, args);
+ this.overlayCtx.restore();
};
/**
@@ -7383,6 +8158,9 @@
// set clipping rect to cells area
var ctx = this.overlayCtx;
+
+ this._startRtlRendering(ctx);
+
ctx.save().beginPath()
.rect(this.cellsLeft, this.cellsTop, ctx.getWidth() - this.cellsLeft, ctx.getHeight() - this.cellsTop)
.clip();
@@ -7513,6 +8291,7 @@
if (!isOtherSelectionMode && !isShapeSelect) {
this._drawActiveHeaders();
}
+ this._endRtlRendering(ctx);
};
WorksheetView.prototype.Show_ForeignCursorLabel = function(userId, foreignCursor, index, color) {
@@ -7736,7 +8515,9 @@
var y2 = -Number.MAX_VALUE;
var _x1, _x2, _y1, _y2;
var i;
- var arnIntersection;
+ var arnIntersection;
+
+ this._startRtlRendering(ctx);
if (this.topLeftFrozenCell) {
var cFrozen = this.topLeftFrozenCell.getCol0();
@@ -7769,13 +8550,14 @@
if (range.r1 !== this.visibleRange.r1) {
diffHeight = 0;
}
- offsetX = this._getColLeft(range.c1) - this.cellsLeft - diffWidth;
- offsetY = this._getRowTop(range.r1) - this.cellsTop - diffHeight;
+ offsetX = this._getOffsetX(range.c1, true) - diffWidth;
+ offsetY = this._getOffsetY(range.r1, true) - diffHeight;
} else {
- offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft - diffWidth;
- offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop - diffHeight;
+ offsetX = this._getOffsetX() - diffWidth;
+ offsetY = this._getOffsetY() - diffHeight;
}
+ this._endRtlRendering(ctx);
this._activateOverlayCtx();
var t = this;
var isRetinaWidth = this.getRetinaPixelRatio() >= 2;
@@ -7809,6 +8591,7 @@
}
});
this._deactivateOverlayCtx();
+ this._startRtlRendering(ctx);
// Если есть активное автозаполнения, то нужно его тоже очистить
if (this.activeFillHandle !== null) {
@@ -8009,7 +8792,7 @@
if (!(Number.MAX_VALUE === x1 && -Number.MAX_VALUE === x2 && Number.MAX_VALUE === y1 &&
-Number.MAX_VALUE === y2)) {
- if(this.workbook.Api.isMobileVersion) {
+ if(this.workbook.Api.wb.MobileTouchManager) {
//Add radius of mobile pins
var nRad = (AscCommon.MOBILE_SELECT_TRACK_ROUND / 2 + 0.5) >> 0;
nRad = AscCommon.AscBrowser.convertToRetinaValue(nRad, true);
@@ -8026,6 +8809,7 @@
.clearRect(x1, y1, x2 - x1, y2 - y1)
.restore();
}
+ this._endRtlRendering(ctx);
return this;
};
@@ -8108,17 +8892,21 @@
x += mouseX;
var ctx = this.overlayCtx;
- var offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+ var offsetX = this._getOffsetX();
var offsetFrozen = this.getFrozenPaneOffset( false, true );
offsetX -= offsetFrozen.offsetX;
var x1 = this._getColLeft(col) - offsetX - gridlineSize;
var h = ctx.getHeight();
- var width = Asc.round((x - x1) / (this.getZoom(true) * this.getRetinaPixelRatio()));
+ var width = Asc.round((this.getRightToLeft() ? (this.getCtxWidth() - x1) - x : (x - x1)) / (this.getZoom(true) * this.getRetinaPixelRatio()));
if ( 0 > width ) {
width = 0;
}
+ if (this.getRightToLeft()) {
+ x1 = this.drawingCtx.getWidth() - x1;
+ }
+
ctx.clear();
this._drawSelection();
ctx.setFillPattern( this.settings.ptrnLineDotted1 )
@@ -8129,7 +8917,7 @@
type : Asc.c_oAscMouseMoveType.ResizeColumn,
sizeCCOrPt: this.model.colWidthToCharCount(width),
sizePx : width,
- x : AscCommon.AscBrowser.convertToRetinaValue(x1 + this._getColumnWidth(col)),
+ x : AscCommon.AscBrowser.convertToRetinaValue( this.getRightToLeft() ? x1 : x1 + this._getColumnWidth(col)),
y : AscCommon.AscBrowser.convertToRetinaValue(this.cellsTop)
} );
};
@@ -8140,7 +8928,7 @@
y += mouseY;
var ctx = this.overlayCtx;
- var offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ var offsetY = this._getOffsetY();
var offsetFrozen = this.getFrozenPaneOffset( true, false );
offsetY -= offsetFrozen.offsetY;
@@ -8161,7 +8949,7 @@
type : Asc.c_oAscMouseMoveType.ResizeRow,
sizeCCOrPt: AscCommonExcel.convertPxToPt(height),
sizePx : height,
- x : AscCommon.AscBrowser.convertToRetinaValue(this.cellsLeft),
+ x : AscCommon.AscBrowser.convertToRetinaValue(this.getRightToLeft() ? (this.getCtxWidth() - this.cellsLeft) : this.cellsLeft),
y : AscCommon.AscBrowser.convertToRetinaValue(y1 + this._getRowHeight(row))
} );
};
@@ -8630,6 +9418,7 @@
if (!angle && !verticalText && (cto.leftSide !== 0 || cto.rightSide !== 0)) {
this._addErasedBordersToCache(col - cto.leftSide, col + cto.rightSide, row);
}
+
this._updateRowHeight(cache, row, maxW, colWidth);
return mc ? mc.c2 : col;
@@ -8689,6 +9478,35 @@
//not find a case where the ms does not update the height with the columns merged ans wrap
var isMergedRows = (mergeType & c_oAscMergeType.rows)/* || (mergeType && cache.flags.wrapText)*/;
var tm = cache.metrics;
+
+ let mergedWrapHeight = null;
+ if (mergeType && cache.flags.wrapText) {
+ if (cache.angle) {
+ isMergedRows = true;
+ } else {
+ //ms use ht if multitext cell inside and use text 1 line height metrics if not multitext
+ //while such as detect different text settings into 1 cell. probably, need get info from model
+ let textHeight;
+ if (cache.state && cache.state.lines) {
+ for (let i = 0 ; i < cache.state.lines.length; i++) {
+ if (!textHeight) {
+ textHeight = cache.state.lines[i].th;
+ } else if (textHeight !== cache.state.lines[i].th) {
+ textHeight = null;
+ break;
+ }
+ }
+ }
+ if (textHeight) {
+ mergedWrapHeight = textHeight;
+ } else {
+ let _rowHeight = AscCommonExcel.convertPtToPx(this.model.getRowHeight(row));
+ if (_rowHeight && !isNaN(_rowHeight)) {
+ mergedWrapHeight = _rowHeight;
+ }
+ }
+ }
+ }
var va = cache.cellVA;
var textBound = cache.textBound;
var rowInfo = this.rows[row];
@@ -8705,7 +9523,7 @@
// update row's height
// Замерженная ячейка (с 2-мя или более строками) не влияет на высоту строк!
if (!isCustomHeight && !(window["NATIVE_EDITOR_ENJINE"] && this.notUpdateRowHeight) && !isMergedRows) {
- var newHeight = tm.height;
+ var newHeight = mergedWrapHeight ? mergedWrapHeight : tm.height;
var oldHeight = this.updateRowHeightValuePx || AscCommonExcel.convertPtToPx(this._getRowHeightReal(row));
if (cache.angle && textBound) {
newHeight = Math.max(oldHeight, textBound.height / this.getZoom());
@@ -9328,19 +10146,8 @@
function findEOT() {
var obr = t.objectRender ? t.objectRender.getMaxColRow() : new AscCommon.CellBase(-1, -1);
- var maxCols = t.model.getColsCount();
- var maxRows = t.model.getRowsCount();
- var lastC = -1, lastR = -1;
-
- for (var col = 0; col < maxCols; ++col) {
- for (var row = 0; row < maxRows; ++row) {
- if (!t._isCellNullText(col, row)) {
- lastC = Math.max(lastC, col);
- lastR = Math.max(lastR, row);
- }
- }
- }
- return {col: Math.max(lastC, obr.col), row: Math.max(lastR, obr.row)};
+ const eot = t.model.findEOT();
+ return {col: Math.max(eot.col, obr.col), row: Math.max(eot.row, obr.row)};
}
var eot = dc > +2.0001 && dc < +2.9999 && dr > +2.0001 && dr < +2.9999 ? findEOT() : null;
@@ -9418,14 +10225,14 @@
};
WorksheetView.prototype._getMissingWidth = function () {
- var visibleWidth = this.cellsLeft + this._getColLeft(this.nColsCount) - this._getColLeft(this.visibleRange.c1);
+ var visibleWidth = this._getColLeft(this.nColsCount) - this._getOffsetX();
var offsetFrozen = this.getFrozenPaneOffset(false, true);
visibleWidth += offsetFrozen.offsetX;
return this.drawingCtx.getWidth() - visibleWidth;
};
WorksheetView.prototype._getMissingHeight = function () {
- var visibleHeight = this.cellsTop + this._getRowTop(this.nRowsCount) - this._getRowTop(this.visibleRange.r1);
+ var visibleHeight = this._getRowTop(this.nRowsCount) - this._getOffsetY();
var offsetFrozen = this.getFrozenPaneOffset(true, false);
visibleHeight += offsetFrozen.offsetY;
return this.drawingCtx.getHeight() - visibleHeight;
@@ -9463,10 +10270,103 @@
};
WorksheetView.prototype.scrollVertical = function (delta, editor, initRowsCount) {
+ let t = this;
var vr = this.visibleRange;
var fixStartRow = new asc_Range(vr.c1, vr.r1, vr.c2, vr.r1);
+
+ let isReverse = delta < 0;
+ let unitDeltaStep = Asc.round(this.getVScrollStep());
+
+ let defaultScrollPxStep = unitDeltaStep * Math.abs(delta);
+ if (defaultScrollPxStep < 1) {
+ return;
+ }
+ defaultScrollPxStep = Math.floor(defaultScrollPxStep);
+
+ let deltaRows = 0, deltaCorrect = 0;
+ let currentScrollCorrect = this.getScrollCorrect();
+
+ let firstRow = vr.r1;
+ let startRowHeight = this._getRowHeight(firstRow);
+
+ var offsetX, offsetY, diffWidth = 0, diffHeight = 0, cFrozen = 0, rFrozen = 0;
+ if (this.topLeftFrozenCell) {
+ cFrozen = this.topLeftFrozenCell.getCol0();
+ rFrozen = this.topLeftFrozenCell.getRow0();
+ diffWidth = this._getColLeft(cFrozen) - this._getColLeft(0);
+ diffHeight = this._getRowTop(rFrozen) - this._getRowTop(0);
+ }
+
+ if (this.workbook.getSmoothScrolling()) {
+ //in px
+ if (!isReverse) {
+ //down scroll
+ if (currentScrollCorrect + defaultScrollPxStep >= startRowHeight) {
+ //go to the next row
+ //calculate part of row + new rows delta
+
+ let allScrollHeight = currentScrollCorrect + defaultScrollPxStep;
+ let scrollHeight = 0;
+ for (let i = firstRow; i < gc_nMaxRow0; i++) {
+ let _rowHeight = this._getRowHeight(i);
+ scrollHeight += _rowHeight;
+ if (scrollHeight >= allScrollHeight) {
+ if (scrollHeight === allScrollHeight) {
+ deltaRows++;
+ } else {
+ deltaCorrect = _rowHeight - (scrollHeight - allScrollHeight);
+ }
+ break;
+ }
+ deltaRows++;
+ }
+ } else {
+ //stay in wr.r1
+ deltaCorrect = defaultScrollPxStep + currentScrollCorrect;
+ deltaRows = 0;
+ }
+ } else {
+ //up scroll
+ if (currentScrollCorrect - defaultScrollPxStep < 0) {
+ //go to the next row
+ //calculate part of row + new rows delta
+
+ let allScrollHeight = defaultScrollPxStep - currentScrollCorrect;
+ let scrollHeight = 0;
+ /*if (currentScrollCorrect !== 0) {
+ deltaRows--;
+ }*/
+ for (let i = firstRow - 1; i >= 0; i--) {
+ let _rowHeight = this._getRowHeight(i);
+ scrollHeight += _rowHeight;
+ if (scrollHeight >= allScrollHeight) {
+ if (scrollHeight === allScrollHeight) {
+ deltaRows--;
+ } else {
+ //if (deltaRows === 0) {
+ deltaRows--;
+ //}
+ deltaCorrect = (scrollHeight - allScrollHeight);
+ }
+ break;
+ }
+ deltaRows--;
+ }
+
+
+ } else {
+ //stay in vr.r1
+ deltaCorrect = currentScrollCorrect - defaultScrollPxStep;
+ deltaRows = 0;
+ }
+ }
+
+ delta = deltaRows;
+ }
+
+
this._fixSelectionOfHiddenCells(0, delta >= 0 ? +1 : -1, fixStartRow);
- var start = this._calcCellPosition(vr.c1, fixStartRow.r1, 0, delta).row;
+ var start = this._calcCellPosition(vr.c1, this.workbook.getSmoothScrolling() ? vr.r1 : fixStartRow.r1, 0, delta).row;
fixStartRow.assign(vr.c1, start, vr.c2, start);
this._fixSelectionOfHiddenCells(0, delta >= 0 ? +1 : -1, fixStartRow);
this._fixVisibleRange(fixStartRow);
@@ -9477,7 +10377,7 @@
}
start = fixStartRow.r1;
- if (start === vr.r1) {
+ if (start === vr.r1 && (!this.workbook.getSmoothScrolling() || (this.workbook.getSmoothScrolling() && currentScrollCorrect === deltaCorrect))) {
if (reinitScrollY) {
this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollVertical;
this._reinitializeScroll();
@@ -9486,6 +10386,7 @@
}
if (!this.notUpdateRowHeight) {
+ this.cleanHighlightedHeaders();
this.cleanSelection();
this.cellCommentator.cleanSelectedComment();
}
@@ -9493,19 +10394,17 @@
var ctx = this.drawingCtx;
var ctxW = ctx.getWidth();
var ctxH = ctx.getHeight();
- var offsetX, offsetY, diffWidth = 0, diffHeight = 0, cFrozen = 0, rFrozen = 0;
- if (this.topLeftFrozenCell) {
- cFrozen = this.topLeftFrozenCell.getCol0();
- rFrozen = this.topLeftFrozenCell.getRow0();
- diffWidth = this._getColLeft(cFrozen) - this._getColLeft(0);
- diffHeight = this._getRowTop(rFrozen) - this._getRowTop(0);
- }
var oldVRE_isPartial = this._isRowDrawnPartially(vr.r2, vr.r1, diffHeight);
var oldVR = vr.clone();
var oldStart = vr.r1;
var oldEnd = vr.r2;
var x = this.cellsLeft;
+
+ var topOldStart = this._getRowTop(oldStart);
+ var dy = (this._getRowTop(start) + deltaCorrect - (topOldStart + currentScrollCorrect));
+ this.workbook.getSmoothScrolling() && this.setScrollCorrect(deltaCorrect);
+
// ToDo стоит тут переделать весь scroll
vr.r1 = start;
this._updateVisibleRowsCount();
@@ -9514,7 +10413,7 @@
// Полностью обновилась область
this._prepareCellTextMetricsCache(vr);
} else {
- if (0 > delta) {
+ if (isReverse) {
// Идем вверх
this._prepareCellTextMetricsCache(new asc_Range(vr.c1, start, vr.c2, oldStart - 1));
} else {
@@ -9528,14 +10427,15 @@
}
var oldW, dx;
- var topOldStart = this._getRowTop(oldStart);
- var dy = this._getRowTop(start) - topOldStart;
+
var oldH = ctxH - this.cellsTop - Math.abs(dy) - diffHeight;
var scrollDown = (dy > 0 && oldH > 0);
var y = this.cellsTop + (scrollDown ? dy : 0) + diffHeight;
var lastRowHeight = (scrollDown && oldVRE_isPartial) ?
ctxH - (this._getRowTop(oldEnd) - topOldStart + this.cellsTop + diffHeight) : 0;
+ this._startRtlRendering();
+
//TODO рассмотреть все случаи, когда необходимо вычитать groupWidth
if (x !== this.cellsLeft) {
this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollHorizontal;
@@ -9574,33 +10474,69 @@
// Очищаем область
var clearTop = this.cellsTop + diffHeight + (scrollDown && moveHeight > 0 ? moveHeight : 0);
var clearHeight = (moveHeight > 0) ? Math.abs(dy) + lastRowHeight : ctxH - (this.cellsTop + diffHeight);
+ let clearOffset = 0;
+ if (this.workbook.getSmoothScrolling() && (diffHeight + this._getRowTop(0)) !== clearTop) {
+ //need clear full row height
+ let firstDrawRow = vr.r1;
+ if (moveHeight > 0 && scrollDown) {
+ firstDrawRow = oldEnd + ((oldVRE_isPartial || (delta === 0)) ? 0 : 1);
+ }
+
+ let firstDrawRowPos = this.getCellTopRelative(firstDrawRow, undefined, true);
+ if (firstDrawRowPos && clearTop > firstDrawRowPos) {
+ clearOffset = clearTop - firstDrawRowPos;
+ }
+ }
ctx.setFillStyle(this.settings.cells.defaultState.background)
- .fillRect(this.headersLeft - this.groupWidth, clearTop, ctxW, clearHeight);
- this.drawingGraphicCtx.clearRect(this.headersLeft - this.groupWidth, clearTop, ctxW, clearHeight);
+ .fillRect(this.headersLeft - this.groupWidth, clearTop - clearOffset, ctxW, clearHeight + clearOffset);
+ this.drawingGraphicCtx.clearRect(this.headersLeft - this.groupWidth, clearTop - clearOffset, ctxW, clearHeight + clearOffset);
this._updateDrawingArea();
// Дорисовываем необходимое
- if (dy < 0 || vr.r2 !== oldEnd || oldVRE_isPartial || dx !== 0) {
+ if (dy < 0 || vr.r2 !== oldEnd || oldVRE_isPartial || dx !== 0 || (clearHeight !== 0 && this.workbook.getSmoothScrolling())) {
var r1, r2;
if (moveHeight > 0) {
if (scrollDown) {
- r1 = oldEnd + (oldVRE_isPartial ? 0 : 1);
+ r1 = oldEnd + ((oldVRE_isPartial || (delta === 0 && this.workbook.getSmoothScrolling())) ? 0 : 1);
r2 = vr.r2;
} else {
r1 = vr.r1;
- r2 = delta < 0 ? (vr.r1 + (oldVR.r1 - vr.r1 - 1)) : (vr.r1 - 1 - delta);
+ r2 = isReverse ? (vr.r1 + (oldVR.r1 - vr.r1 - 1)) : (vr.r1 - 1 - delta);
}
} else {
r1 = vr.r1;
r2 = vr.r2;
}
+
+ if (this.workbook.getSmoothScrolling() && r2 < AscCommon.gc_nMaxRow0) {
+ r2++;
+ }
+ if (r1 > AscCommon.gc_nMaxRow0) {
+ r1 = AscCommon.gc_nMaxRow0;
+ }
+ if (r2 > AscCommon.gc_nMaxRow0) {
+ r2 = AscCommon.gc_nMaxRow0;
+ }
+ if (this.workbook.getSmoothScrolling() && r2 < r1) {
+ r2 = r1;
+ }
+
+ let startClip = function () {
+ if (t.workbook.getSmoothScrolling()) {
+ ctx.AddClipRect(t.headersLeft - t.groupWidth, clearTop - clearOffset, ctxW, clearHeight + clearOffset);
+ t.drawingGraphicCtx.AddClipRect && t.drawingGraphicCtx.AddClipRect(t.headersLeft - t.groupWidth, clearTop - clearOffset, ctxW, clearHeight + clearOffset);
+ }
+ };
+
var range = new asc_Range(vr.c1, r1, vr.c2, r2);
if (dx === 0) {
+ startClip();
this._drawRowHeaders(null, r1, r2);
} else {
// redraw all headres, because number of decades in row index has been changed
this._drawRowHeaders(null);
+ startClip();
if (dx < 0) {
// draw last column
var r_;
@@ -9614,15 +10550,15 @@
}
if (0 < rFrozen) {
r_ = new asc_Range(vr.c2, 0, vr.c2, rFrozen - 1);
- offsetY = this._getRowTop(0) - this.cellsTop;
+ offsetY = this._getOffsetY(0, true);
this._drawGrid(null, r_, /*offsetXForDraw*/undefined, offsetY);
this._drawGroupData(null, r_, /*offsetXForDraw*/undefined, offsetY);
this._drawCellsAndBorders(null, r_, /*offsetXForDraw*/undefined, offsetY);
}
}
}
- offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft - diffWidth;
- offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop - diffHeight;
+ offsetX = this._getOffsetX() - diffWidth;
+ offsetY = this._getOffsetY() - diffHeight;
this._drawGrid(null, range);
if(dx !== 0) {
this._drawGroupData(null);
@@ -9636,7 +10572,7 @@
if (0 < cFrozen) {
range.c1 = 0;
range.c2 = cFrozen - 1;
- offsetX = this._getColLeft(0) - this.cellsLeft;
+ offsetX = this._getOffsetX(0, true);
this._drawGrid(null, range, offsetX);
this._drawGroupData(null, range, offsetX);
this._drawCellsAndBorders(null, range, offsetX);
@@ -9644,22 +10580,52 @@
this.objectRender.updateRange(range);
}
}
+
+ if (this.workbook.getSmoothScrolling()) {
+ ctx.RemoveClipRect();
+ this.drawingGraphicCtx.RemoveClipRect && this.drawingGraphicCtx.RemoveClipRect();
+ }
+
// Отрисовывать нужно всегда, вдруг бордеры
this._drawFrozenPaneLines();
this._fixSelectionOfMergedCells();
this._drawSelection();
//this._cleanPagesModeData();
- if (reinitScrollY || (0 > delta && initRowsCount && this._initRowsCount())) {
+ /*if (!reinitScrollY && this.workbook.getSmoothScrolling()) {
+ reinitScrollY = oldEnd !== vr.r2;
+ }*/
+
+ let isNeedExpand = function () {
+ //we must init scroll, if expand scroll range(calculate new rows height)
+ //todo need review
+ let controller = t.workbook.controller;
+ let scrollStep = controller.settings.vscrollStep;
+ if (!t.workbook.Api.isMobileVersion && !AscCommon.AscBrowser.isMacOs && !initRowsCount && t.workbook.getSmoothScrolling() && !isReverse && t.model.getRowsCount() >
+ t.visibleRange.r2 && controller.vsbMax && scrollStep && controller.vsbMax < (t.getVerticalScrollRange() * scrollStep)) {
+ return true;
+ }
+ return false;
+ };
+
+ if ((reinitScrollY && !this.workbook.getSmoothScrolling()) || (reinitScrollY && this.workbook.getSmoothScrolling() && deltaCorrect !== currentScrollCorrect) ||
+ (isReverse && initRowsCount && this._initRowsCount()) || (this.workbook.getSmoothScrolling() && initRowsCount && this.nRowsCount !== gc_nMaxRow) || isNeedExpand()) {
this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollVertical;
- }
+ }
+
+ if (initRowsCount) {
+ this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollInitRowsColsCount;
+ }
this._reinitializeScroll();
+
this.handlers.trigger("onDocumentPlaceChanged");
if (editor && this.model.getSelection().activeCell.row >= rFrozen) {
editor.move();
}
+ this._endRtlRendering();
+
//ToDo this.drawDepCells();
this.cellCommentator.updateActiveComment();
this.cellCommentator.drawCommentCells();
@@ -9669,11 +10635,134 @@
return this;
};
+
+ //smooth scroll
+ WorksheetView.prototype.setScrollCorrect = function (val, needDraw) {
+ this.scrollCorrect = val;
+ if (needDraw) {
+ this.draw();
+ }
+ };
+
+ WorksheetView.prototype.getScrollCorrect = function (units) {
+ var u = units >= 0 && units <= 3 ? units : 0;
+ return this.scrollCorrect ? (this.scrollCorrect * asc_getcvt(0/*px*/, u, this._getPPIX())) : 0;
+ };
+
+ WorksheetView.prototype.setHorizontalScrollCorrect = function (val, needDraw) {
+ this.horizontalScrollCorrect = val;
+ if (needDraw) {
+ this.draw();
+ }
+ };
+
+ WorksheetView.prototype.getHorizontalScrollCorrect = function (units) {
+ var u = units >= 0 && units <= 3 ? units : 0;
+ return this.horizontalScrollCorrect ? (this.horizontalScrollCorrect * asc_getcvt(0/*px*/, u, this._getPPIX())) : 0;
+ };
+
+
+
+ WorksheetView.prototype.isScrollCorrect = function () {
+ return !!this.scrollCorrect;
+ };
+
WorksheetView.prototype.scrollHorizontal = function (delta, editor, initColsCount) {
var vr = this.visibleRange;
var fixStartCol = new asc_Range(vr.c1, vr.r1, vr.c1, vr.r2);
+
+ let isReverse = delta < 0;
+ let unitDeltaStep = Asc.round(this.getHScrollStep());
+
+ let defaultScrollPxStep = unitDeltaStep * Math.abs(delta);
+ if (defaultScrollPxStep < 1) {
+ return;
+ }
+ defaultScrollPxStep = Math.ceil(defaultScrollPxStep);
+
+ let deltaCols = 0, deltaCorrect = 0;
+ let currentScrollCorrect = this.getHorizontalScrollCorrect();
+
+ let firstCol = vr.c1;
+ let startColWidth = this._getColumnWidth(firstCol);
+
+ var offsetX, offsetY, diffWidth = 0, diffHeight = 0, cFrozen = 0, rFrozen = 0;
+ if (this.topLeftFrozenCell) {
+ cFrozen = this.topLeftFrozenCell.getCol0();
+ rFrozen = this.topLeftFrozenCell.getRow0();
+ diffWidth = this._getColLeft(cFrozen) - this._getColLeft(0);
+ diffHeight = this._getRowTop(rFrozen) - this._getRowTop(0);
+ }
+
+ if (this.workbook.getSmoothScrolling()) {
+ //in px
+ if (!isReverse) {
+ //down scroll
+ if (currentScrollCorrect + defaultScrollPxStep >= startColWidth) {
+ //go to the next row
+ //calculate part of row + new rows delta
+
+ let allScrollWidth = currentScrollCorrect + defaultScrollPxStep;
+ let scrollWidth = 0;
+ for (let i = firstCol; i < gc_nMaxCol0; i++) {
+ let _colWidth = this._getColumnWidth(i);
+ scrollWidth += _colWidth;
+ if (scrollWidth >= allScrollWidth) {
+ if (scrollWidth === allScrollWidth) {
+ deltaCols++;
+ } else {
+ deltaCorrect = _colWidth - (scrollWidth - allScrollWidth);
+ }
+ break;
+ }
+ deltaCols++;
+ }
+ } else {
+ //stay in wr.r1
+ deltaCorrect = defaultScrollPxStep + currentScrollCorrect;
+ deltaCols = 0;
+ }
+ } else {
+ //up scroll
+ if (currentScrollCorrect - defaultScrollPxStep < 0) {
+ //go to the next row
+ //calculate part of row + new rows delta
+
+ let allScrollWidth = defaultScrollPxStep - currentScrollCorrect;
+ let scrollWidth = 0;
+ /*if (currentScrollCorrect !== 0) {
+ deltaRows--;
+ }*/
+ for (let i = firstCol - 1; i >= 0; i--) {
+ let _rowHeight = this._getColumnWidth(i);
+ scrollWidth += _rowHeight;
+ if (scrollWidth >= allScrollWidth) {
+ if (scrollWidth === allScrollWidth) {
+ deltaCols--;
+ } else {
+ //if (deltaRows === 0) {
+ deltaCols--;
+ //}
+ deltaCorrect = (scrollWidth - allScrollWidth);
+ }
+ break;
+ }
+ deltaCols--;
+ }
+
+
+ } else {
+ //stay in vr.r1
+ deltaCorrect = currentScrollCorrect - defaultScrollPxStep;
+ deltaCols = 0;
+ }
+ }
+
+ delta = deltaCols;
+ }
+
this._fixSelectionOfHiddenCells(delta >= 0 ? +1 : -1, 0, fixStartCol);
- var start = this._calcCellPosition(fixStartCol.c1, vr.r1, delta, 0).col;
+ var start = this._calcCellPosition(this.workbook.getSmoothScrolling() ? vr.c1 : fixStartCol.c1, vr.r1, delta, 0).col;
fixStartCol.assign(start, vr.r1, start, vr.r2);
this._fixSelectionOfHiddenCells(delta >= 0 ? +1 : -1, 0, fixStartCol);
this._fixVisibleRange(fixStartCol);
@@ -9684,7 +10773,7 @@
}
start = fixStartCol.c1;
- if (start === vr.c1) {
+ if (start === vr.c1 && (!this.workbook.getSmoothScrolling() || (this.workbook.getSmoothScrolling() && currentScrollCorrect === deltaCorrect))) {
if (reinitScrollX) {
this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollHorizontal;
this._reinitializeScroll();
@@ -9693,6 +10782,7 @@
}
if (!this.notUpdateRowHeight) {
+ this.cleanHighlightedHeaders();
this.cleanSelection();
this.cellCommentator.cleanSelectedComment();
}
@@ -9702,25 +10792,22 @@
var ctxH = ctx.getHeight();
var oldStart = vr.c1;
var oldEnd = vr.c2;
+
var leftOldStart = this._getColLeft(oldStart);
- var dx = this._getColLeft(start) - leftOldStart;
- var offsetX, offsetY, diffWidth = 0, diffHeight = 0;
+ var dx = (this._getColLeft(start) + deltaCorrect - (leftOldStart + currentScrollCorrect));
+
var oldW = ctxW - this.cellsLeft - Math.abs(dx);
var scrollRight = (dx > 0 && oldW > 0);
var x = this.cellsLeft + (scrollRight ? dx : 0);
var y = this.headersTop - this.groupHeight;
- var cFrozen = 0, rFrozen = 0;
- if (this.topLeftFrozenCell) {
- rFrozen = this.topLeftFrozenCell.getRow0();
- cFrozen = this.topLeftFrozenCell.getCol0();
- diffWidth = this._getColLeft(cFrozen) - this._getColLeft(0);
- diffHeight = this._getRowTop(rFrozen) - this._getRowTop(0);
- x += diffWidth;
- oldW -= diffWidth;
- }
+ x += diffWidth;
+ oldW -= diffWidth;
var oldVCE_isPartial = this._isColDrawnPartially(vr.c2, vr.c1, diffWidth);
var oldVR = vr.clone();
+
+ this.workbook.getSmoothScrolling() && this.setHorizontalScrollCorrect(deltaCorrect);
+
// ToDo стоит тут переделать весь scroll
vr.c1 = start;
this._updateVisibleColsCount();
@@ -9745,10 +10832,15 @@
var lastColWidth = (scrollRight && oldVCE_isPartial) ?
ctxW - (this._getColLeft(oldEnd) - leftOldStart + this.cellsLeft + diffWidth) : 0;
+
+ this._startRtlRendering();
+ this._startRtlDrawingRendering();
+
+
// Перемещаем область
var moveWidth = oldW - lastColWidth;
if (moveWidth > 0) {
- ctx.drawImage(ctx.getCanvas(), x, y, moveWidth, ctxH, x - dx, y, moveWidth, ctxH);
+ ctx.drawImage(ctx.getCanvas(), x + this.getRightToLeftOffset(), y, moveWidth, ctxH, x - dx + this.getRightToLeftOffset(), y, moveWidth, ctxH);
// Заглушка для safari (http://bugzilla.onlyoffice.com/show_bug.cgi?id=25546). Режим 'copy' сначала затирает, а
// потом рисует (а т.к. мы рисуем сами на себе, то уже картинка будет пустой)
@@ -9761,18 +10853,38 @@
// Очищаем область
var clearLeft = this.cellsLeft + diffWidth + (scrollRight && moveWidth > 0 ? moveWidth : 0);
var clearWidth = (moveWidth > 0) ? Math.abs(dx) + lastColWidth : ctxW - (this.cellsLeft + diffWidth);
+ let clearOffset = 0;
+ if (this.workbook.getSmoothScrolling() && (diffWidth + this._getColLeft(0)) !== clearLeft) {
+ //need clear full row height
+ let firstDrawCol = vr.c1;
+ if (moveWidth > 0 && scrollRight) {
+ firstDrawCol = oldEnd + ((oldVCE_isPartial || (delta === 0)) ? 0 : 1);
+ }
+
+ let firstDrawColPos = this.getCellLeftRelative(firstDrawCol, undefined, true);
+ if (firstDrawColPos && clearLeft > firstDrawColPos) {
+ clearOffset = clearLeft - firstDrawColPos;
+ }
+ }
+
ctx.setFillStyle(this.settings.cells.defaultState.background)
- .fillRect(clearLeft, y, clearWidth, ctxH);
- this.drawingGraphicCtx.clearRect(clearLeft, y, clearWidth, ctxH);
+ .fillRect(clearLeft - clearOffset + this.getRightToLeftOffset(), y, clearWidth + clearOffset, ctxH);
+ this.drawingGraphicCtx.clearRect(clearLeft - clearOffset, y, clearWidth + clearOffset, ctxH);
this._updateDrawingArea();
+
+ if (this.workbook.getSmoothScrolling()) {
+ ctx.AddClipRect(clearLeft - clearOffset + this.getRightToLeftOffset(), y, clearWidth + clearOffset + this.getRightToLeftOffset(), ctxH);
+ this.drawingGraphicCtx.AddClipRect && this.drawingGraphicCtx.AddClipRect(clearLeft - clearOffset, y, clearWidth + clearOffset + this.getRightToLeftOffset(), ctxH);
+ }
+ this._endRtlDrawingRendering();
// Дорисовываем необходимое
- if (dx < 0 || vr.c2 !== oldEnd || oldVCE_isPartial) {
+ if (dx < 0 || vr.c2 !== oldEnd || oldVCE_isPartial || (clearWidth !== 0 && this.workbook.getSmoothScrolling())) {
var c1, c2;
if (moveWidth > 0) {
if (scrollRight) {
- c1 = oldEnd + (oldVCE_isPartial ? 0 : 1);
+ c1 = oldEnd + ((oldVCE_isPartial || (delta === 0 && this.workbook.getSmoothScrolling())) ? 0 : 1);
c2 = vr.c2;
} else {
c1 = vr.c1;
@@ -9782,9 +10894,23 @@
c1 = vr.c1;
c2 = vr.c2;
}
+
+ if (this.workbook.getSmoothScrolling() && c2 < AscCommon.gc_nMaxCol0) {
+ c2++;
+ }
+ if (c1 > AscCommon.gc_nMaxCol0) {
+ c1 = AscCommon.gc_nMaxCol0;
+ }
+ if (c2 > AscCommon.gc_nMaxCol0) {
+ c2 = AscCommon.gc_nMaxCol0;
+ }
+ if (this.workbook.getSmoothScrolling() && c2 < c1) {
+ c2 = c1;
+ }
+
var range = new asc_Range(c1, vr.r1, c2, vr.r2);
- offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft - diffWidth;
- offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop - diffHeight;
+ offsetX = this._getOffsetX() - diffWidth;
+ offsetY = this._getOffsetY() - diffHeight;
this._drawColumnHeaders(null, c1, c2);
this._drawGrid(null, range);
this._drawGroupData(null, range, undefined, undefined, true);
@@ -9794,7 +10920,7 @@
if (rFrozen) {
range.r1 = 0;
range.r2 = rFrozen - 1;
- offsetY = this._getRowTop(0) - this.cellsTop;
+ offsetY = this._getOffsetY(0, true);
this._drawGrid(null, range, undefined, offsetY);
this._drawGroupData(null, range, undefined, offsetY, true);
this._drawCellsAndBorders(null, range, undefined, offsetY);
@@ -9803,35 +10929,64 @@
}
}
+ if (this.workbook.getSmoothScrolling()) {
+ ctx.RemoveClipRect();
+ this.drawingGraphicCtx.RemoveClipRect && this.drawingGraphicCtx.RemoveClipRect();
+ }
+
// Отрисовывать нужно всегда, вдруг бордеры
this._drawFrozenPaneLines();
this._fixSelectionOfMergedCells();
this._drawSelection();
//this._cleanPagesModeData();
- if (reinitScrollX || (0 > delta && initColsCount && this._initColsCount())) {
+ if (!reinitScrollX && this.workbook.getSmoothScrolling()) {
+ reinitScrollX = oldEnd !== vr.c2;
+ }
+
+ if ((reinitScrollX && !this.workbook.getSmoothScrolling()) || (reinitScrollX && this.workbook.getSmoothScrolling() && deltaCorrect !== currentScrollCorrect) ||
+ (0 > delta && initColsCount && this._initColsCount()) || (this.workbook.getSmoothScrolling() && initColsCount && this.nColsCount !== gc_nMaxCol)) {
if (reinitScrollX && (start - cFrozen) === 0 && 0 > delta && initColsCount) {
this._initColsCount();
}
this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollHorizontal;
- }
+ }
+ if (initColsCount) {
+ this.scrollType |= AscCommonExcel.c_oAscScrollType.ScrollInitRowsColsCount;
+ }
this._reinitializeScroll();
+
this.handlers.trigger("onDocumentPlaceChanged");
if (editor && this.model.getSelection().activeCell.col >= cFrozen) {
editor.move();
}
+ this._endRtlRendering();
+
//ToDo this.drawDepCells();
this.cellCommentator.updateActiveComment();
this.cellCommentator.drawCommentCells();
window['AscCommon'].g_specialPasteHelper.SpecialPasteButton_Update_Position();
this.handlers.trigger("toggleAutoCorrectOptions", true);
+
//this.model.updateTopLeftCell(this.visibleRange);
return this;
};
+ WorksheetView.prototype.executeScrollDefaultStep = function (callback) {
+ let oView = this.workbook && this.workbook.controller && this.workbook.controller.settings;
+ let defaultStep = 10;
+ let realVScrollPxStep = this.vScrollPxStep;
+ let realHScrollPxStep = this.hScrollPxStep;
+ this.vScrollPxStep = oView ? oView.vscrollStep : defaultStep;
+ this.hScrollPxStep = oView ? oView.hscrollStep : defaultStep;
+ callback();
+ this.vScrollPxStep = realVScrollPxStep;
+ this.hScrollPxStep = realHScrollPxStep;
+ };
+
// ----- Selection -----
// x,y - абсолютные координаты относительно листа (без учета заголовков)
@@ -9841,8 +10996,13 @@
result.col = result.row = null;
}
- x += this.cellsLeft;
+ x += this.getRightToLeft() ? 0 : this.cellsLeft;
y += this.cellsTop;
+
+ if (this.getRightToLeft()) {
+ x = this.getCtxWidth() - x;
+ }
+
if (!skipCol) {
sum = this._getColLeft(this.nColsCount);
if (sum < x) {
@@ -9853,7 +11013,7 @@
sum += (result.col - this.nColsCount) * (this.defaultColWidthPx * this.getZoom(true) * this.getRetinaPixelRatio());
}
} else {
- sum = this.cellsLeft;
+ sum = this.getRightToLeft() ? 0 : this.cellsLeft;
for (i = 0; i < this.nColsCount; ++i) {
size = this._getColumnWidth(i);
if (sum + size > x) {
@@ -9905,12 +11065,17 @@
* @returns {*}
* @private
*/
- WorksheetView.prototype._findColUnderCursor = function (x, canReturnNull, half) {
+ WorksheetView.prototype._findColUnderCursor = function (x, canReturnNull, half, ignoreRtl) {
var activeCellCol = half ? this._getSelection().activeCell.col : -1;
var w, dx = 0;
var c = this.visibleRange.c1;
- var offset = this._getColLeft(c) - this.cellsLeft;
- var c2, x1, x2, cFrozen, widthDiff = 0;
+ var offset = this._getOffsetX(c);
+ var c2, x1, x2, cFrozen, widthDiff = -this.getHorizontalScrollCorrect();
+
+ if (!ignoreRtl && this.getRightToLeft()) {
+ x = this.getCtxWidth() - x;
+ }
+
if (x >= this.cellsLeft) {
if (this.topLeftFrozenCell) {
cFrozen = this.topLeftFrozenCell.getCol0();
@@ -9918,6 +11083,8 @@
if (x < this.cellsLeft + widthDiff && 0 !== widthDiff) {
c = 0;
widthDiff = 0;
+ } else {
+ widthDiff -= this.getHorizontalScrollCorrect();
}
}
for (x1 = this.cellsLeft + widthDiff, c2 = this.nColsCount - 1; c <= c2; ++c, x1 = x2) {
@@ -9977,8 +11144,8 @@
var activeCellRow = half ? this._getSelection().activeCell.row : -1;
var h, dy = 0;
var r = this.visibleRange.r1;
- var offset = this._getRowTop(r) - this.cellsTop;
- var r2, y1, y2, rFrozen, heightDiff = 0;
+ var offset = /*this._getRowTop(r) - this.cellsTop*/this._getOffsetY(r);
+ var r2, y1, y2, rFrozen, heightDiff = -this.getScrollCorrect();
if (y >= this.cellsTop) {
if (this.topLeftFrozenCell) {
rFrozen = this.topLeftFrozenCell.getRow0();
@@ -9986,6 +11153,8 @@
if (y < this.cellsTop + heightDiff && 0 !== heightDiff) {
r = 0;
heightDiff = 0;
+ } else {
+ heightDiff -= this.getScrollCorrect();
}
}
for (y1 = this.cellsTop + heightDiff, r2 = this.nRowsCount - 1; r <= r2; ++r, y1 = y2) {
@@ -10339,6 +11508,9 @@
};
WorksheetView.prototype.getCursorTypeFromXY = function (x, y) {
+ if (this.getRightToLeft()) {
+ x = this.getCtxWidth() - x;
+ }
var canEdit = this.workbook.canEdit();
var viewMode = this.handlers.trigger('getViewMode');
this.handlers.trigger("checkLastWork");
@@ -10396,8 +11568,7 @@
lockRangePosTop: lockRangePosTop
};
}
-
- var drawingInfo = this.objectRender.checkCursorDrawingObject(x, y);
+ var drawingInfo = this.objectRender.checkCursorDrawingObject(this.getRightToLeft() ? this.getCtxWidth() - x : x, y);
if ((asc["editor"].isStartAddShape || asc["editor"].isInkDrawerOn()) &&
AscCommonExcel.CheckIdSatetShapeAdd(this.objectRender.controller.curState)) {
return {cursor: asc["editor"].isInkDrawerOn() ? kCurDefault : kCurFillHandle , target: c_oTargetType.Shape, col: -1, row: -1};
@@ -10457,8 +11628,8 @@
}
var cFrozen = -1, rFrozen = -1;
- offsetX = this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
- offsetY = this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ offsetX = this._getOffsetX();
+ offsetY = this._getOffsetY();
if (this.topLeftFrozenCell) {
cFrozen = this.topLeftFrozenCell.getCol0();
rFrozen = this.topLeftFrozenCell.getRow0();
@@ -10493,7 +11664,7 @@
if (readyMode && y <= this.cellsTop && this.groupHeight && y < this.groupHeight) {
c = null;
if(x > this.groupWidth + this.headersWidth) {
- c = this._findColUnderCursor(x, true);
+ c = this._findColUnderCursor(x, true, null, true);
}
col = -1;
if (c) {
@@ -10510,7 +11681,7 @@
let isMobileVersion = this.workbook && this.workbook.Api && this.workbook.Api.isMobileVersion;
var epsChangeSize = AscCommon.AscBrowser.convertToRetinaValue(3 * AscCommon.global_mouseEvent.KoefPixToMM, true);
- if (x <= this.cellsLeft && y >= this.cellsTop && x >= this.headersLeft) {
+ if (x <= this.cellsLeft && y >= this.cellsTop && x >= this.headersLeft + this.getRightToLeftOffset()) {
r = this._findRowUnderCursor(y, true);
if (r === null) {
return oResDefault;
@@ -10550,7 +11721,7 @@
}
if (y <= this.cellsTop && x >= this.cellsLeft && y >= this.headersTop) {
- c = this._findColUnderCursor(x, true);
+ c = this._findColUnderCursor(x, true, null, true);
if (c === null) {
return oResDefault;
}
@@ -10595,7 +11766,7 @@
}
}
if (y <= this.cellsTop && x >= this.cellsLeft) {
- c = this._findColUnderCursor(x, true);
+ c = this._findColUnderCursor(x, true, null, true);
if (c !== null) {
target = c_oTargetType.ColumnHeader;
col = c.col;
@@ -10647,7 +11818,7 @@
}
if (x > this.cellsLeft && y > this.cellsTop) {
- c = this._findColUnderCursor(x, true);
+ c = this._findColUnderCursor(x, true, null, true);
r = this._findRowUnderCursor(y, true);
if (c === null || r === null) {
return oResDefault;
@@ -10979,11 +12150,11 @@
WorksheetView.prototype._getRangeByXY = function (x, y) {
var c1, r1, c2, r2;
- if (x < this.cellsLeft && y < this.cellsTop) {
+ if (this.checkRtl(x) < this.cellsLeft && y < this.cellsTop) {
c1 = r1 = 0;
c2 = gc_nMaxCol0;
r2 = gc_nMaxRow0;
- } else if (x < this.cellsLeft) {
+ } else if (this.checkRtl(x) < this.cellsLeft) {
r1 = r2 = this._findRowUnderCursor(y).row;
c1 = 0;
c2 = gc_nMaxCol0;
@@ -11263,17 +12434,17 @@
var scroll = 0;
if (arn.r1 < vr.r1) {
- scroll = arn.r1 - vr.r1;
+ scroll = this._rowDiffToSmooth(arn.r1, vr.r1);
} else if (arn.r1 >= vr.r2) {
this.nRowsCount = arn.r2 + 1;
this._prepareCellTextMetricsCache(new asc_Range(vr.c1, vr.r2, vr.c2, arn.r2 + 1));
scroll = this.getVerticalScrollRange(true);
- if (scroll > arn.r1) {
- scroll = arn.r1;
+ if (scroll > this._rowToSmooth(arn.r1)) {
+ scroll = this._rowToSmooth(arn.r1);
}
- scroll -= vr.r1 - (this.topLeftFrozenCell ? this.topLeftFrozenCell.getRow0() : 0);
+ scroll -= this._rowDiffToSmooth(vr.r1, (this.topLeftFrozenCell ? this.topLeftFrozenCell.getRow0() : 0));
this.nRowsCount = nRowsCount;
}
if (scroll) {
@@ -11283,14 +12454,14 @@
scroll = 0;
if (arn.c1 < vr.c1) {
- scroll = arn.c1 - vr.c1;
+ scroll = this._colDiffToSmooth(arn.c1, vr.c1);
} else if (arn.c1 >= vr.c2) {
this.setColsCount(arn.c2 + 1 + 1);
scroll = this.getHorizontalScrollRange();
- if (scroll > arn.c1) {
- scroll = arn.c1;
+ if (scroll > this._colToSmooth(arn.c1)) {
+ scroll = this._colToSmooth(arn.c1);
}
- scroll -= vr.c1 - (this.topLeftFrozenCell ? this.topLeftFrozenCell.getCol0() : 0);
+ scroll -= this._colDiffToSmooth(vr.c1, (this.topLeftFrozenCell ? this.topLeftFrozenCell.getCol0() : 0));
this.setColsCount(nColsCount);
}
if (scroll) {
@@ -11642,6 +12813,120 @@
AscCommonExcel.referenceType.A : AscCommonExcel.referenceType.R);
};
+ WorksheetView.prototype.convertOffsetToSmooth = function (offset) {
+ if (!this.workbook.getSmoothScrolling()) {
+ return offset;
+ }
+
+ let vr = this.visibleRange;
+ if (offset.col !== 0) {
+ if (offset.col < 0) {
+ //left
+ let x1 = this.getCellLeft(vr.c1);
+ let x2 = this.getCellLeft(Math.max(vr.c1 + offset.col, 0));
+ let rowsWidth = x1 - x2;
+ let unitDeltaStep = this.getHScrollStep();
+ offset.col = -rowsWidth / unitDeltaStep;
+ offset.col -= this.getHorizontalScrollCorrect() / unitDeltaStep;
+ } else {
+ //down
+ /*let x1 = this.getCellLeft(vr.c2);
+ let x2 = this.getCellLeft(vr.c2 + offset.col);
+ let rowsWidth = x2 - x1;
+ let unitDeltaStep = Asc.round(this.defaultRowHeightPx * this.getZoom());
+ offset.col = rowsWidth / unitDeltaStep;
+ offset.col += this.getHorizontalScrollCorrect() / unitDeltaStep;*/
+ }
+ //this.setHorizontalScrollCorrect(0);
+ }
+ if (offset.row !== 0) {
+ if (offset.row < 0) {
+ //up
+ let y1 = this.getCellTop(vr.r1);
+ let y2 = this.getCellTop(Math.max(vr.r1 + offset.row, 0));
+ let rowsHeight = y1 - y2;
+ let unitDeltaStep = this.getVScrollStep();
+ offset.row = -rowsHeight / unitDeltaStep;
+ offset.row -= this.getScrollCorrect() / unitDeltaStep;
+ } else {
+ //down
+ /*let y1 = this.getCellTop(vr.r2);
+ let y2 = this.getCellTop(vr.r2 + offset.row);
+ let rowsHeight = y2 - y1;
+ let unitDeltaStep = Asc.round(this.defaultRowHeightPx * this.getZoom());
+ offset.row = rowsHeight / unitDeltaStep;
+ offset.row += this.getScrollCorrect() / unitDeltaStep;*/
+ }
+ //this.setScrollCorrect(0);
+ }
+ return offset;
+ };
+
+ WorksheetView.prototype._colDiffToSmooth = function (from, to) {
+ if (!this.workbook.getSmoothScrolling()) {
+ return from - to;
+ }
+
+ let x1 = this.getCellLeft(from);
+ let x2 = this.getCellLeft(to);
+ let colsWidth = x1 - x2;
+ let unitDeltaStep = this.getHScrollStep();
+ let res = colsWidth / unitDeltaStep;
+ res = res < 0 ? res - this.getHorizontalScrollCorrect() / unitDeltaStep : res + this.getHorizontalScrollCorrect() / unitDeltaStep;
+
+ return res;
+ };
+
+ WorksheetView.prototype._rowDiffToSmooth = function (from, to) {
+ if (!this.workbook.getSmoothScrolling()) {
+ return from - to;
+ }
+
+ let y1 = this.getCellTop(from);
+ let y2 = this.getCellTop(to);
+ let rowsHeight = y1 - y2;
+ let unitDeltaStep = this.getVScrollStep();
+ let res = rowsHeight / unitDeltaStep;
+ res = res < 0 ? res - this.getScrollCorrect() / unitDeltaStep : res + this.getScrollCorrect() / unitDeltaStep;
+
+ return res;
+ };
+
+ WorksheetView.prototype._colToSmooth = function (val) {
+ if (!this.workbook.getSmoothScrolling()) {
+ return val;
+ }
+
+ let x1 = this.getCellLeft(val);
+ let unitDeltaStep = this.getHScrollStep();
+ return x1 / unitDeltaStep;
+ };
+
+ WorksheetView.prototype._rowDiffToSmooth = function (from, to) {
+ if (!this.workbook.getSmoothScrolling()) {
+ return from - to;
+ }
+
+ let y1 = this.getCellTop(from);
+ let y2 = this.getCellTop(to);
+ let rowsHeight = y1 - y2;
+ let unitDeltaStep = this.getVScrollStep();
+ let res = rowsHeight / unitDeltaStep;
+ res = res < 0 ? res - this.getScrollCorrect() / unitDeltaStep : res + this.getScrollCorrect() / unitDeltaStep;
+
+ return res;
+ };
+
+ WorksheetView.prototype._rowToSmooth = function (val) {
+ if (!this.workbook.getSmoothScrolling()) {
+ return val;
+ }
+
+ let y1 = this.getCellTop(val);
+ let unitDeltaStep = this.getVScrollStep();
+ return y1 / unitDeltaStep;
+ };
+
WorksheetView.prototype.getSelectionRangeValue = function (absName, addSheet) {
return this.getSelectionRangeValues(absName, addSheet).join(AscCommon.FormulaSeparators.functionArgumentSeparator);
};
@@ -12014,13 +13299,20 @@
var xL = this._getColLeft(col);
var yL = this._getRowTop(row);
// Пересчитываем X и Y относительно видимой области
- xL -= (this._getColLeft(vrCol) - this.cellsLeft);
- yL -= (this._getRowTop(vrRow) - this.cellsTop);
+ xL -= (this._getOffsetX(vrCol));
+ yL -= (this._getOffsetY(vrRow));
// Пересчитываем X и Y относительно закрепленной области
xL += offsetX;
yL += offsetY;
+ if (this.getRightToLeft()) {
+ xL = this.getCtxWidth() - xL;
+ }
+
var width = this._getColumnWidth(col);
+ if (this.getRightToLeft()) {
+ width = -width;
+ }
var height = this._getRowHeight(row);
if ( AscBrowser.isCustomScaling() ) {
@@ -12074,7 +13366,7 @@
window['AscCommon'].g_specialPasteHelper.SpecialPasteButton_Update_Position();
};
- WorksheetView.prototype.setSelection = function (range) {
+ WorksheetView.prototype.setSelection = function (range, onlyCells) {
if (!Array.isArray(range)) {
range = [AscCommonExcel.Range.prototype.createFromBBox(this.model, range)];
}
@@ -12100,7 +13392,7 @@
this.model.selectionRange.update();
}
- this._fixSelectionOfMergedCells();
+ this._fixSelectionOfMergedCells(null, onlyCells);
this.updateSelectionWithSparklines();
this._updateSelectionNameAndInfo();
@@ -12269,7 +13561,7 @@
// Не попали в выделение (меняем первую точку)
this.cleanSelection();
this.model.selectionRange.clean();
- this.setSelection(range);
+ this.setSelection(range, true);
this._drawSelection();
this._updateSelectionNameAndInfo();
@@ -12649,10 +13941,10 @@
var ar = table ? table.Ref.clone() : this.model.getSelection().getLast().clone(true);
// Получаем координаты левого верхнего угла выделения
- var xL = this._getColLeft(ar.c1);
+ var xL = this._getColLeft(ar.c1, true);
var yL = this._getRowTop(ar.r1);
// Получаем координаты правого нижнего угла выделения
- var xR = this._getColLeft(ar.c2 + 1);
+ var xR = this._getColLeft(ar.c2 + 1, true);
var yR = this._getRowTop(ar.r2 + 1);
// range для пересчета видимой области
@@ -12669,7 +13961,7 @@
var dRow;
// Пересчитываем X и Y относительно видимой области
- x += (this._getColLeft(this.visibleRange.c1) - this.cellsLeft);
+ x += (this._getColLeft(this.visibleRange.c1, true) - this.cellsLeft);
y += (this._getRowTop(this.visibleRange.r1) - this.cellsTop);
// Вычисляем расстояние от (x, y) до (xL, yL)
@@ -13934,8 +15226,16 @@
}
if (shiftMove) {
- arnFrom = lastSelection;
arnTo = t.model.selectionRange.getLast().clone();
+ if (lastSelection.getType() === c_oAscSelectionType.RangeCol && lastSelection.c1 > arnTo.c1) {
+ let diff = arnFrom.c2 - arnFrom.c1 + 1;
+ arnFrom = new asc_Range(lastSelection.c1 + diff, lastSelection.r1, lastSelection.c2 + diff, lastSelection.r2);
+ } else if (lastSelection.getType() === c_oAscSelectionType.RangeRow && lastSelection.r1 > arnTo.r1) {
+ let diff = arnFrom.r2 - arnFrom.r1 + 1;
+ arnFrom = new asc_Range(lastSelection.c1, lastSelection.r1 + diff, lastSelection.c2, lastSelection.r2 + diff);
+ } else {
+ arnFrom = lastSelection;
+ }
}
//***array-formula***
@@ -13986,11 +15286,13 @@
t.model.selectionRange.getLast().assign(lastSelection.c1, rowStart, lastSelection.c2, rowEnd);
}
- if (colByX != null || rowByY != null) {
+ if (t.model.selectionRange.getLast().isEqual(lastSelection) !== true &&(colByX != null || rowByY != null)) {
History.Create_NewPoint();
History.StartTransaction();
- let insProp = colByX ? c_oAscInsertOptions.InsertCellsAndShiftRight : c_oAscInsertOptions.InsertCellsAndShiftDown;
+ let insProp = null != colByX ? c_oAscInsertOptions.InsertCellsAndShiftRight : c_oAscInsertOptions.InsertCellsAndShiftDown;
this.changeWorksheet("insCell", insProp, doMove, true);
+ } else {
+ this._cleanSelectionMoveRange();
}
} else {
doMove(true);
@@ -14261,18 +15563,19 @@
return;
}
- var t = this;
- var checkRange = [];
- var activeCell = this.model.selectionRange.activeCell.clone();
- var arn = this.model.selectionRange.getLast().clone(true);
+ const t = this;
+ const ws = t.model;
+ let checkRange = [];
+ let activeCell = this.model.selectionRange.activeCell.clone();
+ let arn = this.model.selectionRange.getLast().clone(true);
- var revertSelection = function () {
+ const revertSelection = function () {
if (val.originalSelectBeforePaste && val.originalSelectBeforePaste.ranges) {
t.model.selectionRange.ranges = val.originalSelectBeforePaste.ranges;
}
};
- var onSelectionCallback = function (isSuccess) {
+ const onSelectionCallback = function (isSuccess) {
if (false === isSuccess) {
AscCommonExcel.g_clipboardExcel.pasteProcessor.pasteCallBack = null;
return;
@@ -14302,7 +15605,7 @@
return border;
}
- var checkIndent = function (_range) {
+ const checkIndent = function (_range) {
if (_range) {
var _align = _range.getAlign();
if (_align && _align.getIndent && 0 != _align.getIndent()) {
@@ -14312,6 +15615,7 @@
return false;
};
+
History.Create_NewPoint();
History.StartTransaction();
@@ -14528,7 +15832,39 @@
t.handlers.trigger("slowOperation", true);
}
/* отключаем отрисовку на случай необходимости пересчета ячеек, заносим ячейку, при необходимости в список перерисовываемых */
+
t.model.workbook.dependencyFormulas.lockRecal();
+
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ //***dynamic array-formula***
+ let changedDynamicArraysList;
+ // checking affected arrays only for cases of deleting values in cells
+ if (val === c_oAscCleanOptions.All || val === c_oAscCleanOptions.Text || val === c_oAscCleanOptions.Formula) {
+ changedDynamicArraysList = ws.getChangedArrayList();
+ if (changedDynamicArraysList) {
+ // go through changed dynamic arrays, and delete all|partitional values?
+ for (let array in changedDynamicArraysList) {
+ let arrayData = changedDynamicArraysList[array];
+ let formula = arrayData.formula;
+ let dynamicbbox = arrayData.range;
+ let range = (formula && formula.aca && formula.ca) ? t.model.getRange3(dynamicbbox.r1, dynamicbbox.c1, dynamicbbox.r1, dynamicbbox.c1) : t.model.getRange3(dynamicbbox.r1, dynamicbbox.c1, dynamicbbox.r2, dynamicbbox.c2);
+ // todo create clear function for cells (clearRange?)
+ if (arrayData.doDelete) {
+ // delete all cells
+ range.cleanText();
+ let listenerId = arrayData.formula && arrayData.formula.getListenerId();
+ // remove from volatilate listeners
+ ws.workbook.dependencyFormulas.endListeningVolatileArray(listenerId);
+ } else if (arrayData.doRecalc) {
+ // delete all cells except the first one
+ range.cleanTextExceptFirst();
+ ws.workbook.dependencyFormulas.addToVolatileArrays(formula);
+ }
+ }
+ ws.clearChangedArrayList();
+ }
+ }
+ }
switch(val) {
case c_oAscCleanOptions.All:
@@ -14563,6 +15899,10 @@
break;
}
+ // recalculate all volatile arrays on page
+ t.model.recalculateVolatileArrays();
+
+
t.model.excludeHiddenRows(false);
// Если нужно удалить автофильтры - удаляем
@@ -14736,11 +16076,8 @@
return false;
}
- for (var j = 0; j < checkPasteRange.length; j++) {
- var _checkRange = checkPasteRange[j];
- /*if () {
-
- }*/
+ for (let j = 0; j < checkPasteRange.length; j++) {
+ let _checkRange = checkPasteRange[j];
if (this.intersectionFormulaArray(_checkRange)) {
t.handlers.trigger("onErrorEvent", c_oAscError.ID.CannotChangeFormulaArray, c_oAscError.Level.NoCritical);
revertSelection();
@@ -15178,6 +16515,25 @@
} else if (AscCH.historyitem_Worksheet_SetShowFormulas === type) {
t.model.setShowFormulas(val);
fullUpdate = true;
+ } else if (AscCH.historyitem_Worksheet_SetRightToLeft === type) {
+ t.model.setRightToLeft(val);
+ t.workbook.checkScrollRtl(val);
+ if (t.objectRender) {
+ t.objectRender.updateDrawingsTransform({target: c_oTargetType.ColumnResize, col: 0});
+ let drawings = t.objectRender.controller.getDrawingObjects();
+ for (var i = 0; i < drawings.length; ++i) {
+ if (!drawings[i].group) {
+ AscFormat.CheckSpPrXfrm3(drawings[i], true);
+ } else {
+ AscFormat.CheckSpPrXfrm(drawings[i], true);
+ }
+ }
+ t.objectRender.controller.recalculate(true);
+ }
+ t.model.workbook.handlers.trigger("asc_onHideMathTrack");
+ t.model.workbook.handlers.trigger("asc_onHideSpecialPasteOptions");
+ t.model.workbook.handlers.trigger("asc_onHideComment");
+ fullUpdate = true;
} else {
t.model.setDisplayGridlines(val);
}
@@ -15188,7 +16544,11 @@
}
};
- this._isLockedAll(onChangeSheetViewSettings);
+ if (AscCH.historyitem_Worksheet_SetRightToLeft === type) {
+ onChangeSheetViewSettings(true);
+ } else {
+ this._isLockedAll(onChangeSheetViewSettings);
+ }
};
WorksheetView.prototype.changeWorksheet = function (prop, val, callback, lockDraw) {
@@ -16765,19 +18125,23 @@
};
WorksheetView.prototype._saveCellValueAfterEdit = function (c, val, flags, isNotHistory, lockDraw) {
- var bbox = c.bbox;
- var t = this;
+ const t = this;
+ const ws = t.model
+ let bbox = c.bbox;
- var ctrlKey = flags && flags.ctrlKey;
- var shiftKey = flags && flags.shiftKey;
- var applyByArray = ctrlKey && shiftKey;
+ let ctrlKey = flags && flags.ctrlKey;
+ let shiftKey = flags && flags.shiftKey;
+ let applyByArray = ctrlKey && shiftKey;
//t.model.workbook.dependencyFormulas.lockRecal();
+ let arrayCannotExpand; // flag, needed to avoid selecting the entire expected dynamic range in situations where the array cannot open
+
//***array-formula***
- var changeRangesIfArrayFormula = function() {
+ const changeRangesIfArrayFormula = function() {
if(ctrlKey) {
//TODO есть баг с тем, что не лочатся все ячейки при данном действии
- c = t.getSelectedRange();
+ // c = dynamicSelectionRange && !arrayCannotExpand ? t._getRange(dynamicSelectionRange.c1, dynamicSelectionRange.r1, dynamicSelectionRange.c2, dynamicSelectionRange.r2) : t.getSelectedRange();
+ c = dynamicSelectionRange ? t._getRange(dynamicSelectionRange.c1, dynamicSelectionRange.r1, dynamicSelectionRange.c2, dynamicSelectionRange.r2) : t.getSelectedRange();
var isAllColumnSelect = c && c.bbox && (c.bbox.getType() === c_oAscSelectionType.RangeMax || c.bbox.getType() === c_oAscSelectionType.RangeCol);
if(c.bbox.isOneCell()) {
//проверяем, есть ли формула массива в этой ячейке
@@ -16813,14 +18177,21 @@
return;
}
bbox = c.bbox;
+
+ // set selection if dynamic arrays are used
+ if (dynamicSelectionRange) {
+ ws.copySelection && ws.copySelection.assign2(bbox);
+ }
}
};
- var isFormula = this._isFormula(val);
- var newFP, parseResult;
+ let dynamicSelectionRange = null;
+ let isFormula = this._isFormula(val);
+ let newFP, parseResult;
if (isFormula) {
+ let calculateResult = new AscCommonExcel.CalculateResult(true);
//перед созданием точки в истории, проверяю, валидная ли формула
- var cellWithFormula = new AscCommonExcel.CCellWithFormula(this.model, bbox.r1, bbox.c1);
+ let cellWithFormula = new AscCommonExcel.CCellWithFormula(this.model, bbox.r1, bbox.c1);
newFP = new AscCommonExcel.parserFormula(val[0].getFragmentText().substring(1), cellWithFormula, this.model);
parseResult = new AscCommonExcel.ParseResult();
if (!newFP.parse(AscCommonExcel.oFormulaLocaleInfo.Parse, AscCommonExcel.oFormulaLocaleInfo.DigitSep, parseResult)) {
@@ -16828,6 +18199,59 @@
this.model.workbook.handlers.trigger("asc_onError", parseResult.error, c_oAscError.Level.NoCritical);
return;
}
+ } else {
+
+ if (!applyByArray && AscCommonExcel.bIsSupportDynamicArrays) {
+ /* if we write not through cse, then check the formula for the presence of ref */
+ /* if ref exists, write the formula as an array formula and also find its dimensions for further expansion */
+
+ let isRef = newFP.findRefByOutStack();
+ if (isRef) {
+ // if formula has ref, calculate it to get the final size of ref
+ let formulaRes = newFP.calculate(null, null, null, null, calculateResult);
+ applyByArray = true;
+ ctrlKey = true;
+
+ if ((newFP.aca && newFP.ca)) {
+ // array cannot expand
+ // set ref to the first(parent) cell
+ arrayCannotExpand = true;
+ dynamicSelectionRange = new Asc.Range(newFP.parent.nCol, newFP.parent.nRow, newFP.parent.nCol, newFP.parent.nRow);
+ t.model.workbook.dependencyFormulas.addToVolatileArrays(newFP);
+ } else {
+ let dimension = formulaRes.getDimensions();
+ dynamicSelectionRange = new Asc.Range(newFP.parent.nCol, newFP.parent.nRow, newFP.parent.nCol + dimension.col - 1, newFP.parent.nRow + dimension.row - 1);
+ }
+ } else if (newFP.ref) {
+ applyByArray = true;
+ ctrlKey = true;
+ dynamicSelectionRange = newFP.ref;
+ }
+ } else if (!applyByArray && !ctrlKey) {
+ // TODO ctrlKey+enter used to fills the selected cell range with the current entry. Dynamic arrays will have to work the same
+ // refInfo = {cannoChangeFormulaArray: true|false, applyByArray: true|false, ctrlKey: true|false, dynamicRange: range}
+
+ let canAutoExpand = newFP.findRefByOutStack(true);
+ let refInfo = canAutoExpand ? ws.getRefDynamicInfo(newFP, calculateResult) : false;
+ if (refInfo) {
+ if (refInfo.cannotChangeFormulaArray) {
+ t.handlers.trigger("onErrorEvent", c_oAscError.ID.CannotChangeFormulaArray,
+ c_oAscError.Level.NoCritical);
+ return false;
+ }
+
+ applyByArray = refInfo.applyByArray;
+ ctrlKey = refInfo.ctrlKey;
+ dynamicSelectionRange = refInfo.dynamicRange;
+ }
+ }
+
+ // preliminary calculation of the formula
+ // if calculateResult.error is not empty - return this error
+ if (calculateResult && calculateResult.error != null) {
+ this.model.workbook.handlers.trigger("asc_onError", calculateResult.error, c_oAscError.Level.NoCritical);
+ return false;
+ }
}
}
@@ -16836,11 +18260,15 @@
History.StartTransaction();
}
+ // if there is a formula use setValue, otherwise setValue2
if (isFormula) {
// ToDo - при вводе формулы в заголовок автофильтра надо писать "0"
//***array-formula***
- var ret = true;
+ let ret = true;
changeRangesIfArrayFormula();
+
+ //***dynamic array-formula***
+ let changedDynamicArraysList = AscCommonExcel.bIsSupportDynamicArrays ? ws.getChangedArrayList() : null;
if(ctrlKey) {
this.model.workbook.dependencyFormulas.lockRecal();
}
@@ -16850,10 +18278,40 @@
t.model.workbook.addExternalReferencesAfterParseFormulas(parseResult.externalReferenesNeedAdd);
}
+ // before putting a value in the selected cell, need to check whether the given range concerns any of the arrays (daf) on the page
+ // collect a list of all affected arrays and go through each of them
+ // if the main cell was affected, then need to clear the entire array (we will also need to update the DepGraph dependency list)
+ // if the main cell has NOT been affected, we need to execute cell.setValue("") or Range.setValue("") for all child cells of the array, and set the aca=true flag for the main cell
+ if (changedDynamicArraysList) {
+ for (let array in changedDynamicArraysList) {
+ let arrayData = changedDynamicArraysList[array];
+ let formula = arrayData.formula;
+ let dynamicbbox = arrayData.range;
+ let range = (formula && formula.aca && formula.ca) ? t.model.getRange3(dynamicbbox.r1, dynamicbbox.c1, dynamicbbox.r1, dynamicbbox.c1) : t.model.getRange3(dynamicbbox.r1, dynamicbbox.c1, dynamicbbox.r2, dynamicbbox.c2);
+ if (arrayData.doDelete) {
+ // delete all cells
+ range.cleanText();
+
+ // remove listener
+ let listenerId = arrayData.formula && arrayData.formula.getListenerId();
+ ws.workbook.dependencyFormulas.endListeningVolatileArray(listenerId);
+ } else if (arrayData.doRecalc) {
+ // delete all cells except the first one
+ range.cleanTextExceptFirst();
+ // add to volatile
+ ws.workbook.dependencyFormulas.addToVolatileArrays(formula);
+ }
+ }
+ ws.clearChangedArrayList();
+ }
+ // set the value to the selected range
c.setValue(AscCommonExcel.getFragmentsText(val), function (r) {
ret = r;
- }, null, applyByArray ? bbox : ((!applyByArray && ctrlKey) ? null : undefined));
+ }, null, applyByArray ? bbox : ((!applyByArray && ctrlKey) ? null : undefined), null, AscCommonExcel.bIsSupportDynamicArrays ? dynamicSelectionRange : null);
+
+ // recalc all volatile arrays on page
+ t.model.recalculateVolatileArrays();
//***array-formula***
if(ctrlKey) {
@@ -16866,6 +18324,7 @@
return false;
}
+ // todo Add to history UndoRedo DynamicArray and add to AscCH historyitem_DynamicArrayFormula_AddFormula
//***array-formula***
if(applyByArray) {
History.Add(AscCommonExcel.g_oUndoRedoArrayFormula, AscCH.historyitem_ArrayFromula_AddFormula, this.model.getId(),
@@ -16877,8 +18336,43 @@
} else {
//***array-formula***
changeRangesIfArrayFormula();
+
+ if (AscCommonExcel.bIsSupportDynamicArrays) {
+ //***dynamic array-formula***
+ let changedDynamicArraysList = ws.getChangedArrayList();
+ if (changedDynamicArraysList) {
+ // go through changed dynamic arrays, and delete all|partitional values?
+ for (let array in changedDynamicArraysList) {
+ let arrayData = changedDynamicArraysList[array];
+ let formula = arrayData.formula;
+ let dynamicbbox = arrayData.range;
+ let range = (formula && formula.aca && formula.ca) ? t.model.getRange3(dynamicbbox.r1, dynamicbbox.c1, dynamicbbox.r1, dynamicbbox.c1) : t.model.getRange3(dynamicbbox.r1, dynamicbbox.c1, dynamicbbox.r2, dynamicbbox.c2);
+ // todo create clear function for cells (clearRange?)
+ if (arrayData.doDelete) {
+ // delete all cells
+ range.cleanText();
+
+ // remove listener
+ let listenerId = arrayData.formula && arrayData.formula.getListenerId();
+ ws.workbook.dependencyFormulas.endListeningVolatileArray(listenerId);
+ } else if (arrayData.doRecalc) {
+ // delete all cells except the first one
+ range.cleanTextExceptFirst();
+ // add to volatile
+ ws.workbook.dependencyFormulas.addToVolatileArrays(formula);
+ }
+ }
+
+ ws.clearChangedArrayList();
+ }
+ }
+
+ // set the value to the selected range
c.setValue2(val, true);
+ // recalculate all volatile arrays on page
+ t.model.recalculateVolatileArrays();
+
// Вызываем функцию пересчета для заголовков форматированной таблицы
this.model.checkChangeTablesContent(bbox);
}
@@ -16945,20 +18439,27 @@
var rFrozen = t.topLeftFrozenCell.getRow0();
if (0 < cFrozen) {
if (col >= cFrozen) {
- offsetX = t._getColLeft(cFrozen) - t._getColLeft(0);
+ offsetX = t._getColLeft(cFrozen) - t._getColLeft(0) - t.getHorizontalScrollCorrect();
} else {
vr.c1 = 0;
vr.c2 = cFrozen - 1;
}
+ } else {
+ offsetX -= t.getHorizontalScrollCorrect();
}
if (0 < rFrozen) {
if (row >= rFrozen) {
- offsetY = t._getRowTop(rFrozen) - t._getRowTop(0);
+ offsetY = t._getRowTop(rFrozen) - t._getRowTop(0) - t.getScrollCorrect();
} else {
vr.r1 = 0;
vr.r2 = rFrozen - 1;
}
+ } else {
+ offsetY -= t.getScrollCorrect();
}
+ } else {
+ offsetX -= t.getHorizontalScrollCorrect();
+ offsetY -= t.getScrollCorrect();
}
return {vr: vr, offsetX: offsetX, offsetY: offsetY};
}
@@ -16966,6 +18467,14 @@
col = cell.col;
row = cell.row;
+ //TODO need only 1 redraw
+ if (row === t.visibleRange.r1) {
+ this.setScrollCorrect(0, true);
+ }
+ if (col === t.visibleRange.c1) {
+ this.setHorizontalScrollCorrect(0, true);
+ }
+
// Возможно стоит заменить на ячейку из кеша
c = this._getVisibleCell(col, row);
fl = this._getCellFlags(c);
@@ -16975,13 +18484,27 @@
c = this._getVisibleCell(mc.c1, mc.r1);
fl = this._getCellFlags(c);
}
+
+ if (this.getRightToLeft() && col === 0) {
+ fl.wrapText = true;
+ }
+
var align = c.getAlign();
var indent = align && align.indent;
if (AscCommon.align_Distributed === fl.textAlign) {
fl.textAlign = AscCommon.align_Center;
}
- this.handlers.trigger("onScroll", this._calcActiveCellOffset());
+ let offset = this._calcActiveCellOffset();
+ if (this.topLeftFrozenCell) {
+ if (col < this.topLeftFrozenCell.getCol0()) {
+ offset.col = 0;
+ }
+ if (row < this.topLeftFrozenCell.getRow0()) {
+ offset.row = 0;
+ }
+ }
+ this.handlers.trigger("onScroll", offset);
bg = c.getFillColor();
@@ -17107,7 +18630,8 @@
}
//***array-formula***
- var ref = null;
+ let ref = null;
+ let isDynamicRef = null;
if (flags.ctrlKey && flags.shiftKey) {
//необходимо проверить на выделение массива частично
var activeRange = t.getSelectedRange();
@@ -17146,14 +18670,38 @@
t._isLockedCells(lockedRange, /*subType*/null, saveCellValueCallback);
}
} else {
- //проверяем activeCell на наличие форулы массива
+ // check activeCell for the presence of an array formula
c._foreachNoEmpty(function (cell) {
- ref = cell.formulaParsed && cell.formulaParsed.ref ? cell.formulaParsed.ref : null;
+ if (cell) {
+ let formula = cell.formulaParsed;
+ let arrayFormulaRef = formula && formula.getArrayFormulaRef();
+ let dynamicRange = formula && formula.getDynamicRef();
+
+ ref = formula && arrayFormulaRef ? arrayFormulaRef : null;
+ isDynamicRef = formula && dynamicRange ? true : null;
+
+ if (isDynamicRef && AscCommonExcel.bIsSupportDynamicArrays) {
+ let name = dynamicRange.getName(AscCommonExcel.referenceType.R);
+ let arrayInfo = {range: dynamicRange, doDelete: false, doRecalc: true, formula: formula};
+
+ // check this cell. If this is the first cell of dynamic range, delete this range, else delete all elements except the first
+ if (cell.nRow === dynamicRange.r1 && cell.nCol === dynamicRange.c1) {
+ arrayInfo.doRecalc = false
+ arrayInfo.doDelete = true
+ }
+
+ t.model.addChangedArray(name, arrayInfo);
+ }
+ }
});
if (ref && !ref.isOneCell()) {
- t.handlers.trigger("onErrorEvent", c_oAscError.ID.CannotChangeFormulaArray,
+ if (isDynamicRef && AscCommonExcel.bIsSupportDynamicArrays) {
+ return saveCellValueCallback(true);
+ } else {
+ t.handlers.trigger("onErrorEvent", c_oAscError.ID.CannotChangeFormulaArray,
c_oAscError.Level.NoCritical);
- return false;
+ return false;
+ }
} else {
return saveCellValueCallback(true);
}
@@ -17161,9 +18709,10 @@
},
getSides: function () {
var _c1, _r1, _c2, _r2, ri = 0, bi = 0;
+ let isRtl = t.getRightToLeft();
if (isMerged) {
- _c1 = mc.c1;
- _c2 = mc.c2;
+ _c1 = isRtl ? mc.c2 : mc.c1;
+ _c2 = isRtl ? mc.c1 : mc.c2;
_r1 = mc.r1;
_r2 = mc.r2;
} else {
@@ -17173,29 +18722,55 @@
var vro = getVisibleRangeObject();
var i, w, h, arrLeftS = [], arrRightS = [], arrBottomS = [];
var offsX = t._getColLeft(vro.vr.c1) - t._getColLeft(0) - vro.offsetX;
+ if (isRtl) {
+ offsX = -offsX;
+ }
var offsY = t._getRowTop(vro.vr.r1) - t._getRowTop(0) - vro.offsetY;
- var cellX = t._getColLeft(_c1) - offsX, cellY = t._getRowTop(_r1) - offsY;
+ var cellX = t._getColLeft(_c1, true) - offsX, cellY = t._getRowTop(_r1) - offsY;
var _left = cellX;
- for (i = _c1; i >= vro.vr.c1; --i) {
- w = t._getColumnWidth(i);
- if (0 < w) {
- arrLeftS.push(_left);
+ if (isRtl) {
+ for (i = _c1; i >= vro.vr.c1; --i) {
+ w = t._getColumnWidth(i);
+ if (0 < w) {
+ arrLeftS.push(_left);
+ }
+ _left -= w;
+ }
+ } else {
+ for (i = _c1; i <= vro.vr.c2; ++i) {
+ w = t._getColumnWidth(i);
+ if (0 < w) {
+ arrLeftS.push(_left);
+ }
+ _left -= w;
}
- _left -= w;
}
if (_c2 > vro.vr.c2) {
_c2 = vro.vr.c2;
}
_left = cellX;
- for (i = _c1; i <= vro.vr.c2; ++i) {
- w = t._getColumnWidth(i);
- _left += w;
- if (0 < w) {
- arrRightS.push(_left);
+ if (isRtl) {
+ for (i = _c1; i >= vro.vr.c1; --i) {
+ w = t._getColumnWidth(i);
+ _left += w;
+ if (0 < w) {
+ arrRightS.push(_left);
+ }
+ if (_c2 === i) {
+ ri = arrRightS.length - 1;
+ }
}
- if (_c2 === i) {
- ri = arrRightS.length - 1;
+ } else {
+ for (i = _c1; i <= vro.vr.c2; ++i) {
+ w = t._getColumnWidth(i);
+ _left += w;
+ if (0 < w) {
+ arrRightS.push(_left);
+ }
+ if (_c2 === i) {
+ ri = arrRightS.length - 1;
+ }
}
}
w = t.drawingCtx.getWidth();
@@ -17305,6 +18880,12 @@
}
this.handlers.trigger("onDocumentPlaceChanged");
+ } else {
+ //for example, after change size we must recalculate drawings offset(right-to-left mode)
+ //todo need review
+ if (this.getRightToLeft() && this.objectRender) {
+ this.objectRender.updateDrawingsTransform({target: c_oTargetType.RowResize, row: 0});
+ }
}
this._updateColumnPositions();
@@ -17487,6 +19068,7 @@
}
}
+ let isTable = !!styleName;
var checkFilterRange = filterInfo ? filterInfo.rangeWithoutDiff : filterRange;
if (t._checkAddAutoFilter(checkFilterRange, styleName, addFormatTableOptionsObj) === true) {
@@ -17499,7 +19081,7 @@
};
var oRange = this.model.getRange3(checkFilterRange.r1, checkFilterRange.c1, checkFilterRange.r1, checkFilterRange.c2);
- if (!addNameColumn && oRange.isFormulaContains()) {
+ if (!addNameColumn && isTable && oRange.isFormulaContains()) {
this.model.workbook.handlers.trigger("asc_onConfirmAction", Asc.c_oAscConfirm.ConfirmReplaceFormulaInTable,
function (can) {
if (can) {
@@ -18296,6 +19878,8 @@
return false;
}
+ offsetX -= this.getRightToLeftOffset();
+
var drawCurrentFilterButtons = function (filter) {
var autoFilter = filter.isAutoFilter() ? filter : filter.AutoFilter;
@@ -18367,7 +19951,7 @@
continue;
}
- t.af_drawCurrentButton(offsetX, offsetY, {isSortState: isSortState, isSetFilter: isSetFilter, row: row, col: col});
+ t.af_drawCurrentButton(offsetX - t.getRightToLeftOffset(), offsetY, {isSortState: isSortState, isSetFilter: isSetFilter, row: row, col: col});
}
}
}
@@ -18427,8 +20011,16 @@
var ctx = props.isOverlay ? this.overlayCtx : this.drawingCtx;
var isDataValidation = props.isOverlay;
+ let isClip = null;
+ if (!isDataValidation && this._clipDrawingRect(ctx, new Asc.Range(props.col, props.row, props.col, props.row), clipType.range)) {
+ isClip = true;
+ }
+
if (props.idPivotCollapse) {
this._drawPivotCollapseButton(offsetX, offsetY, props);
+ if (isClip) {
+ ctx.RemoveClipRect();
+ }
return;
}
@@ -18649,6 +20241,10 @@
scaleIndex *= this.getRetinaPixelRatio();
_drawButton(x1 + diffX, y1 + diffY);
+
+ if (isClip) {
+ ctx.RemoveClipRect();
+ }
};
@@ -20151,6 +21747,51 @@
});
return res;
};
+ WorksheetView.prototype.intersectionFormulaArray2 = function(range, notCheckContains, checkOneCellArray) {
+ const t = this;
+ const ws = this.model;
+ //checkOneCellArray - ф/т можно добавить поверх формулы массива, которая содержит 1 ячейку, если более - то ошибка
+ //notCheckContains - ф/т нельзя добавить, если мы пересекаемся или содержим ф/т
+ // this function, in addition to checking cse formulas, checks dynamic arrays and fills in the list of changed arrays
+
+ let res = false;
+ for (let row = range.r1; row <= range.r2; row++) {
+ for (let col = range.c1; col <= range.c2; col++) {
+ if (res) {
+ return res;
+ }
+
+ ws._getCell(row, col, function(cell) {
+ if(cell.isFormula()) {
+ let formulaParsed = cell.getFormulaParsed();
+ let arrayFormulaRef = formulaParsed.getArrayFormulaRef();
+ let dynamicRange = formulaParsed.getDynamicRef();
+
+ if (arrayFormulaRef && dynamicRange) {
+ let name = dynamicRange.getName(AscCommonExcel.referenceType.R);
+ let arrayInfo = {range: dynamicRange, doDelete: false, doRecalc: true, formula: formulaParsed};
+
+ // check this cell. If this is the first cell of dynamic range, delete this range, else delete all elements except the first
+ if (cell.nRow === dynamicRange.r1 && cell.nCol === dynamicRange.c1) {
+ arrayInfo.doRecalc = false
+ arrayInfo.doDelete = true
+ }
+
+ ws.addChangedArray(name, arrayInfo);
+ } else if(arrayFormulaRef && (!checkOneCellArray || (checkOneCellArray && !arrayFormulaRef.isOneCell()))) {
+ if(notCheckContains) {
+ res = true;
+ } else if(!notCheckContains && !range.containsRange(arrayFormulaRef)){
+ res = true;
+ }
+ }
+ }
+ });
+
+ }
+ }
+ return res;
+ };
// Convert coordinates methods
WorksheetView.prototype.ConvertXYToLogic = function (x, y) {
@@ -21141,8 +22782,8 @@
this._drawGroupDataMenu(drawingCtx, bCol);
var ctx = drawingCtx || this.drawingCtx;
- var offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
- var offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ var offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getOffsetX();
+ var offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getOffsetY();
if (!drawingCtx && this.topLeftFrozenCell) {
if (undefined === leftFieldInPx) {
var cFrozen = this.topLeftFrozenCell.getCol0();
@@ -21154,6 +22795,11 @@
}
}
+ let isClip = null;
+ if (this._clipDrawingRect(ctx, range, bCol ? clipType.groupCols : clipType.groupRows)) {
+ isClip = true;
+ }
+
var zoom = this.getZoom();
if(zoom > 1) {
zoom = 1;
@@ -21416,13 +23062,13 @@
var collasedEndCol = this._getGroupCollapsed(arrayLines[i][j].end + 1);
//var collasedEndCol = rowLevelMap[arrayLines[i][j].end + 1] && rowLevelMap[arrayLines[i][j].end + 1].collapsed;
if(!collasedEndCol) {
- ctx.lineVerPrevPx(posX, startPos, endPos + paddingTop);
+ ctx.lineVerPrevPx(posX - this.getRightToLeftOffset(), startPos, endPos + paddingTop);
}
// _
//|
if(!collasedEndCol && startY === arrayLines[i][j].start) {
- ctx.lineHorPrevPx(posX - lineWidthDiff + thickLineDiff, startPos, posX + 4*padding);
+ ctx.lineHorPrevPx(posX - lineWidthDiff + thickLineDiff + this.getRightToLeftOffset(), startPos, posX + 4*padding + this.getRightToLeftOffset());
}
} else {
if(endPosArr[arrayLines[i][j].start]) {
@@ -21498,6 +23144,9 @@
ctx.closePath();
}
+ if (isClip) {
+ ctx.RemoveClipRect();
+ }
this._drawGroupDataButtons(drawingCtx, buttons, leftFieldInPx, topFieldInPx, bCol);
};
@@ -21521,7 +23170,7 @@
var offsetX = 0, offsetY = 0;
if(bCol) {
- offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+ offsetX = (undefined !== leftFieldInPx) ? leftFieldInPx : this._getOffsetX();
if (!drawingCtx && this.topLeftFrozenCell) {
if (undefined === leftFieldInPx) {
var cFrozen = this.topLeftFrozenCell.getCol0();
@@ -21529,7 +23178,7 @@
}
}
} else {
- offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ offsetY = (undefined !== topFieldInPx) ? topFieldInPx : this._getOffsetY();
if (!drawingCtx && this.topLeftFrozenCell) {
if (undefined === topFieldInPx) {
var rFrozen = this.topLeftFrozenCell.getRow0();
@@ -21558,14 +23207,14 @@
x = x - offsetX;
y = y - offsetY;
- ctx.AddClipRect(bCol ? pos.pos - borderSize - offsetX : x - borderSize, bCol ? y - borderSize : pos.pos - borderSize - offsetY, bCol ? pos.size + borderSize : w + borderSize, bCol ? h + borderSize : pos.size + borderSize);
+ ctx.AddClipRect(bCol ? pos.pos - borderSize - offsetX : x - borderSize, bCol ? y - borderSize : pos.pos - borderSize - offsetY, bCol ? pos.size + borderSize : w + borderSize + this.getRightToLeftOffset(), bCol ? h + borderSize : pos.size + borderSize);
ctx.beginPath();
if(buttons[i].clean) {
ctx.clearRect(x, y, w, h);
}
- ctx.lineHorPrevPx(x, y, x + w);
+ ctx.lineHorPrevPx(x, y, x + w + this.getRightToLeftOffset());
ctx.lineHorPrevPx(x + w, y + h, x);
ctx.lineVerPrevPx(x + w, y, y + h);
ctx.lineVerPrevPx(x, y + h, y - borderSize);
@@ -21603,9 +23252,10 @@
if(w > sizeLine + 2) {
if(this._getGroupCollapsed(val, bCol)/*rowLevelMap[val] && rowLevelMap[val].collapsed*/) {
- ctx.lineHorPrevPx(x + paddingLine, y + h / 2 + 1, x + sizeLine + paddingLine);
- ctx.lineVerPrevPx(x + paddingLine + sizeLine / 2 + 1, y + h / 2 - sizeLine / 2, y + h / 2 + sizeLine / 2);
+ ctx.lineHorPrevPx(x + paddingLine + this.getRightToLeftOffset(), y + h / 2 + 1, x + sizeLine + paddingLine + this.getRightToLeftOffset());
+ ctx.lineVerPrevPx(x + paddingLine + sizeLine / 2 + 1 - this.getRightToLeftOffset(), y + h / 2 - sizeLine / 2, y + h / 2 + sizeLine / 2);
} else {
+ x += this.getRightToLeftOffset();
ctx.lineHorPrevPx(x + paddingLine, y + h / 2 + diff, x + sizeLine + paddingLine);
}
}
@@ -21784,7 +23434,9 @@
if(w > tm.width + 3) {
var diff = bActive ? 1 : 0;
- ctx.setFillStyle(st.color).fillText(text, x + w / 2 - tm.width / 2 + diff, y + Asc.round(tm.baseline) + h / 2 - tm.height / 2 + diff, undefined, sr.charWidths);
+ ctx.setFillStyle(st.color);
+
+ this._fillText(ctx, text, x + (this.getRightToLeft() ? w : w/2) - tm.width / 2 + diff, y + Asc.round(tm.baseline) + h / 2 - tm.height / 2 + diff, undefined, sr.charWidths);
}
ctx.stroke();
@@ -21909,14 +23561,14 @@
var t = this;
var bCol = c_oTargetType.GroupCol === target.target;
- var offsetX = /*(undefined !== leftFieldInPx) ? leftFieldInPx : */this._getColLeft(this.visibleRange.c1) - this.cellsLeft;
+ var offsetX = /*(undefined !== leftFieldInPx) ? leftFieldInPx : */this._getOffsetX();
if (/*!drawingCtx &&*/ this.topLeftFrozenCell) {
//if (undefined === leftFieldInPx) {
var cFrozen = this.topLeftFrozenCell.getCol0();
offsetX -= this._getColLeft(cFrozen) - this._getColLeft(0);
//}
}
- var offsetY = /*(undefined !== topFieldInPx) ? topFieldInPx : */this._getRowTop(this.visibleRange.r1) - this.cellsTop;
+ var offsetY = /*(undefined !== topFieldInPx) ? topFieldInPx : */this._getOffsetY();
if (/*!drawingCtx &&*/ this.topLeftFrozenCell) {
//if (undefined === topFieldInPx) {
var rFrozen = this.topLeftFrozenCell.getRow0();
@@ -22014,6 +23666,7 @@
if((arrayLines[i][j].end + 1 === target.row && !bCol) || (arrayLines[i][j].end + 1 === target.col && bCol)) {
props = t._getGroupDataButtonPos(arrayLines[i][j].end + 1, i, bCol);
collapsed = t._getGroupCollapsed(arrayLines[i][j].end + 1, bCol);/*levelMap[arrayLines[i][j].end + 1] && levelMap[arrayLines[i][j].end + 1].collapsed*/
+ x = t.checkRtl(x);
if(props) {
if(x >= props.x - offsetX && x <= props.x + props.w - offsetX && y >= props.y - offsetY && y <= props.y - offsetY + props.h) {
if(AscCommon.getPtrEvtName("up") === type) {
@@ -22088,6 +23741,8 @@
}
}
+ x = this.checkRtl(x);
+
//TODO для группировки колонок - y должен быть больше поля колонок
var bButtonClick = !bCol && x <= this.cellsLeft && this.groupWidth && x < this.groupWidth && y < this.cellsTop;
if(!bButtonClick) {
@@ -22109,10 +23764,10 @@
for(var i = 0; i <= groupArr.length; i++) {
props = this.getGroupDataMenuButPos(i, bCol);
if(x >= props.x && y >= props.y && x <= props.x + props.w && y <= props.y + props.h) {
- if("mouseup" === type) {
+ if("mouseup" === type || "pointerup" === type) {
this.hideGroupLevel(i + 1, bCol);
this.clickedGroupButton = null;
- } else if("mousedown" === type){
+ } else if("mousedown" === type || "pointerdown" === type){
this._drawGroupDataMenuButton(null, i, true, true, bCol);
this.clickedGroupButton = {level: i, bCol: bCol};
return true;
@@ -23498,19 +25153,33 @@
WorksheetView.prototype.rangeToRectAbs = function(oRange, units) {
var left = this.getCellLeft(0, units);
var top = this.getCellTop(0, units);
- var l = this.getCellLeft(oRange.c1, units) - left;
+ var l = this.checkRtl(this.getCellLeft(oRange.c1, units) - left, null, units);
var t = this.getCellTop(oRange.r1, units) - top;
- var r = this.getCellLeft(oRange.c2, units) + this.getColumnWidth(oRange.c2, units) - left;
+ var r = this.checkRtl(this.getCellLeft(oRange.c2, units) + this.getColumnWidth(oRange.c2, units) - left, null, units);
var b = this.getCellTop(oRange.r2, units) + this.getRowHeight(oRange.r2, units) - top;
- return new AscFormat.CGraphicBounds(l, t, r, b);
+
+ if (this.getRightToLeft()) {
+ let _r = r;
+ r = l;
+ l = _r;
+ }
+
+ return new AscFormat.CGraphicBounds(l - this.getRightToLeftOffset(), t, r, b);
};
- WorksheetView.prototype.rangeToRectRel = function(oRange, units) {
- var l = this.getCellLeftRelative(oRange.c1, units);
- var t = this.getCellTopRelative(oRange.r1, units);
- var r = this.getCellLeftRelative(oRange.c2, units) + this.getColumnWidth(oRange.c2, units);
+ WorksheetView.prototype.rangeToRectRel = function(oRange, units, checkFrozenArea) {
+ var l = this.checkRtl(this.getCellLeftRelative(oRange.c1, units, checkFrozenArea), null, units);
+ var t = this.getCellTopRelative(oRange.r1, units, checkFrozenArea);
+ var r = this.checkRtl(this.getCellLeftRelative(oRange.c2, units) + this.getColumnWidth(oRange.c2, units), null, units);
var b = this.getCellTopRelative(oRange.r2, units) + this.getRowHeight(oRange.r2, units);
- return new AscFormat.CGraphicBounds(l, t, r, b);
+
+ if (this.getRightToLeft()) {
+ let _r = r;
+ r = l;
+ l = _r;
+ }
+
+ return new AscFormat.CGraphicBounds(l - this.getRightToLeftOffset(), t, r, b);
};
//интерфейс
/*отдаём массив данных для интерефейса - beforeInsertSlicer
@@ -24491,12 +26160,18 @@
let needCalc = false;
if (fP) {
for (let i = 0; i < fP.outStack.length; i++) {
- if ((AscCommonExcel.cElementType.cellsRange3D === fP.outStack[i].type || AscCommonExcel.cElementType.cell3D === fP.outStack[i].type) && fP.outStack[i].externalLink) {
+ let type = fP.outStack[i].type;
+ if ((AscCommonExcel.cElementType.cellsRange3D === type || AscCommonExcel.cElementType.cell3D === type ||
+ AscCommonExcel.cElementType.name3D === type) && fP.outStack[i].externalLink) {
let eR = t.model.workbook.getExternalWorksheet(fP.outStack[i].externalLink);
if (eR) {
externalReferences.push(opt_get_only_ids ? eR.Id : eR.getAscLink());
if (initStructure) {
- eR.initRows(fP.outStack[i].getRange());
+ if (AscCommonExcel.cElementType.name3D === type) {
+ eR.initDefinedName(fP.outStack[i]);
+ } else {
+ eR.initRows(fP.outStack[i].getRange());
+ }
}
}
} else if (initStructure && fP.outStack[i].type === AscCommonExcel.cElementType.func && fP.outStack[i].name === "IMPORTRANGE") {
@@ -24719,7 +26394,7 @@
if (this.isPageBreakPreview(true)) {
this.model && this.model.PagePrintOptions && this.model.PagePrintOptions.initPrintTitles();
if (this.workbook && this.workbook.model && this.workbook.model.getActiveWs() === this.model) {
- this.draw();
+ this.draw(this.lockDraw);
}
}
};
@@ -25048,10 +26723,119 @@
WorksheetView.prototype.initRenderingSettings = function () {
this.renderingSettings = new CRenderingSettings();
+ return this.renderingSettings;
+ };
+
+ WorksheetView.prototype.getVScrollStep = function () {
+ let isMobileVersion = this.workbook && this.workbook.Api && this.workbook.Api.isMobileVersion;
+ return this.vScrollPxStep * this.getZoom() * (isMobileVersion ? this.getRetinaPixelRatio() : 1);
+ };
+
+ WorksheetView.prototype.getHScrollStep = function () {
+ return this.hScrollPxStep * this.getZoom() * this.getRetinaPixelRatio();
+ };
+
+ WorksheetView.prototype.checkRtl = function (x, ctx, units, checkOffsets) {
+ if (this.getRightToLeft()) {
+ let u = units >= 0 && units <= 3 ? units : 0;
+ let kf = asc_getcvt(0/*px*/, u, this._getPPIX());
+ if (!ctx) {
+ ctx = this.drawingCtx;
+ }
+ return this.getCtxWidth(ctx, checkOffsets) * kf - x;
+ }
+ return x;
+ };
+
+ WorksheetView.prototype.getRightToLeft = function () {
+ let sheetViewSettings = this.getSheetViewSettings(true);
+ return sheetViewSettings.rightToLeft;
+ };
+
+ WorksheetView.prototype.setRightToLeft = function (val) {
+ let sheetViewSettings = this.getSheetViewSettings(true);
+ sheetViewSettings.rightToLeft = val;
+ };
+
+ WorksheetView.prototype._startRtlRendering = function (ctx) {
+ if (!ctx) {
+ ctx = this.drawingCtx;
+ }
+ if (this.getRightToLeft()) {
+ let _transform = ctx.Transform ? ctx.Transform : new AscCommon.CMatrix();
+ let transformMatrix = _transform.CreateDublicate ? _transform.CreateDublicate() : _transform.clone();
+ ctx.setTransform(-1, transformMatrix.shy, transformMatrix.shx, transformMatrix.sy, this.getCtxWidth(ctx), transformMatrix.ty);
+
+ ctx.updateTransforms();
+ }
+ };
+
+ WorksheetView.prototype.getCtxWidth = function (ctx, checkOffsets) {
+ if (!ctx) {
+ ctx = this.drawingCtx;
+ }
+ let res;
+ let renderingSettings = this.getRenderingSettings();
+ if (renderingSettings && renderingSettings.getCtxWidth()) {
+ let offset = checkOffsets ? (renderingSettings.getPageLeftOffset() + renderingSettings.getPageLeftOffset()) : 0;
+ res = renderingSettings.getCtxWidth() - offset;
+ } else {
+ res = ctx.getWidth();
+ }
+ return res;
+ };
+
+ WorksheetView.prototype._endRtlRendering = function (ctx) {
+ if (!ctx) {
+ ctx = this.drawingCtx;
+ }
+ if (this.getRightToLeft()) {
+ let _transform = ctx.Transform ? ctx.Transform : new AscCommon.CMatrix();
+ let transformMatrix = _transform.CreateDublicate ? _transform.CreateDublicate() : _transform.clone();
+ ctx.setTransform(1, transformMatrix.shy, transformMatrix.shx, transformMatrix.sy, 0, transformMatrix.ty);
+
+ ctx.updateTransforms()
+ }
+ };
+
+ WorksheetView.prototype._startRtlDrawingRendering = function () {
+ if (this.getRightToLeft()) {
+ let ctx = this.drawingGraphicCtx;
+ let _transform = ctx.Transform ? ctx.Transform : new AscCommon.CMatrix();
+ let transformMatrix = _transform.CreateDublicate ? _transform.CreateDublicate() : _transform.clone();
+ ctx.setTransform(-1, transformMatrix.shy, transformMatrix.shx, transformMatrix.sy, this.getCtxWidth(ctx), transformMatrix.ty);
+
+ ctx.updateTransforms && ctx.updateTransforms();
+ }
+ };
+
+ WorksheetView.prototype._endRtlDrawingRendering = function () {
+ if (this.getRightToLeft()) {
+ let ctx = this.drawingGraphicCtx;
+ let _transform = ctx.Transform ? ctx.Transform : new AscCommon.CMatrix();
+ let transformMatrix = _transform.CreateDublicate ? _transform.CreateDublicate() : _transform.clone();
+ ctx.setTransform(1, transformMatrix.shy, transformMatrix.shx, transformMatrix.sy, 0, transformMatrix.ty);
+
+ ctx.updateTransforms && ctx.updateTransforms();
+ }
};
+ WorksheetView.prototype.getRightToLeftOffset = function () {
+ return this.getRightToLeft() ? 1 : 0;
+ };
+
+ WorksheetView.prototype.checkGraphicObjectsBounds = function () {
+ this.objectRender.updateSizeDrawingObjects({target: c_oTargetType.ColumnResize, col: 100});
+ this.objectRender.updateDrawingsTransform({target: c_oTargetType.ColumnResize, col: 100});
+ this.objectRender.updateRange(new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxCol0));
+ };
+
+
function CRenderingSettings() {
this.splitRowBG = null; //number - how much row need skip, every 2,3 and..
+ this.ctxWidth = null;
+ this.leftOffset = null;
+ this.rightOffset = null;
}
CRenderingSettings.prototype.setSplitRowBG = function (val) {
this.splitRowBG = val;
@@ -25070,6 +26854,24 @@
return res;
};
+ CRenderingSettings.prototype.getCtxWidth = function () {
+ return this.ctxWidth;
+ };
+ CRenderingSettings.prototype.setCtxWidth = function (val) {
+ this.ctxWidth = val;
+ };
+ CRenderingSettings.prototype.setPageLeftOffset = function (val) {
+ this.pageLeftOffset = val;
+ };
+ CRenderingSettings.prototype.setPageRightOffset = function (val) {
+ this.pageRightOffset = val;
+ };
+ CRenderingSettings.prototype.getPageLeftOffset = function () {
+ return this.pageLeftOffset;
+ };
+ CRenderingSettings.prototype.getPageRightOffset = function () {
+ return this.pageRightOffset;
+ };
function cAsyncAction() {
this.timer = null;
@@ -25596,6 +27398,9 @@
var valF = arrFormula[i].val;
var arrayRef = arrFormula[i].arrayRef;
+ if (arrFormula[i].ca) {
+ AscCommonExcel.g_cCalcRecursion.setCellPasteValue(arrFormula[i].oldValue);
+ }
//***array-formula***
if (arrayRef && window['AscCommonExcel'].bIsSupportArrayFormula) {
var rangeFormulaArray = ws.model.getRange3(arrayRef.r1, arrayRef.c1, arrayRef.r2, arrayRef.c2);
@@ -25616,6 +27421,13 @@
cell.setValue(valF, null, true);
});
}
+
+ // todo it works correctly, external dependencies are loaded, but additional checks are needed
+ // let afterExternalReferences = ws.getExternalReferencesByCell(rangeF, true, true);
+ // if (afterExternalReferences /*&& !_compare(afterExternalReferences, beforeExternalReferences)*/) {
+ // //t.model.workbook.handlers.trigger("asc_onNeedUpdateExternalReference");
+ // ws.updateExternalReferenceByCell(rangeF, true);
+ // }
}
ws.model.workbook.dependencyFormulas.unlockRecal();
@@ -26823,6 +28635,7 @@
var sId = _newVal.getName();
if (pastedFormula || modelFormula) {
+ let oFromCell = formulaProps.cell;
//formula
if (pastedFormula && !isOneMerge) {
@@ -26892,13 +28705,25 @@
assemb = applySpecialOperationFormula(cellValueDataDup, modelVal, assemb, modelFormula, needOperation, isEmptyPasted, isEmptyModel);
}
if (assemb !== null) {
- rangeStyle.formula = {range: range, val: "=" + assemb, arrayRef: arrayFormulaRef};
+ rangeStyle.formula = {
+ range: range,
+ val: "=" + assemb,
+ arrayRef: arrayFormulaRef,
+ ca: oFromCell.getFormulaParsed().ca,
+ oldValue: oFromCell.getNumberValue()
+ };
}
}
} else if (modelFormula && needOperation !== null) {
assemb = applySpecialOperationFormula(cellValueDataDup, modelVal, null, modelFormula, needOperation, isEmptyPasted, isEmptyModel);
if (assemb !== null) {
- rangeStyle.formula = {range: range, val: "=" + assemb, arrayRef: arrayFormulaRef};
+ rangeStyle.formula = {
+ range: range,
+ val: "=" + assemb,
+ arrayRef: arrayFormulaRef,
+ ca: oFromCell.getFormulaParsed().ca,
+ oldValue: oFromCell.getNumberValue()
+ };
}
}
}
@@ -26911,7 +28736,16 @@
sFormula = sFormula.substr(1);
var offset = new AscCommon.CellBase(0, 0);
var assemb, _p_ = new AscCommonExcel.parserFormula(sFormula, null, ws.model);
- if (_p_.parse()) {
+
+ let parseResult = new AscCommonExcel.ParseResult();
+ if (_p_.parse(AscCommonExcel.oFormulaLocaleInfo.Parse, AscCommonExcel.oFormulaLocaleInfo.DigitSep, parseResult)) {
+ if (parseResult.externalReferenesNeedAdd && ws && ws.model && ws.model.workbook) {
+ ws.model.workbook.addExternalReferencesAfterParseFormulas(parseResult.externalReferenesNeedAdd);
+
+ // we create the formula again and parse it to correctly obtain externalLink and elements in outStack
+ _p_ = new AscCommonExcel.parserFormula(sFormula, null, ws.model);
+ _p_.parse(AscCommonExcel.oFormulaLocaleInfo.Parse, AscCommonExcel.oFormulaLocaleInfo.DigitSep, parseResult)
+ }
assemb = _p_.changeOffset(offset, null, true).assemble(true);
rangeStyle.formula = {range: range, val: "=" + assemb};
} else {
@@ -27411,8 +29245,8 @@
var mmToPx = asc_getcvt(3/*mm*/, 0/*px*/, ws._getPPIX());
var cursorPos = window['AscCommon'].g_specialPasteHelper.buttonInfo.range;
- var offsetX = ws._getColLeft(ws.visibleRange.c1) - ws.cellsLeft;
- var offsetY = ws._getRowTop(ws.visibleRange.r1) - ws.cellsTop;
+ var offsetX = ws._getOffsetX();
+ var offsetY = ws._getOffsetY();
var posX = curShape.transformText.TransformPointX(cursorPos.X, cursorPos.Y) * mmToPx - offsetX + ws.cellsLeft;
var posY = curShape.transformText.TransformPointY(cursorPos.X, cursorPos.Y) * mmToPx - offsetY + ws.cellsTop;
diff --git a/cell/view/mobileTouch.js b/cell/view/mobileTouch.js
index 1a8cc9edd1..62fc6340e4 100644
--- a/cell/view/mobileTouch.js
+++ b/cell/view/mobileTouch.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -60,9 +60,10 @@ function (window, undefined)
CMobileDelegateEditorCell.prototype.constructor = CMobileDelegateEditorCell;
CMobileDelegateEditorCell.prototype.Resize = function()
{
- var _element = document.getElementById("editor_sdk");
- this.Offset.X = _element.offsetLeft;
- this.Offset.Y = _element.offsetTop;
+ let _element = document.getElementById("editor_sdk");
+ let pos = AscCommon.UI.getBoundingClientRect(_element);
+ this.Offset.X = pos.x || pos.left;
+ this.Offset.Y = pos.y || pos.top;
this.Size.W = _element.offsetWidth;
this.Size.H = _element.offsetHeight;
@@ -161,7 +162,7 @@ function (window, undefined)
};
CMobileDelegateEditorCell.prototype.GetSelectionRectsBounds = function()
{
- var _selection = this.WB.GetSelectionRectsBounds();
+ var _selection = this.WB.GetSelectionRectsBounds(true);
if (_selection)
{
@@ -201,31 +202,41 @@ function (window, undefined)
var pos;
var _api = this.WB;
+ let needInit = false;
+ let isSmoothScrolling = _api.getSmoothScrolling();
if ('v' === _scroll.directionLocked)
{
pos = -_scroll.y / _api.controller.settings.hscrollStep;
- if (-_scroll.y >= -_scroll.maxScrollY)
+ if (-_scroll.y >= -_scroll.maxScrollY) {
+ needInit = isSmoothScrolling;
pos += 1;
- _api._onScrollY(pos);
+ }
+ _api._onScrollY(pos, needInit, true);
}
else if ('h' === _scroll.directionLocked)
{
pos = -_scroll.x / _api.controller.settings.vscrollStep;
- if (-_scroll.x >= -_scroll.maxScrollX)
+ if (-_scroll.x >= -_scroll.maxScrollX) {
+ needInit = isSmoothScrolling;
pos += 1;
- _api._onScrollX(pos);
+ }
+ _api._onScrollX(pos, needInit, true);
}
else if ('n' === _scroll.directionLocked)
{
pos = -_scroll.y / _api.controller.settings.hscrollStep;
- if (-_scroll.y >= -_scroll.maxScrollY)
+ if (-_scroll.y >= -_scroll.maxScrollY) {
+ needInit = isSmoothScrolling;
pos += 1;
- _api._onScrollY(pos);
+ }
+ _api._onScrollY(pos, needInit, true);
pos = -_scroll.x / _api.controller.settings.vscrollStep;
- if (-_scroll.x >= -_scroll.maxScrollX)
+ if (-_scroll.x >= -_scroll.maxScrollX) {
+ needInit = isSmoothScrolling;
pos += 1;
- _api._onScrollX(pos);
+ }
+ _api._onScrollX(pos, needInit, true);
}
};
CMobileDelegateEditorCell.prototype.GetContextMenuType = function()
@@ -484,16 +495,26 @@ function (window, undefined)
{
return this.Api.controller._onMouseUp(this._convertLogicToEvent(e, x, y, page));
};
+ CMobileDelegateEditorCell.prototype.extendPointerEvent = function(e)
+ {
+ try {
+ e.button = 0;
+ } catch(err) {
+ }
+ };
CMobileDelegateEditorCell.prototype.Drawing_OnMouseDown = function(e)
{
+ this.extendPointerEvent(e);
return this.Api.controller._onMouseDown(e);
};
CMobileDelegateEditorCell.prototype.Drawing_OnMouseMove = function(e)
{
+ this.extendPointerEvent(e);
return this.Api.controller._onMouseMove(e);
};
CMobileDelegateEditorCell.prototype.Drawing_OnMouseUp = function(e)
{
+ this.extendPointerEvent(e);
return this.Api.controller._onMouseUp(e);
};
@@ -519,7 +540,7 @@ function (window, undefined)
this.iScroll = new window.IScrollMobile(_element, {
scrollbars: true,
- mouseWheel: true,
+ mouseWheel: !this.isDesktopMode,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
@@ -527,7 +548,8 @@ function (window, undefined)
scroller_id : this.iScrollElement,
bounce : false,
eventsElement : this.eventsElement,
- click : false
+ click : false,
+ transparentIndicators : this.isDesktopMode
});
this.delegate.Init();
@@ -581,12 +603,27 @@ function (window, undefined)
if (_matrix && global_MatrixTransformer.IsIdentity(_matrix))
_matrix = null;
- if (!this.CheckSelectTrack())
+ let touchesCount = e.touches ? e.touches.length : this.getPointerCount();
+ let isLockedTouch = false;
+
+ if (touchesCount > 1)
{
- bIsKoefPixToMM = this.CheckObjectTrack();
+ if (AscCommon.MobileTouchMode.None !== this.Mode &&
+ AscCommon.MobileTouchMode.Scroll !== this.Mode)
+ {
+ isLockedTouch = true;
+ }
}
- if ((e.touches && 2 == e.touches.length) || (2 == this.getPointerCount()))
+ if (!isLockedTouch)
+ {
+ if (!this.CheckSelectTrack())
+ {
+ bIsKoefPixToMM = this.CheckObjectTrack();
+ }
+ }
+
+ if (!isLockedTouch && (2 === touchesCount))
{
this.Mode = AscCommon.MobileTouchMode.Zoom;
}
@@ -904,8 +941,8 @@ function (window, undefined)
this.Api.sendEvent("asc_onTapEvent", e);
var typeMenu = this.delegate.GetContextMenuType();
- if (typeMenu == AscCommon.MobileTouchContextMenuType.Target ||
- (typeMenu == AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
+ if (typeMenu === AscCommon.MobileTouchContextMenuType.Target ||
+ (typeMenu === AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
isPreventDefault = false;
}
else
@@ -936,6 +973,12 @@ function (window, undefined)
// TODO:
this.delegate.Drawing_OnMouseUp(e.changedTouches ? e.changedTouches[0] : e);
this.Mode = AscCommon.MobileTouchMode.None;
+
+ var typeMenu = this.delegate.GetContextMenuType();
+ if (typeMenu === AscCommon.MobileTouchContextMenuType.Target ||
+ (typeMenu === AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
+ isPreventDefault = false;
+
break;
}
case AscCommon.MobileTouchMode.Select:
@@ -971,7 +1014,7 @@ function (window, undefined)
this.delegate.Api.controller._onMouseMove(_e);
}
- if (this.CellEditorType == Asc.c_oAscCellEditorState.editFormula)
+ if (this.CellEditorType === Asc.c_oAscCellEditorState.editFormula)
isPreventDefault = false;
if (this.Api.isViewMode || isPreventDefault)
@@ -986,6 +1029,9 @@ function (window, undefined)
if (true !== this.iScroll.isAnimating && (this.CellEditorType != Asc.c_oAscCellEditorState.editFormula))
this.CheckContextMenuTouchEnd(isCheckContextMenuMode, isCheckContextMenuSelect, isCheckContextMenuCursor);
+ if (!isPreventDefault && this.Api.isMobileVersion && !this.Api.isUseOldMobileVersion())
+ this.showKeyboard(true);
+
return false;
};
@@ -993,6 +1039,7 @@ function (window, undefined)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
+ this.removeHandlersOnClick();
return this.onTouchStart(e);
};
CMobileTouchManager.prototype.mainOnTouchMove = function(e)
@@ -1001,12 +1048,17 @@ function (window, undefined)
};
CMobileTouchManager.prototype.mainOnTouchEnd = function(e)
{
- return this.onTouchEnd(e);
+ let res = this.onTouchEnd(e);
+ this.checkDesktopModeContextMenuEnd(e);
+ return res;
};
// отрисовка текстового селекта
CMobileTouchManager.prototype.CheckSelect = function(overlay, color, drDocument)
{
+ if (!this.desktopTouchState)
+ return;
+
if (!this.SelectEnabled)
return;
diff --git a/common/AdvancedOptions.js b/common/AdvancedOptions.js
index 2978ac2b6f..42b2ec1d14 100644
--- a/common/AdvancedOptions.js
+++ b/common/AdvancedOptions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -43,6 +43,7 @@
this.fileType = fileType;
this.isDownloadEvent = !!isDownloadEvent;
this.isSaveAs = false;
+ this.wopiSaveAsPath = null;
this.advancedOptions = null;
this.compatible = true;
@@ -62,6 +63,7 @@
asc_CDownloadOptions.prototype.asc_setFileType = function (fileType) {this.fileType = fileType;};
asc_CDownloadOptions.prototype.asc_setIsDownloadEvent = function (isDownloadEvent) {this.isDownloadEvent = isDownloadEvent;};
asc_CDownloadOptions.prototype.asc_setIsSaveAs = function (isSaveAs) {this.isSaveAs = isSaveAs;};
+ asc_CDownloadOptions.prototype.asc_setWopiSaveAsPath = function (wopiSaveAsPath) {this.wopiSaveAsPath = wopiSaveAsPath;};
asc_CDownloadOptions.prototype.asc_setAdvancedOptions = function (advancedOptions) {this.advancedOptions = advancedOptions;};
asc_CDownloadOptions.prototype.asc_setCompatible = function (compatible) {this.compatible = compatible;};
asc_CDownloadOptions.prototype.asc_setTextParams = function (textParams) {this.textParams = textParams;};
@@ -212,6 +214,7 @@
prot["asc_setFileType"] = prot.asc_setFileType;
prot["asc_setIsDownloadEvent"] = prot.asc_setIsDownloadEvent;
prot["asc_setIsSaveAs"] = prot.asc_setIsSaveAs;
+ prot["asc_setWopiSaveAsPath"] = prot.asc_setWopiSaveAsPath;
prot["asc_setAdvancedOptions"] = prot.asc_setAdvancedOptions;
prot["asc_setCompatible"] = prot.asc_setCompatible;
prot["asc_setTextParams"] = prot.asc_setTextParams;
diff --git a/common/BulletPreviewDrawer.js b/common/BulletPreviewDrawer.js
index a14c33ad3c..fd245bb32c 100644
--- a/common/BulletPreviewDrawer.js
+++ b/common/BulletPreviewDrawer.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -12,7 +12,7 @@
* 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 20A-12 Ernesta Birznieka-Upisha
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
@@ -949,7 +949,7 @@
nYPos = e.clientY;
}
nYPos = (nYPos * AscCommon.AscBrowser.zoom);
- const oClientRect = this.getBoundingClientRect();
+ const oClientRect = AscCommon.UI.getBoundingClientRect(this);
if (AscFormat.isRealNumber(oClientRect.y))
{
diff --git a/common/Charts/3DTransformation.js b/common/Charts/3DTransformation.js
index dff0157db5..da82f6a820 100644
--- a/common/Charts/3DTransformation.js
+++ b/common/Charts/3DTransformation.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -32,1521 +32,1539 @@
"use strict";
-(
-/**
+(/**
* @param {Window} window
* @param {undefined} undefined
*/
function (window, undefined) {
// Import
-var ORIENTATION_MIN_MAX = AscFormat.ORIENTATION_MIN_MAX;
-
-var globalBasePercent = 100;
-var global3DPersperctive = 30; // ToDo а нужна ли она в ChartsDrawer ?
-
-var c_oChartFloorPosition =
-{
- None: 0,
- Left: 1,
- Right: 2,
- Bottom: 3,
- Top: 4
-};
+ let ORIENTATION_MIN_MAX = AscFormat.ORIENTATION_MIN_MAX;
-/** @constructor */
-function Processor3D(width, height, left, right, bottom, top, chartSpace, chartsDrawer) {
- this.widthCanvas = width;
- this.heightCanvas = height;
+ let globalBasePercent = 100;
+ let global3DPersperctive = 30; // ToDo а нужна ли она в ChartsDrawer ?
- this.left = left ? left : 0;
- this.right = right ? right : 0;
- this.bottom = bottom ? bottom : 0;
- this.top = top ? top : 0;
+ let c_oChartFloorPosition = {
+ None: 0, Left: 1, Right: 2, Bottom: 3, Top: 4
+ };
- this.cameraDiffZ = 0;
- this.cameraDiffX = 0;
- this.cameraDiffY = 0;
+ /** @constructor */
+ function Processor3D(width, height, left, right, bottom, top, chartSpace, chartsDrawer) {
+ this.widthCanvas = width;
+ this.heightCanvas = height;
- this.scaleY = 1;
- this.scaleX = 1;
- this.scaleZ = 1;
+ this.left = left ? left : 0;
+ this.right = right ? right : 0;
+ this.bottom = bottom ? bottom : 0;
+ this.top = top ? top : 0;
- this.aspectRatioY = 1;
- this.aspectRatioX = 1;
- this.aspectRatioZ = 1;
+ this.cameraDiffZ = 0;
+ this.cameraDiffX = 0;
+ this.cameraDiffY = 0;
- this.specialStandardScaleX = 1;
+ this.scaleY = 1;
+ this.scaleX = 1;
+ this.scaleZ = 1;
- this.view3D = chartSpace.chart.getView3d();
- this.chartSpace = chartSpace;
- this.chartsDrawer = chartsDrawer;
+ this.aspectRatioY = 1;
+ this.aspectRatioX = 1;
+ this.aspectRatioZ = 1;
- this.rPerspective = 0;
+ this.specialStandardScaleX = 1;
- this.hPercent = null;
+ this.view3D = chartSpace.chart.getView3d();
+ this.chartSpace = chartSpace;
+ this.chartsDrawer = chartsDrawer;
- this.angleOx = this.view3D && this.view3D.rotX ? (-this.view3D.rotX / 360) * (Math.PI * 2) : 0;
- this.angleOy = this.view3D && this.view3D.rotY ? (-this.view3D.rotY / 360) * (Math.PI * 2) : 0;
- //this.angleOz = this.view3D && this.view3D.rotZ ? (- this.view3D.rotZ / 360) * (Math.PI * 2) : 0;
+ this.rPerspective = 0;
- if (!this.view3D.getRAngAx() && AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) {
- this.angleOy = 0;
- }
+ this.hPercent = null;
- this.orientationCatAx = null;
- this.orientationValAx = null;
+ this.angleOx = this.view3D && this.view3D.rotX ? (-this.view3D.rotX / 360) * (Math.PI * 2) : 0;
+ this.angleOy = this.view3D && this.view3D.rotY ? (-this.view3D.rotY / 360) * (Math.PI * 2) : 0;
+ //this.angleOz = this.view3D && this.view3D.rotZ ? (- this.view3D.rotZ / 360) * (Math.PI * 2) : 0;
- this.matrixRotateOx = null;
- this.matrixRotateOy = null;
- this.matrixRotateAllAxis = null;
- this.matrixShearXY = null;
- this.projectMatrix = null;
-}
+ if (!this.view3D.getRAngAx() && AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) {
+ this.angleOy = 0;
+ }
-Processor3D.prototype.calaculate3DProperties = function (baseDepth, gapDepth, bIsCheck) {
- this.calculateCommonOptions();
+ this.orientationCatAx = null;
+ this.orientationValAx = null;
- //TODO baseDepth - не универсальный параметр, позже переделать
- this._calculateAutoHPercent();
+ this.matrixRotateOx = null;
+ this.matrixRotateOy = null;
+ this.matrixRotateAllAxis = null;
+ this.matrixShearXY = null;
+ this.projectMatrix = null;
+ }
- //рассчёт коэффициэнта отношения ширины / высоты
- this._calcAspectRatio();
+ Processor3D.prototype.calaculate3DProperties = function (baseDepth, gapDepth, bIsCheck) {
+ this.calculateCommonOptions();
- //TODO рассчёт коэффицианты для диаграмм типа standard. позже необходимо отказаться
- //this._calcSpecialStandardScaleX();
+ //TODO baseDepth - не универсальный параметр, позже переделать
+ this._calculateAutoHPercent();
- //глубина
- this.depthPerspective = this.view3D.getRAngAx() ? this._calculateDepth() : this._calculateDepthPerspective();
+ //рассчёт коэффициэнта отношения ширины / высоты
+ this._calcAspectRatio();
- //угол перспективы
- this._calculatePerspective(this.view3D);
+ //TODO рассчёт коэффицианты для диаграмм типа standard. позже необходимо отказаться
+ //this._calcSpecialStandardScaleX();
- //после рассчета глубины меняются пропорции ширины и высоты
- if (this.view3D.getRAngAx())
- this._calculateScaleFromDepth();
+ //глубина
+ this.depthPerspective = this.view3D.getRAngAx() ? this._calculateDepth() : this._calculateDepthPerspective();
- //сдвиг камеры для того, чтобы попали все линии
- if (!bIsCheck) {
- this._calculateCameraDiff();
+ //угол перспективы
+ this._calculatePerspective(this.view3D);
+ //после рассчета глубины меняются пропорции ширины и высоты
if (this.view3D.getRAngAx()) {
- this._recalculateScaleWithMaxWidth();
+ this._calculateScaleFromDepth();
}
- }
- if (AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type && !this.view3D.getRAngAx()) {
- //TODO пересмотреть функцию
- this.tempChangeAspectRatioForPie();
- }
-};
+ //сдвиг камеры для того, чтобы попали все линии
+ if (!bIsCheck) {
+ this._calculateCameraDiff();
-Processor3D.prototype.tempChangeAspectRatioForPie = function () {
- var perspectiveDepth = this.depthPerspective;
+ if (this.view3D.getRAngAx()) {
+ this._recalculateScaleWithMaxWidth();
+ }
+ }
- var widthCanvas = this.widthCanvas;
- var originalWidthChart = widthCanvas - this.left - this.right;
+ if (AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type && !this.view3D.getRAngAx()) {
+ //TODO пересмотреть функцию
+ this.tempChangeAspectRatioForPie();
+ }
+ };
- var heightCanvas = this.heightCanvas;
- var heightChart = heightCanvas - this.top - this.bottom;
+ Processor3D.prototype.tempChangeAspectRatioForPie = function () {
+ let perspectiveDepth = this.depthPerspective;
- var points = [], faces = [];
+ let widthCanvas = this.widthCanvas;
+ let originalWidthChart = widthCanvas - this.left - this.right;
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
- points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart, this.top, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top, 0, this));
+ let heightCanvas = this.heightCanvas;
+ let heightChart = heightCanvas - this.top - this.bottom;
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, perspectiveDepth, this));
- points.push(new Point3D(this.left, this.top + heightChart, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart, this.top + heightChart, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
+ let points = [], faces = [];
- faces.push([0, 1, 2, 3]);
- faces.push([2, 5, 4, 3]);
- faces.push([1, 6, 7, 0]);
- faces.push([6, 5, 4, 7]);
- faces.push([7, 4, 3, 0]);
- faces.push([1, 6, 2, 5]);
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
+ points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart, this.top, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top, 0, this));
- var minMaxOx = this._getMinMaxOx(points, faces);
- var minMaxOy = this._getMinMaxOy(points, faces);
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, perspectiveDepth, this));
+ points.push(new Point3D(this.left, this.top + heightChart, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart, this.top + heightChart, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
- var kF = ((minMaxOx.right - minMaxOx.left) / originalWidthChart);
- if ((minMaxOy.bottom - minMaxOy.top) / kF > heightChart) {
- kF = ((minMaxOy.bottom - minMaxOy.top) / heightChart);
- }
+ faces.push([0, 1, 2, 3]);
+ faces.push([2, 5, 4, 3]);
+ faces.push([1, 6, 7, 0]);
+ faces.push([6, 5, 4, 7]);
+ faces.push([7, 4, 3, 0]);
+ faces.push([1, 6, 2, 5]);
- this.aspectRatioX = this.aspectRatioX * kF;
- this.aspectRatioY = this.aspectRatioY * kF;
- this.aspectRatioZ = this.aspectRatioZ * kF;
-};
+ let minMaxOx = this._getMinMaxOx(points, faces);
+ let minMaxOy = this._getMinMaxOy(points, faces);
+
+ let kF = ((minMaxOx.right - minMaxOx.left) / originalWidthChart);
+ if ((minMaxOy.bottom - minMaxOy.top) / kF > heightChart) {
+ kF = ((minMaxOy.bottom - minMaxOy.top) / heightChart);
+ }
+
+ this.aspectRatioX = this.aspectRatioX * kF;
+ this.aspectRatioY = this.aspectRatioY * kF;
+ this.aspectRatioZ = this.aspectRatioZ * kF;
+ };
Processor3D.prototype.calculateCommonOptions = function () {
this.orientationCatAx = this.chartSpace && this.chartSpace.chart.plotArea.catAx ? this.chartSpace.chart.plotArea.catAx.getOrientation() : ORIENTATION_MIN_MAX;
this.orientationValAx = this.chartSpace && this.chartSpace.chart.plotArea.valAx ? this.chartSpace.chart.plotArea.valAx.getOrientation() : ORIENTATION_MIN_MAX;
};
-Processor3D.prototype._calculateAutoHPercent = function () {
- var widthLine = this.widthCanvas - (this.left + this.right);
- var heightLine = this.heightCanvas - (this.top + this.bottom);
+ Processor3D.prototype._calculateAutoHPercent = function () {
+ let widthLine = this.widthCanvas - (this.left + this.right);
+ let heightLine = this.heightCanvas - (this.top + this.bottom);
- if (this.hPercent == null) {
- this.hPercent = this.view3D.hPercent === null ? (heightLine / widthLine) : this.view3D.hPercent / 100;
- if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && ((this.view3D.hPercent === null && this.view3D.getRAngAx()) || (this.view3D.hPercent !== null && !this.view3D.getRAngAx())))
- this.hPercent = 1 / this.hPercent;
+ if (this.hPercent == null) {
+ this.hPercent = this.view3D.hPercent === null ? (heightLine / widthLine) : this.view3D.hPercent / 100;
+ if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar &&
+ ((this.view3D.hPercent === null && this.view3D.getRAngAx()) || (this.view3D.hPercent !== null && !this.view3D.getRAngAx()))) {
+ this.hPercent = 1 / this.hPercent;
+ }
+
+ if (AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) {
+ this.hPercent = 0.12;
+ //this.view3D.depthPercent = 180;
+ }
- if (AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) {
- this.hPercent = 0.12;
- //this.view3D.depthPercent = 180;
}
+ };
- }
-};
+ Processor3D.prototype._recalculateScaleWithMaxWidth = function () {
+ let widthLine = this.widthCanvas - (this.left + this.right);
+ let heightLine = this.heightCanvas - (this.top + this.bottom);
+ let widthCanvas = this.widthCanvas;
+ //todo оптимальную ширину нужно пересмотреть
+ //оптимальная ширина - ширина при которой не происходит масштабирования по ширине
+ let optimalWidth = heightLine * 10;
+
+ let subType = this.chartsDrawer.calcProp.subType;
+ let type = this.chartsDrawer.calcProp.type;
+ let isStandardType = subType === "standard" || type === AscFormat.c_oChartTypes.Line || (type === AscFormat.c_oChartTypes.Area && subType === "normal") || type ===
+ AscFormat.c_oChartTypes.Surface;
+
+ let optimalWidthLine, kF;
+ if (!isStandardType) {
+ this.widthCanvas = optimalWidth + (this.left + this.right);
+ this._calculateScaleNStandard();
+ optimalWidthLine = Math.abs(this.depthPerspective * Math.sin(-this.angleOy)) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
+ kF = optimalWidthLine / widthLine;
+
+ if (optimalWidthLine < widthLine) {
+ this.widthCanvas = widthCanvas;
+ this._calculateScaleNStandard();
+ } else {
+ this.aspectRatioX = widthLine / ((optimalWidthLine - Math.abs(this.depthPerspective * Math.sin(-this.angleOy))) / kF);
+ this.scaleY = this.scaleY * kF;
+ this.scaleZ = this.scaleZ * kF;
-Processor3D.prototype._recalculateScaleWithMaxWidth = function () {
- var widthLine = this.widthCanvas - (this.left + this.right);
- var heightLine = this.heightCanvas - (this.top + this.bottom);
- var widthCanvas = this.widthCanvas;
- //todo оптимальную ширину нужно пересмотреть
- //оптимальная ширина - ширина при которой не происходит масштабирования по ширине
- var optimalWidth = heightLine * 10;
-
- var subType = this.chartsDrawer.calcProp.subType;
- var type = this.chartsDrawer.calcProp.type;
- var isStandardType = subType === "standard" || type === AscFormat.c_oChartTypes.Line || (type === AscFormat.c_oChartTypes.Area && subType === "normal") || type === AscFormat.c_oChartTypes.Surface;
-
- var optimalWidthLine, kF;
- if (!isStandardType) {
- this.widthCanvas = optimalWidth + (this.left + this.right);
- this._calculateScaleNStandard();
- optimalWidthLine = Math.abs(this.depthPerspective * Math.sin(-this.angleOy)) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
- kF = optimalWidthLine / widthLine;
+ this.widthCanvas = widthCanvas;
+ }
- if (optimalWidthLine < widthLine) {
- this.widthCanvas = widthCanvas;
- this._calculateScaleNStandard();
+ this._recalculateCameraDiff();
} else {
- this.aspectRatioX = widthLine / ((optimalWidthLine - Math.abs(this.depthPerspective * Math.sin(-this.angleOy))) / kF);
- this.scaleY = this.scaleY * kF;
- this.scaleZ = this.scaleZ * kF;
+ let scaleX = this.scaleX;
+ let scaleY = this.scaleY;
+ let scaleZ = this.scaleZ;
- this.widthCanvas = widthCanvas;
- }
+ let aspectRatioX = this.aspectRatioX;
+ let aspectRatioY = this.aspectRatioY;
+ let aspectRatioZ = this.aspectRatioZ;
- this._recalculateCameraDiff();
- } else {
- var scaleX = this.scaleX;
- var scaleY = this.scaleY;
- var scaleZ = this.scaleZ;
+ //если будут проблемы с поворотом standard диграмм, раскомментровать!
+ //TODO протестировать, и если не будет проблем, то убрать if-else
+ if (Math.abs(this.angleOy) > Math.PI) {
+ //рассчитываем параметры диаграммы при оптимальной ширине
+ this.widthCanvas = optimalWidth + (this.left + this.right);
- var aspectRatioX = this.aspectRatioX;
- var aspectRatioY = this.aspectRatioY;
- var aspectRatioZ = this.aspectRatioZ;
+ this.calaculate3DProperties(null, null, true);
- //если будут проблемы с поворотом standard диграмм, раскомментровать!
- //TODO протестировать, и если не будет проблем, то убрать if-else
- if (Math.abs(this.angleOy) > Math.PI) {
- //рассчитываем параметры диаграммы при оптимальной ширине
- this.widthCanvas = optimalWidth + (this.left + this.right);
+ let newDepth = Math.abs(this.depthPerspective * Math.sin(-this.angleOy));
+ optimalWidthLine = newDepth + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
+ kF = optimalWidthLine / widthLine;
- this.calaculate3DProperties(null, null, true);
+ if (optimalWidthLine < widthLine) {
+ this.widthCanvas = widthCanvas;
+ this.scaleX = scaleX;
+ this.scaleY = scaleY;
+ this.scaleZ = scaleZ;
- var newDepth = Math.abs(this.depthPerspective * Math.sin(-this.angleOy));
- optimalWidthLine = newDepth + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
- kF = optimalWidthLine / widthLine;
+ this.aspectRatioX = aspectRatioX;
+ this.aspectRatioY = aspectRatioY;
+ this.aspectRatioZ = aspectRatioZ;
+
+ return;
+ }
+
+ this.aspectRatioX = widthLine / ((optimalWidthLine - newDepth) / kF);
+ this.scaleY = this.scaleY * kF;
+ this.scaleZ = this.scaleZ * kF;
- if (optimalWidthLine < widthLine) {
this.widthCanvas = widthCanvas;
- this.scaleX = scaleX;
- this.scaleY = scaleY;
- this.scaleZ = scaleZ;
- this.aspectRatioX = aspectRatioX;
- this.aspectRatioY = aspectRatioY;
- this.aspectRatioZ = aspectRatioZ;
+ this._recalculateCameraDiff();
+ } else {
+ //рассчитываем параметры диаграммы при оптимальной ширине
+ this.widthCanvas = optimalWidth + (this.left + this.right);
+ this.calaculate3DProperties(null, null, true);
- return;
- }
+ optimalWidthLine = this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
- this.aspectRatioX = widthLine / ((optimalWidthLine - newDepth) / kF);
- this.scaleY = this.scaleY * kF;
- this.scaleZ = this.scaleZ * kF;
+ if (optimalWidthLine < widthLine) {
+ this.widthCanvas = widthCanvas;
+ this.scaleX = scaleX;
+ this.scaleY = scaleY;
+ this.scaleZ = scaleZ;
- this.widthCanvas = widthCanvas;
+ this.aspectRatioX = aspectRatioX;
+ this.aspectRatioY = aspectRatioY;
+ this.aspectRatioZ = aspectRatioZ;
- this._recalculateCameraDiff();
- } else {
- //рассчитываем параметры диаграммы при оптимальной ширине
- this.widthCanvas = optimalWidth + (this.left + this.right);
- this.calaculate3DProperties(null, null, true);
+ return;
+ }
- optimalWidthLine = this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
+ kF = optimalWidthLine / widthLine;
+ this.aspectRatioX = widthLine / ((optimalWidthLine - this.depthPerspective * Math.sin(-this.angleOy)) / kF);
+ this.scaleY = this.scaleY * kF;
+ this.scaleZ = this.scaleZ * kF;
- if (optimalWidthLine < widthLine) {
this.widthCanvas = widthCanvas;
- this.scaleX = scaleX;
- this.scaleY = scaleY;
- this.scaleZ = scaleZ;
-
- this.aspectRatioX = aspectRatioX;
- this.aspectRatioY = aspectRatioY;
- this.aspectRatioZ = aspectRatioZ;
- return;
+ this._recalculateCameraDiff();
}
+ }
+ };
- kF = optimalWidthLine / widthLine;
- this.aspectRatioX = widthLine / ((optimalWidthLine - this.depthPerspective * Math.sin(-this.angleOy)) / kF);
- this.scaleY = this.scaleY * kF;
- this.scaleZ = this.scaleZ * kF;
+ Processor3D.prototype._calculateScaleNStandard = function () {
+ let seriesProps = this.chartsDrawer.calculateFirstChartCountSeries();
+ let ptCount = seriesProps.points;
- this.widthCanvas = widthCanvas;
+ let widthLine = this.widthCanvas - (this.left + this.right);
+ let heightLine = this.heightCanvas - (this.top + this.bottom);
- this._recalculateCameraDiff();
- }
- }
-};
+ let trueDepth = Math.abs(this.depthPerspective * Math.sin(-this.angleOx));
+ let mustHeight = heightLine - trueDepth;
+ let mustWidth = this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar ? mustHeight * this.hPercent : mustHeight / this.hPercent;
-Processor3D.prototype._calculateScaleNStandard = function () {
- var ptCount = this.chartsDrawer.calcProp.ptCount;
+ let areaStackedKf = this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && this.chartsDrawer.calcProp.subType !== "normal" ? (ptCount / ((ptCount - 1))) : 1;
- var widthLine = this.widthCanvas - (this.left + this.right);
- var heightLine = this.heightCanvas - (this.top + this.bottom);
+ //без маштабирования
+ if (this.angleOy === 0) {
+ this.aspectRatioX = ((this.widthCanvas - (this.left + this.right)) / mustWidth) / areaStackedKf;
+ this.scaleX = 1;
+ this.scaleY = 1;
+ this.aspectRatioY = heightLine / mustHeight;
+ } else {
+ this.aspectRatioX = ((this.widthCanvas - (this.left + this.right)) / mustWidth) / areaStackedKf;
+ this.scaleX = 1;
+ this.scaleY = 1;
+ this.aspectRatioY = heightLine / mustHeight;
+ }
- var trueDepth = Math.abs(this.depthPerspective * Math.sin(-this.angleOx));
- var mustHeight = heightLine - trueDepth;
- var mustWidth = this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar ? mustHeight * this.hPercent : mustHeight / this.hPercent;
+ let optimalWidthLine = (widthLine / this.aspectRatioX) / this.scaleX;
- var areaStackedKf = this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && this.chartsDrawer.calcProp.subType !== "normal" ? (ptCount / ((ptCount - 1))) : 1;
- //без маштабирования
- if (this.angleOy === 0) {
- this.aspectRatioX = ((this.widthCanvas - (this.left + this.right)) / mustWidth) / areaStackedKf;
- this.scaleX = 1;
- this.scaleY = 1;
- this.aspectRatioY = heightLine / mustHeight;
- } else {
- this.aspectRatioX = ((this.widthCanvas - (this.left + this.right)) / mustWidth) / areaStackedKf;
- this.scaleX = 1;
- this.scaleY = 1;
- this.aspectRatioY = heightLine / mustHeight;
- }
-
- var optimalWidthLine = (widthLine / this.aspectRatioX) / this.scaleX;
+ if (optimalWidthLine < widthLine) {
+ return;
+ }
+ let kF = optimalWidthLine / (widthLine);
+ this.aspectRatioX = kF * this.aspectRatioX;
+ this.scaleY = this.scaleY * kF;
+ this.scaleZ = this.scaleZ * kF;
+ };
- if (optimalWidthLine < widthLine) {
- return;
- }
+ Processor3D.prototype._recalculateCameraDiff = function () {
+ this.cameraDiffX = 0;
+ this.cameraDiffY = 0;
+ this.cameraDiffZ = 0;
- var kF = optimalWidthLine / (widthLine);
- this.aspectRatioX = kF * this.aspectRatioX;
- this.scaleY = this.scaleY * kF;
- this.scaleZ = this.scaleZ * kF;
-};
+ this._calculateCameraDiff();
+ };
-Processor3D.prototype._recalculateCameraDiff = function () {
- this.cameraDiffX = 0;
- this.cameraDiffY = 0;
- this.cameraDiffZ = 0;
+ Processor3D.prototype.calculateZPositionValAxis = function () {
+ let result = 0;
+ if (!this.view3D.getRAngAx()) {
+ result = this.orientationCatAx !== ORIENTATION_MIN_MAX ? this.depthPerspective : 0;
+ if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar) {
+ let angleOyAbs = Math.abs(this.angleOy);
+ if ((angleOyAbs >= Math.PI / 2 && angleOyAbs < Math.PI) || (angleOyAbs >= 3 * Math.PI / 2 && angleOyAbs < 2 * Math.PI)) {
+ result = this.orientationCatAx !== ORIENTATION_MIN_MAX ? 0 : this.depthPerspective;
+ }
+ } else {
+ if (this.orientationCatAx !== ORIENTATION_MIN_MAX) {
+ result = Math.cos(this.angleOy) > 0 ? this.depthPerspective : 0;
+ } else {
+ result = Math.cos(this.angleOy) > 0 ? 0 : this.depthPerspective;
+ }
+ }
+ } else if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar && this.orientationCatAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
+ result = this.depthPerspective;
+ } else if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.orientationCatAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
+ //if(this.chartSpace.chart.plotArea.valAx && this.chartSpace.chart.plotArea.valAx.yPoints && this.chartSpace.chart.plotArea.catAx.posY === this.chartSpace.chart.plotArea.valAx.yPoints[0].pos)
+ result = this.depthPerspective;
+ }
- this._calculateCameraDiff();
-};
+ return result;
+ };
-Processor3D.prototype.calculateZPositionValAxis = function () {
- var result = 0;
- if (!this.view3D.getRAngAx()) {
- result = this.orientationCatAx !== ORIENTATION_MIN_MAX ? this.depthPerspective : 0;
- if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar) {
- var angleOyAbs = Math.abs(this.angleOy);
- if ((angleOyAbs >= Math.PI / 2 && angleOyAbs < Math.PI) || (angleOyAbs >= 3 * Math.PI / 2 && angleOyAbs < 2 * Math.PI))
- result = this.orientationCatAx !== ORIENTATION_MIN_MAX ? 0 : this.depthPerspective;
- } else {
- if (this.orientationCatAx !== ORIENTATION_MIN_MAX) {
+ Processor3D.prototype.calculateZPositionCatAxis = function () {
+ let result = 0;
+ if (!this.view3D.getRAngAx()) {
+ if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.orientationValAx !== ORIENTATION_MIN_MAX) {
result = Math.cos(this.angleOy) > 0 ? this.depthPerspective : 0;
} else {
result = Math.cos(this.angleOy) > 0 ? 0 : this.depthPerspective;
}
+ } else if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar && this.orientationValAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
+ if (this.chartSpace.chart.plotArea.valAx && this.chartSpace.chart.plotArea.valAx.yPoints && this.chartSpace.chart.plotArea.catAx.posY ===
+ this.chartSpace.chart.plotArea.valAx.yPoints[0].pos) {
+ result = this.depthPerspective;
+ }
+ } else if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.orientationValAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
+ result = this.depthPerspective;
}
- } else if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar && this.orientationCatAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
- result = this.depthPerspective;
- } else if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.orientationCatAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
- //if(this.chartSpace.chart.plotArea.valAx && this.chartSpace.chart.plotArea.valAx.yPoints && this.chartSpace.chart.plotArea.catAx.posY === this.chartSpace.chart.plotArea.valAx.yPoints[0].pos)
- result = this.depthPerspective;
- }
- return result;
-};
+ return result;
+ };
-Processor3D.prototype.calculateZPositionCatAxis = function () {
- var result = 0;
- if (!this.view3D.getRAngAx()) {
- if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.orientationValAx !== ORIENTATION_MIN_MAX) {
- result = Math.cos(this.angleOy) > 0 ? this.depthPerspective : 0;
- } else {
- result = Math.cos(this.angleOy) > 0 ? 0 : this.depthPerspective;
+ Processor3D.prototype.calculateXPositionSerAxis = function () {
+ if (!this.view3D.getRAngAx()) {
+ return Math.sin(this.angleOy) > 0;
}
- } else if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar && this.orientationValAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
- if (this.chartSpace.chart.plotArea.valAx && this.chartSpace.chart.plotArea.valAx.yPoints && this.chartSpace.chart.plotArea.catAx.posY === this.chartSpace.chart.plotArea.valAx.yPoints[0].pos)
- result = this.depthPerspective;
- } else if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.orientationValAx !== ORIENTATION_MIN_MAX && this.depthPerspective !== undefined) {
- result = this.depthPerspective;
- }
-
- return result;
-};
-
-Processor3D.prototype.calculateXPositionSerAxis = function () {
- if (!this.view3D.getRAngAx()) {
- return Math.sin(this.angleOy) > 0;
- }
-};
+ };
-Processor3D.prototype.calculateFloorPosition = function () {
- var res, absOy;
+ Processor3D.prototype.calculateFloorPosition = function () {
+ let res, absOy;
- if (this.view3D.getRAngAx()) {
- if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar) {
- absOy = Math.abs(this.angleOy);
- res = c_oChartFloorPosition.Left;
- if (absOy > Math.PI) {
- res = c_oChartFloorPosition.Right;
- }
- } else {
- res = c_oChartFloorPosition.Bottom;
- if (this.angleOx > 0) {
- res = c_oChartFloorPosition.None;
+ if (this.view3D.getRAngAx()) {
+ if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar) {
+ absOy = Math.abs(this.angleOy);
+ res = c_oChartFloorPosition.Left;
+ if (absOy > Math.PI) {
+ res = c_oChartFloorPosition.Right;
+ }
+ } else {
+ res = c_oChartFloorPosition.Bottom;
+ if (this.angleOx > 0) {
+ res = c_oChartFloorPosition.None;
+ }
}
- }
- } else {
- if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar) {
- absOy = Math.abs(this.angleOy);
- res = c_oChartFloorPosition.Left;
- if (absOy > Math.PI) {
- res = c_oChartFloorPosition.Right;
- }
} else {
- res = c_oChartFloorPosition.Bottom;
- if (this.angleOx > 0) {
- res = c_oChartFloorPosition.None;
+ if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar) {
+ absOy = Math.abs(this.angleOy);
+ res = c_oChartFloorPosition.Left;
+ if (absOy > Math.PI) {
+ res = c_oChartFloorPosition.Right;
+ }
+ } else {
+ res = c_oChartFloorPosition.Bottom;
+ if (this.angleOx > 0) {
+ res = c_oChartFloorPosition.None;
+ }
}
}
- }
- return res;
-};
-
-//***functions for complete transformation point***
-Processor3D.prototype.convertAndTurnPoint = function (x, y, z, isNScale, isNRotate, isNProject) {
- var res = null;
+ return res;
+ };
- if (this.view3D.getRAngAx()) {
- res = this.convertAndTurnPointRAngAx(x, y, z);
- } else {
- res = this.convertAndTurnPointPerspective(x, y, z, isNScale, isNRotate, isNProject);
- }
+ //***functions for complete transformation point***
+ Processor3D.prototype.convertAndTurnPoint = function (x, y, z, isNScale, isNRotate, isNProject) {
+ let res = null;
- return res;
-};
+ if (this.view3D.getRAngAx()) {
+ res = this.convertAndTurnPointRAngAx(x, y, z);
+ } else {
+ res = this.convertAndTurnPointPerspective(x, y, z, isNScale, isNRotate, isNProject);
+ }
-Processor3D.prototype.convertAndTurnPointRAngAx = function (x, y, z) {
- var heightChart = this.heightCanvas - this.top - this.bottom;
- var widthOriginalChart = this.widthCanvas - this.left - this.right;
+ return res;
+ };
- var point3D = new Point3D(x, y, z, this);
- this.scale(point3D);
+ Processor3D.prototype.convertAndTurnPointRAngAx = function (x, y, z) {
+ let heightChart = this.heightCanvas - this.top - this.bottom;
- //diff
- var centerXDiff = heightChart / 2 + this.left / 2;
- var centerYDiff = heightChart / 2 + this.top;
- var centerZDiff = this.depthPerspective / 2;
+ let point3D = new Point3D(x, y, z, this);
+ this.scale(point3D);
- point3D.offset(-centerXDiff, -centerYDiff, -centerZDiff);
+ //diff
+ let centerXDiff = heightChart / 2 + this.left / 2;
+ let centerYDiff = heightChart / 2 + this.top;
+ let centerZDiff = this.depthPerspective / 2;
- //rotate
- var matrixRotateAllAxis = this._shearXY();
- point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
+ point3D.offset(-centerXDiff, -centerYDiff, -centerZDiff);
- // diff camera for charts write into rect
- point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
+ //rotate
+ let matrixRotateAllAxis = this._shearXY();
+ point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
- //undiff
- var specialReverseDiff = this.widthCanvas / 2 + (this.left - this.right) / 2;
- point3D.offset(specialReverseDiff, centerYDiff, centerZDiff);
+ // diff camera for charts write into rect
+ point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
- return {x: point3D.x, y: point3D.y, z: z};
-};
+ //undiff
+ let specialReverseDiff = this.widthCanvas / 2 + (this.left - this.right) / 2;
+ point3D.offset(specialReverseDiff, centerYDiff, centerZDiff);
-Processor3D.prototype.convertAndTurnPointPerspective = function (x, y, z, isNScale, isNRotate, isNProject) {
- var point3D = new Point3D(x, y, z, this);
+ return {x: point3D.x, y: point3D.y, z: z};
+ };
- if (!isNScale) {
- this.scale(point3D);
- }
+ Processor3D.prototype.convertAndTurnPointPerspective = function (x, y, z, isNScale, isNRotate, isNProject) {
+ let point3D = new Point3D(x, y, z, this);
- if (!isNRotate) {
- this.rotatePerspective(point3D);
- }
+ if (!isNScale) {
+ this.scale(point3D);
+ }
- if (!isNProject) {
- this.projectPerspective(point3D);
- }
+ if (!isNRotate) {
+ this.rotatePerspective(point3D);
+ }
- return {x: point3D.x, y: point3D.y, z: point3D.z};
-};
+ if (!isNProject) {
+ this.projectPerspective(point3D);
+ }
-Processor3D.prototype.scale = function (point3D) {
- //aspectRatio
- point3D.x = point3D.x / this.aspectRatioX;
- point3D.y = point3D.y / this.aspectRatioY;
+ return {x: point3D.x, y: point3D.y, z: point3D.z};
+ };
- point3D.x = point3D.x / this.scaleX;
- point3D.y = point3D.y / this.scaleY;
- point3D.z = point3D.z / this.scaleZ;
-};
+ Processor3D.prototype.scale = function (point3D) {
+ //aspectRatio
+ point3D.x = point3D.x / this.aspectRatioX;
+ point3D.y = point3D.y / this.aspectRatioY;
+ point3D.x = point3D.x / this.scaleX;
+ point3D.y = point3D.y / this.scaleY;
+ point3D.z = point3D.z / this.scaleZ;
+ };
-Processor3D.prototype.rotatePerspective = function (point3D) {
- //diff
- point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY, 0);
- //rotate
- var matrixRotateAllAxis = this._getMatrixRotateAllAxis();
- point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
+ Processor3D.prototype.rotatePerspective = function (point3D) {
+ //diff
+ point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY, 0);
+ //rotate
+ let matrixRotateAllAxis = this._getMatrixRotateAllAxis();
+ point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
- point3D.offset((this.widthCanvas / 2) / this.aspectRatioX, (this.heightCanvas / 2) / this.aspectRatioY, 0);
-};
+ point3D.offset((this.widthCanvas / 2) / this.aspectRatioX, (this.heightCanvas / 2) / this.aspectRatioY, 0);
+ };
+ Processor3D.prototype.projectPerspective = function (point3D) {
+ //diff
+ point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY /** aspectRatio*/, 0);
-Processor3D.prototype.projectPerspective = function (point3D) {
- //diff
- point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY /** aspectRatio*/, 0);
+ // diff camera for charts write into rect
+ point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
- // diff camera for charts write into rect
- point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
+ //project
+ let projectiveMatrix = this._getPerspectiveProjectionMatrix(1 / (this.rPerspective));
+ point3D.project(projectiveMatrix);
- //project
- var projectiveMatrix = this._getPerspectiveProjectionMatrix(1 / (this.rPerspective));
- point3D.project(projectiveMatrix);
+ //undiff
+ let specialReverseDiffX = this.widthCanvas / 2 + (this.left - this.right) / 2;
+ let specialReverseDiffY = this.heightCanvas / 2 + (this.top - this.bottom) / 2;
+ point3D.offset(specialReverseDiffX, specialReverseDiffY, 0);
+ };
- //undiff
- var specialReverseDiffX = this.widthCanvas / 2 + (this.left - this.right) / 2;
- var specialReverseDiffY = this.heightCanvas / 2 + (this.top - this.bottom) / 2;
- point3D.offset(specialReverseDiffX, specialReverseDiffY, 0);
-};
+ //functions for step transformation point
+ Processor3D.prototype.calculatePointManual = function (x, y, z, diffX, diffY, diffZ) {
+ diffX = diffX !== undefined ? diffX : this.cameraDiffX;
+ diffY = diffY !== undefined ? diffY : this.cameraDiffY;
+ diffZ = diffZ !== undefined ? diffZ : this.cameraDiffZ;
-//functions for step transformation point
-Processor3D.prototype.calculatePointManual = function (x, y, z, diffX, diffY, diffZ) {
- diffX = diffX !== undefined ? diffX : this.cameraDiffX;
- diffY = diffY !== undefined ? diffY : this.cameraDiffY;
- diffZ = diffZ !== undefined ? diffZ : this.cameraDiffZ;
+ let diffAndScalePoints = this.diffAndScale(x, y, z);
+ let x11 = diffAndScalePoints.x;
+ let y11 = diffAndScalePoints.y;
+ let z11 = diffAndScalePoints.z;
- var diffAndScalePoints = this.diffAndScale(x, y, z);
- var x11 = diffAndScalePoints.x;
- var y11 = diffAndScalePoints.y;
- var z11 = diffAndScalePoints.z;
+ let rotatePoints = this.rotate(x11, y11, z11);
+ let x111 = rotatePoints.x;
+ let y111 = rotatePoints.y;
+ let z111 = rotatePoints.z;
- var rotatePoints = this.rotate(x11, y11, z11);
- var x111 = rotatePoints.x;
- var y111 = rotatePoints.y;
- var z111 = rotatePoints.z;
+ let x1111 = x111 + diffX;
+ let y1111 = y111 + diffY;
+ let z1111 = z111 + diffZ;
- var x1111 = x111 + diffX;
- var y1111 = y111 + diffY;
- var z1111 = z111 + diffZ;
+ let projectPoints = this.project(x1111, y1111, z1111);
+ let x11111 = projectPoints.x;
+ let y11111 = projectPoints.y;
- var projectPoints = this.project(x1111, y1111, z1111);
- var x11111 = projectPoints.x;
- var y11111 = projectPoints.y;
+ return {x: x11111, y: y11111};
+ };
- return {x: x11111, y: y11111};
-};
+ Processor3D.prototype.diffAndScale = function (x, y, z) {
+ let aRX = this.aspectRatioX;
+ let aRY = this.aspectRatioY;
-Processor3D.prototype.diffAndScale = function (x, y, z) {
- var aRX = this.aspectRatioX;
- var aRY = this.aspectRatioY;
+ let w = this.widthCanvas;
+ let h = this.heightCanvas;
- var w = this.widthCanvas;
- var h = this.heightCanvas;
+ let x1 = x / aRX;
+ let x11 = x1 - (w / 2) / aRX;
- var x1 = x / aRX;
- var x11 = x1 - (w / 2) / aRX;
+ let z11 = z;
- var z1 = z;
- var z11 = z1;
+ let y1 = y / aRY;
+ let y11 = y1 - (h / 2) / aRY;
- var y1 = y / aRY;
- var y11 = y1 - (h / 2) / aRY;
+ return {x: x11, y: y11, z: z11};
+ };
- return {x: x11, y: y11, z: z11};
-};
+ Processor3D.prototype.rotate = function (x11, y11, z11) {
+ let sinOY = Math.sin(-this.angleOy);
+ let cosOY = Math.cos(-this.angleOy);
+ let sinOX = Math.sin(-this.angleOx);
+ let cosOX = Math.cos(-this.angleOx);
-Processor3D.prototype.rotate = function (x11, y11, z11) {
- var sinOY = Math.sin(-this.angleOy);
- var cosOY = Math.cos(-this.angleOy);
- var sinOX = Math.sin(-this.angleOx);
- var cosOX = Math.cos(-this.angleOx);
+ let x111 = z11 * sinOY + x11 * cosOY;
+ let y111 = x11 * sinOX * sinOY + y11 * cosOX - z11 * sinOX * cosOY;
+ let z111 = -x11 * sinOY * cosOX + y11 * sinOX + z11 * (cosOY * cosOX);
- var x111 = z11 * sinOY + x11 * cosOY;
- var y111 = x11 * sinOX * sinOY + y11 * cosOX - z11 * sinOX * cosOY;
- var z111 = -x11 * sinOY * cosOX + y11 * sinOX + z11 * (cosOY * cosOX);
+ return {x: x111, y: y111, z: z111};
+ };
- return {x: x111, y: y111, z: z111};
-};
+ Processor3D.prototype.project = function (x1111, y1111, z1111) {
+ let fov = 1 / this.rPerspective;
-Processor3D.prototype.project = function (x1111, y1111, z1111) {
- var fov = 1 / this.rPerspective;
+ let w = this.widthCanvas;
+ let h = this.heightCanvas;
- var w = this.widthCanvas;
- var h = this.heightCanvas;
+ let x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
+ let y11111 = (fov * y1111) / (z1111 + fov) + h / 2;
- var x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
- var y11111 = (fov * y1111) / (z1111 + fov) + h / 2;
+ return {x: x11111, y: y11111};
+ };
- return {x: x11111, y: y11111};
-};
+ //exception for pie charts
+ Processor3D.prototype.convertAndTurnPointForPie = function (x, y, z) {
+ let heightChart = this.heightCanvas - this.top - this.bottom;
-//exception for pie charts
-Processor3D.prototype.convertAndTurnPointForPie = function (x, y, z, cameraDiffZ) {
- var heightChart = this.heightCanvas - this.top - this.bottom;
+ let point3D = new Point3D(x, y, z, this);
- //aspectRatio
- /*x = x / this.aspectRatioX;
- y = y / this.aspectRatioY;
+ //diff
+ let centerXDiff = heightChart / 2 + this.left / 2;
+ let centerYDiff = heightChart / 2 + this.top;
+ let centerZDiff = this.depthPerspective / 2;
- x = x / this.scaleX;
- y = y / this.scaleY;
- z = z / this.scaleZ;*/
- var point3D = new Point3D(x, y, z, this);
+ point3D.offset(-centerXDiff, -centerYDiff, -centerZDiff);
- //diff
- var centerXDiff = heightChart / 2 + this.left / 2;
- var centerYDiff = heightChart / 2 + this.top;
- var centerZDiff = this.depthPerspective / 2;
+ //rotate
+ let matrixRotateAllAxis;
+ if (!this.view3D.getRAngAx()) {
+ matrixRotateAllAxis = this._getMatrixRotateAllAxis();
+ } else {
+ matrixRotateAllAxis = this._shearXY();
+ }
+ point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
- point3D.offset(-centerXDiff, -centerYDiff, -centerZDiff);
+ // diff camera for charts write into rect
+ point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
- //rotate
- var matrixRotateAllAxis;
- if (!this.view3D.getRAngAx())
- matrixRotateAllAxis = this._getMatrixRotateAllAxis();
- else
- matrixRotateAllAxis = this._shearXY();
+ //project
+ let projectionPoint = point3D;
+ if (!this.view3D.getRAngAx()) {
+ let projectiveMatrix = this._getPerspectiveProjectionMatrix(1 / (this.rPerspective));
+ projectionPoint = point3D.project(projectiveMatrix);
+ }
- point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
+ //undiff
+ let specialReverseDiff = this.widthCanvas / 2 + (this.left - this.right) / 2;
+ projectionPoint.offset(specialReverseDiff, centerYDiff, centerZDiff);
- // diff camera for charts write into rect
- point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
+ //console.log(" this.aspectRatioX: " + this.aspectRatioX + " this.aspectRatioY: " + this.aspectRatioY + " this.scaleX: " + this.scaleX + " this.scaleY: " + this.scaleY);
- //project
- var projectionPoint = point3D;
- if (!this.view3D.getRAngAx()) {
- var projectiveMatrix = this._getPerspectiveProjectionMatrix(1 / (this.rPerspective));
- projectionPoint = point3D.project(projectiveMatrix);
- }
+ return {x: projectionPoint.x, y: projectionPoint.y};
+ };
- //undiff
- var specialReverseDiff = this.widthCanvas / 2 + (this.left - this.right) / 2;
- projectionPoint.offset(specialReverseDiff, centerYDiff, centerZDiff);
+ Processor3D.prototype.calculatePropertiesForPieCharts = function () {
+ let sinAngleOx = Math.sin(-this.angleOx);
+ let cosAngleOx = Math.cos(-this.angleOx);
+
+ let widthCharts = this.widthCanvas - this.left - this.right;
+ let heightCharts = this.heightCanvas - this.bottom - this.top;
+ let radius1 = widthCharts / 2;
+ let radius2 = radius1 * sinAngleOx;
+ let depth = ((widthCharts + 4.89) / 8.37) * cosAngleOx;
+
+ if ((radius2 * 2 + depth) > heightCharts) {
+ let kF = (radius2 * 2 + depth) / heightCharts;
+ radius1 = radius1 / kF;
+ radius2 = radius2 / kF;
+ depth = depth / kF;
+ }
- //console.log(" this.aspectRatioX: " + this.aspectRatioX + " this.aspectRatioY: " + this.aspectRatioY + " this.scaleX: " + this.scaleX + " this.scaleY: " + this.scaleY);
+ //ToDo временная правка для круговой диграммы с углом поворота 0 градусов
+ if (0 === radius2) {
+ radius2 = 1;
+ }
- return {x: projectionPoint.x, y: projectionPoint.y};
-};
+ return {radius1: radius1, radius2: radius2, depth: depth};
+ };
-Processor3D.prototype.calculatePropertiesForPieCharts = function () {
- var sinAngleOx = Math.sin(-this.angleOx);
- var cosAngleOx = Math.cos(-this.angleOx);
-
- var widthCharts = this.widthCanvas - this.left - this.right;
- var heightCharts = this.heightCanvas - this.bottom - this.top;
- var radius1 = widthCharts / 2;
- var radius2 = radius1 * sinAngleOx;
- var depth = ((widthCharts + 4.89) / 8.37) * cosAngleOx;
-
- if ((radius2 * 2 + depth) > heightCharts) {
- var kF = (radius2 * 2 + depth) / heightCharts;
- radius1 = radius1 / kF;
- radius2 = radius2 / kF;
- depth = depth / kF;
- }
- //ToDo временная правка для круговой диграммы с углом поворота 0 градусов
- if (0 === radius2) {
- radius2 = 1;
- }
+ //***functions for matrix transformation***
+ Processor3D.prototype._shearXY = function () {
+ if (null === this.matrixShearXY) {
+ this.matrixShearXY = new Matrix4D();
- return {radius1: radius1, radius2: radius2, depth: depth};
-};
+ this.matrixShearXY.a31 = Math.sin(-this.angleOy);
+ this.matrixShearXY.a32 = Math.sin(this.angleOx);
+ this.matrixShearXY.a33 = 0;
+ this.matrixShearXY.a44 = 0;
+ }
+ return this.matrixShearXY;
+ };
+ Processor3D.prototype._shearXY2 = function () {
+ if (null === this.matrixShearXY) {
+ this.matrixShearXY = [[1, 0, 0, 0], [0, 1, 0, 0], [Math.sin(-this.angleOy), Math.sin(this.angleOx), 0, 0], [0, 0, 0, 0]];
+ }
+ return this.matrixShearXY;
+ };
-//***functions for matrix transformation***
-Processor3D.prototype._shearXY = function () {
- if (null === this.matrixShearXY) {
- this.matrixShearXY = new Matrix4D();
+ Processor3D.prototype._getMatrixRotateAllAxis = function () {
+ let matrixRotateOY = this._getMatrixRotateOy();
+ let matrixRotateOX = this._getMatrixRotateOx();
- this.matrixShearXY.a31 = Math.sin(-this.angleOy);
- this.matrixShearXY.a32 = Math.sin(this.angleOx);
- this.matrixShearXY.a33 = 0;
- this.matrixShearXY.a44 = 0;
- }
+ /*result matrix
- return this.matrixShearXY;
-};
-Processor3D.prototype._shearXY2 = function () {
- if (null === this.matrixShearXY) {
- this.matrixShearXY = [[1, 0, 0, 0], [0, 1, 0, 0], [Math.sin(-this.angleOy), Math.sin(this.angleOx), 0, 0], [0, 0, 0, 0]];
- }
- return this.matrixShearXY;
-};
+ |cosOy 0 sinOy 0|
+ |sinOx * sinOy cosOx -sinOx * cosOy 0|
+ |-sinOy * cosOx sinOx cosOy * cosOx 0|
+ |-sinOy 0 (cosOy + 1) 1|*/
-Processor3D.prototype._getMatrixRotateAllAxis = function () {
- var matrixRotateOY = this._getMatrixRotateOy();
- var matrixRotateOX = this._getMatrixRotateOx();
+ if (null === this.matrixRotateAllAxis) {
+ this.matrixRotateAllAxis = matrixRotateOY.multiply(matrixRotateOX);
+ }
- /*итоговая матрица
+ return this.matrixRotateAllAxis;
+ };
- |cosOy 0 sinOy 0|
- |sinOx * sinOy cosOx -sinOx * cosOy 0|
- |-sinOy * cosOx sinOx cosOy * cosOx 0|
- |-sinOy 0 (cosOy + 1) 1|*/
+ Processor3D.prototype._getMatrixRotateOx = function () {
+ //todo array -> Float32Array ?
+ if (null === this.matrixRotateOx) {
+ this.matrixRotateOx =
+ new Matrix4D()/*[[1, 0, 0, 0], [0, Math.cos(-this.angleOx), Math.sin(-this.angleOx), 0], [0, - Math.sin(-this.angleOx), Math.cos(-this.angleOx), 1], [0, 0, 0, 1]]*/;
- if (null === this.matrixRotateAllAxis) {
- this.matrixRotateAllAxis = matrixRotateOY.multiply(matrixRotateOX);
- }
+ let cos = Math.cos(-this.angleOx);
+ let sin = Math.sin(-this.angleOx);
- return this.matrixRotateAllAxis;
-};
+ this.matrixRotateOx.a22 = cos;
+ this.matrixRotateOx.a23 = sin;
+ this.matrixRotateOx.a32 = -sin;
+ this.matrixRotateOx.a33 = cos;
+ this.matrixRotateOx.a34 = 1;
+ }
-Processor3D.prototype._getMatrixRotateOx = function () {
- //todo посмотреть возможность заменить массивы на Float32Array
- if (null === this.matrixRotateOx) {
- this.matrixRotateOx = new Matrix4D()/*[[1, 0, 0, 0], [0, Math.cos(-this.angleOx), Math.sin(-this.angleOx), 0], [0, - Math.sin(-this.angleOx), Math.cos(-this.angleOx), 1], [0, 0, 0, 1]]*/;
+ return this.matrixRotateOx;
+ };
- var cos = Math.cos(-this.angleOx);
- var sin = Math.sin(-this.angleOx);
+ Processor3D.prototype._getMatrixRotateOy = function () {
+ if (null === this.matrixRotateOy) {
+ this.matrixRotateOy =
+ new Matrix4D()/*[[Math.cos(-this.angleOy), 0, -Math.sin(-this.angleOy), 0], [0, 1, 0, 0], [Math.sin(-this.angleOy), 0, Math.cos(-this.angleOy), 1], [0, 0, 0, 1]]*/;
- this.matrixRotateOx.a22 = cos;
- this.matrixRotateOx.a23 = sin;
- this.matrixRotateOx.a32 = -sin;
- this.matrixRotateOx.a33 = cos;
- this.matrixRotateOx.a34 = 1;
- }
+ let cos = Math.cos(-this.angleOy);
+ let sin = Math.sin(-this.angleOy);
- return this.matrixRotateOx;
-};
+ this.matrixRotateOy.a11 = cos;
+ this.matrixRotateOy.a13 = -sin;
+ this.matrixRotateOy.a31 = sin;
+ this.matrixRotateOy.a33 = cos;
+ this.matrixRotateOy.a34 = 1;
+ }
-Processor3D.prototype._getMatrixRotateOy = function () {
- if (null === this.matrixRotateOy) {
- this.matrixRotateOy = new Matrix4D()/*[[Math.cos(-this.angleOy), 0, -Math.sin(-this.angleOy), 0], [0, 1, 0, 0], [Math.sin(-this.angleOy), 0, Math.cos(-this.angleOy), 1], [0, 0, 0, 1]]*/;
+ return this.matrixRotateOy;
+ };
- var cos = Math.cos(-this.angleOy);
- var sin = Math.sin(-this.angleOy);
+ Processor3D.prototype._getMatrixRotateOz = function () {
+ return [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
+ };
- this.matrixRotateOy.a11 = cos;
- this.matrixRotateOy.a13 = -sin;
- this.matrixRotateOy.a31 = sin;
- this.matrixRotateOy.a33 = cos;
- this.matrixRotateOy.a34 = 1;
- }
+ Processor3D.prototype._getPerspectiveProjectionMatrix = function (fov) {
+ /*let zf = this.rPerspective + this.depthPerspective;
+ let zn = this.rPerspective;
+ let q = zf / (zf - zn);
+ return [[1 / Math.tan(this.rPerspective / 2), 0, 0, 0], [0, 1 / Math.tan(this.rPerspective / 2), 0, 0], [0, 0, q, 1], [0, 0, -q * zn, 0]];*/
+ //[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1 / fov], [0, 0, 0, 1]]
+ if (null === this.projectMatrix) {
+ this.projectMatrix = new Matrix4D();
+ this.projectMatrix.a33 = 0;
+ this.projectMatrix.a34 = 1 / fov;
+ }
- return this.matrixRotateOy;
-};
+ return this.projectMatrix;
+ };
-Processor3D.prototype._getMatrixRotateOz = function () {
- return [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
-};
+ Processor3D.prototype.correctPointsPosition = function (chartSpace) {
+ if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Pie) {
+ return;
+ }
-Processor3D.prototype._getPerspectiveProjectionMatrix = function (fov) {
- /*var zf = this.rPerspective + this.depthPerspective;
- var zn = this.rPerspective;
- var q = zf / (zf - zn);
- return [[1 / Math.tan(this.rPerspective / 2), 0, 0, 0], [0, 1 / Math.tan(this.rPerspective / 2), 0, 0], [0, 0, q, 1], [0, 0, -q * zn, 0]];*/
- //[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1 / fov], [0, 0, 0, 1]]
- if (null === this.projectMatrix) {
- this.projectMatrix = new Matrix4D();
- this.projectMatrix.a33 = 0;
- this.projectMatrix.a34 = 1 / fov;
- }
+ let pxToMM = 1 / AscCommon.g_dKoef_pix_to_mm;
+ let t = this;
+ //коррективы для подписей
+ let xPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.catAx ? chartSpace.chart.plotArea.catAx.xPoints : null;
+ if (!xPoints) {
+ xPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.valAx ? chartSpace.chart.plotArea.valAx.xPoints : null;
+ }
- return this.projectMatrix;
-};
+ let coordYAxisOx = chartSpace.chart.plotArea.catAx && chartSpace.chart.plotArea.catAx.posY;
+ if (!coordYAxisOx && chartSpace.chart.plotArea.valAx) {
+ coordYAxisOx = chartSpace.chart.plotArea.valAx.posY != undefined ? chartSpace.chart.plotArea.valAx.posY : chartSpace.chart.plotArea.valAx.posY;
+ }
-Processor3D.prototype.correctPointsPosition = function (chartSpace) {
- if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Pie)
- return;
+ let yPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.valAx ? chartSpace.chart.plotArea.valAx.yPoints : null;
+ if (!yPoints) {
+ yPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.catAx ? chartSpace.chart.plotArea.catAx.yPoints : null;
+ }
- var pxToMM = 1 / AscCommon.g_dKoef_pix_to_mm;
- var t = this;
- //коррективы для подписей
- var xPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.catAx ? chartSpace.chart.plotArea.catAx.xPoints : null;
- if (!xPoints)
- xPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.valAx ? chartSpace.chart.plotArea.valAx.xPoints : null;
+ let coordXAxisOy;
+ if (chartSpace.chart.plotArea.catAx) {
+ coordXAxisOy = chartSpace.chart.plotArea.catAx.posX ? chartSpace.chart.plotArea.catAx.posX : chartSpace.chart.plotArea.catAx.xPos;
+ }
+ if (!coordXAxisOy && chartSpace.chart.plotArea.valAx) {
+ coordXAxisOy = chartSpace.chart.plotArea.valAx.posX != undefined ? chartSpace.chart.plotArea.valAx.posX : null;
+ }
- var coordYAxisOx = chartSpace.chart.plotArea.catAx.posY;
- if (!coordYAxisOx)
- coordYAxisOx = chartSpace.chart.plotArea.valAx.posY != undefined ? chartSpace.chart.plotArea.valAx.posY : chartSpace.chart.plotArea.valAx.posY;
+ let correctPointsOx = function () {
+ let z = t.calculateZPositionCatAxis();
+ let valCatAx = chartSpace.chart.plotArea.catAx;
+ if (!valCatAx.transformXPoints) {
+ valCatAx.transformXPoints = [];
+ }
- var yPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.valAx ? chartSpace.chart.plotArea.valAx.yPoints : null;
- if (!yPoints)
- yPoints = chartSpace.chart.plotArea && chartSpace.chart.plotArea.catAx ? chartSpace.chart.plotArea.catAx.yPoints : null;
+ for (let i = 0; i < xPoints.length; i++) {
+ let widthText = 0;
+ if (valCatAx && valCatAx.labels && t.orientationValAx !== ORIENTATION_MIN_MAX) {
+ widthText = valCatAx.labels.extY * pxToMM;
+ }
- var coordXAxisOy = chartSpace.chart.plotArea.catAx.posX ? chartSpace.chart.plotArea.catAx.posX : chartSpace.chart.plotArea.catAx.xPos;
- if (!coordXAxisOy)
- coordXAxisOy = chartSpace.chart.plotArea.valAx.posX != undefined ? chartSpace.chart.plotArea.valAx.posX : null;
+ let point = t.convertAndTurnPoint(xPoints[i].pos * pxToMM, coordYAxisOx * pxToMM - widthText, z);
- var correctPointsOx = function () {
- var z = t.calculateZPositionCatAxis();
- var valCatAx = chartSpace.chart.plotArea.catAx;
- if (!valCatAx.transformXPoints)
- valCatAx.transformXPoints = [];
+ valCatAx.transformXPoints[i] = {x: point.x / pxToMM, y: point.y / pxToMM};
+ }
+ };
- for (var i = 0; i < xPoints.length; i++) {
- var widthText = 0;
- if (valCatAx && valCatAx.labels && t.orientationValAx !== ORIENTATION_MIN_MAX)
- widthText = valCatAx.labels.extY * pxToMM;
+ let correctPointsOxHBar = function () {
+ let z = t.calculateZPositionValAxis();
+ let valCatAx = chartSpace.chart.plotArea.valAx;
+ if (!valCatAx.transformXPoints) {
+ valCatAx.transformXPoints = [];
+ }
- var point = t.convertAndTurnPoint(xPoints[i].pos * pxToMM, coordYAxisOx * pxToMM - widthText, z);
+ for (let i = 0; i < xPoints.length; i++) {
+ let widthText = 0;
+ if (t.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && valCatAx && valCatAx.labels && t.orientationCatAx !== ORIENTATION_MIN_MAX) {
+ widthText = valCatAx.labels.extY * pxToMM;
+ }
- valCatAx.transformXPoints[i] = {x: point.x / pxToMM, y: point.y / pxToMM};
- }
- };
+ let point = t.convertAndTurnPoint(xPoints[i].pos * pxToMM, coordYAxisOx * pxToMM - widthText, z);
- var correctPointsOxHBar = function () {
- var z = t.calculateZPositionValAxis();
- var valCatAx = chartSpace.chart.plotArea.valAx;
- if (!valCatAx.transformXPoints)
- valCatAx.transformXPoints = [];
+ valCatAx.transformXPoints[i] = {x: point.x / pxToMM, y: point.y / pxToMM};
+ }
+ };
- for (var i = 0; i < xPoints.length; i++) {
- var widthText = 0;
- if (t.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && valCatAx && valCatAx.labels && t.orientationCatAx !== ORIENTATION_MIN_MAX)
- widthText = valCatAx.labels.extY * pxToMM;
+ let correctPointsOy = function () {
+ let zPosition = t.calculateZPositionValAxis();
+ let valCatAx = chartSpace.chart.plotArea.valAx;
- var point = t.convertAndTurnPoint(xPoints[i].pos * pxToMM, coordYAxisOx * pxToMM - widthText, z);
+ if (!valCatAx.transformYPoints) {
+ valCatAx.transformYPoints = [];
+ }
- valCatAx.transformXPoints[i] = {x: point.x / pxToMM, y: point.y / pxToMM};
- }
- };
+ for (let i = 0; i < yPoints.length; i++) {
+ let point = t.convertAndTurnPoint(coordXAxisOy * pxToMM, yPoints[i].pos * (pxToMM), zPosition);
- var correctPointsOy = function () {
- var zPosition = t.calculateZPositionValAxis();
- var valCatAx = chartSpace.chart.plotArea.valAx;
+ //TODO значения высчитать
+ let widthText = 5;
+ if (valCatAx && valCatAx.labels) {
+ widthText = valCatAx.labels.extX * pxToMM;
+ }
- if (!valCatAx.transformYPoints)
- valCatAx.transformYPoints = [];
+ if (t.orientationCatAx !== ORIENTATION_MIN_MAX) {
+ widthText = 0;
+ }
- for (var i = 0; i < yPoints.length; i++) {
- var point = t.convertAndTurnPoint(coordXAxisOy * pxToMM, yPoints[i].pos * (pxToMM), zPosition);
+ let diffXText = 0;
+ let angleOyAbs = Math.abs(t.angleOy);
+ if (!t.view3D.getRAngAx() && (angleOyAbs >= Math.PI / 2 && angleOyAbs < 3 * Math.PI / 2)) {
+ diffXText = -diffXText;
+ }
- //TODO значения высчитать
- var widthText = 5;
- if (valCatAx && valCatAx.labels)
- widthText = valCatAx.labels.extX * pxToMM;
+ valCatAx.transformYPoints[i] = {
+ x: (point.x - (diffXText + widthText)) / pxToMM, y: point.y / pxToMM
+ };
+ }
+ };
- if (t.orientationCatAx !== ORIENTATION_MIN_MAX) {
- widthText = 0;
+ let correctPointsOyHBar = function () {
+ let zPosition = t.calculateZPositionCatAxis();
+ let valCatAx = chartSpace.chart.plotArea.catAx;
+ if (!valCatAx.transformYPoints) {
+ valCatAx.transformYPoints = [];
}
- var diffXText = 0;
- var angleOyAbs = Math.abs(t.angleOy);
- if (!t.view3D.getRAngAx() && (angleOyAbs >= Math.PI / 2 && angleOyAbs < 3 * Math.PI / 2))
- diffXText = -diffXText;
+ for (let i = 0; i < yPoints.length; i++) {
+ let point = t.convertAndTurnPoint(coordXAxisOy * pxToMM, yPoints[i].pos * (pxToMM), zPosition);
- valCatAx.transformYPoints[i] = {
- x: (point.x - (diffXText + widthText)) / pxToMM,
- y: point.y / pxToMM
- };
- }
- };
+ //TODO значения высчитать
+ let widthText = 0;
+ if (valCatAx && valCatAx.labels) {
+ widthText = valCatAx.labels.extX * pxToMM;
+ }
- var correctPointsOyHBar = function () {
- var zPosition = t.calculateZPositionCatAxis();
- var valCatAx = chartSpace.chart.plotArea.catAx;
- if (!valCatAx.transformYPoints)
- valCatAx.transformYPoints = [];
+ if (t.orientationValAx !== ORIENTATION_MIN_MAX) {
+ widthText -= 10;
+ } else {
+ widthText += 5;
+ }
- for (var i = 0; i < yPoints.length; i++) {
- var point = t.convertAndTurnPoint(coordXAxisOy * pxToMM, yPoints[i].pos * (pxToMM), zPosition);
+ valCatAx.transformYPoints[i] = {x: (point.x - widthText) / pxToMM, y: point.y / pxToMM};
+ }
+ };
- //TODO значения высчитать
- var widthText = 0;
- if (valCatAx && valCatAx.labels)
- widthText = valCatAx.labels.extX * pxToMM;
- if (t.orientationValAx !== ORIENTATION_MIN_MAX) {
- widthText -= 10;
+ if (xPoints) {
+ if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar) {
+ correctPointsOx(xPoints);
} else {
- widthText += 5;
+ correctPointsOxHBar(xPoints);
}
+ }
- valCatAx.transformYPoints[i] = {x: (point.x - widthText) / pxToMM, y: point.y / pxToMM};
+ if (yPoints) {
+ if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar) {
+ correctPointsOy(yPoints);
+ } else {
+ correctPointsOyHBar(yPoints);
+ }
}
};
+ Processor3D.prototype._calculatePerspective = function (view3D) {
+ let heightLine = this.heightCanvas - (this.top + this.bottom);
- if (xPoints) {
- if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar)
- correctPointsOx(xPoints);
- else
- correctPointsOxHBar(xPoints);
- }
+ let perspective = view3D && view3D.perspective ? view3D.perspective : global3DPersperctive;
+ if (view3D && 0 === view3D.perspective && this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface) {
+ perspective = 1;
+ }
- if (yPoints) {
- if (this.chartsDrawer.calcProp.type !== AscFormat.c_oChartTypes.HBar)
- correctPointsOy(yPoints);
- else
- correctPointsOyHBar(yPoints);
- }
-};
+ let alpha = perspective / 4;//в xml проиходит двойной угол(в параметрах ms стоит 40, приходит в xml 80)
+ //TODO this.top - this.bottom пересмотреть
+ let catt = ((heightLine / 2 + (Math.abs(this.top - this.bottom)))) / Math.tan((alpha / 360) * (Math.PI * 2));
+ let rPerspective;
+ if (catt === 0) {
+ rPerspective = 0;
+ } else {
+ rPerspective = 1 / catt;
+ }
-Processor3D.prototype._calculatePerspective = function (view3D) {
- var heightLine = this.heightCanvas - (this.top + this.bottom);
+ this.rPerspective = rPerspective;
+ };
- var perspective = view3D && view3D.perspective ? view3D.perspective : global3DPersperctive;
- if (view3D && 0 === view3D.perspective && this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface) {
- perspective = 1;
- }
+ Processor3D.prototype._calculateDepth = function () {
+ let widthOriginalChart = this.widthCanvas - (this.left + this.right);
+ let heightOriginalChart = this.heightCanvas - (this.top + this.bottom);
+ let subType = this.chartsDrawer.calcProp.subType;
+ let type = this.chartsDrawer.calcProp.type;
+ let defaultOverlap = (subType === "stacked" || subType === "stackedPer" || subType === "standard" || type === AscFormat.c_oChartTypes.Line || type ===
+ AscFormat.c_oChartTypes.Area || type === AscFormat.c_oChartTypes.Surface) ? 100 : 0;
+ let overlap = AscFormat.isRealNumber(this.chartSpace.chart.plotArea.chart.overlap) ? (this.chartSpace.chart.plotArea.chart.overlap / 100) : (defaultOverlap / 100);
+ let gapWidth = this.chartSpace.chart.plotArea.chart.gapWidth != null ? (this.chartSpace.chart.plotArea.chart.gapWidth / 100) : (150 / 100);
+ let gapDepth = this.chartSpace.chart.plotArea.chart.gapDepth != null ? (this.chartSpace.chart.plotArea.chart.gapDepth / 100) :
+ type === AscFormat.c_oChartTypes.Area && subType !== "normal" ? 1 : (150 / 100);
+
+ let seriesProps = this.chartsDrawer.calculateFirstChartCountSeries();
+ let seriesCount = seriesProps.series;
+ let ptCount = seriesProps.points;
+
+ let sinOx = Math.abs(Math.sin(-this.angleOx));
+ let sinOy = Math.sin(-this.angleOy);
+ let hPercent = type === AscFormat.c_oChartTypes.HBar ? 1 : this.hPercent;
+ let depthPercent = this._getDepthPercent();
+ let t = this;
+
+ let areaStackedKf = (type === AscFormat.c_oChartTypes.Area && subType !== "normal") || type === AscFormat.c_oChartTypes.Surface ? (ptCount / (2 * (ptCount - 1))) : 1;
+
+ let depth = 0;
+ let chartWidth = 0;
+
+ let standardType = false;
+ if (subType === "standard" || type === AscFormat.c_oChartTypes.Line || (type === AscFormat.c_oChartTypes.Area && subType === "normal") ||
+ (type === AscFormat.c_oChartTypes.Surface)) {
+ standardType = true;
+ }
- var alpha = perspective / 4;//в xml проиходит двойной угол(в параметрах ms стоит 40, приходит в xml 80)
- //TODO this.top - this.bottom пересмотреть
- var catt = ((heightLine / 2 + (Math.abs(this.top - this.bottom)))) / Math.tan((alpha / 360) * (Math.PI * 2));
- var rPerspective;
- if (catt === 0)
- rPerspective = 0;
- else
- rPerspective = 1 / catt;
+ let heightHPercent = heightOriginalChart / hPercent;
+ let angleOxKf;
+ if (!standardType) {
+ let widthOneBar = ((heightHPercent / seriesCount) / (ptCount - (ptCount - 1) * (overlap) + gapWidth)) * sinOy;
+ let a, b;
- this.rPerspective = rPerspective;
-};
+ if (this.angleOx === 0 && this.angleOy === 0)//withoutAngleNoAuto + withoutAngleAuto
+ {
+ chartWidth = widthOneBar + heightHPercent;
+ } else if (this.angleOx !== 0)//AngleOYNoAut + AngleOYNoAutPerHeight + (ANGLEOX+ANGLEOY) + AngleOYOXNoAut + ANGLEOXANGLEOYHPerDPer(ANGLEOX+ANGLEOY HPercent)
+ {
+ //если выставить ширину 255 будет так же, как и в документе с расчётами
+ b = (seriesCount - (seriesCount - 1) * overlap + gapWidth);
+ a = (depthPercent / (ptCount * b)) / hPercent;
+ let width = heightOriginalChart * areaStackedKf;
+ depth = (width * a + gapDepth * width * a) / (1 / sinOx + (gapDepth) * a + a);
+
+ chartWidth = heightHPercent - depth;
+ } else if (this.angleOy !== 0)//angleOxNoAuto
+ {
+ //если выставить ширину = 321.25 будет так же, как и в документе с расчётам
+ //TODO глубина с некоторыми графиками имеет различия, пересчитать!
+ let widthChart = (widthOriginalChart / t.aspectRatioX) / t.specialStandardScaleX;
-Processor3D.prototype._calculateDepth = function () {
- var widthOriginalChart = this.widthCanvas - (this.left + this.right);
- var heightOriginalChart = this.heightCanvas - (this.top + this.bottom);
- var subType = this.chartsDrawer.calcProp.subType;
- var type = this.chartsDrawer.calcProp.type;
- var defaultOverlap = (subType == "stacked" || subType == "stackedPer" || subType == "standard" || type == AscFormat.c_oChartTypes.Line || type == AscFormat.c_oChartTypes.Area || type == AscFormat.c_oChartTypes.Surface) ? 100 : 0;
- var overlap = AscFormat.isRealNumber(this.chartSpace.chart.plotArea.chart.overlap) ? (this.chartSpace.chart.plotArea.chart.overlap / 100) : (defaultOverlap / 100);
- var gapWidth = this.chartSpace.chart.plotArea.chart.gapWidth != null ? (this.chartSpace.chart.plotArea.chart.gapWidth / 100) : (150 / 100);
- var gapDepth = this.chartSpace.chart.plotArea.chart.gapDepth != null ? (this.chartSpace.chart.plotArea.chart.gapDepth / 100) : type === AscFormat.c_oChartTypes.Area && subType !== "normal" ? 1 : (150 / 100);
- var seriesCount = this.chartsDrawer.calcProp.seriesCount;
- var ptCount = this.chartsDrawer.calcProp.ptCount;
- var sinOx = Math.abs(Math.sin(-this.angleOx));
- var sinOy = Math.sin(-this.angleOy);
- var hPercent = type == AscFormat.c_oChartTypes.HBar ? 1 : this.hPercent;
- var depthPercent = this._getDepthPercent();
- var t = this;
-
- var areaStackedKf = (type === AscFormat.c_oChartTypes.Area && subType !== "normal") || type === AscFormat.c_oChartTypes.Surface ? (ptCount / (2 * (ptCount - 1))) : 1;
-
- var depth = 0;
- var chartWidth = 0;
-
- var standardType = false;
- if (subType == "standard" || type == AscFormat.c_oChartTypes.Line || (type == AscFormat.c_oChartTypes.Area && subType == "normal") || (type === AscFormat.c_oChartTypes.Surface))
- standardType = true;
-
- var heightHPercent = heightOriginalChart / hPercent;
- var angleOxKf;
- if (!standardType) {
- var widthOneBar = ((heightHPercent / seriesCount) / (ptCount - (ptCount - 1) * (overlap) + gapWidth)) * sinOy;
- var a, b;
-
- if (this.angleOx === 0 && this.angleOy === 0)//withoutAngleNoAuto + withoutAngleAuto
- {
- chartWidth = widthOneBar + heightHPercent;
- } else if (this.angleOx !== 0)//AngleOYNoAut + AngleOYNoAutPerHeight + (ANGLEOX+ANGLEOY) + AngleOYOXNoAut + ANGLEOXANGLEOYHPerDPer(ANGLEOX+ANGLEOY HPercent)
- {
- //если выставить ширину 255 будет так же, как и в документе с расчётами
- b = (seriesCount - (seriesCount - 1) * overlap + gapWidth);
- a = (depthPercent / (ptCount * b)) / hPercent;
- var width = heightOriginalChart * areaStackedKf;
- depth = (width * a + gapDepth * width * a) / (1 / sinOx + (gapDepth) * a + a);
-
- chartWidth = heightHPercent - depth;
- } else if (this.angleOy !== 0)//angleOxNoAuto
- {
- //если выставить ширину = 321.25 будет так же, как и в документе с расчётам
- //TODO глубина с некоторыми графиками имеет различия, пересчитать!
- var widthChart = (widthOriginalChart / t.aspectRatioX) / t.specialStandardScaleX;
+ b = (seriesCount - (seriesCount - 1) * overlap + gapWidth);
+ if (subType === "standard" || type === AscFormat.c_oChartTypes.Line || type === AscFormat.c_oChartTypes.Area || type === AscFormat.c_oChartTypes.Surface) {
+ b = b / seriesCount;
+ }
- b = (seriesCount - (seriesCount - 1) * overlap + gapWidth);
- if (subType == "standard" || type == AscFormat.c_oChartTypes.Line || type == AscFormat.c_oChartTypes.Area || type === AscFormat.c_oChartTypes.Surface)
- b = b / seriesCount;
+ angleOxKf = sinOx === 0 ? 1 : sinOx;
+ a = depthPercent / (ptCount * b);
+ depth = (widthChart * a + gapDepth * widthChart * a) / (1 / angleOxKf + (gapDepth) * a + a);
- angleOxKf = sinOx === 0 ? 1 : sinOx;
- a = depthPercent / (t.chartsDrawer.calcProp.ptCount * b);
- depth = (widthChart * a + gapDepth * widthChart * a) / (1 / angleOxKf + (gapDepth) * a + a);
+ depth = depth / angleOxKf;
+ }
+ } else//allStandardDepth
+ {
+ angleOxKf = sinOx === 0 ? 0 : sinOx;
- depth = depth / angleOxKf;
- }
- } else//allStandardDepth
- {
- angleOxKf = sinOx === 0 ? 0 : sinOx;
+ if (type === AscFormat.c_oChartTypes.Area) {
+ depth =
+ (depthPercent / (angleOxKf * depthPercent + ((ptCount + (Math.floor((seriesCount - ptCount) / 2 - 0.5))) / seriesCount * hPercent))) * (heightOriginalChart);
+ } else {
+ depth = (depthPercent / (angleOxKf * depthPercent + ((ptCount + (Math.floor((seriesCount - ptCount) / 2))) / seriesCount * hPercent))) * (heightOriginalChart);
+ }
- if (type == AscFormat.c_oChartTypes.Area)
- depth = (depthPercent / (angleOxKf * depthPercent + ((ptCount + (Math.floor((seriesCount - ptCount) / 2 - 0.5))) / seriesCount * hPercent))) * (heightOriginalChart);
- else
- depth = (depthPercent / (angleOxKf * depthPercent + ((ptCount + (Math.floor((seriesCount - ptCount) / 2))) / seriesCount * hPercent))) * (heightOriginalChart);
+ if ((this.angleOx !== 0)) {
+ depth = depth * Math.sin(-this.angleOx);
+ }
+ }
- if ((this.angleOx !== 0))
- depth = depth * Math.sin(-this.angleOx);
- }
+ return sinOx !== 0 ? Math.abs(depth / sinOx) : Math.abs(depth);
+ };
- return sinOx !== 0 ? Math.abs(depth / sinOx) : Math.abs(depth);
-};
+ Processor3D.prototype._calculateDepthPerspective = function () {
+ let widthCanvas = this.widthCanvas;
+ let widthOriginalChart = widthCanvas - (this.left + this.right);
-Processor3D.prototype._calculateDepthPerspective = function () {
- var widthCanvas = this.widthCanvas;
- var widthOriginalChart = widthCanvas - (this.left + this.right);
+ let aspectRatio = this.aspectRatioX / (this.specialStandardScaleX);
+ let widthChart = widthOriginalChart / aspectRatio;
+ widthChart = widthChart / this.scaleX;
- var aspectRatio = this.aspectRatioX / (this.specialStandardScaleX);
- var widthChart = widthOriginalChart / aspectRatio;
- widthChart = widthChart / this.scaleX;
+ let countSeries = this.chartsDrawer.calculateFirstChartCountSeries();
+ let seriesCount = countSeries.series;
+ let ptCount = countSeries.points;
- var seriesCount = this.chartsDrawer.calcProp.seriesCount;
+ let width = widthChart / ptCount;
- var width = widthChart / this.chartsDrawer.calcProp.ptCount;
+ let isNormalArea = (this.chartsDrawer.calcProp.subType === "normal" && this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area) ||
+ this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface;
- var isNormalArea = (this.chartsDrawer.calcProp.subType == "normal" && this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area) || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface;
+ let defaultOverlap = (this.chartsDrawer.calcProp.subType === "stacked" || this.chartsDrawer.calcProp.subType === "stackedPer" || this.chartsDrawer.calcProp.subType ===
+ "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || isNormalArea) ? 100 : 0;
+ let overlap = AscFormat.isRealNumber(this.chartSpace.chart.plotArea.chart.overlap) ? (this.chartSpace.chart.plotArea.chart.overlap / 100) : (defaultOverlap / 100);
- var defaultOverlap = (this.chartsDrawer.calcProp.subType == "stacked" || this.chartsDrawer.calcProp.subType == "stackedPer" || this.chartsDrawer.calcProp.subType == "standard" || this.chartsDrawer.calcProp.type == AscFormat.c_oChartTypes.Line || isNormalArea) ? 100 : 0;
- var overlap = AscFormat.isRealNumber(this.chartSpace.chart.plotArea.chart.overlap) ? (this.chartSpace.chart.plotArea.chart.overlap / 100) : (defaultOverlap / 100);
+ let gapWidth = this.chartSpace.chart.plotArea.chart.gapWidth != null ? (this.chartSpace.chart.plotArea.chart.gapWidth / 100) : (150 / 100);
+ let gapDepth = this.chartSpace.chart.plotArea.chart.gapDepth != null ? (this.chartSpace.chart.plotArea.chart.gapDepth / 100) : (150 / 100);
- var gapWidth = this.chartSpace.chart.plotArea.chart.gapWidth != null ? (this.chartSpace.chart.plotArea.chart.gapWidth / 100) : (150 / 100);
- var gapDepth = this.chartSpace.chart.plotArea.chart.gapDepth != null ? (this.chartSpace.chart.plotArea.chart.gapDepth / 100) : (150 / 100);
+ if (AscFormat.c_oChartTypes.Area === this.chartsDrawer.calcProp.type || AscFormat.c_oChartTypes.Surface === this.chartsDrawer.calcProp.type) {
+ gapWidth = 0;
+ gapDepth = 0;
+ }
- if (AscFormat.c_oChartTypes.Area === this.chartsDrawer.calcProp.type || AscFormat.c_oChartTypes.Surface === this.chartsDrawer.calcProp.type) {
- gapWidth = 0;
- gapDepth = 0;
- }
+ let baseDepth = width / (seriesCount - (seriesCount - 1) * overlap + gapWidth);
+ if (this.chartsDrawer.calcProp.subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || isNormalArea) {
+ baseDepth = (width / (seriesCount - (seriesCount - 1) * overlap + gapWidth)) * seriesCount;
+ }
- var baseDepth = width / (seriesCount - (seriesCount - 1) * overlap + gapWidth);
- if (this.chartsDrawer.calcProp.subType == "standard" || this.chartsDrawer.calcProp.type == AscFormat.c_oChartTypes.Line || isNormalArea)
- baseDepth = (width / (seriesCount - (seriesCount - 1) * overlap + gapWidth)) * seriesCount;
+ let basePercent = this._getDepthPercent();
+ let depth = baseDepth * basePercent;
+ depth = depth + depth * gapDepth;
- //процент от базовой глубины
- var basePercent = this._getDepthPercent();
- var depth = baseDepth * basePercent;
- depth = depth + depth * gapDepth;
+ if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.hPercent !== null) {
+ depth = this.hPercent * depth;
+ }
- if (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.HBar && this.hPercent !== null) {
- depth = this.hPercent * depth;
- }
+ //TODO глубина в некоторых случаях отличается(тип Standard)
+ if (this.chartsDrawer.calcProp.subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || isNormalArea) {
+ let b = 1 / seriesCount;
- //TODO глубина в некоторых случаях отличается(тип Standard)
- if (this.chartsDrawer.calcProp.subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || isNormalArea) {
- var b = 1 / seriesCount;
+ let sinOx = Math.sin(-this.angleOx);
+ let angleOxKf = 1;
+ let a = basePercent / (ptCount * b);
+ depth = (widthChart * a + widthChart * a) / (1 / angleOxKf + a);
- var sinOx = Math.sin(-this.angleOx);
- var angleOxKf = 1;
- var a = basePercent / (this.chartsDrawer.calcProp.ptCount * b);
- depth = (widthChart * a + widthChart * a) / (1 / angleOxKf + a);
+ depth = depth / angleOxKf;
+ }
- depth = depth / angleOxKf;
- }
+ return depth;
+ };
- return depth;
-};
+ Processor3D.prototype._calcSpecialStandardScaleX = function () {
+ let type = this.chartsDrawer.calcProp.type;
+ let subType = this.chartsDrawer.calcProp.subType;
+ if (!(subType === "standard" || type === AscFormat.c_oChartTypes.Line || (type === AscFormat.c_oChartTypes.Area && subType === "normal") || type ===
+ AscFormat.c_oChartTypes.Surface)) {
+ return;
+ }
-Processor3D.prototype._calcSpecialStandardScaleX = function () {
- if (!(this.chartsDrawer.calcProp.subType == "standard" || this.chartsDrawer.calcProp.type == AscFormat.c_oChartTypes.Line || (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && this.chartsDrawer.calcProp.subType == "normal") || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface))
- return;
+ let countSeries = this.chartsDrawer.calculateFirstChartCountSeries();
+ let seriesCount = countSeries.series;
+ let ptCount = countSeries.points;
- //calculate width in 3d standard charts with rAngAx
- var n = Math.floor((this.chartsDrawer.calcProp.seriesCount + this.chartsDrawer.calcProp.ptCount) / 2);
- var kf = this.chartsDrawer.calcProp.ptCount / n;
+ //calculate width in 3d standard charts with rAngAx
+ let n = Math.floor((seriesCount + ptCount) / 2);
+ let kf = ptCount / n;
- this.specialStandardScaleX = 1 / kf;
-};
+ this.specialStandardScaleX = 1 / kf;
+ };
-Processor3D.prototype._calculateScaleFromDepth = function (/*isSkip*/) {
- //***Calculate scaleY***
- if (this.view3D.getRAngAx() && this.aspectRatioY === 1) {
- var heightCanvas = this.heightCanvas;
- var heightChart = heightCanvas - this.top - this.bottom;
-
- this.scaleY = heightChart / (-this.depthPerspective * Math.sin(Math.abs(this.angleOx)) + heightChart);
- //меняется ширина в зависимости от количества значений
- //if(this.chartsDrawer.calcProp.subType == "standard")
- //this.scaleX += parseInt((this.chartsDrawer.calcProp.seriesCount + 1) / 2) - 1;
-
- var subType = this.chartsDrawer.calcProp.subType;
- var newDepth, newWidth;
- if (!(subType == "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface || (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && subType == "normal"))) {
- newDepth = this.depthPerspective * Math.sin(-this.angleOx);
- newWidth = heightChart - newDepth;
- this.scaleX = heightChart / newWidth;
+ Processor3D.prototype._calculateScaleFromDepth = function (/*isSkip*/) {
+ //***Calculate scaleY***
+ if (this.view3D.getRAngAx() && this.aspectRatioY === 1) {
+ let heightCanvas = this.heightCanvas;
+ let heightChart = heightCanvas - this.top - this.bottom;
+
+ this.scaleY = heightChart / (-this.depthPerspective * Math.sin(Math.abs(this.angleOx)) + heightChart);
+
+ let subType = this.chartsDrawer.calcProp.subType;
+ let newDepth, newWidth;
+ if (!(subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || this.chartsDrawer.calcProp.type ===
+ AscFormat.c_oChartTypes.Surface || (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && subType === "normal"))) {
+ newDepth = this.depthPerspective * Math.sin(-this.angleOx);
+ newWidth = heightChart - newDepth;
+ this.scaleX = heightChart / newWidth;
+ }
}
- }
-};
-
-Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/) {
- //глубина по OZ
- var perspectiveDepth = this.depthPerspective;
+ };
- var widthCanvas = this.widthCanvas;
- var originalWidthChart = widthCanvas - this.left - this.right;
+ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/) {
+ //глубина по OZ
+ let perspectiveDepth = this.depthPerspective;
- var heightCanvas = this.heightCanvas;
- var heightChart = heightCanvas - this.top - this.bottom;
+ let widthCanvas = this.widthCanvas;
+ let originalWidthChart = widthCanvas - this.left - this.right;
- //add test points for parallelepiped rect
- var points = [];
- var faces = [];
+ let heightCanvas = this.heightCanvas;
+ let heightChart = heightCanvas - this.top - this.bottom;
- /*if(AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type)
- {
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
- points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart, this.top, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top, 0, this));
+ //add test points for parallelepiped rect
+ let points = [];
+ let faces = [];
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, perspectiveDepth, this));
- points.push(new Point3D(this.left, this.top + heightChart, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart, this.top + heightChart, perspectiveDepth / 2, this));
- points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
- }
- else
- {*/
- points.push(new Point3D(this.left, this.top, perspectiveDepth, this));
- points.push(new Point3D(this.left, heightChart + this.top, perspectiveDepth, this));
- points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, perspectiveDepth, this));
- points.push(new Point3D(originalWidthChart + this.left, this.top, perspectiveDepth, this));
- points.push(new Point3D(originalWidthChart + this.left, this.top, 0, this));
- points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, 0, this));
- points.push(new Point3D(this.left, heightChart + this.top, 0, this));
- points.push(new Point3D(this.left, this.top, 0, this));
- //}
-
- faces.push([0, 1, 2, 3]);
- faces.push([2, 5, 4, 3]);
- faces.push([1, 6, 7, 0]);
- faces.push([6, 5, 4, 7]);
- faces.push([7, 4, 3, 0]);
- faces.push([1, 6, 2, 5]);
-
-
- //***Calculate cameraDiffZ***
- if (!this.view3D.getRAngAx()) {
- //быстрая функция поиска сдвигов камеры
- //console.time("sdf");
- this._calculateCameraDiffZX(points, faces);
- //console.timeEnd("sdf");
- }
+ /*if(AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type)
+ {
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
+ points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart, this.top, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top, 0, this));
+
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, perspectiveDepth, this));
+ points.push(new Point3D(this.left, this.top + heightChart, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart, this.top + heightChart, perspectiveDepth / 2, this));
+ points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
+ }
+ else
+ {*/
+ points.push(new Point3D(this.left, this.top, perspectiveDepth, this));
+ points.push(new Point3D(this.left, heightChart + this.top, perspectiveDepth, this));
+ points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, perspectiveDepth, this));
+ points.push(new Point3D(originalWidthChart + this.left, this.top, perspectiveDepth, this));
+ points.push(new Point3D(originalWidthChart + this.left, this.top, 0, this));
+ points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, 0, this));
+ points.push(new Point3D(this.left, heightChart + this.top, 0, this));
+ points.push(new Point3D(this.left, this.top, 0, this));
+ //}
+
+ faces.push([0, 1, 2, 3]);
+ faces.push([2, 5, 4, 3]);
+ faces.push([1, 6, 7, 0]);
+ faces.push([6, 5, 4, 7]);
+ faces.push([7, 4, 3, 0]);
+ faces.push([1, 6, 2, 5]);
+
+
+ //***Calculate cameraDiffZ***
+ if (!this.view3D.getRAngAx()) {
+ //быстрая функция поиска сдвигов камеры
+ //console.time("sdf");
+ this._calculateCameraDiffZX(points, faces);
+ //console.timeEnd("sdf");
+ }
- //***Calculate cameraDiffX***
- if (this.view3D.getRAngAx()) {
- var minMaxOx = this._getMinMaxOx(points, faces);
- this._calculateCameraDiffX(minMaxOx);
+ //***Calculate cameraDiffX***
+ if (this.view3D.getRAngAx()) {
+ let minMaxOx = this._getMinMaxOx(points, faces);
+ this._calculateCameraDiffX(minMaxOx);
- //***Calculate cameraDiffY***
- var minMaxOy = this._getMinMaxOy(points, faces);
- this._calculateCameraDiffY(minMaxOy.top, minMaxOy.bottom);
- }
-};
+ //***Calculate cameraDiffY***
+ let minMaxOy = this._getMinMaxOy(points, faces);
+ this._calculateCameraDiffY(minMaxOy.top, minMaxOy.bottom);
+ }
+ };
-Processor3D.prototype._calculateCameraDiffZX = function (newPoints) {
- var heightChart = this.heightCanvas - this.top - this.bottom;
- var widthOriginalChart = this.widthCanvas - this.left - this.right;
- var heightOriginalChart = heightChart;
+ Processor3D.prototype._calculateCameraDiffZX = function (newPoints) {
+ let heightChart = this.heightCanvas - this.top - this.bottom;
+ let widthOriginalChart = this.widthCanvas - this.left - this.right;
+ let heightOriginalChart = heightChart;
- var minX = null;
- var maxX = null;
- var minZ = null;
+ let minX = null;
+ let maxX = null;
+ let minZ = null;
- var aspectRatio = (widthOriginalChart) / (heightOriginalChart);
+ let aspectRatio = (widthOriginalChart) / (heightOriginalChart);
- for (var i = 0; i < newPoints.length; i++) {
- var point3D = new Point3D(newPoints[i].x, newPoints[i].y, newPoints[i].z, this);
+ for (let i = 0; i < newPoints.length; i++) {
+ let point3D = new Point3D(newPoints[i].x, newPoints[i].y, newPoints[i].z, this);
- point3D.scale(aspectRatio, 1, 1);
- point3D.offset((-this.widthCanvas / 2) / aspectRatio, (-this.heightCanvas / 2), 0);
+ point3D.scale(aspectRatio, 1, 1);
+ point3D.offset((-this.widthCanvas / 2) / aspectRatio, (-this.heightCanvas / 2), 0);
- //rotate
- var matrixRotateAllAxis = this._getMatrixRotateAllAxis();
- point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
+ //rotate
+ let matrixRotateAllAxis = this._getMatrixRotateAllAxis();
+ point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
- if (minZ === null || point3D.z < minZ)
- minZ = point3D.z;
+ if (minZ === null || point3D.z < minZ) {
+ minZ = point3D.z;
+ }
- if (minX === null || point3D.x < minX)
- minX = point3D.x;
+ if (minX === null || point3D.x < minX) {
+ minX = point3D.x;
+ }
- if (maxX === null || point3D.x > maxX)
- maxX = point3D.x;
- }
+ if (maxX === null || point3D.x > maxX) {
+ maxX = point3D.x;
+ }
+ }
- //get min and max point's and diffX
- /*if(-t.angleOx === 0)
- {
- var minMaxOx = this._getMinMaxOxPoints(newPoints, minZ);
- this.cameraDiffZ = - minZ;
- this.cameraDiffX = - minMaxOx.diffX;
+ //get min and max point's and diffX
+ /*if(-t.angleOx === 0)
+ {
+ let minMaxOx = this._getMinMaxOxPoints(newPoints, minZ);
+ this.cameraDiffZ = - minZ;
+ this.cameraDiffX = - minMaxOx.diffX;
- var x111 = this.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- var x222 = this.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ let x111 = this.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ let x222 = this.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- if(Math.abs(x222.x - x111.x) > widthOriginalChart)
- {
- var correctOffset;
- if(x222.x > x111.x)
+ if(Math.abs(x222.x - x111.x) > widthOriginalChart)
{
- correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ let correctOffset;
+ if(x222.x > x111.x)
+ {
+ correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ }
+ else
+ {
+ correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ }
+
+ this.cameraDiffZ = Math.abs(correctOffset.minZ);
+ this.cameraDiffX = correctOffset.diffX;
}
- else
+ }
+ else if(-t.angleOy === 0 && -t.angleOx !== 0)
+ {
+ let minMaxOy = this._getMinMaxOyPoints(newPoints, minZ);
+ this.cameraDiffZ = - minZ;
+ this.cameraDiffY = -minMaxOy.diffY;
+
+ let y111 = this.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ let y222 = this.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+
+ if(Math.abs(y111.y - y222.y) < heightOriginalChart)
{
- correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
- }
+ let minMaxOx = this._getMinMaxOxPoints(newPoints, minZ);
+ let x111 = this.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ let x222 = this.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+
+ let correctOffset;
+ if(x222.x > x111.x)
+ {
+ correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ }
+ else
+ {
+ correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ }
- this.cameraDiffZ = Math.abs(correctOffset.minZ);
- this.cameraDiffX = correctOffset.diffX;
- }
- }
- else if(-t.angleOy === 0 && -t.angleOx !== 0)
- {
- var minMaxOy = this._getMinMaxOyPoints(newPoints, minZ);
- this.cameraDiffZ = - minZ;
- this.cameraDiffY = -minMaxOy.diffY;
+ this.cameraDiffZ = Math.abs(correctOffset.minZ);
+ this.cameraDiffX = correctOffset.diffX;
- var y111 = this.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- var y222 = this.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- if(Math.abs(y111.y - y222.y) < heightOriginalChart)
+ let minMaxOy = this._getMinMaxOyPoints(newPoints, 0);
+ //this.cameraDiffZ = - minZ;
+ this.cameraDiffY = -minMaxOy.diffY;
+ }
+ }*/
+ /*else if(-t.angleOy !== 0 && -t.angleOx !== 0)
{
- var minMaxOx = this._getMinMaxOxPoints(newPoints, minZ);
- var x111 = this.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- var x222 = this.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ let minMaxOx = this._getMinMaxOxPoints(newPoints, minZ);
+ let x111 = this.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ let x222 = this.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- var correctOffset;
+ let correctOffset;
if(x222.x > x111.x)
{
correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
}
else
{
- correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ correctOffset = this._correctZPosition4(minMaxOx.tempX2, minMaxOx.tempX1, minMaxOx.tempZ2, minMaxOx.tempZ1, minZ, minMaxOx.tempY2, minMaxOx.tempY1);
}
- this.cameraDiffZ = Math.abs(correctOffset.minZ);
+ this.cameraDiffZ = correctOffset.minZ;
this.cameraDiffX = correctOffset.diffX;
+ let minMaxOy = this._getMinMaxOyPoints2(newPoints, this.cameraDiffZ);
+ this.cameraDiffY = minMaxOy.diffY;
- var minMaxOy = this._getMinMaxOyPoints(newPoints, 0);
- //this.cameraDiffZ = - minZ;
- this.cameraDiffY = -minMaxOy.diffY;
- }
- }*/
- /*else if(-t.angleOy !== 0 && -t.angleOx !== 0)
- {
- var minMaxOx = this._getMinMaxOxPoints(newPoints, minZ);
- var x111 = this.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- var x222 = this.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
-
- var correctOffset;
- if(x222.x > x111.x)
- {
- correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, minZ, minMaxOx.tempY1, minMaxOx.tempY2);
- }
- else
- {
- correctOffset = this._correctZPosition4(minMaxOx.tempX2, minMaxOx.tempX1, minMaxOx.tempZ2, minMaxOx.tempZ1, minZ, minMaxOx.tempY2, minMaxOx.tempY1);
- }
-
- this.cameraDiffZ = correctOffset.minZ;
- this.cameraDiffX = correctOffset.diffX;
+ console.log(" tempX1: " + minMaxOy.tempX1 + " tempX2: " + minMaxOy.tempX2 + " tempY1: " + minMaxOy.tempY1 + " tempY2: " + minMaxOy.tempY2 + " tempZ1: " + minMaxOy.tempZ1 + " tempZ2: " + minMaxOy.tempZ2);
- var minMaxOy = this._getMinMaxOyPoints2(newPoints, this.cameraDiffZ);
- this.cameraDiffY = minMaxOy.diffY;
+ let y111 = this.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ let y222 = this.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- console.log(" tempX1: " + minMaxOy.tempX1 + " tempX2: " + minMaxOy.tempX2 + " tempY1: " + minMaxOy.tempY1 + " tempY2: " + minMaxOy.tempY2 + " tempZ1: " + minMaxOy.tempZ1 + " tempZ2: " + minMaxOy.tempZ2);
-
- var y111 = this.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- var y222 = this.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+ if(y111.y < this.top || y222.y > this.top + heightOriginalChart)
+ {
+ //correctOffset = this._correctZPositionOY(minMaxOy.tempX1, minMaxOy.tempX2, minMaxOy.tempZ1, minMaxOy.tempZ2, minZ, minMaxOy.tempY1, minMaxOy.tempY2);
+ this.cameraDiffZ = minMaxOy.diffZ;
+ //this.cameraDiffY = minMaxOy.diffY;
- if(y111.y < this.top || y222.y > this.top + heightOriginalChart)
- {
- //correctOffset = this._correctZPositionOY(minMaxOy.tempX1, minMaxOy.tempX2, minMaxOy.tempZ1, minMaxOy.tempZ2, minZ, minMaxOy.tempY1, minMaxOy.tempY2);
- this.cameraDiffZ = minMaxOy.diffZ;
- //this.cameraDiffY = minMaxOy.diffY;
+ let minMaxOx = this._getMinMaxOxPoints(newPoints, -this.cameraDiffZ);
+ //correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, -this.cameraDiffZ, minMaxOx.tempY1, minMaxOx.tempY2);
+ this.cameraDiffX = -minMaxOx.diffX;
+ }
- var minMaxOx = this._getMinMaxOxPoints(newPoints, -this.cameraDiffZ);
- //correctOffset = this._correctZPosition4(minMaxOx.tempX1, minMaxOx.tempX2, minMaxOx.tempZ1, minMaxOx.tempZ2, -this.cameraDiffZ, minMaxOx.tempY1, minMaxOx.tempY2);
- this.cameraDiffX = -minMaxOx.diffX;
- }
+ //TODO пока включаю для поворотов по OX + по OY checkOutSideArea(медленная функция), затем нужно переделать, используя закомментированный код сверху
+ this.cameraDiffZ = -minZ;
+ //this.cameraDiffX = -minMaxOx.diffX;
+ this.checkOutSideArea(newPoints);
+ }*/
- //TODO пока включаю для поворотов по OX + по OY checkOutSideArea(медленная функция), затем нужно переделать, используя закомментированный код сверху
+ //TODO пока включаю для ВСЕГО checkOutSideArea(медленная функция), затем нужно переделать, используя закомментированный код сверху
this.cameraDiffZ = -minZ;
- //this.cameraDiffX = -minMaxOx.diffX;
- this.checkOutSideArea(newPoints);
- }*/
-
- //TODO пока включаю для ВСЕГО checkOutSideArea(медленная функция), затем нужно переделать, используя закомментированный код сверху
- this.cameraDiffZ = -minZ;
- this.checkOutSideArea2(newPoints);
+ this.checkOutSideArea2(newPoints);
-};
+ };
//TODO если будут проблемы при маштабировании, вернуть функцию checkOutSideArea2 вместо checkOutSideArea
-Processor3D.prototype.checkOutSideArea2 = function (newPoints) {
- var i = 0;
- var maxI = 1000;
- var t = this;
-
- var heightChart = this.heightCanvas - this.top - this.bottom;
- var widthChart = this.widthCanvas - this.left - this.right;
+ Processor3D.prototype.checkOutSideArea2 = function (newPoints) {
+ let i = 0;
+ let maxI = 1000;
+ let t = this;
- var calculateZ = function (step) {
- var minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
- t.cameraDiffX = -minMaxOx.diffX;
- var x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- var x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ let heightChart = this.heightCanvas - this.top - this.bottom;
+ let widthChart = this.widthCanvas - this.left - this.right;
- var diffX = Math.abs(x222.x - x111.x);
-
- var minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
- t.cameraDiffY = -minMaxOy.diffY;
- var y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- var y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+ let calculateZ = function (step) {
+ let minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
+ t.cameraDiffX = -minMaxOx.diffX;
+ let x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ let x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- var diffY = Math.abs(y222.y - y111.y);
+ let diffX = Math.abs(x222.x - x111.x);
- if (diffX < widthChart && diffY < heightChart)//if size less then width or height
- {
- while (diffX < widthChart && diffY < heightChart) {
- t.cameraDiffZ -= step;
- i++;
- minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
- t.cameraDiffX = -minMaxOx.diffX;
+ let minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
+ t.cameraDiffY = -minMaxOy.diffY;
+ let y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ let y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- diffX = Math.abs(x222.x - x111.x);
+ let diffY = Math.abs(y222.y - y111.y);
- minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
- t.cameraDiffY = -minMaxOy.diffY;
- y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- diffY = Math.abs(y222.y - y111.y);
-
- if (i > maxI)
- break;
+ if (diffX < widthChart && diffY < heightChart)//if size less then width or height
+ {
+ while (diffX < widthChart && diffY < heightChart) {
+ t.cameraDiffZ -= step;
+ i++;
+ minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
+ t.cameraDiffX = -minMaxOx.diffX;
+
+ x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ diffX = Math.abs(x222.x - x111.x);
+
+ minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
+ t.cameraDiffY = -minMaxOy.diffY;
+ y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+ diffY = Math.abs(y222.y - y111.y);
+
+ if (i > maxI) {
+ break;
+ }
+ }
+ } else if (diffX > widthChart || diffY > heightChart)//if size more then width or height
+ {
+ while (diffX > widthChart || diffY > heightChart) {
+ t.cameraDiffZ += step;
+ i++;
+ minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
+ t.cameraDiffX = -minMaxOx.diffX;
+
+ x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ diffX = Math.abs(x222.x - x111.x);
+
+ minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
+ t.cameraDiffY = -minMaxOy.diffY;
+ y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+ diffY = Math.abs(y222.y - y111.y);
+
+ if (i > maxI) {
+ break;
+ }
+ }
}
- } else if (diffX > widthChart || diffY > heightChart)//if size more then width or height
- {
- while (diffX > widthChart || diffY > heightChart) {
- t.cameraDiffZ += step;
- i++;
- minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
- t.cameraDiffX = -minMaxOx.diffX;
-
- x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- diffX = Math.abs(x222.x - x111.x);
-
- minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
- t.cameraDiffY = -minMaxOy.diffY;
- y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- diffY = Math.abs(y222.y - y111.y);
+ };
- if (i > maxI)
- break;
- }
- }
+ calculateZ(100);
+ calculateZ(10);
+ calculateZ(1);
};
- calculateZ(100);
- calculateZ(10);
- calculateZ(1);
-
-};
+ Processor3D.prototype.checkOutSideArea = function (newPoints) {
+ let t = this;
-Processor3D.prototype.checkOutSideArea = function (newPoints) {
- var t = this;
-
- var heightChart = this.heightCanvas - this.top - this.bottom;
- var widthChart = this.widthCanvas - this.left - this.right;
- var DELTA = 3;
- var maxCount = 1000;
- var calculateZ = function () {
- var minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
- t.cameraDiffX = -minMaxOx.diffX;
- var x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- var x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ let heightChart = this.heightCanvas - this.top - this.bottom;
+ let widthChart = this.widthCanvas - this.left - this.right;
+ let DELTA = 3;
+ let maxCount = 1000;
+ let calculateZ = function () {
+ let minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
+ t.cameraDiffX = -minMaxOx.diffX;
+ let x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ let x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- var diffX = Math.abs(x222.x - x111.x);
+ let diffX = Math.abs(x222.x - x111.x);
- var minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
- t.cameraDiffY = -minMaxOy.diffY;
- var y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- var y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+ let minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
+ t.cameraDiffY = -minMaxOy.diffY;
+ let y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ let y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- var diffY = Math.abs(y222.y - y111.y);
+ let diffY = Math.abs(y222.y - y111.y);
- if (diffX <= widthChart && diffY <= heightChart && ((widthChart - diffX) < DELTA || (heightChart - diffY) < DELTA)) {
- return;
- }
-
- var count = 0;
- var fStart = t.cameraDiffZ ? t.cameraDiffZ : 1;
- var fLeftDiffZ, fRightDiffZ;
- if (diffX < widthChart && diffY < heightChart) {
- fLeftDiffZ = 0;
- fRightDiffZ = t.cameraDiffZ;
- } else {
- fLeftDiffZ = t.cameraDiffZ;
- while (diffX >= widthChart || diffY >= heightChart) {
- count++;
- t.cameraDiffZ += fStart / 2;
- minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
- t.cameraDiffX = -minMaxOx.diffX;
- x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
- diffX = Math.abs(x222.x - x111.x);
- minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
- t.cameraDiffY = -minMaxOy.diffY;
- y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- diffY = Math.abs(y222.y - y111.y);
-
- if (count > maxCount) {
- return;
- }
- }
if (diffX <= widthChart && diffY <= heightChart && ((widthChart - diffX) < DELTA || (heightChart - diffY) < DELTA)) {
return;
}
- fRightDiffZ = t.cameraDiffZ;
- }
-
- while ((diffX > widthChart || diffY > heightChart) || (fRightDiffZ - fLeftDiffZ) > DELTA) {
- t.cameraDiffZ = fLeftDiffZ + ((fRightDiffZ - fLeftDiffZ) / 2);
-
- count++;
- minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
- t.cameraDiffX = -minMaxOx.diffX;
- var x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
- var x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
-
-
- var diffX = Math.abs(x222.x - x111.x);
-
- var minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
- t.cameraDiffY = -minMaxOy.diffY;
- var y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
- var y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
-
- var diffY = Math.abs(y222.y - y111.y);
+ let count = 0;
+ let fStart = t.cameraDiffZ ? t.cameraDiffZ : 1;
+ let fLeftDiffZ, fRightDiffZ;
if (diffX < widthChart && diffY < heightChart) {
- if (((widthChart - diffX) < DELTA) || ((heightChart - diffY) < DELTA)) {
- break;
- }
+ fLeftDiffZ = 0;
fRightDiffZ = t.cameraDiffZ;
} else {
fLeftDiffZ = t.cameraDiffZ;
+ while (diffX >= widthChart || diffY >= heightChart) {
+ count++;
+ t.cameraDiffZ += fStart / 2;
+ minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
+ t.cameraDiffX = -minMaxOx.diffX;
+ x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+ diffX = Math.abs(x222.x - x111.x);
+ minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
+ t.cameraDiffY = -minMaxOy.diffY;
+ y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
+ diffY = Math.abs(y222.y - y111.y);
+
+ if (count > maxCount) {
+ return;
+ }
+ }
+ if (diffX <= widthChart && diffY <= heightChart && ((widthChart - diffX) < DELTA || (heightChart - diffY) < DELTA)) {
+ return;
+ }
+ fRightDiffZ = t.cameraDiffZ;
}
- if (count > maxCount) {
- return;
- }
- }
- };
- calculateZ();
+ while ((diffX > widthChart || diffY > heightChart) || (fRightDiffZ - fLeftDiffZ) > DELTA) {
+ t.cameraDiffZ = fLeftDiffZ + ((fRightDiffZ - fLeftDiffZ) / 2);
+
+ count++;
+ minMaxOx = t._getMinMaxOxPoints(newPoints, -t.cameraDiffZ);
+ t.cameraDiffX = -minMaxOx.diffX;
+ let x111 = t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1, minMaxOx.tempZ1);
+ let x222 = t.convertAndTurnPoint(minMaxOx.tempX2, minMaxOx.tempY2, minMaxOx.tempZ2);
+
-};
+ let diffX = Math.abs(x222.x - x111.x);
-Processor3D.prototype._getMinMaxOxPoints = function (points, minZ) {
- var fov = 1 / this.rPerspective;
+ let minMaxOy = t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);
+ t.cameraDiffY = -minMaxOy.diffY;
+ let y111 = t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1, minMaxOy.tempZ1);
+ let y222 = t.convertAndTurnPoint(minMaxOy.tempX2, minMaxOy.tempY2, minMaxOy.tempZ2);
- var t = this;
- var aspectRatioX = this.aspectRatioX;
- var aspectRatioY = this.aspectRatioY;
+ let diffY = Math.abs(y222.y - y111.y);
+ if (diffX < widthChart && diffY < heightChart) {
+ if (((widthChart - diffX) < DELTA) || ((heightChart - diffY) < DELTA)) {
+ break;
+ }
+ fRightDiffZ = t.cameraDiffZ;
+ } else {
+ fLeftDiffZ = t.cameraDiffZ;
+ }
+ if (count > maxCount) {
+ return;
+ }
+ }
+ };
- var diffAndRotatePoint = function (point) {
- var point3D = new Point3D(point.x, point.y, point.z, t);
+ calculateZ();
- point3D.scale(aspectRatioX, aspectRatioY, 1);
- point3D.offset((-t.widthCanvas / 2) / aspectRatioX, (-t.heightCanvas / 2) / aspectRatioY /** aspectRatio*/, 0);
+ };
- //rotate
- var matrixRotateAllAxis = t._getMatrixRotateAllAxis();
- point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
+ Processor3D.prototype._getMinMaxOxPoints = function (points, minZ) {
+ let fov = 1 / this.rPerspective;
- return point3D;
- };
+ let t = this;
+ let aspectRatioX = this.aspectRatioX;
+ let aspectRatioY = this.aspectRatioY;
- var calculateDiffX = function (x1, x2, z1, z2, minZ, y1, y2) {
- var diffAndScalePoints1 = t.diffAndScale(x1, y1, z1);
- x1 = diffAndScalePoints1.x;
- y1 = diffAndScalePoints1.y;
- z1 = diffAndScalePoints1.z;
- var rotatePoints1 = t.rotate(x1, y1, z1);
+ let diffAndRotatePoint = function (point) {
+ let point3D = new Point3D(point.x, point.y, point.z, t);
- var a1 = rotatePoints1.x;
- //var x1S = a1 - diffX;
- var z1S = rotatePoints1.z - minZ;
- //var x1SS = (fov * x1S / (z1S + fov)) + w / 2;
+ point3D.scale(aspectRatioX, aspectRatioY, 1);
+ point3D.offset((-t.widthCanvas / 2) / aspectRatioX, (-t.heightCanvas / 2) / aspectRatioY /** aspectRatio*/, 0);
+ //rotate
+ let matrixRotateAllAxis = t._getMatrixRotateAllAxis();
+ point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
- var diffAndScalePoints2 = t.diffAndScale(x2, y2, z2);
- x2 = diffAndScalePoints2.x;
- y2 = diffAndScalePoints2.y;
- z2 = diffAndScalePoints2.z;
+ return point3D;
+ };
- var rotatePoints2 = t.rotate(x2, y2, z2);
+ let calculateDiffX = function (x1, x2, z1, z2, minZ, y1, y2) {
+ let diffAndScalePoints1 = t.diffAndScale(x1, y1, z1);
+ x1 = diffAndScalePoints1.x;
+ y1 = diffAndScalePoints1.y;
+ z1 = diffAndScalePoints1.z;
- var a2 = rotatePoints2.x;
- //var x2S = a2 - diffX;
- var z2S = rotatePoints2.z - minZ;
- //var x2SS = (fov * x2S / (z2S + fov)) + w / 2;
+ let rotatePoints1 = t.rotate(x1, y1, z1);
- return (-a1 * z2S - a1 * fov - a2 * z1S - a2 * fov) / (-z2S - fov - z1S - fov);
- };
+ let a1 = rotatePoints1.x;
+ //let x1S = a1 - diffX;
+ let z1S = rotatePoints1.z - minZ;
+ //let x1SS = (fov * x1S / (z1S + fov)) + w / 2;
- var w = t.widthCanvas;
+ let diffAndScalePoints2 = t.diffAndScale(x2, y2, z2);
+ x2 = diffAndScalePoints2.x;
+ y2 = diffAndScalePoints2.y;
+ z2 = diffAndScalePoints2.z;
- var tempArray = this._getArrayAllVergeCube(points);
+ let rotatePoints2 = t.rotate(x2, y2, z2);
- var x11, x22, y11, y22, z11, z22;
- var tempX1, tempY1, tempZ1, tempX2, tempY2, tempZ2, start, end;
- for (var i = 0; i < tempArray.length - 1; i++) {
- start = i;
- end = i + 1;
- x11 = tempArray[start].x - (t.widthCanvas / 2);
- x22 = tempArray[end].x - (t.widthCanvas / 2);
+ let a2 = rotatePoints2.x;
+ //let x2S = a2 - diffX;
+ let z2S = rotatePoints2.z - minZ;
+ //let x2SS = (fov * x2S / (z2S + fov)) + w / 2;
- y11 = tempArray[start].y - (t.heightCanvas / 2);
- y22 = tempArray[end].y - (t.heightCanvas / 2);
+ return (-a1 * z2S - a1 * fov - a2 * z1S - a2 * fov) / (-z2S - fov - z1S - fov);
+ };
- z11 = tempArray[start].z;
- z22 = tempArray[end].z;
- tempX1 = tempArray[start].x;
- tempY1 = tempArray[start].y;
- tempZ1 = tempArray[start].z;
+ let w = t.widthCanvas;
- tempX2 = tempArray[end].x;
- tempY2 = tempArray[end].y;
- tempZ2 = tempArray[end].z;
+ let tempArray = this._getArrayAllVergeCube(points);
- if (x11 > x22) {
- start = i + 1;
- end = i;
+ let diffX;
+ let x11, x22, y11, y22, z11, z22;
+ let tempX1, tempY1, tempZ1, tempX2, tempY2, tempZ2, start, end;
+ for (let i = 0; i < tempArray.length - 1; i++) {
+ start = i;
+ end = i + 1;
x11 = tempArray[start].x - (t.widthCanvas / 2);
x22 = tempArray[end].x - (t.widthCanvas / 2);
@@ -1563,151 +1581,147 @@ Processor3D.prototype._getMinMaxOxPoints = function (points, minZ) {
tempX2 = tempArray[end].x;
tempY2 = tempArray[end].y;
tempZ2 = tempArray[end].z;
- }
+ if (x11 > x22) {
+ start = i + 1;
+ end = i;
+ x11 = tempArray[start].x - (t.widthCanvas / 2);
+ x22 = tempArray[end].x - (t.widthCanvas / 2);
- var diffX = calculateDiffX(tempX1, tempX2, tempZ1, tempZ2, minZ, tempY1, tempY2);
+ y11 = tempArray[start].y - (t.heightCanvas / 2);
+ y22 = tempArray[end].y - (t.heightCanvas / 2);
- var projectiveMatrix = t._getPerspectiveProjectionMatrix(1 / (t.rPerspective));
+ z11 = tempArray[start].z;
+ z22 = tempArray[end].z;
- var rotatePoint1 = diffAndRotatePoint(tempArray[start]);
- rotatePoint1.offset(-diffX, 0, -minZ);
- rotatePoint1 = rotatePoint1.project(projectiveMatrix);
- var x1 = Math.floor(rotatePoint1.x + t.widthCanvas / 2);
+ tempX1 = tempArray[start].x;
+ tempY1 = tempArray[start].y;
+ tempZ1 = tempArray[start].z;
+ tempX2 = tempArray[end].x;
+ tempY2 = tempArray[end].y;
+ tempZ2 = tempArray[end].z;
+ }
- var rotatePoint2 = diffAndRotatePoint(tempArray[end]);
- rotatePoint2.offset(-diffX, 0, -minZ);
- rotatePoint2 = rotatePoint2.project(projectiveMatrix);
- var x2 = Math.floor(rotatePoint2.x + t.widthCanvas / 2);
- var leftMargin = x1;
- var rightMargin = Math.floor(w - x2);
- if (!((leftMargin >= rightMargin - 1) && (leftMargin <= rightMargin + 1)))
- continue;
+ diffX = calculateDiffX(tempX1, tempX2, tempZ1, tempZ2, minZ, tempY1, tempY2);
- var isTrue = true;
- for (var l = 0; l < tempArray.length - 1; l++) {
- var rotatePoint = diffAndRotatePoint(tempArray[l]);
- rotatePoint.offset(-diffX, 0, -minZ);
- rotatePoint = rotatePoint.project(projectiveMatrix);
- var tempX11 = Math.floor(rotatePoint.x + t.widthCanvas / 2);
+ let projectiveMatrix = t._getPerspectiveProjectionMatrix(1 / (t.rPerspective));
+ let rotatePoint1 = diffAndRotatePoint(tempArray[start]);
+ rotatePoint1.offset(-diffX, 0, -minZ);
+ rotatePoint1 = rotatePoint1.project(projectiveMatrix);
+ let x1 = Math.floor(rotatePoint1.x + t.widthCanvas / 2);
- if (x1 < x2) {
- if (tempX11 < x1 || tempX11 > x2) {
- isTrue = false;
- break;
- }
- } else {
- if (tempX11 > x1 || tempX11 < x2) {
- isTrue = false;
- break;
- }
- }
- }
- if (isTrue)
- break;
- }
+ let rotatePoint2 = diffAndRotatePoint(tempArray[end]);
+ rotatePoint2.offset(-diffX, 0, -minZ);
+ rotatePoint2 = rotatePoint2.project(projectiveMatrix);
+ let x2 = Math.floor(rotatePoint2.x + t.widthCanvas / 2);
- return {
- diffX: diffX,
- tempX1: tempX1,
- tempY1: tempY1,
- tempZ1: tempZ1,
- tempX2: tempX2,
- tempY2: tempY2,
- tempZ2: tempZ2,
- x11: x11,
- z11: z11,
- x22: x22,
- z22: z22,
- y11: y11,
- y22: y22
- };
-};
+ let leftMargin = x1;
+ let rightMargin = Math.floor(w - x2);
+ if (!((leftMargin >= rightMargin - 1) && (leftMargin <= rightMargin + 1))) {
+ continue;
+ }
-Processor3D.prototype._getMinMaxOyPoints = function (points, minZ) {
- var fov = 1 / this.rPerspective;
+ let isTrue = true;
+ for (let l = 0; l < tempArray.length - 1; l++) {
+ let rotatePoint = diffAndRotatePoint(tempArray[l]);
+ rotatePoint.offset(-diffX, 0, -minZ);
+ rotatePoint = rotatePoint.project(projectiveMatrix);
+ let tempX11 = Math.floor(rotatePoint.x + t.widthCanvas / 2);
- var t = this;
- var h = t.heightCanvas;
- var w = t.widthCanvas;
+ if (x1 < x2) {
+ if (tempX11 < x1 || tempX11 > x2) {
+ isTrue = false;
+ break;
+ }
+ } else {
+ if (tempX11 > x1 || tempX11 < x2) {
+ isTrue = false;
+ break;
+ }
+ }
+ }
- var calculateDiffY = function (x1, x2, y1, y2, z1, z2, minZ) {
- //var cos1 = Math.cos(-t.angleOy);
- //var sin1 = Math.sin(-t.angleOy);
- var diffY = 0;
+ if (isTrue) {
+ break;
+ }
+ }
- var diffAndScalePoints = t.diffAndScale(x1, y1, z1);
- var x1 = diffAndScalePoints.x;
- var y1 = diffAndScalePoints.y;
- var z1 = diffAndScalePoints.z;
+ return {
+ diffX: diffX, tempX1: tempX1, tempY1: tempY1, tempZ1: tempZ1, tempX2: tempX2, tempY2: tempY2, tempZ2: tempZ2, x11: x11, z11: z11, x22: x22, z22: z22, y11: y11, y22: y22
+ };
+ };
+ Processor3D.prototype._getMinMaxOyPoints = function (points, minZ) {
+ let fov = 1 / this.rPerspective;
+ let t = this;
+ let h = t.heightCanvas;
- var rotatePoints = t.rotate(x1, y1, z1);
+ let calculateDiffY = function (x1, x2, y1, y2, z1, z2, minZ) {
+ //let cos1 = Math.cos(-t.angleOy);
+ //let sin1 = Math.sin(-t.angleOy);
+ let diffY = 0;
- var a1 = rotatePoints.y;
- //var y1S = (a1 - diffY);
- var z1S = rotatePoints.z + minZ;
+ let diffAndScalePoints = t.diffAndScale(x1, y1, z1);
+ x1 = diffAndScalePoints.x;
+ y1 = diffAndScalePoints.y;
+ z1 = diffAndScalePoints.z;
- //var x1SS = (fov * y1S / (z1S + fov)) + h / 2;
+ let rotatePoints = t.rotate(x1, y1, z1);
- diffAndScalePoints = t.diffAndScale(x2, y2, z2);
- x2 = diffAndScalePoints.x;
- y2 = diffAndScalePoints.y;
- z2 = diffAndScalePoints.z;
+ let a1 = rotatePoints.y;
+ //let y1S = (a1 - diffY);
+ let z1S = rotatePoints.z + minZ;
- rotatePoints = t.rotate(x2, y2, z2);
+ //let x1SS = (fov * y1S / (z1S + fov)) + h / 2;
- var a2 = rotatePoints.y;
- //var y2S = (a2 - diffY);
- var z2S = rotatePoints.z + minZ;
- //var x2SS = (fov * y2S / (z2S + fov)) + h / 2;
+ diffAndScalePoints = t.diffAndScale(x2, y2, z2);
+ x2 = diffAndScalePoints.x;
+ y2 = diffAndScalePoints.y;
+ z2 = diffAndScalePoints.z;
- //var topMargin = (fov * y1S / (z1S + fov)) + h / 2;
- //var bottomMargin = h - ((fov * y2S / (z2S + fov)) + h / 2);
+ rotatePoints = t.rotate(x2, y2, z2);
+ let a2 = rotatePoints.y;
+ //let y2S = (a2 - diffY);
+ let z2S = rotatePoints.z + minZ;
- //((a1 - diffY) / (z1S + fov)) = - (((a2 - diffY) / (z2S + fov)))
+ //let x2SS = (fov * y2S / (z2S + fov)) + h / 2;
- /*(a1 - diffY) * (z2S + fov) = -(z1S + fov) * (a2 - diffY)
+ //let topMargin = (fov * y1S / (z1S + fov)) + h / 2;
+ //let bottomMargin = h - ((fov * y2S / (z2S + fov)) + h / 2);
- a1 * z2S + a1 * fov - diffY * z2S - diffY * fov = -z1S * a2 + z1S * diffY - fov * a2 + fov * diffY
- a1 * z2S + a1 * fov + fov * a2 + z1S * a2= diffY * z2S + diffY * fov + z1S * diffY + fov * diffY*/
+ //((a1 - diffY) / (z1S + fov)) = - (((a2 - diffY) / (z2S + fov)))
- diffY = (a1 * z2S + a1 * fov + fov * a2 + z1S * a2) / (z2S + fov + z1S + fov);
+ /*(a1 - diffY) * (z2S + fov) = -(z1S + fov) * (a2 - diffY)
- //var diffY = (-a1 * z2S - a1 * fov - a2 * z1S -a2 * fov) / ( -z2S - fov - z1S - fov);
+ a1 * z2S + a1 * fov - diffY * z2S - diffY * fov = -z1S * a2 + z1S * diffY - fov * a2 + fov * diffY
+ a1 * z2S + a1 * fov + fov * a2 + z1S * a2= diffY * z2S + diffY * fov + z1S * diffY + fov * diffY*/
- return diffY;
+ diffY = (a1 * z2S + a1 * fov + fov * a2 + z1S * a2) / (z2S + fov + z1S + fov);
- };
+ //let diffY = (-a1 * z2S - a1 * fov - a2 * z1S -a2 * fov) / ( -z2S - fov - z1S - fov);
- var tempArray = this._getArrayAllVergeCube(points);
- var tempX1, tempY1, tempZ1, tempX2, tempY2, tempZ2;
- for (var i = 0; i < tempArray.length - 1; i++) {
- var start = i;
- var end = i + 1;
+ return diffY;
- tempX1 = tempArray[start].x;
- tempY1 = tempArray[start].y;
- tempZ1 = tempArray[start].z;
+ };
- tempX2 = tempArray[end].x;
- tempY2 = tempArray[end].y;
- tempZ2 = tempArray[end].z;
+ let tempArray = this._getArrayAllVergeCube(points);
- if (tempY1 > tempY2) {
- start = i + 1;
- end = i;
+ let diffY;
+ let tempX1, tempY1, tempZ1, tempX2, tempY2, tempZ2;
+ for (let i = 0; i < tempArray.length - 1; i++) {
+ let start = i;
+ let end = i + 1;
tempX1 = tempArray[start].x;
tempY1 = tempArray[start].y;
@@ -1716,150 +1730,146 @@ Processor3D.prototype._getMinMaxOyPoints = function (points, minZ) {
tempX2 = tempArray[end].x;
tempY2 = tempArray[end].y;
tempZ2 = tempArray[end].z;
- }
+ if (tempY1 > tempY2) {
+ start = i + 1;
+ end = i;
- var diffY = calculateDiffY(tempX1, tempX2, tempY1, tempY2, tempZ1, tempZ2, minZ);
+ tempX1 = tempArray[start].x;
+ tempY1 = tempArray[start].y;
+ tempZ1 = tempArray[start].z;
- var rotatePoint1 = this.calculatePointManual(tempX1, tempY1, tempZ1, this.cameraDiffX, -diffY, minZ);
- var y1 = rotatePoint1.y;
+ tempX2 = tempArray[end].x;
+ tempY2 = tempArray[end].y;
+ tempZ2 = tempArray[end].z;
+ }
- var rotatePoint2 = this.calculatePointManual(tempX2, tempY2, tempZ2, this.cameraDiffX, -diffY, minZ);
- var y2 = rotatePoint2.y;
+ diffY = calculateDiffY(tempX1, tempX2, tempY1, tempY2, tempZ1, tempZ2, minZ);
- var topMargin = y1;
- var bottomMargin = Math.floor(h - y2);
- if (!((topMargin >= bottomMargin - 1) && (topMargin <= bottomMargin + 1)))
- continue;
+ let rotatePoint1 = this.calculatePointManual(tempX1, tempY1, tempZ1, this.cameraDiffX, -diffY, minZ);
+ let y1 = rotatePoint1.y;
- var isTrue = true;
- for (var l = 0; l < tempArray.length - 1; l++) {
- var rotatePoint = this.calculatePointManual(tempArray[l].x, tempArray[l].y, tempArray[l].z, this.cameraDiffX, -diffY, minZ);
- var tempY11 = rotatePoint.y;
- if (y1 < y2) {
- if (tempY11 < y1 || tempY11 > y2) {
- isTrue = false;
- break;
- }
- } else {
- if (tempY11 > y1 || tempY11 < y2) {
- isTrue = false;
- break;
+ let rotatePoint2 = this.calculatePointManual(tempX2, tempY2, tempZ2, this.cameraDiffX, -diffY, minZ);
+ let y2 = rotatePoint2.y;
+
+ let topMargin = y1;
+ let bottomMargin = Math.floor(h - y2);
+ if (!((topMargin >= bottomMargin - 1) && (topMargin <= bottomMargin + 1))) {
+ continue;
+ }
+
+ let isTrue = true;
+ for (let l = 0; l < tempArray.length - 1; l++) {
+ let rotatePoint = this.calculatePointManual(tempArray[l].x, tempArray[l].y, tempArray[l].z, this.cameraDiffX, -diffY, minZ);
+ let tempY11 = rotatePoint.y;
+
+ if (y1 < y2) {
+ if (tempY11 < y1 || tempY11 > y2) {
+ isTrue = false;
+ break;
+ }
+ } else {
+ if (tempY11 > y1 || tempY11 < y2) {
+ isTrue = false;
+ break;
+ }
}
}
- }
- if (isTrue)
- break;
- }
+ if (isTrue) {
+ break;
+ }
+ }
- return {
- diffY: diffY,
- tempX1: tempX1,
- tempY1: tempY1,
- tempZ1: tempZ1,
- tempX2: tempX2,
- tempY2: tempY2,
- tempZ2: tempZ2
+ return {
+ diffY: diffY, tempX1: tempX1, tempY1: tempY1, tempZ1: tempZ1, tempX2: tempX2, tempY2: tempY2, tempZ2: tempZ2
+ };
};
-};
-Processor3D.prototype._getArrayAllVergeCube = function (points) {
- var res = [];
-
- res[0] = points[0];
- res[1] = points[1];
- res[2] = points[2];
- res[3] = points[3];
- res[4] = points[0];
- res[5] = points[4];
- res[6] = points[7];
- res[7] = points[6];
- res[8] = points[5];
- res[9] = points[2];
- res[10] = points[6];
- res[11] = points[1];
- res[12] = points[7];
- res[13] = points[0];
- res[14] = points[5];
- res[15] = points[1];
- res[16] = points[4];
- res[17] = points[3];
- res[18] = points[6];
- res[19] = points[0];
- res[20] = points[2];
- res[21] = points[7];
- res[22] = points[3];
- res[23] = points[5];
- res[24] = points[7];
- res[25] = points[4];
- res[26] = points[2];
- res[27] = points[3];
- res[28] = points[1];
- res[29] = points[4];
- res[30] = points[5];
- res[31] = points[6];
- res[32] = points[4];
-
-
- /*for(var i = 0; i < points.length; i++)
- {
- for(var j = 0; j < points.length; j++)
+ Processor3D.prototype._getArrayAllVergeCube = function (points) {
+ let res = [];
+
+ res[0] = points[0];
+ res[1] = points[1];
+ res[2] = points[2];
+ res[3] = points[3];
+ res[4] = points[0];
+ res[5] = points[4];
+ res[6] = points[7];
+ res[7] = points[6];
+ res[8] = points[5];
+ res[9] = points[2];
+ res[10] = points[6];
+ res[11] = points[1];
+ res[12] = points[7];
+ res[13] = points[0];
+ res[14] = points[5];
+ res[15] = points[1];
+ res[16] = points[4];
+ res[17] = points[3];
+ res[18] = points[6];
+ res[19] = points[0];
+ res[20] = points[2];
+ res[21] = points[7];
+ res[22] = points[3];
+ res[23] = points[5];
+ res[24] = points[7];
+ res[25] = points[4];
+ res[26] = points[2];
+ res[27] = points[3];
+ res[28] = points[1];
+ res[29] = points[4];
+ res[30] = points[5];
+ res[31] = points[6];
+ res[32] = points[4];
+
+
+ /*for(let i = 0; i < points.length; i++)
{
- res.push(points[i]);
- res.push(points[j]);
+ for(let j = 0; j < points.length; j++)
+ {
+ res.push(points[i]);
+ res.push(points[j]);
- }
- }*/
+ }
+ }*/
- return res;
-};
+ return res;
+ };
-Processor3D.prototype._getMinMaxOyPoints2 = function (points, minZ) {
- var t = this;
-
- var h = t.heightCanvas;
-
- var tempArray = [];
- tempArray[0] = points[0];//leftNear
- tempArray[1] = points[1];//leftFar
- tempArray[2] = points[2];//rightFar
- tempArray[3] = points[3];//rightNear
- tempArray[4] = points[4];//leftNear
- tempArray[5] = points[5];//leftFar
- tempArray[6] = points[6];//leftFar
- tempArray[7] = points[7];//leftFar
- tempArray[8] = points[4];//leftFar
- tempArray[9] = points[1];//leftFar
- tempArray[10] = points[3];//leftFar
- tempArray[11] = points[0];//leftFar
- tempArray[12] = points[7];//leftFar
- tempArray[13] = points[2];//leftFar
- tempArray[14] = points[0];//leftFar
- tempArray[15] = points[6];//leftFar
- tempArray[16] = points[5];//leftFar
- tempArray[17] = points[0];//leftFar
- tempArray[18] = points[4];//leftFar
-
-
- var tempX1, tempY1, tempZ1, tempX2, tempY2, tempZ2;
- for (var i = 0; i < tempArray.length - 1; i++) {
- var start = i;
- var end = i + 1;
-
- tempX1 = tempArray[start].x;
- tempY1 = tempArray[start].y;
- tempZ1 = tempArray[start].z;
-
- tempX2 = tempArray[end].x;
- tempY2 = tempArray[end].y;
- tempZ2 = tempArray[end].z;
-
- if (tempY1 > tempY2) {
- start = i + 1;
- end = i;
+ Processor3D.prototype._getMinMaxOyPoints2 = function (points, minZ) {
+ let t = this;
+
+ let h = t.heightCanvas;
+
+ let tempArray = [];
+ tempArray[0] = points[0];//leftNear
+ tempArray[1] = points[1];//leftFar
+ tempArray[2] = points[2];//rightFar
+ tempArray[3] = points[3];//rightNear
+ tempArray[4] = points[4];//leftNear
+ tempArray[5] = points[5];//leftFar
+ tempArray[6] = points[6];//leftFar
+ tempArray[7] = points[7];//leftFar
+ tempArray[8] = points[4];//leftFar
+ tempArray[9] = points[1];//leftFar
+ tempArray[10] = points[3];//leftFar
+ tempArray[11] = points[0];//leftFar
+ tempArray[12] = points[7];//leftFar
+ tempArray[13] = points[2];//leftFar
+ tempArray[14] = points[0];//leftFar
+ tempArray[15] = points[6];//leftFar
+ tempArray[16] = points[5];//leftFar
+ tempArray[17] = points[0];//leftFar
+ tempArray[18] = points[4];//leftFar
+
+
+ let tempX1, tempY1, tempZ1, tempX2, tempY2, tempZ2;
+ for (let i = 0; i < tempArray.length - 1; i++) {
+ let start = i;
+ let end = i + 1;
tempX1 = tempArray[start].x;
tempY1 = tempArray[start].y;
@@ -1868,413 +1878,425 @@ Processor3D.prototype._getMinMaxOyPoints2 = function (points, minZ) {
tempX2 = tempArray[end].x;
tempY2 = tempArray[end].y;
tempZ2 = tempArray[end].z;
- }
+ if (tempY1 > tempY2) {
+ start = i + 1;
+ end = i;
- //var diffY = calculateDiffY(tempX1, tempX2, tempY1, tempY2, tempZ1, tempZ2, minZ);
+ tempX1 = tempArray[start].x;
+ tempY1 = tempArray[start].y;
+ tempZ1 = tempArray[start].z;
+ tempX2 = tempArray[end].x;
+ tempY2 = tempArray[end].y;
+ tempZ2 = tempArray[end].z;
+ }
- var correctOffset = this._correctZPositionOY(tempX1, tempX2, tempZ1, tempZ2, minZ, tempY1, tempY2);
- var diffZ = correctOffset.minZ;
- var diffY = correctOffset.diffY;
+ //let diffY = calculateDiffY(tempX1, tempX2, tempY1, tempY2, tempZ1, tempZ2, minZ);
- var rotatePoint1 = this.calculatePointManual(tempX1, tempY1, tempZ1, this.cameraDiffX, diffY, diffZ);
- var y1 = rotatePoint1.y;
+ let correctOffset = this._correctZPositionOY(tempX1, tempX2, tempZ1, tempZ2, minZ, tempY1, tempY2);
+ let diffZ = correctOffset.minZ;
+ let diffY = correctOffset.diffY;
- var rotatePoint2 = this.calculatePointManual(tempX2, tempY2, tempZ2, this.cameraDiffX, diffY, diffZ);
- var y2 = rotatePoint2.y;
- var topMargin = y1;
- var bottomMargin = Math.floor(h - y2);
- if (!((topMargin >= bottomMargin - 1) && (topMargin <= bottomMargin + 1)))
- continue;
+ let rotatePoint1 = this.calculatePointManual(tempX1, tempY1, tempZ1, this.cameraDiffX, diffY, diffZ);
+ let y1 = rotatePoint1.y;
- var isTrue = true;
- for (var l = 0; l < tempArray.length - 1; l++) {
- var rotatePoint = this.calculatePointManual(tempArray[l].x, tempArray[l].y, tempArray[l].z, this.cameraDiffX, diffY, diffZ);
- var tempY11 = rotatePoint.y;
- if (y1 < y2) {
- if (tempY11 < y1 || tempY11 > y2) {
- isTrue = false;
- break;
- }
- } else {
- if (tempY11 > y1 || tempY11 < y2) {
- isTrue = false;
- break;
- }
+ let rotatePoint2 = this.calculatePointManual(tempX2, tempY2, tempZ2, this.cameraDiffX, diffY, diffZ);
+ let y2 = rotatePoint2.y;
+
+ let topMargin = y1;
+ let bottomMargin = Math.floor(h - y2);
+ if (!((topMargin >= bottomMargin - 1) && (topMargin <= bottomMargin + 1))) {
+ continue;
}
- }
- if (isTrue)
- break;
- }
+ let isTrue = true;
+ for (let l = 0; l < tempArray.length - 1; l++) {
+ let rotatePoint = this.calculatePointManual(tempArray[l].x, tempArray[l].y, tempArray[l].z, this.cameraDiffX, diffY, diffZ);
+ let tempY11 = rotatePoint.y;
- return {
- diffY: diffY,
- tempX1: tempX1,
- tempY1: tempY1,
- tempZ1: tempZ1,
- tempX2: tempX2,
- tempY2: tempY2,
- tempZ2: tempZ2,
- diffZ: diffZ
- };
-};
+ if (y1 < y2) {
+ if (tempY11 < y1 || tempY11 > y2) {
+ isTrue = false;
+ break;
+ }
+ } else {
+ if (tempY11 > y1 || tempY11 < y2) {
+ isTrue = false;
+ break;
+ }
+ }
+ }
-Processor3D.prototype._correctZPosition4 = function (x1, x2, z1, z2, minZ, y1, y2) {
- var t = this;
+ if (isTrue) {
+ break;
+ }
+ }
- var getDiffXZ3 = function (x1, x2, z1, z2, y1, y2) {
- var w = t.widthCanvas;
+ return {
+ tempX1: tempX1, tempY1: tempY1, tempZ1: tempZ1, tempX2: tempX2, tempY2: tempY2, tempZ2: tempZ2
+ };
+ };
- var fov = 1 / t.rPerspective;
+ Processor3D.prototype._correctZPosition4 = function (x1, x2, z1, z2, minZ, y1, y2) {
+ let t = this;
- var diffAndScalePoints = t.diffAndScale(x1, y1, z1);
- var x11 = diffAndScalePoints.x;
- var y11 = diffAndScalePoints.y;
- var z11 = diffAndScalePoints.z;
+ let getDiffXZ3 = function (x1, x2, z1, z2, y1, y2) {
+ let w = t.widthCanvas;
+ let fov = 1 / t.rPerspective;
- var rotatePoints = t.rotate(x11, y11, z11);
- var x111 = rotatePoints.x;
- var z111 = rotatePoints.z;
+ let diffAndScalePoints = t.diffAndScale(x1, y1, z1);
+ let x11 = diffAndScalePoints.x;
+ let y11 = diffAndScalePoints.y;
+ let z11 = diffAndScalePoints.z;
- /*var x1111 = x111 + diffX;
- var y1111 = y111 + diffY;
- var z1111 = z111 + diffZ;
- var x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
- var y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
+ let rotatePoints = t.rotate(x11, y11, z11);
+ let x111 = rotatePoints.x;
+ let z111 = rotatePoints.z;
- //(fov * x1111) / (z1111 + fov) + w / 2 = t.left
- //(fov * (x111 + diffX)) / ((z111 + diffZ) + fov) + w / 2 = t.left
- var wL = t.left - w / 2;
- //fov * (x111 + diffX) = wL * ((z111 + diffZ) + fov)
- //fov * x111 + fov * diffX = wL * z111 + wL * diffZ + wL * fov
+ /*let x1111 = x111 + diffX;
+ let y1111 = y111 + diffY;
+ let z1111 = z111 + diffZ;
+ let x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
+ let y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
- diffAndScalePoints = t.diffAndScale(x2, y2, z2);
- var x22 = diffAndScalePoints.x;
- var y22 = diffAndScalePoints.y;
- var z22 = diffAndScalePoints.z;
+ //(fov * x1111) / (z1111 + fov) + w / 2 = t.left
+ //(fov * (x111 + diffX)) / ((z111 + diffZ) + fov) + w / 2 = t.left
+ let wL = t.left - w / 2;
+ //fov * (x111 + diffX) = wL * ((z111 + diffZ) + fov)
+ //fov * x111 + fov * diffX = wL * z111 + wL * diffZ + wL * fov
- rotatePoints = t.rotate(x22, y22, z22);
- var x222 = rotatePoints.x;
- var z222 = rotatePoints.z;
+ diffAndScalePoints = t.diffAndScale(x2, y2, z2);
+ let x22 = diffAndScalePoints.x;
+ let y22 = diffAndScalePoints.y;
+ let z22 = diffAndScalePoints.z;
- /*var x1111 = x111 + diffX;
- var y1111 = y111 + diffY;
- var z1111 = z111 + diffZ;
- var x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
- var y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
+ rotatePoints = t.rotate(x22, y22, z22);
+ let x222 = rotatePoints.x;
+ let z222 = rotatePoints.z;
- var wR = w / 2 - t.left;
- //fov * (x222 + diffX) = wR * ((z222 + diffZ) + fov)
- //fov * x222 + fov * diffX = wR * z222 + wR * diffZ + wR * fov
+ /*let x1111 = x111 + diffX;
+ let y1111 = y111 + diffY;
+ let z1111 = z111 + diffZ;
+ let x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
+ let y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
- //итого
- //fov * x111 + fov * diffX = wL * z111 + wL * diffZ + wL * fov
- //fov * x222 + fov * diffX = wR * z222 + wR * diffZ + wR * fov
+ let wR = w / 2 - t.left;
+ //fov * (x222 + diffX) = wR * ((z222 + diffZ) + fov)
+ //fov * x222 + fov * diffX = wR * z222 + wR * diffZ + wR * fov
- /*diffX = (wL * z111 + wL * diffZ + wL * fov - fov * x111) / fov;
+ //итого
+ //fov * x111 + fov * diffX = wL * z111 + wL * diffZ + wL * fov
+ //fov * x222 + fov * diffX = wR * z222 + wR * diffZ + wR * fov
- fov * x222 + wL * z111 + wL * diffZ + wL * fov - fov * x111 = wR * z222 + wR * diffZ + wR * fov
- fov * x222 + wL * z111 + wL * fov - fov * x111 - wR * z222 - wR * fov = wR * diffZ - wL * diffZ*/
+ /*diffX = (wL * z111 + wL * diffZ + wL * fov - fov * x111) / fov;
+ fov * x222 + wL * z111 + wL * diffZ + wL * fov - fov * x111 = wR * z222 + wR * diffZ + wR * fov
- var diffZ = (fov * x222 + wL * z111 + wL * fov - fov * x111 - wR * z222 - wR * fov) / (wR - wL);
- var diffX = (wL * z111 + wL * diffZ + wL * fov - fov * x111) / fov;
+ fov * x222 + wL * z111 + wL * fov - fov * x111 - wR * z222 - wR * fov = wR * diffZ - wL * diffZ*/
- return {minZ: diffZ, diffX: diffX};
- };
+ let diffZ = (fov * x222 + wL * z111 + wL * fov - fov * x111 - wR * z222 - wR * fov) / (wR - wL);
+ let diffX = (wL * z111 + wL * diffZ + wL * fov - fov * x111) / fov;
- var diffXZ3 = getDiffXZ3(x1, x2, z1, z2, y1, y2);
- return {minZ: diffXZ3.minZ, diffX: diffXZ3.diffX};
-};
+ return {minZ: diffZ, diffX: diffX};
+ };
+ let diffXZ3 = getDiffXZ3(x1, x2, z1, z2, y1, y2);
-Processor3D.prototype._correctZPositionOY = function (x1, x2, z1, z2, minZ, y1, y2) {
- var t = this;
+ return {minZ: diffXZ3.minZ, diffX: diffXZ3.diffX};
+ };
- var getDiffXZ3 = function (x1, x2, z1, z2, y1, y2) {
- var h = t.heightCanvas;
+ Processor3D.prototype._correctZPositionOY = function (x1, x2, z1, z2, minZ, y1, y2) {
+ let t = this;
- var fov = 1 / t.rPerspective;
+ let getDiffXZ3 = function (x1, x2, z1, z2, y1, y2) {
+ let h = t.heightCanvas;
- var diffAndScalePoints = t.diffAndScale(x1, y1, z1);
- var x11 = diffAndScalePoints.x;
- var y11 = diffAndScalePoints.y;
- var z11 = diffAndScalePoints.z;
+ let fov = 1 / t.rPerspective;
+ let diffAndScalePoints = t.diffAndScale(x1, y1, z1);
+ let x11 = diffAndScalePoints.x;
+ let y11 = diffAndScalePoints.y;
+ let z11 = diffAndScalePoints.z;
- var rotatePoints = t.rotate(x11, y11, z11);
- var y111 = rotatePoints.y;
- var z111 = rotatePoints.z;
+ let rotatePoints = t.rotate(x11, y11, z11);
+ let y111 = rotatePoints.y;
+ let z111 = rotatePoints.z;
- /*var x1111 = x111 + diffX;
- var y1111 = y111 + diffY;
- var z1111 = z111 + diffZ;
- var x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
- var y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
+ /*let x1111 = x111 + diffX;
+ let y1111 = y111 + diffY;
+ let z1111 = z111 + diffZ;
+ let x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
+ let y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
- //(fov * x1111) / (z1111 + fov) + w / 2 = t.left
- //(fov * (x111 + diffX)) / ((z111 + diffZ) + fov) + w / 2 = t.left
- //var wL = t.left - w / 2;
- //fov * (x111 + diffX) = wL * ((z111 + diffZ) + fov)
- //fov * x111 + fov * diffX = wL * z111 + wL * diffZ + wL * fov
+ //(fov * x1111) / (z1111 + fov) + w / 2 = t.left
+ //(fov * (x111 + diffX)) / ((z111 + diffZ) + fov) + w / 2 = t.left
+ //let wL = t.left - w / 2;
+ //fov * (x111 + diffX) = wL * ((z111 + diffZ) + fov)
+ //fov * x111 + fov * diffX = wL * z111 + wL * diffZ + wL * fov
- diffAndScalePoints = t.diffAndScale(x2, y2, z2);
- var x22 = diffAndScalePoints.x;
- var y22 = diffAndScalePoints.y;
- var z22 = diffAndScalePoints.z;
+ diffAndScalePoints = t.diffAndScale(x2, y2, z2);
+ let x22 = diffAndScalePoints.x;
+ let y22 = diffAndScalePoints.y;
+ let z22 = diffAndScalePoints.z;
- rotatePoints = t.rotate(x22, y22, z22);
- var y222 = rotatePoints.y;
- var z222 = rotatePoints.z;
+ rotatePoints = t.rotate(x22, y22, z22);
+ let y222 = rotatePoints.y;
+ let z222 = rotatePoints.z;
- /*var x1111 = x111 + diffX;
- var y1111 = y111 + diffY;
- var z1111 = z111 + diffZ;
- var x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
- var y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
+ /*let x1111 = x111 + diffX;
+ let y1111 = y111 + diffY;
+ let z1111 = z111 + diffZ;
+ let x11111 = (fov * x1111) / (z1111 + fov) + w / 2;
+ let y11111 = (fov * y1111) / (z1111 + fov) + h / 2;*/
- //(fov * (y111 + diffY)) / ((z111 + diffZ) + fov) + h / 2 = t.top
- //(fov * (y222 + diffY)) / ((z222 + diffZ) + fov) + h / 2 = h - t.bottom
- var wL = t.top - h / 2;
- var wR = h / 2 - t.bottom;
- /*(fov * (y111 + diffY)) / ((z111 + diffZ) + fov) = wL
- (fov * (y222 + diffY)) / ((z222 + diffZ) + fov) = wR
+ //(fov * (y111 + diffY)) / ((z111 + diffZ) + fov) + h / 2 = t.top
+ //(fov * (y222 + diffY)) / ((z222 + diffZ) + fov) + h / 2 = h - t.bottom
+ let wL = t.top - h / 2;
+ let wR = h / 2 - t.bottom;
+ /*(fov * (y111 + diffY)) / ((z111 + diffZ) + fov) = wL
+ (fov * (y222 + diffY)) / ((z222 + diffZ) + fov) = wR
- fov * (y111 + diffY) = wL * ((z111 + diffZ) + fov)
- fov * y111 + fov * diffY = wL * z111 + wL * diffZ + wL * fov
- fov * y222 + fov * diffY = wR * z222 + wR * diffZ + wR * fov
+ fov * (y111 + diffY) = wL * ((z111 + diffZ) + fov)
- diffY = (wR * z222 + wR * diffZ + wR * fov - fov * y222) / fov
+ fov * y111 + fov * diffY = wL * z111 + wL * diffZ + wL * fov
+ fov * y222 + fov * diffY = wR * z222 + wR * diffZ + wR * fov
- fov * y111 + wR * z222 + wR * diffZ + wR * fov - fov * y222 = wL * z111 + wL * diffZ + wL * fov
+ diffY = (wR * z222 + wR * diffZ + wR * fov - fov * y222) / fov
- fov * y111 + wR * z222 + wR * fov - fov * y222 - wL * z111 - wL * fov = wL * diffZ - wR * diffZ*/
+ fov * y111 + wR * z222 + wR * diffZ + wR * fov - fov * y222 = wL * z111 + wL * diffZ + wL * fov
- var diffZ = (fov * y111 + wR * z222 + wR * fov - fov * y222 - wL * z111 - wL * fov) / (wL - wR);
- var diffY = (wR * z222 + wR * diffZ + wR * fov - fov * y222) / fov;
+ fov * y111 + wR * z222 + wR * fov - fov * y222 - wL * z111 - wL * fov = wL * diffZ - wR * diffZ*/
+ let diffZ = (fov * y111 + wR * z222 + wR * fov - fov * y222 - wL * z111 - wL * fov) / (wL - wR);
+ let diffY = (wR * z222 + wR * diffZ + wR * fov - fov * y222) / fov;
- //var diffZ = (fov * x222 + wL * z111 + wL * fov - fov * x111 - wR * z222 - wR * fov) / (wR - wL);
- //var diffX = (wL * z111 + wL * diffZ + wL * fov - fov * x111) / fov;
+ //let diffZ = (fov * x222 + wL * z111 + wL * fov - fov * x111 - wR * z222 - wR * fov) / (wR - wL);
+ //let diffX = (wL * z111 + wL * diffZ + wL * fov - fov * x111) / fov;
- return {minZ: diffZ, diffY: diffY};
- };
- var diffXZ3 = getDiffXZ3(x1, x2, z1, z2, y1, y2);
+ return {minZ: diffZ, diffY: diffY};
+ };
- return {minZ: diffXZ3.minZ, diffY: diffXZ3.diffY};
-};
+ let diffXZ3 = getDiffXZ3(x1, x2, z1, z2, y1, y2);
-Processor3D.prototype._calculateCameraDiffX = function (minMaxOx) {
- //test ровно по центру, но циклом
- var maxLeftPoint = minMaxOx.left;
- var maxRightPoint = minMaxOx.right;
+ return {minZ: diffXZ3.minZ, diffY: diffXZ3.diffY};
+ };
- //так ближе к тому, как смещает excel
- var widthCanvas = this.widthCanvas;
- var originalWidthChart = widthCanvas - this.left - this.right;
+ Processor3D.prototype._calculateCameraDiffX = function (minMaxOx) {
+ //test ровно по центру, но циклом
+ let maxLeftPoint = minMaxOx.left;
+ let maxRightPoint = minMaxOx.right;
- var diffLeft = maxLeftPoint - this.left;
- var diffRight = (this.left + originalWidthChart) - maxRightPoint;
+ //так ближе к тому, как смещает excel
+ let widthCanvas = this.widthCanvas;
+ let originalWidthChart = widthCanvas - this.left - this.right;
- this.cameraDiffX = (((diffRight - diffLeft) / 2) * (1 / (this.rPerspective) + this.cameraDiffZ)) / (1 / (this.rPerspective));
-};
+ let diffLeft = maxLeftPoint - this.left;
+ let diffRight = (this.left + originalWidthChart) - maxRightPoint;
-Processor3D.prototype._calculateCameraDiffY = function (maxTopPoint, maxBottomPoint) {
- var top = this.top;
- var bottom = this.bottom;
- var heightCanvas = this.heightCanvas;
- var heightChart = heightCanvas - top - bottom;
+ this.cameraDiffX = (((diffRight - diffLeft) / 2) * (1 / (this.rPerspective) + this.cameraDiffZ)) / (1 / (this.rPerspective));
+ };
- var diffTop = maxTopPoint - top;
- var diffBottom = (heightChart + top) - maxBottomPoint;
+ Processor3D.prototype._calculateCameraDiffY = function (maxTopPoint, maxBottomPoint) {
+ let top = this.top;
+ let bottom = this.bottom;
+ let heightCanvas = this.heightCanvas;
+ let heightChart = heightCanvas - top - bottom;
- //this.cameraDiffY = this.top - minMaxOy.top; - для rAngAx
- this.cameraDiffY = (diffBottom - diffTop) / 2;
-};
+ let diffTop = maxTopPoint - top;
+ let diffBottom = (heightChart + top) - maxBottomPoint;
-Processor3D.prototype._getMinMaxOx = function (points, faces) {
- var mostLeftPointX;
- var mostRightPointX;
- var xRight;
- var xLeft;
+ //this.cameraDiffY = this.top - minMaxOy.top; - для rAngAx
+ this.cameraDiffY = (diffBottom - diffTop) / 2;
+ };
- for (var i = 0; i < faces.length - 1; i++) {
- for (var k = 0; k <= 3; k++) {
+ Processor3D.prototype._getMinMaxOx = function (points, faces) {
+ let mostLeftPointX;
+ let mostRightPointX;
+ let xRight;
+ let xLeft;
- var point1 = this.convertAndTurnPoint(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z);
- //var point2 = this.convertAndTurnPoint(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z, true);
- var x1 = point1.x;
- //var x2 = point2.x;
+ for (let i = 0; i < faces.length - 1; i++) {
+ for (let k = 0; k <= 3; k++) {
- if (!xLeft) {
- xLeft = x1;
- mostLeftPointX = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
+ let point1 = this.convertAndTurnPoint(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z);
+ //let point2 = this.convertAndTurnPoint(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z, true);
+ let x1 = point1.x;
+ //let x2 = point2.x;
- xRight = x1;
- mostRightPointX = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
- } else {
- if (x1 < xLeft) {
+ if (!xLeft) {
xLeft = x1;
mostLeftPointX = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
- }
- if (x1 > xRight) {
xRight = x1;
mostRightPointX = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
+ } else {
+ if (x1 < xLeft) {
+ xLeft = x1;
+ mostLeftPointX = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
+ }
+
+ if (x1 > xRight) {
+ xRight = x1;
+ mostRightPointX = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
+ }
}
- }
+ }
}
- }
- return {left: xLeft, right: xRight, mostLeftPointX: mostLeftPointX, mostRightPointX: mostRightPointX};
-};
+ return {left: xLeft, right: xRight, mostLeftPointX: mostLeftPointX, mostRightPointX: mostRightPointX};
+ };
-Processor3D.prototype._getMinMaxOy = function (points, faces) {
- var mostTopPointY;
- var mostBottomPointY;
- var xTop = this.top + this.heightCanvas;
- var xBottom = 0;
- for (var i = 0; i < faces.length - 1; i++) {
- for (var k = 0; k < 3; k++) {
+ Processor3D.prototype._getMinMaxOy = function (points, faces) {
+ let mostTopPointY;
+ let mostBottomPointY;
+ let xTop = this.top + this.heightCanvas;
+ let xBottom = 0;
+ for (let i = 0; i < faces.length - 1; i++) {
+ for (let k = 0; k < 3; k++) {
- var point1 = this.convertAndTurnPoint(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z);
- var point2 = this.convertAndTurnPoint(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z);
- var y1 = point1.y;
- var y2 = point2.y;
+ let point1 = this.convertAndTurnPoint(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z);
+ let point2 = this.convertAndTurnPoint(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z);
+ let y1 = point1.y;
+ let y2 = point2.y;
- if (y1 <= xTop) {
- xTop = y1;
- mostTopPointY = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
- }
+ if (y1 <= xTop) {
+ xTop = y1;
+ mostTopPointY = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
+ }
- if (y2 <= xTop) {
- xTop = y2;
- mostTopPointY = new Point3D(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z, this.cChartDrawer);
- }
+ if (y2 <= xTop) {
+ xTop = y2;
+ mostTopPointY = new Point3D(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z, this.cChartDrawer);
+ }
- if (y1 >= xBottom) {
- xBottom = y1;
- mostBottomPointY = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
- }
+ if (y1 >= xBottom) {
+ xBottom = y1;
+ mostBottomPointY = new Point3D(points[faces[i][k]].x, points[faces[i][k]].y, points[faces[i][k]].z, this.cChartDrawer);
+ }
- if (y2 >= xBottom) {
- xBottom = y2;
- mostBottomPointY = new Point3D(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z, this.cChartDrawer);
- }
+ if (y2 >= xBottom) {
+ xBottom = y2;
+ mostBottomPointY = new Point3D(points[faces[i][k + 1]].x, points[faces[i][k + 1]].y, points[faces[i][k + 1]].z, this.cChartDrawer);
+ }
+ }
}
- }
- return {top: xTop, bottom: xBottom, mostTopPointY: mostTopPointY, mostBottomPointY: mostBottomPointY};
-};
+ return {top: xTop, bottom: xBottom, mostTopPointY: mostTopPointY, mostBottomPointY: mostBottomPointY};
+ };
-Processor3D.prototype._calcAspectRatio = function () {
- //return width / height
- var widthOriginalChart = this.widthCanvas - (this.left + this.right);
- var heightOriginalChart = this.heightCanvas - (this.top + this.bottom);
- //auto scale if hPercent == null
- var hPercent = this.hPercent;
- var depthPercent = this._getDepthPercent();
+ Processor3D.prototype._calcAspectRatio = function () {
+ //return width / height
+ let widthOriginalChart = this.widthCanvas - (this.left + this.right);
+ let heightOriginalChart = this.heightCanvas - (this.top + this.bottom);
+ //auto scale if hPercent == null
+ let hPercent = this.hPercent;
+ let depthPercent = this._getDepthPercent();
- var aspectRatioX = 1;
- var aspectRatioY = 1;
+ let aspectRatioX = 1;
+ let aspectRatioY = 1;
- var subType = this.chartsDrawer.calcProp.subType;
- if ((subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && subType == "normal") || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface) && !this.view3D.getRAngAx()) {
- this._calcSpecialStandardScaleX();
+ let countSeries = this.chartsDrawer.calculateFirstChartCountSeries();
+ let seriesCount = countSeries.series;
+ let ptCount = countSeries.points;
- aspectRatioX = (widthOriginalChart / (heightOriginalChart / hPercent)) * this.specialStandardScaleX;
- } else if (subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface) {
- var seriesCount = this.chartsDrawer.calcProp.seriesCount;
- var ptCount = this.chartsDrawer.calcProp.ptCount;
+ let subType = this.chartsDrawer.calcProp.subType;
+ if ((subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line ||
+ (this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Area && subType === "normal") || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Surface) &&
+ !this.view3D.getRAngAx()) {
+ this._calcSpecialStandardScaleX();
- var depth = this.view3D.getRAngAx() ? this._calculateDepth() : this._calculateDepthPerspective();
- var width = (depth / depthPercent) * (ptCount / seriesCount);
+ aspectRatioX = (widthOriginalChart / (heightOriginalChart / hPercent)) * this.specialStandardScaleX;
+ } else if (subType === "standard" || this.chartsDrawer.calcProp.type === AscFormat.c_oChartTypes.Line || this.chartsDrawer.calcProp.type ===
+ AscFormat.c_oChartTypes.Surface) {
- aspectRatioX = (widthOriginalChart) / width;
- } else if (hPercent !== null)//auto scale height
- aspectRatioX = widthOriginalChart / (heightOriginalChart / hPercent);
+ let depth = this.view3D.getRAngAx() ? this._calculateDepth() : this._calculateDepthPerspective();
+ let width = (depth / depthPercent) * (ptCount / seriesCount);
- if (aspectRatioX < 1 && this.view3D.getRAngAx()) {
- aspectRatioY = 1 / aspectRatioX;
- aspectRatioX = 1;
- }
+ aspectRatioX = (widthOriginalChart) / width;
+ } else if (hPercent !== null)//auto scale height
+ {
+ aspectRatioX = widthOriginalChart / (heightOriginalChart / hPercent);
+ }
- this.aspectRatioX = aspectRatioX;
- this.aspectRatioY = aspectRatioY;
-};
+ if (aspectRatioX < 1 && this.view3D.getRAngAx()) {
+ aspectRatioY = 1 / aspectRatioX;
+ aspectRatioX = 1;
+ }
-Processor3D.prototype._getDepthPercent = function () {
- if (AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) {
- return globalBasePercent / 100;
- }
- return this.view3D && this.view3D.depthPercent ? this.view3D.depthPercent / 100 : globalBasePercent / 100;
-};
+ this.aspectRatioX = aspectRatioX;
+ this.aspectRatioY = aspectRatioY;
+ };
+
+ Processor3D.prototype._getDepthPercent = function () {
+ if (AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) {
+ return globalBasePercent / 100;
+ }
+ return this.view3D && this.view3D.depthPercent ? this.view3D.depthPercent / 100 : globalBasePercent / 100;
+ };
-function Point3D(x, y, z, chartsDrawer) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.t = 1;
+ function Point3D(x, y, z, chartsDrawer) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.t = 1;
- if (chartsDrawer) {
- this.chartProp = chartsDrawer.calcProp;
- this.cChartDrawer = chartsDrawer;
- this.cChartSpace = chartsDrawer.cChartSpace;
+ if (chartsDrawer) {
+ this.chartProp = chartsDrawer.calcProp;
+ this.cChartDrawer = chartsDrawer;
+ this.cChartSpace = chartsDrawer.cChartSpace;
+ }
}
-}
-Point3D.prototype =
- {
+ Point3D.prototype = {
constructor: Point3D,
rotate: function (angleOx, angleOy, angleOz) {
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var cosy = Math.cos(angleOy);
- var siny = Math.sin(angleOy);
- var cosx = Math.cos(angleOx);
- var sinx = Math.sin(angleOx);
- var cosz = Math.cos(angleOz);
- var sinz = Math.sin(angleOz);
+ let x = this.x;
+ let y = this.y;
+ let z = this.z;
+ let cosy = Math.cos(angleOy);
+ let siny = Math.sin(angleOy);
+ let cosx = Math.cos(angleOx);
+ let sinx = Math.sin(angleOx);
+ let cosz = Math.cos(angleOz);
+ let sinz = Math.sin(angleOz);
- var newX = cosy * (sinz * y + cosz * x) - siny * z;
- var newY = sinx * (cosy * z + siny * (sinz * y + cosz * x)) + cosx * (cosz * y - sinz * x);
- var newZ = cosx * (cosy * z + siny * (sinz * y + cosz * x)) - sinx * (cosz * y - sinz * x);
+ let newX = cosy * (sinz * y + cosz * x) - siny * z;
+ let newY = sinx * (cosy * z + siny * (sinz * y + cosz * x)) + cosx * (cosz * y - sinz * x);
+ let newZ = cosx * (cosy * z + siny * (sinz * y + cosz * x)) - sinx * (cosz * y - sinz * x);
this.x = newX;
this.y = newY;
@@ -2285,11 +2307,11 @@ Point3D.prototype =
project: function (matrix) {
//умножаем
- var projectPoint = matrix.multiplyPoint(this);
+ let projectPoint = matrix.multiplyPoint(this);
//делим на 4 коэффициэнт
- var newX = projectPoint.x / projectPoint.t;
- var newY = projectPoint.y / projectPoint.t;
+ let newX = projectPoint.x / projectPoint.t;
+ let newY = projectPoint.y / projectPoint.t;
this.x = newX;
this.y = newY;
@@ -2314,404 +2336,403 @@ Point3D.prototype =
},
multiplyPointOnMatrix1: function (matrix) {
- var multiplyMatrix = matrix.multiplyPoint(this);
+ let multiplyMatrix = matrix.multiplyPoint(this);
this.x = multiplyMatrix.x;
this.y = multiplyMatrix.y;
this.z = multiplyMatrix.z;
}
};
-function Matrix4D() {
- this.a11 = 1.0;
- this.a12 = 0.0;
- this.a13 = 0.0;
- this.a14 = 0.0;
-
- this.a21 = 0.0;
- this.a22 = 1.0;
- this.a23 = 0.0;
- this.a24 = 0.0;
-
- this.a31 = 0.0;
- this.a32 = 0.0;
- this.a33 = 1.0;
- this.a34 = 0.0;
-
- this.a41 = 0.0;
- this.a42 = 0.0;
- this.a43 = 0.0;
- this.a44 = 1.0;
-
- return this;
-}
-
-Matrix4D.prototype.reset = function () {
- this.a11 = 1.0;
- this.a12 = 0.0;
- this.a13 = 0.0;
- this.a14 = 0.0;
-
- this.a21 = 0.0;
- this.a22 = 1.0;
- this.a23 = 0.0;
- this.a24 = 0.0;
-
- this.a31 = 0.0;
- this.a32 = 0.0;
- this.a33 = 1.0;
- this.a34 = 0.0;
-
- this.a41 = 0.0;
- this.a42 = 0.0;
- this.a43 = 0.0;
- this.a44 = 1.0;
-};
-Matrix4D.prototype.multiply = function (m) {
- var res = new Matrix4D();
-
- res.a11 = this.a11 * m.a11 + this.a12 * m.a21 + this.a13 * m.a31 + this.a14 * m.a41;
- res.a12 = this.a11 * m.a12 + this.a12 * m.a22 + this.a13 * m.a32 + this.a14 * m.a42;
- res.a13 = this.a11 * m.a13 + this.a12 * m.a23 + this.a13 * m.a33 + this.a14 * m.a43;
- res.a14 = this.a11 * m.a14 + this.a12 * m.a24 + this.a13 * m.a34 + this.a14 * m.a44;
-
- res.a21 = this.a21 * m.a11 + this.a22 * m.a21 + this.a23 * m.a31 + this.a24 * m.a41;
- res.a22 = this.a21 * m.a12 + this.a22 * m.a22 + this.a23 * m.a32 + this.a24 * m.a42;
- res.a23 = this.a21 * m.a13 + this.a22 * m.a23 + this.a23 * m.a33 + this.a24 * m.a43;
- res.a24 = this.a21 * m.a14 + this.a22 * m.a24 + this.a23 * m.a34 + this.a24 * m.a44;
-
- res.a31 = this.a31 * m.a11 + this.a32 * m.a21 + this.a33 * m.a31 + this.a34 * m.a41;
- res.a32 = this.a31 * m.a12 + this.a32 * m.a22 + this.a33 * m.a32 + this.a34 * m.a42;
- res.a33 = this.a31 * m.a13 + this.a32 * m.a23 + this.a33 * m.a33 + this.a34 * m.a43;
- res.a34 = this.a31 * m.a14 + this.a32 * m.a24 + this.a33 * m.a34 + this.a34 * m.a44;
-
- res.a41 = this.a41 * m.a11 + this.a42 * m.a21 + this.a43 * m.a31 + this.a44 * m.a41;
- res.a42 = this.a41 * m.a12 + this.a42 * m.a22 + this.a43 * m.a32 + this.a44 * m.a42;
- res.a43 = this.a41 * m.a13 + this.a42 * m.a23 + this.a43 * m.a33 + this.a44 * m.a43;
- res.a44 = this.a41 * m.a14 + this.a42 * m.a24 + this.a43 * m.a34 + this.a44 * m.a44;
-
- return res;
-};
-Matrix4D.prototype.multiplyPoint = function (p) {
- var res = new Point3D();
+ function Matrix4D() {
+ this.a11 = 1.0;
+ this.a12 = 0.0;
+ this.a13 = 0.0;
+ this.a14 = 0.0;
- res.x = p.x * this.a11 + p.y * this.a21 + p.z * this.a31 + this.a41;
- res.y = p.x * this.a12 + p.y * this.a22 + p.z * this.a32 + this.a42;
- res.z = p.x * this.a13 + p.y * this.a23 + p.z * this.a33 + this.a43;
- res.t = p.x * this.a14 + p.y * this.a24 + p.z * this.a34 + this.a44;
+ this.a21 = 0.0;
+ this.a22 = 1.0;
+ this.a23 = 0.0;
+ this.a24 = 0.0;
- return res;
-};
+ this.a31 = 0.0;
+ this.a32 = 0.0;
+ this.a33 = 1.0;
+ this.a34 = 0.0;
+ this.a41 = 0.0;
+ this.a42 = 0.0;
+ this.a43 = 0.0;
+ this.a44 = 1.0;
-//sort parallalepiped faces
-function CSortFaces(cChartDrawer, centralViewPoint) {
- this.cChartDrawer = cChartDrawer;
- this.chartProp = cChartDrawer.calcProp;
- this.centralViewPoint = null;
- this._initProperties(centralViewPoint)
-}
-
-CSortFaces.prototype =
-{
- constructor: CSortFaces,
-
- _initProperties: function (centralViewPoint) {
- if (!centralViewPoint) {
- var top = this.chartProp.chartGutter._top;
- var bottom = this.chartProp.chartGutter._bottom;
- var left = this.chartProp.chartGutter._left;
- var right = this.chartProp.chartGutter._right;
-
- var widthCanvas = this.chartProp.widthCanvas;
- var heightCanvas = this.chartProp.heightCanvas;
- var heightChart = heightCanvas - top - bottom;
- var widthChart = widthCanvas - left - right;
-
- var centerChartY = top + heightChart / 2;
- var centerChartX = left + widthChart / 2;
-
- var diffX = centerChartX;
- var diffY = centerChartY;
- var diffZ = -1 / this.cChartDrawer.processor3D.rPerspective;
- //TODO протестировать на bar и затем сделать для всех перспективных диаграмм данный сдвиг
- if (!this.cChartDrawer.processor3D.view3D.getRAngAx() && this.chartProp.type === AscFormat.c_oChartTypes.Bar) {
- diffX -= this.cChartDrawer.processor3D.cameraDiffX;
- diffY -= this.cChartDrawer.processor3D.cameraDiffY;
- diffZ -= this.cChartDrawer.processor3D.cameraDiffZ;
- }
-
- //TODO пересмотреть правку!
- if (diffZ > 0 && this.chartProp.type === AscFormat.c_oChartTypes.Bar && this.cChartDrawer.processor3D.view3D.getRAngAx() && (this.chartProp.subType === "stackedPer" || this.chartProp.subType == "stacked")) {
- diffZ -= 500;
- }
-
- this.centralViewPoint = {x: diffX, y: diffY, z: diffZ};
- } else {
- this.centralViewPoint = centralViewPoint;
- }
- },
+ return this;
+ }
- sortParallelepipeds: function (parallelepipeds) {
- var intersectionsParallelepipeds = this._getIntersectionsParallelepipeds(parallelepipeds);
- var revIntersections = intersectionsParallelepipeds.reverseIntersections;
- var countIntersection = intersectionsParallelepipeds.countIntersection;
+ Matrix4D.prototype.reset = function () {
+ this.a11 = 1.0;
+ this.a12 = 0.0;
+ this.a13 = 0.0;
+ this.a14 = 0.0;
+
+ this.a21 = 0.0;
+ this.a22 = 1.0;
+ this.a23 = 0.0;
+ this.a24 = 0.0;
+
+ this.a31 = 0.0;
+ this.a32 = 0.0;
+ this.a33 = 1.0;
+ this.a34 = 0.0;
+
+ this.a41 = 0.0;
+ this.a42 = 0.0;
+ this.a43 = 0.0;
+ this.a44 = 1.0;
+ };
+ Matrix4D.prototype.multiply = function (m) {
+ let res = new Matrix4D();
- var startIndexes = [];
- for (var i = 0; i < countIntersection.length; i++) {
- if (countIntersection[i] === 0) {
- startIndexes.push({index: parseInt(i)});
- }
- }
+ res.a11 = this.a11 * m.a11 + this.a12 * m.a21 + this.a13 * m.a31 + this.a14 * m.a41;
+ res.a12 = this.a11 * m.a12 + this.a12 * m.a22 + this.a13 * m.a32 + this.a14 * m.a42;
+ res.a13 = this.a11 * m.a13 + this.a12 * m.a23 + this.a13 * m.a33 + this.a14 * m.a43;
+ res.a14 = this.a11 * m.a14 + this.a12 * m.a24 + this.a13 * m.a34 + this.a14 * m.a44;
- if (startIndexes.length === 0) {
- //TODO сделано для графиков типа stacked, когда пересечения найдены всех параллалеп.
- return this._getSortZIndexArray(parallelepipeds);
- }
+ res.a21 = this.a21 * m.a11 + this.a22 * m.a21 + this.a23 * m.a31 + this.a24 * m.a41;
+ res.a22 = this.a21 * m.a12 + this.a22 * m.a22 + this.a23 * m.a32 + this.a24 * m.a42;
+ res.a23 = this.a21 * m.a13 + this.a22 * m.a23 + this.a23 * m.a33 + this.a24 * m.a43;
+ res.a24 = this.a21 * m.a14 + this.a22 * m.a24 + this.a23 * m.a34 + this.a24 * m.a44;
+
+ res.a31 = this.a31 * m.a11 + this.a32 * m.a21 + this.a33 * m.a31 + this.a34 * m.a41;
+ res.a32 = this.a31 * m.a12 + this.a32 * m.a22 + this.a33 * m.a32 + this.a34 * m.a42;
+ res.a33 = this.a31 * m.a13 + this.a32 * m.a23 + this.a33 * m.a33 + this.a34 * m.a43;
+ res.a34 = this.a31 * m.a14 + this.a32 * m.a24 + this.a33 * m.a34 + this.a34 * m.a44;
+
+ res.a41 = this.a41 * m.a11 + this.a42 * m.a21 + this.a43 * m.a31 + this.a44 * m.a41;
+ res.a42 = this.a41 * m.a12 + this.a42 * m.a22 + this.a43 * m.a32 + this.a44 * m.a42;
+ res.a43 = this.a41 * m.a13 + this.a42 * m.a23 + this.a43 * m.a33 + this.a44 * m.a43;
+ res.a44 = this.a41 * m.a14 + this.a42 * m.a24 + this.a43 * m.a34 + this.a44 * m.a44;
+
+ return res;
+ };
+ Matrix4D.prototype.multiplyPoint = function (p) {
+ let res = new Point3D();
+
+ res.x = p.x * this.a11 + p.y * this.a21 + p.z * this.a31 + this.a41;
+ res.y = p.x * this.a12 + p.y * this.a22 + p.z * this.a32 + this.a42;
+ res.z = p.x * this.a13 + p.y * this.a23 + p.z * this.a33 + this.a43;
+ res.t = p.x * this.a14 + p.y * this.a24 + p.z * this.a34 + this.a44;
+
+ return res;
+ };
- var g = revIntersections;
- var color = {}; // цвет вершины (0, 1, или 2)
- var time_in = {}, time_out = {}; // "времена" захода и выхода из вершины
- var dfs_timer = 0;
- var dfs = function (v) {
- time_in[v] = dfs_timer++;
- color[v] = 1;
+//sort parallalepiped faces
+ function CSortFaces(cChartDrawer, centralViewPoint) {
+ this.cChartDrawer = cChartDrawer;
+ this.chartProp = cChartDrawer.calcProp;
+ this.centralViewPoint = null;
+ this._initProperties(centralViewPoint)
+ }
- for (var i in g[v]) {
- if (!color[i]) {
- dfs(i);
+ CSortFaces.prototype = {
+ constructor: CSortFaces,
+
+ _initProperties: function (centralViewPoint) {
+ if (!centralViewPoint) {
+ let top = this.chartProp.chartGutter._top;
+ let bottom = this.chartProp.chartGutter._bottom;
+ let left = this.chartProp.chartGutter._left;
+ let right = this.chartProp.chartGutter._right;
+
+ let widthCanvas = this.chartProp.widthCanvas;
+ let heightCanvas = this.chartProp.heightCanvas;
+ let heightChart = heightCanvas - top - bottom;
+ let widthChart = widthCanvas - left - right;
+
+ let centerChartY = top + heightChart / 2;
+ let centerChartX = left + widthChart / 2;
+
+ let diffX = centerChartX;
+ let diffY = centerChartY;
+ let diffZ = -1 / this.cChartDrawer.processor3D.rPerspective;
+ //TODO протестировать на bar и затем сделать для всех перспективных диаграмм данный сдвиг
+ if (!this.cChartDrawer.processor3D.view3D.getRAngAx() && this.chartProp.type === AscFormat.c_oChartTypes.Bar) {
+ diffX -= this.cChartDrawer.processor3D.cameraDiffX;
+ diffY -= this.cChartDrawer.processor3D.cameraDiffY;
+ diffZ -= this.cChartDrawer.processor3D.cameraDiffZ;
}
- }
- color[v] = 2;
- time_out[v] = dfs_timer++;
- };
- var getMax = function () {
- var max = 0;
- var res = null;
- for (var i in time_out) {
- if (!addIndexes[i] && time_out[i] > max) {
- max = time_out[i];
- res = i;
+ //TODO пересмотреть правку!
+ if (diffZ > 0 && this.chartProp.type === AscFormat.c_oChartTypes.Bar && this.cChartDrawer.processor3D.view3D.getRAngAx() &&
+ (this.chartProp.subType === "stackedPer" || this.chartProp.subType === "stacked")) {
+ diffZ -= 500;
}
+
+ this.centralViewPoint = {x: diffX, y: diffY, z: diffZ};
+ } else {
+ this.centralViewPoint = centralViewPoint;
}
- return res;
- };
+ },
- for (var i = 0; i < startIndexes.length; i++) {
- dfs(startIndexes[i].index);
- }
+ sortParallelepipeds: function (parallelepipeds) {
+ let intersectionsParallelepipeds = this._getIntersectionsParallelepipeds(parallelepipeds);
+ let revIntersections = intersectionsParallelepipeds.reverseIntersections;
+ let countIntersection = intersectionsParallelepipeds.countIntersection;
- var addIndexes = {};
- var res = [];
- while (true) {
- var index = getMax();
+ let startIndexes = [];
+ for (let i = 0; i < countIntersection.length; i++) {
+ if (countIntersection[i] === 0) {
+ startIndexes.push({index: parseInt(i)});
+ }
+ }
- if (null === index) {
- break;
+ if (startIndexes.length === 0) {
+ //TODO сделано для графиков типа stacked, когда пересечения найдены всех параллалеп.
+ return this._getSortZIndexArray(parallelepipeds);
}
- res.push({nextIndex: index});
- addIndexes[index] = 1;
- }
- if (res.length < parallelepipeds.length) {
- return this._getSortZIndexArray(parallelepipeds);
- }
+ let g = revIntersections;
+ let color = {}; // цвет вершины (0, 1, или 2)
+ let time_in = {}, time_out = {}; // "времена" захода и выхода из вершины
+ let dfs_timer = 0;
- return res.reverse();
- },
+ let dfs = function (v) {
+ time_in[v] = dfs_timer++;
+ color[v] = 1;
- _getSortZIndexArray: function (arr) {
- arr.sort(function sortArr(a, b) {
- return b.z - a.z;
- });
- var result = [];
- for (var i = 0; i < arr.length; i++) {
- result.push({ nextIndex: i });
- }
- return result;
- },
-
- _getIntersectionsParallelepipeds: function (parallelepipeds) {
- //TODO нужно по максимуму оптимизировать, при большом количестве значений работает медленно
- var usuallyIntersect = {};
- var usuallyIntersectRev = {};
-
- var intersections = [];
- var reverseIntersections = [];
- var countIntersection = [];
- for (var i = 0; i < parallelepipeds.length; i++) {
- //из каждой точки данного параллалепипеда строим прямые до точки наблюдателя
- var fromParallalepiped = parallelepipeds[i];
- countIntersection[i] = 0;
-
- for (var m = 0; m < parallelepipeds.length; m++) {
- if (m === i || usuallyIntersect[i] === m || usuallyIntersectRev[i] === m) {
- continue;
+ for (let i in g[v]) {
+ if (!color[i]) {
+ dfs(i);
+ }
}
- if (parallelepipeds[m].isValZero && this.cChartDrawer.calcProp.subType !== "normal") {
- continue;
+
+ color[v] = 2;
+ time_out[v] = dfs_timer++;
+ };
+ let getMax = function () {
+ let max = 0;
+ let res = null;
+ for (let i in time_out) {
+ if (!addIndexes[i] && time_out[i] > max) {
+ max = time_out[i];
+ res = i;
+ }
}
+ return res;
+ };
- for (var l = 0; l < fromParallalepiped.arrPoints.length; l++) {
- //перебираем точки параллалепипеда FROM
- var point = fromParallalepiped.arrPoints[l];
-
- //перебираем грани параллалепипеда TO и проверяем на пересечения с прямыми из параллалепипеда FROM
- var toParallalepiped = parallelepipeds[m];
- for (var n = 0; n < toParallalepiped.faces.length; n++) {
- var toVerge = toParallalepiped.faces[n];
- var lineEqucation = this.cChartDrawer.getLineEquation(point, this.centralViewPoint);
- var intersection = this._isIntersectionFaceAndLine(toVerge, lineEqucation, point);
- if (intersection) {
- usuallyIntersect[i] = m;
- usuallyIntersectRev[m] = i;
-
- if (!intersections[i]) {
- intersections[i] = [];
- }
+ for (let i = 0; i < startIndexes.length; i++) {
+ dfs(startIndexes[i].index);
+ }
- if (!reverseIntersections[m]) {
- reverseIntersections[m] = [];
- }
+ let addIndexes = {};
+ let res = [];
+ while (true) {
+ let index = getMax();
+
+ if (null === index) {
+ break;
+ }
+
+ res.push({nextIndex: index});
+ addIndexes[index] = 1;
+ }
+ if (res.length < parallelepipeds.length) {
+ return this._getSortZIndexArray(parallelepipeds);
+ }
+
+ return res.reverse();
+ },
+
+ _getSortZIndexArray: function (arr) {
+ arr.sort(function sortArr(a, b) {
+ return b.z - a.z;
+ });
+ let result = [];
+ for (let i = 0; i < arr.length; i++) {
+ result.push({nextIndex: i});
+ }
+ return result;
+ },
+
+ _getIntersectionsParallelepipeds: function (parallelepipeds) {
+ //TODO нужно по максимуму оптимизировать, при большом количестве значений работает медленно
+ let usuallyIntersect = {};
+ let usuallyIntersectRev = {};
+
+ let intersections = [];
+ let reverseIntersections = [];
+ let countIntersection = [];
+ for (let i = 0; i < parallelepipeds.length; i++) {
+ //из каждой точки данного параллалепипеда строим прямые до точки наблюдателя
+ let fromParallalepiped = parallelepipeds[i];
+ countIntersection[i] = 0;
+
+ for (let m = 0; m < parallelepipeds.length; m++) {
+ if (m === i || usuallyIntersect[i] === m || usuallyIntersectRev[i] === m) {
+ continue;
+ }
+ if (parallelepipeds[m].isValZero && this.cChartDrawer.calcProp.subType !== "normal") {
+ continue;
+ }
+
+ for (let l = 0; l < fromParallalepiped.arrPoints.length; l++) {
+ //перебираем точки параллалепипеда FROM
+ let point = fromParallalepiped.arrPoints[l];
+
+ //перебираем грани параллалепипеда TO и проверяем на пересечения с прямыми из параллалепипеда FROM
+ let toParallalepiped = parallelepipeds[m];
+ for (let n = 0; n < toParallalepiped.faces.length; n++) {
+ let toVerge = toParallalepiped.faces[n];
+ let lineEqucation = this.cChartDrawer.getLineEquation(point, this.centralViewPoint);
+ let intersection = this._isIntersectionFaceAndLine(toVerge, lineEqucation, point);
+ if (intersection) {
+ usuallyIntersect[i] = m;
+ usuallyIntersectRev[m] = i;
- countIntersection[i]++;
+ if (!intersections[i]) {
+ intersections[i] = [];
+ }
- intersections[i][m] = 1;
- reverseIntersections[m][i] = 1;
+ if (!reverseIntersections[m]) {
+ reverseIntersections[m] = [];
+ }
- l = point.length;
- //console.log("fromParallalepiped: " + i + " toParallalepiped " + m + " x: " + intersection.x + " y: " + intersection.y + " z: " + intersection.z);
+ countIntersection[i]++;
- break;
+ intersections[i][m] = 1;
+ reverseIntersections[m][i] = 1;
+
+ l = point.length;
+ //console.log("fromParallalepiped: " + i + " toParallalepiped " + m + " x: " + intersection.x + " y: " + intersection.y + " z: " + intersection.z);
+
+ break;
+ }
}
}
}
}
- }
- return {
- intersections: intersections,
- reverseIntersections: reverseIntersections,
- countIntersection: countIntersection
- };
- },
+ return {
+ intersections: intersections, reverseIntersections: reverseIntersections, countIntersection: countIntersection
+ };
+ },
- //смотрим есть ли пересечения точек, выходящих из вершин данной грани, с другими гранями
- _isIntersectionFacesPointLines: function (plainVerge, i, sortZIndexPaths) {
- var res = false;
- var t = this;
+ //смотрим есть ли пересечения точек, выходящих из вершин данной грани, с другими гранями
+ _isIntersectionFacesPointLines: function (plainVerge, i, sortZIndexPaths) {
+ let res = false;
+ let t = this;
- for (var j = 0; j < plainVerge.points.length; j++) {
- var pointFromVerge = plainVerge.points[j];
- var lineEqucation = t.cChartDrawer.getLineEquation(pointFromVerge, this.centralViewPoint);
+ for (let j = 0; j < plainVerge.points.length; j++) {
+ let pointFromVerge = plainVerge.points[j];
+ let lineEqucation = t.cChartDrawer.getLineEquation(pointFromVerge, this.centralViewPoint);
- //пересечение грани и прямой
- if (t._isIntersectionFacesAndLine(lineEqucation, pointFromVerge, i, j, sortZIndexPaths)) {
- res = true;
- break;
+ //пересечение грани и прямой
+ if (t._isIntersectionFacesAndLine(lineEqucation, pointFromVerge, i, j, sortZIndexPaths)) {
+ res = true;
+ break;
+ }
}
- }
- return res;
- },
+ return res;
+ },
- //пересечение прямой с другими гранями
- _isIntersectionFacesAndLine: function (lineEqucation, pointFromVerge, i, j, sortZIndexPaths) {
- var res = false;
+ //пересечение прямой с другими гранями
+ _isIntersectionFacesAndLine: function (lineEqucation, pointFromVerge, i, j, sortZIndexPaths) {
+ let res = false;
- for (var k = 0; k < sortZIndexPaths.length; k++) {
- if (k === i)
- continue;
+ for (let k = 0; k < sortZIndexPaths.length; k++) {
+ if (k === i) {
+ continue;
+ }
- if (this._isIntersectionFaceAndLine(sortZIndexPaths[k], lineEqucation, pointFromVerge, i, j, k)) {
- res = true;
- break;
+ if (this._isIntersectionFaceAndLine(sortZIndexPaths[k], lineEqucation, pointFromVerge, i, j, k)) {
+ res = true;
+ break;
+ }
}
- }
- return res;
- },
+ return res;
+ },
- //пересечение прямой гранью
- _isIntersectionFaceAndLine: function (plain, lineEquation, pointFromVerge) {
- var res = false;
- var t = this;
+ //пересечение прямой гранью
+ _isIntersectionFaceAndLine: function (plain, lineEquation, pointFromVerge) {
+ let res = false;
+ let t = this;
- //get intersection
- var nIntersectionPlainAndLine = t.cChartDrawer.isIntersectionPlainAndLine(plain.plainEquation, lineEquation);
+ //get intersection
+ let nIntersectionPlainAndLine = t.cChartDrawer.isIntersectionPlainAndLine(plain.plainEquation, lineEquation);
- if (null === nIntersectionPlainAndLine) {
- return res;
- }
+ if (null === nIntersectionPlainAndLine) {
+ return res;
+ }
- var iSX = nIntersectionPlainAndLine.x;
- var iSY = nIntersectionPlainAndLine.y;
- var iSZ = nIntersectionPlainAndLine.z;
+ let iSX = nIntersectionPlainAndLine.x;
+ let iSY = nIntersectionPlainAndLine.y;
+ let iSZ = nIntersectionPlainAndLine.z;
- if (Math.round(iSZ * 1000) / 1000 < Math.round(pointFromVerge.z * 1000) / 1000) {
- var minMaxpoints = t.cChartDrawer.getMinMaxPoints(plain.points);
- var minX = minMaxpoints.minX, maxX = minMaxpoints.maxX, minY = minMaxpoints.minY,
- maxY = minMaxpoints.maxY, minZ = minMaxpoints.minZ, maxZ = minMaxpoints.maxZ;
+ if (Math.round(iSZ * 1000) / 1000 < Math.round(pointFromVerge.z * 1000) / 1000) {
+ let minMaxpoints = t.cChartDrawer.getMinMaxPoints(plain.points);
+ let minX = minMaxpoints.minX, maxX = minMaxpoints.maxX, minY = minMaxpoints.minY, maxY = minMaxpoints.maxY, minZ = minMaxpoints.minZ, maxZ = minMaxpoints.maxZ;
- var isBeetwenX = t._isBetweenPoint(iSX, minX, maxX);
- var isBeetwenY = t._isBetweenPoint(iSY, minY, maxY);
- var isBeetwenZ = t._isBetweenPoint(iSZ, minZ, maxZ);
+ let isBeetwenX = t._isBetweenPoint(iSX, minX, maxX);
+ let isBeetwenY = t._isBetweenPoint(iSY, minY, maxY);
+ let isBeetwenZ = t._isBetweenPoint(iSZ, minZ, maxZ);
- if (isBeetwenX && isBeetwenY && isBeetwenZ) {
- var point0 = plain.points2[0];
- var point1 = plain.points2[1];
- var point2 = plain.points2[2];
- var point3 = plain.points2[3];
+ if (isBeetwenX && isBeetwenY && isBeetwenZ) {
+ let point0 = plain.points2[0];
+ let point1 = plain.points2[1];
+ let point2 = plain.points2[2];
+ let point3 = plain.points2[3];
- var projectIntersection = nIntersectionPlainAndLine;
- if (!this.cChartDrawer.processor3D.view3D.getRAngAx()) {
- projectIntersection = t.cChartDrawer._convertAndTurnPoint(nIntersectionPlainAndLine.x, nIntersectionPlainAndLine.y, nIntersectionPlainAndLine.z, true, true);
- }
+ let projectIntersection = nIntersectionPlainAndLine;
+ if (!this.cChartDrawer.processor3D.view3D.getRAngAx()) {
+ projectIntersection =
+ t.cChartDrawer._convertAndTurnPoint(nIntersectionPlainAndLine.x, nIntersectionPlainAndLine.y, nIntersectionPlainAndLine.z, true, true);
+ }
- var areaQuadrilateral = plain.plainArea;
- var areaTriangle1 = t.cChartDrawer.getAreaTriangle(point0, projectIntersection, point1);
- var areaTriangle2 = t.cChartDrawer.getAreaTriangle(point1, projectIntersection, point2);
- var areaTriangle3 = t.cChartDrawer.getAreaTriangle(point2, projectIntersection, point3);
- var areaTriangle4 = t.cChartDrawer.getAreaTriangle(point3, projectIntersection, point0);
+ let areaQuadrilateral = plain.plainArea;
+ let areaTriangle1 = t.cChartDrawer.getAreaTriangle(point0, projectIntersection, point1);
+ let areaTriangle2 = t.cChartDrawer.getAreaTriangle(point1, projectIntersection, point2);
+ let areaTriangle3 = t.cChartDrawer.getAreaTriangle(point2, projectIntersection, point3);
+ let areaTriangle4 = t.cChartDrawer.getAreaTriangle(point3, projectIntersection, point0);
- if (parseInt(areaQuadrilateral) === parseInt(areaTriangle1 + areaTriangle2 + areaTriangle3 + areaTriangle4)) {
- //var pointFromVergeProject = t.cChartDrawer._convertAndTurnPoint(pointFromVerge.x, pointFromVerge.y, pointFromVerge.z, true, true);
- //console.log("x: " + projectIntersection.x + " ;y: " + projectIntersection.y + " ;fromX:" + pointFromVergeProject.x + " ;fromY:" + pointFromVergeProject.y);
+ if (parseInt(areaQuadrilateral) === parseInt(areaTriangle1 + areaTriangle2 + areaTriangle3 + areaTriangle4)) {
+ //let pointFromVergeProject = t.cChartDrawer._convertAndTurnPoint(pointFromVerge.x, pointFromVerge.y, pointFromVerge.z, true, true);
+ //console.log("x: " + projectIntersection.x + " ;y: " + projectIntersection.y + " ;fromX:" + pointFromVergeProject.x + " ;fromY:" + pointFromVergeProject.y);
- res = nIntersectionPlainAndLine;
+ res = nIntersectionPlainAndLine;
+ }
}
}
- }
- return res;
- },
+ return res;
+ },
- _isBetweenPoint: function (point, start, end) {
- //TODO округление пересмотреть
- var res = false;
- point = Math.round(point * 100) / 100;
- start = Math.round(start * 100) / 100;
- end = Math.round(end * 100) / 100;
+ _isBetweenPoint: function (point, start, end) {
+ //TODO округление пересмотреть
+ let res = false;
+ point = Math.round(point * 100) / 100;
+ start = Math.round(start * 100) / 100;
+ end = Math.round(end * 100) / 100;
- if (point >= start && point <= end) {
- res = true;
- }
+ if (point >= start && point <= end) {
+ res = true;
+ }
- return res;
- },
+ return res;
+ },
- _isEqualPoints: function (point1, point2) {
- //TODO округление пересмотреть
- var res = false;
+ _isEqualPoints: function (point1, point2) {
+ //TODO округление пересмотреть
+ let res = false;
- if (parseInt(point1.x) === parseInt(point2.x) && parseInt(point1.y) === parseInt(point2.y) && parseInt(point1.y) === parseInt(point2.y)) {
- res = true;
- }
+ if (parseInt(point1.x) === parseInt(point2.x) && parseInt(point1.y) === parseInt(point2.y) && parseInt(point1.y) === parseInt(point2.y)) {
+ res = true;
+ }
- return res;
- }
-};
+ return res;
+ }
+ };
//----------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
diff --git a/common/Charts/ChartStyles.js b/common/Charts/ChartStyles.js
index 2ee41f0cf1..d3c746520f 100644
--- a/common/Charts/ChartStyles.js
+++ b/common/Charts/ChartStyles.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Charts/ChartsDrawer.js b/common/Charts/ChartsDrawer.js
index 65b42223a3..31fd6633e1 100644
--- a/common/Charts/ChartsDrawer.js
+++ b/common/Charts/ChartsDrawer.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -189,7 +189,9 @@ CChartsDrawer.prototype =
//CHARTS
if (!chartSpace.bEmptySeries) {
for(var i in this.charts) {
- this.charts[i].recalculate();
+ if (this.charts.hasOwnProperty(i) && this.charts[i]) {
+ this.charts[i].recalculate();
+ }
}
}
@@ -204,6 +206,27 @@ CChartsDrawer.prototype =
//this._testChartsPaths();
},
+ getStandartMargin: function () {
+ return this.calcProp && AscFormat.isRealNumber(this.calcProp.pxToMM) ? standartMarginForCharts / this.calcProp.pxToMM : 0;
+ },
+
+ createChartEx: function (seria) {
+ this.charts = {};
+ switch (seria.layoutId) {
+ case AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN :
+ this.charts.chartEx= new drawHistogramChart(seria, this)
+ break
+ case AscFormat.SERIES_LAYOUT_WATERFALL :
+ this.charts.chartEx = new drawWaterfallChart(seria, this)
+ break
+ case AscFormat.SERIES_LAYOUT_FUNNEL :
+ this.charts.chartEx = new drawFunnelChart(seria, this)
+ break
+ default :
+ this.charts.chartEx = null;
+ }
+ },
+
init: function(chartSpace) {
//создаём область
this.areaChart = new areaChart();
@@ -215,60 +238,68 @@ CChartsDrawer.prototype =
this.backWall3DChart = new backWall3DChart();
//draw chart
- var newChart;
- for (var i = 0; i < chartSpace.chart.plotArea.charts.length; i++) {
- var chart = chartSpace.chart.plotArea.charts[i];
- switch (this._getChartType(chart)) {
- case c_oChartTypes.Bar: {
- newChart = new drawBarChart(chart, this);
- break;
- }
- case c_oChartTypes.Line: {
- newChart = new drawLineChart(chart, this);
- break;
- }
- case c_oChartTypes.HBar: {
- newChart = new drawHBarChart(chart, this);
- break;
- }
- case c_oChartTypes.Pie: {
- newChart = new drawPieChart(chart, this);
- break;
- }
- case c_oChartTypes.Scatter: {
- newChart = new drawScatterChart(chart, this);
- break;
- }
- case c_oChartTypes.Area: {
- newChart = new drawAreaChart(chart, this);
- break;
- }
- case c_oChartTypes.Stock: {
- newChart = new drawStockChart(chart, this);
- break;
- }
- case c_oChartTypes.DoughnutChart: {
- newChart = new drawDoughnutChart(chart, this);
- break;
- }
- case c_oChartTypes.Radar: {
- newChart = new drawRadarChart(chart, this);
- break;
- }
- case c_oChartTypes.BubbleChart: {
- newChart = new drawBubbleChart(chart, this);
- break;
+ let plotArea = chartSpace.chart.plotArea;
+ let newChart;
+ if (plotArea.isChartEx()) {
+ const series = plotArea.plotAreaRegion.series;
+ for (let i = 0; i < series.length; i++) {
+ this.createChartEx(series[i]);
+ }
+ } else {
+ for (let i = 0; i < plotArea.charts.length; i++) {
+ let chart = plotArea.charts[i];
+ switch (this._getChartType(chart)) {
+ case c_oChartTypes.Bar: {
+ newChart = new drawBarChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Line: {
+ newChart = new drawLineChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.HBar: {
+ newChart = new drawHBarChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Pie: {
+ newChart = new drawPieChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Scatter: {
+ newChart = new drawScatterChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Area: {
+ newChart = new drawAreaChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Stock: {
+ newChart = new drawStockChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.DoughnutChart: {
+ newChart = new drawDoughnutChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Radar: {
+ newChart = new drawRadarChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.BubbleChart: {
+ newChart = new drawBubbleChart(chart, this);
+ break;
+ }
+ case c_oChartTypes.Surface: {
+ newChart = new drawSurfaceChart(chart, this);
+ break;
+ }
}
- case c_oChartTypes.Surface: {
- newChart = new drawSurfaceChart(chart, this);
- break;
+ if (i === 0) {
+ this.chart = newChart;
+ this.charts = {};
}
+ this.charts[chart.Id] = newChart;
}
- if (i === 0) {
- this.chart = newChart;
- this.charts = {};
- }
- this.charts[chart.Id] = newChart;
}
},
@@ -279,7 +310,6 @@ CChartsDrawer.prototype =
var cShapeDrawer = new AscCommon.CShapeDrawer();
cShapeDrawer.Graphics = graphics;
- this.calcProp.series = chartSpace.chart.plotArea.chart.series;
this.cShapeDrawer = cShapeDrawer;
@@ -291,35 +321,46 @@ CChartsDrawer.prototype =
if(!bBeforeAxes && t.nDimensionCount === 3) {
return;
}
+ if (!chartSpace || !chartSpace.chart || !chartSpace.chart.plotArea) {
+ return;
+ }
- //для начала нужно отсортировать
- var sortCharts = t._sortChartsForDrawing(chartSpace);
- for(var i = 0; i < sortCharts.length; i++) {
- var id = sortCharts[i];
- var chartModel = t._getChartModelById(chartSpace.chart.plotArea, id);
- if(!chartModel) {
- continue;
- }
-
- var type = chartModel.getObjectType();
- var isLinesChart = type === AscDFH.historyitem_type_LineChart || type === AscDFH.historyitem_type_ScatterChart;
- //рисуем линейные диаграммы после отрисовки сетки
- if(t.nDimensionCount !== 3 && ((isLinesChart && bBeforeAxes) || (!isLinesChart && !bBeforeAxes))) {
- continue;
- }
-
- var bIsNoSmartAttack = false;
- if(t.nDimensionCount === 3 || isLinesChart) {
- bIsNoSmartAttack = true;
- }
-
- if(bIsNoSmartAttack) {
- t.cShapeDrawer.bIsNoSmartAttack = true;
+ if (chartSpace.isChartEx()) {
+ for (i in t.charts) {
+ if (t.charts.hasOwnProperty(i) && t.charts[i]) {
+ t.charts[i].draw();
+ }
}
- t.calcProp.series = chartModel.series;
- t.charts[id].draw();
- if(bIsNoSmartAttack) {
- t.cShapeDrawer.bIsNoSmartAttack = false;
+ } else {
+ //для начала нужно отсортировать
+ var sortCharts = t._sortChartsForDrawing(chartSpace);
+ for(var i = 0; i < sortCharts.length; i++) {
+ var id = sortCharts[i];
+ var chartModel = t._getChartModelById(chartSpace.chart.plotArea, id);
+ if(!chartModel) {
+ continue;
+ }
+
+ var type = chartModel.getObjectType();
+ var isLinesChart = type === AscDFH.historyitem_type_LineChart || type === AscDFH.historyitem_type_ScatterChart;
+ //рисуем линейные диаграммы после отрисовки сетки
+ if(t.nDimensionCount !== 3 && ((isLinesChart && bBeforeAxes) || (!isLinesChart && !bBeforeAxes))) {
+ continue;
+ }
+
+ var bIsNoSmartAttack = false;
+ if(t.nDimensionCount === 3 || isLinesChart) {
+ bIsNoSmartAttack = true;
+ }
+
+ if(bIsNoSmartAttack) {
+ t.cShapeDrawer.bIsNoSmartAttack = true;
+ }
+
+ t.charts[id].draw();
+ if(bIsNoSmartAttack) {
+ t.cShapeDrawer.bIsNoSmartAttack = false;
+ }
}
}
};
@@ -586,6 +627,7 @@ CChartsDrawer.prototype =
if (!this.cChartSpace.bEmptySeries) {
var type = obj.getObjectType();
+
switch (type) {
case AscDFH.historyitem_type_DLbl: {
pos = this._calculatePositionDlbl(obj);
@@ -595,7 +637,7 @@ CChartsDrawer.prototype =
var parentType = obj.parent ? obj.parent.getObjectType() : null;
if (parentType === AscDFH.historyitem_type_Chart) {
pos = this._calculatePositionTitle(obj);
- } else if (parentType === AscDFH.historyitem_type_ValAx || parentType === AscDFH.historyitem_type_CatAx || parentType === AscDFH.historyitem_type_DateAx) {
+ } else if (parentType === AscDFH.historyitem_type_ValAx || parentType === AscDFH.historyitem_type_CatAx || parentType === AscDFH.historyitem_type_DateAx || parentType === AscDFH.historyitem_type_Axis) {
pos = this._calculatePositionAxisTitle(obj.parent);
}
break;
@@ -639,18 +681,23 @@ CChartsDrawer.prototype =
_calculatePositionDlbl: function(obj/*chartSpace, ser, val, bLayout*/)
{
- var res = null;
-
- var chartSpace = obj.chart;
- var bLayout = AscCommon.isRealObject(obj.layout) && (AscFormat.isRealNumber(obj.layout.x) || AscFormat.isRealNumber(obj.layout.y));
- var serIdx = obj.series.idx;
- var valIdx = obj.pt.idx;
-
- var chartId = this._getChartModelIdBySerIdx(chartSpace.chart.plotArea, serIdx);
- if(null !== chartId && this.charts[chartId] && this.charts[chartId].chart && this.charts[chartId].chart.series) {
- //TODO нужно переделать все массивы с патами по idx
- var serIndex = this._getIndexByIdxSeria(this.charts[chartId].chart.series, serIdx);
- res = this.charts[chartId]._calculateDLbl(chartSpace, serIndex, valIdx, bLayout, serIdx);
+ let res = null;
+ if (obj.showChartExVal) {
+ if (this.charts && this.charts.chartEx) {
+ res = this.charts.chartEx._calculateDLbl(obj);
+ }
+ } else {
+ var chartSpace = obj.chart;
+ var bLayout = AscCommon.isRealObject(obj.layout) && (AscFormat.isRealNumber(obj.layout.x) || AscFormat.isRealNumber(obj.layout.y));
+ var serIdx = obj.series.idx;
+ var valIdx = obj.pt.idx;
+
+ var chartId = this._getChartModelIdBySerIdx(chartSpace.chart.plotArea, serIdx);
+ if(null !== chartId && this.charts[chartId] && this.charts[chartId].chart && this.charts[chartId].chart.series) {
+ //TODO нужно переделать все массивы с патами по idx
+ var serIndex = this._getIndexByIdxSeria(this.charts[chartId].chart.series, serIdx);
+ res = this.charts[chartId]._calculateDLbl(chartSpace, serIndex, valIdx, bLayout, serIdx);
+ }
}
return res;
@@ -864,22 +911,22 @@ CChartsDrawer.prototype =
},
_calculatePositionLabelsCatAxForRadar: function (idx) {
- var chartProp = this.calcProp;
+ let chartProp = this.calcProp;
- var trueWidth = chartProp.trueWidth;
- var trueHeight = chartProp.trueHeight;
- var xCenter = (chartProp.chartGutter._left + trueWidth / 2) / chartProp.pxToMM;
- var yCenter = (chartProp.chartGutter._top + trueHeight / 2) / chartProp.pxToMM;
+ let trueWidth = chartProp.trueWidth;
+ let trueHeight = chartProp.trueHeight;
+ let xCenter = (chartProp.chartGutter._left + trueWidth / 2) / chartProp.pxToMM;
+ let yCenter = (chartProp.chartGutter._top + trueHeight / 2) / chartProp.pxToMM;
- var seria = chartProp.series;
- var numChache = this.getNumCache(seria[0].val);
+ let radarChart = this.getChartByType(AscDFH.historyitem_type_RadarChart);
+ let ptCount = radarChart && radarChart.series && this.cChartDrawer.getPtCount(radarChart.series);
- var angle = (Math.PI * 2 / numChache.ptCount) * idx;
- var radius = (trueHeight / 2) / chartProp.pxToMM;
- var startAngle = (Math.PI / 2) * 3 + angle;
+ let angle = (Math.PI * 2 / ptCount) * idx;
+ let radius = (trueHeight / 2) / chartProp.pxToMM;
+ let startAngle = (Math.PI / 2) * 3 + angle;
- var x = xCenter + radius * Math.cos(startAngle);
- var y = yCenter + radius * Math.sin(startAngle);
+ let x = xCenter + radius * Math.cos(startAngle);
+ let y = yCenter + radius * Math.sin(startAngle);
return { x: x, y: y };
},
@@ -914,31 +961,58 @@ CChartsDrawer.prototype =
//добавляем размеры подписей осей + размеры названия
//TODO генерировать extX для всех осей
var axId = chartSpace.chart.plotArea.axId;
+ let isLeftAxis = false;
+ let isRightAxis = false;
+ let isTopExist = chartSpace && chartSpace.chart ? !!chartSpace.chart.title || (!!chartSpace.chart.legend && chartSpace.chart.legend.legendPos === Asc.c_oAscChartLegendShowSettings.top) : false;
+ let isVertAxisExist = false;
if(axId) {
for(var i = 0; i < axId.length; i++) {
- if(null !== axId[i].title) {
- switch (axId[i].axPos) {
- case window['AscFormat'].AX_POS_B: {
+ switch (axId[i].axPos) {
+ case window['AscFormat'].AX_POS_B: {
+ if (null !== axId[i].title) {
bottomTextLabels += axId[i].title.extY;
- break;
}
- case window['AscFormat'].AX_POS_T: {
+ break;
+ }
+ case window['AscFormat'].AX_POS_T: {
+ if (null !== axId[i].title) {
topTextLabels += axId[i].title.extY;
- break;
}
- case window['AscFormat'].AX_POS_L: {
+ break;
+ }
+ case window['AscFormat'].AX_POS_L: {
+ if (null !== axId[i].title) {
leftTextLabels += axId[i].title.extX;
- break;
}
- case window['AscFormat'].AX_POS_R: {
+ break;
+ }
+ case window['AscFormat'].AX_POS_R: {
+ if (null !== axId[i].title) {
rightTextLabels += axId[i].title.extX;
- break;
}
+ break;
+ }
+ }
+ const bLeftVert = axId[i].axPos === AscFormat.AX_POS_L;
+ const bRigthVert = axId[i].axPos === AscFormat.AX_POS_R;
+ if (!axId[i].bDelete) {
+ if (bLeftVert) {
+ isLeftAxis = axId[i].tickLblPos === AscFormat.TICK_LABEL_POSITION_NEXT_TO || axId[i].tickLblPos === AscFormat.TICK_LABEL_POSITION_LOW;
+ isRightAxis = axId[i].tickLblPos === AscFormat.TICK_LABEL_POSITION_HIGH;
}
+ if (bRigthVert) {
+ isLeftAxis = axId[i].tickLblPos === AscFormat.TICK_LABEL_POSITION_HIGH;
+ isRightAxis = axId[i].tickLblPos === AscFormat.TICK_LABEL_POSITION_NEXT_TO || axId[i].tickLblPos === AscFormat.TICK_LABEL_POSITION_LOW;
+ }
+ }
+ if (!axId[i].bDelete && axId[i].tickLblPos !== Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE && (bLeftVert || bRigthVert) && !isVertAxisExist) {
+ isVertAxisExist = true;
}
}
}
+ // if no vetical axis when top is not exist, then should work as if top exist
+ isTopExist = !isTopExist && !isVertAxisExist ? true : isTopExist;
//TITLE
var topMainTitle = 0;
@@ -1032,10 +1106,10 @@ CChartsDrawer.prototype =
}
if((null === pieChart) || is3dChart) {
- left += this._getStandartMargin(left, leftKey, leftTextLabels, 0) + leftKey + leftTextLabels;
+ left += this._getStandartMargin(isLeftAxis ? 1 : left, leftKey, leftTextLabels, 0) + leftKey + leftTextLabels;
bottom += this._getStandartMargin(bottom, bottomKey, bottomTextLabels, 0) + bottomKey + bottomTextLabels;
- top += this._getStandartMargin(top, topKey, topTextLabels, topMainTitle) + topKey + topTextLabels + topMainTitle;
- right += this._getStandartMargin(right, rightKey, rightTextLabels, 0) + rightKey + rightTextLabels;
+ top += this._getStandartMargin(isTopExist ? top : 1, topKey, topTextLabels, topMainTitle) + topKey + topTextLabels + topMainTitle;
+ right += this._getStandartMargin(isRightAxis ? 1 : right, rightKey, rightTextLabels, 0) + rightKey + rightTextLabels;
}
var pxLeft = calculateLeft ? calculateLeft * pxToMM : left * pxToMM;
@@ -1119,12 +1193,15 @@ CChartsDrawer.prototype =
var horizontalAxis = horizontalAxes ? horizontalAxes[0] : null;
var verticalAxis = verticalAxes ? verticalAxes[0] : null;
var crossBetween = null;
+ const plotArea = chartSpace && chartSpace.chart ? chartSpace.chart.plotArea : null;
+ const seria = plotArea && plotArea.plotAreaRegion ? plotArea.plotAreaRegion.series[0] : null;
+ const type = seria ? seria.layoutId : null;
+ const isChartEx = AscFormat.isRealNumber(type) && chartSpace ? chartSpace.isChartEx() : false;
if(verticalAxis instanceof AscFormat.CValAx) {
crossBetween = verticalAxis.crossBetween;
} else if(horizontalAxis instanceof AscFormat.CValAx) {
crossBetween = horizontalAxis.crossBetween;
}
-
if (horizontalAxis && horizontalAxis.xPoints && horizontalAxis.xPoints.length && this.calcProp.widthCanvas != undefined) {
if (horizontalAxis instanceof AscFormat.CValAx) {
if (!horizontalAxis.isReversed()) {
@@ -1134,33 +1211,31 @@ CChartsDrawer.prototype =
calculateLeft = horizontalAxis.xPoints[horizontalAxis.xPoints.length - 1].pos;
calculateRight = this.calcProp.widthCanvas / pxToMM - horizontalAxis.xPoints[0].pos;
}
- } else if ((horizontalAxis instanceof AscFormat.CCatAx || horizontalAxis instanceof AscFormat.CDateAx) && verticalAxis && !isNaN(verticalAxis.posX)) {
+ } else if (((horizontalAxis instanceof AscFormat.CCatAx || horizontalAxis instanceof AscFormat.CDateAx) && verticalAxis && !isNaN(verticalAxis.posX)) || isChartEx) {
diffPoints = horizontalAxis.xPoints[1] ? Math.abs(horizontalAxis.xPoints[1].pos - horizontalAxis.xPoints[0].pos) : Math.abs(horizontalAxis.xPoints[0].pos - verticalAxis.posX) * 2;
- curBetween = 0;
- if (!horizontalAxis.isReversed()) {
- if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN) {
- curBetween = diffPoints / 2;
- }
-
- calculateLeft = horizontalAxis.xPoints[0].pos - curBetween;
- calculateRight = this.calcProp.widthCanvas / pxToMM - (horizontalAxis.xPoints[horizontalAxis.xPoints.length - 1].pos + curBetween);
- } else {
- if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN) {
- curBetween = diffPoints / 2;
- }
-
- calculateLeft = horizontalAxis.xPoints[horizontalAxis.xPoints.length - 1].pos - curBetween;
- calculateRight = this.calcProp.widthCanvas / pxToMM - (horizontalAxis.xPoints[0].pos + curBetween);
- }
+ curBetween = (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN || isChartEx) ? diffPoints / 2 : 0;
+ // for reversed cases, start and end indexes are reversed!
+ const isReversed = horizontalAxis.isReversed();
+ const startIndex = (!isReversed || isChartEx) ? 0 : horizontalAxis.xPoints.length - 1;
+ const endIndex = (!isReversed || isChartEx) ? horizontalAxis.xPoints.length - 1 : 0;
+ calculateLeft = horizontalAxis.xPoints[startIndex].pos - curBetween;
+ calculateRight = this.calcProp.widthCanvas / pxToMM - (horizontalAxis.xPoints[endIndex].pos + curBetween);
}
}
if (verticalAxis && verticalAxis.yPoints && verticalAxis.yPoints.length && this.calcProp.heightCanvas != undefined) {
- if (verticalAxis instanceof AscFormat.CValAx) {
- if (!verticalAxis.isReversed()) {
- calculateTop = verticalAxis.yPoints[verticalAxis.yPoints.length - 1].pos;
- calculateBottom = this.calcProp.heightCanvas / pxToMM - verticalAxis.yPoints[0].pos;
+ if (verticalAxis instanceof AscFormat.CValAx || isChartEx) {
+ if (!verticalAxis.isReversed() || isChartEx) {
+ if (isChartEx && type === AscFormat.SERIES_LAYOUT_FUNNEL && verticalAxis.yPoints.length === 1) {
+ // for diagrams with single axis and single data point
+ let oSize = chartSpace ? chartSpace.getChartSizes() : {startY : 0, h : 0};
+ calculateTop = oSize.startY;
+ calculateBottom = this.calcProp.heightCanvas / pxToMM - (oSize.h + oSize.startY);
+ } else {
+ calculateTop = verticalAxis.yPoints[verticalAxis.yPoints.length - 1].pos;
+ calculateBottom = this.calcProp.heightCanvas / pxToMM - verticalAxis.yPoints[0].pos;
+ }
} else {
calculateTop = verticalAxis.yPoints[0].pos;
calculateBottom = this.calcProp.heightCanvas / pxToMM - verticalAxis.yPoints[verticalAxis.yPoints.length - 1].pos;
@@ -1188,6 +1263,15 @@ CChartsDrawer.prototype =
}
}
+ // for funnel chart
+ if (!horizontalAxis && isChartEx && verticalAxis && verticalAxis.labels && verticalAxis.yPoints) {
+ calculateLeft = this.cChartSpace && this.cChartSpace.plotAreaRect ? this.cChartSpace.plotAreaRect.x : 0;
+ let curBetween = verticalAxis.yPoints[1] ? Math.abs(verticalAxis.yPoints[1].pos - verticalAxis.yPoints[0].pos) / 2 : 0;
+ // curBetween = !curBetween && this.cChartSpace && this.cChartSpace.plotAreaRect ? verticalAxis.yPoints[0].pos - this.cChartSpace.plotAreaRect.y : curBetween;
+ calculateTop -= curBetween;
+ calculateBottom -= curBetween;
+ }
+
return {calculateLeft: calculateLeft, calculateRight : calculateRight, calculateTop: calculateTop, calculateBottom: calculateBottom};
},
@@ -1196,31 +1280,31 @@ CChartsDrawer.prototype =
var defMargin = standartMarginForCharts / this.calcProp.pxToMM;
var result;
- if (labelsMargin == 0 && keyMargin == 0 && textMargin == 0 && topMainTitleMargin == 0) {
+ if (labelsMargin === 0 && keyMargin === 0 && textMargin === 0 && topMainTitleMargin === 0) {
result = defMargin;
- } else if (labelsMargin != 0 && keyMargin == 0 && textMargin == 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin !== 0 && keyMargin === 0 && textMargin === 0 && topMainTitleMargin === 0) {
result = defMargin / 2;
- } else if (labelsMargin != 0 && keyMargin == 0 && textMargin != 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin !== 0 && keyMargin === 0 && textMargin !== 0 && topMainTitleMargin === 0) {
result = defMargin;
- } else if (labelsMargin != 0 && keyMargin != 0 && textMargin != 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin !== 0 && keyMargin !== 0 && textMargin !== 0 && topMainTitleMargin === 0) {
result = defMargin + defMargin / 2;
- } else if (labelsMargin == 0 && keyMargin != 0 && textMargin == 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin === 0 && keyMargin !== 0 && textMargin === 0 && topMainTitleMargin === 0) {
result = defMargin;
- } else if (labelsMargin == 0 && keyMargin == 0 && textMargin != 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin === 0 && keyMargin === 0 && textMargin !== 0 && topMainTitleMargin === 0) {
result = defMargin;
- } else if (labelsMargin == 0 && keyMargin != 0 && textMargin != 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin === 0 && keyMargin !== 0 && textMargin !== 0 && topMainTitleMargin === 0) {
result = defMargin + defMargin / 2;
- } else if (labelsMargin != 0 && keyMargin != 0 && textMargin == 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin !== 0 && keyMargin !== 0 && textMargin === 0 && topMainTitleMargin === 0) {
result = defMargin;
- } else if (labelsMargin == 0 && keyMargin != 0 && textMargin != 0 && topMainTitleMargin == 0) {
+ } else if (labelsMargin === 0 && keyMargin !== 0 && textMargin !== 0 && topMainTitleMargin === 0) {
result = defMargin + defMargin / 2;
- } else if (labelsMargin == 0 && keyMargin == 0 && topMainTitleMargin != 0) {
+ } else if (labelsMargin === 0 && keyMargin === 0 && topMainTitleMargin !== 0) {
result = defMargin + defMargin / 2;
- } else if (labelsMargin == 0 && keyMargin != 0 && topMainTitleMargin != 0) {
+ } else if (labelsMargin === 0 && keyMargin !== 0 && topMainTitleMargin !== 0) {
result = 2 * defMargin;
- } else if (labelsMargin != 0 && keyMargin == 0 && topMainTitleMargin != 0) {
+ } else if (labelsMargin !== 0 && keyMargin === 0 && topMainTitleMargin !== 0) {
result = defMargin;
- } else if (labelsMargin != 0 && keyMargin != 0 && topMainTitleMargin != 0) {
+ } else if (labelsMargin !== 0 && keyMargin !== 0 && topMainTitleMargin !== 0) {
result = 2 * defMargin;
}
@@ -1238,12 +1322,22 @@ CChartsDrawer.prototype =
let horizontalAxis = horizontalAxes ? horizontalAxes[0] : null;
let verticalAxis = verticalAxes ? verticalAxes[0] : null;
+ let getInterval = function (_axis) {
+ if (_axis.interval) {
+ return Math.abs((horizontalAxis.interval) / 2);
+ }
+ if (_axis.scale && _axis.scale.length > 1) {
+ return Math.abs(_axis.scale[1] - _axis.scale[0]);
+ }
+ return 1;
+ };
+
let diffPoints;
if(horizontalAxis && horizontalAxis.xPoints && horizontalAxis.xPoints.length) {
let orientationHorAxis = !horizontalAxis.isReversed();
diffPoints = 0;
if((horizontalAxis instanceof AscFormat.CDateAx || horizontalAxis instanceof AscFormat.CCatAx) && crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN) {
- diffPoints = Math.abs((horizontalAxis.interval) / 2);
+ diffPoints = getInterval(horizontalAxis);
}
if(orientationHorAxis) {
leftDownPointX = horizontalAxis.xPoints[0].pos - diffPoints;
@@ -1267,10 +1361,11 @@ CChartsDrawer.prototype =
if(verticalAxis && verticalAxis.yPoints && verticalAxis.yPoints.length) {
let orientationVerAxis = !verticalAxis.isReversed();
diffPoints = 0;
+ const isChartEx = chartSpace.isChartEx();
if((verticalAxis instanceof AscFormat.CDateAx || verticalAxis instanceof AscFormat.CCatAx)&& crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN) {
- diffPoints = Math.abs((verticalAxis.interval) / 2);
+ diffPoints = getInterval(verticalAxis);
}
- if(orientationVerAxis) {
+ if(orientationVerAxis || isChartEx) {
leftDownPointY = verticalAxis.yPoints[0].pos + diffPoints;
rightUpPointY = verticalAxis.yPoints[verticalAxis.yPoints.length - 1].pos - diffPoints;
} else {
@@ -1314,20 +1409,35 @@ CChartsDrawer.prototype =
var priorityAxis = [];
let charts = chartSpace.chart.plotArea.charts;
- for (let i = 0; i < charts.length; i++) {
- for (let j = 0; j < charts[i].axId.length; j++) {
- var axis = charts[i].axId[j];
+ const isChartEx = chartSpace.isChartEx();
+ if (isChartEx) {
+ var axId = chartSpace.chart.plotArea.axId;
+ for(var i = 0; i < axId.length; i++) {
+ var axis = chartSpace.chart.plotArea.axId[i];
if(axis.axPos === window['AscFormat'].AX_POS_R || axis.axPos === window['AscFormat'].AX_POS_L) {
- if (charts[i].getObjectType() === AscDFH.historyitem_type_RadarChart) {
- priorityAxis.push(axis);
- } else {
- res.push(axis);
+ if(!res) {
+ res = [];
+ }
+ res.push(axis);
+ }
+ }
+ return res;
+ } else {
+ for (let i = 0; i < charts.length; i++) {
+ for (let j = 0; j < charts[i].axId.length; j++) {
+ var axis = charts[i].axId[j];
+ if(axis.axPos === window['AscFormat'].AX_POS_R || axis.axPos === window['AscFormat'].AX_POS_L) {
+ if (charts[i].getObjectType() === AscDFH.historyitem_type_RadarChart) {
+ priorityAxis.push(axis);
+ } else {
+ res.push(axis);
+ }
}
}
}
+ return res.length || priorityAxis.length ? priorityAxis.concat(res) : null;
}
- return res.length || priorityAxis.length ? priorityAxis.concat(res) : null;
},
isRadarChart: function(axis) {
@@ -1353,8 +1463,27 @@ CChartsDrawer.prototype =
//считаем маргины
this._calculateMarginsChart(chartSpace);
- this.calcProp.trueWidth = this.calcProp.widthCanvas - this.calcProp.chartGutter._left - this.calcProp.chartGutter._right;
- this.calcProp.trueHeight = this.calcProp.heightCanvas - this.calcProp.chartGutter._top - this.calcProp.chartGutter._bottom;
+ // check if diagmar size affected by layout
+ const isLayoutSizes = this.cChartSpace.isLayoutSizes();
+
+ // layour should not affect for circular charts
+ let isCircular = false;
+ if (isLayoutSizes && chartSpace && chartSpace.chart && chartSpace.chart.plotArea && Array.isArray(chartSpace.chart.plotArea.charts)) {
+ const charts = chartSpace.chart.plotArea.charts;
+ for (let i = 0; i < charts.length; i++) {
+ const typeChart = charts[0].getObjectType();
+ isCircular = !isCircular ? (typeChart === AscDFH.historyitem_type_PieChart || typeChart === AscDFH.historyitem_type_DoughnutChart) : isCircular;
+ }
+ }
+
+ if (isLayoutSizes && !isCircular) {
+ this.calcProp.trueWidth = this.cChartSpace.chart.plotArea.extX * this.calcProp.pxToMM;
+ this.calcProp.trueHeight = this.cChartSpace.chart.plotArea.extY * this.calcProp.pxToMM;
+ this.calcProp.chartGutter._top = this.cChartSpace.chart.plotArea.y * this.calcProp.pxToMM;
+ } else {
+ this.calcProp.trueWidth = this.calcProp.widthCanvas - this.calcProp.chartGutter._left - this.calcProp.chartGutter._right;
+ this.calcProp.trueHeight = this.calcProp.heightCanvas - this.calcProp.chartGutter._top - this.calcProp.chartGutter._bottom;
+ }
},
//****new calculate data****
@@ -1534,6 +1663,7 @@ CChartsDrawer.prototype =
// add Trendline coordinates and precalculate all the necessary results
if (chartSpace && chartSpace.chart && chartSpace.chart.plotArea && chartSpace.chart.plotArea.charts) {
const charts = chartSpace.chart.plotArea.charts;
+ const dispBlanksAs = chartSpace.chart.dispBlanksAs;
for (let i = 0; i < charts.length; i++) {
if (charts[i].series) {
const subType = this.getChartGrouping(charts[i]);
@@ -1548,14 +1678,45 @@ CChartsDrawer.prototype =
if (!valPts || !valPts.length || seria.isHidden === true || valPts.length < 2) {
continue;
}
- this.trendline.init(valNumCache.ptCount);
// if xVal is given
const catNumCache = seria.xVal ? this.getNumCache(seria.xVal) : null;
const catPts = catNumCache ? catNumCache.pts : null;
- for (let k = 0; k < valPts.length; k++) {
- const catVal = catPts ? catPts[k].val : valPts[k].idx + 1;
- this.trendline.addCoordinate(catVal, valPts[k].val , charts[i].Id, seria.Id);
+
+ // obtain reference of targetPts either catpts or valpts;
+ const targetPts = catPts ? catPts : valPts;
+ let valIterator = 0;
+ let catIterator = 0;
+
+ const decideCatValue = function (index) {
+ ++catIterator;
+ return catPts ? targetPts[index].val : targetPts[index].idx + 1;
+ }
+
+ const decideValValue = function () {
+ return valPts[valIterator++].val
+ }
+
+ if (dispBlanksAs === AscFormat.DISP_BLANKS_AS_ZERO) {
+ const ptCount = catNumCache ? catNumCache.ptCount : valNumCache.ptCount;
+ for (let k = 0; k < ptCount; k++) {
+ const statement1 = catIterator < targetPts.length;
+ const statement2 = valIterator < valPts.length;
+ const catVal = statement1 && k === targetPts[catIterator].idx ? decideCatValue(catIterator) : 0;
+ const valVal = statement2 && k === valPts[valIterator].idx ? decideValValue() : 0;
+ this.trendline.addCoordinate(catVal, valVal, charts[i].Id, seria.Id);
+ }
+ } else {
+ for (let k = 0; k < targetPts.length && valIterator < valPts.length; k++) {
+ if ( targetPts[k].idx === valPts[valIterator].idx) {
+ const catVal = decideCatValue(k);
+ const valVal = decideValValue();
+ this.trendline.addCoordinate(catVal, valVal, charts[i].Id, seria.Id);
+ } else if (targetPts[k].idx > valPts[valIterator].idx) {
+ valIterator++;
+ k--;
+ }
+ }
}
}
}
@@ -1863,11 +2024,20 @@ CChartsDrawer.prototype =
}
} else {
if(series.length > 0) {
- //возможно стоит пройтись по всем сериям
- seria = series[0];
- numCache = t.getNumCache(seria.val);
+ // every chart except scatter should start from 1
min = 1;
- max = numCache ? numCache.ptCount : 1;
+ max = 1;
+ // find max value across each seria
+ for (let i = 0; i < series.length; i++) {
+ const seria = series[i];
+ if (seria) {
+ numCache = t.getNumCache(seria.val);
+ const ptCount = numCache && AscFormat.isRealNumber(numCache.ptCount) ? numCache.ptCount : 0;
+ // trendline can affect max value
+ const newMax = seria.trendline && seria.trendline.forward && ptCount > 1 ? ptCount + seria.trendline.forward : ptCount;
+ max = Math.max(max, newMax);
+ }
+ }
}
}
};
@@ -1890,6 +2060,12 @@ CChartsDrawer.prototype =
newArr[l][j] = [val.x, val.y];
}
}
+
+ // check the impact of trendline on scatter chart
+ if (series[l].trendline) {
+ min = series[l].trendline.backward ? min - series[l].trendline.backward : min;
+ max = series[l].trendline.forward ? max + series[l].trendline.forward : max;
+ }
}
};
@@ -1966,7 +2142,8 @@ CChartsDrawer.prototype =
let isOx = axis.axPos === window['AscFormat'].AX_POS_B || axis.axPos === window['AscFormat'].AX_POS_T;
//для оси категорий берем интервал 1
let arrayValues;
- if(AscDFH.historyitem_type_CatAx === axis.getObjectType() || AscDFH.historyitem_type_DateAx === axis.getObjectType()) {
+ const axisType = axis.getObjectType();
+ if(AscDFH.historyitem_type_CatAx === axisType || AscDFH.historyitem_type_DateAx === axisType) {
arrayValues = [];
let max = axis.max;
for(let i = axis.min; i <= max; i++) {
@@ -1992,7 +2169,7 @@ CChartsDrawer.prototype =
var bIsManualStep = false;
let t = this;
let calcAxisMinMax = function (isDefaultMinMax) {
- let trueMinMax = t._getTrueMinMax((manualMin !== null && manualMin > yMin) ? manualMin : yMin, (manualMax !== null && manualMax < yMax) ? manualMax : yMax, isDefaultMinMax, isScatter);
+ let trueMinMax = t._getTrueMinMax((manualMin !== null && manualMin > yMin) ? manualMin : yMin, (manualMax !== null && manualMax < yMax) ? manualMax : yMax, isDefaultMinMax, isScatter, manualMax);
let _axisMin, _axisMax, _step, firstDegree;
//TODO временная проверка для некорректных минимальных и максимальных значений
if (manualMax && manualMin && manualMax < manualMin) {
@@ -2025,7 +2202,8 @@ CChartsDrawer.prototype =
} else {
//было следующее условие - isOx || c_oChartTypes.HBar === this.calcProp.type
if (isOx /*&& !isScatter && axisMin !== 0 && axisMax !== 0*/) {
- _step = t._getStep(firstDegree.val + (firstDegree.val / 10) * 3);
+ _step = t._getStep(firstDegree.val + (firstDegree.val / 10) * 1.1111);
+ // _step = t._getStep(firstDegree.val);
} else {
_step = t._getStep(firstDegree.val);
}
@@ -2053,7 +2231,11 @@ CChartsDrawer.prototype =
}
if (isNaN(step) || step === 0) {
- arrayValues = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
+ if (AscFormat.isRealNumber(manualMax) && manualMax <= 0) {
+ arrayValues = [-1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0];
+ } else {
+ arrayValues = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
+ }
} else {
if (false && isRadarChart) {
arrayValues = this._getRadarAxisValues(axisMin, axisMax, step);
@@ -2136,13 +2318,21 @@ CChartsDrawer.prototype =
} else {
var limitArr = [0, 0, 32, 26, 24, 22, 21, 19, 18, 17, 16];
var limit = limitArr[res.length - 1];
- var heightGrid = Math.round((trueHeight / (res.length - 1)));
+ const num = (trueHeight / (res.length - 1));
+ var heightGrid = Math.round(num);
while (heightGrid <= limit) {
var firstDegreeStep = this._getFirstDegree(newStep);
var tempStep = this._getNextStep(firstDegreeStep.val);
newStep = tempStep * firstDegreeStep.numPow;
- res = this._getArrayDataValues(newStep, axisMin, axisMax, manualMin, manualMax);
+ const newRes = this._getArrayDataValues(newStep, axisMin, axisMax, manualMin, manualMax);
+
+ //new array cannot be generated from broken data, example: step is NaN
+ if (!newRes) {
+ break;
+ }
+ //after we checked that newRes is working array substitute res
+ res = newRes;
if (res.length <= 2) {
break;
}
@@ -2170,25 +2360,35 @@ CChartsDrawer.prototype =
},
_getArrayDataValues: function (step, axisMin, axisMax, manualMin, manualMax, isRadarChart) {
+ if (!AscFormat.isRealNumber(axisMin) || !AscFormat.isRealNumber(axisMax) || !AscFormat.isRealNumber(step)) {
+ return null;
+ }
+
var arrayValues;
//минимальное значение оси
//TODO use axisMin
- var minUnit = 0;
+ let minUnit = 0;
- if (manualMin != null) {
+ if (AscFormat.isRealNumber(manualMin)) {
minUnit = manualMin;
- } else if (manualMin == null && axisMin != null && axisMin != 0 && axisMin > 0 && axisMax > 0)//TODO пересмотреть все значения, где-то могут быть расхождения с EXCEL
- {
- minUnit = parseInt(axisMin / step) * step;
} else {
- if (axisMin < 0) {
- while ((!isRadarChart && minUnit >= axisMin) || (isRadarChart && minUnit > axisMin)) {
- minUnit -= step;
- }
- } else if (axisMin > 0) {
- while (minUnit < axisMin && minUnit > (axisMin - step)) {
- minUnit += step;
+ if (AscFormat.isRealNumber(manualMax) && manualMax > axisMin && manualMax >= 0) {
+ const stepCount = Math.ceil((manualMax - axisMin) / step);
+ minUnit = manualMax - (stepCount * step);
+ // minUnit = Math.min(minUnit, manualMax - upperLimit);
+ } else if (AscFormat.isRealNumber(manualMax)) {
+ if (manualMax > 0) {
+ minUnit = 0;
+ } else if (manualMax === 0) {
+ minUnit = -1;
+ } else {
+ minUnit = manualMax * 2;
}
+ } else {
+ // possible problems if axisMin < 0 should be checked
+ // const statement1 = !isRadarChart && minUnit >= axisMin;
+ // const statement2 = isRadarChart && minUnit > axisMin;
+ minUnit = Math.floor(axisMin / step) * step;
}
}
@@ -2209,9 +2409,8 @@ CChartsDrawer.prototype =
* axis contains min and max values and logBase
* if they are null just use yMin lowerBound and yMax upperBound
*/
- let kF = 1000000000;
- let trueMin = (axis && axis.scaling && axis.scaling.min) !== null ? Math.round(axis.scaling.min * kF) / kF : null;
- let trueMax = (axis && axis.scaling && axis.scaling.max) !== null ? Math.round(axis.scaling.max * kF) / kF : null;
+ let trueMin = (axis && axis.scaling && axis.scaling.min) !== null ? this._roundValue(axis.scaling.min) : null;
+ let trueMax = (axis && axis.scaling && axis.scaling.max) !== null ? this._roundValue(axis.scaling.max) : null;
yMin = (yMin <= 0 || yMin >= 1) ? 1 : yMin;
yMax = (yMax <= 0) ? logBase : yMax;
trueMin = (!trueMin || trueMin <= 0) ? yMin : trueMin;
@@ -2399,7 +2598,7 @@ CChartsDrawer.prototype =
return step;
},
- _getTrueMinMax: function (yMin, yMax, isStackedType, isScatter) {
+ _getTrueMinMax: function (yMin, yMax, isStackedType, isScatter, isMaxSet) {
var axisMax, axisMin, diffMaxMin;
var cDiff = 1/6;
@@ -2408,7 +2607,7 @@ CChartsDrawer.prototype =
// TODO пересмотреть все остальные ситуации!
if (yMin >= 0 && yMax >= 0) {
diffMaxMin = (yMax - yMin) / yMax;
- if (cDiff > diffMaxMin) {
+ if (isMaxSet === null && cDiff > diffMaxMin) {
if (isScatter) {
axisMin = isStackedType ? yMin : yMin - 0.05 * (yMax - yMin);
axisMax = isStackedType ? yMax : yMax + 0.05 * (yMax - yMin);
@@ -2455,107 +2654,477 @@ CChartsDrawer.prototype =
this.calcProp.pathH = 1000000000;
this.calcProp.pathW = 1000000000;
- this.calcProp.type = this._getChartType(chartSpace.chart.plotArea.chart);
- this.calcProp.subType = this.getChartGrouping(chartSpace.chart.plotArea.chart);
-
this.calcProp.xaxispos = null;
this.calcProp.yaxispos = null;
- //рассчёт данных и ещё некоторых параметров(this.calcProp./min/max/ymax/ymin/)
- if (!notCalcExtremum) {
- this._calculateExtremumAllCharts(chartSpace);
- }
+ const isChartEx = chartSpace.isChartEx();
- //***series***
- this.calcProp.series = chartSpace.chart.plotArea.chart.series;
+ if (!isChartEx) {
+ this.calcProp.type = this._getChartType(chartSpace.chart.plotArea.chart);
+ this.calcProp.subType = this.getChartGrouping(chartSpace.chart.plotArea.chart);
+ }
- //отсеиваем пустые серии
- var countSeries = this.calculateCountSeries(chartSpace.chart.plotArea.chart);
- this.calcProp.seriesCount = countSeries.series;
- this.calcProp.ptCount = countSeries.points;
+ if (!notCalcExtremum) {
+ if (!isChartEx) {
+ //calculate calcProp -> /min/max/ymax/ymin/
+ this._calculateExtremumAllCharts(chartSpace);
+ } else {
+ this._prepChartExData(chartSpace)
+ }
+ }
this.calcProp.widthCanvas = chartSpace.extX * this.calcProp.pxToMM;
this.calcProp.heightCanvas = chartSpace.extY * this.calcProp.pxToMM;
},
- _getChartType: function (chart) {
- var res;
- var typeChart = chart.getObjectType();
- switch (typeChart) {
- case AscDFH.historyitem_type_LineChart: {
- res = c_oChartTypes.Line;
- break;
- }
- case AscDFH.historyitem_type_BarChart: {
- if (chart.barDir !== AscFormat.BAR_DIR_BAR) {
- res = c_oChartTypes.Bar;
- } else {
- res = c_oChartTypes.HBar;
- }
- break;
- }
- case AscDFH.historyitem_type_PieChart: {
- res = c_oChartTypes.Pie;
- break;
- }
- case AscDFH.historyitem_type_AreaChart: {
- res = c_oChartTypes.Area;
- break;
- }
- case AscDFH.historyitem_type_ScatterChart: {
- res = c_oChartTypes.Scatter;
- break;
- }
- case AscDFH.historyitem_type_StockChart: {
- res = c_oChartTypes.Stock;
- break;
- }
- case AscDFH.historyitem_type_DoughnutChart: {
- res = c_oChartTypes.DoughnutChart;
- break;
- }
- case AscDFH.historyitem_type_RadarChart: {
- res = c_oChartTypes.Radar;
- break;
- }
- case AscDFH.historyitem_type_BubbleChart: {
- res = c_oChartTypes.BubbleChart;
- break;
- }
- case AscDFH.historyitem_type_SurfaceChart: {
- res = c_oChartTypes.Surface;
- break;
- }
+ _handleUserTypedChartExValMinMax: function (axis) {
+ if (!axis) {
+ return;
}
- return res;
- },
+ //check for user typed max and min properties
+ let trueMin = (axis.scaling && axis.scaling.min != null) ? this._roundValue(axis.scaling.min) : null;
+ let trueMax = (axis.scaling && axis.scaling.max != null) ? this._roundValue(axis.scaling.max) : null;
+ const isTrueMin = AscFormat.isRealNumber(trueMin);
+ const isTreuMax = AscFormat.isRealNumber(trueMax);
- getChartGrouping: function(chart) {
- var res = null;
+ if (isTrueMin && isTreuMax && trueMin >= trueMax) {
+ axis.max = 0;
+ axis.min = 0;
+ } else {
+ trueMin = AscFormat.isRealNumber(trueMin) ? trueMin : axis.min;
+ trueMax = AscFormat.isRealNumber(trueMax) ? trueMax : axis.max;
- var grouping = chart.grouping;
- var typeChart = chart.getObjectType();
+ //for special cases, when min greater than max, or max is negative
+ trueMax = (trueMax === 0 && trueMin >= 0) ? 1 : trueMax;
+ trueMax = (trueMin > 1 && trueMin > trueMax - 1) ? trueMax * 2 : trueMax;
+ trueMin = (trueMax < 0 && trueMax < trueMin) ? trueMax * 2 : trueMin;
- if (typeChart === AscDFH.historyitem_type_LineChart || typeChart === AscDFH.historyitem_type_AreaChart) {
- res = (grouping === AscFormat.GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === AscFormat.GROUPING_STACKED) ? "stacked" : "normal";
- } else if (this.nDimensionCount === 3 && grouping === AscFormat.BAR_GROUPING_STANDARD) {
- res = "standard";
- } else {
- res = (grouping === AscFormat.BAR_GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === AscFormat.BAR_GROUPING_STACKED) ? "stacked" : "normal";
+ axis.max = trueMax;
+ axis.min = trueMin;
}
-
- return res;
},
- calculateSizePlotArea : function(chartSpace, bNotRecalculate)
- {
- if(!bNotRecalculate || undefined === this.calcProp.chartGutter) {
- this._calculateMarginsChart(chartSpace);
+ _chartExHandleAxesConfigurations: function (axes, axisProperties) {
+ if (!axes || !Array.isArray(axes) || !axisProperties ) {
+ return;
}
- var widthCanvas = chartSpace.extX;
- var heightCanvas = chartSpace.extY;
-
+ for (let i = 0; i < axes.length; i++) {
+ const customAxis = axes[i].axPos === window['AscFormat'].AX_POS_T || axes[i].axPos === window['AscFormat'].AX_POS_B ? axisProperties.cat : axisProperties.val;
+ axes[i].min = customAxis.min;
+ axes[i].max = customAxis.max;
+ this._handleUserTypedChartExValMinMax(axes[i]);
+ axes[i].scale = customAxis.scale.length > 0 ? customAxis.scale : this._roundValues(this._getAxisValues2(axes[i], this.cChartSpace, false, false));
+ }
+ },
+
+ _chartExSetAxisMinAndMax: function (axis, num) {
+ if (!axis || (num !== 0 && !num)) {
+ return;
+ }
+ axis.max = (axis.max === null || num > axis.max) ? num : axis.max;
+ axis.min = (axis.min === null || num < axis.min) ? num : axis.min;
+ },
+
+ _chartExHandleAggregation: function (type, cachedData, numArr, strArr, axisProperties) {
+ if (type !== AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN || !cachedData || !numArr || !strArr || !axisProperties) {
+ return;
+ }
+ if (cachedData.aggregation) {
+ const aggregation = cachedData.aggregation;
+ axisProperties.cat.scale.push(1);
+ if (strArr.length !== 0) {
+ // create object of key and values
+ for (let i = 0; i < numArr.length; i++) {
+ const key = strArr[i].val;
+ if (!aggregation.hasOwnProperty(key)) {
+ aggregation[key] = 0;
+ }
+ aggregation[key] += numArr[i].val;
+ this._chartExSetAxisMinAndMax(axisProperties.val, aggregation[key]);
+ }
+ } else {
+ // Cases when labels do not exist
+ const val = numArr[0].val ? numArr[0].val : 0;
+ aggregation[''] = val;
+ this._chartExSetAxisMinAndMax(axisProperties.val, val);
+ }
+ }
+ },
+
+
+ _chartExHandleBinning: function (type, cachedData, numArr, axisProperties) {
+ if (type !== AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN || !cachedData || !numArr || !axisProperties) {
+ return;
+ }
+ if (cachedData.binning) {
+ const handleCatLimits = function (localBinning, axisProperties) {
+ if (!localBinning || !axisProperties || !axisProperties.cat) {
+ return;
+ }
+ // uncomment when excel will fix the problem of overflow and underflow being incorrect in some moments
+ // const statement1 = localBinning.intervalClosed !== AscFormat.INTERVAL_CLOSED_SIDE_L ? localBinning.overflow < axisProperties.cat.max && localBinning.overflow >= axisProperties.cat.min : localBinning.overflow <= axisProperties.cat.max && localBinning.overflow > axisProperties.cat.min;
+ // const statement2 = localBinning.intervalClosed !== AscFormat.INTERVAL_CLOSED_SIDE_L ? localBinning.underflow >= axisProperties.cat.min && localBinning.underflow < axisProperties.cat.max : localBinning.underflow > axisProperties.cat.min && localBinning.underflow <= axisProperties.cat.max;
+ // localBinning.overflow = ((localBinning.overflow === 0 || localBinning.overflow) && statement1) ? localBinning.overflow : null;
+ // localBinning.underflow = ((localBinning.underflow === 0 || localBinning.underflow) && statement2) ? localBinning.underflow : null;
+ localBinning.overflow = ((localBinning.overflow === 0 || localBinning.overflow) && localBinning.overflow < axisProperties.cat.max && localBinning.overflow >= axisProperties.cat.min) ? localBinning.overflow : null;
+ localBinning.underflow = ((localBinning.underflow === 0 || localBinning.underflow) && localBinning.underflow > axisProperties.cat.min && localBinning.underflow <= axisProperties.cat.max) ? localBinning.underflow : null;
+ const limits = {
+ isOverflowExist : localBinning.overflow === 0 || localBinning.overflow ? true : false,
+ isUnderflowExist : localBinning.underflow === 0 || localBinning.underflow ? true : false,
+ trueMax : null,
+ trueMin : null,
+ }
+ if (limits.isOverflowExist && limits.isUnderflowExist && localBinning.underflow > localBinning.overflow) {
+ localBinning.overflow = null;
+ limits.isOverflowExist = false;
+ }
+ limits.trueMax = limits.isOverflowExist ? localBinning.overflow : axisProperties.cat.max;
+ limits.trueMin = limits.isUnderflowExist ? localBinning.underflow : axisProperties.cat.min;
+ return limits;
+ }
+
+ const calculateBinSizeAndCount = function (localBinning, cL, numArr, axisProperties) {
+ if (!localBinning || !cL || !numArr || !axisProperties) {
+ return;
+ }
+ if (localBinning.binSize) {
+ localBinning.binCount = Math.max(Math.ceil((cL.trueMax - cL.trueMin) / localBinning.binSize), 1);
+ localBinning.normalized = true;
+ } else if (localBinning.binCount) {
+ localBinning.binCount -= (cL.isOverflowExist ? 1 : 0) + (cL.isUnderflowExist ? 1 : 0);
+ localBinning.binCount = Math.max(localBinning.binCount, 0);
+ localBinning.binSize = (localBinning.binCount != 0) ? ((cL.trueMax - cL.trueMin) / localBinning.binCount) : null;
+ localBinning.normalized = true;;
+ } else {
+ // Find stdev
+ // formula = sqrt((∑(x - mean)^2)/(n-1))
+ let isUnique = true;
+ let mean = 0;
+ let stDev = 0;
+ for (let i = 0; i < numArr.length; i++) {
+ mean += numArr[i].val;
+ }
+ mean /= numArr.length;
+
+ for (let i = 0; i < numArr.length; i++) {
+ isUnique = numArr[i].val === numArr[0].val ? true : false;
+ stDev += Math.pow((numArr[i].val - mean), 2);
+ }
+ stDev = Math.sqrt(stDev / Math.max(numArr.length - 1, 1));
+
+ // Calculate bin size and bin count
+ localBinning.binSize = (3.5 * stDev) / (Math.pow(numArr.length, 1 / 3));
+ localBinning.binCount = (localBinning.binSize) ? Math.max(Math.ceil((cL.trueMax - cL.trueMin) / localBinning.binSize), 1) : 1;
+ localBinning.normalized = false;
+ if (isUnique) {
+ localBinning.binSize = 5;
+ localBinning.binCount = 1;
+ localBinning.overflow = null;
+ localBinning.underflow = null;
+ }
+ }
+ }
+
+ const addRangesAndFillCatScale = function (localResults, localBinning, cL, axisProperties) {
+ if (!localResults || !localBinning || !cL || !axisProperties) {
+ return;
+ }
+ let prev = cL.trueMin;
+ const addRange = function (minVal, maxVal) {
+ localResults.push({ min: minVal, max: maxVal, occurrence: 0 });
+ }
+ if (cL.isUnderflowExist) {
+ addRange(null, prev);
+ }
+
+ axisProperties.cat.scale.push(prev);
+ for (let i = 0; i < localBinning.binCount; i++) {
+ let curr = prev + localBinning.binSize;
+
+ if (cL.isOverflowExist) {
+ curr = Math.min(curr, cL.trueMax);
+ }
+
+ addRange(prev, curr);
+ prev = curr;
+ axisProperties.cat.scale.push(curr);
+ }
+
+ if (cL.isOverflowExist) {
+ addRange(cL.trueMax, null);
+ }
+ }
+
+ const countOccurrencesAndValExtremum = function (localResults, localBinning, numArr, axisProperties, chartsDrawer) {
+ if (!localResults || !localBinning || !numArr || !axisProperties) {
+ return ;
+ }
+ if (numArr.length === 1) {
+ localResults[0].occurrence++;
+ chartsDrawer._chartExSetAxisMinAndMax(axisProperties.val, 1);
+ } else {
+ for (let i = 0; i < numArr.length; i++) {
+ // sometimes when bincount is fixed, values shifts into the last bean.
+ // if this issue will be fixed remove isFound and last if case
+ let isFound = false;
+ for (let j = 0; j < localResults.length; j++) {
+ const min = localResults[j].min;
+ const max = localResults[j].max;
+ const statement1 = (j === 0 && numArr[i].val === min);
+ const statement2 = localBinning.intervalClosed !== AscFormat.INTERVAL_CLOSED_SIDE_L ?
+ ((!min || numArr[i].val > min) && (!max || numArr[i].val <= max)) :
+ ((!min || numArr[i].val >= min) && (!max || numArr[i].val < max));
+ if (statement1 || statement2) {
+ isFound = true;
+ localResults[j].occurrence++;
+ chartsDrawer._chartExSetAxisMinAndMax(axisProperties.val, localResults[j].occurrence);
+ }
+ }
+ if (!isFound && localResults.length > 1) {
+ const lastIndex = localResults.length - 1;
+ localResults[lastIndex].occurrence++;
+ chartsDrawer._chartExSetAxisMinAndMax(axisProperties.val, localResults[lastIndex].occurrence);
+ }
+ }
+ }
+ }
+
+ const localBinning = cachedData.binning;
+ const localResults = cachedData.results;
+ const catLimits = handleCatLimits(localBinning, axisProperties);
+ calculateBinSizeAndCount(localBinning, catLimits, numArr, axisProperties);
+ // if binSize is calculated automatically, it must be rounded to two digits. Example: 78.65 = 79, 0.856 : 0.86!
+ const BINNING_PRECISION = 1;
+ localBinning.binSize = !localBinning.normalized ? this._roundValue(localBinning.binSize, true, BINNING_PRECISION) : localBinning.binSize;
+ addRangesAndFillCatScale(localResults, localBinning, catLimits, axisProperties);
+ countOccurrencesAndValExtremum(localResults, localBinning, numArr, axisProperties, this);
+ }
+ },
+
+ _chartExHandleClusteredColumn: function (type, cachedData, numArr, strArr, axisProperties) {
+ if (type !== AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN || !cachedData || !numArr || !axisProperties) {
+ return;
+ }
+
+ if (!cachedData.clusteredColumn) {
+ cachedData.clusteredColumn = {};
+ }
+ this._chartExSetAxisMinAndMax(axisProperties.val, 0);
+ this._chartExHandleAggregation(type, cachedData.clusteredColumn, numArr, strArr, axisProperties);
+ this._chartExHandleBinning(type, cachedData.clusteredColumn, numArr, axisProperties);
+ },
+
+ _chartExHandleWaterfall: function (type, cachedData, numArr, axisProperties, seria) {
+ if (type !== AscFormat.SERIES_LAYOUT_WATERFALL || !numArr || !axisProperties || !cachedData) {
+ return;
+ }
+
+ // prepare cached data
+ if (!cachedData.waterfall) {
+ cachedData.waterfall = {data: []};
+ }
+ cachedData.waterfall.numArr = numArr;
+
+ axisProperties.val.min = 0;
+ axisProperties.val.max = 0;
+ let sum = 0;
+
+ // Check if any total values exist is in the array
+ let index = 0;
+ const subtotals = seria.layoutPr && seria.layoutPr.subtotals ? seria.layoutPr.subtotals.idx : [];
+ const checkIsTotal = function (idx) {
+ if (index < subtotals.length) {
+ if (subtotals[index] === idx) {
+ index += 1;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ for (let i = 0; i < numArr.length; i++) {
+ const isTotal = checkIsTotal(numArr[i].idx);
+ sum = isTotal ? numArr[i].val : sum + numArr[i].val;
+ cachedData.waterfall.data.push({val: sum, isTotal: isTotal});
+ this._chartExSetAxisMinAndMax(axisProperties.val, sum);
+ axisProperties.cat.scale.push(numArr[i].idx + 1);
+ }
+ },
+
+ _chartExHandleFunnel: function (type, cachedData, numArr, axisProperties) {
+ if (type !== AscFormat.SERIES_LAYOUT_FUNNEL || !numArr || !axisProperties || !cachedData) {
+ return;
+ }
+
+ if (!cachedData.funnel) {
+ cachedData.funnel = [];
+ }
+
+ //if there is at least one element in the array then min is 1, however if there is no elements then min is 0
+ axisProperties.val.min = 0;
+ axisProperties.val.max = 0;
+ for (let i = 0; i < numArr.length; i++) {
+ this._chartExSetAxisMinAndMax(axisProperties.val, numArr[i].val);
+ cachedData.funnel.push(numArr[i].val);
+ axisProperties.val.scale.push(numArr.length - i);
+ }
+ },
+
+ _prepChartExData: function (chartSpace) {
+ // plotArea: CPlotArea
+ // data: CNumericPoint
+ if (!chartSpace || !chartSpace.chart || !chartSpace.chart.plotArea || !chartSpace.chart.plotArea.plotAreaRegion || !chartSpace.chart.plotArea.plotAreaRegion.series) {
+ return;
+ }
+
+ const plotArea = chartSpace.chart.plotArea;
+ const seria = plotArea.plotAreaRegion.series[0];
+ if (!seria) {
+ return;
+ }
+ const type = seria.layoutId;
+ const strCache = seria.getCatLit(type);
+ const numLit = seria.getValLit();
+
+ //createCache for storing information
+ const createCachedData = function (chart, seria) {
+
+ chart.cachedData = {}
+
+ if (seria.layoutPr) {
+ const binning = seria.layoutPr.binning;
+ const aggregation = seria.layoutPr.aggregation;
+ if (aggregation) {
+ chart.cachedData.clusteredColumn = {aggregation : {}};
+ }
+ if (binning) {
+ if (!chart.cachedData.clusteredColumn) {
+ chart.cachedData.clusteredColumn = {};
+ }
+ chart.cachedData.clusteredColumn.binning = {intervalClosed: binning.intervalClosed, overflow: binning.overflow, underflow: binning.underflow, binCount : binning.binCount, binSize : binning.binSize };
+ chart.cachedData.clusteredColumn.results = [];
+ }
+ }
+ }
+
+ createCachedData(plotArea.plotAreaRegion, seria);
+
+ if (numLit && numLit.pts && numLit.pts.length > 0) {
+
+ const numArr = numLit.pts;
+ const strArr = strCache ? strCache.pts : [];
+ const cachedData = plotArea.plotAreaRegion.cachedData;
+ const axisProperties = {
+ cat : {max: null, min:null, scale : []},
+ val : {max: null, min:null, scale : []},
+ }
+
+ if (cachedData) {
+
+ const calculateExtremums = function (type, axisProperties, numArr, chartsDrawer) {
+ // Histogram has unique labels. Example: [1, 3], (3, 7], ... etc.
+ if (type === AscFormat.SERIES_LAYOUT_FUNNEL || !axisProperties || !numArr || axisProperties.mean || axisProperties.catMax || axisProperties.catMin) {
+ return;
+ }
+ const isUniqueLabels = (type === AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN) ? true : false;
+ if (isUniqueLabels) {
+ for (let i = 0; i < numArr.length; i++) {
+ chartsDrawer._chartExSetAxisMinAndMax(axisProperties.cat, numArr[i].val);
+ }
+ } else {
+ axisProperties.cat.min = numArr.length > 0 ? numArr[0].idx + 1 : 0;
+ axisProperties.cat.max = numArr.length > 0 ? numArr[numArr.length - 1].idx + 1 : 0;
+ }
+ }
+
+ calculateExtremums(type, axisProperties, numArr, this);
+ this._chartExHandleClusteredColumn(type, plotArea.plotAreaRegion.cachedData, numArr, strArr, axisProperties);
+ this._chartExHandleWaterfall(type, plotArea.plotAreaRegion.cachedData, numArr, axisProperties, seria);
+ this._chartExHandleFunnel(type, plotArea.plotAreaRegion.cachedData, numArr, axisProperties);
+ this._chartExHandleAxesConfigurations(plotArea.axId, axisProperties);
+ }
+ }
+ },
+
+ _getChartType: function (chart) {
+ var res;
+ var typeChart = chart.getObjectType();
+ switch (typeChart) {
+ case AscDFH.historyitem_type_LineChart: {
+ res = c_oChartTypes.Line;
+ break;
+ }
+ case AscDFH.historyitem_type_BarChart: {
+ if (chart.barDir !== AscFormat.BAR_DIR_BAR) {
+ res = c_oChartTypes.Bar;
+ } else {
+ res = c_oChartTypes.HBar;
+ }
+ break;
+ }
+ case AscDFH.historyitem_type_PieChart: {
+ res = c_oChartTypes.Pie;
+ break;
+ }
+ case AscDFH.historyitem_type_AreaChart: {
+ res = c_oChartTypes.Area;
+ break;
+ }
+ case AscDFH.historyitem_type_ScatterChart: {
+ res = c_oChartTypes.Scatter;
+ break;
+ }
+ case AscDFH.historyitem_type_StockChart: {
+ res = c_oChartTypes.Stock;
+ break;
+ }
+ case AscDFH.historyitem_type_DoughnutChart: {
+ res = c_oChartTypes.DoughnutChart;
+ break;
+ }
+ case AscDFH.historyitem_type_RadarChart: {
+ res = c_oChartTypes.Radar;
+ break;
+ }
+ case AscDFH.historyitem_type_BubbleChart: {
+ res = c_oChartTypes.BubbleChart;
+ break;
+ }
+ case AscDFH.historyitem_type_SurfaceChart: {
+ res = c_oChartTypes.Surface;
+ break;
+ }
+ }
+ return res;
+ },
+
+ getChartGrouping: function(chart) {
+ var res = null;
+
+ var grouping = chart.grouping;
+ var typeChart = chart.getObjectType();
+
+ if (typeChart === AscDFH.historyitem_type_LineChart || typeChart === AscDFH.historyitem_type_AreaChart) {
+ res = (grouping === AscFormat.GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === AscFormat.GROUPING_STACKED) ? "stacked" : "normal";
+ } else if (this.nDimensionCount === 3 && grouping === AscFormat.BAR_GROUPING_STANDARD) {
+ res = "standard";
+ } else {
+ res = (grouping === AscFormat.BAR_GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === AscFormat.BAR_GROUPING_STACKED) ? "stacked" : "normal";
+ }
+
+ return res;
+ },
+
+ calculateSizePlotArea : function(chartSpace, bNotRecalculate)
+ {
+ if(!bNotRecalculate || undefined === this.calcProp.chartGutter) {
+ this._calculateMarginsChart(chartSpace);
+ }
+
+ var widthCanvas = chartSpace.extX;
+ var heightCanvas = chartSpace.extY;
+
var w = widthCanvas - (this.calcProp.chartGutter._left + this.calcProp.chartGutter._right) / this.calcProp.pxToMM;
var h = heightCanvas - (this.calcProp.chartGutter._top + this.calcProp.chartGutter._bottom) / this.calcProp.pxToMM;
@@ -2932,7 +3501,7 @@ CChartsDrawer.prototype =
}*/
- var getResult = function(index) {
+ var getResult = function(index, isChartEx) {
resPos = Math.abs(yPoints[index + 1].pos - yPoints[index].pos);
resVal = yPoints[index + 1].val - yPoints[index].val;
@@ -2943,29 +3512,22 @@ CChartsDrawer.prototype =
var res;
var startPos = yPoints[index].pos;
- if (!isOx) {
- if (!axis.isReversed()) {
- res = -(resPos / resVal) * (Math.abs(val - yPoints[index].val)) + startPos;
- } else {
- res = (resPos / resVal) * (Math.abs(val - yPoints[index].val)) + startPos;
- }
- } else {
- if (axis.isReversed()) {
- res = -(resPos / resVal) * (Math.abs(val - yPoints[index].val)) + startPos;
- } else {
- res = (resPos / resVal) * (Math.abs(val - yPoints[index].val)) + startPos;
- }
- }
+ // for the cases of reversed axis, direction is calculated
+ let firstDirection = !isOx && (!axis.isReversed() || isChartEx) ? -1 : 1;
+ let secondDirection = isOx && (axis.isReversed() || isChartEx) ? -1 : 1;
+
+ res = (firstDirection * secondDirection * (resPos / resVal) * (Math.abs(val - yPoints[index].val))) + startPos;
return res;
};
var i = 0, j = yPoints.length - 1, k;
+ const isChartEx = this.cChartSpace.isChartEx();
while (i <= j) {
k = Math.floor((i + j) / 2);
if (val >= yPoints[k].val && yPoints[k + 1] && val <= yPoints[k + 1].val) {
- result = getResult(k);
+ result = getResult(k, isChartEx);
break;
} else if (val < yPoints[k].val) {
j = k - 1;
@@ -3277,19 +3839,59 @@ CChartsDrawer.prototype =
_roundValues: function (values) {
if (values.length) {
for (let i = 0; i < values.length; i++) {
- let count = 1;
- let kF = 1000000000;
- if (values[i] !== 0 && Math.abs(values[i] * kF) < 1) {
- while (Math.abs(values[i]*kF) < 1) {
- kF *= 10;
- }
- }
- values[i] = Math.round(values[i] * kF) / (kF * count);
+ values[i] = this._roundValue(values[i]);
}
}
return values;
},
+
+ // if rounding is strong it affects whole number. Example 106.82 -> 107, for the precision 2
+ // if weak, then only decimal places. Example 106.82 ->106.8, for the precision 1
+ _roundValue: function (num, isStrong, precision) {
+ if (num !== 0 && (!num || !isFinite(num))) {
+ return 1;
+ }
+
+ if (num === 0) {
+ return num;
+ }
+
+ // if num is negative
+ let isNegative = false;
+ if (num < 0) {
+ isNegative = true;
+ num = -num;
+ }
+
+ if (!precision || precision < 0) {
+ //default precision is 9!
+ precision = 9;
+ }
+
+ let count = 0;
+
+ // Normalize the number by adjusting its scale
+ if (isStrong) {
+ while (num >= 10) {
+ num /= 10;
+ count++;
+ }
+ }
+
+ while (num < 1) {
+ num *= 10;
+ count--;
+ }
+
+ // Round the number to two decimal places
+ const kF = Math.pow(10, precision);
+ const roundedNum = Math.round(num * kF) / kF;
+
+ // Return the normalized number with the appropriate scale
+ num = (count >= 0) ? roundedNum * Math.pow(10, count) : roundedNum / Math.pow(10, -count);
+ return isNegative ? -num : num;
+ },
//***spline functions***
@@ -3465,6 +4067,12 @@ CChartsDrawer.prototype =
return {series: counter, points: ptCount};
},
+
+ calculateFirstChartCountSeries: function () {
+ let chart = this.cChartSpace && this.cChartSpace.chart && this.cChartSpace.chart.plotArea && this.cChartSpace.chart.plotArea.charts &&
+ this.cChartSpace.chart.plotArea.charts[0];
+ return chart ? this.calculateCountSeries(chart) : null;
+ },
//вспомогательные функции работающие с тремя координатами
//получаем к-ты уравнения прямой по 2 точкам
@@ -4249,6 +4857,66 @@ CChartsDrawer.prototype =
return res;
},
+ // Draws a rectangle,
+ // params are start x and y, width, height and isCOnverted
+ _calculateRect: function (x, y, w, h, isPxToMmConverted) {
+ if (!this.cChartSpace || !this.calcProp) {
+ return null;
+ }
+ const pathId = this.cChartSpace.AllocPath();
+ const path = this.cChartSpace.GetPath(pathId);
+
+ const pathH = this.calcProp.pathH;
+ const pathW = this.calcProp.pathW;
+
+ if (!isPxToMmConverted) {
+ const pxToMm = this.calcProp.pxToMM;
+ x = x / pxToMm;
+ y = y / pxToMm;
+ w = w / pxToMm;
+ h = h / pxToMm;
+ }
+
+ path.moveTo(x * pathW, y * pathH);
+ path.lnTo(x * pathW, (y - h) * pathH);
+ path.lnTo((x + w) * pathW, (y - h) * pathH);
+ path.lnTo((x + w) * pathW, y * pathH);
+ path.lnTo(x * pathW, y * pathH);
+
+ return pathId;
+ },
+
+ // Draws a line,
+ // params are point1, length, constPoint, isVertical, and isPxToMmConverted
+ _calculateLine: function (p1, l, constP, isVertical, isPxToMmConverted) {
+ if (!this.cChartSpace || !this.calcProp) {
+ return null;
+ }
+
+ const pathId = this.cChartSpace.AllocPath();
+ const path = this.cChartSpace.GetPath(pathId);
+
+ const pathH = this.calcProp.pathH;
+ const pathW = this.calcProp.pathW;
+
+ if (!isPxToMmConverted) {
+ const pxToMm = this.calcProp.pxToMM;
+ p1 = p1 / pxToMm;
+ l = l / pxToMm;
+ constP = constP / pxToMm;
+ }
+
+ if (isVertical) {
+ path.moveTo(constP * pathW, p1 * pathH);
+ path.lnTo(constP * pathW, (p1 - l) * pathH);
+ } else {
+ path.moveTo(p1 * pathW, constP * pathH);
+ path.lnTo(p1 + l * pathW, constP * pathH);
+ }
+
+ return pathId;
+ },
+
_calculatePathFaceCylinder: function(segmentPoints, segmentPoints2, up, down, isConvertPxToMM, check)
{
var pxToMm = 1;
@@ -4507,10 +5175,10 @@ CChartsDrawer.prototype =
//common functions for grid
getHorizontalGridLines: function (axis, isCatAxis) {
- var t = this;
- var gridLines, minorGridLines;
- var crossBetween = this.cChartSpace.getValAxisCrossType();
- var points = axis.yPoints;
+ let t = this;
+ let gridLines, minorGridLines;
+ let crossBetween = this.cChartSpace.getValAxisCrossType();
+ let points = axis.yPoints;
if(!points) {
return;
@@ -4519,24 +5187,25 @@ CChartsDrawer.prototype =
return;
}
- var widthLine = this.calcProp.widthCanvas - (this.calcProp.chartGutter._left + this.calcProp.chartGutter._right);
- var bottomMargin = this.calcProp.heightCanvas - this.calcProp.chartGutter._bottom;
- var posX = this.calcProp.chartGutter._left;
- var posMinorY, posY, crossDiff;
+ let widthLine = this.calcProp.trueWidth;
+ let bottomMargin = this.calcProp.heightCanvas - this.calcProp.chartGutter._bottom;
+ let posX = this.calcProp.chartGutter._left;
+ let posMinorY, posY, crossDiff;
if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && isCatAxis) {
- var posAxis = (this.calcProp.heightCanvas - this.calcProp.chartGutter._bottom)/this.calcProp.pxToMM;
+ let posAxis = (this.calcProp.heightCanvas - this.calcProp.chartGutter._bottom)/this.calcProp.pxToMM;
crossDiff = points[1] ? Math.abs((points[1].pos - points[0].pos) / 2) : Math.abs(points[0].pos - posAxis);
}
let isRadarValues = axis.isRadarValues();
-
- //TODO пересмотреть отрисовку сетки для Radar, не использовать numCache!
- var numCache, tempAngle, trueHeight, trueWidth, xDiff, xCenter, yCenter;
+
+ let ptCount, tempAngle, trueHeight, trueWidth, xDiff, xCenter, yCenter;
if(isRadarValues) {
- numCache = this.getNumCache(this.calcProp.series[0].val);
- if(numCache) {
- tempAngle = 2 * Math.PI / numCache.length;
+ let radarChart = this.getChartByType(AscDFH.historyitem_type_RadarChart);
+ let ptCount = radarChart && radarChart.series && this.getPtCount(radarChart.series);
+
+ if(ptCount) {
+ tempAngle = 2 * Math.PI / ptCount;
trueHeight = this.calcProp.trueHeight;
trueWidth = this.calcProp.trueWidth;
xDiff = ((trueHeight / 2) / points.length) / this.calcProp.pxToMM;
@@ -4545,10 +5214,10 @@ CChartsDrawer.prototype =
}
}
- var calculateRadarGridLines = function () {
- var y, x, radius, xFirst, yFirst;
+ let calculateRadarGridLines = function () {
+ let y, x, radius, xFirst, yFirst;
- for (var k = 0; k < numCache.length; k++) {
+ for (let k = 0; k < ptCount; k++) {
y = i * xDiff;
x = xCenter;
@@ -4557,8 +5226,8 @@ CChartsDrawer.prototype =
y = yCenter - radius * Math.cos(k * tempAngle);
x = x + radius * Math.sin(k * tempAngle);
- var pathH = t.calcProp.pathH;
- var pathW = t.calcProp.pathW;
+ let pathH = t.calcProp.pathH;
+ let pathW = t.calcProp.pathW;
path.stroke = true;
if (k === 0) {
@@ -4566,7 +5235,7 @@ CChartsDrawer.prototype =
yFirst = y;
path.moveTo(x * pathW, y * pathH);
} else {
- if (k === numCache.length - 1) {
+ if (k === ptCount - 1) {
path.lnTo(x * pathW, y * pathH);
path.lnTo(xFirst * pathW, yFirst * pathH);
} else {
@@ -4580,16 +5249,16 @@ CChartsDrawer.prototype =
}
};
- var minorLinesCount = isCatAxis ? 2 : 5;
- var stepY = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[0].pos - axis.posY) * 2;
- var minorStep = (stepY / minorLinesCount) * this.calcProp.pxToMM;
+ let minorLinesCount = isCatAxis ? 2 : 5;
+ let stepY = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[0].pos - axis.posY) * 2;
+ let minorStep = (stepY / minorLinesCount) * this.calcProp.pxToMM;
- var pathId = t.cChartSpace.AllocPath();
- var path = t.cChartSpace.GetPath(pathId);
- var i;
+ let pathId = t.cChartSpace.AllocPath();
+ let path = t.cChartSpace.GetPath(pathId);
+ let i;
for (i = 0; i < points.length; i++) {
if(isRadarValues) {
- if(numCache) {
+ if(ptCount) {
calculateRadarGridLines();
}
} else {
@@ -4623,8 +5292,8 @@ CChartsDrawer.prototype =
}
}
- var pathIdMinor = t.cChartSpace.AllocPath();
- var pathMinor = t.cChartSpace.GetPath(pathIdMinor);
+ let pathIdMinor = t.cChartSpace.AllocPath();
+ let pathMinor = t.cChartSpace.GetPath(pathIdMinor);
for (i = 0; i < points.length; i++) {
if(!isRadarValues) {
if(isCatAxis && points[i].val < 0) {
@@ -4638,7 +5307,7 @@ CChartsDrawer.prototype =
}
//промежуточные линии
- for (var n = 0; n < minorLinesCount; n++) {
+ for (let n = 0; n < minorLinesCount; n++) {
posMinorY = posY + n * minorStep;
if (posMinorY < this.calcProp.chartGutter._top || posMinorY > bottomMargin) {
@@ -4654,19 +5323,23 @@ CChartsDrawer.prototype =
}
}
-
return {gridLines: gridLines, minorGridLines: minorGridLines};
},
getVerticalGridLines: function (axis, isCatAxis) {
var gridLines, minorGridLines;
+ const isChartEx = this.cChartSpace.isChartEx();
var crossBetween = this.cChartSpace.getValAxisCrossType();
if(null === crossBetween && isCatAxis) {
crossBetween = axis.crossAx ? axis.crossAx.crossBetween : null;
}
- var heightLine = this.calcProp.heightCanvas - (this.calcProp.chartGutter._bottom + this.calcProp.chartGutter._top);
+ if(null === crossBetween && isChartEx) {
+ crossBetween = 0;
+ }
+
+ var heightLine = this.calcProp.trueHeight;
var rightMargin = this.calcProp.widthCanvas - this.calcProp.chartGutter._right;
var posY = this.calcProp.chartGutter._top;
var posMinorX;
@@ -4678,15 +5351,14 @@ CChartsDrawer.prototype =
if(!axis.majorGridlines && !axis.minorGridlines) {
return;
}
-
- var minorLinesCount = isCatAxis ? 2 : 5;
+ var minorLinesCount = isCatAxis || isChartEx ? 2 : 5;
var posAxis = this.calcProp.chartGutter._left / this.calcProp.pxToMM;
var stepX = points[1] ? Math.abs((points[1].pos - points[0].pos)) : (Math.abs(points[0].pos - posAxis) * 2);
var minorStep = (stepX * this.calcProp.pxToMM) / minorLinesCount;
var posX, crossDiff;
- if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && isCatAxis) {
+ if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && (isCatAxis || isChartEx)) {
crossDiff = points[1] ? Math.abs((points[1].pos - points[0].pos) / 2) : Math.abs(points[0].pos - posAxis);
}
@@ -4694,7 +5366,7 @@ CChartsDrawer.prototype =
var path = this.cChartSpace.GetPath(pathId);
var i;
for (i = 0; i < points.length; i++) {
- if(isCatAxis && points[i].val < 0) {
+ if((isCatAxis && points[i].val < 0) && !isChartEx) {
continue;
}
@@ -4725,7 +5397,7 @@ CChartsDrawer.prototype =
var pathIdMinor = this.cChartSpace.AllocPath();
var pathMinor = this.cChartSpace.GetPath(pathIdMinor);
for (i = 0; i < points.length; i++) {
- if(isCatAxis && points[i].val < 0) {
+ if((isCatAxis && points[i].val < 0) && !isChartEx) {
continue;
}
@@ -4880,7 +5552,9 @@ CChartsDrawer.prototype =
yCenter = (this.calcProp.chartGutter._top + trueHeight / 2) / this.calcProp.pxToMM;
}
- var ptCount = this.getPtCount(this.calcProp.series);
+ let radarChart = this.getChartByType(AscDFH.historyitem_type_RadarChart);
+ let ptCount = radarChart && radarChart.series && this.getPtCount(radarChart.series);
+
if (!ptCount) {
return null;
}
@@ -5949,6 +6623,15 @@ CChartsDrawer.prototype =
return pathId;
},
+
+ getChartByType: function (type) {
+ for (let i in this.charts) {
+ if (this.charts[i] && this.charts[i].chart.getObjectType() === type) {
+ return this.charts[i].chart;
+ }
+ }
+ return null;
+ }
};
@@ -6189,7 +6872,7 @@ drawBarChart.prototype = {
cubeCount++;
} else {
- paths = this._calculateRect(startX, startY, individualBarWidth, height);
+ paths = this.cChartDrawer._calculateRect(startX, startY, individualBarWidth, height);
}
var serIdx = this.chart.series[i].idx;
@@ -6640,25 +7323,6 @@ drawBarChart.prototype = {
return {x: centerX, y: centerY};
},
- _calculateRect: function (x, y, w, h) {
- var pathId = this.cChartSpace.AllocPath();
- var path = this.cChartSpace.GetPath(pathId);
-
- var pathH = this.chartProp.pathH;
- var pathW = this.chartProp.pathW;
-
-
- var pxToMm = this.chartProp.pxToMM;
-
- path.moveTo(x / pxToMm * pathW, y / pxToMm * pathH);
- path.lnTo(x / pxToMm * pathW, (y - h) / pxToMm * pathH);
- path.lnTo((x + w) / pxToMm * pathW, (y - h) / pxToMm * pathH);
- path.lnTo((x + w) / pxToMm * pathW, y / pxToMm * pathH);
- path.lnTo(x / pxToMm * pathW, y / pxToMm * pathH);
-
- return pathId;
- },
-
//TODO delete after test
_DrawBars3D2: function () {
@@ -7018,201 +7682,783 @@ drawBarChart.prototype = {
point8 = this.cChartDrawer._convertAndTurnPoint(x82, y82, z82);
- var needAddOnlyFrontFace = this.subType === "standard";
- var nullPositionOX = this.catAx.posY * this.chartProp.pxToMM;
+ var needAddOnlyFrontFace = this.subType === "standard";
+ var nullPositionOX = this.catAx.posY * this.chartProp.pxToMM;
+
+ var t = this;
+ var dRadius1, dRadius2, uRadius1, uRadius2;
+ var calcCylinderProps = function (bCone) {
+ //большая и малая полуось оснований усеченного конуса
+ if (bCone) {
+ // за оси эллипса берем 1/2 длин ребер оснований усеченной пирамиды
+ points = t.cChartDrawer.isConeIntersection(false, t.subType, startX, startY, height, gapDepth, individualBarWidth, perspectiveDepth, val, nullPositionOX, maxH, minH);
+
+ if (t.val === 0) {
+ uRadius1 = 0;
+ uRadius2 = 0;
+ dRadius1 = points.wDown;
+ dRadius2 = points.lDown;
+ } else if ((t.subType === "stacked" || t.subType === "stackedPer") && t.cChartSpace.chart.plotArea.valAx.isReversed()) {
+ uRadius1 = points.wUp !== 0 ? points.wUp : individualBarWidth / 2;
+ uRadius2 = points.lUp !== 0 ? points.lUp : perspectiveDepth / 2;
+ dRadius1 = points.wDown;
+ dRadius2 = points.lDown;
+ } else {
+ uRadius1 = points.wUp;
+ uRadius2 = points.lUp;
+ dRadius1 = points.wDown !== 0 ? points.wDown : individualBarWidth / 2;
+ dRadius2 = points.lDown !== 0 ? points.lDown : perspectiveDepth/ 2;
+ }
+
+ } else {
+ //большая и малая полуось эллипса
+ dRadius1 = individualBarWidth / 2;
+ dRadius2 = perspectiveDepth / 2;
+ }
+ };
+
+
+ var facePoints;
+ switch (type) {
+ case AscFormat.BAR_SHAPE_PYRAMID:
+ case AscFormat.BAR_SHAPE_PYRAMIDTOMAX: {
+ var nullPositionOX = this.subType === "stacked" ? this.cChartDrawer.getPositionZero(this.valAx) :
+ this.catAx.posY * this.chartProp.pxToMM;
+ paths = this.cChartDrawer.calculatePyramid(false, this.subType, startX, startY, height, gapDepth,
+ individualBarWidth, perspectiveDepth, val, nullPositionOX, maxH, minH);
+
+ paths = paths.paths;
+ break
+ }
+ case AscFormat.BAR_SHAPE_CYLINDER: {
+ //paths = this.cChartDrawer._calculateCylinder(startX, startY, individualBarWidth, height, val, gapDepth, perspectiveDepth, this.subType !== "standard", false, false);
+
+ calcCylinderProps();
+ this.cChartDrawer.calcShapesHelper.setProps(startX, startY, gapDepth, individualBarWidth, height, perspectiveDepth, needAddOnlyFrontFace, val, false, dRadius1, dRadius2);
+ paths = this.cChartDrawer.calcShapesHelper.getCylinder();
+
+ break;
+ }
+ case AscFormat.BAR_SHAPE_CONE:
+ case AscFormat.BAR_SHAPE_CONETOMAX: {
+ //paths = this.cChartDrawer._calculateCylinder(startX, startY, individualBarWidth, height, val, gapDepth, perspectiveDepth, this.subType !== "standard", false, this.subType, nullPositionOX, maxH, minH);
+
+ calcCylinderProps(true);
+ this.cChartDrawer.calcShapesHelper.setProps(startX, startY, gapDepth, individualBarWidth, height, perspectiveDepth, needAddOnlyFrontFace, val, false, dRadius1, dRadius2, uRadius1, uRadius2);
+ paths = this.cChartDrawer.calcShapesHelper.getCone();
+
+ break;
+ }
+ default: {
+ points = [point1, point2, point3, point4, point5, point6, point7, point8];
+ paths = this.cChartDrawer.calculateRect3D(points, val, null, this.subType !== "standard", false);
+ break;
+ }
+ }
+
+ facePoints = [[point1, point4, point8, point5], [point1, point2, point3, point4],
+ [point1, point2, point6, point5], [point4, point8, point7, point3], [point5, point6, point7, point8],
+ [point2, point3, point7, point6]];
+
+ //paths2 для расчета подписей, в дальнейшем нужно оптимизировать этот процесс
+ points = [point1, point2, point3, point4, point5, point6, point7, point8];
+ paths2 = this.cChartDrawer.calculateRect3D(points, val, isNotDrawDownVerge);
+
+ if (this.subType !== "standard") {
+
+ height = testHeight;
+ x12 = startX, y12 = startY, z12 = 0 + gapDepth;
+ x22 = startX, y22 = startY, z22 = perspectiveDepth + gapDepth;
+ x32 = startX + individualBarWidth, y32 = startY, z32 = perspectiveDepth + gapDepth;
+ x42 = startX + individualBarWidth, y42 = startY, z42 = 0 + gapDepth;
+ x52 = startX, y52 = startY - height, z52 = 0 + gapDepth;
+ x62 = startX, y62 = startY - height, z62 = perspectiveDepth + gapDepth;
+ x72 = startX + individualBarWidth, y72 = startY - height, z72 = perspectiveDepth + gapDepth;
+ x82 = startX + individualBarWidth, y82 = startY - height, z82 = 0 + gapDepth;
+
+ point1 = this.cChartDrawer._convertAndTurnPoint(x12, y12, z12);
+ point2 = this.cChartDrawer._convertAndTurnPoint(x22, y22, z22);
+ point3 = this.cChartDrawer._convertAndTurnPoint(x32, y32, z32);
+ point4 = this.cChartDrawer._convertAndTurnPoint(x42, y42, z42);
+ point5 = this.cChartDrawer._convertAndTurnPoint(x52, y52, z52);
+ point6 = this.cChartDrawer._convertAndTurnPoint(x62, y62, z62);
+ point7 = this.cChartDrawer._convertAndTurnPoint(x72, y72, z72);
+ point8 = this.cChartDrawer._convertAndTurnPoint(x82, y82, z82);
+
+ var point11 = this.cChartDrawer._convertAndTurnPoint(x12, y12, z12, null, null, true);
+ var point22 = this.cChartDrawer._convertAndTurnPoint(x22, y22, z22, null, null, true);
+ var point33 = this.cChartDrawer._convertAndTurnPoint(x32, y32, z32, null, null, true);
+ var point44 = this.cChartDrawer._convertAndTurnPoint(x42, y42, z42, null, null, true);
+ var point55 = this.cChartDrawer._convertAndTurnPoint(x52, y52, z52, null, null, true);
+ var point66 = this.cChartDrawer._convertAndTurnPoint(x62, y62, z62, null, null, true);
+ var point77 = this.cChartDrawer._convertAndTurnPoint(x72, y72, z72, null, null, true);
+ var point88 = this.cChartDrawer._convertAndTurnPoint(x82, y82, z82, null, null, true);
+
+ var controlPoint = this.cChartDrawer._convertAndTurnPoint(x12 + individualBarWidth / 2, y12 - height / 2, z12);
+
+ var arrPoints = [[point1, point4, point8, point5], [point1, point2, point3, point4],
+ [point1, point2, point6, point5], [point4, point8, point7, point3], [point5, point6, point7, point8],
+ [point6, point2, point3, point7]];
+
+ var arrPoints2 = [[point11, point44, point88, point55], [point11, point22, point33, point44],
+ [point11, point22, point66, point55], [point44, point88, point77, point33],
+ [point55, point66, point77, point88], [point66, point22, point33, point77]];
+
+ if (!arr) {
+ arr = [];
+ }
+ if (!arr[cubeCount]) {
+ arr[cubeCount] = {};
+ }
+ if (!arr[cubeCount].faces) {
+ arr[cubeCount].faces = [];
+ arr[cubeCount].arrPoints = [point11, point22, point33, point44, point55, point66, point77, point88];
+ arr[cubeCount].z = controlPoint.z;
+ arr[cubeCount].y = controlPoint.y;
+ arr[cubeCount].x = controlPoint.x;
+ arr[cubeCount].isValZero = val === 0;
+ }
+
+ for (var k = 0; k < paths.frontPaths.length; k++) {
+ if (null === paths.frontPaths[k] && null === paths.darkPaths[k]) {
+ continue;
+ }
+ //this.sortZIndexPaths.push({seria: i, point: idx, verge: k, paths: paths[k], points: arrPoints2[k], points2: arrPoints[k], plainEquation: plainEquation});
+
+ var plainEquation = this.cChartDrawer.getPlainEquation(arrPoints2[k][0], arrPoints2[k][1], arrPoints2[k][2], arrPoints2[k][3]);
+ var plainArea = this.cChartDrawer.getAreaQuadrilateral(arrPoints[k][0], arrPoints[k][1], arrPoints[k][2], arrPoints[k][3]);
+ arr[cubeCount].faces.push({
+ seria: serNum,
+ point: idx,
+ verge: k,
+ frontPaths: paths.frontPaths[k],
+ darkPaths: paths.darkPaths[k],
+ points: arrPoints2[k],
+ points2: arrPoints[k],
+ plainEquation: plainEquation,
+ plainArea: plainArea,
+ shapeType: type,
+ });
+ }
+ }
+
+ return {
+ paths: paths,
+ paths2: paths2,
+ facePoints: facePoints,
+ };
+ },
+
+ getDepths: function (serNum) {
+ //параметр r и глубина по OZ
+ var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
+
+ //сдвиг по OZ в глубину
+ var gapDepth = this.chart.gapDepth != null ? this.chart.gapDepth : globalGapDepth;
+ if (this.subType === "standard") {
+ perspectiveDepth = (perspectiveDepth / (gapDepth / 100 + 1)) / this.seriesCount;
+ } else {
+ perspectiveDepth = perspectiveDepth / (gapDepth / 100 + 1);
+ }
+
+ //если есть ось z берем pos из zPoints
+ if (this.serAx && this.serAx.zPoints[serNum]) {
+ return { gapDepth: this.serAx.zPoints[serNum].pos - (perspectiveDepth / 2), perspectiveDepth: perspectiveDepth };
+ }
+
+ var DiffGapDepth = perspectiveDepth * (gapDepth / 2) / 100;
+ if (this.subType === "standard") {
+ gapDepth = (perspectiveDepth + DiffGapDepth + DiffGapDepth) * serNum + DiffGapDepth;
+ } else {
+ gapDepth = DiffGapDepth;
+ }
+
+ return { gapDepth: gapDepth, perspectiveDepth: perspectiveDepth };
+ }
+};
+
+
+
+/** @constructor */
+function drawHistogramChart(seria, chartsDrawer) {
+ this.chartProp = chartsDrawer.calcProp;
+ this.cChartDrawer = chartsDrawer;
+ this.cChartSpace = chartsDrawer.cChartSpace;
+
+ this.seria = seria;
+
+ this.catAx = null;
+ this.valAx = null;
+
+ this.ptCount = null;
+ this.seriesCount = null;
+ this.subType = null;
+
+ this.paths = {};
+}
+
+drawHistogramChart.prototype = {
+ constructor: drawHistogramChart,
+
+ recalculate: function () {
+ if (!this.cChartSpace || !this.cChartSpace.chart || !this.cChartSpace.chart.plotArea || !this.cChartSpace.chart.plotArea.plotAreaRegion || !this.cChartSpace.chart.plotArea.axId || this.cChartSpace.chart.plotArea.axId.length < 2) {
+ return;
+ }
+ const cachedData = this.cChartSpace.chart.plotArea.plotAreaRegion.cachedData;
+ if (cachedData && this.chartProp && this.chartProp.chartGutter && cachedData.clusteredColumn) {
+ const valAxis = this.cChartSpace.chart.plotArea.axId[1];
+ const catAxis = this.cChartSpace.chart.plotArea.axId[0];
+
+ const catStart = this.chartProp.chartGutter._left;
+ let valStart = this.cChartSpace.chart.plotArea.axId ? this.cChartSpace.chart.plotArea.axId[0].posY * this.chartProp.pxToMM : this.chartProp.trueHeight + this.chartProp.chartGutter._top;
+ const coeff = catAxis.scaling.gapWidth;
+
+ const isAggregation = cachedData.clusteredColumn.aggregation;
+ // two different ways of storing information, object and array, therefore convert object into array
+ const sections = isAggregation ? Object.values(cachedData.clusteredColumn.aggregation) : cachedData.clusteredColumn.results;
+ if (sections) {
+ // 1 px gap for each section length
+ const gapWidth = 0.5 / this.chartProp.pxToMM;
+ const gapNumber = sections.length;
+ //Each bar will have 2 gapWidth and 2 margins , on left and right sides
+ const initialBarWidth = (this.chartProp.trueWidth - (2 * gapWidth * gapNumber)) / sections.length;
+ const barWidth = (initialBarWidth / (1 + coeff));
+ const margin = (initialBarWidth - barWidth) / 2;
+
+ let start = (catStart + margin + gapWidth);
+ for (let i = 0; i < sections.length; i++) {
+ // aggregation object does not have field occurrence;
+ const val = isAggregation ? sections[i] : sections[i].occurrence;
+ const startY = this.cChartDrawer.getYPosition(val, valAxis, true);
+ const bW = i === 0 ? barWidth : barWidth - gapWidth;
+ if (this.chartProp && this.chartProp.pxToMM ) {
+ const height = valStart - (startY * this.chartProp.pxToMM);
+ this.paths[i] = this.cChartDrawer._calculateRect(start, valStart, bW, height);
+ }
+ start += (bW + margin + gapWidth + gapWidth + margin);
+ }
+ }
+
+ }
+ },
+
+ draw: function () {
+ if (!this.cChartDrawer || !this.cChartDrawer.calcProp || !this.cChartDrawer.cShapeDrawer || !this.cChartDrawer.cShapeDrawer.Graphics || !this.cChartDrawer.calcProp.chartGutter) {
+ return;
+ }
+
+ // find chart starting coordinates, width and height;
+ let leftRect = this.cChartDrawer.calcProp.chartGutter._left / this.cChartDrawer.calcProp.pxToMM;
+ let topRect = (this.cChartDrawer.calcProp.chartGutter._top) / this.cChartDrawer.calcProp.pxToMM;
+ let rightRect = this.cChartDrawer.calcProp.trueWidth / this.cChartDrawer.calcProp.pxToMM;
+ let bottomRect = (this.cChartDrawer.calcProp.trueHeight) / this.cChartDrawer.calcProp.pxToMM;
+
+ if (!AscFormat.isRealNumber(leftRect) || !AscFormat.isRealNumber(topRect) || !AscFormat.isRealNumber(rightRect) || !AscFormat.isRealNumber(bottomRect) ) {
+ return
+ }
+
+ this.cChartDrawer.cShapeDrawer.Graphics.SaveGrState();
+ this.cChartDrawer.cShapeDrawer.Graphics.AddClipRect(leftRect, topRect, rightRect, bottomRect);
+
+
+ //TODO !!!
+ //series color
+ /*
+
+
+
+
+
+
+
+
+ */
+
+ //point color
+ /*cx:plotAreaRegion>
+
+
+
+
+
+
+
+
+
+ */
+
+ //this.cChartSpace.chart.plotArea.plotAreaRegion.series[0].spPr.Fill.ln
+
+ let series = this.cChartSpace.chart.plotArea.plotAreaRegion.series;
+
+ let oSeries = series[0];
+ if(oSeries) {
+ for (let i in this.paths) {
+ if (this.paths.hasOwnProperty(i) && this.paths[i]) {
+ let nPtIdx = parseInt(i);
+ let pen = oSeries.getPtPen(nPtIdx);
+ let brush = oSeries.getPtBrush(nPtIdx);
+ this.cChartDrawer.drawPath(this.paths[i], pen, brush);
+ }
+ }
+ }
+
+ this.cChartDrawer.cShapeDrawer.Graphics.RestoreGrState();
+ },
+
+ _calculateDLbl: function (compiledDlb) {
+ if (!this.paths || !this.chartProp) {
+ return;
+ }
+ const path = this.paths[compiledDlb.idx];
+
+ if (!AscFormat.isRealNumber(path)) {
+ return;
+ }
+
+ const oPath = this.cChartSpace.GetPath(path);
+ const oCommand0 = oPath.getCommandByIndex(0);
+ const oCommand1 = oPath.getCommandByIndex(1);
+ const oCommand2 = oPath.getCommandByIndex(2);
+
+ const x = oCommand0.X;
+ const y = oCommand0.Y;
+
+ const h = oCommand0.Y - oCommand1.Y;
+ const w = oCommand2.X - oCommand1.X;
+
+ const pxToMm = this.chartProp.pxToMM;
+
+ const width = compiledDlb.extX;
+ const height = compiledDlb.extY;
+
+ let centerX, centerY;
+ // DATA_LABEL_POS_IN_END
+ switch (compiledDlb.dLblPos) {
+ case AscFormat.DATA_LABEL_POS_CTR: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h / 2 - height / 2;
+ break;
+ }
+ case AscFormat.DATA_LABEL_POS_IN_BASE: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - height;
+ break;
+ }
+ case AscFormat.DATA_LABEL_POS_IN_END: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h;
+ break;
+ }
+ case AscFormat.DATA_LABEL_POS_OUT_END: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h - height;
+ break;
+ }
+ }
+
+ const top = this.chartProp.chartGutter._top / pxToMm;
+ if (centerY < top) {
+ centerY = top;
+ }
+
+ const bottom = ((this.chartProp.trueHeight + this.chartProp.chartGutter._top) / pxToMm) - height ;
+ if (centerY >= bottom) {
+ centerY = bottom;
+ }
+
+ return {x: centerX, y: centerY};
+ }
+};
+
+/** @constructor */
+function drawWaterfallChart(chart, chartsDrawer) {
+ this.chartProp = chartsDrawer.calcProp;
+ this.cChartDrawer = chartsDrawer;
+ this.cChartSpace = chartsDrawer.cChartSpace;
+
+ this.chart = chart;
+
+ this.catAx = null;
+ this.valAx = null;
+
+ this.ptCount = null;
+ this.seriesCount = null;
+ this.subType = null;
+
+ this.paths = {};
+}
+
+drawWaterfallChart.prototype = {
+ constructor: drawWaterfallChart,
+
+ recalculate: function () {
+ if (!this.cChartSpace || !this.cChartSpace.chart || !this.cChartSpace.chart.plotArea || !this.cChartSpace.chart.plotArea.plotAreaRegion || !this.cChartSpace.chart.plotArea.plotAreaRegion.cachedData || !this.cChartSpace.chart.plotArea.plotAreaRegion.cachedData.waterfall || !this.cChartSpace.chart.plotArea.axId) {
+ return;
+ }
+ const data = this.cChartSpace.chart.plotArea.plotAreaRegion.cachedData.waterfall.data;
+
+ if (data && data.length > 0 && this.chartProp && this.chartProp.chartGutter) {
+ const valAxis = this.cChartSpace.chart.plotArea.axId[1];
+ const catAxis = this.cChartSpace.chart.plotArea.axId[0];
+
+ const catStart = this.chartProp.chartGutter._left;
+ let valStart = this.cChartSpace.chart.plotArea.axId ? this.cChartSpace.chart.plotArea.axId[0].posY * this.chartProp.pxToMM : this.chartProp.trueHeight + this.chartProp.chartGutter._top;
+ const zeroValStart = valStart;
+ if (AscFormat.isRealNumber(valStart)) {
+ const coeff = catAxis.scaling.gapWidth;
+ // 1 px gap for each section length
+ const gapWidth = 0.5 / this.chartProp.pxToMM;
+ const gapNumber = data.length;
+ //Each bar will have 2 gapWidth and 2 margins , on left and right sides
+ const initialBarWidth = (this.chartProp.trueWidth - (2 * gapWidth * gapNumber))/ data.length;
+ const barWidth = (initialBarWidth / (1 + coeff));
+ const margin = (initialBarWidth - barWidth) / 2;
+
+ let start = (catStart + margin + gapWidth);
+
+ for (let i = 0; i < data.length; i++) {
+ const valPos = this.cChartDrawer.getYPosition(data[i].val, valAxis, true) * this.chartProp.pxToMM; // calc roof of the current bar
+ const next = start + (barWidth + margin + gapWidth + gapWidth + margin); // start of the next bar
+ if (this.chartProp && this.chartProp.pxToMM ) {
+ const height = data[i].isTotal && i !== 0 ? zeroValStart - valPos : valStart - valPos;
+ this.paths[i] = [];
+ this.paths[i].push(this.cChartDrawer._calculateRect(start, data[i].isTotal ? zeroValStart : valStart, barWidth, height));
+ //dont need last connectorLine
+ if (i !== data.length - 1 && margin !== 0) {
+ //exclude gapWidth from connector line
+ this.paths[i].push(this._calculateConnectorLine(valPos, start + barWidth + gapWidth, next - gapWidth))
+ }
+ }
+ valStart = valPos; // go up in y direction
+ start = next; // go right in x direction
+ }
+ }
+ }
+ },
+
+ _calculateConnectorLine: function (y, x1, x2) {
+ if (!this.cChartSpace || !this.chartProp) {
+ return null;
+ }
+ const pathId = this.cChartSpace.AllocPath();
+ const path = this.cChartSpace.GetPath(pathId);
+
+ const pathH = this.chartProp.pathH;
+ const pathW = this.chartProp.pathW;
+ const pxToMm = this.chartProp.pxToMM;
+
+ path.moveTo((x1 / pxToMm) * pathW, (y / pxToMm) * pathH);
+ path.lnTo((x2 / pxToMm) * pathW, (y / pxToMm) * pathH);
+
+ return pathId;
+ },
+
+ draw: function () {
+ if (!this.cChartDrawer || !this.cChartDrawer.calcProp || !this.cChartDrawer.cShapeDrawer || !this.cChartDrawer.cShapeDrawer.Graphics || !this.cChartDrawer.calcProp.chartGutter) {
+ return;
+ }
+
+ // find chart starting coordinates, width and height;
+ let leftRect = this.cChartDrawer.calcProp.chartGutter._left / this.cChartDrawer.calcProp.pxToMM;
+ let topRect = (this.cChartDrawer.calcProp.chartGutter._top) / this.cChartDrawer.calcProp.pxToMM;
+ let rightRect = this.cChartDrawer.calcProp.trueWidth / this.cChartDrawer.calcProp.pxToMM;
+ let bottomRect = (this.cChartDrawer.calcProp.trueHeight) / this.cChartDrawer.calcProp.pxToMM;
+
+ if (!AscFormat.isRealNumber(leftRect) || !AscFormat.isRealNumber(topRect) || !AscFormat.isRealNumber(rightRect) || !AscFormat.isRealNumber(bottomRect) ) {
+ return
+ }
+
+ this.cChartDrawer.cShapeDrawer.Graphics.SaveGrState();
+ this.cChartDrawer.cShapeDrawer.Graphics.AddClipRect(leftRect, topRect, rightRect, bottomRect);
+
+
+ //TODO !!!
+ //series color
+ /*
+
+
+
+
+
+
+
+
+ */
+
+ //point color
+ /*cx:plotAreaRegion>
+
+
+
+
+
+
+
+
+
+ */
+
+ //this.cChartSpace.chart.plotArea.plotAreaRegion.series[0].spPr.Fill.ln
+
+ let series = this.cChartSpace.chart.plotArea.plotAreaRegion.series;
+
+ let oSeries = series[0];
+ if(oSeries) {
+ for (let i in this.paths) {
+ if (this.paths.hasOwnProperty(i) && this.paths[i]) {
+ for (let j in this.paths[i]) {
+ if (this.paths[i].hasOwnProperty(j) && this.paths[i][j]) {
+ let nPtIdx = parseInt(i);
+ let pen = (j === '0' ) ? oSeries.getPtPen(nPtIdx) : this.cChartSpace.chart.plotArea.axId[1].compiledMajorGridLines;
+ let brush = oSeries.getPtBrush(nPtIdx);
+ this.cChartDrawer.drawPath(this.paths[i][j], pen, brush);
+ }
+ }
+ }
+ }
+ }
+
+ this.cChartDrawer.cShapeDrawer.Graphics.RestoreGrState();
+ },
+
+ _calculateDLbl: function (compiledDlb) {
+ if (!this.paths || !this.chartProp) {
+ return;
+ }
+ const path = this.paths[compiledDlb.idx] && Array.isArray(this.paths[compiledDlb.idx]) && this.paths[compiledDlb.idx].length > 0 ? this.paths[compiledDlb.idx][0] : null;
+
+ if (!AscFormat.isRealNumber(path)) {
+ return;
+ }
- var t = this;
- var dRadius1, dRadius2, uRadius1, uRadius2;
- var calcCylinderProps = function (bCone) {
- //большая и малая полуось оснований усеченного конуса
- if (bCone) {
- // за оси эллипса берем 1/2 длин ребер оснований усеченной пирамиды
- points = t.cChartDrawer.isConeIntersection(false, t.subType, startX, startY, height, gapDepth, individualBarWidth, perspectiveDepth, val, nullPositionOX, maxH, minH);
+ const oPath = this.cChartSpace.GetPath(path);
+ const oCommand0 = oPath.getCommandByIndex(0);
+ const oCommand1 = oPath.getCommandByIndex(1);
+ const oCommand2 = oPath.getCommandByIndex(2);
- if (t.val === 0) {
- uRadius1 = 0;
- uRadius2 = 0;
- dRadius1 = points.wDown;
- dRadius2 = points.lDown;
- } else if ((t.subType === "stacked" || t.subType === "stackedPer") && t.cChartSpace.chart.plotArea.valAx.isReversed()) {
- uRadius1 = points.wUp !== 0 ? points.wUp : individualBarWidth / 2;
- uRadius2 = points.lUp !== 0 ? points.lUp : perspectiveDepth / 2;
- dRadius1 = points.wDown;
- dRadius2 = points.lDown;
- } else {
- uRadius1 = points.wUp;
- uRadius2 = points.lUp;
- dRadius1 = points.wDown !== 0 ? points.wDown : individualBarWidth / 2;
- dRadius2 = points.lDown !== 0 ? points.lDown : perspectiveDepth/ 2;
- }
+ const x = oCommand0.X;
+ const y = oCommand0.Y;
- } else {
- //большая и малая полуось эллипса
- dRadius1 = individualBarWidth / 2;
- dRadius2 = perspectiveDepth / 2;
- }
- };
+ const h = oCommand0.Y - oCommand1.Y;
+ const w = oCommand2.X - oCommand1.X;
+ const pxToMm = this.chartProp.pxToMM;
- var facePoints;
- switch (type) {
- case AscFormat.BAR_SHAPE_PYRAMID:
- case AscFormat.BAR_SHAPE_PYRAMIDTOMAX: {
- var nullPositionOX = this.subType === "stacked" ? this.cChartDrawer.getPositionZero(this.valAx) :
- this.catAx.posY * this.chartProp.pxToMM;
- paths = this.cChartDrawer.calculatePyramid(false, this.subType, startX, startY, height, gapDepth,
- individualBarWidth, perspectiveDepth, val, nullPositionOX, maxH, minH);
+ const width = compiledDlb.extX;
+ const height = compiledDlb.extY;
- paths = paths.paths;
- break
+ let centerX, centerY;
+ // DATA_LABEL_POS_IN_END
+ switch (compiledDlb.dLblPos) {
+ case AscFormat.DATA_LABEL_POS_CTR: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h / 2 - height / 2;
+ break;
}
- case AscFormat.BAR_SHAPE_CYLINDER: {
- //paths = this.cChartDrawer._calculateCylinder(startX, startY, individualBarWidth, height, val, gapDepth, perspectiveDepth, this.subType !== "standard", false, false);
-
- calcCylinderProps();
- this.cChartDrawer.calcShapesHelper.setProps(startX, startY, gapDepth, individualBarWidth, height, perspectiveDepth, needAddOnlyFrontFace, val, false, dRadius1, dRadius2);
- paths = this.cChartDrawer.calcShapesHelper.getCylinder();
-
+ case AscFormat.DATA_LABEL_POS_IN_BASE: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - height;
break;
}
- case AscFormat.BAR_SHAPE_CONE:
- case AscFormat.BAR_SHAPE_CONETOMAX: {
- //paths = this.cChartDrawer._calculateCylinder(startX, startY, individualBarWidth, height, val, gapDepth, perspectiveDepth, this.subType !== "standard", false, this.subType, nullPositionOX, maxH, minH);
-
- calcCylinderProps(true);
- this.cChartDrawer.calcShapesHelper.setProps(startX, startY, gapDepth, individualBarWidth, height, perspectiveDepth, needAddOnlyFrontFace, val, false, dRadius1, dRadius2, uRadius1, uRadius2);
- paths = this.cChartDrawer.calcShapesHelper.getCone();
-
+ case AscFormat.DATA_LABEL_POS_IN_END: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h;
break;
}
- default: {
- points = [point1, point2, point3, point4, point5, point6, point7, point8];
- paths = this.cChartDrawer.calculateRect3D(points, val, null, this.subType !== "standard", false);
+ case AscFormat.DATA_LABEL_POS_OUT_END: {
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h - height;
break;
}
}
- facePoints = [[point1, point4, point8, point5], [point1, point2, point3, point4],
- [point1, point2, point6, point5], [point4, point8, point7, point3], [point5, point6, point7, point8],
- [point2, point3, point7, point6]];
+ const top = this.chartProp.chartGutter._top / pxToMm;
+ if (centerY < top) {
+ centerY = top;
+ }
- //paths2 для расчета подписей, в дальнейшем нужно оптимизировать этот процесс
- points = [point1, point2, point3, point4, point5, point6, point7, point8];
- paths2 = this.cChartDrawer.calculateRect3D(points, val, isNotDrawDownVerge);
+ const bottom = ((this.chartProp.trueHeight + this.chartProp.chartGutter._top) / pxToMm) - height ;
+ if (centerY >= bottom) {
+ centerY = bottom;
+ }
- if (this.subType !== "standard") {
+ return {x: centerX, y: centerY};
+ }
+}
- height = testHeight;
- x12 = startX, y12 = startY, z12 = 0 + gapDepth;
- x22 = startX, y22 = startY, z22 = perspectiveDepth + gapDepth;
- x32 = startX + individualBarWidth, y32 = startY, z32 = perspectiveDepth + gapDepth;
- x42 = startX + individualBarWidth, y42 = startY, z42 = 0 + gapDepth;
- x52 = startX, y52 = startY - height, z52 = 0 + gapDepth;
- x62 = startX, y62 = startY - height, z62 = perspectiveDepth + gapDepth;
- x72 = startX + individualBarWidth, y72 = startY - height, z72 = perspectiveDepth + gapDepth;
- x82 = startX + individualBarWidth, y82 = startY - height, z82 = 0 + gapDepth;
+/** @constructor */
+function drawFunnelChart(chart, chartsDrawer) {
+ this.chartProp = chartsDrawer.calcProp;
+ this.cChartDrawer = chartsDrawer;
+ this.cChartSpace = chartsDrawer.cChartSpace;
- point1 = this.cChartDrawer._convertAndTurnPoint(x12, y12, z12);
- point2 = this.cChartDrawer._convertAndTurnPoint(x22, y22, z22);
- point3 = this.cChartDrawer._convertAndTurnPoint(x32, y32, z32);
- point4 = this.cChartDrawer._convertAndTurnPoint(x42, y42, z42);
- point5 = this.cChartDrawer._convertAndTurnPoint(x52, y52, z52);
- point6 = this.cChartDrawer._convertAndTurnPoint(x62, y62, z62);
- point7 = this.cChartDrawer._convertAndTurnPoint(x72, y72, z72);
- point8 = this.cChartDrawer._convertAndTurnPoint(x82, y82, z82);
+ this.chart = chart;
- var point11 = this.cChartDrawer._convertAndTurnPoint(x12, y12, z12, null, null, true);
- var point22 = this.cChartDrawer._convertAndTurnPoint(x22, y22, z22, null, null, true);
- var point33 = this.cChartDrawer._convertAndTurnPoint(x32, y32, z32, null, null, true);
- var point44 = this.cChartDrawer._convertAndTurnPoint(x42, y42, z42, null, null, true);
- var point55 = this.cChartDrawer._convertAndTurnPoint(x52, y52, z52, null, null, true);
- var point66 = this.cChartDrawer._convertAndTurnPoint(x62, y62, z62, null, null, true);
- var point77 = this.cChartDrawer._convertAndTurnPoint(x72, y72, z72, null, null, true);
- var point88 = this.cChartDrawer._convertAndTurnPoint(x82, y82, z82, null, null, true);
+ this.catAx = null;
+ this.valAx = null;
- var controlPoint = this.cChartDrawer._convertAndTurnPoint(x12 + individualBarWidth / 2, y12 - height / 2, z12);
+ this.ptCount = null;
+ this.seriesCount = null;
+ this.subType = null;
- var arrPoints = [[point1, point4, point8, point5], [point1, point2, point3, point4],
- [point1, point2, point6, point5], [point4, point8, point7, point3], [point5, point6, point7, point8],
- [point6, point2, point3, point7]];
+ this.paths = {};
+ this.linePath = null;
+}
- var arrPoints2 = [[point11, point44, point88, point55], [point11, point22, point33, point44],
- [point11, point22, point66, point55], [point44, point88, point77, point33],
- [point55, point66, point77, point88], [point66, point22, point33, point77]];
+drawFunnelChart.prototype = {
+ constructor: drawFunnelChart,
- if (!arr) {
- arr = [];
- }
- if (!arr[cubeCount]) {
- arr[cubeCount] = {};
- }
- if (!arr[cubeCount].faces) {
- arr[cubeCount].faces = [];
- arr[cubeCount].arrPoints = [point11, point22, point33, point44, point55, point66, point77, point88];
- arr[cubeCount].z = controlPoint.z;
- arr[cubeCount].y = controlPoint.y;
- arr[cubeCount].x = controlPoint.x;
- arr[cubeCount].isValZero = val === 0;
+ recalculate: function () {
+ if (!this.cChartSpace || !this.cChartSpace.chart || !this.cChartSpace.chart.plotArea || !this.cChartSpace.chart.plotArea.plotAreaRegion || !this.cChartSpace.chart.plotArea.axId) {
+ return;
+ }
+ const seria = this.cChartSpace.chart.plotArea.plotAreaRegion.series[0];
+ const numLit = seria.getValLit();
+ const data = numLit ? numLit.pts : null;
+ if (data && data.length > 0 && this.chartProp && this.chartProp.chartGutter) {
+ const valAxis = this.cChartSpace.chart.plotArea.axId[0];
+ const isSinglePoint = data.length === 1;
+ const catMiddle = (this.chartProp.trueWidth / 2 + this.chartProp.chartGutter._left );
+ let valStart = this.chartProp.chartGutter._top;
+ let chartHeight = this.chartProp.trueHeight;
+ const pxToMM = this.chartProp.pxToMM;
+ if (AscFormat.isRealNumber(valStart) && AscFormat.isRealNumber(catMiddle)) {
+ const coeff = valAxis.scaling.gapWidth;
+ // 1 px gap for each section length
+ const gapWidth = 0.5 / pxToMM;
+ const gapNumber = data.length;
+ //Each bar will have 2 gapWidth and 2 margins , on top and bottom sides
+ const initialBarHeight = (chartHeight - (2 * gapWidth * gapNumber))/ data.length;
+ const barHeight = (initialBarHeight / (1 + coeff));
+ const margin = (initialBarHeight - barHeight) / 2;
+
+ // because calculate rect accepts bottom left point as starting y, we add barHeight to the calculation of starting point
+ let startVertical = (valStart + margin + gapWidth + barHeight);
+ for (let i = 0; i < data.length; i++) {
+ if (this.chartProp && pxToMM) {
+ const barWidth = valAxis.max && data[i].val > 0 ? (data[i].val / valAxis.max) * this.chartProp.trueWidth: 0;
+ this.paths[i] = this.cChartDrawer._calculateRect(catMiddle - (barWidth / 2), startVertical, barWidth, barHeight);
+ }
+ startVertical += margin + gapWidth + gapWidth + margin + barHeight;
+ }
+ // vertical line with 1 px from left
+ this.linePath = this.cChartDrawer._calculateLine(startVertical, (startVertical - valStart), this.chartProp.chartGutter._left + 1, true);
}
+ }
+ },
- for (var k = 0; k < paths.frontPaths.length; k++) {
- if (null === paths.frontPaths[k] && null === paths.darkPaths[k]) {
- continue;
- }
- //this.sortZIndexPaths.push({seria: i, point: idx, verge: k, paths: paths[k], points: arrPoints2[k], points2: arrPoints[k], plainEquation: plainEquation});
+ draw: function () {
+ if (!this.cChartDrawer || !this.cChartDrawer.calcProp || !this.cChartDrawer.cShapeDrawer || !this.cChartDrawer.cShapeDrawer.Graphics || !this.cChartDrawer.calcProp.chartGutter) {
+ return;
+ }
- var plainEquation = this.cChartDrawer.getPlainEquation(arrPoints2[k][0], arrPoints2[k][1], arrPoints2[k][2], arrPoints2[k][3]);
- var plainArea = this.cChartDrawer.getAreaQuadrilateral(arrPoints[k][0], arrPoints[k][1], arrPoints[k][2], arrPoints[k][3]);
- arr[cubeCount].faces.push({
- seria: serNum,
- point: idx,
- verge: k,
- frontPaths: paths.frontPaths[k],
- darkPaths: paths.darkPaths[k],
- points: arrPoints2[k],
- points2: arrPoints[k],
- plainEquation: plainEquation,
- plainArea: plainArea,
- shapeType: type,
- });
- }
+ // find chart starting coordinates, width and height;
+ let leftRect = this.cChartDrawer.calcProp.chartGutter._left / this.cChartDrawer.calcProp.pxToMM;
+ let topRect = (this.cChartDrawer.calcProp.chartGutter._top) / this.cChartDrawer.calcProp.pxToMM;
+ let rightRect = this.cChartDrawer.calcProp.trueWidth / this.cChartDrawer.calcProp.pxToMM;
+ let bottomRect = (this.cChartDrawer.calcProp.trueHeight) / this.cChartDrawer.calcProp.pxToMM;
+
+ if (!AscFormat.isRealNumber(leftRect) || !AscFormat.isRealNumber(topRect) || !AscFormat.isRealNumber(rightRect) || !AscFormat.isRealNumber(bottomRect) ) {
+ return
}
- return {
- paths: paths,
- paths2: paths2,
- facePoints: facePoints,
- };
- },
+ this.cChartDrawer.cShapeDrawer.Graphics.SaveGrState();
+ this.cChartDrawer.cShapeDrawer.Graphics.AddClipRect(leftRect, topRect, rightRect, bottomRect);
- getDepths: function (serNum) {
- //параметр r и глубина по OZ
- var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
- //сдвиг по OZ в глубину
- var gapDepth = this.chart.gapDepth != null ? this.chart.gapDepth : globalGapDepth;
- if (this.subType === "standard") {
- perspectiveDepth = (perspectiveDepth / (gapDepth / 100 + 1)) / this.seriesCount;
- } else {
- perspectiveDepth = perspectiveDepth / (gapDepth / 100 + 1);
+ //TODO !!!
+ //series color
+ /*
+
+
+
+
+
+
+
+
+ */
+
+ //point color
+ /*cx:plotAreaRegion>
+
+
+
+
+
+
+
+
+
+ */
+
+ //this.cChartSpace.chart.plotArea.plotAreaRegion.series[0].spPr.Fill.ln
+
+ let series = this.cChartSpace.chart.plotArea.plotAreaRegion.series;
+
+ let oSeries = series[0];
+ if(oSeries) {
+ if (this.linePath) {
+ let pen = this.cChartSpace.pen;
+ this.cChartDrawer.drawPath(this.linePath, pen);
+ }
+ for (let i in this.paths) {
+ if (this.paths.hasOwnProperty(i) && this.paths[i]) {
+ let nPtIdx = parseInt(i);
+ let pen = oSeries.getPtPen(nPtIdx);
+ let brush = oSeries.getPtBrush(nPtIdx);
+ this.cChartDrawer.drawPath(this.paths[i], pen, brush);
+ }
+ }
}
+
+ this.cChartDrawer.cShapeDrawer.Graphics.RestoreGrState();
+ },
- //если есть ось z берем pos из zPoints
- if (this.serAx && this.serAx.zPoints[serNum]) {
- return { gapDepth: this.serAx.zPoints[serNum].pos - (perspectiveDepth / 2), perspectiveDepth: perspectiveDepth };
+ _calculateDLbl: function (compiledDlb) {
+ if (!this.paths || !this.chartProp) {
+ return;
}
+ const path = this.paths[compiledDlb.idx];
- var DiffGapDepth = perspectiveDepth * (gapDepth / 2) / 100;
- if (this.subType === "standard") {
- gapDepth = (perspectiveDepth + DiffGapDepth + DiffGapDepth) * serNum + DiffGapDepth;
- } else {
- gapDepth = DiffGapDepth;
+ if (!AscFormat.isRealNumber(path)) {
+ return;
}
- return { gapDepth: gapDepth, perspectiveDepth: perspectiveDepth };
- }
-};
+ const oPath = this.cChartSpace.GetPath(path);
+ const oCommand0 = oPath.getCommandByIndex(0);
+ const oCommand1 = oPath.getCommandByIndex(1);
+ const oCommand2 = oPath.getCommandByIndex(2);
+
+ const x = oCommand0.X;
+ const y = oCommand0.Y;
+
+ const h = oCommand0.Y - oCommand1.Y;
+ const w = oCommand2.X - oCommand1.X;
+
+ const pxToMm = this.chartProp.pxToMM;
+
+ const width = compiledDlb.extX;
+ const height = compiledDlb.extY;
+
+ let centerX, centerY;
+
+ centerX = x + w / 2 - width / 2;
+ centerY = y - h / 2 - height / 2;
+ const top = this.chartProp.chartGutter._top / pxToMm;
+ if (centerY < top) {
+ centerY = top;
+ }
+
+ const bottom = ((this.chartProp.trueHeight + this.chartProp.chartGutter._top) / pxToMm) - height ;
+ if (centerY >= bottom) {
+ centerY = bottom;
+ }
+ return {x: centerX, y: centerY};
+ }
+}
/** @constructor */
function drawLineChart(chart, chartsDrawer) {
@@ -7260,6 +8506,7 @@ drawLineChart.prototype = {
_calculateLines: function () {
var xPoints = this.catAx.xPoints;
var yPoints = this.valAx.yPoints;
+ let isLog;
if(!xPoints || !yPoints) {
return;
@@ -7270,6 +8517,7 @@ drawLineChart.prototype = {
seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
+ isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;
if (!numCache) {
continue;
@@ -7303,7 +8551,7 @@ drawLineChart.prototype = {
compiledMarkerSize = idxPoint && idxPoint.compiledMarker && idxPoint.compiledMarker.size ? idxPoint.compiledMarker.size : null;
compiledMarkerSymbol = idxPoint && idxPoint.compiledMarker && AscFormat.isRealNumber(idxPoint.compiledMarker.symbol) ? idxPoint.compiledMarker.symbol : null;
- if (val != null) {
+ if (val != null && ((isLog && val !== 0) || !isLog)) {
this.paths.points[i][n] = this.cChartDrawer.calculatePoint(x, y, compiledMarkerSize, compiledMarkerSymbol);
let errBars = this.chart.series[i].errBars[0];
if (errBars) {
@@ -7807,11 +9055,13 @@ drawAreaChart.prototype = {
var y, x, val, seria, dataSeries, numCache;
var pxToMm = this.chartProp.pxToMM;
var nullPositionOX = this.catAx.posY;
+ let isLog;
for (var i = 0; i < this.chart.series.length; i++) {
seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
+ isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;
if (!numCache) {
continue;
@@ -7823,7 +9073,7 @@ drawAreaChart.prototype = {
//рассчитываем значения
val = this._getYVal(n, i);
- if(null === val && this.cChartDrawer.nDimensionCount !== 3) {
+ if((null === val && this.cChartDrawer.nDimensionCount !== 3) || (isLog && val === 0)) {
continue;
}
@@ -8877,6 +10127,9 @@ drawAreaChart.prototype = {
return pathId;
};
+ let countSeries = oThis.cChartDrawer.calculateCountSeries(oThis.chart);
+ let ptCount = countSeries.points;
+
//left
paths[2] = null;
if (this.darkFaces["left"] && point === 0) {
@@ -8885,7 +10138,7 @@ drawAreaChart.prototype = {
//right
paths[3] = null;
- if (this.darkFaces["right"] && point === t.cChartDrawer.calcProp.ptCount - 2) {
+ if (this.darkFaces["right"] && point === ptCount - 2) {
paths[3] = calculateSimpleFace(point4, point8, point7, point3, point44, point88, point77, point33, 3);
}
@@ -9093,11 +10346,6 @@ drawAreaChart.prototype = {
this.chartProp.trueWidth / this.chartProp.pxToMM, this.chartProp.trueHeight / this.chartProp.pxToMM);
for (var i = 0; i < this.chart.series.length; i++) {
-
- //в случае накопительных дигарамм, рисуем в обратном порядке
- /*if(this.chartProp.subType == "stackedPer" || this.chartProp.subType == "stacked")
- seria = this.chartProp.series[this.chartProp.series.length - 1 - i];
- else*/
seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
dataSeries = numCache && numCache.pts ? numCache.pts : null;
@@ -9491,7 +10739,7 @@ drawHBarChart.prototype = {
seriesHeight, i, idx, cubeCount, shapeType, maxH, minH);
cubeCount++;
} else {
- paths = this._calculateRect(newStartX, newStartY / this.chartProp.pxToMM, width, individualBarHeight / this.chartProp.pxToMM);
+ paths = this.cChartDrawer._calculateRect(newStartX, newStartY / this.chartProp.pxToMM, width, individualBarHeight / this.chartProp.pxToMM, true);
}
var serIdx = this.chart.series[i].idx;
@@ -9819,21 +11067,6 @@ drawHBarChart.prototype = {
return {x: centerX, y: centerY};
},
- _calculateRect: function (x, y, w, h) {
- var pathId = this.cChartSpace.AllocPath();
- var path = this.cChartSpace.GetPath(pathId);
-
- var pathH = this.chartProp.pathH;
- var pathW = this.chartProp.pathW;
-
- path.moveTo(x * pathW, y * pathH);
- path.lnTo(x * pathW, (y - h) * pathH);
- path.lnTo((x + w) * pathW, (y - h) * pathH);
- path.lnTo((x + w) * pathW, y * pathH);
- path.lnTo(x * pathW, y * pathH);
- return pathId;
- },
-
calculateParallalepiped: function (newStartX, newStartY, val, width, DiffGapDepth, perspectiveDepth,
individualBarHeight, seriesHeight, i, idx, cubeCount, type, maxH, minH) {
var paths, paths2;
@@ -12840,6 +14073,7 @@ drawScatterChart.prototype = {
_recalculateScatter: function () {
let seria, yVal, xVal, points, yNumCache, compiledMarkerSize, compiledMarkerSymbol, yPoint, idx, xPoint;
let dispBlanksAs = this.cChartSpace.chart.dispBlanksAs;
+ let isLog;
let t = this;
let _initObjs = function (_index) {
@@ -12860,6 +14094,7 @@ drawScatterChart.prototype = {
for (let i = 0; i < this.chart.series.length; i++) {
seria = this.chart.series[i];
yNumCache = this.cChartDrawer.getNumCache(seria.yVal);
+ isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;
if (!yNumCache) {
continue;
@@ -12898,7 +14133,7 @@ drawScatterChart.prototype = {
_initObjs(i);
- if (yVal != null) {
+ if (yVal != null && ((isLog && yVal !== 0) || !isLog)) {
let x = this.cChartDrawer.getYPosition(xVal, this.catAx, true);
let y = this.cChartDrawer.getYPosition(yVal, this.valAx, true);
this.paths.points[i].push(this.cChartDrawer.calculatePoint(x, y, compiledMarkerSize, compiledMarkerSymbol));
@@ -13091,10 +14326,10 @@ drawScatterChart.prototype = {
//this.paths.series[i][n] = {path: this.cChartDrawer.calculateSplineLine(x, y, x1, y1, x2, y2, x3, y3, this.catAx, this.valAx), idx: points[i][n].idx};
this.paths.series[i][n] = this.cChartDrawer.calculateSplineLine(x, y, x1, y1, x2, y2, x3, y3, this.catAx, this.valAx);
} else {
- x = this.cChartDrawer.getYPosition(points[i][n].x, this.catAx);
+ x = this.cChartDrawer.getYPosition(points[i][n].x, this.catAx, true);
y = this.cChartDrawer.getYPosition(points[i][n].y, this.valAx, true);
- x1 = this.cChartDrawer.getYPosition(points[i][n + 1].x, this.catAx);
+ x1 = this.cChartDrawer.getYPosition(points[i][n + 1].x, this.catAx, true);
y1 = this.cChartDrawer.getYPosition(points[i][n + 1].y, this.valAx, true);
//this.paths.series[i][n] = {path: this._calculateLine(x, y, x1, y1), idx: points[i][n].idx};
@@ -14416,11 +15651,11 @@ axisChart.prototype = {
},
_calculateValAxis: function () {
- var axisPos;
- var left = this.chartProp.chartGutter._left / this.chartProp.pxToMM;
- var right = (this.chartProp.widthCanvas - this.chartProp.chartGutter._right) / this.chartProp.pxToMM;
- var top = this.chartProp.chartGutter._top / this.chartProp.pxToMM;
- var bottom = (this.chartProp.heightCanvas - this.chartProp.chartGutter._bottom) / this.chartProp.pxToMM;
+ let axisPos;
+ let left = this.chartProp.chartGutter._left / this.chartProp.pxToMM;
+ let right = (this.chartProp.widthCanvas - this.chartProp.chartGutter._right) / this.chartProp.pxToMM;
+ let top = this.chartProp.chartGutter._top / this.chartProp.pxToMM;
+ let bottom = (this.chartProp.heightCanvas - this.chartProp.chartGutter._bottom) / this.chartProp.pxToMM;
if (this.axis && this.axis.isRadarValues()) {
@@ -14429,7 +15664,7 @@ axisChart.prototype = {
var orientation = !axis.isReversed();
var xCenter = axis.posX;
- var yCenter, trueHeight;
+ let yCenter, trueHeight;
if (yPoints.length > 0) {
yCenter = orientation ? yPoints[0].pos : yPoints[yPoints.length - 1].pos;
} else {
@@ -14437,15 +15672,16 @@ axisChart.prototype = {
yCenter = (this.chartProp.chartGutter._top + trueHeight / 2) / this.chartProp.pxToMM;
}
- var ptCount = this.cChartDrawer.getPtCount(this.chartProp.series);
+ let radarChart = this.cChartDrawer.getChartByType(AscDFH.historyitem_type_RadarChart);
+ let ptCount = radarChart && radarChart.series && this.cChartDrawer.getPtCount(radarChart.series);
if (!ptCount) {
return;
}
- var tempAngle = 2 * Math.PI / ptCount;
+ let tempAngle = 2 * Math.PI / ptCount;
- var radius, x, y;
+ let radius, x, y;
radius = Math.abs(yPoints[yPoints.length - 1].pos - yPoints[0].pos);
- for (var n = 0; n < ptCount; n++) {
+ for (let n = 0; n < ptCount; n++) {
x = xCenter + radius * Math.sin(n * tempAngle);
y = yCenter - radius * Math.cos(n * tempAngle);
@@ -14775,7 +16011,9 @@ axisChart.prototype = {
let stepY = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
minorStep = stepY / minorLinesCount;
- let ptCount = this.cChartDrawer.getNumCache(this.chartProp.series[0].val).ptCount;
+ let radarChart = this.cChartDrawer.getChartByType(AscDFH.historyitem_type_RadarChart);
+ let ptCount = radarChart && radarChart.series && this.cChartDrawer.getPtCount(radarChart.series);
+
let tempAngle = 2 * Math.PI / ptCount;
let x1, y1, x2, y2;
for (let nDataPt = 0; nDataPt < ptCount; nDataPt++) {
@@ -14862,31 +16100,38 @@ axisChart.prototype = {
},
_calculateSerTickMark: function () {
- var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
- var tickmarksProps = this._getTickmarksPropsSer();
- var widthLine = tickmarksProps.widthLine;
+ let perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
+ let tickmarksProps = this._getTickmarksPropsSer();
+ let widthLine = tickmarksProps.widthLine;
+ let seriesCount = this.axis.labels && this.axis.labels.count;
+ if (seriesCount == null) {
+ let _chart = this.axis.parent && this.axis.parent.chart;
+ let countSeries = this.cChartDrawer.calculateCountSeries(_chart);
+ seriesCount = countSeries.series;
+ }
+
if (widthLine !== 0) {
- var positionX = this.cChartDrawer.processor3D.calculateXPositionSerAxis();
- var stepY = perspectiveDepth / this.chartProp.seriesCount;
- var startX;
+ let positionX = this.cChartDrawer.processor3D.calculateXPositionSerAxis();
+ let stepY = perspectiveDepth / seriesCount;
+ let startX;
if (positionX) {
startX = this.chartProp.chartGutter._left;
} else {
startX = this.chartProp.widthCanvas - this.chartProp.chartGutter._right;
}
- var startY = this.axis.posY * this.chartProp.pxToMM;
+ let startY = this.axis.posY * this.chartProp.pxToMM;
- for (var i = 0; i <= this.chartProp.seriesCount; i++) {
+ for (let i = 0; i <= seriesCount; i++) {
//основные линии
if (!this.paths.tickMarks) {
this.paths.tickMarks = [];
}
- var convertResult = this.cChartDrawer._convertAndTurnPoint(startX, startY, i * stepY);
- var x = convertResult.x / this.chartProp.pxToMM;
- var y = convertResult.y / this.chartProp.pxToMM;
+ let convertResult = this.cChartDrawer._convertAndTurnPoint(startX, startY, i * stepY);
+ let x = convertResult.x / this.chartProp.pxToMM;
+ let y = convertResult.y / this.chartProp.pxToMM;
this.paths.tickMarks[i] = this._calculateLine(x, y, x + widthLine / this.chartProp.pxToMM, y);
}
@@ -16327,7 +17572,7 @@ CColorObj.prototype =
function CTrendline(chartsDrawer) {
this.cChartDrawer = chartsDrawer;
this.storage = {};//[chartId][seriaId]
- this.ptCount = null;
+ this.ptCount = 0;
//control trend calculate type
this.bAllowDrawByBezier = true;
@@ -16339,15 +17584,6 @@ CColorObj.prototype =
constructor: CTrendline,
- // find max ptCount
- init: function (ptCount) {
- if (!this.ptCount) {
- this.ptCount = ptCount;
- } else {
- this.ptCount = Math.max(ptCount);
- }
- },
-
addCoordinate: function (xVal, yVal, chartId, seriaId) {
if (!this.storage[chartId]) {
this.storage[chartId] = {};
@@ -16361,6 +17597,7 @@ CColorObj.prototype =
// in the case of duplicated data, no further adding should be allowed
if (!this.stopAdding) {
+ this.ptCount+=1;
this.storage[chartId][seriaId].addCatVal(xVal);
this.storage[chartId][seriaId].addValVal(yVal);
@@ -16432,8 +17669,8 @@ CColorObj.prototype =
const coefficients = this._getEquationCoefficients(coords.catVals, coords.valVals, type, order, attributes.intercept);
const equationStorage = this._obtainEquationStorage(type);
if (coefficients && equationStorage) {
- let catMax = catAxis.max + attributes.forward;
- let catMin = catAxis.min + attributes.backward;
+ let catMax = catAxis.max;
+ let catMin = catAxis.min;
const midPointsNum = 100;
const lineBuilder = new CLineBuilder(coefficients, catMin, catMax, valAxis.scaling.min, valAxis.scaling.max, valAxis.scaling.logBase);
lineBuilder.setCalcYVal(equationStorage.calcYVal);
@@ -16458,10 +17695,10 @@ CColorObj.prototype =
}
storageElement.setBoundary(lineBuilder.getBoundary());
- if (attributes.dispEq) {
+ if (attributes.dispEq || attributes.dispEq === null) {
storageElement.setCoefficients(coefficients);
}
- if (attributes.dispRSqr) {
+ if (attributes.dispRSqr || attributes.dispRSqr === null) {
const rSquared = this._dispRSquared(coords.catVals, coords.valVals, coefficients, type);
storageElement.setRSquared(rSquared);
}
diff --git a/common/Charts/DrawingArea.js b/common/Charts/DrawingArea.js
index e081fe4f4e..6132176f81 100755
--- a/common/Charts/DrawingArea.js
+++ b/common/Charts/DrawingArea.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -434,13 +434,13 @@ function FrozenPlace(ws, type) {
break;
case FrozenAreaType.Bottom: {
- scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet._getRowTop(_this.frozenCell.row)) + headerPx;
+ scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet._getRowTop(_this.frozenCell.row) + _this.worksheet.getScrollCorrect()) + headerPx;
}
break;
case FrozenAreaType.Left:
case FrozenAreaType.Right: {
- scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet.cellsTop) + headerPx;
+ scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet.cellsTop + _this.worksheet.getScrollCorrect()) + headerPx;
}
break;
@@ -453,13 +453,13 @@ function FrozenPlace(ws, type) {
case FrozenAreaType.LeftBottom:
case FrozenAreaType.RightBottom: {
- scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet._getRowTop(_this.frozenCell.row)) + headerPx;
+ scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet._getRowTop(_this.frozenCell.row) + _this.worksheet.getScrollCorrect()) + headerPx;
}
break;
// No frozen areas
case FrozenAreaType.Center: {
- scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet.cellsTop) + headerPx;
+ scroll = -(_this.worksheet._getRowTop(fv.row) - _this.worksheet.cellsTop + _this.worksheet.getScrollCorrect()) + headerPx;
}
break;
}
@@ -477,7 +477,7 @@ function FrozenPlace(ws, type) {
// Two places
case FrozenAreaType.Top:
case FrozenAreaType.Bottom: {
- scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet.cellsLeft) + headerPx;
+ scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet.cellsLeft + _this.worksheet.getHorizontalScrollCorrect()) + headerPx;
}
break;
@@ -487,7 +487,7 @@ function FrozenPlace(ws, type) {
break;
case FrozenAreaType.Right: {
- scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet._getColLeft(_this.frozenCell.col)) + headerPx;
+ scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet._getColLeft(_this.frozenCell.col) + _this.worksheet.getHorizontalScrollCorrect()) + headerPx;
}
break;
@@ -500,17 +500,17 @@ function FrozenPlace(ws, type) {
case FrozenAreaType.RightTop:
case FrozenAreaType.RightBottom: {
- scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet._getColLeft(_this.frozenCell.col)) + headerPx;
+ scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet._getColLeft(_this.frozenCell.col) + _this.worksheet.getHorizontalScrollCorrect()) + headerPx;
}
break;
// No frozen areas
case FrozenAreaType.Center: {
- scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet.cellsLeft) + headerPx;
+ scroll = -(_this.worksheet._getColLeft(fv.col) - _this.worksheet.cellsLeft + _this.worksheet.getHorizontalScrollCorrect()) + headerPx;
}
break;
}
- return scroll;
+ return _this.worksheet.getRightToLeft() ? -scroll : scroll;
};
_this.clip = function(canvas, rect) {
@@ -542,7 +542,7 @@ function FrozenPlace(ws, type) {
var oClipRect;
if(!oRect) {
- oClipRect = _this.worksheet.rangeToRectRel(_this.range, 0);
+ oClipRect = _this.worksheet.rangeToRectRel(_this.range, 0, true);
}
else {
var oT = canvas.shapeCtx.m_oCoordTransform;
@@ -580,7 +580,7 @@ function FrozenPlace(ws, type) {
}
var canvas = _this.worksheet.objectRender.getDrawingCanvas();
_this.setTransform(canvas.shapeCtx, canvas.shapeOverlayCtx, canvas.autoShapeTrack);
- _this.clip(canvas.shapeCtx, _this.worksheet.rangeToRectRel(oClipRange, 0));
+ _this.clip(canvas.shapeCtx, _this.worksheet.rangeToRectRel(oClipRange, 0, true));
canvas.shapeCtx.updatedRect = _this.worksheet.rangeToRectAbs(oClipRange, 3);
//For debug
// canvas.shapeCtx.p_color(0, 0, 0, 255);
@@ -629,10 +629,10 @@ function FrozenPlace(ws, type) {
}
autoShapeTrack.m_oOverlay.CheckPoint1(x - nW, top);
autoShapeTrack.m_oOverlay.CheckPoint2(x + nW, bottom);
- autoShapeTrack.drawImage(sFrozenImageRotUrl, x, top, nW, bottom);
+ autoShapeTrack.drawImage(sFrozenImageRotUrl, _this.worksheet.checkRtl(x), top, nW, bottom);
}
else {
- autoShapeTrack.m_oOverlay.DrawFrozenPlaceVerLine(x, top, bottom);
+ autoShapeTrack.m_oOverlay.DrawFrozenPlaceVerLine(_this.worksheet.checkRtl(x), top, bottom);
}
};
_this.drawSelection = function(drawingDocument, shapeCtx, shapeOverlayCtx, autoShapeTrack, trackOverlay) {
@@ -640,7 +640,7 @@ function FrozenPlace(ws, type) {
var ctx = trackOverlay.m_oContext;
_this.setTransform(shapeCtx, shapeOverlayCtx, autoShapeTrack, trackOverlay);
// Clip
- _this.clip(shapeOverlayCtx, _this.worksheet.rangeToRectRel(_this.range, 0));
+ _this.clip(shapeOverlayCtx, _this.worksheet.rangeToRectRel(_this.range, 0, true));
if (drawingDocument.m_bIsSelection) {
if (!window["IS_NATIVE_EDITOR"]) {
drawingDocument.SelectionMatrix = null;
@@ -857,7 +857,17 @@ DrawingArea.prototype.drawSelection = function(drawingDocument) {
if(oWatermark) {
oWatermark.zoom = 1.0;
oWatermark.Generate();
- oWatermark.Draw(ctx, ctx.canvas.width, ctx.canvas.height);
+ if(oWatermark.width > 0 && oWatermark.height > 0) {
+ let nOffsetY = oWS.cellsTop;
+ while (nOffsetY < ctx.canvas.height) {
+ let nOffsetX = oWS.cellsLeft;
+ while (nOffsetX < ctx.canvas.width) {
+ oWatermark.Draw(ctx, nOffsetX, nOffsetY, oWatermark.width, oWatermark.height);
+ nOffsetX += oWatermark.width;
+ }
+ nOffsetY += oWatermark.height;
+ }
+ }
}
if (this.api) {
diff --git a/common/Charts/DrawingObjects.js b/common/Charts/DrawingObjects.js
index 436dabc73f..988e0f6e29 100644
--- a/common/Charts/DrawingObjects.js
+++ b/common/Charts/DrawingObjects.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -427,8 +427,16 @@ function asc_CChartBinary(chart) {
this["binary"] = null;
if (chart && chart.getObjectType() === AscDFH.historyitem_type_ChartSpace)
{
+ this["IsChartEx"] = chart.isChartEx();
var writer = new AscCommon.BinaryChartWriter(new AscCommon.CMemory(false)), pptx_writer;
- writer.WriteCT_ChartSpace(chart);
+ if(this["IsChartEx"])
+ {
+ writer.WriteCT_ChartExSpace(chart);
+ }
+ else
+ {
+ writer.WriteCT_ChartSpace(chart);
+ }
this["binary"] = writer.memory.pos + ";" + writer.memory.GetBase64Memory();
if(chart.theme)
{
@@ -462,6 +470,8 @@ asc_CChartBinary.prototype = {
asc_setThemeBinary: function(val) { this["themeBinary"] = val; },
asc_setColorMapBinary: function(val){this["colorMapBinary"] = val;},
asc_getColorMapBinary: function(){return this["colorMapBinary"];},
+ asc_setIsChartEx: function(val){this["IsChartEx"] = val;},
+ asc_getIsChartEx: function(){return this["IsChartEx"];},
getChartSpace: function(workSheet)
{
var binary = this["binary"];
@@ -470,7 +480,12 @@ asc_CChartBinary.prototype = {
AscCommon.pptx_content_loader.Clear();
var oNewChartSpace = Asc.editor.isPdfEditor() ? new AscPDF.CPdfChart() : new AscFormat.CChartSpace();
var oBinaryChartReader = new AscCommon.BinaryChartReader(stream);
- oBinaryChartReader.ExternalReadCT_ChartSpace(stream.size , oNewChartSpace, workSheet);
+ if(this["IsChartEx"]) {
+ oBinaryChartReader.ExternalReadCT_ChartExSpace(stream.size , oNewChartSpace, workSheet);
+ }
+ else {
+ oBinaryChartReader.ExternalReadCT_ChartSpace(stream.size , oNewChartSpace, workSheet);
+ }
return oNewChartSpace;
},
@@ -1080,6 +1095,8 @@ CSparklineView.prototype.draw = function(graphics, offX, offY)
var x = this.ws.getCellLeft(this.col, 3) - offX;
var y = this.ws.getCellTop(this.row, 3) - offY;
+ x = this.ws.checkRtl(x, undefined, 3);
+
var i;
var extX;
@@ -1088,7 +1105,7 @@ CSparklineView.prototype.draw = function(graphics, offX, offY)
if(oMergeInfo){
extX = 0;
for(i = oMergeInfo.c1; i <= oMergeInfo.c2; ++i){
- extX += this.ws.getColumnWidth(i, 3)
+ extX += this.ws.getColumnWidth(i, 3);
}
extY = 0;
for(i = oMergeInfo.r1; i <= oMergeInfo.r2; ++i){
@@ -1100,6 +1117,9 @@ CSparklineView.prototype.draw = function(graphics, offX, offY)
extY = this.ws.getRowHeight(this.row, 3);
}
+ if (this.ws.getRightToLeft()) {
+ x -= extX;
+ }
var bExtent = Math.abs(this.extX - extX) > 0.01 || Math.abs(this.extY - extY) > 0.01;
var bPosition = Math.abs(this.x - x) > 0.01 || Math.abs(this.y - y) > 0.01;
@@ -1363,6 +1383,9 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
metrics.y = this.pxToMm( coordsFrom.y );
metrics.extX = this.ext.cx;
metrics.extY = this.ext.cy;
+ if (this.worksheet.getRightToLeft()) {
+ metrics.x -= metrics.extX;
+ }
}
break;
}
@@ -1370,12 +1393,21 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
{
if (this.worksheet) {
coordsFrom = this.getDrawingObjects().calculateCoords(_t.from);
- metrics.x = this.pxToMm( coordsFrom.x );
- metrics.y = this.pxToMm( coordsFrom.y );
+ if (!this.worksheet.getRightToLeft()) {
+ metrics.x = this.pxToMm( coordsFrom.x );
+ metrics.y = this.pxToMm( coordsFrom.y );
+ coordsTo = this.getDrawingObjects().calculateCoords(_t.to);
+ metrics.extX = this.pxToMm( coordsTo.x - coordsFrom.x );
+ metrics.extY = this.pxToMm( coordsTo.y - coordsFrom.y );
+ } else {
+ metrics.y = this.pxToMm( coordsFrom.y );
+
+ coordsTo = this.getDrawingObjects().calculateCoords(_t.to);
+ metrics.extX = this.pxToMm( coordsFrom.x - coordsTo.x );
+ metrics.extY = this.pxToMm( coordsTo.y - coordsFrom.y );
- coordsTo = this.getDrawingObjects().calculateCoords(_t.to);
- metrics.extX = this.pxToMm( coordsTo.x - coordsFrom.x );
- metrics.extY = this.pxToMm( coordsTo.y - coordsFrom.y );
+ metrics.x = this.pxToMm( coordsTo.x );
+ }
}
break;
}
@@ -1430,6 +1462,12 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
ret.ext.cy = _t.graphicObject.extX;
}
+ if (this.worksheet.getRightToLeft()) {
+ let temp = fromX;
+ fromX = toX;
+ toX = temp;
+ }
+
var fromColCell = this.worksheet.findCellByXY(fromX, fromY, true, false, true);
var fromRowCell = this.worksheet.findCellByXY(fromX, fromY, true, true, false);
var toColCell = this.worksheet.findCellByXY(toX, toY, true, false, true);
@@ -1499,6 +1537,12 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
this.ext.cy = _t.graphicObject.extX;
}
+ if (this.worksheet.getRightToLeft()) {
+ let temp = fromX;
+ fromX = toX;
+ toX = temp;
+ }
+
var fromColCell = this.worksheet.findCellByXY(fromX, fromY, true, false, true);
var fromRowCell = this.worksheet.findCellByXY(fromX, fromY, true, true, false);
var toColCell = this.worksheet.findCellByXY(toX, toY, true, false, true);
@@ -1536,6 +1580,12 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
toY = 0;
}
+ if (this.worksheet.getRightToLeft()) {
+ let temp = fromX;
+ fromX = toX;
+ toX = temp;
+ }
+
var fromColCell = this.worksheet.findCellByXY(fromX, fromY, true, false, true);
var fromRowCell = this.worksheet.findCellByXY(fromX, fromY, true, true, false);
var toColCell = this.worksheet.findCellByXY(toX, toY, true, false, true);
@@ -1998,6 +2048,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
oGraphic = drawingObject.graphicObject;
oGraphic.setDrawingBase(drawingObject);
oGraphic.setDrawingObjects(_this);
+ oGraphic.generateLocalDrawingPart();
oGraphic.getAllRasterImages(aImagesSync);
}
aImagesSync = _this.checkImageBullets(currentSheet, aImagesSync);
@@ -2384,7 +2435,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
//-----------------------------------------------------------------------------------
- _this.calculateObjectMetrics = function (object, width, height) {
+ _this.calculateObjectMetrics = function (object, width, height, opt_checkRtl) {
// Обработка картинок большого разрешения
var bCorrect = false;
var metricCoeff = 1;
@@ -2411,6 +2462,9 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
bCorrect = true;
}
+ if (opt_checkRtl && worksheet.getRightToLeft()) {
+ width *= -1;
+ }
var toCell = worksheet.findCellByXY(realLeftOffset + width, realTopOffset + height, true, false, false);
object.to.col = toCell.col;
object.to.colOff = pxToMm(toCell.colOff);
@@ -2443,10 +2497,15 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
oSize = new AscCommon.asc_CImageSize(Math.max((options.width * AscCommon.g_dKoef_pix_to_mm), 1),
Math.max((options.height * AscCommon.g_dKoef_pix_to_mm), 1), true);
}
- var bCorrect = _this.calculateObjectMetrics(drawingObject, mmToPx(oSize.asc_getImageWidth()), mmToPx(oSize.asc_getImageHeight()));
+ var bCorrect = _this.calculateObjectMetrics(drawingObject, mmToPx(oSize.asc_getImageWidth()), mmToPx(oSize.asc_getImageHeight()), true);
var coordsFrom = _this.calculateCoords(drawingObject.from);
var coordsTo = _this.calculateCoords(drawingObject.to);
+ if (worksheet.getRightToLeft()) {
+ let temp = coordsTo.x;
+ coordsTo.x = coordsFrom.x;
+ coordsFrom.x = temp;
+ }
if(bCorrect) {
_this.controller.addImageFromParams(_image.src, pxToMm(coordsFrom.x) + MOVE_DELTA, pxToMm(coordsFrom.y) + MOVE_DELTA, pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y));
}
@@ -2795,6 +2854,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
asc_chart_binary.asc_setBinary(chart["binary"]);
asc_chart_binary.asc_setThemeBinary(chart["themeBinary"]);
asc_chart_binary.asc_setColorMapBinary(chart["colorMapBinary"]);
+ asc_chart_binary.asc_setIsChartEx(chart["IsChartEx"]);
var oNewChartSpace = asc_chart_binary.getChartSpace(model);
var theme = asc_chart_binary.getTheme();
if(theme)
@@ -2850,13 +2910,42 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
function fillTableFromRef(ref)
{
- var cache = ref.numCache ? ref.numCache : (ref.strCache ? ref.strCache : null);
+ var cache;
+ if(ref.numCache) {
+ cache =ref.numCache;
+ }
+ else if(ref.strCache) {
+ cache = ref.strCache;
+ }
+ else {
+ if(Array.isArray(ref.levelData)) {
+ cache = ref.levelData[0];
+ }
+ else if(typeof ref.v === "string") {
+ cache = AscFormat.ExecuteNoHistory(
+ function() {
+ let oStrCache = new AscFormat.CStrCache();
+ let oPt = new AscFormat.CStringPoint();
+ oPt.idx = 0;
+ oPt.val = ref.v;
+ oStrCache.addPt(oPt);
+ return oStrCache;
+ }, this, []
+ );
+ }
+ }
+ var sFormula = "";
+ if(typeof ref.f === "string") {
+ sFormula = ref.f;
+ }
+ else if(ref.f && ref.f.content) {
+ sFormula = ref.f.content;
+ }
var lit_format_code;
if(cache)
{
lit_format_code = (typeof cache.formatCode === "string" && cache.formatCode.length > 0) ? cache.formatCode : "General";
- var sFormula = ref.f + "";
if(sFormula[0] === '(')
sFormula = sFormula.slice(1);
if(sFormula[sFormula.length-1] === ')')
@@ -3007,6 +3096,27 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
}
}
}
+ else
+ {
+ if(oNewChartSpace.isChartEx()) {
+ let aSeries = oNewChartSpace.getAllSeries();
+
+ for(let nS = 0; nS < aSeries.length; ++nS) {
+ let oSeries = aSeries[nS];
+ let oData = oSeries.getData();
+ if(oData) {
+ let aDims = oData.dimension;
+ for(let nDim = 0; nDim < aDims.length; ++nDim) {
+ let oDim = aDims[nDim];
+ fillTableFromRef(oDim);
+ }
+ }
+ if(oSeries.tx && oSeries.tx.txData) {
+ fillTableFromRef(oSeries.tx.txData);
+ }
+ }
+ }
+ }
oAllRange = oAllRange.bbox;
oAllRange.r2 = Math.max(oAllRange.r2, max_r);
oAllRange.c2 = Math.max(oAllRange.c2, max_c);
@@ -4548,9 +4658,11 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
if(_this.controller.checkSelectedObjectsProtectionText()) {
return;
}
+ Asc.editor.sendEvent("asc_onUserActionStart");
History.Create_NewPoint(AscDFH.historydescription_Document_CompositeInput);
_this.beginCompositeInput();
_this.controller.recalculateCurPos(true, true);
+ Asc.editor.sendEvent("asc_onUserActionEnd");
};
@@ -4583,12 +4695,14 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
{
if (null === _this.CompositeInput)
return;
+ Asc.editor.sendEvent("asc_onUserActionStart");
History.Create_NewPoint(AscDFH.historydescription_Document_CompositeInputReplace);
_this.addCompositeText(nCharCode);
_this.checkCurrentTextObjectExtends();
_this.controller.recalculate();
_this.controller.recalculateCurPos(true, true);
_this.controller.updateSelectionState();
+ Asc.editor.sendEvent("asc_onUserActionEnd");
};
_this.removeCompositeText = function(nCount){
@@ -4614,6 +4728,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
{
if (null === _this.CompositeInput)
return;
+ Asc.editor.sendEvent("asc_onUserActionStart");
History.Create_NewPoint(AscDFH.historydescription_Document_CompositeInputReplace);
_this.removeCompositeText(_this.CompositeInput.Length);
for (var nIndex = 0, nCount = arrCharCodes.length; nIndex < nCount; ++nIndex)
@@ -4624,6 +4739,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
_this.controller.startRecalculate();
_this.controller.recalculateCurPos(true, true);
_this.controller.updateSelectionState();
+ Asc.editor.sendEvent("asc_onUserActionEnd");
};
_this.Set_CursorPosInCompositeText = function(nPos)
{
@@ -4705,6 +4821,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
var resultColOff = cell.colOff > colWidth ? colWidth : cell.colOff;
coords.y = ws._getRowTop(cell.row) + ws.objectRender.convertMetric(resultRowOff, 3, 0) - ws._getRowTop(0);
coords.x = ws._getColLeft(cell.col) + ws.objectRender.convertMetric(resultColOff, 3, 0) - ws._getColLeft(0);
+ coords.x = ws.checkRtl(coords.x, undefined, undefined, true);
}
return coords;
};
diff --git a/common/Charts/charts.js b/common/Charts/charts.js
index 1f9e8ddfcd..77d6a55a08 100644
--- a/common/Charts/charts.js
+++ b/common/Charts/charts.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/CollaborativeEditingBase.js b/common/CollaborativeEditingBase.js
index c44e87c1ee..6370957ddf 100644
--- a/common/CollaborativeEditingBase.js
+++ b/common/CollaborativeEditingBase.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -123,9 +123,9 @@
};
CCollaborativeChanges.prototype.private_SaveData = function(Binary)
{
- var Writer = AscCommon.History.BinaryWriter;
- var Pos = Binary.Pos;
- var Len = Binary.Len;
+ let Writer = AscCommon.History.BinaryWriter;
+ let Pos = Binary.Pos;
+ let Len = Binary.Len;
if ((Asc.editor || editor).binaryChanges) {
return Writer.GetDataUint8(Pos, Len);
} else {
@@ -249,7 +249,15 @@
{
return this.m_oLogicDocument;
};
- CCollaborativeEditingBase.prototype.Clear = function()
+ CCollaborativeEditingBase.prototype.getCoHistory = function()
+ {
+ return this.CoHistory;
+ };
+ CCollaborativeEditingBase.prototype.SetLogicDocument = function(doc)
+ {
+ this.m_oLogicDocument = doc;
+ };
+ CCollaborativeEditingBase.prototype.Clear = function()
{
this.m_nUseType = 1;
@@ -264,6 +272,8 @@
this.m_aCheckLocksInstance = [];
this.m_aNewObjects = [];
this.m_aNewImages = [];
+
+ this.CoHistory.clear();
};
CCollaborativeEditingBase.prototype.Set_Fast = function(bFast)
{
@@ -283,15 +293,15 @@
{
return (1 === this.m_nUseType);
};
+ CCollaborativeEditingBase.prototype.isCollaboration = function()
+ {
+ return (-1 === this.m_nUseType);
+ };
CCollaborativeEditingBase.prototype.canSendChanges = function()
{
let api = this.GetEditorApi();
return api && api.canSendChanges();
};
- CCollaborativeEditingBase.prototype.getCoHistory = function()
- {
- return this.CoHistory;
- };
CCollaborativeEditingBase.prototype.getCollaborativeEditing = function()
{
return !this.Is_SingleUser();
@@ -372,6 +382,8 @@
if (fEndCallBack)
fEndCallBack();
}
+
+ AscCommon.CollaborativeEditing.CoHistory.InitTextRecover();
};
CCollaborativeEditingBase.prototype.Apply_OtherChanges = function()
{
@@ -901,6 +913,10 @@
}
}
};
+ CCollaborativeEditingBase.prototype.Get_CollaborativeMarks = function ()
+ {
+ return this.m_aChangedClasses;
+ }
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с обновлением курсоров после принятия изменений
//----------------------------------------------------------------------------------------------------------------------
@@ -947,6 +963,10 @@
CCollaborativeEditingBase.prototype.Add_DocumentPosition = function(DocumentPos){
this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos);
};
+ CCollaborativeEditingBase.prototype.Remove_DocumentPosition = function(docPos)
+ {
+ this.m_aDocumentPositions.Remove_DocumentPosition(docPos);
+ };
CCollaborativeEditingBase.prototype.Add_ForeignCursor = function(UserId, DocumentPos, UserShortId){
this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);
this.m_aForeignCursors[UserId] = DocumentPos;
diff --git a/common/Controls.js b/common/Controls.js
index c6030a1611..eff09724aa 100644
--- a/common/Controls.js
+++ b/common/Controls.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/ArcTo.js b/common/Drawings/ArcTo.js
index 3251be9101..4ce967cbe2 100644
--- a/common/Drawings/ArcTo.js
+++ b/common/Drawings/ArcTo.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/ColorArray.js b/common/Drawings/ColorArray.js
index ff5f2c2325..504cf76b53 100644
--- a/common/Drawings/ColorArray.js
+++ b/common/Drawings/ColorArray.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/CommonController.js b/common/Drawings/CommonController.js
index 718e86c53a..59842444a7 100644
--- a/common/Drawings/CommonController.js
+++ b/common/Drawings/CommonController.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -206,6 +206,46 @@
return oResult;
}
+ function fGetMaxInscribedRectangle(width, height, angle) {
+ const isShortWidth = width < height;
+ let shortSide = height;
+ let longSide = width;
+ if (isShortWidth) {
+ longSide = height;
+ shortSide = width;
+ }
+ const sinA = Math.abs(Math.sin(angle));
+ const cosA = Math.abs(Math.cos(angle));
+ const tanA = sinA / cosA;
+ let inscribedWidth;
+ let inscribedHeight;
+
+ if (angle % Math.PI === 0) {
+ inscribedWidth = width;
+ inscribedHeight = height;
+ } else if (angle % (Math.PI / 2) === 0) {
+ inscribedWidth = height;
+ inscribedHeight = width;
+ } else if (shortSide * (tanA + 1 / tanA) / 2 <= longSide) {
+ if (isShortWidth) {
+ inscribedWidth = shortSide / (2 * cosA);
+ inscribedHeight = shortSide / (2 * sinA);
+ } else {
+ inscribedWidth = shortSide / (2 * sinA);
+ inscribedHeight = shortSide / (2 * cosA);
+ }
+ } else {
+ const divider = sinA * sinA - cosA * cosA;
+ inscribedWidth = (height * sinA - cosA * width) / divider;
+ inscribedHeight = (width * sinA - cosA * height) / divider;
+ }
+
+ return {
+ width: inscribedWidth,
+ height: inscribedHeight
+ };
+ }
+
function checkParagraphDefFonts(map, par) {
par && par.Pr && par.Pr.DefaultRunPr && checkRFonts(map, par.Pr.DefaultRunPr.RFonts);
}
@@ -1485,7 +1525,7 @@
if (AscFormat.isLeftButtonDoubleClick(e) && !e.ShiftKey && !e.CtrlKey && ((this.selection.groupSelection && this.selection.groupSelection.selectedObjects.length === 1) || this.selectedObjects.length === 1)) {
- var drawing = this.selectedObjects[0].parent;
+ var drawing = this.selectedObjects[0] && this.selectedObjects[0].parent;
if (object.getObjectType() === AscDFH.historyitem_type_ChartSpace && this.handleChartDoubleClick) {
this.handleChartDoubleClick(drawing, object, e, x, y, pageIndex);
@@ -2064,7 +2104,7 @@
const oApi = this.getEditorApi();
let isDrawHandles = oApi ? oApi.isShowShapeAdjustments() : true;
- const nSelectedCount = this.selectedObjects;
+ const nSelectedCount = this.selectedObjects.length;
const oFirstSelected = this.selectedObjects[0];
if (nSelectedCount === 1
@@ -2112,7 +2152,7 @@
false,
false,
undefined,
- isDrawHandles && cropObject.canEdit()
+ isDrawHandles && cropObject.canEdit() && cropObject.canResize()
);
drawingDocument.DrawTrack(
AscFormat.TYPE_TRACK.CROP,
@@ -2124,7 +2164,7 @@
false,
false,
undefined,
- isDrawHandles && oCrop.canEdit()
+ isDrawHandles && oCrop.canEdit() && oCrop.canResize()
);
}
}
@@ -2144,7 +2184,7 @@
AscFormat.CheckObjectLine(oTx),
oTx.canRotate(),
undefined,
- isDrawHandles && oTx.canEdit()
+ isDrawHandles && oTx.canEdit() && oTx.canResize()
);
oTx.drawAdjustments(drawingDocument);
}
@@ -2161,7 +2201,7 @@
false,
oGrp.canRotate(),
undefined,
- isDrawHandles && oGrp.canEdit()
+ isDrawHandles && oGrp.canEdit() && oGrp.canResize()
);
const oGrpTx = oGrp.selection.textSelection;
const oGrpChart = oGrp.selection.chartSelection;
@@ -2177,7 +2217,7 @@
AscFormat.CheckObjectLine(oGrpTx),
oGrpTx.canRotate(),
undefined,
- isDrawHandles && this.selection.groupSelection.canEdit()
+ isDrawHandles && this.selection.groupSelection.canEdit() && this.selection.groupSelection.canResize()
);
} else if (oGrpChart) {
oGrpChart.drawSelect(drawingDocument, pageIndex);
@@ -2197,7 +2237,7 @@
AscFormat.CheckObjectLine(oDrawing),
oDrawing.canRotate() && !Asc.editor.isPdfEditor(),
undefined,
- isDrawHandles && oGrp.canEdit());
+ isDrawHandles && oGrp.canEdit() && oGrp.canResize());
}
}
if (aGrpSelected.length === 1) {
@@ -2228,7 +2268,7 @@
AscFormat.CheckObjectLine(oDrawing),
oDrawing.canRotate(),
undefined,
- isDrawHandles && oDrawing.canEdit()
+ isDrawHandles && oDrawing.canEdit() && oDrawing.canResize()
);
}
}
@@ -2530,7 +2570,7 @@
return null;
},
- getTargetDocContent: function (bCheckChartTitle, bOrTable) {
+ getTargetDocContent: function (bTryUpdateHistory, bOrTable) {
var text_object = getTargetTextObject(this);
if (text_object) {
if (bOrTable) {
@@ -2538,8 +2578,16 @@
return text_object.graphicObject;
}
}
- if (bCheckChartTitle && text_object.checkDocContent) {
- text_object.checkDocContent();
+ if (bTryUpdateHistory) {
+ if (text_object.checkDocContent) {
+ text_object.checkDocContent();
+ }
+ if (text_object.checkDrawingPartWithHistory) {
+ const newTextObject = text_object.checkDrawingPartWithHistory();
+ if (newTextObject) {
+ text_object = newTextObject;
+ }
+ }
}
return text_object.getDocContent();
}
@@ -2563,26 +2611,31 @@
this.applyDocContentFunction(AscFormat.CDrawingDocContent.prototype.ClearParagraphFormatting, [isClearParaPr, isClearTextPr], CTable.prototype.ClearParagraphFormatting);
},
- applyDocContentFunction: function (f, args, tableFunction) {
- var oThis = this;
- var isIncreaseDecreaseFunction = f === CDocumentContent.prototype.IncreaseDecreaseFontSize;
+ applyDocContentFunction: function (f, args, tableFunction, fOrigDocContentMethod) {
+ let oThis = this;
+ let isIncreaseDecreaseFunction = f === CDocumentContent.prototype.IncreaseDecreaseFontSize;
function applyToArrayDrawings(arr) {
var ret = false, ret2;
for (var i = 0; i < arr.length; ++i) {
- if (arr[i].getObjectType() === AscDFH.historyitem_type_GroupShape || arr[i].getObjectType() === AscDFH.historyitem_type_SmartArt) {
- ret2 = applyToArrayDrawings(arr[i].arrGraphicObjects);
+ let drawing = arr[i];
+ const newShape = arr[i].checkDrawingPartWithHistory && arr[i].checkDrawingPartWithHistory();
+ if (newShape) {
+ drawing = newShape;
+ }
+ if (drawing.getObjectType() === AscDFH.historyitem_type_GroupShape || drawing.getObjectType() === AscDFH.historyitem_type_SmartArt) {
+ ret2 = applyToArrayDrawings(drawing.arrGraphicObjects);
if (ret2) {
ret = true;
}
- } else if (arr[i].getObjectType() === AscDFH.historyitem_type_GraphicFrame) {
- arr[i].graphicObject.SetApplyToAll(true);
- tableFunction.apply(arr[i].graphicObject, args);
- arr[i].graphicObject.SetApplyToAll(false);
+ } else if (drawing.getObjectType() === AscDFH.historyitem_type_GraphicFrame) {
+ drawing.graphicObject.SetApplyToAll(true);
+ tableFunction.apply(drawing.graphicObject, args);
+ drawing.graphicObject.SetApplyToAll(false);
ret = true;
- } else if (arr[i].getObjectType() === AscDFH.historyitem_type_ChartSpace) {
+ } else if (drawing.getObjectType() === AscDFH.historyitem_type_ChartSpace) {
if (args[0].Type === para_TextPr) {
- var oChartSpace = arr[i];
+ var oChartSpace = drawing;
var fCallback = function (oElement) {
AscFormat.CheckObjectTextPr(oElement, args[0].Value, oThis.getDrawingDocument());
@@ -2590,40 +2643,42 @@
oChartSpace.applyLabelsFunction(fCallback, args[0].Value);
}
if (f === CDocumentContent.prototype.IncreaseDecreaseFontSize) {
- arr[i].paragraphIncDecFontSize(args[0]);
- }
- } else if (arr[i].getDocContent) {
- var content = arr[i].getDocContent();
- if (content) {
- content.SetApplyToAll(true);
- f.apply(content, args);
- content.SetApplyToAll(false);
- ret = true;
- if (isIncreaseDecreaseFunction && arr[i].isObjectInSmartArt()) {
- arr[i].setCustT(true);
- }
- } else {
- if (arr[i].getObjectType() === AscDFH.historyitem_type_Shape) {
- if (arr[i].canEditText()) {
- if (arr[i].bWordShape) {
- arr[i].createTextBoxContent();
- } else {
- arr[i].createTextBody();
- }
- content = arr[i].getDocContent();
- if (content) {
- content.SetApplyToAll(true);
- f.apply(content, args);
- content.SetApplyToAll(false);
- ret = true;
+ drawing.paragraphIncDecFontSize(args[0]);
+ }
+ } else if (drawing.getDocContent) {
+ if(!drawing.checkEditTextStyle(fOrigDocContentMethod || f, args, false)) {
+ var content = drawing.getDocContent();
+ if (content) {
+ content.SetApplyToAll(true);
+ f.apply(content, args);
+ content.SetApplyToAll(false);
+ ret = true;
+ if (isIncreaseDecreaseFunction && drawing.isObjectInSmartArt()) {
+ drawing.setCustT(true);
+ }
+ } else {
+ if (drawing.getObjectType() === AscDFH.historyitem_type_Shape) {
+ if (drawing.canEditText()) {
+ if (drawing.bWordShape) {
+ drawing.createTextBoxContent();
+ } else {
+ drawing.createTextBody();
+ }
+ content = drawing.getDocContent();
+ if (content) {
+ content.SetApplyToAll(true);
+ f.apply(content, args);
+ content.SetApplyToAll(false);
+ ret = true;
+ }
}
}
}
}
}
- if (arr[i].checkExtentsByDocContent) {
- arr[i].checkExtentsByDocContent();
+ if (drawing.checkExtentsByDocContent) {
+ drawing.checkExtentsByDocContent();
}
}
return ret;
@@ -2649,7 +2704,9 @@
if (this.selection.textSelection) {
if (this.selection.textSelection.getObjectType() !== AscDFH.historyitem_type_GraphicFrame) {
- f.apply(this.selection.textSelection.getDocContent(), args);
+ if(!this.selection.textSelection.checkEditTextStyle(fOrigDocContentMethod || f, args, true)) {
+ f.apply(this.selection.textSelection.getDocContent(), args);
+ }
this.selection.textSelection.checkExtentsByDocContent();
} else {
tableFunction.apply(this.selection.textSelection.graphicObject, args);
@@ -2658,6 +2715,8 @@
if (this.selection.groupSelection.selection.textSelection) {
if (this.selection.groupSelection.selection.textSelection.getObjectType() !== AscDFH.historyitem_type_GraphicFrame) {
var frame = this.selection.groupSelection.selection.textSelection;
+ frame.checkDrawingPartWithHistory();
+ frame = this.selection.groupSelection.selection.textSelection;
f.apply(frame.getDocContent(), args);
if (frame.isObjectInSmartArt() && isIncreaseDecreaseFunction) {
frame.setCustT(true);
@@ -2864,8 +2923,15 @@
},
applyTextFunction: function (docContentFunction, tableFunction, args) {
+ let bApplyTextPr = false;
+ if(docContentFunction === CDocumentContent.prototype.AddToParagraph && args[0].Type === para_TextPr) {
+ bApplyTextPr = true;
+ }
if (this.selection.textSelection) {
- this.selection.textSelection.applyTextFunction(docContentFunction, tableFunction, args);
+ if(!this.selection.textSelection.checkEditTextStyle(docContentFunction, args, true)) {
+ this.selection.textSelection.checkDrawingPartWithHistory();
+ this.selection.textSelection.applyTextFunction(docContentFunction, tableFunction, args);
+ }
} else if (this.selection.groupSelection) {
var oOldDoc = this.selection.groupSelection.document;
this.selection.groupSelection.document = this.document;
@@ -2877,19 +2943,20 @@
this.document.Recalculate();
}
} else {
- if (docContentFunction === CDocumentContent.prototype.AddToParagraph && args[0].Type === para_TextPr || docContentFunction === CDocumentContent.prototype.PasteFormatting) {
+ if (bApplyTextPr || docContentFunction === CDocumentContent.prototype.PasteFormatting) {
var fDocContentCallback = function () {
if (this.CanEditAllContentControls()) {
docContentFunction.apply(this, args);
}
};
- this.applyDocContentFunction(fDocContentCallback, args, tableFunction);
+ this.applyDocContentFunction(fDocContentCallback, args, tableFunction, docContentFunction);
} else if (this.selectedObjects.length === 1 && ((this.selectedObjects[0].getObjectType() === AscDFH.historyitem_type_Shape && this.selectedObjects[0].canEditText()) || this.selectedObjects[0].getObjectType() === AscDFH.historyitem_type_GraphicFrame)) {
this.selection.textSelection = this.selectedObjects[0];
if (this.selectedObjects[0].getObjectType() === AscDFH.historyitem_type_GraphicFrame) {
this.selectedObjects[0].graphicObject.MoveCursorToStartPos(false);
this.selectedObjects[0].applyTextFunction(docContentFunction, tableFunction, args);
} else {
+ this.selectedObjects[0].checkDrawingPartWithHistory && this.selectedObjects[0].checkDrawingPartWithHistory();
var oDocContent = this.selectedObjects[0].getDocContent();
if (oDocContent) {
oDocContent.MoveCursorToEndPos(false);
@@ -3992,36 +4059,13 @@
}
}
if (AscFormat.isRealNumber(props.Width) || AscFormat.isRealNumber(props.Height)) {
-
-
- for (i = 0; i < objects_by_type.shapes.length; ++i) {
- fApplyDrawingSize(objects_by_type.shapes[i], props);
- }
- for (i = 0; i < objects_by_type.images.length; ++i) {
- fApplyDrawingSize(objects_by_type.images[i], props);
- }
- for (i = 0; i < objects_by_type.charts.length; ++i) {
- fApplyDrawingSize(objects_by_type.charts[i], props);
- }
- for (i = 0; i < objects_by_type.smartArts.length; ++i) {
- let oSmartArt = objects_by_type.smartArts[i];
- CheckSpPrXfrm3(oSmartArt);
- let kw, kh;
- kw = props.Width / oSmartArt.spPr.xfrm.extX;
- kh = props.Height / oSmartArt.spPr.xfrm.extY;
- oSmartArt.changeSize(kw, kh);
- if (oSmartArt.group) {
- checkObjectInArray(aGroups, oSmartArt.group.getMainGroup());
- }
- oSmartArt.checkDrawingBaseCoords();
- oSmartArt.checkExtentsByDocContent(true, true);
- }
- for (i = 0; i < objects_by_type.oleObjects.length; ++i) {
- let oOleObject = objects_by_type.oleObjects[i];
- fApplyDrawingSize(oOleObject, props);
- oOleObject.callPluginOnResize();
+ for(i = 0; i < aSelectedObjects.length; ++i) {
+ let oDrawing = aSelectedObjects[i];
+ fApplyDrawingSize(oDrawing, props);
+ if(oDrawing.getObjectType() === AscDFH.historyitem_type_OleObject) {
+ oDrawing.callPluginOnResize();
+ }
}
-
if (editorId === AscCommon.c_oEditorId.Presentation || editorId === AscCommon.c_oEditorId.Spreadsheet) {
bCheckConnectors = true;
bMoveFlag = false;
@@ -4048,122 +4092,53 @@
if (isRealObject(props.Position) && AscFormat.isRealNumber(props.Position.X) && AscFormat.isRealNumber(props.Position.Y)
|| AscFormat.isRealBool(props.flipH) || AscFormat.isRealBool(props.flipV) || AscFormat.isRealBool(props.flipHInvert) || AscFormat.isRealBool(props.flipVInvert) || AscFormat.isRealNumber(props.rotAdd) || AscFormat.isRealNumber(props.rot) || AscFormat.isRealNumber(props.anchor)) {
var bPosition = isRealObject(props.Position) && (AscFormat.isRealNumber(props.Position.X) || AscFormat.isRealNumber(props.Position.Y));
- for (i = 0; i < objects_by_type.shapes.length; ++i) {
- CheckSpPrXfrm(objects_by_type.shapes[i]);
- if (bPosition) {
- if (AscFormat.isRealNumber(props.Position.X)) {
- objects_by_type.shapes[i].spPr.xfrm.setOffX(props.Position.X);
- }
- if (AscFormat.isRealNumber(props.Position.Y)) {
- objects_by_type.shapes[i].spPr.xfrm.setOffY(props.Position.Y);
- }
- }
- if (AscFormat.isRealBool(props.flipH)) {
- objects_by_type.shapes[i].changeFlipH(props.flipH);
- }
- if (AscFormat.isRealBool(props.flipV)) {
- objects_by_type.shapes[i].changeFlipV(props.flipV);
- }
- if (props.flipHInvert) {
- objects_by_type.shapes[i].changeFlipH(!objects_by_type.shapes[i].flipH);
- }
- if (props.flipVInvert) {
- objects_by_type.shapes[i].changeFlipV(!objects_by_type.shapes[i].flipV);
- }
- if (AscFormat.isRealNumber(props.rotAdd)) {
- objects_by_type.shapes[i].changeRot(AscFormat.normalizeRotate(objects_by_type.shapes[i].rot + props.rotAdd));
- }
- if (AscFormat.isRealNumber(props.rot)) {
- objects_by_type.shapes[i].changeRot(AscFormat.normalizeRotate(props.rot));
- }
- if (objects_by_type.shapes[i].group) {
- checkObjectInArray(aGroups, objects_by_type.shapes[i].group.getMainGroup());
- }
- objects_by_type.shapes[i].checkDrawingBaseCoords();
- }
- for (i = 0; i < objects_by_type.images.length; ++i) {
- CheckSpPrXfrm(objects_by_type.images[i]);
- if (bPosition) {
- if (AscFormat.isRealNumber(props.Position.X)) {
- objects_by_type.images[i].spPr.xfrm.setOffX(props.Position.X);
- }
- if (AscFormat.isRealNumber(props.Position.Y)) {
- objects_by_type.images[i].spPr.xfrm.setOffY(props.Position.Y);
+ for(i = 0; i < aSelectedObjects.length; ++i) {
+ let oDrawing = aSelectedObjects[i];
+ CheckSpPrXfrm(oDrawing);
+ let nType = oDrawing.getObjectType();
+ if(bPosition) {
+ let oXfrm = oDrawing.spPr && oDrawing.spPr.xfrm;
+ if(oXfrm) {
+ if (AscFormat.isRealNumber(props.Position.X)) {
+ oXfrm.setOffX(props.Position.X);
+ }
+ if (AscFormat.isRealNumber(props.Position.Y)) {
+ oXfrm.setOffY(props.Position.Y);
+ }
}
}
- if (AscFormat.isRealBool(props.flipH)) {
- objects_by_type.images[i].changeFlipH(props.flipH);
- }
- if (AscFormat.isRealBool(props.flipV)) {
- objects_by_type.images[i].changeFlipV(props.flipV);
- }
- if (props.flipHInvert) {
- objects_by_type.images[i].changeFlipH(!objects_by_type.images[i].flipH);
- }
- if (props.flipVInvert) {
- objects_by_type.images[i].changeFlipV(!objects_by_type.images[i].flipV);
- }
- if (AscFormat.isRealNumber(props.rot)) {
- objects_by_type.images[i].changeRot(AscFormat.normalizeRotate(props.rot));
- }
- if (AscFormat.isRealNumber(props.rotAdd)) {
- objects_by_type.images[i].changeRot(AscFormat.normalizeRotate(objects_by_type.images[i].rot + props.rotAdd));
- }
- if (objects_by_type.images[i].group) {
- checkObjectInArray(aGroups, objects_by_type.images[i].group.getMainGroup());
- }
- objects_by_type.images[i].checkDrawingBaseCoords();
- }
- if (bPosition) {
- for (i = 0; i < objects_by_type.charts.length; ++i) {
- CheckSpPrXfrm(objects_by_type.charts[i]);
- if (AscFormat.isRealNumber(props.Position.X)) {
- objects_by_type.charts[i].spPr.xfrm.setOffX(props.Position.X);
- }
- if (AscFormat.isRealNumber(props.Position.Y)) {
- objects_by_type.charts[i].spPr.xfrm.setOffY(props.Position.Y);
- }
- if (objects_by_type.charts[i].group) {
- checkObjectInArray(aGroups, objects_by_type.charts[i].group.getMainGroup());
- }
- objects_by_type.charts[i].checkDrawingBaseCoords();
- }
- var aSlicers = objects_by_type.slicers;
- for (i = 0; i < aSlicers.length; ++i) {
- var oSlicer = aSlicers[i];
- CheckSpPrXfrm(oSlicer);
- if (AscFormat.isRealNumber(props.Position.X)) {
- oSlicer.spPr.xfrm.setOffX(props.Position.X);
- }
- if (AscFormat.isRealNumber(props.Position.Y)) {
- oSlicer.spPr.xfrm.setOffY(props.Position.Y);
- }
+ if( nType === AscDFH.historyitem_type_Shape ||
+ nType === AscDFH.historyitem_type_Cnx ||
+ nType === AscDFH.historyitem_type_ImageShape ||
+ nType === AscDFH.historyitem_type_GroupShape) {
- if (oSlicer.group) {
- checkObjectInArray(aGroups, oSlicer.group.getMainGroup());
+ if (AscFormat.isRealBool(props.flipH)) {
+ oDrawing.changeFlipH(props.flipH);
}
- oSlicer.checkDrawingBaseCoords();
- oSlicer.recalculate();
- }
-
- var aSmartArts = objects_by_type.smartArts;
- for (i = 0; i < aSmartArts.length; ++i) {
- var oSmartArt = aSmartArts[i];
- CheckSpPrXfrm(oSmartArt);
- if (AscFormat.isRealNumber(props.Position.X)) {
- oSmartArt.spPr.xfrm.setOffX(props.Position.X);
+ if (AscFormat.isRealBool(props.flipV)) {
+ oDrawing.changeFlipV(props.flipV);
}
- if (AscFormat.isRealNumber(props.Position.Y)) {
- oSmartArt.spPr.xfrm.setOffY(props.Position.Y);
+ if (props.flipHInvert) {
+ oDrawing.changeFlipH(!oDrawing.flipH);
}
-
- if (oSmartArt.group) {
- checkObjectInArray(aGroups, oSmartArt.group.getMainGroup());
+ if (props.flipVInvert) {
+ oDrawing.changeFlipV(!oDrawing.flipV);
}
- oSmartArt.checkDrawingBaseCoords();
- oSmartArt.recalculate();
+ if(oDrawing.canRotate()) {
+ if (AscFormat.isRealNumber(props.rotAdd)) {
+ oDrawing.changeRot(AscFormat.normalizeRotate(oDrawing.rot + props.rotAdd));
+ }
+ if (AscFormat.isRealNumber(props.rot)) {
+ oDrawing.changeRot(AscFormat.normalizeRotate(props.rot));
+ }
+ }
+ }
+ if (oDrawing.group) {
+ checkObjectInArray(aGroups, oDrawing.group.getMainGroup());
}
+ oDrawing.checkDrawingBaseCoords();
+ oDrawing.recalculate();
}
if (editorId === AscCommon.c_oEditorId.Presentation || editorId === AscCommon.c_oEditorId.Spreadsheet) {
bCheckConnectors = true;
@@ -4295,6 +4270,68 @@
if (!oChartSpace || !oProps) {
return;
}
+ if(oChartSpace.isChartEx()) {
+
+ var oChart = oChartSpace.chart;
+ var oPlotArea = oChart.plotArea;
+ var nTitle = oProps.getTitle(), oTitle, bOverlay;
+ if (nTitle === c_oAscChartTitleShowSettings.none) {
+ if (oChart.title) {
+ oChart.setTitle(null);
+ }
+ } else if (nTitle === c_oAscChartTitleShowSettings.noOverlay
+ || nTitle === c_oAscChartTitleShowSettings.overlay) {
+ oTitle = oChart.title;
+ if (!oTitle) {
+ oTitle = new AscFormat.CTitle();
+ oChart.setTitle(oTitle);
+ }
+ bOverlay = (nTitle === c_oAscChartTitleShowSettings.overlay);
+ if (oTitle.overlay !== bOverlay) {
+ oTitle.setOverlay(bOverlay);
+ }
+ }
+
+
+ var nLegend = oProps.getLegendPos(), oLegend;
+ bOverlay = (c_oAscChartLegendShowSettings.leftOverlay === nLegend || nLegend === c_oAscChartLegendShowSettings.rightOverlay);
+ if (bOverlay) {
+ if (c_oAscChartLegendShowSettings.leftOverlay === nLegend) {
+ nLegend = c_oAscChartLegendShowSettings.left;
+ }
+ if (c_oAscChartLegendShowSettings.rightOverlay === nLegend) {
+ nLegend = c_oAscChartLegendShowSettings.right;
+ }
+ }
+ if (nLegend !== null) {
+ if (nLegend === c_oAscChartLegendShowSettings.none) {
+ if (oChart.legend) {
+ oChart.setLegend(null);
+ }
+ } else {
+ oLegend = oChart.legend;
+ var bChange = false;
+ if (!oLegend) {
+ oLegend = new AscFormat.CLegend();
+ oChart.setLegend(oLegend);
+ bChange = true;
+ }
+ if (oLegend.legendPos !== nLegend && nLegend !== c_oAscChartLegendShowSettings.layout) {
+ oLegend.setLegendPos(nLegend);
+ bChange = true;
+ }
+ if (oLegend.overlay !== bOverlay) {
+ oLegend.setOverlay(bOverlay);
+ bChange = true;
+ }
+ if (bChange) {
+ oLegend.setLayout(new AscFormat.CLayout());
+ }
+ oChartSpace.checkElementChartStyle(oLegend);
+ }
+ }
+ return;
+ }
var oApi = this.getEditorApi();
oChartSpace.resetSelection(true);
if (this.selection && this.selection.chartSelection === oChartSpace) {
@@ -4322,6 +4359,7 @@
//Set the properties which was already set. It needs for the fast coediting. TODO: check it
oChartSpace.setChart(oChartSpace.chart.createDuplicate());
oChartSpace.setStyle(oChartSpace.style);
+ oChartSpace.setDisplayTrendlinesEquation(oProps.displayTrendlinesEquation);
//Apply chart preset TODO: remove this when chartStyle will be implemented
var oChart = oChartSpace.chart;
@@ -4536,6 +4574,7 @@
}
ret.putStyle(chart_space.getChartStyleIdx());
+ ret.putDisplayTrendlinesEquation(chart_space.getDisplayTrendlinesEquation());
ret.putTitle(isRealObject(chart.title) ? (chart.title.overlay ? c_oAscChartTitleShowSettings.overlay : c_oAscChartTitleShowSettings.noOverlay) : c_oAscChartTitleShowSettings.none);
@@ -4561,7 +4600,12 @@
var aPositions = chart_space.getPossibleDLblsPosition();
var nDefaultDatalabelsPos;
nDefaultDatalabelsPos = aPositions[0];
- var oFirstChart = plot_area.charts[0];
+ var oFirstChart;
+ if (plot_area.isChartEx()) {
+ oFirstChart = plot_area.plotAreaRegion
+ } else {
+ oFirstChart = plot_area.charts[0];
+ }
var aSeries = oFirstChart.series;
var nSer, oSeries;
var oFirstSeries = aSeries[0];
@@ -4716,6 +4760,7 @@
if (isRealObject(chart) && typeof chart["binary"] === "string" && chart["binary"].length > 0) {
var asc_chart_binary = new Asc.asc_CChartBinary();
asc_chart_binary.asc_setBinary(chart["binary"]);
+ asc_chart_binary.asc_setIsChartEx(chart["IsChartEx"]);
ret = asc_chart_binary.getChartSpace(editor.WordControl.m_oLogicDocument);
if (ret.spPr && ret.spPr.xfrm) {
ret.spPr.xfrm.setOffX(0);
@@ -7648,6 +7693,13 @@
group_drawing_props.shapeProps.title = drawing.getTitle();
group_drawing_props.shapeProps.name = sOwnName;
group_drawing_props.shapeProps.description = drawing.getDescription();
+ group_drawing_props.shapeProps.w = drawing.extX;
+ group_drawing_props.shapeProps.h = drawing.extY;
+ group_drawing_props.shapeProps.rot = drawing.rot;
+ group_drawing_props.shapeProps.flipH = drawing.flipH;
+ group_drawing_props.shapeProps.flipV = drawing.flipV;
+ group_drawing_props.shapeProps.x = drawing.x;
+ group_drawing_props.shapeProps.y = drawing.y;
}
if (!shape_props)
shape_props = group_drawing_props.shapeProps;
@@ -7662,6 +7714,13 @@
group_drawing_props.shapeChartProps.title = drawing.getTitle();
group_drawing_props.shapeChartProps.name = sOwnName;
group_drawing_props.shapeChartProps.description = drawing.getDescription();
+ group_drawing_props.shapeChartProps.w = drawing.extX;
+ group_drawing_props.shapeChartProps.h = drawing.extY;
+ group_drawing_props.shapeChartProps.rot = drawing.rot;
+ group_drawing_props.shapeChartProps.flipH = drawing.flipH;
+ group_drawing_props.shapeChartProps.flipV = drawing.flipV;
+ group_drawing_props.shapeChartProps.x = drawing.x;
+ group_drawing_props.shapeChartProps.y = drawing.y;
}
if (!shape_chart_props) {
shape_chart_props = group_drawing_props.shapeChartProps;
@@ -7675,6 +7734,14 @@
group_drawing_props.imageProps.title = drawing.getTitle();
group_drawing_props.imageProps.name = sOwnName;
group_drawing_props.imageProps.description = drawing.getDescription();
+
+ group_drawing_props.imageProps.w = drawing.extX;
+ group_drawing_props.imageProps.h = drawing.extY;
+ group_drawing_props.imageProps.rot = drawing.rot;
+ group_drawing_props.imageProps.flipH = drawing.flipH;
+ group_drawing_props.imageProps.flipV = drawing.flipV;
+ group_drawing_props.imageProps.x = drawing.x;
+ group_drawing_props.imageProps.y = drawing.y;
}
if (!image_props)
image_props = group_drawing_props.imageProps;
@@ -7718,6 +7785,14 @@
group_drawing_props.chartProps.title = drawing.getTitle();
group_drawing_props.chartProps.name = sOwnName;
group_drawing_props.chartProps.description = drawing.getDescription();
+
+ group_drawing_props.chartProps.w = drawing.extX;
+ group_drawing_props.chartProps.h = drawing.extY;
+ group_drawing_props.chartProps.rot = drawing.rot;
+ group_drawing_props.chartProps.flipH = drawing.flipH;
+ group_drawing_props.chartProps.flipV = drawing.flipV;
+ group_drawing_props.chartProps.x = drawing.x;
+ group_drawing_props.chartProps.y = drawing.y;
}
if (!chart_props) {
chart_props = group_drawing_props.chartProps;
@@ -8551,7 +8626,19 @@
};
return Asc.editor.checkObjectsLock(aId, callback2);
},
-
+ checkDrawingPartWithHistory: function () {
+ const api = Asc.editor;
+ const editorId = api && api.getEditorId();
+ if (editorId === AscCommon.c_oEditorId.Spreadsheet) {
+ const objectsByType = this.getSelectedObjectsByTypes(true);
+ for (let i = 0; i < objectsByType.shapes.length; i++) {
+ objectsByType.shapes[i].checkDrawingPartWithHistory();
+ }
+ for (let i = 0; i < objectsByType.smartArts.length; i++) {
+ objectsByType.smartArts[i].checkDrawingPartWithHistory();
+ }
+ }
+ },
setGraphicObjectPropsCallBack: function (props, bUpdateSelection) {
var apply_props;
if (AscFormat.isRealNumber(props.Width) && AscFormat.isRealNumber(props.Height)) {
@@ -8559,7 +8646,9 @@
} else {
apply_props = props.ShapeProperties ? props.ShapeProperties : props;
}
- var objects_by_types = this.applyDrawingProps(apply_props);
+
+ this.checkDrawingPartWithHistory();
+ const objects_by_types = this.applyDrawingProps(apply_props);
if (bUpdateSelection) {
this.updateSelectionState();
this.recalculateCurPos(true, true);
@@ -11074,9 +11163,9 @@
return null;
}
}
- if (oSelectionState2.geometryObject) {
+ if (oSelectionState2.geometryObject && oSelectionState2.geometryObject.drawing) {
if(oSelectionState1.geometryObject !== oSelectionState2.geometryObject) {
- return getTextObj(oSelectionState2.geometryObject.getSpeechDescription() + " " + AscCommon.translateManager.getValue("selected"));
+ return getTextObj(oSelectionState2.geometryObject.drawing.getSpeechDescription() + " " + AscCommon.translateManager.getValue("selected"));
}
else {
return null;
@@ -11231,6 +11320,7 @@
window['AscFormat'].CalcLiterByLength = CalcLiterByLength;
window['AscFormat'].fillImage = fillImage;
window['AscFormat'].fSolveQuadraticEquation = fSolveQuadraticEquation;
+ window['AscFormat'].fGetMaxInscribedRectangle = fGetMaxInscribedRectangle;
window['AscFormat'].fApproxEqual = fApproxEqual;
window['AscFormat'].fCheckBoxIntersectionSegment = fCheckBoxIntersectionSegment;
window['AscFormat'].CMathPainter = CMathPainter;
diff --git a/common/Drawings/DrawingObjectsHandlers.js b/common/Drawings/DrawingObjectsHandlers.js
index e9a28756c7..321ba6cfba 100644
--- a/common/Drawings/DrawingObjectsHandlers.js
+++ b/common/Drawings/DrawingObjectsHandlers.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -338,6 +338,13 @@ function handleFloatObjects(drawingObjectsController, drawingArr, e, x, y, group
case AscDFH.historyitem_type_OleObject:
case AscDFH.historyitem_type_Cnx:
case AscDFH.historyitem_type_LockedCanvas:
+ // annnots
+ case AscDFH.historyitem_type_Pdf_Annot_Ink:
+ case AscDFH.historyitem_type_Pdf_Annot_Circle:
+ case AscDFH.historyitem_type_Pdf_Annot_Square:
+ case AscDFH.historyitem_type_Pdf_Annot_Line:
+ case AscDFH.historyitem_type_Pdf_Annot_Polygon:
+ case AscDFH.historyitem_type_Pdf_Annot_Polyline:
{
ret = handleShapeImage(drawing, drawingObjectsController, e, x, y, group, pageIndex, bWord);
break;
@@ -349,6 +356,7 @@ function handleFloatObjects(drawingObjectsController, drawingArr, e, x, y, group
}
case AscDFH.historyitem_type_GroupShape:
case AscDFH.historyitem_type_SmartArt:
+ case AscDFH.historyitem_type_Pdf_Annot_FreeText:
{
ret = handleGroup(drawing, drawingObjectsController, e, x, y, group, pageIndex, bWord);
break;
@@ -734,22 +742,23 @@ function handleGroup(drawing, drawingObjectsController, e, x, y, group, pageInde
function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, group, pageIndex, bWord) {
- var selector = group ? group : drawingObjectsController;
- var bSeries = false;
+ let selector = group ? group : drawingObjectsController;
+ let bSeries = false;
if(drawing.chartObj)
{
- var t = drawing.chartObj;
- var sortCharts = t._sortChartsForDrawing(drawing);
- var oCanvas = drawing.getCanvasContext();
- if( !Array.isArray(t.chart.sortZIndexPaths) || t.chart.sortZIndexPaths.length === 0)
+ let oChartDrawer = drawing.chartObj;
+ let sortCharts = oChartDrawer._sortChartsForDrawing(drawing);
+ let oCanvas = drawing.getCanvasContext();
+ let oChartSelection = drawing.selection;
+ if(!oChartDrawer.chart || !Array.isArray(oChartDrawer.chart.sortZIndexPaths) || oChartDrawer.chart.sortZIndexPaths.length === 0)
{
for(var j = sortCharts.length - 1; j > -1; j--) {
var id = sortCharts[j];
- var chartModel = t._getChartModelById(drawing.chart.plotArea, id);
+ var chartModel = oChartDrawer._getChartModelById(drawing.chart.plotArea, id);
if(!chartModel) {
continue;
}
- var oDrawChart = t.charts[id];
+ var oDrawChart = oChartDrawer.charts[id];
var pointsPaths = oDrawChart.paths.points;
if(Array.isArray(pointsPaths))
@@ -775,25 +784,25 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
if(bSeries)
{
- if(drawing.selection.chart === id && drawing.selection.series === k)
+ if(oChartSelection.chart === id && oChartSelection.series === k)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.markers = true;
- drawing.selection.datPoint = l;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.markers = true;
+ oChartSelection.datPoint = l;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.markers = true;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.markers = true;
+ oChartSelection.datPoint = null;
}
break;
}
@@ -830,44 +839,44 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
bSeries = true;
if(bPie)
{
- if(drawing.selection.series === 0)
+ if(oChartSelection.series === 0)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = k;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = k;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = null;
}
}
else
{
- if(drawing.selection.chart === id && drawing.selection.series === k)
+ if(oChartSelection.chart === id && oChartSelection.series === k)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = l;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = l;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = null;
}
}
break;
@@ -886,45 +895,45 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
bSeries = true;
if(bPie)
{
- if(drawing.selection.series === 0)
+ if(oChartSelection.series === 0)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = k;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = k;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = null;
}
}
else
{
- if(drawing.selection.chart === id && drawing.selection.series === k)
+ if(oChartSelection.chart === id && oChartSelection.series === k)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = l;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = l;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = null;
}
}
break;
@@ -988,44 +997,44 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
{
if(bPie)
{
- if(drawing.selection.series === 0)
+ if(oChartSelection.series === 0)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = k;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = k;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = null;
}
}
else
{
- if(drawing.selection.chart === id && drawing.selection.series === k)
+ if(oChartSelection.chart === id && oChartSelection.series === k)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = l;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = l;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = null;
}
}
break;
@@ -1047,23 +1056,23 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
bSeries = true;
if(bPie)
{
- if(drawing.selection.series === 0)
+ if(oChartSelection.series === 0)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = k;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = k;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.series = 0;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = 0;
+ oChartSelection.datPoint = null;
}
}
else
@@ -1071,10 +1080,10 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.plotArea = null;
- drawing.selection.chart = id;
- drawing.selection.series = k;
- drawing.selection.datPoint = null;
+ oChartSelection.plotArea = null;
+ oChartSelection.chart = id;
+ oChartSelection.series = k;
+ oChartSelection.datPoint = null;
}
break;
}
@@ -1107,8 +1116,8 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.upBars = chartModel.upDownBars.upBars ;
+ oChartSelection.chart = id;
+ oChartSelection.upBars = chartModel.upDownBars.upBars ;
break;
}
}
@@ -1124,8 +1133,8 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.downBars = chartModel.upDownBars.downBars;
+ oChartSelection.chart = id;
+ oChartSelection.downBars = chartModel.upDownBars.downBars;
break;
}
}
@@ -1141,8 +1150,8 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.hiLowLines = chartModel.hiLowLines;
+ oChartSelection.chart = id;
+ oChartSelection.hiLowLines = chartModel.hiLowLines;
break;
}
}
@@ -1155,8 +1164,8 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = id;
- drawing.selection.hiLowLines = chartModel.hiLowLines;
+ oChartSelection.chart = id;
+ oChartSelection.hiLowLines = chartModel.hiLowLines;
break;
}
}
@@ -1170,11 +1179,11 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
}
else
{
- for(var i = t.chart.sortZIndexPaths.length - 1; i > -1; i--) {
- var oPathsObject = t.chart.sortZIndexPaths[i];
- if(AscFormat.isRealNumber(t.chart.sortZIndexPaths[i].paths))
+ for(var i = oChartDrawer.chart.sortZIndexPaths.length - 1; i > -1; i--) {
+ var oPathsObject = oChartDrawer.chart.sortZIndexPaths[i];
+ if(AscFormat.isRealNumber(oChartDrawer.chart.sortZIndexPaths[i].paths))
{
- var oPath = drawing.pathMemory.GetPath(t.chart.sortZIndexPaths[i].paths);
+ var oPath = drawing.pathMemory.GetPath(oChartDrawer.chart.sortZIndexPaths[i].paths);
if(oPath.hitInInnerArea(oCanvas, dTx, dTy) || oPath.hitInPath(oCanvas, dTx, dTy)) {
bSeries = true;
}
@@ -1182,16 +1191,16 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
else
{
- if(!bSeries && AscFormat.isRealNumber(t.chart.sortZIndexPaths[i].frontPaths))
+ if(!bSeries && AscFormat.isRealNumber(oChartDrawer.chart.sortZIndexPaths[i].frontPaths))
{
- var oPath = drawing.pathMemory.GetPath(t.chart.sortZIndexPaths[i].frontPaths);
+ var oPath = drawing.pathMemory.GetPath(oChartDrawer.chart.sortZIndexPaths[i].frontPaths);
if(oPath.hitInInnerArea(oCanvas, dTx, dTy) || oPath.hitInPath(oCanvas, dTx, dTy)) {
bSeries = true;
}
}
- if(!bSeries && AscFormat.isRealNumber(t.chart.sortZIndexPaths[i].darkPaths))
+ if(!bSeries && AscFormat.isRealNumber(oChartDrawer.chart.sortZIndexPaths[i].darkPaths))
{
- var oPath = drawing.pathMemory.GetPath(t.chart.sortZIndexPaths[i].darkPaths);
+ var oPath = drawing.pathMemory.GetPath(oChartDrawer.chart.sortZIndexPaths[i].darkPaths);
if(oPath.hitInInnerArea(oCanvas, dTx, dTy) || oPath.hitInPath(oCanvas, dTx, dTy)) {
bSeries = true;
}
@@ -1199,23 +1208,23 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
}
if(bSeries)
{
- if(drawing.selection.chart === t.chart.chart.Id && drawing.selection.series === t.chart.sortZIndexPaths[i].seria)
+ if(oChartSelection.chart === oChartDrawer.chart.chart.Id && oChartSelection.series === oChartDrawer.chart.sortZIndexPaths[i].seria)
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = t.chart.chart.Id;
- drawing.selection.series = t.chart.sortZIndexPaths[i].seria;
- drawing.selection.datPoint = t.chart.sortZIndexPaths[i].point;
+ oChartSelection.chart = oChartDrawer.chart.chart.Id;
+ oChartSelection.series = oChartDrawer.chart.sortZIndexPaths[i].seria;
+ oChartSelection.datPoint = oChartDrawer.chart.sortZIndexPaths[i].point;
}
else
{
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.chart = t.chart.chart.Id;
- drawing.selection.series = t.chart.sortZIndexPaths[i].seria;
- drawing.selection.datPoint = null;
+ oChartSelection.chart = oChartDrawer.chart.chart.Id;
+ oChartSelection.series = oChartDrawer.chart.sortZIndexPaths[i].seria;
+ oChartSelection.datPoint = null;
}
break;
}
@@ -1225,11 +1234,11 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
if(!bSeries)
{
j = 0;
- if(Array.isArray(t.axesChart))
+ if(Array.isArray(oChartDrawer.axesChart))
{
- for(j = 0; j < t.axesChart.length; ++j)
+ for(j = 0; j < oChartDrawer.axesChart.length; ++j)
{
- var oAxObj = t.axesChart[j];
+ var oAxObj = oChartDrawer.axesChart[j];
if(oAxObj && oAxObj.paths)
{
if(oAxObj.axis && oAxObj.axis.compiledMajorGridLines && oAxObj.axis.compiledMajorGridLines.isVisible()
@@ -1242,8 +1251,8 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.axis = oAxObj.axis;
- drawing.selection.majorGridlines = true;
+ oChartSelection.axis = oAxObj.axis;
+ oChartSelection.majorGridlines = true;
break;
}
}
@@ -1257,8 +1266,8 @@ function handleChartElements(drawing, drawingObjectsController, e, dTx, dTy, gro
selector.resetSelection();
selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing;
- drawing.selection.axis = oAxObj.axis;
- drawing.selection.minorGridlines = true;
+ oChartSelection.axis = oAxObj.axis;
+ oChartSelection.minorGridlines = true;
break;
}
}
diff --git a/common/Drawings/DrawingsChanges.js b/common/Drawings/DrawingsChanges.js
index 6298695fce..107b97bd68 100644
--- a/common/Drawings/DrawingsChanges.js
+++ b/common/Drawings/DrawingsChanges.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -158,8 +158,8 @@
function CChangesDrawingsDouble2(Class, Type, OldPr, NewPr) {
this.Type = Type;
- var _OldPr = (AscFormat.isRealNumber(OldPr) || isNaN(OldPr)) ? OldPr : undefined;
- var _NewPr = (AscFormat.isRealNumber(NewPr) || isNaN(NewPr)) ? NewPr : undefined;
+ var _OldPr = typeof OldPr === "number" ? OldPr : undefined;
+ var _NewPr = typeof NewPr === "number" ? NewPr : undefined;
AscDFH.CChangesBaseDoubleProperty.call(this, Class, _OldPr, _NewPr);
}
diff --git a/common/Drawings/Externals.js b/common/Drawings/Externals.js
index 82fbc96c02..b5e2ca98a0 100644
--- a/common/Drawings/Externals.js
+++ b/common/Drawings/Externals.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -630,15 +630,15 @@
function checkAllFonts()
{
+ if (undefined === window["__fonts_files"] && window["native"] && window["native"]["GenerateAllFonts"])
+ window["native"]["GenerateAllFonts"]();
+
+ if (undefined === window["__fonts_files"])
+ return;
+
let g_font_files, g_font_infos;
var files = window["__fonts_files"];
- if (!files && window["native"] && window["native"]["GenerateAllFonts"])
- {
- // тогда должны быть глобальные переменные такие, без window
- window["native"]["GenerateAllFonts"]();
- files = window["__fonts_files"];
- }
let count_files = files ? files.length : 0;
g_font_files = new Array(count_files);
diff --git a/common/Drawings/Format/ChartEx.js b/common/Drawings/Format/ChartEx.js
new file mode 100644
index 0000000000..12d5ddf258
--- /dev/null
+++ b/common/Drawings/Format/ChartEx.js
@@ -0,0 +1,4548 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2023
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(/**
+ * @param {Window} window
+ * @param {undefined} undefined
+ */
+function (window, undefined) {
+
+ const drawingsChangesMap = window['AscDFH'].drawingsChangesMap;
+ const drawingContentChanges = window['AscDFH'].drawingContentChanges;
+
+ const CChangesDrawingsBool = AscDFH.CChangesDrawingsBool;
+ const CChangesDrawingsLong = AscDFH.CChangesDrawingsLong;
+ const CChangesDrawingsString = AscDFH.CChangesDrawingsString;
+ const CChangesDrawingsContent = AscDFH.CChangesDrawingsContent;
+ const CChangesDrawingsObject = AscDFH.CChangesDrawingsObject;
+ const CChangesDrawingsObjectNoId = AscDFH.CChangesDrawingsObjectNoId;
+ const CChangesDrawingsDouble2 = AscDFH.CChangesDrawingsDouble2;
+
+ // Address
+ drawingsChangesMap[AscDFH.historyitem_Address_SetAddress1] = function (oClass, value) {
+ oClass.address1 = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Address_SetCountryRegion] = function (oClass, value) {
+ oClass.countryRegion = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Address_SetAdminDistrict1] = function (oClass, value) {
+ oClass.adminDistrict1 = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Address_SetAdminDistrict2] = function (oClass, value) {
+ oClass.adminDistrict2 = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Address_SetPostalCode] = function (oClass, value) {
+ oClass.postalCode = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Address_SetLocality] = function (oClass, value) {
+ oClass.locality = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Address_SetISOCountryCode] = function (oClass, value) {
+ oClass.isoCountryCode = value;
+ };
+
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetAddress1] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetCountryRegion] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetAdminDistrict1] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetAdminDistrict2] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetPostalCode] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetLocality] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Address_SetISOCountryCode] = window['AscDFH'].CChangesDrawingsString;
+
+ const SERIES_LAYOUT_BOX_WHISKER = 0;
+ const SERIES_LAYOUT_CLUSTERED_COLUMN = 1;
+ const SERIES_LAYOUT_FUNNEL = 2;
+ const SERIES_LAYOUT_PARETO_LINE = 3;
+ const SERIES_LAYOUT_REGION_MAP = 4;
+ const SERIES_LAYOUT_SUNBURST = 5;
+ const SERIES_LAYOUT_TREEMAP = 6;
+ const SERIES_LAYOUT_WATERFALL = 7;
+
+ const DATA_LABEL_POS_BEST_FIT = 0;
+ const DATA_LABEL_POS_B = 1;
+ const DATA_LABEL_POS_CTR = 2;
+ const DATA_LABEL_POS_IN_BASE = 3;
+ const DATA_LABEL_POS_IN_END = 4;
+ const DATA_LABEL_POS_L = 5;
+ const DATA_LABEL_POS_OUT_END = 6;
+ const DATA_LABEL_POS_R = 7;
+ const DATA_LABEL_POS_T = 8;
+
+ const PARENT_LABEL_LAYOUT_NONE = 0;
+ const PARENT_LABEL_LAYOUT_BANNER = 1;
+ const PARENT_LABEL_LAYOUT_OVERLAPPING = 2;
+
+ const REGION_LABEL_LAYOUT_NONE = 0;
+ const REGION_LABEL_LAYOUT_BEST_FIT_ONLY = 1;
+ const REGION_LABEL_LAYOUT_SHOW_ALL = 2;
+
+ const INTERVAL_CLOSED_SIDE_L = 0;
+ const INTERVAL_CLOSED_SIDE_R = 1;
+
+ const AXIS_UNIT_HUNDREDS = 0;
+ const AXIS_UNIT_THOUSANDS = 1;
+ const AXIS_UNIT_TEN_THOUSANDS = 2;
+ const AXIS_UNIT_HUNDRED_THOUSANDS = 3;
+ const AXIS_UNIT_MILLIONS = 4;
+ const AXIS_UNIT_TEN_MILLIONS = 5;
+ const AXIS_UNIT_HUNDRED_MILLIONS = 6;
+ const AXIS_UNIT_BILLIONS = 7;
+ const AXIS_UNIT_TRILLIONS = 8;
+ const AXIS_UNIT_PERCENTAGE = 9;
+
+ const SIDE_POS_L = 0;
+ const SIDE_POS_T = 1;
+ const SIDE_POS_R = 2;
+ const SIDE_POS_B = 3;
+
+ const POS_ALIGN_MIN = 0;
+ const POS_ALIGN_CTR = 1;
+ const POS_ALIGN_MAX = 2;
+
+ const TICK_MARKS_TYPE_IN = 0;
+ const TICK_MARKS_TYPE_OUT = 1;
+ const TICK_MARKS_TYPE_CROSS = 2;
+ const TICK_MARKS_TYPE_NONE = 3;
+
+ const QUARTILE_METHOD_INCLUSIVE = 0;
+ const QUARTILE_METHOD_EXCLUSIVE = 1;
+
+ const STRING_DIMENSION_TYPE_CAT = 10;
+ const STRING_DIMENSION_TYPE_COLOR_STR = 11;
+
+ const NUMERIC_DIMENSION_TYPE_VAL = 0;
+ const NUMERIC_DIMENSION_TYPE_X = 1;
+ const NUMERIC_DIMENSION_TYPE_Y = 2;
+ const NUMERIC_DIMENSION_TYPE_SIZE = 3;
+ const NUMERIC_DIMENSION_TYPE_COLOR_VAL = 4;
+
+ const FORMULA_DIRECTION_COL = 0;
+ const FORMULA_DIRECTION_ROW = 1;
+
+// Import
+ const History = AscCommon.History;
+ const InitClass = AscFormat.InitClass;
+ const CBaseChartObject = AscFormat.CBaseChartObject;
+ const CAxisBase = AscFormat.CAxisBase;
+
+ function CAddress() {
+ CBaseChartObject.call(this);
+ this.address1 = null;
+ this.countryRegion = null;
+ this.adminDistrict1 = null;
+ this.adminDistrict2 = null;
+ this.postalCode = null;
+ this.locality = null;
+ this.isoCountryCode = null;
+ }
+
+ InitClass(CAddress, CBaseChartObject, AscDFH.historyitem_type_Address);
+
+ CAddress.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setAddress1(this.address1);
+ oCopy.setCountryRegion(this.countryRegion);
+ oCopy.setAdminDistrict1(this.adminDistrict1);
+ oCopy.setAdminDistrict2(this.adminDistrict2);
+ oCopy.setPostalCode(this.postalCode);
+ oCopy.setLocality(this.locality);
+ oCopy.setISOCountryCode(this.isoCountryCode);
+ };
+
+ CAddress.prototype.setAddress1 = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetAddress1, this.address1, pr));
+ this.address1 = pr;
+ };
+ CAddress.prototype.setCountryRegion = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetCountryRegion, this.countryRegion, pr));
+ this.countryRegion = pr;
+ };
+ CAddress.prototype.setAdminDistrict1 = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetAdminDistrict1, this.adminDistrict1, pr));
+ this.adminDistrict1 = pr;
+ };
+ CAddress.prototype.setAdminDistrict2 = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetAdminDistrict2, this.adminDistrict2, pr));
+ this.adminDistrict2 = pr;
+ };
+ CAddress.prototype.setPostalCode = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetPostalCode, this.postalCode, pr));
+ this.postalCode = pr;
+ };
+ CAddress.prototype.setLocality = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetLocality, this.locality, pr));
+ this.locality = pr;
+ };
+ CAddress.prototype.setISOCountryCode = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Address_SetISOCountryCode, this.isoCountryCode, pr));
+ this.isoCountryCode = pr;
+ };
+
+ drawingsChangesMap[AscDFH.historyitem_Axis_SetUnits] = function (oClass, value) {
+ oClass.units = value;
+ };
+
+ drawingsChangesMap[AscDFH.historyitem_Axis_SetTickLabels] = function (oClass, value) {
+ oClass.tickLabels = value;
+ };
+
+ drawingsChangesMap[AscDFH.historyitem_Axis_SetHidden] = function (oClass, value) {
+ oClass.hidden = value;
+ };
+
+ AscDFH.changesFactory[AscDFH.historyitem_Axis_SetUnits] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Axis_SetTickLabels] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_Axis_SetHidden] = window['AscDFH'].CChangesDrawingsBool;
+
+ function CAxis() {
+ CAxisBase.call(this);
+ this.units = null;
+ this.hidden = null;
+
+ this.majorTickMark = null;
+ this.minorTickMark = null;
+ }
+
+ InitClass(CAxis, CAxisBase, AscDFH.historyitem_type_Axis);
+
+ CAxis.prototype.fillObject = function (oCopy) {
+ CAxisBase.prototype.fillObject.call(this, oCopy);
+ if (this.units) {
+ oCopy.setUnits(this.units.createDuplicate());
+ }
+ oCopy.setTickLabels(this.tickLabels);
+ oCopy.setHidden(this.hidden);
+ };
+
+ // initialize the ax position, 0 is horizontal and 1 is vertical
+ CAxis.prototype.initializeAxPos = function (isVertAxis) {
+ const axPos = isVertAxis ? window['AscFormat'].AX_POS_L : window['AscFormat'].AX_POS_B;
+ CAxisBase.prototype.setAxPos.call(this, axPos);
+ }
+
+ CAxis.prototype.setUnits = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Axis_SetUnits, this.units, pr));
+ this.units = pr;
+ };
+
+ CAxis.prototype.getFormatCode = function () {
+ let oNumFmt = this.numFmt;
+ let sFormatCode = null;
+
+ if (oNumFmt) {
+ if (oNumFmt.sourceLinked) {
+ return this.getSourceFormatCode();
+ }
+ sFormatCode = oNumFmt.formatCode;
+ if (typeof sFormatCode === "string" && sFormatCode.length > 0) {
+ return sFormatCode;
+ }
+ }
+ return "General";
+ };
+ CAxis.prototype.setTickLabels = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_Axis_SetTickLabels, this.tickLabels, pr));
+ this.tickLabels = pr;
+ };
+ CAxis.prototype.setHidden = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_Axis_SetHidden, this.hidden, pr));
+ this.hidden = pr;
+ };
+ CAxis.prototype.isValuesAxis = function () {
+ return (this.scaling instanceof CValueAxisScaling);
+ };
+ CAxis.prototype.isChartExCat = function() {
+ return (this.scaling instanceof CCategoryAxisScaling);
+ };
+ CAxis.prototype.isChartEx = function() {
+ return true;
+ };
+
+ CAxis.prototype.isHorizontal = function() {
+ return !this.isVertical();
+ };
+ CAxis.prototype.isVertical = function() {
+ if(this.isChartExCat()) {
+ let oChartSpace = this.getChartSpace();
+ if(oChartSpace) {
+ let aSeries = oChartSpace.getAllSeries();
+ let oFirstSeries = aSeries[0];
+ if(oFirstSeries && oFirstSeries.layoutId === AscFormat.SERIES_LAYOUT_FUNNEL) {
+ return true;
+ }
+ }
+ }
+ return this.isValuesAxis();
+ };
+
+ // AxisUnits
+ drawingsChangesMap[AscDFH.historyitem_AxisUnits_SetUnitsLabel] = function (oClass, value) {
+ oClass.unitsLabel = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_AxisUnits_SetUnit] = function (oClass, value) {
+ oClass.unit = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_AxisUnits_SetUnitsLabel] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_AxisUnits_SetUnit] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CAxisUnits() {
+ CBaseChartObject.call(this);
+ this.unitsLabel = null;
+ this.unit = null;
+ }
+
+ InitClass(CAxisUnits, CBaseChartObject, AscDFH.historyitem_type_AxisUnits);
+
+ CAxisUnits.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.unitsLabel) {
+ oCopy.setUnitsLabel(this.unitsLabel.createDuplicate());
+ }
+ oCopy.setUnit(this.unit);
+ };
+ CAxisUnits.prototype.setUnitsLabel = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_AxisUnits_SetUnitsLabel, this.unitsLabel, pr));
+ this.unitsLabel = pr;
+ this.setParentToChild(pr);
+ };
+ CAxisUnits.prototype.setUnit = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_AxisUnits_SetUnit, this.unit, pr));
+ this.unit = pr;
+ };
+
+ // AxisUnitsLabel
+ drawingsChangesMap[AscDFH.historyitem_AxisUnitsLabel_SetTx] = function (oClass, value) {
+ oClass.tx = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_AxisUnitsLabel_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_AxisUnitsLabel_SetTxPr] = function (oClass, value) {
+ oClass.txPr = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_AxisUnitsLabel_SetTx] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_AxisUnitsLabel_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_AxisUnitsLabel_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CAxisUnitsLabel() {
+ CBaseChartObject.call(this);
+ this.tx = null;
+ this.spPr = null;
+ this.txPr = null;
+ }
+
+ InitClass(CAxisUnitsLabel, CBaseChartObject, AscDFH.historyitem_type_AxisUnitsLabel);
+
+ CAxisUnitsLabel.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.tx) {
+ oCopy.setTx(this.tx.createDuplicate());
+ }
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ if (this.txPr) {
+ oCopy.setTxPr(this.txPr.createDuplicate());
+ }
+ };
+
+ CAxisUnitsLabel.prototype.setTx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_AxisUnitsLabel_SetTx, this.tx, pr));
+ this.tx = pr;
+ this.setParentToChild(pr);
+ };
+ CAxisUnitsLabel.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_AxisUnitsLabel_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+ CAxisUnitsLabel.prototype.setTxPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_AxisUnitsLabel_SetTxPr, this.txPr, pr));
+ this.txPr = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // Binning
+ drawingsChangesMap[AscDFH.historyitem_Binning_SetBinSize] = function (oClass, value) {
+ oClass.binSize = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Binning_SetBinCount] = function (oClass, value) {
+ oClass.binCount = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Binning_SetIntervalClosed] = function (oClass, value) {
+ oClass.intervalClosed = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Binning_SetUnderflow] = function (oClass, value) {
+ oClass.underflow = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Binning_SetOverflow] = function (oClass, value) {
+ oClass.overflow = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Binning_SetBinSize] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_Binning_SetBinCount] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Binning_SetIntervalClosed] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Binning_SetUnderflow] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_Binning_SetOverflow] = window['AscDFH'].CChangesDrawingsDouble2;
+
+ function CBinning() {
+ CBaseChartObject.call(this);
+ this.binSize = null;
+ this.binCount = null;
+ this.intervalClosed = null;
+ this.underflow = null;
+ this.overflow = null;
+ }
+
+ InitClass(CBinning, CBaseChartObject, AscDFH.historyitem_type_Binning);
+
+ CBinning.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setBinSize(this.binSize);
+ oCopy.setBinCount(this.binCount);
+ oCopy.setIntervalClosed(this.intervalClosed);
+ oCopy.setUnderflow(this.underflow);
+ oCopy.setOverflow(this.overflow);
+ };
+
+ CBinning.prototype.setBinSize = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_Binning_SetBinSize, this.binSize, pr));
+ this.binSize = pr;
+ };
+ CBinning.prototype.setBinCount = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Binning_SetBinCount, this.binCount, pr));
+ this.binCount = pr;
+ };
+ CBinning.prototype.setIntervalClosed = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Binning_SetIntervalClosed, this.intervalClosed, pr));
+ this.intervalClosed = pr;
+ };
+ CBinning.prototype.setUnderflow = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_Binning_SetUnderflow, this.underflow, pr));
+ this.underflow = pr;
+ };
+ CBinning.prototype.setOverflow = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_Binning_SetOverflow, this.overflow, pr));
+ this.overflow = pr;
+ };
+
+
+ // CategoryAxisScaling
+ drawingsChangesMap[AscDFH.historyitem_CategoryAxisScaling_SetGapWidth] = function (oClass, value) {
+ oClass.gapWidth = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_CategoryAxisScaling_SetGapWidth] = window['AscDFH'].CChangesDrawingsDouble2;
+
+ function CCategoryAxisScaling() {
+ CBaseChartObject.call(this);
+ this.gapWidth = null;
+ }
+
+ InitClass(CCategoryAxisScaling, CBaseChartObject, AscDFH.historyitem_type_CategoryAxisScaling);
+
+ CCategoryAxisScaling.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setGapWidth(this.gapWidth);
+ };
+
+ CCategoryAxisScaling.prototype.setGapWidth = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_CategoryAxisScaling_SetGapWidth, this.gapWidth, pr));
+ this.gapWidth = pr;
+
+ };
+
+
+
+ // ChartData
+ drawingsChangesMap[AscDFH.historyitem_ChartData_SetExternalData] = function (oClass, value) {
+ oClass.externalData = value;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_ChartData_AddData] =
+ drawingContentChanges[AscDFH.historyitem_ChartData_RemoveData] = function (oClass) {
+ return oClass.data;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_ChartData_SetExternalData] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ChartData_AddData] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_ChartData_RemoveData] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CChartData() {
+ CBaseChartObject.call(this);
+ this.externalData = null;
+ this.data = [];
+ }
+
+ InitClass(CChartData, CBaseChartObject, AscDFH.historyitem_type_ChartData);
+
+ CChartData.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.externalData) {
+ oCopy.setExternalData(this.externalData.createDuplicate());
+ }
+ if (this.data) {
+ for (let i = 0; i < this.data.length; i++) {
+ oCopy.addData(this.data[i].createDuplicate(), i);
+ }
+ }
+ };
+
+ CChartData.prototype.setExternalData = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartData_SetExternalData, this.externalData, pr));
+ this.externalData = pr;
+ this.setParentToChild(pr);
+ };
+ CChartData.prototype.addData = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.data.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_ChartData_AddData, pos, [pr], true));
+ this.data.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CChartData.prototype.removeDataByPos = function (pos) {
+ if (this.data[pos]) {
+ let data = this.data.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_ChartData_RemoveData, pos, [data], false));
+ }
+ };
+ CChartData.prototype.updateReferences = function (bDisplayEmptyCellsAs, bDisplayHidden) {
+ for (let nData = 0; nData < this.data.length; ++nData) {
+ this.data[nData].updateReferences(bDisplayEmptyCellsAs, bDisplayHidden);
+ }
+ };
+ CChartData.prototype.getData = function (id) {
+ for (let nData = 0; nData < this.data.length; ++nData) {
+ let oData = this.data[nData];
+ if (oData.id === id) {
+ return oData;
+ }
+ }
+ return null;
+ };
+
+ // Clear (no in ChartSerializeEx.h)
+ drawingsChangesMap[AscDFH.historyitem_Clear_SetGeoLocationQueryResults] = function (oClass, value) {
+ oClass.geoLocationQueryResults = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Clear_SetGeoDataEntityQueryResults] = function (oClass, value) {
+ oClass.geoDataEntityQueryResults = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Clear_SetGeoDataPointToEntityQueryResults] = function (oClass, value) {
+ oClass.geoDataPointToEntityQueryResults = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Clear_SetGeoChildEntitiesQueryResults] = function (oClass, value) {
+ oClass.geoChildEntitiesQueryResults = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Clear_SetGeoLocationQueryResults] = window['AscDFH'].CChangesDrawingsObjectNoId;
+ AscDFH.changesFactory[AscDFH.historyitem_Clear_SetGeoDataEntityQueryResults] = window['AscDFH'].CChangesDrawingsObjectNoId;
+ AscDFH.changesFactory[AscDFH.historyitem_Clear_SetGeoDataPointToEntityQueryResults] = window['AscDFH'].CChangesDrawingsObjectNoId;
+ AscDFH.changesFactory[AscDFH.historyitem_Clear_SetGeoChildEntitiesQueryResults] = window['AscDFH'].CChangesDrawingsObjectNoId;
+
+ function CClear() {
+ CBaseChartObject.call(this);
+ this.geoLocationQueryResults = null;
+ this.geoDataEntityQueryResults = null;
+ this.geoDataPointToEntityQueryResults = null;
+ this.geoChildEntitiesQueryResults = null;
+ }
+
+ InitClass(CClear, CBaseChartObject, AscDFH.historyitem_type_Clear);
+
+ CClear.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoLocationQueryResults) {
+ oCopy.setGeoLocationQueryResults(this.geoLocationQueryResults.createDuplicate());
+ }
+ if (this.geoDataEntityQueryResults) {
+ oCopy.setGeoDataEntityQueryResults(this.geoDataEntityQueryResults.createDuplicate());
+ }
+ if (this.geoDataPointToEntityQueryResults) {
+ oCopy.setGeoDataPointToEntityQueryResults(this.geoDataPointToEntityQueryResults.createDuplicate());
+ }
+ if (this.geoChildEntitiesQueryResults) {
+ oCopy.setGeoChildEntitiesQueryResults(this.geoChildEntitiesQueryResults.createDuplicate());
+ }
+ };
+
+ CClear.prototype.setGeoLocationQueryResults = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_Clear_SetGeoLocationQueryResults, this.geoLocationQueryResults, pr));
+ this.geoLocationQueryResults = pr;
+ this.setParentToChild(pr);
+ };
+ CClear.prototype.setGeoDataEntityQueryResults = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_Clear_SetGeoDataEntityQueryResults, this.geoDataEntityQueryResults, pr));
+ this.geoDataEntityQueryResults = pr;
+ this.setParentToChild(pr);
+ };
+ CClear.prototype.setGeoDataPointToEntityQueryResults = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_Clear_SetGeoDataPointToEntityQueryResults, this.geoDataPointToEntityQueryResults, pr));
+ this.geoDataPointToEntityQueryResults = pr;
+ this.setParentToChild(pr);
+ };
+ CClear.prototype.setGeoChildEntitiesQueryResults = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Clear_SetGeoChildEntitiesQueryResults, this.geoChildEntitiesQueryResults, pr));
+ this.geoChildEntitiesQueryResults = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ drawingsChangesMap[AscDFH.historyitem_Copyrights_SetCopyright] = function (oClass, value) {
+ oClass.copyright = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Copyrights_SetCopyright] = window['AscDFH'].CChangesDrawingsString;
+
+ function CCopyrights() {
+ CBaseChartObject.call(this);
+ this.copyright = null;
+ }
+
+ InitClass(CCopyrights, CBaseChartObject, AscDFH.historyitem_type_Copyrights);
+
+ CCopyrights.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setCopyright(this.copyright);
+ };
+
+ CCopyrights.prototype.setCopyright = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Copyrights_SetCopyright, this.copyright, pr));
+ this.copyright = pr;
+ };
+
+
+ // Data
+
+ drawingsChangesMap[AscDFH.historyitem_Data_SetId] = function (oClass, value) {
+ oClass.id = value;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_Data_AddDimension] =
+ drawingContentChanges[AscDFH.historyitem_Data_RemoveDimension] = function (oClass) {
+ return oClass.dimension;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Data_SetId] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Data_AddDimension] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_Data_RemoveDimension] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CData() {
+ CBaseChartObject.call(this);
+ // field dimension instead of numDim,strDim (ChartSerializeEx.h)
+ // this.numDim = null;
+ // this.strDim = null;
+ this.dimension = [];
+ this.id = null;
+ }
+
+ InitClass(CData, CBaseChartObject, AscDFH.historyitem_type_Data);
+
+ CData.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.dimension) {
+ for (let i = 0; i < this.dimension.length; i++) {
+ oCopy.addDimension(this.dimension[i].createDuplicate(), i);
+ }
+ }
+ oCopy.setId(this.id);
+ };
+
+ CData.prototype.addDimension = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.dimension.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_Data_AddDimension, pos, [pr], true));
+ this.dimension.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CData.prototype.removeDimensionByPos = function (pos) {
+ if (this.dimension[pos]) {
+ let dimension = this.dimension.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_Data_RemoveDimension, pos, [dimension], false));
+ }
+ };
+ CData.prototype.setId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Data_SetId, this.id, pr));
+ this.id = pr;
+ };
+ CData.prototype.updateReferences = function (bDisplayEmptyCellsAs, bDisplayHidden) {
+ for (let nDim = 0; nDim < this.dimension.length; ++nDim) {
+ this.dimension[nDim].updateReferences(bDisplayEmptyCellsAs, bDisplayHidden)
+ }
+ };
+ CData.prototype.getValDimensions = function () {
+ let aRes = [];
+ for (let nDim = 0; nDim < this.dimension.length; ++nDim) {
+ let oDim = this.dimension[nDim];
+ if ((oDim instanceof CNumericDimension) && oDim.type === AscFormat.NUMERIC_DIMENSION_TYPE_VAL) {
+ aRes.push(oDim);
+ }
+ }
+ return aRes;
+ };
+ CData.prototype.getCatDimensions = function () {
+ let aRes = [];
+ for (let nDim = 0; nDim < this.dimension.length; ++nDim) {
+ let oDim = this.dimension[nDim];
+ if ((oDim instanceof CStringDimension) && oDim.type === AscFormat.STRING_DIMENSION_TYPE_CAT) {
+ aRes.push(oDim);
+ }
+ }
+ return aRes;
+ };
+
+
+ // // DataId (int field instead class in ChartSerializeEx.h)
+ // drawingsChangesMap[AscDFH.historyitem_DataId_SetVal] = function (oClass, value) {
+ // oClass.val = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_DataId_SetVal] = window['AscDFH'].CChangesDrawingsString;
+ // function CDataId() {
+ // CBaseChartObject.call(this);
+ // this.val = null;
+ // }
+
+ // InitClass(CDataId, CBaseChartObject, AscDFH.historyitem_type_DataId);
+
+ // CDataId.prototype.setVal = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_DataId_SetVal, this.val, pr));
+ // this.val = pr;
+ // };
+ //
+
+ // DataLabel
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetNumFmt] = function (oClass, value) {
+ oClass.numFmt = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetTxPr] = function (oClass, value) {
+ oClass.txPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetVisibility] = function (oClass, value) {
+ oClass.visibility = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetSeparator] = function (oClass, value) {
+ oClass.separator = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetIdx] = function (oClass, value) {
+ oClass.idx = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabel_SetPos] = function (oClass, value) {
+ oClass.pos = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetNumFmt] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetVisibility] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetSeparator] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabel_SetPos] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CDataLabel() {
+ CBaseChartObject.call(this);
+ this.numFmt = null;
+ this.spPr = null;
+ this.txPr = null;
+ this.visibility = null;
+ this.separator = null;
+ this.idx = null;
+ this.pos = null;
+ }
+
+ InitClass(CDataLabel, CBaseChartObject, AscDFH.historyitem_type_DataLabel);
+
+ CDataLabel.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.numFmt) {
+ oCopy.setNumFmt(this.numFmt.createDuplicate());
+ }
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ if (this.txPr) {
+ oCopy.setTxPr(this.txPr.createDuplicate());
+ }
+ if (this.visibility) {
+ oCopy.setVisibility(this.visibility.createDuplicate());
+ }
+ oCopy.setSeparator(this.separator);
+ oCopy.setPos(this.pos);
+ oCopy.setIdx(this.idx);
+ };
+
+ CDataLabel.prototype.setNumFmt = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabel_SetNumFmt, this.numFmt, pr));
+ this.numFmt = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabel.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabel_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabel.prototype.setTxPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabel_SetTxPr, this.txPr, pr));
+ this.txPr = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabel.prototype.setVisibility = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabel_SetVisibility, this.visibility, pr));
+ this.visibility = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabel.prototype.setSeparator = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_DataLabel_SetSeparator, this.separator, pr));
+ this.separator = pr;
+ };
+ CDataLabel.prototype.setIdx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DataLabel_SetIdx, this.idx, pr));
+ this.idx = pr;
+ };
+ CDataLabel.prototype.setPos = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DataLabel_SetPos, this.pos, pr));
+ this.pos = pr;
+ };
+
+
+ // DataLabelHidden
+ drawingsChangesMap[AscDFH.historyitem_DataLabelHidden_SetIdx] = function (oClass, value) {
+ oClass.idx = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabelHidden_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CDataLabelHidden() {
+ CBaseChartObject.call(this);
+ this.idx = null;
+ }
+
+ InitClass(CDataLabelHidden, CBaseChartObject, AscDFH.historyitem_type_DataLabelHidden);
+
+ CDataLabelHidden.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setIdx(this.idx);
+ };
+
+ CDataLabelHidden.prototype.setIdx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DataLabelHidden_SetIdx, this.idx, pr));
+ this.idx = pr;
+ };
+
+
+ // DataLabels
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetNumFmt] = function (oClass, value) {
+ oClass.numFmt = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetTxPr] = function (oClass, value) {
+ oClass.txPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetVisibility] = function (oClass, value) {
+ oClass.visibility = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetSeparator] = function (oClass, value) {
+ oClass.separator = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetDataLabel] = function (oClass, value) {
+ oClass.dataLabel = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabels_SetPos] = function (oClass, value) {
+ oClass.pos = value;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_DataLabels_AddDataLabel] =
+ drawingContentChanges[AscDFH.historyitem_DataLabels_RemoveDataLabel] = function (oClass) {
+ return oClass.dataLabel;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_DataLabels_AddDataLabelHidden] =
+ drawingContentChanges[AscDFH.historyitem_DataLabels_RemoveDataLabelHidden] = function (oClass) {
+ return oClass.dataLabelHidden;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetNumFmt] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetVisibility] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetSeparator] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetDataLabel] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_SetPos] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_AddDataLabel] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_RemoveDataLabel] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_AddDataLabelHidden] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabels_RemoveDataLabelHidden] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CDataLabels() {
+ CBaseChartObject.call(this);
+ this.numFmt = null;
+ this.spPr = null;
+ this.txPr = null;
+ this.visibility = null;
+ this.separator = null;
+ this.dataLabel = [];
+ this.dataLabelHidden = [];
+ this.pos = null;
+ }
+
+ InitClass(CDataLabels, CBaseChartObject, AscDFH.historyitem_type_DataLabels);
+
+ CDataLabels.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.numFmt) {
+ oCopy.setNumFmt(this.numFmt.createDuplicate());
+ }
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ if (this.txPr) {
+ oCopy.setTxPr(this.txPr.createDuplicate());
+ }
+ if (this.visibility) {
+ oCopy.setVisibility(this.visibility.createDuplicate());
+ }
+ if (this.dataLabel) {
+ for (let i = 0; i < this.dataLabel.length; i++) {
+ oCopy.addDataLabel(this.dataLabel[i].createDuplicate(), i);
+ }
+ }
+ if (this.dataLabelHidden) {
+ for (let i = 0; i < this.dataLabelHidden.length; i++) {
+ oCopy.addDataLabelHidden(this.dataLabelHidden[i].createDuplicate(), i);
+ }
+ }
+ oCopy.setPos(this.pos);
+ };
+
+ CDataLabels.prototype.setNumFmt = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabels_SetNumFmt, this.numFmt, pr));
+ this.numFmt = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabels_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.setTxPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabels_SetTxPr, this.txPr, pr));
+ this.txPr = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.setVisibility = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabels_SetVisibility, this.visibility, pr));
+ this.visibility = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.setSeparator = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_DataLabels_SetSeparator, this.separator, pr));
+ this.separator = pr;
+ };
+ CDataLabels.prototype.setDataLabel = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataLabels_SetDataLabel, this.dataLabel, pr));
+ this.dataLabel = pr;
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.addDataLabel = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.dataLabel.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_DataLabels_AddDataLabel, pos, [pr], true));
+ this.dataLabel.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.removeDataLabelByPos = function (pos) {
+ if (this.dataLabel[pos]) {
+ let dataLabel = this.dataLabel.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_DataLabels_RemoveDataLabel, pos, [dataLabel], false));
+ }
+ };
+ CDataLabels.prototype.addDataLabelHidden = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.dataLabelHidden.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_DataLabels_AddDataLabelHidden, pos, [pr], true));
+ this.dataLabelHidden.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CDataLabels.prototype.removeDataLabelHiddenByPos = function (pos) {
+ if (this.dataLabelHidden[pos]) {
+ let dataLabelHidden = this.dataLabelHidden.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_DataLabels_RemoveDataLabelHidden, pos, [dataLabelHidden], false));
+ }
+ };
+ CDataLabels.prototype.setPos = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DataLabels_SetPos, this.pos, pr));
+ this.pos = pr;
+ };
+
+
+ // DataLabelVisibilities
+ drawingsChangesMap[AscDFH.historyitem_DataLabelVisibilities_SetSeriesName] = function (oClass, value) {
+ oClass.seriesName = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabelVisibilities_SetCategoryName] = function (oClass, value) {
+ oClass.categoryName = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataLabelVisibilities_SetValue] = function (oClass, value) {
+ oClass.value = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabelVisibilities_SetSeriesName] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabelVisibilities_SetCategoryName] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_DataLabelVisibilities_SetValue] = window['AscDFH'].CChangesDrawingsBool;
+
+ function CDataLabelVisibilities() {
+ CBaseChartObject.call(this);
+ this.seriesName = null;
+ this.categoryName = null;
+ this.value = null;
+ }
+
+ InitClass(CDataLabelVisibilities, CBaseChartObject, AscDFH.historyitem_type_DataLabelVisibilities);
+
+ CDataLabelVisibilities.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setSeriesName(this.seriesName);
+ oCopy.setCategoryName(this.categoryName);
+ oCopy.setValue(this.value);
+ };
+
+ CDataLabelVisibilities.prototype.setSeriesName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DataLabelVisibilities_SetSeriesName, this.seriesName, pr));
+ this.seriesName = pr;
+ };
+ CDataLabelVisibilities.prototype.setCategoryName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DataLabelVisibilities_SetCategoryName, this.categoryName, pr));
+ this.categoryName = pr;
+ };
+ CDataLabelVisibilities.prototype.setValue = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DataLabelVisibilities_SetValue, this.value, pr));
+ this.value = pr;
+ };
+
+
+ // DataPoint
+ drawingsChangesMap[AscDFH.historyitem_DataPoint_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_DataPoint_SetIdx] = function (oClass, value) {
+ oClass.idx = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_DataPoint_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_DataPoint_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CDataPoint() {
+ CBaseChartObject.call(this);
+ this.spPr = null;
+ this.idx = null;
+ }
+
+ InitClass(CDataPoint, CBaseChartObject, AscDFH.historyitem_type_DataPoint);
+
+ CDataPoint.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ oCopy.setIdx(this.idx);
+ };
+
+ CDataPoint.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DataPoint_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+ CDataPoint.prototype.setIdx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DataPoint_SetIdx, this.idx, pr));
+ this.idx = pr;
+ };
+
+
+ // // Extension (Extensionlist is unused in ChartSerializeEx.h)
+ // drawingsChangesMap[AscDFH.historyitem_Extension_SetUri] = function (oClass, value) {
+ // oClass.uri = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_Extension_SetUri] = window['AscDFH'].CChangesDrawingsString;
+ // function CExtension() {
+ // CBaseChartObject.call(this);
+ // this.uri = null;
+ // }
+
+ // InitClass(CExtension, CBaseChartObject, AscDFH.historyitem_type_Extension);
+
+ // CExtension.prototype.setUri = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Extension_SetUri, this.uri, pr));
+ // this.uri = pr;
+ // };
+ //
+
+ // // ExtensionList (OOX::Drawing::COfficeArtExtensionList instead of CExtensionList)
+ // drawingsChangesMap[AscDFH.historyitem_ExtensionList_SetExt] = function (oClass, value) {
+ // oClass.ext = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_ExtensionList_SetExt] = window['AscDFH'].CChangesDrawingsString;
+ // function CExtensionList() {
+ // CBaseChartObject.call(this);
+ // this.ext = null;
+ // }
+
+ // InitClass(CExtensionList, CBaseChartObject, AscDFH.historyitem_type_ExtensionList);
+
+ // CExtensionList.prototype.setExt = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_ExtensionList_SetExt, this.ext, pr));
+ // this.ext = pr;
+ // };
+ //
+
+ // // ExternalData (contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_ExternalData_SetId] = function (oClass, value) {
+ // oClass.id = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ExternalData_SetAutoUpdate] = function (oClass, value) {
+ // oClass.autoUpdate = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_ExternalData_SetId] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_ExternalData_SetAutoUpdate] = window['AscDFH'].CChangesDrawingsBool;
+ // function CExternalData() {
+ // CBaseChartObject.call(this);
+ // this.id = null;
+ // this.autoUpdate = null;
+ // }
+
+ // InitClass(CExternalData, CBaseChartObject, AscDFH.historyitem_type_ExternalData);
+
+ // CExternalData.prototype.setId = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_ExternalData_SetId, this.id, pr));
+ // this.id = pr;
+ // };
+ // CExternalData.prototype.setAutoUpdate = function (pr) {
+ // History.CanAddChanges() && History.Add(CChangesDrawingsBool(this, AscDFH.historyitem_ExternalData_SetAutoUpdate, this.autoUpdate, pr));
+ // this.autoUpdate = pr;
+ // };
+ //
+
+ // FormatOverride (no in ChartSerializeEx.h)
+ drawingsChangesMap[AscDFH.historyitem_FormatOverride_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_FormatOverride_SetIdx] = function (oClass, value) {
+ oClass.idx = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_FormatOverride_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_FormatOverride_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CFormatOverride() {
+ CBaseChartObject.call(this);
+ this.spPr = null;
+ this.idx = null;
+ }
+
+ InitClass(CFormatOverride, CBaseChartObject, AscDFH.historyitem_type_FormatOverride);
+
+ CFormatOverride.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ oCopy.setIdx(this.idx);
+ };
+
+ CFormatOverride.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_FormatOverride_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+ CFormatOverride.prototype.setIdx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_FormatOverride_SetIdx, this.idx, pr));
+ this.idx = pr;
+ };
+
+
+ // FormatOverrides (no in ChartSerializeEx.h)
+ drawingsChangesMap[AscDFH.historyitem_FormatOverrides_SetFmtOvr] = function (oClass, value) {
+ oClass.fmtOvr = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_FormatOverrides_SetFmtOvr] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CFormatOverrides() {
+ CBaseChartObject.call(this);
+ this.fmtOvr = null;
+ }
+
+ InitClass(CFormatOverrides, CBaseChartObject, AscDFH.historyitem_type_FormatOverrides);
+
+ CFormatOverrides.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.fmtOvr) {
+ oCopy.setFmtOvr(this.fmtOvr.createDuplicate());
+ }
+ };
+
+ CFormatOverrides.prototype.setFmtOvr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_FormatOverrides_SetFmtOvr, this.fmtOvr, pr));
+ this.fmtOvr = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // Formula
+ drawingsChangesMap[AscDFH.historyitem_Formula_SetDir] = function (oClass, value) {
+ oClass.dir = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Formula_SetContent] = function (oClass, value) {
+ oClass.content = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Formula_SetDir] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Formula_SetContent] = window['AscDFH'].CChangesDrawingsString;
+
+ function CFormula() {
+ CBaseChartObject.call(this);
+ this.dir = null;
+ this.content = null;
+ }
+
+ InitClass(CFormula, CBaseChartObject, AscDFH.historyitem_type_Formula);
+
+ CFormula.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setDir(this.dir);
+ oCopy.setContent(this.content);
+ };
+
+ CFormula.prototype.setDir = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Formula_SetDir, this.dir, pr));
+ this.dir = pr;
+ };
+ CFormula.prototype.setContent = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Formula_SetContent, this.content, pr));
+ this.content = pr;
+ };
+
+
+ // GeoCache
+ drawingsChangesMap[AscDFH.historyitem_GeoCache_SetBinary] = function (oClass, value) {
+ oClass.binary = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoCache_SetClear] = function (oClass, value) {
+ oClass.clear = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoCache_SetProvider] = function (oClass, value) {
+ oClass.provider = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoCache_SetBinary] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoCache_SetClear] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoCache_SetProvider] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGeoCache() {
+ CBaseChartObject.call(this);
+ this.binary = null;
+ this.clear = null;
+ this.provider = null;
+ }
+
+ InitClass(CGeoCache, CBaseChartObject, AscDFH.historyitem_type_GeoCache);
+
+ CGeoCache.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.clear) {
+ oCopy.setClear(this.clear.createDuplicate());
+ }
+ oCopy.setBinary(this.binary);
+ oCopy.setProvider(this.provider);
+ };
+
+ CGeoCache.prototype.setBinary = function (pr) { // todo base64binary type
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoCache_SetBinary, this.binary, pr));
+ this.binary = pr;
+ };
+ CGeoCache.prototype.setClear = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoCache_SetClear, this.clear, pr));
+ this.clear = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoCache.prototype.setProvider = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoCache_SetProvider, this.provider, pr));
+ this.provider = pr;
+ };
+
+
+ // GeoChildEntities
+ drawingsChangesMap[AscDFH.historyitem_GeoChildEntities_SetGeoHierarchyEntity] = function (oClass, value) {
+ oClass.geoHierarchyEntity = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildEntities_SetGeoHierarchyEntity] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoChildEntities() {
+ CBaseChartObject.call(this);
+ this.geoHierarchyEntity = null;
+ }
+
+ InitClass(CGeoChildEntities, CBaseChartObject, AscDFH.historyitem_type_GeoChildEntities);
+
+ CGeoChildEntities.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoHierarchyEntity) {
+ oCopy.setGeoHierarchyEntity(this.geoHierarchyEntity.createDuplicate());
+ }
+ };
+
+ CGeoChildEntities.prototype.setGeoHierarchyEntity = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoChildEntities_SetGeoHierarchyEntity, this.geoHierarchyEntity, pr));
+ this.geoHierarchyEntity = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoChildEntitiesQuery
+ drawingsChangesMap[AscDFH.historyitem_GeoChildEntitiesQuery_SetGeoChildTypes] = function (oClass, value) {
+ oClass.geoChildTypes = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoChildEntitiesQuery_SetEntityId] = function (oClass, value) {
+ oClass.entityId = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildEntitiesQuery_SetGeoChildTypes] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildEntitiesQuery_SetEntityId] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGeoChildEntitiesQuery() {
+ CBaseChartObject.call(this);
+ this.geoChildTypes = null;
+ this.entityId = null;
+ }
+
+ InitClass(CGeoChildEntitiesQuery, CBaseChartObject, AscDFH.historyitem_type_GeoChildEntitiesQuery);
+
+ CGeoChildEntitiesQuery.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoChildTypes) {
+ oCopy.setGeoChildTypes(this.geoChildTypes.createDuplicate());
+ }
+ oCopy.setEntityId(this.entityId);
+ };
+
+ CGeoChildEntitiesQuery.prototype.setGeoChildTypes = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoChildEntitiesQuery_SetGeoChildTypes, this.geoChildTypes, pr));
+ this.geoChildTypes = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoChildEntitiesQuery.prototype.setEntityId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoChildEntitiesQuery_SetEntityId, this.entityId, pr));
+ this.entityId = pr;
+ };
+
+
+ // GeoChildEntitiesQueryResult
+ drawingsChangesMap[AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntitiesQuery] = function (oClass, value) {
+ oClass.geoChildEntitiesQuery = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntities] = function (oClass, value) {
+ oClass.geoChildEntities = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntitiesQuery] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntities] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoChildEntitiesQueryResult() {
+ CBaseChartObject.call(this);
+ this.geoChildEntitiesQuery = null;
+ this.geoChildEntities = null;
+ }
+
+ InitClass(CGeoChildEntitiesQueryResult, CBaseChartObject, AscDFH.historyitem_type_GeoChildEntitiesQueryResult);
+
+ CGeoChildEntitiesQueryResult.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoChildEntities) {
+ oCopy.setGeoChildEntities(this.geoChildEntities.createDuplicate());
+ }
+ if (this.geoChildEntitiesQuery) {
+ oCopy.setGeoChildEntitiesQuery(this.geoChildEntitiesQuery.createDuplicate());
+ }
+ };
+
+ CGeoChildEntitiesQueryResult.prototype.setGeoChildEntitiesQuery = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntitiesQuery, this.geoChildEntitiesQuery, pr));
+ this.geoChildEntitiesQuery = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoChildEntitiesQueryResult.prototype.setGeoChildEntities = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntities, this.geoChildEntities, pr));
+ this.geoChildEntities = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoChildEntitiesQueryResults
+ drawingsChangesMap[AscDFH.historyitem_GeoChildEntitiesQueryResults_SetGeoChildEntitiesQueryResult] = function (oClass, value) {
+ oClass.geoChildEntitiesQueryResult = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildEntitiesQueryResults_SetGeoChildEntitiesQueryResult] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoChildEntitiesQueryResults() {
+ CBaseChartObject.call(this);
+ this.geoChildEntitiesQueryResult = null;
+ }
+
+ InitClass(CGeoChildEntitiesQueryResults, CBaseChartObject, AscDFH.historyitem_type_GeoChildEntitiesQueryResults);
+
+ CGeoChildEntitiesQueryResults.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoChildEntitiesQueryResult) {
+ oCopy.setGeoChildEntitiesQueryResult(this.geoChildEntitiesQueryResult.createDuplicate());
+ }
+ };
+
+ CGeoChildEntitiesQueryResults.prototype.setGeoChildEntitiesQueryResult = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoChildEntitiesQueryResults_SetGeoChildEntitiesQueryResult, this.geoChildEntitiesQueryResult, pr));
+ this.geoChildEntitiesQueryResult = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoChildTypes
+ drawingsChangesMap[AscDFH.historyitem_GeoChildTypes_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoChildTypes_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoChildTypes() {
+ CBaseChartObject.call(this);
+ this.entityType = null;
+ }
+
+ InitClass(CGeoChildTypes, CBaseChartObject, AscDFH.historyitem_type_GeoChildTypes);
+
+ CGeoChildTypes.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setEntityType(this.entityType);
+ };
+
+ CGeoChildTypes.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoChildTypes_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoData
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetGeoPolygons] = function (oClass, value) {
+ oClass.geoPolygons = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetCopyrights] = function (oClass, value) {
+ oClass.copyrights = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetEntityName] = function (oClass, value) {
+ oClass.entityName = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetEntityId] = function (oClass, value) {
+ oClass.entityId = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetEast] = function (oClass, value) {
+ oClass.east = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetWest] = function (oClass, value) {
+ oClass.west = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetNorth] = function (oClass, value) {
+ oClass.north = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoData_SetSouth] = function (oClass, value) {
+ oClass.south = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetGeoPolygons] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetCopyrights] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetEntityName] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetEntityId] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetEast] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetWest] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetNorth] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoData_SetSouth] = window['AscDFH'].CChangesDrawingsDouble2;
+
+ function CGeoData() {
+ CBaseChartObject.call(this);
+ this.geoPolygons = null;
+ this.copyrights = null;
+ this.entityName = null;
+ this.entityId = null;
+ this.east = null;
+ this.west = null;
+ this.north = null;
+ this.south = null;
+ }
+
+ InitClass(CGeoData, CBaseChartObject, AscDFH.historyitem_type_GeoData);
+
+ CGeoData.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoPolygons) {
+ oCopy.setGeoPolygons(this.geoPolygons.createDuplicate());
+ }
+ if (this.setCopyrights) {
+ oCopy.setGeoChildEntitiesQuery(this.copyrights.createDuplicate());
+ }
+ oCopy.setEntityName(this.entityName);
+ oCopy.setEntityId(this.entityId);
+ oCopy.setEast(this.east);
+ oCopy.setWest(this.west);
+ oCopy.setNorth(this.north);
+ oCopy.setSouth(this.south);
+ };
+
+ CGeoData.prototype.setGeoPolygons = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoData_SetGeoPolygons, this.geoPolygons, pr));
+ this.geoPolygons = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoData.prototype.setCopyrights = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoData_SetCopyrights, this.copyrights, pr));
+ this.copyrights = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoData.prototype.setEntityName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoData_SetEntityName, this.entityName, pr));
+ this.entityName = pr;
+ };
+ CGeoData.prototype.setEntityId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoData_SetEntityId, this.entityId, pr));
+ this.entityId = pr;
+ };
+ CGeoData.prototype.setEast = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoData_SetEast, this.east, pr));
+ this.east = pr;
+ };
+ CGeoData.prototype.setWest = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoData_SetWest, this.west, pr));
+ this.west = pr;
+ };
+ CGeoData.prototype.setNorth = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoData_SetNorth, this.north, pr));
+ this.north = pr;
+ };
+ CGeoData.prototype.setSouth = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoData_SetSouth, this.south, pr));
+ this.south = pr;
+ };
+
+
+ // GeoDataEntityQuery
+ drawingsChangesMap[AscDFH.historyitem_GeoDataEntityQuery_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoDataEntityQuery_SetEntityId] = function (oClass, value) {
+ oClass.entityId = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataEntityQuery_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataEntityQuery_SetEntityId] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGeoDataEntityQuery() {
+ CBaseChartObject.call(this);
+ this.entityType = null;
+ this.entityId = null;
+ }
+
+ InitClass(CGeoDataEntityQuery, CBaseChartObject, AscDFH.historyitem_type_GeoDataEntityQuery);
+
+ CGeoDataEntityQuery.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setEntityType(this.entityType);
+ oCopy.setEntityId(this.entityId);
+ };
+
+ CGeoDataEntityQuery.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataEntityQuery_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoDataEntityQuery.prototype.setEntityId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoDataEntityQuery_SetEntityId, this.entityId, pr));
+ this.entityId = pr;
+ };
+
+
+ // GeoDataEntityQueryResult
+ drawingsChangesMap[AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoDataEntityQuery] = function (oClass, value) {
+ oClass.geoDataEntityQuery = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoData] = function (oClass, value) {
+ oClass.geoData = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoDataEntityQuery] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoData] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoDataEntityQueryResult() {
+ CBaseChartObject.call(this);
+ this.geoDataEntityQuery = null;
+ this.geoData = null;
+ }
+
+ InitClass(CGeoDataEntityQueryResult, CBaseChartObject, AscDFH.historyitem_type_GeoDataEntityQueryResult);
+
+ CGeoDataEntityQueryResult.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoDataEntityQuery) {
+ oCopy.setGeoDataEntityQuery(this.geoDataEntityQuery.createDuplicate());
+ }
+ if (this.geoData) {
+ oCopy.setGeoData(this.geoData.createDuplicate());
+ }
+ }
+
+ CGeoDataEntityQueryResult.prototype.setGeoDataEntityQuery = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoDataEntityQuery, this.geoDataEntityQuery, pr));
+ this.geoDataEntityQuery = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoDataEntityQueryResult.prototype.setGeoData = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoData, this.geoData, pr));
+ this.geoData = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoDataEntityQueryResults
+ drawingsChangesMap[AscDFH.historyitem_GeoDataEntityQueryResults_SetGeoDataEntityQueryResult] = function (oClass, value) {
+ oClass.geoDataEntityQueryResult = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataEntityQueryResults_SetGeoDataEntityQueryResult] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoDataEntityQueryResults() {
+ CBaseChartObject.call(this);
+ this.geoDataEntityQueryResult = null;
+ }
+
+ InitClass(CGeoDataEntityQueryResults, CBaseChartObject, AscDFH.historyitem_type_GeoDataEntityQueryResults);
+
+ CGeoDataEntityQueryResults.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoDataEntityQueryResult) {
+ oCopy.setGeoDataEntityQueryResult(this.geoDataEntityQueryResult.createDuplicate());
+ }
+ }
+
+ CGeoDataEntityQueryResults.prototype.setGeoDataEntityQueryResult = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataEntityQueryResults_SetGeoDataEntityQueryResult, this.geoDataEntityQueryResult, pr));
+ this.geoDataEntityQueryResult = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoDataPointQuery
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointQuery_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointQuery_SetLatitude] = function (oClass, value) {
+ oClass.latitude = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointQuery_SetLongitude] = function (oClass, value) {
+ oClass.longitude = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointQuery_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointQuery_SetLatitude] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointQuery_SetLongitude] = window['AscDFH'].CChangesDrawingsDouble2;
+
+ function CGeoDataPointQuery() {
+ CBaseChartObject.call(this);
+ this.entityType = null;
+ this.latitude = null;
+ this.longitude = null;
+ }
+
+ InitClass(CGeoDataPointQuery, CBaseChartObject, AscDFH.historyitem_type_GeoDataPointQuery);
+
+ CGeoDataPointQuery.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setEntityType(this.entityType);
+ oCopy.setLatitude(this.latitude);
+ oCopy.setLongitude(this.longitude);
+ }
+
+ CGeoDataPointQuery.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataPointQuery_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoDataPointQuery.prototype.setLatitude = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoDataPointQuery_SetLatitude, this.latitude, pr));
+ this.latitude = pr;
+ };
+ CGeoDataPointQuery.prototype.setLongitude = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoDataPointQuery_SetLongitude, this.longitude, pr));
+ this.longitude = pr;
+ };
+
+
+ // GeoDataPointToEntityQuery
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityId] = function (oClass, value) {
+ oClass.entityId = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityId] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGeoDataPointToEntityQuery() {
+ CBaseChartObject.call(this);
+ this.entityType = null;
+ this.entityId = null;
+ }
+
+ InitClass(CGeoDataPointToEntityQuery, CBaseChartObject, AscDFH.historyitem_type_GeoDataPointToEntityQuery);
+
+ CGeoDataPointToEntityQuery.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setEntityType(this.entityType);
+ oCopy.setEntityId(this.entityId);
+ }
+
+ CGeoDataPointToEntityQuery.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoDataPointToEntityQuery.prototype.setEntityId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityId, this.entityId, pr));
+ this.entityId = pr;
+ };
+
+
+ // GeoDataPointToEntityQueryResult
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointQuery] = function (oClass, value) {
+ oClass.geoDataPointQuery = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointToEntityQuery] = function (oClass, value) {
+ oClass.geoDataPointToEntityQuery = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointQuery] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointToEntityQuery] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoDataPointToEntityQueryResult() {
+ CBaseChartObject.call(this);
+ this.geoDataPointQuery = null;
+ this.geoDataPointToEntityQuery = null;
+ }
+
+ InitClass(CGeoDataPointToEntityQueryResult, CBaseChartObject, AscDFH.historyitem_type_GeoDataPointToEntityQueryResult);
+
+ CGeoDataPointToEntityQueryResult.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoDataPointQuery) {
+ oCopy.setGeoDataPointQuery(this.geoDataPointQuery.createDuplicate());
+ }
+ if (this.geoDataPointToEntityQuery) {
+ oCopy.setGeoDataPointToEntityQuery(this.geoDataPointToEntityQuery.createDuplicate());
+ }
+ }
+
+ CGeoDataPointToEntityQueryResult.prototype.setGeoDataPointQuery = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointQuery, this.geoDataPointQuery, pr));
+ this.geoDataPointQuery = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoDataPointToEntityQueryResult.prototype.setGeoDataPointToEntityQuery = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointToEntityQuery, this.geoDataPointToEntityQuery, pr));
+ this.geoDataPointToEntityQuery = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoDataPointToEntityQueryResults
+ drawingsChangesMap[AscDFH.historyitem_GeoDataPointToEntityQueryResults_SetGeoDataPointToEntityQueryResult] = function (oClass, value) {
+ oClass.geoDataPointToEntityQueryResult = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoDataPointToEntityQueryResults_SetGeoDataPointToEntityQueryResult] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoDataPointToEntityQueryResults() {
+ CBaseChartObject.call(this);
+ this.geoDataPointToEntityQueryResult = null;
+ }
+
+ InitClass(CGeoDataPointToEntityQueryResults, CBaseChartObject, AscDFH.historyitem_type_GeoDataPointToEntityQueryResults);
+
+ CGeoDataPointToEntityQueryResults.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoDataPointToEntityQueryResult) {
+ oCopy.setGeoDataPointToEntityQueryResult(this.geoDataPointToEntityQueryResult.createDuplicate());
+ }
+ }
+
+ CGeoDataPointToEntityQueryResults.prototype.setGeoDataPointToEntityQueryResult = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoDataPointToEntityQueryResults_SetGeoDataPointToEntityQueryResult, this.geoDataPointToEntityQueryResult, pr));
+ this.geoDataPointToEntityQueryResult = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // Geography
+ drawingsChangesMap[AscDFH.historyitem_Geography_SetGeoCache] = function (oClass, value) {
+ oClass.geoCache = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Geography_SetProjectionType] = function (oClass, value) {
+ oClass.projectionType = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Geography_SetViewedRegionType] = function (oClass, value) {
+ oClass.viewedRegionType = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Geography_SetCultureLanguage] = function (oClass, value) {
+ oClass.cultureLanguage = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Geography_SetCultureRegion] = function (oClass, value) {
+ oClass.cultureRegion = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Geography_SetAttribution] = function (oClass, value) {
+ oClass.attribution = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Geography_SetGeoCache] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Geography_SetProjectionType] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Geography_SetViewedRegionType] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Geography_SetCultureLanguage] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Geography_SetCultureRegion] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Geography_SetAttribution] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGeography() {
+ CBaseChartObject.call(this);
+ this.geoCache = null;
+ this.projectionType = null;
+ this.viewedRegionType = null;
+ this.cultureLanguage = null;
+ this.cultureRegion = null;
+ this.attribution = null;
+ }
+
+ InitClass(CGeography, CBaseChartObject, AscDFH.historyitem_type_Geography);
+
+ CGeography.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoCache) {
+ oCopy.setGeoCache(this.geoCache.createDuplicate());
+ }
+ oCopy.setProjectionType(this.projectionType);
+ oCopy.setViewedRegionType(this.viewedRegionType);
+ oCopy.setCultureLanguage(this.cultureLanguage);
+ oCopy.setCultureRegion(this.cultureRegion);
+ oCopy.setAttribution(this.attribution);
+ }
+
+ CGeography.prototype.setGeoCache = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Geography_SetGeoCache, this.geoCache, pr));
+ this.geoCache = pr;
+ this.setParentToChild(pr);
+ };
+ CGeography.prototype.setProjectionType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Geography_SetProjectionType, this.projectionType, pr));
+ this.projectionType = pr;
+ this.setParentToChild(pr);
+ };
+ CGeography.prototype.setViewedRegionType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Geography_SetViewedRegionType, this.viewedRegionType, pr));
+ this.viewedRegionType = pr;
+ this.setParentToChild(pr);
+ };
+ CGeography.prototype.setCultureLanguage = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Geography_SetCultureLanguage, this.cultureLanguage, pr));
+ this.cultureLanguage = pr;
+ };
+ CGeography.prototype.setCultureRegion = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Geography_SetCultureRegion, this.cultureRegion, pr));
+ this.cultureRegion = pr;
+ };
+ CGeography.prototype.setAttribution = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Geography_SetAttribution, this.attribution, pr));
+ this.attribution = pr;
+ };
+
+
+ // GeoHierarchyEntity
+ drawingsChangesMap[AscDFH.historyitem_GeoHierarchyEntity_SetEntityName] = function (oClass, value) {
+ oClass.entityName = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoHierarchyEntity_SetEntityId] = function (oClass, value) {
+ oClass.entityId = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoHierarchyEntity_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoHierarchyEntity_SetEntityName] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoHierarchyEntity_SetEntityId] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoHierarchyEntity_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoHierarchyEntity() {
+ CBaseChartObject.call(this);
+ this.entityName = null;
+ this.entityId = null;
+ this.entityType = null;
+ }
+
+ InitClass(CGeoHierarchyEntity, CBaseChartObject, AscDFH.historyitem_type_GeoHierarchyEntity);
+
+ CGeoHierarchyEntity.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setEntityName(this.entityName);
+ oCopy.setEntityId(this.entityId);
+ oCopy.setEntityType(this.entityType);
+ }
+
+ CGeoHierarchyEntity.prototype.setEntityName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoHierarchyEntity_SetEntityName, this.entityName, pr));
+ this.entityName = pr;
+ };
+ CGeoHierarchyEntity.prototype.setEntityId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoHierarchyEntity_SetEntityId, this.entityId, pr));
+ this.entityId = pr;
+ };
+ CGeoHierarchyEntity.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoHierarchyEntity_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoLocation
+ drawingsChangesMap[AscDFH.historyitem_GeoLocation_SetAddress] = function (oClass, value) {
+ oClass.address = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocation_SetLatitude] = function (oClass, value) {
+ oClass.latitude = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocation_SetLongitude] = function (oClass, value) {
+ oClass.longitude = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocation_SetEntityName] = function (oClass, value) {
+ oClass.entityName = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocation_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocation_SetAddress] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocation_SetLatitude] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocation_SetLongitude] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocation_SetEntityName] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocation_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoLocation() {
+ CBaseChartObject.call(this);
+ this.address = null;
+ this.latitude = null;
+ this.longitude = null;
+ this.entityName = null;
+ this.entityType = null;
+ }
+
+ InitClass(CGeoLocation, CBaseChartObject, AscDFH.historyitem_type_GeoLocation);
+
+ CGeoLocation.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.address) {
+ oCopy.setAddress(this.address.createDuplicate());
+ }
+ oCopy.setLatitude(this.latitude);
+ oCopy.setLongitude(this.longitude);
+ oCopy.setEntityName(this.entityName);
+ oCopy.setEntityType(this.entityType);
+ }
+
+ CGeoLocation.prototype.setAddress = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocation_SetAddress, this.address, pr));
+ this.address = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoLocation.prototype.setLatitude = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoLocation_SetLatitude, this.latitude, pr));
+ this.latitude = pr;
+ };
+ CGeoLocation.prototype.setLongitude = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_GeoLocation_SetLongitude, this.longitude, pr));
+ this.longitude = pr;
+ };
+ CGeoLocation.prototype.setEntityName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoLocation_SetEntityName, this.entityName, pr));
+ this.entityName = pr;
+ };
+ CGeoLocation.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocation_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoLocationQuery
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQuery_SetCountryRegion] = function (oClass, value) {
+ oClass.countryRegion = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict1] = function (oClass, value) {
+ oClass.adminDistrict1 = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict2] = function (oClass, value) {
+ oClass.adminDistrict2 = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQuery_SetPostalCode] = function (oClass, value) {
+ oClass.postalCode = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQuery_SetEntityType] = function (oClass, value) {
+ oClass.entityType = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQuery_SetCountryRegion] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict1] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict2] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQuery_SetPostalCode] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQuery_SetEntityType] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoLocationQuery() {
+ CBaseChartObject.call(this);
+ this.countryRegion = null;
+ this.adminDistrict1 = null;
+ this.adminDistrict2 = null;
+ this.postalCode = null;
+ this.entityType = null;
+ }
+
+ InitClass(CGeoLocationQuery, CBaseChartObject, AscDFH.historyitem_type_GeoLocationQuery);
+
+ CGeoLocationQuery.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setCountryRegion(this.countryRegion);
+ oCopy.setAdminDistrict1(this.adminDistrict1);
+ oCopy.setAdminDistrict2(this.adminDistrict2);
+ oCopy.setPostalCode(this.postalCode);
+ oCopy.setEntityType(this.entityType);
+ }
+
+ CGeoLocationQuery.prototype.setCountryRegion = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoLocationQuery_SetCountryRegion, this.countryRegion, pr));
+ this.countryRegion = pr;
+ };
+ CGeoLocationQuery.prototype.setAdminDistrict1 = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict1, this.adminDistrict1, pr));
+ this.adminDistrict1 = pr;
+ };
+ CGeoLocationQuery.prototype.setAdminDistrict2 = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict2, this.adminDistrict2, pr));
+ this.adminDistrict2 = pr;
+ };
+ CGeoLocationQuery.prototype.setPostalCode = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoLocationQuery_SetPostalCode, this.postalCode, pr));
+ this.postalCode = pr;
+ };
+ CGeoLocationQuery.prototype.setEntityType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocationQuery_SetEntityType, this.entityType, pr));
+ this.entityType = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoLocationQueryResult
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocationQuery] = function (oClass, value) {
+ oClass.geoLocationQuery = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocations] = function (oClass, value) {
+ oClass.geoLocations = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocationQuery] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocations] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoLocationQueryResult() {
+ CBaseChartObject.call(this);
+ this.geoLocationQuery = null;
+ this.geoLocations = null;
+ }
+
+ InitClass(CGeoLocationQueryResult, CBaseChartObject, AscDFH.historyitem_type_GeoLocationQueryResult);
+
+ CGeoLocationQueryResult.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoLocationQuery) {
+ oCopy.setGeoLocationQuery(this.geoLocationQuery.createDuplicate());
+ }
+ if (this.geoLocations) {
+ oCopy.setGeoLocations(this.geoLocations.createDuplicate());
+ }
+ }
+
+ CGeoLocationQueryResult.prototype.setGeoLocationQuery = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocationQuery, this.geoLocationQuery, pr));
+ this.geoLocationQuery = pr;
+ this.setParentToChild(pr);
+ };
+ CGeoLocationQueryResult.prototype.setGeoLocations = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocations, this.geoLocations, pr));
+ this.geoLocations = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoLocationQueryResults
+ drawingsChangesMap[AscDFH.historyitem_GeoLocationQueryResults_SetGeoLocationQueryResult] = function (oClass, value) {
+ oClass.geoLocationQueryResult = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocationQueryResults_SetGeoLocationQueryResult] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoLocationQueryResults() {
+ CBaseChartObject.call(this);
+ this.geoLocationQueryResult = null;
+ }
+
+ InitClass(CGeoLocationQueryResults, CBaseChartObject, AscDFH.historyitem_type_GeoLocationQueryResults);
+
+ CGeoLocationQueryResults.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoLocationQueryResult) {
+ oCopy.setGeoLocationQueryResult(this.geoLocationQueryResult.createDuplicate());
+ }
+ }
+
+ CGeoLocationQueryResults.prototype.setGeoLocationQueryResult = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocationQueryResults_SetGeoLocationQueryResult, this.geoLocationQueryResult, pr));
+ this.geoLocationQueryResult = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoLocations
+ drawingsChangesMap[AscDFH.historyitem_GeoLocations_SetGeoLocation] = function (oClass, value) {
+ oClass.geoLocation = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoLocations_SetGeoLocation] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoLocations() {
+ CBaseChartObject.call(this);
+ this.geoLocation = null;
+ }
+
+ InitClass(CGeoLocations, CBaseChartObject, AscDFH.historyitem_type_GeoLocations);
+
+ CGeoLocations.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoLocation) {
+ oCopy.setGeoLocation(this.geoLocation.createDuplicate());
+ }
+ }
+
+ CGeoLocations.prototype.setGeoLocation = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoLocations_SetGeoLocation, this.geoLocation, pr));
+ this.geoLocation = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // GeoPolygon
+ drawingsChangesMap[AscDFH.historyitem_GeoPolygon_SetPolygonId] = function (oClass, value) {
+ oClass.polygonId = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoPolygon_SetNumPoints] = function (oClass, value) {
+ oClass.numPoints = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_GeoPolygon_SetPcaRings] = function (oClass, value) {
+ oClass.pcaRings = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoPolygon_SetPolygonId] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoPolygon_SetNumPoints] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_GeoPolygon_SetPcaRings] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGeoPolygon() {
+ CBaseChartObject.call(this);
+ this.polygonId = null;
+ this.numPoints = null;
+ this.pcaRings = null;
+ }
+
+ InitClass(CGeoPolygon, CBaseChartObject, AscDFH.historyitem_type_GeoPolygon);
+
+ CGeoPolygon.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setPolygonId(this.polygonId);
+ oCopy.setNumPoints(this.numPoints);
+ oCopy.setPcaRings(this.pcaRings);
+ }
+
+
+ CGeoPolygon.prototype.setPolygonId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoPolygon_SetPolygonId, this.polygonId, pr));
+ this.polygonId = pr;
+ };
+ CGeoPolygon.prototype.setNumPoints = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_GeoPolygon_SetNumPoints, this.numPoints, pr));
+ this.numPoints = pr;
+ };
+ CGeoPolygon.prototype.setPcaRings = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_GeoPolygon_SetPcaRings, this.pcaRings, pr));
+ this.pcaRings = pr;
+ };
+
+
+ // GeoPolygons
+ drawingsChangesMap[AscDFH.historyitem_GeoPolygons_SetGeoPolygon] = function (oClass, value) {
+ oClass.geoPolygon = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_GeoPolygons_SetGeoPolygon] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CGeoPolygons() {
+ CBaseChartObject.call(this);
+ this.geoPolygon = null;
+ }
+
+ InitClass(CGeoPolygons, CBaseChartObject, AscDFH.historyitem_type_GeoPolygons);
+
+ CGeoPolygons.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.geoPolygon) {
+ oCopy.setGeoPolygon(this.geoPolygon.createDuplicate());
+ }
+ }
+
+ CGeoPolygons.prototype.setGeoPolygon = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_GeoPolygons_SetGeoPolygon, this.geoPolygon, pr));
+ this.geoPolygon = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // Gridlines
+ drawingsChangesMap[AscDFH.historyitem_Gridlines_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Gridlines_SetName] = function (oClass, value) {
+ oClass.name = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Gridlines_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Gridlines_SetName] = window['AscDFH'].CChangesDrawingsString;
+
+ function CGridlines() {
+ CBaseChartObject.call(this);
+ this.spPr = null;
+ this.name = null;
+ }
+
+ InitClass(CGridlines, CBaseChartObject, AscDFH.historyitem_type_Gridlines);
+
+ CGridlines.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ oCopy.setName(this.name);
+ }
+
+ CGridlines.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Gridlines_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+ CGridlines.prototype.setName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Gridlines_SetName, this.name, pr));
+ this.name = pr;
+ };
+
+
+ // // HeaderFooter (contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetOddHeader] = function (oClass, value) {
+ // oClass.oddHeader = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetOddFooter] = function (oClass, value) {
+ // oClass.oddFooter = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetEvenHeader] = function (oClass, value) {
+ // oClass.evenHeader = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetEvenFooter] = function (oClass, value) {
+ // oClass.evenFooter = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetFirstHeader] = function (oClass, value) {
+ // oClass.firstHeader = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetFirstFooter] = function (oClass, value) {
+ // oClass.firstFooter = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetAlignWithMargins] = function (oClass, value) {
+ // oClass.alignWithMargins = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetDifferentOddEven] = function (oClass, value) {
+ // oClass.differentOddEven = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_HeaderFooter_SetDifferentFirst] = function (oClass, value) {
+ // oClass.differentFirst = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetOddHeader] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetOddFooter] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetEvenHeader] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetEvenFooter] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetFirstHeader] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetFirstFooter] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetAlignWithMargins] = window['AscDFH'].CChangesDrawingsBool;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetDifferentOddEven] = window['AscDFH'].CChangesDrawingsBool;
+ // AscDFH.changesFactory[AscDFH.historyitem_HeaderFooter_SetDifferentFirst] = window['AscDFH'].CChangesDrawingsBool;
+ // function CHeaderFooter() {
+ // CBaseChartObject.call(this);
+ // this.oddHeader = null;
+ // this.oddFooter = null;
+ // this.evenHeader = null;
+ // this.evenFooter = null;
+ // this.firstHeader = null;
+ // this.firstFooter = null;
+ // this.alignWithMargins = null;
+ // this.differentOddEven = null;
+ // this.differentFirst = null;
+ // }
+
+ // InitClass(CHeaderFooter, CBaseChartObject, AscDFH.historyitem_type_HeaderFooter);
+
+ // CHeaderFooter.prototype.setOddHeader = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_HeaderFooter_SetOddHeader, this.oddHeader, pr));
+ // this.oddHeader = pr;
+ // };
+ // CHeaderFooter.prototype.setOddFooter = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_HeaderFooter_SetOddFooter, this.oddFooter, pr));
+ // this.oddFooter = pr;
+ // };
+ // CHeaderFooter.prototype.setEvenHeader = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_HeaderFooter_SetEvenHeader, this.evenHeader, pr));
+ // this.evenHeader = pr;
+ // };
+ // CHeaderFooter.prototype.setEvenFooter = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_HeaderFooter_SetEvenFooter, this.evenFooter, pr));
+ // this.evenFooter = pr;
+ // };
+ // CHeaderFooter.prototype.setFirstHeader = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_HeaderFooter_SetFirstHeader, this.firstHeader, pr));
+ // this.firstHeader = pr;
+ // };
+ // CHeaderFooter.prototype.setFirstFooter = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_HeaderFooter_SetFirstFooter, this.firstFooter, pr));
+ // this.firstFooter = pr;
+ // };
+ // CHeaderFooter.prototype.setAlignWithMargins = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_HeaderFooter_SetAlignWithMargins, this.alignWithMargins, pr));
+ // this.alignWithMargins = pr;
+ // };
+ // CHeaderFooter.prototype.setDifferentOddEven = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_HeaderFooter_SetDifferentOddEven, this.differentOddEven, pr));
+ // this.differentOddEven = pr;
+ // };
+ // CHeaderFooter.prototype.setDifferentFirst = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_HeaderFooter_SetDifferentFirst, this.differentFirst, pr));
+ // this.differentFirst = pr;
+ // };
+ //
+
+ // // ChartExLegend (Legend contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_ChartExLegend_SetSpPr] = function (oClass, value) {
+ // oClass.spPr = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ChartExLegend_SetTxPr] = function (oClass, value) {
+ // oClass.txPr = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ChartExLegend_SetPos] = function (oClass, value) {
+ // oClass.pos = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ChartExLegend_SetAlign] = function (oClass, value) {
+ // oClass.align = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ChartExLegend_SetOverlay] = function (oClass, value) {
+ // oClass.overlay = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExLegend_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExLegend_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExLegend_SetPos] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExLegend_SetAlign] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExLegend_SetOverlay] = window['AscDFH'].CChangesDrawingsBool;
+ // function CChartExLegend() {
+ // CBaseChartObject.call(this);
+ // this.spPr = null;
+ // this.txPr = null;
+ // this.pos = null;
+ // this.align = null;
+ // this.overlay = null;
+ // }
+
+ // InitClass(CChartExLegend, CBaseChartObject, AscDFH.historyitem_type_ChartExLegend);
+
+ // CChartExLegend.prototype.setSpPr = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExLegend_SetSpPr, this.spPr, pr));
+ // this.spPr = pr;
+ // };
+ // CChartExLegend.prototype.setTxPr = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExLegend_SetTxPr, this.txPr, pr));
+ // this.txPr = pr;
+ // };
+ // CChartExLegend.prototype.setPos = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExLegend_SetPos, this.pos, pr));
+ // this.pos = pr;
+ // };
+ // CChartExLegend.prototype.setAlign = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExLegend_SetAlign, this.align, pr));
+ // this.align = pr;
+ // };
+ // CChartExLegend.prototype.setOverlay = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_ChartExLegend_SetOverlay, this.overlay, pr));
+ // this.overlay = pr;
+ // };
+
+
+ // // NumberColorPosition (CNumericPoint replaces this class)
+ // drawingsChangesMap[AscDFH.historyitem_NumberColorPosition_SetVal] = function (oClass, value) {
+ // oClass.val = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_NumberColorPosition_SetVal] = window['AscDFH'].CChangesDrawingsDouble2;
+ // function CNumberColorPosition() {
+ // CBaseChartObject.call(this);
+ // this.val = null;
+ // }
+
+ // InitClass(CNumberColorPosition, CBaseChartObject, AscDFH.historyitem_type_NumberColorPosition);
+
+ // CNumberColorPosition.prototype.setVal = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_NumberColorPosition_SetVal, this.val, pr));
+ // this.val = pr;
+ // };
+ //
+
+ // // NumberFormat (CNumFmt contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_NumberFormat_SetFormatCode] = function (oClass, value) {
+ // oClass.formatCode = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_NumberFormat_SetSourceLinked] = function (oClass, value) {
+ // oClass.sourceLinked = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_NumberFormat_SetFormatCode] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_NumberFormat_SetSourceLinked] = window['AscDFH'].CChangesDrawingsBool;
+ // function CNumberFormat() {
+ // CBaseChartObject.call(this);
+ // this.formatCode = null;
+ // this.sourceLinked = null;
+ // }
+
+ // InitClass(CNumberFormat, CBaseChartObject, AscDFH.historyitem_type_NumberFormat);
+
+ // CNumberFormat.prototype.setFormatCode = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_NumberFormat_SetFormatCode, this.formatCode, pr));
+ // this.formatCode = pr;
+ // };
+ // CNumberFormat.prototype.setSourceLinked = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_NumberFormat_SetSourceLinked, this.sourceLinked, pr));
+ // this.sourceLinked = pr;
+ // };
+ //
+
+ // Dimension
+ drawingsChangesMap[AscDFH.historyitem_Dimension_SetF] = function (oClass, value) {
+ oClass.f = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Dimension_SetNf] = function (oClass, value) {
+ oClass.nf = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Dimension_SetType] = function (oClass, value) {
+ oClass.type = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Dimension_SetF] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Dimension_SetNf] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Dimension_SetType] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CDimension() {
+ AscFormat.CChartRefBase.call(this);
+ this.f = null;
+ this.nf = null;
+ this.type = null;
+ this.levelData = [];
+ }
+
+ InitClass(CDimension, AscFormat.CChartRefBase, AscDFH.historyitem_type_Dimension);
+
+ CDimension.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.f) {
+ oCopy.setF(this.f.createDuplicate());
+ }
+ if (this.nf) {
+ oCopy.setNf(this.nf);
+ }
+ oCopy.setType(this.type);
+ }
+
+ CDimension.prototype.setF = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Dimension_SetF, this.f, pr));
+ this.f = pr;
+ this.setParentToChild(pr);
+ };
+ CDimension.prototype.setNf = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Dimension_SetNf, this.nf, pr));
+ this.nf = pr;
+ };
+ CDimension.prototype.setType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Dimension_SetType, this.type, pr));
+ this.type = pr;
+ };
+ CDimension.prototype.createLvl = function () {
+ return null;
+ };
+ CDimension.prototype.fillCellVal = function (oCell, oLvl, nPtIdx) {
+ return null;
+ };
+ CDimension.prototype.clearLevelData = function () {
+ for(let nIdx = this.levelData.length; nIdx > -1; --nIdx) {
+ this.removeLevelDataByPos(nIdx)
+ }
+ };
+ CDimension.prototype.removeLevelDataByPos = function (nIdx) {
+ };
+ CDimension.prototype.updateReferences = function (bDisplayEmptyCellsAs, bDisplayHidden) {
+
+ this.clearLevelData();
+ if (!this.f) {
+ return;
+ }
+ let sContent = this.f.content;
+
+ let aParsedRef = AscFormat.fParseChartFormula(sContent);
+ if (!Array.isArray(aParsedRef) || aParsedRef.length === 0) {
+ return false;
+ }
+ let nPtCount = 0;
+ if (aParsedRef.length > 0) {
+ let nRows = 0, nRef, oRef, oBBox, nPtIdx, nCol, oWS, oCell, sVal, nCols = 0, nRow;
+ let nLvl, oLvl;
+ let bLvlsByRows;
+ if (this.f.dir === AscFormat.FORMULA_DIRECTION_ROW) {
+ bLvlsByRows = true;
+ }
+ else {
+ bLvlsByRows = false;
+ }
+
+ if (bLvlsByRows) {
+ for (nRef = 0; nRef < aParsedRef.length; ++nRef) {
+ oRef = aParsedRef[nRef];
+ oBBox = oRef.bbox;
+ nPtCount += (oBBox.c2 - oBBox.c1 + 1);
+ nRows = Math.max(nRows, oBBox.r2 - oBBox.r1 + 1);
+ }
+ for (nLvl = 0; nLvl < nRows; ++nLvl) {
+ oLvl = this.createLvl();
+ if (!oLvl) {
+ return;
+ }
+ nPtIdx = 0;
+ for (nRef = 0; nRef < aParsedRef.length; ++nRef) {
+ oRef = aParsedRef[nRef];
+ oBBox = oRef.bbox;
+ oWS = oRef.worksheet;
+ if (nLvl < (oBBox.r2 - oBBox.r1 + 1)) {
+ for (nCol = oBBox.c1; nCol <= oBBox.c2; ++nCol) {
+ oCell = oWS.getCell3(nLvl + oBBox.r1, nCol);
+ this.fillCellVal(oCell, oLvl, nPtIdx);
+ ++nPtIdx;
+ }
+ }
+ else {
+ nPtIdx += (oBBox.c2 - oBBox.c1 + 1);
+ }
+ }
+ nPtCount = Math.max(nPtCount, nPtIdx);
+ oLvl.setPtCount(nPtIdx);
+ this.addLevelData(oLvl);
+ }
+ }
+ else {
+ for (nRef = 0; nRef < aParsedRef.length; ++nRef) {
+ oRef = aParsedRef[nRef];
+ oBBox = oRef.bbox;
+ nPtCount += (oBBox.r2 - oBBox.r1 + 1);
+ nCols = Math.max(nCols, oBBox.c2 - oBBox.c1 + 1);
+ }
+ for (nLvl = 0; nLvl < nCols; ++nLvl) {
+ oLvl = this.createLvl();
+ nPtIdx = 0;
+ for (nRef = 0; nRef < aParsedRef.length; ++nRef) {
+ oRef = aParsedRef[nRef];
+ oBBox = oRef.bbox;
+ oWS = oRef.worksheet;
+ if (nLvl < (oBBox.c2 - oBBox.c1 + 1)) {
+ for (nRow = oBBox.r1; nRow <= oBBox.r2; ++nRow) {
+ oCell = oWS.getCell3(nRow, nLvl + oBBox.c1);
+ this.fillCellVal(oCell, oLvl, nPtIdx);
+ ++nPtIdx;
+ }
+ }
+ else {
+ nPtIdx += (oBBox.r2 - oBBox.r1 + 1);
+ }
+ }
+ nPtCount = Math.max(nPtCount, nPtIdx);
+ oLvl.setPtCount(nPtIdx);
+ this.addLevelData(oLvl);
+ }
+ }
+ }
+ };
+ CDimension.prototype.updateCache = function() {
+ AscFormat.ExecuteNoHistory(function () {
+ this.updateReferences();
+ }, this, []);
+ };
+ // NumericDimension
+ drawingContentChanges[AscDFH.historyitem_NumericDimension_AddLevelData] =
+ drawingContentChanges[AscDFH.historyitem_NumericDimension_RemoveLevelData] = function (oClass) {
+ return oClass.levelData;
+ };
+
+ AscDFH.changesFactory[AscDFH.historyitem_NumericDimension_AddLevelData] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_NumericDimension_RemoveLevelData] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CNumericDimension() {
+ CDimension.call(this);
+ }
+
+ InitClass(CNumericDimension, CDimension, AscDFH.historyitem_type_NumericDimension);
+
+ CNumericDimension.prototype.fillObject = function (oCopy) {
+ CDimension.prototype.fillObject.call(this, oCopy);
+ if (this.levelData) {
+ for (let i = 0; i < this.levelData.length; i++) {
+ oCopy.addLevelData(this.levelData[i].createDuplicate(), i);
+ }
+ }
+ }
+
+ CNumericDimension.prototype.addLevelData = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.levelData.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_NumericDimension_AddLevelData, pos, [pr], true));
+ this.levelData.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CNumericDimension.prototype.removeLevelDataByPos = function (pos) {
+ if (this.levelData[pos]) {
+ let levelData = this.levelData.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_NumericDimension_RemoveLevelData, pos, [levelData], false));
+ }
+ };
+ CNumericDimension.prototype.createLvl = function () {
+ return new AscFormat.CNumLit();
+ };
+ CNumericDimension.prototype.fillCellVal = function (oCell, oLvl, nPtIdx) {
+ let dVal = oCell.getNumberValue();
+ if (!AscFormat.isRealNumber(dVal)) {
+ let sVal = oCell.getValueForEdit();
+ if ((typeof sVal === "string") && sVal.length > 0) {
+ dVal = 0;
+ }
+ }
+ if (AscFormat.isRealNumber(dVal)) {
+ let oPt = new AscFormat.CNumericPoint();
+ oPt.setIdx(nPtIdx);
+ oPt.setVal(dVal);
+ oLvl.addPt(oPt);
+ oPt.setFormatCode(oCell.getNumFormatStr());
+ }
+ };
+
+
+ // // PageMargins (CPageMarginsChart contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_PageMargins_SetL] = function (oClass, value) {
+ // oClass.l = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageMargins_SetR] = function (oClass, value) {
+ // oClass.r = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageMargins_SetT] = function (oClass, value) {
+ // oClass.t = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageMargins_SetB] = function (oClass, value) {
+ // oClass.b = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageMargins_SetHeader] = function (oClass, value) {
+ // oClass.header = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageMargins_SetFooter] = function (oClass, value) {
+ // oClass.footer = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_PageMargins_SetL] = window['AscDFH'].CChangesDrawingsDouble2;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageMargins_SetR] = window['AscDFH'].CChangesDrawingsDouble2;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageMargins_SetT] = window['AscDFH'].CChangesDrawingsDouble2;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageMargins_SetB] = window['AscDFH'].CChangesDrawingsDouble2;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageMargins_SetHeader] = window['AscDFH'].CChangesDrawingsDouble2;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageMargins_SetFooter] = window['AscDFH'].CChangesDrawingsDouble2;
+ // function CPageMargins() {
+ // CBaseChartObject.call(this);
+ // this.l = null;
+ // this.r = null;
+ // this.t = null;
+ // this.b = null;
+ // this.header = null;
+ // this.footer = null;
+ // }
+
+ // InitClass(CPageMargins, CBaseChartObject, AscDFH.historyitem_type_PageMargins);
+
+ // CPageMargins.prototype.setL = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PageMargins_SetL, this.l, pr));
+ // this.l = pr;
+ // };
+ // CPageMargins.prototype.setR = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PageMargins_SetR, this.r, pr));
+ // this.r = pr;
+ // };
+ // CPageMargins.prototype.setT = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PageMargins_SetT, this.t, pr));
+ // this.t = pr;
+ // };
+ // CPageMargins.prototype.setB = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PageMargins_SetB, this.b, pr));
+ // this.b = pr;
+ // };
+ // CPageMargins.prototype.setHeader = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PageMargins_SetHeader, this.header, pr));
+ // this.header = pr;
+ // };
+ // CPageMargins.prototype.setFooter = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PageMargins_SetFooter, this.footer, pr));
+ // this.footer = pr;
+ // };
+ //
+
+ // // PageSetup (contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetPaperSize] = function (oClass, value) {
+ // oClass.paperSize = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetFirstPageNumber] = function (oClass, value) {
+ // oClass.firstPageNumber = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetOrientation] = function (oClass, value) {
+ // oClass.orientation = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetBlackAndWhite] = function (oClass, value) {
+ // oClass.blackAndWhite = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetDraft] = function (oClass, value) {
+ // oClass.draft = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetUseFirstPageNumber] = function (oClass, value) {
+ // oClass.useFirstPageNumber = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetHorizontalDpi] = function (oClass, value) {
+ // oClass.horizontalDpi = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetVerticalDpi] = function (oClass, value) {
+ // oClass.verticalDpi = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PageSetup_SetCopies] = function (oClass, value) {
+ // oClass.copies = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetPaperSize] = window['AscDFH'].CChangesDrawingsLong;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetFirstPageNumber] = window['AscDFH'].CChangesDrawingsLong;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetOrientation] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetBlackAndWhite] = window['AscDFH'].CChangesDrawingsBool;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetDraft] = window['AscDFH'].CChangesDrawingsBool;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetUseFirstPageNumber] = window['AscDFH'].CChangesDrawingsBool;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetHorizontalDpi] = window['AscDFH'].CChangesDrawingsLong;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetVerticalDpi] = window['AscDFH'].CChangesDrawingsLong;
+ // AscDFH.changesFactory[AscDFH.historyitem_PageSetup_SetCopies] = window['AscDFH'].CChangesDrawingsLong;
+ // function CPageSetup() {
+ // CBaseChartObject.call(this);
+ // this.paperSize = null;
+ // this.firstPageNumber = null;
+ // this.orientation = null;
+ // this.blackAndWhite = null;
+ // this.draft = null;
+ // this.useFirstPageNumber = null;
+ // this.horizontalDpi = null;
+ // this.verticalDpi = null;
+ // this.copies = null;
+ // }
+
+ // InitClass(CPageSetup, CBaseChartObject, AscDFH.historyitem_type_PageSetup);
+
+ // CPageSetup.prototype.setPaperSize = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PageSetup_SetPaperSize, this.paperSize, pr));
+ // this.paperSize = pr;
+ // };
+ // CPageSetup.prototype.setFirstPageNumber = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PageSetup_SetFirstPageNumber, this.firstPageNumber, pr));
+ // this.firstPageNumber = pr;
+ // };
+ // CPageSetup.prototype.setOrientation = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_PageSetup_SetOrientation, this.orientation, pr));
+ // this.orientation = pr;
+ // };
+ // CPageSetup.prototype.setBlackAndWhite = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_PageSetup_SetBlackAndWhite, this.blackAndWhite, pr));
+ // this.blackAndWhite = pr;
+ // };
+ // CPageSetup.prototype.setDraft = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_PageSetup_SetDraft, this.draft, pr));
+ // this.draft = pr;
+ // };
+ // CPageSetup.prototype.setUseFirstPageNumber = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_PageSetup_SetUseFirstPageNumber, this.useFirstPageNumber, pr));
+ // this.useFirstPageNumber = pr;
+ // };
+ // CPageSetup.prototype.setHorizontalDpi = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PageSetup_SetHorizontalDpi, this.horizontalDpi, pr));
+ // this.horizontalDpi = pr;
+ // };
+ // CPageSetup.prototype.setVerticalDpi = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PageSetup_SetVerticalDpi, this.verticalDpi, pr));
+ // this.verticalDpi = pr;
+ // };
+ // CPageSetup.prototype.setCopies = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PageSetup_SetCopies, this.copies, pr));
+ // this.copies = pr;
+ // };
+ //
+
+ // // ParentLabelLayout ( st instead ct_ParentLabelLayout )
+ // drawingsChangesMap[AscDFH.historyitem_ParentLabelLayout_SetVal] = function (oClass, value) {
+ // oClass.val = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_ParentLabelLayout_SetVal] = window['AscDFH'].CChangesDrawingsObject;
+ // function CParentLabelLayout() {
+ // CBaseChartObject.call(this);
+ // this.val = null;
+ // }
+
+ // InitClass(CParentLabelLayout, CBaseChartObject, AscDFH.historyitem_type_ParentLabelLayout);
+
+ // CParentLabelLayout.prototype.setVal = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ParentLabelLayout_SetVal, this.val, pr));
+ // this.val = pr;
+ // };
+
+
+ // PercentageColorPosition
+ drawingsChangesMap[AscDFH.historyitem_PercentageColorPosition_SetVal] = function (oClass, value) {
+ oClass.val = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_PercentageColorPosition_SetVal] = window['AscDFH'].CChangesDrawingsDouble2;
+
+ function CPercentageColorPosition() {
+ CBaseChartObject.call(this);
+ this.val = null;
+ }
+
+ InitClass(CPercentageColorPosition, CBaseChartObject, AscDFH.historyitem_type_PercentageColorPosition);
+
+ CPercentageColorPosition.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setVal(this.val);
+ }
+
+ CPercentageColorPosition.prototype.setVal = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_PercentageColorPosition_SetVal, this.val, pr));
+ this.val = pr;
+ };
+
+
+ // // PlotArea (contains in chartFormat.js but different fields)
+ // drawingsChangesMap[AscDFH.historyitem_ChartExPlotArea_SetPlotAreaRegion] = function (oClass, value) {
+ // oClass.plotAreaRegion = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ChartExPlotArea_SetAxis] = function (oClass, value) {
+ // oClass.axis = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_ChartExPlotArea_SetSpPr] = function (oClass, value) {
+ // oClass.spPr = value;
+ // };
+ // drawingContentChanges[AscDFH.historyitem_ChartExPlotArea_AddAxis] =
+ // drawingContentChanges[AscDFH.historyitem_ChartExPlotArea_RemoveAxis] = function (oClass) {
+ // return oClass.axis;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExPlotArea_SetPlotAreaRegion] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExPlotArea_SetAxis] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExPlotArea_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExPlotArea_AddAxis] = window['AscDFH'].CChangesDrawingsContent;
+ // AscDFH.changesFactory[AscDFH.historyitem_ChartExPlotArea_RemoveAxis] = window['AscDFH'].CChangesDrawingsContent;
+ // function CChartExPlotArea() {
+ // CBaseChartObject.call(this);
+ // this.plotAreaRegion = null;
+ // this.axis = [];
+ // this.spPr = null;
+ // }
+
+ // InitClass(CChartExPlotArea, CBaseChartObject, AscDFH.historyitem_type_ChartExPlotArea);
+
+ // CChartExPlotArea.prototype.setPlotAreaRegion = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExPlotArea_SetPlotAreaRegion, this.plotAreaRegion, pr));
+ // this.plotAreaRegion = pr;
+ // };
+ // CChartExPlotArea.prototype.setAxis = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExPlotArea_SetAxis, this.axis, pr));
+ // this.axis = pr;
+ // };
+ // CChartExPlotArea.prototype.setSpPr = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartExPlotArea_SetSpPr, this.spPr, pr));
+ // this.spPr = pr;
+ // };
+ // CChartExPlotArea.prototype.addAxis = function (pr, idx) {
+ // var pos;
+ // if (AscFormat.isRealNumber(idx))
+ // pos = idx;
+ // else
+ // pos = this.axis.length;
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_ChartExPlotArea_AddAxis, pos, [pr], true));
+ // this.axis.splice(pos, 0, pr);
+ // };
+ // CChartExPlotArea.prototype.removeAxisByPos = function (pos) {
+ // if (this.axis[pos]) {
+ // var axis = this.axis.splice(pos, 1)[0];
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_ChartExPlotArea_RemoveAxis, pos, [axis], false));
+ // }
+ // };
+
+
+ // PlotAreaRegion
+ drawingsChangesMap[AscDFH.historyitem_PlotAreaRegion_SetPlotSurface] = function (oClass, value) {
+ oClass.plotSurface = value;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_PlotAreaRegion_AddSeries] =
+ drawingContentChanges[AscDFH.historyitem_PlotAreaRegion_RemoveSeries] = function (oClass) {
+ return oClass.series;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_PlotAreaRegion_SetPlotSurface] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_PlotAreaRegion_AddSeries] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_PlotAreaRegion_RemoveSeries] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CPlotAreaRegion() {
+ CBaseChartObject.call(this);
+ this.plotSurface = null;
+ this.series = [];
+ }
+
+ InitClass(CPlotAreaRegion, CBaseChartObject, AscDFH.historyitem_type_PlotAreaRegion);
+
+ CPlotAreaRegion.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.plotSurface) {
+ oCopy.setPlotSurface(this.plotSurface.createDuplicate());
+ }
+ if (this.series) {
+ for (let i = 0; i < this.series.length; i++) {
+ oCopy.addSeries(this.series[i].createDuplicate(), i);
+ }
+ }
+ }
+
+ CPlotAreaRegion.prototype.getMaxSeriesIdx = function () {
+ return this.series.length;
+ };
+ CPlotAreaRegion.prototype.setPlotSurface = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_PlotAreaRegion_SetPlotSurface, this.plotSurface, pr));
+ this.plotSurface = pr;
+ this.setParentToChild(pr);
+ };
+ CPlotAreaRegion.prototype.addSeries = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.series.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_PlotAreaRegion_AddSeries, pos, [pr], true));
+ this.series.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CPlotAreaRegion.prototype.removeSeriesByPos = function (pos) {
+ if (this.series[pos]) {
+ let series = this.series.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_PlotAreaRegion_RemoveSeries, pos, [series], false));
+ }
+ };
+ CPlotAreaRegion.prototype.updateReferences = function (bDisplayEmptyCellsAs, bDisplayHidden) {
+
+ };
+ CPlotAreaRegion.prototype.getAllSeries = function () {
+ return [].concat(this.series);
+ };
+ CPlotAreaRegion.prototype.getAllRasterImages = function (images) {
+ for(let nIdx = 0; nIdx < this.series.length; ++nIdx) {
+ this.series[nIdx].getAllRasterImages(images);
+ }
+ };
+
+ // PlotSurface
+ drawingsChangesMap[AscDFH.historyitem_PlotSurface_SetSpPr] = function (oClass, value) {
+ oClass.spPr = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_PlotSurface_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CPlotSurface() {
+ CBaseChartObject.call(this);
+ this.spPr = null;
+ }
+
+ InitClass(CPlotSurface, CBaseChartObject, AscDFH.historyitem_type_PlotSurface);
+
+ CPlotSurface.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.spPr) {
+ oCopy.setSpPr(this.spPr.createDuplicate());
+ }
+ }
+
+ CPlotSurface.prototype.setSpPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_PlotSurface_SetSpPr, this.spPr, pr));
+ this.spPr = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // // PrintSettings (contains in ChartFormat.js)
+ // drawingsChangesMap[AscDFH.historyitem_PrintSettings_SetHeaderFooter] = function (oClass, value) {
+ // oClass.headerFooter = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PrintSettings_SetPageMargins] = function (oClass, value) {
+ // oClass.pageMargins = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_PrintSettings_SetPageSetup] = function (oClass, value) {
+ // oClass.pageSetup = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_PrintSettings_SetHeaderFooter] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_PrintSettings_SetPageMargins] = window['AscDFH'].CChangesDrawingsString;
+ // AscDFH.changesFactory[AscDFH.historyitem_PrintSettings_SetPageSetup] = window['AscDFH'].CChangesDrawingsString;
+ // function CPrintSettings() {
+ // CBaseChartObject.call(this);
+ // this.headerFooter = null;
+ // this.pageMargins = null;
+ // this.pageSetup = null;
+ // }
+
+ // InitClass(CPrintSettings, CBaseChartObject, AscDFH.historyitem_type_PrintSettings);
+
+ // CPrintSettings.prototype.setHeaderFooter = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_PrintSettings_SetHeaderFooter, this.headerFooter, pr));
+ // this.headerFooter = pr;
+ // };
+ // CPrintSettings.prototype.setPageMargins = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_PrintSettings_SetPageMargins, this.pageMargins, pr));
+ // this.pageMargins = pr;
+ // };
+ // CPrintSettings.prototype.setPageSetup = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_PrintSettings_SetPageSetup, this.pageSetup, pr));
+ // this.pageSetup = pr;
+ // };
+ //
+
+ // // RegionLabelLayout (st is used instead of CT_RegionLabelLayout)
+ // drawingsChangesMap[AscDFH.historyitem_RegionLabelLayout_SetVal] = function (oClass, value) {
+ // oClass.val = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_RegionLabelLayout_SetVal] = window['AscDFH'].CChangesDrawingsString;
+ // function CRegionLabelLayout() {
+ // CBaseChartObject.call(this);
+ // this.val = null;
+ // }
+
+ // InitClass(CRegionLabelLayout, CBaseChartObject, AscDFH.historyitem_type_RegionLabelLayout);
+
+ // CRegionLabelLayout.prototype.setVal = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_RegionLabelLayout_SetVal, this.val, pr));
+ // this.val = pr;
+ // };
+ //
+
+
+ // Series
+
+ drawingsChangesMap[AscDFH.historyitem_Series_SetDataLabels] = function (oClass, value) {
+ oClass.dataLabels = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetDataId] = function (oClass, value) {
+ oClass.dataId = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetLayoutPr] = function (oClass, value) {
+ oClass.layoutPr = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetLayoutId] = function (oClass, value) {
+ oClass.layoutId = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetHidden] = function (oClass, value) {
+ oClass.hidden = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetOwnerIdx] = function (oClass, value) {
+ oClass.ownerIdx = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetUniqueId] = function (oClass, value) {
+ oClass.uniqueId = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Series_SetFormatIdx] = function (oClass, value) {
+ oClass.formatIdx = value;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_Series_AddDataPt] =
+ drawingContentChanges[AscDFH.historyitem_Series_RemoveDataPt] = function (oClass) {
+ return oClass.dPt;
+ };
+
+ drawingContentChanges[AscDFH.historyitem_Series_AddAxisId] =
+ drawingContentChanges[AscDFH.historyitem_Series_RemoveAxisId] = function (oClass) {
+ return oClass.axisId;
+ };
+
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetDataLabels] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetDataId] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetLayoutPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetLayoutId] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetHidden] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetOwnerIdx] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetUniqueId] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_SetFormatIdx] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_AddDataPt] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_RemoveDataPt] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_AddAxisId] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_Series_RemoveAxisId] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CSeries() {
+ AscFormat.CSeriesBase.call(this);
+ // commented in ChartSerializeEx.h
+ // this.valueColors = null;
+ // this.valueColorPositions = null;
+ this.dPt = [];
+ this.dataLabels = null;
+ this.dataId = null;
+ this.layoutPr = null;
+ this.axisId = [];
+ this.layoutId = null;
+ this.hidden = null;
+ this.ownerIdx = null;
+ this.uniqueId = null;
+ this.formatIdx = null;
+ }
+
+ InitClass(CSeries, AscFormat.CSeriesBase, AscDFH.historyitem_type_Series);
+ CSeries.prototype.isSupported = function () {
+ let nType = this.layoutId;
+ if(nType === AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN ||
+ nType === AscFormat.SERIES_LAYOUT_WATERFALL ||
+ nType === AscFormat.SERIES_LAYOUT_FUNNEL) {
+ return true;
+ }
+ return false;
+ };
+ CSeries.prototype.fillObject = function (oCopy) {
+ AscFormat.CSeriesBase.prototype.fillObject.call(this, oCopy);
+ if (this.dataLabels) {
+ oCopy.setDataLabels(this.dataLabels.createDuplicate());
+ }
+ oCopy.setDataId(this.dataId);
+ if (this.layoutPr) {
+ oCopy.setLayoutPr(this.layoutPr.createDuplicate());
+ }
+ if (this.layoutId) {
+ oCopy.setLayoutId(this.layoutId);
+ }
+ if (this.dPt) {
+ for (let i = 0; i < this.dPt.length; i++) {
+ oCopy.addDataPt(this.dPt[i].createDuplicate(), i);
+ }
+ }
+ if (this.axisId) {
+ for (let i = 0; i < this.axisId.length; i++) {
+ oCopy.addAxisId(this.axisId[i].createDuplicate(), i);
+ }
+ }
+ oCopy.setHidden(this.hidden);
+ oCopy.setOwnerIdx(this.ownerIdx);
+ oCopy.setUniqueId(this.uniqueId);
+ oCopy.setFormatIdx(this.formatIdx);
+ }
+
+ // CSeries.prototype.setValueColors = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Series_SetValueColors, this.valueColors, pr));
+ // this.valueColors = pr;
+ // };
+ // CSeries.prototype.setValueColorPositions = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Series_SetValueColorPositions, this.valueColorPositions, pr));
+ // this.valueColorPositions = pr;
+ // };
+ CSeries.prototype.addDataPt = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.dPt.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_Series_AddDataPt, pos, [pr], true));
+ this.dPt.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CSeries.prototype.removeDataPtByPos = function (pos) {
+ if (this.dPt[pos]) {
+ let dPt = this.dPt.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_Series_RemoveDataPt, pos, [dPt], false));
+ }
+ };
+ CSeries.prototype.setDataLabels = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Series_SetDataLabels, this.dataLabels, pr));
+ this.dataLabels = pr;
+ this.setParentToChild(pr);
+ };
+ CSeries.prototype.setDataId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Series_SetDataId, this.dataId, pr));
+ this.dataId = pr;
+ };
+ CSeries.prototype.setLayoutPr = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Series_SetLayoutPr, this.layoutPr, pr));
+ this.layoutPr = pr;
+ this.setParentToChild(pr);
+ };
+ CSeries.prototype.addAxisId = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.axisId.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_Series_AddAxisId, pos, [pr], true));
+ this.axisId.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CSeries.prototype.removeAxisIdByPos = function (pos) {
+ if (this.axisId[pos]) {
+ let axisId = this.axisId.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_Series_RemoveAxisId, pos, [axisId], false));
+ }
+ };
+ CSeries.prototype.setLayoutId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Series_SetLayoutId, this.layoutId, pr));
+ this.layoutId = pr;
+ };
+ CSeries.prototype.setHidden = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_Series_SetHidden, this.hidden, pr));
+ this.hidden = pr;
+ };
+ CSeries.prototype.setOwnerIdx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Series_SetOwnerIdx, this.ownerIdx, pr));
+ this.ownerIdx = pr;
+ };
+ CSeries.prototype.setUniqueId = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Series_SetUniqueId, this.uniqueId, pr));
+ this.uniqueId = pr;
+ };
+ CSeries.prototype.setFormatIdx = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Series_SetFormatIdx, this.formatIdx, pr));
+ this.formatIdx = pr;
+ };
+ CSeries.prototype.getData = function () {
+ if (this.dataId === null) {
+ return null;
+ }
+ let oChartSpace = this.getChartSpace();
+ if (!oChartSpace) {
+ return null;
+ }
+ let oChartData = oChartSpace.chartData;
+ if (!oChartData) {
+ return null;
+ }
+ let oSeriesData = oChartData.getData(this.dataId);
+ if (!oSeriesData) {
+ return null;
+ }
+ return oSeriesData;
+ };
+ CSeries.prototype.getValLit = function () {
+ let oSeriesData = this.getData();
+ if (!oSeriesData) {
+ return null;
+ }
+ let aValDim = oSeriesData.getValDimensions();
+ if (aValDim.length > 0) {
+ let oDim = aValDim[0];
+ if (oDim) {
+ return oDim.levelData[0] || null;
+ }
+ }
+ return null;
+ };
+ CSeries.prototype.getAllRasterImages = function (images) {
+ for (let nDpt = 0; nDpt < this.dPt.length; ++nDpt) {
+ let oDPt = this.dPt[nDpt];
+ if(oDPt && oDPt.spPr) {
+ oDPt.spPr.checkBlipFillRasterImage(images);
+ }
+ }
+ };
+ CSeries.prototype.getValPts = function () {
+ const numLit = this.getValLit();
+ return numLit ? numLit.pts : [];
+ };
+ CSeries.prototype.getNumPts = function() {
+ return this.getValPts();
+ };
+ CSeries.prototype.getCatLit = function (type) {
+ let oSeriesData = this.getData();
+ if (!oSeriesData) {
+ return null;
+ }
+ let aCatDim = oSeriesData.getCatDimensions();
+ if (aCatDim.length > 0) {
+ let oDim = aCatDim[0];
+ if (oDim) {
+ let index = (type === AscFormat.SERIES_LAYOUT_WATERFALL || type === AscFormat.SERIES_LAYOUT_FUNNEL) ? oDim.levelData.length - 1 : 0;
+ return oDim.levelData[index] || null;
+ }
+ }
+ return null;
+ };
+ CSeries.prototype.getBrush = function () {
+ return this.compiledSeriesBrush;
+ };
+ CSeries.prototype.getPen = function () {
+ return this.compiledSeriesPen;
+ };
+ CSeries.prototype.getDptByIdx = function (idx) {
+ for (let nDpt = 0; nDpt < this.dPt.length; ++nDpt) {
+ if (this.dPt[nDpt].idx === idx) {
+ return this.dPt[nDpt];
+ }
+ }
+ return null;
+ };
+ CSeries.prototype.getPtByIdx = function (idx) {
+ let aPts = this.getNumPts();
+ for (let nIdx = 0; nIdx < aPts.length; ++nIdx) {
+ if (aPts[nIdx].idx === idx) {
+ return aPts[nIdx];
+ }
+ }
+ return null;
+ };
+ CSeries.prototype.getPtPen = function (nIdx) {
+ let oPt = this.getPtByIdx(nIdx);
+ if (oPt && oPt.pen) {
+ return oPt.pen;
+ }
+ return this.compiledSeriesPen;
+ };
+
+ CSeries.prototype.getPtBrush = function (nIdx) {
+ let oPt = this.getPtByIdx(nIdx);
+ if (oPt && oPt.brush) {
+ return oPt.brush;
+ }
+ return this.compiledSeriesBrush;
+ };
+
+ CSeries.prototype.getIdx = function () {
+ if (!this.parent) {
+ return -1;
+ }
+ let aSeries = this.parent.series;
+ for (let nSer = 0; nSer < aSeries.length; ++nSer) {
+ if (this === aSeries[nSer]) {
+ return nSer;
+ }
+ }
+ return -1;
+ };
+
+
+ // SeriesElementVisibilities
+ drawingsChangesMap[AscDFH.historyitem_SeriesElementVisibilities_SetConnectorLines] = function (oClass, value) {
+ oClass.connectorLines = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesElementVisibilities_SetMeanLine] = function (oClass, value) {
+ oClass.meanLine = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesElementVisibilities_SetMeanMarker] = function (oClass, value) {
+ oClass.meanMarker = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesElementVisibilities_SetNonoutliers] = function (oClass, value) {
+ oClass.nonoutliers = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesElementVisibilities_SetOutliers] = function (oClass, value) {
+ oClass.outliers = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesElementVisibilities_SetConnectorLines] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesElementVisibilities_SetMeanLine] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesElementVisibilities_SetMeanMarker] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesElementVisibilities_SetNonoutliers] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesElementVisibilities_SetOutliers] = window['AscDFH'].CChangesDrawingsBool;
+
+ function CSeriesElementVisibilities() {
+ CBaseChartObject.call(this);
+ this.connectorLines = null;
+ this.meanLine = null;
+ this.meanMarker = null;
+ this.nonoutliers = null;
+ this.outliers = null;
+ }
+
+ InitClass(CSeriesElementVisibilities, CBaseChartObject, AscDFH.historyitem_type_SeriesElementVisibilities);
+
+ CSeriesElementVisibilities.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setConnectorLines(this.connectorLines);
+ oCopy.setMeanLine(this.meanLine);
+ oCopy.setMeanMarker(this.meanMarker);
+ oCopy.setNonoutliers(this.nonoutliers);
+ oCopy.setOutliers(this.outliers);
+ }
+
+ CSeriesElementVisibilities.prototype.setConnectorLines = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_SeriesElementVisibilities_SetConnectorLines, this.connectorLines, pr));
+ this.connectorLines = pr;
+ };
+ CSeriesElementVisibilities.prototype.setMeanLine = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_SeriesElementVisibilities_SetMeanLine, this.meanLine, pr));
+ this.meanLine = pr;
+ };
+ CSeriesElementVisibilities.prototype.setMeanMarker = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_SeriesElementVisibilities_SetMeanMarker, this.meanMarker, pr));
+ this.meanMarker = pr;
+ };
+ CSeriesElementVisibilities.prototype.setNonoutliers = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_SeriesElementVisibilities_SetNonoutliers, this.nonoutliers, pr));
+ this.nonoutliers = pr;
+ };
+ CSeriesElementVisibilities.prototype.setOutliers = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_SeriesElementVisibilities_SetOutliers, this.outliers, pr));
+ this.outliers = pr;
+ };
+
+
+ // SeriesLayoutProperties
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetParentLabelLayout] = function (oClass, value) {
+ oClass.parentLabelLayout = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetRegionLabelLayout] = function (oClass, value) {
+ oClass.regionLabelLayout = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetVisibility] = function (oClass, value) {
+ oClass.visibility = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetAggregation] = function (oClass, value) {
+ oClass.aggregation = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetBinning] = function (oClass, value) {
+ oClass.binning = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetGeography] = function (oClass, value) {
+ oClass.geography = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetStatistics] = function (oClass, value) {
+ oClass.statistics = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_SeriesLayoutProperties_SetSubtotals] = function (oClass, value) {
+ oClass.subtotals = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetParentLabelLayout] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetRegionLabelLayout] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetVisibility] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetAggregation] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetBinning] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetGeography] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetStatistics] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_SeriesLayoutProperties_SetSubtotals] = window['AscDFH'].CChangesDrawingsObjectNoId;
+
+
+
+
+ function CSeriesLayoutProperties() {
+ CBaseChartObject.call(this);
+ this.parentLabelLayout = null;
+ this.regionLabelLayout = null;
+ this.visibility = null;
+ this.aggregation = null;
+ this.statistics = null;
+ this.subtotals = null;
+ this.binning = null;
+ // todo in ChartSerializeEx.h
+ this.geography = null;
+ }
+
+ InitClass(CSeriesLayoutProperties, CBaseChartObject, AscDFH.historyitem_type_SeriesLayoutProperties);
+
+ CSeriesLayoutProperties.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.visibility) {
+ oCopy.setVisibility(this.visibility.createDuplicate());
+ }
+ if (this.statistics) {
+ oCopy.setStatistics(this.statistics.createDuplicate());
+ }
+ if (this.subtotals) {
+ oCopy.setSubtotals(this.subtotals.createDuplicate());
+ }
+ if (this.binning) {
+ oCopy.setBinning(this.binning.createDuplicate());
+ }
+ if (this.geography) {
+ oCopy.setGeography(this.geography.createDuplicate());
+ }
+ oCopy.setParentLabelLayout(this.parentLabelLayout);
+ oCopy.setRegionLabelLayout(this.regionLabelLayout);
+ oCopy.setAggregation(this.aggregation);
+ }
+
+ CSeriesLayoutProperties.prototype.setParentLabelLayout = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SeriesLayoutProperties_SetParentLabelLayout, this.parentLabelLayout, pr));
+ this.parentLabelLayout = pr;
+ this.setParentToChild(pr);
+ };
+ CSeriesLayoutProperties.prototype.setRegionLabelLayout = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SeriesLayoutProperties_SetRegionLabelLayout, this.regionLabelLayout, pr));
+ this.regionLabelLayout = pr;
+ this.setParentToChild(pr);
+ };
+ CSeriesLayoutProperties.prototype.setVisibility = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SeriesLayoutProperties_SetVisibility, this.visibility, pr));
+ this.visibility = pr;
+ this.setParentToChild(pr);
+ };
+ CSeriesLayoutProperties.prototype.setAggregation = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_SeriesLayoutProperties_SetAggregation, this.aggregation, pr));
+ this.aggregation = pr;
+ };
+ CSeriesLayoutProperties.prototype.setBinning = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SeriesLayoutProperties_SetBinning, this.binning, pr));
+ this.binning = pr;
+ this.setParentToChild(pr);
+ };
+ CSeriesLayoutProperties.prototype.setGeography = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SeriesLayoutProperties_SetGeography, this.geography, pr));
+ this.geography = pr;
+ this.setParentToChild(pr);
+ };
+ CSeriesLayoutProperties.prototype.setStatistics = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SeriesLayoutProperties_SetStatistics, this.statistics, pr));
+ this.statistics = pr;
+ this.setParentToChild(pr);
+ };
+ CSeriesLayoutProperties.prototype.setSubtotals = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_SeriesLayoutProperties_SetSubtotals, this.subtotals, pr));
+ this.subtotals = pr;
+ };
+
+
+ // Statistics
+ drawingsChangesMap[AscDFH.historyitem_Statistics_SetQuartileMethod] = function (oClass, value) {
+ oClass.quartileMethod = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_Statistics_SetQuartileMethod] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CStatistics() {
+ CBaseChartObject.call(this);
+ this.quartileMethod = null;
+ }
+
+ InitClass(CStatistics, CBaseChartObject, AscDFH.historyitem_type_Statistics);
+
+ CStatistics.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setQuartileMethod(this.quartileMethod);
+ }
+
+ CStatistics.prototype.setQuartileMethod = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Statistics_SetQuartileMethod, this.quartileMethod, pr));
+ this.quartileMethod = pr;
+ };
+
+ // StringDimension
+
+ drawingContentChanges[AscDFH.historyitem_StringDimension_AddLevelData] =
+ drawingContentChanges[AscDFH.historyitem_StringDimension_RemoveLevelData] = function (oClass) {
+ return oClass.levelData;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_StringDimension_AddLevelData] = window['AscDFH'].CChangesDrawingsContent;
+ AscDFH.changesFactory[AscDFH.historyitem_StringDimension_RemoveLevelData] = window['AscDFH'].CChangesDrawingsContent;
+
+ function CStringDimension() {
+ CDimension.call(this);
+ }
+
+ InitClass(CStringDimension, CDimension, AscDFH.historyitem_type_StringDimension);
+
+ CStringDimension.prototype.fillObject = function (oCopy) {
+ CDimension.prototype.fillObject.call(this, oCopy);
+ if (this.levelData) {
+ for (let i = 0; i < this.levelData.length; i++) {
+ oCopy.addLevelData(this.levelData[i].createDuplicate(), i);
+ }
+ }
+ }
+
+ CStringDimension.prototype.addLevelData = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx))
+ pos = idx;
+ else
+ pos = this.levelData.length;
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_StringDimension_AddLevelData, pos, [pr], true));
+ this.levelData.splice(pos, 0, pr);
+ this.setParentToChild(pr);
+ };
+ CStringDimension.prototype.removeLevelDataByPos = function (pos) {
+ if (this.levelData[pos]) {
+ let levelData = this.levelData.splice(pos, 1)[0];
+ History.CanAddChanges() && History.Add(new CChangesDrawingsContent(this, AscDFH.historyitem_StringDimension_RemoveLevelData, pos, [levelData], false));
+ }
+ };
+
+ CStringDimension.prototype.createLvl = function () {
+ return new AscFormat.CStrCache();
+ };
+ CStringDimension.prototype.fillCellVal = function (oCell, oLvl, nPtIdx) {
+ let sVal = oCell.getValueWithFormat();
+ if (typeof sVal === "string" && sVal.length > 0) {
+ let oPt = new AscFormat.CStringPoint();
+ oPt.setIdx(nPtIdx);
+ oPt.setVal(sVal);
+ oLvl.addPt(oPt);
+ }
+ };
+
+
+
+
+ function CSubtotals() {
+ AscFormat.CBaseNoIdObject.call(this);
+ this.idx = [];
+ }
+
+ InitClass(CSubtotals, AscFormat.CBaseNoIdObject, AscDFH.historyitem_type_Subtotals);
+
+ CSubtotals.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.idx) {
+ for (let i = 0; i < this.idx.length; i++) {
+ oCopy.addIdx(this.idx[i], i);
+ }
+ }
+ }
+
+ CSubtotals.prototype.addIdx = function (pr, idx) {
+ let pos;
+ if (AscFormat.isRealNumber(idx)) {
+ pos = idx;
+ }
+ else {
+ pos = this.idx.length;
+ }
+ this.idx.splice(pos, 0, pr);
+ };
+ CSubtotals.prototype.removeIdxByPos = function (pos) {
+ if (this.idx[pos]) {
+ this.idx.splice(pos, 1);
+ }
+ };
+ CSubtotals.prototype.Write_ToBinary = function(w) {
+ let nCount = this.idx.length;
+ w.WriteLong(nCount);
+ for(let nI = 0; nI < nCount; ++nI) {
+ AscFormat.writeLong(w, this.idx[nI]);
+ }
+ };
+ CSubtotals.prototype.Read_FromBinary = function(r) {
+ let nCount = r.GetLong();
+ for(let nI = 0; nI < nCount; ++nI) {
+ let nIdx = AscFormat.readLong(r);
+ this.addIdx(nIdx);
+ }
+ };
+ CSubtotals.prototype.createDuplicate = function(r) {
+ let oCopy = new CSubtotals();
+ for(let nI = 0; nI < this.idx.length; ++nI) {
+ oCopy.addIdx(this.idx[nI]);
+ }
+ return oCopy;
+ };
+
+ AscDFH.drawingsConstructorsMap[AscDFH.historyitem_SeriesLayoutProperties_SetSubtotals] = CSubtotals;
+ // // Text (CChartText instead CText)
+ // drawingsChangesMap[AscDFH.historyitem_Text_SetTxData] = function (oClass, value) {
+ // oClass.txData = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_Text_SetRich] = function (oClass, value) {
+ // oClass.rich = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_Text_SetTxData] = window['AscDFH'].CChangesDrawingsObject;
+ // AscDFH.changesFactory[AscDFH.historyitem_Text_SetRich] = window['AscDFH'].CChangesDrawingsObject;
+ // function CText() {
+ // CBaseChartObject.call(this);
+ // this.txData = null;
+ // this.rich = null;
+ // }
+
+ // InitClass(CText, CBaseChartObject, AscDFH.historyitem_type_Text);
+
+ // CText.prototype.setTxData = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Text_SetTxData, this.txData, pr));
+ // this.txData = pr;
+ // };
+ // CText.prototype.setRich = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Text_SetRich, this.rich, pr));
+ // this.rich = pr;
+ // };
+
+
+ // TextData
+ drawingsChangesMap[AscDFH.historyitem_TextData_SetF] = function (oClass, value) {
+ oClass.f = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_TextData_SetV] = function (oClass, value) {
+ oClass.v = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_TextData_SetF] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_TextData_SetV] = window['AscDFH'].CChangesDrawingsString;
+
+ function CTextData() {
+ AscFormat.CChartRefBase.call(this);
+ this.f = null;
+ this.v = null;
+ }
+
+ InitClass(CTextData, AscFormat.CChartRefBase, AscDFH.historyitem_type_TextData);
+
+ CTextData.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.f) {
+ oCopy.setF(this.f.createDuplicate());
+ }
+ oCopy.setV(this.v);
+ }
+
+ CTextData.prototype.setF = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_TextData_SetF, this.f, pr));
+ this.f = pr;
+ this.setParentToChild(pr);
+ };
+ CTextData.prototype.setV = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_TextData_SetV, this.v, pr));
+ this.v = pr;
+ };
+
+ CTextData.prototype.updateCache = function() {
+ AscFormat.ExecuteNoHistory(function () {
+ if(this.f) {
+ let sContent = this.f.content;
+
+ let aParsedRef = AscFormat.fParseChartFormula(sContent);
+ if (!Array.isArray(aParsedRef) || aParsedRef.length === 0) {
+ return false;
+ }
+ if (aParsedRef.length > 0) {
+ let oRef = aParsedRef[0];
+ let oBBox = oRef.bbox;
+ let oWS = oRef.worksheet;
+ let oCell = oWS.getCell3(oBBox.r1, oBBox.c1);
+ if(oCell) {
+ let sVal = oCell.getValueWithFormat();
+ if (typeof sVal === "string" && sVal.length > 0) {
+ this.setV(sVal);
+ }
+ }
+ }
+ }
+ }, this, []);
+ };
+
+ // // TickLabels (unused, bool instead this class)
+ // function CTickLabels() {
+ // CBaseChartObject.call(this);
+ // }
+
+ // InitClass(CTickLabels, CBaseChartObject, AscDFH.historyitem_type_TickLabels);
+ //
+
+ // TickMarks
+ drawingsChangesMap[AscDFH.historyitem_TickMarks_SetType] = function (oClass, value) {
+ oClass.type = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_TickMarks_SetName] = function (oClass, value) {
+ oClass.name = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_TickMarks_SetType] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_TickMarks_SetName] = window['AscDFH'].CChangesDrawingsString;
+
+ function CTickMarks() {
+ CBaseChartObject.call(this);
+ this.type = null;
+ this.name = null;
+ }
+
+ InitClass(CTickMarks, CBaseChartObject, AscDFH.historyitem_type_TickMarks);
+
+ CTickMarks.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setType(this.type);
+ oCopy.setName(this.name);
+ }
+
+ CTickMarks.prototype.setType = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_TickMarks_SetType, this.type, pr));
+ this.type = pr;
+ };
+ CTickMarks.prototype.setName = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_TickMarks_SetName, this.name, pr));
+ this.name = pr;
+ };
+
+
+ // ValueAxisScaling
+ drawingsChangesMap[AscDFH.historyitem_ValueAxisScaling_SetMax] = function (oClass, value) {
+ oClass.max = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueAxisScaling_SetMin] = function (oClass, value) {
+ oClass.min = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueAxisScaling_SetMajorUnit] = function (oClass, value) {
+ oClass.majorUnit = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueAxisScaling_SetMinorUnit] = function (oClass, value) {
+ oClass.minorUnit = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_ValueAxisScaling_SetMax] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueAxisScaling_SetMin] = window['AscDFH'].CChangesDrawingsDouble2;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueAxisScaling_SetMajorUnit] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueAxisScaling_SetMinorUnit] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CValueAxisScaling() {
+ CBaseChartObject.call(this);
+ this.max = null;
+ this.min = null;
+ this.majorUnit = null;
+ this.minorUnit = null;
+ }
+
+ InitClass(CValueAxisScaling, CBaseChartObject, AscDFH.historyitem_type_ValueAxisScaling);
+
+ CValueAxisScaling.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setMax(this.max);
+ oCopy.setMin(this.min);
+ oCopy.setMajorUnit(this.majorUnit);
+ oCopy.setMinorUnit(this.minorUnit);
+ }
+
+ CValueAxisScaling.prototype.setMax = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_ValueAxisScaling_SetMax, this.max, pr));
+ this.max = pr;
+ };
+ CValueAxisScaling.prototype.setMin = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_ValueAxisScaling_SetMin, this.min, pr));
+ this.min = pr;
+ };
+ CValueAxisScaling.prototype.setMajorUnit = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_ValueAxisScaling_SetMajorUnit, this.majorUnit, pr));
+ this.majorUnit = pr;
+ };
+ CValueAxisScaling.prototype.setMinorUnit = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_ValueAxisScaling_SetMinorUnit, this.minorUnit, pr));
+ this.minorUnit = pr;
+ };
+
+
+ // ValueColorEndPosition
+ drawingsChangesMap[AscDFH.historyitem_ValueColorEndPosition_SetExtremeValue] = function (oClass, value) {
+ oClass.extremeValue = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColorEndPosition_SetNumber] = function (oClass, value) {
+ oClass.number = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColorEndPosition_SetPercent] = function (oClass, value) {
+ oClass.percent = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorEndPosition_SetExtremeValue] = window['AscDFH'].CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorEndPosition_SetNumber] = window['AscDFH'].CChangesDrawingsString;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorEndPosition_SetPercent] = window['AscDFH'].CChangesDrawingsString;
+
+ function CValueColorEndPosition() {
+ CBaseChartObject.call(this);
+ this.extremeValue = null;
+ this.number = null;
+ this.percent = null;
+ }
+
+ InitClass(CValueColorEndPosition, CBaseChartObject, AscDFH.historyitem_type_ValueColorEndPosition);
+
+ CValueColorEndPosition.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.percent) {
+ oCopy.setPercent(this.percent);
+ }
+ oCopy.setExtremeValue(this.extremeValue);
+ oCopy.setNumber(this.number);
+ }
+
+ CValueColorEndPosition.prototype.setExtremeValue = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_ValueColorEndPosition_SetExtremeValue, this.extremeValue, pr));
+ this.extremeValue = pr;
+ };
+ CValueColorEndPosition.prototype.setNumber = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_ValueColorEndPosition_SetNumber, this.number, pr));
+ this.number = pr;
+ };
+ CValueColorEndPosition.prototype.setPercent = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_ValueColorEndPosition_SetPercent, this.percent, pr));
+ this.percent = pr;
+ };
+
+
+ // ValueColorMiddlePosition
+ drawingsChangesMap[AscDFH.historyitem_ValueColorMiddlePosition_SetNumber] = function (oClass, value) {
+ oClass.number = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColorMiddlePosition_SetPercent] = function (oClass, value) {
+ oClass.percent = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorMiddlePosition_SetNumber] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorMiddlePosition_SetPercent] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CValueColorMiddlePosition() {
+ CBaseChartObject.call(this);
+ this.number = null;
+ this.percent = null;
+ }
+
+ InitClass(CValueColorMiddlePosition, CBaseChartObject, AscDFH.historyitem_type_ValueColorMiddlePosition);
+
+ CValueColorMiddlePosition.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.percent) {
+ oCopy.setPercent(this.percent);
+ }
+ oCopy.setNumber(this.number);
+ }
+
+ CValueColorMiddlePosition.prototype.setNumber = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_ValueColorMiddlePosition_SetNumber, this.number, pr));
+ this.number = pr;
+ };
+ CValueColorMiddlePosition.prototype.setPercent = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_ValueColorMiddlePosition_SetPercent, this.percent, pr));
+ this.percent = pr;
+ };
+
+
+ // ValueColorPositions
+ drawingsChangesMap[AscDFH.historyitem_ValueColorPositions_SetMin] = function (oClass, value) {
+ oClass.min = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColorPositions_SetMid] = function (oClass, value) {
+ oClass.mid = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColorPositions_SetMax] = function (oClass, value) {
+ oClass.max = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColorPositions_SetCount] = function (oClass, value) {
+ oClass.count = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorPositions_SetMin] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorPositions_SetMid] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorPositions_SetMax] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColorPositions_SetCount] = window['AscDFH'].CChangesDrawingsLong;
+
+ function CValueColorPositions() {
+ CBaseChartObject.call(this);
+ this.min = null;
+ this.mid = null;
+ this.max = null;
+ this.count = null;
+ }
+
+ InitClass(CValueColorPositions, CBaseChartObject, AscDFH.historyitem_type_ValueColorPositions);
+
+ CValueColorPositions.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ if (this.min) {
+ oCopy.setMin(this.min.createDuplicate());
+ }
+ if (this.mid) {
+ oCopy.setMid(this.mid.createDuplicate());
+ }
+ if (this.max) {
+ oCopy.setMax(this.max.createDuplicate());
+ }
+ oCopy.setCount(this.count);
+ }
+
+ CValueColorPositions.prototype.setMin = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ValueColorPositions_SetMin, this.min, pr));
+ this.min = pr;
+ this.setParentToChild(pr);
+ };
+ CValueColorPositions.prototype.setMid = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ValueColorPositions_SetMid, this.mid, pr));
+ this.mid = pr;
+ this.setParentToChild(pr);
+ };
+ CValueColorPositions.prototype.setMax = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ValueColorPositions_SetMax, this.max, pr));
+ this.max = pr;
+ this.setParentToChild(pr);
+ };
+ CValueColorPositions.prototype.setCount = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_ValueColorPositions_SetCount, this.count, pr));
+ this.count = pr;
+ };
+
+
+ // ValueColors
+ drawingsChangesMap[AscDFH.historyitem_ValueColors_SetMinColor] = function (oClass, value) {
+ oClass.minColor = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColors_SetMidColor] = function (oClass, value) {
+ oClass.midColor = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_ValueColors_SetMaxColor] = function (oClass, value) {
+ oClass.maxColor = value;
+ };
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColors_SetMinColor] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColors_SetMidColor] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ValueColors_SetMaxColor] = window['AscDFH'].CChangesDrawingsObject;
+
+ function CValueColors() {
+ CBaseChartObject.call(this);
+ this.minColor = null;
+ this.midColor = null;
+ this.maxColor = null;
+ }
+
+ InitClass(CValueColors, CBaseChartObject, AscDFH.historyitem_type_ValueColors);
+
+ CValueColors.prototype.fillObject = function (oCopy) {
+ CBaseChartObject.prototype.fillObject.call(this, oCopy);
+ oCopy.setMinColor(this.minColor);
+ oCopy.setMidColor(this.midColor);
+ oCopy.setMaxColor(this.maxColor);
+ }
+
+ CValueColors.prototype.setMinColor = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ValueColors_SetMinColor, this.minColor, pr));
+ this.minColor = pr;
+ this.setParentToChild(pr);
+ };
+ CValueColors.prototype.setMidColor = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ValueColors_SetMidColor, this.midColor, pr));
+ this.midColor = pr;
+ this.setParentToChild(pr);
+ };
+ CValueColors.prototype.setMaxColor = function (pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ValueColors_SetMaxColor, this.maxColor, pr));
+ this.maxColor = pr;
+ this.setParentToChild(pr);
+ };
+
+
+ // Simple Types
+
+
+ // // SidePos
+ // drawingsChangesMap[AscDFH.historyitem_SidePos_SetSidePos] = function (oClass, value) {
+ // oClass.sidePos = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_SidePos_SetSidePos] = window['AscDFH'].CChangesDrawingsLong;
+ // function CSidePos() {
+ // CBaseChartObject.call(this);
+ // this.sidePos = null;
+ // }
+
+ // InitClass(CSidePos, CBaseChartObject, AscDFH.historyitem_type_SidePos);
+
+ // CSidePos.prototype.setSidePos = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_SidePos_SetSidePos, this.sidePos, pr));
+ // this.sidePos = pr;
+ // };
+
+
+ // // PosAlign
+ // drawingsChangesMap[AscDFH.historyitem_PosAlign_SetPosAlign] = function (oClass, value) {
+ // oClass.posAlign = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_PosAlign_SetPosAlign] = window['AscDFH'].CChangesDrawingsLong;
+ // function CPosAlign() {
+ // CBaseChartObject.call(this);
+ // this.posAlign = null;
+ // }
+
+ // InitClass(CPosAlign, CBaseChartObject, AscDFH.historyitem_type_PosAlign);
+
+ // CPosAlign.prototype.setPosAlign = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PosAlign_SetPosAlign, this.posAlign, pr));
+ // this.posAlign = pr;
+ // };
+
+
+ // // AxisUnit
+ // drawingsChangesMap[AscDFH.historyitem_AxisUnit_SetAxisUnit] = function (oClass, value) {
+ // oClass.axisUnit = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_AxisUnit_SetAxisUnit] = window['AscDFH'].CChangesDrawingsLong;
+ // function CAxisUnit() {
+ // CBaseChartObject.call(this);
+ // this.axisUnit = null;
+ // }
+
+ // InitClass(CAxisUnit, CBaseChartObject, AscDFH.historyitem_type_AxisUnit);
+
+ // CAxisUnit.prototype.setAxisUnit = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_AxisUnit_SetAxisUnit, this.axisUnit, pr));
+ // this.axisUnit = pr;
+ // };
+
+
+ // // FormulaDirection
+ // drawingsChangesMap[AscDFH.historyitem_FormulaDirection_SetFormulaDirection] = function (oClass, value) {
+ // oClass.formulaDirection = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_FormulaDirection_SetFormulaDirection] = window['AscDFH'].CChangesDrawingsLong;
+ // function CFormulaDirection() {
+ // CBaseChartObject.call(this);
+ // this.formulaDirection = null;
+ // }
+
+ // InitClass(CFormulaDirection, CBaseChartObject, AscDFH.historyitem_type_FormulaDirection);
+
+ // CFormulaDirection.prototype.setFormulaDirection = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_FormulaDirection_SetFormulaDirection, this.formulaDirection, pr));
+ // this.formulaDirection = pr;
+ // };
+
+
+ // // IntervalClosedSide
+ // drawingsChangesMap[AscDFH.historyitem_IntervalClosedSide_SetIntervalClosedSide] = function (oClass, value) {
+ // oClass.intervalClosedSide = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_IntervalClosedSide_SetIntervalClosedSide] = window['AscDFH'].CChangesDrawingsLong;
+ // function CIntervalClosedSide() {
+ // CBaseChartObject.call(this);
+ // this.intervalClosedSide = null;
+ // }
+
+ // InitClass(CIntervalClosedSide, CBaseChartObject, AscDFH.historyitem_type_IntervalClosedSide);
+
+ // CIntervalClosedSide.prototype.setIntervalClosedSide = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_IntervalClosedSide_SetIntervalClosedSide, this.intervalClosedSide, pr));
+ // this.intervalClosedSide = pr;
+ // };
+
+
+ // // DimensionType (NumericDimensionType)
+ // drawingsChangesMap[AscDFH.historyitem_DimensionType_SetDimensionType] = function (oClass, value) {
+ // oClass.dimensionType = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_DimensionType_SetDimensionType] = window['AscDFH'].CChangesDrawingsLong;
+ // function CDimensionType() {
+ // CBaseChartObject.call(this);
+ // this.dimensionType = null;
+ // }
+
+ // InitClass(CDimensionType, CBaseChartObject, AscDFH.historyitem_type_DimensionType);
+
+ // CDimensionType.prototype.setDimensionType = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DimensionType_SetDimensionType, this.dimensionType, pr));
+ // this.dimensionType = pr;
+ // };
+
+
+ // // QuartileMethod
+ // drawingsChangesMap[AscDFH.historyitem_QuartileMethod_SetQuartileMethod] = function (oClass, value) {
+ // oClass.quartileMethod = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_QuartileMethod_SetQuartileMethod] = window['AscDFH'].CChangesDrawingsLong;
+ // function CQuartileMethod() {
+ // CBaseChartObject.call(this);
+ // this.quartileMethod = null;
+ // }
+
+ // InitClass(CQuartileMethod, CBaseChartObject, AscDFH.historyitem_type_QuartileMethod);
+
+ // CQuartileMethod.prototype.setQuartileMethod = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_QuartileMethod_SetQuartileMethod, this.quartileMethod, pr));
+ // this.quartileMethod = pr;
+ // };
+
+
+ // // DataLabelPos
+ // drawingsChangesMap[AscDFH.historyitem_DataLabelPos_SetDataLabelPos] = function (oClass, value) {
+ // oClass.dataLabelPos = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_DataLabelPos_SetDataLabelPos] = window['AscDFH'].CChangesDrawingsLong;
+ // function CDataLabelPos() {
+ // CBaseChartObject.call(this);
+ // this.dataLabelPos = null;
+ // }
+
+ // InitClass(CDataLabelPos, CBaseChartObject, AscDFH.historyitem_type_DataLabelPos);
+
+ // CDataLabelPos.prototype.setDataLabelPos = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DataLabelPos_SetDataLabelPos, this.dataLabelPos, pr));
+ // this.dataLabelPos = pr;
+ // };
+
+
+ // // SeriesLayout
+ // drawingsChangesMap[AscDFH.historyitem_SeriesLayout_SetSeriesLayout] = function (oClass, value) {
+ // oClass.seriesLayout = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_SeriesLayout_SetSeriesLayout] = window['AscDFH'].CChangesDrawingsLong;
+ // function CSeriesLayout() {
+ // CBaseChartObject.call(this);
+ // this.seriesLayout = null;
+ // }
+
+ // InitClass(CSeriesLayout, CBaseChartObject, AscDFH.historyitem_type_SeriesLayout);
+
+ // CSeriesLayout.prototype.setSeriesLayout = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_SeriesLayout_SetSeriesLayout, this.seriesLayout, pr));
+ // this.seriesLayout = pr;
+ // };
+
+
+ // // TickMarksType
+ // drawingsChangesMap[AscDFH.historyitem_TickMarksType_SetTickMarksType] = function (oClass, value) {
+ // oClass.tickMarksType = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_TickMarksType_SetTickMarksType] = window['AscDFH'].CChangesDrawingsLong;
+ // function CTickMarksType() {
+ // CBaseChartObject.call(this);
+ // this.tickMarksType = null;
+ // }
+
+ // InitClass(CTickMarksType, CBaseChartObject, AscDFH.historyitem_type_TickMarksType);
+
+ // CTickMarksType.prototype.setTickMarksType = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_TickMarksType_SetTickMarksType, this.tickMarksType, pr));
+ // this.tickMarksType = pr;
+ // };
+
+
+ // // EntityType
+ // drawingsChangesMap[AscDFH.historyitem_EntityType_SetEntityType] = function (oClass, value) {
+ // oClass.entityType = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_EntityType_SetEntityType] = window['AscDFH'].CChangesDrawingsLong;
+ // function CEntityType() {
+ // CBaseChartObject.call(this);
+ // this.entityType = null;
+ // }
+
+ // InitClass(CEntityType, CBaseChartObject, AscDFH.historyitem_type_EntityType);
+
+ // CEntityType.prototype.setEntityType = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_EntityType_SetEntityType, this.entityType, pr));
+ // this.entityType = pr;
+ // };
+
+
+ // // GeoProjectionType
+ // drawingsChangesMap[AscDFH.historyitem_GeoProjectionType_SetGeoProjectionType] = function (oClass, value) {
+ // oClass.geoProjectionType = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_GeoProjectionType_SetGeoProjectionType] = window['AscDFH'].CChangesDrawingsLong;
+ // function CGeoProjectionType() {
+ // CBaseChartObject.call(this);
+ // this.geoProjectionType = null;
+ // }
+
+ // InitClass(CGeoProjectionType, CBaseChartObject, AscDFH.historyitem_type_GeoProjectionType);
+
+ // CGeoProjectionType.prototype.setGeoProjectionType = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_GeoProjectionType_SetGeoProjectionType, this.geoProjectionType, pr));
+ // this.geoProjectionType = pr;
+ // };
+
+
+ // // GeoMappingLevel
+ // drawingsChangesMap[AscDFH.historyitem_GeoMappingLevel_SetGeoMappingLevel] = function (oClass, value) {
+ // oClass.geoMappingLevel = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_GeoMappingLevel_SetGeoMappingLevel] = window['AscDFH'].CChangesDrawingsLong;
+ // function CGeoMappingLevel() {
+ // CBaseChartObject.call(this);
+ // this.geoMappingLevel = null;
+ // }
+
+ // InitClass(CGeoMappingLevel, CBaseChartObject, AscDFH.historyitem_type_GeoMappingLevel);
+
+ // CGeoMappingLevel.prototype.setGeoMappingLevel = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_GeoMappingLevel_SetGeoMappingLevel, this.geoMappingLevel, pr));
+ // this.geoMappingLevel = pr;
+ // };
+
+
+ // // PageOrientation
+ // drawingsChangesMap[AscDFH.historyitem_PageOrientation_SetPageOrientation] = function (oClass, value) {
+ // oClass.pageOrientation = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_PageOrientation_SetPageOrientation] = window['AscDFH'].CChangesDrawingsLong;
+ // function CPageOrientation() {
+ // CBaseChartObject.call(this);
+ // this.pageOrientation = null;
+ // }
+
+ // InitClass(CPageOrientation, CBaseChartObject, AscDFH.historyitem_type_PageOrientation);
+
+ // CPageOrientation.prototype.setPageOrientation = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_PageOrientation_SetPageOrientation, this.pageOrientation, pr));
+ // this.pageOrientation = pr;
+ // };
+
+
+ // // LabelLayout (ST_ParentLabelLayout)
+ // drawingsChangesMap[AscDFH.historyitem_LabelLayout_SetLabelLayout] = function (oClass, value) {
+ // oClass.labelLayout = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_LabelLayout_SetLabelLayout] = window['AscDFH'].CChangesDrawingsLong;
+ // function CLabelLayout() {
+ // CBaseChartObject.call(this);
+ // this.labelLayout = null;
+ // }
+
+ // InitClass(CLabelLayout, CBaseChartObject, AscDFH.historyitem_type_LabelLayout);
+
+ // CLabelLayout.prototype.setPageOrientation = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_LabelLayout_SetLabelLayout, this.labelLayout, pr));
+ // this.labelLayout = pr;
+ // };
+
+
+ // // RegionLabelLayout (ST)
+ // drawingsChangesMap[AscDFH.historyitem_RegionLabelLayout_SetRegionLabelLayout] = function (oClass, value) {
+ // oClass.regionLabelLayout = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_RegionLabelLayout_SetRegionLabelLayout] = window['AscDFH'].CChangesDrawingsLong;
+ // function CRegionLabelLayout() {
+ // CBaseChartObject.call(this);
+ // this.regionLabelLayout = null;
+ // }
+
+ // InitClass(CRegionLabelLayout, CBaseChartObject, AscDFH.historyitem_type_RegionLabelLayout);
+
+ // CRegionLabelLayout.prototype.setPageOrientation = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_RegionLabelLayout_SetRegionLabelLayout, this.regionLabelLayout, pr));
+ // this.regionLabelLayout = pr;
+ // };
+
+
+ // // DoubleOrAutomatic
+ // drawingsChangesMap[AscDFH.historyitem_DoubleOrAutomatic_SetValue] = function (oClass, value) {
+ // oClass.value = value;
+ // };
+ // drawingsChangesMap[AscDFH.historyitem_DoubleOrAutomatic_SetType] = function (oClass, value) {
+ // oClass.type = value;
+ // };
+ // AscDFH.changesFactory[AscDFH.historyitem_DoubleOrAutomatic_SetValue] = window['AscDFH'].CChangesDrawingsLong;
+ // AscDFH.changesFactory[AscDFH.historyitem_DoubleOrAutomatic_SetType] = window['AscDFH'].CChangesDrawingsDouble2;
+
+ // const EDoubleOrAutomatic = { typeAuto: 0, typeDouble: 1};
+ // function CDoubleOrAutomatic() {
+ // CBaseChartObject.call(this);
+ // this.value = 0;
+ // this.type = EDoubleOrAutomatic.typeAuto;
+ // }
+
+ // InitClass(CDoubleOrAutomatic, CBaseChartObject, AscDFH.historyitem_type_DoubleOrAutomatic);
+ // CDoubleOrAutomatic.prototype.setValue = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_DoubleOrAutomatic_SetValue, this.value, pr));
+ // this.value = pr;
+ // };
+ // CDoubleOrAutomatic.prototype.setType = function (pr) {
+ // History.CanAddChanges() && History.Add(new CChangesDrawingsDouble2(this, AscDFH.historyitem_DoubleOrAutomatic_SetType, this.type, pr));
+ // this.type = pr;
+ // };
+
+ //--------------------------------------------------------export----------------------------------------------------
+ window['AscFormat'] = window['AscFormat'] || {};
+ window['AscFormat'].CAddress = CAddress;
+ window['AscFormat'].CAxis = CAxis;
+ // window['AscFormat'].CChartExTitle = CChartExTitle;
+ // window['AscFormat'].CAxisTitle = CAxisTitle;
+ window['AscFormat'].CAxisUnits = CAxisUnits;
+ window['AscFormat'].CAxisUnitsLabel = CAxisUnitsLabel;
+ window['AscFormat'].CBinning = CBinning;
+ window['AscFormat'].CCategoryAxisScaling = CCategoryAxisScaling;
+ window['AscFormat'].CChartData = CChartData;
+ window['AscFormat'].CClear = CClear;
+ window['AscFormat'].CCopyrights = CCopyrights;
+ window['AscFormat'].CData = CData;
+ window['AscFormat'].CDataLabel = CDataLabel;
+ window['AscFormat'].CDataLabelHidden = CDataLabelHidden;
+ window['AscFormat'].CDataLabels = CDataLabels;
+ window['AscFormat'].CDataLabelVisibilities = CDataLabelVisibilities;
+ window['AscFormat'].CDataPoint = CDataPoint;
+ // window['AscFormat'].CExtension = CExtension;
+ // window['AscFormat'].CExtensionList = CExtensionList;
+ // window['AscFormat'].CExternalData = CExternalData;
+ window['AscFormat'].CFormatOverride = CFormatOverride;
+ window['AscFormat'].CFormatOverrides = CFormatOverrides;
+ window['AscFormat'].CFormula = CFormula;
+ window['AscFormat'].CGeoCache = CGeoCache;
+ window['AscFormat'].CGeoChildEntities = CGeoChildEntities;
+ window['AscFormat'].CGeoChildEntitiesQuery = CGeoChildEntitiesQuery;
+ window['AscFormat'].CGeoChildEntitiesQueryResult = CGeoChildEntitiesQueryResult;
+ window['AscFormat'].CGeoChildEntitiesQueryResults = CGeoChildEntitiesQueryResults;
+ window['AscFormat'].CGeoChildTypes = CGeoChildTypes;
+ window['AscFormat'].CGeoData = CGeoData;
+ window['AscFormat'].CGeoDataEntityQuery = CGeoDataEntityQuery;
+ window['AscFormat'].CGeoDataEntityQueryResult = CGeoDataEntityQueryResult;
+ window['AscFormat'].CGeoDataEntityQueryResults = CGeoDataEntityQueryResults;
+ window['AscFormat'].CGeoDataPointQuery = CGeoDataPointQuery;
+ window['AscFormat'].CGeoDataPointToEntityQuery = CGeoDataPointToEntityQuery;
+ window['AscFormat'].CGeoDataPointToEntityQueryResult = CGeoDataPointToEntityQueryResult;
+ window['AscFormat'].CGeoDataPointToEntityQueryResults = CGeoDataPointToEntityQueryResults;
+ window['AscFormat'].CGeography = CGeography;
+ window['AscFormat'].CGeoHierarchyEntity = CGeoHierarchyEntity;
+ window['AscFormat'].CGeoLocation = CGeoLocation;
+ window['AscFormat'].CGeoLocationQuery = CGeoLocationQuery;
+ window['AscFormat'].CGeoLocationQueryResult = CGeoLocationQueryResult;
+ window['AscFormat'].CGeoLocationQueryResults = CGeoLocationQueryResults;
+ window['AscFormat'].CGeoLocations = CGeoLocations;
+ window['AscFormat'].CGeoPolygon = CGeoPolygon;
+ window['AscFormat'].CGeoPolygons = CGeoPolygons;
+ window['AscFormat'].CGridlines = CGridlines;
+ // window['AscFormat'].CHeaderFooter = CHeaderFooter;
+ // window['AscFormat'].CChartExLegend = CChartExLegend;
+ // window['AscFormat'].CNumberColorPosition = CNumberColorPosition;
+ // window['AscFormat'].CNumberFormat = CNumberFormat;
+
+ // window['AscFormat'].CPageMargins = CPageMargins;
+ // window['AscFormat'].CPageSetup = CPageSetup;
+ // window['AscFormat'].CParentLabelLayout = CParentLabelLayout;
+ window['AscFormat'].CPercentageColorPosition = CPercentageColorPosition;
+ // window['AscFormat'].CChartExPlotArea = CChartExPlotArea;
+ window['AscFormat'].CPlotAreaRegion = CPlotAreaRegion;
+ window['AscFormat'].CPlotSurface = CPlotSurface;
+ // window['AscFormat'].CPrintSettings = CPrintSettings;
+ window['AscFormat'].CSeries = CSeries;
+ window['AscFormat'].CSeriesElementVisibilities = CSeriesElementVisibilities;
+ window['AscFormat'].CSeriesLayoutProperties = CSeriesLayoutProperties;
+ window['AscFormat'].CStatistics = CStatistics;
+ window['AscFormat'].CDimension = CDimension;
+ window['AscFormat'].CNumericDimension = CNumericDimension;
+ window['AscFormat'].CStringDimension = CStringDimension;
+ window['AscFormat'].CSubtotals = CSubtotals;
+ // window['AscFormat'].CText = CText;
+ window['AscFormat'].CTextData = CTextData;
+ // window['AscFormat'].CTickLabels = CTickLabels;
+ window['AscFormat'].CTickMarks = CTickMarks;
+ window['AscFormat'].CValueAxisScaling = CValueAxisScaling;
+ window['AscFormat'].CValueColorEndPosition = CValueColorEndPosition;
+ window['AscFormat'].CValueColorMiddlePosition = CValueColorMiddlePosition;
+ window['AscFormat'].CValueColorPositions = CValueColorPositions;
+ window['AscFormat'].CValueColors = CValueColors;
+ // ---------------------------------------------
+ // Simple Types
+ // ---------------------------------------------
+ // window['AscFormat'].CSidePos = CSidePos;
+ // window['AscFormat'].CPosAlign = CPosAlign;
+ // window['AscFormat'].CAxisUnit = CAxisUnit;
+ // window['AscFormat'].CFormulaDirection = CFormulaDirection;
+ // window['AscFormat'].CIntervalClosedSide = CIntervalClosedSide;
+ // window['AscFormat'].CDimensionType = CDimensionType;
+ // window['AscFormat'].CQuartileMethod = CQuartileMethod;
+ // window['AscFormat'].CDataLabelPos = CDataLabelPos;
+ // window['AscFormat'].CSeriesLayout = CSeriesLayout;
+ // window['AscFormat'].CTickMarksType = CTickMarksType;
+ // window['AscFormat'].CEntityType = CEntityType;
+ // window['AscFormat'].CGeoProjectionType = CGeoProjectionType;
+ // window['AscFormat'].CGeoMappingLevel = CGeoMappingLevel;
+ // window['AscFormat'].CPageOrientation = CPageOrientation;
+ // window['AscFormat'].CLabelLayout = CLabelLayout;
+ // window['AscFormat'].CRegionLabelLayout = CRegionLabelLayout;
+ // window['AscFormat'].CDoubleOrAutomatic = CDoubleOrAutomatic;
+
+ window['AscFormat'].SERIES_LAYOUT_BOX_WHISKER = SERIES_LAYOUT_BOX_WHISKER;
+ window['AscFormat'].SERIES_LAYOUT_CLUSTERED_COLUMN = SERIES_LAYOUT_CLUSTERED_COLUMN;
+ window['AscFormat'].SERIES_LAYOUT_FUNNEL = SERIES_LAYOUT_FUNNEL;
+ window['AscFormat'].SERIES_LAYOUT_PARETO_LINE = SERIES_LAYOUT_PARETO_LINE;
+ window['AscFormat'].SERIES_LAYOUT_REGION_MAP = SERIES_LAYOUT_REGION_MAP;
+ window['AscFormat'].SERIES_LAYOUT_SUNBURST = SERIES_LAYOUT_SUNBURST;
+ window['AscFormat'].SERIES_LAYOUT_TREEMAP = SERIES_LAYOUT_TREEMAP;
+ window['AscFormat'].SERIES_LAYOUT_WATERFALL = SERIES_LAYOUT_WATERFALL;
+
+ window['AscFormat'].DATA_LABEL_POS_BEST_FIT = DATA_LABEL_POS_BEST_FIT;
+ window['AscFormat'].DATA_LABEL_POS_B = DATA_LABEL_POS_B;
+ window['AscFormat'].DATA_LABEL_POS_CTR = DATA_LABEL_POS_CTR;
+ window['AscFormat'].DATA_LABEL_POS_IN_BASE = DATA_LABEL_POS_IN_BASE;
+ window['AscFormat'].DATA_LABEL_POS_IN_END = DATA_LABEL_POS_IN_END;
+ window['AscFormat'].DATA_LABEL_POS_L = DATA_LABEL_POS_L;
+ window['AscFormat'].DATA_LABEL_POS_OUT_END = DATA_LABEL_POS_OUT_END;
+ window['AscFormat'].DATA_LABEL_POS_R = DATA_LABEL_POS_R;
+ window['AscFormat'].DATA_LABEL_POS_T = DATA_LABEL_POS_T;
+
+ window['AscFormat'].PARENT_LABEL_LAYOUT_NONE = PARENT_LABEL_LAYOUT_NONE;
+ window['AscFormat'].PARENT_LABEL_LAYOUT_BANNER = PARENT_LABEL_LAYOUT_BANNER;
+ window['AscFormat'].PARENT_LABEL_LAYOUT_OVERLAPPING = PARENT_LABEL_LAYOUT_OVERLAPPING;
+
+ window['AscFormat'].REGION_LABEL_LAYOUT_NONE = REGION_LABEL_LAYOUT_NONE;
+ window['AscFormat'].REGION_LABEL_LAYOUT_BEST_FIT_ONLY = REGION_LABEL_LAYOUT_BEST_FIT_ONLY;
+ window['AscFormat'].REGION_LABEL_LAYOUT_SHOW_ALL = REGION_LABEL_LAYOUT_SHOW_ALL;
+
+ window['AscFormat'].INTERVAL_CLOSED_SIDE_L = INTERVAL_CLOSED_SIDE_L;
+ window['AscFormat'].INTERVAL_CLOSED_SIDE_R = INTERVAL_CLOSED_SIDE_R;
+
+ window['AscFormat'].AXIS_UNIT_HUNDREDS = AXIS_UNIT_HUNDREDS;
+ window['AscFormat'].AXIS_UNIT_THOUSANDS = AXIS_UNIT_THOUSANDS;
+ window['AscFormat'].AXIS_UNIT_TEN_THOUSANDS = AXIS_UNIT_TEN_THOUSANDS;
+ window['AscFormat'].AXIS_UNIT_HUNDRED_THOUSANDS = AXIS_UNIT_HUNDRED_THOUSANDS;
+ window['AscFormat'].AXIS_UNIT_MILLIONS = AXIS_UNIT_MILLIONS;
+ window['AscFormat'].AXIS_UNIT_TEN_MILLIONS = AXIS_UNIT_TEN_MILLIONS;
+ window['AscFormat'].AXIS_UNIT_HUNDRED_MILLIONS = AXIS_UNIT_HUNDRED_MILLIONS;
+ window['AscFormat'].AXIS_UNIT_BILLIONS = AXIS_UNIT_BILLIONS;
+ window['AscFormat'].AXIS_UNIT_TRILLIONS = AXIS_UNIT_TRILLIONS;
+ window['AscFormat'].AXIS_UNIT_PERCENTAGE = AXIS_UNIT_PERCENTAGE;
+
+ window['AscFormat'].SIDE_POS_L = SIDE_POS_L;
+ window['AscFormat'].SIDE_POS_T = SIDE_POS_T;
+ window['AscFormat'].SIDE_POS_R = SIDE_POS_R;
+ window['AscFormat'].SIDE_POS_B = SIDE_POS_B;
+
+ window['AscFormat'].POS_ALIGN_MIN = POS_ALIGN_MIN;
+ window['AscFormat'].POS_ALIGN_CTR = POS_ALIGN_CTR;
+ window['AscFormat'].POS_ALIGN_MAX = POS_ALIGN_MAX;
+
+ window['AscFormat'].TICK_MARKS_TYPE_IN = TICK_MARKS_TYPE_IN;
+ window['AscFormat'].TICK_MARKS_TYPE_OUT = TICK_MARKS_TYPE_OUT;
+ window['AscFormat'].TICK_MARKS_TYPE_CROSS = TICK_MARKS_TYPE_CROSS;
+ window['AscFormat'].TICK_MARKS_TYPE_NONE = TICK_MARKS_TYPE_NONE;
+
+ window['AscFormat'].QUARTILE_METHOD_INCLUSIVE = QUARTILE_METHOD_INCLUSIVE;
+ window['AscFormat'].QUARTILE_METHOD_EXCLUSIVE = QUARTILE_METHOD_EXCLUSIVE;
+
+ window['AscFormat'].STRING_DIMENSION_TYPE_CAT = STRING_DIMENSION_TYPE_CAT;
+ window['AscFormat'].STRING_DIMENSION_TYPE_COLOR_STR = STRING_DIMENSION_TYPE_COLOR_STR;
+
+ window['AscFormat'].NUMERIC_DIMENSION_TYPE_VAL = NUMERIC_DIMENSION_TYPE_VAL;
+ window['AscFormat'].NUMERIC_DIMENSION_TYPE_X = NUMERIC_DIMENSION_TYPE_X;
+ window['AscFormat'].NUMERIC_DIMENSION_TYPE_Y = NUMERIC_DIMENSION_TYPE_Y;
+ window['AscFormat'].NUMERIC_DIMENSION_TYPE_SIZE = NUMERIC_DIMENSION_TYPE_SIZE;
+ window['AscFormat'].NUMERIC_DIMENSION_TYPE_COLOR_VAL = NUMERIC_DIMENSION_TYPE_COLOR_VAL;
+
+ window['AscFormat'].FORMULA_DIRECTION_COL = FORMULA_DIRECTION_COL;
+ window['AscFormat'].FORMULA_DIRECTION_ROW = FORMULA_DIRECTION_ROW;
+})(window);
diff --git a/common/Drawings/Format/ChartFormat.js b/common/Drawings/Format/ChartFormat.js
index 5b4a2a1d38..5f075dfbe3 100644
--- a/common/Drawings/Format/ChartFormat.js
+++ b/common/Drawings/Format/ChartFormat.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -101,6 +101,9 @@
drawingsChangesMap[AscDFH.historyitem_PlotArea_SetDateAx] = function(oClass, value) {
oClass.dateAx = value;
};
+ drawingsChangesMap[AscDFH.historyitem_PlotArea_SetPlotAreaRegion] = function(oClass, value) {
+ oClass.plotAreaRegion = value;
+ };
drawingsChangesMap[AscDFH.historyitem_PlotArea_SetDTable] = function(oClass, value) {
oClass.dTable = value;
};
@@ -544,6 +547,9 @@
oClass.strRef = value;
oClass.onChangeDataRefs();
};
+ drawingsChangesMap[AscDFH.historyitem_ChartText_SetTxData] = function(oClass, value) {
+ oClass.txData = value;
+ };
drawingsChangesMap[AscDFH.historyitem_ChartText_SetRich] = function(oClass, value) {
oClass.rich = value;
};
@@ -723,6 +729,9 @@
drawingsChangesMap[AscDFH.historyitem_Legend_SetSpPr] = function(oClass, value) {
oClass.spPr = value;
};
+ drawingsChangesMap[AscDFH.historyitem_Legend_SetAlign] = function(oClass, value) {
+ oClass.align = value;
+ };
drawingsChangesMap[AscDFH.historyitem_Legend_SetTxPr] = function(oClass, value) {
oClass.txPr = value;
};
@@ -838,6 +847,9 @@
drawingsChangesMap[AscDFH.historyitem_NumLit_SetPtCount] = function(oClass, value) {
oClass.ptCount = value;
};
+ drawingsChangesMap[AscDFH.historyitem_NumLit_SetName] = function(oClass, value) {
+ oClass.name = value;
+ };
drawingsChangesMap[AscDFH.historyitem_OfPieChart_SetDLbls] = function(oClass, value) {
oClass.dLbls = value;
};
@@ -1034,6 +1046,9 @@
drawingsChangesMap[AscDFH.historyitem_StrCache_SetPtCount] = function(oClass, value) {
oClass.ptCount = value;
};
+ drawingsChangesMap[AscDFH.historyitem_StrCache_SetName] = function(oClass, value) {
+ oClass.name = value;
+ };
drawingsChangesMap[AscDFH.historyitem_StrPoint_SetIdx] = function(oClass, value) {
oClass.idx = value;
};
@@ -1089,6 +1104,12 @@
drawingsChangesMap[AscDFH.historyitem_Title_SetTxPr] = function(oClass, value) {
oClass.txPr = value;
};
+ drawingsChangesMap[AscDFH.historyitem_Title_SetAlign] = function(oClass, value) {
+ oClass.align = value;
+ };
+ drawingsChangesMap[AscDFH.historyitem_Title_SetPos] = function(oClass, value) {
+ oClass.pos = value;
+ };
drawingsChangesMap[AscDFH.historyitem_Trendline_SetBackward] = function(oClass, value) {
oClass.backward = value;
};
@@ -1612,6 +1633,7 @@
AscDFH.changesFactory[AscDFH.historyitem_Marker_SetSymbol] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_MultiLvlStrCache_SetPtCount] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_NumLit_SetPtCount] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_NumLit_SetName] = window['AscDFH'].CChangesDrawingsString;
AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetGapWidth] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetOfPieType] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetSecondPieSize] = window['AscDFH'].CChangesDrawingsLong;
@@ -1628,6 +1650,7 @@
AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetOrder] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_StrCache_SetPtCount] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_StrCache_SetName] = window['AscDFH'].CChangesDrawingsString;
AscDFH.changesFactory[AscDFH.historyitem_StringLiteral_SetPtCount] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_StrPoint_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_SurfaceSeries_SetIdx] = window['AscDFH'].CChangesDrawingsLong;
@@ -1695,6 +1718,7 @@
AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetTx] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetParent] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetPlotAreaRegion] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetDTable] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetLayout] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
@@ -1768,6 +1792,7 @@
AscDFH.changesFactory[AscDFH.historyitem_Cat_SetStrLit] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_Cat_SetStrRef] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartFormatSetChart] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_ChartText_SetTxData] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartText_SetRich] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartText_SetStrRef] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetLeaderLines] = window['AscDFH'].CChangesDrawingsObject;
@@ -1787,6 +1812,7 @@
AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_Legend_SetLayout] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_Legend_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Legend_SetAlign] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_Legend_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_LegendEntry_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetDLbls] = window['AscDFH'].CChangesDrawingsObject;
@@ -1851,6 +1877,8 @@
AscDFH.changesFactory[AscDFH.historyitem_Title_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_Title_SetTx] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_Title_SetTxPr] = window['AscDFH'].CChangesDrawingsObject;
+ AscDFH.changesFactory[AscDFH.historyitem_Title_SetAlign] = window['AscDFH'].CChangesDrawingsLong;
+ AscDFH.changesFactory[AscDFH.historyitem_Title_SetPos] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetSpPr] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetTrendlineLbl] = window['AscDFH'].CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_UpDownBars_SetDownBars] = window['AscDFH'].CChangesDrawingsObject;
@@ -1991,13 +2019,6 @@
AscDFH.changesFactory[AscDFH.historyitem_MarkerLayoutSymbol] = window['AscDFH'].CChangesDrawingsLong;
AscDFH.changesFactory[AscDFH.historyitem_MarkerLayoutSize] = window['AscDFH'].CChangesDrawingsLong;
- AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryLnRef] = AscFormat.StyleRef;
- AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryFillRef] = AscFormat.StyleRef;
- AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryEffectRef] = AscFormat.StyleRef;
- AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryFontRef] = AscFormat.FontRef;
- AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryBodyPr] = AscFormat.CBodyPr;
-
-
drawingContentChanges[AscDFH.historyitem_PlotArea_AddAxis] =
drawingContentChanges[AscDFH.historyitem_BarChart_AddAxId] =
drawingContentChanges[AscDFH.historyitem_AreaChart_AddAxId] =
@@ -2116,9 +2137,17 @@
}
InitClass(CBaseChartObject, CBaseFormatObject, AscDFH.historyitem_type_Unknown);
+ CBaseChartObject.prototype.generateSmartArtDrawingPart = function () {};
CBaseChartObject.prototype.notAllowedWithoutId = function() {
return true;
};
+ CBaseChartObject.prototype.isChartEx = function() {
+ const oChartSpace = this.getChartSpace();
+ if(oChartSpace) {
+ return oChartSpace.isChartEx();
+ }
+ return false;
+ };
CBaseChartObject.prototype.getChartSpace = function() {
var oCurElement = this;
while(oCurElement) {
@@ -2184,7 +2213,7 @@
if(oSpPr && oSpPr.Fill) {
oFill = oSpPr.Fill.createDuplicate();
var bIsSpecialStyle = oStyleEntry.isSpecialStyle();
- oFill.checkPhColor(oFillRefUnicolor || aColors[nIdx], bIsSpecialStyle);
+ oFill.checkPhColor(oFillRefUnicolor || aColors[nIdx]);
if(bIsSpecialStyle) {
if(AscFormat.isRealNumber(nIdx)) {
var nPatternType = oStyleEntry.getSpecialPatternType(nIdx);
@@ -2199,7 +2228,7 @@
oLn = oTheme.getLnStyle(oLineRef.idx, oLineRefUnicolor);
if(oSpPr && oSpPr.ln) {
oLn = oSpPr.ln.createDuplicate();
- oLn.Fill.checkPhColor(oLineRefUnicolor, false);
+ oLn.Fill.checkPhColor(oLineRefUnicolor);
}
if(AscFormat.isRealNumber(oLn.w) && AscFormat.isRealNumber(oStyleEntry.lineWidthScale)) {
oLn.w *= oStyleEntry.lineWidthScale;
@@ -2224,7 +2253,7 @@
if(oStyleEntry.defRPr) {
oTextPr.Merge(oStyleEntry.defRPr);
if(oTextPr.Unifill) {
- oTextPr.Unifill.checkPhColor(oFontUnicolor, false);
+ oTextPr.Unifill.checkPhColor(oFontUnicolor);
}
}
oParaPr.DefaultRunPr = oTextPr;
@@ -2944,6 +2973,7 @@
style.TextPr.Merge(chart_text_pr);
}
}
+ let bChartEx = this.isChartEx && this.isChartEx();
if(this instanceof CTitle || this.parent instanceof CTitle) {
style.TextPr.Bold = true;
if(this.parent instanceof CChart || (this.parent && (this.parent.parent instanceof CChart))) {
@@ -2952,6 +2982,25 @@
else
style.TextPr.FontSize = 18;
}
+
+
+ if(bChartEx) {
+ if (oChartSpace.chartStyle && oChartSpace.chartColors) {
+ let oTxPr;
+ if(this.parent instanceof CChart ) {
+ if (oChartSpace.chartStyle && oChartSpace.chartColors) {
+ oTxPr = oChartSpace.getTxPrFormStyleEntry(oChartSpace.chartStyle.title, oChartSpace.chartColors.generateColors(1), 0);
+ }
+ }
+ else if(this.parent instanceof AscFormat.CAxis) {
+ oTxPr = oChartSpace.getTxPrFormStyleEntry(oChartSpace.chartStyle.axisTitle, oChartSpace.chartColors.generateColors(1), 0);
+ }
+ if(oTxPr) {
+ let oParaPr = oTxPr.content.Content[0].Pr;
+ style.TextPr.Merge(oParaPr.DefaultRunPr);
+ }
+ }
+ }
}
if(this instanceof CalcLegendEntry && this.legend) {
oParaPr = this.legend.getTxPrParaPr();
@@ -2960,6 +3009,16 @@
if(oParaPr.DefaultRunPr)
style.TextPr.Merge(oParaPr.DefaultRunPr);
}
+ if(bChartEx) {
+ if (oChartSpace.chartStyle && oChartSpace.chartColors) {
+ let oTxPr;
+ oTxPr = oChartSpace.getTxPrFormStyleEntry(oChartSpace.chartStyle.legend, oChartSpace.chartColors.generateColors(1), 0);
+ if(oTxPr) {
+ let oParaPr = oTxPr.content.Content[0].Pr;
+ style.TextPr.Merge(oParaPr.DefaultRunPr);
+ }
+ }
+ }
if(AscFormat.isRealNumber(this.idx)) {
var aLegendEntries = this.legend.legendEntryes;
for(var i = 0; i < aLegendEntries.length; ++i) {
@@ -2977,6 +3036,16 @@
}
}
+ if(this.parent && this.parent instanceof AscFormat.CAxis) {
+ if (oChartSpace.chartStyle && oChartSpace.chartColors) {
+ let oTxPr;
+ oTxPr = oChartSpace.getTxPrFormStyleEntry(oChartSpace.chartStyle.categoryAxis, oChartSpace.chartColors.generateColors(1), 0);
+ if(oTxPr) {
+ let oParaPr = oTxPr.content.Content[0].Pr;
+ style.TextPr.Merge(oParaPr.DefaultRunPr);
+ }
+ }
+ }
if(!(this instanceof CTitle)) {
if(this.parent) {
oParaPr = this.parent.getTxPrParaPr();
@@ -3079,6 +3148,12 @@
}
return "";
};
+ CDLbl.prototype.getCategoryName = function() {
+ if(this.series && this.pt) {
+ return this.series.getCatName(this.pt.idx);
+ }
+ return "";
+ };
CDLbl.prototype.getDefaultTextForTxBody = function() {
var compiled_string = "";
var separator;
@@ -3114,6 +3189,11 @@
compiled_string += separator;
compiled_string += this.getPercentageString();
}
+ if (this.showChartExVal) {
+ //TODO: format the passed number
+ const val = this.pt;
+ compiled_string += this.getValueString();
+ }
return compiled_string;
};
CDLbl.prototype.getMaxWidth = function(bodyPr) {
@@ -3328,7 +3408,12 @@
this.txBody = this.tx.rich;
this.txBody.parent = this;
}
+ else if(this.txPr && this.txPr.content && !this.txPr.content.IsEmpty()) {
+ this.txBody = this.txPr.createDuplicate();
+ this.txBody.parent = this;
+ }
else {
+
if(this.parent && this.parent.getObjectType() === AscDFH.historyitem_type_TrendLine) {
this.txBody = AscFormat.CreateTextBodyFromString("", this.getDrawingDocument(), this);
this.parent.fillEquationContent( this.txBody.content);
@@ -3562,6 +3647,10 @@
History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DLbl_SetShowVal, this.showVal, pr));
this.showVal = pr;
};
+ CDLbl.prototype.setShowChartExVal = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DLbl_SetShowVal, this.setShowChartExVal, pr));
+ this.showChartExVal = pr;
+ };
CDLbl.prototype.setShowDlblsRange = function(pr) {
History.CanAddChanges() && History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DLbl_SetShowDLblsRange, this.showDlblsRange, pr));
this.showDlblsRange = pr;
@@ -3812,6 +3901,9 @@
return "";
}
}
+ if(this.tx && this.tx.txData && this.tx.txData.v) {
+ return this.tx.txData.v;
+ }
return AscCommon.translateManager.getValue('Series') + " " + (this.idx + 1);
};
CSeriesBase.prototype.handleUpdateFill = function() {
@@ -4033,7 +4125,7 @@
return new CDataRefs([]);
};
CSeriesBase.prototype.getTxDataRefs = function() {
- if(this.tx) {
+ if(this.tx && this.tx.getDataRefs) {
return this.tx.getDataRefs();
}
return new CDataRefs([]);
@@ -4684,9 +4776,12 @@
oChartSpace.onDataUpdate();
};
CSeriesBase.prototype["asc_setOrder"] = CSeriesBase.prototype.asc_setOrder;
- CSeriesBase.prototype.asc_getIdx = function() {
+ CSeriesBase.prototype.getIdx = function() {
return this.idx;
};
+ CSeriesBase.prototype.asc_getIdx = function() {
+ return this.getIdx();
+ };
CSeriesBase.prototype["asc_getIdx"] = CSeriesBase.prototype.asc_getIdx;
CSeriesBase.prototype.asc_MoveUp = function() {
var oChartSpace = this.getChartSpace();
@@ -4824,6 +4919,7 @@
function CPlotArea() {
CBaseChartObject.call(this);
+ this.plotAreaRegion = null;
this.charts = [];
this.dTable = null;
this.layout = null;
@@ -4854,6 +4950,10 @@
InitClass(CPlotArea, CBaseChartObject, AscDFH.historyitem_type_PlotArea);
CPlotArea.prototype.Refresh_RecalcData = function(data) {
switch(data.Type) {
+ case AscDFH.historyitem_PlotArea_SetPlotAreaRegion:
+ {
+ break;
+ }
case AscDFH.historyitem_CommonChartFormat_SetParent:
{
break;
@@ -4942,6 +5042,9 @@
if(this.spPr) {
oCopy.setSpPr(this.spPr.createDuplicate());
}
+ if(this.plotAreaRegion) {
+ oCopy.setPlotAreaRegion(this.plotAreaRegion.createDuplicate());
+ }
var len = this.axId.length;
for(i = 0; i < len; i++) {
@@ -5157,6 +5260,11 @@
}
}
};
+ CPlotArea.prototype.setPlotAreaRegion = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_PlotArea_SetPlotAreaRegion, this.plotAreaRegion, pr));
+ this.plotAreaRegion = pr;
+ this.setParentToChild(pr);
+ };
CPlotArea.prototype.setDTable = function(pr) {
History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_PlotArea_SetDTable, this.dTable, pr));
this.dTable = pr;
@@ -5279,6 +5387,9 @@
CPlotArea.prototype.canMove = function() {
return true;
};
+ CPlotArea.prototype.canResize = function() {
+ return true;
+ };
CPlotArea.prototype.reindexSeries = function() {
if(this.parent) {
this.parent.reindexSeries();
@@ -5881,6 +5992,18 @@
if(!this.parent) {
return;
}
+ if(this.isChartEx()) {
+ let oChartSpace = this.getChartSpace();
+ if(!oChartSpace) return;
+ let settings = AscFormat.DrawingObjectsController.prototype.getPropsFromChart(oChartSpace);
+ settings.type = nType;
+ let aSeries = AscFormat.getChartSeries(settings);
+ let oNewChartSpace = AscFormat.DrawingObjectsController.prototype._getChartSpace.call(this, aSeries, settings, true);
+ if(oNewChartSpace) {
+ oChartSpace.setChart(oNewChartSpace.chart.createDuplicate());
+ }
+ return;
+ }
if(this.charts.length < 1) {
return;
}
@@ -5920,6 +6043,9 @@
}
};
CPlotArea.prototype.getAllSeries = function() {
+ if(this.plotAreaRegion) {
+ return this.plotAreaRegion.getAllSeries();
+ }
var _ret = [];
var aCharts = this.charts;
for(var i = 0; i < aCharts.length; ++i) {
@@ -5931,7 +6057,10 @@
return _ret;
};
CPlotArea.prototype.getMaxSeriesIdx = function() {
- var aAllSeries = this.getAllSeries();
+ if(this.plotAreaRegion) {
+ return this.plotAreaRegion.getMaxSeriesIdx();
+ }
+ let aAllSeries = this.getAllSeries();
if(aAllSeries.length === 0) {
return -1;
}
@@ -6452,7 +6581,22 @@
}
}
};
-
+ CPlotArea.prototype.updateReferences = function(bDisplayEmptyCellsAs, bDisplayHidden) {
+ const aCharts = this.charts;
+ for (let nChart = 0; nChart < aCharts.length; ++nChart) {
+ this.charts[nChart].updateReferences(bDisplayEmptyCellsAs, bDisplayHidden);
+ }
+ const aAxes = this.axId;
+ for (let nAx = 0; nAx < aAxes.length; ++nAx) {
+ aAxes[nAx].updateReferences();
+ }
+ if(this.plotAreaRegion) {
+ this.plotAreaRegion.updateReferences(bDisplayEmptyCellsAs, bDisplayHidden);
+ }
+ };
+ CPlotArea.prototype.isChartEx = function() {
+ return !!this.plotAreaRegion;
+ };
function getIsMarkerByType(nType) {
if(nType === Asc.c_oAscChartTypeSettings.scatter ||
nType === Asc.c_oAscChartTypeSettings.scatterLineMarker ||
@@ -7096,6 +7240,12 @@
}
return this.parent.getMaxSeriesIdx();
};
+ CChartBase.prototype.updateReferences = function(bDisplayEmptyCellsAs, bDisplayHidden) {
+ for(let nSeries = 0; nSeries < this.series.length; ++nSeries) {
+ this.series[nSeries].updateData(bDisplayEmptyCellsAs, bDisplayHidden);
+ }
+ };
+
function CBarChart() {
CChartBase.call(this);
this.barDir = null;
@@ -7592,6 +7742,24 @@
CAxisBase.prototype.onUpdate = function() {
this.onChartInternalUpdate();
};
+ CAxisBase.prototype.getFormatCode = function() {
+ let oNumFmt = this.numFmt;
+ let sFormatCode = null;
+
+ if(oNumFmt) {
+ if(oNumFmt.sourceLinked) {
+ return this.getSourceFormatCode ? this.getSourceFormatCode() : "General";
+ }
+ sFormatCode = oNumFmt.formatCode;
+ if(typeof sFormatCode === "string" && sFormatCode.length > 0) {
+ return sFormatCode;
+ }
+ return "General";
+ }
+ else {
+ return this.getSourceFormatCode ? this.getSourceFormatCode() : "General";
+ }
+ };
CAxisBase.prototype.Refresh_RecalcData = function() {
this.onUpdate();
};
@@ -7769,7 +7937,11 @@
CAxisBase.prototype.getSourceFormatCode = function() {
return "General";
};
+ CAxisBase.prototype.isChartExCat = function() {
+ return false;
+ };
CAxisBase.prototype.updateNumFormat = function() {
+ if(this.isChartEx()) return;
var oNumFmt = this.numFmt;
if(!oNumFmt) {
oNumFmt = new CNumFmt();
@@ -8107,6 +8279,13 @@
return this.getObjectType() === AscDFH.historyitem_type_SerAx;
};
+ CAxisBase.prototype.updateReferences = function() {
+ if(this.title) {
+ this.title.updateReferences();
+ }
+ this.updateNumFormat();
+ };
+
function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
}
@@ -8888,24 +9067,6 @@
}
}
};
- CValAx.prototype.getFormatCode = function() {
- let oNumFmt = this.numFmt;
- let sFormatCode = null;
-
- if(oNumFmt) {
- if(oNumFmt.sourceLinked) {
- return this.getSourceFormatCode();
- }
- sFormatCode = oNumFmt.formatCode;
- if(typeof sFormatCode === "string" && sFormatCode.length > 0) {
- return sFormatCode;
- }
- return "General";
- }
- else {
- return this.getSourceFormatCode();
- }
- };
CValAx.prototype.getSourceFormatCode = function() {
var oPlotArea = this.getPlotArea();
var sDefault = "General";
@@ -9254,6 +9415,7 @@
this.rich = null;
this.strRef = null;
this.chart = null;
+ this.txData = null;
}
InitClass(CChartText, CBaseChartObject, AscDFH.historyitem_type_ChartText);
@@ -9267,6 +9429,9 @@
if(this.strRef) {
oCopy.setStrRef(this.strRef.createDuplicate());
}
+ if(this.txData) {
+ oCopy.setTxData(this.txData.createDuplicate());
+ }
};
CChartText.prototype.getStyles = CDLbl.prototype.getStyles;
CChartText.prototype.Get_Theme = CDLbl.prototype.Get_Theme;
@@ -9290,6 +9455,11 @@
this.strRef = tx.strRef;
}
};
+ CChartText.prototype.setTxData = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartText_SetTxData, this.txData, pr));
+ this.txData = pr;
+ this.setParentToChild(pr);
+ };
CChartText.prototype.setRich = function(pr) {
History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartText_SetRich, this.rich, pr));
this.rich = pr;
@@ -10135,6 +10305,7 @@
this.overlay = false;
this.spPr = null;
this.txPr = null;
+ this.align = null;
this.rot = 0;
this.flipH = false;
@@ -10210,6 +10381,9 @@
if(this.txPr) {
oCopy.setTxPr(this.txPr.createDuplicate());
}
+ if(this.align !== null) {
+ oCopy.setAlign(this.align);
+ }
};
CLegend.prototype.getCalcEntryByIdx = function(idx, drawingDocument) {
for(var i = 0; i < this.calcEntryes.length; ++i) {
@@ -10263,6 +10437,9 @@
CLegend.prototype.canMove = function() {
return true;
};
+ CLegend.prototype.canResize = function() {
+ return true;
+ };
CLegend.prototype.selectObject = function() {
};
@@ -10413,6 +10590,10 @@
this.spPr = spPr;
this.setParentToChild(spPr);
};
+ CLegend.prototype.setAlign = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Legend_SetAlign, this.align, pr));
+ this.align = pr;
+ };
CLegend.prototype.setTxPr = function(txPr) {
History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Legend_SetTxPr, this.txPr, txPr));
this.txPr = txPr;
@@ -11615,7 +11796,15 @@
}
}
};
-
+ CStrRef.prototype.onUpdateCache = function() {
+ CChartRefBase.prototype.onUpdateCache.call(this);
+ if(this.parent && this.parent.getObjectType() === AscDFH.historyitem_type_ChartText) {
+ let oParentObject = this.parent.parent;
+ if(oParentObject && oParentObject.recalcInfo && oParentObject.recalcInfo.recalculateTxBody === false) {
+ oParentObject.recalcInfo.recalculateTxBody = true;
+ }
+ }
+ };
function CNumericPoint() {
CBaseChartObject.call(this);
this.formatCode = null;
@@ -11698,6 +11887,8 @@
this.formatCode = null;
this.pts = [];
this.ptCount = null;
+
+ this.name = null;
}
InitClass(CNumLit, CBaseChartObject, AscDFH.historyitem_type_NumLit);
@@ -11717,6 +11908,9 @@
oCopy.addPt(this.pts[i].createDuplicate());
}
oCopy.setPtCount(this.ptCount);
+ if(this.name) {
+ oCopy.setName(this.name);
+ }
};
CNumLit.prototype.getPtByIndex = function(idx) {
if(this.pts[idx] && this.pts[idx].idx === idx)
@@ -11961,6 +12155,10 @@
}
return "General";
};
+ CNumLit.prototype.setName = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_NumLit_SetName, this.name, pr));
+ this.name = pr;
+ };
function COfPieChart() {
CChartBase.call(this);
@@ -13242,6 +13440,7 @@
CBaseChartObject.call(this);
this.pts = [];
this.ptCount = null;
+ this.name = null;
}
InitClass(CStrCache, CBaseChartObject, AscDFH.historyitem_type_StrCache);
@@ -13294,6 +13493,10 @@
History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_StrCache_SetPtCount, this.ptCount, pr));
this.ptCount = pr;
};
+ CStrCache.prototype.setName = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_StrCache_SetName, this.name, pr));
+ this.name = pr;
+ };
CStrCache.prototype.update = function(sFormula) {
AscFormat.ExecuteNoHistory(function() {
var str_cache = this;
@@ -13630,6 +13833,10 @@
this.localTransform = new CMatrix();
this.localTransformText = new CMatrix();
+ //for chart title only (but not axis title)
+ this.align = null;
+ this.pos = null;
+
this.recalcInfo =
{
recalculateTxBody: true,
@@ -13812,6 +14019,8 @@
if(this.txPr) {
oCopy.setTxPr(this.txPr.createDuplicate());
}
+ oCopy.setPos(this.pos);
+ oCopy.setAlign(this.align);
};
CTitle.prototype.paragraphAdd = function(paraItem, bRecalculate) {
var content = this.getDocContent();
@@ -13927,6 +14136,14 @@
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
};
+ CTitle.prototype.setAlign = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Title_SetAlign, this.align, pr));
+ this.align = pr;
+ };
+ CTitle.prototype.setPos = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Title_SetPos, this.pos, pr));
+ this.pos = pr;
+ };
CTitle.prototype.getParentObjects = function() {
if(this.chart) {
return this.chart.getParentObjects();
@@ -13955,8 +14172,16 @@
};
CTitle.prototype.getDefaultTextForTxBody = function() {
var sText;
- if(this.tx && this.tx.strRef) {
- sText = this.tx.strRef.getText(false);
+ if(this.tx) {
+ let oTx = this.tx;
+ if(oTx.strRef) {
+ sText = oTx.strRef.getText(false);
+ }
+ if(!sText) {
+ if(oTx.txData) {
+ sText = oTx.txData.v;
+ }
+ }
if(typeof sText === "string" && sText.length > 0) {
return sText;
}
@@ -14070,6 +14295,11 @@
this.applyStyleEntry(oChartStyle.axisTitle, oColors.generateColors(1), 0, bReset);
}
};
+ CTitle.prototype.updateReferences = function() {
+ if (this.tx) {
+ this.tx.update();
+ }
+ };
function CTrendLine() {
CBaseChartObject.call(this);
@@ -14167,6 +14397,9 @@
if(AscFormat.isRealNumber(this.trendlineType)) {
oCopy.setTrendlineType(this.trendlineType);
}
+ if(this.trendlineLbl) {
+ oCopy.setTrendlineLbl(this.trendlineLbl.createDuplicate());
+ }
};
CTrendLine.prototype.applyChartStyle = function(oChartStyle, oColors, oAdditionalData, bReset) {
if(!this.parent) {
@@ -14311,6 +14544,37 @@
CTrendLine.prototype.Refresh_RecalcData2 = function(pageIndex, object) {
this.onChartInternalUpdate();
};
+ CTrendLine.prototype.createLabel = function() {
+ let oLabel = new AscFormat.CDLbl();
+ let oChartSpace = this.getChartSpace();
+ if(!oChartSpace)
+ return oLabel;
+ let oChartStyle = oChartSpace.chartStyle;
+ let oChartColors = oChartSpace.chartColors;
+ if(!oChartStyle || !oChartColors)
+ return oLabel;
+ let oTrendlineLabelStyle = oChartStyle.trendlineLabel;
+ if(!oTrendlineLabelStyle)
+ return oLabel;
+ oLabel.setParent(this);
+ oLabel.applyStyleEntry(oTrendlineLabelStyle, oChartColors.generateColors(1), 0, true);
+ return oLabel;
+ };
+
+ CTrendLine.prototype.setShowLabel = function(bShow) {
+ if(bShow) {
+ if(!this.trendlineLbl) {
+ this.setTrendlineLbl(this.createLabel());
+ this.setDispEq(null);
+ }
+ }
+ else {
+ if(this.trendlineLbl) {
+ this.setTrendlineLbl(null);
+ this.setDispEq(false);
+ }
+ }
+ };
function CUpDownBars() {
CBaseChartObject.call(this);
@@ -15218,7 +15482,14 @@
this.title.applyChartStyle(oChartStyle, oColors, oAdditionalData, bReset);
}
};
-
+ CChart.prototype.updateReferences = function(bDisplayEmptyCellsAs, bDisplayHidden) {
+ if(this.title) {
+ this.title.updateReferences();
+ }
+ if(this.plotArea) {
+ this.plotArea.updateReferences(bDisplayEmptyCellsAs, bDisplayHidden);
+ }
+ };
function CChartWall() {
CBaseChartObject.call(this);
this.pictureOptions = null;
@@ -15774,6 +16045,14 @@
function AddToContentFromString(content, str) {
content.MoveCursorToStartPos(false);
+ if(content.IsEmpty()) {
+ let aFirstPara = content.Content[0];
+ if(aFirstPara.Content.length === 2) {// 0 - empty run, 1 - paraEnd run
+ let oFirstRun = aFirstPara.Content[0];
+ oFirstRun.AddText(str);
+ return;
+ }
+ }
content.AddText(str);
}
@@ -15956,6 +16235,13 @@
CalcLegendEntry.prototype.GetParaDrawing = function() {
return null;
};
+ CalcLegendEntry.prototype.isChartEx = function() {
+ let oCS = this.getChartSpace();
+ if(oCS) {
+ return oCS.isChartEx();
+ }
+ return false;
+ };
function CompiledMarker() {
this.spPr = new AscFormat.CSpPr();
@@ -17378,16 +17664,55 @@
if(!this.chartSpace) {
return;
}
- var aSeries = this.chartSpace.getAllSeries();
- aSeries.sort(function(a, b) {
- return a.order - b.order;
- });
- var nSeries;
- var oSeriesRefs;
- var nStartIdx = aSeries.length;
+ let aSeries = this.chartSpace.getAllSeries();
+ let nSeries;
+ let oSeriesRefs;
+ let nStartIdx = aSeries.length;
+ if(this.chartSpace.isChartEx()) {
+ let oChartData = this.chartSpace.chartData;
+ if(!oChartData) return;
- for(nSeries = 0; nSeries < aSeries.length; ++nSeries) {
- this.seriesRefs.push(new CSeriesDataRefs(aSeries[nSeries]));
+ aSeries.sort(function(a, b) {
+ return a.formatIdx - b.formatIdx;
+ });
+
+ for(nSeries = 0; nSeries < aSeries.length; ++nSeries) {
+ let oSeries = aSeries[nSeries];
+ let oData = oSeries.getData();
+ if(oData) {
+ let oSeriesDataRefs = new CSeriesDataRefs();
+ let oNumDim = oData.getValDimensions()[0];
+ let oStrDim = oData.getCatDimensions()[0];
+ let oTxDim = oSeries.tx && oSeries.tx.txData;
+ let sFormula;
+ if(oNumDim && oNumDim.f) {
+ sFormula = oNumDim.f.content;
+ oSeriesDataRefs.val = new CDataRefs(AscFormat.fParseChartFormula(sFormula));
+ oSeriesDataRefs.val.ref = oNumDim;
+ }
+ if(oStrDim && oStrDim.f) {
+ sFormula = oStrDim.f.content;
+ oSeriesDataRefs.cat = new CDataRefs(AscFormat.fParseChartFormula(sFormula));
+ oSeriesDataRefs.cat.ref = oStrDim;
+ }
+ if(oTxDim && oTxDim.f) {
+ sFormula = oTxDim.f.content;
+ oSeriesDataRefs.tx = new CDataRefs(AscFormat.fParseChartFormula(sFormula));
+ oSeriesDataRefs.tx.ref = oTxDim;
+ }
+ this.tx = new CDataRefs([]);
+ this.seriesRefs.push(oSeriesDataRefs);
+ }
+ }
+ }
+ else {
+ aSeries.sort(function(a, b) {
+ return a.order - b.order;
+ });
+
+ for(nSeries = 0; nSeries < aSeries.length; ++nSeries) {
+ this.seriesRefs.push(new CSeriesDataRefs(aSeries[nSeries]));
+ }
}
for(nSeries = 0; nSeries < this.seriesRefs.length; ++nSeries) {
oSeriesRefs = this.seriesRefs[nSeries];
@@ -18828,9 +19153,18 @@
};
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartSpace_ChartColors] = CChartColors;
+ AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryLnRef] = AscFormat.StyleRef;
+ AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryFillRef] = AscFormat.StyleRef;
+ AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryEffectRef] = AscFormat.StyleRef;
+ AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryFontRef] = AscFormat.FontRef;
+ AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryBodyPr] = AscFormat.CBodyPr;
+
+
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
+ window['AscFormat'].CAxisBase = CAxisBase;
+ window['AscFormat'].CSeriesBase = CSeriesBase;
window['AscFormat'].CDLbl = CDLbl;
window['AscFormat'].CPlotArea = CPlotArea;
window['AscFormat'].CBarChart = CBarChart;
@@ -18896,6 +19230,7 @@
window['AscFormat'].CHeaderFooterChart = CHeaderFooterChart;
window['AscFormat'].CPageMarginsChart = CPageMarginsChart;
window['AscFormat'].CPageSetup = CPageSetup;
+ window['AscFormat'].CChartRefBase = CChartRefBase;
window['AscFormat'].CreateTextBodyFromString = CreateTextBodyFromString;
window['AscFormat'].CreateDocContentFromString = CreateDocContentFromString;
window['AscFormat'].AddToContentFromString = AddToContentFromString;
diff --git a/common/Drawings/Format/ChartSpace.js b/common/Drawings/Format/ChartSpace.js
index 02a2bc2b14..1a7d8d204d 100644
--- a/common/Drawings/Format/ChartSpace.js
+++ b/common/Drawings/Format/ChartSpace.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -373,6 +373,7 @@ function(window, undefined) {
AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetNvGrFrProps] = CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetThemeOverride] = CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBDeleted] = CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetChartData] = CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetParent] = CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetChart] = CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetClrMapOvr] = CChangesDrawingsObject;
@@ -535,6 +536,9 @@ function(window, undefined) {
drawingsChangesMap[AscDFH.historyitem_ShapeSetBDeleted] = function (oClass, value) {
oClass.bDeleted = value;
};
+ drawingsChangesMap[AscDFH.historyitem_ChartSpace_SetChartData] = function(oClass, value) {
+ oClass.chartData = value;
+ };
drawingsChangesMap[AscDFH.historyitem_ChartSpace_SetParent] = function (oClass, value) {
oClass.oldParent = oClass.parent;
oClass.parent = value;
@@ -706,7 +710,7 @@ function(window, undefined) {
this.aLabels[i].updatePosition(x, y);
}
};
- CLabelsBox.prototype.layoutHorNormal = function (fAxisY, fDistance, fXStart, fInterval, bOnTickMark, fForceContentWidth) {
+ CLabelsBox.prototype.layoutHorNormal = function (fAxisY, fDistance, fXStart, fInterval, bOnTickMark, fForceContentWidth, oLabelParams) {
this.bRotated = false;
this.align = (fDistance >= 0);
let fMaxHeight = 0.0;
@@ -715,44 +719,57 @@ function(window, undefined) {
fCurX += fInterval;
}
let oFirstLabel = null, fFirstLabelCenterX = null, oLastLabel = null, fLastLabelCenterX = null;
- let fContentWidth = fForceContentWidth ? fForceContentWidth : Math.abs(fInterval);
+ let fContentWidth = fForceContentWidth || (oLabelParams && oLabelParams.valid) ? fForceContentWidth : Math.abs(fInterval);
let fHorShift = Math.abs(fInterval) / 2.0 - fContentWidth / 2.0;
let fMaxContentWidth = 0;
- for (let i = 0; i < this.aLabels.length; ++i) {
- if (this.aLabels[i]) {
- var oLabel = this.aLabels[i];
- var oContent = oLabel.tx.rich.content;
- oContent.Reset(0, 0, fContentWidth, 20000.0);
- oContent.Recalculate_Page(0, true);
- var fCurHeight = oContent.GetSummaryHeight();
- if (fCurHeight > fMaxHeight) {
- fMaxHeight = fCurHeight;
- }
- var fX, fY;
- fX = fCurX + fHorShift;
- if (fDistance >= 0.0) {
- fY = fAxisY + fDistance;
- } else {
- fY = fAxisY + fDistance - fCurHeight;
- }
- let oTransform = oLabel.transformText;
- oTransform.Reset();
- global_MatrixTransformer.TranslateAppend(oTransform, fX, fY);
- oTransform = oLabel.localTransformText;
- oTransform.Reset();
- global_MatrixTransformer.TranslateAppend(oTransform, fX, fY);
-
+ let bNeedMaxWidth = false;
+ if(this.axis && this.axis.getObjectType() === AscDFH.historyitem_type_SerAx) {
+ bNeedMaxWidth = true;
+ }
+ if (Array.isArray(this.aLabels) && this.aLabels.length > 0) {
+ let loopsCount = 0;
+ let jump = 0;
+ for (let i = 0; i < this.aLabels.length; i += jump) {
+ if (this.aLabels[i]) {
+ var oLabel = this.aLabels[i];
+ var oContent = oLabel.tx.rich.content;
+ oContent.Reset(0, 0, fContentWidth, 20000.0);
+ oContent.Recalculate_Page(0, true);
+ var fCurHeight = oContent.GetSummaryHeight();
+ if (fCurHeight > fMaxHeight) {
+ fMaxHeight = fCurHeight;
+ }
+ var fX, fY;
+ fX = fCurX + fHorShift;
+ if (fDistance >= 0.0) {
+ fY = fAxisY + fDistance;
+ } else {
+ fY = fAxisY + fDistance - fCurHeight;
+ }
+ let oTransform = oLabel.transformText;
+ oTransform.Reset();
+ global_MatrixTransformer.TranslateAppend(oTransform, fX, fY);
+ oTransform = oLabel.localTransformText;
+ oTransform.Reset();
+ global_MatrixTransformer.TranslateAppend(oTransform, fX, fY);
+
+
+ if (oFirstLabel === null) {
+ oFirstLabel = oLabel;
+ fFirstLabelCenterX = fCurX + Math.abs(fInterval) / 2.0;
+ }
+ oLastLabel = oLabel;
+ fLastLabelCenterX = fCurX + Math.abs(fInterval) / 2.0;
- if (oFirstLabel === null) {
- oFirstLabel = oLabel;
- fFirstLabelCenterX = fCurX + Math.abs(fInterval) / 2.0;
+ if(bNeedMaxWidth) {
+ fMaxContentWidth = Math.max(fMaxContentWidth, oLabel.tx.rich.getMaxContentWidth(fContentWidth));
+ }
}
- oLastLabel = oLabel;
- fLastLabelCenterX = fCurX + Math.abs(fInterval) / 2.0;
- fMaxContentWidth = Math.max(fMaxContentWidth, oLabel.tx.rich.getMaxContentWidth(fContentWidth));
+ jump = skipCond(oLabelParams, loopsCount);
+ fCurX += (jump * fInterval);
+ loopsCount++;
}
- fCurX += fInterval;
}
let x0, x1;
@@ -783,103 +800,265 @@ function(window, undefined) {
this.extY = fMaxHeight - fDistance;
}
};
- CLabelsBox.prototype.layoutHorRotated = function (fAxisY, fDistance, fXStart, fXEnd, fInterval, bOnTickMark) {
+ CLabelsBox.prototype.layoutHorRotated = function (fAxisY, fDistance, fXStart, fXEnd, fInterval, bOnTickMark, oLabelParams) {
this.bRotated = true;
this.align = (fDistance >= 0);
var bTickLblSkip = AscFormat.isRealNumber(this.axis.tickLblSkip);
if (bTickLblSkip) {
- this.layoutHorRotated2(this.aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark);
+ this.layoutHorRotated2(this.aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark, oLabelParams);
} else {
-
- var fAngle = Math.PI / 4.0, fMultiplier = Math.sin(fAngle);
- var aLabelsSource = [].concat(this.aLabels);
- var oLabel = aLabelsSource[0];
- var i = 1;
- while (!oLabel && i < aLabelsSource.length) {
- oLabel = aLabelsSource[i++];
- }
- if (oLabel) {
- var oContent = oLabel.tx.rich.content;
- oContent.SetApplyToAll(true);
- oContent.SetParagraphAlign(AscCommon.align_Left);
- oContent.SetParagraphIndent({FirstLine: 0.0, Left: 0.0});
- oContent.SetApplyToAll(false);
- var oSize = oLabel.tx.rich.getContentOneStringSizes();
- var fInset = fMultiplier * (oSize.h);
- fInset *= 2;
- if (fInset <= fInterval) {
- this.layoutHorRotated2(this.aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark);
- } else {
+ if (oLabelParams) {
+ this.layoutHorRotated2(this.aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark, oLabelParams);
+ } else {
+ // manually search for oLabelParams
+ var fAngle = Math.PI / 4.0, fMultiplier = Math.sin(fAngle);
+ var aLabelsSource = [].concat(this.aLabels);
+ var oLabel = aLabelsSource[0];
+ var i = 1;
+ while (!oLabel && i < aLabelsSource.length) {
+ oLabel = aLabelsSource[i++];
+ }
+ if (oLabel) {
+ var oContent = oLabel.tx.rich.content;
+ oContent.SetApplyToAll(true);
+ oContent.SetParagraphAlign(AscCommon.align_Left);
+ oContent.SetParagraphIndent({FirstLine: 0.0, Left: 0.0});
+ oContent.SetApplyToAll(false);
+ var oSize = oLabel && oLabel.tx && oLabel.tx.rich ? oLabel.tx.rich.getContentOneStringSizes() : {w: 0, h: 0};
+ var fInset = fMultiplier * (oSize.h);
+ fInset *= 2;
+ if (fInset <= fInterval) {
+ this.layoutHorRotated2(this.aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark);
+ } else {
- var nIntervalCount = bOnTickMark ? this.count - 1 : this.count;
- var fInterval_ = Math.abs(fXEnd - fXStart) / nIntervalCount;
- var nLblTickSkip = (fInset / fInterval_ + 0.5) >> 0;
- var aLabels = [].concat(aLabelsSource);
- var index = 0;
- if (nLblTickSkip > 1) {
- for (i = 0; i < aLabels.length; ++i) {
- if (aLabels[i]) {
- if ((index % nLblTickSkip) !== 0) {
- aLabels[i] = null;
+ var nIntervalCount = bOnTickMark ? this.count - 1 : this.count;
+ var fInterval_ = Math.abs(fXEnd - fXStart) / nIntervalCount;
+ var nLblTickSkip = (fInset / fInterval_ + 0.5) >> 0;
+ var aLabels = [].concat(aLabelsSource);
+ var index = 0;
+ if (nLblTickSkip > 1) {
+ for (i = 0; i < aLabels.length; ++i) {
+ if (aLabels[i]) {
+ if ((index % nLblTickSkip) !== 0) {
+ aLabels[i] = null;
+ }
+ index++;
}
- index++;
}
}
+ this.layoutHorRotated2(this.aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark);
}
- this.layoutHorRotated2(aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark);
}
}
}
-
};
- CLabelsBox.prototype.layoutHorRotated2 = function (aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark) {
+ CLabelsBox.prototype.layoutHorRotated2 = function (aLabels, fAxisY, fDistance, fXStart, fInterval, bOnTickMark, oLabelParams) {
this.bRotated = true;
this.align = (fDistance >= 0);
- var i;
var fMaxHeight = 0.0;
var fCurX = bOnTickMark ? fXStart : fXStart + fInterval / 2.0;
- var fAngle = Math.PI / 4.0, fMultiplier = Math.sin(fAngle);
+ let fAngle = oLabelParams && oLabelParams.valid ? Math.PI : Math.PI / 4.0;
+ const fMultiplier = Math.sin(fAngle);
+ let sinAlpha = null;
+ let cosAlpha = null;
var fMinLeft = null, fMaxRight = null;
- for (i = 0; i < aLabels.length; ++i) {
- if (aLabels[i]) {
- var oLabel = aLabels[i];
- var oContent = oLabel.tx.rich.content;
- oContent.SetApplyToAll(true);
- oContent.SetParagraphAlign(AscCommon.align_Left);
- oContent.SetParagraphIndent({FirstLine: 0.0, Left: 0.0});
- oContent.SetApplyToAll(false);
- var oSize = oLabel.tx.rich.getContentOneStringSizes();
- var fBoxW = fMultiplier * (oSize.w + oSize.h);
- var fBoxH = fBoxW;
- if (fBoxH > fMaxHeight) {
- fMaxHeight = fBoxH;
- }
- var fX1, fY0, fXC, fYC;
- fY0 = fAxisY + fDistance;
- if (fDistance >= 0.0) {
- fXC = fCurX - oSize.w * fMultiplier / 2.0;
- fYC = fY0 + fBoxH / 2.0;
- } else {
- //fX1 = fCurX - oSize.h*fMultiplier;
- fXC = fCurX + oSize.w * fMultiplier / 2.0;
- fYC = fY0 - fBoxH / 2.0;
+ let rotatedMaxWidth = null;
+ let bDirection = true;
+
+ if (oLabelParams && oLabelParams.valid) {
+ fAngle = getRotationAngle(oLabelParams.rot);
+ sinAlpha = Math.abs(Math.sin(fAngle));
+ cosAlpha = Math.abs(Math.cos(fAngle));
+ rotatedMaxWidth = (cosAlpha + sinAlpha) * oLabelParams.maxHeight;
+ // bDirection indecates whether angle is positive or negative.
+ // excel incorrectly works with align, is they will fix it uncomment this line, and remove this align from getTranslationX function
+ // bDirection = this.align ? oLabelParams.rot > 0 : oLabelParams.rot <= 0;
+ bDirection = oLabelParams.rot > 0;
+ }
+
+ const getSquareWidth = function (bDirection, oLabel, fLabelHigh) {
+ const contents = oLabel && oLabel.txBody && oLabel.txBody.content && oLabel.txBody.content.Content && Array.isArray(oLabel.txBody.content.Content) ? oLabel.txBody.content.Content[0].Content : null;
+
+ if (!contents || !Array.isArray(contents) || contents.length < 1) {
+ return;
+ }
+
+ let runTexts = contents[0].Content;
+
+ if (runTexts) {
+ let squareWidth = 0;
+ let size = runTexts.length;
+ if (size > 0) {
+ if (bDirection) {
+ squareWidth = runTexts[0].GetWidth(oLabel.txPr);
+ } else {
+ squareWidth = runTexts[size - 1].GetWidth(oLabel.txPr);
+ }
+
+ // we need lowest out of height and width;
+ squareWidth = squareWidth > fLabelHigh ? fLabelHigh : squareWidth;
}
- var oTransform = oLabel.localTransformText;
- oTransform.Reset();
- global_MatrixTransformer.TranslateAppend(oTransform, -oSize.w / 2.0, -oSize.h / 2.0);
- global_MatrixTransformer.RotateRadAppend(oTransform, fAngle);
- global_MatrixTransformer.TranslateAppend(oTransform, fXC, fYC);
- oLabel.transformText = oTransform.CreateDublicate();
- if (null === fMinLeft || (fXC - fBoxW / 2.0) < fMinLeft) {
- fMinLeft = fXC - fBoxW / 2.0;
+
+ return squareWidth;
+ }
+ }
+
+ const getTranslationX = function (align, bDirection, squareWidth, labelWidth) {
+ bDirection = align ? bDirection : !bDirection;
+ return bDirection > 0 ? -squareWidth / 2.0 : (squareWidth / 2.0) - labelWidth;
+ }
+
+ const addDots = function (sliced, oLabel) {
+ const contents = oLabel && oLabel.txBody && oLabel.txBody.content && oLabel.txBody.content.Content && Array.isArray(oLabel.txBody.content.Content) ? oLabel.txBody.content.Content[0].Content : null;
+ if (!sliced || !contents) {
+ return;
+ }
+ let size = contents[0].Content.length;
+ contents[0].AddToContent(size++,new AscWord.CRunText(46), true);
+ contents[0].AddToContent(size++,new AscWord.CRunText(46), true);
+ contents[0].AddToContent(size++,new AscWord.CRunText(46), true);
+ oLabel.txBody.content.Recalculate_Page(0, true);
+ }
+
+ const sliceLabel = function (oLabel, maxWidth, aDotWidth) {
+ const paragraph = oLabel && oLabel.txBody && oLabel.txBody.content && oLabel.txBody.content.Content && Array.isArray(oLabel.txBody.content.Content) ? oLabel.txBody.content.Content[0] : null
+ const contents = paragraph ? paragraph.Content : null;
+ let oSize = oLabel && oLabel.tx && oLabel.tx.rich ? oLabel.tx.rich.getContentOneStringSizes() : null;
+ if (!paragraph || !contents || !maxWidth || !oSize) {
+ return;
+ }
+ let runTexts = contents[0].Content;
+ let addDots = false;
+
+ const getCondition = function (multiLine) {
+ // statement1 indicates whether paragraph consist of multiple lines
+ const statement1 = paragraph && Array.isArray(paragraph.Lines) && paragraph.Lines.length > 1;
+ // statement2 indicates label with overfitting
+ const statement2 = oSize.w > maxWidth;
+ return multiLine ? statement1 : statement2;
+ }
+
+ // true stands for multiple line problem, false stands for overwidth problem
+ const slice = function (multiLine) {
+
+ // condition indecates whether multilines or overfitting
+ let condition = getCondition(multiLine);
+
+ if (runTexts && condition) {
+ contents[0].Content = [];
+ let left = 0;
+ let right = runTexts.length;
+ let mid = null;
+
+ // when dealing width width subtract the width of the dots from max width
+ if (!multiLine) {
+
+ // add dot to empty string and find its width
+ if (aDotWidth[0] === null) {
+ const oDot = new AscWord.CRunText(46);
+ contents[0].AddToContent(0, oDot, true);
+ const oDotSize = oLabel && oLabel.tx && oLabel.tx.rich ? oLabel.tx.rich.getContentOneStringSizes() : {w: 0, h: 0};
+ contents[0].Content = [];
+ aDotWidth[0] = oDotSize.w;
+ }
+
+ // indicate number of dots
+ const dotCount = 3;
+ // aDotWidth is equal across all the axis labels
+ maxWidth -= (aDotWidth[0] * dotCount);
+ }
+
+ while(right - left > 1) {
+ mid = (right + left) / 2 + 0.5 >> 0;
+ contents[0].Content = runTexts.slice(0, mid - 1);
+ oSize = oLabel && oLabel.tx && oLabel.tx.rich ? oLabel.tx.rich.getContentOneStringSizes() : {w: 0, h: 0};
+ condition = getCondition(multiLine);
+ if(condition) {
+ right = mid;
+ } else {
+ left = mid;
+ }
+ }
+ left = (left === 0) ? 1 : left;
+ contents[0].Content = runTexts.slice(0, left);
+ oSize = oLabel && oLabel.tx && oLabel.tx.rich ? oLabel.tx.rich.getContentOneStringSizes() : {w: 0, h: 0};
+ if (getCondition(multiLine) && left > 1) {
+ contents[0].Content = runTexts.slice(0, --left);
+ }
+
+ addDots = true;
}
- if (null === fMaxRight || (fXC + fBoxW / 2.0) > fMaxRight) {
- fMaxRight = fXC + fBoxW / 2.0;
+
+ }
+
+ // when rotation is applied then multiline labels should be sliced
+ slice(true);
+
+ // if overfitting is detected then label should be sliced
+ slice(false);
+
+ return addDots;
+ }
+
+ if (Array.isArray(aLabels) && aLabels.length > 0) {
+ let loopsCount = 0;
+ let jump = 0;
+ const aDotWidth = [null];
+ for (let i = 0; i < aLabels.length; i += jump) {
+ if (aLabels[i]) {
+ var oLabel = aLabels[i];
+ const sliced = sliceLabel(oLabel, rotatedMaxWidth, aDotWidth);
+ var oContent = oLabel.tx.rich.content;
+ oContent.SetApplyToAll(true);
+ oContent.SetParagraphAlign(AscCommon.align_Left);
+ oContent.SetParagraphIndent({FirstLine: 0.0, Left: 0.0});
+ oContent.SetApplyToAll(false);
+ const oSize = oLabel && oLabel.tx && oLabel.tx.rich ? oLabel.tx.rich.getContentOneStringSizes() : {w: 0, h: 0};
+ addDots(sliced, oLabel);
+
+ // create a square around which rotation will be made;
+ const squareWidth = getSquareWidth(bDirection, oLabel, oSize.h);
+ let fBoxW = oLabelParams && oLabelParams.valid ? (cosAlpha * oSize.w) + (sinAlpha * oSize.h) : fMultiplier * (oSize.w + oSize.h);
+ var fBoxH = oLabelParams && oLabelParams.valid ? (sinAlpha * oSize.w) + (cosAlpha * oSize.h) : fBoxW;
+ if (fBoxH > fMaxHeight) {
+ fMaxHeight = fBoxH;
+ }
+ var fX1, fY0, fXC, fYC;
+ fY0 = fAxisY + fDistance;
+ if (fDistance >= 0.0) {
+ fXC = oLabelParams && oLabelParams.valid ? fCurX : fCurX - oSize.w * fMultiplier / 2.0;
+ fYC = oLabelParams && oLabelParams.valid ? fY0 + squareWidth / 2.0 : fY0 + fBoxH / 2.0;
+ } else {
+ //fX1 = fCurX - oSize.h*fMultiplier;
+ fXC = oLabelParams && oLabelParams.valid ? fCurX : fCurX + oSize.w * fMultiplier / 2.0;
+ fYC = oLabelParams && oLabelParams.valid ? fY0 : fY0 - fBoxH / 2.0;
+ }
+ var oTransform = oLabel.localTransformText;
+ oTransform.Reset();
+
+ const translateInX = oLabelParams && oLabelParams.valid ? getTranslationX(this.align, bDirection, squareWidth, oSize.w) : -oSize.w / 2.0;
+ global_MatrixTransformer.TranslateAppend(oTransform, translateInX, - oSize.h / 2.0);
+ global_MatrixTransformer.RotateRadAppend(oTransform, fAngle);
+ global_MatrixTransformer.TranslateAppend(oTransform, fXC, fYC);
+
+ oLabel.transformText = oTransform.CreateDublicate();
+ const leftStep = oLabelParams && oLabelParams.valid ? (bDirection ? fXC : fXC - fBoxW) : (fXC - fBoxW / 2.0);
+ if (null === fMinLeft || leftStep < fMinLeft) {
+ fMinLeft = leftStep;
+ }
+ const rightStep = oLabelParams && oLabelParams.valid ? (bDirection ? fXC + fBoxW : fXC) : (fXC + fBoxW / 2.0);
+ if (null === fMaxRight || rightStep > fMaxRight) {
+ fMaxRight = rightStep;
+ }
}
+
+ jump = skipCond(oLabelParams, loopsCount);
+ fCurX += (jump * fInterval);
+ loopsCount++;
}
- fCurX += fInterval;
}
+
this.aLabels = aLabels;
var aPoints = [];
aPoints.push(fXStart);
@@ -891,6 +1070,7 @@ function(window, undefined) {
if (null !== fMaxRight) {
aPoints.push(fMaxRight);
}
+
this.x = Math.min.apply(Math, aPoints);
this.extX = Math.max.apply(Math, aPoints) - this.x;
if (fDistance >= 0.0) {
@@ -1092,6 +1272,51 @@ function(window, undefined) {
drawingDocument.DrawTrack(AscFormat.TYPE_TRACK.CHART_TEXT, this.chartSpace.transform, this.x, this.y, this.extX, this.extY, false, false, undefined, isDrawHandles);
}
};
+ CLabelsBox.prototype.isLabelUserDefined = function () {
+ if (!this.chartSpace || !this.chartSpace.chart || !this.chartSpace.chart.plotArea || !this.axis) {
+ return false;
+ }
+ let oSeries = this.chartSpace.chart.plotArea.getSeriesWithSmallestIndexForAxis(this.axis);
+ // check if axis has user typed labels
+ const mainAxis = oSeries ? oSeries.cat : null // && oSeries.cat.getLit();
+
+ //statement2 checks if non general
+ const sFormatCode = this.axis.getFormatCode();
+ const statement2 = sFormatCode !== 'General';
+ return !!mainAxis || statement2;
+ }
+
+ CLabelsBox.prototype.getLabelsDataType = function () {
+ if (!this.chartSpace || !this.chartSpace.chart || !this.chartSpace.chart.plotArea || !this.axis) {
+ return 'number';
+ }
+ let oSeries = this.chartSpace.chart.plotArea.getSeriesWithSmallestIndexForAxis(this.axis);
+ // check if axis has user typed labels
+ const mainAxis = oSeries ? oSeries.cat : null // && oSeries.cat.getLit();
+
+ //statement1 checks if string
+ const statement1 = mainAxis ? (!!mainAxis.strRef || !!mainAxis.strLit) : false;
+
+ if (statement1) {
+ return 'string';
+ }
+
+ //statement2 checks if date
+ const sFormatCode = this.axis.getFormatCode();
+ const statement2 = sFormatCode !== 'General';
+ const oNumFormat = oNumFormatCache.get(sFormatCode);
+
+ let msg = 'date_';
+ const isDateAx = this.axis.getObjectType() === AscDFH.historyitem_type_DateAx;
+ if (isDateAx && mainAxis) {
+ const numCache = mainAxis.getNumCache();
+ if (numCache) {
+ const val = Array.isArray(numCache.pts) && numCache.pts.length > 0 ? numCache.pts[0].val : null;
+ msg = AscFormat.isRealNumber(val) ? msg + val : msg;
+ }
+ }
+ return statement2 ? (isDateAx ? msg : 'string') : 'number';
+ }
function fCreateLabel(sText, idx, oParent, oChart, oTxPr, oSpPr, oDrawingDocument) {
var dlbl = new AscFormat.CDLbl();
@@ -1112,14 +1337,102 @@ function(window, undefined) {
return dlbl;
}
- function fLayoutHorLabelsBox(oLabelsBox, fY, fXStart, fXEnd, bOnTickMark, fDistance, bForceVertical, bNumbers, fForceContentWidth) {
+ function getRotationAngle (rot) {
+ // one degree of rot is equal to 60000
+ // therefore fullRange is 180 * 60000
+ // regular range is between [-90 * 60000; 90 * 60000]
+ const fullRange = 10800000;
+ const halfRange = 5400000;
+ const isRot = AscFormat.isRealNumber(rot);
+ return isRot && rot >= -halfRange && rot <= halfRange ? - (Math.PI * rot) / fullRange : Math.PI / 4.0;
+ }
+
+ function skipCond (oLabelParams, loopsCount) {
+ if (!oLabelParams) {
+ return 1;
+ }
+
+ const isLeap = function (y) {
+ if (!AscFormat.isRealNumber(y)) {
+ return false;
+ }
+
+ // excel formula for leap year;
+ return (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0;
+ };
+
+ const nLblTickSkip = oLabelParams.nLblTickSkip;
+ const nAxisType = oLabelParams.nAxisType;
+ const sDataType = oLabelParams.sDataType;
+ const oStartingDate = oLabelParams.oStartingDate;
+ const currentDay = oLabelParams.oStartingDate ? oStartingDate.getDate() : 0;
+ const currentMonth = oLabelParams.oStartingDate ? oStartingDate.getMonth() : 0;
+ const currentYear = oLabelParams.oStartingDate ? oStartingDate.getFullYear() : 0;
+
+ const calcYearlyStep = function (yearsCounter) {
+ if (!AscFormat.isRealNumber(yearsCounter) && yearsCounter < 0) {
+ return 366;
+ }
+ let res = 0;
+ let year = 0;
+ for (let i = 1; i <= yearsCounter; i++) {
+ year = currentYear + i;
+ const days = isLeap(year) ? 366 : 365;
+ res += days
+ }
+ oStartingDate.setFullYear(year);
+ return res;
+ }
+
+ const calcMonthlyStep = function (monthCounter) {
+ const findDays = function (arr, startIndex, step) {
+ let sum = 0;
+ for (let i = startIndex; i < startIndex + step; i++) {
+ sum += arr[i % 12];
+ }
+ return sum;
+ }
+ const months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ // february can have 28/29 days
+ months[1] = isLeap(currentYear) ? months[1] + 1 : months[1];
+ const currMonth = months[currentMonth];
+ const nextMonth = months[(currentMonth + monthCounter) % 12];
+ const days = findDays(months, currentMonth, monthCounter);
+
+ //check if next month has less days, example 29 January, where February can not contain more
+ const negOffset = currentDay > nextMonth ? currentDay - nextMonth : 0;
+
+ //check if last day, days must be added example : 28 + (31-28);
+ const posOffset = currentDay === currMonth && nextMonth > currMonth ? nextMonth - currMonth : 0;
+ const skipDays = days - negOffset + posOffset;
+
+ oStartingDate.setDate(oStartingDate.getDate() + skipDays);
+ return skipDays;
+ }
+
+ if (nAxisType === AscDFH.historyitem_type_DateAx && oStartingDate && nLblTickSkip !== 0) {
+ if (nLblTickSkip % 366 === 0) {
+ return calcYearlyStep(nLblTickSkip / 366);
+ } else if (nLblTickSkip % 31 === 0) {
+ return calcMonthlyStep(nLblTickSkip / 31);;
+ }
+ }
+
+ return AscFormat.isRealNumber(nLblTickSkip) && nLblTickSkip > 0 ? nLblTickSkip : 1;
+ }
+
+ function fLayoutHorLabelsBox(oLabelsBox, fY, fXStart, fXEnd, bOnTickMark, fDistance, bForceVertical, bNumbers, fForceContentWidth, nIndex, fRectHeight) {
+ if (!oLabelsBox) {
+ return;
+ }
+
let fAxisLength = fXEnd - fXStart;
let nLabelsCount = oLabelsBox.aLabels.length;
-
let bOnTickMark_ = bOnTickMark && nLabelsCount > 1;
let nIntervalCount = bOnTickMark_ ? nLabelsCount - 1 : nLabelsCount;
let fInterval = fAxisLength / nIntervalCount;
let fForceContentWidth_ = fForceContentWidth;
+
if (!bForceVertical || true) {//TODO: implement for vertical labels
let fMaxMinWidth = oLabelsBox.checkMaxMinWidth();
let fCheckInterval;
@@ -1156,11 +1469,28 @@ function(window, undefined) {
}
}
}
- if (fMaxMinWidth <= fCheckInterval) {
- oLabelsBox.layoutHorNormal(fY, fDistance, fXStart, fInterval, bOnTickMark_, fForceContentWidth_);
- } else {
- oLabelsBox.layoutHorRotated(fY, fDistance, fXStart, fXEnd, fInterval, bOnTickMark_);
+ // find axis type and data type
+ const nAxisType = oLabelsBox && oLabelsBox.axis ? oLabelsBox.axis.getObjectType() : null;
+ const sDataType = oLabelsBox.getLabelsDataType();
+
+ // oLabelParams indecates necessary stuff such as label rotation, label skip, label format
+ const oLabelParams = oLabelsBox && oLabelsBox.axis && oLabelsBox.axis.params ? oLabelsBox.axis.params : new CLabelsParameters(nAxisType, sDataType);
+ oLabelParams.calculate(oLabelsBox, fAxisLength, fRectHeight, nIndex);
+
+ //check whether rotation is applied or not
+ let statement = oLabelParams.valid ? oLabelParams.isRotated() : fMaxMinWidth > fCheckInterval;
+ if (oLabelParams.valid) {
+ // if oLabelParams is valid then one label = axis lenght / (number of labels); number of labels = allLabels / labelsTickSkip
+
+ const fLabelWidth = fAxisLength / Math.ceil(oLabelParams.nLabelsCount / oLabelParams.nLblTickSkip);
+ // if userDefinedTickSkip then each label has same width as axislength
+ fForceContentWidth_ = oLabelParams.isUserDefinedTickSkip ? fAxisLength : fLabelWidth;
+ }
+ if (statement) {
+ oLabelsBox.layoutHorRotated(fY, fDistance, fXStart, fXEnd, fInterval, bOnTickMark_, oLabelParams);
+ } else {
+ oLabelsBox.layoutHorNormal(fY, fDistance, fXStart, fInterval, bOnTickMark_, fForceContentWidth_, oLabelParams);
}
}
}
@@ -1323,6 +1653,7 @@ function(window, undefined) {
this.userShapes = [];//userShapes
this.chartStyle = null;
this.chartColors = null;
+ this.chartData = null;
this.dataRefs = null;
this.pathMemory = new CPathMemory();
@@ -1355,6 +1686,21 @@ function(window, undefined) {
}
AscFormat.InitClass(CChartSpace, AscFormat.CGraphicObjectBase, AscDFH.historyitem_type_ChartSpace);
+ CChartSpace.prototype.getPlotArea = function () {
+ if(!this.chart) return null;
+ return this.chart.plotArea;
+ };
+ CChartSpace.prototype.isChartEx = function () {
+ let oPlotArea = this.getPlotArea();
+ if(!oPlotArea) return false;
+ return oPlotArea.isChartEx();
+ };
+ CChartSpace.prototype.isLayoutSizes = function () {
+ let oPlotArea = this.getPlotArea();
+ if(!oPlotArea) return false;
+ const oLayout = oPlotArea.layout;
+ return oLayout ? ((oLayout.h === null && oLayout.w === null && oLayout.x === null && oLayout.y === null) ? false : true): false;
+ };
CChartSpace.prototype.fromOther = function(oChartSpace) {
if(oChartSpace.nvGraphicFramePr) {
this.setNvSpPr(oChartSpace.nvGraphicFramePr.createDuplicate());
@@ -1430,6 +1776,10 @@ function(window, undefined) {
}
return this.dataRefs;
};
+ CChartSpace.prototype.setChartData = function(pr) {
+ History.CanAddChanges() && History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ChartSpace_SetChartData, this.chartData, pr));
+ this.chartData = pr;
+ };
CChartSpace.prototype.clearDataRefs = function () {
if (this.dataRefs) {
this.dataRefs = null;
@@ -1442,17 +1792,24 @@ function(window, undefined) {
return this.pathMemory.GetPath(index);
};
CChartSpace.prototype.checkTypeCorrect = function () {
- if (!this.chart) {
- return false;
- }
- if (!this.chart.plotArea) {
- return false
- }
- if (this.chart.plotArea.charts.length === 0) {
+ let allSeries = this.getAllSeries();
+ if (allSeries.length === 0) {
return false;
}
- var allSeries = this.getAllSeries();
- if (allSeries.length === 0) {
+ return true;
+ };
+ CChartSpace.prototype.isSupported = function () {
+ if(this.isChartEx()) {
+ const aSeries = this.getAllSeries();
+ if(aSeries.length === 0) {
+ return true;
+ }
+ for (let nSer = 0; nSer < aSeries.length; nSer++) {
+ let oSeries = aSeries[nSer];
+ if(oSeries.isSupported()) {
+ return true;
+ }
+ }
return false;
}
return true;
@@ -1474,6 +1831,16 @@ function(window, undefined) {
}
return -1;
};
+ CChartSpace.prototype.getSeriesByIdx = function (nSeriesIdx) {
+ let aAllSeries = this.getAllSeries();
+ for(let nIdx = 0; nIdx < aAllSeries.length; ++nIdx) {
+ let oSer = aAllSeries[nIdx];
+ if(oSer.idx === nSeriesIdx) {
+ return oSer;
+ }
+ }
+ return null;
+ };
CChartSpace.prototype._getPtArrayIdx = function (oChart, nSeriesIdx, nPtIdx) {
var oSeries = oChart.series[this._getSeriesArrayIdx(nSeriesIdx)];
if (oSeries) {
@@ -3350,6 +3717,9 @@ function(window, undefined) {
if (this.textLink !== null) {
copy.setTextLink(this.textLink);
}
+ if(this.chartData) {
+ copy.setChartData(this.chartData.createDuplicate());
+ }
if (!oPr || false !== oPr.cacheImage) {
copy.cachedImage = this.getBase64Img();
copy.cachedPixH = this.cachedPixH;
@@ -3460,23 +3830,19 @@ function(window, undefined) {
if (this.chart) {
if (this.chart.plotArea) {
this.chart.plotArea.updatePosition(posX, posY);
- var aCharts = this.chart.plotArea.charts;
- for (var t = 0; t < aCharts.length; ++t) {
- var oChart = aCharts[t];
- var series = oChart.series;
- for (var i = 0; i < series.length; ++i) {
- var ser = series[i];
- var pts = ser.getNumPts();
- for (var j = 0; j < pts.length; ++j) {
- if (pts[j].compiledDlb) {
- pts[j].compiledDlb.updatePosition(posX, posY);
- }
- }
- let oTrendlineLbl = ser.trendline && ser.trendline.trendlineLbl;
- if(oTrendlineLbl) {
- oTrendlineLbl.updatePosition(posX, posY);
+ var series = this.getAllSeries();
+ for (var i = 0; i < series.length; ++i) {
+ var ser = series[i];
+ var pts = ser.getNumPts();
+ for (var j = 0; j < pts.length; ++j) {
+ if (pts[j].compiledDlb) {
+ pts[j].compiledDlb.updatePosition(posX, posY);
}
}
+ let oTrendlineLbl = ser.trendline && ser.trendline.trendlineLbl;
+ if(oTrendlineLbl) {
+ oTrendlineLbl.updatePosition(posX, posY);
+ }
}
var aAxes = this.chart.plotArea.axId;
for (var i = 0; i < aAxes.length; ++i) {
@@ -3619,6 +3985,10 @@ function(window, undefined) {
for (i = 0; i < plot_area.charts.length; ++i) {
plot_area.charts[i].getAllRasterImages(images);
}
+
+ if(plot_area.plotAreaRegion) {
+ plot_area.plotAreaRegion.getAllRasterImages(images);
+ }
}
}
for (var i = 0; i < this.userShapes.length; ++i) {
@@ -3842,7 +4212,7 @@ function(window, undefined) {
this.group = group;
};
CChartSpace.prototype.hasCharts = function () {
- if (this.chart && this.chart.plotArea && this.chart.plotArea.charts.length > 0) {
+ if (this.isChartEx() || !this.isChartEx() && this.chart && this.chart.plotArea && this.chart.plotArea.charts.length > 0) {
return true;
}
return false;
@@ -3865,7 +4235,7 @@ function(window, undefined) {
this.clearDataCache();
};
CChartSpace.prototype.recalculateReferences = function () {
- var oSelectedSeries = this.getSelectedSeries();
+ const oSelectedSeries = this.getSelectedSeries();
if (AscFormat.isRealNumber(this.selection.series)) {
if (!oSelectedSeries) {
this.selection.series = null;
@@ -3873,27 +4243,11 @@ function(window, undefined) {
this.selection.markers = null;
}
}
- var worksheet = this.worksheet;
- if (!worksheet)
+ if (!this.worksheet)
return;
- var charts, series, i, j, ser;
- charts = this.chart.plotArea.charts;
- for (i = 0; i < charts.length; ++i) {
- series = charts[i].series;
- for (j = 0; j < series.length; ++j) {
- series[j].updateData(this.displayEmptyCellsAs, this.displayHidden);
- }
- }
- var aTitles = this.getAllTitles();
- for (i = 0; i < aTitles.length; ++i) {
- var oTitle = aTitles[i];
- if (oTitle.tx) {
- oTitle.tx.update();
- }
- }
- var aAxis = this.chart.plotArea.axId;
- for (i = 0; i < aAxis.length; ++i) {
- aAxis[i].updateNumFormat();
+ this.chart.updateReferences(this.displayEmptyCellsAs, this.displayHidden);
+ if(this.chartData) {
+ this.chartData.updateReferences(this.displayEmptyCellsAs, this.displayHidden);
}
};
CChartSpace.prototype.checkEmptyVal = function (val) {
@@ -3924,17 +4278,37 @@ function(window, undefined) {
}
return true;
};
+
+ // if true, then series is empty
CChartSpace.prototype.checkEmptySeries = function () {
- for (var t = 0; t < this.chart.plotArea.charts.length; ++t) {
- var chart_type = this.chart.plotArea.charts[t];
- var series = chart_type.series;
- var nChartType = chart_type.getObjectType();
- var nSeriesLength = (nChartType === AscDFH.historyitem_type_PieChart || nChartType === AscDFH.historyitem_type_DoughnutChart) && this.chart.plotArea.charts.length === 1 ? Math.min(1, series.length) : series.length;
- if (this.isEmptySeries(series, nSeriesLength)) {
+ if (!this.chart || !this.chart.plotArea ) {
+ return true;
+ }
+ if (this.isChartEx()) {
+ if (!this.chart.plotArea.plotAreaRegion) {
+ return true;
+ }
+
+ const numLit = this.chart.plotArea.plotAreaRegion.series[0].getValLit();
+ if (!numLit) {
+ return true;
+ }
+ return numLit.pts.length === 0 ? true : false;
+ } else {
+ if (!this.chart.plotArea.charts) {
return true;
}
+ for (var t = 0; t < this.chart.plotArea.charts.length; ++t) {
+ var chart_type = this.chart.plotArea.charts[t];
+ var series = chart_type.series;
+ var nChartType = chart_type.getObjectType();
+ var nSeriesLength = (nChartType === AscDFH.historyitem_type_PieChart || nChartType === AscDFH.historyitem_type_DoughnutChart) && this.chart.plotArea.charts.length === 1 ? Math.min(1, series.length) : series.length;
+ if (this.isEmptySeries(series, nSeriesLength)) {
+ return true;
+ }
+ }
+ return t < 1;
}
- return t < 1;
};
CChartSpace.prototype.getNeedReflect = function () {
if (!this.chartObj) {
@@ -3950,7 +4324,7 @@ function(window, undefined) {
return ret;
};
CChartSpace.prototype.getAxisCrossType = function (oAxis) {
- if (oAxis.getObjectType() === AscDFH.historyitem_type_ValAx) {
+ if (oAxis.getObjectType() === AscDFH.historyitem_type_ValAx || (oAxis.getObjectType() === AscDFH.historyitem_type_Axis && oAxis.isValuesAxis())) {
return AscFormat.CROSS_BETWEEN_MID_CAT;
}
if (oAxis.getObjectType() === AscDFH.historyitem_type_SerAx) {
@@ -4086,7 +4460,68 @@ function(window, undefined) {
}
return fRetLayout;
};
- CChartSpace.prototype.calculateLabelsPositions = function (b_recalc_labels, b_recalc_legend) {
+ CChartSpace.prototype.calculateDLblsForChartEx = function () {
+ const obtainData = function (cachedData, key) {
+ if (!cachedData) {
+ return;
+ }
+ if (cachedData.clusteredColumn) {
+ if (cachedData.clusteredColumn.aggregation) {
+ return key ? cachedData.clusteredColumn.aggregation[key] : cachedData.clusteredColumn.aggregation;
+ } else if (cachedData.clusteredColumn.results) {
+ return key ? cachedData.clusteredColumn.results[key].occurrence : cachedData.clusteredColumn.results;
+ }
+ } else if (cachedData.waterfall && cachedData.waterfall.numArr) {
+ return key ? cachedData.waterfall.numArr[key].val : cachedData.waterfall.numArr;
+ } else if (cachedData.funnel) {
+ return key ? cachedData.funnel[key] : cachedData.funnel;
+ }
+ return null;
+ }
+
+ const size = this.chart.plotArea.plotAreaRegion.series.length;
+ const seria = this.chart.plotArea.plotAreaRegion.series[size - 1];
+ const cachedData = this.chart.plotArea.plotAreaRegion.cachedData;
+ const results = obtainData(cachedData);
+ //seria.dataLabels.visibility optional
+ if (cachedData && seria && seria.dataLabels && results) {
+ const default_lbl = new AscFormat.CDLbl();
+ const nDefaultPosition = seria.dataLabels.pos ? seria.dataLabels.pos : AscFormat.DATA_LABEL_POS_OUT_END;
+ default_lbl.initDefault(nDefaultPosition);
+ cachedData.compiledDlbs = [];
+ let aPts = seria.getValPts();
+ for(let nPt = 0; nPt < aPts.length; ++nPt) {
+ let pt = aPts[nPt];
+ const compiled_dlb = new AscFormat.CDLbl();
+ compiled_dlb.merge(default_lbl);
+ pt.compiledDlb = compiled_dlb;
+ pt.compiledDlb.chart = this;
+ pt.compiledDlb.series = seria;
+ pt.compiledDlb.pt = pt;
+ pt.compiledDlb.setShowChartExVal(true);
+ pt.compiledDlb.recalculate();
+ if (cachedData.funnel && pt.compiledDlb.pt <= 0) {
+ pt.compiledDlb = default_lbl;
+ }
+ }
+ }
+ }
+ CChartSpace.prototype.calculateChartExLabelsPositions = function () {
+ if (!this.chartObj || !this.chart || !this.chart.plotArea || !this.chart.plotArea.plotAreaRegion || !this.chart.plotArea.plotAreaRegion.series) {
+ return;
+ }
+
+ this.calculateDLblsForChartEx();
+ const aDLbls = this.recalcInfo.dataLbls;
+ for (let i = 0; i < aDLbls.length; i++) {
+ let oLbl = aDLbls[i];
+ oLbl.idx = i;
+ let pos = this.chartObj.recalculatePositionText(oLbl);
+ oLbl.setPosition(pos.x, pos.y);
+ }
+ };
+
+ CChartSpace.prototype.calculateChartLabelsPositions = function () {
let layout;
let aDLbls = this.recalcInfo.dataLbls;
for (let i = 0; i < aDLbls.length; ++i) {
@@ -4130,13 +4565,31 @@ function(window, undefined) {
}
}
}
+ };
+
+ CChartSpace.prototype.calculateLabelsPositions = function (b_recalc_labels, b_recalc_legend) {
+ const isChartEx = this.isChartEx();
+
+ // TODO after new succefull implementation of new type remove option here
+ const type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;
+ if (isChartEx && !type && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {
+ return ;
+ }
+ //----------------------------------
+
+ if (isChartEx) {
+ this.calculateChartExLabelsPositions();
+ } else {
+ this.calculateChartLabelsPositions();
+ }
this.recalcInfo.dataLbls.length = 0;
+ // Calculate diagram title and axes titles
if (b_recalc_labels) {
if (this.chart && this.chart.title) {
var pos = this.chartObj.recalculatePositionText(this.chart.title);
if (this.chart.title.layout) {
- layout = this.chart.title.layout;
+ const layout = this.chart.title.layout;
if (AscFormat.isRealNumber(layout.x)) {
pos.x = this.calculatePosByLayout(pos.x, layout.xMode, layout.x, this.chart.title.extX, this.extX);
}
@@ -4155,7 +4608,7 @@ function(window, undefined) {
var pos = this.chartObj.recalculatePositionText(oAxis.title);
if (oAxis.title.layout) {
- layout = oAxis.title.layout;
+ const layout = oAxis.title.layout;
if (AscFormat.isRealNumber(layout.x)) {
pos.x = this.calculatePosByLayout(pos.x, layout.xMode, layout.x, oAxis.title.extX, this.extX);
}
@@ -4171,6 +4624,7 @@ function(window, undefined) {
}
}
+ //Calculate diagram legend
if (b_recalc_legend && this.chart && this.chart.legend) {
var bResetLegendPos = false;
if (!AscFormat.isRealNumber(this.chart.legend.legendPos)) {
@@ -4179,7 +4633,7 @@ function(window, undefined) {
}
var pos = this.chartObj.recalculatePositionText(this.chart.legend);
if (this.chart.legend.layout) {
- layout = this.chart.legend.layout;
+ const layout = this.chart.legend.layout;
if (AscFormat.isRealNumber(layout.x)) {
pos.x = this.calculatePosByLayout(pos.x, layout.xMode, layout.x, this.chart.legend.extX, this.extX);
}
@@ -4193,6 +4647,7 @@ function(window, undefined) {
}
}
+ // Calculate trendline labels
let aSeries = this.getAllSeries();
for(let nSer = 0; nSer < aSeries.length; ++nSer) {
let oSer = aSeries[nSer];
@@ -4202,7 +4657,7 @@ function(window, undefined) {
if(oLbl && oDrawerData && oDrawerData.coordinate) {
pos = {x: oDrawerData.coordinate.catVal, y: oDrawerData.coordinate.valVal};
if (oLbl.layout) {
- layout = oLbl.layout;
+ const layout = oLbl.layout;
if (AscFormat.isRealNumber(layout.x)) {
pos.x = this.calculatePosByLayout(pos.x, layout.xMode, layout.x, oLbl.extX, this.extX);
}
@@ -4262,28 +4717,60 @@ function(window, undefined) {
}
return ret;
};
+
+
+ CChartSpace.prototype.getValLabels = function(oAxis) {
+ let aStrings = [];
+ let aVal = [].concat(oAxis.scale);
+ let fMultiplier;
+ if (oAxis.dispUnits) {
+ fMultiplier = oAxis.dispUnits.getMultiplier();
+ } else {
+ fMultiplier = 1.0;
+ }
+ let oNumFormat = null;
+ let sFormatCode = oAxis.getFormatCode();
+ if (typeof sFormatCode === "string") {
+ oNumFormat = oNumFormatCache.get(sFormatCode);
+ }
+ if (!oNumFormat) {
+ oNumFormat = oNumFormatCache.get("General");
+ }
+ for (let t = 0; t < aVal.length; ++t) {
+ let fCalcValue = aVal[t] * fMultiplier;
+ let sRichValue;
+ if (oNumFormat) {
+ sRichValue = oNumFormat.formatToChart(fCalcValue);
+ } else {
+ sRichValue = fCalcValue + "";
+ }
+ aStrings.push(sRichValue);
+ }
+ return aStrings;
+ };
+
CChartSpace.prototype.getLabelsForAxis = function (oAxis) {
- var aStrings = [];
- var oPlotArea = this.chart.plotArea, i;
- var nAxisType = oAxis.getObjectType();
- var oSeries = oPlotArea.getSeriesWithSmallestIndexForAxis(oAxis);
- var bCat = false;
+ let aStrings = [];
+ let oPlotArea = this.chart.plotArea, i;
+ let nAxisType = oAxis.getObjectType();
+ let oSeries = oPlotArea.getSeriesWithSmallestIndexForAxis(oAxis);
+ let bCat = false;
switch (nAxisType) {
case AscDFH.historyitem_type_DateAx:
case AscDFH.historyitem_type_CatAx: {
//расчитаем подписи для горизонтальной оси
- var nPtsLen = 0;
- var aScale = [];
+ let nPtsLen = 0;
+ let aScale = [];
if (Array.isArray(oAxis.scale)) {
aScale = aScale.concat(oAxis.scale);
}
if (oSeries && oSeries.cat) {
- var oCat = oSeries.cat;
- var oLit = oCat.getLit();
+ let oCat = oSeries.cat;
+ let oLit = oCat.getLit();
if (oLit) {
bCat = true;
- var oLitFormat = null, oPtFormat = null;
+ let oLitFormat = null, oPtFormat = null;
if (typeof oLit.formatCode === "string" && oLit.formatCode.length > 0) {
oLitFormat = oNumFormatCache.get(oLit.formatCode);
}
@@ -4292,15 +4779,16 @@ function(window, undefined) {
}
nPtsLen = oLit.ptCount;
- var bTickSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) || nPtsLen >= SKIP_LBL_LIMIT;
- var nTickLblSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) ? oAxis.tickLblSkip : (nPtsLen < SKIP_LBL_LIMIT ? 1 : (Math.floor(nPtsLen / SKIP_LBL_LIMIT) + 1));
+ let bTickSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) || nPtsLen >= SKIP_LBL_LIMIT;
+ // let nTickLblSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) ? oAxis.tickLblSkip : (nPtsLen < SKIP_LBL_LIMIT ? 1 : (Math.floor(nPtsLen / SKIP_LBL_LIMIT) + 1));
+ let nTickLblSkip = 1;
let nLastNoEmptyLblIdx = -1;
for (i = 0; i < nPtsLen; ++i) {
if (!bTickSkip ||
nLastNoEmptyLblIdx === -1 || ((i - nLastNoEmptyLblIdx) >= nTickLblSkip)) {
- var oPt = oLit.getPtByIndex(i);
+ let oPt = oLit.getPtByIndex(i);
if (oPt) {
- var sPt;
+ let sPt;
if (typeof oPt.formatCode === "string" && oPt.formatCode.length > 0) {
oPtFormat = oNumFormatCache.get(oPt.formatCode);
if (oPtFormat) {
@@ -4326,12 +4814,12 @@ function(window, undefined) {
}
}
}
- var nPtsLength = 0;
- var aChartsForAxis = oAxis.getAllCharts();
+ let nPtsLength = 0;
+ let aChartsForAxis = oAxis.getAllCharts();
for (i = 0; i < aChartsForAxis.length; ++i) {
- var oChart = aChartsForAxis[i];
- for (var j = 0; j < oChart.series.length; ++j) {
- var oCurPts = null;
+ let oChart = aChartsForAxis[i];
+ for (let j = 0; j < oChart.series.length; ++j) {
+ let oCurPts = null;
oSeries = oChart.series[j];
if (oSeries.val) {
if (oSeries.val.numRef && oSeries.val.numRef.numCache) {
@@ -4340,24 +4828,35 @@ function(window, undefined) {
oCurPts = oSeries.val.numLit;
}
if (oCurPts) {
- nPtsLength = Math.max(nPtsLength, oCurPts.ptCount);
+ const forward = oSeries.trendline && oSeries.trendline.forward ? oSeries.trendline.forward : 0;
+ const newNPtsLength = oCurPts.ptCount + forward;
+ nPtsLength = Math.max(nPtsLength, newNPtsLength);
}
}
}
}
- var nCrossBetween = this.getAxisCrossType(oAxis);
+ let nCrossBetween = this.getAxisCrossType(oAxis);
if (nCrossBetween === AscFormat.CROSS_BETWEEN_MID_CAT && nPtsLength < 2) {
nPtsLength = 2;
}
- var oLitFormatDate = null;
- if (nAxisType === AscDFH.historyitem_type_DateAx && oAxis.numFmt && typeof oAxis.numFmt.formatCode === "string" && oAxis.numFmt.formatCode.length > 0) {
+ let oLitFormatDate = null;
+ if (oAxis.numFmt && typeof oAxis.numFmt.formatCode === "string" && oAxis.numFmt.formatCode.length > 0) {
oLitFormatDate = oNumFormatCache.get(oAxis.numFmt.formatCode);
}
if (nPtsLength > aStrings.length) {
- bTickSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) || nPtsLength >= SKIP_LBL_LIMIT;
- nTickLblSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) ? oAxis.tickLblSkip : (nPtsLength < SKIP_LBL_LIMIT ? 1 : (Math.floor(nPtsLength / SKIP_LBL_LIMIT) + 1));
- var nStartLength = aStrings.length;
+ let bTickSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) || nPtsLength >= SKIP_LBL_LIMIT;
+ let nTickLblSkip = AscFormat.isRealNumber(oAxis.tickLblSkip) ? oAxis.tickLblSkip : (nPtsLength < SKIP_LBL_LIMIT ? 1 : (Math.floor(nPtsLength / SKIP_LBL_LIMIT) + 1));
+ // let nTickLblSkip = 1;
+ let nStartLength = aStrings.length;
+
+ // // different label skip implementation for catAxis
+ const nAxisType = oAxis.getObjectType();
+ if (AscFormat.isRealNumber(nAxisType) && (AscDFH.historyitem_type_CatAx === nAxisType || AscDFH.historyitem_type_DateAx === nAxisType)) {
+ nTickLblSkip = 1;
+ }
+
+
for (i = aStrings.length; i < nPtsLength; ++i) {
if (!bCat && (!bTickSkip || (((nStartLength + i) % nTickLblSkip) === 0))) {
if (oLitFormatDate) {
@@ -4387,31 +4886,7 @@ function(window, undefined) {
break;
}
case AscDFH.historyitem_type_ValAx: {
- var aVal = [].concat(oAxis.scale);
- var fMultiplier;
- if (oAxis.dispUnits) {
- fMultiplier = oAxis.dispUnits.getMultiplier();
- } else {
- fMultiplier = 1.0;
- }
- var oNumFormat = null;
- var sFormatCode = oAxis.getFormatCode();
- if (typeof sFormatCode === "string") {
- oNumFormat = oNumFormatCache.get(sFormatCode);
- }
- if (!oNumFormat) {
- oNumFormat = oNumFormatCache.get("General");
- }
- for (var t = 0; t < aVal.length; ++t) {
- var fCalcValue = aVal[t] * fMultiplier;
- var sRichValue;
- if (oNumFormat) {
- sRichValue = oNumFormat.formatToChart(fCalcValue);
- } else {
- sRichValue = fCalcValue + "";
- }
- aStrings.push(sRichValue);
- }
+ aStrings = this.getValLabels(oAxis);
break;
}
case AscDFH.historyitem_type_SerAx: {
@@ -4424,21 +4899,114 @@ function(window, undefined) {
break;
}
- }
- return aStrings;
- };
- CChartSpace.prototype.calculateAxisGrid = function (oAxis, oRect) {
- if (!oAxis) {
- return;
- }
+ case AscDFH.historyitem_type_Axis: {
+ if (!this.chart || !this.chart.plotArea) {
+ return [];
+ }
+ if (oAxis.isValuesAxis()) {
+ aStrings = this.getValLabels(oAxis);
+ break;
+ }
+ const strSeria = this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series ? this.chart.plotArea.plotAreaRegion.series[0] : null;
+ if (strSeria) {
+ const cachedData = this.chart.plotArea.plotAreaRegion.cachedData;
+ const type = this.chart.plotArea.plotAreaRegion.series[0].layoutId;
+ if (!cachedData || !oAxis.scale) {
+ return [];
+ }
+
+ if (type === AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN && cachedData.clusteredColumn && cachedData.clusteredColumn.aggregation) {
+ // if data is aggregated then convert array of integers into chars
+ const strCache = strSeria.getCatLit();
+ if (strCache && strCache.pts) {
+ const mySet = {};
+ for (let i = 0; i < strCache.pts.length; i++) {
+ // If no labels exist, then excel just leaves empty catAxis
+ const key = strCache.pts[i].val;
+ if (!mySet.hasOwnProperty(key)) {
+ mySet[key] = true;
+ aStrings.push(key);
+ }
+ }
+ } else {
+ aStrings.push('');
+ }
+ } else if (type === AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN && cachedData.clusteredColumn && cachedData.clusteredColumn.binning) {
+ // obtain properly formated array of integers
+ const bStrings = this.getValLabels(oAxis);
+ const binning = cachedData.clusteredColumn.binning;
+
+ //convert array of formated strings into ranges
+ if (bStrings && bStrings.length != 0) {
+ // ranges always start with '[' and end with ']', however between they can have '(' and ')'
+ let start = '[';
+ let end = binning.intervalClosed === AscFormat.INTERVAL_CLOSED_SIDE_L ? ')' : ']';
+ // user can manually set minimum and maximum, therefore alternative start and end needed
+ const alternativeStart = binning.intervalClosed === AscFormat.INTERVAL_CLOSED_SIDE_L ? '<' : '≤';
+ const alternativeEnd = binning.intervalClosed === AscFormat.INTERVAL_CLOSED_SIDE_L ? '≥' : '>';
+
+ const isAlternativeStartExist = binning.underflow === 0 || binning.underflow ? true : false;
+ const isAlternativeEndExist = binning.overflow === 0 || binning.overflow ? true : false;
+ // first check is alternativeStart exist, and append alternativeStartSign with value,
+ // also because start not the first anymore, we can change its value from '[' to '(';
+ if (isAlternativeStartExist) {
+ aStrings.push(alternativeStart + bStrings[0]);
+ start = '(';
+ }
+ // if element not the first one, then change value of start
+ // if element is last one and no alternativeEnd exist, then change value of end
+ for (let i = 0; i < (bStrings.length - 1); i++) {
+ if (i === 1 && start != "(" && binning.intervalClosed !== AscFormat.INTERVAL_CLOSED_SIDE_L) {
+ start = '(';
+ }
- let oAxisGrid = new CAxisGrid();
- oAxis.grid = oAxisGrid;
- let aStrings = this.getLabelsForAxis(oAxis);
- if(oAxis.isRadarCategories()) {
- let nIntervalsCount = aStrings.length;
- oAxisGrid.nCount = nIntervalsCount;
- oAxisGrid.bOnTickMark = true;
+ if (i === (bStrings.length - 2) && !isAlternativeEndExist && binning.intervalClosed === AscFormat.INTERVAL_CLOSED_SIDE_L) {
+ end = ']';
+ }
+ aStrings.push(start + bStrings[i] + ", " + bStrings[i + 1] + end)
+ }
+ // add alternativeEnd if exist
+ if (isAlternativeEndExist) {
+ const val = (bStrings.length > 1) ? bStrings[bStrings.length - 1] : binning.overflow;
+ aStrings.push(alternativeEnd + " " + val);
+ }
+ }
+ } else if (type === AscFormat.SERIES_LAYOUT_WATERFALL) {
+ const strCache = strSeria.getCatLit(type);
+ if (strCache) {
+ for ( let i = 0; i < strCache.pts.length; i++) {
+ aStrings.push(strCache.pts[i].val);
+ }
+ } else {
+ aStrings = this.getValLabels(oAxis);
+ }
+ } else if (type === AscFormat.SERIES_LAYOUT_FUNNEL) {
+ const strCache = strSeria.getCatLit(type);
+ if (strCache) {
+ for ( let i = strCache.pts.length - 1; i >= 0; i--) {
+ aStrings.push(strCache.pts[i].val);
+ }
+ } else {
+ aStrings = this.getValLabels(oAxis);
+ }
+ }
+ }
+ break;
+ }
+ }
+ return aStrings;
+ };
+ CChartSpace.prototype.calculateAxisGrid = function (oAxis, oRect) {
+ if (!oAxis) {
+ return;
+ }
+ let oAxisGrid = new CAxisGrid();
+ oAxis.grid = oAxisGrid;
+ let aStrings = this.getLabelsForAxis(oAxis);
+ if(oAxis.isRadarCategories()) {
+ let nIntervalsCount = aStrings.length;
+ oAxisGrid.nCount = nIntervalsCount;
+ oAxisGrid.bOnTickMark = true;
oAxisGrid.aStrings = aStrings;
if (!oAxis.isReversed()) {
oAxisGrid.fStart = 0;
@@ -4520,13 +5088,21 @@ function(window, undefined) {
};
CChartSpace.prototype.recalculateAxesSet = function(aAxesSet, oRect, oBaseRect, nIndex, fForceContentWidth) {
let oCorrectedRect = null;
-
- let bWithoutLabels = false;
- if(this.chart.plotArea.layout && this.chart.plotArea.layout.layoutTarget === AscFormat.LAYOUT_TARGET_INNER) {
- bWithoutLabels = true;
- }
+ // check if diagram size affected by laout
+ const isLayoutSizes = this.isLayoutSizes();
+ const oPlotArea = this.getPlotArea();
+ const bWithoutLabels = isLayoutSizes && this.chart.plotArea.layout.layoutTarget === AscFormat.LAYOUT_TARGET_INNER;
+ if (isLayoutSizes && oPlotArea) {
+ oPlotArea.extX = oRect.w;
+ oPlotArea.extY = oRect.h;
+ oPlotArea.x = oRect.x;
+ oPlotArea.y = oRect.y;
+ oPlotArea.rectChanged = true;
+ }
+
let bCorrected = false;
let fL = oRect.x, fT = oRect.y, fR = oRect.x + oRect.w, fB = oRect.y + oRect.h;
+ const isChartEx = this.isChartEx();
let fHorPadding = 0.0;
let fVertPadding = 0.0;
let fHorInterval = null;
@@ -4534,22 +5110,28 @@ function(window, undefined) {
for(let nAxesSet = 0; nAxesSet < aAxesSet.length; ++nAxesSet) {
let oCurAxis = aAxesSet[nAxesSet];
let oCrossAxis = oCurAxis.crossAx;
- if(!oCalcMap[oCurAxis.Id]) {
+ if(oCalcMap && !oCalcMap[oCurAxis.Id]) {
this.calculateAxisGrid(oCurAxis, oRect);
oCalcMap[oCurAxis.Id] = true;
}
- if(!oCalcMap[oCrossAxis.Id]) {
+ if(oCrossAxis && !oCalcMap[oCrossAxis.Id]) {
this.calculateAxisGrid(oCrossAxis, oRect);
oCalcMap[oCrossAxis.Id] = true;
}
+ if (!oCrossAxis) {
+ return;
+ }
let fCrossValue;
+ // posY seeks the zero position on the diagram
+ let posY = null;
+ // fAxisPos seeks the bottom diagram position
let fAxisPos;
let fDistance = DEFAULT_LBLS_DISTANCE;
let fDistanceSign = 1;
let nLabelsPos;
let bLabelsExtremePosition = false;
let bOnTickMark = oCurAxis.grid.bOnTickMark;
- if(oCurAxis.bDelete) {
+ if(oCurAxis.bDelete || oCurAxis.hidden) {
nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE;
}
else {
@@ -4595,7 +5177,9 @@ function(window, undefined) {
}
default:
{ //includes AutoZero
- if(oCrossAxis.scale[0] <= 0 && oCrossAxis.scale[oCrossAxis.scale.length - 1] >= 0) {
+ if (isChartEx) {
+ fCrossValue = oCrossAxis.scale[0];
+ } else if(oCrossAxis.scale[0] <= 0 && oCrossAxis.scale[oCrossAxis.scale.length - 1] >= 0) {
fCrossValue = 0;
}
else if(oCrossAxis.scale[0] > 0) {
@@ -4617,6 +5201,7 @@ function(window, undefined) {
let bKoeff = 1.0;
if(oCrossAxis.scale.length > 1) {
bKoeff = oCrossAxis.scale[1] - oCrossAxis.scale[0];
+ bKoeff = bKoeff ? bKoeff : 1.0;
}
fAxisPos = oCrossGrid.fStart;
const bRadarValues = oCurAxis.isRadarValues();
@@ -4626,6 +5211,7 @@ function(window, undefined) {
else {
if(oCrossAxis.scale.length > 0) {
fAxisPos += (fCrossValue - oCrossAxis.scale[0]) * (oCrossGrid.fStride) / bKoeff;
+ posY = fAxisPos + (-oCrossAxis.scale[0]) * (oCrossGrid.fStride) / bKoeff;
}
}
@@ -4666,7 +5252,9 @@ function(window, undefined) {
}
}
-
+ if (isChartEx && aAxesSet.length === 1) {
+ fPos = oRect.x;
+ }
oCurAxis.labels = oLabelsBox;
oCurAxis.posX = null;
@@ -4689,7 +5277,7 @@ function(window, undefined) {
fLayoutRadarCatLabelsBox(oLabelsBox, oRect, aPoints);
}
else if(oCurAxis.isHorizontal()) {
- oCurAxis.posY = fAxisPos;
+ oCurAxis.posY = isChartEx ? posY : fAxisPos;
oCurAxis.xPoints = [];
aPoints = oCurAxis.xPoints;
if(oLabelsBox) {
@@ -4713,7 +5301,7 @@ function(window, undefined) {
fForceContentWidth = Math.abs(fHorInterval) + fHorInterval / nTickLblSkip;
}
fDistance = fDistanceSign * oLabelsBox.getLabelsOffset();
- fLayoutHorLabelsBox(oLabelsBox, fPos, fPosStart, fPosEnd, bOnTickMark, fDistance, bForceVertical, bNumbers, fForceContentWidth);
+ fLayoutHorLabelsBox(oLabelsBox, fPos, fPosStart, fPosEnd, bOnTickMark, fDistance, bForceVertical, bNumbers, fForceContentWidth, nIndex, oBaseRect.h);
if(bLabelsExtremePosition) {
if(fDistance > 0) {
fVertPadding = -oLabelsBox.extY;
@@ -4924,6 +5512,14 @@ function(window, undefined) {
this.cachedCanvas = null;
this.plotAreaRect = null;
this.bEmptySeries = this.checkEmptySeries();
+ const isChartEx = this.isChartEx();
+
+ // TODO after new succefull implementation of new type remove option here
+ const type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;
+ if (isChartEx && !type && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {
+ return ;
+ }
+ //----------------------------------
if (this.chart && this.chart.plotArea) {
var oPlotArea = this.chart.plotArea;
for (i = 0; i < oPlotArea.axId.length; ++i) {
@@ -4993,44 +5589,50 @@ function(window, undefined) {
var aSeriesAxes = [];
var dSeriesLabelsWidth = 0;
var oSetAxis;
- while (aAxes.length > 0) {
- oCurAxis = aAxes.splice(0, 1)[0];
- if (oCurAxis.getObjectType() !== AscDFH.historyitem_type_SerAx) {
- aCurAxesSet = [];
- aCurAxesSet.push(oCurAxis);
- for (i = aAxes.length - 1; i > -1; --i) {
- oCurAxis2 = aAxes[i];
- if (oCurAxis2.getObjectType() !== AscDFH.historyitem_type_SerAx) {
- for (j = aCurAxesSet.length - 1; j > -1; --j) {
- oSetAxis = aCurAxesSet[j];
- if (oSetAxis.crossAx !== oSetAxis && oSetAxis.crossAx === oCurAxis2 ||
- oCurAxis2.crossAx !== oCurAxis2 && oCurAxis2.crossAx === oSetAxis) {
- aCurAxesSet.push(oCurAxis2);
+ if (isChartEx) {
+ if (this.chart.plotArea.axId && Array.isArray(this.chart.plotArea.axId)) {
+ aAllAxes.push(this.chart.plotArea.axId);
+ }
+ } else {
+ while (aAxes.length > 0) {
+ oCurAxis = aAxes.splice(0, 1)[0];
+ if (oCurAxis.getObjectType() !== AscDFH.historyitem_type_SerAx) {
+ aCurAxesSet = [];
+ aCurAxesSet.push(oCurAxis);
+ for (i = aAxes.length - 1; i > -1; --i) {
+ oCurAxis2 = aAxes[i];
+ if (oCurAxis2.getObjectType() !== AscDFH.historyitem_type_SerAx) {
+ for (j = aCurAxesSet.length - 1; j > -1; --j) {
+ oSetAxis = aCurAxesSet[j];
+ if (oSetAxis.crossAx !== oSetAxis && oSetAxis.crossAx === oCurAxis2 ||
+ oCurAxis2.crossAx !== oCurAxis2 && oCurAxis2.crossAx === oSetAxis) {
+ aCurAxesSet.push(oCurAxis2);
+ }
}
}
}
- }
- if (aCurAxesSet.length > 1) {
- aAllAxes.push(aCurAxesSet);
- }
- } else {
- aSeriesAxes.push(oCurAxis);
- this.calculateAxisGrid(oCurAxis, oRect);
- oCurAxis.labels = null;
- var nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO;
- if (oCurAxis.bDelete) {
- nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE;
+ if (aCurAxesSet.length > 1) {
+ aAllAxes.push(aCurAxesSet);
+ }
} else {
- if (null !== oCurAxis.tickLblPos) {
- nLabelsPos = oCurAxis.tickLblPos;
+ aSeriesAxes.push(oCurAxis);
+ this.calculateAxisGrid(oCurAxis, oRect);
+ oCurAxis.labels = null;
+ var nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO;
+ if (oCurAxis.bDelete) {
+ nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE;
} else {
- nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO;
+ if (null !== oCurAxis.tickLblPos) {
+ nLabelsPos = oCurAxis.tickLblPos;
+ } else {
+ nLabelsPos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO;
+ }
+ }
+ if (nLabelsPos !== c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE) {
+ var oLabelsBox = new CLabelsBox(oCurAxis.grid.aStrings, oCurAxis, this);
+ oCurAxis.labels = oLabelsBox;
+ dSeriesLabelsWidth = oLabelsBox.maxMinWidth;
}
- }
- if (nLabelsPos !== c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE) {
- var oLabelsBox = new CLabelsBox(oCurAxis.grid.aStrings, oCurAxis, this);
- oCurAxis.labels = oLabelsBox;
- dSeriesLabelsWidth = oLabelsBox.maxMinWidth;
}
}
}
@@ -5170,6 +5772,7 @@ function(window, undefined) {
}
let oChartSize = this.getChartSizes(true);
+ oPlotArea.rectChanged = false;
this.chart.plotArea.x = oChartSize.startX;
this.chart.plotArea.y = oChartSize.startY;
this.chart.plotArea.extX = oChartSize.w;
@@ -5259,6 +5862,9 @@ function(window, undefined) {
} else {
if (oAxisLabels.align) {
var labels_offset = oCatAx.labels.getLabelsOffset();
+ const rot = oAxisLabels.axis && oAxisLabels.axis.params ? oAxisLabels.axis.params.rot : null;
+ // find angle based on rot
+ let fAngle = getRotationAngle(rot);
for (i = 0; i < oAxisLabels.aLabels.length; ++i) {
if (oAxisLabels.aLabels[i]) {
oLabel = oAxisLabels.aLabels[i];
@@ -5266,9 +5872,9 @@ function(window, undefined) {
w: oLabel.tx.rich.getContentWidth(),
h: oLabel.tx.rich.content.GetSummaryHeight()
}, w2, h2, x1, y0, xc, yc;
- w2 = wh.w * Math.cos(Math.PI / 4) + wh.h * Math.sin(Math.PI / 4);
- h2 = wh.w * Math.sin(Math.PI / 4) + wh.h * Math.cos(Math.PI / 4);
- x1 = oCatAx.xPoints[i].pos + wh.h * Math.sin(Math.PI / 4);
+ w2 = wh.w * Math.cos(fAngle) + wh.h * Math.sin(fAngle);
+ h2 = wh.w * Math.sin(fAngle) + wh.h * Math.cos(fAngle);
+ x1 = oCatAx.xPoints[i].pos + wh.h * Math.sin(fAngle);
y0 = oAxisLabels.y + labels_offset;
var x1t, y0t;
var oRes = oProcessor3D.convertAndTurnPoint(x1 * this.chartObj.calcProp.pxToMM, y0 * this.chartObj.calcProp.pxToMM, dZPositionCatAxis);
@@ -5279,7 +5885,7 @@ function(window, undefined) {
var local_text_transform = oLabel.localTransformText;
local_text_transform.Reset();
global_MatrixTransformer.TranslateAppend(local_text_transform, -wh.w / 2, -wh.h / 2);
- global_MatrixTransformer.RotateRadAppend(local_text_transform, Math.PI / 4);
+ global_MatrixTransformer.RotateRadAppend(local_text_transform, fAngle);
global_MatrixTransformer.TranslateAppend(local_text_transform, xc, yc);
var fBottomContent = y0t + h2;
@@ -5310,7 +5916,6 @@ function(window, undefined) {
local_text_transform = oLabel.localTransformText;
local_text_transform.Reset();
global_MatrixTransformer.TranslateAppend(local_text_transform, -wh.w / 2, -wh.h / 2);
- global_MatrixTransformer.RotateRadAppend(local_text_transform, Math.PI / 4);//TODO
global_MatrixTransformer.TranslateAppend(local_text_transform, xc, yc);
}
}
@@ -5537,25 +6142,28 @@ function(window, undefined) {
};
CChartSpace.prototype.recalculateLegend = function () {
if (this.chart && this.chart.legend) {
- var parents = this.getParentObjects();
- var RGBA = {R: 0, G: 0, B: 0, A: 255};
- var legend = this.chart.legend;
- var arr_str_labels = [], i, j;
- var calc_entryes = legend.calcEntryes;
+ let aCharts = this.isChartEx() ? [this.chart.plotArea.plotAreaRegion] : this.chart.plotArea.charts;
+ if(aCharts.length === 0) {
+ return;
+ }
+ let parents = this.getParentObjects();
+ let RGBA = {R: 0, G: 0, B: 0, A: 255};
+ let legend = this.chart.legend;
+ let arr_str_labels = [], i, j;
+ let calc_entryes = legend.calcEntryes;
calc_entryes.length = 0;
- var series;
- var legend_pos = c_oAscChartLegendShowSettings.right;
+ let series;
+ let legend_pos = c_oAscChartLegendShowSettings.right;
if (AscFormat.isRealNumber(legend.legendPos)) {
legend_pos = legend.legendPos;
}
- var aCharts = this.chart.plotArea.charts;
var oTypedChart;
//Order series for the legend
- var aOrderedSeries = [];
- var aChartSeries;
- var nChart;
- var bStraightOrder;
- var bVericalLegend = false;
+ let aOrderedSeries = [];
+ let aChartSeries;
+ let nChart;
+ let bStraightOrder;
+ let bVericalLegend = false;
if (aCharts.length === 1 && (legend_pos === c_oAscChartLegendShowSettings.left ||
legend_pos === c_oAscChartLegendShowSettings.right ||
legend_pos === c_oAscChartLegendShowSettings.leftOverlay ||
@@ -5598,22 +6206,28 @@ function(window, undefined) {
aOrderedSeries = aOrderedSeries.concat(aChartSeries);
}
}
+
series = aOrderedSeries;
- var calc_entry, union_marker, entry;
- var max_width = 0, cur_width, max_font_size = 0, cur_font_size, ser, b_line_series;
- var b_no_line_series = false;
+ for(let nS = series.length - 1; nS > -1; --nS) {
+ if(series[nS].hidden) {
+ series.splice(nS, 1);
+ }
+ }
+ let calc_entry, union_marker, entry;
+ let max_width = 0, cur_width, max_font_size = 0, cur_font_size, ser, b_line_series;
+ let b_no_line_series = false;
this.chart.legend.chart = this;
var b_scatter_no_line = false;
/*(this.chart.plotArea.charts[0].getObjectType() === AscDFH.historyitem_type_ScatterChart &&
(this.chart.plotArea.charts[0].scatterStyle === AscFormat.SCATTER_STYLE_MARKER || this.chart.plotArea.charts[0].scatterStyle === AscFormat.SCATTER_STYLE_NONE)); */
this.legendLength = null;
- var oFirstChart = aCharts[0];
- var bNoPieChart = (oFirstChart.getObjectType() !== AscDFH.historyitem_type_PieChart && oFirstChart.getObjectType() !== AscDFH.historyitem_type_DoughnutChart);
- var bSurfaceChart = (oFirstChart.getObjectType() === AscDFH.historyitem_type_SurfaceChart);
- const bRadarChart = (oFirstChart.getObjectType() === AscDFH.historyitem_type_RadarChart);
+ const oFirstChart = aCharts[0];
+ const bNoPieChart = oFirstChart && (oFirstChart.getObjectType() !== AscDFH.historyitem_type_PieChart && oFirstChart.getObjectType() !== AscDFH.historyitem_type_DoughnutChart);
+ const bSurfaceChart = oFirstChart && (oFirstChart.getObjectType() === AscDFH.historyitem_type_SurfaceChart);
+ const bRadarChart = oFirstChart && (oFirstChart.getObjectType() === AscDFH.historyitem_type_RadarChart);
- var bSeriesLegend = aCharts.length > 1 || (bNoPieChart && (!(oFirstChart.varyColors && series.length === 1) || bSurfaceChart || bRadarChart));
+ let bSeriesLegend = aCharts.length > 1 || (bNoPieChart && (!(oFirstChart.varyColors && series.length === 1) || bSurfaceChart || bRadarChart));
if (bSeriesLegend) {
if (bSurfaceChart) {
this.legendLength = this.chart.plotArea.charts[0].compiledBandFormats.length;
@@ -5630,7 +6244,8 @@ function(window, undefined) {
entry = legend.findLegendEntryByIndex(i);
if(entry && entry.bDelete)
continue;
- arr_str_labels.push(ser.getSeriesName());
+ const label = ser.getSeriesName ? ser.getSeriesName() : '';
+ arr_str_labels.push(label);
}
else {
entry = legend.findLegendEntryByIndex(i);
@@ -5661,12 +6276,13 @@ function(window, undefined) {
calc_entry.calcMarkerUnion = new AscFormat.CUnionMarker();
union_marker = calc_entry.calcMarkerUnion;
- var pts = ser.getNumPts();
+ var pts = this.isChartEx() ? ser.getValPts() : ser.getNumPts();
var nSerType = ser.getObjectType();
if(nSerType === AscDFH.historyitem_type_BarSeries ||
nSerType === AscDFH.historyitem_type_BubbleSeries ||
nSerType === AscDFH.historyitem_type_AreaSeries ||
nSerType === AscDFH.historyitem_type_PieSeries ||
+ nSerType === AscDFH.historyitem_type_Series ||
(nSerType === AscDFH.historyitem_type_RadarSeries &&
ser.parent && ser.parent.isFilled())) {
@@ -5861,6 +6477,9 @@ function(window, undefined) {
} else {
marker_size = 0.2 * max_font_size;
for (i = 0; i < calc_entryes.length; ++i) {
+ if (!calc_entryes[i].calcMarkerUnion || !calc_entryes[i].calcMarkerUnion.marker || !calc_entryes[i].calcMarkerUnion.marker.spPr || !calc_entryes[i].calcMarkerUnion.marker.spPr.geometry) {
+ continue;
+ }
calc_entryes[i].calcMarkerUnion.marker.spPr.geometry.Recalculate(marker_size, marker_size);
}
distance_to_text = marker_size * 0.7;
@@ -6691,7 +7310,6 @@ function(window, undefined) {
}
if (bMerge) {
-
var oParaPr = oCopy.txPr.content.Content[0].Pr.Copy();
var oParaPr2 = new CParaPr();
var oCopyTextPr = oTextPr.Copy();
@@ -6829,6 +7447,7 @@ function(window, undefined) {
}
return oCopy;
};
+
CChartSpace.prototype.getChartSizes = function (bNotRecalculate) {
if (this.plotAreaRect && !this.recalcInfo.recalculateAxisVal) {
return {
@@ -6843,7 +7462,14 @@ function(window, undefined) {
var oChartSize = this.chartObj.calculateSizePlotArea(this, bNotRecalculate);
var oLayout = this.chart.plotArea.layout;
if (oLayout) {
-
+ if (this.chart.plotArea.rectChanged) {
+ return {
+ startX: this.chart.plotArea.x,
+ startY: this.chart.plotArea.y,
+ w: this.chart.plotArea.extX,
+ h: this.chart.plotArea.extY
+ }
+ }
oChartSize.startX = this.calculatePosByLayout(oChartSize.startX, oLayout.xMode, oLayout.x, oChartSize.w, this.extX);
oChartSize.startY = this.calculatePosByLayout(oChartSize.startY, oLayout.yMode, oLayout.y, oChartSize.h, this.extY);
var fSize = this.calculateSizeByLayout(oChartSize.startX, this.extX, oLayout.w, oLayout.wMode);
@@ -6969,6 +7595,14 @@ function(window, undefined) {
default_brush = CreateUnifillSolidFillSchemeColor(8, 0.95000);
}
}
+ if(this.isChartEx()) {
+ if (this.chartStyle && this.chartColors) {
+ let oSpPr = this.getSpPrFormStyleEntry(this.chartStyle.plotArea, this.chartColors.generateColors(1), 0);
+ if(oSpPr && oSpPr.Fill) {
+ default_brush.merge(oSpPr.Fill);
+ }
+ }
+ }
if (plot_area.spPr && plot_area.spPr.Fill) {
default_brush.merge(plot_area.spPr.Fill);
}
@@ -7008,6 +7642,14 @@ function(window, undefined) {
B: 0,
A: 255
}, this.clrMapOvr);
+ if(this.isChartEx()) {
+ if (this.chartStyle && this.chartColors) {
+ let oSpPr = this.getSpPrFormStyleEntry(this.chartStyle.chartArea, this.chartColors.generateColors(1), 0);
+ if(oSpPr && oSpPr.ln) {
+ default_line.merge(oSpPr.ln);
+ }
+ }
+ }
this.pen = default_line;
checkBlackUnifill(this.pen.Fill, true);
};
@@ -7020,6 +7662,14 @@ function(window, undefined) {
else
default_brush = CreateUnifillSolidFillSchemeColor(8, 0);
+ if(this.isChartEx()) {
+ if (this.chartStyle && this.chartColors) {
+ let oSpPr = this.getSpPrFormStyleEntry(this.chartStyle.chartArea, this.chartColors.generateColors(1), 0);
+ if(oSpPr && oSpPr.Fill) {
+ default_brush.merge(oSpPr.Fill);
+ }
+ }
+ }
if (this.spPr && this.spPr.Fill) {
default_brush.merge(this.spPr.Fill);
}
@@ -7241,533 +7891,558 @@ function(window, undefined) {
this.cachedCanvas = null;
this.ptsCount = 0;
if (this.chart && this.chart.plotArea) {
- var style = CHART_STYLE_MANAGER.getStyleByIndex(this.style);
- var parents = this.getParentObjects();
- var RGBA = {R: 0, G: 0, B: 0, A: 255};
- var aCharts = this.chart.plotArea.charts;
- var aAllSeries = [];
- for (var t = 0; t < aCharts.length; ++t) {
- aAllSeries = aAllSeries.concat(aCharts[t].series);
- }
- var nMaxSeriesIdx = getMaxIdx(aAllSeries);
- for (t = 0; t < aCharts.length; ++t) {
- var oChart = aCharts[t];
- var series = oChart.series;
- if (oChart.varyColors
- && (series.length === 1 || oChart.getObjectType() === AscDFH.historyitem_type_PieChart || oChart.getObjectType() === AscDFH.historyitem_type_DoughnutChart)) {
- var base_fills2 = getArrayFillsFromBase(style.fill2, getMaxIdx(series));
- for (var ii = 0; ii < series.length; ++ii) {
- var ser = series[ii];
- var pts = ser.getNumPts();
- this.ptsCount += pts.length;
- ser.compiledSeriesBrush = new AscFormat.CUniFill();
- ser.compiledSeriesBrush.merge(base_fills2[ser.idx]);
- if (ser.spPr && ser.spPr.Fill) {
- ser.compiledSeriesBrush.merge(ser.spPr.Fill);
- }
-
-
- ser.compiledSeriesPen = new AscFormat.CLn();
- if (style.line1 === EFFECT_NONE) {
- ser.compiledSeriesPen.w = 0;
- } else if (style.line1 === EFFECT_SUBTLE) {
- ser.compiledSeriesPen.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
- } else if (style.line1 === EFFECT_MODERATE) {
- ser.compiledSeriesPen.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
- } else if (style.line1 === EFFECT_INTENSE) {
- ser.compiledSeriesPen.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
- }
- var base_line_fills2;
- if (this.style === 34)
- base_line_fills2 = getArrayFillsFromBase(style.line2, getMaxIdx(series));
-
- ser.compiledSeriesPen.Fill = new AscFormat.CUniFill();
- if (this.style !== 34) {
- ser.compiledSeriesPen.Fill.merge(style.line2[0]);
- } else {
- ser.compiledSeriesPen.Fill.merge(base_line_fills2[ser.idx]);
- }
- if (ser.spPr && ser.spPr.ln)
- ser.compiledSeriesPen.merge(ser.spPr.ln);
-
-
- if (!(oChart.getObjectType() === AscDFH.historyitem_type_LineChart || oChart.getObjectType() === AscDFH.historyitem_type_ScatterChart)) {
- var base_fills = getArrayFillsFromBase(style.fill2, getMaxIdx(pts));
- for (var i = 0; i < pts.length; ++i) {
- var compiled_brush = new AscFormat.CUniFill();
- compiled_brush.merge(base_fills[pts[i].idx]);
- if (ser.spPr && ser.spPr.Fill) {
- compiled_brush.merge(ser.spPr.Fill);
- }
- if (Array.isArray(ser.dPt)) {
- for (var j = 0; j < ser.dPt.length; ++j) {
- if (ser.dPt[j].idx === pts[i].idx) {
- if (ser.dPt[j].spPr) {
- compiled_brush.merge(ser.dPt[j].spPr.Fill);
+ let style = CHART_STYLE_MANAGER.getStyleByIndex(this.style);
+ let parents = this.getParentObjects();
+ let RGBA = {R: 0, G: 0, B: 0, A: 255};
+ let nColorsCount = this.chart.plotArea.getMaxSeriesIdx() + 1;
+ let oChartSpace = this;
+ function defaultCalculateSeriesColors(aSeries) {
+ let base_fills = getArrayFillsFromBase(style.fill2, nColorsCount);
+ let base_line_fills = null;
+ if (style.line1 === EFFECT_SUBTLE && oChartSpace.style === 34)
+ base_line_fills = getArrayFillsFromBase(style.line2, nColorsCount);
+
+
+ for (let nSer = 0; nSer < aSeries.length; ++nSer) {
+ let oSeries = aSeries[nSer];
+ var compiled_brush = new AscFormat.CUniFill();
+ compiled_brush.merge(base_fills[oSeries.getIdx()]);
+ if(oSeries.isChartEx()) {
+ if (oChartSpace.chartStyle && oChartSpace.chartColors) {
+ let oSpPr = oChartSpace.getSpPrFormStyleEntry(oChartSpace.chartStyle.dataPoint, oChartSpace.chartColors.generateColors(aSeries.length), oSeries.idx);
+ if(oSpPr && oSpPr.Fill) {
+ compiled_brush.merge(oSpPr.Fill);
+ }
+ }
+ }
+ if (oSeries.spPr && oSeries.spPr.Fill) {
+ compiled_brush.merge(oSeries.spPr.Fill);
+ }
+ oSeries.compiledSeriesBrush = compiled_brush.createDuplicate();
+
+ oSeries.compiledSeriesBrush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, oChartSpace.clrMapOvr);
+
+ default_line = new AscFormat.CLn();
+ if (style.line1 === EFFECT_NONE) {
+ default_line.w = 0;
+ } else if (style.line1 === EFFECT_SUBTLE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
+ } else if (style.line1 === EFFECT_MODERATE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
+ } else if (style.line1 === EFFECT_INTENSE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
+ }
+
+ let pts = oSeries.getNumPts && oSeries.getNumPts();
+ if (oChartSpace.style === 34 && pts)
+ base_line_fills = getArrayFillsFromBase(style.line2, getMaxIdx(pts));
+
+
+ var compiled_line = new AscFormat.CLn();
+ compiled_line.merge(default_line);
+ compiled_line.Fill = new AscFormat.CUniFill();
+ if (oChartSpace.style !== 34)
+ compiled_line.Fill.merge(style.line2[0]);
+ else if (base_line_fills)
+ compiled_line.Fill.merge(base_line_fills[oSeries.idx]);
+ if(oSeries.isChartEx()) {
+ if (oChartSpace.chartStyle && oChartSpace.chartColors) {
+ let oSpPr = oChartSpace.getSpPrFormStyleEntry(oChartSpace.chartStyle.dataPoint, oChartSpace.chartColors.generateColors(aSeries.length), oSeries.idx);
+ if(oSpPr && oSpPr.ln) {
+ compiled_line.merge(oSpPr.ln);
+ }
+ }
+ }
+ if (oSeries.spPr && oSeries.spPr.ln) {
+ compiled_line.merge(oSeries.spPr.ln);
+ }
+ oSeries.compiledSeriesPen = compiled_line.createDuplicate();
+ oSeries.compiledSeriesPen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, oChartSpace.clrMapOvr);
+
+
+ if(pts) {
+ oChartSpace.ptsCount += pts.length;
+ for (let nPt = 0; nPt < pts.length; ++nPt) {
+ let oPt = pts[nPt];
+ oPt.brush = oSeries.compiledSeriesBrush;
+ oPt.pen = oSeries.compiledSeriesPen;
+ if (Array.isArray(oSeries.dPt) && !(oSeries.getObjectType && oSeries.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
+ for (let nDpt = 0; nDpt < oSeries.dPt.length; ++nDpt) {
+ let oDpt = oSeries.dPt[nDpt];
+ if (oDpt.idx === oPt.idx) {
+ if (oDpt.spPr) {
+ if (oDpt.spPr.Fill && oDpt.spPr.Fill.fill) {
+ compiled_brush = oDpt.spPr.Fill.createDuplicate();
+ oPt.brush = compiled_brush;
}
- break;
+ compiled_line = oSeries.compiledSeriesPen.createDuplicate();
+ compiled_line.merge(oDpt.spPr.ln);
+ oPt.pen = compiled_line;
+
+ compiled_brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, oChartSpace.clrMapOvr);
+ compiled_line.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, oChartSpace.clrMapOvr);
}
+ break;
}
}
- pts[i].brush = compiled_brush;
- pts[i].brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
}
+ }
+ }
+ else {
+ for (let nDpt = 0; nDpt < oSeries.dPt.length; ++nDpt) {
+ let oDpt = oSeries.dPt[nDpt];
+ oDpt.brush = oSeries.compiledSeriesBrush;
+ oDpt.pen = oSeries.compiledSeriesPen;
+ if (oDpt.spPr) {
+ if (oDpt.spPr.Fill && oDpt.spPr.Fill.fill) {
+ compiled_brush = oDpt.spPr.Fill.createDuplicate();
+ oDpt.brush = compiled_brush;
+
+ compiled_brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, oChartSpace.clrMapOvr);
+ }
+ compiled_line = oSeries.compiledSeriesPen.createDuplicate();
+ compiled_line.merge(oDpt.spPr.ln);
+ oDpt.pen = compiled_line;
+ compiled_line.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, oChartSpace.clrMapOvr);
+ }
+ }
+ }
+ }
+ }
+
+ if(this.isChartEx()) {
+ let oPlotAreaRegion = this.chart.plotArea.plotAreaRegion;
+ if(oPlotAreaRegion) {
+ defaultCalculateSeriesColors(oPlotAreaRegion.series);
+ }
+ }
+ else {
+ let aCharts = this.chart.plotArea.charts;
+ for (let nChart = 0; nChart < aCharts.length; ++nChart) {
+ let oChart = aCharts[nChart];
+ let series = oChart.series;
+ if (oChart.varyColors
+ && (series.length === 1 || oChart.getObjectType() === AscDFH.historyitem_type_PieChart || oChart.getObjectType() === AscDFH.historyitem_type_DoughnutChart)) {
+ var base_fills2 = getArrayFillsFromBase(style.fill2, getMaxIdx(series));
+ for (var ii = 0; ii < series.length; ++ii) {
+ var ser = series[ii];
+ var pts = ser.getNumPts();
+ this.ptsCount += pts.length;
+ ser.compiledSeriesBrush = new AscFormat.CUniFill();
+ ser.compiledSeriesBrush.merge(base_fills2[ser.idx]);
+ if (ser.spPr && ser.spPr.Fill) {
+ ser.compiledSeriesBrush.merge(ser.spPr.Fill);
+ }
+
- default_line = new AscFormat.CLn();
+ ser.compiledSeriesPen = new AscFormat.CLn();
if (style.line1 === EFFECT_NONE) {
- default_line.w = 0;
+ ser.compiledSeriesPen.w = 0;
} else if (style.line1 === EFFECT_SUBTLE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
+ ser.compiledSeriesPen.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
} else if (style.line1 === EFFECT_MODERATE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
+ ser.compiledSeriesPen.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
} else if (style.line1 === EFFECT_INTENSE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
+ ser.compiledSeriesPen.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
}
- var base_line_fills;
+ var base_line_fills2;
if (this.style === 34)
- base_line_fills = getArrayFillsFromBase(style.line2, getMaxIdx(pts));
- for (i = 0; i < pts.length; ++i) {
- var compiled_line = new AscFormat.CLn();
- compiled_line.merge(default_line);
- compiled_line.Fill = new AscFormat.CUniFill();
- if (this.style !== 34) {
- compiled_line.Fill.merge(style.line2[0]);
- } else {
- compiled_line.Fill.merge(base_line_fills[pts[i].idx]);
- }
- if (ser.spPr && ser.spPr.ln)
- compiled_line.merge(ser.spPr.ln);
- if (Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
- for (var j = 0; j < ser.dPt.length; ++j) {
- if (ser.dPt[j].idx === pts[i].idx) {
- if (ser.dPt[j].spPr) {
- compiled_line.merge(ser.dPt[j].spPr.ln);
- }
- break;
- }
- }
- }
- pts[i].pen = compiled_line;
- pts[i].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- }
- } else {
- var default_line;
- if (oChart.getObjectType() === AscDFH.historyitem_type_ScatterChart && oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE) {
- default_line = new AscFormat.CLn();
- default_line.setFill(new AscFormat.CUniFill());
- default_line.Fill.setFill(new AscFormat.CNoFill());
+ base_line_fills2 = getArrayFillsFromBase(style.line2, getMaxIdx(series));
+
+ ser.compiledSeriesPen.Fill = new AscFormat.CUniFill();
+ if (this.style !== 34) {
+ ser.compiledSeriesPen.Fill.merge(style.line2[0]);
} else {
- default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
- }
- var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(pts));
- for (var i = 0; i < pts.length; ++i) {
- var compiled_line = new AscFormat.CLn();
- compiled_line.merge(default_line);
- if (!(oChart.getObjectType() === AscDFH.historyitem_type_ScatterChart && oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE))
- compiled_line.Fill.merge(base_line_fills[pts[i].idx]);
- compiled_line.w *= style.line3;
- if (ser.spPr && ser.spPr.ln) {
- compiled_line.merge(ser.spPr.ln);
- }
- if (Array.isArray(ser.dPt)) {
- for (var j = 0; j < ser.dPt.length; ++j) {
- if (ser.dPt[j].idx === pts[i].idx) {
- if (ser.dPt[j].spPr) {
- compiled_line.merge(ser.dPt[j].spPr.ln);
- }
- break;
- }
- }
- }
- pts[i].brush = null;
- pts[i].pen = compiled_line;
- pts[i].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ ser.compiledSeriesPen.Fill.merge(base_line_fills2[ser.idx]);
}
- }
- for (var j = 0; j < pts.length; ++j) {
- if (pts[j].compiledMarker) {
- pts[j].compiledMarker.pen && pts[j].compiledMarker.pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- pts[j].compiledMarker.brush && pts[j].compiledMarker.brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ if (ser.spPr && ser.spPr.ln)
+ ser.compiledSeriesPen.merge(ser.spPr.ln);
- }
- }
- }
- }
- else {
- var nChartType = oChart.getObjectType();
- if(nChartType === AscDFH.historyitem_type_LineChart ||
- (nChartType === AscDFH.historyitem_type_RadarChart && (oChart.radarStyle === AscFormat.RADAR_STYLE_STANDARD || oChart.radarStyle === AscFormat.RADAR_STYLE_MARKER))) {
- var base_line_fills = getArrayFillsFromBase(style.line4, nMaxSeriesIdx);
- if(!AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this)) {
- for(var i = 0; i < series.length; ++i) {
- var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
- var ser = series[i];
- var pts = ser.getNumPts();
- this.ptsCount += pts.length;
- var compiled_line = new AscFormat.CLn();
- compiled_line.merge(default_line);
- compiled_line.Fill && compiled_line.Fill.merge(base_line_fills[ser.idx]);
- compiled_line.w *= style.line3;
- if(ser.spPr && ser.spPr.ln)
- compiled_line.merge(ser.spPr.ln);
- ser.compiledSeriesPen = compiled_line;
- for(var j = 0; j < pts.length; ++j) {
- var oPointLine = null;
- if(Array.isArray(ser.dPt)) {
- for(var k = 0; k < ser.dPt.length; ++k) {
- if(ser.dPt[k].idx === pts[j].idx) {
- if(ser.dPt[k].spPr) {
- oPointLine = ser.dPt[k].spPr.ln;
+ if (!(oChart.getObjectType() === AscDFH.historyitem_type_LineChart || oChart.getObjectType() === AscDFH.historyitem_type_ScatterChart)) {
+ var base_fills = getArrayFillsFromBase(style.fill2, getMaxIdx(pts));
+ for (var i = 0; i < pts.length; ++i) {
+ var compiled_brush = new AscFormat.CUniFill();
+ compiled_brush.merge(base_fills[pts[i].idx]);
+ if (ser.spPr && ser.spPr.Fill) {
+ compiled_brush.merge(ser.spPr.Fill);
+ }
+ if (Array.isArray(ser.dPt)) {
+ for (var j = 0; j < ser.dPt.length; ++j) {
+ if (ser.dPt[j].idx === pts[i].idx) {
+ if (ser.dPt[j].spPr) {
+ compiled_brush.merge(ser.dPt[j].spPr.Fill);
}
break;
}
}
}
- if(oPointLine) {
- compiled_line = ser.compiledSeriesPen.createDuplicate();
- compiled_line.merge(oPointLine);
- }
- else {
- compiled_line = ser.compiledSeriesPen;
- }
- pts[j].brush = null;
- pts[j].pen = compiled_line;
+ pts[i].brush = compiled_brush;
+ pts[i].brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
}
- }
- }
- else {
- var base_fills = getArrayFillsFromBase(style.fill2, nMaxSeriesIdx);
- var base_line_fills = null;
- if(style.line1 === EFFECT_SUBTLE && this.style === 34)
- base_line_fills = getArrayFillsFromBase(style.line2, nMaxSeriesIdx);
- for(var i = 0; i < series.length; ++i) {
- var ser = series[i];
- var compiled_brush = new AscFormat.CUniFill();
- compiled_brush.merge(base_fills[ser.idx]);
- if(ser.spPr && ser.spPr.Fill) {
- compiled_brush.merge(ser.spPr.Fill);
+
+ default_line = new AscFormat.CLn();
+ if (style.line1 === EFFECT_NONE) {
+ default_line.w = 0;
+ } else if (style.line1 === EFFECT_SUBTLE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
+ } else if (style.line1 === EFFECT_MODERATE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
+ } else if (style.line1 === EFFECT_INTENSE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
}
- ser.compiledSeriesBrush = compiled_brush;
- ser.compiledSeriesBrush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- var pts = ser.getNumPts();
- for(var j = 0; j < pts.length; ++j) {
- pts[j].brush = ser.compiledSeriesBrush;
- if(Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
- for(var k = 0; k < ser.dPt.length; ++k) {
- if(ser.dPt[k].idx === pts[j].idx) {
- if(ser.dPt[k].spPr) {
- if(ser.dPt[k].spPr.Fill && ser.dPt[k].spPr.Fill.fill) {
- pts[j].brush = ser.dPt[k].spPr.Fill.createDuplicate();
- pts[j].brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- }
+ var base_line_fills;
+ if (this.style === 34)
+ base_line_fills = getArrayFillsFromBase(style.line2, getMaxIdx(pts));
+ for (i = 0; i < pts.length; ++i) {
+ var compiled_line = new AscFormat.CLn();
+ compiled_line.merge(default_line);
+ compiled_line.Fill = new AscFormat.CUniFill();
+ if (this.style !== 34) {
+ compiled_line.Fill.merge(style.line2[0]);
+ } else {
+ compiled_line.Fill.merge(base_line_fills[pts[i].idx]);
+ }
+ if (ser.spPr && ser.spPr.ln)
+ compiled_line.merge(ser.spPr.ln);
+ if (Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
+ for (var j = 0; j < ser.dPt.length; ++j) {
+ if (ser.dPt[j].idx === pts[i].idx) {
+ if (ser.dPt[j].spPr) {
+ compiled_line.merge(ser.dPt[j].spPr.ln);
}
break;
}
}
}
+ pts[i].pen = compiled_line;
+ pts[i].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
}
-
-
- //
- {
+ } else {
+ var default_line;
+ if (oChart.getObjectType() === AscDFH.historyitem_type_ScatterChart && oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE) {
default_line = new AscFormat.CLn();
- if(style.line1 === EFFECT_NONE) {
- default_line.w = 0;
- }
- else if(style.line1 === EFFECT_SUBTLE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
- }
- else if(style.line1 === EFFECT_MODERATE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
+ default_line.setFill(new AscFormat.CUniFill());
+ default_line.Fill.setFill(new AscFormat.CNoFill());
+ } else {
+ default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
+ }
+ var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(pts));
+ for (var i = 0; i < pts.length; ++i) {
+ var compiled_line = new AscFormat.CLn();
+ compiled_line.merge(default_line);
+ if (!(oChart.getObjectType() === AscDFH.historyitem_type_ScatterChart && oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE))
+ compiled_line.Fill.merge(base_line_fills[pts[i].idx]);
+ compiled_line.w *= style.line3;
+ if (ser.spPr && ser.spPr.ln) {
+ compiled_line.merge(ser.spPr.ln);
}
- else if(style.line1 === EFFECT_INTENSE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
+ if (Array.isArray(ser.dPt)) {
+ for (var j = 0; j < ser.dPt.length; ++j) {
+ if (ser.dPt[j].idx === pts[i].idx) {
+ if (ser.dPt[j].spPr) {
+ compiled_line.merge(ser.dPt[j].spPr.ln);
+ }
+ break;
+ }
+ }
}
- var base_line_fills;
- if(this.style === 34)
- base_line_fills = getArrayFillsFromBase(style.line2, getMaxIdx(pts));
+ pts[i].brush = null;
+ pts[i].pen = compiled_line;
+ pts[i].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ }
+ }
+ for (var j = 0; j < pts.length; ++j) {
+ if (pts[j].compiledMarker) {
+ pts[j].compiledMarker.pen && pts[j].compiledMarker.pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ pts[j].compiledMarker.brush && pts[j].compiledMarker.brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ }
+ }
+ }
+ } else {
+ var nChartType = oChart.getObjectType();
+ if (nChartType === AscDFH.historyitem_type_LineChart ||
+ (nChartType === AscDFH.historyitem_type_RadarChart && (oChart.radarStyle === AscFormat.RADAR_STYLE_STANDARD || oChart.radarStyle === AscFormat.RADAR_STYLE_MARKER))) {
+ var base_line_fills = getArrayFillsFromBase(style.line4, nColorsCount);
+ if (!AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this)) {
+ for (var i = 0; i < series.length; ++i) {
+ var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
+ var ser = series[i];
+ var pts = ser.getNumPts();
+ this.ptsCount += pts.length;
var compiled_line = new AscFormat.CLn();
compiled_line.merge(default_line);
- compiled_line.Fill = new AscFormat.CUniFill();
- if(this.style !== 34)
- compiled_line.Fill.merge(style.line2[0]);
- else
- compiled_line.Fill.merge(base_line_fills[ser.idx]);
- if(ser.spPr && ser.spPr.ln) {
+ compiled_line.Fill && compiled_line.Fill.merge(base_line_fills[ser.idx]);
+ compiled_line.w *= style.line3;
+ if (ser.spPr && ser.spPr.ln)
compiled_line.merge(ser.spPr.ln);
- }
ser.compiledSeriesPen = compiled_line;
- ser.compiledSeriesPen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- for(var j = 0; j < pts.length; ++j) {
- if(Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
- for(var k = 0; k < ser.dPt.length; ++k) {
- if(ser.dPt[k].idx === pts[j].idx) {
- if(ser.dPt[k].spPr) {
- compiled_line = ser.compiledSeriesPen.createDuplicate();
- compiled_line.merge(ser.dPt[k].spPr.ln);
- pts[j].pen = compiled_line;
- pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ for (var j = 0; j < pts.length; ++j) {
+ var oPointLine = null;
+ if (Array.isArray(ser.dPt)) {
+ for (var k = 0; k < ser.dPt.length; ++k) {
+ if (ser.dPt[k].idx === pts[j].idx) {
+ if (ser.dPt[k].spPr) {
+ oPointLine = ser.dPt[k].spPr.ln;
}
break;
}
}
}
- if(pts[j].compiledMarker) {
- pts[j].compiledMarker.pen && pts[j].compiledMarker.pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- pts[j].compiledMarker.brush && pts[j].compiledMarker.brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ if (oPointLine) {
+ compiled_line = ser.compiledSeriesPen.createDuplicate();
+ compiled_line.merge(oPointLine);
+ } else {
+ compiled_line = ser.compiledSeriesPen;
}
+ pts[j].brush = null;
+ pts[j].pen = compiled_line;
+ pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
}
}
- }
- }
- }
- else if(nChartType === AscDFH.historyitem_type_ScatterChart) {
- var base_line_fills = getArrayFillsFromBase(style.line4, nMaxSeriesIdx);
- for(var i = 0; i < series.length; ++i) {
- var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
- var ser = series[i];
- var pts = ser.getNumPts();
- this.ptsCount += pts.length;
- if(oChart.scatterStyle === AscFormat.SCATTER_STYLE_SMOOTH || oChart.scatterStyle === AscFormat.SCATTER_STYLE_SMOOTH_MARKER) {
- if(!AscFormat.isRealBool(ser.smooth)) {
- ser.smooth = true;
- }
- }
- if(oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE) {
- default_line = new AscFormat.CLn();
- default_line.setFill(new AscFormat.CUniFill());
- default_line.Fill.setFill(new AscFormat.CNoFill());
- }
- var compiled_line = new AscFormat.CLn();
- compiled_line.merge(default_line);
- if(!(oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE)) {
- compiled_line.Fill && compiled_line.Fill.merge(base_line_fills[ser.idx]);
- }
- compiled_line.w *= style.line3;
- if(ser.spPr && ser.spPr.ln)
- compiled_line.merge(ser.spPr.ln);
- ser.compiledSeriesPen = compiled_line;
- for(var j = 0; j < pts.length; ++j) {
- pts[j].brush = null;
- pts[j].pen = ser.compiledSeriesPen;
- if(Array.isArray(ser.dPt)) {
- for(var k = 0; k < ser.dPt.length; ++k) {
- if(ser.dPt[k].idx === pts[j].idx) {
- if(ser.dPt[k].spPr) {
- pts[j].pen = ser.compiledSeriesPen.createDuplicate();
- pts[j].pen.merge(ser.dPt[k].spPr.ln);
- pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ } else {
+ var base_fills = getArrayFillsFromBase(style.fill2, nColorsCount);
+ var base_line_fills = null;
+ if (style.line1 === EFFECT_SUBTLE && this.style === 34)
+ base_line_fills = getArrayFillsFromBase(style.line2, nColorsCount);
+ for (var i = 0; i < series.length; ++i) {
+ var ser = series[i];
+ var compiled_brush = new AscFormat.CUniFill();
+ compiled_brush.merge(base_fills[ser.idx]);
+ if (ser.spPr && ser.spPr.Fill) {
+ compiled_brush.merge(ser.spPr.Fill);
+ }
+ ser.compiledSeriesBrush = compiled_brush;
+ ser.compiledSeriesBrush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ var pts = ser.getNumPts();
+ for (var j = 0; j < pts.length; ++j) {
+ pts[j].brush = ser.compiledSeriesBrush;
+ if (Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
+ for (var k = 0; k < ser.dPt.length; ++k) {
+ if (ser.dPt[k].idx === pts[j].idx) {
+ if (ser.dPt[k].spPr) {
+ if (ser.dPt[k].spPr.Fill && ser.dPt[k].spPr.Fill.fill) {
+ pts[j].brush = ser.dPt[k].spPr.Fill.createDuplicate();
+ pts[j].brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ }
+ }
+ break;
+ }
}
- break;
}
}
- }
- }
- }
- }
- else if(nChartType === AscDFH.historyitem_type_SurfaceChart) {
- var oSurfaceChart = oChart;
- var aValAxArray = this.getValAxisValues();
- var nFmtsCount = aValAxArray.length - 1;
- var oSpPr, oBandFmt, oCompiledBandFmt;
- oSurfaceChart.compiledBandFormats.length = 0;
- var multiplier;
- var axis_by_types = oSurfaceChart.getAxisByTypes();
- var val_ax = axis_by_types.valAx[0];
- if(val_ax.dispUnits)
- multiplier = val_ax.dispUnits.getMultiplier();
- else
- multiplier = 1;
- var num_fmt = val_ax.numFmt, num_format = null, calc_value, rich_value;
- if(num_fmt && typeof num_fmt.formatCode === "string" /*&& !(num_fmt.formatCode === "General")*/) {
- num_format = oNumFormatCache.get(num_fmt.formatCode);
- }
- var oParentObjects = this.getParentObjects();
- var RGBA = {R: 255, G: 255, B: 255, A: 255};
- if(oSurfaceChart.isWireframe()) {
- var base_line_fills = getArrayFillsFromBase(style.line4, nFmtsCount);
- var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
- for(var i = 0; i < nFmtsCount; ++i) {
- oBandFmt = oSurfaceChart.getBandFmtByIndex(i);
- oSpPr = new AscFormat.CSpPr();
- oSpPr.setFill(AscFormat.CreateNoFillUniFill());
- var compiled_line = new AscFormat.CLn();
- compiled_line.merge(default_line);
- compiled_line.Fill.merge(base_line_fills[i]);
- //compiled_line.w *= style.line3;
- compiled_line.Join = new AscFormat.LineJoin();
- compiled_line.Join.type = AscFormat.LineJoinType.Bevel;
- if(oBandFmt && oBandFmt.spPr) {
- compiled_line.merge(oBandFmt.spPr.ln);
- }
- compiled_line.calculate(oParentObjects.theme, oParentObjects.slide, oParentObjects.layout, oParentObjects.master, RGBA, this.clrMapOvr);
- oSpPr.setLn(compiled_line);
- oCompiledBandFmt = new AscFormat.CBandFmt();
- oCompiledBandFmt.setIdx(i);
- oCompiledBandFmt.setSpPr(oSpPr);
- if(num_format) {
- oCompiledBandFmt.startValue = num_format.formatToChart(aValAxArray[i] * multiplier);
- oCompiledBandFmt.endValue = num_format.formatToChart(aValAxArray[i + 1] * multiplier);
-
- }
- else {
- oCompiledBandFmt.startValue = '' + (aValAxArray[i] * multiplier);
- oCompiledBandFmt.endValue = '' + (aValAxArray[i + 1] * multiplier);
+ //
+ {
+ default_line = new AscFormat.CLn();
+ if (style.line1 === EFFECT_NONE) {
+ default_line.w = 0;
+ } else if (style.line1 === EFFECT_SUBTLE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
+ } else if (style.line1 === EFFECT_MODERATE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
+ } else if (style.line1 === EFFECT_INTENSE) {
+ default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
+ }
+ var base_line_fills;
+ if (this.style === 34)
+ base_line_fills = getArrayFillsFromBase(style.line2, getMaxIdx(pts));
+
+
+ var compiled_line = new AscFormat.CLn();
+ compiled_line.merge(default_line);
+ compiled_line.Fill = new AscFormat.CUniFill();
+ if (this.style !== 34)
+ compiled_line.Fill.merge(style.line2[0]);
+ else
+ compiled_line.Fill.merge(base_line_fills[ser.idx]);
+ if (ser.spPr && ser.spPr.ln) {
+ compiled_line.merge(ser.spPr.ln);
+ }
+ ser.compiledSeriesPen = compiled_line;
+ ser.compiledSeriesPen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ for (var j = 0; j < pts.length; ++j) {
+ if (Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
+ for (var k = 0; k < ser.dPt.length; ++k) {
+ if (ser.dPt[k].idx === pts[j].idx) {
+ if (ser.dPt[k].spPr) {
+ compiled_line = ser.compiledSeriesPen.createDuplicate();
+ compiled_line.merge(ser.dPt[k].spPr.ln);
+ pts[j].pen = compiled_line;
+ pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ }
+ break;
+ }
+ }
+ }
+ if (pts[j].compiledMarker) {
+ pts[j].compiledMarker.pen && pts[j].compiledMarker.pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ pts[j].compiledMarker.brush && pts[j].compiledMarker.brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
+ }
+ }
+ }
}
- oCompiledBandFmt.setSpPr(oSpPr);
- oSurfaceChart.compiledBandFormats.push(oCompiledBandFmt);
- }
- }
- else {
- var base_fills = getArrayFillsFromBase(style.fill2, nFmtsCount);
- var base_line_fills = null;
- if(style.line1 === EFFECT_SUBTLE && this.style === 34)
- base_line_fills = getArrayFillsFromBase(style.line2, nFmtsCount);
-
- var default_line = new AscFormat.CLn();
- if(style.line1 === EFFECT_NONE) {
- default_line.w = 0;
- }
- else if(style.line1 === EFFECT_SUBTLE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
- }
- else if(style.line1 === EFFECT_MODERATE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
- }
- else if(style.line1 === EFFECT_INTENSE) {
- default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
}
-
- for(var i = 0; i < nFmtsCount; ++i) {
- oBandFmt = oSurfaceChart.getBandFmtByIndex(i);
- var compiled_brush = new AscFormat.CUniFill();
- oSpPr = new AscFormat.CSpPr();
- compiled_brush.merge(base_fills[i]);
- if(oBandFmt && oBandFmt.spPr) {
- compiled_brush.merge(oBandFmt.spPr.Fill);
+ } else if (nChartType === AscDFH.historyitem_type_ScatterChart) {
+ var base_line_fills = getArrayFillsFromBase(style.line4, nColorsCount);
+ for (var i = 0; i < series.length; ++i) {
+ var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
+ var ser = series[i];
+ var pts = ser.getNumPts();
+ this.ptsCount += pts.length;
+ if (oChart.scatterStyle === AscFormat.SCATTER_STYLE_SMOOTH || oChart.scatterStyle === AscFormat.SCATTER_STYLE_SMOOTH_MARKER) {
+ if (!AscFormat.isRealBool(ser.smooth)) {
+ ser.smooth = true;
+ }
+ }
+ if (oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE) {
+ default_line = new AscFormat.CLn();
+ default_line.setFill(new AscFormat.CUniFill());
+ default_line.Fill.setFill(new AscFormat.CNoFill());
}
- oSpPr.setFill(compiled_brush);
-
var compiled_line = new AscFormat.CLn();
compiled_line.merge(default_line);
- compiled_line.Fill = new AscFormat.CUniFill();
- if(this.style !== 34)
- compiled_line.Fill.merge(style.line2[0]);
- else
- compiled_line.Fill.merge(base_line_fills[i]);
- if(oBandFmt && oBandFmt.spPr && oBandFmt.spPr.ln) {
- compiled_line.merge(oBandFmt.spPr.ln);
+ if (!(oChart.scatterStyle === AscFormat.SCATTER_STYLE_MARKER || oChart.scatterStyle === AscFormat.SCATTER_STYLE_NONE)) {
+ compiled_line.Fill && compiled_line.Fill.merge(base_line_fills[ser.idx]);
}
- oSpPr.setLn(compiled_line);
- compiled_line.calculate(oParentObjects.theme, oParentObjects.slide, oParentObjects.layout, oParentObjects.master, RGBA, this.clrMapOvr);
- compiled_brush.calculate(oParentObjects.theme, oParentObjects.slide, oParentObjects.layout, oParentObjects.master, RGBA, this.clrMapOvr);
- oCompiledBandFmt = new AscFormat.CBandFmt();
- oCompiledBandFmt.setIdx(i);
- oCompiledBandFmt.setSpPr(oSpPr);
- if(num_format) {
- oCompiledBandFmt.startValue = num_format.formatToChart(aValAxArray[i] * multiplier);
- oCompiledBandFmt.endValue = num_format.formatToChart(aValAxArray[i + 1] * multiplier);
-
- }
- else {
- oCompiledBandFmt.startValue = '' + (aValAxArray[i] * multiplier);
- oCompiledBandFmt.endValue = '' + (aValAxArray[i + 1] * multiplier);
- }
- oSurfaceChart.compiledBandFormats.push(oCompiledBandFmt);
- }
- }
- }
- else {
-
- var base_fills = getArrayFillsFromBase(style.fill2, nMaxSeriesIdx);
- var base_line_fills = null;
- if(style.line1 === EFFECT_SUBTLE && this.style === 34)
- base_line_fills = getArrayFillsFromBase(style.line2, nMaxSeriesIdx);
- for(var i = 0; i < series.length; ++i) {
- var ser = series[i];
- var compiled_brush = new AscFormat.CUniFill();
- compiled_brush.merge(base_fills[ser.idx]);
- if(ser.spPr && ser.spPr.Fill) {
- compiled_brush.merge(ser.spPr.Fill);
- }
- ser.compiledSeriesBrush = compiled_brush.createDuplicate();
- var pts = ser.getNumPts();
- this.ptsCount += pts.length;
- for(var j = 0; j < pts.length; ++j) {
- pts[j].brush = ser.compiledSeriesBrush;
- if(Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
- for(var k = 0; k < ser.dPt.length; ++k) {
- if(ser.dPt[k].idx === pts[j].idx) {
- if(ser.dPt[k].spPr) {
- if(ser.dPt[k].spPr.Fill && ser.dPt[k].spPr.Fill.fill) {
- compiled_brush = ser.dPt[k].spPr.Fill.createDuplicate();
- pts[j].brush = compiled_brush;
+ compiled_line.w *= style.line3;
+ if (ser.spPr && ser.spPr.ln)
+ compiled_line.merge(ser.spPr.ln);
+ ser.compiledSeriesPen = compiled_line;
+ for (var j = 0; j < pts.length; ++j) {
+ pts[j].brush = null;
+ pts[j].pen = ser.compiledSeriesPen;
+ if (Array.isArray(ser.dPt)) {
+ for (var k = 0; k < ser.dPt.length; ++k) {
+ if (ser.dPt[k].idx === pts[j].idx) {
+ if (ser.dPt[k].spPr) {
+ pts[j].pen = ser.compiledSeriesPen.createDuplicate();
+ pts[j].pen.merge(ser.dPt[k].spPr.ln);
}
+ break;
}
- break;
}
}
+ pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
}
}
+ } else if (nChartType === AscDFH.historyitem_type_SurfaceChart) {
+ var oSurfaceChart = oChart;
+ var aValAxArray = this.getValAxisValues();
+ var nFmtsCount = aValAxArray.length - 1;
+ var oSpPr, oBandFmt, oCompiledBandFmt;
+ oSurfaceChart.compiledBandFormats.length = 0;
+ var multiplier;
+ var axis_by_types = oSurfaceChart.getAxisByTypes();
+ var val_ax = axis_by_types.valAx[0];
+ if (val_ax.dispUnits)
+ multiplier = val_ax.dispUnits.getMultiplier();
+ else
+ multiplier = 1;
+ var num_fmt = val_ax.numFmt, num_format = null, calc_value, rich_value;
+ if (num_fmt && typeof num_fmt.formatCode === "string" /*&& !(num_fmt.formatCode === "General")*/) {
+ num_format = oNumFormatCache.get(num_fmt.formatCode);
+ }
+ var oParentObjects = this.getParentObjects();
+ RGBA = {R: 255, G: 255, B: 255, A: 255};
+ if (oSurfaceChart.isWireframe()) {
+ var base_line_fills = getArrayFillsFromBase(style.line4, nFmtsCount);
+ var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
+ for (var i = 0; i < nFmtsCount; ++i) {
+ oBandFmt = oSurfaceChart.getBandFmtByIndex(i);
+ oSpPr = new AscFormat.CSpPr();
+ oSpPr.setFill(AscFormat.CreateNoFillUniFill());
+ var compiled_line = new AscFormat.CLn();
+ compiled_line.merge(default_line);
+ compiled_line.Fill.merge(base_line_fills[i]);
+ //compiled_line.w *= style.line3;
+ compiled_line.Join = new AscFormat.LineJoin();
+ compiled_line.Join.type = AscFormat.LineJoinType.Bevel;
+ if (oBandFmt && oBandFmt.spPr) {
+ compiled_line.merge(oBandFmt.spPr.ln);
+ }
+ compiled_line.calculate(oParentObjects.theme, oParentObjects.slide, oParentObjects.layout, oParentObjects.master, RGBA, this.clrMapOvr);
+ oSpPr.setLn(compiled_line);
+ oCompiledBandFmt = new AscFormat.CBandFmt();
+ oCompiledBandFmt.setIdx(i);
+ oCompiledBandFmt.setSpPr(oSpPr);
- //
- {
- default_line = new AscFormat.CLn();
- if(style.line1 === EFFECT_NONE) {
- default_line.w = 0;
+ if (num_format) {
+ oCompiledBandFmt.startValue = num_format.formatToChart(aValAxArray[i] * multiplier);
+ oCompiledBandFmt.endValue = num_format.formatToChart(aValAxArray[i + 1] * multiplier);
+
+ } else {
+ oCompiledBandFmt.startValue = '' + (aValAxArray[i] * multiplier);
+ oCompiledBandFmt.endValue = '' + (aValAxArray[i + 1] * multiplier);
+ }
+ oCompiledBandFmt.setSpPr(oSpPr);
+ oSurfaceChart.compiledBandFormats.push(oCompiledBandFmt);
}
- else if(style.line1 === EFFECT_SUBTLE) {
+ } else {
+ var base_fills = getArrayFillsFromBase(style.fill2, nFmtsCount);
+ var base_line_fills = null;
+ if (style.line1 === EFFECT_SUBTLE && this.style === 34)
+ base_line_fills = getArrayFillsFromBase(style.line2, nFmtsCount);
+
+ var default_line = new AscFormat.CLn();
+ if (style.line1 === EFFECT_NONE) {
+ default_line.w = 0;
+ } else if (style.line1 === EFFECT_SUBTLE) {
default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[0]);
- }
- else if(style.line1 === EFFECT_MODERATE) {
+ } else if (style.line1 === EFFECT_MODERATE) {
default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[1]);
- }
- else if(style.line1 === EFFECT_INTENSE) {
+ } else if (style.line1 === EFFECT_INTENSE) {
default_line.merge(parents.theme.themeElements.fmtScheme.lnStyleLst[2]);
}
- var base_line_fills;
- if(this.style === 34)
- base_line_fills = getArrayFillsFromBase(style.line2, getMaxIdx(pts));
+ for (var i = 0; i < nFmtsCount; ++i) {
+ oBandFmt = oSurfaceChart.getBandFmtByIndex(i);
+ var compiled_brush = new AscFormat.CUniFill();
+ oSpPr = new AscFormat.CSpPr();
+ compiled_brush.merge(base_fills[i]);
+ if (oBandFmt && oBandFmt.spPr) {
+ compiled_brush.merge(oBandFmt.spPr.Fill);
+ }
+ oSpPr.setFill(compiled_brush);
- var compiled_line = new AscFormat.CLn();
- compiled_line.merge(default_line);
- compiled_line.Fill = new AscFormat.CUniFill();
- if(this.style !== 34)
- compiled_line.Fill.merge(style.line2[0]);
- else
- compiled_line.Fill.merge(base_line_fills[ser.idx]);
- if(ser.spPr && ser.spPr.ln) {
- compiled_line.merge(ser.spPr.ln);
- }
- ser.compiledSeriesPen = compiled_line.createDuplicate();
- ser.compiledSeriesPen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA, this.clrMapOvr);
- for(var j = 0; j < pts.length; ++j) {
- pts[j].pen = ser.compiledSeriesPen;
- if(Array.isArray(ser.dPt) && !(ser.getObjectType && ser.getObjectType() === AscDFH.historyitem_type_AreaSeries)) {
- for(var k = 0; k < ser.dPt.length; ++k) {
- if(ser.dPt[k].idx === pts[j].idx) {
- if(ser.dPt[k].spPr) {
- compiled_line = ser.compiledSeriesPen.createDuplicate();
- compiled_line.merge(ser.dPt[k].spPr.ln);
- pts[j].pen = compiled_line;
- }
- break;
- }
- }
+ var compiled_line = new AscFormat.CLn();
+ compiled_line.merge(default_line);
+ compiled_line.Fill = new AscFormat.CUniFill();
+ if (this.style !== 34)
+ compiled_line.Fill.merge(style.line2[0]);
+ else
+ compiled_line.Fill.merge(base_line_fills[i]);
+ if (oBandFmt && oBandFmt.spPr && oBandFmt.spPr.ln) {
+ compiled_line.merge(oBandFmt.spPr.ln);
}
+ oSpPr.setLn(compiled_line);
+ compiled_line.calculate(oParentObjects.theme, oParentObjects.slide, oParentObjects.layout, oParentObjects.master, RGBA, this.clrMapOvr);
+ compiled_brush.calculate(oParentObjects.theme, oParentObjects.slide, oParentObjects.layout, oParentObjects.master, RGBA, this.clrMapOvr);
+ oCompiledBandFmt = new AscFormat.CBandFmt();
+ oCompiledBandFmt.setIdx(i);
+ oCompiledBandFmt.setSpPr(oSpPr);
+ if (num_format) {
+ oCompiledBandFmt.startValue = num_format.formatToChart(aValAxArray[i] * multiplier);
+ oCompiledBandFmt.endValue = num_format.formatToChart(aValAxArray[i + 1] * multiplier);
+
+ } else {
+ oCompiledBandFmt.startValue = '' + (aValAxArray[i] * multiplier);
+ oCompiledBandFmt.endValue = '' + (aValAxArray[i + 1] * multiplier);
+ }
+ oSurfaceChart.compiledBandFormats.push(oCompiledBandFmt);
}
}
+ } else {
+ defaultCalculateSeriesColors(series);
}
}
}
}
+
}
};
CChartSpace.prototype.recalculateChartTitleEditMode = function (bWord) {
@@ -8229,6 +8904,14 @@ function(window, undefined) {
if (this.chartObj) {
this.chartObj.draw(this, graphics);
}
+ const isChartEx = this.isChartEx();
+
+ // TODO after new succefull implementation of new type remove option here
+ const type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;
+ if (isChartEx && !type && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {
+ return ;
+ }
+ //----------------------------------
if (this.chart && !this.bEmptySeries) {
if (this.chart.plotArea) {
// var oChartSize = this.getChartSizes();
@@ -8241,25 +8924,26 @@ function(window, undefined) {
// graphics._l(oChartSize.startX + 0, oChartSize.startY + oChartSize.h);
// graphics._z();
// graphics.ds();
- var aCharts = this.chart.plotArea.charts;
- for (var t = 0; t < aCharts.length; ++t) {
- var oChart = aCharts[t];
- if (oChart && oChart.series) {
- var series = oChart.series;
- var _len = oChart.getObjectType() === AscDFH.historyitem_type_PieChart ? 1 : series.length;
- for (var i = 0; i < _len; ++i) {
- var ser = series[i];
- var pts = ser.getNumPts();
- for (var j = 0; j < pts.length; ++j) {
- if (pts[j].compiledDlb)
- pts[j].compiledDlb.draw(graphics);
- }
- let oTrendlineLbl = ser.trendline && ser.trendline.trendlineLbl;
- if(oTrendlineLbl) {
- oTrendlineLbl.draw(graphics);
- }
+ var series = this.getAllSeries();
+ let bPie = false;
+ for (var i = 0; i < series.length; ++i) {
+ var ser = series[i];
+ if(ser.parent.getObjectType() === AscDFH.historyitem_type_PieChart) {
+ if(bPie) {
+ continue;
+ }
+ bPie = true;
+ }
+ var pts = ser.getNumPts();
+ for (var j = 0; j < pts.length; ++j) {
+ if (pts[j].compiledDlb) {
+ pts[j].compiledDlb.draw(graphics);
}
}
+ let oTrendlineLbl = ser.trendline && ser.trendline.trendlineLbl;
+ if(oTrendlineLbl) {
+ oTrendlineLbl.draw(graphics);
+ }
}
for (var i = 0; i < this.chart.plotArea.axId.length; ++i) {
var oAxis = this.chart.plotArea.axId[i];
@@ -8580,10 +9264,65 @@ function(window, undefined) {
}
return oChartStyleCache.getStyleIdx(this.getChartType(), this.chartStyle.id);
};
+ CChartSpace.prototype.getDisplayTrendlinesEquation = function () {
+ let aSeries = this.getAllSeries();
+ let bResult = null;
+ if(aSeries.length === 0) {
+ return bResult;
+ }
+ let aAllTrendlines = [];
+ let oTrendline;
+ for(let nSer = 0; nSer < aSeries.length; ++nSer) {
+ oTrendline = aSeries[nSer].trendline;
+ if(oTrendline) {
+ aAllTrendlines.push(oTrendline);
+ }
+ }
+ if(aAllTrendlines.length === 0) {
+ return null;
+ }
+ if(!oTrendline) {
+ return bResult;
+ }
+ oTrendline = aAllTrendlines[0];
+ bResult = oTrendline.trendlineLbl !== null;
+ for(let nIdx = 1; nIdx < aAllTrendlines.length; ++nIdx) {
+ let bLbl = aAllTrendlines[nIdx].trendlineLbl !== null;
+ if(bResult !== bLbl) {
+ return undefined;
+ }
+ }
+ return bResult;
+ };
+ CChartSpace.prototype.setDisplayTrendlinesEquation = function (bValue) {
+ if(bValue === this.getDisplayTrendlinesEquation()) {
+ return;
+ }
+ let aSeries = this.getAllSeries();
+ let bResult = null;
+ if(aSeries.length === 0) {
+ return;
+ }
+ let aAllTrendlines = [];
+ let oTrendline;
+ for(let nSer = 0; nSer < aSeries.length; ++nSer) {
+ oTrendline = aSeries[nSer].trendline;
+ if(oTrendline) {
+ aAllTrendlines.push(oTrendline);
+ }
+ }
+ for(let nIdx = 0; nIdx < aAllTrendlines.length; ++nIdx) {
+ aAllTrendlines[nIdx].setShowLabel(bValue);
+ }
+ return bResult;
+ };
CChartSpace.prototype.buildSeries = function (aRefs) {
if (!Array.isArray(aRefs)) {
return Asc.c_oAscError.ID.No;
}
+ if(this.isChartEx()) {
+ return Asc.c_oAscError.ID.CannotFillRange;
+ }
if (aRefs.length > MAX_SERIES_COUNT) {
return Asc.c_oAscError.ID.MaxDataSeriesError;
}
@@ -8649,6 +9388,7 @@ function(window, undefined) {
}
};
CChartSpace.prototype.switchRowCol = function () {
+ if(this.isChartEx()) return;
var oDataRange = this.getDataRefs();
var aRefs = oDataRange.getSwitchedRefs(this.isScatterChartType());
if (!aRefs) {
@@ -8662,6 +9402,7 @@ function(window, undefined) {
return nResult;
};
CChartSpace.prototype.fillDataFromTrack = function (oSelectedRange) {
+ if(this.isChartEx()) return;
let oSelectedSeries = this.getSelectedSeries();
if (oSelectedSeries) {
oSelectedSeries.fillFromSelectedRange(oSelectedRange);
@@ -10942,6 +11683,290 @@ function(window, undefined) {
CHART_STYLE_MANAGER.init();
}
+ function CLabelsParameters(nAxisType, sDataType) {
+ this.nLblTickType = null;
+ this.nLblTickSkip = null;
+ this.rot = null;
+ this.isUserDefinedTickSkip = false;
+ this.isUserDefinedLabelFormat = false;
+ this.isUserDefinedRot = false;
+ // excel calculates one degree as 60000
+ this.degree = 60000;
+ this.maxHeight = null;
+ // excel works in the range of -90 degree to 90 degree -> [-90 * 60000; 60000 * 90]
+ this.range = 60000 * 90;
+ this.nAxisType = nAxisType;
+ this.sDataType = sDataType;
+ this.oStartingDate = null;
+ this.valid = AscFormat.isRealNumber(nAxisType) && (this.nAxisType === AscDFH.historyitem_type_CatAx || this.nAxisType === AscDFH.historyitem_type_DateAx);
+ this.nLabelsCount = 0;
+ this.bCalculated = false;
+ this.fLabelHeight = null;
+ this.fLabelWidth = null;
+ }
+
+ CLabelsParameters.prototype.calculate = function (oLabelsBox, fAxisLength, fRectHeight, nIndex) {
+ // get height of label
+ this.bCalculated = !!nIndex;
+
+ if (this.valid && this.isCorrectlyCalculated(oLabelsBox, fAxisLength)) {
+
+ // get labelHeight
+ this.fLabelHeight = AscFormat.isRealNumber(this.fLabelHeight) ? this.fLabelHeight : this.getHeight(oLabelsBox.aLabels);
+
+ // check whether user has defined some parameters
+ this.getUserDefinedSettings(oLabelsBox);
+
+ // calculate number of labels
+ this.calculateLabelsNumber(oLabelsBox);
+
+ // automatically calculate remaining parameters
+ this.calculateParams(oLabelsBox, fAxisLength, fRectHeight);
+
+ // save some updated params for future use
+ this.saveParams(oLabelsBox);
+
+ this.bCalculated = true;
+ }
+ };
+
+ // function to check whether new Label axis will handle old parameters
+ CLabelsParameters.prototype.isCorrectlyCalculated = function (oLabelsBox, fAxisLength) {
+ if (!this.bCalculated) {
+ return true;
+ }
+
+ // cases when 45 degree text calculated should not be affected by width;
+ if (!this.isUserDefinedRot && this.rot < 0 && AscFormat.isRealNumber(this.fLabelHeight)) {
+ this.fLabelWidth = this.fLabelHeight;
+ }
+
+ // sometimes it is possible that new fAxisLength is enough for current nLabelsCount
+ if (this.bCalculated && this.nLblTickSkip !== null && this.nLabelsCount !== 0 && this.nLblTickSkip !== 0) {
+ return this.bCalculated = Math.ceil(this.nLabelsCount / this.nLblTickSkip) * this.fLabelWidth >= fAxisLength;
+ }
+ return false;
+ }
+
+ CLabelsParameters.prototype.calculateLabelsNumber = function (oLabelsBox) {
+ this.nLabelsCount = 0;
+ for (let i = 0; i < oLabelsBox.aLabels.length; i++) {
+ if (oLabelsBox.aLabels[i]) {
+ this.nLabelsCount++;
+ }
+ }
+ };
+
+ CLabelsParameters.prototype.getUserDefinedSettings = function (oLabelsBox) {
+ if (!oLabelsBox) {
+ return;
+ }
+
+ // check label format
+ this.isUserDefinedLabelFormat = oLabelsBox && oLabelsBox.isLabelUserDefined ? oLabelsBox.isLabelUserDefined() : false;
+
+ // check lbl tick skip
+ this.nLblTickSkip = oLabelsBox.axis && AscFormat.isRealNumber(oLabelsBox.axis.tickLblSkip) ? oLabelsBox.axis.tickLblSkip : null;
+ this.isUserDefinedTickSkip = !!this.nLblTickSkip;
+
+ // check rotation
+ const rot = oLabelsBox.axis.txPr && oLabelsBox.axis.txPr.bodyPr ? oLabelsBox.axis.txPr.bodyPr.rot : null;
+ this.rot = AscFormat.isRealNumber(rot) && rot >= -this.range && rot <= this.range ? rot : null;
+ this.isUserDefinedRot = !!this.rot;
+ };
+
+ CLabelsParameters.prototype.calculateParams = function (oLabelsBox, fAxisLength, fRectHeight) {
+ // find max possible space allowed to fill by labels
+ const isLayoutSizes = oLabelsBox.chartSpace ? oLabelsBox.chartSpace.isLayoutSizes() : false;
+ this.setMaxHeight(oLabelsBox, fRectHeight, isLayoutSizes ? oLabelsBox.chartSpace.chart.plotArea.layout : false);
+
+ // retrieve startingDate if exist
+ let msg = this.sDataType.split('_');
+ if (msg.length > 1) {
+ // date.setDate(date.getDateFromExcel(+msg[1]));
+ let date = new AscCommonExcel.cDate();
+ this.oStartingDate = date.getDateFromExcel(+msg[1]);
+ } else if (msg[0] === 'number'){
+ let date = new AscCommonExcel.cDate();
+ // 2 days + 1899/12/39 will create 1900/01/01
+ this.oStartingDate = date.getDateFromExcel(2);
+ }
+
+ // find label skip
+ this.calculateNLblTickSkip(oLabelsBox, fAxisLength);
+
+ // if rotation is not set
+ this.calculateRotation(oLabelsBox, fAxisLength);
+ };
+
+ CLabelsParameters.prototype.saveParams = function (oLabelsBox) {
+ if (!oLabelsBox) {
+ return;
+ }
+ oLabelsBox.axis.params = this;
+ };
+
+ CLabelsParameters.prototype.setMaxHeight = function (oLabelsBox, fRectHeight, layout) {
+ if (!oLabelsBox) {
+ return;
+ }
+
+ if (layout && AscFormat.isRealNumber(layout.h) && layout.h !== 0) {
+ const fChartHeight = layout.h;
+ const fChartStart = layout.y;
+ // find chart height
+ const fTrueRectHeight = oLabelsBox.chartSpace && AscFormat.isRealNumber(oLabelsBox.chartSpace.extY) ? oLabelsBox.chartSpace.extY : fRectHeight / fChartHeight;
+ const fTrueRectStart = fTrueRectHeight * fChartStart;
+
+ // function to obtains standart margin
+ let margin = oLabelsBox.chartSpace && oLabelsBox.chartSpace.chartObj ? oLabelsBox.chartSpace.chartObj.getStandartMargin() : 0;
+ const is3dChart = oLabelsBox.chartSpace ? oLabelsBox.chartSpace.is3dChart() : false;
+ margin = !is3dChart ? margin * 2 : margin;
+
+ // check wheter the axis is on top or on bottom, standart is bottom
+ const statement1 = !oLabelsBox.axis || (oLabelsBox.axis.axPos === AscFormat.AX_POS_B && oLabelsBox.axis.tickLblPos !== AscFormat.TICK_LABEL_POSITION_HIGH);
+ const statement2 = !oLabelsBox.axis || (oLabelsBox.axis.axPos === AscFormat.AX_POS_T && oLabelsBox.axis.tickLblPos === AscFormat.TICK_LABEL_POSITION_HIGH);
+ const isStandard = statement1 || statement2;
+
+ if (isStandard) {
+ const labelMaxHeight = fTrueRectHeight - (fTrueRectStart + fRectHeight);
+ this.maxHeight = labelMaxHeight > margin ? labelMaxHeight - margin : labelMaxHeight;
+ } else {
+ const labelMaxHeight = fTrueRectStart;
+ this.maxHeight = labelMaxHeight > ((3 * margin) / 4) ? labelMaxHeight - ((3 * margin) / 4) : labelMaxHeight;
+ }
+ } else {
+ //height multiplier defines the maximum occupation percentage
+ const heightMultiplier = 0.45;
+ this.maxHeight = fRectHeight * heightMultiplier;
+ }
+ };
+
+ CLabelsParameters.prototype.calculateNLblTickSkip = function (oLabelsBox, fAxisLength) {
+ //default nLblTickSkip should be 1!
+ if (!oLabelsBox || !Array.isArray(oLabelsBox.aLabels) || this.nLabelsCount === 0 || !fAxisLength) {
+ this.nLblTickSkip = 1;
+ return;
+ }
+
+ if (!this.isUserDefinedTickSkip) {
+ this.nLblTickSkip = this.manuallyCalculateNLblTickSkip(oLabelsBox, fAxisLength);
+ }
+ };
+
+ CLabelsParameters.prototype.getHeight = function (aLabels) {
+ for (let i = 0; i < aLabels.length; i++) {
+ //check if there multiple lines exist
+ //if so, take the height of first line
+ if (aLabels[i]) {
+ const content = aLabels[i].tx && aLabels[i].tx.rich && aLabels[i].tx.rich.content ? aLabels[i].tx.rich.content.Content : null;
+ const lines = content && Array.isArray(content) && content.length > 0 && content[0] ? content[0].Lines : null;
+ const height = lines && Array.isArray(lines) && lines.length > 0 ? lines[0].Y : null;
+ if (AscFormat.isRealNumber(height)) {
+ return height;
+ }
+
+ //check the height of the label
+ const labelSize = aLabels[i].tx.rich.getContentOneStringSizes();
+ if (AscFormat.isRealNumber(labelSize.h)) {
+ return labelSize.h;
+ }
+ }
+ }
+ return 0;
+ };
+
+ CLabelsParameters.prototype.manuallyCalculateNLblTickSkip = function (oLabelsBox, fAxisLength) {
+ // due to the rotation of the labels, the width necessary to place all of them is recalculated according to its height and some trigonometric formulas
+ const radianAngle = this.isUserDefinedRot ? (Math.abs(this.rot / this.degree) * Math.PI) / 180 : Math.PI / 2.0;
+ // if the rotation parameter is set then we need to measure the new width of the label
+ const rotationWidth = this.fLabelHeight / Math.sin(radianAngle);
+ // if the rotation width is higher than normal width, then take normal width
+ const updatedCellWidth = AscFormat.isRealNumber(oLabelsBox.maxMinWidth) ? Math.min(rotationWidth, oLabelsBox.maxMinWidth) : null;
+ this.fLabelWidth = AscFormat.isRealNumber(updatedCellWidth) ? updatedCellWidth : this.fLabelHeight;
+
+ // return minimum amount of skips needed to place a vertical labels into fAxisLength
+ let nLblTickSkip = 1;
+
+ if (this.fLabelWidth) {
+ // toDo test configurations for different number labels on excel: finalTestCatAxis
+ const labelCount = fAxisLength > 0 && fAxisLength >= this.fLabelWidth ? Math.floor(fAxisLength / this.fLabelWidth) : 1;
+ nLblTickSkip = Math.ceil(this.nLabelsCount / labelCount);
+
+ // date ax skips labels by significant days
+ // two days, week or weeks, mounths, years
+ if (this.nAxisType === AscDFH.historyitem_type_DateAx && this.sDataType !== 'string') {
+ // lowLimits indicate necessary count of days for following skips, month and years
+ const lowLimitMonths = 21;
+ const lowLimitYears = 341;
+ if (nLblTickSkip > 2 && nLblTickSkip < lowLimitMonths) {
+ nLblTickSkip = Math.ceil(nLblTickSkip / 7) * 7;
+ } else if (nLblTickSkip > 14 && nLblTickSkip < lowLimitYears) {
+ nLblTickSkip = Math.ceil(nLblTickSkip / 31) * 31;
+ } else if (nLblTickSkip >= lowLimitYears) {
+ nLblTickSkip = Math.ceil(nLblTickSkip / 366) * 366;
+ }
+ }
+ }
+
+ // default is always 1
+ return (!AscFormat.isRealNumber(nLblTickSkip) || nLblTickSkip === 0) ? 1 : nLblTickSkip;
+ };
+
+ CLabelsParameters.prototype.calculateRotation = function (oLabelsBox, fAxisLength) {
+
+ if (!oLabelsBox || !Array.isArray(oLabelsBox.aLabels) || this.nLabelsCount === 0|| !fAxisLength) {
+ this.rot = 0;
+ return;
+ }
+
+ if (this.isUserDefinedRot) {
+ return;
+ }
+
+ const updatedLabelsCount = Math.ceil(this.nLabelsCount / this.nLblTickSkip);
+
+ // Check if horizontal labels can fit into axis width
+ const labelWidth = oLabelsBox.maxMinWidth * updatedLabelsCount;
+ if (labelWidth && labelWidth <= fAxisLength) {
+ this.fLabelWidth = oLabelsBox.maxMinWidth;
+ this.rot = 0;
+ return;
+ }
+
+ // сheck if diagonal labels can fit into axis width
+ // also other suggestions to calculate diagonal width can be found in this function in commit: 616c0a0665bb0b09e81d9bc25df120ddf3c6783a
+ if (this.isUserDefinedLabelFormat || this.sDataType === 'string') {
+ // multiplier is the square root of 2;
+ // diagonal rectangle with h is equal to root(2) * h;
+ const fUpdatedLabelHight = 1.41421356237 * this.fLabelHeight;
+ const diagonalLabelWidth = fUpdatedLabelHight * updatedLabelsCount;
+
+ // diagonal angle is 45 degree
+ if (diagonalLabelWidth && diagonalLabelWidth <= fAxisLength) {
+ this.fLabelWidth = fUpdatedLabelHight;
+ this.rot = -45 * this.degree;
+ return;
+ }
+ }
+
+ // vertical angle is 90 degree
+ this.rot = this.isUserDefinedTickSkip && oLabelsBox.maxMinWidth < this.fLabelHeight? 0 : -90 * this.degree;
+ };
+
+ CLabelsParameters.prototype.isRotated = function () {
+ //case when rot parameter is unset
+ if (!AscFormat.isRealNumber(this.rot) || this.rot < -this.range || this.rot > this.range) {
+ return false;
+ }
+ // case when labels are rotated 0 degree
+ if (this.rot === 0) {
+ return false;
+ }
+
+ return true;
+ };
+
function CChartStyleCache() {
this.cachedStyles = {};
diff --git a/common/Drawings/Format/CnxShape.js b/common/Drawings/Format/CnxShape.js
index dc838b7935..d9ac39cad2 100644
--- a/common/Drawings/Format/CnxShape.js
+++ b/common/Drawings/Format/CnxShape.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -524,6 +524,11 @@
this.fillObject(copy, oPr);
return copy;
};
+ CConnectionShape.prototype.convertToPdf = function(oPr) {
+ let copy = new AscPDF.CPdfConnectionShape();
+ this.fillObject(copy, oPr);
+ return copy;
+ };
CConnectionShape.prototype.resetShape = function (oShape) {
if (!this.nvSpPr)
diff --git a/common/Drawings/Format/CreateGeometry.js b/common/Drawings/Format/CreateGeometry.js
index da6a4c07f3..0b09b27025 100644
--- a/common/Drawings/Format/CreateGeometry.js
+++ b/common/Drawings/Format/CreateGeometry.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Format/Data.js b/common/Drawings/Format/Data.js
index b7f24dbcd2..f92019ad4d 100644
--- a/common/Drawings/Format/Data.js
+++ b/common/Drawings/Format/Data.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -88,7 +88,11 @@ Because of this, the display is sometimes not correct.
// consts
const GRAYSCALE_TRESHHOLD = 150;
- const Point_type_asst = 1;
+ const smartArtContentFillingType_parentWithChildren = 0x0011;
+ const smartArtContentFillingType_onlyChildren = 0x0001;
+ const smartArtContentFillingType_onlyParent = 0x0010;
+
+ const Point_type_asst = 1;
const Point_type_doc = 2;
const Point_type_node = 0;
const Point_type_parTrans = 4;
@@ -203,11 +207,6 @@ Because of this, the display is sometimes not correct.
const If_op_gte = 4;
const If_op_lte = 5;
- const boolOperator_none = 0;
- const boolOperator_equ = 1;
- const boolOperator_gte = 2;
- const boolOperator_lte = 3;
-
const If_func_cnt = 0;
const If_func_depth = 6;
const If_func_maxDepth = 7;
@@ -254,7 +253,7 @@ Because of this, the display is sometimes not correct.
const Constr_type_endPad = 15;
const Constr_type_h = 16;
const Constr_type_hArH = 17;
- const Constr_type_hOff = 63; // TODO: add to constr type in x2t
+ const Constr_type_hOff = 63;
const Constr_type_l = 18;
const Constr_type_lMarg = 19;
const Constr_type_lOff = 20;
@@ -690,10 +689,10 @@ Because of this, the display is sometimes not correct.
const ParameterVal_connectorRouting_stra = 3;
const ParameterVal_continueDirection_revDir = 0;
const ParameterVal_continueDirection_sameDir = 1;
- const ParameterVal_diagramHorizontalAlignment_ctr = 0;
- const ParameterVal_diagramHorizontalAlignment_l = 1;
- const ParameterVal_diagramHorizontalAlignment_none = 2;
- const ParameterVal_diagramHorizontalAlignment_r = 3;
+ const ParameterVal_horizontalAlignment_ctr = 0;
+ const ParameterVal_horizontalAlignment_l = 1;
+ const ParameterVal_horizontalAlignment_none = 2;
+ const ParameterVal_horizontalAlignment_r = 3;
const ParameterVal_diagramTextAlignment_ctr = 0;
const ParameterVal_diagramTextAlignment_l = 1;
const ParameterVal_diagramTextAlignment_r = 2;
@@ -755,7 +754,7 @@ Because of this, the display is sometimes not correct.
const ParameterVal_textAnchorHorizontal_none = 1;
const ParameterVal_textAnchorVertical_b = 0;
const ParameterVal_textAnchorVertical_mid = 1;
- const ParameterVal_textAnchorVertical_top = 2;
+ const ParameterVal_textAnchorVertical_t = 2;
const ParameterVal_textBlockDirection_horz = 0;
const ParameterVal_textBlockDirection_vert = 1;
const ParameterVal_textDirection_fromB = 0;
@@ -981,6 +980,20 @@ Because of this, the display is sometimes not correct.
return [this.ptLst, this.cxnLst, this.whole, this.bg];
};
+ DataModel.prototype.getMainPoint = function () {
+ const ptLst = this.getPtLst();
+
+ if (ptLst) {
+ const arrPoints = ptLst.list;
+ for (let i = 0; i < arrPoints.length; i += 1) {
+ const oPoint = arrPoints[i];
+ if (oPoint.getType() === Point_type_doc) {
+ return oPoint;
+ }
+ }
+ }
+ }
+
changesFactory[AscDFH.historyitem_CCommonDataListAdd] = CChangeContent;
changesFactory[AscDFH.historyitem_CCommonDataListRemove] = CChangeContent;
@@ -1090,7 +1103,7 @@ Because of this, the display is sometimes not correct.
changesFactory[AscDFH.historyitem_CxnSibTransId] = CChangeString;
changesFactory[AscDFH.historyitem_CxnSrcId] = CChangeString;
changesFactory[AscDFH.historyitem_CxnSrcOrd] = CChangeString;
- changesFactory[AscDFH.historyitem_CxnType] = CChangeString;
+ changesFactory[AscDFH.historyitem_CxnType] = CChangeLong;
changesFactory[AscDFH.historyitem_CxnExtLst] = CChangeObject;
drawingsChangesMap[AscDFH.historyitem_CxnDestId] = function (oClass, value) {
oClass.destId = value;
@@ -1133,13 +1146,37 @@ Because of this, the display is sometimes not correct.
this.sibTransId = null;
this.srcId = null;
this.srcOrd = null;
- this.type = null;
+ this.type = Cxn_type_parOf;
this.extLst = null;
}
InitClass(Cxn, CBaseFormatObject, AscDFH.historyitem_type_Cxn);
+ Cxn.getTypeEnum = function (sType) {
+ switch (sType) {
+ case 'presOf':
+ return Cxn_type_presOf;
+ case 'parOf':
+ return Cxn_type_parOf;
+ case 'presParOf':
+ return Cxn_type_presParOf;
+ default:
+ return;
+ }
+ };
+ Cxn.getTypeString = function (sType) {
+ switch (sType) {
+ case Cxn_type_presOf:
+ return 'presOf';
+ case Cxn_type_parOf:
+ return 'parOf';
+ case Cxn_type_presParOf:
+ return 'presParOf';
+ default:
+ return '';
+ }
+ };
Cxn.prototype.setDestId = function (pr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_CxnDestId, this.getDestId(), pr));
this.destId = pr;
@@ -1181,7 +1218,7 @@ Because of this, the display is sometimes not correct.
}
Cxn.prototype.setType = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_CxnType, this.getType(), pr));
+ oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_CxnType, this.getType(), pr));
this.type = pr;
}
@@ -1248,7 +1285,7 @@ Because of this, the display is sometimes not correct.
Cxn.prototype.privateWriteAttributes = function(pWriter) {
pWriter._WriteString2(0, this.modelId);
- pWriter._WriteString2(1, this.type);
+ pWriter._WriteString2(1, Cxn.getTypeString(this.type));
pWriter._WriteString2(2, this.destId);
pWriter._WriteString2(3, this.destOrd);
pWriter._WriteString2(4, this.srcId);
@@ -1262,7 +1299,7 @@ Because of this, the display is sometimes not correct.
Cxn.prototype.readAttribute = function(nType, pReader) {
var oStream = pReader.stream;
if (0 === nType) this.setModelId(oStream.GetString2());
- else if (1 === nType) this.setType(oStream.GetString2());
+ else if (1 === nType) this.setType(Cxn.getTypeEnum(oStream.GetString2()));
else if (2 === nType) this.setDestId(oStream.GetString2());
else if (3 === nType) this.setDestOrd(oStream.GetString2());
else if (4 === nType) this.setSrcId(oStream.GetString2());
@@ -1615,7 +1652,7 @@ Because of this, the display is sometimes not correct.
CBaseFormatObject.call(this);
this.cxnId = null;
this.modelId = null;
- this.type = null;
+ this.type = Point_type_node;
this.extLst = null;
this.prSet = null;
@@ -1625,6 +1662,9 @@ Because of this, the display is sometimes not correct.
InitClass(Point, CBaseFormatObject, AscDFH.historyitem_type_Point);
+ Point.prototype.getHierBranchValue = function () {
+ return this.prSet && this.prSet.getHierBranchValue();
+ };
Point.prototype.getDrawingDocument = function () {
}
@@ -1887,6 +1927,14 @@ Because of this, the display is sometimes not correct.
return this.prSet && this.prSet.presStyleLbl;
};
+ Point.prototype.getPresName = function () {
+ return this.prSet && this.prSet.presName;
+ };
+
+ Point.prototype.getPresAssocID = function () {
+ return this.prSet && this.prSet.presAssocID;
+ };
+
Point.prototype.getCustAng = function () {
var prSet = this.getPrSet();
if (prSet) {
@@ -2054,7 +2102,9 @@ Because of this, the display is sometimes not correct.
InitClass(PrSet, CBaseFormatObject, AscDFH.historyitem_type_PrSet);
-
+ PrSet.prototype.getHierBranchValue = function () {
+ return this.presLayoutVars && this.presLayoutVars.getHierBranchValue();
+ };
PrSet.prototype.setCoherent3DOff = function (pr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeBool(this, AscDFH.historyitem_PrSetCoherent3DOff, this.getCoherent3DOff(), pr));
this.coherent3DOff = pr;
@@ -2374,8 +2424,8 @@ Because of this, the display is sometimes not correct.
pWriter._WriteInt2(8, this.custLinFactNeighborY ? Math.floor(this.custLinFactNeighborY * 100000) : null);
pWriter._WriteInt2(9, this.custLinFactX ? Math.floor(this.custLinFactX * 100000) : null);
pWriter._WriteInt2(10, this.custLinFactY ? Math.floor(this.custLinFactY * 100000) : null);
- pWriter._WriteInt2(11, this.custRadScaleInc);
- pWriter._WriteInt2(12, this.custRadScaleRad);
+ pWriter._WriteInt2(11, this.custRadScaleInc ? Math.floor(this.custRadScaleInc * 100000) : null);
+ pWriter._WriteInt2(12, this.custRadScaleRad ? Math.floor(this.custRadScaleRad * 100000) : null);
pWriter._WriteInt2(13, this.custScaleX ? Math.floor(this.custScaleX * 100000) : null);
pWriter._WriteInt2(14, this.custScaleY ? Math.floor(this.custScaleY * 100000) : null);
pWriter._WriteInt2(15, this.custSzX);
@@ -2409,8 +2459,8 @@ Because of this, the display is sometimes not correct.
else if (8 === nType) this.setCustLinFactNeighborY(oStream.GetLong() / 100000);
else if (9 === nType) this.setCustLinFactX(oStream.GetLong() / 100000);
else if (10 === nType) this.setCustLinFactY(oStream.GetLong() / 100000);
- else if (11 === nType) this.setCustRadScaleInc(oStream.GetLong());
- else if (12 === nType) this.setCustRadScaleRad(oStream.GetLong());
+ else if (11 === nType) this.setCustRadScaleInc(oStream.GetLong() / 100000);
+ else if (12 === nType) this.setCustRadScaleRad(oStream.GetLong() / 100000);
else if (13 === nType) this.setCustScaleX(oStream.GetLong() / 100000);
else if (14 === nType) this.setCustScaleY(oStream.GetLong() / 100000);
else if (15 === nType) this.setCustSzX(oStream.GetLong());
@@ -2681,7 +2731,7 @@ Because of this, the display is sometimes not correct.
break;
}
case 1: {
- this.setDesc(new Desc());
+ this.setDesc(new DiagramTitle());
this.desc.fromPPTY(pReader);
break;
}
@@ -2696,12 +2746,12 @@ Because of this, the display is sometimes not correct.
break;
}
case 4: {
- this.setStyleData(new StyleData());
+ this.setStyleData(new SampData());
this.styleData.fromPPTY(pReader);
break;
}
case 5: {
- this.setClrData(new ClrData());
+ this.setClrData(new SampData());
this.clrData.fromPPTY(pReader);
break;
}
@@ -2719,12 +2769,6 @@ Because of this, the display is sometimes not correct.
LayoutDef.prototype.getChildren = function() {
return [this.title, this.desc, this.catLst, this.sampData, this.styleData, this.clrData, this.layoutNode];
};
- LayoutDef.prototype.startAlgorithm = function (pointTree) {
- var entry = this.getLayoutNode();
- if (entry) {
- entry.startAlgorithm(pointTree);
- }
- };
function CatLst() {
@@ -2804,131 +2848,6 @@ Because of this, the display is sometimes not correct.
};
- changesFactory[AscDFH.historyitem_ClrDataUseDef] = CChangeBool;
- changesFactory[AscDFH.historyitem_ClrDataDataModel] = CChangeObject;
- drawingsChangesMap[AscDFH.historyitem_ClrDataUseDef] = function (oClass, value) {
- oClass.useDef = value;
- };
- drawingsChangesMap[AscDFH.historyitem_ClrDataDataModel] = function (oClass, value) {
- oClass.dataModel = value;
- };
-
- function ClrData() {
- CBaseFormatObject.call(this);
- this.useDef = null;
- this.dataModel = null;
- }
-
- InitClass(ClrData, CBaseFormatObject, AscDFH.historyitem_type_ClrData);
-
- ClrData.prototype.setUseDef = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeBool(this, AscDFH.historyitem_ClrDataUseDef, this.getUseDef(), pr));
- this.useDef = pr;
- }
-
- ClrData.prototype.setDataModel = function (oPr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_ClrDataDataModel, this.getDataModel(), oPr));
- this.dataModel = oPr;
- this.setParentToChild(oPr);
- }
-
- ClrData.prototype.getUseDef = function () {
- return this.useDef;
- }
-
- ClrData.prototype.getDataModel = function () {
- return this.dataModel;
- }
-
- ClrData.prototype.fillObject = function (oCopy, oIdMap) {
- oCopy.setUseDef(this.getUseDef());
- if (this.getDataModel()) {
- oCopy.setDataModel(this.getDataModel().createDuplicate(oIdMap));
- }
- }
-
- ClrData.prototype.privateWriteAttributes = function(pWriter) {
- pWriter._WriteBool2(0, this.useDef);
- };
- ClrData.prototype.writeChildren = function(pWriter) {
- this.writeRecord2(pWriter, 0, this.dataModel); // TODO: add record number
- };
- ClrData.prototype.readAttribute = function(nType, pReader) {
- var oStream = pReader.stream;
- if (0 === nType) this.setUseDef(oStream.GetBool());
- };
- ClrData.prototype.readChild = function(nType, pReader) {
- var s = pReader.stream;
- switch (nType) {
- case 0: {
- this.setDataModel(new DataModel());
- this.dataModel.fromPPTY(pReader);
- break;
- }
- default: {
- s.SkipRecord();
- break;
- }
- }
- };
- ClrData.prototype.getChildren = function() {
- return [this.dataModel];
- };
-
-
- changesFactory[AscDFH.historyitem_DescLang] = CChangeString;
- changesFactory[AscDFH.historyitem_DescVal] = CChangeString;
- drawingsChangesMap[AscDFH.historyitem_DescLang] = function (oClass, value) {
- oClass.lang = value;
- };
- drawingsChangesMap[AscDFH.historyitem_DescVal] = function (oClass, value) {
- oClass.val = value;
- };
-
- function Desc() {
- CBaseFormatObject.call(this);
- this.lang = null;
- this.val = null;
- }
- InitClass(Desc, CBaseFormatObject, AscDFH.historyitem_type_Desc);
- Desc.prototype.setLang = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_DescLang, this.getLang(), pr));
- this.lang = pr;
- }
-
- Desc.prototype.setVal = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_DescVal, this.getVal(), pr));
- this.val = pr;
- }
-
- Desc.prototype.getLang = function () {
- return this.lang;
- }
-
- Desc.prototype.getVal = function () {
- return this.val;
- }
-
- Desc.prototype.fillObject = function (oCopy, oIdMap) {
- oCopy.setLang(this.getLang());
- oCopy.setVal(this.getVal());
- }
-
- Desc.prototype.privateWriteAttributes = function(pWriter) {
- pWriter._WriteString2(0, this.lang);
- pWriter._WriteString2(1, this.val);
- };
- Desc.prototype.writeChildren = function(pWriter) {
- };
- Desc.prototype.readAttribute = function(nType, pReader) {
- var oStream = pReader.stream;
- if (0 === nType) this.setLang(oStream.GetString2());
- else if (1 === nType) this.setVal(oStream.GetString2());
- };
- Desc.prototype.readChild = function(nType, pReader) {
- };
-
-
changesFactory[AscDFH.historyitem_LayoutNodeChOrder] = CChangeLong;
changesFactory[AscDFH.historyitem_LayoutNodeMoveWith] = CChangeString;
changesFactory[AscDFH.historyitem_LayoutNodeName] = CChangeString;
@@ -3071,35 +2990,6 @@ Because of this, the display is sometimes not correct.
}, undefined);
};
- LayoutNode.prototype.startAlgorithm = function (pointTree) {
- if (pointTree) {
- var nodes = pointTree.findNodeByNameAndStyleLbl.call(pointTree, this.name, this.styleLbl);
- if (nodes) {
- var that = this;
- nodes.forEach(function (node) {
- var transfer = {node: node, name: that.name, styleLbl: that.styleLbl};
- var constrLst = that.list.reduce(function (acc, current) {
- return current instanceof ConstrLst ? current : acc;
- }, null);
- if (constrLst) {
- constrLst.startSetConstr(pointTree, transfer);
- }
- if (that.list) {
- that.list.forEach(function (element) {
- if (element instanceof AscFormat.ForEach || element instanceof AscFormat.LayoutNode || element instanceof AscFormat.Choose) {
- element.startAlgorithm(pointTree, transfer);
- }
- });
- }
- });
- }
- }
- };
-
- LayoutNode.prototype.findPoint = function (pointInfo) {
-
- };
-
changesFactory[AscDFH.historyitem_AlgRev] = CChangeLong;
changesFactory[AscDFH.historyitem_AlgType] = CChangeLong;
@@ -3226,7 +3116,7 @@ Because of this, the display is sometimes not correct.
changesFactory[AscDFH.historyitem_ParameterValConnectorPoint] = CChangeLong;
changesFactory[AscDFH.historyitem_ParameterValConnectorRouting] = CChangeLong;
changesFactory[AscDFH.historyitem_ParameterValContinueDirection] = CChangeLong;
- changesFactory[AscDFH.historyitem_ParameterValDiagramHorizontalAlignment] = CChangeLong;
+ changesFactory[AscDFH.historyitem_ParameterValHorizontalAlignment] = CChangeLong;
changesFactory[AscDFH.historyitem_ParameterValDiagramTextAlignment] = CChangeLong;
changesFactory[AscDFH.historyitem_ParameterValFallbackDimension] = CChangeLong;
changesFactory[AscDFH.historyitem_ParameterValFlowDirection] = CChangeLong;
@@ -3284,8 +3174,8 @@ Because of this, the display is sometimes not correct.
drawingsChangesMap[AscDFH.historyitem_ParameterValContinueDirection] = function (oClass, value) {
oClass.continueDirection = value;
};
- drawingsChangesMap[AscDFH.historyitem_ParameterValDiagramHorizontalAlignment] = function (oClass, value) {
- oClass.diagramHorizontalAlignment = value;
+ drawingsChangesMap[AscDFH.historyitem_ParameterValHorizontalAlignment] = function (oClass, value) {
+ oClass.horizontalAlignment = value;
};
drawingsChangesMap[AscDFH.historyitem_ParameterValDiagramTextAlignment] = function (oClass, value) {
oClass.diagramTextAlignment = value;
@@ -3373,7 +3263,7 @@ Because of this, the display is sometimes not correct.
this.connectorPoint = null;
this.connectorRouting = null;
this.continueDirection = null;
- this.diagramHorizontalAlignment = null;
+ this.horizontalAlignment = null;
this.diagramTextAlignment = null;
this.fallbackDimension = null;
this.flowDirection = null;
@@ -3457,9 +3347,9 @@ Because of this, the display is sometimes not correct.
this.continueDirection = pr;
};
- ParameterVal.prototype.setDiagramHorizontalAlignment = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_ParameterValDiagramHorizontalAlignment, this.getDiagramHorizontalAlignment(), pr));
- this.diagramHorizontalAlignment = pr;
+ ParameterVal.prototype.setHorizontalAlignment = function (pr) {
+ oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_ParameterValHorizontalAlignment, this.getHorizontalAlignment(), pr));
+ this.horizontalAlignment = pr;
};
ParameterVal.prototype.setDiagramTextAlignment = function (pr) {
@@ -3626,8 +3516,8 @@ Because of this, the display is sometimes not correct.
return this.continueDirection;
};
- ParameterVal.prototype.getDiagramHorizontalAlignment = function () {
- return this.diagramHorizontalAlignment;
+ ParameterVal.prototype.getHorizontalAlignment = function () {
+ return this.horizontalAlignment;
};
ParameterVal.prototype.getDiagramTextAlignment = function () {
@@ -3738,7 +3628,7 @@ Because of this, the display is sometimes not correct.
oCopy.setConnectorPoint(this.getConnectorPoint());
oCopy.setConnectorRouting(this.getConnectorRouting());
oCopy.setContinueDirection(this.getContinueDirection());
- oCopy.setDiagramHorizontalAlignment(this.getDiagramHorizontalAlignment());
+ oCopy.setHorizontalAlignment(this.getHorizontalAlignment());
oCopy.setDiagramTextAlignment(this.getDiagramTextAlignment());
oCopy.setFallbackDimension(this.getFallbackDimension());
oCopy.setFlowDirection(this.getFlowDirection());
@@ -3783,6 +3673,376 @@ Because of this, the display is sometimes not correct.
}
InitClass(Param, CBaseFormatObject, AscDFH.historyitem_type_Param);
+ Param.prototype.getValEnum = function () {
+ switch (this.type) {
+ case Param_type_ctrShpMap: {
+ switch (this.val) {
+ case 'fNode':
+ return ParameterVal_centerShapeMapping_fNode;
+ case 'none':
+ return ParameterVal_centerShapeMapping_none;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_autoTxRot: {
+ switch (this.val) {
+ case 'upr':
+ return ParameterVal_autoTextRotation_upr;
+ case 'grav':
+ return ParameterVal_autoTextRotation_grav;
+ case 'none':
+ return ParameterVal_autoTextRotation_none;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_rotPath: {
+ switch (this.val) {
+ case 'alongPath':
+ return ParameterVal_rotationPath_alongPath;
+ case 'none':
+ return ParameterVal_rotationPath_none;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_fallback: {
+ switch (this.val) {
+ case '1D':
+ return ParameterVal_fallbackDimension_1D;
+ case '2D':
+ return ParameterVal_fallbackDimension_2D;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_bendPt: {
+ switch (this.val) {
+ case 'end':
+ return ParameterVal_bendPoint_end;
+ case 'beg':
+ return ParameterVal_bendPoint_beg;
+ case 'def':
+ return ParameterVal_bendPoint_def;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_pyraAcctPos: {
+ switch (this.val) {
+ case 'bef':
+ return ParameterVal_pyramidAccentPosition_bef;
+ case 'aft':
+ return ParameterVal_pyramidAccentPosition_aft;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_nodeHorzAlign: {
+ switch (this.val) {
+ case 'l':
+ return ParameterVal_nodeHorizontalAlignment_l;
+ case 'ctr':
+ return ParameterVal_nodeHorizontalAlignment_ctr;
+ case 'r':
+ return ParameterVal_nodeHorizontalAlignment_r;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_nodeVertAlign: {
+ switch (this.val) {
+ case 'b':
+ return ParameterVal_nodeVerticalAlignment_b;
+ case 'mid':
+ return ParameterVal_nodeVerticalAlignment_mid;
+ case 't':
+ return ParameterVal_nodeVerticalAlignment_t;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_connRout: {
+ switch (this.val) {
+ case 'longCurve':
+ return ParameterVal_connectorRouting_longCurve;
+ case 'curve':
+ return ParameterVal_connectorRouting_curve;
+ case 'stra':
+ return ParameterVal_connectorRouting_stra;
+ case 'bend':
+ return ParameterVal_connectorRouting_bend;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_dim: {
+ switch (this.val) {
+ case '2D':
+ return ParameterVal_connectorDimension_2D;
+ case '1D':
+ return ParameterVal_connectorDimension_1D;
+ case 'cust':
+ return ParameterVal_connectorDimension_cust;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_begSty:
+ case Param_type_endSty: {
+ switch (this.val) {
+ case 'arr':
+ return ParameterVal_arrowheadStyle_arr;
+ case 'noArr':
+ return ParameterVal_arrowheadStyle_noArr;
+ case 'auto':
+ return ParameterVal_arrowheadStyle_auto;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_grDir: {
+ switch (this.val) {
+ case 'bL':
+ return ParameterVal_growDirection_bL;
+ case 'bR':
+ return ParameterVal_growDirection_bR;
+ case 'tL':
+ return ParameterVal_growDirection_tL;
+ case 'tR':
+ return ParameterVal_growDirection_tR;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_contDir: {
+ switch (this.val) {
+ case 'sameDir':
+ return ParameterVal_continueDirection_sameDir;
+ case 'revDir':
+ return ParameterVal_continueDirection_revDir;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_secLinDir:
+ case Param_type_linDir: {
+ switch (this.val) {
+ case 'fromL':
+ return ParameterVal_linearDirection_fromL;
+ case 'fromT':
+ return ParameterVal_linearDirection_fromT;
+ case 'fromR':
+ return ParameterVal_linearDirection_fromR;
+ case 'fromB':
+ return ParameterVal_linearDirection_fromB;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_hierAlign:
+ {
+ switch (this.val) {
+ case 'bCtrCh':
+ return ParameterVal_hierarchyAlignment_bCtrCh;
+ case 'bCtrDes':
+ return ParameterVal_hierarchyAlignment_bCtrDes;
+ case 'bL':
+ return ParameterVal_hierarchyAlignment_bL;
+ case 'bR':
+ return ParameterVal_hierarchyAlignment_bR;
+ case 'lB':
+ return ParameterVal_hierarchyAlignment_lB;
+ case 'lCtrCh':
+ return ParameterVal_hierarchyAlignment_lCtrCh;
+ case 'lCtrDes':
+ return ParameterVal_hierarchyAlignment_lCtrDes;
+ case 'lT':
+ return ParameterVal_hierarchyAlignment_lT;
+ case 'rB':
+ return ParameterVal_hierarchyAlignment_rB;
+ case 'rCtrCh':
+ return ParameterVal_hierarchyAlignment_rCtrCh;
+ case 'rCtrDes':
+ return ParameterVal_hierarchyAlignment_rCtrDes;
+ case 'rT':
+ return ParameterVal_hierarchyAlignment_rT;
+ case 'tCtrCh':
+ return ParameterVal_hierarchyAlignment_tCtrCh;
+ case 'tCtrDes':
+ return ParameterVal_hierarchyAlignment_tCtrDes;
+ case 'tL':
+ return ParameterVal_hierarchyAlignment_tL;
+ case 'tR':
+ return ParameterVal_hierarchyAlignment_tR;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_secChAlign:
+ case Param_type_chAlign: {
+ switch (this.val) {
+ case 'l':
+ return ParameterVal_childAlignment_l;
+ case 't':
+ return ParameterVal_childAlignment_t;
+ case 'r':
+ return ParameterVal_childAlignment_r;
+ case 'b':
+ return ParameterVal_childAlignment_b;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_flowDir: {
+ switch (this.val) {
+ case 'col':
+ return ParameterVal_flowDirection_col;
+ case 'row':
+ return ParameterVal_flowDirection_row;
+ default:
+ return this.val;
+ }
+ }
+ case Param_type_off:
+ switch (this.val) {
+ case 'ctr':
+ return ParameterVal_offset_ctr;
+ case 'off':
+ return ParameterVal_offset_off;
+ default:
+ return this.val;
+ }
+ case Param_type_bkpt:
+ switch (this.val) {
+ case 'fixed':
+ return ParameterVal_breakpoint_fixed;
+ case 'endCnv':
+ return ParameterVal_breakpoint_endCnv;
+ case 'bal':
+ return ParameterVal_breakpoint_bal;
+ default:
+ return this.val;
+ }
+ case Param_type_vertAlign:
+ switch (this.val) {
+ case 'mid':
+ return ParameterVal_verticalAlignment_mid;
+ case 'b':
+ return ParameterVal_verticalAlignment_b;
+ case 't':
+ return ParameterVal_verticalAlignment_t;
+ case 'none':
+ return ParameterVal_verticalAlignment_none;
+ default:
+ return this.val;
+ }
+ case Param_type_horzAlign:
+ switch (this.val) {
+ case 'r':
+ return ParameterVal_horizontalAlignment_r;
+ case 'l':
+ return ParameterVal_horizontalAlignment_l;
+ case 'ctr':
+ return ParameterVal_horizontalAlignment_ctr;
+ case 'none':
+ return ParameterVal_horizontalAlignment_none;
+ default:
+ return this.val;
+ }
+ case Param_type_begPts:
+ case Param_type_endPts:
+ const arrVal = this.val.split(' ');
+ const arrResult = [];
+ for (let i = 0; i < arrVal.length; i++) {
+ const val = arrVal[i];
+ switch (val) {
+ case "auto":
+ arrResult.push(ParameterVal_connectorPoint_auto);
+ break;
+ case "bCtr":
+ arrResult.push(ParameterVal_connectorPoint_bCtr);
+ break;
+ case "bL":
+ arrResult.push(ParameterVal_connectorPoint_bL);
+ break;
+ case "bR":
+ arrResult.push(ParameterVal_connectorPoint_bR);
+ break;
+ case "ctr":
+ arrResult.push(ParameterVal_connectorPoint_ctr);
+ break;
+ case "midL":
+ arrResult.push(ParameterVal_connectorPoint_midL);
+ break;
+ case "midR":
+ arrResult.push(ParameterVal_connectorPoint_midR);
+ break;
+ case "radial":
+ arrResult.push(ParameterVal_connectorPoint_radial);
+ break;
+ case "tCtr":
+ arrResult.push(ParameterVal_connectorPoint_tCtr);
+ break;
+ case "tL":
+ arrResult.push(ParameterVal_connectorPoint_tL);
+ break;
+ case "tR":
+ arrResult.push(ParameterVal_connectorPoint_tR);
+ break;
+ default:
+ break;
+ }
+ }
+ return arrResult;
+ case Param_type_parTxLTRAlign:
+ case Param_type_parTxRTLAlign:
+ case Param_type_shpTxLTRAlignCh:
+ case Param_type_shpTxRTLAlignCh:
+ switch (this.val) {
+ case "r":
+ return ParameterVal_horizontalAlignment_r;
+ case "l":
+ return ParameterVal_horizontalAlignment_l;
+ case "ctr":
+ return ParameterVal_horizontalAlignment_ctr;
+ default:
+ return this.val;
+ }
+ case Param_type_txAnchorVert:
+ case Param_type_txAnchorVertCh:
+ switch (this.val) {
+ case "b":
+ return ParameterVal_textAnchorVertical_b;
+ case "t":
+ return ParameterVal_textAnchorVertical_t;
+ case "mid":
+ return ParameterVal_textAnchorVertical_mid;
+ default:
+ return this.val;
+ }
+ case Param_type_txAnchorHorz:
+ case Param_type_txAnchorHorzCh:
+ switch (this.val) {
+ case "ctr":
+ return true;
+ default:
+ return false;
+ }
+ case Param_type_lnSpAfParP:
+ case Param_type_lnSpAfChP:
+ return parseFloat(this.val) / 100 * 1.2 * g_dKoef_pt_to_mm;
+ case Param_type_ar:
+ case Param_type_spanAng:
+ case Param_type_stAng:
+ case Param_type_bkPtFixedVal:
+ case Param_type_stBulletLvl:
+ return parseFloat(this.val);
+ default:
+ return this.val;
+ }
+ };
Param.prototype.setType = function (pr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_ParamType, this.getType(), pr));
@@ -3934,22 +4194,6 @@ Because of this, the display is sometimes not correct.
return [this.if, this.else];
};
- Choose.prototype.startAlgorithm = function (pointTree, node) {
- var check;
- for (var i = 0; i < this.if.length; i += 1) {
- if (!check) {
- check = this.if[i].startAlgorithm(pointTree, node);
- } else {
- this.if[i].startAlgorithm(pointTree, node);
- }
- }
- if (!check) {
- if (this.else) {
- this.else.startAlgorithm(pointTree, node);
- }
- }
- };
-
changesFactory[AscDFH.historyitem_ElseName] = CChangeString;
@@ -4036,20 +4280,6 @@ Because of this, the display is sometimes not correct.
return [].concat(this.list);
};
- Else.prototype.startAlgorithm = function (pointTree, node) {
- var constrLst = this.list.reduce(function (acc, current) {
- return current instanceof ConstrLst ? current : acc;
- }, null);
- if (constrLst) {
- constrLst.startSetConstr(pointTree, node);
- }
- this.list.forEach(function (element) {
- if (element instanceof AscFormat.ForEach || element instanceof AscFormat.LayoutNode || element instanceof AscFormat.Choose) {
- element.startAlgorithm(pointTree, node);
- }
- });
- };
-
changesFactory[AscDFH.historyitem_IteratorAttributesAddAxis] = CChangeContent;
changesFactory[AscDFH.historyitem_IteratorAttributesRemoveAxis] = CChangeContent;
changesFactory[AscDFH.historyitem_IteratorAttributesAddCnt] = AscDFH.CChangesDrawingsContentLong;
@@ -4111,6 +4341,74 @@ Because of this, the display is sometimes not correct.
InitClass(IteratorAttributes, CBaseFormatObject, AscDFH.historyitem_type_IteratorAttributes);
+
+ IteratorAttributes.prototype.getNodesArray = function (smartartAlgorithm) {
+ if (!this.axis.length) {
+ return [];
+ }
+ const currentNode = smartartAlgorithm.getCurrentNode();
+ let currentNodes = [currentNode];
+ for (let i = 0; i < this.axis.length; i += 1) {
+ const newCurrentNodes = [];
+ for (let j = 0; j < currentNodes.length; j += 1) {
+ const node = currentNodes[j];
+ const tempNodes = [];
+ node.getNodesByAxis(tempNodes, this.getAxis(i), this.getPtType(i));
+ const step = this.getStep(i);
+ let count = this.getCount(i) || tempNodes.length;
+ for (let k = this.getStart(i, tempNodes.length); k < tempNodes.length; k += step) {
+ if (!count) {
+ break;
+ }
+ newCurrentNodes.push(tempNodes[k]);
+ count -= 1;
+ }
+ }
+ currentNodes = newCurrentNodes;
+ }
+ const lastNode = currentNodes[currentNodes.length - 1];
+ if (lastNode && lastNode.isHideLastTrans) {
+ currentNodes.pop();
+ }
+ return currentNodes;
+ };
+ IteratorAttributes.prototype.getPtType = function (index) {
+ if (this.ptType[index]) {
+ return this.ptType[index].getVal();
+ }
+ return ElementType_value_all;
+ };
+ IteratorAttributes.prototype.getCount = function (index) {
+ return this.cnt[index] || 0;
+ };
+ IteratorAttributes.prototype.getAxis = function (index) {
+ if (this.axis[index]) {
+ return this.axis[index].getVal();
+ }
+ return AxisType_value_none;
+ };
+ IteratorAttributes.prototype.getStart = function (index, nodesLength) {
+ if (AscFormat.isRealNumber(this.st[index])) {
+ const start = this.st[index];
+ if (start <= 0) {
+ return Math.max(nodesLength + start, 0);
+ }
+ return start - 1;
+ }
+ return 0;
+ };
+ IteratorAttributes.prototype.getStep = function (index) {
+ if (AscFormat.isRealNumber(this.step[index])) {
+ return this.st[index];
+ }
+ return 1;
+ };
+ IteratorAttributes.prototype.getHideLastTrans = function (index) {
+ if (this.hideLastTrans[index] !== undefined) {
+ return this.hideLastTrans[index];
+ }
+ return true;
+ };
IteratorAttributes.prototype.addToLstAxis = function (nIdx, oPr) {
var nInsertIdx = Math.min(this.axis.length, Math.max(0, nIdx));
oHistory.CanAddChanges() && oHistory.Add(new CChangeContent(this, AscDFH.historyitem_IteratorAttributesAddAxis, nInsertIdx, [oPr], true));
@@ -4347,7 +4645,7 @@ Because of this, the display is sometimes not correct.
function ElementType() {
CBaseFormatObject.call(this);
- this.val = null;
+ this.val = ElementType_value_all;
}
InitClass(ElementType, CBaseFormatObject, AscDFH.historyitem_type_ElementType);
@@ -4566,7 +4864,7 @@ Because of this, the display is sometimes not correct.
oCopy.setInt(this.getInt());
};
- changesFactory[AscDFH.historyitem_IfArg] = CChangeString;
+ changesFactory[AscDFH.historyitem_IfArg] = CChangeLong;
changesFactory[AscDFH.historyitem_IfRef] = CChangeString;
changesFactory[AscDFH.historyitem_IfFunc] = CChangeLong;
changesFactory[AscDFH.historyitem_IfName] = CChangeString;
@@ -4602,7 +4900,7 @@ Because of this, the display is sometimes not correct.
function If() {
IteratorAttributes.call(this);
- this.arg = null;
+ this.arg = If_arg_none;
this.func = null;
this.name = null;
this.op = null;
@@ -4612,9 +4910,58 @@ Because of this, the display is sometimes not correct.
}
InitClass(If, IteratorAttributes, AscDFH.historyitem_type_If);
+ If.getArgEnum = function (arg) {
+ switch (arg) {
+ case 'animLvl':
+ return If_arg_animLvl;
+ case 'animOne':
+ return If_arg_animOne;
+ case 'bulEnabled':
+ return If_arg_bulEnabled;
+ case 'chMax':
+ return If_arg_chMax;
+ case 'chPref':
+ return If_arg_chPref;
+ case 'dir':
+ return If_arg_dir;
+ case 'hierBranch':
+ return If_arg_hierBranch;
+ case 'orgChart':
+ return If_arg_orgChart;
+ case 'resizeHandles':
+ return If_arg_resizeHandles;
+ case 'none':
+ default:
+ return If_arg_none;
+ }
+ };
+ If.getArgString = function (arg) {
+ switch (arg) {
+ case If_arg_animLvl:
+ return 'animLvl';
+ case If_arg_animOne:
+ return 'animOne';
+ case If_arg_bulEnabled:
+ return 'bulEnabled';
+ case If_arg_chMax:
+ return 'chMax';
+ case If_arg_chPref:
+ return 'chPref';
+ case If_arg_dir:
+ return 'dir';
+ case If_arg_hierBranch:
+ return 'hierBranch';
+ case If_arg_none:
+ return 'none';
+ case If_arg_orgChart:
+ return 'orgChart';
+ case If_arg_resizeHandles:
+ return 'resizeHandles';
+ }
+ }
If.prototype.setArg = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_IfArg, this.getArg(), pr));
+ oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_IfArg, this.getArg(), pr));
this.arg = pr;
};
@@ -4758,7 +5105,7 @@ Because of this, the display is sometimes not correct.
pWriter._WriteUChar2(8, this.op);
pWriter._WriteUChar2(9, this.func);
pWriter._WriteString2(10, this.val);
- pWriter._WriteString2(11, this.arg);
+ pWriter._WriteString2(11, If.getArgString(this.arg));
};
If.prototype.writeChildren = function(pWriter) {
for(var nIndex = 0; nIndex < this.list.length; ++nIndex) {
@@ -4798,7 +5145,7 @@ Because of this, the display is sometimes not correct.
else if (8 === nType) this.setOp(oStream.GetUChar());
else if (9 === nType) this.setFunc(oStream.GetUChar());
else if (10 === nType) this.setVal(oStream.GetString2());
- else if (11 === nType) this.setArg(oStream.GetString2());
+ else if (11 === nType) this.setArg(If.getArgEnum(oStream.GetString2()));
};
If.prototype.readChild = function(nType, pReader) {
@@ -4808,191 +5155,6 @@ Because of this, the display is sometimes not correct.
return [].concat(this.list);
};
- If.prototype.startAlgorithm = function (pointTree, node) {
- var check = this.checkCondition(pointTree, node);
- if (check) {
- var constrLst = this.list.reduce(function (acc, current) {
- return current instanceof ConstrLst ? current : acc;
- }, null);
- if (constrLst) {
- constrLst.startSetConstr(pointTree, node);
- }
- this.list.forEach(function (element) {
- if (element instanceof AscFormat.ForEach || element instanceof AscFormat.LayoutNode || element instanceof AscFormat.Choose) {
- element.startAlgorithm(pointTree, node);
- }
- });
- }
- return check;
- };
-
-
- If.prototype.checkCondition = function (pointTree, nodeData) {
- if (nodeData.node) {
- var nodes = [];
- var smartArtNode = nodeData.node.parent;
- this.axis.forEach(function (type) {
- nodes = nodes.concat(smartArtNode.getAxis(type.getVal()));
- });
- }
-
- switch (this.func) {
- case If_func_cnt:
- return this.funcCnt(nodes);
- case If_func_depth:
- return this.funcDepth(nodes);
- case If_func_maxDepth:
- return this.funcMaxDepth(nodes);
- case If_func_pos:
- return this.funcPos(nodes);
- case If_func_posEven:
- return this.funcPosEven(nodes);
- case If_func_posOdd:
- return this.funcPosOdd(nodes);
- case If_func_revPos:
- return this.funcRevPos(nodes);
- case If_func_var:
- return this.funcVar(nodeData);
- default:
- return false;
- }
- };
-
- If.prototype.funcVar = function (nodeData) {
- if (nodeData && nodeData.node) {
- var nodeElement = nodeData.node.parent;
- var rootOfTree = nodeElement.getRoot()[0];
- var rootPres = rootOfTree.data.getPresWithVarLst();
- var currentPres = nodeData.node.getPresByNameAndStyleLbl(nodeData.name, nodeData.styleLbl);
- switch (this.arg) {
- case 'animLvl':
- case 'hierBranch':
- case 'bulletEnabled':
- if (currentPres && currentPres.prSet && currentPres.prSet.presLayoutVars) {
- return this.compare(currentPres.prSet.presLayoutVars.getVal(this.arg));
- }
- break;
-
- case 'animOne':
- case 'dir':
- case 'chPref':
- case 'chMax':
- case 'orgChart':
- case 'resizeHandles':
- if (rootPres && rootPres.prSet && rootPres.prSet.presLayoutVars && rootPres.prSet.presLayoutVars[this.arg]) {
- return this.compare(rootPres.prSet.presLayoutVars.getVal(this.arg));
- }
- break;
- default:
- return false;
- }
- }
- return false;
- };
-
- If.prototype.funcCnt = function (axis) {
- var count = 0;
- this.ptType.forEach(function (Type) {
- var typeOfPoint = Type.getVal();
- axis.forEach(function (node) {
- count += node.getPoints(typeOfPoint).length;
- });
- });
- return this.compare(count);
- };
-
- If.prototype.funcDepth = function (axis) {
- return this.compare(axis[0].data.depth);
- };
-
- If.prototype.funcMaxDepth = function (axis) {
- var maxDepth = axis.reduce(function (acc, b) {
- if (b.data.depth > acc) {
- return b.data.depth;
- }
- return acc;
- }, 0);
- return this.compare(maxDepth);
- };
-
- If.prototype.funcPos = function () {
-
- };
-
- If.prototype.funcPosEven = function (axis) {
- return this.funcPos(axis) % 2 === 0;
- };
-
- If.prototype.funcPosOdd = function (axis) {
- return this.funcPos(axis) % 2 === 1;
- };
-
- If.prototype.funcRevPos = function () {
-
- };
-
- If.prototype.compare = function (comparingArg) {
- var val = this.valAdapter(this.val);
- var adaptComparingArg = this.valAdapter(comparingArg);
- switch (this.op) {
- case If_op_equ:
- return adaptComparingArg === val;
- case If_op_gt:
- return adaptComparingArg > val;
- case If_op_gte:
- return adaptComparingArg >= val;
- case If_op_lt:
- return adaptComparingArg < val;
- case If_op_lte:
- return adaptComparingArg <= val;
- case If_op_neq:
- return adaptComparingArg !== val;
- default:
- return false;
- }
- };
-
- If.prototype.valAdapter = function (value) {
- var adaptVal;
- if (!(parseFloat(value) !== parseFloat(value))) {
- adaptVal = parseFloat(value);
- } else {
- switch (value) {
- case 'norm':
- case 'none':
- case 'hang':
- case 'exact':
- case false:
- case 'false':
- adaptVal = 0;
- break;
- case 'rev':
- case 'ctr':
- case 'branch':
- case 'init':
- case 'rel':
- case true:
- case 'true':
- adaptVal = 1;
- break;
- case 'lvl':
- case 'one':
- case 'l':
- adaptVal = 2;
- break;
- case 'r':
- adaptVal = 3;
- break;
- case 'std':
- adaptVal = 4;
- break;
- default:
- return;
- }
- }
- return adaptVal;
- };
-
function ConstrLst() {
CCommonDataList.call(this);
}
@@ -5015,34 +5177,6 @@ Because of this, the display is sometimes not correct.
}
};
- ConstrLst.prototype.startSetConstr = function (pointTree, node) {
- var constrWithPrimFont = [];
- var constrWithSecFont = [];
- this.list.forEach(function (constr) {
- if (constr.type === Constr_type_primFontSz) {
- constrWithPrimFont.push({
- constr: constr,
- node: node,
- });
- } else if (constr.type === Constr_type_secFontSz) {
- constrWithSecFont.push({
- constr: constr,
- node: node,
- });
- } else {
- constr.setConstr(pointTree, [{node: node, constr: constr}]);
- }
- });
- if (constrWithPrimFont.length !== 0) {
- constrWithPrimFont[0].constr.setConstr(pointTree, constrWithPrimFont);
- }
- if (constrWithSecFont.length !== 0) {
- constrWithSecFont[0].constr.setConstr(pointTree, constrWithSecFont);
- }
- };
-
-
-
changesFactory[AscDFH.historyitem_ConstrFact] = CChangeDouble2;
changesFactory[AscDFH.historyitem_ConstrFor] = CChangeLong;
changesFactory[AscDFH.historyitem_ConstrForName] = CChangeString;
@@ -5095,17 +5229,17 @@ Because of this, the display is sometimes not correct.
function Constr() {
CBaseFormatObject.call(this);
- this.fact = null;
- this.for = null;
+ this.fact = 1;
+ this.for = Constr_for_self;
this.forName = null;
- this.op = null;
+ this.op = Constr_op_none;
this.setPtType(new ElementType());
- this.refFor = null;
+ this.refFor = Constr_for_self;
this.refForName = null;
this.setRefPtType(new ElementType());
- this.refType = null;
+ this.refType = Constr_type_none;
this.type = null;
- this.val = null;
+ this.val = 0;
this.extLst = null;
}
@@ -5283,534 +5417,6 @@ Because of this, the display is sometimes not correct.
Constr.prototype.readChild = function(nType, pReader) {
};
- Constr.prototype.getFieldScale = function (type) {
- if (type) {
- switch (type) {
- case Constr_type_alignOff:
- return 1;
- case Constr_type_b:
- return 1;
- case Constr_type_begMarg:
- return 1;
- case Constr_type_begPad:
- return 1;
- case Constr_type_bendDist:
- return 1;
- case Constr_type_bMarg:
- return 1;
- case Constr_type_bOff:
- return 1;
- case Constr_type_connDist:
- return 1;
- case Constr_type_ctrX:
- return 1;
- case Constr_type_ctrXOff:
- return 1;
- case Constr_type_ctrY:
- return 1;
- case Constr_type_ctrYOff:
- return 1;
- case Constr_type_diam:
- return 1;
- case Constr_type_endMarg:
- return 1;
- case Constr_type_endPad:
- return 1;
- case Constr_type_h:
- case Constr_type_w:
- return 36000;
- case Constr_type_hArH:
- return 1;
- case Constr_type_hOff: // TODO: add to constr type in x2t
- return 1;
- case Constr_type_l:
- return 1;
- case Constr_type_lMarg:
- return 1;
- case Constr_type_lOff:
- return 1;
- case Constr_type_none:
- return 1;
- case Constr_type_primFontSz:
- case Constr_type_secFontSz:
- return 100 * Constr_font_scale;
- case Constr_type_pyraAcctRatio:
- return 1;
- case Constr_type_r:
- return 1;
- case Constr_type_rMarg:
- return 1;
- case Constr_type_rOff:
- return 1;
- case Constr_type_secSibSp:
- return 1;
- case Constr_type_sibSp:
- return 1;
- case Constr_type_sp:
- return 1;
- case Constr_type_stemThick:
- return 1;
- case Constr_type_t:
- return 1;
- case Constr_type_tMarg:
- return 1;
- case Constr_type_tOff:
- return 1;
- case Constr_type_userA:
- return 1;
- case Constr_type_userB:
- return 1;
- case Constr_type_userC:
- return 1;
- case Constr_type_userD:
- return 1;
- case Constr_type_userE:
- return 1;
- case Constr_type_userF:
- return 1;
- case Constr_type_userG:
- return 1;
- case Constr_type_userH:
- return 1;
- case Constr_type_userI:
- return 1;
- case Constr_type_userJ:
- return 1;
- case Constr_type_userK:
- return 1;
- case Constr_type_userL:
- return 1;
- case Constr_type_userM:
- return 1;
- case Constr_type_userN:
- return 1;
- case Constr_type_userO:
- return 1;
- case Constr_type_userP:
- return 1;
- case Constr_type_userQ:
- return 1;
- case Constr_type_userR:
- return 1;
- case Constr_type_userS:
- return 1;
- case Constr_type_userT:
- return 1;
- case Constr_type_userU:
- return 1;
- case Constr_type_userV:
- return 1;
- case Constr_type_userW:
- return 1;
- case Constr_type_userX:
- return 1;
- case Constr_type_userY:
- return 1;
- case Constr_type_userZ:
- return 1;
- case Constr_type_wArH:
- return 1;
- case Constr_type_wOff:
- return 1;
- default:
- return 1;
- }
- }
- return 1;
- };
-
- Constr.prototype.getConstrVal = function (shape) {
- var result;
- if (this.val) {
- result = this.val;
- return;
- } else {
- if (shape) {
- var constrType = this.refType;
-
- switch (constrType) {
- case Constr_type_alignOff:
- break;
- case Constr_type_b:
- break;
- case Constr_type_begMarg:
- break;
- case Constr_type_begPad:
- break;
- case Constr_type_bendDist:
- break;
- case Constr_type_bMarg:
- break;
- case Constr_type_bOff:
- break;
- case Constr_type_connDist:
- break;
- case Constr_type_ctrX:
- break;
- case Constr_type_ctrXOff:
- break;
- case Constr_type_ctrY:
- break;
- case Constr_type_ctrYOff:
- break;
- case Constr_type_diam:
- break;
- case Constr_type_endMarg:
- break;
- case Constr_type_endPad:
- break;
- case Constr_type_h:
- //result = shape.extX;
- break;
- case Constr_type_hArH:
- break;
- case Constr_type_hOff: // TODO: add to constr type in x2t
- break;
- case Constr_type_l:
- break;
- case Constr_type_lMarg:
- break;
- case Constr_type_lOff:
- break;
- case Constr_type_none:
- break;
- case Constr_type_primFontSz:
- case Constr_type_secFontSz:
- if (shape.txBody && shape.txBody.content) {
- result = shape.txBody.content.getFontSizeForConstr();
- }
- break;
- case Constr_type_pyraAcctRatio:
- break;
- case Constr_type_r:
- break;
- case Constr_type_rMarg:
- break;
- case Constr_type_rOff:
- break;
- case Constr_type_secSibSp:
- break;
- case Constr_type_sibSp:
- break;
- case Constr_type_sp:
- break;
- case Constr_type_stemThick:
- break;
- case Constr_type_t:
- break;
- case Constr_type_tMarg:
- break;
- case Constr_type_tOff:
- break;
- case Constr_type_userA:
- break;
- case Constr_type_userB:
- break;
- case Constr_type_userC:
- break;
- case Constr_type_userD:
- break;
- case Constr_type_userE:
- break;
- case Constr_type_userF:
- break;
- case Constr_type_userG:
- break;
- case Constr_type_userH:
- break;
- case Constr_type_userI:
- break;
- case Constr_type_userJ:
- break;
- case Constr_type_userK:
- break;
- case Constr_type_userL:
- break;
- case Constr_type_userM:
- break;
- case Constr_type_userN:
- break;
- case Constr_type_userO:
- break;
- case Constr_type_userP:
- break;
- case Constr_type_userQ:
- break;
- case Constr_type_userR:
- break;
- case Constr_type_userS:
- break;
- case Constr_type_userT:
- break;
- case Constr_type_userU:
- break;
- case Constr_type_userV:
- break;
- case Constr_type_userW:
- break;
- case Constr_type_userX:
- break;
- case Constr_type_userY:
- break;
- case Constr_type_userZ:
- break;
- case Constr_type_w:
- //result = shape.extY;
- break;
- case Constr_type_wArH:
- break;
- case Constr_type_wOff:
- break;
- default:
- return;
- }
- if (typeof result === 'number' && !(result !== result)) {
- result *= this.getFieldScale(constrType);
- }
- }
- }
- if (typeof result === 'number'&& !(result !== result)) {
- var fact = Math.abs(this.fact ? this.fact : 1);
- result *= fact;
- return result;
- }
- };
-
- Constr.prototype.getShapesFromAxis = function (transfer, isRef) {
- var node = transfer && transfer.node && transfer.node.parent;
- if (node) {
- var axisNodes;
- var shapes = [];
- var fGetAxis = this.getAxisFromParent.bind(this, node);
- var that = this;
- axisNodes = isRef ? fGetAxis(this.refFor) : fGetAxis(this.for);
- if (axisNodes && axisNodes.length !== 0) {
- var ptType;
- if (isRef) {
- ptType = this.refPtType && this.refPtType.getVal();
- shapes = axisNodes.reduce(function (acc, axisNode) {
- if (that.refForName && ptType) {
- return acc.concat(axisNode.getShape(that.refForName, ptType));
- }
- else if (that.refForName) {
- return acc.concat(axisNode.getShape(that.refForName));
- }
- else if (ptType) {
- return acc.concat(axisNode.getShape(transfer.name, ptType));
- } else {
- return acc.concat(axisNode.getShape(transfer.name));
- }
- }, []);
- } else {
- ptType = this.ptType && this.ptType.getVal();
- shapes = axisNodes.reduce(function (acc, axisNode) {
- if (that.forName && ptType) {
- return acc.concat(axisNode.getShape(that.forName, ptType));
- }
- else if (that.forName) {
- return acc.concat(axisNode.getShape(that.forName));
- }
- else if (ptType) {
- return acc.concat(axisNode.getShape(undefined, ptType));
- } else {
- return acc.concat(axisNode.getShape());
- }
- }, []);
- }
- }
- return shapes;
- }
- };
-
- Constr.prototype.getAxisFromParent = function (node, constrAxisType) {
- switch (constrAxisType) {
- case Constr_for_ch:
- return node.getAxis(AxisType_value_ch);
- case Constr_for_des:
- return node.getAxis(AxisType_value_des);
- case Constr_for_self:
- return node.getAxis(AxisType_value_self);
- default:
- return node.getAxis(AxisType_value_self);
- }
- };
-
- Constr.prototype.setConstr = function (pointTree, transfer) {
- // var node = transfer;
- // var smartArt = pointTree && pointTree.parent;
- // if (node) {
- // var shapes = this.getShapesFromAxis(node, false);
- // var refShape = this.getShapesFromAxis(node, true);
- // if (this.type === Constr_type_primFontSz || this.type === Constr_type_secFontSz) {
- // if (smartArt) {
- // smartArt.setTruthFontSizeInSmartArt(shapes);
- // }
- // return;
- // }
- //
- // var that = this;
- // var value = refShape.reduce(function (acc, shape) {
- // var compute = that.getConstrVal(shape);
- // if (!acc && typeof compute === 'number') {
- // return compute;
- // } else if (typeof compute === 'number' && compute > acc) {
- // return compute;
- // }
- // return acc;
- // }, undefined);
- //
- // if (typeof value === 'number' && !(value !== value)) {
- // value /= this.getFieldScale(this.type);
- // shapes.forEach(function (shape) {
- // var setter = that.getConstrSetter(shape);
- // if (setter) {
- // setter.call(shape, value);
- // }
- // });
- // }
- // }
- };
-
- Constr.prototype.getConstrSetter = function (shape) {
- if (shape) {
- var constrType = this.type;
- switch (constrType) {
- case Constr_type_alignOff:
- break;
- case Constr_type_b:
- break;
- case Constr_type_begMarg:
- break;
- case Constr_type_begPad:
- break;
- case Constr_type_bendDist:
- break;
- case Constr_type_bMarg:
- break;
- case Constr_type_bOff:
- break;
- case Constr_type_connDist:
- break;
- case Constr_type_ctrX:
- break;
- case Constr_type_ctrXOff:
- break;
- case Constr_type_ctrY:
- break;
- case Constr_type_ctrYOff:
- break;
- case Constr_type_diam:
- break;
- case Constr_type_endMarg:
- break;
- case Constr_type_endPad:
- break;
- case Constr_type_h:
- //return shape.setResizeHeightConstr;
- break;
- case Constr_type_hArH:
- break;
- case Constr_type_hOff: // TODO: add to constr type in x2t
- break;
- case Constr_type_l:
- break;
- case Constr_type_lMarg:
- break;
- case Constr_type_lOff:
- break;
- case Constr_type_none:
- break;
- case Constr_type_primFontSz:
- case Constr_type_secFontSz:
- //return shape.setFontSizeForAllContent;
- break;
- case Constr_type_pyraAcctRatio:
- break;
- case Constr_type_r:
- break;
- case Constr_type_rMarg:
- break;
- case Constr_type_rOff:
- break;
- case Constr_type_secSibSp:
- break;
- case Constr_type_sibSp:
- break;
- case Constr_type_sp:
- break;
- case Constr_type_stemThick:
- break;
- case Constr_type_t:
- break;
- case Constr_type_tMarg:
- break;
- case Constr_type_tOff:
- break;
- case Constr_type_userA:
- break;
- case Constr_type_userB:
- break;
- case Constr_type_userC:
- break;
- case Constr_type_userD:
- break;
- case Constr_type_userE:
- break;
- case Constr_type_userF:
- break;
- case Constr_type_userG:
- break;
- case Constr_type_userH:
- break;
- case Constr_type_userI:
- break;
- case Constr_type_userJ:
- break;
- case Constr_type_userK:
- break;
- case Constr_type_userL:
- break;
- case Constr_type_userM:
- break;
- case Constr_type_userN:
- break;
- case Constr_type_userO:
- break;
- case Constr_type_userP:
- break;
- case Constr_type_userQ:
- break;
- case Constr_type_userR:
- break;
- case Constr_type_userS:
- break;
- case Constr_type_userT:
- break;
- case Constr_type_userU:
- break;
- case Constr_type_userV:
- break;
- case Constr_type_userW:
- break;
- case Constr_type_userX:
- break;
- case Constr_type_userY:
- break;
- case Constr_type_userZ:
- break;
- case Constr_type_w:
- //return shape.setResizeWidthConstr;
- break;
- case Constr_type_wArH:
- break;
- case Constr_type_wOff:
- break;
- default:
- return;
- }
- }
- };
-
changesFactory[AscDFH.historyitem_PresOfExtLst] = CChangeObject;
drawingsChangesMap[AscDFH.historyitem_PresOfExtLst] = function (oClass, value) {
oClass.extLst = value;
@@ -5960,7 +5566,7 @@ Because of this, the display is sometimes not correct.
function Rule() {
CBaseFormatObject.call(this);
this.fact = null;
- this.for = null;
+ this.for = AscFormat.Constr_for_self;
this.forName = null;
this.max = null;
this.type = null;
@@ -6094,7 +5700,7 @@ Because of this, the display is sometimes not correct.
changesFactory[AscDFH.historyitem_SShapeHideGeom] = CChangeBool;
changesFactory[AscDFH.historyitem_SShapeLkTxEntry] = CChangeBool;
changesFactory[AscDFH.historyitem_SShapeRot] = CChangeDouble2;
- changesFactory[AscDFH.historyitem_SShapeType] = CChangeString;
+ changesFactory[AscDFH.historyitem_SShapeType] = CChangeLong;
changesFactory[AscDFH.historyitem_SShapeZOrderOff] = CChangeLong;
changesFactory[AscDFH.historyitem_SShapeAdjLst] = CChangeObject;
changesFactory[AscDFH.historyitem_SShapeExtLst] = CChangeObject;
@@ -6129,12 +5735,12 @@ Because of this, the display is sometimes not correct.
function SShape() {
CBaseFormatObject.call(this);
this.blip = null;
- this.blipPhldr = null;
- this.hideGeom = null;
- this.lkTxEntry = null;
- this.rot = null;
- this.type = null;
- this.zOrderOff = null;
+ this.blipPhldr = false;
+ this.hideGeom = false;
+ this.lkTxEntry = false;
+ this.rot = 0;
+ this.type = LayoutShapeType_outputShapeType_none;
+ this.zOrderOff = 0;
this.adjLst = null;
this.extLst = null;
}
@@ -6167,7 +5773,7 @@ Because of this, the display is sometimes not correct.
}
SShape.prototype.setType = function (oPr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_SShapeType, this.getType(), oPr));
+ oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_SShapeType, this.getType(), oPr));
this.type = oPr;
}
@@ -6246,7 +5852,7 @@ Because of this, the display is sometimes not correct.
pWriter._WriteBool2(3, this.lkTxEntry);
pWriter._WriteDoubleReal2(4, this.rot);
pWriter._WriteInt2(5, this.zOrderOff);
- pWriter._WriteString2(6, this.type);
+ pWriter._WriteString2(6, AscCommon.To_XML_ST_LayoutShapeType(this.type));
};
SShape.prototype.writeChildren = function(pWriter) {
@@ -6259,8 +5865,8 @@ Because of this, the display is sometimes not correct.
else if (2 === nType) this.setHideGeom(oStream.GetBool());
else if (3 === nType) this.setLkTxEntry(oStream.GetBool());
else if (4 === nType) this.setRot(oStream.GetDouble());
- else if (5 === nType) this.setZOrderOff(oStream.GetULong());
- else if (6 === nType) this.setType(oStream.GetString2());
+ else if (5 === nType) this.setZOrderOff(oStream.GetLong());
+ else if (6 === nType) this.setType(AscCommon.From_XML_ST_LayoutShapeType(oStream.GetString2()));
};
SShape.prototype.readChild = function(nType, pReader) {
switch (nType) {
@@ -6402,6 +6008,9 @@ Because of this, the display is sometimes not correct.
InitClass(VarLst, CBaseFormatObject, AscDFH.historyitem_type_VarLst);
+ VarLst.prototype.getHierBranchValue = function () {
+ return this.hierBranch && this.hierBranch.val;
+ }
VarLst.prototype.setAnimLvl = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_VarLstAnimLvl, this.getAnimLvl(), oPr));
this.animLvl = oPr;
@@ -6640,7 +6249,9 @@ Because of this, the display is sometimes not correct.
};
AnimLvl.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(val);
+ if (val !== null) {
+ this.setVal(val);
+ }
};
AnimLvl.prototype.readAttribute = function(nType, pReader) {
var oStream = pReader.stream;
@@ -6680,7 +6291,9 @@ Because of this, the display is sometimes not correct.
AnimOne.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(val);
+ if (val !== null) {
+ this.setVal(val);
+ }
};
changesFactory[AscDFH.historyitem_BulletEnabledVal] = CChangeBool;
@@ -6713,7 +6326,9 @@ Because of this, the display is sometimes not correct.
BulletEnabled.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(!!val);
+ if (val !== null) {
+ this.setVal(!!val);
+ }
};
changesFactory[AscDFH.historyitem_ChMaxVal] = CChangeLong;
@@ -6795,7 +6410,7 @@ Because of this, the display is sometimes not correct.
function DiagramDirection() {
CBaseFormatObject.call(this);
- this.val = null;
+ this.val = DiagramDirection_val_norm;
}
InitClass(DiagramDirection, CBaseFormatObject, AscDFH.historyitem_type_DiagramDirection);
@@ -6819,7 +6434,9 @@ Because of this, the display is sometimes not correct.
DiagramDirection.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(val);
+ if (val !== null) {
+ this.setVal(val);
+ }
};
@@ -6830,7 +6447,7 @@ Because of this, the display is sometimes not correct.
function HierBranch() {
CBaseFormatObject.call(this);
- this.val = null;
+ this.val = AscFormat.HierBranch_val_std;
}
InitClass(HierBranch, CBaseFormatObject, AscDFH.historyitem_type_HierBranch);
@@ -6849,12 +6466,14 @@ Because of this, the display is sometimes not correct.
};
HierBranch.prototype.toPPTY = function (pWriter) {
- pWriter.WriteByteToPPTY(this.getVal() || 0);
+ pWriter.WriteByteToPPTY(this.getVal());
};
HierBranch.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(val);
+ if (val !== null) {
+ this.setVal(val);
+ }
};
@@ -6889,7 +6508,9 @@ Because of this, the display is sometimes not correct.
OrgChart.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(!!val);
+ if (val !== null) {
+ this.setVal(!!val);
+ }
};
@@ -6925,7 +6546,9 @@ Because of this, the display is sometimes not correct.
ResizeHandles.prototype.fromPPTY = function (pReader) {
var val = pReader.stream.ReadByteFromPPTY();
- this.setVal(val);
+ if (val !== null) {
+ this.setVal(val);
+ }
};
@@ -7104,16 +6727,6 @@ Because of this, the display is sometimes not correct.
return [].concat(this.list);
};
- ForEach.prototype.startAlgorithm = function (pointTree, node) {
- this.list.forEach(function (element) {
- if (element instanceof AscFormat.ForEach || element instanceof AscFormat.LayoutNode || element instanceof AscFormat.Choose) {
- element.startAlgorithm(pointTree, node);
- }
- });
- };
-
-
-
changesFactory[AscDFH.historyitem_SampDataUseDef] = CChangeBool;
changesFactory[AscDFH.historyitem_SampDataDataModel] = CChangeObject;
drawingsChangesMap[AscDFH.historyitem_SampDataUseDef] = function (oClass, value) {
@@ -7185,80 +6798,6 @@ Because of this, the display is sometimes not correct.
return [this.dataModel];
};
-
- changesFactory[AscDFH.historyitem_StyleDataUseDef] = CChangeBool;
- changesFactory[AscDFH.historyitem_StyleDataDataModel] = CChangeObject;
- drawingsChangesMap[AscDFH.historyitem_StyleDataUseDef] = function (oClass, value) {
- oClass.useDef = value;
- };
- drawingsChangesMap[AscDFH.historyitem_StyleDataDataModel] = function (oClass, value) {
- oClass.dataModel = value;
- };
-
- function StyleData() {
- CBaseFormatObject.call(this);
- this.useDef = null;
- this.dataModel = null;
- }
-
- InitClass(StyleData, CBaseFormatObject, AscDFH.historyitem_type_StyleData);
-
- StyleData.prototype.setUseDef = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeBool(this, AscDFH.historyitem_StyleDataUseDef, this.getUseDef(), pr));
- this.useDef = pr;
- }
-
- StyleData.prototype.setDataModel = function (oPr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_StyleDataDataModel, this.getDataModel(), oPr));
- this.dataModel = oPr;
- this.setParentToChild(oPr);
- }
-
- StyleData.prototype.getUseDef = function () {
- return this.useDef;
- }
-
- StyleData.prototype.getDataModel = function () {
- return this.dataModel;
- }
-
- StyleData.prototype.fillObject = function (oCopy, oIdMap) {
- oCopy.setUseDef(this.getUseDef());
- if (this.getDataModel()) {
- oCopy.setDataModel(this.getDataModel().createDuplicate(oIdMap));
- }
- }
-
- StyleData.prototype.privateWriteAttributes = function(pWriter) {
- pWriter._WriteBool2(0, this.useDef);
- };
- StyleData.prototype.writeChildren = function(pWriter) {
- this.writeRecord2(pWriter, 0, this.dataModel);
- };
- StyleData.prototype.readAttribute = function(nType, pReader) {
- var oStream = pReader.stream;
- if (0 === nType) this.setUseDef(oStream.GetBool());
- };
- StyleData.prototype.readChild = function(nType, pReader) {
- var s = pReader.stream;
- switch (nType) {
- case 0: {
- this.setDataModel(new DataModel());
- this.dataModel.fromPPTY(pReader);
- break;
- }
- default: {
- s.SkipRecord();
- break;
- }
- }
- };
- StyleData.prototype.getChildren = function() {
- return [this.dataModel];
- };
-
-
-
changesFactory[AscDFH.historyitem_DiagramTitleLang] = CChangeString;
changesFactory[AscDFH.historyitem_DiagramTitleVal] = CChangeString;
drawingsChangesMap[AscDFH.historyitem_DiagramTitleLang] = function (oClass, value) {
@@ -7271,7 +6810,7 @@ Because of this, the display is sometimes not correct.
function DiagramTitle() {
CBaseFormatObject.call(this);
this.lang = null;
- this.val = null;
+ this.val = "";
}
InitClass(DiagramTitle, CBaseFormatObject, AscDFH.historyitem_type_DiagramTitle);
@@ -7676,8 +7215,8 @@ Because of this, the display is sometimes not correct.
if (nIdx > -1 && nIdx < this.styleLbl.length) {
this.styleLbl[nIdx].setParent(null);
oHistory.CanAddChanges() && oHistory.Add(new CChangesDrawingsContentStyleLbl(this, AscDFH.historyitem_ColorsDefRemoveStyleLbl, nIdx, [this.styleLbl[nIdx]], false));
- var deleteObj = nIdx === this.styleLbl.length - 1 ? this.styleLbl.pop() : this.styleLbl.splice(nIdx, 1);
- delete this.styleLblByName[deleteObj[0].name];
+ var deleteObj = nIdx === this.styleLbl.length - 1 ? this.styleLbl.pop() : this.styleLbl.splice(nIdx, 1)[0];
+ delete this.styleLblByName[deleteObj.name];
}
};
@@ -7751,7 +7290,7 @@ Because of this, the display is sometimes not correct.
break;
}
case 1: {
- this.setDesc(new Desc());
+ this.setDesc(new DiagramTitle());
this.desc.fromPPTY(pReader);
break;
}
@@ -7828,7 +7367,6 @@ Because of this, the display is sometimes not correct.
oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_ColorDefStyleLblName, this.getName(), pr));
this.name = pr;
}
-
ColorDefStyleLbl.prototype.setEffectClrLst = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_ColorDefStyleLblEffectClrLst, this.getEffectClrLst(), oPr));
this.effectClrLst = oPr;
@@ -7947,32 +7485,32 @@ Because of this, the display is sometimes not correct.
var s = pReader.stream;
switch (nType) {
case 0: {
- this.setEffectClrLst(new EffectClrLst());
+ this.setEffectClrLst(new ClrLst());
this.effectClrLst.fromPPTY(pReader);
break;
}
case 1: {
- this.setFillClrLst(new FillClrLst());
+ this.setFillClrLst(new ClrLst());
this.fillClrLst.fromPPTY(pReader);
break;
}
case 2: {
- this.setLinClrLst(new LinClrLst());
+ this.setLinClrLst(new ClrLst());
this.linClrLst.fromPPTY(pReader);
break;
}
case 3: {
- this.setTxEffectClrLst(new TxEffectClrLst());
+ this.setTxEffectClrLst(new ClrLst());
this.txEffectClrLst.fromPPTY(pReader);
break;
}
case 4: {
- this.setTxFillClrLst(new TxFillClrLst());
+ this.setTxFillClrLst(new ClrLst());
this.txFillClrLst.fromPPTY(pReader);
break;
}
case 5: {
- this.setTxLinClrLst(new TxLinClrLst());
+ this.setTxLinClrLst(new ClrLst());
this.txLinClrLst.fromPPTY(pReader);
break;
}
@@ -7985,98 +7523,81 @@ Because of this, the display is sometimes not correct.
ColorDefStyleLbl.prototype.getChildren = function() {
return [this.effectClrLst, this.fillClrLst, this.linClrLst, this.txEffectClrLst, this.txFillClrLst, this.txLinClrLst];
};
+ ColorDefStyleLbl.prototype.checkNoFill = function () {
+ switch (this.name) {
+ case "parChTrans1D1":
+ return true;
+ default:
+ return false;
+ }
+ };
- changesFactory[AscDFH.historyitem_CCommonDataClrListAdd] = CChangesContentNoId;
- changesFactory[AscDFH.historyitem_CCommonDataClrListRemove] = CChangesContentNoId;
- drawingConstructorsMap[AscDFH.historyitem_CCommonDataClrListAdd] = AscFormat.CUniColor;
- drawingConstructorsMap[AscDFH.historyitem_CCommonDataClrListRemove] = AscFormat.CUniColor;
- drawingContentChanges[AscDFH.historyitem_CCommonDataClrListAdd] = function (oClass) {
- return oClass.list;
- };
- drawingContentChanges[AscDFH.historyitem_CCommonDataClrListRemove] = function (oClass) {
- return oClass.list;
- };
-
-
- function CCommonDataClrList(type, ind, item, isAdd) {
- CBaseFormatObject.call(this, type, ind, item, isAdd);
- this.list = [];
- this.hueDir = null;
- this.meth = null;
- }
-
- InitClass(CCommonDataClrList, CBaseFormatObject, AscDFH.historyitem_type_CCommonDataClrList);
-
- CCommonDataClrList.prototype.setHueDir = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_CCommonDataClrListHueDir, this.getHueDir(), pr));
- this.hueDir = pr;
- }
-
- CCommonDataClrList.prototype.setMeth = function (pr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_CCommonDataClrListMeth, this.getMeth(), pr));
- this.meth = pr;
- }
-
- CCommonDataClrList.prototype.getHueDir = function () {
- return this.hueDir;
- }
-
- CCommonDataClrList.prototype.getMeth = function () {
- return this.meth;
- }
-
- CCommonDataClrList.prototype.addToLst = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.list.length, Math.max(0, nIdx));
- oHistory.CanAddChanges() && oHistory.Add(new CChangesContentNoId(this, AscDFH.historyitem_CCommonDataClrListAdd, nInsertIdx, [oPr], true));
- nInsertIdx === this.list.length ? this.list.push(oPr) : this.list.splice(nInsertIdx, 0, oPr);
- };
-
- CCommonDataClrList.prototype.removeFromLst = function (nIdx) {
- if (nIdx > -1 && nIdx < this.list.length) {
- this.list[nIdx].setParent(null);
- oHistory.CanAddChanges() && oHistory.Add(new CChangesContentNoId(this, AscDFH.historyitem_CCommonDataClrListRemove, nIdx, [this.list[nIdx]], false));
- nIdx === this.list.length - 1 ? this.list.pop() : this.list.splice(nIdx, 1);
- }
- };
-
- CCommonDataClrList.prototype.fillObject = function (oCopy, oIdMap) {
- for (var nIdx = 0; nIdx < this.list.length; ++nIdx) {
- oCopy.addToLst(nIdx, this.list[nIdx].createDuplicate(oIdMap));
- }
- };
-
- CCommonDataClrList.prototype.privateWriteAttributes = function(pWriter) {
- pWriter._WriteUChar2(0, this.hueDir);
- pWriter._WriteUChar2(1, this.meth);
- };
- CCommonDataClrList.prototype.writeChildren = function(pWriter) {
- for (var i = 0; i < this.list.length; i += 1) {
- pWriter.WriteRecord2(0, this.list[i], pWriter.WriteUniColor);
- }
- };
- CCommonDataClrList.prototype.readAttribute = function(nType, pReader) {
- var oStream = pReader.stream;
- if (0 === nType) this.setHueDir(oStream.GetUChar());
- else if (1 === nType) this.setMeth(oStream.GetUChar());
- };
- CCommonDataClrList.prototype.readChild = function(nType, pReader) {
- var s = pReader.stream;
- switch (nType) {
- case 0:
- this.addToLst(this.list.length, pReader.ReadUniColor());
- break;
- default:
- s.SkipRecord();
- break;
- }
-
- };
- CCommonDataClrList.prototype.getChildren = function() {
- return [].concat(this.list);
- };
-
+ ColorDefStyleLbl.prototype.checkNoLn = function () {
+ switch (this.name) {
+ case "sibTrans2D1":
+ case "trBgShp":
+ case "bgShp":
+ case "dkBgShp":
+ case "fgSibTrans2D1":
+ case "revTx":
+ return true;
+ default:
+ return false;
+ }
+ };
+ ColorDefStyleLbl.prototype.setShapeFill = function (shapes, parentObjects) {
+ if (shapes.length && this.fillClrLst && !this.checkNoFill()) {
+ const fillShapes = [];
+ for (let i = 0; i < shapes.length; i++) {
+ if (!(shapes[i].shape.hideGeom || shapes[i].type === AscFormat.LayoutShapeType_outputShapeType_conn)) {
+ fillShapes.push(shapes[i]);
+ }
+ }
+ const fills = this.fillClrLst.getCurColor(fillShapes.length, parentObjects);
+ if (fills) {
+ for (let i = 0; i < fills.length; i++) {
+ fillShapes[i].setFill(fills[i]);
+ }
+ }
+ }
+ };
+ ColorDefStyleLbl.prototype.getLineWidth = function (shadowShape) {
+ switch (this.name) {
+ case "trAlignAcc1":
+ case "sibTrans1D1":
+ return 6350;
+ default:
+ return shadowShape.tailLnArrow || shadowShape.headLnArrow ? 6350 : 12700;
+ }
+ }
+ ColorDefStyleLbl.prototype.setShapeLn = function (shapes, parentObjects) {
+ if (shapes.length && this.linClrLst && !this.checkNoLn()) {
+ const fillShapes = [];
+ for (let i = 0; i < shapes.length; i += 1) {
+ const shadowShape = shapes[i];
+ if (!(shadowShape.shape.hideGeom ||
+ shadowShape.node.isParNode() && shadowShape.type !== AscFormat.LayoutShapeType_outputShapeType_conn)) {
+ fillShapes.push(shadowShape);
+ }
+ }
+ const fills = this.linClrLst.getCurColor(fillShapes.length, parentObjects);
+ if (fills) {
+ for (let i = 0; i < fills.length; i++) {
+ const shadowShape = fillShapes[i];
+ const ln = new AscFormat.CLn();
+ ln.setW(this.getLineWidth(shadowShape));
+ ln.setFill(fills[i]);
+ shadowShape.setLn(ln);
+ }
+ }
+ }
+ };
+ changesFactory[AscDFH.historyitem_ClrLstAdd] = CChangesContentNoId;
+ changesFactory[AscDFH.historyitem_ClrLstRemove] = CChangesContentNoId;
+ drawingConstructorsMap[AscDFH.historyitem_ClrLstAdd] = AscFormat.CUniColor;
+ drawingConstructorsMap[AscDFH.historyitem_ClrLstRemove] = AscFormat.CUniColor;
changesFactory[AscDFH.historyitem_ClrLstHueDir] = CChangeLong;
changesFactory[AscDFH.historyitem_ClrLstMeth] = CChangeLong;
drawingsChangesMap[AscDFH.historyitem_ClrLstHueDir] = function (oClass, value) {
@@ -8085,15 +7606,115 @@ Because of this, the display is sometimes not correct.
drawingsChangesMap[AscDFH.historyitem_ClrLstMeth] = function (oClass, value) {
oClass.meth = value;
};
+ drawingContentChanges[AscDFH.historyitem_ClrLstAdd] = function (oClass) {
+ return oClass.list;
+ };
+ drawingContentChanges[AscDFH.historyitem_ClrLstRemove] = function (oClass) {
+ return oClass.list;
+ };
function ClrLst() {
- CCommonDataClrList.call(this);
- this.hueDir = null;
- this.meth = null;
+ CBaseFormatObject.call(this);
+ this.list = [];
+ this.hueDir = ClrLst_hueDir_cw;
+ this.meth = ClrLst_meth_span;
}
+ InitClass(ClrLst, CBaseFormatObject, AscDFH.historyitem_type_ClrLst);
+
+ ClrLst.prototype.getCurColor = function (length, parentObjects) {
+ if (!length) {
+ return;
+ }
+ if (this.list.length === 0) {
+ return this.getNoFillColor(length);
+ }
+
+ if (this.meth === ClrLst_meth_repeat || this.list.length === 1) {
+ return this.getRepeatColor(length);
+ }
- InitClass(ClrLst, CCommonDataClrList, AscDFH.historyitem_type_ClrLst);
+ const startColor = this.list[0];
+ const endColor = this.list[1];
+ startColor.Calculate(parentObjects.theme, parentObjects.slide, parentObjects.layout, parentObjects.master);
+ endColor.Calculate(parentObjects.theme, parentObjects.slide, parentObjects.layout, parentObjects.master);
+ const startHSL = {};
+ AscFormat.CColorModifiers.prototype.RGB2HSL(startColor.RGBA.R, startColor.RGBA.G, startColor.RGBA.B, startHSL);
+
+ const endHSL = {};
+ AscFormat.CColorModifiers.prototype.RGB2HSL(endColor.RGBA.R, endColor.RGBA.G, endColor.RGBA.B, endHSL);
+
+ const diffHSL = {};
+ if (this.hueDir === ClrLst_hueDir_ccw) {
+ diffHSL.H = startHSL.H - endHSL.H;
+ } else {
+ diffHSL.H = endHSL.H - startHSL.H;
+ }
+ diffHSL.S = endHSL.S - startHSL.S;
+ diffHSL.L = endHSL.L - startHSL.L;
+ diffHSL.A = endColor.RGBA.A - startColor.RGBA.A;
+ if (this.meth === ClrLst_meth_cycle) {
+ return this.getCycleColor(diffHSL, length);
+ } else {
+ return this.getSpanColor(diffHSL, length);
+ }
+ };
+
+ ClrLst.prototype.getNoFillColor = function (length) {
+ const colors = [];
+ for (let i = 0; i < length; i++) {
+ colors.push(AscFormat.CreateNoFillUniFill());
+ }
+ return colors;
+ };
+
+ ClrLst.prototype.getRepeatColor = function (length) {
+ const colors = [];
+ for (let i = 0; i < length; i++) {
+ const truthIndex = i % this.list.length;
+ const uniColor = this.list[truthIndex];
+ colors.push(AscFormat.CreateUniFillByUniColorCopy(uniColor));
+ }
+ return colors;
+ };
+ ClrLst.prototype.getInterpolateStartColor = function (diffHSL, scale) {
+ const startColor = this.list[0];
+
+ const hueOff = diffHSL.H * scale;
+ const satOff = diffHSL.S * scale;
+ const lumOff = diffHSL.L * scale;
+ const alphaOff = diffHSL.A * scale;
+ const copyColor = startColor.createDuplicate();
+ copyColor.addColorMod(new AscFormat.CColorMod("hueOff", ((hueOff / 255) * (360 * 60000)) >> 0));
+ copyColor.addColorMod(new AscFormat.CColorMod("satOff", (satOff / 255 * 100000) >> 0));
+ copyColor.addColorMod(new AscFormat.CColorMod("lumOff", (lumOff / 255 * 100000) >> 0));
+ copyColor.addColorMod(new AscFormat.CColorMod("alphaOff", (alphaOff / 255 * 100000) >> 0));
+ return AscFormat.CreateUniFillByUniColor(copyColor);
+ };
+ ClrLst.prototype.getCycleColor = function (diffHSL, length) {
+ if (!length) {
+ return;
+ }
+ const resultColors = [];
+
+ for (let i = 0; i < length; i++) {
+ const scale = (i * 2) / length;
+ resultColors.push(this.getInterpolateStartColor(diffHSL, scale > 1 ? 2 - scale : scale));
+ }
+ return resultColors;
+ };
+ ClrLst.prototype.getSpanColor = function (diffHSL, length) {
+ if (!length) {
+ return;
+ }
+
+ const resultColors = [];
+ for (let i = 0; i < length; i += 1) {
+ const scale = i / (length - 1);
+ resultColors.push(this.getInterpolateStartColor(diffHSL, scale));
+ }
+ return resultColors;
+ }
ClrLst.prototype.setHueDir = function (pr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeLong(this, AscDFH.historyitem_ClrLstHueDir, this.getHueDir(), pr));
this.hueDir = pr;
@@ -8104,6 +7725,20 @@ Because of this, the display is sometimes not correct.
this.meth = pr;
}
+ ClrLst.prototype.addToLst = function (nIdx, oPr) {
+ var nInsertIdx = Math.min(this.list.length, Math.max(0, nIdx));
+ oHistory.CanAddChanges() && oHistory.Add(new CChangesContentNoId(this, AscDFH.historyitem_ClrLstAdd, nInsertIdx, [oPr], true));
+ nInsertIdx === this.list.length ? this.list.push(oPr) : this.list.splice(nInsertIdx, 0, oPr);
+ };
+
+ ClrLst.prototype.removeFromLst = function (nIdx) {
+ if (nIdx > -1 && nIdx < this.list.length) {
+ this.list[nIdx].setParent(null);
+ oHistory.CanAddChanges() && oHistory.Add(new CChangesContentNoId(this, AscDFH.historyitem_ClrLstRemove, nIdx, [this.list[nIdx]], false));
+ nIdx === this.list.length - 1 ? this.list.pop() : this.list.splice(nIdx, 1);
+ }
+ };
+
ClrLst.prototype.getHueDir = function () {
return this.hueDir;
}
@@ -8112,6 +7747,32 @@ Because of this, the display is sometimes not correct.
return this.meth;
}
+ ClrLst.prototype.privateWriteAttributes = function(pWriter) {
+ pWriter._WriteUChar2(0, this.hueDir);
+ pWriter._WriteUChar2(1, this.meth);
+ };
+ ClrLst.prototype.writeChildren = function(pWriter) {
+ for (var i = 0; i < this.list.length; i += 1) {
+ pWriter.WriteRecord2(0, this.list[i], pWriter.WriteUniColor);
+ }
+ };
+ ClrLst.prototype.readAttribute = function(nType, pReader) {
+ var oStream = pReader.stream;
+ if (0 === nType) this.setHueDir(oStream.GetUChar());
+ else if (1 === nType) this.setMeth(oStream.GetUChar());
+ };
+ ClrLst.prototype.readChild = function(nType, pReader) {
+ var s = pReader.stream;
+ switch (nType) {
+ case 0:
+ this.addToLst(this.list.length, pReader.ReadUniColor());
+ break;
+ default:
+ s.SkipRecord();
+ break;
+ }
+ };
+
ClrLst.prototype.fillObject = function (oCopy, oIdMap) {
oCopy.setHueDir(this.getHueDir());
oCopy.setMeth(this.getMeth());
@@ -8120,41 +7781,9 @@ Because of this, the display is sometimes not correct.
oCopy.addToLst(nIdx, oColor);
}
}
-
- function EffectClrLst() {
- ClrLst.call(this);
- }
-
- InitClass(EffectClrLst, ClrLst, AscDFH.historyitem_type_EffectClrLst);
-
- function FillClrLst() {
- ClrLst.call(this);
- }
-
- InitClass(FillClrLst, ClrLst, AscDFH.historyitem_type_FillClrLst);
-
- function LinClrLst() {
- ClrLst.call(this);
- }
-
- InitClass(LinClrLst, ClrLst, AscDFH.historyitem_type_LinClrLst);
- function TxEffectClrLst() {
- ClrLst.call(this);
- }
-
- InitClass(TxEffectClrLst, ClrLst, AscDFH.historyitem_type_TxEffectClrLst);
-
- function TxFillClrLst() {
- ClrLst.call(this);
- }
-
- InitClass(TxFillClrLst, ClrLst, AscDFH.historyitem_type_TxFillClrLst);
-
- function TxLinClrLst() {
- ClrLst.call(this);
- }
-
- InitClass(TxLinClrLst, ClrLst, AscDFH.historyitem_type_TxLinClrLst);
+ ClrLst.prototype.getChildren = function() {
+ return [].concat(this.list);
+ };
function ColorsDefHdrLst() {
CCommonDataList.call(this);
@@ -8316,8 +7945,8 @@ Because of this, the display is sometimes not correct.
changesFactory[AscDFH.historyitem_StyleDefScene3d] = CChangeObject;
changesFactory[AscDFH.historyitem_StyleDefTitle] = CChangeObject;
changesFactory[AscDFH.historyitem_StyleDefDesc] = CChangeObject;
- changesFactory[AscDFH.historyitem_StyleDefAddStyleLbl] = CChangeContent;
- changesFactory[AscDFH.historyitem_StyleDefRemoveStyleLbl] = CChangeContent;
+ changesFactory[AscDFH.historyitem_StyleDefAddStyleLbl] = CChangesDrawingsContentStyleLbl;
+ changesFactory[AscDFH.historyitem_StyleDefRemoveStyleLbl] = CChangesDrawingsContentStyleLbl;
drawingsChangesMap[AscDFH.historyitem_StyleDefMinVer] = function (oClass, value) {
oClass.minVer = value;
};
@@ -8356,6 +7985,7 @@ Because of this, the display is sometimes not correct.
this.title = null;
this.desc = null;
this.styleLbl = [];
+ this.styleLblByName = {};
}
InitClass(StyleDef, CBaseFormatObject, AscDFH.historyitem_type_StyleDef);
@@ -8402,16 +8032,18 @@ Because of this, the display is sometimes not correct.
StyleDef.prototype.addToLstStyleLbl = function (nIdx, oPr) {
var nInsertIdx = Math.min(this.styleLbl.length, Math.max(0, nIdx));
- oHistory.CanAddChanges() && oHistory.Add(new CChangeContent(this, AscDFH.historyitem_StyleDefAddStyleLbl, nInsertIdx, [oPr], true));
+ oHistory.CanAddChanges() && oHistory.Add(new CChangesDrawingsContentStyleLbl(this, AscDFH.historyitem_StyleDefAddStyleLbl, nInsertIdx, [oPr], true));
nInsertIdx === this.styleLbl.length ? this.styleLbl.push(oPr) : this.styleLbl.splice(nInsertIdx, 0, oPr);
this.setParentToChild(oPr);
+ this.styleLblByName[oPr.name] = oPr;
};
StyleDef.prototype.removeFromLstStyleLbl = function (nIdx) {
if (nIdx > -1 && nIdx < this.styleLbl.length) {
this.styleLbl[nIdx].setParent(null);
- oHistory.CanAddChanges() && oHistory.Add(new CChangeContent(this, AscDFH.historyitem_StyleDefRemoveStyleLbl, nIdx, [this.styleLbl[nIdx]], false));
- nIdx === this.styleLbl.length - 1 ? this.styleLbl.pop() : this.styleLbl.splice(nIdx, 1);
+ oHistory.CanAddChanges() && oHistory.Add(new CChangesDrawingsContentStyleLbl(this, AscDFH.historyitem_StyleDefRemoveStyleLbl, nIdx, [this.styleLbl[nIdx]], false));
+ const deleteObj = nIdx === this.styleLbl.length - 1 ? this.styleLbl.pop() : this.styleLbl.splice(nIdx, 1)[0];
+ delete this.styleLblByName[deleteObj.name];
}
};
@@ -8493,7 +8125,7 @@ Because of this, the display is sometimes not correct.
break;
}
case 1: {
- this.setDesc(new Desc());
+ this.setDesc(new DiagramTitle());
this.desc.fromPPTY(pReader);
break;
}
@@ -8683,6 +8315,14 @@ Because of this, the display is sometimes not correct.
InitClass(StyleDefStyleLbl, CBaseFormatObject, AscDFH.historyitem_type_StyleDefStyleLbl);
+ StyleDefStyleLbl.prototype.setShapeStyle = function (shapes) {
+ if (this.style) {
+ for (let i = 0; i < shapes.length; i += 1) {
+ const shape = shapes[i];
+ shape.setStyle(this.style.createDuplicate());
+ }
+ }
+ }
StyleDefStyleLbl.prototype.setName = function (pr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_StyleDefStyleLblName, this.getName(), pr));
this.name = pr;
@@ -9021,6 +8661,11 @@ Because of this, the display is sometimes not correct.
InitClass(Drawing, CGroupShape, AscDFH.historyitem_type_SmartArtDrawing);
+ Drawing.prototype.recalcSmartArtConnections = function () {
+ if (this.group) {
+ this.group.recalcSmartArtConnections();
+ }
+ };
Drawing.prototype.getObjectType = function () {
return AscDFH.historyitem_type_SmartArtDrawing;
}
@@ -10056,54 +9701,212 @@ Because of this, the display is sometimes not correct.
}
- changesFactory[AscDFH.historyitem_ShapeSmartArtInfoSpPrPoint] = CChangeObject;
- changesFactory[AscDFH.historyitem_ShapeSmartArtInfoShapePoint] = CChangeObject;
- changesFactory[AscDFH.historyitem_ShapeSmartArtInfoAddLstContentPoint] = CChangeContent;
- changesFactory[AscDFH.historyitem_ShapeSmartArtInfoRemoveLstContentPoint] = CChangeContent;
- drawingsChangesMap[AscDFH.historyitem_ShapeSmartArtInfoSpPrPoint] = function (oClass, value) {
- oClass.spPrPoint = value;
- };
- drawingsChangesMap[AscDFH.historyitem_ShapeSmartArtInfoShapePoint] = function (oClass, value) {
- oClass.shapePoint = value;
- };
- drawingContentChanges[AscDFH.historyitem_ShapeSmartArtInfoAddLstContentPoint] = function (oClass) {
- return oClass.contentPoint;
- };
- drawingContentChanges[AscDFH.historyitem_ShapeSmartArtInfoRemoveLstContentPoint] = function (oClass) {
- return oClass.contentPoint;
- };
-
function ShapeSmartArtInfo() {
- CBaseFormatObject.call(this);
+ this.shape = null;
this.shapePoint = null;
this.contentPoint = [];
this.maxFontSize = null;
- }
- InitClass(ShapeSmartArtInfo, CBaseFormatObject, AscDFH.historyitem_type_ShapeSmartArtInfo);
+ this.textConstraints = {};
+ this.params = {};
+ this.textConstraintRelations = [];
+ this.adaptFontSizeShapesInfo = null;
+ this.secondaryFontSizeScale = null;
+ }
+ ShapeSmartArtInfo.prototype.getContentFillingType = function (shapes) {
+
+ let res = 0x00;
+ for (let i = 0; i < shapes.length; i += 1) {
+ const shape = shapes[i];
+ if (!shape.isCanFitFontSize()) {
+ continue;
+ }
+ const docContent = shape.getDocContent();
+ if (docContent) {
+ for (let j = 0; j < docContent.Content.length; j++) {
+ const item = docContent.Content[j];
+ if (item.PresentationPr && item.PresentationPr.Bullet && !item.PresentationPr.Bullet.IsNone()) {
+ res |= smartArtContentFillingType_onlyChildren;
+ } else {
+ res |= smartArtContentFillingType_onlyParent;
+ }
+ if (res === smartArtContentFillingType_parentWithChildren) {
+ return res;
+ }
+ }
+ }
+ }
+ return res;
+ };
+ ShapeSmartArtInfo.prototype.getSecondaryFontSizeCoefficient = function () {
+ if (this.secondaryFontSizeScale === null) {
+ const primaryConstr = this.textConstraints[AscFormat.Constr_type_primFontSz];
+ if (primaryConstr) {
+ const coefficient = primaryConstr.getSecondaryFontSizeCoefficient();
+ if (coefficient !== null) {
+ this.secondaryFontSizeScale = coefficient;
+ return coefficient;
+ }
+ }
+
+ const secondaryConstr = this.textConstraints[AscFormat.Constr_type_secFontSz];
+ if (secondaryConstr) {
+ const coefficient = secondaryConstr.getSecondaryFontSizeCoefficient();
+ if (coefficient !== null) {
+ this.secondaryFontSizeScale = coefficient;
+ return coefficient;
+ }
+ }
+
+ this.secondaryFontSizeScale = 0.78;
+ }
+ return this.secondaryFontSizeScale;
+ };
+ ShapeSmartArtInfo.prototype.getAdaptFontSizeInfo = function () {
+ if (this.adaptFontSizeShapesInfo === null) {
+ const checkShapes = {};
+
+ this.adaptFontSizeShapesInfo = {};
+ this.adaptFontSizeShapesInfo.shapes = [];
+ const res = this.adaptFontSizeShapesInfo.shapes;
+ const checkShapeSmartArtInfos = [this];
+ while (checkShapeSmartArtInfos.length) {
+ const smartArtInfo = checkShapeSmartArtInfos.pop();
+ const shape = smartArtInfo.shape;
+ if (!checkShapes[shape.GetId()]) {
+ res.push(shape);
+ checkShapes[shape.GetId()] = true;
+ }
+
+
+ const primFontConstraint = smartArtInfo.textConstraints[AscFormat.Constr_type_primFontSz];
+ if (primFontConstraint) {
+ primFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_equ, checkShapeSmartArtInfos, checkShapes);
+ primFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_equ, checkShapeSmartArtInfos, checkShapes, true);
+ primFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_none, checkShapeSmartArtInfos, checkShapes);
+ primFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_lte, checkShapeSmartArtInfos, checkShapes);
+ }
+ const secFontConstraint = smartArtInfo.textConstraints[AscFormat.Constr_type_secFontSz];
+ if (secFontConstraint) {
+ secFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_equ, checkShapeSmartArtInfos, checkShapes);
+ secFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_equ, checkShapeSmartArtInfos, checkShapes, true);
+ secFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_none, checkShapeSmartArtInfos, checkShapes);
+ secFontConstraint.collectShapeSmartArtInfo(AscFormat.Constr_op_lte, checkShapeSmartArtInfos, checkShapes);
+ }
+ }
+ this.adaptFontSizeShapesInfo.contentFillingType = this.getContentFillingType(res);
+ }
+ return this.adaptFontSizeShapesInfo;
+ };
+ ShapeSmartArtInfo.prototype.getChildrenSpacingScale = function () {
+ if (this.params[AscFormat.Param_type_lnSpAfChP] !== undefined) {
+ return this.params[AscFormat.Param_type_lnSpAfChP];
+ }
+ return g_dKoef_pt_to_mm * 0.18;
+ };
+ ShapeSmartArtInfo.prototype.getParentSpacingScale = function () {
+ if (this.params[AscFormat.Param_type_lnSpAfParP] !== undefined) {
+ return this.params[AscFormat.Param_type_lnSpAfParP];
+ }
+ return g_dKoef_pt_to_mm * 0.42;
+ };
+ ShapeSmartArtInfo.prototype.setShape = function (shape) {
+ this.shape = shape;
+ }
+ ShapeSmartArtInfo.prototype.getMarginFactors = function () {
+ const res = {};
+ res.bMarg = this.textConstraints[AscFormat.Constr_type_bMarg];
+ res.tMarg = this.textConstraints[AscFormat.Constr_type_tMarg];
+ res.rMarg = this.textConstraints[AscFormat.Constr_type_rMarg];
+ res.lMarg = this.textConstraints[AscFormat.Constr_type_lMarg];
+ return res;
+ };
+ ShapeSmartArtInfo.prototype.getRelFitFontSize = function (isUseChildrenCoefficient) {
+ const adaptInfo = this.getAdaptFontSizeInfo();
+ const shapes = adaptInfo.shapes;
+ let minFontSize = null;
+ for (let i = 0; i < shapes.length; i++) {
+ const shape = shapes[i];
+ const content = shape.getDocContent();
+ const shapeInfo = shape.getSmartArtInfo();
+ const isNotPlaceholder = content && !content.Is_Empty({SkipEnd: true, SkipPlcHldr: false}) && shapeInfo.contentPoint.some(function (node) {
+ const point = node.point;
+ return point && point.prSet && !point.prSet.custT && !point.prSet.phldr;
+ });
+ if (isNotPlaceholder) {
+
+ if (shapeInfo.maxFontSize === null) {
+ this.setMaxFontSize(shape.findFitFontSizeForSmartArt());
+ }
+ if (minFontSize === null || minFontSize > shapeInfo.maxFontSize) {
+ minFontSize = shapeInfo.maxFontSize;
+ }
+ }
+ if (minFontSize !== null && isUseChildrenCoefficient) {
+ const contentFillingType = this.getContentFillingType(shapes);
+ if (contentFillingType === smartArtContentFillingType_onlyChildren || contentFillingType === smartArtContentFillingType_parentWithChildren) {
+ return minFontSize;
+ } else if (contentFillingType === smartArtContentFillingType_onlyParent) {
+ return Math.round(minFontSize * shapeInfo.getSecondaryFontSizeCoefficient());
+ }
+ }
+ }
+ return minFontSize;
+ };
+ ShapeSmartArtInfo.prototype.getMaxConstrFontSize = function (isUseChildrenCoefficient) {
+ const fontSizes = [65];
+ const primTextConstr = this.textConstraints[AscFormat.Constr_type_primFontSz];
+ if (primTextConstr) {
+ fontSizes.push(primTextConstr.getMaxFontSize(isUseChildrenCoefficient));
+ }
+ const secTextConstr = this.textConstraints[AscFormat.Constr_type_secFontSz];
+ if (secTextConstr) {
+ fontSizes.push(secTextConstr.getMaxFontSize(isUseChildrenCoefficient));
+ }
+ return Math.min.apply(Math, fontSizes);
+ };
+ ShapeSmartArtInfo.prototype.getMinConstrFontSize = function () {
+ const fontSizes = [5];
+ const primTextConstr = this.textConstraints[AscFormat.Constr_type_primFontSz];
+ if (primTextConstr) {
+ fontSizes.push(primTextConstr.getMinFontSize());
+ }
+ const secTextConstr = this.textConstraints[AscFormat.Constr_type_secFontSz];
+ if (secTextConstr) {
+ fontSizes.push(secTextConstr.getMinFontSize());
+ }
+ return Math.min.apply(Math, fontSizes);
+ };
+ ShapeSmartArtInfo.prototype.getShape = function () {
+ return this.shape;
+ };
ShapeSmartArtInfo.prototype.setShapePoint = function (oPr) {
- oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_ShapeSmartArtInfoShapePoint, this.shapePoint, oPr));
this.shapePoint = oPr;
- this.setParentToChild(oPr);
}
ShapeSmartArtInfo.prototype.addToLstContentPoint = function (nIdx, oPr) {
var nInsertIdx = Math.min(this.contentPoint.length, Math.max(0, nIdx));
- oHistory.CanAddChanges() && oHistory.Add(new CChangeContent(this, AscDFH.historyitem_ShapeSmartArtInfoAddLstContentPoint, nInsertIdx, [oPr], true));
nInsertIdx === this.contentPoint.length ? this.contentPoint.push(oPr) : this.contentPoint.splice(nInsertIdx, 0, oPr);
- this.setParentToChild(oPr);
}
ShapeSmartArtInfo.prototype.removeFromLstContentPoint = function (nIdx) {
if (nIdx > -1 && nIdx < this.contentPoint.length) {
- this.contentPoint[nIdx].setParent(null);
- oHistory.CanAddChanges() && oHistory.Add(new CChangeContent(this, AscDFH.historyitem_ShapeSmartArtInfoRemoveLstContentPoint, nIdx, [this.contentPoint[nIdx]], false));
nIdx === this.contentPoint.length - 1 ? this.contentPoint.pop() : this.contentPoint.splice(nIdx, 1);
}
}
- ShapeSmartArtInfo.prototype.setMaxFontSize = function (oPr) {
- this.maxFontSize = oPr;
- }
+ ShapeSmartArtInfo.prototype.setMaxFontSize = function (nPr) {
+ this.maxFontSize = nPr;
+ };
+ ShapeSmartArtInfo.prototype.collectTextConstraintRelations = function (array) {
+ array = array || [];
+ for (let i = 0; i < this.textConstraintRelations.length; i += 1) {
+ const presNodeArray = this.textConstraintRelations[i];
+ if (!array.includes(presNodeArray)) {
+ array.push(presNodeArray);
+ }
+ }
+ return array;
+ };
changesFactory[AscDFH.historyitem_SmartArtColorsDef] = CChangeObject;
changesFactory[AscDFH.historyitem_SmartArtDrawing] = CChangeObject;
@@ -10120,6 +9923,8 @@ Because of this, the display is sometimes not correct.
};
drawingsChangesMap[AscDFH.historyitem_SmartArtDrawing] = function (oClass, value) {
oClass.drawing = value;
+ oClass.isLocalDrawingPart = oClass.localDrawingId !== null ? oClass.localDrawingId === (value && value.Get_Id()) : false;
+ oClass.recalcSmartArtConnections();
};
drawingsChangesMap[AscDFH.historyitem_SmartArtLayoutDef] = function (oClass, value) {
oClass.layoutDef = value;
@@ -10147,11 +9952,33 @@ Because of this, the display is sometimes not correct.
this.bNeedUpdatePosition = true;
this.calcGeometry = null;
- this.bFirstRecalculate = true;
+ this.isLocalDrawingPart = true;
+ this.localDrawingId = null;
}
InitClass(SmartArt, CGroupShape, AscDFH.historyitem_type_SmartArt);
-
+ SmartArt.prototype.generateDefaultStructures = function () {
+ if (!this.colorsDef) {
+ this.setColorsDef(AscFormat.generateDefaultSmartArtColors());
+ }
+ if (!this.layoutDef) {
+ this.setLayoutDef(AscFormat.generateDefaultSmartArtLayout());
+ }
+ if (!this.styleDef){
+ this.setStyleDef(AscFormat.generateDefaultSmartArtQuickStyle());
+ }
+ };
+ SmartArt.prototype.recalcFitFontSize = function () {
+ this.recalcInfo.fitFontSize = true;
+ };
+ SmartArt.prototype.recalcSmartArtConnections = function () {
+ this.recalcInfo.reconnectSmartArtShapes = true;
+ };
+ SmartArt.prototype.setRecalculateInfo = function () {
+ CGroupShape.prototype.setRecalculateInfo.call(this);
+ this.recalcInfo.fitFontSize = true;
+ this.recalcInfo.reconnectSmartArtShapes = true;
+ };
SmartArt.prototype.getObjectType = function() {
return AscDFH.historyitem_type_SmartArt;
};
@@ -10159,6 +9986,235 @@ Because of this, the display is sometimes not correct.
return 'SmartArt';
};
+ SmartArt.prototype.isCanGenerateSmartArt = function () {
+ const smartartType = this.getTypeOfSmartArt();
+ switch (smartartType) {
+ case Asc.c_oAscSmartArtTypes.AlternatingHexagonList:
+ case Asc.c_oAscSmartArtTypes.AlternatingPictureBlocks:
+ case Asc.c_oAscSmartArtTypes.ArrowRibbon:
+ case Asc.c_oAscSmartArtTypes.AscendingPictureAccentProcess:
+ case Asc.c_oAscSmartArtTypes.Balance:
+ case Asc.c_oAscSmartArtTypes.BasicBlockList:
+ case Asc.c_oAscSmartArtTypes.BasicCycle:
+ case Asc.c_oAscSmartArtTypes.BasicMatrix:
+ case Asc.c_oAscSmartArtTypes.BasicBendingProcess:
+ case Asc.c_oAscSmartArtTypes.BasicPie:
+ case Asc.c_oAscSmartArtTypes.BasicProcess:
+ case Asc.c_oAscSmartArtTypes.BasicPyramid:
+ case Asc.c_oAscSmartArtTypes.BasicRadial:
+ case Asc.c_oAscSmartArtTypes.BasicTarget:
+ case Asc.c_oAscSmartArtTypes.BasicVenn:
+ case Asc.c_oAscSmartArtTypes.BendingPictureAccentList:
+ case Asc.c_oAscSmartArtTypes.BendingPictureBlocks:
+ case Asc.c_oAscSmartArtTypes.BendingPictureCaptionList:
+ case Asc.c_oAscSmartArtTypes.BendingPictureCaption:
+ case Asc.c_oAscSmartArtTypes.BendingPictureSemiTransparentText:
+ case Asc.c_oAscSmartArtTypes.BlockCycle:
+ case Asc.c_oAscSmartArtTypes.CaptionedPictures:
+ case Asc.c_oAscSmartArtTypes.ChevronAccentProcess:
+ case Asc.c_oAscSmartArtTypes.CircleArrowProcess:
+ case Asc.c_oAscSmartArtTypes.CircleProcess:
+ case Asc.c_oAscSmartArtTypes.CircleRelationship:
+ case Asc.c_oAscSmartArtTypes.ClosedChevronProcess:
+ case Asc.c_oAscSmartArtTypes.ContinuousCycle:
+ case Asc.c_oAscSmartArtTypes.ConvergingArrows:
+ case Asc.c_oAscSmartArtTypes.ConvergingRadial:
+ case Asc.c_oAscSmartArtTypes.ConvergingText:
+ case Asc.c_oAscSmartArtTypes.CounterbalanceArrows:
+ case Asc.c_oAscSmartArtTypes.CycleMatrix:
+ case Asc.c_oAscSmartArtTypes.DescendingProcess:
+ case Asc.c_oAscSmartArtTypes.DivergingArrows:
+ case Asc.c_oAscSmartArtTypes.DivergingRadial:
+ case Asc.c_oAscSmartArtTypes.Equation:
+ case Asc.c_oAscSmartArtTypes.Funnel:
+ case Asc.c_oAscSmartArtTypes.Gear:
+ case Asc.c_oAscSmartArtTypes.GridMatrix:
+ case Asc.c_oAscSmartArtTypes.GroupedList:
+ case Asc.c_oAscSmartArtTypes.HexagonCluster:
+ case Asc.c_oAscSmartArtTypes.IncreasingCircleProcess:
+ case Asc.c_oAscSmartArtTypes.InterconnectedBlockProcess:
+ case Asc.c_oAscSmartArtTypes.InterconnectedRings:
+ case Asc.c_oAscSmartArtTypes.InvertedPyramid:
+ case Asc.c_oAscSmartArtTypes.LinearVenn:
+ case Asc.c_oAscSmartArtTypes.MultiDirectionalCycle:
+ case Asc.c_oAscSmartArtTypes.NestedTarget:
+ case Asc.c_oAscSmartArtTypes.NonDirectionalCycle:
+ case Asc.c_oAscSmartArtTypes.OpposingArrows:
+ case Asc.c_oAscSmartArtTypes.OpposingIdeas:
+ case Asc.c_oAscSmartArtTypes.PhasedProcess:
+ case Asc.c_oAscSmartArtTypes.PictureAccentProcess:
+ case Asc.c_oAscSmartArtTypes.PictureCaptionList:
+ case Asc.c_oAscSmartArtTypes.PictureFrame:
+ case Asc.c_oAscSmartArtTypes.PictureLineup:
+ case Asc.c_oAscSmartArtTypes.PictureOrganizationChart:
+ case Asc.c_oAscSmartArtTypes.PictureStrips:
+ case Asc.c_oAscSmartArtTypes.PlusAndMinus:
+ case Asc.c_oAscSmartArtTypes.ProcessList:
+ case Asc.c_oAscSmartArtTypes.RadialCluster:
+ case Asc.c_oAscSmartArtTypes.RadialCycle:
+ case Asc.c_oAscSmartArtTypes.RadialList:
+ case Asc.c_oAscSmartArtTypes.RadialPictureList:
+ case Asc.c_oAscSmartArtTypes.RadialVenn:
+ case Asc.c_oAscSmartArtTypes.RepeatingBendingProcess:
+ case Asc.c_oAscSmartArtTypes.ReverseList:
+ case Asc.c_oAscSmartArtTypes.SegmentedCycle:
+ case Asc.c_oAscSmartArtTypes.SegmentedProcess:
+ case Asc.c_oAscSmartArtTypes.SegmentedPyramid:
+ case Asc.c_oAscSmartArtTypes.SpiralPicture:
+ case Asc.c_oAscSmartArtTypes.StackedVenn:
+ case Asc.c_oAscSmartArtTypes.StaggeredProcess:
+ case Asc.c_oAscSmartArtTypes.TabList:
+ case Asc.c_oAscSmartArtTypes.TabbedArc:
+ case Asc.c_oAscSmartArtTypes.TableList:
+ case Asc.c_oAscSmartArtTypes.TextCycle:
+ case Asc.c_oAscSmartArtTypes.ThemePictureAccent:
+ case Asc.c_oAscSmartArtTypes.ThemePictureAlternatingAccent:
+ case Asc.c_oAscSmartArtTypes.ThemePictureGrid:
+ case Asc.c_oAscSmartArtTypes.TitledMatrix:
+ case Asc.c_oAscSmartArtTypes.TitledPictureAccentList:
+ case Asc.c_oAscSmartArtTypes.TitledPictureBlocks:
+ case Asc.c_oAscSmartArtTypes.TitlePictureLineup:
+ case Asc.c_oAscSmartArtTypes.TrapezoidList:
+ case Asc.c_oAscSmartArtTypes.UpwardArrow:
+ case Asc.c_oAscSmartArtTypes.VerticalPictureAccentList:
+ case Asc.c_oAscSmartArtTypes.VerticalPictureList:
+ case Asc.c_oAscSmartArtTypes.HorizontalOrganizationChart:
+ case Asc.c_oAscSmartArtTypes.HalfCircleOrganizationChart:
+ case Asc.c_oAscSmartArtTypes.StackedList:
+ case Asc.c_oAscSmartArtTypes.HorizontalHierarchy:
+ case Asc.c_oAscSmartArtTypes.HorizontalMultiLevelHierarchy:
+ case Asc.c_oAscSmartArtTypes.OrganizationChart:
+ case Asc.c_oAscSmartArtTypes.NameAndTitleOrganizationChart:
+ case Asc.c_oAscSmartArtTypes.CirclePictureHierarchy:
+ case Asc.c_oAscSmartArtTypes.HierarchyList:
+ case Asc.c_oAscSmartArtTypes.Hierarchy:
+ return true;
+ default:
+ return false;
+ }
+ };
+ SmartArt.prototype.getSizes = function () {
+ const sizes = {width: 0, height: 0};
+ if (this.drawingBase) {
+ const drawingMetrics = this.drawingBase.getGraphicObjectMetrics();
+ sizes.width = drawingMetrics.extX;
+ sizes.height = drawingMetrics.extY;
+ } else {
+ sizes.width = this.spPr.xfrm.extX;
+ sizes.height = this.spPr.xfrm.extY;
+ }
+ return sizes;
+ };
+ SmartArt.prototype.generateLocalDrawingPart = function () {
+ if (this.isLocalDrawingPart) {
+ if (!this.isCanGenerateSmartArt()) {
+ this.isLocalDrawingPart = false;
+ return;
+ }
+ AscFormat.ExecuteNoHistory(function () {
+ this.generateDrawingPart();
+ this.isLocalDrawingPart = true;
+ this.localDrawingId = this.drawing.Get_Id();
+ }, this, []);
+ }
+ };
+ SmartArt.prototype.reconnectSmartArtShapes = function () {
+ if (!this.dataModel) {
+ return;
+ }
+ this.smartArtTree = new AscFormat.SmartArtAlgorithm(this);
+ if (this.isCanGenerateSmartArt()) {
+ this.smartArtTree.startFromBegin();
+ this.smartArtTree.connectShapeSmartArtInfo();
+ } else {
+ this.setConnections2();
+ }
+ };
+ SmartArt.prototype.checkDrawingPartWithHistory = function (handleShape) {
+ if (this.worksheet && this.isLocalDrawingPart && AscCommon.History.CanAddChanges()) {
+ this.isLocalDrawingPart = false;
+ const oldDrawing = this.drawing;
+ const mainGroup = this.getMainGroup();
+ const selectedObjects = mainGroup.selectedObjects;
+ const mapShapes = {};
+ for (let i = 0; i < oldDrawing.spTree.length; i += 1) {
+ const shape = oldDrawing.spTree[i];
+ mapShapes[shape.GetId()] = {index: i, state: null};
+ const docContent = shape.getDocContent();
+ if (docContent) {
+ mapShapes[shape.GetId()].state = docContent.GetSelectionState();
+ }
+ }
+
+ const copyDrawing = this.drawing.copy();
+ copyDrawing.setWorksheet(this.drawing.worksheet);
+ copyDrawing.setDrawingObjects(this.drawing.drawingObjects);
+ this.removeFromSpTreeByPos(0);
+ this.addToSpTree(0, copyDrawing);
+ this.setDrawing(copyDrawing);
+ this.reconnectSmartArtShapes();
+ copyDrawing.recalculate();
+ for (let i = 0; i < selectedObjects.length; i += 1) {
+ const shapeInfo = mapShapes[selectedObjects[i].Id];
+ if (shapeInfo) {
+ copyDrawing.spTree[shapeInfo.index].selectStartPage = selectedObjects[i].selectStartPage;
+ selectedObjects[i] = copyDrawing.spTree[shapeInfo.index];
+ selectedObjects[i].selected = true;
+ if (shapeInfo.state) {
+ const docContent = selectedObjects[i].getDocContent();
+ docContent && docContent.SetSelectionState(shapeInfo.state);
+ }
+ }
+ }
+ if (mainGroup.selection.textSelection) {
+ const info = mapShapes[mainGroup.selection.textSelection.GetId()];
+ if (info) {
+ mainGroup.selection.textSelection = copyDrawing.spTree[info.index];
+ }
+ }
+ if (handleShape) {
+ const info = mapShapes[handleShape.GetId()];
+ if (info) {
+ return copyDrawing.spTree[info.index];
+ }
+ }
+ }
+ };
+ SmartArt.prototype.initDrawing = function () {
+ if (!this.drawing) {
+ this.drawing = new Drawing();
+ this.drawing.setBDeleted(false);
+ this.addToSpTree(0, this.drawing);
+ const spPr = new AscFormat.CSpPr();
+ this.drawing.setSpPr(spPr);
+ spPr.setParent(this.drawing);
+ const nvSpPr = new AscFormat.UniNvPr();
+ nvSpPr.cNvPr.setId(0);
+ this.drawing.setNvSpPr(nvSpPr);
+ }
+ }
+ SmartArt.prototype.generateDrawingPart = function () {
+ this.isLocalDrawingPart = false;
+ if (!this.isCanGenerateSmartArt()) {
+ return;
+ }
+ this.smartArtTree = new AscFormat.SmartArtAlgorithm(this);
+ this.smartArtTree.startFromBegin();
+ const drawing = this.getDrawing();
+ const shapeLength = drawing.spTree.length;
+ for (let i = 0; i < shapeLength; i++) {
+ drawing.removeFromSpTreeByPos(0);
+ }
+ const shapes = this.smartArtTree.getShapes();
+ for (let i = shapes.length - 1; i >= 0; i -= 1) {
+ drawing.addToSpTree(0, shapes[i]);
+ }
+ this.recalcFitFontSize();
+ };
+ SmartArt.prototype.generateSmartArtDrawingPart = SmartArt.prototype.generateDrawingPart;
+ SmartArt.prototype.findConnector = function (x, y) {
+ return null;
+ };
SmartArt.prototype.getAllRasterImages = function (arrImages)
{
const oBgFormat = this.getBg();
@@ -10180,7 +10236,6 @@ Because of this, the display is sometimes not correct.
arrShapes.forEach(function (oShape) {
if (oShape.spPr) {
if (oShape.spPr.Fill && oShape.spPr.Fill.fill && !(oShape.spPr.Fill.fill instanceof AscFormat.CNoFill)) {
- let mods = null;
const id = oShape.spPr.Fill.fill.color.color.id;
let standardColor;
if (id === 0) {
@@ -10192,7 +10247,7 @@ Because of this, the display is sometimes not correct.
}
if (oShape.spPr.Fill.fill.color.Mods) {
- mods = oShape.spPr.Fill.fill.color.Mods.Apply(standardColor);
+ oShape.spPr.Fill.fill.color.Mods.Apply(standardColor);
}
const grayscaleValue = AscFormat.getGrayscaleValue(standardColor);
@@ -10226,11 +10281,15 @@ Because of this, the display is sometimes not correct.
if (oldParaMarks) {
editor.ShowParaMarks = false;
}
+ if (this.recalcInfo.reconnectSmartArtShapes) {
+ this.recalcInfo.reconnectSmartArtShapes = false;
+ this.reconnectSmartArtShapes();
+ }
CGroupShape.prototype.recalculate.call(this);
- if (this.bFirstRecalculate) {
- this.bFirstRecalculate = false;
- this.fitFontSize();
- }
+ if (this.recalcInfo.fitFontSize) {
+ this.recalcInfo.fitFontSize = false;
+ this.fitFontSize();
+ }
if (oldParaMarks) {
editor.ShowParaMarks = oldParaMarks;
}
@@ -10269,6 +10328,7 @@ Because of this, the display is sometimes not correct.
this.readChild(pReader.stream.GetUChar(), pReader);
this.readChild(pReader.stream.GetUChar(), pReader);
this.readChild(pReader.stream.GetUChar(), pReader);
+ this.readChild(pReader.stream.GetUChar(), pReader);
this.checkNodePointsAfterRead(true);
}
this.setSpPr(new AscFormat.CSpPr());
@@ -10343,13 +10403,6 @@ Because of this, the display is sometimes not correct.
}
};
- SmartArt.prototype.startAlgorithm = function (pointTree) {
- var layoutDef = this.getLayoutDef();
- if (layoutDef) {
- layoutDef.startAlgorithm(pointTree);
- }
- }
-
SmartArt.prototype.getShapeMap = function () {
var shapes = this.getDrawing() && this.getDrawing().spTree;
var shapeMap = {};
@@ -10361,11 +10414,6 @@ Because of this, the display is sometimes not correct.
}
}
- SmartArt.prototype.recalculateSmartArt = function () {
- var tree = this.createHierarchy();
- this.startAlgorithm(tree);
- }
-
SmartArt.prototype.getPtMap = function () {
var ptLst = this.getPtLst();
var ptMap = {};
@@ -10387,113 +10435,10 @@ Because of this, the display is sometimes not correct.
return dataModel && dataModel.getCxnLst() && dataModel.getCxnLst().list;
}
- SmartArt.prototype.createDataForHierarchy = function () {
- var shapeMap = this.getShapeMap();
- var ptMap = this.getPtMap();
- var ptLst = this.getPtLst();
- var cxnLst = this.getCxnLst();
- var elements = [];
- var nodePoints = [];
- var ptLstWithTypePres = [];
- var docPoint;
- if (cxnLst && ptLst) {
- var connectionsParOf = cxnLst.filter(function (cxn) {return !cxn.type;});
-
- ptLst.forEach(function (point) {
- if (point.type === Point_type_pres) {
- ptLstWithTypePres.push(point);
- } else if (!point.type || point.type === Point_type_node || point.type === Point_type_asst) {
- nodePoints.push(point);
- } else if (point.type === Point_type_doc) {
- docPoint = point;
- }
- });
-
- for (var i = 0; i <= nodePoints.length; i += 1) {
- var elem = new SmartArtNodeData();
-
- if (i === nodePoints.length) {
- var mPoint = docPoint;
- elem.setDocPoint(mPoint);
-
- } else {
- mPoint = nodePoints[i];
- if (!mPoint.type || mPoint.type === Point_type_node) {
- elem.setNodePoint(mPoint);
- } else if (mPoint.type === Point_type_asst) {
- elem.setAsstPoint(mPoint);
- }
- }
-
- connectionsParOf.forEach(function (cxn) {
- if (cxn.destId === mPoint.modelId) {
- elem.setCxn(cxn);
- if (ptMap) {
- elem.addToLstSibPoint(0, ptMap[cxn.sibTransId]);
- elem.addToLstParPoint(0, ptMap[cxn.parTransId]);
- }
- }
- });
-
- ptLstWithTypePres.forEach(function (pointWithTypePres) {
- var prSet = pointWithTypePres.prSet;
- if (prSet && (prSet.presAssocID === mPoint.modelId || (elem.sibPoint && prSet.presAssocID === elem.sibPoint.modelId) || (elem.parPoint && prSet.presAssocID === elem.parPoint.modelId))) {
- elem.addToLstPresPoint(elem.presPoint.length, pointWithTypePres);
- if (shapeMap && shapeMap[pointWithTypePres.modelId]) {
- elem.addToLstShapes(elem.shapes.length, shapeMap[pointWithTypePres.modelId]);
- }
- }
- });
- elements.push(elem);
- }
- return elements;
- }
- }
-
- SmartArt.prototype.createHierarchy = function () {
- var cxnLst = this.getCxnLst();
-
- if (cxnLst) {
- var cxnWithNoPres = cxnLst.filter(function (cxn) {return !cxn.type;});
-
- var elements = this.createDataForHierarchy();
-
- var root = elements.reduce(function (acc, next) {
- if (next.docPoint) {
- return next;
- }
- return acc;
- }, undefined);
-
- if (root) {
- var rootInfo = root.docPoint.modelId;
- var tree = new SmartArtTree(rootInfo, root, this);
-
- cxnWithNoPres = cxnWithNoPres.sort(function (a, b) {
- return parseInt(a.srcOrd) - parseInt(b.srcOrd);
- });
- for (var i = 0; i < cxnWithNoPres.length; i += 1) {
- for (var j = 0; j < cxnWithNoPres.length; j += 1) {
- var _cxn = cxnWithNoPres[j];
- var childData = elements.reduce(function (acc, next) {
- var nodePoint = next.nodePoint || next.asstPoint;
- if (nodePoint && nodePoint.modelId === _cxn.destId) {
- return next;
- }
- return acc;
- }, undefined);
- tree.add(_cxn.destId, _cxn.srcId, childData);
- }
- }
- }
- }
- return tree;
- }
-
- SmartArt.prototype.getDefColorsByName = function () {
- var colorsDef = this.getColorsDef();
- return colorsDef && colorsDef.styleLblByName;
- }
+ SmartArt.prototype.getDefColorsByName = function () {
+ var colorsDef = this.getColorsDef();
+ return colorsDef && colorsDef.styleLblByName;
+ }
SmartArt.prototype.getDefaultColorsForPoint = function (point) {
var styleLbl = point.getPresStyleLbl();
@@ -10514,8 +10459,21 @@ Because of this, the display is sometimes not correct.
}
SmartArt.prototype.getSmartArtDefaultTxFill = function (shape) {
- var shapePoint = shape && shape.getSmartArtShapePoint();
- var defaultTxColorFromShape = shapePoint && this.getDefaultTxColorFromPoint(shapePoint);
+ const smartArtInfo = shape.getSmartArtInfo();
+ if (!smartArtInfo) {
+ return;
+ }
+ let textPoint;
+ if (this.isCanGenerateSmartArt()) {
+ const contentNodes = smartArtInfo.contentPoint;
+ if (contentNodes.length) {
+ const textNode = contentNodes[0].getTextNode();
+ textPoint = textNode && textNode.presPoint;
+ }
+ } else {
+ textPoint = smartArtInfo.shapePoint;
+ }
+ var defaultTxColorFromShape = textPoint && this.getDefaultTxColorFromPoint(textPoint);
var defaultTxFill;
if (defaultTxColorFromShape) {
@@ -10525,155 +10483,12 @@ Because of this, the display is sometimes not correct.
}
SmartArt.prototype.getTypeOfSmartArt = function () {
- // Russian name -> type
- //
- //
- // Акцентируемый рисунок -> AccentedPicture
- // Баланс -> balance1
- // Блоки рисунков с названиями -> TitledPictureBlocks
- // Блоки со смещенными рисунками -> PictureAccentBlocks
- // Блочный цикл -> cycle5
- // Венна в столбик -> venn2
- // Вертикальное уравнение -> equation2
- // Вертикальный блочный список -> vList5
- // Вертикальный ломаный процесс -> bProcess4
- // Вертикальный маркированный список -> vList2
- // Вертикальный нелинейный список -> VerticalCurvedList
- // Вертикальный процесс -> process2
- // Вертикальный список -> list1
- // Вертикальный список рисунков -> vList4
- // Вертикальный список с кругами -> VerticalCircleList
- // Вертикальный список со смещенными рисунками -> vList3
- // Вертикальный список со стрелкой -> vList6
- // Вертикальный уголковый список -> chevron2
- // Вертикальный уголковый список2 -> VerticalAccentList
- // Вложенная целевая -> target2
- // Воронка -> funnel1
- // Восходящая стрелка -> arrow2
- // Восходящая стрелка процесса -> IncreasingArrowsProcess
- // Восходящий процесс -> StepUpProcess
- // Выноска с круглыми рисунками -> CircularPictureCallout
- // Горизонтальная иерархия -> hierarchy2
- // Горизонтальная иерархия с подписями -> hierarchy5
- // Горизонтальная многоуровневая иерархия -> HorizontalMultiLevelHierarchy
- // Горизонтальная организационная диаграмма -> HorizontalOrganizationChart
- // Горизонтальный маркированный список -> hList1
- // Горизонтальный список рисунков -> pList2
- // Закрытый уголковый процесс -> hChevron3
- // Иерархический список -> hierarchy3
- // Иерархия -> hierarchy1
- // Иерархия с круглыми рисунками -> CirclePictureHierarchy
- // Иерархия с подписями -> hierarchy6
- // Инвертированная пирамида -> pyramid3
- // Кластер шестиугольников -> HexagonCluster
- // Круг связей -> CircleRelationship
- // Круглая временная шкала -> CircleAccentTimeline
- // Круглый ломаный процесс -> bProcess2
- // Лента со стрелками -> arrow6
- // Линейная Венна -> venn3
- // Линия рисунков -> PictureLineup
- // Линия рисунков с названиями -> TitlePictureLineup
- // Ломаный список рисунков с подписями -> BendingPictureCaptionList
- // Ломаный список со смещенными рисунками -> bList2
- // Матрица с заголовками -> matrix1
- // Нарастающий процесс с кругами -> IncreasingCircleProcess
- // Нелинейные рисунки с блоками -> BendingPictureBlocks
- // Нелинейные рисунки с подписями -> BendingPictureCaption
- // Нелинейные рисунки с полупрозрачным текстом -> BendingPictureSemiTransparentText
- // Ненаправленный цикл -> cycle6
- // Непрерывный блочный процесс -> hProcess9
- // Непрерывный список с рисунками -> hList7
- // Непрерывный цикл -> cycle3
- // Нисходящий блочный список -> BlockDescendingList
- // Нисходящий процесс -> StepDownProcess
- // Обратный список -> ReverseList
- // Организационная диаграмма -> orgChart1
- // Организационная диаграмма с именами и должностями -> NameandTitleOrganizationalChart
- // Переменный поток -> hProcess4
- // Пирамидальный список -> pyramid2
- // Плюс и минус -> PlusandMinus
- // Повторяющийся ломаный процесс -> bProcess3
- // Подписанные рисунки -> CaptionedPictures
- // Подробный процесс -> hProcess7
- // Полосы рисунков -> PictureStrips
- // Полукруглая организационная диаграмма -> HalfCircleOrganizationChart
- // Поэтапный процесс -> PhasedProcess
- // Простая Венна -> venn1
- // Простая временная шкала -> hProcess11
- // Простая круговая -> chart3
- // Простая матрица -> matrix3
- // Простая пирамида -> pyramid1
- // Простая радиальная -> radial1
- // Простая целевая -> target1
- // Простой блочный список -> default
- // Простой ломаный процесс -> process5
- // Простой процесс -> process1
- // Простой уголковый процесс -> chevron1
- // Простой цикл -> cycle2
- // Противоположные идеи -> OpposingIdeas
- // Противостоящие стрелки -> arrow4
- // Процесс от случайности к результату -> RandomtoResultProcess
- // Процесс с вложенными шагами -> SubStepProcess
- // Процесс с круговой диаграммой -> PieProcess
- // Процесс со смещением -> process3
- // Процесс со смещенными по возрастанию рисунками -> AscendingPictureAccentProcess
- // Процесс со смещенными рисунками -> hProcess10
- // Радиальная Венна -> radial3
- // Радиальная циклическая -> radial6
- // Радиальный кластер -> RadialCluster
- // Радиальный список -> radial2
- // Разнонаправленный цикл -> cycle7
- // Расходящаяся радиальная -> radial5
- // Расходящиеся стрелки -> arrow1
- // Рисунок с текстом в рамке -> FramedTextPicture
- // Сгруппированный список -> lProcess2
- // Сегментированная пирамида -> pyramid4
- // Сегментированный процесс -> process4
- // Сегментированный цикл -> cycle8
- // Сетка рисунков -> PictureGrid
- // Сетчатая матрица -> matrix2
- // Спираль рисунков -> SpiralPicture
- // Список в столбик -> hList9
- // Список названий рисунков -> pList1
- // Список процессов -> lProcess1
- // Список рисунков с выносками -> BubblePictureList
- // Список с квадратиками -> SquareAccentList
- // Список с линиями -> LinedList
- // Список со смещенными рисунками -> hList2
- // Список со смещенными рисунками и заголовком -> PictureAccentList
- // Список со снимками -> SnapshotPictureList
- // Стрелка непрерывного процесса -> hProcess3
- // Стрелка процесса с кругами -> CircleArrowProcess
- // Стрелки процесса -> hProcess6
- // Ступенчатый процесс -> vProcess5
- // Сходящаяся радиальная -> radial4
- // Сходящиеся стрелки -> arrow5
- // Табличная иерархия -> hierarchy4
- // Табличный список -> hList3
- // Текстовый цикл -> cycle1
- // Трапецевидный список -> hList6
- // Убывающий процесс -> DescendingProcess
- // Уголковый список -> lProcess3
- // Уравнение -> equation1
- // Уравновешивающие стрелки -> arrow3
- // Целевой список -> target3
- // Циклическая матрица -> cycle4
- // Чередующиеся блоки рисунков -> AlternatingPictureBlocks
- // Чередующиеся круги рисунков -> AlternatingPictureCircles
- // Чередующиеся шестиугольники -> AlternatingHexagons
- // Шестеренки -> gear1
- var dataModel = this.getDataModel() && this.getDataModel().getDataModel();
- var ptLst = dataModel.ptLst.list;
+ const layoutDef = this.getLayoutDef();
var type;
- ptLst.forEach(function (point) {
- if (point.type === Point_type_doc) {
- if (point.prSet && point.prSet.loTypeId) {
- var typeSplit = point.prSet.loTypeId.split('/');
- type = typeSplit[typeSplit.length - 1];
- type = type.split('#')[0];
- }
- }
- });
+ if (layoutDef) {
+ var typeSplit = layoutDef.uniqueId.split('/');
+ type = typeSplit[typeSplit.length - 1].split('#')[0];
+ }
switch (type) {
case "AccentedPicture": {
@@ -11371,7 +11186,9 @@ Because of this, the display is sometimes not correct.
SmartArt.prototype.setColorsDef = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_SmartArtColorsDef, this.getColorsDef(), oPr));
this.colorsDef = oPr;
- oPr.setParent(this);
+ if (oPr) {
+ oPr.setParent(this);
+ }
};
SmartArt.prototype.setType = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeString(this, AscDFH.historyitem_SmartArtType, this.type, oPr));
@@ -11379,23 +11196,31 @@ Because of this, the display is sometimes not correct.
};
SmartArt.prototype.setDrawing = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_SmartArtDrawing, this.getDrawing(), oPr));
- this.drawing = oPr;
- oPr.setParent(this);
+ this.drawing = oPr;
+ if (oPr) {
+ oPr.setParent(this);
+ }
};
SmartArt.prototype.setLayoutDef = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_SmartArtLayoutDef, this.getLayoutDef(), oPr));
this.layoutDef = oPr;
- oPr.setParent(this);
+ if (oPr) {
+ oPr.setParent(this);
+ }
};
SmartArt.prototype.setDataModel = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_SmartArtDataModel, this.getDataModel(), oPr));
this.dataModel = oPr;
- oPr.setParent(this);
+ if (oPr) {
+ oPr.setParent(this);
+ }
};
SmartArt.prototype.setStyleDef = function (oPr) {
oHistory.CanAddChanges() && oHistory.Add(new CChangeObject(this, AscDFH.historyitem_SmartArtStyleDef, this.getStyleDef(), oPr));
this.styleDef = oPr;
- oPr.setParent(this);
+ if (oPr) {
+ oPr.setParent(this);
+ }
};
SmartArt.prototype.getColorsDef = function () {
return this.colorsDef;
@@ -11435,6 +11260,64 @@ Because of this, the display is sometimes not correct.
}
};
+ SmartArt.prototype.getRelationOfContent2 = function () {
+ var dataModel = this.getDataModel() && this.getDataModel().getDataModel();
+ if (dataModel) {
+ var connections = {byConnections: {}, custom: {}};
+ connections.byConnections[Cxn_type_presOf] = {};
+ connections.byConnections[Cxn_type_parOf] = {};
+ connections.byConnections[Cxn_type_presParOf] = {};
+ connections.custom.presParOfAssocId = {};
+ connections.custom.presChildParOf = {};
+ var ptMap = this.getPtMap();
+ var cxnLst = dataModel.cxnLst.list;
+
+ cxnLst.forEach(function (cxn) {
+ switch (cxn.type) {
+ case Cxn_type_presOf: {
+ const point = ptMap[cxn.srcId];
+ connections.byConnections[Cxn_type_presOf][point.getModelId()] = ptMap[cxn.destId];
+ break;
+ }
+ case Cxn_type_parOf: {
+ if (!connections.byConnections[Cxn_type_parOf][cxn.srcId]) {
+ connections.byConnections[Cxn_type_parOf][cxn.srcId] = [];
+ }
+ connections.byConnections[Cxn_type_parOf][cxn.srcId].push({
+ point : ptMap[cxn.destId],
+ sibPoint: ptMap[cxn.sibTransId],
+ parPoint: ptMap[cxn.parTransId],
+ index: parseInt(cxn.srcOrd, 10)
+ });
+ break;
+ }
+ case Cxn_type_presParOf: {
+ if (!connections.byConnections[Cxn_type_presParOf][cxn.srcId]) {
+ connections.byConnections[Cxn_type_presParOf][cxn.srcId] = {};
+ }
+ const presPoint = ptMap[cxn.destId];
+ connections.byConnections[Cxn_type_presParOf][cxn.srcId][cxn.srcOrd] = ptMap[cxn.destId];
+ const presAssocId = presPoint.getPresAssocID();
+ if (!connections.custom.presParOfAssocId[presAssocId]) {
+ connections.custom.presParOfAssocId[presAssocId] = [];
+ }
+ connections.custom.presParOfAssocId[presAssocId].push(presPoint);
+ connections.custom.presChildParOf[cxn.destId] = ptMap[cxn.srcId];
+ break;
+ }
+ default:
+ break;
+ }
+ });
+ for (let id in connections.byConnections[Cxn_type_parOf]) {
+ connections.byConnections[Cxn_type_parOf][id].sort(function (a, b) {
+ return a.index - b.index;
+ });
+ }
+ return connections;
+ }
+ };
+
SmartArt.prototype.getRelationOfContent = function () {
var dataModel = this.getDataModel() && this.getDataModel().getDataModel();
if (dataModel) {
@@ -11443,7 +11326,7 @@ Because of this, the display is sometimes not correct.
var shapeMap = this.getShapeMap();
var cxnLst = dataModel.cxnLst.list;
var presCxnLst = cxnLst.filter(function (cxn) {
- return cxn.type === 'presOf';
+ return cxn.type === Cxn_type_presOf;
});
presCxnLst.forEach(function (cxn) {
@@ -11481,7 +11364,7 @@ Because of this, the display is sometimes not correct.
var shapeMap = this.getShapeMap();
var cxnLst = dataModel.cxnLst.list;
var presCxnLst = cxnLst.filter(function (cxn) {
- return cxn.type === 'presOf' || cxn.type === 'presParOf';
+ return cxn.type === Cxn_type_presOf || cxn.type === Cxn_type_presParOf;
});
presCxnLst.forEach(function (cxn) {
@@ -11503,14 +11386,15 @@ Because of this, the display is sometimes not correct.
var shapeMap = this.getShapeMap();
var contentConnections = this.getRelationOfContent();
var shapeConnections = this.getRelationOfShapes();
-
+ const contentNodeRelations = this.smartArtTree.getDataPointRelations();
for (var modelId in shapeMap) {
var shape = shapeMap[modelId];
var smartArtInfo = new ShapeSmartArtInfo();
shape.setShapeSmartArtInfo(smartArtInfo);
if (contentConnections[modelId]) {
contentConnections[modelId].forEach(function (el) {
- smartArtInfo.addToLstContentPoint(smartArtInfo.contentPoint.length, el.point);
+ const contentNode = contentNodeRelations[el.point.getModelId()];
+ smartArtInfo.addToLstContentPoint(smartArtInfo.contentPoint.length, contentNode);
});
}
if (shapeConnections[modelId]) {
@@ -11547,6 +11431,7 @@ Because of this, the display is sometimes not correct.
switch (nType) {
case 0: {
this.setDrawing(new Drawing());
+ this.drawing.setBDeleted(false);
pReader.ReadSmartArtGroup(this.drawing);
this.drawing.setGroup(this);
this.addToSpTree(0, this.drawing);
@@ -11555,7 +11440,6 @@ Because of this, the display is sometimes not correct.
case 1: {
this.setDataModel(new DiagramData());
this.dataModel.fromPPTY(pReader);
- this.setConnections2();
break;
}
case 2: {
@@ -11681,6 +11565,11 @@ Because of this, the display is sometimes not correct.
editor.ShowParaMarks = false;
}
+ if (graphics.animationDrawer) {
+ graphics.animationDrawer.drawObject(this, graphics);
+ return;
+ }
+
if(this.calcGeometry) {
graphics.SaveGrState();
graphics.SetIntegerGrid(false);
@@ -11733,7 +11622,9 @@ Because of this, the display is sometimes not correct.
var RGBA = {R: 0, G: 0, B: 0, A: 255};
this.brush.calculate(oParents.theme, oParents.slide, oParents.layout, oParents.master, RGBA);
};
-
+ SmartArt.prototype.getCompiledFill = function () {
+ return null;
+ };
SmartArt.prototype.recalculatePen = function () {
this.pen = null;
var oWhole = this.getWhole();
@@ -11893,7 +11784,6 @@ Because of this, the display is sometimes not correct.
copy.cachedPixW = this.cachedPixW;
}
copy.setLocks(this.locks);
- copy.setConnections2();
return copy;
};
SmartArt.prototype.handleUpdateFill = function() {
@@ -11934,1373 +11824,23 @@ Because of this, the display is sometimes not correct.
}
};
SmartArt.prototype.checkNodePointsAfterRead = function(bReplaceAll) {
- let tree = this.createHierarchy();
- tree.traverseBF(function (node) {
- let nodePoint = node.data && (node.data.nodePoint || node.data.asstPoint);
- if (nodePoint) {
- if (bReplaceAll) {
- nodePoint.setPhldrT('[' + AscCommon.translateManager.getValue('Text') + ']');
- } else {
- const oPlaceholderText = nodePoint.getPhldrT();
- if (typeof oPlaceholderText !== 'string') {
- nodePoint.setPhldrT('');
- }
- }
- }
- });
- };
-
- function SmartArtTree(rootInfo, rootData, parent) {
- CBaseFormatObject.call(this);
- var child = new SmartArtNode();
- if (rootInfo) {
- child.setInfo(rootInfo);
- }
- if (rootData) {
- child.setData(rootData);
- }
- child.setParent(this);
- this.parent = parent;
- child.depth = 0;
- this.root = child;
- }
- InitClass(SmartArtTree, CBaseFormatObject, AscDFH.historyitem_type_SmartArtTree);
-
- SmartArtTree.prototype.traverseDF = function (callback) {
- (function recurse(currentNode) {
- for (var i = 0; i < currentNode.children.length; i += 1) {
- recurse(currentNode.children[i]);
- }
- callback(currentNode);
- })(this.root);
- }
- SmartArtTree.prototype.setRoot = function (oPr) {
- this.root = oPr;
- oPr.setParent(this);
- }
-
- SmartArtTree.prototype.traverseBF = function (callback) {
- var queue = [];
- var currentTree = this.root;
-
- while (currentTree) {
- for (var i = 0; i < currentTree.children.length; i += 1) {
- queue.push(currentTree.children[i]);
- }
- callback(currentTree);
- currentTree = queue.shift();
- }
- }
-
- SmartArtTree.prototype.findNodeByNameAndStyleLbl = function (name, styleLbl) {
- var layoutNode = [];
- function callback(node) {
- if (node.data) {
- if (name && styleLbl) {
- var check = node.data.presPoint.some(function (point) {
- if (point.prSet) {
- return point.prSet.presName === name && point.prSet.styleLbl === styleLbl;
- }
- });
- if (check) {
- layoutNode.push(node.data);
- }
- } else if (name) {
- var check = node.data.presPoint.some(function (point) {
- if (point.prSet) {
- return point.prSet.presName === name;
- }
- });
- if (check) {
- layoutNode.push(node.data);
- }
- } else if (styleLbl) {
- var check = node.data.presPoint.some(function (point) {
- if (point.prSet) {
- return point.prSet.styleLbl === styleLbl;
- }
- });
- if (check) {
- layoutNode.push(node.data);
- }
- }
- }
- }
- this.contains(callback, true);
- return layoutNode;
- }
-
- SmartArtTree.prototype.contains = function (callback, isTraverseDF) {
- var traverse = isTraverseDF ? this.traverseDF : this.traverseBF;
- traverse.call(this, callback);
- }
-
- SmartArtTree.prototype.add = function (childInfo, parentInfo, childData, isTraverseDF) {
- var traverse = isTraverseDF ? this.traverseDF : this.traverseBF;
- var parent;
-
- var callback = function (node) {
- if (node.info === parentInfo) {
- parent = node;
- }
- };
- this.contains(callback, traverse === this.traverseDF);
-
- if (parent) {
- var parentHaveChild = parent.children.some(function (ch) {
- return ch.info === childInfo;
- });
- if (!parentHaveChild) {
- var child = new SmartArtNode();
- if (childInfo) {
- child.setInfo(childInfo);
- }
- if (childData) {
- child.setData(childData);
- }
- parent.addToLstChildren(parent.children.length, child);
- }
- }
+ //todo
+ // let tree = this.createHierarchy();
+ // tree.traverseBF(function (node) {
+ // let nodePoint = node.data && (node.data.nodePoint || node.data.asstPoint);
+ // if (nodePoint) {
+ // if (bReplaceAll) {
+ // nodePoint.setPhldrT('[' + AscCommon.translateManager.getValue('Text') + ']');
+ // } else {
+ // const oPlaceholderText = nodePoint.getPhldrT();
+ // if (typeof oPlaceholderText !== 'string') {
+ // nodePoint.setPhldrT('');
+ // }
+ // }
+ // }
+ // });
};
- SmartArtTree.prototype.remove = function (node, parent) {
-
- }
-
- function SmartArtNode() {
- CBaseFormatObject.call(this);
- this.info = null;
- this.data = null;
- this.children = [];
- this.depth = null;
- }
- InitClass(SmartArtNode, CBaseFormatObject, AscDFH.historyitem_type_SmartArtNode);
-
- SmartArtNode.prototype.setInfo = function (oPr) {
- this.info = oPr;
- }
-
- SmartArtNode.prototype.getInfo = function () {
- return this.info;
- }
-
- SmartArtNode.prototype.setData = function (oPr) {
- this.data = oPr;
- oPr.setParent(this);
- }
-
- SmartArtNode.prototype.getData = function () {
- return this.data;
- }
-
- SmartArtNode.prototype.addToLstChildren = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.children.length, Math.max(0, nIdx));
- nInsertIdx === this.children.length ? this.children.push(oPr) : this.children.splice(nInsertIdx, 0, oPr);
- oPr.depth = this.depth + 1;
- oPr.setParent(this);
- }
-
- SmartArtNode.prototype.removeFromLstChildren = function (nIdx) {
- if (nIdx > -1 && nIdx < this.children.length) {
- this.children[nIdx].setParent(null);
- nIdx === this.children.length - 1 ? this.children.pop() : this.children.splice(nIdx, 1);
- }
- }
-
- SmartArtNode.prototype.getAxis = function (axisType) {
- switch (axisType) {
- case AxisType_value_ancst:
- return this.getAncst();
- case AxisType_value_ancstOrSelf:
- return this.getAncstOrSelf();
- case AxisType_value_ch:
- return this.getCh();
- case AxisType_value_des:
- return this.getDes();
- case AxisType_value_desOrSelf:
- return this.getDesOrSelf();
- case AxisType_value_follow:
- return this.getFollow();
- case AxisType_value_followSib:
- return this.getFollowSib();
- case AxisType_value_none:
- return this.getNone();
- case AxisType_value_par:
- return this.getPar();
- case AxisType_value_preced:
- return this.getPreced();
- case AxisType_value_precedSib:
- return this.getPrecedSib();
- case AxisType_value_root:
- return this.getRoot();
- case AxisType_value_self:
- return this.getSelf();
- default:
- return;
-
- }
- }
-
- SmartArtNode.prototype.getAncst = function () {
- var ancestors = [];
- var root = this;
- while (!(root instanceof SmartArtTree)) {
- if (root !== this) {
- ancestors.unshift(root);
- }
- root = root.parent;
- }
- return ancestors;
- }
-
- SmartArtNode.prototype.getAncstOrSelf = function () {
- return this.getAncst().concat(this.getSelf());
- }
-
- SmartArtNode.prototype.getCh = function () {
- return this.children;
- }
-
- SmartArtNode.prototype.getDes = function () {
- var descendant = [];
- (function recurse(context) {
- context.children.forEach(function (children) {
- descendant.push(children);
- recurse(children);
- });
- })(this);
- return descendant;
- }
-
- SmartArtNode.prototype.getDesOrSelf = function () {
- return this.getSelf().concat(this.getDes());
- }
-
- SmartArtNode.prototype.getFollow = function () {
- if (this.parent instanceof SmartArtTree) {
- return;
- }
- var follow = [];
- var followSib = this.getFollowSib();
- followSib.forEach(function (follower) {
- follow = follow.concat(follower.getDesOrSelf());
- });
- return follow;
- }
-
- SmartArtNode.prototype.getFollowSib = function () {
- if (this.parent instanceof SmartArtTree) {
- return;
- }
- var followSib = [];
- var isFollowSib;
- var parent = this.parent;
- var childs = parent.children;
- for (var i = 0; i < childs.length; i += 1) {
- var child = childs[i];
- if (isFollowSib) {
- followSib.push(child);
- }
- if (this === child) {
- isFollowSib = true;
- }
- }
- return followSib;
- }
-
- SmartArtNode.prototype.getNone = function () {
- return [];
- }
-
- SmartArtNode.prototype.getPar = function () {
- return [this.parent];
- }
-
- SmartArtNode.prototype.getPreced = function () {
- if (this.parent instanceof SmartArtTree) {
- return;
- }
- var preced = [];
- var precedSib = this.getPrecedSib();
- precedSib.forEach(function (preceder) {
- preced = preced.concat(preceder.getDesOrSelf());
- });
- return preced;
- }
-
- SmartArtNode.prototype.getPrecedSib = function () {
- if (this.parent instanceof SmartArtTree) {
- return;
- }
- var precedSib = [];
- var isPrecedSib;
- var parent = this.parent;
- var childs = parent.children;
- for (var i = childs.length - 1; i >= 0; i -= 1) {
- var child = childs[i];
- if (isPrecedSib) {
- precedSib.push(child);
- }
- if (this === child) {
- isPrecedSib = true;
- }
- }
- return precedSib;
- }
-
- SmartArtNode.prototype.getRoot = function () {
- var root = this;
- while (!(root instanceof SmartArtTree)) {
- root = root.parent;
- }
- return [root.root];
- }
-
- SmartArtNode.prototype.getSelf = function () {
- return [this];
- }
-
- SmartArtNode.prototype.getPoints = function (ptType, name) {
- var points = [];
- if (this.data) {
- switch (ptType) {
- case ElementType_value_all:
- points = this.data.getAllPoints();
- break;
- case ElementType_value_asst:
- points = this.data.getAsstPoint();
- break;
- case ElementType_value_node:
- points = this.data.getNodePoint();
- break;
- case ElementType_value_doc:
- points = this.data.getDocPoint();
- break;
- case ElementType_value_norm:
- points = this.data.getNormPoint();
- break;
- case ElementType_value_nonAsst:
- points = this.data.getNonAsstPoint();
- break;
- case ElementType_value_nonNorm:
- points = this.data.getNonNormPoint();
- break;
- case ElementType_value_parTrans:
- points = this.data.getParPoint();
- break;
- case ElementType_value_pres:
- points = this.data.getPresPoint();
- break;
- case ElementType_value_sibTrans:
- points = this.data.getSibPoint();
- break;
- default:
- points = this.data.getAllPoints();
- break;
- }
- if (name) {
- return points.filter(function (point) {
- return point && point.prSet && point.prSet.presName && point.prSet.presName === name;
- });
- }
- }
- return points;
- }
-
- SmartArtNode.prototype.getShape = function (name, ptType) {
- var points;
- if (ptType) {
- points = this.getPoints(ptType, name);
- } else {
- points = this.getPoints(ElementType_value_all, name);
- }
- points = points.map(function (point) {
- return point.getShape(name);
- }).filter(function (shape) {
- return !!shape;
- });
- return points;
- }
-
- function SmartArtNodeData() {
- CBaseFormatObject.call(this);
- this.cxn = null;
- this.sibPoint = [];
- this.parPoint = [];
- this.docPoint = null;
- this.nodePoint = null;
- this.normPoint = [];
- this.asstPoint = null;
- this.presPoint = [];
- this.shapes = [];
- }
- InitClass(SmartArtNodeData, CBaseFormatObject, AscDFH.historyitem_type_SmartArtNodeData);
-
- SmartArtNodeData.prototype.setSibPoint = function (oPr) {
- this.sibPoint = oPr;
- }
-
- SmartArtNodeData.prototype.addToLstSibPoint = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.sibPoint.length, Math.max(0, nIdx));
- nInsertIdx === this.sibPoint.length ? this.sibPoint.push(oPr) : this.sibPoint.splice(nInsertIdx, 0, oPr);
- }
-
- SmartArtNodeData.prototype.addToLstNormPoint = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.normPoint.length, Math.max(0, nIdx));
- nInsertIdx === this.normPoint.length ? this.normPoint.push(oPr) : this.normPoint.splice(nInsertIdx, 0, oPr);
- }
-
- SmartArtNodeData.prototype.addToLstParPoint = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.parPoint.length, Math.max(0, nIdx));
- nInsertIdx === this.parPoint.length ? this.parPoint.push(oPr) : this.parPoint.splice(nInsertIdx, 0, oPr);
- }
-
- SmartArtNodeData.prototype.setDocPoint = function (oPr) {
- this.docPoint = oPr;
- }
-
- SmartArtNodeData.prototype.addToLstAsstPoint = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.asstPoint.length, Math.max(0, nIdx));
- nInsertIdx === this.asstPoint.length ? this.asstPoint.push(oPr) : this.asstPoint.splice(nInsertIdx, 0, oPr);
- }
-
- SmartArtNodeData.prototype.setAsstPoint = function (oPr) {
- this.asstPoint = oPr;
- }
-
- SmartArtNodeData.prototype.setNodePoint = function (oPr) {
- this.nodePoint = oPr;
- }
-
- SmartArtNodeData.prototype.getPresPoint = function () {
- return this.presPoint;
- }
-
- SmartArtNodeData.prototype.getAllPoints = function () {
- var typeOfPoints = ['sibPoint', 'parPoint', 'docPoint', 'normPoint', 'nodePoint', 'asstPoint', 'presPoint'];
- var result = [];
- var that = this;
- typeOfPoints.forEach(function (pointType) {
- result = result.concat(!!that[pointType] ? that[pointType] : []);
- });
- return result;
- }
-
- SmartArtNodeData.prototype.getDocPoint = function () {
- return this.docPoint ? [this.docPoint] : [];
- }
-
- SmartArtNodeData.prototype.getNodePoint = function () {
- return this.nodePoint ? [this.nodePoint] : [];
- }
-
- SmartArtNodeData.prototype.getAsstPoint = function () {
- return this.asstPoint;
- }
-
- SmartArtNodeData.prototype.getNormPoint = function () {
- return this.normPoint;
- }
-
- SmartArtNodeData.prototype.getParPoint = function () {
- return this.parPoint;
- }
-
- SmartArtNodeData.prototype.getNonAsstPoint = function () {
- return this.getAllPoints().filter(function (point) {
- return point.type !== Point_type_asst;
- });
- }
-
- SmartArtNodeData.prototype.getNonNormPoint = function () {
- var typeOfPoints = ['sibPoint', 'parPoint', 'docPoint', 'nodePoint', 'asstPoint'];
- var result = [];
- var that = this;
- typeOfPoints.forEach(function (pointType) {
- result = result.concat(that[pointType]);
- });
- return result;
- }
-
- SmartArtNodeData.prototype.getSibPoint = function () {
- return this.sibPoint;
- }
-
- SmartArtNodeData.prototype.setCxn = function (oPr) {
- this.cxn = oPr;
- }
- SmartArtNodeData.prototype.getCxn = function () {
- return this.cxn;
- }
-
- SmartArtNodeData.prototype.setParPoint = function (oPr) {
- this.parPoint = oPr;
- }
-
- SmartArtNodeData.prototype.getParPoint = function () {
- return this.parPoint;
- }
-
-
- SmartArtNodeData.prototype.addToLstShapes = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.shapes.length, Math.max(0, nIdx));
- nInsertIdx === this.shapes.length ? this.shapes.push(oPr) : this.shapes.splice(nInsertIdx, 0, oPr);
- }
-
- SmartArtNodeData.prototype.removeFromLstShapes = function (nIdx) {
- if (nIdx > -1 && nIdx < this.shapes.length) {
- this.shapes[nIdx].setParent(null);
- nIdx === this.shapes.length - 1 ? this.shapes.pop() : this.shapes.splice(nIdx, 1);
- }
- }
-
- SmartArtNodeData.prototype.addToLstPresPoint = function (nIdx, oPr) {
- var nInsertIdx = Math.min(this.presPoint.length, Math.max(0, nIdx));
- nInsertIdx === this.presPoint.length ? this.presPoint.push(oPr) : this.presPoint.splice(nInsertIdx, 0, oPr);
- }
-
- SmartArtNodeData.prototype.removeFromLstPresPoint = function (nIdx) {
- if (nIdx > -1 && nIdx < this.presPoint.length) {
- this.presPoint[nIdx].setParent(null);
- nIdx === this.presPoint.length - 1 ? this.presPoint.pop() : this.presPoint.splice(nIdx, 1);
- }
- }
-
- SmartArtNodeData.prototype.getPresByNameAndStyleLbl = function (name, styleLbl) {
- var presValue;
- this.presPoint.forEach(function (pres) {
- if (pres.prSet) {
- if (name && styleLbl) {
- if (pres.prSet.presName === name && pres.prSet.styleLbl === styleLbl) {
- presValue = pres;
- }
- } else if (name) {
- if (pres.prSet.presName === name) {
- presValue = pres;
- }
- } else if (styleLbl) {
- if (pres.prSet.styleLbl === styleLbl) {
- presValue = pres;
- }
- }
- }
- });
- return presValue;
- }
-
- SmartArtNodeData.prototype.getPresWithVarLst = function () {
- for (var i = 0; i < this.presPoint.length; i += 1) {
- var pres = this.presPoint[i];
- if (pres && pres.prSet && pres.prSet.presLayoutVars) {
- return pres;
- }
- }
- }
-
- // Акцентируемый рисунок
- function SmartArtAccentedPicture() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtAccentedPicture, SmartArt);
-
- // Баланс
- function SmartArtBalance1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBalance1, SmartArt);
-
- // Блоки рисунков с названиями
- function SmartArtTitledPictureBlocks() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtTitledPictureBlocks, SmartArt);
-
- // Блоки со смещенными рисунками
- function SmartArtPictureAccentBlocks() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPictureAccentBlocks, SmartArt);
- // Блочный цикл
- function SmartArtCycle5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle5, SmartArt);
-
- // Венна в столбик
- function SmartArtVenn2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVenn2, SmartArt);
-
- // Вертикальное уравнение
- function SmartArtEquation2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtEquation2, SmartArt);
-
- // Вертикальный блочный список
- function SmartArtVList5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVList5, SmartArt);
-
- // Вертикальный ломаный процесс
- function SmartArtBProcess4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBProcess4, SmartArt);
-
- // Вертикальный маркированный список
- function SmartArtVList2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVList2, SmartArt);
-
- // Вертикальный нелинейный список
- function SmartArtVerticalCurvedList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVerticalCurvedList, SmartArt);
-
- // Вертикальный процесс
- function SmartArtProcess2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtProcess2, SmartArt);
-
- // Вертикальный список
- function SmartArtList1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtList1, SmartArt);
-
- // Вертикальный список рисунков
- function SmartArtVList4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVList4, SmartArt);
-
- // Вертикальный список с кругами
- function SmartArtVerticalCircleList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVerticalCircleList, SmartArt);
-
- // Вертикальный список со смещенными рисунками
- function SmartArtVList3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVList3, SmartArt);
-
- // Вертикальный список со стрелкой
- function SmartArtVList6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVList6, SmartArt);
-
- // Вертикальный уголковый список
- function SmartArtChevron2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtChevron2, SmartArt);
-
- // Вертикальный уголковый список2
- function SmartArtVerticalAccentList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVerticalAccentList, SmartArt);
-
- // Вложенная целевая
- function SmartArtTarget2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtTarget2, SmartArt);
-
- // Воронка
- function SmartArtFunnel1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtFunnel1, SmartArt);
-
- // Восходящая стрелка
- function SmartArtArrow2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtArrow2, SmartArt);
-
- // Восходящая стрелка процесса
- function SmartArtIncreasingArrowsProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtIncreasingArrowsProcess, SmartArt);
-
- // Восходящий процесс
- function SmartArtStepUpProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtStepUpProcess, SmartArt);
-
- // Выноска с круглыми рисунками
- function SmartArtCircularPictureCallout() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCircularPictureCallout, SmartArt);
-
- // Горизонтальная иерархия
- function SmartArtHierarchy2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHierarchy2, SmartArt);
-
- // Горизонтальная иерархия с подписями
- function SmartArtHierarchy5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHierarchy5, SmartArt);
-
- // Горизонтальная многоуровневая иерархия
- function SmartArtHorizontalMultiLevelHierarchy() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHorizontalMultiLevelHierarchy, SmartArt);
-
- // Горизонтальная организационная диаграмма
- function SmartArtHorizontalOrganizationChart() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHorizontalOrganizationChart, SmartArt);
-
- // Горизонтальный маркированный список
- function SmartArtHList1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHList1, SmartArt);
-
- // Горизонтальный список рисунков
- function SmartArtPList2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPList2, SmartArt);
-
- // Закрытый уголковый процесс
- function SmartArtHChevron3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHChevron3, SmartArt);
-
- // Иерархический список
- function SmartArtHierarchy3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHierarchy3, SmartArt);
-
- // Иерархия
- function SmartArtHierarchy1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHierarchy1, SmartArt);
-
- // Иерархия с круглыми рисунками
- function SmartArtCirclePictureHierarchy() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCirclePictureHierarchy, SmartArt);
-
- // Иерархия с подписями
- function SmartArtHierarchy6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHierarchy6, SmartArt);
-
- // Инвертированная пирамида
- function SmartArtPyramid3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPyramid3, SmartArt);
-
- // Кластер шестиугольников
- function SmartArtHexagonCluster() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHexagonCluster, SmartArt);
-
- // Круг связей
- function SmartArtCircleRelationship() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCircleRelationship, SmartArt);
-
- // Круглая временная шкала
- function SmartArtCircleAccentTimeline() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCircleAccentTimeline, SmartArt);
-
- // Круглый ломаный процесс
- function SmartArtBProcess2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBProcess2, SmartArt);
-
- // Лента со стрелками
- function SmartArtArrow6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtArrow6, SmartArt);
-
- // Линейная Венна
- function SmartArtVenn3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVenn3, SmartArt);
-
- // Линия рисунков
- function SmartArtPictureLineup() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPictureLineup, SmartArt);
-
- // Линия рисунков с названиями
- function SmartArtTitlePictureLineup() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtTitlePictureLineup, SmartArt);
-
- // Ломаный список рисунков с подписями
- function SmartArtBendingPictureCaptionList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBendingPictureCaptionList, SmartArt);
-
- // Ломаный список со смещенными рисунками
- function SmartArtBList2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBList2, SmartArt);
-
- // Матрица с заголовками
- function SmartArtMatrix1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtMatrix1, SmartArt);
-
- // Нарастающий процесс с кругами
- function SmartArtIncreasingCircleProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtIncreasingCircleProcess, SmartArt);
-
- // Нелинейные рисунки с блоками
- function SmartArtBendingPictureBlocks() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBendingPictureBlocks, SmartArt);
-
- // Нелинейные рисунки с подписями
- function SmartArtBendingPictureCaption() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBendingPictureCaption, SmartArt);
-
- // Нелинейные рисунки с полупрозрачным текстом
- function SmartArtBendingPictureSemiTransparentText() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBendingPictureSemiTransparentText, SmartArt);
-
- // Ненаправленный цикл
- function SmartArtCycle6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle6, SmartArt);
-
- // Непрерывный блочный процесс
- function SmartArtHProcess9() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess9, SmartArt);
-
- // Непрерывный список с рисунками
- function SmartArtHList7() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHList7, SmartArt);
-
- // Непрерывный цикл
- function SmartArtCycle3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle3, SmartArt);
-
- // Нисходящий блочный список
- function SmartArtBlockDescendingList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBlockDescendingList, SmartArt);
-
- // Нисходящий процесс
- function SmartArtStepDownProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtStepDownProcess, SmartArt);
-
- // Обратный список
- function SmartArtReverseList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtReverseList, SmartArt);
-
- // Организационная диаграмма
- function SmartArtOrgChart1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtOrgChart1, SmartArt);
-
- // Организационная диаграмма с именами и должностями
- function SmartArtNameandTitleOrganizationalChart() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtNameandTitleOrganizationalChart, SmartArt);
-
- // Переменный поток
- function SmartArtHProcess4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess4, SmartArt);
-
- // Пирамидальный список
- function SmartArtPyramid2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPyramid2, SmartArt);
-
- // Плюс и минус
- function SmartArtPlusandMinus() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPlusandMinus, SmartArt);
-
- // Повторяющийся ломаный процесс
- function SmartArtBProcess3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBProcess3, SmartArt);
-
- // Подписанные рисунки
- function SmartArtCaptionedPictures() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCaptionedPictures, SmartArt);
-
- // Подробный процесс
- function SmartArtHProcess7() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess7, SmartArt);
-
- // Полосы рисунков
- function SmartArtPictureStrips() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPictureStrips, SmartArt);
-
- // Полукруглая организационная диаграмма
- function SmartArtHalfCircleOrganizationChart() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHalfCircleOrganizationChart, SmartArt);
-
- // Поэтапный процесс
- function SmartArtPhasedProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPhasedProcess, SmartArt);
-
- // Простая Венна
- function SmartArtVenn1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVenn1, SmartArt);
-
- // Простая временная шкала
- function SmartArtHProcess11() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess11, SmartArt);
-
- // Простая круговая
- function SmartArtChart3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtChart3, SmartArt);
-
- // Простая матрица
- function SmartArtMatrix3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtMatrix3, SmartArt);
-
- // Простая пирамида
- function SmartArtPyramid1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPyramid1, SmartArt);
-
- // Простая радиальная
- function SmartArtRadial1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadial1, SmartArt);
-
- // Простая целевая
- function SmartArtTarget1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtTarget1, SmartArt);
-
- // Простой блочный список
- function SmartArtDefault() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtDefault, SmartArt);
-
- // Простой ломаный процесс
- function SmartArtProcess5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtProcess5, SmartArt);
-
- // Простой процесс
- function SmartArtProcess1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtProcess1, SmartArt);
-
- // Простой уголковый процесс
- function SmartArtChevron1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtChevron1, SmartArt);
-
- // Простой цикл
- function SmartArtCycle2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle2, SmartArt);
-
- // Противоположные идеи
- function SmartArtOpposingIdeas() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtOpposingIdeas, SmartArt);
-
- // Противостоящие стрелки
- function SmartArtArrow4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtArrow4, SmartArt);
-
- // Процесс от случайности к результату
- function SmartArtRandomtoResultProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRandomtoResultProcess, SmartArt);
-
- // Процесс с вложенными шагами
- function SmartArtSubStepProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtSubStepProcess, SmartArt);
-
- // Процесс с круговой диаграммой
- function SmartArtPieProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPieProcess, SmartArt);
-
- // Процесс со смещением
- function SmartArtProcess3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtProcess3, SmartArt);
-
- // Процесс со смещенными по возрастанию рисунками
- function SmartArtAscendingPictureAccentProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtAscendingPictureAccentProcess, SmartArt);
-
- // Процесс со смещенными рисунками
- function SmartArtHProcess10() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess10, SmartArt);
-
- // Радиальная Венна
- function SmartArtRadial3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadial3, SmartArt);
-
- // Радиальная циклическая
- function SmartArtRadial6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadial6, SmartArt);
-
- // Радиальный кластер
- function SmartArtRadialCluster() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadialCluster, SmartArt);
-
- // Радиальный список
- function SmartArtRadial2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadial2, SmartArt);
-
- // Разнонаправленный цикл
- function SmartArtCycle7() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle7, SmartArt);
-
- // Расходящаяся радиальная
- function SmartArtRadial5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadial5, SmartArt);
-
- // Расходящиеся стрелки
- function SmartArtArrow1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtArrow1, SmartArt);
-
- // Рисунок с текстом в рамке
- function SmartArtFramedTextPicture() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtFramedTextPicture, SmartArt);
-
- // Сгруппированный список
- function SmartArtLProcess2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtLProcess2, SmartArt);
-
- // Сегментированная пирамида
- function SmartArtPyramid4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPyramid4, SmartArt);
-
- // Сегментированный процесс
- function SmartArtProcess4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtProcess4, SmartArt);
-
- // Сегментированный цикл
- function SmartArtCycle8() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle8, SmartArt);
-
- // Сетка рисунков
- function SmartArtPictureGrid() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPictureGrid, SmartArt);
-
- // Сетчатая матрица
- function SmartArtMatrix2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtMatrix2, SmartArt);
-
- // Спираль рисунков
- function SmartArtSpiralPicture() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtSpiralPicture, SmartArt);
-
- // Список в столбик
- function SmartArtHList9() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHList9, SmartArt);
-
- // Список названий рисунков
- function SmartArtPList1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPList1, SmartArt);
-
- // Список процессов
- function SmartArtLProcess1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtLProcess1, SmartArt);
-
- // Список рисунков с выносками
- function SmartArtBubblePictureList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtBubblePictureList, SmartArt);
-
- // Список с квадратиками
- function SmartArtSquareAccentList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtSquareAccentList, SmartArt);
-
- // Список с линиями
- function SmartArtLinedList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtLinedList, SmartArt);
-
- // Список со смещенными рисунками
- function SmartArtHList2() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHList2, SmartArt);
-
- // Список со смещенными рисунками и заголовком
- function SmartArtPictureAccentList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtPictureAccentList, SmartArt);
-
- // Список со снимками
- function SmartArtSnapshotPictureList() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtSnapshotPictureList, SmartArt);
-
- // Стрелка непрерывного процесса
- function SmartArtHProcess3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess3, SmartArt);
-
- // Стрелка процесса с кругами
- function SmartArtCircleArrowProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCircleArrowProcess, SmartArt);
-
- // Стрелки процесса
- function SmartArtHProcess6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHProcess6, SmartArt);
-
- // Ступенчатый процесс
- function SmartArtVProcess5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtVProcess5, SmartArt);
-
- // Сходящаяся радиальная
- function SmartArtRadial4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtRadial4, SmartArt);
-
- // Сходящиеся стрелки
- function SmartArtArrow5() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtArrow5, SmartArt);
-
- // Табличная иерархия
- function SmartArtHierarchy4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHierarchy4, SmartArt);
-
- // Табличный список
- function SmartArtHList3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHList3, SmartArt);
-
- // Текстовый цикл
- function SmartArtCycle1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle1, SmartArt);
-
- // Трапецевидный список
- function SmartArtHList6() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtHList6, SmartArt);
-
- // Убывающий процесс
- function SmartArtDescendingProcess() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtDescendingProcess, SmartArt);
-
- // Уголковый список
- function SmartArtLProcess3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtLProcess3, SmartArt);
-
- // Уравнение
- function SmartArtEquation1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtEquation1, SmartArt);
-
- // Уравновешивающие стрелки
- function SmartArtArrow3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtArrow3, SmartArt);
-
- // Целевой список
- function SmartArtTarget3() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtTarget3, SmartArt);
-
- // Циклическая матрица
- function SmartArtCycle4() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtCycle4, SmartArt);
-
- // Чередующиеся блоки рисунков
- function SmartArtAlternatingPictureBlocks() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtAlternatingPictureBlocks, SmartArt);
-
- // Чередующиеся круги рисунков
- function SmartArtAlternatingPictureCircles() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtAlternatingPictureCircles, SmartArt);
-
- // Чередующиеся шестиугольники
- function SmartArtAlternatingHexagons() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtAlternatingHexagons, SmartArt);
-
- // Шестеренки
- function SmartArtGear1() {
- SmartArt.call(this);
- }
- InitClassWithoutType(SmartArtGear1, SmartArt);
-
-
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].kForInsFitFontSize = kForInsFitFontSize;
@@ -13318,8 +11858,6 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].LayoutDef = LayoutDef;
window['AscFormat'].CatLst = CatLst;
window['AscFormat'].SCat = SCat;
- window['AscFormat'].ClrData = ClrData;
- window['AscFormat'].Desc = Desc;
window['AscFormat'].LayoutNode = LayoutNode;
window['AscFormat'].Alg = Alg;
window['AscFormat'].Param = Param;
@@ -13351,12 +11889,6 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].ColorsDef = ColorsDef;
window['AscFormat'].ColorDefStyleLbl = ColorDefStyleLbl;
window['AscFormat'].ClrLst = ClrLst;
- window['AscFormat'].EffectClrLst = EffectClrLst;
- window['AscFormat'].FillClrLst = FillClrLst;
- window['AscFormat'].LinClrLst = LinClrLst;
- window['AscFormat'].TxEffectClrLst = TxEffectClrLst;
- window['AscFormat'].TxFillClrLst = TxFillClrLst;
- window['AscFormat'].TxLinClrLst = TxLinClrLst;
window['AscFormat'].ColorsDefHdr = ColorsDefHdr;
window['AscFormat'].ColorsDefHdrLst = ColorsDefHdrLst;
window['AscFormat'].StyleDef = StyleDef;
@@ -13377,7 +11909,6 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].StyleDefHdrLst = StyleDefHdrLst;
window['AscFormat'].StyleDefHdr = StyleDefHdr;
window['AscFormat'].BackdropAnchor = BackdropAnchor;
- window['AscFormat'].StyleData = StyleData;
window['AscFormat'].SampData = SampData;
window['AscFormat'].ForEach = ForEach;
window['AscFormat'].ResizeHandles = ResizeHandles;
@@ -13388,15 +11919,11 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].ExtrusionClr = ExtrusionClr;
window['AscFormat'].ContourClr = ContourClr;
window['AscFormat'].SmartArt = SmartArt;
- window['AscFormat'].CCommonDataClrList = CCommonDataClrList;
window['AscFormat'].BuNone = BuNone;
window['AscFormat'].Drawing = Drawing;
window['AscFormat'].DiagramData = DiagramData;
window['AscFormat'].FunctionValue = FunctionValue;
window['AscFormat'].ShapeSmartArtInfo = ShapeSmartArtInfo;
- window['AscFormat'].SmartArtTree = SmartArtTree;
- window['AscFormat'].SmartArtNode = SmartArtNode;
- window['AscFormat'].SmartArtNodeData = SmartArtNodeData;
window['AscFormat'].Point_type_asst = Point_type_asst;
window['AscFormat'].Point_type_doc = Point_type_doc;
@@ -13513,11 +12040,6 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].If_op_gte = If_op_gte;
window['AscFormat'].If_op_lte = If_op_lte;
- window['AscFormat'].boolOperator_none = boolOperator_none;
- window['AscFormat'].boolOperator_equ = boolOperator_equ;
- window['AscFormat'].boolOperator_gte = boolOperator_gte;
- window['AscFormat'].boolOperator_lte = boolOperator_lte;
-
window['AscFormat'].If_func_cnt = If_func_cnt;
window['AscFormat'].If_func_depth = If_func_depth;
window['AscFormat'].If_func_maxDepth = If_func_maxDepth;
@@ -14000,10 +12522,10 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].ParameterVal_connectorRouting_stra = ParameterVal_connectorRouting_stra;
window['AscFormat'].ParameterVal_continueDirection_revDir = ParameterVal_continueDirection_revDir;
window['AscFormat'].ParameterVal_continueDirection_sameDir = ParameterVal_continueDirection_sameDir;
- window['AscFormat'].ParameterVal_diagramHorizontalAlignment_ctr = ParameterVal_diagramHorizontalAlignment_ctr;
- window['AscFormat'].ParameterVal_diagramHorizontalAlignment_l = ParameterVal_diagramHorizontalAlignment_l;
- window['AscFormat'].ParameterVal_diagramHorizontalAlignment_none = ParameterVal_diagramHorizontalAlignment_none;
- window['AscFormat'].ParameterVal_diagramHorizontalAlignment_r = ParameterVal_diagramHorizontalAlignment_r;
+ window['AscFormat'].ParameterVal_horizontalAlignment_ctr = ParameterVal_horizontalAlignment_ctr;
+ window['AscFormat'].ParameterVal_horizontalAlignment_l = ParameterVal_horizontalAlignment_l;
+ window['AscFormat'].ParameterVal_horizontalAlignment_none = ParameterVal_horizontalAlignment_none;
+ window['AscFormat'].ParameterVal_horizontalAlignment_r = ParameterVal_horizontalAlignment_r;
window['AscFormat'].ParameterVal_diagramTextAlignment_ctr = ParameterVal_diagramTextAlignment_ctr;
window['AscFormat'].ParameterVal_diagramTextAlignment_l = ParameterVal_diagramTextAlignment_l;
window['AscFormat'].ParameterVal_diagramTextAlignment_r = ParameterVal_diagramTextAlignment_r;
@@ -14065,7 +12587,7 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].ParameterVal_textAnchorHorizontal_none = ParameterVal_textAnchorHorizontal_none;
window['AscFormat'].ParameterVal_textAnchorVertical_b = ParameterVal_textAnchorVertical_b;
window['AscFormat'].ParameterVal_textAnchorVertical_mid = ParameterVal_textAnchorVertical_mid;
- window['AscFormat'].ParameterVal_textAnchorVertical_top = ParameterVal_textAnchorVertical_top;
+ window['AscFormat'].ParameterVal_textAnchorVertical_t = ParameterVal_textAnchorVertical_t;
window['AscFormat'].ParameterVal_textBlockDirection_horz = ParameterVal_textBlockDirection_horz;
window['AscFormat'].ParameterVal_textBlockDirection_vert = ParameterVal_textBlockDirection_vert;
window['AscFormat'].ParameterVal_textDirection_fromB = ParameterVal_textDirection_fromB;
@@ -14101,4 +12623,8 @@ Because of this, the display is sometimes not correct.
window['AscFormat'].EChOrder_chOrderB = EChOrder_chOrderB;
window['AscFormat'].EChOrder_chOrderT = EChOrder_chOrderT;
+ window['AscCommon'].smartArtContentFillingType_parentWithChildren = smartArtContentFillingType_parentWithChildren;
+ window['AscCommon'].smartArtContentFillingType_onlyChildren = smartArtContentFillingType_onlyChildren;
+ window['AscCommon'].smartArtContentFillingType_onlyParent = smartArtContentFillingType_onlyParent;
+
})(window)
diff --git a/common/Drawings/Format/DrawingContent.js b/common/Drawings/Format/DrawingContent.js
index 30f35f92ff..103bbfc39e 100644
--- a/common/Drawings/Format/DrawingContent.js
+++ b/common/Drawings/Format/DrawingContent.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -789,7 +789,8 @@
var oShape = this.Parent.parent;
var contentPoints = oShape.getSmartArtPointContent();
if (contentPoints && contentPoints.length !== 0) {
- var isPhldr = contentPoints.every(function (point) {
+ var isPhldr = contentPoints.every(function (node) {
+ const point = node.point;
return point && point.prSet && point.prSet.phldr;
});
if (isPhldr) {
diff --git a/common/Drawings/Format/Format.js b/common/Drawings/Format/Format.js
index 8879b8430f..fc182444e9 100644
--- a/common/Drawings/Format/Format.js
+++ b/common/Drawings/Format/Format.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -70,6 +70,7 @@
var CChangesDrawingsContentLong = AscDFH.CChangesDrawingsContentLong;
var CChangesDrawingsContentLongMap = AscDFH.CChangesDrawingsContentLongMap;
var CChangesDrawingsContent = AscDFH.CChangesDrawingsContent;
+ var CChangesDrawingsDouble2 = AscDFH.CChangesDrawingsDouble2;
@@ -714,6 +715,9 @@
drawingContentChanges[AscDFH.historyitem_ThemeRemoveExtraClrScheme] = function (oClass) {
return oClass.extraClrSchemeLst;
};
+ drawingContentChanges[AscDFH.historyitem_CustomPropertiesAddProperty] = function (oClass) {
+ return oClass.properties;
+ };
drawingConstructorsMap[AscDFH.historyitem_ClrMap_SetClr] = CUniColor;
@@ -733,7 +737,7 @@
drawingConstructorsMap[AscDFH.historyitem_CNvPr_SetHlinkClick] = CT_Hyperlink;
drawingConstructorsMap[AscDFH.historyitem_CNvPr_SetHlinkHover] = CT_Hyperlink;
-
+ drawingConstructorsMap[AscDFH.historyitem_CustomPropertiesAddProperty] = CCustomProperty;
AscDFH.changesFactory[AscDFH.historyitem_DefaultShapeDefinition_SetSpPr] = CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_DefaultShapeDefinition_SetBodyPr] = CChangesDrawingsObjectNoId;
@@ -800,6 +804,10 @@
AscDFH.changesFactory[AscDFH.historyitem_HF_SetFtr] = CChangesDrawingsBool;
AscDFH.changesFactory[AscDFH.historyitem_HF_SetHdr] = CChangesDrawingsBool;
AscDFH.changesFactory[AscDFH.historyitem_HF_SetSldNum] = CChangesDrawingsBool;
+ AscDFH.changesFactory[AscDFH.historyitem_CustomPropertiesAddProperty] = CChangesDrawingsContentNoId;
+
+
+
// COLOR -----------------------
/*
@@ -888,7 +896,7 @@
g_oThemeFontsName["minorHAnsi"] = true;
function isRealNumber(n) {
- return typeof n === "number" && !isNaN(n);
+ return typeof n === "number" && !isNaN(n) && isFinite(n);
}
function isRealBool(b) {
@@ -1025,11 +1033,11 @@
}
}
- function ExecuteNoHistory(f, oThis, args) {
+ function ExecuteNoHistory(f, oThis, args, notOffTableId) {
AscCommon.History.TurnOff && AscCommon.History.TurnOff();
var b_table_id = false;
- if (g_oTableId && !g_oTableId.m_bTurnOff) {
+ if (!notOffTableId && g_oTableId && !g_oTableId.m_bTurnOff) {
g_oTableId.m_bTurnOff = true;
b_table_id = true;
}
@@ -1807,7 +1815,22 @@
oMod.name = name;
while (reader.MoveToNextAttribute()) {
if (reader.GetNameNoNS() === "val") {
- oMod.val = reader.GetValueInt();
+ let sVal = reader.GetValue();
+ let nLen = sVal.length;
+ if(typeof sVal === "string" && nLen > 0) {
+ if ((nLen - 1) === sVal.indexOf("%")) {
+ sVal.substring(0, nLen - 1);
+ let dVal = parseFloat(sVal);
+ if (AscFormat.isRealNumber(dVal))
+ oMod.val = dVal * 1000 + 0.5 >> 0;
+ }
+ else {
+ let dVal = parseFloat(sVal);
+ if(AscFormat.isRealNumber(dVal)) {
+ oMod.val = dVal + 0.5 >> 0;
+ }
+ }
+ }
break;
}
}
@@ -2420,7 +2443,7 @@
}
InitClass(CUniColor, CBaseNoIdObject, 0);
- CUniColor.prototype.checkPhColor = function (unicolor, bMergeMods) {
+ CUniColor.prototype.checkPhColor = function (unicolor) {
if (this.color && this.color.type === c_oAscColor.COLOR_TYPE_SCHEME && this.color.id === 14) {
if (unicolor) {
if (unicolor.color) {
@@ -2430,9 +2453,7 @@
if (!this.Mods || this.Mods.Mods.length === 0) {
this.Mods = unicolor.Mods.createDuplicate();
} else {
- if (bMergeMods) {
- this.Mods.Merge(unicolor.Mods);
- }
+ this.Mods.Merge(unicolor.Mods);
}
}
}
@@ -2467,6 +2488,13 @@
}
return null;
};
+ CUniColor.prototype.getTransparency = function () {
+ let nAlphaVal = this.getModValue("alpha");
+ if(nAlphaVal === null) {
+ return 0;
+ }
+ return (100000 - nAlphaVal) / 1000;
+ };
CUniColor.prototype.checkWordMods = function () {
return this.Mods && this.Mods.Mods.length === 1
&& (this.Mods.Mods[0].name === "wordTint" || this.Mods.Mods[0].name === "wordShade");
@@ -3122,24 +3150,60 @@
}
return _ret;
};
+ CBlipFill.prototype.reduceSize = function (nW, nH, nMaxSize) {
+ let dWK = nW / nMaxSize;
+ let dHK = nH / nMaxSize;
+ let dK = Math.max(dWK, dHK);
+ let oResult = {W: nW, H: nH};
+ if (dK > 1) {
+ oResult.W = ((nW / dK) + 0.5 >> 0);
+ oResult.H = ((nH / dK) + 0.5 >> 0);
+ }
+ return oResult;
+ };
CBlipFill.prototype.getBase64Data = function (bReduce, bReturnOrigIfCantDraw) {
- var sRasterImageId = this.RasterImageId;
+ let sRasterImageId = this.RasterImageId;
if (typeof sRasterImageId !== "string" || sRasterImageId.length === 0) {
return null;
}
- var oApi = Asc.editor || editor;
- var sDefaultResult = sRasterImageId;
+ let oApi = Asc.editor || editor;
+ let sDefaultResult = sRasterImageId;
+ const nMaxSize = 640;
if(bReturnOrigIfCantDraw === false) {
sDefaultResult = null;
}
+ if (window["NATIVE_EDITOR_ENJINE"] && window["native"]) {
+ let sSrc = AscCommon.getFullImageSrc2(sRasterImageId);
+ let oImageSize = AscCommon.getSourceImageSize(sSrc);
+ let nW = Math.max(oImageSize.width, 1);
+ let nH = Math.max(oImageSize.height, 1);
+ if (bReduce) {
+ let oReducedSize = this.reduceSize(nW, nH, nMaxSize);
+ nW = oReducedSize.W;
+ nH = oReducedSize.H;
+ }
+ let oCanvas = new AscCommon.CNativeGraphics();
+ oCanvas.width = nW;
+ oCanvas.height = nH;
+ oCanvas.create(window["native"], oCanvas.width, oCanvas.height, oCanvas.width, oCanvas.height);
+ oCanvas.transform(1, 0, 0, 1, 0, 0);
+ oCanvas.drawImage(sSrc, 0, 0, oCanvas.width, oCanvas.height);
+ let sResult;
+ try {
+ sResult = oCanvas.toDataURL("image/png");
+ } catch (err) {
+ sResult = sDefaultResult;
+ }
+ return {img: sResult, w: oCanvas.width, h: oCanvas.height};
+ }
if (!oApi) {
return {img: sDefaultResult, w: null, h: null};
}
- var oImageLoader = oApi.ImageLoader;
+ let oImageLoader = oApi.ImageLoader;
if (!oImageLoader) {
return {img: sDefaultResult, w: null, h: null};
}
- var oImage = oImageLoader.map_image_index[AscCommon.getFullImageSrc2(sRasterImageId)];
+ let oImage = oImageLoader.map_image_index[AscCommon.getFullImageSrc2(sRasterImageId)];
if (!oImage || !oImage.Image || oImage.Status !== AscFonts.ImageLoadStatus.Complete) {
return {img: sDefaultResult, w: null, h: null};
}
@@ -3147,20 +3211,15 @@
if (sRasterImageId.indexOf("data:") === 0 && sRasterImageId.indexOf("base64") > 0) {
return {img: sRasterImageId, w: oImage.Image.width, h: oImage.Image.height};
}
- var sResult = sDefaultResult;
+ let sResult = sDefaultResult;
if (!window["NATIVE_EDITOR_ENJINE"]) {
- var oCanvas = document.createElement("canvas");
- var nW = Math.max(oImage.Image.width, 1);
- var nH = Math.max(oImage.Image.height, 1);
+ let oCanvas = document.createElement("canvas");
+ let nW = Math.max(oImage.Image.width, 1);
+ let nH = Math.max(oImage.Image.height, 1);
if (bReduce) {
- var nMaxSize = 640;
- var dWK = nW / nMaxSize;
- var dHK = nH / nMaxSize;
- var dK = Math.max(dWK, dHK);
- if (dK > 1) {
- nW = ((nW / dK) + 0.5 >> 0);
- nH = ((nH / dK) + 0.5 >> 0);
- }
+ let oReducedSize = this.reduceSize(nW, nH, nMaxSize);
+ nW = oReducedSize.W;
+ nH = oReducedSize.H;
}
oCanvas.width = nW;
oCanvas.height = nH;
@@ -4086,11 +4145,7 @@
if(!this.color) {
return 0;
}
- let nAlphaVal = this.color.getModValue("alpha");
- if(nAlphaVal === null) {
- return 0;
- }
- return (100000 - nAlphaVal) / 1000;
+ return this.color.getTransparency();
};
asc_CShadowProperty.prototype.putTransparency = function(nVal) {
if(!this.color) {
@@ -5090,7 +5145,7 @@
}
}
};
- CUniFill.prototype.checkPhColor = function (unicolor, bMergeMods) {
+ CUniFill.prototype.checkPhColor = function (unicolor) {
if (this.fill) {
switch (this.fill.type) {
case c_oAscFill.FILL_TYPE_BLIP:
@@ -5100,24 +5155,24 @@
}
case c_oAscFill.FILL_TYPE_SOLID: {
if (this.fill.color && this.fill.color) {
- this.fill.color.checkPhColor(unicolor, bMergeMods);
+ this.fill.color.checkPhColor(unicolor);
}
break;
}
case c_oAscFill.FILL_TYPE_GRAD: {
for (var i = 0; i < this.fill.colors.length; ++i) {
if (this.fill.colors[i] && this.fill.colors[i].color) {
- this.fill.colors[i].color.checkPhColor(unicolor, bMergeMods);
+ this.fill.colors[i].color.checkPhColor(unicolor);
}
}
break;
}
case c_oAscFill.FILL_TYPE_PATT: {
if (this.fill.bgClr) {
- this.fill.bgClr.checkPhColor(unicolor, bMergeMods);
+ this.fill.bgClr.checkPhColor(unicolor);
}
if (this.fill.fgClr) {
- this.fill.fgClr.checkPhColor(unicolor, bMergeMods);
+ this.fill.fgClr.checkPhColor(unicolor);
}
break;
}
@@ -6237,39 +6292,42 @@
return;
}
if (ln.Fill != null && ln.Fill.fill != null) {
- this.Fill = ln.Fill.createDuplicate();
+ this.setFill(ln.Fill.createDuplicate());
}
if (ln.prstDash != null) {
- this.prstDash = ln.prstDash;
+ this.setPrstDash(ln.prstDash);
}
if (ln.Join != null) {
- this.Join = ln.Join.createDuplicate();
+ this.setJoin(ln.Join.createDuplicate());
}
if (ln.headEnd != null) {
- this.headEnd = ln.headEnd.createDuplicate();
+ this.setHeadEnd(ln.headEnd.createDuplicate());
}
if (ln.tailEnd != null) {
- this.tailEnd = ln.tailEnd.createDuplicate();
+ this.setTailEnd(ln.tailEnd.createDuplicate());
}
if (ln.algn != null) {
- this.algn = ln.algn;
+ this.setAlgn(ln.algn);
}
if (ln.cap != null) {
- this.cap = ln.cap;
+ this.setCap(ln.cap);
}
if (ln.cmpd != null) {
- this.cmpd = ln.cmpd;
+ this.setCmpd(ln.cmpd);
}
if (ln.w != null) {
- this.w = ln.w;
+ this.setW(ln.w);
+ }
+ else if(ln.isNoFillLine && ln.isNoFillLine()) {
+ this.setW(0);
}
};
CLn.prototype.calculate = function (theme, slide, layout, master, RGBA, colorMap) {
@@ -6844,6 +6902,9 @@
AscCommon.History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_Ph_SetIdx, this.idx, idx));
this.idx = idx;
};
+ Ph.prototype.getIdx = function() {
+ return this.idx;
+ }
Ph.prototype.setOrient = function (orient) {
AscCommon.History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Ph_SetOrient, this.orient, orient));
this.orient = orient;
@@ -6856,6 +6917,9 @@
AscCommon.History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Ph_SetType, this.type, type));
this.type = type;
};
+ Ph.prototype.getType = function() {
+ return this.type;
+ };
function fUpdateLocksValue(nLocks, nMask, bValue) {
nLocks |= nMask;
@@ -7031,6 +7095,7 @@
CBaseNoIdObject.call(this);
this.idx = 0;
this.Color = new CUniColor();
+ this.styleClr = null;
}
InitClass(StyleRef, CBaseNoIdObject, 0);
@@ -7055,6 +7120,9 @@
StyleRef.prototype.setIdx = function (idx) {
this.idx = idx;
};
+ StyleRef.prototype.setStyleClr = function (styleClr) {
+ this.styleClr = styleClr;
+ };
StyleRef.prototype.setColor = function (color) {
this.Color = color;
};
@@ -7148,19 +7216,19 @@
CShapeStyle.prototype.merge = function (style) {
if (style != null) {
if (style.lnRef != null) {
- this.lnRef = style.lnRef.createDuplicate();
+ this.setLnRef(style.lnRef.createDuplicate());
}
if (style.fillRef != null) {
- this.fillRef = style.fillRef.createDuplicate();
+ this.setFillRef(style.fillRef.createDuplicate());
}
if (style.effectRef != null) {
- this.effectRef = style.effectRef.createDuplicate();
+ this.setEffectRef(style.effectRef.createDuplicate());
}
if (style.fontRef != null) {
- this.fontRef = style.fontRef.createDuplicate();
+ this.setFontRef(style.fontRef.createDuplicate());
}
}
};
@@ -7327,46 +7395,46 @@
return;
}
if (xfrm.offX != null) {
- this.offX = xfrm.offX;
+ this.setOffX(xfrm.offX);
}
if (xfrm.offY != null) {
- this.offY = xfrm.offY;
+ this.setOffY(xfrm.offY);
}
if (xfrm.extX != null) {
- this.extX = xfrm.extX;
+ this.setExtX(xfrm.extX);
}
if (xfrm.extY != null) {
- this.extY = xfrm.extY;
+ this.setExtY(xfrm.extY);
}
if (xfrm.chOffX != null) {
- this.chOffX = xfrm.chOffX;
+ this.setChOffX(xfrm.chOffX);
}
if (xfrm.chOffY != null) {
- this.chOffY = xfrm.chOffY;
+ this.setChOffY(xfrm.chOffY);
}
if (xfrm.chExtX != null) {
- this.chExtX = xfrm.chExtX;
+ this.setChExtX(xfrm.chExtX);
}
if (xfrm.chExtY != null) {
- this.chExtY = xfrm.chExtY;
+ this.setChExtY(xfrm.chExtY);
}
if (xfrm.flipH != null) {
- this.flipH = xfrm.flipH;
+ this.setFlipH(xfrm.flipH);
}
if (xfrm.flipV != null) {
- this.flipV = xfrm.flipV;
+ this.setFlipV(xfrm.flipV);
}
if (xfrm.rot != null) {
- this.rot = xfrm.rot;
+ this.setRot(xfrm.rot);
}
};
CXfrm.prototype.createDuplicate = function () {
@@ -7869,6 +7937,25 @@
this.ln.merge(spPr.ln);
} */
};
+ CSpPr.prototype.fullMerge = function (spPr) {
+ if (spPr.xfrm != null) {
+ this.xfrm.merge(spPr.xfrm);
+ }
+ if (spPr.geometry !== null) {
+ this.setGeometry(spPr.geometry.createDuplicate());
+ }
+
+ if (spPr.Fill !== null && spPr.Fill.fill !== null) {
+ this.setFill(spPr.Fill.createDuplicate());
+ }
+
+ if (spPr.ln != null) {
+ if (this.ln == null)
+ this.setLn(new CLn());
+
+ this.ln.merge(spPr.ln);
+ }
+ };
CSpPr.prototype.setParent = function (pr) {
AscCommon.History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_SpPr_SetParent, this.parent, pr));
this.parent = pr;
@@ -8557,14 +8644,14 @@
if (!ret)
return null;
var ret2 = ret.createDuplicate();
- ret2.checkPhColor(unicolor, false);
+ ret2.checkPhColor(unicolor);
return ret2;
} else if (number >= 1001) {
var ret = this.bgFillStyleLst[number - 1001];
if (!ret)
return null;
var ret2 = ret.createDuplicate();
- ret2.checkPhColor(unicolor, false);
+ ret2.checkPhColor(unicolor);
return ret2;
}
return null;
@@ -8746,7 +8833,7 @@
if (this.themeElements.fmtScheme.fillStyleLst[idx - 1]) {
ret = this.themeElements.fmtScheme.fillStyleLst[idx - 1].createDuplicate();
if (ret) {
- ret.checkPhColor(unicolor, false);
+ ret.checkPhColor(unicolor);
return ret;
}
}
@@ -8754,7 +8841,7 @@
if (this.themeElements.fmtScheme.bgFillStyleLst[idx - 1001]) {
ret = this.themeElements.fmtScheme.bgFillStyleLst[idx - 1001].createDuplicate();
if (ret) {
- ret.checkPhColor(unicolor, false);
+ ret.checkPhColor(unicolor);
return ret;
}
}
@@ -8768,7 +8855,7 @@
if (this.themeElements.fmtScheme.lnStyleLst[idx - 1]) {
var ret = this.themeElements.fmtScheme.lnStyleLst[idx - 1].createDuplicate();
if (ret.Fill) {
- ret.Fill.checkPhColor(unicolor, false);
+ ret.Fill.checkPhColor(unicolor);
}
return ret;
}
@@ -9039,6 +9126,52 @@
AscCommon.History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_HF_SetSldNum, this.sldNum, pr));
this.sldNum = pr;
};
+ HF.prototype.applySettings = function (oSettings) {
+ if(!oSettings) return;
+ if (oSettings.get_ShowSlideNum()) {
+ if (this.sldNum !== null) {
+ this.setSldNum(null);
+ }
+ }
+ else {
+ if (this.sldNum !== false) {
+ this.setSldNum(false);
+ }
+ }
+
+ if (oSettings.get_ShowFooter()) {
+ if (this.ftr !== null) {
+ this.setFtr(null);
+ }
+ }
+ else {
+ if (this.ftr !== false) {
+ this.setFtr(false);
+ }
+ }
+
+ if (oSettings.get_ShowHeader()) {
+ if (this.hdr !== null) {
+ this.setHdr(null);
+ }
+ }
+ else {
+ if (this.hdr !== false) {
+ this.setHdr(false);
+ }
+ }
+
+ if (oSettings.get_ShowDateTime()) {
+ if (this.dt !== null) {
+ this.setDt(null);
+ }
+ }
+ else {
+ if (this.dt !== false) {
+ this.setDt(false);
+ }
+ }
+ };
function CBgPr() {
CBaseNoIdObject.call(this)
@@ -9200,8 +9333,15 @@
}
});
};
- CSld.prototype.refreshAllContentsFields = function() {
+ CSld.prototype.refreshAllContentsFields = function(bNoHistory) {
+ let bOldUpdate = AscCommon.History.RecalculateData.Update;
+ if(bNoHistory) {
+ AscCommon.History.RecalculateData.Update = false;
+ }
this.handleAllContents(RefreshContentAllFields);
+ if(bNoHistory) {
+ AscCommon.History.RecalculateData.Update = bOldUpdate;
+ }
};
function RefreshContentAllFields(oContent) {
@@ -10558,6 +10698,12 @@
CBullet.prototype.isBullet = function () {
return this.bulletType != null && this.bulletType.type != null;
};
+ CBullet.prototype.isNone = function() {
+ if (!this.bulletType)
+ return true;
+
+ return this.bulletType.type === AscFormat.BULLET_TYPE_TYPEFACE_NONE;
+ };
CBullet.prototype.getPresentationBullet = function (theme, color) {
var para_pr = new CParaPr();
para_pr.Bullet = this;
@@ -10796,12 +10942,12 @@
return;
}
var _this = this;
- AscCommon.ShowImageFileDialog(Api.documentId, Api.documentUserId, Api.CoAuthoringApi.get_jwt(), Api.documentShardKey, Api.documentWopiSrc, function (error, files) {
+ AscCommon.ShowImageFileDialog(Api.documentId, Api.documentUserId, Api.CoAuthoringApi.get_jwt(), Api.documentShardKey, Api.documentWopiSrc, Api.documentUserSessionId, function (error, files) {
if (Asc.c_oAscError.ID.No !== error) {
Api.sendEvent("asc_onError", error, Asc.c_oAscError.Level.NoCritical);
} else {
Api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.UploadImage);
- AscCommon.UploadImageFiles(files, Api.documentId, Api.documentUserId, Api.CoAuthoringApi.get_jwt(), Api.documentShardKey, Api.documentWopiSrc, function (error, urls) {
+ AscCommon.UploadImageFiles(files, Api.documentId, Api.documentUserId, Api.CoAuthoringApi.get_jwt(), Api.documentShardKey, Api.documentWopiSrc, Api.documentUserSessionId, function (error, urls) {
if (Asc.c_oAscError.ID.No !== error) {
Api.sendEvent("asc_onError", error, Asc.c_oAscError.Level.NoCritical);
Api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.UploadImage);
@@ -11465,7 +11611,78 @@
}
}
};
+ TextListStyle.prototype.applyParaPr = function (nLvl, ParaPr, bIncreaseFontSize, oSp) {
+ let iN = AscFormat.isRealNumber;
+ if(bIncreaseFontSize === true || bIncreaseFontSize === false) {
+ if(!this.levels[nLvl]) {
+ this.levels[nLvl] = new AscWord.CParaPr();
+ }
+ let oLvl = this.levels[nLvl];
+ if(oLvl) {
+ if(!oLvl.DefaultRunPr) {
+ oLvl.DefaultRunPr = new AscWord.CTextPr();
+ }
+ let TextPr = oLvl.DefaultRunPr;
+ let Pr;
+ if(iN(TextPr.FontSize)) {
+ TextPr.FontSize = TextPr.GetIncDecFontSize(bIncreaseFontSize)
+ }
+ else {
+ let oSpStyles = oSp.Get_Styles(nLvl);
+ let Styles = oSpStyles.styles;
+ Pr = Styles.Get_Pr(oSpStyles.lastId, styletype_Paragraph, null);
+ TextPr.FontSize = Pr.TextPr.GetIncDecFontSize(bIncreaseFontSize)
+ }
+ if(iN(TextPr.FontSizeCS)) {
+ TextPr.FontSizeCS = TextPr.GetIncDecFontSizeCS(bIncreaseFontSize)
+ }
+
+ else {
+ if(!Pr) {
+ let oSpStyles = oSp.Get_Styles(nLvl);
+ let Styles = oSpStyles.styles;
+ Pr = Styles.Get_Pr(oSpStyles.lastId, styletype_Paragraph, null);
+ }
+ TextPr.FontSize = Pr.TextPr.GetIncDecFontSize(bIncreaseFontSize)
+ }
+ }
+ return;
+ }
+ if(!ParaPr) {
+ this.levels[nLvl] = null;
+ return;
+ }
+ if(!this.levels[nLvl]) {
+ this.levels[nLvl] = new AscWord.CParaPr();
+ }
+ let oLvl = this.levels[nLvl];
+ oLvl.Merge(ParaPr);
+ if(!oLvl.DefaultRunPr) {
+ oLvl.DefaultRunPr = new AscWord.CTextPr();
+ }
+
+ if(ParaPr.DefaultRunPr) {
+ let TextPr = ParaPr.DefaultRunPr;
+ if (TextPr.FontFamily) {
+ let FName = TextPr.FontFamily.Name;
+ let FIndex = TextPr.FontFamily.Index;
+ TextPr.RFonts = new CRFonts();
+ TextPr.RFonts.SetAll(FName, FIndex);
+ }
+ oLvl.DefaultRunPr.Apply(ParaPr.DefaultRunPr);
+ }
+ };
+ TextListStyle.prototype.changeFontSize = function (nLvl, bIncrease) {
+ if(!this.levels[nLvl]) {
+ this.levels[nLvl] = new AscWord.CParaPr();
+ }
+ let oLvl = this.levels[nLvl];
+ if(oLvl.DefaultRunPr) {
+ oLvl.DefaultRunPr = new AscWord.CTextPr();
+ }
+
+ };
function CBaseAttrObject() {
CBaseNoIdObject.call(this);
@@ -12706,11 +12923,12 @@
prot["asc_getPages"] = prot.asc_getPages;
function CCustomProperties() {
- CBaseNoIdObject.call(this);
+ CBaseObject.call(this);
this.properties = [];
+ this.Lock = new AscCommon.CLock();
}
- InitClass(CCustomProperties, CBaseNoIdObject, 0);
+ InitClass(CCustomProperties, CBaseObject, AscDFH.historyitem_type_CustomProperties);
CCustomProperties.prototype.fromStream = function (s) {
var _type = s.GetUChar();
var _len = s.GetULong();
@@ -12768,19 +12986,68 @@
});
};
CCustomProperties.prototype.add = function (name, variant, opt_linkTarget) {
+ this.addProperty(this.properties.length, this.createPropertyWithVariant(name, variant, opt_linkTarget));
+ };
+ CCustomProperties.prototype.createPropertyWithVariant = function (name, variant, opt_linkTarget) {
var newProperty = new CCustomProperty();
newProperty.fmtid = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}";
newProperty.pid = null;
newProperty.name = name;
newProperty.linkTarget = opt_linkTarget || null;
newProperty.content = variant;
- this.properties.push(newProperty);
+ return newProperty;
+ };
+ CCustomProperties.prototype.createProperty = function (name, type, value, opt_linkTarget) {
+ let oVariant = new CVariant();
+ oVariant.setType(type);
+ oVariant.setValue(value);
+ return this.createPropertyWithVariant(name, oVariant, opt_linkTarget);
+ };
+ CCustomProperties.prototype.getAllProperties = function () {
+ return [].concat(this.properties);
+ };
+ CCustomProperties.prototype.addProperty = function (idx, pr) {
+ let nInsertIdx = Math.min(this.properties.length, Math.max(0, idx));
+ AscCommon.History.Add(new CChangesDrawingsContentNoId(this, AscDFH.historyitem_CustomPropertiesAddProperty, nInsertIdx, [pr], true));
+ this.properties.splice(nInsertIdx, 0, pr);
+ };
+ CCustomProperties.prototype.removeProperty = function (idx) {
+ if(idx < 0 || idx >= this.properties.length)
+ return;
+ let aDeleteElems = this.properties.splice(idx, 1);
+ AscCommon.History.Add(new CChangesDrawingsContentNoId(this, AscDFH.historyitem_CustomPropertiesAddProperty, idx, aDeleteElems, false));
+ };
+ CCustomProperties.prototype.modifyProperty = function (idx, pr) {
+ if(idx < 0 || idx >= this.properties.length)
+ return;
+ this.removeProperty(idx);
+ this.addProperty(idx, pr);
+ };
+ CCustomProperties.prototype.AddProperty = function (name, type, value) {
+ for(let nIdx = 0; nIdx < this.properties.length; ++nIdx) {
+ let oPr = this.properties[nIdx];
+ if(oPr.name === name) {
+ this.ModifyProperty(nIdx, name, type, value);
+ return;
+ }
+ }
+ this.addProperty(this.properties.length, this.createProperty(name, type, value, null));
+ };
+ CCustomProperties.prototype.ModifyProperty = function (idx, name, type, value) {
+ this.modifyProperty(idx, this.createProperty(name, type, value, null));
+ };
+ CCustomProperties.prototype.RemoveProperty = function (idx) {
+ return this.removeProperty(idx);
+ };
+ CCustomProperties.prototype.hasProperties = function () {
+ return this.properties.length > 0;
};
window['AscCommon'].CCustomProperties = CCustomProperties;
prot = CCustomProperties.prototype;
prot["add"] = prot.add;
+
function CCustomProperty() {
CBaseNoIdObject.call(this);
this.fmtid = null;
@@ -12858,7 +13125,43 @@
s.WriteRecord4(0, this.content);
};
-
+ CCustomProperty.prototype.setContent = function (v) {
+ this.content = v;
+ };
+ CCustomProperty.prototype.asc_getName = function() {
+ return this.name;
+ };
+ CCustomProperty.prototype.asc_getType = function() {
+ if(this.content) {
+ return this.content.getVariantType();
+ }
+ return c_oVariantTypes.vtEmpty;
+ };
+ CCustomProperty.prototype.asc_getValue = function() {
+ if(this.content) {
+ return this.content.getValue();
+ }
+ return null;
+ };
+ CCustomProperty.prototype.Write_ToBinary = function(w) {
+ let oStream = AscCommon.pptx_content_writer.BinaryFileWriter;
+ var old = new AscCommon.CMemory(true);
+ oStream.ExportToMemory(old);
+ oStream.ImportFromMemory(w);
+ oStream.WriteRecord4(0, this);
+ oStream.ExportToMemory(w);
+ oStream.ImportFromMemory(old);
+ };
+ CCustomProperty.prototype.Read_FromBinary = function(r) {
+ let fileStream = r.ToFileStream();
+ fileStream.GetUChar();
+ this.fromStream(fileStream);
+ r.FromFileStream(fileStream);
+ };
+
+ CCustomProperty.prototype["asc_getName"] = CCustomProperty.prototype.asc_getName;
+ CCustomProperty.prototype["asc_getType"] = CCustomProperty.prototype.asc_getType;
+ CCustomProperty.prototype["asc_getValue"] = CCustomProperty.prototype.asc_getValue;
function CVariantVector() {
CBaseNoIdObject.call(this);
@@ -13077,7 +13380,6 @@
};
function CVariant(parent) {
- CBaseNoIdObject.call(this);
this.type = null;
this.strContent = null;
this.iContent = null;
@@ -13088,11 +13390,8 @@
this.vector = null;
this.array = null;
this.vStream = null;
-
this.parent = parent;
}
-
- InitClass(CVariant, CBaseNoIdObject, 0);
CVariant.prototype.fromStream = function (s) {
var _type;
var _len = s.GetULong();
@@ -13187,21 +13486,54 @@
s.WriteRecord4(7, this.array);
s.WriteRecord4(8, this.vStream);
};
+ CVariant.prototype.setParent = function(pr) {
+ this.parent = pr;
+ };
+ CVariant.prototype.setType = function(pr) {
+ this.type = pr;
+ };
+ CVariant.prototype.setStrContent = function(pr) {
+ this.strContent = pr;
+ };
+ CVariant.prototype.setIContent = function(pr) {
+ this.iContent = pr;
+ };
+ CVariant.prototype.setUContent = function(pr) {
+ this.uContent = pr;
+ };
+ CVariant.prototype.setDContent = function(pr) {
+ this.dContent = pr;
+ };
+ CVariant.prototype.setBContent = function(pr) {
+ this.bContent = pr;
+ };
+ CVariant.prototype.setVariant = function(pr) {
+ this.variant = pr;
+ };
+ CVariant.prototype.setVector = function(pr) {
+ this.vector = pr;
+ };
+ CVariant.prototype.setArray = function(pr) {
+ this.array = pr;
+ };
+ CVariant.prototype.setVStream = function(pr) {
+ this.vStream = pr;
+ };
CVariant.prototype.setText = function (val) {
- this.type = c_oVariantTypes.vtLpwstr;
- this.strContent = val;
+ this.setType(c_oVariantTypes.vtLpwstr);
+ this.setStrContent(val);
};
CVariant.prototype.setNumber = function (val) {
- this.type = c_oVariantTypes.vtI4;
- this.iContent = val;
+ this.setType(c_oVariantTypes.vtI4);
+ this.setIContent(val);
};
CVariant.prototype.setDate = function (val) {
- this.type = c_oVariantTypes.vtFiletime;
- this.strContent = val.toISOString().slice(0, 19) + 'Z';
+ this.setDate(c_oVariantTypes.vtFiletime);
+ this.setStrContent(val.toISOString().slice(0, 19) + 'Z');
};
CVariant.prototype.setBool = function (val) {
- this.type = c_oVariantTypes.vtBool;
- this.bContent = val;
+ this.setType(c_oVariantTypes.vtBool);
+ this.setBContent(val);
};
CVariant.prototype.typeStrToEnum = function (name) {
switch (name) {
@@ -13414,6 +13746,116 @@
CVariant.prototype.getVariantType = function () {
return AscFormat.isRealNumber(this.type) ? this.type : c_oVariantTypes.vtEmpty;
};
+ CVariant.prototype.getValue = function () {
+ switch (this.type) {
+ case c_oVariantTypes.vtClsid:
+ case c_oVariantTypes.vtOStorage:
+ case c_oVariantTypes.vtStorage:
+ case c_oVariantTypes.vtOStream:
+ case c_oVariantTypes.vtStream:
+ case c_oVariantTypes.vtError:
+ case c_oVariantTypes.vtCy:
+ case c_oVariantTypes.vtBstr:
+ case c_oVariantTypes.vtDecimal:
+ case c_oVariantTypes.vtEmpty:
+ case c_oVariantTypes.vtVariant:
+ case c_oVariantTypes.vtVector:
+ case c_oVariantTypes.vtArray:
+ case c_oVariantTypes.vtVStream:
+ case c_oVariantTypes.vtBlob:
+ case c_oVariantTypes.vtOBlob:
+ case c_oVariantTypes.vtNull: {
+ return null;
+ }
+ case c_oVariantTypes.vtI2:
+ case c_oVariantTypes.vtI4:
+ case c_oVariantTypes.vtI8:
+ case c_oVariantTypes.vtInt:
+ case c_oVariantTypes.vtI1: {
+ return this.iContent;
+ }
+ case c_oVariantTypes.vtUint:
+ case c_oVariantTypes.vtUi8:
+ case c_oVariantTypes.vtUi4:
+ case c_oVariantTypes.vtUi2:
+ case c_oVariantTypes.vtUi1: {
+ return this.uContent;
+ }
+ case c_oVariantTypes.vtR8:
+ case c_oVariantTypes.vtR4: {
+ return this.dContent;
+ }
+ case c_oVariantTypes.vtLpwstr:
+ case c_oVariantTypes.vtLpstr: {
+ return this.strContent;
+ }
+ case c_oVariantTypes.vtDate:
+ case c_oVariantTypes.vtFiletime: {
+ return new Date(this.strContent);
+ }
+ case c_oVariantTypes.vtBool: {
+ return this.bContent;
+ }
+ }
+ };
+ CVariant.prototype.setValue = function(v) {
+ switch (this.type) {
+ case c_oVariantTypes.vtClsid:
+ case c_oVariantTypes.vtOStorage:
+ case c_oVariantTypes.vtStorage:
+ case c_oVariantTypes.vtOStream:
+ case c_oVariantTypes.vtStream:
+ case c_oVariantTypes.vtError:
+ case c_oVariantTypes.vtCy:
+ case c_oVariantTypes.vtBstr:
+ case c_oVariantTypes.vtDecimal:
+ case c_oVariantTypes.vtEmpty:
+ case c_oVariantTypes.vtVariant:
+ case c_oVariantTypes.vtVector:
+ case c_oVariantTypes.vtArray:
+ case c_oVariantTypes.vtVStream:
+ case c_oVariantTypes.vtBlob:
+ case c_oVariantTypes.vtOBlob:
+ case c_oVariantTypes.vtNull: {
+ break;
+ }
+ case c_oVariantTypes.vtI2:
+ case c_oVariantTypes.vtI4:
+ case c_oVariantTypes.vtI8:
+ case c_oVariantTypes.vtInt:
+ case c_oVariantTypes.vtI1: {
+ this.setIContent(v);
+ break;
+ }
+ case c_oVariantTypes.vtUint:
+ case c_oVariantTypes.vtUi8:
+ case c_oVariantTypes.vtUi4:
+ case c_oVariantTypes.vtUi2:
+ case c_oVariantTypes.vtUi1: {
+ this.setUContent(v);
+ break;
+ }
+ case c_oVariantTypes.vtR8:
+ case c_oVariantTypes.vtR4: {
+ this.setDContent(v);
+ break;
+ }
+ case c_oVariantTypes.vtLpwstr:
+ case c_oVariantTypes.vtLpstr: {
+ this.setStrContent(v);
+ break;
+ }
+ case c_oVariantTypes.vtDate:
+ case c_oVariantTypes.vtFiletime: {
+ this.setStrContent(v.toISOString().slice(0, 19) + 'Z');
+ break;
+ }
+ case c_oVariantTypes.vtBool: {
+ this.setBContent(v);
+ break;
+ }
+ }
+ };
window['AscCommon'].CVariant = CVariant;
prot = CVariant.prototype;
@@ -13461,7 +13903,41 @@
};
window['AscCommon'].c_oVariantTypes = c_oVariantTypes;
-
+ window['AscCommon']["c_oVariantTypes"] = c_oVariantTypes;
+ c_oVariantTypes["vtEmpty"] = c_oVariantTypes.vtEmpty;
+ c_oVariantTypes["vtNull"] = c_oVariantTypes.vtNull;
+ c_oVariantTypes["vtVariant"] = c_oVariantTypes.vtVariant;
+ c_oVariantTypes["vtVector"] = c_oVariantTypes.vtVector;
+ c_oVariantTypes["vtArray"] = c_oVariantTypes.vtArray;
+ c_oVariantTypes["vtVStream"] = c_oVariantTypes.vtVStream;
+ c_oVariantTypes["vtBlob"] = c_oVariantTypes.vtBlob;
+ c_oVariantTypes["vtOBlob"] = c_oVariantTypes.vtOBlob;
+ c_oVariantTypes["vtI1"] = c_oVariantTypes.vtI1;
+ c_oVariantTypes["vtI2"] = c_oVariantTypes.vtI2;
+ c_oVariantTypes["vtI4"] = c_oVariantTypes.vtI4;
+ c_oVariantTypes["vtI8"] = c_oVariantTypes.vtI8;
+ c_oVariantTypes["vtInt"] = c_oVariantTypes.vtInt;
+ c_oVariantTypes["vtUi1"] = c_oVariantTypes.vtUi1;
+ c_oVariantTypes["vtUi2"] = c_oVariantTypes.vtUi2;
+ c_oVariantTypes["vtUi4"] = c_oVariantTypes.vtUi4;
+ c_oVariantTypes["vtUi8"] = c_oVariantTypes.vtUi8;
+ c_oVariantTypes["vtUint"] = c_oVariantTypes.vtUint;
+ c_oVariantTypes["vtR4"] = c_oVariantTypes.vtR4;
+ c_oVariantTypes["vtR8"] = c_oVariantTypes.vtR8;
+ c_oVariantTypes["vtDecimal"] = c_oVariantTypes.vtDecimal;
+ c_oVariantTypes["vtLpstr"] = c_oVariantTypes.vtLpstr;
+ c_oVariantTypes["vtLpwstr"] = c_oVariantTypes.vtLpwstr;
+ c_oVariantTypes["vtBstr"] = c_oVariantTypes.vtBstr;
+ c_oVariantTypes["vtDate"] = c_oVariantTypes.vtDate;
+ c_oVariantTypes["vtFiletime"] = c_oVariantTypes.vtFiletime;
+ c_oVariantTypes["vtBool"] = c_oVariantTypes.vtBool;
+ c_oVariantTypes["vtCy"] = c_oVariantTypes.vtCy;
+ c_oVariantTypes["vtError"] = c_oVariantTypes.vtError;
+ c_oVariantTypes["vtStream"] = c_oVariantTypes.vtStream;
+ c_oVariantTypes["vtOStream"] = c_oVariantTypes.vtOStream;
+ c_oVariantTypes["vtStorage"] = c_oVariantTypes.vtStorage;
+ c_oVariantTypes["vtOStorage"] = c_oVariantTypes.vtOStorage;
+ c_oVariantTypes["vtClsid"] = c_oVariantTypes.vtClsid;
function CPres() {
CBaseNoIdObject.call(this);
@@ -13765,10 +14241,12 @@
let oColor = new CUniColor();
oColor.color = new CSchemeColor();
oColor.color.id = id;
- for(let nMod = 0; nMod < aMods.length; ++nMod) {
- let oModObject = aMods[nMod];
- let oMod = new CColorMod(oModObject.name, oModObject.val);
- oColor.addColorMod(oMod);
+ if (aMods) {
+ for(let nMod = 0; nMod < aMods.length; ++nMod) {
+ let oModObject = aMods[nMod];
+ let oMod = new CColorMod(oModObject.name, oModObject.val);
+ oColor.addColorMod(oMod);
+ }
}
return oColor;
}
@@ -14827,18 +15305,29 @@
case "areaStackedPercent": {
return Asc.c_oAscChartTypeSettings.areaStackedPer;
}
+ case "comboBarLine": {
+ return Asc.c_oAscChartTypeSettings.comboBarLine;
+ }
+ case "comboBarLineSecondary": {
+ return Asc.c_oAscChartTypeSettings.comboBarLineSecondary;
+ }
+ case "comboCustom": {
+ return Asc.c_oAscChartTypeSettings.comboCustom;
+ }
}
return null;
}
+
+
function builder_CreateChart(nW, nH, sType, aCatNames, aSeriesNames, aSeries, nStyleIndex, aNumFormats) {
- var settings = new Asc.asc_ChartSettings();
+ let settings = new Asc.asc_ChartSettings();
settings.type = ChartBuilderTypeToInternal(sType);
- var aAscSeries = [];
- var aAlphaBet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
- var oCat, i;
+ let aAscSeries = [];
+ let aAlphaBet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
+ let oCat, i;
if (aCatNames.length > 0) {
- var aNumCache = [];
+ let aNumCache = [];
for (i = 0; i < aCatNames.length; ++i) {
aNumCache.push({val: aCatNames[i] + ""});
}
@@ -14848,10 +15337,10 @@
};
}
for (i = 0; i < aSeries.length; ++i) {
- var oAscSeries = new AscFormat.asc_CChartSeria();
+ let oAscSeries = new AscFormat.asc_CChartSeria();
oAscSeries.Val.NumCache = [];
- var aData = aSeries[i];
- var sEndLiter = AscFormat.CalcLiterByLength(aAlphaBet, aData.length);
+ let aData = aSeries[i];
+ let sEndLiter = AscFormat.CalcLiterByLength(aAlphaBet, aData.length);
oAscSeries.Val.Formula = 'Sheet1!' + '$B$' + (i + 2) + ':$' + sEndLiter + '$' + (i + 2);
if (aSeriesNames[i]) {
oAscSeries.TxCache.Formula = 'Sheet1!' + '$A$' + (i + 2);
@@ -14869,7 +15358,7 @@
if (Array.isArray(aNumFormats) && typeof (aNumFormats[i]) === "string")
oAscSeries.FormatCode = aNumFormats[i];
- for (var j = 0; j < aData.length; ++j) {
+ for (let j = 0; j < aData.length; ++j) {
oAscSeries.Val.NumCache.push({
numFormatStr: oAscSeries.FormatCode !== "" ? null : "General",
isDateTimeFormat: false,
@@ -14880,7 +15369,7 @@
aAscSeries.push(oAscSeries);
}
- var oChartSpace = AscFormat.DrawingObjectsController.prototype._getChartSpace(aAscSeries, settings, true);
+ let oChartSpace = AscFormat.DrawingObjectsController.prototype._getChartSpace(aAscSeries, settings, true);
if (!oChartSpace) {
return null;
}
@@ -18226,6 +18715,7 @@
window['AscFormat'].fRGBAToHexString = fRGBAToHexString;
window['AscFormat'].RefreshContentAllFields = RefreshContentAllFields;
window['AscFormat'].IsEqualObjects = IsEqualObjects;
+ window['AscFormat'].CreateSchemeUnicolorWithMods = CreateSchemeUnicolorWithMods;
window['AscFormat'].szPh_full = szPh_full;
window['AscFormat'].szPh_half = szPh_half;
window['AscFormat'].szPh_quarter = szPh_quarter;
diff --git a/common/Drawings/Format/Geometry.js b/common/Drawings/Format/Geometry.js
index 183d21447a..bbfece13cb 100644
--- a/common/Drawings/Format/Geometry.js
+++ b/common/Drawings/Format/Geometry.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Format/GraphicFrame.js b/common/Drawings/Format/GraphicFrame.js
index f3b1fe45d7..538b0a9aa2 100644
--- a/common/Drawings/Format/GraphicFrame.js
+++ b/common/Drawings/Format/GraphicFrame.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -39,8 +39,7 @@
var HitInLine = AscFormat.HitInLine;
var isRealObject = AscCommon.isRealObject;
- var History = AscCommon.History;
-
+
window['AscDFH'].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSpPr] = function (oClass, value) {
oClass.spPr = value;
@@ -237,7 +236,7 @@
};
CGraphicFrame.prototype.setSpPr = function (spPr) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSpPr, this.spPr, spPr));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSpPr, this.spPr, spPr));
this.spPr = spPr;
if (spPr) {
spPr.setParent(this);
@@ -245,7 +244,7 @@
};
CGraphicFrame.prototype.setGraphicObject = function (graphicObject) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetGraphicObject, this.graphicObject, graphicObject));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetGraphicObject, this.graphicObject, graphicObject));
this.graphicObject = graphicObject;
if (this.graphicObject) {
this.graphicObject.Index = 0;
@@ -254,17 +253,17 @@
};
CGraphicFrame.prototype.setNvSpPr = function (pr) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSetNvSpPr, this.nvGraphicFramePr, pr));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSetNvSpPr, this.nvGraphicFramePr, pr));
this.nvGraphicFramePr = pr;
};
CGraphicFrame.prototype.setParent = function (parent) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSetParent, this.parent, parent));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSetParent, this.parent, parent));
this.parent = parent;
};
CGraphicFrame.prototype.setGroup = function (group) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSetGroup, this.group, group));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetSetGroup, this.group, group));
this.group = group;
};
@@ -959,7 +958,20 @@
}
return this.compiledStyles[level];
} else {
- return editor.WordControl.m_oLogicDocument.globalTableStyles;
+ let oLogicDoc;
+ if(Asc.editor.private_GetLogicDocument) {
+ oLogicDoc = Asc.editor.private_GetLogicDocument();
+ }
+ if(oLogicDoc) {
+
+ if(oLogicDoc.globalTableStyles) {
+ return oLogicDoc.globalTableStyles;
+ }
+ if(oLogicDoc.Get_Styles) {
+ return oLogicDoc.Get_Styles(level);
+ }
+ }
+ return this.Get_Styles(0);
}
};
@@ -1189,7 +1201,11 @@
Graphic.GraphicData = new AscFormat.CT_GraphicalObjectData();
let nDrawingType = oDrawing.getObjectType();
if (nDrawingType === AscDFH.historyitem_type_ChartSpace) {
- Graphic.GraphicData.Uri = "http://schemas.openxmlformats.org/drawingml/2006/chart";
+ if (oDrawing.isChartEx()) {
+ Graphic.GraphicData.Uri = "http://schemas.microsoft.com/office/drawing/2014/chartex";
+ } else {
+ Graphic.GraphicData.Uri = "http://schemas.openxmlformats.org/drawingml/2006/chart";
+ }
} else if (nDrawingType === AscDFH.historyitem_type_SlicerView) {
Graphic.GraphicData.Uri = "http://schemas.microsoft.com/office/drawing/2010/slicer";
} else if (nDrawingType === AscDFH.historyitem_type_TimelineSlicerView) {
diff --git a/common/Drawings/Format/GraphicObjectBase.js b/common/Drawings/Format/GraphicObjectBase.js
index 6e6afdf3af..29694de2e2 100644
--- a/common/Drawings/Format/GraphicObjectBase.js
+++ b/common/Drawings/Format/GraphicObjectBase.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -55,6 +55,7 @@
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBaseExt] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetClientData] = AscDFH.CChangesDrawingsObjectNoId;
+ AscDFH.changesFactory[AscDFH.historyitem_ShapeSetUseBgFill] = AscDFH.CChangesDrawingsBool;
var drawingsChangesMap = window['AscDFH'].drawingsChangesMap;
@@ -133,6 +134,9 @@
drawingsChangesMap[AscDFH.historyitem_ShapeSetClientData] = function (oClass, value) {
oClass.clientData = value;
};
+ drawingsChangesMap[AscDFH.historyitem_ShapeSetUseBgFill] = function (oClass, value) {
+ oClass.useBgFill = value;
+ };
drawingsChangesMap[AscDFH.historyitem_ShapeSetMacro] = function (oClass, value) {
@@ -750,19 +754,19 @@
}
};
CGraphicObjectBase.prototype.setMacro = function (sMacroName) {
- History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetMacro, this.macro, sMacroName));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetMacro, this.macro, sMacroName));
this.macro = sMacroName;
};
CGraphicObjectBase.prototype.setModelId = function (sModelId) {
- History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetModelId, this.modelId, sModelId));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetModelId, this.modelId, sModelId));
this.modelId = sModelId;
};
CGraphicObjectBase.prototype.setFLocksText = function (bLock) {
- History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_ShapeSetFLocksText, this.fLocksText, bLock));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_ShapeSetFLocksText, this.fLocksText, bLock));
this.fLocksText = bLock;
};
CGraphicObjectBase.prototype.setClientData = function (oClientData) {
- History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_ShapeSetClientData, this.clientData, oClientData));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_ShapeSetClientData, this.clientData, oClientData));
this.clientData = oClientData;
};
CGraphicObjectBase.prototype.checkClientData = function () {
@@ -847,7 +851,7 @@
}
};
CGraphicObjectBase.prototype.setTextLink = function (sLink) {
- History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetTextLink, this.textLink, sLink));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetTextLink, this.textLink, sLink));
this.textLink = sLink;
};
CGraphicObjectBase.prototype.hasMacro = function () {
@@ -970,6 +974,12 @@
}
return this.getNoRot() === false;
};
+ CGraphicObjectBase.prototype.canResize = function () {
+ if (!this.canEdit()) {
+ return false;
+ }
+ return this.getNoResize() === false;
+ };
CGraphicObjectBase.prototype.canSelect = function () {
return this.getNoSelect() === false;
};
@@ -1099,8 +1109,16 @@
oSpPr.setGeometry(geometry.createDuplicate());
}
let oShadowFill;
+ let nTransparency = null;
if (outerShdw.color) {
oShadowFill = AscFormat.CreateUniFillByUniColorCopy(outerShdw.color);
+ nTransparency = outerShdw.color.getTransparency();
+ if(nTransparency === 0) {
+ oShadowFill.transparent = null;
+ }
+ else {
+ oShadowFill.transparent = 255 - 255 * nTransparency / 100
+ }
} else {
oShadowFill = AscFormat.CreateUniFillByUniColor(AscFormat.CreateUniColorRGB(0, 0, 0));
}
@@ -1164,6 +1182,12 @@
CGraphicObjectBase.prototype.clearLang = function () {
};
+ CGraphicObjectBase.prototype.editTxStyleLst = function (ParaPr, bSelect) {
+ };
+ CGraphicObjectBase.prototype.checkEditTextStyle = function (fDocContentMethod, params) {
+ return false;
+ };
+
CGraphicObjectBase.prototype.isObjectInSmartArt = function () {
if (this.group && this.group.isSmartArtObject()) {
return true;
@@ -1173,7 +1197,7 @@
};
CGraphicObjectBase.prototype.isGroupObject = function () {
var nType = this.getObjectType();
- return nType === AscDFH.historyitem_type_GroupShape || nType === AscDFH.historyitem_type_LockedCanvas || this.isSmartArtObject();
+ return nType === AscDFH.historyitem_type_GroupShape || nType === AscDFH.historyitem_type_LockedCanvas || this.isSmartArtObject() || nType === AscDFH.historyitem_type_Pdf_Annot_FreeText;
};
CGraphicObjectBase.prototype.isSmartArtObject = function () {
var nType = this.getObjectType();
@@ -1242,9 +1266,8 @@
oTransform.ty += this.shdwSp.extY;
}
global_MatrixTransformer.MultiplyAppend(oTransform, this.transform);
- this.shdwSp.bounds.x = this.bounds.x + this.shdwSp.bounds.l;
- this.shdwSp.bounds.y = this.bounds.y + this.shdwSp.bounds.t;
this.shdwSp.transform = oTransform;
+ this.shdwSp.recalculateBounds();
this.shdwSp.draw(graphics);
}
};
@@ -1282,6 +1305,9 @@
CGraphicObjectBase.prototype.checkTypeCorrect = function () {
return true;
};
+ CGraphicObjectBase.prototype.isSupported = function () {
+ return true;
+ };
CGraphicObjectBase.prototype.handleUpdateExtents = function (bExtX) {
};
CGraphicObjectBase.prototype.handleUpdatePosition = function () {
@@ -1299,21 +1325,21 @@
};
CGraphicObjectBase.prototype.setDrawingBaseType = function (nType) {
if (this.drawingBase) {
- History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseType, this.drawingBase.Type, nType));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseType, this.drawingBase.Type, nType));
this.drawingBase.Type = nType;
this.handleUpdateExtents();
}
};
CGraphicObjectBase.prototype.setDrawingBaseEditAs = function (nType) {
if (this.drawingBase) {
- History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseEditAs, this.drawingBase.editAs, nType));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseEditAs, this.drawingBase.editAs, nType));
this.drawingBase.editAs = nType;
this.handleUpdateExtents();
}
};
CGraphicObjectBase.prototype.setDrawingBasePos = function (fPosX, fPosY) {
if (this.drawingBase && this.drawingBase.Pos) {
- History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBasePos, new CDrawingBaseCoordsWritable(this.drawingBase.Pos.X, this.drawingBase.Pos.Y), new CDrawingBaseCoordsWritable(fPosX, fPosY)));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBasePos, new CDrawingBaseCoordsWritable(this.drawingBase.Pos.X, this.drawingBase.Pos.Y), new CDrawingBaseCoordsWritable(fPosX, fPosY)));
this.drawingBase.Pos.X = fPosX;
this.drawingBase.Pos.Y = fPosY;
this.handleUpdatePosition();
@@ -1321,7 +1347,7 @@
};
CGraphicObjectBase.prototype.setDrawingBaseExt = function (fExtX, fExtY) {
if (this.drawingBase && this.drawingBase.ext) {
- History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseExt, new CDrawingBaseCoordsWritable(this.drawingBase.ext.cx, this.drawingBase.ext.cy), new CDrawingBaseCoordsWritable(fExtX, fExtY)));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseExt, new CDrawingBaseCoordsWritable(this.drawingBase.ext.cx, this.drawingBase.ext.cy), new CDrawingBaseCoordsWritable(fExtX, fExtY)));
this.drawingBase.ext.cx = fExtX;
this.drawingBase.ext.cy = fExtY;
this.handleUpdateExtents();
@@ -1501,7 +1527,7 @@
this.extY = oldExtY;
this.rot = oldRot;
var from = this.drawingBase.from, to = this.drawingBase.to;
- History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors,
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors,
new CDrawingBasePosWritable({
fromCol: oldFromCol,
fromColOff: oldFromColOff,
@@ -1535,7 +1561,7 @@
};
CGraphicObjectBase.prototype.setDrawingBaseCoords = function (fromCol, fromColOff, fromRow, fromRowOff, toCol, toColOff, toRow, toRowOff, posX, posY, extX, extY) {
if (this.drawingBase) {
- History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors, new CDrawingBasePosWritable({
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors, new CDrawingBasePosWritable({
fromCol: this.drawingBase.from.col,
fromColOff: this.drawingBase.from.colOff,
fromRow: this.drawingBase.from.row,
@@ -1606,6 +1632,11 @@
CGraphicObjectBase.prototype.getWorksheet = function () {
return this.worksheet;
};
+ CGraphicObjectBase.prototype.getWorksheetView = function () {
+ let oWS = this.getWorksheet();
+ if(!oWS) return null;
+
+ };
CGraphicObjectBase.prototype.getWorkbook = function () {
var oWorksheet = this.getWorksheet();
if (!oWorksheet) {
@@ -1696,7 +1727,7 @@
return undefined;
};
CGraphicObjectBase.prototype.setBDeleted = function (pr) {
- History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_ShapeSetBDeleted, this.bDeleted, pr));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_ShapeSetBDeleted, this.bDeleted, pr));
this.bDeleted = pr;
};
CGraphicObjectBase.prototype.getEditorType = function () {
@@ -2781,12 +2812,13 @@
};
CGraphicObjectBase.prototype.createPlaceholderControl = function (aControls) {
- if(!this.parent) return;
- if(!this.parent.getObjectType) return;
+ let nParentType = null;
+ if(this.parent && this.parent.getObjectType) {
+ nParentType = this.parent.getObjectType();
+ }
let bCanAdd = false;
- let nParentType = this.parent.getObjectType();
- if(this.isPlaceholder() &&
- (nParentType === AscDFH.historyitem_type_SlideMaster || nParentType === AscDFH.historyitem_type_SlideLayout)) {
+ let bMasterLtPh = (this.isPlaceholder() && (nParentType === AscDFH.historyitem_type_SlideMaster || nParentType === AscDFH.historyitem_type_SlideLayout))
+ if(bMasterLtPh) {
bCanAdd = true;
}
else {
@@ -2798,10 +2830,11 @@
if (!bCanAdd) {
return;
}
- var phType = this.getPlaceholderType();
- var aButtons = [];
- var isLocalDesktop = window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsSupportMedia"] && window["AscDesktopEditor"]["IsSupportMedia"]();
+ let phType = this.getPlaceholderType();
+ let aButtons = [];
+ let isLocalDesktop = window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsSupportMedia"] && window["AscDesktopEditor"]["IsSupportMedia"]();
const oRect = {x: 0, y: 0, w: this.extX, h: this.extY};
+ let isDisabled = bMasterLtPh;
switch (phType) {
case null: {
aButtons.push(AscCommon.PlaceholderButtonType.Table);
@@ -2896,7 +2929,7 @@
nPageNum = this.Get_AbsolutePage() || 0;
}
if (aButtons.length > 0) {
- aControls.push(AscCommon.CreateDrawingPlaceholder(this.Id, aButtons, nPageNum, oRect, this.transform));
+ aControls.push(AscCommon.CreateDrawingPlaceholder(this.Id, aButtons, nPageNum, oRect, this.transform, isDisabled));
}
};
CGraphicObjectBase.prototype.onSlicerUpdate = function (sName) {
@@ -2998,6 +3031,12 @@
return this;
};
+ CGraphicObjectBase.prototype.getDrawingObjectsController = function() {
+ if(AscFormat.CShape.prototype.getDrawingObjectsController) {
+ return AscFormat.CShape.prototype.getDrawingObjectsController.call(this);
+ }
+ return null;
+ };
//TODO: refactor this methods: don't call functions from AscFormat.CShape.prototype
@@ -3125,6 +3164,10 @@
};
CGraphicObjectBase.prototype.getBoundsByDrawing = function (bMorph) {
const oCopy = this.bounds.copy();
+ if(this.shdwSp) {
+ this.shdwSp.recalculateBounds();
+ oCopy.checkByOther(this.shdwSp.bounds);
+ }
if(!bMorph) {
oCopy.l -= 3;
oCopy.r += 3;
@@ -3653,9 +3696,14 @@
CGraphicObjectBase.prototype.applyDrawingSize = function(props) {
let oSpParent = this.parent;
- let oXfrm = this.spPr.xfrm;
AscFormat.CheckSpPrXfrm3(this);
+ let oXfrm = this.spPr.xfrm;
+ let scaleX = 1.0;
+ let scaleY = 1.0;
+ let oldExtX = oXfrm.extX;
+ let oldExtY = oXfrm.extY;
if (!props.SizeRelH && AscFormat.isRealNumber(props.Width)) {
+ scaleX = props.Width / oXfrm.extX;
oXfrm.setExtX(props.Width);
if (oSpParent instanceof AscCommonWord.ParaDrawing) {
oSpParent.SetSizeRelH({
@@ -3665,6 +3713,7 @@
}
}
if (!props.SizeRelV && AscFormat.isRealNumber(props.Height)) {
+ scaleY = props.Height / oXfrm.extY;
oXfrm.setExtY(props.Height);
if (oSpParent instanceof AscCommonWord.ParaDrawing) {
oSpParent.SetSizeRelV({
@@ -3688,20 +3737,51 @@
}
}
this.ResetParametersWithResize(true);
+ if(this.isGroup()) {
+ oXfrm.setExtX(oldExtX);
+ oXfrm.setExtY(oldExtY);
+ this.changeSize(scaleX, scaleY);
+ }
this.checkDrawingBaseCoords();
};
CGraphicObjectBase.prototype.checkPlaceholders = function(oPlaceholders) {
+ if(this.isDependentPlaceholder(oPlaceholders)) {
+ this.setRecalculateInfo();
+ this.handleUpdateTheme();
+ this.recalculate();
+ return true;
+ }
+ return false;
+ };
+ CGraphicObjectBase.prototype.isDependentPlaceholder = function(oPlaceholders) {
+ if(!this.isPlaceholder()) return false;
let aHierarchy = this.getHierarchy();
for(let nIdx = 0; nIdx < aHierarchy.length; ++nIdx) {
let oDrawing = aHierarchy[nIdx];
if(oDrawing && oPlaceholders[oDrawing.Id]) {
- this.setRecalculateInfo();
- this.recalculate();
return true;
}
}
return false;
};
+ CGraphicObjectBase.prototype.handleUpdateTheme = function() {
+
+ };
+ CGraphicObjectBase.prototype.changeSize = function (kw, kh) {
+ AscFormat.CShape.prototype.changeSize.call(this, kw, kh);
+ };
+ CGraphicObjectBase.prototype.checkOnDeletePlaceholder = function(oPlaceholders) {
+ if(this.isDependentPlaceholder(oPlaceholders)) {
+ if(!(this.spPr && this.spPr.xfrm && this.spPr.xfrm.isNotNull())) {
+ AscFormat.CheckSpPrXfrm(this, true);
+ }
+ return true;
+ }
+ return false;
+ };
+ CGraphicObjectBase.prototype.generateLocalDrawingPart = function () {};
+ CGraphicObjectBase.prototype.generateSmartArtDrawingPart = function () {};
+ CGraphicObjectBase.prototype.checkDrawingPartWithHistory = function () {};
var ANIM_LABEL_WIDTH_PIX = 22;
var ANIM_LABEL_HEIGHT_PIX = 17;
@@ -3729,24 +3809,24 @@
return AscDFH.historyitem_type_RelSizeAnchor;
};
CRelSizeAnchor.prototype.setFromTo = function (fromX, fromY, toX, toY) {
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorFromX, this.fromX, fromX));
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorFromY, this.fromY, fromY));
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorToX, this.toX, toX));
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorToY, this.toY, toY));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorFromX, this.fromX, fromX));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorFromY, this.fromY, fromY));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorToX, this.toX, toX));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_RelSizeAnchorToY, this.toY, toY));
this.fromX = fromX;
this.fromY = fromY;
this.toX = toX;
this.toY = toY;
};
CRelSizeAnchor.prototype.setObject = function (object) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_RelSizeAnchorObject, this.object, object));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_RelSizeAnchorObject, this.object, object));
this.object = object;
if (object) {
object.setParent(this);
}
};
CRelSizeAnchor.prototype.setParent = function (object) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_RelSizeAnchorParent, this.parent, object));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_RelSizeAnchorParent, this.parent, object));
this.parent = object;
};
CRelSizeAnchor.prototype.copy = function (oPr) {
@@ -3816,24 +3896,24 @@
return AscDFH.historyitem_type_AbsSizeAnchor;
};
CAbsSizeAnchor.prototype.setFromTo = function (fromX, fromY, extX, extY) {
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorFromX, this.fromX, fromX));
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorFromY, this.fromY, fromY));
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorExtX, this.toX, extX));
- History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorExtY, this.toY, extY));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorFromX, this.fromX, fromX));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorFromY, this.fromY, fromY));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorExtX, this.toX, extX));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsDouble(this, AscDFH.historyitem_AbsSizeAnchorExtY, this.toY, extY));
this.fromX = fromX;
this.fromY = fromY;
this.toX = extX;
this.toY = extY;
};
CAbsSizeAnchor.prototype.setObject = function (object) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_AbsSizeAnchorObject, this.object, object));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_AbsSizeAnchorObject, this.object, object));
this.object = object;
if (object) {
object.setParent(this);
}
};
CAbsSizeAnchor.prototype.setParent = function (object) {
- History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_AbsSizeAnchorParent, this.parent, object));
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_AbsSizeAnchorParent, this.parent, object));
this.parent = object;
};
CAbsSizeAnchor.prototype.copy = function (oPr) {
diff --git a/common/Drawings/Format/GroupShape.js b/common/Drawings/Format/GroupShape.js
index b8be2e02fa..4d0764f80e 100644
--- a/common/Drawings/Format/GroupShape.js
+++ b/common/Drawings/Format/GroupShape.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -511,7 +511,7 @@
CGroupShape.prototype.getResultScaleCoefficients = function () {
if (this.recalcInfo.recalculateScaleCoefficients) {
var cx, cy;
- if (this.spPr.xfrm.isNotNullForGroup()) {
+ if (this.spPr && this.spPr.xfrm && this.spPr.xfrm.isNotNullForGroup()) {
var dExtX = this.spPr.xfrm.extX, dExtY = this.spPr.xfrm.extY;
@@ -1434,7 +1434,7 @@
}
}
};
-
+ CGroupShape.prototype.recalcSmartArtConnections = function () {};
CGroupShape.prototype.Refresh_RecalcData = function (oData) {
if (oData) {
switch (oData.Type) {
@@ -1449,6 +1449,13 @@
case AscDFH.historyitem_GroupShapeRemoveFromSpTree: {
if (!this.bDeleted) {
this.handleUpdateSpTree();
+ this.recalcSmartArtConnections();
+ }
+ break;
+ }
+ case AscDFH.historyitem_SmartArtDrawing: {
+ if (!this.bDeleted) {
+ this.addToRecalculate();
}
break;
}
@@ -1700,6 +1707,12 @@
}
return oCurCandidate;
};
+ CGroupShape.prototype.checkDrawingPartWithHistory = function() {};
+ CGroupShape.prototype.generateSmartArtDrawingPart = function () {
+ for (let i = 0; i < this.spTree.length; i += 1) {
+ this.spTree[i].generateSmartArtDrawingPart();
+ }
+ };
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
diff --git a/common/Drawings/Format/Image.js b/common/Drawings/Format/Image.js
index b1dba4657e..d2eb020eed 100644
--- a/common/Drawings/Format/Image.js
+++ b/common/Drawings/Format/Image.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -288,6 +288,41 @@
return ret;
};
+ CImageShape.prototype.convertToPdf = function () {
+ let copy = new AscPDF.CPdfImage();
+
+ copy.setParent(null);
+ copy.setBDeleted(false);
+
+ if (this.nvPicPr) {
+ copy.setNvPicPr(this.nvPicPr.createDuplicate());
+ }
+ if (this.spPr) {
+ copy.setSpPr(this.spPr.createDuplicate());
+ copy.spPr.setParent(copy);
+ }
+ if (this.blipFill) {
+ copy.setBlipFill(this.blipFill.createDuplicate());
+ }
+ if (this.style) {
+ copy.setStyle(this.style.createDuplicate());
+ }
+ if (this.macro !== null) {
+ copy.setMacro(this.macro);
+ }
+ if (this.textLink !== null) {
+ copy.setTextLink(this.textLink);
+ }
+ if (this.clientData) {
+ copy.setClientData(this.clientData.createDuplicate());
+ }
+ if (this.fLocksText !== null) {
+ copy.setFLocksText(this.fLocksText);
+ }
+ copy.setLocks(this.locks);
+ return copy;
+ };
+
CImageShape.prototype.recalculateBrush = CShape.prototype.recalculateBrush;
CImageShape.prototype.recalculatePen = function () {
@@ -460,7 +495,7 @@
CImageShape.prototype.recalculateGeometry = function () {
this.calcGeometry = null;
- if (isRealObject(this.spPr.geometry)) {
+ if (isRealObject(this.spPr && this.spPr.geometry)) {
this.calcGeometry = this.spPr.geometry;
} else {
var hierarchy = this.getHierarchy();
diff --git a/common/Drawings/Format/LockedCanvas.js b/common/Drawings/Format/LockedCanvas.js
index 0655368d82..a57ca15d7f 100644
--- a/common/Drawings/Format/LockedCanvas.js
+++ b/common/Drawings/Format/LockedCanvas.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Format/OleObject.js b/common/Drawings/Format/OleObject.js
index fcfa65b388..a570939f8e 100644
--- a/common/Drawings/Format/OleObject.js
+++ b/common/Drawings/Format/OleObject.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Format/Path.js b/common/Drawings/Format/Path.js
index 88ce0bb723..e28c5a377d 100644
--- a/common/Drawings/Format/Path.js
+++ b/common/Drawings/Format/Path.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -55,8 +55,6 @@ var HitInBezier4 = AscFormat.HitInBezier4;
var HitInBezier3 = AscFormat.HitInBezier3;
var MOVE_DELTA = AscFormat.MOVE_DELTA;
- var History = AscCommon.History;
-
var cToRad2 = (Math.PI/60000)/180;
@@ -273,32 +271,32 @@ AscFormat.InitClass(Path, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_P
};
Path.prototype.setStroke = function(pr)
{
- History.CanAddChanges() && History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_PathSetStroke, this.stroke, pr));
+ AscCommon.History.CanAddChanges() && AscCommon.History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_PathSetStroke, this.stroke, pr));
this.stroke = pr;
};
Path.prototype.setExtrusionOk = function(pr)
{
- History.CanAddChanges() && History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_PathSetExtrusionOk, this.extrusionOk, pr));
+ AscCommon.History.CanAddChanges() && AscCommon.History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_PathSetExtrusionOk, this.extrusionOk, pr));
this.extrusionOk = pr;
};
Path.prototype.setFill = function(pr)
{
- History.CanAddChanges() && History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_PathSetFill, this.fill, pr));
+ AscCommon.History.CanAddChanges() && AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_PathSetFill, this.fill, pr));
this.fill = pr;
};
Path.prototype.setPathH = function(pr)
{
- History.CanAddChanges() && History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_PathSetPathH, this.pathH, pr));
+ AscCommon.History.CanAddChanges() && AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_PathSetPathH, this.pathH, pr));
this.pathH = pr;
};
Path.prototype.setPathW = function(pr)
{
- History.CanAddChanges() && History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_PathSetPathW, this.pathW, pr));
+ AscCommon.History.CanAddChanges() && AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this, AscDFH.historyitem_PathSetPathW, this.pathW, pr));
this.pathW = pr;
};
Path.prototype.addPathCommand = function(cmd)
{
- History.CanAddChanges() && History.Add(new CChangesDrawingsAddPathCommand(this, cmd, this.ArrPathCommandInfo.length));
+ AscCommon.History.CanAddChanges() && AscCommon.History.Add(new CChangesDrawingsAddPathCommand(this, cmd, this.ArrPathCommandInfo.length));
this.ArrPathCommandInfo.push(cmd);
};
Path.prototype.moveTo = function(x, y)
diff --git a/common/Drawings/Format/Shape.js b/common/Drawings/Format/Shape.js
index aed7ae8d60..b6a3b8ff64 100644
--- a/common/Drawings/Format/Shape.js
+++ b/common/Drawings/Format/Shape.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -76,6 +76,22 @@
var dTextFitDelta = 3;// mm
+ function getSmartArtParagraphIndent(fontSize) {
+ if (fontSize >= 30) {
+ return 7.9;
+ }
+ if (fontSize >= 20) {
+ return 6.4;
+ }
+ if (fontSize >= 16) {
+ return 4.8;
+ }
+ if (fontSize >= 12) {
+ return 3.2;
+ }
+ return 1.6;
+ }
+
function CheckObjectLine(obj) {
return (obj instanceof CShape && obj.spPr && obj.spPr.geometry && AscFormat.CheckLinePresetForParagraphAdd(obj.spPr.geometry.preset));
}
@@ -186,6 +202,10 @@
return -1;
}
+ if(object.canResize && !object.canResize()) {
+ return -1;
+ }
+
if (object.cropObject) {
return hitToCropHandles(x, y, object);
}
@@ -423,6 +443,10 @@
oNewEndPr.Unifill = oNewEndPr.TextFill;
oNewEndPr.TextFill = undefined;
}
+ if (oNewEndPr.RStyle != undefined) {
+ oNewEndPr.RStyle = undefined;
+ }
+ oNewEndPr.FontScale = undefined;
new_paragraph.TextPr.Set_Value(oNewEndPr);
new_paragraph.Internal_Content_Remove2(0, new_paragraph.Content.length);
ConvertParagraphContentToPPTX(paragraph.Content, new_paragraph, bIsAddMath, bRemoveHyperlink);
@@ -717,6 +741,11 @@
aAllDrawings[i].GraphicObj.recalculate();
}
}
+ let aTables = oDocContent.GetAllTables();
+ for(let nIdx = 0; nIdx < aTables.length; ++nIdx) {
+ let oTable = aTables[nIdx];
+ oTable.RecalcInfo.Recalc_AllCells();
+ }
oDocContent.Recalculate_Page(0, true);
fHandleContent(oDocContent.Content, oMaxWidth);
if (oMaxWidth.max_width === 0) {
@@ -791,9 +820,7 @@
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr] = AscDFH.CChangesDrawingsObject;
- AscDFH.changesFactory[AscDFH.historyitem_ShapeSetShapeSmartArtPointInfo] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxXfrm] = AscDFH.CChangesDrawingsObject;
- AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSmartArtPoint] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent] = AscDFH.CChangesDrawingsObject;
@@ -809,12 +836,6 @@
AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr] = function (oClass, value) {
oClass.nvSpPr = value;
};
- AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSmartArtPoint] = function (oClass, value) {
- oClass.point = value;
- };
- AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetShapeSmartArtPointInfo] = function (oClass, value) {
- oClass.shapeSmartArtInfo = value;
- };
AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxXfrm] = function (oClass, value) {
oClass.txXfrm = value;
};
@@ -959,18 +980,21 @@
CShape.prototype.setCustT = function (value) {
var pointContent = this.getSmartArtPointContent();
if (pointContent) {
- pointContent.forEach(function (point) {
+ pointContent.forEach(function (node) {
+ const point = node.point;
if (point.prSet && point.prSet.custT !== value) {
point.prSet.setCustT(value);
}
- })
+ });
+ this.applyCustTSettings();
}
}
CShape.prototype.setShapeSmartArtInfo = function (pr) {
- AscCommon.History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_ShapeSetShapeSmartArtPointInfo, this.shapeSmartArtInfo, pr));
this.shapeSmartArtInfo = pr;
- this.shapeSmartArtInfo.setParent(this);
+ if (this.shapeSmartArtInfo) {
+ this.shapeSmartArtInfo.setShape(this);
+ }
}
CShape.prototype.isActiveBlipFillPlaceholder = function () {
const shapePoint = this.getSmartArtShapePoint();
@@ -978,7 +1002,8 @@
let isContentFill = false;
const contentPoints = this.getSmartArtPointContent();
if (contentPoints && contentPoints[0]) {
- isContentFill = contentPoints[0].spPr && contentPoints[0].spPr.Fill;
+ const contentPoint = contentPoints[0].point;
+ isContentFill = contentPoint.spPr && contentPoint.spPr.Fill;
}
return shapePoint.isBlipFillPlaceholder() && !(shapePoint.spPr && shapePoint.spPr.Fill) && !isContentFill;
}
@@ -1057,54 +1082,16 @@
CShape.prototype.convertToPPTX = function (drawingDocument, worksheet, bIsAddMath) {
let c = new CShape();
- c.setWordShape(false);
- c.setBDeleted(false);
- c.setWorksheet(worksheet);
- if (this.nvSpPr) {
- c.setNvSpPr(this.nvSpPr.createDuplicate());
- }
- if (this.spPr) {
- c.setSpPr(this.spPr.createDuplicate());
- c.spPr.setParent(c);
- }
- if (this.style) {
- c.setStyle(this.style.createDuplicate());
- }
- if (this.textBoxContent) {
- let tx_body = new AscFormat.CTextBody();
- tx_body.setParent(c);
- if (this.bodyPr) {
- tx_body.setBodyPr(this.bodyPr.createDuplicate());
- }
- let new_content = new AscFormat.CDrawingDocContent(tx_body, drawingDocument, 0, 0, 0, 0, false, false, true);
- let aContent = this.textBoxContent.Content;
- let aNewParagraphs = [];
- for (let nIdx = 0; nIdx < aContent.length; ++nIdx) {
- let oCurElement = aContent[nIdx];
- if (oCurElement instanceof AscWord.Paragraph) {
- let oParagraph = ConvertParagraphToPPTX(oCurElement, drawingDocument, new_content, bIsAddMath);
- aNewParagraphs.push(oParagraph);
- }
- }
- if (aNewParagraphs.length > 0) {
- new_content.Internal_Content_RemoveAll();
- for (let nIdx = 0; nIdx < aNewParagraphs.length; ++nIdx) {
- let oParagraph = aNewParagraphs[nIdx];
- new_content.Internal_Content_Add(nIdx, oParagraph, false);
- }
- }
- tx_body.setContent(new_content);
- c.setTxBody(tx_body);
- }
- if (worksheet) {
- if (this.signatureLine) {
- c.setSignature(this.signatureLine.copy());
- }
- }
+ this._convertToPPTX(c, drawingDocument, worksheet, bIsAddMath);
return c;
};
CShape.prototype.convertToPdf = function (drawingDocument, worksheet, bIsAddMath) {
let c = new AscPDF.CPdfShape();
+ this._convertToPPTX(c, drawingDocument, worksheet, bIsAddMath);
+ return c;
+ };
+ CShape.prototype._convertToPPTX = function(c, drawingDocument, worksheet, bIsAddMath)
+ {
c.setWordShape(false);
c.setBDeleted(false);
c.setWorksheet(worksheet);
@@ -1149,7 +1136,6 @@
c.setSignature(this.signatureLine.copy());
}
}
- return c;
};
CShape.prototype.convertFromSmartArt = function (bForce) {
if (AscFormat.SmartArt && !bForce) {
@@ -1238,7 +1224,9 @@
this.txXfrm.setParent(this);
}
};
-
+ CShape.prototype.getModelId = function () {
+ return this.modelId;
+ };
CShape.prototype.setModelId = function (pr) {
AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ShapeSetModelId, this.modelId, pr));
this.modelId = pr;
@@ -1286,6 +1274,10 @@
this.recalcInfo.recalculateTransformText = true;
this.addToRecalculate();
};
+ CShape.prototype.setUseBgFill = function (pr) {
+ AscCommon.History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_ShapeSetUseBgFill, this.useBgFill, pr));
+ this.useBgFill = pr;
+ };
CShape.prototype.createTextBody = function () {
var tx_body = new AscFormat.CTextBody();
@@ -1380,7 +1372,7 @@
var pointsCopy;
for (var i = 0; i < pointContent.length; i += 1) {
- var point = pointContent[i];
+ var point = pointContent[i].point;
if (point.prSet && point.prSet.custT) {
options.custT = true;
@@ -1416,7 +1408,8 @@
}
}
pointsCopy = txBody.createDuplicateForSmartArt(options);
- pointContent.forEach(function (point, idx) {
+ pointContent.forEach(function (node, idx) {
+ const point = node.point;
point.setT(pointsCopy[idx])
});
}
@@ -2241,50 +2234,22 @@
CShape.prototype.checkTransformTextMatrix = function (oMatrix, oContent, oBodyPr, bWordArtTransform, bIgnoreInsets) {
oMatrix.Reset();
- var _shape_transform = this.localTransform;
- var _content_height = oContent.GetSummaryHeight();
- var _l, _t, _r, _b;
- var _t_x_lt, _t_y_lt, _t_x_rt, _t_y_rt, _t_x_lb, _t_y_lb, _t_x_rb, _t_y_rb;
- var l_ins = bIgnoreInsets ? 0 : (AscFormat.isRealNumber(oBodyPr.lIns) ? oBodyPr.lIns : 2.54);
- var t_ins = bIgnoreInsets ? 0 : (AscFormat.isRealNumber(oBodyPr.tIns) ? oBodyPr.tIns : 1.27);
- var r_ins = bIgnoreInsets ? 0 : (AscFormat.isRealNumber(oBodyPr.rIns) ? oBodyPr.rIns : 2.54);
- var b_ins = bIgnoreInsets ? 0 : (AscFormat.isRealNumber(oBodyPr.bIns) ? oBodyPr.bIns : 1.27);
-
- var oRect = this.getTextRect();
- if (this.txXfrm) {
- return this.checkTransformTextMatrixSmartArt(oMatrix, oContent, oBodyPr, bWordArtTransform, bIgnoreInsets);
- }
+ let _shape_transform = this.localTransform;
+ let _content_height = oContent.GetSummaryHeight();
+ let _l, _t, _r, _b;
+ let _t_x_lt, _t_y_lt, _t_x_rt, _t_y_rt, _t_x_lb, _t_y_lb, _t_x_rb, _t_y_rb;
- if (this.bWordShape) {
- var oPen = this.pen;
- if (oPen) {
- var penW = (oPen.w == null) ? 12700 : parseInt(oPen.w);
- penW /= 36000.0;
- switch (oPen.algn) {
- case 1: {
- break;
- }
- default: {
- penW /= 2.0;
- break;
- }
- }
- l_ins += penW;
- r_ins += penW;
- t_ins += penW;
- b_ins += penW;
- }
- }
- let oForm = this.isForm && this.isForm() ? this.getInnerForm() : null;
- if (oForm) {
- let nFormHorPadding = this.getFormHorPadding();
- l_ins = nFormHorPadding;
- r_ins = nFormHorPadding;
- t_ins = 0;
- b_ins = 0;
+ let oRect = this.getTextRect();
+ if (this.txXfrm) {
+ return this.checkTransformTextMatrixSmartArt(oMatrix, oContent, oBodyPr, bWordArtTransform, bIgnoreInsets);
}
+ let oInsets = this.getInsets({bIgnoreInsets: bIgnoreInsets, bodyPr: oBodyPr});
+ let l_ins = oInsets.lIns;
+ let t_ins = oInsets.tIns;
+ let r_ins = oInsets.rIns;
+ let b_ins = oInsets.bIns;
_l = oRect.l + l_ins;
_t = oRect.t + t_ins;
@@ -2340,6 +2305,7 @@
var oClipRect;
var Diff = 1.6;
+ const oForm = this.isForm && this.isForm() ? this.getInnerForm() : null;
if (oForm) {
if (oForm.IsMultiLineForm())
_vertical_shift = 0;
@@ -2810,7 +2776,8 @@
if (this.isObjectInSmartArt()) {
var pointContent = this.getSmartArtPointContent();
if (pointContent && pointContent.length !== 0) {
- return pointContent.every(function (point) {
+ return pointContent.every(function (node) {
+ const point = node.point;
return point && point.prSet && point.prSet.phldr;
})
}
@@ -3042,11 +3009,18 @@
};
CShape.prototype.recalculateBrush = function () {
- var compiled_style = this.getCompiledStyle();
- var RGBA = {R: 0, G: 0, B: 0, A: 255};
- var parents = this.getParentObjects();
- var oStyleBrush = null;
- var oLin;
+ let parents = this.getParentObjects();
+ let RGBA = {R: 0, G: 0, B: 0, A: 255};
+ if(this.useBgFill) {
+ if(this.parent && this.parent.backgroundFill) {
+ this.brush = this.parent.backgroundFill.createDuplicate();
+ this.brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA);
+ return;
+ }
+ }
+ let compiled_style = this.getCompiledStyle();
+ let oStyleBrush = null;
+ let oLin;
if (isRealObject(parents.theme) && isRealObject(compiled_style) && isRealObject(compiled_style.fillRef)) {
this.brush = parents.theme.getFillStyle(compiled_style.fillRef.idx, compiled_style.fillRef.Color);
if (this.brush) {
@@ -3159,7 +3133,8 @@
|| phldrType == AscFormat.phType_media) {
return true;
}
- if (phldrType == AscFormat.phType_pic) {
+ if (phldrType == AscFormat.phType_pic
+ || phldrType == AscFormat.phType_tbl) {
var _b_empty_text = true;
if (this.txBody) {
if (this.txBody.content) {
@@ -3497,8 +3472,19 @@
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
- this.x = scale_scale_coefficients.cx * (xfrm.offX - this.group.spPr.xfrm.chOffX);
- this.y = scale_scale_coefficients.cy * (xfrm.offY - this.group.spPr.xfrm.chOffY);
+
+ let offX = xfrm.offX;
+ let offY = xfrm.offY;
+ let oGrXfrm = null;
+ if(this.group.spPr) {
+ oGrXfrm = this.group.spPr.xfrm;
+ if(oGrXfrm) {
+ offX -= oGrXfrm.chOffX;
+ offY -= oGrXfrm.chOffY;
+ }
+ }
+ this.x = scale_scale_coefficients.cx * offX;
+ this.y = scale_scale_coefficients.cy * offY;
this.extX = scale_scale_coefficients.cx * xfrm.extX;
this.extY = scale_scale_coefficients.cy * xfrm.extY;
this.rot = AscFormat.isRealNumber(xfrm.rot) ? xfrm.rot : 0;
@@ -3846,53 +3832,16 @@
CShape.prototype.recalculateDocContent = function (oDocContent, oBodyPr) {
- var nStartPage = this.Get_AbsolutePage ? this.Get_AbsolutePage() : 0;
- var oRet = {w: 0, h: 0, contentH: 0};
- var l_ins, t_ins, r_ins, b_ins;
- if (oBodyPr) {
- l_ins = AscFormat.isRealNumber(oBodyPr.lIns) ? oBodyPr.lIns : 2.54;
- r_ins = AscFormat.isRealNumber(oBodyPr.rIns) ? oBodyPr.rIns : 2.54;
- t_ins = AscFormat.isRealNumber(oBodyPr.tIns) ? oBodyPr.tIns : 1.27;
- b_ins = AscFormat.isRealNumber(oBodyPr.bIns) ? oBodyPr.bIns : 1.27;
- } else {
- l_ins = 2.54;
- r_ins = 2.54;
- t_ins = 1.27;
- b_ins = 1.27;
- }
- if (this.bWordShape) {
- var oPen = this.pen;
- if (oPen) {
- var penW = (oPen.w == null) ? 12700 : parseInt(oPen.w);
- penW /= 36000.0;
- switch (oPen.algn) {
- case 1: {
- break;
- }
- default: {
- penW /= 2.0;
- break;
- }
- }
-
- l_ins += penW;
- r_ins += penW;
- t_ins += penW;
- b_ins += penW;
- }
- }
-
- let oForm = this.isForm && this.isForm() ? this.getInnerForm() : null;
- if (oForm) {
- let nFormHorPadding = this.getFormHorPadding();
- l_ins = nFormHorPadding;
- r_ins = nFormHorPadding;
- t_ins = 0;
- b_ins = 0;
- }
-
- var oRect = this.getTextRect();
- var w, h;
+ let nStartPage = this.Get_AbsolutePage ? this.Get_AbsolutePage() : 0;
+ let oRet = {w: 0, h: 0, contentH: 0};
+ let oInsets = this.getInsets({bIgnoreInsets: false, bodyPr: oBodyPr});
+ const oForm = this.isForm && this.isForm() ? this.getInnerForm() : null;
+ let l_ins = oInsets.lIns;
+ let t_ins = oInsets.tIns;
+ let r_ins = oInsets.rIns;
+ let b_ins = oInsets.bIns;
+ let oRect = this.getTextRect();
+ let w, h;
w = oRect.r - oRect.l - (l_ins + r_ins);
h = oRect.b - oRect.t - (t_ins + b_ins);
if (oBodyPr.wrap === AscFormat.nTWTNone) {
@@ -4031,9 +3980,8 @@
};
CShape.prototype.getSmartArtPointContent = function () {
- if (this.isObjectInSmartArt()) {
- return this.getSmartArtInfo() && this.getSmartArtInfo().contentPoint;
- }
+ const smartartInfo = this.getSmartArtInfo();
+ return smartartInfo && smartartInfo.contentPoint;
}
CShape.prototype.getSmartArtShapePoint = function () {
@@ -4062,7 +4010,7 @@
if (typeof AscCommonSlide !== "undefined" && AscCommonSlide.CNotes && this.parent instanceof AscCommonSlide.CNotes && this.nvSpPr.nvPr.ph.type === AscFormat.phType_body) {
text = AscCommon.translateManager.getValue("Click to add notes");
} else if (this.isObjectInSmartArt()) {
- text = AscCommon.translateManager.getValue(pointContent[0].prSet.phldrT || '');
+ text = AscCommon.translateManager.getValue(pointContent[0].point.prSet.phldrT || '');
} else {
text = this.getPlaceholderName();
}
@@ -4227,47 +4175,222 @@
return currentFontSize;
}
- CShape.prototype.setFontSizeInSmartArt = function (fontSize, bSkipRecalculateContent2) {
+ CShape.prototype.setFontSizeInSmartArt = function (fontSize, bSkipRecalculateContent2, isParentWithChildren) {
const oContent = this.txBody && this.txBody.content;
if (this.txBody && oContent) {
const currentFontSize = this.getFirstFontSize();
const oBodyPr = this.txBody.getBodyPr();
- if (oBodyPr) {
+ const pointContent = this.getSmartArtPointContent();
+ if (oBodyPr && pointContent) {
const paddings = {};
- const pointContent = this.getSmartArtPointContent();
- const point = pointContent && pointContent[0];
+ const point = pointContent && pointContent[0].point;
if (point) {
const isRecalculateInsets = point.isRecalculateInsets();
- if (isRecalculateInsets.Top) {
- const tInsetPerPt = oBodyPr.tIns / currentFontSize;
- paddings.Top = tInsetPerPt * fontSize;
- }
- if (isRecalculateInsets.Bottom) {
- const bInsetPerPt = oBodyPr.bIns / currentFontSize;
- paddings.Bottom = bInsetPerPt * fontSize;
- }
- if (isRecalculateInsets.Left) {
- const lInsetPerPt = oBodyPr.lIns / currentFontSize;
- paddings.Left = lInsetPerPt * fontSize;
- }
- if (isRecalculateInsets.Right) {
- const rInsetPerPt = oBodyPr.rIns / currentFontSize;
- paddings.Right = rInsetPerPt * fontSize;
+ const smartArt = this.group && this.group.group;
+ if (smartArt && smartArt.isCanGenerateSmartArt()) {
+ const shapeInfo = this.getSmartArtInfo();
+ const marginFactors = shapeInfo.getMarginFactors();
+ if (isRecalculateInsets.Top && marginFactors.tMarg !== undefined) {
+ paddings.Top = g_dKoef_pt_to_mm * marginFactors.tMarg * fontSize;
+ }
+ if (isRecalculateInsets.Bottom && marginFactors.bMarg !== undefined) {
+ paddings.Bottom = g_dKoef_pt_to_mm * marginFactors.bMarg * fontSize;
+ }
+ if (isRecalculateInsets.Left && marginFactors.lMarg !== undefined) {
+ paddings.Left = g_dKoef_pt_to_mm * marginFactors.lMarg * fontSize;
+ }
+ if (isRecalculateInsets.Right && marginFactors.rMarg !== undefined) {
+ paddings.Right = g_dKoef_pt_to_mm * marginFactors.rMarg * fontSize;
+ }
+ } else {
+ if (isRecalculateInsets.Top) {
+ const tInsetPerPt = oBodyPr.tIns / currentFontSize;
+ paddings.Top = tInsetPerPt * fontSize;
+ }
+ if (isRecalculateInsets.Bottom) {
+ const bInsetPerPt = oBodyPr.bIns / currentFontSize;
+ paddings.Bottom = bInsetPerPt * fontSize;
+ }
+ if (isRecalculateInsets.Left) {
+ const lInsetPerPt = oBodyPr.lIns / currentFontSize;
+ paddings.Left = lInsetPerPt * fontSize;
+ }
+ if (isRecalculateInsets.Right) {
+ const rInsetPerPt = oBodyPr.rIns / currentFontSize;
+ paddings.Right = rInsetPerPt * fontSize;
+ }
}
}
// In files layout.xml insets depend on font size.
// While there is no recalculation, we consider new insets as a dependency on the previous font size.
this.setPaddings(paddings, {bNotCopyToPoints: true});
}
- const bOldApplyToAll = oContent.ApplyToAll;
- oContent.ApplyToAll = true;
- oContent.AddToParagraph(new AscCommonWord.ParaTextPr({FontSize: (Math.min(fontSize, 300))}), false);
- oContent.ApplyToAll = bOldApplyToAll;
+ if (pointContent) {
+ this.applySmartArtFontSize(fontSize, isParentWithChildren);
+ } else {
+ const bOldApplyToAll = oContent.ApplyToAll;
+ oContent.ApplyToAll = true;
+ oContent.AddToParagraph(new AscCommonWord.ParaTextPr({FontSize:fontSize}), false);
+ oContent.ApplyToAll = bOldApplyToAll;
+ }
+
if (!bSkipRecalculateContent2) {
this.recalculateContent2();
}
}
};
+ CShape.prototype.getFirstCustTFontSize = function () {
+ const shapeInfo = this.getSmartArtInfo();
+ const contentPoints = shapeInfo && shapeInfo.contentPoint;
+ if (contentPoints) {
+ let paragraphIndex = 0;
+ for (let i = 0; i < contentPoints.length; i++) {
+ const contentNode = contentPoints[i];
+ const point = contentNode.point;
+ const contentLength = point.t && point.t.content && point.t.content.Content.length;
+ if (contentLength) {
+ if (point && point.prSet && point.prSet.custT) {
+ break;
+ } else {
+ paragraphIndex += contentLength;
+ }
+ }
+ }
+ const content = this.getDocContent();
+ if (content) {
+ const item = content.Content[paragraphIndex];
+ if (item) {
+ return item.Get_FirstTextPr2().FontSize;
+ }
+ }
+ }
+ };
+ CShape.prototype.applyCustTSettings = function () {
+ const fontSize = this.getFirstCustTFontSize();
+ const oContent = this.getDocContent();
+ if (AscFormat.isRealNumber(fontSize) && oContent) {
+ this.applySmartArtPaddings(fontSize);
+ this.applyCustTFontSizeSettings();
+ }
+ };
+
+ CShape.prototype.applyCustTFontSizeSettings = function () {
+ const contentPoints = this.getSmartArtPointContent();
+ if (!contentPoints) {
+ return;
+ }
+ const oContent = this.txBody && this.txBody.content;
+ const shapeInfo = this.getSmartArtInfo();
+ const nBulletParagraphIndex = this.getFirstBulletParagraphIndex();
+ const bulletSpacingScale = shapeInfo.getChildrenSpacingScale();
+ const paragraphSpacingScale = shapeInfo.getParentSpacingScale();
+
+ if (oContent && contentPoints && contentPoints.length) {
+ let startDepth;
+ let paragraphIndex = 0;
+ for (let i = 0; i < contentPoints.length; i++) {
+ const node = contentPoints[i];
+ const point = node.point;
+ const pointContent = point.t && point.t.content;
+ if (paragraphIndex === nBulletParagraphIndex) {
+ startDepth = node.depth;
+ }
+ const deltaDepth = startDepth !== undefined ? node.depth - startDepth + 1 : 0;
+ for (let j = 0; j < pointContent.Content.length; j += 1) {
+ const oItem = oContent.Content[paragraphIndex];
+ const fontSize = oItem.Get_FirstTextPr2().FontSize;
+ if (startDepth !== undefined) {
+ const indent = getSmartArtParagraphIndent(fontSize);
+ oItem.Set_Spacing({After: fontSize * bulletSpacingScale}, false);
+ oItem.Set_Ind({Left: deltaDepth * indent, FirstLine: -indent}, false);
+ } else {
+ oItem.Set_Spacing({After: fontSize * paragraphSpacingScale}, false);
+ oItem.Set_Ind({Left: 0, FirstLine: 0}, false);
+ }
+ paragraphIndex += 1;
+ }
+ }
+ }
+ };
+ CShape.prototype.applySmartArtPaddings = function (fontSize) {
+ const oContent = this.txBody && this.txBody.content;
+ if (this.txBody && oContent) {
+ const oBodyPr = this.txBody.getBodyPr();
+ const pointContent = this.getSmartArtPointContent();
+ if (oBodyPr && pointContent) {
+ const paddings = {};
+ const point = pointContent && pointContent[0].point;
+ if (point) {
+ const isRecalculateInsets = point.isRecalculateInsets();
+ const shapeInfo = this.getSmartArtInfo();
+ const marginFactors = shapeInfo.getMarginFactors();
+ if (isRecalculateInsets.Top && marginFactors.tMarg !== undefined) {
+ paddings.Top = g_dKoef_pt_to_mm * marginFactors.tMarg * fontSize;
+ }
+ if (isRecalculateInsets.Bottom && marginFactors.bMarg !== undefined) {
+ paddings.Bottom = g_dKoef_pt_to_mm * marginFactors.bMarg * fontSize;
+ }
+ if (isRecalculateInsets.Left && marginFactors.lMarg !== undefined) {
+ paddings.Left = g_dKoef_pt_to_mm * marginFactors.lMarg * fontSize;
+ }
+ if (isRecalculateInsets.Right && marginFactors.rMarg !== undefined) {
+ paddings.Right = g_dKoef_pt_to_mm * marginFactors.rMarg * fontSize;
+ }
+ }
+
+ this.setPaddings(paddings, {bNotCopyToPoints: true});
+ }
+ }
+ }
+ CShape.prototype.applySmartArtFontSize = function (fontSize, isParentWithChildren) {
+ const contentPoints = this.getSmartArtPointContent();
+ if (!contentPoints) {
+ return;
+ }
+ const oContent = this.txBody && this.txBody.content;
+ const shapeInfo = this.getSmartArtInfo();
+ const nBulletParagraphIndex = this.getFirstBulletParagraphIndex();
+ const mainParaTextPr = new AscCommonWord.ParaTextPr({FontSize: fontSize});
+ let bulletTextPr = mainParaTextPr;
+ if (isParentWithChildren) {
+ const fontSizeScale = shapeInfo.getSecondaryFontSizeCoefficient();
+ bulletTextPr = new AscCommonWord.ParaTextPr({FontSize: Math.round(fontSize * fontSizeScale)});
+ }
+ const bulletFontSize = bulletTextPr.Value.FontSize;
+ const indent = getSmartArtParagraphIndent(bulletFontSize);
+ const bulletSpacingScale = shapeInfo.getChildrenSpacingScale();
+ const paragraphSpacingScale = shapeInfo.getParentSpacingScale();
+
+ if (oContent && contentPoints && contentPoints.length) {
+ let startDepth;
+ let paragraphIndex = 0;
+ let firstLine = 0;
+ for (let i = 0; i < contentPoints.length; i++) {
+ const node = contentPoints[i];
+ const point = node.point;
+ const pointContent = point.t && point.t.content;
+ if (paragraphIndex === nBulletParagraphIndex) {
+ startDepth = node.depth;
+ firstLine = -indent;
+ }
+ const deltaDepth = startDepth !== undefined ? node.depth - startDepth + 1 : 0;
+ for (let j = 0; j < pointContent.Content.length; j += 1) {
+ const oItem = oContent.Content[paragraphIndex];
+ oItem.SetApplyToAll(true);
+ if (startDepth !== undefined) {
+ oItem.AddToParagraph(bulletTextPr, false);
+ oItem.Set_Spacing({After: bulletFontSize * bulletSpacingScale}, false);
+ } else {
+ oItem.AddToParagraph(mainParaTextPr, false);
+ oItem.Set_Spacing({After: fontSize * paragraphSpacingScale}, false);
+ }
+ oItem.Set_Ind({Left: deltaDepth * indent, FirstLine: firstLine}, false);
+ oItem.SetApplyToAll(false);
+ paragraphIndex += 1;
+ }
+ }
+ }
+ };
CShape.prototype.resetSmartArtMaxFontSize = function () {
const oSmartArtInfo = this.getSmartArtInfo();
if (oSmartArtInfo) {
@@ -4287,7 +4410,8 @@
return !paragraph.Is_Empty({SkipEnd: true, SkipPlcHldr: false});
});
if (bIsNotEmptyShape) {
- arrPointContent.forEach(function (point) {
+ arrPointContent.forEach(function (node) {
+ const point = node.point;
point.prSet.setPhldr(false);
})
this.txBody.content2 = null;
@@ -4299,15 +4423,23 @@
};
- CShape.prototype.getInsets = function (properties) {
- const oBodyPr = properties.bodyPr || this.getBodyPr && this.getBodyPr();
+ CShape.prototype.getInsets = function (properties) {;
properties = properties || {};
+ const oBodyPr = properties.bodyPr || this.getBodyPr && this.getBodyPr()
let lIns = 0, tIns = 0, rIns = 0, bIns = 0;
if (!properties.bIgnoreInsets) {
- lIns = (AscFormat.isRealNumber(oBodyPr.lIns) ? oBodyPr.lIns : 2.54);
- tIns = (AscFormat.isRealNumber(oBodyPr.tIns) ? oBodyPr.tIns : 1.27);
- rIns = (AscFormat.isRealNumber(oBodyPr.rIns) ? oBodyPr.rIns : 2.54);
- bIns = (AscFormat.isRealNumber(oBodyPr.bIns) ? oBodyPr.bIns : 1.27);
+ if(oBodyPr) {
+ lIns = (AscFormat.isRealNumber(oBodyPr.lIns) ? oBodyPr.lIns : 2.54);
+ tIns = (AscFormat.isRealNumber(oBodyPr.tIns) ? oBodyPr.tIns : 1.27);
+ rIns = (AscFormat.isRealNumber(oBodyPr.rIns) ? oBodyPr.rIns : 2.54);
+ bIns = (AscFormat.isRealNumber(oBodyPr.bIns) ? oBodyPr.bIns : 1.27);
+ }
+ else {
+ lIns = 2.54;
+ tIns = 1.27;
+ rIns = 2.54;
+ bIns = 1.27;
+ }
}
if (this.bWordShape) {
@@ -4437,7 +4569,17 @@
}
return false;
};
- CShape.prototype.findFitFontSize = function (nMinFontSize, nMaxFontSize, bMax) {
+ CShape.prototype.getFirstBulletParagraphIndex = function () {
+ const oContent = this.getDocContent();
+ for (let i = 0; i < oContent.Content.length; i++) {
+ const shapeParagraph = oContent.Content[i];
+ if (shapeParagraph.Pr.Bullet && shapeParagraph.Pr.Bullet.bulletType.type === AscFormat.BULLET_TYPE_BULLET_CHAR) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ CShape.prototype.findFitFontSize = function (nMinFontSize, nMaxFontSize, bMax, isParentWithChildren) {
if (nMinFontSize > nMaxFontSize) {
return null;
}
@@ -4457,7 +4599,7 @@
let b = scalesForSmartArt.length - 1;
let averageAmount = Math.floor((a + b) / 2);
while (a !== averageAmount && b !== averageAmount) {
- this.setFontSizeInSmartArt(scalesForSmartArt[averageAmount]);
+ this.setFontSizeInSmartArt(scalesForSmartArt[averageAmount], false, isParentWithChildren);
let bCheck = this.compareWidthOfBoundsTextInSmartArt(bMax) || this.compareHeightOfBoundsTextInSmartArt();
if (bCheck) {
@@ -4467,87 +4609,75 @@
}
averageAmount = Math.floor((a + b) / 2);
}
- this.setFontSizeInSmartArt(nOldFontSize);
+ this.setFontSizeInSmartArt(scalesForSmartArt[averageAmount + 1], false, isParentWithChildren);
+ if (!this.compareWidthOfBoundsTextInSmartArt(bMax) && !this.compareHeightOfBoundsTextInSmartArt()) {
+ averageAmount += 1;
+ }
+ this.setFontSizeInSmartArt(nOldFontSize, false, isParentWithChildren);
this.recalculateContent();
return scalesForSmartArt[averageAmount];
}
return MAX_FONT_SIZE;
}, this, []);
};
- CShape.prototype.findFitFontSizeForSmartArt = function (bMax) {
- return AscFormat.ExecuteNoHistory(function () {
- const MAX_FONT_SIZE = 65;
- const content = this.getCurrentDocContentInSmartArt();
- if (content) {
- const nOldFontSize = this.getFirstFontSize();
- const scalesForSmartArt = Array((MAX_FONT_SIZE - 4) > 0 ? MAX_FONT_SIZE - 4 : 1).fill(0).map(function (e, ind) {
- return ind + 5;
- });
- let a = 0;
- let b = scalesForSmartArt.length - 1;
- let averageAmount = Math.floor((a + b) / 2);
- const bNeedCheckWidth = this.checkFitContentForSmartArt();
- while (a !== averageAmount && b !== averageAmount) {
- this.setFontSizeInSmartArt(scalesForSmartArt[averageAmount]);
- let bCheck;
- if (bNeedCheckWidth) {
- bCheck = this.compareWidthOfBoundsTextInSmartArt(bMax) || this.compareHeightOfBoundsTextInSmartArt();
- } else {
- bCheck = this.compareHeightOfBoundsTextInSmartArt();
- }
+ CShape.prototype.findFitFontSizeForSmartArt = function (isParentWithChildren) {
+ const oSmartArtInfo = this.getSmartArtInfo();
- if (bCheck) {
- b = averageAmount;
- } else {
- a = averageAmount;
- }
- averageAmount = Math.floor((a + b) / 2);
- }
- this.setFontSizeInSmartArt(nOldFontSize);
- this.recalculateContent();
- return scalesForSmartArt[averageAmount];
- }
- return MAX_FONT_SIZE;
- }, this, []);
+ const maxFontSize = oSmartArtInfo.getMaxConstrFontSize(oSmartArtInfo.getAdaptFontSizeInfo().contentFillingType === AscCommon.smartArtContentFillingType_onlyChildren);
+ const minFontSize = oSmartArtInfo.getMinConstrFontSize();
+ return this.findFitFontSize(minFontSize, maxFontSize, false, isParentWithChildren);
};
CShape.prototype.getShapesForFitText = function () {
- return this.isObjectInSmartArt() ? this.group.group.getShapesForFitText(this) : [];
+ if (this.isObjectInSmartArt()) {
+ if (this.group.group.isCanGenerateSmartArt()) {
+ const smartArtInfo = this.getSmartArtInfo();
+ return smartArtInfo.getAdaptFontSizeInfo();
+ }
+ //todo
+ return {shapes: this.group.group.getShapesForFitText(this), contentFillingType: AscCommon.smartArtContentFillingType_onlyParent};
+ }
+ return [];
};
- CShape.prototype.setTruthFontSizeInSmartArt = function () {
+ CShape.prototype.isCanFitFontSize = function () {
const arrMainContentPoints = this.getSmartArtPointContent();
- if (!(arrMainContentPoints && arrMainContentPoints.length)) return;
- const bIsFitText = arrMainContentPoints.every(function (point) {
- return point && point.prSet && (typeof point.prSet.phldrT === "string") && !point.prSet.custT && !point.prSet.phldr;
- });
- let bIsPlaceholder = arrMainContentPoints.every(function (point) {
- return point && point.prSet && (typeof point.prSet.phldrT === "string") && !point.prSet.custT && point.prSet.phldr;
+ if (!(arrMainContentPoints && arrMainContentPoints.length)) {
+ return false;
+ }
+ return arrMainContentPoints.every(function (node) {
+ const point = node.point;
+ return point && point.prSet && !point.prSet.custT;
});
+ };
- if (!bIsFitText && !bIsPlaceholder) {
- return;
- }
- const oSmartArtInfo = this.getSmartArtInfo();
- if (oSmartArtInfo) {
- oSmartArtInfo.setMaxFontSize(this.findFitFontSizeForSmartArt());
- }
- const arrShapes = this.getShapesForFitText();
+ function fitSmartArtShapes(arrShapes, isParentWithChildren) {
const arrPlaceholders = [];
const arrFitText = [];
for (let i = 0; i < arrShapes.length; i += 1) {
const oShape = arrShapes[i];
var contentPoints = oShape.getSmartArtPointContent();
- const isPlaceholder = contentPoints.every(function (point) {
- return point && point.prSet && (typeof point.prSet.phldrT === "string") && !point.prSet.custT && point.prSet.phldr;
- });
- const isNotPlaceholder = contentPoints.every(function (point) {
- return point && point.prSet && (typeof point.prSet.phldrT === "string") && !point.prSet.custT && !point.prSet.phldr;
+
+ const isNotPlaceholder = contentPoints.every(function (node) {
+ const point = node.point;
+ return point && point.prSet && !point.prSet.custT;
+ }) && contentPoints.some(function (node) {
+ const point = node.point;
+ return point && point.prSet && !point.prSet.phldr;
});
- if (isPlaceholder) {
- arrPlaceholders.push(oShape);
- } else if (isNotPlaceholder) {
- arrFitText.push(oShape);
+ if (isNotPlaceholder) {
+ const oContent = oShape.getDocContent();
+ if (oContent && !oContent.Is_Empty({SkipEnd: true, SkipPlcHldr: false})) {
+ arrFitText.push(oShape);
+ }
+ } else {
+ const isPlaceholder = contentPoints.every(function (node) {
+ const point = node.point;
+ return point && point.prSet && (typeof point.prSet.phldrT === "string") && !point.prSet.custT && point.prSet.phldr;
+ });
+ if (isPlaceholder) {
+ arrPlaceholders.push(oShape);
+ }
}
}
@@ -4557,18 +4687,37 @@
const oShapeSmartArtInfo = oShape.getSmartArtInfo();
if (oShapeSmartArtInfo) {
if (!AscFormat.isRealNumber(oShapeSmartArtInfo.maxFontSize)) {
- oShapeSmartArtInfo.setMaxFontSize(oShape.findFitFontSizeForSmartArt());
+ oShapeSmartArtInfo.setMaxFontSize(oShape.findFitFontSizeForSmartArt(isParentWithChildren));
}
if (oShapeSmartArtInfo.maxFontSize < nFitFontSize) {
nFitFontSize = oShapeSmartArtInfo.maxFontSize;
}
}
}
+ const adaptRelationArrays = [];
for (let i = 0; i < arrFitText.length; i += 1) {
const oShape = arrFitText[i];
const nCurrentFontSize = oShape.getFirstFontSize();
+ const smartArtInfo = oShape.getSmartArtInfo();
if (nCurrentFontSize !== nFitFontSize) {
- oShape.setFontSizeInSmartArt(nFitFontSize, true);
+ oShape.setFontSizeInSmartArt(nFitFontSize, true, isParentWithChildren);
+ } else {
+ oShape.recalculate();
+ }
+
+ smartArtInfo.collectTextConstraintRelations(adaptRelationArrays);
+ }
+
+ for (let i = 0; i < adaptRelationArrays.length; i += 1) {
+ const presNodeArray = adaptRelationArrays[i];
+ if (presNodeArray.length) {
+ const editorShape = presNodeArray[0].contentNodes[0] && presNodeArray[0].contentNodes[0].getContentNode().getShape().editorShape;
+ if (editorShape) {
+ const smartArtInfo = editorShape.getSmartArtInfo();
+ if (AscFormat.isRealNumber(smartArtInfo.maxFontSize)) {
+ editorShape.setTruthFontSizeInSmartArt(true);
+ }
+ }
}
}
@@ -4578,16 +4727,44 @@
const oPlaceholderSmartArtInfo = oShape.getSmartArtInfo();
if (oPlaceholderSmartArtInfo) {
if (!AscFormat.isRealNumber(oPlaceholderSmartArtInfo.maxFontSize)) {
- oPlaceholderSmartArtInfo.setMaxFontSize(oShape.findFitFontSizeForSmartArt());
+ oPlaceholderSmartArtInfo.setMaxFontSize(oShape.findFitFontSizeForSmartArt(isParentWithChildren));
}
const nPlaceholderFontSize = Math.min(oPlaceholderSmartArtInfo.maxFontSize, nFitFontSize);
if (nCurrentFontSize !== nPlaceholderFontSize) {
- oShape.setFontSizeInSmartArt(nPlaceholderFontSize, true);
+ oShape.setFontSizeInSmartArt(nPlaceholderFontSize, true, isParentWithChildren);
+ } else {
+ oShape.recalculate();
}
} else if (nCurrentFontSize !== nFitFontSize) {
- oShape.setFontSizeInSmartArt(nFitFontSize, true);
+ oShape.setFontSizeInSmartArt(nFitFontSize, true, isParentWithChildren);
+ } else {
+ oShape.recalculate();
+ }
+ }
+ }
+ CShape.prototype.setTruthFontSizeInSmartArt = function (updateAllMaxFontSize) {
+ let arrShapes;
+ if (updateAllMaxFontSize) {
+ arrShapes = this.getShapesForFitText();
+ for (let i = 0; i < arrShapes.shapes.length; i += 1) {
+ const shape = arrShapes.shapes[i];
+ const oSmartArtInfo = shape.getSmartArtInfo();
+ if (oSmartArtInfo) {
+ oSmartArtInfo.setMaxFontSize(null);
+ }
+ }
+ } else {
+ if (!this.isCanFitFontSize()) {
+ return;
+ }
+ arrShapes = this.getShapesForFitText();
+ const oSmartArtInfo = this.getSmartArtInfo();
+ if (oSmartArtInfo) {
+ oSmartArtInfo.setMaxFontSize(null);
}
}
+
+ fitSmartArtShapes(arrShapes.shapes, arrShapes.contentFillingType === AscCommon.smartArtContentFillingType_parentWithChildren);
};
CShape.prototype.checkExtentsByDocContent = function (bForce, bNeedRecalc) {
@@ -4758,7 +4935,8 @@
return !paragraph.Is_Empty({SkipEnd: true, SkipPlcHldr: false});
});
if (isNotEmptyShape) {
- pointContent.forEach(function (point) {
+ pointContent.forEach(function (node) {
+ const point = node.point;
point.prSet.setPhldr(false);
})
this.txBody.content2 = null;
@@ -5355,7 +5533,7 @@
this.isPlaceholder && this.isPlaceholder()) {
bMasterPh = true;
}
- if ((!graphics.isSmartArtPreviewDrawer && !graphics.isPdf() && !this.bWordShape && (this.isEmptyPlaceholder() || bMasterPh) && !(this.parent && this.parent.kind === AscFormat.TYPE_KIND.NOTES) && !(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill)) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter)
+ if (/*(!(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill)) && AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN) || */(!graphics.isSmartArtPreviewDrawer && !graphics.isPdf() && !this.bWordShape && (this.isEmptyPlaceholder() && !this.isObjectInSmartArt() || bMasterPh) && !(this.parent && this.parent.kind === AscFormat.TYPE_KIND.NOTES) && !(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill)) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter)
|| (Asc.editor.isPdfEditor() && !graphics.isPdf() && !graphics.isSmartArtPreviewDrawer && this.IsDrawing && this.IsDrawing() && this.ShouldDrawImaginaryBorder(graphics) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter)) {
var drawingObjects = this.getDrawingObjectsController();
if (typeof editor !== "undefined" && editor && graphics.m_oContext !== undefined && graphics.m_oContext !== null && !graphics.isTrack() && (Asc.editor.isPdfEditor() || !drawingObjects || AscFormat.getTargetTextObject(drawingObjects) !== this)) {
@@ -5930,6 +6108,9 @@
var unifill2 = AscFormat.CorrectUniFill(unifill, this.brush, this.getEditorType());
unifill2.convertToPPTXMods();
this.setFill(unifill2);
+ if(this.useBgFill) {
+ this.setUseBgFill(null);
+ }
var point = this.getSmartArtShapePoint();
if (point) {
point.setUniFill(unifill2);
@@ -6753,6 +6934,91 @@
return true;
};
+ CShape.prototype.checkEditTextStyle = function (fDocContentMethod, params, bSelect) {
+ let nParentType = null;
+ if(this.parent && this.parent.getObjectType) {
+ nParentType = this.parent.getObjectType();
+ }
+ if(nParentType !== AscDFH.historyitem_type_SlideMaster &&
+ nParentType !== AscDFH.historyitem_type_SlideLayout) {
+ return false;
+ }
+ if(!this.isPlaceholder()) {
+ return false;
+ }
+ let oTxBody = this.txBody;
+ if(!oTxBody) {
+ return false;
+ }
+ let oContent = oTxBody.content;
+ if(!oContent) {
+ return false;
+ }
+ let oParaPrToApply = new AscWord.CParaPr();
+ let bIncreaseFontSize = null;
+ let oDCP = AscFormat.CDrawingDocContent.prototype;
+ if(fDocContentMethod === oDCP.Set_ParagraphPresentationNumbering) {
+ oParaPrToApply.Bullet = params[0];
+ }
+ else if(fDocContentMethod === oDCP.SetParagraphIndent) {
+ oParaPrToApply.Ind = new CParaInd();
+ oParaPrToApply.Ind.Set_FromObject(params[0]);
+ }
+ else if(fDocContentMethod === oDCP.ClearParagraphFormatting) {
+ oParaPrToApply = null;
+ if(nParentType === AscDFH.historyitem_type_SlideMaster) {
+ return true;
+ }
+ }
+ else if(fDocContentMethod === oDCP.SetParagraphSpacing) {
+ oParaPrToApply.Spacing = new CParaSpacing();
+ oParaPrToApply.Spacing.Set_FromObject(params[0]);
+ }
+ else if(fDocContentMethod === oDCP.IncreaseDecreaseFontSize) {
+ bIncreaseFontSize = params[0];
+ }
+ else if(fDocContentMethod === oDCP.SetParagraphAlign) {
+ oParaPrToApply.Jc = params[0];
+ }
+ else if(fDocContentMethod === CDocumentContent.prototype.AddToParagraph && params[0].Type === para_TextPr) {
+ oParaPrToApply.DefaultRunPr = params[0].Value;
+ }
+ else {
+ return false;
+ }
+
+ let oTextStyles;
+ if(oTxBody.lstStyle) {
+ oTextStyles = oTxBody.lstStyle.createDuplicate();
+ }
+ else {
+ oTextStyles = new AscFormat.TextListStyle();
+ }
+ if(bSelect) {
+ let oLvls = {};
+ let aParagraphs = [];
+ oContent.GetCurrentParagraph(false, aParagraphs, {});
+ for(let nIdx = 0; nIdx < aParagraphs.length; ++nIdx) {
+ let oParagraph = aParagraphs[nIdx];
+ let nLvl = 0;
+ if(AscFormat.isRealNumber(oParagraph.Pr.Lvl)) {
+ nLvl = oParagraph.Pr.Lvl;
+ }
+ if(!oLvls[nLvl]) {
+ oTextStyles.applyParaPr(nLvl, oParaPrToApply, bIncreaseFontSize, this);
+ oLvls[nLvl] = true;
+ }
+ }
+ }
+ else {
+ for(let nLvl = 0; nLvl < 9; ++nLvl) {
+ oTextStyles.applyParaPr(nLvl, oParaPrToApply, bIncreaseFontSize, this);
+ }
+ }
+ oTxBody.setLstStyle(oTextStyles);
+ return true;
+ };
+
CShape.prototype.pasteFormatting = function (oFormatData) {
if(!oFormatData)
return;
@@ -6953,6 +7219,7 @@
}
return oCurCandidate;
};
+ CShape.prototype.checkDrawingPartWithHistory = function () {};
function CreateBinaryReader(szSrc, offset, srcLen) {
var memoryData = AscCommon.Base64.decode(szSrc, true, srcLen, offset);
@@ -7093,4 +7360,5 @@
window['AscFormat'].SaveContentSourceFormatting = SaveContentSourceFormatting;
window['AscFormat'].hitToHandles = hitToHandles;
window['AscFormat'].pHText = pHText;
+ window['AscFormat'].fitSmartArtShapes = fitSmartArtShapes;
})(window);
diff --git a/common/Drawings/Format/SlicerView.js b/common/Drawings/Format/SlicerView.js
index 839331a6ff..6f5a15fd9d 100644
--- a/common/Drawings/Format/SlicerView.js
+++ b/common/Drawings/Format/SlicerView.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Format/TextBody.js b/common/Drawings/Format/TextBody.js
index 23bdab5973..6ce55042dc 100644
--- a/common/Drawings/Format/TextBody.js
+++ b/common/Drawings/Format/TextBody.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -232,6 +232,11 @@
if(Data.Type === AscDFH.historyitem_TextBodySetBodyPr) {
this.recalcInfo.recalculateBodyPr = true;
}
+ if(Data.Type === AscDFH.historyitem_TextBodySetLstStyle) {
+ if(this.content) {
+ this.content.Recalc_AllParagraphs_CompiledPr();
+ }
+ }
}
};
CTextBody.prototype.isEmpty = function() {
@@ -247,7 +252,7 @@
};
CTextBody.prototype.Get_AbsolutePage = function(CurPage) {
if(this.parent && this.parent.Get_AbsolutePage) {
- return this.parent.Get_AbsolutePage();
+ return this.parent.Get_AbsolutePage(CurPage);
}
return 0;//TODO;
};
@@ -317,7 +322,7 @@
};
CTextBody.prototype.draw = function(graphics) {
if((!this.content || this.content.Is_Empty()) && !AscCommon.IsShapeToImageConverter && this.parent.isEmptyPlaceholder() && !this.checkCurrentPlaceholder()) {
- if(graphics.IsNoDrawingEmptyPlaceholder !== true && graphics.IsNoDrawingEmptyPlaceholderText !== true && this.content2 && !graphics.isPdf()) {
+ if(/*AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN || */graphics.IsNoDrawingEmptyPlaceholder !== true && graphics.IsNoDrawingEmptyPlaceholderText !== true && this.content2 && !graphics.isPdf()) {
if(!graphics.isSupportTextDraw()) {
let _w2 = this.content2.XLimit;
let _h2 = this.content2.GetSummaryHeight();
@@ -541,7 +546,7 @@
return max_width;
};
CTextBody.prototype.getMaxContentWidth = function(maxWidth, bLeft) {
- this.content.Reset(0, 0, maxWidth - 0.01, 20000);
+ this.content.Reset(0, 0, maxWidth, 20000);
if(bLeft) {
this.content.SetApplyToAll(true);
this.content.SetParagraphAlign(AscCommon.align_Left);
@@ -556,7 +561,7 @@
max_width = paragraph_lines[j].Ranges[0].W;
}
}
- return max_width + 0.01;
+ return Math.max(max_width, 0.01);
};
CTextBody.prototype.GetPrevElementEndInfo = function(CurElement) {
return null;
diff --git a/common/Drawings/GraphicsBase.js b/common/Drawings/GraphicsBase.js
index 8a95a8e205..30426908c1 100644
--- a/common/Drawings/GraphicsBase.js
+++ b/common/Drawings/GraphicsBase.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/HatchPattern.js b/common/Drawings/HatchPattern.js
index c2f35bbfb6..61287438e1 100644
--- a/common/Drawings/HatchPattern.js
+++ b/common/Drawings/HatchPattern.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Hit.js b/common/Drawings/Hit.js
index 4a56d4e705..de7d24b7b9 100644
--- a/common/Drawings/Hit.js
+++ b/common/Drawings/Hit.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/Metafile.js b/common/Drawings/Metafile.js
index 457090d05a..ad4730c808 100644
--- a/common/Drawings/Metafile.js
+++ b/common/Drawings/Metafile.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1205,6 +1205,16 @@
this.WriteXmlAttributeDouble(name, val)
}
};
+ this.WriteXmlNullableAttributeAnyNumber = function(name, val)
+ {
+ if (null !== val && undefined !== val) {
+ if (val === Infinity) {
+ this.WriteXmlAttributeString(name, "INF");
+ } else {
+ this.WriteXmlAttributeDouble(name, val);
+ }
+ }
+ };
this.WriteXmlNullableAttributeNumber = function(name, val)
{
if (null !== val && undefined !== val) {
@@ -1544,6 +1554,8 @@
this.ctAnnotFieldDelete = 165;
this.ctWidgetsInfo = 166;
+ this.ctHeadings = 169;
+
this.ctPageWidth = 200;
this.ctPageHeight = 201;
@@ -3373,6 +3385,111 @@
}
};
+ function WriteHeadings(memory, headings)
+ {
+ if (!headings.length)
+ return;
+
+ memory.WriteByte(CommandType.ctHeadings);
+
+ let nStartPos = memory.GetCurPosition();
+ memory.Skip(4);
+
+ memory.WriteLong(headings.length);
+ for (let i = 0; i < headings.length; ++i)
+ {
+ memory.WriteLong(headings[i].lvl);
+ memory.WriteLong(headings[i].page);
+ memory.WriteDouble(headings[i].x);
+ memory.WriteDouble(headings[i].y);
+ memory.WriteString(headings[i].desc);
+ }
+
+ let nEndPos = memory.GetCurPosition();
+ memory.Seek(nStartPos);
+ memory.WriteLong(nEndPos - nStartPos);
+ memory.Seek(nEndPos);
+ }
+
+ function AddHeading(headings, posXY, lvl, text)
+ {
+ if (!posXY)
+ return;
+
+ let x = posXY.X;
+ let y = posXY.Y;
+ if (posXY.Transform)
+ {
+ x = posXY.Transform.TransformPointX(posXY.X, posXY.Y);
+ y = posXY.Transform.TransformPointY(posXY.X, posXY.Y);
+ }
+
+ headings.push({
+ lvl : lvl,
+ page : posXY.PageNum,
+ x : x,
+ y : y,
+ desc : text
+ });
+ }
+
+ function GetHeadingsByHeadings(logicDocument)
+ {
+ let docOutline = logicDocument.GetDocumentOutline();
+ let isUse = docOutline.IsUse();
+ if (!isUse)
+ docOutline.SetUse(true);
+
+ let count = docOutline.GetElementsCount();
+ let headings = [];
+ for (let i = 0; i < count; ++i)
+ {
+ let posXY = docOutline.GetDestinationXY(i);
+ AddHeading(headings, posXY, docOutline.GetLevel(i), docOutline.GetText(i));
+ }
+
+ if (!isUse)
+ docOutline.SetUse(false);
+
+ return headings;
+ }
+
+ function GetHeadingsByBookmarks(logicDocument)
+ {
+ let bookmarkManager = logicDocument.GetBookmarksManager();
+
+ let count = bookmarkManager.GetCount();
+ let headings = [];
+ for (let i = 0; i < count; ++i)
+ {
+ let name = bookmarkManager.GetName(i);
+ if (bookmarkManager.IsHiddenBookmark(name))
+ continue;
+
+ let bookmarkStart = bookmarkManager.GetBookmarkStart(i);
+ if (!bookmarkStart)
+ continue;
+
+ let posXY = bookmarkStart.GetDestinationXY();
+ AddHeading(headings, posXY, 0, name);
+ }
+
+ return headings;
+ }
+ CDocumentRenderer.prototype.AddHeadings = function(logicDocument, byHeadings)
+ {
+ if (!logicDocument)
+ return;
+
+ let headings;
+ if (byHeadings)
+ headings = GetHeadingsByHeadings(logicDocument);
+ else
+ headings = GetHeadingsByBookmarks(logicDocument);
+
+ WriteHeadings(this.Memory, headings);
+ };
+
var MATRIX_ORDER_PREPEND = 0;
var MATRIX_ORDER_APPEND = 1;
diff --git a/common/Drawings/States.js b/common/Drawings/States.js
index e17bd707cc..c4546d5945 100644
--- a/common/Drawings/States.js
+++ b/common/Drawings/States.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1044,6 +1044,7 @@ RotateState.prototype =
History.Create_NewPoint(AscDFH.historydescription_CommonDrawings_CopyCtrl);
for(i = 0; i < tracks.length; ++i)
{
+ tracks[i].checkDrawingPartWithHistory();
copy = tracks[i].originalObject.copy(oCopyPr);
oIdMap[tracks[i].originalObject.Id] = copy.Id;
this.drawingObjects.drawingObjects.getWorksheetModel && copy.setWorksheet(this.drawingObjects.drawingObjects.getWorksheetModel());
@@ -1241,6 +1242,7 @@ RotateState.prototype =
this.drawingObjects.checkSelectedObjectsAndCallback(function () {
for(i = 0; i < tracks.length; ++i){
+ tracks[i].checkDrawingPartWithHistory();
tracks[i].trackEnd(false, bFlag);
}
if(tracks.length === 1 && tracks[0].chartSpace){
diff --git a/common/Drawings/TextDrawer.js b/common/Drawings/TextDrawer.js
index 0b4b3288e5..7189ab3850 100644
--- a/common/Drawings/TextDrawer.js
+++ b/common/Drawings/TextDrawer.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/TrackObjects/AdjustmentTracks.js b/common/Drawings/TrackObjects/AdjustmentTracks.js
index 0dd75683d8..ef8514820b 100644
--- a/common/Drawings/TrackObjects/AdjustmentTracks.js
+++ b/common/Drawings/TrackObjects/AdjustmentTracks.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -308,6 +308,7 @@ XYAdjustmentTrack.prototype.trackEnd = function()
}
};
+XYAdjustmentTrack.prototype.checkDrawingPartWithHistory = function () {};
function PolarAdjustmentTrack(originalShape, adjIndex, bTextWarp)
{
@@ -527,6 +528,7 @@ function PolarAdjustmentTrack(originalShape, adjIndex, bTextWarp)
}
};
+ this.checkDrawingPartWithHistory = function () {};
}
PolarAdjustmentTrack.prototype.getBounds = XYAdjustmentTrack.prototype.getBounds;
diff --git a/common/Drawings/TrackObjects/ConnectorTrack.js b/common/Drawings/TrackObjects/ConnectorTrack.js
index fce462fb9d..77b4060e51 100644
--- a/common/Drawings/TrackObjects/ConnectorTrack.js
+++ b/common/Drawings/TrackObjects/ConnectorTrack.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/TrackObjects/GeometryEditTrack.js b/common/Drawings/TrackObjects/GeometryEditTrack.js
index ab516d67d4..dee636c793 100644
--- a/common/Drawings/TrackObjects/GeometryEditTrack.js
+++ b/common/Drawings/TrackObjects/GeometryEditTrack.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -504,7 +504,15 @@
return {OffX: dOffX, OffY: dOffY};
};
-
+ EditShapeGeometryTrack.prototype.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.checkDrawingPartWithHistory) {
+ const newObject = this.originalObject.checkDrawingPartWithHistory();
+ if (newObject) {
+ this.originalObject = newObject;
+ this.originalShape = newObject;
+ }
+ }
+ };
EditShapeGeometryTrack.prototype.trackEnd = function(bWord) {
this.addCommandsInPathInfo();
//set new extents
diff --git a/common/Drawings/TrackObjects/MoveTracks.js b/common/Drawings/TrackObjects/MoveTracks.js
index 67e7e902e4..732e096414 100644
--- a/common/Drawings/TrackObjects/MoveTracks.js
+++ b/common/Drawings/TrackObjects/MoveTracks.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -251,7 +251,16 @@ function MoveShapeImageTrack(originalObject)
}
this.overlayObject.draw(overlay);
};
-
+ this.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.checkDrawingPartWithHistory) {
+
+ const newObject = this.originalObject.checkDrawingPartWithHistory();
+ if (newObject) {
+ this.originalObject = newObject;
+ this.originalShape = newObject;
+ }
+ }
+ };
this.trackEnd = function(bWord, bNoResetCnx)
{
if(!this.bIsTracked)
@@ -574,7 +583,11 @@ function MoveGroupTrack(originalObject)
bounds_checker.Bounds.extY = this.originalObject.extY;
return bounds_checker.Bounds;
};
-
+ this.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.checkDrawingPartWithHistory) {
+ this.originalObject.checkDrawingPartWithHistory();
+ }
+ };
this.trackEnd = function(bWord)
{
if(!this.bIsTracked){
@@ -659,23 +672,24 @@ function MoveComment(comment)
boundsChecker.Bounds.extY = H;
return boundsChecker.Bounds;
};
+ this.checkDrawingPartWithHistory = function () {};
}
function MoveAnnotationTrack(originalObject)
{
this.bIsTracked = false;
this.originalObject = originalObject;
- this.x = originalObject._pagePos.x;
- this.y = originalObject._pagePos.y;
- this.viewer = editor.getDocumentRenderer();
+ this.x = originalObject._origRect[0];
+ this.y = originalObject._origRect[1];
+ this.viewer = Asc.editor.getDocumentRenderer();
this.objectToDraw = originalObject.LazyCopy();
this.pageIndex = originalObject.GetPage();
this.track = function(dx, dy, pageIndex)
{
this.bIsTracked = true;
- this.x = this.originalObject._pagePos.x + dx * AscCommon.g_dKoef_mm_to_pix;
- this.y = this.originalObject._pagePos.y + dy * AscCommon.g_dKoef_mm_to_pix;
+ this.x = originalObject._origRect[0] + dx * g_dKoef_mm_to_pt;
+ this.y = originalObject._origRect[1] + dy * g_dKoef_mm_to_pt;
this.pageIndex = pageIndex;
this.initCanvas();
@@ -790,6 +804,7 @@ function MoveAnnotationTrack(originalObject)
{
return {x: this.x, y: this.y};
};
+ this.checkDrawingPartWithHistory = function () {};
this.initCanvas(true);
}
@@ -903,6 +918,7 @@ function MoveChartObjectTrack(oObject, oChartSpace)
boundsChecker.Bounds.extY = oObject.extY;
return boundsChecker.Bounds;
};
+ this.checkDrawingPartWithHistory = function () {};
}
@@ -1001,6 +1017,7 @@ function MoveChartObjectTrack(oObject, oChartSpace)
oBounds.extY = oBounds.max_y - oBounds.min_y;
return oBounds;
};
+ CGuideTrack.prototype.checkDrawingPartWithHistory = function () {};
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
diff --git a/common/Drawings/TrackObjects/NewShapeTracks.js b/common/Drawings/TrackObjects/NewShapeTracks.js
index 39ca5a9709..5ae42a02aa 100644
--- a/common/Drawings/TrackObjects/NewShapeTracks.js
+++ b/common/Drawings/TrackObjects/NewShapeTracks.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -109,7 +109,7 @@
SHAPE_ASPECTS["accentBorderCallout2"] = 914400/612648;
SHAPE_ASPECTS["accentBorderCallout3"] = 914400/612648;
-function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, pageIndex, drawingsController, nPlaceholderType, bVertical)
+function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, pageIndex, drawingsController, nPlaceholderType, bVertical, bSkipCheckConnector)
{
this.presetGeom = presetGeom;
this.startX = startX;
@@ -141,7 +141,7 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
AscFormat.ExecuteNoHistory(function(){
- if(this.drawingsController && !this.drawingsController.document){
+ if(!bSkipCheckConnector && this.drawingsController && !this.drawingsController.document){
this.bConnector = AscFormat.isConnectorPreset(presetGeom);
if(this.bConnector){
@@ -688,10 +688,18 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
{
if(this.presetGeom && this.presetGeom.indexOf("textRect") === 0)
{
+ let isPdf = Asc.editor.isPdfEditor();
+
shape.spPr.setGeometry(AscFormat.CreateGeometry("rect"));
shape.setTxBox(true);
var fill, ln;
- if(!drawingObjects || !drawingObjects.cSld)
+ if((drawingObjects && drawingObjects.cSld) || isPdf)
+ {
+ fill = new AscFormat.CUniFill();
+ fill.setFill(new AscFormat.CNoFill());
+ shape.spPr.setFill(fill);
+ }
+ else
{
if(!bFromWord)
{
@@ -712,13 +720,7 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
ln.Fill.fill.setColor(new AscFormat.CUniColor());
ln.Fill.fill.color.setColor(new AscFormat.CPrstColor());
ln.Fill.fill.color.color.setId("black");
- shape.spPr.setLn(ln);
- }
- else
- {
- fill = new AscFormat.CUniFill();
- fill.setFill(new AscFormat.CNoFill());
- shape.spPr.setFill(fill);
+ shape.spPr.setLn(ln);
}
var body_pr = new AscFormat.CBodyPr();
body_pr.setDefault();
diff --git a/common/Drawings/TrackObjects/PolyLine.js b/common/Drawings/TrackObjects/PolyLine.js
index d0a31ce265..f5f3017762 100644
--- a/common/Drawings/TrackObjects/PolyLine.js
+++ b/common/Drawings/TrackObjects/PolyLine.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/TrackObjects/ResizeTracks.js b/common/Drawings/TrackObjects/ResizeTracks.js
index 326ab0e517..cb837c1d76 100644
--- a/common/Drawings/TrackObjects/ResizeTracks.js
+++ b/common/Drawings/TrackObjects/ResizeTracks.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -522,43 +522,36 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController
// этот метод обрабатывает данный случай и корректирует координаты
let oFreeText = this.originalObject.group;
- let oFreeTextRect = oFreeText.GetTextBoxRect(true).map(function(measure) {
- return measure * AscCommon.g_dKoef_pix_to_mm;
+ let oFreeTextRect = oFreeText.GetTextBoxRect().map(function(measure) {
+ return measure * g_dKoef_pt_to_mm;
});
let aCallout = oFreeText.GetCallout();
let oExitPoint = undefined; // перпендикулярная линия выходящая из freetext аннотации
let oCalloutArrowPt = undefined; // x2, y2 точка линии (точка начала стрелки)
let oCalloutArrowEndPt = undefined; // x1, y1 точка линии (точка конца стрелки)
- let oViewer = Asc.editor.getDocumentRenderer();
- let nPage = oFreeText.GetPage();
- let nScaleY = oViewer.drawingPages[nPage].H / oViewer.file.pages[nPage].H / oViewer.zoom * AscCommon.g_dKoef_pix_to_mm;
- let nScaleX = oViewer.drawingPages[nPage].W / oViewer.file.pages[nPage].W / oViewer.zoom * AscCommon.g_dKoef_pix_to_mm;
if (aCallout && aCallout.length == 6) {
// точка выхода callout из аннотации
oExitPoint = {
- x: (aCallout[2 * 2]) * nScaleX,
- y: (aCallout[2 * 2 + 1]) * nScaleY
+ x: (aCallout[2 * 2]) * g_dKoef_pt_to_mm,
+ y: (aCallout[2 * 2 + 1]) * g_dKoef_pt_to_mm
};
// x2, y2 линии
oCalloutArrowPt = {
- x: aCallout[1 * 2] * nScaleX,
- y: (aCallout[1 * 2 + 1]) * nScaleY
+ x: aCallout[1 * 2] * g_dKoef_pt_to_mm,
+ y: (aCallout[1 * 2 + 1]) * g_dKoef_pt_to_mm
};
oCalloutArrowEndPt = {
- x: aCallout[0 * 2] * nScaleX,
- y: (aCallout[0 * 2 + 1]) * nScaleY
+ x: aCallout[0 * 2] * g_dKoef_pt_to_mm,
+ y: (aCallout[0 * 2 + 1]) * g_dKoef_pt_to_mm
}
}
else {
return;
}
- let nFreeTextW = oFreeTextRect[2] - oFreeTextRect[0];
- let nFreeTextH = oFreeTextRect[3] - oFreeTextRect[1];
-
if (this.numberHandle == 4) {
// если x начала стрелки находится в пределах ректа аннотации то фиксируем x
if (oCalloutArrowPt.x < oFreeTextRect[0] || oCalloutArrowPt.x > oFreeTextRect[2]) {
@@ -574,8 +567,8 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController
this.correctXYForPdfFreeText = function(x, y) {
let oFreeText = this.originalObject.group;
let aCallout = oFreeText.GetCallout(true);
- let aCalloutMM = aCallout ? aCallout.map(function(measure) {return measure * AscCommon.g_dKoef_pix_to_mm}) : undefined;
- let aTextBoxRectMM = oFreeText.GetTextBoxRect(true).map(function(measure) {return measure * AscCommon.g_dKoef_pix_to_mm});
+ let aCalloutMM = aCallout ? aCallout.map(function(measure) {return measure * g_dKoef_pt_to_mm}) : undefined;
+ let aTextBoxRectMM = oFreeText.GetTextBoxRect().map(function(measure) {return measure * g_dKoef_pt_to_mm});
let nExitPos = oFreeText.GetCalloutExitPos();
if (!aCalloutMM)
@@ -968,7 +961,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController
this.resizedflipV = false;
}
- if (Asc.editor.isPdfEditor() && this.originalObject.IsPdfObject) {
+ if (Asc.editor.isPdfEditor() && this.originalObject.IsAnnot()) {
let xMin = this.resizedPosX;
let xMax = this.resizedPosX + this.resizedExtX;
let yMin = this.resizedPosY;
@@ -1284,6 +1277,11 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController
return;
}
+ if (this.originalObject.IsAnnot && this.originalObject.IsAnnot()) {
+ // changed size in SetRect method
+ return;
+ }
+
if(this.originalObject.animMotionTrack)
{
this.originalObject.updateAnimation(this.resizedPosX, this.resizedPosY,
@@ -1565,6 +1563,14 @@ function ResizeTrackShapeImage(originalObject, cardDirection, drawingsController
}
};
+ this.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.checkDrawingPartWithHistory) {
+ const newObject = this.originalObject.checkDrawingPartWithHistory();
+ if (newObject) {
+ this.originalObject = newObject;
+ }
+ }
+ };
}, this, []);
}
@@ -2295,6 +2301,15 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
};
+ this.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.getObjectType && this.originalObject.getObjectType() === AscDFH.historyitem_type_SmartArt) {
+ this.originalObject.checkDrawingPartWithHistory();
+ }
+ for(var i = 0; i < this.childs.length; ++i)
+ {
+ this.childs[i].checkDrawingPartWithHistory();
+ }
+ };
}, this, []);
@@ -2455,6 +2470,7 @@ function ShapeForResizeInGroup(originalObject, parentTrack)
if(this.parentTrack)
global_MatrixTransformer.MultiplyAppend(t, this.parentTrack.transform);
};
+ this.checkDrawingPartWithHistory = function () {};
}, this, []);
}
diff --git a/common/Drawings/TrackObjects/RotateTracks.js b/common/Drawings/TrackObjects/RotateTracks.js
index 958e94474f..3a2933b27d 100644
--- a/common/Drawings/TrackObjects/RotateTracks.js
+++ b/common/Drawings/TrackObjects/RotateTracks.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -510,6 +510,14 @@ function RotateTrackShapeImage(originalObject)
boundsChecker.Bounds.extY = this.originalObject.extY;
return boundsChecker.Bounds;
}
+ this.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.checkDrawingPartWithHistory) {
+ const newObject = this.originalObject.checkDrawingPartWithHistory();
+ if (newObject) {
+ this.originalObject = newObject;
+ }
+ }
+ };
}
function RotateTrackGroup(originalObject)
@@ -654,6 +662,11 @@ function RotateTrackGroup(originalObject)
}
this.originalObject.spPr.xfrm.setRot(this.angle);
}
+ this.checkDrawingPartWithHistory = function () {
+ if (this.originalObject.checkDrawingPartWithHistory) {
+ this.originalObject.checkDrawingPartWithHistory()
+ }
+ };
}
function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY)
@@ -935,6 +948,7 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY)
}
oChartSpace.changeView3d(this.view3D.createDuplicate());
}
+ this.checkDrawingPartWithHistory = function () {};
}
//--------------------------------------------------------export----------------------------------------------------
diff --git a/common/Drawings/TrackObjects/Spline.js b/common/Drawings/TrackObjects/Spline.js
index 8df6d183b9..51584ed909 100644
--- a/common/Drawings/TrackObjects/Spline.js
+++ b/common/Drawings/TrackObjects/Spline.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Drawings/WorkEvents.js b/common/Drawings/WorkEvents.js
index 5cd7712eb6..eaa6d9cbe4 100644
--- a/common/Drawings/WorkEvents.js
+++ b/common/Drawings/WorkEvents.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -67,7 +67,7 @@
var isUsePointerEvents = true;
if (AscBrowser.isChrome && (AscBrowser.chromeVersion <= 70)) // xp
isUsePointerEvents = false;
- else if (AscBrowser.isSafari && (AscBrowser.safariVersion < 17004001))
+ else if (AscBrowser.isSafari && (AscBrowser.safariVersion < 15000000))
isUsePointerEvents = false;
else if (AscBrowser.isIE)
isUsePointerEvents = false;
@@ -104,6 +104,7 @@
this.Y = 0; // позиция курсора Y
this.Button = g_mouse_button_left; // кнопка мыши
+ this.ButtonOverride = -1;
this.Type = g_mouse_event_type_move; // тип евента
this.AltKey = false; // нажата ли кнопка alt
@@ -333,6 +334,8 @@
function getMouseButton(e)
{
+ if (-1 !== global_mouseEvent.ButtonOverride)
+ return global_mouseEvent.ButtonOverride;
var res = e.button;
return (res && -1 !== res) ? res : 0;
}
@@ -755,8 +758,9 @@
return oEvent.defaultPrevented;
}
- function PaintMessageLoop(interval)
+ function PaintMessageLoop(interval, api)
{
+ this.isUseInterval = api.isMobileVersion !== true;
this.interval = interval || 40;
this.id = null;
@@ -772,7 +776,7 @@
window.oCancelRequestAnimationFrame ||
window.msCancelRequestAnimationFrame || null;
- this.isUseRequestAnimationFrame = AscCommon.AscBrowser.isChrome;
+ this.isUseRequestAnimationFrame = AscCommon.AscBrowser.isChrome || AscCommon.AscBrowser.isSafari;
if (this.isUseRequestAnimationFrame && !this.requestAnimationFrame)
this.isUseRequestAnimationFrame = false;
@@ -819,7 +823,7 @@
PaintMessageLoop.prototype._animation = function()
{
var now = Date.now();
- if (-1 === this.requestAnimationOldTime || (now >= (this.requestAnimationOldTime + 40)) || (now < this.requestAnimationOldTime))
+ if (!this.isUseInterval || -1 === this.requestAnimationOldTime || (now >= (this.requestAnimationOldTime + this.interval)) || (now < this.requestAnimationOldTime))
{
this.requestAnimationOldTime = now;
this.engine();
diff --git a/common/ExternalDataLoader.js b/common/ExternalDataLoader.js
index b3de9bb88c..92e3066341 100644
--- a/common/ExternalDataLoader.js
+++ b/common/ExternalDataLoader.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/GlobalLoaders.js b/common/GlobalLoaders.js
index 705919db67..d0fc99113f 100644
--- a/common/GlobalLoaders.js
+++ b/common/GlobalLoaders.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -330,6 +330,50 @@
info && info.LoadFontsFromServer(this);
}
};
+
+ this.LoadFonts = function(fonts, callback)
+ {
+ let fontMap = {}
+
+ if (fonts && Array.isArray(fonts))
+ {
+ for (let i = 0; i < fonts.length; ++i)
+ {
+ let name = fonts[i];
+ fontMap[name] = AscFonts.g_fontApplication.GetFontInfo(name);
+ fontMap[name].NeedStyles = 15;
+ }
+ }
+ else
+ {
+ for (let name in fonts)
+ {
+ fontMap[name] = AscFonts.g_fontApplication.GetFontInfo(name);
+ fontMap[name].NeedStyles = 15;
+ }
+ }
+
+
+ let globalLoader = this;
+
+ let checkLoaded = function()
+ {
+ let needLoad = 0;
+ for (let name in fontMap)
+ {
+ if (!fontMap[name].CheckFontLoadStyles(globalLoader))
+ delete fontMap[name];
+ else
+ ++needLoad;
+ }
+
+ if (needLoad)
+ setTimeout(checkLoaded, 50);
+ else if (callback)
+ callback();
+ };
+ checkLoaded();
+ }
}
function CGlobalImageLoader()
@@ -424,16 +468,16 @@
}
// сначала заполним массив
- if (this.ThemeLoader == null)
- this.Api.asyncImagesDocumentStartLoaded();
- else
- this.ThemeLoader.asyncImagesStartLoaded();
this.images_loading = [];
for (let id in images)
{
this.images_loading[this.images_loading.length] = AscCommon.getFullImageSrc2(images[id]);
}
+ if (this.ThemeLoader == null)
+ this.Api.asyncImagesDocumentStartLoaded(this.images_loading);
+ else
+ this.ThemeLoader.asyncImagesStartLoaded(this.images_loading);
if (!this.bIsAsyncLoadDocumentImages)
{
diff --git a/common/HistoryCommon.js b/common/HistoryCommon.js
index 708f8883d1..946c71fa18 100644
--- a/common/HistoryCommon.js
+++ b/common/HistoryCommon.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1210,6 +1210,7 @@
break;
case AscDFH.historydescription_Document_ConvertTableToText:
sString = "Document_ConvertTableToText";
+ break;
case AscDFH.historydescription_Document_ResolveAllComments:
sString = "Document_ResolveAllComments";
break;
@@ -1224,6 +1225,7 @@
break;
case AscDFH.historydescription_Document_ConvertMathView:
sString = "Document_ConvertMathView";
+ break;
case AscDFH.historydescription_Document_ConvertMathDisplayMode:
sString = "Document_ConvertMathDisplayMode";
break;
@@ -1291,13 +1293,37 @@
sString = "Document_ComplexField_MergeFormat";
break;
case AscDFH.historydescription_Presentation_ResetSlideBackground:
- sString = "historydescription_Presentation_ResetSlideBackground";
+ sString = "Presentation_ResetSlideBackground";
break;
case AscDFH.historydescription_Presentation_ApplyBackgroundToAll:
- sString = "historydescription_Presentation_ApplyBackgroundToAll";
+ sString = "Presentation_ApplyBackgroundToAll";
break;
case AscDFH.historydescription_Presentation_ShowMasterShapes:
- sString = "historydescription_Presentation_ShowMasterShapes";
+ sString = "Presentation_ShowMasterShapes";
+ break;
+ case AscDFH.historydescription_BuilderScript:
+ sString = "BuilderScript";
+ break;
+ case AscDFH.historydescription_Document_AddRemoveBeforeAfterParagraph:
+ sString = "Document_AddRemoveBeforeAfterParagraph";
+ break;
+ case AscDFH.historydescription_Document_SectionPageNumFormat:
+ sString = "Document_SectionPageNumFormat";
+ break;
+ case AscDFH.historydescription_Document_SetPageColor:
+ sString = "Document_SetPageColor";
+ break;
+ case AscDFH.historydescription_Document_InsertTextFromFile:
+ sString = "Document_InsertTextFromFile";
+ break;
+ case AscDFH.historydescription_Document_AddComplexField:
+ sString = "Document_AddComplexField";
+ break;
+ case AscDFH.historydescription_Document_EditComplexFieldInstruction:
+ sString = "Document_EditComplexFieldInstruction";
+ break;
+ case AscDFH.historydescription_Collaborative_DeletedTextRecovery:
+ sString = "Collaborative_DeletedTextRecovery";
break;
}
return sString;
@@ -1325,11 +1351,12 @@
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- window['AscDFH'].historyitem_recalctype_Inline = 0; // Изменения произошли в обычном тексте (с верхним классом CDocument)
- window['AscDFH'].historyitem_recalctype_Flow = 1; // Изменения произошли в "плавающем" объекте
- window['AscDFH'].historyitem_recalctype_HdrFtr = 2; // Изменения произошли в колонтитуле
- window['AscDFH'].historyitem_recalctype_Drawing = 3; // Изменения произошли в drawing'е
- window['AscDFH'].historyitem_recalctype_NotesEnd = 4; // Изменение произошли в сносках, которые идут в конце документа
+ window['AscDFH'].historyitem_recalctype_Inline = 0; // Изменения произошли в обычном тексте (с верхним классом CDocument)
+ window['AscDFH'].historyitem_recalctype_Flow = 1; // Изменения произошли в "плавающем" объекте
+ window['AscDFH'].historyitem_recalctype_HdrFtr = 2; // Изменения произошли в колонтитуле
+ window['AscDFH'].historyitem_recalctype_Drawing = 3; // Изменения произошли в drawing'е
+ window['AscDFH'].historyitem_recalctype_NotesEnd = 4; // Изменение произошли в сносках, которые идут в конце документа
+ window['AscDFH'].historyitem_recalctype_FromStart = 0xFFFF; // Изменения требуют полного пересчета документа с самого начала
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
@@ -1406,7 +1433,9 @@
window['AscDFH'].historyitem_type_GlossaryDocument = 67 << 16;
window['AscDFH'].historyitem_type_DocPart = 68 << 16;
window['AscDFH'].historyitem_type_Endnotes = 69 << 16;
-
+ window['AscDFH'].historyitem_type_ParagraphPermStart = 70 << 16;
+ window['AscDFH'].historyitem_type_ParagraphPermEnd = 71 << 16;
+
window['AscDFH'].historyitem_type_CommonShape = 1000 << 16; // Этот класс добавлен для элементов, у которых нет конкретного класса
window['AscDFH'].historyitem_type_ColorMod = 1001 << 16;
@@ -1610,6 +1639,68 @@
window['AscDFH'].historyitem_type_MarkerLayout = 1199 << 16;
window['AscDFH'].historyitem_type_TimelineSlicerView = 1200 << 16;
+
+ window['AscDFH'].historyitem_type_Address = 1201 << 16;
+ window['AscDFH'].historyitem_type_AxisUnits = 1202 << 16;
+ window['AscDFH'].historyitem_type_AxisUnitsLabel = 1200 << 16;
+ window['AscDFH'].historyitem_type_Binning = 1203 << 16;
+ window['AscDFH'].historyitem_type_CategoryAxisScaling = 1204 << 16;
+ window['AscDFH'].historyitem_type_ChartData = 1205 << 16;
+ window['AscDFH'].historyitem_type_Clear = 1206 << 16;
+ window['AscDFH'].historyitem_type_Copyrights = 1207 << 16;
+ window['AscDFH'].historyitem_type_Data = 1208 << 16;
+ window['AscDFH'].historyitem_type_DataLabel = 1209 << 16;
+ window['AscDFH'].historyitem_type_DataLabelHidden = 1200 << 16;
+ window['AscDFH'].historyitem_type_DataLabels = 1210 << 16;
+ window['AscDFH'].historyitem_type_DataLabelVisibilities = 1211 << 16;
+ window['AscDFH'].historyitem_type_DataPoint = 1212 << 16;
+ window['AscDFH'].historyitem_type_FormatOverride = 1213 << 16;
+ window['AscDFH'].historyitem_type_FormatOverrides = 1214 << 16;
+ window['AscDFH'].historyitem_type_Formula = 1215 << 16;
+ window['AscDFH'].historyitem_type_GeoCache = 1216 << 16;
+ window['AscDFH'].historyitem_type_GeoChildEntities = 1217 << 16;
+ window['AscDFH'].historyitem_type_GeoChildEntitiesQuery = 1218 << 16;
+ window['AscDFH'].historyitem_type_GeoChildEntitiesQueryResult = 1219 << 16;
+ window['AscDFH'].historyitem_type_GeoChildEntitiesQueryResults = 1220 << 16;
+ window['AscDFH'].historyitem_type_GeoChildTypes = 1221 << 16;
+ window['AscDFH'].historyitem_type_GeoData = 1222 << 16;
+ window['AscDFH'].historyitem_type_GeoDataEntityQuery = 1223 << 16;
+ window['AscDFH'].historyitem_type_GeoDataEntityQueryResult = 1224 << 16;
+ window['AscDFH'].historyitem_type_GeoDataEntityQueryResults = 1225 << 16;
+ window['AscDFH'].historyitem_type_GeoDataPointQuery = 1226 << 16;
+ window['AscDFH'].historyitem_type_GeoDataPointToEntityQuery = 1227 << 16;
+ window['AscDFH'].historyitem_type_GeoDataPointToEntityQueryResult = 1228 << 16;
+ window['AscDFH'].historyitem_type_GeoDataPointToEntityQueryResults = 1229 << 16;
+ window['AscDFH'].historyitem_type_Geography = 1230 << 16;
+ window['AscDFH'].historyitem_type_GeoHierarchyEntity = 1231 << 16;
+ window['AscDFH'].historyitem_type_GeoLocation = 1232 << 16;
+ window['AscDFH'].historyitem_type_GeoLocationQuery = 1233 << 16;
+ window['AscDFH'].historyitem_type_GeoLocationQueryResult = 1234 << 16;
+ window['AscDFH'].historyitem_type_GeoLocationQueryResults = 1235 << 16;
+ window['AscDFH'].historyitem_type_GeoLocations = 1236 << 16;
+ window['AscDFH'].historyitem_type_GeoPolygon = 1237 << 16;
+ window['AscDFH'].historyitem_type_GeoPolygons = 1238 << 16;
+ window['AscDFH'].historyitem_type_Gridlines = 1239 << 16;
+ window['AscDFH'].historyitem_type_Dimension = 1240 << 16;
+ window['AscDFH'].historyitem_type_NumericDimension = 1241 << 16;
+ window['AscDFH'].historyitem_type_PercentageColorPosition = 1242 << 16;
+ window['AscDFH'].historyitem_type_PlotAreaRegion = 1243 << 16;
+ window['AscDFH'].historyitem_type_PlotSurface = 1244 << 16;
+ window['AscDFH'].historyitem_type_Series = 1245 << 16;
+ window['AscDFH'].historyitem_type_SeriesElementVisibilities = 1246 << 16;
+ window['AscDFH'].historyitem_type_SeriesLayoutProperties = 1247 << 16;
+ window['AscDFH'].historyitem_type_Statistics = 1248 << 16;
+ window['AscDFH'].historyitem_type_StringDimension = 1249 << 16;
+ window['AscDFH'].historyitem_type_Subtotals = 1250 << 16;
+ window['AscDFH'].historyitem_type_TextData = 1251 << 16;
+ window['AscDFH'].historyitem_type_TickMarks = 1252 << 16;
+ window['AscDFH'].historyitem_type_ValueAxisScaling = 1253 << 16;
+ window['AscDFH'].historyitem_type_ValueColorEndPosition = 1254 << 16;
+ window['AscDFH'].historyitem_type_ValueColorMiddlePosition = 1255 << 16;
+ window['AscDFH'].historyitem_type_ValueColorPositions = 1256 << 16;
+ window['AscDFH'].historyitem_type_ValueColors = 1257 << 16;
+
+
window['AscDFH'].historyitem_type_DocumentMacros = 2000 << 16;
window['AscDFH'].historyitem_type_PrSet = 2001 << 16;
window['AscDFH'].historyitem_type_CCommonDataList = 2002 << 16;
@@ -1625,8 +1716,6 @@
window['AscDFH'].historyitem_type_LayoutDef = 2012 << 16;
window['AscDFH'].historyitem_type_CatLst = 2013 << 16;
window['AscDFH'].historyitem_type_SCat = 2014 << 16;
- window['AscDFH'].historyitem_type_ClrData = 2015 << 16;
- window['AscDFH'].historyitem_type_Desc = 2016 << 16;
window['AscDFH'].historyitem_type_LayoutNode = 2017 << 16;
window['AscDFH'].historyitem_type_Alg = 2018 << 16;
window['AscDFH'].historyitem_type_Param = 2019 << 16;
@@ -1658,12 +1747,6 @@
window['AscDFH'].historyitem_type_ColorsDef = 2047 << 16;
window['AscDFH'].historyitem_type_ColorDefStyleLbl = 2048 << 16;
window['AscDFH'].historyitem_type_ClrLst = 2049 << 16;
- window['AscDFH'].historyitem_type_EffectClrLst = 2050 << 16;
- window['AscDFH'].historyitem_type_FillClrLst = 2051 << 16;
- window['AscDFH'].historyitem_type_LinClrLst = 2052 << 16;
- window['AscDFH'].historyitem_type_TxEffectClrLst = 2053 << 16;
- window['AscDFH'].historyitem_type_TxFillClrLst = 2054 << 16;
- window['AscDFH'].historyitem_type_TxLinClrLst = 2056 << 16;
window['AscDFH'].historyitem_type_ColorsDefHdr = 2057 << 16;
window['AscDFH'].historyitem_type_ColorsDefHdrLst = 2058 << 16;
window['AscDFH'].historyitem_type_StyleDef = 2059 << 16;
@@ -1685,7 +1768,6 @@
window['AscDFH'].historyitem_type_StyleDefHdrLst = 2075 << 16;
window['AscDFH'].historyitem_type_StyleDefHdr = 2076 << 16;
window['AscDFH'].historyitem_type_BackdropAnchor = 2077 << 16;
- window['AscDFH'].historyitem_type_StyleData = 2078 << 16;
window['AscDFH'].historyitem_type_SampData = 2079 << 16;
window['AscDFH'].historyitem_type_ForEach = 2080 << 16;
window['AscDFH'].historyitem_type_ResizeHandles = 2081 << 16;
@@ -1696,16 +1778,11 @@
window['AscDFH'].historyitem_type_ExtrusionClr = 2086 << 16;
window['AscDFH'].historyitem_type_ContourClr = 2087 << 16;
window['AscDFH'].historyitem_type_SmartArt = 2088 << 16;
- window['AscDFH'].historyitem_type_CCommonDataClrList = 2089 << 16;
window['AscDFH'].historyitem_type_BuNone = 2090 << 16;
window['AscDFH'].historyitem_type_SmartArtDrawing = 2091 << 16;
window['AscDFH'].historyitem_type_DiagramData = 2092 << 16;
window['AscDFH'].historyitem_type_FunctionValue = 2093 << 16;
window['AscDFH'].historyitem_type_PointInfo = 2094 << 16;
- window['AscDFH'].historyitem_type_ShapeSmartArtInfo = 2095 << 16;
- window['AscDFH'].historyitem_type_SmartArtTree = 2096 << 16;
- window['AscDFH'].historyitem_type_SmartArtNode = 2097 << 16;
- window['AscDFH'].historyitem_type_SmartArtNodeData = 2098 << 16;
window['AscDFH'].historyitem_type_BuBlip = 2099 << 16;
window['AscDFH'].historyitem_type_VMLArc = 2099 << 16;
@@ -1738,13 +1815,26 @@
window['AscDFH'].historyitem_type_PDF_Document = 2210 << 16;
window['AscDFH'].historyitem_type_Pdf_Form = 2211 << 16;
window['AscDFH'].historyitem_type_Pdf_Comment = 2212 << 16;
- window['AscDFH'].historyitem_type_Pdf_Ink = 2213 << 16;
- window['AscDFH'].historyitem_type_Pdf_Annot = 2214 << 16;
- window['AscDFH'].historyitem_type_Pdf_Pushbutton = 2215 << 16;
- window['AscDFH'].historyitem_type_Pdf_Line = 2216 << 16;
- window['AscDFH'].historyitem_type_Pdf_List_Form = 2217 << 16;
- window['AscDFH'].historyitem_Pdf_FreeText = 2218 << 16;
- window['AscDFH'].historyitem_Pdf_Drawing = 2219 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot = 2213 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Ink = 2214 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Line = 2215 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_FreeText = 2216 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Text = 2217 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Circle = 2218 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Square = 2219 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Polygon = 2220 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Polyline = 2221 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Highlight = 2222 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Underline = 2223 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Strikeout = 2224 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Squiggly = 2225 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Annot_Caret = 2226 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Pushbutton = 2227 << 16;
+ window['AscDFH'].historyitem_type_Pdf_List_Form = 2228 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Drawing = 2229 << 16;
+ window['AscDFH'].historyitem_type_Pdf_Page = 2230 << 16;
+
+ window['AscDFH'].historyitem_type_CustomProperties = 2301 << 16;
@@ -2454,6 +2544,7 @@
window['AscDFH'].historyitem_ChartSpace_RemoveUserShape = window['AscDFH'].historyitem_type_ChartSpace | 19;
window['AscDFH'].historyitem_ChartSpace_ChartStyle = window['AscDFH'].historyitem_type_ChartSpace | 20;
window['AscDFH'].historyitem_ChartSpace_ChartColors = window['AscDFH'].historyitem_type_ChartSpace | 21;
+ window['AscDFH'].historyitem_ChartSpace_SetChartData = window['AscDFH'].historyitem_type_ChartSpace | 22;
window['AscDFH'].historyitem_Legend_SetLayout = window['AscDFH'].historyitem_type_Legend | 1;
window['AscDFH'].historyitem_Legend_AddLegendEntry = window['AscDFH'].historyitem_type_Legend | 2;
@@ -2461,6 +2552,7 @@
window['AscDFH'].historyitem_Legend_SetOverlay = window['AscDFH'].historyitem_type_Legend | 4;
window['AscDFH'].historyitem_Legend_SetSpPr = window['AscDFH'].historyitem_type_Legend | 5;
window['AscDFH'].historyitem_Legend_SetTxPr = window['AscDFH'].historyitem_type_Legend | 6;
+ window['AscDFH'].historyitem_Legend_SetAlign = window['AscDFH'].historyitem_type_Legend | 7;
window['AscDFH'].historyitem_Layout_SetH = window['AscDFH'].historyitem_type_Layout | 1;
window['AscDFH'].historyitem_Layout_SetHMode = window['AscDFH'].historyitem_type_Layout | 2;
@@ -2505,17 +2597,18 @@
window['AscDFH'].historyitem_Marker_SetSpPr = window['AscDFH'].historyitem_type_Marker | 2;
window['AscDFH'].historyitem_Marker_SetSymbol = window['AscDFH'].historyitem_type_Marker | 3;
- window['AscDFH'].historyitem_PlotArea_AddChart = window['AscDFH'].historyitem_type_PlotArea | 1;
- window['AscDFH'].historyitem_PlotArea_SetCatAx = window['AscDFH'].historyitem_type_PlotArea | 2;
- window['AscDFH'].historyitem_PlotArea_SetDateAx = window['AscDFH'].historyitem_type_PlotArea | 3;
- window['AscDFH'].historyitem_PlotArea_SetDTable = window['AscDFH'].historyitem_type_PlotArea | 4;
- window['AscDFH'].historyitem_PlotArea_SetLayout = window['AscDFH'].historyitem_type_PlotArea | 5;
- window['AscDFH'].historyitem_PlotArea_SetSerAx = window['AscDFH'].historyitem_type_PlotArea | 6;
- window['AscDFH'].historyitem_PlotArea_SetSpPr = window['AscDFH'].historyitem_type_PlotArea | 7;
- window['AscDFH'].historyitem_PlotArea_SetValAx = window['AscDFH'].historyitem_type_PlotArea | 8;
- window['AscDFH'].historyitem_PlotArea_AddAxis = window['AscDFH'].historyitem_type_PlotArea | 9;
- window['AscDFH'].historyitem_PlotArea_RemoveChart = window['AscDFH'].historyitem_type_PlotArea | 10;
- window['AscDFH'].historyitem_PlotArea_RemoveAxis = window['AscDFH'].historyitem_type_PlotArea | 11;
+ window['AscDFH'].historyitem_PlotArea_AddChart = window['AscDFH'].historyitem_type_PlotArea | 1;
+ window['AscDFH'].historyitem_PlotArea_SetCatAx = window['AscDFH'].historyitem_type_PlotArea | 2;
+ window['AscDFH'].historyitem_PlotArea_SetDateAx = window['AscDFH'].historyitem_type_PlotArea | 3;
+ window['AscDFH'].historyitem_PlotArea_SetDTable = window['AscDFH'].historyitem_type_PlotArea | 4;
+ window['AscDFH'].historyitem_PlotArea_SetLayout = window['AscDFH'].historyitem_type_PlotArea | 5;
+ window['AscDFH'].historyitem_PlotArea_SetSerAx = window['AscDFH'].historyitem_type_PlotArea | 6;
+ window['AscDFH'].historyitem_PlotArea_SetSpPr = window['AscDFH'].historyitem_type_PlotArea | 7;
+ window['AscDFH'].historyitem_PlotArea_SetValAx = window['AscDFH'].historyitem_type_PlotArea | 8;
+ window['AscDFH'].historyitem_PlotArea_AddAxis = window['AscDFH'].historyitem_type_PlotArea | 9;
+ window['AscDFH'].historyitem_PlotArea_RemoveChart = window['AscDFH'].historyitem_type_PlotArea | 10;
+ window['AscDFH'].historyitem_PlotArea_RemoveAxis = window['AscDFH'].historyitem_type_PlotArea | 11;
+ window['AscDFH'].historyitem_PlotArea_SetPlotAreaRegion = window['AscDFH'].historyitem_type_PlotArea | 12;
window['AscDFH'].historyitem_NumFmt_SetFormatCode = window['AscDFH'].historyitem_type_NumFmt | 1;
window['AscDFH'].historyitem_NumFmt_SetSourceLinked = window['AscDFH'].historyitem_type_NumFmt | 2;
@@ -2667,6 +2760,7 @@
window['AscDFH'].historyitem_NumLit_SetFormatCode = window['AscDFH'].historyitem_type_NumLit | 1;
window['AscDFH'].historyitem_NumLit_AddPt = window['AscDFH'].historyitem_type_NumLit | 2;
window['AscDFH'].historyitem_NumLit_SetPtCount = window['AscDFH'].historyitem_type_NumLit | 3;
+ window['AscDFH'].historyitem_NumLit_SetName = window['AscDFH'].historyitem_type_NumLit | 4;
window['AscDFH'].historyitem_NumericPoint_SetFormatCode = window['AscDFH'].historyitem_type_NumericPoint | 1;
window['AscDFH'].historyitem_NumericPoint_SetIdx = window['AscDFH'].historyitem_type_NumericPoint | 2;
@@ -2695,6 +2789,7 @@
window['AscDFH'].historyitem_StrCache_AddPt = window['AscDFH'].historyitem_type_StrCache | 1;
window['AscDFH'].historyitem_StrCache_SetPtCount = window['AscDFH'].historyitem_type_StrCache | 2;
+ window['AscDFH'].historyitem_StrCache_SetName = window['AscDFH'].historyitem_type_StrCache | 3;
window['AscDFH'].historyitem_StrPoint_SetIdx = window['AscDFH'].historyitem_type_StrPoint | 1;
window['AscDFH'].historyitem_StrPoint_SetVal = window['AscDFH'].historyitem_type_StrPoint | 2;
@@ -2822,6 +2917,7 @@
window['AscDFH'].historyitem_ChartText_SetRich = window['AscDFH'].historyitem_type_ChartText | 1;
window['AscDFH'].historyitem_ChartText_SetStrRef = window['AscDFH'].historyitem_type_ChartText | 2;
+ window['AscDFH'].historyitem_ChartText_SetTxData = window['AscDFH'].historyitem_type_ChartText | 3;
window['AscDFH'].historyitem_ShapeStyle_SetLnRef = window['AscDFH'].historyitem_type_ShapeStyle | 1;
window['AscDFH'].historyitem_ShapeStyle_SetFillRef = window['AscDFH'].historyitem_type_ShapeStyle | 2;
@@ -2936,10 +3032,9 @@
window['AscDFH'].historyitem_ShapeSetTextLink = window['AscDFH'].historyitem_type_Shape | 13;
window['AscDFH'].historyitem_ShapeSetModelId = window['AscDFH'].historyitem_type_Shape | 14;
window['AscDFH'].historyitem_ShapeSetTxXfrm = window['AscDFH'].historyitem_type_Shape | 15;
- window['AscDFH'].historyitem_ShapeSetSmartArtPoint = window['AscDFH'].historyitem_type_Shape | 16;
window['AscDFH'].historyitem_ShapeSetFLocksText = window['AscDFH'].historyitem_type_Shape | 17;
window['AscDFH'].historyitem_ShapeSetClientData = window['AscDFH'].historyitem_type_Shape | 18;
- window['AscDFH'].historyitem_ShapeSetShapeSmartArtPointInfo = window['AscDFH'].historyitem_type_Shape | 19;
+ window['AscDFH'].historyitem_ShapeSetUseBgFill = window['AscDFH'].historyitem_type_Shape | 19;
window['AscDFH'].historyitem_OleSizeSelectionSetRange = window['AscDFH'].historyitem_type_OleSizeSelection | 1;
@@ -3092,6 +3187,8 @@
window['AscDFH'].historyitem_Title_SetSpPr = window['AscDFH'].historyitem_type_Title | 3;
window['AscDFH'].historyitem_Title_SetTx = window['AscDFH'].historyitem_type_Title | 4;
window['AscDFH'].historyitem_Title_SetTxPr = window['AscDFH'].historyitem_type_Title | 5;
+ window['AscDFH'].historyitem_Title_SetAlign = window['AscDFH'].historyitem_type_Title | 6;
+ window['AscDFH'].historyitem_Title_SetPos = window['AscDFH'].historyitem_type_Title | 7;
window['AscDFH'].historyitem_SlideSetComments = window['AscDFH'].historyitem_type_Slide | 1;
window['AscDFH'].historyitem_SlideSetShow = window['AscDFH'].historyitem_type_Slide | 2;
@@ -3564,12 +3661,6 @@
AscDFH.historyitem_SCatPri = AscDFH.historyitem_type_SCat | 1;
AscDFH.historyitem_SCatType = AscDFH.historyitem_type_SCat | 2;
- AscDFH.historyitem_ClrDataUseDef = AscDFH.historyitem_type_ClrData | 1;
- AscDFH.historyitem_ClrDataDataModel = AscDFH.historyitem_type_ClrData | 2;
-
- AscDFH.historyitem_DescLang = AscDFH.historyitem_type_Desc | 1;
- AscDFH.historyitem_DescVal = AscDFH.historyitem_type_Desc | 2;
-
AscDFH.historyitem_LayoutNodeChOrder = AscDFH.historyitem_type_LayoutNode | 1;
AscDFH.historyitem_LayoutNodeMoveWith = AscDFH.historyitem_type_LayoutNode | 2;
AscDFH.historyitem_LayoutNodeName = AscDFH.historyitem_type_LayoutNode | 3;
@@ -3728,6 +3819,8 @@
AscDFH.historyitem_ClrLstHueDir = AscDFH.historyitem_type_ClrLst | 1;
AscDFH.historyitem_ClrLstMeth = AscDFH.historyitem_type_ClrLst | 2;
+ AscDFH.historyitem_ClrLstAdd = AscDFH.historyitem_type_ClrLst | 3;
+ AscDFH.historyitem_ClrLstRemove = AscDFH.historyitem_type_ClrLst | 4;
AscDFH.historyitem_ColorsDefHdrMinVer = AscDFH.historyitem_type_ColorsDefHdr | 1;
AscDFH.historyitem_ColorsDefHdrResId = AscDFH.historyitem_type_ColorsDefHdr | 2;
@@ -3825,9 +3918,6 @@
AscDFH.historyitem_BackdropAnchorY = AscDFH.historyitem_type_BackdropAnchor | 2;
AscDFH.historyitem_BackdropAnchorZ = AscDFH.historyitem_type_BackdropAnchor | 3;
- AscDFH.historyitem_StyleDataDataModel = AscDFH.historyitem_type_StyleData | 1;
- AscDFH.historyitem_StyleDataUseDef = AscDFH.historyitem_type_StyleData | 2;
-
AscDFH.historyitem_SampDataDataModel = AscDFH.historyitem_type_SampData | 1;
AscDFH.historyitem_SampDataUseDef = AscDFH.historyitem_type_SampData | 2;
@@ -3850,27 +3940,6 @@
AscDFH.historyitem_FunctionValueBool = AscDFH.historyitem_type_FunctionValue | 6;
AscDFH.historyitem_FunctionValueInt = AscDFH.historyitem_type_FunctionValue | 7;
- AscDFH.historyitem_ShapeSmartArtInfoSpPrPoint = AscDFH.historyitem_type_ShapeSmartArtInfo | 1;
- AscDFH.historyitem_ShapeSmartArtInfoShapePoint = AscDFH.historyitem_type_ShapeSmartArtInfo | 2;
- AscDFH.historyitem_ShapeSmartArtInfoAddLstContentPoint = AscDFH.historyitem_type_ShapeSmartArtInfo | 3;
- AscDFH.historyitem_ShapeSmartArtInfoRemoveLstContentPoint = AscDFH.historyitem_type_ShapeSmartArtInfo | 4;
-
- AscDFH.historyitem_SmartArtTreeRoot = AscDFH.historyitem_type_SmartArtTree | 1;
-
- AscDFH.historyitem_SmartArtNodeInfo = AscDFH.historyitem_type_SmartArtNode | 1;
- AscDFH.historyitem_SmartArtNodeData = AscDFH.historyitem_type_SmartArtNode | 2;
- AscDFH.historyitem_SmartArtNodeAddToLstChildren = AscDFH.historyitem_type_SmartArtNode | 3;
- AscDFH.historyitem_SmartArtNodeRemoveFromLstChildren = AscDFH.historyitem_type_SmartArtNode | 4;
-
- AscDFH.historyitem_SmartArtNodeDataParPoint = AscDFH.historyitem_type_SmartArtNodeData | 1;
- AscDFH.historyitem_SmartArtNodeDataSibPoint = AscDFH.historyitem_type_SmartArtNodeData | 2;
- AscDFH.historyitem_SmartArtNodeDataCxn = AscDFH.historyitem_type_SmartArtNodeData | 3;
- AscDFH.historyitem_SmartArtNodeDataMainPoint = AscDFH.historyitem_type_SmartArtNodeData | 4;
- AscDFH.historyitem_SmartArtNodeDataAddToLstShapes = AscDFH.historyitem_type_SmartArtNodeData | 5;
- AscDFH.historyitem_SmartArtNodeDataRemoveFromLstShapes = AscDFH.historyitem_type_SmartArtNodeData | 6;
- AscDFH.historyitem_SmartArtNodeDataAddToLstPresPoint = AscDFH.historyitem_type_SmartArtNodeData | 7;
- AscDFH.historyitem_SmartArtNodeDataRemoveFromLstPresPoint = AscDFH.historyitem_type_SmartArtNodeData | 8;
-
AscDFH.historyitem_BuBlipBlip = AscDFH.historyitem_type_BuBlip | 1;
AscDFH.historyitem_PointInfoPoint = AscDFH.historyitem_type_PointInfo | 1;
@@ -3887,7 +3956,7 @@
AscDFH.historyitem_ParameterValConnectorPoint = AscDFH.historyitem_type_ParameterVal | 9;
AscDFH.historyitem_ParameterValConnectorRouting = AscDFH.historyitem_type_ParameterVal | 10;
AscDFH.historyitem_ParameterValContinueDirection = AscDFH.historyitem_type_ParameterVal | 11;
- AscDFH.historyitem_ParameterValDiagramHorizontalAlignment = AscDFH.historyitem_type_ParameterVal | 12;
+ AscDFH.historyitem_ParameterValHorizontalAlignment = AscDFH.historyitem_type_ParameterVal | 12;
AscDFH.historyitem_ParameterValDiagramTextAlignment = AscDFH.historyitem_type_ParameterVal | 13;
AscDFH.historyitem_ParameterValFallbackDimension = AscDFH.historyitem_type_ParameterVal | 14;
AscDFH.historyitem_ParameterValFlowDirection = AscDFH.historyitem_type_ParameterVal | 15;
@@ -3976,12 +4045,6 @@
AscDFH.historyitem_SmartArtParent = AscDFH.historyitem_type_SmartArt | 6;
AscDFH.historyitem_SmartArtType = AscDFH.historyitem_type_SmartArt | 7;
- AscDFH.historyitem_CCommonDataClrListAdd = AscDFH.historyitem_type_CCommonDataClrList | 1;
- AscDFH.historyitem_CCommonDataClrListRemove = AscDFH.historyitem_type_CCommonDataClrList | 2;
- AscDFH.historyitem_CCommonDataClrListHueDir = AscDFH.historyitem_type_CCommonDataClrList | 3;
- AscDFH.historyitem_CCommonDataClrListMeth = AscDFH.historyitem_type_CCommonDataClrList | 4;
-
-
AscDFH.historyitem_ViewPrGridSpacing = AscDFH.historyitem_type_ViewPr | 1;
AscDFH.historyitem_ViewPrSlideViewerPr = AscDFH.historyitem_type_ViewPr | 2;
AscDFH.historyitem_ViewPrLastView = AscDFH.historyitem_type_ViewPr | 3;
@@ -4004,6 +4067,249 @@
AscDFH.historyitem_ViewPrGuideOrient = AscDFH.historyitem_type_ViewPrGuide | 1;
AscDFH.historyitem_ViewPrGuidePos = AscDFH.historyitem_type_ViewPrGuide | 2;
+
+ AscDFH.historyitem_Address_SetAddress1 = AscDFH.historyitem_type_Address | 1;
+ AscDFH.historyitem_Address_SetCountryRegion = AscDFH.historyitem_type_Address | 2;
+ AscDFH.historyitem_Address_SetAdminDistrict1 = AscDFH.historyitem_type_Address | 3;
+ AscDFH.historyitem_Address_SetAdminDistrict2 = AscDFH.historyitem_type_Address | 4;
+ AscDFH.historyitem_Address_SetPostalCode = AscDFH.historyitem_type_Address | 5;
+ AscDFH.historyitem_Address_SetLocality = AscDFH.historyitem_type_Address | 6;
+ AscDFH.historyitem_Address_SetISOCountryCode = AscDFH.historyitem_type_Address | 7;
+
+ AscDFH.historyitem_Axis_SetUnits = AscDFH.historyitem_type_Axis | 1;
+ AscDFH.historyitem_Axis_SetTickLabels = AscDFH.historyitem_type_Axis | 2;
+ AscDFH.historyitem_Axis_SetHidden = AscDFH.historyitem_type_Axis | 3;
+
+ AscDFH.historyitem_AxisUnits_SetUnitsLabel = AscDFH.historyitem_type_AxisUnits | 1;
+ AscDFH.historyitem_AxisUnits_SetUnit = AscDFH.historyitem_type_AxisUnits | 2;
+
+ AscDFH.historyitem_AxisUnitsLabel_SetTx = AscDFH.historyitem_type_AxisUnitsLabel | 1;
+ AscDFH.historyitem_AxisUnitsLabel_SetSpPr = AscDFH.historyitem_type_AxisUnitsLabel | 2;
+ AscDFH.historyitem_AxisUnitsLabel_SetTxPr = AscDFH.historyitem_type_AxisUnitsLabel | 3;
+
+ AscDFH.historyitem_Binning_SetBinSize = AscDFH.historyitem_type_Binning | 1;
+ AscDFH.historyitem_Binning_SetBinCount = AscDFH.historyitem_type_Binning | 2;
+ AscDFH.historyitem_Binning_SetIntervalClosed = AscDFH.historyitem_type_Binning | 3;
+ AscDFH.historyitem_Binning_SetUnderflow = AscDFH.historyitem_type_Binning | 4;
+ AscDFH.historyitem_Binning_SetOverflow = AscDFH.historyitem_type_Binning | 5;
+
+ AscDFH.historyitem_CategoryAxisScaling_SetGapWidth = AscDFH.historyitem_type_CategoryAxisScaling | 1;
+
+ AscDFH.historyitem_ChartData_SetExternalData = AscDFH.historyitem_type_ChartData | 1;
+ AscDFH.historyitem_ChartData_AddData = AscDFH.historyitem_type_ChartData | 2;
+ AscDFH.historyitem_ChartData_RemoveData = AscDFH.historyitem_type_ChartData | 3;
+
+ AscDFH.historyitem_Clear_SetGeoLocationQueryResults = AscDFH.historyitem_type_Clear | 1;
+ AscDFH.historyitem_Clear_SetGeoDataEntityQueryResults = AscDFH.historyitem_type_Clear | 2;
+ AscDFH.historyitem_Clear_SetGeoDataPointToEntityQueryResults = AscDFH.historyitem_type_Clear | 3;
+ AscDFH.historyitem_Clear_SetGeoChildEntitiesQueryResults = AscDFH.historyitem_type_Clear | 4;
+
+ AscDFH.historyitem_Copyrights_SetCopyright = AscDFH.historyitem_type_Copyrights | 1;
+
+ AscDFH.historyitem_Data_AddDimension = AscDFH.historyitem_type_Data | 1;
+ AscDFH.historyitem_Data_RemoveDimension = AscDFH.historyitem_type_Data | 2;
+ AscDFH.historyitem_Data_SetId = AscDFH.historyitem_type_Data | 3;
+
+ AscDFH.historyitem_DataLabel_SetNumFmt = AscDFH.historyitem_type_DataLabel | 1;
+ AscDFH.historyitem_DataLabel_SetSpPr = AscDFH.historyitem_type_DataLabel | 2;
+ AscDFH.historyitem_DataLabel_SetTxPr = AscDFH.historyitem_type_DataLabel | 3;
+ AscDFH.historyitem_DataLabel_SetVisibility = AscDFH.historyitem_type_DataLabel | 4;
+ AscDFH.historyitem_DataLabel_SetSeparator = AscDFH.historyitem_type_DataLabel | 5;
+ AscDFH.historyitem_DataLabel_SetIdx = AscDFH.historyitem_type_DataLabel | 6;
+ AscDFH.historyitem_DataLabel_SetPos = AscDFH.historyitem_type_DataLabel | 7;
+
+ AscDFH.historyitem_DataLabelHidden_SetIdx = AscDFH.historyitem_type_DataLabelHidden | 1;
+
+ AscDFH.historyitem_DataLabels_SetNumFmt = AscDFH.historyitem_type_DataLabels | 1;
+ AscDFH.historyitem_DataLabels_SetSpPr = AscDFH.historyitem_type_DataLabels | 2;
+ AscDFH.historyitem_DataLabels_SetTxPr = AscDFH.historyitem_type_DataLabels | 3;
+ AscDFH.historyitem_DataLabels_SetVisibility = AscDFH.historyitem_type_DataLabels | 4;
+ AscDFH.historyitem_DataLabels_SetSeparator = AscDFH.historyitem_type_DataLabels | 5;
+ AscDFH.historyitem_DataLabels_SetDataLabel = AscDFH.historyitem_type_DataLabels | 6;
+ AscDFH.historyitem_DataLabels_AddDataLabel = AscDFH.historyitem_type_DataLabels | 7;
+ AscDFH.historyitem_DataLabels_RemoveDataLabel = AscDFH.historyitem_type_DataLabels | 8;
+ AscDFH.historyitem_DataLabels_AddDataLabelHidden = AscDFH.historyitem_type_DataLabels | 9;
+ AscDFH.historyitem_DataLabels_RemoveDataLabelHidden = AscDFH.historyitem_type_DataLabels | 10;
+ AscDFH.historyitem_DataLabels_SetPos = AscDFH.historyitem_type_DataLabels | 11;
+
+
+ AscDFH.historyitem_DataLabelVisibilities_SetSeriesName = AscDFH.historyitem_type_DataLabelVisibilities | 1;
+ AscDFH.historyitem_DataLabelVisibilities_SetCategoryName = AscDFH.historyitem_type_DataLabelVisibilities | 2;
+ AscDFH.historyitem_DataLabelVisibilities_SetValue = AscDFH.historyitem_type_DataLabelVisibilities | 3;
+
+ AscDFH.historyitem_DataPoint_SetSpPr = AscDFH.historyitem_type_DataPoint | 1;
+ AscDFH.historyitem_DataPoint_SetIdx = AscDFH.historyitem_type_DataPoint | 2;
+
+ AscDFH.historyitem_FormatOverride_SetSpPr = AscDFH.historyitem_type_FormatOverride | 1;
+ AscDFH.historyitem_FormatOverride_SetIdx = AscDFH.historyitem_type_FormatOverride | 2;
+ AscDFH.historyitem_FormatOverrides_SetFmtOvr = AscDFH.historyitem_type_FormatOverride | 3;
+
+ AscDFH.historyitem_Formula_SetDir = AscDFH.historyitem_type_Formula | 1;
+ AscDFH.historyitem_Formula_SetContent = AscDFH.historyitem_type_Formula | 2;
+
+ AscDFH.historyitem_GeoCache_SetBinary = AscDFH.historyitem_type_GeoCache | 1;
+ AscDFH.historyitem_GeoCache_SetClear = AscDFH.historyitem_type_GeoCache | 2;
+ AscDFH.historyitem_GeoCache_SetProvider = AscDFH.historyitem_type_GeoCache | 3;
+
+ AscDFH.historyitem_GeoChildEntities_SetGeoHierarchyEntity = AscDFH.historyitem_type_GeoChildEntities | 1;
+
+ AscDFH.historyitem_GeoChildEntitiesQuery_SetGeoChildTypes = AscDFH.historyitem_type_GeoChildEntitiesQuery | 1;
+ AscDFH.historyitem_GeoChildEntitiesQuery_SetEntityId = AscDFH.historyitem_type_GeoChildEntitiesQuery | 2;
+
+ AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntitiesQuery = AscDFH.historyitem_type_GeoChildEntitiesQueryResult | 1;
+ AscDFH.historyitem_GeoChildEntitiesQueryResult_SetGeoChildEntities = AscDFH.historyitem_type_GeoChildEntitiesQueryResult | 2;
+
+ AscDFH.historyitem_GeoChildEntitiesQueryResults_SetGeoChildEntitiesQueryResult = AscDFH.historyitem_type_GeoChildEntitiesQueryResults | 1;
+
+ AscDFH.historyitem_GeoChildTypes_SetEntityType = AscDFH.historyitem_type_GeoChildTypes | 1;
+
+ AscDFH.historyitem_GeoData_SetGeoPolygons = AscDFH.historyitem_type_GeoData | 1;
+ AscDFH.historyitem_GeoData_SetCopyrights = AscDFH.historyitem_type_GeoData | 2;
+ AscDFH.historyitem_GeoData_SetEntityName = AscDFH.historyitem_type_GeoData | 3;
+ AscDFH.historyitem_GeoData_SetEntityId = AscDFH.historyitem_type_GeoData | 4;
+ AscDFH.historyitem_GeoData_SetEast = AscDFH.historyitem_type_GeoData | 5;
+ AscDFH.historyitem_GeoData_SetWest = AscDFH.historyitem_type_GeoData | 6;
+ AscDFH.historyitem_GeoData_SetNorth = AscDFH.historyitem_type_GeoData | 7;
+ AscDFH.historyitem_GeoData_SetSouth = AscDFH.historyitem_type_GeoData | 8;
+
+ AscDFH.historyitem_GeoDataEntityQuery_SetEntityType = AscDFH.historyitem_type_GeoDataEntityQuery | 1;
+ AscDFH.historyitem_GeoDataEntityQuery_SetEntityId = AscDFH.historyitem_type_GeoDataEntityQuery |2;
+
+ AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoDataEntityQuery = AscDFH.historyitem_type_GeoDataEntityQueryResult | 1;
+ AscDFH.historyitem_GeoDataEntityQueryResult_SetGeoData = AscDFH.historyitem_type_GeoDataEntityQueryResult | 2;
+
+ AscDFH.historyitem_GeoDataEntityQueryResults_SetGeoDataEntityQueryResult = AscDFH.historyitem_type_GeoDataEntityQueryResults | 1;
+
+ AscDFH.historyitem_GeoDataPointQuery_SetEntityType = AscDFH.historyitem_type_GeoDataPointQuery | 1;
+ AscDFH.historyitem_GeoDataPointQuery_SetLatitude = AscDFH.historyitem_type_GeoDataPointQuery | 2;
+ AscDFH.historyitem_GeoDataPointQuery_SetLongitude = AscDFH.historyitem_type_GeoDataPointQuery | 3;
+
+ AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityType = AscDFH.historyitem_type_GeoDataPointToEntityQuery | 1;
+ AscDFH.historyitem_GeoDataPointToEntityQuery_SetEntityId = AscDFH.historyitem_type_GeoDataPointToEntityQuery | 2;
+
+ AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointQuery = AscDFH.historyitem_type_GeoDataPointToEntityQueryResult | 1;
+ AscDFH.historyitem_GeoDataPointToEntityQueryResult_SetGeoDataPointToEntityQuery = AscDFH.historyitem_type_GeoDataPointToEntityQueryResult | 2;
+
+ AscDFH.historyitem_GeoDataPointToEntityQueryResults_SetGeoDataPointToEntityQueryResult = AscDFH.historyitem_type_GeoDataPointToEntityQueryResults | 1;
+
+ AscDFH.historyitem_Geography_SetGeoCache = AscDFH.historyitem_type_Geography | 1;
+ AscDFH.historyitem_Geography_SetProjectionType = AscDFH.historyitem_type_Geography | 2;
+ AscDFH.historyitem_Geography_SetViewedRegionType = AscDFH.historyitem_type_Geography | 3;
+ AscDFH.historyitem_Geography_SetCultureLanguage = AscDFH.historyitem_type_Geography | 4;
+ AscDFH.historyitem_Geography_SetCultureRegion = AscDFH.historyitem_type_Geography | 5;
+ AscDFH.historyitem_Geography_SetAttribution = AscDFH.historyitem_type_Geography | 6;
+
+ AscDFH.historyitem_GeoHierarchyEntity_SetEntityName = AscDFH.historyitem_type_GeoHierarchyEntity | 1;
+ AscDFH.historyitem_GeoHierarchyEntity_SetEntityId = AscDFH.historyitem_type_GeoHierarchyEntity | 2;
+ AscDFH.historyitem_GeoHierarchyEntity_SetEntityType = AscDFH.historyitem_type_GeoHierarchyEntity | 3;
+
+ AscDFH.historyitem_GeoLocation_SetAddress = AscDFH.historyitem_type_GeoLocation | 1;
+ AscDFH.historyitem_GeoLocation_SetLatitude = AscDFH.historyitem_type_GeoLocation | 2;
+ AscDFH.historyitem_GeoLocation_SetLongitude = AscDFH.historyitem_type_GeoLocation | 3;
+ AscDFH.historyitem_GeoLocation_SetEntityName = AscDFH.historyitem_type_GeoLocation | 4;
+ AscDFH.historyitem_GeoLocation_SetEntityType = AscDFH.historyitem_type_GeoLocation | 5;
+
+ AscDFH.historyitem_GeoLocationQuery_SetCountryRegion = AscDFH.historyitem_type_GeoLocationQuery | 1;
+ AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict1 = AscDFH.historyitem_type_GeoLocationQuery | 2;
+ AscDFH.historyitem_GeoLocationQuery_SetAdminDistrict2 = AscDFH.historyitem_type_GeoLocationQuery | 3;
+ AscDFH.historyitem_GeoLocationQuery_SetPostalCode = AscDFH.historyitem_type_GeoLocationQuery | 4;
+ AscDFH.historyitem_GeoLocationQuery_SetEntityType = AscDFH.historyitem_type_GeoLocationQuery | 5;
+
+ AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocationQuery = AscDFH.historyitem_type_GeoLocationQueryResult | 1;
+ AscDFH.historyitem_GeoLocationQueryResult_SetGeoLocations = AscDFH.historyitem_type_GeoLocationQueryResult | 2;
+
+ AscDFH.historyitem_GeoLocationQueryResults_SetGeoLocationQueryResult = AscDFH.historyitem_type_GeoLocationQueryResults | 1;
+
+ AscDFH.historyitem_GeoLocations_SetGeoLocation = AscDFH.historyitem_type_GeoLocations | 1;
+
+ AscDFH.historyitem_GeoPolygon_SetPolygonId = AscDFH.historyitem_type_GeoPolygon | 1;
+ AscDFH.historyitem_GeoPolygon_SetNumPoints = AscDFH.historyitem_type_GeoPolygon | 2;
+ AscDFH.historyitem_GeoPolygon_SetPcaRings = AscDFH.historyitem_type_GeoPolygon | 3;
+
+ AscDFH.historyitem_GeoPolygons_SetGeoPolygon = AscDFH.historyitem_type_GeoPolygons | 1;
+
+ AscDFH.historyitem_Gridlines_SetSpPr = AscDFH.historyitem_type_Gridlines | 1;
+ AscDFH.historyitem_Gridlines_SetName = AscDFH.historyitem_type_Gridlines | 2;
+
+ AscDFH.historyitem_Dimension_SetF = AscDFH.historyitem_type_Dimension | 1;
+ AscDFH.historyitem_Dimension_SetNf = AscDFH.historyitem_type_Dimension | 2;
+ AscDFH.historyitem_Dimension_SetType = AscDFH.historyitem_type_Dimension | 3;
+
+ AscDFH.historyitem_NumericDimension_AddLevelData = AscDFH.historyitem_type_NumericDimension | 1;
+ AscDFH.historyitem_NumericDimension_RemoveLevelData = AscDFH.historyitem_type_NumericDimension | 2;
+
+ AscDFH.historyitem_PercentageColorPosition_SetVal = AscDFH.historyitem_type_PercentageColorPosition | 1;
+
+ AscDFH.historyitem_PlotAreaRegion_SetPlotSurface = AscDFH.historyitem_type_PlotAreaRegion | 1;
+ AscDFH.historyitem_PlotAreaRegion_AddSeries = AscDFH.historyitem_type_PlotAreaRegion | 2;
+ AscDFH.historyitem_PlotAreaRegion_RemoveSeries = AscDFH.historyitem_type_PlotAreaRegion | 3;
+
+ AscDFH.historyitem_PlotSurface_SetSpPr = AscDFH.historyitem_type_PlotSurface | 1;
+
+ AscDFH.historyitem_Series_AddDataPt = AscDFH.historyitem_type_Series | 1;
+ AscDFH.historyitem_Series_RemoveDataPt = AscDFH.historyitem_type_Series | 2;
+ AscDFH.historyitem_Series_SetDataLabels = AscDFH.historyitem_type_Series | 3;
+ AscDFH.historyitem_Series_SetDataId = AscDFH.historyitem_type_Series | 4;
+ AscDFH.historyitem_Series_SetLayoutPr = AscDFH.historyitem_type_Series | 5;
+ AscDFH.historyitem_Series_AddAxisId = AscDFH.historyitem_type_Series | 6;
+ AscDFH.historyitem_Series_RemoveAxisId = AscDFH.historyitem_type_Series | 7;
+ AscDFH.historyitem_Series_SetLayoutId = AscDFH.historyitem_type_Series | 8;
+ AscDFH.historyitem_Series_SetHidden = AscDFH.historyitem_type_Series | 9;
+ AscDFH.historyitem_Series_SetOwnerIdx = AscDFH.historyitem_type_Series | 10;
+ AscDFH.historyitem_Series_SetUniqueId = AscDFH.historyitem_type_Series | 11;
+ AscDFH.historyitem_Series_SetFormatIdx = AscDFH.historyitem_type_Series | 12;
+
+ AscDFH.historyitem_SeriesElementVisibilities_SetConnectorLines = AscDFH.historyitem_type_SeriesElementVisibilities | 1;
+ AscDFH.historyitem_SeriesElementVisibilities_SetMeanLine = AscDFH.historyitem_type_SeriesElementVisibilities | 2;
+ AscDFH.historyitem_SeriesElementVisibilities_SetMeanMarker = AscDFH.historyitem_type_SeriesElementVisibilities | 3;
+ AscDFH.historyitem_SeriesElementVisibilities_SetNonoutliers = AscDFH.historyitem_type_SeriesElementVisibilities | 4;
+ AscDFH.historyitem_SeriesElementVisibilities_SetOutliers = AscDFH.historyitem_type_SeriesElementVisibilities | 5;
+
+ AscDFH.historyitem_SeriesLayoutProperties_SetParentLabelLayout = AscDFH.historyitem_type_SeriesLayoutProperties | 1;
+ AscDFH.historyitem_SeriesLayoutProperties_SetRegionLabelLayout = AscDFH.historyitem_type_SeriesLayoutProperties | 2;
+ AscDFH.historyitem_SeriesLayoutProperties_SetVisibility = AscDFH.historyitem_type_SeriesLayoutProperties | 3;
+ AscDFH.historyitem_SeriesLayoutProperties_SetAggregation = AscDFH.historyitem_type_SeriesLayoutProperties | 4;
+ AscDFH.historyitem_SeriesLayoutProperties_SetBinning = AscDFH.historyitem_type_SeriesLayoutProperties | 5;
+ AscDFH.historyitem_SeriesLayoutProperties_SetGeography = AscDFH.historyitem_type_SeriesLayoutProperties | 6;
+ AscDFH.historyitem_SeriesLayoutProperties_SetStatistics = AscDFH.historyitem_type_SeriesLayoutProperties | 7;
+ AscDFH.historyitem_SeriesLayoutProperties_SetSubtotals = AscDFH.historyitem_type_SeriesLayoutProperties | 8;
+
+ AscDFH.historyitem_Statistics_SetQuartileMethod = AscDFH.historyitem_type_Statistics | 1;
+
+ AscDFH.historyitem_StringDimension_AddLevelData = AscDFH.historyitem_type_StringDimension | 1;
+ AscDFH.historyitem_StringDimension_RemoveLevelData = AscDFH.historyitem_type_StringDimension | 2;
+
+ AscDFH.historyitem_Subtotals_AddIdx = AscDFH.historyitem_type_Subtotals | 1;
+ AscDFH.historyitem_Subtotals_RemoveIdx = AscDFH.historyitem_type_Subtotals | 2;
+
+ AscDFH.historyitem_TextData_SetF = AscDFH.historyitem_type_TextData | 1;
+ AscDFH.historyitem_TextData_SetV = AscDFH.historyitem_type_TextData | 2;
+
+ AscDFH.historyitem_TickMarks_SetType = AscDFH.historyitem_type_TickMarks | 1;
+ AscDFH.historyitem_TickMarks_SetName = AscDFH.historyitem_type_TickMarks | 2;
+
+ AscDFH.historyitem_ValueAxisScaling_SetMax = AscDFH.historyitem_type_ValueAxisScaling | 1;
+ AscDFH.historyitem_ValueAxisScaling_SetMin = AscDFH.historyitem_type_ValueAxisScaling | 2;
+ AscDFH.historyitem_ValueAxisScaling_SetMajorUnit = AscDFH.historyitem_type_ValueAxisScaling | 3;
+ AscDFH.historyitem_ValueAxisScaling_SetMinorUnit = AscDFH.historyitem_type_ValueAxisScaling | 4;
+
+ AscDFH.historyitem_ValueColorEndPosition_SetExtremeValue = AscDFH.historyitem_type_ValueColorEndPosition | 1;
+ AscDFH.historyitem_ValueColorEndPosition_SetNumber = AscDFH.historyitem_type_ValueColorEndPosition | 2;
+ AscDFH.historyitem_ValueColorEndPosition_SetPercent = AscDFH.historyitem_type_ValueColorEndPosition | 3;
+
+ AscDFH.historyitem_ValueColorMiddlePosition_SetNumber = AscDFH.historyitem_type_ValueColorMiddlePosition | 1;
+ AscDFH.historyitem_ValueColorMiddlePosition_SetPercent = AscDFH.historyitem_type_ValueColorMiddlePosition | 2;
+
+ AscDFH.historyitem_ValueColorPositions_SetMin = AscDFH.historyitem_type_ValueColorPositions | 1;
+ AscDFH.historyitem_ValueColorPositions_SetMid = AscDFH.historyitem_type_ValueColorPositions | 2;
+ AscDFH.historyitem_ValueColorPositions_SetMax = AscDFH.historyitem_type_ValueColorPositions | 3;
+ AscDFH.historyitem_ValueColorPositions_SetCount = AscDFH.historyitem_type_ValueColorPositions | 4;
+
+ AscDFH.historyitem_ValueColors_SetMinColor = AscDFH.historyitem_type_ValueColors | 1;
+ AscDFH.historyitem_ValueColors_SetMidColor = AscDFH.historyitem_type_ValueColors | 2;
+ AscDFH.historyitem_ValueColors_SetMaxColor = AscDFH.historyitem_type_ValueColors | 3;
+
+
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в PDF Forms
//------------------------------------------------------------------------------------------------------------------
@@ -4011,8 +4317,10 @@
AscDFH.historyitem_Pdf_Form_Value = AscDFH.historyitem_type_Pdf_Form | 1;
AscDFH.historyitem_Pdf_Form_Add_Kid = AscDFH.historyitem_type_Pdf_Form | 2;
AscDFH.historyitem_Pdf_Form_Remove_Kid = AscDFH.historyitem_type_Pdf_Form | 3;
+ AscDFH.historyitem_Pdf_Form_Change_Display = AscDFH.historyitem_type_Pdf_Form | 4;
AscDFH.historyitem_Pdf_List_Form_Cur_Idxs = AscDFH.historyitem_type_Pdf_List_Form | 1;
+ AscDFH.historyitem_Pdf_List_Form_Top_Idx = AscDFH.historyitem_type_Pdf_List_Form | 2;
AscDFH.historyitem_Pdf_Pushbutton_Image = AscDFH.historyitem_type_Pdf_Pushbutton | 1;
@@ -4026,43 +4334,60 @@
AscDFH.historyitem_Pdf_Annot_Pos = AscDFH.historyitem_type_Pdf_Annot | 2;
AscDFH.historyitem_Pdf_Annot_Contents = AscDFH.historyitem_type_Pdf_Annot | 3;
AscDFH.historyitem_Pdf_Annot_Page = AscDFH.historyitem_type_Pdf_Annot | 4;
- AscDFH.historyitem_Pdf_Annot_Replies = AscDFH.historyitem_type_Pdf_Annot | 5;
- AscDFH.historyitem_Pdf_Annot_RD = AscDFH.historyitem_type_Pdf_Annot | 6;
- AscDFH.historyitem_Pdf_Annot_Vertices = AscDFH.historyitem_type_Pdf_Annot | 7;
+ AscDFH.historyitem_Pdf_Annot_RD = AscDFH.historyitem_type_Pdf_Annot | 5;
+ AscDFH.historyitem_Pdf_Annot_Vertices = AscDFH.historyitem_type_Pdf_Annot | 6;
+ AscDFH.historyitem_Pdf_Annot_Creation_Date = AscDFH.historyitem_type_Pdf_Annot | 7;
+ AscDFH.historyitem_Pdf_Annot_Mod_Date = AscDFH.historyitem_type_Pdf_Annot | 8;
+ AscDFH.historyitem_Pdf_Annot_Author = AscDFH.historyitem_type_Pdf_Annot | 9;
+ AscDFH.historyitem_Pdf_Annot_Display = AscDFH.historyitem_type_Pdf_Annot | 10;
+ AscDFH.historyitem_Pdf_Annot_Name = AscDFH.historyitem_type_Pdf_Annot | 11;
+ AscDFH.historyitem_Pdf_Annot_File_Idx = AscDFH.historyitem_type_Pdf_Annot | 12;
+ AscDFH.historyitem_Pdf_Annot_Stroke = AscDFH.historyitem_type_Pdf_Annot | 13;
+ AscDFH.historyitem_Pdf_Annot_StrokeWidth = AscDFH.historyitem_type_Pdf_Annot | 14;
+ AscDFH.historyitem_Pdf_Annot_Fill = AscDFH.historyitem_type_Pdf_Annot | 15;
+ AscDFH.historyitem_Pdf_Annot_Opacity = AscDFH.historyitem_type_Pdf_Annot | 16;
+ AscDFH.historyitem_Pdf_Annot_Quads = AscDFH.historyitem_type_Pdf_Annot | 17;
+ AscDFH.historyitem_Pdf_Annot_Intent = AscDFH.historyitem_type_Pdf_Annot | 18;
+ AscDFH.historyitem_Pdf_Annot_WasChanged = AscDFH.historyitem_type_Pdf_Annot | 19;
// Comment
AscDFH.historyitem_Pdf_Comment_Data = AscDFH.historyitem_type_Pdf_Comment | 1;
// Ink
- AscDFH.historyitem_Pdf_Ink_Points = AscDFH.historyitem_type_Pdf_Ink | 1;
- AscDFH.historyitem_Pdf_Ink_FlipV = AscDFH.historyitem_type_Pdf_Ink | 2;
- AscDFH.historyitem_Pdf_Ink_FlipH = AscDFH.historyitem_type_Pdf_Ink | 3;
+ AscDFH.historyitem_Pdf_Ink_Points = AscDFH.historyitem_type_Pdf_Annot_Ink | 1;
+ AscDFH.historyitem_Pdf_Ink_FlipV = AscDFH.historyitem_type_Pdf_Annot_Ink | 2;
+ AscDFH.historyitem_Pdf_Ink_FlipH = AscDFH.historyitem_type_Pdf_Annot_Ink | 3;
// FreeText
- AscDFH.historyitem_Pdf_FreeText_CL = AscDFH.historyitem_Pdf_FreeText | 1;
- AscDFH.historyitem_Pdf_FreeText_RC = AscDFH.historyitem_Pdf_FreeText | 2;
+ AscDFH.historyitem_type_Pdf_Annot_FreeText_CL = AscDFH.historyitem_type_Pdf_Annot_FreeText | 1;
+ AscDFH.historyitem_type_Pdf_Annot_FreeText_RC = AscDFH.historyitem_type_Pdf_Annot_FreeText | 2;
+ AscDFH.historyitem_type_Pdf_Annot_FreeText_Align = AscDFH.historyitem_type_Pdf_Annot_FreeText | 3;
+ AscDFH.historyitem_type_Pdf_Annot_FreeText_Rotate = AscDFH.historyitem_type_Pdf_Annot_FreeText | 4;
// annot line
- AscDFH.historyitem_Pdf_Line_Points = AscDFH.historyitem_type_Pdf_Line | 1;
+ AscDFH.historyitem_Pdf_Line_Points = AscDFH.historyitem_type_Pdf_Annot_Line | 1;
//------------------------------------------------------------------------------------------------------------------
- // Типы изменений в PDF Text Shape
+ // Типы изменений в PDF drawing prototype
//------------------------------------------------------------------------------------------------------------------
- AscDFH.historyitem_Pdf_Drawing_Rect = AscDFH.historyitem_Pdf_Drawing | 0;
- AscDFH.historyitem_Pdf_Drawing_Page = AscDFH.historyitem_Pdf_Drawing | 1;
- AscDFH.historyitem_Pdf_Drawing_Rot = AscDFH.historyitem_Pdf_Drawing | 2;
+ AscDFH.historyitem_type_Pdf_Drawing_Page = AscDFH.historyitem_type_Pdf_Drawing | 1;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе CPDFDoc
//------------------------------------------------------------------------------------------------------------------
- window['AscDFH'].historyitem_PDF_Document_AddItem = window['AscDFH'].historyitem_type_PDF_Document | 1;
- window['AscDFH'].historyitem_PDF_Document_RemoveItem = window['AscDFH'].historyitem_type_PDF_Document | 2;
- window['AscDFH'].historyitem_PDF_Document_AddPage = window['AscDFH'].historyitem_type_PDF_Document | 3;
- window['AscDFH'].historyitem_PDF_Document_RemovePage = window['AscDFH'].historyitem_type_PDF_Document | 4;
- window['AscDFH'].historyitem_PDF_Document_RotatePage = window['AscDFH'].historyitem_type_PDF_Document | 5;
- window['AscDFH'].historyitem_PDF_Document_RecognizePage = window['AscDFH'].historyitem_type_PDF_Document | 6;
- window['AscDFH'].historyitem_PDF_Document_ChangePosInTree = window['AscDFH'].historyitem_type_PDF_Document | 7;
+ window['AscDFH'].historyitem_PDF_Document_AnnotsContent = window['AscDFH'].historyitem_type_PDF_Document | 1;
+ window['AscDFH'].historyitem_PDF_Document_DrawingsContent = window['AscDFH'].historyitem_type_PDF_Document | 2;
+ window['AscDFH'].historyitem_PDF_Document_FieldsContent = window['AscDFH'].historyitem_type_PDF_Document | 3;
+ window['AscDFH'].historyitem_PDF_Document_AddPage = window['AscDFH'].historyitem_type_PDF_Document | 4;
+ window['AscDFH'].historyitem_PDF_Document_RemovePage = window['AscDFH'].historyitem_type_PDF_Document | 5;
+ window['AscDFH'].historyitem_PDF_Document_RotatePage = window['AscDFH'].historyitem_type_PDF_Document | 6;
+ window['AscDFH'].historyitem_PDF_Document_RecognizePage = window['AscDFH'].historyitem_type_PDF_Document | 7;
+ window['AscDFH'].historyitem_PDF_Document_SetDocument = window['AscDFH'].historyitem_type_PDF_Document | 8;
+
+
+ AscDFH.historyitem_CustomPropertiesAddProperty = AscDFH.historyitem_type_CustomProperties | 0;
+ AscDFH.historyitem_CustomPropertiesRemoveProperty = AscDFH.historyitem_type_CustomProperties | 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4071,6 +4396,7 @@
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ window['AscDFH'].historydescription_Unknown = 0x0000;
window['AscDFH'].historydescription_Cut = 0x0001;
window['AscDFH'].historydescription_PasteButtonIE = 0x0002;
window['AscDFH'].historydescription_PasteButtonNotIE = 0x0003;
@@ -4510,6 +4836,34 @@
window['AscDFH'].historydescription_Document_AddRemoveBeforeAfterParagraph = 0x01b0;
window['AscDFH'].historydescription_Document_SectionPageNumFormat = 0x01b1;
window['AscDFH'].historydescription_Document_SetPageColor = 0x01b2;
+ window['AscDFH'].historydescription_Document_InsertTextFromFile = 0x01b3;
+ window['AscDFH'].historydescription_Document_AddComplexField = 0x01b4;
+ window['AscDFH'].historydescription_Document_EditComplexFieldInstruction = 0x01b5;
+ window['AscDFH'].historydescription_Collaborative_DeletedTextRecovery = 0x01b6;
+ window['AscDFH'].historydescription_Document_AutoCorrectMath = 0x01b7;
+
+ window['AscDFH'].historydescription_CustomProperties_Add = 0x01b8;
+ window['AscDFH'].historydescription_CustomProperties_Remove = 0x01b9;
+ window['AscDFH'].historydescription_CustomProperties_Modify = 0x01c0;
+ // pdf
+ window['AscDFH'].historydescription_Pdf_AddAnnot = 0x29a;
+ window['AscDFH'].historydescription_Pdf_FreeTextGeom = 0x29b;
+ window['AscDFH'].historydescription_Pdf_AddPage = 0x29c;
+ window['AscDFH'].historydescription_Pdf_RemovePage = 0x29d;
+ window['AscDFH'].historydescription_Pdf_AddHighlightAnnot = 0x29e;
+ window['AscDFH'].historydescription_Pdf_EraseInk = 0x29f;
+ window['AscDFH'].historydescription_Pdf_RemoveComment = 0x2a0;
+ window['AscDFH'].historydescription_Pdf_EditPage = 0x2a1;
+ window['AscDFH'].historydescription_Pdf_ContextMenuRemove = 0x2a2;
+ window['AscDFH'].historydescription_Pdf_RotatePage = 0x2a3;
+ window['AscDFH'].historydescription_Pdf_UpdateAnnotRC = 0x2a4;
+ window['AscDFH'].historydescription_Pdf_ClickCheckbox = 0x2a5;
+ window['AscDFH'].historydescription_Pdf_FieldCommit = 0x2a6;
+ window['AscDFH'].historydescription_Pdf_FieldImportImage = 0x2a6;
+ window['AscDFH'].historydescription_Pdf_FieldSelectOption = 0x2a7;
+ window['AscDFH'].historydescription_Pdf_ExecActions = 0x2a8;
+ window['AscDFH'].historydescription_Pdf_FreeTextFitTextBox = 0x2a9;
+ window['AscDFH'].historydescription_Pdf_AddComment = 0x2b0;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4654,6 +5008,13 @@
{
return true;
};
+ CChangesBaseContentChange.prototype.GetContentChangesClass = function()
+ {
+ if (this.Class && this.Class.m_oContentChanges)
+ return this.Class.m_oContentChanges;
+
+ return null;
+ };
CChangesBaseContentChange.prototype.IsAdd = function()
{
return this.Add;
diff --git a/common/Local/common.js b/common/Local/common.js
index aff8f025a6..92d4720fe7 100644
--- a/common/Local/common.js
+++ b/common/Local/common.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Local/license.js b/common/Local/license.js
index e7caf27768..ce846f7e30 100644
--- a/common/Local/license.js
+++ b/common/Local/license.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Merge/NodejsEnv.js b/common/Merge/NodejsEnv.js
index 097826c416..e3ff71ed7f 100644
--- a/common/Merge/NodejsEnv.js
+++ b/common/Merge/NodejsEnv.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Native/native.js b/common/Native/native.js
index 8569568621..7d611ed6b9 100644
--- a/common/Native/native.js
+++ b/common/Native/native.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -241,13 +241,21 @@ document.documentElement = _null_object;
document.body = _null_object;
// NATIVE OBJECT
-window.native = native;
function GetNativeEngine() { return window.native; }
var Api = null; // main builder object
window.devicePixelRatio = 1;
-if (window.native && window.native.GetDevicePixelRatio)
- window.devicePixelRatio = window.native.GetDevicePixelRatio();
+
+window.InitNativeObject = function()
+{
+ window.native = native;
+ window.devicePixelRatio = 1;
+ if (window.native && window.native.GetDevicePixelRatio)
+ window.devicePixelRatio = window.native.GetDevicePixelRatio();
+};
+
+if (undefined !== native)
+ window.InitNativeObject();
// OPEN
function NativeCreateApi(options)
@@ -259,15 +267,28 @@ function NativeCreateApi(options)
if (options && undefined !== options["translate"])
configApi["translate"] = options["translate"];
- if (window.NATIVE_DOCUMENT_TYPE === "presentation" || window.NATIVE_DOCUMENT_TYPE === "document")
+ switch (window.NATIVE_DOCUMENT_TYPE)
{
- Api = new window["Asc"]["asc_docs_api"](configApi);
- if (options && options["documentLayout"] && undefined !== options["documentLayout"]["openedAt"])
- Api.setOpenedAt(options["documentLayout"]["openedAt"]);
- }
- else
- {
- Api = new window["Asc"]["spreadsheet_api"](configApi);
+ case "document":
+ case "presentation":
+ {
+ Api = new window["Asc"]["asc_docs_api"](configApi);
+ if (options && options["documentLayout"] && undefined !== options["documentLayout"]["openedAt"])
+ Api.setOpenedAt(options["documentLayout"]["openedAt"]);
+ break;
+ }
+ case "spreadsheet":
+ {
+ Api = new window["Asc"]["spreadsheet_api"](configApi);
+ break;
+ }
+ case "pdf":
+ {
+ Api = new window["Asc"]["PDFEditorApi"](configApi);
+ break;
+ }
+ default:
+ break;
}
if (options && undefined !== options["locale"])
@@ -278,14 +299,26 @@ function NativeOpenFileData(data, version, xlsx_file_path, options)
{
NativeCreateApi(options);
- if (window.NATIVE_DOCUMENT_TYPE === "presentation" ||
- window.NATIVE_DOCUMENT_TYPE === "document")
- {
- Api.asc_nativeOpenFile(data, version);
- }
- else
+ switch (window.NATIVE_DOCUMENT_TYPE)
{
- Api.asc_nativeOpenFile(data, version, undefined, xlsx_file_path);
+ case "document":
+ case "presentation":
+ {
+ Api.asc_nativeOpenFile(data, version);
+ break;
+ }
+ case "spreadsheet":
+ {
+ Api.asc_nativeOpenFile(data, version, undefined, xlsx_file_path);
+ break;
+ }
+ case "pdf":
+ {
+ Api.asc_nativeOpenFile(data, version);
+ break;
+ }
+ default:
+ break;
}
}
diff --git a/common/Native/native_graphics.js b/common/Native/native_graphics.js
index cb26579fe0..50e4b91641 100644
--- a/common/Native/native_graphics.js
+++ b/common/Native/native_graphics.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -31,12 +31,12 @@
*/
"use strict";
-function CNativeGraphics()
+function CNativeGraphics(nativeEmbed)
{
AscCommon.CGraphicsBase.call(this, AscCommon.RendererType.NativeDrawer);
/** @suppress {checkVars} */
- this.Native = CreateEmbedObject("CGraphicsEmbed");
+ this.Native = nativeEmbed ? nativeEmbed : CreateEmbedObject("CGraphicsEmbed");
this.isNativeGraphics = true;
diff --git a/common/NumFormat.js b/common/NumFormat.js
index fc3113febb..541b22daf0 100644
--- a/common/NumFormat.js
+++ b/common/NumFormat.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -2847,26 +2847,45 @@ CellFormat.prototype =
{
isTextFormat : function()
{
- if(null != this.oPositiveFormat)
+ if (this.oPositiveFormat != null) {
return this.oPositiveFormat.bTextFormat;
- else if(null != this.aComporationFormats && this.aComporationFormats.length > 0)
+ } else if (this.aComporationFormats != null && this.aComporationFormats.length > 0) {
return this.aComporationFormats[0].bTextFormat;
+ }
return false;
},
isGeneralFormat : function()
{
- if(null != this.oPositiveFormat)
+ if (this.oPositiveFormat != null) {
return this.oPositiveFormat.isGeneral();
- else if(null != this.aComporationFormats && this.aComporationFormats.length > 0)
+ } else if (this.aComporationFormats != null && this.aComporationFormats.length > 0) {
return this.aComporationFormats[0].isGeneral();
+ }
return false;
},
isDateTimeFormat : function()
{
- if(null != this.oPositiveFormat)
+ if (this.oPositiveFormat != null) {
return this.oPositiveFormat.bDateTime;
- else if(null != this.aComporationFormats && this.aComporationFormats.length > 0)
+ } else if (this.aComporationFormats != null && this.aComporationFormats.length > 0) {
return this.aComporationFormats[0].bDateTime;
+ }
+ return false;
+ },
+ isTimeFormat : function() {
+ if (this.oPositiveFormat != null) {
+ return this.oPositiveFormat.bTime;
+ } else if (this.aComporationFormats != null && this.aComporationFormats.length > 0) {
+ return this.aComporationFormats[0].bTime;
+ }
+ return false;
+ },
+ isDateFormat : function() {
+ if ( this.oPositiveFormat != null) {
+ return this.oPositiveFormat.bDate;
+ } else if (this.aComporationFormats != null && this.aComporationFormats.length > 0) {
+ return this.aComporationFormats[0].bDate;
+ }
return false;
},
getTextFormat: function () {
@@ -3884,7 +3903,14 @@ FormatParser.prototype =
prev.date = true;
}
if (i + 1 < length) {
- var next = match[i + 1];
+ let next = match[i + 1]
+ // processing the option when the date is given as the format "October 11, 2008"
+ if (i === 0 && i + 2 < length) {
+ let afterNext = match[i + 2];
+ if (oDataTypes.digit == afterNext.type && false == afterNext.time) {
+ afterNext.date = true;
+ }
+ }
if (oDataTypes.digit == next.type && false == next.time)
next.date = true;
}
@@ -3931,7 +3957,7 @@ FormatParser.prototype =
bError = true;//случай "1-2-3 10"
}
var nDateLength = aDate.length;
- if (nDateLength > 0 && !(2 <= nDateLength && nDateLength <= 3 && (null == nMonthIndex || (3 == nDateLength && 1 == nMonthIndex) || 2 == nDateLength)))
+ if (nDateLength > 0 && !(2 <= nDateLength && nDateLength <= 3 && (null == nMonthIndex || (3 == nDateLength && 1 == nMonthIndex) || 2 == nDateLength || (3 == nDateLength && 0 == nMonthIndex))))
bError = true;
var nTimeLength = aTime.length;
if (nTimeLength > 3)
@@ -3969,12 +3995,18 @@ FormatParser.prototype =
bError = true;
}
}
- }
- else {
- res.sDateFormat = "d-mmm-yy";
- res.d = aDate[0];
- res.m = aDate[1];
- res.y = aDate[2];
+ } else {
+ if (nMonthIndex == 0) {
+ res.sDateFormat = "dd-mmm-yy";
+ res.m = aDate[0];
+ res.d = aDate[1];
+ res.y = aDate[2];
+ } else {
+ res.sDateFormat = "d-mmm-yy";
+ res.d = aDate[0];
+ res.m = aDate[1];
+ res.y = aDate[2];
+ }
}
}
else {
@@ -4252,7 +4284,7 @@ FormatParser.prototype =
break;
}
}
- return bRes;
+ return length === 0 ? false: bRes;
},
parseDate: function (value, cultureInfo)
{
@@ -4273,7 +4305,7 @@ FormatParser.prototype =
var oDataType = null;
if("0" <= sChar && sChar <= "9")
oDataType = oDataTypes.digit;
- else if(" " == sChar)
+ else if(" " == sChar || "," == sChar)
oDataType = oDataTypes.space;
else if ("/" == sChar || "-" == sChar || ":" == sChar || cultureInfo.DateSeparator == sChar || cultureInfo.TimeSeparator == sChar)
oDataType = oDataTypes.delimiter;
@@ -4329,7 +4361,7 @@ FormatParser.prototype =
}
else if (!bMonth) {
bMonth = true;
- var aArraysToCheck = [{ arr: cultureInfo.AbbreviatedMonthNames, format: "mmm" }, { arr: cultureInfo.MonthNames, format: "mmmm" }];
+ let aArraysToCheck = [{ arr: cultureInfo.MonthNames, format: "mmmm" }, { arr: cultureInfo.AbbreviatedMonthNames, format: "mmm" }];
var bFound = false;
for (var index in aArraysToCheck) {
var aArrayTemp = aArraysToCheck[index];
@@ -5715,7 +5747,7 @@ var g_aCultureInfos = {
1045: {LCID: 1045, Name: "pl-PL", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "zł", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"], AbbreviatedDayNames: ["niedz.", "pon.", "wt.", "śr.", "czw.", "pt.", "sob."], MonthNames: ["styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień", ""], AbbreviatedMonthNames: ["sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paź", "lis", "gru", ""], MonthGenitiveNames: ["stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia", ""], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\,\\ d\\ mmmm\\ yyyy"},
1046: {LCID: 1046, Name: "pt-BR", CurrencyPositivePattern: 2, CurrencyNegativePattern: 9, CurrencySymbol: "R$", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"], AbbreviatedDayNames: ["dom", "seg", "ter", "qua", "qui", "sex", "sáb"], MonthNames: ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro", ""], AbbreviatedMonthNames: ["jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\,\\ d\" de \"mmmm\" de \"yyyy"},
1049: {LCID: 1049, Name: "ru-RU", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "₽", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], AbbreviatedDayNames: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], MonthNames: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь", ""], AbbreviatedMonthNames: ["янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек", ""], MonthGenitiveNames: ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря", ""], AbbreviatedMonthGenitiveNames: ["янв", "фев", "мар", "апр", "мая", "июн", "июл", "авг", "сен", "окт", "ноя", "дек", ""], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "d\\ mmmm\\ yyyy\\ \"г.\""},
- 1050: {LCID: 1050, Name: "hr-HR", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "kn", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["nedjelja", "ponedjeljak", "utorak", "srijeda", "četvrtak", "petak", "subota"], AbbreviatedDayNames: ["ned", "pon", "uto", "sri", "čet", "pet", "sub"], MonthNames: ["siječanj", "veljača", "ožujak", "travanj", "svibanj", "lipanj", "srpanj", "kolovoz", "rujan", "listopad", "studeni", "prosinac", ""], AbbreviatedMonthNames: ["sij", "vlj", "ožu", "tra", "svi", "lip", "srp", "kol", "ruj", "lis", "stu", "pro", ""], MonthGenitiveNames: ["siječnja", "veljače", "ožujka", "travnja", "svibnja", "lipnja", "srpnja", "kolovoza", "rujna", "listopada", "studenog", "prosinca", ""], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "d\\.\\ mmmm\\ yyyy\\."},
+ 1050: {LCID: 1050, Name: "hr-HR", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "€", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["nedjelja", "ponedjeljak", "utorak", "srijeda", "četvrtak", "petak", "subota"], AbbreviatedDayNames: ["ned", "pon", "uto", "sri", "čet", "pet", "sub"], MonthNames: ["siječanj", "veljača", "ožujak", "travanj", "svibanj", "lipanj", "srpanj", "kolovoz", "rujan", "listopad", "studeni", "prosinac", ""], AbbreviatedMonthNames: ["sij", "vlj", "ožu", "tra", "svi", "lip", "srp", "kol", "ruj", "lis", "stu", "pro", ""], MonthGenitiveNames: ["siječnja", "veljače", "ožujka", "travnja", "svibnja", "lipnja", "srpnja", "kolovoza", "rujna", "listopada", "studenog", "prosinca", ""], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "d\\.\\ mmmm\\ yyyy\\."},
1051: {LCID: 1051, Name: "sk-SK", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "€", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["nedeľa", "pondelok", "utorok", "streda", "štvrtok", "piatok", "sobota"], AbbreviatedDayNames: ["ne", "po", "ut", "st", "št", "pi", "so"], MonthNames: ["január", "február", "marec", "apríl", "máj", "jún", "júl", "august", "september", "október", "november", "december", ""], AbbreviatedMonthNames: ["jan", "feb", "mar", "apr", "máj", "jún", "júl", "aug", "sep", "okt", "nov", "dec", ""], MonthGenitiveNames: ["januára", "februára", "marca", "apríla", "mája", "júna", "júla", "augusta", "septembra", "októbra", "novembra", "decembra", ""], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "dddd\\ d\\.\\ mmmm\\ yyyy"},
1053: {LCID: 1053, Name: "sv-SE", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "kr", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"], AbbreviatedDayNames: ["sön", "mån", "tis", "ons", "tor", "fre", "lör"], MonthNames: ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december", ""], AbbreviatedMonthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: "-", TimeSeparator: ":", ShortDatePattern: "531", LongDatePattern: "\"den \"d\\ mmmm\\ yyyy"},
1055: {LCID: 1055, Name: "tr-TR", CurrencyPositivePattern: 0, CurrencyNegativePattern: 1, CurrencySymbol: "₺", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], AbbreviatedDayNames: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], MonthNames: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık", ""], AbbreviatedMonthNames: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "ÖÖ", PMDesignator: "ÖS", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "035", LongDatePattern: "d\\ mmmm\\ yyyy\\ dddd"},
@@ -5775,10 +5807,12 @@ var g_aCultureInfos = {
9225: {LCID: 9225, Name: "en-029", CurrencyPositivePattern: 0, CurrencyNegativePattern: 1, CurrencySymbol: "EC$", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], AbbreviatedDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], MonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], AbbreviatedMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\,\\ dd\\ mmmm\\ yyyy"},
9226: {LCID: 9226, Name: "es-CO", CurrencyPositivePattern: 2, CurrencyNegativePattern: 9, CurrencySymbol: "$", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], AbbreviatedDayNames: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."], MonthNames: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre", ""], AbbreviatedMonthNames: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic.", ""], AMDesignator: "a. m.", PMDesignator: "p. m.", UseAMPM: 1, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "035", LongDatePattern: "dddd\\,\\ d\\ \"de\"\\ mmmm\\ \"de\"\\ yyyy"},
9228: {LCID: 9228, Name: "fr-CD", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "FC", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], AbbreviatedDayNames: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], MonthNames: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre", ""], AbbreviatedMonthNames: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\ d\\ mmmm\\ yyyy"},
+ 9242: {LCID: 9242, Name: "sr-Latn-RS", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "RSD", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["nedelja", "ponedeljak", "utorak", "sreda", "četvrtak", "petak", "subota"], AbbreviatedDayNames: ["ned", "pon", "uto", "sre", "čet", "pet", "sub"], MonthNames: ["januar", "februar", "mart", "april", "maj", "jun", "jul", "avgust", "septembar", "oktobar", "novembar", "decembar", ""], AbbreviatedMonthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "avg", "sep", "okt", "nov", "dec", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "pre podne", PMDesignator: "po podne", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "dddd\\,\\ dd\\.\\ mmmm\\ yyyy\\."},
10241: {LCID: 10241, Name: "ar-SY", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "ل.س.", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], AbbreviatedDayNames: ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], MonthNames: ["كانون الثاني", "شباط", "آذار", "نيسان", "أيار", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول", ""], AbbreviatedMonthNames: ["كانون الثاني", "شباط", "آذار", "نيسان", "أيار", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "ص", PMDesignator: "م", UseAMPM: 1, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dd\\ mmmm\\,\\ yyyy"},
10249: {LCID: 10249, Name: "en-BZ", CurrencyPositivePattern: 0, CurrencyNegativePattern: 1, CurrencySymbol: "$", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], AbbreviatedDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], MonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], AbbreviatedMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "am", PMDesignator: "pm", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\,\\ dd\\ mmmm\\ yyyy"},
10250: {LCID: 10250, Name: "es-PE", CurrencyPositivePattern: 2, CurrencyNegativePattern: 9, CurrencySymbol: "S/", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], AbbreviatedDayNames: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."], MonthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre", "Noviembre", "Diciembre", ""], AbbreviatedMonthNames: ["Ene.", "Feb.", "Mar.", "Abr.", "May.", "Jun.", "Jul.", "Ago.", "Set.", "Oct.", "Nov.", "Dic.", ""], MonthGenitiveNames: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "setiembre", "octubre", "noviembre", "diciembre", ""], AbbreviatedMonthGenitiveNames: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "set.", "oct.", "nov.", "dic.", ""], AMDesignator: "a. m.", PMDesignator: "p. m.", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "035", LongDatePattern: "dddd\\,\\ d\\ \"de\"\\ mmmm\\ \"de\"\\ yyyy"},
10252: {LCID: 10252, Name: "fr-SN", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "CFA", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], AbbreviatedDayNames: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], MonthNames: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre", ""], AbbreviatedMonthNames: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\ d\\ mmmm\\ yyyy"},
+ 10266: {LCID: 10266, Name: "sr-Cyrl-RS", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "дин.", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["недеља", "понедељак", "уторак", "среда", "четвртак", "петак", "субота"], AbbreviatedDayNames: ["нед.", "пон.", "ут.", "ср.", "чет.", "пет.", "суб."], MonthNames: ["јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар", ""], AbbreviatedMonthNames: ["јан.", "феб.", "март", "апр.", "мај", "јун", "јул", "авг.", "септ.", "окт.", "нов.", "дец.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "d\\.\\ mmmm\\ yyyy\\."},
11265: {LCID: 11265, Name: "ar-JO", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "د.ا.", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], AbbreviatedDayNames: ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], MonthNames: ["كانون الثاني", "شباط", "آذار", "نيسان", "أيار", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول", ""], AbbreviatedMonthNames: ["كانون الثاني", "شباط", "آذار", "نيسان", "أيار", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "ص", PMDesignator: "م", UseAMPM: 1, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dd\\ mmmm\\,\\ yyyy"},
11273: {LCID: 11273, Name: "en-TT", CurrencyPositivePattern: 0, CurrencyNegativePattern: 1, CurrencySymbol: "$", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], AbbreviatedDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], MonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], AbbreviatedMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "am", PMDesignator: "pm", UseAMPM: 1, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "dddd\\,\\ d\\ mmmm\\ yyyy"},
11274: {LCID: 11274, Name: "es-AR", CurrencyPositivePattern: 2, CurrencyNegativePattern: 9, CurrencySymbol: "$", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], AbbreviatedDayNames: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."], MonthNames: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre", ""], AbbreviatedMonthNames: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "a. m.", PMDesignator: "p. m.", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "dddd\\,\\ d\\ \"de\"\\ mmmm\\ \"de\"\\ yyyy"},
@@ -5811,12 +5845,14 @@ var g_aCultureInfos = {
21514: {LCID: 21514, Name: "es-US", CurrencyPositivePattern: 0, CurrencyNegativePattern: 0, CurrencySymbol: "$", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], AbbreviatedDayNames: ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"], MonthNames: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre", ""], AbbreviatedMonthNames: ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 1, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "205", LongDatePattern: "dddd\\,\\ mmmm\\ dd\\,\\ yyyy"},
22538: {LCID: 22538, Name: "es-419", CurrencyPositivePattern: 0, CurrencyNegativePattern: 1, CurrencySymbol: "XDR", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], AbbreviatedDayNames: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."], MonthNames: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre", ""], AbbreviatedMonthNames: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "a.m.", PMDesignator: "p.m.", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "dddd\\,\\ d\\ \"de\"\\ mmmm\\ \"de\"\\ yyyy"},
23562: {LCID: 23562, Name: "es-CU", CurrencyPositivePattern: 0, CurrencyNegativePattern: 1, CurrencySymbol: "$", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], AbbreviatedDayNames: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."], MonthNames: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre", ""], AbbreviatedMonthNames: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "a.m.", PMDesignator: "p.m.", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "dddd\\,\\ d\\ \"de\"\\ mmmm\\ \"de\"\\ yyyy"},
+ 27674: {LCID: 27674, Name: "sr-Cyrl", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "дин.", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["недеља", "понедељак", "уторак", "среда", "четвртак", "петак", "субота"], AbbreviatedDayNames: ["нед.", "пон.", "ут.", "ср.", "чет.", "пет.", "суб."], MonthNames: ["јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар", ""], AbbreviatedMonthNames: ["јан.", "феб.", "март", "апр.", "мај", "јун", "јул", "авг.", "септ.", "окт.", "нов.", "дец.", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "d\\.\\ mmmm\\ yyyy\\."},
+ 28698: {LCID: 28698, Name: "sr-Latn", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "RSD", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["nedelja", "ponedeljak", "utorak", "sreda", "četvrtak", "petak", "subota"], AbbreviatedDayNames: ["ned", "pon", "uto", "sre", "čet", "pet", "sub"], MonthNames: ["januar", "februar", "mart", "april", "maj", "jun", "jul", "avgust", "septembar", "oktobar", "novembar", "decembar", ""], AbbreviatedMonthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "avg", "sep", "okt", "nov", "dec", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "pre podne", PMDesignator: "po podne", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "dddd\\,\\ dd\\.\\ mmmm\\ yyyy\\."},
29740: {LCID: 29740, Name: "az-Cyrl", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "₼", NumberDecimalSeparator: ",", NumberGroupSeparator: " ", NumberGroupSizes: [3], DayNames: ["базар", "базар ертәси", "чәршәнбә ахшамы", "чәршәнбә", "ҹүмә ахшамы", "ҹүмә", "шәнбә"], AbbreviatedDayNames: ["Б", "Бе", "Ча", "Ч", "Ҹа", "Ҹ", "Ш"], MonthNames: ["jанвар", "феврал", "март", "апрел", "мај", "ијун", "ијул", "август", "сентјабр", "октјабр", "нојабр", "декабр", ""], AbbreviatedMonthNames: ["Јан", "Фев", "Мар", "Апр", "Мај", "Ијун", "Ијул", "Авг", "Сен", "Окт", "Ноя", "Дек", ""], MonthGenitiveNames: ["јанвар", "феврал", "март", "апрел", "мај", "ијун", "ијул", "август", "сентјабр", "октјабр", "нојабр", "декабр", ""], AbbreviatedMonthGenitiveNames: ["Јан", "Фев", "Мар", "Апр", "мая", "ијун", "ијул", "Авг", "Сен", "Окт", "Ноя", "Дек", ""], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "d\\ mmmm\\ yyyy"},
30724: {LCID: 30724, Name: "zh", CurrencyPositivePattern: 0, CurrencyNegativePattern: 2, CurrencySymbol: "¥", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], AbbreviatedDayNames: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], MonthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", ""], AbbreviatedMonthNames: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "上午", PMDesignator: "下午", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "520", LongDatePattern: "yyyy\"年\"m\"月\"d\"日\""},
30764: {LCID: 30764, Name: "az-Latn", CurrencyPositivePattern: 3, CurrencyNegativePattern: 8, CurrencySymbol: "₼", NumberDecimalSeparator: ",", NumberGroupSeparator: ".", NumberGroupSizes: [3], DayNames: ["bazar", "bazar ertəsi", "çərşənbə axşamı", "çərşənbə", "cümə axşamı", "cümə", "şənbə"], AbbreviatedDayNames: ["B.", "B.E.", "Ç.A.", "Ç.", "C.A.", "C.", "Ş."], MonthNames: ["Yanvar", "Fevral", "Mart", "Aprel", "May", "İyun", "İyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr", ""], AbbreviatedMonthNames: ["yan", "fev", "mar", "apr", "may", "iyn", "iyl", "avq", "sen", "okt", "noy", "dek", ""], MonthGenitiveNames: ["yanvar", "fevral", "mart", "aprel", "may", "iyun", "iyul", "avqust", "sentyabr", "oktyabr", "noyabr", "dekabr", ""], AbbreviatedMonthGenitiveNames: [], AMDesignator: "AM", PMDesignator: "PM", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "135", LongDatePattern: "d\\ mmmm\\ yyyy\\,\\ dddd"},
30800: {LCID: 30800, Name: "mn-Cyrl", CurrencyPositivePattern: 2, CurrencyNegativePattern: 9, CurrencySymbol: "₮", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["ням", "даваа", "мягмар", "лхагва", "пүрэв", "баасан", "бямба"], AbbreviatedDayNames: ["Ня", "Да", "Мя", "Лх", "Пү", "Ба", "Бя"], MonthNames: ["Нэгдүгээр сар", "Хоёрдугаар сар", "Гуравдугаар сар", "Дөрөвдүгээр сар", "Тавдугаар сар", "Зургаадугаар сар", "Долоодугаар сар", "Наймдугаар сар", "Есдүгээр сар", "Аравдугаар сар", "Арван нэгдүгээр сар", "Арван хоёрдугаар сар", ""], AbbreviatedMonthNames: ["1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар", ""], MonthGenitiveNames: ["нэгдүгээр сар", "хоёрдугаар сар", "гуравдугаар сар", "дөрөвдүгээр сар", "тавдугаар сар", "зургаадугаар сар", "долоодугаар сар", "наймдугаар сар", "есдүгээр сар", "аравдугаар сар", "арван нэгдүгээр сар", "арван хоёрдугаар сар", ""], AbbreviatedMonthGenitiveNames: [], AMDesignator: "ү.ө.", PMDesignator: "ү.х.", UseAMPM: 0, DateSeparator: ".", TimeSeparator: ":", ShortDatePattern: "531", LongDatePattern: "yyyy\\.mm\\.dd\\,\\ dddd"},
31748: {LCID: 31748, Name: "zh-Hant", CurrencyPositivePattern: 0, CurrencyNegativePattern: 0, CurrencySymbol: "HK$", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3], DayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], AbbreviatedDayNames: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"], MonthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", ""], AbbreviatedMonthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "上午", PMDesignator: "下午", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "025", LongDatePattern: "yyyy\"年\"m\"月\"d\"日\""},
- 31824: {LCID:31824,Name:"mn-Mong",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"¥",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3,0],DayNames:["ᠭᠠᠷᠠᠭ ᠤᠨ ᠡᠳᠦᠷ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠨᠢᠭᠡᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠬᠣᠶᠠᠷ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠭᠤᠷᠪᠠᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠳᠥᠷᠪᠡᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠲᠠᠪᠤᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠵᠢᠷᠭᠤᠭᠠᠨ"],AbbreviatedDayNames:["ᠭᠠᠷᠠᠭ ᠤᠨ ᠡᠳᠦᠷ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠨᠢᠭᠡᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠬᠣᠶᠠᠷ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠭᠤᠷᠪᠠᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠳᠥᠷᠪᠡᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠲᠠᠪᠤᠨ","ᠭᠠᠷᠠᠭ ᠤᠨ ᠵᠢᠷᠭᠤᠭᠠᠨ"],MonthNames:["ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠭᠤᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠲᠦᠷᠪᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠲᠠᠪᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠵᠢᠷᠭᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠲᠤᠯᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠨᠠᠢᠮᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠶᠢᠰᠦᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠠᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠠᠷᠪᠠᠨ ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠠᠷᠪᠠᠨ ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ",""],AbbreviatedMonthNames:["ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠭᠤᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠲᠦᠷᠪᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠲᠠᠪᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠵᠢᠷᠭᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠲᠤᠯᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠨᠠᠢᠮᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠶᠢᠰᠦᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠠᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ","ᠠᠷᠪᠠᠨ ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ","ᠠᠷᠪᠠᠨ ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",UseAMPM:0,DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520",LongDatePattern:"yyyy\\ᠣ\\ᠨ\\ mmmm\\ d\\ᠡ\\ᠳ\\ᠦ\\ᠷ\\᠂\\ dddd"},
+ 31824: {LCID: 31824, Name: "mn-Mong", CurrencyPositivePattern: 0, CurrencyNegativePattern: 2, CurrencySymbol: "¥", NumberDecimalSeparator: ".", NumberGroupSeparator: ",", NumberGroupSizes: [3, 0], DayNames: ["ᠭᠠᠷᠠᠭ ᠤᠨ ᠡᠳᠦᠷ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠨᠢᠭᠡᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠬᠣᠶᠠᠷ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠭᠤᠷᠪᠠᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠳᠥᠷᠪᠡᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠲᠠᠪᠤᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠵᠢᠷᠭᠤᠭᠠᠨ"], AbbreviatedDayNames: ["ᠭᠠᠷᠠᠭ ᠤᠨ ᠡᠳᠦᠷ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠨᠢᠭᠡᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠬᠣᠶᠠᠷ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠭᠤᠷᠪᠠᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠳᠥᠷᠪᠡᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠲᠠᠪᠤᠨ", "ᠭᠠᠷᠠᠭ ᠤᠨ ᠵᠢᠷᠭᠤᠭᠠᠨ"], MonthNames: ["ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠭᠤᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠲᠦᠷᠪᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠲᠠᠪᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠵᠢᠷᠭᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠲᠤᠯᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠨᠠᠢᠮᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠶᠢᠰᠦᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠠᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠠᠷᠪᠠᠨ ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠠᠷᠪᠠᠨ ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", ""], AbbreviatedMonthNames: ["ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠭᠤᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠲᠦᠷᠪᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠲᠠᠪᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠵᠢᠷᠭᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠲᠤᠯᠤᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠨᠠᠢᠮᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠶᠢᠰᠦᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠠᠷᠪᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", "ᠠᠷᠪᠠᠨ ᠨᠢᠭᠡᠳᠦᠭᠡᠷ ᠰᠠᠷᠠ", "ᠠᠷᠪᠠᠨ ᠬᠤᠶ᠋ᠠᠳᠤᠭᠠᠷ ᠰᠠᠷᠠ", ""], MonthGenitiveNames: [], AbbreviatedMonthGenitiveNames: [], AMDesignator: "", PMDesignator: "", UseAMPM: 0, DateSeparator: "/", TimeSeparator: ":", ShortDatePattern: "520", LongDatePattern: "yyyy\\ᠣ\\ᠨ\\ mmmm\\ d\\ᠡ\\ᠳ\\ᠦ\\ᠷ\\᠂\\ dddd"},
};
var g_oDefaultCultureInfo, g_oLCID;
setCurrentCultureInfo(1033);//en-US//1033//fr-FR//1036//basq//1069//ru-Ru//1049//hindi//1081
diff --git a/common/Overlay.js b/common/Overlay.js
index aedfff0249..ed8eb67160 100644
--- a/common/Overlay.js
+++ b/common/Overlay.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/PromiseIterators.js b/common/PromiseIterators.js
index 21d9a17e3e..d5673c7535 100644
--- a/common/PromiseIterators.js
+++ b/common/PromiseIterators.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Scrolls/mobileTouchManagerBase.js b/common/Scrolls/mobileTouchManagerBase.js
index b7f73c55a8..67211b2e45 100644
--- a/common/Scrolls/mobileTouchManagerBase.js
+++ b/common/Scrolls/mobileTouchManagerBase.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -38,6 +38,45 @@
var AscCommon = window['AscCommon'];
var global_mouseEvent = AscCommon.global_mouseEvent;
+ /*
+ function CVirtualKeyboard()
+ {
+ this.checkSupport = false;
+ this.isShow = false;
+
+ try
+ {
+ if ("virtualKeyboard" in navigator)
+ {
+ this.checkSupport = true;
+
+ if (navigator.virtualKeyboard.addEventListener)
+ {
+ navigator.virtualKeyboard.addEventListener("geometrychange", function(event) {
+ alert(JSON.stringify(event.target.boundingRect));
+ });
+ }
+ }
+ }
+ catch (err)
+ {
+ this.checkSupport = false;
+ }
+
+ this.isSupport = function()
+ {
+ return this.checkSupport;
+ };
+
+ this.isVisible = function()
+ {
+ return this.isShow;
+ };
+ }
+
+ AscCommon.virtualKeyboard = new CVirtualKeyboard();
+ */
+
AscCommon.MobileTouchMode =
{
None : 0,
@@ -215,6 +254,10 @@
{
return false;
};
+ CMobileDelegateSimple.prototype.IsLockedZoom = function()
+ {
+ return false;
+ };
/**
* @extends {CMobileDelegateSimple}
@@ -241,7 +284,10 @@
};
CMobileDelegateEditor.prototype.ConvertCoordsFromCursor = function(x, y)
{
- return this.DrawingDocument.ConvertCoordsFromCursor2(x, y);
+ let res = this.DrawingDocument.ConvertCoordsFromCursor2(x, y);
+ if (undefined === res.pageIndex)
+ res.Page = res.DrawPage;
+ return res;
};
CMobileDelegateEditor.prototype.GetElementOffset = function()
{
@@ -312,17 +358,14 @@
var _target = this.LogicDocument.IsSelectionUse();
if (_target === false)
{
- /*
- _info = {
- X : this.DrawingDocument.m_dTargetX,
- Y : this.DrawingDocument.m_dTargetY,
- Page : this.DrawingDocument.m_lTargetPage
- };
- */
+ let targetPos = this.LogicDocument.Get_TargetPos();
+ if (!targetPos)
+ return;
+
_info = {
- X : this.LogicDocument.TargetPos.X,
- Y : this.LogicDocument.TargetPos.Y,
- Page : this.LogicDocument.TargetPos.PageNum
+ X : targetPos.X,
+ Y : targetPos.Y,
+ Page : targetPos.PageNum
};
_transform = this.DrawingDocument.TextMatrix;
@@ -508,7 +551,7 @@
CMobileDelegateEditor.prototype.GetScrollerParent = function()
{
if (this.IsNativeViewer())
- return document.getElementById(this.Api.HtmlElementName);
+ return document.getElementById("id_main");
return this.HtmlPage.m_oMainView.HtmlElement;
};
CMobileDelegateEditor.prototype.GetScrollerSize = function()
@@ -570,7 +613,13 @@
};
CMobileDelegateEditor.prototype.IsReader = function()
{
- return (null != this.DrawingDocument.m_oDocumentRenderer);
+ return false;//(null != this.DrawingDocument.m_oDocumentRenderer);
+ };
+ CMobileDelegateEditor.prototype.IsLockedZoom = function()
+ {
+ // Fix after testing...
+ return false;
+ return this.HtmlPage.ReaderModeCurrent === 1;
};
CMobileDelegateEditor.prototype.IsNativeViewer = function()
{
@@ -581,6 +630,8 @@
CMobileDelegateEditor.prototype.Logic_GetNearestPos = function(x, y, page)
{
+ if (this.IsNativeViewer())
+ return null;
return this.LogicDocument.Get_NearestPos(page, x, y);
};
CMobileDelegateEditor.prototype.Logic_OnMouseDown = function(e, x, y, page)
@@ -597,14 +648,20 @@
};
CMobileDelegateEditor.prototype.Drawing_OnMouseDown = function(e)
{
+ if (this.IsNativeViewer())
+ return this.DrawingDocument.m_oDocumentRenderer.onMouseDown(e);
return this.HtmlPage.onMouseDown(e);
};
CMobileDelegateEditor.prototype.Drawing_OnMouseMove = function(e)
{
+ if (this.IsNativeViewer())
+ return this.DrawingDocument.m_oDocumentRenderer.onMouseMove(e);
return this.HtmlPage.onMouseMove(e);
};
CMobileDelegateEditor.prototype.Drawing_OnMouseUp = function(e)
{
+ if (this.IsNativeViewer())
+ return this.DrawingDocument.m_oDocumentRenderer.onMouseUp(e);
return this.HtmlPage.onMouseUp(e);
};
@@ -613,14 +670,20 @@
this.Api = null;
this.Mode = AscCommon.MobileTouchMode.None;
+ this.isDesktopMode = _config.desktopMode === true;
+ this.isTouchingProcess = false;
+ this.desktopTouchState = false;
+
this.IsTouching = false;
this.ReadingGlassTime = 750;
this.TimeDown = 0;
this.DownPoint = null;
this.DownPointOriginal = {X : 0, Y : 0};
+ this.MoveMinDist = 20;
+ this.isGlassDrawed = false;
+
this.MoveAfterDown = false;
- this.MoveMinDist = 10;
/* select text */
this.SelectEnabled = (_config.isSelection !== false);
@@ -681,15 +744,132 @@
this.isShowingContextMenu = false;
this.isMobileContextMenuShowResize = false;
+
+ // On Android, there is no way to show the keyboard except onclick
+ // TODO: may be exist another way??
+ this.isCheckFocusOnClick = AscCommon.AscBrowser.isAndroid;
+ this.isCheckFocusOnClickValue = false;
}
CMobileTouchManagerBase.prototype.initEvents = function(_id)
{
+ this.desktopTouchState = true;
this.eventsElement = _id;
this.iScroll.eventsElement = this.eventsElement;
this.iScroll._initEvents();
};
+ CMobileTouchManagerBase.prototype.isTouchMode = function()
+ {
+ if (this.isDesktopMode)
+ return this.desktopTouchState;
+ return true;
+ };
+
+ CMobileTouchManagerBase.prototype.checkMouseFocus = function(e)
+ {
+ // mobile version does not get focus with mouse events
+ if (this.Api.isMobileVersion && e && "mouse" === e.pointerType)
+ {
+ if (AscCommon.g_inputContext)
+ AscCommon.g_inputContext.setInterfaceEnableKeyEvents(true);
+ }
+ };
+
+ CMobileTouchManagerBase.prototype.checkTouchEvent = function(e)
+ {
+ if (!e)
+ return false;
+
+ if (this.isDesktopMode)
+ {
+ if (this.isTouchingInProcess())
+ return false;
+
+ if (e.pointerType === "touch")
+ {
+ this.desktopTouchState = true;
+
+ switch (this.Api.editorId)
+ {
+ case AscCommon.c_oEditorId.Word:
+ {
+ if (this.Api.isDrawTableErase === true ||
+ this.Api.isDrawTablePen === true ||
+ this.Api.isStartAddShape === true ||
+ this.Api.isInkDrawerOn())
+ {
+ this.desktopTouchState = false;
+ }
+ break;
+ }
+ case AscCommon.c_oEditorId.Spreadsheet:
+ {
+ if (this.Api.isStartAddShape === true)
+ {
+ this.desktopTouchState = false;
+ }
+ break;
+ }
+ case AscCommon.c_oEditorId.Presentation:
+ {
+ if (this.Api.isStartAddShape === true)
+ {
+ this.desktopTouchState = false;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ else
+ this.desktopTouchState = false;
+
+ return this.desktopTouchState;
+ }
+
+ return false;
+ };
+
+ CMobileTouchManagerBase.prototype.isTouchingInProcess = function()
+ {
+ return this.isTouchingProcess;
+ };
+ CMobileTouchManagerBase.prototype.startTouchingInProcess = function()
+ {
+ this.isTouchingProcess = true;
+ };
+ CMobileTouchManagerBase.prototype.stopTouchingInProcess = function()
+ {
+ this.isTouchingProcess = false;
+ };
+
+ CMobileTouchManagerBase.prototype.checkDesktopModeContextMenuEnd = function(e)
+ {
+ let isContextMenu = false;
+ if (this.isDesktopMode && !this.MoveAfterDown)
+ {
+ let newTime = new Date().getTime();
+ if ((newTime - this.TimeDown) > 750)
+ isContextMenu = true;
+ }
+
+ if (!e)
+ return isContextMenu;
+
+ if (!isContextMenu)
+ return;
+
+ AscCommon.global_mouseEvent.ButtonOverride = AscCommon.g_mouse_button_right;
+
+ let _e = e.changedTouches ? e.changedTouches[0] : e;
+ this.delegate.Drawing_OnMouseDown(_e);
+ this.delegate.Drawing_OnMouseUp(_e);
+
+ AscCommon.global_mouseEvent.ButtonOverride = -1;
+ };
+
CMobileTouchManagerBase.prototype.checkHandlersOnClick = function()
{
var handler = this.Api.getHandlerOnClick();
@@ -711,7 +891,7 @@
CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper)
{
var _scroller = document.createElement('div');
- var _style = "position: absolute; z-index: 0; margin: 0; padding: 0; -webkit-tap-highlight-color: rgba(0,0,0,0); width: 100%; heigth: 100%; display: block;";
+ var _style = "position: absolute; z-index: -1; margin: 0; padding: 0; -webkit-tap-highlight-color: rgba(0,0,0,0); width: 100%; heigth: 100%; display: block;";
_style += "-webkit-transform: translateZ(0); -moz-transform: translateZ(0); -ms-transform: translateZ(0); -o-transform: translateZ(0); transform: translateZ(0);";
_style += "touch-action:none;-webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;";
_style += "-webkit-text-size-adjust: none; -moz-text-size-adjust: none; -ms-text-size-adjust: none; -o-text-size-adjust: none; text-size-adjust: none;";
@@ -1072,6 +1252,12 @@
}
var _new_value = this.delegate.GetZoomFit();
+ if (this.isDesktopMode && !this.Api.isMobileVersion)
+ {
+ let c_min_zoom_value = 50; // delegate method
+ if (_new_value > c_min_zoom_value)
+ _new_value = c_min_zoom_value;
+ }
this.ZoomValueMin = _new_value;
if (this.ZoomValue < this.ZoomValueMin)
@@ -1170,7 +1356,9 @@
{
that.ContextMenuShowTimerId = -1;
var _pos = that.delegate.GetContextMenuPosition();
+ if (AscCommon.g_inputContext) AscCommon.g_inputContext.isGlobalDisableFocus = true;
that.Api.sendEvent("asc_onShowPopMenu", _pos.X, _pos.Y, (_pos.Mode > 1) ? true : false);
+ if (AscCommon.g_inputContext) AscCommon.g_inputContext.isGlobalDisableFocus = false;
}, 500);
};
@@ -1473,9 +1661,199 @@
this.PageSelect2 = _rect2.Page;
};
+ CMobileTouchManagerBase.prototype.CheckGlassUpdate = function()
+ {
+ if (this.isGlassDrawed)
+ this.delegate.HtmlPage.OnUpdateOverlay();
+ };
+
+ CMobileTouchManagerBase.prototype.CheckGlass = function(overlay, mainLayer, targetElement)
+ {
+ this.isGlassDrawed = false;
+
+ if (this.Mode !== AscCommon.MobileTouchMode.Cursor &&
+ this.Mode !== AscCommon.MobileTouchMode.Select)
+ {
+ return;
+ }
+
+ var rPR = AscCommon.AscBrowser.retinaPixelRatio;
+ let elementOffset = this.delegate.GetElementOffset();
+ let posMouseX = (rPR * (AscCommon.global_mouseEvent.X - elementOffset.X)) >> 0;
+ let posMouseY = (rPR * (AscCommon.global_mouseEvent.Y - elementOffset.Y)) >> 0;
+
+ let glassSize = (rPR * 100) >> 0;
+ let glassOffset = (rPR * 25) >> 0;
+ let glassScale = 2;
+
+ let srcSize = (glassSize / glassScale) >> 0;
+ let srcX = posMouseX - (srcSize >> 1);
+ let srcY = posMouseY - (srcSize >> 1);
+
+ if (0 > srcX || 0 > srcY)
+ return;
+
+ let srcR = srcX + srcSize;
+ let srcB = srcY + srcSize;
+
+ let rad = (glassSize >> 1);
+ let dstX = posMouseX - rad;
+ let dstY = posMouseY - glassOffset - glassSize;
+
+ let imageSizeX = mainLayer.width;
+ let imageSizeY = mainLayer.height;
+
+ if (srcY < 0)
+ {
+ dstY += ((-1 * glassScale * srcY) >> 0);
+ srcY = 0;
+ }
+ if (srcX < 0)
+ {
+ dstX += ((-1 * glassScale * srcX) >> 0);
+ srcX = 0;
+ }
+ if (srcR >= imageSizeX)
+ srcR = imageSizeX;
+ if (srcB >= imageSizeY)
+ srcB = imageSizeY;
+
+ var ctx = overlay.m_oContext;
+ ctx.save();
+ ctx.beginPath();
+ ctx.arc(dstX + rad, dstY + rad, rad, 0, 2 * Math.PI);
+ ctx.clip();
+ ctx.beginPath();
+
+ let srcW = srcR - srcX;
+ let srcH = srcB - srcY;
+
+ if (srcW > 0 && srcH > 0)
+ {
+ if (AscCommon.AscBrowser.isAppleDevices)
+ {
+ if (!this.glassCanvas)
+ this.glassCanvas = document.createElement("canvas");
+
+ if (glassSize !== this.glassCanvas.width || glassSize !== this.glassCanvas.height)
+ {
+ this.glassCanvas.width = glassSize;
+ this.glassCanvas.width = glassSize;
+ }
+ let ctxTmp = this.glassCanvas.getContext("2d");
+
+ let data1 = mainLayer.getContext("2d").getImageData(srcX, srcY, srcW, srcH);
+ ctxTmp.putImageData(data1, 0, 0);
+ ctx.drawImage(this.glassCanvas, 0, 0, srcW, srcH, dstX, dstY, (srcW * glassScale) >> 0, (srcH * glassScale) >> 0);
+
+ let data2 = ctx.getImageData(srcX, srcY, srcW, srcH);
+ ctxTmp.putImageData(data2, 0, 0);
+ ctx.drawImage(this.glassCanvas, 0, 0, srcW, srcH, dstX, dstY, (srcW * glassScale) >> 0, (srcH * glassScale) >> 0);
+ } else
+ {
+ ctx.drawImage(mainLayer, srcX, srcY, srcW, srcH, dstX, dstY, (srcW * glassScale) >> 0, (srcH * glassScale) >> 0);
+ ctx.drawImage(ctx.canvas, srcX, srcY, srcW, srcH, dstX, dstY, (srcW * glassScale) >> 0, (srcH * glassScale) >> 0);
+ }
+ }
+
+ if (targetElement)
+ {
+ let tL = parseInt(targetElement.style.left);
+ let tT = parseInt(targetElement.style.top);
+ let tR = tL + parseInt(targetElement.style.width);
+ let tB = tT + parseInt(targetElement.style.height);
+ let m = undefined;
+
+ let transform = targetElement.style["transform"] || targetElement.style["webkitTransform"] || targetElement.style["mozTransform"] || targetElement.style["msTransform"] || "";
+ if (transform !== "")
+ {
+ let pos1 = transform.indexOf("(");
+ let pos2 = transform.indexOf(")");
+
+ if (-1 !== pos1 && -1 !== pos2 && pos2 > pos1)
+ {
+ let arrPos = transform.substring(pos1 + 1, pos2).split(", ");
+ if (6 === arrPos.length)
+ {
+ m = new AscCommon.CMatrix();
+ m.SetValues(parseFloat(arrPos[0]), parseFloat(arrPos[1]), parseFloat(arrPos[2]),
+ parseFloat(arrPos[3]), parseFloat(arrPos[4]), parseFloat(arrPos[5]));
+ }
+ }
+ }
+
+ let arrPoints = new Array(8);
+
+ if (!m)
+ {
+ arrPoints[0] = tL * rPR;
+ arrPoints[1] = tT * rPR;
+
+ arrPoints[2] = tR * rPR;
+ arrPoints[3] = tT * rPR;
+
+ arrPoints[4] = tR * rPR;
+ arrPoints[5] = tB * rPR;
+
+ arrPoints[6] = tL * rPR;
+ arrPoints[7] = tB * rPR;
+ }
+ else
+ {
+ arrPoints[0] = rPR * m.TransformPointX(tL, tT);
+ arrPoints[1] = rPR * m.TransformPointY(tL, tT);
+
+ arrPoints[2] = rPR * m.TransformPointX(tR, tT);
+ arrPoints[3] = rPR * m.TransformPointY(tR, tT);
+
+ arrPoints[4] = rPR * m.TransformPointX(tR, tB);
+ arrPoints[5] = rPR * m.TransformPointY(tR, tB);
+
+ arrPoints[6] = rPR * m.TransformPointX(tL, tB);
+ arrPoints[7] = rPR * m.TransformPointY(tL, tB);
+ }
+
+ let cX = posMouseX;
+ let cY = posMouseY - glassOffset - rad;
+ for (let i = 0; i < 8; i += 2)
+ {
+ let x = arrPoints[i];
+ let y = arrPoints[i + 1];
+
+ x = cX + (x - posMouseX) * glassScale;
+ y = cY + (y - posMouseY) * glassScale;
+
+ if (0 === i)
+ ctx.moveTo(x, y);
+ else
+ ctx.lineTo(x, y);
+ }
+ ctx.closePath();
+ ctx.fillStyle = targetElement.style.backgroundColor;
+ ctx.fill();
+ ctx.beginPath();
+ }
+
+ ctx.beginPath();
+ ctx.arc(dstX + rad, dstY + rad, rad, 0, 2 * Math.PI);
+ ctx.lineWidth = 1;
+ ctx.strokeStyle = GlobalSkin.RulerOutline;
+ ctx.stroke();
+ ctx.beginPath();
+
+ overlay.CheckRect(posMouseX - rad, posMouseY - glassOffset - glassSize, glassSize, glassSize);
+
+ ctx.restore();
+
+ this.isGlassDrawed = true;
+ };
+
// отрисовка текстового селекта
CMobileTouchManagerBase.prototype.CheckSelect = function(overlay)
{
+ if (!this.desktopTouchState)
+ return;
+
if (!this.SelectEnabled)
return;
@@ -1586,6 +1964,9 @@
// заточка на определенного делегата
CMobileTouchManagerBase.prototype.CheckTableRules = function(overlay)
{
+ if (!this.desktopTouchState)
+ return;
+
if (this.Api.isViewMode || this.Api.isRestrictionForms() || !this.TableTrackEnabled)
return;
@@ -1647,8 +2028,8 @@
{
this.TableMovePoint = {X : _tableOutline.X, Y : _tableOutline.Y};
- var pos1 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _tableOutline.Y, _tableOutline.PageNum);
- var pos2 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X + _tableW, _tableOutline.Y, _tableOutline.PageNum);
+ var pos1 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _tableOutline.Y, _tableOutline.PageNum, undefined, false);
+ var pos2 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X + _tableW, _tableOutline.Y, _tableOutline.PageNum, undefined, false);
ctx.beginPath();
@@ -1680,8 +2061,8 @@
_y2 += _table_markup.Rows[i].H;
}
- var pos3 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _y1, DrawingDocument.m_lCurrentPage);
- var pos4 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _y2, DrawingDocument.m_lCurrentPage);
+ var pos3 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _y1, DrawingDocument.m_lCurrentPage, undefined, false);
+ var pos4 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _y2, DrawingDocument.m_lCurrentPage, undefined, false);
if (this.delegate.Name != "slide")
{
@@ -1760,7 +2141,7 @@
var _newPos = (i != _count) ? _table_markup.Rows[i].Y : _oldY;
var _p = {Y : _oldY, H : (_newPos - _oldY)};
- var _y = DrawingDocument.ConvertCoordsToCursorWR(0, _oldY, _PageNum);
+ var _y = DrawingDocument.ConvertCoordsToCursorWR(0, _oldY, _PageNum, undefined, false);
ctx.beginPath();
overlay.AddDiamond(Math.round(_x * rPR) + 1.5 + Math.round(Math.round(_rectWidth * rPR) / 2), Math.round(_y.Y * rPR), Math.round(AscCommon.MOBILE_TABLE_RULER_DIAMOND * rPR));
@@ -2232,13 +2613,16 @@
CMobileTouchManagerBase.prototype.checkPointerEvent = function(e)
{
var _type = e.type;
+ if (!_type)
+ return false;
+
if (_type.toLowerCase)
_type = _type.toLowerCase();
- if (-1 == _type.indexOf("pointer"))
+ if (-1 === _type.indexOf("pointer"))
return false;
- if (undefined == e["pointerId"])
+ if (undefined === e["pointerId"])
return false;
return true;
@@ -2300,13 +2684,45 @@
return _count;
};
- CMobileTouchManagerBase.prototype.showKeyboard = function()
+ CMobileTouchManagerBase.prototype.showKeyboard = function(isForce)
{
if (AscCommon.g_inputContext)
{
- if (this.ContextMenuLastMode == AscCommon.MobileTouchContextMenuType.Target)
- AscCommon.g_inputContext.HtmlArea.focus();
+ let isShow = (isForce === true) ? true : false;
+ if (!isShow)
+ {
+ if (this.ContextMenuLastMode === AscCommon.MobileTouchContextMenuType.Target)
+ {
+ if (this.Api.canEnterText())
+ isShow = true;
+ }
+ }
+ if (isShow)
+ {
+ AscCommon.g_inputContext.showKeyboard();
+
+ if (this.isCheckFocusOnClick)
+ this.isCheckFocusOnClickValue = true;
+ }
+ }
+ };
+
+ CMobileTouchManagerBase.prototype.addClickElement = function(elems)
+ {
+ for (let i = 0, len = elems.length; i < len; i++)
+ elems[i].onclick = this.onClickElement.bind(this);
+ };
+
+ CMobileTouchManagerBase.prototype.onClickElement = function(e)
+ {
+ if (this.isCheckFocusOnClickValue === true)
+ {
+ if (AscCommon.g_inputContext)
+ AscCommon.g_inputContext.showKeyboard();
+ this.isCheckFocusOnClickValue = false;
}
+
+ this.checkHandlersOnClick();
};
CMobileTouchManagerBase.prototype.scrollTo = function(x, y)
diff --git a/common/SerializeChart.js b/common/SerializeChart.js
index fddb12ea85..dd2fb59876 100644
--- a/common/SerializeChart.js
+++ b/common/SerializeChart.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -197,6 +197,78 @@ var st_groupingPERCENTSTACKED = 0;
var st_groupingSTANDARD = 1;
var st_groupingSTACKED = 2;
+// chart ex st
+
+var st_parentlabellayoutNONE = 0;
+var st_parentlabellayoutBANNER = 1;
+var st_parentlabellayoutOVERLAPPING = 2;
+
+var st_regionlabellayoutNONE = 0;
+var st_regionlabellayoutBESTFITONLY = 1;
+var st_regionlabellayoutSHOWALL = 2;
+
+var st_serieslayoutBOXWHISKER = 0;
+var st_serieslayoutCLUSTEREDCOLUMN = 1;
+var st_serieslayoutFUNNEL = 2;
+var st_serieslayoutPARETOLINE = 3;
+var st_serieslayoutREGIONMAP = 4;
+var st_serieslayoutSUNBURST = 5;
+var st_serieslayoutTREEMAP = 6;
+var st_serieslayoutWATERFALL = 7;
+
+var st_datalabelposBESTFIT = 0;
+var st_datalabelposB = 1;
+var st_datalabelposCTR = 2;
+var st_datalabelposINBASE = 3;
+var st_datalabelposINEND = 4;
+var st_datalabelposL = 5;
+var st_datalabelposOUTEND = 6;
+var st_datalabelposR = 7;
+var st_datalabelposT = 8;
+
+var st_intervalclosedsideL = 0;
+var st_intervalclosedsideR = 1;
+
+var st_axisunitHUNDREDS = 0;
+var st_axisunitTHOUSANDS = 1;
+var st_axisunitTENTHOUSANDS = 2;
+var st_axisunitHUNDREDTHOUSANDS = 3;
+var st_axisunitMILLIONS = 4;
+var st_axisunitTENMILLIONS = 5;
+var st_axisunitHUNDREDMILLIONS = 6;
+var st_axisunitBILLIONS = 7;
+var st_axisunitTRILLIONS = 8;
+var st_axisunitPERCENTAGE = 9;
+
+var st_posalignMIN = 0;
+var st_posalignCTR = 1;
+var st_posalignMAX = 2;
+
+var st_tickmarkstypeIN = 0;
+var st_tickmarkstypeOUT = 1;
+var st_tickmarkstypeCROSS = 2;
+var st_tickmarkstypeNONE = 3;
+
+var st_quartilemethodINCLUSIVE = 0;
+var st_quartilemethodEXCLUSIVE = 1;
+
+var st_stringdimensiontypeCAT = 10;
+var st_stringdimensiontypeCOLORSTR = 11;
+
+var st_numericdimensiontypeVAL = 0;
+var st_numericdimensiontypeX = 1;
+var st_numericdimensiontypeY = 2;
+var st_numericdimensiontypeSIZE = 3;
+var st_numericdimensiontypeCOLORVAL = 4;
+
+var st_formuladirectionCOL = 0;
+var st_formuladirectionROW = 1;
+
+var st_sideposL = 0;
+var st_sideposT = 1;
+var st_sideposR = 2;
+var st_sideposB = 3;
+
var c_oserct_extlstEXT = 0;
var c_oserct_chartspaceDATE1904 = 0;
@@ -218,7 +290,13 @@ var c_oserct_chartspaceTHEMEOVERRIDE = 15;
var c_oserct_chartspaceXLSX = 16;
var c_oserct_chartspaceSTYLES = 17;
var c_oserct_chartspaceCOLORS = 18;
+var c_oserct_chartspaceXLSXEXTERNAL = 19;
+var c_oserct_chartspaceXLSXZIP = 20;
+const sideLeft = 0;
+const sideRight = 1;
+const sideTop = 2;
+const sideBottom = 3;
var c_oserct_usershapes_COUNT = 0;
var c_oserct_usershapes_SHAPE_REL = 1;
@@ -285,6 +363,7 @@ var c_oserct_legendOVERLAY = 3;
var c_oserct_legendSPPR = 4;
var c_oserct_legendTXPR = 5;
var c_oserct_legendEXTLST = 6;
+var c_oserct_legendALIGN = 7;
var c_oserct_layoutMANUALLAYOUT = 0;
var c_oserct_layoutEXTLST = 1;
@@ -354,6 +433,7 @@ var c_oserct_titleOVERLAY = 2;
var c_oserct_titleSPPR = 3;
var c_oserct_titleTXPR = 4;
var c_oserct_titleEXTLST = 5;
+var c_oserct_titleALIGN = 6;
var c_oserct_txRICH = 0;
var c_oserct_txSTRREF = 1;
@@ -927,6 +1007,7 @@ var c_oserct_plotareaVALAX = 22;
var c_oserct_plotareaDTABLE = 23;
var c_oserct_plotareaSPPR = 24;
var c_oserct_plotareaEXTLST = 25;
+var c_oserct_plotareaPLOTAREAREGION = 26;
var c_oserct_thicknessVAL = 0;
@@ -1032,6 +1113,7 @@ var c_oserct_chartExSpaceCLRMAPOVR = 4;
var c_oserct_chartExSpaceXLSX = c_oserct_chartspaceXLSX;/* = 16*/
var c_oserct_chartExSpaceSTYLES = c_oserct_chartspaceSTYLES;/* = 17*/
var c_oserct_chartExSpaceCOLORS = c_oserct_chartspaceCOLORS;/* = 18*/
+// var c_oserct_chartExSpaceXLSXEXTERNAL = c_oserct_chartspaceXLSXEXTERNAL;/* = 19*/
var c_oserct_chartExDATA = 0;
var c_oserct_chartExEXTERNALDATA = 1;
@@ -1394,6 +1476,44 @@ BinaryChartWriter.prototype.WriteCT_ChartSpace = function (oVal) {
});
}
};
+BinaryChartWriter.prototype.WriteCT_ChartExSpace = function (oVal) {
+ var oThis = this;
+ if(oVal.chartData !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceCHARTDATA, function() {
+ oThis.WriteCT_ChartData(oVal.chartData);
+ });
+ }
+ if (oVal.chart !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceCHART, function () {
+ oThis.WriteCT_ChartEx(oVal.chart);
+ });
+ }
+ if (oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceSPPR, function () {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if (oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceTXPR, function () {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+ if (oVal.clrMapOvr !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceCLRMAPOVR, function () {
+ oThis.WriteClrMapOverride(oVal.clrMapOvr);
+ });
+ }
+ if(oVal.chartStyle !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceSTYLES, function() {
+ oThis.WriteCT_ChartStyle(oVal.chartStyle);
+ });
+ }
+ if(oVal.chartColors !== null) {
+ this.bs.WriteItem(c_oserct_chartExSpaceCOLORS, function() {
+ oThis.WriteCT_ChartColors(oVal.chartColors);
+ });
+ }
+};
BinaryChartWriter.prototype.WriteCT_FromTo = function(oVal){
this.memory.WriteByte(Asc.c_oSer_DrawingPosType.X);
this.memory.WriteByte(AscCommon.c_oSerPropLenType.Double);
@@ -1908,6 +2028,11 @@ BinaryChartWriter.prototype.WriteCT_Legend = function (oVal) {
oThis.WriteTxPr(oVal.txPr);
});
}
+ if (null != oVal.align) {
+ this.bs.WriteItem(c_oserct_legendALIGN, function () {
+ oThis.memory.WriteByte(oVal.align);
+ });
+ }
// var oCurVal = oVal.m_extLst;
// if (null != oCurVal) {
// this.bs.WriteItem(c_oserct_legendEXTLST, function () {
@@ -2261,6 +2386,11 @@ BinaryChartWriter.prototype.WriteCT_Title = function (oVal) {
oThis.WriteTxPr(oVal.txPr);
});
}
+ if (null != oVal.align) {
+ this.bs.WriteItem(c_oserct_titleALIGN, function () {
+ oThis.memory.WriteByte(oVal.align);
+ });
+ }
// var oCurVal = oVal.m_extLst;
// if (null != oCurVal) {
// this.bs.WriteItem(c_oserct_titleEXTLST, function () {
@@ -5461,6 +5591,11 @@ BinaryChartWriter.prototype.WriteCT_PlotArea = function (oVal, oChart) {
oThis.WriteSpPr(oVal.spPr);
});
}
+ if (null != oVal.plotAreaRegion) {
+ this.bs.WriteItem(c_oserct_plotareaPLOTAREAREGION, function () {
+ oThis.WriteCT_PlotAreaRegion(oVal.plotAreaRegion);
+ });
+ }
// var oCurVal = oVal.m_extLst;
// if (null != oCurVal) {
// this.bs.WriteItem(c_oserct_plotareaEXTLST, function () {
@@ -5771,980 +5906,3407 @@ BinaryChartWriter.prototype.WriteCT_TextLanguageID = function (oVal) {
});
}
};
-BinaryChartWriter.prototype.WriteAlternateContent = function (oVal) {
+BinaryChartWriter.prototype.WriteCT_Axis = function (oVal) {
var oThis = this;
- if (null != oVal.m_Choice) {
- for (var i = 0, length = oVal.m_Choice.length; i < length; ++i) {
- var oCurVal = oVal.m_Choice[i];
- if (null != oCurVal) {
- this.bs.WriteItem(c_oseralternatecontentCHOICE, function () {
- oThis.WriteAlternateContentChoice(oCurVal);
- });
- }
+ if(oVal.axId !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisID, function() {
+ oThis.memory.WriteLong(oVal.axId);
+ });
+ }
+ if(oVal.hidden !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisHIDDEN, function() {
+ oThis.memory.WriteBool(oVal.hidden);
+ });
+ }
+ if(oVal.scaling !== null) {
+ if (oVal.scaling instanceof AscFormat.CCategoryAxisScaling) {
+ this.bs.WriteItem(c_oserct_chartExAxisCATSCALING, function() {
+ oThis.WriteCT_CategoryAxisScaling(oVal.scaling);
+ });
+ } else if (oVal.scaling instanceof AscFormat.CValueAxisScaling) {
+ this.bs.WriteItem(c_oserct_chartExAxisVALSCALING, function() {
+ oThis.WriteCT_ValueAxisScaling(oVal.scaling);
+ });
}
}
- var oCurVal = oVal.m_Fallback;
- if (null != oCurVal) {
- this.bs.WriteItem(c_oseralternatecontentFALLBACK, function () {
- oThis.WriteAlternateContentFallback(oCurVal);
+ if(oVal.title !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisTITLE, function() {
+ oThis.WriteCT_ChartExTitle(oVal.title);
});
}
-};
-BinaryChartWriter.prototype.WriteAlternateContentChoice = function (oVal) {
- var oThis = this;
- var oCurVal = oVal.m_style;
- if (null != oCurVal) {
- this.bs.WriteItem(c_oseralternatecontentchoiceSTYLE, function () {
- oThis.WriteCT_Style(oCurVal);
+ if(oVal.units !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisUNIT, function() {
+ oThis.WriteCT_AxisUnits(oVal.units);
});
}
- var oCurVal = oVal.m_Requires;
- if (null != oCurVal) {
- this.bs.WriteItem(c_oseralternatecontentchoiceREQUIRES, function () {
- oThis.memory.WriteString3(oCurVal);
+ if(oVal.numFmt !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisNUMFMT, function() {
+ oThis.WriteCT_ChartExNumFmt(oVal.numFmt);
+ });
+ }
+ if(oVal.majorTickMark !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisMAJORTICK, function() {
+ oThis.WriteCT_TickMarks(oVal.majorTickMark);
+ });
+ }
+ if(oVal.minorTickMark !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisMINORTICK, function() {
+ oThis.WriteCT_TickMarks(oVal.minorTickMark);
+ });
+ }
+ if(oVal.majorGridlines !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisMAJORGRID, function() {
+ oThis.WriteCT_Gridlines(oVal.majorGridlines);
+ });
+ }
+ if(oVal.minorGridlines !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisMINORGRID, function() {
+ oThis.WriteCT_Gridlines(oVal.minorGridlines);
+ });
+ }
+ if(oVal.tickLabels !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisTICKLABELS, function() {
+ oThis.memory.WriteBool(oVal.tickLabels);
+ });
+ }
+ if(oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisTXPR, function() {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
});
}
};
-BinaryChartWriter.prototype.WriteAlternateContentFallback = function (oVal) {
+BinaryChartWriter.prototype.WriteCT_ChartData = function (oVal) {
var oThis = this;
- var oCurVal = oVal.m_style;
- if (null != oCurVal) {
- this.bs.WriteItem(c_oseralternatecontentfallbackSTYLE, function () {
- oThis.WriteCT_Style1(oCurVal);
+ if (oVal.data !== null) {
+ for (var i = 0, length = oVal.data.length; i < length; ++i) {
+ var oCurVal = oVal.data[i];
+ if (oCurVal !== null) {
+ this.bs.WriteItem(c_oserct_chartExDATA, function () {
+ oThis.WriteCT_Data(oCurVal);
+ });
+ }
+ }
+ }
+ if(oVal.externalData !== null) {
+ this.bs.WriteItem(c_oserct_chartExEXTERNALDATA, function() {
+ oThis.WriteCT_ChartExExternalData(oVal.externalData);
});
}
};
-function BinaryChartReader(stream) {
- this.stream = stream;
- this.bcr = new AscCommon.Binary_CommonReader(this.stream);
- this.drawingDocument = null;
-}
-BinaryChartReader.prototype.ReadCT_extLst = function (type, length, val) {
+BinaryChartWriter.prototype.WriteCT_ChartExExternalData = function (oVal) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_extlstEXT === type) {
- var oNewVal;
- oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Extension(t, l, oNewVal);
+ var oCurVal = oVal.m_autoUpdate;
+ if (oCurVal !== null) {
+ this.bs.WriteItem(c_oserct_chartExExternalAUTOUPDATE, function () {
+ oThis.WriteCT_Boolean(oCurVal);
});
- if (null == val.m_ext)
- val.m_ext = [];
- val.m_ext.push(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
};
-BinaryChartReader.prototype.ExternalReadCT_ChartSpace = function (length, val, curWorksheet) {
- var res = c_oSerConstants.ReadOk;
- this.curWorksheet = curWorksheet;
- this.drawingDocument = null;
- if(this.curWorksheet) {
- if(this.curWorksheet.getDrawingDocument) {
- this.drawingDocument = this.curWorksheet.getDrawingDocument();
- }
- if (!this.drawingDocument && this.curWorksheet.DrawingDocument) {
- this.drawingDocument = this.curWorksheet.DrawingDocument;
- }
+BinaryChartWriter.prototype.WriteCT_ChartEx = function (oVal) {
+ var oThis = this;
+ if(oVal.plotArea !== null) {
+ this.bs.WriteItem(c_oserct_chartExChartPLOTAREA, function() {
+ oThis.WriteCT_ChartExPlotArea(oVal.plotArea);
+ });
}
-
+ if(oVal.title !== null) {
+ this.bs.WriteItem(c_oserct_chartExChartTITLE, function() {
+ oThis.WriteCT_ChartExTitle(oVal.title);
+ });
+ }
+ if(oVal.legend !== null) {
+ this.bs.WriteItem(c_oserct_chartExChartLEGEND, function() {
+ oThis.WriteCT_ChartExLegend(oVal.legend);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_ChartExPlotArea = function (oVal) {
var oThis = this;
- this.curChart = val;
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartSpace(t, l, val);
- });
- if(val){
- val.correctAxes();
- }
- /*if(this.curWorksheet) {
- var aStyles = null;
- var sName = this.curWorksheet.sName;
- if(sName === "Bar") {
-
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal"];
- }
- else if(sName === "BarStacked") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked"] = [];
+ if(oVal.plotAreaRegion !== null) {
+ this.bs.WriteItem(c_oserct_chartExChartAREAREGION, function() {
+ oThis.WriteCT_PlotAreaRegion(oVal.plotAreaRegion);
+ });
+ }
+ if (oVal.axId !== null) {
+ for (var i = 0, length = oVal.axId.length; i < length; ++i) {
+ var oCurVal = oVal.axId[i];
+ if (oCurVal !== null) {
+ this.bs.WriteItem(c_oserct_chartExChartAXIS, function () {
+ oThis.WriteCT_Axis(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked"];
}
- else if(sName === "BarStackedPer") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer"] = [];
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExChartSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_PlotAreaRegion = function (oVal) {
+ var oThis = this;
+ if(oVal.plotSurface !== null) {
+ this.bs.WriteItem(c_oserct_chartExAreaPLOTSURFACE, function() {
+ oThis.WriteCT_PlotSurface(oVal.plotSurface);
+ });
+ }
+ if (oVal.series !== null) {
+ for (var i = 0, length = oVal.series.length; i < length; ++i) {
+ var oCurVal = oVal.series[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExAreaSERIES, function () {
+ oThis.WriteCT_Series(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer"];
}
- else if(sName === "3DClusteredColumn") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3d"] = [];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_PlotSurface = function (oVal) {
+ var oThis = this;
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExPlotSurfaceSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_SeriesLayout = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.SERIES_LAYOUT_BOX_WHISKER: nVal = st_serieslayoutBOXWHISKER; break;
+ case AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN: nVal = st_serieslayoutCLUSTEREDCOLUMN; break;
+ case AscFormat.SERIES_LAYOUT_FUNNEL: nVal = st_serieslayoutFUNNEL; break;
+ case AscFormat.SERIES_LAYOUT_PARETO_LINE: nVal = st_serieslayoutPARETOLINE; break;
+ case AscFormat.SERIES_LAYOUT_REGION_MAP: nVal = st_serieslayoutREGIONMAP; break;
+ case AscFormat.SERIES_LAYOUT_SUNBURST: nVal = st_serieslayoutSUNBURST; break;
+ case AscFormat.SERIES_LAYOUT_TREEMAP: nVal = st_serieslayoutTREEMAP; break;
+ case AscFormat.SERIES_LAYOUT_WATERFALL:
+ default: nVal = st_serieslayoutWATERFALL; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_Series = function (oVal) {
+ var oThis = this;
+ if (oVal.dPt !== null) {
+ for (var i = 0, length = oVal.dPt.length; i < length; ++i) {
+ var oCurVal = oVal.dPt[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExSeriesDATAPT, function () {
+ oThis.WriteCT_DataPoint(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3d"];
}
- else if(sName === "3DStackedColumn") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked3d"] = [];
+ }
+ if(oVal.dataLabels !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesDATALABELS, function() {
+ oThis.WriteCT_DataLabels(oVal.dataLabels);
+ });
+ }
+ if(oVal.layoutPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLAYOUTPROPS, function() {
+ oThis.WriteCT_SeriesLayoutProperties(oVal.layoutPr);
+ });
+ }
+ if(oVal.tx !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesTEXT, function() {
+ oThis.WriteCT_Text(oVal.tx);
+ });
+ }
+ if (oVal.axisId !== null) {
+ for (var i = 0, length = oVal.axisId.length; i < length; ++i) {
+ var oCurVal = oVal.axisId[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExSeriesAXIS, function() {
+ oThis.memory.WriteLong(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked3d"];
}
- else if(sName === "3DStackedColumnPer") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer3d"] = [];
+ }
+ if(oVal.dataId !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesDATAID, function() {
+ oThis.memory.WriteLong(oVal.dataId);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if(oVal.layoutId !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLAYOUTID, function() {
+ oThis.WriteCT_SeriesLayout(oVal.layoutId);
+ });
+ }
+ if(oVal.hidden !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesHIDDEN, function() {
+ oThis.memory.WriteBool(oVal.hidden);
+ });
+ }
+ if(oVal.ownerIdx !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesOWNERIDX, function() {
+ oThis.memory.WriteLong(oVal.ownerIdx);
+ });
+ }
+ if(oVal.formatIdx !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesFORMATIDX, function() {
+ oThis.memory.WriteLong(oVal.formatIdx);
+ });
+ }
+ if(oVal.uniqueId !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesUNIQUEID, function() {
+ oThis.memory.WriteString3(oVal.uniqueId);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_DataPoint = function (oVal) {
+ var oThis = this;
+ if(oVal.idx !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataPointIDX, function() {
+ oThis.memory.WriteLong(oVal.idx);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataPointSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_DataLabels = function (oVal) {
+ var oThis = this;
+ if(oVal.pos !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsPOS, function() {
+ oThis.WriteCT_DataLabelPos(oVal.pos);
+ });
+ }
+ if(oVal.numFmt !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsNUMFMT, function() {
+ oThis.WriteCT_ChartExNumFmt(oVal.numFmt);
+ });
+ }
+ if(oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsTXPR, function() {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if(oVal.visibility !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsVISABILITIES, function() {
+ oThis.WriteCT_DataLabelVisibilities(oVal.visibility);
+ });
+ }
+ if(oVal.separator !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsSEPARATOR, function() {
+ oThis.memory.WriteString3(oVal.separator);
+ });
+ }
+ if (oVal.dataLabel !== null) {
+ for (var i = 0, length = oVal.dataLabel.length; i < length; ++i) {
+ var oCurVal = oVal.dataLabel[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsDATALABEL, function () {
+ oThis.WriteCT_DataLabel(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer3d"];
}
- else if(sName === "3DColumn") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3dPerspective"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3dPerspective"] = [];
+ }
+ if (oVal.dataLabelHidden !== null) {
+ for (var i = 0, length = oVal.dataLabelHidden.length; i < length; ++i) {
+ var oCurVal = oVal.dataLabelHidden[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelsDATALABELHIDDEN, function () {
+ oThis.WriteCT_DataLabelHidden(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3dPerspective"];
}
- else if(sName === "2DBar") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal"];
- }
- else if(sName === "StackedBar") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked"];
- }
- else if(sName === "StackedBarPer") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStackedPer"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStackedPer"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStackedPer"];
- }
- else if(sName === "3DClusteredBar") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal3d"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal3d"];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_ChartExNumFmt = function (oVal) {
+ var oThis = this;
+ if (oVal.formatCode !== null) {
+ this.bs.WriteItem(c_oserct_chartExNumberFormatFORMATCODE, function () {
+ oThis.memory.WriteString3(oVal.formatCode);
+ });
+ }
+ if (oVal.sourceLinked !== null) {
+ this.bs.WriteItem(c_oserct_chartExNumberFormatSOURCELINKED, function () {
+ oThis.memory.WriteBool(oVal.sourceLinked);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_DataLabelPos = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.DATA_LABEL_POS_BEST_FIT: nVal = st_datalabelposBESTFIT; break;
+ case AscFormat.DATA_LABEL_POS_B: nVal = st_datalabelposB; break;
+ case AscFormat.DATA_LABEL_POS_CTR: nVal = st_datalabelposCTR; break;
+ case AscFormat.DATA_LABEL_POS_IN_BASE: nVal = st_datalabelposINBASE; break;
+ case AscFormat.DATA_LABEL_POS_IN_END: nVal = st_datalabelposINEND; break;
+ case AscFormat.DATA_LABEL_POS_L: nVal = st_datalabelposL; break;
+ case AscFormat.DATA_LABEL_POS_OUT_END: nVal = st_datalabelposOUTEND; break;
+ case AscFormat.DATA_LABEL_POS_R: nVal = st_datalabelposR; break;
+ case AscFormat.DATA_LABEL_POS_T:
+ default: nVal = st_datalabelposT; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_DataLabel = function (oVal) {
+ var oThis = this;
+ if(oVal.idx !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelIDX, function() {
+ oThis.memory.WriteLong(oVal.idx);
+ });
+ }
+ if(oVal.pos !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelPOS, function() {
+ oThis.WriteCT_DataLabelPos(oVal.pos);
+ });
+ }
+ if(oVal.numFmt !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelNUMFMT, function() {
+ oThis.WriteCT_ChartExNumFmt(oVal.numFmt);
+ });
+ }
+ if(oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelTXPR, function() {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if(oVal.visibility !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelVISABILITIES, function() {
+ oThis.WriteCT_DataLabelVisibilities(oVal.visibility);
+ });
+ }
+ if(oVal.separator !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelSEPARATOR, function() {
+ oThis.memory.WriteString3(oVal.separator);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_DataLabelHidden = function (oVal) {
+ var oThis = this;
+ if(oVal.idx !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelHiddenIDX, function() {
+ oThis.memory.WriteLong(oVal.idx);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_ParentLabelLayout = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.PARENT_LABEL_LAYOUT_NONE: nVal = st_parentlabellayoutNONE; break;
+ case AscFormat.PARENT_LABEL_LAYOUT_BANNER: nVal = st_parentlabellayoutBANNER; break;
+ case AscFormat.PARENT_LABEL_LAYOUT_OVERLAPPING:
+ default: nVal = st_parentlabellayoutOVERLAPPING; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_RegionLabelLayout = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.REGION_LABEL_LAYOUT_NONE: nVal = st_regionlabellayoutNONE; break;
+ case AscFormat.REGION_LABEL_LAYOUT_BEST_FIT_ONLY: nVal = st_regionlabellayoutBESTFITONLY; break;
+ case AscFormat.REGION_LABEL_LAYOUT_SHOW_ALL:
+ default: nVal = st_regionlabellayoutSHOWALL; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_SeriesLayoutProperties = function (oVal) {
+ var oThis = this;
+ if(oVal.parentLabelLayout !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutPARENT, function() {
+ oThis.WriteCT_ParentLabelLayout(oVal.parentLabelLayout);
+ });
+ }
+ if(oVal.regionLabelLayout !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutREGION, function() {
+ oThis.WriteCT_RegionLabelLayout(oVal.regionLabelLayout);
+ });
+ }
+ if(oVal.visibility !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutVISABILITIES, function() {
+ oThis.WriteCT_SeriesElementVisibilities(oVal.visibility);
+ });
+ }
+ if(oVal.aggregation !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutAGGREGATION, function() {
+ oThis.memory.WriteBool(oVal.aggregation);
+ });
+ }
+ if(oVal.binning !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutBINNING, function() {
+ oThis.WriteCT_Binning(oVal.binning);
+ });
+ }
+ if(oVal.statistics !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutSTATISTIC, function() {
+ oThis.WriteCT_Statistics(oVal.statistics);
+ });
+ }
+ if(oVal.subtotals !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesLayoutSUBTOTALS, function() {
+ oThis.WriteCT_Subtotals(oVal.subtotals);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_DataLabelVisibilities = function (oVal) {
+ var oThis = this;
+ if(oVal.seriesName !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelVisibilitiesSERIES, function() {
+ oThis.memory.WriteBool(oVal.seriesName);
+ });
+ }
+ if(oVal.categoryName !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelVisibilitiesCATEGORY, function() {
+ oThis.memory.WriteBool(oVal.categoryName);
+ });
+ }
+ if(oVal.value !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLabelVisibilitiesVALUE, function() {
+ oThis.memory.WriteBool(oVal.value);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_IntervalClosedSide = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.INTERVAL_CLOSED_SIDE_L: nVal = st_intervalclosedsideL; break;
+ case AscFormat.INTERVAL_CLOSED_SIDE_R:
+ default: nVal = st_intervalclosedsideR; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_Binning = function (oVal) {
+ var oThis = this;
+ if(oVal.binSize !== null) {
+ this.bs.WriteItem(c_oserct_chartExBinningBINSIZE, function() {
+ oThis.memory.WriteDouble2(oVal.binSize);
+ });
+ }
+ if(oVal.binCount !== null) {
+ this.bs.WriteItem(c_oserct_chartExBinningBINCOUNT, function() {
+ oThis.memory.WriteLong(oVal.binCount);
+ });
+ }
+ if(oVal.intervalClosed !== null) {
+ this.bs.WriteItem(c_oserct_chartExBinningINTERVAL, function() {
+ oThis.WriteCT_IntervalClosedSide(oVal.intervalClosed);
+ });
+ }
+ if(oVal.underflow !== null) {
+ if (typeof oVal.underflow === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExBinningUNDERAUTO, function() {
+ oThis.memory.WriteByte(0);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExBinningUNDERVAL, function() {
+ oThis.memory.WriteDouble2(oVal.underflow);
+ });
}
- else if(sName === "3DStackedBar") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked3d"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked3d"];
+ }
+ if(oVal.overflow !== null) {
+ if (typeof oVal.underflow === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExBinningOVERAUTO, function() {
+ oThis.memory.WriteByte(oVal.overflow);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExBinningOVERVAL, function() {
+ oThis.memory.WriteDouble2(oVal.overflow);
+ });
}
- else if(sName === "Line") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormal"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormalMarker"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStackedMarker"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStackedPerMarker"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormal"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStacked"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStackedPer"] = [];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_PosAlign = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.POS_ALIGN_MIN: nVal = st_posalignMIN; break;
+ case AscFormat.POS_ALIGN_CTR: nVal = st_posalignCTR; break;
+ case AscFormat.POS_ALIGN_MAX:
+ default: nVal = st_posalignMAX; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_SidePos = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.SIDE_POS_L: nVal = st_sideposL; break;
+ case AscFormat.SIDE_POS_T: nVal = st_sideposT; break;
+ case AscFormat.SIDE_POS_R: nVal = st_sideposR; break;
+ case AscFormat.SIDE_POS_B:
+ default: nVal = st_sideposB; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_ChartExTitle = function (oVal) {
+ var oThis = this;
+ if(oVal.tx !== null) {
+ this.bs.WriteItem(c_oserct_chartExTitleTX, function() {
+ oThis.WriteCT_Text(oVal.tx);
+ });
+ }
+ if(oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExTitleTXPR, function() {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExTitleSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if(oVal.pos !== null) {
+ this.bs.WriteItem(c_oserct_chartExTitlePOS, function() {
+ oThis.WriteCT_SidePos(oVal.pos);
+ });
+ }
+ if(oVal.align !== null) {
+ this.bs.WriteItem(c_oserct_chartExTitleALIGN, function() {
+ oThis.WriteCT_PosAlign(oVal.align);
+ });
+ }
+ // if(oVal.overlay !== null) {
+ // this.bs.WriteItem(c_oserct_chartExTitleOVERLAY, function() {
+ // oThis.memory.WriteBool(oVal.overlay);
+ // });
+ // }
+};
+BinaryChartWriter.prototype.WriteCT_ChartExLegend = function (oVal) {
+ var oThis = this;
+ if(oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExLegendTXPR, function() {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExLegendSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if(oVal.legendPos !== null) {
+ this.bs.WriteItem(c_oserct_chartExLegendPOS, function() {
+ let nVal = st_legendposT;
+ switch (oVal.legendPos) {
+ case c_oAscChartLegendShowSettings.bottom: nVal = sideBottom; break;
+ case c_oAscChartLegendShowSettings.topRight: nVal = sideRight; break;
+ case c_oAscChartLegendShowSettings.left:
+ case c_oAscChartLegendShowSettings.leftOverlay:
+ nVal = sideLeft; break;
+ case c_oAscChartLegendShowSettings.right:
+ case c_oAscChartLegendShowSettings.rightOverlay:
+ nVal = sideRight; break;
+ case c_oAscChartLegendShowSettings.top: nVal = sideTop; break;
+ }
+
+ oThis.memory.WriteByte(nVal);
+ });
+ }
+ if(oVal.align !== null) {
+ this.bs.WriteItem(c_oserct_chartExLegendALIGN, function() {
+ oThis.WriteCT_PosAlign(oVal.align);
+ });
+ }
+ if(oVal.overlay !== null) {
+ this.bs.WriteItem(c_oserct_chartExLegendOVERLAY, function() {
+ oThis.memory.WriteBool(oVal.overlay);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_Text = function (oVal) {
+ var oThis = this;
+ if(oVal.rich !== null) {
+ this.bs.WriteItem(c_oserct_chartExTextRICH, function() {
+ oThis.WriteTxPr(oVal.rich);
+ });
+ }
+ if(oVal.txData !== null) {
+ this.bs.WriteItem(c_oserct_chartExTextDATA, function() {
+ oThis.WriteCT_TextData(oVal.txData);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_TextData = function (oVal) {
+ var oThis = this;
+ if(oVal.f !== null) {
+ this.bs.WriteItem(c_oserct_chartExTextDataFORMULA, function() {
+ oThis.WriteCT_Formula(oVal.f);
+ });
+ }
+ if(oVal.v !== null) {
+ this.bs.WriteItem(c_oserct_chartExTextDataVALUE, function() {
+ oThis.memory.WriteString3(oVal.v);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_Data = function (oVal) {
+ var oThis = this;
+ if(oVal.id !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataID, function() {
+ oThis.memory.WriteLong(oVal.id);
+ });
+ }
+ if(oVal.dimension !== null) {
+ for (var i = 0, length = oVal.dimension.length; i < length; ++i) {
+ var oDimension = oVal.dimension[i];
+ if (oDimension instanceof AscFormat.CNumericDimension) {
+ this.bs.WriteItem(c_oserct_chartExDataNUMDIMENSION, function() {
+ oThis.WriteCT_NumericDimension(oDimension);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExDataSTRDIMENSION, function() {
+ oThis.WriteCT_StringDimension(oDimension);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormal"];
}
- else if(sName === "Line3D") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.line3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.line3d"] = [];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_Subtotals = function (oVal) {
+ var oThis = this;
+ if(oVal.idx !== null) {
+ for (var i = 0, length = oVal.idx.length; i < length; ++i) {
+ var oCurVal = oVal.idx[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExSubtotalsIDX, function () {
+ oThis.memory.WriteLong(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.line3d"];
}
- else if(sName === "Pie") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie"];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_SeriesElementVisibilities = function (oVal) {
+ var oThis = this;
+ if(oVal.connectorLines !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesVisibilitiesCONNECTOR, function() {
+ oThis.memory.WriteBool(oVal.connectorLines);
+ });
+ }
+ if(oVal.meanLine !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesVisibilitiesMEANLINE, function() {
+ oThis.memory.WriteBool(oVal.meanLine);
+ });
+ }
+ if(oVal.meanMarker !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesVisibilitiesMEANMARKER, function() {
+ oThis.memory.WriteBool(oVal.meanMarker);
+ });
+ }
+ if(oVal.nonoutliers !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesVisibilitiesNONOUTLIERS, function() {
+ oThis.memory.WriteBool(oVal.nonoutliers);
+ });
+ }
+ if(oVal.outliers !== null) {
+ this.bs.WriteItem(c_oserct_chartExSeriesVisibilitiesOUTLIERS, function() {
+ oThis.memory.WriteBool(oVal.outliers);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_CategoryAxisScaling = function (oVal) {
+ var oThis = this;
+ if(oVal.gapWidth !== null) {
+ if (typeof oVal.gapWidth === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExCatScalingGAPAUTO, function() {
+ oThis.memory.WriteByte(0);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExCatScalingGAPVAL, function() {
+ oThis.memory.WriteDouble2(oVal.gapWidth);
+ });
}
- else if(sName === "Pie3D") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie3d"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie3d"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie3d"];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_ValueAxisScaling = function (oVal) {
+ var oThis = this;
+ if(oVal.max !== null) {
+ if (typeof oVal.max === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExValScalingMAXAUTO, function() {
+ oThis.memory.WriteByte(oVal.max);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExValScalingMAXVAL, function() {
+ oThis.memory.WriteDouble2(oVal.max);
+ });
}
- else if(sName === "Doughnut") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.doughnut"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.doughnut"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.doughnut"];
+ }
+ if(oVal.min !== null) {
+ if (typeof oVal.min === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExValScalingMINAUTO, function() {
+ oThis.memory.WriteByte(oVal.min);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExValScalingMINVAL, function() {
+ oThis.memory.WriteDouble2(oVal.min);
+ });
}
- else if(sName === "Area") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaNormal"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaNormal"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaStacked"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaStackedPer"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaNormal"];
+ }
+ if(oVal.majorUnit !== null) {
+ if (typeof oVal.majorUnit === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExValScalingMAJUNITAUTO, function() {
+ oThis.memory.WriteByte(oVal.majorUnit);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExValScalingMAJUNITVAL, function() {
+ oThis.memory.WriteDouble2(oVal.majorUnit);
+ });
}
- else if(sName === "Stock") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.stock"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.stock"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.stock"];
+ }
+ if(oVal.minorUnit !== null) {
+ if (typeof oVal.minorUnit === "undefined") {
+ this.bs.WriteItem(c_oserct_chartExValScalingMINUNITAUTO, function() {
+ oThis.memory.WriteByte(oVal.minorUnit);
+ });
+ } else {
+ this.bs.WriteItem(c_oserct_chartExValScalingMINUNITVAL, function() {
+ oThis.memory.WriteDouble2(oVal.minorUnit);
+ });
}
- if(sName === "ScatterLine") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatter"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatter"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterLine"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterLineMarker"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterMarker"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterNone"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterSmooth"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterSmoothMarker"] = [];
- }
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatter"];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_ChartExAxisUnit = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.AXIS_UNIT_HUNDREDS: nVal = st_axisunitHUNDREDS; break;
+ case AscFormat.AXIS_UNIT_THOUSANDS: nVal = st_axisunitTHOUSANDS; break;
+ case AscFormat.AXIS_UNIT_TEN_THOUSANDS: nVal = st_axisunitTENTHOUSANDS; break;
+ case AscFormat.AXIS_UNIT_HUNDRED_THOUSANDS: nVal = st_axisunitHUNDREDTHOUSANDS; break;
+ case AscFormat.AXIS_UNIT_MILLIONS: nVal = st_axisunitMILLIONS; break;
+ case AscFormat.AXIS_UNIT_TEN_MILLIONS: nVal = st_axisunitTENMILLIONS; break;
+ case AscFormat.AXIS_UNIT_HUNDRED_MILLIONS: nVal = st_axisunitHUNDREDMILLIONS; break;
+ case AscFormat.AXIS_UNIT_BILLIONS: nVal = st_axisunitBILLIONS; break;
+ case AscFormat.AXIS_UNIT_TRILLIONS: nVal = st_axisunitTRILLIONS; break;
+ case AscFormat.AXIS_UNIT_PERCENTAGE:
+ default: nVal = st_axisunitPERCENTAGE; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_AxisUnits = function (oVal) {
+ var oThis = this;
+ if(oVal.unitsLabel !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisUnitLABEL, function() {
+ oThis.WriteCT_AxisUnitsLabel(oVal.unitsLabel);
+ });
+ }
+ if(oVal.unit !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisUnitTYPE, function() {
+ oThis.WriteCT_ChartExAxisUnit(oVal.unit);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_AxisUnitsLabel = function (oVal) {
+ var oThis = this;
+ if(oVal.tx !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisUnitsLabelTEXT, function() {
+ oThis.WriteCT_Text(oVal.tx);
+ });
+ }
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisUnitsLabelSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+ if(oVal.txPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExAxisUnitsLabelTXPR, function() {
+ oThis.WriteTxPr(oVal.txPr);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_TickMarksType = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.TICK_MARKS_TYPE_IN: nVal = st_tickmarkstypeIN; break;
+ case AscFormat.TICK_MARKS_TYPE_OUT: nVal = st_tickmarkstypeOUT; break;
+ case AscFormat.TICK_MARKS_TYPE_CROSS: nVal = st_tickmarkstypeCROSS; break;
+ case AscFormat.TICK_MARKS_TYPE_NONE:
+ default: nVal = st_tickmarkstypeNONE; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_TickMarks = function (oVal) {
+ var oThis = this;
+ if(oVal.type !== null) {
+ this.bs.WriteItem(c_oserct_chartExTickMarksTYPE, function() {
+ oThis.WriteCT_TickMarksType(oVal.type);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_Gridlines = function (oVal) {
+ var oThis = this;
+ if(oVal.spPr !== null) {
+ this.bs.WriteItem(c_oserct_chartExGridlinesSPPR, function() {
+ oThis.WriteSpPr(oVal.spPr);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_QuartileMethod = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.QUARTILE_METHOD_INCLUSIVE: nVal = st_quartilemethodINCLUSIVE; break;
+ case AscFormat.QUARTILE_METHOD_EXCLUSIVE:
+ default: nVal = st_quartilemethodEXCLUSIVE; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_Statistics = function (oVal) {
+ var oThis = this;
+ if(oVal.quartileMethod !== null) {
+ this.bs.WriteItem(c_oserct_chartExStatisticsMETHOD, function() {
+ oThis.WriteCT_QuartileMethod(oVal.quartileMethod);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_StringDimensionType = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.STRING_DIMENSION_TYPE_CAT: nVal = st_stringdimensiontypeCAT; break;
+ case AscFormat.STRING_DIMENSION_TYPE_COLOR_STR:
+ default: nVal = st_stringdimensiontypeCOLORSTR; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_StringDimension = function (oVal) {
+ var oThis = this;
+ if(oVal.type !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionTYPE, function() {
+ oThis.WriteCT_StringDimensionType(oVal.type);
+ });
+ }
+ if(oVal.f !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionFORMULA, function() {
+ oThis.WriteCT_Formula(oVal.f);
+ });
+ }
+ if(oVal.nf !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionNF, function() {
+ oThis.memory.WriteString3(oVal.nf);
+ });
+ }
+ if(oVal.levelData !== null) {
+ for (var i = 0, length = oVal.levelData.length; i < length; ++i) {
+ var oCurVal = oVal.levelData[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionSTRINGLEVEL, function () {
+ oThis.WriteCT_StringLevel(oCurVal);
+ });
+ }
}
- else if(sName === "Combo") {
- if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboCustom"])) {
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboCustom"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboBarLine"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboBarLineSecondary"] =
- AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboAreaBar"] = [];
+ }
+};
+BinaryChartWriter.prototype.WriteCT_NumericDimensionType = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.NUMERIC_DIMENSION_TYPE_VAL: nVal = st_numericdimensiontypeVAL; break;
+ case AscFormat.NUMERIC_DIMENSION_TYPE_X: nVal = st_numericdimensiontypeX; break;
+ case AscFormat.NUMERIC_DIMENSION_TYPE_Y: nVal = st_numericdimensiontypeY; break;
+ case AscFormat.NUMERIC_DIMENSION_TYPE_SIZE: nVal = st_numericdimensiontypeSIZE; break;
+ case AscFormat.NUMERIC_DIMENSION_TYPE_COLOR_VAL:
+ default: nVal = st_numericdimensiontypeCOLORVAL; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_NumericDimension = function (oVal) {
+ var oThis = this;
+ if(oVal.type !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionTYPE, function() {
+ oThis.WriteCT_NumericDimensionType(oVal.type);
+ });
+ }
+ if(oVal.f !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionFORMULA, function() {
+ oThis.WriteCT_Formula(oVal.f);
+ });
+ }
+ if(oVal.nf !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionNF, function() {
+ oThis.memory.WriteString3(oVal.nf);
+ });
+ }
+ if(oVal.levelData !== null) {
+ for (var i = 0, length = oVal.levelData.length; i < length; ++i) {
+ var oCurVal = oVal.levelData[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExDataDimensionNUMERICLEVEL, function () {
+ oThis.WriteCT_NumericLevel(oCurVal);
+ });
}
- aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboCustom"];
}
- if(Array.isArray(aStyles)) {
- if(this.curChart.oDataLablesData) {
- AscCommon.g_oDataLabelsBinaries[this.curChart.oDataLablesData.crc32] = this.curChart.oDataLablesData.data;
- }
- if(this.curChart.oCatAxData) {
- AscCommon.g_oCatBinaries[this.curChart.oCatAxData.crc32] = this.curChart.oCatAxData.data;
- }
- if(this.curChart.oValAxData) {
- AscCommon.g_oValBinaries[this.curChart.oValAxData.crc32] = this.curChart.oValAxData.data;
- }
- if(this.curChart.oView3DData) {
- AscCommon.g_oView3dBinaries[this.curChart.oView3DData.crc32] = this.curChart.oView3DData.data;
- }
- if(this.curChart.oLegendData) {
- AscCommon.g_oLegendBinaries[this.curChart.oLegendData.crc32] = this.curChart.oLegendData.data;
- }
- if(this.curChart.oChartStyleData) {
- AscCommon.g_oStylesBinaries[this.curChart.oChartStyleData.crc32] = this.curChart.oChartStyleData.data;
- AscCommon.g_oChartStylesIdMap[this.curChart.chartStyle.id] = this.curChart.oChartStyleData.crc32;
- }
- if(this.curChart.oChartColorsData) {
- AscCommon.g_oColorsBinaries[this.curChart.oChartColorsData.crc32] = this.curChart.oChartColorsData.data;
- }
- var oBarChart;
- var aCharts = val.chart.plotArea.charts;
- if(aCharts.length === 1 && aCharts[0].getObjectType() === AscDFH.historyitem_type_BarChart) {
- oBarChart = aCharts[0];
- }
- var crc32BarParams = null;
- if(oBarChart) {
- var aBarParams = [];
- aBarParams.push(oBarChart.gapWidth);
- aBarParams.push(oBarChart.overlap);
- aBarParams.push(oBarChart.gapDepth);
- var sJSON = JSON.stringify(aBarParams);
- crc32BarParams = AscCommon.g_oCRC32.Calculate_ByString(sJSON, sJSON.length);
- AscCommon.g_oBarParams[crc32BarParams] = aBarParams;
- }
- aStyles.push([
- val.oChartStyleData && val.oChartStyleData.crc32 || null,
- val.oChartColorsData && val.oChartColorsData.crc32 || null,
- val.oDataLablesData && val.oDataLablesData.crc32 || null,
- val.oCatAxData && val.oCatAxData.crc32 || null,
- val.oValAxData && val.oValAxData.crc32 || null,
- val.oView3DData && val.oView3DData.crc32 || null,
- val.oLegendData && val.oLegendData.crc32 || null,
- crc32BarParams
- ]);
+ }
+};
+BinaryChartWriter.prototype.WriteCT_FormulaDirection = function (oVal) {
+ var oThis = this;
+ var nVal = null;
+ switch (oVal) {
+ case AscFormat.FORMULA_DIRECTION_COL: nVal = st_formuladirectionCOL; break;
+ case AscFormat.FORMULA_DIRECTION_ROW:
+ default: nVal = st_formuladirectionROW; break;
+ }
+ oThis.memory.WriteByte(nVal);
+};
+BinaryChartWriter.prototype.WriteCT_Formula = function (oVal) {
+ var oThis = this;
+ if(oVal.content !== null) {
+ this.bs.WriteItem(c_oserct_chartExFormulaCONTENT, function() {
+ oThis.memory.WriteString3(oVal.content);
+ });
+ }
+ if(oVal.dir !== null) {
+ this.bs.WriteItem(c_oserct_chartExFormulaDIRECTION, function() {
+ oThis.WriteCT_FormulaDirection(oVal.dir);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_StringLevel = function (oVal) {
+ var oThis = this;
+ if(oVal.name !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelNAME, function() {
+ oThis.memory.WriteString3(oVal.name);
+ });
+ }
+ if(oVal.ptCount !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelCOUNT, function() {
+ oThis.memory.WriteLong(oVal.ptCount);
+ });
+ }
+ for (var i = 0, length = oVal.pts.length; i < length; ++i) {
+ var oCurVal = oVal.pts[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelPT, function () {
+ oThis.WriteCT_StringValue(oCurVal);
+ });
+ }
+ }
+};
+BinaryChartWriter.prototype.WriteCT_NumericLevel = function (oVal) {
+ var oThis = this;
+ if(oVal.name !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelNAME, function() {
+ oThis.memory.WriteString3(oVal.name);
+ });
+ }
+ if(oVal.ptCount !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelCOUNT, function() {
+ oThis.memory.WriteLong(oVal.ptCount);
+ });
+ }
+
+ for (var i = 0, length = oVal.pts.length; i < length; ++i) {
+ var oCurVal = oVal.pts[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelPT, function () {
+ oThis.WriteCT_NumericValue(oCurVal);
+ });
+ }
+ }
+ if(oVal.formatCode !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataLevelFORMATCODE, function() {
+ oThis.memory.WriteString3(oVal.formatCode);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_StringValue = function (oVal) {
+ var oThis = this;
+ if(oVal.idx !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataValueIDX, function() {
+ oThis.memory.WriteLong(oVal.idx);
+ });
+ }
+ if(oVal.val !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataValueCONTENT, function() {
+ oThis.memory.WriteString3(oVal.val);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteCT_NumericValue = function (oVal) {
+ var oThis = this;
+ if(oVal.idx !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataValueIDX, function() {
+ oThis.memory.WriteLong(oVal.idx);
+ });
+ }
+ if(oVal.content !== null) {
+ this.bs.WriteItem(c_oserct_chartExDataValueCONTENT, function() {
+ oThis.memory.WriteDouble2(oVal.val);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteAlternateContent = function (oVal) {
+ var oThis = this;
+ if (null != oVal.m_Choice) {
+ for (var i = 0, length = oVal.m_Choice.length; i < length; ++i) {
+ var oCurVal = oVal.m_Choice[i];
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oseralternatecontentCHOICE, function () {
+ oThis.WriteAlternateContentChoice(oCurVal);
+ });
+ }
+ }
+ }
+ var oCurVal = oVal.m_Fallback;
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oseralternatecontentFALLBACK, function () {
+ oThis.WriteAlternateContentFallback(oCurVal);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteAlternateContentChoice = function (oVal) {
+ var oThis = this;
+ var oCurVal = oVal.m_style;
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oseralternatecontentchoiceSTYLE, function () {
+ oThis.WriteCT_Style(oCurVal);
+ });
+ }
+ var oCurVal = oVal.m_Requires;
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oseralternatecontentchoiceREQUIRES, function () {
+ oThis.memory.WriteString3(oCurVal);
+ });
+ }
+};
+BinaryChartWriter.prototype.WriteAlternateContentFallback = function (oVal) {
+ var oThis = this;
+ var oCurVal = oVal.m_style;
+ if (null != oCurVal) {
+ this.bs.WriteItem(c_oseralternatecontentfallbackSTYLE, function () {
+ oThis.WriteCT_Style1(oCurVal);
+ });
+ }
+};
+function BinaryChartReader(stream) {
+ this.stream = stream;
+ this.bcr = new AscCommon.Binary_CommonReader(this.stream);
+ this.drawingDocument = null;
+}
+BinaryChartReader.prototype.ReadCT_extLst = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_extlstEXT === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Extension(t, l, oNewVal);
+ });
+ if (null == val.m_ext)
+ val.m_ext = [];
+ val.m_ext.push(oNewVal);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ExternalReadCT_ChartSpace = function (length, val, curWorksheet) {
+ var res = c_oSerConstants.ReadOk;
+ this.curWorksheet = curWorksheet;
+ this.drawingDocument = null;
+ if(this.curWorksheet) {
+ if(this.curWorksheet.getDrawingDocument) {
+ this.drawingDocument = this.curWorksheet.getDrawingDocument();
+ }
+ if (!this.drawingDocument && this.curWorksheet.DrawingDocument) {
+ this.drawingDocument = this.curWorksheet.DrawingDocument;
+ }
+ }
+
+ var oThis = this;
+ this.curChart = val;
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartSpace(t, l, val);
+ });
+ if(val){
+ val.correctAxes();
+ }
+ /*if(this.curWorksheet) {
+ var aStyles = null;
+ var sName = this.curWorksheet.sName;
+ if(sName === "Bar") {
+
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal"];
+ }
+ else if(sName === "BarStacked") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked"];
+ }
+ else if(sName === "BarStackedPer") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer"];
+ }
+ else if(sName === "3DClusteredColumn") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3d"];
+ }
+ else if(sName === "3DStackedColumn") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStacked3d"];
+ }
+ else if(sName === "3DStackedColumnPer") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barStackedPer3d"];
+ }
+ else if(sName === "3DColumn") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3dPerspective"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3dPerspective"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.barNormal3dPerspective"];
+ }
+ else if(sName === "2DBar") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal"];
+ }
+ else if(sName === "StackedBar") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked"];
+ }
+ else if(sName === "StackedBarPer") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStackedPer"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStackedPer"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStackedPer"];
+ }
+ else if(sName === "3DClusteredBar") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarNormal3d"];
+ }
+ else if(sName === "3DStackedBar") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.hBarStacked3d"];
+ }
+ else if(sName === "Line") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormal"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormalMarker"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStackedMarker"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStackedPerMarker"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormal"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStacked"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineStackedPer"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.lineNormal"];
+ }
+ else if(sName === "Line3D") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.line3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.line3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.line3d"];
+ }
+ else if(sName === "Pie") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie"];
+ }
+ else if(sName === "Pie3D") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie3d"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie3d"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.pie3d"];
+ }
+ else if(sName === "Doughnut") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.doughnut"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.doughnut"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.doughnut"];
+ }
+ else if(sName === "Area") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaNormal"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaNormal"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaStacked"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaStackedPer"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.areaNormal"];
+ }
+ else if(sName === "Stock") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.stock"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.stock"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.stock"];
+ }
+ if(sName === "ScatterLine") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatter"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatter"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterLine"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterLineMarker"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterMarker"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterNone"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterSmooth"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatterSmoothMarker"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.scatter"];
+ }
+ else if(sName === "Combo") {
+ if(!Array.isArray(AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboCustom"])) {
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboCustom"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboBarLine"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboBarLineSecondary"] =
+ AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboAreaBar"] = [];
+ }
+ aStyles = AscCommon.g_oChartStyles["Asc.c_oAscChartTypeSettings.comboCustom"];
+ }
+ if(Array.isArray(aStyles)) {
+ if(this.curChart.oDataLablesData) {
+ AscCommon.g_oDataLabelsBinaries[this.curChart.oDataLablesData.crc32] = this.curChart.oDataLablesData.data;
+ }
+ if(this.curChart.oCatAxData) {
+ AscCommon.g_oCatBinaries[this.curChart.oCatAxData.crc32] = this.curChart.oCatAxData.data;
+ }
+ if(this.curChart.oValAxData) {
+ AscCommon.g_oValBinaries[this.curChart.oValAxData.crc32] = this.curChart.oValAxData.data;
+ }
+ if(this.curChart.oView3DData) {
+ AscCommon.g_oView3dBinaries[this.curChart.oView3DData.crc32] = this.curChart.oView3DData.data;
+ }
+ if(this.curChart.oLegendData) {
+ AscCommon.g_oLegendBinaries[this.curChart.oLegendData.crc32] = this.curChart.oLegendData.data;
+ }
+ if(this.curChart.oChartStyleData) {
+ AscCommon.g_oStylesBinaries[this.curChart.oChartStyleData.crc32] = this.curChart.oChartStyleData.data;
+ AscCommon.g_oChartStylesIdMap[this.curChart.chartStyle.id] = this.curChart.oChartStyleData.crc32;
+ }
+ if(this.curChart.oChartColorsData) {
+ AscCommon.g_oColorsBinaries[this.curChart.oChartColorsData.crc32] = this.curChart.oChartColorsData.data;
+ }
+ var oBarChart;
+ var aCharts = val.chart.plotArea.charts;
+ if(aCharts.length === 1 && aCharts[0].getObjectType() === AscDFH.historyitem_type_BarChart) {
+ oBarChart = aCharts[0];
+ }
+ var crc32BarParams = null;
+ if(oBarChart) {
+ var aBarParams = [];
+ aBarParams.push(oBarChart.gapWidth);
+ aBarParams.push(oBarChart.overlap);
+ aBarParams.push(oBarChart.gapDepth);
+ var sJSON = JSON.stringify(aBarParams);
+ crc32BarParams = AscCommon.g_oCRC32.Calculate_ByString(sJSON, sJSON.length);
+ AscCommon.g_oBarParams[crc32BarParams] = aBarParams;
+ }
+ aStyles.push([
+ val.oChartStyleData && val.oChartStyleData.crc32 || null,
+ val.oChartColorsData && val.oChartColorsData.crc32 || null,
+ val.oDataLablesData && val.oDataLablesData.crc32 || null,
+ val.oCatAxData && val.oCatAxData.crc32 || null,
+ val.oValAxData && val.oValAxData.crc32 || null,
+ val.oView3DData && val.oView3DData.crc32 || null,
+ val.oLegendData && val.oLegendData.crc32 || null,
+ crc32BarParams
+ ]);
+ }
+ }*/
+ return res;
+};
+BinaryChartReader.prototype.ExternalReadCT_ChartExSpace = function (length, val, curWorksheet) {
+ var res = c_oSerConstants.ReadOk;
+ this.curWorksheet = curWorksheet;
+ this.drawingDocument = null;
+ if(this.curWorksheet) {
+ if(this.curWorksheet.getDrawingDocument) {
+ this.drawingDocument = this.curWorksheet.getDrawingDocument();
+ }
+ else {
+ if(this.curWorksheet.DrawingDocument) {
+ this.drawingDocument = this.curWorksheet.DrawingDocument;
+ }
+ }
+ }
+
+ var oThis = this;
+ this.curChart = val;
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartExSpace(t, l, val);
+ });
+ if(val) {
+ val.correctAxes();
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartSpace = function (type, length, val, curWorksheet) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartspaceDATE1904 === type) {
+ oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setDate1904(oNewVal.m_val);
+ else
+ val.setDate1904(true);
+ }
+ else if (c_oserct_chartspaceLANG === type) {
+ oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TextLanguageID(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setLang(oNewVal.m_val);
+ }
+ else if (c_oserct_chartspaceROUNDEDCORNERS === type) {
+ oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setRoundedCorners(oNewVal.m_val);
+ }
+ else if (c_oserct_chartspaceALTERNATECONTENT === type) {
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadAlternateContent(t, l, oNewVal);
+ });
+ var nNewStyle = null;
+ if (null != oNewVal.m_Choice && oNewVal.m_Choice.length > 0) {
+ var choice = oNewVal.m_Choice[0];
+ if (null != choice.m_style && null != choice.m_style.m_val)
+ nNewStyle = choice.m_style.m_val - 100;
+ }
+ if (null == nNewStyle && null != oNewVal.m_Fallback && null != oNewVal.m_Fallback.m_style && null != oNewVal.m_Fallback.m_style.m_val)
+ nNewStyle = oNewVal.m_Fallback.m_style.m_val;
+ if (null != nNewStyle)
+ val.setStyle(nNewStyle);
+ }
+ else if (c_oserct_chartspaceSTYLE === type) {
+ oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Style1(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setStyle(oNewVal.m_val);
+ }
+ else if (c_oserct_chartspaceCLRMAPOVR === type) {
+ val.setClrMapOvr(this.ReadClrOverride(length));
+ }
+ else if (c_oserct_chartspacePIVOTSOURCE === type) {
+ oNewVal = new AscFormat.CPivotSource();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_PivotSource(t, l, oNewVal);
+ });
+ val.setPivotSource(oNewVal);
+ }
+ else if (c_oserct_chartspacePROTECTION === type) {
+ oNewVal = new AscFormat.CProtection();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Protection(t, l, oNewVal);
+ });
+ val.setProtection(oNewVal);
+ }
+ else if (c_oserct_chartspaceCHART === type) {
+ oNewVal = new AscFormat.CChart();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Chart(t, l, oNewVal);
+ });
+ val.setChart(oNewVal);
+ // if(null === oNewVal.autoTitleDeleted){
+ // oNewVal.setAutoTitleDeleted(false);
+ // }
+ }
+ else if (c_oserct_chartspaceSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ val.spPr.setParent(val);
+ }
+ else if (c_oserct_chartspaceTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ //else if (c_oserct_chartspaceEXTERNALDATA === type) {
+ // oNewVal;
+ // oNewVal = {};
+ // res = this.bcr.Read1(length, function (t, l) {
+ // return oThis.ReadCT_ExternalData(t, l, oNewVal);
+ // });
+ // val.m_externalData = oNewVal;
+ //}
+ else if (c_oserct_chartspacePRINTSETTINGS === type) {
+ oNewVal = new AscFormat.CPrintSettings();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_PrintSettings(t, l, oNewVal);
+ });
+ val.setPrintSettings(oNewVal);
+ }
+ else if (c_oserct_chartspaceUSERSHAPES === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UserShapes(t, l, val);
+ });
+ }
+ else if (c_oserct_chartspaceEXTLST === type) {
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else if (c_oserct_chartspaceTHEMEOVERRIDE === type) {
+ var theme = AscCommon.pptx_content_loader.ReadTheme(this, this.stream);
+ if (null != theme)
+ val.setThemeOverride(theme);
+ }
+ else if(c_oserct_chartspaceXLSX === type) {
+ //todo
+ res = c_oSerConstants.ReadUnknown;
+ }
+ else if(c_oserct_chartspaceSTYLES === type) {
+ oNewVal = new AscFormat.CChartStyle();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartStyle(t, l, oNewVal);
+ });
+ if(oNewVal) {
+ val.setChartStyle(oNewVal);
+ }
+ }
+ else if(c_oserct_chartspaceCOLORS === type) {
+ oNewVal = new AscFormat.CChartColors();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartColors(t, l, oNewVal);
+ });
+ if(oNewVal) {
+ val.setChartColors(oNewVal);
+ }
+ }
+ else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartExSpace = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if(c_oserct_chartExSpaceCHARTDATA === type)
+ {
+ oNewVal = new AscFormat.CChartData();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartData(t, l, oNewVal);
+ });
+ val.setChartData(oNewVal);
+ }
+ else if (c_oserct_chartExSpaceCHART === type) {
+ oNewVal = new AscFormat.CChart();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartEx(t, l, oNewVal);
+ });
+ val.setChart(oNewVal);
+ }
+ else if (c_oserct_chartExSpaceSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_chartExSpaceTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_chartExSpaceCLRMAPOVR === type) {
+ val.setClrMapOvr(this.ReadClrOverride(length));
+ }
+ // else if(c_oserct_chartExSpaceXLSX === type) {
+ // //todo
+ // res = c_oSerConstants.ReadUnknown;
+ // }
+ else if(c_oserct_chartExSpaceCOLORS === type) {
+ oNewVal = new AscFormat.CChartColors();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartColors(t, l, oNewVal);
+ });
+ val.setChartColors(oNewVal);
+ }
+ else if(c_oserct_chartExSpaceSTYLES === type) {
+ oNewVal = new AscFormat.CChartStyle();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartStyle(t, l, oNewVal);
+ });
+ val.setChartStyle(oNewVal);
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadSpPr = function (length) {
+ return AscCommon.pptx_content_loader.ReadShapeProperty(this.stream);
+};
+
+BinaryChartReader.prototype.ReadClrOverride = function(lenght)
+{
+ var loader = new AscCommon.BinaryPPTYLoader();
+
+ loader.stream = new AscCommon.FileStream();
+ loader.stream.obj = this.stream.obj;
+ loader.stream.data = this.stream.data;
+ loader.stream.size = this.stream.size;
+
+ loader.stream.pos = this.stream.pos;
+ loader.stream.cur = this.stream.cur;
+ var s = loader.stream;
+ var _main_type = s.GetUChar(); // 0!!!
+
+ var clr_map = new AscFormat.ClrMap();
+ loader.ReadClrMap(clr_map);
+
+ this.stream.pos = s.pos;
+ this.stream.cur = s.cur;
+ return clr_map;
+
+};
+
+BinaryChartReader.prototype.ReadTxPr = function (length) {
+ var cur = this.stream.cur;
+ var ret = AscCommon.pptx_content_loader.ReadTextBody(null, this.stream, null, this.curWorksheet, this.drawingDocument);
+ this.stream.cur = cur + length;
+ return ret;
+};
+BinaryChartReader.prototype.ParsePersent = function (val) {
+ var nVal = parseFloat(val);
+ if (!isNaN(nVal))
+ return nVal;
+ else
+ return null;
+};
+BinaryChartReader.prototype.ParseMetric = function (val) {
+ var nVal = parseFloat(val);
+ var nRes = null;
+ if (!isNaN(nVal)) {
+ if (-1 != val.indexOf("mm"))
+ nRes = nVal;
+ else if (-1 != val.indexOf("cm"))
+ nRes = nVal * 10;
+ else if (-1 != val.indexOf("in"))
+ nRes = nVal * 2.54 * 10;
+ else if (-1 != val.indexOf("pt"))
+ nRes = nVal * 2.54 * 10 / 72;
+ else if (-1 != val.indexOf("pc") || -1 != val.indexOf("pi"))
+ nRes = nVal * 12 * 2.54 * 10 / 72;
+ }
+ return nRes;
+};
+BinaryChartReader.prototype.CorrectChartWithAxis = function (chartOld, chartNew, aChartWithAxis) {
+ for (var i = 0, length = aChartWithAxis.length; i < length; ++i) {
+ var item = aChartWithAxis[i];
+ if (item.chart == chartOld)
+ item.chart = chartNew;
+ }
+};
+BinaryChartReader.prototype.ReadCT_Boolean = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_booleanVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetBool();
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ExternalReadCT_RelId = function (length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_RelId(t, l, val);
+ });
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_RelId = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_relidID === type) {
+ //todo
+ var oNewVal;
+ oNewVal = this.stream.GetString2LE(length);
+ val.m_id = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_UserShapes = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var nCount;
+ if (c_oserct_usershapes_COUNT === type) {
+ nCount = this.stream.GetULongLE();
+ }
+ else if(c_oserct_usershapes_SHAPE_REL){
+ var oNewVal = new AscFormat.CRelSizeAnchor();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_userShape(t, l, oNewVal);
+ });
+ val.addUserShape(undefined, oNewVal);
+ }
+ else if(c_oserct_usershapes_SHAPE_ABS){
+ var oNewVal = new AscFormat.CAbsSizeAnchor();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_userShape(t, l, oNewVal);
+ });
+ val.addUserShape(undefined, oNewVal);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+
+BinaryChartReader.prototype.ReadCT_ChartStyle = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if(c_oserct_chartstyleID === type) {
+ val.setId(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartstyleENTRY === type) {
+ oNewVal = new AscFormat.CStyleEntry();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_StyleEntry(t, l, oNewVal);
+ });
+ if(res === c_oSerConstants.ReadOk) {
+ val.addEntry(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleMARKERLAYOUT === type) {
+ oNewVal = new AscFormat.CMarkerLayout();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_MarkerLayout(t, l, oNewVal);
+ });
+ if(res === c_oSerConstants.ReadOk) {
+ val.setMarkerLayout(oNewVal);
+ }
+ }
+ else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_StyleEntry = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oNewVal;
+ if (c_oserct_chartstyleENTRYTYPE == type)
+ {
+ val.setType(this.stream.GetUChar());
+ }
+ else if (c_oserct_chartstyleLNREF == type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadStyleRef(this, this.stream);
+ if(oNewVal)
+ {
+ val.setLnRef(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleFILLREF == type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadStyleRef(this, this.stream);
+ if(oNewVal)
+ {
+ val.setFillRef(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleEFFECTREF == type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadStyleRef(this, this.stream);
+ if(oNewVal)
+ {
+ val.setEffectRef(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleFONTREF == type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadFontRef(this, this.stream);
+ if(oNewVal)
+ {
+ val.setFontRef(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleDEFPR == type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadRunProperties(this.stream, 0);
+ if(oNewVal)
+ {
+ val.setDefRPr(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleBODYPR == type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadBodyPr(this, this.stream);
+ if(oNewVal)
+ {
+ val.setBodyPr(oNewVal);
+ }
+ }
+ else if (c_oserct_chartstyleSPPR == type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_chartstyleLINEWIDTH == type)
+ {
+ val.setLineWidthScale(this.stream.GetDoubleLE());
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_MarkerLayout = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_chartstyleMARKERSYMBOL == type)
+ {
+ val.setSymbol(this.MarkerStyleToFormat(this.stream.GetUChar()));
+ }
+ else if (c_oserct_chartstyleMARKERSIZE == type)
+ {
+ val.setSize(this.stream.GetULongLE());
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartColors = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartcolorsID === type)
+ {
+ val.setId(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartcolorsMETH === type)
+ {
+ val.setMeth(this.stream.GetString2LE(length));
+ }
+ else if(c_oserct_chartcolorsVARIATION === type)
+ {
+ oNewVal = new AscFormat.CColorModifiers();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ColorsVariation(t, l, oNewVal);
+ });
+ val.addItem(oNewVal);
+ }
+ else if(c_oserct_chartcolorsCOLOR === type)
+ {
+ oNewVal = AscCommon.pptx_content_loader.ReadUniColor(this, this.stream);
+ if(oNewVal)
+ {
+ val.addItem(oNewVal);
+ }
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ColorsVariation = function (type, length, val)
+{
+ var res = c_oSerConstants.ReadOk;
+ if (c_oserct_chartcolorsEFFECT === type)
+ {
+ var oMod = AscCommon.pptx_content_loader.ReadColorMod(this, this.stream);
+ if(oMod)
+ {
+ val.addMod(oMod);
+ }
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+
+BinaryChartReader.prototype.ReadCT_FromTo = function(type, length, poResult)
+{
+ var res = c_oSerConstants.ReadOk;
+ if(Asc.c_oSer_DrawingPosType.X == type)
+ {
+ poResult.x = this.stream.GetDoubleLE();
+ }
+ else if(Asc.c_oSer_DrawingPosType.Y == type)
+ {
+ poResult.y = this.stream.GetDoubleLE();
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_userShape = function(type, length, poResult)
+{
+ var oThis = this;
+
+ var res = c_oSerConstants.ReadOk;
+ if(Asc.c_oSer_DrawingType.From == type)
+ {
+ var oNewVal = {};
+ res = this.bcr.Read2Spreadsheet(length, function (t, l) {
+ return oThis.ReadCT_FromTo(t, l, oNewVal);
+ });
+ poResult.setFromTo(oNewVal.x, oNewVal.y, poResult.toX, poResult.toY);
+ }
+ else if(Asc.c_oSer_DrawingType.To == type)
+ {
+ var oNewVal = {};
+ res = this.bcr.Read2Spreadsheet(length, function (t, l) {
+ return oThis.ReadCT_FromTo(t, l, oNewVal);
+ });
+ poResult.setFromTo( poResult.fromX, poResult.fromY, oNewVal.x, oNewVal.y);
+ }
+ else if(Asc.c_oSer_DrawingType.Ext == type)
+ {
+ var oNewVal = {};
+ res = this.bcr.Read2Spreadsheet(length, function (t, l) {
+ return oThis.ReadCT_FromTo(t, l, oNewVal);
+ });
+ poResult.setFromTo( poResult.fromX, poResult.fromY, oNewVal.x, oNewVal.y);
+ }
+ else if(Asc.c_oSer_DrawingType.pptxDrawing == type)
+ {
+ var oGraphicObject = AscCommon.pptx_content_loader.ReadGraphicObject(this.stream, this.curWorksheet, this.drawingDocument);
+ poResult.setObject(oGraphicObject);
+ // oGraphicObject.createTextBody();
+ // oGraphicObject.txBody.content.AddText("Test user Shapes");
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PageSetup = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_pagesetupPAPERSIZE === type) {
+ val.setPaperSize(this.stream.GetULongLE());
+ }
+ else if (c_oserct_pagesetupPAPERHEIGHT === type) {
+ var mm = this.ParseMetric(this.stream.GetString2LE(length));
+ if (null != mm)
+ val.setPaperHeight(mm);
+ }
+ else if (c_oserct_pagesetupPAPERWIDTH === type) {
+ var mm = this.ParseMetric(this.stream.GetString2LE(length));
+ if (null != mm)
+ val.setPaperWidth(mm);
+ }
+ else if (c_oserct_pagesetupFIRSTPAGENUMBER === type) {
+ val.setFirstPageNumber(this.stream.GetULongLE());
+ }
+ else if (c_oserct_pagesetupORIENTATION === type) {
+ switch (this.stream.GetUChar()) {
+ case st_pagesetuporientationDEFAULT: val.setOrientation(AscFormat.PAGE_SETUP_ORIENTATION_DEFAULT); break;
+ case st_pagesetuporientationPORTRAIT: val.setOrientation(AscFormat.PAGE_SETUP_ORIENTATION_PORTRAIT); break;
+ case st_pagesetuporientationLANDSCAPE: val.setOrientation(AscFormat.PAGE_SETUP_ORIENTATION_LANDSCAPE); break;
+ }
+ }
+ else if (c_oserct_pagesetupBLACKANDWHITE === type) {
+ val.setBlackAndWhite(this.stream.GetBool());
+ }
+ else if (c_oserct_pagesetupDRAFT === type) {
+ val.setBlackAndWhite(this.stream.GetBool());
+ }
+ else if (c_oserct_pagesetupUSEFIRSTPAGENUMBER === type) {
+ val.setUseFirstPageNumb(this.stream.GetBool());
+ }
+ else if (c_oserct_pagesetupHORIZONTALDPI === type) {
+ val.setHorizontalDpi(this.stream.GetULongLE());
+ }
+ else if (c_oserct_pagesetupVERTICALDPI === type) {
+ val.setVerticalDpi(this.stream.GetULongLE());
+ }
+ else if (c_oserct_pagesetupCOPIES === type) {
+ val.setCopies(this.stream.GetULongLE());
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PageMargins = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_pagemarginsL === type) {
+ val.setL(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_pagemarginsR === type) {
+ val.setR(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_pagemarginsT === type) {
+ val.setT(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_pagemarginsB === type) {
+ val.setB(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_pagemarginsHEADER === type) {
+ val.setHeader(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_pagemarginsFOOTER === type) {
+ val.setFooter(this.stream.GetDoubleLE());
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_HeaderFooter = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_headerfooterODDHEADER === type) {
+ val.setOddHeader(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_headerfooterODDFOOTER === type) {
+ val.setOddFooter(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_headerfooterEVENHEADER === type) {
+ val.setEvenHeader(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_headerfooterEVENFOOTER === type) {
+ val.setEvenFooter(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_headerfooterFIRSTHEADER === type) {
+ val.setFirstHeader(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_headerfooterFIRSTFOOTER === type) {
+ val.setFirstFooter(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_headerfooterALIGNWITHMARGINS === type) {
+ val.setAlignWithMargins(this.stream.GetBool());
+ }
+ else if (c_oserct_headerfooterDIFFERENTODDEVEN === type) {
+ val.setDifferentOddEven(this.stream.GetBool());
+ }
+ else if (c_oserct_headerfooterDIFFERENTFIRST === type) {
+ val.setDifferentFirst(this.stream.GetBool());
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PrintSettings = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_printsettingsHEADERFOOTER === type) {
+ var oNewVal = new AscFormat.CHeaderFooterChart();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_HeaderFooter(t, l, oNewVal);
+ });
+ val.setHeaderFooter(oNewVal);
+ }
+ else if (c_oserct_printsettingsPAGEMARGINS === type) {
+ var oNewVal = new AscFormat.CPageMarginsChart();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_PageMargins(t, l, oNewVal);
+ });
+ val.setPageMargins(oNewVal);
+ }
+ else if (c_oserct_printsettingsPAGESETUP === type) {
+ var oNewVal = new AscFormat.CPageSetup();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_PageSetup(t, l, oNewVal);
+ });
+ val.setPageSetup(oNewVal);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ExternalData = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_externaldataAUTOUPDATE === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ val.m_autoUpdate = oNewVal;
+ }
+ else if (c_oserct_externaldataID === type) {
+ //todo
+ var oNewVal;
+ oNewVal = this.stream.GetString2LE(length);
+ val.m_id = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DispBlanksAs = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_dispblanksasVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_dispblanksasSPAN: val.m_val = AscFormat.DISP_BLANKS_AS_SPAN; break;
+ case st_dispblanksasGAP: val.m_val = AscFormat.DISP_BLANKS_AS_GAP; break;
+ case st_dispblanksasZERO: val.m_val = AscFormat.DISP_BLANKS_AS_ZERO; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_LegendEntry = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_legendentryIDX === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setIdx(oNewVal.m_val);
+ }
+ else if (c_oserct_legendentryDELETE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setDelete(oNewVal.m_val);
+ else
+ val.setDelete(true);
+ }
+ else if (c_oserct_legendentryTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_legendentryEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_UnsignedInt = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_unsignedintVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetULongLE();
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Extension = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_extensionANY === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetString2LE(length);
+ val.m_Any = oNewVal;
+ }
+ else if (c_oserct_extensionURI === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetString2LE(length);
+ val.m_uri = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_LegendPos = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_legendposVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_legendposB: val.m_val = c_oAscChartLegendShowSettings.bottom; break;
+ case st_legendposTR: val.m_val = c_oAscChartLegendShowSettings.topRight; break;
+ case st_legendposL: val.m_val = c_oAscChartLegendShowSettings.left; break;
+ case st_legendposR: val.m_val = c_oAscChartLegendShowSettings.right; break;
+ case st_legendposT: val.m_val = c_oAscChartLegendShowSettings.top; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Legend = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_legendLEGENDPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LegendPos(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setLegendPos(oNewVal.m_val);
+ }
+ else if (c_oserct_legendLEGENDENTRY === type) {
+ var oNewVal = new AscFormat.CLegendEntry();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LegendEntry(t, l, oNewVal);
+ });
+ val.addLegendEntry(oNewVal);
+ }
+ else if (c_oserct_legendLAYOUT === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Layout(t, l, val);
+ });
+ }
+ else if (c_oserct_legendOVERLAY === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setOverlay(oNewVal.m_val);
+ }
+ else if (c_oserct_legendSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_legendTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_legendALIGN === type) {
+ val.setAlign(this.stream.GetUChar())
+ }
+ else if (c_oserct_legendEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Layout = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_layoutMANUALLAYOUT === type) {
+ var oNewVal = new AscFormat.CLayout();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ManualLayout(t, l, oNewVal);
+ });
+ val.setLayout(oNewVal);
+ }
+ else if (c_oserct_layoutEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ManualLayout = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_manuallayoutLAYOUTTARGET === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LayoutTarget(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setLayoutTarget(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutXMODE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setXMode(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutYMODE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setYMode(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutWMODE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setWMode(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutHMODE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setHMode(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutX === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setX(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutY === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setY(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutW === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setW(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutH === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setH(oNewVal.m_val);
+ }
+ else if (c_oserct_manuallayoutEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_LayoutTarget = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_layouttargetVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_layouttargetINNER: val.m_val = LAYOUT_TARGET_INNER; break;
+ case st_layouttargetOUTER: val.m_val = LAYOUT_TARGET_OUTER; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_LayoutMode = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_layoutmodeVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_layoutmodeEDGE: val.m_val = LAYOUT_MODE_EDGE; break;
+ case st_layoutmodeFACTOR: val.m_val = LAYOUT_MODE_FACTOR; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Double = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_doubleVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetDoubleLE();
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DTable = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_dtableSHOWHORZBORDER === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowHorzBorder(oNewVal.m_val);
+ }
+ else if (c_oserct_dtableSHOWVERTBORDER === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowVertBorder(oNewVal.m_val);
+ }
+ else if (c_oserct_dtableSHOWOUTLINE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowOutline(oNewVal.m_val);
+ }
+ else if (c_oserct_dtableSHOWKEYS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowKeys(oNewVal.m_val);
+ }
+ else if (c_oserct_dtableSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length))
+ }
+ else if (c_oserct_dtableTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_dtableEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_SerAx = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_seraxAXID === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setAxId(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxSCALING === type) {
+ var oNewVal = new AscFormat.CScaling();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Scaling(t, l, oNewVal);
+ });
+ val.setScaling(oNewVal);
+ }
+ else if (c_oserct_seraxDELETE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setDelete(oNewVal.m_val);
+ else
+ val.setDelete(true);
+ }
+ else if (c_oserct_seraxAXPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_AxPos(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setAxPos(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxMAJORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMajorGridlines(oNewVal.spPr);
+ else
+ val.setMajorGridlines(new AscFormat.CSpPr());
+ }
+ else if (c_oserct_seraxMINORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMinorGridlines(oNewVal.spPr);
+ else
+ val.setMinorGridlines(new AscFormat.CSpPr());
+ }
+ else if (c_oserct_seraxTITLE === type) {
+ var oNewVal = new AscFormat.CTitle();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Title(t, l, oNewVal);
+ });
+ if(!AscFormat.isRealBool(oNewVal.overlay))
+ {
+ oNewVal.setOverlay(false);
+ }
+ val.setTitle(oNewVal);
+ }
+ else if (c_oserct_seraxNUMFMT === type) {
+ var oNewVal = new AscFormat.CNumFmt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumFmt(t, l, oNewVal);
+ });
+ val.setNumFmt(oNewVal);
+ }
+ else if (c_oserct_seraxMAJORTICKMARK === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setMajorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
+ }
+ }
+ else if (c_oserct_seraxMINORTICKMARK === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setMinorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
}
- }*/
+ }
+ else if (c_oserct_seraxTICKLBLPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickLblPos(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setTickLblPos(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_seraxTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_seraxCROSSAX === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+
+ if (null != oNewVal.m_val)
+ {
+ val.crossAxId = oNewVal.m_val;
+ }
+ }
+ else if (c_oserct_seraxCROSSES === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Crosses(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setCrosses(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxCROSSESAT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setCrossesAt(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxTICKLBLSKIP === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Skip(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setTickLblSkip(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxTICKMARKSKIP === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Skip(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setTickMarkSkip(oNewVal.m_val);
+ }
+ else if (c_oserct_seraxEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ChartSpace = function (type, length, val, curWorksheet) {
+BinaryChartReader.prototype.ReadCT_Scaling = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- var oNewVal;
- if (c_oserct_chartspaceDATE1904 === type) {
- oNewVal = { m_val: null };
+ if (c_oserct_scalingLOGBASE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_LogBase(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDate1904(oNewVal.m_val);
- else
- val.setDate1904(true);
+ val.setLogBase(oNewVal.m_val);
}
- else if (c_oserct_chartspaceLANG === type) {
- oNewVal = { m_val: null };
+ else if (c_oserct_scalingORIENTATION === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TextLanguageID(t, l, oNewVal);
+ return oThis.ReadCT_Orientation(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLang(oNewVal.m_val);
+ val.setOrientation(oNewVal.m_val);
}
- else if (c_oserct_chartspaceROUNDEDCORNERS === type) {
- oNewVal = { m_val: null };
+ else if (c_oserct_scalingMAX === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setRoundedCorners(oNewVal.m_val);
+ val.setMax(oNewVal.m_val);
}
- else if (c_oserct_chartspaceALTERNATECONTENT === type) {
- oNewVal = {};
+ else if (c_oserct_scalingMIN === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadAlternateContent(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
- var nNewStyle = null;
- if (null != oNewVal.m_Choice && oNewVal.m_Choice.length > 0) {
- var choice = oNewVal.m_Choice[0];
- if (null != choice.m_style && null != choice.m_style.m_val)
- nNewStyle = choice.m_style.m_val - 100;
- }
- if (null == nNewStyle && null != oNewVal.m_Fallback && null != oNewVal.m_Fallback.m_style && null != oNewVal.m_Fallback.m_style.m_val)
- nNewStyle = oNewVal.m_Fallback.m_style.m_val;
- if (null != nNewStyle)
- val.setStyle(nNewStyle);
+ if (null != oNewVal.m_val)
+ val.setMin(oNewVal.m_val);
}
- else if (c_oserct_chartspaceSTYLE === type) {
- oNewVal = { m_val: null };
+ else if (c_oserct_scalingEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Style1(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setStyle(oNewVal.m_val);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_chartspaceCLRMAPOVR === type) {
- val.setClrMapOvr(this.ReadClrOverride(length));
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_LogBase = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_logbaseVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetDoubleLE();
+ val.m_val = oNewVal;
}
- else if (c_oserct_chartspacePIVOTSOURCE === type) {
- oNewVal = new AscFormat.CPivotSource();
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Orientation = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_orientationVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_orientationMAXMIN: val.m_val = AscFormat.ORIENTATION_MAX_MIN; break;
+ case st_orientationMINMAX: val.m_val = AscFormat.ORIENTATION_MIN_MAX; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_AxPos = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_axposVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_axposB: val.m_val = AscFormat.AX_POS_B; break;
+ case st_axposL: val.m_val = AscFormat.AX_POS_L; break;
+ case st_axposR: val.m_val = AscFormat.AX_POS_R; break;
+ case st_axposT: val.m_val = AscFormat.AX_POS_T; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartLines = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_chartlinesSPPR === type) {
+ val.spPr = this.ReadSpPr(length);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Title = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_titleTX === type) {
+ var oNewVal = new AscFormat.CChartText();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PivotSource(t, l, oNewVal);
+ return oThis.ReadCT_Tx(t, l, oNewVal);
});
- val.setPivotSource(oNewVal);
+ oNewVal.setChart(this.curChart);
+ val.setTx(oNewVal);
}
- else if (c_oserct_chartspacePROTECTION === type) {
- oNewVal = new AscFormat.CProtection();
+ else if (c_oserct_titleLAYOUT === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Protection(t, l, oNewVal);
+ return oThis.ReadCT_Layout(t, l, val);
});
- val.setProtection(oNewVal);
}
- else if (c_oserct_chartspaceCHART === type) {
- oNewVal = new AscFormat.CChart();
+ else if (c_oserct_titleOVERLAY === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Chart(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setChart(oNewVal);
- // if(null === oNewVal.autoTitleDeleted){
- // oNewVal.setAutoTitleDeleted(false);
- // }
- }
- else if (c_oserct_chartspaceSPPR === type) {
+ if (null != oNewVal.m_val)
+ val.setOverlay(oNewVal.m_val);
+ }
+ else if (c_oserct_titleSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
- val.spPr.setParent(val);
}
- else if (c_oserct_chartspaceTXPR === type) {
+ else if (c_oserct_titleTXPR === type) {
val.setTxPr(this.ReadTxPr(length));
val.txPr.setParent(val);
}
- //else if (c_oserct_chartspaceEXTERNALDATA === type) {
- // oNewVal;
- // oNewVal = {};
- // res = this.bcr.Read1(length, function (t, l) {
- // return oThis.ReadCT_ExternalData(t, l, oNewVal);
- // });
- // val.m_externalData = oNewVal;
- //}
- else if (c_oserct_chartspacePRINTSETTINGS === type) {
- oNewVal = new AscFormat.CPrintSettings();
+ else if (c_oserct_titleALIGN === type) {
+ val.setAlign(this.stream.GetUChar());
+ }
+ else if (c_oserct_titleEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PrintSettings(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- val.setPrintSettings(oNewVal);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_chartspaceUSERSHAPES === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UserShapes(t, l, val);
- });
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Tx = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_txRICH === type) {
+ val.setRich(this.ReadTxPr(length));
+ val.rich.setParent(val);
}
- else if (c_oserct_chartspaceEXTLST === type) {
+ else if (c_oserct_txSTRREF === type) {
+ var oNewVal = new AscFormat.CStrRef();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_StrRef(t, l, oNewVal);
+ });
+ val.setStrRef(oNewVal);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_StrRef = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_strrefF === type) {
+ val.setF(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_strrefSTRCACHE === type) {
+ var oNewVal = new AscFormat.CStrCache();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_StrData(t, l, oNewVal);
+ });
+ val.setStrCache(oNewVal);
+ }
+ else if (c_oserct_strrefEXTLST === type) {
+ var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
- else if (c_oserct_chartspaceTHEMEOVERRIDE === type) {
- var theme = AscCommon.pptx_content_loader.ReadTheme(this, this.stream);
- if (null != theme)
- val.setThemeOverride(theme);
- }
- else if(c_oserct_chartspaceXLSX === type) {
- //todo
+ else
res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_StrData = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_strdataPTCOUNT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setPtCount(oNewVal.m_val);
}
- else if(c_oserct_chartspaceSTYLES === type) {
- oNewVal = new AscFormat.CChartStyle();
+ else if (c_oserct_strdataPT === type) {
+ var oNewVal = new AscFormat.CStringPoint();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartStyle(t, l, oNewVal);
+ return oThis.ReadCT_StrVal(t, l, oNewVal);
});
- if(oNewVal) {
- val.setChartStyle(oNewVal);
- }
+ val.addPt(oNewVal);
}
- else if(c_oserct_chartspaceCOLORS === type) {
- oNewVal = new AscFormat.CChartColors();
+ else if (c_oserct_strdataEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartColors(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- if(oNewVal) {
- val.setChartColors(oNewVal);
- }
+ // val.m_extLst = oNewVal;
}
- else {
+ else
res = c_oSerConstants.ReadUnknown;
- }
return res;
};
-BinaryChartReader.prototype.ReadSpPr = function (length) {
- return AscCommon.pptx_content_loader.ReadShapeProperty(this.stream);
-};
-
-BinaryChartReader.prototype.ReadClrOverride = function(lenght)
-{
- var loader = new AscCommon.BinaryPPTYLoader();
-
- loader.stream = new AscCommon.FileStream();
- loader.stream.obj = this.stream.obj;
- loader.stream.data = this.stream.data;
- loader.stream.size = this.stream.size;
-
- loader.stream.pos = this.stream.pos;
- loader.stream.cur = this.stream.cur;
- var s = loader.stream;
- var _main_type = s.GetUChar(); // 0!!!
-
- var clr_map = new AscFormat.ClrMap();
- loader.ReadClrMap(clr_map);
-
- this.stream.pos = s.pos;
- this.stream.cur = s.cur;
- return clr_map;
-
-};
-
-BinaryChartReader.prototype.ReadTxPr = function (length) {
- var cur = this.stream.cur;
- var ret = AscCommon.pptx_content_loader.ReadTextBody(null, this.stream, null, this.curWorksheet, this.drawingDocument);
- this.stream.cur = cur + length;
- return ret;
+BinaryChartReader.prototype.ReadCT_StrVal = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_strvalV === type) {
+ val.setVal(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_strvalIDX === type) {
+ val.setIdx(this.stream.GetULongLE());
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
};
-BinaryChartReader.prototype.ParsePersent = function (val) {
- var nVal = parseFloat(val);
- if (!isNaN(nVal))
- return nVal;
+BinaryChartReader.prototype.ReadCT_NumFmt = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_numfmtFORMATCODE === type) {
+ val.setFormatCode(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_numfmtSOURCELINKED === type) {
+ val.setSourceLinked(this.stream.GetBool());
+ }
else
- return null;
+ res = c_oSerConstants.ReadUnknown;
+ return res;
};
-BinaryChartReader.prototype.ParseMetric = function (val) {
- var nVal = parseFloat(val);
- var nRes = null;
- if (!isNaN(nVal)) {
- if (-1 != val.indexOf("mm"))
- nRes = nVal;
- else if (-1 != val.indexOf("cm"))
- nRes = nVal * 10;
- else if (-1 != val.indexOf("in"))
- nRes = nVal * 2.54 * 10;
- else if (-1 != val.indexOf("pt"))
- nRes = nVal * 2.54 * 10 / 72;
- else if (-1 != val.indexOf("pc") || -1 != val.indexOf("pi"))
- nRes = nVal * 12 * 2.54 * 10 / 72;
+BinaryChartReader.prototype.ReadCT_TickMark = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_tickmarkVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_tickmarkCROSS: val.m_val = c_oAscTickMark.TICK_MARK_CROSS; break;
+ case st_tickmarkIN: val.m_val = c_oAscTickMark.TICK_MARK_IN; break;
+ case st_tickmarkNONE: val.m_val = c_oAscTickMark.TICK_MARK_NONE; break;
+ case st_tickmarkOUT: val.m_val = c_oAscTickMark.TICK_MARK_OUT; break;
+ }
}
- return nRes;
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
};
-BinaryChartReader.prototype.CorrectChartWithAxis = function (chartOld, chartNew, aChartWithAxis) {
- for (var i = 0, length = aChartWithAxis.length; i < length; ++i) {
- var item = aChartWithAxis[i];
- if (item.chart == chartOld)
- item.chart = chartNew;
+BinaryChartReader.prototype.ReadCT_TickLblPos = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_ticklblposVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_ticklblposHIGH: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH; break;
+ case st_ticklblposLOW: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW; break;
+ case st_ticklblposNEXTTO: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO; break;
+ case st_ticklblposNONE: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE; break;
+ }
}
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
};
-BinaryChartReader.prototype.ReadCT_Boolean = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Crosses = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_booleanVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetBool();
- val.m_val = oNewVal;
+ if (c_oserct_crossesVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_crossesAUTOZERO: val.m_val = AscFormat.CROSSES_AUTO_ZERO; break;
+ case st_crossesMAX: val.m_val = AscFormat.CROSSES_MAX; break;
+ case st_crossesMIN: val.m_val = AscFormat.CROSSES_MIN; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ExternalReadCT_RelId = function (length, val) {
+BinaryChartReader.prototype.ReadCT_Skip = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_RelId(t, l, val);
- });
+ if (c_oserct_skipVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetULongLE();
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_RelId = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_TimeUnit = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_relidID === type) {
- //todo
- var oNewVal;
- oNewVal = this.stream.GetString2LE(length);
- val.m_id = oNewVal;
+ if (c_oserct_timeunitVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_timeunitDAYS: val.m_val = AscFormat.TIME_UNIT_DAYS; break;
+ case st_timeunitMONTHS: val.m_val = AscFormat.TIME_UNIT_MONTHS; break;
+ case st_timeunitYEARS: val.m_val = AscFormat.TIME_UNIT_YEARS; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_UserShapes = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_DateAx = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- var nCount;
- if (c_oserct_usershapes_COUNT === type) {
- nCount = this.stream.GetULongLE();
- }
- else if(c_oserct_usershapes_SHAPE_REL){
- var oNewVal = new AscFormat.CRelSizeAnchor();
+ if (c_oserct_dateaxAXID === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_userShape(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- val.addUserShape(undefined, oNewVal);
+ if (null != oNewVal.m_val)
+ val.setAxId(oNewVal.m_val);
}
- else if(c_oserct_usershapes_SHAPE_ABS){
- var oNewVal = new AscFormat.CAbsSizeAnchor();
+ else if (c_oserct_dateaxSCALING === type) {
+ var oNewVal = new AscFormat.CScaling();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_userShape(t, l, oNewVal);
+ return oThis.ReadCT_Scaling(t, l, oNewVal);
});
- val.addUserShape(undefined, oNewVal);
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-
-BinaryChartReader.prototype.ReadCT_ChartStyle = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- var oNewVal;
- if(c_oserct_chartstyleID === type) {
- val.setId(this.stream.GetULongLE());
+ val.setScaling(oNewVal);
}
- else if (c_oserct_chartstyleENTRY === type) {
- oNewVal = new AscFormat.CStyleEntry();
+ else if (c_oserct_dateaxDELETE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StyleEntry(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if(res === c_oSerConstants.ReadOk) {
- val.addEntry(oNewVal);
- }
+ if (null != oNewVal.m_val)
+ val.setDelete(oNewVal.m_val);
+ else
+ val.setDelete(true);
}
- else if (c_oserct_chartstyleMARKERLAYOUT === type) {
- oNewVal = new AscFormat.CMarkerLayout();
+ else if (c_oserct_dateaxAXPOS === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_MarkerLayout(t, l, oNewVal);
+ return oThis.ReadCT_AxPos(t, l, oNewVal);
});
- if(res === c_oSerConstants.ReadOk) {
- val.setMarkerLayout(oNewVal);
- }
+ if (null != oNewVal.m_val)
+ val.setAxPos(oNewVal.m_val);
}
- else {
- res = c_oSerConstants.ReadUnknown;
+ else if (c_oserct_dateaxMAJORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMajorGridlines(oNewVal.spPr);
+ else
+ val.setMajorGridlines(new AscFormat.CSpPr());
}
- return res;
-};
-BinaryChartReader.prototype.ReadCT_StyleEntry = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oNewVal;
- if (c_oserct_chartstyleENTRYTYPE == type)
- {
- val.setType(this.stream.GetUChar());
+ else if (c_oserct_dateaxMINORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMinorGridlines(oNewVal.spPr);
+ else
+ val.setMinorGridlines(new AscFormat.CSpPr());
}
- else if (c_oserct_chartstyleLNREF == type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadStyleRef(this, this.stream);
- if(oNewVal)
+ else if (c_oserct_dateaxTITLE === type) {
+ var oNewVal = new AscFormat.CTitle();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Title(t, l, oNewVal);
+ });
+ if(!AscFormat.isRealBool(oNewVal.overlay))
{
- val.setLnRef(oNewVal);
+ oNewVal.setOverlay(false);
}
+ val.setTitle(oNewVal);
}
- else if (c_oserct_chartstyleFILLREF == type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadStyleRef(this, this.stream);
- if(oNewVal)
- {
- val.setFillRef(oNewVal);
- }
+ else if (c_oserct_dateaxNUMFMT === type) {
+ var oNewVal = new AscFormat.CNumFmt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumFmt(t, l, oNewVal);
+ });
+ val.setNumFmt(oNewVal);
}
- else if (c_oserct_chartstyleEFFECTREF == type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadStyleRef(this, this.stream);
- if(oNewVal)
- {
- val.setEffectRef(oNewVal);
+ else if (c_oserct_dateaxMAJORTICKMARK === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setMajorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
}
}
- else if (c_oserct_chartstyleFONTREF == type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadFontRef(this, this.stream);
- if(oNewVal)
- {
- val.setFontRef(oNewVal);
+ else if (c_oserct_dateaxMINORTICKMARK === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setMinorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
}
}
- else if (c_oserct_chartstyleDEFPR == type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadRunProperties(this.stream, 0);
- if(oNewVal)
- {
- val.setDefRPr(oNewVal);
- }
+ else if (c_oserct_dateaxTICKLBLPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickLblPos(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setTickLblPos(oNewVal.m_val);
}
- else if (c_oserct_chartstyleBODYPR == type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadBodyPr(this, this.stream);
- if(oNewVal)
+ else if (c_oserct_dateaxSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_dateaxTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_dateaxCROSSAX === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+
+ if (null != oNewVal.m_val)
{
- val.setBodyPr(oNewVal);
+ val.crossAxId = oNewVal.m_val;
}
}
- else if (c_oserct_chartstyleSPPR == type)
- {
- val.setSpPr(this.ReadSpPr(length));
+ else if (c_oserct_dateaxCROSSES === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Crosses(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setCrosses(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxCROSSESAT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setCrossesAt(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxAUTO === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setAuto(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxLBLOFFSET === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LblOffset(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setLblOffset(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxBASETIMEUNIT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TimeUnit(t, l, oNewVal);
+ });
+ // if (null != oNewVal.m_val) {
+ // val.setMinorTimeUnit(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxMAJORUNIT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_AxisUnit(t, l, oNewVal);
+ });
+ // if (null != oNewVal.m_val)
+ // val.setMajorUnit(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxMAJORTIMEUNIT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TimeUnit(t, l, oNewVal);
+ });
+ // if (null != oNewVal.m_val) {
+ // val.setMinorTimeUnit(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxMINORUNIT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_AxisUnit(t, l, oNewVal);
+ });
+ // if (null != oNewVal.m_val)
+ // val.setMinorUnit(oNewVal.m_val);
+ }
+ else if (c_oserct_dateaxMINORTIMEUNIT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TimeUnit(t, l, oNewVal);
+ });
+ // if (null != oNewVal.m_val)
+ // val.setMinorTimeUnit(oNewVal.m_val);
}
- else if (c_oserct_chartstyleLINEWIDTH == type)
- {
- val.setLineWidthScale(this.stream.GetDoubleLE());
+ else if (c_oserct_dateaxEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
}
else
- {
res = c_oSerConstants.ReadUnknown;
- }
return res;
};
-BinaryChartReader.prototype.ReadCT_MarkerLayout = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_LblOffset = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_chartstyleMARKERSYMBOL == type)
- {
- val.setSymbol(this.MarkerStyleToFormat(this.stream.GetUChar()));
- }
- else if (c_oserct_chartstyleMARKERSIZE == type)
- {
- val.setSize(this.stream.GetULongLE());
+ if (c_oserct_lbloffsetVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
else
- {
res = c_oSerConstants.ReadUnknown;
- }
return res;
};
-BinaryChartReader.prototype.ReadCT_ChartColors = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_AxisUnit = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- var oNewVal;
- if (c_oserct_chartcolorsID === type)
- {
- val.setId(this.stream.GetULongLE());
- }
- else if (c_oserct_chartcolorsMETH === type)
- {
- val.setMeth(this.stream.GetString2LE(length));
- }
- else if(c_oserct_chartcolorsVARIATION === type)
- {
- oNewVal = new AscFormat.CColorModifiers();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ColorsVariation(t, l, oNewVal);
- });
- val.addItem(oNewVal);
- }
- else if(c_oserct_chartcolorsCOLOR === type)
- {
- oNewVal = AscCommon.pptx_content_loader.ReadUniColor(this, this.stream);
- if(oNewVal)
- {
- val.addItem(oNewVal);
- }
+ if (c_oserct_axisunitVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetDoubleLE();
+ val.m_val = oNewVal;
}
else
- {
res = c_oSerConstants.ReadUnknown;
- }
return res;
};
-BinaryChartReader.prototype.ReadCT_ColorsVariation = function (type, length, val)
-{
+BinaryChartReader.prototype.ReadCT_LblAlgn = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
- if (c_oserct_chartcolorsEFFECT === type)
- {
- var oMod = AscCommon.pptx_content_loader.ReadColorMod(this, this.stream);
- if(oMod)
- {
- val.addMod(oMod);
+ var oThis = this;
+ if (c_oserct_lblalgnVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_lblalgnCTR: val.m_val = AscFormat.LBL_ALG_CTR; break;
+ case st_lblalgnL: val.m_val = AscFormat.LBL_ALG_L; break;
+ case st_lblalgnR: val.m_val = AscFormat.LBL_ALG_R; break;
}
}
else
- {
res = c_oSerConstants.ReadUnknown;
- }
return res;
};
-
-BinaryChartReader.prototype.ReadCT_FromTo = function(type, length, poResult)
-{
+BinaryChartReader.prototype.ReadCT_CatAx = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
- if(Asc.c_oSer_DrawingPosType.X == type)
- {
- poResult.x = this.stream.GetDoubleLE();
- }
- else if(Asc.c_oSer_DrawingPosType.Y == type)
- {
- poResult.y = this.stream.GetDoubleLE();
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_userShape = function(type, length, poResult)
-{
var oThis = this;
-
- var res = c_oSerConstants.ReadOk;
- if(Asc.c_oSer_DrawingType.From == type)
- {
- var oNewVal = {};
- res = this.bcr.Read2Spreadsheet(length, function (t, l) {
- return oThis.ReadCT_FromTo(t, l, oNewVal);
+ if (c_oserct_cataxAXID === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- poResult.setFromTo(oNewVal.x, oNewVal.y, poResult.toX, poResult.toY);
+ if (null != oNewVal.m_val)
+ val.setAxId(oNewVal.m_val);
}
- else if(Asc.c_oSer_DrawingType.To == type)
- {
- var oNewVal = {};
- res = this.bcr.Read2Spreadsheet(length, function (t, l) {
- return oThis.ReadCT_FromTo(t, l, oNewVal);
+ else if (c_oserct_cataxSCALING === type) {
+ var oNewVal = new AscFormat.CScaling();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Scaling(t, l, oNewVal);
});
- poResult.setFromTo( poResult.fromX, poResult.fromY, oNewVal.x, oNewVal.y);
+ val.setScaling(oNewVal);
}
- else if(Asc.c_oSer_DrawingType.Ext == type)
- {
- var oNewVal = {};
- res = this.bcr.Read2Spreadsheet(length, function (t, l) {
- return oThis.ReadCT_FromTo(t, l, oNewVal);
+ else if (c_oserct_cataxDELETE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- poResult.setFromTo( poResult.fromX, poResult.fromY, oNewVal.x, oNewVal.y);
- }
- else if(Asc.c_oSer_DrawingType.pptxDrawing == type)
- {
- var oGraphicObject = AscCommon.pptx_content_loader.ReadGraphicObject(this.stream, this.curWorksheet, this.drawingDocument);
- poResult.setObject(oGraphicObject);
- // oGraphicObject.createTextBody();
- // oGraphicObject.txBody.content.AddText("Test user Shapes");
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_PageSetup = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_pagesetupPAPERSIZE === type) {
- val.setPaperSize(this.stream.GetULongLE());
+ if (null != oNewVal.m_val)
+ val.setDelete(oNewVal.m_val);
+ else
+ val.setDelete(true);
}
- else if (c_oserct_pagesetupPAPERHEIGHT === type) {
- var mm = this.ParseMetric(this.stream.GetString2LE(length));
- if (null != mm)
- val.setPaperHeight(mm);
+ else if (c_oserct_cataxAXPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_AxPos(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setAxPos(oNewVal.m_val);
}
- else if (c_oserct_pagesetupPAPERWIDTH === type) {
- var mm = this.ParseMetric(this.stream.GetString2LE(length));
- if (null != mm)
- val.setPaperWidth(mm);
+ else if (c_oserct_cataxMAJORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMajorGridlines(oNewVal.spPr);
+ else
+ val.setMajorGridlines(new AscFormat.CSpPr());
}
- else if (c_oserct_pagesetupFIRSTPAGENUMBER === type) {
- val.setFirstPageNumber(this.stream.GetULongLE());
+ else if (c_oserct_cataxMINORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMinorGridlines(oNewVal.spPr);
+ else
+ val.setMinorGridlines(new AscFormat.CSpPr());
}
- else if (c_oserct_pagesetupORIENTATION === type) {
- switch (this.stream.GetUChar()) {
- case st_pagesetuporientationDEFAULT: val.setOrientation(AscFormat.PAGE_SETUP_ORIENTATION_DEFAULT); break;
- case st_pagesetuporientationPORTRAIT: val.setOrientation(AscFormat.PAGE_SETUP_ORIENTATION_PORTRAIT); break;
- case st_pagesetuporientationLANDSCAPE: val.setOrientation(AscFormat.PAGE_SETUP_ORIENTATION_LANDSCAPE); break;
+ else if (c_oserct_cataxTITLE === type) {
+ var oNewVal = new AscFormat.CTitle();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Title(t, l, oNewVal);
+ });
+ if(!AscFormat.isRealBool(oNewVal.overlay))
+ {
+ oNewVal.setOverlay(true);
}
+ val.setTitle(oNewVal);
}
- else if (c_oserct_pagesetupBLACKANDWHITE === type) {
- val.setBlackAndWhite(this.stream.GetBool());
- }
- else if (c_oserct_pagesetupDRAFT === type) {
- val.setBlackAndWhite(this.stream.GetBool());
- }
- else if (c_oserct_pagesetupUSEFIRSTPAGENUMBER === type) {
- val.setUseFirstPageNumb(this.stream.GetBool());
- }
- else if (c_oserct_pagesetupHORIZONTALDPI === type) {
- val.setHorizontalDpi(this.stream.GetULongLE());
- }
- else if (c_oserct_pagesetupVERTICALDPI === type) {
- val.setVerticalDpi(this.stream.GetULongLE());
- }
- else if (c_oserct_pagesetupCOPIES === type) {
- val.setCopies(this.stream.GetULongLE());
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_PageMargins = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_pagemarginsL === type) {
- val.setL(this.stream.GetDoubleLE());
- }
- else if (c_oserct_pagemarginsR === type) {
- val.setR(this.stream.GetDoubleLE());
- }
- else if (c_oserct_pagemarginsT === type) {
- val.setT(this.stream.GetDoubleLE());
+ else if (c_oserct_cataxNUMFMT === type) {
+ var oNewVal = new AscFormat.CNumFmt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumFmt(t, l, oNewVal);
+ });
+ val.setNumFmt(oNewVal);
}
- else if (c_oserct_pagemarginsB === type) {
- val.setB(this.stream.GetDoubleLE());
+ else if (c_oserct_cataxMAJORTICKMARK === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setMajorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
+ }
}
- else if (c_oserct_pagemarginsHEADER === type) {
- val.setHeader(this.stream.GetDoubleLE());
+ else if (c_oserct_cataxMINORTICKMARK === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setMinorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
+ }
}
- else if (c_oserct_pagemarginsFOOTER === type) {
- val.setFooter(this.stream.GetDoubleLE());
+ else if (c_oserct_cataxTICKLBLPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_TickLblPos(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setTickLblPos(oNewVal.m_val);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_HeaderFooter = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_headerfooterODDHEADER === type) {
- val.setOddHeader(this.stream.GetString2LE(length));
+ else if (c_oserct_cataxSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_headerfooterODDFOOTER === type) {
- val.setOddFooter(this.stream.GetString2LE(length));
+ else if (c_oserct_cataxTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
}
- else if (c_oserct_headerfooterEVENHEADER === type) {
- val.setEvenHeader(this.stream.GetString2LE(length));
+ else if (c_oserct_cataxCROSSAX === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ {
+ val.crossAxId = oNewVal.m_val;
+ }
}
- else if (c_oserct_headerfooterEVENFOOTER === type) {
- val.setEvenFooter(this.stream.GetString2LE(length));
+ else if (c_oserct_cataxCROSSES === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Crosses(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setCrosses(oNewVal.m_val);
+
}
- else if (c_oserct_headerfooterFIRSTHEADER === type) {
- val.setFirstHeader(this.stream.GetString2LE(length));
+ else if (c_oserct_cataxCROSSESAT === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setCrossesAt(oNewVal.m_val);
}
- else if (c_oserct_headerfooterFIRSTFOOTER === type) {
- val.setFirstFooter(this.stream.GetString2LE(length));
+ else if (c_oserct_cataxAUTO === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setAuto(oNewVal.m_val);
}
- else if (c_oserct_headerfooterALIGNWITHMARGINS === type) {
- val.setAlignWithMargins(this.stream.GetBool());
+ else if (c_oserct_cataxLBLALGN === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LblAlgn(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setLblAlgn(oNewVal.m_val);
}
- else if (c_oserct_headerfooterDIFFERENTODDEVEN === type) {
- val.setDifferentOddEven(this.stream.GetBool());
+ else if (c_oserct_cataxLBLOFFSET === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_LblOffset(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setLblOffset(oNewVal.m_val);
}
- else if (c_oserct_headerfooterDIFFERENTFIRST === type) {
- val.setDifferentFirst(this.stream.GetBool());
+ else if (c_oserct_cataxTICKLBLSKIP === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Skip(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setTickLblSkip(oNewVal.m_val);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_PrintSettings = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_printsettingsHEADERFOOTER === type) {
- var oNewVal = new AscFormat.CHeaderFooterChart();
+ else if (c_oserct_cataxTICKMARKSKIP === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_HeaderFooter(t, l, oNewVal);
+ return oThis.ReadCT_Skip(t, l, oNewVal);
});
- val.setHeaderFooter(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setTickMarkSkip(oNewVal.m_val);
}
- else if (c_oserct_printsettingsPAGEMARGINS === type) {
- var oNewVal = new AscFormat.CPageMarginsChart();
+ else if (c_oserct_cataxNOMULTILVLLBL === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PageMargins(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setPageMargins(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setNoMultiLvlLbl(oNewVal.m_val);
}
- else if (c_oserct_printsettingsPAGESETUP === type) {
- var oNewVal = new AscFormat.CPageSetup();
+ else if (c_oserct_cataxEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PageSetup(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- val.setPageSetup(oNewVal);
+ // val.m_extLst = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ExternalData = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_DispUnitsLbl = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_externaldataAUTOUPDATE === type) {
- var oNewVal;
- oNewVal = {};
+ if (c_oserct_dispunitslblLAYOUT === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Layout(t, l, val);
});
- val.m_autoUpdate = oNewVal;
}
- else if (c_oserct_externaldataID === type) {
- //todo
- var oNewVal;
- oNewVal = this.stream.GetString2LE(length);
- val.m_id = oNewVal;
+ else if (c_oserct_dispunitslblTX === type) {
+ var oNewVal = new AscFormat.CChartText();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Tx(t, l, oNewVal);
+ });
+ oNewVal.setChart(this.curChart);
+ val.setTx(oNewVal);
+ }
+ else if (c_oserct_dispunitslblSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_dispunitslblTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DispBlanksAs = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_BuiltInUnit = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dispblanksasVAL === type) {
+ if (c_oserct_builtinunitVAL === type) {
switch (this.stream.GetUChar()) {
- case st_dispblanksasSPAN: val.m_val = AscFormat.DISP_BLANKS_AS_SPAN; break;
- case st_dispblanksasGAP: val.m_val = AscFormat.DISP_BLANKS_AS_GAP; break;
- case st_dispblanksasZERO: val.m_val = AscFormat.DISP_BLANKS_AS_ZERO; break;
+ case st_builtinunitHUNDREDS: val.m_val = c_oAscValAxUnits.HUNDREDS; break;
+ case st_builtinunitTHOUSANDS: val.m_val = c_oAscValAxUnits.THOUSANDS; break;
+ case st_builtinunitTENTHOUSANDS: val.m_val = c_oAscValAxUnits.TEN_THOUSANDS; break;
+ case st_builtinunitHUNDREDTHOUSANDS: val.m_val = c_oAscValAxUnits.HUNDRED_THOUSANDS; break;
+ case st_builtinunitMILLIONS: val.m_val = c_oAscValAxUnits.MILLIONS; break;
+ case st_builtinunitTENMILLIONS: val.m_val = c_oAscValAxUnits.TEN_MILLIONS; break;
+ case st_builtinunitHUNDREDMILLIONS: val.m_val = c_oAscValAxUnits.HUNDRED_MILLIONS; break;
+ case st_builtinunitBILLIONS: val.m_val = c_oAscValAxUnits.BILLIONS; break;
+ case st_builtinunitTRILLIONS: val.m_val = c_oAscValAxUnits.TRILLIONS; break;
}
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LegendEntry = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_DispUnits = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_legendentryIDX === type) {
+ if (c_oserct_dispunitsBUILTINUNIT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_BuiltInUnit(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ val.setBuiltInUnit(oNewVal.m_val);
}
- else if (c_oserct_legendentryDELETE === type) {
+ else if (c_oserct_dispunitsCUSTUNIT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDelete(oNewVal.m_val);
- else
- val.setDelete(true);
+ val.setCustUnit(oNewVal.m_val);
}
- else if (c_oserct_legendentryTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ else if (c_oserct_dispunitsDISPUNITSLBL === type) {
+ var oNewVal = new AscFormat.CDLbl();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DispUnitsLbl(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDispUnitsLbl(oNewVal);
}
- else if (c_oserct_legendentryEXTLST === type) {
+ else if (c_oserct_dispunitsEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -6756,199 +9318,190 @@ BinaryChartReader.prototype.ReadCT_LegendEntry = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_UnsignedInt = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_unsignedintVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetULongLE();
- val.m_val = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Extension = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_extensionANY === type) {
- var oNewVal;
- oNewVal = this.stream.GetString2LE(length);
- val.m_Any = oNewVal;
- }
- else if (c_oserct_extensionURI === type) {
- var oNewVal;
- oNewVal = this.stream.GetString2LE(length);
- val.m_uri = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_LegendPos = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_CrossBetween = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_legendposVAL === type) {
+ if (c_oserct_crossbetweenVAL === type) {
switch (this.stream.GetUChar()) {
- case st_legendposB: val.m_val = c_oAscChartLegendShowSettings.bottom; break;
- case st_legendposTR: val.m_val = c_oAscChartLegendShowSettings.topRight; break;
- case st_legendposL: val.m_val = c_oAscChartLegendShowSettings.left; break;
- case st_legendposR: val.m_val = c_oAscChartLegendShowSettings.right; break;
- case st_legendposT: val.m_val = c_oAscChartLegendShowSettings.top; break;
+ case st_crossbetweenBETWEEN: val.m_val = AscFormat.CROSS_BETWEEN_BETWEEN; break;
+ case st_crossbetweenMIDCAT: val.m_val = AscFormat.CROSS_BETWEEN_MID_CAT; break;
}
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Legend = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ValAx = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_legendLEGENDPOS === type) {
+ if (c_oserct_valaxAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LegendPos(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLegendPos(oNewVal.m_val);
+ val.setAxId(oNewVal.m_val);
}
- else if (c_oserct_legendLEGENDENTRY === type) {
- var oNewVal = new AscFormat.CLegendEntry();
+ else if (c_oserct_valaxSCALING === type) {
+ var oNewVal = new AscFormat.CScaling();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LegendEntry(t, l, oNewVal);
+ return oThis.ReadCT_Scaling(t, l, oNewVal);
});
- val.addLegendEntry(oNewVal);
+ val.setScaling(oNewVal);
}
- else if (c_oserct_legendLAYOUT === type) {
+ else if (c_oserct_valaxDELETE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Layout(t, l, val);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
+ if (null != oNewVal.m_val)
+ val.setDelete(oNewVal.m_val);
+ else
+ val.setDelete(true);
}
- else if (c_oserct_legendOVERLAY === type) {
+ else if (c_oserct_valaxAXPOS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_AxPos(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setOverlay(oNewVal.m_val);
- }
- else if (c_oserct_legendSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ val.setAxPos(oNewVal.m_val);
}
- else if (c_oserct_legendTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ else if (c_oserct_valaxMAJORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setMajorGridlines(oNewVal.spPr);
+ else
+ val.setMajorGridlines(new AscFormat.CSpPr());
}
- else if (c_oserct_legendEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_valaxMINORGRIDLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ if (null != oNewVal.spPr)
+ val.setMinorGridlines(oNewVal.spPr);
+ else
+ val.setMinorGridlines(new AscFormat.CSpPr());
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Layout = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_layoutMANUALLAYOUT === type) {
- var oNewVal = new AscFormat.CLayout();
+ else if (c_oserct_valaxTITLE === type) {
+ var oNewVal = new AscFormat.CTitle();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ManualLayout(t, l, oNewVal);
+ return oThis.ReadCT_Title(t, l, oNewVal);
});
- val.setLayout(oNewVal);
+ if(!AscFormat.isRealBool(oNewVal.overlay))
+ {
+ oNewVal.setOverlay(true);
+ }
+ val.setTitle(oNewVal);
}
- else if (c_oserct_layoutEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_valaxNUMFMT === type) {
+ var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_NumFmt(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.setNumFmt(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_ManualLayout = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_manuallayoutLAYOUTTARGET === type) {
+ else if (c_oserct_valaxMAJORTICKMARK === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LayoutTarget(t, l, oNewVal);
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLayoutTarget(oNewVal.m_val);
+ val.setMajorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
+ }
}
- else if (c_oserct_manuallayoutXMODE === type) {
+ else if (c_oserct_valaxMINORTICKMARK === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ return oThis.ReadCT_TickMark(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setXMode(oNewVal.m_val);
+ val.setMinorTickMark(oNewVal.m_val);
+ else{
+ val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
+ }
}
- else if (c_oserct_manuallayoutYMODE === type) {
+ else if (c_oserct_valaxTICKLBLPOS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ return oThis.ReadCT_TickLblPos(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setYMode(oNewVal.m_val);
+ val.setTickLblPos(oNewVal.m_val);
}
- else if (c_oserct_manuallayoutWMODE === type) {
+ else if (c_oserct_valaxSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_valaxTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_valaxCROSSAX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setWMode(oNewVal.m_val);
+ {
+ val.crossAxId = oNewVal.m_val;
+ }
}
- else if (c_oserct_manuallayoutHMODE === type) {
+ else if (c_oserct_valaxCROSSES === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LayoutMode(t, l, oNewVal);
+ return oThis.ReadCT_Crosses(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setHMode(oNewVal.m_val);
+ val.setCrosses(oNewVal.m_val);
+ else
+ val.setCrosses(AscFormat.CROSSES_AUTO_ZERO);
}
- else if (c_oserct_manuallayoutX === type) {
+ else if (c_oserct_valaxCROSSESAT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Double(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setX(oNewVal.m_val);
+ val.setCrossesAt(oNewVal.m_val);
}
- else if (c_oserct_manuallayoutY === type) {
+ else if (c_oserct_valaxCROSSBETWEEN === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_CrossBetween(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setY(oNewVal.m_val);
+ val.setCrossBetween(oNewVal.m_val);
}
- else if (c_oserct_manuallayoutW === type) {
+ else if (c_oserct_valaxMAJORUNIT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_AxisUnit(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setW(oNewVal.m_val);
+ val.setMajorUnit(oNewVal.m_val);
}
- else if (c_oserct_manuallayoutH === type) {
+ else if (c_oserct_valaxMINORUNIT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_AxisUnit(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setH(oNewVal.m_val);
+ val.setMinorUnit(oNewVal.m_val);
}
- else if (c_oserct_manuallayoutEXTLST === type) {
+ else if (c_oserct_valaxDISPUNITS === type) {
+ var oNewVal = new AscFormat.CDispUnits();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DispUnits(t, l, oNewVal);
+ });
+ val.setDispUnits(oNewVal);
+ }
+ else if (c_oserct_valaxEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -6960,253 +9513,246 @@ BinaryChartReader.prototype.ReadCT_ManualLayout = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LayoutTarget = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_SizeRepresents = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_layouttargetVAL === type) {
+ if (c_oserct_sizerepresentsVAL === type) {
switch (this.stream.GetUChar()) {
- case st_layouttargetINNER: val.m_val = LAYOUT_TARGET_INNER; break;
- case st_layouttargetOUTER: val.m_val = LAYOUT_TARGET_OUTER; break;
+ case st_sizerepresentsAREA: val.m_val = SIZE_REPRESENTS_AREA; break;
+ case st_sizerepresentsW: val.m_val = SIZE_REPRESENTS_W; break;
}
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LayoutMode = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_BubbleScale = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_layoutmodeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_layoutmodeEDGE: val.m_val = LAYOUT_MODE_EDGE; break;
- case st_layoutmodeFACTOR: val.m_val = LAYOUT_MODE_FACTOR; break;
- }
+ if (c_oserct_bubblescaleVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Double = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_BubbleSer = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_doubleVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetDoubleLE();
- val.m_val = oNewVal;
+ if (c_oserct_bubbleserIDX === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setIdx(oNewVal.m_val);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_DTable = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_dtableSHOWHORZBORDER === type) {
+ else if (c_oserct_bubbleserORDER === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setOrder(oNewVal.m_val);
+ }
+ else if (c_oserct_bubbleserTX === type) {
+ var oNewVal = new AscFormat.CTx();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_SerTx(t, l, oNewVal);
+ });
+ val.setTx(oNewVal);
+ }
+ else if (c_oserct_bubbleserSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_bubbleserINVERTIFNEGATIVE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setInvertIfNegative(oNewVal.m_val);
+ }
+ else if (c_oserct_bubbleserDPT === type) {
+ var oNewVal = new AscFormat.CDPt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DPt(t, l, oNewVal);
+ });
+ val.addDPt(oNewVal);
+ }
+ else if (c_oserct_bubbleserDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
+ }
+ else if (c_oserct_bubbleserTRENDLINE === type) {
+ //todo array
+ var oNewVal = new AscFormat.CTrendLine();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Trendline(t, l, oNewVal);
+ });
+ val.setTrendline(oNewVal);
+ }
+ else if (c_oserct_bubbleserERRBARS === type) {
+ var oNewVal = new AscFormat.CErrBars();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ErrBars(t, l, oNewVal);
+ });
+ val.addErrBars(oNewVal);
+ }
+ else if (c_oserct_bubbleserXVAL === type) {
+ var oNewVal = new AscFormat.CCat();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowHorzBorder(oNewVal.m_val);
+ val.setXVal(oNewVal);
}
- else if (c_oserct_dtableSHOWVERTBORDER === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_bubbleserYVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowVertBorder(oNewVal.m_val);
+ val.setYVal(oNewVal);
}
- else if (c_oserct_dtableSHOWOUTLINE === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_bubbleserBUBBLESIZE === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowOutline(oNewVal.m_val);
+ val.setBubbleSize(oNewVal);
}
- else if (c_oserct_dtableSHOWKEYS === type) {
+ else if (c_oserct_bubbleserBUBBLE3D === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setShowKeys(oNewVal.m_val);
- }
- else if (c_oserct_dtableSPPR === type) {
- val.setSpPr(this.ReadSpPr(length))
- }
- else if (c_oserct_dtableTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ val.setBubble3D(oNewVal.m_val);
}
- else if (c_oserct_dtableEXTLST === type) {
+ else if (c_oserct_bubbleserEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
+ }
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_SerAx = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_SerTx = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_seraxAXID === type) {
- var oNewVal = { m_val: null };
+ if (c_oserct_sertxSTRREF === type) {
+ var oNewVal = new AscFormat.CStrRef();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_StrRef(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setAxId(oNewVal.m_val);
+ val.setStrRef(oNewVal);
}
- else if (c_oserct_seraxSCALING === type) {
- var oNewVal = new AscFormat.CScaling();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Scaling(t, l, oNewVal);
- });
- val.setScaling(oNewVal);
+ else if (c_oserct_sertxV === type) {
+ val.setVal(this.stream.GetString2LE(length));
}
- else if (c_oserct_seraxDELETE === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DPt = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_dptIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDelete(oNewVal.m_val);
- else
- val.setDelete(true);
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_seraxAXPOS === type) {
+ else if (c_oserct_dptINVERTIFNEGATIVE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxPos(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setAxPos(oNewVal.m_val);
- }
- else if (c_oserct_seraxMAJORGRIDLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setMajorGridlines(oNewVal.spPr);
- else
- val.setMajorGridlines(new AscFormat.CSpPr());
- }
- else if (c_oserct_seraxMINORGRIDLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setMinorGridlines(oNewVal.spPr);
- else
- val.setMinorGridlines(new AscFormat.CSpPr());
- }
- else if (c_oserct_seraxTITLE === type) {
- var oNewVal = new AscFormat.CTitle();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Title(t, l, oNewVal);
- });
- if(!AscFormat.isRealBool(oNewVal.overlay))
- {
- oNewVal.setOverlay(false);
- }
- val.setTitle(oNewVal);
- }
- else if (c_oserct_seraxNUMFMT === type) {
- var oNewVal = new AscFormat.CNumFmt();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumFmt(t, l, oNewVal);
- });
- val.setNumFmt(oNewVal);
+ val.setInvertIfNegative(oNewVal.m_val);
}
- else if (c_oserct_seraxMAJORTICKMARK === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_dptMARKER === type) {
+ var oNewVal = new AscFormat.CMarker();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
+ return oThis.ReadCT_Marker(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setMajorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
+ val.setMarker(oNewVal);
}
- else if (c_oserct_seraxMINORTICKMARK === type) {
+ else if (c_oserct_dptBUBBLE3D === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMinorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
+ val.setBubble3D(oNewVal.m_val);
}
- else if (c_oserct_seraxTICKLBLPOS === type) {
+ else if (c_oserct_dptEXPLOSION === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickLblPos(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setTickLblPos(oNewVal.m_val);
+ val.setExplosion(oNewVal.m_val);
}
- else if (c_oserct_seraxSPPR === type) {
+ else if (c_oserct_dptSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_seraxTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
- }
- else if (c_oserct_seraxCROSSAX === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_dptPICTUREOPTIONS === type) {
+ var oNewVal = new AscFormat.CPictureOptions();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_PictureOptions(t, l, oNewVal);
});
-
- if (null != oNewVal.m_val)
- {
- val.crossAxId = oNewVal.m_val;
- }
+ val.setPictureOptions(oNewVal);
}
- else if (c_oserct_seraxCROSSES === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_dptEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Crosses(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setCrosses(oNewVal.m_val);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_seraxCROSSESAT === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Marker = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_markerSYMBOL === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_MarkerStyle(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCrossesAt(oNewVal.m_val);
+ val.setSymbol(oNewVal.m_val);
}
- else if (c_oserct_seraxTICKLBLSKIP === type) {
+ else if (c_oserct_markerSIZE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Skip(t, l, oNewVal);
+ return oThis.ReadCT_MarkerSize(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setTickLblSkip(oNewVal.m_val);
+ val.setSize(oNewVal.m_val);
}
- else if (c_oserct_seraxTICKMARKSKIP === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Skip(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setTickMarkSkip(oNewVal.m_val);
+ else if (c_oserct_markerSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_seraxEXTLST === type) {
+ else if (c_oserct_markerEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -7218,334 +9764,277 @@ BinaryChartReader.prototype.ReadCT_SerAx = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Scaling = function (type, length, val) {
+BinaryChartReader.prototype.MarkerStyleToFormat = function(markerStyle) {
+
+ var val = null;
+ switch (markerStyle) {
+ case st_markerstyleCIRCLE: val = AscFormat.SYMBOL_CIRCLE; break;
+ case st_markerstyleDASH: val = AscFormat.SYMBOL_DASH; break;
+ case st_markerstyleDIAMOND: val = AscFormat.SYMBOL_DIAMOND; break;
+ case st_markerstyleDOT: val = AscFormat.SYMBOL_DOT; break;
+ case st_markerstyleNONE: val = AscFormat.SYMBOL_NONE; break;
+ case st_markerstylePICTURE: val = AscFormat.SYMBOL_PICTURE; break;
+ case st_markerstylePLUS: val = AscFormat.SYMBOL_PLUS; break;
+ case st_markerstyleSQUARE: val = AscFormat.SYMBOL_SQUARE; break;
+ case st_markerstyleSTAR: val = AscFormat.SYMBOL_STAR; break;
+ case st_markerstyleTRIANGLE: val = AscFormat.SYMBOL_TRIANGLE; break;
+ case st_markerstyleX: val = AscFormat.SYMBOL_X; break;
+ case st_markerstyleAUTO: break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_MarkerStyle = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ if (c_oserct_markerstyleVAL === type) {
+ val.m_val = this.MarkerStyleToFormat(this.stream.GetUChar());
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_MarkerSize = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_scalingLOGBASE === type) {
+ if (c_oserct_markersizeVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetUChar();
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PictureOptions = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_pictureoptionsAPPLYTOFRONT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LogBase(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLogBase(oNewVal.m_val);
+ val.setApplyToFront(oNewVal.m_val);
}
- else if (c_oserct_scalingORIENTATION === type) {
+ else if (c_oserct_pictureoptionsAPPLYTOSIDES === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Orientation(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setOrientation(oNewVal.m_val);
+ val.setApplyToSides(oNewVal.m_val);
}
- else if (c_oserct_scalingMAX === type) {
+ else if (c_oserct_pictureoptionsAPPLYTOEND === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMax(oNewVal.m_val);
+ val.setApplyToEnd(oNewVal.m_val);
}
- else if (c_oserct_scalingMIN === type) {
+ else if (c_oserct_pictureoptionsPICTUREFORMAT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_PictureFormat(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMin(oNewVal.m_val);
+ val.setPictureFormat(oNewVal.m_val);
}
- else if (c_oserct_scalingEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_pictureoptionsPICTURESTACKUNIT === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_PictureStackUnit(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_LogBase = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_logbaseVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetDoubleLE();
- val.m_val = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Orientation = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_orientationVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_orientationMAXMIN: val.m_val = AscFormat.ORIENTATION_MAX_MIN; break;
- case st_orientationMINMAX: val.m_val = AscFormat.ORIENTATION_MIN_MAX; break;
- }
+ if (null != oNewVal.m_val)
+ val.setPictureStackUnit(oNewVal.m_val);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_AxPos = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_PictureFormat = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_axposVAL === type) {
+ if (c_oserct_pictureformatVAL === type) {
switch (this.stream.GetUChar()) {
- case st_axposB: val.m_val = AscFormat.AX_POS_B; break;
- case st_axposL: val.m_val = AscFormat.AX_POS_L; break;
- case st_axposR: val.m_val = AscFormat.AX_POS_R; break;
- case st_axposT: val.m_val = AscFormat.AX_POS_T; break;
+ case st_pictureformatSTRETCH: val.m_val = PICTURE_FORMAT_STACK_STRETCH; break;
+ case st_pictureformatSTACK: val.m_val = PICTURE_FORMAT_STACK; break;
+ case st_pictureformatSTACKSCALE: val.m_val = PICTURE_FORMAT_STACK_SCALE; break;
}
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ChartLines = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_PictureStackUnit = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_chartlinesSPPR === type) {
- val.spPr = this.ReadSpPr(length);
+ if (c_oserct_picturestackunitVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetDoubleLE();
+ val.m_val = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Title = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_DLbls = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_titleTX === type) {
- var oNewVal = new AscFormat.CChartText();
+ if (c_oserct_dlblsDLBL === type) {
+ var oNewVal = new AscFormat.CDLbl();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Tx(t, l, oNewVal);
+ return oThis.ReadCT_DLbl(t, l, oNewVal);
});
- oNewVal.setChart(this.curChart);
- val.setTx(oNewVal);
+ oNewVal.correctValues();
+ val.addDLbl(oNewVal);
}
- else if (c_oserct_titleLAYOUT === type) {
+ else if (c_oserct_dlblsDLBLPOS === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Layout(t, l, val);
+ return oThis.ReadCT_DLblPos(t, l, oNewVal);
});
+ if (null != oNewVal.m_val)
+ val.setDLblPos(oNewVal.m_val);
}
- else if (c_oserct_titleOVERLAY === type) {
+ else if (c_oserct_dlblsDELETE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setOverlay(oNewVal.m_val);
- }
- else if (c_oserct_titleSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
- }
- else if (c_oserct_titleTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ val.setDelete(oNewVal.m_val);
+ else
+ val.setDelete(true);
}
- else if (c_oserct_titleEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_dlblsLEADERLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Tx = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_txRICH === type) {
- val.setRich(this.ReadTxPr(length));
- val.rich.setParent(val);
+ if (null != oNewVal.spPr)
+ val.setLeaderLines(oNewVal.spPr);
+ else
+ val.setLeaderLines(new AscFormat.CSpPr());
}
- else if (c_oserct_txSTRREF === type) {
- var oNewVal = new AscFormat.CStrRef();
+ else if (c_oserct_dlblsNUMFMT === type) {
+ var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrRef(t, l, oNewVal);
+ return oThis.ReadCT_NumFmt(t, l, oNewVal);
});
- val.setStrRef(oNewVal);
+ val.setNumFmt(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_StrRef = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_strrefF === type) {
- val.setF(this.stream.GetString2LE(length));
+ else if (c_oserct_dlblsSEPARATOR === type) {
+ val.setSeparator(this.stream.GetString2LE(length));
}
- else if (c_oserct_strrefSTRCACHE === type) {
- var oNewVal = new AscFormat.CStrCache();
+ else if (c_oserct_dlblsSHOWBUBBLESIZE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrData(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setStrCache(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setShowBubbleSize(oNewVal.m_val);
+ else
+ val.setShowBubbleSize(true);
}
- else if (c_oserct_strrefEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_dlblsSHOWCATNAME === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ if (null != oNewVal.m_val)
+ val.setShowCatName(oNewVal.m_val);
+ else
+ val.setShowCatName(true);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_StrData = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_strdataPTCOUNT === type) {
+ else if (c_oserct_dlblsSHOWLEADERLINES === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setPtCount(oNewVal.m_val);
+ val.setShowLeaderLines(oNewVal.m_val);
+ else
+ val.setShowLeaderLines(true);
}
- else if (c_oserct_strdataPT === type) {
- var oNewVal = new AscFormat.CStringPoint();
+ else if (c_oserct_dlblsSHOWLEGENDKEY === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrVal(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.addPt(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setShowLegendKey(oNewVal.m_val);
+ else
+ val.setShowLegendKey(true);
}
- else if (c_oserct_strdataEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_dlblsSHOWPERCENT === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_StrVal = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_strvalV === type) {
- val.setVal(this.stream.GetString2LE(length));
- }
- else if (c_oserct_strvalIDX === type) {
- val.setIdx(this.stream.GetULongLE());
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_NumFmt = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_numfmtFORMATCODE === type) {
- val.setFormatCode(this.stream.GetString2LE(length));
+ if (null != oNewVal.m_val)
+ val.setShowPercent(oNewVal.m_val);
+ else
+ val.setShowPercent(true);
}
- else if (c_oserct_numfmtSOURCELINKED === type) {
- val.setSourceLinked(this.stream.GetBool());
+ else if (c_oserct_dlblsSHOWSERNAME === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowSerName(oNewVal.m_val);
+ else
+ val.setShowSerName(true);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_TickMark = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_tickmarkVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_tickmarkCROSS: val.m_val = c_oAscTickMark.TICK_MARK_CROSS; break;
- case st_tickmarkIN: val.m_val = c_oAscTickMark.TICK_MARK_IN; break;
- case st_tickmarkNONE: val.m_val = c_oAscTickMark.TICK_MARK_NONE; break;
- case st_tickmarkOUT: val.m_val = c_oAscTickMark.TICK_MARK_OUT; break;
- }
+ else if (c_oserct_dlblsSHOWVAL === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowVal(oNewVal.m_val);
+ else
+ val.setShowVal(true);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_TickLblPos = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_ticklblposVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_ticklblposHIGH: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH; break;
- case st_ticklblposLOW: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW; break;
- case st_ticklblposNEXTTO: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO; break;
- case st_ticklblposNONE: val.m_val = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE; break;
- }
+ else if (c_oserct_dlblsSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Crosses = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_crossesVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_crossesAUTOZERO: val.m_val = AscFormat.CROSSES_AUTO_ZERO; break;
- case st_crossesMAX: val.m_val = AscFormat.CROSSES_MAX; break;
- case st_crossesMIN: val.m_val = AscFormat.CROSSES_MIN; break;
- }
+ else if (c_oserct_dlblsTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Skip = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_skipVAL === type) {
+ else if (c_oserct_dlblsEXTLST === type) {
var oNewVal;
- oNewVal = this.stream.GetULongLE();
- val.m_val = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_TimeUnit = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_timeunitVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_timeunitDAYS: val.m_val = AscFormat.TIME_UNIT_DAYS; break;
- case st_timeunitMONTHS: val.m_val = AscFormat.TIME_UNIT_MONTHS; break;
- case st_timeunitYEARS: val.m_val = AscFormat.TIME_UNIT_YEARS; break;
- }
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DateAx = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_DLbl = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dateaxAXID === type) {
+ if (c_oserct_dlblIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setAxId(oNewVal.m_val);
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_dateaxSCALING === type) {
- var oNewVal = new AscFormat.CScaling();
+ else if (c_oserct_dlblDLBLPOS === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Scaling(t, l, oNewVal);
+ return oThis.ReadCT_DLblPos(t, l, oNewVal);
});
- val.setScaling(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setDLblPos(oNewVal.m_val);
}
- else if (c_oserct_dateaxDELETE === type) {
+ else if (c_oserct_dlblDELETE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
@@ -7555,173 +10044,232 @@ BinaryChartReader.prototype.ReadCT_DateAx = function (type, length, val) {
else
val.setDelete(true);
}
- else if (c_oserct_dateaxAXPOS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_dlblLAYOUT === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxPos(t, l, oNewVal);
+ return oThis.ReadCT_Layout(t, l, val);
});
- if (null != oNewVal.m_val)
- val.setAxPos(oNewVal.m_val);
}
- else if (c_oserct_dateaxMAJORGRIDLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_dlblNUMFMT === type) {
+ var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_NumFmt(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setMajorGridlines(oNewVal.spPr);
- else
- val.setMajorGridlines(new AscFormat.CSpPr());
+ val.setNumFmt(oNewVal);
}
- else if (c_oserct_dateaxMINORGRIDLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_dlblSEPARATOR === type) {
+ val.setSeparator(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_dlblSHOWBUBBLESIZE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setMinorGridlines(oNewVal.spPr);
+ if (null != oNewVal.m_val)
+ val.setShowBubbleSize(oNewVal.m_val);
else
- val.setMinorGridlines(new AscFormat.CSpPr());
+ val.setShowBubbleSize(true);
}
- else if (c_oserct_dateaxTITLE === type) {
- var oNewVal = new AscFormat.CTitle();
+ else if (c_oserct_dlblSHOWCATNAME === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Title(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if(!AscFormat.isRealBool(oNewVal.overlay))
- {
- oNewVal.setOverlay(false);
- }
- val.setTitle(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setShowCatName(oNewVal.m_val);
+ else
+ val.setShowCatName(true);
}
- else if (c_oserct_dateaxNUMFMT === type) {
- var oNewVal = new AscFormat.CNumFmt();
+ else if (c_oserct_dlblSHOWLEGENDKEY === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumFmt(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setNumFmt(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setShowLegendKey(oNewVal.m_val);
+ else
+ val.setShowLegendKey(true);
}
- else if (c_oserct_dateaxMAJORTICKMARK === type) {
+ else if (c_oserct_dlblSHOWPERCENT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMajorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
+ val.setShowPercent(oNewVal.m_val);
+ else
+ val.setShowPercent(true);
}
- else if (c_oserct_dateaxMINORTICKMARK === type) {
+ else if (c_oserct_dlblSHOWSERNAME === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMinorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
+ val.setShowSerName(oNewVal.m_val);
+ else
+ val.setShowSerName(true);
}
- else if (c_oserct_dateaxTICKLBLPOS === type) {
+ else if (c_oserct_dlblSHOWVAL === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickLblPos(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setTickLblPos(oNewVal.m_val);
+ val.setShowVal(oNewVal.m_val);
+ else
+ val.setShowVal(true);
}
- else if (c_oserct_dateaxSPPR === type) {
+ else if (c_oserct_dlblSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_dateaxTXPR === type) {
+ else if (c_oserct_dlblTX === type) {
+ var oNewVal = new AscFormat.CChartText();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Tx(t, l, oNewVal);
+ });
+ oNewVal.setChart(this.curChart);
+ val.setTx(oNewVal);
+ }
+ else if (c_oserct_dlblTXPR === type) {
val.setTxPr(this.ReadTxPr(length));
val.txPr.setParent(val);
}
- else if (c_oserct_dateaxCROSSAX === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_dlblEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else if (c_oserct_dataLabel === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLblExt(t, l, val);
});
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DLblExt = function(type, length, val) {
- if (null != oNewVal.m_val)
- {
- val.crossAxId = oNewVal.m_val;
+ let res = c_oSerConstants.ReadOk;
+ let oThis = this;
+ if (c_oserct_showDataLabelsRange === type) {
+ let oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShowDlblsRange(oNewVal.m_val);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DLblPos = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_dlblposVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_dlblposBESTFIT: val.m_val = c_oAscChartDataLabelsPos.bestFit; break;
+ case st_dlblposB: val.m_val = c_oAscChartDataLabelsPos.b; break;
+ case st_dlblposCTR: val.m_val = c_oAscChartDataLabelsPos.ctr; break;
+ case st_dlblposINBASE: val.m_val = c_oAscChartDataLabelsPos.inBase; break;
+ case st_dlblposINEND: val.m_val = c_oAscChartDataLabelsPos.inEnd; break;
+ case st_dlblposL: val.m_val = c_oAscChartDataLabelsPos.l; break;
+ case st_dlblposOUTEND: val.m_val = c_oAscChartDataLabelsPos.outEnd; break;
+ case st_dlblposR: val.m_val = c_oAscChartDataLabelsPos.r; break;
+ case st_dlblposT: val.m_val = c_oAscChartDataLabelsPos.t; break;
}
}
- else if (c_oserct_dateaxCROSSES === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Trendline = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_trendlineNAME === type) {
+ val.setName(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_trendlineSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_trendlineTRENDLINETYPE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Crosses(t, l, oNewVal);
+ return oThis.ReadCT_TrendlineType(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCrosses(oNewVal.m_val);
+ val.setTrendlineType(oNewVal.m_val);
}
- else if (c_oserct_dateaxCROSSESAT === type) {
+ else if (c_oserct_trendlineORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_Order(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCrossesAt(oNewVal.m_val);
+ val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_dateaxAUTO === type) {
+ else if (c_oserct_trendlinePERIOD === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Period(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setAuto(oNewVal.m_val);
+ val.setPeriod(oNewVal.m_val);
}
- else if (c_oserct_dateaxLBLOFFSET === type) {
+ else if (c_oserct_trendlineFORWARD === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LblOffset(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLblOffset(oNewVal.m_val);
+ val.setForward(oNewVal.m_val);
}
- else if (c_oserct_dateaxBASETIMEUNIT === type) {
+ else if (c_oserct_trendlineBACKWARD === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TimeUnit(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
- // if (null != oNewVal.m_val) {
- // val.setMinorTimeUnit(oNewVal.m_val);
+ if (null != oNewVal.m_val)
+ val.setBackward(oNewVal.m_val);
}
- else if (c_oserct_dateaxMAJORUNIT === type) {
+ else if (c_oserct_trendlineINTERCEPT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxisUnit(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
- // if (null != oNewVal.m_val)
- // val.setMajorUnit(oNewVal.m_val);
+ if (null != oNewVal.m_val)
+ val.setIntercept(oNewVal.m_val);
}
- else if (c_oserct_dateaxMAJORTIMEUNIT === type) {
+ else if (c_oserct_trendlineDISPRSQR === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TimeUnit(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- // if (null != oNewVal.m_val) {
- // val.setMinorTimeUnit(oNewVal.m_val);
+ if (null != oNewVal.m_val)
+ val.setDispRSqr(oNewVal.m_val);
}
- else if (c_oserct_dateaxMINORUNIT === type) {
+ else if (c_oserct_trendlineDISPEQ === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxisUnit(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- // if (null != oNewVal.m_val)
- // val.setMinorUnit(oNewVal.m_val);
+ if (null != oNewVal.m_val)
+ val.setDispEq(oNewVal.m_val);
}
- else if (c_oserct_dateaxMINORTIMEUNIT === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_trendlineTRENDLINELBL === type) {
+ var oNewVal = new AscFormat.CDLbl();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TimeUnit(t, l, oNewVal);
+ return oThis.ReadCT_TrendlineLbl(t, l, oNewVal);
});
- // if (null != oNewVal.m_val)
- // val.setMinorTimeUnit(oNewVal.m_val);
+ oNewVal.correctValues();
+ val.setTrendlineLbl(oNewVal);
}
- else if (c_oserct_dateaxEXTLST === type) {
+ else if (c_oserct_trendlineEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -7733,229 +10281,150 @@ BinaryChartReader.prototype.ReadCT_DateAx = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LblOffset = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_TrendlineType = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_lbloffsetVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ if (c_oserct_trendlinetypeVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_trendlinetypeEXP: val.m_val = TRENDLINE_TYPE_EXP; break;
+ case st_trendlinetypeLINEAR: val.m_val = TRENDLINE_TYPE_LINEAR; break;
+ case st_trendlinetypeLOG: val.m_val = TRENDLINE_TYPE_LOG; break;
+ case st_trendlinetypeMOVINGAVG: val.m_val = TRENDLINE_TYPE_MOVING_AVG; break;
+ case st_trendlinetypePOLY: val.m_val = TRENDLINE_TYPE_POLY; break;
+ case st_trendlinetypePOWER: val.m_val = TRENDLINE_TYPE_POWER; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_AxisUnit = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Order = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_axisunitVAL === type) {
+ if (c_oserct_orderVAL === type) {
var oNewVal;
- oNewVal = this.stream.GetDoubleLE();
+ oNewVal = this.stream.GetUChar();
val.m_val = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LblAlgn = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Period = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_lblalgnVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_lblalgnCTR: val.m_val = AscFormat.LBL_ALG_CTR; break;
- case st_lblalgnL: val.m_val = AscFormat.LBL_ALG_L; break;
- case st_lblalgnR: val.m_val = AscFormat.LBL_ALG_R; break;
- }
+ if (c_oserct_periodVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetULongLE();
+ val.m_val = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_CatAx = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_TrendlineLbl = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_cataxAXID === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setAxId(oNewVal.m_val);
- }
- else if (c_oserct_cataxSCALING === type) {
- var oNewVal = new AscFormat.CScaling();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Scaling(t, l, oNewVal);
- });
- val.setScaling(oNewVal);
- }
- else if (c_oserct_cataxDELETE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setDelete(oNewVal.m_val);
- else
- val.setDelete(true);
- }
- else if (c_oserct_cataxAXPOS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxPos(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setAxPos(oNewVal.m_val);
- }
- else if (c_oserct_cataxMAJORGRIDLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setMajorGridlines(oNewVal.spPr);
- else
- val.setMajorGridlines(new AscFormat.CSpPr());
- }
- else if (c_oserct_cataxMINORGRIDLINES === type) {
- var oNewVal = { spPr: null };
+ if (c_oserct_trendlinelblLAYOUT === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_Layout(t, l, val);
});
- if (null != oNewVal.spPr)
- val.setMinorGridlines(oNewVal.spPr);
- else
- val.setMinorGridlines(new AscFormat.CSpPr());
}
- else if (c_oserct_cataxTITLE === type) {
- var oNewVal = new AscFormat.CTitle();
+ else if (c_oserct_trendlinelblTX === type) {
+ var oNewVal = new AscFormat.CChartText();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Title(t, l, oNewVal);
+ return oThis.ReadCT_Tx(t, l, oNewVal);
});
- if(!AscFormat.isRealBool(oNewVal.overlay))
- {
- oNewVal.setOverlay(true);
- }
- val.setTitle(oNewVal);
+ oNewVal.setChart(this.curChart);
+ val.setTx(oNewVal);
}
- else if (c_oserct_cataxNUMFMT === type) {
+ else if (c_oserct_trendlinelblNUMFMT === type) {
var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_NumFmt(t, l, oNewVal);
});
val.setNumFmt(oNewVal);
}
- else if (c_oserct_cataxMAJORTICKMARK === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setMajorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
- }
- else if (c_oserct_cataxMINORTICKMARK === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setMinorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
- }
- else if (c_oserct_cataxTICKLBLPOS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickLblPos(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setTickLblPos(oNewVal.m_val);
- }
- else if (c_oserct_cataxSPPR === type) {
+ else if (c_oserct_trendlinelblSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_cataxTXPR === type) {
+ else if (c_oserct_trendlinelblTXPR === type) {
val.setTxPr(this.ReadTxPr(length));
val.txPr.setParent(val);
}
- else if (c_oserct_cataxCROSSAX === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- {
- val.crossAxId = oNewVal.m_val;
- }
- }
- else if (c_oserct_cataxCROSSES === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_trendlinelblEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Crosses(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setCrosses(oNewVal.m_val);
-
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_cataxCROSSESAT === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ErrBars = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_errbarsERRDIR === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_ErrDir(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCrossesAt(oNewVal.m_val);
+ val.setErrDir(oNewVal.m_val);
}
- else if (c_oserct_cataxAUTO === type) {
+ else if (c_oserct_errbarsERRBARTYPE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_ErrBarType(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setAuto(oNewVal.m_val);
+ val.setErrBarType(oNewVal.m_val);
}
- else if (c_oserct_cataxLBLALGN === type) {
+ else if (c_oserct_errbarsERRVALTYPE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LblAlgn(t, l, oNewVal);
+ return oThis.ReadCT_ErrValType(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLblAlgn(oNewVal.m_val);
+ val.setErrValType(oNewVal.m_val);
}
- else if (c_oserct_cataxLBLOFFSET === type) {
+ else if (c_oserct_errbarsNOENDCAP === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LblOffset(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setLblOffset(oNewVal.m_val);
+ val.setNoEndCap(oNewVal.m_val);
}
- else if (c_oserct_cataxTICKLBLSKIP === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_errbarsPLUS === type) {
+ var oNewVal = new AscFormat.CMinusPlus();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Skip(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setTickLblSkip(oNewVal.m_val);
+ val.setPlus(oNewVal);
}
- else if (c_oserct_cataxTICKMARKSKIP === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_errbarsMINUS === type) {
+ var oNewVal = new AscFormat.CMinusPlus();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Skip(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setTickMarkSkip(oNewVal.m_val);
+ val.setMinus(oNewVal);
}
- else if (c_oserct_cataxNOMULTILVLLBL === type) {
+ else if (c_oserct_errbarsVAL === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Double(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setNoMultiLvlLbl(oNewVal.m_val);
+ val.setVal(oNewVal.m_val);
}
- else if (c_oserct_cataxEXTLST === type) {
+ else if (c_oserct_errbarsSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_errbarsEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -7967,81 +10436,92 @@ BinaryChartReader.prototype.ReadCT_CatAx = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DispUnitsLbl = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ErrDir = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dispunitslblLAYOUT === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Layout(t, l, val);
- });
- }
- else if (c_oserct_dispunitslblTX === type) {
- var oNewVal = new AscFormat.CChartText();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Tx(t, l, oNewVal);
- });
- oNewVal.setChart(this.curChart);
- val.setTx(oNewVal);
- }
- else if (c_oserct_dispunitslblSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ if (c_oserct_errdirVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_errdirX: val.m_val = ERR_DIR_X; break;
+ case st_errdirY: val.m_val = ERR_DIR_Y; break;
+ }
}
- else if (c_oserct_dispunitslblTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ErrBarType = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_errbartypeVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_errbartypeBOTH: val.m_val = ERR_BAR_TYPE_BOTH; break;
+ case st_errbartypeMINUS: val.m_val = ERR_BAR_TYPE_MINUS; break;
+ case st_errbartypePLUS: val.m_val = ERR_BAR_TYPE_PLUS; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_BuiltInUnit = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ErrValType = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_builtinunitVAL === type) {
+ if (c_oserct_errvaltypeVAL === type) {
switch (this.stream.GetUChar()) {
- case st_builtinunitHUNDREDS: val.m_val = c_oAscValAxUnits.HUNDREDS; break;
- case st_builtinunitTHOUSANDS: val.m_val = c_oAscValAxUnits.THOUSANDS; break;
- case st_builtinunitTENTHOUSANDS: val.m_val = c_oAscValAxUnits.TEN_THOUSANDS; break;
- case st_builtinunitHUNDREDTHOUSANDS: val.m_val = c_oAscValAxUnits.HUNDRED_THOUSANDS; break;
- case st_builtinunitMILLIONS: val.m_val = c_oAscValAxUnits.MILLIONS; break;
- case st_builtinunitTENMILLIONS: val.m_val = c_oAscValAxUnits.TEN_MILLIONS; break;
- case st_builtinunitHUNDREDMILLIONS: val.m_val = c_oAscValAxUnits.HUNDRED_MILLIONS; break;
- case st_builtinunitBILLIONS: val.m_val = c_oAscValAxUnits.BILLIONS; break;
- case st_builtinunitTRILLIONS: val.m_val = c_oAscValAxUnits.TRILLIONS; break;
+ case st_errvaltypeCUST: val.m_val = ERR_VAL_TYPE_CUST; break;
+ case st_errvaltypeFIXEDVAL: val.m_val = ERR_VAL_TYPE_FIXED_VAL; break;
+ case st_errvaltypePERCENTAGE: val.m_val = ERR_VAL_TYPE_PERCENTAGE; break;
+ case st_errvaltypeSTDDEV: val.m_val = ERR_VAL_TYPE_STD_DEV; break;
+ case st_errvaltypeSTDERR: val.m_val = ERR_VAL_TYPE_STD_ERR; break;
}
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DispUnits = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_NumDataSource = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dispunitsBUILTINUNIT === type) {
- var oNewVal = { m_val: null };
+ if (c_oserct_numdatasourceNUMLIT === type) {
+ var oNewVal = new AscFormat.CNumLit();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BuiltInUnit(t, l, oNewVal);
+ return oThis.ReadCT_NumData(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setBuiltInUnit(oNewVal.m_val);
+ val.setNumLit(oNewVal);
}
- else if (c_oserct_dispunitsCUSTUNIT === type) {
+ else if (c_oserct_numdatasourceNUMREF === type) {
+ var oNewVal = new AscFormat.CNumRef();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumRef(t, l, oNewVal);
+ });
+ val.setNumRef(oNewVal);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_NumData = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_numdataFORMATCODE === type) {
+ val.setFormatCode(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_numdataPTCOUNT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCustUnit(oNewVal.m_val);
+ val.setPtCount(oNewVal.m_val);
}
- else if (c_oserct_dispunitsDISPUNITSLBL === type) {
- var oNewVal = new AscFormat.CDLbl();
+ else if (c_oserct_numdataPT === type) {
+ var oNewVal = new AscFormat.CNumericPoint();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DispUnitsLbl(t, l, oNewVal);
+ return oThis.ReadCT_NumVal(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDispUnitsLbl(oNewVal);
+ val.addPt(oNewVal);
}
- else if (c_oserct_dispunitsEXTLST === type) {
+ else if (c_oserct_numdataEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -8053,192 +10533,227 @@ BinaryChartReader.prototype.ReadCT_DispUnits = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_CrossBetween = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_NumVal = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_crossbetweenVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_crossbetweenBETWEEN: val.m_val = AscFormat.CROSS_BETWEEN_BETWEEN; break;
- case st_crossbetweenMIDCAT: val.m_val = AscFormat.CROSS_BETWEEN_MID_CAT; break;
- }
+ if (c_oserct_numvalV === type) {
+ var nVal = parseFloat(this.stream.GetString2LE(length));
+ if(isNaN(nVal))
+ nVal = 0;
+ val.setVal(nVal);
+ }
+ else if (c_oserct_numvalIDX === type) {
+ val.setIdx(this.stream.GetULongLE());
+ }
+ else if (c_oserct_numvalFORMATCODE === type) {
+ val.setFormatCode(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ValAx = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_NumRef = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_valaxAXID === type) {
- var oNewVal = { m_val: null };
+ if (c_oserct_numrefF === type) {
+ val.setF(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_numrefNUMCACHE === type) {
+ var oNewVal = new AscFormat.CNumLit();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_NumData(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setAxId(oNewVal.m_val);
+ val.setNumCache(oNewVal);
}
- else if (c_oserct_valaxSCALING === type) {
- var oNewVal = new AscFormat.CScaling();
+ else if (c_oserct_numrefEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Scaling(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- val.setScaling(oNewVal);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_valaxDELETE === type) {
- var oNewVal = { m_val: null };
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_AxDataSource = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_axdatasourceMULTILVLSTRREF === type) {
+ var oNewVal = new AscFormat.CMultiLvlStrRef();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_MultiLvlStrRef(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setDelete(oNewVal.m_val);
- else
- val.setDelete(true);
+ val.setMultiLvlStrRef(oNewVal);
}
- else if (c_oserct_valaxAXPOS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_axdatasourceNUMLIT === type) {
+ var oNewVal = new AscFormat.CNumLit();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxPos(t, l, oNewVal);
+ return oThis.ReadCT_NumData(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setAxPos(oNewVal.m_val);
+ val.setNumLit(oNewVal);
}
- else if (c_oserct_valaxMAJORGRIDLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_axdatasourceNUMREF === type) {
+ var oNewVal = new AscFormat.CNumRef();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_NumRef(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setMajorGridlines(oNewVal.spPr);
- else
- val.setMajorGridlines(new AscFormat.CSpPr());
+ val.setNumRef(oNewVal);
}
- else if (c_oserct_valaxMINORGRIDLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_axdatasourceSTRLIT === type) {
+ var oNewVal = new AscFormat.CStrCache();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_StrData(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setMinorGridlines(oNewVal.spPr);
- else
- val.setMinorGridlines(new AscFormat.CSpPr());
+ val.setStrLit(oNewVal);
}
- else if (c_oserct_valaxTITLE === type) {
- var oNewVal = new AscFormat.CTitle();
+ else if (c_oserct_axdatasourceSTRREF === type) {
+ var oNewVal = new AscFormat.CStrRef();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Title(t, l, oNewVal);
+ return oThis.ReadCT_StrRef(t, l, oNewVal);
});
- if(!AscFormat.isRealBool(oNewVal.overlay))
- {
- oNewVal.setOverlay(true);
- }
- val.setTitle(oNewVal);
+ val.setStrRef(oNewVal);
}
- else if (c_oserct_valaxNUMFMT === type) {
- var oNewVal = new AscFormat.CNumFmt();
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_MultiLvlStrRef = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_multilvlstrrefF === type) {
+ val.setF(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_multilvlstrrefMULTILVLSTRCACHE === type) {
+ var oNewVal = new AscFormat.CMultiLvlStrCache();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_MultiLvlStrData(t, l, oNewVal);
+ });
+ val.setMultiLvlStrCache(oNewVal);
+ }
+ else if (c_oserct_multilvlstrrefEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_lvl = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_lvlPT === type) {
+ var oNewVal = new AscFormat.CStringPoint();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumFmt(t, l, oNewVal);
+ return oThis.ReadCT_StrVal(t, l, oNewVal);
});
- val.setNumFmt(oNewVal);
+ val.addPt(oNewVal);
}
- else if (c_oserct_valaxMAJORTICKMARK === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_MultiLvlStrData = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_multilvlstrdataPTCOUNT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMajorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
+ val.setPtCount(oNewVal.m_val);
}
- else if (c_oserct_valaxMINORTICKMARK === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_multilvlstrdataLVL === type) {
+ var oNewVal = new AscFormat.CStrCache();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickMark(t, l, oNewVal);
+ return oThis.ReadCT_lvl(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setMinorTickMark(oNewVal.m_val);
- else{
- val.setMajorTickMark(c_oAscTickMark.TICK_MARK_CROSS);
- }
+ val.addLvl(oNewVal);
}
- else if (c_oserct_valaxTICKLBLPOS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_multilvlstrdataEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TickLblPos(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setTickLblPos(oNewVal.m_val);
- }
- else if (c_oserct_valaxSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
- }
- else if (c_oserct_valaxTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_valaxCROSSAX === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_BubbleChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_bubblechartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- {
- val.crossAxId = oNewVal.m_val;
- }
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_valaxCROSSES === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_bubblechartSER === type) {
+ var oNewVal = new AscFormat.CBubbleSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Crosses(t, l, oNewVal);
+ return oThis.ReadCT_BubbleSer(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setCrosses(oNewVal.m_val);
- else
- val.setCrosses(AscFormat.CROSSES_AUTO_ZERO);
+ val.addSer(oNewVal);
}
- else if (c_oserct_valaxCROSSESAT === type) {
+ else if (c_oserct_bubblechartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
+ }
+ else if (c_oserct_bubblechartBUBBLE3D === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCrossesAt(oNewVal.m_val);
+ val.setBubble3D(oNewVal.m_val);
}
- else if (c_oserct_valaxCROSSBETWEEN === type) {
+ else if (c_oserct_bubblechartBUBBLESCALE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_CrossBetween(t, l, oNewVal);
+ return oThis.ReadCT_BubbleScale(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setCrossBetween(oNewVal.m_val);
+ val.setBubbleScale(oNewVal.m_val);
}
- else if (c_oserct_valaxMAJORUNIT === type) {
+ else if (c_oserct_bubblechartSHOWNEGBUBBLES === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxisUnit(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMajorUnit(oNewVal.m_val);
+ val.setShowNegBubbles(oNewVal.m_val);
}
- else if (c_oserct_valaxMINORUNIT === type) {
+ else if (c_oserct_bubblechartSIZEREPRESENTS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxisUnit(t, l, oNewVal);
+ return oThis.ReadCT_SizeRepresents(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setMinorUnit(oNewVal.m_val);
+ val.setSizeRepresents(oNewVal.m_val);
}
- else if (c_oserct_valaxDISPUNITS === type) {
- var oNewVal = new AscFormat.CDispUnits();
+ else if (c_oserct_bubblechartAXID === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DispUnits(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- val.setDispUnits(oNewVal);
+ if (null != oNewVal.m_val)
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_valaxEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_bubblechartEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
@@ -8248,33 +10763,66 @@ BinaryChartReader.prototype.ReadCT_ValAx = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_SizeRepresents = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_bandFmts = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_sizerepresentsVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_sizerepresentsAREA: val.m_val = SIZE_REPRESENTS_AREA; break;
- case st_sizerepresentsW: val.m_val = SIZE_REPRESENTS_W; break;
- }
+ if (c_oserct_bandfmtsBANDFMT === type) {
+ var oNewVal = new AscFormat.CBandFmt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_BandFmt(t, l, oNewVal);
+ });
+ val.addBandFmt(oNewVal);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_BubbleScale = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Surface3DChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_bubblescaleVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ if (c_oserct_surface3dchartWIREFRAME === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setWireframe(oNewVal.m_val);
+ }
+ else if (c_oserct_surface3dchartSER === type) {
+ var oNewVal = new AscFormat.CSurfaceSeries();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_SurfaceSer(t, l, oNewVal);
+ });
+ val.addSer(oNewVal);
+ }
+ else if (c_oserct_surface3dchartBANDFMTS === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_bandFmts(t, l, val);
+ });
+ }
+ else if (c_oserct_surface3dchartAXID === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val, surface: true });
+ }
+ else if (c_oserct_surface3dchartEXTLST === type) {
+ var oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_BubbleSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_SurfaceSer = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_bubbleserIDX === type) {
+ if (c_oserct_surfaceserIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -8282,7 +10830,7 @@ BinaryChartReader.prototype.ReadCT_BubbleSer = function (type, length, val) {
if (null != oNewVal.m_val)
val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_bubbleserORDER === type) {
+ else if (c_oserct_surfaceserORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -8290,84 +10838,96 @@ BinaryChartReader.prototype.ReadCT_BubbleSer = function (type, length, val) {
if (null != oNewVal.m_val)
val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_bubbleserTX === type) {
+ else if (c_oserct_surfaceserTX === type) {
var oNewVal = new AscFormat.CTx();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_SerTx(t, l, oNewVal);
});
val.setTx(oNewVal);
}
- else if (c_oserct_bubbleserSPPR === type) {
+ else if (c_oserct_surfaceserSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_bubbleserINVERTIFNEGATIVE === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_surfaceserCAT === type) {
+ var oNewVal = new AscFormat.CCat();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setInvertIfNegative(oNewVal.m_val);
+ val.setCat(oNewVal);
}
- else if (c_oserct_bubbleserDPT === type) {
- var oNewVal = new AscFormat.CDPt();
+ else if (c_oserct_surfaceserVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DPt(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- val.addDPt(oNewVal);
+ val.setVal(oNewVal);
}
- else if (c_oserct_bubbleserDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_surfaceserEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_bubbleserTRENDLINE === type) {
- //todo array
- var oNewVal = new AscFormat.CTrendLine();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Trendline(t, l, oNewVal);
- });
- val.setTrendline(oNewVal);
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
}
- else if (c_oserct_bubbleserERRBARS === type) {
- var oNewVal = new AscFormat.CErrBars();
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_BandFmt = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_bandfmtIDX === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrBars(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- val.addErrBars(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_bubbleserXVAL === type) {
- var oNewVal = new AscFormat.CCat();
+ else if (c_oserct_bandfmtSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_SurfaceChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_surfacechartWIREFRAME === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setXVal(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setWireframe(oNewVal.m_val);
}
- else if (c_oserct_bubbleserYVAL === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_surfacechartSER === type) {
+ var oNewVal = new AscFormat.CSurfaceSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_SurfaceSer(t, l, oNewVal);
});
- val.setYVal(oNewVal);
+ val.addSer(oNewVal);
}
- else if (c_oserct_bubbleserBUBBLESIZE === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_surfacechartBANDFMTS === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_bandFmts(t, l, val);
});
- val.setBubbleSize(oNewVal);
}
- else if (c_oserct_bubbleserBUBBLE3D === type) {
+ else if (c_oserct_surfacechartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setBubble3D(oNewVal.m_val);
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val, surface: true });
}
- else if (c_oserct_bubbleserEXTLST === type) {
+ else if (c_oserct_surfacechartEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -8375,85 +10935,146 @@ BinaryChartReader.prototype.ReadCT_BubbleSer = function (type, length, val) {
});
// val.m_extLst = oNewVal;
}
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_SecondPieSize = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_secondpiesizeVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_SerTx = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_SplitType = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_sertxSTRREF === type) {
- var oNewVal = new AscFormat.CStrRef();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrRef(t, l, oNewVal);
- });
- val.setStrRef(oNewVal);
+ if (c_oserct_splittypeVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_splittypeAUTO: val.m_val = SPLIT_TYPE_AUTO; break;
+ case st_splittypeCUST: val.m_val = SPLIT_TYPE_CUST; break;
+ case st_splittypePERCENT: val.m_val = SPLIT_TYPE_PERCENT; break;
+ case st_splittypePOS: val.m_val = SPLIT_TYPE_POS; break;
+ case st_splittypeVAL: val.m_val = SPLIT_TYPE_VAL; break;
+ }
}
- else if (c_oserct_sertxV === type) {
- val.setVal(this.stream.GetString2LE(length));
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_OfPieType = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_ofpietypeVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_ofpietypePIE: val.m_val = OF_PIE_TYPE_PIE; break;
+ case st_ofpietypeBAR: val.m_val = OF_PIE_TYPE_BAR; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DPt = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_custSplit = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dptIDX === type) {
+ if (c_oserct_custsplitSECONDPIEPT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ val.addCustSplit(oNewVal.m_val);
}
- else if (c_oserct_dptINVERTIFNEGATIVE === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_OfPieChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_ofpiechartOFPIETYPE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_OfPieType(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setOfPieType(oNewVal.m_val);
+ }
+ else if (c_oserct_ofpiechartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setInvertIfNegative(oNewVal.m_val);
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_dptMARKER === type) {
- var oNewVal = new AscFormat.CMarker();
+ else if (c_oserct_ofpiechartSER === type) {
+ var oNewVal = new AscFormat.CPieSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Marker(t, l, oNewVal);
+ return oThis.ReadCT_PieSer(t, l, oNewVal);
});
- val.setMarker(oNewVal);
+ val.addSer(oNewVal);
}
- else if (c_oserct_dptBUBBLE3D === type) {
+ else if (c_oserct_ofpiechartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
+ }
+ else if (c_oserct_ofpiechartGAPWIDTH === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_GapAmount(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setBubble3D(oNewVal.m_val);
+ val.setGapWidth(oNewVal.m_val);
}
- else if (c_oserct_dptEXPLOSION === type) {
+ else if (c_oserct_ofpiechartSPLITTYPE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_SplitType(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setExplosion(oNewVal.m_val);
+ val.setSplitType(oNewVal.m_val)
}
- else if (c_oserct_dptSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ else if (c_oserct_ofpiechartSPLITPOS === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Double(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setSplitPos(oNewVal.m_val);
}
- else if (c_oserct_dptPICTUREOPTIONS === type) {
- var oNewVal = new AscFormat.CPictureOptions();
+ else if (c_oserct_ofpiechartCUSTSPLIT === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PictureOptions(t, l, oNewVal);
+ return oThis.ReadCT_custSplit(t, l, val);
});
- val.setPictureOptions(oNewVal);
}
- else if (c_oserct_dptEXTLST === type) {
+ else if (c_oserct_ofpiechartSECONDPIESIZE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_SecondPieSize(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setSecondPieSize(oNewVal.m_val);
+ }
+ else if (c_oserct_ofpiechartSERLINES === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setSerLines(oNewVal.spPr);
+ else
+ val.setSerLines(new AscFormat.CSpPr());
+ }
+ else if (c_oserct_ofpiechartEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -8465,280 +11086,174 @@ BinaryChartReader.prototype.ReadCT_DPt = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Marker = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_PieSer = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_markerSYMBOL === type) {
+ if (c_oserct_pieserIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_MarkerStyle(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setSymbol(oNewVal.m_val);
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_markerSIZE === type) {
+ else if (c_oserct_pieserORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_MarkerSize(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setSize(oNewVal.m_val);
- }
- else if (c_oserct_markerSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_markerEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_pieserTX === type) {
+ var oNewVal = new AscFormat.CTx();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_SerTx(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.MarkerStyleToFormat = function(markerStyle) {
-
- var val = null;
- switch (markerStyle) {
- case st_markerstyleCIRCLE: val = AscFormat.SYMBOL_CIRCLE; break;
- case st_markerstyleDASH: val = AscFormat.SYMBOL_DASH; break;
- case st_markerstyleDIAMOND: val = AscFormat.SYMBOL_DIAMOND; break;
- case st_markerstyleDOT: val = AscFormat.SYMBOL_DOT; break;
- case st_markerstyleNONE: val = AscFormat.SYMBOL_NONE; break;
- case st_markerstylePICTURE: val = AscFormat.SYMBOL_PICTURE; break;
- case st_markerstylePLUS: val = AscFormat.SYMBOL_PLUS; break;
- case st_markerstyleSQUARE: val = AscFormat.SYMBOL_SQUARE; break;
- case st_markerstyleSTAR: val = AscFormat.SYMBOL_STAR; break;
- case st_markerstyleTRIANGLE: val = AscFormat.SYMBOL_TRIANGLE; break;
- case st_markerstyleX: val = AscFormat.SYMBOL_X; break;
- case st_markerstyleAUTO: break;
- }
- return val;
-};
-BinaryChartReader.prototype.ReadCT_MarkerStyle = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- if (c_oserct_markerstyleVAL === type) {
- val.m_val = this.MarkerStyleToFormat(this.stream.GetUChar());
+ val.setTx(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_MarkerSize = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_markersizeVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetUChar();
- val.m_val = oNewVal;
+ else if (c_oserct_pieserSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_PictureOptions = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_pictureoptionsAPPLYTOFRONT === type) {
+ else if (c_oserct_pieserEXPLOSION === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setApplyToFront(oNewVal.m_val);
+ val.setExplosion(oNewVal.m_val);
}
- else if (c_oserct_pictureoptionsAPPLYTOSIDES === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_pieserDPT === type) {
+ var oNewVal = new AscFormat.CDPt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DPt(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setApplyToSides(oNewVal.m_val);
+ val.addDPt(oNewVal);
}
- else if (c_oserct_pictureoptionsAPPLYTOEND === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_pieserDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
+ }
+ else if (c_oserct_pieserCAT === type) {
+ var oNewVal = new AscFormat.CCat();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setApplyToEnd(oNewVal.m_val);
+ val.setCat(oNewVal);
}
- else if (c_oserct_pictureoptionsPICTUREFORMAT === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_pieserVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PictureFormat(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setPictureFormat(oNewVal.m_val);
+ val.setVal(oNewVal);
}
- else if (c_oserct_pictureoptionsPICTURESTACKUNIT === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_pieserEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PictureStackUnit(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setPictureStackUnit(oNewVal.m_val);
+ // val.m_extLst = oNewVal;
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_PictureFormat = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_pictureformatVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_pictureformatSTRETCH: val.m_val = PICTURE_FORMAT_STACK_STRETCH; break;
- case st_pictureformatSTACK: val.m_val = PICTURE_FORMAT_STACK; break;
- case st_pictureformatSTACKSCALE: val.m_val = PICTURE_FORMAT_STACK_SCALE; break;
- }
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_PictureStackUnit = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_GapAmount = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_picturestackunitVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetDoubleLE();
- val.m_val = oNewVal;
+ if (c_oserct_gapamountVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DLbls = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Bar3DChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dlblsDLBL === type) {
- var oNewVal = new AscFormat.CDLbl();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbl(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.addDLbl(oNewVal);
- }
- else if (c_oserct_dlblsDLBLPOS === type) {
+ if (c_oserct_bar3dchartBARDIR === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLblPos(t, l, oNewVal);
+ return oThis.ReadCT_BarDir(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDLblPos(oNewVal.m_val);
+ val.setBarDir(oNewVal.m_val);
}
- else if (c_oserct_dlblsDELETE === type) {
+ else if (c_oserct_bar3dchartGROUPING === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_BarGrouping(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDelete(oNewVal.m_val);
- else
- val.setDelete(true);
- }
- else if (c_oserct_dlblsLEADERLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setLeaderLines(oNewVal.spPr);
- else
- val.setLeaderLines(new AscFormat.CSpPr());
- }
- else if (c_oserct_dlblsNUMFMT === type) {
- var oNewVal = new AscFormat.CNumFmt();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumFmt(t, l, oNewVal);
- });
- val.setNumFmt(oNewVal);
- }
- else if (c_oserct_dlblsSEPARATOR === type) {
- val.setSeparator(this.stream.GetString2LE(length));
+ val.setGrouping(oNewVal.m_val);
}
- else if (c_oserct_dlblsSHOWBUBBLESIZE === type) {
+ else if (c_oserct_bar3dchartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setShowBubbleSize(oNewVal.m_val);
- else
- val.setShowBubbleSize(true);
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_dlblsSHOWCATNAME === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_bar3dchartSER === type) {
+ var oNewVal = new AscFormat.CBarSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_BarSer(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowCatName(oNewVal.m_val);
- else
- val.setShowCatName(true);
+ val.addSer(oNewVal);
}
- else if (c_oserct_dlblsSHOWLEADERLINES === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_bar3dchartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowLeaderLines(oNewVal.m_val);
- else
- val.setShowLeaderLines(true);
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_dlblsSHOWLEGENDKEY === type) {
+ else if (c_oserct_bar3dchartGAPWIDTH === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_GapAmount(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setShowLegendKey(oNewVal.m_val);
- else
- val.setShowLegendKey(true);
+ val.setGapWidth(oNewVal.m_val);
}
- else if (c_oserct_dlblsSHOWPERCENT === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_bar3dchartGAPDEPTH === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_GapAmount(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowPercent(oNewVal.m_val);
- else
- val.setShowPercent(true);
+ if(null != oNewVal.m_val)
+ val.setGapDepth(oNewVal.m_val);
}
- else if (c_oserct_dlblsSHOWSERNAME === type) {
+ else if (c_oserct_bar3dchartSHAPE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Shape(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowSerName(oNewVal.m_val);
- else
- val.setShowSerName(true);
+ if(null != oNewVal.m_val)
+ val.setShape(oNewVal.m_val);
}
- else if (c_oserct_dlblsSHOWVAL === type) {
+ else if (c_oserct_bar3dchartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setShowVal(oNewVal.m_val);
- else
- val.setShowVal(true);
- }
- else if (c_oserct_dlblsSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
- }
- else if (c_oserct_dlblsTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_dlblsEXTLST === type) {
+ else if (c_oserct_bar3dchartEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -8750,10 +11265,38 @@ BinaryChartReader.prototype.ReadCT_DLbls = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DLbl = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_BarDir = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dlblIDX === type) {
+ if (c_oserct_bardirVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_bardirBAR: val.m_val = AscFormat.BAR_DIR_BAR; break;
+ case st_bardirCOL: val.m_val = AscFormat.BAR_DIR_COL; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_BarGrouping = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_bargroupingVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_bargroupingPERCENTSTACKED: val.m_val = AscFormat.BAR_GROUPING_PERCENT_STACKED; break;
+ case st_bargroupingCLUSTERED: val.m_val = AscFormat.BAR_GROUPING_CLUSTERED; break;
+ case st_bargroupingSTANDARD: val.m_val = AscFormat.BAR_GROUPING_STANDARD; break;
+ case st_bargroupingSTACKED: val.m_val = AscFormat.BAR_GROUPING_STACKED; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_BarSer = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_barserIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -8761,252 +11304,308 @@ BinaryChartReader.prototype.ReadCT_DLbl = function (type, length, val) {
if (null != oNewVal.m_val)
val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_dlblDLBLPOS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLblPos(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setDLblPos(oNewVal.m_val);
- }
- else if (c_oserct_dlblDELETE === type) {
+ else if (c_oserct_barserORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDelete(oNewVal.m_val);
- else
- val.setDelete(true);
- }
- else if (c_oserct_dlblLAYOUT === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Layout(t, l, val);
- });
- }
- else if (c_oserct_dlblNUMFMT === type) {
- var oNewVal = new AscFormat.CNumFmt();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumFmt(t, l, oNewVal);
- });
- val.setNumFmt(oNewVal);
- }
- else if (c_oserct_dlblSEPARATOR === type) {
- val.setSeparator(this.stream.GetString2LE(length));
+ val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_dlblSHOWBUBBLESIZE === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_barserTX === type) {
+ var oNewVal = new AscFormat.CTx();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_SerTx(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowBubbleSize(oNewVal.m_val);
- else
- val.setShowBubbleSize(true);
+ val.setTx(oNewVal);
}
- else if (c_oserct_dlblSHOWCATNAME === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setShowCatName(oNewVal.m_val);
- else
- val.setShowCatName(true);
+ else if (c_oserct_barserSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_dlblSHOWLEGENDKEY === type) {
+ else if (c_oserct_barserINVERTIFNEGATIVE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setShowLegendKey(oNewVal.m_val);
- else
- val.setShowLegendKey(true);
+ val.setInvertIfNegative(oNewVal.m_val);
}
- else if (c_oserct_dlblSHOWPERCENT === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_barserPICTUREOPTIONS === type) {
+ var oNewVal = new AscFormat.CPictureOptions();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_PictureOptions(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowPercent(oNewVal.m_val);
- else
- val.setShowPercent(true);
+ val.setPictureOptions(oNewVal);
}
- else if (c_oserct_dlblSHOWSERNAME === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_barserDPT === type) {
+ var oNewVal = new AscFormat.CDPt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DPt(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowSerName(oNewVal.m_val);
- else
- val.setShowSerName(true);
+ val.addDPt(oNewVal);
}
- else if (c_oserct_dlblSHOWVAL === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_barserDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowVal(oNewVal.m_val);
- else
- val.setShowVal(true);
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_dlblSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ else if (c_oserct_barserTRENDLINE === type) {
+ //todo array
+ var oNewVal = new AscFormat.CTrendLine();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Trendline(t, l, oNewVal);
+ });
+ val.setTrendline(oNewVal);
}
- else if (c_oserct_dlblTX === type) {
- var oNewVal = new AscFormat.CChartText();
+ else if (c_oserct_barserERRBARS === type) {
+ var oNewVal = new AscFormat.CErrBars();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Tx(t, l, oNewVal);
+ return oThis.ReadCT_ErrBars(t, l, oNewVal);
});
- oNewVal.setChart(this.curChart);
- val.setTx(oNewVal);
+ val.addErrBars(oNewVal);
}
- else if (c_oserct_dlblTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ else if (c_oserct_barserCAT === type) {
+ var oNewVal = new AscFormat.CCat();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ });
+ val.setCat(oNewVal);
}
- else if (c_oserct_dlblEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_barserVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.setVal(oNewVal);
}
- else if (c_oserct_dataLabel === type) {
+ else if (c_oserct_barserSHAPE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLblExt(t, l, val);
+ return oThis.ReadCT_Shape(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setShape(oNewVal.m_val);
+ }
+ else if (c_oserct_barserEXTLST === type) {
+ var oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
+ }
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DLblExt = function(type, length, val) {
-
+BinaryChartReader.prototype.ReadCT_ChartFiltering = function(type, length, val) {
let res = c_oSerConstants.ReadOk;
let oThis = this;
- if (c_oserct_showDataLabelsRange === type) {
- let oNewVal = { m_val: null };
+ if (c_oserct_dataLabelsRange === type) {
+ var oNewVal = new AscFormat.CStrRef();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_dataLabelsRange(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setShowDlblsRange(oNewVal.m_val);
+ val.setDataLabelsRange(oNewVal);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DLblPos = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_dataLabelsRange = function(type, length, val) {
+ let res = c_oSerConstants.ReadOk;
+ let oThis = this;
+ if (0 === type) {
+ val.setF(this.stream.GetString2LE(length));
+ }
+ else if(1 === type) {
+ var oNewVal = new AscFormat.CStrCache();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_StrData(t, l, oNewVal);
+ });
+ val.setStrCache(oNewVal);
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Shape = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_dlblposVAL === type) {
+ if (c_oserct_shapeVAL === type) {
switch (this.stream.GetUChar()) {
- case st_dlblposBESTFIT: val.m_val = c_oAscChartDataLabelsPos.bestFit; break;
- case st_dlblposB: val.m_val = c_oAscChartDataLabelsPos.b; break;
- case st_dlblposCTR: val.m_val = c_oAscChartDataLabelsPos.ctr; break;
- case st_dlblposINBASE: val.m_val = c_oAscChartDataLabelsPos.inBase; break;
- case st_dlblposINEND: val.m_val = c_oAscChartDataLabelsPos.inEnd; break;
- case st_dlblposL: val.m_val = c_oAscChartDataLabelsPos.l; break;
- case st_dlblposOUTEND: val.m_val = c_oAscChartDataLabelsPos.outEnd; break;
- case st_dlblposR: val.m_val = c_oAscChartDataLabelsPos.r; break;
- case st_dlblposT: val.m_val = c_oAscChartDataLabelsPos.t; break;
+ case st_shapeCONE: val.m_val = AscFormat.BAR_SHAPE_CONE; break;
+ case st_shapeCONETOMAX: val.m_val = AscFormat.BAR_SHAPE_CONETOMAX; break;
+ case st_shapeBOX: val.m_val = AscFormat.BAR_SHAPE_BOX; break;
+ case st_shapeCYLINDER: val.m_val = AscFormat.BAR_SHAPE_CYLINDER; break;
+ case st_shapePYRAMID: val.m_val = AscFormat.BAR_SHAPE_PYRAMID; break;
+ case st_shapePYRAMIDTOMAX: val.m_val = AscFormat.BAR_SHAPE_PYRAMIDTOMAX; break;
}
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Trendline = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Overlap = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_trendlineNAME === type) {
- val.setName(this.stream.GetString2LE(length));
+ if (c_oserct_overlapVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
- else if (c_oserct_trendlineSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_BarChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_barchartBARDIR === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_BarDir(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setBarDir(oNewVal.m_val);
}
- else if (c_oserct_trendlineTRENDLINETYPE === type) {
+ else if (c_oserct_barchartGROUPING === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TrendlineType(t, l, oNewVal);
+ return oThis.ReadCT_BarGrouping(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setTrendlineType(oNewVal.m_val);
+ val.setGrouping(oNewVal.m_val);
}
- else if (c_oserct_trendlineORDER === type) {
+ else if (c_oserct_barchartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Order(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setOrder(oNewVal.m_val);
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_trendlinePERIOD === type) {
+ else if (c_oserct_barchartSER === type) {
+ var oNewVal = new AscFormat.CBarSeries();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_BarSer(t, l, oNewVal);
+ });
+ val.addSer(oNewVal);
+ }
+ else if (c_oserct_barchartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
+ }
+ else if (c_oserct_barchartGAPWIDTH === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Period(t, l, oNewVal);
+ return oThis.ReadCT_GapAmount(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setPeriod(oNewVal.m_val);
+ val.setGapWidth(oNewVal.m_val);
}
- else if (c_oserct_trendlineFORWARD === type) {
+ else if (c_oserct_barchartOVERLAP === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_Overlap(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setForward(oNewVal.m_val);
+ val.setOverlap(oNewVal.m_val);
}
- else if (c_oserct_trendlineBACKWARD === type) {
+ else if (c_oserct_barchartSERLINES === type) {
+ //todo array
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setSerLines(oNewVal.spPr);
+ else
+ val.setSerLines(new AscFormat.CSpPr());
+ }
+ else if (c_oserct_barchartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setBackward(oNewVal.m_val);
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_trendlineINTERCEPT === type) {
+ else if (c_oserct_barchartEXTLST === type) {
+ var oNewVal;
+ oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_HoleSize = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_holesizeVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DoughnutChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_doughnutchartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setVaryColors(oNewVal.m_val);
+ }
+ else if (c_oserct_doughnutchartSER === type) {
+ var oNewVal = new AscFormat.CPieSeries();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_PieSer(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setIntercept(oNewVal.m_val);
+ val.addSer(oNewVal);
}
- else if (c_oserct_trendlineDISPRSQR === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_doughnutchartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setDispRSqr(oNewVal.m_val);
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_trendlineDISPEQ === type) {
+ else if (c_oserct_doughnutchartFIRSTSLICEANG === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_FirstSliceAng(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setDispEq(oNewVal.m_val);
+ val.setFirstSliceAng(oNewVal.m_val);
}
- else if (c_oserct_trendlineTRENDLINELBL === type) {
- var oNewVal = new AscFormat.CDLbl();
+ else if (c_oserct_doughnutchartHOLESIZE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_TrendlineLbl(t, l, oNewVal);
+ return oThis.ReadCT_HoleSize(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setTrendlineLbl(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setHoleSize(oNewVal.m_val);
}
- else if (c_oserct_trendlineEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_doughnutchartEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
@@ -9016,39 +11615,10 @@ BinaryChartReader.prototype.ReadCT_Trendline = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_TrendlineType = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_trendlinetypeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_trendlinetypeEXP: val.m_val = TRENDLINE_TYPE_EXP; break;
- case st_trendlinetypeLINEAR: val.m_val = TRENDLINE_TYPE_LINEAR; break;
- case st_trendlinetypeLOG: val.m_val = TRENDLINE_TYPE_LOG; break;
- case st_trendlinetypeMOVINGAVG: val.m_val = TRENDLINE_TYPE_MOVING_AVG; break;
- case st_trendlinetypePOLY: val.m_val = TRENDLINE_TYPE_POLY; break;
- case st_trendlinetypePOWER: val.m_val = TRENDLINE_TYPE_POWER; break;
- }
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Order = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_orderVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetUChar();
- val.m_val = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Period = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_FirstSliceAng = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_periodVAL === type) {
+ if (c_oserct_firstsliceangVAL === type) {
var oNewVal;
oNewVal = this.stream.GetULongLE();
val.m_val = oNewVal;
@@ -9057,39 +11627,34 @@ BinaryChartReader.prototype.ReadCT_Period = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_TrendlineLbl = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Pie3DChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_trendlinelblLAYOUT === type) {
+ if (c_oserct_pie3dchartVARYCOLORS === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Layout(t, l, val);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
+ if (null != oNewVal.m_val)
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_trendlinelblTX === type) {
- var oNewVal = new AscFormat.CChartText();
+ else if (c_oserct_pie3dchartSER === type) {
+ var oNewVal = new AscFormat.CPieSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Tx(t, l, oNewVal);
+ return oThis.ReadCT_PieSer(t, l, oNewVal);
});
- oNewVal.setChart(this.curChart);
- val.setTx(oNewVal);
+ val.addSer(oNewVal);
}
- else if (c_oserct_trendlinelblNUMFMT === type) {
- var oNewVal = new AscFormat.CNumFmt();
+ else if (c_oserct_pie3dchartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumFmt(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- val.setNumFmt(oNewVal);
- }
- else if (c_oserct_trendlinelblSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
- }
- else if (c_oserct_trendlinelblTXPR === type) {
- val.setTxPr(this.ReadTxPr(length));
- val.txPr.setParent(val);
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_trendlinelblEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_pie3dchartEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
@@ -9099,208 +11664,222 @@ BinaryChartReader.prototype.ReadCT_TrendlineLbl = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ErrBars = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_PieChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_errbarsERRDIR === type) {
+ if (c_oserct_piechartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrDir(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setErrDir(oNewVal.m_val);
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_errbarsERRBARTYPE === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_piechartSER === type) {
+ var oNewVal = new AscFormat.CPieSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrBarType(t, l, oNewVal);
+ return oThis.ReadCT_PieSer(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setErrBarType(oNewVal.m_val);
+ val.addSer(oNewVal);
}
- else if (c_oserct_errbarsERRVALTYPE === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_piechartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrValType(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setErrValType(oNewVal.m_val);
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_errbarsNOENDCAP === type) {
+ else if (c_oserct_piechartFIRSTSLICEANG === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_FirstSliceAng(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setNoEndCap(oNewVal.m_val);
+ val.setFirstSliceAng(oNewVal.m_val);
}
- else if (c_oserct_errbarsPLUS === type) {
- var oNewVal = new AscFormat.CMinusPlus();
+ else if (c_oserct_piechartEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_extLst(t, l, oNewVal);
});
- val.setPlus(oNewVal);
+ // val.m_extLst = oNewVal;
}
- else if (c_oserct_errbarsMINUS === type) {
- var oNewVal = new AscFormat.CMinusPlus();
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ScatterSer = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_scatterserIDX === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- val.setMinus(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_errbarsVAL === type) {
+ else if (c_oserct_scatterserORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setVal(oNewVal.m_val);
+ val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_errbarsSPPR === type) {
+ else if (c_oserct_scatterserTX === type) {
+ var oNewVal = new AscFormat.CTx();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_SerTx(t, l, oNewVal);
+ });
+ val.setTx(oNewVal);
+ }
+ else if (c_oserct_scatterserSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_errbarsEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_scatterserMARKER === type) {
+ var oNewVal = new AscFormat.CMarker();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_Marker(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.setMarker(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_ErrDir = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_errdirVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_errdirX: val.m_val = ERR_DIR_X; break;
- case st_errdirY: val.m_val = ERR_DIR_Y; break;
- }
+ else if (c_oserct_scatterserDPT === type) {
+ var oNewVal = new AscFormat.CDPt();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DPt(t, l, oNewVal);
+ });
+ val.addDPt(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_ErrBarType = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_errbartypeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_errbartypeBOTH: val.m_val = ERR_BAR_TYPE_BOTH; break;
- case st_errbartypeMINUS: val.m_val = ERR_BAR_TYPE_MINUS; break;
- case st_errbartypePLUS: val.m_val = ERR_BAR_TYPE_PLUS; break;
- }
+ else if (c_oserct_scatterserDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_ErrValType = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_errvaltypeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_errvaltypeCUST: val.m_val = ERR_VAL_TYPE_CUST; break;
- case st_errvaltypeFIXEDVAL: val.m_val = ERR_VAL_TYPE_FIXED_VAL; break;
- case st_errvaltypePERCENTAGE: val.m_val = ERR_VAL_TYPE_PERCENTAGE; break;
- case st_errvaltypeSTDDEV: val.m_val = ERR_VAL_TYPE_STD_DEV; break;
- case st_errvaltypeSTDERR: val.m_val = ERR_VAL_TYPE_STD_ERR; break;
- }
+ else if (c_oserct_scatterserTRENDLINE === type) {
+ //todo array
+ var oNewVal = new AscFormat.CTrendLine();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Trendline(t, l, oNewVal);
+ });
+ val.setTrendline(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_NumDataSource = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_numdatasourceNUMLIT === type) {
- var oNewVal = new AscFormat.CNumLit();
+ else if (c_oserct_scatterserERRBARS === type) {
+ var oNewVal = new AscFormat.CErrBars();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumData(t, l, oNewVal);
+ return oThis.ReadCT_ErrBars(t, l, oNewVal);
});
- val.setNumLit(oNewVal);
+ val.addErrBars(oNewVal);
}
- else if (c_oserct_numdatasourceNUMREF === type) {
- var oNewVal = new AscFormat.CNumRef();
+ else if (c_oserct_scatterserXVAL === type) {
+ var oNewVal = new AscFormat.CCat();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumRef(t, l, oNewVal);
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- val.setNumRef(oNewVal);
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_NumData = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_numdataFORMATCODE === type) {
- val.setFormatCode(this.stream.GetString2LE(length));
+ val.setXVal(oNewVal);
}
- else if (c_oserct_numdataPTCOUNT === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_scatterserYVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setPtCount(oNewVal.m_val);
+ val.setYVal(oNewVal);
}
- else if (c_oserct_numdataPT === type) {
- var oNewVal = new AscFormat.CNumericPoint();
+ else if (c_oserct_scatterserSMOOTH === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumVal(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.addPt(oNewVal);
+ if (null != oNewVal.m_val){
+ val.setSmooth(oNewVal.m_val);
+ }
+ else{
+ val.setSmooth(true);
+ }
}
- else if (c_oserct_numdataEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_scatterserEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
+ }
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_NumVal = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ScatterStyle = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_numvalV === type) {
- var nVal = parseFloat(this.stream.GetString2LE(length));
- if(isNaN(nVal))
- nVal = 0;
- val.setVal(nVal);
- }
- else if (c_oserct_numvalIDX === type) {
- val.setIdx(this.stream.GetULongLE());
- }
- else if (c_oserct_numvalFORMATCODE === type) {
- val.setFormatCode(this.stream.GetString2LE(length));
+ if (c_oserct_scatterstyleVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_scatterstyleNONE: val.m_val = AscFormat.SCATTER_STYLE_NONE; break;
+ case st_scatterstyleLINE: val.m_val = AscFormat.SCATTER_STYLE_LINE; break;
+ case st_scatterstyleLINEMARKER: val.m_val = AscFormat.SCATTER_STYLE_LINE_MARKER; break;
+ case st_scatterstyleMARKER: val.m_val = AscFormat.SCATTER_STYLE_MARKER; break;
+ case st_scatterstyleSMOOTH: val.m_val = AscFormat.SCATTER_STYLE_SMOOTH; break;
+ case st_scatterstyleSMOOTHMARKER: val.m_val = AscFormat.SCATTER_STYLE_SMOOTH_MARKER; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_NumRef = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ScatterChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_numrefF === type) {
- val.setF(this.stream.GetString2LE(length));
+ if (c_oserct_scatterchartSCATTERSTYLE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ScatterStyle(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setScatterStyle(oNewVal.m_val);
}
- else if (c_oserct_numrefNUMCACHE === type) {
- var oNewVal = new AscFormat.CNumLit();
+ else if (c_oserct_scatterchartVARYCOLORS === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumData(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setNumCache(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_numrefEXTLST === type) {
+ else if (c_oserct_scatterchartSER === type) {
+ var oNewVal = new AscFormat.CScatterSeries();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ScatterSer(t, l, oNewVal);
+ });
+ val.addSer(oNewVal);
+ if(oNewVal.smooth === null){
+ oNewVal.setSmooth(false);
+ }
+ }
+ else if (c_oserct_scatterchartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
+ }
+ else if (c_oserct_scatterchartAXID === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ }
+ else if (c_oserct_scatterchartEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -9311,62 +11890,72 @@ BinaryChartReader.prototype.ReadCT_NumRef = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_AxDataSource = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_RadarSer = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_axdatasourceMULTILVLSTRREF === type) {
- var oNewVal = new AscFormat.CMultiLvlStrRef();
+ if (c_oserct_radarserIDX === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_MultiLvlStrRef(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- val.setMultiLvlStrRef(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_axdatasourceNUMLIT === type) {
- var oNewVal = new AscFormat.CNumLit();
+ else if (c_oserct_radarserORDER === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumData(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- val.setNumLit(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_axdatasourceNUMREF === type) {
- var oNewVal = new AscFormat.CNumRef();
+ else if (c_oserct_radarserTX === type) {
+ var oNewVal = new AscFormat.CTx();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumRef(t, l, oNewVal);
+ return oThis.ReadCT_SerTx(t, l, oNewVal);
});
- val.setNumRef(oNewVal);
+ val.setTx(oNewVal);
}
- else if (c_oserct_axdatasourceSTRLIT === type) {
- var oNewVal = new AscFormat.CStrCache();
+ else if (c_oserct_radarserSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_radarserMARKER === type) {
+ var oNewVal = new AscFormat.CMarker();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrData(t, l, oNewVal);
+ return oThis.ReadCT_Marker(t, l, oNewVal);
});
- val.setStrLit(oNewVal);
+ val.setMarker(oNewVal);
}
- else if (c_oserct_axdatasourceSTRREF === type) {
- var oNewVal = new AscFormat.CStrRef();
+ else if (c_oserct_radarserDPT === type) {
+ var oNewVal = new AscFormat.CDPt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrRef(t, l, oNewVal);
+ return oThis.ReadCT_DPt(t, l, oNewVal);
});
- val.setStrRef(oNewVal);
+ val.addDPt(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_MultiLvlStrRef = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_multilvlstrrefF === type) {
- val.setF(this.stream.GetString2LE(length));
+ else if (c_oserct_radarserDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_multilvlstrrefMULTILVLSTRCACHE === type) {
- var oNewVal = new AscFormat.CMultiLvlStrCache();
+ else if (c_oserct_radarserCAT === type) {
+ var oNewVal = new AscFormat.CCat();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_MultiLvlStrData(t, l, oNewVal);
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- val.setMultiLvlStrCache(oNewVal);
+ val.setCat(oNewVal);
}
- else if (c_oserct_multilvlstrrefEXTLST === type) {
+ else if (c_oserct_radarserVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ });
+ val.setVal(oNewVal);
+ }
+ else if (c_oserct_radarserEXTLST === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
@@ -9374,57 +11963,41 @@ BinaryChartReader.prototype.ReadCT_MultiLvlStrRef = function (type, length, val)
});
// val.m_extLst = oNewVal;
}
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
+ }
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_lvl = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_RadarStyle = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_lvlPT === type) {
- var oNewVal = new AscFormat.CStringPoint();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrVal(t, l, oNewVal);
- });
- val.addPt(oNewVal);
+ if (c_oserct_radarstyleVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_radarstyleSTANDARD: val.m_val = RADAR_STYLE_STANDARD; break;
+ case st_radarstyleMARKER: val.m_val = RADAR_STYLE_MARKER; break;
+ case st_radarstyleFILLED: val.m_val = RADAR_STYLE_FILLED; break;
+ }
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_MultiLvlStrData = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_RadarChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_multilvlstrdataPTCOUNT === type) {
+ if (c_oserct_radarchartRADARSTYLE === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setPtCount(oNewVal.m_val);
- }
- else if (c_oserct_multilvlstrdataLVL === type) {
- var oNewVal = new AscFormat.CStrCache();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_lvl(t, l, oNewVal);
- });
- val.addLvl(oNewVal);
- }
- else if (c_oserct_multilvlstrdataEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_BubbleChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_bubblechartVARYCOLORS === type) {
+ return oThis.ReadCT_RadarStyle(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setRadarStyle(oNewVal.m_val);
+ }
+ else if (c_oserct_radarchartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
@@ -9432,14 +12005,14 @@ BinaryChartReader.prototype.ReadCT_BubbleChart = function (type, length, val, aC
if (null != oNewVal.m_val)
val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_bubblechartSER === type) {
- var oNewVal = new AscFormat.CBubbleSeries();
+ else if (c_oserct_radarchartSER === type) {
+ var oNewVal = new AscFormat.CRadarSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BubbleSer(t, l, oNewVal);
+ return oThis.ReadCT_RadarSer(t, l, oNewVal);
});
val.addSer(oNewVal);
}
- else if (c_oserct_bubblechartDLBLS === type) {
+ else if (c_oserct_radarchartDLBLS === type) {
var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_DLbls(t, l, oNewVal);
@@ -9447,39 +12020,7 @@ BinaryChartReader.prototype.ReadCT_BubbleChart = function (type, length, val, aC
oNewVal.correctValues();
val.setDLbls(oNewVal);
}
- else if (c_oserct_bubblechartBUBBLE3D === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setBubble3D(oNewVal.m_val);
- }
- else if (c_oserct_bubblechartBUBBLESCALE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BubbleScale(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setBubbleScale(oNewVal.m_val);
- }
- else if (c_oserct_bubblechartSHOWNEGBUBBLES === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setShowNegBubbles(oNewVal.m_val);
- }
- else if (c_oserct_bubblechartSIZEREPRESENTS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SizeRepresents(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setSizeRepresents(oNewVal.m_val);
- }
- else if (c_oserct_bubblechartAXID === type) {
+ else if (c_oserct_radarchartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -9487,7 +12028,7 @@ BinaryChartReader.prototype.ReadCT_BubbleChart = function (type, length, val, aC
if (null != oNewVal.m_val)
aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_bubblechartEXTLST === type) {
+ else if (c_oserct_radarchartEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -9498,52 +12039,60 @@ BinaryChartReader.prototype.ReadCT_BubbleChart = function (type, length, val, aC
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_bandFmts = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_StockChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_bandfmtsBANDFMT === type) {
- var oNewVal = new AscFormat.CBandFmt();
+ if (c_oserct_stockchartSER === type) {
+ var oNewVal = new AscFormat.CLineSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BandFmt(t, l, oNewVal);
+ return oThis.ReadCT_LineSer(t, l, oNewVal);
});
- val.addBandFmt(oNewVal);
+ val.addSer(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Surface3DChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_surface3dchartWIREFRAME === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_stockchartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setWireframe(oNewVal.m_val);
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_surface3dchartSER === type) {
- var oNewVal = new AscFormat.CSurfaceSeries();
+ else if (c_oserct_stockchartDROPLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SurfaceSer(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- val.addSer(oNewVal);
+ if (null != oNewVal.spPr)
+ val.setDropLines(oNewVal.spPr);
+ else
+ val.setDropLines(new AscFormat.CSpPr());
}
- else if (c_oserct_surface3dchartBANDFMTS === type) {
+ else if (c_oserct_stockchartHILOWLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_bandFmts(t, l, val);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setHiLowLines(oNewVal.spPr);
+ else
+ val.setHiLowLines(new AscFormat.CSpPr());
+ }
+ else if (c_oserct_stockchartUPDOWNBARS === type) {
+ var oNewVal = new AscFormat.CUpDownBars();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UpDownBars(t, l, oNewVal);
});
+ val.setUpDownBars(oNewVal);
}
- else if (c_oserct_surface3dchartAXID === type) {
+ else if (c_oserct_stockchartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val, surface: true });
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_surface3dchartEXTLST === type) {
+ else if (c_oserct_stockchartEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -9554,10 +12103,10 @@ BinaryChartReader.prototype.ReadCT_Surface3DChart = function (type, length, val,
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_SurfaceSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_LineSer = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_surfaceserIDX === type) {
+ if (c_oserct_lineserIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -9565,7 +12114,7 @@ BinaryChartReader.prototype.ReadCT_SurfaceSer = function (type, length, val) {
if (null != oNewVal.m_val)
val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_surfaceserORDER === type) {
+ else if (c_oserct_lineserORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -9573,173 +12122,159 @@ BinaryChartReader.prototype.ReadCT_SurfaceSer = function (type, length, val) {
if (null != oNewVal.m_val)
val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_surfaceserTX === type) {
+ else if (c_oserct_lineserTX === type) {
var oNewVal = new AscFormat.CTx();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_SerTx(t, l, oNewVal);
});
val.setTx(oNewVal);
}
- else if (c_oserct_surfaceserSPPR === type) {
+ else if (c_oserct_lineserSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_surfaceserCAT === type) {
- var oNewVal = new AscFormat.CCat();
+ else if (c_oserct_lineserMARKER === type) {
+ var oNewVal = new AscFormat.CMarker();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ return oThis.ReadCT_Marker(t, l, oNewVal);
});
- val.setCat(oNewVal);
+ val.setMarker(oNewVal);
}
- else if (c_oserct_surfaceserVAL === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_lineserDPT === type) {
+ var oNewVal = new AscFormat.CDPt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_DPt(t, l, oNewVal);
});
- val.setVal(oNewVal);
+ val.addDPt(oNewVal);
}
- else if (c_oserct_surfaceserEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_lineserDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
- }
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_BandFmt = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_bandfmtIDX === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_lineserTRENDLINE === type) {
+ //todo array
+ var oNewVal = new AscFormat.CTrendLine();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Trendline(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
- }
- else if (c_oserct_bandfmtSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ val.setTrendline(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_SurfaceChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_surfacechartWIREFRAME === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_lineserERRBARS === type) {
+ var oNewVal = new AscFormat.CErrBars();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_ErrBars(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setWireframe(oNewVal.m_val);
+ val.addErrBars(oNewVal);
}
- else if (c_oserct_surfacechartSER === type) {
- var oNewVal = new AscFormat.CSurfaceSeries();
+ else if (c_oserct_lineserCAT === type) {
+ var oNewVal = new AscFormat.CCat();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SurfaceSer(t, l, oNewVal);
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- val.addSer(oNewVal);
+ val.setCat(oNewVal);
}
- else if (c_oserct_surfacechartBANDFMTS === type) {
+ else if (c_oserct_lineserVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_bandFmts(t, l, val);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
+ val.setVal(oNewVal);
}
- else if (c_oserct_surfacechartAXID === type) {
+ else if (c_oserct_lineserSMOOTH === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val, surface: true });
+ if (null != oNewVal.m_val) {
+ val.setSmooth(oNewVal.m_val);
+ }
+ else {
+ val.setSmooth(true);
+ }
}
- else if (c_oserct_surfacechartEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_lineserEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_SecondPieSize = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_secondpiesizeVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_SplitType = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_UpDownBars = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_splittypeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_splittypeAUTO: val.m_val = SPLIT_TYPE_AUTO; break;
- case st_splittypeCUST: val.m_val = SPLIT_TYPE_CUST; break;
- case st_splittypePERCENT: val.m_val = SPLIT_TYPE_PERCENT; break;
- case st_splittypePOS: val.m_val = SPLIT_TYPE_POS; break;
- case st_splittypeVAL: val.m_val = SPLIT_TYPE_VAL; break;
- }
+ if (c_oserct_updownbarsGAPWIDTH === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_GapAmount(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setGapWidth(oNewVal.m_val);
+ }
+ else if (c_oserct_updownbarsUPBARS === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UpDownBar(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setUpBars(oNewVal.spPr);
+ else
+ val.setUpBars(new AscFormat.CSpPr());
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_OfPieType = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_ofpietypeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_ofpietypePIE: val.m_val = OF_PIE_TYPE_PIE; break;
- case st_ofpietypeBAR: val.m_val = OF_PIE_TYPE_BAR; break;
- }
+ else if (c_oserct_updownbarsDOWNBARS === type) {
+ var oNewVal = { spPr: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UpDownBar(t, l, oNewVal);
+ });
+ if (null != oNewVal.spPr)
+ val.setDownBars(oNewVal.spPr);
+ else
+ val.setDownBars(new AscFormat.CSpPr());
+ }
+ else if (c_oserct_updownbarsEXTLST === type) {
+ var oNewVal = {};
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_extLst(t, l, oNewVal);
+ });
+ // val.m_extLst = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_custSplit = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_UpDownBar = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_custsplitSECONDPIEPT === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.addCustSplit(oNewVal.m_val);
+ if (c_oserct_updownbarSPPR === type) {
+ val.spPr = this.ReadSpPr(length);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_OfPieChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_Line3DChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_ofpiechartOFPIETYPE === type) {
+ if (c_oserct_line3dchartGROUPING === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_OfPieType(t, l, oNewVal);
+ return oThis.ReadCT_Grouping(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setOfPieType(oNewVal.m_val);
+ val.setGrouping(oNewVal.m_val);
}
- else if (c_oserct_ofpiechartVARYCOLORS === type) {
+ else if (c_oserct_line3dchartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
@@ -9747,14 +12282,17 @@ BinaryChartReader.prototype.ReadCT_OfPieChart = function (type, length, val, aCh
if (null != oNewVal.m_val)
val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_ofpiechartSER === type) {
- var oNewVal = new AscFormat.CPieSeries();
+ else if (c_oserct_line3dchartSER === type) {
+ var oNewVal = new AscFormat.CLineSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PieSer(t, l, oNewVal);
+ return oThis.ReadCT_LineSer(t, l, oNewVal);
});
+ if(oNewVal.smooth === null){
+ oNewVal.setSmooth(false);
+ }
val.addSer(oNewVal);
}
- else if (c_oserct_ofpiechartDLBLS === type) {
+ else if (c_oserct_line3dchartDLBLS === type) {
var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_DLbls(t, l, oNewVal);
@@ -9762,56 +12300,34 @@ BinaryChartReader.prototype.ReadCT_OfPieChart = function (type, length, val, aCh
oNewVal.correctValues();
val.setDLbls(oNewVal);
}
- else if (c_oserct_ofpiechartGAPWIDTH === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_GapAmount(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setGapWidth(oNewVal.m_val);
- }
- else if (c_oserct_ofpiechartSPLITTYPE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SplitType(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setSplitType(oNewVal.m_val)
- }
- else if (c_oserct_ofpiechartSPLITPOS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_line3dchartDROPLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Double(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setSplitPos(oNewVal.m_val);
+ if (null != oNewVal.spPr)
+ val.setDropLines(oNewVal.spPr);
+ else
+ val.setDropLines(new AscFormat.CSpPr());
}
- else if (c_oserct_ofpiechartCUSTSPLIT === type) {
+ else if (c_oserct_line3dchartGAPDEPTH === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_custSplit(t, l, val);
+ return oThis.ReadCT_GapAmount(t, l, oNewVal);
});
+ //val.m_gapDepth = oNewVal;
}
- else if (c_oserct_ofpiechartSECONDPIESIZE === type) {
+ else if (c_oserct_line3dchartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SecondPieSize(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setSecondPieSize(oNewVal.m_val);
- }
- else if (c_oserct_ofpiechartSERLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setSerLines(oNewVal.spPr);
- else
- val.setSerLines(new AscFormat.CSpPr());
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_ofpiechartEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_line3dchartEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
@@ -9821,118 +12337,135 @@ BinaryChartReader.prototype.ReadCT_OfPieChart = function (type, length, val, aCh
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_PieSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Grouping = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_pieserIDX === type) {
+ if (c_oserct_groupingVAL === type) {
+ switch (this.stream.GetUChar()) {
+ case st_groupingPERCENTSTACKED: val.m_val = AscFormat.GROUPING_PERCENT_STACKED; break;
+ case st_groupingSTANDARD: val.m_val = AscFormat.GROUPING_STANDARD; break;
+ case st_groupingSTACKED: val.m_val = AscFormat.GROUPING_STACKED; break;
+ }
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_LineChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_linechartGROUPING === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Grouping(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ val.setGrouping(oNewVal.m_val);
}
- else if (c_oserct_pieserORDER === type) {
+ else if (c_oserct_linechartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setOrder(oNewVal.m_val);
+ val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_pieserTX === type) {
- var oNewVal = new AscFormat.CTx();
+ else if (c_oserct_linechartSER === type) {
+ var oNewVal = new AscFormat.CLineSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SerTx(t, l, oNewVal);
+ return oThis.ReadCT_LineSer(t, l, oNewVal);
});
- val.setTx(oNewVal);
+ val.addSer(oNewVal);
+ if(oNewVal.smooth === null){
+ oNewVal.setSmooth(false);
+ }
}
- else if (c_oserct_pieserSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ else if (c_oserct_linechartDLBLS === type) {
+ var oNewVal = new AscFormat.CDLbls();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_DLbls(t, l, oNewVal);
+ });
+ oNewVal.correctValues();
+ val.setDLbls(oNewVal);
}
- else if (c_oserct_pieserEXPLOSION === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_linechartDROPLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setExplosion(oNewVal.m_val);
+ if (null != oNewVal.spPr)
+ val.setDropLines(oNewVal.spPr);
+ else
+ val.setDropLines(new AscFormat.CSpPr());
}
- else if (c_oserct_pieserDPT === type) {
- var oNewVal = new AscFormat.CDPt();
+ else if (c_oserct_linechartHILOWLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DPt(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- val.addDPt(oNewVal);
+ if (null != oNewVal.spPr)
+ val.setHiLowLines(oNewVal.spPr);
+ else
+ val.setHiLowLines(new AscFormat.CSpPr());
}
- else if (c_oserct_pieserDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_linechartUPDOWNBARS === type) {
+ var oNewVal = new AscFormat.CUpDownBars();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_UpDownBars(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ val.setUpDownBars(oNewVal);
}
- else if (c_oserct_pieserCAT === type) {
- var oNewVal = new AscFormat.CCat();
+ else if (c_oserct_linechartMARKER === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setCat(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setMarker(oNewVal.m_val);
}
- else if (c_oserct_pieserVAL === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_linechartSMOOTH === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setVal(oNewVal);
+ if (null != oNewVal.m_val){
+ val.setSmooth(oNewVal.m_val);
+ }
+ else{
+ val.setSmooth(true);
+ }
}
- else if (c_oserct_pieserEXTLST === type) {
+ else if (c_oserct_linechartAXID === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ }
+ else if (c_oserct_linechartEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_GapAmount = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_gapamountVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
- }
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Bar3DChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_bar3dchartBARDIR === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarDir(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setBarDir(oNewVal.m_val);
- }
- else if (c_oserct_bar3dchartGROUPING === type) {
+BinaryChartReader.prototype.ReadCT_Area3DChart = function (type, length, val, aChartWithAxis) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_area3dchartGROUPING === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarGrouping(t, l, oNewVal);
+ return oThis.ReadCT_Grouping(t, l, oNewVal);
});
if (null != oNewVal.m_val)
val.setGrouping(oNewVal.m_val);
}
- else if (c_oserct_bar3dchartVARYCOLORS === type) {
+ else if (c_oserct_area3dchartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
@@ -9940,14 +12473,14 @@ BinaryChartReader.prototype.ReadCT_Bar3DChart = function (type, length, val, aCh
if (null != oNewVal.m_val)
val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_bar3dchartSER === type) {
- var oNewVal = new AscFormat.CBarSeries();
+ else if (c_oserct_area3dchartSER === type) {
+ var oNewVal = new AscFormat.CAreaSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarSer(t, l, oNewVal);
+ return oThis.ReadCT_AreaSer(t, l, oNewVal);
});
val.addSer(oNewVal);
}
- else if (c_oserct_bar3dchartDLBLS === type) {
+ else if (c_oserct_area3dchartDLBLS === type) {
var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_DLbls(t, l, oNewVal);
@@ -9955,32 +12488,25 @@ BinaryChartReader.prototype.ReadCT_Bar3DChart = function (type, length, val, aCh
oNewVal.correctValues();
val.setDLbls(oNewVal);
}
- else if (c_oserct_bar3dchartGAPWIDTH === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_area3dchartDROPLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_GapAmount(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setGapWidth(oNewVal.m_val);
+ if (null != oNewVal.spPr)
+ val.setDropLines(oNewVal.spPr);
+ else
+ val.setDropLines(new AscFormat.CSpPr());
}
- else if (c_oserct_bar3dchartGAPDEPTH === type) {
+ else if (c_oserct_area3dchartGAPDEPTH === type) {
var oNewVal;
oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_GapAmount(t, l, oNewVal);
});
- if(null != oNewVal.m_val)
- val.setGapDepth(oNewVal.m_val);
- }
- else if (c_oserct_bar3dchartSHAPE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Shape(t, l, oNewVal);
- });
- if(null != oNewVal.m_val)
- val.setShape(oNewVal.m_val);
+ //val.m_gapDepth = oNewVal;
}
- else if (c_oserct_bar3dchartAXID === type) {
+ else if (c_oserct_area3dchartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -9988,9 +12514,8 @@ BinaryChartReader.prototype.ReadCT_Bar3DChart = function (type, length, val, aCh
if (null != oNewVal.m_val)
aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_bar3dchartEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_area3dchartEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
@@ -10000,38 +12525,10 @@ BinaryChartReader.prototype.ReadCT_Bar3DChart = function (type, length, val, aCh
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_BarDir = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_bardirVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_bardirBAR: val.m_val = AscFormat.BAR_DIR_BAR; break;
- case st_bardirCOL: val.m_val = AscFormat.BAR_DIR_COL; break;
- }
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_BarGrouping = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_bargroupingVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_bargroupingPERCENTSTACKED: val.m_val = AscFormat.BAR_GROUPING_PERCENT_STACKED; break;
- case st_bargroupingCLUSTERED: val.m_val = AscFormat.BAR_GROUPING_CLUSTERED; break;
- case st_bargroupingSTANDARD: val.m_val = AscFormat.BAR_GROUPING_STANDARD; break;
- case st_bargroupingSTACKED: val.m_val = AscFormat.BAR_GROUPING_STACKED; break;
- }
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_BarSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_AreaSer = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_barserIDX === type) {
+ if (c_oserct_areaserIDX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -10039,7 +12536,7 @@ BinaryChartReader.prototype.ReadCT_BarSer = function (type, length, val) {
if (null != oNewVal.m_val)
val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_barserORDER === type) {
+ else if (c_oserct_areaserORDER === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
@@ -10047,39 +12544,31 @@ BinaryChartReader.prototype.ReadCT_BarSer = function (type, length, val) {
if (null != oNewVal.m_val)
val.setOrder(oNewVal.m_val);
}
- else if (c_oserct_barserTX === type) {
+ else if (c_oserct_areaserTX === type) {
var oNewVal = new AscFormat.CTx();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_SerTx(t, l, oNewVal);
});
val.setTx(oNewVal);
}
- else if (c_oserct_barserSPPR === type) {
+ else if (c_oserct_areaserSPPR === type) {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_barserINVERTIFNEGATIVE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setInvertIfNegative(oNewVal.m_val);
- }
- else if (c_oserct_barserPICTUREOPTIONS === type) {
+ else if (c_oserct_areaserPICTUREOPTIONS === type) {
var oNewVal = new AscFormat.CPictureOptions();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_PictureOptions(t, l, oNewVal);
});
val.setPictureOptions(oNewVal);
}
- else if (c_oserct_barserDPT === type) {
+ else if (c_oserct_areaserDPT === type) {
var oNewVal = new AscFormat.CDPt();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_DPt(t, l, oNewVal);
});
val.addDPt(oNewVal);
}
- else if (c_oserct_barserDLBLS === type) {
+ else if (c_oserct_areaserDLBLS === type) {
var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_DLbls(t, l, oNewVal);
@@ -10087,220 +12576,63 @@ BinaryChartReader.prototype.ReadCT_BarSer = function (type, length, val) {
oNewVal.correctValues();
val.setDLbls(oNewVal);
}
- else if (c_oserct_barserTRENDLINE === type) {
+ else if (c_oserct_areaserTRENDLINE === type) {
//todo array
var oNewVal = new AscFormat.CTrendLine();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Trendline(t, l, oNewVal);
});
- val.setTrendline(oNewVal);
- }
- else if (c_oserct_barserERRBARS === type) {
- var oNewVal = new AscFormat.CErrBars();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrBars(t, l, oNewVal);
- });
- val.addErrBars(oNewVal);
- }
- else if (c_oserct_barserCAT === type) {
- var oNewVal = new AscFormat.CCat();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
- });
- val.setCat(oNewVal);
- }
- else if (c_oserct_barserVAL === type) {
- var oNewVal = new AscFormat.CYVal();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
- });
- val.setVal(oNewVal);
- }
- else if (c_oserct_barserSHAPE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Shape(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setShape(oNewVal.m_val);
- }
- else if (c_oserct_barserEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
- }
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_ChartFiltering = function(type, length, val) {
- let res = c_oSerConstants.ReadOk;
- let oThis = this;
- if (c_oserct_dataLabelsRange === type) {
- var oNewVal = new AscFormat.CStrRef();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_dataLabelsRange(t, l, oNewVal);
- });
- val.setDataLabelsRange(oNewVal);
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_dataLabelsRange = function(type, length, val) {
- let res = c_oSerConstants.ReadOk;
- let oThis = this;
- if (0 === type) {
- val.setF(this.stream.GetString2LE(length));
- }
- else if(1 === type) {
- var oNewVal = new AscFormat.CStrCache();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StrData(t, l, oNewVal);
- });
- val.setStrCache(oNewVal);
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Shape = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_shapeVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_shapeCONE: val.m_val = AscFormat.BAR_SHAPE_CONE; break;
- case st_shapeCONETOMAX: val.m_val = AscFormat.BAR_SHAPE_CONETOMAX; break;
- case st_shapeBOX: val.m_val = AscFormat.BAR_SHAPE_BOX; break;
- case st_shapeCYLINDER: val.m_val = AscFormat.BAR_SHAPE_CYLINDER; break;
- case st_shapePYRAMID: val.m_val = AscFormat.BAR_SHAPE_PYRAMID; break;
- case st_shapePYRAMIDTOMAX: val.m_val = AscFormat.BAR_SHAPE_PYRAMIDTOMAX; break;
- }
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Overlap = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_overlapVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_BarChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_barchartBARDIR === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarDir(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setBarDir(oNewVal.m_val);
- }
- else if (c_oserct_barchartGROUPING === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarGrouping(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setGrouping(oNewVal.m_val);
- }
- else if (c_oserct_barchartVARYCOLORS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
- }
- else if (c_oserct_barchartSER === type) {
- var oNewVal = new AscFormat.CBarSeries();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarSer(t, l, oNewVal);
- });
- val.addSer(oNewVal);
- }
- else if (c_oserct_barchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
- }
- else if (c_oserct_barchartGAPWIDTH === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_GapAmount(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setGapWidth(oNewVal.m_val);
+ val.setTrendline(oNewVal);
}
- else if (c_oserct_barchartOVERLAP === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_areaserERRBARS === type) {
+ var oNewVal = new AscFormat.CErrBars();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Overlap(t, l, oNewVal);
+ return oThis.ReadCT_ErrBars(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setOverlap(oNewVal.m_val);
+ val.addErrBars(oNewVal);
}
- else if (c_oserct_barchartSERLINES === type) {
- //todo array
- var oNewVal = { spPr: null };
+ else if (c_oserct_areaserCAT === type) {
+ var oNewVal = new AscFormat.CCat();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_AxDataSource(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setSerLines(oNewVal.spPr);
- else
- val.setSerLines(new AscFormat.CSpPr());
+ val.setCat(oNewVal);
}
- else if (c_oserct_barchartAXID === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_areaserVAL === type) {
+ var oNewVal = new AscFormat.CYVal();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_NumDataSource(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ val.setVal(oNewVal);
}
- else if (c_oserct_barchartEXTLST === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_areaserEXTLST === type) {
+ var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_HoleSize = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_holesizeVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ else if(c_oserct_chartFiltering === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ChartFiltering(t, l, val);
+ });
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_DoughnutChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_AreaChart = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_doughnutchartVARYCOLORS === type) {
+ if (c_oserct_areachartGROUPING === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Grouping(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setGrouping(oNewVal.m_val);
+ }
+ else if (c_oserct_areachartVARYCOLORS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
@@ -10308,14 +12640,14 @@ BinaryChartReader.prototype.ReadCT_DoughnutChart = function (type, length, val,
if (null != oNewVal.m_val)
val.setVaryColors(oNewVal.m_val);
}
- else if (c_oserct_doughnutchartSER === type) {
- var oNewVal = new AscFormat.CPieSeries();
+ else if (c_oserct_areachartSER === type) {
+ var oNewVal = new AscFormat.CAreaSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PieSer(t, l, oNewVal);
+ return oThis.ReadCT_AreaSer(t, l, oNewVal);
});
val.addSer(oNewVal);
}
- else if (c_oserct_doughnutchartDLBLS === type) {
+ else if (c_oserct_areachartDLBLS === type) {
var oNewVal = new AscFormat.CDLbls();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_DLbls(t, l, oNewVal);
@@ -10323,23 +12655,25 @@ BinaryChartReader.prototype.ReadCT_DoughnutChart = function (type, length, val,
oNewVal.correctValues();
val.setDLbls(oNewVal);
}
- else if (c_oserct_doughnutchartFIRSTSLICEANG === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_areachartDROPLINES === type) {
+ var oNewVal = { spPr: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_FirstSliceAng(t, l, oNewVal);
+ return oThis.ReadCT_ChartLines(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setFirstSliceAng(oNewVal.m_val);
+ if (null != oNewVal.spPr)
+ val.setDropLines(oNewVal.spPr);
+ else
+ val.setDropLines(new AscFormat.CSpPr());
}
- else if (c_oserct_doughnutchartHOLESIZE === type) {
+ else if (c_oserct_areachartAXID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_HoleSize(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setHoleSize(oNewVal.m_val);
+ aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
}
- else if (c_oserct_doughnutchartEXTLST === type) {
+ else if (c_oserct_areachartEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -10350,271 +12684,238 @@ BinaryChartReader.prototype.ReadCT_DoughnutChart = function (type, length, val,
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_FirstSliceAng = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_PlotArea = function (type, length, val, aChartWithAxis) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_firstsliceangVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetULongLE();
- val.m_val = oNewVal;
+ if (c_oserct_plotareaLAYOUT === type) {
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Layout(t, l, val);
+ });
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Pie3DChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_pie3dchartVARYCOLORS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_plotareaAREA3DCHART === type) {
+ var oNewVal = new AscFormat.CAreaChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Area3DChart(t, l, oNewVal, aChartWithAxis);
});
- if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ val.addChart(oNewVal);
}
- else if (c_oserct_pie3dchartSER === type) {
- var oNewVal = new AscFormat.CPieSeries();
+ else if (c_oserct_plotareaAREACHART === type) {
+ var oNewVal = new AscFormat.CAreaChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PieSer(t, l, oNewVal);
+ return oThis.ReadCT_AreaChart(t, l, oNewVal, aChartWithAxis);
});
- val.addSer(oNewVal);
+ val.addChart(oNewVal);
}
- else if (c_oserct_pie3dchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_plotareaBAR3DCHART === type) {
+ var oNewVal = new AscFormat.CBarChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_Bar3DChart(t, l, oNewVal, aChartWithAxis);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ oNewVal.set3D(true);
+ //3d->2d
+ /*if (AscFormat.BAR_GROUPING_STANDARD == oNewVal.grouping)
+ oNewVal.setGrouping(AscFormat.BAR_GROUPING_CLUSTERED);
+ else if(AscFormat.BAR_GROUPING_CLUSTERED != oNewVal.grouping){
+ oNewVal.setOverlap(100);
+ }*/
+ val.addChart(oNewVal);
}
- else if (c_oserct_pie3dchartEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_plotareaBARCHART === type) {
+ var oNewVal = new AscFormat.CBarChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_BarChart(t, l, oNewVal, aChartWithAxis);
});
- // val.m_extLst = oNewVal;
+ val.addChart(oNewVal);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_PieChart = function (type, length, val, aChartWithAxis) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_piechartVARYCOLORS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_plotareaBUBBLECHART === type) {
+ var oNewVal = new AscFormat.CBubbleChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_BubbleChart(t, l, oNewVal, aChartWithAxis);
});
- if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ //bubble -> scatter
+ var scatter = oNewVal.convertToScutterChart();
+ this.CorrectChartWithAxis(oNewVal, scatter, aChartWithAxis);
+ val.addChart(scatter);
}
- else if (c_oserct_piechartSER === type) {
- var oNewVal = new AscFormat.CPieSeries();
+ else if (c_oserct_plotareaDOUGHNUTCHART === type) {
+ var oNewVal = new AscFormat.CDoughnutChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PieSer(t, l, oNewVal);
+ return oThis.ReadCT_DoughnutChart(t, l, oNewVal, aChartWithAxis);
});
- val.addSer(oNewVal);
+ val.addChart(oNewVal);
}
- else if (c_oserct_piechartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_plotareaLINE3DCHART === type) {
+ var oNewVal = new AscFormat.CLineChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_Line3DChart(t, l, oNewVal, aChartWithAxis);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ oNewVal.convert3Dto2D();
+ val.addChart(oNewVal);
}
- else if (c_oserct_piechartFIRSTSLICEANG === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_plotareaLINECHART === type) {
+ var oNewVal = new AscFormat.CLineChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_FirstSliceAng(t, l, oNewVal);
+ return oThis.ReadCT_LineChart(t, l, oNewVal, aChartWithAxis);
});
- if (null != oNewVal.m_val)
- val.setFirstSliceAng(oNewVal.m_val);
+ val.addChart(oNewVal);
}
- else if (c_oserct_piechartEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_plotareaOFPIECHART === type) {
+ var oNewVal = new AscFormat.COfPieChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_OfPieChart(t, l, oNewVal, aChartWithAxis);
});
- // val.m_extLst = oNewVal;
+ //ofPie -> pie
+ var pie = oNewVal.convertToPieChart();
+ this.CorrectChartWithAxis(oNewVal, pie, aChartWithAxis);
+ val.addChart(pie);
}
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_ScatterSer = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_scatterserIDX === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_plotareaPIE3DCHART === type) {
+ var oNewVal = new AscFormat.CPieChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Pie3DChart(t, l, oNewVal, aChartWithAxis);
});
- if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ oNewVal.set3D(true);
+ //3d->2d
+ // oNewVal.setFirstSliceAng(0);
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserORDER === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_plotareaPIECHART === type) {
+ var oNewVal = new AscFormat.CPieChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_PieChart(t, l, oNewVal, aChartWithAxis);
});
- if (null != oNewVal.m_val)
- val.setOrder(oNewVal.m_val);
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserTX === type) {
- var oNewVal = new AscFormat.CTx();
+ else if (c_oserct_plotareaRADARCHART === type) {
+ var oNewVal = new AscFormat.CRadarChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SerTx(t, l, oNewVal);
+ return oThis.ReadCT_RadarChart(t, l, oNewVal, aChartWithAxis);
});
- val.setTx(oNewVal);
+ //radar -> line
+ //var line = this.ConvertRadarToLine(oNewVal, aChartWithAxis);
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ else if (c_oserct_plotareaSCATTERCHART === type) {
+ var oNewVal = new AscFormat.CScatterChart();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_ScatterChart(t, l, oNewVal, aChartWithAxis);
+ });
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserMARKER === type) {
- var oNewVal = new AscFormat.CMarker();
+ else if (c_oserct_plotareaSTOCKCHART === type) {
+ var oNewVal = new AscFormat.CStockChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Marker(t, l, oNewVal);
+ return oThis.ReadCT_StockChart(t, l, oNewVal, aChartWithAxis);
});
- val.setMarker(oNewVal);
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserDPT === type) {
- var oNewVal = new AscFormat.CDPt();
+ else if (c_oserct_plotareaSURFACE3DCHART === type) {
+ var oNewVal = new AscFormat.CSurfaceChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DPt(t, l, oNewVal);
+ return oThis.ReadCT_Surface3DChart(t, l, oNewVal, aChartWithAxis);
});
- val.addDPt(oNewVal);
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_plotareaSURFACECHART === type) {
+ var oNewVal = new AscFormat.CSurfaceChart();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_SurfaceChart(t, l, oNewVal, aChartWithAxis);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ val.addChart(oNewVal);
}
- else if (c_oserct_scatterserTRENDLINE === type) {
- //todo array
- var oNewVal = new AscFormat.CTrendLine();
+ else if (c_oserct_plotareaCATAX === type) {
+ var oNewVal = new AscFormat.CCatAx();
+
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Trendline(t, l, oNewVal);
+ return oThis.ReadCT_CatAx(t, l, oNewVal);
});
- val.setTrendline(oNewVal);
+ val.addAxis(oNewVal);
}
- else if (c_oserct_scatterserERRBARS === type) {
- var oNewVal = new AscFormat.CErrBars();
+ else if (c_oserct_plotareaDATEAX === type) {
+ var oNewVal = new AscFormat.CDateAx();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrBars(t, l, oNewVal);
+ return oThis.ReadCT_DateAx(t, l, oNewVal);
});
- val.addErrBars(oNewVal);
+ val.addAxis(oNewVal);
}
- else if (c_oserct_scatterserXVAL === type) {
- var oNewVal = new AscFormat.CCat();
+ else if (c_oserct_plotareaSERAX === type) {
+ var oNewVal = new AscFormat.CSerAx();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ return oThis.ReadCT_SerAx(t, l, oNewVal);
});
- val.setXVal(oNewVal);
+ val.addAxis(oNewVal);
}
- else if (c_oserct_scatterserYVAL === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_plotareaVALAX === type) {
+ var oNewVal = new AscFormat.CValAx();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_ValAx(t, l, oNewVal);
});
- val.setYVal(oNewVal);
+ val.addAxis(oNewVal);
+ //if(!AscFormat.isRealNumber(oNewVal.crossBetween))
+ //{
+ // oNewVal.setCrossBetween(AscFormat.CROSS_BETWEEN_BETWEEN);
+ //}
}
- else if (c_oserct_scatterserSMOOTH === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_plotareaDTABLE === type) {
+ var oNewVal = new AscFormat.CDTable();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_DTable(t, l, oNewVal);
});
- if (null != oNewVal.m_val){
- val.setSmooth(oNewVal.m_val);
- }
- else{
- val.setSmooth(true);
- }
+ val.setDTable(oNewVal);
}
- else if (c_oserct_scatterserEXTLST === type) {
+ else if (c_oserct_plotareaSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_plotareaEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
// val.m_extLst = oNewVal;
}
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
+ else if (c_oserct_plotareaPLOTAREAREGION === type) {
+ var oNewVal = new AscFormat.CPlotAreaRegion();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_PlotAreaRegion(t, l, oNewVal);
+ });
+ val.setPlotAreaRegion(oNewVal);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ScatterStyle = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Thickness = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_scatterstyleVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_scatterstyleNONE: val.m_val = AscFormat.SCATTER_STYLE_NONE; break;
- case st_scatterstyleLINE: val.m_val = AscFormat.SCATTER_STYLE_LINE; break;
- case st_scatterstyleLINEMARKER: val.m_val = AscFormat.SCATTER_STYLE_LINE_MARKER; break;
- case st_scatterstyleMARKER: val.m_val = AscFormat.SCATTER_STYLE_MARKER; break;
- case st_scatterstyleSMOOTH: val.m_val = AscFormat.SCATTER_STYLE_SMOOTH; break;
- case st_scatterstyleSMOOTHMARKER: val.m_val = AscFormat.SCATTER_STYLE_SMOOTH_MARKER; break;
- }
+ if (c_oserct_thicknessVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_ScatterChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_Surface = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_scatterchartSCATTERSTYLE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ScatterStyle(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setScatterStyle(oNewVal.m_val);
- }
- else if (c_oserct_scatterchartVARYCOLORS === type) {
+ if (c_oserct_surfaceTHICKNESS === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Thickness(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
- }
- else if (c_oserct_scatterchartSER === type) {
- var oNewVal = new AscFormat.CScatterSeries();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ScatterSer(t, l, oNewVal);
- });
- val.addSer(oNewVal);
- if(oNewVal.smooth === null){
- oNewVal.setSmooth(false);
- }
+ val.setThickness(oNewVal.m_val);
}
- else if (c_oserct_scatterchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ else if (c_oserct_surfaceSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_scatterchartAXID === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_surfacePICTUREOPTIONS === type) {
+ var oNewVal = new AscFormat.CPictureOptions();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_PictureOptions(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ val.setPictureOptions(oNewVal);
}
- else if (c_oserct_scatterchartEXTLST === type) {
+ else if (c_oserct_surfaceEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -10625,145 +12926,120 @@ BinaryChartReader.prototype.ReadCT_ScatterChart = function (type, length, val, a
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_RadarSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Perspective = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_radarserIDX === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
- }
- else if (c_oserct_radarserORDER === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setOrder(oNewVal.m_val);
- }
- else if (c_oserct_radarserTX === type) {
- var oNewVal = new AscFormat.CTx();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SerTx(t, l, oNewVal);
- });
- val.setTx(oNewVal);
- }
- else if (c_oserct_radarserSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
- }
- else if (c_oserct_radarserMARKER === type) {
- var oNewVal = new AscFormat.CMarker();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Marker(t, l, oNewVal);
- });
- val.setMarker(oNewVal);
- }
- else if (c_oserct_radarserDPT === type) {
- var oNewVal = new AscFormat.CDPt();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DPt(t, l, oNewVal);
- });
- val.addDPt(oNewVal);
- }
- else if (c_oserct_radarserDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
- }
- else if (c_oserct_radarserCAT === type) {
- var oNewVal = new AscFormat.CCat();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
- });
- val.setCat(oNewVal);
+ if (c_oserct_perspectiveVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetUChar();
+ val.m_val = oNewVal;
}
- else if (c_oserct_radarserVAL === type) {
- var oNewVal = new AscFormat.CYVal();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
- });
- val.setVal(oNewVal);
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DepthPercent = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_depthpercentVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetString2LE(length);
+ val.m_val = oNewVal;
}
- else if (c_oserct_radarserEXTLST === type) {
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_RotY = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_rotyVAL === type) {
var oNewVal;
- oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
+ oNewVal = this.stream.GetULongLE();
+ val.m_val = oNewVal;
}
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_HPercent = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_hpercentVAL === type) {
+ val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_RadarStyle = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_RotX = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_radarstyleVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_radarstyleSTANDARD: val.m_val = RADAR_STYLE_STANDARD; break;
- case st_radarstyleMARKER: val.m_val = RADAR_STYLE_MARKER; break;
- case st_radarstyleFILLED: val.m_val = RADAR_STYLE_FILLED; break;
- }
+ if (c_oserct_rotxVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetChar();
+ val.m_val = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_RadarChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_View3D = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_radarchartRADARSTYLE === type) {
+ if (c_oserct_view3dROTX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_RadarStyle(t, l, oNewVal);
+ return oThis.ReadCT_RotX(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setRadarStyle(oNewVal.m_val);
+ val.setRotX(oNewVal.m_val);
}
- else if (c_oserct_radarchartVARYCOLORS === type) {
+ else if (c_oserct_view3dHPERCENT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_HPercent(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ val.setHPercent(oNewVal.m_val);
}
- else if (c_oserct_radarchartSER === type) {
- var oNewVal = new AscFormat.CRadarSeries();
+ else if (c_oserct_view3dROTY === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_RadarSer(t, l, oNewVal);
+ return oThis.ReadCT_RotY(t, l, oNewVal);
});
- val.addSer(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setRotY(oNewVal.m_val);
}
- else if (c_oserct_radarchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_view3dDEPTHPERCENT === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_DepthPercent(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ if (null != oNewVal.m_val){
+ var nPercent = parseInt(oNewVal.m_val)
+ if(AscFormat.isRealNumber(nPercent)){
+ val.setDepthPercent(nPercent);
+ }
+ }
}
- else if (c_oserct_radarchartAXID === type) {
+ else if (c_oserct_view3dRANGAX === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ val.setRAngAx(oNewVal.m_val);
}
- else if (c_oserct_radarchartEXTLST === type) {
+ else if (c_oserct_view3dPERSPECTIVE === type) {
+ var oNewVal = { m_val: null };
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Perspective(t, l, oNewVal);
+ });
+ if (null != oNewVal.m_val)
+ val.setPerspective(oNewVal.m_val);
+ }
+ else if (c_oserct_view3dEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -10774,60 +13050,40 @@ BinaryChartReader.prototype.ReadCT_RadarChart = function (type, length, val, aCh
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_StockChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_PivotFmt = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_stockchartSER === type) {
- var oNewVal = new AscFormat.CLineSeries();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LineSer(t, l, oNewVal);
- });
- val.addSer(oNewVal);
- }
- else if (c_oserct_stockchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ if (c_oserct_pivotfmtIDX === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setIdx(oNewVal.m_val);
}
- else if (c_oserct_stockchartDROPLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setDropLines(oNewVal.spPr);
- else
- val.setDropLines(new AscFormat.CSpPr());
+ else if (c_oserct_pivotfmtSPPR === type) {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_stockchartHILOWLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setHiLowLines(oNewVal.spPr);
- else
- val.setHiLowLines(new AscFormat.CSpPr());
+ else if (c_oserct_pivotfmtTXPR === type) {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
}
- else if (c_oserct_stockchartUPDOWNBARS === type) {
- var oNewVal = new AscFormat.CUpDownBars();
+ else if (c_oserct_pivotfmtMARKER === type) {
+ var oNewVal = new AscFormat.CMarker();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UpDownBars(t, l, oNewVal);
+ return oThis.ReadCT_Marker(t, l, oNewVal);
});
- val.setUpDownBars(oNewVal);
+ val.setMarker(oNewVal);
}
- else if (c_oserct_stockchartAXID === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_pivotfmtDLBL === type) {
+ var oNewVal = new AscFormat.CDLbl();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_DLbl(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ oNewVal.correctValues();
+ val.setLbl(oNewVal);
}
- else if (c_oserct_stockchartEXTLST === type) {
+ else if (c_oserct_pivotfmtEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -10838,146 +13094,118 @@ BinaryChartReader.prototype.ReadCT_StockChart = function (type, length, val, aCh
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LineSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_pivotFmts = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_lineserIDX === type) {
- var oNewVal = { m_val: null };
+ if (c_oserct_pivotfmtsPIVOTFMT === type) {
+ var oNewVal = new AscFormat.CPivotFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_PivotFmt(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ val.setPivotFmts(oNewVal);
}
- else if (c_oserct_lineserORDER === type) {
- var oNewVal = { m_val: null };
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Chart = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_chartTITLE === type) {
+ var oNewVal = new AscFormat.CTitle();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Title(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setOrder(oNewVal.m_val);
+ val.setTitle(oNewVal);
}
- else if (c_oserct_lineserTX === type) {
- var oNewVal = new AscFormat.CTx();
+ else if (c_oserct_chartAUTOTITLEDELETED === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SerTx(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- val.setTx(oNewVal);
- }
- else if (c_oserct_lineserSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
+ if (null != oNewVal.m_val)
+ val.setAutoTitleDeleted(oNewVal.m_val);
+ else
+ val.setAutoTitleDeleted(true);
}
- else if (c_oserct_lineserMARKER === type) {
- var oNewVal = new AscFormat.CMarker();
+ else if (c_oserct_chartPIVOTFMTS === type) {
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Marker(t, l, oNewVal);
+ return oThis.ReadCT_pivotFmts(t, l, val);
});
- val.setMarker(oNewVal);
}
- else if (c_oserct_lineserDPT === type) {
- var oNewVal = new AscFormat.CDPt();
+ else if (c_oserct_chartVIEW3D === type) {
+ var oNewVal = new AscFormat.CView3d();
+
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DPt(t, l, oNewVal);
+ return oThis.ReadCT_View3D(t, l, oNewVal);
});
- val.addDPt(oNewVal);
+ val.setView3D(oNewVal);
}
- else if (c_oserct_lineserDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_chartFLOOR === type) {
+ var oNewVal = new AscFormat.CChartWall();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_Surface(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ val.setFloor(oNewVal);
}
- else if (c_oserct_lineserTRENDLINE === type) {
- //todo array
- var oNewVal = new AscFormat.CTrendLine();
+ else if (c_oserct_chartSIDEWALL === type) {
+ var oNewVal = new AscFormat.CChartWall();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Trendline(t, l, oNewVal);
+ return oThis.ReadCT_Surface(t, l, oNewVal);
});
- val.setTrendline(oNewVal);
+ val.setSideWall(oNewVal);
}
- else if (c_oserct_lineserERRBARS === type) {
- var oNewVal = new AscFormat.CErrBars();
+ else if (c_oserct_chartBACKWALL === type) {
+ var oNewVal = new AscFormat.CChartWall();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrBars(t, l, oNewVal);
+ return oThis.ReadCT_Surface(t, l, oNewVal);
});
- val.addErrBars(oNewVal);
+ val.setBackWall(oNewVal);
}
- else if (c_oserct_lineserCAT === type) {
- var oNewVal = new AscFormat.CCat();
+ else if (c_oserct_chartPLOTAREA === type) {
+ var oNewVal = new AscFormat.CPlotArea();
+ var aChartWithAxis = [];
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ return oThis.ReadCT_PlotArea(t, l, oNewVal, aChartWithAxis);
});
- val.setCat(oNewVal);
+ oNewVal.initPostOpen(aChartWithAxis);
+ val.setPlotArea(oNewVal);
}
- else if (c_oserct_lineserVAL === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_chartLEGEND === type) {
+ var oNewVal = new AscFormat.CLegend();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_Legend(t, l, oNewVal);
});
- val.setVal(oNewVal);
+ oNewVal.updateLegendPos();
+ val.setLegend(oNewVal);
}
- else if (c_oserct_lineserSMOOTH === type) {
+ else if (c_oserct_chartPLOTVISONLY === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if (null != oNewVal.m_val) {
- val.setSmooth(oNewVal.m_val);
- }
- else {
- val.setSmooth(true);
- }
- }
- else if (c_oserct_lineserEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
- }
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_UpDownBars = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_updownbarsGAPWIDTH === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_GapAmount(t, l, oNewVal);
- });
if (null != oNewVal.m_val)
- val.setGapWidth(oNewVal.m_val);
+ val.setPlotVisOnly(oNewVal.m_val);
}
- else if (c_oserct_updownbarsUPBARS === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_chartDISPBLANKSAS === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UpDownBar(t, l, oNewVal);
+ return oThis.ReadCT_DispBlanksAs(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setUpBars(oNewVal.spPr);
- else
- val.setUpBars(new AscFormat.CSpPr());
+ if (null != oNewVal.m_val)
+ val.setDispBlanksAs(oNewVal.m_val);
}
- else if (c_oserct_updownbarsDOWNBARS === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_chartSHOWDLBLSOVERMAX === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UpDownBar(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setDownBars(oNewVal.spPr);
+ if (null != oNewVal.m_val)
+ val.setShowDLblsOverMax(oNewVal.m_val);
else
- val.setDownBars(new AscFormat.CSpPr());
+ val.setShowDLblsOverMax(true);
}
- else if (c_oserct_updownbarsEXTLST === type) {
+ else if (c_oserct_chartEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
@@ -10988,1070 +13216,1393 @@ BinaryChartReader.prototype.ReadCT_UpDownBars = function (type, length, val) {
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_UpDownBar = function (type, length, val) {
- var res = c_oSerConstants.ReadOk;
- var oThis = this;
- if (c_oserct_updownbarSPPR === type) {
- val.spPr = this.ReadSpPr(length);
- }
- else
- res = c_oSerConstants.ReadUnknown;
- return res;
-};
-BinaryChartReader.prototype.ReadCT_Line3DChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_Protection = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_line3dchartGROUPING === type) {
+ if (c_oserct_protectionCHARTOBJECT === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Grouping(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setGrouping(oNewVal.m_val);
+ val.setChartObject(oNewVal.m_val);
}
- else if (c_oserct_line3dchartVARYCOLORS === type) {
+ else if (c_oserct_protectionDATA === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ val.setData(oNewVal.m_val);
}
- else if (c_oserct_line3dchartSER === type) {
- var oNewVal = new AscFormat.CLineSeries();
+ else if (c_oserct_protectionFORMATTING === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LineSer(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if(oNewVal.smooth === null){
- oNewVal.setSmooth(false);
- }
- val.addSer(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setFormatting(oNewVal.m_val);
}
- else if (c_oserct_line3dchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_protectionSELECTION === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ if (null != oNewVal.m_val)
+ val.setSelection(oNewVal.m_val);
}
- else if (c_oserct_line3dchartDROPLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_protectionUSERINTERFACE === type) {
+ var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setDropLines(oNewVal.spPr);
- else
- val.setDropLines(new AscFormat.CSpPr());
+ if (null != oNewVal.m_val)
+ val.setUserInterface(oNewVal.m_val);
}
- else if (c_oserct_line3dchartGAPDEPTH === type) {
- var oNewVal;
- oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_GapAmount(t, l, oNewVal);
- });
- //val.m_gapDepth = oNewVal;
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PivotSource = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_pivotsourceNAME === type) {
+ val.setName(this.stream.GetString2LE(length));
}
- else if (c_oserct_line3dchartAXID === type) {
+ else if (c_oserct_pivotsourceFMTID === type) {
var oNewVal = { m_val: null };
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
});
if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ val.setFmtId(oNewVal.m_val);
}
- else if (c_oserct_line3dchartEXTLST === type) {
+ else if (c_oserct_pivotsourceEXTLST === type) {
var oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_extLst(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ // if (null == val.m_extLst)
+ // val.m_extLst = [];
+ // val.m_extLst.push(oNewVal);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_Grouping = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Style1 = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_groupingVAL === type) {
- switch (this.stream.GetUChar()) {
- case st_groupingPERCENTSTACKED: val.m_val = AscFormat.GROUPING_PERCENT_STACKED; break;
- case st_groupingSTANDARD: val.m_val = AscFormat.GROUPING_STANDARD; break;
- case st_groupingSTACKED: val.m_val = AscFormat.GROUPING_STACKED; break;
- }
+ if (c_oserct_style1VAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetUChar();
+ val.m_val = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
-BinaryChartReader.prototype.ReadCT_LineChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_Style = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_linechartGROUPING === type) {
- var oNewVal = { m_val: null };
+ if (c_oserct_styleVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetUChar();
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_TextLanguageID = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_textlanguageidVAL === type) {
+ var oNewVal;
+ oNewVal = this.stream.GetString2LE(length);
+ val.m_val = oNewVal;
+ }
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_Axis = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExAxisID === type)
+ {
+ val.setAxId(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExAxisHIDDEN === type)
+ {
+ val.setHidden(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExAxisCATSCALING === type)
+ {
+ var oNewVal = new AscFormat.CCategoryAxisScaling();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Grouping(t, l, oNewVal);
+ return oThis.ReadCT_CategoryAxisScaling(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setGrouping(oNewVal.m_val);
+ val.setScaling(oNewVal);
}
- else if (c_oserct_linechartVARYCOLORS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExAxisVALSCALING === type)
+ {
+ var oNewVal = new AscFormat.CValueAxisScaling();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_ValueAxisScaling(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ val.setScaling(oNewVal);
}
- else if (c_oserct_linechartSER === type) {
- var oNewVal = new AscFormat.CLineSeries();
+ else if (c_oserct_chartExAxisTITLE === type)
+ {
+ var oNewVal = new AscFormat.CTitle();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LineSer(t, l, oNewVal);
+ return oThis.ReadCT_ChartExTitle(t, l, oNewVal);
});
- val.addSer(oNewVal);
- if(oNewVal.smooth === null){
- oNewVal.setSmooth(false);
- }
+ val.setTitle(oNewVal);
}
- else if (c_oserct_linechartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
+ else if (c_oserct_chartExAxisUNIT === type)
+ {
+ var oNewVal = new AscFormat.CAxisUnits();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
+ return oThis.ReadCT_AxisUnits(t, l, oNewVal);
});
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ val.setUnits(oNewVal);
}
- else if (c_oserct_linechartDROPLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_chartExAxisNUMFMT === type)
+ {
+ var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_ChartExNumFmt(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setDropLines(oNewVal.spPr);
- else
- val.setDropLines(new AscFormat.CSpPr());
+ val.setNumFmt(oNewVal);
}
- else if (c_oserct_linechartHILOWLINES === type) {
- var oNewVal = { spPr: null };
+ else if (c_oserct_chartExAxisMAJORTICK === type)
+ {
+ var oNewVal = new AscFormat.CTickMarks();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_TickMarks(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setHiLowLines(oNewVal.spPr);
- else
- val.setHiLowLines(new AscFormat.CSpPr());
+ val.setMajorTickMark(oNewVal);
}
- else if (c_oserct_linechartUPDOWNBARS === type) {
- var oNewVal = new AscFormat.CUpDownBars();
+ else if (c_oserct_chartExAxisMINORTICK === type)
+ {
+ var oNewVal = new AscFormat.CTickMarks();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UpDownBars(t, l, oNewVal);
+ return oThis.ReadCT_TickMarks(t, l, oNewVal);
});
- val.setUpDownBars(oNewVal);
+ val.setMinorTickMark(oNewVal);
}
- else if (c_oserct_linechartMARKER === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExAxisMAJORGRID === type)
+ {
+ var oNewVal = new AscFormat.CGridlines();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Gridlines(t, l, oNewVal);
+ });
+ val.setMajorGridlines(oNewVal);
+ }
+ else if (c_oserct_chartExAxisMINORGRID === type)
+ {
+ var oNewVal = new AscFormat.CGridlines();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Gridlines(t, l, oNewVal);
+ });
+ val.setMinorGridlines(oNewVal);
+ }
+ else if (c_oserct_chartExAxisTICKLABELS === type)
+ {
+ val.setTickLabels(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExAxisTXPR === type)
+ {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_chartExAxisSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartData = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExDATA === type) {
+ var oNewVal = new AscFormat.CData();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Data(t, l, oNewVal);
+ });
+ val.addData(oNewVal);
+ }
+ // else if (c_oserct_chartExEXTERNALDATA === type)
+ // {
+ // var oNewVal = new AscFormat.CExternalData();
+ // res = this.bcr.Read1(length, function (t, l) {
+ // return oThis.ReadCT_ChartExExternalData(t, l, oNewVal);
+ // });
+ // val.setExternalData(oNewVal);
+ // }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartExExternalData = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ if (c_oserct_chartExExternalAUTOUPDATE === type) {
+ var oNewVal;
+ oNewVal = {};
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadCT_Boolean(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setMarker(oNewVal.m_val);
+ val.m_autoUpdate = oNewVal;
}
- else if (c_oserct_linechartSMOOTH === type) {
- var oNewVal = { m_val: null };
+ else
+ res = c_oSerConstants.ReadUnknown;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartEx = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExChartPLOTAREA === type)
+ {
+ var oNewVal = new AscFormat.CPlotArea();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_ChartExPlotArea(t, l, oNewVal);
});
- if (null != oNewVal.m_val){
- val.setSmooth(oNewVal.m_val);
- }
- else{
- val.setSmooth(true);
+ if (oNewVal && oNewVal.axId && Array.isArray(oNewVal.axId)) {
+ for (let i = 0; i < oNewVal.axId.length; i++) {
+ const axis = oNewVal.axId[i];
+ const start = (oNewVal.axId.length > 1) ? i : i + 1;
+ axis.initializeAxPos(start);
+ }
+ if (oNewVal.axId.length === 2) {
+ oNewVal.axId[0].setCrossAx(oNewVal.axId[1]);
+ oNewVal.axId[1].setCrossAx(oNewVal.axId[0]);
+ }
+ if (oNewVal.axId.length === 1) {
+ oNewVal.axId[0].setCrossAx(oNewVal.axId[0]);
+ }
}
+ val.setPlotArea(oNewVal);
}
- else if (c_oserct_linechartAXID === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExChartTITLE === type)
+ {
+ var oNewVal = new AscFormat.CTitle();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_ChartExTitle(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ val.setTitle(oNewVal);
}
- else if (c_oserct_linechartEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_chartExChartLEGEND === type)
+ {
+ var oNewVal = new AscFormat.CLegend();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_ChartExLegend(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.setLegend(oNewVal);
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Area3DChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_ChartExPlotArea = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_area3dchartGROUPING === type) {
- var oNewVal = { m_val: null };
+ var oNewVal;
+ if (c_oserct_chartExChartAREAREGION === type)
+ {
+ var oNewVal = new AscFormat.CPlotAreaRegion();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Grouping(t, l, oNewVal);
+ return oThis.ReadCT_PlotAreaRegion(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setGrouping(oNewVal.m_val);
+ val.setPlotAreaRegion(oNewVal);
}
- else if (c_oserct_area3dchartVARYCOLORS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExChartAXIS === type) {
+ var oNewVal = new AscFormat.CAxis();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
+ return oThis.ReadCT_Axis(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ val.addAxis(oNewVal);
}
- else if (c_oserct_area3dchartSER === type) {
- var oNewVal = new AscFormat.CAreaSeries();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AreaSer(t, l, oNewVal);
- });
- val.addSer(oNewVal);
+ else if (c_oserct_chartExChartSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_area3dchartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_area3dchartDROPLINES === type) {
- var oNewVal = { spPr: null };
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PlotAreaRegion = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExAreaPLOTSURFACE === type)
+ {
+ var oNewVal = new AscFormat.CPlotSurface();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
+ return oThis.ReadCT_PlotSurface(t, l, oNewVal);
});
- if (null != oNewVal.spPr)
- val.setDropLines(oNewVal.spPr);
- else
- val.setDropLines(new AscFormat.CSpPr());
+ val.setPlotSurface(oNewVal);
}
- else if (c_oserct_area3dchartGAPDEPTH === type) {
- var oNewVal;
- oNewVal = {};
+ else if (c_oserct_chartExAreaSERIES === type) {
+ var oNewVal = new AscFormat.CSeries();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_GapAmount(t, l, oNewVal);
+ return oThis.ReadCT_Series(t, l, oNewVal);
});
- //val.m_gapDepth = oNewVal;
+ val.addSeries(oNewVal);
}
- else if (c_oserct_area3dchartAXID === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_area3dchartEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PlotSurface = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExPlotSurfaceSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_AreaSer = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_SeriesLayout = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_serieslayoutBOXWHISKER: val = AscFormat.SERIES_LAYOUT_BOX_WHISKER; break;
+ case st_serieslayoutCLUSTEREDCOLUMN: val = AscFormat.SERIES_LAYOUT_CLUSTERED_COLUMN; break;
+ case st_serieslayoutFUNNEL: val = AscFormat.SERIES_LAYOUT_FUNNEL; break;
+ case st_serieslayoutPARETOLINE: val = AscFormat.SERIES_LAYOUT_PARETO_LINE; break;
+ case st_serieslayoutREGIONMAP: val = AscFormat.SERIES_LAYOUT_REGION_MAP; break;
+ case st_serieslayoutSUNBURST: val = AscFormat.SERIES_LAYOUT_SUNBURST; break;
+ case st_serieslayoutTREEMAP: val = AscFormat.SERIES_LAYOUT_TREEMAP; break;
+ case st_serieslayoutWATERFALL:
+ default: val = AscFormat.SERIES_LAYOUT_WATERFALL; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_Series = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_areaserIDX === type) {
- var oNewVal = { m_val: null };
+ var oNewVal;
+ if (c_oserct_chartExSeriesDATAPT === type) {
+ var oNewVal = new AscFormat.CDataPoint();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_DataPoint(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ val.addDataPt(oNewVal);
}
- else if (c_oserct_areaserORDER === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExSeriesDATALABELS === type)
+ {
+ var oNewVal = new AscFormat.CDataLabels();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_DataLabels(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setOrder(oNewVal.m_val);
+ val.setDataLabels(oNewVal);
}
- else if (c_oserct_areaserTX === type) {
- var oNewVal = new AscFormat.CTx();
+ else if (c_oserct_chartExSeriesLAYOUTPROPS === type)
+ {
+ var oNewVal = new AscFormat.CSeriesLayoutProperties();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SerTx(t, l, oNewVal);
+ return oThis.ReadCT_SeriesLayoutProperties(t, l, oNewVal);
+ });
+ val.setLayoutPr(oNewVal);
+ }
+ else if (c_oserct_chartExSeriesTEXT === type)
+ {
+ var oNewVal = new AscFormat.CChartText();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Text(t, l, oNewVal);
});
+ oNewVal.setChart(this.curChart);
val.setTx(oNewVal);
}
- else if (c_oserct_areaserSPPR === type) {
+ else if (c_oserct_chartExSeriesAXIS === type) {
+ val.addAxisId(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExSeriesDATAID === type)
+ {
+ val.setDataId(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExSeriesSPPR === type)
+ {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_areaserPICTUREOPTIONS === type) {
- var oNewVal = new AscFormat.CPictureOptions();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PictureOptions(t, l, oNewVal);
- });
- val.setPictureOptions(oNewVal);
+ else if (c_oserct_chartExSeriesLAYOUTID === type)
+ {
+ val.setLayoutId(oThis.ReadCT_SeriesLayout());
+ }
+ else if (c_oserct_chartExSeriesHIDDEN === type)
+ {
+ val.setHidden(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExSeriesOWNERIDX === type)
+ {
+ val.setOwnerIdx(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExSeriesFORMATIDX === type)
+ {
+ val.setFormatIdx(this.stream.GetULongLE());
}
- else if (c_oserct_areaserDPT === type) {
- var oNewVal = new AscFormat.CDPt();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DPt(t, l, oNewVal);
- });
- val.addDPt(oNewVal);
+ else if (c_oserct_chartExSeriesUNIQUEID === type)
+ {
+ val.setUniqueId(this.stream.GetString2LE(length));
}
- else if (c_oserct_areaserDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_areaserTRENDLINE === type) {
- //todo array
- var oNewVal = new AscFormat.CTrendLine();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Trendline(t, l, oNewVal);
- });
- val.setTrendline(oNewVal);
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DataPoint = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExDataPointIDX === type)
+ {
+ val.setIdx(this.stream.GetULongLE());
}
- else if (c_oserct_areaserERRBARS === type) {
- var oNewVal = new AscFormat.CErrBars();
+ else if (c_oserct_chartExDataPointSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DataLabels = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExDataLabelsPOS === type)
+ {
+ val.setPos(oThis.ReadCT_DataLabelPos());
+ }
+ else if (c_oserct_chartExDataLabelsNUMFMT === type)
+ {
+ var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ErrBars(t, l, oNewVal);
+ return oThis.ReadCT_ChartExNumFmt(t, l, oNewVal);
});
- val.addErrBars(oNewVal);
+ val.setNumFmt(oNewVal);
}
- else if (c_oserct_areaserCAT === type) {
- var oNewVal = new AscFormat.CCat();
+ else if (c_oserct_chartExDataLabelsTXPR === type)
+ {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_chartExDataLabelsSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_chartExDataLabelsVISABILITIES === type)
+ {
+ var oNewVal = new AscFormat.CDataLabelVisibilities();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AxDataSource(t, l, oNewVal);
+ return oThis.ReadCT_DataLabelVisibilities(t, l, oNewVal);
});
- val.setCat(oNewVal);
+ val.setVisibility(oNewVal);
}
- else if (c_oserct_areaserVAL === type) {
- var oNewVal = new AscFormat.CYVal();
+ else if (c_oserct_chartExDataLabelsSEPARATOR === type)
+ {
+ val.setSeparator(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_chartExDataLabelsDATALABEL === type) {
+ var oNewVal = new AscFormat.CDataLabel();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_NumDataSource(t, l, oNewVal);
+ return oThis.ReadCT_DataLabel(t, l, oNewVal);
});
- val.setVal(oNewVal);
+ val.addDataLabel(oNewVal);
}
- else if (c_oserct_areaserEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_chartExDataLabelsDATALABELHIDDEN === type) {
+ var oNewVal = new AscFormat.CDataLabelHidden();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_DataLabelHidden(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.addDataLabelHidden(oNewVal);
}
- else if(c_oserct_chartFiltering === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartFiltering(t, l, val);
- });
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartExNumFmt = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExNumberFormatFORMATCODE === type) {
+ val.setFormatCode(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_chartExNumberFormatSOURCELINKED === type) {
+ val.setSourceLinked(this.stream.GetBool());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_AreaChart = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_DataLabelPos = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_datalabelposBESTFIT: val = AscFormat.DATA_LABEL_POS_BEST_FIT; break;
+ case st_datalabelposB: val = AscFormat.DATA_LABEL_POS_B; break;
+ case st_datalabelposCTR: val = AscFormat.DATA_LABEL_POS_CTR; break;
+ case st_datalabelposINBASE: val = AscFormat.DATA_LABEL_POS_IN_BASE; break;
+ case st_datalabelposINEND: val = AscFormat.DATA_LABEL_POS_IN_END; break;
+ case st_datalabelposL: val = AscFormat.DATA_LABEL_POS_L; break;
+ case st_datalabelposOUTEND: val = AscFormat.DATA_LABEL_POS_OUT_END; break;
+ case st_datalabelposR: val = AscFormat.DATA_LABEL_POS_R; break;
+ case st_datalabelposT:
+ default: val = AscFormat.DATA_LABEL_POS_T; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_DataLabel = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_areachartGROUPING === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Grouping(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setGrouping(oNewVal.m_val);
+ var oNewVal;
+ if (c_oserct_chartExDataLabelIDX === type)
+ {
+ val.setIdx(this.stream.GetULongLE());
}
- else if (c_oserct_areachartVARYCOLORS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setVaryColors(oNewVal.m_val);
+ else if (c_oserct_chartExDataLabelPOS === type)
+ {
+ val.setPos(oThis.ReadCT_DataLabelPos());
}
- else if (c_oserct_areachartSER === type) {
- var oNewVal = new AscFormat.CAreaSeries();
+ else if (c_oserct_chartExDataLabelNUMFMT === type)
+ {
+ var oNewVal = new AscFormat.CNumFmt();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AreaSer(t, l, oNewVal);
+ return oThis.ReadCT_ChartExNumFmt(t, l, oNewVal);
});
- val.addSer(oNewVal);
+ val.setNumFmt(oNewVal);
}
- else if (c_oserct_areachartDLBLS === type) {
- var oNewVal = new AscFormat.CDLbls();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbls(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setDLbls(oNewVal);
+ else if (c_oserct_chartExDataLabelTXPR === type)
+ {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
}
- else if (c_oserct_areachartDROPLINES === type) {
- var oNewVal = { spPr: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ChartLines(t, l, oNewVal);
- });
- if (null != oNewVal.spPr)
- val.setDropLines(oNewVal.spPr);
- else
- val.setDropLines(new AscFormat.CSpPr());
+ else if (c_oserct_chartExDataLabelSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_areachartAXID === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExDataLabelVISABILITIES === type)
+ {
+ var oNewVal = new AscFormat.CDataLabelVisibilities();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_DataLabelVisibilities(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- aChartWithAxis.push({ axisId: oNewVal.m_val, chart: val });
+ val.setVisibility(oNewVal);
}
- else if (c_oserct_areachartEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
+ else if (c_oserct_chartExDataLabelSEPARATOR === type)
+ {
+ val.setSeparator(this.stream.GetString2LE(length));
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_PlotArea = function (type, length, val, aChartWithAxis) {
+BinaryChartReader.prototype.ReadCT_DataLabelHidden = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_plotareaLAYOUT === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Layout(t, l, val);
- });
+ var oNewVal;
+ if (c_oserct_chartExDataLabelHiddenIDX === type)
+ {
+ val.setIdx(this.stream.GetULongLE());
}
- else if (c_oserct_plotareaAREA3DCHART === type) {
- var oNewVal = new AscFormat.CAreaChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Area3DChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_plotareaAREACHART === type) {
- var oNewVal = new AscFormat.CAreaChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_AreaChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ParentLabelLayout = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_parentlabellayoutNONE: val = AscFormat.PARENT_LABEL_LAYOUT_NONE; break;
+ case st_parentlabellayoutBANNER: val = AscFormat.PARENT_LABEL_LAYOUT_BANNER; break;
+ case st_parentlabellayoutOVERLAPPING:
+ default: val = AscFormat.PARENT_LABEL_LAYOUT_OVERLAPPING; break;
}
- else if (c_oserct_plotareaBAR3DCHART === type) {
- var oNewVal = new AscFormat.CBarChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Bar3DChart(t, l, oNewVal, aChartWithAxis);
- });
- oNewVal.set3D(true);
- //3d->2d
- /*if (AscFormat.BAR_GROUPING_STANDARD == oNewVal.grouping)
- oNewVal.setGrouping(AscFormat.BAR_GROUPING_CLUSTERED);
- else if(AscFormat.BAR_GROUPING_CLUSTERED != oNewVal.grouping){
- oNewVal.setOverlap(100);
- }*/
- val.addChart(oNewVal);
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_RegionLabelLayout = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_regionlabellayoutNONE: val = AscFormat.REGION_LABEL_LAYOUT_NONE; break;
+ case st_regionlabellayoutBESTFITONLY: val = AscFormat.REGION_LABEL_LAYOUT_BEST_FIT_ONLY; break;
+ case st_regionlabellayoutSHOWALL:
+ default: val = AscFormat.REGION_LABEL_LAYOUT_SHOW_ALL; break;
}
- else if (c_oserct_plotareaBARCHART === type) {
- var oNewVal = new AscFormat.CBarChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BarChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_SeriesLayoutProperties = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExSeriesLayoutPARENT === type)
+ {
+ val.setParentLabelLayout(oThis.ReadCT_ParentLabelLayout());
}
- else if (c_oserct_plotareaBUBBLECHART === type) {
- var oNewVal = new AscFormat.CBubbleChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_BubbleChart(t, l, oNewVal, aChartWithAxis);
- });
- //bubble -> scatter
- var scatter = oNewVal.convertToScutterChart();
- this.CorrectChartWithAxis(oNewVal, scatter, aChartWithAxis);
- val.addChart(scatter);
+ else if (c_oserct_chartExSeriesLayoutREGION === type)
+ {
+ val.setRegionLabelLayout(oThis.ReadCT_RegionLabelLayout());
}
- else if (c_oserct_plotareaDOUGHNUTCHART === type) {
- var oNewVal = new AscFormat.CDoughnutChart();
+ else if (c_oserct_chartExSeriesLayoutVISABILITIES === type)
+ {
+ var oNewVal = new AscFormat.CSeriesElementVisibilities();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DoughnutChart(t, l, oNewVal, aChartWithAxis);
+ return oThis.ReadCT_SeriesElementVisibilities(t, l, oNewVal);
});
- val.addChart(oNewVal);
+ val.setVisibility(oNewVal);
}
- else if (c_oserct_plotareaLINE3DCHART === type) {
- var oNewVal = new AscFormat.CLineChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Line3DChart(t, l, oNewVal, aChartWithAxis);
- });
- oNewVal.convert3Dto2D();
- val.addChart(oNewVal);
+ else if (c_oserct_chartExSeriesLayoutAGGREGATION === type)
+ {
+ val.setAggregation(this.stream.GetBool());
}
- else if (c_oserct_plotareaLINECHART === type) {
- var oNewVal = new AscFormat.CLineChart();
+ else if (c_oserct_chartExSeriesLayoutBINNING === type)
+ {
+ var oNewVal = new AscFormat.CBinning();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_LineChart(t, l, oNewVal, aChartWithAxis);
+ return oThis.ReadCT_Binning(t, l, oNewVal);
});
- val.addChart(oNewVal);
+ val.setBinning(oNewVal);
}
- else if (c_oserct_plotareaOFPIECHART === type) {
- var oNewVal = new AscFormat.COfPieChart();
+ else if (c_oserct_chartExSeriesLayoutSTATISTIC === type)
+ {
+ var oNewVal = new AscFormat.CStatistics();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_OfPieChart(t, l, oNewVal, aChartWithAxis);
+ return oThis.ReadCT_Statistics(t, l, oNewVal);
});
- //ofPie -> pie
- var pie = oNewVal.convertToPieChart();
- this.CorrectChartWithAxis(oNewVal, pie, aChartWithAxis);
- val.addChart(pie);
+ val.setStatistics(oNewVal);
}
- else if (c_oserct_plotareaPIE3DCHART === type) {
- var oNewVal = new AscFormat.CPieChart();
+ else if (c_oserct_chartExSeriesLayoutSUBTOTALS === type)
+ {
+ var oNewVal = new AscFormat.CSubtotals();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Pie3DChart(t, l, oNewVal, aChartWithAxis);
+ return oThis.ReadCT_Subtotals(t, l, oNewVal);
});
- oNewVal.set3D(true);
- //3d->2d
- // oNewVal.setFirstSliceAng(0);
- val.addChart(oNewVal);
+ val.setSubtotals(oNewVal);
}
- else if (c_oserct_plotareaPIECHART === type) {
- var oNewVal = new AscFormat.CPieChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PieChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_plotareaRADARCHART === type) {
- var oNewVal = new AscFormat.CRadarChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_RadarChart(t, l, oNewVal, aChartWithAxis);
- });
- //radar -> line
- //var line = this.ConvertRadarToLine(oNewVal, aChartWithAxis);
- val.addChart(oNewVal);
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_DataLabelVisibilities = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExDataLabelVisibilitiesSERIES === type)
+ {
+ val.setSeriesName(this.stream.GetBool());
}
- else if (c_oserct_plotareaSCATTERCHART === type) {
- var oNewVal = new AscFormat.CScatterChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ScatterChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ else if (c_oserct_chartExDataLabelVisibilitiesCATEGORY === type)
+ {
+ val.setCategoryName(this.stream.GetBool());
}
- else if (c_oserct_plotareaSTOCKCHART === type) {
- var oNewVal = new AscFormat.CStockChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_StockChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ else if (c_oserct_chartExDataLabelVisibilitiesVALUE === type)
+ {
+ val.setValue(this.stream.GetBool());
}
- else if (c_oserct_plotareaSURFACE3DCHART === type) {
- var oNewVal = new AscFormat.CSurfaceChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Surface3DChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_plotareaSURFACECHART === type) {
- var oNewVal = new AscFormat.CSurfaceChart();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SurfaceChart(t, l, oNewVal, aChartWithAxis);
- });
- val.addChart(oNewVal);
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_IntervalClosedSide = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_intervalclosedsideL: val = AscFormat.INTERVAL_CLOSED_SIDE_L; break;
+ case st_intervalclosedsideR:
+ default: val = AscFormat.INTERVAL_CLOSED_SIDE_R; break;
}
- else if (c_oserct_plotareaCATAX === type) {
- var oNewVal = new AscFormat.CCatAx();
-
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_CatAx(t, l, oNewVal);
- });
- val.addAxis(oNewVal);
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_Binning = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExBinningBINSIZE === type)
+ {
+ val.setBinSize(this.stream.GetDoubleLE());
}
- else if (c_oserct_plotareaDATEAX === type) {
- var oNewVal = new AscFormat.CDateAx();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DateAx(t, l, oNewVal);
- });
- val.addAxis(oNewVal);
+ else if (c_oserct_chartExBinningBINCOUNT === type)
+ {
+ val.setBinCount(this.stream.GetULongLE());
}
- else if (c_oserct_plotareaSERAX === type) {
- var oNewVal = new AscFormat.CSerAx();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_SerAx(t, l, oNewVal);
- });
- val.addAxis(oNewVal);
+ else if (c_oserct_chartExBinningINTERVAL === type)
+ {
+ val.setIntervalClosed(oThis.ReadCT_IntervalClosedSide());
}
- else if (c_oserct_plotareaVALAX === type) {
- var oNewVal = new AscFormat.CValAx();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_ValAx(t, l, oNewVal);
- });
- val.addAxis(oNewVal);
- //if(!AscFormat.isRealNumber(oNewVal.crossBetween))
- //{
- // oNewVal.setCrossBetween(AscFormat.CROSS_BETWEEN_BETWEEN);
- //}
+ else if (c_oserct_chartExBinningUNDERVAL === type)
+ {
+ val.setUnderflow(this.stream.GetDoubleLE());
}
- else if (c_oserct_plotareaDTABLE === type) {
- var oNewVal = new AscFormat.CDTable();
+ else if (c_oserct_chartExBinningUNDERAUTO === type)
+ {
+ this.stream.GetUChar();
+ val.setUnderflow(undefined);
+ }
+ else if (c_oserct_chartExBinningOVERVAL === type)
+ {
+ val.setOverflow(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_chartExBinningOVERAUTO === type)
+ {
+ val.setOverflow(this.stream.GetUChar());
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_PosAlign = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_posalignMIN: val = AscFormat.POS_ALIGN_MIN; break;
+ case st_posalignCTR: val = AscFormat.POS_ALIGN_CTR; break;
+ case st_posalignMAX:
+ default: val = AscFormat.POS_ALIGN_MAX; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_SidePos = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_sideposL: val = AscFormat.SIDE_POS_L; break;
+ case st_sideposT: val = AscFormat.SIDE_POS_T; break;
+ case st_sideposR: val = AscFormat.SIDE_POS_R; break;
+ case st_sideposB:
+ default: val = AscFormat.SIDE_POS_B; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_ChartExTitle = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExTitleTX === type)
+ {
+ var oNewVal = new AscFormat.CChartText();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DTable(t, l, oNewVal);
+ return oThis.ReadCT_Text(t, l, oNewVal);
});
- val.setDTable(oNewVal);
+ oNewVal.setChart(this.curChart);
+ val.setTx(oNewVal);
}
- else if (c_oserct_plotareaSPPR === type) {
+ else if (c_oserct_chartExTitleTXPR === type)
+ {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_chartExTitleSPPR === type)
+ {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_plotareaEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
+ else if (c_oserct_chartExTitlePOS === type)
+ {
+ val.setPos(oThis.ReadCT_SidePos());
+ }
+ else if (c_oserct_chartExTitleALIGN === type)
+ {
+ val.setAlign(oThis.ReadCT_PosAlign());
+ }
+ else if (c_oserct_chartExTitleOVERLAY === type)
+ {
+ val.setOverlay(this.stream.GetBool());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Thickness = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ChartExLegend = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_thicknessVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ var oNewVal;
+ if (c_oserct_chartExLegendTXPR === type)
+ {
+ val.setTxPr(this.ReadTxPr(length));
+ val.txPr.setParent(val);
+ }
+ else if (c_oserct_chartExLegendSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
+ }
+ else if (c_oserct_chartExLegendPOS === type)
+ {
+ let nPos = c_oAscChartLegendShowSettings.top;
+ switch (this.stream.GetUChar()) {
+ case sideBottom: nPos = c_oAscChartLegendShowSettings.bottom; break;
+ case sideLeft: nPos = c_oAscChartLegendShowSettings.left; break;
+ case sideRight: nPos = c_oAscChartLegendShowSettings.right; break;
+ case sideTop: nPos = c_oAscChartLegendShowSettings.top; break;
+ }
+ val.setLegendPos(nPos);
+ }
+ else if (c_oserct_chartExLegendALIGN === type)
+ {
+ val.setAlign(oThis.ReadCT_PosAlign());
+ }
+ else if (c_oserct_chartExLegendOVERLAY === type)
+ {
+ val.setOverlay(this.stream.GetBool());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Surface = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Text = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_surfaceTHICKNESS === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Thickness(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setThickness(oNewVal.m_val);
- }
- else if (c_oserct_surfaceSPPR === type) {
- val.setSpPr(this.ReadSpPr(length));
- }
- else if (c_oserct_surfacePICTUREOPTIONS === type) {
- var oNewVal = new AscFormat.CPictureOptions();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PictureOptions(t, l, oNewVal);
- });
- val.setPictureOptions(oNewVal);
+ var oNewVal;
+ if (c_oserct_chartExTextRICH === type)
+ {
+ // var oNewVal = new AscFormat.CTextBody();
+ // res = this.bcr.Read1(length, function (t, l) {
+ // return oThis.ReadCT_TextBody(t, l, oNewVal);
+ // });
+ // val.setRich(oNewVal);
+ val.setRich(this.ReadTxPr(length));
+ val.rich.setParent(val);
}
- else if (c_oserct_surfaceEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_chartExTextDATA === type)
+ {
+ var oNewVal = new AscFormat.CTextData();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_TextData(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.setTxData(oNewVal);
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Perspective = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_TextData = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_perspectiveVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetUChar();
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExTextDataFORMULA === type)
+ {
+ var oNewVal = new AscFormat.CFormula();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_Formula(t, l, oNewVal);
+ });
+ val.setF(oNewVal);
+ }
+ else if (c_oserct_chartExTextDataVALUE === type)
+ {
+ val.setV(this.stream.GetString2LE(length));
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_DepthPercent = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Data = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_depthpercentVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetString2LE(length);
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExDataID === type)
+ {
+ val.setId(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExDataSTRDIMENSION === type)
+ {
+ var oNewVal = new AscFormat.CStringDimension();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_StringDimension(t, l, oNewVal);
+ });
+ val.addDimension(oNewVal);
+ }
+ else if (c_oserct_chartExDataNUMDIMENSION === type)
+ {
+ var oNewVal = new AscFormat.CNumericDimension();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumericDimension(t, l, oNewVal);
+ });
+ val.addDimension(oNewVal);
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_RotY = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Subtotals = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_rotyVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetULongLE();
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExSubtotalsIDX === type)
+ {
+ val.addIdx(this.stream.GetULongLE());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_HPercent = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_SeriesElementVisibilities = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_hpercentVAL === type) {
- val.m_val = this.ParsePersent(this.stream.GetString2LE(length));
+ var oNewVal;
+ if (c_oserct_chartExSeriesVisibilitiesCONNECTOR === type)
+ {
+ val.setConnectorLines(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExSeriesVisibilitiesMEANLINE === type)
+ {
+ val.setMeanLine(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExSeriesVisibilitiesMEANMARKER === type)
+ {
+ val.setMeanMarker(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExSeriesVisibilitiesNONOUTLIERS === type)
+ {
+ val.setNonoutliers(this.stream.GetBool());
+ }
+ else if (c_oserct_chartExSeriesVisibilitiesOUTLIERS === type)
+ {
+ val.setOutliers(this.stream.GetBool());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_RotX = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_CategoryAxisScaling = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_rotxVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetChar();
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExCatScalingGAPVAL === type)
+ {
+ val.setGapWidth(this.stream.GetDoubleLE());
+ }
+ else if (c_oserct_chartExCatScalingGAPAUTO === type)
+ {
+ this.stream.GetUChar();
+ val.setGapWidth(undefined);
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_View3D = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_ValueAxisScaling = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_view3dROTX === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_RotX(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setRotX(oNewVal.m_val);
+ var oNewVal;
+ if (c_oserct_chartExValScalingMAXAUTO === type)
+ {
+ val.setMax(this.stream.GetUChar());
}
- else if (c_oserct_view3dHPERCENT === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_HPercent(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setHPercent(oNewVal.m_val);
+ else if (c_oserct_chartExValScalingMAXVAL === type)
+ {
+ val.setMax(this.stream.GetDoubleLE());
}
- else if (c_oserct_view3dROTY === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_RotY(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setRotY(oNewVal.m_val);
+ else if (c_oserct_chartExValScalingMINAUTO === type)
+ {
+ val.setMin(this.stream.GetUChar());
}
- else if (c_oserct_view3dDEPTHPERCENT === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DepthPercent(t, l, oNewVal);
- });
- if (null != oNewVal.m_val){
- var nPercent = parseInt(oNewVal.m_val)
- if(AscFormat.isRealNumber(nPercent)){
- val.setDepthPercent(nPercent);
- }
- }
+ else if (c_oserct_chartExValScalingMINVAL === type)
+ {
+ val.setMin(this.stream.GetDoubleLE());
}
- else if (c_oserct_view3dRANGAX === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setRAngAx(oNewVal.m_val);
+ else if (c_oserct_chartExValScalingMAJUNITAUTO === type)
+ {
+ val.setMajorUnit(this.stream.GetUChar());
}
- else if (c_oserct_view3dPERSPECTIVE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Perspective(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setPerspective(oNewVal.m_val);
+ else if (c_oserct_chartExValScalingMAJUNITVAL === type)
+ {
+ val.setMajorUnit(this.stream.GetDoubleLE());
}
- else if (c_oserct_view3dEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_chartExValScalingMINUNITAUTO === type)
+ {
+ val.setMinorUnit(this.stream.GetUChar());
+ }
+ else if (c_oserct_chartExValScalingMINUNITVAL === type)
+ {
+ val.setMinorUnit(this.stream.GetDoubleLE());
+ }
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
+ }
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_ChartExAxisUnit = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_axisunitHUNDREDS: val = AscFormat.AXIS_UNIT_HUNDREDS; break;
+ case st_axisunitTHOUSANDS: val = AscFormat.AXIS_UNIT_TEN_THOUSANDS; break;
+ case st_axisunitTENTHOUSANDS: val = AscFormat.AXIS_UNIT_TEN_MILLIONS; break;
+ case st_axisunitHUNDREDTHOUSANDS: val = AscFormat.AXIS_UNIT_HUNDRED_THOUSANDS; break;
+ case st_axisunitMILLIONS: val = AscFormat.AXIS_UNIT_MILLIONS; break;
+ case st_axisunitTENMILLIONS: val = AscFormat.AXIS_UNIT_TEN_MILLIONS; break;
+ case st_axisunitHUNDREDMILLIONS: val = AscFormat.AXIS_UNIT_HUNDRED_MILLIONS; break;
+ case st_axisunitBILLIONS: val = AscFormat.AXIS_UNIT_BILLIONS; break;
+ case st_axisunitTRILLIONS: val = AscFormat.AXIS_UNIT_TRILLIONS; break;
+ case st_axisunitPERCENTAGE:
+ default: val = AscFormat.AXIS_UNIT_PERCENTAGE; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_AxisUnits = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExAxisUnitLABEL === type)
+ {
+ var oNewVal = new AscFormat.CAxisUnitsLabel();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_AxisUnitsLabel(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.setUnitsLabel(oNewVal);
+ }
+ else if (c_oserct_chartExAxisUnitTYPE === type)
+ {
+ val.setUnit(oThis.ReadCT_ChartExAxisUnit());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_PivotFmt = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_AxisUnitsLabel = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_pivotfmtIDX === type) {
- var oNewVal = { m_val: null };
+ var oNewVal;
+ if (c_oserct_chartExAxisUnitsLabelTEXT === type)
+ {
+ var oNewVal = new AscFormat.CChartText();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
+ return oThis.ReadCT_Text(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setIdx(oNewVal.m_val);
+ val.setTx(oNewVal);
}
- else if (c_oserct_pivotfmtSPPR === type) {
+ else if (c_oserct_chartExAxisUnitsLabelSPPR === type)
+ {
val.setSpPr(this.ReadSpPr(length));
}
- else if (c_oserct_pivotfmtTXPR === type) {
+ else if (c_oserct_chartExAxisUnitsLabelTXPR === type)
+ {
val.setTxPr(this.ReadTxPr(length));
val.txPr.setParent(val);
}
- else if (c_oserct_pivotfmtMARKER === type) {
- var oNewVal = new AscFormat.CMarker();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Marker(t, l, oNewVal);
- });
- val.setMarker(oNewVal);
- }
- else if (c_oserct_pivotfmtDLBL === type) {
- var oNewVal = new AscFormat.CDLbl();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DLbl(t, l, oNewVal);
- });
- oNewVal.correctValues();
- val.setLbl(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_pivotfmtEXTLST === type) {
- var oNewVal = {};
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
- });
- // val.m_extLst = oNewVal;
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_TickMarksType = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_tickmarkstypeIN: val = AscFormat.TICK_MARKS_TYPE_IN; break;
+ case st_tickmarkstypeOUT: val = AscFormat.TICK_MARKS_TYPE_OUT; break;
+ case st_tickmarkstypeCROSS: val = AscFormat.TICK_MARKS_TYPE_CROSS; break;
+ case st_tickmarkstypeNONE:
+ default: val = AscFormat.TICK_MARKS_TYPE_NONE; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_TickMarks = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExTickMarksTYPE === type)
+ {
+ val.setType(oThis.ReadCT_TickMarksType());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_pivotFmts = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_Gridlines = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_pivotfmtsPIVOTFMT === type) {
- var oNewVal = new AscFormat.CPivotFmt();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PivotFmt(t, l, oNewVal);
- });
- val.setPivotFmts(oNewVal);
+ var oNewVal;
+ if (c_oserct_chartExGridlinesSPPR === type)
+ {
+ val.setSpPr(this.ReadSpPr(length));
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Chart = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_QuartileMethod = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_quartilemethodINCLUSIVE: val = AscFormat.QUARTILE_METHOD_INCLUSIVE; break;
+ case st_quartilemethodEXCLUSIVE:
+ default: val = AscFormat.QUARTILE_METHOD_EXCLUSIVE; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_Statistics = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_chartTITLE === type) {
- var oNewVal = new AscFormat.CTitle();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Title(t, l, oNewVal);
- });
- val.setTitle(oNewVal);
+ var oNewVal;
+ if (c_oserct_chartExStatisticsMETHOD === type)
+ {
+ val.setQuartileMethod(oThis.ReadCT_QuartileMethod());
}
- else if (c_oserct_chartAUTOTITLEDELETED === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setAutoTitleDeleted(oNewVal.m_val);
- else
- val.setAutoTitleDeleted(true);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_chartPIVOTFMTS === type) {
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_pivotFmts(t, l, val);
- });
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_StringDimensionType = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_stringdimensiontypeCAT: val = AscFormat.STRING_DIMENSION_TYPE_CAT; break;
+ case st_stringdimensiontypeCOLORSTR:
+ default: val = AscFormat.STRING_DIMENSION_TYPE_COLOR_STR; break;
}
- else if (c_oserct_chartVIEW3D === type) {
- var oNewVal = new AscFormat.CView3d();
-
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_View3D(t, l, oNewVal);
- });
- val.setView3D(oNewVal);
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_StringDimension = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExDataDimensionTYPE === type)
+ {
+ val.setType(oThis.ReadCT_StringDimensionType());
}
- else if (c_oserct_chartFLOOR === type) {
- var oNewVal = new AscFormat.CChartWall();
+ else if (c_oserct_chartExDataDimensionFORMULA === type)
+ {
+ var oNewVal = new AscFormat.CFormula();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Surface(t, l, oNewVal);
+ return oThis.ReadCT_Formula(t, l, oNewVal);
});
- val.setFloor(oNewVal);
+ val.setF(oNewVal);
}
- else if (c_oserct_chartSIDEWALL === type) {
- var oNewVal = new AscFormat.CChartWall();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Surface(t, l, oNewVal);
- });
- val.setSideWall(oNewVal);
+ else if (c_oserct_chartExDataDimensionNF === type)
+ {
+ val.setNf(this.stream.GetString2LE(length));
}
- else if (c_oserct_chartBACKWALL === type) {
- var oNewVal = new AscFormat.CChartWall();
+ else if (c_oserct_chartExDataDimensionSTRINGLEVEL === type)
+ {
+ var oNewVal = new AscFormat.CStrCache();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Surface(t, l, oNewVal);
+ return oThis.ReadCT_StringLevel(t, l, oNewVal);
});
- val.setBackWall(oNewVal);
+ val.addLevelData(oNewVal);
}
- else if (c_oserct_chartPLOTAREA === type) {
- var oNewVal = new AscFormat.CPlotArea();
- var aChartWithAxis = [];
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_PlotArea(t, l, oNewVal, aChartWithAxis);
- });
- oNewVal.initPostOpen(aChartWithAxis);
- val.setPlotArea(oNewVal);
+ else
+ {
+ res = c_oSerConstants.ReadUnknown;
}
- else if (c_oserct_chartLEGEND === type) {
- var oNewVal = new AscFormat.CLegend();
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Legend(t, l, oNewVal);
- });
- oNewVal.updateLegendPos();
- val.setLegend(oNewVal);
+ return res;
+};
+BinaryChartReader.prototype.ReadCT_NumericDimensionType = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_numericdimensiontypeVAL: val = AscFormat.NUMERIC_DIMENSION_TYPE_VAL; break;
+ case st_numericdimensiontypeX: val = AscFormat.NUMERIC_DIMENSION_TYPE_X; break;
+ case st_numericdimensiontypeY: val = AscFormat.NUMERIC_DIMENSION_TYPE_Y; break;
+ case st_numericdimensiontypeSIZE: val = AscFormat.NUMERIC_DIMENSION_TYPE_SIZE; break;
+ case st_numericdimensiontypeCOLORVAL:
+ default: val = AscFormat.NUMERIC_DIMENSION_TYPE_COLOR_VAL; break;
}
- else if (c_oserct_chartPLOTVISONLY === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setPlotVisOnly(oNewVal.m_val);
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_NumericDimension = function (type, length, val) {
+ var res = c_oSerConstants.ReadOk;
+ var oThis = this;
+ var oNewVal;
+ if (c_oserct_chartExDataDimensionTYPE === type)
+ {
+ val.setType(oThis.ReadCT_NumericDimensionType());
}
- else if (c_oserct_chartDISPBLANKSAS === type) {
- var oNewVal = { m_val: null };
+ else if (c_oserct_chartExDataDimensionFORMULA === type)
+ {
+ var oNewVal = new AscFormat.CFormula();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_DispBlanksAs(t, l, oNewVal);
+ return oThis.ReadCT_Formula(t, l, oNewVal);
});
- if (null != oNewVal.m_val)
- val.setDispBlanksAs(oNewVal.m_val);
+ val.setF(oNewVal);
}
- else if (c_oserct_chartSHOWDLBLSOVERMAX === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setShowDLblsOverMax(oNewVal.m_val);
- else
- val.setShowDLblsOverMax(true);
+ else if (c_oserct_chartExDataDimensionNF === type)
+ {
+ val.setNf(this.stream.GetString2LE(length));
}
- else if (c_oserct_chartEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_chartExDataDimensionNUMERICLEVEL === type)
+ {
+ var oNewVal = new AscFormat.CNumLit();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_NumericLevel(t, l, oNewVal);
});
- // val.m_extLst = oNewVal;
+ val.addLevelData(oNewVal);
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Protection = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_FormulaDirection = function () {
+ let val = null;
+ switch (this.stream.GetUChar()) {
+ case st_formuladirectionCOL: val = AscFormat.FORMULA_DIRECTION_COL; break;
+ case st_formuladirectionROW:
+ default: val = AscFormat.FORMULA_DIRECTION_ROW; break;
+ }
+ return val;
+};
+BinaryChartReader.prototype.ReadCT_Formula = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_protectionCHARTOBJECT === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setChartObject(oNewVal.m_val);
- }
- else if (c_oserct_protectionDATA === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setData(oNewVal.m_val);
- }
- else if (c_oserct_protectionFORMATTING === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setFormatting(oNewVal.m_val);
- }
- else if (c_oserct_protectionSELECTION === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setSelection(oNewVal.m_val);
+ var oNewVal;
+ if (c_oserct_chartExFormulaCONTENT === type)
+ {
+ val.setContent(this.stream.GetString2LE(length));
}
- else if (c_oserct_protectionUSERINTERFACE === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_Boolean(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setUserInterface(oNewVal.m_val);
+ else if (c_oserct_chartExFormulaDIRECTION === type)
+ {
+ val.setDir(oThis.ReadCT_FormulaDirection());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_PivotSource = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_StringLevel = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_pivotsourceNAME === type) {
+ var oNewVal;
+ if (c_oserct_chartExDataLevelNAME === type)
+ {
val.setName(this.stream.GetString2LE(length));
}
- else if (c_oserct_pivotsourceFMTID === type) {
- var oNewVal = { m_val: null };
- res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_UnsignedInt(t, l, oNewVal);
- });
- if (null != oNewVal.m_val)
- val.setFmtId(oNewVal.m_val);
+ else if (c_oserct_chartExDataLevelCOUNT === type)
+ {
+ val.setPtCount(this.stream.GetULongLE());
}
- else if (c_oserct_pivotsourceEXTLST === type) {
- var oNewVal = {};
+ else if (c_oserct_chartExDataLevelPT === type)
+ {
+ var oNewVal = new AscFormat.CStringPoint();
res = this.bcr.Read1(length, function (t, l) {
- return oThis.ReadCT_extLst(t, l, oNewVal);
+ return oThis.ReadCT_StringValue(t, l, oNewVal);
});
- // if (null == val.m_extLst)
- // val.m_extLst = [];
- // val.m_extLst.push(oNewVal);
+ val.addPt(oNewVal);
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Style1 = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_NumericLevel = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_style1VAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetUChar();
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExDataLevelNAME === type)
+ {
+ val.setName(this.stream.GetString2LE(length));
+ }
+ else if (c_oserct_chartExDataLevelCOUNT === type)
+ {
+ val.setPtCount(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExDataLevelPT === type)
+ {
+ var oNewVal = new AscFormat.CNumericPoint();
+ res = this.bcr.Read1(length, function (t, l) {
+ return oThis.ReadCT_NumericValue(t, l, oNewVal);
+ });
+ val.addPt(oNewVal);
+ }
+ else if (c_oserct_chartExDataLevelFORMATCODE === type)
+ {
+ val.setFormatCode(this.stream.GetString2LE(length));
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_Style = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_StringValue = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_styleVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetUChar();
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExDataValueIDX === type)
+ {
+ val.setIdx(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExDataValueCONTENT === type)
+ {
+ val.setVal(this.stream.GetString2LE(length));
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
-BinaryChartReader.prototype.ReadCT_TextLanguageID = function (type, length, val) {
+BinaryChartReader.prototype.ReadCT_NumericValue = function (type, length, val) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
- if (c_oserct_textlanguageidVAL === type) {
- var oNewVal;
- oNewVal = this.stream.GetString2LE(length);
- val.m_val = oNewVal;
+ var oNewVal;
+ if (c_oserct_chartExDataValueIDX === type)
+ {
+ val.setIdx(this.stream.GetULongLE());
+ }
+ else if (c_oserct_chartExDataValueCONTENT === type)
+ {
+ val.setVal(this.stream.GetDoubleLE());
}
else
+ {
res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
BinaryChartReader.prototype.ReadAlternateContent = function (type, length, val) {
@@ -12178,4 +14729,9 @@ BinaryChartReader.prototype.ReadAlternateContentFallback = function (type, lengt
window['AscFormat'].ERR_VAL_TYPE_STD_DEV = ERR_VAL_TYPE_STD_DEV;
window['AscFormat'].ERR_VAL_TYPE_STD_ERR = ERR_VAL_TYPE_STD_ERR;
+ window['AscFormat'].TICK_LABEL_POSITION_HIGH = st_ticklblposHIGH;
+ window['AscFormat'].TICK_LABEL_POSITION_LOW = st_ticklblposLOW;
+ window['AscFormat'].TICK_LABEL_POSITION_NEXT_TO = st_ticklblposNEXTTO;
+ window['AscFormat'].TICK_LABEL_POSITION_NONE = st_ticklblposNONE;
+
})(window);
diff --git a/common/SerializeCommonWordExcel.js b/common/SerializeCommonWordExcel.js
index ecd509e29e..837a994af3 100644
--- a/common/SerializeCommonWordExcel.js
+++ b/common/SerializeCommonWordExcel.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -83,7 +83,8 @@ var c_oSerBorderType = {
Value: 3,
ColorTheme: 4,
SpacePoint: 5,
- Size8Point: 6
+ Size8Point: 6,
+ ValueType: 7
};
var c_oSerBordersType = {
left: 0,
@@ -239,6 +240,10 @@ BinaryCommonWriter.prototype.WriteBorder = function(border)
this.memory.WriteByte(c_oSerBorderType.Value);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(border.Value);
+
+ this.memory.WriteByte(c_oSerBorderType.ValueType);
+ this.memory.WriteByte(c_oSerPropLenType.Long);
+ this.memory.WriteLong(border.getValue());
}
};
BinaryCommonWriter.prototype.WriteBorders = function(Borders)
@@ -1283,6 +1288,13 @@ function isRealObject(obj)
return 0;
return this.data[this.cur++];
}
+ this.GetUChar_TypeNode = function()
+ {
+ if (this.cur >= this.size)
+ return c_nodeAttribute.nodeAttributeEnd;
+ return this.data[this.cur++];
+ }
+
this.GetBool = function()
{
if (this.cur >= this.size)
@@ -1332,12 +1344,12 @@ function isRealObject(obj)
this.ReadByteFromPPTY = function ()
{
- var value = 0;
+ var value = null;
var end = this.cur + this.GetULong() + 4;
this.Skip2(1);
while (true)
{
- var _at = this.GetUChar();
+ var _at = this.GetUChar_TypeNode();
if (_at === c_nodeAttribute.nodeAttributeEnd)
{
break;
diff --git a/common/Shapes/EditorSettings.js b/common/Shapes/EditorSettings.js
index a0e90e87ac..91407fdddc 100644
--- a/common/Shapes/EditorSettings.js
+++ b/common/Shapes/EditorSettings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/Shapes/Serialize.js b/common/Shapes/Serialize.js
index ad5dd851e9..841d3e668a 100644
--- a/common/Shapes/Serialize.js
+++ b/common/Shapes/Serialize.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -173,6 +173,7 @@ function BinaryPPTYLoader()
this.oConnectedObjects = {};
this.map_shapes_by_id = {};
this.fields = [];
+ this.smartarts = [];
this.ClearConnectedObjects = function(){
@@ -312,6 +313,15 @@ function BinaryPPTYLoader()
this.ImageMapChecker = null;
};
+ this.GenerateSmartArts = function () {
+ while (this.smartarts.length) {
+ const smartart = this.smartarts.pop();
+ smartart.generateDrawingPart();
+ }
+ };
+ this.ClearSmartArts = function () {
+ this.smartarts.length = 0;
+ };
this.LoadDocument = function()
{
@@ -385,7 +395,6 @@ function BinaryPPTYLoader()
// CustomProperties
s.Seek2(_main_tables["48"]);
- this.presentation.CustomProperties = new AscCommon.CCustomProperties();
this.presentation.CustomProperties.fromStream(s);
}
}
@@ -691,6 +700,11 @@ function BinaryPPTYLoader()
}
}
}
+ if (this.IsThemeLoader) {
+ this.ClearSmartArts();
+ } else {
+ this.GenerateSmartArts();
+ }
if (this.Api != null && !this.IsThemeLoader)
{
@@ -6367,7 +6381,7 @@ function BinaryPPTYLoader()
{
case 0:
{
- shape.attrUseBgFill = s.GetBool();
+ shape.setUseBgFill(s.GetBool());
break;
}
default:
@@ -6606,18 +6620,114 @@ function BinaryPPTYLoader()
return shape;
};
+ this.IsNoSlideSpTree = function ()
+ {
+ return this.TempMainObject && AscFormat.isRealNumber(this.TempMainObject.kind) && (this.TempMainObject.kind !== AscFormat.TYPE_KIND.SLIDE);
+ };
+ this.ReadSpTreeElement = function()
+ {
+ let s = this.stream;
+
+ let bIsNoSlideSpTree = this.IsNoSlideSpTree();
+ let _type = s.GetUChar();
+ let _object;
+ switch (_type)
+ {
+ case 1:
+ {
+ _object = this.ReadShape();
+ if (!IsHiddenObj(_object) || bIsNoSlideSpTree)
+ {
+ _object.setParent2(this.TempMainObject);
+ }
+ else
+ {
+ _object = null;
+ }
+ break;
+ }
+ case 6:
+ case 2:
+ case 7:
+ case 8:
+ {
+ _object = this.ReadPic(_type);
+ if(_type === 6 && !_object.checkCorrect())
+ {
+ _object = null;
+ }
+ break;
+ }
+ case 3:
+ {
+ _object = this.ReadCxn();
+ break;
+ }
+ case 4:
+ {
+ _object = this.ReadGroupShape();
+ break;
+ }
+ case 5:
+ {
+ _object = this.ReadGrFrame();
+ break;
+ }
+ case 0x99:
+ {
+ _object = this.ReadSpTreeElement();
+ break;
+ }
+ default:
+ {
+ s.SkipRecord();
+ break;
+ }
+ }
+ if(_object)
+ {
+ if (!IsHiddenObj(_object) || bIsNoSlideSpTree)
+ {
+ _object.setParent2(this.TempMainObject);
+ }
+ else
+ {
+ _object = null
+ }
+ }
+ let nCurPos = s.cur;
+ let nType = s.GetUChar();
+ let oAltDrawing = null;
+ if(nType === 0x99)
+ {
+ let nAltContentLen = s.GetULong();
+ let nEndPos = s.cur + nAltContentLen;
+ if(!_object || !_object.isSupported())
+ oAltDrawing = this.ReadSpTreeElement();
+ if(oAltDrawing)
+ {
+ _object = oAltDrawing;
+ }
+ s.Seek2(nEndPos);
+ }
+ else
+ {
+ s.Seek2(nCurPos);
+ }
+ return _object;
+ };
this.ReadGroupShapeMain = function()
{
- var s = this.stream;
+ let s = this.stream;
- var shapes = [];
+ let shapes = [];
- var _rec_start = s.cur;
- var _end_rec = _rec_start + s.GetULong() + 4;
+ let _rec_start = s.cur;
+ let _end_rec = _rec_start + s.GetULong() + 4;
+ let _object;
s.Skip2(5); // type SPTREE + len
- let bIsNoSlideSpTree = this.TempMainObject && AscFormat.isRealNumber(this.TempMainObject.kind) && (this.TempMainObject.kind !== AscFormat.TYPE_KIND.SLIDE);
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
@@ -6646,71 +6756,10 @@ function BinaryPPTYLoader()
if (__len == 0)
continue;
- var _type = s.GetUChar();
-
- switch (_type)
+ _object = this.ReadSpTreeElement();
+ if(_object)
{
- case 1:
- {
- var _object = this.ReadShape();
- if (!IsHiddenObj(_object) || bIsNoSlideSpTree)
- {
- shapes[shapes.length] = _object;
- _object.setParent2(this.TempMainObject);
- }
- break;
- }
- case 6:
- case 2:
- case 7:
- case 8:
- {
- var _object = this.ReadPic(_type);
- if (!IsHiddenObj(_object) || bIsNoSlideSpTree)
- {
- if(_type !== 6 || _object.checkCorrect())
- {
- shapes[shapes.length] = _object;
- _object.setParent2(this.TempMainObject);
- }
- }
- break;
- }
- case 3:
- {
- var _object = this.ReadCxn();
- if (!IsHiddenObj(_object) || bIsNoSlideSpTree)
- {
- shapes[shapes.length] = _object;
- _object.setParent2(this.TempMainObject);
- }
- break;
- }
- case 4:
- {
- var _object = this.ReadGroupShape();
- if (!IsHiddenObj(_object) || bIsNoSlideSpTree)
- {
- shapes[shapes.length] = _object;
- _object.setParent2(this.TempMainObject);
- }
- break;
- }
- case 5:
- {
- var _ret = this.ReadGrFrame();
- if (null != _ret)
- {
- shapes[shapes.length] = _ret;
- _ret.setParent2(this.TempMainObject);
- }
- break;
- }
- default:
- {
- s.SkipRecord();
- break;
- }
+ shapes[shapes.length] = _object;
}
}
break;
@@ -6858,7 +6907,7 @@ function BinaryPPTYLoader()
{
var s = this.stream;
- var shape = new AscFormat.CConnectionShape();
+ var shape = false == Asc.editor.isPdfEditor() ? new AscFormat.CConnectionShape() : new AscPDF.CPdfConnectionShape();
shape.setBDeleted(false);
var _rec_start = s.cur;
@@ -7115,9 +7164,37 @@ function BinaryPPTYLoader()
}
break;
}
+ case 7: // chartEx
+ {
+ var _length = s.GetLong();
+ var _pos = s.cur;
+
+ if(typeof AscFormat.CChartSpace !== "undefined" && _length)
+ {
+ var _stream = new AscCommon.FT_Stream2();
+ _stream.data = s.data;
+ _stream.pos = s.pos;
+ _stream.cur = s.cur;
+ _stream.size = s.size;
+ _chart = new AscFormat.CChartSpace();
+ _chart.setBDeleted(false);
+ AscCommon.pptx_content_loader.ImageMapChecker = this.ImageMapChecker;
+ AscCommon.pptx_content_loader.Reader.ImageMapChecker = this.ImageMapChecker;
+ var oBinaryChartReader = new AscCommon.BinaryChartReader(_stream);
+ oBinaryChartReader.ExternalReadCT_ChartExSpace(_length, _chart, this.presentation);
+ if(!_chart.hasCharts())
+ {
+ _chart = null;
+ }
+ }
+
+ s.Seek2(_pos + _length);
+ break;
+ }
case 8://smartArt
{
_smartArt = this.ReadSmartArt();
+ this.smartarts.push(_smartArt);
break;
}
case 9:
@@ -7238,6 +7315,7 @@ function BinaryPPTYLoader()
_smartArt = new AscFormat.SmartArt();
_smartArt.fromPPTY(this);
_smartArt.setBDeleted(false);
+ _smartArt.generateDefaultStructures();
_smartArt.checkNodePointsAfterRead();
}
else
@@ -10461,6 +10539,23 @@ function BinaryPPTYLoader()
return GrObject;
});
};
+ this.ReadGraphicObject2 = function(stream, presentation, drawingDocument) {
+ var oThis = this;
+ return this.ReadPPTXElement(undefined, stream, function() {
+ if(presentation)
+ {
+ oThis.Reader.presentation = presentation;
+ }
+ if(drawingDocument)
+ {
+ oThis.Reader.DrawingDocument = drawingDocument;
+ }
+ oThis.LogicDocument = null;
+ var s = oThis.stream;
+ var GrObject = oThis.Reader.ReadGraphicObject();
+ return GrObject;
+ });
+ };
this.ReadTextBody = function(reader, stream, shape, presentation, drawingDocument) {
var oThis = this;
@@ -10542,7 +10637,7 @@ function BinaryPPTYLoader()
{
case 0:
{
- shape.attrUseBgFill = s.GetBool();
+ shape.setUseBgFill(s.GetBool());
break;
}
default:
@@ -10785,7 +10880,19 @@ function BinaryPPTYLoader()
var s = this.stream;
var isOle = (type === 6);
- var pic = isOle ? new AscFormat.COleObject() : new AscFormat.CImageShape();
+ var pic;
+ if (isOle)
+ {
+ pic = new AscFormat.COleObject(this.TempMainObject)
+ }
+ else
+ {
+ if (Asc.editor.isPdfEditor())
+ pic = new AscPDF.CPdfImage();
+ else
+ pic = new AscFormat.CImageShape(this.TempMainObject);
+ }
+
pic.setBDeleted(false);
pic.setParent(this.TempMainObject == null ? this.ParaDrawing : null);
@@ -11305,6 +11412,7 @@ function BinaryPPTYLoader()
this.BaseReader = null;
if(!bClearStreamOnly)
this.ImageMapChecker = {};
+ this.Reader.ClearSmartArts();
};
}
diff --git a/common/Shapes/SerializeWriter.js b/common/Shapes/SerializeWriter.js
index a9018b2310..ee810d6bf2 100644
--- a/common/Shapes/SerializeWriter.js
+++ b/common/Shapes/SerializeWriter.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -582,7 +582,7 @@ function CBinaryFileWriter()
this.WriteCore(presentation.Core, presentation.Api);
// Core
- if (presentation.CustomProperties)
+ if (presentation.CustomProperties && presentation.CustomProperties.hasProperties())
this.WriteCustomProperties(presentation.CustomProperties, presentation.Api);
// ViewProps
@@ -2971,8 +2971,10 @@ function CBinaryFileWriter()
{
oThis.WriteRecord2(1, txBody.lstStyle, oThis.WriteTextListStyle);
}
- var _content = txBody.content.Content;
- oThis.WriteRecordArray(2, 0, _content, oThis.WriteParagraph);
+ var _content = txBody.content && txBody.content.Content;
+ if (_content) {
+ oThis.WriteRecordArray(2, 0, _content, oThis.WriteParagraph);
+ }
};
this.WriteParagraph = function(paragraph, startPos, endPos)
@@ -3329,7 +3331,7 @@ function CBinaryFileWriter()
else{
oThis.StartRecord(1);
oThis.WriteUChar(g_nodeAttributeStart);
- oThis._WriteBool2(0, shape.attrUseBgFill);
+ oThis._WriteBool2(0, shape.useBgFill);
oThis.WriteUChar(g_nodeAttributeEnd);
}
@@ -3507,7 +3509,14 @@ function CBinaryFileWriter()
}
case AscDFH.historyitem_type_ChartSpace:
{
- oThis.WriteRecord2(3, grObj, oThis.WriteChart2);
+ if(grObj.isChartEx())
+ {
+ oThis.WriteRecord2(7, grObj, oThis.WriteChart2);
+ }
+ else
+ {
+ oThis.WriteRecord2(3, grObj, oThis.WriteChart2);
+ }
break;
}
case AscDFH.historyitem_type_SlicerView:
@@ -3548,7 +3557,11 @@ function CBinaryFileWriter()
oThis.UseContinueWriter++;
var oBinaryChartWriter = new AscCommon.BinaryChartWriter(_memory);
- oBinaryChartWriter.WriteCT_ChartSpace(grObj);
+ if (grObj.isChartEx()) {
+ oBinaryChartWriter.WriteCT_ChartExSpace(grObj);
+ } else {
+ oBinaryChartWriter.WriteCT_ChartSpace(grObj);
+ }
oThis.data = _memory.data;
oThis.len = _memory.len;
@@ -5226,7 +5239,7 @@ function CBinaryFileWriter()
else{
_writer.StartRecord(1);
_writer.WriteUChar(g_nodeAttributeStart);
- _writer._WriteBool2(0, shape.attrUseBgFill);
+ _writer._WriteBool2(0, shape.useBgFill);
_writer.WriteUChar(g_nodeAttributeEnd);
}
diff --git a/common/SmartArts/DefaultStructures.js b/common/SmartArts/DefaultStructures.js
new file mode 100644
index 0000000000..7dbd5c3d30
--- /dev/null
+++ b/common/SmartArts/DefaultStructures.js
@@ -0,0 +1,1013 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2023
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(function (window) {
+ const g_clr_accent1 = 0;
+ const g_clr_lt1 = 12;
+ const g_clr_tx1 = 15;
+ const g_clr_dk1 = 8;
+
+
+
+
+ function generateLayoutChildren(parent, children) {
+ if (!children) {
+ return;
+ }
+ for (let i = children.length - 1; i >= 0; i -= 1) {
+ const templateChild = children[i];
+ let child;
+ if (templateChild.layoutNode) {
+ child = getLayoutNode(templateChild.layoutNode);
+ } else if (templateChild.varLst) {
+ child = getVarLst(templateChild.varLst);
+ } else if (templateChild.alg) {
+ child = getAlgorithm(templateChild.alg);
+ } else if (templateChild.shape) {
+ child = getSmartArtShape(templateChild.shape);
+ } else if (templateChild.presOf) {
+ child = getPresOf(templateChild.presOf);
+ } else if (templateChild.constrLst) {
+ child = getConstrLst(templateChild.constrLst);
+ } else if (templateChild.ruleLst) {
+ child = getRuleLst(templateChild.ruleLst);
+ } else if (templateChild.forEach) {
+ child = getForEach(templateChild.forEach);
+ } else if (templateChild.choose) {
+ child = getChoose(templateChild.choose);
+ }
+ if (child) {
+ if (parent.addToLst) {
+ parent.addToLst(0, child);
+ } else if (parent.addToLstList) {
+ parent.addToLstList(0, child);
+ }
+
+ }
+ }
+ }
+ function getVarLst(info) {
+ const varLst = new AscFormat.VarLst();
+ if (info.bulletEnabled) {
+ varLst.setBulletEnabled(new AscFormat.BulletEnabled());
+ varLst.bulletEnabled.setVal(info.bulletEnabled.val);
+ }
+ if (info.dir) {
+ varLst.setDir(new AscFormat.DiagramDirection());
+ }
+ if (info.resizeHandles) {
+ varLst.setResizeHandles(new AscFormat.ResizeHandles());
+ varLst.resizeHandles.setVal(info.resizeHandles.val);
+ }
+ return varLst;
+ }
+ function getAlgorithm(info) {
+ const alg = new AscFormat.Alg();
+ alg.setType(info.type);
+ if (info.params) {
+ for (let i = info.params.length - 1; i >= 0; i -= 1) {
+ const sampParam = info.params[i];
+ const param = new AscFormat.Param();
+ param.setType(sampParam.type);
+ param.setVal(sampParam.val);
+ alg.addToLstParam(0, param);
+ }
+ }
+ return alg;
+ }
+ function getSmartArtShape(info) {
+ const smartArtShape = new AscFormat.SShape();
+ smartArtShape.setBlip(info.blip);
+ if (info.type !== undefined) {
+ smartArtShape.setType(info.type);
+ }
+ if (info.adjLst) {
+ smartArtShape.setAdjLst(new AscFormat.AdjLst());
+ }
+ return smartArtShape;
+ }
+ function getPresOf(info) {
+ const presOf = new AscFormat.PresOf();
+ if (info.axis !== undefined) {
+ presOf.addToLstAxis(0, getAxis(info.axis));
+ }
+ if (info.ptType !== undefined) {
+ presOf.addToLstPtType(0, getPtType(info.ptType));
+ }
+ return presOf;
+ }
+ function getConstrLst(info) {
+ const constrLst = new AscFormat.ConstrLst();
+ for (let i = info.length - 1; i >= 0; i -= 1) {
+ const sampConstr = info[i];
+ const constr = new AscFormat.Constr();
+ if (sampConstr.type !== undefined) {
+ constr.setType(sampConstr.type);
+ }
+ if (sampConstr.refType !== undefined) {
+ constr.setRefType(sampConstr.refType);
+ }
+ if (sampConstr.for !== undefined) {
+ constr.setFor(sampConstr.for);
+ }
+ if (sampConstr.refFor !== undefined) {
+ constr.setRefFor(sampConstr.refFor);
+ }
+ if (sampConstr.forName !== undefined) {
+ constr.setForName(sampConstr.forName);
+ }
+ if (sampConstr.refForName !== undefined) {
+ constr.setRefForName(sampConstr.refForName);
+ }
+ if (sampConstr.fact !== undefined) {
+ constr.setFact(sampConstr.fact);
+ }
+ if (sampConstr.val !== undefined) {
+ constr.setVal(sampConstr.val);
+ }
+ if (sampConstr.op !== undefined) {
+ constr.setOp(sampConstr.op);
+ }
+ constrLst.addToLst(0, constr);
+ }
+ return constrLst;
+ }
+ function getRuleLst(info) {
+ const ruleLst = new AscFormat.RuleLst();
+ for (let i = info.length - 1; i >= 0; i -= 1) {
+ const sampRule = info[i];
+ const rule = new AscFormat.Rule();
+ if (sampRule.type !== undefined) {
+ rule.setType(sampRule.type);
+ }
+ if (sampRule.for !== undefined) {
+ rule.setFor(sampRule.for);
+ }
+ if (sampRule.forName !== undefined) {
+ rule.setForName(sampRule.forName);
+ }
+ if (sampRule.fact !== undefined) {
+ rule.setFact(sampRule.fact);
+ }
+ if (sampRule.max !== undefined) {
+ rule.setMax(sampRule.max);
+ }
+ if (sampRule.val !== undefined) {
+ rule.setVal(sampRule.val);
+ }
+ ruleLst.addToLst(0, rule);
+ }
+ return ruleLst;
+ }
+ function getAxis(type) {
+ const axisType = new AscFormat.AxisType();
+ axisType.setVal(type);
+ return axisType;
+ }
+ function getPtType(type) {
+ const ptType = new AscFormat.ElementType();
+ ptType.setVal(type);
+ return ptType;
+ }
+ function getForEach(info) {
+ const forEach = new AscFormat.ForEach();
+ forEach.setName(info.name);
+ forEach.addToLstAxis(0, getAxis(info.axis));
+ forEach.addToLstPtType(0, getPtType(info.ptType));
+ if (info.cnt !== undefined) {
+ forEach.addToLstCnt(0, info.cnt);
+ }
+ generateLayoutChildren(forEach, info.children);
+ return forEach;
+ }
+ function getChoose(info) {
+ const choose = new AscFormat.Choose();
+ choose.setName(info.name);
+ const chooseElse = new AscFormat.Else();
+ chooseElse.setName(info.layoutElse.name);
+ generateLayoutChildren(chooseElse, info.layoutElse.children);
+ choose.setElse(chooseElse);
+ for (let i = info.ifArray.length - 1; i >= 0; i -= 1) {
+ const ifInfo = info.ifArray[i];
+ const chooseIf = new AscFormat.If();
+ chooseIf.setName(ifInfo.name);
+ chooseIf.setFunc(ifInfo.func);
+ chooseIf.setArg(ifInfo.arg);
+ chooseIf.setVal(ifInfo.val);
+ chooseIf.setOp(ifInfo.op);
+ generateLayoutChildren(chooseIf, ifInfo.children);
+ choose.addToLstIf(0, chooseIf);
+ }
+ return choose;
+ }
+ function getLayoutNode(info) {
+ const layoutNode = new AscFormat.LayoutNode();
+ const name = info.name;
+ layoutNode.setName(name);
+ generateLayoutChildren(layoutNode, info.children);
+ return layoutNode;
+ }
+ function getSampData(data) {
+ const sampData = new AscFormat.SampData();
+ if (data.dataModel) {
+ const dataModel = new AscFormat.DataModel();
+ if (data.dataModel.ptLst) {
+ const ptLst = new AscFormat.PtLst();
+ for (let i = 0; i < data.dataModel.ptLst.length; i++) {
+ const sampPt = data.dataModel.ptLst[i];
+ const pt = new AscFormat.Point();
+ pt.setModelId(sampPt.id);
+ if (sampPt.type !== undefined) {
+ pt.setType(sampPt.type);
+ }
+ if (sampPt.prSet) {
+ pt.setPrSet(new AscFormat.PrSet());
+ if (sampPt.prSet.phldr) {
+ pt.prSet.setPhldr(sampPt.prSet.phldr);
+ }
+ }
+
+ ptLst.addToLst(ptLst.list.length, pt);
+
+ }
+ dataModel.setPtLst(ptLst);
+ }
+
+ if (data.dataModel.cxnLst) {
+ const cxnLst = new AscFormat.CxnLst();
+ for (let i = 0; i < data.dataModel.cxnLst.length; i += 1) {
+ const sampCxn = data.dataModel.cxnLst[i];
+ const cxn = new AscFormat.Cxn();
+ cxn.setModelId(sampCxn.modelId);
+ cxn.setDestId(sampCxn.destId);
+ cxn.setDestOrd(sampCxn.destOrd);
+ cxn.setSrcId(sampCxn.srcId);
+ cxn.setSrcOrd(sampCxn.srcOrd);
+ cxnLst.addToLst(cxnLst.list.length, cxn);
+ }
+ dataModel.setCxnLst(cxnLst);
+ }
+ if (data.dataModel.bg) {
+ dataModel.setBg(new AscFormat.BgFormat());
+ }
+ if (data.dataModel.whole) {
+ dataModel.setWhole(new AscFormat.Whole());
+ }
+ sampData.setDataModel(dataModel);
+ }
+ return sampData;
+ }
+
+ function getScene3D() {
+ const scene3d = new AscFormat.Scene3d();
+ scene3d.setCamera(new AscFormat.Camera());
+ scene3d.camera.setPrst(AscFormat.Camera_prst_orthographicFront);
+ scene3d.setLightRig(new AscFormat.LightRig());
+ scene3d.lightRig.setRig(AscFormat.LightRig_rig_threePt);
+ scene3d.lightRig.setDir(AscFormat.LightRig_dir_t);
+ return scene3d;
+ }
+ function generateStyleStyleLbl(name, color, idx) {
+ const styleLbl = new AscFormat.StyleDefStyleLbl();
+ styleLbl.setName(name);
+ styleLbl.setScene3d(getScene3D());
+ styleLbl.setSp3d(new AscFormat.Sp3d());
+ styleLbl.setTxPr(new AscFormat.CTextBody());
+ styleLbl.setStyle(new AscFormat.CShapeStyle());
+ styleLbl.style.setLnRef(new AscFormat.StyleRef());
+ styleLbl.style.lnRef.setIdx(idx[0]);
+ styleLbl.style.lnRef.setColor(AscFormat.CreateUniColorRGB(0, 0, 0));
+ styleLbl.style.setFillRef(new AscFormat.StyleRef());
+ styleLbl.style.fillRef.setIdx(idx[1]);
+ styleLbl.style.fillRef.setColor(AscFormat.CreateUniColorRGB(0, 0, 0));
+ styleLbl.style.setEffectRef(new AscFormat.StyleRef());
+ styleLbl.style.effectRef.setIdx(idx[2]);
+ styleLbl.style.effectRef.setColor(AscFormat.CreateUniColorRGB(0, 0, 0));
+ styleLbl.style.setFontRef(new AscFormat.FontRef());
+ styleLbl.style.fontRef.setIdx(AscFormat.fntStyleInd_minor);
+ if (color) {
+ styleLbl.style.fontRef.setColor(AscFormat.CreateSchemeUnicolorWithMods(color.type, color.mods));
+ }
+ return styleLbl;
+ }
+
+ function generateDefaultSmartArtLayout() {
+ const defaultLayoutPreset = {
+ sampData: {
+ dataModel: {
+ ptLst: [
+ {
+ id: "0",
+ type: AscFormat.Point_type_doc
+ },
+ {
+ id: "1",
+ prSet: {
+ phldr: true
+ }
+ },
+ {
+ id: "2",
+ prSet: {
+ phldr: true
+ }
+ },
+ {
+ id: "3",
+ prSet: {
+ phldr: true
+ }
+ },
+ {
+ id: "4",
+ prSet: {
+ phldr: true
+ }
+ },
+ {
+ id: "5",
+ prSet: {
+ phldr: true
+ }
+ }
+ ],
+ cxnLst: [
+ {
+ modelId: "6",
+ srcId: "0",
+ destId: "1",
+ srcOrd: "0",
+ destOrd: "0"
+ },
+ {
+ modelId: "7",
+ srcId: "0",
+ destId: "2",
+ srcOrd: "1",
+ destOrd: "0"
+ },
+ {
+ modelId: "8",
+ srcId: "0",
+ destId: "3",
+ srcOrd: "2",
+ destOrd: "0"
+ },
+ {
+ modelId: "9",
+ srcId: "0",
+ destId: "4",
+ srcOrd: "3",
+ destOrd: "0"
+ },
+ {
+ modelId: "10",
+ srcId: "0",
+ destId: "5",
+ srcOrd: "4",
+ destOrd: "0"
+ }
+ ],
+ bg: {},
+ whole: {}
+ }
+ },
+ styleData: {
+ dataModel: {
+ ptLst: [
+ {
+ id: "0",
+ type: AscFormat.Point_type_doc
+ },
+ {id: "1"},
+ {id: "2"}
+ ],
+ cxnLst: [
+ {
+ modelId: "3",
+ srcId: "0",
+ destId: "1",
+ srcOrd: "0",
+ destOrd: "0"
+ },
+ {
+ modelId: "4",
+ srcId: "0",
+ destId: "2",
+ srcOrd: "1",
+ destOrd: "0"
+ }
+ ],
+ bg: {},
+ whole: {}
+ }
+ },
+ clrData: {
+ dataModel: {
+ ptLst: [
+ {
+ id: "0",
+ type: AscFormat.Point_type_doc
+ },
+ {id: "1"},
+ {id: "2"},
+ {id: "3"},
+ {id: "4"},
+ {id: "5"},
+ {id: "6"}
+ ],
+ cxnLst: [
+ {
+ modelId: "7",
+ srcId: "0",
+ destId: "1",
+ srcOrd: "0",
+ destOrd: "0"
+ },
+ {
+ modelId: "8",
+ srcId: "0",
+ destId: "2",
+ srcOrd: "1",
+ destOrd: "0"
+ },
+ {
+ modelId: "9",
+ srcId: "0",
+ destId: "3",
+ srcOrd: "2",
+ destOrd: "0"
+ },
+ {
+ modelId: "10",
+ srcId: "0",
+ destId: "4",
+ srcOrd: "3",
+ destOrd: "0"
+ },
+ {
+ modelId: "11",
+ srcId: "0",
+ destId: "5",
+ srcOrd: "4",
+ destOrd: "0"
+ },
+ {
+ modelId: "12",
+ srcId: "0",
+ destId: "6",
+ srcOrd: "5",
+ destOrd: "0"
+ }
+ ],
+ bg: {},
+ whole: {}
+ }
+ },
+ layoutNode: {
+ name: "diagram",
+ children: [
+ {
+ varLst: {
+ dir: {},
+ resizeHandles: {
+ val: AscFormat.ResizeHandles_val_exact
+ }
+ }
+ },
+ {
+ choose: {
+ name: "Name0",
+ layoutElse: {
+ name: "Name2",
+ children: [
+ {
+ alg: {
+ type: AscFormat.Alg_type_snake,
+ params: [
+ {type: AscFormat.Param_type_grDir, val: "tR"},
+ {type: AscFormat.Param_type_flowDir, val: "row"},
+ {type: AscFormat.Param_type_contDir, val: "sameDir"},
+ {type: AscFormat.Param_type_off, val: "ctr"}
+ ]
+ }
+ }
+ ]
+ },
+ ifArray: [{
+ name: "Name1",
+ func: AscFormat.If_func_var,
+ arg: AscFormat.If_arg_dir,
+ op: AscFormat.If_op_equ,
+ val: "norm",
+ children: [
+ {
+ alg: {
+ type: AscFormat.Alg_type_snake,
+ params: [
+ {type: AscFormat.Param_type_grDir, val: "tL"},
+ {type: AscFormat.Param_type_flowDir, val: "row"},
+ {type: AscFormat.Param_type_contDir, val: "sameDir"},
+ {type: AscFormat.Param_type_off, val: "ctr"}
+ ]
+ }
+ }
+ ]
+ }]
+ }
+ },
+ {
+ shape: {
+ blip: "",
+ adjLst: []
+ }
+ },
+ {
+ presOf: {}
+ },
+ {
+ constrLst:
+ [
+ {type:AscFormat.Constr_type_w, for: AscFormat.Constr_for_ch, forName: "node", refType: AscFormat.Constr_type_w},
+ {type:AscFormat.Constr_type_h, for: AscFormat.Constr_for_ch, forName: "node", refType: AscFormat.Constr_type_w, refFor: AscFormat.Constr_for_ch, refForName: "node", fact: 0.6},
+ {type:AscFormat.Constr_type_w, for: AscFormat.Constr_for_ch, forName: "sibTrans", refType: AscFormat.Constr_type_w, refFor: AscFormat.Constr_for_ch, refForName: "node", fact: 0.1},
+ {type:AscFormat.Constr_type_sp, refType: AscFormat.Constr_type_w, refFor: AscFormat.Constr_for_ch, refForName: "sibTrans"},
+ {type:AscFormat.Constr_type_primFontSz, for: AscFormat.Constr_for_ch, forName: "node", op: AscFormat.Constr_op_equ, val: 65}
+ ]
+ },
+ {ruleLst: {}},
+ {
+ forEach: {
+ name: "Name3",
+ axis: AscFormat.AxisType_value_ch,
+ ptType: AscFormat.ElementType_value_node,
+ children: [
+ {
+ layoutNode: {
+ name: "node",
+ children: [
+ {
+ varLst: {
+ bulletEnabled: {
+ val: true
+ }
+ }
+ },
+ {
+ alg: {
+ type: AscFormat.Alg_type_tx
+ }
+ },
+ {
+ shape: {
+ type: AscFormat.LayoutShapeType_shapeType_rect,
+ blip: "",
+ adjLst: []
+
+ }
+ },
+ {
+ presOf: {
+ axis: AscFormat.AxisType_value_desOrSelf,
+ ptType: AscFormat.ElementType_value_node
+ }
+ },
+ {
+ constrLst: [
+ {type: AscFormat.Constr_type_lMarg, refType: AscFormat.Constr_type_primFontSz, fact: 0.3},
+ {type: AscFormat.Constr_type_rMarg, refType: AscFormat.Constr_type_primFontSz, fact: 0.3},
+ {type: AscFormat.Constr_type_tMarg, refType: AscFormat.Constr_type_primFontSz, fact: 0.3},
+ {type: AscFormat.Constr_type_bMarg, refType: AscFormat.Constr_type_primFontSz, fact: 0.3}
+ ]
+ },
+ {
+ ruleLst: [
+ {
+ type: AscFormat.Constr_type_primFontSz,
+ val: 5,
+ fact: NaN,
+ max: NaN
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ forEach: {
+ name: "Name4",
+ axis: AscFormat.AxisType_value_followSib,
+ ptType: AscFormat.ElementType_value_sibTrans,
+ cnt: 1,
+ children: [
+ {
+ layoutNode: {
+ name: "sibTrans",
+ children: [
+ {
+ alg: {
+ type: AscFormat.Alg_type_sp
+ }
+ },
+ {
+ shape: {
+ adjLst: [],
+ blip: ""
+ }
+ },
+ {
+ presOf: {}
+ },
+ {
+ constrLst: []
+ },
+ {
+ ruleLst: []
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ };
+ const layoutDef = new AscFormat.LayoutDef();
+ layoutDef.setUniqueId("urn:microsoft.com/office/officeart/2005/8/layout/default");
+ layoutDef.setTitle(new AscFormat.DiagramTitle());
+ layoutDef.setDesc(new AscFormat.DiagramTitle());
+ layoutDef.setCatLst(new AscFormat.CatLst());
+ const category = new AscFormat.SCat();
+ category.setType("list");
+ category.setPri(400);
+ layoutDef.catLst.addToLst(0, category);
+ layoutDef.setSampData(getSampData(defaultLayoutPreset.sampData));
+ layoutDef.setStyleData(getSampData(defaultLayoutPreset.styleData));
+ layoutDef.setClrData(getSampData(defaultLayoutPreset.clrData));
+ layoutDef.setLayoutNode(getLayoutNode(defaultLayoutPreset.layoutNode));
+
+ return layoutDef;
+ }
+
+ function generateDefaultSmartArtQuickStyle() {
+ const defaultStylesInfo = [
+ {
+ names: ["fgImgPlace1", "alignImgPlace1", "bgImgPlace1", "callout",
+ "fgAcc1", "conFgAcc1", "alignAcc1", "bgAcc1", "solidFgAcc1",
+ "solidAlignAcc1", "solidBgAcc1", "fgAccFollowNode1", "alignAccFollowNode1", "bgAccFollowNode1", "fgAcc0", "fgAcc2",
+ "fgAcc3", "fgAcc4", "fgShp"],
+ idx: [2, 1, 0]
+ },
+ {
+ names: ["revTx"],
+ idx: [0, 0, 0]
+ },
+ {
+ names: ["bgShp", "dkBgShp", "trBgShp"],
+ idx: [0, 1, 0]
+ },
+ {
+ names: ["trAlignAcc1"],
+ idx: [1, 1, 0]
+ },
+ {
+ names: ["parChTrans1D1", "parChTrans1D2", "parChTrans1D3", "parChTrans1D4"],
+ idx: [2, 0, 0]
+ },
+ {
+ names: ["sibTrans1D1"],
+ idx: [1, 0, 0]
+ },
+ {
+ names: ["node0", "lnNode1", "alignNode1", "node1", "node2", "node3", "node4",
+ "asst0", "asst1", "asst2", "asst3", "asst4", "parChTrans2D1", "parChTrans2D2", "parChTrans2D3", "parChTrans2D4"],
+ clr: {type: g_clr_lt1},
+ idx: [2, 1, 0]
+ },
+ {
+ names: ["sibTrans2D1", "fgSibTrans2D1", "bgSibTrans2D1"],
+ clr: {type: g_clr_lt1},
+ idx: [0, 1, 0]
+ },
+ {
+ names: ["vennNode1"],
+ clr: {type: g_clr_tx1},
+ idx: [2, 1, 0]
+ }
+ ];
+
+ const styleDef = new AscFormat.StyleDef();
+ styleDef.setUniqueId("urn:microsoft.com/office/officeart/2005/8/quickstyle/simple1");
+ styleDef.setTitle(new AscFormat.DiagramTitle());
+ styleDef.setDesc(new AscFormat.DiagramTitle());
+ styleDef.setCatLst(new AscFormat.CatLst());
+ const cat = new AscFormat.SCat();
+ cat.setType("simple");
+ cat.setPri(10100);
+ styleDef.catLst.addToLst(0, cat);
+ styleDef.setScene3d(getScene3D());
+ for (let i = 0; i < defaultStylesInfo.length; i++) {
+ const info = defaultStylesInfo[i];
+ const color = info.clr;
+ const idx = info.idx;
+ for (let j = 0; j < info.names.length; j++) {
+ styleDef.addToLstStyleLbl(styleDef.styleLbl.length, generateStyleStyleLbl(info.names[j], color, idx));
+ }
+ }
+ return styleDef;
+ }
+
+
+
+ function getTintMod(val) {
+ return {name: "tint", val: val};
+ }
+ function getAlphaMod(val) {
+ return {name: "alpha", val: val};
+ }
+ function getShadeMod(val) {
+ return {name: "shade", val: val};
+ }
+ function repeatAccent(mods) {
+ return {
+ method: AscFormat.ClrLst_meth_repeat,
+ colors: [{type: g_clr_accent1, mods: mods}]
+ };
+ }
+ function repeatLt(mods) {
+ return {
+ method: AscFormat.ClrLst_meth_repeat,
+ colors: [{type: g_clr_lt1, mods: mods}]
+ };
+ }
+ function repeatTx(mods) {
+ return {
+ method: AscFormat.ClrLst_meth_repeat,
+ colors: [{type: g_clr_tx1, mods: mods}]
+ };
+ }
+ function repeatDk(mods) {
+ return {
+ method: AscFormat.ClrLst_meth_repeat,
+ colors: [{type: g_clr_dk1, mods: mods}]
+ };
+ }
+ function repeatAccentTint(val) {
+ return repeatAccent([getTintMod(val)]);
+ }
+ function repeatAccentAlpha(val) {
+ return repeatAccent([getAlphaMod(val)]);
+ }
+ function repeatAccentShade(val) {
+ return repeatAccent([getShadeMod(val)]);
+ }
+ function repeatLtAlpha(val) {
+ return repeatLt([getAlphaMod(val)]);
+ }
+ function generateDefaultSmartArtColors() {
+ const presetStyleLbl = [
+ {
+ names:["node0", "node1", "lnNode1", "node2", "node3", "node4", "asst0", "asst1", "asst2", "asst3", "asst4"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatLt()
+ }
+ },
+ {
+ names:["alignNode1"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatAccent()
+ }
+ },
+ {
+ names:["vennNode1"],
+ clrsLst: {
+ fillClrLst: repeatAccentAlpha(50000),
+ linClrLst: repeatLt()
+ }
+ },
+ {
+ names:["fgImgPlace1", "alignImgPlace1", "bgImgPlace1"],
+ clrsLst: {
+ fillClrLst: repeatAccentTint(50000),
+ linClrLst: repeatLt(),
+ txFillClrLst: repeatLt()
+ }
+ },
+ {
+ names:["sibTrans2D1", "fgSibTrans2D1", "bgSibTrans2D1"],
+ clrsLst: {
+ fillClrLst: repeatAccentTint(60000),
+ linClrLst: repeatAccentTint(60000),
+ }
+ },
+ {
+ names:["sibTrans1D1"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatTx(),
+ }
+ },
+ {
+ names:["callout"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatAccentTint(50000),
+ txFillClrLst: repeatTx(),
+ }
+ },
+ {
+ names:["parChTrans2D1"],
+ clrsLst: {
+ fillClrLst: repeatAccentTint(60000),
+ linClrLst: repeatAccentTint(60000),
+ txFillClrLst: repeatLt()
+ }
+ },
+ {
+ names:["parChTrans2D2", "parChTrans2D3", "parChTrans2D4"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatLt()
+ }
+ },
+ {
+ names:["parChTrans1D1", "parChTrans1D2"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatAccentShade(60000),
+ txFillClrLst: repeatTx()
+ }
+ },
+ {
+ names:["parChTrans1D3", "parChTrans1D4"],
+ clrsLst: {
+ fillClrLst: repeatAccent(),
+ linClrLst: repeatAccentShade(80000),
+ txFillClrLst: repeatTx()
+ }
+ },
+ {
+ names:["fgAcc1", "conFgAcc1", "alignAcc1", "bgAcc1", "fgAcc0", "fgAcc2", "fgAcc3", "fgAcc4"],
+ clrsLst: {
+ fillClrLst: repeatLtAlpha(90000),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatDk()
+ }
+ },
+ {
+ names:["trAlignAcc1"],
+ clrsLst: {
+ fillClrLst: repeatLtAlpha(40000),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatDk()
+ }
+ },
+ {
+ names:["solidFgAcc1", "solidAlignAcc1", "solidBgAcc1"],
+ clrsLst: {
+ fillClrLst: repeatLt(),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatDk()
+ }
+ },
+ {
+ names:["fgAccFollowNode1", "alignAccFollowNode1", "bgAccFollowNode1"],
+ clrsLst: {
+ fillClrLst: repeatAccent([getAlphaMod(90000), getTintMod(40000)]),
+ linClrLst: repeatAccent([getAlphaMod(90000), getTintMod(40000)]),
+ txFillClrLst: repeatDk()
+ }
+ },
+ {
+ names: ["bgShp"],
+ clrsLst: {
+ fillClrLst: repeatAccentTint(40000),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatDk()
+ }
+ },
+ {
+ names: ["dkBgShp"],
+ clrsLst: {
+ fillClrLst: repeatAccentShade(80000),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatLt()
+ }
+ },
+ {
+ names: ["trBgShp"],
+ clrsLst: {
+ fillClrLst: repeatAccent([getTintMod(50000), getAlphaMod(40000)]),
+ linClrLst: repeatAccent(),
+ txFillClrLst: repeatLt()
+ }
+ },
+ {
+ names: ["fgShp"],
+ clrsLst: {
+ fillClrLst: repeatAccentTint(60000),
+ linClrLst: repeatLt(),
+ txFillClrLst: repeatDk()
+ }
+ },
+ {
+ names: ["revTx"],
+ clrsLst: {
+ fillClrLst: repeatLtAlpha(0),
+ linClrLst: repeatDk([getAlphaMod(0)]),
+ txFillClrLst: repeatTx()
+ }
+ }
+ ];
+
+ const colorsDef = new AscFormat.ColorsDef();
+ colorsDef.setUniqueId("urn:microsoft.com/office/officeart/2005/8/colors/accent1_2");
+ colorsDef.setTitle(new AscFormat.DiagramTitle());
+ colorsDef.setDesc(new AscFormat.DiagramTitle());
+ colorsDef.setCatLst(new AscFormat.CatLst());
+ const cat = new AscFormat.SCat();
+ colorsDef.catLst.addToLst(0, cat);
+ cat.setType("accent1");
+ cat.setPri(11200);
+ for (let i = 0; i < presetStyleLbl.length; i++) {
+ const infos = presetStyleLbl[i];
+ const names = infos.names;
+ for (let j = 0; j < names.length; j++) {
+ const styleLbl = createColorsStyleLbl(presetStyleLbl[i].clrsLst, names[j]);
+ colorsDef.addToLstStyleLbl(colorsDef.styleLbl.length, styleLbl);
+ }
+ }
+ return colorsDef;
+ }
+ function createColorsStyleLbl(clrsLst, name) {
+ const styleLbl = new AscFormat.ColorDefStyleLbl();
+ styleLbl.setName(name);
+ styleLbl.setLinClrLst(new AscFormat.ClrLst());
+ styleLbl.setFillClrLst(new AscFormat.ClrLst());
+ styleLbl.setEffectClrLst(new AscFormat.ClrLst());
+ styleLbl.setTxLinClrLst(new AscFormat.ClrLst());
+ styleLbl.setTxFillClrLst(new AscFormat.ClrLst());
+ styleLbl.setTxEffectClrLst(new AscFormat.ClrLst());
+ fillColorsLst(styleLbl.fillClrLst, clrsLst.fillClrLst);
+ fillColorsLst(styleLbl.linClrLst, clrsLst.linClrLst);
+ fillColorsLst(styleLbl.effectClrLst, clrsLst.effectClrLst);
+ fillColorsLst(styleLbl.txLinClrLst, clrsLst.txLinClrLst);
+ fillColorsLst(styleLbl.txFillClrLst, clrsLst.txFillClrLst);
+ fillColorsLst(styleLbl.txEffectClrLst, clrsLst.txEffectClrLst);
+ return styleLbl;
+ }
+ function fillColorsLst(styleLblClrLst, exampleClrLst) {
+ if (!exampleClrLst) {
+ return;
+ }
+ const method = exampleClrLst.method;
+ const colors = exampleClrLst.colors;
+ styleLblClrLst.setMeth(method);
+ for (let i = 0; i < colors.length; i++) {
+ styleLblClrLst.addToLst(i, AscFormat.CreateSchemeUnicolorWithMods(colors[i].type, colors[i].mods));
+ }
+ }
+
+ window["AscFormat"].generateDefaultSmartArtLayout = generateDefaultSmartArtLayout;
+ window["AscFormat"].generateDefaultSmartArtColors = generateDefaultSmartArtColors;
+ window["AscFormat"].generateDefaultSmartArtQuickStyle = generateDefaultSmartArtQuickStyle;
+})(window);
diff --git a/common/SmartArts/SmartArtCache.js b/common/SmartArts/SmartArtCache.js
index dffd6d757e..1589d08706 100644
--- a/common/SmartArts/SmartArtCache.js
+++ b/common/SmartArts/SmartArtCache.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/SmartArts/SmartArtTree.js b/common/SmartArts/SmartArtTree.js
new file mode 100644
index 0000000000..2c1ef3593a
--- /dev/null
+++ b/common/SmartArts/SmartArtTree.js
@@ -0,0 +1,8200 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2023
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(function (window) {
+ // const IS_DEBUG_DRAWING = true;
+ // const IS_ADD_HTML = false;
+ AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN = false;
+
+ const LayoutNode = AscFormat.LayoutNode;
+ const Choose = AscFormat.Choose;
+ const If = AscFormat.If;
+ const Else = AscFormat.Else;
+ const Alg = AscFormat.Alg;
+ const ForEach = AscFormat.ForEach;
+ const Point = AscFormat.Point;
+ const ConstrLst = AscFormat.ConstrLst;
+ const SShape = AscFormat.SShape;
+ const PresOf = AscFormat.PresOf;
+ const RuleLst = AscFormat.RuleLst;
+ const VarLst = AscFormat.VarLst;
+
+ const degToRad = Math.PI / 180;
+ const radToDeg = 1 / degToRad;
+ const algDelta = 1e-10;
+ const intDelta = 1e-2;
+
+ const factRuleState = {
+ default: 0,
+ enabled: 1,
+ disabled: 2
+ };
+
+ function isClockwisePoints(centerPoint, edgePoint1, edgePoint2) {
+ const rectSum = (centerPoint.x - edgePoint1.x) * (edgePoint2.y - edgePoint1.y) -
+ (edgePoint2.x - edgePoint1.x) * (centerPoint.y - edgePoint1.y);
+ return rectSum < 0;
+ }
+
+ function checkBounds(firstBounds, secondBounds) {
+ if (secondBounds.l < firstBounds.l) {
+ firstBounds.l = secondBounds.l;
+ }
+ if (secondBounds.t < firstBounds.t) {
+ firstBounds.t = secondBounds.t;
+ }
+ if (secondBounds.r > firstBounds.r) {
+ firstBounds.r = secondBounds.r;
+ }
+ if (secondBounds.b > firstBounds.b) {
+ firstBounds.b = secondBounds.b;
+ }
+ }
+
+ function fAlgDeltaEqual(a, b) {
+ return AscFormat.fApproxEqual(a, b, algDelta);
+ }
+ function fIntervalDeltaEqual(a, b) {
+ return AscFormat.fApproxEqual(a, b, intDelta);
+ }
+
+ function CCoordPoint(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ CCoordPoint.prototype.getVector = function (point) {
+ return new CVector(point.x - this.x, point.y - this.y);
+ }
+ function CVector(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+ CVector.getVectorByAngle = function (angle) {
+ return new CVector(Math.cos(angle), Math.sin(angle));
+ };
+ CVector.prototype.getDistance = function () {
+ return Math.sqrt(this.x * this.x + this.y * this.y);
+ };
+ CVector.prototype.getDiffVector = function (vector) {
+ return new CVector(this.x - vector.x, this.y - vector.y);
+ };
+ CVector.prototype.multiply = function (value) {
+ this.x *= value;
+ this.y *= value;
+ };
+ CVector.prototype.getAngle = function () {
+ const x = this.x;
+ const y = this.y;
+ const vectorLength = Math.sqrt(x * x + y * y);
+ if (vectorLength !== 0) {
+ const angle = Math.acos(x / vectorLength);
+ if (y > 0) {
+ return angle;
+ }
+ return AscFormat.normalizeRotate(-angle);
+ }
+ return null;
+ };
+
+ CVector.prototype.getAngleBetween = function (vector, isAntiClockwise) {
+ let currentAngle = this.getAngle();
+ let anotherAngle = vector.getAngle();
+
+ if (isAntiClockwise) {
+ if (currentAngle < anotherAngle) {
+ currentAngle += Math.PI * 2;
+ }
+ return currentAngle - anotherAngle;
+ } else {
+ if (anotherAngle < currentAngle || fAlgDeltaEqual(anotherAngle, currentAngle)) {
+ anotherAngle += Math.PI * 2;
+ }
+ return anotherAngle - currentAngle;
+ }
+ };
+
+ function createPresNode(presName, styleLbl, contentNode) {
+ presName = presName || "";
+ const point = new Point();
+ point.setType(AscFormat.Point_type_pres);
+ const prSet = new AscFormat.PrSet();
+ prSet.setPresName(presName);
+ prSet.setPresStyleLbl(styleLbl || "node1");
+
+ point.setPrSet(prSet);
+ return new PresNode(point, contentNode);
+ }
+
+ VarLst.prototype.executeAlgorithm = function (smartartAlgorithm) {};
+
+ PresOf.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ const currentPresNode = smartartAlgorithm.getCurrentPresNode();
+ //todo change read/write only one instance of presof
+ if (currentPresNode.contentNodes.length) {
+ return;
+ }
+ const nodes = this.getNodesArray(smartartAlgorithm);
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ currentPresNode.contentNodes.push(node);
+ node.addPresOf(currentPresNode);
+ }
+
+ if (nodes.length) {
+ currentPresNode.node = nodes[0] || smartartAlgorithm.getCurrentNode();
+ }
+ };
+ LayoutNode.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ const list = this.list;
+ const parentPresNode = smartartAlgorithm.getCurrentPresNode();
+ const curPresNode = smartartAlgorithm.getPresNode(this);
+ parentPresNode.addChild(curPresNode);
+ smartartAlgorithm.addCurrentPresNode(curPresNode);
+ for (let i = 0; i < list.length; i += 1) {
+ const element = this.list[i];
+ element.executeAlgorithm(smartartAlgorithm);
+ }
+ curPresNode.checkMoveWith();
+ curPresNode.initPresShape();
+ smartartAlgorithm.removeCurrentPresNode(curPresNode);
+ }
+ LayoutNode.prototype.getForEachMap = function () {
+ const forEachMap = {};
+ const elements = [this];
+ while (elements.length) {
+ const element = elements.pop();
+
+ const list = element.list;
+ if (list) {
+ elements.push.apply(elements, list);
+ }
+ if (element instanceof ForEach) {
+ forEachMap[element.name] = element;
+ }
+ }
+ return forEachMap;
+ }
+
+ Choose.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ for (let i = 0; i < this.if.length; i++) {
+ if (this.if[i].executeAlgorithm(smartartAlgorithm)) {
+ return;
+ }
+ }
+ this.else.executeAlgorithm(smartartAlgorithm);
+ };
+
+
+ If.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ if (this.checkCondition(smartartAlgorithm)) {
+ for (let i = 0; i < this.list.length; i++) {
+ this.list[i].executeAlgorithm(smartartAlgorithm);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ If.prototype.checkCondition = function (smartArtAlgorithm) {
+ const node = smartArtAlgorithm.getCurrentNode();
+ const nodes = this.getNodesArray(smartArtAlgorithm);
+
+ switch (this.func) {
+ case AscFormat.If_func_cnt:
+ return this.funcCnt(nodes);
+ case AscFormat.If_func_depth:
+ return this.funcDepth(node);
+ case AscFormat.If_func_maxDepth:
+ const depth = node.isParNode() ? node.depth - 1 : node.depth;
+ return this.funcMaxDepth(nodes, depth);
+ case AscFormat.If_func_pos:
+ return this.funcPos(nodes, node);
+ case AscFormat.If_func_posEven:
+ return this.funcPosEven(nodes, node);
+ case AscFormat.If_func_posOdd:
+ return this.funcPosOdd(nodes, node);
+ case AscFormat.If_func_revPos:
+ return this.funcRevPos(nodes, node);
+ case AscFormat.If_func_var:
+ return this.funcVar(smartArtAlgorithm);
+ default:
+ return false;
+ }
+ };
+
+ If.prototype.check = function (expected, result) {
+ switch (this.op) {
+ case AscFormat.If_op_equ: {
+ return expected === result;
+ }
+ case AscFormat.If_op_gt: {
+ return result > expected;
+ }
+ case AscFormat.If_op_lt: {
+ return result < expected;
+ }
+ case AscFormat.If_op_gte: {
+ return result >= expected;
+ }
+ case AscFormat.If_op_lte: {
+ return result <= expected;
+ }
+ case AscFormat.If_op_neq: {
+ return result !== expected;
+ }
+ default: {
+ return false;
+ }
+ }
+ }
+ If.prototype.funcPosEven = function (nodes, currentNode) {
+ const conditionValue = parseInt(this.getConditionValue(), 10);
+ for (let i = 0; i < nodes.length; i += 1) {
+ if (nodes === currentNode) {
+ return this.check(conditionValue, (i + 1) % 2 === 0 ? 1 : 0);
+ }
+ }
+ return false;
+ };
+ If.prototype.funcPosOdd = function (nodes, currentNode) {
+ const conditionValue = parseInt(this.getConditionValue(), 10);
+ const position = currentNode.getPositionByParent() + 1;
+ return this.check(conditionValue, position % 2);
+ };
+ If.prototype.funcPos = function (nodes, currentNode) {
+ const conditionValue = parseInt(this.getConditionValue(), 10);
+ const position = currentNode.getPositionByParent() + 1;
+ return this.check(conditionValue, position);
+ };
+ If.prototype.funcRevPos = function (nodes, currentNode) {
+ const conditionValue = parseInt(this.getConditionValue(), 10);
+ const position = currentNode.getPositionByParent();
+ const parentLength = currentNode.getParentChildLength();
+ return this.check(conditionValue, parentLength - position);
+ };
+ If.prototype.funcDepth = function (currentNode) {
+ const conditionValue = parseInt(this.getConditionValue(), 10);
+ return this.check(conditionValue, currentNode.depth);
+ };
+ If.prototype.funcMaxDepth = function (nodes, curDepth) {
+ const conditionValue = parseInt(this.getConditionValue(), 10);
+ let maxDepth = curDepth;
+ for (let i = 0; i < nodes.length; i++) {
+ const depth = nodes[i].getChildDepth();
+ if (depth > maxDepth) {
+ maxDepth = depth;
+ }
+ }
+ return this.check(conditionValue, maxDepth - curDepth);
+ };
+ If.prototype.getFuncVarNode = function (smartArtAlgorithm) {
+ switch (this.arg) {
+ case AscFormat.If_arg_dir: {
+ return smartArtAlgorithm.dataRoot;
+ }
+ default:
+ return smartArtAlgorithm.getCurrentNode();
+ }
+ };
+ If.prototype.funcVar = function (smartArtAlgorithm) {
+ const node = this.getFuncVarNode(smartArtAlgorithm);
+ const nodeVal = node.getFuncVarValue(this.arg);
+ return this.check(this.getConditionValue(), nodeVal);
+ }
+ If.prototype.funcCnt = function (nodes) {
+ return this.check(parseInt(this.val, 10), nodes.length);
+ }
+ If.prototype.getConditionValue = function () {
+ switch (this.arg) {
+ case AscFormat.If_arg_dir: {
+ return this.getConditionDirValue();
+ }
+ case AscFormat.If_arg_hierBranch: {
+ return this.getConditionHierBranchValue();
+ }
+ default:
+ return this.val;
+ }
+ };
+ If.prototype.getConditionHierBranchValue = function () {
+ switch (this.val) {
+ case 'l':
+ return AscFormat.HierBranch_val_l;
+ case 'r':
+ return AscFormat.HierBranch_val_r;
+ case 'hang':
+ return AscFormat.HierBranch_val_hang;
+ case 'init':
+ return AscFormat.HierBranch_val_init;
+ case 'std':
+ return AscFormat.HierBranch_val_std;
+ default:
+ break;
+ }
+ }
+ If.prototype.getConditionDirValue = function () {
+ switch (this.val) {
+ case 'norm':
+ return AscFormat.DiagramDirection_val_norm;
+ case 'rev':
+ return AscFormat.DiagramDirection_val_rev;
+ default:
+ break;
+ }
+ }
+ ConstrLst.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ smartartAlgorithm.setConstraints(this.list);
+ }
+
+ RuleLst.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ smartartAlgorithm.setRules(this.list);
+ }
+
+ Else.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ for (let i = 0; i < this.list.length; i++) {
+ this.list[i].executeAlgorithm(smartartAlgorithm);
+ }
+ }
+
+ ForEach.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ const refForEach = smartartAlgorithm.getForEach(this.ref);
+ if (refForEach) {
+ refForEach.executeAlgorithm(smartartAlgorithm);
+ return;
+ }
+ const currentNode = smartartAlgorithm.getCurrentNode();
+
+ let isHideLastTrans2 = this.getHideLastTrans(0);
+ if (!isHideLastTrans2) {
+ const parent = currentNode.parent || currentNode;
+ const lastChild = parent.childs[parent.childs.length - 1];
+ if (lastChild && lastChild.sibNode) {
+ lastChild.sibNode.isHideLastTrans = false;
+ }
+ }
+ const nodes = this.getNodesArray(smartartAlgorithm);
+ for (let i = 0; i < nodes.length; i += 1) {
+ const node = nodes[i];
+ smartartAlgorithm.addCurrentNode(node);
+ for (let j = 0; j < this.list.length; j++) {
+ this.list[j].executeAlgorithm(smartartAlgorithm);
+ }
+ smartartAlgorithm.removeCurrentNode();
+ }
+ };
+
+ Alg.prototype.getAlgorithm = function (smartartAlgorithm) {
+ let algorithm;
+ switch (this.getType()) {
+ case AscFormat.Alg_type_snake: {
+ algorithm = new SnakeAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_tx: {
+ algorithm = new TextAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_sp: {
+ algorithm = new SpaceAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_composite: {
+ algorithm = new CompositeAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_lin: {
+ algorithm = new LinearAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_conn: {
+ algorithm = new ConnectorAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_cycle: {
+ algorithm = new CycleAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_pyra: {
+ algorithm = new PyramidAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_hierRoot: {
+ algorithm = new HierarchyRootAlgorithm();
+ break;
+ }
+ case AscFormat.Alg_type_hierChild: {
+ algorithm = new HierarchyChildAlgorithm();
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ if (algorithm) {
+ algorithm.setParams(this.param);
+ algorithm.setParentNode(smartartAlgorithm.getCurrentPresNode());
+ }
+ return algorithm;
+ };
+
+ Alg.prototype.executeAlgorithm = function (smartartAlgorithm) {
+ const node = smartartAlgorithm.getCurrentPresNode();
+ node.setAlgorithm(this.getAlgorithm(smartartAlgorithm));
+ }
+
+
+ Point.prototype.getVariables = function () {
+ const prSet = this.prSet;
+ return prSet && prSet.getPresLayoutVars();
+ }
+ Point.prototype.getDirection = function () {
+ const variables = this.getVariables();
+ if (variables) {
+ const dir = variables.getDir();
+ if (dir) {
+ return dir.getVal();
+ }
+ }
+ return AscFormat.DiagramDirection_val_norm;
+ }
+ SShape.prototype.executeAlgorithm = function (smartartAlgoritm) {
+ const presNode = smartartAlgoritm.getCurrentPresNode();
+ presNode.layoutInfo.shape = this;
+ }
+
+ function SmartArtAlgorithm(smartart) {
+ this.smartart = smartart;
+ const relations = this.smartart.getRelationOfContent2();
+ this.relations = relations.byConnections;
+ this.customRelations = relations.custom;
+ this.dataRoot = null;
+ this.presRoot = null;
+ this.nodesStack = [];
+ this.presNodesStack = [];
+ this.connectorAlgorithmStack = [];
+ this.moveShapeSettings = [];
+ this.forEachMap = null;
+ this.factRuleState = factRuleState.default;
+ this.initDataTree();
+ }
+ SmartArtAlgorithm.prototype.forEachContentNode = function (callback) {
+ const nodes = [this.dataRoot];
+ while (nodes.length) {
+ const node = nodes.pop();
+ callback(node);
+ nodes.push.apply(nodes, node.childs);
+ }
+ };
+ SmartArtAlgorithm.prototype.getDataPointRelations = function () {
+ const mapRelations = {};
+ this.forEachContentNode(function (node) {
+ mapRelations[node.point.getModelId()] = node;
+ if (node.sibNode) {
+ mapRelations[node.sibNode.point.getModelId()] = node.sibNode;
+ }
+ if (node.parNode) {
+ mapRelations[node.parNode.point.getModelId()] = node.parNode;
+ }
+ });
+ return mapRelations;
+ };
+ SmartArtAlgorithm.prototype.setFactRuleState = function (pr) {
+ this.factRuleState = pr;
+ };
+ SmartArtAlgorithm.prototype.addSettingsForMove = function (settings) {
+ this.moveShapeSettings.push(settings);
+ };
+ SmartArtAlgorithm.prototype.applySettingsForMove = function () {
+ while (this.moveShapeSettings.length) {
+ const settings = this.moveShapeSettings.pop();
+ const coefficient = settings.coefficient;
+ const shape = settings.shape;
+
+ const presNode = shape.node;
+ const prSet = presNode.getPrSet();
+ let neighborWidth = null;
+ let neighborHeight = null;
+ const neighbor = presNode.getNeighbor();
+ const neighborShape = neighbor.shape;
+/* if (neighborShape) {
+ if (presNode.node.isSibNode()) {
+ neighborHeight = neighborShape.cleanParams.height;
+ } else {
+ neighborWidth = neighborShape.cleanParams.width;
+ }
+ }*/
+ if (prSet) {
+ let offX = 0;
+ let offY = 0;
+ const radialInfo = shape.getCustomRadialInfo();
+ if (radialInfo) {
+ const custScaleRadius = prSet.custRadScaleRad === null ? 1 : prSet.custRadScaleRad;
+ const custScaleAngle = prSet.custRadScaleInc === null ? 0 : prSet.custRadScaleInc;
+ if (custScaleRadius !== 1 || custScaleAngle !== 0) {
+ const shapeCenterPoint = new CCoordPoint(shape.x + shape.width / 2, shape.y + shape.height / 2);
+ const centerPoint = new CCoordPoint(shapeCenterPoint.x - shape.radialVector.x, shapeCenterPoint.y - shape.radialVector.y);
+ const customRadius = radialInfo.radius;
+ const custAngle = radialInfo.angle;
+ const custVector = CVector.getVectorByAngle(custAngle);
+ custVector.multiply(customRadius);
+ const custCenterPoint = new CCoordPoint(custVector.x + centerPoint.x, custVector.y + centerPoint.y);
+ offX = custCenterPoint.x - shape.width / 2 - shape.x;
+ offY = custCenterPoint.y - shape.height / 2 - shape.y;
+ shape.custCenterPoint = centerPoint;
+ }
+ }
+
+ if (prSet.custLinFactNeighborX) {
+ const width = neighborWidth !== null ? neighborWidth : shape.cleanParams.width;
+ offX += width * prSet.custLinFactNeighborX * coefficient;
+ }
+ if (prSet.custLinFactX) {
+ offX += shape.cleanParams.width * prSet.custLinFactX * coefficient;
+ }
+ if (prSet.custLinFactNeighborY) {
+ const height = neighborHeight !== null ? neighborHeight : shape.cleanParams.height;
+ offY += height * prSet.custLinFactNeighborY * coefficient;
+ }
+ if (prSet.custLinFactY) {
+ offY += shape.cleanParams.height * prSet.custLinFactY * coefficient;
+ }
+
+ const smartart = this.smartart;
+ const smartartHeight = smartart.spPr.xfrm.extY;
+ const smartartWidth = smartart.spPr.xfrm.extX;
+ const shapeBounds = shape.getBounds();
+ if (shapeBounds.l + offX < 0) {
+ offX = -shapeBounds.l;
+ } else if (shapeBounds.r + offX > smartartWidth) {
+ offX = smartartWidth - shapeBounds.r;
+ }
+ if (shapeBounds.t + offY < 0) {
+ offY = -shapeBounds.t;
+ } else if (shapeBounds.b + offY > smartartHeight) {
+ offY = smartartHeight - shapeBounds.b;
+ }
+ if (shape.radialVector) {
+ shape.radialVector = new CVector(shape.radialVector.x + offX, shape.radialVector.y + offY);
+ }
+ shape.moveTo(offX, offY);
+ }
+ }
+ };
+ SmartArtAlgorithm.prototype.getForEach = function (ref) {
+ return this.forEachMap[ref];
+ };
+ SmartArtAlgorithm.prototype.addConnectorAlgorithm = function (algorithm) {
+ this.connectorAlgorithmStack.push(algorithm);
+ }
+ SmartArtAlgorithm.prototype.getParentObjects = function () {
+ const smartart = this.smartart;
+ return smartart.getParentObjects();
+ };
+ SmartArtAlgorithm.prototype.getInitObjects = function () {
+ const api = Asc.editor;
+ if (!api) {
+ return null;
+ }
+ const smartart = this.smartart;
+ const initObjects = Object.create(this.getParentObjects());
+ initObjects.worksheet = null;
+ initObjects.parent = null;
+ initObjects.drawingObjects = null;
+ initObjects.drawingDocument = api.getDrawingDocument();
+ const editorId = api.getEditorId();
+ if (editorId === AscCommon.c_oEditorId.Spreadsheet) {
+ initObjects.worksheet = smartart.worksheet;
+ initObjects.drawingObjects = smartart.drawingObjects;
+ } else if (editorId === AscCommon.c_oEditorId.Presentation) {
+ initObjects.parent = smartart.parent;
+ }
+ return initObjects;
+ };
+ SmartArtAlgorithm.prototype.applyColorsDef = function (shadowShapes) {
+ const colorsDef = this.smartart.getColorsDef();
+ const stylesDef = this.smartart.getStyleDef();
+ const styleLblsByName = stylesDef.styleLblByName;
+ const colorLblsByName = colorsDef.styleLblByName;
+ const parentObjects = this.getParentObjects();
+ const shapesByStyleLbl = {};
+ for (let i = 0; i < shadowShapes.length; i += 1) {
+ const shadowShape = shadowShapes[i];
+ const node = shadowShape.node;
+ const styleLbl = node.getPresStyleLbl();
+ if (styleLbl) {
+ if (!shapesByStyleLbl[styleLbl]) {
+ shapesByStyleLbl[styleLbl] = [];
+ }
+ shapesByStyleLbl[styleLbl].push(shadowShape.connectorShape || shadowShape);
+ }
+ }
+ for (let styleLbl in shapesByStyleLbl) {
+ const colorLbl = colorLblsByName[styleLbl];
+ const shapes = shapesByStyleLbl[styleLbl];
+ if (colorLbl) {
+ colorLbl.setShapeFill(shapes, parentObjects);
+ colorLbl.setShapeLn(shapes, parentObjects);
+ }
+ const quickStyleLbl = styleLblsByName[styleLbl];
+ if (quickStyleLbl) {
+ quickStyleLbl.setShapeStyle(shapes);
+ }
+ }
+ };
+
+ SmartArtAlgorithm.prototype.initDataTree = function () {
+ const dataModel = this.smartart.getDataModel().getDataModel();
+ const mainSmartArtPoint = dataModel.getMainPoint();
+ const treeRoot = new SmartArtDataNode(mainSmartArtPoint, 0);
+ this.dataRoot = treeRoot;
+ const elements = [treeRoot];
+
+ while (elements.length) {
+ const root = elements.shift();
+ const rootChildDepth = root.depth + 1;
+ let connectionChildren = this.relations[[AscFormat.Cxn_type_parOf]][root.getModelId()];
+ if (connectionChildren) {
+ for (let i = 0; i < connectionChildren.length; i += 1) {
+ const connectionChild = connectionChildren[i];
+ const contentPoint = connectionChild.point;
+ const sibPoint = connectionChild.sibPoint;
+ const parPoint = connectionChild.parPoint;
+ const node = new SmartArtDataNode(contentPoint, rootChildDepth);
+ node.setSibNode(new SmartArtSibDataNode(sibPoint, rootChildDepth));
+ node.setParNode(new SmartArtParDataNode(parPoint, rootChildDepth));
+ root.addChild(node);
+ elements.push(node);
+ }
+ if (connectionChildren.length) {
+ const lastNode = elements[elements.length - 1];
+ const sibTrans = lastNode.sibNode;
+ sibTrans.isHideLastTrans = true;
+ }
+ }
+ }
+ }
+
+ SmartArtAlgorithm.prototype.getPresNode = function (layoutNode) {
+ const currentNode = this.getCurrentNode();
+ const currentPresNode = this.getCurrentPresNode();
+ const presRelations = this.relations[AscFormat.Cxn_type_presOf];
+ const presCustomRelations = this.customRelations.presParOfAssocId;
+ const presChildParRelations = this.customRelations.presChildParOf;
+ const presParRelations = this.relations[AscFormat.Cxn_type_presParOf];
+ let presNode;
+ if (!currentNode.presNode) {
+ const nodeModelId = currentNode.getModelId();
+
+ let presPoint = presRelations[nodeModelId];
+ if (!presPoint || presPoint.getPresName() !== layoutNode.name) {
+ let i;
+ if (presCustomRelations[nodeModelId]) {
+ for (i = 0; i < presCustomRelations[nodeModelId].length; i += 1) {
+ const assocPresPoint = presCustomRelations[nodeModelId][i];
+ if (assocPresPoint.getPresName() === layoutNode.name) {
+ presPoint = assocPresPoint;
+ break;
+ }
+ }
+ }
+ while (presPoint && presPoint.getPresName() !== layoutNode.name) {
+ presPoint = presChildParRelations[presPoint.getModelId()];
+ }
+ }
+ if (presPoint) {
+ presNode = new PresNode(presPoint, currentNode);
+ } else {
+ presNode = createPresNode(layoutNode.name, layoutNode.styleLbl, currentNode);
+ }
+ currentNode.setPresNode(presNode);
+ } else {
+ const children = presParRelations[currentPresNode.getModelId()];
+ const child = children && children[currentPresNode.childs.length];
+ if (child) {
+ presNode = new PresNode(child, currentNode);
+ } else {
+ presNode = createPresNode(layoutNode.name, layoutNode.styleLbl, currentNode);
+ }
+ }
+ presNode.moveWith = layoutNode.moveWith;
+ return presNode;
+ };
+
+ SmartArtAlgorithm.prototype.addCurrentPresNode = function (presNode) {
+ this.presNodesStack.push(presNode);
+ }
+ SmartArtAlgorithm.prototype.removeCurrentPresNode = function () {
+ this.presNodesStack.pop();
+ }
+ SmartArtAlgorithm.prototype.getCurrentPresNode = function () {
+ return this.presNodesStack[this.presNodesStack.length - 1];
+ }
+ SmartArtAlgorithm.prototype.getShapes = function () {
+
+ const algorithm = this.presRoot.algorithm;
+ return algorithm ? algorithm.getShapes(this) : [];
+ }
+ SmartArtAlgorithm.prototype.connectShapeSmartArtInfo = function () {
+ const spTree = this.smartart.drawing.spTree;
+ const mapEditorShapes = {};
+ for (let i = 0; i < spTree.length; i++) {
+ const shape = spTree[i];
+ mapEditorShapes[shape.getModelId()] = shape;
+ }
+ this.forEachPresFromBottom(function (presNode) {
+ const point = presNode.presPoint;
+ const editorShape = mapEditorShapes[point.getModelId()];
+ if (editorShape) {
+ const shadowShape = presNode.getShape();
+ shadowShape.setShapeSmartArtInfo(editorShape);
+ shadowShape.editorShape = editorShape;
+ const textNodes = presNode.contentNodes[0] && presNode.contentNodes[0].getTextNodes();
+ if (textNodes) {
+ if (presNode === textNodes.textNode) {
+ presNode.algorithm.applyFontRelations(editorShape);
+ } else if (presNode === textNodes.contentNode && textNodes.textNode) {
+ textNodes.textNode.algorithm.applyFontRelations(editorShape);
+ }
+ }
+ }
+ });
+ };
+
+
+ SmartArtAlgorithm.prototype.cleanDrawingShapeInfo = function () {
+ const smartart = this.smartart;
+ const drawing = smartart.drawing;
+ for (let i = 0; i < drawing.spTree.length; i++) {
+ const shape = drawing.spTree[i];
+ shape.setShapeSmartArtInfo(null);
+ }
+ };
+ SmartArtAlgorithm.prototype.startFromBegin = function () {
+ this.cleanDrawingShapeInfo();
+ this.addCurrentNode(this.dataRoot);
+ const mockPresNode = new PresNode();
+ this.addCurrentPresNode(mockPresNode);
+
+ const layout = this.smartart.getLayoutDef();
+ const layoutNode = layout.getLayoutNode();
+ this.forEachMap = layoutNode.getForEachMap();
+ layoutNode.executeAlgorithm(this);
+
+ this.presRoot = mockPresNode.childs[0];
+ this.presRoot.parent = null;
+ this.presRoot.initRootConstraints(this.smartart, this);
+ this.removeCurrentPresNode();
+ this.removeCurrentNode();
+ this.calcConstraints();
+ this.cleanRules();
+ this.calcScaleCoefficients();
+ if (this.factRuleState === factRuleState.disabled) {
+ this.cleanCalcValues();
+ this.calcConstraints();
+ this.calcScaleCoefficients();
+ }
+ this.calcAdaptedConstraints();
+
+ this.executeAlgorithms();
+ };
+ SmartArtAlgorithm.prototype.cleanCalcValues = function () {
+ this.forEachPresFromTop(function (presNode) {
+ presNode.cleanRules();
+ presNode.cleanConstraints();
+ presNode.cleanScales();
+ presNode.cleanPosition();
+ });
+ this.presRoot.initRootConstraints(this.smartart, this);
+ };
+
+
+ SmartArtAlgorithm.prototype.calcScaleCoefficients = function () {
+ const oThis = this;
+ this.forEachPresFromBottom(function (presNode) {
+ presNode.startAlgorithm(oThis, true);
+ });
+ };
+ SmartArtAlgorithm.prototype.calcAdaptedConstraints = function () {
+ const oThis = this;
+ const isNeedSetRules = this.factRuleState !== factRuleState.disabled;
+ this.forEachPresFromTop(function (presNode) {
+ if (isNeedSetRules) {
+ presNode.setRules(oThis);
+ }
+ presNode.setConstraints(true, oThis);
+ });
+ };
+ SmartArtAlgorithm.prototype.calcConstraints = function () {
+ const oThis = this;
+ const isNeedSetRules = this.factRuleState !== factRuleState.disabled;
+ this.forEachPresFromTop(function (presNode) {
+ if (isNeedSetRules) {
+ presNode.setRules(oThis);
+ }
+ presNode.setConstraints(false, oThis);
+ });
+ };
+ SmartArtAlgorithm.prototype.cleanRules = function () {
+ this.forEachPresFromTop(function (presNode) {
+ presNode.cleanRules();
+ });
+ };
+ SmartArtAlgorithm.prototype.executeAlgorithms = function () {
+ const oThis = this;
+ this.forEachPresFromBottom(function (presNode) {
+ presNode.startAlgorithm(oThis);
+ });
+ this.applySettingsForMove();
+ this.generateConnectors();
+ this.applySettingsForMove();
+ };
+ SmartArtAlgorithm.prototype.generateConnectors = function () {
+ while (this.connectorAlgorithmStack.length) {
+ const connectorAlgorithm = this.connectorAlgorithmStack.pop();
+ connectorAlgorithm.connectShapes(this);
+ }
+ };
+ SmartArtAlgorithm.prototype.forEachPresFromBottom = function (callback) {
+ const checkElements = [this.presRoot];
+ while (checkElements.length) {
+ const elem = checkElements.pop();
+ if (elem.childs.length) {
+ for (let i = 0; i < elem.childs.length; i += 1) {
+ checkElements.push(elem.childs[i]);
+ }
+ } else {
+ const callbackElements = [elem];
+ while (callbackElements.length) {
+ const elem = callbackElements.pop();
+ callback(elem);
+ const firstParentChild = elem.parent && elem.parent.childs[0];
+ if (firstParentChild === elem) {
+ callbackElements.push(elem.parent);
+ }
+ }
+ }
+ }
+ };
+
+
+ SmartArtAlgorithm.prototype.forEachPresFromTop = function (callback) {
+ const elements = [this.presRoot];
+ while (elements.length) {
+ const element = elements.pop();
+ callback(element);
+ for (let i = element.childs.length - 1; i >= 0; i -= 1) {
+ elements.push(element.childs[i]);
+ }
+ }
+ };
+
+
+ SmartArtAlgorithm.prototype.getCurrentNode = function () {
+ return this.nodesStack[this.nodesStack.length - 1];
+ }
+ SmartArtAlgorithm.prototype.addCurrentNode = function (node) {
+ this.nodesStack.push(node);
+ }
+
+ SmartArtAlgorithm.prototype.removeCurrentNode = function () {
+ this.nodesStack.pop();
+ }
+
+ SmartArtAlgorithm.prototype.setConstraints = function (constr) {
+ const node = this.getCurrentPresNode();
+ node.setLayoutConstraints(constr);
+ }
+ SmartArtAlgorithm.prototype.setRules = function (rules) {
+ const node = this.getCurrentPresNode();
+ node.setLayoutRules(rules);
+ }
+
+ function SmartArtDataNodeBase(point, depth) {
+ this.point = point;
+ this.parent = null;
+ this.presNode = null;
+ this.childs = [];
+ this.algorithm = null;
+ this.depth = AscFormat.isRealNumber(depth) ? depth : null;
+ this.presOfArray = [];
+ this.presOf = null;
+ }
+ SmartArtDataNodeBase.prototype.addPresOf = function (presNode) {
+ this.presOfArray.push(presNode);
+ }
+ SmartArtDataNodeBase.prototype.getTextNode = function () {
+ const textNodes = this.getTextNodes();
+ return textNodes.textNode || textNodes.contentNode;
+ };
+ SmartArtDataNodeBase.prototype.getContentNode = function () {
+ const textNodes = this.getTextNodes();
+ return textNodes.contentNode || textNodes.textNode;
+ };
+ SmartArtDataNodeBase.prototype.getTextNodes = function () {
+ if (this.presOf === null) {
+ this.presOf = {
+ contentNode: null,
+ textNode: null
+ };
+ while (this.presOfArray.length) {
+ const presNode = this.presOfArray.pop();
+ if (presNode.algorithm instanceof TextAlgorithm) {
+ this.presOf.textNode = presNode;
+ } else if (presNode.layoutInfo.shape && !presNode.layoutInfo.shape.hideGeom && presNode.layoutInfo.shape.type !== AscFormat.LayoutShapeType_outputShapeType_none) {
+ this.presOf.contentNode = presNode;
+ }
+ }
+ }
+ return this.presOf;
+ };
+ SmartArtDataNodeBase.prototype.getDirection = function () {};
+ SmartArtDataNodeBase.prototype._getHierBranchValue = function () {
+ if (this.presNode) {
+ const presPoint = this.presNode.presPoint;
+ return presPoint && presPoint.getHierBranchValue();
+ }
+ };
+ SmartArtDataNodeBase.prototype.getPositionByParent = function () {
+ return -1;
+ };
+ SmartArtDataNodeBase.prototype.getHierBranch = function () {
+ return this._getHierBranchValue();
+ };
+ SmartArtDataNodeBase.prototype.getFuncVarValue = function (type) {
+ switch (type) {
+ case AscFormat.If_arg_dir:
+ return this.getDirection();
+ case AscFormat.If_arg_hierBranch:
+ return this.getHierBranch();
+ }
+ };
+ SmartArtDataNodeBase.prototype.getPresName = function () {
+ return this.presNode && this.presNode.getPresName();
+ };
+ SmartArtDataNodeBase.prototype.getPtType = function () {
+ return this.point.type;
+ }
+
+ SmartArtDataNodeBase.prototype.getNodesByAxis = function (nodes, axis, ptType) {
+ nodes = nodes || [];
+ switch (axis) {
+ case AscFormat.AxisType_value_root: {
+ this.getNodesByRoot(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_ch: {
+ this.getNodesByCh(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_par: {
+ this.getNodesByParent(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_self: {
+ const needNode = this.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ break;
+ }
+ case AscFormat.AxisType_value_follow: {
+ this.getNodesByFollow(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_followSib: {
+ this.getNodesByFollowSib(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_precedSib: {
+ this.getNodesByPrecedSib(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_des: {
+ this.getNodesByDescendant(nodes, ptType);
+ break;
+ }
+ case AscFormat.AxisType_value_desOrSelf: {
+ this.getNodesByAxis(nodes, AscFormat.AxisType_value_self, ptType);
+ this.getNodesByAxis(nodes, AscFormat.AxisType_value_des, ptType);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return nodes;
+ }
+ SmartArtDataNodeBase.prototype.getParent = function () {
+ return this.parent;
+ }
+ SmartArtDataNodeBase.prototype.getNodesByParent = function (nodes, ptType) {
+ const parent = this.getParent();
+ const needNode = parent && parent.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ };
+ SmartArtDataNodeBase.prototype.getNodesByRoot = function (nodes, ptType) {
+ let curNode = this;
+ while (curNode && !curNode.isRoot()) {
+ curNode = curNode.parent;
+ }
+ if (curNode && curNode.isRoot()) {
+ const needNode = curNode.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ }
+ }
+ SmartArtDataNodeBase.prototype.getNodesByDescendant = function (nodes, ptType) {
+ const elements = [].concat(this.childs);
+ while (elements.length) {
+ const child = elements.shift();
+ const needNode = child.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ for (let i = 0; i < child.childs.length; i++) {
+ elements.push(child.childs[i]);
+ }
+ }
+ };
+
+ SmartArtDataNodeBase.prototype.forEachDes = function (callback) {
+ const elements = [this];
+ while (elements.length) {
+ const element = elements.pop();
+ for (let i = 0; i < element.childs.length; i++) {
+ elements.push(element.childs[i]);
+ callback(element.childs[i]);
+ }
+ }
+ };
+
+ SmartArtDataNodeBase.prototype.forEachDesOrSelf = function (callback) {
+ callback(this);
+ this.forEachDes(callback);
+ };
+ SmartArtDataNodeBase.prototype.getNodesByFollow = function (nodes, ptType) {
+ const parent = this.getParent();
+ if (parent) {
+ let bAdd = false;
+ for (let i = 0; i < parent.childs.length; i++) {
+ const child = parent.childs[i];
+ if (bAdd) {
+ child.forEachDesOrSelf(function (node) {
+ const needNode = node.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ });
+ } else if (child === this) {
+ bAdd = true;
+ if (ptType === AscFormat.ElementType_value_sibTrans) {
+ child.forEachDesOrSelf(function (node) {
+ const needNode = node.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ });
+ }
+ } else if (child.sibNode === this) {
+ bAdd = true;
+ }
+ }
+ }
+ }
+ SmartArtDataNodeBase.prototype.getNodesByFollowSib = function (nodes, ptType) {
+ const parent = this.getParent();
+ if (parent) {
+ let bAdd = false;
+ for (let i = 0; i < parent.childs.length; i++) {
+ const child = parent.childs[i];
+ if (bAdd) {
+ const needNode = parent.childs[i].getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ } else if (child === this) {
+ bAdd = true;
+ if (ptType === AscFormat.ElementType_value_sibTrans) {
+ const needNode = parent.childs[i].getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ }
+ } else if (child.sibNode === this) {
+ bAdd = true;
+ }
+ }
+ }
+ };
+ SmartArtDataNodeBase.prototype.getNodesByPrecedSib = function (nodes, ptType) {
+ const parent = this.parent;
+ if (parent) {
+ for (let i = 0; i < parent.childs.length; i++) {
+ if (parent.childs[i] === this) {
+ if (ptType === AscFormat.ElementType_value_parTrans) {
+ const needNode = parent.childs[i].getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ }
+ break;
+ } else {
+ const needNode = parent.childs[i].getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ }
+ }
+ }
+ };
+
+ SmartArtDataNodeBase.prototype.getNodesByCh = function (nodes, ptType) {
+ for (let i = 0; i < this.childs.length; i++) {
+ const child = this.childs[i];
+ const needNode = child.getNodeByPtType(ptType);
+ if (needNode) {
+ nodes.push(needNode);
+ }
+ }
+ };
+
+ SmartArtDataNodeBase.prototype.addChild = function (child, position) {
+ position = AscFormat.isRealNumber(position) ? position : this.childs.length;
+ this.childs.splice(position, 0, child);
+ child.setParent(this);
+ };
+ SmartArtDataNodeBase.prototype.removeChilds = function (position, count) {
+ this.childs.splice(position, count);
+ };
+ SmartArtDataNodeBase.prototype.setParent = function (parent) {
+ this.parent = parent;
+ };
+ SmartArtDataNodeBase.prototype.setPresNode = function (presNode) {
+ this.presNode = presNode;
+ };
+
+ SmartArtDataNodeBase.prototype.getModelId = function () {
+ return this.point.getModelId();
+ };
+ SmartArtDataNodeBase.prototype.isRoot = function () {
+ return this.point.getType() === AscFormat.Point_type_doc;
+ };
+ SmartArtDataNodeBase.prototype.isNode = function () {
+ return this.point.getType() === AscFormat.Point_type_node;
+ };
+ SmartArtDataNodeBase.prototype.isAsst = function () {
+ return this.point.getType() === AscFormat.Point_type_asst;
+ };
+ SmartArtDataNodeBase.prototype.isContentNode = function () {
+ return false;
+ };
+ SmartArtDataNodeBase.prototype.isSibNode = function () {
+ return false;
+ };
+ SmartArtDataNodeBase.prototype.isParNode = function () {
+ return false;
+ };
+
+ function SmartArtSibDataNode(mainPoint, depth) {
+ SmartArtDataNodeBase.call(this, mainPoint, depth);
+ }
+ AscFormat.InitClassWithoutType(SmartArtSibDataNode, SmartArtDataNodeBase);
+ SmartArtSibDataNode.prototype.isSibNode = function () {
+ return true;
+ };
+ SmartArtSibDataNode.prototype.getParent = function () {
+ return this.parent && this.parent.parent;
+ }
+ SmartArtSibDataNode.prototype.getNodeByPtType = function (elementTypeValue) {
+ switch (elementTypeValue) {
+ case AscFormat.ElementType_value_sibTrans:
+ return this;
+ case AscFormat.ElementType_value_node:
+ return this;
+ default:
+ return this;
+ }
+ }
+
+ function SmartArtParDataNode(mainPoint, depth) {
+ SmartArtDataNodeBase.call(this, mainPoint, depth);
+ }
+ AscFormat.InitClassWithoutType(SmartArtParDataNode, SmartArtDataNodeBase);
+ SmartArtParDataNode.prototype.isParNode = function () {
+ return true;
+ };
+ SmartArtParDataNode.prototype.getNodeByPtType = function (elementTypeValue) {
+ return this;
+ }
+ SmartArtParDataNode.prototype.getDirection = function () {
+ return this.parent.getDirection();
+ };
+ SmartArtParDataNode.prototype.getHierBranch = function () {
+ let node = this;
+ while (node) {
+ const val = node._getHierBranchValue();
+ if (AscFormat.isRealNumber(val)) {
+ return val;
+ }
+ node = node.parent;
+ }
+ return null;
+ };
+ SmartArtParDataNode.prototype.getParent = function () {
+ return this.parent && this.parent.parent;
+ }
+ function SmartArtDataNode(mainPoint, depth) {
+ SmartArtDataNodeBase.call(this, mainPoint, depth);
+ this.sibNode = null;
+ this.parNode = null;
+ this.childDepth = null;
+ }
+ AscFormat.InitClassWithoutType(SmartArtDataNode, SmartArtDataNodeBase);
+ SmartArtDataNode.prototype.getPointType = function () {
+ return this.point.getType();
+ }
+ SmartArtDataNode.prototype.getParentChildLength = function () {
+ const parent = this.getParent();
+ return parent.childs.length;
+ }
+ SmartArtDataNode.prototype.getPositionByParent = function () {
+ const parent = this.getParent();
+ for (let i = 0; i < parent.childs.length; i++) {
+ if (parent.childs[i] === this) {
+ return i;
+ }
+ }
+ return -1;
+ };
+
+ SmartArtDataNode.prototype.getDirection = function () {
+ return this.presNode && this.presNode.getDirection();
+ }
+
+ SmartArtDataNode.prototype.getChildDepth = function () {
+ if (this.childDepth === null) {
+ let maxDepth = this.depth;
+ const tempNodes = [this];
+ while (tempNodes.length) {
+ const node = tempNodes.pop();
+ if (node.depth > maxDepth) {
+ maxDepth = node.depth;
+ }
+ tempNodes.push.apply(tempNodes, node.childs);
+ }
+ this.childDepth = maxDepth;
+ }
+ return this.childDepth;
+ };
+ SmartArtDataNode.prototype.isContentNode = function () {
+ return true;
+ };
+
+ SmartArtDataNode.prototype.setSibNode = function (node) {
+ this.sibNode = node;
+ node.setParent(this);
+ };
+
+ SmartArtDataNode.prototype.setParNode = function (node) {
+ this.parNode = node;
+ node.setParent(this);
+ };
+
+ SmartArtDataNode.prototype.getNodeByPtType = function (elementTypeValue) {
+ switch (elementTypeValue) {
+ case AscFormat.ElementType_value_sibTrans:
+ return this.sibNode;
+ case AscFormat.ElementType_value_node:
+ if (this.isNode() || this.isAsst()) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_parTrans:
+ return this.parNode;
+ case AscFormat.ElementType_value_all:
+ return this;
+ case AscFormat.ElementType_value_asst:
+ if (this.isAsst()) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_doc:
+ if (this.isRoot()) {
+ return this;
+ }
+ break;
+
+ case AscFormat.ElementType_value_nonAsst:
+ if (!this.isAsst()) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_nonNorm:
+ break;
+ case AscFormat.ElementType_value_norm:
+ break;
+ case AscFormat.ElementType_value_pres:
+ break;
+ default:
+ return this;
+ }
+ }
+
+ SmartArtDataNode.prototype.getSibName = function () {
+ return this.sibNode.getPresName();
+ };
+ SmartArtDataNode.prototype.getParName = function () {
+ return this.parNode.getPresName();
+ };
+
+ SmartArtDataNode.prototype.checkName = function (name) {
+ switch (name) {
+ case this.getPresName():
+ return this;
+ case this.getSibName():
+ return this.sibNode;
+ case this.getParName():
+ return this.parNode;
+ default:
+ return null;
+ }
+ }
+
+
+ SmartArtDataNode.prototype.getPrSet = function () {
+ return this.presNode && this.presNode.getPrSet();
+ }
+
+ function Position(node) {
+ this.rot = 0;
+ this.x = 0;
+ this.y = 0;
+ this.width = 0;
+ this.height = 0;
+ this.node = node;
+ this.cleanParams = {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ };
+ }
+ Position.prototype.getMatrix = function () {
+ const matrix = new AscCommon.CMatrix();
+ matrix.RotateAt(this.rot * radToDeg, this.x + this.width / 2, this.y + this.height / 2);
+ return matrix;
+ };
+ Position.prototype.getReverseMatrix = function () {
+ const matrix = new AscCommon.CMatrix();
+ matrix.RotateAt(-this.rot * radToDeg, this.x + this.width / 2, this.y + this.height / 2);
+ return matrix;
+ };
+ Position.prototype.initFromShape = function () {
+
+ };
+ Position.prototype.moveTo = function (dx, dy) {
+ this.node.moveTo(dx, dy, true);
+ };
+ Position.prototype.checkBounds = function (bounds, isClean) {
+ const shapeBounds = this.getBounds(isClean);
+ checkBounds(bounds, shapeBounds);
+ };
+ Position.prototype.getBounds = function (isClean, skipRotate) {
+ const res = {
+ isEllipse: this.node.layoutInfo.shape.type === AscFormat.LayoutShapeType_shapeType_ellipse
+ };
+ const pos = isClean ? this.cleanParams : this;
+ let minX;
+ let maxX;
+ let minY;
+ let maxY;
+ if (skipRotate) {
+ minX = pos.x;
+ maxX = pos.x + pos.width;
+ minY = pos.y;
+ maxY = pos.y + pos.height;
+ } else {
+ const matrix = this.getMatrix();
+ const x1 = matrix.TransformPointX(pos.x, pos.y);
+ const x2 = matrix.TransformPointX(pos.x + pos.width, pos.y);
+ const x3 = matrix.TransformPointX(pos.x, pos.y + pos.height);
+ const x4 = matrix.TransformPointX(pos.x + pos.width, pos.y + pos.height);
+ const y1 = matrix.TransformPointY(pos.x, pos.y);
+ const y2 = matrix.TransformPointY(pos.x + pos.width, pos.y);
+ const y3 = matrix.TransformPointY(pos.x, pos.y + pos.height);
+ const y4 = matrix.TransformPointY(pos.x + pos.width, pos.y + pos.height);
+
+
+ minX = Math.min(x1, x2, x3, x4);
+ maxX = Math.max(x1, x2, x3, x4);
+ minY = Math.min(y1, y2, y3, y4);
+ maxY = Math.max(y1, y2, y3, y4);
+ }
+ if (pos.width < 0) {
+ res.l = maxX;
+ res.r = minX;
+ } else {
+ res.l = minX;
+ res.r = maxX;
+ }
+ if (pos.height < 0) {
+ res.t = maxY;
+ res.b = minY;
+ } else {
+ res.t = minY;
+ res.b = maxY;
+ }
+ return res;
+ };
+ function ShadowShape(node) {
+ Position.call(this, node);
+ this.rot = 0;
+ this.type = AscFormat.LayoutShapeType_outputShapeType_none;
+ this.ln = null;
+ this.fill = null;
+ this.tailLnArrow = null;
+ this.headLnArrow = null;
+ this.style = null;
+ this.shape = null;
+ this.connectorShape = null;
+ this.customAdj = null;
+ this.customGeom = [];
+ this.radialVector = null;
+ this.incAngle = null;
+ }
+ AscFormat.InitClassWithoutType(ShadowShape, Position);
+ ShadowShape.prototype.setRadialInfo = function (radialVector, incAngle) {
+ const nodes = [this.node];
+ while (nodes.length) {
+ const node = nodes.pop();
+ if (node.algorithm instanceof CompositeAlgorithm) {
+ nodes.push.apply(nodes, node.childs);
+ } else {
+ const shape = node.getShape();
+ shape.radialVector = radialVector;
+ shape.incAngle = incAngle;
+ }
+ }
+ };
+ ShadowShape.prototype.getCustomRadialInfo = function () {
+ if (this.radialVector && AscFormat.isRealNumber(this.incAngle)) {
+ const prSet = this.node.getPrSet();
+ if (prSet) {
+ const custScaleRadius = prSet.custRadScaleRad === null ? 1 : prSet.custRadScaleRad;
+ const custScaleAngle = prSet.custRadScaleInc === null ? 0 : prSet.custRadScaleInc;
+ const defaultRadius = this.radialVector.getDistance();
+ const defaultAngle = this.radialVector.getAngle();
+ if (custScaleRadius !== 1 || custScaleAngle !== 0) {
+ const customRadius = defaultRadius * custScaleRadius;
+ const custAngle = AscFormat.normalizeRotate(defaultAngle + custScaleAngle * this.incAngle);
+ return {radius: customRadius, angle: custAngle};
+ }
+ return {radius: defaultRadius, angle: defaultAngle};
+ }
+ }
+ };
+ ShadowShape.prototype.moveTo = function (dX, dY) {
+ this.node.moveTo(dX, dY, false);
+ };
+ ShadowShape.prototype.changeSize = function (coefficient, props) {
+ props = props || {};
+ this.x *= coefficient;
+ this.width *= coefficient;
+ if (props.changeHeight !== false) {
+ this.y *= coefficient;
+ this.height *= coefficient;
+ }
+ }
+ ShadowShape.prototype.initSizesFromConstraints = function () {
+
+ }
+ ShadowShape.prototype.initFromShape = function (shape) {
+ this.shape = shape;
+ if (!(shape.hideGeom && (this.node.algorithm instanceof SpaceAlgorithm))) {
+ this.type = shape.type;
+ }
+
+ }
+
+ ShadowShape.prototype.setFill = function (fill) {
+ this.fill = fill;
+ };
+
+ ShadowShape.prototype.setLn = function (ln) {
+ this.ln = ln;
+ }
+
+ ShadowShape.prototype.setStyle = function (style) {
+ this.style = style;
+ }
+
+ ShadowShape.prototype.getEditorLine = function (initObjects) {
+
+ const shapeTrack = new AscFormat.NewShapeTrack("", this.x, this.y, initObjects.theme, initObjects.master, initObjects.layout, initObjects.slide, 0, undefined, undefined, undefined, true);
+ shapeTrack.track({}, this.x + this.width, this.y + this.height);
+ const shape = shapeTrack.getShape(false, initObjects.drawingDocument, initObjects.drawingObjects);
+ const spPr = shape.spPr;
+ spPr.setFill(null);
+ spPr.setLn(null);
+ spPr.xfrm.setExtX(this.width);
+ spPr.xfrm.setExtY(this.height);
+ shape.setBDeleted(false);
+ shape.setParent(initObjects.parent);
+ shape.setWorksheet(initObjects.worksheet);
+
+ const geometry = spPr.geometry;
+ for (let i = 0; i < this.customGeom.length; i += 1) {
+ const custCommand = this.customGeom[i];
+ for (let j = 1; j < custCommand.length; j++) {
+ custCommand[j] = String(custCommand[j] >> 0);
+ }
+ geometry.AddPathCommand.apply(geometry, custCommand);
+ }
+ this.applyPostEditorSettings(shape);
+ return shape;
+ };
+ ShadowShape.prototype.getEditorShape = function (isLine, initObjects) {
+ if (this.connectorShape) {
+ return this.connectorShape.getEditorShape(this.connectorShape.type === AscFormat.LayoutShapeType_outputShapeType_conn, initObjects);
+ }
+
+ if (isLine) {
+ return this.getEditorLine(initObjects);
+ } else {
+ const shapeType = this.getEditorShapeType();
+ if (typeof shapeType !== 'string') {
+ return null;
+ }
+
+ const shapeTrack = new AscFormat.NewShapeTrack(this.getEditorShapeType(), this.x, this.y, initObjects.theme, initObjects.master, initObjects.layout, initObjects.slide, 0, undefined, undefined, undefined, true);
+ shapeTrack.track({}, this.x + this.width, this.y + this.height);
+ const shape = shapeTrack.getShape(false, initObjects.drawingDocument, initObjects.drawingObjects);
+ const nvSpPr = new AscFormat.UniNvPr();
+ nvSpPr.cNvPr.setId(0);
+ shape.setNvSpPr(nvSpPr);
+ const spPr = shape.spPr;
+ spPr.setFill(null);
+ spPr.setLn(null);
+ spPr.xfrm.setExtX(this.width);
+ spPr.xfrm.setExtY(this.height);
+ shape.setBDeleted(false);
+ shape.setParent(initObjects.parent);
+ shape.setWorksheet(initObjects.worksheet);
+
+ this.applyAdjLst(shape.spPr.geometry);
+ this.applyPostEditorSettings(shape);
+ return shape;
+ }
+ }
+ ShadowShape.prototype.getAdjValueWithApplyFactor = function (adj) {
+ const val = adj.val;
+ const idx = adj.idx;
+ switch (this.type) {
+ case AscFormat.LayoutShapeType_shapeType_pie:
+ case AscFormat.LayoutShapeType_shapeType_arc:
+ return AscFormat.normalizeRotate(val * degToRad) * radToDeg * 60000;
+ case AscFormat.LayoutShapeType_shapeType_blockArc:
+ switch (idx) {
+ case 1:
+ case 2:
+ return AscFormat.normalizeRotate(val * degToRad) * radToDeg * 60000;
+ default:
+ return val * 100000;
+ }
+ case AscFormat.LayoutShapeType_shapeType_circularArrow:
+ case AscFormat.LayoutShapeType_shapeType_leftCircularArrow:
+ switch (idx) {
+ case 2:
+ case 3:
+ case 4:
+ return AscFormat.normalizeRotate(val * degToRad) * radToDeg * 60000;
+ default:
+ return val * 100000;
+ }
+ case AscFormat.LayoutShapeType_shapeType_chord:
+ return AscFormat.normalizeRotate(val * degToRad) * radToDeg * 60000;
+ default:
+ return val * 100000;
+ }
+ };
+ function getAdjName(geometry, id) {
+ switch (geometry.preset) {
+ case "hexagon":
+ if (id === 1) {
+ return "adj"
+ } else if (id === 2) {
+ return "vf";
+ }
+ break;
+ default:
+ const singleAdjName = "adj";
+ const adjName = singleAdjName + id;
+ if (geometry.avLst[adjName]) {
+ return adjName;
+ } else if (geometry.avLst[singleAdjName]) {
+ return singleAdjName;
+ }
+ break;
+ }
+ return null;
+ }
+ ShadowShape.prototype.applyAdjLst = function (geometry) {
+ const adjLst = this.customAdj || (this.shape && this.shape.adjLst);
+ if (adjLst) {
+ for (let i = 0; i < adjLst.list.length; i += 1) {
+ const adj = adjLst.list[i];
+ const adjName = getAdjName(geometry, adj.idx);
+ if (adjName) {
+ geometry.AddAdj(adjName, 0, this.getAdjValueWithApplyFactor(adj));
+ }
+ }
+ }
+
+ }
+ ShadowShape.prototype.setShapeSmartArtInfo = function (editorShape) {
+ const shapeSmartArtInfo = new AscFormat.ShapeSmartArtInfo();
+ editorShape.setShapeSmartArtInfo(shapeSmartArtInfo);
+
+ const presNode = this.node;
+ shapeSmartArtInfo.setShapePoint(presNode.presPoint);
+ editorShape.setModelId(presNode.presPoint.getModelId());
+ for (let i = presNode.contentNodes.length - 1; i >= 0; i -= 1) {
+ const contentNode = presNode.contentNodes[i];
+ shapeSmartArtInfo.addToLstContentPoint(0, contentNode);
+ }
+ };
+
+ ShadowShape.prototype.applyPostEditorSettings = function (editorShape) {
+ this.setShapeSmartArtInfo(editorShape);
+ this.applyShapeSettings(editorShape);
+ this.applyTextSettings(editorShape);
+ this.applyShapeRot(editorShape);
+ };
+
+ ShadowShape.prototype.applyShapeRot = function (editorShape) {
+ const presNode = this.node;
+ let sumRot = this.rot + presNode.moveRot;
+ const prSet = presNode.getPrSet();
+ if (prSet) {
+ if (prSet.custAng) {
+ sumRot += prSet.custAng;
+ }
+ }
+ editorShape.spPr.xfrm.setRot(AscFormat.normalizeRotate(sumRot));
+ };
+
+ ShadowShape.prototype.applyTextSettings = function (editorShape) {
+ const algorithm = this.node.algorithm;
+ algorithm.applyTextSettings(editorShape);
+ };
+ ShadowShape.prototype.applyShapeSettings = function (editorShape) {
+ const shapeSmartArtInfo = editorShape.getSmartArtInfo();
+ const presPoint = shapeSmartArtInfo.shapePoint;
+ const contentPoint = shapeSmartArtInfo.contentPoint[0];
+ let skipSettingDefaultSpPr = false;
+ if (this.style) {
+ editorShape.setStyle(this.style);
+ if (this.fill) {
+ skipSettingDefaultSpPr = true;
+ const fillRef = editorShape.style.fillRef ? editorShape.style.fillRef.createDuplicate() : new AscFormat.StyleRef();
+ const color = this.fill.fill.color || null;
+ fillRef.setColor(color);
+ editorShape.style.setFillRef(fillRef);
+ }
+ if (this.ln) {
+ skipSettingDefaultSpPr = true;
+ const lnRef = editorShape.style.lnRef ? editorShape.style.lnRef.createDuplicate() : new AscFormat.StyleRef();
+ const color = this.ln.Fill.fill.color || null;
+ lnRef.setColor(color);
+ editorShape.style.setLnRef(lnRef);
+ }
+ }
+ if (!editorShape.spPr.ln) {
+ editorShape.spPr.setLn(new AscFormat.CLn());
+ }
+ if (this.headLnArrow) {
+ editorShape.spPr.ln.setHeadEnd(this.headLnArrow);
+ }
+ if (this.tailLnArrow) {
+ editorShape.spPr.ln.setTailEnd(this.tailLnArrow);
+ }
+
+
+ const style = editorShape.style;
+ if (contentPoint && contentPoint.point.prSet && contentPoint.point.prSet.style) {
+ style.merge(contentPoint.point.prSet.style);
+ skipSettingDefaultSpPr = true;
+ }
+ if (presPoint && presPoint.prSet && presPoint.prSet.style) {
+ style.merge(presPoint.prSet.style);
+ skipSettingDefaultSpPr = true;
+ }
+
+ const spPr = editorShape.spPr;
+ if (!skipSettingDefaultSpPr) {
+ if (this.fill) {
+ spPr.setFill(this.fill);
+ } else {
+ spPr.setFill(AscFormat.CreateNoFillUniFill());
+ }
+ if (this.ln) {
+ spPr.setLn(this.ln);
+ } else {
+ spPr.setLn(AscFormat.CreateNoFillLine());
+ }
+ }
+
+ if (contentPoint && contentPoint.point.spPr) {
+ spPr.fullMerge(contentPoint.point.spPr);
+ }
+ if (presPoint && presPoint.spPr) {
+ spPr.fullMerge(presPoint.spPr);
+ }
+ };
+
+ ShadowShape.prototype.getEditorShapeType = function () {
+ if (this.type !== AscFormat.LayoutShapeType_outputShapeType_none && this.type !== AscFormat.LayoutShapeType_outputShapeType_conn) {
+ return AscCommon.To_XML_ST_LayoutShapeType(this.type);
+ }
+ };
+
+
+ function BaseAlgorithm() {
+ this.params = {};
+ this.parentNode = null;
+ this._isHideLastChild = null;
+ this.constraintSizes = null;
+ this.constrClockwise = null;
+ this.calcValues = {};
+ }
+ BaseAlgorithm.prototype.applyTextSettings = function (editorShape) {};
+ BaseAlgorithm.prototype.setConstrClockwise = function (isClockwise) {
+ this.constrClockwise = isClockwise;
+ }
+ BaseAlgorithm.prototype.isClockwise = function () {
+ return true;
+ };
+ BaseAlgorithm.prototype.getConstrClockwise = function () {
+ return this.constrClockwise;
+ }
+ BaseAlgorithm.prototype.getChildAlgorithmAlignBounds = function (isCalculateCoefficients, skipRotate) {
+ let childShape = this.parentNode.getShape(isCalculateCoefficients);
+ if (childShape.connectorShape) {
+ childShape = childShape.connectorShape;
+ }
+ return childShape.getBounds(false, skipRotate);
+ };
+ BaseAlgorithm.prototype.getAlgorithmAlignBounds = function (isCalculateCoefficients) {
+ const childs = this.parentNode.childs;
+ let bounds;
+ const isCycleAlgorithm = this instanceof CycleAlgorithm;
+ for (let i = 0; i < childs.length; i += 1) {
+ const node = childs[i];
+ if (node.isSkipShape(isCalculateCoefficients, isCycleAlgorithm)) {
+ continue;
+ }
+ const childBounds = node.algorithm.getChildAlgorithmAlignBounds(isCalculateCoefficients, isCycleAlgorithm);
+ if (bounds) {
+ checkBounds(bounds, childBounds);
+ } else {
+ bounds = childBounds;
+ }
+ }
+ return bounds;
+ };
+ BaseAlgorithm.prototype.getHorizontalAlgorithmOffset = function (isCalculateCoefficients) {
+ if (this.params[AscFormat.Param_type_horzAlign] === AscFormat.ParameterVal_horizontalAlignment_none) {
+ return 0;
+ }
+
+ const constrBounds = this.getAlgorithmAlignBounds(isCalculateCoefficients);
+ if (!constrBounds) {
+ return 0;
+ }
+
+ switch (this.params[AscFormat.Param_type_horzAlign]) {
+ case AscFormat.ParameterVal_horizontalAlignment_ctr: {
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w, !isCalculateCoefficients);
+ const boundsWidth = constrBounds.r - constrBounds.l;
+ return parentWidth / 2 - (constrBounds.l + boundsWidth / 2);
+ }
+ case AscFormat.ParameterVal_horizontalAlignment_l: {
+ return -constrBounds.l;
+ }
+ case AscFormat.ParameterVal_horizontalAlignment_r: {
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w, !isCalculateCoefficients);
+ return parentWidth - constrBounds.r;
+ }
+ default:
+ return 0;
+
+ }
+ };
+ BaseAlgorithm.prototype.getVerticalAlgorithmOffset = function (isCalculateCoefficients) {
+ if (this.params[AscFormat.Param_type_vertAlign] === AscFormat.ParameterVal_horizontalAlignment_none) {
+ return 0;
+ }
+
+ const constrBounds = this.getAlgorithmAlignBounds(isCalculateCoefficients);
+ if (!constrBounds) {
+ return 0;
+ }
+
+ switch (this.params[AscFormat.Param_type_vertAlign]) {
+ case AscFormat.ParameterVal_verticalAlignment_mid: {
+ const boundsHeight = constrBounds.b - constrBounds.t;
+ const parentHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, !isCalculateCoefficients);
+ return parentHeight / 2 - (constrBounds.t + boundsHeight / 2);
+ }
+ case AscFormat.ParameterVal_verticalAlignment_t: {
+ return -constrBounds.t;
+ }
+ case AscFormat.ParameterVal_verticalAlignment_b: {
+ const parentHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, !isCalculateCoefficients);
+ return parentHeight - constrBounds.b;
+ }
+ default:
+ return 0;
+ }
+ };
+ BaseAlgorithm.prototype.applyAlgorithmAligns = function (isCalculateCoefficients) {
+ const offX = this.getHorizontalAlgorithmOffset(isCalculateCoefficients);
+ const offY = this.getVerticalAlgorithmOffset(isCalculateCoefficients);
+ this.parentNode.forEachChild(function (node) {
+ node.moveTo(offX, offY, isCalculateCoefficients, true);
+ });
+ };
+ BaseAlgorithm.prototype.getParentConnectionNode = function () {
+ return this.parentNode;
+ };
+ BaseAlgorithm.prototype.setParentConnection = function (connectorAlgorithm, childNode) {
+ const parentConnNode = this.getParentConnectionNode();
+ if (connectorAlgorithm && childNode.algorithm && parentConnNode) {
+ let srcNode;
+ let dstNode;
+ if (connectorAlgorithm.params[AscFormat.Param_type_srcNode]) {
+ srcNode = parentConnNode.getNamedNode(connectorAlgorithm.params[AscFormat.Param_type_srcNode]);
+ } else {
+ srcNode = parentConnNode.getDefaultConnectionNode();
+ }
+ if (connectorAlgorithm.params[AscFormat.Param_type_dstNode]) {
+ dstNode = childNode.getNamedNode(connectorAlgorithm.params[AscFormat.Param_type_dstNode]);
+ } else {
+ dstNode = childNode.getDefaultConnectionNode();
+ }
+ if (srcNode && dstNode) {
+ connectorAlgorithm.setParentAlgorithm(this);
+ connectorAlgorithm.setFirstConnectorNode(srcNode);
+ connectorAlgorithm.setLastConnectorNode(dstNode);
+ }
+ }
+ };
+ BaseAlgorithm.prototype.getBounds = function (isCalculateScaleCoefficients, bounds) {
+ const shape = this.parentNode.getShape(isCalculateScaleCoefficients);
+ if (!bounds) {
+ bounds = shape.getBounds();
+ } else {
+ shape.checkBounds(bounds);
+ }
+ return bounds;
+ };
+ BaseAlgorithm.prototype.getRoot = function () {
+ return this.parentNode;
+ };
+ BaseAlgorithm.prototype.getShapes = function (smartartAlgorithm) {
+ const shapes = [];
+ const initObjects = smartartAlgorithm.getInitObjects();
+ if (!initObjects) {
+ return shapes;
+ }
+ const shadowShapes = this.parentNode.getShadowShapesByZOrder();
+ smartartAlgorithm.applyColorsDef(this.parentNode.getDescendantFilteredShapes().sort(function (shape1, shape2) {
+ return shape2.shape.zOrderOff - shape1.shape.zOrderOff;
+ }));
+ for (let i = 0; i < shadowShapes.length; i++) {
+ const shadowShape = shadowShapes[i];
+ const editorShape = shadowShape.getEditorShape(false, initObjects);
+ if (editorShape) {
+ shadowShape.editorShape = editorShape;
+ shapes.push(editorShape);
+ }
+ }
+ return shapes;
+ }
+ BaseAlgorithm.prototype.applyPostAlgorithmSettings = function (smartartAlgorithm) {
+ this.applyPostAlgorithmSettingsForShape(smartartAlgorithm, this.parentNode.getShape(false));
+ };
+ BaseAlgorithm.prototype.isHierarchy = function () {return false;};
+ BaseAlgorithm.prototype.moveToHierarchyOffsets = function () {};
+ BaseAlgorithm.prototype.isRootHierarchy = function () {
+ return false;
+ };
+ BaseAlgorithm.prototype.setConstraintSizes = function (shape) {
+ this.constraintSizes = {
+ x : shape.x,
+ y : shape.y,
+ width : shape.width,
+ height: shape.height
+ }
+ }
+ BaseAlgorithm.prototype.setSibConnection = function (startNode, endNode, connectorAlgorithm) {
+ let srcNode;
+ let dstNode;
+ const parentNode = this.parentNode;
+ if (connectorAlgorithm.params[AscFormat.Param_type_srcNode]) {
+ srcNode = startNode.getNamedNode(connectorAlgorithm.params[AscFormat.Param_type_srcNode]);
+ if (!srcNode) {
+ srcNode = parentNode.getNamedNode(connectorAlgorithm.params[AscFormat.Param_type_srcNode]);
+ }
+ } else {
+ srcNode = startNode.getDefaultConnectionNode();
+ }
+ if (connectorAlgorithm.params[AscFormat.Param_type_dstNode]) {
+ dstNode = endNode.getNamedNode(connectorAlgorithm.params[AscFormat.Param_type_dstNode]);
+ if (!dstNode) {
+ dstNode = parentNode.getNamedNode(connectorAlgorithm.params[AscFormat.Param_type_dstNode]);
+ }
+ } else {
+ dstNode = endNode.getDefaultConnectionNode();
+ }
+ if (srcNode && dstNode) {
+ connectorAlgorithm.setParentAlgorithm(this);
+ connectorAlgorithm.setFirstConnectorNode(srcNode);
+ connectorAlgorithm.setLastConnectorNode(dstNode);
+ }
+ };
+ BaseAlgorithm.prototype.setConnections = function () {
+ const nodes = this.parentNode.childs;
+ let firstNode;
+ let sibConnNode;
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ const shape = node.shape;
+ if (nodes[i].isRealShapeType()) {
+ sibConnNode = nodes[i];
+ }
+ if (shape.type === AscFormat.LayoutShapeType_outputShapeType_conn) {
+ const algorithm = node.algorithm;
+ if (node.isParNode()) {
+ const parConnNode = node.node.parent && node.node.parent.presNode;
+ this.setParentConnection(algorithm, parConnNode);
+ } else {
+ if (!sibConnNode) {
+ continue;
+ }
+ if (!firstNode) {
+ firstNode = sibConnNode;
+ }
+ let nextIndex = i + 1;
+ while (nextIndex < nodes.length && !nodes[nextIndex].isRealShapeType()) {
+ nextIndex += 1;
+ }
+ const lastNode = nodes[nodes.length - 1].node;
+ const nextNode = nextIndex === nodes.length && !lastNode.isHideLastTrans ? firstNode : nodes[nextIndex];
+ if (algorithm && nextNode) {
+ this.setSibConnection(sibConnNode, nextNode, algorithm);
+ }
+ }
+ }
+ }
+ };
+ BaseAlgorithm.prototype.getRadialConnectionInfo = function () {};
+ BaseAlgorithm.prototype.setParentAlgorithm = function (algorithm) {};
+ BaseAlgorithm.prototype.isHideLastChild = function () {
+ if (this._isHideLastChild !== null) {
+ return this._isHideLastChild;
+ }
+ this._isHideLastChild = false;
+ if (this.parentNode.isHideLastTrans) {
+ const childs = this.parentNode.childs;
+ const lastNode = childs[childs.length - 1];
+ if (lastNode && lastNode.isSibNode()) {
+ this._isHideLastChild = true;
+ }
+ }
+ return this._isHideLastChild;
+ };
+
+ BaseAlgorithm.prototype.calcScaleCoefficients = function () {};
+ BaseAlgorithm.prototype.setConnectionDistance = function (value, isStart) {
+
+ };
+ BaseAlgorithm.prototype.setStemThick = function (value) {
+
+ };
+ BaseAlgorithm.prototype.afterShape = function (smartartAlgorithm) {};
+ BaseAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(false, isCalculateScaleCoefficients);
+ };
+ BaseAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ this.createShadowShape(isCalculateScaleCoefficients);
+ };
+ BaseAlgorithm.prototype.setParams = function (params) {
+ this.initParams(params);
+ };
+ BaseAlgorithm.prototype.initParams = function (params) {
+ for (let i = 0; i < params.length; i++) {
+ const param = params[i];
+ this.params[param.type] = param.getValEnum();
+ }
+ };
+ BaseAlgorithm.prototype.getAspectRatio = function () {
+ return this.params[AscFormat.Param_type_ar] || 0;
+ }
+
+
+ BaseAlgorithm.prototype.setParentNode = function (node) {
+ this.parentNode = node;
+ };
+ BaseAlgorithm.prototype.setFirstConnectorNode = function () {
+
+ };
+ BaseAlgorithm.prototype.setLastConnectorNode = function () {
+
+ };
+ BaseAlgorithm.prototype.applyPostAlgorithmSettingsForShape = function (smartartAlgorithm, shape, customCoefficient) {
+ const presNode = shape.node;
+ const prSet = presNode.getPrSet();
+ if (prSet.custLinFactY || prSet.custLinFactX || prSet.custLinFactNeighborY || prSet.custLinFactNeighborX || prSet.custRadScaleInc || prSet.custRadScaleRad) {
+ smartartAlgorithm.addSettingsForMove({shape: shape, coefficient: customCoefficient || 1});
+ }
+ };
+ function PositionAlgorithm() {
+ BaseAlgorithm.call(this);
+ this.connector = null;
+ this.shapeContainer = null;
+ this.coefficientShapeContainer = null;
+ }
+ AscFormat.InitClassWithoutType(PositionAlgorithm, BaseAlgorithm);
+ PositionAlgorithm.prototype.getParentNodeWidth = function (isAdapt) {
+ return this.parentNode.getConstr(AscFormat.Constr_type_w, isAdapt) || this.parentNode.getParentWidth(isAdapt);
+ };
+ PositionAlgorithm.prototype.getParentNodeHeight = function (isAdapt) {
+ return this.parentNode.getConstr(AscFormat.Constr_type_h, isAdapt) || this.parentNode.getParentHeight(isAdapt);
+ };
+ PositionAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficient) {
+ return isCalculateScaleCoefficient ? this.coefficientShapeContainer : this.shapeContainer;
+ };
+
+ PositionAlgorithm.prototype.applyParamOffsets = function (isCalculateScaleCoefficient) {
+ switch (this.params[AscFormat.Param_type_off]) {
+ case AscFormat.ParameterVal_offset_ctr:
+ this.applyCenterAlign(isCalculateScaleCoefficient);
+ break;
+ default:
+ break;
+ }
+ };
+
+ PositionAlgorithm.prototype.applyCenterAlign = function (isCalculateScaleCoefficient) {
+ const parentHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, !isCalculateScaleCoefficient)/* || this.parentNode.getParentHeight(!isCalculateScaleCoefficient)*/;
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w, !isCalculateScaleCoefficient)/* || this.parentNode.getParentWidth(!isCalculateScaleCoefficient)*/;
+ if (!(parentWidth && parentHeight)) {
+ return
+ }
+
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficient);
+ shapeContainer.applyCenterAlign(parentHeight, parentWidth, isCalculateScaleCoefficient, this);
+ };
+
+ PositionAlgorithm.prototype.calcScaleCoefficients = function () {
+
+ };
+ PositionAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm) {
+
+ };
+
+
+ function SnakeAlgorithm() {
+ PositionAlgorithm.call(this);
+ this.calcValues = {
+ spacing: null
+ };
+ }
+
+ AscFormat.InitClassWithoutType(SnakeAlgorithm, PositionAlgorithm);
+ SnakeAlgorithm.prototype.initParams = function (params) {
+ BaseAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_flowDir] === undefined) {
+ this.params[AscFormat.Param_type_flowDir] = AscFormat.ParameterVal_flowDirection_row;
+ }
+ if (this.params[AscFormat.Param_type_grDir] === undefined) {
+ this.params[AscFormat.Param_type_grDir] = AscFormat.ParameterVal_growDirection_tL;
+ }
+ if (this.params[AscFormat.Param_type_bkpt] === undefined) {
+ this.params[AscFormat.Param_type_bkpt] = AscFormat.ParameterVal_breakpoint_endCnv;
+ }
+ if (this.params[AscFormat.Param_type_vertAlign] === undefined) {
+ this.params[AscFormat.Param_type_vertAlign] = AscFormat.ParameterVal_verticalAlignment_mid;
+ }
+ if (this.params[AscFormat.Param_type_horzAlign] === undefined) {
+ this.params[AscFormat.Param_type_horzAlign] = AscFormat.ParameterVal_horizontalAlignment_ctr;
+ }
+ if (this.params[AscFormat.Param_type_contDir] === undefined) {
+ this.params[AscFormat.Param_type_contDir] = AscFormat.ParameterVal_continueDirection_sameDir;
+ }
+ };
+ SnakeAlgorithm.prototype.applyParamOffsets = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ shapeContainer.applyCenterAlign(this.params[AscFormat.Param_type_off] === AscFormat.ParameterVal_offset_ctr);
+ };
+ SnakeAlgorithm.prototype.getStartValues = function (node) {
+ const oRes = {coefficient: 1, width: 0, height: 0, prSpace: 0};
+ if (node) {
+ const shape = node.getShape(true);
+ oRes.height = shape.height;
+ oRes.width = shape.width;
+
+ const smWidth = this.parentNode.getConstr(AscFormat.Constr_type_w);
+ const smHeight = this.parentNode.getConstr(AscFormat.Constr_type_h);
+
+ const widthKoef = smWidth / oRes.width;
+ const heightKoef = smHeight / oRes.height;
+ oRes.coefficient = Math.min(1, widthKoef, heightKoef);
+ }
+ return oRes;
+ };
+
+
+ SnakeAlgorithm.prototype.calculateFixedRowScaleCoefficient = function () {
+ const parentNode = this.parentNode;
+ const childs = parentNode.childs;
+
+ const parentWidth = parentNode.getConstr(AscFormat.Constr_type_w);
+ const parentHeight = parentNode.getConstr(AscFormat.Constr_type_h);
+ const spaceConstr = parentNode.getConstr(AscFormat.Constr_type_sp);
+
+ const countInRow = this.getBreakpointFixedValue();
+ let maxWidth = 0;
+ let height = -spaceConstr;
+ let rowWidth = 0;
+ let maxRowHeight = 0;
+ let rowShapeCounter = 0;
+ for (let i = 0; i < childs.length; i += 1) {
+ const node = childs[i];
+ const shape = node.getShape(true);
+ if (!node.node.isSibNode()) {
+ if (rowShapeCounter === countInRow) {
+ rowShapeCounter = 0;
+ if (maxWidth < rowWidth) {
+ maxWidth = rowWidth;
+ }
+ height += maxRowHeight + spaceConstr;
+ maxRowHeight = shape.height;
+ rowWidth = shape.width;
+ } else {
+ rowWidth += shape.width;
+ if (shape.height > maxRowHeight) {
+ maxRowHeight = shape.height;
+ }
+ }
+ rowShapeCounter += 1;
+ } else if (rowShapeCounter !== 0 && rowShapeCounter !== countInRow) {
+ rowWidth += shape.width;
+ }
+ }
+ if (rowShapeCounter !== 0) {
+ if (maxWidth < rowWidth) {
+ maxWidth = rowWidth;
+ }
+ height += maxRowHeight + spaceConstr;
+ }
+ const coefficient = Math.min(1, parentWidth / maxWidth, parentHeight / height);
+ this.setScaleCoefficient(coefficient);
+ };
+ SnakeAlgorithm.prototype.calculateFixedColumnScaleCoefficient = function () {
+ const parentNode = this.parentNode;
+ const childs = parentNode.childs;
+
+ const parentWidth = parentNode.getConstr(AscFormat.Constr_type_w);
+ const parentHeight = parentNode.getConstr(AscFormat.Constr_type_h);
+ const spaceConstr = parentNode.getConstr(AscFormat.Constr_type_sp);
+
+ const countInColumn = this.getBreakpointFixedValue();
+
+ let maxHeight = 0;
+ let width = -spaceConstr;
+ let columnHeight = 0;
+ let maxColumnWidth = 0;
+ let columnShapeCounter = 0;
+ for (let i = 0; i < childs.length; i += 1) {
+ const node = childs[i];
+ const shape = node.getShape(true);
+ if (!node.node.isSibNode()) {
+ if (columnShapeCounter === countInColumn) {
+ columnShapeCounter = 0;
+ if (maxHeight < columnHeight) {
+ maxHeight = columnHeight;
+ }
+ width += maxColumnWidth + spaceConstr;
+ maxColumnWidth = shape.width;
+ columnHeight = shape.height;
+ } else {
+ columnHeight += shape.height;
+ if (shape.width > maxColumnWidth) {
+ maxColumnWidth = shape.width;
+ }
+ }
+ columnShapeCounter += 1;
+ } else if (columnShapeCounter !== 0 && columnShapeCounter !== countInColumn) {
+ columnHeight += shape.height;
+ }
+ }
+ if (columnShapeCounter !== 0) {
+ if (maxHeight < columnHeight) {
+ maxHeight = columnHeight;
+ }
+ width += maxColumnWidth + spaceConstr;
+ }
+ const coefficient = Math.min(1, parentWidth / width, parentHeight / maxHeight);
+ this.setScaleCoefficient(coefficient);
+ };
+ SnakeAlgorithm.prototype.setScaleCoefficient = function (coefficient) {
+ this.parentNode.forEachDes(function (node) {
+ node.setSizesScale(coefficient, coefficient);
+ });
+ const space = this.parentNode.getConstr(AscFormat.Constr_type_sp);
+ this.calcValues.spacing = coefficient * space;
+ }
+ SnakeAlgorithm.prototype.calculateCanvasRowScaleCoefficient = function () {
+ const parentNode = this.parentNode;
+ const childs = parentNode.childs;
+
+ const parentWidth = parentNode.getConstr(AscFormat.Constr_type_w);
+ const parentHeight = parentNode.getConstr(AscFormat.Constr_type_h);
+ const spaceConstr = parentNode.getConstr(AscFormat.Constr_type_sp);
+ const initValues = this.getStartValues(parentNode.childs[0]);
+ let coefficient = initValues.coefficient;
+ let i = 1;
+ let nNeedRecalc = 0;
+ function calculateAdaptCoefficient() {
+ let prSpaceWidth = 0;
+ let previousRowHeight = 0;
+ let columnWidth = initValues.width;
+ let rowHeight = initValues.height;
+ let previousRowSpace = 0;
+ let previousMaxWidthCoefficient = null;
+ for (i; i < childs.length; i++) {
+ const child = parentNode.childs[i];
+ const childShape = child.getShape(true);
+ if (child.node.isSibNode()) {
+ prSpaceWidth = childShape.width;
+ } else {
+ const width = childShape.width;
+ const height = childShape.height;
+
+ const sumWidth = columnWidth + width + prSpaceWidth;
+ const sumHeight = rowHeight + height + spaceConstr;
+
+ const updatePreviousRowHeight = previousRowHeight + height + previousRowSpace;
+
+
+ let widthCoefficient = 1;
+ let heightCoefficient = 1;
+ widthCoefficient = parentWidth / sumWidth;
+ heightCoefficient = parentHeight / sumHeight;
+ const tempCoefficient = Math.min(coefficient, Math.max(widthCoefficient, heightCoefficient));
+ const nodeWidthCoefficient = parentWidth / width;
+ const nodeHeightCoefficient = parentHeight / updatePreviousRowHeight;
+ let addToWidth = false;
+
+
+ if ((heightCoefficient < 1) && (heightCoefficient > widthCoefficient) && (nodeWidthCoefficient < tempCoefficient)) {
+ coefficient = Math.min(coefficient, /*nodeWidthCoefficient,*/ nodeWidthCoefficient);
+ addToWidth = true;
+ } else if ((updatePreviousRowHeight > rowHeight) && (widthCoefficient < 1) && (widthCoefficient > nodeHeightCoefficient) && (nodeHeightCoefficient < tempCoefficient)) {
+ if (previousRowHeight > height || nNeedRecalc >= i) {
+ coefficient = Math.min(coefficient, nodeHeightCoefficient);
+ } else {
+ coefficient = Math.min(coefficient, parentHeight / height);
+ return true;
+ }
+ } else {
+ if (previousMaxWidthCoefficient !== null && previousMaxWidthCoefficient < coefficient && tempCoefficient < coefficient && previousMaxWidthCoefficient >= heightCoefficient) {
+ coefficient = previousMaxWidthCoefficient;
+ return true;
+ } else if (widthCoefficient < coefficient && (previousMaxWidthCoefficient === null || previousMaxWidthCoefficient < widthCoefficient)) {
+ previousMaxWidthCoefficient = widthCoefficient;
+ }
+ addToWidth = widthCoefficient >= tempCoefficient;
+ coefficient = tempCoefficient;
+
+ }
+ if (addToWidth) {
+ columnWidth = sumWidth;
+ rowHeight = Math.max(rowHeight, updatePreviousRowHeight);
+ // todo need optimize
+ if (nNeedRecalc < i) {
+ return true
+ }
+ } else {
+ previousRowSpace = spaceConstr;
+ previousRowHeight = rowHeight;
+ rowHeight = sumHeight;
+ columnWidth = width;
+ }
+ }
+ }
+ return false;
+ }
+
+ while (calculateAdaptCoefficient()) {
+ nNeedRecalc = i;
+ i = 1;
+ }
+ this.setScaleCoefficient(coefficient);
+ };
+ SnakeAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(false, isCalculateScaleCoefficients);
+ };
+ SnakeAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ if (isCalculateScaleCoefficients) {
+ this.calcScaleCoefficients();
+ } else {
+ this._calculateShapePositions();
+ this.applyParamOffsets();
+ this.applyAlgorithmAligns();
+ this.applyPostAlgorithmSettings();
+ this.setConnections();
+ }
+ this.createShadowShape(isCalculateScaleCoefficients);
+ }
+ SnakeAlgorithm.prototype._calculateShapePositions = function () {
+ if (this.isColumn()) {
+ this.calculateColumnSnakeShapePositions();
+ } else {
+ this.calculateRowSnakeShapePositions();
+ }
+ }
+ SnakeAlgorithm.prototype.getMainElements = function () {
+ const childs = this.parentNode.childs;
+ const mainElements = [];
+ for (let i = 0; i < childs.length; i += 1) {
+ const node = childs[i];
+ if (!node.node.isSibNode()) {
+ mainElements.push(node);
+ }
+ }
+ return mainElements;
+ };
+ SnakeAlgorithm.prototype.getBreakpointFixedValue = function () {
+ if (this.params[AscFormat.Param_type_bkPtFixedVal] !== undefined) {
+ return this.params[AscFormat.Param_type_bkPtFixedVal];
+ }
+ const mainElements = this.getMainElements();
+ return Math.ceil(Math.sqrt(mainElements.length));
+
+ };
+ SnakeAlgorithm.prototype.calcScaleCoefficients = function () {
+ if (this.isColumn()) {
+ if (this.params[AscFormat.Param_type_bkpt] !== AscFormat.ParameterVal_breakpoint_endCnv) {
+ this.calculateFixedColumnScaleCoefficient();
+ }
+ } else {
+ if (this.params[AscFormat.Param_type_bkpt] === AscFormat.ParameterVal_breakpoint_endCnv) {
+ this.calculateCanvasRowScaleCoefficient();
+ } else {
+ this.calculateFixedRowScaleCoefficient();
+ }
+ }
+ };
+ SnakeAlgorithm.prototype.isReverseNextLine = function () {
+ return this.params[AscFormat.Param_type_contDir] === AscFormat.ParameterVal_continueDirection_revDir;
+ };
+ SnakeAlgorithm.prototype.addGridToParentContainer = function (parentContainer, gridContainer, isReverse) {
+ if (isReverse) {
+ gridContainer.reverse();
+ }
+
+ switch (this.params[AscFormat.Param_type_grDir]) {
+ case AscFormat.ParameterVal_growDirection_tL:
+ parentContainer.push(gridContainer);
+ break;
+ case AscFormat.ParameterVal_growDirection_bR:
+ parentContainer.unshift(gridContainer);
+ break;
+ case AscFormat.ParameterVal_growDirection_tR:
+ if (this.isColumn()) {
+ parentContainer.unshift(gridContainer);
+ } else {
+ parentContainer.push(gridContainer);
+ }
+ break;
+ case AscFormat.ParameterVal_growDirection_bL:
+ if (this.isColumn()) {
+ parentContainer.push(gridContainer);
+ } else {
+ parentContainer.unshift(gridContainer);
+ }
+ break;
+ default:
+ break;
+ }
+ };
+ SnakeAlgorithm.prototype.isPushInCurrentLine = function (containerLength) {
+ let defaultValue;
+ switch (this.params[AscFormat.Param_type_grDir]) {
+ case AscFormat.ParameterVal_growDirection_tR:
+ defaultValue = this.isColumn();
+ break;
+ case AscFormat.ParameterVal_growDirection_tL:
+ defaultValue = true;
+ break;
+ case AscFormat.ParameterVal_growDirection_bR:
+ defaultValue = false;
+ break;
+ case AscFormat.ParameterVal_growDirection_bL:
+ defaultValue = !this.isColumn();
+ break;
+ default:
+ defaultValue = true;
+ break;
+ }
+ return this.isReverseNextLine() && (containerLength % 2 === 1) ? !defaultValue : defaultValue;
+ };
+ SnakeAlgorithm.prototype.addShapeToRow = function (row, shape, isPush, offX) {
+ row.push(shape);
+ if (isPush) {
+ shape.moveTo(offX - shape.x, -shape.y);
+ return shape.x + shape.width;
+ } else {
+ shape.moveTo(offX - (shape.x + shape.width), -shape.y);
+ return shape.x;
+ }
+ };
+ SnakeAlgorithm.prototype.addShapeToColumn = function (column, shape, isPush, offY) {
+ column.push(shape);
+ if (isPush) {
+ shape.moveTo(-shape.x, offY - shape.y);
+ return shape.y + shape.height;
+ } else {
+ shape.moveTo(-shape.x, offY - (shape.y + shape.height));
+ return shape.y;
+ }
+ };
+ SnakeAlgorithm.prototype.calculateRowSnakeShapePositions = function () {
+ const childs = this.parentNode.childs;
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w, true);
+ const constrSpace = this.calcValues.spacing;
+ const rows = this.getShapeContainer();
+ rows.setGap(constrSpace);
+ let row = new ShapeContainer();
+ let isPushInCurrentLine = this.isPushInCurrentLine(0);
+ let sibSpacingShapes = [];
+ let sibWidth = 0;
+ let offX = 0;
+ let startX = 0;
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ const shape = child.getShape(false);
+ const newRowWidth = Math.abs(offX - startX) + shape.width + sibWidth;
+ if (newRowWidth > parentWidth && !fAlgDeltaEqual(newRowWidth, parentWidth)) {
+ this.addGridToParentContainer(rows, row, !isPushInCurrentLine);
+ isPushInCurrentLine = this.isPushInCurrentLine(rows.getLength());
+ if (isPushInCurrentLine) {
+ const positionShape = row.shapes[0];
+ offX = positionShape.x;
+ startX = offX;
+ } else {
+ const positionShape = row.shapes[row.shapes.length - 1];
+ offX = positionShape.x + positionShape.width;
+ startX = offX;
+ }
+
+ row = new ShapeContainer();
+ sibSpacingShapes = [];
+ sibWidth = 0;
+ if (!child.node.isSibNode()) {
+ offX = this.addShapeToRow(row, shape, isPushInCurrentLine, offX);
+ }
+ } else {
+ if (!child.node.isSibNode()) {
+ for (let j = 0; j < sibSpacingShapes.length; j += 1) {
+ offX = this.addShapeToRow(row, sibSpacingShapes[j], isPushInCurrentLine, offX);
+ }
+ sibSpacingShapes = [];
+ sibWidth = 0;
+ offX = this.addShapeToRow(row, shape, isPushInCurrentLine, offX);
+ } else if (row.shapes.length !== 0) {
+ sibSpacingShapes.push(shape);
+ sibWidth += shape.width;
+ }
+ }
+ }
+ if (row !== rows.rows[rows.rows.length - 1]) {
+ this.addGridToParentContainer(rows, row);
+ }
+ rows.applyVerticalPositions();
+ };
+
+ SnakeAlgorithm.prototype.calculateColumnSnakeShapePositions = function () {
+ const childs = this.parentNode.childs;
+ const parentHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, true);
+ const constrSpace = this.calcValues.spacing;
+ const columns = this.getShapeContainer();
+ columns.setGap(constrSpace);
+ let column = new ShapeContainer();
+ let isPushInCurrentLine = this.isPushInCurrentLine(0);
+ let sibSpacingShapes = [];
+ let sibSpacingHeight = 0;
+ let offY = 0;
+ let startY = 0;
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ const shape = child.getShape(false);
+ const newRowHeight = Math.abs(offY - startY) + shape.height + sibSpacingHeight;
+ if (newRowHeight > parentHeight && !fAlgDeltaEqual(newRowHeight, parentHeight)) {
+ this.addGridToParentContainer(columns, column, !isPushInCurrentLine);
+ isPushInCurrentLine = this.isPushInCurrentLine(columns.getLength());
+ if (isPushInCurrentLine) {
+ const positionShape = column.shapes[0];
+ offY = positionShape.y;
+ startY = offY;
+ } else {
+ const positionShape = column.shapes[column.shapes.length - 1];
+ offY = positionShape.y + positionShape.height;
+ startY = offY;
+ }
+
+ column = new ShapeContainer();
+ sibSpacingShapes = [];
+ sibSpacingHeight = 0;
+ if (!child.node.isSibNode()) {
+ offY = this.addShapeToColumn(column, shape, isPushInCurrentLine, offY);
+ }
+ } else {
+ if (!child.node.isSibNode()) {
+ for (let j = 0; j < sibSpacingShapes.length; j += 1) {
+ offY = this.addShapeToColumn(column, sibSpacingShapes[j], isPushInCurrentLine, offY);
+ }
+ sibSpacingShapes = [];
+ sibSpacingHeight = 0;
+ offY = this.addShapeToColumn(column, shape, isPushInCurrentLine, offY);
+ } else if (column.shapes.length !== 0) {
+ sibSpacingShapes.push(shape);
+ sibSpacingHeight += shape.height;
+ }
+ }
+ }
+ if (column !== columns.columns[columns.columns.length - 1]) {
+ this.addGridToParentContainer(columns, column);
+ }
+ columns.applyHorizontalPositions();
+ };
+ SnakeAlgorithm.prototype.isColumn = function () {
+ return this.params[AscFormat.Param_type_flowDir] === AscFormat.ParameterVal_flowDirection_col;
+ }
+ SnakeAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficient) {
+ if (isCalculateScaleCoefficient) {
+ if (this.coefficientShapeContainer === null) {
+ this.coefficientShapeContainer = this.isColumn() ? new ShapeColumns() : new ShapeRows();
+ }
+ return this.coefficientShapeContainer;
+ }
+ if (this.shapeContainer === null) {
+ this.shapeContainer = this.isColumn() ? new ShapeColumns() : new ShapeRows();
+ }
+ return this.shapeContainer;
+ };
+
+ function ContainerBase() {
+
+ }
+ ContainerBase.prototype.forEachShape = function (callback) {
+ };
+ ContainerBase.prototype.applyCenterAlign = function (parentHeight, parentWidth, isCalculateScaleCoefficients, algorithm) {
+ };
+
+ function ShapeContainer() {
+ ContainerBase.call(this);
+ this.shapes = [];
+ this.bounds = null;
+ }
+ AscFormat.InitClassWithoutType(ShapeContainer, ContainerBase);
+ ShapeContainer.prototype.forEachShape = function (callback) {
+ for (let i = 0; i < this.shapes.length; i += 1) {
+ callback(this.shapes[i]);
+ }
+ };
+ ShapeContainer.prototype.reverse = function () {
+ return this.shapes.reverse();
+ };
+ ShapeContainer.prototype.push = function (shape) {
+ this.shapes.push(shape);
+ };
+ ShapeContainer.prototype.unshift = function (shape) {
+ this.shapes.unshift(shape);
+ };
+ ShapeContainer.prototype.getBounds = function (isCalculateScaleCoefficient, isClean) {
+ if (this.shapes.length) {
+ const firstShape = this.shapes[0];
+ this.bounds = firstShape.getBounds(isClean);
+ for (let i = 1; i < this.shapes.length; i += 1) {
+ this.shapes[i].checkBounds(this.bounds, isClean);
+ }
+ } else {
+ this.bounds = {l: 0, r: 0, t: 0, b: 0};
+ }
+ return this.bounds;
+ };
+ ShapeContainer.prototype.getOffsets = function (parentHeight, parentWidth, isCalculateScaleCoefficient) {
+ const bounds = this.getBounds(isCalculateScaleCoefficient);
+ const ctrX = bounds.l + (bounds.r - bounds.l) / 2;
+ const ctrY = bounds.t + (bounds.b - bounds.t) / 2;
+ const offX = parentWidth / 2 - ctrX;
+ const offY = parentHeight / 2 - ctrY;
+ return {offX: offX, offY: offY};
+ }
+ ShapeContainer.prototype.applyCenterAlign = function (parentHeight, parentWidth, isCalculateScaleCoefficient, algorithm) {
+ const offsets = this.getOffsets(parentHeight, parentWidth, isCalculateScaleCoefficient);
+ algorithm.moveToHierarchyOffsets(offsets.offX, offsets.offY);
+ for (let i = 0; i < this.shapes.length; i++) {
+ const shape = this.shapes[i];
+ const node = shape.node;
+ node.moveTo(offsets.offX, offsets.offY, isCalculateScaleCoefficient);
+ }
+ };
+ function PyramidContainer() {
+ ShapeContainer.call(this)
+ }
+ AscFormat.InitClassWithoutType(PyramidContainer, ShapeContainer);
+
+ function HierarchyChildContainer() {
+ ShapeContainer.call(this);
+ }
+ AscFormat.InitClassWithoutType(HierarchyChildContainer, ShapeContainer);
+ HierarchyChildContainer.prototype.getBounds = function (isCalculateScaleCoefficient) {
+ let bounds;
+ for (let i = 0; i < this.shapes.length; i += 1) {
+ const shape = this.shapes[i];
+ const algorithm = shape.node.algorithm;
+ bounds = algorithm.getBounds(isCalculateScaleCoefficient, bounds);
+ }
+ if (!bounds) {
+ return {l: 0, r: 0, t: 0, b: 0};
+ }
+ return bounds;
+ };
+ function HierarchyRootContainer() {
+ ShapeContainer.call(this);
+ }
+ AscFormat.InitClassWithoutType(HierarchyRootContainer, ShapeContainer);
+ function CycleContainer() {
+ ShapeContainer.call(this);
+ }
+ AscFormat.InitClassWithoutType(CycleContainer, ShapeContainer);
+ CycleContainer.prototype.getBounds = function (isCalculateScaleCoefficient) {
+ if (this.shapes.length) {
+ const firstShape = this.shapes[0];
+ const bounds = {
+ l: firstShape.x,
+ t: firstShape.y,
+ b: firstShape.y + firstShape.height,
+ r: firstShape.x + firstShape.width
+ };
+ this.bounds = bounds;
+ for (let i = 0; i < this.shapes.length; i += 1) {
+ const shape = this.shapes[i];
+ if (shape.x < bounds.l) {
+ bounds.l = shape.x;
+ }
+ if (shape.y < bounds.t) {
+ bounds.t = shape.y;
+ }
+
+ const r = shape.x + shape.width;
+ if (r > bounds.r) {
+ bounds.r = r;
+ }
+
+ const b = shape.y + shape.height;
+ if (b > bounds.b) {
+ bounds.b = b;
+ }
+ }
+ } else {
+ this.bounds = {l: 0, r: 0, b: 0, t: 0};
+ }
+ return this.bounds;
+ };
+
+
+ function ShapeRows() {
+ ContainerBase.call(this);
+ this.bounds = null;
+ this.rows = [];
+ this.gap = 0;
+ }
+ AscFormat.InitClassWithoutType(ShapeRows, ContainerBase);
+ ShapeRows.prototype.getLength = function () {
+ return this.rows.length;
+ };
+ ShapeRows.prototype.setGap = function (value) {
+ this.gap = value;
+ };
+ ShapeRows.prototype.applyVerticalPositions = function () {
+ for (let i = 1; i < this.rows.length; i += 1) {
+ const currentRow = this.rows[i];
+ const currentRowBounds = currentRow.getBounds();
+ const previousRowBounds = this.rows[i - 1].getBounds();
+
+ const offY = previousRowBounds.b + this.gap - currentRowBounds.t;
+ for (let j = 0; j < currentRow.shapes.length; j += 1) {
+ const shape = currentRow.shapes[j];
+ shape.moveTo(0, offY);
+ }
+ }
+ };
+ ShapeRows.prototype.push = function (elem) {
+ this.rows.push(elem);
+ }
+ ShapeRows.prototype.unshift = function (elem) {
+ this.rows.unshift(elem);
+ }
+ ShapeRows.prototype.getBounds = function (isCalculateScaleCoefficient, isClean) {
+ if (this.rows.length) {
+ const firstBounds = Object.assign({}, this.rows[0].getBounds(isCalculateScaleCoefficient, isClean));
+ for (let i = 0; i < this.rows.length; i++) {
+ const row = this.rows[i];
+ const bounds = row.getBounds(isCalculateScaleCoefficient, isClean);
+ checkBounds(firstBounds, bounds);
+ }
+ this.bounds = firstBounds;
+ } else {
+ this.bounds = {l: 0, r: 0, t: 0, b: 0};
+ }
+ return this.bounds;
+ };
+
+ ShapeRows.prototype.applyCenterAlign = function (isCenteringRows) {
+ const bounds = this.getBounds();
+ const width = bounds.r - bounds.l;
+
+ for (let i = 0; i < this.rows.length; i++) {
+ const row = this.rows[i];
+ const rowBounds = row.getBounds();
+ const rowHeight = rowBounds.b - rowBounds.t;
+ let offRowX = 0;
+ if (isCenteringRows) {
+ const rowWidth = rowBounds.r - rowBounds.l;
+ offRowX = bounds.l + width / 2 - (rowBounds.l + rowWidth / 2);
+ }
+ for (let j = 0; j < row.shapes.length; j++) {
+ const shape = row.shapes[j];
+ const offRowY = rowBounds.t + rowHeight / 2 - (shape.y + shape.height / 2);
+ shape.moveTo(offRowX, offRowY);
+ }
+ }
+ };
+ ShapeRows.prototype.forEachShape = function (callback) {
+ for (let i = 0; i < this.rows.length; i += 1) {
+ this.rows[i].forEachShape(callback);
+ }
+ };
+
+ function ShapeColumns() {
+ ContainerBase.call(this);
+ this.bounds = null;
+ this.columns = [];
+ this.gap = 0;
+ }
+ AscFormat.InitClassWithoutType(ShapeColumns, ContainerBase);
+
+ ShapeColumns.prototype.getLength = function () {
+ return this.columns.length;
+ };
+ ShapeColumns.prototype.push = function (elem) {
+ this.columns.push(elem);
+ }
+ ShapeColumns.prototype.unshift = function (elem) {
+ this.columns.unshift(elem);
+ }
+ ShapeColumns.prototype.setGap = function (value) {
+ this.gap = value;
+ }
+ ShapeColumns.prototype.getBounds = function (isCalculateScaleCoefficient, isClean) {
+ if (this.columns.length) {
+ const firstBounds = Object.assign({}, this.columns[0].getBounds(isCalculateScaleCoefficient, isClean));
+ for (let i = 0; i < this.columns.length; i++) {
+ const column = this.columns[i];
+ const bounds = column.getBounds(isCalculateScaleCoefficient, isClean);
+ checkBounds(firstBounds, bounds);
+ }
+ this.bounds = firstBounds;
+ } else {
+ this.bounds = {l: 0, r: 0, t: 0, b: 0};
+ }
+ return this.bounds;
+ };
+
+ ShapeColumns.prototype.applyHorizontalPositions = function () {
+ for (let i = 1; i < this.columns.length; i += 1) {
+ const currentColumn = this.columns[i];
+ const currentColumnBounds = currentColumn.getBounds();
+ const previousColumnBounds = this.columns[i - 1].getBounds();
+
+ const offX = previousColumnBounds.r + this.gap - currentColumnBounds.l;
+ for (let j = 0; j < currentColumn.shapes.length; j += 1) {
+ const shape = currentColumn.shapes[j];
+ shape.moveTo(offX, 0);
+ }
+ }
+ };
+
+ ShapeColumns.prototype.applyCenterAlign = function (isCenteringColumns) {
+ const bounds = this.getBounds();
+ const height = bounds.b - bounds.t;
+
+ for (let i = 0; i < this.columns.length; i++) {
+ const column = this.columns[i];
+ const columnBounds = column.getBounds();
+ const columnWidth = columnBounds.r - columnBounds.l;
+
+ let offColumnY = 0;
+ if (isCenteringColumns) {
+ const columnHeight = columnBounds.b - columnBounds.t;
+ offColumnY = height / 2 - (columnBounds.t + columnHeight / 2);
+ }
+ for (let j = 0; j < column.shapes.length; j++) {
+ const shape = column.shapes[j];
+ const offColumnX = columnBounds.l + columnWidth / 2 - (shape.x + shape.width / 2);
+ shape.moveTo(offColumnX, offColumnY);
+ }
+ }
+ };
+ ShapeColumns.prototype.forEachShape = function (callback) {
+ for (let i = 0; i < this.columns.length; i += 1) {
+ this.columns[i].forEachShape(callback);
+ }
+ };
+
+function HierarchyAlgorithm() {
+ PositionAlgorithm.call(this);
+ this.levelPositions = [];
+ this.calcValues = {
+ mainChilds: null
+ };
+}
+ AscFormat.InitClassWithoutType(HierarchyAlgorithm, PositionAlgorithm);
+ HierarchyAlgorithm.prototype.moveToHierarchyOffsets = function (dx, dy) {
+ for (let i = 0; i < this.levelPositions.length; i += 1) {
+ const levelPosition = this.levelPositions[i];
+ levelPosition.l += dx;
+ levelPosition.r += dx;
+ levelPosition.t += dy;
+ levelPosition.b += dy;
+ }
+ };
+ HierarchyAlgorithm.prototype.setLevelBounds = function (bounds) {
+ this.levelPositions.push(Object.assign({}, bounds));
+ };
+ HierarchyAlgorithm.prototype.getHorizontalOffset = function (node, isCalculateScaleCoefficient, fromLeft) {
+ const algorithm = node.algorithm;
+ let maxSpace = 0;
+ const shape = node.getShape(isCalculateScaleCoefficient);
+
+ for (let i = 0; i < this.levelPositions.length; i += 1) {
+ const startBounds = this.levelPositions[i];
+ for (let j = 0; j < algorithm.levelPositions.length; j += 1) {
+ const endBounds = algorithm.levelPositions[j];
+ let levelDifference;
+ if (fromLeft) {
+ levelDifference = startBounds.r - endBounds.l;
+ } else {
+ levelDifference = endBounds.r - startBounds.l;
+ }
+ if (levelDifference > maxSpace && !!this.getVerticalIntersection(startBounds, endBounds)) {
+ maxSpace = levelDifference;
+ }
+ }
+ const shapeBounds = shape.getBounds();
+ let nodeDifference;
+ if (fromLeft) {
+ nodeDifference = startBounds.r - shapeBounds.l;
+ } else {
+ nodeDifference = shapeBounds.r - startBounds.l;
+ }
+ if (nodeDifference > maxSpace && !!this.getVerticalIntersection(shapeBounds, startBounds)) {
+ maxSpace = nodeDifference;
+ }
+ }
+ return maxSpace;
+ };
+ HierarchyAlgorithm.prototype.getHorizontalIntersection = function (bounds1, bounds2) {
+ return Math.max(Math.min(bounds1.r, bounds2.r) - Math.max(bounds1.l, bounds2.l), 0);
+ };
+ HierarchyAlgorithm.prototype.getVerticalIntersection = function (bounds1, bounds2) {
+ return Math.max(Math.min(bounds1.b, bounds2.b) - Math.max(bounds1.t, bounds2.t), 0);
+ };
+ HierarchyAlgorithm.prototype.getVerticalOffset = function (node, isCalculateScaleCoefficient) {
+ const algorithm = node.algorithm;
+ let maxSpace = 0;
+ const shape = node.getShape(isCalculateScaleCoefficient);
+ for (let i = 0; i < this.levelPositions.length; i += 1) {
+ const startBounds = this.levelPositions[i];
+ for (let j = 0; j < algorithm.levelPositions.length; j += 1) {
+ const endBounds = algorithm.levelPositions[j];
+ const levelDifference = startBounds.b - endBounds.t;
+ if (levelDifference > maxSpace && !!this.getHorizontalIntersection(startBounds, endBounds)) {
+ maxSpace = levelDifference;
+ }
+ }
+ const shapeBounds = shape.getBounds();
+ const nodeDifference = startBounds.b - shapeBounds.t;
+ if (nodeDifference > maxSpace && !!this.getHorizontalIntersection(shapeBounds, startBounds)) {
+ maxSpace = nodeDifference;
+ }
+ }
+ return maxSpace;
+ };
+ HierarchyAlgorithm.prototype.isHierarchy = function () {
+ return true;
+ };
+ HierarchyAlgorithm.prototype.getMainChilds = function () {
+ if (this.calcValues.mainChilds === null) {
+ const childs = [];
+ for (let i = 0; i < this.parentNode.childs.length; i += 1) {
+ const child = this.parentNode.childs[i];
+ if (child.isContentNode()) {
+ childs.push(child);
+ }
+ }
+ this.calcValues.mainChilds = childs;
+ }
+ return this.calcValues.mainChilds;
+ };
+ HierarchyAlgorithm.prototype._calculateShapePositions = function (isAdapt) {
+
+ };
+ HierarchyAlgorithm.prototype.setScaleCoefficient = function () {
+ if (this.parentNode.parent && !(this.parentNode.parent.algorithm instanceof CompositeAlgorithm)) {
+ return;
+ }
+ const childs = this.getMainChilds();
+ const parentHeight = this.parentNode.getConstr(AscFormat.Constr_type_h);
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w);
+ if (!(parentHeight && parentWidth)) {
+ return;
+ }
+ const shapeContainer = this.getShapeContainer(true);
+ const bounds = shapeContainer.getBounds(true);
+ const height = bounds.b - bounds.t;
+ const width = bounds.r - bounds.l;
+
+ const widthCoefficient = Math.min(parentWidth / width, 1);
+ const heightCoefficient = Math.min(parentHeight / height, 1);
+ const coefficient = Math.min(widthCoefficient, heightCoefficient, 1);
+ if (!AscFormat.isRealNumber(coefficient)) {
+ return
+ }
+
+ this.parentNode.forEachDes(function (node) {
+ node.setSizesScale(coefficient, coefficient);
+ });
+ };
+
+ HierarchyAlgorithm.prototype.updateLevelPositions = function (algorithm) {
+ if (algorithm.levelPositions) {
+ for (let i = 0; i < algorithm.levelPositions.length; i += 1) {
+ this.setLevelBounds(algorithm.levelPositions[i]);
+ }
+ }
+ };
+ HierarchyAlgorithm.prototype.resetLevelPositions = function () {
+ this.levelPositions = [];
+ };
+ HierarchyAlgorithm.prototype.collectHierarchyPositions = function () {};
+ HierarchyAlgorithm.prototype.putShapesToShapeContainer = function (isCalculateScaleCoefficient) {};
+ HierarchyAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ this.resetLevelPositions();
+ this.putShapesToShapeContainer(isCalculateScaleCoefficients);
+ this._calculateShapePositions(isCalculateScaleCoefficients);
+ this.applyParamOffsets(isCalculateScaleCoefficients);
+ this.collectHierarchyPositions();
+ if (isCalculateScaleCoefficients) {
+ this.setScaleCoefficient();
+ } else {
+ this.setConnections();
+ }
+ this.createShadowShape(isCalculateScaleCoefficients);
+ };
+
+
+ function HierarchyChildAlgorithm() {
+ HierarchyAlgorithm.call(this);
+ }
+ AscFormat.InitClassWithoutType(HierarchyChildAlgorithm, HierarchyAlgorithm);
+
+ HierarchyChildAlgorithm.prototype.getHorizontalSibSp = function (node, isCalculateScaleCoefficient, fromLeft) {
+ const sibSp = this.parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+ const offset = this.getHorizontalOffset(node, isCalculateScaleCoefficient, fromLeft);
+ if (fromLeft) {
+ return sibSp + offset;
+ } else {
+ return - offset - sibSp;
+ }
+ };
+ HierarchyChildAlgorithm.prototype.getVerticalSibSp = function (node, isCalculateScaleCoefficient) {
+ const sibSp = this.parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+ const offset = this.getVerticalOffset(node, isCalculateScaleCoefficient);
+ return sibSp + offset;
+ };
+ HierarchyChildAlgorithm.prototype.isHorizontalHierarchy = function () {
+ const parent = this.parentNode.parent;
+ if (parent && parent.algorithm.isHierarchy()) {
+ return parent.algorithm.isHorizontalHierarchy();
+ } else {
+ switch (this.params[AscFormat.Param_type_chAlign]) {
+ case AscFormat.ParameterVal_childAlignment_r:
+ case AscFormat.ParameterVal_childAlignment_l:
+ return true;
+ default:
+ return false;
+ }
+ }
+ };
+ HierarchyChildAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createHierarchyChildShadowShape(isCalculateScaleCoefficients);
+ };
+ HierarchyChildAlgorithm.prototype.setParentConnection = function (connectorAlgorithm, childNode) {
+ const parent = this.parentNode.parent;
+ if (parent && parent.algorithm.isHierarchy()) {
+ const root = parent.algorithm.getRoot();
+ root.algorithm.setParentConnection(connectorAlgorithm, childNode.algorithm.getRoot());
+ }
+ };
+ HierarchyChildAlgorithm.prototype.initParams = function (params) {
+ HierarchyAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_linDir] === undefined) {
+ this.params[AscFormat.Param_type_linDir] = AscFormat.ParameterVal_linearDirection_fromL;
+ }
+ if (this.params[AscFormat.Param_type_chAlign] === undefined) {
+ this.params[AscFormat.Param_type_chAlign] = AscFormat.ParameterVal_childAlignment_t;
+ }
+ if (this.params[AscFormat.Param_type_off] === undefined) {
+ this.params[AscFormat.Param_type_off] = AscFormat.ParameterVal_offset_ctr;
+ }
+ }
+
+ HierarchyChildAlgorithm.prototype.isHang = function () {
+ return this.params[AscFormat.Param_type_secLinDir] !== undefined &&
+ this.params[AscFormat.Param_type_linDir] !== undefined;
+ }
+ HierarchyChildAlgorithm.prototype.getCommonChildBounds = function (isCalculateScaleCoefficient) {
+ const childs = this.getMainChilds();
+ let bounds;
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ bounds = child.algorithm.getBounds(isCalculateScaleCoefficient, bounds);
+ }
+ return bounds;
+ };
+ HierarchyChildAlgorithm.prototype.getRootCenteringOffset = function (shape, isCalculateScaleCoefficient) {
+ const result = {offX: 0, offY: 0};
+ if (this.isHang()) {
+ const isHorizontal = this.isHorizontalHierarchy();
+ const sibSp = this.parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+ const bounds = this.getHangStructBounds(isCalculateScaleCoefficient);
+ if (!bounds) {
+ return result;
+ }
+ if (isHorizontal) {
+ result.offY = shape.y + shape.height / 2 - bounds.b - sibSp / 2;
+ } else {
+ if (this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromR) {
+ result.offX = shape.x + shape.width / 2 - bounds.l + sibSp / 2;
+ } else {
+ result.offX = shape.x + shape.width / 2 - bounds.r - sibSp / 2;
+ }
+ }
+ }
+ return result;
+ };
+ HierarchyChildAlgorithm.prototype.putShapesToShapeContainer = function (isCalculateScaleCoefficient) {
+ const childs = this.getMainChilds();
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficient);
+ for (let i = 0; i < childs.length; i += 1) {
+ shapeContainer.push(childs[i].getShape(isCalculateScaleCoefficient));
+ }
+ }
+ HierarchyChildAlgorithm.prototype.calculateVerticalHierarchyVerticalShapePositions = function (isCalculateScaleCoefficient, fromTop) {
+ const childs = fromTop ? this.getMainChilds() : this.getMainChilds().slice().reverse();
+ const parentNode = this.parentNode;
+ const sibSp = parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+ const commonBounds = this.getCommonChildBounds(isCalculateScaleCoefficient);
+ const firstShape = childs[0].getShape(isCalculateScaleCoefficient);
+ const firstBounds = childs[0].algorithm.getBounds(isCalculateScaleCoefficient);
+
+ const firstChildOffsets = this.getChildAlignOffsets(commonBounds, firstBounds, this.params[AscFormat.Param_type_chAlign]);
+ firstShape.moveTo(firstChildOffsets.offX, firstChildOffsets.offY);
+
+ let offY = firstBounds.b - firstBounds.t + sibSp;
+ this.setLevelBounds({l: firstShape.x, t: firstShape.y, b: firstShape.y + firstShape.height, r: firstShape.x + firstShape.width});
+ this.updateLevelPositions(childs[0].algorithm);
+ let previousShape = firstShape;
+ let previousDesHeight = firstBounds.b - firstBounds.t;
+ for (let i = 1; i < childs.length; i += 1) {
+ const node = childs[i];
+ const shape = node.getShape(isCalculateScaleCoefficient);
+ const bounds = node.algorithm.getBounds(isCalculateScaleCoefficient);
+ const childOffsets = this.getChildAlignOffsets(commonBounds, bounds, this.params[AscFormat.Param_type_chAlign]);
+ const offY = previousShape.y + previousDesHeight + sibSp - shape.y;
+ shape.moveTo(childOffsets.offX, offY + childOffsets.offY);
+ this.setLevelBounds({l: shape.x, t: shape.y, b: shape.y + shape.height, r: shape.x + shape.width});
+ this.updateLevelPositions(node.algorithm);
+ previousShape = shape;
+ previousDesHeight = bounds.b - bounds.t;
+ }
+ };
+ HierarchyChildAlgorithm.prototype.calculateHorizontalHierarchyVerticalShapePositions = function (isCalculateScaleCoefficient, fromTop) {
+ const childs = fromTop ? this.getMainChilds() : this.getMainChilds().slice().reverse();
+ const commonBounds = this.getCommonChildBounds(isCalculateScaleCoefficient);
+ const firstNode = childs[0];
+ const firstShape = firstNode.getShape(isCalculateScaleCoefficient);
+ const firstBounds = firstNode.algorithm.getBounds(isCalculateScaleCoefficient);
+ const firstChildOffsets = this.getChildAlignOffsets(commonBounds, firstBounds, this.params[AscFormat.Param_type_chAlign]);
+ firstShape.moveTo(firstChildOffsets.offX, firstChildOffsets.offY);
+
+ this.updateLevelPositions(firstNode.algorithm);
+ let previousShape = firstShape;
+ this.setLevelBounds({l: firstShape.x, r: firstShape.x + firstShape.width, t: firstShape.y, b: firstShape.y + firstShape.height});
+ for (let i = 1; i < childs.length; i += 1) {
+ const node = childs[i];
+ const shape = node.getShape(isCalculateScaleCoefficient);
+ const bounds = node.algorithm.getBounds(isCalculateScaleCoefficient);
+ const offY = previousShape.y + previousShape.height - shape.y;
+ const childOffsets = this.getChildAlignOffsets(commonBounds, bounds, this.params[AscFormat.Param_type_chAlign]);
+ shape.moveTo(childOffsets.offX, offY + childOffsets.offY);
+ const sibSp = this.getVerticalSibSp(node, isCalculateScaleCoefficient);
+ shape.moveTo(0, sibSp);
+ this.updateLevelPositions(node.algorithm);
+ this.setLevelBounds({l: shape.x, r: shape.x + shape.width, t: shape.y, b: shape.y + shape.height});
+ previousShape = shape;
+ }
+ };
+ HierarchyChildAlgorithm.prototype.setSibLevelBounds = function () {
+
+ };
+ HierarchyChildAlgorithm.prototype.calculateVerticalHierarchyHorizontalShapePositions = function (isCalculateScaleCoefficient, fromLeft) {
+ const childs = this.getMainChilds();
+ const commonBounds = this.getCommonChildBounds(isCalculateScaleCoefficient);
+ const firstNode = childs[0];
+ const firstShape = firstNode.getShape(isCalculateScaleCoefficient);
+ const firstBounds = firstNode.algorithm.getBounds(isCalculateScaleCoefficient);
+ const firstAlignOffsets = this.getChildAlignOffsets(commonBounds, firstBounds, this.params[AscFormat.Param_type_chAlign]);
+ firstNode.moveTo(firstAlignOffsets.offX, firstAlignOffsets.offY, isCalculateScaleCoefficient);
+ this.updateLevelPositions(childs[0].algorithm);
+ let previousShape = firstShape;
+ this.setLevelBounds({l: firstShape.x, t: firstShape.y, b: firstShape.y + firstShape.height, r: firstShape.x + firstShape.width});
+ for (let i = 1; i < childs.length; i += 1) {
+ const node = childs[i];
+ const shape = node.getShape(isCalculateScaleCoefficient);
+
+ let offX;
+ if (fromLeft) {
+ offX = previousShape.x + previousShape.width - shape.x;
+ } else {
+ offX = previousShape.x - (shape.x + shape.width);
+ }
+ const bounds = node.algorithm.getBounds(isCalculateScaleCoefficient);
+ const alignOffsets = this.getChildAlignOffsets(commonBounds, bounds, this.params[AscFormat.Param_type_chAlign]);
+ node.moveTo(offX + alignOffsets.offX, alignOffsets.offY, isCalculateScaleCoefficient);
+ const offset = this.getHorizontalSibSp(node, isCalculateScaleCoefficient, fromLeft);
+ node.moveTo(offset, 0, isCalculateScaleCoefficient);
+ previousShape = shape;
+ this.updateLevelPositions(node.algorithm);
+ this.setLevelBounds({l: shape.x, t: shape.y, b: shape.y + shape.height, r: shape.x + shape.width});
+ }
+ };
+ HierarchyChildAlgorithm.prototype.calculateHorizontalHierarchyHorizontalShapePositions = function (isCalculateScaleCoefficient, fromRight) {
+ const childs = fromRight ? this.getMainChilds() : this.getMainChilds().slice().reverse();
+ const parentNode = this.parentNode;
+ const sibSp = parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+ const commonBounds = this.getCommonChildBounds(isCalculateScaleCoefficient);
+ const firstShape = childs[0].getShape(isCalculateScaleCoefficient);
+ const firstBounds = childs[0].algorithm.getBounds(isCalculateScaleCoefficient);
+
+ const firstChildOffsets = this.getChildAlignOffsets(commonBounds, firstBounds, this.params[AscFormat.Param_type_chAlign]);
+ firstShape.moveTo(firstChildOffsets.offX, firstChildOffsets.offY);
+
+ this.setLevelBounds({l: firstShape.x, t: firstShape.y, b: firstShape.y + firstShape.height, r: firstShape.x + firstShape.width});
+ this.updateLevelPositions(childs[0].algorithm);
+ let previousShape = firstShape;
+ let previousWidth = firstBounds.r - firstBounds.l;
+ for (let i = 1; i < childs.length; i += 1) {
+ const node = childs[i];
+ const shape = node.getShape(isCalculateScaleCoefficient);
+ const bounds = node.algorithm.getBounds(isCalculateScaleCoefficient);
+ const childOffsets = this.getChildAlignOffsets(commonBounds, bounds, this.params[AscFormat.Param_type_chAlign]);
+ const offX = previousShape.x + previousWidth + sibSp;
+ shape.moveTo(childOffsets.offX + offX, childOffsets.offY);
+ this.setLevelBounds({l: shape.x, t: shape.y, b: shape.y + shape.height, r: shape.x + shape.width});
+ this.updateLevelPositions(node.algorithm);
+ previousShape = shape;
+ previousWidth = bounds.r - bounds.l;
+ }
+ };
+ HierarchyChildAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficient) {
+ if (isCalculateScaleCoefficient) {
+ if (this.coefficientShapeContainer === null) {
+ this.coefficientShapeContainer = new HierarchyChildContainer();
+ }
+ return this.coefficientShapeContainer;
+ }
+ if (this.shapeContainer === null) {
+ this.shapeContainer = new HierarchyChildContainer();
+ }
+ return this.shapeContainer;
+ }
+ HierarchyChildAlgorithm.prototype.calculateShapePositionsHorizontalHang = function (isCalculateScaleCoefficient, fromRight) {
+ const childs = this.getMainChilds();
+ const sibSp = this.parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+
+ const topRow = [];
+ const bottomRow = [];
+
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ if (i % 2 === 0) {
+ topRow.push(child);
+ } else {
+ bottomRow.push(child);
+ }
+ }
+
+ const topCalcBounds = this.applyMainChildAlign(topRow, isCalculateScaleCoefficient);
+ const bottomCalcBounds = this.applyMainChildAlign(bottomRow, isCalculateScaleCoefficient);
+
+ let bottomOffY = 0;
+ if (topCalcBounds.commonBounds && bottomCalcBounds.commonBounds) {
+ bottomOffY = topCalcBounds.commonBounds.b - bottomCalcBounds.commonBounds.t + sibSp;
+ }
+
+ let offX = 0;
+ for (let i = 0; i < topRow.length; i += 1) {
+ const topNode = topRow[i];
+ const topShape = topNode.getShape(isCalculateScaleCoefficient);
+ const topBounds = topCalcBounds.bounds[i];
+
+ const commonChildBounds = Object.assign({}, topBounds);
+
+ const bottomNode = bottomRow[i];
+ let bottomShape;
+ if (bottomNode) {
+ bottomShape = bottomNode.getShape(isCalculateScaleCoefficient);
+ const bottomBounds = bottomCalcBounds.bounds[i];
+ checkBounds(commonChildBounds, bottomBounds);
+ const bottomOffsets = this.getChildAlignOffsets(commonChildBounds, bottomBounds, this.params[AscFormat.Param_type_chAlign]);
+ bottomNode.moveTo(bottomOffsets.offX, bottomOffsets.offY, isCalculateScaleCoefficient);
+ if (fromRight) {
+ bottomShape.moveTo(offX - (bottomShape.x + bottomShape.width), bottomOffY - bottomShape.y);
+ } else {
+ bottomShape.moveTo(offX - bottomShape.x, bottomOffY - bottomShape.y);
+ }
+ this.updateLevelPositions(bottomNode.algorithm);
+ this.setLevelBounds({
+ l: bottomShape.x,
+ r: bottomShape.x + bottomShape.width,
+ t: bottomShape.y,
+ b: bottomShape.y + bottomShape.height
+ });
+ }
+ const topOffsets = this.getChildAlignOffsets(commonChildBounds, topBounds, this.params[AscFormat.Param_type_chAlign]);
+ topNode.moveTo(topOffsets.offX, topOffsets.offY, isCalculateScaleCoefficient);
+ if (fromRight) {
+ topShape.moveTo(offX - (topShape.x + topShape.width), 0);
+ } else {
+ topShape.moveTo(offX - topShape.x, 0);
+ }
+ this.updateLevelPositions(topNode.algorithm);
+ this.setLevelBounds({
+ l: topShape.x,
+ r: topShape.x + topShape.width,
+ t: topShape.y,
+ b: topShape.y + topShape.height
+ });
+ if (topShape && bottomShape) {
+ const bottomBounds = bottomCalcBounds.bounds[i];
+ if (fromRight) {
+ const topLeft = topShape.x + topShape.width - (topBounds.r - topBounds.l);
+ const bottomLeft = bottomShape.x + bottomShape.width - (bottomBounds.r - bottomBounds.l);
+ offX = Math.min(topLeft, bottomLeft) - sibSp;
+ } else {
+ const topRight = topShape.x + (topBounds.r - topBounds.l);
+ const bottomRight = bottomShape.x + (bottomBounds.r - bottomBounds.l);
+ offX = Math.max(topRight, bottomRight) + sibSp;
+ }
+ }
+ }
+ };
+ HierarchyChildAlgorithm.prototype.getChildAlignOffsets = function (commonBounds, shapeBounds, childAlign) {
+ const offsets = {offX: 0, offY: 0};
+
+ switch (childAlign) {
+ case AscFormat.ParameterVal_childAlignment_l:
+ offsets.offX = commonBounds.l - shapeBounds.l;
+ break;
+ case AscFormat.ParameterVal_childAlignment_t:
+ offsets.offY = commonBounds.t - shapeBounds.t;
+ break;
+ case AscFormat.ParameterVal_childAlignment_r:
+ offsets.offX = commonBounds.r - shapeBounds.r;
+ break;
+ case AscFormat.ParameterVal_childAlignment_b:
+ offsets.offY = commonBounds.b - shapeBounds.b;
+ break;
+ default:
+ break;
+ }
+ return offsets;
+ };
+ HierarchyChildAlgorithm.prototype.calculateShapePositionsVerticalHangFromTop = function (isCalculateScaleCoefficient, fromRight) {
+ const childs = this.getMainChilds();
+
+ let leftCol = [];
+ let rightCol = [];
+ const sibSp = this.parentNode.getConstr(AscFormat.Constr_type_sibSp, !isCalculateScaleCoefficient);
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ if (i % 2 === 0) {
+ leftCol.push(child);
+ } else {
+ rightCol.push(child);
+ }
+ }
+ if (fromRight) {
+ const tempCol = leftCol;
+ leftCol = rightCol;
+ rightCol = tempCol;
+ }
+ const leftCalcBounds = this.applyMainChildAlign(leftCol, isCalculateScaleCoefficient);
+ const rightCalcBounds = this.applyMainChildAlign(rightCol, isCalculateScaleCoefficient);
+ let rightOffX = 0;
+ if (leftCalcBounds.commonBounds && rightCalcBounds.commonBounds) {
+ rightOffX = leftCalcBounds.commonBounds.r - rightCalcBounds.commonBounds.l + sibSp;
+ }
+ let offY = 0;
+ const columnLength = Math.ceil(childs.length / 2);
+ for (let i = 0; i < columnLength; i += 1) {
+ const leftNode = leftCol[i];
+ if (leftNode) {
+ const leftShape = leftNode.getShape(isCalculateScaleCoefficient);
+ leftShape.moveTo(0, offY);
+ this.updateLevelPositions(leftNode.algorithm);
+ this.setLevelBounds({l: leftShape.x, r: leftShape.x + leftShape.width, t: leftShape.y, b: leftShape.y + leftShape.height});
+ }
+ const rightNode = rightCol[i];
+ if (rightNode) {
+ const rightShape = rightNode.getShape(isCalculateScaleCoefficient);
+ rightShape.moveTo(rightOffX, offY);
+ this.updateLevelPositions(rightNode.algorithm);
+ this.setLevelBounds({l: rightShape.x, r: rightShape.x + rightShape.width, t: rightShape.y, b: rightShape.y + rightShape.height});
+ }
+ const leftBounds = leftCalcBounds.bounds[i];
+ const rightBounds = rightCalcBounds.bounds[i];
+ if (leftBounds && rightBounds) {
+ const commonChildBounds = Object.assign({}, leftBounds);
+ checkBounds(commonChildBounds, rightBounds);
+/* const leftOffsets = this.getChildAlignOffsets(commonChildBounds, leftBounds, this.params[AscFormat.Param_type_chAlign]);
+ const rightOffsets = this.getChildAlignOffsets(commonChildBounds, rightBounds, this.params[AscFormat.Param_type_chAlign]);
+ leftNode.moveTo(leftOffsets.offX, leftOffsets.offY, isCalculateScaleCoefficient);
+ rightNode.moveTo(rightOffsets.offX, rightOffsets.offY, isCalculateScaleCoefficient);*/
+ offY += Math.max(leftBounds.b - leftBounds.t, rightBounds.b - rightBounds.t) + sibSp;
+ }
+ }
+ };
+ HierarchyChildAlgorithm.prototype.applyMainChildAlign = function (childs, isCalculateScaleCoefficient) {
+ const allBounds = [];
+ const result = {
+ commonBounds: null,
+ bounds: allBounds
+ };
+ if (!childs.length) {
+ return result;
+ }
+ const commonBounds = {};
+ const firstChild = childs[0];
+ const firstBounds = firstChild.algorithm.getBounds(isCalculateScaleCoefficient);
+ allBounds.push(firstBounds);
+ Object.assign(commonBounds, firstBounds);
+ for (let i = 1; i < childs.length; i += 1) {
+ const child = childs[i];
+ const bounds = child.algorithm.getBounds(isCalculateScaleCoefficient);
+ checkBounds(commonBounds, bounds);
+ allBounds.push(bounds);
+ }
+
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ const mainOffsets = this.getChildAlignOffsets(commonBounds, allBounds[i], this.params[AscFormat.Param_type_chAlign]);
+ const secondaryOffsets = this.getChildAlignOffsets(commonBounds, allBounds[i], this.params[AscFormat.Param_type_secChAlign]);
+ child.moveTo(mainOffsets.offX + secondaryOffsets.offX, mainOffsets.offY + secondaryOffsets.offY, isCalculateScaleCoefficient);
+ }
+ return {commonBounds: commonBounds, bounds: allBounds};
+ };
+
+ HierarchyChildAlgorithm.prototype.calculateShapePositionsVerticalHangFromRight = function (isCalculateScaleCoefficient) {
+
+ };
+ HierarchyChildAlgorithm.prototype._calculateShapePositions = function (isCalculateScaleCoefficient) {
+ const childs = this.getMainChilds();
+ if (!childs.length) {
+ return;
+ }
+ if (this.isHang()) {
+ switch (this.params[AscFormat.Param_type_secLinDir]) {
+ case AscFormat.ParameterVal_linearDirection_fromT:
+ const fromRight = this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromR;
+ this.calculateShapePositionsVerticalHangFromTop(isCalculateScaleCoefficient, fromRight);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromL:
+ this.calculateShapePositionsHorizontalHang(isCalculateScaleCoefficient, false);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromR:
+ this.calculateShapePositionsHorizontalHang(isCalculateScaleCoefficient, true);
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (this.isHorizontalHierarchy()) {
+ switch (this.params[AscFormat.Param_type_linDir]) {
+ case AscFormat.ParameterVal_linearDirection_fromB:
+ this.calculateHorizontalHierarchyVerticalShapePositions(isCalculateScaleCoefficient, false);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromT:
+ this.calculateHorizontalHierarchyVerticalShapePositions(isCalculateScaleCoefficient, true);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromR:
+ this.calculateHorizontalHierarchyHorizontalShapePositions(isCalculateScaleCoefficient, false);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromL:
+ this.calculateHorizontalHierarchyHorizontalShapePositions(isCalculateScaleCoefficient, true);
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (this.params[AscFormat.Param_type_linDir]) {
+ case AscFormat.ParameterVal_linearDirection_fromB:
+ this.calculateVerticalHierarchyVerticalShapePositions(isCalculateScaleCoefficient, false);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromT:
+ this.calculateVerticalHierarchyVerticalShapePositions(isCalculateScaleCoefficient, true);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromR:
+ this.calculateVerticalHierarchyHorizontalShapePositions(isCalculateScaleCoefficient, false);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromL:
+ this.calculateVerticalHierarchyHorizontalShapePositions(isCalculateScaleCoefficient, true);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ };
+
+ HierarchyChildAlgorithm.prototype.getChildBounds = function (isCalculateScaleCoefficients) {
+ const childs = this.getMainChilds();
+
+ if (!childs.length) {
+ return;
+ }
+
+ const firstChild = childs[0];
+ const firstRoot = firstChild.algorithm.getRoot();
+ const firstShape = firstRoot.getShape(isCalculateScaleCoefficients);
+ const bounds = firstShape.getBounds();
+
+ for (let i = 1; i < childs.length; i += 1) {
+ const child = childs[i];
+ const root = child.algorithm.getRoot();
+ const shape = root.getShape(isCalculateScaleCoefficients);
+ shape.checkBounds(bounds);
+ }
+ return bounds;
+ };
+ HierarchyChildAlgorithm.prototype.getHangStructBounds = function (isCalculateScaleCoefficients) {
+ const childs = this.getMainChilds();
+ if (!childs.length) {
+ return;
+ }
+ const firstChild = childs[0];
+ const bounds = firstChild.algorithm.getBounds(isCalculateScaleCoefficients);
+ for (let i = 2; i < childs.length; i += 2) {
+ const child = childs[i];
+ child.algorithm.getBounds(isCalculateScaleCoefficients, bounds);
+ }
+ return bounds;
+ };
+ function HierarchyRootAlgorithm() {
+ HierarchyAlgorithm.call(this);
+ }
+ AscFormat.InitClassWithoutType(HierarchyRootAlgorithm, HierarchyAlgorithm);
+ HierarchyRootAlgorithm.prototype.isHorizontalHierarchy = function () {
+ switch (this.params[AscFormat.Param_type_hierAlign]) {
+ case AscFormat.ParameterVal_hierarchyAlignment_lB:
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_lT:
+ case AscFormat.ParameterVal_hierarchyAlignment_rB:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_rT:
+ return true;
+ default:
+ return false;
+ }
+ };
+ HierarchyRootAlgorithm.prototype.putShapesToShapeContainer = function (isCalculateScaleCoefficient) {
+ const rootNode = this.getRoot();
+ const asstNode = this.getAsstNode();
+ const nonAsstNode = this.getNonAsstNode();
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficient);
+ shapeContainer.push(rootNode.getShape(isCalculateScaleCoefficient));
+ if (asstNode && asstNode.algorithm.getMainChilds().length) {
+ shapeContainer.push(asstNode.getShape(isCalculateScaleCoefficient));
+ }
+ if (nonAsstNode.algorithm.getMainChilds().length) {
+ shapeContainer.push(nonAsstNode.getShape(isCalculateScaleCoefficient));
+ }
+ };
+ HierarchyRootAlgorithm.prototype.getBounds = function (isCalculateScaleCoefficients, bounds) {
+ const childs = this.getMainChilds();
+ const firstChild = childs[0];
+ const firstShape = firstChild.getShape(isCalculateScaleCoefficients);
+ if (!bounds) {
+ bounds = firstShape.getBounds();
+ } else {
+ firstShape.checkBounds(bounds);
+ }
+ const asstNode = this.getAsstNode();
+ if (asstNode && asstNode.childs.length) {
+ const shape = asstNode.getShape(isCalculateScaleCoefficients);
+ shape.checkBounds(bounds);
+ }
+ const nonAsstNode = this.getNonAsstNode();
+ if (nonAsstNode.childs.length) {
+ const shape = nonAsstNode.getShape(isCalculateScaleCoefficients);
+ shape.checkBounds(bounds);
+ }
+ return bounds;
+ };
+ HierarchyRootAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createHierarchyRootShadowShape(isCalculateScaleCoefficients);
+ };
+ HierarchyRootAlgorithm.prototype.getNonAsstNode = function () {
+ return this.parentNode.childs[1];
+ };
+ HierarchyRootAlgorithm.prototype.getAsstNode = function () {
+ return this.parentNode.childs[2];
+ };
+ HierarchyRootAlgorithm.prototype.applyMainTopAlign = function (isCalculateScaleCoefficients) {
+ const root = this.getRoot();
+ if (!root) {
+ return;
+ }
+ const parentNode = this.parentNode;
+ const space = parentNode.getConstr(AscFormat.Constr_type_sp, !isCalculateScaleCoefficients);
+ const rootShape = root.getShape(isCalculateScaleCoefficients);
+ let offY = rootShape.y + rootShape.height + space;
+
+ const asstNode = this.getAsstNode();
+ if (asstNode && asstNode.algorithm.getMainChilds().length) {
+ const asstShape = asstNode.getShape(isCalculateScaleCoefficients);
+ asstShape.moveTo(/*todo: asstOffset*/0, offY - asstShape.y);
+ offY = asstShape.y + asstShape.height + space;
+ }
+
+ const nonAsstNode = this.getNonAsstNode();
+ if (nonAsstNode.algorithm.getMainChilds().length) {
+ const nonAsstShape = nonAsstNode.getShape(isCalculateScaleCoefficients);
+ nonAsstShape.moveTo(/*todo: nonAsstOffset*/0, offY - nonAsstShape.y);
+ }
+ };
+
+ HierarchyRootAlgorithm.prototype.applyMainBottomAlign = function (isCalculateScaleCoefficients) {
+ const rootNode = this.getRoot();
+ if (!rootNode) {
+ return;
+ }
+ const parentNode = this.parentNode;
+ const space = parentNode.getConstr(AscFormat.Constr_type_sp, !isCalculateScaleCoefficients);
+
+ let offY = 0;
+ const nonAsstNode = this.getNonAsstNode();
+ if (nonAsstNode.algorithm.getMainChilds().length) {
+ const nonAsstShape = nonAsstNode.getShape(isCalculateScaleCoefficients);
+ offY += nonAsstShape.y + nonAsstShape.height + space;
+ }
+
+
+ const asstNode = this.getAsstNode();
+ if (asstNode && asstNode.algorithm.getMainChilds().length) {
+ const asstShape = asstNode.getShape(isCalculateScaleCoefficients);
+ asstShape.moveTo(/*todo: asstOffset*/0, offY - asstShape.y);
+ offY = asstShape.y + asstShape.height + space;
+ }
+
+ const rootShape = rootNode.getShape(isCalculateScaleCoefficients);
+ rootShape.moveTo(0, offY - rootShape.y);
+ };
+
+ HierarchyRootAlgorithm.prototype.applyMainLeftAlign = function (isCalculateScaleCoefficients) {
+ const rootNode = this.getRoot();
+ if (!rootNode) {
+ return;
+ }
+ const space = this.parentNode.getConstr(AscFormat.Constr_type_sp, !isCalculateScaleCoefficients);
+ const rootShape = rootNode.getShape(isCalculateScaleCoefficients);
+ const bounds = rootShape.getBounds();
+ let offX = bounds.r + space;
+
+ const asstNode = this.getAsstNode();
+ if (asstNode && asstNode.algorithm.getMainChilds().length) {
+ const asstShape = asstNode.getShape(isCalculateScaleCoefficients);
+ asstShape.moveTo(offX - asstShape.x, 0);
+ offX = asstShape.x + asstShape.width + space;
+ }
+
+ const nonAsstNode = this.getNonAsstNode();
+ if (nonAsstNode.algorithm.getMainChilds().length) {
+ const nonAsstShape = nonAsstNode.getShape(isCalculateScaleCoefficients);
+ nonAsstShape.moveTo(offX - nonAsstShape.x, 0);
+ }
+ };
+
+ HierarchyRootAlgorithm.prototype.applyMainRightAlign = function (isCalculateScaleCoefficients) {
+ const rootNode = this.getRoot();
+ if (!rootNode) {
+ return;
+ }
+ const space = this.parentNode.getConstr(AscFormat.Constr_type_sp, !isCalculateScaleCoefficients);
+ let offX = 0;
+
+ const nonAsstNode = this.getNonAsstNode();
+ if (nonAsstNode.algorithm.getMainChilds().length) {
+ const nonAsstShape = nonAsstNode.getShape(isCalculateScaleCoefficients);
+ offX = nonAsstShape.x + nonAsstShape.width + space;
+ }
+
+ const asstNode = this.getAsstNode();
+ if (asstNode && asstNode.algorithm.getMainChilds().length) {
+ const asstShape = asstNode.getShape(isCalculateScaleCoefficients);
+ asstShape.moveTo(offX - asstShape.x, 0);
+ offX = asstShape.x + asstShape.width + space;
+ }
+
+ const rootShape = rootNode.getShape(isCalculateScaleCoefficients);
+ const bounds = rootShape.getBounds();
+ rootShape.moveTo(offX - bounds.l, 0);
+ };
+
+ HierarchyRootAlgorithm.prototype.applyMainAlign = function (isCalculateScaleCoefficients) {
+ switch (this.params[AscFormat.Param_type_hierAlign]) {
+ case AscFormat.ParameterVal_hierarchyAlignment_bCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_bCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_bL:
+ case AscFormat.ParameterVal_hierarchyAlignment_bR:
+ this.applyMainBottomAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_lB:
+ case AscFormat.ParameterVal_hierarchyAlignment_lT:
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrDes:
+ this.applyMainLeftAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_rB:
+ case AscFormat.ParameterVal_hierarchyAlignment_rT:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrDes:
+ this.applyMainRightAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_tCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_tCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_tL:
+ case AscFormat.ParameterVal_hierarchyAlignment_tR:
+ this.applyMainTopAlign(isCalculateScaleCoefficients);
+ break;
+ default:
+ return;
+ }
+ };
+ HierarchyRootAlgorithm.prototype.applySecondaryAlign = function (isCalculateScaleCoefficients) {
+ const asstNode = this.getAsstNode();
+ const nonAsstNode = this.getNonAsstNode();
+
+ if (asstNode) {
+ this.applySecondaryAlignForChild(isCalculateScaleCoefficients, asstNode);
+ }
+ this.applySecondaryAlignForChild(isCalculateScaleCoefficients, nonAsstNode);
+ };
+ HierarchyRootAlgorithm.prototype.applySecondaryAlignForChild = function (isCalculateScaleCoefficients, child) {
+ const rootNode = this.getRoot();
+ const rootShape = rootNode.getShape(isCalculateScaleCoefficients);
+ const childShape = child.getShape(isCalculateScaleCoefficients);
+ if (child.algorithm.isHang()) {
+ const offsets = child.algorithm.getRootCenteringOffset(rootShape, isCalculateScaleCoefficients);
+ childShape.moveTo(offsets.offX, offsets.offY);
+ return;
+ }
+
+ const appendChildOffset = this.getOffsetAlign(isCalculateScaleCoefficients, child);
+ switch (this.params[AscFormat.Param_type_hierAlign]) {
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrCh: {
+ const childBounds = child.algorithm.getChildBounds(isCalculateScaleCoefficients);
+ if (childBounds) {
+ childShape.moveTo(0, (rootShape.y + rootShape.height / 2) - (childBounds.t + (childBounds.b - childBounds.t) / 2) + appendChildOffset);
+ }
+ break;
+ }
+ case AscFormat.ParameterVal_hierarchyAlignment_bCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_tCtrCh: {
+ const childBounds = child.algorithm.getChildBounds(isCalculateScaleCoefficients);
+ if (childBounds) {
+ childShape.moveTo((rootShape.x + rootShape.width / 2) - (childBounds.l + (childBounds.r - childBounds.l) / 2) + appendChildOffset, 0);
+ }
+ break;
+ }
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrDes:
+ childShape.moveTo(0, rootShape.y + rootShape.height / 2 - (childShape.y + childShape.height / 2) + appendChildOffset);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_bCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_tCtrDes:
+ childShape.moveTo(rootShape.x + rootShape.width / 2 - (childShape.x + childShape.width / 2) + appendChildOffset, 0);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_bL:
+ case AscFormat.ParameterVal_hierarchyAlignment_tL:
+ childShape.moveTo(rootShape.x - childShape.x + appendChildOffset, 0);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_bR:
+ case AscFormat.ParameterVal_hierarchyAlignment_tR:
+ childShape.moveTo((rootShape.x + rootShape.width) - (childShape.x + childShape.width) + appendChildOffset, 0);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_lB:
+ case AscFormat.ParameterVal_hierarchyAlignment_rB:
+ childShape.moveTo(0, (rootShape.y + rootShape.height) - (childShape.y + childShape.height) + appendChildOffset);
+ break;
+ case AscFormat.ParameterVal_hierarchyAlignment_lT:
+ case AscFormat.ParameterVal_hierarchyAlignment_rT:
+ childShape.moveTo(0, rootShape.y - childShape.y + appendChildOffset);
+ break;
+ default:
+ return;
+ }
+ };
+
+ HierarchyRootAlgorithm.prototype.getOffsetAlign = function (isCalculateScaleCoefficients, child) {
+ const offsetFactor = child.algorithm.isHang() ? 0 : this.parentNode.getConstr(AscFormat.Constr_type_alignOff, !isCalculateScaleCoefficients);
+ if (!offsetFactor) {
+ return 0;
+ }
+ const rootNode = this.getRoot();
+ const rootShape = rootNode.getShape(isCalculateScaleCoefficients);
+ switch (this.params[AscFormat.Param_type_hierAlign]) {
+ case AscFormat.ParameterVal_hierarchyAlignment_bCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_tCtrCh:
+ case AscFormat.ParameterVal_hierarchyAlignment_bCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_lCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_rCtrDes:
+ case AscFormat.ParameterVal_hierarchyAlignment_tCtrDes:
+ return 0;
+ case AscFormat.ParameterVal_hierarchyAlignment_bL:
+ case AscFormat.ParameterVal_hierarchyAlignment_tL:
+ return rootShape.width * offsetFactor;
+ case AscFormat.ParameterVal_hierarchyAlignment_bR:
+ case AscFormat.ParameterVal_hierarchyAlignment_tR:
+ return -rootShape.width * offsetFactor;
+ case AscFormat.ParameterVal_hierarchyAlignment_lB:
+ case AscFormat.ParameterVal_hierarchyAlignment_rB:
+ return -rootShape.height * offsetFactor;
+ case AscFormat.ParameterVal_hierarchyAlignment_lT:
+ case AscFormat.ParameterVal_hierarchyAlignment_rT:
+ return rootShape.height * offsetFactor;
+ default:
+ return 0;
+ }
+ };
+
+ HierarchyRootAlgorithm.prototype.initParams = function (params) {
+ HierarchyAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_off] === undefined) {
+ this.params[AscFormat.Param_type_off] = AscFormat.ParameterVal_offset_ctr;
+ }
+ if (this.params[AscFormat.Param_type_hierAlign] === undefined) {
+ this.params[AscFormat.Param_type_hierAlign] = AscFormat.ParameterVal_hierarchyAlignment_tCtrCh;
+ }
+ }
+ HierarchyRootAlgorithm.prototype.getRoot = function () {
+ const childs = this.getMainChilds();
+ if (childs.length) {
+ return childs[0];
+ }
+ };
+ HierarchyRootAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficients) {
+ if (isCalculateScaleCoefficients) {
+ if (this.coefficientShapeContainer === null) {
+ this.coefficientShapeContainer = new HierarchyRootContainer();
+ }
+ return this.coefficientShapeContainer;
+ } else {
+ if (this.shapeContainer === null) {
+ this.shapeContainer = new HierarchyRootContainer();
+ }
+ return this.shapeContainer;
+ }
+ };
+ HierarchyRootAlgorithm.prototype._collectHierarchyPositions = function (isVertical) {
+ const asstNode = this.getAsstNode();
+ if (asstNode) {
+ const asstAlgorithm = asstNode.algorithm;
+ for (let i = 0; i < asstAlgorithm.levelPositions.length; i += 1) {
+ this.setLevelBounds(asstAlgorithm.levelPositions[i]);
+ }
+ }
+ const nonAsstNode = this.getNonAsstNode();
+ const nonAsstAlgorithm = nonAsstNode.algorithm;
+ for (let i = 0; i < nonAsstAlgorithm.levelPositions.length; i += 1) {
+ this.setLevelBounds(nonAsstAlgorithm.levelPositions[i]);
+ }
+ };
+ HierarchyRootAlgorithm.prototype.collectHierarchyPositions = function () {
+ this._collectHierarchyPositions();
+ };
+ HierarchyRootAlgorithm.prototype._calculateShapePositions = function (isCalculateScaleCoefficients) {
+ this.applyMainAlign(isCalculateScaleCoefficients);
+ this.applySecondaryAlign(isCalculateScaleCoefficients);
+ };
+
+
+ function PyramidAlgorithm() {
+ PositionAlgorithm.call(this);
+ this.calcValues = {
+ defaultBlockHeight: 0
+ };
+ }
+ AscFormat.InitClassWithoutType(PyramidAlgorithm, PositionAlgorithm);
+ PyramidAlgorithm.prototype.initParams = function (params) {
+ PositionAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_pyraAcctPos] === undefined) {
+ this.params[AscFormat.Param_type_pyraAcctPos] = AscFormat.ParameterVal_pyramidAccentPosition_aft;
+ }
+ if (this.params[AscFormat.Param_type_off] === undefined) {
+ this.params[AscFormat.Param_type_off] = AscFormat.ParameterVal_offset_ctr;
+ }
+
+ }
+ PyramidAlgorithm.prototype.calcScaleCoefficients = function () {
+ const parentHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, false);
+ const childs = this.parentNode.childs;
+ const defaultBlockHeight = parentHeight / childs.length;
+ let sumHeight = 0;
+ for (let i = 0; i < childs.length; i++) {
+ const child = this.getPyramidChildren(childs[i]).pyramid;
+ const scaleBlockHeight = child.getHeightScale();
+ sumHeight += scaleBlockHeight * defaultBlockHeight;
+ }
+ this.calcValues.defaultBlockHeight = defaultBlockHeight * (parentHeight / sumHeight);
+ };
+ PyramidAlgorithm.prototype.getTextNodeCoefficients = function (contentNode, textNode) {
+ const resultScales = {width: 1, height: 1};
+ const contentWidth = contentNode.getConstr(AscFormat.Constr_type_w, true, true);
+ const contentHeight = contentNode.getConstr(AscFormat.Constr_type_h, true, true);
+ const textWidth = textNode.getConstr(AscFormat.Constr_type_w, true, true);
+ const textHeight = textNode.getConstr(AscFormat.Constr_type_h, true, true);
+ if (contentWidth && textWidth) {
+ resultScales.width = textWidth / contentWidth;
+ }
+ if (contentHeight && textHeight) {
+ resultScales.height = textHeight / contentHeight;
+ }
+ return resultScales;
+ };
+ PyramidAlgorithm.prototype.setPyramidParametersForNode = function (child, x, y, height, width, cleanHeight, cleanWidth, adjValue) {
+ const shape = child.getShape(false);
+ if (shape) {
+ if (width < height) {
+ adjValue = adjValue * height / cleanWidth;
+ }
+ shape.height = height;
+ shape.width = width;
+ shape.x = x;
+ shape.y = y;
+ shape.cleanParams.height = cleanHeight;
+ shape.cleanParams.width = cleanWidth;
+ const adjLst = new AscFormat.AdjLst();
+ const adj = new AscFormat.Adj();
+ adj.setVal(adjValue);
+ adj.setIdx(1);
+ adjLst.addToLst(0, adj);
+ shape.customAdj = adjLst;
+
+ const textNodes = child.contentNodes[0] && child.contentNodes[0].getTextNodes();
+ if (textNodes && textNodes.contentNode === child && textNodes.textNode) {
+ const txNode = textNodes.textNode;
+ const coefficients = this.getTextNodeCoefficients(child, txNode);
+ const textShape = txNode.getShape();
+ textShape.height = shape.height * coefficients.height;
+ textShape.width = shape.width * coefficients.width;
+ textShape.x = shape.x + (shape.width - textShape.width) / 2;
+ textShape.y = shape.y + (shape.height - textShape.height) / 2;
+ }
+ }
+ };
+ PyramidAlgorithm.prototype.getPyramidChildren = function (node) {
+ const pyramid = node.getNamedNode(this.params[AscFormat.Param_type_pyraLvlNode]);
+ const acct = node.getNamedNode(this.params[AscFormat.Param_type_pyraAcctBkgdNode]);
+ return {
+ pyramid: pyramid,
+ acct: acct
+ };
+ };
+ PyramidAlgorithm.prototype.isReversedPyramid = function () {
+ return this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromT;
+ };
+ PyramidAlgorithm.prototype.getStartDefaultBlockWidth = function () {
+ const acctRatio = this.parentNode.getConstr(AscFormat.Constr_type_pyraAcctRatio, true);
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w, true);
+ return parentWidth * (1 - acctRatio);
+ }
+ PyramidAlgorithm.prototype.forEachChild = function (callback, startIndex) {
+ const childs = this.parentNode.childs;
+ if (this.isReversedPyramid()) {
+ for (let i = startIndex; i < childs.length; i += 1) {
+ callback(childs[i]);
+ }
+ } else {
+ for (let i = childs.length - 1 - startIndex; i >= 0; i -= 1) {
+ callback(childs[i]);
+ }
+ }
+ }
+ PyramidAlgorithm.prototype.getFirstPyramidComponents = function () {
+ const childs = this.parentNode.childs;
+ if (this.isReversedPyramid()) {
+ return this.getPyramidChildren(childs[0]);
+ }
+
+ return this.getPyramidChildren(childs[childs.length - 1]);
+ }
+ PyramidAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficient) {
+ if (isCalculateScaleCoefficient) {
+ if (this.coefficientShapeContainer === null) {
+ this.coefficientShapeContainer = new PyramidContainer();
+ }
+ return this.coefficientShapeContainer;
+ }
+ if (this.shapeContainer === null) {
+ this.shapeContainer = new PyramidContainer();
+ }
+ return this.shapeContainer;
+ };
+ PyramidAlgorithm.prototype._calculateShapePositions = function () {
+ const parentNode = this.parentNode;
+ const shapeContainer = this.getShapeContainer(false);
+ const parentHeight = parentNode.getConstr(AscFormat.Constr_type_h, true);
+ const parentWidth = parentNode.getConstr(AscFormat.Constr_type_w, true);
+ const defaultBlockHeight = this.calcValues.defaultBlockHeight;
+ let previousBlockWidth = this.getStartDefaultBlockWidth();
+ const defaultAdjValue = (previousBlockWidth / 2) / parentHeight;
+
+
+ const firstPyramidComponents = this.getFirstPyramidComponents();
+ const firstChild = firstPyramidComponents.pyramid;
+ const firstShape = firstChild.getShape(false);
+ const firstHeight = defaultBlockHeight * firstChild.getHeightScale();
+ const firstWidth = previousBlockWidth * firstChild.getWidthScale();
+ let ctrX = (previousBlockWidth - firstWidth) / 2 + firstWidth / 2;
+ if (!this.isAfterAcct()) {
+ ctrX = parentWidth - ctrX;
+ }
+ let previousY;
+ if (this.isReversedPyramid()) {
+ previousY = 0;
+ } else {
+ previousY = parentHeight - firstHeight;
+ }
+ let previousBlockHeight = firstHeight;
+ this.setPyramidParametersForNode(firstChild, ctrX - firstWidth / 2, previousY, firstHeight, firstWidth, defaultBlockHeight, previousBlockWidth, defaultAdjValue);
+ const firstAcctOffset = defaultAdjValue * previousBlockHeight;
+ if (this.isReversedPyramid()) {
+ firstShape.rot = Math.PI;
+ this.addAcctShape(firstChild, firstPyramidComponents.acct, defaultAdjValue, firstAcctOffset);
+ shapeContainer.push(firstShape);
+ } else {
+ shapeContainer.push(firstShape);
+ this.addAcctShape(firstChild, firstPyramidComponents.acct, defaultAdjValue, firstAcctOffset);
+ }
+ const oThis = this;
+ this.forEachChild(function (node) {
+ const pyramidComponents = oThis.getPyramidChildren(node);
+ const child = pyramidComponents.pyramid;
+ const shape = child.getShape(false);
+ const blockHeightFactor = child.getHeightScale();
+ const blockWidthFactor = child.getWidthScale();
+ const scaledBlockHeight = blockHeightFactor * defaultBlockHeight;
+ const curBlockWidth = previousBlockWidth - 2 * defaultAdjValue * previousBlockHeight;
+ const scaledBlockWidth = curBlockWidth * blockWidthFactor;
+ const x = ctrX - scaledBlockWidth / 2;
+ let y;
+ if (oThis.isReversedPyramid()) {
+ y = previousY + previousBlockHeight;
+ } else {
+ y = previousY - scaledBlockHeight;
+ }
+ const acctOffset = defaultAdjValue * scaledBlockHeight;
+ oThis.setPyramidParametersForNode(child, x, y, scaledBlockHeight, scaledBlockWidth, defaultBlockHeight, curBlockWidth, defaultAdjValue);
+ if (oThis.isReversedPyramid()) {
+ shape.rot = Math.PI;
+ oThis.addAcctShape(child, pyramidComponents.acct, defaultAdjValue, acctOffset);
+ shapeContainer.push(shape);
+ } else {
+ shapeContainer.push(shape);
+ oThis.addAcctShape(child, pyramidComponents.acct, defaultAdjValue, acctOffset);
+ }
+ previousBlockWidth = curBlockWidth;
+ previousBlockHeight = scaledBlockHeight;
+ previousY = y;
+ }, 1);
+ if (!this.isReversedPyramid()) {
+ shapeContainer.reverse();
+ }
+ };
+ PyramidAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ const parentNode = this.parentNode;
+ const childs = parentNode.childs;
+ if (!childs.length) {
+ return;
+ }
+ if (isCalculateScaleCoefficients) {
+ this.calcScaleCoefficients(smartartAlgorithm);
+ } else {
+ this._calculateShapePositions();
+ this.applyParamOffsets();
+ this.applyPostAlgorithmSettings();
+ this.createShadowShape(false);
+ }
+ };
+ PyramidAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(true, isCalculateScaleCoefficients);
+ };
+ PyramidAlgorithm.prototype.getTemplateAdjAcctLst = function (firstAdj, secondAdj) {
+ const adjLst = new AscFormat.AdjLst();
+ const adj1 = new AscFormat.Adj();
+ adjLst.addToLst(0, adj1);
+ adj1.setIdx(1);
+
+ const adj2 = new AscFormat.Adj();
+ adj2.setIdx(2);
+ adjLst.addToLst(1, adj2);
+
+ adj1.setVal(firstAdj);
+ adj2.setVal(secondAdj);
+ return adjLst;
+ };
+ PyramidAlgorithm.prototype.isAfterAcct = function () {
+ return this.params[AscFormat.Param_type_pyraAcctPos] === AscFormat.ParameterVal_pyramidAccentPosition_aft;
+ }
+ PyramidAlgorithm.prototype.addAcctShape = function (mainNode, acctNode, defaultAdjValue, acctHelper) {
+ if (!(mainNode && acctNode)) {
+ return;
+ }
+ const shapeContainer = this.getShapeContainer();
+ const parentWidth = this.parentNode.getConstr(AscFormat.Constr_type_w, true);
+ const mainShape = mainNode.getShape(false);
+ const acctShape = acctNode.getShape(false);
+
+ const heightScale = acctNode.getHeightScale();
+ const widthScale = acctNode.getWidthScale();
+ let defaultWidth;
+ if (this.isAfterAcct()) {
+ defaultWidth = parentWidth - (mainShape.x + mainShape.width - acctHelper);
+ } else {
+ defaultWidth = mainShape.x + acctHelper;
+ }
+ const defaultHeight = mainShape.height;
+ acctShape.cleanParams.width = defaultWidth;
+ acctShape.cleanParams.height = defaultHeight;
+ acctShape.width = defaultWidth * widthScale;
+ acctShape.height = defaultHeight * heightScale;
+ if (defaultWidth < defaultHeight) {
+ defaultAdjValue = defaultAdjValue * defaultHeight / defaultWidth;
+ }
+
+ if (this.isAfterAcct()) {
+ acctShape.x = mainShape.x + mainShape.width - acctHelper + (defaultWidth - acctShape.width) / 2;
+ if (this.isReversedPyramid()) {
+ acctShape.customAdj = this.getTemplateAdjAcctLst(defaultAdjValue, 0);
+ } else {
+ acctShape.customAdj = this.getTemplateAdjAcctLst(0, defaultAdjValue);
+ }
+ } else {
+ acctShape.x = (defaultWidth - acctShape.width) / 2;
+ if (this.isReversedPyramid()) {
+ acctShape.customAdj = this.getTemplateAdjAcctLst(0, defaultAdjValue);
+ } else {
+ acctShape.customAdj = this.getTemplateAdjAcctLst(defaultAdjValue, 0);
+ }
+ }
+ acctShape.y = mainShape.y + (defaultHeight - acctShape.height) / 2;
+ if (!this.isReversedPyramid()) {
+ acctShape.rot = Math.PI;
+ }
+ shapeContainer.push(acctShape);
+
+ const txNode = acctNode.contentNodes[0] && acctNode.contentNodes[0].getTextNode();
+ if (txNode) {
+ const textShape = txNode.getShape();
+ textShape.type = AscFormat.LayoutShapeType_shapeType_rect;
+ if (this.isAfterAcct()) {
+ textShape.x = mainShape.x + mainShape.width;
+ textShape.y = acctShape.y;
+ textShape.height = acctShape.height;
+ textShape.width = acctShape.width - (textShape.x - acctShape.x);
+ textShape.rot = acctShape.rot;
+ } else {
+ textShape.x = acctShape.x;
+ textShape.y = acctShape.y;
+ textShape.height = acctShape.height;
+ textShape.width = acctShape.width - acctHelper;
+ textShape.rot = acctShape.rot;
+ }
+
+ }
+ };
+
+ function CycleAlgorithm() {
+ PositionAlgorithm.call(this);
+ this.calcValues = {
+ radius: 0,
+ startAngle: 0,
+ stepAngle: 0,
+ mainElements: [],
+ centerNodeIndex: null,
+ isInit: false
+ };
+ }
+ AscFormat.InitClassWithoutType(CycleAlgorithm, PositionAlgorithm);
+ CycleAlgorithm.prototype.getChildAlgorithmAlignBounds = function (isCalculateCoefficients, skipRotate) {
+ const x = this.parentNode.getConstr(AscFormat.Constr_type_l, !isCalculateCoefficients);
+ const y = this.parentNode.getConstr(AscFormat.Constr_type_t, !isCalculateCoefficients);
+ const width = this.parentNode.getConstr(AscFormat.Constr_type_w, !isCalculateCoefficients);
+ const height = this.parentNode.getConstr(AscFormat.Constr_type_h, !isCalculateCoefficients);
+ return {
+ l: x,
+ t: y,
+ r: x + width,
+ b: y + height
+ };
+ };
+ CycleAlgorithm.prototype.getCenterNode = function () {
+ if (this.calcValues.centerNodeIndex !== null) {
+ return this.parentNode.childs[this.calcValues.centerNodeIndex];
+ }
+ };
+ CycleAlgorithm.prototype.getParentConnectionNode = function () {
+ return this.getCenterNode();
+ };
+ CycleAlgorithm.prototype.isClockwise = function () {
+ return this.calcValues.stepAngle > 0;
+ }
+ CycleAlgorithm.prototype.getShapeIndex = function (shape) {
+ return this.calcValues.mainElements.indexOf(shape);
+ };
+ CycleAlgorithm.prototype.getRadialConnectionInfo = function (node) {
+ const shape = node.getShape();
+ const shapeCenterPoint = new CCoordPoint(shape.x + shape.width / 2, shape.y + shape.height / 2);
+ let radius;
+ let angle;
+ let custVector;
+ if (shape.custCenterPoint) {
+ custVector = shape.custCenterPoint.getVector(shapeCenterPoint);
+ radius = custVector.getDistance();
+ angle = custVector.getAngle();
+ return {
+ point: shape.custCenterPoint,
+ radius: radius,
+ angle: angle,
+ isClockwise: this.isClockwise()
+ }
+ } else if (shape.radialVector) {
+ radius = shape.radialVector.getDistance();
+ angle = shape.radialVector.getAngle();
+ return {
+ point: new CCoordPoint(shapeCenterPoint.x - shape.radialVector.x, shapeCenterPoint.y - shape.radialVector.y),
+ radius: radius,
+ angle: angle,
+ isClockwise: this.isClockwise()
+ };
+ }
+ return null;
+ };
+ CycleAlgorithm.prototype.initParams = function (params) {
+ PositionAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_stAng] === undefined) {
+ this.params[AscFormat.Param_type_stAng] = 0;
+ }
+ if (this.params[AscFormat.Param_type_spanAng] === undefined) {
+ this.params[AscFormat.Param_type_spanAng] = 360;
+ }
+ if (this.params[AscFormat.Param_type_vertAlign] === undefined) {
+ this.params[AscFormat.Param_type_vertAlign] = AscFormat.ParameterVal_verticalAlignment_mid;
+ }
+ if (this.params[AscFormat.Param_type_horzAlign] === undefined) {
+ this.params[AscFormat.Param_type_horzAlign] = AscFormat.ParameterVal_horizontalAlignment_ctr;
+ }
+
+ if (this.params[AscFormat.Param_type_ctrShpMap] === undefined) {
+ this.params[AscFormat.Param_type_ctrShpMap] = AscFormat.ParameterVal_centerShapeMapping_none;
+ }
+ }
+ CycleAlgorithm.prototype.getCenterShapeRadius = function (centerBounds, anotherBounds, guideVector) {
+ if (!centerBounds || !anotherBounds) {
+ return 0;
+ }
+ const centerPoint = getShapePoint(centerBounds);
+ const anotherPoint = getShapePoint(anotherBounds);
+ const centerEdgePoint = getMinShapeEdgePoint(centerBounds, guideVector);
+ const anotherEdgePoint = getMinShapeEdgePoint(anotherBounds, new CVector(-guideVector.x, -guideVector.y));
+ if (centerEdgePoint && anotherEdgePoint) {
+ const centerDistance = centerPoint.getVector(centerEdgePoint).getDistance();
+ const anotherDistance = anotherPoint.getVector(anotherEdgePoint).getDistance();
+ const minPadding = this.parentNode.getConstr(AscFormat.Constr_type_sp);
+ return centerDistance + anotherDistance + minPadding;
+ }
+ return 0;
+ };
+ CycleAlgorithm.prototype.getStartCycleBounds = function () {
+ const centerNode = this.getCenterNode();
+ if (centerNode) {
+ const centerShape = centerNode.getShape(true);
+ const bounds = centerShape.getBounds(true);
+ const halfWidth = (bounds.r - bounds.l) / 2;
+ const halfHeight = (bounds.b - bounds.t) / 2;
+ return {
+ l: -halfWidth,
+ r: halfWidth,
+ t: -halfHeight,
+ b: halfHeight
+ };
+ }
+ return {l: 0, r: 0, t: 0, b: 0};
+ }
+ CycleAlgorithm.prototype.initCenterShapeMap = function () {
+ if (this.params[AscFormat.Param_type_ctrShpMap] === AscFormat.ParameterVal_centerShapeMapping_fNode) {
+ const childs = this.parentNode.childs;
+ for (let i = 0; i < childs.length; i += 1) {
+ const child = childs[i];
+ if (child.isContentNode()) {
+ this.calcValues.centerNodeIndex = i;
+ return i + 1;
+ }
+ }
+ }
+ return 0;
+ };
+ CycleAlgorithm.prototype.calculateStartValues = function () {
+ if (!this.calcValues.isInit) {
+ this.calcValues.isInit = true;
+ const spanAngle = this.params[AscFormat.Param_type_spanAng];
+ const startAngle = AscFormat.normalizeRotate(this.params[AscFormat.Param_type_stAng] * degToRad - Math.PI / 2);
+
+ const mainElements = this.calcValues.mainElements;
+ const childs = this.parentNode.childs;
+ let startIndex = this.initCenterShapeMap();
+ for (startIndex; startIndex < childs.length; startIndex += 1) {
+ const child = childs[startIndex];
+ if (child.isContentNode()) {
+ mainElements.push(child);
+ }
+ }
+
+ let stepAngle;
+ if (Math.abs(spanAngle) === 360) {
+ if (mainElements.length === 0) {
+ stepAngle = 0;
+ } else {
+ stepAngle = (spanAngle / mainElements.length) * degToRad;
+ }
+
+ } else {
+ if (mainElements.length === 0) {
+ stepAngle = 0;
+ } else {
+ stepAngle = (spanAngle / (mainElements.length - 1)) * degToRad;
+ }
+ }
+ this.calcValues.startAngle = startAngle;
+ this.calcValues.stepAngle = stepAngle;
+ }
+ };
+ CycleAlgorithm.prototype.getNormalizeSibSp = function () {
+ //todo think about how it is actually calculated
+ const stepAngle = this.calcValues.stepAngle;
+ const sibSp = this.parentNode.getConstr(AscFormat.Constr_type_sibSp);
+ if (this.isClockwise()) {
+ if (stepAngle > Math.PI / 2 && sibSp < 0) {
+ return 0;
+ }
+ } else {
+ if (stepAngle < -Math.PI / 2 && sibSp < 0) {
+ return 0;
+ }
+ }
+ return sibSp;
+ }
+ CycleAlgorithm.prototype.calcScaleCoefficients = function (smartartAlgorithm) {
+ const startAngle = this.calcValues.startAngle;
+ const stepAngle = this.calcValues.stepAngle;
+ const mainElements = this.calcValues.mainElements;
+ let previousAngle = startAngle;
+ let currentAngle = AscFormat.normalizeRotate(startAngle + stepAngle);
+ const divider = Math.sqrt(2 * (1 - Math.cos(Math.abs(stepAngle))));
+ const sibSp = this.getNormalizeSibSp();
+
+ const firstShape = mainElements[0] && mainElements[0].getShape(true)
+ const firstElementBounds = firstShape && firstShape.getBounds(true);
+ let maxRadius = 0;
+ const centerNode = this.getCenterNode();
+ let centerShapeBounds;
+ if (centerNode) {
+ const startGuideVector = CVector.getVectorByAngle(startAngle);
+ const centerShape = centerNode.getShape(true);
+ centerShapeBounds = centerShape.getBounds(true);
+ maxRadius = this.getCenterShapeRadius(centerShapeBounds, firstElementBounds, startGuideVector);
+ }
+ if (divider !== 0) {
+ let previousBounds = firstElementBounds;
+ for (let i = 1; i < mainElements.length + 1; i++) {
+ const curIndex = i === mainElements.length ? 0 : i;
+ const shape = mainElements[curIndex].getShape(true);
+ const currentBounds = shape.getBounds(true);
+ const centerGuideVector = CVector.getVectorByAngle(currentAngle);
+ const tempCenterRadius = this.getCenterShapeRadius(centerShapeBounds, currentBounds, centerGuideVector);
+
+ let tempSibRadius = 0;
+
+ const previousVector = CVector.getVectorByAngle(previousAngle);
+ const currentVector = CVector.getVectorByAngle(currentAngle);
+ const guideVector = currentVector.getDiffVector(previousVector);
+ const currentEdgePoint = getMinShapeEdgePoint(currentBounds, guideVector);
+ const previousEdgePoint = getMinShapeEdgePoint(previousBounds, new CVector(-guideVector.x, -guideVector.y));
+ if (currentEdgePoint && previousEdgePoint) {
+ const currentShapePoint = getShapePoint(currentBounds);
+ const previousShapePoint = getShapePoint(previousBounds);
+ const currentVector = currentShapePoint.getVector(currentEdgePoint);
+ const previousVector = previousShapePoint.getVector(previousEdgePoint);
+ const previousDistance = previousVector.getDistance();
+ const currentDistance = currentVector.getDistance();
+
+ tempSibRadius = (sibSp + previousDistance + currentDistance) / divider;
+ }
+ maxRadius = Math.max(maxRadius, tempSibRadius, tempCenterRadius);
+ previousAngle = currentAngle;
+ currentAngle = i === mainElements.length - 1 ? AscFormat.normalizeRotate(startAngle) : AscFormat.normalizeRotate(currentAngle + stepAngle);
+ previousBounds = currentBounds;
+ }
+ }
+ currentAngle = startAngle;
+ const cycleBounds = this.getStartCycleBounds();
+ const radiusBounds = {l: 0, r: 0, t: 0, b: 0};
+ for (let i = 0; i < mainElements.length; i++) {
+ const radiusVector = CVector.getVectorByAngle(currentAngle);
+ radiusVector.multiply(maxRadius);
+ const shape = mainElements[i].getShape(true);
+ const currentBounds = shape.getBounds(true);
+ const halfWidth = (currentBounds.r - currentBounds.l) / 2;
+ const halfHeight = (currentBounds.b - currentBounds.t) / 2;
+ const newL = radiusVector.x - halfWidth;
+ const newR = radiusVector.x + halfWidth;
+ const newT = radiusVector.y - halfHeight;
+ const newB = radiusVector.y + halfHeight;
+
+ if (newL < cycleBounds.l) {
+ cycleBounds.l = newL;
+ radiusBounds.l = radiusVector.x;
+ }
+ if (newT < cycleBounds.t) {
+ cycleBounds.t = newT;
+ radiusBounds.t = radiusVector.y;
+ }
+ if (newR > cycleBounds.r) {
+ cycleBounds.r = newR;
+ radiusBounds.r = radiusVector.x;
+ }
+ if (newB > cycleBounds.b) {
+ cycleBounds.b = newB;
+ radiusBounds.b = radiusVector.y;
+ }
+
+ currentAngle = AscFormat.normalizeRotate(currentAngle + stepAngle);
+ }
+
+ const parentWidth = this.getParentNodeWidth();
+ const parentHeight = this.getParentNodeHeight();
+ const cycleHeight = cycleBounds.b - cycleBounds.t;
+ const cycleWidth = cycleBounds.r - cycleBounds.l;
+ let coefficient = Math.min(1, parentWidth / cycleWidth, parentHeight / cycleHeight);
+ if (coefficient === 1 && smartartAlgorithm.factRuleState === factRuleState.enabled) {
+ smartartAlgorithm.setFactRuleState(factRuleState.disabled);
+ return;
+ }
+ let radiusCoefficient = coefficient;
+ const scaleFactor = this.getOffsetScaleFactor(radiusBounds, cycleBounds);
+ if (scaleFactor > 1) {
+ radiusCoefficient = Math.max(coefficient, scaleFactor);
+ }
+ const adaptRadius = maxRadius * radiusCoefficient;
+ this.calcValues.radius = maxRadius;
+ const constrRadius = this.getConstrRadius(true);
+ if (constrRadius !== undefined && adaptRadius > constrRadius) {
+ radiusCoefficient *= constrRadius / adaptRadius;
+ }
+ this.calcValues.radiusCoefficient = radiusCoefficient;
+ for (let i = 0; i < this.parentNode.childs.length; i += 1) {
+ const child = this.parentNode.childs[i];
+ child.setSizesScale(coefficient, coefficient);
+ }
+ };
+ CycleAlgorithm.prototype.getConstrRadius = function (isCalculateScaleCoefficients) {
+ const constrObject = this.parentNode.getConstraints(!isCalculateScaleCoefficients);
+ const diameter = constrObject[AscFormat.Constr_type_diam];
+ if (diameter !== undefined) {
+ return diameter / 2;
+ }
+ };
+ CycleAlgorithm.prototype.getOffsetScaleFactor = function (radiusBounds, cycleBounds) {
+ const parentNodeWidth = this.getParentNodeWidth();
+ const parentNodeHeight = this.getParentNodeHeight();
+
+ const radiusHeight = radiusBounds.b - radiusBounds.t;
+ const radiusWidth = radiusBounds.r - radiusBounds.l;
+ const parentWidth = parentNodeWidth - (radiusBounds.l - cycleBounds.l) - (cycleBounds.r - radiusBounds.r);
+ const parentHeight = parentNodeHeight - (radiusBounds.t - cycleBounds.t) - (cycleBounds.b - radiusBounds.b);
+ if (radiusHeight !== 0 && radiusWidth !== 0) {
+ return Math.max(1, Math.min(parentWidth / radiusWidth, parentHeight / radiusHeight));
+ } else if (radiusHeight === 0 && radiusWidth !== 0) {
+ return Math.max(1, parentWidth / radiusWidth);
+ } else if (radiusWidth === 0 && radiusHeight !== 0) {
+ return Math.max(1, parentHeight / radiusHeight);
+ }
+ return 1;
+ };
+
+ CycleAlgorithm.prototype.generateCurveShapeConnectors = function (smartartAlgorithm) {
+ for (let i = 0; i < this.parentNode.childs.length; i += 1) {
+ const child = this.parentNode.childs[i];
+ if (child.algorithm instanceof ConnectorAlgorithm && child.algorithm.isCurveShape()) {
+ child.algorithm.connectShapes(smartartAlgorithm);
+ }
+ }
+ };
+ CycleAlgorithm.prototype.resetConnectors = function () {
+ for (let i = 0; i < this.parentNode.childs.length; i += 1) {
+ const child = this.parentNode.childs[i];
+ if (child.algorithm instanceof ConnectorAlgorithm) {
+ child.algorithm.reset();
+ }
+ }
+ };
+ CycleAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ this.calculateStartValues();
+ if (isCalculateScaleCoefficients) {
+ this.calcScaleCoefficients(smartartAlgorithm);
+ } else {
+ this._calculateShapePositions();
+ this.setConnections();
+ this.generateCurveShapeConnectors(smartartAlgorithm);
+ this.applyAlgorithmAligns(isCalculateScaleCoefficients);
+ this.resetConnectors();
+ this.applyPostAlgorithmSettings();
+ this.createShadowShape(isCalculateScaleCoefficients);
+ }
+ };
+ CycleAlgorithm.prototype.isAlongPath = function () {
+ return this.params[AscFormat.Param_type_rotPath] === AscFormat.ParameterVal_rotationPath_alongPath;
+ }
+ CycleAlgorithm.prototype.getAlongRot = function (currentAngle) {
+ if (this.isAlongPath()) {
+ return AscFormat.normalizeRotate(currentAngle + Math.PI / 2);
+ }
+ return 0;
+ };
+ CycleAlgorithm.prototype._calculateShapePositions = function () {
+ const childs = this.parentNode.childs;
+ const radius = this.calcValues.radius * this.calcValues.radiusCoefficient;
+ let currentAngle = this.calcValues.startAngle;
+ const stepAngle = this.calcValues.stepAngle;
+ const container = this.getShapeContainer();
+ let startIndex = 0;
+ let incAngleDivider = childs.length;
+ if (this.calcValues.centerNodeIndex !== null) {
+ incAngleDivider -= 1;
+ const centerNode = this.getCenterNode();
+ const shape = centerNode && centerNode.getShape(false);
+ if (shape) {
+ shape.moveTo(-(shape.x + shape.width / 2), -(shape.y + shape.height / 2));
+ container.push(shape);
+ }
+ startIndex = this.calcValues.centerNodeIndex + 1;
+ }
+ let incAngle = 0;
+ if (incAngleDivider > 0) {
+ incAngle = 2 * Math.PI / incAngleDivider;
+ }
+
+ for (let i = startIndex; i < childs.length; i++) {
+ const child = childs[i];
+ const shape = child.getShape(false);
+ if (child.isContentNode() && shape) {
+ const radiusGuideVector = CVector.getVectorByAngle(currentAngle);
+ radiusGuideVector.multiply(radius);
+ shape.setRadialInfo(radiusGuideVector, incAngle);
+ const bounds = shape.getBounds();
+ const width = bounds.r - bounds.l;
+ const height = bounds.b - bounds.t;
+ const offX = radiusGuideVector.x - (bounds.l + width / 2);
+ const offY = radiusGuideVector.y - (bounds.t + height / 2);
+
+ shape.rot = this.getAlongRot(currentAngle);
+ shape.moveTo(offX, offY);
+ currentAngle = currentAngle + stepAngle;
+ container.push(shape);
+ }
+ }
+ };
+ CycleAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(true, isCalculateScaleCoefficients);
+ };
+ CycleAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficient) {
+ if (isCalculateScaleCoefficient) {
+ if (this.coefficientShapeContainer === null) {
+ this.coefficientShapeContainer = new CycleContainer();
+ }
+ return this.coefficientShapeContainer;
+ }
+ if (this.shapeContainer === null) {
+ this.shapeContainer = new CycleContainer();
+ }
+ return this.shapeContainer;
+ };
+
+ function LinearAlgorithm() {
+ PositionAlgorithm.call(this);
+ }
+ AscFormat.InitClassWithoutType(LinearAlgorithm, PositionAlgorithm);
+
+ LinearAlgorithm.prototype.isRow = function () {
+ return this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromL ||
+ this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromR;
+ }
+ LinearAlgorithm.prototype.initParams = function (params) {
+ PositionAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_linDir] === undefined) {
+ this.params[AscFormat.Param_type_linDir] = AscFormat.ParameterVal_linearDirection_fromL;
+ }
+
+ if (this.params[AscFormat.Param_type_vertAlign] === undefined) {
+ this.params[AscFormat.Param_type_vertAlign] = AscFormat.ParameterVal_verticalAlignment_mid;
+ }
+ if (this.params[AscFormat.Param_type_horzAlign] === undefined) {
+ this.params[AscFormat.Param_type_horzAlign] = AscFormat.ParameterVal_horizontalAlignment_ctr;
+ }
+
+ if (this.isRow()) {
+ if (this.params[AscFormat.Param_type_nodeVertAlign] === undefined) {
+ this.params[AscFormat.Param_type_nodeVertAlign] = AscFormat.ParameterVal_nodeVerticalAlignment_mid;
+ }
+ this.params[AscFormat.Param_type_nodeHorzAlign] = undefined;
+ } else {
+ if (this.params[AscFormat.Param_type_nodeHorzAlign] === undefined) {
+ this.params[AscFormat.Param_type_nodeHorzAlign] = AscFormat.ParameterVal_nodeHorizontalAlignment_ctr;
+ }
+ this.params[AscFormat.Param_type_nodeVertAlign] = undefined;
+ }
+ }
+ LinearAlgorithm.prototype.applyLeftNodeAlign = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const bounds = shapeContainer.getBounds();
+
+ shapeContainer.forEachShape(function (shape) {
+ const shapeBounds = shape.getBounds();
+ shape.moveTo(bounds.l - shapeBounds.l, 0);
+ });
+ };
+ LinearAlgorithm.prototype.applyRightNodeAlign = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const bounds = shapeContainer.getBounds();
+
+ shapeContainer.forEachShape(function (shape) {
+ const shapeBounds = shape.getBounds();
+ shape.moveTo(bounds.r - shapeBounds.r, 0);
+ });
+ };
+ LinearAlgorithm.prototype.applyCenterNodeAlign = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const bounds = shapeContainer.getBounds();
+ const boundsCenter = bounds.l + (bounds.r - bounds.l) / 2;
+ shapeContainer.forEachShape(function (shape) {
+ const shapeBounds = shape.getBounds();
+ shape.moveTo(boundsCenter - (shapeBounds.l + (shapeBounds.r - shapeBounds.l) / 2), 0);
+ });
+ };
+ LinearAlgorithm.prototype.applyTopNodeAlign = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const bounds = shapeContainer.getBounds();
+
+ shapeContainer.forEachShape(function (shape) {
+ const shapeBounds = shape.getBounds();
+ shape.moveTo(0, bounds.t - shapeBounds.t);
+ });
+ };
+ LinearAlgorithm.prototype.applyBottomNodeAlign = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const bounds = shapeContainer.getBounds();
+
+ shapeContainer.forEachShape(function (shape) {
+ const shapeBounds = shape.getBounds();
+ shape.moveTo(0, bounds.b - shapeBounds.b);
+ });
+ };
+ LinearAlgorithm.prototype.applyMidNodeAlign = function (isCalculateScaleCoefficients) {
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const bounds = shapeContainer.getBounds();
+ const boundsCenter = bounds.t + (bounds.b - bounds.t) / 2;
+ shapeContainer.forEachShape(function (shape) {
+ const shapeBounds = shape.getBounds();
+ shape.moveTo(0, boundsCenter - (shapeBounds.t + (shapeBounds.b - shapeBounds.t) / 2));
+ });
+ };
+ LinearAlgorithm.prototype.applyNodeAligns = function (isCalculateScaleCoefficients) {
+ switch (this.params[AscFormat.Param_type_nodeHorzAlign]) {
+ case AscFormat.ParameterVal_nodeHorizontalAlignment_l:
+ this.applyLeftNodeAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_nodeHorizontalAlignment_ctr:
+ this.applyCenterNodeAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_nodeHorizontalAlignment_r:
+ this.applyRightNodeAlign(isCalculateScaleCoefficients);
+ break;
+ default:
+ break;
+ }
+
+ switch (this.params[AscFormat.Param_type_nodeVertAlign]) {
+ case AscFormat.ParameterVal_nodeVerticalAlignment_t:
+ this.applyTopNodeAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_nodeVerticalAlignment_mid:
+ this.applyMidNodeAlign(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_nodeVerticalAlignment_b:
+ this.applyBottomNodeAlign(isCalculateScaleCoefficients);
+ break;
+ default:
+ break;
+ }
+ }
+ LinearAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(true, isCalculateScaleCoefficients);
+ };
+ LinearAlgorithm.prototype.isFromLeft = function () {
+ return this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromL;
+ };
+ LinearAlgorithm.prototype.isFromTop = function () {
+ return this.params[AscFormat.Param_type_linDir] === AscFormat.ParameterVal_linearDirection_fromT;
+ };
+ LinearAlgorithm.prototype._calculateShapePositions = function (isCalculateScaleCoefficients) {
+ switch (this.params[AscFormat.Param_type_linDir]) {
+ case AscFormat.ParameterVal_linearDirection_fromL:
+ case AscFormat.ParameterVal_linearDirection_fromR:
+ this.calculateRowShapePositions(isCalculateScaleCoefficients);
+ break;
+ case AscFormat.ParameterVal_linearDirection_fromT:
+ case AscFormat.ParameterVal_linearDirection_fromB:
+ this.calculateColumnShapePositions(isCalculateScaleCoefficients);
+ break;
+ }
+ };
+ LinearAlgorithm.prototype.isHaveChildLinear = function () {
+ for (let i = 0; i < this.parentNode.childs.length; i += 1) {
+ if (this.parentNode.childs[i].algorithm instanceof LinearAlgorithm) {
+ return true;
+ }
+ }
+ return false;
+ }
+ LinearAlgorithm.prototype.is2DFallback = function () {
+ return this.params[AscFormat.Param_type_fallback] === AscFormat.ParameterVal_fallbackDimension_2D || this.isHaveChildLinear();
+ }
+ LinearAlgorithm.prototype.setScaleCoefficient = function () {
+ if (!(!this.parentNode.parent || this.parentNode.parent.algorithm instanceof CompositeAlgorithm)) {
+ return;
+ }
+
+ const parentHeight = this.getParentNodeHeight(false);
+ const parentWidth = this.getParentNodeWidth(false);
+ if (!(parentHeight && parentWidth)) {
+ return;
+ }
+ const childs = this.parentNode.childs;
+ const length = this.isHideLastChild() ? childs.length - 1 : childs.length;
+ if (length > 0) {
+ const isRow = this.isRow();
+ const shapeContainer = this.getShapeContainer(true);
+ const bounds = shapeContainer.getBounds();
+ const width = bounds.r - bounds.l;
+ const height = bounds.b - bounds.t;
+ let widthCoefficient = Math.min(parentWidth / width, 1);
+ let heightCoefficient = Math.min(parentHeight / height, 1);
+ if (this.is2DFallback()) {
+ const commonCoefficient = Math.min(widthCoefficient, heightCoefficient);
+ widthCoefficient = commonCoefficient;
+ heightCoefficient = commonCoefficient;
+ } else if (isRow) {
+ //todo check the case when the height depends on the width
+ const cleanBounds = shapeContainer.getBounds(true, true);
+ const cleanHeightCoefficient = parentHeight / (cleanBounds.b - cleanBounds.t);
+ if (cleanHeightCoefficient >= 1 || fAlgDeltaEqual(cleanHeightCoefficient, 1)) {
+ heightCoefficient = 1;
+ }
+ } else {
+ const cleanBounds = shapeContainer.getBounds(true, true);
+ const cleanWidthCoefficient = parentWidth / (cleanBounds.r - cleanBounds.l);
+ if (cleanWidthCoefficient >= 1 || fAlgDeltaEqual(cleanWidthCoefficient, 1)) {
+ widthCoefficient = 1;
+ }
+ }
+
+ const heightSizeScale = isRow ? 1 : heightCoefficient;
+ const widthSizeScale = isRow ? widthCoefficient : 1;
+ const nodes = [this.parentNode];
+ while (nodes.length) {
+ const node = nodes.pop();
+ for (let i = 0; i < node.childs.length; i += 1) {
+ const childNode = node.childs[i];
+
+ childNode.setSizesScale(widthSizeScale, heightSizeScale);
+ const shapeType = childNode.layoutInfo.shape.type;
+ if (shapeType !== AscFormat.LayoutShapeType_outputShapeType_none &&
+ shapeType !== AscFormat.LayoutShapeType_outputShapeType_conn) {
+ if (isRow) {
+ if (childNode.getAspectRatio()) {
+ childNode.setParentScale(AscFormat.Constr_type_w, heightCoefficient);
+ childNode.setParentScale(AscFormat.Constr_type_h, heightCoefficient);
+ } else {
+ childNode.setParentScale(AscFormat.Constr_type_h, heightCoefficient);
+ }
+ } else {
+ if (childNode.getAspectRatio()) {
+ childNode.setParentScale(AscFormat.Constr_type_w, widthCoefficient);
+ childNode.setParentScale(AscFormat.Constr_type_h, widthCoefficient);
+ } else {
+ childNode.setParentScale(AscFormat.Constr_type_w, widthCoefficient);
+ }
+ }
+ }
+ nodes.push(childNode);
+ }
+ }
+ }
+ };
+ LinearAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ this._calculateShapePositions(isCalculateScaleCoefficients);
+ this.applyNodeAligns(isCalculateScaleCoefficients);
+ this.applyAlgorithmAligns(isCalculateScaleCoefficients);
+ if (isCalculateScaleCoefficients) {
+ this.setScaleCoefficient();
+ } else {
+ this.setConnections();
+ }
+ this.createShadowShape(isCalculateScaleCoefficients);
+ };
+ LinearAlgorithm.prototype.calculateRowShapePositions = function (isCalculateScaleCoefficients) {
+ const fromLeft = this.isFromLeft();
+ const childs = this.parentNode.childs;
+ const length = this.isHideLastChild() ? childs.length - 1 : childs.length;
+ let offX = 0;
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients);
+ const row = new ShapeContainer();
+ shapeContainer.push(row);
+ for (let i = 0; i < length; i++) {
+ const node = childs[i];
+ const shape = node.getShape(isCalculateScaleCoefficients);
+ const bounds = shape.getBounds();
+ row.push(shape);
+ if (fromLeft) {
+ shape.moveTo(offX - bounds.l, 0);
+ offX += bounds.r - bounds.l;
+ } else {
+ shape.moveTo(offX - bounds.r, 0);
+ offX -= bounds.r - bounds.l;
+ }
+ }
+ };
+
+ LinearAlgorithm.prototype.calculateColumnShapePositions = function (isCalculateScaleCoefficients) {
+ const fromTop = this.isFromTop();
+ const childs = this.parentNode.childs;
+ const length = this.isHideLastChild() ? childs.length - 1 : childs.length;
+ if (length === 0) {
+ return;
+ }
+ const shapeContainer = this.getShapeContainer(isCalculateScaleCoefficients, true);
+ const row = new ShapeContainer();
+ shapeContainer.push(row);
+ let offY = 0;
+ for (let i = 0; i < length; i++) {
+ const node = childs[i];
+ const shape = node.getShape(isCalculateScaleCoefficients);
+ row.push(shape);
+ const bounds = shape.getBounds();
+ if (fromTop) {
+ shape.moveTo(0, offY - bounds.t);
+ offY += bounds.b - bounds.t;
+ } else {
+ shape.moveTo(0, offY - bounds.b);
+ offY -= bounds.b - bounds.t;
+ }
+ }
+ };
+ LinearAlgorithm.prototype.getShapeContainer = function (isCalculateScaleCoefficient, isColumn) {
+ if (isCalculateScaleCoefficient) {
+ if (this.coefficientShapeContainer === null) {
+ if (isColumn) {
+ this.coefficientShapeContainer = new ShapeColumns();
+ } else {
+ this.coefficientShapeContainer = new ShapeRows();
+ }
+
+ }
+ return this.coefficientShapeContainer;
+ }
+ if (this.shapeContainer === null) {
+ if (isColumn) {
+ this.shapeContainer = new ShapeColumns();
+ } else {
+ this.shapeContainer = new ShapeRows();
+ }
+ }
+ return this.shapeContainer;
+ };
+
+ function ConnectorAlgorithm() {
+ BaseAlgorithm.call(this);
+ this.startNode = null;
+ this.endNode = null;
+ this.connectionDistances = {
+ begin: null,
+ end: null
+ };
+ this.stemThick = 0.6;
+ this.diameterScale = 1;
+ this.parentAlgorithm = null;
+ this.calcValues = {
+ edgePoints: null,
+ radiusCenterPoint: null,
+ connectionPoints: null,
+ pointPositions: null
+ }
+ }
+ AscFormat.InitClassWithoutType(ConnectorAlgorithm, BaseAlgorithm);
+ ConnectorAlgorithm.prototype.reset = function () {
+ this.calcValues = {
+ edgePoints: null,
+ radiusCenterPoint: null,
+ connectionPoints: null,
+ pointPositions: null
+ }
+ const connectionDistanceResolver = this.parentAlgorithm.parentNode.connectionDistanceResolver;
+ if (connectionDistanceResolver) {
+ connectionDistanceResolver.connectionDistance = null;
+ }
+ };
+ ConnectorAlgorithm.prototype.isClockwise = function () {
+ if (this.constrClockwise !== null) {
+ return this.constrClockwise;
+ }
+ return this.parentAlgorithm.isClockwise();
+ };
+ ConnectorAlgorithm.prototype.initParams = function (params) {
+ BaseAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_dim] === undefined) {
+ this.params[AscFormat.Param_type_dim] = AscFormat.ParameterVal_connectorDimension_2D;
+ }
+ if (this.params[AscFormat.Param_type_begSty] === undefined) {
+ this.params[AscFormat.Param_type_begSty] = AscFormat.ParameterVal_arrowheadStyle_noArr;
+ }
+ if (this.params[AscFormat.Param_type_endSty] === undefined) {
+ this.params[AscFormat.Param_type_endSty] = AscFormat.ParameterVal_arrowheadStyle_arr;
+ }
+ if (this.params[AscFormat.Param_type_connRout] === undefined) {
+ this.params[AscFormat.Param_type_connRout] = AscFormat.ParameterVal_connectorRouting_stra;
+ }
+ if (this.params[AscFormat.Param_type_connRout] === AscFormat.ParameterVal_connectorRouting_bend) {
+ if (this.params[AscFormat.Param_type_bendPt] === undefined) {
+ this.params[AscFormat.Param_type_bendPt] = AscFormat.ParameterVal_bendPoint_end;
+ }
+ }
+ }
+
+ ConnectorAlgorithm.prototype.getConnectionDistCoefficient = function (isBegin) {
+ switch (this.params[AscFormat.Param_type_connRout]) {
+ case AscFormat.ParameterVal_connectorRouting_bend:
+ if (!this.connectionDistances.begin && !this.connectionDistances.end) {
+ return isBegin ? 0 : 1;
+ } else {
+ if (isBegin) {
+ return this.connectionDistances.begin || 0;
+ } else {
+ return this.connectionDistances.end || 1;
+ }
+ }
+ case AscFormat.ParameterVal_connectorRouting_stra:
+ if (!this.connectionDistances.begin && !this.connectionDistances.end) {
+ if (this.params[AscFormat.Param_type_dim] === AscFormat.ParameterVal_connectorDimension_2D) {
+ return isBegin ? 0.22 : 0.25;
+ }
+ return 0;
+ }
+ return isBegin ? this.connectionDistances.begin : this.connectionDistances.end;
+ default:
+ return isBegin ? this.connectionDistances.begin : this.connectionDistances.end;
+ }
+ }
+ ConnectorAlgorithm.prototype.getEdgePoints = function () {
+ if (!this.calcValues.edgePoints) {
+ this.calcValues.edgePoints = {
+ start: null,
+ end: null
+ };
+ this.calcValues.pointPositions = {
+ start: null,
+ end: null
+ };
+
+ let calcStartEdgePoint;
+ let calcEndEdgePoint;
+ const startEdgePoints = this.getAvailableEdgePoints(true);
+ const endEdgePoints = this.getAvailableEdgePoints();
+ let minDistance = null;
+ for (let i = 0; i < startEdgePoints.length; i += 1) {
+ const startEdgePoint = startEdgePoints[i].point;
+ for (let j = 0; j < endEdgePoints.length; j += 1) {
+ const endEdgePoint = endEdgePoints[j].point;
+ const distance = startEdgePoint.getVector(endEdgePoint).getDistance();
+ if (minDistance === null || minDistance > distance) {
+ minDistance = distance;
+ calcStartEdgePoint = startEdgePoints[i];
+ calcEndEdgePoint = endEdgePoints[j];
+ }
+ }
+ }
+
+ if (calcStartEdgePoint && calcEndEdgePoint) {
+ this.calcValues.edgePoints.start = calcStartEdgePoint.point;
+ this.calcValues.pointPositions.start = calcStartEdgePoint.type;
+ this.calcValues.edgePoints.end = calcEndEdgePoint.point;
+ this.calcValues.pointPositions.end = calcEndEdgePoint.type;
+ }
+ if (this.isCurveConnection()) {
+ this.calcCurveEdgePoints(this.calcValues.edgePoints.start, this.calcValues.edgePoints.end);
+ }
+ }
+ if (this.calcValues.edgePoints.start && this.calcValues.edgePoints.end) {
+ return this.calcValues.edgePoints;
+ }
+ return null;
+ };
+ ConnectorAlgorithm.prototype.getBendConnectionPoints = function (startPoint, endPoint) {
+ const vector = startPoint.getVector(endPoint);
+ const startConnectionPoint = this.getBendConnectionPoint(startPoint, startPoint, vector, true);
+ const endConnectionPoint = this.getBendConnectionPoint(endPoint, startPoint, vector, false);
+ return {start: startConnectionPoint, end: endConnectionPoint};
+ };
+
+ ConnectorAlgorithm.prototype.getBendConnectionPoint = function (point, startPoint, vector, isStart) {
+ const position = this.getPointPosition(isStart);
+ const coefficient = this.getConnectionDistCoefficient(isStart);
+ switch (position) {
+ case AscFormat.ParameterVal_connectorPoint_bCtr:
+ case AscFormat.ParameterVal_connectorPoint_tCtr:
+ return new CCoordPoint(point.x, vector.y * coefficient + startPoint.y);
+ case AscFormat.ParameterVal_connectorPoint_midR:
+ case AscFormat.ParameterVal_connectorPoint_midL:
+ case AscFormat.ParameterVal_connectorPoint_tL:
+ case AscFormat.ParameterVal_connectorPoint_bR:
+ case AscFormat.ParameterVal_connectorPoint_tR:
+ case AscFormat.ParameterVal_connectorPoint_bL:
+ return new CCoordPoint(vector.x * coefficient + startPoint.x, point.y);
+ case AscFormat.ParameterVal_connectorPoint_radial:
+ case AscFormat.ParameterVal_connectorPoint_auto:
+ default:
+ return null;
+ }
+ };
+ ConnectorAlgorithm.prototype.getStraightConnectionPoints = function (startPoint, endPoint) {
+ const startCoefficient = this.getConnectionDistCoefficient(true);
+ const endCoefficient = 1 - this.getConnectionDistCoefficient(false);
+ const endConnectionPoint = new CCoordPoint((endPoint.x - startPoint.x) * endCoefficient + startPoint.x, (endPoint.y - startPoint.y) * endCoefficient + startPoint.y);
+ const startConnectionPoint = new CCoordPoint((endPoint.x - startPoint.x) * startCoefficient + startPoint.x, (endPoint.y - startPoint.y) * startCoefficient + startPoint.y);
+
+ return {start: startConnectionPoint, end: endConnectionPoint};
+ };
+ ConnectorAlgorithm.prototype.getCenterPoint = function () {
+ if (this.calcValues.radiusCenterPoint) {
+ return this.calcValues.radiusCenterPoint;
+ }
+ if (this.parentAlgorithm instanceof CycleAlgorithm) {
+ const startShape = this.getStartShape();
+ if (startShape.radialVector) {
+ const bounds = startShape.getBounds();
+ const centerShapePoint = getShapePoint(bounds);
+ return new CCoordPoint(centerShapePoint.x - startShape.radialVector.x, centerShapePoint.y - startShape.radialVector.y);
+ }
+ }
+ };
+ ConnectorAlgorithm.prototype.getCurveConnectionPoints = function (startPoint, endPoint) {
+ const result = {start: null, end: null};
+ const centerPoint = this.getCenterPoint();
+ if (centerPoint) {
+ const startCoefficient = this.getConnectionDistCoefficient(true);
+ const endCoefficient = this.getConnectionDistCoefficient(false);
+
+ const startVector = centerPoint.getVector(startPoint);
+ const radius = startVector.getDistance();
+ const endVector = centerPoint.getVector(endPoint);
+ const angle = startVector.getAngleBetween(endVector, !this.isClockwise());
+ const startAngle = startVector.getAngle();
+ const endAngle = endVector.getAngle();
+
+ let startConnectionVector;
+ let endConnectionVector;
+ if (this.isClockwise() === this.isLongCurve()) {
+ startConnectionVector = CVector.getVectorByAngle(startAngle - angle * startCoefficient);
+ endConnectionVector = CVector.getVectorByAngle(endAngle + angle * endCoefficient);
+ } else {
+ startConnectionVector = CVector.getVectorByAngle(startAngle + angle * startCoefficient);
+ endConnectionVector = CVector.getVectorByAngle(endAngle - angle * endCoefficient);
+ }
+ result.start = new CCoordPoint(centerPoint.x + startConnectionVector.x * radius, centerPoint.y + startConnectionVector.y * radius);
+ result.end = new CCoordPoint(centerPoint.x + endConnectionVector.x * radius, centerPoint.y + endConnectionVector.y * radius);
+ }
+ return result;
+ };
+ ConnectorAlgorithm.prototype.getConnectionPoints = function () {
+ if (!this.calcValues.connectionPoints) {
+ this.calcValues.connectionPoints = {
+ start: null,
+ end : null
+ };
+ const edgePoints = this.getEdgePoints();
+ if (edgePoints) {
+ const startPoint = edgePoints.start;
+ const endPoint = edgePoints.end;
+ let connectionPoints;
+ switch (this.params[AscFormat.Param_type_connRout]) {
+ case AscFormat.ParameterVal_connectorRouting_bend:
+ connectionPoints = this.getBendConnectionPoints(startPoint, endPoint);
+ break;
+ case AscFormat.ParameterVal_connectorRouting_stra:
+ connectionPoints = this.getStraightConnectionPoints(startPoint, endPoint);
+ break;
+ case AscFormat.ParameterVal_connectorRouting_curve:
+ case AscFormat.ParameterVal_connectorRouting_longCurve:
+ connectionPoints = this.getCurveConnectionPoints(startPoint, endPoint);
+ break;
+ default:
+ break;
+ }
+
+ if (connectionPoints) {
+ this.calcValues.connectionPoints.start = connectionPoints.start;
+ this.calcValues.connectionPoints.end = connectionPoints.end;
+ }
+ }
+ }
+ return this.calcValues.connectionPoints;
+ }
+ ConnectorAlgorithm.prototype.setParentAlgorithm = function (algorithm) {
+ this.parentAlgorithm = algorithm;
+ };
+ ConnectorAlgorithm.prototype.setConnectionDistance = function (value, isStart) {
+ if (isStart) {
+ this.connectionDistances.begin = value;
+ } else {
+ this.connectionDistances.end = value;
+ }
+ };
+ BaseAlgorithm.prototype.setStemThick = function (value) {
+ this.stemThick = value;
+ };
+ ConnectorAlgorithm.prototype.getPointPosition = function (isStart) {
+ if (!this.calcValues.pointPositions) {
+ this.getEdgePoints();
+ }
+ return isStart ? this.calcValues.pointPositions.start : this.calcValues.pointPositions.end;
+ };
+ ConnectorAlgorithm.prototype.getStartShape = function () {
+ return this.startNode.getShape(false);
+ };
+ ConnectorAlgorithm.prototype.getEndShape = function () {
+ return this.endNode.getShape(false);
+ };
+ ConnectorAlgorithm.prototype.isAutoCenterPoint = function (isStart, isFromLayout) {
+ const connCoefficient = this.getConnectionDistCoefficient(isStart);
+ return connCoefficient === 0 && this.params[AscFormat.Param_type_dim] === AscFormat.ParameterVal_connectorDimension_2D &&
+ isFromLayout;
+ };
+ ConnectorAlgorithm.prototype.getAutoEdgePoint = function (isStart, isFromLayout) {
+ const startShape = this.getStartShape();
+ const endShape = this.getEndShape();
+ const startBounds = startShape.getBounds();
+ const endBounds = endShape.getBounds();
+ if (this.isAutoCenterPoint(isStart, isFromLayout)) {
+ return isStart ? getShapePoint(startBounds) : getShapePoint(endBounds);
+ }
+ const startPoint = getShapePoint(startBounds);
+ const endPoint = getShapePoint(endBounds);
+ let guideVector;
+ if (isStart) {
+ guideVector = new CVector(endPoint.x - startPoint.x, endPoint.y - startPoint.y);
+ } else {
+ guideVector = new CVector(startPoint.x - endPoint.x, startPoint.y - endPoint.y);
+ }
+ if (fAlgDeltaEqual(guideVector.getDistance(), 0)) {
+ return null;
+ }
+ const bounds = isStart ? startBounds : endBounds;
+ return getMinShapeEdgePoint(bounds, guideVector);
+ };
+ ConnectorAlgorithm.prototype.getEllipseRadialEdgePoint = function (radialInfo, bounds, isStart) {
+ const cycleAngle = radialInfo.angle;
+ const centerPoint = radialInfo.point;
+ const radius = radialInfo.radius;
+ const shapeRadius = (bounds.r - bounds.l) / 2;
+ const shapeAngle = Math.acos(1 - ((shapeRadius * shapeRadius) / (2 * radius * radius)));
+ let angle = cycleAngle;
+ if (radialInfo.isClockwise) {
+ if (isStart) {
+ angle += shapeAngle;
+ } else {
+ angle -= shapeAngle;
+ }
+ } else {
+ if (isStart) {
+ angle -= shapeAngle;
+ } else {
+ angle += shapeAngle;
+ }
+ }
+
+
+ return new CCoordPoint(Math.cos(angle) * radius + centerPoint.x, Math.sin(angle) * radius + centerPoint.y);
+ };
+ ConnectorAlgorithm.prototype.isPointOnInterval = function (point, startSegment, endSegment) {
+ if (startSegment.x === endSegment.x) {
+ return (point.y > startSegment.y) && (point.y < endSegment.y) && !(fIntervalDeltaEqual(point.y, startSegment.y) || fIntervalDeltaEqual(point.y, endSegment.y));
+ } else {
+ return (point.x > startSegment.x) && (point.x < endSegment.x) && !(fIntervalDeltaEqual(point.x, startSegment.x) || fIntervalDeltaEqual(point.x, endSegment.x));
+ }
+ };
+ ConnectorAlgorithm.prototype.isPointOnSegment = function (point, startSegment, endSegment) {
+ if (startSegment.x === endSegment.x) {
+ return (point.y > startSegment.y || fIntervalDeltaEqual(point.y, startSegment.y)) && (point.y < endSegment.y || fIntervalDeltaEqual(point.y, endSegment.y));
+ } else {
+ return (point.x > startSegment.x || fIntervalDeltaEqual(point.x, startSegment.x)) && (point.x < endSegment.x || fIntervalDeltaEqual(point.x, endSegment.x));
+ }
+ }
+ ConnectorAlgorithm.prototype.getCycleRadius = function () {
+ const radiusCoefficient = this.parentAlgorithm.calcValues.radiusCoefficient || 1;
+ if (this.parentAlgorithm instanceof CycleAlgorithm) {
+ const diamScale = Math.abs(this.diameterScale);
+ return this.parentAlgorithm.calcValues.radius * radiusCoefficient * diamScale;
+ }
+ const constrDiam = this.parentNode.getConstr(AscFormat.Constr_type_diam, true, true);
+ if (constrDiam !== undefined) {
+ return Math.abs(constrDiam) / 2;
+ }
+
+ };
+
+ ConnectorAlgorithm.prototype.calcCurveEdgePoints = function (startPoint, endPoint) {
+ if (!(startPoint && endPoint)) {
+ startPoint = this.getAutoEdgePoint(true);
+ endPoint = this.getAutoEdgePoint();
+ }
+ if (!(startPoint && endPoint)) {
+ const startShape = this.getStartShape();
+ const endShape = this.getEndShape();
+ const startBounds = startShape.getBounds();
+ const endBounds = endShape.getBounds();
+ startPoint = getShapePoint(startBounds);
+ endPoint = getShapePoint(endBounds);
+ }
+ if (startPoint && endPoint) {
+ this.calcValues.edgePoints.start = startPoint;
+ this.calcValues.edgePoints.end = endPoint;
+
+ const cycleRadius = this.getCycleRadius();
+ const isClockwise = this.isClockwise();
+ const lineVector = startPoint.getVector(endPoint);
+ const circlesIntersectionPoints = AscFormat.circlesIntersection(startPoint.x, startPoint.y, cycleRadius, endPoint.x, endPoint.y, cycleRadius);
+ if (circlesIntersectionPoints.length) {
+ const firstEllipsePoint = new CCoordPoint(circlesIntersectionPoints[0].x, circlesIntersectionPoints[0].y);
+ const secondEllipsePoint = new CCoordPoint(circlesIntersectionPoints[1].x, circlesIntersectionPoints[1].y);
+ let _isClockwisePoints = isClockwisePoints(firstEllipsePoint, startPoint, endPoint);
+
+ if (_isClockwisePoints) {
+ this.calcValues.radiusCenterPoint = isClockwise ? firstEllipsePoint : secondEllipsePoint;
+ } else {
+ this.calcValues.radiusCenterPoint = isClockwise ? secondEllipsePoint : firstEllipsePoint;
+ }
+ } else {
+ this.calcValues.radiusCenterPoint = new CCoordPoint(startPoint.x + lineVector.x / 2, startPoint.y + lineVector.y / 2);
+ }
+ }
+ };
+ ConnectorAlgorithm.prototype.getRectRadialEdgePoint = function (radialInfo, bounds, isStart) {
+ const centerPoint = radialInfo.point;
+ const radius = radialInfo.radius;
+ const isClockwise = radialInfo.isClockwise;
+
+ const ellipseBounds = {
+ l: centerPoint.x - radius,
+ r: centerPoint.x + radius,
+ t: centerPoint.y - radius,
+ b: centerPoint.y + radius
+ };
+
+ const linePoints = [
+ [new CCoordPoint(bounds.l, bounds.t), new CCoordPoint(bounds.r, bounds.t)],
+ [new CCoordPoint(bounds.l, bounds.t), new CCoordPoint(bounds.l, bounds.b)],
+ [new CCoordPoint(bounds.l, bounds.b), new CCoordPoint(bounds.r, bounds.b)],
+ [new CCoordPoint(bounds.r, bounds.t), new CCoordPoint(bounds.r, bounds.b)]
+ ];
+ const rectCenterPoint = getShapePoint(bounds);
+ for (let i = 0; i < linePoints.length; i += 1) {
+ const coords = linePoints[i];
+ const paramLine = getParametricLinEquation(coords[0], new CVector(coords[1].x - coords[0].x, coords[1].y - coords[0].y));
+ const answer = resolveParameterLineAndShapeEquation(ellipseBounds, paramLine);
+ if (!answer.bError) {
+ let point;
+ const point1 = new CCoordPoint(paramLine.x + paramLine.ax * answer.x1, paramLine.y + paramLine.ay * answer.x1);
+ const point2 = new CCoordPoint(paramLine.x + paramLine.ax * answer.x2, paramLine.y + paramLine.ay * answer.x2);
+
+ if (this.isPointOnInterval(point1, coords[0], coords[1]) && this.isPointOnInterval(point2, coords[0], coords[1])) {
+ continue;
+ } else if (this.isPointOnSegment(point1, coords[0], coords[1])) {
+ point = point1;
+ } else if (this.isPointOnSegment(point2, coords[0], coords[1])) {
+ point = point2;
+ } else {
+ continue;
+ }
+ if (isStart && isClockwise || !isStart && !isClockwise) {
+ if (isClockwisePoints(centerPoint, rectCenterPoint, point)) {
+ return point;
+ }
+ } else {
+ if (isClockwisePoints(centerPoint, point, rectCenterPoint)) {
+ return point;
+ }
+ }
+ }
+ }
+ return null;
+ };
+ ConnectorAlgorithm.prototype.getRadialEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const radialInfo = this.parentAlgorithm.getRadialConnectionInfo(shape.node);
+ if (!radialInfo || radialInfo.radius === 0) {
+ return null;
+ }
+
+ const bounds = shape.getBounds();
+ if (bounds.isEllipse) {
+ return this.getEllipseRadialEdgePoint(radialInfo, bounds, isStart);
+ }
+ return this.getRectRadialEdgePoint(radialInfo, bounds, isStart);
+ };
+ ConnectorAlgorithm.prototype.getAvailablePointPositions = function (isStart) {
+ const parameters = isStart ? this.params[AscFormat.Param_type_begPts] : this.params[AscFormat.Param_type_endPts];
+ return parameters || [AscFormat.ParameterVal_connectorPoint_auto];
+
+ }
+ ConnectorAlgorithm.prototype.isCurveConnection = function () {
+ return this.params[AscFormat.Param_type_connRout] === AscFormat.ParameterVal_connectorRouting_curve ||
+ this.params[AscFormat.Param_type_connRout] === AscFormat.ParameterVal_connectorRouting_longCurve;
+ };
+ ConnectorAlgorithm.prototype.isCurveShape = function () {
+ return this.params[AscFormat.Param_type_connRout] === AscFormat.ParameterVal_connectorRouting_curve &&
+ this.params[AscFormat.Param_type_dim] === AscFormat.ParameterVal_connectorDimension_2D;
+ };
+ ConnectorAlgorithm.prototype.getAvailableEdgePoints = function (isStart) {
+ const result = [];
+ const pointPositions = this.getAvailablePointPositions(isStart);
+ for (let i = 0; i < pointPositions.length; i += 1) {
+ const type = pointPositions[i];
+ let point;
+ switch (type) {
+ case AscFormat.ParameterVal_connectorPoint_radial:
+ point = this.getRadialEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_tL:
+ point = this.getTopLeftEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_tCtr:
+ point = this.getTopCenterEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_tR:
+ point = this.getTopRightEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_midR:
+ point = this.getMidRightEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_bR:
+ point = this.getBottomRightEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_bCtr:
+ point = this.getBottomCenterEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_bL:
+ point = this.getBottomLeftEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_midL:
+ point = this.getMidLeftEdgePoint(isStart);
+ break;
+ case AscFormat.ParameterVal_connectorPoint_auto:
+ default:
+ point = this.getAutoEdgePoint(isStart, true);
+ break;
+ }
+ if (point) {
+ result.push({point: point, type: type});
+ }
+ }
+ return result;
+ };
+ ConnectorAlgorithm.prototype.getTopLeftEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.l, bounds.t);
+ };
+ ConnectorAlgorithm.prototype.getTopCenterEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.l + (bounds.r - bounds.l) / 2, bounds.t);
+ };
+ ConnectorAlgorithm.prototype.getTopRightEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.r, bounds.t);
+ };
+ ConnectorAlgorithm.prototype.getMidRightEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.r, bounds.t + (bounds.b - bounds.t) / 2);
+ };
+ ConnectorAlgorithm.prototype.getBottomRightEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.r, bounds.b);
+ };
+ ConnectorAlgorithm.prototype.getBottomCenterEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.l + (bounds.r - bounds.l) / 2, bounds.b);
+ };
+ ConnectorAlgorithm.prototype.getBottomLeftEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.l, bounds.b);
+ };
+ ConnectorAlgorithm.prototype.getMidLeftEdgePoint = function (isStart) {
+ const shape = isStart ? this.getStartShape() : this.getEndShape();
+ const bounds = shape.getBounds();
+ return new CCoordPoint(bounds.l, bounds.t + (bounds.b - bounds.t) / 2);
+ };
+
+ ConnectorAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(false, isCalculateScaleCoefficients);
+ };
+ ConnectorAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ this.createShadowShape(isCalculateScaleCoefficients);
+ if (!isCalculateScaleCoefficients) {
+ smartartAlgorithm.addConnectorAlgorithm(this);
+ }
+ }
+
+ ConnectorAlgorithm.prototype.setFirstConnectorNode = function (node) {
+ this.startNode = node;
+ };
+ ConnectorAlgorithm.prototype.setLastConnectorNode = function (node) {
+ this.endNode = node;
+ };
+ ConnectorAlgorithm.prototype.connectShapes = function (smartartAlgorithm) {
+ if (this.startNode && this.endNode) {
+ if (this.params[AscFormat.Param_type_dim] === AscFormat.ParameterVal_connectorDimension_2D) {
+ this.createShapeConnector(smartartAlgorithm);
+ } else if (this.params[AscFormat.Param_type_dim] === AscFormat.ParameterVal_connectorDimension_1D) {
+ this.createLineConnector();
+ }
+ }
+ };
+ ConnectorAlgorithm.prototype.getStraightAdjLst = function (shapeType) {
+ if (shapeType !== AscFormat.LayoutShapeType_shapeType_rect) {
+ const customAdjLst = new AscFormat.AdjLst();
+ const adj1 = new AscFormat.Adj();
+ const adj2 = new AscFormat.Adj();
+ adj1.setIdx(1);
+ adj2.setIdx(2);
+ adj1.setVal(this.stemThick);
+ adj2.setVal(0.5);
+ customAdjLst.addToLst(0, adj1);
+ customAdjLst.addToLst(0, adj2);
+ return customAdjLst;
+ }
+ };
+ ConnectorAlgorithm.prototype.isLongCurve = function () {
+ return this.params[AscFormat.Param_type_connRout] === AscFormat.ParameterVal_connectorRouting_longCurve;
+ }
+ ConnectorAlgorithm.prototype.getConnectorShapeType = function () {
+ const endStyle = this.params[AscFormat.Param_type_endSty];
+ const beginStyle = this.params[AscFormat.Param_type_begSty];
+ if (this.params[AscFormat.Param_type_connRout] === AscFormat.ParameterVal_connectorRouting_curve) {
+ if (endStyle === AscFormat.ParameterVal_arrowheadStyle_arr && beginStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ return AscFormat.LayoutShapeType_shapeType_leftRightCircularArrow;
+ } else if (endStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ if (this.isClockwise()) {
+ return AscFormat.LayoutShapeType_shapeType_circularArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_leftCircularArrow;
+ } else if (beginStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ if (this.isClockwise()) {
+ return AscFormat.LayoutShapeType_shapeType_leftCircularArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_circularArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_blockArc;
+ } else if (this.isLongCurve()) {
+ if (endStyle === AscFormat.ParameterVal_arrowheadStyle_arr && beginStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ return AscFormat.LayoutShapeType_shapeType_leftRightCircularArrow;
+ } else if (endStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ if (this.isClockwise()) {
+ return AscFormat.LayoutShapeType_shapeType_leftCircularArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_circularArrow;
+ } else if (beginStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ if (this.isClockwise()) {
+ return AscFormat.LayoutShapeType_shapeType_circularArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_leftCircularArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_blockArc;
+ } else {
+ if (endStyle === AscFormat.ParameterVal_arrowheadStyle_arr && beginStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ return AscFormat.LayoutShapeType_shapeType_leftRightArrow;
+ } else if (endStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ return AscFormat.LayoutShapeType_shapeType_rightArrow;
+ } else if (beginStyle === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ return AscFormat.LayoutShapeType_shapeType_leftArrow;
+ }
+ return AscFormat.LayoutShapeType_shapeType_rect;
+ }
+ }
+ ConnectorAlgorithm.prototype.getTemplateConnectorShape = function () {
+ const shape = this.parentNode.shape;
+ const connectorShape = new ShadowShape();
+ connectorShape.shape = shape.shape;
+
+ connectorShape.type = this.getConnectorShapeType();
+ connectorShape.cleanParams = {};
+ connectorShape.cleanParams.width = shape.cleanParams.width;
+ connectorShape.cleanParams.height = shape.cleanParams.height;
+ connectorShape.cleanParams.x = shape.cleanParams.x;
+ connectorShape.cleanParams.y = shape.cleanParams.y;
+ connectorShape.node = this.parentNode;
+ return connectorShape;
+ };
+
+ ConnectorAlgorithm.prototype.createBlockArcCurveShapeConnector = function (startAngle, endAngle, radius) {
+ const connectorShape = this.getTemplateConnectorShape();
+ const connectorHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, true);
+ const stemThick = (connectorHeight / radius) / 3.4;
+ const customAdjLst = new AscFormat.AdjLst();
+ const adj1 = new AscFormat.Adj();
+ const adj2 = new AscFormat.Adj();
+ const adj3 = new AscFormat.Adj();
+ adj1.setIdx(1);
+ adj2.setIdx(2);
+ adj3.setIdx(3);
+ adj1.setVal(startAngle * radToDeg);
+ adj2.setVal(endAngle * radToDeg);
+ adj3.setVal(stemThick);
+ customAdjLst.addToLst(0, adj1);
+ customAdjLst.addToLst(0, adj2);
+ customAdjLst.addToLst(0, adj3);
+ connectorShape.customAdj = customAdjLst;
+
+ const centerPoint = this.getCenterPoint();
+ const absRadius = Math.abs(radius);
+ const diameterSide = absRadius * 2;
+ const truthSide = diameterSide / (1 - stemThick / 2);
+ const truthRadius = truthSide / 2;
+ connectorShape.width = truthSide;
+ connectorShape.height = truthSide;
+ connectorShape.x = centerPoint.x - truthRadius;
+ connectorShape.y = centerPoint.y - truthRadius;
+ const shape = this.parentNode.getShape();
+ shape.connectorShape = connectorShape;
+ };
+ ConnectorAlgorithm.prototype.createCircularArrowCurveShapeConnector = function (startAngle, endAngle, radius) {
+ const connectorShape = this.getTemplateConnectorShape();
+ const connectorHeight = this.parentNode.getConstr(AscFormat.Constr_type_h, true, true);
+ const constrArrowWidth = this.parentNode.getConstr(AscFormat.Constr_type_wArH, true, true);
+ const constrStemThick = this.parentNode.getConstr(AscFormat.Constr_type_stemThick, true, true);
+ const constrArrowHeight = this.parentNode.getConstr(AscFormat.Constr_type_hArH, true, true);
+ let adjArrowWidth;
+ let stemThick;
+ let adjArrowHeight;
+ let truthSide;
+ // todo: increase accuracy in Continuous Cycle
+ if (constrArrowWidth !== undefined && constrStemThick !== undefined && constrArrowHeight !== undefined) {
+ const diam = radius * 2;
+ const diamScale = Math.abs(this.diameterScale);
+ if (connectorHeight !== undefined) {
+ adjArrowWidth = constrArrowWidth / radius * 0.6195;
+ stemThick = adjArrowWidth / 1.16666;
+ adjArrowHeight = (constrArrowHeight / radius) * 28.65983;
+ truthSide = (diam / (1 - adjArrowWidth * 2)) * 0.98999;
+ } else {
+ adjArrowWidth = 1 / (diamScale) * 0.0598728;
+ stemThick = adjArrowWidth * 0.963;
+ adjArrowHeight = (1 / diamScale) * 5.731787;
+ truthSide = (diam / (1 - adjArrowWidth * 2)) * 0.9965;
+ }
+ } else if (connectorHeight !== undefined) {
+ const addValue = connectorHeight * 0.15;
+ truthSide = ((radius + addValue) * 2 + connectorHeight);
+ adjArrowWidth = 0.5 - ((radius - addValue / 3) / truthSide);
+ stemThick = adjArrowWidth * 0.85718;
+ adjArrowHeight = (connectorHeight / radius) * radToDeg / 2;
+ } else {
+ return;
+ }
+
+
+ const customAdjLst = new AscFormat.AdjLst();
+ const adj1 = new AscFormat.Adj();
+ const adj2 = new AscFormat.Adj();
+ const adj3 = new AscFormat.Adj();
+ const adj4 = new AscFormat.Adj();
+ const adj5 = new AscFormat.Adj();
+ adj1.setIdx(1);
+ adj2.setIdx(2);
+ adj3.setIdx(3);
+ adj4.setIdx(4);
+ adj5.setIdx(5);
+ adj1.setVal(stemThick);
+ adj2.setVal(adjArrowHeight);
+ if (this.getConnectorShapeType() === AscFormat.LayoutShapeType_shapeType_circularArrow) {
+ adj3.setVal(endAngle * radToDeg - adjArrowHeight);
+ adj4.setVal(startAngle * radToDeg);
+ } else {
+ adj3.setVal(startAngle * radToDeg + adjArrowHeight);
+ adj4.setVal(endAngle * radToDeg);
+ }
+ adj5.setVal(adjArrowWidth);
+ customAdjLst.addToLst(0, adj1);
+ customAdjLst.addToLst(0, adj2);
+ customAdjLst.addToLst(0, adj3);
+ customAdjLst.addToLst(0, adj4);
+ customAdjLst.addToLst(0, adj5);
+ connectorShape.customAdj = customAdjLst;
+
+ const centerPoint = this.getCenterPoint();
+ const truthRadius = truthSide / 2;
+ connectorShape.width = truthSide;
+ connectorShape.height = truthSide;
+ connectorShape.x = centerPoint.x - truthRadius;
+ connectorShape.y = centerPoint.y - truthRadius;
+ const shape = this.parentNode.getShape();
+ shape.connectorShape = connectorShape;
+ };
+ ConnectorAlgorithm.prototype.createCurveShapeConnector = function (smartartAlgorithm, startPoint, endPoint) {
+ const centerPoint = this.getCenterPoint();
+ const startVector = centerPoint.getVector(startPoint);
+ const endVector = centerPoint.getVector(endPoint);
+ let startAngle = startVector.getAngle();
+ let endAngle = endVector.getAngle();
+ const isClockwise = this.isClockwise();
+ if (fAlgDeltaEqual(startAngle, endAngle)) {
+ endAngle = startAngle + 0.000001;
+ } else if (isClockwise === this.isLongCurve()) {
+ const temp = startAngle;
+ startAngle = endAngle;
+ endAngle = temp;
+ }
+ const radius = startVector.getDistance();
+ switch (this.getConnectorShapeType()) {
+ case AscFormat.LayoutShapeType_shapeType_blockArc:
+ this.createBlockArcCurveShapeConnector(startAngle, endAngle, radius);
+ break;
+ case AscFormat.LayoutShapeType_shapeType_circularArrow:
+ case AscFormat.LayoutShapeType_shapeType_leftCircularArrow:
+ this.createCircularArrowCurveShapeConnector(startAngle, endAngle, radius);
+ break;
+ default:
+ break;
+ }
+
+ const shape = this.parentNode.getShape();
+ const connectorShape = shape.connectorShape;
+ if (connectorShape) {
+ const coefficient = connectorShape.width / shape.cleanParams.width;
+ const heightScale = this.parentNode.getHeightScale(true);
+ const widthScale = this.parentNode.getWidthScale(true);
+ const newWidth = connectorShape.width * widthScale;
+ const newHeight = connectorShape.height * heightScale;
+ connectorShape.x += (connectorShape.width - newWidth) / 2;
+ connectorShape.y += (connectorShape.height - newHeight) / 2;
+ connectorShape.width = newWidth;
+ connectorShape.height = newHeight;
+ this.applyPostAlgorithmSettingsForShape(smartartAlgorithm, connectorShape, coefficient);
+ }
+ };
+ ConnectorAlgorithm.prototype.createStraightShapeConnector = function (smartartAlgorithm, startPoint, endPoint) {
+ const cx = (startPoint.x + endPoint.x) / 2;
+ const cy = (startPoint.y + endPoint.y) / 2;
+
+ const arrowVector = new CVector(endPoint.x - startPoint.x, endPoint.y - startPoint.y);
+
+ let width;
+ const connectionDistanceResolver = this.parentAlgorithm.parentNode.connectionDistanceResolver;
+ const minConnectionDistance = connectionDistanceResolver && connectionDistanceResolver.getConnectionDistance();
+ if (connectionDistanceResolver && minConnectionDistance !== -1) {
+ width = minConnectionDistance;
+ } else {
+ width = arrowVector.getDistance();
+ }
+ const constrObj = this.parentNode.getConstraints(true);
+ const height = constrObj[AscFormat.Constr_type_hArH] !== undefined ? constrObj[AscFormat.Constr_type_hArH] : this.parentNode.shape.height;
+
+ const x = cx - width / 2;
+ const y = cy - height / 2;
+ const shape = this.parentNode.getShape();
+ const connectorShape = this.getTemplateConnectorShape();
+ connectorShape.customAdj = this.getStraightAdjLst(connectorShape.type);
+
+ connectorShape.x = x;
+ connectorShape.y = y;
+ connectorShape.rot = arrowVector.getAngle();
+ shape.connectorShape = connectorShape;
+
+ const prSet = this.parentNode.getPrSet();
+ if (!prSet.getPresStyleLbl()) {
+ prSet.setPresStyleLbl("sibTrans2D1");
+ }
+ const coefficient = width / shape.cleanParams.width;
+ this.applyPostAlgorithmSettings(smartartAlgorithm, connectorShape, coefficient);
+
+ const heightScale = this.parentNode.getHeightScale(true);
+ const widthScale = this.parentNode.getWidthScale(true);
+ const scaleHeight = height * heightScale;
+ const scaleWidth = width * widthScale;
+ connectorShape.height = scaleHeight;
+ connectorShape.width = scaleWidth;
+ connectorShape.x += (width - scaleWidth) / 2;
+ connectorShape.y += (height - scaleHeight) / 2;
+ };
+ ConnectorAlgorithm.prototype.createShapeConnector = function (smartartAlgorithm) {
+ const connectionPoints = this.getConnectionPoints();
+ const startArrowPoint = connectionPoints.start;
+ const endArrowPoint = connectionPoints.end;
+ if (startArrowPoint && endArrowPoint) {
+ switch (this.params[AscFormat.Param_type_connRout]) {
+ case AscFormat.ParameterVal_connectorRouting_longCurve:
+ case AscFormat.ParameterVal_connectorRouting_curve:
+ this.createCurveShapeConnector(smartartAlgorithm, startArrowPoint, endArrowPoint);
+ break;
+ default:
+ this.createStraightShapeConnector(smartartAlgorithm, startArrowPoint, endArrowPoint);
+ break;
+ }
+ }
+ };
+
+ ConnectorAlgorithm.prototype.createLineConnector = function () {
+ const points = this.getConnectionPoints();
+ if (points.start && points.end) {
+ switch (this.params[AscFormat.Param_type_connRout]) {
+ case AscFormat.ParameterVal_connectorRouting_stra:
+ this.createStraightLineConnector(points.start, points.end);
+ break;
+ case AscFormat.ParameterVal_connectorRouting_bend:
+ this.createBendLineConnector(points.start, points.end);
+ break;
+ case AscFormat.ParameterVal_connectorRouting_curve:
+ this.createCurveLineConnector(points.start, points.end);
+ break;
+ default:
+ break;
+ }
+ }
+ };
+ ConnectorAlgorithm.prototype.getStraightConnectionInfo = function (startPoint, endPoint) {
+ const cx = (startPoint.x + endPoint.x) / 2;
+ const cy = (startPoint.y + endPoint.y) / 2;
+
+ const arrowVector = new CVector(endPoint.x - startPoint.x, endPoint.y - startPoint.y);
+
+ let width;
+ const connectionDistanceResolver = this.parentAlgorithm.parentNode.connectionDistanceResolver;
+ const minConnectionDistance = connectionDistanceResolver && connectionDistanceResolver.getConnectionDistance();
+ if (connectionDistanceResolver && minConnectionDistance !== -1) {
+ width = minConnectionDistance;
+ } else {
+ width = arrowVector.getDistance();
+ }
+ const shape = this.parentNode.shape;
+ const height = shape.height;
+
+ const x = cx - width / 2;
+ const y = cy - height / 2;
+
+ const coefficient = width / shape.cleanParams.width;
+
+ const heightScale = this.parentNode.getHeightScale(true);
+ const widthScale = this.parentNode.getWidthScale(true);
+ const scaleHeight = height * heightScale;
+ const scaleWidth = width * widthScale;
+
+ return {
+ x: x,
+ y: y,
+ width: scaleWidth,
+ height: scaleHeight,
+ offX: (width - scaleWidth) / 2,
+ offY: (height - scaleHeight) / 2,
+ rot: arrowVector.getAngle(),
+ coefficient: coefficient
+ }
+ }
+ ConnectorAlgorithm.prototype.isDoubleBendHorizontalConnector = function() {
+ const startPoint = this.getPointPosition(true);
+ const endPoint = this.getPointPosition();
+ return startPoint === AscFormat.ParameterVal_connectorPoint_midR && endPoint === AscFormat.ParameterVal_connectorPoint_midL ||
+ startPoint === AscFormat.ParameterVal_connectorPoint_midL && endPoint === AscFormat.ParameterVal_connectorPoint_midR;
+ };
+ ConnectorAlgorithm.prototype.isDoubleBendVerticalConnector = function() {
+ const startPoint = this.getPointPosition(true);
+ const endPoint = this.getPointPosition();
+ return startPoint === AscFormat.ParameterVal_connectorPoint_bCtr && endPoint === AscFormat.ParameterVal_connectorPoint_tCtr ||
+ startPoint === AscFormat.ParameterVal_connectorPoint_tCtr && endPoint === AscFormat.ParameterVal_connectorPoint_bCtr;
+ };
+ ConnectorAlgorithm.prototype.isWrongBendPoints = function (startPoint, endPoint) {
+ const endPointPosition = this.getPointPosition();
+ const startPointPosition = this.getPointPosition(true);
+ switch (endPointPosition) {
+ case AscFormat.ParameterVal_connectorPoint_tCtr:
+ if ((endPoint.y <= startPoint.y) ||
+ (startPointPosition === AscFormat.ParameterVal_connectorPoint_midR && endPoint.x <= startPoint.x) ||
+ (startPointPosition === AscFormat.ParameterVal_connectorPoint_midL && endPoint.x >= startPoint.x)) {
+ return true;
+ }
+ break;
+ case AscFormat.ParameterVal_connectorPoint_bCtr:
+ if ((endPoint.y >= startPoint.y) ||
+ (startPointPosition === AscFormat.ParameterVal_connectorPoint_midR && endPoint.x <= startPoint.x) ||
+ (startPointPosition === AscFormat.ParameterVal_connectorPoint_midL && endPoint.x >= startPoint.x)) {
+ return true;
+ }
+ break;
+ case AscFormat.ParameterVal_connectorPoint_midR:
+ case AscFormat.ParameterVal_connectorPoint_bR:
+ if ((endPoint.x >= startPoint.x) ||
+ ((startPointPosition === AscFormat.ParameterVal_connectorPoint_bCtr ||
+ startPointPosition === AscFormat.ParameterVal_connectorPoint_tCtr) && endPoint.y <= startPoint.y)) {
+ return true;
+ }
+ break;
+ case AscFormat.ParameterVal_connectorPoint_midL:
+ case AscFormat.ParameterVal_connectorPoint_bL:
+ if ((endPoint.x <= startPoint.x) ||
+ ((startPointPosition === AscFormat.ParameterVal_connectorPoint_bCtr ||
+ startPointPosition === AscFormat.ParameterVal_connectorPoint_tCtr) && endPoint.y <= startPoint.y)) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ };
+ ConnectorAlgorithm.prototype.getBendPoints = function (startPoint, endPoint) {
+ if (this.isWrongBendPoints(startPoint, endPoint)) {
+ return [];
+ }
+ const isReverse = this.params[AscFormat.Param_type_bendPt] === AscFormat.ParameterVal_bendPoint_end;
+ const edgePoints = this.getEdgePoints();
+ let startEdgePoint = edgePoints.start;
+ let endEdgePoint = edgePoints.end;
+ if (isReverse) {
+ const t = startPoint;
+ startPoint = endPoint;
+ endPoint = t;
+ startEdgePoint = edgePoints.end;
+ endEdgePoint = edgePoints.start;
+ }
+ let bendDist;
+ if (this.isDoubleBendHorizontalConnector()) {
+ bendDist = this.parentNode.adaptConstr[AscFormat.Constr_type_bendDist];
+ if (bendDist === undefined) {
+ bendDist = Math.abs(startEdgePoint.x - endEdgePoint.x) / 2;
+ }
+ } else if (this.isDoubleBendVerticalConnector()) {
+ bendDist = this.parentNode.adaptConstr[AscFormat.Constr_type_bendDist];
+ if (bendDist === undefined) {
+ bendDist = Math.abs(startEdgePoint.y - endEdgePoint.y) / 2;
+ }
+ }
+ const type = this.getPointPosition(!isReverse);
+ let bendPoints;
+ switch (type) {
+ case AscFormat.ParameterVal_connectorPoint_auto:
+ break;
+ case AscFormat.ParameterVal_connectorPoint_bCtr: {
+ if (bendDist === undefined) {
+ bendPoints = [new CCoordPoint(startPoint.x, endPoint.y)];
+ } else {
+ let y = Math.min(endPoint.y, startEdgePoint.y + bendDist);
+ bendPoints = [new CCoordPoint(startEdgePoint.x, y), new CCoordPoint(endEdgePoint.x, y)];
+ }
+ break;
+ }
+ case AscFormat.ParameterVal_connectorPoint_ctr:
+ break;
+ case AscFormat.ParameterVal_connectorPoint_bL:
+ case AscFormat.ParameterVal_connectorPoint_midL: {
+ if (bendDist === undefined) {
+ bendPoints = [new CCoordPoint(endPoint.x, startPoint.y)];
+ } else {
+ let x = Math.max(endPoint.x, startEdgePoint.x - bendDist);
+ bendPoints = [new CCoordPoint(x, startEdgePoint.y), new CCoordPoint(x, endEdgePoint.y)];
+ }
+ break;
+ }
+ case AscFormat.ParameterVal_connectorPoint_bR:
+ case AscFormat.ParameterVal_connectorPoint_midR: {
+ if (bendDist === undefined) {
+ bendPoints = [new CCoordPoint(endPoint.x, startPoint.y)];
+ } else {
+ let x = Math.min(endPoint.x, startEdgePoint.x + bendDist);
+ bendPoints = [new CCoordPoint(x, startEdgePoint.y), new CCoordPoint(x, endEdgePoint.y)];
+ }
+ break;
+ }
+ case AscFormat.ParameterVal_connectorPoint_radial:
+ break;
+ case AscFormat.ParameterVal_connectorPoint_tCtr: {
+ if (bendDist === undefined) {
+ bendPoints = [new CCoordPoint(startPoint.x, endPoint.y)];
+ } else {
+ let y = Math.max(endPoint.y, startEdgePoint.y - bendDist);
+ bendPoints = [new CCoordPoint(startEdgePoint.x, y), new CCoordPoint(endEdgePoint.x, y)];
+ }
+ break;
+ }
+ case AscFormat.ParameterVal_connectorPoint_tL:
+ break;
+ case AscFormat.ParameterVal_connectorPoint_tR:
+ break;
+ default:
+ break;
+ }
+ if (bendPoints) {
+ return isReverse ? bendPoints.reverse() : bendPoints;
+ }
+ };
+ ConnectorAlgorithm.prototype.getStartBendPoint = function (startPoint, endPoint) {
+
+ };
+ ConnectorAlgorithm.prototype.getEndBendPoint = function (startPoint, endPoint) {
+
+ };
+ ConnectorAlgorithm.prototype.getBendConnectionInfo = function (startPoint, endPoint) {
+ const x = endPoint.x < startPoint.x ? endPoint.x : startPoint.x;
+ const y = endPoint.y < startPoint.y ? endPoint.y : startPoint.y;
+ const width = Math.abs(endPoint.x - startPoint.x);
+ const height = Math.abs(endPoint.y - startPoint.y);
+ const bendPoints = this.getBendPoints(startPoint, endPoint);
+ return {
+ x: x,
+ y: y,
+ width: width,
+ height: height,
+ bendPoints: bendPoints
+ };
+ }
+ ConnectorAlgorithm.prototype.createBendLineConnector = function (startPoint, endPoint) {
+ const shape = this.parentNode.getShape(false);
+ shape.height = 0;
+ const info = this.getBendConnectionInfo(startPoint, endPoint);
+ const connectorShape = this.getTemplateConnectorLine();
+
+ connectorShape.x = info.x;
+ connectorShape.y = info.y;
+ connectorShape.width = info.width;
+ connectorShape.height = info.height;
+
+ shape.connectorShape = connectorShape;
+
+ const prSet = this.parentNode.getPrSet();
+ if (!prSet.getPresStyleLbl()) {
+ prSet.setPresStyleLbl("parChTrans1D2");
+ }
+
+ const bendPoints = info.bendPoints;
+ const localEndPoint = new CCoordPoint(endPoint.x - connectorShape.x, endPoint.y - connectorShape.y);
+ const localStartPoint = new CCoordPoint(startPoint.x - connectorShape.x, startPoint.y - connectorShape.y);
+ if (bendPoints) {
+ connectorShape.customGeom.push([0]);
+ connectorShape.customGeom.push([1, localStartPoint.x * 36000, localStartPoint.y * 36000]);
+ for (let i = 0; i < bendPoints.length; i++) {
+ const bendPoint = bendPoints[i];
+ const localBendPoint = new CCoordPoint(bendPoint.x - connectorShape.x, bendPoint.y - connectorShape.y);
+ connectorShape.customGeom.push([2, localBendPoint.x * 36000, localBendPoint.y * 36000]);
+ }
+ connectorShape.customGeom.push([2, localEndPoint.x * 36000, localEndPoint.y * 36000]);
+
+ } else {
+ connectorShape.customGeom.push([0]);
+ connectorShape.customGeom.push([1, localStartPoint.x * 36000, localStartPoint.y * 36000]);
+ connectorShape.customGeom.push([2, localEndPoint.x * 36000, localEndPoint.y * 36000]);
+ }
+ };
+ ConnectorAlgorithm.prototype.createCurveLineConnector = function (startPoint, endPoint) {
+ const centerPoint = this.calcValues.radiusCenterPoint;
+ if (centerPoint) {
+ const shape = this.parentNode.getShape();
+ const prSet = this.parentNode.getPrSet();
+ if (!prSet.getPresStyleLbl()) {
+ prSet.setPresStyleLbl("sibTrans1D1");
+ }
+ const startVector = centerPoint.getVector(startPoint);
+ const endVector = centerPoint.getVector(endPoint);
+
+ const radius = startVector.getDistance();
+ const side = radius * 2;
+
+ const isClockwise = this.isClockwise();
+ const swAngle = isClockwise ? startVector.getAngleBetween(endVector) : -startVector.getAngleBetween(endVector, true);
+
+ const connectorShape = this.getTemplateConnectorLine();
+ connectorShape.width = side;
+ connectorShape.height = side;
+ connectorShape.x = centerPoint.x - radius;
+ connectorShape.y = centerPoint.y - radius;
+
+ shape.connectorShape = connectorShape;
+
+
+ connectorShape.customGeom.push([0]);
+ connectorShape.customGeom.push([1, (startPoint.x - connectorShape.x) * 36000, (startPoint.y - connectorShape.y) * 36000]);
+ const startAngle = startVector.getAngle();
+ connectorShape.customGeom.push([3, radius * 36000, radius * 36000, startAngle * radToDeg * 60000, swAngle * radToDeg * 60000]);
+ }
+ };
+ ConnectorAlgorithm.prototype.createStraightLineConnector = function (startPoint, endPoint) {
+ const shape = this.parentNode.shape;
+ shape.height = 0;
+ const info = this.getStraightConnectionInfo(startPoint, endPoint);
+ const connectorShape = this.getTemplateConnectorLine();
+
+ connectorShape.x = info.x;
+ connectorShape.y = info.y;
+ connectorShape.rot = info.rot;
+
+ shape.connectorShape = connectorShape;
+
+ const prSet = this.parentNode.getPrSet();
+ if (!prSet.getPresStyleLbl()) {
+ prSet.setPresStyleLbl("parChTrans1D2");
+ }
+
+ connectorShape.height = info.height;
+ connectorShape.width = info.width;
+ connectorShape.x += info.offX;
+ connectorShape.y += info.offY;
+
+ connectorShape.customGeom.push([0]);
+ connectorShape.customGeom.push([1, 0, 0]);
+ connectorShape.customGeom.push([2, connectorShape.width * 36000, 0]);
+ connectorShape.customGeom.push([6]);
+ };
+ ConnectorAlgorithm.prototype.getTemplateConnectorLine = function () {
+ const shape = this.parentNode.shape;
+ const connectorShape = new ShadowShape();
+ connectorShape.shape = shape.shape;
+
+ connectorShape.type = AscFormat.LayoutShapeType_outputShapeType_conn;
+ connectorShape.cleanParams = {};
+ connectorShape.cleanParams.width = shape.cleanParams.width;
+ connectorShape.cleanParams.height = shape.cleanParams.height;
+ connectorShape.cleanParams.x = shape.cleanParams.x;
+ connectorShape.cleanParams.y = shape.cleanParams.y;
+ connectorShape.node = this.parentNode;
+ if (this.params[AscFormat.Param_type_endSty] === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ const endArrow = new AscFormat.EndArrow();
+ endArrow.type = AscFormat.LineEndType.Arrow;
+ connectorShape.tailLnArrow = endArrow;
+ }
+ if (this.params[AscFormat.Param_type_begSty] === AscFormat.ParameterVal_arrowheadStyle_arr) {
+ const endArrow = new AscFormat.EndArrow();
+ endArrow.type = AscFormat.LineEndType.Arrow;
+ connectorShape.headLnArrow = endArrow;
+ }
+ return connectorShape;
+ }
+
+ function SpaceAlgorithm() {
+ BaseAlgorithm.call(this);
+ }
+ AscFormat.InitClassWithoutType(SpaceAlgorithm, BaseAlgorithm);
+
+ SpaceAlgorithm.prototype.applyTextSettings = function (editorShape) {
+ const node = this.parentNode.node;
+ const textNodes = node.getTextNodes();
+
+ const textNode = textNodes.textNode;
+ if (textNode && textNodes.contentNode === this.parentNode) {
+ textNodes.textNode.algorithm.applyTextSettings(editorShape, this.parentNode.getShape());
+ }
+ };
+ SpaceAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ this.createShadowShape(isCalculateScaleCoefficients);
+ if (!isCalculateScaleCoefficients) {
+ this.applyPostAlgorithmSettings(smartartAlgorithm);
+ }
+ }
+ SpaceAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(false, isCalculateScaleCoefficients);
+ };
+ function TextAlgorithm() {
+ BaseAlgorithm.call(this);
+ }
+
+ AscFormat.InitClassWithoutType(TextAlgorithm, BaseAlgorithm);
+ TextAlgorithm.prototype.initParams = function (params) {
+ BaseAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_parTxLTRAlign] === undefined) {
+ this.params[AscFormat.Param_type_parTxLTRAlign] = AscFormat.ParameterVal_horizontalAlignment_ctr;
+ }
+ if (this.params[AscFormat.Param_type_parTxRTLAlign] === undefined) {
+ this.params[AscFormat.Param_type_parTxRTLAlign] = AscFormat.ParameterVal_horizontalAlignment_ctr;
+ }
+ if (this.params[AscFormat.Param_type_shpTxLTRAlignCh] === undefined) {
+ this.params[AscFormat.Param_type_shpTxLTRAlignCh] = AscFormat.ParameterVal_horizontalAlignment_l;
+ }
+ if (this.params[AscFormat.Param_type_shpTxRTLAlignCh] === undefined) {
+ this.params[AscFormat.Param_type_shpTxRTLAlignCh] = AscFormat.ParameterVal_horizontalAlignment_r;
+ }
+ if (this.params[AscFormat.Param_type_txAnchorVert] === undefined) {
+ this.params[AscFormat.Param_type_txAnchorVert] = AscFormat.ParameterVal_textAnchorVertical_mid;
+ }
+ if (this.params[AscFormat.Param_type_txAnchorVertCh] === undefined) {
+ this.params[AscFormat.Param_type_txAnchorVertCh] = AscFormat.ParameterVal_textAnchorVertical_t;
+ }
+ if (this.params[AscFormat.Param_type_autoTxRot] === undefined) {
+ this.params[AscFormat.Param_type_autoTxRot] = AscFormat.ParameterVal_autoTextRotation_upr;
+ }
+ if (this.params[AscFormat.Param_type_stBulletLvl] === undefined) {
+ this.params[AscFormat.Param_type_stBulletLvl] = 2;
+ }
+ };
+ TextAlgorithm.prototype.applyContentFilling = function (editorShape) {
+ const shapeSmartArtInfo = editorShape.getSmartArtInfo();
+ const contentNodes = shapeSmartArtInfo.contentPoint;
+ if (!contentNodes.length) {
+ return;
+ }
+
+
+ const stBulletLvl = this.params[AscFormat.Param_type_stBulletLvl];
+ editorShape.createTextBody();
+ const shapeContent = editorShape.txBody.content;
+
+ const arrParagraphs = [];
+ let nBulletLevel = 0;
+
+ const startDepth = contentNodes[0].depth;
+ for (let i = 0; i < contentNodes.length; i += 1) {
+ const contentNode = contentNodes[i];
+ const mainPoint = contentNode.point;
+ const deltaDepth = contentNode.depth - startDepth;
+ if (contentNode.point) {
+ const dataContent = mainPoint.t && mainPoint.t.content;
+ if (dataContent) {
+ const firstParagraph = dataContent.Content[0];
+ if (firstParagraph) {
+ const copyParagraph = firstParagraph.Copy(shapeContent, shapeContent.DrawingDocument);
+ if (stBulletLvl === 1 || stBulletLvl === 2 && deltaDepth > 0) {
+ const oBullet = AscFormat.fGetPresentationBulletByNumInfo({Type: 0, SubType: 0});
+ oBullet.bulletTypeface.type = AscFormat.BULLET_TYPE_TYPEFACE_TX;
+
+ copyParagraph.Add_PresentationNumbering(oBullet);
+ copyParagraph.Set_PresentationLevel(nBulletLevel);
+ nBulletLevel = Math.min(nBulletLevel + 1, 8);
+ copyParagraph.Set_Ind({FirstLine: -7.9}, false);
+ }
+ copyParagraph.Set_Spacing({Line : 0.9, LineRule : Asc.linerule_Auto}, false);
+ arrParagraphs.push(copyParagraph);
+ for (let j = 1; j < dataContent.Content.length; j += 1) {
+ const paragraph = dataContent.Content[j];
+ const copyCurrentParagraph = paragraph.Copy();
+ if (copyParagraph.Pr.Ind) {
+ copyCurrentParagraph.Set_Ind({Left: copyParagraph.Pr.Ind.Left}, false);
+
+ }
+ if (copyParagraph.Pr.Spacing) {
+ copyCurrentParagraph.Set_Spacing(copyParagraph.Pr.Spacing, false);
+ }
+ arrParagraphs.push(copyCurrentParagraph);
+ }
+ }
+ }
+ }
+ }
+ if (arrParagraphs.length) {
+ shapeContent.Internal_Content_RemoveAll();
+ for (let i = 0; i < arrParagraphs.length; i++) {
+ shapeContent.AddToContent(shapeContent.Content.length, arrParagraphs[i]);
+ }
+ }
+ };
+ TextAlgorithm.prototype.applyDataBodyPr = function (editorShape) {
+ const node = this.parentNode;
+ const contentNode = node.contentNodes[0];
+ const bodyPr = contentNode.point.t && contentNode.point.t.bodyPr;
+ if (bodyPr) {
+ const copyBodyPr = bodyPr.createDuplicate();
+ editorShape.txBody.setBodyPr(copyBodyPr);
+ }
+ };
+ TextAlgorithm.prototype.applyTextSettings = function (editorShape, contentShadowShape) {
+ if (!contentShadowShape && this.parentNode.isTxXfrm()) {
+ return;
+ }
+ const smartArtInfo = editorShape.getSmartArtInfo();
+ this.applyFontRelations(editorShape);
+ this.applyContentFilling(editorShape);
+ if (smartArtInfo.contentPoint.length) {
+ this.applyTxXfrmSettings(editorShape, contentShadowShape);
+ this.applyDataBodyPr(editorShape);
+ this.applyTextMargins(editorShape);
+ this.applyHorizontalAlignment(editorShape);
+ this.applyVerticalAlignment(editorShape);
+ if (!editorShape.isCanFitFontSize()) {
+ editorShape.applyCustTSettings();
+ }
+ }
+ };
+ TextAlgorithm.prototype.getTextRotate = function () {
+ const shadowShape = this.parentNode.getShape();
+ const shapeRotate = shadowShape.rot;
+ switch (this.params[AscFormat.Param_type_autoTxRot]) {
+ case AscFormat.ParameterVal_autoTextRotation_none:
+ return 0;
+ case AscFormat.ParameterVal_autoTextRotation_grav:
+ if ((shapeRotate > Math.PI / 2) && (shapeRotate < Math.PI * 3 / 2)) {
+ return Math.PI;
+ }
+ return 0;
+ case AscFormat.ParameterVal_autoTextRotation_upr:
+ default:
+ let rot = 0;
+ if (shapeRotate > Math.PI / 4) {
+ rot -= Math.PI / 2;
+ }
+ if (shapeRotate >= Math.PI * 3 / 4) {
+ rot -= Math.PI / 2;
+ }
+ if (shapeRotate > Math.PI * 5 / 4) {
+ rot -= Math.PI / 2;
+ }
+ if (shapeRotate >= Math.PI * 7 / 4) {
+ rot -= Math.PI / 2;
+ }
+ return AscFormat.normalizeRotate(rot);
+ }
+ };
+ TextAlgorithm.prototype.applyTxXfrmSettings = function (editorShape, contentShadowShape) {
+ const shadowShape = this.parentNode.getShape();
+ const txXfrm = new AscFormat.CXfrm();
+ const autoRot = this.getTextRotate();
+ let geometry = editorShape.spPr.geometry;
+ if (contentShadowShape) {
+ geometry = AscFormat.ExecuteNoHistory(function(){return AscFormat.CreateGeometry(shadowShape.getEditorShapeType());}, this, []);
+ shadowShape.applyAdjLst(geometry);
+ }
+ geometry.Recalculate(shadowShape.width, shadowShape.height);
+ const geometryRect = geometry.rect;
+ let extX;
+ let extY;
+ let offX;
+ let offY;
+ if (geometryRect) {
+ offX = geometryRect.l + shadowShape.x;
+ offY = geometryRect.t + shadowShape.y;
+ extX = geometryRect.r - geometryRect.l;
+ extY = geometryRect.b - geometryRect.t;
+ } else {
+ offX = shadowShape.x;
+ offY = shadowShape.y;
+ extX = shadowShape.width;
+ extY = shadowShape.height;
+ }
+ const shapeMatrix = shadowShape.getReverseMatrix();
+ const cx = shapeMatrix.TransformPointX(offX + extX / 2, offY + extY / 2);
+ const cy = shapeMatrix.TransformPointY(offX + extX / 2, offY + extY / 2);
+ offX = cx - extX / 2;
+ offY = cy - extY / 2;
+
+ const newSizes = AscFormat.fGetMaxInscribedRectangle(extX, extY, autoRot);
+ offX += (extX - newSizes.width) / 2;
+ offY += (extY - newSizes.height) / 2;
+ txXfrm.setOffX(offX);
+ txXfrm.setOffY(offY);
+ txXfrm.setExtX(newSizes.width);
+ txXfrm.setExtY(newSizes.height);
+ const contentShadowShapeRot = contentShadowShape ? (shadowShape.rot - contentShadowShape.rot) : 0;
+ txXfrm.setRot(AscFormat.normalizeRotate(autoRot + contentShadowShapeRot));
+
+ editorShape.setTxXfrm(txXfrm);
+ };
+ TextAlgorithm.prototype.initDefaultMarginScales = function () {
+ const node = this.parentNode;
+
+ if (node.textConstraints[AscFormat.Constr_type_bMarg] === undefined) {
+ const bMarg = node.getConstr(AscFormat.Constr_type_bMarg, true, true);
+ if (bMarg === undefined) {
+ node.textConstraints[AscFormat.Constr_type_bMarg] = 0.56;
+ }
+ }
+ if (node.textConstraints[AscFormat.Constr_type_tMarg] === undefined) {
+ const tMarg = node.getConstr(AscFormat.Constr_type_tMarg, true, true);
+ if (tMarg === undefined) {
+ node.textConstraints[AscFormat.Constr_type_tMarg] = 0.56;
+ }
+ }
+
+ if (node.textConstraints[AscFormat.Constr_type_rMarg] === undefined) {
+ const rMarg = node.getConstr(AscFormat.Constr_type_rMarg, true, true);
+ if (rMarg === undefined) {
+ node.textConstraints[AscFormat.Constr_type_rMarg] = 0.56;
+ }
+ }
+
+ if (node.textConstraints[AscFormat.Constr_type_lMarg] === undefined) {
+ const lMarg = node.getConstr(AscFormat.Constr_type_lMarg, true, true);
+ if (lMarg === undefined) {
+ node.textConstraints[AscFormat.Constr_type_lMarg] = 0.56;
+ }
+ }
+ };
+ TextAlgorithm.prototype.applyFontRelations = function (editorShape) {
+ const node = this.parentNode;
+ this.initDefaultMarginScales();
+
+ const shapeSmartArtInfo = editorShape.getSmartArtInfo();
+ shapeSmartArtInfo.textConstraintRelations = node.textConstraintRelations;
+ shapeSmartArtInfo.textConstraints = node.textConstraints;
+ shapeSmartArtInfo.params[AscFormat.Param_type_lnSpAfParP] = this.params[AscFormat.Param_type_lnSpAfParP];
+ shapeSmartArtInfo.params[AscFormat.Param_type_lnSpAfChP] = this.params[AscFormat.Param_type_lnSpAfChP];
+ };
+ TextAlgorithm.prototype.applyTextMargins = function (editorShape) {
+ const node = this.parentNode;
+ const paddings = {};
+ const isApplyInsets = node.contentNodes[0].point.isRecalculateInsets();
+ if (isApplyInsets.Bottom && node.textConstraints[AscFormat.Constr_type_bMarg] === undefined) {
+ paddings.Bottom = node.getConstr(AscFormat.Constr_type_bMarg, true) * g_dKoef_pt_to_mm;
+ }
+
+ if (isApplyInsets.Top && node.textConstraints[AscFormat.Constr_type_tMarg] === undefined) {
+ paddings.Top = node.getConstr(AscFormat.Constr_type_tMarg, true) * g_dKoef_pt_to_mm;
+ }
+
+ if (isApplyInsets.Right && node.textConstraints[AscFormat.Constr_type_rMarg] === undefined) {
+ paddings.Right = node.getConstr(AscFormat.Constr_type_rMarg, true) * g_dKoef_pt_to_mm;
+ }
+
+ if (isApplyInsets.Left && node.textConstraints[AscFormat.Constr_type_lMarg] === undefined) {
+ paddings.Left = node.getConstr(AscFormat.Constr_type_lMarg, true) * g_dKoef_pt_to_mm;
+ }
+
+ editorShape.setPaddings(paddings, {bNotCopyToPoints: true});
+ };
+ function isParentWithChildren(nodes) {
+ if (nodes.length) {
+ const startDepth = nodes[0].depth;
+ for (let i = 1; i < nodes.length; i += 1) {
+ if (nodes[i].depth - startDepth > 0) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ TextAlgorithm.prototype.applyVerticalAlignment = function (editorShape) {
+ const node = this.parentNode;
+ const bodyPr = editorShape.getBodyPr().createDuplicate();
+ const stBulletLvl = this.params[AscFormat.Param_type_stBulletLvl];
+ const firstNodeBodyPr = node.contentNodes[0].point.t.bodyPr;
+ if (firstNodeBodyPr && typeof firstNodeBodyPr.anchor === "number") {
+ bodyPr.setAnchor(firstNodeBodyPr.anchor);
+ } else if (isParentWithChildren(node.contentNodes) || stBulletLvl === 1) {
+ switch (this.params[AscFormat.Param_type_txAnchorVertCh]) {
+ case AscFormat.ParameterVal_textAnchorVertical_b:
+ bodyPr.setAnchor(AscFormat.VERTICAL_ANCHOR_TYPE_BOTTOM);
+ break;
+ case AscFormat.ParameterVal_textAnchorVertical_mid:
+ bodyPr.setAnchor(AscFormat.VERTICAL_ANCHOR_TYPE_CENTER);
+ break;
+ case AscFormat.ParameterVal_textAnchorVertical_t:
+ default:
+ bodyPr.setAnchor(AscFormat.VERTICAL_ANCHOR_TYPE_TOP);
+ break;
+ }
+ } else {
+ switch (this.params[AscFormat.Param_type_txAnchorVert]) {
+ case AscFormat.ParameterVal_textAnchorVertical_b:
+ bodyPr.setAnchor(AscFormat.VERTICAL_ANCHOR_TYPE_BOTTOM);
+ break;
+ case AscFormat.ParameterVal_textAnchorVertical_t:
+ bodyPr.setAnchor(AscFormat.VERTICAL_ANCHOR_TYPE_TOP);
+ break;
+ case AscFormat.ParameterVal_textAnchorVertical_mid:
+ default:
+ bodyPr.setAnchor(AscFormat.VERTICAL_ANCHOR_TYPE_CENTER);
+ break;
+ }
+ }
+ editorShape.txBody.setBodyPr(bodyPr);
+ };
+ TextAlgorithm.prototype.getTextAlignment = function (paramType) {
+ switch (this.params[paramType]) {
+ case AscFormat.ParameterVal_horizontalAlignment_l:
+ return AscCommon.align_Left;
+ case AscFormat.ParameterVal_horizontalAlignment_r:
+ return AscCommon.align_Right;
+ case AscFormat.ParameterVal_horizontalAlignment_ctr:
+ default:
+ return AscCommon.align_Center;
+ }
+ };
+ TextAlgorithm.prototype.applyHorizontalAlignment = function (editorShape) {
+ const drawingContent = editorShape.txBody.content;
+ const node = this.parentNode;
+ let paragraphLTRAlignment;
+ let paragraphRTLAlignment;
+ let isCtrHorzAlign;
+ const stBulletLvl = this.params[AscFormat.Param_type_stBulletLvl];
+ if (isParentWithChildren(node.contentNodes) || stBulletLvl === 1) {
+ paragraphLTRAlignment = this.getTextAlignment(AscFormat.Param_type_shpTxLTRAlignCh);
+ paragraphRTLAlignment = this.getTextAlignment(AscFormat.Param_type_shpTxRTLAlignCh);
+ isCtrHorzAlign = !!this.params[AscFormat.Param_type_txAnchorHorzCh];
+ } else {
+ paragraphLTRAlignment = this.getTextAlignment(AscFormat.Param_type_parTxLTRAlign);
+ paragraphRTLAlignment = this.getTextAlignment(AscFormat.Param_type_parTxRTLAlign);
+ isCtrHorzAlign = !!this.params[AscFormat.Param_type_txAnchorHorz];
+ }
+ let skipSettingAlignment = false;
+ for (let i = 0; i < drawingContent.Content.length; i++) {
+ const item = drawingContent.Content[i];
+ if (typeof item.Pr.Jc === "number") {
+ skipSettingAlignment = true;
+ break;
+ }
+ }
+ if (!skipSettingAlignment) {
+ for (let i = 0; i < drawingContent.Content.length; i++) {
+ const item = drawingContent.Content[i];
+ item.SetApplyToAll(true);
+ if (item.isRtlDirection()) {
+ item.SetParagraphAlign(paragraphRTLAlignment);
+ } else {
+ item.SetParagraphAlign(paragraphLTRAlignment);
+ }
+ item.SetApplyToAll(false);
+ }
+ }
+
+ const bodyPr = editorShape.getBodyPr();
+ const firstNodeBodyPr = node.contentNodes[0].point.t.bodyPr;
+ if (firstNodeBodyPr && typeof firstNodeBodyPr.anchorCtr === "boolean") {
+ const copyBodyPr = bodyPr.createDuplicate();
+ bodyPr.anchorCtr = firstNodeBodyPr.anchorCtr;
+ editorShape.txBody.setBodyPr(copyBodyPr);
+ } else if (bodyPr.anchorCtr !== isCtrHorzAlign) {
+ const copyBodyPr = bodyPr.createDuplicate();
+ bodyPr.anchorCtr = isCtrHorzAlign;
+ editorShape.txBody.setBodyPr(copyBodyPr);
+ }
+ };
+
+ TextAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateScaleCoefficient) {
+ this.createShadowShape(isCalculateScaleCoefficient);
+ if (!isCalculateScaleCoefficient) {
+ this.applyPostAlgorithmSettings(smartartAlgorithm);
+ }
+ };
+ TextAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(false, isCalculateScaleCoefficients);
+ };
+
+ function CompositeAlgorithm() {
+ BaseAlgorithm.call(this);
+ }
+ AscFormat.InitClassWithoutType(CompositeAlgorithm, BaseAlgorithm);
+ CompositeAlgorithm.prototype.initParams = function (params) {
+ BaseAlgorithm.prototype.initParams.call(this, params);
+ if (this.params[AscFormat.Param_type_horzAlign] === undefined) {
+ this.params[AscFormat.Param_type_horzAlign] = AscFormat.ParameterVal_horizontalAlignment_ctr;
+ }
+ if (this.params[AscFormat.Param_type_vertAlign] === undefined) {
+ this.params[AscFormat.Param_type_vertAlign] = AscFormat.ParameterVal_verticalAlignment_mid;
+ }
+ };
+
+ CompositeAlgorithm.prototype.createShadowShape = function (isCalculateScaleCoefficients) {
+ return this.parentNode.createShadowShape(true, isCalculateScaleCoefficients);
+ };
+ CompositeAlgorithm.prototype.calculateShapePositions = function (smartartAlgorithm, isCalculateCoefficients) {
+ this.applyAlgorithmAligns(isCalculateCoefficients);
+ if (!isCalculateCoefficients) {
+ this.setConnections();
+ }
+ this.createShadowShape(isCalculateCoefficients);
+ };
+
+function PresNode(presPoint, contentNode) {
+ this.parent = null;
+ this.presPoint = presPoint || null;
+ this.childs = [];
+ this.algorithm = null;
+ this.node = contentNode;
+ this.contentNodes = [];
+ this.layoutInfo = {
+ constrLst: null,
+ ruleLst: null,
+ shape: null
+ };
+
+ this.shape = null;
+ this.moveWithNodes = [];
+
+ this.isHideLastTrans = true;
+ this.connectionDistanceResolver = null;
+ this.bounds = {
+ constraints: null
+ };
+ this.namedNodes = null;
+ this.moveWith = null;
+ this._isTxXfrm = null;
+ this.textConstraints = {};
+ this.textConstraintRelations = [];
+
+ this.cleanRules();
+ this.cleanConstraints();
+ this.cleanScales();
+ this.cleanPosition();
+}
+ PresNode.prototype.cleanPosition = function () {
+ this.position = null;
+ };
+PresNode.prototype.cleanScales = function () {
+ this.moveScaleCoefficients = {
+ width: 1,
+ height: 1
+ };
+ this.moveRot = 0;
+ this.parentScale = {};
+};
+PresNode.prototype.setSizesScale = function (widthCoefficient, heightCoefficient) {
+ const aspectRatio = this.getAspectRatio();
+ if (aspectRatio) {
+ const commonCoefficient = Math.min(widthCoefficient, heightCoefficient);
+ this.setWidthScale(commonCoefficient);
+ this.setHeightScale(commonCoefficient);
+ } else {
+ this.setWidthScale(widthCoefficient);
+ this.setHeightScale(heightCoefficient);
+ }
+};
+ PresNode.prototype.initPresShape = function () {
+ if (!this.layoutInfo.shape) {
+ this.layoutInfo.shape = new AscFormat.SShape();
+ }
+ }
+ PresNode.prototype.getParentScale = function (type) {
+ return this.parentScale[type] === undefined ? 1 : this.parentScale[type];
+ }
+ PresNode.prototype.setParentScale = function (type, value) {
+ if (value < 1 && (this.parentScale[type] === undefined || this.parentScale[type] > value)) {
+ this.parentScale[type] = value;
+ }
+ }
+PresNode.prototype.getDefaultConnectionNode = function() {
+ if (this.childs.length) {
+ return this.childs[0];
+ }
+ return this;
+ };
+ PresNode.prototype.getShape = function (isCalculateCoefficients) {
+ if (isCalculateCoefficients) {
+ if (!this.position) {
+ this.position = new Position(this);
+ }
+ return this.position;
+ }
+ if (!this.shape) {
+ this.shape = new ShadowShape(this);
+ }
+ return this.shape;
+ };
+ PresNode.prototype.getRelationConstr = function (type) {
+ return this.relations[type];
+ }
+ PresNode.prototype.setRelationConstr = function (refNode, constr) {
+ this.relations[constr.type] = {constr: constr, ref: refNode};
+ };
+ PresNode.prototype.setWidthScale = function (pr) {
+ const relation = this.getRelationConstr(AscFormat.Constr_type_w);
+ if (relation) {
+ const relationConstr = relation.constr;
+ const widthRef = relation.ref;
+ const summaryWidthScale = this.getSummaryWidthScale();
+ const newCoef = pr / summaryWidthScale;
+ if (widthRef.getPresName() === this.getPresName() &&
+ relationConstr.refType === AscFormat.Constr_type_h) {
+ this.setParentScale(AscFormat.Constr_type_h, newCoef);
+ } else {
+ this.setParentScale(AscFormat.Constr_type_w, newCoef);
+ }
+ }
+ }
+ PresNode.prototype.getSummaryScale = function (scaleType) {
+ let startCoefficient = 1;
+ const startRelation = this.getRelationConstr(scaleType);
+ if (!startRelation) {
+ return startCoefficient;
+ }
+ let refNode = startRelation.ref;
+ let relationConstr = startRelation.constr;
+ const mapRelations = {};
+ mapRelations[scaleType] = {};
+ if (refNode && refNode.getPresName() === this.getPresName() && relationConstr.type !== relationConstr.refType) {
+ mapRelations[scaleType][this.getPresName()] = true;
+ }
+
+ while (relationConstr && refNode) {
+ const refType = relationConstr.refType;
+ if (!mapRelations[refType]) {
+ mapRelations[refType] = {};
+ }
+ const refPresName = refNode.getPresName();
+ if (mapRelations[refType][refPresName]) {
+ break;
+ }
+ startCoefficient *= refNode.getParentScale(refType);
+ mapRelations[refType][refPresName] = true;
+ const refRelation = refNode.getRelationConstr(refType);
+ if (refRelation) {
+ relationConstr = refRelation.constr;
+ refNode = refRelation.ref;
+ } else {
+ break;
+ }
+ }
+ return startCoefficient;
+ }
+
+ PresNode.prototype.getSummaryHeightScale = function () {
+ return this.getSummaryScale(AscFormat.Constr_type_h);
+ };
+
+ PresNode.prototype.getSummaryWidthScale = function () {
+ return this.getSummaryScale(AscFormat.Constr_type_w);
+ };
+ PresNode.prototype.setHeightScale = function (pr) {
+ const relation = this.getRelationConstr(AscFormat.Constr_type_h);
+ if (relation) {
+ const relationConstr = relation.constr;
+ const heightRef = relation.ref;
+ const isSelfRelation = heightRef.getPresName() === this.getPresName();
+ const summaryHeight = this.getSummaryHeightScale();
+ const newCoef = pr / summaryHeight;
+ if (isSelfRelation &&
+ relationConstr.refType === AscFormat.Constr_type_w) {
+ this.setParentScale(AscFormat.Constr_type_w, newCoef);
+ } else {
+ this.setParentScale(AscFormat.Constr_type_h, newCoef);
+ }
+ }
+ }
+PresNode.prototype.getNamedNode = function (name) {
+ if (name === undefined || name === this.getPresName()) {
+ return this;
+ }
+ if (this.namedNodes === null) {
+ this.namedNodes = {};
+ const childs = this.childs;
+ for (let i = 0; i < childs.length; i++) {
+ const child = childs[i];
+ this.namedNodes[child.getPresName()] = child;
+ }
+ }
+ return this.namedNodes[name];
+};
+ PresNode.prototype.isRealShapeType = function () {
+ return !(this.algorithm instanceof ConnectorAlgorithm || (this.algorithm instanceof SpaceAlgorithm &&
+ (this.layoutInfo.shape.type === AscFormat.LayoutShapeType_outputShapeType_conn ||
+ this.layoutInfo.shape.type === AscFormat.LayoutShapeType_outputShapeType_none)));
+ }
+ PresNode.prototype.isSkipShape = function (isCalculateScaleCoefficient, isCycleAlgorithm) {
+ let shape = this.getShape(isCalculateScaleCoefficient);
+ if (shape.connectorShape) {
+ shape = shape.connectorShape;
+ }
+ return shape.width <= 0 && shape.height <= 0 ||
+ (this.algorithm instanceof ConnectorAlgorithm && !(isCycleAlgorithm && this.algorithm.isCurveShape())) ||
+ this.isTxXfrm() ||
+ !this.algorithm ||
+ (this.algorithm instanceof SpaceAlgorithm &&
+ !(this.parent && this.parent.algorithm instanceof CompositeAlgorithm) &&
+ (this.layoutInfo.shape.hideGeom || !this.isRealShapeType()));
+ };
+ PresNode.prototype.isSibNode = function () {
+ return this.node.isSibNode();
+ };
+ PresNode.prototype.isParNode = function () {
+ return this.node.isParNode();
+ };
+ PresNode.prototype.isContentNode = function () {
+ return this.node.isContentNode();
+ };
+ PresNode.prototype.getDescendantFilteredShapes = function () {
+ const nodes = [this];
+ const shapes = [];
+ while (nodes.length) {
+ const node = nodes.pop();
+ shapes.push(node.getShape());
+
+ for (let i = node.childs.length - 1; i >= 0; i -= 1) {
+ nodes.push(node.childs[i]);
+ }
+ }
+ return shapes.filter(function (shadowShape) {
+ if (shadowShape.height === 0 && shadowShape.width === 0 && shadowShape.node.algorithm instanceof TextAlgorithm) {
+ return false;
+ }
+ if (shadowShape.shape.hideGeom && shadowShape.shape.type === AscFormat.LayoutShapeType_shapeType_rect && shadowShape.node.algorithm instanceof TextAlgorithm && !shadowShape.node.isTxXfrm()) {
+ return true;
+ }
+ return !shadowShape.shape.hideGeom && !shadowShape.node.isTxXfrm() && shadowShape.shape.type !== AscFormat.LayoutShapeType_outputShapeType_none;
+ });
+ }
+ PresNode.prototype.getShadowShapesByZOrder = function () {
+ const shapes = this.getDescendantFilteredShapes();
+ const sortedShapes = shapes.slice();
+ let sortedIndex = 0;
+ for (let i = 0; i < shapes.length; i++) {
+ const shape = shapes[i];
+ const zOrderOff = shape.shape.zOrderOff;
+ if (zOrderOff === 0) {
+ continue;
+ }
+ while (sortedShapes[sortedIndex] !== shape) {
+ sortedIndex += 1;
+ }
+ const sortedShape = sortedShapes[sortedIndex];
+ sortedShapes.splice(sortedIndex, 1);
+ const insertIndex = Math.min(Math.max(0, sortedIndex + zOrderOff), sortedShapes.length);
+ sortedShapes.splice(insertIndex, 0, sortedShape);
+ }
+
+ return sortedShapes;
+ };
+ PresNode.prototype.getChildIndex = function (child) {
+ for (let i = 0; i < this.childs.length; i++) {
+ if (this.childs[i] === child) {
+ return i;
+ }
+ }
+ }
+ PresNode.prototype.getNeighbor = function () {
+ const parent = this.parent;
+ const index = parent.getChildIndex(this);
+ for (let i = index + 1; i < parent.childs.length; i += 1) {
+ const child = parent.childs[i];
+ const shape = child.shape;
+ if (child.isRealShapeType()) {
+ return child;
+ }
+ }
+
+ for (let i = index - 1; i >= 0; i -= 1) {
+ const child = parent.childs[i];
+ const shape = child.shape;
+ if (child.isRealShapeType()) {
+ return child;
+ }
+ }
+
+ return this;
+ };
+ PresNode.prototype.moveTo = function (deltaX, deltaY, isCalcScaleCoefficient, skipMoveWithNodes) {
+ deltaX = deltaX || 0;
+ deltaY = deltaY || 0;
+ this.forEachDesOrSelf(function (node) {
+ const shape = node.getShape(isCalcScaleCoefficient);
+ if (shape) {
+ shape.x += deltaX;
+ shape.y += deltaY;
+ }
+ });
+ if (!skipMoveWithNodes) {
+ for (let i = 0; i < this.moveWithNodes.length; i++) {
+ const moveNode = this.moveWithNodes[i];
+ const moveShape = moveNode.getShape(isCalcScaleCoefficient);
+ if (moveShape) {
+ moveShape.x += deltaX;
+ moveShape.y += deltaY;
+ }
+ }
+ const textNodes = this.contentNodes[0] && this.contentNodes[0].getTextNodes();
+ if (textNodes && textNodes.contentNode === this && textNodes.textNode) {
+ const moveShape = textNodes.textNode.getShape(isCalcScaleCoefficient);
+ if (moveShape) {
+ moveShape.x += deltaX;
+ moveShape.y += deltaY;
+ }
+ }
+ }
+ this.algorithm.moveToHierarchyOffsets(deltaX, deltaY);
+ };
+
+ PresNode.prototype.forEachChild = function (callback) {
+ for (let i = 0; i < this.childs.length; i += 1) {
+ callback(this.childs[i]);
+ }
+ };
+
+ PresNode.prototype.forEachDes = function (callback) {
+ const elements = [this];
+ while (elements.length) {
+ const element = elements.pop();
+ for (let i = 0; i < element.childs.length; i++) {
+ elements.push(element.childs[i]);
+ callback(element.childs[i]);
+ }
+ }
+ };
+
+ PresNode.prototype.forEachDesOrSelf = function (callback) {
+ callback(this);
+ this.forEachDes(callback);
+ };
+ PresNode.prototype.getAspectRatio = function () {
+ if (this.algorithm) {
+ return this.algorithm.getAspectRatio();
+ }
+ return 0;
+ }
+ PresNode.prototype.getPresStyleLbl = function () {
+ return this.presPoint.getPresStyleLbl();
+ }
+ PresNode.prototype.addMoveWithNode = function (node) {
+ this.moveWithNodes.push(node);
+ }
+ PresNode.prototype.checkMoveWith = function () {
+ for (let i = 0; i < this.childs.length; i += 1) {
+ const node = this.childs[i];
+ if (node.moveWith) {
+ const moveNode = this.getNamedNode(node.moveWith);
+ if (moveNode) {
+ moveNode.addMoveWithNode(node);
+ }
+ }
+ }
+ };
+PresNode.prototype.addChild = function (ch, pos) {
+ if (!AscFormat.isRealNumber(pos)) {
+ pos = this.childs.length;
+ }
+ this.childs.splice(pos, 0, ch);
+ ch.parent = this;
+};
+ PresNode.prototype.removeChilds = function (pos, count) {
+ this.childs.splice(pos, count);
+ };
+ PresNode.prototype.getPresName = function () {
+ return this.presPoint.getPresName();
+ };
+ PresNode.prototype.getPrSet = function () {
+ return this.presPoint.getPrSet();
+ };
+
+ PresNode.prototype.setShape = function (shape) {
+ this.shape = shape;
+ };
+
+ PresNode.prototype.getNodesByAxis = function (nodes, constrType) {
+ switch (constrType) {
+ case AscFormat.Constr_for_self: {
+ nodes.push(this);
+ break;
+ }
+ case AscFormat.Constr_for_ch: {
+ for (let i = 0; i < this.childs.length; i++) {
+ nodes.push(this.childs[i]);
+ }
+ break;
+ }
+ case AscFormat.Constr_for_des: {
+ const elements = [this];
+ while (elements.length) {
+ const element = elements.pop();
+ for (let i = 0; i < element.childs.length; i++) {
+ const child = element.childs[i];
+ nodes.push(child);
+ elements.push(child);
+ }
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ };
+ PresNode.prototype.setRules = function (smartartAlgorithm) {
+ const ruleLst = this.layoutInfo.ruleLst;
+ if (!ruleLst) {
+ return;
+ }
+ let cacheFor = {};
+ for (let i = 0; i < ruleLst.length; i++) {
+ const rule = ruleLst[i];
+ if (!cacheFor[rule.for]) {
+ cacheFor[rule.for] = [];
+ this.getNodesByAxis(cacheFor[rule.for], rule.for);
+ }
+ const nodes = cacheFor[rule.for];
+ for (let j = 0; j < nodes.length; j++) {
+ nodes[j].setRule(rule, smartartAlgorithm);
+ }
+ }
+ };
+ PresNode.prototype.getFactRule = function (constr) {
+ const ruleFactor = this.factRules[constr.type];
+ if (ruleFactor === undefined || ruleFactor > constr.fact) {
+ return constr.fact;
+ }
+ return ruleFactor;
+ };
+ PresNode.prototype.cleanRules = function () {
+ this.factRules = {};
+ this.valRules = {};
+ };
+ PresNode.prototype.cleanConstraints = function () {
+ this.relations = {};
+ this.equationRelations = {
+ adapt: {},
+ nonAdapt: {}
+ };
+
+ this.equationRelations.nonAdapt[AscFormat.Constr_op_equ] = {};
+ this.equationRelations.nonAdapt[AscFormat.Constr_op_gte] = {};
+ this.equationRelations.nonAdapt[AscFormat.Constr_op_lte] = {};
+ this.equationRelations.nonAdapt[AscFormat.Constr_op_none] = {};
+ this.equationRelations.adapt[AscFormat.Constr_op_equ] = {};
+ this.equationRelations.adapt[AscFormat.Constr_op_gte] = {};
+ this.equationRelations.adapt[AscFormat.Constr_op_lte] = {};
+ this.equationRelations.adapt[AscFormat.Constr_op_none] = {};
+ this.adaptConstr = {};
+ this.constr = {};
+ };
+ PresNode.prototype.setRule = function (rule, smartartAlgorithm) {
+ const node = this.getConstraintNode(rule.forName, rule.ptType.getVal());
+ if (node) {
+ if (AscFormat.isRealNumber(rule.fact)) {
+ if (rule.val !== rule.val) {
+ node.factRules[rule.type] = rule.fact;
+ smartartAlgorithm.setFactRuleState(factRuleState.enabled);
+ }
+ }
+ if (typeof rule.val === "number" && rule.val === rule.val) {
+ switch (rule.type) {
+ case AscFormat.Constr_type_diam: {
+ this.valRules[rule.type] = rule.val;
+ break;
+ }
+ case AscFormat.Constr_type_primFontSz:
+ case AscFormat.Constr_type_secFontSz: {
+ if (!this.textConstraints[rule.type]) {
+ this.textConstraints[rule.type] = new TextConstr();
+ }
+ const textConstr = this.textConstraints[rule.type];
+ if (!textConstr.rule || rule.val < textConstr.rule.val) {
+ textConstr.rule = rule;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ };
+ function TextConstr() {
+ this.op = {};
+ this.op[AscFormat.Constr_op_none] = [];
+ this.op[AscFormat.Constr_op_equ] = [];
+ this.op[AscFormat.Constr_op_gte] = [];
+ this.op[AscFormat.Constr_op_lte] = [];
+ this.rule = null;
+ }
+ TextConstr.prototype.getSecondaryFontSizeCoefficient = function () {
+ const info = this.op[AscFormat.Constr_op_none];
+
+ for (let i = 0; i < info.length; i += 1) {
+ const constr = info[i].constr;
+ if (constr.type === AscFormat.Constr_type_primFontSz && constr.refType === AscFormat.Constr_type_secFontSz) {
+ return 1 / constr.fact;
+ } else if (constr.refType === AscFormat.Constr_type_primFontSz && constr.type === AscFormat.Constr_type_secFontSz) {
+ return constr.fact;
+ }
+ }
+ return null;
+ };
+ TextConstr.prototype.collectShapeSmartArtInfo = function (opType, array, mapShapes, collectRefNodes) {
+ const information = this.op[opType];
+ for (let i = 0; i < information.length; i++) {
+ const info = information[i];
+ const nodes = collectRefNodes ? info.refNodes : info.nodes;
+ for (let j = 0; j < nodes.length; j++) {
+ const node = nodes[j];
+ const editorShape = node.contentNodes[0] && node.contentNodes[0].getContentNode().getShape().editorShape;
+ if (editorShape && !mapShapes[editorShape.GetId()]) {
+ array.push(editorShape.getSmartArtInfo());
+ }
+ }
+ }
+ };
+
+ TextConstr.prototype.getMaxFontSizeFromInfo = function (opType, isUseChildrenCoefficient, isReturnFirstFindFontSize) {
+ const informations = this.op[opType];
+ let fontSize = 65;
+ //todo
+ for (let i = 0; i < informations.length; i += 1) {
+ const info = informations[i];
+ const constr = info.constr;
+ if (constr) {
+ if (constr.refType === AscFormat.Constr_type_none && constr.op !== AscFormat.Constr_op_equ) {
+ if (constr.val < fontSize) {
+ fontSize = constr.val;
+ }
+ if (isReturnFirstFindFontSize) {
+ break;
+ }
+ } else if (!(constr.for === constr.refFor && constr.forName === constr.refForName && constr.ptType.getVal() === constr.refPtType.getVal())) {
+ const refNodes = info.refNodes;
+ for (let i = 0; i < refNodes.length; i += 1) {
+ const refNode = refNodes[i];
+ const editorShape = refNode.contentNodes[0] && refNode.contentNodes[0].getContentNode().getShape().editorShape;
+ if (editorShape) {
+ const shapeInfo = editorShape.getSmartArtInfo();
+ const shapeFontSize = shapeInfo.getRelFitFontSize(isUseChildrenCoefficient);
+ if (shapeFontSize !== null && shapeFontSize < fontSize) {
+ fontSize = shapeFontSize;
+ }
+ }
+ }
+ if (isReturnFirstFindFontSize) {
+ break;
+ }
+ }
+ }
+ }
+
+ return fontSize;
+ };
+ TextConstr.prototype.getMaxFontSize = function (isUseChildrenCoefficient) {
+ const noneFontSize = this.getMaxFontSizeFromInfo(AscFormat.Constr_op_none, isUseChildrenCoefficient, true);
+ const lteFontSize = this.getMaxFontSizeFromInfo(AscFormat.Constr_op_lte, isUseChildrenCoefficient);
+ return Math.min(noneFontSize, lteFontSize);
+ };
+ TextConstr.prototype.getMinFontSize = function () {
+ if (this.rule) {
+ return this.rule.val;
+ }
+ return 5;
+ };
+ function checkFontSizeConstraints(constr, refNodes, nodes) {
+ const truthRefNodes = [];
+ const truthNodes = [];
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i].getConstraintNode(constr.forName, constr.ptType.getVal());
+ if (node) {
+ truthNodes.push(node);
+ }
+ }
+ for (let i = 0; i < refNodes.length; i++) {
+ const node = refNodes[i].getConstraintNode(constr.refForName, constr.refPtType.getVal());
+ if (node) {
+ truthRefNodes.push(node);
+ }
+ }
+ for (let i = 0; i < truthNodes.length; i += 1) {
+ const node = truthNodes[i];
+ if (!node.textConstraints[constr.type]) {
+ node.textConstraints[constr.type] = new TextConstr();
+ }
+ const calcConstr = node.textConstraints[constr.type];
+ calcConstr.op[constr.op].push({constr: constr, refNodes: truthRefNodes, nodes: truthNodes});
+ }
+ if (constr.op === AscFormat.Constr_op_equ) {
+ for (let i = 0; i < truthRefNodes.length; i++) {
+ const node = truthRefNodes[i];
+ if (!node.textConstraints[constr.type]) {
+ node.textConstraints[constr.type] = new TextConstr();
+ }
+ const calcConstr = node.textConstraints[constr.type];
+ calcConstr.op[constr.op].push({constr: constr, refNodes: truthNodes, nodes: truthRefNodes});
+ }
+ }
+ if (constr.op === AscFormat.Constr_op_lte && !(constr.for === constr.refFor && constr.forName === constr.refForName && constr.ptType.getVal() === constr.refPtType.getVal()) && constr.refType !== AscFormat.Constr_type_none) {
+ for (let i = 0; i < truthRefNodes.length; i += 1) {
+ truthRefNodes[i].textConstraintRelations.push(truthNodes);
+ }
+ }
+ }
+ PresNode.prototype.setConstraints = function (isAdapt, smartartAlgorithm) {
+ const constrLst = this.layoutInfo.constrLst;
+ if (!constrLst) {
+ return;
+ }
+ const valueCache = {};
+ const cacheFor = {};
+ for (let i = 0; i < constrLst.length; i++) {
+ const constr = constrLst[i];
+ if (!cacheFor[constr.for]) {
+ cacheFor[constr.for] = [];
+ this.getNodesByAxis(cacheFor[constr.for], constr.for);
+ }
+ const nodes = cacheFor[constr.for];
+
+ if (!cacheFor[constr.refFor]) {
+ cacheFor[constr.refFor] = [];
+ this.getNodesByAxis(cacheFor[constr.refFor], constr.refFor);
+ }
+ const refNodes = cacheFor[constr.refFor];
+
+ for (let j = 0; j < refNodes.length; j++) {
+ const calcValue = refNodes[j].getCalcRefConstr(constr, isAdapt, valueCache);
+ if (AscFormat.isRealNumber(calcValue)) {
+ for (let k = 0; k < nodes.length; k++) {
+ nodes[k].setConstraintByNode(constr, refNodes[j], calcValue, isAdapt);
+ }
+ break;
+ }
+ }
+ if (isAdapt) {
+ switch (constr.type) {
+ case AscFormat.Constr_type_primFontSz:
+ case AscFormat.Constr_type_secFontSz:
+ checkFontSizeConstraints(constr, refNodes, nodes, smartartAlgorithm);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ PresNode.prototype.getPtType = function () {
+ const node = this.node;
+ return node.getPtType();
+ }
+ PresNode.prototype.checkPtType = function (elementType) {
+ const ptType = this.getPtType();
+ switch (elementType) {
+ case AscFormat.ElementType_value_all:
+ return this;
+ case AscFormat.ElementType_value_sibTrans:
+ if (ptType === AscFormat.Point_type_sibTrans) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_parTrans:
+ if (ptType === AscFormat.Point_type_parTrans) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_node:
+ if (ptType === AscFormat.Point_type_node || ptType === AscFormat.Point_type_asst) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_asst:
+ if (ptType === AscFormat.Point_type_asst) {
+ return this;
+ }
+ break;
+ case AscFormat.ElementType_value_nonAsst:
+ if (ptType !== AscFormat.Point_type_asst) {
+ return this;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ PresNode.prototype.getConstraintNode = function (forName, ptType) {
+ let node = this;
+ if (forName) {
+ node = this.checkName(forName);
+ }
+ return node && node.checkPtType(ptType);
+ };
+
+ PresNode.prototype.getCalcRefConstr = function (constr, isAdapt, valueCache) {
+ const refPtType = constr.refPtType.getVal();
+ if (!constr.refForName) {
+ if (!valueCache[constr.refFor]) {
+ valueCache[constr.refFor] = {};
+ }
+ if (!valueCache[constr.refFor][refPtType]) {
+ valueCache[constr.refFor][refPtType] = {};
+ }
+ const cacheValue = valueCache[constr.refFor][refPtType][constr.refType];
+ if (AscFormat.isRealNumber(cacheValue)) {
+ return cacheValue;
+ }
+ }
+
+ const refNode = this.getConstraintNode(constr.refForName, refPtType);
+ if (!refNode) {
+ return;
+ }
+ const calcValue = refNode.getRefConstr(constr, isAdapt);
+ if (constr.refType !== AscFormat.Constr_type_none && !constr.refForName && constr.refFor !== AscFormat.Constr_for_self) {
+ valueCache[constr.refFor][refPtType][constr.refType] = calcValue;
+ }
+ return calcValue;
+ };
+ PresNode.prototype.setConstraintByNode = function (constr, refNode, calcValue, isAdapt) {
+ const constrNode = this.getConstraintNode(constr.forName, constr.ptType.getVal());
+ if (constrNode) {
+ constrNode.addEqualRelation(refNode, constr, isAdapt);
+ const isSettingConstraint = constrNode.setConstraint(constr, calcValue, isAdapt);
+ constrNode.setParamConstraint(constr, refNode);
+ if (isSettingConstraint) {
+ constrNode.applyEqualRelations(isAdapt);
+ setRelationConstraints(constrNode, refNode, constr);
+ }
+ }
+ };
+
+ function setRelationConstraints(constrNode, refNode, constr) {
+ switch (constr.type) {
+ case AscFormat.Constr_type_w:
+ case AscFormat.Constr_type_h:
+ constrNode.setRelationConstr(refNode, constr);
+ break;
+ default:
+ break;
+ }
+ }
+
+ PresNode.prototype.addEqualRelation = function (refNode, constr, isAdapt) {
+ const relations = isAdapt ? this.equationRelations.adapt : this.equationRelations.nonAdapt;
+ relations[constr.op][constr.type] = {constr: constr, ref: refNode};
+ };
+ PresNode.prototype.applyEqualRelations = function (isAdapt) {
+ const relations = isAdapt ? this.equationRelations.adapt : this.equationRelations.nonAdapt;
+ const equRelations = relations[AscFormat.Constr_op_equ];
+ for (let constrType in equRelations) {
+ const rel = equRelations[constrType];
+ const constr = rel.constr;
+ const refNode = rel.ref;
+
+ const refConstrObject = isAdapt ? refNode.adaptConstr : refNode.constr;
+ const curConstrObject = isAdapt ? this.adaptConstr : this.constr;
+
+ let factor = this.getFactRule(constr);
+ const refType = constr.refType === AscFormat.Constr_type_none && constr.refForName ? constr.type : constr.refType;
+ if (refConstrObject[refType]) {
+ if ( refNode === this && refConstrObject[refType] * factor !== curConstrObject[constr.type]) {
+ refConstrObject[refType] = curConstrObject[constr.type];
+ } else {
+ curConstrObject[constr.type] = refConstrObject[refType] * factor;
+ }
+ }
+ }
+ };
+ PresNode.prototype.setParamConstraint = function (constr, refNode) {
+ switch (constr.type) {
+ case AscFormat.Constr_type_connDist: {
+ if (constr.for !== AscFormat.Constr_for_self) {
+ if (this.algorithm) {
+ if (!refNode.connectionDistanceResolver) {
+ refNode.connectionDistanceResolver = new CConnectionDistanceResolver();
+ }
+ refNode.connectionDistanceResolver.addConnection(this.algorithm);
+ }
+ }
+ }
+ }
+ }
+ function isUserConstr(type) {
+ switch (type) {
+ case AscFormat.Constr_type_userA:
+ case AscFormat.Constr_type_userB:
+ case AscFormat.Constr_type_userC:
+ case AscFormat.Constr_type_userD:
+ case AscFormat.Constr_type_userE:
+ case AscFormat.Constr_type_userF:
+ case AscFormat.Constr_type_userG:
+ case AscFormat.Constr_type_userH:
+ case AscFormat.Constr_type_userI:
+ case AscFormat.Constr_type_userJ:
+ case AscFormat.Constr_type_userK:
+ case AscFormat.Constr_type_userL:
+ case AscFormat.Constr_type_userM:
+ case AscFormat.Constr_type_userN:
+ case AscFormat.Constr_type_userO:
+ case AscFormat.Constr_type_userP:
+ case AscFormat.Constr_type_userQ:
+ case AscFormat.Constr_type_userR:
+ case AscFormat.Constr_type_userS:
+ case AscFormat.Constr_type_userT:
+ case AscFormat.Constr_type_userU:
+ case AscFormat.Constr_type_userV:
+ case AscFormat.Constr_type_userW:
+ case AscFormat.Constr_type_userX:
+ case AscFormat.Constr_type_userY:
+ case AscFormat.Constr_type_userZ:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ PresNode.prototype.setConstraint = function (constr, value, isAdapt) {
+ if (!this.isCanAdapt(constr, isAdapt)) {
+ return false;
+ }
+ let factor = this.getFactRule(constr);
+ value *= factor;
+ const constrObject = this.getConstraints(isAdapt);
+ if (constrObject[constr.type] !== undefined && constr.refFor === AscFormat.Constr_for_self && constr.refType === AscFormat.Constr_type_none) {
+ return false;
+ }
+
+ switch (constr.op) {
+ case AscFormat.Constr_op_gte: {
+ const oldValue = constrObject[constr.type];
+ if (oldValue !== undefined && value < oldValue) {
+ return false;
+ }
+ break;
+ }
+ case AscFormat.Constr_op_lte: {
+ const oldValue = constrObject[constr.type];
+ if (oldValue !== undefined && value > oldValue) {
+ return false;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ if (isAdapt) {
+ switch (constr.type) {
+ case AscFormat.Constr_type_w:
+ case AscFormat.Constr_type_h: {
+ const summaryScale = this.getSummaryScale(constr.type);
+ const parentScale = Math.min(this.getParentScale(constr.type) / summaryScale, 1);
+ value *= parentScale;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+
+ switch (constr.type) {
+ case AscFormat.Constr_type_begPad:
+ case AscFormat.Constr_type_endPad: {
+ if (this.algorithm) {
+ const padFactor = constr.refType === AscFormat.Constr_type_none ? constr.val : constr.fact;
+ this.algorithm.setConnectionDistance(padFactor, constr.type === AscFormat.Constr_type_begPad);
+ }
+ break;
+ }
+ case AscFormat.Constr_type_stemThick: {
+ if (this.algorithm) {
+ this.algorithm.setStemThick(constr.fact);
+ }
+ break;
+ }
+ case AscFormat.Constr_type_diam:
+ if (this.algorithm) {
+ let val;
+ if (value === 0) {
+ val = constr.refType === AscFormat.Constr_type_none ? constr.val : constr.fact;
+ } else {
+ val = value;
+ }
+ this.algorithm.setConstrClockwise(val > 0);
+ this.algorithm.diameterScale = constr.fact;
+ break;
+ }
+ break;
+ case AscFormat.Constr_type_bMarg:
+ case AscFormat.Constr_type_tMarg:
+ case AscFormat.Constr_type_rMarg:
+ case AscFormat.Constr_type_lMarg:
+ if (this.textConstraints[constr.type] === undefined && constrObject[constr.type] === undefined) {
+ if (constr.refType === AscFormat.Constr_type_primFontSz || constr.refType === AscFormat.Constr_type_secFontSz) {
+ this.textConstraints[constr.type] = constr.fact;
+ } else if (AscFormat.isRealNumber(this.textConstraints[constr.refType])) {
+ this.textConstraints[constr.type] = this.textConstraints[constr.refType];
+ }
+ } else if (constr.refType === AscFormat.Constr_type_primFontSz || constr.refType === AscFormat.Constr_type_secFontSz) {
+ return;
+ }
+ break;
+ default: {
+ break;
+ }
+ }
+ if (this.valRules[constr.type] !== Infinity) {
+ constrObject[constr.type] = value;
+ }
+ return true;
+ };
+ PresNode.prototype.getParentWidth = function (isAdapt) {
+ let node = this;
+ while (node.isContentNode() && node.parent) {
+ const parentConstrObject = isAdapt ? node.parent.adaptConstr : node.parent.constr;
+ let parentWidth = parentConstrObject[AscFormat.Constr_type_w];
+ let parentHeight = parentConstrObject[AscFormat.Constr_type_h];
+ const aspectRatio = node.parent.getAspectRatio();
+ if (aspectRatio) {
+ const aspectWidth = parentHeight * aspectRatio;
+ if (parentWidth > aspectWidth) {
+ parentWidth = aspectWidth;
+ }
+ }
+ if (parentWidth) {
+ return parentWidth;
+ }
+ node = node.parent;
+ }
+ };
+ PresNode.prototype.getParentHeight = function (isAdapt) {
+ let node = this;
+ while (node.isContentNode() && node.parent) {
+ const parentConstrObject = isAdapt ? node.parent.adaptConstr : node.parent.constr;
+ let parentWidth = parentConstrObject[AscFormat.Constr_type_w];
+ let parentHeight = parentConstrObject[AscFormat.Constr_type_h];
+ const aspectRatio = node.parent.getAspectRatio();
+ if (aspectRatio) {
+ const aspectWidth = parentHeight * aspectRatio;
+ if (parentWidth <= aspectWidth) {
+ parentHeight = parentWidth / aspectRatio;
+ }
+ }
+ if (parentHeight) {
+ return parentHeight;
+ }
+ node = node.parent;
+ }
+ };
+ PresNode.prototype.isCanAdapt = function (constr, isAdapt) {
+ if (isAdapt) {
+ switch (constr.type) {
+ case AscFormat.Constr_type_w:
+ case AscFormat.Constr_type_h: {
+ const relation = this.getRelationConstr(constr.type);
+ return !!(relation && constr === relation.constr);
+ }
+ default:
+ return true;
+ }
+ }
+ return true;
+ }
+ PresNode.prototype.getRefConstr = function (constr, isAdapt) {
+ let aspectRatio;
+ if (!(constr.for === AscFormat.Constr_for_self && constr.refFor === AscFormat.Constr_for_self && !isUserConstr(constr.type))) {
+ aspectRatio = this.getAspectRatio();
+ }
+ const constrObject = isAdapt ? this.adaptConstr : this.constr;
+ let value;
+ if (isUserConstr(constr.type) && constr.refType === AscFormat.Constr_type_none && constrObject[constr.type] !== undefined && constr.refFor === AscFormat.Constr_for_self) {
+ value = constrObject[constr.type];
+ } else if (constr.refType === AscFormat.Constr_type_none) {
+ value = constr.val;
+ } else if (constrObject[constr.refType]) {
+ value = constrObject[constr.refType];
+ }
+ if (value !== undefined) {
+ if (aspectRatio) {
+ switch (constr.refType) {
+ case AscFormat.Constr_type_h:
+ const width = constrObject[AscFormat.Constr_type_w];
+ if (width !== undefined) {
+ const aspectWidth = width / aspectRatio;
+ if (aspectWidth < value) {
+ value = aspectWidth;
+ }
+ }
+
+ break;
+ case AscFormat.Constr_type_w:
+ const height = constrObject[AscFormat.Constr_type_h];
+ if (height !== undefined) {
+ const aspectHeight = height * aspectRatio;
+ if (aspectHeight < value) {
+ value = aspectHeight;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
+ value = this.getConstr(constr.refType, isAdapt, true);
+ if (value === undefined) {
+ switch (constr.refType) {
+ case AscFormat.Constr_type_w: {
+ const parentWidth = this.getParentWidth(isAdapt);
+ constrObject[AscFormat.Constr_type_w] = parentWidth;
+ return parentWidth;
+ }
+ case AscFormat.Constr_type_h: {
+ const parentHeight = this.getParentHeight(isAdapt);
+ constrObject[AscFormat.Constr_type_h] = parentHeight;
+ return parentHeight;
+ }
+ default: {
+ value = constr.val;
+ break;
+ }
+ }
+ }
+ }
+ return value;
+ };
+
+ PresNode.prototype.setAlgorithm = function (algorithm) {
+ this.algorithm = algorithm;
+ }
+
+ PresNode.prototype.getAlgorithm = function () {
+ return this.algorithm;
+ }
+ PresNode.prototype.getPositionConstrWithOffset = function (posConstrType, offsetConstrType, isAdapt) {
+ const constrObject = this.getConstraints(isAdapt);
+ const position = constrObject[posConstrType];
+ let result;
+ if (position !== undefined) {
+ result = position;
+ const offset = constrObject[offsetConstrType];
+ if (offset !== undefined) {
+ result += offset;
+ }
+ }
+ return result;
+ }
+ PresNode.prototype.getConstrForCalculating = function (type, isAdapt) {
+ switch (type) {
+ case AscFormat.Constr_type_l:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_lOff, isAdapt);
+ case AscFormat.Constr_type_r:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_rOff, isAdapt);
+ case AscFormat.Constr_type_t:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_tOff, isAdapt);
+ case AscFormat.Constr_type_b:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_bOff, isAdapt);
+ case AscFormat.Constr_type_ctrX:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_ctrXOff, isAdapt);
+ case AscFormat.Constr_type_ctrY:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_ctrYOff, isAdapt);
+ case AscFormat.Constr_type_w:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_wOff, isAdapt);
+ case AscFormat.Constr_type_h:
+ return this.getPositionConstrWithOffset(type, AscFormat.Constr_type_hOff, isAdapt);
+ default:
+ const constrObj = this.getConstraints(isAdapt);
+ return constrObj[type];
+ }
+ };
+ PresNode.prototype.getConstr = function (type, isAdapt, skipDefaultValue, depth) {
+ depth = depth || 0;
+ const constrObj = isAdapt ? this.adaptConstr : this.constr;
+ let result = this.getConstrForCalculating(type, isAdapt);
+ if (depth < 2) {
+ switch (type) {
+ case AscFormat.Constr_type_l: {
+ const width = this.getConstr(AscFormat.Constr_type_w, isAdapt, false, depth + 1);
+ const right = this.getConstrForCalculating(AscFormat.Constr_type_r, isAdapt);
+ const ctrX = this.getConstrForCalculating(AscFormat.Constr_type_ctrX, isAdapt);
+ if (ctrX !== undefined) {
+ result = ctrX - width / 2;
+ } else if (right !== undefined) {
+ result = right - width;
+ }
+ break;
+ }
+ case AscFormat.Constr_type_t: {
+ const height = this.getConstrForCalculating(AscFormat.Constr_type_h, isAdapt);
+ if (height !== undefined) {
+ const ctrY = this.getConstrForCalculating(AscFormat.Constr_type_ctrY, isAdapt);
+ const bottom = this.getConstrForCalculating(AscFormat.Constr_type_b, isAdapt);
+ if (ctrY !== undefined) {
+ result = ctrY - height / 2;
+ } else if (bottom !== undefined) {
+ result = bottom - height;
+ }
+ }
+ break;
+ }
+ case AscFormat.Constr_type_w: {
+ const right = this.getConstrForCalculating(AscFormat.Constr_type_r, isAdapt);
+ const left = this.getConstrForCalculating(AscFormat.Constr_type_l, isAdapt);
+ if (right !== undefined && left !== undefined) {
+ result = right - left;
+ } else if (this.algorithm instanceof TextAlgorithm && result === undefined) {
+ const wOff = constrObj[AscFormat.Constr_type_wOff];
+ result = this.getParentWidth(isAdapt);
+ if (left !== undefined) {
+ result -= left;
+ } else if (wOff !== undefined) {
+ result += wOff;
+ }
+ }
+ break;
+ }
+ case AscFormat.Constr_type_h: {
+ const bottom = this.getConstrForCalculating(AscFormat.Constr_type_b, isAdapt);
+ const top = this.getConstr(AscFormat.Constr_type_t, isAdapt, true, depth + 1);
+ if (bottom !== undefined && top !== undefined) {
+ result = bottom - top;
+ } else if (this.algorithm instanceof TextAlgorithm && result === undefined) {
+ const hOff = constrObj[AscFormat.Constr_type_hOff];
+ result = this.getParentHeight(isAdapt);
+ if (top !== undefined) {
+ result -= top;
+ } else if (hOff !== undefined) {
+ result += hOff;
+ }
+ }
+ break;
+ }
+ case AscFormat.Constr_type_b: {
+ const height = this.getConstrForCalculating(AscFormat.Constr_type_h, isAdapt);
+ if (AscFormat.isRealNumber(height)) {
+ const top = this.getConstrForCalculating(AscFormat.Constr_type_t, isAdapt);
+ const ctrY = this.getConstrForCalculating(AscFormat.Constr_type_ctrY, isAdapt);
+ if (AscFormat.isRealNumber(top)) {
+ result = top + height;
+ } else if (AscFormat.isRealNumber(ctrY)) {
+ result = ctrY + height / 2;
+ } else {
+ result = height;
+ }
+ }
+ break;
+ }
+ case AscFormat.Constr_type_r: {
+ const width = this.getConstr(AscFormat.Constr_type_w, isAdapt, true, depth + 1);
+ if (AscFormat.isRealNumber(width)) {
+ const left = this.getConstr(AscFormat.Constr_type_l, isAdapt, false, depth + 1);
+ result = left + width;
+ }
+ break;
+ }
+ case AscFormat.Constr_type_ctrY: {
+ const height = this.getConstr(AscFormat.Constr_type_h, isAdapt, true, depth + 1);
+ if (AscFormat.isRealNumber(height)) {
+ const top = this.getConstr(AscFormat.Constr_type_t, isAdapt, false, depth + 1);
+ result = top + height / 2;
+ }
+ break;
+ }
+ case AscFormat.Constr_type_ctrX: {
+ const width = this.getConstr(AscFormat.Constr_type_w, isAdapt, true, depth + 1);
+ if (AscFormat.isRealNumber(width)) {
+ const left = this.getConstr(AscFormat.Constr_type_l, isAdapt, false, depth + 1);
+ result = left + width / 2;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ return skipDefaultValue ? result : (result || 0);
+ };
+
+
+ PresNode.prototype.getDirection = function () {
+ return this.presPoint.getDirection();
+ }
+
+ PresNode.prototype.checkName = function (name) {
+ if (this.getPresName() === name) {
+ return this;
+ }
+ }
+
+ PresNode.prototype.startAlgorithm = function (smartartAlgorithm, isCalculateScaleCoefficients) {
+ if (this.algorithm) {
+ this.algorithm.calculateShapePositions(smartartAlgorithm, isCalculateScaleCoefficients);
+ }
+ }
+
+ PresNode.prototype.calcScaleCoefficients = function (smartartAlgorithm) {
+ if (this.algorithm) {
+ this.algorithm.calcScaleCoefficients(smartartAlgorithm);
+ }
+ }
+ PresNode.prototype.setLayoutConstraints = function (lst) {
+ this.layoutInfo.constrLst = lst;
+ };
+ PresNode.prototype.setLayoutRules = function (lst) {
+ this.layoutInfo.ruleLst = lst;
+ };
+ PresNode.prototype.isTxXfrm = function () {
+ const contentNode = this.node;
+ const textNodes = contentNode.getTextNodes();
+ return !!(textNodes.textNode && textNodes.contentNode && textNodes.textNode === this);
+ };
+
+ PresNode.prototype.updateCompositeSizes = function (isCalculateCoefficients) {
+ const shape = this.getShape(isCalculateCoefficients);
+ if (!this.childs.length) {
+ shape.width = 0;
+ shape.height = 0;
+ return;
+ }
+
+ let shapeBounds;
+ let cleanShapeBounds;
+ for (let i = 0; i < this.childs.length; i += 1) {
+ const node = this.childs[i];
+ const childShape = node.getShape(isCalculateCoefficients);
+ // todo: check this
+ if (childShape.width <= 0 && childShape.height <= 0 || (node.algorithm instanceof ConnectorAlgorithm) || ((node.algorithm instanceof TextAlgorithm) && !node.isRealShapeType()) || node.isTxXfrm()) {
+ continue;
+ }
+ if (shapeBounds) {
+ checkBounds(shapeBounds, childShape.getBounds());
+ checkBounds(cleanShapeBounds, childShape.getBounds(true));
+ } else {
+ shapeBounds = childShape.getBounds();
+ cleanShapeBounds = childShape.getBounds(true);
+ }
+ }
+ if (!shapeBounds) {
+ shape.width = 0;
+ shape.height = 0;
+ return;
+ }
+
+
+ shape.x = shapeBounds.l;
+ shape.y = shapeBounds.t;
+ shape.cleanParams.x = cleanShapeBounds.l;
+ shape.cleanParams.y = cleanShapeBounds.t;
+
+
+ shape.width = shapeBounds.r - shapeBounds.l;
+ shape.height = shapeBounds.b - shapeBounds.t;
+
+ shape.cleanParams.width = cleanShapeBounds.r - cleanShapeBounds.l;
+ shape.cleanParams.height = cleanShapeBounds.b - cleanShapeBounds.t;
+ return shapeBounds;
+ };
+
+ PresNode.prototype.createShadowShape = function (isComposite, isCalculateCoefficients) {
+
+ const shape = this.getShape(isCalculateCoefficients);
+ shape.initFromShape(this.layoutInfo.shape);
+ this.createShadowShapeFromConstraints(this.layoutInfo.shape, isCalculateCoefficients);
+ if (isComposite) {
+ this.forEachChild(function (node) {
+ node.moveTo(shape.x, shape.y, isCalculateCoefficients, true);
+ });
+ this.algorithm.setConstraintSizes(shape);
+ return this.updateCompositeSizes(isCalculateCoefficients);
+ }
+ };
+ PresNode.prototype.createHierarchyRootShadowShape = function (isCalculateCoefficients) {
+ const algorithm = this.algorithm;
+ if (algorithm) {
+ const root = algorithm.getRoot();
+ const shape = this.getShape(isCalculateCoefficients);
+ shape.initFromShape(this.layoutInfo.shape);
+ // root.algorithm.getBounds();
+ const rootShape = root.getShape(isCalculateCoefficients);
+ shape.x = rootShape.x;
+ shape.y = rootShape.y;
+ shape.width = rootShape.width;
+ shape.height = rootShape.height;
+ shape.rot = rootShape.rot;
+ shape.cleanParams = Object.assign({}, rootShape.cleanParams);
+ }
+ };
+ PresNode.prototype.createHierarchyChildShadowShape = function (isCalculateCoefficients) {
+ const shape = this.getShape(isCalculateCoefficients);
+ shape.initFromShape(this.layoutInfo.shape);
+ const childs = this.algorithm.getMainChilds();
+ if (!childs.length) {
+ return;
+ }
+ let bounds = childs[0].algorithm.getBounds(isCalculateCoefficients);
+ for (let i = 1; i < childs.length; i += 1) {
+ const child = childs[i];
+ const algorithm = child.algorithm;
+ bounds = algorithm.getBounds(isCalculateCoefficients, bounds);
+ }
+ if (bounds) {
+ shape.x = bounds.l;
+ shape.y = bounds.t;
+ shape.width = bounds.r - bounds.l;
+ shape.height = bounds.b - bounds.t;
+ }
+ };
+ PresNode.prototype.getConstraints = function (isAdapt) {
+ return isAdapt ? this.adaptConstr : this.constr;
+ };
+ PresNode.prototype.setMoveRot = function (rot) {
+ this.moveRot = rot;
+ }
+ PresNode.prototype.createShadowShapeFromConstraints = function (layoutShape, isCalculateCoefficients) {
+ const isChildInSpaceAlgorithm = this.parent && this.parent.algorithm instanceof SpaceAlgorithm;
+ const constrNode = isChildInSpaceAlgorithm ? this.parent : this;
+
+ const shape = this.getShape(isCalculateCoefficients);
+ shape.rot = AscFormat.normalizeRotate(degToRad * layoutShape.rot);
+
+ const widthCoef = this.getWidthScale();
+ const heightCoef = this.getHeightScale();
+ let x = constrNode.getConstr(AscFormat.Constr_type_l, !isCalculateCoefficients);
+ let y = constrNode.getConstr(AscFormat.Constr_type_t, !isCalculateCoefficients);
+ let width = constrNode.getConstr(AscFormat.Constr_type_w, !isCalculateCoefficients, !isChildInSpaceAlgorithm);
+ let height = constrNode.getConstr(AscFormat.Constr_type_h, !isCalculateCoefficients, !isChildInSpaceAlgorithm);
+ if (width === undefined && height === undefined) {
+ const isSpaceAlgorithm = this.algorithm instanceof SpaceAlgorithm;
+ width = isSpaceAlgorithm ? (constrNode.getParentWidth(!isCalculateCoefficients) || 0) : 0;
+ height = isSpaceAlgorithm ? (constrNode.getParentHeight(!isCalculateCoefficients) || 0): 0;
+ } else {
+ width = width || 0;
+ height = height || 0;
+ }
+ const newSizes = AscFormat.fGetMaxInscribedRectangle(width, height, shape.rot);
+ const newScaledSizes = AscFormat.fGetMaxInscribedRectangle(width * widthCoef, height * heightCoef, shape.rot);
+ x += (width - newSizes.width) / 2;
+ y += (height - newSizes.height) / 2;
+ width = newSizes.width;
+ height = newSizes.height;
+ const scaleWidth = newScaledSizes.width;
+ const scaleHeight = newScaledSizes.height;
+ shape.x = x;
+ shape.y = y;
+
+
+ shape.width = scaleWidth;
+ shape.height = scaleHeight;
+ const offX = (width - shape.width) / 2;
+ const offY = (height - shape.height) / 2;
+ shape.x += offX;
+ shape.y += offY;
+
+ let moveRot = 0;
+ const prSet = this.getPrSet();
+
+ if (prSet && prSet.custAng) {
+ moveRot = prSet.custAng;
+ }
+ for (let i = 0; i < this.moveWithNodes.length; i += 1) {
+ const moveNode = this.moveWithNodes[i];
+ if (moveNode.isInitShape(isCalculateCoefficients)) {
+ const moveShape = moveNode.getShape(isCalculateCoefficients);
+ const scaleMoveWidth = moveShape.width * widthCoef;
+ const scaleMoveHeight = moveShape.height * heightCoef;
+ const moveOffX = (shape.x + (moveShape.x - x) * widthCoef) - moveShape.x;
+ const moveOffY = (moveShape.height - scaleMoveHeight) / 2;
+ moveShape.width = scaleMoveWidth;
+ moveShape.height = scaleMoveHeight;
+ moveNode.moveTo(moveOffX, moveOffY, isCalculateCoefficients);
+
+
+ } else {
+ moveNode.setMoveScaleCoefficients(widthCoef, heightCoef);
+ }
+ moveNode.setMoveRot(moveRot);
+ }
+ const textNodes = this.contentNodes[0] && this.contentNodes[0].getTextNodes();
+ if (textNodes && textNodes.contentNode === this && textNodes.textNode) {
+ if (textNodes.textNode.isInitShape(isCalculateCoefficients)) {
+ const moveShape = textNodes.textNode.getShape(isCalculateCoefficients);
+ const scaleMoveWidth = moveShape.width * widthCoef;
+ const scaleMoveHeight = moveShape.height * heightCoef;
+ const moveOffX = shape.x + shape.width / 2 + (moveShape.x + moveShape.width / 2 - (x + width / 2)) * widthCoef - (moveShape.x + scaleMoveWidth / 2);
+ const moveOffY = shape.y + shape.height / 2 + (moveShape.y + moveShape.height / 2 - (y + height / 2)) * heightCoef - (moveShape.y + scaleMoveHeight / 2);
+ moveShape.width = scaleMoveWidth;
+ moveShape.height = scaleMoveHeight;
+ textNodes.textNode.moveTo(moveOffX, moveOffY, isCalculateCoefficients);
+ }
+ }
+
+ shape.cleanParams = {
+ width: width,
+ height: height,
+ x: x,
+ y: y
+ };
+ };
+ PresNode.prototype.isInitShape = function (isCalculateScaleCoefficient) {
+ return !!(isCalculateScaleCoefficient ? this.position : this.shape);
+ };
+ PresNode.prototype.setMoveScaleCoefficients = function (widthCoefficient, heightCoefficient) {
+ this.moveScaleCoefficients.width = widthCoefficient;
+ this.moveScaleCoefficients.height = heightCoefficient;
+ };
+ PresNode.prototype.getChildConstraintBounds = function (isCalculateCoefficients) {
+ if (this.bounds.constraints === null) {
+ const constrBounds = {
+ l: 0,
+ r: 0,
+ t: 0,
+ b: 0
+ };
+ this.bounds.constraints = constrBounds;
+ if (this.childs.length) {
+ const firstNodeConstraints = this.childs[0].algorithm && this.childs[0].algorithm.constraintSizes;
+ if (firstNodeConstraints) {
+ constrBounds.b = firstNodeConstraints.y + firstNodeConstraints.height;
+ constrBounds.t = firstNodeConstraints.y;
+ constrBounds.l = firstNodeConstraints.x;
+ constrBounds.r = firstNodeConstraints.x + firstNodeConstraints.width;
+ } else {
+ const shape = this.childs[0].getShape(isCalculateCoefficients);
+ constrBounds.b = shape.y + shape.height;
+ constrBounds.t = shape.y;
+ constrBounds.l = shape.x;
+ constrBounds.r = shape.x + shape.width;
+ }
+ for (let i = 1; i < this.childs.length; i++) {
+ this.childs[i].checkConstraintBounds(constrBounds, isCalculateCoefficients);
+ }
+ }
+ }
+ return this.bounds.constraints;
+ };
+ PresNode.prototype.checkConstraintBounds = function (bounds, isCalculateScaleCoefficient) {
+ if (!this.isContentNode()) {
+ return;
+ }
+ const constraintSizes = this.algorithm && this.algorithm.constraintSizes;
+ if (constraintSizes) {
+ if (constraintSizes.x < bounds.l) {
+ bounds.l = constraintSizes.x;
+ }
+ if (constraintSizes.y < bounds.t) {
+ bounds.t = constraintSizes.y;
+ }
+ const right = constraintSizes.x + constraintSizes.width;
+ if (right > bounds.r) {
+ bounds.r = right;
+ }
+ const bottom = constraintSizes.y + constraintSizes.height;
+ if (bottom > bounds.b) {
+ bounds.b = bottom;
+ }
+ } else {
+ const shape = this.getShape(isCalculateScaleCoefficient);
+ if (shape.x < bounds.l) {
+ bounds.l = shape.x;
+ }
+ if (shape.y < bounds.t) {
+ bounds.t = shape.y;
+ }
+ const right = shape.x + shape.width;
+ if (right > bounds.r) {
+ bounds.r = right;
+ }
+ const bottom = shape.y + shape.height;
+ if (bottom > bounds.b) {
+ bounds.b = bottom;
+ }
+ }
+ };
+
+ PresNode.prototype.getHeightScale = function (force) {
+ if (!force && !this.isRealShapeType()) {
+ return this.moveScaleCoefficients.height;
+ }
+ const prSet = this.getPrSet();
+ if (prSet) {
+ return (prSet.custScaleY || 1) * this.moveScaleCoefficients.height;
+ }
+ return this.moveScaleCoefficients.height;
+ }
+
+ PresNode.prototype.getWidthScale = function (force) {
+ if (!force && !this.isRealShapeType()) {
+ return this.moveScaleCoefficients.width;
+ }
+ const prSet = this.getPrSet();
+ if (prSet) {
+ return (prSet.custScaleX || 1) * this.moveScaleCoefficients.width;
+ }
+ return this.moveScaleCoefficients.width;
+ }
+
+ PresNode.prototype.initRootConstraints = function (smartArt, smartartAlgorithm) {
+ const sizes = smartArt.getSizes();
+ this.constr[AscFormat.Constr_type_w] = sizes.width;
+ this.constr[AscFormat.Constr_type_h] = sizes.height;
+ this.adaptConstr[AscFormat.Constr_type_w] = sizes.width;
+ this.adaptConstr[AscFormat.Constr_type_h] = sizes.height;
+ };
+ PresNode.prototype.getModelId = function () {
+ return this.presPoint.getModelId();
+ };
+
+function CConnectionDistanceResolver() {
+ this.connectionAlgorithms = [];
+ this.connectionDistance = null;
+}
+
+ CConnectionDistanceResolver.prototype.calcChildConnectionDistance = function () {
+ this.connectionDistance = -1;
+ const firstAlg = this.connectionAlgorithms[0];
+ if (firstAlg) {
+ const points = firstAlg.getConnectionPoints();
+ if (points.end && points.start) {
+ const v = new CVector(points.end.x - points.start.x, points.end.y - points.start.y);
+ this.connectionDistance = v.getDistance();
+ } else {
+ return;
+ }
+ }
+ for (let i = 1; i < this.connectionAlgorithms.length; i++) {
+ const alg = this.connectionAlgorithms[i];
+ const points = alg.getConnectionPoints();
+ if (points.end && points.start) {
+ const v = new CVector(points.end.x - points.start.x, points.end.y - points.start.y);
+ const distance = v.getDistance();
+ if (distance < this.connectionDistance) {
+ this.connectionDistance = distance;
+ }
+ }
+ }
+ };
+ CConnectionDistanceResolver.prototype.getConnectionDistance = function () {
+ if (this.connectionDistance === null) {
+ this.calcChildConnectionDistance();
+ }
+ return this.connectionDistance;
+ };
+ CConnectionDistanceResolver.prototype.addConnection = function (algorithm) {
+ this.connectionAlgorithms.push(algorithm);
+ }
+
+ function getShapePoint(bounds) {
+ return new CCoordPoint(bounds.l + (bounds.r - bounds.l) / 2, bounds.t + (bounds.b - bounds.t) / 2);
+ }
+ function getMinShapeEdgePoint(bounds, guideVector) {
+ if (bounds.isEllipse) {
+ return getMinCircleEdgePoint(bounds, guideVector);
+ } else {
+ return getMinRectEdgePoint(bounds, guideVector);
+ }
+ }
+ function resolveParameterLineAndShapeEquation(ellipseBounds, paramLine) {
+ const width = ellipseBounds.r - ellipseBounds.l;
+ const height = ellipseBounds.b - ellipseBounds.t;
+ const cw = width / 2;
+ const ch = height / 2;
+ const cx = cw + ellipseBounds.l;
+ const cy = ch + ellipseBounds.t;
+
+ const px = paramLine.ax;
+ const py = paramLine.ay;
+ const x1 = paramLine.x;
+ const y1 = paramLine.y;
+ const ch2 = ch * ch;
+ const cw2 = cw * cw;
+ const a = ch2 * px * px + cw2 * py * py;
+ const b = 2 * ch2 * px * (x1 - cx) + 2 * cw2 * py * (y1 - cy);
+ const c = ch2 * (cy * cy - 2 * cy * y1 + y1 * y1) + cw2 * (cx * cx - 2 * cx * x1 + x1 * x1) - cw2 * ch2;
+ return AscFormat.fSolveQuadraticEquation(a, b, c);
+ }
+
+ function getMinCircleEdgePoint(bounds, guideVector) {
+ const shapePoint = getShapePoint(bounds);
+ const line = getParametricLinEquation(shapePoint, guideVector);
+ const answer = resolveParameterLineAndShapeEquation(bounds, line);
+ if (answer.bError) {
+ return null;
+ }
+ const angle = guideVector.getAngle();
+
+ const xt1 = line.x + line.ax * answer.x1;
+ const yt1 = line.y + line.ay * answer.x1;
+
+ let edgeAngle = new CVector(xt1 - shapePoint.x, yt1 - shapePoint.y).getAngle();
+ if (AscFormat.fApproxEqual(edgeAngle, angle, algDelta)) {
+ return new CCoordPoint(xt1, yt1);
+ }
+
+ const xt2 = line.x + line.ax * answer.x2;
+ const yt2 = line.y + line.ay * answer.x2;
+
+ edgeAngle = new CVector(xt2 - shapePoint.x, yt2 - shapePoint.y).getAngle();
+ if (AscFormat.fApproxEqual(edgeAngle, angle, algDelta)) {
+ return new CCoordPoint(xt2, yt2);
+ }
+ }
+
+ function getMinRectEdgePoint(bounds, guideVector) {
+ const shapePoint = getShapePoint(bounds);
+ const centerAngle = guideVector.getAngle();
+ let checkEdges = [
+ [new CCoordPoint(bounds.l, bounds.t), new CCoordPoint(bounds.r, bounds.t)],
+ [new CCoordPoint(bounds.r, bounds.t), new CCoordPoint(bounds.r, bounds.b)],
+ [new CCoordPoint(bounds.l, bounds.t), new CCoordPoint(bounds.l, bounds.b)],
+ [new CCoordPoint(bounds.l, bounds.b), new CCoordPoint(bounds.r, bounds.b)]
+ ];
+ for (let i = 0; i < checkEdges.length; i += 1) {
+ const edge = checkEdges[i];
+ const point = getRectEdgePoint(shapePoint, guideVector, edge[0], edge[1]);
+ if (point) {
+ const edgeGuideVector = new CVector(point.x - shapePoint.x, point.y - shapePoint.y);
+ const edgeAngle = edgeGuideVector.getAngle();
+ if (AscFormat.fApproxEqual(edgeAngle, centerAngle, algDelta)) {
+ return point;
+ }
+ }
+ }
+ }
+ function getParametricLinEquation(startPoint, guideVector) {
+ const len = guideVector.getDistance();
+ return {
+ x: startPoint.x,
+ ax: guideVector.x / len,
+ y: startPoint.y,
+ ay: guideVector.y / len
+ };
+ }
+ function getRectEdgePoint(linePoint, guideVector, rectEdgePoint1, rectEdgePoint2) {
+ const line1 = getParametricLinEquation(linePoint, guideVector);
+ const line2 = getParametricLinEquation(rectEdgePoint1, new CVector(rectEdgePoint2.x - rectEdgePoint1.x, rectEdgePoint2.y - rectEdgePoint1.y));
+ return getIntersectionLines(line1, line2, rectEdgePoint1, rectEdgePoint2);
+ }
+ function getIntersectionLines(line1, line2, rectEdgePoint1, rectEdgePoint2) {
+ const divider = line1.ay * line2.ax - line1.ax * line2.ay;
+ if (divider === 0) {
+ return null;
+ }
+ const parameter = (line1.ax * (line2.y - line1.y) - line1.ay * (line2.x - line1.x)) / divider;
+ const x = line2.x + line2.ax * parameter;
+ const y = line2.y + line2.ay * parameter;
+ if (((x > rectEdgePoint1.x && x < rectEdgePoint2.x) || AscFormat.fApproxEqual(x, rectEdgePoint2.x, algDelta) || AscFormat.fApproxEqual(x, rectEdgePoint1.x, algDelta))
+ && ((y > rectEdgePoint1.y && y < rectEdgePoint2.y) || AscFormat.fApproxEqual(y, rectEdgePoint2.y, algDelta) || AscFormat.fApproxEqual(y, rectEdgePoint1.y, algDelta))) {
+ return new CCoordPoint(x, y);
+ }
+ return null;
+ }
+
+ // document.body.addEventListener('keydown', function (e) {
+ // if (e.ctrlKey && e.altKey && e.keyCode === 82) {
+ // const oSM = editor.getGraphicController().selectedObjects[0];
+ // const smartArtAlgorithm = new SmartArtAlgorithm(oSM);
+ // smartArtAlgorithm.startFromBegin();
+ // const drawing = oSM.spTree[0];
+ // const shapeLength = drawing.spTree.length;
+ // for (let i = 0; i < shapeLength; i++) {
+ // drawing.removeFromSpTreeByPos(0);
+ // }
+ // const shapes = smartArtAlgorithm.getShapes();
+ //
+ // for (let i = shapes.length - 1; i >= 0; i -= 1) {
+ // drawing.addToSpTree(0, shapes[i]);
+ // }
+ //
+ // oSM.recalculate();
+ //
+ // editor.getLogicDocument().Recalculate();
+ // oSM.fitFontSize();
+ // editor.getLogicDocument().Recalculate();
+ // }
+ // });
+
+ AscFormat.SmartArtAlgorithm = SmartArtAlgorithm;
+})(window);
+
diff --git a/common/TableId.js b/common/TableId.js
index f125e4e2e5..73ac203b6e 100644
--- a/common/TableId.js
+++ b/common/TableId.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -51,14 +51,14 @@
{
return this.isInit;
};
- CTableId.prototype.init = function()
+ CTableId.prototype.init = function(editor)
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.m_oFactoryClass = {};
this.Id = AscCommon.g_oIdCounter.Get_NewId();
this.Add(this, this.Id);
- this.private_InitFactoryClass();
+ this.private_InitFactoryClass(editor);
this.isInit = true;
};
CTableId.prototype.Add = function(Class, Id)
@@ -145,7 +145,7 @@
delete this.m_aPairs[sId];
}
};
- CTableId.prototype.private_InitFactoryClass = function()
+ CTableId.prototype.private_InitFactoryClass = function(editor)
{
this.m_oFactoryClass[AscDFH.historyitem_type_Paragraph] = AscWord.Paragraph;
this.m_oFactoryClass[AscDFH.historyitem_type_TextPr] = AscCommonWord.ParaTextPr;
@@ -308,8 +308,6 @@
this.m_oFactoryClass[AscDFH.historyitem_type_LayoutDef ] = AscFormat.LayoutDef;
this.m_oFactoryClass[AscDFH.historyitem_type_CatLst ] = AscFormat.CatLst;
this.m_oFactoryClass[AscDFH.historyitem_type_SCat ] = AscFormat.SCat;
- this.m_oFactoryClass[AscDFH.historyitem_type_ClrData ] = AscFormat.ClrData;
- this.m_oFactoryClass[AscDFH.historyitem_type_Desc ] = AscFormat.Desc;
this.m_oFactoryClass[AscDFH.historyitem_type_LayoutNode ] = AscFormat.LayoutNode;
this.m_oFactoryClass[AscDFH.historyitem_type_Alg ] = AscFormat.Alg;
this.m_oFactoryClass[AscDFH.historyitem_type_Param ] = AscFormat.Param;
@@ -341,12 +339,6 @@
this.m_oFactoryClass[AscDFH.historyitem_type_ColorsDef ] = AscFormat.ColorsDef;
this.m_oFactoryClass[AscDFH.historyitem_type_ColorDefStyleLbl ] = AscFormat.ColorDefStyleLbl;
this.m_oFactoryClass[AscDFH.historyitem_type_ClrLst ] = AscFormat.ClrLst;
- this.m_oFactoryClass[AscDFH.historyitem_type_EffectClrLst ] = AscFormat.EffectClrLst;
- this.m_oFactoryClass[AscDFH.historyitem_type_FillClrLst ] = AscFormat.FillClrLst;
- this.m_oFactoryClass[AscDFH.historyitem_type_LinClrLst ] = AscFormat.LinClrLst;
- this.m_oFactoryClass[AscDFH.historyitem_type_TxEffectClrLst ] = AscFormat.TxEffectClrLst;
- this.m_oFactoryClass[AscDFH.historyitem_type_TxFillClrLst ] = AscFormat.TxFillClrLst;
- this.m_oFactoryClass[AscDFH.historyitem_type_TxLinClrLst ] = AscFormat.TxLinClrLst;
this.m_oFactoryClass[AscDFH.historyitem_type_ColorsDefHdr ] = AscFormat.ColorsDefHdr;
this.m_oFactoryClass[AscDFH.historyitem_type_ColorsDefHdrLst ] = AscFormat.ColorsDefHdrLst;
this.m_oFactoryClass[AscDFH.historyitem_type_StyleDef ] = AscFormat.StyleDef;
@@ -368,7 +360,6 @@
this.m_oFactoryClass[AscDFH.historyitem_type_StyleDefHdrLst ] = AscFormat.StyleDefHdrLst;
this.m_oFactoryClass[AscDFH.historyitem_type_StyleDefHdr ] = AscFormat.StyleDefHdr;
this.m_oFactoryClass[AscDFH.historyitem_type_BackdropAnchor ] = AscFormat.BackdropAnchor;
- this.m_oFactoryClass[AscDFH.historyitem_type_StyleData ] = AscFormat.StyleData;
this.m_oFactoryClass[AscDFH.historyitem_type_SampData ] = AscFormat.SampData;
this.m_oFactoryClass[AscDFH.historyitem_type_ForEach ] = AscFormat.ForEach;
this.m_oFactoryClass[AscDFH.historyitem_type_ResizeHandles ] = AscFormat.ResizeHandles;
@@ -379,16 +370,13 @@
this.m_oFactoryClass[AscDFH.historyitem_type_ExtrusionClr ] = AscFormat.ExtrusionClr;
this.m_oFactoryClass[AscDFH.historyitem_type_ContourClr ] = AscFormat.ContourClr;
this.m_oFactoryClass[AscDFH.historyitem_type_SmartArt ] = AscFormat.SmartArt;
- this.m_oFactoryClass[AscDFH.historyitem_type_CCommonDataClrList] = AscFormat.CCommonDataClrList;
this.m_oFactoryClass[AscDFH.historyitem_type_BuNone ] = AscFormat.BuNone;
this.m_oFactoryClass[AscDFH.historyitem_type_SmartArtDrawing ] = AscFormat.Drawing;
this.m_oFactoryClass[AscDFH.historyitem_type_DiagramData ] = AscFormat.DiagramData;
this.m_oFactoryClass[AscDFH.historyitem_type_FunctionValue ] = AscFormat.FunctionValue;
- this.m_oFactoryClass[AscDFH.historyitem_type_ShapeSmartArtInfo ] = AscFormat.ShapeSmartArtInfo;
- this.m_oFactoryClass[AscDFH.historyitem_type_SmartArtTree ] = AscFormat.SmartArtTree;
- this.m_oFactoryClass[AscDFH.historyitem_type_SmartArtNode ] = AscFormat.SmartArtNode;
- this.m_oFactoryClass[AscDFH.historyitem_type_SmartArtNodeData ] = AscFormat.SmartArtNodeData;
this.m_oFactoryClass[AscDFH.historyitem_type_BuBlip ] = AscFormat.CBuBlip;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ParagraphPermStart] = AscWord.ParagraphPermStart;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ParagraphPermEnd ] = AscWord.ParagraphPermEnd;
if (window['AscCommonSlide'])
{
@@ -461,6 +449,10 @@
this.m_oFactoryClass[AscDFH.historyitem_type_Theme] = AscFormat.CTheme;
this.m_oFactoryClass[AscDFH.historyitem_type_GraphicFrame] = AscFormat.CGraphicFrame;
+
+ this.m_oFactoryClass[AscDFH.historyitem_type_CustomProperties] = AscCommon.CCustomProperties;
+
+
if (window['AscCommonExcel'])
{
this.m_oFactoryClass[AscDFH.historyitem_type_Sparkline] = AscCommonExcel.sparklineGroup;
@@ -478,7 +470,84 @@
}
+ if (editor && editor.isPdfEditor())
+ {
+ this.m_oFactoryClass[AscDFH.historyitem_type_Shape] = AscPDF.CPdfShape;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GraphicFrame] = AscPDF.CPdfGraphicFrame;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ImageShape] = AscPDF.CPdfImage;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Cnx] = AscPDF.CPdfConnectionShape;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_Text] = AscPDF.CAnnotationText;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_Ink] = AscPDF.CAnnotationInk;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_Highlight] = AscPDF.CAnnotationHighlight;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_Underline] = AscPDF.CAnnotationUnderline;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_Strikeout] = AscPDF.CAnnotationStrikeout;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_FreeText] = AscPDF.CAnnotationFreeText;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Page] = AscPDF.CPageInfo;
+ }
+
this.m_oFactoryClass[AscDFH.historyitem_type_DocumentMacros] = AscCommon.CDocumentMacros;
+
+
+ this.m_oFactoryClass[AscDFH.historyitem_type_Address] = AscFormat.CAddress;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Axis] = AscFormat.CAxis;
+ this.m_oFactoryClass[AscDFH.historyitem_type_AxisUnits] = AscFormat.CAxisUnits;
+ this.m_oFactoryClass[AscDFH.historyitem_type_AxisUnitsLabel] = AscFormat.CAxisUnitsLabel;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Binning] = AscFormat.CBinning;
+ this.m_oFactoryClass[AscDFH.historyitem_type_CategoryAxisScaling] = AscFormat.CCategoryAxisScaling;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ChartData] = AscFormat.CChartData;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Clear] = AscFormat.CClear;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Copyrights] = AscFormat.CCopyrights;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Data] = AscFormat.CData;
+ this.m_oFactoryClass[AscDFH.historyitem_type_DataLabel] = AscFormat.CDataLabel;
+ this.m_oFactoryClass[AscDFH.historyitem_type_DataLabelHidden] = AscFormat.CDataLabelHidden;
+ this.m_oFactoryClass[AscDFH.historyitem_type_DataLabels] = AscFormat.CDataLabels;
+ this.m_oFactoryClass[AscDFH.historyitem_type_DataLabelVisibilities] = AscFormat.CDataLabelVisibilities;
+ this.m_oFactoryClass[AscDFH.historyitem_type_DataPoint] = AscFormat.CDataPoint;
+ this.m_oFactoryClass[AscDFH.historyitem_type_FormatOverride] = AscFormat.CFormatOverride;
+ this.m_oFactoryClass[AscDFH.historyitem_type_FormatOverrides] = AscFormat.CFormatOverrides;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Formula] = AscFormat.CFormula;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoCache] = AscFormat.CGeoCache;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoChildEntities] = AscFormat.CGeoChildEntities;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoChildEntitiesQuery] = AscFormat.CGeoChildEntitiesQuery;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoChildEntitiesQueryResult] = AscFormat.CGeoChildEntitiesQueryResult;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoChildEntitiesQueryResults] = AscFormat.CGeoChildEntitiesQueryResults;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoChildTypes] = AscFormat.CGeoChildTypes;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoData] = AscFormat.CGeoData;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataEntityQuery] = AscFormat.CGeoDataEntityQuery;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataEntityQueryResult] = AscFormat.CGeoDataEntityQueryResult;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataEntityQueryResults] = AscFormat.CGeoDataEntityQueryResults;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataPointQuery] = AscFormat.CGeoDataPointQuery;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataPointToEntityQuery] = AscFormat.CGeoDataPointToEntityQuery;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataPointToEntityQueryResult] = AscFormat.CGeoDataPointToEntityQueryResult;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoDataPointToEntityQueryResults] = AscFormat.CGeoDataPointToEntityQueryResults;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Geography] = AscFormat.CGeography;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoHierarchyEntity] = AscFormat.CGeoHierarchyEntity;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoLocation] = AscFormat.CGeoLocation;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoLocationQuery] = AscFormat.CGeoLocationQuery;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoLocationQueryResult] = AscFormat.CGeoLocationQueryResult;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoLocationQueryResults] = AscFormat.CGeoLocationQueryResults;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoLocations] = AscFormat.CGeoLocations;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoPolygon] = AscFormat.CGeoPolygon;
+ this.m_oFactoryClass[AscDFH.historyitem_type_GeoPolygons] = AscFormat.CGeoPolygons;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Gridlines] = AscFormat.CGridlines;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Dimension] = AscFormat.CDimension;
+ this.m_oFactoryClass[AscDFH.historyitem_type_NumericDimension] = AscFormat.CNumericDimension;
+ this.m_oFactoryClass[AscDFH.historyitem_type_PercentageColorPosition] = AscFormat.CPercentageColorPosition;
+ this.m_oFactoryClass[AscDFH.historyitem_type_PlotAreaRegion] = AscFormat.CPlotAreaRegion;
+ this.m_oFactoryClass[AscDFH.historyitem_type_PlotSurface] = AscFormat.CPlotSurface;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Series] = AscFormat.CSeries;
+ this.m_oFactoryClass[AscDFH.historyitem_type_SeriesElementVisibilities] = AscFormat.CSeriesElementVisibilities;
+ this.m_oFactoryClass[AscDFH.historyitem_type_SeriesLayoutProperties] = AscFormat.CSeriesLayoutProperties;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Statistics] = AscFormat.CStatistics;
+ this.m_oFactoryClass[AscDFH.historyitem_type_StringDimension] = AscFormat.CStringDimension;
+ this.m_oFactoryClass[AscDFH.historyitem_type_Subtotals] = AscFormat.CSubtotals;
+ this.m_oFactoryClass[AscDFH.historyitem_type_TextData] = AscFormat.CTextData;
+ this.m_oFactoryClass[AscDFH.historyitem_type_TickMarks] = AscFormat.CTickMarks;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ValueAxisScaling] = AscFormat.CValueAxisScaling;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ValueColorEndPosition] = AscFormat.CValueColorEndPosition;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ValueColorMiddlePosition] = AscFormat.CValueColorMiddlePosition;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ValueColorPositions] = AscFormat.CValueColorPositions;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ValueColors] = AscFormat.CValueColors;
this.InitOFormClasses();
};
diff --git a/common/TableIdChanges.js b/common/TableIdChanges.js
index 873b92ffad..4b20216dfd 100644
--- a/common/TableIdChanges.js
+++ b/common/TableIdChanges.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/actionOnTimer.js b/common/api/actionOnTimer.js
index 738da9a722..56dd233cd8 100644
--- a/common/api/actionOnTimer.js
+++ b/common/api/actionOnTimer.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -95,6 +95,15 @@
this.OnEnd();
}
};
+ CActionOnTimerBase.prototype.Stop = function()
+ {
+ this.Reset();
+ this.Start = false;
+ };
+ CActionOnTimerBase.prototype.IsInProgress = function()
+ {
+ return this.Start;
+ };
CActionOnTimerBase.prototype.Reset = function()
{
if (this.TimerId)
diff --git a/common/api/addTextSettings.js b/common/api/addTextSettings.js
index cecc675267..f72b22f2bf 100644
--- a/common/api/addTextSettings.js
+++ b/common/api/addTextSettings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/auto-hyphenation-settings.js b/common/api/auto-hyphenation-settings.js
index b6af1360a8..b7556ed7ba 100644
--- a/common/api/auto-hyphenation-settings.js
+++ b/common/api/auto-hyphenation-settings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/autoCorrectSettings.js b/common/api/autoCorrectSettings.js
index cace6ad6a0..ebf67acaf5 100644
--- a/common/api/autoCorrectSettings.js
+++ b/common/api/autoCorrectSettings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/firstLetterExceptions.js b/common/api/firstLetterExceptions.js
index 16b1726934..dd43972127 100644
--- a/common/api/firstLetterExceptions.js
+++ b/common/api/firstLetterExceptions.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/restrictionSettings.js b/common/api/restrictionSettings.js
index fac6ba05ac..9a731f4186 100644
--- a/common/api/restrictionSettings.js
+++ b/common/api/restrictionSettings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/searchSettings.js b/common/api/searchSettings.js
index 3f9de0201c..87f0136d32 100644
--- a/common/api/searchSettings.js
+++ b/common/api/searchSettings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/spellCheckSettings.js b/common/api/spellCheckSettings.js
index 72b575997c..dd07abeaf6 100644
--- a/common/api/spellCheckSettings.js
+++ b/common/api/spellCheckSettings.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/api/tableStylesPreviewGenerator.js b/common/api/tableStylesPreviewGenerator.js
index 29dc8957a1..ac84a98a39 100644
--- a/common/api/tableStylesPreviewGenerator.js
+++ b/common/api/tableStylesPreviewGenerator.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/apiBase.js b/common/apiBase.js
index ede25b3c84..13e029c116 100644
--- a/common/apiBase.js
+++ b/common/apiBase.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -85,6 +85,7 @@
this.documentShardKey = undefined;
this.documentWopiSrc = undefined;
this.documentIsWopi = false;
+ this.documentUserSessionId = undefined;
this.documentOpenOptions = undefined; // Опции при открытии (пока только опции для CSV)
@@ -166,7 +167,6 @@
this.forceSaveButtonContinue = false;
this.forceSaveTimeoutTimeout = null;
this.forceSaveForm = null;
- this.disconnectOnSave = null;
this.disconnectRestrictions = null;//to restore restrictions after disconnect
this.forceSaveUndoRequest = false; // Флаг нужен, чтобы мы знали, что данное сохранение пришло по запросу Undo в совместке
@@ -230,7 +230,8 @@
this.binaryChanges = false;
this.isBlurEditor = false;
-
+
+ this.builderFonts = {};
this.formatPainter = new AscCommon.CFormatPainter(this);
this.eyedropper = new AscCommon.CEyedropper(this);
@@ -305,7 +306,11 @@
if(t.isDocumentLoadComplete) {
//todo disconnect and downloadAs ability
t.sendEvent("asc_onError", Asc.c_oAscError.ID.EditingError, c_oAscError.Level.NoCritical);
- t.asc_setViewMode(true);
+ if (t.isCoAuthoringEnable) {
+ t.asc_coAuthoringDisconnect();
+ } else {
+ t.asc_setViewMode(true);
+ }
}
else {
t.sendEvent("asc_onError", Asc.c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
@@ -485,6 +490,12 @@
//чтобы в versionHistory был один documentId для auth и open
this.CoAuthoringApi.setDocId(this.documentId);
+ if (this.DocInfo.get_Wopi())
+ {
+ this.documentWopiSrc = this.DocInfo.get_Wopi()["WOPISrc"];
+ this.documentUserSessionId = this.DocInfo.get_Wopi()["UserSessionId"];
+ this.documentIsWopi = true;
+ }
if (this.documentOpenOptions)
{
if (this.documentOpenOptions["watermark"])
@@ -498,16 +509,10 @@
window["Asc"]["Addons"]["forms"] = false;
AscCommon.g_oTableId.InitOFormClasses();
}
-
- if (this.documentOpenOptions[Asc.c_sWopiSrcName])
- {
- this.documentWopiSrc = this.documentOpenOptions[Asc.c_sWopiSrcName];
- this.documentIsWopi = true;
- }
}
if (!this.documentWopiSrc) {
//todo add tenant in origin?
- this.documentShardKey = this.documentId;
+ this.documentShardKey = this.DocInfo.get_Shardkey() || this.documentId;
}
}
@@ -689,6 +694,7 @@
this.restrictions = val;
this.onUpdateRestrictions(additionalSettings);
this.checkInputMode();
+ this.sendEvent("asc_onChangeRestrictions", this.restrictions);
};
baseEditorsApi.prototype.getViewMode = function()
{
@@ -699,12 +705,14 @@
this.restrictions |= val;
this.onUpdateRestrictions();
this.checkInputMode();
+ this.sendEvent("asc_onChangeRestrictions", this.restrictions);
};
baseEditorsApi.prototype.asc_removeRestriction = function(val)
{
this.restrictions &= ~val;
this.onUpdateRestrictions();
this.checkInputMode();
+ this.sendEvent("asc_onChangeRestrictions", this.restrictions);
};
baseEditorsApi.prototype.asc_setCanSendChanges = function(canSend)
{
@@ -1032,11 +1040,8 @@
{
this.sendEvent("asc_onPrint");
};
- // Open
- baseEditorsApi.prototype.asc_LoadDocument = function(versionHistory, isRepeat)
+ baseEditorsApi.prototype._getOpenCmd = function(versionHistory)
{
- // Меняем тип состояния (на открытие)
- this.advancedOptionsAction = AscCommon.c_oAscAdvancedOptionsAction.Open;
var rData = null;
if (!(this.DocInfo && this.DocInfo.get_OfflineApp()))
{
@@ -1049,7 +1054,7 @@
}
}
let convertToOrigin = '';
- if (!!this.DocInfo.get_DirectUrl() && this["asc_isSupportFeature"]("ooxml")) {
+ if (!!(this.DocInfo && this.DocInfo.get_DirectUrl()) && this["asc_isSupportFeature"]("ooxml")) {
convertToOrigin = '.docx.xlsx.pptx';
}
@@ -1073,15 +1078,25 @@
if (versionHistory)
{
rData["serverVersion"] = versionHistory.serverVersion;
- rData["closeonerror"] = versionHistory.isRequested;
+ rData["closeonerror"] = versionHistory.isRequested;
rData["tokenHistory"] = versionHistory.token;
//чтобы результат пришел только этому соединению, а не всем кто в документе
rData["userconnectionid"] = this.CoAuthoringApi.getUserConnectionId();
}
}
+ return rData;
+ }
+ // Open
+ baseEditorsApi.prototype.asc_LoadDocument = function(versionHistory, isRepeat)
+ {
+ // Меняем тип состояния (на открытие)
+ this.advancedOptionsAction = AscCommon.c_oAscAdvancedOptionsAction.Open;
+
+ let rData = this._getOpenCmd(versionHistory);
if (versionHistory) {
this.CoAuthoringApi.versionHistory(rData);
} else {
+ //todo auth on connection
this.CoAuthoringApi.auth(this.getViewMode(), rData);
}
@@ -1173,7 +1188,7 @@
{
// здесь прокинуть евент о заморозке меню
};
- baseEditorsApi.prototype.asyncImagesDocumentStartLoaded = function()
+ baseEditorsApi.prototype.asyncImagesDocumentStartLoaded = function(aImages)
{
// евент о заморозке не нужен... оно и так заморожено
// просто нужно вывести информацию в статус бар (что началась загрузка картинок)
@@ -1314,6 +1329,9 @@
baseEditorsApi.prototype._haveOtherChanges = function () {
return false;
};
+ baseEditorsApi.prototype._haveChanges = function() {
+ return AscCommon.History.Have_Changes();
+ };
baseEditorsApi.prototype._onSaveCallback = function (e) {
var t = this;
var nState;
@@ -1552,6 +1570,8 @@
// CoAuthoring
baseEditorsApi.prototype._coAuthoringInit = function()
{
+ this.initCollaborativeEditing();
+
var t = this;
//Если User не задан, отключаем коавторинг.
if (null == this.User || null == this.User.asc_getId())
@@ -1606,6 +1626,7 @@
if (!t.isOnLoadLicense) {
t._onEndPermissions();
} else {
+ //todo auth on connection
if (t.CoAuthoringApi.get_isAuth()) {
t.CoAuthoringApi.auth(t.getViewMode(), undefined, t.isIdle());
} else {
@@ -1666,25 +1687,19 @@
var reason = data["reason"];
var interval = data["interval"];
var extendSession = true;
- if (c_oCloseCode.sessionIdle == code) {
+ if (c_oCloseCode.sessionIdle === code) {
var idleTime = t.isIdle();
if (idleTime > interval) {
extendSession = false;
} else {
t.CoAuthoringApi.extendSession(idleTime);
}
- } else if (c_oCloseCode.sessionAbsolute == code) {
+ } else if (c_oCloseCode.sessionAbsolute === code) {
extendSession = false;
}
if (!extendSession) {
- if (t.asc_Save(false, true)) {
- //enter view mode because save async
- t.setViewModeDisconnect(AscCommon.getEnableDownloadByCloseCode(code));
- t.disconnectOnSave = {code: code, reason: reason};
- } else {
- t.CoAuthoringApi.sendClientLog('debug', 'disconnect code:' + code + ';reason:' + reason);
- t.CoAuthoringApi.disconnect(code, reason);
- }
+ t.CoAuthoringApi.sendClientLog('debug', 'disconnect code:' + code + ';reason:' + reason);
+ t.CoAuthoringApi.disconnect(code, reason);
}
};
this.CoAuthoringApi.onForceSave = function(data) {
@@ -1788,7 +1803,8 @@
{
t.asyncServerIdEndLoaded();
}
- if (null != opt_closeCode) {
+ let isSessionIdleDisconnect = AscCommon.c_oCloseCode.sessionIdle === opt_closeCode;
+ if (null != opt_closeCode && !isSessionIdleDisconnect) {
if (null !== t.disconnectRestrictions) {
t.sync_EndAction(Asc.c_oAscAsyncActionType.Information, Asc.c_oAscAsyncAction.Disconnect);
t.asc_setRestriction(t.disconnectRestrictions);
@@ -1806,6 +1822,11 @@
t.disconnectRestrictions = t.restrictions;
t.sync_StartAction(Asc.c_oAscAsyncActionType.Information, Asc.c_oAscAsyncAction.Disconnect);
t.asc_setRestriction(Asc.c_oAscRestrictionType.View);
+ if (isSessionIdleDisconnect) {
+ t.waitNotIdle(undefined, function () {
+ t.CoAuthoringApi.connect();
+ });
+ }
}
};
this.CoAuthoringApi.onDocumentOpen = function (inputWrap) {
@@ -1904,7 +1925,9 @@
};
this._coAuthoringInitEnd();
- this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', this.editorId, this.documentFormatSave, this.DocInfo, this.documentShardKey, this.documentWopiSrc);
+
+ let openCmd = this._getOpenCmd();
+ this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', this.editorId, this.documentFormatSave, this.DocInfo, this.documentShardKey, this.documentWopiSrc, this.documentUserSessionId, openCmd);
};
baseEditorsApi.prototype._coAuthoringInitEnd = function()
{
@@ -2145,6 +2168,7 @@
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(options.fileType), Asc.c_nMaxDownloadTitleLen);
oAdditionalData["nobase64"] = isNoBase64;
oAdditionalData["isSaveAs"] = options.isSaveAs;
+ oAdditionalData["saveAsPath"] = options.wopiSaveAsPath;
let locale = this.asc_getLocale() || undefined;
if (typeof locale === "string") {
locale = Asc.g_oLcidNameToIdMap[locale];
@@ -2308,6 +2332,13 @@
{
return this.textArtPreviewManager.getWordArtPreviews();
};
+ baseEditorsApi.prototype.isUseOldMobileVersion = function()
+ {
+ if (!this.isMobileVersion)
+ return false;
+ // return true for old scheme
+ return false;
+ };
// Add image
baseEditorsApi.prototype.AddImageUrl = function(urls, imgProp, token, obj)
{
@@ -2355,7 +2386,7 @@
var t = this;
if (this.WordControl) // после показа диалога может не прийти mouseUp
this.WordControl.m_bIsMouseLock = false;
- AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), this.documentShardKey, this.documentWopiSrc, function(error, files)
+ AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), this.documentShardKey, this.documentWopiSrc, this.documentUserSessionId, function(error, files)
{
t._uploadCallback(error, files, obj);
}, function(error)
@@ -2388,7 +2419,7 @@
}
obj && obj.fStartUploadImageCallback && obj.fStartUploadImageCallback();
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
- AscCommon.UploadImageFiles(files, this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), this.documentShardKey, this.documentWopiSrc, function(error, urls)
+ AscCommon.UploadImageFiles(files, this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), this.documentShardKey, this.documentWopiSrc, this.documentUserSessionId, function(error, urls)
{
if (c_oAscError.ID.No !== error)
{
@@ -2614,12 +2645,16 @@
AscCommon.CollaborativeEditing.Apply_Changes();
}
};
+ baseEditorsApi.prototype.getVersionHistory = function()
+ {
+ return this.VersionHistory;
+ };
baseEditorsApi.prototype.asc_undoAllChanges = function()
{
};
baseEditorsApi.prototype.asc_getAdvancedOptions = function () {
var cp = {
- 'codepage' : AscCommon.c_oAscCodePageUtf8,
+ 'codepage' : AscCommon.c_oAscCodePageNone,
'encodings' : AscCommon.getEncodingParams()
};
return new AscCommon.asc_CAdvancedOptions(cp);
@@ -2645,7 +2680,7 @@
if (this.canSave && this._saveCheck() && this.canSendChanges()) {
this.IsUserSave = !isAutoSave;
- if (this.asc_isDocumentCanSave() || AscCommon.History.Have_Changes() || this._haveOtherChanges() ||
+ if (this.asc_isDocumentCanSave() || this._haveChanges() || this._haveOtherChanges() ||
this.canUnlockDocument || this.forceSaveUndoRequest) {
if (this._prepareSave(isIdle)) {
// Не даем пользователю сохранять, пока не закончится сохранение (если оно началось)
@@ -2786,6 +2821,14 @@
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenFormat, c_oAscError.Level.Critical, errorData);
return;
}
+ if (this.VersionHistory && this.VersionHistory.documentSha256) {
+ let sha256 = AscCommon.Digest.sha256(this.openResult.data, 0, this.openResult.data.length);
+ if (this.VersionHistory.documentSha256 !== AscCommon.Hex.encode(sha256) ) {
+ this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
+ this.sendEvent("asc_onError", c_oAscError.ID.DocumentAndChangeMismatch, c_oAscError.Level.Critical);
+ return;
+ }
+ }
this.openDocument(this.openResult);
this.sendEvent("asc_onDocumentPassword", ("" !== this.currentPassword));
@@ -2795,7 +2838,8 @@
};
baseEditorsApi.prototype._onEndLoadSdk = function()
{
- AscCommon.g_oTableId.init();
+ AscCommon.g_oTableId.init(this);
+ this.initCollaborativeEditing();
// init drag&drop
var t = this;
@@ -2830,6 +2874,9 @@
this.checkDocumentTitleFonts();
};
+ baseEditorsApi.prototype.initCollaborativeEditing = function()
+ {
+ };
baseEditorsApi.prototype.checkDocumentTitleFonts = function() {
if (!AscFonts.FontPickerByCharacter || !this.documentTitle)
return;
@@ -3280,8 +3327,36 @@
{
return this.asc_canPaste();
};
- baseEditorsApi.prototype.onEndBuilderScript = function()
+ baseEditorsApi.prototype.onEndBuilderScript = function(callback)
+ {
+ let _t = this;
+ this.loadBuilderFonts(function()
+ {
+ return _t._onEndBuilderScript(callback);
+ });
+
+ return true;
+ };
+ baseEditorsApi.prototype.addBuilderFont = function(fontName)
{
+ this.builderFonts[fontName] = true;
+ };
+ baseEditorsApi.prototype.loadBuilderFonts = function(callback)
+ {
+ let _t = this;
+ this.incrementCounterLongAction();
+ AscCommon.g_font_loader.LoadFonts(this.builderFonts, function(){
+ _t.decrementCounterLongAction();
+ callback();
+ });
+ this.builderFonts = {};
+ };
+ baseEditorsApi.prototype._onEndBuilderScript = function(callback)
+ {
+ // This method is intended to be overridden
+ if (callback)
+ callback(true);
+
return true;
};
@@ -3736,15 +3811,29 @@
if (!this.canSave || !this._saveCheck())
return 0;
- if (this.isPdfEditor())
- return 0;
-
//viewer
- if (this.isViewMode)
+ if (this.isViewMode || this.isPdfViewer)
return 0;
return new Date().getTime() - this.lastWorkTime;
};
+ baseEditorsApi.prototype.waitNotIdle = function (lastWorkTime, callback)
+ {
+ let t = this;
+ //todo remove first timeout
+ //start with timeout to aviod lastWorkTime update on:
+ //onDisconnect -> asc_setRestriction -> checkLastWork and CheckTargetUpdate -> checkLastWork
+ setTimeout(function () {
+ if (undefined === lastWorkTime) {
+ lastWorkTime = t.getLastWork();
+ }
+ if (lastWorkTime < t.getLastWork()) {
+ callback();
+ } else {
+ t.waitNotIdle(lastWorkTime, callback);
+ }
+ }, 100);
+ }
baseEditorsApi.prototype.checkInterfaceElementBlur = function()
{
@@ -3760,6 +3849,11 @@
document.activeElement.dispatchEvent(e);
};
+
+ baseEditorsApi.prototype.getLastWork = function()
+ {
+ return this.lastWorkTime;
+ };
baseEditorsApi.prototype.checkLastWork = function()
{
this.lastWorkTime = new Date().getTime();
@@ -3775,9 +3869,10 @@
baseEditorsApi.prototype.asc_setCurrentPassword = function(password)
{
+ this.currentPasswordOld = this.currentPassword;
this.currentPassword = password;
this.asc_Save(false, undefined, true);
- if (!(this.DocInfo && this.DocInfo.get_OfflineApp())) {
+ if (!(this.DocInfo && this.DocInfo.get_OfflineApp()) && !this.isViewMode && !this.isPdfViewer) {
var rData = {
"c": 'setpassword',
"id": this.documentId,
@@ -4469,6 +4564,10 @@
this.updateDarkMode();
};
+ baseEditorsApi.prototype.canEnterText = function()
+ {
+ return this.canEdit();
+ };
baseEditorsApi.prototype.updateDarkMode = function()
{
};
@@ -5024,6 +5123,8 @@
if (types && types[i] && types[i].prototype && types[i].prototype.fromCValue)
arguments[i] = types[i].prototype.fromCValue(arguments[i]);
}
+ if (!this[name])
+ console.log("Wrap unexisted function: " + name);
let result = this[name].apply(this, arguments);
if (result && result.toCValue)
result = result.toCValue();
@@ -5031,19 +5132,73 @@
}
};
- baseEditorsApi.prototype.wrapEvent = function(name)
+ baseEditorsApi.prototype.wrapEvent = function(name)
{
- this.asc_registerCallback(name, function()
- {
- for (let i = 0, len = arguments.length; i < len; i++)
+ var wrapArray = function(args) {
+ let arrayResult = new Array(args.length);
+ for (let i = 0, len = args.length; i < len; i++)
{
- if (arguments[i] && arguments[i].toCValue)
- arguments[i] = arguments[i].toCValue();
+ arrayResult[i] = args[i];
+ if (!args[i])
+ continue;
+ if (args[i].toCValue)
+ arrayResult[i] = args[i].toCValue();
+ else if (Array.isArray(args[i]))
+ arrayResult[i] = wrapArray(args[i]);
}
- window["native"]["onJsEvent"](name, Array.from(arguments));
+ return arrayResult;
+ };
+
+ this.asc_registerCallback(name, function()
+ {
+ window["native"]["onJsEvent"](name, wrapArray(arguments));
});
};
+ baseEditorsApi.prototype.setPluginsOptions = function(options)
+ {
+ this.externalPluginsOptions = options;
+
+ if (window.g_asc_plugins)
+ window.g_asc_plugins.onUpdateOptions();
+ };
+
+ baseEditorsApi.prototype.getCustomProperties = function() {
+ return null;
+ };
+
+ baseEditorsApi.prototype.asc_getAllCustomProperties = function() {
+ let oCustomProperties = this.getCustomProperties();
+ if(!oCustomProperties) return [];
+ return oCustomProperties.getAllProperties();
+ };
+
+ baseEditorsApi.prototype.asc_addCustomProperty = function(name, type, value) {
+ this.addCustomProperty(name, type, value);
+ };
+
+ baseEditorsApi.prototype.asc_modifyCustomProperty = function(idx, name, type, value) {
+ this.modifyCustomProperty(idx, name, type, value);
+ };
+
+
+ baseEditorsApi.prototype.asc_removeCustomProperty = function(idx) {
+ this.removeCustomProperty(idx);
+ };
+
+ baseEditorsApi.prototype.addCustomProperty = function(name, type, value) {
+ };
+
+ baseEditorsApi.prototype.modifyCustomProperty = function(idx, name, type, value) {
+ };
+
+ baseEditorsApi.prototype.removeCustomProperty = function(idx) {
+ };
+
+ baseEditorsApi.prototype.asc_setPdfViewer = function(isPdfViewer) {
+ };
+
+
//----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].baseEditorsApi = baseEditorsApi;
@@ -5119,8 +5274,34 @@
prot['asc_hideMediaControl'] = prot.asc_hideMediaControl;
prot['asc_getInputLanguage'] = prot.asc_getInputLanguage;
+ prot['setPluginsOptions'] = prot.setPluginsOptions;
+
// passwords
prot["asc_setCurrentPassword"] = prot.asc_setCurrentPassword;
prot["asc_resetPassword"] = prot.asc_resetPassword;
+ // NATIVE INITIALIZER (need be in min version)
+ window["InitNativeEditors"] = function()
+ {
+ AscFonts.checkAllFonts();
+
+ let loader = AscCommon.g_font_loader;
+ loader.fontFiles = AscFonts.g_font_files;
+ loader.fontInfos = AscFonts.g_font_infos;
+ loader.map_font_index = AscFonts.g_map_font_index;
+
+ window["InitNativeObject"]();
+ if (window["InitNativeTextMeasurer"]) // fonts_ie.js
+ window["InitNativeTextMeasurer"]();
+ window["InitNativeZLib"]();
+ };
+
+ //custom properties
+ prot["asc_getAllCustomProperties"] = prot.asc_getAllCustomProperties;
+ prot["asc_addCustomProperty"] = prot.asc_addCustomProperty;
+ prot["asc_modifyCustomProperty"] = prot.asc_modifyCustomProperty;
+ prot["asc_removeCustomProperty"] = prot.asc_removeCustomProperty;
+
+ prot["asc_setPdfViewer"] = prot.asc_setPdfViewer;
+
})(window);
diff --git a/common/apiBase_plugins.js b/common/apiBase_plugins.js
index c0eeeb6f00..d286c21fd3 100644
--- a/common/apiBase_plugins.js
+++ b/common/apiBase_plugins.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -56,29 +56,32 @@
/**
* The editors which the plugin is available for:
- * * word - text document editor,
- * * cell - spreadsheet editor,
- * * slide - presentation editor,
- * * pdf - pdf editor.
+ * word - text document editor,
+ * cell - spreadsheet editor,
+ * slide - presentation editor,
+ * pdf - pdf editor.
* @typedef {("word" | "cell" | "slide" | "pdf")} editorType
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/editorType.js
+ */
/**
* The data type selected in the editor and sent to the plugin:
- * * text - the text data,
- * * html - HTML formatted code,
- * * ole - OLE object data,
- * * desktop - the desktop editor data,
- * * destop-external - the main page data of the desktop app (system messages),
- * * none - no data will be send to the plugin from the editor,
- * * sign - the sign for the keychain plugin.
+ * text - the text data,
+ * html - HTML formatted code,
+ * ole - OLE object data,
+ * desktop - the desktop editor data,
+ * destop-external - the main page data of the desktop app (system messages),
+ * none - no data will be send to the plugin from the editor,
+ * sign - the sign for the keychain plugin.
* @typedef {("text" | "html" | "ole" | "desktop" | "destop-external" | "none" | "sign")} initDataType
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/initDataType.js
+ */
/**
* Plugin event ("onDocumentContentReady", "onTargetPositionChanged", onClick", "onInputHelperClear", "onInputHelperInput", etc.).
* @typedef {string} EventType
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/EventType.js
+ */
/**
* Plugin variations, or subplugins, that are created inside the origin plugin.
@@ -148,11 +151,12 @@
* @property {boolean} [primary] - Defines if the button is primary or not. The primary flag affects the button skin only.
* @property {boolean} [isViewer] - Defines if the button is shown in the viewer mode only or not.
* @property {localeTranslate} [textLocale] - Translations for the text field. The object keys are the two letter language codes (ru, de, it, etc.) and the values are the button label translation for each language.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/Button.js
*/
/**
* The OLE object properties
- * @typed {Object} OLEProperties
+ * @typedef {Object} OLEProperties
* @property {string} data - OLE object data (internal format).
* @property {string} imgSrc - A link to the image (its visual representation) stored in the OLE object and used by the plugin.
* @property {string} guid - An identifier of the plugin which can edit the current OLE object and must be of the *asc.{UUID}* type.
@@ -160,6 +164,7 @@
* @property {number} height - The OLE object height measured in millimeters.
* @property {number} widthPix - The OLE object image width in pixels.
* @property {number} heightPix - The OLE object image height in pixels.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/OLEProperties.js
*/
/**
@@ -177,7 +182,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias GetVersion
* @returns {string} - The editor version.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetVersion.js
+ */
Api.prototype["pluginMethod_GetVersion"] = function() { return this.GetVersion(); };
/**
@@ -187,7 +193,8 @@
* @alias AddOleObject
* @this Api
* @param {OLEProperties} data - The OLE object properties.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddOleObject.js
+ */
Api.prototype["pluginMethod_AddOleObject"] = function(data) { return this.asc_addOleObject(data); };
/**
@@ -196,7 +203,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias EditOleObject
* @param {OLEProperties} data - The OLE object properties.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/EditOleObject.js
+ */
Api.prototype["pluginMethod_EditOleObject"] = function(data) { return this.asc_editOleObject(data); };
@@ -206,6 +214,7 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias GetSelectedOleObjects
* @returns {OLEProperties[]} - An array of the *OLEProperties* objects containing the data about the OLE object parameters.
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetSelectedOleObjects.js
*/
Api.prototype["pluginMethod_GetSelectedOleObjects"] = function()
{
@@ -246,7 +255,8 @@
* @property {number} m_shLineGap The typographic line gap for the current font.
* @property {number} m_shXHeight The distance between the baseline and the approximate height of non-ascending lowercase letters measured in FUnits.
* @property {number} m_shCapHeight The distance between the baseline and the approximate height of uppercase letters measured in FUnits.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/FontInfo.js
+ */
/**
* Returns the fonts list.
@@ -254,7 +264,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias GetFontList
* @returns {FontInfo[]} - An array of the FontInfo objects containing the data about the used fonts.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetFontList.js
+ */
Api.prototype["pluginMethod_GetFontList"] = function()
{
return AscFonts.g_fontApplication.g_fontSelections.SerializeList();
@@ -267,7 +278,8 @@
* @alias InputText
* @param {string} text - A string value that specifies the text to be inserted into the document.
* @param {string} textReplace - A string value that specifies the text to be replaced with a new text.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/InputText.js
+ */
Api.prototype["pluginMethod_InputText"] = function(text, textReplace)
{
if (!this.canEdit() || this.isPdfEditor() || !AscCommon.g_inputContext)
@@ -289,6 +301,7 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias PasteHtml
* @param {string} htmlText - A string value that specifies the text in the *HTML* format to be pasted into the document.
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/PasteHtml.js
*/
Api.prototype["pluginMethod_PasteHtml"] = function (htmlText) {
if (!AscCommon.g_clipboardBase)
@@ -362,7 +375,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias PasteText
* @param {string} text - A string value that specifies the text to be pasted into the document.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/PasteText.js
+ */
Api.prototype["pluginMethod_PasteText"] = function(text)
{
if (!AscCommon.g_clipboardBase)
@@ -376,7 +390,8 @@
* @typedef {Object} Macros
* @property {Array.} macrosArray - An array of macros codes (*[{"name": "Macros1", "value": "{macrosCode}"}]*).
* @property {number} current - A current macro index.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/Macros.js
+ */
/**
* Returns the document macros.
@@ -384,7 +399,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias GetMacros
* @returns {Macros} - The Macros object containing the data about all the macros from the document
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetMacros.js
+ */
Api.prototype["pluginMethod_GetMacros"] = function()
{
return this.asc_getMacros();
@@ -396,7 +412,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias SetMacros
* @param {Macros} data - The *Macros* object containing the data about all the macros from the document.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SetMacros.js
+ */
Api.prototype["pluginMethod_SetMacros"] = function(data)
{
return this.asc_setMacros(data);
@@ -409,6 +426,7 @@
* @alias GetVBAMacros
* @returns {string | null} VBA xml macros.
* @since 7.3.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetVBAMacros.js
*/
Api.prototype["pluginMethod_GetVBAMacros"] = function()
{
@@ -422,7 +440,8 @@
* @alias StartAction
* @param {number} type - A value which defines an action type which can take 0 if this is an *Information* action or 1 if this is a *BlockInteraction* action.
* @param {string} description - A string value that specifies the description text for the start action of the operation.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/StartAction.js
+ */
Api.prototype["pluginMethod_StartAction"] = function(type, description)
{
this.sync_StartAction((type == "Block") ? Asc.c_oAscAsyncActionType.BlockInteraction : Asc.c_oAscAsyncActionType.Information, description);
@@ -436,7 +455,8 @@
* @param {number} type - A value which defines an action type which can take "Block" if this is the *BlockInteraction* action or "Information if this is the *Information* action.
* @param {string} description - A string value that specifies the description text for the operation end action.
* @param {string} status - The error status code. If no error occurs, then an empty string is passed.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/EndAction.js
+ */
Api.prototype["pluginMethod_EndAction"] = function(type, description, status)
{
this.sync_EndAction((type == "Block") ? Asc.c_oAscAsyncActionType.BlockInteraction : Asc.c_oAscAsyncActionType.Information, description);
@@ -489,17 +509,18 @@
* @alias OnEncryption
* @param {object} obj - The encryption properties.
* @param {string} obj.type - The type of encrypting operation:
- * * generatePassword - generates a password for the document,
- * * getPasswordByFile - sends the password when opening the document,
- * * encryptData - encrypts changes when co-editing,
- * * decryptData - decrypts changes when co-editing.
+ * generatePassword - generates a password for the document,
+ * getPasswordByFile - sends the password when opening the document,
+ * encryptData - encrypts changes when co-editing,
+ * decryptData - decrypts changes when co-editing.
* @param {string} obj.password - A string value specifying the password to access the document.
* @param {string} obj.data - Encrypted/decrypted changes.
* @param {boolean} obj.check - Checks if the encryption/decryption operation is successful or not (used only for *encryptData* or *decryptData* types).
* @param {string} obj.docinfo - An unencrypted part of the encrypted file.
* @param {string} obj.hash - A string value specifying a file hash (*sha256* by default).
* @param {string} obj.error - A string value specifying an error that occurs (the "" value means that the operation is successful).
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/OnEncryption.js
+ */
Api.prototype["pluginMethod_OnEncryption"] = function(obj)
{
var _editor = window["Asc"]["editor"] ? window["Asc"]["editor"] : window.editor;
@@ -586,7 +607,8 @@
* @property {boolean} paragraphs.runs.italic Defines if the current text is displayed italic or not.
* @property {boolean} paragraphs.runs.strikeout Defines if the current text is displayed struck through or not.
* @property {boolean} paragraphs.runs.underline Defines if the current text is displayed underlined or not.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/watermark_on_draw.js
+ */
/**
* An object containing the form properties.
@@ -596,7 +618,8 @@
* @property {string} tags.checkBox The checkbox form value (true - checked, false - unchecked).
* @property {string} tags.picture The image form value (a link to the image).
* @property {string} tags.comboBox The combo box form value (one of the items from the combo box list values).
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/fillForms.js
+ */
/**
* Sets the properties to the document.
@@ -609,7 +632,8 @@
* @param {?string} obj.watermark_on_draw - A string value for {@link global#watermark_on_draw watermark properties} in JSON format.
* @param {?boolean} obj.disableAutostartMacros - Sets a flag that specifies that macros are started automatically when the editor opens.
* @param {?string} obj.fillForms - Sets rules in JSON format for filling document {@link global#fillForms forms} by tags.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SetProperties.js
+ */
Api.prototype["pluginMethod_SetProperties"] = function(obj)
{
if (!this.isDocumentLoadComplete && obj)
@@ -813,6 +837,33 @@
}
};
+ /**
+ * The plugin options.
+ * @typedef {Object} PluginOptions
+ * @property {object} all The parameters which will be set for all plugins ({ "all" : { key, value } }).
+ * @property {object} plugin_guid The parameters which will be set for a specific plugin. The plugin must be specified with the plugin GUID of the asc.{UUID} type ({ "plugin_guid" : { keyForSpecificPlugin : valueForSpecificPlugin } }).
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/PluginOptions.js
+ */
+
+ /**
+ * Configures plugins from an external source. The settings can be set for all plugins or for a specific plugin.
+ * For example, this method can be used to pass an authorization token to the plugin. This method can be used only with the connector class.
+ * @memberof Api
+ * @typeofeditors ["CDE", "CSE", "CPE"]
+ * @alias SetPluginsOptions
+ * @param {PluginOptions} options - Plugin options.
+ * @since 8.1.1
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SetPluginsOptions.js
+ */
+ Api.prototype["pluginMethod_SetPluginsOptions"] = function(options)
+ {
+ let guid = window.g_asc_plugins.getCurrentPluginGuid();
+ let runObject = window.g_asc_plugins.runnedPluginsMap[guid];
+ if (!runObject.isConnector)
+ return;
+ this.setPluginsOptions(options);
+ };
+
/**
* Shows the input helper.
* @memberof Api
@@ -822,7 +873,8 @@
* @param {number} w - A number which specifies the window width measured in millimeters.
* @param {number} h - A number which specifies the window height measured in millimeters.
* @param {boolean} isKeyboardTake - Defines if the keyboard is caught (**true**) or not (**alse**).
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ShowInputHelper.js
+ */
Api.prototype["pluginMethod_ShowInputHelper"] = function(guid, w, h, isKeyboardTake)
{
var _frame = document.getElementById("iframe_" + guid);
@@ -907,7 +959,8 @@
* @alias UnShowInputHelper
* @param {string} guid - A string value which specifies a plugin identifier which must be of the *asc.{UUID}* type.
* @param {string} isclear - Defines if the input context will be cleared (**true**) or not (**false**).
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/UnShowInputHelper.js
+ */
Api.prototype["pluginMethod_UnShowInputHelper"] = function(guid, isclear)
{
var _frame = document.getElementById("iframe_" + guid);
@@ -948,7 +1001,8 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias CoAuthoringChatSendMessage
* @param {string} sText - Message text.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/CoAuthoringChatSendMessage.js
+ */
Api.prototype["pluginMethod_CoAuthoringChatSendMessage"] = function(sText)
{
return this.CoAuthoringChatSendMessage(sText);
@@ -957,6 +1011,7 @@
/**
* The current selection type ("none", "text", "drawing", or "slide").
* @typedef {("none" | "text" | "drawing" | "slide")} SelectionType
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/SelectionType.js
*/
/**
@@ -965,6 +1020,7 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias GetSelectionType
* @returns {SelectionType} - The selection type.
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetSelectionType.js
*/
Api.prototype["pluginMethod_GetSelectionType"] = function()
{
@@ -1058,7 +1114,8 @@
* @param {boolean} [bDemoteHeadings=false] - Defines if all heading levels in your document will be demoted to conform with the following standard: single H1 as title, H2 as top-level heading in the text body.
* @param {boolean} [bRenderHTMLTags=false] - Defines if HTML tags will be preserved in your Markdown. If you just want to use an occasional HTML tag, you can avoid using the opening angle bracket in the following way: \text\. By default, the opening angle brackets will be replaced with the special characters.
* @return {string} - The Markdown/HTML text.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ConvertDocument.js
+ */
Api.prototype["pluginMethod_ConvertDocument"] = function(sConvertType, bHtmlHeadings, bBase64img, bDemoteHeadings, bRenderHTMLTags)
{
return this.ConvertDocument(sConvertType, bHtmlHeadings, bBase64img, bDemoteHeadings, bRenderHTMLTags);
@@ -1080,9 +1137,8 @@
* @param {string} prop.NewLineSeparator - Defines how the line separator will be specified in the resulting string (this property has the priority over *NewLine*).
* @return {string} - Selected text.
* @since 7.1.0
- * @example
- * window.Asc.plugin.executeMethod("GetSelectedText", [{NewLine:true, NewLineParagraph:true, Numbering:true}])
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetSelectedText.js
+ */
Api.prototype["pluginMethod_GetSelectedText"] = function(prop)
{
var properties;
@@ -1123,7 +1179,8 @@
* @param {string} [sParaNewLine=" "] - A character which is used to specify the line break character in the source text.
* @returns {boolean} - Always returns true.
* @since 7.1.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ReplaceTextSmart.js
+ */
Api.prototype["pluginMethod_ReplaceTextSmart"] = function(arrString, sParaTab, sParaNewLine)
{
window.g_asc_plugins && window.g_asc_plugins.setPluginMethodReturnAsync();
@@ -1165,7 +1222,8 @@
* @param {string} [format=" "] - A format in which you need to download a file.
* @returns {string} - URL to download the file in the specified format or error.
* @since 7.2.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetFileToDownload.js
+ */
Api.prototype["pluginMethod_GetFileToDownload"] = function(format)
{
window.g_asc_plugins && window.g_asc_plugins.setPluginMethodReturnAsync();
@@ -1185,6 +1243,7 @@
/**
* Specifies how to adjust the image object in case of replacing the selected image.
* @typedef {("fill" | "fit" | "original" | "stretch")} ReplaceImageMode
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ReplaceImageMode.js
*/
/**
@@ -1194,7 +1253,8 @@
* @property {number} width The image width in pixels.
* @property {number} height The image height in pixels.
* @property {?ReplaceImageMode} replaceMode Specifies how to adjust the image object in case of replacing the selected image.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ImageData.js
+ */
/**
* Returns the image data from the first of the selected drawings. If there are no drawings selected, the method returns a white rectangle.
@@ -1203,7 +1263,8 @@
* @alias GetImageDataFromSelection
* @returns {?ImageData} - The ImageData object containig the information about the base64 encoded png image.
* @since 7.2.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetImageDataFromSelection.js
+ */
Api.prototype["pluginMethod_GetImageDataFromSelection"] = function()
{
return this.getImageDataFromSelection();
@@ -1216,7 +1277,8 @@
* @alias PutImageDataToSelection
* @param {ImageData} oImageData - The information about the base64 encoded *png* image.
* @since 7.2.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/PutImageDataToSelection.js
+ */
Api.prototype["pluginMethod_PutImageDataToSelection"] = function(oImageData)
{
if(!this.canEdit() || this.isPdfEditor())
@@ -1420,7 +1482,8 @@
* @property {string} guid The plugin identifier. It must be of the *asc.{UUID}* type.
* @property {boolean} canRemoved Specifies if the plugin can be removed (**true**) or not (**false**).
* @property {object} obj The {@link /plugin/config config} of the installed plugin. The version is taken from the config and compared with the current one to check for updates.
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/PluginData.js
+ */
/**
* Returns all the installed plugins.
@@ -1429,7 +1492,8 @@
* @alias GetInstalledPlugins
* @returns {PluginData[]} - An array of all the installed plugins.
* @since 7.2.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetInstalledPlugins.js
+ */
Api.prototype["pluginMethod_GetInstalledPlugins"] = function()
{
/*
@@ -1520,7 +1584,8 @@
* @alias RemovePlugin
* @returns {object} - An object with the result information.
* @since 7.2.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemovePlugin.js
+ */
Api.prototype["pluginMethod_RemovePlugin"] = function(guid, backup)
{
let removedPlugin = window.g_asc_plugins.unregister(guid);
@@ -1581,7 +1646,8 @@
* @alias InstallPlugin
* @returns {object} - An object with the result information.
* @since 7.2.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/InstallPlugin.js
+ */
Api.prototype["pluginMethod_InstallPlugin"] = function(config)
{
return installPlugin(config, "Installed");
@@ -1594,7 +1660,8 @@
* @alias UpdatePlugin
* @returns {object} - An object with the result information.
* @since 7.3.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/UpdatePlugin.js
+ */
Api.prototype["pluginMethod_UpdatePlugin"] = function(config)
{
return installPlugin(config, "Updated");
@@ -1608,6 +1675,7 @@
* @alias InstallDeveloperPlugin
* @returns {boolean} - Returns true if the plugin is installed.
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/InstallDeveloperPlugin.js
*/
Api.prototype["installDeveloperPlugin"] = function(configUrl)
{
@@ -1639,6 +1707,7 @@
* @param {string} align - The parameter indicates whether the button will be displayed on the right side of the window or on the left. The default value is "left".
* @alias ShowButton
* @since 7.2.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ShowButton.js
*/
Api.prototype["pluginMethod_ShowButton"] = function(id, bShow, align)
{
@@ -1679,14 +1748,15 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {object} obj The drag&drop emulation properties.
* @param {string} obj.type - The drag&drop event type:
- * * onbeforedrop - an event that is fired when the selected text or element is dragged;
- * * ondrop - an event that is fired when the selected text or element is dropped on a valid drop target.
+ * onbeforedrop - an event that is fired when the selected text or element is dragged;
+ * ondrop - an event that is fired when the selected text or element is dropped on a valid drop target.
* @param {number} obj.x - The horizontal coordinate (in pixels) at which the mouse was clicked, relative to the left edge of the entire document.
* @param {number} obj.y - The vertical coordinate (in pixels) at which the mouse was clicked, relative to the top edge of the entire document.
* @param {string} obj.html - The dragged HTML element.
* @param {string} obj.text - The dragged text.
* @alias OnDropEvent
* @since 7.3.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/OnDropEvent.js
*/
Api.prototype["pluginMethod_OnDropEvent"] = function(obj)
{
@@ -1728,7 +1798,8 @@
* @alias GetDocumentLang
* @returns {string} - Document language.
* @since 7.4.0
- */
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetDocumentLang.js
+ */
Api.prototype["pluginMethod_GetDocumentLang"] = function()
{
let langCode = 1033; // en-US
@@ -1788,6 +1859,7 @@
* @property {boolean} [disabled] - Specifies if the current item is disabled or not.
* @property {string} [icons] - The item icons (see the plugins {@link /plugin/config config} documentation).
* @property {ContextMenuItem[]} items - An array containing the context menu items for the current item.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ContextMenuItem.js
*/
/**
@@ -1797,6 +1869,7 @@
* @alias AddContextMenuItem
* @param {ContextMenuItem[]} items - An array containing the context menu items.
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddContextMenuItem.js
*/
Api.prototype["pluginMethod_AddContextMenuItem"] = function(items)
{
@@ -1812,6 +1885,7 @@
* @alias UpdateContextMenuItem
* @param {ContextMenuItem[]} items - An array containing the context menu items for the current item.
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/UpdateContextMenuItem.js
*/
Api.prototype["pluginMethod_UpdateContextMenuItem"] = function(items)
{
@@ -1823,6 +1897,7 @@
/**
* The possible values of the base which the relative vertical position of the toolbar menu item will be calculated from.
* @typedef {("button" | "...")} ToolbarMenuItemType
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ToolbarMenuItemType.js
*/
/**
@@ -1839,6 +1914,7 @@
* @property {boolean} [separator] - Specifies if a separator is used between the toolbar menu items or not.
* @property {boolean} [split] - Specifies if the toolbar menu items are split or not.
* @property {ContextMenuItem[]} [items] - An array containing the context menu items for the current item.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ToolbarMenuItem.js
*/
/**
@@ -1847,6 +1923,7 @@
* @property {string} id - The tab ID.
* @property {string} text - The tab text.
* @property {ToolbarMenuItem[]} [items] - An array containing the toolbar menu items for the current tab.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ToolbarMenuTab.js
*/
/**
@@ -1854,6 +1931,7 @@
* The main toolbar menu item.
* @property {string} guid - The plugin guid.
* @property {ToolbarMenuTab[]} tabs - An array containing the toolbar menu tabs for the current item.
+ * @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ToolbarMenuMainItem.js
*/
/**
@@ -1863,6 +1941,7 @@
* @alias AddToolbarMenuItem
* @param {ToolbarMenuMainItem[]} items - An array containing the main toolbar menu items.
* @since 8.1.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddToolbarMenuItem.js
*/
Api.prototype["pluginMethod_AddToolbarMenuItem"] = function(items)
{
@@ -1884,6 +1963,7 @@
* @param {variation} variation - The plugin variation.
* @alias ShowWindow
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ShowWindow.js
*/
Api.prototype["pluginMethod_ShowWindow"] = function(frameId, variation)
{
@@ -1903,6 +1983,7 @@
* @param {string} frameId - The frame ID.
* @alias ActivateWindow
* @since 8.1.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ActivateWindow.js
*/
Api.prototype["pluginMethod_ActivateWindow"] = function(frameId)
{
@@ -1916,6 +1997,7 @@
* @param {string} frameId - The frame ID.
* @alias CloseWindow
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/CloseWindow.js
*/
Api.prototype["pluginMethod_CloseWindow"] = function(frameId)
{
@@ -1931,6 +2013,7 @@
* @param {object} data - The event data.
* @alias SendToWindow
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SendToWindow.js
*/
Api.prototype["pluginMethod_SendToWindow"] = function(windowID, name, data)
{
@@ -1947,6 +2030,7 @@
* @param {number} maxSize - The frame maximum size.
* @alias ResizeWindow
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ResizeWindow.js
*/
Api.prototype["pluginMethod_ResizeWindow"] = function(frameId, size, minSize, maxSize)
{
@@ -1965,6 +2049,7 @@
* @param {number} y - The Y coordinate.
* @alias MouseUpWindow
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MouseUpWindow.js
*/
Api.prototype["pluginMethod_MouseUpWindow"] = function(frameId, x, y)
{
@@ -1980,9 +2065,12 @@
* @param {number} y - The Y coordinate.
* @alias MouseMoveWindow
* @since 7.4.0
+ * @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MouseMoveWindow.js
*/
Api.prototype["pluginMethod_MouseMoveWindow"] = function(frameId, x, y)
{
this.sendEvent("asc_onPluginWindowMouseMove", frameId, x, y);
};
})(window);
+
+
diff --git a/common/apiCommon.js b/common/apiCommon.js
index e20bf4bd05..68148bafaa 100644
--- a/common/apiCommon.js
+++ b/common/apiCommon.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1067,6 +1067,8 @@ function (window, undefined) {
this.depthAxes = [];
this.view3D = null;
+
+ this.displayTrendlinesEquation = false;
}
//TODO:remove this---------------------
@@ -1294,6 +1296,9 @@ function (window, undefined) {
if (this.view3D && oPr.view3D && !this.view3D.isEqual(oPr.view3D)) {
return false;
}
+ if(this.displayTrendlinesEquation !== oPr.displayTrendlinesEquation) {
+ return false;
+ }
return true;
};
asc_ChartSettings.prototype.isEmpty = function () {
@@ -1657,6 +1662,12 @@ function (window, undefined) {
this.chartSpace.onDataUpdate();
}
};
+ asc_ChartSettings.prototype.getDisplayTrendlinesEquation = function() {
+ return this.displayTrendlinesEquation;
+ };
+ asc_ChartSettings.prototype.putDisplayTrendlinesEquation = function(v) {
+ this.displayTrendlinesEquation = v;
+ };
/** @constructor */
function asc_CRect(x, y, width, height) {
@@ -4650,6 +4661,8 @@ function (window, undefined) {
this.IsEnabledMacroses = true;
this.IsWebOpening = false;
this.SupportsOnSaveDocument = false;
+ this.Wopi = null;
+ this.shardkey = null;
//for external reference
this.ReferenceData = null;
@@ -4809,6 +4822,18 @@ function (window, undefined) {
prot.get_SupportsOnSaveDocument = prot.asc_getSupportsOnSaveDocument = function () {
return this.SupportsOnSaveDocument;
};
+ prot.put_Wopi = prot.asc_putWopi = function (v) {
+ this.Wopi = v;
+ };
+ prot.get_Wopi = prot.asc_getWopi = function () {
+ return this.Wopi;
+ };
+ prot.put_Shardkey = prot.asc_putShardkey = function (v) {
+ this.shardkey = v;
+ };
+ prot.get_Shardkey = prot.asc_getShardkey = function () {
+ return this.shardkey;
+ };
function COpenProgress() {
this.Type = Asc.c_oAscAsyncAction.Open;
@@ -5052,7 +5077,13 @@ function (window, undefined) {
let ctx = canvasTransparent.getContext("2d");
ctx.globalAlpha = this.transparent;
ctx.drawImage(this.image, 0, 0);
- this.imageBase64 = canvasTransparent.toDataURL("image/png");
+ try {
+ this.imageBase64 = canvasTransparent.toDataURL("image/png");
+ }
+ catch (e) {
+ this.imageBase64 = undefined;
+ this.api.sendEvent("asc_onError", Asc.c_oAscError.ID.CannotSaveWatermark, Asc.c_oAscError.Level.NoCritical);
+ }
canvasTransparent = null;
};
this.EndRenderer = function () {
@@ -5062,6 +5093,9 @@ function (window, undefined) {
this.imageBase64 = undefined;
};
this.DrawOnRenderer = function (renderer, w, h) {
+ if(!this.imageBase64) {
+ return;
+ }
let wMM = this.width * AscCommon.g_dKoef_pix_to_mm / this.zoom;
let hMM = this.height * AscCommon.g_dKoef_pix_to_mm / this.zoom;
let x = (w - wMM) / 2;
@@ -5111,7 +5145,7 @@ function (window, undefined) {
}
let _oldTrackRevision = false;
- if (oApi.getEditorId() === AscCommon.c_oEditorId.Word && oApi.WordControl && !oApi.isPdfEditor())
+ if (oApi.getEditorId() === AscCommon.c_oEditorId.Word && oApi.WordControl && oApi.WordControl.m_oLogicDocument && !oApi.isPdfEditor())
_oldTrackRevision = oApi.WordControl.m_oLogicDocument.GetLocalTrackRevisions();
if (false !== _oldTrackRevision)
@@ -5165,7 +5199,11 @@ function (window, undefined) {
if (undefined != align) {
oShape.setVerticalAlign(align);
}
+ else {
+ oShape.setVerticalAlign(1);//ctr
+ }
+ oShape.setVertOverflowType(AscFormat.nVOTOverflow);
if (Array.isArray(obj['margins']) && obj['margins'].length === 4) {
oShape.setPaddings({
Left: obj['margins'][0],
@@ -5426,6 +5464,13 @@ function (window, undefined) {
this.zoom = 1;
this.calculatezoom = 0;
this.CheckParams();
+
+ if (this.contentObjects && "string" === typeof this.contentObjects["fill"])
+ {
+ this.imageBackgroundUrl = this.contentObjects["fill"];
+ this.imageBackground = {};
+ }
+
this.Generate();
};
}
@@ -6110,7 +6155,8 @@ function (window, undefined) {
prot["getView3d"] = prot.getView3d;
prot["putView3d"] = prot.putView3d;
prot["setView3d"] = prot.setView3d;
-
+ prot["getDisplayTrendlinesEquation"] = prot.getDisplayTrendlinesEquation;
+ prot["putDisplayTrendlinesEquation"] = prot.putDisplayTrendlinesEquation;
window["AscCommon"].asc_CRect = asc_CRect;
prot = asc_CRect.prototype;
@@ -6795,6 +6841,10 @@ function (window, undefined) {
prot["get_IsWebOpening"] = prot["asc_getIsWebOpening"] = prot.asc_getIsWebOpening;
prot["put_SupportsOnSaveDocument"] = prot["asc_putSupportsOnSaveDocument"] = prot.asc_putSupportsOnSaveDocument;
prot["get_SupportsOnSaveDocument"] = prot["asc_getSupportsOnSaveDocument"] = prot.asc_getSupportsOnSaveDocument;
+ prot["put_Wopi"] = prot["asc_putWopi"] = prot.asc_putWopi;
+ prot["get_Wopi"] = prot["asc_getWopi"] = prot.asc_getWopi;
+ prot["put_Shardkey"] = prot["asc_putShardkey"] = prot.asc_putShardkey;
+ prot["get_Shardkey"] = prot["asc_getShardkey"] = prot.asc_getShardkey;
window["AscCommon"].COpenProgress = COpenProgress;
prot = COpenProgress.prototype;
@@ -6856,5 +6906,14 @@ function (window, undefined) {
CDocInfoProp.prototype['put_SymbolsCount'] = CDocInfoProp.prototype.put_SymbolsCount;
CDocInfoProp.prototype['get_SymbolsWSCount'] = CDocInfoProp.prototype.get_SymbolsWSCount;
CDocInfoProp.prototype['put_SymbolsWSCount'] = CDocInfoProp.prototype.put_SymbolsWSCount;
-
+
+ window["AscCommon"]["pix2mm"] = window["AscCommon"].pix2mm = function(pix)
+ {
+ return pix * AscCommon.g_dKoef_pix_to_mm;
+ };
+ window["AscCommon"]["mm2pix"] = window["AscCommon"].mm2pix = function(mm)
+ {
+ return mm * AscCommon.g_dKoef_mm_to_pix;
+ };
+
})(window);
diff --git a/common/applyDocumentChanges.js b/common/applyDocumentChanges.js
index 6560f9cbee..758c363cea 100644
--- a/common/applyDocumentChanges.js
+++ b/common/applyDocumentChanges.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/base32.js b/common/base32.js
index 41562056b1..d8a50d9437 100644
--- a/common/base32.js
+++ b/common/base32.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/browser.js b/common/browser.js
index d980e01950..18c8b6c15e 100644
--- a/common/browser.js
+++ b/common/browser.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -63,7 +63,9 @@ var AscBrowser = {
chromeVersion : 70,
iosVersion : 13,
isAndroidNativeApp : false,
- safariVersion : 17004001
+ safariVersion : 17004001,
+ isTelegramWebView : false,
+ maxTouchPoints : 0
};
// user agent lower case
@@ -144,6 +146,8 @@ if (AscBrowser.isAppleDevices)
AscBrowser.iosVersion = iosversion;
}
+if (navigator.maxTouchPoints) AscBrowser.maxTouchPoints = navigator.maxTouchPoints;
+
// android devices detect
AscBrowser.isAndroid = (AscBrowser.userAgent.indexOf("android") > -1);
@@ -177,6 +181,8 @@ AscBrowser.isNeedEmulateUpload = (AscBrowser.userAgent.indexOf("needemulateuploa
AscBrowser.isAndroidNativeApp = (AscBrowser.userAgent.indexOf("ascandroidwebview") > -1);
+AscBrowser.isTelegramWebView = (typeof TelegramWebviewProxy === "object") ? true : false;
+
AscBrowser.zoom = 1;
AscBrowser.isCustomScaling = function()
@@ -213,6 +219,13 @@ AscBrowser.checkZoom = function()
AscCommon.correctApplicationScale(zoomValue);
};
+AscBrowser.isOffsetUsedZoom = function()
+{
+ if (AscCommon.AscBrowser.isChrome && 128 <= AscCommon.AscBrowser.chromeVersion)
+ return (AscBrowser.zoom === 1) ? false : true;
+ return false;
+};
+
AscBrowser.checkZoom();
AscBrowser.convertToRetinaValue = function(value, isScale)
@@ -223,7 +236,42 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
return ((value / AscBrowser.retinaPixelRatio) + 0.5) >> 0;
};
+var UI = {
+ getBoundingClientRect : function(element)
+ {
+ let rect = element.getBoundingClientRect();
+ if (!AscBrowser.isOffsetUsedZoom())
+ return rect;
+
+ let koef = AscCommon.AscBrowser.zoom;
+ let newRect = {}
+ if (undefined !== rect.x) newRect.x = rect.x * koef;
+ if (undefined !== rect.y) newRect.y = rect.y * koef;
+ if (undefined !== rect.width) newRect.width = rect.width * koef;
+ if (undefined !== rect.height) newRect.height = rect.height * koef;
+
+ if (undefined !== rect.left) newRect.left = rect.left * koef;
+ if (undefined !== rect.top) newRect.top = rect.top * koef;
+ if (undefined !== rect.right) newRect.right = rect.right * koef;
+ if (undefined !== rect.bottom) newRect.bottom = rect.bottom * koef;
+ return newRect;
+ },
+
+ getOffsetLeft : function(element) {
+ if (!AscBrowser.isOffsetUsedZoom())
+ return element.offsetLeft;
+ return element.offsetLeft * AscBrowser.zoom;
+ },
+
+ getOffsetTop : function(element) {
+ if (!AscBrowser.isOffsetUsedZoom())
+ return element.offsetTop;
+ return element.offsetTop * AscBrowser.zoom;
+ }
+};
+
//--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].AscBrowser = AscBrowser;
+ window['AscCommon'].UI = UI;
})(window);
diff --git a/common/clipboard_base.js b/common/clipboard_base.js
index 35f69d709e..f7c080db15 100644
--- a/common/clipboard_base.js
+++ b/common/clipboard_base.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -1044,6 +1044,15 @@
Button_Copy : function()
{
+ if (window["AscDesktopEditor"])
+ {
+ window["asc_desktop_copypaste"](this.Api, "Copy");
+ return true;
+ }
+
+ if (window["NATIVE_EDITOR_ENJINE"])
+ return false;
+
if (this.isUseNewCopy())
{
if (this.Button_Copy_New())
@@ -1080,6 +1089,15 @@
Button_Cut : function()
{
+ if (window["AscDesktopEditor"])
+ {
+ window["asc_desktop_copypaste"](this.Api, "Cut");
+ return true;
+ }
+
+ if (window["NATIVE_EDITOR_ENJINE"])
+ return false;
+
if (this.isUseNewCopy())
{
if (this.Button_Copy_New(true))
@@ -1120,6 +1138,15 @@
Button_Paste : function()
{
+ if (window["AscDesktopEditor"])
+ {
+ window["asc_desktop_copypaste"](this.Api, "Paste");
+ return true;
+ }
+
+ if (window["NATIVE_EDITOR_ENJINE"])
+ return false;
+
if (this.isUseNewPaste())
{
if (this.Button_Paste_New())
@@ -1516,6 +1543,4 @@ window["asc_desktop_copypaste"] = function(_api, _method)
if (!bIsFocus)
_api.asc_enableKeyEvents(true);
window["AscDesktopEditor"][_method]();
- if (!bIsFocus)
- _api.asc_enableKeyEvents(false);
};
diff --git a/common/collaboration/deleted-text-recovery.js b/common/collaboration/deleted-text-recovery.js
new file mode 100644
index 0000000000..c88a03d792
--- /dev/null
+++ b/common/collaboration/deleted-text-recovery.js
@@ -0,0 +1,670 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2024
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(function ()
+{
+ /**
+ * Класс, восстанавливающий удаленные части документа
+ * @param {AscWord.Document} logicDocument
+ * @constructor
+ */
+ function DeletedTextRecovery(logicDocument)
+ {
+ this.document = logicDocument;
+
+ /**
+ * Список всех изменений связанных с удалением текста
+ * @type {*[]}
+ */
+ this.m_RewiewDelPoints = [];
+ this.arrColor = [];
+
+ this.userId = undefined;
+ this.userName = undefined;
+ this.userTime = undefined;
+ }
+ /**
+ * Восстанавливаем удаленный текст в текущей точке истории версий
+ * @return {boolean}
+ */
+ DeletedTextRecovery.prototype.RecoverDeletedText = function()
+ {
+ this.UndoRecoveredText();
+ return this.ShowDelText();
+ };
+ /**
+ * Отменяем восстановление удаленного текста, если оно было
+ */
+ DeletedTextRecovery.prototype.UndoRecoveredText = function ()
+ {
+ if (!this.HaveRecoveredText())
+ return;
+
+ let localHistory = AscCommon.History;
+ let changes = localHistory.Undo();
+ this.document.UpdateAfterUndoRedo(changes);
+ localHistory.ClearRedo();
+ };
+ /**
+ * Запрашивем,есть ли восстановленный удаленный текст
+ * @return {boolean}
+ */
+ DeletedTextRecovery.prototype.HaveRecoveredText = function()
+ {
+ let localHistory = AscCommon.History;
+ let lastPoint = localHistory.Points[localHistory.Points.length - 1];
+ return !!(lastPoint && lastPoint.Description === AscDFH.historydescription_Collaborative_DeletedTextRecovery);
+ };
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Private area
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /**
+ * Инициализация и создание промежуточных данных для отображения удаленного текста в текущей ревизии
+ */
+ DeletedTextRecovery.prototype.HandleChanges = function()
+ {
+ AscCommon.CollaborativeEditing.CoHistory.SplitChangesByPoints();
+
+ let oCoHistory = AscCommon.CollaborativeEditing.CoHistory;
+ let arrChangesList = oCoHistory.Changes;
+ let arrPointsList = AscCommon.CollaborativeEditing.CoHistory.ChangesSplitByPoints;
+ let nIndex = AscCommon.CollaborativeEditing.CoHistory.curChangeIndex;
+ let arrChanges = arrChangesList.slice(0, arrPointsList[nIndex]);
+
+ if (!arrChanges || !arrChanges.length)
+ return;
+
+ this.m_RewiewDelPoints = arrChanges;
+ };
+ /**
+ * Получаем подготовленные данные, разбитые по точкам
+ * @return {*[]}
+ */
+ DeletedTextRecovery.prototype.GetChanges = function()
+ {
+ let arr = this.m_RewiewDelPoints.slice();
+
+ let arrOutput = []
+ for (let i = 0; i < arr.length; i++)
+ {
+ let oChange = arr[i];
+ if (oChange.ConvertToSimpleChanges)
+ {
+ let arrSplitChange = oChange.ConvertToSimpleChanges();
+ if (arrSplitChange && arrSplitChange.length)
+ {
+ for (let j = 0; j < arrSplitChange.length; j++)
+ {
+ arrOutput.push(arrSplitChange[j])
+ }
+ } else
+ {
+ arrOutput.push(oChange);
+ }
+ }
+ else
+ arrOutput.push(oChange);
+
+ }
+ return arrOutput;
+ };
+ DeletedTextRecovery.prototype.GetRemoveTextChanges = function (arrInputChanges, oRemoveText)
+ {
+ let oAddText = new AddTextPositions();
+
+ // отбираем удаленный текст связанный с текущей ревизией
+ for (let i = 0; i < arrInputChanges.length; i++)
+ {
+ let oCurChange = arrInputChanges[i];
+
+ // пропускаем все изменения связанные со сплитом
+ if (oCurChange instanceof CChangesRunOnStartSplit)
+ {
+ while (oCurChange && !(oCurChange instanceof CChangesRunOnEndSplit))
+ {
+ i++;
+ oCurChange = arrInputChanges[i];
+ }
+ }
+
+ if (oCurChange === undefined)
+ break;
+
+ if (oCurChange instanceof AscCommon.CChangesTableIdDescription || !oCurChange.Copy)
+ continue;
+
+ let oNewCurChange = oCurChange.Copy();
+
+ oRemoveText.ProceedChange(oNewCurChange);
+
+ if (oNewCurChange instanceof CChangesRunAddItem || oNewCurChange instanceof CChangesParagraphAddItem || oNewCurChange instanceof CChangesDocumentAddItem)
+ oAddText.Add(oCurChange.Class, oCurChange, oCurChange.UseArray ? oCurChange.PosArray[0] : oCurChange.Pos, i);
+ else if (oNewCurChange instanceof CChangesRunRemoveItem || oNewCurChange instanceof CChangesParagraphRemoveItem || oNewCurChange instanceof CChangesDocumentRemoveItem)
+ oRemoveText.Check(oAddText, oCurChange, i);
+ }
+ oRemoveText.DelDuplicate();
+ }
+ DeletedTextRecovery.prototype.CommuteChanges = function (arrInputChanges, arrSaveData, oRemoveText)
+ {
+ // коммутируем изменения
+ let arrRevInput = arrInputChanges;
+
+ let arrDelChangesForCommute = oRemoveText.GetArrayChanges();
+
+ for (let j = 0; j < arrDelChangesForCommute.length; j++)
+ {
+ let oCurItem = arrDelChangesForCommute[j];
+ let nPos = oCurItem.nIndex;
+ let oChange = oCurItem.item;
+
+ if (oChange.IsContentChange())
+ {
+ let _oChange = oChange.Copy();
+
+ if (AscCommon.CollaborativeEditing.CoHistory.CommuteContentChange(_oChange, nPos, arrRevInput))
+ arrSaveData.push(_oChange);
+ }
+ else
+ {
+ arrSaveData.push(oChange);
+ }
+ }
+
+ oRemoveText.ResetData();
+ }
+ /**
+ * Отменяем заданные изменения
+ * @param arrInputChanges
+ * @return {*[]}
+ */
+ DeletedTextRecovery.prototype.RedoUndoChanges = function (arrInputChanges)
+ {
+ let oRemoveText = new RemoveTextPositions();
+ let arrChanges = [];
+ let arrDelChanges = [];
+
+ this.GetRemoveTextChanges(arrInputChanges, oRemoveText);
+ this.CommuteChanges(arrInputChanges, arrDelChanges, oRemoveText);
+
+ for (let i = 0; i < arrDelChanges.length; i++)
+ {
+ this.RedoUndoChange(arrDelChanges[i], false, arrChanges);
+ let nPos = arrDelChanges[i].UseArray
+ ? arrDelChanges[i].PosArray[0]
+ : arrDelChanges[i].Pos;
+
+ oRemoveText.Add(
+ arrDelChanges[i].Class,
+ arrDelChanges[i],
+ nPos,
+ i
+ );
+ }
+
+ let result = {
+ data: oRemoveText.ProceedPositions(this),
+ classes: oRemoveText.oClasses
+ };
+
+ return [arrChanges, result];
+ };
+ DeletedTextRecovery.prototype.ShowDelText = function ()
+ {
+ let versionHistory = this.document.GetApi().getVersionHistory();
+ if (!versionHistory)
+ return false;
+
+ this.HandleChanges();
+ let arrInput = this.GetChanges();
+ if (arrInput.length === 0)
+ return false;
+
+ let localHistory = AscCommon.History;
+ localHistory.Create_NewPoint(AscDFH.historydescription_Collaborative_DeletedTextRecovery);
+
+ this.userId = versionHistory.userId;
+ this.userName = versionHistory.userName;
+ this.userTime = new Date(versionHistory.dateOfRevision).getTime();
+
+ // отменяем изменения до нужного места (необходимо для перемещения по истории)
+ let arrCurrentPoint = this.RedoUndoChanges(arrInput);
+ let delChanges = arrCurrentPoint[0];
+ let arrResult = arrCurrentPoint[1];
+
+ for (let i = 0; i < delChanges.length; i++)
+ {
+ this.document.History.Add(delChanges[i]);
+ }
+ this.Split(arrResult);
+ this.document.RecalculateByChanges(delChanges);
+
+ this.m_RewiewDelPoints = [];
+ return true;
+ };
+ DeletedTextRecovery.prototype.Split = function (arrInput)
+ {
+ let data = arrInput.data;
+ let classes = arrInput.classes;
+ let arrKeys = Object.keys(data);
+
+ for (let nKey = 0; nKey < arrKeys.length; nKey++)
+ {
+ let strCurrentKey = arrKeys[nKey];
+ let arrCurrentRunData = data[strCurrentKey];
+ let oCurrentRun = classes[strCurrentKey];
+
+ arrCurrentRunData.sort(function (a, b) { return a.nStart - b.nStart });
+
+ for (let j = arrCurrentRunData.length - 1; j >= 0; j--)
+ {
+ let oCurrentRule = arrCurrentRunData[j];
+ let nStart = oCurrentRule.nStart;
+ let nEnd = oCurrentRule.nEnd;
+
+ if (oCurrentRun instanceof CDocument)
+ {
+ let arrContent = oCurrentRun.Content;
+
+ for (let j = nStart; j <= nEnd; j++)
+ {
+ let oCurrentParagraph = arrContent[j];
+ if (oCurrentParagraph)
+ this.SetReviewInfo(oCurrentParagraph);
+ }
+ }
+ else if (oCurrentRun instanceof Paragraph)
+ {
+ let arrContent = oCurrentRun.Content;
+
+ if (nStart === 0 && arrContent.length === nEnd)
+ {
+ this.SetReviewInfo(oCurrentRun);
+ }
+ else
+ {
+ for (let i = nStart; i <= nEnd; i++)
+ {
+ this.SetReviewInfo(arrContent[i]);
+ }
+ }
+ }
+ else if (oCurrentRun instanceof ParaRun)
+ {
+ let newCollab = [];
+
+ if (oCurrentRun.Content.length === 0 || (nEnd + 1 - nStart) === oCurrentRun.Content.length)
+ {
+ this.SetReviewInfo(oCurrentRun);
+ continue;
+ }
+
+ for (let i = 0; i < oCurrentRun.CollaborativeMarks.Ranges.length; i++)
+ {
+ let oCollab = oCurrentRun.CollaborativeMarks.Ranges[i];
+ newCollab.push({PosS: oCollab.PosS, PosE: oCollab.PosE, Color: oCollab.Color, oCurrentRun: oCurrentRun});
+ }
+
+ let oParent = oCurrentRun.GetParent();
+ let RunPos = this.FindPosInParent(oCurrentRun);
+ let RightRun = oCurrentRun.SplitForSpreadCollaborativeMark(nStart);
+
+ oParent.Add_ToContent(RunPos + 1, RightRun);
+ let oNewer = RightRun.SplitForSpreadCollaborativeMark(nEnd - nStart + 1);
+
+ oParent.Add_ToContent(RunPos + 2, oNewer);
+ this.SetReviewInfo(RightRun);
+
+ for (let i = 0; i < newCollab.length; i++)
+ {
+ let oCurCollaborativeMark = newCollab[i];
+ this.arrColor.push(oCurCollaborativeMark);
+ }
+ }
+ }
+ }
+ }
+ DeletedTextRecovery.prototype.SetReviewInfo = function (oReviewInfoParent)
+ {
+ if (!oReviewInfoParent === undefined)
+ return;
+
+ if (!oReviewInfoParent || !oReviewInfoParent.ReviewInfo)
+ {
+ if (oReviewInfoParent instanceof ParaMath)
+ {
+ let oRootContent = oReviewInfoParent.Root.Content;
+ for (let i = 0; i < oRootContent.length; i++)
+ {
+ let oCurrentContent = oRootContent[i];
+ this.SetReviewInfo(oCurrentContent);
+ }
+ }
+ else if (oReviewInfoParent.Content.length > 0)
+ {
+ for (let i = 0; i < oReviewInfoParent.Content.length; i++)
+ {
+ let oCurrentContent = oReviewInfoParent.Content[i];
+ this.SetReviewInfo(oCurrentContent);
+ }
+ }
+ return;
+ }
+
+ if (oReviewInfoParent.ReviewType !== 1)
+ {
+ let oCurrentReviewType = oReviewInfoParent.GetReviewInfo().Copy();
+ oCurrentReviewType.UserId = this.userId;
+ oCurrentReviewType.UserName = this.userName;
+ oCurrentReviewType.DateTime = this.userTime;
+
+ oReviewInfoParent.SetReviewTypeWithInfo(1, oCurrentReviewType, false);
+ }
+ };
+ DeletedTextRecovery.prototype.FindPosInParent = function(oClass)
+ {
+ let oParent = oClass.GetParent();
+ let arrParentContent = oParent.Content;
+
+ for (let i = 0; i < arrParentContent.length; i++)
+ {
+ if (arrParentContent[i] === oClass)
+ return i;
+ }
+ };
+ DeletedTextRecovery.prototype.RedoUndoChange = function (oChange, isRedo, arrToSave)
+ {
+ if (!oChange)
+ return;
+
+ if (oChange.IsContentChange())
+ {
+ let arrSimpleChanges = oChange.ConvertToSimpleChanges();
+
+ for (let simpleIndex = arrSimpleChanges.length - 1; simpleIndex >= 0; simpleIndex--)
+ {
+ if (isRedo)
+ arrSimpleChanges[simpleIndex].Redo();
+ else
+ arrSimpleChanges[simpleIndex].Undo();
+
+
+ let oRevChange = arrSimpleChanges[simpleIndex];
+
+ if (!isRedo)
+ oRevChange = oRevChange.CreateReverseChange();
+
+ if (oRevChange)
+ arrToSave.push(oRevChange);
+ }
+ }
+ else
+ {
+ if (isRedo)
+ oChange.Redo();
+ else
+ oChange.Undo();
+
+ let oRevChange = oChange;
+
+ if (!isRedo)
+ oRevChange = oRevChange.CreateReverseChange();
+
+ if (oRevChange)
+ arrToSave.push(oRevChange);
+ }
+ };
+
+ function AddTextPositions()
+ {
+ this.data = {};
+
+ this.Add = function (oClass, oItem, Pos, nIndex)
+ {
+ if (!this.data[oClass.Id])
+ this.data[oClass.Id] = [];
+
+ this.data[oClass.Id].push({item: oItem, pos: Pos, nIndex: nIndex});
+ }
+ }
+ function RemoveTextPositions()
+ {
+ this.data = {};
+ this.oClasses = {};
+ this.arrClasses = [];
+
+ this.Check = function (oAddText, oCurChange, i)
+ {
+ if (oCurChange.Class)
+ {
+ let strCurrentId = oCurChange.Class.Id;
+ let arrRemData = oAddText.data[strCurrentId];
+
+ if (!arrRemData)
+ {
+ this.Add(oCurChange.Class, oCurChange, oCurChange.UseArray ? oCurChange.PosArray[0] : oCurChange.Pos, i);
+ return;
+ }
+
+ let addItem = oCurChange.Items[0];
+
+ for (let i = 0; i < arrRemData.length; i++)
+ {
+ let oCurrentRemItem = arrRemData[i];
+
+ if (oCurChange.UseArray && oCurChange.PosArray[0] === oCurrentRemItem.pos && addItem.Value === oCurrentRemItem.item.Items[0].Value)
+ {
+ return false;
+ }
+ else if (!oCurChange.UseArray && oCurChange.Pos === oCurrentRemItem.pos && addItem.Value === oCurrentRemItem.item.Items[0].Value)
+ {
+ return false;
+ }
+ }
+ }
+
+ this.Add(oCurChange.Class, oCurChange, oCurChange.UseArray ? oCurChange.PosArray[0] : oCurChange.Pos, i);
+ }
+ this.DelDuplicate = function ()
+ {
+ let arrKeys = Object.keys(this.data);
+
+ for (let nKey = 0; nKey < arrKeys.length; nKey++)
+ {
+ let strCurrentKey = arrKeys[nKey];
+ let arrCurrentRunData = this.data[strCurrentKey];
+
+ for (let i = 0; i < arrCurrentRunData.length; i++)
+ {
+ for (let j = i + 1; j < arrCurrentRunData.length; j++)
+ {
+ if (arrCurrentRunData[i].item === arrCurrentRunData[j].item)
+ {
+ arrCurrentRunData.splice(j, 1);
+ break
+ }
+ }
+ }
+ }
+ }
+ this.Add = function (oClass, oItem, Pos, nIndex)
+ {
+ if (!this.data[oClass.Id])
+ this.data[oClass.Id] = [];
+
+ this.data[oClass.Id].push({item: oItem, pos: Pos, nIndex: nIndex});
+ }
+ this.GetArrayChanges = function ()
+ {
+ let arrOutput = []
+ let arrKeys = Object.keys(this.data);
+
+ for (let nKey = 0; nKey < arrKeys.length; nKey++)
+ {
+ let strCurrentKey = arrKeys[nKey];
+ let arrCurrentRunData = this.data[strCurrentKey];
+
+ for (let i = 0; i < arrCurrentRunData.length; i++)
+ {
+ arrOutput.push(arrCurrentRunData[i]);
+ }
+ }
+ return arrOutput;
+ }
+ this.ProceedChange = function (oChange)
+ {
+ if (oChange.Class && !this.oClasses[oChange.Class.Id])
+ {
+ this.oClasses[oChange.Class.Id] = oChange.Class;
+ if (-1 === this.arrClasses.indexOf(oChange.Class.Id))
+ {
+ this.arrClasses.push(oChange.Class.Id);
+ }
+ }
+ }
+ this.FindInParent = function (oClass, oItem)
+ {
+ let arrParentContent = oClass.Content;
+
+ for (let nPos = 0; nPos < arrParentContent.length; nPos++)
+ {
+ if (arrParentContent[nPos] === oItem)
+ return nPos;
+ }
+ }
+ this.ProceedPositions = function ()
+ {
+ for (let nKey = 0; nKey < this.arrClasses.length; nKey++)
+ {
+ let strCurrentKey = this.arrClasses[nKey];
+ let arrCurrentRunData = this.data[strCurrentKey];
+ if (!arrCurrentRunData)
+ continue;
+ let oClass = this.oClasses[strCurrentKey];
+ let newArrCurrentRunData = [];
+
+ for (let i = 0; i < arrCurrentRunData.length; i++)
+ {
+ let oItem = arrCurrentRunData[i];
+
+ let nPos = this.FindInParent(oClass, oItem.item.Items[0]);
+ newArrCurrentRunData.push(nPos);
+ }
+
+ let nCurrentPos;
+ let nPrevPos;
+ let nTempPrevPos;
+
+ for (let nPos = 1; nPos < newArrCurrentRunData.length; nPos++)
+ {
+ nPrevPos = newArrCurrentRunData[nPos - 1];
+ nCurrentPos = newArrCurrentRunData[nPos];
+
+ if (nTempPrevPos === nCurrentPos || nCurrentPos === nPrevPos)
+ {
+ if (nTempPrevPos)
+ {
+ nTempPrevPos = undefined;
+ newArrCurrentRunData[nPos] = nPrevPos + 1;
+ nTempPrevPos = nCurrentPos;
+ }
+ else
+ {
+ newArrCurrentRunData[nPos] = nCurrentPos + 1;
+ nTempPrevPos = nCurrentPos;
+ }
+ }
+ }
+ this.data[strCurrentKey] = newArrCurrentRunData;
+ }
+ let transformedObject = CollapsePositions(this.data);
+ return transformedObject
+ }
+ this.ResetData = function ()
+ {
+ this.data = {};
+ }
+ }
+ function CollapsePositions (oInput)
+ {
+ let transformedObject = {};
+ for (let key in oInput)
+ {
+ if (oInput.hasOwnProperty(key))
+ {
+ let values = oInput[key];
+ let pairs = [];
+ let nStart = null;
+ let nEnd = null;
+ let decreasingSequence = false;
+
+ for (let i = 0; i < values.length; i++)
+ {
+ let value = values[i];
+
+ if (nStart === null)
+ {
+ nStart = value;
+ nEnd = value;
+ }
+ else if (value === nEnd + 1)
+ {
+ nEnd = value;
+ decreasingSequence = false;
+ }
+ else if (value === nEnd - 1)
+ {
+ nStart = value;
+ decreasingSequence = true;
+ }
+ else
+ {
+ pairs.push({ nStart : nStart, nEnd: nEnd });
+ nStart = value;
+ nEnd = value;
+ decreasingSequence = false;
+ }
+ }
+
+ if (nStart !== null && nEnd !== null)
+ pairs.push({ nStart : nStart, nEnd: nEnd });
+
+ transformedObject[key] = pairs;
+ }
+ }
+ return transformedObject;
+ }
+ //--------------------------------------------------------export----------------------------------------------------
+ AscCommon.DeletedTextRecovery = DeletedTextRecovery;
+
+})();
diff --git a/common/collaborativeHistory.js b/common/collaborativeHistory.js
index c3be086fda..2dbd5544ad 100644
--- a/common/collaborativeHistory.js
+++ b/common/collaborativeHistory.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -44,12 +44,82 @@
this.CoEditing = coEditing;
this.Changes = []; // Список всех изменений
+ this.ChangesSplitByPoints = [] // Список изменений разделенных по точкам
this.OwnRanges = []; // Диапазоны собственных изменений
- this.SyncIndex = -1; // Позиция в массиве изменений, которые согласованы с сервером
-
+ this.SyncIndex = -1; // Позиция в массиве изменений, которые согласованы с сервером
+ this.curChangeIndex = -1; // Текущая позиция в массиве изменений разделенных по точкам
+ //this.StepTextPoint = undefined; //Позиция предыдущего состояния
+
+ this.textRecovery = null;
}
+ /**
+ * Разделяем изменения ревизии для отображения истории ревизии
+ */
+ CCollaborativeHistory.prototype.SplitChangesByPoints = function ()
+ {
+ if (!this.Changes || !this.Changes || this.ChangesSplitByPoints.length !== 0)
+ return;
+
+ let arrCurrent = [0];
+ for (let i = 1; i < this.Changes.length; i++)
+ {
+ let oCurrentChange = this.Changes[i];
+ let oPrevChange = (i === 0)
+ ? undefined
+ : this.Changes[i - 1];
+ if (!(oPrevChange && (oPrevChange instanceof AscCommon.CChangesTableIdDescription || oPrevChange.IsDescriptionChange() === oCurrentChange.IsDescriptionChange())))
+ {
+ arrCurrent.push(i);
+ }
+ }
+
+ arrCurrent.push(this.Changes.length);
+ this.ChangesSplitByPoints = arrCurrent;
+ this.curChangeIndex = arrCurrent.length - 1;
+ };
+ CCollaborativeHistory.prototype.clear = function()
+ {
+ this.Changes = [];
+ this.OwnRanges = [];
+ this.ChangesSplitByPoints = [];
+
+ this.SyncIndex = -1;
+ this.curChangeIndex = -1;
+
+ this.textRecovery = null;
+ };
+ /**
+ * Перемещаемся по истории ревизии на заданную точку
+ * @param {number} pointIndex - Позиция на которую необходимо переместится
+ * @constructor
+ */
+ CCollaborativeHistory.prototype.NavigationRevisionHistoryByStep = function(pointIndex)
+ {
+ let logicDocument = this.CoEditing.GetLogicDocument();
+ if (!logicDocument || !logicDocument.IsDocumentEditor())
+ return false;
+
+ this.UndoDeletedTextRecovery();
+ this.SplitChangesByPoints();
+ if (this.curChangeIndex < 0)
+ return false;
+
+ pointIndex = Math.max(0, Math.min(pointIndex, this.ChangesSplitByPoints.length - 1));
+ if (pointIndex === this.curChangeIndex)
+ return false;
+
+ let changes;
+ if (this.curChangeIndex < pointIndex)
+ changes = this._RedoChanges(this.ChangesSplitByPoints[this.curChangeIndex], this.ChangesSplitByPoints[pointIndex]);
+ else
+ changes = this._UndoChanges(this.ChangesSplitByPoints[this.curChangeIndex], this.ChangesSplitByPoints[pointIndex]);
+
+ this.curChangeIndex = pointIndex;
+ logicDocument.RecalculateByChanges(changes);
+ return true;
+ };
CCollaborativeHistory.prototype.AddChange = function(change)
{
this.Changes.push(change);
@@ -89,6 +159,52 @@
{
return (this.OwnRanges.length > 0)
};
+ CCollaborativeHistory.prototype._RedoChanges = function(startPos, endPos)
+ {
+ let changes = [];
+ for (let i = startPos; i < endPos; ++i)
+ {
+ let change = this.Changes[i];
+ if (change.IsContentChange())
+ {
+ let simpleChanges = change.ConvertToSimpleChanges();
+ for (let simpleIndex = 0; simpleIndex < simpleChanges.length; ++simpleIndex)
+ {
+ simpleChanges[simpleIndex].Redo();
+ changes.push(simpleChanges[simpleIndex]);
+ }
+ }
+ else
+ {
+ change.Redo();
+ changes.push(change);
+ }
+ }
+ return changes;
+ };
+ CCollaborativeHistory.prototype._UndoChanges = function(startPos, endPos)
+ {
+ let changes = [];
+ for (let i = startPos - 1; i >= endPos; --i)
+ {
+ let change = this.Changes[i];
+ if (change.IsContentChange())
+ {
+ let simpleChanges = change.ConvertToSimpleChanges();
+ for (let simpleIndex = simpleChanges.length - 1; simpleIndex >= 0; --simpleIndex)
+ {
+ simpleChanges[simpleIndex].Undo();
+ changes.push(simpleChanges[simpleIndex]);
+ }
+ }
+ else
+ {
+ change.Undo();
+ changes.push(change);
+ }
+ }
+ return changes;
+ };
/**
* Откатываем заданное количество действий
* @param {number} count
@@ -96,6 +212,8 @@
*/
CCollaborativeHistory.prototype.UndoGlobalChanges = function(count)
{
+ this.UndoDeletedTextRecovery();
+
count = Math.min(count, this.Changes.length);
if (!count)
@@ -134,6 +252,8 @@
*/
CCollaborativeHistory.prototype.UndoGlobalPoint = function()
{
+ this.UndoDeletedTextRecovery();
+
let count = 0;
for (let index = this.Changes.length - 1; index > 0; --index, ++count)
{
@@ -150,6 +270,73 @@
return count ? this.UndoGlobalChanges(count) : [];
};
+ /**
+ * Получаем количество позиций истории в текущей ревизии
+ * @return {number}
+ * @constructor
+ */
+ CCollaborativeHistory.prototype.GetGlobalPointCount = function()
+ {
+ this.SplitChangesByPoints();
+ return this.ChangesSplitByPoints.length;
+ };
+ /**
+ * Получаем текущую позицию в истории ревизии
+ * @return {number}
+ */
+ CCollaborativeHistory.prototype.GetGlobalPointIndex = function()
+ {
+ this.SplitChangesByPoints();
+ return this.curChangeIndex;
+ };
+ /**
+ * Перемещаемся на нужную точку истории ревизии
+ * @param nPos - позиция в истории
+ * @return {boolean} - был ли произведен переход на данную позицию
+ */
+ CCollaborativeHistory.prototype.MoveToPoint = function(nPos)
+ {
+ return this.NavigationRevisionHistoryByStep(nPos);
+ };
+ CCollaborativeHistory.prototype.InitTextRecover = function ()
+ {
+ if (this.textRecovery)
+ return;
+
+ let logicDocument = this.CoEditing.GetLogicDocument();
+ if (!logicDocument || !logicDocument.IsDocumentEditor())
+ return;
+
+ this.textRecovery = new AscCommon.DeletedTextRecovery(logicDocument);
+ };
+ /**
+ * Отображаем удаленный текст для данный точки в истории ревизии
+ * @return {boolean} - был ли отображен удаленный текст
+ */
+ CCollaborativeHistory.prototype.RecoverDeletedText = function()
+ {
+ this.InitTextRecover();
+ return this.textRecovery.RecoverDeletedText();
+ };
+ /**
+ * Отменить отображение удаленного текста в данной точке истории ревизии
+ * @return {boolean}
+ */
+ CCollaborativeHistory.prototype.UndoDeletedTextRecovery = function()
+ {
+ if (this.textRecovery)
+ return this.textRecovery.UndoRecoveredText();
+
+ return false;
+ };
+ CCollaborativeHistory.prototype.HaveDeletedTextRecovery = function()
+ {
+ return !!(this.textRecovery && this.textRecovery.HaveRecoveredText());
+ };
+ CCollaborativeHistory.prototype.GetCollaborativeMarks = function ()
+ {
+ return this.CoEditing.Get_CollaborativeMarks();
+ }
/**
* Отменяем собственные последние действия, прокатывая их через чужие
* @returns {[]} возвращаем массив новых действий
@@ -292,8 +479,12 @@
return arrReverseChanges;
};
- CCollaborativeHistory.prototype.CommuteContentChange = function(oChange, nStartPosition)
+ CCollaborativeHistory.prototype.CommuteContentChange = function(oChange, nStartPosition, arrChanges)
{
+ var arrChangesForProceed = this.Changes;
+ if (arrChanges && arrChanges.length > 0)
+ arrChangesForProceed = arrChanges;
+
var arrActions = oChange.ConvertToSimpleActions();
var arrCommutateActions = [];
@@ -302,9 +493,9 @@
var oAction = arrActions[nActionIndex];
var oResult = oAction;
- for (var nIndex = nStartPosition, nOverallCount = this.Changes.length; nIndex < nOverallCount; ++nIndex)
+ for (var nIndex = nStartPosition, nOverallCount = arrChangesForProceed.length; nIndex < nOverallCount; ++nIndex)
{
- var oTempChange = this.Changes[nIndex];
+ var oTempChange = arrChangesForProceed[nIndex];
if (!oTempChange)
continue;
@@ -748,5 +939,11 @@
//--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CCollaborativeHistory = CCollaborativeHistory;
-
+
+ CCollaborativeHistory.prototype["GetGlobalPointCount"] = CCollaborativeHistory.prototype.GetGlobalPointCount;
+ CCollaborativeHistory.prototype["getGlobalPointIndex"] = CCollaborativeHistory.prototype.GetGlobalPointIndex;
+ CCollaborativeHistory.prototype["moveToPoint"] = CCollaborativeHistory.prototype.MoveToPoint;
+ CCollaborativeHistory.prototype["recoverDeletedText"] = CCollaborativeHistory.prototype.RecoverDeletedText;
+ CCollaborativeHistory.prototype["undoDeletedTextRecovery"] = CCollaborativeHistory.prototype.UndoDeletedTextRecovery;
+
})(window);
diff --git a/common/commonDefines.js b/common/commonDefines.js
index 8597e4b955..baa5948606 100644
--- a/common/commonDefines.js
+++ b/common/commonDefines.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -457,6 +457,7 @@ window.AscCommon.g_cIsBeta = "false";
var c_sNativeViewerFormats = '.pdf.xps.oxps.djvu';
var c_sShardKeyName = 'shardkey';
var c_sWopiSrcName = 'WOPISrc';
+ var c_sUserSessionIdName = 'usid';
//files type for Saving & DownloadAs
var c_oAscFileType = {
@@ -1069,7 +1070,7 @@ window.AscCommon.g_cIsBeta = "false";
var ST_ChildOrderType = {
b: 0,
- t: 1
+ t: 1
}
var ST_AlgorithmType = {
@@ -1096,7 +1097,7 @@ window.AscCommon.g_cIsBeta = "false";
equ: 1,
gte: 2,
lte: 3
- }
+ }
var ST_ElementType = {
all: 0,
@@ -2179,6 +2180,7 @@ window.AscCommon.g_cIsBeta = "false";
var changestype_Timing = 78;
var changestype_ViewPr = 79;
var changestype_DocumentProtection = 80;
+ var changestype_CustomPr = 81;
var changestype_2_InlineObjectMove = 1; // Передвигаем объект в заданную позцию (проверяем место, в которое пытаемся передвинуть)
var changestype_2_HdrFtr = 2; // Изменения с колонтитулом
@@ -2436,9 +2438,9 @@ window.AscCommon.g_cIsBeta = "false";
pasteOnlyFormula: 1,
formulaNumberFormat: 2,
formulaAllFormatting: 3,
- formulaWithoutBorders: 4,
+ formulaWithoutBorders: 4,
formulaColumnWidth: 5,
- mergeConditionalFormating: 6,
+ mergeConditionalFormating: 6,
pasteOnlyValues: 7,
valueNumberFormat: 8,
valueAllFormating: 9,
@@ -2988,17 +2990,21 @@ window.AscCommon.g_cIsBeta = "false";
CustomGreece : 0x4000,
CustomDecimalFourZero : 0x4001,
CustomDecimalThreeZero : 0x4002,
- CustomDecimalTwoZero : 0x4003
+ CustomDecimalTwoZero : 0x4003,
+ CustomUpperTurkish : 0x4004,
+ CustomLowerTurkish : 0x4005
};
var c_oAscCustomNumberingFormatAssociation = {
'α, β, γ, ...': c_oAscNumberingFormat.CustomGreece,
'00001, 00002, 00003, ...': c_oAscNumberingFormat.CustomDecimalFourZero,
'0001, 0002, 0003, ...': c_oAscNumberingFormat.CustomDecimalThreeZero,
- '001, 002, 003, ...': c_oAscNumberingFormat.CustomDecimalTwoZero
+ '001, 002, 003, ...': c_oAscNumberingFormat.CustomDecimalTwoZero,
+ 'A, Ç, Ĝ, ...': c_oAscNumberingFormat.CustomUpperTurkish,
+ 'a, ç, ĝ, ...': c_oAscNumberingFormat.CustomLowerTurkish
};
- var c_oAscAllNumberingTypes = [c_oAscNumberingFormat.Aiueo, c_oAscNumberingFormat.AiueoFullWidth, c_oAscNumberingFormat.ArabicAbjad, c_oAscNumberingFormat.ArabicAlpha, c_oAscNumberingFormat.BahtText, c_oAscNumberingFormat.CardinalText, c_oAscNumberingFormat.Chicago, c_oAscNumberingFormat.ChineseCounting, c_oAscNumberingFormat.ChineseCountingThousand, c_oAscNumberingFormat.ChineseLegalSimplified, c_oAscNumberingFormat.Chosung, c_oAscNumberingFormat.Decimal, c_oAscNumberingFormat.DecimalEnclosedCircle, c_oAscNumberingFormat.DecimalEnclosedCircleChinese, c_oAscNumberingFormat.DecimalEnclosedFullstop, c_oAscNumberingFormat.DecimalEnclosedParen, c_oAscNumberingFormat.DecimalFullWidth, c_oAscNumberingFormat.DecimalFullWidth2, c_oAscNumberingFormat.DecimalHalfWidth, c_oAscNumberingFormat.DecimalZero, c_oAscNumberingFormat.Ganada, c_oAscNumberingFormat.Hebrew1, c_oAscNumberingFormat.Hebrew2, c_oAscNumberingFormat.Hex, c_oAscNumberingFormat.HindiConsonants, c_oAscNumberingFormat.HindiCounting, c_oAscNumberingFormat.HindiNumbers, c_oAscNumberingFormat.HindiVowels, c_oAscNumberingFormat.IdeographDigital, c_oAscNumberingFormat.IdeographEnclosedCircle, c_oAscNumberingFormat.IdeographLegalTraditional, c_oAscNumberingFormat.IdeographTraditional, c_oAscNumberingFormat.IdeographZodiac, c_oAscNumberingFormat.IdeographZodiacTraditional, c_oAscNumberingFormat.Iroha, c_oAscNumberingFormat.IrohaFullWidth, c_oAscNumberingFormat.JapaneseCounting, c_oAscNumberingFormat.JapaneseDigitalTenThousand, c_oAscNumberingFormat.JapaneseLegal, c_oAscNumberingFormat.KoreanCounting, c_oAscNumberingFormat.KoreanDigital, c_oAscNumberingFormat.KoreanDigital2, c_oAscNumberingFormat.KoreanLegal, c_oAscNumberingFormat.LowerLetter, c_oAscNumberingFormat.LowerRoman, c_oAscNumberingFormat.NumberInDash, c_oAscNumberingFormat.Ordinal, c_oAscNumberingFormat.OrdinalText, c_oAscNumberingFormat.RussianLower, c_oAscNumberingFormat.RussianUpper, c_oAscNumberingFormat.TaiwaneseCounting, c_oAscNumberingFormat.TaiwaneseCountingThousand, c_oAscNumberingFormat.TaiwaneseDigital, c_oAscNumberingFormat.ThaiCounting, c_oAscNumberingFormat.ThaiLetters, c_oAscNumberingFormat.ThaiNumbers, c_oAscNumberingFormat.UpperLetter, c_oAscNumberingFormat.UpperRoman, c_oAscNumberingFormat.VietnameseCounting, c_oAscNumberingFormat.CustomGreece, c_oAscNumberingFormat.CustomDecimalFourZero, c_oAscNumberingFormat.CustomDecimalThreeZero, c_oAscNumberingFormat.CustomDecimalTwoZero,];
+ var c_oAscAllNumberingTypes = [c_oAscNumberingFormat.Aiueo, c_oAscNumberingFormat.AiueoFullWidth, c_oAscNumberingFormat.ArabicAbjad, c_oAscNumberingFormat.ArabicAlpha, c_oAscNumberingFormat.BahtText, c_oAscNumberingFormat.CardinalText, c_oAscNumberingFormat.Chicago, c_oAscNumberingFormat.ChineseCounting, c_oAscNumberingFormat.ChineseCountingThousand, c_oAscNumberingFormat.ChineseLegalSimplified, c_oAscNumberingFormat.Chosung, c_oAscNumberingFormat.Decimal, c_oAscNumberingFormat.DecimalEnclosedCircle, c_oAscNumberingFormat.DecimalEnclosedCircleChinese, c_oAscNumberingFormat.DecimalEnclosedFullstop, c_oAscNumberingFormat.DecimalEnclosedParen, c_oAscNumberingFormat.DecimalFullWidth, c_oAscNumberingFormat.DecimalFullWidth2, c_oAscNumberingFormat.DecimalHalfWidth, c_oAscNumberingFormat.DecimalZero, c_oAscNumberingFormat.Ganada, c_oAscNumberingFormat.Hebrew1, c_oAscNumberingFormat.Hebrew2, c_oAscNumberingFormat.Hex, c_oAscNumberingFormat.HindiConsonants, c_oAscNumberingFormat.HindiCounting, c_oAscNumberingFormat.HindiNumbers, c_oAscNumberingFormat.HindiVowels, c_oAscNumberingFormat.IdeographDigital, c_oAscNumberingFormat.IdeographEnclosedCircle, c_oAscNumberingFormat.IdeographLegalTraditional, c_oAscNumberingFormat.IdeographTraditional, c_oAscNumberingFormat.IdeographZodiac, c_oAscNumberingFormat.IdeographZodiacTraditional, c_oAscNumberingFormat.Iroha, c_oAscNumberingFormat.IrohaFullWidth, c_oAscNumberingFormat.JapaneseCounting, c_oAscNumberingFormat.JapaneseDigitalTenThousand, c_oAscNumberingFormat.JapaneseLegal, c_oAscNumberingFormat.KoreanCounting, c_oAscNumberingFormat.KoreanDigital, c_oAscNumberingFormat.KoreanDigital2, c_oAscNumberingFormat.KoreanLegal, c_oAscNumberingFormat.LowerLetter, c_oAscNumberingFormat.LowerRoman, c_oAscNumberingFormat.NumberInDash, c_oAscNumberingFormat.Ordinal, c_oAscNumberingFormat.OrdinalText, c_oAscNumberingFormat.RussianLower, c_oAscNumberingFormat.RussianUpper, c_oAscNumberingFormat.TaiwaneseCounting, c_oAscNumberingFormat.TaiwaneseCountingThousand, c_oAscNumberingFormat.TaiwaneseDigital, c_oAscNumberingFormat.ThaiCounting, c_oAscNumberingFormat.ThaiLetters, c_oAscNumberingFormat.ThaiNumbers, c_oAscNumberingFormat.UpperLetter, c_oAscNumberingFormat.UpperRoman, c_oAscNumberingFormat.VietnameseCounting, c_oAscNumberingFormat.CustomGreece, c_oAscNumberingFormat.CustomDecimalFourZero, c_oAscNumberingFormat.CustomDecimalThreeZero, c_oAscNumberingFormat.CustomDecimalTwoZero, c_oAscNumberingFormat.CustomUpperTurkish, c_oAscNumberingFormat.CustomLowerTurkish];
/** enum {number} */
var c_oAscNumberingSuff = {
@@ -3767,8 +3773,36 @@ window.AscCommon.g_cIsBeta = "false";
Shape: "Shape",
OleObject: "OleObject"
};
-
-
+
+ // 17.18.21 ST_EdGrp
+ const ST_EdGrp = {
+ administrators : 0,
+ contributors : 1,
+ current : 2,
+ editors : 3,
+ everyone : 4,
+ none : 5,
+ owners : 6
+ };
+
+ window['Asc']['ST_EdGrp'] = window['Asc'].ST_EdGrp = ST_EdGrp;
+ ST_EdGrp['administrators'] = ST_EdGrp.administrators;
+ ST_EdGrp['contributors'] = ST_EdGrp.contributors;
+ ST_EdGrp['current'] = ST_EdGrp.current;
+ ST_EdGrp['editors'] = ST_EdGrp.editors;
+ ST_EdGrp['everyone'] = ST_EdGrp.everyone;
+ ST_EdGrp['none'] = ST_EdGrp.none;
+
+ // 17.18.13 ST_DisplacedByCustomXml
+ const ST_DisplacedByCustomXml = {
+ next : 0,
+ prev : 1
+ };
+ window['Asc']['ST_DisplacedByCustomXml'] = window['Asc'].ST_DisplacedByCustomXml = ST_DisplacedByCustomXml;
+ ST_DisplacedByCustomXml['next'] = ST_DisplacedByCustomXml.next;
+ ST_DisplacedByCustomXml['prev'] = ST_DisplacedByCustomXml.prev;
+
+
var c_oAscDateTimeFormat = {};
c_oAscDateTimeFormat[lcid_arSA] = [
"dd/MM/yyyy",
@@ -4254,6 +4288,44 @@ window.AscCommon.g_cIsBeta = "false";
"HH:mm",
"HH:mm:ss"
];
+ c_oAscDateTimeFormat[lcid_srCyrlRS] = [
+ "dd.MM.yyyy.",
+ "dddd, d. MMMM yyyy.",
+ "d. MMMM yyyy.",
+ "dd.MM.yy.",
+ "yyyy-MM-dd",
+ "d-MMM-yy",
+ "dd/MM/yyyy",
+ "d. MMM. yy.",
+ "dd/MM/yy",
+ "MMMM yy",
+ "MMM-yy",
+ "dd.MM.yyyy. H:mm",
+ "dd.MM.yyyy. H:mm:ss",
+ "h:mm am/pm",
+ "h:mm:ss am/pm",
+ "HH:mm",
+ "HH:mm:ss"
+ ];
+ c_oAscDateTimeFormat[lcid_srLatnRS] = [
+ "d.M.yyyy.",
+ "dddd, dd. MMMM yyyy.",
+ "dd. MMMM yyyy.",
+ "d.M.yy.",
+ "yyyy-MM-dd",
+ "d-MMM-yy",
+ "d/M/yyyy",
+ "dd. MMM. yy.",
+ "d/M/yy",
+ "MMMM yy",
+ "MMM-yy",
+ "d.M.yyyy. HH:mm",
+ "d.M.yyyy. HH:mm:ss",
+ "h:mm am/pm",
+ "h:mm:ss am/pm",
+ "HH:mm",
+ "HH:mm:ss"
+ ];
c_oAscDateTimeFormat[lcid_skSK] = [
"d. M. yyyy",
"dddd d. MMMM yyyy",
@@ -4455,6 +4527,7 @@ window.AscCommon.g_cIsBeta = "false";
window['Asc']['c_sNativeViewerFormats'] = window['Asc'].c_sNativeViewerFormats = c_sNativeViewerFormats;
window['Asc']['c_sShardKeyName'] = window['Asc'].c_sShardKeyName = c_sShardKeyName;
window['Asc']['c_sWopiSrcName'] = window['Asc'].c_sWopiSrcName = c_sWopiSrcName;
+ window['Asc']['c_sUserSessionIdName'] = window['Asc'].c_sUserSessionIdName = c_sUserSessionIdName;
window['Asc']['c_oAscFileType'] = window['Asc'].c_oAscFileType = c_oAscFileType;
window['Asc'].g_oLcidNameToIdMap = g_oLcidNameToIdMap;
window['Asc'].availableIdeographLanguages = availableIdeographLanguages;
@@ -5225,6 +5298,7 @@ window.AscCommon.g_cIsBeta = "false";
window["AscCommon"].changestype_Timing = changestype_Timing;
window["AscCommon"].changestype_ViewPr = changestype_ViewPr;
window["AscCommon"].changestype_DocumentProtection = changestype_DocumentProtection;
+ window["AscCommon"].changestype_CustomPr = changestype_CustomPr;
window["AscCommon"].changestype_2_InlineObjectMove = changestype_2_InlineObjectMove;
window["AscCommon"].changestype_2_HdrFtr = changestype_2_HdrFtr;
@@ -5558,6 +5632,8 @@ window.AscCommon.g_cIsBeta = "false";
prot['CustomDecimalFourZero'] = prot.CustomDecimalFourZero;
prot['CustomDecimalThreeZero'] = prot.CustomDecimalThreeZero;
prot['CustomDecimalTwoZero'] = prot.CustomDecimalTwoZero;
+ prot['CustomUpperTurkish'] = prot.CustomUpperTurkish;
+ prot['CustomLowerTurkish'] = prot.CustomLowerTurkish;
window['Asc']['c_oAscCustomNumberingFormatAssociation'] = window['Asc'].c_oAscCustomNumberingFormatAssociation = c_oAscCustomNumberingFormatAssociation;
diff --git a/common/device_scale.js b/common/device_scale.js
index e3c1e746c6..2df381e35b 100644
--- a/common/device_scale.js
+++ b/common/device_scale.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/digest/sha256.js b/common/digest/sha256.js
index 4ad0a3eec6..4d2d20a8ab 100644
--- a/common/digest/sha256.js
+++ b/common/digest/sha256.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/docscoapi.js b/common/docscoapi.js
index b3c2f7c5ed..1c88e22896 100644
--- a/common/docscoapi.js
+++ b/common/docscoapi.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -50,7 +50,7 @@
this._onlineWork = false;
}
- CDocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo, shardKey, wopiSrc) {
+ CDocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo, shardKey, wopiSrc, userSessionId, openCmd) {
if (this._CoAuthoringApi && this._CoAuthoringApi.isRightURL()) {
var t = this;
this._CoAuthoringApi.onAuthParticipantsChanged = function(e, id) {
@@ -145,7 +145,7 @@
t.callback_OnLicenseChanged(res);
};
- this._CoAuthoringApi.init(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo, shardKey, wopiSrc);
+ this._CoAuthoringApi.init(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo, shardKey, wopiSrc, userSessionId, openCmd);
this._onlineWork = true;
} else {
// Фиктивные вызовы
@@ -357,6 +357,12 @@
}
};
+ CDocsCoApi.prototype.connect = function() {
+ if (this._CoAuthoringApi && this._onlineWork) {
+ this._CoAuthoringApi.connect();
+ }
+ };
+
CDocsCoApi.prototype.extendSession = function(idleTime) {
if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.extendSession(idleTime);
@@ -587,7 +593,7 @@
this._id = null;
this._sessionTimeConnect = null;
this._allChangesSaved = null;
- this._lastForceSaveButtonTime = null;
+ this._lastForceSaveButtonTime = -2;//-2 to allow first save without changes
this._lastForceSaveTimeoutTime = null;
this._indexUser = -1;
// Если пользователей больше 1, то совместно редактируем
@@ -645,12 +651,12 @@
this.mode = undefined;
this.permissions = undefined;
this.lang = undefined;
+ this.openCmd = undefined;
this.jwtOpen = undefined;
this.jwtSession = undefined;
this.encrypted = undefined;
this.IsAnonymousUser = undefined;
this.coEditingMode = undefined;
- this._isViewer = false;
this._isReSaveAfterAuth = false; // Флаг для сохранения после повторной авторизации (для разрыва соединения во время сохранения)
this._lockBuffer = [];
this._saveChangesChunks = [];
@@ -903,6 +909,11 @@
}
};
+ DocsCoApi.prototype.connect = function() {
+ this.isCloseCoAuthoring = false;
+ this.socketio.connect();
+ };
+
DocsCoApi.prototype.disconnect = function(opt_code, opt_reason) {
// Отключаемся сами
this.isCloseCoAuthoring = true;
@@ -1641,7 +1652,7 @@
this._authOtherChanges = [];
};
- DocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo, shardKey, wopiSrc) {
+ DocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo, shardKey, wopiSrc, userSessionId, openCmd) {
this._user = user;
this._docid = null;
this._documentCallbackUrl = documentCallbackUrl;
@@ -1656,12 +1667,14 @@
this.mode = docInfo.get_Mode();
this.permissions = docInfo.get_Permissions();
this.lang = docInfo.get_Lang();
+ this.openCmd = openCmd;
this.jwtOpen = docInfo.get_Token();
this.encrypted = docInfo.get_Encrypted() || docInfo.get_IsWebOpening();
this.IsAnonymousUser = docInfo.get_IsAnonymousUser();
this.coEditingMode = docInfo.asc_getCoEditingMode();
this.shardKey = shardKey;
this.wopiSrc = wopiSrc;
+ this.userSessionId = userSessionId;
this.setDocId(docid);
this._initSocksJs();
@@ -1674,9 +1687,7 @@
this._docid = docid;
this.socketio_url = AscCommon.getBaseUrlPathname() + '../../../../doc/' + docid + '/c';
};
- // Авторизация (ее нужно делать после выставления состояния редактора view-mode)
- DocsCoApi.prototype.auth = function(isViewer, opt_openCmd, opt_isIdle) {
- this._isViewer = isViewer;
+ DocsCoApi.prototype.getAuthCommand = function(opt_openCmd, opt_isIdle) {
if (this._locks) {
this.ownedLockBlocks = [];
//If we already have locks
@@ -1689,7 +1700,7 @@
}
this._locks = {};
}
- this._send({
+ return {
'type': 'auth',
'docid': this._docid,
'documentCallbackUrl': this._documentCallbackUrl,
@@ -1705,10 +1716,9 @@
'lastOtherSaveTime': this.lastOtherSaveTime,
'block': this.ownedLockBlocks,
'sessionId': this._id,
- 'sessionTimeConnect': this._sessionTimeConnect,
+ 'sessionTimeConnect': this._sessionTimeConnect,
'sessionTimeIdle': opt_isIdle >= 0 ? opt_isIdle : 0,
'documentFormatSave': this._documentFormatSave,
- 'view': this._isViewer,
'isCloseCoAuthoring': this.isCloseCoAuthoring,
'openCmd': opt_openCmd,
'lang': this.lang,
@@ -1722,9 +1732,12 @@
'jwtSession': this.jwtSession,
'time': Math.round(performance.now()),
'supportAuthChangesAck': true
- });
+ };
+ };
+ // Авторизация (ее нужно делать после выставления состояния редактора view-mode)
+ DocsCoApi.prototype.auth = function(isViewer, opt_openCmd, opt_isIdle) {
+ this._send(this.getAuthCommand(opt_openCmd, opt_isIdle));
};
-
function CNativeSocket(settings)
{
this.engine = window['SockJS'];
@@ -1783,6 +1796,7 @@
"reconnectionDelayMax": 10000,
"randomizationFactor": 0.5,
"auth": {
+ "data": this.getAuthCommand(this.openCmd),
"token": this.jwtOpen,
"session": this.jwtSession
}
@@ -1794,6 +1808,9 @@
if (this.wopiSrc) {
options["query"][Asc.c_sWopiSrcName] = this.wopiSrc;
}
+ if (this.userSessionId) {
+ options["query"][Asc.c_sUserSessionIdName] = this.userSessionId;
+ }
if (window['IS_NATIVE_EDITOR']) {
socket = this.sockjs = new CNativeSocket(options);
diff --git a/common/docscoapicommon.js b/common/docscoapicommon.js
index 1a34e02599..b7e2edec1d 100644
--- a/common/docscoapicommon.js
+++ b/common/docscoapicommon.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/downloaderfiles.js b/common/downloaderfiles.js
index 6b2afb777c..da12132494 100644
--- a/common/downloaderfiles.js
+++ b/common/downloaderfiles.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/editorscommon.js b/common/editorscommon.js
index 27c3cef4c6..ffee0e8165 100644
--- a/common/editorscommon.js
+++ b/common/editorscommon.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -54,6 +54,12 @@
var availableBidiLanguages = window['Asc'].availableBidiLanguages;
const fontslot_ASCII = 0x01;
+ let scriptDirectory = "";
+ if (document.currentScript) {
+ scriptDirectory = document.currentScript.src;
+ scriptDirectory = scriptDirectory.substring(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/") + 1);
+ }
+
Number.isInteger = Number.isInteger || function(value) {
return typeof value === 'number' && Number.isFinite(value) && !(value % 1);
};
@@ -966,6 +972,9 @@
if (editor.documentWopiSrc) {
url += '&' + Asc.c_sWopiSrcName + '=' + encodeURIComponent(editor.documentWopiSrc);
}
+ if (editor.documentUserSessionId) {
+ url += '&' + Asc.c_sUserSessionIdName + '=' + encodeURIComponent(editor.documentUserSessionId);
+ }
asc_ajax({
type: 'POST',
url: url,
@@ -988,7 +997,7 @@
});
}
- function sendSaveFile(docId, userId, title, jwt, shardKey, wopiSrc, data, fError, fsuccess)
+ function sendSaveFile(docId, userId, title, jwt, shardKey, wopiSrc, userSessionId, data, fError, fsuccess)
{
let cmd = {'id': docId, "userid": userId, "tokenSession": jwt, 'outputpath': title};
let url =sSaveFileLocalUrl + '/' + docId;
@@ -999,6 +1008,9 @@
if (wopiSrc) {
url += '&' + Asc.c_sWopiSrcName + '=' + encodeURIComponent(wopiSrc);
}
+ if (userSessionId) {
+ url += '&' + Asc.c_sUserSessionIdName + '=' + encodeURIComponent(userSessionId);
+ }
asc_ajax({
type: 'POST',
url: url,
@@ -1045,6 +1057,8 @@
case c_oAscServerError.ConvertNEED_PARAMS :
case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.ConvertReadFile :
+ case c_oAscServerError.ConvertTemporaty :
+ case c_oAscServerError.ConvertDetect :
case c_oAscServerError.Convert :
nRes =
AscCommon.c_oAscAdvancedOptionsAction.Save === nAction ? Asc.c_oAscError.ID.ConvertationSaveError :
@@ -1446,7 +1460,8 @@
"na": "#N\/A",
"getdata": "#GETTING_DATA",
"uf": "#UNSUPPORTED_FUNCTION!",
- "calc": "#CALC!"
+ "calc": "#CALC!",
+ "spill": "#SPILL!",
};
var cErrorLocal = {};
let cCellFunctionLocal = {};
@@ -1481,7 +1496,8 @@
structured_tables_headata = new XRegExp('(?:\\[\\#' + loc_headers + '\\]\\' + FormulaSeparators.functionArgumentSeparator + '\\[\\#' + loc_data + '\\])'),
structured_tables_datals = new XRegExp('(?:\\[\\#' + loc_data + '\\]\\' + FormulaSeparators.functionArgumentSeparator + '\\[\\#' + loc_totals + '\\])'),
structured_tables_userColumn = new XRegExp('(?:\'\\[|\'\\]|[^[\\]])+'),
- structured_tables_reservedColumn = new XRegExp('\\#(?:' + loc_all + '|' + loc_headers + '|' + loc_totals + '|' + loc_data + '|' + loc_this_row + ')|@');
+ structured_tables_reservedColumn = new XRegExp('\\#(?:' + loc_all + '|' + loc_headers + '|' + loc_totals + '|' + loc_data + /*'|' + loc_this_row + */')'),
+ structured_tables_thisRow = new XRegExp('(?:\\#(?:' + loc_this_row +')|(?:\\@))');
//Table4[[#Data];[#Totals]]
@@ -1497,22 +1513,34 @@
//Table1[[#Headers],[#Data],[Column1]:[Column2]]
+ // @ === [#This Row],
+ // Table[@]
+ // Table[@Column1]
+ // Table[@Column1:[Column2]] === Table[@[Column1]:[Column2]]
+
let argsSeparator = FormulaSeparators.functionArgumentSeparator;
return XRegExp.build('^(?{{tableName}})\\[(?{{columnName}})?\\]', {
"tableName": new XRegExp("^(:?[" + str_namedRanges + "][" + str_namedRanges + "\\d.]*)"),
- "columnName": XRegExp.build('(?{{reservedColumn}})|(?{{userColumn}})|(?{{userColumnRange}})|(?{{hdtcc}})', {
+ "columnName": XRegExp.build('(?{{reservedColumn}}|{{thisRow}})|(?{{userColumn}})|(?{{userColumnRange}})|(?{{hdtcc}})', {
"userColumn": structured_tables_userColumn,
"reservedColumn": structured_tables_reservedColumn,
+ "thisRow": structured_tables_thisRow,
"userColumnRange": XRegExp.build('\\[(?{{uc}})\\]\\:\\[(?{{uc}})\\]', {
"uc": structured_tables_userColumn
}),
//fixed: added [{{rc}}\\]' + argsSeparator + '\\[{{rc}}\\] for:
//Table1[[#Data],[#Totals]]
//Table1[[#Headers],[#Data]]
- "hdtcc": XRegExp.build('(?\\[{{rc}}\\]' + argsSeparator + '\\[{{rc}}\\]|\\[{{rc}}\\]|{{hd}}|{{dt}})(?:\\' + argsSeparator + '(?:\\[(?{{uc}})\\])(?:\\:(?:\\[(?{{uc}})\\]))?)?', {
+
+ // '(?\\[{{rc}}\\]' + argsSeparator + '\\[{{rc}}\\]|\\[{{rc}}\\]|{{hd}}|{{dt}})(?:\\' + argsSeparator + '(?:\\[(?{{uc}})\\])(?:\\:(?:\\[(?{{uc}})\\]))?)?'
+
+ // last used: '(?(?:\\[{{rc}}\\])?(?:\@)?)(?:(?:\\'+argsSeparator+')?(?:\\\[?(?{{uc}})\\\]?)(?:\\:(?:\\[(?{{uc}})\\]))?)?'
+ "hdtcc": XRegExp.build('(?(?:\\[{{rc}}\\]' + argsSeparator + '\\[{{rc}}\\]|\\[{{rc}}\\]|{{hd}}|{{dt}})|(?:\\[{{tr}}\\])|\@)(?:(?:\\' + argsSeparator + ')?(?:\\[(?{{uc}})\\])(?:\\:(?:\\[(?{{uc}})\\]))?)?'
+ , {
"rc": structured_tables_reservedColumn,
"hd": structured_tables_headata,
"dt": structured_tables_datals,
+ "tr": structured_tables_thisRow,
"uc": structured_tables_userColumn
})
})
@@ -1540,7 +1568,8 @@
"na": "#N\/A",
"getdata": "#GETTING_DATA",
"uf": "#UNSUPPORTED_FUNCTION!",
- "calc": "#CALC!"
+ "calc": "#CALC!",
+ "spill": "#SPILL!"
};
cErrorLocal['nil'] = local['nil'];
cErrorLocal['div'] = local['div'];
@@ -1552,6 +1581,7 @@
cErrorLocal['getdata'] = local['getdata'];
cErrorLocal['uf'] = local['uf'];
cErrorLocal['calc'] = local['calc'];
+ cErrorLocal['spill'] = local['spill'];
return new RegExp("^(" + cErrorLocal["nil"] + "|" +
cErrorLocal["div"] + "|" +
@@ -1562,7 +1592,8 @@
cErrorLocal["na"] + "|" +
cErrorLocal["getdata"] + "|" +
cErrorLocal["uf"] + "|" +
- cErrorLocal["calc"] + ")", "i");
+ cErrorLocal["calc"] + "|" +
+ cErrorLocal["spill"] + ")", "i")
}
function build_rx_cell_func(local)
@@ -1646,6 +1677,8 @@
ConvertPASSWORD: -91,
ConvertICU: -92,
ConvertLIMITS: -93,
+ ConvertTemporaty: -94,
+ ConvertDetect: -95,
ConvertDeadLetter: -99,
Upload: -100,
@@ -1668,7 +1701,7 @@
//todo get from server config
var c_oAscImageUploadProp = {//Не все браузеры позволяют получить информацию о файле до загрузки(например ie9), меняя параметры здесь надо поменять аналогичные параметры в web.common
MaxFileSize: 25000000, //25 mb
- SupportedFormats: ["jpg", "jpeg", "jpe", "png", "gif", "bmp", "svg"]
+ SupportedFormats: ["jpg", "jpeg", "jpe", "png", "gif", "bmp", "svg", "tiff", "tif"]
};
var c_oAscDocumentUploadProp = {
@@ -2190,8 +2223,14 @@
let oViewer = Asc.editor.getDocumentRenderer();
let oDoc = oViewer.doc;
let oActionsQueue = oDoc.GetActionsQueue();
+
+ function cancelFileDialog() {
+ AscCommon.global_mouseEvent.UnLockMouse();
+ oActionsQueue.Continue();
+ }
+
if (oActionsQueue.IsInProgress()) {
- Asc.editor.sendEvent("asc_onOpenFilePdfForm", fileName.click.bind(fileName), oActionsQueue.Continue.bind(oActionsQueue));
+ Asc.editor.sendEvent("asc_onOpenFilePdfForm", fileName.click.bind(fileName), cancelFileDialog);
}
else
fileName.click();
@@ -2204,7 +2243,7 @@
return false;
}
}
- function ShowImageFileDialog(documentId, documentUserId, jwt, shardKey, wopiSrc, callback, callbackOld)
+ function ShowImageFileDialog(documentId, documentUserId, jwt, shardKey, wopiSrc, userSessionId, callback, callbackOld)
{
if (false === _ShowFileDialog(getAcceptByArray(c_oAscImageUploadProp.SupportedFormats), true, true, ValidateUploadImage, callback)) {
//todo remove this compatibility
@@ -2217,6 +2256,9 @@
if (wopiSrc) {
queryParams.push(Asc.c_sWopiSrcName + '=' + encodeURIComponent(wopiSrc));
}
+ if (userSessionId) {
+ queryParams.push(Asc.c_sUserSessionIdName + '=' + encodeURIComponent(userSessionId));
+ }
if (jwt) {
queryParams.push('token=' + encodeURIComponent(jwt));
}
@@ -2248,8 +2290,8 @@
fileName.click();
}
}
- function ShowDocumentFileDialog(callback) {
- if (false === _ShowFileDialog(getAcceptByArray(c_oAscDocumentUploadProp.SupportedFormats), false, false, ValidateUploadDocument, callback)) {
+ function ShowDocumentFileDialog(callback, isAllowMultiple) {
+ if (false === _ShowFileDialog(getAcceptByArray(c_oAscDocumentUploadProp.SupportedFormats), false, !!isAllowMultiple, ValidateUploadDocument, callback)) {
callback(Asc.c_oAscError.ID.Unknown);
}
}
@@ -2430,7 +2472,7 @@
callback(nError, [file], obj);
}
- function UploadImageFiles(files, documentId, documentUserId, jwt, shardKey, wopiSrc, callback)
+ function UploadImageFiles(files, documentId, documentUserId, jwt, shardKey, wopiSrc, userSessionId, callback)
{
if (files.length > 0)
{
@@ -2442,6 +2484,9 @@
if (wopiSrc) {
queryParams.push(Asc.c_sWopiSrcName + '=' + encodeURIComponent(wopiSrc));
}
+ if (userSessionId) {
+ queryParams.push(Asc.c_sUserSessionIdName + '=' + encodeURIComponent(userSessionId));
+ }
if (queryParams.length > 0) {
url += '?' + queryParams.join('&');
}
@@ -2503,7 +2548,7 @@
}
}
- function UploadImageUrls(files, documentId, documentUserId, jwt, shardKey, wopiSrc, callback)
+ function UploadImageUrls(files, documentId, documentUserId, jwt, shardKey, wopiSrc, userSessionId, callback)
{
if (files.length > 0)
{
@@ -2515,6 +2560,9 @@
if (wopiSrc) {
queryParams.push(Asc.c_sWopiSrcName + '=' + encodeURIComponent(wopiSrc));
}
+ if (userSessionId) {
+ queryParams.push(Asc.c_sUserSessionIdName + '=' + encodeURIComponent(userSessionId));
+ }
if (queryParams.length > 0) {
url += '?' + queryParams.join('&');
}
@@ -2809,8 +2857,8 @@
/*Functions that checks of an element in formula*/
//var str_namedRanges = "\\p{L}\\p{M}*",
- var str_namedRanges = "A-Za-z\u005F\u0080-\u0081\u0083\u0085-\u0087\u0089-\u008A\u008C-\u0091\u0093-\u0094\u0096-\u0097\u0099-\u009A\u009C-\u009F\u00A1-\u00A5\u00A7-\u00A8\u00AA\u00AD\u00AF-\u00BA\u00BC-\u02B8\u02BB-\u02C1\u02C7\u02C9-\u02CB\u02CD\u02D0-\u02D1\u02D8-\u02DB\u02DD\u02E0-\u02E4\u02EE\u0370-\u0373\u0376-\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0972\u097B-\u097F\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58-\u0C59\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E3A\u0E40-\u0E4E\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1159\u115F-\u11A2\u11A8-\u11F9\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u1676\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19A9\u19C1-\u19C7\u1A00-\u1A16\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200e\u2010\u2013-\u2016\u2018\u201C-\u201D\u2020-\u2021\u2025-\u2027\u2030\u2032-\u2033\u2035\u203B\u2071\u2074\u207F\u2081-\u2084\u2090-\u2094\u2102-\u2103\u2105\u2107\u2109-\u2113\u2115-\u2116\u2119-\u211D\u2121-\u2122\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2153-\u2154\u215B-\u215E\u2160-\u2188\u2190-\u2199\u21D2\u21D4\u2200\u2202-\u2203\u2207-\u2208\u220B\u220F\u2211\u2215\u221A\u221D-\u2220\u2223\u2225\u2227-\u222C\u222E\u2234-\u2237\u223C-\u223D\u2248\u224C\u2252\u2260-\u2261\u2264-\u2267\u226A-\u226B\u226E-\u226F\u2282-\u2283\u2286-\u2287\u2295\u2299\u22A5\u22BF\u2312\u2460-\u24B5\u24D0-\u24E9\u2500-\u254B\u2550-\u2574\u2581-\u258F\u2592-\u2595\u25A0-\u25A1\u25A3-\u25A9\u25B2-\u25B3\u25B6-\u25B7\u25BC-\u25BD\u25C0-\u25C1\u25C6-\u25C8\u25CB\u25CE-\u25D1\u25E2-\u25E5\u25EF\u2605-\u2606\u2609\u260E-\u260F\u261C\u261E\u2640\u2642\u2660-\u2661\u2663-\u2665\u2667-\u266A\u266C-\u266D\u266F\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2C6F\u2C71-\u2C7D\u2C80-\u2CE4\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3000-\u3003\u3005-\u3017\u301D-\u301F\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u321C\u3220-\u3229\u3231-\u3232\u3239\u3260-\u327B\u327F\u32A3-\u32A8\u3303\u330D\u3314\u3318\u3322-\u3323\u3326-\u3327\u332B\u3336\u333B\u3349-\u334A\u334D\u3351\u3357\u337B-\u337E\u3380-\u3384\u3388-\u33CA\u33CD-\u33D3\u33D5-\u33D6\u33D8\u33DB-\u33DD\u3400-\u4DB5\u4E00-\u9FC3\uA000-\uA48C\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA65F\uA662-\uA66E\uA680-\uA697\uA722-\uA787\uA78B-\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA90A-\uA925\uA930-\uA946\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAC00-\uD7A3\uE000-\uF848\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE30-\uFE31\uFE33-\uFE44\uFE49-\uFE52\uFE54-\uFE57\uFE59-\uFE66\uFE68-\uFE6B\uFE70-\uFE74\uFE76-\uFEFC\uFF01-\uFF5E\uFF61-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE0-\uFFE6";
- str_namedRanges += "\\p{M}*";
+ var str_namedRanges = "A-Za-z\u005F\u0080-\u0081\u0083\u0085-\u0087\u0089-\u008A\u008C-\u0091\u0093-\u0094\u0096-\u0097\u0099-\u009A\u009C-\u009F\u00A1-\u00A5\u00A7-\u00A8\u00AA\u00AD\u00AF-\u00BA\u00BC-\u02B8\u02BB-\u02C1\u02C7\u02C9-\u02CB\u02CD\u02D0-\u02D1\u02D8-\u02DB\u02DD\u02E0-\u02E4\u02EE\u0370-\u0373\u0376-\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0972\u097B-\u097F\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09C0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58-\u0C59\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E3A\u0E40-\u0E4E\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1159\u115F-\u11A2\u11A8-\u11F9\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u1676\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19A9\u19C1-\u19C7\u1A00-\u1A16\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200e\u2010\u2013-\u2016\u2018\u201C-\u201D\u2020-\u2021\u2025-\u2027\u2030\u2032-\u2033\u2035\u203B\u2071\u2074\u207F\u2081-\u2084\u2090-\u2094\u2102-\u2103\u2105\u2107\u2109-\u2113\u2115-\u2116\u2119-\u211D\u2121-\u2122\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2153-\u2154\u215B-\u215E\u2160-\u2188\u2190-\u2199\u21D2\u21D4\u2200\u2202-\u2203\u2207-\u2208\u220B\u220F\u2211\u2215\u221A\u221D-\u2220\u2223\u2225\u2227-\u222C\u222E\u2234-\u2237\u223C-\u223D\u2248\u224C\u2252\u2260-\u2261\u2264-\u2267\u226A-\u226B\u226E-\u226F\u2282-\u2283\u2286-\u2287\u2295\u2299\u22A5\u22BF\u2312\u2460-\u24B5\u24D0-\u24E9\u2500-\u254B\u2550-\u2574\u2581-\u258F\u2592-\u2595\u25A0-\u25A1\u25A3-\u25A9\u25B2-\u25B3\u25B6-\u25B7\u25BC-\u25BD\u25C0-\u25C1\u25C6-\u25C8\u25CB\u25CE-\u25D1\u25E2-\u25E5\u25EF\u2605-\u2606\u2609\u260E-\u260F\u261C\u261E\u2640\u2642\u2660-\u2661\u2663-\u2665\u2667-\u266A\u266C-\u266D\u266F\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2C6F\u2C71-\u2C7D\u2C80-\u2CE4\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3000-\u3003\u3005-\u3017\u301D-\u301F\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u321C\u3220-\u3229\u3231-\u3232\u3239\u3260-\u327B\u327F\u32A3-\u32A8\u3303\u330D\u3314\u3318\u3322-\u3323\u3326-\u3327\u332B\u3336\u333B\u3349-\u334A\u334D\u3351\u3357\u337B-\u337E\u3380-\u3384\u3388-\u33CA\u33CD-\u33D3\u33D5-\u33D6\u33D8\u33DB-\u33DD\u3400-\u4DB5\u4E00-\u9FC3\uA000-\uA48C\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA65F\uA662-\uA66E\uA680-\uA697\uA722-\uA787\uA78B-\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA90A-\uA925\uA930-\uA946\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAC00-\uD7A3\uE000-\uF848\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE30-\uFE31\uFE33-\uFE44\uFE49-\uFE52\uFE54-\uFE57\uFE59-\uFE66\uFE68-\uFE6B\uFE70-\uFE74\uFE76-\uFEFC\uFF01-\uFF5E\uFF61-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE0-\uFFE6";
+ str_namedRanges += "\\p{M}";
var str_namedSheetsRange = "\u0001-\u0026\u0028-\u0029\u002B-\u002D\u003B-\u003E\u0040\u005E\u0060\u007B-\u007F\u0082\u0084\u008B\u0092\u0095\u0098\u009B\u00A0\u00A6\u00A9\u00AB-\u00AC\u00AE\u00BB\u0378-\u0379\u037E-\u0383\u0387\u038B\u038D\u03A2\u0524-\u0530\u0557-\u0558\u055A-\u0560\u0588-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EF\u05F3-\u05FF\u0604-\u0605\u0609-\u060A\u060C-\u060D\u061B-\u061E\u0620\u065F\u066A-\u066D\u06D4\u0700-\u070E\u074B-\u074C\u07B2-\u07BF\u07F7-\u07F9\u07FB-\u0900\u093A-\u093B\u094E-\u094F\u0955-\u0957\u0964-\u0965\u0970\u0973-\u097A\u0980\u0984\u098D-\u098E\u0991-\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BB\u09C5-\u09C6\u09C9-\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4-\u09E5\u09FB-\u0A00\u0A04\u0A0B-\u0A0E\u0A11-\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A3B\u0A3D\u0A43-\u0A46\u0A49-\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABB\u0AC6\u0ACA\u0ACE-\u0ACF\u0AD1-\u0ADF\u0AE4-\u0AE5\u0AF0\u0AF2-\u0B00\u0B04\u0B0D-\u0B0E\u0B11-\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3B\u0B45-\u0B46\u0B49-\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64-\u0B65\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE-\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64-\u0C65\u0C70-\u0C77\u0C80-\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4-\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D29\u0D3A-\u0D3C\u0D45\u0D49\u0D4E-\u0D56\u0D58-\u0D5F\u0D64-\u0D65\u0D76-\u0D78\u0D80-\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE-\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3E\u0E4F\u0E5A-\u0E80\u0E83\u0E85-\u0E86\u0E89\u0E8B-\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8-\u0EA9\u0EAC\u0EBA\u0EBE-\u0EBF\u0EC5\u0EC7\u0ECE-\u0ECF\u0EDA-\u0EDB\u0EDE-\u0EFF\u0F04-\u0F12\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F8C-\u0F8F\u0F98\u0FBD\u0FCD\u0FD0-\u0FFF\u104A-\u104F\u109A-\u109D\u10C6-\u10CF\u10FB\u10FD-\u10FF\u115A-\u115E\u11A3-\u11A7\u11FA-\u11FF\u1249\u124E-\u124F\u1257\u1259\u125E-\u125F\u1289\u128E-\u128F\u12B1\u12B6-\u12B7\u12BF\u12C1\u12C6-\u12C7\u12D7\u1311\u1316-\u1317\u135B-\u135E\u1361-\u1368\u137D-\u137F\u139A-\u139F\u13F5-\u1400\u166D-\u166E\u1677-\u167F\u169B-\u169F\u16EB-\u16ED\u16F1-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DA\u17DE-\u17DF\u17EA-\u17EF\u17FA-\u180A\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1945\u196E-\u196F\u1975-\u197F\u19AA-\u19AF\u19CA-\u19CF\u19DA-\u19DF\u1A1C-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BAB-\u1BAD\u1BBA-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E-\u1CFF\u1DE7-\u1DFD\u1F16-\u1F17\u1F1E-\u1F1F\u1F46-\u1F47\u1F4E-\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E-\u1F7F\u1FB5\u1FC5\u1FD4-\u1FD5\u1FDC\u1FF0-\u1FF1\u1FF5\u1FFF\u200e\u2011-\u2012\u2017\u2019-\u201B\u201E-\u201F\u2022-\u2024\u2031\u2034\u2036-\u203A\u203C-\u2043\u2045-\u2051\u2053-\u205E\u2065-\u2069\u2072-\u2073\u207D-\u207E\u208D-\u208F\u2095-\u209F\u20B6-\u20CF\u20F1-\u20FF\u2150-\u2152\u2189-\u218F\u2329-\u232A\u23E8-\u23FF\u2427-\u243F\u244B-\u245F\u269E-\u269F\u26BD-\u26BF\u26C4-\u2700\u2705\u270A-\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u275F-\u2760\u2768-\u2775\u2795-\u2797\u27B0\u27BF\u27C5-\u27C6\u27CB\u27CD-\u27CF\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC-\u29FD\u2B4D-\u2B4F\u2B55-\u2BFF\u2C2F\u2C5F\u2C70\u2C7E-\u2C7F\u2CEB-\u2CFC\u2CFE-\u2CFF\u2D26-\u2D2F\u2D66-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3018-\u301C\u3030\u303D\u3040\u3097-\u3098\u30A0\u3100-\u3104\u312E-\u3130\u318F\u31B8-\u31BF\u31E4-\u31EF\u321F\u3244-\u324F\u32FF\u4DB6-\u4DBF\u9FC4-\u9FFF\uA48D-\uA48F\uA4C7-\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA660-\uA661\uA673-\uA67B\uA67E\uA698-\uA6FF\uA78D-\uA7FA\uA82C-\uA83F\uA874-\uA87F\uA8C5-\uA8CF\uA8DA-\uA8FF\uA92F\uA954-\uA9FF\uAA37-\uAA3F\uAA4E-\uAA4F\uAA5A-\uABFF\uD7A4-\uD7FF\uFA2E-\uFA2F\uFA6B-\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90-\uFD91\uFDC8-\uFDEF\uFDFE-\uFDFF\uFE10-\uFE1F\uFE27-\uFE2F\uFE32\uFE45-\uFE48\uFE53\uFE58\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFEFE\uFF00\uFF5F-\uFF60\uFFBF-\uFFC1\uFFC8-\uFFC9\uFFD0-\uFFD1\uFFD8-\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFF8\uFFFE-\uFFFF",
rx_operators = /^ *[-+*\/^&%<=>:] */,
@@ -2876,43 +2924,57 @@
//var regExpExceptExternalLink = /('?[a-zA-Z0-9\s\[\]\.]{1,99})?'?!?\$?[a-zA-Z]{1,3}\$?[0-9]{1,7}(:\$?[a-zA-Z]{1,3}\$?[0-9]{1,7})?/;
//'path/[name]Sheet1'!A1
- var path, name, startLink, i;
- url = url && url.split(FormulaSeparators.functionArgumentSeparator)[0];
- if (url && url[0] === "'"/*url.match(/('[^\[]*\[[^\]]+\]([^'])+'!)/g)*/) {
- for (i = url.length - 1; i >= 0; i--) {
- if (url[i] === "!" && url[i - 1] === "'") {
- startLink = true;
- i--;
- continue;
+ let path, name, startLink, i, exclamationMarkIndex;
+ if (url && url.indexOf("[") !== -1) {
+ //todo check on other separators, exm -> SUM(A2 '[new.xlsx]Sheet1'!A1 '[new.xlsx]Sheet1'!A2)
+ for (let j = 0; j < url.length; j++) {
+ if (!exclamationMarkIndex && url[j] === "!") {
+ exclamationMarkIndex = j;
+ }
+
+ if (url[j] === FormulaSeparators.functionArgumentSeparator || url[j] === FormulaSeparators.functionArgumentSeparatorDef || url[j] === ";") {
+ url = url.substring(0, j);
+ break;
}
- if (startLink) {
- if (name) {
- if (url[i] === "[" && (url[i - 1] === "/" || url[i - 1] === "/\/" || url[i - 1] === "\\" || (url[i - 1] === "'") && i === 1)) {
- break;
+ }
+
+
+ if (url && url[0] === "'"/*url.match(/('[^\[]*\[[^\]]+\]([^'])+'!)/g)*/) {
+ for (i = exclamationMarkIndex ? exclamationMarkIndex : url.length - 1; i >= 0; i--) {
+ if (url[i] === "!" && url[i - 1] === "'") {
+ startLink = true;
+ i--;
+ continue;
+ }
+ if (startLink) {
+ if (name) {
+ if (url[i] === "[" && (url[i - 1] === "/" || url[i - 1] === "/\/" || url[i - 1] === "\\" || (url[i - 1] === "'") && i === 1)) {
+ break;
+ } else {
+ name.end--;
+ }
} else {
- name.end--;
- }
- } else {
- if("]" === url[i]) {
- name = {start: i, end: i};
+ if("]" === url[i]) {
+ name = {start: i, end: i};
+ }
}
}
}
- }
- if (name) {
- var fullname = url.substring(0, name.start + 1);
- path = url.substring(1, name.end - 1);
- name = url.substring(name.end, name.start);
- return {name: name, path: path, fullname: fullname};
- }
- } else if (url && url[0] === "[") { // [name]Sheet1!A1
- for (i = 1; i < url.length; i++) {
- if (url[i] === "]") {
- return {name: url.substring(1, i), path: "", fullname: url.substring(0, i + 1)};
+ if (name) {
+ var fullname = url.substring(0, name.start + 1);
+ path = url.substring(1, name.end - 1);
+ name = url.substring(name.end, name.start);
+ return {name: name, path: path, fullname: fullname};
}
- }
- } else if (true) { //https://s3.amazonaws.com/nct-files/xlsx/[ExternalLinksDestination.xlsx]Sheet1!A1:A2
+ } else if (url && url[0] === "[") { // [name]Sheet1!A1
+ for (i = 1; i < url.length; i++) {
+ if (url[i] === "]") {
+ return {name: url.substring(1, i), path: "", fullname: url.substring(0, i + 1)};
+ }
+ }
+ } else if (true) { //https://s3.amazonaws.com/nct-files/xlsx/[ExternalLinksDestination.xlsx]Sheet1!A1:A2
+ }
}
return null;
@@ -3342,10 +3404,12 @@
if (external) {
externalLength = external.fullname.length;
subSTR = formula.substring(start_pos + externalLength);
- if (-1 !== subSTR.indexOf("'")) {
- externalLength += 1;
+ const posQuote = subSTR.indexOf("'");
+ if (-1 !== posQuote) {
+ externalLength -= 1;
+ subSTR = "'" + subSTR;
}
- subSTR = subSTR.replace("'", "");
+
external = external.path + external.name;
}
}
@@ -3700,8 +3764,8 @@
this._reset();
}
- var subSTR = formula.substring(start_pos),
- match = XRegExp.exec(subSTR, local ? rx_table_local : rx_table);
+ let subSTR = formula.substring(start_pos),
+ match = XRegExp.exec(subSTR, local ? rx_table_local : rx_table);
if (match != null && match["tableName"])
{
@@ -4203,10 +4267,15 @@
this.m_nOFormLoadCounter = 0;
this.m_nOFormEditCounter = 0;
+
+ this.m_nTurnOffCounter = 0;
}
CIdCounter.prototype.Get_NewId = function ()
{
+ if (!AscCommon.g_oTableId.IsOn())
+ return ("off_" + (++this.m_nTurnOffCounter));
+
if (true === this.m_bLoad || null === this.m_sUserId)
{
this.m_nIdCounterLoad++;
@@ -4303,6 +4372,11 @@
oLogicDocument.Document_UpdateInterfaceState(false);
}
}
+ let oCustomProperties = oApi.getCustomProperties && oApi.getCustomProperties();
+ if(oCustomProperties && oCustomProperties.Lock === this)
+ {
+ oApi.sendEvent("asc_onCustomPropertiesLocked", this.Is_Locked());
+ }
};
CLock.prototype.Check = function (Id)
{
@@ -4371,13 +4445,17 @@
{
this.m_aChanges.length = 0;
};
- CContentChanges.prototype.Check = function (Type, Pos)
+ CContentChanges.prototype.GetPos = function(pos)
+ {
+ return this.Check(AscCommon.contentchanges_Remove, pos, true);
+ };
+ CContentChanges.prototype.Check = function (Type, Pos, checkPos)
{
var CurPos = Pos;
var Count = this.m_aChanges.length;
for (var Index = 0; Index < Count; Index++)
{
- var NewPos = this.m_aChanges[Index].Check_Changes(Type, CurPos);
+ var NewPos = this.m_aChanges[Index].Check_Changes(Type, CurPos, checkPos);
if (false === NewPos)
return false;
@@ -4430,20 +4508,23 @@
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
};
- CContentChangesElement.prototype.Check_Changes = function (Type, Pos)
+ CContentChangesElement.prototype.Check_Changes = function (Type, Pos, checkPos)
{
var CurPos = Pos;
- if (contentchanges_Add === Type)
+ if (AscCommon.contentchanges_Add === Type)
{
for (var Index = 0; Index < this.m_nCount; Index++)
{
if (false !== this.m_aPositions[Index])
{
if (CurPos <= this.m_aPositions[Index])
- this.m_aPositions[Index]++;
+ {
+ if (!checkPos)
+ this.m_aPositions[Index]++;
+ }
else
{
- if (contentchanges_Add === this.m_nType)
+ if (AscCommon.contentchanges_Add === this.m_nType)
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
@@ -4455,29 +4536,35 @@
{
for (var Index = 0; Index < this.m_nCount; Index++)
{
- if (false !== this.m_aPositions[Index])
+ if (false === this.m_aPositions[Index])
+ continue;
+
+ if (CurPos < this.m_aPositions[Index])
{
- if (CurPos < this.m_aPositions[Index])
+ if (!checkPos)
this.m_aPositions[Index]--;
- else if (CurPos > this.m_aPositions[Index])
+ }
+ else if (CurPos > this.m_aPositions[Index])
+ {
+ if (AscCommon.contentchanges_Add === this.m_nType)
+ CurPos++;
+ else //if ( contentchanges_Remove === this.m_nType )
+ CurPos--;
+ }
+ else //if ( CurPos === this.m_aPositions[Index] )
+ {
+ if (AscCommon.contentchanges_Remove === this.m_nType)
{
- if (contentchanges_Add === this.m_nType)
- CurPos++;
- else //if ( contentchanges_Remove === this.m_nType )
- CurPos--;
+ // Мы попали в позицию, удаленную другим пользователем
+ // Если наше действие удаляем тоже самое место, то помечаем, что удалять ничего не нужно
+ if (!checkPos)
+ this.m_aPositions[Index] = false;
+
+ return false;
}
- else //if ( CurPos === this.m_aPositions[Index] )
+ else
{
- if (AscCommon.contentchanges_Remove === this.m_nType)
- {
- // Отмечаем, что действия совпали
- this.m_aPositions[Index] = false;
- return false;
- }
- else
- {
- CurPos++;
- }
+ CurPos++;
}
}
}
@@ -4649,11 +4736,183 @@
return ((num - 1) % nLastTrueSymbol) + 1;
}
+ function getANDConjunctionLang(nLang)
+ {
+ const sLang = languages[nLang];
+ switch (sLang)
+ {
+ case "tr-TR":
+ return "ve";
+ case 'fr-FR':
+ return "et";
+ case 'de-DE':
+ return "und";
+ case 'es-ES':
+ return "con";
+ case 'nl-NL':
+ return "en";
+ case 'sv-SE':
+ case 'sk-SK':
+ return "";
+ case 'pt-BR':
+ case 'pt-PT':
+ case 'it-IT':
+ return "e";
+ case 'el-GR':
+ return "και";
+ case "sr-Cyrl-RS":
+ case 'pl-PL':
+ case "sr-Latn-RS":
+ return "i";
+ case 'cs-CZ':
+ return "a";
+ case 'ru-RU':
+ return "и";
+ case "eu-ES":
+ return "koma";
+ case "hy-AM":
+ case "gl-ES":
+ case 'ko-KR':
+ case 'vi-VN':
+ case 'zh-CN':
+ case 'ja-JP':
+ case 'en-GB':
+ case "ms-MY":
+ case 'bg-BG':
+ case 'lv-LV':
+ case 'az-Latn-AZ':
+ case "si-LK":
+ case "ar-SA":
+ case 'en-US':
+ case "zh-TW":
+ case 'uk-UA':
+ default:
+ return "and";
+ }
+ }
+
function getAlphaBetForOrdinalText(language)
{
var alphaBet = {};
switch (language)
{
+ case "sr-Cyrl-RS": {
+ alphaBet = {
+ "нула" : "нулти",
+ "један" : "први",
+ "два" : "други",
+ "три" : "трећи",
+ "четири" : "четврти",
+ "пет" : "пети",
+ "шест" : "шести",
+ "седам" : "седми",
+ "осам" : "осми",
+ "девет" : "девети",
+ "десет" : "десети",
+ "једанаест" : "једанаести",
+ "дванаест" : "дванаести",
+ "тринаест" : "тринаести",
+ "четрнаест" : "четрнаести",
+ "петнаест" : "петнаести",
+ "шеснаест" : "шеснаести",
+ "седамнаест": "седамнаести",
+ "осамнаест" : "осамнаести",
+ "деветнаест": "деветнаести",
+ "двадесет" : "двадесети",
+ "тридесет" : "тридесети",
+ "четрдесет" : "четрдесети",
+ "педесет" : "педесети",
+ "шездесет" : "шездесети",
+ "седамдесет": "седамдесети",
+ "осамдесет" : "осамдесети",
+ "деведесет" : "деведесети",
+ "сто" : "стоти",
+ "двјесто" : "двјестоти",
+ "тристо" : "тристоти",
+ "четиристо" : "четиристоти",
+ "петсто" : "петстоти",
+ "шесто" : "шестстоти",
+ "седамсто" : "седамстоти",
+ "осамсто" : "осамстоти",
+ "деветсто" : "деветстоти",
+ "тисућу" : "тисућити",
+ "тисуће" : "тисућити",
+ "тисућа" : "тисућити"
+ };
+ break;
+ }
+ case "sr-Latn-RS": {
+ alphaBet = {
+ "nula" : "nulti",
+ "jedan" : "prvi",
+ "dva" : "drugi",
+ "tri" : "treći",
+ "četiri" : "četvrti",
+ "pet" : "peti",
+ "šest" : "šesti",
+ "sedam" : "sedmi",
+ "osam" : "osmi",
+ "devet" : "deveti",
+ "deset" : "deseti",
+ "jedanaest" : "jedanaesti",
+ "dvanaest" : "dvanaesti",
+ "trinaest" : "trinaesti",
+ "četrnaest" : "četrnaesti",
+ "petnaest" : "petnaesti",
+ "šesnaest" : "šesnaesti",
+ "sedamnaest": "sedamnaesti",
+ "osamnaest" : "osamnaesti",
+ "devetnaest": "devetnaesti",
+ "dvadeset" : "dvadeseti",
+ "trideset" : "trideseti",
+ "četrdeset" : "četrdeseti",
+ "pedeset" : "pedeseti",
+ "šezdeset" : "šezdeseti",
+ "sedamdeset": "sedamdeseti",
+ "osamdeset" : "osamdeseti",
+ "devedeset" : "devedeseti",
+ "sto" : "stoti",
+ "dvjesto" : "dvjestoti",
+ "tristo" : "tristoti",
+ "četiristo" : "četiristoti",
+ "petsto" : "petstoti",
+ "šesto" : "šeststoti",
+ "sedamsto" : "sedamstoti",
+ "osamsto" : "osamstoti",
+ "devetsto" : "devetstoti",
+ "tisuću" : "tisućiti",
+ "tisuće" : "tisućiti",
+ "tisuća" : "tisućiti"
+
+ };
+ break;
+ }
+ case "tr-TR": {
+ alphaBet = {
+ "sıfır" : "sıfırıncı",
+ "bir" : "birinci",
+ "iki" : "ikinci",
+ "üç" : "üçüncü",
+ "dört" : "dördüncü",
+ "beş" : "beşinci",
+ "altı" : "altıncı",
+ "yedi" : "yedinci",
+ "sekiz" : "sekizinci",
+ "dokuz" : "dokuzuncu",
+ "on" : "onuncu",
+ "yirmi" : "yirminci",
+ "otuz" : "otuzuncu",
+ "kırk" : "kırkıncı",
+ "elli" : "ellinci",
+ "altmış": "altmışıncı",
+ "yetmiş": "yetmişinci",
+ "seksen": "sekseninci",
+ "doksan": "doksanıncı",
+ "yüz" : "yüzüncü",
+ "bin" : "bininci"
+ };
+ break;
+ }
case "bg-BG":
alphaBet = {
0: ['нулевят'],
@@ -5324,6 +5583,12 @@
case 'ko-KR':
case 'az-Latn-AZ':
case 'en-US':
+ case 'si-LK':
+ case 'ar-SA':
+ case 'gl-ES':
+ case 'hy-AM':
+ case 'ms-MY':
+ case 'zh-TW':
case 'vi-VN':
case 'en-GB':
default:
@@ -5351,6 +5616,76 @@
var alphaBet = {};
switch (language)
{
+ case "eu-ES":
+ alphaBet = {
+ 0 : ["zero"],
+ 1 : [
+ "bat",
+ "bi",
+ "hiru",
+ "lau",
+ "bost",
+ "sei",
+ "zazpi",
+ "zortzi",
+ "bederatzi",
+ "hamar",
+ "hamaika",
+ "hamabi",
+ "hamairu",
+ "hamalau",
+ "hamabost",
+ "hamasei",
+ "hamazazpi",
+ "hemezortzi",
+ "hemeretzi"
+ ],
+ 10 : [
+ "hogei",
+ "berrogei",
+ "hirurogei",
+ "laurogei"
+ ],
+ 100: [
+ "ehun",
+ "berrehun",
+ "hirurehun",
+ "laurehun",
+ "bostehun",
+ "seiehun",
+ "zazpiehun",
+ "zortziehun",
+ "bederatziehun"
+ ]
+ };
+ break;
+ case "tr-TR":
+ alphaBet = {
+ 0 : ["sıfır"],
+ 1 : [
+ "bir",
+ "iki",
+ "üç",
+ "dört",
+ "beş",
+ "altı",
+ "yedi",
+ "sekiz",
+ "dokuz"
+ ],
+ 10: [
+ "on",
+ "yirmi",
+ "otuz",
+ "kırk",
+ "elli",
+ "altmış",
+ "yetmiş",
+ "seksen",
+ "doksan"
+ ]
+ };
+ break;
case"bg-BG":
alphaBet = {
0: ['нула'],
@@ -5407,6 +5742,118 @@
]
};
break;
+ case "sr-Cyrl-RS":
+ alphaBet = {
+ 0: ["нула"],
+ 1: [
+ "један",
+ "два",
+ "три",
+ "четири",
+ "пет",
+ "шест",
+ "седам",
+ "осам",
+ "девет",
+ "десет",
+ "једанаест",
+ "дванаест",
+ "тринаест",
+ "четрнаест",
+ "петнаест",
+ "шеснаест",
+ "седамнаест",
+ "осамнаест",
+ "деветнаест"
+ ],
+ 10: [
+ "двадесет",
+ "тридесет",
+ "четрдесет",
+ "педесет",
+ "шездесет",
+ "седамдесет",
+ "осамдесет",
+ "деведесет"
+ ],
+ 100: [
+ "сто",
+ "двјесто",
+ "тристо",
+ "четиристо",
+ "петсто",
+ "шесто",
+ "седамсто",
+ "осамсто",
+ "деветсто"
+ ],
+ "thousand": [
+ "тисућу",
+ "тисуће",
+ "тисућа"
+ ],
+ 'thousandType': [
+ "један",
+ "двије"
+ ]
+ };
+ break;
+ case "sr-Latn-RS":
+ alphaBet = {
+ 0: ["nula"],
+ 1: [
+ "jedan",
+ "dva",
+ "tri",
+ "četiri",
+ "pet",
+ "šest",
+ "sedam",
+ "osam",
+ "devet",
+ "deset",
+ "jedanaest",
+ "dvanaest",
+ "trinaest",
+ "četrnaest",
+ "petnaest",
+ "šesnaest",
+ "sedamnaest",
+ "osamnaest",
+ "devetnaest"
+ ],
+ 10: [
+ "dvadeset",
+ "trideset",
+ "četrdeset",
+ "pedeset",
+ "šezdeset",
+ "sedamdeset",
+ "osamdeset",
+ "devedeset"
+ ],
+ 100: [
+ "sto",
+ "dvjesto",
+ "tristo",
+ "četiristo",
+ "petsto",
+ "šesto",
+ "sedamsto",
+ "osamsto",
+ "devetsto"
+ ],
+ "thousand": [
+ "tisuću",
+ "tisuće",
+ "tisuća"
+ ],
+ 'thousandType': [
+ "jedan",
+ "dvije"
+ ]
+ };
+ break;
case"cs-CZ":
alphaBet = {
0: ['nula'],
@@ -6061,6 +6508,12 @@
};
break;
case 'en-US':
+ case 'si-LK':
+ case 'ar-SA':
+ case 'gl-ES':
+ case 'hy-AM':
+ case 'ms-MY':
+ case 'zh-TW':
case 'az-Latn-AZ':
case 'en-GB':
case 'ja-JP':
@@ -6123,6 +6576,8 @@
switch (lang)
{
+ case 'sr-Latn-RS':
+ case 'sr-Cyrl-RS':
case 'ru-RU':
case 'uk-UA':
case 'cs-CZ':
@@ -6241,7 +6696,7 @@
return resArr;
};
- if (lang === 'uk-UA' || lang === 'cs-CZ' || lang === 'pl-PL' || lang === 'el-GR' || lang === 'lv-LV')
+ if (lang === 'uk-UA' || lang === 'cs-CZ' || lang === 'pl-PL' || lang === 'el-GR' || lang === 'lv-LV' || lang === 'sr-Latn-RS' || lang === 'sr-Cyrl-RS')
{
arrAnswer = cardinalSplittingCyrillicMim(nValue, true);
} else if (lang === 'ru-RU')
@@ -6746,6 +7201,74 @@
};
break;
}
+ case "eu-ES":
+ {
+ const letterNumberLessThen100EU = function (nNum)
+ {
+ var resArr = [];
+ if (nNum < 100 && nNum > 0)
+ {
+ const nDegree1 = nNum % 20;
+ const nDegree10 = Math.floor(nNum / 20);
+ if (nDegree10 && nDegree1)
+ {
+ resArr.push(alphaBet[10][nDegree10 - 1] + "ta", alphaBet[1][nDegree1 - 1]);
+ }
+ else if (nDegree10)
+ {
+ resArr.push(alphaBet[10][nDegree10 - 1]);
+ }
+ else
+ {
+ resArr.push(alphaBet[1][nDegree1 - 1]);
+ }
+ }
+
+ return resArr;
+ };
+ const cardinalSplittingEU = function (nNum, bNotPushEta)
+ {
+ const resArr = [];
+ if (nNum < 1000000 && nNum > 0)
+ {
+ const oGroups = {};
+ oGroups[1000] = Math.floor(nNum / 1000);
+ nNum %= 1000;
+ oGroups[100] = Math.floor(nNum / 100);
+ nNum %= 100;
+ oGroups[1] = nNum;
+ if (oGroups[1000])
+ {
+ if (oGroups[1000] >= 100)
+ {
+ resArr.push.apply(resArr, cardinalSplittingEU(oGroups[1000], true));
+ }
+ else if (oGroups[1000] !== 1)
+ {
+ resArr.push.apply(resArr, letterNumberLessThen100EU(oGroups[1000]));
+ }
+ resArr.push("mila");
+ }
+
+ if (oGroups[100])
+ {
+ resArr.push(alphaBet[100][oGroups[100] - 1]);
+ }
+
+ if (oGroups[1])
+ {
+ if ((oGroups[100] || oGroups[1000]) && !bNotPushEta)
+ {
+ resArr.push("eta");
+ }
+ resArr.push.apply(resArr, letterNumberLessThen100EU(oGroups[1]));
+ }
+ }
+ return resArr;
+ }
+ arrAnswer = cardinalSplittingEU(nValue);
+ break;
+ }
case 'it-IT':
{
var letterNumberLessThen100IT = function(num)
@@ -7027,7 +7550,77 @@
break;
}
+ case 'tr-TR':
+ const letterNumberLessThen100TR = function (nNum)
+ {
+ const resArr = [];
+ if (nNum < 100 && nNum > 0)
+ {
+ const nDegree1 = nNum % 10;
+ const nDegree10 = Math.floor(nNum / 10);
+
+ if (nDegree10)
+ {
+ resArr.push(alphaBet[10][nDegree10 - 1]);
+ }
+ if (nDegree1)
+ {
+ resArr.push(alphaBet[1][nDegree1 - 1]);
+ }
+ }
+ return resArr;
+ }
+ const cardinalSplittingTR = function (nNum)
+ {
+ const resArr = [];
+ if (nNum < 1000000 && nNum > 0)
+ {
+ const oGroups = {};
+ oGroups[1000] = Math.floor(nNum / 1000);
+ nNum = nNum % 1000;
+ oGroups[100] = Math.floor(nNum / 100);
+ nNum = nNum % 100;
+ oGroups[1] = nNum;
+ if (oGroups[1000])
+ {
+ if (oGroups[1000] >= 100)
+ {
+ resArr.push.apply(resArr, cardinalSplittingTR(oGroups[1000]));
+ }
+ else if (oGroups[1000] !== 1)
+ {
+ resArr.push.apply(resArr, letterNumberLessThen100TR(oGroups[1000]));
+ }
+ resArr.push("bin");
+ }
+ if (oGroups[100])
+ {
+ if (oGroups[100] !== 1)
+ {
+ resArr.push.apply(resArr, letterNumberLessThen100TR(oGroups[100]));
+ }
+ resArr.push("yüz");
+ }
+ if (oGroups[1])
+ {
+ resArr.push.apply(resArr, letterNumberLessThen100TR(oGroups[1]));
+ }
+ }
+ return resArr;
+ }
+ arrAnswer = cardinalSplittingTR(nValue);
+ getConcatStringByRule = function (array)
+ {
+ return array.join("");
+ }
+ break;
case 'en-US':
+ case 'gl-ES':
+ case 'si-LK':
+ case 'ar-SA':
+ case 'hy-AM':
+ case 'ms-MY':
+ case 'zh-TW':
case 'az-Latn-AZ':
case 'en-GB':
case 'ja-JP':
@@ -8320,6 +8913,10 @@
switch (textLang)
{
case 'de-DE':
+ case 'eu-ES':
+ case 'tr-TR':
+ case 'sr-Cyrl-RS':
+ case 'sr-Latn-RS':
case 'pl-PL':
case 'cs-CZ':
{
@@ -8383,6 +8980,12 @@
}
case 'bg-BG':
case 'en-GB':
+ case 'gl-ES':
+ case 'si-LK':
+ case 'ar-SA':
+ case 'hy-AM':
+ case 'ms-MY':
+ case 'zh-TW':
case 'en-US':
case 'zh-CN':
case 'uk-UA':
@@ -8571,6 +9174,21 @@
return sResult;
}
+ function getCardinalTextToSentenceCase(sText, sLang)
+ {
+ switch (sLang)
+ {
+ case "tr-TR":
+ if (sText[0] === "i")
+ {
+ return "İ" + sText.slice(1, sText.length);
+ }
+ return sText.sentenceCase();
+ default:
+ return sText.sentenceCase();
+ }
+ }
+
function IntToOrdinalText(nValue, nLang)
{
var textLang = languages[nLang];
@@ -8579,12 +9197,35 @@
{
if (alphaBet[0] && alphaBet[0][0])
{
- return alphaBet[0][0].sentenceCase();
+ return getCardinalTextToSentenceCase(alphaBet[0][0], textLang);
}
}
var ordinalText = getCardinalTextFromValue(textLang, nValue);
switch (textLang)
{
+ case 'eu-ES':
+ {
+ const arrOfDigits = ordinalText.arrAnswer;
+ if (nValue === 1)
+ {
+ arrOfDigits[arrOfDigits.length - 1] = "lehenengo";
+ }
+ else if (arrOfDigits[arrOfDigits.length - 1])
+ {
+ arrOfDigits[arrOfDigits.length - 1] = arrOfDigits[arrOfDigits.length - 1] + "garren";
+ }
+ break;
+ }
+ case 'tr-TR':
+ {
+ const arrOfDigits = ordinalText.arrAnswer;
+ const sLastWord = arrOfDigits[arrOfDigits.length - 1];
+ if (alphaBet[sLastWord])
+ {
+ arrOfDigits[arrOfDigits.length - 1] = alphaBet[sLastWord];
+ }
+ break;
+ }
case 'de-DE':
{
var arrOfDigits = ordinalText.arrAnswer;
@@ -8844,6 +9485,28 @@
}
break;
}
+ case 'sr-Cyrl-RS':
+ case 'sr-Latn-RS':
+ {
+ const arrOfDigits = ordinalText.arrAnswer;
+ const sLastWord = arrOfDigits[arrOfDigits.length - 1];
+ if (sLastWord)
+ {
+ const reminder100 = nValue % 100;
+ const degree10 = Math.floor(reminder100 / 10);
+ const degree1 = reminder100 % 10;
+ if (degree10 && degree1 && reminder100 >= 20)
+ {
+ arrOfDigits[arrOfDigits.length - 1] = alphaBet[arrOfDigits[arrOfDigits.length - 1]];
+ arrOfDigits[arrOfDigits.length - 2] = alphaBet[arrOfDigits[arrOfDigits.length - 2]];
+ }
+ else
+ {
+ arrOfDigits[arrOfDigits.length - 1] = alphaBet[arrOfDigits[arrOfDigits.length - 1]];
+ }
+ }
+ break;
+ }
case 'uk-UA':
case 'pl-PL':
case 'ru-RU':
@@ -9009,6 +9672,12 @@
case 'ko-KR':
case 'az-Latn-AZ':
case 'en-US':
+ case 'si-LK':
+ case 'ar-SA':
+ case 'gl-ES':
+ case 'zh-TW':
+ case 'ms-MY':
+ case 'hy-AM':
case 'vi-VN':
case 'en-GB':
default:
@@ -9033,7 +9702,7 @@
break;
}
}
- return ordinalText.getConcatStringByRule(ordinalText.arrAnswer).sentenceCase();
+ return getCardinalTextToSentenceCase(ordinalText.getConcatStringByRule(ordinalText.arrAnswer), textLang);
}
var splitHindiCounting = function(alphaBet, degrees, num)
@@ -9194,6 +9863,43 @@
return resArr;
}
+ function NumberToDollarText(nValue, nLang, bIsSkipFractValue)
+ {
+ const nIntValue = Math.floor(nValue);
+ const oCardinalText = getCardinalTextFromValue(languages[nLang], nIntValue);
+ const sIntResult = oCardinalText.getConcatStringByRule(oCardinalText.arrAnswer);
+ if (!bIsSkipFractValue)
+ {
+ const nFractValue = Math.round(nValue * 100) % 100;
+ const sFractValue = nFractValue.toString();
+ const sDollarValue = sFractValue.length === 1 ? "0" + sFractValue : sFractValue;
+ const sFractResult = sDollarValue + "/100";
+
+ const sAndConjunction = getANDConjunctionLang(nLang);
+ return sIntResult + (sAndConjunction.length ? " " + sAndConjunction + " " : " ") + sFractResult;
+ }
+ return sIntResult;
+ }
+
+ function NumberToBahtText(nValue, isSkipFractValue)
+ {
+ const nIntValue = Math.floor(nValue);
+ const nFractValue = Math.round(nValue * 100) % 100;
+ const sIntValue = IntToNumberFormat(nIntValue, Asc.c_oAscNumberingFormat.ThaiCounting);
+
+ if (isSkipFractValue)
+ {
+ return sIntValue;
+ }
+ if (nFractValue)
+ {
+ const sFractValue = IntToNumberFormat(nFractValue, Asc.c_oAscNumberingFormat.ThaiCounting);
+ return sIntValue + "บาท" + sFractValue + "สตางค์";
+ }
+
+ return sIntValue + "บาทถ้วน";
+ }
+
function IntToThaiCounting(nValue)
{
var digits = [
@@ -9278,6 +9984,31 @@
return vietnameseCounting(nValue, digits).join(' ');
}
+ function IntToCustomTurkish(nValue, bLowerCase)
+ {
+ let arrLetters;
+ if (bLowerCase)
+ {
+ arrLetters = [0x0061, 0x0062, 0x0063, 0x00e7, 0x0064, 0x0065, 0x0066, 0x0067, 0x011f, 0x0068, 0x0131, 0x0069, 0x006a,
+ 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x00f6, 0x0070, 0x0072, 0x0073, 0x015f, 0x0074, 0x0075, 0x00fc, 0x0076,
+ 0x0079, 0x007a];
+ }
+ else
+ {
+ arrLetters = [0x0041, 0x0042, 0x0043, 0x00c7, 0x0044, 0x0045, 0x0046, 0x0047, 0x011e, 0x0048, 0x0049, 0x0130, 0x004a,
+ 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x00d6, 0x0050, 0x0052, 0x0053, 0x015e, 0x0054, 0x0055, 0x00dc, 0x0056,
+ 0x0059, 0x005a];
+ }
+ nValue = repeatNumberingLvl(nValue, 870);
+ const nNum = nValue - 1;
+
+ const nAlphabetLength = arrLetters.length;
+ const nOst = nNum % nAlphabetLength;
+ const nCount = ((nNum - nOst) / nAlphabetLength) + 1;
+
+ return String.fromCharCode(arrLetters[nOst]).repeat(nCount);
+ }
+
function IntToCustomGreece(nValue) {
nValue = repeatNumberingLvl(nValue, 9999);
const greeceNumbersMap = {
@@ -9368,12 +10099,14 @@
* Переводим числовое значение в строку с заданным форматом нумерации
* @param nValue {number}
* @param nFormat {Asc.c_oAscNumberingFormat}
- * @param [oLang] {AscCommonWord.CLang}
+ * @param [oPr] {Object}
* @returns {string}
*/
- function IntToNumberFormat(nValue, nFormat, oLang)
+ function IntToNumberFormat(nValue, nFormat, oPr)
{
+ oPr = oPr || {};
var nLang;
+ const oLang = oPr.lang;
if (oLang)
{
nLang = oLang.Val;
@@ -9650,7 +10383,7 @@
break;
case Asc.c_oAscNumberingFormat.CardinalText:
var cardinalText = getCardinalTextFromValue(languages[nLang], nValue);
- sResult = cardinalText.getConcatStringByRule(cardinalText.arrAnswer).sentenceCase();
+ sResult = getCardinalTextToSentenceCase(cardinalText.getConcatStringByRule(cardinalText.arrAnswer), languages[nLang]);
break;
case Asc.c_oAscNumberingFormat.Custom:
@@ -9679,16 +10412,39 @@
sResult = IntToThaiCounting(nValue, nFormat);
break;
case Asc.c_oAscNumberingFormat.DollarText:
- sResult += nValue;
+ if (oPr.isFromField)
+ {
+ sResult = NumberToDollarText(nValue, nLang, oPr.isSkipFractPart);
+ }
+ else
+ {
+ sResult += nValue;
+ }
break;
case Asc.c_oAscNumberingFormat.BahtText:
- sResult += nValue;
+ if (oPr.isFromField)
+ {
+ sResult = NumberToBahtText(nValue, oPr.isSkipFractPart);
+ }
+ else
+ {
+ sResult += nValue;
+ }
break;
case Asc.c_oAscNumberingFormat.VietnameseCounting:
sResult = IntToVietnameseCounting(nValue);
break;
case Asc.c_oAscNumberingFormat.CustomGreece:
sResult = IntToCustomGreece(nValue);
+ break;
+ case Asc.c_oAscNumberingFormat.CustomUpperTurkish:
+ sResult = IntToCustomTurkish(nValue);
+ break;
+ case Asc.c_oAscNumberingFormat.CustomLowerTurkish:
+ sResult = IntToCustomTurkish(nValue, true);
+ break;
+ default:
+ break;
}
return sResult;
@@ -9898,6 +10654,23 @@
return result;
}
+ function ExecuteEditorAction(actionPr, f, logicDocument, t, args)
+ {
+ if (!logicDocument
+ || !logicDocument.IsDocumentEditor
+ || !logicDocument.IsDocumentEditor())
+ return f.apply(t, args);
+
+ let description = actionPr && actionPr.description ? actionPr.description : AscDFH.historydescription_Unknown;
+ let flags = actionPr && actionPr.flags ? actionPr.flags : AscWord.ACTION_FLAGS.UPDATEALL_RECALCULATE;
+
+ logicDocument.StartAction(description, null, flags);
+ let result = f.apply(t, args);
+ logicDocument.FinalizeAction();
+
+ return result;
+ }
+
function AddAndExecuteChange(change)
{
AscCommon.History.Add(change);
@@ -10458,7 +11231,11 @@
}
else
{
- loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', onSuccess, onError);
+ if (scriptDirectory) {
+ loadScript(scriptDirectory + 'sdk-all.js', onSuccess, onError);
+ } else {
+ loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', onSuccess, onError);
+ }
}
}
@@ -10814,6 +11591,13 @@
|| (0x2670 <= nCharCode && nCharCode <= 0x2671)
|| (0xFB1D <= nCharCode && nCharCode <= 0xFB4F));
}
+
+ function IsGeorgianScript(charCode)
+ {
+ return ((0x10A0 <= charCode && charCode <= 0x10FF)
+ || (0x2D00 <= charCode && charCode <= 0x2D2F)
+ || (0x1C90 <= charCode && charCode <= 0x1CBF));
+ }
var g_oIdCounter = new CIdCounter();
@@ -11394,7 +12178,7 @@
obj.options.callback(Asc.c_oAscError.ID.No, data);
else
{
- AscCommon.UploadImageUrls(data, obj.options.api.documentId, obj.options.api.documentUserId, obj.options.api.CoAuthoringApi.get_jwt(), obj.options.api.documentShardKey, obj.options.api.documentWopiSrc, function(urls)
+ AscCommon.UploadImageUrls(data, obj.options.api.documentId, obj.options.api.documentUserId, obj.options.api.CoAuthoringApi.get_jwt(), obj.options.api.documentShardKey, obj.options.api.documentWopiSrc, obj.options.api.documentUserSessionId, function(urls)
{
obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.UploadImage);
@@ -13363,7 +14147,7 @@
var rect;
if (!AscBrowser.isIE)
- rect = element.getBoundingClientRect();
+ rect = AscCommon.UI.getBoundingClientRect(element);
else {
function getCanvasBoundingClientRect(canvas) {
const offsetLeft = canvas.offsetLeft;
@@ -13840,6 +14624,10 @@
return max;
return value;
}
+
+ function getArrayRandomElement(aArray) {
+ return aArray[Math.random() * aArray.length | 0];
+ }
//------------------------------------------------------------export---------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window["AscCommon"].getSockJs = getSockJs;
@@ -13929,6 +14717,7 @@
window["AscCommon"].IsAscFontSupport = IsAscFontSupport;
window["AscCommon"].ExecuteNoHistory = ExecuteNoHistory;
window["AscCommon"].executeNoRevisions = executeNoRevisions;
+ window["AscCommon"].ExecuteEditorAction = ExecuteEditorAction;
window["AscCommon"].AddAndExecuteChange = AddAndExecuteChange;
window["AscCommon"].CompareStrings = CompareStrings;
window["AscCommon"].IsSupportAscFeature = IsSupportAscFeature;
@@ -13946,6 +14735,7 @@
window["AscCommon"].isEastAsianScript = isEastAsianScript;
window["AscCommon"].IsEastAsianFont = IsEastAsianFont;
window["AscCommon"].IsComplexScript = IsComplexScript;
+ window["AscCommon"].IsGeorgianScript = IsGeorgianScript;
window["AscCommon"].CMathTrack = CMathTrack;
window["AscCommon"].CPolygon = CPolygon;
window['AscCommon'].CDrawingCollaborativeTargetBase = CDrawingCollaborativeTargetBase;
@@ -14064,9 +14854,10 @@
window["AscCommon"].c_oAscImageUploadProp = c_oAscImageUploadProp;
window["AscCommon"].trimMinMaxValue = trimMinMaxValue;
window["AscCommon"].cStrucTableReservedWords = cStrucTableReservedWords;
+ window["AscCommon"].getArrayRandomElement = getArrayRandomElement;
})(window);
-window["asc_initAdvancedOptions"] = function(_code, _file_hash, _docInfo)
+window["asc_initAdvancedOptions"] = function(_code, _file_hash, _docInfo, csv_data)
{
if (window.isNativeOpenPassword)
{
@@ -14096,7 +14887,14 @@ window["asc_initAdvancedOptions"] = function(_code, _file_hash, _docInfo)
}
window.checkPasswordFromPlugin = false;
- _editor._onNeedParams(undefined, (_code == 90 || _code == 91) ? true : undefined);
+ let data = undefined;
+ if (csv_data && window["AscDesktopEditor"])
+ {
+ var bufferArray = window["AscDesktopEditor"]["GetOpenedFile"](csv_data);
+ if (bufferArray)
+ data = new Uint8Array(bufferArray);
+ }
+ _editor._onNeedParams(data, (_code == 90 || _code == 91) ? true : undefined);
};
window["asc_IsNeedBuildCryptedFile"] = function()
@@ -14281,7 +15079,7 @@ window["buildCryptoFile_End"] = function(url, error, hash, password)
ext = ".docxf";
}
- AscCommon.sendSaveFile(_editor.documentId, _editor.documentUserId, "output" + ext, _editor.asc_getSessionToken(), _editor.documentShardKey, _editor.documentWopiSrc, fileData, function(err) {
+ AscCommon.sendSaveFile(_editor.documentId, _editor.documentUserId, "output" + ext, _editor.asc_getSessionToken(), _editor.documentShardKey, _editor.documentWopiSrc, _editor.documentUserSessionId, fileData, function(err) {
_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
_editor.sendEvent("asc_onError", Asc.c_oAscError.ID.ConvertationSaveError, Asc.c_oAscError.Level.Critical);
diff --git a/common/embed/embed.js b/common/embed/embed.js
index a597ec99d3..143d801cc1 100644
--- a/common/embed/embed.js
+++ b/common/embed/embed.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/errorCodes.js b/common/errorCodes.js
index 270651e235..0a07f9a941 100644
--- a/common/errorCodes.js
+++ b/common/errorCodes.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -131,6 +131,8 @@
ConvertationOpenLimitError : -84,
ConvertationOpenFormat : -85,
+ CannotSaveWatermark : -86,
+
UserDrop : -100,
Warning : -101,
UpdateVersion : -102,
@@ -167,6 +169,8 @@
PivotGroup : -315,
PivotWithoutUnderlyingData : -316,
+ CircularReference : -320,
+
ForceSaveButton: -331,
ForceSaveTimeout: -332,
Submit: -333,
@@ -246,7 +250,9 @@
TraceDependentsNoFormulas: 1060,
TracePrecedentsNoValidReference: 1061,
- MustIntegerOrDecimalNumber: 1070
+ MustIntegerOrDecimalNumber: 1070,
+
+ DocumentAndChangeMismatch: 1080
}
};
@@ -331,6 +337,7 @@
prot['ConvertationSaveError'] = prot.ConvertationSaveError;
prot['ConvertationOpenLimitError'] = prot.ConvertationOpenLimitError;
prot['ConvertationOpenFormat'] = prot.ConvertationOpenFormat;
+ prot['CannotSaveWatermark'] = prot.CannotSaveWatermark;
prot['UserDrop'] = prot.UserDrop;
prot['Warning'] = prot.Warning;
prot['UpdateVersion'] = prot.UpdateVersion;
@@ -358,6 +365,7 @@
prot['PivotOverlap'] = prot.PivotOverlap;
prot['PivotGroup'] = prot.PivotGroup;
prot['PivotWithoutUnderlyingData'] = prot.PivotWithoutUnderlyingData;
+ prot['CircularReference'] = prot.CircularReference;
prot['ForceSaveButton'] = prot.ForceSaveButton;
prot['ForceSaveTimeout'] = prot.ForceSaveTimeout;
prot['Submit'] = prot.Submit;
@@ -413,6 +421,7 @@
prot['TraceDependentsNoFormulas'] = prot.TraceDependentsNoFormulas;
prot['TracePrecedentsNoValidReference'] = prot.TracePrecedentsNoValidReference;
prot['MustIntegerOrDecimalNumber'] = prot.MustIntegerOrDecimalNumber;
+ prot['DocumentAndChangeMismatch'] = prot.DocumentAndChangeMismatch;
diff --git a/common/externs/cell.js b/common/externs/cell.js
index 43bb612250..311cad4924 100644
--- a/common/externs/cell.js
+++ b/common/externs/cell.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/externs/global.js b/common/externs/global.js
index 306ce38651..3425847a4e 100644
--- a/common/externs/global.js
+++ b/common/externs/global.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/externs/slide.js b/common/externs/slide.js
index d07b014740..b338a6ef86 100644
--- a/common/externs/slide.js
+++ b/common/externs/slide.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/externs/word.js b/common/externs/word.js
index 657fe36338..620bb204c6 100644
--- a/common/externs/word.js
+++ b/common/externs/word.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/externs/xregexp-3.0.0.js b/common/externs/xregexp-3.0.0.js
index 95647bfb9b..9e92120047 100644
--- a/common/externs/xregexp-3.0.0.js
+++ b/common/externs/xregexp-3.0.0.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/geometry/geometry.js b/common/geometry/geometry.js
index 3d1b7e6a72..cf3ee2c4ed 100644
--- a/common/geometry/geometry.js
+++ b/common/geometry/geometry.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/geometry/test/code.js b/common/geometry/test/code.js
index a5038fe0ac..f5e1690e42 100644
--- a/common/geometry/test/code.js
+++ b/common/geometry/test/code.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/hash/hash.js b/common/hash/hash.js
index 8a2a79ea2c..be2e88c61c 100644
--- a/common/hash/hash.js
+++ b/common/hash/hash.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/hash/hash/engine.js b/common/hash/hash/engine.js
index 9dad61df72..6ff9e1afa1 100644
--- a/common/hash/hash/engine.js
+++ b/common/hash/hash/engine.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/hash/hash/engine_ie.js b/common/hash/hash/engine_ie.js
index bc93c7f616..6760dd00a5 100644
--- a/common/hash/hash/engine_ie.js
+++ b/common/hash/hash/engine_ie.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/intervalTree.js b/common/intervalTree.js
index 2b5e7655a5..765a2ac3b5 100644
--- a/common/intervalTree.js
+++ b/common/intervalTree.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/keychainstorage.js b/common/keychainstorage.js
index 3e1f30ac92..246a2a6365 100644
--- a/common/keychainstorage.js
+++ b/common/keychainstorage.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/libfont/character.js b/common/libfont/character.js
index 8f64768fb9..9950274260 100644
--- a/common/libfont/character.js
+++ b/common/libfont/character.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/libfont/common.js b/common/libfont/common.js
index c61e8c5660..73ac774fea 100644
--- a/common/libfont/common.js
+++ b/common/libfont/common.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/libfont/engine.js b/common/libfont/engine.js
index 518924aae2..b4e3a92977 100644
--- a/common/libfont/engine.js
+++ b/common/libfont/engine.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
@@ -775,7 +775,10 @@ function onLoadFontsModule(window, undefined)
if (AscCommon["CZLibEngineJS"])
AscCommon["CZLibEngineJS"].prototype["isModuleInit"] = true;
- window.nativeZlibEngine = new ZLib();
+ if (window["NATIVE_EDITOR_ENJINE"])
+ window["InitNativeZLib"] = function() { window.nativeZlibEngine = new ZLib(); };
+ else
+ window.nativeZlibEngine = new ZLib();
function Hyphenation()
{
diff --git a/common/libfont/engine/fonts.js b/common/libfont/engine/fonts.js
index 10c0648008..d26f609e42 100644
--- a/common/libfont/engine/fonts.js
+++ b/common/libfont/engine/fonts.js
@@ -1,5 +1,5 @@
/*
- * (c) Copyright Ascensio System SIA 2010-2023
+ * (c) Copyright Ascensio System SIA 2010-2024
*
* 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)
diff --git a/common/libfont/engine/fonts_ie.js b/common/libfont/engine/fonts_ie.js
index e9ea891577..d29d839e9f 100644
--- a/common/libfont/engine/fonts_ie.js
+++ b/common/libfont/engine/fonts_ie.js
@@ -29,11214 +29,1019 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
- (function(window,undefined){var AscFonts=window["AscFonts"];if(window["NATIVE_EDITOR_ENJINE"]){var immediateArray=[];window.setImmediate=function(fn){if(immediateArray)immediateArray.push(fn);else fn()};window.immediateRun=function(){for(var i=0;ih&&(h=Math.max(0,Ka+h));if(null==Za||Za>Ka)Za=Ka;Za=Number(Za);0>Za&&(Za=Math.max(0,Ka+Za));for(h=Number(h||0);hf||1342177279>>=1)h+=h;return Za}});Gd("Number.isFinite",
-function(h){return h?h:function(f){return"number"!==typeof f?!1:!isNaN(f)&&Infinity!==f&&-Infinity!==f}});Gd("Number.isInteger",function(h){return h?h:function(f){return Number.isFinite(f)?f===Math.floor(f):!1}});Gd("String.prototype.endsWith",function(h){return h?h:function(f,h){var Ka=Hd(this,f,"endsWith");f+="";void 0===h&&(h=Ka.length);h=Math.max(0,Math.min(h|0,Ka.length));for(var bb=f.length;0=bb}});Gd("String.prototype.padStart",function(h){return h?
-h:function(f,h){var Ka=Hd(this,null,"padStart");f-=Ka.length;h=void 0!==h?String(h):" ";return(0=gb}});Gd("Object.is",function(h){return h?h:function(f,h){return f===h?0!==f||1/f===1/h:f!==f&&h!==h}});Gd("Array.prototype.includes",function(h){return h?h:function(f,h){var Ka=this;Ka instanceof String&&(Ka=String(Ka));var bb=Ka.length;h=h||0;for(0>h&&(h=Math.max(h+bb,0));hf?-h:h}});Gd("Math.log1p",function(h){return h?h:function(f){f=Number(f);if(.25>f&&-.25f&&-.25f?-h:h}});Gd("Math.log10",function(h){return h?h:function(f){return Math.log(f)/Math.LN10}});Gd("Math.cosh",function(h){if(h)return h;var f=Math.exp;return function(h){h=Number(h);return(f(h)+
-f(-h))/2}});Gd("Math.sinh",function(h){if(h)return h;var f=Math.exp;return function(h){h=Number(h);return 0===h?h:(f(h)-f(-h))/2}});Gd("Math.acosh",function(h){return h?h:function(f){f=Number(f);return Math.log(f+Math.sqrt(f*f-1))}});Gd("Math.atanh",function(h){if(h)return h;var f=Math.log1p;return function(h){h=Number(h);return(f(h)-f(-h))/2}});Gd("Math.asinh",function(h){return h?h:function(f){f=Number(f);if(0===f)return f;var h=Math.log(Math.abs(f)+Math.sqrt(f*f+1));return 0>f?-h:h}});Gd("Array.prototype.findIndex",
-function(h){return h?h:function(f,h){return Fw(this,f,h).dn}});Math.imul=Math.imul||function(a,b){var ah=a>>>16&65535;var al=a&65535;var bh=b>>>16&65535;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16>>>0)|0};Math.fround=Math.fround||function(x){return(new Float32Array([x]))[0]};Math.clz32=Math.clz32||function(value){value=Number(value)>>>0;return value!==0?31-Math.floor(Math.log(value+.5)/Math.log(2)):32};Uint8Array.prototype.copyWithin=Uint8Array.prototype.copyWithin||function(target,start,end){var tmpArray=
-this.subarray(start,end);this.set(tmpArray,target);return this};(function(){if(undefined!==String.prototype.fromUtf8&&undefined!==String.prototype.toUtf8)return;var STRING_UTF8_BUFFER_LENGTH=1024;var STRING_UTF8_BUFFER=new ArrayBuffer(STRING_UTF8_BUFFER_LENGTH);String.prototype.fromUtf8=function(buffer,start,len){if(undefined===start)start=0;if(undefined===len)len=buffer.length-start;var result="";var index=start;var end=start+len;while(index>10,56320|ch&1023)}}return result};String.prototype.toUtf8=function(isNoEndNull,isUseBuffer){var inputLen=this.length;var testLen=6*inputLen+1;var tmpStrings=isUseBuffer&&testLen<
-STRING_UTF8_BUFFER_LENGTH?STRING_UTF8_BUFFER:new ArrayBuffer(testLen);var code=0;var index=0;var outputIndex=0;var outputDataTmp=new Uint8Array(tmpStrings);var outputData=outputDataTmp;while(index=55296&&code<=57343&&index>6;outputData[outputIndex++]=128|code&63}else if(code<65536){outputData[outputIndex++]=
-224|code>>12;outputData[outputIndex++]=128|code>>6&63;outputData[outputIndex++]=128|code&63}else if(code<2097151){outputData[outputIndex++]=240|code>>18;outputData[outputIndex++]=128|code>>12&63;outputData[outputIndex++]=128|code>>6&63;outputData[outputIndex++]=128|code&63}else if(code<67108863){outputData[outputIndex++]=248|code>>24;outputData[outputIndex++]=128|code>>18&63;outputData[outputIndex++]=128|code>>12&63;outputData[outputIndex++]=128|code>>6&63;outputData[outputIndex++]=128|code&63}else if(code<
-2147483647){outputData[outputIndex++]=252|code>>30;outputData[outputIndex++]=128|code>>24&63;outputData[outputIndex++]=128|code>>18&63;outputData[outputIndex++]=128|code>>12&63;outputData[outputIndex++]=128|code>>6&63;outputData[outputIndex++]=128|code&63}}if(isNoEndNull!==true)outputData[outputIndex++]=0;return new Uint8Array(tmpStrings,0,outputIndex)};function StringPointer(pointer,len){this.ptr=pointer;this.length=len}StringPointer.prototype.free=function(){if(0!==this.ptr)Module["_free"](this.ptr)};
-String.prototype.toUtf8Pointer=function(isNoEndNull){var tmp=this.toUtf8(isNoEndNull,true);var pointer=Module["_malloc"](tmp.length);if(0==pointer)return null;Module["HEAP8"].set(tmp,pointer);return new StringPointer(pointer,tmp.length)}})();var Module=typeof Module!="undefined"?Module:{};var Promise=function(){function noop(){}function bind(fn,thisArg){return function(){fn.apply(thisArg,arguments)}}function Promise(fn){if(!(this instanceof Promise))throw new TypeError("Promises must be constructed via new");
-if(typeof fn!="function")throw new TypeError("not a function");this._state=0;this._handled=false;this._value=undefined;this._deferreds=[];doResolve(fn,this)}function handle(self,deferred){while(self._state===3)self=self._value;if(self._state===0){self._deferreds.push(deferred);return}self._handled=true;Promise._immediateFn(function(){var cb=self._state===1?deferred.onFulfilled:deferred.onRejected;if(cb===null){(self._state===1?resolve:reject)(deferred.promise,self._value);return}var ret;try{ret=cb(self._value)}catch(e){reject(deferred.promise,
-e);return}resolve(deferred.promise,ret)})}function resolve(self,newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&(typeof newValue=="object"||typeof newValue=="function")){var then=newValue.then;if(newValue instanceof Promise){self._state=3;self._value=newValue;finale(self);return}else if(typeof then=="function"){doResolve(bind(then,newValue),self);return}}self._state=1;self._value=newValue;finale(self)}catch(e){reject(self,e)}}function reject(self,
-newValue){self._state=2;self._value=newValue;finale(self)}function finale(self){if(self._state===2&&self._deferreds.length===0)Promise._immediateFn(function(){if(!self._handled)Promise._unhandledRejectionFn(self._value)});for(var i=0,len=self._deferreds.length;i=0;--a){f[48+a]=52+a;f[65+a]=a;f[97+a]=26+a}f[43]=62;f[47]=63;function l(m,n,o){var g,h,a=0,i=n,j=o.length,k=n+(j*3>>2)-(o[j-2]=="=")-(o[j-1]=="=");for(;a>4;if(i>2;if(i>2];d=c-12|0;f=J[d>>2];b=f+a|0;if(!J[b+4>>2]){H[b+33|0]=1;f=J[d>>2]}D=a+12|0;N=a+33|0;A=a+4|0;a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{k:{while(1){l:{g=a+f|0;b=J[g+12>>2];if(b>>>0>=M[g+8>>2])break l;i=J[g+16>>2];if(i-b>>>0<=7){H[g+33|0]=1;break k}e=c-12|0;d=0;if(b+3>>>0>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4;f=J[e>>2];b=f+a|0;i=J[b+16>>2];b=J[b+12>>2]}m:{if(b+3>>>0>=i>>>0)break m;g=K[b|0]|K[b+1|0]<<8|(K[b+2|
-0]<<16|K[b+3|0]<<24);J[f+D>>2]=b+4;if(!g)break m;b=J[e>>2]+a|0;F=J[b+12>>2];c=g-8|0;if(c>>>0>J[b+16>>2]-F>>>0){H[b+33|0]=1;break k}Q=J[b+4>>2];J[a+116>>2]=c;b=J[e>>2]+a|0;c=c+J[b+12>>2]|0;g=b;b=J[b+8>>2];J[g+16>>2]=b>>>0>c>>>0?c:b;if(d-123>>>0<=4294967173){if(J[a+36>>2]==1179469088&J[a+40>>2]==65536)break l;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break k}if(!((d|0)==1|G)){H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break k}n:{o:switch(d-1|0){case 113:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+56>>2]=0;J[h+
-60>>2]=0;J[h+48>>2]=0;J[h+52>>2]=1072693248;J[h+80>>2]=0;J[h+84>>2]=0;J[h+72>>2]=0;J[h+76>>2]=1072693248;J[h+64>>2]=0;J[h+68>>2]=0;J[h+88>>2]=0;J[h+92>>2]=0;H[h+96|0]=0;H[h+97|0]=0;H[h+98|0]=0;H[h+99|0]=0;e=0;f=0;g=J[J[a>>2]-12>>2]+A|0;c=J[g+12>>2];b=J[g+8>>2];if(c>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+4>>2]=e;e=0;p:{if(c>>>0<=b+3>>>0){f=0;break p}f=K[b|
-0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+8>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+12>>2]=e;e=0;q:{if(c>>>0<=b+3>>>0){f=0;break q}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+16>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+20>>2]=e;e=0;r:{if(c>>>0<=b+3>>>0){f=0;break r}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+
-24>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+28>>2]=e;e=0;f=0;if(b>>>0>>0){f=K[b|0];J[g+8>>2]=b+1}H[h+32|0]=f;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+33|0]=e;e=0;b=0;c=J[g+8>>2];if(c>>>0>2]){b=K[c|0];J[g+8>>2]=c+1}H[h+34|0]=b;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+35|0]=e;e=0;d=J[g+12>>2];b=J[g+8>>2];s:{if(d>>>0<=b+3>>>0){f=0;break s}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+
-8>>2]=b}J[h+36>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+40>>2]=e;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+48>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+56>>3]=o;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+64>>3]=o;if(d>>>
-0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+72>>3]=o;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+80>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+88>>3]=o;e=0;f=0;if(b>>>0>>0){f=K[b|0];J[g+8>>2]=b+1}H[h+96|0]=f;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+97|0]=e;e=0;b=
-0;c=J[g+8>>2];if(c>>>0>2]){b=K[c|0];J[g+8>>2]=c+1}H[h+98|0]=b;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+99|0]=e;e=0;c=J[g+12>>2];b=J[g+8>>2];t:{if(c>>>0<=b+3>>>0){f=0;break t}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+100>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+104>>2]=e;e=0;u:{if(c>>>0<=b+3>>>0){f=0;break u}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+108>>
-2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+112>>2]=e;e=0;v:{if(c>>>0<=b+3>>>0){f=0;break v}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+116>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+120>>2]=e;e=0;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+8>>2]=b+4}J[h+124>>2]=e;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+112>>
-2]](b,h,(J[J[a>>2]-12>>2]+a|0)+4|0);i=0;e=xb-16|0;xb=e;J[e+12>>2]=0;w:{if(!(!(Ab[J[J[a>>2]+136>>2]](a,J[h+104>>2],J[h+108>>2],J[h+112>>2],J[h+116>>2],108,e+12|0,e+8|0,e+4|0)|0)|!J[a+208>>2])){x:{if(!K[h+35|0]){d=J[e+4>>2];if(!d){d=0;break x}c=J[e+8>>2];if(!c)break x;while(1){y:{if(!c){c=0;break y}b=K[h+34|0];f=0;while(1){H[(J[e+12>>2]+(P(c,i)+f<<2)|0)+3|0]=b;c=J[e+8>>2];f=f+1|0;if(c>>>0>f>>>0)continue;break}d=J[e+4>>2]}i=i+1|0;if(i>>>0>>0)continue;break}break x}d=J[e+4>>2];if(!d){d=0;break x}c=
-J[e+8>>2];if(!c)break x;l=+K[h+34|0]/255;while(1){f=0;if(c){while(1){b=J[e+12>>2]+(P(c,i)+f<<2)|0;n=l*+K[b+3|0];z:{if(n<4294967296&n>=0){c=~~n>>>0;break z}c=0}H[b+3|0]=c;c=J[e+8>>2];f=f+1|0;if(c>>>0>f>>>0)continue;break}d=J[e+4>>2]}else c=0;i=i+1|0;if(i>>>0>>0)continue;break}}f=J[e+12>>2];g=J[a+208>>2];b=f;if(!g)break w;c=J[h+16>>2];n=+(c|0);b=J[h+20>>2];l=+(b|0);Ab[J[J[g>>2]+16>>2]](g,n,l,+(c+J[h+24>>2]|0)-n,+(b+J[h+28>>2]|0)-l,f,J[e+8>>2],d)}b=J[e+12>>2]}if(b)Kb(b);xb=e+16|0;break n;case 75:J[h+
-8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+56>>2]=0;J[h+60>>2]=0;J[h+48>>2]=0;J[h+52>>2]=1072693248;J[h+80>>2]=0;J[h+84>>2]=0;J[h+72>>2]=0;J[h+76>>2]=1072693248;J[h+64>>2]=0;J[h+68>>2]=0;J[h+88>>2]=0;J[h+92>>2]=0;H[h+96|0]=0;H[h+97|0]=0;H[h+98|0]=0;H[h+99|0]=0;e=0;f=0;g=J[J[a>>2]-12>>2]+A|0;d=J[g+12>>2];b=J[g+8>>2];if(d>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=
-b}J[h+4>>2]=e;e=0;A:{if(d>>>0<=b+3>>>0){f=0;break A}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+8>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+12>>2]=e;e=0;B:{if(d>>>0<=b+3>>>0){f=0;break B}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+20>>2]=e;e=0;C:{if(d>>>0<=b+3>>>0){f=0;break C}f=K[b|0]|K[b+
-1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+28>>2]=e;e=0;D:{if(d>>>0<=b+3>>>0){f=0;break D}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+32>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+36>>2]=e;e=0;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+40>>2]=e;if(d>>>0<=
-b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+48>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+56>>3]=o;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+64>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+72>>3]=o;if(d>>>0<=b+
-3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+80>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+88>>3]=o;e=0;f=0;if(b>>>0>>0){f=K[b|0];J[g+8>>2]=b+1}H[h+96|0]=f;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+97|0]=e;e=0;b=0;c=J[g+8>>2];if(c>>>0>2]){b=K[c|0];J[g+8>>2]=c+1}H[h+98|0]=b;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+
-99|0]=e;e=0;c=J[g+12>>2];b=J[g+8>>2];E:{if(c>>>0<=b+3>>>0){f=0;break E}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+100>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+104>>2]=e;e=0;F:{if(c>>>0<=b+3>>>0){f=0;break F}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+108>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+112>>2]=e;e=0;if(c>>>0>b+3>>>0){e=
-K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+8>>2]=b+4}J[h+116>>2]=e;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+120>>2]](b,h,(J[J[a>>2]-12>>2]+a|0)+4|0);g=xb-16|0;xb=g;J[g+12>>2]=0;G:{H:{if(Ab[J[J[a>>2]+136>>2]](a,J[h+104>>2],J[h+108>>2],J[h+112>>2],J[h+116>>2],100,g+12|0,g+8|0,g+4|0)|0){d=J[a+208>>2];if(!d)break H;c=J[h+16>>2];n=+(c|0);b=J[h+20>>2];l=+(b|0);Ab[J[J[d>>2]+16>>2]](d,n,l,+(c+J[h+24>>2]|0)-n,+(b+J[h+28>>2]|0)-l,J[g+12>>2],J[g+8>>2],J[g+4>>2]);break H}I:{J:{K:{b=
-J[h+32>>2];if((b|0)<=10485960){if((b|0)==66)break K;if((b|0)!=5898313)break I;break J}if((b|0)==10485961|(b|0)==15728673)break J;if((b|0)!=16711778)break I;b=Pb(4);J[g+12>>2]=b;H[b|0]=255;H[b+1|0]=255;H[b+2|0]=255;H[b+3|0]=255;J[g+4>>2]=1;J[g+8>>2]=1;break I}b=Pb(4);J[g+12>>2]=b;H[b|0]=0;H[b+1|0]=0;H[b+2|0]=0;H[b+3|0]=255;J[g+4>>2]=1;J[g+8>>2]=1;break I}b=J[J[a+120>>2]+20>>2];if(!b)break I;c=Pb(4);J[g+12>>2]=c;H[c|0]=K[b+10|0];H[c+1|0]=K[b+9|0];b=K[b+8|0];H[c+3|0]=255;H[c+2|0]=b;J[g+4>>2]=1;J[g+8>>
-2]=1}d=J[g+12>>2];if(!d)break G;f=J[a+208>>2];if(!f)break H;c=J[h+16>>2];n=+(c|0);b=J[h+20>>2];l=+(b|0);Ab[J[J[f>>2]+16>>2]](f,n,l,+(c+J[h+24>>2]|0)-n,+(b+J[h+28>>2]|0)-l,d,J[g+8>>2],J[g+4>>2])}b=J[g+12>>2];if(!b)break G;Kb(b)}xb=g+16|0;break n;case 80:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;c=0;e=0;f=J[J[a>>2]-12>>2]+A|0;d=J[f+12>>2];b=J[f+8>>2];if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<
-16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+4>>2]=e;e=0;L:{if(d>>>0<=b+3>>>0){c=0;break L}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+8>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+12>>2]=e;e=0;M:{if(d>>>0<=b+3>>>0){c=0;break M}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+16>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+20>>2]=e;e=0;N:{if(d>>>
-0<=b+3>>>0){c=0;break N}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+24>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+28>>2]=e;e=0;O:{if(d>>>0<=b+3>>>0){c=0;break O}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+32>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+36>>2]=e;e=0;P:{if(d>>>0<=b+3>>>0){c=0;break P}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+
-3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+40>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+44>>2]=e;e=0;Q:{if(d>>>0<=b+3>>>0){c=0;break Q}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+48>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+52>>2]=e;e=0;R:{if(d>>>0<=b+3>>>0){c=0;break R}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+56>>2]=c;if(d>>>0>b+3>>>0){e=
-K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+60>>2]=e;e=0;S:{if(d>>>0<=b+3>>>0){c=0;break S}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+64>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+8>>2]=b+4}J[h+68>>2]=e;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+116>>2]](b,h,(J[J[a>>2]-12>>2]+a|0)+4|0);g=xb-16|0;xb=g;J[g+12>>2]=0;b=g+12|0;T:{if(!(!(Ab[J[J[a>>2]+136>>2]](a,J[h+40>>2],J[h+44>>2],J[h+
-48>>2],J[h+52>>2],80,b,g+8|0,g+4|0)|0)|!J[a+208>>2])){hr(J[h+60>>2],b,J[g+8>>2],J[g+4>>2]);d=J[g+12>>2];f=J[a+208>>2];b=d;if(!f)break T;c=J[h+16>>2];n=+(c|0);b=J[h+20>>2];l=+(b|0);Ab[J[J[f>>2]+16>>2]](f,n,l,+(c+J[h+64>>2]|0)-n,+(b+J[h+68>>2]|0)-l,d,J[g+8>>2],J[g+4>>2])}b=J[g+12>>2]}if(b)Kb(b);xb=g+16|0;break n;case 79:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;c=0;e=0;f=J[J[a>>2]-12>>2]+A|0;d=J[f+12>>2];b=J[f+8>>2];if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+
-8>>2]=b}J[h>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+4>>2]=c;c=0;U:{if(d>>>0<=b+3>>>0){e=0;break U}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+8>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+12>>2]=c;c=0;V:{if(d>>>0<=b+3>>>0){e=0;break V}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+16>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|
-0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+20>>2]=c;c=0;W:{if(d>>>0<=b+3>>>0){e=0;break W}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+24>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+28>>2]=c;c=0;X:{if(d>>>0<=b+3>>>0){e=0;break X}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+32>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+36>>2]=c;c=0;Y:{if(d>>>
-0<=b+3>>>0){e=0;break Y}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+40>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+44>>2]=c;c=0;Z:{if(d>>>0<=b+3>>>0){e=0;break Z}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+48>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+52>>2]=c;c=0;_:{if(d>>>0<=b+3>>>0){e=0;break _}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+
-3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+56>>2]=e;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+8>>2]=b}J[h+60>>2]=c;c=0;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+8>>2]=b+4}J[h+64>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+124>>2]](b,h,(J[J[a>>2]-12>>2]+a|0)+4|0);c=xb-16|0;xb=c;J[c+12>>2]=0;$:{if(!(Ab[J[J[a>>2]+136>>2]](a,J[h+40>>2],J[h+44>>2],J[h+48>>2],J[h+52>>2],76,c+12|0,c+8|0,c+4|0)|0))break $;b=J[a+208>>
-2];if(!b)break $;n=+J[h>>2];l=+J[h+4>>2];Ab[J[J[b>>2]+16>>2]](b,n,l,+J[h+8>>2]-n,+J[h+12>>2]-l,J[c+12>>2],J[c+8>>2],J[c+4>>2])}b=J[c+12>>2];if(b)Kb(b);xb=c+16|0;break n;case 76:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+56>>2]=0;J[h+60>>2]=0;J[h+48>>2]=0;J[h+52>>2]=1072693248;J[h+80>>2]=0;J[h+84>>2]=0;J[h+72>>2]=0;J[h+76>>2]=1072693248;J[h+64>>2]=0;J[h+68>>2]=0;J[h+88>>2]=0;J[h+92>>2]=0;H[h+96|0]=0;H[h+97|0]=0;H[h+98|0]=0;H[h+99|0]=0;e=0;f=0;g=J[J[a>>2]-12>>2]+A|0;d=J[g+12>>2];b=J[g+8>>2];
-if(d>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+4>>2]=e;e=0;aa:{if(d>>>0<=b+3>>>0){f=0;break aa}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+8>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+12>>2]=e;e=0;ba:{if(d>>>0<=b+3>>>0){f=0;break ba}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<
-24);b=b+4|0;J[g+8>>2]=b}J[h+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+20>>2]=e;e=0;ca:{if(d>>>0<=b+3>>>0){f=0;break ca}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+28>>2]=e;e=0;da:{if(d>>>0<=b+3>>>0){f=0;break da}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+32>>2]=f;if(d>>>0>b+3>>>0){e=
-K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+36>>2]=e;e=0;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+40>>2]=e;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+48>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+56>>3]=o;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|
-0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+64>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+72>>3]=o;if(d>>>0<=b+3>>>0)o=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}O[h+80>>3]=o;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b;o=+(x(2,c),C())}else o=0;O[h+88>>3]=o;e=0;f=0;if(b>>>0>>0){f=K[b|0];J[g+8>>2]=b+1}H[h+96|0]=f;b=J[g+8>>2];
-if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+97|0]=e;e=0;b=0;c=J[g+8>>2];if(c>>>0>2]){b=K[c|0];J[g+8>>2]=c+1}H[h+98|0]=b;b=J[g+8>>2];if(b>>>0>2]){e=K[b|0];J[g+8>>2]=b+1}H[h+99|0]=e;e=0;c=J[g+12>>2];b=J[g+8>>2];ea:{if(c>>>0<=b+3>>>0){f=0;break ea}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+100>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+104>>2]=e;e=0;fa:{if(c>>>0<=b+3>>>0){f=0;break fa}f=K[b|0]|K[b+
-1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+108>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+112>>2]=e;e=0;ga:{if(c>>>0<=b+3>>>0){f=0;break ga}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+116>>2]=f;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+8>>2]=b}J[h+120>>2]=e;e=0;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+8>>2]=b+4}J[h+124>>2]=e;b=J[a+216>>
-2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+128>>2]](b,h,(J[J[a>>2]-12>>2]+a|0)+4|0);g=xb-16|0;xb=g;J[g+12>>2]=0;b=g+12|0;ha:{if(!(!(Ab[J[J[a>>2]+136>>2]](a,J[h+104>>2],J[h+108>>2],J[h+112>>2],J[h+116>>2],108,b,g+8|0,g+4|0)|0)|!J[a+208>>2])){hr(J[h+32>>2],b,J[g+8>>2],J[g+4>>2]);d=J[g+12>>2];f=J[a+208>>2];b=d;if(!f)break ha;c=J[h+16>>2];n=+(c|0);b=J[h+20>>2];l=+(b|0);Ab[J[J[f>>2]+16>>2]](f,n,l,+(c+J[h+24>>2]|0)-n,+(b+J[h+28>>2]|0)-l,d,J[g+8>>2],J[g+4>>2])}b=J[g+12>>2]}if(b)Kb(b);xb=
-g+16|0;break n;case 28:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];ia:{if(c+3>>>0>=b>>>0){e=0;break ia}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+4>>2]=d;d=0;ja:{if(b>>>0<=c+3>>>0){e=0;break ja}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<
-24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;e=xb+-64|0;xb=e;c=J[h+8>>2];b=J[h>>2];d=(c|0)>(b|0);f=(d?1:-1)+c|0;J[h+8>>2]=f;d=b+(d?-1:1)|0;J[h>>2]=d;c=J[h+4>>2];b=J[h+12>>2];g=(c|0)<(b|0);c=(g?-1:1)+c|0;J[h+4>>2]=c;b=b+(g?1:-1)|0;J[h+12>>2]=b;O[e+56>>3]=b|0;O[e+48>>3]=f|0;O[e+40>>3]=c|0;O[e+32>>3]=d|0;c=Ab[J[J[a>>2]+36>>2]](a)|0;b=J[c>>2];O[e+8>>3]=J[c+4>>2];O[e>>3]=b|0;b=J[c+8>>2];O[e+24>>3]=J[c+12>>2];O[e+16>>3]=b|0;cC(J[a+120>>2]+4|0,e+32|0,e);b=J[a+208>>2];ka:{if(!b)break ka;
-Ab[J[J[b>>2]+84>>2]](b);b=J[a+208>>2];if(!b)break ka;Ab[J[J[b>>2]+284>>2]](b,h)}xb=e- -64|0;break n;case 74:f=0;c=J[a>>2]-12|0;e=J[c>>2];g=e+a|0;b=J[g+12>>2];d=J[g+16>>2];la:{if(d>>>0<=b+3>>>0){i=0;break la}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4;e=J[c>>2];b=e+a|0;d=J[b+16>>2];b=J[b+12>>2]}J[h>>2]=i;if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[e+D>>2]=b+4}J[h+152>>2]=f;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;wf(J[a+120>>2]+4|0);b=J[a+208>>2];if(b)Ab[J[J[b>>
-2]+288>>2]](b,h,h+152|0,(J[J[a>>2]-12>>2]+a|0)+4|0);b=J[J[a>>2]-12>>2]+a|0;c=(J[b+12>>2]+J[a+116>>2]|0)-8|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;break n;case 29:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];ma:{if(c+3>>>0>=b>>>0){e=0;break ma}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+4>>2]=d;d=0;na:{if(b>>>0<=c+3>>>0){e=0;break na}e=
-K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;c=xb-32|0;xb=c;b=J[h>>2];O[c+8>>3]=J[h+4>>2];O[c>>3]=b|0;b=J[h+8>>2];O[c+24>>3]=J[h+12>>2];O[c+16>>3]=b|0;dC(J[a+120>>2]+4|0,c);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+312>>2]](b,h);xb=c+32|0;break n;case 66:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+
-2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+276>>2]](b,h);c=J[a+156>>2];oa:{if(!c)break oa;b=J[a+120>>2];cr(b+4|0,c,J[h>>2],b+504|0);b=J[a+156>>2];if(b){Kb(qd(b));J[a+156>>2]=0}b=J[a+208>>2];if(!b)break oa;Ab[J[J[b>>2]+84>>2]](b)}break n;case 27:wf(J[a+120>>2]+4|0);b=J[a+208>>2];pa:{if(!b)break pa;Ab[J[J[b>>2]+292>>2]](b);b=J[a+208>>2];if(!b)break pa;Ab[J[J[b>>2]+84>>2]](b)}break n;case 0:e=0;b=0;g=J[a>>2]-12|0;f=J[g>>2]+
-a|0;c=J[f+12>>2];d=J[f+16>>2];if(c+3>>>0>>0){e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[a+4>>2]=e;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[a+8>>2]=b;b=0;qa:{if(d>>>0<=c+3>>>0){e=0;break qa}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[a+12>>2]=e;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[a+16>>2]=b;b=0;f=J[g>>2]+a|0;c=J[f+12>>2];d=J[f+16>>2];ra:{if(c+
-3>>>0>=d>>>0){e=0;break ra}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[a+20>>2]=e;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[a+24>>2]=b;b=0;sa:{if(d>>>0<=c+3>>>0){e=0;break sa}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[a+28>>2]=e;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[a+32>>2]=b;b=0;e=0;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){e=K[d|0]|K[d+1|
-0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[a+36>>2]=e;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[a+40>>2]=b;b=0;e=0;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){e=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[a+44>>2]=e;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[a+48>>2]=b;b=0;e=0;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+1>>>0>2]){e=K[d|0]|K[d+1|0]<<8;J[c+12>>2]=d+2}I[a+52>>1]=e;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+1>>>0>2]){b=K[d|0]|K[d+1|0]<<8;J[c+12>>2]=d+2}I[a+54>>1]=b;b=0;e=0;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){e=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[a+56>>2]=e;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[a+60>>2]=b;c=0;b=0;d=J[g>>2]+a|0;f=J[d+12>>2];if(f+3>>>0>2]){b=K[f|0]|K[f+1|0]<<8|(K[f+
-2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[a+64>>2]=b;f=J[g>>2]+a|0;e=J[f+12>>2];d=J[f+16>>2];if(e+3>>>0>>0){c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[f+12>>2]=e}J[a+68>>2]=c;c=0;b=0;if(d>>>0>e+3>>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[f+12>>2]=e+4}J[a+72>>2]=b;f=J[g>>2]+a|0;b=J[f+12>>2];d=J[f+16>>2];if(b+3>>>0>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[a+76>>2]=c;e=0;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<
-24);J[f+12>>2]=b+4}J[a+80>>2]=e;ta:{if(!(J[a+36>>2]==1179469088&J[a+40>>2]==65536)){H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ta}b=J[J[a>>2]-12>>2]+a|0;c=(J[b+12>>2]+J[a+116>>2]|0)-80|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;z=+J[a+76>>2];f=a+68|0;v=+J[f>>2];w=+J[a+20>>2]/100/z*v;l=V(w+.5);ua:{if(R(l)<2147483648){c=~~l;break ua}c=-2147483648}J[a+84>>2]=c;t=+J[a+80>>2];o=+J[a+72>>2];n=+J[a+24>>2]/100/t*o;l=V(n+.5);va:{if(R(l)<2147483648){b=~~l;break va}b=-2147483648}J[a+88>>2]=b;l=V(+J[a+32>>2]/
-100/t*o-n+.5);wa:{if(R(l)<2147483648){d=~~l;break wa}d=-2147483648}J[a+96>>2]=d+b;l=V(+J[a+28>>2]/100/z*v-w+.5);xa:{if(R(l)<2147483648){b=~~l;break xa}b=-2147483648}J[a+92>>2]=b+c;b=J[a+88>>2];J[a+100>>2]=J[a+84>>2];J[a+104>>2]=b;b=J[a+96>>2];J[a+108>>2]=J[a+92>>2];J[a+112>>2]=b;iA(J[a+120>>2],f);hA(J[a+120>>2],f);b=J[a+208>>2];if(b){Ab[J[J[b>>2]+8>>2]](b);b=J[a+208>>2];Ab[J[J[b>>2]+108>>2]](b,a+4|0)}}break n;case 13:g=J[a>>2]-12|0;c=J[g>>2];d=c+a|0;b=J[d+12>>2];f=J[d+16>>2];if(f>>>0>b+3>>>0){J[d+
-12>>2]=b+4;c=J[g>>2];b=c+a|0;f=J[b+16>>2];b=J[b+12>>2]}if(b+3>>>0>>0){J[c+D>>2]=b+4;c=J[g>>2];b=c+a|0;f=J[b+16>>2];b=J[b+12>>2]}b=(J[a+116>>2]+b|0)-12|0;J[c+D>>2]=b>>>0>>0?b:f;c=J[g>>2]+a|0;b=J[c+12>>2];if(b+3>>>0>2])J[c+12>>2]=b+4;Uq(a);break n;case 40:f=0;d=0;c=xb-32|0;xb=c;k=J[a>>2]-12|0;e=J[k>>2]+a|0;b=J[e+12>>2];g=J[e+16>>2];if(b+3>>>0>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+24>>2]=d;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+
-3|0]<<24);J[e+12>>2]=b+4}J[c+28>>2]=f;d=0;f=J[k>>2];g=f+a|0;e=J[g+12>>2];b=J[g+16>>2];if(b>>>0>e+3>>>0){d=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+12>>2]=e+4;f=J[k>>2];g=f+a|0;b=J[g+16>>2];e=J[g+12>>2]}J[c+20>>2]=d;if(e+3>>>0>=b>>>0)o=0;else{g=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[(a+f|0)+12>>2]=e+4;f=J[k>>2];d=f+a|0;b=J[d+16>>2];e=J[d+12>>2];o=+(x(2,g),C())}O[c+8>>3]=o;if(e+3>>>0>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[(a+f|0)+12>>2]=e+4;o=+(x(2,b),C())}else o=
-0;O[c>>3]=o;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){e=c+24|0;g=c+20|0;f=c+8|0;b=J[a+208>>2];ya:{if(!b)break ya;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>2]](b)|0)==4)break ya;b=J[a+208>>2]}Ab[J[J[b>>2]+324>>2]](b,e,g,f,c)}d=J[e+4>>2];g=J[g>>2];v=+(d+g|0);b=J[e>>2];w=+(b+g|0);t=+(d-g|0);o=+(b-g|0);n=O[c>>3];l=O[f>>3];b=J[a+156>>2];za:{if(b){if(Se(b,o,t,w,v,l,n))break za;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break za}b=J[a+208>>2];if(!b)break za;Ab[J[J[b>>2]+44>>2]](b,o,t,w,v,l,n)}b=J[a+208>>2];if(!(!(!J[a+156>>
-2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,1);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}}xb=c+32|0;break n;case 44:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+152>>2]=0;J[h+156>>2]=0;J[h+144>>2]=0;J[h+148>>2]=0;d=h+152|0;c=h+144|0;Cn(a,h,d,c,h+136|0,h+128|0);b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];Aa:{if(!b)break Aa;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>2]](b)|0)==4)break Aa;b=J[a+208>>2]}Ab[J[J[b>>2]+328>>2]](b,h,d,c)}z=we(J[h>>2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[d>>2],J[d+4>>2]);l=we(J[h>>
-2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[c>>2],J[c+4>>2]);f=J[a+120>>2];e=J[f+688>>2];d=J[f+672>>2];b=J[h+4>>2];c=J[h+12>>2];Ba:{if(((J[f+676>>2]<0?(b|0)<(c|0):(b|0)>(c|0))|0)!=1){f=b;b=c;break Ba}J[h+4>>2]=c;J[h+12>>2]=b;f=c}c=J[h>>2];g=J[h+8>>2];Ca:{if((((d|0)<0?(c|0)<(g|0):(c|0)>(g|0))|0)!=1){d=c;c=g;break Ca}J[h>>2]=g;J[h+8>>2]=c;d=g}v=z*-.017453292519943295;o=Fe(v);w=l-z;t=w+-360;g=(e|0)==1;n=+(b-f|0);l=n*.5;E=o;o=+(c-d|0);n=Pi(ue(v)/n*.5,E/o*.5);l=l+ +(f|0)-l*ue(n);Da:{if(R(l)<2147483648){c=~~l;
-break Da}c=-2147483648}v=+(c|0);l=o*.5;l=l*Fe(n)+(l+ +(d|0));Ea:{if(R(l)<2147483648){b=~~l;break Ea}b=-2147483648}l=+(b|0);d=J[a+156>>2];Fa:{Ga:{if(d){if(le(d,l,v))break Ga;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Fa}d=J[a+208>>2];if(!d)break Ga;Ab[J[J[d>>2]+32>>2]](d,l,v)}d=J[a+120>>2];J[d+680>>2]=b;J[d+684>>2]=c}w=g?w:t;t=+J[h+12>>2];o=+J[h+8>>2];n=+J[h+4>>2];l=+J[h>>2];b=J[a+156>>2];Ha:{if(b){if(Se(b,l,n,o,t,z,w))break Ha;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ha}b=J[a+208>>2];if(!b)break Ha;Ab[J[J[b>>
-2]+44>>2]](b,l,n,o,t,z,w)}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,1);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}break n;case 54:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+152>>2]=0;J[h+156>>2]=0;J[h+144>>2]=0;J[h+148>>2]=0;d=h+152|0;c=h+144|0;Cn(a,h,d,c,h+136|0,h+128|0);b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];Ia:{if(!b)break Ia;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>2]](b)|0)==4)break Ia;b=J[a+208>>2]}Ab[J[J[b>>2]+332>>2]](b,h,d,c)}v=we(J[h>>2],J[h+4>>2],J[h+
-8>>2],J[h+12>>2],J[d>>2],J[d+4>>2]);l=we(J[h>>2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[c>>2],J[c+4>>2]);f=J[a+120>>2];d=J[(f+664|0)+8>>2];b=J[h+12>>2];c=J[h+4>>2];Ja:{if(((J[f+676>>2]<0?(b|0)>(c|0):(b|0)<(c|0))|0)!=1){f=b;b=c;break Ja}J[h+4>>2]=b;J[h+12>>2]=c;f=c}c=J[h+8>>2];g=J[h>>2];Ka:{if((((d|0)<0?(c|0)>(g|0):(c|0)<(g|0))|0)!=1){d=c;c=g;break Ka}J[h>>2]=c;J[h+8>>2]=g;d=g}w=l-v;t=+(f|0);o=+(d|0);n=+(b|0);l=+(c|0);b=J[a+156>>2];La:{if(b){if(Se(b,l,n,o,t,v,w))break La;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;
-break La}b=J[a+208>>2];if(!b)break La;Ab[J[J[b>>2]+44>>2]](b,l,n,o,t,v,w)}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,1);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}break n;case 45:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+152>>2]=0;J[h+156>>2]=0;J[h+144>>2]=0;J[h+148>>2]=0;f=h+152|0;c=h+144|0;Cn(a,h,f,c,h+136|0,h+128|0);b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=c;c=J[a+208>>2];Ma:{if(!c)break Ma;if(J[a+156>>2]){if((Ab[J[J[c>>2]+96>>2]](c)|0)==4)break Ma;c=J[a+208>>2]}Ab[J[J[c>>
-2]+336>>2]](c,h,f,b)}v=we(J[h>>2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[f>>2],J[f+4>>2]);w=we(J[h>>2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[b>>2],J[b+4>>2]);d=J[h>>2];c=J[h+8>>2];t=v*-.017453292519943295;o=Fe(t);b=J[h+4>>2];n=+(J[h+12>>2]-b|0);l=n*.5;E=o;o=+(c-d|0);n=Pi(ue(t)/n*.5,E/o*.5);l=l+ +(b|0)-l*ue(n);Na:{if(R(l)<2147483648){c=~~l;break Na}c=-2147483648}t=+(c|0);l=o*.5;l=l*Fe(n)+(l+ +(d|0));Oa:{if(R(l)<2147483648){b=~~l;break Oa}b=-2147483648}l=+(b|0);d=J[a+156>>2];Pa:{Qa:{if(d){if(le(d,l,t))break Qa;
-H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Pa}d=J[a+208>>2];if(!d)break Qa;Ab[J[J[d>>2]+32>>2]](d,l,t)}d=J[a+120>>2];J[d+680>>2]=b;J[d+684>>2]=c}w=w-v;t=+J[h+12>>2];o=+J[h+8>>2];n=+J[h+4>>2];l=+J[h>>2];b=J[a+156>>2];Ra:{Sa:{Ta:{if(b){if(Se(b,l,n,o,t,v,w))break Ta;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ta}b=J[a+208>>2];if(!b){c=J[f+4>>2];b=J[f>>2];break Sa}Ab[J[J[b>>2]+44>>2]](b,l,n,o,t,v,w)}c=J[f+4>>2];n=+(c|0);b=J[f>>2];l=+(b|0);d=J[a+156>>2];if(d){if(ud(d,l,n))break Sa;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=
-1;break Ra}d=J[a+208>>2];if(!d)break Sa;Ab[J[J[d>>2]+36>>2]](d,l,n)}d=J[a+120>>2];J[d+680>>2]=b;J[d+684>>2]=c}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,3);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}break n;case 41:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];Ua:{if(c+3>>>0>=b>>>0){e=0;break Ua}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;
-J[f+12>>2]=c}J[h+4>>2]=d;d=0;Va:{if(b>>>0<=c+3>>>0){e=0;break Va}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];Wa:{if(!b)break Wa;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>2]](b)|0)==4)break Wa;b=J[a+208>>2]}Ab[J[J[b>>2]+340>>2]](b,h)}c=J[a+120>>2];b=J[(c+664|0)+8>>2];f=J[h+4>>2];d=J[h+12>>2];if(((J[c+676>>2]<0?(f|0)<(d|
-0):(d|0)<(f|0))|0)==1){J[h+4>>2]=d;J[h+12>>2]=f}d=J[h>>2];c=J[h+8>>2];if((((b|0)<0?(d|0)<(c|0):(c|0)<(d|0))|0)==1){J[h>>2]=c;J[h+8>>2]=d}b=J[a+156>>2];t=+J[h+8>>2];o=+J[h>>2];Xa:{if(J[J[a+120>>2]+688>>2]==1){n=+J[h+12>>2];l=+J[h+4>>2];if(b){if(Se(b,o,l,t,n,0,360))break Xa;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Xa}b=J[a+208>>2];if(!b)break Xa;Ab[J[J[b>>2]+44>>2]](b,o,l,t,n,0,360);break Xa}n=+J[h+4>>2];l=+J[h+12>>2];if(b){if(Se(b,o,l,t,n,0,360))break Xa;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Xa}b=J[a+
-208>>2];if(!b)break Xa;Ab[J[J[b>>2]+44>>2]](b,o,l,t,n,0,360)}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,3);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}break n;case 82:f=0;i=0;n=0;c=xb-96|0;xb=c;J[c+68>>2]=0;J[c+72>>2]=0;J[c+76>>2]=0;J[c+80>>2]=0;J[c+88>>2]=0;J[c+92>>2]=0;J[c+48>>2]=0;J[c+52>>2]=0;J[c+16>>2]=0;J[c+20>>2]=0;e=J[J[a>>2]-12>>2]+a|0;b=J[e+12>>2];g=J[e+16>>2];if(b+3>>>0>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+8>>2]=i;if(g>>>0>b+
-3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+12>>2]=f;f=0;Ya:{if(g>>>0<=b+3>>>0){i=0;break Ya}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+16>>2]=i;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+20>>2]=f;f=0;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+24>>2]=f;if(g>>>0<=b+3>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|
-0;J[e+12>>2]=b;o=+(x(2,d),C())}O[c+32>>3]=o;if(g>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[e+12>>2]=b+4;n=+(x(2,d),C())}J[195395]=0;O[c+40>>3]=n;fa(1990,e+4|0,c+48|0,36);b=J[195395];J[195395]=0;if((b|0)==1)break j;b=J[a+216>>2];Za:{if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break j;if(d)break Za}J[195395]=0;$(1991,a|0,c+8|0);b=J[195395];J[195395]=0;if((b|0)==1)break j}b=J[c+88>>2];if(b){Kb(b);J[c+88>>2]=0}b=J[c+92>>2];if(b)Kb(b);xb=c+96|0;break n;case 83:f=
-0;i=0;n=0;c=xb-96|0;xb=c;J[c+68>>2]=0;J[c+72>>2]=0;J[c+76>>2]=0;J[c+80>>2]=0;J[c+88>>2]=0;J[c+92>>2]=0;J[c+48>>2]=0;J[c+52>>2]=0;J[c+16>>2]=0;J[c+20>>2]=0;e=J[J[a>>2]-12>>2]+a|0;b=J[e+12>>2];g=J[e+16>>2];if(b+3>>>0>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+8>>2]=i;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+12>>2]=f;f=0;_a:{if(g>>>0<=b+3>>>0){i=0;break _a}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;
-J[e+12>>2]=b}J[c+16>>2]=i;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+20>>2]=f;f=0;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[c+24>>2]=f;if(g>>>0<=b+3>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b;o=+(x(2,d),C())}O[c+32>>3]=o;if(g>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[e+12>>2]=b+4;n=+(x(2,d),C())}J[195395]=0;O[c+40>>3]=n;fa(1992,e+4|0,c+48|0,
-36);b=J[195395];J[195395]=0;if((b|0)==1)break j;b=J[a+216>>2];$a:{if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break j;if(d)break $a}J[195395]=0;$(1993,a|0,c+8|0);b=J[195395];J[195395]=0;if((b|0)==1)break j}b=J[c+88>>2];if(b){Kb(b);J[c+88>>2]=0}b=J[c+92>>2];if(b)Kb(b);xb=c+96|0;break n;case 61:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];ab:{if(c+3>>>0>=b>>>0){e=0;break ab}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>
-2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+4>>2]=d;d=0;bb:{if(b>>>0<=c+3>>>0){e=0;break bb}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+228>>2]](b,h);b=J[a+156>>2];cb:{if(!b)break cb;Ui(b,J[a+208>>2],0,1,-1);wf(J[a+156>>2]);b=J[a+156>>2];if(!b)break cb;
-Kb(qd(b));J[a+156>>2]=0}break n;case 53:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];db:{if(f+3>>>0>=b>>>0){e=0;break db}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>2]=e;if(b>>>0>f+3>>>0){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];eb:{if(!b)break eb;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>2]](b)|0)==4)break eb;b=J[a+208>>2]}Ab[J[J[b>>2]+352>>2]](b,h)}d=J[h+4>>2];n=+(d|0);c=J[h>>
-2];l=+(c|0);b=J[a+156>>2];fb:{gb:{if(b){if(ud(b,l,n))break gb;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break fb}b=J[a+208>>2];if(!b)break gb;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}break n;case 46:J[h+8>>2]=0;J[h+12>>2]=0;J[h>>2]=0;J[h+4>>2]=0;J[h+152>>2]=0;J[h+156>>2]=0;J[h+144>>2]=0;J[h+148>>2]=0;d=h+152|0;c=h+144|0;Cn(a,h,d,c,h+136|0,h+128|0);b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];hb:{if(!b)break hb;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>2]](b)|0)==4)break hb;
-b=J[a+208>>2]}Ab[J[J[b>>2]+356>>2]](b,h,d,c)}v=we(J[h>>2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[d>>2],J[d+4>>2]);w=we(J[h>>2],J[h+4>>2],J[h+8>>2],J[h+12>>2],J[c>>2],J[c+4>>2])-v;t=+J[h+12>>2];o=+J[h+8>>2];n=+J[h+4>>2];l=+J[h>>2];b=J[a+156>>2];ib:{if(b){if(Se(b,l,n,o,t,v,w))break ib;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ib}b=J[a+208>>2];if(!b)break ib;Ab[J[J[b>>2]+44>>2]](b,l,n,o,t,v,w)}d=(J[h+12>>2]+J[h+4>>2]|0)/2|0;n=+(d|0);c=(J[h+8>>2]+J[h>>2]|0)/2|0;l=+(c|0);b=J[a+156>>2];jb:{kb:{if(b){if(ud(b,l,n))break kb;
-H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break jb}b=J[a+208>>2];if(!b)break kb;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}b=J[a+156>>2];lb:{if(b){if(Kf(b))break lb;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break lb}b=J[a+208>>2];if(!b)break lb;Ab[J[J[b>>2]+48>>2]](b)}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,3);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}break n;case 1:b=0;f=0;e=xb-32|0;xb=e;J[e+24>>2]=0;J[e+28>>2]=0;q=J[a>>2]-12|0;g=J[q>>2]+a|0;c=J[g+12>>2];d=J[g+16>>
-2];if(c+3>>>0>>0){f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[g+12>>2]=c}J[e+16>>2]=f;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[g+12>>2]=c}J[e+20>>2]=b;b=0;mb:{if(d>>>0<=c+3>>>0){f=0;break mb}f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[g+12>>2]=c}J[e+24>>2]=f;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[g+12>>2]=c+4}J[e+28>>2]=b;b=J[q>>2]+a|0;c=J[b+12>>2];nb:{if(c+3>>>0>=M[b+16>>2])break nb;m=K[c|0]|K[c+1|
-0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;if(!m)break nb;J[e+12>>2]=0;J[e+4>>2]=0;J[e+8>>2]=0;ob:{pb:{if(m>>>0>=536870912){J[195395]=0;ea(1994,e+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break pb;B()}J[195395]=0;d=m<<3;f=_(1078,d|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break ob}a=Z()|0;b=J[e+4>>2];if(!b)break d;J[e+8>>2]=b;Kb(b);break d}J[e+4>>2]=f;b=d+f|0;J[e+12>>2]=b;c=0;j=Nb(f,0,d);J[e+8>>2]=b;g=J[q>>2]+a|0;d=J[g+12>>2];b=J[g+16>>2];qb:{if(d+3>>>0>=b>>>0){f=0;break qb}f=K[d|0]|K[d+1|0]<<
-8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[g+12>>2]=d}J[j>>2]=f;if(b>>>0>d+3>>>0){c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[g+12>>2]=d+4}J[j+4>>2]=c;d=1;if(m>>>0>1)while(1){p=j+(d<<3)|0;f=0;k=J[q>>2]+a|0;b=J[k+12>>2];g=J[k+16>>2];rb:{if(b+3>>>0>=g>>>0){c=0;break rb}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p>>2]=c;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[k+12>>2]=b+4}J[p+4>>2]=f;f=0;k=J[q>>2]+a|0;b=J[k+12>>2];g=J[k+16>>2];sb:{if(b+3>>>
-0>=g>>>0){c=0;break sb}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+8>>2]=c;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[k+12>>2]=b+4}J[p+12>>2]=f;f=0;k=J[q>>2]+a|0;b=J[k+12>>2];g=J[k+16>>2];tb:{if(b+3>>>0>=g>>>0){c=0;break tb}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+16>>2]=c;if(g>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[k+12>>2]=b+4}J[p+20>>2]=f;d=d+3|0;if(m>>>0>d>>>0)continue;break}b=J[a+
-216>>2];ub:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break i;if(c)break ub}J[195395]=0;fa(1995,a|0,e+16|0,e+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break i}b=J[e+4>>2];if(!b)break nb;J[e+8>>2]=b;Kb(b)}xb=e+32|0;break n;case 84:c=0;f=0;e=xb-32|0;xb=e;J[e+24>>2]=0;J[e+28>>2]=0;m=J[a>>2]-12|0;g=J[m>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[e+16>>2]=f;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+
-2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[e+20>>2]=c;c=0;vb:{if(d>>>0<=b+3>>>0){f=0;break vb}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[e+24>>2]=f;if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[e+28>>2]=c;b=J[m>>2]+a|0;c=J[b+12>>2];wb:{if(c+3>>>0>=M[b+16>>2])break wb;j=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;if(!j)break wb;J[e+12>>2]=0;J[e+4>>2]=0;J[e+8>>2]=0;xb:{yb:{if(j>>>0>=1073741824){J[195395]=0;ea(1996,
-e+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break yb;B()}J[195395]=0;d=j<<2;f=_(1078,d|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break xb}a=Z()|0;b=J[e+4>>2];if(!b)break d;J[e+8>>2]=b;Kb(b);break d}J[e+4>>2]=f;b=d+f|0;J[e+12>>2]=b;c=0;k=Nb(f,0,d);J[e+8>>2]=b;g=J[m>>2]+a|0;b=J[g+12>>2];f=J[g+16>>2];zb:{if(b+1>>>0>=f>>>0){d=0;break zb}d=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[g+12>>2]=b}I[k>>1]=d;u=1;if(f>>>0>b+1>>>0){c=K[b|0]|K[b+1|0]<<8;J[g+12>>2]=b+2}I[k+2>>1]=c;if(j>>>0>1)while(1){q=k+(u<<2)|0;f=0;g=J[m>>2]+
-a|0;c=J[g+12>>2];d=J[g+16>>2];Ab:{if(c+1>>>0>=d>>>0){b=0;break Ab}b=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[g+12>>2]=c}I[q>>1]=b;if(d>>>0>c+1>>>0){f=K[c|0]|K[c+1|0]<<8;J[g+12>>2]=c+2}I[q+2>>1]=f;f=0;g=J[m>>2]+a|0;c=J[g+12>>2];d=J[g+16>>2];Bb:{if(c+1>>>0>=d>>>0){b=0;break Bb}b=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[g+12>>2]=c}I[q+4>>1]=b;if(d>>>0>c+1>>>0){f=K[c|0]|K[c+1|0]<<8;J[g+12>>2]=c+2}I[q+6>>1]=f;f=0;g=J[m>>2]+a|0;c=J[g+12>>2];d=J[g+16>>2];Cb:{if(c+1>>>0>=d>>>0){b=0;break Cb}b=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[g+12>>
-2]=c}I[q+8>>1]=b;if(d>>>0>c+1>>>0){f=K[c|0]|K[c+1|0]<<8;J[g+12>>2]=c+2}I[q+10>>1]=f;u=u+3|0;if(j>>>0>u>>>0)continue;break}b=J[a+216>>2];Db:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break i;if(c)break Db}J[195395]=0;fa(1997,a|0,e+16|0,e+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break i}b=J[e+4>>2];if(!b)break wb;J[e+8>>2]=b;Kb(b)}xb=e+32|0;break n;case 4:c=0;b=0;f=xb-32|0;xb=f;J[f+24>>2]=0;J[f+28>>2]=0;m=J[a>>2]-12|0;g=J[m>>2]+a|0;e=J[g+12>>2];d=J[g+16>>2];if(e+3>>>0>>0){c=
-K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f+16>>2]=c;if(d>>>0>e+3>>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f+20>>2]=b;b=0;Eb:{if(d>>>0<=e+3>>>0){c=0;break Eb}c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f+24>>2]=c;if(d>>>0>e+3>>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+12>>2]=e+4}J[f+28>>2]=b;Fb:{Gb:{b=J[m>>2]+a|0;c=J[b+12>>2];Hb:{Ib:{Jb:{if(c+3>>>0>=M[b+16>>2]){J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>
-2]=0;break Jb}q=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;if(!q)break Jb;Kb:{Lb:{if(q>>>0>=536870912){J[195395]=0;ea(1994,f+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break Lb;B()}e=0;J[195395]=0;d=q<<3;b=_(1078,d|0)|0;c=J[195395];J[195395]=0;if((c|0)!=1)break Kb}e=Z()|0;a=J[f+4>>2];if(!a)break Gb;J[f+8>>2]=a;Kb(a);break Gb}J[f+4>>2]=b;c=b+d|0;J[f+12>>2]=c;k=Nb(b,0,d);J[f+8>>2]=c;while(1){j=J[m>>2]+a|0;if(q-e>>>0<=1){H[j+33|0]=1;break Ib}p=k+
-(e<<3)|0;d=0;g=J[j+16>>2];c=J[j+12>>2];Mb:{if(g>>>0<=c+3>>>0){i=0;break Mb}i=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[j+12>>2]=c}J[p>>2]=i;if(g>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[j+12>>2]=c+4}J[p+4>>2]=d;d=0;j=J[m>>2]+a|0;c=J[j+12>>2];g=J[j+16>>2];Nb:{if(c+3>>>0>=g>>>0){i=0;break Nb}i=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[j+12>>2]=c}J[p+8>>2]=i;if(g>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[j+12>>2]=c+4}J[p+12>>
-2]=d;d=0;j=J[m>>2]+a|0;c=J[j+12>>2];g=J[j+16>>2];Ob:{if(c+3>>>0>=g>>>0){i=0;break Ob}i=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[j+12>>2]=c}J[p+16>>2]=i;if(g>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[j+12>>2]=c+4}J[p+20>>2]=d;e=e+3|0;if(q>>>0>e>>>0)continue;break}}Pb:{Qb:{Rb:{b=J[a+216>>2];if(!b)break Rb;J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break Qb;if(!c)break Rb;b=J[f+4>>2];break Pb}e=J[a+208>>2];Sb:{if(!e)break Sb;if(J[a+156>>2]){b=J[J[e>>
-2]+96>>2];J[195395]=0;c=_(b|0,e|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Qb;if((c|0)==4)break Sb;e=J[a+208>>2]}b=J[J[e>>2]+368>>2];J[195395]=0;fa(b|0,e|0,f+16|0,f+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break Qb}b=J[f+8>>2];c=J[f+4>>2];if((b|0)==(c|0))break Pb;e=0;b=c;while(1){Tb:{J[195395]=0;b=(e<<3)+b|0;ia(1998,a|0,b|0,b+8|0,b+16|0);b=J[195395];J[195395]=0;if((b|0)==1)break Tb;e=e+3|0;b=J[f+4>>2];if(e>>>0>2]-b>>3>>>0)continue;break Pb}break}}e=Z()|0;a=J[f+4>>2];if(!a)break Gb;break c}if(!b)break Hb}J[f+
-8>>2]=b;Kb(b)}xb=f+32|0;break Fb}ba(e|0);B()}break n;case 87:c=0;b=0;f=xb-32|0;xb=f;J[f+24>>2]=0;J[f+28>>2]=0;m=J[a>>2]-12|0;g=J[m>>2]+a|0;e=J[g+12>>2];d=J[g+16>>2];if(e+3>>>0>>0){c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f+16>>2]=c;if(d>>>0>e+3>>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f+20>>2]=b;b=0;Ub:{if(d>>>0<=e+3>>>0){c=0;break Ub}c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f+24>>2]=c;if(d>>>0>e+
-3>>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+12>>2]=e+4}J[f+28>>2]=b;Vb:{Wb:{b=J[m>>2]+a|0;c=J[b+12>>2];Xb:{Yb:{Zb:{if(c+3>>>0>=M[b+16>>2]){J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;break Zb}q=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;if(!q)break Zb;_b:{$b:{if(q>>>0>=1073741824){J[195395]=0;ea(1996,f+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break $b;B()}e=0;J[195395]=0;d=q<<2;b=_(1078,d|0)|0;c=J[195395];J[195395]=0;if((c|0)!=1)break _b}e=
-Z()|0;a=J[f+4>>2];if(!a)break Wb;J[f+8>>2]=a;Kb(a);break Wb}J[f+4>>2]=b;c=b+d|0;J[f+12>>2]=c;k=Nb(b,0,d);J[f+8>>2]=c;while(1){j=J[m>>2]+a|0;if(q-e>>>0<=1){H[j+33|0]=1;break Yb}p=k+(e<<2)|0;d=0;g=J[j+16>>2];c=J[j+12>>2];ac:{if(g>>>0<=c+1>>>0){i=0;break ac}i=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[j+12>>2]=c}I[p>>1]=i;if(g>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;J[j+12>>2]=c+2}I[p+2>>1]=d;d=0;j=J[m>>2]+a|0;c=J[j+12>>2];g=J[j+16>>2];bc:{if(c+1>>>0>=g>>>0){i=0;break bc}i=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[j+12>>2]=c}I[p+4>>
-1]=i;if(g>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;J[j+12>>2]=c+2}I[p+6>>1]=d;d=0;j=J[m>>2]+a|0;c=J[j+12>>2];g=J[j+16>>2];cc:{if(c+1>>>0>=g>>>0){i=0;break cc}i=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[j+12>>2]=c}I[p+8>>1]=i;if(g>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;J[j+12>>2]=c+2}I[p+10>>1]=d;e=e+3|0;if(q>>>0>e>>>0)continue;break}}dc:{ec:{fc:{b=J[a+216>>2];if(!b)break fc;J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break ec;if(!c)break fc;b=J[f+4>>2];break dc}e=J[a+208>>2];gc:{if(!e)break gc;if(J[a+156>>
-2]){b=J[J[e>>2]+96>>2];J[195395]=0;c=_(b|0,e|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break ec;if((c|0)==4)break gc;e=J[a+208>>2]}b=J[J[e>>2]+372>>2];J[195395]=0;fa(b|0,e|0,f+16|0,f+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break ec}b=J[f+8>>2];c=J[f+4>>2];if((b|0)==(c|0))break dc;e=0;b=c;while(1){hc:{J[195395]=0;b=(e<<2)+b|0;ia(1999,a|0,b|0,b+4|0,b+8|0);b=J[195395];J[195395]=0;if((b|0)==1)break hc;e=e+3|0;b=J[f+4>>2];if(e>>>0>2]-b>>2>>>0)continue;break dc}break}}e=Z()|0;a=J[f+4>>2];if(!a)break Wb;
-break c}if(!b)break Xb}J[f+8>>2]=b;Kb(b)}xb=f+32|0;break Vb}ba(e|0);B()}break n;case 55:e=0;c=0;r=xb-32|0;xb=r;J[r+24>>2]=0;J[r+28>>2]=0;k=J[a>>2]-12|0;f=J[k>>2]+a|0;b=J[f+12>>2];d=J[f+16>>2];if(b+3>>>0>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[r+16>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[r+20>>2]=e;e=0;ic:{if(d>>>0<=b+3>>>0){c=0;break ic}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=
-b}J[r+24>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+12>>2]=b+4}J[r+28>>2]=e;b=J[k>>2]+a|0;c=J[b+12>>2];jc:{if(c+3>>>0>=M[b+16>>2])break jc;j=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;J[r+12>>2]=j;if(!j)break jc;b=0;c=j<<3;q=Nb(Pb(j>>>0>536870911?-1:c),0,c);while(1){f=q+(b<<3)|0;g=J[k>>2]+a|0;e=J[g+12>>2];d=J[g+16>>2];kc:{if(e+3>>>0>=d>>>0){c=0;break kc}c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[g+12>>2]=e}J[f>>2]=c;c=0;if(d>>>0>
-e+3>>>0){c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+12>>2]=e+4}J[f+4>>2]=c;b=b+1|0;if((j|0)!=(b|0))continue;break}b=0;p=Pb(j);if((j|0)!=1){d=j&-2;c=0;while(1){s=0;f=J[k>>2]+a|0;g=J[f+12>>2];if(g>>>0>2]){s=K[g|0];J[f+12>>2]=g+1}H[b+p|0]=s;s=0;f=J[k>>2]+a|0;g=J[f+12>>2];if(g>>>0>2]){s=K[g|0];J[f+12>>2]=g+1}H[p+(b|1)|0]=s;b=b+2|0;c=c+2|0;if((d|0)!=(c|0))continue;break}}if(j&1){c=b+p|0;b=0;d=J[k>>2]+a|0;f=J[d+12>>2];if(f>>>0>2]){b=K[f|0];J[d+12>>2]=f+1}H[c|0]=b}b=J[a+
-216>>2];if(!(K[b+213|0]?b:0)){k=r+16|0;e=0;b=0;d=0;g=0;j=r+12|0;lc:{if(!J[j>>2])break lc;while(1){f=d;c=b;b=q+(e<<3)|0;m=K[e+p|0];mc:{nc:{if((m|0)==6){Zq(a,b);d=0;break nc}oc:{pc:{qc:{if(m&2){Bn(a,b);d=0;if(m&1)break qc;break nc}if(!(m&4))break nc;d=1;rc:switch(f|0){case 0:break mc;case 1:break oc;case 2:break rc;default:break pc}XA(a,c,g,b);d=0;if(!(m&1))break nc}nl(a);break nc}H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break lc}d=2;g=b}b=c}e=e+1|0;if(e>>>0>2])continue;break}}e=J[a+208>>2];sc:{if(!e)break sc;
-if(J[a+156>>2]){if((Ab[J[J[e>>2]+96>>2]](e)|0)==4)break sc;e=J[a+208>>2]}Ab[J[J[e>>2]+376>>2]](e,k,q,j,p)}}Kb(q);Kb(p)}xb=r+32|0;break n;case 91:e=0;c=0;r=xb-32|0;xb=r;J[r+24>>2]=0;J[r+28>>2]=0;k=J[a>>2]-12|0;f=J[k>>2]+a|0;b=J[f+12>>2];d=J[f+16>>2];if(b+3>>>0>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[r+16>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[r+20>>2]=e;e=0;tc:{if(d>>>0<=b+3>>>0){c=0;break tc}c=K[b|0]|K[b+
-1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[r+24>>2]=c;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+12>>2]=b+4}J[r+28>>2]=e;b=J[k>>2]+a|0;c=J[b+12>>2];uc:{if(c+3>>>0>=M[b+16>>2])break uc;j=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;J[r+12>>2]=j;if(!j)break uc;b=0;c=j<<2;q=Nb(Pb(j>>>0>1073741823?-1:c),0,c);while(1){f=q+(b<<2)|0;g=J[k>>2]+a|0;e=J[g+12>>2];d=J[g+16>>2];vc:{if(e+1>>>0>=d>>>0){c=0;break vc}c=K[e|0]|K[e+1|0]<<8;e=e+2|0;J[g+12>>
-2]=e}I[f>>1]=c;c=0;if(d>>>0>e+1>>>0){c=K[e|0]|K[e+1|0]<<8;J[g+12>>2]=e+2}I[f+2>>1]=c;b=b+1|0;if((j|0)!=(b|0))continue;break}b=0;p=Pb(j);if((j|0)!=1){d=j&-2;c=0;while(1){s=0;f=J[k>>2]+a|0;g=J[f+12>>2];if(g>>>0>2]){s=K[g|0];J[f+12>>2]=g+1}H[b+p|0]=s;s=0;f=J[k>>2]+a|0;g=J[f+12>>2];if(g>>>0>2]){s=K[g|0];J[f+12>>2]=g+1}H[p+(b|1)|0]=s;b=b+2|0;c=c+2|0;if((d|0)!=(c|0))continue;break}}if(j&1){c=b+p|0;b=0;d=J[k>>2]+a|0;f=J[d+12>>2];if(f>>>0>2]){b=K[f|0];J[d+12>>2]=f+1}H[c|0]=b}b=J[a+
-216>>2];if(!(K[b+213|0]?b:0)){k=r+16|0;e=0;b=0;d=0;g=0;j=r+12|0;wc:{if(!J[j>>2])break wc;while(1){f=d;c=b;b=q+(e<<2)|0;m=K[e+p|0];xc:{yc:{if((m|0)==6){Yq(a,b);d=0;break yc}zc:{Ac:{Bc:{if(m&2){An(a,b);d=0;if(m&1)break Bc;break yc}if(!(m&4))break yc;d=1;Cc:switch(f|0){case 0:break xc;case 1:break zc;case 2:break Cc;default:break Ac}YA(a,c,g,b);d=0;if(!(m&1))break yc}nl(a);break yc}H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break wc}d=2;g=b}b=c}e=e+1|0;if(e>>>0>2])continue;break}}e=J[a+208>>2];Dc:{if(!e)break Dc;
-if(J[a+156>>2]){if((Ab[J[J[e>>2]+96>>2]](e)|0)==4)break Dc;e=J[a+208>>2]}Ab[J[J[e>>2]+380>>2]](e,k,q,j,p)}}Kb(q);Kb(p)}xb=r+32|0;break n;case 2:e=0;f=0;c=xb-32|0;xb=c;J[c+24>>2]=0;J[c+28>>2]=0;j=J[a>>2]-12|0;g=J[j>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+20>>2]=e;e=0;Ec:{if(d>>>0<=b+3>>>0){f=0;break Ec}f=K[b|0]|K[b+
-1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[c+28>>2]=e;b=J[j>>2]+a|0;d=J[b+12>>2];Fc:{if(d+3>>>0>=M[b+16>>2])break Fc;q=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4;if(!q)break Fc;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;Gc:{Hc:{if(q>>>0>=536870912){J[195395]=0;ea(1994,c+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break Hc;B()}J[195395]=0;f=q<<3;g=_(1078,f|0)|0;b=J[195395];J[195395]=
-0;if((b|0)!=1)break Gc}b=Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a);break a}J[c+4>>2]=g;d=f+g|0;J[c+12>>2]=d;b=0;g=Nb(g,0,f);J[c+8>>2]=d;while(1){k=g+(b<<3)|0;m=J[j>>2]+a|0;e=J[m+12>>2];d=J[m+16>>2];Ic:{if(e+3>>>0>=d>>>0){f=0;break Ic}f=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[m+12>>2]=e}J[k>>2]=f;f=0;if(d>>>0>e+3>>>0){f=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[m+12>>2]=e+4}J[k+4>>2]=f;b=b+1|0;if((q|0)!=(b|0))continue;break}Jc:{b=J[a+216>>2];if(b){J[195395]=0;d=K[b+
-213|0];b=J[195395];J[195395]=0;if((b|0)==1)break b;if(d)break Jc}J[195395]=0;fa(2E3,a|0,c+16|0,c+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break Jc;break b}b=J[c+4>>2];if(!b)break Fc;J[c+8>>2]=b;Kb(b)}xb=c+32|0;break n;case 85:e=0;f=0;c=xb-32|0;xb=c;J[c+24>>2]=0;J[c+28>>2]=0;j=J[a>>2]-12|0;g=J[j>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+
-4|0;J[g+12>>2]=b}J[c+20>>2]=e;e=0;Kc:{if(d>>>0<=b+3>>>0){f=0;break Kc}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[c+28>>2]=e;b=J[j>>2]+a|0;d=J[b+12>>2];Lc:{if(d+3>>>0>=M[b+16>>2])break Lc;q=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4;if(!q)break Lc;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;Mc:{Nc:{if(q>>>0>=1073741824){J[195395]=0;ea(1996,c+4|0);a=J[195395];J[195395]=
-0;if((a|0)==1)break Nc;B()}J[195395]=0;f=q<<2;g=_(1078,f|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break Mc}b=Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a);break a}J[c+4>>2]=g;d=f+g|0;J[c+12>>2]=d;b=0;g=Nb(g,0,f);J[c+8>>2]=d;while(1){k=g+(b<<2)|0;m=J[j>>2]+a|0;e=J[m+12>>2];d=J[m+16>>2];Oc:{if(e+1>>>0>=d>>>0){f=0;break Oc}f=K[e|0]|K[e+1|0]<<8;e=e+2|0;J[m+12>>2]=e}I[k>>1]=f;f=0;if(d>>>0>e+1>>>0){f=K[e|0]|K[e+1|0]<<8;J[m+12>>2]=e+2}I[k+2>>1]=f;b=b+1|0;if((q|0)!=(b|0))continue;break}Pc:{b=J[a+216>>
-2];if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break b;if(d)break Pc}J[195395]=0;fa(2001,a|0,c+16|0,c+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break Pc;break b}b=J[c+4>>2];if(!b)break Lc;J[c+8>>2]=b;Kb(b)}xb=c+32|0;break n;case 3:e=0;f=0;c=xb-32|0;xb=c;J[c+24>>2]=0;J[c+28>>2]=0;j=J[a>>2]-12|0;g=J[j>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+
-2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+20>>2]=e;e=0;Qc:{if(d>>>0<=b+3>>>0){f=0;break Qc}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[c+28>>2]=e;b=J[j>>2]+a|0;d=J[b+12>>2];Rc:{if(d+3>>>0>=M[b+16>>2])break Rc;q=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4;if(!q)break Rc;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;Sc:{Tc:{if(q>>>0>=536870912){J[195395]=0;ea(1994,
-c+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break Tc;B()}J[195395]=0;f=q<<3;g=_(1078,f|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break Sc}b=Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a);break a}J[c+4>>2]=g;d=f+g|0;J[c+12>>2]=d;b=0;g=Nb(g,0,f);J[c+8>>2]=d;while(1){k=g+(b<<3)|0;m=J[j>>2]+a|0;e=J[m+12>>2];d=J[m+16>>2];Uc:{if(e+3>>>0>=d>>>0){f=0;break Uc}f=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[m+12>>2]=e}J[k>>2]=f;f=0;if(d>>>0>e+3>>>0){f=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<
-24);J[m+12>>2]=e+4}J[k+4>>2]=f;b=b+1|0;if((q|0)!=(b|0))continue;break}Vc:{b=J[a+216>>2];if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break b;if(d)break Vc}J[195395]=0;fa(2002,a|0,c+16|0,c+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break Vc;break b}b=J[c+4>>2];if(!b)break Rc;J[c+8>>2]=b;Kb(b)}xb=c+32|0;break n;case 86:e=0;f=0;c=xb-32|0;xb=c;J[c+24>>2]=0;J[c+28>>2]=0;j=J[a>>2]-12|0;g=J[j>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|
-0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+20>>2]=e;e=0;Wc:{if(d>>>0<=b+3>>>0){f=0;break Wc}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[c+28>>2]=e;b=J[j>>2]+a|0;d=J[b+12>>2];Xc:{if(d+3>>>0>=M[b+16>>2])break Xc;q=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4;if(!q)break Xc;
-J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;Yc:{Zc:{if(q>>>0>=1073741824){J[195395]=0;ea(1996,c+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break Zc;B()}J[195395]=0;f=q<<2;g=_(1078,f|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break Yc}b=Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a);break a}J[c+4>>2]=g;d=f+g|0;J[c+12>>2]=d;b=0;g=Nb(g,0,f);J[c+8>>2]=d;while(1){k=g+(b<<2)|0;m=J[j>>2]+a|0;e=J[m+12>>2];d=J[m+16>>2];_c:{if(e+1>>>0>=d>>>0){f=0;break _c}f=K[e|0]|K[e+1|0]<<8;e=e+2|0;J[m+12>>2]=e}I[k>>1]=f;f=0;if(d>>>
-0>e+1>>>0){f=K[e|0]|K[e+1|0]<<8;J[m+12>>2]=e+2}I[k+2>>1]=f;b=b+1|0;if((q|0)!=(b|0))continue;break}$c:{b=J[a+216>>2];if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break b;if(d)break $c}J[195395]=0;fa(2003,a|0,c+16|0,c+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break $c;break b}b=J[c+4>>2];if(!b)break Xc;J[c+8>>2]=b;Kb(b)}xb=c+32|0;break n;case 5:f=0;e=0;c=xb-32|0;xb=c;J[c+24>>2]=0;J[c+28>>2]=0;m=J[a>>2]-12|0;g=J[m>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+
-1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+20>>2]=e;e=0;ad:{if(d>>>0<=b+3>>>0){f=0;break ad}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[c+28>>2]=e;b=J[m>>2]+a|0;d=J[b+12>>2];bd:{if(d+3>>>0>=M[b+16>>2]){e=0;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;d=0;break bd}p=K[d|
-0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4;e=0;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;d=0;if(!p)break bd;cd:{dd:{if(p>>>0>=536870912){J[195395]=0;ea(1994,c+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break dd;B()}b=0;J[195395]=0;f=p<<3;e=_(1078,f|0)|0;d=J[195395];J[195395]=0;if((d|0)!=1)break cd}b=Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a);break a}J[c+4>>2]=e;d=e+f|0;J[c+12>>2]=d;k=Nb(e,0,f);J[c+8>>2]=d;while(1){j=k+(b<<3)|0;u=0;q=J[m>>2]+a|0;f=J[q+12>>2];g=J[q+16>>2];ed:{if(f+3>>>
-0>=g>>>0){r=0;break ed}r=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[q+12>>2]=f}J[j>>2]=r;if(g>>>0>f+3>>>0){u=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[q+12>>2]=f+4}J[j+4>>2]=u;b=b+1|0;if((p|0)!=(b|0))continue;break}}fd:{b=J[a+216>>2];if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break b;if(d)break fd;e=J[c+4>>2];d=J[c+8>>2]}if((d|0)!=(e|0)){b=0;while(1){J[195395]=0;$(2004,a|0,(b<<3)+e|0);d=J[195395];J[195395]=0;if((d|0)==1)break b;b=b+1|0;e=J[c+4>>2];if(b>>>
-0>2]-e>>3>>>0)continue;break}}b=J[a+208>>2];if(!b)break fd;if(J[a+156>>2]){d=J[J[b>>2]+96>>2];J[195395]=0;d=_(d|0,b|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break b;if((d|0)==4)break fd;b=J[a+208>>2]}d=J[J[b>>2]+400>>2];J[195395]=0;fa(d|0,b|0,c+16|0,c+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break fd;break b}b=J[c+4>>2];if(b){J[c+8>>2]=b;Kb(b)}xb=c+32|0;break n;case 88:f=0;e=0;c=xb-32|0;xb=c;J[c+24>>2]=0;J[c+28>>2]=0;m=J[a>>2]-12|0;g=J[m>>2]+a|0;b=J[g+12>>2];d=J[g+16>>2];if(b+3>>>0>>0){f=
-K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+16>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+20>>2]=e;e=0;gd:{if(d>>>0<=b+3>>>0){f=0;break gd}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[c+24>>2]=f;if(d>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[c+28>>2]=e;b=J[m>>2]+a|0;d=J[b+12>>2];hd:{if(d+3>>>0>=M[b+16>>2]){e=0;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;d=0;break hd}p=
-K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4;e=0;J[c+12>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;d=0;if(!p)break hd;id:{jd:{if(p>>>0>=1073741824){J[195395]=0;ea(1996,c+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break jd;B()}b=0;J[195395]=0;f=p<<2;e=_(1078,f|0)|0;d=J[195395];J[195395]=0;if((d|0)!=1)break id}b=Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a);break a}J[c+4>>2]=e;d=e+f|0;J[c+12>>2]=d;k=Nb(e,0,f);J[c+8>>2]=d;while(1){j=k+(b<<2)|0;u=0;q=J[m>>2]+a|0;f=J[q+12>>2];g=J[q+16>>2];kd:{if(f+
-1>>>0>=g>>>0){r=0;break kd}r=K[f|0]|K[f+1|0]<<8;f=f+2|0;J[q+12>>2]=f}I[j>>1]=r;if(g>>>0>f+1>>>0){u=K[f|0]|K[f+1|0]<<8;J[q+12>>2]=f+2}I[j+2>>1]=u;b=b+1|0;if((p|0)!=(b|0))continue;break}}ld:{b=J[a+216>>2];if(b){J[195395]=0;d=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break b;if(d)break ld;e=J[c+4>>2];d=J[c+8>>2]}if((d|0)!=(e|0)){b=0;while(1){J[195395]=0;$(2005,a|0,(b<<2)+e|0);d=J[195395];J[195395]=0;if((d|0)==1)break b;b=b+1|0;e=J[c+4>>2];if(b>>>0>2]-e>>2>>>0)continue;break}}b=J[a+208>>2];
-if(!b)break ld;if(J[a+156>>2]){d=J[J[b>>2]+96>>2];J[195395]=0;d=_(d|0,b|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break b;if((d|0)==4)break ld;b=J[a+208>>2]}d=J[J[b>>2]+404>>2];J[195395]=0;fa(d|0,b|0,c+16|0,c+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break ld;break b}b=J[c+4>>2];if(b){J[c+8>>2]=b;Kb(b)}xb=c+32|0;break n;case 7:e=0;d=0;f=xb-32|0;xb=f;J[f+24>>2]=0;J[f+28>>2]=0;k=J[a>>2]-12|0;g=J[k>>2]+a|0;b=J[g+12>>2];c=J[g+16>>2];if(b+3>>>0>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+
-4|0;J[g+12>>2]=b}J[f+16>>2]=d;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[f+20>>2]=e;e=0;md:{if(c>>>0<=b+3>>>0){d=0;break md}d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[f+24>>2]=d;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[f+28>>2]=e;d=0;e=J[k>>2];g=e+a|0;c=J[g+12>>2];b=J[g+16>>2];if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[g+12>>2]=c+4;e=J[k>>2];c=e+a|0;b=J[c+
-16>>2];c=J[c+12>>2]}if(c+3>>>0>>0)J[(a+e|0)+12>>2]=c+4;b=0;J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;nd:{if(!d)break nd;J[195395]=0;$(2006,f+4|0,d|0);c=J[195395];J[195395]=0;if((c|0)==1)break h;while(1){c=0;g=J[J[a>>2]-12>>2]+a|0;e=J[g+12>>2];if(e+3>>>0>2]){c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+12>>2]=e+4}k=J[f+4>>2]+P(b,12)|0;e=J[k>>2];g=J[k+4>>2]-e>>3;od:{if(g>>>0>>0){J[195395]=0;$(2007,k|0,c-g|0);c=J[195395];J[195395]=0;if((c|0)!=1)break od;break h}if(c>>>0>=g>>>0)break od;
-J[k+4>>2]=e+(c<<3)}b=b+1|0;if((d|0)!=(b|0))continue;break}if(!d)break nd;m=J[a>>2]-12|0;i=0;j=J[f+4>>2];while(1){c=j+P(i,12)|0;b=J[c+4>>2];p=J[c>>2];if((b|0)!=(p|0)){b=b-p>>3;k=b>>>0<=1?1:b;c=0;while(1){q=p+(c<<3)|0;r=J[m>>2]+a|0;b=J[r+12>>2];g=J[r+16>>2];pd:{if(b+3>>>0>=g>>>0){e=0;break pd}e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[r+12>>2]=b}J[q>>2]=e;e=0;if(g>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[r+12>>2]=b+4}J[q+4>>2]=e;c=c+1|0;if((k|0)!=(c|0))continue;
-break}}i=i+1|0;if((i|0)!=(d|0))continue;break}}b=J[a+216>>2];qd:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break h;if(c)break qd}J[195395]=0;fa(2008,a|0,f+16|0,f+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break h}d=J[f+4>>2];if(d){b=J[f+8>>2];c=d;if((b|0)!=(c|0)){while(1){c=b-12|0;g=J[c>>2];if(g){J[b-8>>2]=g;Kb(g)}b=c;if((d|0)!=(b|0))continue;break}c=J[f+4>>2]}J[f+8>>2]=d;Kb(c)}xb=f+32|0;break n;case 90:e=0;d=0;f=xb-32|0;xb=f;J[f+24>>2]=0;J[f+28>>2]=0;k=J[a>>2]-12|0;g=J[k>>
-2]+a|0;b=J[g+12>>2];c=J[g+16>>2];if(b+3>>>0>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[f+16>>2]=d;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[f+20>>2]=e;e=0;rd:{if(c>>>0<=b+3>>>0){d=0;break rd}d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b}J[f+24>>2]=d;if(c>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4}J[f+28>>2]=e;d=0;e=J[k>>2];g=e+a|0;c=J[g+12>>2];b=J[g+16>>2];
-if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[g+12>>2]=c+4;e=J[k>>2];c=e+a|0;b=J[c+16>>2];c=J[c+12>>2]}if(c+3>>>0>>0)J[(a+e|0)+12>>2]=c+4;b=0;J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;sd:{if(!d)break sd;J[195395]=0;$(2009,f+4|0,d|0);c=J[195395];J[195395]=0;if((c|0)==1)break h;while(1){c=0;g=J[J[a>>2]-12>>2]+a|0;e=J[g+12>>2];if(e+3>>>0>2]){c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+12>>2]=e+4}k=J[f+4>>2]+P(b,12)|0;e=J[k>>2];g=J[k+4>>2]-e>>2;td:{if(g>>>0>>0){J[195395]=
-0;$(2010,k|0,c-g|0);c=J[195395];J[195395]=0;if((c|0)!=1)break td;break h}if(c>>>0>=g>>>0)break td;J[k+4>>2]=e+(c<<2)}b=b+1|0;if((d|0)!=(b|0))continue;break}if(!d)break sd;m=J[a>>2]-12|0;i=0;j=J[f+4>>2];while(1){c=j+P(i,12)|0;b=J[c+4>>2];p=J[c>>2];if((b|0)!=(p|0)){b=b-p>>2;k=b>>>0<=1?1:b;c=0;while(1){q=p+(c<<2)|0;r=J[m>>2]+a|0;b=J[r+12>>2];g=J[r+16>>2];ud:{if(b+1>>>0>=g>>>0){e=0;break ud}e=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[r+12>>2]=b}I[q>>1]=e;e=0;if(g>>>0>b+1>>>0){e=K[b|0]|K[b+1|0]<<8;J[r+12>>2]=b+2}I[q+
-2>>1]=e;c=c+1|0;if((k|0)!=(c|0))continue;break}}i=i+1|0;if((i|0)!=(d|0))continue;break}}b=J[a+216>>2];vd:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break h;if(c)break vd}J[195395]=0;fa(2011,a|0,f+16|0,f+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break h}d=J[f+4>>2];if(d){b=J[f+8>>2];c=d;if((b|0)!=(c|0)){while(1){c=b-12|0;g=J[c>>2];if(g){J[b-8>>2]=g;Kb(g)}b=c;if((d|0)!=(b|0))continue;break}c=J[f+4>>2]}J[f+8>>2]=d;Kb(c)}xb=f+32|0;break n;case 6:b=0;d=0;f=xb-32|0;xb=f;J[f+24>>
-2]=0;J[f+28>>2]=0;g=J[a>>2]-12|0;k=J[g>>2]+a|0;e=J[k+12>>2];c=J[k+16>>2];if(e+3>>>0>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[k+12>>2]=e}J[f+16>>2]=b;if(c>>>0>e+3>>>0){d=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[k+12>>2]=e}J[f+20>>2]=d;d=0;wd:{if(c>>>0<=e+3>>>0){b=0;break wd}b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[k+12>>2]=e}J[f+24>>2]=b;if(c>>>0>e+3>>>0){d=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[k+12>>2]=e+4}J[f+28>>2]=d;i=0;d=J[g>>
-2];c=d+a|0;b=J[c+12>>2];e=J[c+16>>2];if(e>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[c+12>>2]=b+4;d=J[g>>2];b=d+a|0;e=J[b+16>>2];b=J[b+12>>2]}c=1;if(b+3>>>0>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+d|0)+12>>2]=b+4;c=!c}xd:{b=!i;if(c?b:0)break xd;if((b|c)==1){H[(J[g>>2]+a|0)+33|0]=1;break xd}c=0;J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;J[195395]=0;$(2006,f+4|0,i|0);b=J[195395];J[195395]=0;yd:{if((b|0)==1)break yd;while(1){b=0;d=J[J[a>>2]-12>>2]+a|0;g=J[d+12>>2];
-if(g+3>>>0>2]){b=K[g|0]|K[g+1|0]<<8|(K[g+2|0]<<16|K[g+3|0]<<24);J[d+12>>2]=g+4}e=J[f+4>>2]+P(c,12)|0;g=J[e>>2];d=J[e+4>>2]-g>>3;zd:{if(d>>>0>>0){J[195395]=0;$(2007,e|0,b-d|0);b=J[195395];J[195395]=0;if((b|0)!=1)break zd;break yd}if(b>>>0>=d>>>0)break zd;J[e+4>>2]=g+(b<<3)}c=c+1|0;if((i|0)!=(c|0))continue;break}m=J[a>>2]-12|0;e=0;j=J[f+4>>2];while(1){c=j+P(e,12)|0;b=J[c+4>>2];p=J[c>>2];if((b|0)!=(p|0)){b=b-p>>3;k=b>>>0<=1?1:b;b=0;while(1){q=p+(b<<3)|0;r=J[m>>2]+a|0;c=J[r+12>>2];g=J[r+16>>
-2];Ad:{if(c+3>>>0>=g>>>0){d=0;break Ad}d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[r+12>>2]=c}J[q>>2]=d;d=0;if(g>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[r+12>>2]=c+4}J[q+4>>2]=d;b=b+1|0;if((k|0)!=(b|0))continue;break}}e=e+1|0;if((i|0)!=(e|0))continue;break}b=J[a+216>>2];Bd:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break yd;if(c)break Bd}J[195395]=0;fa(2012,a|0,f+16|0,f+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break yd}d=J[f+4>>2];if(!d)break xd;
-b=d;c=J[f+8>>2];if((b|0)!=(c|0)){while(1){b=c-12|0;g=J[b>>2];if(g){J[c-8>>2]=g;Kb(g)}c=b;if((b|0)!=(d|0))continue;break}b=J[f+4>>2]}J[f+8>>2]=d;Kb(b);break xd}break h}xb=f+32|0;break n;case 89:b=0;d=0;f=xb-32|0;xb=f;J[f+24>>2]=0;J[f+28>>2]=0;g=J[a>>2]-12|0;k=J[g>>2]+a|0;e=J[k+12>>2];c=J[k+16>>2];if(e+3>>>0>>0){b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[k+12>>2]=e}J[f+16>>2]=b;if(c>>>0>e+3>>>0){d=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[k+12>>2]=e}J[f+20>>2]=d;d=
-0;Cd:{if(c>>>0<=e+3>>>0){b=0;break Cd}b=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);e=e+4|0;J[k+12>>2]=e}J[f+24>>2]=b;if(c>>>0>e+3>>>0){d=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[k+12>>2]=e+4}J[f+28>>2]=d;i=0;d=J[g>>2];c=d+a|0;b=J[c+12>>2];e=J[c+16>>2];if(e>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[c+12>>2]=b+4;d=J[g>>2];b=d+a|0;e=J[b+16>>2];b=J[b+12>>2]}c=1;if(b+3>>>0>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+d|0)+12>>2]=b+4;c=!c}Dd:{b=!i;if(c?
-b:0)break Dd;if((b|c)==1){H[(J[g>>2]+a|0)+33|0]=1;break Dd}c=0;J[f+12>>2]=0;J[f+4>>2]=0;J[f+8>>2]=0;J[195395]=0;$(2009,f+4|0,i|0);b=J[195395];J[195395]=0;Ed:{if((b|0)==1)break Ed;while(1){b=0;d=J[J[a>>2]-12>>2]+a|0;g=J[d+12>>2];if(g+3>>>0>2]){b=K[g|0]|K[g+1|0]<<8|(K[g+2|0]<<16|K[g+3|0]<<24);J[d+12>>2]=g+4}e=J[f+4>>2]+P(c,12)|0;g=J[e>>2];d=J[e+4>>2]-g>>2;Fd:{if(d>>>0>>0){J[195395]=0;$(2010,e|0,b-d|0);b=J[195395];J[195395]=0;if((b|0)!=1)break Fd;break Ed}if(b>>>0>=d>>>0)break Fd;J[e+4>>2]=
-g+(b<<2)}c=c+1|0;if((i|0)!=(c|0))continue;break}m=J[a>>2]-12|0;e=0;j=J[f+4>>2];while(1){c=j+P(e,12)|0;b=J[c+4>>2];p=J[c>>2];if((b|0)!=(p|0)){b=b-p>>2;k=b>>>0<=1?1:b;b=0;while(1){q=p+(b<<2)|0;r=J[m>>2]+a|0;c=J[r+12>>2];g=J[r+16>>2];Gd:{if(c+1>>>0>=g>>>0){d=0;break Gd}d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+12>>2]=c}I[q>>1]=d;d=0;if(g>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;J[r+12>>2]=c+2}I[q+2>>1]=d;b=b+1|0;if((k|0)!=(b|0))continue;break}}e=e+1|0;if((i|0)!=(e|0))continue;break}b=J[a+216>>2];Hd:{if(b){J[195395]=
-0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break Ed;if(c)break Hd}J[195395]=0;fa(2013,a|0,f+16|0,f+4|0);b=J[195395];J[195395]=0;if((b|0)==1)break Ed}d=J[f+4>>2];if(!d)break Dd;b=d;c=J[f+8>>2];if((b|0)!=(c|0)){while(1){b=c-12|0;g=J[b>>2];if(g){J[c-8>>2]=g;Kb(g)}c=b;if((b|0)!=(d|0))continue;break}b=J[f+4>>2]}J[f+8>>2]=d;Kb(b);break Dd}break h}xb=f+32|0;break n;case 95:c=0;b=xb-80|0;xb=b;J[b+40>>2]=0;J[b+44>>2]=0;J[b+32>>2]=0;J[b+36>>2]=0;J[b+76>>2]=0;d=J[J[a>>2]-12>>2];J[195395]=0;ca(2014,(a+
-d|0)+4|0,b+32|0)|0;d=J[195395];J[195395]=0;if((d|0)==1)break g;Id:{Jd:{Kd:{Ld:{Md:{if(!J[b+72>>2])break Md;if(!J[b+76>>2])break Ld;c=J[a+216>>2];if(c){J[195395]=0;d=K[c+213|0];c=J[195395];J[195395]=0;if((c|0)==1)break g;c=J[b+72>>2];if(!c|d)break Md}e=0;while(1){J[b+24>>2]=0;J[b+28>>2]=1072693248;J[b+8>>2]=0;J[b+12>>2]=1072693248;J[b+16>>2]=0;J[b+20>>2]=1072693248;J[195395]=0;J[b>>2]=0;J[b+4>>2]=1072693248;ia(2015,a|0,J[b+76>>2]+P(e,48)|0,J[b+48>>2],b|0);c=J[195395];J[195395]=0;if((c|0)==1)break g;
-c=J[b+72>>2];e=e+1|0;if(c>>>0>e>>>0)continue;break}}e=J[b+76>>2];if(!e)break Id;if(!c)break Jd;break Kd}H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;if(J[b+76>>2])break Kd;break Id}c=0;while(1){f=J[b+76>>2]+P(c,48)|0;d=J[f+40>>2];if(d){Kb(d);J[f+40>>2]=0}d=J[f+44>>2];if(d){Kb(d);J[f+44>>2]=0}c=c+1|0;if(c>>>0>2])continue;break}e=J[b+76>>2];if(!e)break Id}Kb(e)}xb=b+80|0;break n;case 96:c=0;b=xb-80|0;xb=b;J[b+40>>2]=0;J[b+44>>2]=0;J[b+32>>2]=0;J[b+36>>2]=0;J[b+76>>2]=0;d=J[J[a>>2]-12>>2];J[195395]=0;ca(2016,
-(a+d|0)+4|0,b+32|0)|0;d=J[195395];J[195395]=0;if((d|0)==1)break g;Nd:{Od:{Pd:{Qd:{Rd:{if(!J[b+72>>2])break Rd;if(!J[b+76>>2])break Qd;c=J[a+216>>2];if(c){J[195395]=0;d=K[c+213|0];c=J[195395];J[195395]=0;if((c|0)==1)break g;c=J[b+72>>2];if(!c|d)break Rd}e=0;while(1){J[b+24>>2]=0;J[b+28>>2]=1072693248;J[b+8>>2]=0;J[b+12>>2]=1072693248;J[b+16>>2]=0;J[b+20>>2]=1072693248;J[195395]=0;J[b>>2]=0;J[b+4>>2]=1072693248;ia(2017,a|0,J[b+76>>2]+P(e,48)|0,J[b+48>>2],b|0);c=J[195395];J[195395]=0;if((c|0)==1)break g;
-c=J[b+72>>2];e=e+1|0;if(c>>>0>e>>>0)continue;break}}e=J[b+76>>2];if(!e)break Nd;if(!c)break Od;break Pd}H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;if(J[b+76>>2])break Pd;break Nd}c=0;while(1){f=J[b+76>>2]+P(c,48)|0;d=J[f+40>>2];if(d){Kb(d);J[f+40>>2]=0}d=J[f+44>>2];if(d){Kb(d);J[f+44>>2]=0}c=c+1|0;if(c>>>0>2])continue;break}e=J[b+76>>2];if(!e)break Nd}Kb(e)}xb=b+80|0;break n;case 42:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];Sd:{if(c+3>>>0>=b>>>0){e=0;break Sd}e=K[c|
-0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+4>>2]=d;d=0;Td:{if(b>>>0<=c+3>>>0){e=0;break Td}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];Ud:{if(!b)break Ud;if(J[a+156>>2]){if((Ab[J[J[b>>2]+96>>
-2]](b)|0)==4)break Ud;b=J[a+208>>2]}Ab[J[J[b>>2]+424>>2]](b,h)}b=J[a+156>>2];d=J[h+4>>2];n=+(d|0);c=J[h>>2];l=+(c|0);Vd:{if(J[J[a+120>>2]+688>>2]==1){Wd:{Xd:{if(b){if(le(b,l,n))break Xd;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Wd}b=J[a+208>>2];if(!b)break Xd;Ab[J[J[b>>2]+32>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}d=J[h+12>>2];n=+(d|0);c=J[h>>2];l=+(c|0);b=J[a+156>>2];Yd:{Zd:{if(b){if(ud(b,l,n))break Zd;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Yd}b=J[a+208>>2];if(!b)break Zd;Ab[J[J[b>>2]+
-36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}d=J[h+12>>2];n=+(d|0);c=J[h+8>>2];l=+(c|0);b=J[a+156>>2];_d:{$d:{if(b){if(ud(b,l,n))break $d;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break _d}b=J[a+208>>2];if(!b)break $d;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}d=J[h+4>>2];n=+(d|0);c=J[h+8>>2];l=+(c|0);b=J[a+156>>2];ae:{if(b){if(ud(b,l,n))break ae;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Vd}b=J[a+208>>2];if(!b)break ae;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>
-2]=c;J[b+684>>2]=d;break Vd}be:{ce:{if(b){if(le(b,l,n))break ce;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break be}b=J[a+208>>2];if(!b)break ce;Ab[J[J[b>>2]+32>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}d=J[h+4>>2];n=+(d|0);c=J[h+8>>2];l=+(c|0);b=J[a+156>>2];de:{ee:{if(b){if(ud(b,l,n))break ee;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break de}b=J[a+208>>2];if(!b)break ee;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}d=J[h+12>>2];n=+(d|0);c=J[h+8>>2];l=+(c|0);b=J[a+156>>2];fe:{ge:{if(b){if(ud(b,
-l,n))break ge;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break fe}b=J[a+208>>2];if(!b)break ge;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}d=J[h+12>>2];n=+(d|0);c=J[h>>2];l=+(c|0);b=J[a+156>>2];he:{if(b){if(ud(b,l,n))break he;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Vd}b=J[a+208>>2];if(!b)break he;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}b=J[a+156>>2];ie:{if(b){if(Kf(b))break ie;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ie}b=J[a+208>>2];if(!b)break ie;Ab[J[J[b>>
-2]+48>>2]](b)}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,3);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}break n;case 43:c=0;f=0;k=xb-32|0;xb=k;J[k+24>>2]=0;J[k+28>>2]=0;J[k+8>>2]=0;J[k+12>>2]=0;d=J[a>>2]-12|0;e=J[d>>2]+a|0;b=J[e+12>>2];g=J[e+16>>2];if(b+3>>>0>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[k+16>>2]=f;if(g>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[k+20>>2]=c;c=0;je:{if(g>>>0<=b+3>>>0){f=0;break je}f=
-K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[k+24>>2]=f;if(g>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[e+12>>2]=b+4}J[k+28>>2]=c;b=0;g=J[d>>2]+a|0;c=J[g+12>>2];d=J[g+16>>2];ke:{if(c+3>>>0>=d>>>0){f=0;break ke}f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[g+12>>2]=c}J[k+8>>2]=f;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[g+12>>2]=c+4}J[k+12>>2]=b;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){j=k+16|0;g=k+8|0;d=J[a+208>>2];le:{if(!d)break le;
-if(J[a+156>>2]){if((Ab[J[J[d>>2]+96>>2]](d)|0)==4)break le;d=J[a+208>>2]}Ab[J[J[d>>2]+428>>2]](d,j,g)}f=J[j+4>>2];c=(J[j+12>>2]-f|0)/2|0;b=J[g+4>>2];e=(b|0)>(c|0)?c:b;d=J[j>>2];c=(J[j+8>>2]-d|0)/2|0;b=J[g>>2];g=(b|0)>(c|0)?c:b;c=d+g|0;n=+(c|0);b=J[a+156>>2];l=+(f|0);me:{if(J[J[a+120>>2]+688>>2]==1){ne:{oe:{if(b){if(le(b,n,l))break oe;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ne}b=J[a+208>>2];if(!b)break oe;Ab[J[J[b>>2]+32>>2]](b,n,l)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=f}b=J[j+4>>2];t=+(b+e|0);c=
-J[j>>2];o=+(g+c|0);n=+(b|0);l=+(c|0);b=J[a+156>>2];pe:{qe:{re:{if(b){if(Se(b,l,n,o,t,270,-90))break re;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break re}b=J[a+208>>2];if(!b){d=J[j+12>>2]-e|0;break qe}Ab[J[J[b>>2]+44>>2]](b,l,n,o,t,270,-90)}d=J[j+12>>2]-e|0;n=+(d|0);c=J[j>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,l,n))break qe;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break pe}b=J[a+208>>2];if(!b)break qe;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}b=J[j>>2];t=+(b+g|0);c=J[j+12>>2];o=+(c-e|
-0);n=+(c|0);l=+(b|0);b=J[a+156>>2];se:{te:{ue:{if(b){if(Se(b,l,o,t,n,180,-90))break ue;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ue}b=J[a+208>>2];if(!b){d=J[j+8>>2]-g|0;break te}Ab[J[J[b>>2]+44>>2]](b,l,o,t,n,180,-90)}d=J[j+8>>2]-g|0;n=+(d|0);c=J[j+12>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,n,l))break te;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break se}b=J[a+208>>2];if(!b)break te;Ab[J[J[b>>2]+36>>2]](b,n,l)}b=J[a+120>>2];J[b+680>>2]=d;J[b+684>>2]=c}b=J[j+12>>2];t=+(b-e|0);c=J[j+8>>2];o=+(c-g|0);n=+(b|0);
-l=+(c|0);b=J[a+156>>2];ve:{we:{xe:{if(b){if(Se(b,o,t,l,n,90,-90))break xe;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break xe}b=J[a+208>>2];if(!b){d=e+J[j+4>>2]|0;break we}Ab[J[J[b>>2]+44>>2]](b,o,t,l,n,90,-90)}d=e+J[j+4>>2]|0;n=+(d|0);c=J[j+8>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,l,n))break we;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ve}b=J[a+208>>2];if(!b)break we;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}c=J[j+4>>2];t=+(e+c|0);b=J[j+8>>2];o=+(b-g|0);n=+(b|0);l=+(c|0);b=J[a+156>>
-2];ye:{ze:{if(b){if(Se(b,o,l,n,t,0,-90))break ze;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break ze}b=J[a+208>>2];if(!b){d=g+J[j>>2]|0;break ye}Ab[J[J[b>>2]+44>>2]](b,o,l,n,t,0,-90)}d=g+J[j>>2]|0;n=+(d|0);c=J[j+4>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,n,l))break ye;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break me}b=J[a+208>>2];if(!b)break ye;Ab[J[J[b>>2]+36>>2]](b,n,l)}b=J[a+120>>2];J[b+680>>2]=d;J[b+684>>2]=c;break me}Ae:{Be:{if(b){if(le(b,n,l))break Be;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ae}b=J[a+208>>2];
-if(!b)break Be;Ab[J[J[b>>2]+32>>2]](b,n,l)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=f}d=J[j+8>>2]-g|0;n=+(d|0);c=J[j+4>>2];l=+(c|0);b=J[a+156>>2];Ce:{De:{if(b){if(ud(b,n,l))break De;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ce}b=J[a+208>>2];if(!b)break De;Ab[J[J[b>>2]+36>>2]](b,n,l)}b=J[a+120>>2];J[b+680>>2]=d;J[b+684>>2]=c}b=J[j+4>>2];t=+(b+e|0);c=J[j+8>>2];o=+(c-g|0);n=+(c|0);l=+(b|0);b=J[a+156>>2];Ee:{Fe:{Ge:{if(b){if(Se(b,o,l,n,t,-90,90))break Ge;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ge}b=J[a+208>>
-2];if(!b){d=J[j+12>>2]-e|0;break Fe}Ab[J[J[b>>2]+44>>2]](b,o,l,n,t,-90,90)}d=J[j+12>>2]-e|0;n=+(d|0);c=J[j+8>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,l,n))break Fe;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ee}b=J[a+208>>2];if(!b)break Fe;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}c=J[j+12>>2];t=+(c-e|0);b=J[j+8>>2];o=+(b-g|0);n=+(c|0);l=+(b|0);b=J[a+156>>2];He:{Ie:{Je:{if(b){if(Se(b,o,t,l,n,0,90))break Je;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Je}b=J[a+208>>2];if(!b){d=g+J[j>>
-2]|0;break Ie}Ab[J[J[b>>2]+44>>2]](b,o,t,l,n,0,90)}d=g+J[j>>2]|0;n=+(d|0);c=J[j+12>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,n,l))break Ie;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break He}b=J[a+208>>2];if(!b)break Ie;Ab[J[J[b>>2]+36>>2]](b,n,l)}b=J[a+120>>2];J[b+680>>2]=d;J[b+684>>2]=c}c=J[j>>2];t=+(g+c|0);b=J[j+12>>2];o=+(b-e|0);n=+(b|0);l=+(c|0);b=J[a+156>>2];Ke:{Le:{Me:{if(b){if(Se(b,l,o,t,n,90,90))break Me;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Me}b=J[a+208>>2];if(!b){d=e+J[j+4>>2]|0;break Le}Ab[J[J[b>>
-2]+44>>2]](b,l,o,t,n,90,90)}d=e+J[j+4>>2]|0;n=+(d|0);c=J[j>>2];l=+(c|0);b=J[a+156>>2];if(b){if(ud(b,l,n))break Le;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ke}b=J[a+208>>2];if(!b)break Le;Ab[J[J[b>>2]+36>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}c=J[j+4>>2];t=+(c+e|0);b=J[j>>2];o=+(b+g|0);n=+(c|0);l=+(b|0);b=J[a+156>>2];if(b){if(Se(b,l,n,o,t,180,90))break me;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break me}b=J[a+208>>2];if(!b)break me;Ab[J[J[b>>2]+44>>2]](b,l,n,o,t,180,90)}b=J[a+156>>2];Ne:{if(b){if(Kf(b))break Ne;
-H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Ne}b=J[a+208>>2];if(!b)break Ne;Ab[J[J[b>>2]+48>>2]](b)}b=J[a+208>>2];if(!(!(!J[a+156>>2]|!b)|!b)){Ab[J[J[b>>2]+52>>2]](b,3);b=J[a+208>>2];Ab[J[J[b>>2]+56>>2]](b)}}xb=k+32|0;break n;case 14:b=0;e=0;k=xb-16|0;xb=k;j=k+4|0;H[j|0]=0;H[j+1|0]=0;H[j+2|0]=0;H[j+3|0]=0;f=J[a>>2]-12|0;g=J[f>>2]+a|0;c=J[g+12>>2];d=J[g+16>>2];if(c+3>>>0>>0){e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[g+12>>2]=c}J[k+8>>2]=e;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+
-2|0]<<16|K[c+3|0]<<24);J[g+12>>2]=c+4}J[k+12>>2]=b;c=0;f=J[f>>2]+a|0;b=J[f+12>>2];d=J[f+16>>2];Oe:{if(b>>>0>=d>>>0){e=0;break Oe}e=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j|0]=e;if(b>>>0>>0){c=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j+1|0]=c;c=0;Pe:{if(b>>>0>=d>>>0){e=0;break Pe}e=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j+2|0]=e;if(b>>>0>>0){c=K[b|0];J[f+12>>2]=b+1}H[j+3|0]=c;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){f=k+8|0;g=xb-16|0;xb=g;b=J[a+208>>2];if(b){Ab[J[J[b>>2]+432>>2]](b,f,j);b=J[a+208>>2]}else b=0;H[g+12|0]=K[j+2|
-0];H[g+13|0]=K[j+1|0];c=K[j|0];H[g+15|0]=255;H[g+14|0]=c;if(b){d=J[f>>2];n=+(d|0);c=J[f+4>>2];l=+(c|0);Ab[J[J[b>>2]+16>>2]](b,n,l,+(d+1|0)-n,+(c+1|0)-l,g+12|0,1,1)}xb=g+16|0}xb=k+16|0;break n;case 107:J[h+40>>2]=0;J[h+44>>2]=0;J[h+56>>2]=0;J[h+48>>2]=0;J[h+52>>2]=0;b=J[J[a>>2]-12>>2];J[195395]=0;ca(1987,b+A|0,h|0)|0;b=J[195395];J[195395]=0;Qe:{Re:{if((b|0)==1)break Re;b=J[a+216>>2];if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break Re;if(c)break Qe}J[195395]=0;$(1989,a|0,h|0);
-b=J[195395];J[195395]=0;if((b|0)!=1)break Qe}a=Z()|0;b=J[h+56>>2];if(b)Kb(b);break d}b=J[h+56>>2];if(!b)break n;Kb(b);break n;case 62:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];Se:{if(c+3>>>0>=b>>>0){e=0;break Se}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+4>>2]=d;d=0;Te:{if(b>>>0<=c+3>>>0){e=0;break Te}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|
-K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];Ue:{if(!b)break Ue;Ab[J[J[b>>2]+440>>2]](b,h);c=J[a+208>>2];if(!c)break Ue;b=J[a+156>>2];if(!b)break Ue;Ui(b,c,1,1,-1);wf(J[a+156>>2]);b=J[a+156>>2];if(!b)break Ue;Kb(qd(b));J[a+156>>2]=0}break n;case 63:J[h+8>>2]=0;J[h+12>>2]=0;d=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];b=J[f+16>>2];Ve:{if(c+3>>>0>=b>>>0){e=
-0;break Ve}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+4>>2]=d;d=0;We:{if(b>>>0<=c+3>>>0){e=0;break We}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[h+8>>2]=e;if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4}J[h+12>>2]=d;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];Xe:{if(!b)break Xe;Ab[J[J[b>>2]+444>>2]](b,
-h);c=J[a+208>>2];if(!c)break Xe;b=J[a+156>>2];if(!b)break Xe;Ui(b,c,1,0,-1);wf(J[a+156>>2]);b=J[a+156>>2];if(!b)break Xe;Kb(qd(b));J[a+156>>2]=0}break n;case 73:b=0;f=0;g=0;u=0;m=xb+-64|0;xb=m;J[m+56>>2]=0;J[m+60>>2]=0;k=J[a>>2]-12|0;e=J[k>>2]+a|0;c=J[e+12>>2];d=J[e+16>>2];if(c+3>>>0>>0){f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+48>>2]=f;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+52>>2]=b;b=0;Ye:{if(d>>>0<=c+3>>>0){f=
-0;break Ye}f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+56>>2]=f;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[e+12>>2]=c+4}J[m+60>>2]=b;Ze:{_e:{c=J[k>>2]+a|0;d=J[c+12>>2];$e:{if(d+3>>>0>=M[c+16>>2])break $e;b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4;if(b>>>0<33)break $e;J[m+40>>2]=0;J[m+44>>2]=0;J[m+32>>2]=0;J[m+36>>2]=0;f=0;e=J[k>>2]+a|0;c=J[e+12>>2];d=J[e+16>>2];if(c+3>>>0>>0){g=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<
-24);c=c+4|0;J[e+12>>2]=c}J[m+16>>2]=g;af:{if(d>>>0<=c+3>>>0){b=c;break af}f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);b=c+4|0;J[e+12>>2]=b}J[m+20>>2]=f;i=0;bf:{if(d>>>0<=b+3>>>0){c=0;break bf}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+24>>2]=c;if(d>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+28>>2]=i;i=0;if(d>>>0>b+3>>>0){u=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+32>>2]=u;if(d>>>0>b+3>>>
-0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+36>>2]=i;i=0;cf:{if(d>>>0<=b+3>>>0){u=0;break cf}u=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+40>>2]=u;if(d>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[e+12>>2]=b+4}J[m+44>>2]=i;if(!c|((g|0)!=32|(f|0)!=1))break $e;J[m+12>>2]=0;J[m+4>>2]=0;J[m+8>>2]=0;df:{ef:{if(c>>>0>=268435456){J[195395]=0;ea(2018,m+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break ef;B()}J[195395]=0;f=c<<4;
-c=_(1078,f|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break df}c=Z()|0;a=J[m+4>>2];if(!a)break _e;J[m+8>>2]=a;Kb(a);break _e}J[m+4>>2]=c;d=c+f|0;J[m+12>>2]=d;Nb(c,0,f);J[m+8>>2]=d;while(1){j=J[k>>2]+a|0;b=J[j+12>>2];e=J[j+16>>2];ff:{if(b+3>>>0>=e>>>0){f=0;break ff}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[j+12>>2]=b}J[c>>2]=f;f=0;gf:{if(e>>>0<=b+3>>>0){g=0;break gf}g=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[j+12>>2]=b}J[c+4>>2]=g;if(e>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<
-8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[j+12>>2]=b}J[c+8>>2]=f;f=0;if(e>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[j+12>>2]=b+4}J[c+12>>2]=f;c=c+16|0;if((d|0)!=(c|0))continue;break}hf:{b=J[a+216>>2];jf:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break jf;if(c)break hf}J[195395]=0;ia(2019,a|0,m+48|0,m+16|0,m+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break hf}c=Z()|0;a=J[m+4>>2];if(!a)break _e;J[m+8>>2]=a;Kb(a);ba(c|0);B()}b=J[m+4>>2];if(!b)break $e;J[m+8>>
-2]=b;Kb(b)}xb=m- -64|0;break Ze}ba(c|0);B()}break n;case 70:b=0;f=0;g=0;u=0;r=0;m=xb+-64|0;xb=m;J[m+56>>2]=0;J[m+60>>2]=0;k=J[a>>2]-12|0;e=J[k>>2]+a|0;c=J[e+12>>2];d=J[e+16>>2];if(c+3>>>0>>0){f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+48>>2]=f;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+52>>2]=b;b=0;kf:{if(d>>>0<=c+3>>>0){f=0;break kf}f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+56>>2]=f;
-if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[e+12>>2]=c+4}J[m+60>>2]=b;b=J[k>>2];e=b+a|0;d=J[e+12>>2];c=J[e+16>>2];lf:{if(c>>>0<=d+3>>>0){f=0;break lf}f=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[e+12>>2]=d+4;b=J[k>>2];d=b+a|0;c=J[d+16>>2];d=J[d+12>>2]}if(d+3>>>0>>0){r=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[(a+b|0)+12>>2]=d+4}mf:{nf:{of:{if(f>>>0<33)break of;J[m+40>>2]=0;J[m+44>>2]=0;J[m+32>>2]=0;J[m+36>>2]=0;f=0;e=J[k>>2]+a|0;c=J[e+12>>2];d=J[e+16>>2];if(c+
-3>>>0>>0){g=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[e+12>>2]=c}J[m+16>>2]=g;pf:{if(d>>>0<=c+3>>>0){b=c;break pf}f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);b=c+4|0;J[e+12>>2]=b}J[m+20>>2]=f;i=0;qf:{if(d>>>0<=b+3>>>0){c=0;break qf}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+24>>2]=c;if(d>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+28>>2]=i;i=0;if(d>>>0>b+3>>>0){u=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|
-0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+32>>2]=u;if(d>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+36>>2]=i;i=0;rf:{if(d>>>0<=b+3>>>0){u=0;break rf}u=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[e+12>>2]=b}J[m+40>>2]=u;if(d>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[e+12>>2]=b+4}J[m+44>>2]=i;if(!c|((g|0)!=32|(f|0)!=1))break of;J[m+12>>2]=0;J[m+4>>2]=0;J[m+8>>2]=0;sf:{tf:{if(c>>>0>=268435456){J[195395]=0;ea(2018,m+4|0);a=J[195395];
-J[195395]=0;if((a|0)==1)break tf;B()}J[195395]=0;f=c<<4;d=_(1078,f|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break sf}d=Z()|0;a=J[m+4>>2];if(!a)break nf;J[m+8>>2]=a;Kb(a);break nf}J[m+4>>2]=d;c=d+f|0;J[m+12>>2]=c;Nb(d,0,f);J[m+8>>2]=c;while(1){j=J[k>>2]+a|0;b=J[j+12>>2];e=J[j+16>>2];uf:{if(b+3>>>0>=e>>>0){f=0;break uf}f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[j+12>>2]=b}J[d>>2]=f;f=0;vf:{if(e>>>0<=b+3>>>0){g=0;break vf}g=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[j+12>>
-2]=b}J[d+4>>2]=g;if(e>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[j+12>>2]=b}J[d+8>>2]=f;f=0;if(e>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[j+12>>2]=b+4}J[d+12>>2]=f;d=d+16|0;if((c|0)!=(d|0))continue;break}wf:{b=J[a+216>>2];xf:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break xf;if(c)break wf}J[195395]=0;ma(2020,a|0,m+48|0,r|0,m+16|0,m+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break wf}d=Z()|0;a=J[m+4>>2];if(!a)break nf;J[m+
-8>>2]=a;Kb(a);ba(d|0);B()}b=J[m+4>>2];if(!b)break of;J[m+8>>2]=b;Kb(b)}xb=m- -64|0;break mf}ba(d|0);B()}break n;case 71:b=0;d=0;s=0;g=0;u=0;r=0;m=0;e=0;p=xb+-64|0;xb=p;J[p+56>>2]=0;J[p+60>>2]=0;q=J[a>>2]-12|0;f=J[q>>2]+a|0;i=J[f+12>>2];c=J[f+16>>2];if(i+3>>>0>>0){b=K[i|0]|K[i+1|0]<<8|(K[i+2|0]<<16|K[i+3|0]<<24);i=i+4|0;J[f+12>>2]=i}J[p+48>>2]=b;if(c>>>0>i+3>>>0){d=K[i|0]|K[i+1|0]<<8|(K[i+2|0]<<16|K[i+3|0]<<24);i=i+4|0;J[f+12>>2]=i}J[p+52>>2]=d;d=0;yf:{if(c>>>0<=i+3>>>0){b=0;break yf}b=K[i|0]|K[i+
-1|0]<<8|(K[i+2|0]<<16|K[i+3|0]<<24);i=i+4|0;J[f+12>>2]=i}J[p+56>>2]=b;if(c>>>0>i+3>>>0){d=K[i|0]|K[i+1|0]<<8|(K[i+2|0]<<16|K[i+3|0]<<24);J[f+12>>2]=i+4}J[p+60>>2]=d;zf:{Af:{c=J[q>>2]+a|0;d=J[c+12>>2];Bf:{if(d+3>>>0>=M[c+16>>2])break Bf;b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4;if(b>>>0<33)break Bf;d=0;i=J[q>>2];b=i+a|0;c=J[b+12>>2];f=J[b+16>>2];if(f>>>0>c+3>>>0){m=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;i=J[q>>2];b=i+a|0;f=J[b+16>>2];c=J[b+12>>2]}if(c+3>>>
-0>>0){r=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+i|0)+12>>2]=c+4;i=J[q>>2];b=i+a|0;f=J[b+16>>2];c=J[b+12>>2]}if(c+3>>>0>>0){e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+i|0)+12>>2]=c+4;i=J[q>>2];b=i+a|0;f=J[b+16>>2];c=J[b+12>>2]}J[p+40>>2]=0;J[p+44>>2]=0;J[p+32>>2]=0;J[p+36>>2]=0;k=a+i|0;Cf:{if(c+3>>>0>=f>>>0){b=c;break Cf}d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);b=c+4|0;J[k+12>>2]=b}J[p+16>>2]=d;c=0;if(b+3>>>0>>0){g=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<
-24);b=b+4|0;J[k+12>>2]=b}J[p+20>>2]=g;if(b+3>>>0>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+24>>2]=c;if(b+3>>>0>>0){u=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+28>>2]=u;if(b+3>>>0>>0){s=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+32>>2]=s;s=0;Df:{if(b+3>>>0>=f>>>0){u=0;break Df}u=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+36>>2]=u;if(b+3>>>0>>0){s=K[b|0]|K[b+1|0]<<
-8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[p+40>>2]=s;s=0;if(b+3>>>0>>0){s=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[k+12>>2]=b+4}J[p+44>>2]=s;if(!c|((d|0)!=32|(g|0)!=1))break Bf;J[p+12>>2]=0;J[p+4>>2]=0;J[p+8>>2]=0;Ef:{Ff:{if(c>>>0>=268435456){J[195395]=0;ea(2018,p+4|0);a=J[195395];J[195395]=0;if((a|0)==1)break Ff;B()}J[195395]=0;d=c<<4;f=_(1078,d|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break Ef}f=Z()|0;a=J[p+4>>2];if(!a)break Af;J[p+8>>2]=a;Kb(a);break Af}J[p+4>>2]=f;c=d+f|
-0;J[p+12>>2]=c;Nb(f,0,d);J[p+8>>2]=c;while(1){j=J[q>>2]+a|0;d=J[j+12>>2];k=J[j+16>>2];Gf:{if(d+3>>>0>=k>>>0){b=0;break Gf}b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[j+12>>2]=d}J[f>>2]=b;b=0;Hf:{if(k>>>0<=d+3>>>0){g=0;break Hf}g=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[j+12>>2]=d}J[f+4>>2]=g;if(k>>>0>d+3>>>0){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[j+12>>2]=d}J[f+8>>2]=b;b=0;if(k>>>0>d+3>>>0){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[j+12>>
-2]=d+4}J[f+12>>2]=b;f=f+16|0;if((c|0)!=(f|0))continue;break}If:{b=J[a+216>>2];Jf:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break Jf;if(c)break If}J[195395]=0;oa(2021,a|0,p+48|0,m|0,r|0,e|0,p+16|0,p+4|0);b=J[195395];J[195395]=0;if((b|0)!=1)break If}f=Z()|0;a=J[p+4>>2];if(!a)break Af;J[p+8>>2]=a;Kb(a);ba(f|0);B()}b=J[p+4>>2];if(!b)break Bf;J[p+8>>2]=b;Kb(b)}xb=p- -64|0;break zf}ba(f|0);B()}break n;case 117:m=0;p=xb-32|0;xb=p;q=J[a>>2]-12|0;e=J[q>>2];j=e+a|0;f=J[j+12>>2];i=
-J[j+16>>2];g=i>>>0>f+3>>>0;b=f+(g<<2)|0;d=b+3>>>0>>0;b=b+(d<<2)|0;c=b+3>>>0>>0;b=(c<<2)+b|0;k=b+3|0;Kf:{if(!(c|(d|g)))if(i>>>0<=k>>>0)break Kf;J[j+12>>2]=b+((i>>>0>k>>>0)<<2);e=J[q>>2];b=e+a|0;i=J[b+16>>2];f=J[b+12>>2]}g=0;Lf:{if(f+3>>>0>=i>>>0){u=0;break Lf}u=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[(a+e|0)+12>>2]=f+4;e=J[q>>2];b=e+a|0;i=J[b+16>>2];f=J[b+12>>2]}if(f+3>>>0>>0){g=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[(a+e|0)+12>>2]=f+4;e=J[q>>2];b=e+a|0;i=J[b+16>>2];f=J[b+
-12>>2]}if(f+3>>>0>>0){m=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[(a+e|0)+12>>2]=f+4}Mf:{Nf:{Of:{if(!g|u-5>>>0<4294967294)break Of;c=u<<4;b=Pb(c);J[p+20>>2]=b;d=b+c|0;J[p+28>>2]=d;e=0;j=Nb(b,0,c);J[p+24>>2]=d;k=J[q>>2]+a|0;b=J[k+12>>2];f=J[k+16>>2];Pf:{if(b+3>>>0>=f>>>0){c=0;break Pf}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[j>>2]=c;if(f>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[j+4>>2]=e;e=0;Qf:{if(f>>>0<=b+1>>>0){c=
-0;break Qf}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+8>>1]=c;if(f>>>0>b+1>>>0){e=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+10>>1]=e;e=0;Rf:{if(f>>>0<=b+1>>>0){c=0;break Rf}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+12>>1]=c;if(f>>>0>b+1>>>0){e=K[b|0]|K[b+1|0]<<8;J[k+12>>2]=b+2}I[j+14>>1]=e;Sf:{if((d|0)==(j+16|0))break Sf;e=0;k=J[q>>2]+a|0;b=J[k+12>>2];f=J[k+16>>2];Tf:{if(b+3>>>0>=f>>>0){c=0;break Tf}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[j+16>>2]=c;if(f>>>
-0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[j+20>>2]=e;e=0;Uf:{if(f>>>0<=b+1>>>0){c=0;break Uf}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+24>>1]=c;if(f>>>0>b+1>>>0){e=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+26>>1]=e;e=0;Vf:{if(f>>>0<=b+1>>>0){c=0;break Vf}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+28>>1]=c;if(f>>>0>b+1>>>0){e=K[b|0]|K[b+1|0]<<8;J[k+12>>2]=b+2}I[j+30>>1]=e;if((d|0)==(j+32|0))break Sf;e=0;k=J[q>>2]+a|0;b=J[k+12>>2];f=J[k+16>>2];Wf:{if(b+
-3>>>0>=f>>>0){c=0;break Wf}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[j+32>>2]=c;if(f>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b}J[j+36>>2]=e;e=0;Xf:{if(f>>>0<=b+1>>>0){c=0;break Xf}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+40>>1]=c;if(f>>>0>b+1>>>0){e=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+42>>1]=e;e=0;Yf:{if(f>>>0<=b+1>>>0){c=0;break Yf}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[k+12>>2]=b}I[j+44>>1]=c;if(f>>>0>b+1>>>0){e=K[b|0]|
-K[b+1|0]<<8;J[k+12>>2]=b+2}I[j+46>>1]=e;if((d|0)==(j+48|0))break Sf;b=0;f=J[q>>2]+a|0;c=J[f+12>>2];d=J[f+16>>2];Zf:{if(c+3>>>0>=d>>>0){e=0;break Zf}e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[j+48>>2]=e;if(d>>>0>c+3>>>0){b=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c}J[j+52>>2]=b;b=0;_f:{if(d>>>0<=c+1>>>0){e=0;break _f}e=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[f+12>>2]=c}I[j+56>>1]=e;if(d>>>0>c+1>>>0){b=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[f+12>>2]=c}I[j+58>>1]=b;b=
-0;$f:{if(d>>>0<=c+1>>>0){e=0;break $f}e=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[f+12>>2]=c}I[j+60>>1]=e;if(d>>>0>c+1>>>0){b=K[c|0]|K[c+1|0]<<8;J[f+12>>2]=c+2}I[j+62>>1]=b}J[p+16>>2]=0;J[p+8>>2]=0;J[p+12>>2]=0;if(g>>>0>=536870912){J[195395]=0;ea(2022,p+8|0);a=J[195395];J[195395]=0;if((a|0)==1)break Nf;B()}J[195395]=0;c=g<<3;i=_(1078,c|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Nf;J[p+8>>2]=i;j=c+i|0;J[p+16>>2]=j;Nb(i,0,c);J[p+12>>2]=j;k=a+12|0;while(1){b=J[q>>2];d=b+a|0;f=J[d+12>>2];c=J[d+16>>2];ag:{if(c>>>
-0<=f+3>>>0){e=0;break ag}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4;b=J[q>>2];d=b+a|0;c=J[d+16>>2];f=J[d+12>>2]}J[i>>2]=e;e=0;if(f+3>>>0>>0){e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[b+k>>2]=f+4}J[i+4>>2]=e;i=i+8|0;if((j|0)!=(i|0))continue;break}if((u|0)==4){b=J[q>>2]+a|0;c=J[b+12>>2]+(g<<2)|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b}b=J[a+216>>2];bg:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break Nf;if(c)break bg}J[195395]=0;ia(2023,a|
-0,p+20|0,p+8|0,m|0);b=J[195395];J[195395]=0;if((b|0)==1)break Nf}b=J[p+8>>2];if(b){J[p+12>>2]=b;Kb(b)}b=J[p+20>>2];if(!b)break Of;J[p+24>>2]=b;Kb(b)}xb=p+32|0;break Mf}a=Z()|0;b=J[p+8>>2];if(b){J[p+12>>2]=b;Kb(b)}b=J[p+20>>2];if(b){J[p+24>>2]=b;Kb(b)}ba(a|0);B()}break n;case 38:c=0;k=xb-16|0;xb=k;b=Pb(44);J[195395]=0;j=dh(b);d=J[195395];J[195395]=0;cg:{if((d|0)!=1){f=J[a>>2]-12|0;e=J[f>>2];g=e+a|0;b=J[g+12>>2];d=J[g+16>>2];if(d>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>
-2]=b+4;e=J[f>>2];b=e+a|0;d=J[b+16>>2];b=J[b+12>>2]}J[k+12>>2]=c;f=a+e|0;e=0;dg:{if(b+3>>>0>=d>>>0){c=0;break dg}c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b}J[j+8>>2]=c;if(b>>>0>>0){e=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j+12|0]=e;e=0;eg:{if(b>>>0>=d>>>0){c=0;break eg}c=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j+13|0]=c;if(b>>>0>>0){e=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j+14|0]=e;e=0;fg:{if(b>>>0>=d>>>0){c=0;break fg}c=K[b|0];b=b+1|0;J[f+12>>2]=b}H[j+15|0]=c;if(b+3>>>0>>0){e=K[b|0]|K[b+
-1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+12>>2]=b+4}J[j+16>>2]=e;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){c=k+12|0;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+152>>2]](b,c,j);ef(a+124|0,J[c>>2],j)}xb=k+16|0;break cg}break f}break n;case 93:e=0;d=0;k=xb-32|0;xb=k;c=J[a>>2]-12|0;i=J[c>>2];g=i+a|0;b=J[g+12>>2];f=J[g+16>>2];if(f>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4;i=J[c>>2];b=i+a|0;f=J[b+16>>2];b=J[b+12>>2]}J[k+28>>2]=d;c=a+i|0;if(b+3>>>0>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<
-16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+8>>2]=e;e=0;gg:{if(b+3>>>0>=f>>>0){i=0;break gg}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+12>>2]=i;if(b+3>>>0>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+16>>2]=e;e=0;hg:{if(b+3>>>0>=f>>>0){i=0;break hg}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+20>>2]=i;if(b+3>>>0>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[c+12>>2]=b+4}J[k+24>>2]=e;b=J[a+216>>
-2];if(!(K[b+213|0]?b:0)){d=k+28|0;c=k+8|0;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+272>>2]](b,d,c,(J[J[a>>2]-12>>2]+a|0)+4|0);$A(a,c,J[d>>2])}xb=k+32|0;break n;case 92:e=0;d=0;k=xb-32|0;xb=k;c=J[a>>2]-12|0;i=J[c>>2];g=i+a|0;b=J[g+12>>2];f=J[g+16>>2];if(f>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4;i=J[c>>2];b=i+a|0;f=J[b+16>>2];b=J[b+12>>2]}J[k+28>>2]=d;c=a+i|0;if(b+3>>>0>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+8>>2]=e;e=0;ig:{if(b+
-3>>>0>=f>>>0){i=0;break ig}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+12>>2]=i;if(b+3>>>0>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+16>>2]=e;e=0;jg:{if(b+3>>>0>=f>>>0){i=0;break jg}i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[c+12>>2]=b}J[k+20>>2]=i;if(b+3>>>0>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[c+12>>2]=b+4}J[k+24>>2]=e;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){d=k+28|0;c=k+8|0;b=J[a+208>>2];if(b)Ab[J[J[b>>
-2]+268>>2]](b,d,c,(J[J[a>>2]-12>>2]+a|0)+4|0);$A(a,c,J[d>>2])}xb=k+32|0;break n;case 48:c=0;k=xb-16|0;xb=k;e=Pb(12);J[195395]=0;J[e+8>>2]=0;I[e+4>>1]=0;J[e>>2]=415752;b=e;d=J[195395];J[195395]=0;kg:{if((d|0)!=1){d=J[a>>2]-12|0;e=J[d>>2];f=e+a|0;g=J[f+12>>2];if(g+3>>>0>2]){c=K[g|0]|K[g+1|0]<<8|(K[g+2|0]<<16|K[g+3|0]<<24);J[f+12>>2]=g+4;e=J[d>>2]}J[k+12>>2]=c;g=0;e=a+e|0;c=J[e+16>>2];d=J[e+12>>2];if(c>>>0>d+1>>>0){d=d+2|0;J[e+12>>2]=d}lg:{mg:{if(c>>>0<=d+1>>>0){I[b+4>>1]=0;break mg}c=K[d|0]|
-K[d+1|0]<<8;J[e+12>>2]=d+2;I[b+4>>1]=c;if(!c)break mg;S=b,T=Pb(c<<2),J[S+8>>2]=T;while(1){f=J[b+8>>2]+(g<<2)|0;d=0;c=J[e+12>>2];if(c>>>0>2]){d=K[c|0];J[e+12>>2]=c+1}H[f|0]=d;d=0;s=0;c=J[e+12>>2];if(c>>>0>2]){s=K[c|0];J[e+12>>2]=c+1}H[f+1|0]=s;c=J[e+12>>2];if(c>>>0>2]){d=K[c|0];J[e+12>>2]=c+1}H[f+2|0]=d;d=0;c=J[e+12>>2];if(c>>>0>2]){d=K[c|0];J[e+12>>2]=c+1}H[f+3|0]=d;g=g+1|0;if(g>>>0>1])continue;break}break lg}J[b+8>>2]=0}c=J[a+216>>2];if(!(K[c+213|0]?c:0)){d=
-k+12|0;c=J[a+208>>2];if(c)Ab[J[J[c>>2]+300>>2]](c,d,b);ef(a+124|0,J[d>>2],b)}xb=k+16|0;break kg}break e}break n;case 37:b=0;k=xb-16|0;xb=k;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[k+12>>2]=b;b=Pb(28);J[195395]=0;j=Vj(b);c=J[195395];J[195395]=0;ng:{if((c|0)!=1){e=0;b=0;g=J[a>>2]-12|0;c=J[g>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[j+8>>2]=b;c=J[g>>
-2];d=c+a|0;b=J[d+12>>2];f=J[d+16>>2];if(f>>>0>b+3>>>0){e=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[d+12>>2]=b+4;c=J[g>>2];b=c+a|0;f=J[b+16>>2];b=J[b+12>>2]}J[k+8>>2]=e;if(b+3>>>0>>0){J[(a+c|0)+12>>2]=b+4;c=J[g>>2];b=c+a|0;f=J[b+16>>2];b=J[b+12>>2]}d=a+c|0;c=0;og:{if(b>>>0>=f>>>0){e=0;break og}e=K[b|0];b=b+1|0;J[d+12>>2]=b}H[j+16|0]=e;if(b>>>0>>0){c=K[b|0];b=b+1|0;J[d+12>>2]=b}H[j+17|0]=c;c=0;pg:{if(b>>>0>=f>>>0){e=0;break pg}e=K[b|0];b=b+1|0;J[d+12>>2]=b}H[j+18|0]=e;if(b>>>0>>0){c=
-K[b|0];J[d+12>>2]=b+1}H[j+19|0]=c;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){d=k+12|0;c=k+8|0;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+188>>2]](b,d,c,j);J[j+12>>2]=J[c>>2];ef(a+124|0,J[d>>2],j)}xb=k+16|0;break ng}break f}break n;case 81:c=0;m=xb-16|0;xb=m;b=J[a+116>>2];e=Pb(372);J[195395]=0;H[e+368|0]=b-4>>>0<321;J[e+4>>2]=415608;J[e>>2]=415552;J[e+364>>2]=0;b=e;d=J[195395];J[195395]=0;qg:{if((d|0)!=1){d=J[a>>2]-12|0;e=J[d>>2];f=e+a|0;g=J[f+12>>2];if(g+3>>>0>2]){c=K[g|0]|K[g+1|0]<<8|(K[g+2|0]<<16|K[g+3|0]<<
-24);J[f+12>>2]=g+4;e=J[d>>2]}J[m+12>>2]=c;r=(a+e|0)+4|0;i=0;u=0;e=0;q=b+8|0;rg:{if(K[b+368|0]){cB(r,q);j=J[r+12>>2];d=J[r+8>>2];f=j-d|0;if(f+1>>>0<3)break rg;k=b+100|0;c=(f|0)/2|0;c=c>>>0>=64?64:c;g=c&1;sg:{if((f&-2)==2)break sg;f=c&126;while(1){tg:{if(j>>>0<=d+1>>>0){c=0;break tg}c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+(i<<1)>>1]=c;c=0;if(j>>>0>d+1>>>0){c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+((i|1)<<1)>>1]=c;i=i+2|0;e=e+2|0;if((f|0)!=(e|0))continue;break}}if(g){c=0;if(j>>>0>d+1>>>0){c=
-K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+(i<<1)>>1]=c}f=j-d|0;if(f+1>>>0<3)break rg;k=b+228|0;c=(f|0)/2|0;c=c>>>0>=32?32:c;g=c&1;ug:{if((f&-2)==2){i=0;break ug}f=c&62;i=0;e=0;while(1){vg:{if(j>>>0<=d+1>>>0){c=0;break vg}c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+(i<<1)>>1]=c;c=0;if(j>>>0>d+1>>>0){c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+((i|1)<<1)>>1]=c;i=i+2|0;e=e+2|0;if((f|0)!=(e|0))continue;break}}if(g){c=0;if(j>>>0>d+1>>>0){c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+(i<<1)>>1]=c}f=j-
-d|0;if(f+1>>>0<3)break rg;k=b+292|0;c=(f|0)/2|0;c=c>>>0>=18?18:c;g=c&1;i=0;if((f&-2)!=2){f=c&30;e=0;while(1){wg:{if(j>>>0<=d+1>>>0){c=0;break wg}c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+(i<<1)>>1]=c;c=0;if(j>>>0>d+1>>>0){c=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[r+8>>2]=d}I[k+((i|1)<<1)>>1]=c;i=i+2|0;e=e+2|0;if((f|0)!=(e|0))continue;break}}if(!g)break rg;c=0;if(j>>>0>d+1>>>0){c=K[d|0]|K[d+1|0]<<8;J[r+8>>2]=d+2}I[k+(i<<1)>>1]=c;break rg}cB(r,q);p=J[r+12>>2];c=J[r+8>>2];f=p-c|0;d=(f|0)/2|0;xg:{if(f+1>>>0<
-3)break xg;j=q+92|0;d=d>>>0>=64?64:d;k=d&1;yg:{if((f&-2)==2){g=0;break yg}f=d&126;g=0;while(1){zg:{if(p>>>0<=c+1>>>0){d=0;break zg}d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+(g<<1)>>1]=d;d=0;if(p>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+((g|1)<<1)>>1]=d;g=g+2|0;u=u+2|0;if((f|0)!=(u|0))continue;break}}if(k){d=0;if(p>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+(g<<1)>>1]=d}f=p-c|0;if(f+1>>>0<3)break xg;j=q+220|0;d=(f|0)/2|0;d=d>>>0>=32?32:d;k=d&1;Ag:{if((f&-2)==2){g=
-0;break Ag}f=d&62;g=0;u=0;while(1){Bg:{if(p>>>0<=c+1>>>0){d=0;break Bg}d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+(g<<1)>>1]=d;d=0;if(p>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+((g|1)<<1)>>1]=d;g=g+2|0;u=u+2|0;if((f|0)!=(u|0))continue;break}}if(k){d=0;if(p>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+(g<<1)>>1]=d}f=p-c|0;if(f+1>>>0<3)break xg;j=q+284|0;d=(f|0)/2|0;d=d>>>0>=32?32:d;k=d&1;g=0;if((f&-2)!=2){f=d&62;u=0;while(1){Cg:{if(p>>>0<=c+1>>>0){d=0;break Cg}d=K[c|
-0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+(g<<1)>>1]=d;d=0;if(p>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;c=c+2|0;J[r+8>>2]=c}I[j+((g|1)<<1)>>1]=d;g=g+2|0;u=u+2|0;if((f|0)!=(u|0))continue;break}}if(!k)break xg;d=0;if(p>>>0>c+1>>>0){d=K[c|0]|K[c+1|0]<<8;J[r+8>>2]=c+2}I[j+(g<<1)>>1]=d}q=J[r+12>>2];d=J[r+8>>2];if(q>>>0>d+3>>>0){i=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[r+8>>2]=d}J[b+356>>2]=i;if(q>>>0<=d+3>>>0){J[b+360>>2]=0;J[b+364>>2]=0;break rg}p=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);
-d=d+4|0;J[r+8>>2]=d;J[b+364>>2]=0;J[b+360>>2]=p;if((i|0)!=134248036|p-17>>>0<4294967280)break rg;j=Pb(p<<2);J[b+364>>2]=j;i=0;if((p|0)!=1){k=p&-2;while(1){g=i<<2;f=g+j|0;Dg:{if(q>>>0<=d+3>>>0){c=0;break Dg}c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[r+8>>2]=d}J[f>>2]=c;c=0;if(q>>>0>d+3>>>0){c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[r+8>>2]=d}J[j+(g|4)>>2]=c;i=i+2|0;e=e+2|0;if((k|0)!=(e|0))continue;break}}if(!(p&1))break rg;c=j+(i<<2)|0;i=0;if(q>>>0>d+3>>>0){i=K[d|0]|
-K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[r+8>>2]=d+4}J[c>>2]=i}c=J[a+216>>2];if(!(K[c+213|0]?c:0)){d=m+12|0;c=J[a+208>>2];if(c)Ab[J[J[c>>2]+164>>2]](c,d,b);ef(a+124|0,J[d>>2],b)}xb=m+16|0;break qg}break e}break n;case 94:f=0;y=xb-16|0;xb=y;g=J[a>>2]-12|0;e=J[g>>2];d=e+a|0;c=J[d+12>>2];b=J[d+16>>2];if(b>>>0>c+3>>>0){f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[d+12>>2]=c+4;e=J[g>>2];c=e+a|0;b=J[c+16>>2];c=J[c+12>>2]}J[y+12>>2]=f;c=c+4|0;J[(a+e|0)+12>>2]=b>>>0>c>>>0?c:b;b=J[g>>2]+a|0;c=J[b+12>>
-2]+4|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;b=J[g>>2]+a|0;c=J[b+12>>2]+4|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;b=J[g>>2]+a|0;c=J[b+12>>2]+4|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;k=J[a+116>>2];b=Pb(28);J[195395]=0;i=Vj(b);c=J[195395];J[195395]=0;if((c|0)==1)break f;g=Pb(8);J[y>>2]=g;b=g+8|0;J[y+8>>2]=b;J[g>>2]=0;J[g+4>>2]=0;J[y+4>>2]=b;c=0;b=0;s=J[a>>2]-12|0;d=J[s>>2]+a|0;f=J[d+12>>2];if(f+3>>>0>2]){b=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[i+
-8>>2]=b;b=J[s>>2]+a|0;d=J[b+12>>2];if(d+3>>>0>2]){c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[b+12>>2]=d+4}J[i+12>>2]=c;b=0;c=0;d=J[s>>2]+a|0;f=J[d+12>>2];if(f+3>>>0>2]){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[g>>2]=c;d=J[s>>2]+a|0;e=J[d+12>>2];c=J[d+16>>2];if(e>>>0>>0){b=K[e|0];e=e+1|0;J[d+12>>2]=e}H[i+16|0]=b;b=0;Eg:{if(c>>>0<=e>>>0){f=0;break Eg}f=K[e|0];e=e+1|0;J[d+12>>2]=e}H[i+17|0]=f;if(c>>>0>e>>>0){b=K[e|0];e=e+1|0;J[d+12>>2]=e}H[i+18|0]=
-b;b=0;f=0;if(c>>>0>e>>>0){f=K[e|0];J[d+12>>2]=e+1}H[i+19|0]=f;c=J[s>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[g+4>>2]=b;Fg:{Gg:{Hg:{Ig:{b=J[s>>2]+a|0;c=J[b+12>>2];if(c+3>>>0>=M[b+16>>2]){J[i+20>>2]=0;u=k-44|0;break Ig}r=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;J[i+20>>2]=r;u=k-44|0;if(!r)break Ig;c=0;J[195395]=0;j=r<<2;q=_(1109,(r>>>0>1073741823?-1:j)|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Gg;J[i+24>>
-2]=q;if((r|0)!=1){k=r&-2;f=0;while(1){e=c<<2;d=q+e|0;b=0;m=J[s>>2]+a|0;p=J[m+12>>2];if(p+3>>>0>2]){b=K[p|0]|K[p+1|0]<<8|(K[p+2|0]<<16|K[p+3|0]<<24);J[m+12>>2]=p+4}J[d>>2]=b;b=0;d=J[s>>2]+a|0;m=J[d+12>>2];if(m+3>>>0>2]){b=K[m|0]|K[m+1|0]<<8|(K[m+2|0]<<16|K[m+3|0]<<24);J[d+12>>2]=m+4}J[q+(e|4)>>2]=b;c=c+2|0;f=f+2|0;if((k|0)!=(f|0))continue;break}}u=u-j|0;if(!(r&1))break Hg;b=q+(c<<2)|0;c=0;d=J[s>>2]+a|0;f=J[d+12>>2];if(f+3>>>0>2]){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<
-24);J[d+12>>2]=f+4}J[b>>2]=c;break Hg}J[i+24>>2]=0}b=J[s>>2]+a|0;c=J[b+12>>2]+u|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;b=J[a+216>>2];Jg:{Kg:{if(b){J[195395]=0;c=K[b+213|0];b=J[195395];J[195395]=0;if((b|0)==1)break Gg;if(c)break Kg}J[195395]=0;ia(2028,a|0,y+12|0,i|0,y|0);b=J[195395];J[195395]=0;if((b|0)==1)break Gg;g=J[y>>2];if(!g)break Jg}J[y+4>>2]=g;Kb(g)}xb=y+16|0;break Fg}a=Z()|0;b=J[y>>2];if(b){J[y+4>>2]=b;Kb(b)}ba(a|0);B()}break n;case 36:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>
-0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+160>>2]](b,h);mA(a+124|0,J[h>>2]);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 39:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+176>>2]](b,h);jA(a+124|0,J[h>>2]);b=J[a+
-208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 47:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+304>>2]](b,h);e=a+124|0;g=J[h>>2];if((g|0)==-2147483633)J[J[e>>2]+404>>2]=0;c=e+24|0;d=J[c>>2];Lg:{if(!d)break Lg;b=c;while(1){f=g>>>0>M[d+16>>2];b=f?b:d;d=J[(f?d+4|0:d)>>2];if(d)continue;break}if((b|0)==(c|0)|g>>>0>2])break Lg;b=J[b+
-20>>2];if((Ab[J[J[b>>2]+8>>2]](b)|0)!=4)break Lg;J[J[e>>2]+404>>2]=b}break n;case 58:b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+156>>2];if(b)Kb(qd(b));b=J[a+208>>2];if(b)Ab[J[J[b>>2]+196>>2]](b);b=Pb(12);J[195395]=0;J[b+8>>2]=0;J[b>>2]=0;J[b+4>>2]=0;c=J[195395];J[195395]=0;Mg:{if((c|0)!=1){J[a+156>>2]=b;b=J[a+120>>2];le(J[a+156>>2],+J[b+680>>2],+J[b+684>>2]);break Mg}break f}break n;case 59:b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+200>>2]](b);break n;case 60:b=J[a+
-216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+204>>2]](b);b=J[a+156>>2];Ng:{if(!b)break Ng;if(Kf(b))break Ng;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1}break n;case 64:b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+208>>2]](b);break n;case 65:b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+212>>2]](b);break n;case 67:b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+216>>2]](b);b=J[a+156>>2];if(b){Kb(qd(b));J[a+156>>
-2]=0}break n;case 26:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];Og:{if(f+3>>>0>=b>>>0){e=0;break Og}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>2]=e;if(b>>>0>f+3>>>0){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+220>>2]](b,h);d=J[h+4>>2];n=+(d|0);c=J[h>>2];l=+(c|0);b=J[a+156>>2];Pg:{Qg:{if(b){if(le(b,l,n))break Qg;H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Pg}b=
-J[a+208>>2];if(!b)break Qg;Ab[J[J[b>>2]+32>>2]](b,l,n)}b=J[a+120>>2];J[b+680>>2]=c;J[b+684>>2]=d}break n;case 56:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+224>>2]](b,h);J[J[a+120>>2]+688>>2]=J[h>>2];break n;case 32:b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+136>>2]](b);lA(a+124|0,-1);b=J[a+208>>2];if(b)Ab[J[J[b>>
-2]+84>>2]](b);break n;case 33:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+140>>2]](b,h);b=J[h>>2];Rg:{if((b|0)>=0){H[(J[J[a>>2]-12>>2]+a|0)+33|0]=1;break Rg}kA(a+124|0,b);J[a+120>>2]=J[a+124>>2];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b)}break n;case 23:H[h|0]=0;H[h+1|0]=0;H[h+2|0]=0;H[h+3|0]=0;e=0;d=J[J[a>>2]-12>>2]+a|0;c=J[d+12>>2];
-b=J[d+16>>2];Sg:{if(c>>>0>=b>>>0){i=0;break Sg}i=K[c|0];c=c+1|0;J[d+12>>2]=c}H[h|0]=i;if(b>>>0>c>>>0){e=K[c|0];c=c+1|0;J[d+12>>2]=c}H[h+1|0]=e;e=0;Tg:{if(b>>>0<=c>>>0){i=0;break Tg}i=K[c|0];c=c+1|0;J[d+12>>2]=c}H[h+2|0]=i;if(b>>>0>c>>>0){e=K[c|0];J[d+12>>2]=c+1}H[h+3|0]=e;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+156>>2]](b,h);b=J[a+120>>2];H[b+600|0]=K[h|0];H[b+601|0]=K[h+1|0];H[b+602|0]=K[h+2|0];H[b+603|0]=K[h+3|0];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;
-case 21:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+168>>2]](b,h);J[J[a+120>>2]+608>>2]=J[h>>2];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 17:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+
-208>>2];if(b)Ab[J[J[b>>2]+172>>2]](b,h);J[J[a+120>>2]+612>>2]=J[h>>2];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 57:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+180>>2]](b,h);J[J[a+120>>2]+616>>2]=J[h>>2];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 18:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=
-K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+192>>2]](b,h);J[J[a+120>>2]+620>>2]=J[h>>2];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 16:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+232>>2]](b,h);g=J[a+120>>2];b=J[h>>2];J[g+16>>
-2]=b;Ug:{Vg:switch(b-1|0){case 0:J[g+640>>2]=0;J[g+644>>2]=1072693248;J[g+632>>2]=0;J[g+636>>2]=1072693248;break Ug;case 1:J[g+640>>2]=-1860025207;J[g+644>>2]=1070736456;J[g+632>>2]=-1860025207;J[g+636>>2]=1070736456;break Ug;case 2:J[g+640>>2]=-2117046872;J[g+644>>2]=1067255514;J[g+632>>2]=-2117046872;J[g+636>>2]=1067255514;break Ug;case 3:J[g+640>>2]=1889785610;J[g+644>>2]=1072106045;J[g+632>>2]=1889785610;J[g+636>>2]=1072106045;break Ug;case 4:J[g+640>>2]=-1924145348;J[g+644>>2]=1068658327;J[g+
-632>>2]=-1924145348;J[g+636>>2]=1068658327;break Ug;case 5:J[g+640>>2]=-1717986918;J[g+644>>2]=1068079513;J[g+632>>2]=-1717986918;J[g+636>>2]=1068079513;break Ug;case 6:case 7:break Vg;default:break Ug}f=J[g+656>>2];if((f|0)<2)break Ug;d=J[g+672>>2];if((d|0)<2)break Ug;Wg:switch(b-7|0){case 0:l=+(d|0)/+(f|0);O[g+632>>3]=l;O[g+640>>3]=l;break Ug;case 1:break Wg;default:break Ug}c=J[g+660>>2];if(!c)break Ug;b=J[g+676>>2];if(!b)break Ug;O[g+640>>3]=+(b|0)/+(c|0);O[g+632>>3]=+(d|0)/+(f|0)}Yf(g);break n;
-case 9:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];Xg:{if(f+3>>>0>=b>>>0){e=0;break Xg}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>2]=e;if(b>>>0>f+3>>>0){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+236>>2]](b,h);g=J[a+120>>2];J[g+648>>2]=J[h>>2];J[g+652>>2]=J[h+4>>2];f=J[g+656>>2];Yg:{if((f|0)<2)break Yg;d=J[g+672>>2];if((d|0)<2)break Yg;Zg:switch(J[g+16>>
-2]-7|0){case 0:l=+(d|0)/+(f|0);O[g+632>>3]=l;O[g+640>>3]=l;break Yg;case 1:break Zg;default:break Yg}c=J[g+660>>2];if(!c)break Yg;b=J[g+676>>2];if(!b)break Yg;O[g+640>>3]=+(b|0)/+(c|0);O[g+632>>3]=+(d|0)/+(f|0)}Yf(g);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 8:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];_g:{if(f+3>>>0>=b>>>0){e=0;break _g}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>2]=e;if(b>>>0>f+3>>>0){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+
-3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+240>>2]](b,h);c=J[a+120>>2];b=J[c+16>>2];$g:{if((b|0)!=7&(b|0)!=8)break $g;iA(c,h);b=J[a+208>>2];if(!b)break $g;Ab[J[J[b>>2]+84>>2]](b)}break n;case 31:d=0;i=0;s=0;k=J[a>>2]-12|0;c=J[k>>2];f=c+a|0;b=J[f+12>>2];e=J[f+16>>2];if(e>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+12>>2]=b+4;c=J[k>>2];b=c+a|0;e=J[b+16>>2];b=J[b+12>>2]}g=0;if(b+3>>>0>>0){d=K[b|0]|K[b+1|0]<<8|
-(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+c|0)+12>>2]=b+4;c=J[k>>2];b=c+a|0;e=J[b+16>>2];b=J[b+12>>2]}if(b+3>>>0>>0){s=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+c|0)+12>>2]=b+4;c=J[k>>2];b=c+a|0;e=J[b+16>>2];b=J[b+12>>2]}if(b+3>>>0>>0){g=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+c|0)+12>>2]=b+4}b=J[a+216>>2];if(!(K[b+213|0]?b:0)){b=J[a+208>>2];if(b)Ab[J[J[b>>2]+244>>2]](b,i,d,s,g);b=J[a+120>>2];c=J[b+16>>2];ah:{if((c|0)!=7&(c|0)!=8)break ah;n=+(s|0)/+(g|0);l=+J[b+656>>2]*(+(i|0)/
-+(d|0));bh:{if(R(l)<2147483648){d=~~l;break bh}d=-2147483648}J[b+656>>2]=d;l=+J[b+660>>2]*n;ch:{if(R(l)<2147483648){c=~~l;break ch}c=-2147483648}J[b+660>>2]=c;e=J[b+16>>2];dh:{if((e|0)!=7)break dh;g=J[b+672>>2];n=+(g|0);t=R(n/+(d|0));f=J[b+676>>2];l=+(f|0);o=R(l/+(c|0));if(t>o){f=g>>31|1;l=V(o*n/t+.5);eh:{if(R(l)<2147483648){g=~~l;break eh}g=-2147483648}J[b+672>>2]=g?g:f;break dh}f=f>>31|1;l=V(t*l/o+.5);fh:{if(R(l)<2147483648){g=~~l;break fh}g=-2147483648}J[b+676>>2]=g?g:f}gh:{if((d|0)<2)break gh;
-g=J[b+672>>2];if((g|0)<2)break gh;hh:switch(e-7|0){case 0:l=+(g|0)/+(d|0);O[b+632>>3]=l;O[b+640>>3]=l;break gh;case 1:break hh;default:break gh}if(!c)break gh;f=J[b+676>>2];if(!f)break gh;O[b+640>>3]=+(f|0)/+(c|0);O[b+632>>3]=+(g|0)/+(d|0)}Yf(b);b=J[a+208>>2];if(!b)break ah;Ab[J[J[b>>2]+84>>2]](b)}}break n;case 11:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];ih:{if(f+3>>>0>=b>>>0){e=0;break ih}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>2]=e;if(b>>>0>f+3>>>0){c=
-K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+248>>2]](b,h);g=J[a+120>>2];J[g+664>>2]=J[h>>2];J[g+668>>2]=J[h+4>>2];f=J[g+656>>2];jh:{if((f|0)<2)break jh;d=J[g+672>>2];if((d|0)<2)break jh;kh:switch(J[g+16>>2]-7|0){case 0:l=+(d|0)/+(f|0);O[g+632>>3]=l;O[g+640>>3]=l;break jh;case 1:break kh;default:break jh}c=J[g+660>>2];if(!c)break jh;b=J[g+676>>2];if(!b)break jh;O[g+640>>3]=+(b|0)/+(c|0);O[g+632>>3]=
-+(d|0)/+(f|0)}Yf(g);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 10:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];lh:{if(f+3>>>0>=b>>>0){e=0;break lh}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>2]=e;if(b>>>0>f+3>>>0){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+252>>2]](b,h);c=J[a+120>>2];b=J[c+16>>2];mh:{if((b|0)!=7&(b|0)!=8)break mh;hA(c,h);b=J[a+
-208>>2];if(!b)break mh;Ab[J[J[b>>2]+84>>2]](b)}break n;case 30:d=0;i=0;s=0;k=J[a>>2]-12|0;c=J[k>>2];f=c+a|0;b=J[f+12>>2];e=J[f+16>>2];if(e>>>0>b+3>>>0){i=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+12>>2]=b+4;c=J[k>>2];b=c+a|0;e=J[b+16>>2];b=J[b+12>>2]}g=0;if(b+3>>>0>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+c|0)+12>>2]=b+4;c=J[k>>2];b=c+a|0;e=J[b+16>>2];b=J[b+12>>2]}if(b+3>>>0>>0){s=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+c|0)+12>>2]=b+4;c=J[k>>2];b=c+a|0;
-e=J[b+16>>2];b=J[b+12>>2]}if(b+3>>>0>>0){g=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[(a+c|0)+12>>2]=b+4}b=J[a+216>>2];if(!(K[b+213|0]?b:0)){b=J[a+208>>2];if(b)Ab[J[J[b>>2]+256>>2]](b,i,d,s,g);b=J[a+120>>2];c=J[b+16>>2];nh:{if((c|0)!=7&(c|0)!=8)break nh;n=+(s|0)/+(g|0);l=+J[b+672>>2]*(+(i|0)/+(d|0));oh:{if(R(l)<2147483648){c=~~l;break oh}c=-2147483648}J[b+672>>2]=c;l=+J[b+676>>2]*n;ph:{if(R(l)<2147483648){d=~~l;break ph}d=-2147483648}J[b+676>>2]=d;g=J[b+16>>2];qh:{if((g|0)!=7){f=J[b+656>>
-2];break qh}n=+(c|0);f=J[b+656>>2];t=R(n/+(f|0));l=+(d|0);o=R(l/+J[b+660>>2]);if(t>o){c=c>>31|1;l=V(o*n/t+.5);rh:{if(R(l)<2147483648){e=~~l;break rh}e=-2147483648}c=e?e:c;J[b+672>>2]=c;break qh}d=d>>31|1;l=V(t*l/o+.5);sh:{if(R(l)<2147483648){e=~~l;break sh}e=-2147483648}d=e?e:d;J[b+676>>2]=d}th:{if((f|0)<2|(c|0)<2)break th;uh:switch(g-7|0){case 0:l=+(c|0)/+(f|0);O[b+632>>3]=l;O[b+640>>3]=l;break th;case 1:break uh;default:break th}g=J[b+660>>2];if(!g|!d)break th;O[b+640>>3]=+(d|0)/+(g|0);O[b+632>>
-3]=+(c|0)/+(f|0)}Yf(b);b=J[a+208>>2];if(!b)break nh;Ab[J[J[b>>2]+84>>2]](b)}}break n;case 24:H[h|0]=0;H[h+1|0]=0;H[h+2|0]=0;H[h+3|0]=0;e=0;d=J[J[a>>2]-12>>2]+a|0;c=J[d+12>>2];b=J[d+16>>2];vh:{if(c>>>0>=b>>>0){i=0;break vh}i=K[c|0];c=c+1|0;J[d+12>>2]=c}H[h|0]=i;if(b>>>0>c>>>0){e=K[c|0];c=c+1|0;J[d+12>>2]=c}H[h+1|0]=e;e=0;wh:{if(b>>>0<=c>>>0){i=0;break wh}i=K[c|0];c=c+1|0;J[d+12>>2]=c}H[h+2|0]=i;if(b>>>0>c>>>0){e=K[c|0];J[d+12>>2]=c+1}H[h+3|0]=e;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];
-if(b)Ab[J[J[b>>2]+280>>2]](b,h);b=J[a+120>>2];H[b+604|0]=K[h|0];H[b+605|0]=K[h+1|0];H[b+606|0]=K[h+2|0];H[b+607|0]=K[h+3|0];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 20:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+260>>2]](b,h);J[J[a+120>>2]+624>>2]=J[h>>2];break n;case 97:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>
-0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+264>>2]](b,h);break n;case 19:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+296>>2]](b,h);J[J[a+120>>2]+628>>2]=J[h>>2];b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);break n;case 51:b=
-J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+308>>2]](b);break n;case 114:b=0;c=J[J[a>>2]-12>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>2]){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4}J[h>>2]=b;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+316>>2]](b,h);break n;case 12:c=0;d=J[J[a>>2]-12>>2]+a|0;f=J[d+12>>2];b=J[d+16>>2];xh:{if(f+3>>>0>=b>>>0){e=0;break xh}e=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);f=f+4|0;J[d+12>>2]=f}J[h>>
-2]=e;if(b>>>0>f+3>>>0){c=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[h+4>>2]=c;b=J[a+216>>2];if(K[b+213|0]?b:0)break n;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+320>>2]](b,h);break n;case 34:c=xb-48|0;xb=c;J[c+8>>2]=0;J[c+12>>2]=0;J[c>>2]=0;J[c+4>>2]=1072693248;J[c+32>>2]=0;J[c+36>>2]=0;J[c+24>>2]=0;J[c+28>>2]=1072693248;J[c+16>>2]=0;J[c+20>>2]=0;J[c+40>>2]=0;J[c+44>>2]=0;g=J[J[a>>2]-12>>2]+a|0;b=J[g+12>>2];f=J[g+16>>2];if(b+3>>>0>=f>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|
-0]<<24);b=b+4|0;J[g+12>>2]=b;o=+(x(2,d),C())}O[c>>3]=o;if(f>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b;o=+(x(2,d),C())}else o=0;O[c+8>>3]=o;if(f>>>0<=b+3>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b;o=+(x(2,d),C())}O[c+16>>3]=o;if(f>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[g+12>>2]=b;o=+(x(2,d),C())}else o=0;O[c+24>>3]=o;if(f>>>0<=b+3>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<
-24);b=b+4|0;J[g+12>>2]=b;o=+(x(2,d),C())}O[c+32>>3]=o;if(f>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[g+12>>2]=b+4;o=+(x(2,d),C())}else o=0;O[c+40>>3]=o;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){b=J[a+208>>2];if(b)Ab[J[J[b>>2]+148>>2]](b,c);Qh(J[a+120>>2],c,4);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b)}xb=c+48|0;break n;case 35:g=xb+-64|0;xb=g;c=g+16|0;J[c+8>>2]=0;J[c+12>>2]=0;J[c>>2]=0;J[c+4>>2]=1072693248;J[c+32>>2]=0;J[c+36>>2]=0;J[c+24>>2]=0;J[c+28>>2]=1072693248;J[c+16>>2]=0;J[c+
-20>>2]=0;J[c+40>>2]=0;J[c+44>>2]=0;f=J[a>>2]-12|0;k=J[f>>2]+a|0;b=J[k+12>>2];e=J[k+16>>2];if(b+3>>>0>=e>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b;o=+(x(2,d),C())}O[c>>3]=o;if(e>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b;o=+(x(2,d),C())}else o=0;O[c+8>>3]=o;if(e>>>0<=b+3>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b;o=+(x(2,d),C())}O[c+16>>3]=o;if(e>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<
-8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b;o=+(x(2,d),C())}else o=0;O[c+24>>3]=o;if(e>>>0<=b+3>>>0)o=0;else{d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[k+12>>2]=b;o=+(x(2,d),C())}O[c+32>>3]=o;if(e>>>0>b+3>>>0){d=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[k+12>>2]=b+4;o=+(x(2,d),C())}else o=0;O[c+40>>3]=o;b=0;d=J[f>>2]+a|0;f=J[d+12>>2];if(f+3>>>0>2]){b=K[f|0]|K[f+1|0]<<8|(K[f+2|0]<<16|K[f+3|0]<<24);J[d+12>>2]=f+4}J[g+12>>2]=b;b=J[a+216>>2];if(!(K[b+213|0]?b:0)){d=
-g+12|0;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+144>>2]](b,c,d);Qh(J[a+120>>2],c,J[d>>2]);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b)}xb=g- -64|0;break n;case 69:i=xb-464|0;xb=i;e=J[a>>2];f=e-12|0;b=J[f>>2]+a|0;c=J[b+12>>2]+4|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;b=J[f>>2]+a|0;c=J[b+12>>2];H[i+463|0]=4;d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);H[i+456|0]=0;J[i+452>>2]=d;g=b;c=c+4|0;b=J[b+16>>2];J[g+12>>2]=b>>>0>c>>>0?c:b;yh:{zh:{Ah:{Bh:{Ch:{Dh:{Eh:{Fh:{if((d|0)!=1128875079){if((d|0)!=726027589)break yh;
-d=J[a+208>>2];if(!d)break yh;c=J[a+216>>2];if(!c){J[195395]=0;f=_(1078,280)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Fh;J[195395]=0;c=aa(2029,f|0,d|0,a+4|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Eh;J[a+216>>2]=c;e=J[a>>2];J[(J[J[c>>2]-12>>2]+c|0)+24>>2]=J[(J[e-12>>2]+a|0)+24>>2]}d=J[(J[e-12>>2]+a|0)+12>>2];b=J[a+116>>2];J[195395]=0;ol(c,d,b-8|0);b=J[195395];J[195395]=0;if((b|0)==1)break Fh;c=J[a+208>>2];b=J[J[c>>2]+104>>2];J[195395]=0;ea(b|0,c|0);b=J[195395];J[195395]=0;if((b|0)==1)break Fh;
-c=J[a+216>>2];b=J[J[c>>2]+16>>2];J[195395]=0;ea(b|0,c|0);b=J[195395];J[195395]=0;if((b|0)==1)break Fh;c=J[a+208>>2];b=J[J[c>>2]+104>>2];J[195395]=0;ea(b|0,c|0);b=J[195395];J[195395]=0;if((b|0)==1)break Fh;b=J[J[a>>2]-12>>2]+a|0;c=(J[b+12>>2]+J[a+116>>2]|0)-8|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;break yh}c=J[f>>2]+a|0;d=J[c+12>>2];if(d+3>>>0>=M[c+16>>2])break yh;b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[c+12>>2]=d+4;if((b|0)!=-2147483647)break yh;b=J[f>>2]+a|0;c=J[b+12>>2]+12|0;d=
-b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;b=J[f>>2]+a|0;c=J[b+12>>2];if(c+3>>>0>=M[b+16>>2])break yh;q=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4;if(!q)break yh;J[195395]=0;s=_(1796,i+176|0)|0;b=J[195395];J[195395]=0;Gh:{if((b|0)!=1){b=J[a>>2]-12|0;J[s+24>>2]=J[(J[b>>2]+a|0)+24>>2];b=J[(J[b>>2]+a|0)+12>>2];J[195395]=0;J[s+4>>2]=b;J[s+12>>2]=b;b=b+q|0;J[s+16>>2]=b;J[s+8>>2]=b;b=J[195395];J[195395]=0;if((b|0)==1)break Ah;J[195395]=0;ea(2032,s|0);b=J[195395];J[195395]=0;if((b|0)==
-1)break Ah;if(!K[s+33|0])break Gh;ve(s);break yh}a=Z()|0;break zh}c=J[a+208>>2];if(!c){J[195395]=0;ea(2033,a|0);b=J[195395];J[195395]=0;if((b|0)!=1)break Ch;break Ah}b=J[J[c>>2]+96>>2];J[195395]=0;c=_(b|0,c|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Ah;Hh:{if((c|0)==2){b=J[a+208>>2];J[195395]=0;c=J[b+4>>2];b=J[195395];J[195395]=0;Ih:{Jh:{if((b|0)==1)break Jh;J[195395]=0;c=aa(2035,i+104|0,s|0,c|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Jh;J[195395]=0;$(1802,s|0,c|0);b=J[195395];J[195395]=
-0;if((b|0)==1)break Ih;J[195395]=0;ea(2036,s|0);b=J[195395];J[195395]=0;if((b|0)==1)break Ih;J[195395]=0;ea(2033,a|0);b=J[195395];J[195395]=0;if((b|0)==1)break Ih;J[c>>2]=388672;b=J[c+68>>2];if(!b)break Ch;Kb(b);break Ch}a=Z()|0;ve(s);break zh}a=Z()|0;J[c>>2]=388672;b=J[c+68>>2];if(!b)break Hh;Kb(b);ve(s);break zh}c=J[a+208>>2];if(!c)break Ch;b=J[J[c>>2]+96>>2];J[195395]=0;c=_(b|0,c|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Ah;if((c|0)!=4)break Ch;J[195395]=0;ia(2037,s|0,4,0,0);b=J[195395];J[195395]=
-0;if((b|0)==1)break Ah;b=J[a+208>>2];J[195395]=0;r=J[b+84>>2];b=J[195395];J[195395]=0;if((b|0)!=1){J[195395]=0;p=_(2039,s|0)|0;b=J[195395];J[195395]=0;Kh:{Lh:{Mh:{Nh:{Oh:{Ph:{Qh:{Rh:{Sh:{Th:{Uh:{Vh:{Wh:{Xh:{Yh:{Zh:{_h:{$h:{ai:{bi:{if((b|0)!=1){b=J[J[a>>2]+36>>2];J[195395]=0;c=_(b|0,a|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break bi;m=J[c+4>>2];j=J[c+12>>2];k=J[p+4>>2];e=J[p+12>>2];g=J[c>>2];f=J[c+8>>2];d=J[p>>2];c=J[p+8>>2];J[195395]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Bh;n=R(+(j-m|0)/+(e-
-k|0));l=R(+(f-g|0)/+(c-d|0));ci:{if(R(1-l)<=2.220446049250313E-16){e=0;J[195395]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Bh;if(R(1-n)<=2.220446049250313E-16)break ci}J[195395]=0;c=ca(2040,i+104|0,395940)|0;b=J[195395];J[195395]=0;if((b|0)==1)break ai;J[195395]=0;fa(1950,r|0,c|0,1);b=J[195395];J[195395]=0;if((b|0)==1)break $h;if(H[c+11|0]<0)Kb(J[c>>2]);J[195395]=0;d=ca(2040,i+92|0,396136)|0;b=J[195395];J[195395]=0;if((b|0)==1)break _h;J[195395]=0;c=i+20|0;da(1863,c|0,+l,-1);b=J[195395];J[195395]=
-0;if((b|0)==1)break Zh;J[195395]=0;c=aa(1954,c|0,0,396420)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Yh;J[i+40>>2]=J[c+8>>2];b=J[c+4>>2];J[i+32>>2]=J[c>>2];J[i+36>>2]=b;J[c>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;J[195395]=0;$(1811,i+32|0,44);b=J[195395];J[195395]=0;if((b|0)==1)break Xh;J[i+56>>2]=J[i+40>>2];J[i+40>>2]=0;b=J[i+36>>2];J[i+48>>2]=J[i+32>>2];J[i+52>>2]=b;J[i+32>>2]=0;J[i+36>>2]=0;J[195395]=0;c=i+8|0;da(1863,c|0,+n,-1);b=J[195395];J[195395]=0;if((b|0)==1)break Wh;J[195395]=0;g=c;c=K[i+19|0];
-b=c<<24>>24<0;c=aa(1864,i+48|0,(b?J[i+8>>2]:g)|0,(b?J[i+12>>2]:c)|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Vh;J[i+72>>2]=J[c+8>>2];b=J[c+4>>2];J[i+64>>2]=J[c>>2];J[i+68>>2]=b;J[c>>2]=0;J[c+4>>2]=0;J[c+8>>2]=0;J[195395]=0;$(1811,i- -64|0,41);b=J[195395];J[195395]=0;if((b|0)==1)break Uh;J[i+88>>2]=J[i+72>>2];J[i+72>>2]=0;b=J[i+68>>2];J[i+80>>2]=J[i+64>>2];J[i+84>>2]=b;J[i+64>>2]=0;J[i+68>>2]=0;J[195395]=0;fa(1951,r|0,d|0,i+80|0);b=J[195395];J[195395]=0;if((b|0)==1)break Th;if(H[i+91|0]<0)Kb(J[i+
-80>>2]);if(H[i+75|0]<0)Kb(J[i+64>>2]);if(H[i+19|0]<0)Kb(J[i+8>>2]);if(H[i+59|0]<0)Kb(J[i+48>>2]);if(H[i+43|0]<0)Kb(J[i+32>>2]);if(H[i+31|0]<0)Kb(J[i+20>>2]);if(H[d+11|0]<0)Kb(J[d>>2]);J[195395]=0;c=ca(2040,i+80|0,395940)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Mh;J[195395]=0;ia(1953,r|0,c|0,1,0);b=J[195395];J[195395]=0;if((b|0)==1)break Lh;if(H[c+11|0]<0)Kb(J[c>>2]);e=1}J[195395]=0;c=J[s+248>>2];b=J[195395];J[195395]=0;if((b|0)==1)break Bh;J[195395]=0;$(2042,c+8|0,r|0);b=J[195395];J[195395]=0;
-if((b|0)==1)break Bh;J[195395]=0;ea(2036,s|0);b=J[195395];J[195395]=0;if((b|0)==1)break Bh;if(e)break Kh;break Dh}a=Z()|0;ve(s);break zh}a=Z()|0;ve(s);break zh}a=Z()|0;ve(s);break zh}a=Z()|0;if(H[c+11|0]>=0)break Hh;Kb(J[c>>2]);ve(s);break zh}a=Z()|0;ve(s);break zh}a=Z()|0;break Nh}a=Z()|0;break Oh}a=Z()|0;break Ph}a=Z()|0;break Qh}a=Z()|0;break Rh}a=Z()|0;break Sh}a=Z()|0;if(H[i+91|0]>=0)break Sh;Kb(J[i+80>>2])}if(H[i+75|0]>=0)break Rh;Kb(J[i+64>>2])}if(H[i+19|0]>=0)break Qh;Kb(J[i+8>>2])}if(H[i+
-59|0]>=0)break Ph;Kb(J[i+48>>2])}if(H[i+43|0]>=0)break Oh;Kb(J[i+32>>2])}if(H[i+31|0]>=0)break Nh;Kb(J[i+20>>2])}if(H[d+11|0]>=0)break Hh;Kb(J[d>>2]);ve(s);break zh}a=Z()|0;ve(s);break zh}a=Z()|0;if(H[c+11|0]>=0)break Hh;Kb(J[c>>2]);ve(s);break zh}J[195395]=0;c=ca(2040,i- -64|0,395940)|0;b=J[195395];J[195395]=0;di:{if((b|0)!=1){J[195395]=0;ia(1953,r|0,c|0,0,0);b=J[195395];J[195395]=0;if((b|0)==1)break di;if(H[c+11|0]>=0)break Dh;Kb(J[c>>2]);break Dh}a=Z()|0;ve(s);break zh}a=Z()|0;if(H[c+11|0]>=0)break Hh;
-Kb(J[c>>2]);ve(s);break zh}a=Z()|0}ve(s);break zh}a=Z()|0;break zh}a=Z()|0;Kb(f);break zh}J[195395]=0;ea(2033,a|0);b=J[195395];J[195395]=0;if((b|0)==1)break Bh}b=J[J[a>>2]-12>>2]+a|0;c=q+J[b+12>>2]|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b;ve(s);break yh}a=Z()|0;ve(s);break zh}a=Z()|0;ve(s)}if(H[i+463|0]<0)Kb(J[i+452>>2]);break d}if(H[i+463|0]<0)Kb(J[i+452>>2]);xb=i+464|0;break n;default:break o}d=J[a+208>>2];if(d){c=J[a>>2]-12|0;b=J[c>>2]+a|0;J[b+12>>2]=J[b+12>>2]-8;Ab[J[J[d>>2]+452>>2]](d,(J[c>>
-2]+a|0)+4|0)}b=J[J[a>>2]-12>>2]+a|0;c=J[b+12>>2]+J[a+116>>2]|0;d=b;b=J[b+16>>2];J[d+12>>2]=b>>>0>c>>>0?c:b}if(K[a+212|0])break l;c=J[a>>2];d=c-12|0;b=J[d>>2]+a|0;f=J[a+116>>2]+(J[b+4>>2]+(F-Q|0)|0)|0;g=b;b=J[b+16>>2];J[g+12>>2]=b>>>0>f>>>0?f:b;b=J[d>>2]+a|0;J[b+16>>2]=J[b+8>>2];G=G+1|0}f=J[c-12>>2];if(!K[N+f|0])continue}break}b=J[a>>2];d=J[b-12>>2]+a|0;if(!K[d+33|0]){c=J[d+8>>2];J[d+12>>2]=J[d+4>>2];J[d+16>>2]=c}if(!K[a+212|0]){Uq(a);b=J[a>>2]}Ab[J[b+32>>2]](a)}xb=h+160|0;return}a=Z()|0;b=J[c+88>>
-2];if(b){Kb(b);J[c+88>>2]=0}b=J[c+92>>2];if(b){Kb(b);J[c+92>>2]=0}break d}a=Z()|0;b=J[e+4>>2];if(!b)break d;J[e+8>>2]=b;Kb(b);break d}a=Z()|0;aB(f+4|0);break d}a=Z()|0;c=J[b+76>>2];ei:{if(!c)break ei;if(J[b+72>>2]){c=0;while(1){d=J[b+76>>2]+P(c,48)|0;h=J[d+40>>2];if(h){Kb(h);J[d+40>>2]=0}h=J[d+44>>2];if(h){Kb(h);J[d+44>>2]=0}c=c+1|0;if(c>>>0>2])continue;break}c=J[b+76>>2];if(!c)break ei}Kb(c);J[b+76>>2]=0}break d}a=Z()|0;Kb(b);break d}a=Z()|0;Kb(e)}ba(a|0);B()}J[f+8>>2]=a;Kb(a);ba(e|0);B()}b=
-Z()|0;a=J[c+4>>2];if(!a)break a;J[c+8>>2]=a;Kb(a)}ba(b|0);B()}function j0(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,y=0,z=0,A=0,D=0,E=0,F=0,G=0,N=0,P=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;E=xb-48|0;xb=E;d=J[a>>2];a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{k:{l:{m:{n:{if(K[a+212|0])break n;U=a+124|0;V=a+4|0;P=a+12|0;p=J[d-12>>2];e=J[(p+a|0)+12>>2];while(1){f=a+p|0;if(M[f+8>>2]<=e>>>0)break n;d=d-12|0;b=0;c=J[f+16>>2];o:{if(c>>>0<=e+1>>>0){g=0;break o}g=K[e|0]|
-K[e+1|0]<<8;J[f+12>>2]=e+2;p=J[d>>2];e=p+a|0;c=J[e+16>>2];e=J[e+12>>2]}i=0;if(e+1>>>0>>0){b=K[e|0]|K[e+1|0]<<8;J[p+P>>2]=e+2;p=J[d>>2];e=p+a|0;c=J[e+16>>2];e=J[e+12>>2]}if(e+3>>>0>>0){J[p+P>>2]=e+4;p=J[d>>2];e=p+a|0;c=J[e+16>>2];e=J[e+12>>2]}if(e+3>>>0>>0){i=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[p+P>>2]=e+4}J[a+116>>2]=i;c=J[d>>2]+a|0;e=J[c+12>>2]+i|0;d=c;c=J[c+8>>2];J[d+16>>2]=c>>>0>e>>>0?e:c;n=J[a>>2]-12|0;d=J[n>>2];m=d+a|0;c=J[m+12>>2];W=c-J[m+4>>2]|0;p:{q:switch((g&65535)-
-16385|0){case 52:H[a+213|0]=1;r=0;b=J[n>>2];c=b+a|0;e=J[c+12>>2];d=J[c+16>>2];if(d>>>0<=e+3>>>0)k=0;else{g=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[c+12>>2]=e+4;b=J[n>>2];c=b+a|0;d=J[c+16>>2];e=J[c+12>>2];k=+(x(2,g),C())}if(e+3>>>0>>0){c=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[b+P>>2]=e+4;r=+(x(2,c),C())}b=J[a+208>>2];if(!b)break p;Ab[J[J[b>>2]+468>>2]](b,k,r);break p;case 48:H[a+213|0]=1;wf(J[a+120>>2]+4|0);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);b=J[a+208>>2];if(!b)break p;
-Ab[J[J[b>>2]+472>>2]](b);break p;case 50:f=b&65535;H[a+213|0]=1;c=a+236|0;d=J[c>>2];r:{if(!d)break r;g=f&255;b=c;while(1){e=g>>>0>M[d+16>>2];b=e?b:d;d=J[(e?d+4|0:d)>>2];if(d)continue;break}if((b|0)==(c|0)|g>>>0>2])break r;c=J[b+20>>2];if((Ab[J[J[c>>2]+12>>2]](c)|0)!=3)break r;c=J[b+20>>2];if(!c)break r;wf(J[a+120>>2]+4|0);cr(J[a+120>>2]+4|0,c+4|0,f>>>8&15,Ab[J[J[a>>2]+92>>2]](a,2)|0);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);b=J[a+208>>2];if(!b)break r;Ab[J[J[b>>2]+476>>2]](b,f<<16>>16,c)}break p;
-case 49:r=0;z=0;e=xb-96|0;xb=e;H[a+213|0]=1;J[e+88>>2]=0;J[e+92>>2]=0;J[e+80>>2]=0;J[e+84>>2]=0;f=J[J[a>>2]-12>>2]+a|0;c=J[f+12>>2];g=J[f+16>>2];if(c+3>>>0>=g>>>0)q=0;else{d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c;q=+(x(2,d),C())}O[e+64>>3]=q;if(g>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c;r=+(x(2,d),C())}O[e+72>>3]=r;if(g>>>0<=c+3>>>0)k=0;else{d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);c=c+4|0;J[f+12>>2]=c;k=+(x(2,d),C())}O[e+
-80>>3]=k;if(g>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4;z=+(x(2,d),C())}O[e+88>>3]=z;wf(J[a+120>>2]+4|0);O[e+40>>3]=r;O[e+56>>3]=r+z;O[e+32>>3]=q;O[e+48>>3]=q+k;c=J[e+44>>2];J[e+8>>2]=J[e+40>>2];J[e+12>>2]=c;c=J[e+60>>2];J[e+24>>2]=J[e+56>>2];J[e+28>>2]=c;c=J[e+52>>2];J[e+16>>2]=J[e+48>>2];J[e+20>>2]=c;c=J[e+36>>2];J[e>>2]=J[e+32>>2];J[e+4>>2]=c;f=(b&65535)>>>8&15;g=xb-16|0;xb=g;h=rA(g);k=O[e+8>>3];w=O[e>>3];J[195395]=0;i=h+4|0;ra(1902,i|0,+w,+k)|0;b=J[195395];J[195395]=
-0;s:{t:{if((b|0)==1)break t;q=O[e+16>>3];J[195395]=0;ra(1906,i|0,+q,+k)|0;b=J[195395];J[195395]=0;if((b|0)==1)break t;k=O[e+24>>3];J[195395]=0;ra(1906,i|0,+q,+k)|0;b=J[195395];J[195395]=0;if((b|0)==1)break t;J[195395]=0;ra(1906,i|0,+w,+k)|0;b=J[195395];J[195395]=0;if((b|0)==1)break t;J[195395]=0;_(1921,i|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break t;d=J[a+120>>2];J[195395]=0;b=J[195395];J[195395]=0;if((b|0)==1)break t;b=J[J[a>>2]+92>>2];J[195395]=0;c=ca(b|0,a|0,2)|0;b=J[195395];J[195395]=0;if((b|
-0)==1)break t;J[195395]=0;ha(2087,d+4|0,i|0,f|0,c|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break t;J[195395]=0;ea(2088,a|0);b=J[195395];J[195395]=0;if((b|0)==1)break t;Rq(h);xb=g+16|0;break s}a=Z()|0;Rq(h);ba(a|0);B()}b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+480>>2]](b,f,e- -64|0);xb=e+96|0;break p;case 51:c=0;h=xb+-64|0;xb=h;H[a+213|0]=1;f=b&65535;i=f&255;e=a+236|0;g=J[e>>2];u:{if(!g)break u;b=e;while(1){d=i>>>0>M[g+16>>2];b=d?b:g;g=J[(d?g+4|0:g)>>2];if(g)continue;
-break}if((b|0)==(e|0)|i>>>0>2])break u;e=J[b+20>>2];if((Ab[J[J[e>>2]+12>>2]](e)|0)!=4)break u;b=J[b+20>>2];if(!b)break u;wf(J[a+120>>2]+4|0);g=J[b+4>>2];c=J[b+8>>2];if((g|0)!=(c|0))while(1){g=g+4|0;if((c|0)!=(g|0))continue;break}c=b}b=J[a+208>>2];if(b)Ab[J[J[b>>2]+84>>2]](b);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+484>>2]](b,i,f>>>8&15,c);xb=h- -64|0;break p;case 2:e=J[a+116>>2];c=e+c|0;b=J[m+16>>2];J[m+12>>2]=b>>>0>c>>>0?c:b;b=J[a+208>>2];if(!b)break p;Ab[J[J[b>>2]+488>>2]](b,J[n>>2]+V|0,e);break p;
-case 1:b=J[a+208>>2];if(!b){I[a+212>>1]=1;break p}Ab[J[J[b>>2]+12>>2]](b);I[a+212>>1]=1;b=J[a+208>>2];if(!b)break p;Ab[J[J[b>>2]+492>>2]](b);break p;case 3:H[a+213|0]=0;b=J[a+208>>2];if(!b)break p;Ab[J[J[b>>2]+496>>2]](b);break p;case 0:c=c+4|0;b=J[m+16>>2];J[m+12>>2]=b>>>0>c>>>0?c:b;c=0;g=J[n>>2];d=g+a|0;e=J[d+12>>2];b=J[d+16>>2];v:{if(b>>>0<=e+3>>>0){p=0;break v}p=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[d+12>>2]=e+4;g=J[n>>2];e=g+a|0;b=J[e+16>>2];e=J[e+12>>2]}if(e+3>>>0>>0){c=K[e|0]|
-K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[g+P>>2]=e+4}J[a+216>>2]=c;e=0;b=J[n>>2]+a|0;c=J[b+12>>2];if(c+3>>>0>2]){e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[b+12>>2]=c+4}H[a+213|0]=1;J[a+220>>2]=e;b=J[a+208>>2];if(!b)break p;Ab[J[J[b>>2]+8>>2]](b);b=J[a+208>>2];Ab[J[J[b>>2]+500>>2]](b,p,J[a+216>>2],J[a+220>>2]);break p;case 8:H[E+2|0]=0;H[E+3|0]=255;b=0;e=J[n>>2]+a|0;d=J[e+12>>2];c=J[e+16>>2];w:{if(d>>>0>=c>>>0){i=0;break w}i=K[d|0];d=d+1|0;J[e+12>>2]=d}H[E|0]=i;if(c>>>0>d>>>0){b=
-K[d|0];d=d+1|0;J[e+12>>2]=d}H[E+1|0]=b;i=0;x:{if(c>>>0<=d>>>0){b=0;break x}b=K[d|0];d=d+1|0;J[e+12>>2]=d}H[E+2|0]=b;if(c>>>0>d>>>0){i=K[d|0];J[e+12>>2]=d+1}H[E+3|0]=i;b=J[a+208>>2];if(b)Ab[J[J[b>>2]+504>>2]](b,E);H[a+213|0]=1;break p;case 17:y:{if(b&16384){g=b&65535;r=0;z=0;e=xb-32|0;xb=e;i=J[a>>2]-12|0;c=J[i>>2];h=c+a|0;d=J[h+12>>2];b=J[h+16>>2];if(b>>>0<=d+3>>>0)q=0;else{f=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[h+12>>2]=d+4;c=J[i>>2];d=c+a|0;b=J[d+16>>2];d=J[d+12>>2];q=+(x(2,f),C())}if(d+
-3>>>0>>0){f=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[(a+c|0)+12>>2]=d+4;c=J[i>>2];d=c+a|0;b=J[d+16>>2];z=+(x(2,f),C());d=J[d+12>>2]}f=a+c|0;if(d+1>>>0>=b>>>0)w=0;else{c=(K[d|0]|K[d+1|0]<<8)<<16>>16;d=d+2|0;J[f+12>>2]=d;w=+(c|0)}if(d+1>>>0>>0){c=(K[d|0]|K[d+1|0]<<8)<<16>>16;d=d+2|0;J[f+12>>2]=d;r=+(c|0)}if(d+1>>>0>=b>>>0)k=0;else{c=(K[d|0]|K[d+1|0]<<8)<<16>>16;d=d+2|0;J[f+12>>2]=d;k=+(c|0)}if(d+1>>>0>>0){b=(K[d|0]|K[d+1|0]<<8)<<16>>16;J[f+12>>2]=d+2;y=+(b|0)}else y=0;break y}g=b&65535;
-r=0;z=0;e=xb-32|0;xb=e;i=J[a>>2]-12|0;c=J[i>>2];h=c+a|0;d=J[h+12>>2];b=J[h+16>>2];if(b>>>0<=d+3>>>0)q=0;else{f=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[h+12>>2]=d+4;c=J[i>>2];d=c+a|0;b=J[d+16>>2];d=J[d+12>>2];q=+(x(2,f),C())}if(d+3>>>0>>0){f=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[(a+c|0)+12>>2]=d+4;c=J[i>>2];d=c+a|0;b=J[d+16>>2];z=+(x(2,f),C());d=J[d+12>>2]}f=a+c|0;if(d+3>>>0>=b>>>0)w=0;else{c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[f+12>>2]=d;w=+(x(2,c),C())}if(d+
-3>>>0>>0){c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[f+12>>2]=d;r=+(x(2,c),C())}if(d+3>>>0>=b>>>0)k=0;else{c=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);d=d+4|0;J[f+12>>2]=d;k=+(x(2,c),C())}if(d+3>>>0>>0){b=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[f+12>>2]=d+4;y=+(x(2,b),C())}else y=0}c=a+236|0;d=J[c>>2];z:{if(!d)break z;h=g<<24>>24;b=c;while(1){f=h>>>0>M[d+16>>2];b=f?b:d;d=J[(f?d+4|0:d)>>2];if(d)continue;break}if((b|0)==(c|0)|h>>>0>2])break z;c=J[b+20>>2];
-if((Ab[J[J[c>>2]+12>>2]](c)|0)!=2)break z;b=J[b+20>>2];if(!b)break z;h=b+4|0;J[J[a+120>>2]+24>>2]=h;b=J[J[a+120>>2]+688>>2];O[e+8>>3]=r;O[e>>3]=w;O[e+16>>3]=k;O[e+24>>3]=y;_A(a,w,r);y=r+y;A:{if(R(y)<2147483648){d=~~y;break A}d=-2147483648}k=w+k;B:{if(R(k)<2147483648){c=~~k;break B}c=-2147483648}k=z+-360;f=(b|0)==1;if(R(r)<2147483648)b=~~r;else b=-2147483648;k=f?z:k;if(R(w)<2147483648)f=~~w;else f=-2147483648;Dg(a,f,b,c,d,q,k);Cg(a,1,0,1);b=J[a+208>>2];if(b)Ab[J[J[b>>2]+508>>2]](b,g&255,q,k,e);b=J[a+
-120>>2];if((h|0)==J[b+24>>2])J[b+24>>2]=0}xb=e+32|0;H[a+213|0]=1;break p;case 24:C:{if(b&2048)break C;if(b&16384){d=b&65535;c=0;g=xb-48|0;xb=g;D:{E:{F:{G:{H:{h=J[a>>2]-12|0;b=J[h>>2]+a|0;e=J[b+12>>2];I:{if(e+3>>>0>=M[b+16>>2])break I;t=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[b+12>>2]=e+4;if(t>>>0<3)break I;J[g+44>>2]=0;J[g+36>>2]=0;J[g+40>>2]=0;if(t>>>0>=1073741824){J[195395]=0;ea(2054,g+36|0);a=J[195395];J[195395]=0;if((a|0)==1)break m;break D}J[195395]=0;l=t<<2;e=_(1078,l|0)|0;b=J[195395];
-J[195395]=0;if((b|0)==1)break m;o=d&255;e=Nb(e,0,l);j=l+e|0;while(1){i=(c<<2)+e|0;n=J[h>>2]+a|0;d=J[n+12>>2];f=J[n+16>>2];J:{if(d+1>>>0>=f>>>0){b=0;break J}b=K[d|0]|K[d+1|0]<<8;d=d+2|0;J[n+12>>2]=d}I[i>>1]=b;b=0;if(f>>>0>d+1>>>0){b=K[d|0]|K[d+1|0]<<8;J[n+12>>2]=d+2}I[i+2>>1]=b;c=c+1|0;if((t|0)!=(c|0))continue;break}d=a+236|0;c=J[d>>2];K:{if(!c)break K;b=d;while(1){f=o>>>0>M[c+16>>2];b=f?b:c;c=J[(f?c+4|0:c)>>2];if(c)continue;break}if((b|0)==(d|0)|o>>>0>2])break K;d=J[b+20>>2];c=J[J[d>>2]+12>>
-2];J[195395]=0;d=_(c|0,d|0)|0;c=J[195395];J[195395]=0;L:{if((c|0)!=1){if((d|0)!=2)break K;c=J[b+20>>2];if(!c)break K;b=J[a+120>>2];J[195395]=0;n=c+4|0;J[b+24>>2]=n;b=J[195395];J[195395]=0;if((b|0)!=1)break L}c=Z()|0;break l}J[g+20>>2]=0;J[g+12>>2]=0;J[g+16>>2]=0;m=l>>2;if(m>>>0>=1073741824){J[195395]=0;ea(2054,g+12|0);a=J[195395];J[195395]=0;if((a|0)!=1)break D;break F}v=0;J[195395]=0;d=_(1078,l|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break F;J[g+16>>2]=d;J[g+12>>2]=d;J[g+20>>2]=(m<<2)+d;i=l-4|0;
-h=(i>>>2|0)+1&7;M:{if(!h){b=e;c=d;break M}b=e;c=d;while(1){f=L[b>>1]|L[b+2>>1]<<16;I[c>>1]=f;I[c+2>>1]=f>>>16;c=c+4|0;b=b+4|0;v=v+1|0;if((h|0)!=(v|0))continue;break}}if(i>>>0>=28)while(1){f=L[b>>1]|L[b+2>>1]<<16;I[c>>1]=f;I[c+2>>1]=f>>>16;f=L[b+4>>1]|L[b+6>>1]<<16;I[c+4>>1]=f;I[c+6>>1]=f>>>16;f=L[b+8>>1]|L[b+10>>1]<<16;I[c+8>>1]=f;I[c+10>>1]=f>>>16;f=L[b+12>>1]|L[b+14>>1]<<16;I[c+12>>1]=f;I[c+14>>1]=f>>>16;f=L[b+16>>1]|L[b+18>>1]<<16;I[c+16>>1]=f;I[c+18>>1]=f>>>16;f=L[b+20>>1]|L[b+22>>1]<<16;I[c+
-20>>1]=f;I[c+22>>1]=f>>>16;f=L[b+24>>1]|L[b+26>>1]<<16;I[c+24>>1]=f;I[c+26>>1]=f>>>16;f=L[b+28>>1]|L[b+30>>1]<<16;I[c+28>>1]=f;I[c+30>>1]=f>>>16;c=c+32|0;b=b+32|0;if((j|0)!=(b|0))continue;break}N:{if((c|0)!=(d|0)){J[g+32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0;b=c-d|0;h=b>>2;if(h>>>0>=268435456){J[195395]=0;ea(2056,g+24|0);a=J[195395];J[195395]=0;if((a|0)!=1)break D;break G}J[195395]=0;f=b<<2;b=_(1078,f|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break G;J[g+24>>2]=b;J[g+32>>2]=(h<<4)+b;c=0;l=Nb(b,0,f);J[g+
-28>>2]=l+f;f=h>>>0<=1?1:h;j=f&1;if(h>>>0>=2){i=f&-2;v=0;while(1){h=l+(c<<4)|0;f=(c<<2)+d|0;O[h>>3]=I[f>>1];O[h+8>>3]=I[f+2>>1];f=c|1;h=l+(f<<4)|0;f=(f<<2)+d|0;O[h>>3]=I[f>>1];O[h+8>>3]=I[f+2>>1];c=c+2|0;v=v+2|0;if((i|0)!=(v|0))continue;break}}if(!j)break N;f=l+(c<<4)|0;c=(c<<2)+d|0;O[f>>3]=I[c>>1];O[f+8>>3]=I[c+2>>1];break N}b=0;J[g+32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0}J[g+16>>2]=d;Kb(d);q=O[b+8>>3];k=O[b>>3];J[195395]=0;qa(2057,a|0,+k,+q);c=J[195395];J[195395]=0;b=1;if((c|0)==1)break H;if(t>>>0>1)while(1){c=
-J[g+24>>2]+(b<<4)|0;A=O[c+16>>3];r=O[c+24>>3];y=O[c+32>>3];w=O[c+40>>3];q=O[c>>3];k=O[c+8>>3];J[195395]=0;if(R(k)<2147483648)d=~~k;else d=-2147483648;if(R(q)<2147483648)c=~~q;else c=-2147483648;if(R(w)<2147483648)i=~~w;else i=-2147483648;if(R(y)<2147483648)h=~~y;else h=-2147483648;if(R(r)<2147483648)f=~~r;else f=-2147483648;if(R(A)<2147483648)j=~~A;else j=-2147483648;oa(2058,a|0,c|0,d|0,j|0,f|0,h|0,i|0);c=J[195395];J[195395]=0;if((c|0)==1)break H;b=b+3|0;if(m>>>0>b>>>0)continue;break}J[195395]=0;
-ia(2059,a|0,1,0,1);b=J[195395];J[195395]=0;if((b|0)==1)break H;c=J[a+208>>2];if(c){b=J[J[c>>2]+512>>2];J[195395]=0;fa(b|0,c|0,o|0,g+24|0);b=J[195395];J[195395]=0;if((b|0)==1)break H}b=J[a+120>>2];J[195395]=0;if((n|0)==J[b+24>>2])J[b+24>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break H;b=J[g+24>>2];if(!b)break K;J[g+28>>2]=b;Kb(b)}Kb(e)}xb=g+48|0;break C}c=Z()|0;d=J[g+24>>2];if(!d)break l;J[g+28>>2]=d;break E}c=Z()|0;a=J[g+24>>2];if(a){J[g+28>>2]=a;Kb(a)}J[g+16>>2]=d;break E}c=Z()|0;d=J[g+12>>2];if(!d)break l;
-J[g+16>>2]=d}Kb(d);break l}B()}c=b&65535;g=xb-48|0;xb=g;O:{P:{Q:{R:{S:{T:{h=J[a>>2]-12|0;b=J[h>>2]+a|0;e=J[b+12>>2];U:{if(e+3>>>0>=M[b+16>>2])break U;D=K[e|0]|K[e+1|0]<<8|(K[e+2|0]<<16|K[e+3|0]<<24);J[b+12>>2]=e+4;if(D>>>0<3)break U;J[g+44>>2]=0;J[g+36>>2]=0;J[g+40>>2]=0;if(D>>>0>=268435456){J[195395]=0;ea(2056,g+36|0);a=J[195395];J[195395]=0;if((a|0)==1)break m;break P}J[195395]=0;t=D<<4;e=_(1078,t|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break m;o=c&255;c=0;e=Nb(e,0,t);m=t+e|0;while(1){b=(c<<4)+
-e|0;j=J[h>>2]+a|0;i=J[j+12>>2];f=J[j+16>>2];if(i+3>>>0>=f>>>0)k=0;else{d=K[i|0]|K[i+1|0]<<8|(K[i+2|0]<<16|K[i+3|0]<<24);i=i+4|0;J[j+12>>2]=i;k=+(x(2,d),C())}O[b>>3]=k;if(f>>>0>i+3>>>0){d=K[i|0]|K[i+1|0]<<8|(K[i+2|0]<<16|K[i+3|0]<<24);J[j+12>>2]=i+4;k=+(x(2,d),C())}else k=0;O[b+8>>3]=k;c=c+1|0;if((D|0)!=(c|0))continue;break}d=a+236|0;c=J[d>>2];V:{if(!c)break V;b=d;while(1){f=o>>>0>M[c+16>>2];b=f?b:c;c=J[(f?c+4|0:c)>>2];if(c)continue;break}if((b|0)==(d|0)|o>>>0>2])break V;d=J[b+20>>2];c=J[J[d>>
-2]+12>>2];J[195395]=0;d=_(c|0,d|0)|0;c=J[195395];J[195395]=0;W:{if((c|0)!=1){if((d|0)!=2)break V;c=J[b+20>>2];if(!c)break V;b=J[a+120>>2];J[195395]=0;n=c+4|0;J[b+24>>2]=n;b=J[195395];J[195395]=0;if((b|0)!=1)break W}c=Z()|0;break l}J[g+20>>2]=0;J[g+12>>2]=0;J[g+16>>2]=0;l=t>>4;if(l>>>0>=268435456){J[195395]=0;ea(2056,g+12|0);a=J[195395];J[195395]=0;if((a|0)!=1)break P;break R}i=0;J[195395]=0;d=_(1078,t|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break R;J[g+16>>2]=d;J[g+12>>2]=d;J[g+20>>2]=(l<<4)+d;j=
-t-16|0;h=(j>>>4|0)+1&3;X:{if(!h){b=e;c=d;break X}b=e;c=d;while(1){f=J[b+4>>2];J[c>>2]=J[b>>2];J[c+4>>2]=f;f=J[b+12>>2];J[c+8>>2]=J[b+8>>2];J[c+12>>2]=f;c=c+16|0;b=b+16|0;i=i+1|0;if((h|0)!=(i|0))continue;break}}if(j>>>0>=48)while(1){f=J[b+4>>2];J[c>>2]=J[b>>2];J[c+4>>2]=f;f=J[b+12>>2];J[c+8>>2]=J[b+8>>2];J[c+12>>2]=f;f=J[b+28>>2];J[c+24>>2]=J[b+24>>2];J[c+28>>2]=f;f=J[b+20>>2];J[c+16>>2]=J[b+16>>2];J[c+20>>2]=f;f=J[b+44>>2];J[c+40>>2]=J[b+40>>2];J[c+44>>2]=f;f=J[b+36>>2];J[c+32>>2]=J[b+32>>2];J[c+
-36>>2]=f;f=J[b+52>>2];J[c+48>>2]=J[b+48>>2];J[c+52>>2]=f;f=J[b+60>>2];J[c+56>>2]=J[b+56>>2];J[c+60>>2]=f;c=c- -64|0;b=b- -64|0;if((m|0)!=(b|0))continue;break}Y:{if((c|0)!=(d|0)){J[g+32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0;f=c-d|0;h=f>>4;if(h>>>0>=268435456){J[195395]=0;ea(2056,g+24|0);a=J[195395];J[195395]=0;if((a|0)!=1)break P;break S}J[195395]=0;b=_(1078,f|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break S;J[g+24>>2]=b;J[g+32>>2]=(h<<4)+b;u=0;p=Nb(b,0,f);J[g+28>>2]=p+f;f=h>>>0<=1?1:h;j=f&3;c=0;if(h>>>
-0>=4){i=f&-4;s=0;while(1){t=c<<4;h=t+p|0;m=d+t|0;f=J[m+4>>2];J[h>>2]=J[m>>2];J[h+4>>2]=f;f=J[m+12>>2];J[h+8>>2]=J[m+8>>2];J[h+12>>2]=f;f=t|16;h=f+p|0;m=d+f|0;f=J[m+12>>2];J[h+8>>2]=J[m+8>>2];J[h+12>>2]=f;f=J[m+4>>2];J[h>>2]=J[m>>2];J[h+4>>2]=f;f=t|32;h=f+p|0;m=d+f|0;f=J[m+12>>2];J[h+8>>2]=J[m+8>>2];J[h+12>>2]=f;f=J[m+4>>2];J[h>>2]=J[m>>2];J[h+4>>2]=f;f=t|48;h=f+p|0;m=d+f|0;f=J[m+12>>2];J[h+8>>2]=J[m+8>>2];J[h+12>>2]=f;f=J[m+4>>2];J[h>>2]=J[m>>2];J[h+4>>2]=f;c=c+4|0;s=s+4|0;if((i|0)!=(s|0))continue;
-break}}if(!j)break Y;while(1){f=c<<4;h=f+p|0;i=d+f|0;f=J[i+4>>2];J[h>>2]=J[i>>2];J[h+4>>2]=f;f=J[i+12>>2];J[h+8>>2]=J[i+8>>2];J[h+12>>2]=f;c=c+1|0;u=u+1|0;if((j|0)!=(u|0))continue;break}break Y}b=0;J[g+32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0}J[g+16>>2]=d;Kb(d);q=O[b+8>>3];k=O[b>>3];J[195395]=0;qa(2057,a|0,+k,+q);c=J[195395];J[195395]=0;b=1;if((c|0)==1)break T;if(D>>>0>1)while(1){c=J[g+24>>2]+(b<<4)|0;A=O[c+16>>3];r=O[c+24>>3];y=O[c+32>>3];w=O[c+40>>3];q=O[c>>3];k=O[c+8>>3];J[195395]=0;if(R(k)<2147483648)d=
-~~k;else d=-2147483648;if(R(q)<2147483648)c=~~q;else c=-2147483648;if(R(w)<2147483648)i=~~w;else i=-2147483648;if(R(y)<2147483648)h=~~y;else h=-2147483648;if(R(r)<2147483648)f=~~r;else f=-2147483648;if(R(A)<2147483648)j=~~A;else j=-2147483648;oa(2058,a|0,c|0,d|0,j|0,f|0,h|0,i|0);c=J[195395];J[195395]=0;if((c|0)==1)break T;b=b+3|0;if(l>>>0>b>>>0)continue;break}J[195395]=0;ia(2059,a|0,1,0,1);b=J[195395];J[195395]=0;if((b|0)==1)break T;c=J[a+208>>2];if(c){b=J[J[c>>2]+512>>2];J[195395]=0;fa(b|0,c|0,o|
-0,g+24|0);b=J[195395];J[195395]=0;if((b|0)==1)break T}b=J[a+120>>2];J[195395]=0;if((n|0)==J[b+24>>2])J[b+24>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break T;b=J[g+24>>2];if(!b)break V;J[g+28>>2]=b;Kb(b)}Kb(e)}xb=g+48|0;break O}c=Z()|0;d=J[g+24>>2];if(!d)break l;J[g+28>>2]=d;break Q}c=Z()|0;a=J[g+24>>2];if(a){J[g+28>>2]=a;Kb(a)}J[g+16>>2]=d;break Q}c=Z()|0;d=J[g+12>>2];if(!d)break l;J[g+16>>2]=d}Kb(d);break l}B()}}H[a+213|0]=1;break p;case 22:Z:{if(b&2048)break Z;if(b&16384){d=b&65535;r=0;g=xb-48|
-0;xb=g;h=J[a>>2]-12|0;b=J[h>>2];f=b+a|0;c=J[f+12>>2];i=J[f+16>>2];if(i>>>0>c+3>>>0){e=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[f+12>>2]=c+4;b=J[h>>2];c=b+a|0;i=J[c+16>>2];r=+(x(2,e),C());c=J[c+12>>2]}_:{$:{aa:{ba:{ca:{da:{if(c+3>>>0>=i>>>0)break da;t=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+b|0)+12>>2]=c+4;if(t>>>0<3)break da;J[g+44>>2]=0;J[g+36>>2]=0;J[g+40>>2]=0;if(t>>>0>=1073741824){J[195395]=0;ea(2054,g+36|0);a=J[195395];J[195395]=0;if((a|0)==1)break m;break _}J[195395]=0;j=
-t<<2;c=_(1078,j|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break m;o=d&255;d=0;e=Nb(c,0,j);n=j+e|0;while(1){f=J[h>>2]+a|0;b=J[f+12>>2];c=J[f+16>>2];ea:{if(b+1>>>0>=c>>>0){i=0;break ea}i=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[f+12>>2]=b}I[e>>1]=i;i=0;if(c>>>0>b+1>>>0){i=K[b|0]|K[b+1|0]<<8;J[f+12>>2]=b+2}I[e+2>>1]=i;d=d+1|0;if((t|0)!=(d|0))continue;break}d=a+236|0;c=J[d>>2];fa:{if(!c)break fa;b=d;while(1){f=o>>>0>M[c+16>>2];b=f?b:c;c=J[(f?c+4|0:c)>>2];if(c)continue;break}if((b|0)==(d|0)|o>>>0>2])break fa;
-d=J[b+20>>2];c=J[J[d>>2]+12>>2];J[195395]=0;d=_(c|0,d|0)|0;c=J[195395];J[195395]=0;ga:{if((c|0)!=1){if((d|0)!=2)break fa;c=J[b+20>>2];if(!c)break fa;b=J[a+120>>2];J[195395]=0;m=c+4|0;J[b+24>>2]=m;b=J[195395];J[195395]=0;if((b|0)!=1)break ga}c=Z()|0;break l}J[g+20>>2]=0;J[g+12>>2]=0;J[g+16>>2]=0;c=j>>2;if(c>>>0>=1073741824){J[195395]=0;ea(2054,g+12|0);a=J[195395];J[195395]=0;if((a|0)!=1)break _;break aa}i=0;J[195395]=0;d=_(1078,j|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break aa;J[g+16>>2]=d;J[g+12>>
-2]=d;J[g+20>>2]=(c<<2)+d;j=j-4|0;h=(j>>>2|0)+1&7;ha:{if(!h){b=e;c=d;break ha}b=e;c=d;while(1){f=L[b>>1]|L[b+2>>1]<<16;I[c>>1]=f;I[c+2>>1]=f>>>16;c=c+4|0;b=b+4|0;i=i+1|0;if((h|0)!=(i|0))continue;break}}if(j>>>0>=28)while(1){f=L[b>>1]|L[b+2>>1]<<16;I[c>>1]=f;I[c+2>>1]=f>>>16;f=L[b+4>>1]|L[b+6>>1]<<16;I[c+4>>1]=f;I[c+6>>1]=f>>>16;f=L[b+8>>1]|L[b+10>>1]<<16;I[c+8>>1]=f;I[c+10>>1]=f>>>16;f=L[b+12>>1]|L[b+14>>1]<<16;I[c+12>>1]=f;I[c+14>>1]=f>>>16;f=L[b+16>>1]|L[b+18>>1]<<16;I[c+16>>1]=f;I[c+18>>1]=f>>>
-16;f=L[b+20>>1]|L[b+22>>1]<<16;I[c+20>>1]=f;I[c+22>>1]=f>>>16;f=L[b+24>>1]|L[b+26>>1]<<16;I[c+24>>1]=f;I[c+26>>1]=f>>>16;f=L[b+28>>1]|L[b+30>>1]<<16;I[c+28>>1]=f;I[c+30>>1]=f>>>16;c=c+32|0;b=b+32|0;if((n|0)!=(b|0))continue;break}ia:{if((c|0)!=(d|0)){J[g+32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0;b=c-d|0;h=b>>2;if(h>>>0>=268435456){J[195395]=0;ea(2056,g+24|0);a=J[195395];J[195395]=0;if((a|0)!=1)break _;break ba}J[195395]=0;f=b<<2;b=_(1078,f|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break ba;J[g+24>>2]=b;J[g+
-32>>2]=(h<<4)+b;c=0;l=Nb(b,0,f);J[g+28>>2]=l+f;f=h>>>0<=1?1:h;n=f&1;if(h>>>0>=2){j=f&-2;i=0;while(1){h=l+(c<<4)|0;f=(c<<2)+d|0;O[h>>3]=I[f>>1];O[h+8>>3]=I[f+2>>1];f=c|1;h=l+(f<<4)|0;f=(f<<2)+d|0;O[h>>3]=I[f>>1];O[h+8>>3]=I[f+2>>1];c=c+2|0;i=i+2|0;if((j|0)!=(i|0))continue;break}}if(!n)break ia;f=l+(c<<4)|0;c=(c<<2)+d|0;O[f>>3]=I[c>>1];O[f+8>>3]=I[c+2>>1];break ia}b=0;J[g+32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0}J[g+16>>2]=d;Kb(d);q=O[b+8>>3];k=O[b>>3];J[195395]=0;qa(2057,a|0,+k,+q);c=J[195395];J[195395]=
-0;b=1;if((c|0)==1)break ca;if(t>>>0>1)while(1){c=J[g+24>>2]+(b<<4)|0;z=O[c+16>>3];A=O[c+24>>3];y=O[c+32>>3];w=O[c+40>>3];q=O[c>>3];k=O[c+8>>3];J[195395]=0;if(R(k)<2147483648)d=~~k;else d=-2147483648;if(R(q)<2147483648)c=~~q;else c=-2147483648;if(R(w)<2147483648)i=~~w;else i=-2147483648;if(R(y)<2147483648)h=~~y;else h=-2147483648;if(R(A)<2147483648)f=~~A;else f=-2147483648;if(R(z)<2147483648)j=~~z;else j=-2147483648;oa(2058,a|0,c|0,d|0,j|0,f|0,h|0,i|0);c=J[195395];J[195395]=0;if((c|0)==1)break ca;
-b=b+3|0;if(t>>>0>b>>>0)continue;break}J[195395]=0;ea(2052,a|0);b=J[195395];J[195395]=0;if((b|0)==1)break ca;J[195395]=0;ia(2059,a|0,1,0,1);b=J[195395];J[195395]=0;if((b|0)==1)break ca;c=J[a+208>>2];if(c){b=J[J[c>>2]+516>>2];J[195395]=0;Ua(b|0,c|0,o|0,+r,g+24|0);b=J[195395];J[195395]=0;if((b|0)==1)break ca}b=J[a+120>>2];J[195395]=0;if((m|0)==J[b+24>>2])J[b+24>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break ca;b=J[g+24>>2];if(!b)break fa;J[g+28>>2]=b;Kb(b)}Kb(e)}xb=g+48|0;break Z}c=Z()|0;d=J[g+24>>
-2];if(!d)break l;J[g+28>>2]=d;break $}c=Z()|0;a=J[g+24>>2];if(a){J[g+28>>2]=a;Kb(a)}J[g+16>>2]=d;break $}c=Z()|0;d=J[g+12>>2];if(!d)break l;J[g+16>>2]=d}Kb(d);break l}B()}i=0;D=0;u=0;r=0;g=xb-48|0;xb=g;j=J[a>>2]-12|0;d=J[j>>2];h=d+a|0;c=J[h+12>>2];e=J[h+16>>2];if(e>>>0>c+3>>>0){f=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[h+12>>2]=c+4;d=J[j>>2];c=d+a|0;e=J[c+16>>2];r=+(x(2,f),C());c=J[c+12>>2]}f=b&65535;ja:{ka:{la:{ma:{na:{oa:{pa:{if(c+3>>>0>=e>>>0)break pa;p=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|
-K[c+3|0]<<24);J[(a+d|0)+12>>2]=c+4;if(p>>>0<3)break pa;J[g+44>>2]=0;J[g+36>>2]=0;J[g+40>>2]=0;if(p>>>0>=268435456){J[195395]=0;ea(2056,g+36|0);a=J[195395];J[195395]=0;if((a|0)==1)break m;break ka}J[195395]=0;o=p<<4;c=_(1078,o|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break m;l=f&255;d=0;e=Nb(c,0,o);m=o+e|0;while(1){h=J[j>>2]+a|0;b=J[h+12>>2];f=J[h+16>>2];if(b+3>>>0>=f>>>0)k=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[h+12>>2]=b;k=+(x(2,c),C())}O[e>>3]=k;if(f>>>0>b+3>>>0){c=K[b|
-0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[h+12>>2]=b+4;k=+(x(2,c),C())}else k=0;O[e+8>>3]=k;d=d+1|0;if((p|0)!=(d|0))continue;break}d=a+236|0;c=J[d>>2];qa:{if(!c)break qa;b=d;while(1){f=l>>>0>M[c+16>>2];b=f?b:c;c=J[(f?c+4|0:c)>>2];if(c)continue;break}if((b|0)==(d|0)|l>>>0>2])break qa;d=J[b+20>>2];c=J[J[d>>2]+12>>2];J[195395]=0;d=_(c|0,d|0)|0;c=J[195395];J[195395]=0;ra:{if((c|0)!=1){if((d|0)!=2)break qa;c=J[b+20>>2];if(!c)break qa;b=J[a+120>>2];J[195395]=0;n=c+4|0;J[b+24>>2]=n;b=J[195395];
-J[195395]=0;if((b|0)!=1)break ra}c=Z()|0;break l}J[g+20>>2]=0;J[g+12>>2]=0;J[g+16>>2]=0;c=o>>4;if(c>>>0>=268435456){J[195395]=0;ea(2056,g+12|0);a=J[195395];J[195395]=0;if((a|0)!=1)break ka;break ma}v=0;J[195395]=0;d=_(1078,o|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break ma;J[g+16>>2]=d;J[g+12>>2]=d;J[g+20>>2]=(c<<4)+d;j=o-16|0;h=(j>>>4|0)+1&3;sa:{if(!h){b=e;c=d;break sa}b=e;c=d;while(1){f=J[b+4>>2];J[c>>2]=J[b>>2];J[c+4>>2]=f;f=J[b+12>>2];J[c+8>>2]=J[b+8>>2];J[c+12>>2]=f;c=c+16|0;b=b+16|0;v=v+1|
-0;if((h|0)!=(v|0))continue;break}}if(j>>>0>=48)while(1){f=J[b+4>>2];J[c>>2]=J[b>>2];J[c+4>>2]=f;f=J[b+12>>2];J[c+8>>2]=J[b+8>>2];J[c+12>>2]=f;f=J[b+28>>2];J[c+24>>2]=J[b+24>>2];J[c+28>>2]=f;f=J[b+20>>2];J[c+16>>2]=J[b+16>>2];J[c+20>>2]=f;f=J[b+44>>2];J[c+40>>2]=J[b+40>>2];J[c+44>>2]=f;f=J[b+36>>2];J[c+32>>2]=J[b+32>>2];J[c+36>>2]=f;f=J[b+52>>2];J[c+48>>2]=J[b+48>>2];J[c+52>>2]=f;f=J[b+60>>2];J[c+56>>2]=J[b+56>>2];J[c+60>>2]=f;c=c- -64|0;b=b- -64|0;if((m|0)!=(b|0))continue;break}ta:{if((c|0)!=(d|0)){J[g+
-32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0;c=c-d|0;f=c>>4;if(f>>>0>=268435456){J[195395]=0;ea(2056,g+24|0);a=J[195395];J[195395]=0;if((a|0)!=1)break ka;break na}J[195395]=0;i=_(1078,c|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break na;J[g+24>>2]=i;J[g+32>>2]=(f<<4)+i;t=Nb(i,0,c);J[g+28>>2]=t+c;b=f>>>0<=1?1:f;j=b&3;c=0;if(f>>>0>=4){h=b&-4;while(1){o=c<<4;f=o+t|0;m=d+o|0;b=J[m+4>>2];J[f>>2]=J[m>>2];J[f+4>>2]=b;b=J[m+12>>2];J[f+8>>2]=J[m+8>>2];J[f+12>>2]=b;b=o|16;f=b+t|0;m=b+d|0;b=J[m+12>>2];J[f+8>>2]=J[m+8>>
-2];J[f+12>>2]=b;b=J[m+4>>2];J[f>>2]=J[m>>2];J[f+4>>2]=b;b=o|32;f=b+t|0;m=b+d|0;b=J[m+12>>2];J[f+8>>2]=J[m+8>>2];J[f+12>>2]=b;b=J[m+4>>2];J[f>>2]=J[m>>2];J[f+4>>2]=b;b=o|48;f=b+t|0;m=b+d|0;b=J[m+12>>2];J[f+8>>2]=J[m+8>>2];J[f+12>>2]=b;b=J[m+4>>2];J[f>>2]=J[m>>2];J[f+4>>2]=b;c=c+4|0;u=u+4|0;if((h|0)!=(u|0))continue;break}}if(!j)break ta;while(1){b=c<<4;f=b+t|0;h=b+d|0;b=J[h+4>>2];J[f>>2]=J[h>>2];J[f+4>>2]=b;b=J[h+12>>2];J[f+8>>2]=J[h+8>>2];J[f+12>>2]=b;c=c+1|0;D=D+1|0;if((j|0)!=(D|0))continue;break}break ta}J[g+
-32>>2]=0;J[g+24>>2]=0;J[g+28>>2]=0}J[g+16>>2]=d;Kb(d);q=O[i+8>>3];k=O[i>>3];J[195395]=0;qa(2057,a|0,+k,+q);c=J[195395];J[195395]=0;b=1;if((c|0)==1)break oa;if(p>>>0>1)while(1){c=J[g+24>>2]+(b<<4)|0;z=O[c+16>>3];A=O[c+24>>3];y=O[c+32>>3];w=O[c+40>>3];q=O[c>>3];k=O[c+8>>3];J[195395]=0;if(R(k)<2147483648)d=~~k;else d=-2147483648;if(R(q)<2147483648)c=~~q;else c=-2147483648;if(R(w)<2147483648)i=~~w;else i=-2147483648;if(R(y)<2147483648)h=~~y;else h=-2147483648;if(R(A)<2147483648)f=~~A;else f=-2147483648;
-if(R(z)<2147483648)j=~~z;else j=-2147483648;oa(2058,a|0,c|0,d|0,j|0,f|0,h|0,i|0);c=J[195395];J[195395]=0;if((c|0)==1)break oa;b=b+3|0;if(p>>>0>b>>>0)continue;break}J[195395]=0;ea(2052,a|0);b=J[195395];J[195395]=0;if((b|0)==1)break oa;J[195395]=0;ia(2059,a|0,1,0,1);b=J[195395];J[195395]=0;if((b|0)==1)break oa;c=J[a+208>>2];if(c){b=J[J[c>>2]+516>>2];J[195395]=0;Ua(b|0,c|0,l|0,+r,g+24|0);b=J[195395];J[195395]=0;if((b|0)==1)break oa}b=J[a+120>>2];J[195395]=0;if((n|0)==J[b+24>>2])J[b+24>>2]=0;b=J[195395];
-J[195395]=0;if((b|0)==1)break oa;b=J[g+24>>2];if(!b)break qa;J[g+28>>2]=b;Kb(b)}Kb(e)}xb=g+48|0;break ja}c=Z()|0;d=J[g+24>>2];if(!d)break l;J[g+28>>2]=d;break la}c=Z()|0;a=J[g+24>>2];if(a){J[g+28>>2]=a;Kb(a)}J[g+16>>2]=d;break la}c=Z()|0;d=J[g+12>>2];if(!d)break l;J[g+16>>2]=d}Kb(d);break l}B()}}H[a+213|0]=1;break p;case 23:ua:{if(b&16384){f=b&65535;e=0;g=0;r=0;D=0;u=0;o=xb-48|0;xb=o;j=J[a>>2]-12|0;p=J[j>>2];h=p+a|0;c=J[h+12>>2];b=J[h+16>>2];if(b>>>0>c+3>>>0){d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+
-3|0]<<24);J[h+12>>2]=c+4;p=J[j>>2];c=p+a|0;b=J[c+16>>2];r=+(x(2,d),C());c=J[c+12>>2]}if(c+3>>>0>>0){u=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+p|0)+12>>2]=c+4;p=J[j>>2];c=p+a|0;b=J[c+16>>2];c=J[c+12>>2]}if(c+3>>>0>>0){D=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+p|0)+12>>2]=c+4;p=J[j>>2];c=p+a|0;b=J[c+16>>2];c=J[c+12>>2]}va:{wa:{if(c+3>>>0>=b>>>0){J[o+40>>2]=0;break wa}d=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+p|0)+12>>2]=c+4;J[o+44>>2]=0;J[o+36>>2]=0;J[o+40>>
-2]=0;if(!d)break wa;xa:{ya:{if(d>>>0>=1073741824){J[195395]=0;ea(2054,o+36|0);a=J[195395];J[195395]=0;if((a|0)==1)break ya;break va}J[195395]=0;c=d<<2;e=_(1078,c|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break xa}c=Z()|0;a=J[o+36>>2];if(!a)break k;J[o+40>>2]=a;Kb(a);break k}J[o+36>>2]=e;b=c+e|0;J[o+44>>2]=b;h=Nb(e,0,c);J[o+40>>2]=b;while(1){p=0;i=J[j>>2]+a|0;b=J[i+12>>2];c=J[i+16>>2];za:{if(b+1>>>0>=c>>>0){v=0;break za}v=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[i+12>>2]=b}I[h>>1]=v;if(c>>>0>b+1>>>0){p=K[b|0]|
-K[b+1|0]<<8;J[i+12>>2]=b+2}I[h+2>>1]=p;g=g+1|0;if((d|0)!=(g|0))continue;break}g=d}Aa:{Ba:{Ca:{Da:{Ea:{d=a+236|0;c=J[d>>2];Fa:{if(!c)break Fa;l=f&255;b=d;while(1){f=l>>>0>M[c+16>>2];b=f?b:c;c=J[(f?c+4|0:c)>>2];if(c)continue;break}if((b|0)==(d|0)|l>>>0>2])break Fa;d=J[b+20>>2];c=J[J[d>>2]+12>>2];J[195395]=0;d=_(c|0,d|0)|0;c=J[195395];J[195395]=0;Ga:{if((c|0)!=1){if((d|0)!=2)break Fa;c=J[b+20>>2];if(!c)break Fa;b=J[a+120>>2];J[195395]=0;n=c+4|0;J[b+24>>2]=n;b=J[195395];J[195395]=0;if((b|0)!=
-1)break Ga}c=Z()|0;break Aa}J[o+20>>2]=0;J[o+12>>2]=0;J[o+16>>2]=0;h=J[o+40>>2];b=h-e|0;c=b>>2;if(c>>>0>=1073741824){J[195395]=0;ea(2054,o+12|0);a=J[195395];J[195395]=0;if((a|0)!=1)break va;break Ca}J[195395]=0;d=_(1078,b|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Ca;J[o+16>>2]=d;J[o+12>>2]=d;J[o+20>>2]=(c<<2)+d;b=e;c=d;while(1){f=L[b>>1]|L[b+2>>1]<<16;I[c>>1]=f;I[c+2>>1]=f>>>16;c=c+4|0;b=b+4|0;if((h|0)!=(b|0))continue;break}Ha:{if((c|0)!=(d|0)){J[o+32>>2]=0;J[o+24>>2]=0;J[o+28>>2]=0;b=c-d|0;
-h=b>>2;if(h>>>0>=268435456){J[195395]=0;ea(2056,o+24|0);a=J[195395];J[195395]=0;if((a|0)!=1)break va;break Da}J[195395]=0;f=b<<2;b=_(1078,f|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break Da;J[o+24>>2]=b;J[o+32>>2]=(h<<4)+b;c=0;m=Nb(b,0,f);J[o+28>>2]=m+f;f=h>>>0<=1?1:h;j=f&1;if(h>>>0>=2){i=f&-2;p=0;while(1){h=m+(c<<4)|0;f=(c<<2)+d|0;O[h>>3]=I[f>>1];O[h+8>>3]=I[f+2>>1];f=c|1;h=m+(f<<4)|0;f=(f<<2)+d|0;O[h>>3]=I[f>>1];O[h+8>>3]=I[f+2>>1];c=c+2|0;p=p+2|0;if((i|0)!=(p|0))continue;break}}if(!j)break Ha;
-f=m+(c<<4)|0;c=(c<<2)+d|0;O[f>>3]=I[c>>1];O[f+8>>3]=I[c+2>>1];break Ha}b=0;J[o+32>>2]=0;J[o+24>>2]=0;J[o+28>>2]=0}J[o+16>>2]=d;Kb(d);q=O[b+8>>3];k=O[b>>3];J[195395]=0;qa(2057,a|0,+k,+q);c=J[195395];J[195395]=0;b=1;if((c|0)==1)break Ea;if(g>>>0>1)while(1){c=J[o+24>>2]+(b<<4)|0;z=O[c+16>>3];A=O[c+24>>3];y=O[c+32>>3];w=O[c+40>>3];q=O[c>>3];k=O[c+8>>3];J[195395]=0;if(R(k)<2147483648)d=~~k;else d=-2147483648;if(R(q)<2147483648)c=~~q;else c=-2147483648;if(R(w)<2147483648)i=~~w;else i=-2147483648;if(R(y)<
-2147483648)h=~~y;else h=-2147483648;if(R(A)<2147483648)f=~~A;else f=-2147483648;if(R(z)<2147483648)j=~~z;else j=-2147483648;oa(2058,a|0,c|0,d|0,j|0,f|0,h|0,i|0);c=J[195395];J[195395]=0;if((c|0)==1)break Ea;b=b+3|0;if(g>>>0>b>>>0)continue;break}J[195395]=0;ia(2059,a|0,1,0,1);b=J[195395];J[195395]=0;if((b|0)==1)break Ea;c=J[a+208>>2];if(c){b=J[J[c>>2]+520>>2];J[195395]=0;Ta(b|0,c|0,l|0,+r,u|0,D|0,o+24|0);b=J[195395];J[195395]=0;if((b|0)==1)break Ea}b=J[a+120>>2];J[195395]=0;if((n|0)==J[b+24>>2])J[b+
-24>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Ea;b=J[o+24>>2];if(!b)break Fa;J[o+28>>2]=b;Kb(b)}if(e){J[o+40>>2]=e;Kb(e)}xb=o+48|0;break ua}c=Z()|0;d=J[o+24>>2];if(!d)break Aa;J[o+28>>2]=d;break Ba}c=Z()|0;a=J[o+24>>2];if(a){J[o+28>>2]=a;Kb(a)}J[o+16>>2]=d;break Ba}c=Z()|0;d=J[o+12>>2];if(!d)break Aa;J[o+16>>2]=d}Kb(d)}if(!e)break k;J[o+40>>2]=e;break l}B()}j=b&65535;i=0;r=0;D=0;u=0;s=xb-48|0;xb=s;n=J[a>>2]-12|0;d=J[n>>2];g=d+a|0;c=J[g+12>>2];b=J[g+16>>2];if(b>>>0>c+3>>>0){e=K[c|0]|K[c+1|0]<<
-8|(K[c+2|0]<<16|K[c+3|0]<<24);J[g+12>>2]=c+4;d=J[n>>2];c=d+a|0;b=J[c+16>>2];r=+(x(2,e),C());c=J[c+12>>2]}if(c+3>>>0>>0){u=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+d|0)+12>>2]=c+4;d=J[n>>2];c=d+a|0;b=J[c+16>>2];c=J[c+12>>2]}if(c+3>>>0>>0){D=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+d|0)+12>>2]=c+4;d=J[n>>2];c=d+a|0;b=J[c+16>>2];c=J[c+12>>2]}Ia:{Ja:{Ka:{La:{if(c+3>>>0>=b>>>0){J[s+40>>2]=0;break La}g=K[c|0]|K[c+1|0]<<8|(K[c+2|0]<<16|K[c+3|0]<<24);J[(a+d|0)+12>>2]=c+4;J[s+44>>
-2]=0;J[s+36>>2]=0;J[s+40>>2]=0;if(!g)break La;Ma:{Na:{if(g>>>0>=268435456){J[195395]=0;ea(2056,s+36|0);a=J[195395];J[195395]=0;if((a|0)==1)break Na;break Ja}d=0;J[195395]=0;c=g<<4;e=_(1078,c|0)|0;b=J[195395];J[195395]=0;if((b|0)!=1)break Ma}c=Z()|0;a=J[s+36>>2];if(!a)break k;J[s+40>>2]=a;Kb(a);break k}b=c;c=Nb(e,0,c);J[s+40>>2]=b+c;while(1){i=J[n>>2]+a|0;b=J[i+12>>2];h=J[i+16>>2];if(b+3>>>0>=h>>>0)k=0;else{f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[i+12>>2]=b;k=+(x(2,f),C())}O[c>>
-3]=k;if(h>>>0>b+3>>>0){f=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[i+12>>2]=b+4;k=+(x(2,f),C())}else k=0;O[c+8>>3]=k;d=d+1|0;if((g|0)!=(d|0))continue;break}i=g;break Ka}e=0}Oa:{Pa:{Qa:{Ra:{Sa:{d=a+236|0;c=J[d>>2];Ta:{if(!c)break Ta;o=j&255;b=d;while(1){g=o>>>0>M[c+16>>2];b=g?b:c;c=J[(g?c+4|0:c)>>2];if(c)continue;break}if((b|0)==(d|0)|o>>>0>2])break Ta;d=J[b+20>>2];c=J[J[d>>2]+12>>2];J[195395]=0;d=_(c|0,d|0)|0;c=J[195395];J[195395]=0;Ua:{if((c|0)!=1){if((d|0)!=2)break Ta;c=J[b+20>>2];
-if(!c)break Ta;b=J[a+120>>2];J[195395]=0;j=c+4|0;J[b+24>>2]=j;b=J[195395];J[195395]=0;if((b|0)!=1)break Ua}c=Z()|0;break Oa}J[s+20>>2]=0;J[s+12>>2]=0;J[s+16>>2]=0;f=J[s+40>>2];b=f-e|0;c=b>>4;if(c>>>0>=268435456){J[195395]=0;ea(2056,s+12|0);a=J[195395];J[195395]=0;if((a|0)!=1)break Ja;break Qa}J[195395]=0;d=_(1078,b|0)|0;b=J[195395];J[195395]=0;if((b|0)==1)break Qa;J[s+16>>2]=d;J[s+12>>2]=d;J[s+20>>2]=(c<<4)+d;b=e;c=d;while(1){g=J[b+4>>2];J[c>>2]=J[b>>2];J[c+4>>2]=g;g=J[b+12>>2];J[c+8>>2]=J[b+8>>2];
-J[c+12>>2]=g;c=c+16|0;b=b+16|0;if((f|0)!=(b|0))continue;break}Va:{if((c|0)!=(d|0)){J[s+32>>2]=0;J[s+24>>2]=0;J[s+28>>2]=0;g=c-d|0;f=g>>4;if(f>>>0>=268435456){J[195395]=0;ea(2056,s+24|0);a=J[195395];J[195395]=0;if((a|0)!=1)break Ja;break Ra}J[195395]=0;b=_(1078,g|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break Ra;J[s+24>>2]=b;J[s+32>>2]=(f<<4)+b;v=0;p=Nb(b,0,g);J[s+28>>2]=p+g;g=f>>>0<=1?1:f;m=g&3;c=0;if(f>>>0>=4){h=g&-4;n=0;while(1){t=c<<4;f=t+p|0;l=d+t|0;g=J[l+4>>2];J[f>>2]=J[l>>2];J[f+4>>2]=g;g=J[l+
-12>>2];J[f+8>>2]=J[l+8>>2];J[f+12>>2]=g;g=t|16;f=g+p|0;l=d+g|0;g=J[l+12>>2];J[f+8>>2]=J[l+8>>2];J[f+12>>2]=g;g=J[l+4>>2];J[f>>2]=J[l>>2];J[f+4>>2]=g;g=t|32;f=g+p|0;l=d+g|0;g=J[l+12>>2];J[f+8>>2]=J[l+8>>2];J[f+12>>2]=g;g=J[l+4>>2];J[f>>2]=J[l>>2];J[f+4>>2]=g;g=t|48;f=g+p|0;l=d+g|0;g=J[l+12>>2];J[f+8>>2]=J[l+8>>2];J[f+12>>2]=g;g=J[l+4>>2];J[f>>2]=J[l>>2];J[f+4>>2]=g;c=c+4|0;n=n+4|0;if((h|0)!=(n|0))continue;break}}if(!m)break Va;while(1){g=c<<4;f=g+p|0;h=d+g|0;g=J[h+4>>2];J[f>>2]=J[h>>2];J[f+4>>2]=g;
-g=J[h+12>>2];J[f+8>>2]=J[h+8>>2];J[f+12>>2]=g;c=c+1|0;v=v+1|0;if((m|0)!=(v|0))continue;break}break Va}b=0;J[s+32>>2]=0;J[s+24>>2]=0;J[s+28>>2]=0}J[s+16>>2]=d;Kb(d);q=O[b+8>>3];k=O[b>>3];J[195395]=0;qa(2057,a|0,+k,+q);c=J[195395];J[195395]=0;b=1;if((c|0)==1)break Sa;if(i>>>0>1)while(1){c=J[s+24>>2]+(b<<4)|0;z=O[c+16>>3];A=O[c+24>>3];y=O[c+32>>3];w=O[c+40>>3];q=O[c>>3];k=O[c+8>>3];J[195395]=0;if(R(k)<2147483648)d=~~k;else d=-2147483648;if(R(q)<2147483648)c=~~q;else c=-2147483648;if(R(w)<2147483648)h=
-~~w;else h=-2147483648;if(R(y)<2147483648)f=~~y;else f=-2147483648;if(R(A)<2147483648)g=~~A;else g=-2147483648;if(R(z)<2147483648)l=~~z;else l=-2147483648;oa(2058,a|0,c|0,d|0,l|0,g|0,f|0,h|0);c=J[195395];J[195395]=0;if((c|0)==1)break Sa;b=b+3|0;if(i>>>0>b>>>0)continue;break}J[195395]=0;ia(2059,a|0,1,0,1);b=J[195395];J[195395]=0;if((b|0)==1)break Sa;c=J[a+208>>2];if(c){b=J[J[c>>2]+520>>2];J[195395]=0;Ta(b|0,c|0,o|0,+r,u|0,D|0,s+24|0);b=J[195395];J[195395]=0;if((b|0)==1)break Sa}b=J[a+120>>2];J[195395]=
-0;if((j|0)==J[b+24>>2])J[b+24>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Sa;b=J[s+24>>2];if(!b)break Ta;J[s+28>>2]=b;Kb(b)}if(e){J[s+40>>2]=e;Kb(e)}xb=s+48|0;break Ia}c=Z()|0;d=J[s+24>>2];if(!d)break Oa;J[s+28>>2]=d;break Pa}c=Z()|0;a=J[s+24>>2];if(a){J[s+28>>2]=a;Kb(a)}J[s+16>>2]=d;break Pa}c=Z()|0;d=J[s+12>>2];if(!d)break Oa;J[s+16>>2]=d}Kb(d)}if(!e)break k;J[s+40>>2]=e;break l}B()}}H[a+213|0]=1;break p;case 53:n=b&65535;g=0;v=0;D=0;l=xb-112|0;xb=l;f=J[a>>2]-12|0;c=J[f>>2];e=c+a|0;d=J[e+12>>
-2];b=J[e+16>>2];if(b>>>0>d+3>>>0){g=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[e+12>>2]=d+4;c=J[f>>2];e=c+a|0;b=J[e+16>>2];d=J[e+12>>2]}if(d+3>>>0>>0){D=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[(a+c|0)+12>>2]=d+4;c=J[f>>2];e=c+a|0;b=J[e+16>>2];d=J[e+12>>2]}if(d+3>>>0>>0){v=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<24);J[(a+c|0)+12>>2]=d+4;c=J[f>>2];e=c+a|0;b=J[e+16>>2];d=J[e+12>>2]}Wa:{Xa:{Ya:{Za:{_a:{$a:{if(d+3>>>0>=b>>>0)break $a;m=K[d|0]|K[d+1|0]<<8|(K[d+2|0]<<16|K[d+3|0]<<
-24);J[(a+c|0)+12>>2]=d+4;if(!m)break $a;d=0;b=m+1|0;j=Pb((b|0)<0?-1:b<<1);I[j+(m<<1)>>1]=0;i=J[f>>2]+a|0;h=J[i+16>>2];b=J[i+12>>2];c=h-b|0;e=(c|0)/2|0;ab:{if(c+1>>>0<3)break ab;c=e>>>0>>0?e:m;f=c&1;if((c|0)!=1){e=c&-2;s=0;while(1){bb:{if(h>>>0<=b+1>>>0){c=0;break bb}c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[i+12>>2]=b}I[j+(d<<1)>>1]=c;c=0;if(h>>>0>b+1>>>0){c=K[b|0]|K[b+1|0]<<8;b=b+2|0;J[i+12>>2]=b}I[j+((d|1)<<1)>>1]=c;d=d+2|0;s=s+2|0;if((e|0)!=(s|0))continue;break}}if(!f)break ab;c=0;if(h>>>0>b+1>>>0){c=
-K[b|0]|K[b+1|0]<<8;J[i+12>>2]=b+2}I[j+(d<<1)>>1]=c}J[l+104>>2]=0;J[l+96>>2]=0;J[l+100>>2]=0;J[195395]=0;fa(2061,l+32|0,j|0,m|0);b=J[195395];J[195395]=0;if((b|0)==1)break _a;if(H[l+107|0]<0)Kb(J[l+96>>2]);J[l+104>>2]=J[l+40>>2];b=J[l+36>>2];J[l+96>>2]=J[l+32>>2];J[l+100>>2]=b;Kb(j);J[195395]=0;fa(2062,l+84|0,a|0,m|0);b=J[195395];J[195395]=0;cb:{db:{eb:{fb:{if((b|0)!=1){if((v|0)==1){J[195395]=0;J[l+40>>2]=0;J[l+44>>2]=0;J[l+32>>2]=0;J[l+36>>2]=1072693248;J[l+64>>2]=0;J[l+68>>2]=0;J[l+56>>2]=0;J[l+60>>
-2]=1072693248;J[l+48>>2]=0;J[l+52>>2]=0;J[l+72>>2]=0;J[l+76>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break fb;j=J[J[a>>2]-12>>2]+a|0;b=J[j+12>>2];m=J[j+16>>2];h=b+3>>>0>>0;b=(h<<2)+b|0;f=b+3>>>0>>0;b=(f<<2)+b|0;d=b+3>>>0>>0;b=(d<<2)+b|0;e=b+3>>>0>>0;b=(e<<2)+b|0;c=b+3>>>0>>0;b=(c<<2)+b|0;i=b+3|0;gb:{hb:{if(f|h|(d|e))break hb;if(c)break hb;if(i>>>0>=m>>>0)break gb}J[j+12>>2]=b+((i>>>0>>0)<<2)}H[a+213|0]=1}d=J[l+84>>2];if(!J[a+208>>2])break cb;b=K[l+107|0];h=b<<24>>24<0?J[l+100>>
-2]:b;c=J[l+88>>2];f=c-d|0;if((h|0)!=f>>4)break cb;J[l+28>>2]=0;J[l+20>>2]=0;J[l+24>>2]=0;if((c|0)==(d|0))break db;if(h>>>0<268435456)break eb;J[195395]=0;ea(1813,l+20|0);a=J[195395];J[195395]=0;if((a|0)==1)break Za;B()}d=Z()|0;break Xa}d=Z()|0;break Ya}b=0;J[195395]=0;e=_(1078,f|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break Za;J[l+20>>2]=e;J[l+28>>2]=e+(h<<4);m=Nb(e,0,f);J[l+24>>2]=m+f;c=h>>>0<=1?1:h;i=c&1;if(h>>>0>=2){h=c&-2;c=0;while(1){j=b<<4;f=j+m|0;e=d+j|0;O[f>>3]=O[e>>3];O[f+8>>3]=O[e+8>>3];
-e=j|16;f=e+m|0;e=d+e|0;O[f>>3]=O[e>>3];O[f+8>>3]=O[e+8>>3];b=b+2|0;c=c+2|0;if((h|0)!=(c|0))continue;break}}if(!i)break db;b=b<<4;c=b+m|0;b=b+d|0;O[c>>3]=O[b>>3];O[c+8>>3]=O[b+8>>3]}c=a+236|0;d=J[c>>2];ib:{if(!d)break ib;h=n&255;b=c;while(1){e=h>>>0>M[d+16>>2];b=e?b:d;d=J[(e?d+4|0:d)>>2];if(d)continue;break}if((b|0)==(c|0)|h>>>0>2])break ib;d=J[b+20>>2];e=J[J[d>>2]+12>>2];J[195395]=0;d=_(e|0,d|0)|0;e=J[195395];J[195395]=0;if((e|0)==1)break Za;if((d|0)!=6)break ib;e=J[b+20>>2];if(!e)break ib;
-b=J[a+120>>2];J[195395]=0;f=e+4|0;J[b+28>>2]=f;b=J[195395];J[195395]=0;if((b|0)==1)break Za;jb:{if(n<<16>>16<0){J[195395]=0;e=l+16|0;H[e|0]=0;H[e+1|0]=0;H[e+2|0]=0;H[e+3|0]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Za;H[e+3|0]=g>>>24;H[e|0]=g>>>16;b=g<<8|(g&65280)>>>8;H[e+1|0]=b;H[e+2|0]=b>>>8;c=J[a+120>>2];J[195395]=0;b=J[195395];J[195395]=0;kb:{if((b|0)==1)break kb;J[195395]=0;H[l+12|0]=K[c+600|0];H[l+13|0]=K[c+601|0];H[l+14|0]=K[c+602|0];H[l+15|0]=K[c+603|0];b=J[195395];J[195395]=0;if((b|0)==
-1)break kb;b=J[a+120>>2];J[195395]=0;H[b+600|0]=K[e|0];H[b+601|0]=K[e+1|0];H[b+602|0]=K[e+2|0];H[b+603|0]=K[e+3|0];b=J[195395];J[195395]=0;if((b|0)==1)break kb;c=J[a+208>>2];b=J[J[c>>2]+24>>2];J[195395]=0;d=l+96|0;e=l+20|0;fa(b|0,c|0,d|0,e|0);b=J[195395];J[195395]=0;if((b|0)==1)break kb;c=J[a+208>>2];b=J[J[c>>2]+524>>2];J[195395]=0;Ia(b|0,c|0,h|0,g|0,D|0,v|0,0,d|0,e|0);b=J[195395];J[195395]=0;if((b|0)==1)break kb;b=J[a+120>>2];J[195395]=0;H[b+600|0]=K[l+12|0];H[b+601|0]=K[l+13|0];H[b+602|0]=K[l+14|
-0];H[b+603|0]=K[l+15|0];b=J[195395];J[195395]=0;if((b|0)!=1)break jb}break Za}d=J[c>>2];if(!d)break ib;b=c;while(1){e=M[d+16>>2]>>0;b=e?b:d;d=J[(e?d+4|0:d)>>2];if(d)continue;break}if((b|0)==(c|0)|M[b+16>>2]>g>>>0)break ib;e=J[b+20>>2];c=J[J[e>>2]+12>>2];J[195395]=0;e=_(c|0,e|0)|0;c=J[195395];J[195395]=0;if((c|0)==1)break Za;if((e|0)!=1)break ib;c=J[b+20>>2];if(!c)break ib;J[195395]=0;e=l+16|0;H[e|0]=0;H[e+1|0]=0;H[e+2|0]=0;H[e+3|0]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Za;H[e+2|0]=K[c+8|
-0];H[e+1|0]=K[c+9|0];H[e|0]=K[c+10|0];H[e+3|0]=K[c+11|0];c=J[a+120>>2];J[195395]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Za;J[195395]=0;H[l+12|0]=K[c+600|0];H[l+13|0]=K[c+601|0];H[l+14|0]=K[c+602|0];H[l+15|0]=K[c+603|0];b=J[195395];J[195395]=0;if((b|0)==1)break Za;b=J[a+120>>2];J[195395]=0;H[b+600|0]=K[e|0];H[b+601|0]=K[e+1|0];H[b+602|0]=K[e+2|0];H[b+603|0]=K[e+3|0];b=J[195395];J[195395]=0;if((b|0)==1)break Za;c=J[a+208>>2];b=J[J[c>>2]+24>>2];J[195395]=0;d=c;e=l+96|0;c=l+20|0;fa(b|0,d|0,e|0,c|
-0);b=J[195395];J[195395]=0;if((b|0)==1)break Za;d=J[a+208>>2];if(d){b=J[J[d>>2]+524>>2];J[195395]=0;Ia(b|0,d|0,h|0,g|0,D|0,v|0,0,e|0,c|0);b=J[195395];J[195395]=0;if((b|0)==1)break Za}b=J[a+120>>2];J[195395]=0;H[b+600|0]=K[l+12|0];H[b+601|0]=K[l+13|0];H[b+602|0]=K[l+14|0];H[b+603|0]=K[l+15|0];b=J[195395];J[195395]=0;if((b|0)==1)break Za}b=J[a+120>>2];J[195395]=0;if((f|0)==J[b+28>>2])J[b+28>>2]=0;b=J[195395];J[195395]=0;if((b|0)==1)break Za;H[a+213|0]=1}b=J[l+20>>2];if(b){J[l+24>>2]=b;Kb(b)}d=J[l+84>>
-2]}if(d){J[l+88>>2]=d;Kb(d)}if(H[l+107|0]>=0)break $a;Kb(J[l+96>>2])}xb=l+112|0;break Wa}d=Z()|0;break Xa}d=Z()|0;a=J[l+20>>2];if(!a)break Ya;J[l+24>>2]=a;Kb(a)}a=J[l+84>>2];if(!a)break Xa;J[l+88>>2]=a;Kb(a)}if(H[l+107|0]<0)Kb(J[l+96>>2]);break i}break p;case 14:lb:{if(b&16384){g=b&65535;i=0;p=0;v=0;s=0;d=xb-32|0;xb=d;e=J[J[a>>2]-12>>2]+a|0;b=J[e+12>>2];c=J[e+16>>2];if(b+1>>>0>>0){p=(K[b|0]|K[b+1|0]<<8)<<16>>16;b=b+2|0;J[e+12>>2]=b}if(c>>>0>b+1>>>0){i=(K[b|0]|K[b+1|0]<<8)<<16>>16;b=b+2|0;J[e+12>>
-2]=b}if(c>>>0>b+1>>>0){s=(K[b|0]|K[b+1|0]<<8)<<16>>16;b=b+2|0;J[e+12>>2]=b}if(c>>>0>b+1>>>0){v=(K[b|0]|K[b+1|0]<<8)<<16>>16;J[e+12>>2]=b+2}c=a+236|0;e=J[c>>2];mb:{if(!e)break mb;n=g&255;b=c;while(1){g=n>>>0>M[e+16>>2];b=g?b:e;e=J[(g?e+4|0:e)>>2];if(e)continue;break}if((b|0)==(c|0)|n>>>0>2])break mb;c=J[b+20>>2];if((Ab[J[J[c>>2]+12>>2]](c)|0)!=2)break mb;j=J[b+20>>2];if(!j)break mb;b=J[j+28>>2];if(b)J[J[a+120>>2]+20>>2]=b+4;e=j+4|0;J[J[a+120>>2]+24>>2]=e;c=v<<16>>16;i=i<<16>>16;f=c+i|0;b=s<<
-16>>16;h=p<<16>>16;g=b+h|0;nb:{if(J[J[a+120>>2]+688>>2]==1){Dg(a,h,i,g,f,0,360);break nb}Dg(a,h,f,g,i,0,360)}Cg(a,1,0,1);g=J[a+208>>2];if(g){O[d+24>>3]=c|0;O[d+16>>3]=b|0;O[d+8>>3]=i|0;O[d>>3]=h|0;Ab[J[J[g>>2]+528>>2]](g,n,d)}c=J[j+28>>2];if(c){b=J[a+120>>2];if(J[b+20>>2]==(c+4|0))J[b+20>>2]=0}b=J[a+120>>2];if((e|0)==J[b+24>>2])J[b+24>>2]=0}break lb}g=b&65535;r=0;A=0;d=xb-32|0;xb=d;f=J[J[a>>2]-12>>2]+a|0;b=J[f+12>>2];e=J[f+16>>2];if(b+3>>>0>=e>>>0)q=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|
-0]<<24);b=b+4|0;J[f+12>>2]=b;q=+(x(2,c),C())}if(e>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b;r=+(x(2,c),C())}if(e>>>0<=b+3>>>0)k=0;else{c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);b=b+4|0;J[f+12>>2]=b;k=+(x(2,c),C())}if(e>>>0>b+3>>>0){c=K[b|0]|K[b+1|0]<<8|(K[b+2|0]<<16|K[b+3|0]<<24);J[f+12>>2]=b+4;A=+(x(2,c),C())}c=a+236|0;e=J[c>>2];ob:{if(!e)break ob;j=g&255;b=c;while(1){g=j>>>0>M[e+16>>2];b=g?b:e;e=J[(g?e+4|0:e)>>2];if(e)continue;break}if((b|0)==(c|0)|
-j>>>0