Compare commits
154 Commits
390e38acf6
...
0b78295460
Author | SHA1 | Date |
---|---|---|
yflory | 0b78295460 | |
yflory | afe186736b | |
David Benqué | 40d92a5423 | |
yflory | e6073c5684 | |
Weblate | 415dafc212 | |
Weblate | f702e7160d | |
Weblate | 97cafa6e46 | |
yflory | 528fd4ff97 | |
David Benqué | 9d4368e8cd | |
yflory | ca0bde068e | |
yflory | b4bb28ef19 | |
yflory | 90fc5ae4f1 | |
yflory | 6895fe0650 | |
yflory | 4de7c7f35a | |
David Benqué | 056bded891 | |
yflory | 19ebbbcfdd | |
yflory | b6804f98f4 | |
Weblate | c2209cbc87 | |
Weblate | dcb5da8e29 | |
Weblate | e3f7316272 | |
yflory | 33eca166e6 | |
yflory | dd0e77a74f | |
Weblate | eef7bacef3 | |
Weblate | a3ab9d7bbf | |
Weblate | 449f6e2d3a | |
ansuz | 0737baafca | |
ansuz | 31c5bba8db | |
ansuz | 519391c2db | |
ansuz | c10aee964a | |
ansuz | 4b602ce37f | |
ansuz | 7202b9576e | |
yflory | 25366b898b | |
yflory | 0b7844b523 | |
ansuz | f867784ee7 | |
ansuz | bf148ca92c | |
ansuz | eb4563b914 | |
ansuz | d70b0ed037 | |
ansuz | 4e3c0f32cf | |
ansuz | a2e6f0a1c4 | |
yflory | b050f04090 | |
yflory | 844a6a4b96 | |
yflory | 851419f5b8 | |
ansuz | 64094df5cc | |
ansuz | d2db0066a4 | |
yflory | a8537903ad | |
yflory | b349ab79a6 | |
ansuz | 0d31deb3fc | |
ansuz | 84757e8d88 | |
yflory | 2abe187f67 | |
ansuz | b8d6af7891 | |
ansuz | 3fd30a30f7 | |
ansuz | 747c1a28d0 | |
Weblate | a49783da5b | |
yflory | 73eb80ea30 | |
yflory | 2bc0131904 | |
yflory | 117eda8a04 | |
yflory | 6aa921bff2 | |
yflory | 694aa7eeea | |
yflory | de8fc84dcb | |
David Benqué | 065dfe54e2 | |
Weblate | 5164d53c01 | |
David Benqué | c71255bb0d | |
Weblate | 261d595401 | |
Weblate | e3f93cc241 | |
Weblate | 9fcfd9e829 | |
Weblate | 44bc45fdc0 | |
ansuz | 9b3a2fa609 | |
ansuz | b35c3e44ad | |
ansuz | 6ab6e94802 | |
David Benqué | 5173346b48 | |
David Benqué | b358337280 | |
yflory | 780c21a88f | |
yflory | eb16cd8b73 | |
David Benqué | cfba2b4557 | |
David Benqué | ebc03b12e3 | |
David Benqué | 2cf70bc754 | |
yflory | 75a8d1acba | |
Weblate | cf2c4c294a | |
Weblate | 3abba74ce6 | |
yflory | 60ce5a1399 | |
Weblate | bd2e79648f | |
Weblate | 07d4bc407b | |
David Benqué | 54cc6da763 | |
Weblate | 30f4da9913 | |
David Benqué | 68746171a6 | |
David Benqué | 95b7015481 | |
yflory | 06bef8ff9b | |
yflory | ccc67ce8b7 | |
yflory | e484eb0697 | |
David Benqué | 614250cc4c | |
yflory | bdfb4db13c | |
yflory | 62e7467a94 | |
yflory | f3cdf33daa | |
yflory | aa601db3ee | |
yflory | 7f40aa53d0 | |
yflory | 345a284608 | |
ansuz | dc71d46864 | |
ansuz | 5afb3f7893 | |
yflory | 9e1831bbeb | |
yflory | f432852a86 | |
yflory | 0d12f1d75e | |
yflory | cf415e9f98 | |
yflory | f273fe1291 | |
yflory | c24fa2bb30 | |
yflory | a56cdfe38f | |
yflory | a2b295c42c | |
yflory | c8384f42c9 | |
yflory | 8dd42e3e8c | |
yflory | eebf94b084 | |
yflory | a76fc3a427 | |
yflory | 24fa6a4fb6 | |
yflory | 605a250966 | |
yflory | 08d771a3df | |
yflory | 28b0371937 | |
yflory | 2718eab7c4 | |
yflory | 07b31dc84d | |
yflory | 0718e0fc1b | |
yflory | db5d2cbfc8 | |
yflory | 0642eeb2a7 | |
yflory | 55890011a4 | |
yflory | bef8f131d9 | |
yflory | fab629bf6d | |
yflory | 04e298dd46 | |
ansuz | ce8f108437 | |
ansuz | baf9ab0c93 | |
ansuz | 7ae5654b83 | |
ansuz | 3e9b00077b | |
ansuz | a9e9ee6c7a | |
David Benque | f092575104 | |
yflory | aaed6b7d77 | |
yflory | 3f1480a847 | |
yflory | 86aad06545 | |
yflory | ca95af082d | |
yflory | 4c915f9e5a | |
yflory | 0881936971 | |
ansuz | eb3cdf2f78 | |
ansuz | d9d3cdf092 | |
yflory | df440b19df | |
yflory | 21d6057c1f | |
ansuz | 55537bc6cb | |
Weblate | 5414fe14de | |
yflory | b896870632 | |
yflory | dde1b7ecad | |
yflory | bfe4f3ba36 | |
yflory | 5abf47585c | |
yflory | 2e1deeb8ed | |
yflory | 51ba5d22da | |
yflory | d6983a8b83 | |
yflory | ab62b5f202 | |
yflory | 8846b2d10e | |
yflory | 777de599c3 | |
yflory | 99572cbb6e | |
yflory | aff9ffa400 | |
yflory | d547c90168 |
|
@ -12,6 +12,7 @@
|
|||
"unused": true,
|
||||
"futurehostile":true,
|
||||
"browser": true,
|
||||
"esversion": 6,
|
||||
"predef": [
|
||||
"console",
|
||||
"define",
|
||||
|
|
101
CHANGELOG.md
|
@ -1,3 +1,104 @@
|
|||
# 4.12.1
|
||||
|
||||
This minor release contains a few bug fixes based on feedback we received and adjustments to prepare for the update to OnlyOffice 6.4.
|
||||
|
||||
* We noticed that charts and tables in the Document and Presentation (early access) applications cause conflicts with the upcoming OnlyOffice update. They are now disabled until the next release.
|
||||
* We found that the button to export form results to a CryptPad sheet was empty so we added the missing text.
|
||||
* Several issues were reported with the Forms application and are now fixed. This patch will prevent conditional sections from losing their content (questions and conditions) while editing the form. The "max options" selector won't be displayed anymore when converting "checkbox" questions to other types. The first two lines of a "choice grid" weren't always registered when submitting a form and this patch fixes it for newly created choice grids.
|
||||
* Some calendars created with external tools couldn't be imported in CryptPad due to notifications settings. We've changed the "import" script to make sure the event could still be imported but without the problematic notification.
|
||||
* We've received conflicting feedback about the privacy settings in forms. In the existing system, the users had to untick a box to submit with their name but, depending on the context, it's not always a good solution to make a form result anonymous by default. Similarly submitting form results with the username by default isn't privacy-friendly. We implemented a new system to prompt users to choose between submitting anonymously or with their name (unless one of the options is disabled).
|
||||
|
||||
# 4.12.0
|
||||
|
||||
## Goals
|
||||
|
||||
Our primary goal for this release was to improve support for office file formats in CryptPad by
|
||||
|
||||
1. integrating OnlyOffice's word processor and presentation editor and
|
||||
2. introducing more intuitive workflows that allow users to convert and open uploaded office files directly from their drives
|
||||
|
||||
## Update notes
|
||||
|
||||
This release requires configuration changes to work correctly. We've updated our example NGINX config file to apply the required HTTP headers where appropriate.
|
||||
|
||||
You can compare the updated example against that of a previous CryptPad version by running something like `git diff -U2 4.11.0 docs/` to generate a diff:
|
||||
|
||||
```diff
|
||||
diff --git a/docs/example.nginx.conf b/docs/example.nginx.conf
|
||||
index 14a3d4fc2..ea21e3ba7 100644
|
||||
--- a/docs/example.nginx.conf
|
||||
+++ b/docs/example.nginx.conf
|
||||
@@ -65,5 +65,5 @@ server {
|
||||
|
||||
set $coop '';
|
||||
- if ($uri ~ ^\/(sheet|presentation|doc|convert)\/.*$) { set $coop 'same-origin'; }
|
||||
+ #if ($uri ~ ^\/(sheet|presentation|doc|convert)\/.*$) { set $coop 'same-origin'; }
|
||||
|
||||
# Enable SharedArrayBuffer in Firefox (for .xlsx export)
|
||||
@@ -91,5 +91,5 @@ server {
|
||||
|
||||
# connect-src restricts URLs which can be loaded using script interfaces
|
||||
- set $connectSrc "'self' https://${main_domain} ${main_domain} https://${api_domain} blob: wss://${api_domain} ${api_domain} ${files_domain}";
|
||||
+ set $connectSrc "'self' https://${main_domain} ${main_domain} https://${api_domain} blob: wss://${api_domain} ${api_domain} ${files_domain} https://${sandbox_domain}";
|
||||
|
||||
# fonts can be loaded from data-URLs or the main domain
|
||||
@@ -121,8 +121,13 @@ server {
|
||||
# they unfortunately still require exceptions to the sandboxing to work correctly.
|
||||
if ($uri ~ ^\/(sheet|doc|presentation)\/inner.html.*$) { set $unsafe 1; }
|
||||
- if ($uri ~ ^\/common\/onlyoffice\/.*\/index\.html.*$) { set $unsafe 1; }
|
||||
+ if ($uri ~ ^\/common\/onlyoffice\/.*\/.*\.html.*$) { set $unsafe 1; }
|
||||
|
||||
# everything except the sandbox domain is a privileged scope, as they might be used to handle keys
|
||||
if ($host != $sandbox_domain) { set $unsafe 0; }
|
||||
+ # this iframe is an exception. Office file formats are converted outside of the sandboxed scope
|
||||
+ # because of bugs in Chromium-based browsers that incorrectly ignore headers that are supposed to enable
|
||||
+ # the use of some modern APIs that we require when javascript is run in a cross-origin context.
|
||||
+ # We've applied other sandboxing techniques to mitigate the risk of running WebAssembly in this privileged scope
|
||||
+ if ($uri ~ ^\/unsafeiframe\/inner\.html.*$) { set $unsafe 1; }
|
||||
|
||||
# privileged contexts allow a few more rights than unprivileged contexts, though limits are still applied
|
||||
```
|
||||
|
||||
We've also updated the checkup page to test for the expected server behaviour and suggest helpful steps for correcting misconfiguration issues. You can access this diagnostic page at `https://<your-cryptpad-domain>/checkup/`.
|
||||
|
||||
Our team has limited resources, so we've chosen to introduce the new (and **experimental**) office editors gradually to avoid getting overwhelmed by support tickets as was the case when we introduced the current spreadsheet editor in 2019. In order to support this we've implemented an **early access** system which _optionally_ restricts the use of these editors to premium subscribers. We will enable this system on CryptPad.fr, but admins of independent instances can enable them at their discretion.
|
||||
|
||||
To enable the use of the OnlyOffice Document and Presentation editor for everyone on your instance, edit your [customize/application_config.js](https://docs.cryptpad.fr/en/admin_guide/customization.html#application-config) file to include `AppConfig.enableEarlyAccess = true;`.
|
||||
|
||||
If you wish to avoid a rush of support tickets from your users by limiting early access to users with custom quota increases, add another line like so `Constants.earlyAccessApps = ['doc', 'presentation'];`.
|
||||
|
||||
As these editors become more stable we plan to enable them by default on third-party instances. Keep in mind, these editors may be unstable and users may lose their work. Our team will fix bugs given sufficient information to reproduce them, but we will not take the time to help you recover lost data unless you have taken a support contract with us.
|
||||
|
||||
To update from 4.11.0 to 4.12.0:
|
||||
|
||||
1. Stop your server
|
||||
2. Get the latest code with git
|
||||
3. Apply the recommended changes to your NGINX config (don't forget to **reload NGINX**)
|
||||
* optionally edit your `application_config.js` file to enable early access apps. restart your server or use the admin panel's _Flush cache_ button for this to take effect.
|
||||
4. Install the latest dependencies with `bower update` and `npm i`
|
||||
5. Restart your server
|
||||
6. Confirm that your instance is passing all the tests included on the `/checkup/` page (on whatever devices you intend to support)
|
||||
|
||||
## Features
|
||||
|
||||
* It took a lot of experimentation, reading of specification documents, and reverse-engineering of undocumented workarounds to avoid browser-specific regressions, but we've gotten our client-side engine for office file format conversion to work as intended in the context of user or team drives. This means that as long as you are using a relatively modern browser (not Safari or anything on iOS) you should be able to do things like:
|
||||
* right-click and open uploaded XLSX or ODS files in our OnlyOffice Sheet integration,
|
||||
* implicitly convert editable sheets to XLSX individually (using the _download_ option) or as part of a collection when you download your full drive or one of its subtrees,
|
||||
* perform similar workflows with DOCX, ODT, PPT, and ODP files.
|
||||
* As mentioned above, admins that enable _early access_ editors will be able try out the word processor and presentation editor. These editors use OnlyOffice _client-side_ components, but have had their server-side components completely replaced, just as with our Sheet integration. Nobody else has packaged OnlyOffice's editors in this manner, so this is **experimental technology** and we recommend that you **back up your documents regularly**!
|
||||
* The form app now includes an option to open collected results in a new spreadsheet for advanced analysis.
|
||||
|
||||
## Bug fixes
|
||||
|
||||
* We finally tracked down a sneaky bug that was responsible for scrambling users' spreadsheets. The issue was triggered when they were disconnected and reconnected after editing the sheet by themself, usually for an extended period. A bug in the reconnection logic caused their earlier changes to the sheet to be replayed a second time, typically to disastrous effect if they had inserted rows in the meantime. A minor patch guards against this possibility, making sheets (and the newer office editors) far more stable.
|
||||
* We noticed that the OnlyOffice editors' _print to PDF_ functionality behaved differently depending on the user's preferences for downloads and file-type handling. In some cases the resulting PDF would be opened in an invisible iframe. In addition to the intentional download prompt we meant to trigger, some users would be implicitly shown a second prompt to download the contents of the iframe. We suppressed the creation of the hidden iframe and now download the generated PDF directly using a single, more modern method.
|
||||
* It was reported that responses to conditional sections of forms were not included in their results. Our patch has been tested in production and has been verified to correct the issue.
|
||||
* The recently introduced file upload preview was capable of throwing an error under certain circumstances when previewing text files, which prevented them from being uploaded. We now guard against these errors and fall back to _no preview_.
|
||||
* The chat box in pads failed to load for guests using the _no-drive_ mode which we introduced as an optimization to reduce load time for one-time visitors. An attempt to access a data structure that did not exist caused a type error, which resulted in the chat interface appearing to load indefinitely.
|
||||
* Loading a shared folder by its link now causes it to be displayed in the context of your drive, rather than loading it in the background but displaying your last accessed folder instead.
|
||||
* We now guard against _DOMException_ errors whenever we try to write data into localStorage, as this is capable of triggering a _QuotaExceeded_ error which we has been observed to occur more frequently lately.
|
||||
* When attempting to use an editor's _Insert_ menu to embed uploaded media in a document, we now wait until all thumbnails are loaded before displaying the menu. This is intended to avoid circumstances where the user attempts to click the menu's _upload_ button but accidentally chooses a previously uploaded media file when the position of the button changes.
|
||||
|
||||
# 4.11.0
|
||||
|
||||
## Goals
|
||||
|
|
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
|
@ -1,24 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="512"
|
||||
height="512"
|
||||
version="1.1"
|
||||
viewBox="0 0 135.46606 135.46728"
|
||||
id="svg942"
|
||||
sodipodi:docname="favicon_source.svg"
|
||||
inkscape:version="1.0.2 (1.0.2+r75+1)"
|
||||
inkscape:export-filename="/home/david/cryptpad/customize.dist/favicon/main-favicon-docs.png"
|
||||
inkscape:version="1.1.1 (1:1.1+202109281949+c3084ef5ed)"
|
||||
inkscape:export-filename="/home/david/cryptpad/customize.dist/favicon/alt-favicon-document.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
inkscape:export-ydpi="96"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<metadata
|
||||
id="metadata948">
|
||||
<rdf:RDF>
|
||||
|
@ -35,7 +34,7 @@
|
|||
id="defs946">
|
||||
<linearGradient
|
||||
id="linearGradient943"
|
||||
osb:paint="solid">
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#0087ff;stop-opacity:1;"
|
||||
offset="0"
|
||||
|
@ -43,7 +42,7 @@
|
|||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient947"
|
||||
osb:paint="solid">
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#2467cf;stop-opacity:1;"
|
||||
offset="0"
|
||||
|
@ -51,7 +50,7 @@
|
|||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient939"
|
||||
osb:paint="solid">
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#99b4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
|
@ -59,7 +58,7 @@
|
|||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient934"
|
||||
osb:paint="solid">
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#0087ff;stop-opacity:1;"
|
||||
offset="0"
|
||||
|
@ -67,7 +66,7 @@
|
|||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient917"
|
||||
osb:paint="solid">
|
||||
inkscape:swatch="solid">
|
||||
<stop
|
||||
style="stop-color:#0087ff;stop-opacity:1;"
|
||||
offset="0"
|
||||
|
@ -92,18 +91,19 @@
|
|||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1900"
|
||||
inkscape:window-height="996"
|
||||
inkscape:window-width="1832"
|
||||
inkscape:window-height="1133"
|
||||
id="namedview944"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.819555"
|
||||
inkscape:cx="220.04746"
|
||||
inkscape:cy="396.21109"
|
||||
inkscape:window-x="10"
|
||||
inkscape:window-y="50"
|
||||
inkscape:cx="60.398631"
|
||||
inkscape:cy="380.6944"
|
||||
inkscape:window-x="26"
|
||||
inkscape:window-y="23"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="g1109"
|
||||
inkscape:document-rotation="0" />
|
||||
inkscape:current-layer="g952"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
|
@ -179,7 +179,7 @@
|
|||
inkscape:groupmode="layer"
|
||||
id="g1113"
|
||||
inkscape:label="[export] shield docs [brand/drive] "
|
||||
style="display:inline">
|
||||
style="display:none">
|
||||
<g
|
||||
id="g1111"
|
||||
transform="matrix(1.4853714,0,0,1.4853714,12.798765,-0.61151946)">
|
||||
|
@ -266,6 +266,92 @@
|
|||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="g373"
|
||||
inkscape:label="[export] shield [OO_doc]"
|
||||
style="display:inline">
|
||||
<g
|
||||
id="g371"
|
||||
transform="matrix(1.4853714,0,0,1.4853714,12.798765,-0.61151946)">
|
||||
<g
|
||||
transform="translate(-125.38,-26.449)"
|
||||
id="g369">
|
||||
<path
|
||||
d="m 128.98,30.355 0.55499,39.644 h 33.141 l 0.004,-39.644 z"
|
||||
style="fill:#5170b5;fill-opacity:0.396078"
|
||||
id="path355" />
|
||||
<path
|
||||
d="m 162.69,70 0.003,43.946 c 12.825,-5.8796 32.762,-17.077 33.127,-43.157 l 0.0108,-0.78911 z"
|
||||
style="fill:#5170b5;fill-opacity:0.396078"
|
||||
id="path357" />
|
||||
<path
|
||||
d="m 128.98,30.355 h 44.386 L 195.78,51.181 V 76.08 c 0,26.166 -21.414,32.228 -33.117,38.409 -12.815,-5.8945 -32.794,-12.329 -33.117,-38.409 z"
|
||||
style="fill:none;stroke:#5170b5;stroke-width:5.2922;stroke-opacity:1"
|
||||
id="path359" />
|
||||
<path
|
||||
d="m 171.32,29.811 v 23.04 h 24.575"
|
||||
style="fill:none;stroke:#5170b5;stroke-width:5.2917;stroke-opacity:1"
|
||||
id="path361" />
|
||||
<g
|
||||
transform="matrix(1.1107,0,0,1.1107,18.926,21.932)"
|
||||
style="fill:#4839b7;fill-opacity:1"
|
||||
id="g367">
|
||||
<path
|
||||
d="m 137.23,42.719 a 8.1185,8.1185 0 0 1 -8.1185,8.1185 8.1185,8.1185 0 0 1 -8.1185,-8.1185 8.1185,8.1185 0 0 1 8.1185,-8.1185 8.1185,8.1185 0 0 1 8.1185,8.1185 z"
|
||||
style="fill:#5170b5;fill-opacity:1"
|
||||
id="path363" />
|
||||
<path
|
||||
d="m 127,42.651 h 4.2265 l 4.2333,22.354 h -12.693 z"
|
||||
style="fill:#5170b5;fill-opacity:1"
|
||||
id="path365" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="g956"
|
||||
inkscape:label="[export] shield [OO_pres]"
|
||||
style="display:none">
|
||||
<g
|
||||
id="g954"
|
||||
transform="matrix(1.4853714,0,0,1.4853714,12.798765,-0.61151946)">
|
||||
<g
|
||||
transform="translate(-125.38,-26.449)"
|
||||
id="g952">
|
||||
<path
|
||||
d="m 128.98,30.355 0.55499,39.644 h 33.141 l 0.004,-39.644 z"
|
||||
style="fill:#c65d27;fill-opacity:0.396078"
|
||||
id="path937" />
|
||||
<path
|
||||
d="m 162.69,70 0.003,43.946 c 12.825,-5.8796 32.762,-17.077 33.127,-43.157 l 0.0108,-0.78911 z"
|
||||
style="fill:#c65d27;fill-opacity:0.396078"
|
||||
id="path939" />
|
||||
<path
|
||||
d="m 128.98,30.355 h 44.386 L 195.78,51.181 V 76.08 c 0,26.166 -21.414,32.228 -33.117,38.409 -12.815,-5.8945 -32.794,-12.329 -33.117,-38.409 z"
|
||||
style="fill:none;stroke:#c65d27;stroke-width:5.2922;stroke-opacity:1"
|
||||
id="path941" />
|
||||
<path
|
||||
d="m 171.32,29.811 v 23.04 h 24.575"
|
||||
style="fill:none;stroke:#c65d27;stroke-width:5.2917;stroke-opacity:1"
|
||||
id="path943" />
|
||||
<g
|
||||
transform="matrix(1.1107,0,0,1.1107,18.926,21.932)"
|
||||
style="fill:#c65d27;fill-opacity:1"
|
||||
id="g950">
|
||||
<path
|
||||
d="m 137.23,42.719 a 8.1185,8.1185 0 0 1 -8.1185,8.1185 8.1185,8.1185 0 0 1 -8.1185,-8.1185 8.1185,8.1185 0 0 1 8.1185,-8.1185 8.1185,8.1185 0 0 1 8.1185,8.1185 z"
|
||||
style="fill:#c65d27;fill-opacity:1"
|
||||
id="path946" />
|
||||
<path
|
||||
d="m 127,42.651 h 4.2265 l 4.2333,22.354 h -12.693 z"
|
||||
style="fill:#c65d27;fill-opacity:1"
|
||||
id="path948" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="g913"
|
||||
|
@ -535,7 +621,7 @@
|
|||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="dot"
|
||||
style="display:none">
|
||||
style="display:inline">
|
||||
<circle
|
||||
style="fill:#ff0000;fill-opacity:1;stroke-width:7.93754"
|
||||
id="path968"
|
||||
|
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
|
@ -105,7 +105,7 @@ define([
|
|||
var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ?
|
||||
'/imprint.html' : AppConfig.imprint);
|
||||
|
||||
Pages.versionString = "v4.11.0";
|
||||
Pages.versionString = "v4.12.1";
|
||||
|
||||
|
||||
// used for the about menu
|
||||
|
|
|
@ -7,12 +7,16 @@ define([
|
|||
'/customize/pages.js',
|
||||
'/api/config',
|
||||
'/common/common-ui-elements.js',
|
||||
], function ($, h, Msg, AppConfig, LocalStore, Pages, Config, UIElements) {
|
||||
'/common/common-constants.js',
|
||||
], function ($, h, Msg, AppConfig, LocalStore, Pages, Config, UIElements, Constants) {
|
||||
var accounts = Pages.accounts;
|
||||
|
||||
return function () {
|
||||
Msg.features_f_apps_note = AppConfig.availablePadTypes.map(function (app) {
|
||||
if (AppConfig.registeredOnlyTypes.indexOf(app) !== -1) { return; }
|
||||
if (AppConfig.premiumTypes && AppConfig.premiumTypes.includes(app)) { return; }
|
||||
if (Constants.earlyAccessApps && Constants.earlyAccessApps.includes(app) &&
|
||||
AppConfig.enableEarlyAccess) { return; }
|
||||
return Msg.type[app];
|
||||
}).filter(function (x) { return x; }).join(', ');
|
||||
var premiumButton = h('a', {
|
||||
|
|
|
@ -5,12 +5,14 @@ define([
|
|||
'/common/common-feedback.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/common-hash.js',
|
||||
'/common/common-constants.js',
|
||||
'/common/common-util.js',
|
||||
'/lib/textFit.min.js',
|
||||
'/customize/messages.js',
|
||||
'/customize/application_config.js',
|
||||
'/common/outer/local-store.js',
|
||||
'/customize/pages.js'
|
||||
], function ($, Config, h, Feedback, UI, Hash, TextFit, Msg, AppConfig, LocalStore, Pages) {
|
||||
], function ($, Config, h, Feedback, UI, Hash, Constants, Util, TextFit, Msg, AppConfig, LocalStore, Pages) {
|
||||
var urlArgs = Config.requireConf.urlArgs;
|
||||
|
||||
var isAvailableType = function (x) {
|
||||
|
@ -18,6 +20,15 @@ define([
|
|||
return AppConfig.availablePadTypes.indexOf(x) !== -1;
|
||||
};
|
||||
|
||||
var checkEarlyAccess = function (x) {
|
||||
// Check if this is an early access app and if they are allowed.
|
||||
// Check if this is a premium app and if you're premium
|
||||
// Returns false if the app should be hidden
|
||||
var earlyTypes = Constants.earlyAccessApps;
|
||||
var ea = Util.checkRestrictedApp(x, AppConfig, earlyTypes,
|
||||
LocalStore.getPremium(), LocalStore.isLoggedIn());
|
||||
return ea > 0;
|
||||
};
|
||||
var checkRegisteredType = function (x) {
|
||||
// Return true if we're registered or if the app is not registeredOnly
|
||||
if (LocalStore.isLoggedIn()) { return true; }
|
||||
|
@ -27,20 +38,24 @@ define([
|
|||
|
||||
return function () {
|
||||
var icons = [
|
||||
[ 'pad', Msg.type.pad],
|
||||
[ 'code', Msg.type.code],
|
||||
[ 'slide', Msg.type.slide],
|
||||
[ 'sheet', Msg.type.sheet],
|
||||
[ 'form', Msg.type.form],
|
||||
[ 'doc', Msg.type.doc],
|
||||
[ 'presentation', Msg.type.presentation],
|
||||
[ 'pad', Msg.type.pad],
|
||||
[ 'kanban', Msg.type.kanban],
|
||||
[ 'code', Msg.type.code],
|
||||
[ 'form', Msg.type.form],
|
||||
[ 'whiteboard', Msg.type.whiteboard],
|
||||
[ 'slide', Msg.type.slide],
|
||||
[ 'drive', Msg.type.drive]
|
||||
].filter(function (x) {
|
||||
return isAvailableType(x[0]);
|
||||
})
|
||||
.map(function (x) {
|
||||
var s = 'div.bs-callout.cp-callout-' + x[0];
|
||||
var cls = '';
|
||||
var isEnabled = checkRegisteredType(x[0]);
|
||||
var isEAEnabled = checkEarlyAccess(x[0]);
|
||||
//if (i > 2) { s += '.cp-more.cp-hidden'; }
|
||||
var icon = AppConfig.applicationsIcon[x[0]];
|
||||
var font = icon.indexOf('cptools') === 0 ? 'cptools' : 'fa';
|
||||
|
@ -52,11 +67,14 @@ define([
|
|||
window.location.href = url;
|
||||
}
|
||||
};
|
||||
if (!isEAEnabled) {
|
||||
cls += '.cp-app-hidden';
|
||||
}
|
||||
if (!isEnabled) {
|
||||
s += '.cp-app-disabled';
|
||||
cls += '.cp-app-disabled';
|
||||
attr.title = Msg.mustLogin;
|
||||
}
|
||||
return h('a', [
|
||||
return h('a.cp-index-appitem' + cls, [
|
||||
attr,
|
||||
h(s, [
|
||||
h('i.' + font + '.' + icon, {'aria-hidden': 'true'}),
|
||||
|
|
|
@ -447,6 +447,6 @@
|
|||
@cp_form-poll-yes: fade(@cryptpad_color_light_green, 75%);
|
||||
@cp_form-poll-maybe: @cryptpad_color_grey_300;
|
||||
@cp_form-poll-yes-color: @cryptpad_color_green;
|
||||
@cp_form-invalid: @cryptpad_color_red;
|
||||
@cp_form-invalid: @cp_alerts-danger-text;
|
||||
@cp_form-palette: @cp_palette;
|
||||
@cp_form-palette2: @cp_palette-dark;
|
||||
|
|
|
@ -55,10 +55,19 @@
|
|||
color: @cp_context-fg;
|
||||
}
|
||||
.fa, .cptools {
|
||||
margin-right: 10px;
|
||||
&:first-child {
|
||||
margin-right: 10px;
|
||||
}
|
||||
&.cptools:not(:first-child) {
|
||||
vertical-align: middle;
|
||||
}
|
||||
color: @cp_context-icon;
|
||||
width: 16px;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
cursor: not-allowed !important;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cp-app-drive-context-noAction {
|
||||
|
|
|
@ -115,6 +115,9 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.cp-creation-early {
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
.cp-creation-create {
|
||||
justify-content: center;
|
||||
|
|
|
@ -80,6 +80,15 @@
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.cp-app-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
cursor: not-allowed !important;
|
||||
.fa, .cptools { cursor: not-allowed !important; }
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +295,9 @@
|
|||
display: none;
|
||||
}
|
||||
input {
|
||||
width: ~"calc(100% - 30px)";
|
||||
//width: ~"calc(100% - 30px)";
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0 10px;
|
||||
border: 0;
|
||||
height: auto;
|
||||
|
@ -298,8 +309,9 @@
|
|||
.leftside-menu-category_main();
|
||||
width: ~"calc(100% + 5px)";
|
||||
margin: 0;
|
||||
margin-bottom: -6px;
|
||||
display: inline-block;
|
||||
//margin-bottom: -6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
margin-left: -5px;
|
||||
padding-left: 5px;
|
||||
|
@ -309,6 +321,12 @@
|
|||
width: 25px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
.cp-app-drive-element {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,6 +120,14 @@
|
|||
background-color: @cp_dropdown-bg-active;
|
||||
color: @cp_dropdown-fg;
|
||||
}
|
||||
|
||||
&.cp-app-hidden {
|
||||
display: none;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
cursor: not-allowed !important;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
&> span {
|
||||
box-sizing: border-box;
|
||||
|
|
|
@ -117,9 +117,6 @@
|
|||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.cptools {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
color: @cp_buttons-fg;
|
||||
border: 1px solid @cp_buttons-fg;
|
||||
|
|
|
@ -38,5 +38,14 @@
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.cp-app-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
cursor: not-allowed !important;
|
||||
.fa, .cptools { cursor: not-allowed !important; }
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,15 +118,22 @@
|
|||
padding: 10px 10px 0px 10px;
|
||||
//height: @icons-size - @icons-text-size;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
cursor: not-allowed !important;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.pad-button-text {
|
||||
color: @cryptpad_text_col;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
.cp-index-appitem {
|
||||
&.cp-app-hidden {
|
||||
display: none;
|
||||
}
|
||||
&.cp-app-disabled {
|
||||
div {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
h4 {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ server {
|
|||
add_header Permissions-Policy interest-cohort=();
|
||||
|
||||
set $coop '';
|
||||
if ($uri ~ ^\/(sheet|presentation|doc|convert)\/.*$) { set $coop 'same-origin'; }
|
||||
#if ($uri ~ ^\/(sheet|presentation|doc|convert)\/.*$) { set $coop 'same-origin'; }
|
||||
|
||||
# Enable SharedArrayBuffer in Firefox (for .xlsx export)
|
||||
add_header Cross-Origin-Resource-Policy cross-origin;
|
||||
|
@ -90,7 +90,7 @@ server {
|
|||
set $styleSrc "'unsafe-inline' 'self' ${main_domain}";
|
||||
|
||||
# connect-src restricts URLs which can be loaded using script interfaces
|
||||
set $connectSrc "'self' https://${main_domain} ${main_domain} https://${api_domain} blob: wss://${api_domain} ${api_domain} ${files_domain}";
|
||||
set $connectSrc "'self' https://${main_domain} ${main_domain} https://${api_domain} blob: wss://${api_domain} ${api_domain} ${files_domain} https://${sandbox_domain}";
|
||||
|
||||
# fonts can be loaded from data-URLs or the main domain
|
||||
set $fontSrc "'self' data: ${main_domain}";
|
||||
|
@ -120,10 +120,15 @@ server {
|
|||
# the following assets are loaded via the sandbox domain
|
||||
# they unfortunately still require exceptions to the sandboxing to work correctly.
|
||||
if ($uri ~ ^\/(sheet|doc|presentation)\/inner.html.*$) { set $unsafe 1; }
|
||||
if ($uri ~ ^\/common\/onlyoffice\/.*\/index\.html.*$) { set $unsafe 1; }
|
||||
if ($uri ~ ^\/common\/onlyoffice\/.*\/.*\.html.*$) { set $unsafe 1; }
|
||||
|
||||
# everything except the sandbox domain is a privileged scope, as they might be used to handle keys
|
||||
if ($host != $sandbox_domain) { set $unsafe 0; }
|
||||
# this iframe is an exception. Office file formats are converted outside of the sandboxed scope
|
||||
# because of bugs in Chromium-based browsers that incorrectly ignore headers that are supposed to enable
|
||||
# the use of some modern APIs that we require when javascript is run in a cross-origin context.
|
||||
# We've applied other sandboxing techniques to mitigate the risk of running WebAssembly in this privileged scope
|
||||
if ($uri ~ ^\/unsafeiframe\/inner\.html.*$) { set $unsafe 1; }
|
||||
|
||||
# privileged contexts allow a few more rights than unprivileged contexts, though limits are still applied
|
||||
if ($unsafe) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var Default = module.exports;
|
||||
|
||||
Default.commonCSP = function (domain) {
|
||||
Default.commonCSP = function (domain, sandbox) {
|
||||
domain = ' ' + domain;
|
||||
// Content-Security-Policy
|
||||
|
||||
|
@ -23,7 +23,7 @@ Default.commonCSP = function (domain) {
|
|||
if you are deploying to production, you'll probably want to remove
|
||||
the ws://* directive, and change '*' to your domain
|
||||
*/
|
||||
"connect-src 'self' ws: wss: blob:" + domain,
|
||||
"connect-src 'self' ws: wss: blob: " + domain + (sandbox && sandbox !== domain? ' ' + sandbox: ''),
|
||||
|
||||
// data: is used by codemirror
|
||||
"img-src 'self' data: blob:" + domain,
|
||||
|
@ -35,12 +35,12 @@ Default.commonCSP = function (domain) {
|
|||
];
|
||||
};
|
||||
|
||||
Default.contentSecurity = function (domain) {
|
||||
return (Default.commonCSP(domain).join('; ') + "script-src 'self' resource: " + domain).replace(/\s+/g, ' ');
|
||||
Default.contentSecurity = function (domain, sandbox) {
|
||||
return (Default.commonCSP(domain, sandbox).join('; ') + "script-src 'self' resource: " + domain).replace(/\s+/g, ' ');
|
||||
};
|
||||
|
||||
Default.padContentSecurity = function (domain) {
|
||||
return (Default.commonCSP(domain).join('; ') + "script-src 'self' 'unsafe-eval' 'unsafe-inline' resource: " + domain).replace(/\s+/g, ' ');
|
||||
Default.padContentSecurity = function (domain, sandbox) {
|
||||
return (Default.commonCSP(domain, sandbox).join('; ') + "script-src 'self' 'unsafe-eval' 'unsafe-inline' resource: " + domain).replace(/\s+/g, ' ');
|
||||
};
|
||||
|
||||
Default.httpHeaders = function () {
|
||||
|
|
|
@ -17,6 +17,10 @@ var canonicalizeOrigin = function (s) {
|
|||
return (s || '').trim().replace(/\/+$/, '');
|
||||
};
|
||||
|
||||
var isValidPort = function (p) {
|
||||
return typeof(p) === 'number' && p < 65535;
|
||||
};
|
||||
|
||||
module.exports.create = function (config) {
|
||||
const Env = {
|
||||
version: Package.version,
|
||||
|
@ -25,6 +29,9 @@ module.exports.create = function (config) {
|
|||
httpUnsafeOrigin: canonicalizeOrigin(config.httpUnsafeOrigin),
|
||||
httpSafeOrigin: canonicalizeOrigin(config.httpSafeOrigin),
|
||||
removeDonateButton: config.removeDonateButton,
|
||||
httpPort: isValidPort(config.httpPort)? config.httpPort: 3000,
|
||||
httpAddress: typeof(config.httpAddress) === 'string'? config.httpAddress: '127.0.0.1',
|
||||
websocketPath: config.externalWebsocketURL,
|
||||
|
||||
OFFLINE_MODE: false,
|
||||
FRESH_KEY: '',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cryptpad",
|
||||
"version": "4.11.0",
|
||||
"version": "4.12.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "cryptpad",
|
||||
"description": "realtime collaborative visual editor with zero knowlege server",
|
||||
"version": "4.11.0",
|
||||
"version": "4.12.1",
|
||||
"license": "AGPL-3.0+",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
58
server.js
|
@ -23,28 +23,24 @@ var fancyURL = function (domain, path) {
|
|||
return false;
|
||||
};
|
||||
|
||||
var deriveSandboxOrigin = function (unsafe, port) {
|
||||
var url = new URL(unsafe);
|
||||
url.port = port;
|
||||
return url.origin;
|
||||
};
|
||||
|
||||
(function () {
|
||||
// you absolutely must provide an 'httpUnsafeOrigin' (a truthy string)
|
||||
if (!Env.httpUnsafeOrigin || typeof(Env.httpUnsafeOrigin) !== 'string') {
|
||||
throw new Error("No 'httpUnsafeOrigin' provided");
|
||||
}
|
||||
|
||||
// fall back to listening on a local address
|
||||
// if httpAddress is not a string
|
||||
if (typeof(config.httpAddress) !== 'string') {
|
||||
config.httpAddress = '127.0.0.1';
|
||||
}
|
||||
|
||||
// listen on port 3000 if a valid port number was not provided
|
||||
if (typeof(config.httpPort) !== 'number' || config.httpPort > 65535) {
|
||||
config.httpPort = 3000;
|
||||
}
|
||||
|
||||
if (typeof(Env.httpSafeOrigin) !== 'string') {
|
||||
Env.NO_SANDBOX = true;
|
||||
if (typeof(config.httpSafePort) !== 'number') {
|
||||
config.httpSafePort = config.httpPort + 1;
|
||||
if (typeof(Env.httpSafePort) !== 'number') {
|
||||
Env.httpSafePort = Env.httpPort + 1;
|
||||
}
|
||||
Env.httpSafeOrigin = deriveSandboxOrigin(Env.httpUnsafeOrigin, Env.httpSafePort);
|
||||
}
|
||||
}());
|
||||
|
||||
|
@ -77,21 +73,22 @@ var setHeaders = (function () {
|
|||
}
|
||||
} else {
|
||||
// use the default CSP headers constructed with your domain
|
||||
headers['Content-Security-Policy'] = Default.contentSecurity(Env.httpUnsafeOrigin);
|
||||
headers['Content-Security-Policy'] = Default.contentSecurity(Env.httpUnsafeOrigin, Env.httpSafeOrigin);
|
||||
}
|
||||
|
||||
const padHeaders = Util.clone(headers);
|
||||
if (typeof(config.padContentSecurity) === 'string') {
|
||||
padHeaders['Content-Security-Policy'] = config.padContentSecurity;
|
||||
} else {
|
||||
padHeaders['Content-Security-Policy'] = Default.padContentSecurity(Env.httpUnsafeOrigin);
|
||||
padHeaders['Content-Security-Policy'] = Default.padContentSecurity(Env.httpUnsafeOrigin, Env.httpSafeOrigin);
|
||||
}
|
||||
if (Object.keys(headers).length) {
|
||||
return function (req, res) {
|
||||
// apply a bunch of cross-origin headers for XLSX export in FF and printing elsewhere
|
||||
/*
|
||||
applyHeaderMap(res, {
|
||||
"Cross-Origin-Opener-Policy": /^\/(sheet|presentation|doc|convert)\//.test(req.url)? 'same-origin': '',
|
||||
});
|
||||
});*/
|
||||
|
||||
if (Env.NO_SANDBOX) { // handles correct configuration for local development
|
||||
// https://stackoverflow.com/questions/11531121/add-duplicate-http-response-headers-in-nodejs
|
||||
|
@ -112,8 +109,9 @@ var setHeaders = (function () {
|
|||
|
||||
// targeted CSP, generic policies, maybe custom headers
|
||||
const h = [
|
||||
/^\/common\/onlyoffice\/.*\/index\.html.*/,
|
||||
/^\/common\/onlyoffice\/.*\.html.*/,
|
||||
/^\/(sheet|presentation|doc)\/inner\.html.*/,
|
||||
/^\/unsafeiframe\/inner\.html.*$/,
|
||||
].some((regex) => {
|
||||
return regex.test(req.url);
|
||||
}) ? padHeaders : headers;
|
||||
|
@ -239,14 +237,14 @@ var makeRouteCache = function (template, cacheName) {
|
|||
var serveConfig = makeRouteCache(function (host) {
|
||||
return [
|
||||
'define(function(){',
|
||||
'var obj = ' + JSON.stringify({
|
||||
'return ' + JSON.stringify({
|
||||
requireConf: {
|
||||
waitSeconds: 600,
|
||||
urlArgs: 'ver=' + Env.version + cacheString(),
|
||||
},
|
||||
removeDonateButton: (Env.removeDonateButton === true),
|
||||
allowSubscriptions: (Env.allowSubscriptions === true),
|
||||
websocketPath: config.externalWebsocketURL,
|
||||
websocketPath: Env.websocketPath,
|
||||
httpUnsafeOrigin: Env.httpUnsafeOrigin,
|
||||
adminEmail: Env.adminEmail,
|
||||
adminKeys: Env.admins,
|
||||
|
@ -256,16 +254,8 @@ var serveConfig = makeRouteCache(function (host) {
|
|||
maxUploadSize: Env.maxUploadSize,
|
||||
premiumUploadSize: Env.premiumUploadSize,
|
||||
restrictRegistration: Env.restrictRegistration,
|
||||
httpSafeOrigin: Env.httpSafeOrigin,
|
||||
}, null, '\t'),
|
||||
'obj.httpSafeOrigin = ' + (function () {
|
||||
if (Env.httpSafeOrigin) { return '"' + Env.httpSafeOrigin + '"'; }
|
||||
if (config.httpSafePort) {
|
||||
return "(function () { return window.location.origin.replace(/\:[0-9]+$/, ':" +
|
||||
config.httpSafePort + "'); }())";
|
||||
}
|
||||
return 'window.location.origin';
|
||||
}()),
|
||||
'return obj',
|
||||
'});'
|
||||
].join(';\n')
|
||||
}, 'configCache');
|
||||
|
@ -314,11 +304,11 @@ nThen(function (w) {
|
|||
console.log("CryptPad is customizable, see customize.dist/readme.md for details");
|
||||
}));
|
||||
}).nThen(function (w) {
|
||||
httpServer.listen(config.httpPort,config.httpAddress,function(){
|
||||
var host = config.httpAddress;
|
||||
httpServer.listen(Env.httpPort, Env.httpAddress, function(){
|
||||
var host = Env.httpAddress;
|
||||
var hostName = !host.indexOf(':') ? '[' + host + ']' : host;
|
||||
|
||||
var port = config.httpPort;
|
||||
var port = Env.httpPort;
|
||||
var ps = port === 80? '': ':' + port;
|
||||
|
||||
var roughAddress = 'http://' + hostName + ps;
|
||||
|
@ -336,8 +326,8 @@ nThen(function (w) {
|
|||
}
|
||||
});
|
||||
|
||||
if (config.httpSafePort) {
|
||||
Http.createServer(app).listen(config.httpSafePort, config.httpAddress, w());
|
||||
if (Env.httpSafePort) {
|
||||
Http.createServer(app).listen(Env.httpSafePort, Env.httpAddress, w());
|
||||
}
|
||||
}).nThen(function () {
|
||||
var wsConfig = { server: httpServer };
|
||||
|
@ -348,7 +338,7 @@ nThen(function (w) {
|
|||
config.log = _log;
|
||||
|
||||
if (Env.OFFLINE_MODE) { return; }
|
||||
if (config.externalWebsocketURL) { return; }
|
||||
if (Env.websocketPath) { return; }
|
||||
|
||||
require("./lib/api").create(Env);
|
||||
});
|
||||
|
|
|
@ -188,7 +188,7 @@ define([
|
|||
hidden.push(al.toString());
|
||||
}
|
||||
var trigger = al.getFirstPropertyValue('trigger');
|
||||
var minutes = trigger ? (-trigger.toSeconds() / 60) : 0;
|
||||
var minutes = trigger && trigger.toSeconds ? (-trigger.toSeconds() / 60) : 0;
|
||||
if (reminders.indexOf(minutes) === -1) { reminders.push(minutes); }
|
||||
});
|
||||
|
||||
|
|
|
@ -513,7 +513,8 @@ define([
|
|||
options: types, // Entries displayed in the menu
|
||||
isSelect: true,
|
||||
initialValue: '.ics',
|
||||
common: common
|
||||
common: common,
|
||||
buttonCls: 'btn',
|
||||
};
|
||||
var $select = UIElements.createDropdown(dropdownConfig);
|
||||
UI.prompt(Messages.exportPrompt,
|
||||
|
|
|
@ -685,6 +685,7 @@ define([
|
|||
});
|
||||
});
|
||||
|
||||
/*
|
||||
assert(function (cb, msg) {
|
||||
var url = '/sheet/inner.html';
|
||||
msg.appendChild(h('span', [
|
||||
|
@ -703,6 +704,7 @@ define([
|
|||
cb(content === 'same-origin');
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
var safariGripe = function () {
|
||||
return h('p.cp-notice-other', 'This is expected because Safari and platforms that use its engine lack commonly supported functionality.');
|
||||
|
@ -802,10 +804,10 @@ define([
|
|||
});
|
||||
|
||||
[
|
||||
'sheet',
|
||||
'presentation',
|
||||
'doc',
|
||||
'convert',
|
||||
//'sheet',
|
||||
//'presentation',
|
||||
//'doc',
|
||||
//'convert',
|
||||
].forEach(function (url) {
|
||||
assert(function (cb, msg) {
|
||||
var header = 'cross-origin-opener-policy';
|
||||
|
@ -830,6 +832,33 @@ define([
|
|||
});
|
||||
});
|
||||
|
||||
assert(function (cb, msg) {
|
||||
// check that the sandbox domain is included in connect-src
|
||||
msg.appendChild(h('span', [
|
||||
"This instance's ",
|
||||
code("Content-Security-Policy"),
|
||||
" headers do not include the sandboxed domain (",
|
||||
code(trimmedSafe),
|
||||
") in ",
|
||||
code("connect-src"),
|
||||
". This can cause problems with fonts when printing office documents.",
|
||||
" This is probably due to an incorrectly configured reverse proxy.",
|
||||
" See the provided NGINX configuration file for an example of how to set this header correctly.",
|
||||
]));
|
||||
|
||||
$.ajax(cacheBuster('/'), {
|
||||
dataType: 'text',
|
||||
complete: function (xhr) {
|
||||
var CSP = parseCSP(xhr.getResponseHeader('content-security-policy'));
|
||||
var connect = (CSP && CSP['connect-src']) || "";
|
||||
if (connect.includes(trimmedSafe)) {
|
||||
return void cb(true);
|
||||
}
|
||||
cb(CSP);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
assert(function (cb, msg) {
|
||||
setWarningClass(msg);
|
||||
|
|
|
@ -37,7 +37,11 @@ define([
|
|||
var cachePut = function (k, v, cb) {
|
||||
if (window.cryptpadCache) { return void window.cryptpadCache.put(k, v, cb); }
|
||||
setTimeout(function () {
|
||||
localStorage['LESS_CACHE|' + key + '|' + k] = v;
|
||||
try {
|
||||
localStorage['LESS_CACHE|' + key + '|' + k] = v;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
if (cb) { cb(); }
|
||||
});
|
||||
};
|
||||
|
|
|
@ -11,8 +11,8 @@ define(function() {
|
|||
* redirected to the drive.
|
||||
* You should never remove the drive from this list.
|
||||
*/
|
||||
AppConfig.availablePadTypes = ['drive', 'teams', 'pad', 'sheet', 'code', 'slide', 'poll', 'kanban', 'whiteboard',
|
||||
/*'doc', 'presentation',*/ 'file', /*'todo',*/ 'contacts', 'form', 'convert'];
|
||||
AppConfig.availablePadTypes = ['drive', 'teams', 'sheet', 'doc', 'presentation', 'pad', 'kanban', 'code', 'form', 'poll', 'whiteboard',
|
||||
'file', 'contacts', 'slide', 'convert'];
|
||||
/* The registered only types are apps restricted to registered users.
|
||||
* You should never remove apps from this list unless you know what you're doing. The apps
|
||||
* listed here by default can't work without a user account.
|
||||
|
@ -22,6 +22,13 @@ define(function() {
|
|||
*/
|
||||
AppConfig.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support'];
|
||||
|
||||
/* New applications may be introduced in an "early access" state which can contain
|
||||
* bugs and can cause loss of user content. You can enable these applications on your
|
||||
* CryptPad instance to test them and report bugs to the developers or keep them
|
||||
* disabled until they are officially considered safe.
|
||||
*/
|
||||
AppConfig.enableEarlyAccess = false;
|
||||
|
||||
// to prevent apps that aren't officially supported from showing up
|
||||
// in the document creation modal
|
||||
AppConfig.hiddenTypes = ['drive', 'teams', 'contacts', 'todo', 'file', 'accounts', 'calendar', 'poll', 'convert',
|
||||
|
@ -131,7 +138,7 @@ define(function() {
|
|||
kanban: 'cptools-kanban',
|
||||
doc: 'fa-file-word-o',
|
||||
presentation: 'fa-file-powerpoint-o',
|
||||
sheet: 'cptools-sheet',
|
||||
sheet: 'fa-file-excel-o',
|
||||
drive: 'fa-hdd-o',
|
||||
teams: 'fa-users',
|
||||
};
|
||||
|
|
|
@ -54,11 +54,6 @@ define([
|
|||
};
|
||||
}
|
||||
|
||||
// RPC breaks if you don't support Number.MAX_SAFE_INTEGER
|
||||
if (Number && !Number.MAX_SAFE_INTEGER) {
|
||||
Number.MAX_SAFE_INTEGER = 9007199254740991;
|
||||
}
|
||||
|
||||
var failStore = function () {
|
||||
console.error(new Error('wut'));
|
||||
require(['jquery'], function ($) {
|
||||
|
|
|
@ -11,11 +11,13 @@ define(['/customize/application_config.js'], function (AppConfig) {
|
|||
storageKey: 'filesData',
|
||||
tokenKey: 'loginToken',
|
||||
prefersDriveRedirectKey: 'prefersDriveRedirect',
|
||||
isPremiumKey: 'isPremiumUser',
|
||||
displayPadCreationScreen: 'displayPadCreationScreen',
|
||||
deprecatedKey: 'deprecated',
|
||||
MAX_TEAMS_SLOTS: AppConfig.maxTeamsSlots || 5,
|
||||
MAX_TEAMS_OWNED: AppConfig.maxOwnedTeams || 5,
|
||||
// Apps
|
||||
criticalApps: ['profile', 'settings', 'debug', 'admin', 'support', 'notifications', 'calendar']
|
||||
criticalApps: ['profile', 'settings', 'debug', 'admin', 'support', 'notifications', 'calendar'],
|
||||
earlyAccessApps: ['doc', 'presentation']
|
||||
};
|
||||
});
|
||||
|
|
|
@ -653,12 +653,15 @@ define([
|
|||
button = $('<button>', {
|
||||
'class': 'cptools cptools-new-template cp-toolbar-icon-template',
|
||||
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.saveTemplateButton));
|
||||
if (data.rt) {
|
||||
if (data.rt || data.callback) {
|
||||
button
|
||||
.click(function () {
|
||||
var title = data.getTitle() || document.title;
|
||||
var todo = function (val) {
|
||||
if (typeof(val) !== "string") { return; }
|
||||
if (data.callback) {
|
||||
return void data.callback(val);
|
||||
}
|
||||
var toSave = data.rt.getUserDoc();
|
||||
if (val.trim()) {
|
||||
val = val.trim();
|
||||
|
@ -2087,6 +2090,7 @@ define([
|
|||
};
|
||||
|
||||
|
||||
|
||||
UIElements.createNewPadModal = function (common) {
|
||||
// if in drive, show new pad modal instead
|
||||
if ($(".cp-app-drive-element-row.cp-app-drive-new-ghost").length !== 0) {
|
||||
|
@ -2113,6 +2117,7 @@ define([
|
|||
AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; }
|
||||
return true;
|
||||
});
|
||||
|
||||
types.forEach(function (p) {
|
||||
var $element = $('<li>', {
|
||||
'class': 'cp-icons-element',
|
||||
|
@ -2125,6 +2130,12 @@ define([
|
|||
$modal.hide();
|
||||
common.openURL('/' + p + '/');
|
||||
});
|
||||
var premium = common.checkRestrictedApp(p);
|
||||
if (premium < 0) {
|
||||
$element.addClass('cp-app-hidden cp-app-disabled');
|
||||
} else if (premium === 0) {
|
||||
$element.addClass('cp-app-disabled');
|
||||
}
|
||||
});
|
||||
|
||||
var selected = -1;
|
||||
|
@ -2268,6 +2279,7 @@ define([
|
|||
|
||||
var type = metadataMgr.getMetadataLazy().type || privateData.app;
|
||||
var fromFileData = privateData.fromFileData;
|
||||
var fromContent = privateData.fromContent;
|
||||
|
||||
var $body = $('body');
|
||||
var $creationContainer = $('<div>', { id: 'cp-creation-container' }).appendTo($body);
|
||||
|
@ -2287,7 +2299,11 @@ define([
|
|||
|
||||
// Title
|
||||
//$creation.append(h('h2.cp-creation-title', Messages.newButtonTitle));
|
||||
var newPadH3Title = Messages['button_new' + type]; // Messages.button_newform
|
||||
var newPadH3Title = Messages._getKey('creation_new',[Messages.type[type]]);
|
||||
|
||||
var early = common.checkRestrictedApp(type);
|
||||
var domain = Config.httpUnsafeOrigin || 'CryptPad';
|
||||
if (/^http/.test(domain)) { domain = domain.replace(/^https?\:\/\//, ''); }
|
||||
|
||||
var title = h('div.cp-creation-title', [
|
||||
UI.getFileIcon({type: type})[0],
|
||||
|
@ -2297,6 +2313,12 @@ define([
|
|||
])
|
||||
]);
|
||||
$creation.append(title);
|
||||
|
||||
if (early === 1) {
|
||||
$creation.append(h('div.cp-creation-early.alert.alert-warning', Messages._getKey('premiumAccess', [
|
||||
domain
|
||||
])));
|
||||
}
|
||||
//var colorClass = 'cp-icon-color-'+type;
|
||||
//$creation.append(h('h2.cp-creation-title.'+colorClass, Messages.newButtonTitle));
|
||||
|
||||
|
@ -2524,6 +2546,14 @@ define([
|
|||
todo(res.data);
|
||||
});
|
||||
}
|
||||
else if (fromContent) {
|
||||
allData = [{
|
||||
name: fromContent.title,
|
||||
id: 0,
|
||||
icon: h('span.cptools.cptools-poll'),
|
||||
}];
|
||||
redraw(0);
|
||||
}
|
||||
else {
|
||||
redraw(0);
|
||||
}
|
||||
|
|
|
@ -575,6 +575,26 @@
|
|||
return false;
|
||||
};
|
||||
|
||||
// Tell if a file is spreadsheet from its metadata={title, fileType}
|
||||
Util.isSpreadsheet = function (type, name) {
|
||||
return (type &&
|
||||
(type === 'application/vnd.oasis.opendocument.spreadsheet' ||
|
||||
type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'))
|
||||
|| (name && (name.endsWith('.xlsx') || name.endsWith('.ods')));
|
||||
};
|
||||
Util.isOfficeDoc = function (type, name) {
|
||||
return (type &&
|
||||
(type === 'application/vnd.oasis.opendocument.text' ||
|
||||
type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'))
|
||||
|| (name && (name.endsWith('.docx') || name.endsWith('.odt')));
|
||||
};
|
||||
Util.isPresentation = function (type, name) {
|
||||
return (type &&
|
||||
(type === 'application/vnd.oasis.opendocument.presentation' ||
|
||||
type === 'application/vnd.openxmlformats-officedocument.presentationml.presentation'))
|
||||
|| (name && (name.endsWith('.pptx') || name.endsWith('.odp')));
|
||||
};
|
||||
|
||||
Util.isValidURL = function (str) {
|
||||
var pattern = new RegExp('^(https?:\\/\\/)'+ // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
|
||||
|
@ -618,6 +638,49 @@
|
|||
getColor().toString(16);
|
||||
};
|
||||
|
||||
Util.checkRestrictedApp = function (app, AppConfig, earlyTypes, plan, loggedIn) {
|
||||
// If this is an early access app, make sure this instance allows them
|
||||
if (Array.isArray(earlyTypes) && earlyTypes.includes(app) && !AppConfig.enableEarlyAccess) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
var premiumTypes = AppConfig.premiumTypes;
|
||||
// If this is not a premium app, don't disable it
|
||||
if (!Array.isArray(premiumTypes) || !premiumTypes.includes(app)) { return 2; }
|
||||
// This is a premium app
|
||||
// if you're not logged in, disable it
|
||||
if (!loggedIn) { return -1; }
|
||||
// if you're logged in, enable it only if you're a premium user
|
||||
return plan ? 1 : 0;
|
||||
|
||||
};
|
||||
|
||||
/* Chrome 92 dropped support for SharedArrayBuffer in cross-origin contexts
|
||||
where window.crossOriginIsolated is false.
|
||||
|
||||
Their blog (https://blog.chromium.org/2021/02/restriction-on-sharedarraybuffers.html)
|
||||
isn't clear about why they're doing this, but since it's related to site-isolation
|
||||
it seems they're trying to do vague security things.
|
||||
|
||||
In any case, there seems to be a workaround where you can still create them
|
||||
by using `new WebAssembly.Memory({shared: true, ...})` instead of `new SharedArrayBuffer`.
|
||||
|
||||
This seems unreliable, but it's better than not being able to export, since
|
||||
we actively rely on postMessage between iframes and therefore can't afford
|
||||
to opt for full isolation.
|
||||
*/
|
||||
var supportsSharedArrayBuffers = function () {
|
||||
try {
|
||||
return Object.prototype.toString.call(new window.WebAssembly.Memory({shared: true, initial: 0, maximum: 0}).buffer) === '[object SharedArrayBuffer]';
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Util.supportsWasm = function () {
|
||||
return !(typeof(Atomics) === "undefined" || !supportsSharedArrayBuffers() || typeof(WebAssembly) === 'undefined');
|
||||
};
|
||||
|
||||
if (typeof(module) !== 'undefined' && module.exports) {
|
||||
module.exports = Util;
|
||||
} else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) {
|
||||
|
|
|
@ -728,18 +728,26 @@ define([
|
|||
var optsPut = {};
|
||||
if (p.type === 'poll') { optsPut.initialState = '{}'; }
|
||||
// PPP: add password as cryptput option
|
||||
Cryptput(hash, data.toSave, function (e) {
|
||||
if (e) { throw new Error(e); }
|
||||
postMessage("ADD_PAD", {
|
||||
teamId: data.teamId,
|
||||
href: href,
|
||||
title: data.title,
|
||||
path: ['template']
|
||||
}, function (obj) {
|
||||
if (obj && obj.error) { return void cb(obj.error); }
|
||||
cb();
|
||||
});
|
||||
}, optsPut);
|
||||
Nthen(function (w) {
|
||||
common.getEdPublic(null, w(function (obj) {
|
||||
if (obj && obj.error) { return; }
|
||||
optsPut.owners = [obj];
|
||||
}));
|
||||
}).nThen(function () {
|
||||
Cryptput(hash, data.toSave, function (e) {
|
||||
if (e) { throw new Error(e); }
|
||||
postMessage("ADD_PAD", {
|
||||
teamId: data.teamId,
|
||||
href: href,
|
||||
title: data.title,
|
||||
owners: optsPut.owners,
|
||||
path: ['template']
|
||||
}, function (obj) {
|
||||
if (obj && obj.error) { return void cb(obj.error); }
|
||||
cb();
|
||||
});
|
||||
}, optsPut);
|
||||
});
|
||||
};
|
||||
|
||||
common.isTemplate = function (href, cb) {
|
||||
|
|
|
@ -89,7 +89,6 @@ define([
|
|||
var faShared = 'fa-shhare-alt';
|
||||
var faReadOnly = 'fa-eye';
|
||||
var faPreview = 'fa-eye';
|
||||
var faOpenInCode = 'cptools-code';
|
||||
var faRename = 'fa-pencil';
|
||||
var faColor = 'cptools-palette';
|
||||
var faTrash = 'fa-trash';
|
||||
|
@ -331,8 +330,42 @@ define([
|
|||
return $(".cp-app-drive-element-selected");
|
||||
};
|
||||
|
||||
var getNewPadTypes = function () {
|
||||
var arr = [];
|
||||
AppConfig.availablePadTypes.forEach(function (type) {
|
||||
if (AppConfig.hiddenTypes.indexOf(type) !== -1) { return; }
|
||||
if (!APP.loggedIn && AppConfig.registeredOnlyTypes &&
|
||||
AppConfig.registeredOnlyTypes.indexOf(type) !== -1) {
|
||||
return;
|
||||
}
|
||||
arr.push(type);
|
||||
});
|
||||
return arr;
|
||||
};
|
||||
|
||||
var createContextMenu = function () {
|
||||
var createContextMenu = function (common) {
|
||||
var metadataMgr = common.getMetadataMgr();
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
|
||||
APP.premiumPlan = priv.plan;
|
||||
var getOpenIn = function (app) {
|
||||
var icon = AppConfig.applicationsIcon[app];
|
||||
var cls = icon.indexOf('cptools') === 0 ? 'cptools '+icon : 'fa '+icon;
|
||||
var html = '<i class="'+cls+'"></i>' + Messages.type[app];
|
||||
return Messages._getKey('fc_openIn', [html]);
|
||||
};
|
||||
var restricted = {};
|
||||
var enabled = [];
|
||||
var isAppEnabled = function (app) {
|
||||
return enabled.includes(app);
|
||||
};
|
||||
getNewPadTypes().forEach(function (app) {
|
||||
if (!Array.isArray(AppConfig.availablePadTypes)) { return void enabled.push(app); }
|
||||
var registered = common.isLoggedIn() || !(AppConfig.registeredOnlyTypes || []).includes(app);
|
||||
restricted[app] = common.checkRestrictedApp(app);
|
||||
var e = AppConfig.availablePadTypes.includes(app) && registered && restricted[app] >= 0;
|
||||
if (e) { enabled.push(app); }
|
||||
});
|
||||
var menu = h('div.cp-contextmenu.dropdown.cp-unselectable', [
|
||||
h('ul.dropdown-menu', {
|
||||
'role': 'menu',
|
||||
|
@ -352,10 +385,22 @@ define([
|
|||
'tabindex': '-1',
|
||||
'data-icon': faReadOnly,
|
||||
}, h('span.cp-text', Messages.fc_open_ro))),
|
||||
h('li', h('a.cp-app-drive-context-openincode.dropdown-item', {
|
||||
isAppEnabled('code') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openincode.dropdown-item', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': faOpenInCode,
|
||||
}, Messages.fc_openInCode)),
|
||||
'data-icon': 'fa-arrows',
|
||||
}), getOpenIn('code'))) : undefined,
|
||||
isAppEnabled('sheet') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openinsheet.dropdown-item', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': 'fa-arrows',
|
||||
}), getOpenIn('sheet'))) : undefined,
|
||||
isAppEnabled('doc') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openindoc.dropdown-item' + (restricted.doc === 0 ? '.cp-app-disabled' : ''), {
|
||||
'tabindex': '-1',
|
||||
'data-icon': 'fa-arrows',
|
||||
}), getOpenIn('doc'))) : undefined,
|
||||
isAppEnabled('presentation') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openinpresentation.dropdown-item' + (restricted.presentation === 0 ? '.cp-app-disabled' : ''), {
|
||||
'tabindex': '-1',
|
||||
'data-icon': 'fa-arrows',
|
||||
}), getOpenIn('presentation'))) : undefined,
|
||||
h('li', h('a.cp-app-drive-context-savelocal.dropdown-item', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': 'fa-cloud-upload',
|
||||
|
@ -404,51 +449,21 @@ define([
|
|||
$separator.clone()[0],
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.pad,
|
||||
'data-type': 'pad'
|
||||
}, Messages.button_newpad)),
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.code,
|
||||
'data-type': 'code'
|
||||
}, Messages.button_newcode)),
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.slide,
|
||||
'data-type': 'slide'
|
||||
}, Messages.button_newslide)),
|
||||
'data-icon': AppConfig.applicationsIcon.link,
|
||||
'data-type': 'link'
|
||||
}, Messages.fm_link_new)),
|
||||
h('li.dropdown-submenu', [
|
||||
h('a.cp-app-drive-context-newdocmenu.dropdown-item', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': "fa-plus",
|
||||
}, Messages.fm_morePads),
|
||||
h("ul.dropdown-menu", [
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
}, Messages.fm_newFile),
|
||||
h("ul.dropdown-menu", getNewPadTypes().map(function (app) {
|
||||
return isAppEnabled(app) ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable' + (restricted[app] === 0 ? '.cp-app-disabled' : ''), {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.sheet,
|
||||
'data-type': 'sheet'
|
||||
}, Messages.button_newsheet)),
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.whiteboard,
|
||||
'data-type': 'whiteboard'
|
||||
}, Messages.button_newwhiteboard)),
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.kanban,
|
||||
'data-type': 'kanban'
|
||||
}, Messages.button_newkanban)),
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.poll,
|
||||
'data-type': 'poll'
|
||||
}, Messages.button_newpoll)),
|
||||
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
|
||||
'tabindex': '-1',
|
||||
'data-icon': AppConfig.applicationsIcon.link,
|
||||
'data-type': 'link'
|
||||
}, Messages.fm_link_new)),
|
||||
]),
|
||||
'data-icon': AppConfig.applicationsIcon[app],
|
||||
'data-type': app
|
||||
}, Messages.type[app])) : undefined;
|
||||
})),
|
||||
]),
|
||||
$separator.clone()[0],
|
||||
h('li', h('a.cp-app-drive-context-empty.dropdown-item.cp-app-drive-context-editable', {
|
||||
|
@ -613,7 +628,7 @@ define([
|
|||
var $content = APP.$content = $("#cp-app-drive-content");
|
||||
var $appContainer = $(".cp-app-drive-container");
|
||||
var $driveToolbar = APP.toolbar.$bottom;
|
||||
var $contextMenu = createContextMenu().appendTo($appContainer);
|
||||
var $contextMenu = createContextMenu(common).appendTo($appContainer);
|
||||
|
||||
var $contentContextMenu = $("#cp-app-drive-context-content");
|
||||
var $defaultContextMenu = $("#cp-app-drive-context-default");
|
||||
|
@ -625,7 +640,7 @@ define([
|
|||
// DRIVE
|
||||
var currentPath = APP.currentPath = LS.getLastOpenedFolder();
|
||||
if (APP.newSharedFolder) {
|
||||
var newSFPaths = manager.findFile(APP.newSharedFolder);
|
||||
var newSFPaths = manager.findFile(Number(APP.newSharedFolder));
|
||||
if (newSFPaths.length) {
|
||||
currentPath = newSFPaths[0];
|
||||
}
|
||||
|
@ -654,6 +669,8 @@ define([
|
|||
displayedCategories = [FILES_DATA];
|
||||
currentPath = [FILES_DATA];
|
||||
}
|
||||
} else if (priv.isEmbed && APP.newSharedFolder) {
|
||||
displayedCategories = [ROOT, TRASH];
|
||||
}
|
||||
|
||||
APP.editable = !APP.readOnly;
|
||||
|
@ -1229,7 +1246,7 @@ define([
|
|||
if (className === 'uploadfiles') { return; }
|
||||
if (className === 'uploadfolder') { return !APP.allowFolderUpload; }
|
||||
if (className === 'newdoc') {
|
||||
return AppConfig.availablePadTypes.indexOf($el.attr('data-type')) === -1;
|
||||
return;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
@ -1274,9 +1291,6 @@ define([
|
|||
hide.push('openincode');
|
||||
hide.push('preview');
|
||||
}
|
||||
if ($element.is('.cp-border-color-sheet')) {
|
||||
hide.push('download');
|
||||
}
|
||||
if ($element.is('.cp-app-drive-static')) {
|
||||
hide.push('access', 'hashtag', 'properties', 'download');
|
||||
}
|
||||
|
@ -1293,6 +1307,25 @@ define([
|
|||
if (!metadata || !Util.isPlainTextFile(metadata.fileType, metadata.title)) {
|
||||
hide.push('openincode');
|
||||
}
|
||||
|
||||
if (metadata && /\/(doc|presentation|sheet)\//.test(metadata.href)) {
|
||||
hide.push('openinsheet');
|
||||
hide.push('openindoc');
|
||||
hide.push('openinpresentation');
|
||||
}
|
||||
|
||||
if (!metadata || !Util.isSpreadsheet(metadata.fileType, metadata.title)
|
||||
|| !priv.supportsWasm) {
|
||||
hide.push('openinsheet');
|
||||
}
|
||||
if (!metadata || !Util.isOfficeDoc(metadata.fileType, metadata.title)
|
||||
|| !priv.supportsWasm) {
|
||||
hide.push('openindoc');
|
||||
}
|
||||
if (!metadata || !Util.isPresentation(metadata.fileType, metadata.title)
|
||||
|| !priv.supportsWasm) {
|
||||
hide.push('openinpresentation');
|
||||
}
|
||||
if (metadata.channel && metadata.channel.length < 48) {
|
||||
hide.push('preview');
|
||||
}
|
||||
|
@ -1309,6 +1342,9 @@ define([
|
|||
containsFolder = true;
|
||||
hide.push('openro');
|
||||
hide.push('openincode');
|
||||
hide.push('openinsheet');
|
||||
hide.push('openindoc');
|
||||
hide.push('openinpresentation');
|
||||
hide.push('hashtag');
|
||||
//hide.push('delete');
|
||||
hide.push('makeacopy');
|
||||
|
@ -1324,6 +1360,9 @@ define([
|
|||
hide.push('savelocal');
|
||||
hide.push('openro');
|
||||
hide.push('openincode');
|
||||
hide.push('openinsheet');
|
||||
hide.push('openindoc');
|
||||
hide.push('openinpresentation');
|
||||
hide.push('properties', 'access');
|
||||
hide.push('hashtag');
|
||||
hide.push('makeacopy');
|
||||
|
@ -1355,7 +1394,8 @@ define([
|
|||
hide.push('download');
|
||||
hide.push('share');
|
||||
hide.push('savelocal');
|
||||
hide.push('openincode'); // can't because of race condition
|
||||
//hide.push('openincode'); // can't because of race condition
|
||||
//hide.push('openinsheet'); // can't because of race condition
|
||||
hide.push('makeacopy');
|
||||
hide.push('preview');
|
||||
}
|
||||
|
@ -1367,6 +1407,9 @@ define([
|
|||
if (!APP.loggedIn) {
|
||||
hide.push('openparent');
|
||||
hide.push('rename');
|
||||
hide.push('openinsheet');
|
||||
hide.push('openindoc');
|
||||
hide.push('openinpresentation');
|
||||
}
|
||||
|
||||
filter = function ($el, className) {
|
||||
|
@ -1380,11 +1423,12 @@ define([
|
|||
break;
|
||||
case 'tree':
|
||||
show = ['open', 'openro', 'preview', 'openincode', 'expandall', 'collapseall',
|
||||
'color', 'download', 'share', 'savelocal', 'rename', 'delete', 'makeacopy',
|
||||
'color', 'download', 'share', 'savelocal', 'rename', 'delete',
|
||||
'makeacopy', 'openinsheet', 'openindoc', 'openinpresentation',
|
||||
'deleteowned', 'removesf', 'access', 'properties', 'hashtag'];
|
||||
break;
|
||||
case 'default':
|
||||
show = ['open', 'openro', 'preview', 'openincode', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename'];
|
||||
show = ['open', 'openro', 'preview', 'openincode', 'openinsheet', 'openindoc', 'openinpresentation', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename'];
|
||||
break;
|
||||
case 'trashtree': {
|
||||
show = ['empty'];
|
||||
|
@ -2354,6 +2398,7 @@ define([
|
|||
path.forEach(function (p, idx) {
|
||||
if (isTrash && [2,3].indexOf(idx) !== -1) { return; }
|
||||
if (skipNext) { skipNext = false; return; }
|
||||
if (APP.newSharedFolder && priv.isEmbed && p === ROOT && !idx) { return; }
|
||||
var name = p;
|
||||
|
||||
if (manager.isFile(el) && isInTrashRoot && idx === 1) {
|
||||
|
@ -2394,7 +2439,7 @@ define([
|
|||
addDragAndDropHandlers($span, path.slice(0, idx), true, true);
|
||||
|
||||
if (idx === 0) { name = p === SHARED_FOLDER ? name : getPrettyName(p); }
|
||||
else {
|
||||
else if (!(APP.newSharedFolder && priv.isEmbed && idx === 1)) {
|
||||
var $span2 = $('<span>', {
|
||||
'class': 'cp-app-drive-path-element cp-app-drive-path-separator'
|
||||
}).text(' / ');
|
||||
|
@ -2615,18 +2660,6 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
var getNewPadTypes = function () {
|
||||
var arr = [];
|
||||
AppConfig.availablePadTypes.forEach(function (type) {
|
||||
if (AppConfig.hiddenTypes.indexOf(type) !== -1) { return; }
|
||||
if (!APP.loggedIn && AppConfig.registeredOnlyTypes &&
|
||||
AppConfig.registeredOnlyTypes.indexOf(type) !== -1) {
|
||||
return;
|
||||
}
|
||||
arr.push(type);
|
||||
});
|
||||
return arr;
|
||||
};
|
||||
var showUploadFilesModal = function () {
|
||||
var $input = $('<input>', {
|
||||
'type': 'file',
|
||||
|
@ -2885,6 +2918,14 @@ define([
|
|||
'data-type': type,
|
||||
'href': '#'
|
||||
};
|
||||
|
||||
var premium = common.checkRestrictedApp(type);
|
||||
if (premium < 0) {
|
||||
attributes.class += ' cp-app-hidden cp-app-disabled';
|
||||
} else if (premium === 0) {
|
||||
attributes.class += ' cp-app-disabled';
|
||||
}
|
||||
|
||||
options.push({
|
||||
tag: 'a',
|
||||
attributes: attributes,
|
||||
|
@ -3211,6 +3252,13 @@ define([
|
|||
$element.append($('<span>', {'class': 'cp-app-drive-new-name'})
|
||||
.text(Messages.type[type]));
|
||||
$element.attr('data-type', type);
|
||||
|
||||
var premium = common.checkRestrictedApp(type);
|
||||
if (premium < 0) {
|
||||
$element.addClass('cp-app-hidden cp-app-disabled');
|
||||
} else if (premium === 0) {
|
||||
$element.addClass('cp-app-disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$container.find('.cp-app-drive-element-row').click(function () {
|
||||
|
@ -4062,17 +4110,28 @@ define([
|
|||
var createTree = function ($container, path) {
|
||||
var root = manager.find(path);
|
||||
|
||||
var isRoot = manager.comparePath([ROOT], path);
|
||||
var rootName = ROOT_NAME;
|
||||
if (APP.newSharedFolder && priv.isEmbed && isRoot) {
|
||||
var newSFPaths = manager.findFile(Number(APP.newSharedFolder));
|
||||
if (newSFPaths.length) {
|
||||
path = newSFPaths[0];
|
||||
path.push(ROOT);
|
||||
root = manager.find(path);
|
||||
rootName = manager.getSharedFolderData(APP.newSharedFolder).title;
|
||||
}
|
||||
}
|
||||
|
||||
// don't try to display what doesn't exist
|
||||
if (!root) { return; }
|
||||
|
||||
// Display the root element in the tree
|
||||
var displayingRoot = manager.comparePath([ROOT], path);
|
||||
if (displayingRoot) {
|
||||
var isRootOpened = manager.comparePath([ROOT], currentPath);
|
||||
if (isRoot) {
|
||||
var isRootOpened = manager.comparePath(path.slice(), currentPath);
|
||||
var $rootIcon = manager.isFolderEmpty(files[ROOT]) ?
|
||||
(isRootOpened ? $folderOpenedEmptyIcon : $folderEmptyIcon) :
|
||||
(isRootOpened ? $folderOpenedIcon : $folderIcon);
|
||||
var $rootElement = createTreeElement(ROOT_NAME, $rootIcon.clone(), [ROOT], false, true, true, isRootOpened);
|
||||
var $rootElement = createTreeElement(rootName, $rootIcon.clone(), path.slice(), false, true, true, isRootOpened);
|
||||
if (!manager.hasSubfolder(root)) {
|
||||
$rootElement.find('.cp-app-drive-icon-expcol').css('visibility', 'hidden');
|
||||
}
|
||||
|
@ -4297,10 +4356,6 @@ define([
|
|||
Access.getAccessModal(common, opts, cb);
|
||||
};
|
||||
|
||||
if (!APP.loggedIn) {
|
||||
$contextMenu.find('.cp-app-drive-context-delete').attr('data-icon', faDelete)
|
||||
.html($contextMenu.find('.cp-app-drive-context-remove').html());
|
||||
}
|
||||
var deleteOwnedPaths = function (paths, pathsList) {
|
||||
pathsList = pathsList || [];
|
||||
if (paths) {
|
||||
|
@ -4349,8 +4404,23 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
var openInApp = function (paths, app) {
|
||||
var p = paths[0];
|
||||
var el = manager.find(p.path);
|
||||
var path = currentPath;
|
||||
if (path[0] !== ROOT) { path = [ROOT]; }
|
||||
var _metadata = manager.getFileData(el);
|
||||
var _simpleData = {
|
||||
title: _metadata.filename || _metadata.title,
|
||||
href: _metadata.href || _metadata.roHref,
|
||||
fileType: _metadata.fileType,
|
||||
password: _metadata.password,
|
||||
channel: _metadata.channel,
|
||||
};
|
||||
openIn(app, path, APP.team, _simpleData);
|
||||
};
|
||||
|
||||
$contextMenu.on("click", "a", function(e) {
|
||||
var addContextEvent = function () { $contextMenu.on("click", "a", function(e) {
|
||||
e.stopPropagation();
|
||||
var paths = $contextMenu.data('paths');
|
||||
var pathsList = [];
|
||||
|
@ -4436,20 +4506,19 @@ define([
|
|||
}
|
||||
else if ($this.hasClass('cp-app-drive-context-openincode')) {
|
||||
if (paths.length !== 1) { return; }
|
||||
var p = paths[0];
|
||||
el = manager.find(p.path);
|
||||
(function () {
|
||||
var path = currentPath;
|
||||
if (path[0] !== ROOT) { path = [ROOT]; }
|
||||
var _metadata = manager.getFileData(el);
|
||||
var _simpleData = {
|
||||
title: _metadata.filename || _metadata.title,
|
||||
href: _metadata.href || _metadata.roHref,
|
||||
password: _metadata.password,
|
||||
channel: _metadata.channel,
|
||||
};
|
||||
openIn('code', path, APP.team, _simpleData);
|
||||
})();
|
||||
openInApp(paths, 'code');
|
||||
}
|
||||
else if ($this.hasClass('cp-app-drive-context-openinsheet')) {
|
||||
if (paths.length !== 1) { return; }
|
||||
openInApp(paths, 'sheet');
|
||||
}
|
||||
else if ($this.hasClass('cp-app-drive-context-openindoc')) {
|
||||
if (paths.length !== 1) { return; }
|
||||
openInApp(paths, 'doc');
|
||||
}
|
||||
else if ($this.hasClass('cp-app-drive-context-openinpresentation')) {
|
||||
if (paths.length !== 1) { return; }
|
||||
openInApp(paths, 'presentation');
|
||||
}
|
||||
else if ($this.hasClass('cp-app-drive-context-expandall') ||
|
||||
$this.hasClass('cp-app-drive-context-collapseall')) {
|
||||
|
@ -4770,8 +4839,23 @@ define([
|
|||
APP.selectedFiles = paths[0].path.slice(-1);
|
||||
}
|
||||
APP.hideMenu();
|
||||
}); };
|
||||
|
||||
addContextEvent();
|
||||
metadataMgr.onChange(function () {
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
if (priv.plan !== APP.premiumPlan) {
|
||||
$contextMenu.remove();
|
||||
$contextMenu = createContextMenu(common).appendTo($appContainer);
|
||||
if (!APP.loggedIn) {
|
||||
$contextMenu.find('.cp-app-drive-context-delete').attr('data-icon', faDelete)
|
||||
.html($contextMenu.find('.cp-app-drive-context-remove').html());
|
||||
}
|
||||
addContextEvent();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Chrome considers the double-click means "select all" in the window
|
||||
$content.on('mousedown', function (e) {
|
||||
$content.focus();
|
||||
|
|
|
@ -28,7 +28,7 @@ define([
|
|||
return n;
|
||||
};
|
||||
|
||||
var transform = function (ctx, type, sjson, cb) {
|
||||
var transform = function (ctx, type, sjson, cb, padData) {
|
||||
var result = {
|
||||
data: sjson,
|
||||
ext: '.json',
|
||||
|
@ -41,11 +41,11 @@ define([
|
|||
}
|
||||
var path = '/' + type + '/export.js';
|
||||
require([path], function (Exporter) {
|
||||
Exporter.main(json, function (data) {
|
||||
result.ext = Exporter.ext || '';
|
||||
Exporter.main(json, function (data, _ext) {
|
||||
result.ext = _ext || Exporter.ext || '';
|
||||
result.data = data;
|
||||
cb(result);
|
||||
});
|
||||
}, null, ctx.sframeChan, padData);
|
||||
}, function () {
|
||||
cb(result);
|
||||
});
|
||||
|
@ -117,12 +117,16 @@ define([
|
|||
var opts = {
|
||||
password: pData.password
|
||||
};
|
||||
var padData = {
|
||||
hash: parsed.hash,
|
||||
password: pData.password
|
||||
};
|
||||
var handler = ctx.sframeChan.on("EV_CRYPTGET_PROGRESS", function (data) {
|
||||
if (data.hash !== parsed.hash) { return; }
|
||||
updateProgress.progress(data.progress);
|
||||
if (data.progress === 1) {
|
||||
handler.stop();
|
||||
updateProgress.progress2(1);
|
||||
updateProgress.progress2(2);
|
||||
}
|
||||
});
|
||||
ctx.get({
|
||||
|
@ -136,14 +140,15 @@ define([
|
|||
if (cancelled) { return; }
|
||||
if (!res.data) { return; }
|
||||
var dl = function () {
|
||||
saveAs(res.data, Util.fixFileName(name));
|
||||
saveAs(res.data, Util.fixFileName(name)+(res.ext || ''));
|
||||
};
|
||||
updateProgress.progress2(1);
|
||||
cb(null, {
|
||||
metadata: res.metadata,
|
||||
content: res.data,
|
||||
download: dl
|
||||
});
|
||||
});
|
||||
}, padData);
|
||||
});
|
||||
return {
|
||||
cancel: cancel
|
||||
|
@ -195,9 +200,16 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
var timeout = 60000;
|
||||
// OO pads can only be converted one at a time so we have to give them a
|
||||
// bigger timeout value in case there are 5 of them in the current queue
|
||||
if (['sheet', 'doc', 'presentation'].indexOf(parsed.type) !== -1) {
|
||||
timeout = 180000;
|
||||
}
|
||||
|
||||
to = setTimeout(function () {
|
||||
error('TIMEOUT');
|
||||
}, 60000);
|
||||
}, timeout);
|
||||
|
||||
setTimeout(function () {
|
||||
if (ctx.stop) { return; }
|
||||
|
@ -228,6 +240,9 @@ define([
|
|||
zip.file(fileName, res.data, opts);
|
||||
console.log('DONE ---- ' + fileName);
|
||||
setTimeout(done, 500);
|
||||
}, {
|
||||
hash: parsed.hash,
|
||||
password: fData.password
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -292,7 +307,7 @@ define([
|
|||
};
|
||||
|
||||
// Main function. Create the empty zip and fill it starting from drive.root
|
||||
var create = function (data, getPad, fileHost, cb, progress, cache) {
|
||||
var create = function (data, getPad, fileHost, cb, progress, cache, sframeChan) {
|
||||
if (!data || !data.uo || !data.uo.drive) { return void cb('EEMPTY'); }
|
||||
var sem = Saferphore.create(5);
|
||||
var ctx = {
|
||||
|
@ -307,7 +322,8 @@ define([
|
|||
updateProgress: progress,
|
||||
max: 0,
|
||||
done: 0,
|
||||
cache: cache
|
||||
cache: cache,
|
||||
sframeChan: sframeChan
|
||||
};
|
||||
var filesData = data.sharedFolderId && ctx.sf[data.sharedFolderId] ? ctx.sf[data.sharedFolderId].filesData : ctx.data.filesData;
|
||||
progress('reading', -1); // Msg.settings_export_reading
|
||||
|
@ -358,7 +374,7 @@ define([
|
|||
else if (state === "done") {
|
||||
updateProgress.folderProgress(3);
|
||||
}
|
||||
}, ctx.cache);
|
||||
}, ctx.cache, ctx.sframeChan);
|
||||
};
|
||||
|
||||
var createExportUI = function (origin) {
|
||||
|
|
|
@ -82,7 +82,11 @@ var factory = function () {
|
|||
plainText.innerText = e.srcElement.result;
|
||||
cb(void 0, plainText);
|
||||
});
|
||||
reader.readAsText(content);
|
||||
try {
|
||||
reader.readAsText(content);
|
||||
} catch (err) {
|
||||
cb(err);
|
||||
}
|
||||
},
|
||||
image: function (metadata, url, content, cfg, cb) {
|
||||
var img = document.createElement('img');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define(['/api/config'], function (ApiConfig) {
|
||||
var Module = {};
|
||||
|
||||
var apps = ['code', 'slide', 'pad', 'kanban', 'whiteboard', 'sheet', 'poll', 'teams', 'form'];
|
||||
var apps = ['code', 'slide', 'pad', 'kanban', 'whiteboard', 'sheet', 'poll', 'teams', 'form', 'doc', 'presentation'];
|
||||
var app = window.location.pathname.slice(1, -1); // remove "/" at the beginnin and the end
|
||||
var suffix = apps.indexOf(app) !== -1 ? '-'+app : '';
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ define([
|
|||
|
||||
// The first "cp" in history is the empty doc. It doesn't include the first patch
|
||||
// of the history
|
||||
var initialCp = cpIndex === sortedCp.length;
|
||||
var initialCp = cpIndex === sortedCp.length || !cp.hash;
|
||||
|
||||
var messages = (data.messages || []).slice(initialCp ? 0 : 1);
|
||||
|
||||
|
|
|
@ -143,6 +143,15 @@ define([
|
|||
}
|
||||
sframeChan.event('EV_OO_EVENT', obj);
|
||||
});
|
||||
|
||||
// X2T
|
||||
sframeChan.on('Q_OO_CONVERT', function (obj, cb) {
|
||||
obj.modal = 'x2t';
|
||||
Utils.initUnsafeIframe(obj, cb);
|
||||
});
|
||||
|
||||
|
||||
|
||||
};
|
||||
SFCommonO.start({
|
||||
hash: hash,
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
// Load #1, load as little as possible because we are in a race to get the loading screen up.
|
||||
define([
|
||||
'/bower_components/nthen/index.js',
|
||||
'/api/config',
|
||||
'jquery',
|
||||
'/common/requireconfig.js',
|
||||
'/customize/messages.js',
|
||||
], function (nThen, ApiConfig, $, RequireConfig, Messages) {
|
||||
var requireConfig = RequireConfig();
|
||||
|
||||
var ready = false;
|
||||
var currentCb;
|
||||
var queue = [];
|
||||
|
||||
var create = function (config) {
|
||||
// Loaded in load #2
|
||||
var sframeChan;
|
||||
var refresh = function (data, cb) {
|
||||
if (currentCb) {
|
||||
queue.push({data: data, cb: cb});
|
||||
return;
|
||||
}
|
||||
if (!ready) {
|
||||
ready = function () {
|
||||
refresh(data, cb);
|
||||
};
|
||||
return;
|
||||
}
|
||||
currentCb = cb;
|
||||
sframeChan.event('EV_OOIFRAME_REFRESH', data);
|
||||
};
|
||||
nThen(function (waitFor) {
|
||||
$(waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
var lang = Messages._languageUsed;
|
||||
var themeKey = 'CRYPTPAD_STORE|colortheme';
|
||||
var req = {
|
||||
cfg: requireConfig,
|
||||
req: [ '/common/loading.js' ],
|
||||
pfx: window.location.origin,
|
||||
theme: localStorage[themeKey],
|
||||
themeOS: localStorage[themeKey+'_default'],
|
||||
lang: lang
|
||||
};
|
||||
window.rc = requireConfig;
|
||||
window.apiconf = ApiConfig;
|
||||
$('#sbox-oo-iframe').attr('src',
|
||||
ApiConfig.httpSafeOrigin + '/sheet/inner.html?' + requireConfig.urlArgs +
|
||||
'#' + encodeURIComponent(JSON.stringify(req)));
|
||||
|
||||
// This is a cheap trick to avoid loading sframe-channel in parallel with the
|
||||
// loading screen setup.
|
||||
var done = waitFor();
|
||||
var onMsg = function (msg) {
|
||||
var data = typeof(msg.data) === "object" ? msg.data : JSON.parse(msg.data);
|
||||
if (data.q !== 'READY') { return; }
|
||||
window.removeEventListener('message', onMsg);
|
||||
var _done = done;
|
||||
done = function () { };
|
||||
_done();
|
||||
};
|
||||
window.addEventListener('message', onMsg);
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
var Cryptpad = config.modules.Cryptpad;
|
||||
var Utils = config.modules.Utils;
|
||||
|
||||
nThen(function (waitFor) {
|
||||
// The inner iframe tries to get some data from us every ms (cache, store...).
|
||||
// It will send a "READY" message and wait for our answer with the correct txid.
|
||||
// First, we have to answer to this message, otherwise we're going to block
|
||||
// sframe-boot.js. Then we can start the channel.
|
||||
var msgEv = Utils.Util.mkEvent();
|
||||
var iframe = $('#sbox-oo-iframe')[0].contentWindow;
|
||||
var postMsg = function (data) {
|
||||
iframe.postMessage(data, '*');
|
||||
};
|
||||
var w = waitFor();
|
||||
var whenReady = function (msg) {
|
||||
if (msg.source !== iframe) { return; }
|
||||
var data = JSON.parse(msg.data);
|
||||
if (!data.txid) { return; }
|
||||
// Remove the listener once we've received the READY message
|
||||
window.removeEventListener('message', whenReady);
|
||||
// Answer with the requested data
|
||||
postMsg(JSON.stringify({ txid: data.txid, language: Cryptpad.getLanguage(), localStore: window.localStore, cache: window.cpCache }));
|
||||
|
||||
// Then start the channel
|
||||
window.addEventListener('message', function (msg) {
|
||||
if (msg.source !== iframe) { return; }
|
||||
msgEv.fire(msg);
|
||||
});
|
||||
config.modules.SFrameChannel.create(msgEv, postMsg, waitFor(function (sfc) {
|
||||
sframeChan = sfc;
|
||||
}));
|
||||
w();
|
||||
};
|
||||
window.addEventListener('message', whenReady);
|
||||
}).nThen(function () {
|
||||
var updateMeta = function () {
|
||||
//console.log('EV_METADATA_UPDATE');
|
||||
var metaObj;
|
||||
nThen(function (waitFor) {
|
||||
Cryptpad.getMetadata(waitFor(function (err, n) {
|
||||
if (err) {
|
||||
waitFor.abort();
|
||||
return void console.log(err);
|
||||
}
|
||||
metaObj = n;
|
||||
}));
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
metaObj.doc = {};
|
||||
var additionalPriv = {
|
||||
fileHost: ApiConfig.fileHost,
|
||||
loggedIn: Utils.LocalStore.isLoggedIn(),
|
||||
origin: window.location.origin,
|
||||
pathname: window.location.pathname,
|
||||
feedbackAllowed: Utils.Feedback.state,
|
||||
secureIframe: true,
|
||||
supportsWasm: Utils.Util.supportsWasm()
|
||||
};
|
||||
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }
|
||||
|
||||
sframeChan.event('EV_METADATA_UPDATE', metaObj);
|
||||
});
|
||||
};
|
||||
Cryptpad.onMetadataChanged(updateMeta);
|
||||
sframeChan.onReg('EV_METADATA_UPDATE', updateMeta);
|
||||
|
||||
config.addCommonRpc(sframeChan, true);
|
||||
|
||||
Cryptpad.padRpc.onMetadataEvent.reg(function (data) {
|
||||
sframeChan.event('EV_RT_METADATA', data);
|
||||
});
|
||||
|
||||
sframeChan.on('EV_OOIFRAME_DONE', function (data) {
|
||||
if (queue.length) {
|
||||
setTimeout(function () {
|
||||
var first = queue.shift();
|
||||
refresh(first.data, first.cb);
|
||||
});
|
||||
}
|
||||
if (!currentCb) { return; }
|
||||
currentCb(data);
|
||||
currentCb = undefined;
|
||||
});
|
||||
|
||||
// X2T
|
||||
sframeChan.on('Q_OO_CONVERT', function (obj, cb) {
|
||||
obj.modal = 'x2t';
|
||||
Utils.initUnsafeIframe(obj, cb);
|
||||
});
|
||||
|
||||
sframeChan.onReady(function () {
|
||||
if (ready === true) { return; }
|
||||
if (typeof ready === "function") {
|
||||
ready();
|
||||
}
|
||||
ready = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
return {
|
||||
refresh: refresh
|
||||
};
|
||||
};
|
||||
return {
|
||||
create: create
|
||||
};
|
||||
});
|
|
@ -268,13 +268,13 @@ editorType;this._isExcel=c_oEditorId.Spreadsheet===editorType;this._isPresentati
|
|||
docid;this.sockjs_url=AscCommon.getBaseUrl()+"../../../../doc/"+docid+"/c"};DocsCoApi.prototype.auth=function(isViewer,opt_openCmd,opt_isIdle){this._isViewer=isViewer;if(this._locks){this.ownedLockBlocks=[];for(var block in this._locks)if(this._locks.hasOwnProperty(block)){var lock=this._locks[block];if(lock["state"]===2)this.ownedLockBlocks.push(lock["blockValue"])}this._locks={}}this._send({"type":"auth","docid":this._docid,"documentCallbackUrl":this._documentCallbackUrl,"token":this._token,"user":{"id":this._user.asc_getId(),
|
||||
"username":this._user.asc_getUserName(),"firstname":this._user.asc_getFirstName(),"lastname":this._user.asc_getLastName(),"indexUser":this._indexUser},"editorType":this.editorType,"lastOtherSaveTime":this.lastOtherSaveTime,"block":this.ownedLockBlocks,"sessionId":this._id,"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,
|
||||
"mode":this.mode,"permissions":this.permissions,"encrypted":this.encrypted,"jwtOpen":this.jwtOpen,"jwtSession":this.jwtSession})};DocsCoApi.prototype._initSocksJs=function(){var t=this;var sockjs;sockjs=this.sockjs={};var send=function(data){setTimeout(function(){sockjs.onmessage({data:JSON.stringify(data)})})};var license={type:"license",license:{type:3,mode:0,rights:1,buildVersion:"5.2.6",buildNumber:2}};var channel;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,
|
||||
Util){var msgEv=Util.mkEvent();var p=window.parent;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);
|
||||
return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,
|
||||
false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);
|
||||
break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);
|
||||
break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=
|
||||
null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};
|
||||
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
|
||||
Util){var msgEv=Util.mkEvent();var p=window.parent;if(editor&&editor.isReporterMode){p=window.opener;window.parent=p}else window.APP=p&&p.APP;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=
|
||||
function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=
|
||||
JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);
|
||||
break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);
|
||||
break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=
|
||||
c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=
|
||||
null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
|
||||
(function(window){var CSpellCheckApi=function(){this._SpellCheckApi=new SpellCheckApi;this._onlineWork=false;this.onDisconnect=null;this.onSpellCheck=null};CSpellCheckApi.prototype.init=function(docid){if(this._SpellCheckApi&&this._SpellCheckApi.isRightURL()){var t=this;this._SpellCheckApi.onDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){t.callback_OnDisconnect(e,isDisconnectAtAll,isCloseCoAuthoring)};this._SpellCheckApi.onSpellCheck=function(e){t.callback_OnSpellCheck(e)};this._SpellCheckApi.onInit=
|
||||
function(e){t.callback_OnInit(e)};this._SpellCheckApi.init(docid);this._onlineWork=true}};CSpellCheckApi.prototype.set_url=function(url){if(this._SpellCheckApi)this._SpellCheckApi.set_url(url)};CSpellCheckApi.prototype.get_state=function(){if(this._SpellCheckApi)return this._SpellCheckApi.get_state();return 0};CSpellCheckApi.prototype.disconnect=function(){if(this._SpellCheckApi&&this._onlineWork)this._SpellCheckApi.disconnect()};CSpellCheckApi.prototype.spellCheck=function(spellCheckData){if(this._SpellCheckApi&&
|
||||
this._onlineWork)this._SpellCheckApi.spellCheck(spellCheckData)};CSpellCheckApi.prototype.checkDictionary=function(lang){if(this._SpellCheckApi&&this._onlineWork)return this._SpellCheckApi.checkDictionary(lang);return true};CSpellCheckApi.prototype.callback_OnSpellCheck=function(e){if(this.onSpellCheck)return this.onSpellCheck(e)};CSpellCheckApi.prototype.callback_OnInit=function(e){if(this.onInit)return this.onInit(e)};CSpellCheckApi.prototype.callback_OnDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){if(this.onDisconnect)return this.onDisconnect(e,
|
||||
|
@ -1657,39 +1657,39 @@ function(){};baseEditorsApi.prototype._downloadAs=function(){};baseEditorsApi.pr
|
|||
actionType===c_oAscAsyncAction.Print?DownloadType.Print:DownloadType.Download;else downloadType=DownloadType.None;var isNoBase64=typeof ArrayBuffer!=="undefined"&&!isCloudCrypto;var dataContainer={data:null,part:null,index:0,count:0};var oAdditionalData={};oAdditionalData["c"]="save";oAdditionalData["id"]=this.documentId;oAdditionalData["userid"]=this.documentUserId;oAdditionalData["tokenSession"]=this.CoAuthoringApi.get_jwt();oAdditionalData["outputformat"]=options.fileType;oAdditionalData["title"]=
|
||||
AscCommon.changeFileExtention(this.documentTitle,AscCommon.getExtentionByFormat(options.fileType),Asc.c_nMaxDownloadTitleLen);oAdditionalData["nobase64"]=isNoBase64;if(DownloadType.Print===downloadType)oAdditionalData["inline"]=1;if(this._downloadAs(actionType,options,oAdditionalData,dataContainer))return;var t=this;this.fCurCallback=null;if(!options.callback)this.fCurCallback=function(input,status){var error=403===status?c_oAscError.ID.AccessDeny:c_oAscError.ID.Unknown;if(null!=input&&oAdditionalData["c"]===
|
||||
input["type"])if("ok"===input["status"]){var url=input["data"];if(url){error=c_oAscError.ID.No;t.processSavedFile(url,downloadType)}}else error=AscCommon.mapAscServerErrorToAscError(parseInt(input["data"]),AscCommon.c_oAscAdvancedOptionsAction.Save);if(c_oAscError.ID.No!==error){t.endInsertDocumentUrls();t.sendEvent("asc_onError",options.errorDirect||error,c_oAscError.Level.NoCritical)}if(actionType)t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType)};if(window.parent.APP.printPdf&&
|
||||
(DownloadType.Print===downloadType||!downloadType)){window.parent.APP.printPdf(dataContainer,options.callback||this.fCurCallback);return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=
|
||||
function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};
|
||||
baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});
|
||||
return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=
|
||||
this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};
|
||||
baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);
|
||||
var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},
|
||||
this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&
|
||||
AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);
|
||||
var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,
|
||||
sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=
|
||||
function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);
|
||||
else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};
|
||||
baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,
|
||||
options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};
|
||||
baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=
|
||||
function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=
|
||||
function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();
|
||||
if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;
|
||||
var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;
|
||||
var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};
|
||||
baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();
|
||||
var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name<b.name)return-1;
|
||||
return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",
|
||||
this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;
|
||||
pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=
|
||||
transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,
|
||||
extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,
|
||||
plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};
|
||||
baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=
|
||||
function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&
|
||||
c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};
|
||||
baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
|
||||
(DownloadType.Print===downloadType||!downloadType)){var _cb=options.callback||this.fCurCallback;window.parent.APP.printPdf(dataContainer,function(obj){if(!obj){t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType);return}_cb(obj)});return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=
|
||||
function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=
|
||||
elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");
|
||||
t.asc_addImageCallback(res);t._addImageUrl([res.url],obj)},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,
|
||||
c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);
|
||||
else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=
|
||||
function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&
|
||||
data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=
|
||||
oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=
|
||||
function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,
|
||||
function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=
|
||||
value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;
|
||||
if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<
|
||||
newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&
|
||||
this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=
|
||||
false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==
|
||||
0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&
|
||||
this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();
|
||||
this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};
|
||||
baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,
|
||||
function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};
|
||||
baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};
|
||||
baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);
|
||||
aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name<b.name)return-1;return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());
|
||||
var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;
|
||||
if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=
|
||||
this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,
|
||||
_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&
|
||||
true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};
|
||||
baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};
|
||||
baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);
|
||||
this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();
|
||||
this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
|
||||
baseEditorsApi.prototype.asc_nativeInitBuilder=function(){AscCommon.History.TurnOff();this.asc_setDocInfo(new Asc.asc_CDocInfo)};baseEditorsApi.prototype.asc_SetSilentMode=function(){};baseEditorsApi.prototype.asc_canPaste=function(){return false};baseEditorsApi.prototype.asc_Recalculate=function(){};baseEditorsApi.prototype["asc_nativeCheckPdfRenderer"]=function(_memory1,_memory2){if(true){_memory1.Copy=_memory1["Copy"];_memory1.ClearNoAttack=_memory1["ClearNoAttack"];_memory1.WriteByte=_memory1["WriteByte"];
|
||||
_memory1.WriteBool=_memory1["WriteBool"];_memory1.WriteLong=_memory1["WriteLong"];_memory1.WriteDouble=_memory1["WriteDouble"];_memory1.WriteString=_memory1["WriteString"];_memory1.WriteString2=_memory1["WriteString2"];_memory2.Copy=_memory1["Copy"];_memory2.ClearNoAttack=_memory1["ClearNoAttack"];_memory2.WriteByte=_memory1["WriteByte"];_memory2.WriteBool=_memory1["WriteBool"];_memory2.WriteLong=_memory1["WriteLong"];_memory2.WriteDouble=_memory1["WriteDouble"];_memory2.WriteString=_memory1["WriteString"];
|
||||
_memory2.WriteString2=_memory1["WriteString2"]}var _printer=new AscCommon.CDocumentRenderer;_printer.Memory=_memory1;_printer.VectorMemoryForPrint=_memory2;return _printer};baseEditorsApi.prototype.Begin_CompositeInput=function(){};baseEditorsApi.prototype.Add_CompositeText=function(nCharCode){};baseEditorsApi.prototype.Remove_CompositeText=function(nCount){};baseEditorsApi.prototype.Replace_CompositeText=function(arrCharCodes){};baseEditorsApi.prototype.Set_CursorPosInCompositeText=function(nPos){};
|
||||
|
|
|
@ -4684,118 +4684,118 @@ null};CGraphicObjectBase.prototype.drawCropTrack=function(graphics,srcRect,trans
|
|||
oldExtX;this.extY=oldExtY;this.setSrcRect(this.calculateSrcRect2());this.clearCropObject()};CGraphicObjectBase.prototype.setSrcRect=function(srcRect){if(this.getObjectType()===AscDFH.historyitem_type_ImageShape){var blipFill=this.blipFill.createDuplicate();blipFill.srcRect=srcRect;this.setBlipFill(blipFill)}else{var brush=this.brush.createDuplicate();brush.fill.srcRect=srcRect;this.spPr.setFill(brush)}};CGraphicObjectBase.prototype.calculateSrcRect2=function(){var oShapeDrawer=new AscCommon.CShapeDrawer;
|
||||
oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;this.check_bounds(oShapeDrawer);return CalculateSrcRect(this.transform,oShapeDrawer,this.cropObject.invertTransform,this.cropObject.extX,this.cropObject.extY)};CGraphicObjectBase.prototype.getMediaFileName=function(){return null};CGraphicObjectBase.prototype.getLogicDocument=function(){var oApi=editor||Asc["editor"];if(oApi&&oApi.WordControl)return oApi.WordControl.m_oLogicDocument;return null};CGraphicObjectBase.prototype.updatePosition=
|
||||
function(x,y){this.posX=x;this.posY=y;if(!this.group){this.x=this.localX+x;this.y=this.localY+y}else{this.x=this.localX;this.y=this.localY}if(this.updateTransformMatrix)this.updateTransformMatrix()};CGraphicObjectBase.prototype.copyComments=function(oLogicDocument){if(!oLogicDocument)return;var aDocContents=[];this.getAllDocContents(aDocContents);for(var i=0;i<aDocContents.length;++i)aDocContents[i].CreateDuplicateComments()};CGraphicObjectBase.prototype.createPlaceholderControl=function(){var phType=
|
||||
this.getPhType();var aButtons=[];var isLocalDesktop=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsSupportMedia"]&&window["AscDesktopEditor"]["IsSupportMedia"]();switch(phType){case null:{aButtons.push(AscCommon.PlaceholderButtonType.Table);aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_body:{break}case AscFormat.phType_chart:{aButtons.push(AscCommon.PlaceholderButtonType.Chart);
|
||||
break}case AscFormat.phType_clipArt:{aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_ctrTitle:{break}case AscFormat.phType_dgm:{break}case AscFormat.phType_dt:{break}case AscFormat.phType_ftr:{break}case AscFormat.phType_hdr:{break}case AscFormat.phType_media:{if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_obj:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
||||
aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_pic:{aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_sldImg:{aButtons.push(AscCommon.PlaceholderButtonType.Image);
|
||||
aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_sldNum:{break}case AscFormat.phType_subTitle:{break}case AscFormat.phType_tbl:{aButtons.push(AscCommon.PlaceholderButtonType.Table);break}case AscFormat.phType_title:{break}}var nSlideNum=0;if(this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Slide)nSlideNum=this.parent.num;return AscCommon.CreateDrawingPlaceholder(this.Id,aButtons,nSlideNum,{x:0,y:0,w:this.extX,h:this.extY},this.transform)};
|
||||
CGraphicObjectBase.prototype.onSlicerUpdate=function(sName){return false};CGraphicObjectBase.prototype.onSlicerLock=function(sName,bLock){};CGraphicObjectBase.prototype.onSlicerDelete=function(sName){return false};CGraphicObjectBase.prototype.onSlicerChangeName=function(sName,sNewName){return false};CGraphicObjectBase.prototype.onUpdate=function(oRect){if(this.drawingBase)this.drawingBase.onUpdate(oRect);else if(this.group)this.group.onUpdate(oRect)};CGraphicObjectBase.prototype.getSlicerViewByName=
|
||||
function(name){return null};CGraphicObjectBase.prototype.setParent2=function(parent){this.setParent(parent);if(Array.isArray(this.spTree))for(var i=0;i<this.spTree.length;++i)this.spTree[i].setParent2(parent)};CGraphicObjectBase.prototype.documentCreateFontMap=function(oMap){};CGraphicObjectBase.prototype.createFontMap=function(oMap){this.documentCreateFontMap(oMap)};function CRelSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=
|
||||
null;this.drawingBase=null}CRelSizeAnchor.prototype=Object.create(CBaseObject.prototype);CRelSizeAnchor.prototype.constructor=CRelSizeAnchor;CRelSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CRelSizeAnchor.prototype.getObjectType=function(){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));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));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));this.parent=object};CRelSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CRelSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&
|
||||
this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CRelSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromX]=function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToX]=function(oClass,
|
||||
value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromY]=
|
||||
window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorObject]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;function CAbsSizeAnchor(){CBaseObject.call(this);this.fromX=
|
||||
null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CAbsSizeAnchor.prototype=Object.create(CBaseObject.prototype);CAbsSizeAnchor.prototype.constructor=CAbsSizeAnchor;CAbsSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CAbsSizeAnchor.prototype.getObjectType=function(){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));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));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));this.parent=object};CAbsSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CAbsSizeAnchor.prototype.Refresh_RecalcData=
|
||||
function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CAbsSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};function CalculateSrcRect(parentCropTransform,bounds,oInvertTransformCrop,cropExtX,cropExtY){var lt_x_abs=parentCropTransform.TransformPointX(bounds.min_x,bounds.min_y);var lt_y_abs=parentCropTransform.TransformPointY(bounds.min_x,bounds.min_y);
|
||||
var rb_x_abs=parentCropTransform.TransformPointX(bounds.max_x,bounds.max_y);var rb_y_abs=parentCropTransform.TransformPointY(bounds.max_x,bounds.max_y);var lt_x_rel=oInvertTransformCrop.TransformPointX(lt_x_abs,lt_y_abs);var lt_y_rel=oInvertTransformCrop.TransformPointY(lt_x_abs,lt_y_abs);var rb_x_rel=oInvertTransformCrop.TransformPointX(rb_x_abs,rb_y_abs);var rb_y_rel=oInvertTransformCrop.TransformPointY(rb_x_abs,rb_y_abs);var srcRect=new AscFormat.CSrcRect;var _l=100*lt_x_rel/cropExtX;var _t=100*
|
||||
lt_y_rel/cropExtY;var _r=100*rb_x_rel/cropExtX;var _b=100*rb_y_rel/cropExtY;srcRect.l=Math.min(_l,_r);srcRect.t=Math.min(_t,_b);srcRect.r=Math.max(_l,_r);srcRect.b=Math.max(_t,_b);return srcRect}AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromX]=function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtX]=function(oClass,value){oClass.toX=
|
||||
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;
|
||||
AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorObject]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CGraphicObjectBase=
|
||||
CGraphicObjectBase;window["AscFormat"].CGraphicBounds=CGraphicBounds;window["AscFormat"].checkNormalRotate=checkNormalRotate;window["AscFormat"].normalizeRotate=normalizeRotate;window["AscFormat"].CRelSizeAnchor=CRelSizeAnchor;window["AscFormat"].CAbsSizeAnchor=CAbsSizeAnchor;window["AscFormat"].CalculateSrcRect=CalculateSrcRect;window["AscFormat"].CCopyObjectProperties=CCopyObjectProperties;window["AscFormat"].LOCKS_MASKS=LOCKS_MASKS})(window);"use strict";(function(window,undefined){var g_memory=
|
||||
AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var checkNormalRotate=AscFormat.checkNormalRotate;var HitInLine=AscFormat.HitInLine;
|
||||
var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscFill=Asc.c_oAscFill;var dTextFitDelta=3;function CheckObjectLine(obj){return obj instanceof CShape&&obj.spPr&&obj.spPr.geometry&&AscFormat.CheckLinePreset(obj.spPr.geometry.preset)}function CheckWordArtTextPr(oRun){if(oRun instanceof AscCommonWord.ParaRun){var oTextPr=oRun.Get_CompiledPr();if(oTextPr.TextFill||oTextPr.TextOutline&&oTextPr.TextOutline.Fill&&oTextPr.TextOutline.Fill.fill&&oTextPr.TextOutline.Fill.fill.type!==Asc.c_oAscFill.FILL_TYPE_NOFILL||
|
||||
oTextPr.Unifill&&oTextPr.Unifill.fill&&(oTextPr.Unifill.fill.type!==c_oAscFill.FILL_TYPE_SOLID||oTextPr.Unifill.transparent!=null&&oTextPr.Unifill.transparent<254.5))return true}return false}function hitInRect(x,y,l,t,r,b){return x>=l&&x<=r&&y>=t&&y<=b}function hitToCropHandles(x,y,object){var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var fCoeff=object.convertPixToMM(1);
|
||||
var fCoeff2=1/fCoeff;var widthCorner=object.extX*fCoeff2+1>>1;var isCentralMarkerX=widthCorner>40?true:false;if(widthCorner>17)widthCorner=17;var heightCorner=object.extY*fCoeff2+1>>1;var isCentralMarkerY=heightCorner>40?true:false;if(heightCorner>17)heightCorner=17;widthCorner*=fCoeff;heightCorner*=fCoeff;var markerWidth=5*fCoeff;if(hitInRect(t_x,t_y,0,0,widthCorner,markerWidth))return 0;if(hitInRect(t_x,t_y,0,0,markerWidth,heightCorner))return 0;if(isCentralMarkerX){if(hitInRect(t_x,t_y,object.extX/
|
||||
2-widthCorner/2,0,object.extX/2+widthCorner/2,markerWidth))return 1;if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,object.extY-markerWidth,object.extX/2+widthCorner/2,object.extY))return 5}if(hitInRect(t_x,t_y,object.extX-widthCorner,0,object.extX,markerWidth))return 2;if(hitInRect(t_x,t_y,object.extX-markerWidth,0,object.extX,heightCorner))return 2;if(isCentralMarkerY){if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY/2-heightCorner/2,object.extX,object.extY/2+heightCorner/2))return 3;if(hitInRect(t_x,
|
||||
t_y,0,object.extY/2-heightCorner/2,markerWidth,object.extY/2+heightCorner/2))return 7}if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY-heightCorner,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,object.extX-widthCorner,object.extY-markerWidth,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,0,object.extY-heightCorner,markerWidth,object.extY))return 6;if(hitInRect(t_x,t_y,0,object.extY-markerWidth,widthCorner,object.extY))return 6;return-1}function hitToHandles(x,y,object){if(object.cropObject)return hitToCropHandles(x,
|
||||
y,object);var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var radius=object.convertPixToMM(AscCommon.TRACK_CIRCLE_RADIUS);if(typeof global_mouseEvent!=="undefined"&&isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))radius*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)radius=global_mouseEvent.AscHitToHandlesEpsilon;
|
||||
radius*=radius;var _min_dist=2*radius;var _ret_value=-1;var check_line=CheckObjectLine(object);var sqr_x=t_x*t_x,sqr_y=t_y*t_y;var _tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=0}var hc=object.extX*.5;var dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=1}dist_x=t_x-object.extX;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=2}var vc=
|
||||
object.extY*.5;var dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=3}dist_y=t_y-object.extY;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=4}dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=5}dist_x=t_x;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;
|
||||
_ret_value=6}dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=7}if(object.canRotate&&object.canRotate()&&!check_line){var rotate_distance=object.convertPixToMM(AscCommon.TRACK_DISTANCE_ROTATE);dist_y=t_y+rotate_distance;sqr_y=dist_y*dist_y;dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=8}}dist_x=t_x-hc;dist_y=t_y-vc;_tmp_dist=dist_x*dist_x+dist_y*dist_y;if(_tmp_dist<
|
||||
_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=-1}if(_min_dist<radius)return _ret_value;return-1}function CreateUniFillByUniColorCopy(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CreateUniFillByUniColor(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CopyRunToPPTX(Run,Paragraph,bHyper){var NewRun=
|
||||
new ParaRun(Paragraph,false);var RunPr=Run.Pr.Copy();if(RunPr.RStyle!=undefined)RunPr.RStyle=undefined;RunPr.FontScale=undefined;if(bHyper){if(!RunPr.Unifill)RunPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);RunPr.Underline=true}if(RunPr.TextFill){RunPr.Unifill=RunPr.TextFill;RunPr.TextFill=undefined}NewRun.Set_Pr(RunPr);var PosToAdd=0;for(var CurPos=0;CurPos<Run.Content.length;CurPos++){var Item=Run.Content[CurPos];if(Item.Type!==para_End&&Item.Type!==para_Drawing&&Item.Type!==para_Comment&&
|
||||
Item.Type!==para_PageCount&&Item.Type!==para_FootnoteRef&&Item.Type!==para_FootnoteReference&&Item.Type!==para_PageNum&&Item.Type!==para_FieldChar&&Item.Type!==para_Bookmark&&Item.Type!==para_RevisionMove&&Item.Type!==para_InstrText&&Item.Type!==para_EndnoteReference&&Item.Type!==para_EndnoteRef){NewRun.Add_ToContent(PosToAdd,Item.Copy(),false);++PosToAdd}}return NewRun}function ConvertParagraphContentToPPTX(aOrigContent,oNewParagraph,bIsAddMath,bRemoveHyperlink){var Count=aOrigContent.length;for(var Index=
|
||||
0;Index<Count;Index++){var Item=aOrigContent[Index];if(Item.Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_Hyperlink)if(bRemoveHyperlink===true)for(var j=0;j<Item.Content.length;++j){if(Item.Content[j].Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item.Content[j],oNewParagraph),false)}else oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,
|
||||
ConvertHyperlinkToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_InlineLevelSdt)ConvertParagraphContentToPPTX(Item.Content,oNewParagraph,bIsAddMath,bRemoveHyperlink);else if(true===bIsAddMath&&Item.Type===para_Math)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,Item.Copy(),false)}}function ConvertParagraphToPPTX(paragraph,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var _drawing_document=isRealObject(drawingDocument)?drawingDocument:paragraph.DrawingDocument;var _new_parent=
|
||||
isRealObject(newParent)?newParent:null;var new_paragraph=new Paragraph(_drawing_document,_new_parent,true);if(!(paragraph instanceof Paragraph))return new_paragraph;var oCopyPr=paragraph.Pr.Copy();oCopyPr.ContextualSpacing=undefined;oCopyPr.KeepLines=undefined;oCopyPr.KeepNext=undefined;oCopyPr.PageBreakBefore=undefined;oCopyPr.Shd=undefined;oCopyPr.Brd.First=undefined;oCopyPr.Brd.Last=undefined;oCopyPr.Brd.Between=undefined;oCopyPr.Brd.Bottom=undefined;oCopyPr.Brd.Left=undefined;oCopyPr.Brd.Right=
|
||||
undefined;oCopyPr.Brd.Top=undefined;oCopyPr.WidowControl=undefined;oCopyPr.Tabs=undefined;oCopyPr.NumPr=undefined;oCopyPr.PStyle=undefined;oCopyPr.FramePr=undefined;new_paragraph.Set_Pr(oCopyPr);var oNewEndPr=paragraph.TextPr.Value.Copy();if(oNewEndPr.TextFill){oNewEndPr.Unifill=oNewEndPr.TextFill;oNewEndPr.TextFill=undefined}new_paragraph.TextPr.Set_Value(oNewEndPr);new_paragraph.Internal_Content_Remove2(0,new_paragraph.Content.length);ConvertParagraphContentToPPTX(paragraph.Content,new_paragraph,
|
||||
bIsAddMath,bRemoveHyperlink);var EndRun=new ParaRun(new_paragraph);EndRun.Add_ToContent(0,new ParaEnd);new_paragraph.Internal_Content_Add(new_paragraph.Content.length,EndRun,false);return new_paragraph}function ConvertElementsToPPTX(aResult,aElements,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var i,j,oElement;for(i=0;i<aElements.length;++i){oElement=aElements[i];if(oElement instanceof AscCommonWord.Paragraph)aResult.push(ConvertParagraphToPPTX(oElement));else if(oElement instanceof AscCommonWord.CTable){var paragraphs=
|
||||
[];oElement.GetAllParagraphs({All:true},paragraphs);for(j=0;j<paragraphs.length;j++)aResult.push(AscFormat.ConvertParagraphToPPTX(paragraphs[j],drawingDocument,newParent,bIsAddMath,bRemoveHyperlink))}else if(oElement instanceof AscCommonWord.CBlockLevelSdt)ConvertElementsToPPTX(aResult,oElement.Content.Content,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink)}}function ConvertHyperlinkToPPTX(hyperlink,paragraph){var hyperlink_ret=new ParaHyperlink,i,item,pos=0;hyperlink_ret.SetValue(hyperlink.Value);
|
||||
hyperlink_ret.SetToolTip(hyperlink.ToolTip);for(i=0;i<hyperlink.Content.length;++i){item=hyperlink.Content[i];if(item.Type===para_Run)hyperlink_ret.Add_ToContent(pos++,CopyRunToPPTX(item,paragraph,true));else if(item.Type===para_Hyperlink)hyperlink_ret.Add_ToContent(pos++,ConvertHyperlinkToPPTX(item,paragraph))}return hyperlink_ret}function ConvertParagraphToWord(paragraph,docContent){var _docContent=isRealObject(docContent)?docContent:paragraph.Parent;var oldFlag=paragraph.bFromDocument;paragraph.bFromDocument=
|
||||
true;var new_paragraph=paragraph.Copy(_docContent);CheckWordParagraphContent(new_paragraph.Content,new_paragraph.Pr.DefaultRunPr);var NewRPr=CheckWordRunPr(new_paragraph.TextPr.Value);var oCopyDefaultPr;if(NewRPr){if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(NewRPr);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr}new_paragraph.TextPr.Apply_TextPr(NewRPr)}else if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();
|
||||
oCopyDefaultPr.Merge(new_paragraph.TextPr.Value);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr;new_paragraph.TextPr.Apply_TextPr(NewRPr)}paragraph.bFromDocument=oldFlag;return new_paragraph}function CheckWordRunPr(Pr,bMath){var NewRPr=null;if(Pr.Unifill&&Pr.Unifill.fill)switch(Pr.Unifill.fill.type){case c_oAscFill.FILL_TYPE_SOLID:{if(Pr.Unifill.fill.color&&Pr.Unifill.fill.color.color)switch(Pr.Unifill.fill.color.color.type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{if(Pr.Unifill.fill.color.Mods&&
|
||||
Pr.Unifill.fill.color.Mods.Mods.length!==0)if(!Pr.Unifill.fill.color.canConvertPPTXModsToWord()){NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}else{NewRPr=Pr.Copy();NewRPr.Unifill.convertToWordMods()}break}case Asc.c_oAscColor.COLOR_TYPE_SRGB:{NewRPr=Pr.Copy();var RGBA=Pr.Unifill.fill.color.color.RGBA;NewRPr.Color=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}}break}case c_oAscFill.FILL_TYPE_PATT:case c_oAscFill.FILL_TYPE_BLIP:{NewRPr=
|
||||
Pr.Copy();NewRPr.TextFill=AscFormat.CreateUnfilFromRGB(0,0,0);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined;break}}if(bMath){NewRPr=Pr.Copy();NewRPr.RFonts.Set_All("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,oTextPr){var NewRPr,MergePr;for(var i=0;i<aContent.length;++i){var oItem=aContent[i];switch(oItem.Type){case para_Run:{NewRPr=CheckWordRunPr(oItem.Pr);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=
|
||||
oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}case para_Hyperlink:{CheckWordParagraphContent(oItem.Content);break}case para_Math:{if(oItem.Root&&oItem.Root.Content)CheckWordParagraphContent(oItem.Root.Content);break}case para_Math_Run:{NewRPr=CheckWordRunPr(oItem.Pr,true);if(NewRPr){MergePr=
|
||||
NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}}}}function ConvertGraphicFrameToWordTable(oGraphicFrame,oDocument){oGraphicFrame.setWordFlag(false,oDocument);return oGraphicFrame.graphicObject.Copy(oDocument)}function ConvertTableToGraphicFrame(oTable,oPresentation){var oGraphicFrame=
|
||||
new AscFormat.CGraphicFrame;var oTable2=new CTable(oPresentation.DrawingDocument,oGraphicFrame,true,0,[].concat(oTable.TableGrid),oTable.TableGrid.length,true);oTable2.Reset(0,0,50,1E5,0,0,1);oTable2.SetTableLayout(tbllayout_Fixed);oTable2.Set_Pr(oTable.Pr.Copy());oTable2.Set_TableLook(oTable.TableLook.Copy());for(var i=0;i<oTable.Content.length;++i){var oRow=oTable.Content[i];var oNewRow=new CTableRow(oTable2,oRow.Content.length,oTable2.TableGrid);for(var j=0;j<oRow.Content.length;++j){var oContent=
|
||||
oRow.Content[j].Content;var oNewContent=oNewRow.Content[j].Content;for(var t=0;t<oContent.Content.length;++t)if(oContent.Content[t].Get_Type()===type_Paragraph)oNewContent.Internal_Content_Add(oNewContent.Content.length,AscFormat.ConvertParagraphToPPTX(oContent.Content[t],oPresentation.DrawingDocument,oNewContent))}var nIndex=oTable2.Content.length;oTable2.Content[nIndex]=oNewRow;History.Add(new CChangesTableAddRow(oTable2,nIndex,[oNewRow]));oTable2.private_UpdateTableGrid()}if(!oGraphicFrame.spPr){oGraphicFrame.setSpPr(new AscFormat.CSpPr);
|
||||
oGraphicFrame.spPr.setParent(oGraphicFrame)}oGraphicFrame.spPr.setXfrm(new AscFormat.CXfrm);oGraphicFrame.spPr.xfrm.setExtX(50);oGraphicFrame.spPr.xfrm.setExtY(50);oGraphicFrame.spPr.xfrm.setParent(oGraphicFrame.spPr);var _nvGraphicFramePr=new AscFormat.UniNvPr;oGraphicFrame.setNvSpPr(_nvGraphicFramePr);if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))oGraphicFrame.setLocks(_nvGraphicFramePr.locks);oGraphicFrame.setGraphicObject(oTable2);oGraphicFrame.setBDeleted(false);
|
||||
return oGraphicFrame}function fHandleContent(aContent,oMax){for(var i=0;i<aContent.length;++i){var oContentElement=aContent[i];if(oContentElement.Get_Type()===type_Paragraph){var paragraph_lines=aContent[i].Lines;for(var j=0;j<paragraph_lines.length;++j)if(paragraph_lines[j].Ranges[0].W>oMax.max_width)oMax.max_width=paragraph_lines[j].Ranges[0].X+paragraph_lines[j].Ranges[0].W}else if(oContentElement.Get_Type()===type_Table){if(oContentElement.Bounds.Right>oMax.max_width)oMax.max_width=oContentElement.Bounds.Right}else if(oContentElement.Get_Type()===
|
||||
type_BlockLevelSdt)if(oContentElement&&oContentElement.Content)fHandleContent(oContentElement.Content.Content,oMax)}}function RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,bNeedRecalcAllDrawings){var oMaxWidth={max_width:0},i;oDocContent.Reset(0,0,dMaxWidth,2E4);if(bNeedRecalcAllDrawings){var aAllDrawings=oDocContent.GetAllDrawingObjects();for(i=0;i<aAllDrawings.length;++i)aAllDrawings[i].GraphicObj.recalculate()}oDocContent.Recalculate_Page(0,true);fHandleContent(oDocContent.Content,oMaxWidth);
|
||||
if(oMaxWidth.max_width===0){if(oDocContent.Is_Empty())if(oDocContent.Content[0]&&oDocContent.Content[0].Content[0]&&oDocContent.Content[0].Content[0].Content[0])return oDocContent.Content[0].Content[0].Content[0].WidthVisible/TEXTWIDTH_DIVIDER;return.001}return oMaxWidth.max_width}function CheckExcelDrawingXfrm(xfrm){var rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;if(checkNormalRotate(rot)){if(xfrm.offX<0)xfrm.setOffX(0);if(xfrm.offY<0)xfrm.setOffY(0)}else{var dPosX=xfrm.offX+xfrm.extX/2-xfrm.extY/
|
||||
2;var dPosY=xfrm.offY+xfrm.extY/2-xfrm.extX/2;if(dPosX<0)xfrm.setOffX(xfrm.offX-dPosX);if(dPosY<0)xfrm.setOffY(xfrm.offY-dPosY)}}function SetXfrmFromMetrics(oDrawing,metrics){AscFormat.CheckSpPrXfrm(oDrawing);var rot=AscFormat.isRealNumber(oDrawing.spPr.xfrm.rot)?AscFormat.normalizeRotate(oDrawing.spPr.xfrm.rot):0;var metricExtX,metricExtY;if(!(oDrawing instanceof AscFormat.CGroupShape)){metricExtX=metrics.extX;metricExtY=metrics.extY;if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setExtX(metrics.extX);
|
||||
oDrawing.spPr.xfrm.setExtY(metrics.extY)}else{oDrawing.spPr.xfrm.setExtX(metrics.extY);oDrawing.spPr.xfrm.setExtY(metrics.extX)}}else if(AscFormat.isRealNumber(oDrawing.spPr.xfrm.extX)&&AscFormat.isRealNumber(oDrawing.spPr.xfrm.extY)){metricExtX=oDrawing.spPr.xfrm.extX;metricExtY=oDrawing.spPr.xfrm.extY}else{metricExtX=metrics.extX;metricExtY=metrics.extY}if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setOffX(metrics.x);oDrawing.spPr.xfrm.setOffY(metrics.y)}else{oDrawing.spPr.xfrm.setOffX(metrics.x+
|
||||
metricExtX/2-metricExtY/2);oDrawing.spPr.xfrm.setOffY(metrics.y+metricExtY/2-metricExtX/2)}}AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent]=
|
||||
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetGroup]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetWordShape]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSignature]=
|
||||
AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr]=function(oClass,value){oClass.nvSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetStyle]=function(oClass,value){oClass.style=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxBody]=function(oClass,value){oClass.txBody=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTextBoxContent]=
|
||||
function(oClass,value){oClass.textBoxContent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetBodyPr]=function(oClass,value){oClass.bodyPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=function(oClass,value){oClass.fromSerialize=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetParent]=function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetWordShape]=
|
||||
function(oClass,value){oClass.bWordShape=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSignature]=function(oClass,value){var oldSignature=oClass.signatureLine;var newSignature=value;oClass.signatureLine=value;if(!AscCommon.isFileBuild()){var oApi=window["Asc"]&&window["Asc"]["editor"]||editor;if(oApi){if(oldSignature&&oldSignature.id)oApi.sendEvent("asc_onRemoveSignature",oldSignature.id);if(newSignature&&newSignature.id)oApi.sendEvent("asc_onAddSignature",newSignature.id)}}};function CSignatureLine(){this.id=
|
||||
null;this.signer=null;this.signer2=null;this.email=null;this.showDate=null;this.instructions=null}CSignatureLine.prototype.Write_ToBinary=function(writer){AscFormat.writeString(writer,this.id);AscFormat.writeString(writer,this.signer);AscFormat.writeString(writer,this.signer2);AscFormat.writeString(writer,this.email);AscFormat.writeBool(writer,this.showDate);AscFormat.writeString(writer,this.instructions)};CSignatureLine.prototype.Read_FromBinary=function(reader){this.id=AscFormat.readString(reader);
|
||||
this.signer=AscFormat.readString(reader);this.signer2=AscFormat.readString(reader);this.email=AscFormat.readString(reader);this.showDate=AscFormat.readBool(reader);this.instructions=AscFormat.readString(reader)};CSignatureLine.prototype.copy=function(){var ret=new CSignatureLine;ret.id=AscCommon.CreateGUID();ret.signer=this.signer;ret.signer2=this.signer2;ret.email=this.email;ret.showDate=this.showDate;ret.instructions=this.instructions;return ret};CSignatureLine.prototype.copyWithId=function(){var sId=
|
||||
this.id;var oCopy=this.copy();oCopy.id=sId;return oCopy};CSignatureLine.prototype.setProperties=function(oPr){this.signer=oPr.asc_getSigner1();this.signer2=oPr.asc_getSigner2();this.email=oPr.asc_getEmail();this.showDate=oPr.asc_getShowDate();this.instructions=oPr.asc_getInstructions()};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetSignature]=CSignatureLine;function CShape(){AscFormat.CGraphicObjectBase.call(this);
|
||||
this.nvSpPr=null;this.style=null;this.txBody=null;this.bodyPr=null;this.textBoxContent=null;this.drawingBase=null;this.bWordShape=null;this.bCheckAutoFitFlag=false;this.signatureLine=null;this.transformText=new CMatrix;this.invertTransformText=null;this.localTransformText=new CMatrix;this.worksheet=null;this.cachedImage=null;this.txWarpStruct=null;this.txWarpStructParamarks=null;this.txWarpStructNoTransform=null;this.txWarpStructParamarksNoTransform=null;this.tmpFontScale=undefined;this.tmpLnSpcReduction=
|
||||
undefined}CShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CShape.prototype.constructor=CShape;CShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Shape};CShape.prototype.GetAllDrawingObjects=function(DrawingObjects){var oContent=this.getDocContent();if(oContent)oContent.GetAllDrawingObjects(DrawingObjects)};CShape.prototype.setSignature=function(oSignature){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetSignature,this.signatureLine,
|
||||
oSignature));this.signatureLine=oSignature};CShape.prototype.setSignaturePr=function(oPr,sUrl){if(!oPr||!this.signatureLine)return;var oCopy=this.signatureLine.copyWithId();oCopy.setProperties(oPr);this.setSignature(oCopy);if(sUrl)if(this.spPr){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sUrl);this.spPr.setFill(oBlipFillUnifill)}};CShape.prototype.convertToWord=function(document){this.setBDeleted(true);var c=new CShape;c.setWordShape(true);c.setBDeleted(false);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());
|
||||
if(this.spPr){c.setSpPr(this.spPr.createDuplicate());if(!c.spPr.geometry)c.spPr.setGeometry(AscFormat.CreateGeometry("rect"));c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.txBody){if(this.txBody.bodyPr)c.setBodyPr(this.txBody.bodyPr.createDuplicate());if(this.txBody.content){var new_content=new CDocumentContent(c,document.DrawingDocument,0,0,0,2E4,false,false,false);var paragraphs=this.txBody.content.Content;new_content.Internal_Content_RemoveAll();for(var i=0;i<
|
||||
paragraphs.length;++i){var cur_par=paragraphs[i];var new_paragraph=ConvertParagraphToWord(cur_par,new_content);new_content.Internal_Content_Add(i,new_paragraph,false)}c.setTextBoxContent(new_content)}}if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.convertToPPTX=function(drawingDocument,worksheet,bIsAddMath){var 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){var tx_body=new AscFormat.CTextBody;tx_body.setParent(c);if(this.bodyPr)tx_body.setBodyPr(this.bodyPr.createDuplicate());var new_content=new AscFormat.CDrawingDocContent(tx_body,drawingDocument,0,0,0,0,false,false,true);new_content.Internal_Content_RemoveAll();var paragraphs=this.textBoxContent.Content;var index=0;for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];if(cur_par instanceof Paragraph){var new_paragraph=
|
||||
ConvertParagraphToPPTX(cur_par,drawingDocument,new_content,bIsAddMath);new_content.Internal_Content_Add(index++,new_paragraph,false)}}tx_body.setContent(new_content);c.setTxBody(tx_body)}if(worksheet)if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.handleAllContents=function(fCallback){var content=this.getDocContent();if(content)fCallback(content)};CShape.prototype.documentGetAllFontNames=function(AllFonts){var content=this.getDocContent();if(content)content.Document_Get_AllFontNames(AllFonts)};
|
||||
CShape.prototype.documentCreateFontMap=function(map){var content=this.getDocContent();if(content)content.Document_CreateFontMap(map)};CShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetNvSpPr,this.nvSpPr,pr));this.nvSpPr=pr};CShape.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetSpPr,this.spPr,spPr));this.spPr=spPr};CShape.prototype.setStyle=function(style){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
||||
AscDFH.historyitem_ShapeSetStyle,this.style,style));this.style=style;var content=this.getDocContent();this.recalcInfo.recalculateShapeStyleForParagraph=true;if(this.recalcTextStyles)this.recalcTextStyles();if(content)content.Recalc_AllParagraphs_CompiledPr()};CShape.prototype.setTxBody=function(txBody){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTxBody,this.txBody,txBody));this.txBody=txBody};CShape.prototype.setTextBoxContent=function(textBoxContent){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
||||
AscDFH.historyitem_ShapeSetTextBoxContent,this.textBoxContent,textBoxContent));this.textBoxContent=textBoxContent};CShape.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetBodyPr,this.bodyPr,pr));this.bodyPr=pr;this.recalcInfo.recalculateContent=true;this.recalcInfo.recalculateTransformText=true;this.addToRecalculate()};CShape.prototype.createTextBody=function(){var tx_body=new AscFormat.CTextBody;tx_body.setParent(this);tx_body.setContent(new AscFormat.CDrawingDocContent(tx_body,
|
||||
this.getDrawingDocument(),0,0,0,2E4,false,false,true));var oBodyPr=new AscFormat.CBodyPr;if(this.worksheet){oBodyPr.vertOverflow=AscFormat.nOTClip;oBodyPr.horzOverflow=AscFormat.nOTClip}tx_body.setBodyPr(oBodyPr);tx_body.content.Content[0].Set_DocumentIndex(0);tx_body.content.MoveCursorToStartPos(false);this.setTxBody(tx_body)};CShape.prototype.createTextBoxContent=function(){var body_pr=new AscFormat.CBodyPr;body_pr.setAnchor(1);this.setBodyPr(body_pr);this.setTextBoxContent(new CDocumentContent(this,
|
||||
this.getDrawingDocument(),0,0,0,2E4,false,false));this.textBoxContent.SetParagraphAlign(AscCommon.align_Center);this.textBoxContent.MoveCursorToStartPos(false);this.textBoxContent.Content[0].Set_DocumentIndex(0)};CShape.prototype.paragraphAdd=function(paraItem,bRecalculate){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent()}if(content_to_add)content_to_add.AddToParagraph(paraItem,
|
||||
bRecalculate)};CShape.prototype.applyTextFunction=function(docContentFunction,tableFunction,args){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent();content_to_add.MoveCursorToStartPos()}if(content_to_add)docContentFunction.apply(content_to_add,args);if(!editor||!editor.noCreatePoint||editor.exucuteHistory)this.checkExtentsByDocContent()};
|
||||
CShape.prototype.clearContent=function(){var content=this.getDocContent();if(content){content.Set_ApplyToAll(true);content.Remove(-1);content.AddToParagraph(new AscCommonWord.ParaTextPr({Lang:{Val:undefined}}),false);content.Set_ApplyToAll(false)}};CShape.prototype.getDocContent=function(){if(this.txBody)return this.txBody.content;else if(this.textBoxContent)return this.textBoxContent;return null};CShape.prototype.getBodyPr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.bWordShape){var ret=
|
||||
new AscFormat.CBodyPr;ret.setDefault();if(this.bodyPr)ret.merge(this.bodyPr);return ret}else{if(this.txBody&&this.txBody.bodyPr)return this.txBody.getCompiledBodyPr();var ret=new AscFormat.CBodyPr;ret.setDefault();return ret}},this,[])};CShape.prototype.GetRevisionsChangeElement=function(SearchEngine){var oContent=this.getDocContent();if(oContent)oContent.GetRevisionsChangeElement(SearchEngine)};CShape.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.textBoxContent){var dd=this.getDrawingDocument();
|
||||
dd.StartSearchTransform(this.transformText);this.textBoxContent.Search(Str,Props,SearchEngine,Type);dd.EndSearchTransform()}else if(this.txBody&&this.txBody.content)this.txBody.content.Search(Str,Props,SearchEngine,Type)};CShape.prototype.GetSearchElementId=function(bNext,bCurrent){if(this.textBoxContent)return this.textBoxContent.GetSearchElementId(bNext,bCurrent);else if(this.txBody&&this.txBody.content)return this.txBody.content.GetSearchElementId(bNext,bCurrent);return null};CShape.prototype.documentUpdateRulersState=
|
||||
function(){var content=this.getDocContent();if(!content)return;var xc,yc;var l,t,r,b;var body_pr=this.getBodyPr();var l_ins,t_ins,r_ins,b_ins;if(typeof body_pr.lIns==="number")l_ins=body_pr.lIns;else l_ins=2.54;if(typeof body_pr.tIns==="number")t_ins=body_pr.tIns;else t_ins=1.27;if(typeof body_pr.rIns==="number")r_ins=body_pr.rIns;else r_ins=2.54;if(typeof body_pr.bIns==="number")b_ins=body_pr.bIns;else b_ins=1.27;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){l=
|
||||
this.spPr.geometry.rect.l+l_ins;t=this.spPr.geometry.rect.t+t_ins;r=this.spPr.geometry.rect.r-r_ins;b=this.spPr.geometry.rect.b-b_ins}else{l=l_ins;t=t_ins;r=this.extX-r_ins;b=this.extY-b_ins}var x_lt,y_lt,x_rt,y_rt,x_rb,y_rb,x_lb,y_lb;var tr=this.transform;x_lt=tr.TransformPointX(l,t);y_lt=tr.TransformPointY(l,t);x_rb=tr.TransformPointX(r,b);y_rb=tr.TransformPointY(r,b);xc=(x_lt+x_rb)*.5;yc=(y_lt+y_rb)*.5;var hc=(r-l)*.5;var vc=(b-t)*.5;this.getDrawingDocument().Set_RulerState_Paragraph({L:xc-hc,
|
||||
T:yc-vc,R:xc+hc,B:yc+vc});content.Document_UpdateRulersState(AscFormat.isRealNumber(this.selectStartPage)?this.selectStartPage:0)};CShape.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetParent,this.parent,parent));this.parent=parent};CShape.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetGroup,this.group,group));this.group=group};CShape.prototype.getAllImages=function(images){if(this.spPr&&
|
||||
this.spPr.Fill&&this.spPr.Fill.fill instanceof AscFormat.CBlipFill&&typeof this.spPr.Fill.fill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.spPr.Fill.fill.RasterImageId)]=true};CShape.prototype.getAllFonts=function(fonts){if(this.txBody){this.txBody.content.Document_Get_AllFontNames(fonts);if(this.txBody&&this.txBody.lstStyle)this.txBody.lstStyle.Document_Get_AllFontNames(fonts);delete fonts["+mj-lt"];delete fonts["+mn-lt"];delete fonts["+mj-ea"];delete fonts["+mn-ea"];delete fonts["+mj-cs"];
|
||||
delete fonts["+mn-cs"]}};CShape.prototype.canFill=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.canFill();return true};CShape.prototype.isShape=function(){return true};CShape.prototype.isImage=function(){return false};CShape.prototype.isChart=function(){return false};CShape.prototype.isGroup=function(){return false};CShape.prototype.getHierarchy=function(bIsSingleBody,info){{this.compiledHierarchy=[];if(this.parent){var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=
|
||||
this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body;if(AscFormat.isRealBool(bIsSingleBody))b_is_single_body=bIsSingleBody;else b_is_single_body=this.getIsSingleBody&&this.getIsSingleBody();switch(this.parent.kind){case AscFormat.TYPE_KIND.SLIDE:{hierarchy.push(this.parent.Layout.getMatchingShape(ph_type,ph_index,b_is_single_body,info));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,
|
||||
ph_index,true));break}case AscFormat.TYPE_KIND.NOTES:{if(this.parent.Master)hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}}}this.recalcInfo.recalculateShapeHierarchy=true}}return this.compiledHierarchy};CShape.prototype.getPaddings=function(){var paddings=null;var shape=this;var body_pr;if(shape.txBody)if(shape.txBody.compiledBodyPr)body_pr=shape.txBody.compiledBodyPr;else body_pr=shape.txBody.getCompiledBodyPr();else if(shape.textBoxContent)body_pr=shape.bodyPr;
|
||||
if(body_pr){paddings=new Asc.asc_CPaddings;if(typeof body_pr.lIns==="number")paddings.Left=body_pr.lIns;else paddings.Left=2.54;if(typeof body_pr.tIns==="number")paddings.Top=body_pr.tIns;else paddings.Top=1.27;if(typeof body_pr.rIns==="number")paddings.Right=body_pr.rIns;else paddings.Right=2.54;if(typeof body_pr.bIns==="number")paddings.Bottom=body_pr.bIns;else paddings.Bottom=1.27}return paddings};CShape.prototype.getCompiledFill=function(){if(this.recalcInfo.recalculateFill){this.compiledFill=
|
||||
null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){if(this.spPr.Fill.fill instanceof AscFormat.CGradFill&&this.spPr.Fill.fill.colors.length===0){var parent_objects=this.getParentObjects();var theme=parent_objects.theme;var fmt_scheme=theme.themeElements.fmtScheme;var fill_style_lst=fmt_scheme.fillStyleLst;for(var i=fill_style_lst.length-1;i>-1;--i)if(fill_style_lst[i]&&fill_style_lst[i].fill instanceof AscFormat.CGradFill){this.spPr.Fill=fill_style_lst[i].createDuplicate();
|
||||
break}}this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&&this.compiledFill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else this.compiledFill=null}else this.compiledFill=null}else if(isRealObject(this.group)){var group_compiled_fill=this.group.getCompiledFill();
|
||||
if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&
|
||||
isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}this.recalcInfo.recalculateFill=false}return this.compiledFill};CShape.prototype.getMargins=function(){if(this.txBody)return this.txBody.getMargins();else return null};CShape.prototype.Document_UpdateRulersState=function(margins){if(this.txBody&&this.txBody.content)this.txBody.content.Document_UpdateRulersState(this.parent.num,
|
||||
this.getMargins())};CShape.prototype.getCompiledLine=function(){if(this.recalcInfo.recalculateLine){this.compiledLine=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.ln)&&isRealObject(this.spPr.ln))this.compiledLine=this.spPr.ln.createDuplicate();else if(isRealObject(this.group)){var group_compiled_line=this.group.getCompiledLine();if(isRealObject(group_compiled_line)&&isRealObject(group_compiled_line.fill))this.compiledLine=group_compiled_line.createDuplicate();else{var hierarchy=this.getHierarchy();
|
||||
for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}this.recalcInfo.recalculateLine=false}return this.compiledLine};
|
||||
CShape.prototype.getCompiledTransparent=function(){if(this.recalcInfo.recalculateTransparent){this.compiledTransparent=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill))if(AscFormat.isRealNumber(this.spPr.Fill.transparent))this.compiledTransparent=this.spPr.Fill.transparent;else if(this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group&&this.group.spPr&&this.group.spPr.Fill&&AscFormat.isRealNumber(this.group.spPr.Fill.transparent))this.compiledTransparent=
|
||||
this.group.spPr.Fill.transparent;if(null!==this.compiledTransparent){this.recalcInfo.recalculateTransparent=false;return this.compiledTransparent}if(isRealObject(this.group)){var group_transparent=this.group.getCompiledTransparent();if(AscFormat.isRealNumber(group_transparent))this.compiledTransparent=group_transparent;else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=
|
||||
hierarchy[i].spPr.Fill.transparent;break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=hierarchy[i].spPr.Fill.transparent;break}}this.recalcInfo.recalculateTransparent=false}return this.compiledTransparent};CShape.prototype.isPlaceholder=function(){return isRealObject(this.nvSpPr)&&isRealObject(this.nvSpPr.nvPr)&&
|
||||
isRealObject(this.nvSpPr.nvPr.ph)};CShape.prototype.getPlaceholderType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPlaceholderIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.getPhType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPhIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.setVerticalAlign=function(align){var content_to_add=
|
||||
this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.anchor=align;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setVert=function(vert){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();
|
||||
else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vert=vert;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent&&this.checkExtentsByDocContent()};CShape.prototype.setTextFitType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.textFit=new AscFormat.CTextFit;
|
||||
new_body_pr.textFit.type=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};CShape.prototype.setVertOverflowType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vertOverflow=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,
|
||||
true)}};CShape.prototype.setPaddings=function(paddings){if(paddings){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();if(AscFormat.isRealNumber(paddings.Left))new_body_pr.lIns=paddings.Left;if(AscFormat.isRealNumber(paddings.Top))new_body_pr.tIns=paddings.Top;if(AscFormat.isRealNumber(paddings.Right))new_body_pr.rIns=paddings.Right;if(AscFormat.isRealNumber(paddings.Bottom))new_body_pr.bIns=paddings.Bottom;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}}};
|
||||
CShape.prototype.recalculateTransformText=function(){var oContent=this.getDocContent();if(!oContent)return;var oBodyPr=this.getBodyPr();this.clipRect=this.checkTransformTextMatrix(this.localTransformText,oContent,oBodyPr,false);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText);if(this.txBody&&this.txBody.content2){this.transformText2=new CMatrix;this.clipRect2=this.checkTransformTextMatrix(this.transformText2,
|
||||
this.txBody.content2,oBodyPr,false);this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)}var bNoTextNoShape=oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.preset!=="textNoShape";{this.localTransformTextWordArt=new CMatrix;this.checkTransformTextMatrix(this.localTransformTextWordArt,oContent,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt=this.localTransformTextWordArt.CreateDublicate();this.invertTransformTextWordArt=global_MatrixTransformer.Invert(this.transformTextWordArt)}if(this.txBody&&
|
||||
this.txBody.content2){this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt2=new CMatrix;this.checkTransformTextMatrix(this.transformTextWordArt2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape)}if(this.checkPosTransformText)this.checkPosTransformText();if(this.checkContentDrawings)this.checkContentDrawings()};CShape.prototype.getFullFlip=function(){var _transform=this.localTransform;
|
||||
var _full_rotate=this.getFullRotate();var _full_pos_x_lt=_transform.TransformPointX(0,0);var _full_pos_y_lt=_transform.TransformPointY(0,0);var _full_pos_x_rt=_transform.TransformPointX(this.extX,0);var _full_pos_y_rt=_transform.TransformPointY(this.extX,0);var _full_pos_x_rb=_transform.TransformPointX(this.extX,this.extY);var _full_pos_y_rb=_transform.TransformPointY(this.extX,this.extY);var _rotate_matrix=new CMatrix;global_MatrixTransformer.RotateRadAppend(_rotate_matrix,_full_rotate);var _rotated_pos_x_lt=
|
||||
_rotate_matrix.TransformPointX(_full_pos_x_lt,_full_pos_y_lt);var _rotated_pos_x_rt=_rotate_matrix.TransformPointX(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rt=_rotate_matrix.TransformPointY(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rb=_rotate_matrix.TransformPointY(_full_pos_x_rb,_full_pos_y_rb);return{flipH:_rotated_pos_x_lt>_rotated_pos_x_rt,flipV:_rotated_pos_y_rt>_rotated_pos_y_rb}};CShape.prototype.recalculateTransformText2=function(){if(this.txBody===null)return;if(!this.txBody.content2)return;
|
||||
this.transformText2=new CMatrix;var _text_transform=this.transformText2;var _shape_transform=this.transform;var _body_pr=this.txBody.getBodyPr();var _content_height=this.txBody.getSummaryHeight2();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;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var _rect=this.spPr.geometry.rect;_l=_rect.l+_body_pr.lIns;_t=_rect.t+_body_pr.tIns;_r=_rect.r-_body_pr.rIns;_b=_rect.b-_body_pr.bIns}else{_l=
|
||||
_body_pr.lIns;_t=_body_pr.tIns;_r=this.extX-_body_pr.rIns;_b=this.extY-_body_pr.bIns}if(_l>=_r){var _c=(_l+_r)*.5;_l=_c-.01;_r=_c+.01}if(_t>=_b){_c=(_t+_b)*.5;_t=_c-.01;_b=_c+.01}_t_x_lt=_shape_transform.TransformPointX(_l,_t);_t_y_lt=_shape_transform.TransformPointY(_l,_t);_t_x_rt=_shape_transform.TransformPointX(_r,_t);_t_y_rt=_shape_transform.TransformPointY(_r,_t);_t_x_lb=_shape_transform.TransformPointX(_l,_b);_t_y_lb=_shape_transform.TransformPointY(_l,_b);_t_x_rb=_shape_transform.TransformPointX(_r,
|
||||
_b);_t_y_rb=_shape_transform.TransformPointY(_r,_b);var _dx_t,_dy_t;_dx_t=_t_x_rt-_t_x_lt;_dy_t=_t_y_rt-_t_y_lt;var _dx_lt_rb,_dy_lt_rb;_dx_lt_rb=_t_x_rb-_t_x_lt;_dy_lt_rb=_t_y_rb-_t_y_lt;var _vertical_shift;var _text_rect_height=_b-_t;var _text_rect_width=_r-_l;if(!_body_pr.upright){if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_height;
|
||||
break}case 1:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){var alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,
|
||||
_t_x_lt,_t_y_lt)}else{alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}}else{if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_width-_content_height;break}case 1:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 4:{_vertical_shift=
|
||||
0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI*.5-_alpha);
|
||||
this.getPhType();var aButtons=[];var isLocalDesktop=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsSupportMedia"]&&window["AscDesktopEditor"]["IsSupportMedia"]();switch(phType){case null:{aButtons.push(AscCommon.PlaceholderButtonType.Table);aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_body:{break}case AscFormat.phType_chart:{aButtons.push(AscCommon.PlaceholderButtonType.Chart);
|
||||
break}case AscFormat.phType_clipArt:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_ctrTitle:{break}case AscFormat.phType_dgm:{break}case AscFormat.phType_dt:{break}case AscFormat.phType_ftr:{break}case AscFormat.phType_hdr:{break}case AscFormat.phType_media:{if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_obj:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
||||
aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_pic:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_sldImg:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_sldNum:{break}case AscFormat.phType_subTitle:{break}case AscFormat.phType_tbl:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
||||
break}case AscFormat.phType_title:{break}}var nSlideNum=0;if(this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Slide)nSlideNum=this.parent.num;return AscCommon.CreateDrawingPlaceholder(this.Id,aButtons,nSlideNum,{x:0,y:0,w:this.extX,h:this.extY},this.transform)};CGraphicObjectBase.prototype.onSlicerUpdate=function(sName){return false};CGraphicObjectBase.prototype.onSlicerLock=function(sName,bLock){};CGraphicObjectBase.prototype.onSlicerDelete=function(sName){return false};
|
||||
CGraphicObjectBase.prototype.onSlicerChangeName=function(sName,sNewName){return false};CGraphicObjectBase.prototype.onUpdate=function(oRect){if(this.drawingBase)this.drawingBase.onUpdate(oRect);else if(this.group)this.group.onUpdate(oRect)};CGraphicObjectBase.prototype.getSlicerViewByName=function(name){return null};CGraphicObjectBase.prototype.setParent2=function(parent){this.setParent(parent);if(Array.isArray(this.spTree))for(var i=0;i<this.spTree.length;++i)this.spTree[i].setParent2(parent)};CGraphicObjectBase.prototype.documentCreateFontMap=
|
||||
function(oMap){};CGraphicObjectBase.prototype.createFontMap=function(oMap){this.documentCreateFontMap(oMap)};function CRelSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CRelSizeAnchor.prototype=Object.create(CBaseObject.prototype);CRelSizeAnchor.prototype.constructor=CRelSizeAnchor;CRelSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CRelSizeAnchor.prototype.getObjectType=
|
||||
function(){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));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));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));this.parent=object};CRelSizeAnchor.prototype.copy=
|
||||
function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CRelSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CRelSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromX]=
|
||||
function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToX]=function(oClass,value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorParent]=
|
||||
function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorObject]=
|
||||
window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;function CAbsSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CAbsSizeAnchor.prototype=Object.create(CBaseObject.prototype);CAbsSizeAnchor.prototype.constructor=CAbsSizeAnchor;CAbsSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};
|
||||
CAbsSizeAnchor.prototype.getObjectType=function(){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));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));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));this.parent=
|
||||
object};CAbsSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CAbsSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CAbsSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};
|
||||
function CalculateSrcRect(parentCropTransform,bounds,oInvertTransformCrop,cropExtX,cropExtY){var lt_x_abs=parentCropTransform.TransformPointX(bounds.min_x,bounds.min_y);var lt_y_abs=parentCropTransform.TransformPointY(bounds.min_x,bounds.min_y);var rb_x_abs=parentCropTransform.TransformPointX(bounds.max_x,bounds.max_y);var rb_y_abs=parentCropTransform.TransformPointY(bounds.max_x,bounds.max_y);var lt_x_rel=oInvertTransformCrop.TransformPointX(lt_x_abs,lt_y_abs);var lt_y_rel=oInvertTransformCrop.TransformPointY(lt_x_abs,
|
||||
lt_y_abs);var rb_x_rel=oInvertTransformCrop.TransformPointX(rb_x_abs,rb_y_abs);var rb_y_rel=oInvertTransformCrop.TransformPointY(rb_x_abs,rb_y_abs);var srcRect=new AscFormat.CSrcRect;var _l=100*lt_x_rel/cropExtX;var _t=100*lt_y_rel/cropExtY;var _r=100*rb_x_rel/cropExtX;var _b=100*rb_y_rel/cropExtY;srcRect.l=Math.min(_l,_r);srcRect.t=Math.min(_t,_b);srcRect.r=Math.max(_l,_r);srcRect.b=Math.max(_t,_b);return srcRect}AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromX]=function(oClass,value){oClass.fromX=
|
||||
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtX]=function(oClass,value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorParent]=
|
||||
function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorObject]=
|
||||
window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CGraphicObjectBase=CGraphicObjectBase;window["AscFormat"].CGraphicBounds=CGraphicBounds;window["AscFormat"].checkNormalRotate=checkNormalRotate;window["AscFormat"].normalizeRotate=normalizeRotate;window["AscFormat"].CRelSizeAnchor=CRelSizeAnchor;window["AscFormat"].CAbsSizeAnchor=
|
||||
CAbsSizeAnchor;window["AscFormat"].CalculateSrcRect=CalculateSrcRect;window["AscFormat"].CCopyObjectProperties=CCopyObjectProperties;window["AscFormat"].LOCKS_MASKS=LOCKS_MASKS})(window);"use strict";(function(window,undefined){var g_memory=AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;
|
||||
var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var checkNormalRotate=AscFormat.checkNormalRotate;var HitInLine=AscFormat.HitInLine;var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscFill=Asc.c_oAscFill;var dTextFitDelta=3;function CheckObjectLine(obj){return obj instanceof CShape&&obj.spPr&&obj.spPr.geometry&&AscFormat.CheckLinePreset(obj.spPr.geometry.preset)}function CheckWordArtTextPr(oRun){if(oRun instanceof
|
||||
AscCommonWord.ParaRun){var oTextPr=oRun.Get_CompiledPr();if(oTextPr.TextFill||oTextPr.TextOutline&&oTextPr.TextOutline.Fill&&oTextPr.TextOutline.Fill.fill&&oTextPr.TextOutline.Fill.fill.type!==Asc.c_oAscFill.FILL_TYPE_NOFILL||oTextPr.Unifill&&oTextPr.Unifill.fill&&(oTextPr.Unifill.fill.type!==c_oAscFill.FILL_TYPE_SOLID||oTextPr.Unifill.transparent!=null&&oTextPr.Unifill.transparent<254.5))return true}return false}function hitInRect(x,y,l,t,r,b){return x>=l&&x<=r&&y>=t&&y<=b}function hitToCropHandles(x,
|
||||
y,object){var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var fCoeff=object.convertPixToMM(1);var fCoeff2=1/fCoeff;var widthCorner=object.extX*fCoeff2+1>>1;var isCentralMarkerX=widthCorner>40?true:false;if(widthCorner>17)widthCorner=17;var heightCorner=object.extY*fCoeff2+1>>1;var isCentralMarkerY=heightCorner>40?true:false;if(heightCorner>17)heightCorner=17;widthCorner*=
|
||||
fCoeff;heightCorner*=fCoeff;var markerWidth=5*fCoeff;if(hitInRect(t_x,t_y,0,0,widthCorner,markerWidth))return 0;if(hitInRect(t_x,t_y,0,0,markerWidth,heightCorner))return 0;if(isCentralMarkerX){if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,0,object.extX/2+widthCorner/2,markerWidth))return 1;if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,object.extY-markerWidth,object.extX/2+widthCorner/2,object.extY))return 5}if(hitInRect(t_x,t_y,object.extX-widthCorner,0,object.extX,markerWidth))return 2;if(hitInRect(t_x,
|
||||
t_y,object.extX-markerWidth,0,object.extX,heightCorner))return 2;if(isCentralMarkerY){if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY/2-heightCorner/2,object.extX,object.extY/2+heightCorner/2))return 3;if(hitInRect(t_x,t_y,0,object.extY/2-heightCorner/2,markerWidth,object.extY/2+heightCorner/2))return 7}if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY-heightCorner,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,object.extX-widthCorner,object.extY-markerWidth,object.extX,object.extY))return 4;
|
||||
if(hitInRect(t_x,t_y,0,object.extY-heightCorner,markerWidth,object.extY))return 6;if(hitInRect(t_x,t_y,0,object.extY-markerWidth,widthCorner,object.extY))return 6;return-1}function hitToHandles(x,y,object){if(object.cropObject)return hitToCropHandles(x,y,object);var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var radius=object.convertPixToMM(AscCommon.TRACK_CIRCLE_RADIUS);
|
||||
if(typeof global_mouseEvent!=="undefined"&&isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))radius*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)radius=global_mouseEvent.AscHitToHandlesEpsilon;radius*=radius;var _min_dist=2*radius;var _ret_value=-1;var check_line=CheckObjectLine(object);var sqr_x=t_x*t_x,sqr_y=t_y*t_y;var _tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=0}var hc=object.extX*
|
||||
.5;var dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=1}dist_x=t_x-object.extX;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=2}var vc=object.extY*.5;var dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=3}dist_y=t_y-object.extY;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=
|
||||
_tmp_dist;_ret_value=4}dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=5}dist_x=t_x;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=6}dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=7}if(object.canRotate&&object.canRotate()&&!check_line){var rotate_distance=object.convertPixToMM(AscCommon.TRACK_DISTANCE_ROTATE);
|
||||
dist_y=t_y+rotate_distance;sqr_y=dist_y*dist_y;dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=8}}dist_x=t_x-hc;dist_y=t_y-vc;_tmp_dist=dist_x*dist_x+dist_y*dist_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=-1}if(_min_dist<radius)return _ret_value;return-1}function CreateUniFillByUniColorCopy(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());
|
||||
return ret}function CreateUniFillByUniColor(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CopyRunToPPTX(Run,Paragraph,bHyper){var NewRun=new ParaRun(Paragraph,false);var RunPr=Run.Pr.Copy();if(RunPr.RStyle!=undefined)RunPr.RStyle=undefined;RunPr.FontScale=undefined;if(bHyper){if(!RunPr.Unifill)RunPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);RunPr.Underline=true}if(RunPr.TextFill){RunPr.Unifill=
|
||||
RunPr.TextFill;RunPr.TextFill=undefined}NewRun.Set_Pr(RunPr);var PosToAdd=0;for(var CurPos=0;CurPos<Run.Content.length;CurPos++){var Item=Run.Content[CurPos];if(Item.Type!==para_End&&Item.Type!==para_Drawing&&Item.Type!==para_Comment&&Item.Type!==para_PageCount&&Item.Type!==para_FootnoteRef&&Item.Type!==para_FootnoteReference&&Item.Type!==para_PageNum&&Item.Type!==para_FieldChar&&Item.Type!==para_Bookmark&&Item.Type!==para_RevisionMove&&Item.Type!==para_InstrText&&Item.Type!==para_EndnoteReference&&
|
||||
Item.Type!==para_EndnoteRef){NewRun.Add_ToContent(PosToAdd,Item.Copy(),false);++PosToAdd}}return NewRun}function ConvertParagraphContentToPPTX(aOrigContent,oNewParagraph,bIsAddMath,bRemoveHyperlink){var Count=aOrigContent.length;for(var Index=0;Index<Count;Index++){var Item=aOrigContent[Index];if(Item.Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_Hyperlink)if(bRemoveHyperlink===true)for(var j=0;j<Item.Content.length;++j){if(Item.Content[j].Type===
|
||||
para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item.Content[j],oNewParagraph),false)}else oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,ConvertHyperlinkToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_InlineLevelSdt)ConvertParagraphContentToPPTX(Item.Content,oNewParagraph,bIsAddMath,bRemoveHyperlink);else if(true===bIsAddMath&&Item.Type===para_Math)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,Item.Copy(),false)}}
|
||||
function ConvertParagraphToPPTX(paragraph,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var _drawing_document=isRealObject(drawingDocument)?drawingDocument:paragraph.DrawingDocument;var _new_parent=isRealObject(newParent)?newParent:null;var new_paragraph=new Paragraph(_drawing_document,_new_parent,true);if(!(paragraph instanceof Paragraph))return new_paragraph;var oCopyPr=paragraph.Pr.Copy();oCopyPr.ContextualSpacing=undefined;oCopyPr.KeepLines=undefined;oCopyPr.KeepNext=undefined;oCopyPr.PageBreakBefore=
|
||||
undefined;oCopyPr.Shd=undefined;oCopyPr.Brd.First=undefined;oCopyPr.Brd.Last=undefined;oCopyPr.Brd.Between=undefined;oCopyPr.Brd.Bottom=undefined;oCopyPr.Brd.Left=undefined;oCopyPr.Brd.Right=undefined;oCopyPr.Brd.Top=undefined;oCopyPr.WidowControl=undefined;oCopyPr.Tabs=undefined;oCopyPr.NumPr=undefined;oCopyPr.PStyle=undefined;oCopyPr.FramePr=undefined;new_paragraph.Set_Pr(oCopyPr);var oNewEndPr=paragraph.TextPr.Value.Copy();if(oNewEndPr.TextFill){oNewEndPr.Unifill=oNewEndPr.TextFill;oNewEndPr.TextFill=
|
||||
undefined}new_paragraph.TextPr.Set_Value(oNewEndPr);new_paragraph.Internal_Content_Remove2(0,new_paragraph.Content.length);ConvertParagraphContentToPPTX(paragraph.Content,new_paragraph,bIsAddMath,bRemoveHyperlink);var EndRun=new ParaRun(new_paragraph);EndRun.Add_ToContent(0,new ParaEnd);new_paragraph.Internal_Content_Add(new_paragraph.Content.length,EndRun,false);return new_paragraph}function ConvertElementsToPPTX(aResult,aElements,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var i,j,oElement;
|
||||
for(i=0;i<aElements.length;++i){oElement=aElements[i];if(oElement instanceof AscCommonWord.Paragraph)aResult.push(ConvertParagraphToPPTX(oElement));else if(oElement instanceof AscCommonWord.CTable){var paragraphs=[];oElement.GetAllParagraphs({All:true},paragraphs);for(j=0;j<paragraphs.length;j++)aResult.push(AscFormat.ConvertParagraphToPPTX(paragraphs[j],drawingDocument,newParent,bIsAddMath,bRemoveHyperlink))}else if(oElement instanceof AscCommonWord.CBlockLevelSdt)ConvertElementsToPPTX(aResult,oElement.Content.Content,
|
||||
drawingDocument,newParent,bIsAddMath,bRemoveHyperlink)}}function ConvertHyperlinkToPPTX(hyperlink,paragraph){var hyperlink_ret=new ParaHyperlink,i,item,pos=0;hyperlink_ret.SetValue(hyperlink.Value);hyperlink_ret.SetToolTip(hyperlink.ToolTip);for(i=0;i<hyperlink.Content.length;++i){item=hyperlink.Content[i];if(item.Type===para_Run)hyperlink_ret.Add_ToContent(pos++,CopyRunToPPTX(item,paragraph,true));else if(item.Type===para_Hyperlink)hyperlink_ret.Add_ToContent(pos++,ConvertHyperlinkToPPTX(item,paragraph))}return hyperlink_ret}
|
||||
function ConvertParagraphToWord(paragraph,docContent){var _docContent=isRealObject(docContent)?docContent:paragraph.Parent;var oldFlag=paragraph.bFromDocument;paragraph.bFromDocument=true;var new_paragraph=paragraph.Copy(_docContent);CheckWordParagraphContent(new_paragraph.Content,new_paragraph.Pr.DefaultRunPr);var NewRPr=CheckWordRunPr(new_paragraph.TextPr.Value);var oCopyDefaultPr;if(NewRPr){if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(NewRPr);
|
||||
NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr}new_paragraph.TextPr.Apply_TextPr(NewRPr)}else if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(new_paragraph.TextPr.Value);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr;new_paragraph.TextPr.Apply_TextPr(NewRPr)}paragraph.bFromDocument=oldFlag;return new_paragraph}function CheckWordRunPr(Pr,bMath){var NewRPr=null;if(Pr.Unifill&&Pr.Unifill.fill)switch(Pr.Unifill.fill.type){case c_oAscFill.FILL_TYPE_SOLID:{if(Pr.Unifill.fill.color&&
|
||||
Pr.Unifill.fill.color.color)switch(Pr.Unifill.fill.color.color.type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{if(Pr.Unifill.fill.color.Mods&&Pr.Unifill.fill.color.Mods.Mods.length!==0)if(!Pr.Unifill.fill.color.canConvertPPTXModsToWord()){NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}else{NewRPr=Pr.Copy();NewRPr.Unifill.convertToWordMods()}break}case Asc.c_oAscColor.COLOR_TYPE_SRGB:{NewRPr=Pr.Copy();var RGBA=Pr.Unifill.fill.color.color.RGBA;NewRPr.Color=new CDocumentColor(RGBA.R,
|
||||
RGBA.G,RGBA.B);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}}break}case c_oAscFill.FILL_TYPE_PATT:case c_oAscFill.FILL_TYPE_BLIP:{NewRPr=Pr.Copy();NewRPr.TextFill=AscFormat.CreateUnfilFromRGB(0,0,0);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined;break}}if(bMath){NewRPr=Pr.Copy();NewRPr.RFonts.Set_All("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,
|
||||
oTextPr){var NewRPr,MergePr;for(var i=0;i<aContent.length;++i){var oItem=aContent[i];switch(oItem.Type){case para_Run:{NewRPr=CheckWordRunPr(oItem.Pr);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}case para_Hyperlink:{CheckWordParagraphContent(oItem.Content);
|
||||
break}case para_Math:{if(oItem.Root&&oItem.Root.Content)CheckWordParagraphContent(oItem.Root.Content);break}case para_Math_Run:{NewRPr=CheckWordRunPr(oItem.Pr,true);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}}}}function ConvertGraphicFrameToWordTable(oGraphicFrame,
|
||||
oDocument){oGraphicFrame.setWordFlag(false,oDocument);return oGraphicFrame.graphicObject.Copy(oDocument)}function ConvertTableToGraphicFrame(oTable,oPresentation){var oGraphicFrame=new AscFormat.CGraphicFrame;var oTable2=new CTable(oPresentation.DrawingDocument,oGraphicFrame,true,0,[].concat(oTable.TableGrid),oTable.TableGrid.length,true);oTable2.Reset(0,0,50,1E5,0,0,1);oTable2.SetTableLayout(tbllayout_Fixed);oTable2.Set_Pr(oTable.Pr.Copy());oTable2.Set_TableLook(oTable.TableLook.Copy());for(var i=
|
||||
0;i<oTable.Content.length;++i){var oRow=oTable.Content[i];var oNewRow=new CTableRow(oTable2,oRow.Content.length,oTable2.TableGrid);for(var j=0;j<oRow.Content.length;++j){var oContent=oRow.Content[j].Content;var oNewContent=oNewRow.Content[j].Content;for(var t=0;t<oContent.Content.length;++t)if(oContent.Content[t].Get_Type()===type_Paragraph)oNewContent.Internal_Content_Add(oNewContent.Content.length,AscFormat.ConvertParagraphToPPTX(oContent.Content[t],oPresentation.DrawingDocument,oNewContent))}var nIndex=
|
||||
oTable2.Content.length;oTable2.Content[nIndex]=oNewRow;History.Add(new CChangesTableAddRow(oTable2,nIndex,[oNewRow]));oTable2.private_UpdateTableGrid()}if(!oGraphicFrame.spPr){oGraphicFrame.setSpPr(new AscFormat.CSpPr);oGraphicFrame.spPr.setParent(oGraphicFrame)}oGraphicFrame.spPr.setXfrm(new AscFormat.CXfrm);oGraphicFrame.spPr.xfrm.setExtX(50);oGraphicFrame.spPr.xfrm.setExtY(50);oGraphicFrame.spPr.xfrm.setParent(oGraphicFrame.spPr);var _nvGraphicFramePr=new AscFormat.UniNvPr;oGraphicFrame.setNvSpPr(_nvGraphicFramePr);
|
||||
if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))oGraphicFrame.setLocks(_nvGraphicFramePr.locks);oGraphicFrame.setGraphicObject(oTable2);oGraphicFrame.setBDeleted(false);return oGraphicFrame}function fHandleContent(aContent,oMax){for(var i=0;i<aContent.length;++i){var oContentElement=aContent[i];if(oContentElement.Get_Type()===type_Paragraph){var paragraph_lines=aContent[i].Lines;for(var j=0;j<paragraph_lines.length;++j)if(paragraph_lines[j].Ranges[0].W>
|
||||
oMax.max_width)oMax.max_width=paragraph_lines[j].Ranges[0].X+paragraph_lines[j].Ranges[0].W}else if(oContentElement.Get_Type()===type_Table){if(oContentElement.Bounds.Right>oMax.max_width)oMax.max_width=oContentElement.Bounds.Right}else if(oContentElement.Get_Type()===type_BlockLevelSdt)if(oContentElement&&oContentElement.Content)fHandleContent(oContentElement.Content.Content,oMax)}}function RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,bNeedRecalcAllDrawings){var oMaxWidth={max_width:0},i;
|
||||
oDocContent.Reset(0,0,dMaxWidth,2E4);if(bNeedRecalcAllDrawings){var aAllDrawings=oDocContent.GetAllDrawingObjects();for(i=0;i<aAllDrawings.length;++i)aAllDrawings[i].GraphicObj.recalculate()}oDocContent.Recalculate_Page(0,true);fHandleContent(oDocContent.Content,oMaxWidth);if(oMaxWidth.max_width===0){if(oDocContent.Is_Empty())if(oDocContent.Content[0]&&oDocContent.Content[0].Content[0]&&oDocContent.Content[0].Content[0].Content[0])return oDocContent.Content[0].Content[0].Content[0].WidthVisible/TEXTWIDTH_DIVIDER;
|
||||
return.001}return oMaxWidth.max_width}function CheckExcelDrawingXfrm(xfrm){var rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;if(checkNormalRotate(rot)){if(xfrm.offX<0)xfrm.setOffX(0);if(xfrm.offY<0)xfrm.setOffY(0)}else{var dPosX=xfrm.offX+xfrm.extX/2-xfrm.extY/2;var dPosY=xfrm.offY+xfrm.extY/2-xfrm.extX/2;if(dPosX<0)xfrm.setOffX(xfrm.offX-dPosX);if(dPosY<0)xfrm.setOffY(xfrm.offY-dPosY)}}function SetXfrmFromMetrics(oDrawing,metrics){AscFormat.CheckSpPrXfrm(oDrawing);var rot=AscFormat.isRealNumber(oDrawing.spPr.xfrm.rot)?
|
||||
AscFormat.normalizeRotate(oDrawing.spPr.xfrm.rot):0;var metricExtX,metricExtY;if(!(oDrawing instanceof AscFormat.CGroupShape)){metricExtX=metrics.extX;metricExtY=metrics.extY;if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setExtX(metrics.extX);oDrawing.spPr.xfrm.setExtY(metrics.extY)}else{oDrawing.spPr.xfrm.setExtX(metrics.extY);oDrawing.spPr.xfrm.setExtY(metrics.extX)}}else if(AscFormat.isRealNumber(oDrawing.spPr.xfrm.extX)&&AscFormat.isRealNumber(oDrawing.spPr.xfrm.extY)){metricExtX=oDrawing.spPr.xfrm.extX;
|
||||
metricExtY=oDrawing.spPr.xfrm.extY}else{metricExtX=metrics.extX;metricExtY=metrics.extY}if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setOffX(metrics.x);oDrawing.spPr.xfrm.setOffY(metrics.y)}else{oDrawing.spPr.xfrm.setOffX(metrics.x+metricExtX/2-metricExtY/2);oDrawing.spPr.xfrm.setOffY(metrics.y+metricExtY/2-metricExtX/2)}}AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle]=
|
||||
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetGroup]=
|
||||
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetWordShape]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSignature]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr]=function(oClass,value){oClass.nvSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetStyle]=function(oClass,value){oClass.style=
|
||||
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxBody]=function(oClass,value){oClass.txBody=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTextBoxContent]=function(oClass,value){oClass.textBoxContent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetBodyPr]=function(oClass,value){oClass.bodyPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=function(oClass,value){oClass.fromSerialize=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetParent]=
|
||||
function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetWordShape]=function(oClass,value){oClass.bWordShape=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSignature]=function(oClass,value){var oldSignature=oClass.signatureLine;var newSignature=value;oClass.signatureLine=value;if(!AscCommon.isFileBuild()){var oApi=window["Asc"]&&window["Asc"]["editor"]||
|
||||
editor;if(oApi){if(oldSignature&&oldSignature.id)oApi.sendEvent("asc_onRemoveSignature",oldSignature.id);if(newSignature&&newSignature.id)oApi.sendEvent("asc_onAddSignature",newSignature.id)}}};function CSignatureLine(){this.id=null;this.signer=null;this.signer2=null;this.email=null;this.showDate=null;this.instructions=null}CSignatureLine.prototype.Write_ToBinary=function(writer){AscFormat.writeString(writer,this.id);AscFormat.writeString(writer,this.signer);AscFormat.writeString(writer,this.signer2);
|
||||
AscFormat.writeString(writer,this.email);AscFormat.writeBool(writer,this.showDate);AscFormat.writeString(writer,this.instructions)};CSignatureLine.prototype.Read_FromBinary=function(reader){this.id=AscFormat.readString(reader);this.signer=AscFormat.readString(reader);this.signer2=AscFormat.readString(reader);this.email=AscFormat.readString(reader);this.showDate=AscFormat.readBool(reader);this.instructions=AscFormat.readString(reader)};CSignatureLine.prototype.copy=function(){var ret=new CSignatureLine;
|
||||
ret.id=AscCommon.CreateGUID();ret.signer=this.signer;ret.signer2=this.signer2;ret.email=this.email;ret.showDate=this.showDate;ret.instructions=this.instructions;return ret};CSignatureLine.prototype.copyWithId=function(){var sId=this.id;var oCopy=this.copy();oCopy.id=sId;return oCopy};CSignatureLine.prototype.setProperties=function(oPr){this.signer=oPr.asc_getSigner1();this.signer2=oPr.asc_getSigner2();this.email=oPr.asc_getEmail();this.showDate=oPr.asc_getShowDate();this.instructions=oPr.asc_getInstructions()};
|
||||
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetSignature]=CSignatureLine;function CShape(){AscFormat.CGraphicObjectBase.call(this);this.nvSpPr=null;this.style=null;this.txBody=null;this.bodyPr=null;this.textBoxContent=null;this.drawingBase=null;this.bWordShape=null;this.bCheckAutoFitFlag=false;this.signatureLine=null;this.transformText=new CMatrix;this.invertTransformText=null;this.localTransformText=new CMatrix;
|
||||
this.worksheet=null;this.cachedImage=null;this.txWarpStruct=null;this.txWarpStructParamarks=null;this.txWarpStructNoTransform=null;this.txWarpStructParamarksNoTransform=null;this.tmpFontScale=undefined;this.tmpLnSpcReduction=undefined}CShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CShape.prototype.constructor=CShape;CShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Shape};CShape.prototype.GetAllDrawingObjects=function(DrawingObjects){var oContent=this.getDocContent();
|
||||
if(oContent)oContent.GetAllDrawingObjects(DrawingObjects)};CShape.prototype.setSignature=function(oSignature){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetSignature,this.signatureLine,oSignature));this.signatureLine=oSignature};CShape.prototype.setSignaturePr=function(oPr,sUrl){if(!oPr||!this.signatureLine)return;var oCopy=this.signatureLine.copyWithId();oCopy.setProperties(oPr);this.setSignature(oCopy);if(sUrl)if(this.spPr){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sUrl);
|
||||
this.spPr.setFill(oBlipFillUnifill)}};CShape.prototype.convertToWord=function(document){this.setBDeleted(true);var c=new CShape;c.setWordShape(true);c.setBDeleted(false);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());if(this.spPr){c.setSpPr(this.spPr.createDuplicate());if(!c.spPr.geometry)c.spPr.setGeometry(AscFormat.CreateGeometry("rect"));c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.txBody){if(this.txBody.bodyPr)c.setBodyPr(this.txBody.bodyPr.createDuplicate());
|
||||
if(this.txBody.content){var new_content=new CDocumentContent(c,document.DrawingDocument,0,0,0,2E4,false,false,false);var paragraphs=this.txBody.content.Content;new_content.Internal_Content_RemoveAll();for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];var new_paragraph=ConvertParagraphToWord(cur_par,new_content);new_content.Internal_Content_Add(i,new_paragraph,false)}c.setTextBoxContent(new_content)}}if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.convertToPPTX=
|
||||
function(drawingDocument,worksheet,bIsAddMath){var 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){var tx_body=new AscFormat.CTextBody;tx_body.setParent(c);if(this.bodyPr)tx_body.setBodyPr(this.bodyPr.createDuplicate());var new_content=new AscFormat.CDrawingDocContent(tx_body,
|
||||
drawingDocument,0,0,0,0,false,false,true);new_content.Internal_Content_RemoveAll();var paragraphs=this.textBoxContent.Content;var index=0;for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];if(cur_par instanceof Paragraph){var new_paragraph=ConvertParagraphToPPTX(cur_par,drawingDocument,new_content,bIsAddMath);new_content.Internal_Content_Add(index++,new_paragraph,false)}}tx_body.setContent(new_content);c.setTxBody(tx_body)}if(worksheet)if(this.signatureLine)c.setSignature(this.signatureLine.copy());
|
||||
return c};CShape.prototype.handleAllContents=function(fCallback){var content=this.getDocContent();if(content)fCallback(content)};CShape.prototype.documentGetAllFontNames=function(AllFonts){var content=this.getDocContent();if(content)content.Document_Get_AllFontNames(AllFonts)};CShape.prototype.documentCreateFontMap=function(map){var content=this.getDocContent();if(content)content.Document_CreateFontMap(map)};CShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
||||
AscDFH.historyitem_ShapeSetNvSpPr,this.nvSpPr,pr));this.nvSpPr=pr};CShape.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetSpPr,this.spPr,spPr));this.spPr=spPr};CShape.prototype.setStyle=function(style){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetStyle,this.style,style));this.style=style;var content=this.getDocContent();this.recalcInfo.recalculateShapeStyleForParagraph=true;if(this.recalcTextStyles)this.recalcTextStyles();
|
||||
if(content)content.Recalc_AllParagraphs_CompiledPr()};CShape.prototype.setTxBody=function(txBody){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTxBody,this.txBody,txBody));this.txBody=txBody};CShape.prototype.setTextBoxContent=function(textBoxContent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTextBoxContent,this.textBoxContent,textBoxContent));this.textBoxContent=textBoxContent};CShape.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,
|
||||
AscDFH.historyitem_ShapeSetBodyPr,this.bodyPr,pr));this.bodyPr=pr;this.recalcInfo.recalculateContent=true;this.recalcInfo.recalculateTransformText=true;this.addToRecalculate()};CShape.prototype.createTextBody=function(){var tx_body=new AscFormat.CTextBody;tx_body.setParent(this);tx_body.setContent(new AscFormat.CDrawingDocContent(tx_body,this.getDrawingDocument(),0,0,0,2E4,false,false,true));var oBodyPr=new AscFormat.CBodyPr;if(this.worksheet){oBodyPr.vertOverflow=AscFormat.nOTClip;oBodyPr.horzOverflow=
|
||||
AscFormat.nOTClip}tx_body.setBodyPr(oBodyPr);tx_body.content.Content[0].Set_DocumentIndex(0);tx_body.content.MoveCursorToStartPos(false);this.setTxBody(tx_body)};CShape.prototype.createTextBoxContent=function(){var body_pr=new AscFormat.CBodyPr;body_pr.setAnchor(1);this.setBodyPr(body_pr);this.setTextBoxContent(new CDocumentContent(this,this.getDrawingDocument(),0,0,0,2E4,false,false));this.textBoxContent.SetParagraphAlign(AscCommon.align_Center);this.textBoxContent.MoveCursorToStartPos(false);this.textBoxContent.Content[0].Set_DocumentIndex(0)};
|
||||
CShape.prototype.paragraphAdd=function(paraItem,bRecalculate){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent()}if(content_to_add)content_to_add.AddToParagraph(paraItem,bRecalculate)};CShape.prototype.applyTextFunction=function(docContentFunction,tableFunction,args){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();
|
||||
else this.createTextBody();content_to_add=this.getDocContent();content_to_add.MoveCursorToStartPos()}if(content_to_add)docContentFunction.apply(content_to_add,args);if(!editor||!editor.noCreatePoint||editor.exucuteHistory)this.checkExtentsByDocContent()};CShape.prototype.clearContent=function(){var content=this.getDocContent();if(content){content.Set_ApplyToAll(true);content.Remove(-1);content.AddToParagraph(new AscCommonWord.ParaTextPr({Lang:{Val:undefined}}),false);content.Set_ApplyToAll(false)}};
|
||||
CShape.prototype.getDocContent=function(){if(this.txBody)return this.txBody.content;else if(this.textBoxContent)return this.textBoxContent;return null};CShape.prototype.getBodyPr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.bWordShape){var ret=new AscFormat.CBodyPr;ret.setDefault();if(this.bodyPr)ret.merge(this.bodyPr);return ret}else{if(this.txBody&&this.txBody.bodyPr)return this.txBody.getCompiledBodyPr();var ret=new AscFormat.CBodyPr;ret.setDefault();return ret}},this,[])};CShape.prototype.GetRevisionsChangeElement=
|
||||
function(SearchEngine){var oContent=this.getDocContent();if(oContent)oContent.GetRevisionsChangeElement(SearchEngine)};CShape.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.textBoxContent){var dd=this.getDrawingDocument();dd.StartSearchTransform(this.transformText);this.textBoxContent.Search(Str,Props,SearchEngine,Type);dd.EndSearchTransform()}else if(this.txBody&&this.txBody.content)this.txBody.content.Search(Str,Props,SearchEngine,Type)};CShape.prototype.GetSearchElementId=function(bNext,
|
||||
bCurrent){if(this.textBoxContent)return this.textBoxContent.GetSearchElementId(bNext,bCurrent);else if(this.txBody&&this.txBody.content)return this.txBody.content.GetSearchElementId(bNext,bCurrent);return null};CShape.prototype.documentUpdateRulersState=function(){var content=this.getDocContent();if(!content)return;var xc,yc;var l,t,r,b;var body_pr=this.getBodyPr();var l_ins,t_ins,r_ins,b_ins;if(typeof body_pr.lIns==="number")l_ins=body_pr.lIns;else l_ins=2.54;if(typeof body_pr.tIns==="number")t_ins=
|
||||
body_pr.tIns;else t_ins=1.27;if(typeof body_pr.rIns==="number")r_ins=body_pr.rIns;else r_ins=2.54;if(typeof body_pr.bIns==="number")b_ins=body_pr.bIns;else b_ins=1.27;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){l=this.spPr.geometry.rect.l+l_ins;t=this.spPr.geometry.rect.t+t_ins;r=this.spPr.geometry.rect.r-r_ins;b=this.spPr.geometry.rect.b-b_ins}else{l=l_ins;t=t_ins;r=this.extX-r_ins;b=this.extY-b_ins}var x_lt,y_lt,x_rt,y_rt,x_rb,y_rb,x_lb,y_lb;var tr=this.transform;
|
||||
x_lt=tr.TransformPointX(l,t);y_lt=tr.TransformPointY(l,t);x_rb=tr.TransformPointX(r,b);y_rb=tr.TransformPointY(r,b);xc=(x_lt+x_rb)*.5;yc=(y_lt+y_rb)*.5;var hc=(r-l)*.5;var vc=(b-t)*.5;this.getDrawingDocument().Set_RulerState_Paragraph({L:xc-hc,T:yc-vc,R:xc+hc,B:yc+vc});content.Document_UpdateRulersState(AscFormat.isRealNumber(this.selectStartPage)?this.selectStartPage:0)};CShape.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetParent,
|
||||
this.parent,parent));this.parent=parent};CShape.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetGroup,this.group,group));this.group=group};CShape.prototype.getAllImages=function(images){if(this.spPr&&this.spPr.Fill&&this.spPr.Fill.fill instanceof AscFormat.CBlipFill&&typeof this.spPr.Fill.fill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.spPr.Fill.fill.RasterImageId)]=true};CShape.prototype.getAllFonts=function(fonts){if(this.txBody){this.txBody.content.Document_Get_AllFontNames(fonts);
|
||||
if(this.txBody&&this.txBody.lstStyle)this.txBody.lstStyle.Document_Get_AllFontNames(fonts);delete fonts["+mj-lt"];delete fonts["+mn-lt"];delete fonts["+mj-ea"];delete fonts["+mn-ea"];delete fonts["+mj-cs"];delete fonts["+mn-cs"]}};CShape.prototype.canFill=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.canFill();return true};CShape.prototype.isShape=function(){return true};CShape.prototype.isImage=function(){return false};CShape.prototype.isChart=function(){return false};CShape.prototype.isGroup=
|
||||
function(){return false};CShape.prototype.getHierarchy=function(bIsSingleBody,info){{this.compiledHierarchy=[];if(this.parent){var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body;if(AscFormat.isRealBool(bIsSingleBody))b_is_single_body=bIsSingleBody;else b_is_single_body=this.getIsSingleBody&&this.getIsSingleBody();switch(this.parent.kind){case AscFormat.TYPE_KIND.SLIDE:{hierarchy.push(this.parent.Layout.getMatchingShape(ph_type,
|
||||
ph_index,b_is_single_body,info));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.NOTES:{if(this.parent.Master)hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}}}this.recalcInfo.recalculateShapeHierarchy=true}}return this.compiledHierarchy};CShape.prototype.getPaddings=function(){var paddings=
|
||||
null;var shape=this;var body_pr;if(shape.txBody)if(shape.txBody.compiledBodyPr)body_pr=shape.txBody.compiledBodyPr;else body_pr=shape.txBody.getCompiledBodyPr();else if(shape.textBoxContent)body_pr=shape.bodyPr;if(body_pr){paddings=new Asc.asc_CPaddings;if(typeof body_pr.lIns==="number")paddings.Left=body_pr.lIns;else paddings.Left=2.54;if(typeof body_pr.tIns==="number")paddings.Top=body_pr.tIns;else paddings.Top=1.27;if(typeof body_pr.rIns==="number")paddings.Right=body_pr.rIns;else paddings.Right=
|
||||
2.54;if(typeof body_pr.bIns==="number")paddings.Bottom=body_pr.bIns;else paddings.Bottom=1.27}return paddings};CShape.prototype.getCompiledFill=function(){if(this.recalcInfo.recalculateFill){this.compiledFill=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){if(this.spPr.Fill.fill instanceof AscFormat.CGradFill&&this.spPr.Fill.fill.colors.length===0){var parent_objects=this.getParentObjects();var theme=parent_objects.theme;var fmt_scheme=theme.themeElements.fmtScheme;
|
||||
var fill_style_lst=fmt_scheme.fillStyleLst;for(var i=fill_style_lst.length-1;i>-1;--i)if(fill_style_lst[i]&&fill_style_lst[i].fill instanceof AscFormat.CGradFill){this.spPr.Fill=fill_style_lst[i].createDuplicate();break}}this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&&this.compiledFill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=
|
||||
group_compiled_fill.createDuplicate();else this.compiledFill=null}else this.compiledFill=null}else if(isRealObject(this.group)){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=
|
||||
hierarchy[i].spPr.Fill.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}this.recalcInfo.recalculateFill=false}return this.compiledFill};CShape.prototype.getMargins=function(){if(this.txBody)return this.txBody.getMargins();else return null};
|
||||
CShape.prototype.Document_UpdateRulersState=function(margins){if(this.txBody&&this.txBody.content)this.txBody.content.Document_UpdateRulersState(this.parent.num,this.getMargins())};CShape.prototype.getCompiledLine=function(){if(this.recalcInfo.recalculateLine){this.compiledLine=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.ln)&&isRealObject(this.spPr.ln))this.compiledLine=this.spPr.ln.createDuplicate();else if(isRealObject(this.group)){var group_compiled_line=this.group.getCompiledLine();
|
||||
if(isRealObject(group_compiled_line)&&isRealObject(group_compiled_line.fill))this.compiledLine=group_compiled_line.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&
|
||||
isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}this.recalcInfo.recalculateLine=false}return this.compiledLine};CShape.prototype.getCompiledTransparent=function(){if(this.recalcInfo.recalculateTransparent){this.compiledTransparent=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill))if(AscFormat.isRealNumber(this.spPr.Fill.transparent))this.compiledTransparent=this.spPr.Fill.transparent;else if(this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.type===
|
||||
c_oAscFill.FILL_TYPE_GRP)if(this.group&&this.group.spPr&&this.group.spPr.Fill&&AscFormat.isRealNumber(this.group.spPr.Fill.transparent))this.compiledTransparent=this.group.spPr.Fill.transparent;if(null!==this.compiledTransparent){this.recalcInfo.recalculateTransparent=false;return this.compiledTransparent}if(isRealObject(this.group)){var group_transparent=this.group.getCompiledTransparent();if(AscFormat.isRealNumber(group_transparent))this.compiledTransparent=group_transparent;else{var hierarchy=
|
||||
this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=hierarchy[i].spPr.Fill.transparent;break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=
|
||||
hierarchy[i].spPr.Fill.transparent;break}}this.recalcInfo.recalculateTransparent=false}return this.compiledTransparent};CShape.prototype.isPlaceholder=function(){return isRealObject(this.nvSpPr)&&isRealObject(this.nvSpPr.nvPr)&&isRealObject(this.nvSpPr.nvPr.ph)};CShape.prototype.getPlaceholderType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPlaceholderIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.getPhType=
|
||||
function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPhIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.setVerticalAlign=function(align){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();
|
||||
new_body_pr.anchor=align;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setVert=function(vert){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vert=vert;if(this.bWordShape)this.setBodyPr(new_body_pr);
|
||||
else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent&&this.checkExtentsByDocContent()};CShape.prototype.setTextFitType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.textFit=new AscFormat.CTextFit;new_body_pr.textFit.type=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};
|
||||
CShape.prototype.setVertOverflowType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vertOverflow=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};CShape.prototype.setPaddings=function(paddings){if(paddings){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();
|
||||
if(AscFormat.isRealNumber(paddings.Left))new_body_pr.lIns=paddings.Left;if(AscFormat.isRealNumber(paddings.Top))new_body_pr.tIns=paddings.Top;if(AscFormat.isRealNumber(paddings.Right))new_body_pr.rIns=paddings.Right;if(AscFormat.isRealNumber(paddings.Bottom))new_body_pr.bIns=paddings.Bottom;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}}};CShape.prototype.recalculateTransformText=function(){var oContent=this.getDocContent();if(!oContent)return;
|
||||
var oBodyPr=this.getBodyPr();this.clipRect=this.checkTransformTextMatrix(this.localTransformText,oContent,oBodyPr,false);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText);if(this.txBody&&this.txBody.content2){this.transformText2=new CMatrix;this.clipRect2=this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,oBodyPr,false);this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)}var bNoTextNoShape=
|
||||
oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.preset!=="textNoShape";{this.localTransformTextWordArt=new CMatrix;this.checkTransformTextMatrix(this.localTransformTextWordArt,oContent,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt=this.localTransformTextWordArt.CreateDublicate();this.invertTransformTextWordArt=global_MatrixTransformer.Invert(this.transformTextWordArt)}if(this.txBody&&this.txBody.content2){this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,
|
||||
oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt2=new CMatrix;this.checkTransformTextMatrix(this.transformTextWordArt2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape)}if(this.checkPosTransformText)this.checkPosTransformText();if(this.checkContentDrawings)this.checkContentDrawings()};CShape.prototype.getFullFlip=function(){var _transform=this.localTransform;var _full_rotate=this.getFullRotate();var _full_pos_x_lt=_transform.TransformPointX(0,
|
||||
0);var _full_pos_y_lt=_transform.TransformPointY(0,0);var _full_pos_x_rt=_transform.TransformPointX(this.extX,0);var _full_pos_y_rt=_transform.TransformPointY(this.extX,0);var _full_pos_x_rb=_transform.TransformPointX(this.extX,this.extY);var _full_pos_y_rb=_transform.TransformPointY(this.extX,this.extY);var _rotate_matrix=new CMatrix;global_MatrixTransformer.RotateRadAppend(_rotate_matrix,_full_rotate);var _rotated_pos_x_lt=_rotate_matrix.TransformPointX(_full_pos_x_lt,_full_pos_y_lt);var _rotated_pos_x_rt=
|
||||
_rotate_matrix.TransformPointX(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rt=_rotate_matrix.TransformPointY(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rb=_rotate_matrix.TransformPointY(_full_pos_x_rb,_full_pos_y_rb);return{flipH:_rotated_pos_x_lt>_rotated_pos_x_rt,flipV:_rotated_pos_y_rt>_rotated_pos_y_rb}};CShape.prototype.recalculateTransformText2=function(){if(this.txBody===null)return;if(!this.txBody.content2)return;this.transformText2=new CMatrix;var _text_transform=this.transformText2;
|
||||
var _shape_transform=this.transform;var _body_pr=this.txBody.getBodyPr();var _content_height=this.txBody.getSummaryHeight2();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;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var _rect=this.spPr.geometry.rect;_l=_rect.l+_body_pr.lIns;_t=_rect.t+_body_pr.tIns;_r=_rect.r-_body_pr.rIns;_b=_rect.b-_body_pr.bIns}else{_l=_body_pr.lIns;_t=_body_pr.tIns;_r=this.extX-_body_pr.rIns;_b=this.extY-
|
||||
_body_pr.bIns}if(_l>=_r){var _c=(_l+_r)*.5;_l=_c-.01;_r=_c+.01}if(_t>=_b){_c=(_t+_b)*.5;_t=_c-.01;_b=_c+.01}_t_x_lt=_shape_transform.TransformPointX(_l,_t);_t_y_lt=_shape_transform.TransformPointY(_l,_t);_t_x_rt=_shape_transform.TransformPointX(_r,_t);_t_y_rt=_shape_transform.TransformPointY(_r,_t);_t_x_lb=_shape_transform.TransformPointX(_l,_b);_t_y_lb=_shape_transform.TransformPointY(_l,_b);_t_x_rb=_shape_transform.TransformPointX(_r,_b);_t_y_rb=_shape_transform.TransformPointY(_r,_b);var _dx_t,
|
||||
_dy_t;_dx_t=_t_x_rt-_t_x_lt;_dy_t=_t_y_rt-_t_y_lt;var _dx_lt_rb,_dy_lt_rb;_dx_lt_rb=_t_x_rb-_t_x_lt;_dy_lt_rb=_t_y_rb-_t_y_lt;var _vertical_shift;var _text_rect_height=_b-_t;var _text_rect_width=_r-_l;if(!_body_pr.upright){if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_height;break}case 1:{_vertical_shift=(_text_rect_height-_content_height)*
|
||||
.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){var alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lt,_t_y_lt)}else{alpha=
|
||||
Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}}else{if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_width-_content_height;break}case 1:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 4:{_vertical_shift=0;
|
||||
break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI*.5-_alpha);
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lt,_t_y_lt)}else if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lb,_t_y_lb)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*.5-_alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rb,_t_y_rb)}}if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var rect=
|
||||
this.spPr.geometry.rect;this.clipRect={x:-1,y:rect.t,w:this.extX+2,h:rect.b-rect.t}}else this.clipRect={x:-1,y:0,w:this.extX+2,h:this.extY}}else{var _full_rotate=this.getFullRotate();var _full_flip=this.getFullFlip();var _hc=this.extX*.5;var _vc=this.extY*.5;var _transformed_shape_xc=this.transform.TransformPointX(_hc,_vc);var _transformed_shape_yc=this.transform.TransformPointY(_hc,_vc);var _content_width,content_height2;if(checkNormalRotate(_full_rotate))if(!(_body_pr.vert===AscFormat.nVertTTvert||
|
||||
_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){_content_width=_r-_l;content_height2=_b-_t}else{_content_width=_b-_t;content_height2=_r-_l}else if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){_content_width=_b-_t;content_height2=_r-_l}else{_content_width=_r-_l;content_height2=_b-_t}if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=content_height2-_content_height;break}case 1:{_vertical_shift=
|
||||
|
@ -8425,87 +8425,88 @@ oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Imag
|
|||
this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";
|
||||
var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
|
||||
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_font_loader=new CGlobalFontLoader;window["AscCommon"].g_image_loader=new CGlobalImageLoader;window["AscCommon"].g_flow_anchor=g_flow_anchor;window["AscCommon"].g_flow_anchor2=g_flow_anchor2})(window,window.document);"use strict";(function(window,undefined){var FOREIGN_CURSOR_LABEL_HIDETIME=1500;function CCollaborativeChanges(){this.m_pData=null;this.m_oColor=null}CCollaborativeChanges.prototype.Set_Data=function(pData){this.m_pData=
|
||||
pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;
|
||||
var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=
|
||||
function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index<
|
||||
srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=
|
||||
nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=
|
||||
[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=
|
||||
0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();
|
||||
this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=
|
||||
0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index<Len;Index++)if(this.m_aUsers[Index]===UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};
|
||||
CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();
|
||||
editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>
|
||||
0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};
|
||||
CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);
|
||||
this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls=
|
||||
{};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));
|
||||
else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));
|
||||
this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};
|
||||
CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-
|
||||
1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=
|
||||
function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=
|
||||
0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,
|
||||
false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=
|
||||
function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();
|
||||
this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=
|
||||
function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();
|
||||
this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=
|
||||
CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=
|
||||
function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=
|
||||
UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,
|
||||
Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,
|
||||
SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};
|
||||
CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);
|
||||
else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);
|
||||
if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};
|
||||
CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);
|
||||
if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=
|
||||
function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=
|
||||
0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===
|
||||
oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=
|
||||
this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=
|
||||
oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=0,nCount=arrChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);
|
||||
oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();
|
||||
this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=
|
||||
oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
|
||||
oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&
|
||||
oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=
|
||||
oLogicDocument.Slides.length-1;i>-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=
|
||||
mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=
|
||||
mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,
|
||||
false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=
|
||||
mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=
|
||||
new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();
|
||||
var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<
|
||||
nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,
|
||||
null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=
|
||||
function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();
|
||||
for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=
|
||||
function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,
|
||||
nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=
|
||||
function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position&&(_Pos.Position>Pos||_Pos.Position===Pos&&!(Class instanceof AscCommonWord.ParaRun))){_Pos.Position++;
|
||||
break}}}};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position){if(_Pos.Position>Pos+Count)_Pos.Position-=Count;else if(_Pos.Position>=Pos){_Pos.Position=Pos;_Pos.Deleted=true}break}}}};
|
||||
CDocumentPositionsManager.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositionsSplit=[];for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(SplitRun===_Pos.Class&&_Pos.Position&&_Pos.Position>=SplitPos)this.m_aDocumentPositionsSplit.push({DocPos:DocPos,NewRunPos:_Pos.Position-SplitPos})}}};
|
||||
CDocumentPositionsManager.prototype.OnEnd_SplitRun=function(NewRun){if(!NewRun)return;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsSplit.length;PosIndex<PosCount;++PosIndex){var NewDocPos=[];NewDocPos.push({Class:NewRun,Position:this.m_aDocumentPositionsSplit[PosIndex].NewRunPos});this.m_aDocumentPositions.push(NewDocPos);this.m_aDocumentPositionsMap.push({StartPos:this.m_aDocumentPositionsSplit[PosIndex].DocPos,EndPos:NewDocPos})}};CDocumentPositionsManager.prototype.Update_DocumentPosition=
|
||||
function(DocPos){var NewDocPos=DocPos;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsMap.length;PosIndex<PosCount;++PosIndex)if(this.m_aDocumentPositionsMap[PosIndex].StartPos===NewDocPos)NewDocPos=this.m_aDocumentPositionsMap[PosIndex].EndPos;if(NewDocPos!==DocPos&&NewDocPos.length===1&&NewDocPos[0].Class instanceof AscCommonWord.ParaRun){var Run=NewDocPos[0].Class;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);
|
||||
DocPos.push({Class:Run,Position:NewDocPos[0].Position})}}else if(DocPos.length>0&&DocPos[DocPos.length-1].Class instanceof AscCommonWord.ParaRun){var Run=DocPos[DocPos.length-1].Class;var RunPos=DocPos[DocPos.length-1].Position;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);DocPos.push({Class:Run,Position:RunPos})}}};CDocumentPositionsManager.prototype.Remove_DocumentPosition=function(DocPos){for(var Pos=0,Count=
|
||||
this.m_aDocumentPositions.length;Pos<Count;++Pos)if(this.m_aDocumentPositions[Pos]===DocPos){this.m_aDocumentPositions.splice(Pos,1);return}};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].FOREIGN_CURSOR_LABEL_HIDETIME=FOREIGN_CURSOR_LABEL_HIDETIME;window["AscCommon"].CCollaborativeChanges=CCollaborativeChanges;window["AscCommon"].CCollaborativeEditingBase=CCollaborativeEditingBase;window["AscCommon"].CDocumentPositionsManager=CDocumentPositionsManager})(window);"use strict";(function(window,
|
||||
undefined){var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CBounds(){this.L=0;this.T=0;this.R=0;this.B=0;this.isAbsL=false;this.isAbsT=false;this.isAbsR=false;this.isAbsB=false;this.AbsW=-1;this.AbsH=-1;this.SetParams=function(_l,_t,_r,_b,abs_l,abs_t,abs_r,abs_b,absW,absH){this.L=_l;this.T=_t;this.R=_r;this.B=_b;this.isAbsL=abs_l;this.isAbsT=abs_t;this.isAbsR=abs_r;this.isAbsB=abs_b;this.AbsW=absW;this.AbsH=absH}}function CAbsolutePosition(){this.L=0;this.T=0;this.R=0;this.B=0}var g_anchor_left=
|
||||
1;var g_anchor_top=2;var g_anchor_right=4;var g_anchor_bottom=8;function CControl(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Resize=function(_width,_height,api){if(null==this.Parent||null==this.HtmlElement)return;var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;
|
||||
else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=
|
||||
this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=
|
||||
this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;
|
||||
this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";if(api!==undefined&&api.CheckRetinaElement&&api.CheckRetinaElement(this.HtmlElement)){var _W=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;var _H=(_b-_y)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.width=AscCommon.AscBrowser.convertToRetinaValue(_W,true);this.HtmlElement.height=
|
||||
AscCommon.AscBrowser.convertToRetinaValue(_H,true)}else{this.HtmlElement.width=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.height=(_b-_y)*g_dKoef_mm_to_pix+.5>>0}};this.GetCSS_width=function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CControlContainer(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=
|
||||
null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Controls=[];this.AddControl=function(ctrl){ctrl.Parent=this;this.Controls[this.Controls.length]=ctrl};this.Resize=function(_width,_height,api){if(null==this.Parent){this.AbsolutePosition.L=0;this.AbsolutePosition.T=0;this.AbsolutePosition.R=_width;this.AbsolutePosition.B=_height;if(null!=this.HtmlElement){var lCount=this.Controls.length;for(var i=0;i<lCount;i++)this.Controls[i].Resize(_width,_height,api)}return}var _x=
|
||||
0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=
|
||||
this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*
|
||||
_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<
|
||||
_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";var lCount=this.Controls.length;for(var i=0;i<lCount;i++)this.Controls[i].Resize(_r-_x,_b-_y,api)};this.GetCSS_width=
|
||||
function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CreateControlContainer(name){var ctrl=new CControlContainer;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}function CreateControl(name){var ctrl=new CControl;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}window["AscCommon"]=window["AscCommon"]||
|
||||
{};window["AscCommon"].g_anchor_left=g_anchor_left;window["AscCommon"].g_anchor_top=g_anchor_top;window["AscCommon"].g_anchor_right=g_anchor_right;window["AscCommon"].g_anchor_bottom=g_anchor_bottom;window["AscCommon"].CreateControlContainer=CreateControlContainer;window["AscCommon"].CreateControl=CreateControl})(window);"use strict";(function(window,undefined){var AscBrowser=AscCommon.AscBrowser;var TRACK_CIRCLE_RADIUS=5;var TRACK_RECT_SIZE2=4;var TRACK_RECT_SIZE=8;var TRACK_RECT_SIZE_CT=6;var TRACK_DISTANCE_ROTATE=
|
||||
25;var TRACK_DISTANCE_ROTATE2=25;var TRACK_ADJUSTMENT_SIZE=10;var TRACK_WRAPPOINTS_SIZE=6;var IMAGE_ROTATE_TRACK_W=21;var bIsUseImageRotateTrack=true;if(bIsUseImageRotateTrack){window.g_track_rotate_marker=new Image;window.g_track_rotate_marker;window.g_track_rotate_marker.asc_complete=false;window.g_track_rotate_marker.onload=function(){window.g_track_rotate_marker.asc_complete=true};window.g_track_rotate_marker.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAAVFBMVEUAAAD///////////////////////////////////////////////////////98fHy2trb09PTT09OysrKqqqqJiYng4ODr6+uamprGxsbi4uKGhoYjgM0eAAAADnRSTlMAy00k7/z0jbeuMzDljsugwZgAAACpSURBVBjTdZHbEoMgDESDAl6bgIqX9v//s67UYpm6D0xyYMImoaiuUr3pVdVRUtnwqaY8YaE5SRcfaPgqc+DSIh7WIGGaEVoUqRGN4oZlcDIiqYlaPjQz5CNu6cFJwLiuSO3nlLBDrKhn3l4rcnH4NcAdGd5EZMfCsoMFBxM6CD57G+u6vC48PMVnHtrYhP/x+7+3cw7zdJnD3cyA7QXa4nYXaW+a9Xdvb6zqE5Jb7LmzAAAAAElFTkSuQmCC";
|
||||
pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;if(this.m_pData&&this.m_pData.type==="cp_theme"){clearTimeout(window.CP_theme_to);var data=this.m_pData;window.CP_theme_to=setTimeout(function(){window.parent.APP.remoteTheme();
|
||||
window.editor.ChangeTheme(data.id,null,true)});return true}var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);
|
||||
return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;
|
||||
break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&
|
||||
16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;
|
||||
return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId=
|
||||
{};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=
|
||||
[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=
|
||||
function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index<Len;Index++)if(this.m_aUsers[Index]===
|
||||
UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=
|
||||
function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();
|
||||
this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];
|
||||
Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=
|
||||
function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=
|
||||
function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+
|
||||
sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);
|
||||
this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};
|
||||
CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=
|
||||
Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=
|
||||
function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===
|
||||
this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};
|
||||
CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=
|
||||
function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<
|
||||
Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=
|
||||
Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=
|
||||
function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();
|
||||
editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,
|
||||
UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=
|
||||
function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=
|
||||
function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,
|
||||
Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};
|
||||
CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};
|
||||
CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);
|
||||
if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);
|
||||
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);
|
||||
if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);
|
||||
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=
|
||||
function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=
|
||||
function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>
|
||||
0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=
|
||||
this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=
|
||||
0,nCount=arrChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();
|
||||
if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];
|
||||
var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
|
||||
oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;
|
||||
else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=
|
||||
0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=
|
||||
oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=
|
||||
oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>
|
||||
-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof
|
||||
AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=
|
||||
oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=
|
||||
[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,
|
||||
{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);
|
||||
arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};
|
||||
CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=
|
||||
this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
|
||||
oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;
|
||||
else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=
|
||||
[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
|
||||
for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position&&(_Pos.Position>Pos||_Pos.Position===Pos&&!(Class instanceof AscCommonWord.ParaRun))){_Pos.Position++;break}}}};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=
|
||||
0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position){if(_Pos.Position>Pos+Count)_Pos.Position-=Count;else if(_Pos.Position>=Pos){_Pos.Position=Pos;_Pos.Deleted=true}break}}}};CDocumentPositionsManager.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositionsSplit=[];for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
|
||||
for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(SplitRun===_Pos.Class&&_Pos.Position&&_Pos.Position>=SplitPos)this.m_aDocumentPositionsSplit.push({DocPos:DocPos,NewRunPos:_Pos.Position-SplitPos})}}};CDocumentPositionsManager.prototype.OnEnd_SplitRun=function(NewRun){if(!NewRun)return;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsSplit.length;PosIndex<PosCount;++PosIndex){var NewDocPos=[];NewDocPos.push({Class:NewRun,Position:this.m_aDocumentPositionsSplit[PosIndex].NewRunPos});
|
||||
this.m_aDocumentPositions.push(NewDocPos);this.m_aDocumentPositionsMap.push({StartPos:this.m_aDocumentPositionsSplit[PosIndex].DocPos,EndPos:NewDocPos})}};CDocumentPositionsManager.prototype.Update_DocumentPosition=function(DocPos){var NewDocPos=DocPos;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsMap.length;PosIndex<PosCount;++PosIndex)if(this.m_aDocumentPositionsMap[PosIndex].StartPos===NewDocPos)NewDocPos=this.m_aDocumentPositionsMap[PosIndex].EndPos;if(NewDocPos!==DocPos&&NewDocPos.length===
|
||||
1&&NewDocPos[0].Class instanceof AscCommonWord.ParaRun){var Run=NewDocPos[0].Class;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);DocPos.push({Class:Run,Position:NewDocPos[0].Position})}}else if(DocPos.length>0&&DocPos[DocPos.length-1].Class instanceof AscCommonWord.ParaRun){var Run=DocPos[DocPos.length-1].Class;var RunPos=DocPos[DocPos.length-1].Position;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,
|
||||
Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);DocPos.push({Class:Run,Position:RunPos})}}};CDocumentPositionsManager.prototype.Remove_DocumentPosition=function(DocPos){for(var Pos=0,Count=this.m_aDocumentPositions.length;Pos<Count;++Pos)if(this.m_aDocumentPositions[Pos]===DocPos){this.m_aDocumentPositions.splice(Pos,1);return}};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].FOREIGN_CURSOR_LABEL_HIDETIME=FOREIGN_CURSOR_LABEL_HIDETIME;window["AscCommon"].CCollaborativeChanges=
|
||||
CCollaborativeChanges;window["AscCommon"].CCollaborativeEditingBase=CCollaborativeEditingBase;window["AscCommon"].CDocumentPositionsManager=CDocumentPositionsManager})(window);"use strict";(function(window,undefined){var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CBounds(){this.L=0;this.T=0;this.R=0;this.B=0;this.isAbsL=false;this.isAbsT=false;this.isAbsR=false;this.isAbsB=false;this.AbsW=-1;this.AbsH=-1;this.SetParams=function(_l,_t,_r,_b,abs_l,abs_t,abs_r,abs_b,absW,absH){this.L=_l;
|
||||
this.T=_t;this.R=_r;this.B=_b;this.isAbsL=abs_l;this.isAbsT=abs_t;this.isAbsR=abs_r;this.isAbsB=abs_b;this.AbsW=absW;this.AbsH=absH}}function CAbsolutePosition(){this.L=0;this.T=0;this.R=0;this.B=0}var g_anchor_left=1;var g_anchor_top=2;var g_anchor_right=4;var g_anchor_bottom=8;function CControl(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Resize=function(_width,_height,
|
||||
api){if(null==this.Parent||null==this.HtmlElement)return;var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=
|
||||
this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;
|
||||
else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;
|
||||
else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";if(api!==undefined&&api.CheckRetinaElement&&
|
||||
api.CheckRetinaElement(this.HtmlElement)){var _W=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;var _H=(_b-_y)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.width=AscCommon.AscBrowser.convertToRetinaValue(_W,true);this.HtmlElement.height=AscCommon.AscBrowser.convertToRetinaValue(_H,true)}else{this.HtmlElement.width=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.height=(_b-_y)*g_dKoef_mm_to_pix+.5>>0}};this.GetCSS_width=function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=
|
||||
function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CControlContainer(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Controls=[];this.AddControl=function(ctrl){ctrl.Parent=this;this.Controls[this.Controls.length]=ctrl};this.Resize=function(_width,_height,api){if(null==this.Parent){this.AbsolutePosition.L=0;this.AbsolutePosition.T=
|
||||
0;this.AbsolutePosition.R=_width;this.AbsolutePosition.B=_height;if(null!=this.HtmlElement){var lCount=this.Controls.length;for(var i=0;i<lCount;i++)this.Controls[i].Resize(_width,_height,api)}return}var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=
|
||||
this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==
|
||||
ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==
|
||||
ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*
|
||||
g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";var lCount=this.Controls.length;for(var i=0;i<lCount;i++)this.Controls[i].Resize(_r-_x,_b-_y,api)};this.GetCSS_width=function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CreateControlContainer(name){var ctrl=new CControlContainer;ctrl.Name=name;
|
||||
ctrl.HtmlElement=document.getElementById(name);return ctrl}function CreateControl(name){var ctrl=new CControl;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_anchor_left=g_anchor_left;window["AscCommon"].g_anchor_top=g_anchor_top;window["AscCommon"].g_anchor_right=g_anchor_right;window["AscCommon"].g_anchor_bottom=g_anchor_bottom;window["AscCommon"].CreateControlContainer=CreateControlContainer;window["AscCommon"].CreateControl=
|
||||
CreateControl})(window);"use strict";(function(window,undefined){var AscBrowser=AscCommon.AscBrowser;var TRACK_CIRCLE_RADIUS=5;var TRACK_RECT_SIZE2=4;var TRACK_RECT_SIZE=8;var TRACK_RECT_SIZE_CT=6;var TRACK_DISTANCE_ROTATE=25;var TRACK_DISTANCE_ROTATE2=25;var TRACK_ADJUSTMENT_SIZE=10;var TRACK_WRAPPOINTS_SIZE=6;var IMAGE_ROTATE_TRACK_W=21;var bIsUseImageRotateTrack=true;if(bIsUseImageRotateTrack){window.g_track_rotate_marker=new Image;window.g_track_rotate_marker;window.g_track_rotate_marker.asc_complete=
|
||||
false;window.g_track_rotate_marker.onload=function(){window.g_track_rotate_marker.asc_complete=true};window.g_track_rotate_marker.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAAVFBMVEUAAAD///////////////////////////////////////////////////////98fHy2trb09PTT09OysrKqqqqJiYng4ODr6+uamprGxsbi4uKGhoYjgM0eAAAADnRSTlMAy00k7/z0jbeuMzDljsugwZgAAACpSURBVBjTdZHbEoMgDESDAl6bgIqX9v//s67UYpm6D0xyYMImoaiuUr3pVdVRUtnwqaY8YaE5SRcfaPgqc+DSIh7WIGGaEVoUqRGN4oZlcDIiqYlaPjQz5CNu6cFJwLiuSO3nlLBDrKhn3l4rcnH4NcAdGd5EZMfCsoMFBxM6CD57G+u6vC48PMVnHtrYhP/x+7+3cw7zdJnD3cyA7QXa4nYXaW+a9Xdvb6zqE5Jb7LmzAAAAAElFTkSuQmCC";
|
||||
window.g_track_rotate_marker2=new Image;window.g_track_rotate_marker2;window.g_track_rotate_marker2.asc_complete=false;window.g_track_rotate_marker2.onload=function(){window.g_track_rotate_marker2.asc_complete=true};window.g_track_rotate_marker2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAeFBMVEUAAAD///////////////////////////////////////////////////////////////////////////+Tk5Obm5v8/PzAwMD5+fmWlpbt7e3k5OSfn5/z8/PLy8vn5+fExMSsrKyqqqrf39+vr6+9vb2urq7c3NxSmuRpAAAAE3RSTlMA+u2XA+PTrId4WBwTN7EKtLY4iqQP6AAAAWhJREFUOMudVe2SgjAMLN+goN51CxTLp3r3/m943BAqIJTR/RU6O02yTRY2g5tEgW9blu0HUeKyLRxDj0/ghcdVWuxYfAHLiV95B5uvwD4saK7DN+DMSj1f+CYu58l9J27A6XnnJG9R3ZWU6l4Vk+y6D310baHRXvUxdRSP/aYZILJbmebFLRNAlo69x7PEeQdZ5Xz8qiS6fJr8aOnEquATFApdSsr/v1HINUo+Q6nwoDDspfH4JmoJ6shzWcINaNBSlLCI6uvLfyXmAlR2xIKBB/A1ZKiGIGA+8QCtphBawRt+hsBnNvE0M0OPZmwcijRnFvE0U6CuIcbrIUlJRnJL9L0YifTQCgU3p/aH4I7fnWaCIajwMMszCl5A7Aj+TWctGuMT6qG4QtbGodBj9oAyjpke3LSDYXCXq9A8V6GZrsLGcqXlcrneW9elAQgpxdwA3rcUdv4ymdQHtrdvpPvW/LHZ7/8+/gBTWGFPbAkGiAAAAABJRU5ErkJggg==";
|
||||
TRACK_DISTANCE_ROTATE2=18}function COverlay(){this.m_oControl=null;this.m_oContext=null;this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535;this.m_bIsShow=false;this.m_bIsAlwaysUpdateOverlay=false;this.m_oHtmlPage=null;this.DashLineColor="#000000";this.ClearAll=false;this.IsRetina=false;this.IsCellEditor=false}COverlay.prototype={init:function(context,controlName,x,y,w_pix,h_pix,w_mm,h_mm){this.m_oContext=context;this.m_oControl=AscCommon.CreateControl(controlName);this.m_oHtmlPage=
|
||||
new AscCommon.CHtmlPage;this.m_oHtmlPage.init(x,y,w_pix,h_pix,w_mm,h_mm)},Clear:function(){if(null==this.m_oContext){this.m_oContext=this.m_oControl.HtmlElement.getContext("2d");this.m_oContext.imageSmoothingEnabled=false;this.m_oContext.mozImageSmoothingEnabled=false;this.m_oContext.oImageSmoothingEnabled=false;this.m_oContext.webkitImageSmoothingEnabled=false}this.SetBaseTransform();this.m_oContext.beginPath();if(this.max_x!=-65535&&this.max_y!=-65535)if(this.ClearAll===true){this.m_oContext.clearRect(0,
|
||||
|
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 51 KiB |
|
@ -266,13 +266,13 @@ editorType;this._isExcel=c_oEditorId.Spreadsheet===editorType;this._isPresentati
|
|||
docid;this.sockjs_url=AscCommon.getBaseUrl()+"../../../../doc/"+docid+"/c"};DocsCoApi.prototype.auth=function(isViewer,opt_openCmd,opt_isIdle){this._isViewer=isViewer;if(this._locks){this.ownedLockBlocks=[];for(var block in this._locks)if(this._locks.hasOwnProperty(block)){var lock=this._locks[block];if(lock["state"]===2)this.ownedLockBlocks.push(lock["blockValue"])}this._locks={}}this._send({"type":"auth","docid":this._docid,"documentCallbackUrl":this._documentCallbackUrl,"token":this._token,"user":{"id":this._user.asc_getId(),
|
||||
"username":this._user.asc_getUserName(),"firstname":this._user.asc_getFirstName(),"lastname":this._user.asc_getLastName(),"indexUser":this._indexUser},"editorType":this.editorType,"lastOtherSaveTime":this.lastOtherSaveTime,"block":this.ownedLockBlocks,"sessionId":this._id,"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,
|
||||
"mode":this.mode,"permissions":this.permissions,"encrypted":this.encrypted,"jwtOpen":this.jwtOpen,"jwtSession":this.jwtSession})};DocsCoApi.prototype._initSocksJs=function(){var t=this;var sockjs;sockjs=this.sockjs={};var send=function(data){setTimeout(function(){sockjs.onmessage({data:JSON.stringify(data)})})};var license={type:"license",license:{type:3,mode:0,rights:1,buildVersion:"5.2.6",buildNumber:2}};var channel;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,
|
||||
Util){var msgEv=Util.mkEvent();var p=window.parent;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);
|
||||
return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,
|
||||
false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);
|
||||
break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);
|
||||
break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=
|
||||
null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};
|
||||
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
|
||||
Util){var msgEv=Util.mkEvent();var p=window.parent;if(editor&&editor.isReporterMode){p=window.opener;window.parent=p}else window.APP=p&&p.APP;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=
|
||||
function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=
|
||||
JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);
|
||||
break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);
|
||||
break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=
|
||||
c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=
|
||||
null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
|
||||
(function(window){var CSpellCheckApi=function(){this._SpellCheckApi=new SpellCheckApi;this._onlineWork=false;this.onDisconnect=null;this.onSpellCheck=null};CSpellCheckApi.prototype.init=function(docid){if(this._SpellCheckApi&&this._SpellCheckApi.isRightURL()){var t=this;this._SpellCheckApi.onDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){t.callback_OnDisconnect(e,isDisconnectAtAll,isCloseCoAuthoring)};this._SpellCheckApi.onSpellCheck=function(e){t.callback_OnSpellCheck(e)};this._SpellCheckApi.onInit=
|
||||
function(e){t.callback_OnInit(e)};this._SpellCheckApi.init(docid);this._onlineWork=true}};CSpellCheckApi.prototype.set_url=function(url){if(this._SpellCheckApi)this._SpellCheckApi.set_url(url)};CSpellCheckApi.prototype.get_state=function(){if(this._SpellCheckApi)return this._SpellCheckApi.get_state();return 0};CSpellCheckApi.prototype.disconnect=function(){if(this._SpellCheckApi&&this._onlineWork)this._SpellCheckApi.disconnect()};CSpellCheckApi.prototype.spellCheck=function(spellCheckData){if(this._SpellCheckApi&&
|
||||
this._onlineWork)this._SpellCheckApi.spellCheck(spellCheckData)};CSpellCheckApi.prototype.checkDictionary=function(lang){if(this._SpellCheckApi&&this._onlineWork)return this._SpellCheckApi.checkDictionary(lang);return true};CSpellCheckApi.prototype.callback_OnSpellCheck=function(e){if(this.onSpellCheck)return this.onSpellCheck(e)};CSpellCheckApi.prototype.callback_OnInit=function(e){if(this.onInit)return this.onInit(e)};CSpellCheckApi.prototype.callback_OnDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){if(this.onDisconnect)return this.onDisconnect(e,
|
||||
|
@ -1356,62 +1356,62 @@ prot["Clock_Clockwise"]=c_oAscSlideTransitionParams.Clock_Clockwise;prot["Clock_
|
|||
prot["EditSelectAll"]=c_oAscPresentationShortcutType.EditSelectAll;prot["EditUndo"]=c_oAscPresentationShortcutType.EditUndo;prot["EditRedo"]=c_oAscPresentationShortcutType.EditRedo;prot["Cut"]=c_oAscPresentationShortcutType.Cut;prot["Copy"]=c_oAscPresentationShortcutType.Copy;prot["Paste"]=c_oAscPresentationShortcutType.Paste;prot["Duplicate"]=c_oAscPresentationShortcutType.Duplicate;prot["Print"]=c_oAscPresentationShortcutType.Print;prot["Save"]=c_oAscPresentationShortcutType.Save;
|
||||
prot["ShowContextMenu"]=c_oAscPresentationShortcutType.ShowContextMenu;window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].c_oSerFormat=c_oSerFormat;window["AscCommon"].CurFileVersion=c_oSerFormat.Version;"use strict";
|
||||
(function(window,undefined){var FOREIGN_CURSOR_LABEL_HIDETIME=1500;function CCollaborativeChanges(){this.m_pData=null;this.m_oColor=null}CCollaborativeChanges.prototype.Set_Data=function(pData){this.m_pData=pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=
|
||||
function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);
|
||||
return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;
|
||||
break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&
|
||||
16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;
|
||||
return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId=
|
||||
{};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=
|
||||
[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=
|
||||
function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index<Len;Index++)if(this.m_aUsers[Index]===
|
||||
UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=
|
||||
function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();
|
||||
this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];
|
||||
Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=
|
||||
function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=
|
||||
function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+
|
||||
sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);
|
||||
this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};
|
||||
CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=
|
||||
Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=
|
||||
function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===
|
||||
this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};
|
||||
CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=
|
||||
function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<
|
||||
Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=
|
||||
Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=
|
||||
function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();
|
||||
editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,
|
||||
UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=
|
||||
function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=
|
||||
function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,
|
||||
Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};
|
||||
CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};
|
||||
CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);
|
||||
if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);
|
||||
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);
|
||||
if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);
|
||||
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=
|
||||
function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=
|
||||
function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>
|
||||
0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=
|
||||
this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=
|
||||
0,nCount=arrChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();
|
||||
if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];
|
||||
var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
|
||||
oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;
|
||||
else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=
|
||||
0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=
|
||||
oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=
|
||||
oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>
|
||||
-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof
|
||||
AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=
|
||||
oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=
|
||||
[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,
|
||||
{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);
|
||||
arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};
|
||||
CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=
|
||||
this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
|
||||
function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;if(this.m_pData&&this.m_pData.type==="cp_theme"){clearTimeout(window.CP_theme_to);var data=this.m_pData;window.CP_theme_to=setTimeout(function(){window.parent.APP.remoteTheme();window.editor.ChangeTheme(data.id,null,true)});return true}var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;var nReaderPos=Reader.GetCurPos();var nChangesType=
|
||||
Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=function(szSrc){return this.GetStream(szSrc,
|
||||
0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index<srcLen){var dwCurr=0;var i;var nBits=
|
||||
0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=
|
||||
0;i<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=
|
||||
0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=
|
||||
[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=
|
||||
function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};
|
||||
CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index<Len;Index++)if(this.m_aUsers[Index]===UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};
|
||||
CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();
|
||||
editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;
|
||||
for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};
|
||||
CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=
|
||||
0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=
|
||||
aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);
|
||||
return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=
|
||||
function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=
|
||||
function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=
|
||||
0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=
|
||||
false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=
|
||||
sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);
|
||||
Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=
|
||||
function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};
|
||||
CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=
|
||||
function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses=
|
||||
{};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=
|
||||
this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};
|
||||
CCollaborativeEditingBase.prototype.Add_ForeignCursor=function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};
|
||||
CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,
|
||||
Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=
|
||||
function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate=
|
||||
{}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();
|
||||
if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);
|
||||
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);
|
||||
if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);
|
||||
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=
|
||||
function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=
|
||||
Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=
|
||||
this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-
|
||||
1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=
|
||||
this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=0,nCount=arrChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,
|
||||
nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides=
|
||||
{};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=
|
||||
oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||
|
||||
oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||
|
||||
oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();
|
||||
if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());
|
||||
else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=
|
||||
mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof
|
||||
AscCommonWord.CDocument||oTable.Parent instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,
|
||||
1)}nContentLen=oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;
|
||||
var aSendingChanges=[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,
|
||||
oReverseChange,{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});
|
||||
aSendingChanges.push(oChange.m_pData);arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();
|
||||
oLogicDocument.Document_UpdateRulersState()};CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=
|
||||
this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
|
||||
oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;
|
||||
else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=
|
||||
[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
|
||||
|
@ -1529,39 +1529,39 @@ function(){};baseEditorsApi.prototype._downloadAs=function(){};baseEditorsApi.pr
|
|||
actionType===c_oAscAsyncAction.Print?DownloadType.Print:DownloadType.Download;else downloadType=DownloadType.None;var isNoBase64=typeof ArrayBuffer!=="undefined"&&!isCloudCrypto;var dataContainer={data:null,part:null,index:0,count:0};var oAdditionalData={};oAdditionalData["c"]="save";oAdditionalData["id"]=this.documentId;oAdditionalData["userid"]=this.documentUserId;oAdditionalData["tokenSession"]=this.CoAuthoringApi.get_jwt();oAdditionalData["outputformat"]=options.fileType;oAdditionalData["title"]=
|
||||
AscCommon.changeFileExtention(this.documentTitle,AscCommon.getExtentionByFormat(options.fileType),Asc.c_nMaxDownloadTitleLen);oAdditionalData["nobase64"]=isNoBase64;if(DownloadType.Print===downloadType)oAdditionalData["inline"]=1;if(this._downloadAs(actionType,options,oAdditionalData,dataContainer))return;var t=this;this.fCurCallback=null;if(!options.callback)this.fCurCallback=function(input,status){var error=403===status?c_oAscError.ID.AccessDeny:c_oAscError.ID.Unknown;if(null!=input&&oAdditionalData["c"]===
|
||||
input["type"])if("ok"===input["status"]){var url=input["data"];if(url){error=c_oAscError.ID.No;t.processSavedFile(url,downloadType)}}else error=AscCommon.mapAscServerErrorToAscError(parseInt(input["data"]),AscCommon.c_oAscAdvancedOptionsAction.Save);if(c_oAscError.ID.No!==error){t.endInsertDocumentUrls();t.sendEvent("asc_onError",options.errorDirect||error,c_oAscError.Level.NoCritical)}if(actionType)t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType)};if(window.parent.APP.printPdf&&
|
||||
(DownloadType.Print===downloadType||!downloadType)){window.parent.APP.printPdf(dataContainer,options.callback||this.fCurCallback);return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=
|
||||
function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};
|
||||
baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});
|
||||
return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=
|
||||
this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};
|
||||
baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);
|
||||
var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},
|
||||
this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&
|
||||
AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);
|
||||
var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,
|
||||
sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=
|
||||
function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);
|
||||
else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};
|
||||
baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,
|
||||
options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};
|
||||
baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=
|
||||
function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=
|
||||
function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();
|
||||
if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;
|
||||
var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;
|
||||
var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};
|
||||
baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();
|
||||
var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name<b.name)return-1;
|
||||
return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",
|
||||
this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;
|
||||
pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=
|
||||
transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,
|
||||
extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,
|
||||
plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};
|
||||
baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=
|
||||
function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&
|
||||
c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};
|
||||
baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
|
||||
(DownloadType.Print===downloadType||!downloadType)){var _cb=options.callback||this.fCurCallback;window.parent.APP.printPdf(dataContainer,function(obj){if(!obj){t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType);return}_cb(obj)});return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=
|
||||
function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=
|
||||
elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");
|
||||
t.asc_addImageCallback(res);t._addImageUrl([res.url],obj)},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,
|
||||
c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);
|
||||
else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=
|
||||
function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&
|
||||
data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=
|
||||
oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=
|
||||
function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,
|
||||
function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=
|
||||
value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;
|
||||
if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<
|
||||
newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&
|
||||
this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=
|
||||
false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==
|
||||
0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&
|
||||
this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();
|
||||
this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};
|
||||
baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,
|
||||
function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};
|
||||
baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};
|
||||
baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);
|
||||
aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name<b.name)return-1;return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());
|
||||
var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;
|
||||
if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=
|
||||
this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,
|
||||
_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&
|
||||
true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};
|
||||
baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};
|
||||
baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);
|
||||
this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();
|
||||
this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
|
||||
baseEditorsApi.prototype.asc_nativeInitBuilder=function(){AscCommon.History.TurnOff();this.asc_setDocInfo(new Asc.asc_CDocInfo)};baseEditorsApi.prototype.asc_SetSilentMode=function(){};baseEditorsApi.prototype.asc_canPaste=function(){return false};baseEditorsApi.prototype.asc_Recalculate=function(){};baseEditorsApi.prototype["asc_nativeCheckPdfRenderer"]=function(_memory1,_memory2){if(true){_memory1.Copy=_memory1["Copy"];_memory1.ClearNoAttack=_memory1["ClearNoAttack"];_memory1.WriteByte=_memory1["WriteByte"];
|
||||
_memory1.WriteBool=_memory1["WriteBool"];_memory1.WriteLong=_memory1["WriteLong"];_memory1.WriteDouble=_memory1["WriteDouble"];_memory1.WriteString=_memory1["WriteString"];_memory1.WriteString2=_memory1["WriteString2"];_memory2.Copy=_memory1["Copy"];_memory2.ClearNoAttack=_memory1["ClearNoAttack"];_memory2.WriteByte=_memory1["WriteByte"];_memory2.WriteBool=_memory1["WriteBool"];_memory2.WriteLong=_memory1["WriteLong"];_memory2.WriteDouble=_memory1["WriteDouble"];_memory2.WriteString=_memory1["WriteString"];
|
||||
_memory2.WriteString2=_memory1["WriteString2"]}var _printer=new AscCommon.CDocumentRenderer;_printer.Memory=_memory1;_printer.VectorMemoryForPrint=_memory2;return _printer};baseEditorsApi.prototype.Begin_CompositeInput=function(){};baseEditorsApi.prototype.Add_CompositeText=function(nCharCode){};baseEditorsApi.prototype.Remove_CompositeText=function(nCount){};baseEditorsApi.prototype.Replace_CompositeText=function(arrCharCodes){};baseEditorsApi.prototype.Set_CursorPosInCompositeText=function(nPos){};
|
||||
|
@ -1993,10 +1993,10 @@ true;var ret=editor.WordControl.onKeyDown(e);editor.WordControl.IsFocus=false;re
|
|||
if(null!=this.WordControl.m_oLogicDocument)this.WordControl.m_oLogicDocument.viewMode=true}else{this.WordControl.checkNeedRules();this.WordControl.m_oDrawingDocument.ClearCachePages();this.WordControl.OnResize(true);if(null!=this.WordControl.m_oLogicDocument)this.WordControl.m_oLogicDocument.viewMode=false}};asc_docs_api.prototype.sync_HyperlinkClickCallback=function(Url){var indAction=Url.indexOf("ppaction://hlink");if(0==indAction){if(Url=="ppaction://hlinkshowjump?jump=firstslide")this.WordControl.GoToPage(0);
|
||||
else if(Url=="ppaction://hlinkshowjump?jump=lastslide")this.WordControl.GoToPage(this.WordControl.m_oDrawingDocument.SlidesCount-1);else if(Url=="ppaction://hlinkshowjump?jump=nextslide")this.WordControl.onNextPage();else if(Url=="ppaction://hlinkshowjump?jump=previousslide")this.WordControl.onPrevPage();else{var mask="ppaction://hlinksldjumpslide";var indSlide=Url.indexOf(mask);if(0==indSlide){var slideNum=parseInt(Url.substring(mask.length));if(slideNum>=0&&slideNum<this.WordControl.m_oDrawingDocument.SlidesCount)this.WordControl.GoToPage(slideNum)}}return}this.sendEvent("asc_onHyperlinkClick",
|
||||
Url)};asc_docs_api.prototype.asc_GoToInternalHyperlink=function(url){for(var i=0;i<this.SelectedObjectsStack.length;++i)if(this.SelectedObjectsStack[i].Type===c_oAscTypeSelectElement.Hyperlink){var oHyperProp=this.SelectedObjectsStack[i].Value;if(typeof oHyperProp.Value==="string"&&oHyperProp.Value.indexOf("ppaction://hlink")===0)this.sync_HyperlinkClickCallback(oHyperProp.Value);return}};asc_docs_api.prototype.UpdateInterfaceState=function(){if(this.WordControl.m_oLogicDocument!=null){this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
|
||||
this.WordControl.CheckLayouts(true)}};asc_docs_api.prototype.OnMouseUp=function(x,y){var _e=AscCommon.CreateMouseUpEventObject(x,y);AscCommon.Window_OnMouseUp(_e)};asc_docs_api.prototype.asyncImageEndLoaded2=null;asc_docs_api.prototype.ChangeTheme=function(indexTheme,bSelectedSlides){if(true===AscCommon.CollaborativeEditing.Get_GlobalLock())return;if(!this.isViewMode&&this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Theme)===false){AscCommon.CollaborativeEditing.Set_GlobalLock(true);
|
||||
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Presentation_ChangeTheme);this.bSelectedSlidesTheme=bSelectedSlides===true;this.ThemeLoader.StartLoadTheme(indexTheme)}};asc_docs_api.prototype.StartLoadTheme=function(){};asc_docs_api.prototype.EndLoadTheme=function(theme_load_info){AscCommon.CollaborativeEditing.Set_GlobalLock(false);var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();this.WordControl.m_oLogicDocument.changeTheme(theme_load_info,_array.length<=
|
||||
1&&!this.bSelectedSlidesTheme?null:_array);this.WordControl.ThemeGenerateThumbnails(theme_load_info.Master);this.WordControl.CheckLayouts();this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.LoadTheme)};asc_docs_api.prototype.ChangeLayout=function(layout_index){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,layout_index)};asc_docs_api.prototype.ResetSlide=
|
||||
function(){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,undefined)};asc_docs_api.prototype.put_ShapesAlign=function(type,alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.shapes_alignLeft(alignType);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.shapes_alignRight(alignType);
|
||||
this.WordControl.CheckLayouts(true)}};asc_docs_api.prototype.OnMouseUp=function(x,y){var _e=AscCommon.CreateMouseUpEventObject(x,y);AscCommon.Window_OnMouseUp(_e)};asc_docs_api.prototype.asyncImageEndLoaded2=null;asc_docs_api.prototype.ChangeTheme=function(indexTheme,bSelectedSlides,isRemote){if(window.parent&&window.parent.APP&&!isRemote&&!bSelectedSlides)window.parent.APP.changeTheme(indexTheme);if(true===AscCommon.CollaborativeEditing.Get_GlobalLock())return;if(!this.isViewMode&&this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Theme)===
|
||||
false){AscCommon.CollaborativeEditing.Set_GlobalLock(true);this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Presentation_ChangeTheme);this.bSelectedSlidesTheme=bSelectedSlides===true;this.ThemeLoader.StartLoadTheme(indexTheme)}};asc_docs_api.prototype.StartLoadTheme=function(){};asc_docs_api.prototype.EndLoadTheme=function(theme_load_info){AscCommon.CollaborativeEditing.Set_GlobalLock(false);var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();this.WordControl.m_oLogicDocument.changeTheme(theme_load_info,
|
||||
_array.length<=1&&!this.bSelectedSlidesTheme?null:_array);this.WordControl.ThemeGenerateThumbnails(theme_load_info.Master);this.WordControl.CheckLayouts();this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.LoadTheme)};asc_docs_api.prototype.ChangeLayout=function(layout_index){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,layout_index)};
|
||||
asc_docs_api.prototype.ResetSlide=function(){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,undefined)};asc_docs_api.prototype.put_ShapesAlign=function(type,alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.shapes_alignLeft(alignType);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.shapes_alignRight(alignType);
|
||||
break}case c_oAscAlignShapeType.ALIGN_TOP:{this.shapes_alignTop(alignType);break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{this.shapes_alignBottom(alignType);break}case c_oAscAlignShapeType.ALIGN_CENTER:{this.shapes_alignCenter(alignType);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{this.shapes_alignMiddle(alignType);break}default:break}};asc_docs_api.prototype.DistributeHorizontally=function(alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;this.WordControl.m_oLogicDocument.distributeHor(alignType)};
|
||||
asc_docs_api.prototype.DistributeVertically=function(alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;this.WordControl.m_oLogicDocument.distributeVer(alignType)};asc_docs_api.prototype.shapes_alignLeft=function(alignType){this.WordControl.m_oLogicDocument.alignLeft(alignType)};asc_docs_api.prototype.shapes_alignRight=function(alignType){this.WordControl.m_oLogicDocument.alignRight(alignType)};asc_docs_api.prototype.shapes_alignTop=function(alignType){this.WordControl.m_oLogicDocument.alignTop(alignType)};
|
||||
asc_docs_api.prototype.shapes_alignBottom=function(alignType){this.WordControl.m_oLogicDocument.alignBottom(alignType)};asc_docs_api.prototype.shapes_alignCenter=function(alignType){this.WordControl.m_oLogicDocument.alignCenter(alignType)};asc_docs_api.prototype.shapes_alignMiddle=function(alignType){this.WordControl.m_oLogicDocument.alignMiddle(alignType)};asc_docs_api.prototype.shapes_bringToFront=function(){this.WordControl.m_oLogicDocument.bringToFront()};asc_docs_api.prototype.shapes_bringForward=
|
||||
|
@ -2004,23 +2004,25 @@ function(){this.WordControl.m_oLogicDocument.bringForward()};asc_docs_api.protot
|
|||
function(slideNum){this.sendEvent("asc_onDemonstrationSlideChanged",slideNum)};asc_docs_api.prototype.StartDemonstration=function(div_id,slidestart_num,reporterStartObject){if(window.g_asc_plugins)window.g_asc_plugins.stopWorked();var is_reporter=reporterStartObject&&!this.isReporterMode;if(is_reporter)this.DemonstrationReporterStart(reporterStartObject);if(is_reporter&&(this.reporterWindow||window["AscDesktopEditor"]))this.WordControl.DemonstrationManager.StartWaitReporter(div_id,slidestart_num,
|
||||
true);else this.WordControl.DemonstrationManager.Start(div_id,slidestart_num,true);if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=this.EndShowMessage;this.EndShowMessage=undefined}};asc_docs_api.prototype.EndDemonstration=function(isNoUseFullScreen){if(this.windowReporter)this.windowReporter.close();this.WordControl.DemonstrationManager.End(isNoUseFullScreen)};asc_docs_api.prototype.DemonstrationReporterStart=function(startObject){this.reporterStartObject=
|
||||
startObject;this.reporterStartObject["translate"]=AscCommon.translateManager.mapTranslate;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["startReporter"](window.location.href);this.reporterWindow={};return}var dualScreenLeft=window.screenLeft!=undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!=undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;
|
||||
var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var w=800;var h=600;var left=width/2-w/2+dualScreenLeft;var top=height/2-h/2+dualScreenTop;var _windowPos="width="+w+",height="+h+",left="+left+",top="+top;var _url="index.reporter.html";if(this.locale)_url+="?lang="+this.locale;this.reporterWindow=window.open(_url,"_blank","resizable=yes,status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=0,"+_windowPos);
|
||||
if(!this.reporterWindow)return;this.reporterWindowCounter=0;if(!AscCommon.AscBrowser.isSafariMacOs)this.reporterWindow.onbeforeunload=function(){window.editor.EndDemonstration()};this.reporterWindow.onunload=function(){window.editor.reporterWindowCounter++;if(1<window.editor.reporterWindowCounter)window.editor.EndDemonstration()};if(this.reporterWindow.attachEvent)this.reporterWindow.attachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.addEventListener("message",this.DemonstrationReporterMessages,
|
||||
false)};asc_docs_api.prototype.DemonstrationReporterEnd=function(){if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["endReporter"]();this.reporterWindow=null;return}try{this.reporterWindowCounter=0;if(!this.reporterWindow)return;if(this.reporterWindow.attachEvent)this.reporterWindow.detachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.removeEventListener("message",this.DemonstrationReporterMessages,false);this.reporterWindow.close();this.reporterWindow=null;
|
||||
this.reporterStartObject=null}catch(err){this.reporterWindow=null;this.reporterStartObject=null}};asc_docs_api.prototype.DemonstrationReporterMessages=function(e){var _this=window.editor;if(e.data=="i:am:ready"){var _msg_={type:"file:open",data:_this.reporterStartObject};if(AscCommon.EncryptionWorker.isPasswordCryptoPresent){_msg_.data["cryptoCurrentPassword"]=this.currentPassword;_msg_.data["cryptoCurrentDocumentHash"]=this.currentDocumentHash;_msg_.data["cryptoCurrentDocumentInfo"]=this.currentDocumentInfo}this.reporterStartObject=
|
||||
null;_this.sendToReporter(JSON.stringify(_msg_));return}try{var _obj=JSON.parse(e.data);if(undefined==_obj["reporter_command"])return;switch(_obj["reporter_command"]){case "end":{_this.EndDemonstration();break}case "next":{_this.WordControl.DemonstrationManager.NextSlide();break}case "prev":{_this.WordControl.DemonstrationManager.PrevSlide();break}case "go_to_slide":{_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);break}case "start_show":{_this.WordControl.DemonstrationManager.EndWaitReporter();
|
||||
break}case "pointer_move":{_this.WordControl.DemonstrationManager.PointerMove(_obj["x"],_obj["y"],_obj["w"],_obj["h"]);break}case "pointer_remove":{_this.WordControl.DemonstrationManager.PointerRemove();break}case "pause":{_this.WordControl.DemonstrationManager.Pause();_this.sendEvent("asc_onDemonstrationStatus","pause");break}case "play":{_this.WordControl.DemonstrationManager.Play();_this.sendEvent("asc_onDemonstrationStatus","play");break}case "resize":{_this.WordControl.DemonstrationManager.Resize(true);
|
||||
break}default:break}}catch(err){}};asc_docs_api.prototype.preloadReporter=function(data){if(data["translate"])this.translateManager=AscCommon.translateManager.init(data["translate"]);this.reporterTranslates=[data["translations"]["reset"],data["translations"]["slideOf"],data["translations"]["endSlideshow"],data["translations"]["finalMessage"]];if(data["cryptoCurrentPassword"]){this.currentPassword=data["cryptoCurrentPassword"];this.currentDocumentHash=data["cryptoCurrentDocumentHash"];this.currentDocumentInfo=
|
||||
data["cryptoCurrentDocumentInfo"];if(this.pluginsManager)this.pluginsManager.checkCryptoReporter();else this.isCheckCryptoReporter=true}this.asc_registerCallback("asc_onHyperlinkClick",function(url){if(url)window.open(url)});if(!this.WordControl)return;this.WordControl.reporterTranslates=this.reporterTranslates;this.WordControl.DemonstrationManager.EndShowMessage=this.reporterTranslates[3];var _button1=document.getElementById("dem_id_reset");var _button2=document.getElementById("dem_id_end");if(_button1)_button1.innerHTML=
|
||||
this.reporterTranslates[0];if(_button2){_button2.innerHTML=this.reporterTranslates[2];this.WordControl.OnResizeReporter()}};asc_docs_api.prototype.sendToReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendToReporter"](value);return}if(this.reporterWindow)this.reporterWindow.postMessage(value,"*")};asc_docs_api.prototype.sendFromReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendFromReporter"](value);
|
||||
return}window.postMessage(value,"*")};asc_docs_api.prototype.DemonstrationToReporterMessages=function(e){var _this=window.editor;try{var _obj=JSON.parse(e.data);if(window["AscDesktopEditor"]&&_obj["type"]=="file:open"){window.postMessage(e.data,"*");return}if(undefined==_obj["main_command"])return;if(undefined!==_obj["keyCode"])_this.WordControl.DemonstrationManager.onKeyDownCode(_obj["keyCode"]);else if(undefined!==_obj["mouseUp"])_this.WordControl.DemonstrationManager.onMouseUp({},true,true);else if(undefined!==
|
||||
_obj["mouseWhell"])_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);else if(undefined!==_obj["resize"])_this.WordControl.DemonstrationManager.Resize(true);else if(true===_obj["next"])_this.WordControl.DemonstrationManager.NextSlide(true);else if(true===_obj["prev"])_this.WordControl.DemonstrationManager.PrevSlide(true);else if(undefined!==_obj["go_to_slide"])_this.WordControl.DemonstrationManager.GoToSlide(_obj["go_to_slide"],true);else if(true===_obj["play"]){var _isNowPlaying=
|
||||
_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Play(true);var _elem=document.getElementById("dem_id_play_span");if(_elem&&!_isNowPlaying){_elem.classList.remove("btn-play");_elem.classList.add("btn-pause");_this.WordControl.reporterTimerLastStart=(new Date).getTime();_this.WordControl.reporterTimer=setInterval(_this.WordControl.reporterTimerFunc,1E3)}}else if(true===_obj["pause"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Pause();
|
||||
var _elem=document.getElementById("dem_id_play_span");if(_elem&&_isNowPlaying){_elem.classList.remove("btn-pause");_elem.classList.add("btn-play");if(-1!=_this.WordControl.reporterTimer){clearInterval(_this.WordControl.reporterTimer);_this.WordControl.reporterTimer=-1}_this.WordControl.reporterTimerAdd=_this.WordControl.reporterTimerFunc(true)}}}catch(err){}};asc_docs_api.prototype.DemonstrationPlay=function(){if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=
|
||||
this.EndShowMessage;this.EndShowMessage=undefined}this.WordControl.DemonstrationManager.Play(true);if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "play" : true }')};asc_docs_api.prototype.DemonstrationPause=function(){this.WordControl.DemonstrationManager.Pause();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "pause" : true }')};asc_docs_api.prototype.DemonstrationEndShowMessage=function(message){if(!this.WordControl)this.EndShowMessage=message;else this.WordControl.DemonstrationManager.EndShowMessage=
|
||||
message};asc_docs_api.prototype.DemonstrationNextSlide=function(){this.WordControl.DemonstrationManager.NextSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "next" : true }')};asc_docs_api.prototype.DemonstrationPrevSlide=function(){this.WordControl.DemonstrationManager.PrevSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "prev" : true }')};asc_docs_api.prototype.DemonstrationGoToSlide=function(slideNum){this.WordControl.DemonstrationManager.GoToSlide(slideNum);
|
||||
if(this.isReporterMode)this.sendFromReporter('{ "reporter_command" : "go_to_slide", "slide" : '+slideNum+" }");if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "go_to_slide" : '+slideNum+" }")};asc_docs_api.prototype.SetDemonstrationModeOnly=function(){this.isOnlyDemonstration=true};asc_docs_api.prototype.ApplySlideTiming=function(oTiming){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming)===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTiming);
|
||||
var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i<aSelectedSlides.length;++i){var _curSlide=this.WordControl.m_oLogicDocument.Slides[aSelectedSlides[i]];_curSlide.applyTiming(oTiming)}if(oTiming)if(AscFormat.isRealBool(oTiming.get_ShowLoop())&&oTiming.get_ShowLoop()!==this.WordControl.m_oLogicDocument.isLoopShowMode())this.WordControl.m_oLogicDocument.setShowLoop(oTiming.get_ShowLoop())}this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState()};
|
||||
var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var w=800;var h=600;var left=width/2-w/2+dualScreenLeft;var top=height/2-h/2+dualScreenTop;var _windowPos="width="+w+",height="+h+",left="+left+",top="+top;var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||"";var _url="index.reporter.html?"+urlArgs;if(this.locale)_url+="&lang="+this.locale;this.reporterWindow=window.open(_url,"_blank","resizable=yes,status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=0,"+
|
||||
_windowPos);if(!this.reporterWindow)return;var w=this.reporterWindow;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,Util){var msgEv=Util.mkEvent();window.addEventListener("message",function(msg){if(msg.source!==w)return;msgEv.fire(msg)});var postMsg=function(data){w.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){var send=function(obj){chan.event("CMD",obj)};chan.on("CMD",function(obj){if(obj.type!=="auth")return;send({type:"authChanges",changes:[]});
|
||||
send({type:"auth",result:1,sessionId:"06348ca8f861a0af3548ae38360aa617",participants:[],locks:[],changes:[],changesIndex:0,indexUser:0,buildVersion:"5.2.6",buildNumber:2,licenseType:3});send({type:"documentOpen",data:{"type":"open","status":"ok","data":{"Editor.bin":editor.reporterStartObject.url}}})})})});this.reporterWindowCounter=0;if(!AscCommon.AscBrowser.isSafariMacOs)this.reporterWindow.onbeforeunload=function(){window.editor.EndDemonstration()};this.reporterWindow.onunload=function(){window.editor.reporterWindowCounter++;
|
||||
if(1<window.editor.reporterWindowCounter)window.editor.EndDemonstration()};if(this.reporterWindow.attachEvent)this.reporterWindow.attachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.addEventListener("message",this.DemonstrationReporterMessages,false)};asc_docs_api.prototype.DemonstrationReporterEnd=function(){if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["endReporter"]();this.reporterWindow=null;return}try{this.reporterWindowCounter=0;if(!this.reporterWindow)return;
|
||||
if(this.reporterWindow.attachEvent)this.reporterWindow.detachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.removeEventListener("message",this.DemonstrationReporterMessages,false);this.reporterWindow.close();this.reporterWindow=null;this.reporterStartObject=null}catch(err){this.reporterWindow=null;this.reporterStartObject=null}};asc_docs_api.prototype.DemonstrationReporterMessages=function(e){var _this=window.editor;if(e.data=="i:am:ready"){var bin=editor.asc_nativeGetFile();
|
||||
var blob=new Blob([bin],{type:"plain/text"});var url=URL.createObjectURL(blob);_this.reporterStartObject.url=url;var _msg_={type:"file:open",data:_this.reporterStartObject};if(AscCommon.EncryptionWorker.isPasswordCryptoPresent){_msg_.data["cryptoCurrentPassword"]=this.currentPassword;_msg_.data["cryptoCurrentDocumentHash"]=this.currentDocumentHash;_msg_.data["cryptoCurrentDocumentInfo"]=this.currentDocumentInfo}this.reporterStartObject=null;_this.sendToReporter(JSON.stringify(_msg_));return}try{var _obj=
|
||||
JSON.parse(e.data);if(undefined==_obj["reporter_command"])return;switch(_obj["reporter_command"]){case "end":{_this.EndDemonstration();break}case "next":{_this.WordControl.DemonstrationManager.NextSlide();break}case "prev":{_this.WordControl.DemonstrationManager.PrevSlide();break}case "go_to_slide":{_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);break}case "start_show":{_this.WordControl.DemonstrationManager.EndWaitReporter();break}case "pointer_move":{_this.WordControl.DemonstrationManager.PointerMove(_obj["x"],
|
||||
_obj["y"],_obj["w"],_obj["h"]);break}case "pointer_remove":{_this.WordControl.DemonstrationManager.PointerRemove();break}case "pause":{_this.WordControl.DemonstrationManager.Pause();_this.sendEvent("asc_onDemonstrationStatus","pause");break}case "play":{_this.WordControl.DemonstrationManager.Play();_this.sendEvent("asc_onDemonstrationStatus","play");break}case "resize":{_this.WordControl.DemonstrationManager.Resize(true);break}default:break}}catch(err){}};asc_docs_api.prototype.preloadReporter=function(data){if(data["translate"])this.translateManager=
|
||||
AscCommon.translateManager.init(data["translate"]);this.reporterTranslates=[data["translations"]["reset"],data["translations"]["slideOf"],data["translations"]["endSlideshow"],data["translations"]["finalMessage"]];if(data["cryptoCurrentPassword"]){this.currentPassword=data["cryptoCurrentPassword"];this.currentDocumentHash=data["cryptoCurrentDocumentHash"];this.currentDocumentInfo=data["cryptoCurrentDocumentInfo"];if(this.pluginsManager)this.pluginsManager.checkCryptoReporter();else this.isCheckCryptoReporter=
|
||||
true}this.asc_registerCallback("asc_onHyperlinkClick",function(url){if(url)window.open(url)});if(!this.WordControl)return;this.WordControl.reporterTranslates=this.reporterTranslates;this.WordControl.DemonstrationManager.EndShowMessage=this.reporterTranslates[3];var _button1=document.getElementById("dem_id_reset");var _button2=document.getElementById("dem_id_end");if(_button1)_button1.innerHTML=this.reporterTranslates[0];if(_button2){_button2.innerHTML=this.reporterTranslates[2];this.WordControl.OnResizeReporter()}};
|
||||
asc_docs_api.prototype.sendToReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendToReporter"](value);return}if(this.reporterWindow)this.reporterWindow.postMessage(value,"*")};asc_docs_api.prototype.sendFromReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendFromReporter"](value);return}window.postMessage(value,"*")};asc_docs_api.prototype.DemonstrationToReporterMessages=
|
||||
function(e){var _this=window.editor;try{var _obj=JSON.parse(e.data);if(window["AscDesktopEditor"]&&_obj["type"]=="file:open"){window.postMessage(e.data,"*");return}if(undefined==_obj["main_command"])return;if(undefined!==_obj["keyCode"])_this.WordControl.DemonstrationManager.onKeyDownCode(_obj["keyCode"]);else if(undefined!==_obj["mouseUp"])_this.WordControl.DemonstrationManager.onMouseUp({},true,true);else if(undefined!==_obj["mouseWhell"])_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);
|
||||
else if(undefined!==_obj["resize"])_this.WordControl.DemonstrationManager.Resize(true);else if(true===_obj["next"])_this.WordControl.DemonstrationManager.NextSlide(true);else if(true===_obj["prev"])_this.WordControl.DemonstrationManager.PrevSlide(true);else if(undefined!==_obj["go_to_slide"])_this.WordControl.DemonstrationManager.GoToSlide(_obj["go_to_slide"],true);else if(true===_obj["play"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Play(true);
|
||||
var _elem=document.getElementById("dem_id_play_span");if(_elem&&!_isNowPlaying){_elem.classList.remove("btn-play");_elem.classList.add("btn-pause");_this.WordControl.reporterTimerLastStart=(new Date).getTime();_this.WordControl.reporterTimer=setInterval(_this.WordControl.reporterTimerFunc,1E3)}}else if(true===_obj["pause"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Pause();var _elem=document.getElementById("dem_id_play_span");if(_elem&&
|
||||
_isNowPlaying){_elem.classList.remove("btn-pause");_elem.classList.add("btn-play");if(-1!=_this.WordControl.reporterTimer){clearInterval(_this.WordControl.reporterTimer);_this.WordControl.reporterTimer=-1}_this.WordControl.reporterTimerAdd=_this.WordControl.reporterTimerFunc(true)}}}catch(err){}};asc_docs_api.prototype.DemonstrationPlay=function(){if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=this.EndShowMessage;this.EndShowMessage=undefined}this.WordControl.DemonstrationManager.Play(true);
|
||||
if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "play" : true }')};asc_docs_api.prototype.DemonstrationPause=function(){this.WordControl.DemonstrationManager.Pause();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "pause" : true }')};asc_docs_api.prototype.DemonstrationEndShowMessage=function(message){if(!this.WordControl)this.EndShowMessage=message;else this.WordControl.DemonstrationManager.EndShowMessage=message};asc_docs_api.prototype.DemonstrationNextSlide=
|
||||
function(){this.WordControl.DemonstrationManager.NextSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "next" : true }')};asc_docs_api.prototype.DemonstrationPrevSlide=function(){this.WordControl.DemonstrationManager.PrevSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "prev" : true }')};asc_docs_api.prototype.DemonstrationGoToSlide=function(slideNum){this.WordControl.DemonstrationManager.GoToSlide(slideNum);if(this.isReporterMode)this.sendFromReporter('{ "reporter_command" : "go_to_slide", "slide" : '+
|
||||
slideNum+" }");if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "go_to_slide" : '+slideNum+" }")};asc_docs_api.prototype.SetDemonstrationModeOnly=function(){this.isOnlyDemonstration=true};asc_docs_api.prototype.ApplySlideTiming=function(oTiming){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming)===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTiming);var _count=this.WordControl.m_oDrawingDocument.SlidesCount;
|
||||
var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i<aSelectedSlides.length;++i){var _curSlide=this.WordControl.m_oLogicDocument.Slides[aSelectedSlides[i]];_curSlide.applyTiming(oTiming)}if(oTiming)if(AscFormat.isRealBool(oTiming.get_ShowLoop())&&oTiming.get_ShowLoop()!==this.WordControl.m_oLogicDocument.isLoopShowMode())this.WordControl.m_oLogicDocument.setShowLoop(oTiming.get_ShowLoop())}this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState()};
|
||||
asc_docs_api.prototype.SlideTimingApplyToAll=function(){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming,{All:true})===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTimingToAll);var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;var _slides=this.WordControl.m_oLogicDocument.Slides;if(_cur<0||_cur>=_count)return;var _curSlide=_slides[_cur];_curSlide.timing.makeDuplicate(this.WordControl.m_oLogicDocument.DefaultSlideTiming);
|
||||
var _default=this.WordControl.m_oLogicDocument.DefaultSlideTiming;for(var i=0;i<_count;i++){if(i==_cur)continue;_slides[i].applyTiming(_default)}}};asc_docs_api.prototype.SlideTransitionPlay=function(){var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var _timing=this.WordControl.m_oLogicDocument.Slides[_cur].timing;var _tr=this.WordControl.m_oDrawingDocument.TransitionSlide;_tr.Type=_timing.TransitionType;
|
||||
_tr.Param=_timing.TransitionOption;_tr.Duration=_timing.TransitionDuration;_tr.Start(true)};asc_docs_api.prototype.asc_HideSlides=function(isHide){this.WordControl.m_oLogicDocument.hideSlides(isHide)};asc_docs_api.prototype.sync_EndAddShape=function(){editor.sendEvent("asc_onEndAddShape");if(this.WordControl.m_oDrawingDocument.m_sLockedCursorType=="crosshair")this.WordControl.m_oDrawingDocument.UnlockCursorType()};asc_docs_api.prototype.asc_getChartObject=function(type){this.isChartEditor=true;if(!AscFormat.isRealNumber(type)){this.asc_onOpenChartFrame();
|
||||
|
|
|
@ -4674,118 +4674,118 @@ null};CGraphicObjectBase.prototype.drawCropTrack=function(graphics,srcRect,trans
|
|||
oldExtX;this.extY=oldExtY;this.setSrcRect(this.calculateSrcRect2());this.clearCropObject()};CGraphicObjectBase.prototype.setSrcRect=function(srcRect){if(this.getObjectType()===AscDFH.historyitem_type_ImageShape){var blipFill=this.blipFill.createDuplicate();blipFill.srcRect=srcRect;this.setBlipFill(blipFill)}else{var brush=this.brush.createDuplicate();brush.fill.srcRect=srcRect;this.spPr.setFill(brush)}};CGraphicObjectBase.prototype.calculateSrcRect2=function(){var oShapeDrawer=new AscCommon.CShapeDrawer;
|
||||
oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;this.check_bounds(oShapeDrawer);return CalculateSrcRect(this.transform,oShapeDrawer,this.cropObject.invertTransform,this.cropObject.extX,this.cropObject.extY)};CGraphicObjectBase.prototype.getMediaFileName=function(){return null};CGraphicObjectBase.prototype.getLogicDocument=function(){var oApi=editor||Asc["editor"];if(oApi&&oApi.WordControl)return oApi.WordControl.m_oLogicDocument;return null};CGraphicObjectBase.prototype.updatePosition=
|
||||
function(x,y){this.posX=x;this.posY=y;if(!this.group){this.x=this.localX+x;this.y=this.localY+y}else{this.x=this.localX;this.y=this.localY}if(this.updateTransformMatrix)this.updateTransformMatrix()};CGraphicObjectBase.prototype.copyComments=function(oLogicDocument){if(!oLogicDocument)return;var aDocContents=[];this.getAllDocContents(aDocContents);for(var i=0;i<aDocContents.length;++i)aDocContents[i].CreateDuplicateComments()};CGraphicObjectBase.prototype.createPlaceholderControl=function(){var phType=
|
||||
this.getPhType();var aButtons=[];var isLocalDesktop=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsSupportMedia"]&&window["AscDesktopEditor"]["IsSupportMedia"]();switch(phType){case null:{aButtons.push(AscCommon.PlaceholderButtonType.Table);aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_body:{break}case AscFormat.phType_chart:{aButtons.push(AscCommon.PlaceholderButtonType.Chart);
|
||||
break}case AscFormat.phType_clipArt:{aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_ctrTitle:{break}case AscFormat.phType_dgm:{break}case AscFormat.phType_dt:{break}case AscFormat.phType_ftr:{break}case AscFormat.phType_hdr:{break}case AscFormat.phType_media:{if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_obj:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
||||
aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_pic:{aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_sldImg:{aButtons.push(AscCommon.PlaceholderButtonType.Image);
|
||||
aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_sldNum:{break}case AscFormat.phType_subTitle:{break}case AscFormat.phType_tbl:{aButtons.push(AscCommon.PlaceholderButtonType.Table);break}case AscFormat.phType_title:{break}}var nSlideNum=0;if(this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Slide)nSlideNum=this.parent.num;return AscCommon.CreateDrawingPlaceholder(this.Id,aButtons,nSlideNum,{x:0,y:0,w:this.extX,h:this.extY},this.transform)};
|
||||
CGraphicObjectBase.prototype.onSlicerUpdate=function(sName){return false};CGraphicObjectBase.prototype.onSlicerLock=function(sName,bLock){};CGraphicObjectBase.prototype.onSlicerDelete=function(sName){return false};CGraphicObjectBase.prototype.onSlicerChangeName=function(sName,sNewName){return false};CGraphicObjectBase.prototype.onUpdate=function(oRect){if(this.drawingBase)this.drawingBase.onUpdate(oRect);else if(this.group)this.group.onUpdate(oRect)};CGraphicObjectBase.prototype.getSlicerViewByName=
|
||||
function(name){return null};CGraphicObjectBase.prototype.setParent2=function(parent){this.setParent(parent);if(Array.isArray(this.spTree))for(var i=0;i<this.spTree.length;++i)this.spTree[i].setParent2(parent)};CGraphicObjectBase.prototype.documentCreateFontMap=function(oMap){};CGraphicObjectBase.prototype.createFontMap=function(oMap){this.documentCreateFontMap(oMap)};function CRelSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=
|
||||
null;this.drawingBase=null}CRelSizeAnchor.prototype=Object.create(CBaseObject.prototype);CRelSizeAnchor.prototype.constructor=CRelSizeAnchor;CRelSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CRelSizeAnchor.prototype.getObjectType=function(){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));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));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));this.parent=object};CRelSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CRelSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&
|
||||
this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CRelSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromX]=function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToX]=function(oClass,
|
||||
value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromY]=
|
||||
window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorObject]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;function CAbsSizeAnchor(){CBaseObject.call(this);this.fromX=
|
||||
null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CAbsSizeAnchor.prototype=Object.create(CBaseObject.prototype);CAbsSizeAnchor.prototype.constructor=CAbsSizeAnchor;CAbsSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CAbsSizeAnchor.prototype.getObjectType=function(){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));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));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));this.parent=object};CAbsSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CAbsSizeAnchor.prototype.Refresh_RecalcData=
|
||||
function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CAbsSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};function CalculateSrcRect(parentCropTransform,bounds,oInvertTransformCrop,cropExtX,cropExtY){var lt_x_abs=parentCropTransform.TransformPointX(bounds.min_x,bounds.min_y);var lt_y_abs=parentCropTransform.TransformPointY(bounds.min_x,bounds.min_y);
|
||||
var rb_x_abs=parentCropTransform.TransformPointX(bounds.max_x,bounds.max_y);var rb_y_abs=parentCropTransform.TransformPointY(bounds.max_x,bounds.max_y);var lt_x_rel=oInvertTransformCrop.TransformPointX(lt_x_abs,lt_y_abs);var lt_y_rel=oInvertTransformCrop.TransformPointY(lt_x_abs,lt_y_abs);var rb_x_rel=oInvertTransformCrop.TransformPointX(rb_x_abs,rb_y_abs);var rb_y_rel=oInvertTransformCrop.TransformPointY(rb_x_abs,rb_y_abs);var srcRect=new AscFormat.CSrcRect;var _l=100*lt_x_rel/cropExtX;var _t=100*
|
||||
lt_y_rel/cropExtY;var _r=100*rb_x_rel/cropExtX;var _b=100*rb_y_rel/cropExtY;srcRect.l=Math.min(_l,_r);srcRect.t=Math.min(_t,_b);srcRect.r=Math.max(_l,_r);srcRect.b=Math.max(_t,_b);return srcRect}AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromX]=function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtX]=function(oClass,value){oClass.toX=
|
||||
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;
|
||||
AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorObject]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CGraphicObjectBase=
|
||||
CGraphicObjectBase;window["AscFormat"].CGraphicBounds=CGraphicBounds;window["AscFormat"].checkNormalRotate=checkNormalRotate;window["AscFormat"].normalizeRotate=normalizeRotate;window["AscFormat"].CRelSizeAnchor=CRelSizeAnchor;window["AscFormat"].CAbsSizeAnchor=CAbsSizeAnchor;window["AscFormat"].CalculateSrcRect=CalculateSrcRect;window["AscFormat"].CCopyObjectProperties=CCopyObjectProperties;window["AscFormat"].LOCKS_MASKS=LOCKS_MASKS})(window);"use strict";(function(window,undefined){var g_memory=
|
||||
AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var checkNormalRotate=AscFormat.checkNormalRotate;var HitInLine=AscFormat.HitInLine;
|
||||
var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscFill=Asc.c_oAscFill;var dTextFitDelta=3;function CheckObjectLine(obj){return obj instanceof CShape&&obj.spPr&&obj.spPr.geometry&&AscFormat.CheckLinePreset(obj.spPr.geometry.preset)}function CheckWordArtTextPr(oRun){if(oRun instanceof AscCommonWord.ParaRun){var oTextPr=oRun.Get_CompiledPr();if(oTextPr.TextFill||oTextPr.TextOutline&&oTextPr.TextOutline.Fill&&oTextPr.TextOutline.Fill.fill&&oTextPr.TextOutline.Fill.fill.type!==Asc.c_oAscFill.FILL_TYPE_NOFILL||
|
||||
oTextPr.Unifill&&oTextPr.Unifill.fill&&(oTextPr.Unifill.fill.type!==c_oAscFill.FILL_TYPE_SOLID||oTextPr.Unifill.transparent!=null&&oTextPr.Unifill.transparent<254.5))return true}return false}function hitInRect(x,y,l,t,r,b){return x>=l&&x<=r&&y>=t&&y<=b}function hitToCropHandles(x,y,object){var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var fCoeff=object.convertPixToMM(1);
|
||||
var fCoeff2=1/fCoeff;var widthCorner=object.extX*fCoeff2+1>>1;var isCentralMarkerX=widthCorner>40?true:false;if(widthCorner>17)widthCorner=17;var heightCorner=object.extY*fCoeff2+1>>1;var isCentralMarkerY=heightCorner>40?true:false;if(heightCorner>17)heightCorner=17;widthCorner*=fCoeff;heightCorner*=fCoeff;var markerWidth=5*fCoeff;if(hitInRect(t_x,t_y,0,0,widthCorner,markerWidth))return 0;if(hitInRect(t_x,t_y,0,0,markerWidth,heightCorner))return 0;if(isCentralMarkerX){if(hitInRect(t_x,t_y,object.extX/
|
||||
2-widthCorner/2,0,object.extX/2+widthCorner/2,markerWidth))return 1;if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,object.extY-markerWidth,object.extX/2+widthCorner/2,object.extY))return 5}if(hitInRect(t_x,t_y,object.extX-widthCorner,0,object.extX,markerWidth))return 2;if(hitInRect(t_x,t_y,object.extX-markerWidth,0,object.extX,heightCorner))return 2;if(isCentralMarkerY){if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY/2-heightCorner/2,object.extX,object.extY/2+heightCorner/2))return 3;if(hitInRect(t_x,
|
||||
t_y,0,object.extY/2-heightCorner/2,markerWidth,object.extY/2+heightCorner/2))return 7}if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY-heightCorner,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,object.extX-widthCorner,object.extY-markerWidth,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,0,object.extY-heightCorner,markerWidth,object.extY))return 6;if(hitInRect(t_x,t_y,0,object.extY-markerWidth,widthCorner,object.extY))return 6;return-1}function hitToHandles(x,y,object){if(object.cropObject)return hitToCropHandles(x,
|
||||
y,object);var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var radius=object.convertPixToMM(AscCommon.TRACK_CIRCLE_RADIUS);if(typeof global_mouseEvent!=="undefined"&&isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))radius*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)radius=global_mouseEvent.AscHitToHandlesEpsilon;
|
||||
radius*=radius;var _min_dist=2*radius;var _ret_value=-1;var check_line=CheckObjectLine(object);var sqr_x=t_x*t_x,sqr_y=t_y*t_y;var _tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=0}var hc=object.extX*.5;var dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=1}dist_x=t_x-object.extX;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=2}var vc=
|
||||
object.extY*.5;var dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=3}dist_y=t_y-object.extY;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=4}dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=5}dist_x=t_x;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;
|
||||
_ret_value=6}dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=7}if(object.canRotate&&object.canRotate()&&!check_line){var rotate_distance=object.convertPixToMM(AscCommon.TRACK_DISTANCE_ROTATE);dist_y=t_y+rotate_distance;sqr_y=dist_y*dist_y;dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=8}}dist_x=t_x-hc;dist_y=t_y-vc;_tmp_dist=dist_x*dist_x+dist_y*dist_y;if(_tmp_dist<
|
||||
_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=-1}if(_min_dist<radius)return _ret_value;return-1}function CreateUniFillByUniColorCopy(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CreateUniFillByUniColor(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CopyRunToPPTX(Run,Paragraph,bHyper){var NewRun=
|
||||
new ParaRun(Paragraph,false);var RunPr=Run.Pr.Copy();if(RunPr.RStyle!=undefined)RunPr.RStyle=undefined;RunPr.FontScale=undefined;if(bHyper){if(!RunPr.Unifill)RunPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);RunPr.Underline=true}if(RunPr.TextFill){RunPr.Unifill=RunPr.TextFill;RunPr.TextFill=undefined}NewRun.Set_Pr(RunPr);var PosToAdd=0;for(var CurPos=0;CurPos<Run.Content.length;CurPos++){var Item=Run.Content[CurPos];if(Item.Type!==para_End&&Item.Type!==para_Drawing&&Item.Type!==para_Comment&&
|
||||
Item.Type!==para_PageCount&&Item.Type!==para_FootnoteRef&&Item.Type!==para_FootnoteReference&&Item.Type!==para_PageNum&&Item.Type!==para_FieldChar&&Item.Type!==para_Bookmark&&Item.Type!==para_RevisionMove&&Item.Type!==para_InstrText&&Item.Type!==para_EndnoteReference&&Item.Type!==para_EndnoteRef){NewRun.Add_ToContent(PosToAdd,Item.Copy(),false);++PosToAdd}}return NewRun}function ConvertParagraphContentToPPTX(aOrigContent,oNewParagraph,bIsAddMath,bRemoveHyperlink){var Count=aOrigContent.length;for(var Index=
|
||||
0;Index<Count;Index++){var Item=aOrigContent[Index];if(Item.Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_Hyperlink)if(bRemoveHyperlink===true)for(var j=0;j<Item.Content.length;++j){if(Item.Content[j].Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item.Content[j],oNewParagraph),false)}else oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,
|
||||
ConvertHyperlinkToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_InlineLevelSdt)ConvertParagraphContentToPPTX(Item.Content,oNewParagraph,bIsAddMath,bRemoveHyperlink);else if(true===bIsAddMath&&Item.Type===para_Math)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,Item.Copy(),false)}}function ConvertParagraphToPPTX(paragraph,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var _drawing_document=isRealObject(drawingDocument)?drawingDocument:paragraph.DrawingDocument;var _new_parent=
|
||||
isRealObject(newParent)?newParent:null;var new_paragraph=new Paragraph(_drawing_document,_new_parent,true);if(!(paragraph instanceof Paragraph))return new_paragraph;var oCopyPr=paragraph.Pr.Copy();oCopyPr.ContextualSpacing=undefined;oCopyPr.KeepLines=undefined;oCopyPr.KeepNext=undefined;oCopyPr.PageBreakBefore=undefined;oCopyPr.Shd=undefined;oCopyPr.Brd.First=undefined;oCopyPr.Brd.Last=undefined;oCopyPr.Brd.Between=undefined;oCopyPr.Brd.Bottom=undefined;oCopyPr.Brd.Left=undefined;oCopyPr.Brd.Right=
|
||||
undefined;oCopyPr.Brd.Top=undefined;oCopyPr.WidowControl=undefined;oCopyPr.Tabs=undefined;oCopyPr.NumPr=undefined;oCopyPr.PStyle=undefined;oCopyPr.FramePr=undefined;new_paragraph.Set_Pr(oCopyPr);var oNewEndPr=paragraph.TextPr.Value.Copy();if(oNewEndPr.TextFill){oNewEndPr.Unifill=oNewEndPr.TextFill;oNewEndPr.TextFill=undefined}new_paragraph.TextPr.Set_Value(oNewEndPr);new_paragraph.Internal_Content_Remove2(0,new_paragraph.Content.length);ConvertParagraphContentToPPTX(paragraph.Content,new_paragraph,
|
||||
bIsAddMath,bRemoveHyperlink);var EndRun=new ParaRun(new_paragraph);EndRun.Add_ToContent(0,new ParaEnd);new_paragraph.Internal_Content_Add(new_paragraph.Content.length,EndRun,false);return new_paragraph}function ConvertElementsToPPTX(aResult,aElements,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var i,j,oElement;for(i=0;i<aElements.length;++i){oElement=aElements[i];if(oElement instanceof AscCommonWord.Paragraph)aResult.push(ConvertParagraphToPPTX(oElement));else if(oElement instanceof AscCommonWord.CTable){var paragraphs=
|
||||
[];oElement.GetAllParagraphs({All:true},paragraphs);for(j=0;j<paragraphs.length;j++)aResult.push(AscFormat.ConvertParagraphToPPTX(paragraphs[j],drawingDocument,newParent,bIsAddMath,bRemoveHyperlink))}else if(oElement instanceof AscCommonWord.CBlockLevelSdt)ConvertElementsToPPTX(aResult,oElement.Content.Content,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink)}}function ConvertHyperlinkToPPTX(hyperlink,paragraph){var hyperlink_ret=new ParaHyperlink,i,item,pos=0;hyperlink_ret.SetValue(hyperlink.Value);
|
||||
hyperlink_ret.SetToolTip(hyperlink.ToolTip);for(i=0;i<hyperlink.Content.length;++i){item=hyperlink.Content[i];if(item.Type===para_Run)hyperlink_ret.Add_ToContent(pos++,CopyRunToPPTX(item,paragraph,true));else if(item.Type===para_Hyperlink)hyperlink_ret.Add_ToContent(pos++,ConvertHyperlinkToPPTX(item,paragraph))}return hyperlink_ret}function ConvertParagraphToWord(paragraph,docContent){var _docContent=isRealObject(docContent)?docContent:paragraph.Parent;var oldFlag=paragraph.bFromDocument;paragraph.bFromDocument=
|
||||
true;var new_paragraph=paragraph.Copy(_docContent);CheckWordParagraphContent(new_paragraph.Content,new_paragraph.Pr.DefaultRunPr);var NewRPr=CheckWordRunPr(new_paragraph.TextPr.Value);var oCopyDefaultPr;if(NewRPr){if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(NewRPr);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr}new_paragraph.TextPr.Apply_TextPr(NewRPr)}else if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();
|
||||
oCopyDefaultPr.Merge(new_paragraph.TextPr.Value);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr;new_paragraph.TextPr.Apply_TextPr(NewRPr)}paragraph.bFromDocument=oldFlag;return new_paragraph}function CheckWordRunPr(Pr,bMath){var NewRPr=null;if(Pr.Unifill&&Pr.Unifill.fill)switch(Pr.Unifill.fill.type){case c_oAscFill.FILL_TYPE_SOLID:{if(Pr.Unifill.fill.color&&Pr.Unifill.fill.color.color)switch(Pr.Unifill.fill.color.color.type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{if(Pr.Unifill.fill.color.Mods&&
|
||||
Pr.Unifill.fill.color.Mods.Mods.length!==0)if(!Pr.Unifill.fill.color.canConvertPPTXModsToWord()){NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}else{NewRPr=Pr.Copy();NewRPr.Unifill.convertToWordMods()}break}case Asc.c_oAscColor.COLOR_TYPE_SRGB:{NewRPr=Pr.Copy();var RGBA=Pr.Unifill.fill.color.color.RGBA;NewRPr.Color=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}}break}case c_oAscFill.FILL_TYPE_PATT:case c_oAscFill.FILL_TYPE_BLIP:{NewRPr=
|
||||
Pr.Copy();NewRPr.TextFill=AscFormat.CreateUnfilFromRGB(0,0,0);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined;break}}if(bMath){NewRPr=Pr.Copy();NewRPr.RFonts.Set_All("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,oTextPr){var NewRPr,MergePr;for(var i=0;i<aContent.length;++i){var oItem=aContent[i];switch(oItem.Type){case para_Run:{NewRPr=CheckWordRunPr(oItem.Pr);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=
|
||||
oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}case para_Hyperlink:{CheckWordParagraphContent(oItem.Content);break}case para_Math:{if(oItem.Root&&oItem.Root.Content)CheckWordParagraphContent(oItem.Root.Content);break}case para_Math_Run:{NewRPr=CheckWordRunPr(oItem.Pr,true);if(NewRPr){MergePr=
|
||||
NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}}}}function ConvertGraphicFrameToWordTable(oGraphicFrame,oDocument){oGraphicFrame.setWordFlag(false,oDocument);return oGraphicFrame.graphicObject.Copy(oDocument)}function ConvertTableToGraphicFrame(oTable,oPresentation){var oGraphicFrame=
|
||||
new AscFormat.CGraphicFrame;var oTable2=new CTable(oPresentation.DrawingDocument,oGraphicFrame,true,0,[].concat(oTable.TableGrid),oTable.TableGrid.length,true);oTable2.Reset(0,0,50,1E5,0,0,1);oTable2.SetTableLayout(tbllayout_Fixed);oTable2.Set_Pr(oTable.Pr.Copy());oTable2.Set_TableLook(oTable.TableLook.Copy());for(var i=0;i<oTable.Content.length;++i){var oRow=oTable.Content[i];var oNewRow=new CTableRow(oTable2,oRow.Content.length,oTable2.TableGrid);for(var j=0;j<oRow.Content.length;++j){var oContent=
|
||||
oRow.Content[j].Content;var oNewContent=oNewRow.Content[j].Content;for(var t=0;t<oContent.Content.length;++t)if(oContent.Content[t].Get_Type()===type_Paragraph)oNewContent.Internal_Content_Add(oNewContent.Content.length,AscFormat.ConvertParagraphToPPTX(oContent.Content[t],oPresentation.DrawingDocument,oNewContent))}var nIndex=oTable2.Content.length;oTable2.Content[nIndex]=oNewRow;History.Add(new CChangesTableAddRow(oTable2,nIndex,[oNewRow]));oTable2.private_UpdateTableGrid()}if(!oGraphicFrame.spPr){oGraphicFrame.setSpPr(new AscFormat.CSpPr);
|
||||
oGraphicFrame.spPr.setParent(oGraphicFrame)}oGraphicFrame.spPr.setXfrm(new AscFormat.CXfrm);oGraphicFrame.spPr.xfrm.setExtX(50);oGraphicFrame.spPr.xfrm.setExtY(50);oGraphicFrame.spPr.xfrm.setParent(oGraphicFrame.spPr);var _nvGraphicFramePr=new AscFormat.UniNvPr;oGraphicFrame.setNvSpPr(_nvGraphicFramePr);if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))oGraphicFrame.setLocks(_nvGraphicFramePr.locks);oGraphicFrame.setGraphicObject(oTable2);oGraphicFrame.setBDeleted(false);
|
||||
return oGraphicFrame}function fHandleContent(aContent,oMax){for(var i=0;i<aContent.length;++i){var oContentElement=aContent[i];if(oContentElement.Get_Type()===type_Paragraph){var paragraph_lines=aContent[i].Lines;for(var j=0;j<paragraph_lines.length;++j)if(paragraph_lines[j].Ranges[0].W>oMax.max_width)oMax.max_width=paragraph_lines[j].Ranges[0].X+paragraph_lines[j].Ranges[0].W}else if(oContentElement.Get_Type()===type_Table){if(oContentElement.Bounds.Right>oMax.max_width)oMax.max_width=oContentElement.Bounds.Right}else if(oContentElement.Get_Type()===
|
||||
type_BlockLevelSdt)if(oContentElement&&oContentElement.Content)fHandleContent(oContentElement.Content.Content,oMax)}}function RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,bNeedRecalcAllDrawings){var oMaxWidth={max_width:0},i;oDocContent.Reset(0,0,dMaxWidth,2E4);if(bNeedRecalcAllDrawings){var aAllDrawings=oDocContent.GetAllDrawingObjects();for(i=0;i<aAllDrawings.length;++i)aAllDrawings[i].GraphicObj.recalculate()}oDocContent.Recalculate_Page(0,true);fHandleContent(oDocContent.Content,oMaxWidth);
|
||||
if(oMaxWidth.max_width===0){if(oDocContent.Is_Empty())if(oDocContent.Content[0]&&oDocContent.Content[0].Content[0]&&oDocContent.Content[0].Content[0].Content[0])return oDocContent.Content[0].Content[0].Content[0].WidthVisible/TEXTWIDTH_DIVIDER;return.001}return oMaxWidth.max_width}function CheckExcelDrawingXfrm(xfrm){var rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;if(checkNormalRotate(rot)){if(xfrm.offX<0)xfrm.setOffX(0);if(xfrm.offY<0)xfrm.setOffY(0)}else{var dPosX=xfrm.offX+xfrm.extX/2-xfrm.extY/
|
||||
2;var dPosY=xfrm.offY+xfrm.extY/2-xfrm.extX/2;if(dPosX<0)xfrm.setOffX(xfrm.offX-dPosX);if(dPosY<0)xfrm.setOffY(xfrm.offY-dPosY)}}function SetXfrmFromMetrics(oDrawing,metrics){AscFormat.CheckSpPrXfrm(oDrawing);var rot=AscFormat.isRealNumber(oDrawing.spPr.xfrm.rot)?AscFormat.normalizeRotate(oDrawing.spPr.xfrm.rot):0;var metricExtX,metricExtY;if(!(oDrawing instanceof AscFormat.CGroupShape)){metricExtX=metrics.extX;metricExtY=metrics.extY;if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setExtX(metrics.extX);
|
||||
oDrawing.spPr.xfrm.setExtY(metrics.extY)}else{oDrawing.spPr.xfrm.setExtX(metrics.extY);oDrawing.spPr.xfrm.setExtY(metrics.extX)}}else if(AscFormat.isRealNumber(oDrawing.spPr.xfrm.extX)&&AscFormat.isRealNumber(oDrawing.spPr.xfrm.extY)){metricExtX=oDrawing.spPr.xfrm.extX;metricExtY=oDrawing.spPr.xfrm.extY}else{metricExtX=metrics.extX;metricExtY=metrics.extY}if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setOffX(metrics.x);oDrawing.spPr.xfrm.setOffY(metrics.y)}else{oDrawing.spPr.xfrm.setOffX(metrics.x+
|
||||
metricExtX/2-metricExtY/2);oDrawing.spPr.xfrm.setOffY(metrics.y+metricExtY/2-metricExtX/2)}}AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent]=
|
||||
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetGroup]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetWordShape]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSignature]=
|
||||
AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr]=function(oClass,value){oClass.nvSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetStyle]=function(oClass,value){oClass.style=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxBody]=function(oClass,value){oClass.txBody=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTextBoxContent]=
|
||||
function(oClass,value){oClass.textBoxContent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetBodyPr]=function(oClass,value){oClass.bodyPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=function(oClass,value){oClass.fromSerialize=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetParent]=function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetWordShape]=
|
||||
function(oClass,value){oClass.bWordShape=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSignature]=function(oClass,value){var oldSignature=oClass.signatureLine;var newSignature=value;oClass.signatureLine=value;if(!AscCommon.isFileBuild()){var oApi=window["Asc"]&&window["Asc"]["editor"]||editor;if(oApi){if(oldSignature&&oldSignature.id)oApi.sendEvent("asc_onRemoveSignature",oldSignature.id);if(newSignature&&newSignature.id)oApi.sendEvent("asc_onAddSignature",newSignature.id)}}};function CSignatureLine(){this.id=
|
||||
null;this.signer=null;this.signer2=null;this.email=null;this.showDate=null;this.instructions=null}CSignatureLine.prototype.Write_ToBinary=function(writer){AscFormat.writeString(writer,this.id);AscFormat.writeString(writer,this.signer);AscFormat.writeString(writer,this.signer2);AscFormat.writeString(writer,this.email);AscFormat.writeBool(writer,this.showDate);AscFormat.writeString(writer,this.instructions)};CSignatureLine.prototype.Read_FromBinary=function(reader){this.id=AscFormat.readString(reader);
|
||||
this.signer=AscFormat.readString(reader);this.signer2=AscFormat.readString(reader);this.email=AscFormat.readString(reader);this.showDate=AscFormat.readBool(reader);this.instructions=AscFormat.readString(reader)};CSignatureLine.prototype.copy=function(){var ret=new CSignatureLine;ret.id=AscCommon.CreateGUID();ret.signer=this.signer;ret.signer2=this.signer2;ret.email=this.email;ret.showDate=this.showDate;ret.instructions=this.instructions;return ret};CSignatureLine.prototype.copyWithId=function(){var sId=
|
||||
this.id;var oCopy=this.copy();oCopy.id=sId;return oCopy};CSignatureLine.prototype.setProperties=function(oPr){this.signer=oPr.asc_getSigner1();this.signer2=oPr.asc_getSigner2();this.email=oPr.asc_getEmail();this.showDate=oPr.asc_getShowDate();this.instructions=oPr.asc_getInstructions()};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetSignature]=CSignatureLine;function CShape(){AscFormat.CGraphicObjectBase.call(this);
|
||||
this.nvSpPr=null;this.style=null;this.txBody=null;this.bodyPr=null;this.textBoxContent=null;this.drawingBase=null;this.bWordShape=null;this.bCheckAutoFitFlag=false;this.signatureLine=null;this.transformText=new CMatrix;this.invertTransformText=null;this.localTransformText=new CMatrix;this.worksheet=null;this.cachedImage=null;this.txWarpStruct=null;this.txWarpStructParamarks=null;this.txWarpStructNoTransform=null;this.txWarpStructParamarksNoTransform=null;this.tmpFontScale=undefined;this.tmpLnSpcReduction=
|
||||
undefined}CShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CShape.prototype.constructor=CShape;CShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Shape};CShape.prototype.GetAllDrawingObjects=function(DrawingObjects){var oContent=this.getDocContent();if(oContent)oContent.GetAllDrawingObjects(DrawingObjects)};CShape.prototype.setSignature=function(oSignature){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetSignature,this.signatureLine,
|
||||
oSignature));this.signatureLine=oSignature};CShape.prototype.setSignaturePr=function(oPr,sUrl){if(!oPr||!this.signatureLine)return;var oCopy=this.signatureLine.copyWithId();oCopy.setProperties(oPr);this.setSignature(oCopy);if(sUrl)if(this.spPr){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sUrl);this.spPr.setFill(oBlipFillUnifill)}};CShape.prototype.convertToWord=function(document){this.setBDeleted(true);var c=new CShape;c.setWordShape(true);c.setBDeleted(false);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());
|
||||
if(this.spPr){c.setSpPr(this.spPr.createDuplicate());if(!c.spPr.geometry)c.spPr.setGeometry(AscFormat.CreateGeometry("rect"));c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.txBody){if(this.txBody.bodyPr)c.setBodyPr(this.txBody.bodyPr.createDuplicate());if(this.txBody.content){var new_content=new CDocumentContent(c,document.DrawingDocument,0,0,0,2E4,false,false,false);var paragraphs=this.txBody.content.Content;new_content.Internal_Content_RemoveAll();for(var i=0;i<
|
||||
paragraphs.length;++i){var cur_par=paragraphs[i];var new_paragraph=ConvertParagraphToWord(cur_par,new_content);new_content.Internal_Content_Add(i,new_paragraph,false)}c.setTextBoxContent(new_content)}}if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.convertToPPTX=function(drawingDocument,worksheet,bIsAddMath){var 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){var tx_body=new AscFormat.CTextBody;tx_body.setParent(c);if(this.bodyPr)tx_body.setBodyPr(this.bodyPr.createDuplicate());var new_content=new AscFormat.CDrawingDocContent(tx_body,drawingDocument,0,0,0,0,false,false,true);new_content.Internal_Content_RemoveAll();var paragraphs=this.textBoxContent.Content;var index=0;for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];if(cur_par instanceof Paragraph){var new_paragraph=
|
||||
ConvertParagraphToPPTX(cur_par,drawingDocument,new_content,bIsAddMath);new_content.Internal_Content_Add(index++,new_paragraph,false)}}tx_body.setContent(new_content);c.setTxBody(tx_body)}if(worksheet)if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.handleAllContents=function(fCallback){var content=this.getDocContent();if(content)fCallback(content)};CShape.prototype.documentGetAllFontNames=function(AllFonts){var content=this.getDocContent();if(content)content.Document_Get_AllFontNames(AllFonts)};
|
||||
CShape.prototype.documentCreateFontMap=function(map){var content=this.getDocContent();if(content)content.Document_CreateFontMap(map)};CShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetNvSpPr,this.nvSpPr,pr));this.nvSpPr=pr};CShape.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetSpPr,this.spPr,spPr));this.spPr=spPr};CShape.prototype.setStyle=function(style){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
||||
AscDFH.historyitem_ShapeSetStyle,this.style,style));this.style=style;var content=this.getDocContent();this.recalcInfo.recalculateShapeStyleForParagraph=true;if(this.recalcTextStyles)this.recalcTextStyles();if(content)content.Recalc_AllParagraphs_CompiledPr()};CShape.prototype.setTxBody=function(txBody){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTxBody,this.txBody,txBody));this.txBody=txBody};CShape.prototype.setTextBoxContent=function(textBoxContent){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
||||
AscDFH.historyitem_ShapeSetTextBoxContent,this.textBoxContent,textBoxContent));this.textBoxContent=textBoxContent};CShape.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetBodyPr,this.bodyPr,pr));this.bodyPr=pr;this.recalcInfo.recalculateContent=true;this.recalcInfo.recalculateTransformText=true;this.addToRecalculate()};CShape.prototype.createTextBody=function(){var tx_body=new AscFormat.CTextBody;tx_body.setParent(this);tx_body.setContent(new AscFormat.CDrawingDocContent(tx_body,
|
||||
this.getDrawingDocument(),0,0,0,2E4,false,false,true));var oBodyPr=new AscFormat.CBodyPr;if(this.worksheet){oBodyPr.vertOverflow=AscFormat.nOTClip;oBodyPr.horzOverflow=AscFormat.nOTClip}tx_body.setBodyPr(oBodyPr);tx_body.content.Content[0].Set_DocumentIndex(0);tx_body.content.MoveCursorToStartPos(false);this.setTxBody(tx_body)};CShape.prototype.createTextBoxContent=function(){var body_pr=new AscFormat.CBodyPr;body_pr.setAnchor(1);this.setBodyPr(body_pr);this.setTextBoxContent(new CDocumentContent(this,
|
||||
this.getDrawingDocument(),0,0,0,2E4,false,false));this.textBoxContent.SetParagraphAlign(AscCommon.align_Center);this.textBoxContent.MoveCursorToStartPos(false);this.textBoxContent.Content[0].Set_DocumentIndex(0)};CShape.prototype.paragraphAdd=function(paraItem,bRecalculate){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent()}if(content_to_add)content_to_add.AddToParagraph(paraItem,
|
||||
bRecalculate)};CShape.prototype.applyTextFunction=function(docContentFunction,tableFunction,args){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent();content_to_add.MoveCursorToStartPos()}if(content_to_add)docContentFunction.apply(content_to_add,args);if(!editor||!editor.noCreatePoint||editor.exucuteHistory)this.checkExtentsByDocContent()};
|
||||
CShape.prototype.clearContent=function(){var content=this.getDocContent();if(content){content.Set_ApplyToAll(true);content.Remove(-1);content.AddToParagraph(new AscCommonWord.ParaTextPr({Lang:{Val:undefined}}),false);content.Set_ApplyToAll(false)}};CShape.prototype.getDocContent=function(){if(this.txBody)return this.txBody.content;else if(this.textBoxContent)return this.textBoxContent;return null};CShape.prototype.getBodyPr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.bWordShape){var ret=
|
||||
new AscFormat.CBodyPr;ret.setDefault();if(this.bodyPr)ret.merge(this.bodyPr);return ret}else{if(this.txBody&&this.txBody.bodyPr)return this.txBody.getCompiledBodyPr();var ret=new AscFormat.CBodyPr;ret.setDefault();return ret}},this,[])};CShape.prototype.GetRevisionsChangeElement=function(SearchEngine){var oContent=this.getDocContent();if(oContent)oContent.GetRevisionsChangeElement(SearchEngine)};CShape.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.textBoxContent){var dd=this.getDrawingDocument();
|
||||
dd.StartSearchTransform(this.transformText);this.textBoxContent.Search(Str,Props,SearchEngine,Type);dd.EndSearchTransform()}else if(this.txBody&&this.txBody.content)this.txBody.content.Search(Str,Props,SearchEngine,Type)};CShape.prototype.GetSearchElementId=function(bNext,bCurrent){if(this.textBoxContent)return this.textBoxContent.GetSearchElementId(bNext,bCurrent);else if(this.txBody&&this.txBody.content)return this.txBody.content.GetSearchElementId(bNext,bCurrent);return null};CShape.prototype.documentUpdateRulersState=
|
||||
function(){var content=this.getDocContent();if(!content)return;var xc,yc;var l,t,r,b;var body_pr=this.getBodyPr();var l_ins,t_ins,r_ins,b_ins;if(typeof body_pr.lIns==="number")l_ins=body_pr.lIns;else l_ins=2.54;if(typeof body_pr.tIns==="number")t_ins=body_pr.tIns;else t_ins=1.27;if(typeof body_pr.rIns==="number")r_ins=body_pr.rIns;else r_ins=2.54;if(typeof body_pr.bIns==="number")b_ins=body_pr.bIns;else b_ins=1.27;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){l=
|
||||
this.spPr.geometry.rect.l+l_ins;t=this.spPr.geometry.rect.t+t_ins;r=this.spPr.geometry.rect.r-r_ins;b=this.spPr.geometry.rect.b-b_ins}else{l=l_ins;t=t_ins;r=this.extX-r_ins;b=this.extY-b_ins}var x_lt,y_lt,x_rt,y_rt,x_rb,y_rb,x_lb,y_lb;var tr=this.transform;x_lt=tr.TransformPointX(l,t);y_lt=tr.TransformPointY(l,t);x_rb=tr.TransformPointX(r,b);y_rb=tr.TransformPointY(r,b);xc=(x_lt+x_rb)*.5;yc=(y_lt+y_rb)*.5;var hc=(r-l)*.5;var vc=(b-t)*.5;this.getDrawingDocument().Set_RulerState_Paragraph({L:xc-hc,
|
||||
T:yc-vc,R:xc+hc,B:yc+vc});content.Document_UpdateRulersState(AscFormat.isRealNumber(this.selectStartPage)?this.selectStartPage:0)};CShape.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetParent,this.parent,parent));this.parent=parent};CShape.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetGroup,this.group,group));this.group=group};CShape.prototype.getAllImages=function(images){if(this.spPr&&
|
||||
this.spPr.Fill&&this.spPr.Fill.fill instanceof AscFormat.CBlipFill&&typeof this.spPr.Fill.fill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.spPr.Fill.fill.RasterImageId)]=true};CShape.prototype.getAllFonts=function(fonts){if(this.txBody){this.txBody.content.Document_Get_AllFontNames(fonts);if(this.txBody&&this.txBody.lstStyle)this.txBody.lstStyle.Document_Get_AllFontNames(fonts);delete fonts["+mj-lt"];delete fonts["+mn-lt"];delete fonts["+mj-ea"];delete fonts["+mn-ea"];delete fonts["+mj-cs"];
|
||||
delete fonts["+mn-cs"]}};CShape.prototype.canFill=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.canFill();return true};CShape.prototype.isShape=function(){return true};CShape.prototype.isImage=function(){return false};CShape.prototype.isChart=function(){return false};CShape.prototype.isGroup=function(){return false};CShape.prototype.getHierarchy=function(bIsSingleBody,info){{this.compiledHierarchy=[];if(this.parent){var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=
|
||||
this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body;if(AscFormat.isRealBool(bIsSingleBody))b_is_single_body=bIsSingleBody;else b_is_single_body=this.getIsSingleBody&&this.getIsSingleBody();switch(this.parent.kind){case AscFormat.TYPE_KIND.SLIDE:{hierarchy.push(this.parent.Layout.getMatchingShape(ph_type,ph_index,b_is_single_body,info));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,
|
||||
ph_index,true));break}case AscFormat.TYPE_KIND.NOTES:{if(this.parent.Master)hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}}}this.recalcInfo.recalculateShapeHierarchy=true}}return this.compiledHierarchy};CShape.prototype.getPaddings=function(){var paddings=null;var shape=this;var body_pr;if(shape.txBody)if(shape.txBody.compiledBodyPr)body_pr=shape.txBody.compiledBodyPr;else body_pr=shape.txBody.getCompiledBodyPr();else if(shape.textBoxContent)body_pr=shape.bodyPr;
|
||||
if(body_pr){paddings=new Asc.asc_CPaddings;if(typeof body_pr.lIns==="number")paddings.Left=body_pr.lIns;else paddings.Left=2.54;if(typeof body_pr.tIns==="number")paddings.Top=body_pr.tIns;else paddings.Top=1.27;if(typeof body_pr.rIns==="number")paddings.Right=body_pr.rIns;else paddings.Right=2.54;if(typeof body_pr.bIns==="number")paddings.Bottom=body_pr.bIns;else paddings.Bottom=1.27}return paddings};CShape.prototype.getCompiledFill=function(){if(this.recalcInfo.recalculateFill){this.compiledFill=
|
||||
null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){if(this.spPr.Fill.fill instanceof AscFormat.CGradFill&&this.spPr.Fill.fill.colors.length===0){var parent_objects=this.getParentObjects();var theme=parent_objects.theme;var fmt_scheme=theme.themeElements.fmtScheme;var fill_style_lst=fmt_scheme.fillStyleLst;for(var i=fill_style_lst.length-1;i>-1;--i)if(fill_style_lst[i]&&fill_style_lst[i].fill instanceof AscFormat.CGradFill){this.spPr.Fill=fill_style_lst[i].createDuplicate();
|
||||
break}}this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&&this.compiledFill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else this.compiledFill=null}else this.compiledFill=null}else if(isRealObject(this.group)){var group_compiled_fill=this.group.getCompiledFill();
|
||||
if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&
|
||||
isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}this.recalcInfo.recalculateFill=false}return this.compiledFill};CShape.prototype.getMargins=function(){if(this.txBody)return this.txBody.getMargins();else return null};CShape.prototype.Document_UpdateRulersState=function(margins){if(this.txBody&&this.txBody.content)this.txBody.content.Document_UpdateRulersState(this.parent.num,
|
||||
this.getMargins())};CShape.prototype.getCompiledLine=function(){if(this.recalcInfo.recalculateLine){this.compiledLine=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.ln)&&isRealObject(this.spPr.ln))this.compiledLine=this.spPr.ln.createDuplicate();else if(isRealObject(this.group)){var group_compiled_line=this.group.getCompiledLine();if(isRealObject(group_compiled_line)&&isRealObject(group_compiled_line.fill))this.compiledLine=group_compiled_line.createDuplicate();else{var hierarchy=this.getHierarchy();
|
||||
for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}this.recalcInfo.recalculateLine=false}return this.compiledLine};
|
||||
CShape.prototype.getCompiledTransparent=function(){if(this.recalcInfo.recalculateTransparent){this.compiledTransparent=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill))if(AscFormat.isRealNumber(this.spPr.Fill.transparent))this.compiledTransparent=this.spPr.Fill.transparent;else if(this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group&&this.group.spPr&&this.group.spPr.Fill&&AscFormat.isRealNumber(this.group.spPr.Fill.transparent))this.compiledTransparent=
|
||||
this.group.spPr.Fill.transparent;if(null!==this.compiledTransparent){this.recalcInfo.recalculateTransparent=false;return this.compiledTransparent}if(isRealObject(this.group)){var group_transparent=this.group.getCompiledTransparent();if(AscFormat.isRealNumber(group_transparent))this.compiledTransparent=group_transparent;else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=
|
||||
hierarchy[i].spPr.Fill.transparent;break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=hierarchy[i].spPr.Fill.transparent;break}}this.recalcInfo.recalculateTransparent=false}return this.compiledTransparent};CShape.prototype.isPlaceholder=function(){return isRealObject(this.nvSpPr)&&isRealObject(this.nvSpPr.nvPr)&&
|
||||
isRealObject(this.nvSpPr.nvPr.ph)};CShape.prototype.getPlaceholderType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPlaceholderIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.getPhType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPhIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.setVerticalAlign=function(align){var content_to_add=
|
||||
this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.anchor=align;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setVert=function(vert){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();
|
||||
else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vert=vert;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent&&this.checkExtentsByDocContent()};CShape.prototype.setTextFitType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.textFit=new AscFormat.CTextFit;
|
||||
new_body_pr.textFit.type=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};CShape.prototype.setVertOverflowType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vertOverflow=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,
|
||||
true)}};CShape.prototype.setPaddings=function(paddings){if(paddings){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();if(AscFormat.isRealNumber(paddings.Left))new_body_pr.lIns=paddings.Left;if(AscFormat.isRealNumber(paddings.Top))new_body_pr.tIns=paddings.Top;if(AscFormat.isRealNumber(paddings.Right))new_body_pr.rIns=paddings.Right;if(AscFormat.isRealNumber(paddings.Bottom))new_body_pr.bIns=paddings.Bottom;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}}};
|
||||
CShape.prototype.recalculateTransformText=function(){var oContent=this.getDocContent();if(!oContent)return;var oBodyPr=this.getBodyPr();this.clipRect=this.checkTransformTextMatrix(this.localTransformText,oContent,oBodyPr,false);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText);if(this.txBody&&this.txBody.content2){this.transformText2=new CMatrix;this.clipRect2=this.checkTransformTextMatrix(this.transformText2,
|
||||
this.txBody.content2,oBodyPr,false);this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)}var bNoTextNoShape=oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.preset!=="textNoShape";{this.localTransformTextWordArt=new CMatrix;this.checkTransformTextMatrix(this.localTransformTextWordArt,oContent,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt=this.localTransformTextWordArt.CreateDublicate();this.invertTransformTextWordArt=global_MatrixTransformer.Invert(this.transformTextWordArt)}if(this.txBody&&
|
||||
this.txBody.content2){this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt2=new CMatrix;this.checkTransformTextMatrix(this.transformTextWordArt2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape)}if(this.checkPosTransformText)this.checkPosTransformText();if(this.checkContentDrawings)this.checkContentDrawings()};CShape.prototype.getFullFlip=function(){var _transform=this.localTransform;
|
||||
var _full_rotate=this.getFullRotate();var _full_pos_x_lt=_transform.TransformPointX(0,0);var _full_pos_y_lt=_transform.TransformPointY(0,0);var _full_pos_x_rt=_transform.TransformPointX(this.extX,0);var _full_pos_y_rt=_transform.TransformPointY(this.extX,0);var _full_pos_x_rb=_transform.TransformPointX(this.extX,this.extY);var _full_pos_y_rb=_transform.TransformPointY(this.extX,this.extY);var _rotate_matrix=new CMatrix;global_MatrixTransformer.RotateRadAppend(_rotate_matrix,_full_rotate);var _rotated_pos_x_lt=
|
||||
_rotate_matrix.TransformPointX(_full_pos_x_lt,_full_pos_y_lt);var _rotated_pos_x_rt=_rotate_matrix.TransformPointX(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rt=_rotate_matrix.TransformPointY(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rb=_rotate_matrix.TransformPointY(_full_pos_x_rb,_full_pos_y_rb);return{flipH:_rotated_pos_x_lt>_rotated_pos_x_rt,flipV:_rotated_pos_y_rt>_rotated_pos_y_rb}};CShape.prototype.recalculateTransformText2=function(){if(this.txBody===null)return;if(!this.txBody.content2)return;
|
||||
this.transformText2=new CMatrix;var _text_transform=this.transformText2;var _shape_transform=this.transform;var _body_pr=this.txBody.getBodyPr();var _content_height=this.txBody.getSummaryHeight2();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;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var _rect=this.spPr.geometry.rect;_l=_rect.l+_body_pr.lIns;_t=_rect.t+_body_pr.tIns;_r=_rect.r-_body_pr.rIns;_b=_rect.b-_body_pr.bIns}else{_l=
|
||||
_body_pr.lIns;_t=_body_pr.tIns;_r=this.extX-_body_pr.rIns;_b=this.extY-_body_pr.bIns}if(_l>=_r){var _c=(_l+_r)*.5;_l=_c-.01;_r=_c+.01}if(_t>=_b){_c=(_t+_b)*.5;_t=_c-.01;_b=_c+.01}_t_x_lt=_shape_transform.TransformPointX(_l,_t);_t_y_lt=_shape_transform.TransformPointY(_l,_t);_t_x_rt=_shape_transform.TransformPointX(_r,_t);_t_y_rt=_shape_transform.TransformPointY(_r,_t);_t_x_lb=_shape_transform.TransformPointX(_l,_b);_t_y_lb=_shape_transform.TransformPointY(_l,_b);_t_x_rb=_shape_transform.TransformPointX(_r,
|
||||
_b);_t_y_rb=_shape_transform.TransformPointY(_r,_b);var _dx_t,_dy_t;_dx_t=_t_x_rt-_t_x_lt;_dy_t=_t_y_rt-_t_y_lt;var _dx_lt_rb,_dy_lt_rb;_dx_lt_rb=_t_x_rb-_t_x_lt;_dy_lt_rb=_t_y_rb-_t_y_lt;var _vertical_shift;var _text_rect_height=_b-_t;var _text_rect_width=_r-_l;if(!_body_pr.upright){if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_height;
|
||||
break}case 1:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){var alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,
|
||||
_t_x_lt,_t_y_lt)}else{alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}}else{if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_width-_content_height;break}case 1:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 4:{_vertical_shift=
|
||||
0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI*.5-_alpha);
|
||||
this.getPhType();var aButtons=[];var isLocalDesktop=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsSupportMedia"]&&window["AscDesktopEditor"]["IsSupportMedia"]();switch(phType){case null:{aButtons.push(AscCommon.PlaceholderButtonType.Table);aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_body:{break}case AscFormat.phType_chart:{aButtons.push(AscCommon.PlaceholderButtonType.Chart);
|
||||
break}case AscFormat.phType_clipArt:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_ctrTitle:{break}case AscFormat.phType_dgm:{break}case AscFormat.phType_dt:{break}case AscFormat.phType_ftr:{break}case AscFormat.phType_hdr:{break}case AscFormat.phType_media:{if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_obj:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
||||
aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_pic:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_sldImg:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_sldNum:{break}case AscFormat.phType_subTitle:{break}case AscFormat.phType_tbl:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
||||
break}case AscFormat.phType_title:{break}}var nSlideNum=0;if(this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Slide)nSlideNum=this.parent.num;return AscCommon.CreateDrawingPlaceholder(this.Id,aButtons,nSlideNum,{x:0,y:0,w:this.extX,h:this.extY},this.transform)};CGraphicObjectBase.prototype.onSlicerUpdate=function(sName){return false};CGraphicObjectBase.prototype.onSlicerLock=function(sName,bLock){};CGraphicObjectBase.prototype.onSlicerDelete=function(sName){return false};
|
||||
CGraphicObjectBase.prototype.onSlicerChangeName=function(sName,sNewName){return false};CGraphicObjectBase.prototype.onUpdate=function(oRect){if(this.drawingBase)this.drawingBase.onUpdate(oRect);else if(this.group)this.group.onUpdate(oRect)};CGraphicObjectBase.prototype.getSlicerViewByName=function(name){return null};CGraphicObjectBase.prototype.setParent2=function(parent){this.setParent(parent);if(Array.isArray(this.spTree))for(var i=0;i<this.spTree.length;++i)this.spTree[i].setParent2(parent)};CGraphicObjectBase.prototype.documentCreateFontMap=
|
||||
function(oMap){};CGraphicObjectBase.prototype.createFontMap=function(oMap){this.documentCreateFontMap(oMap)};function CRelSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CRelSizeAnchor.prototype=Object.create(CBaseObject.prototype);CRelSizeAnchor.prototype.constructor=CRelSizeAnchor;CRelSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CRelSizeAnchor.prototype.getObjectType=
|
||||
function(){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));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));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));this.parent=object};CRelSizeAnchor.prototype.copy=
|
||||
function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CRelSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CRelSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromX]=
|
||||
function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToX]=function(oClass,value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorParent]=
|
||||
function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorObject]=
|
||||
window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;function CAbsSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CAbsSizeAnchor.prototype=Object.create(CBaseObject.prototype);CAbsSizeAnchor.prototype.constructor=CAbsSizeAnchor;CAbsSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};
|
||||
CAbsSizeAnchor.prototype.getObjectType=function(){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));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));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));this.parent=
|
||||
object};CAbsSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CAbsSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CAbsSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};
|
||||
function CalculateSrcRect(parentCropTransform,bounds,oInvertTransformCrop,cropExtX,cropExtY){var lt_x_abs=parentCropTransform.TransformPointX(bounds.min_x,bounds.min_y);var lt_y_abs=parentCropTransform.TransformPointY(bounds.min_x,bounds.min_y);var rb_x_abs=parentCropTransform.TransformPointX(bounds.max_x,bounds.max_y);var rb_y_abs=parentCropTransform.TransformPointY(bounds.max_x,bounds.max_y);var lt_x_rel=oInvertTransformCrop.TransformPointX(lt_x_abs,lt_y_abs);var lt_y_rel=oInvertTransformCrop.TransformPointY(lt_x_abs,
|
||||
lt_y_abs);var rb_x_rel=oInvertTransformCrop.TransformPointX(rb_x_abs,rb_y_abs);var rb_y_rel=oInvertTransformCrop.TransformPointY(rb_x_abs,rb_y_abs);var srcRect=new AscFormat.CSrcRect;var _l=100*lt_x_rel/cropExtX;var _t=100*lt_y_rel/cropExtY;var _r=100*rb_x_rel/cropExtX;var _b=100*rb_y_rel/cropExtY;srcRect.l=Math.min(_l,_r);srcRect.t=Math.min(_t,_b);srcRect.r=Math.max(_l,_r);srcRect.b=Math.max(_t,_b);return srcRect}AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromX]=function(oClass,value){oClass.fromX=
|
||||
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtX]=function(oClass,value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorParent]=
|
||||
function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorObject]=
|
||||
window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CGraphicObjectBase=CGraphicObjectBase;window["AscFormat"].CGraphicBounds=CGraphicBounds;window["AscFormat"].checkNormalRotate=checkNormalRotate;window["AscFormat"].normalizeRotate=normalizeRotate;window["AscFormat"].CRelSizeAnchor=CRelSizeAnchor;window["AscFormat"].CAbsSizeAnchor=
|
||||
CAbsSizeAnchor;window["AscFormat"].CalculateSrcRect=CalculateSrcRect;window["AscFormat"].CCopyObjectProperties=CCopyObjectProperties;window["AscFormat"].LOCKS_MASKS=LOCKS_MASKS})(window);"use strict";(function(window,undefined){var g_memory=AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;
|
||||
var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var checkNormalRotate=AscFormat.checkNormalRotate;var HitInLine=AscFormat.HitInLine;var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscFill=Asc.c_oAscFill;var dTextFitDelta=3;function CheckObjectLine(obj){return obj instanceof CShape&&obj.spPr&&obj.spPr.geometry&&AscFormat.CheckLinePreset(obj.spPr.geometry.preset)}function CheckWordArtTextPr(oRun){if(oRun instanceof
|
||||
AscCommonWord.ParaRun){var oTextPr=oRun.Get_CompiledPr();if(oTextPr.TextFill||oTextPr.TextOutline&&oTextPr.TextOutline.Fill&&oTextPr.TextOutline.Fill.fill&&oTextPr.TextOutline.Fill.fill.type!==Asc.c_oAscFill.FILL_TYPE_NOFILL||oTextPr.Unifill&&oTextPr.Unifill.fill&&(oTextPr.Unifill.fill.type!==c_oAscFill.FILL_TYPE_SOLID||oTextPr.Unifill.transparent!=null&&oTextPr.Unifill.transparent<254.5))return true}return false}function hitInRect(x,y,l,t,r,b){return x>=l&&x<=r&&y>=t&&y<=b}function hitToCropHandles(x,
|
||||
y,object){var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var fCoeff=object.convertPixToMM(1);var fCoeff2=1/fCoeff;var widthCorner=object.extX*fCoeff2+1>>1;var isCentralMarkerX=widthCorner>40?true:false;if(widthCorner>17)widthCorner=17;var heightCorner=object.extY*fCoeff2+1>>1;var isCentralMarkerY=heightCorner>40?true:false;if(heightCorner>17)heightCorner=17;widthCorner*=
|
||||
fCoeff;heightCorner*=fCoeff;var markerWidth=5*fCoeff;if(hitInRect(t_x,t_y,0,0,widthCorner,markerWidth))return 0;if(hitInRect(t_x,t_y,0,0,markerWidth,heightCorner))return 0;if(isCentralMarkerX){if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,0,object.extX/2+widthCorner/2,markerWidth))return 1;if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,object.extY-markerWidth,object.extX/2+widthCorner/2,object.extY))return 5}if(hitInRect(t_x,t_y,object.extX-widthCorner,0,object.extX,markerWidth))return 2;if(hitInRect(t_x,
|
||||
t_y,object.extX-markerWidth,0,object.extX,heightCorner))return 2;if(isCentralMarkerY){if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY/2-heightCorner/2,object.extX,object.extY/2+heightCorner/2))return 3;if(hitInRect(t_x,t_y,0,object.extY/2-heightCorner/2,markerWidth,object.extY/2+heightCorner/2))return 7}if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY-heightCorner,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,object.extX-widthCorner,object.extY-markerWidth,object.extX,object.extY))return 4;
|
||||
if(hitInRect(t_x,t_y,0,object.extY-heightCorner,markerWidth,object.extY))return 6;if(hitInRect(t_x,t_y,0,object.extY-markerWidth,widthCorner,object.extY))return 6;return-1}function hitToHandles(x,y,object){if(object.cropObject)return hitToCropHandles(x,y,object);var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var radius=object.convertPixToMM(AscCommon.TRACK_CIRCLE_RADIUS);
|
||||
if(typeof global_mouseEvent!=="undefined"&&isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))radius*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)radius=global_mouseEvent.AscHitToHandlesEpsilon;radius*=radius;var _min_dist=2*radius;var _ret_value=-1;var check_line=CheckObjectLine(object);var sqr_x=t_x*t_x,sqr_y=t_y*t_y;var _tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=0}var hc=object.extX*
|
||||
.5;var dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=1}dist_x=t_x-object.extX;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=2}var vc=object.extY*.5;var dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=3}dist_y=t_y-object.extY;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=
|
||||
_tmp_dist;_ret_value=4}dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=5}dist_x=t_x;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=6}dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=7}if(object.canRotate&&object.canRotate()&&!check_line){var rotate_distance=object.convertPixToMM(AscCommon.TRACK_DISTANCE_ROTATE);
|
||||
dist_y=t_y+rotate_distance;sqr_y=dist_y*dist_y;dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=8}}dist_x=t_x-hc;dist_y=t_y-vc;_tmp_dist=dist_x*dist_x+dist_y*dist_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=-1}if(_min_dist<radius)return _ret_value;return-1}function CreateUniFillByUniColorCopy(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());
|
||||
return ret}function CreateUniFillByUniColor(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CopyRunToPPTX(Run,Paragraph,bHyper){var NewRun=new ParaRun(Paragraph,false);var RunPr=Run.Pr.Copy();if(RunPr.RStyle!=undefined)RunPr.RStyle=undefined;RunPr.FontScale=undefined;if(bHyper){if(!RunPr.Unifill)RunPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);RunPr.Underline=true}if(RunPr.TextFill){RunPr.Unifill=
|
||||
RunPr.TextFill;RunPr.TextFill=undefined}NewRun.Set_Pr(RunPr);var PosToAdd=0;for(var CurPos=0;CurPos<Run.Content.length;CurPos++){var Item=Run.Content[CurPos];if(Item.Type!==para_End&&Item.Type!==para_Drawing&&Item.Type!==para_Comment&&Item.Type!==para_PageCount&&Item.Type!==para_FootnoteRef&&Item.Type!==para_FootnoteReference&&Item.Type!==para_PageNum&&Item.Type!==para_FieldChar&&Item.Type!==para_Bookmark&&Item.Type!==para_RevisionMove&&Item.Type!==para_InstrText&&Item.Type!==para_EndnoteReference&&
|
||||
Item.Type!==para_EndnoteRef){NewRun.Add_ToContent(PosToAdd,Item.Copy(),false);++PosToAdd}}return NewRun}function ConvertParagraphContentToPPTX(aOrigContent,oNewParagraph,bIsAddMath,bRemoveHyperlink){var Count=aOrigContent.length;for(var Index=0;Index<Count;Index++){var Item=aOrigContent[Index];if(Item.Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_Hyperlink)if(bRemoveHyperlink===true)for(var j=0;j<Item.Content.length;++j){if(Item.Content[j].Type===
|
||||
para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item.Content[j],oNewParagraph),false)}else oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,ConvertHyperlinkToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_InlineLevelSdt)ConvertParagraphContentToPPTX(Item.Content,oNewParagraph,bIsAddMath,bRemoveHyperlink);else if(true===bIsAddMath&&Item.Type===para_Math)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,Item.Copy(),false)}}
|
||||
function ConvertParagraphToPPTX(paragraph,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var _drawing_document=isRealObject(drawingDocument)?drawingDocument:paragraph.DrawingDocument;var _new_parent=isRealObject(newParent)?newParent:null;var new_paragraph=new Paragraph(_drawing_document,_new_parent,true);if(!(paragraph instanceof Paragraph))return new_paragraph;var oCopyPr=paragraph.Pr.Copy();oCopyPr.ContextualSpacing=undefined;oCopyPr.KeepLines=undefined;oCopyPr.KeepNext=undefined;oCopyPr.PageBreakBefore=
|
||||
undefined;oCopyPr.Shd=undefined;oCopyPr.Brd.First=undefined;oCopyPr.Brd.Last=undefined;oCopyPr.Brd.Between=undefined;oCopyPr.Brd.Bottom=undefined;oCopyPr.Brd.Left=undefined;oCopyPr.Brd.Right=undefined;oCopyPr.Brd.Top=undefined;oCopyPr.WidowControl=undefined;oCopyPr.Tabs=undefined;oCopyPr.NumPr=undefined;oCopyPr.PStyle=undefined;oCopyPr.FramePr=undefined;new_paragraph.Set_Pr(oCopyPr);var oNewEndPr=paragraph.TextPr.Value.Copy();if(oNewEndPr.TextFill){oNewEndPr.Unifill=oNewEndPr.TextFill;oNewEndPr.TextFill=
|
||||
undefined}new_paragraph.TextPr.Set_Value(oNewEndPr);new_paragraph.Internal_Content_Remove2(0,new_paragraph.Content.length);ConvertParagraphContentToPPTX(paragraph.Content,new_paragraph,bIsAddMath,bRemoveHyperlink);var EndRun=new ParaRun(new_paragraph);EndRun.Add_ToContent(0,new ParaEnd);new_paragraph.Internal_Content_Add(new_paragraph.Content.length,EndRun,false);return new_paragraph}function ConvertElementsToPPTX(aResult,aElements,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var i,j,oElement;
|
||||
for(i=0;i<aElements.length;++i){oElement=aElements[i];if(oElement instanceof AscCommonWord.Paragraph)aResult.push(ConvertParagraphToPPTX(oElement));else if(oElement instanceof AscCommonWord.CTable){var paragraphs=[];oElement.GetAllParagraphs({All:true},paragraphs);for(j=0;j<paragraphs.length;j++)aResult.push(AscFormat.ConvertParagraphToPPTX(paragraphs[j],drawingDocument,newParent,bIsAddMath,bRemoveHyperlink))}else if(oElement instanceof AscCommonWord.CBlockLevelSdt)ConvertElementsToPPTX(aResult,oElement.Content.Content,
|
||||
drawingDocument,newParent,bIsAddMath,bRemoveHyperlink)}}function ConvertHyperlinkToPPTX(hyperlink,paragraph){var hyperlink_ret=new ParaHyperlink,i,item,pos=0;hyperlink_ret.SetValue(hyperlink.Value);hyperlink_ret.SetToolTip(hyperlink.ToolTip);for(i=0;i<hyperlink.Content.length;++i){item=hyperlink.Content[i];if(item.Type===para_Run)hyperlink_ret.Add_ToContent(pos++,CopyRunToPPTX(item,paragraph,true));else if(item.Type===para_Hyperlink)hyperlink_ret.Add_ToContent(pos++,ConvertHyperlinkToPPTX(item,paragraph))}return hyperlink_ret}
|
||||
function ConvertParagraphToWord(paragraph,docContent){var _docContent=isRealObject(docContent)?docContent:paragraph.Parent;var oldFlag=paragraph.bFromDocument;paragraph.bFromDocument=true;var new_paragraph=paragraph.Copy(_docContent);CheckWordParagraphContent(new_paragraph.Content,new_paragraph.Pr.DefaultRunPr);var NewRPr=CheckWordRunPr(new_paragraph.TextPr.Value);var oCopyDefaultPr;if(NewRPr){if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(NewRPr);
|
||||
NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr}new_paragraph.TextPr.Apply_TextPr(NewRPr)}else if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(new_paragraph.TextPr.Value);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr;new_paragraph.TextPr.Apply_TextPr(NewRPr)}paragraph.bFromDocument=oldFlag;return new_paragraph}function CheckWordRunPr(Pr,bMath){var NewRPr=null;if(Pr.Unifill&&Pr.Unifill.fill)switch(Pr.Unifill.fill.type){case c_oAscFill.FILL_TYPE_SOLID:{if(Pr.Unifill.fill.color&&
|
||||
Pr.Unifill.fill.color.color)switch(Pr.Unifill.fill.color.color.type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{if(Pr.Unifill.fill.color.Mods&&Pr.Unifill.fill.color.Mods.Mods.length!==0)if(!Pr.Unifill.fill.color.canConvertPPTXModsToWord()){NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}else{NewRPr=Pr.Copy();NewRPr.Unifill.convertToWordMods()}break}case Asc.c_oAscColor.COLOR_TYPE_SRGB:{NewRPr=Pr.Copy();var RGBA=Pr.Unifill.fill.color.color.RGBA;NewRPr.Color=new CDocumentColor(RGBA.R,
|
||||
RGBA.G,RGBA.B);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}}break}case c_oAscFill.FILL_TYPE_PATT:case c_oAscFill.FILL_TYPE_BLIP:{NewRPr=Pr.Copy();NewRPr.TextFill=AscFormat.CreateUnfilFromRGB(0,0,0);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined;break}}if(bMath){NewRPr=Pr.Copy();NewRPr.RFonts.Set_All("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,
|
||||
oTextPr){var NewRPr,MergePr;for(var i=0;i<aContent.length;++i){var oItem=aContent[i];switch(oItem.Type){case para_Run:{NewRPr=CheckWordRunPr(oItem.Pr);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}case para_Hyperlink:{CheckWordParagraphContent(oItem.Content);
|
||||
break}case para_Math:{if(oItem.Root&&oItem.Root.Content)CheckWordParagraphContent(oItem.Root.Content);break}case para_Math_Run:{NewRPr=CheckWordRunPr(oItem.Pr,true);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}}}}function ConvertGraphicFrameToWordTable(oGraphicFrame,
|
||||
oDocument){oGraphicFrame.setWordFlag(false,oDocument);return oGraphicFrame.graphicObject.Copy(oDocument)}function ConvertTableToGraphicFrame(oTable,oPresentation){var oGraphicFrame=new AscFormat.CGraphicFrame;var oTable2=new CTable(oPresentation.DrawingDocument,oGraphicFrame,true,0,[].concat(oTable.TableGrid),oTable.TableGrid.length,true);oTable2.Reset(0,0,50,1E5,0,0,1);oTable2.SetTableLayout(tbllayout_Fixed);oTable2.Set_Pr(oTable.Pr.Copy());oTable2.Set_TableLook(oTable.TableLook.Copy());for(var i=
|
||||
0;i<oTable.Content.length;++i){var oRow=oTable.Content[i];var oNewRow=new CTableRow(oTable2,oRow.Content.length,oTable2.TableGrid);for(var j=0;j<oRow.Content.length;++j){var oContent=oRow.Content[j].Content;var oNewContent=oNewRow.Content[j].Content;for(var t=0;t<oContent.Content.length;++t)if(oContent.Content[t].Get_Type()===type_Paragraph)oNewContent.Internal_Content_Add(oNewContent.Content.length,AscFormat.ConvertParagraphToPPTX(oContent.Content[t],oPresentation.DrawingDocument,oNewContent))}var nIndex=
|
||||
oTable2.Content.length;oTable2.Content[nIndex]=oNewRow;History.Add(new CChangesTableAddRow(oTable2,nIndex,[oNewRow]));oTable2.private_UpdateTableGrid()}if(!oGraphicFrame.spPr){oGraphicFrame.setSpPr(new AscFormat.CSpPr);oGraphicFrame.spPr.setParent(oGraphicFrame)}oGraphicFrame.spPr.setXfrm(new AscFormat.CXfrm);oGraphicFrame.spPr.xfrm.setExtX(50);oGraphicFrame.spPr.xfrm.setExtY(50);oGraphicFrame.spPr.xfrm.setParent(oGraphicFrame.spPr);var _nvGraphicFramePr=new AscFormat.UniNvPr;oGraphicFrame.setNvSpPr(_nvGraphicFramePr);
|
||||
if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))oGraphicFrame.setLocks(_nvGraphicFramePr.locks);oGraphicFrame.setGraphicObject(oTable2);oGraphicFrame.setBDeleted(false);return oGraphicFrame}function fHandleContent(aContent,oMax){for(var i=0;i<aContent.length;++i){var oContentElement=aContent[i];if(oContentElement.Get_Type()===type_Paragraph){var paragraph_lines=aContent[i].Lines;for(var j=0;j<paragraph_lines.length;++j)if(paragraph_lines[j].Ranges[0].W>
|
||||
oMax.max_width)oMax.max_width=paragraph_lines[j].Ranges[0].X+paragraph_lines[j].Ranges[0].W}else if(oContentElement.Get_Type()===type_Table){if(oContentElement.Bounds.Right>oMax.max_width)oMax.max_width=oContentElement.Bounds.Right}else if(oContentElement.Get_Type()===type_BlockLevelSdt)if(oContentElement&&oContentElement.Content)fHandleContent(oContentElement.Content.Content,oMax)}}function RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,bNeedRecalcAllDrawings){var oMaxWidth={max_width:0},i;
|
||||
oDocContent.Reset(0,0,dMaxWidth,2E4);if(bNeedRecalcAllDrawings){var aAllDrawings=oDocContent.GetAllDrawingObjects();for(i=0;i<aAllDrawings.length;++i)aAllDrawings[i].GraphicObj.recalculate()}oDocContent.Recalculate_Page(0,true);fHandleContent(oDocContent.Content,oMaxWidth);if(oMaxWidth.max_width===0){if(oDocContent.Is_Empty())if(oDocContent.Content[0]&&oDocContent.Content[0].Content[0]&&oDocContent.Content[0].Content[0].Content[0])return oDocContent.Content[0].Content[0].Content[0].WidthVisible/TEXTWIDTH_DIVIDER;
|
||||
return.001}return oMaxWidth.max_width}function CheckExcelDrawingXfrm(xfrm){var rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;if(checkNormalRotate(rot)){if(xfrm.offX<0)xfrm.setOffX(0);if(xfrm.offY<0)xfrm.setOffY(0)}else{var dPosX=xfrm.offX+xfrm.extX/2-xfrm.extY/2;var dPosY=xfrm.offY+xfrm.extY/2-xfrm.extX/2;if(dPosX<0)xfrm.setOffX(xfrm.offX-dPosX);if(dPosY<0)xfrm.setOffY(xfrm.offY-dPosY)}}function SetXfrmFromMetrics(oDrawing,metrics){AscFormat.CheckSpPrXfrm(oDrawing);var rot=AscFormat.isRealNumber(oDrawing.spPr.xfrm.rot)?
|
||||
AscFormat.normalizeRotate(oDrawing.spPr.xfrm.rot):0;var metricExtX,metricExtY;if(!(oDrawing instanceof AscFormat.CGroupShape)){metricExtX=metrics.extX;metricExtY=metrics.extY;if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setExtX(metrics.extX);oDrawing.spPr.xfrm.setExtY(metrics.extY)}else{oDrawing.spPr.xfrm.setExtX(metrics.extY);oDrawing.spPr.xfrm.setExtY(metrics.extX)}}else if(AscFormat.isRealNumber(oDrawing.spPr.xfrm.extX)&&AscFormat.isRealNumber(oDrawing.spPr.xfrm.extY)){metricExtX=oDrawing.spPr.xfrm.extX;
|
||||
metricExtY=oDrawing.spPr.xfrm.extY}else{metricExtX=metrics.extX;metricExtY=metrics.extY}if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setOffX(metrics.x);oDrawing.spPr.xfrm.setOffY(metrics.y)}else{oDrawing.spPr.xfrm.setOffX(metrics.x+metricExtX/2-metricExtY/2);oDrawing.spPr.xfrm.setOffY(metrics.y+metricExtY/2-metricExtX/2)}}AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle]=
|
||||
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetGroup]=
|
||||
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetWordShape]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSignature]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr]=function(oClass,value){oClass.nvSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetStyle]=function(oClass,value){oClass.style=
|
||||
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxBody]=function(oClass,value){oClass.txBody=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTextBoxContent]=function(oClass,value){oClass.textBoxContent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetBodyPr]=function(oClass,value){oClass.bodyPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=function(oClass,value){oClass.fromSerialize=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetParent]=
|
||||
function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetWordShape]=function(oClass,value){oClass.bWordShape=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSignature]=function(oClass,value){var oldSignature=oClass.signatureLine;var newSignature=value;oClass.signatureLine=value;if(!AscCommon.isFileBuild()){var oApi=window["Asc"]&&window["Asc"]["editor"]||
|
||||
editor;if(oApi){if(oldSignature&&oldSignature.id)oApi.sendEvent("asc_onRemoveSignature",oldSignature.id);if(newSignature&&newSignature.id)oApi.sendEvent("asc_onAddSignature",newSignature.id)}}};function CSignatureLine(){this.id=null;this.signer=null;this.signer2=null;this.email=null;this.showDate=null;this.instructions=null}CSignatureLine.prototype.Write_ToBinary=function(writer){AscFormat.writeString(writer,this.id);AscFormat.writeString(writer,this.signer);AscFormat.writeString(writer,this.signer2);
|
||||
AscFormat.writeString(writer,this.email);AscFormat.writeBool(writer,this.showDate);AscFormat.writeString(writer,this.instructions)};CSignatureLine.prototype.Read_FromBinary=function(reader){this.id=AscFormat.readString(reader);this.signer=AscFormat.readString(reader);this.signer2=AscFormat.readString(reader);this.email=AscFormat.readString(reader);this.showDate=AscFormat.readBool(reader);this.instructions=AscFormat.readString(reader)};CSignatureLine.prototype.copy=function(){var ret=new CSignatureLine;
|
||||
ret.id=AscCommon.CreateGUID();ret.signer=this.signer;ret.signer2=this.signer2;ret.email=this.email;ret.showDate=this.showDate;ret.instructions=this.instructions;return ret};CSignatureLine.prototype.copyWithId=function(){var sId=this.id;var oCopy=this.copy();oCopy.id=sId;return oCopy};CSignatureLine.prototype.setProperties=function(oPr){this.signer=oPr.asc_getSigner1();this.signer2=oPr.asc_getSigner2();this.email=oPr.asc_getEmail();this.showDate=oPr.asc_getShowDate();this.instructions=oPr.asc_getInstructions()};
|
||||
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetSignature]=CSignatureLine;function CShape(){AscFormat.CGraphicObjectBase.call(this);this.nvSpPr=null;this.style=null;this.txBody=null;this.bodyPr=null;this.textBoxContent=null;this.drawingBase=null;this.bWordShape=null;this.bCheckAutoFitFlag=false;this.signatureLine=null;this.transformText=new CMatrix;this.invertTransformText=null;this.localTransformText=new CMatrix;
|
||||
this.worksheet=null;this.cachedImage=null;this.txWarpStruct=null;this.txWarpStructParamarks=null;this.txWarpStructNoTransform=null;this.txWarpStructParamarksNoTransform=null;this.tmpFontScale=undefined;this.tmpLnSpcReduction=undefined}CShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CShape.prototype.constructor=CShape;CShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Shape};CShape.prototype.GetAllDrawingObjects=function(DrawingObjects){var oContent=this.getDocContent();
|
||||
if(oContent)oContent.GetAllDrawingObjects(DrawingObjects)};CShape.prototype.setSignature=function(oSignature){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetSignature,this.signatureLine,oSignature));this.signatureLine=oSignature};CShape.prototype.setSignaturePr=function(oPr,sUrl){if(!oPr||!this.signatureLine)return;var oCopy=this.signatureLine.copyWithId();oCopy.setProperties(oPr);this.setSignature(oCopy);if(sUrl)if(this.spPr){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sUrl);
|
||||
this.spPr.setFill(oBlipFillUnifill)}};CShape.prototype.convertToWord=function(document){this.setBDeleted(true);var c=new CShape;c.setWordShape(true);c.setBDeleted(false);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());if(this.spPr){c.setSpPr(this.spPr.createDuplicate());if(!c.spPr.geometry)c.spPr.setGeometry(AscFormat.CreateGeometry("rect"));c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.txBody){if(this.txBody.bodyPr)c.setBodyPr(this.txBody.bodyPr.createDuplicate());
|
||||
if(this.txBody.content){var new_content=new CDocumentContent(c,document.DrawingDocument,0,0,0,2E4,false,false,false);var paragraphs=this.txBody.content.Content;new_content.Internal_Content_RemoveAll();for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];var new_paragraph=ConvertParagraphToWord(cur_par,new_content);new_content.Internal_Content_Add(i,new_paragraph,false)}c.setTextBoxContent(new_content)}}if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.convertToPPTX=
|
||||
function(drawingDocument,worksheet,bIsAddMath){var 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){var tx_body=new AscFormat.CTextBody;tx_body.setParent(c);if(this.bodyPr)tx_body.setBodyPr(this.bodyPr.createDuplicate());var new_content=new AscFormat.CDrawingDocContent(tx_body,
|
||||
drawingDocument,0,0,0,0,false,false,true);new_content.Internal_Content_RemoveAll();var paragraphs=this.textBoxContent.Content;var index=0;for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];if(cur_par instanceof Paragraph){var new_paragraph=ConvertParagraphToPPTX(cur_par,drawingDocument,new_content,bIsAddMath);new_content.Internal_Content_Add(index++,new_paragraph,false)}}tx_body.setContent(new_content);c.setTxBody(tx_body)}if(worksheet)if(this.signatureLine)c.setSignature(this.signatureLine.copy());
|
||||
return c};CShape.prototype.handleAllContents=function(fCallback){var content=this.getDocContent();if(content)fCallback(content)};CShape.prototype.documentGetAllFontNames=function(AllFonts){var content=this.getDocContent();if(content)content.Document_Get_AllFontNames(AllFonts)};CShape.prototype.documentCreateFontMap=function(map){var content=this.getDocContent();if(content)content.Document_CreateFontMap(map)};CShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
||||
AscDFH.historyitem_ShapeSetNvSpPr,this.nvSpPr,pr));this.nvSpPr=pr};CShape.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetSpPr,this.spPr,spPr));this.spPr=spPr};CShape.prototype.setStyle=function(style){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetStyle,this.style,style));this.style=style;var content=this.getDocContent();this.recalcInfo.recalculateShapeStyleForParagraph=true;if(this.recalcTextStyles)this.recalcTextStyles();
|
||||
if(content)content.Recalc_AllParagraphs_CompiledPr()};CShape.prototype.setTxBody=function(txBody){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTxBody,this.txBody,txBody));this.txBody=txBody};CShape.prototype.setTextBoxContent=function(textBoxContent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTextBoxContent,this.textBoxContent,textBoxContent));this.textBoxContent=textBoxContent};CShape.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,
|
||||
AscDFH.historyitem_ShapeSetBodyPr,this.bodyPr,pr));this.bodyPr=pr;this.recalcInfo.recalculateContent=true;this.recalcInfo.recalculateTransformText=true;this.addToRecalculate()};CShape.prototype.createTextBody=function(){var tx_body=new AscFormat.CTextBody;tx_body.setParent(this);tx_body.setContent(new AscFormat.CDrawingDocContent(tx_body,this.getDrawingDocument(),0,0,0,2E4,false,false,true));var oBodyPr=new AscFormat.CBodyPr;if(this.worksheet){oBodyPr.vertOverflow=AscFormat.nOTClip;oBodyPr.horzOverflow=
|
||||
AscFormat.nOTClip}tx_body.setBodyPr(oBodyPr);tx_body.content.Content[0].Set_DocumentIndex(0);tx_body.content.MoveCursorToStartPos(false);this.setTxBody(tx_body)};CShape.prototype.createTextBoxContent=function(){var body_pr=new AscFormat.CBodyPr;body_pr.setAnchor(1);this.setBodyPr(body_pr);this.setTextBoxContent(new CDocumentContent(this,this.getDrawingDocument(),0,0,0,2E4,false,false));this.textBoxContent.SetParagraphAlign(AscCommon.align_Center);this.textBoxContent.MoveCursorToStartPos(false);this.textBoxContent.Content[0].Set_DocumentIndex(0)};
|
||||
CShape.prototype.paragraphAdd=function(paraItem,bRecalculate){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent()}if(content_to_add)content_to_add.AddToParagraph(paraItem,bRecalculate)};CShape.prototype.applyTextFunction=function(docContentFunction,tableFunction,args){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();
|
||||
else this.createTextBody();content_to_add=this.getDocContent();content_to_add.MoveCursorToStartPos()}if(content_to_add)docContentFunction.apply(content_to_add,args);if(!editor||!editor.noCreatePoint||editor.exucuteHistory)this.checkExtentsByDocContent()};CShape.prototype.clearContent=function(){var content=this.getDocContent();if(content){content.Set_ApplyToAll(true);content.Remove(-1);content.AddToParagraph(new AscCommonWord.ParaTextPr({Lang:{Val:undefined}}),false);content.Set_ApplyToAll(false)}};
|
||||
CShape.prototype.getDocContent=function(){if(this.txBody)return this.txBody.content;else if(this.textBoxContent)return this.textBoxContent;return null};CShape.prototype.getBodyPr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.bWordShape){var ret=new AscFormat.CBodyPr;ret.setDefault();if(this.bodyPr)ret.merge(this.bodyPr);return ret}else{if(this.txBody&&this.txBody.bodyPr)return this.txBody.getCompiledBodyPr();var ret=new AscFormat.CBodyPr;ret.setDefault();return ret}},this,[])};CShape.prototype.GetRevisionsChangeElement=
|
||||
function(SearchEngine){var oContent=this.getDocContent();if(oContent)oContent.GetRevisionsChangeElement(SearchEngine)};CShape.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.textBoxContent){var dd=this.getDrawingDocument();dd.StartSearchTransform(this.transformText);this.textBoxContent.Search(Str,Props,SearchEngine,Type);dd.EndSearchTransform()}else if(this.txBody&&this.txBody.content)this.txBody.content.Search(Str,Props,SearchEngine,Type)};CShape.prototype.GetSearchElementId=function(bNext,
|
||||
bCurrent){if(this.textBoxContent)return this.textBoxContent.GetSearchElementId(bNext,bCurrent);else if(this.txBody&&this.txBody.content)return this.txBody.content.GetSearchElementId(bNext,bCurrent);return null};CShape.prototype.documentUpdateRulersState=function(){var content=this.getDocContent();if(!content)return;var xc,yc;var l,t,r,b;var body_pr=this.getBodyPr();var l_ins,t_ins,r_ins,b_ins;if(typeof body_pr.lIns==="number")l_ins=body_pr.lIns;else l_ins=2.54;if(typeof body_pr.tIns==="number")t_ins=
|
||||
body_pr.tIns;else t_ins=1.27;if(typeof body_pr.rIns==="number")r_ins=body_pr.rIns;else r_ins=2.54;if(typeof body_pr.bIns==="number")b_ins=body_pr.bIns;else b_ins=1.27;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){l=this.spPr.geometry.rect.l+l_ins;t=this.spPr.geometry.rect.t+t_ins;r=this.spPr.geometry.rect.r-r_ins;b=this.spPr.geometry.rect.b-b_ins}else{l=l_ins;t=t_ins;r=this.extX-r_ins;b=this.extY-b_ins}var x_lt,y_lt,x_rt,y_rt,x_rb,y_rb,x_lb,y_lb;var tr=this.transform;
|
||||
x_lt=tr.TransformPointX(l,t);y_lt=tr.TransformPointY(l,t);x_rb=tr.TransformPointX(r,b);y_rb=tr.TransformPointY(r,b);xc=(x_lt+x_rb)*.5;yc=(y_lt+y_rb)*.5;var hc=(r-l)*.5;var vc=(b-t)*.5;this.getDrawingDocument().Set_RulerState_Paragraph({L:xc-hc,T:yc-vc,R:xc+hc,B:yc+vc});content.Document_UpdateRulersState(AscFormat.isRealNumber(this.selectStartPage)?this.selectStartPage:0)};CShape.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetParent,
|
||||
this.parent,parent));this.parent=parent};CShape.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetGroup,this.group,group));this.group=group};CShape.prototype.getAllImages=function(images){if(this.spPr&&this.spPr.Fill&&this.spPr.Fill.fill instanceof AscFormat.CBlipFill&&typeof this.spPr.Fill.fill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.spPr.Fill.fill.RasterImageId)]=true};CShape.prototype.getAllFonts=function(fonts){if(this.txBody){this.txBody.content.Document_Get_AllFontNames(fonts);
|
||||
if(this.txBody&&this.txBody.lstStyle)this.txBody.lstStyle.Document_Get_AllFontNames(fonts);delete fonts["+mj-lt"];delete fonts["+mn-lt"];delete fonts["+mj-ea"];delete fonts["+mn-ea"];delete fonts["+mj-cs"];delete fonts["+mn-cs"]}};CShape.prototype.canFill=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.canFill();return true};CShape.prototype.isShape=function(){return true};CShape.prototype.isImage=function(){return false};CShape.prototype.isChart=function(){return false};CShape.prototype.isGroup=
|
||||
function(){return false};CShape.prototype.getHierarchy=function(bIsSingleBody,info){{this.compiledHierarchy=[];if(this.parent){var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body;if(AscFormat.isRealBool(bIsSingleBody))b_is_single_body=bIsSingleBody;else b_is_single_body=this.getIsSingleBody&&this.getIsSingleBody();switch(this.parent.kind){case AscFormat.TYPE_KIND.SLIDE:{hierarchy.push(this.parent.Layout.getMatchingShape(ph_type,
|
||||
ph_index,b_is_single_body,info));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.NOTES:{if(this.parent.Master)hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}}}this.recalcInfo.recalculateShapeHierarchy=true}}return this.compiledHierarchy};CShape.prototype.getPaddings=function(){var paddings=
|
||||
null;var shape=this;var body_pr;if(shape.txBody)if(shape.txBody.compiledBodyPr)body_pr=shape.txBody.compiledBodyPr;else body_pr=shape.txBody.getCompiledBodyPr();else if(shape.textBoxContent)body_pr=shape.bodyPr;if(body_pr){paddings=new Asc.asc_CPaddings;if(typeof body_pr.lIns==="number")paddings.Left=body_pr.lIns;else paddings.Left=2.54;if(typeof body_pr.tIns==="number")paddings.Top=body_pr.tIns;else paddings.Top=1.27;if(typeof body_pr.rIns==="number")paddings.Right=body_pr.rIns;else paddings.Right=
|
||||
2.54;if(typeof body_pr.bIns==="number")paddings.Bottom=body_pr.bIns;else paddings.Bottom=1.27}return paddings};CShape.prototype.getCompiledFill=function(){if(this.recalcInfo.recalculateFill){this.compiledFill=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){if(this.spPr.Fill.fill instanceof AscFormat.CGradFill&&this.spPr.Fill.fill.colors.length===0){var parent_objects=this.getParentObjects();var theme=parent_objects.theme;var fmt_scheme=theme.themeElements.fmtScheme;
|
||||
var fill_style_lst=fmt_scheme.fillStyleLst;for(var i=fill_style_lst.length-1;i>-1;--i)if(fill_style_lst[i]&&fill_style_lst[i].fill instanceof AscFormat.CGradFill){this.spPr.Fill=fill_style_lst[i].createDuplicate();break}}this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&&this.compiledFill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=
|
||||
group_compiled_fill.createDuplicate();else this.compiledFill=null}else this.compiledFill=null}else if(isRealObject(this.group)){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=
|
||||
hierarchy[i].spPr.Fill.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}this.recalcInfo.recalculateFill=false}return this.compiledFill};CShape.prototype.getMargins=function(){if(this.txBody)return this.txBody.getMargins();else return null};
|
||||
CShape.prototype.Document_UpdateRulersState=function(margins){if(this.txBody&&this.txBody.content)this.txBody.content.Document_UpdateRulersState(this.parent.num,this.getMargins())};CShape.prototype.getCompiledLine=function(){if(this.recalcInfo.recalculateLine){this.compiledLine=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.ln)&&isRealObject(this.spPr.ln))this.compiledLine=this.spPr.ln.createDuplicate();else if(isRealObject(this.group)){var group_compiled_line=this.group.getCompiledLine();
|
||||
if(isRealObject(group_compiled_line)&&isRealObject(group_compiled_line.fill))this.compiledLine=group_compiled_line.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&
|
||||
isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}this.recalcInfo.recalculateLine=false}return this.compiledLine};CShape.prototype.getCompiledTransparent=function(){if(this.recalcInfo.recalculateTransparent){this.compiledTransparent=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill))if(AscFormat.isRealNumber(this.spPr.Fill.transparent))this.compiledTransparent=this.spPr.Fill.transparent;else if(this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.type===
|
||||
c_oAscFill.FILL_TYPE_GRP)if(this.group&&this.group.spPr&&this.group.spPr.Fill&&AscFormat.isRealNumber(this.group.spPr.Fill.transparent))this.compiledTransparent=this.group.spPr.Fill.transparent;if(null!==this.compiledTransparent){this.recalcInfo.recalculateTransparent=false;return this.compiledTransparent}if(isRealObject(this.group)){var group_transparent=this.group.getCompiledTransparent();if(AscFormat.isRealNumber(group_transparent))this.compiledTransparent=group_transparent;else{var hierarchy=
|
||||
this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=hierarchy[i].spPr.Fill.transparent;break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=
|
||||
hierarchy[i].spPr.Fill.transparent;break}}this.recalcInfo.recalculateTransparent=false}return this.compiledTransparent};CShape.prototype.isPlaceholder=function(){return isRealObject(this.nvSpPr)&&isRealObject(this.nvSpPr.nvPr)&&isRealObject(this.nvSpPr.nvPr.ph)};CShape.prototype.getPlaceholderType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPlaceholderIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.getPhType=
|
||||
function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPhIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.setVerticalAlign=function(align){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();
|
||||
new_body_pr.anchor=align;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setVert=function(vert){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vert=vert;if(this.bWordShape)this.setBodyPr(new_body_pr);
|
||||
else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent&&this.checkExtentsByDocContent()};CShape.prototype.setTextFitType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.textFit=new AscFormat.CTextFit;new_body_pr.textFit.type=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};
|
||||
CShape.prototype.setVertOverflowType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vertOverflow=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};CShape.prototype.setPaddings=function(paddings){if(paddings){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();
|
||||
if(AscFormat.isRealNumber(paddings.Left))new_body_pr.lIns=paddings.Left;if(AscFormat.isRealNumber(paddings.Top))new_body_pr.tIns=paddings.Top;if(AscFormat.isRealNumber(paddings.Right))new_body_pr.rIns=paddings.Right;if(AscFormat.isRealNumber(paddings.Bottom))new_body_pr.bIns=paddings.Bottom;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}}};CShape.prototype.recalculateTransformText=function(){var oContent=this.getDocContent();if(!oContent)return;
|
||||
var oBodyPr=this.getBodyPr();this.clipRect=this.checkTransformTextMatrix(this.localTransformText,oContent,oBodyPr,false);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText);if(this.txBody&&this.txBody.content2){this.transformText2=new CMatrix;this.clipRect2=this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,oBodyPr,false);this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)}var bNoTextNoShape=
|
||||
oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.preset!=="textNoShape";{this.localTransformTextWordArt=new CMatrix;this.checkTransformTextMatrix(this.localTransformTextWordArt,oContent,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt=this.localTransformTextWordArt.CreateDublicate();this.invertTransformTextWordArt=global_MatrixTransformer.Invert(this.transformTextWordArt)}if(this.txBody&&this.txBody.content2){this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,
|
||||
oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt2=new CMatrix;this.checkTransformTextMatrix(this.transformTextWordArt2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape)}if(this.checkPosTransformText)this.checkPosTransformText();if(this.checkContentDrawings)this.checkContentDrawings()};CShape.prototype.getFullFlip=function(){var _transform=this.localTransform;var _full_rotate=this.getFullRotate();var _full_pos_x_lt=_transform.TransformPointX(0,
|
||||
0);var _full_pos_y_lt=_transform.TransformPointY(0,0);var _full_pos_x_rt=_transform.TransformPointX(this.extX,0);var _full_pos_y_rt=_transform.TransformPointY(this.extX,0);var _full_pos_x_rb=_transform.TransformPointX(this.extX,this.extY);var _full_pos_y_rb=_transform.TransformPointY(this.extX,this.extY);var _rotate_matrix=new CMatrix;global_MatrixTransformer.RotateRadAppend(_rotate_matrix,_full_rotate);var _rotated_pos_x_lt=_rotate_matrix.TransformPointX(_full_pos_x_lt,_full_pos_y_lt);var _rotated_pos_x_rt=
|
||||
_rotate_matrix.TransformPointX(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rt=_rotate_matrix.TransformPointY(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rb=_rotate_matrix.TransformPointY(_full_pos_x_rb,_full_pos_y_rb);return{flipH:_rotated_pos_x_lt>_rotated_pos_x_rt,flipV:_rotated_pos_y_rt>_rotated_pos_y_rb}};CShape.prototype.recalculateTransformText2=function(){if(this.txBody===null)return;if(!this.txBody.content2)return;this.transformText2=new CMatrix;var _text_transform=this.transformText2;
|
||||
var _shape_transform=this.transform;var _body_pr=this.txBody.getBodyPr();var _content_height=this.txBody.getSummaryHeight2();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;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var _rect=this.spPr.geometry.rect;_l=_rect.l+_body_pr.lIns;_t=_rect.t+_body_pr.tIns;_r=_rect.r-_body_pr.rIns;_b=_rect.b-_body_pr.bIns}else{_l=_body_pr.lIns;_t=_body_pr.tIns;_r=this.extX-_body_pr.rIns;_b=this.extY-
|
||||
_body_pr.bIns}if(_l>=_r){var _c=(_l+_r)*.5;_l=_c-.01;_r=_c+.01}if(_t>=_b){_c=(_t+_b)*.5;_t=_c-.01;_b=_c+.01}_t_x_lt=_shape_transform.TransformPointX(_l,_t);_t_y_lt=_shape_transform.TransformPointY(_l,_t);_t_x_rt=_shape_transform.TransformPointX(_r,_t);_t_y_rt=_shape_transform.TransformPointY(_r,_t);_t_x_lb=_shape_transform.TransformPointX(_l,_b);_t_y_lb=_shape_transform.TransformPointY(_l,_b);_t_x_rb=_shape_transform.TransformPointX(_r,_b);_t_y_rb=_shape_transform.TransformPointY(_r,_b);var _dx_t,
|
||||
_dy_t;_dx_t=_t_x_rt-_t_x_lt;_dy_t=_t_y_rt-_t_y_lt;var _dx_lt_rb,_dy_lt_rb;_dx_lt_rb=_t_x_rb-_t_x_lt;_dy_lt_rb=_t_y_rb-_t_y_lt;var _vertical_shift;var _text_rect_height=_b-_t;var _text_rect_width=_r-_l;if(!_body_pr.upright){if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_height;break}case 1:{_vertical_shift=(_text_rect_height-_content_height)*
|
||||
.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){var alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lt,_t_y_lt)}else{alpha=
|
||||
Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}}else{if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_width-_content_height;break}case 1:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 4:{_vertical_shift=0;
|
||||
break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI*.5-_alpha);
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lt,_t_y_lt)}else if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lb,_t_y_lb)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*.5-_alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rb,_t_y_rb)}}if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var rect=
|
||||
this.spPr.geometry.rect;this.clipRect={x:-1,y:rect.t,w:this.extX+2,h:rect.b-rect.t}}else this.clipRect={x:-1,y:0,w:this.extX+2,h:this.extY}}else{var _full_rotate=this.getFullRotate();var _full_flip=this.getFullFlip();var _hc=this.extX*.5;var _vc=this.extY*.5;var _transformed_shape_xc=this.transform.TransformPointX(_hc,_vc);var _transformed_shape_yc=this.transform.TransformPointY(_hc,_vc);var _content_width,content_height2;if(checkNormalRotate(_full_rotate))if(!(_body_pr.vert===AscFormat.nVertTTvert||
|
||||
_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){_content_width=_r-_l;content_height2=_b-_t}else{_content_width=_b-_t;content_height2=_r-_l}else if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){_content_width=_b-_t;content_height2=_r-_l}else{_content_width=_r-_l;content_height2=_b-_t}if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=content_height2-_content_height;break}case 1:{_vertical_shift=
|
||||
|
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 504 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 6.0 KiB |