Merge branch 'staging' into hide-kanban-controls

This commit is contained in:
ansuz 2021-05-07 18:18:57 +05:30
commit f0eef49522
4358 changed files with 13824 additions and 2827 deletions

View file

@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
about: Report a bug in the software
title: ''
labels: ''
assignees: ''

View file

@ -0,0 +1,57 @@
---
name: Initial instance configuration
about: Difficulty configuring a CryptPad instance
title: CONFIG
labels: configuration
assignees: ''
---
We receive many issues from people that have tried to set up a new CryptPad instance that does not load any of the interactive editors or which mostly works but has particular problems with the sheet editor.
Before you create an issue:
## Confirm that the problem stems from your instance and not from your browser
Not all browsers support CryptPad correctly, and various browser extensions interfere with its intended behaviour.
https://CryptPad.fr is a good reference point that you can use to confirm that your browser can load a correctly configured instance. If you can't load CryptPad.fr then the problem may be with your browser, its configuration, or one of its active extensions.
## See your instance's checkup page
If your instance is able to at least partially load some pages then you should be able to access the diagnostic page `http(s)://<your-domain>/checkup/`. It will perform some automated tests of your instance's configuration and will provide hints indicating:
1. what is incorrect about your configuration
2. what to change in order to correct the problem
## Write down the exact steps you followed to configure your instance
0. Provide the URL of the guide you followed
1. Confirm that your system has the necessary pre-requisites
* Did you fetch the source code with `git` as recommended?
* Have you installed the recommend version of Nodejs (12.14.0) using [NVM](https://github.com/nvm-sh/nvm)?
* Have you installed `bower` using `npm`?
* Have you fetched the latest source code? Run `git branch` and confirm that it returns either `main` or [the latest of our releases](github.com/xwiki-labs/cryptpad/releases/latest).
2. Did you copy `cryptpad/config/config.example.js` to `cryptpad/config/config.js`, read the comments, and edit the fields which are described as being necessary for a production environment?
3. Did you restart the application server (`server.js`) after making configuration changes?
4. Are you running NGINX as a reverse proxy as we recommend?
5. Have you generated an SSL certificate that is valid for both the domains that are required by the sandboxing system?
6. Do the domains in your NGINX conf match those in `cryptpad/config/config.js`?
## Review the steps you took
If the answer to any of the above questions is _No_ then that is the most likely cause of your difficulty.
Identifying the problem on your own reduces the time we spend answering GitHub issues and leaves more time to fix actual bugs and develop new features.
## Create a detailed report
If you believe you've done all of those steps correctly then proceed with creating an issue with the following:
0. A concise description of the problem you're experiencing and why you believe it stems from a bug in the software and not a configuration issue
1. The list of all the steps you wrote down when following our instructions above
2. A link to your instance so we can easily load your `/checkup/` page for ourselves
3. A list of any errors visible in your browser's console on whichever page is not behaving as expected
4. A list of any further steps you've taken to debug the problem on your own
Finally, remove the text of this issue template and leave only the content you've written.

View file

@ -1,50 +1,164 @@
# Pending
# WIP
* PRs
* comment config.js about supporting multiple domains in httpUnsafeOrigin
* add decreePath
* explicitly pass archivePath when initializing stores
* fix incorrect API in `scripts/migrations/migrate-tasks-v1.js`
* login/register
* delete login block when deleting account
* more careful checks when changing user password
* checkup page
* fixed typo
* progress bar
* test
* websockets
* sandbox CSP
* login block
* admin page
* support responses to closed tickets
* collapse very long messages
* open properties menu for pads that aren't stored in your drive
* help menu that only links to docs
* remove unused (nested) keys
* display survey URL
* support 'KB' in Util.magnitudeOfBytes
* degraded mode
* decide on a number
* sheets
* fix naming collisions between images in spreadsheets
* degraded mode not supported
* getPropChannels
* pinning?
* oo rebuild
* OnlyOffice v6.2
* some buttons that we were hiding have new ids and needed to be hidden again
* translations
* updated catch-phrase (Collaboration suite\nend-to-end-encrypted and open-source
* CKEditor
* cursor jump when clicking on a comment bubble
* keybindings for common styles
* test if this affects scroll position (it shouldn't)
* check that CTRL-space doesn't mess with anything and that it is what Google uses
* test on Mac
* nodrive
* load anonymous accounts without creating a drive
* faster load time, less junk on the server
* fix opening links from temporary shared folders on iphone or other contexts that do not support shared workers
* add checkup test for disabling google FLoC
* update lodash devDependency
# 4.5.0
## Goals
This release cycle we aimed to complete three major milestones: the official release of our calendar app, the ability for admins to close registration on their instance, and the deployment of the admin section of our [official documentation](https://docs.cryptpad.fr/en/admin_guide/index.html). We spent the remainder of our time addressing a growing backlog of issues on GitHub by fixing a number of weird bugs.
## Update notes
This release includes a new GitHub issue template (`cryptpad/.github/ISSUE_TEMPLATE/initial-instance-configuration.md`). The intent of this file is to make it clear that _Bug Reports_ are for intended for bugs in the software itself, not for soliciting help in configuring your personal server. Such issues take away time that we'd rather spend improving the platform for everybody's benefit, rather than for single administrators.
Sometimes difficulty configuring an instance does stem from an actual bug, however, most of the time these issues relate to the use of an unsupported configuration or failure to correctly follow installation instructions. The issue template includes some basic debugging steps which should identify the vast majority of problems. Beyond its primary goal of narrowing the scope of our issue tracker, we hope it will also be useful as an offline reference for administrators attempting to debug their instance.
This template references the /checkup/ page that we've been steadily improving over the last few releases. It now includes even more tests to diagnose instance configuration problems, each with their own messages that provide some fairly detailed hints about what is wrong when an error is detected. This release introduces a number of tests that print _warnings_ that won't break an instance but might detract from users' experience. We recommend checking this page on your instance with each release as we will continue to improve it on an regular basis, and it might detect some errors of which you were unaware.
Otherwise, this release includes some changes to the provided example NGINX config file. It now includes a header designed to disable clients' participation in Google's [FLoC network](https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea), as well as some basic rules related to the addition of our calendar app and OnlyOffice's two remaining editors (which are still not officially supported despite their inclusion here).
Lastly, any instance administrators that have had to customize their instance in order to disable registration can instead rely on a built-in feature that is available on the main page of the admin panel. Checking the "Close registration" checkbox will cause the application server to reject the creation of new "login blocks" (which store users' encrypted account credentials) while permitting existing users to change their passwords. Clients will be informed that registration is closed via the `/api/config` endpoint, causing the registration page to display a notice instead of the usual form. You may need to use the `FLUSH CACHE` button which can found on the same page of the admin panel in order to force clients to load the updated server config.
To update from 4.4.0 to 4.5.0:
1. Apply the documented NGINX configuration
2. Stop your server
3. Get the latest code with git
4. Install the latest dependencies with `bower update` and `npm i`
5. Restart your server
## Features
* We included a first version of our new calendar app in our last release, however, it was only accessible by URL as there were no links to it in the UI. We've spent time implementing the basic features we expect of any of our apps, including translated UI text (the first version was mostly for us to test) and the ability to import/export .ics files (via ical.js), and the ability to view and store a calendar shared via its URL. It also introduces support for configurable reminders (which can be disabled via the _notifications_ panel of your settings page) and fixes a number of style issues that occurred on small screens. You can access the calendar app via the _user admin menu_ found at the top-right corner of your screen.
* The _What-is-CryptPad_ page now includes the logo of our latest sponsor: [NGI DAPSI](https://dapsi.ngi.eu) (the Data and Portability Services Incubator). DAPSI is another branch of the European Next Generation Internet initiative which has already done so much for our project. Over the next nine months we will use their funding and mentorship to improve CryptPad's interoperability with other services via support for open and de-facto file formats and increasingly intuitive workflows for import and export of your documents. There is already a lot of demand for this functionality, so we're very grateful to finally have the support necessary to take on this big project.
* We've merged a contribution that implements a preference for the rich text editor to open links in a single click instead of treating them as text with a clickable bubble that contains a link. This can be configured on the rich text panel of your settings page.
* The _File_ menu in our apps now includes a _Store in CryptDrive_. This option appears when you have not already stored the document you are currently viewing and when the prompt to store the file has been dismissed or intentionally suppressed via the _never ask_ setting for pad storage.
* We've added support for the display of a configurable _Roadmap_ URL in the footer that can be found on our static pages. This is included mostly for our own purposes of increasing the visibility of the project's planned development, but administrators can also use it however they want to keep their own users informed of their upcoming plans. This value can be set via the host instance's `customize/application_config.js`. An example is included in `cryptpad/www/common/application_config_internal.js`.
* Following the addition of some basic telemetry in our 4.3.1 release we observed that about 20% of newly registered users actually opened the _What is CryptPad_ document which was automatically created in their drive. As such, we've removed the code responsible for its creation along with the translations of its text. New users will instead be directed to read our docs.
## Bug fixes
* Our 4.4.0 release included functionality allowing administrators to broadcast notifications to all the users of their instance. Since then, we noticed that clients were incorrectly "pinning" the log file which stores a record of all messages broadcast in this fashion. In other words, they were informing the server that it should continue to store this file on their behalf and that its size should count against their storage quota. We added an explicit exception to code responsible for generating the list of documents that should be "pinned".
* Right-clicking on rendered markdown extensions in the code editor's preview pane opens a custom menu that offers some basic options. This menu incorrectly displayed some options that were appropriate for encrypted uploads, but not for other extensions such _markmap_, _mathjax_, and _mermaid_. We now handle these explicitly and provide options to export to the relevant image format.
* In one more example of a long list of browser quirks that have broken CryptPad in bizarre ways, we learned that the web engine that used by all browsers available for iPhone incorrectly handles click events on elements that contain buttons. Rather than emitting a single click event in response to user action, the engine seems to emit an event for each sibling _button_ tag regardless of whether it is visible. The HTML structure of the list/grid view mode toggle in the drive caused the engine to emit two click events, immediately toggling the view mode away from and back to its original state. Since Apple has an anti-competitive policy requiring every browser to use the engine they provide (as opposed to independent ones which include speed-boosting optimizations, modern features, and frequent bug fixes), this means that iPhone users could not switch to an alternative. Anyway, we changed the HTML structure that was working well in literally every other browser to make this better for iPhone users.
* There were some CSS selectors in the code app that caused the preview pane to be hidden on narrow screens. This rule is no longer applied when the client loads in embed/present mode, which disable all other UI to display only the preview pane.
* We identified and addressed an unhandled error on the registration page which could have caused clients to act as though the upload of their accounts encrypted credentials had succeeded when it had not. This could result in the inability to access their content on successive login attempts.
* The whiteboard editor allows users to upload images for inclusion in their whiteboard up to a certain size. It was brought to our attention that the enforced size limit was compared against the size of the image after it had been encoded, while the resulting error message suggested that it was measuring the size of the image as uploaded. We've updated this limit to account for the encoding's overhead.
* We've added some extra error handling to diffDOM, the library we use to compute and apply a minimal set of patches to a document. It was brought to our attention that it did not correctly parse and compare some input that is valid in the HTML dialect used to display emails but does not commonly occur in modern browsers. This crashed the renderer with a DOMException error when it tried to apply the malformed attribute.
* Lastly, as usual, we've received a variety of questions and bug reports related to spreadsheets. We've added some guards to prevent the creation of invalid checkpoints. If a generated checkpoint is larger than the maximum file size limit allowed for a particular user we avoid successive attempts to upload within that same session, which avoids spamming the user with repeated warnings of failed uploads. We updated the notice that informs users when conversion to Office formats is not supported in their browser to recommend a recent version of Firefox or Chrome, and displayed the same notice when importing. We also updated the function which checks whether the APIs required for conversion were present, as it checked for SharedArrayBuffers and Atomics but not WebAssembly, all of which are necessary. Finally, we made some minor changes that allow the sheet editor to lock and unlock faster when a checkpoint is loaded and applied, resulting in less disruption to the user's work.
# 4.4.0
## Goals
Our main goal for this release was to complete the first steps of our ["Dialogue" project](https://nlnet.nl/project/CryptPadForms/), which will introduce surveys into CryptPad. We've also put considerable effort towards addressing some configuration issues, correcting some inconsistently translated UI, and writing some new documentation.
## Update notes
This release removes the default privacy policy that has been included in CryptPad up until now. It included some assertions that were true of our own instance (CryptPad.fr) which we couldn't guarantee on third-party instances. We've updated our custom configuration to link to a privacy policy that was written in a rich text pad. You can do the same on your instance by editing `cryptpad/customize/application_config.js` to include the absolute URL of your instance, like so: `AppConfig.privacy = "https://cryptpad.your.website/privacy.html";`.
We've clarified a point about telemetry in the notes of our 4.3.1 release. The text suggested that users on your instance would send telemetry to OUR webserver. It has been clarified to reflect that telemetry from your users is only ever sent to your instance.
We've spent some time working on improving our (officially) unreleased integrations of OnlyOffice's presentation and document editors. We've advised against enabling these editors on your instance. This release includes changes that may not be fully backwards compatible. If your users rely on either editor we advise that you not update until they have had an opportunity to back up their documents. We still aren't officially supporting either editor and we may make further breaking changes in the future. Consider this a warning and not an advertizement of their readiness!
This release also includes changes to the recommended NGINX configuration. Compare your instance's config against `cryptpad/docs/example.nginx.conf` and apply all the new changes before updating. In particular, you'll want to pay attention to the configuration for a newly exposed server API (`/api/broadcast`). This should work much the same as `/api/config`, so if you're using a non-standard configuration that uses more than one server you may want to proxy it in a similar fashion.
Lastly, we've made some big improvements to the `/checkup/` page which performs some basic tests to confirm that your instance is configured correctly. It now provides some much more detailed descriptions of what might be wrong and how you can start debugging any issues that were identified. If you experience any problems after updating please review this page to assess your instance for any known issues before asking for help.
To update from 4.3.1 to 4.4.0:
1. Apply the documented NGINX configuration
2. Stop your server
3. Get the latest code with git
4. Install the latest dependencies with `bower update` and `npm i`
5. Restart your server
This release requires updates to both clientside and serverside dependencies. **You will experience problems if you skip any of the above steps.**
## Features
* 4.4.0 includes a basic version of a calendar app. There are no links to it anywhere in the platform, its translations are hardcoded, and its title includes the text **BETA**. It's included in this release so that we can test and improve it for the next release, however, it should not be considered stable. Use it at your own risk! Our plan for this app is to offer the ability to set and review reminders for deadlines in CryptPad. We haven't secured funding for more advanced functionality, however, our team is available for sponsored development if you'd like to provide funding to include such improvements in our short-term roadmap.
* The admin panel now includes several closely related features in its "broadcast" tab, which allows administrators to send a few types of notifications to all users:
1. _Maintenance notices_ inform users that the service may be unavailable during a specified time range.
2. _Survey notices_ inform users that the instance administrators have published a new survey and would like their feedback. We plan to use this on CryptPad.fr to perform some voluntary user studies on an ongoing basis.
3. _Broadcast messages_ allow admins to send all users a custom message with optional localization in their users' preferred language.
* The drive now includes a "Getting started" message and a link to our docs, like all our other apps. This replaces the creation of a personal "What is CryptPad" pad in the user's drive when they register.
* We recently wrote some scripts to automatically review our translations. This exposed some inconsistencies and incorrectly applied attributes in translations that included HTML. Since it's not reasonable to expect translators to know HTML, we've taken some steps to remove all but the most basic markup from translatable messages. Instead, more advanced attributes are applied via JavaScript. This makes it easier than ever to translate CryptPad as well as providing a more consistent experience to those using translations written by contributors.
## Bug fixes
* Premium users are now prompted to cancel their subscriptions before deleting their accounts.
* The /logout/ page will now clear users' local document cache. Admins can recommend that users try loading this page when users are mysteriously unable to load their drive (or that of a team). If you find that this solves a user's problem, please report their exact problem so we can investigate the underlying cause.
* The _support_ page guards against type errors that appear to have been caused by third-party extensions interfering with some browser APIs and rewriting URLs.
* We found that anonymous users who had not created a drive were not able to use the "Make a copy" functionality on a pad that they were viewing. This has been fixed.
* We noticed that under some unknown circumstances it was possible for users to store documents with invalid document IDs in their drive. We've added a few guards that detect these invalid channels and we're working on a solution to automatically repair them, if possible.
* Links to anchors in read-only rich text documents now navigate to the correct section of the document rather than opening a new tab.
* We've made a large number of improvements to our OnlyOffice integration. This will primarily affect the sheet app, but it also paves the way for us to introduce presentations and text documents in a future release.
* We now inform OnlyOffice of user-list changes, which should fix the incorrect display of users names when they lock a portion of a document.
* Text documents and presentations use a different data format than sheets for locking the document. We've adjusted our code to handle these formats.
* We've fixed some lock-related errors in sheets that could be triggered when receiving checkpoints from other users while editing in strict mode.
* We've adjusted some CSS selectors intended to hide parts of OnlyOffice's UI that are invalid within CryptPad, since those elements' IDs have changed since the last version.
* OnlyOffice's cursors now use your CryptPad account's preferred color.
* We now handle some errors that occurred when documents were migrated by a user editing a sheet in embed mode.
* OnlyOffice modified some of the APIs used to lock a document, so we've adjusted our code to match.
* We found and fixed a race condition which could be triggered when loading a shared folder included in more than one of your user or team drives.
# 4.3.1
This minor release addresses some bugs discovered after deploying and tagging 4.3.0
* We found that some browser extensions interfered with checks to determine whether a registered user was correctly logged in, which resulted in some disabled functionality. If you are running extensions that actively delete the tokens that keep you logged your session should now stay alive until you close all its active tabs, after which you will have to log back in.
* Our 4.2.0 update introduced a new internal format for spreadsheets which broke support for spreadsheet templates using the older format. This release implements a compatibility layer.
* We fixed some minor bugs in our rich text editor. Section links in the table of contents now navigate correctly. Adding a comment to a link no longer prevents clicking on that link.
* A race condition that caused poll titles to reset occasionally has been fixed.
* We've added a little bit of telemetry to tell the application server when a newly registered user opens the new user guide which is automatically added to their drive. We're considering either rewriting or removing this guide, so it's helpful to be able to determine how often people actually read it.
* An error introduced in 4.3.0 was preventing the creation of new teams. It's been fixed.
* 4.3.0 temporarily broke the sheet editor for iPad users. Migrations to a new internal format that were run while the editor was in a bad state produced some invalid data that prevented sheets from loading correctly. This release improves the platforms ability to recover from bad states like this and improves its ability to detect the kind of errors we observed.
# 4.3.0 (D)
## Goals
This release is a continuation of our recent efforts to stabilize the platform, fixing small bugs and inconsistencies that we missed when developing larger features. In the meantime we've received reports of the platform performing poorly under various unusual circumstances, so we've developed some targeted fixes to both improve user experience and decrease the load on our server.
## Update notes
This release should be fairly simple for admins.
To update from 4.2.1 to 4.3.0:
1. Stop your server
2. Get the latest code with git
3. Install the latest dependencies with `bower update` and `npm i`
4. Restart your server
## Features
* We're introducing a "degraded mode" for most of our editors (all except polls and sheets). This follows reports we received that CryptPad performed poorly in settings where a relatively large number of users with *edit* rights were connected simultaneously. To alleviate this, some non-essential features will be disabled when a number of concurrent editors is reached, in order to save computing power on client devices. The user-list will stop being updated as users join and leave, users cursors will stop being displayed, and the chat will not be disabled. Sessions will enter this mode when 8 or more editors are present. This threshold can be configured via `customize/application_config.js` by setting a `degradedLimit` attribute.
* CryptPad was recently used to distribute some high-profile documents. For the first time we were able to observe our server supporting more than 1000 concurrent viewers in a single pad and around 350000 unique visitors over the course of a few days. While the distributed document incurred very little load, CryptPad created a drive for each visitor the first time they visited. Most of these drives were presumably abandoned as these users did not return to create or edit their own documents. Such users that directly load an existing document without having previously visited the platform will no longer create a drive automatically, unless they explicitly visit a page which requires it. This behaviour is supported in most of our editors except sheets and polls. This should result in faster load times for new users, but just in case it causes any issues we've made it easy to disable. Instance admins can disable "no-drive mode" via `customize/application_config.js` by setting `allowDrivelessMode` to `false`.
* We've updated our sheet editor to use OnlyOffice 6.2, which includes support for pivot tables, among a range of other improvements.
* Our rich text editor now features some keyboard shortcuts to apply some commonly used styles:
* heading size 1-6: ctrl+alt+1-6
* "div": ctrl+alt+8
* "preformatted": ctrl+alt+9
* paragraph: ctrl+alt+0
* remove styles from selection: ctrl+space
* We've removed a large number of strings that were included in the "Getting started" box that was displayed to new users in each of our editors. Instead, this box simply contains a link to the relevant page in our documentation. Our intent is to both simplify the interface for newcomers and reduce the number of strings that require translation.
* We've continued to progress on our "checkup page" which performs some routine checks to see whether the host instance is correctly configured. While its hints are not especially helpful for admins without reading the code to understand what they are testing, they do detect a fairly wide range of issues and have already helped us to identify some inconsistencies in our recommended configuration. We plan to link directly from this page to the relevant sections of a configuration guide an in upcoming release.
* The admin support ticket interface has been updated to collapse very long messages in response to some ticket threads submitted in the last few weeks. We also found that sometimes we needed more information after a ticket had been closed, so we added the ability to re-open closed tickets.
* Some time ago we removed the "Survey link" option from the user admin dropdown menu (found in the top-right corner of the page). This release re-enables it for instances that explicitly provide a link to a survey, however, we no longer provide a link to a survey by default.
## Bug fixes
* We finally reviewed and merged a number of pull-requests that had been pending for some time. Collectively, they fixed some configuration issues and type errors in some of our older scripts.
* Sheets can now contain multiple images with the same name, whereas before they would conflict and one would be displayed multiple times.
* A recent change in our code to conditionally display size measurements in different magnitudes (GB, MB) removed support for Kilobytes (KB). This release restores the previous behaviour.
* We believe we've identified and corrected an issue that caused the rich text editor to scroll to the top of the document when the button to add a comment was clicked.
* We recently made it such that documents owned by a particular user would not be automatically re-added to that user's drive when they viewed them. This change revealed a number of odd cases where various commands (destroy, add password, get document size, etc.) did not work as expected unless the document was first added to their drive. We reviewed many of these features and corrected the underlying issues that caused these commands to fail.
* We performed a similar review of various commands related to user accounts and identified a number of issues that caused account deletion to fail.
# 4.2.1

View file

@ -41,7 +41,7 @@
"diff-dom": "2.1.1",
"nthen": "0.1.7",
"open-sans-fontface": "^1.4.2",
"bootstrap-tokenfield": "^0.12.1",
"bootstrap-tokenfield": "0.12.1",
"localforage": "^1.5.2",
"html2canvas": "^0.4.1",
"croppie": "^2.5.0",

View file

@ -54,7 +54,7 @@ module.exports = {
* and it may have unintended consequences in practice.
*
*/
httpUnsafeOrigin: 'http://localhost:3000/',
httpUnsafeOrigin: 'http://localhost:3000',
/* httpSafeOrigin is the URL that is used for the 'sandbox' described above.
* If you're testing or developing with CryptPad on your local machine then
@ -162,15 +162,6 @@ module.exports = {
*/
//blockDailyCheck: false,
/*
* By default users get 50MB of storage by registering on an instance.
* You can set this value to whatever you want.
*
* hint: 50MB is 50 * 1024 * 1024
*/
//defaultStorageLimit: 50 * 1024 * 1024,
/* =====================
* STORAGE
* ===================== */
@ -226,29 +217,6 @@ module.exports = {
*/
//maxUploadSize: 20 * 1024 * 1024,
/*
* CryptPad allows administrators to give custom limits to their friends.
* add an entry for each friend, identified by their user id,
* which can be found on the settings page. Include a 'limit' (number of bytes),
* a 'plan' (string), and a 'note' (string).
*
* hint: 1GB is 1024 * 1024 * 1024 bytes
*/
/*
customLimits: {
"[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]": {
limit: 20 * 1024 * 1024 * 1024,
plan: 'insider',
note: 'storage space donated by my.awesome.website'
},
"[cryptpad-user2@my.awesome.website/GdflkgdlkjeworijfkldfsdflkjeEAsdlEnkbx1vVOo=]": {
limit: 10 * 1024 * 1024 * 1024,
plan: 'insider',
note: 'storage space donated by my.awesome.website'
}
},
*/
/* Users with premium accounts (those with a plan included in their customLimit)
* can benefit from an increased upload size limit. By default they are restricted to the same
* upload size as any other registered user.

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

View file

@ -135,10 +135,6 @@ define([
Exports.mergeAnonDrive = 1;
};
var setCreateReadme = function () {
Exports.createReadme = 1;
};
Exports.loginOrRegister = function (uname, passwd, isRegister, shouldImport, cb) {
if (typeof(cb) !== 'function') { return; }
@ -372,7 +368,6 @@ define([
proxy.curvePrivate = opt.curvePrivate;
proxy.login_name = uname;
proxy[Constants.displayNameKey] = uname;
setCreateReadme();
if (shouldImport) {
setMergeAnonDrive();
} else {
@ -397,7 +392,7 @@ define([
// send an RPC to store the block which you created.
console.log("initializing rpc interface");
Pinpad.create(RT.network, RT.proxy, waitFor(function (e, _rpc) {
Pinpad.create(RT.network, Block.keysToRPCFormat(res.opt.blockKeys), waitFor(function (e, _rpc) {
if (e) {
waitFor.abort();
console.error(e); // INVALID_KEYS
@ -419,7 +414,10 @@ define([
var blockRequest = Block.serialize(JSON.stringify(toPublish), res.opt.blockKeys);
rpc.writeLoginBlock(blockRequest, waitFor(function (e) {
if (e) { return void console.error(e); }
if (e) {
console.error(e);
return void cb(e);
}
console.log("blockInfo available at:", blockHash);
LocalStore.setBlockHash(blockHash);
@ -436,9 +434,6 @@ define([
if (Exports.mergeAnonDrive) {
loginOpts.mergeAnonDrive = 1;
}
if (Exports.createReadme) {
loginOpts.createReadme = 1;
}
h = Hash.getLoginURL(h, loginOpts);
var parser = document.createElement('a');
@ -539,6 +534,9 @@ define([
});
});
break;
case 'E_RESTRICTED':
UI.errorLoadingScreen(Messages.register_registrationIsClosed);
break;
default: // UNHANDLED ERROR
hashing = false;
UI.errorLoadingScreen(Messages.login_unhandledError);

View file

@ -120,10 +120,6 @@ define(req, function(AppConfig, Default, Language) {
}
};
messages.driveReadme = '["BODY",{"class":"cke_editable cke_editable_themed cke_contents_ltr cke_show_borders","contenteditable":"true","spellcheck":"false","style":"color: rgb(51, 51, 51);"},' +
'[["H1",{},["'+messages.readme_welcome+'"]],["P",{},["'+messages.readme_p1+'"]],["P",{},["'+messages.readme_p2+'"]],["HR",{},[]],["H2",{},["'+messages.readme_cat1+'",["BR",{},[]]]],["UL",{},[["LI",{},["'+messages._getKey("readme_cat1_l1", ['",["STRONG",{},["'+messages.newButton+'"]],"', '",["STRONG",{},["'+messages.type.pad+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat1_l2+'"]],["LI",{},["'+messages._getKey("readme_cat1_l3", ['",["STRONG",{},["'+messages.fm_unsortedName+'"]],"'])+'",["UL",{},[["LI",{},["'+messages._getKey("readme_cat1_l3_l1", ['",["STRONG",{},["'+messages.fm_rootName+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat1_l3_l2+'"]]]]]],["LI",{},["'+messages._getKey("readme_cat1_l4", ['",["STRONG",{},["'+messages.fm_trashName+'"]],"'])+'",["BR",{},[]]]]]],["P",{},[["BR",{},[]]]],["H2",{},["'+messages.readme_cat2+'",["BR",{},[]]]],["UL",{},[["LI",{},["'+messages._getKey("readme_cat2_l1", ['",["STRONG",{},["'+messages.shareButton+'"]],"', '",["STRONG",{},["'+messages.edit+'"]],"', '",["STRONG",{},["'+messages.view+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat2_l2+'"]]]],["P",{},[["BR",{},[]]]],["H2",{},["'+messages.readme_cat3+'"]],["UL",{},[["LI",{},["'+messages.readme_cat3_l1+'"]],["LI",{},["'+messages.readme_cat3_l2+'"]],["LI",{},["'+messages.readme_cat3_l3+'",["BR",{},[]]]]]]],' +
'{"metadata":{"defaultTitle":"' + messages.driveReadmeTitle + '","title":"' + messages.driveReadmeTitle + '"}}]';
return messages;
});

View file

@ -4,7 +4,8 @@ define([
'/customize/application_config.js',
'/customize/messages.js',
'jquery',
], function (h, Language, AppConfig, Msg, $) {
'/api/config',
], function (h, Language, AppConfig, Msg, $, ApiConfig) {
var Pages = {};
Pages.setHTML = function (e, html) {
@ -12,6 +13,36 @@ define([
return e;
};
Pages.externalLink = function (el, href) {
if (!el) { return el; }
el.setAttribute("rel", "noopener noreferrer");
el.setAttribute("target", "_blank");
if (typeof(href) === 'string') {
el.setAttribute("href", href);
}
return el;
};
// this rewrites URLS to point to the appropriate translation:
// French, German, or English as a default
var documentedLanguages = ['en', 'fr', 'de'];
Pages.localizeDocsLink = function (href) {
try {
var lang = Msg._getLanguage();
if (documentedLanguages.indexOf(lang) > 0) {
return href.replace('/en/', '/' + lang + '/');
}
} catch (err) {
console.error(err);
// if it fails just use the default href (English)
}
return href;
};
Pages.documentationLink = function (el, href) {
return Pages.externalLink(el, Pages.localizeDocsLink(href));
};
var languageSelector = function () {
var options = [];
var languages = Msg._languages;
@ -45,6 +76,7 @@ define([
};
var footLink = function (ref, loc, text) {
if (!ref) { return; }
var attrs = {
href: ref,
};
@ -62,15 +94,29 @@ define([
var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ?
'/imprint.html' : AppConfig.imprint);
Pages.versionString = "v4.3.0";
Pages.versionString = "v4.5.0";
// used for the about menu
Pages.imprintLink = AppConfig.imprint ? footLink(imprintUrl, 'imprint') : undefined;
Pages.privacyLink = footLink(AppConfig.privacy, 'privacy');
Pages.githubLink = footLink('https://github.com/xwiki-labs/cryptpad', null, 'GitHub');
Pages.docsLink = footLink('https://docs.cryptpad.fr', 'docs_link');
Pages.roadmapLink = footLink(AppConfig.roadmap, 'footer_roadmap');
Pages.infopageFooter = function () {
var terms = footLink('/terms.html', 'footer_tos'); // FIXME this should be configurable like the other legal pages
var legalFooter;
// only display the legal part of the footer if it has content
if (terms || Pages.privacyLink || Pages.imprintLink) {
legalFooter = footerCol('footer_legal', [
terms,
Pages.privacyLink,
Pages.imprintLink,
]);
}
return h('footer', [
h('div.container', [
h('div.row', [
@ -96,12 +142,9 @@ define([
footLink('/contact.html', 'contact'),
footLink('https://github.com/xwiki-labs/cryptpad/wiki/Contributors', 'footer_team'),
footLink('http://www.xwiki.com', null, 'XWiki SAS'),
Pages.roadmapLink,
]),
footerCol('footer_legal', [
footLink('/terms.html', 'footer_tos'),
Pages.privacyLink,
Pages.imprintLink,
]),
legalFooter,
])
]),
h('div.cp-version-footer', [
@ -114,10 +157,16 @@ define([
Pages.infopageTopbar = function () {
var rightLinks;
var username = window.localStorage.getItem('User_name');
var registerLink;
if (!ApiConfig.restrictRegistration) {
registerLink = h('a.nav-item.nav-link.cp-register-btn', { href: '/register/'}, Msg.login_register);
}
if (username === null) {
rightLinks = [
h('a.nav-item.nav-link.cp-login-btn', { href: '/login/'}, Msg.login_login),
h('a.nav-item.nav-link.cp-register-btn', { href: '/register/'}, Msg.login_register)
registerLink,
];
} else {
rightLinks = h('a.nav-item.nav-link.cp-user-btn', { href: '/drive/' }, [

View file

@ -7,8 +7,13 @@ define([
], function (Config, h, Msg, Pages, LocalStore) {
return function () {
var adminEmail = Config.adminEmail && Config.adminEmail !== 'i.did.not.read.my.config@cryptpad.fr';
var developerEmail = "contact@cryptpad.fr";
var adminEmail = Config.adminEmail && [
'i.did.not.read.my.config@cryptpad.fr',
developerEmail
].indexOf(Config.adminEmail) === -1;
var adminMailbox = Config.supportMailbox && LocalStore.isLoggedIn();
return h('div#cp-main', [
Pages.infopageTopbar(),
h('div.container.cp-container', [
@ -110,7 +115,7 @@ define([
)
),
h('div.col-12.col-sm-6.col-md-3.col-lg-3',
h('a.card', {href : "mailto:contact@cryptpad.fr"},
h('a.card', {href : "mailto:" + developerEmail},
h('div.card-body',
h('p', [
h('img', {

View file

@ -146,7 +146,7 @@ define([
]),
]);
var availableFeatures =
(Config.allowSubscriptions && accounts.upgradeURL) ?
(Config.allowSubscriptions && accounts.upgradeURL && !Config.restrictRegistration) ?
[anonymousFeatures, registeredFeatures, premiumFeatures] :
[anonymousFeatures, registeredFeatures];

View file

@ -80,6 +80,12 @@ define([
});
}
var supportText = Pages.setHTML(h('span'), Msg.home_support);
Pages.documentationLink(supportText.querySelector('a'), "https://docs.cryptpad.fr/en/how_to_contribute.html");
var opensource = Pages.setHTML(h('p'), Msg.home_opensource);
Pages.externalLink(opensource.querySelector('a'), "https://github.com/xwiki-labs/cryptpad");
var blocks = [
h('div.row.cp-page-section', [
h('div.col-sm-6',
@ -103,7 +109,7 @@ define([
h('div.row.cp-page-section', [
h('div.col-sm-6', [
h('h2', Msg.home_opensource_title),
Pages.setHTML(h('p'), Msg.home_opensource),
opensource,
h('img.small-logo.cp-img-invert', {
src: '/customize/images/logo_AGPLv3.svg',
alt: 'APGL3 License Logo'
@ -111,7 +117,7 @@ define([
]),
h('div.col-sm-6', [
h('h2', Msg.home_support_title),
Pages.setHTML(h('span'), Msg.home_support),
supportText,
subscribeButton,
Pages.crowdfundingButton(function () {
Feedback.send('HOME_SUPPORT_CRYPTPAD');

View file

@ -2,8 +2,9 @@ define([
'/common/hyperscript.js',
'/common/common-interface.js',
'/customize/messages.js',
'/customize/pages.js'
], function (h, UI, Msg, Pages) {
'/customize/pages.js',
'/api/config',
], function (h, UI, Msg, Pages, Config) {
return function () {
return [h('div#cp-main', [
Pages.infopageTopbar(),
@ -32,7 +33,10 @@ define([
]),
h('div.extra', [
h('button.login', Msg.login_login),
h('button#register.cp-secondary', Msg.login_register)
(Config.restrictRegistration?
undefined:
h('button#register.cp-secondary', Msg.login_register)
)
])
]),
h('div.col-md-3')

View file

@ -1,36 +0,0 @@
define([
'/common/hyperscript.js',
'/customize/messages.js',
'/customize/pages.js'
], function (h, Msg, Pages) {
return function () {
return h('div#cp-main', [
Pages.infopageTopbar(),
h('div.container.cp-container.cp-privacy',[
h('div.row.cp-page-title', h('h1', Msg.policy_title)),
h('h2', Msg.policy_whatweknow),
Pages.setHTML(h('p'), Msg.policy_whatweknow_p1),
h('h2', Msg.policy_howweuse),
h('p', Msg.policy_howweuse_p1),
h('p', Msg.policy_howweuse_p2),
h('h2', Msg.policy_whatwetell),
h('p', Msg.policy_whatwetell_p1),
h('h2', Msg.policy_links),
h('p', Msg.policy_links_p1),
h('h2', Msg.policy_ads),
h('p', Msg.policy_ads_p1),
h('h2', Msg.policy_choices),
h('p', Msg.policy_choices_open),
Pages.setHTML(h('p'), Msg.policy_choices_vpn),
]),
Pages.infopageFooter()
]);
};
});

View file

@ -9,11 +9,37 @@ define([
return function () {
var urlArgs = Config.requireConf.urlArgs;
return [h('div#cp-main', [
Pages.infopageTopbar(),
h('div.container.cp-container', [
h('div.row.cp-page-title', h('h1', Msg.register_header)),
h('div.row.cp-register-det', [
var tos = $(UI.createCheckbox('accept-terms')).find('.cp-checkmark-label').append(Msg.register_acceptTerms).parent()[0];
$(tos).find('a').attr({
href: '/terms.html',
target: '_blank',
tabindex: '-1',
});
var frame = function (content) {
return [
h('div#cp-main', [
Pages.infopageTopbar(),
h('div.container.cp-container', [
h('div.row.cp-page-title', h('h1', Msg.register_header)),
//h('div.row.cp-register-det', content),
].concat(content)),
]),
Pages.infopageFooter(),
];
};
if (Config.restrictRegistration) {
return frame([
h('div.cp-restricted-registration', [
h('p', Msg.register_registrationIsClosed),
])
]);
}
return frame([
h('div.row.cp-register-det', [
h('div#data.hidden.col-md-6', [
h('h2', Msg.register_notes_title),
Pages.setHTML(h('div.cp-register-notes'), Msg.register_notes)
@ -47,16 +73,13 @@ define([
UI.createCheckbox('import-recent', Msg.register_importRecent, true)
]),
h('div.checkbox-container', [
$(UI.createCheckbox('accept-terms')).find('.cp-checkmark-label').append(Msg.register_acceptTerms).parent()[0]
tos,
]),
h('button#register', Msg.login_register)
])
]),
]),
]),
Pages.infopageFooter(),
])];
])
]);
};
});

View file

@ -17,6 +17,9 @@ define([
};
return function () {
var xwiki_info = Pages.setHTML(h('span'), Msg.whatis_xwiki_info);
Pages.externalLink(xwiki_info.querySelector('a'), "https://xwiki.com");
return h('div#cp-main', [
Pages.infopageTopbar(),
h('div.container.cp-container', [
@ -52,7 +55,7 @@ define([
h('div.row.cp-page-section', [
h('div.col-md-6', [
Pages.setHTML(h('h2'), Msg.whatis_drive),
Pages.setHTML(h('spam'), Msg.whatis_drive_info),
Pages.setHTML(h('span'), Msg.whatis_drive_info),
]),
h('div.col-md-6', [
h('img.cp-shadow', {
@ -86,12 +89,14 @@ define([
'https://www.mozilla.org/en-US/moss/'),
logoLink('NGI Trust logo', '/customize/images/logo_ngi_trust.png',
'https://www.ngi.eu/ngi-projects/ngi-trust/'),
logoLink('NGI DAPSI LOGO', '/customize/images/logo_ngi_dapsi.png',
'https://dapsi.ngi.eu/'),
]),
]),
h('div.row.cp-page-section', [
h('div.col-md-6', [
Pages.setHTML(h('h2'), Msg.whatis_xwiki),
Pages.setHTML(h('spam'), Msg.whatis_xwiki_info),
xwiki_info,
]),
h('div.col-md-6.small-logos', [
h('img', {

View file

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html class="cp">
<!-- If this file is not called customize.dist/src/template.html, it is generated -->
<head>
<title data-localization="main_title">CryptPad: Collaboration suite, encrypted and open-source</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" type="image/png" href="/customize/favicon/main-favicon.png" id="favicon"/>
<script async data-bootload="/customize/template.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
</head>
<body class="html">
<noscript>
<p><strong>OOPS</strong> In order to do encryption in your browser, Javascript is really <strong>really</strong> required.</p>
<p><strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.</p>
</noscript>
</html>

View file

@ -58,12 +58,17 @@
width: 100%;
height: 100%;
z-index: 100000; // alertify container
outline: none;
font: @colortheme_app-font;
.cp-checkmark {
color: @cryptpad_text_col;
}
.cp-admin-message {
color: @cryptpad_text_col;
}
.cp-inline-alert-text {
flex: 1;
}

View file

@ -13,8 +13,8 @@
whiteboard: #a72ba7;
kanban: #8C4;
sheet: #40865c;
oodoc: #5170B5;
ooslide: #C65D27;
doc: #5170B5;
presentation: #C65D27;
file: #CD2532;
}
@ -414,3 +414,15 @@
@cp_whiteboard-board-border: @cryptpad_color_grey_800;
@cp_whiteboard-bg: @cp_app-bg;
@cp_whiteboard-fg: @cryptpad_text_col;
// Flatpickr
@cp_flatpickr-bg: @cryptpad_color_grey_800;
@cp_flatpickr-highlight: @cryptpad_color_brand_300;
@cp_flatpickr-highlight-text: @cryptpad_color_grey_800;
// Calendar
@cp_calendar-border: @cryptpad_color_grey_600;
@cp_calendar-now: @cryptpad_color_brand_300;
@cp_calendar-now-fg: @cryptpad_color_grey_800;

View file

@ -13,8 +13,8 @@
whiteboard: #a72ba7;
kanban: #8C4;
sheet: #40865c;
oodoc: #5170B5;
ooslide: #C65D27;
doc: #5170B5;
presentation: #C65D27;
file: #CD2532;
}
@ -190,7 +190,7 @@
// Dropdown
@cp_dropdown-fg: @cryptpad_text_col;
@cp_dropdown-bg: @cryptpad_color_grey_100;
@cp_dropdown-bg-hover: @cryptpad_color_grey_100;
@cp_dropdown-bg-hover: @cryptpad_color_grey_200;
@cp_dropdown-bg-active: @cryptpad_color_grey_300;
// Rendered Markdown
@ -414,3 +414,14 @@
@cp_whiteboard-board-border: @cryptpad_color_grey_600;
@cp_whiteboard-bg: @cp_app-bg;
@cp_whiteboard-fg: @cryptpad_text_col;
// Flatpickr
@cp_flatpickr-bg: @cryptpad_color_grey_50;
@cp_flatpickr-highlight: @cryptpad_color_brand_fadest;
@cp_flatpickr-highlight-text: @cryptpad_text_col;
// Calendar
@cp_calendar-border: @cryptpad_color_grey_300;
@cp_calendar-now: @cryptpad_color_brand;
@cp_calendar-now-fg: @cryptpad_color_grey_200;

View file

@ -1,6 +1,12 @@
.cursor_main() {
// CodeMirror
.cp-codemirror-cursor {
&:before {
content: "";
display: inline-block;
}
cursor: default;
background-color: red;
background-clip: padding-box;
@ -8,8 +14,8 @@
border: 2px solid red;
border-right-color: transparent !important;
border-left-color: transparent !important;
margin-left: -3px;
margin-right: -3px;
display: inline-block;
margin: -2px -3px;
}
.cp-codemirror-selection {
background-color: rgba(255,0,0,0.3);

View file

@ -606,7 +606,7 @@
}
}
.cp-app-drive-content-list {
div.cp-app-drive-content-list {
.cp-app-drive-element-grid {
display: none;
}
@ -896,7 +896,13 @@
.cp-toolbar-bottom {
.cp-toolbar-bottom-right {
.fa-history { order: 50; }
.fa-list, .fa-th-large { order: 25; }
// .fa-list, .fa-th-large,
.cp-app-drive-viewmode-button {
order: 25;
i {
margin-right: 0;
}
}
#cp-app-drive-toolbar-context-mobile, #cp-app-drive-toolbar-contextbuttons { order: 0; }
#cp-app-drive-toolbar-context-mobile {
.fa { margin: 0 !important; }

View file

@ -1,5 +1,6 @@
@import (reference) "./colortheme-all.less";
@import (reference) "./variables.less";
@import (reference) "./tools.less";
.forms_main() {
--LessLoader_require: LessLoader_currentFile();
@ -8,19 +9,25 @@
& {
@alertify_padding-base: @variables_padding;
input:not(.form-control):not([type="checkbox"]), textarea, div.cp-textarea {
input:not(.numInput):not(.form-control):not([type="checkbox"]), textarea, div.cp-textarea {
// background-color: @alertify-input-fg;
color: @cp_forms-fg;
background-color: @cp_forms-bg;
border: 1px solid @cp_forms-border;
width: 100%;
font-size: 100%;
padding: @alertify_padding-base;
&:not(.tui-full-calendar-content) {
width: 100%;
}
&.tui-full-calendar-content {
font-size: @colortheme_app-font-size;
}
&[readonly] {
background-color: @cp_forms-readonly;
border-color: @cp_forms-readonly-border;
color: @cp_forms-fg;
}
.tools_placeholder-color();
}
input:not(.form-control) {
@ -112,6 +119,11 @@
&.no-margin {
margin: 0;
}
&.small {
line-height: initial;
padding: 5px;
height: auto !important;
}
&:hover, &:not(:disabled):not(.disabled):active, &:focus {
color: @cp_buttons-fg;
@ -169,7 +181,7 @@
&:hover, &:not(:disabled):active, &:focus {
border-color: @cryptpad_text_col;
color: @cryptpad_text_col;
background-color: fade(@cryptpad_text_col, 25%);
background-color: fade(@cryptpad_text_col, 10%);
}
}
@ -184,6 +196,7 @@
}
&.btn-register {
margin-top: 10px !important;
white-space: normal;
}
@ -279,4 +292,90 @@
color: @cp_drive-infobox-fg;
}
}
// Flatpickr
body {
.flatpickr-calendar {
background: @cp_flatpickr-bg;
color: @cryptpad_text_col;
border-radius: 0;
box-shadow: @variables_shadow;
-webkit-box-shadow: @variables_shadow;
&.arrowTop::before, &.arrowTop::after {
border-bottom: 0;
}
.flatpickr-months {
.flatpickr-month, .flatpickr-months, .flatpickr-next-month, .flatpickr-prev-month {
color: @cryptpad_text_col;
fill: @cryptpad_text_col;
&:hover {
svg {
fill: @cryptpad_text_col;
}
}
}
.flatpickr-current-month {
span.cur-month:hover {
background: fade(@cryptpad_text_col, 10%);
}
.numInputWrapper span.arrowUp:after {
border-bottom-color: @cryptpad_text_col;
}
.numInputWrapper span.arrowDown:after {
border-top-color: @cryptpad_text_col;
}
}
}
.flatpickr-innerContainer {
border-bottom: 0;
.flatpickr-weekdays {
span.flatpickr-weekday {
color: @cryptpad_text_col;
}
}
.flatpickr-days {
border-left: 0;
border-right: 0;
.flatpickr-day {
color: @cryptpad_text_col;
&:hover {
background-color: fade(@cryptpad_text_col, 10%);
border: 0;
}
&.selected {
background: @cp_flatpickr-highlight;
color: @cp_flatpickr-highlight-text;
border: 0;
}
}
.flatpickr-disabled {
color: fade(@cryptpad_text_col, 20%);
}
}
}
.flatpickr-time {
border-top: none;
.flatpickr-time-separator, .flatpickr-am-pm {
color: @cryptpad_text_col;
}
.flatpickr-am-pm {
&:hover {
background-color: fade(@cryptpad_text_col, 10%);
}
}
.numInputWrapper {
.numInput, .arrowUp, .arrowDown {
color: @cryptpad_text_col;
&:hover, &:focus {
background-color: fade(@cryptpad_text_col, 10%);
}
}
span.arrowDown::after, span.arrowUp::after {
border-top-color: @cryptpad_text_col;
border-bottom-color: @cryptpad_text_col;
}
}
}
}
}
}

View file

@ -70,7 +70,7 @@
justify-content: center;
}
input {
input:not(.tui-full-calendar-content):not(.numInput) {
padding: 8px 12px;
margin: 1em;
width: 300px;

View file

@ -17,6 +17,16 @@
.cp-notification {
min-height: @notif-height;
display: flex;
.cp-broadcast {
display: flex;
font-size: 30px;
align-items: center;
padding: 0 5px;
color: @cp_dropdown-fg;
&.preview:not(.fa-calendar) {
color: @cryptpad_color_red;
}
}
.cp-avatar {
.avatar_main(30px);
padding: 0 5px;

View file

@ -400,7 +400,7 @@
button {
.toolbar_button;
&.cp-notifications-bell {
&.cp-notifications-bell, &.cp-maintenance-wrench {
color: @cryptpad_text_col;
}
}
@ -506,7 +506,7 @@
}
.cp-toolbar-user {
height: @toolbar_line-height;
.cp-toolbar-notifications {
.cp-toolbar-notifications, .cp-toolbar-maintenance {
height: @toolbar_line-height;
width: @toolbar_line-height;
margin-left: 0;
@ -709,7 +709,7 @@
height: 43px;
}
}
.cp-toolbar-link, .cp-toolbar-notifications {
.cp-toolbar-link, .cp-toolbar-notifications, .cp-toolbar-maintenance {
line-height: @toolbar_top-height;
width: @toolbar_top-height;
height: @toolbar_top-height;
@ -717,7 +717,7 @@
box-sizing: border-box;
display: inline-block;
}
.cp-toolbar-notifications {
.cp-toolbar-notifications, .cp-toolbar-maintenance {
text-align: center;
font-size: 32px;
margin-left: 10px;
@ -996,6 +996,9 @@
display: flex;
#cp-toolbar-chat-drawer-open { order: 0; }
#cp-toolbar-userlist-drawer-open { order: 1; }
& > .cp-dropdown-container {
height: @toolbar_line-height;
}
}
.cp-toolbar-bottom-right {

View file

@ -4,16 +4,20 @@
@color: @cp_forms-placeholder;
&::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color: @color;
font-weight: normal;
}
&::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: @color;
opacity: 1; /* Firefox */
font-weight: normal;
}
&:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: @color;
font-weight: normal;
}
&::-ms-input-placeholder { /* Microsoft Edge */
color: @color;
font-weight: normal;
}
}

View file

@ -0,0 +1,20 @@
@import (reference) "../include/colortheme-all.less";
@import (reference) "../include/font.less";
html, body {
.font_main();
margin: 0px;
padding: 0px;
background-color: @cp_static-bg !important;
color: @cryptpad_text_col;
font-family: "IBM Plex Mono";
a {
color: @cryptpad_color_link;
}
}
body {
width: 50%;
min-width: 650px;
margin: auto;
}

View file

@ -52,6 +52,9 @@
}
}
.cp-restricted-registration {
text-align: center !important;
}
.cp-register-det {
#data {

View file

@ -0,0 +1,17 @@
@import (reference) "../include/colortheme-all.less";
@import (reference) "../include/font.less";
//@import (reference) "../include/forms.less";
@import (reference) "../include/alertify.less";
html, body {
.font_main();
.alertify_main();
height: 100%;
margin: 0px;
padding: 0px;
background-color: @cp_static-bg !important;
color: @cryptpad_text_col;
font-family: "IBM Plex Mono";
}

View file

@ -50,7 +50,6 @@ $(function () {
} else if (/^\/login\//.test(pathname)) {
require([ '/login/main.js' ], function () {});
} else if (/^\/($|^\/index\.html$)/.test(pathname)) {
// TODO use different top bar
require([ '/customize/main.js', ], function () {});
} else {
require([ '/customize/main.js', ], function () {});

View file

@ -60,8 +60,11 @@ server {
add_header Access-Control-Allow-Origin "*";
# add_header X-Frame-Options "SAMEORIGIN";
# Opt out of Google's FLoC Network
add_header Permissions-Policy interest-cohort=();
set $coop '';
if ($uri ~ ^\/sheet\/.*$) { set $coop 'same-origin'; }
if ($uri ~ ^\/(sheet|presentation|doc)\/.*$) { set $coop 'same-origin'; }
# Enable SharedArrayBuffer in Firefox (for .xlsx export)
add_header Cross-Origin-Resource-Policy cross-origin;
@ -116,7 +119,7 @@ server {
set $unsafe 0;
# the following assets are loaded via the sandbox domain
# they unfortunately still require exceptions to the sandboxing to work correctly.
if ($uri = "/sheet/inner.html") { set $unsafe 1; }
if ($uri ~ ^\/(sheet|doc|presentation)\/inner.html.*$) { set $unsafe 1; }
if ($uri ~ ^\/common\/onlyoffice\/.*\/index\.html.*$) { set $unsafe 1; }
# everything except the sandbox domain is a privileged scope, as they might be used to handle keys
@ -159,7 +162,7 @@ server {
# /api/config is loaded once per page load and is used to retrieve
# the caching variable which is applied to every other resource
# which is loaded during that session.
location = /api/config {
location ~ ^/api/(config|broadcast).*$ {
proxy_pass http://localhost:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
@ -204,7 +207,7 @@ server {
# The nodejs server has some built-in forwarding rules to prevent
# URLs like /pad from resulting in a 404. This simply adds a trailing slash
# to a variety of applications.
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media|profile|contacts|todo|filepicker|debug|kanban|sheet|support|admin|notifications|teams)$ {
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media|profile|contacts|todo|filepicker|debug|kanban|sheet|support|admin|notifications|teams|calendar|presentation|doc)$ {
rewrite ^(.*)$ $1/ redirect;
}

View file

@ -348,6 +348,9 @@ var commands = {
CLEAR_CACHED_CHANNEL_INDEX: clearChannelIndex,
GET_CACHED_CHANNEL_INDEX: getChannelIndex,
// TODO implement admin historyTrim
// TODO implement kick from channel
// TODO implement force-disconnect user(s)?
CLEAR_CACHED_CHANNEL_METADATA: clearChannelMetadata,
GET_CACHED_CHANNEL_METADATA: getChannelMetadata,

View file

@ -86,47 +86,122 @@ var createLoginBlockPath = function (Env, publicKey) { // FIXME BLOCKS
return Path.join(Env.paths.block, safeKey.slice(0, 2), safeKey);
};
Block.writeLoginBlock = function (Env, safeKey, msg, cb) { // FIXME BLOCKS
Block.validateAncestorProof = function (Env, proof, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
/* prove that you own an existing block by signing for its publicKey */
try {
var parsed = JSON.parse(proof);
var pub = parsed[0];
var u8_pub = Nacl.util.decodeBase64(pub);
var sig = parsed[1];
var u8_sig = Nacl.util.decodeBase64(sig);
var valid = false;
nThen(function (w) {
valid = Nacl.sign.detached.verify(u8_pub, u8_sig, u8_pub);
if (!valid) {
w.abort();
return void cb('E_INVALID_ANCESTOR_PROOF');
}
// else fall through to next step
}).nThen(function (w) {
var path = createLoginBlockPath(Env, pub);
Fs.access(path, Fs.constants.F_OK, w(function (err) {
if (!err) { return; }
w.abort(); // else
return void cb("E_MISSING_ANCESTOR");
}));
}).nThen(function () {
cb(void 0, pub);
});
} catch (err) {
return void cb(err);
}
};
Block.writeLoginBlock = function (Env, safeKey, msg, _cb) { // FIXME BLOCKS
var cb = Util.once(Util.mkAsync(_cb));
//console.log(msg);
var publicKey = msg[0];
var signature = msg[1];
var block = msg[2];
var registrationProof = msg[3];
var previousKey;
validateLoginBlock(Env, publicKey, signature, block, function (e, validatedBlock) {
if (e) { return void cb(e); }
if (!(validatedBlock instanceof Uint8Array)) { return void cb('E_INVALID_BLOCK'); }
// derive the filepath
var path = createLoginBlockPath(Env, publicKey);
// make sure the path is valid
if (typeof(path) !== 'string') {
return void cb('E_INVALID_BLOCK_PATH');
var validatedBlock, parsed, path;
nThen(function (w) {
if (Util.escapeKeyCharacters(publicKey) !== safeKey) {
w.abort();
return void cb("INCORRECT_KEY");
}
var parsed = Path.parse(path);
if (!parsed || typeof(parsed.dir) !== 'string') {
return void cb("E_INVALID_BLOCK_PATH_2");
}
nThen(function (w) {
// make sure the path to the file exists
Fse.mkdirp(parsed.dir, w(function (e) {
if (e) {
w.abort();
cb(e);
}
}));
}).nThen(function () {
// actually write the block
// flow is dumb and I need to guard against this which will never happen
/*:: if (typeof(validatedBlock) === 'undefined') { throw new Error('should never happen'); } */
/*:: if (typeof(path) === 'undefined') { throw new Error('should never happen'); } */
Fs.writeFile(path, Buffer.from(validatedBlock), { encoding: "binary", }, function (err) {
if (err) { return void cb(err); }
cb();
}).nThen(function (w) {
if (!Env.restrictRegistration) { return; }
if (!registrationProof) {
// we allow users with existing blocks to create new ones
// call back with error if registration is restricted and no proof of an existing block was provided
w.abort();
Env.Log.info("BLOCK_REJECTED_REGISTRATION", {
safeKey: safeKey,
publicKey: publicKey,
});
return cb("E_RESTRICTED");
}
Env.validateAncestorProof(registrationProof, w(function (err, provenKey) {
if (err || !provenKey) { // double check that a key was validated
w.abort();
Env.Log.warn('BLOCK_REJECTED_INVALID_ANCESTOR', {
error: err,
});
return void cb("E_RESTRICTED");
}
previousKey = provenKey;
}));
}).nThen(function (w) {
validateLoginBlock(Env, publicKey, signature, block, w(function (e, _validatedBlock) {
if (e) {
w.abort();
return void cb(e);
}
if (!(_validatedBlock instanceof Uint8Array)) {
w.abort();
return void cb('E_INVALID_BLOCK');
}
validatedBlock = _validatedBlock;
// derive the filepath
path = createLoginBlockPath(Env, publicKey);
// make sure the path is valid
if (typeof(path) !== 'string') {
return void cb('E_INVALID_BLOCK_PATH');
}
parsed = Path.parse(path);
if (!parsed || typeof(parsed.dir) !== 'string') {
w.abort();
return void cb("E_INVALID_BLOCK_PATH_2");
}
}));
}).nThen(function (w) {
// make sure the path to the file exists
Fse.mkdirp(parsed.dir, w(function (e) {
if (e) {
w.abort();
cb(e);
}
}));
}).nThen(function () {
// actually write the block
Fs.writeFile(path, Buffer.from(validatedBlock), { encoding: "binary", }, function (err) {
if (err) { return void cb(err); }
Env.Log.info('BLOCK_WRITE_BY_OWNER', {
safeKey: safeKey,
blockId: publicKey,
isChange: Boolean(registrationProof),
previousKey: previousKey,
path: path,
});
cb();
});
});
};
@ -146,26 +221,33 @@ Block.removeLoginBlock = function (Env, safeKey, msg, cb) { // FIXME BLOCKS
var signature = msg[1];
var block = Nacl.util.decodeUTF8('DELETE_BLOCK'); // clients and the server will have to agree on this constant
validateLoginBlock(Env, publicKey, signature, block, function (e /*::, validatedBlock */) {
if (e) { return void cb(e); }
// derive the filepath
var path = createLoginBlockPath(Env, publicKey);
// make sure the path is valid
if (typeof(path) !== 'string') {
return void cb('E_INVALID_BLOCK_PATH');
nThen(function (w) {
if (Util.escapeKeyCharacters(publicKey) !== safeKey) {
w.abort();
return void cb("INCORRECT_KEY");
}
}).nThen(function () {
validateLoginBlock(Env, publicKey, signature, block, function (e /*::, validatedBlock */) {
if (e) { return void cb(e); }
// derive the filepath
var path = createLoginBlockPath(Env, publicKey);
// FIXME COLDSTORAGE
Fs.unlink(path, function (err) {
Env.Log.info('DELETION_BLOCK_BY_OWNER_RPC', {
publicKey: publicKey,
path: path,
status: err? String(err): 'SUCCESS',
// make sure the path is valid
if (typeof(path) !== 'string') {
return void cb('E_INVALID_BLOCK_PATH');
}
// FIXME COLDSTORAGE
Fs.unlink(path, function (err) {
Env.Log.info('DELETION_BLOCK_BY_OWNER_RPC', {
publicKey: publicKey,
path: path,
status: err? String(err): 'SUCCESS',
});
if (err) { return void cb(err); }
cb();
});
if (err) { return void cb(err); }
cb();
});
});
};

View file

@ -191,7 +191,8 @@ var ARRAY_LINE = /^\[/;
*/
Channel.isNewChannel = function (Env, channel, cb) {
if (!Core.isValidId(channel)) { return void cb('INVALID_CHAN'); }
if (channel.length !== 32) { return void cb('INVALID_CHAN'); }
if (channel.length !== HK.STANDARD_CHANNEL_LENGTH &&
channel.length !== HK.ADMIN_CHANNEL_LENGTH) { return void cb('INVALID_CHAN'); }
// TODO replace with readMessagesBin
var done = false;
@ -229,7 +230,8 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
if (!msg) { return void cb("INVALID_MESSAGE"); }
// don't support anything except regular channels
if (!Core.isValidId(channelId) || channelId.length !== 32) {
if (!Core.isValidId(channelId) || (channelId.length !== HK.STANDARD_CHANNEL_LENGTH
&& channelId.length !== HK.ADMIN_CHANNEL_LENGTH)) {
return void cb("INVALID_CHAN");
}
@ -254,6 +256,11 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
var session = HK.getNetfluxSession(Env, netfluxId);
var allowed = HK.listAllowedUsers(metadata);
// Special broadcast channel
if (channelId.length === HK.ADMIN_CHANNEL_LENGTH) {
allowed = Env.admins;
}
if (HK.isUserSessionAllowed(allowed, session)) { return; }
w.abort();
@ -278,12 +285,19 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
// historyKeeper already knows how to handle metadata and message validation, so we just pass it off here
// if the message isn't valid it won't be stored.
Env.historyKeeper.channelMessage(Server, channelStruct, fullMessage);
Env.historyKeeper.channelMessage(Server, channelStruct, fullMessage, function (err) {
if (err) {
// Message not stored...
return void cb(err);
}
Server.getChannelUserList(channelId).forEach(function (userId) {
Server.send(userId, fullMessage);
// Broadcast the message
Server.getChannelUserList(channelId).forEach(function (userId) {
Server.send(userId, fullMessage);
});
});
cb();
});
};

View file

@ -10,7 +10,11 @@ Core.SESSION_EXPIRATION_TIME = 60 * 1000;
Core.isValidId = function (chan) {
return chan && chan.length && /^[a-zA-Z0-9=+-]*$/.test(chan) &&
[32, 48].indexOf(chan.length) > -1;
[32, 33, 48].indexOf(chan.length) > -1;
};
Core.isValidPublicKey = function (owner) {
return typeof(owner) === 'string' && owner.length === 44;
};
var makeToken = Core.makeToken = function () {

View file

@ -9,7 +9,18 @@ const HK = require("../hk-util");
Data.getMetadataRaw = function (Env, channel /* channelName */, _cb) {
const cb = Util.once(Util.mkAsync(_cb));
if (!Core.isValidId(channel)) { return void cb('INVALID_CHAN'); }
if (channel.length !== HK.STANDARD_CHANNEL_LENGTH) { return cb("INVALID_CHAN_LENGTH"); }
if (channel.length !== HK.STANDARD_CHANNEL_LENGTH &&
channel.length !== HK.ADMIN_CHANNEL_LENGTH) { return cb("INVALID_CHAN_LENGTH"); }
// return synthetic metadata for admin broadcast channels as a safety net
// in case anybody manages to write metadata
if (channel.length === HK.ADMIN_CHANNEL_LENGTH) {
return void cb(void 0, {
channel: channel,
creation: +new Date(),
owners: Env.admins,
});
}
var cached = Env.metadata_cache[channel];
if (HK.isMetadataMessage(cached)) {

View file

@ -1,4 +1,5 @@
var Decrees = module.exports;
var Core = require("./commands/core");
/* Admin decrees which modify global server state
@ -24,6 +25,15 @@ SET_PREMIUM_UPLOAD_SIZE
DISABLE_INTEGRATED_TASKS
DISABLE_INTEGRATED_EVICTION
// BROADCAST
SET_LAST_BROADCAST_HASH
SET_SURVEY_URL
SET_MAINTENANCE
// EASIER CONFIG
SET_ADMIN_EMAIL
SET_SUPPORT_MAILBOX
NOT IMPLEMENTED:
// RESTRICTED REGISTRATION
@ -32,9 +42,11 @@ REVOKE_INVITE
REDEEM_INVITE
// 2.0
Env.adminEmail
Env.supportMailbox
Env.DEV_MODE || Env.FRESH_MODE,
ADD_ADMIN_KEY
RM_ADMIN_KEY
*/
var commands = {};
@ -83,6 +95,20 @@ var isNonNegativeNumber = function (n) {
};
*/
var default_validator = function () { return true; };
var makeGenericSetter = function (attr, validator) {
validator = validator || default_validator;
return function (Env, args) {
if (!validator(args)) {
throw new Error("INVALID_ARGS");
}
var value = args[0];
if (value === Env[attr]) { return false; }
Env[attr] = value;
return true;
};
};
var isInteger = function (n) {
return !(typeof(n) !== 'number' || isNaN(n) || (n % 1) !== 0);
};
@ -92,15 +118,7 @@ var args_isInteger = function (args) {
};
var makeIntegerSetter = function (attr) {
return function (Env, args) {
if (!args_isInteger(args)) {
throw new Error('INVALID_ARGS');
}
var integer = args[0];
if (integer === Env[attr]) { return false; }
Env[attr] = integer;
return true;
};
return makeGenericSetter(attr, args_isInteger);
};
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_MAX_UPLOAD_SIZE', [50 * 1024 * 1024]]], console.log)
@ -121,6 +139,52 @@ commands.SET_ARCHIVE_RETENTION_TIME = makeIntegerSetter('archiveRetentionTime');
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ACCOUNT_RETENTION_TIME', [365]]], console.log)
commands.SET_ACCOUNT_RETENTION_TIME = makeIntegerSetter('accountRetentionTime');
var args_isString = function (args) {
return Array.isArray(args) && typeof(args[0]) === "string";
};
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ADMIN_EMAIL', ['admin@website.tld']]], console.log)
commands.SET_ADMIN_EMAIL = makeGenericSetter('adminEmail', args_isString);
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_SUPPORT_MAILBOX', ["Tdz6+fE9N9XXBY93rW5qeNa/k27yd40c0vq7EJyt7jA="]]], console.log)
commands.SET_SUPPORT_MAILBOX = makeGenericSetter('supportMailbox', function (args) {
return args_isString(args) && Core.isValidPublicKey(args[0]);
});
// Maintenance: Empty string or an object with a start and end time
var isNumber = function (value) {
return typeof(value) === "number" && !isNaN(value);
};
var args_isMaintenance = function (args) {
return Array.isArray(args) && args[0] &&
(args[0] === "" || (isNumber(args[0].end) && isNumber(args[0].start)));
};
// we anticipate that we'll add language-specific surveys in the future
// whenever that happens we can relax validation a bit to support more formats
var makeBroadcastSetter = function (attr, validation) {
return function (Env, args) {
if ((validation && !validation(args)) && !args_isString(args)) {
throw new Error('INVALID_ARGS');
}
var str = args[0];
if (str === Env[attr]) { return false; }
Env[attr] = str;
Env.broadcastCache = {};
return true;
};
};
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_LAST_BROADCAST_HASH', [hash]]], console.log)
commands.SET_LAST_BROADCAST_HASH = makeBroadcastSetter('lastBroadcastHash');
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_SURVEY_URL', [url]]], console.log)
commands.SET_SURVEY_URL = makeBroadcastSetter('surveyURL');
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_MAINTENANCE', [{start: +Date, end: +Date}]]], console.log)
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_MAINTENANCE', [""]]], console.log)
commands.SET_MAINTENANCE = makeBroadcastSetter('maintenance', args_isMaintenance);
var Quota = require("./commands/quota");
var Keys = require("./keys");
var Util = require("./common-util");

View file

@ -48,6 +48,7 @@ Default.httpHeaders = function () {
"X-XSS-Protection": "1; mode=block",
"X-Content-Type-Options": "nosniff",
"Access-Control-Allow-Origin": "*",
"Permissions-policy":"interest-cohort=()"
};
};
Default.mainPages = function () {

View file

@ -19,8 +19,10 @@ module.exports.create = function (config) {
FRESH_MODE: true,
DEV_MODE: false,
configCache: {},
broadcastCache: {},
flushCache: function () {
Env.configCache = {};
Env.broadcastCache = {};
Env.FRESH_KEY = +new Date();
if (!(Env.DEV_MODE || Env.FRESH_MODE)) { Env.FRESH_MODE = true; }
if (!Env.Log) { return; }
@ -65,6 +67,11 @@ module.exports.create = function (config) {
paths: {},
//msgStore: config.store,
// /api/broadcast
lastBroadcastHash: '',
surveyURL: undefined,
maintenance: undefined,
netfluxUsers: {},
pinStore: undefined,
@ -82,6 +89,11 @@ module.exports.create = function (config) {
}
},
/* FIXME restrictRegistration is initialized as false and then overridden by admin decree
There is a narrow window in which someone could register before the server updates this value.
See also the cached 'restrictRegistration' value in server.js#serveConfig
*/
restrictRegistration: false,
allowSubscriptions: config.allowSubscriptions === true,
blockDailyCheck: config.blockDailyCheck === true,

View file

@ -158,6 +158,7 @@ module.exports.create = function (Env, cb) {
pinPath: Env.paths.pin,
filePath: Env.paths.data,
archivePath: Env.paths.archive,
blockPath: Env.paths.block,
inactiveTime: Env.inactiveTime,
archiveRetentionTime: Env.archiveRetentionTime,

View file

@ -34,6 +34,7 @@ const getHash = HK.getHash = function (msg, Log) {
// historyKeeper should explicitly store any channel
// with a 32 character id
const STANDARD_CHANNEL_LENGTH = HK.STANDARD_CHANNEL_LENGTH = 32;
const ADMIN_CHANNEL_LENGTH = HK.ADMIN_CHANNEL_LENGTH = 33;
// historyKeeper should not store messages sent to any channel
// with a 34 character id
@ -661,6 +662,8 @@ const handleGetHistory = function (Env, Server, seq, userId, parsed) {
if (txid) { msg[0] = txid; }
Server.send(userId, [0, HISTORY_KEEPER_ID, 'MSG', userId, JSON.stringify(msg)], readMore);
}, (err) => {
// Any error but ENOENT: abort
// ENOENT is allowed in case we want to create a new pad
if (err && err.code !== 'ENOENT') {
if (err.message === "EUNKNOWN") {
Log.error("HK_GET_HISTORY", {
@ -675,11 +678,28 @@ const handleGetHistory = function (Env, Server, seq, userId, parsed) {
err: err && err.message || err,
stack: err && err.stack,
}); }
// FIXME err.message isn't useful for users
const parsedMsg = {error:err.message, channel: channelName, txid: txid};
Server.send(userId, [0, HISTORY_KEEPER_ID, 'MSG', userId, JSON.stringify(parsedMsg)]);
return;
}
// If we're asking for a specific version (lastKnownHash) but we receive an
// ENOENT, this is not a pad creation so we need to abort.
if (err && err.code === 'ENOENT' && lastKnownHash) {
/*
This informs clients that the pad they're trying to load was deleted by its owner.
The user in question might be reconnecting or might have loaded the document from their cache.
The owner that deleted it could be another user or the same user from a different device.
Either way, the respectful thing to do is display an error screen informing them that the content
is no longer on the server so they don't abuse the data and so that they don't unintentionally continue
to edit it in a broken state.
*/
const parsedMsg2 = {error:'EDELETED', channel: channelName, txid: txid};
Server.send(userId, [0, HISTORY_KEEPER_ID, 'MSG', userId, JSON.stringify(parsedMsg2)]);
return;
}
if (msgCount === 0 && !metadata_cache[channelName] && Server.channelContainsUser(channelName, userId)) {
handleFirstMessage(Env, channelName, metadata);
Server.send(userId, [0, HISTORY_KEEPER_ID, 'MSG', userId, JSON.stringify(metadata)]);
@ -883,6 +903,11 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct, cb) {
// don't store messages if the channel id indicates that it's an ephemeral message
if (!channel.id || channel.id.length === EPHEMERAL_CHANNEL_LENGTH) { return void cb(); }
// Admin channel. We can only write to this one from private message (RPC)
if (channel.id.length === ADMIN_CHANNEL_LENGTH && msgStruct[1] !== null) {
return void cb('ERESTRICTED_ADMIN');
}
const isCp = /^cp\|/.test(msgStruct[4]);
let id;
if (isCp) {
@ -893,8 +918,9 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct, cb) {
// more straightforward and reliable.
if (Array.isArray(id) && id[2] && id[2] === channel.lastSavedCp) {
// Reject duplicate checkpoints
// XXX not an error? the checkpoint is already here so we can assume it's stored
return void cb('DUPLICATE');
return void cb();
// not an error? the checkpoint is already here so we can assume it's stored
//return void cb('DUPLICATE');
}
}

View file

@ -1,4 +1,5 @@
var Meta = module.exports;
var Core = require("./commands/core");
var deduplicate = require("./common-util").deduplicateString;
@ -35,9 +36,7 @@ the owners field is guaranteed to exist.
var commands = {};
var isValidPublicKey = function (owner) {
return typeof(owner) === 'string' && owner.length === 44;
};
var isValidPublicKey = Core.isValidPublicKey;
// isValidPublicKey is a better indication of what the above function does
// I'm preserving this function name in case we ever want to expand its

View file

@ -295,7 +295,7 @@ var owned_upload_complete = function (Env, safeKey, id, cb) {
// removeBlob
var remove = function (Env, blobId, cb) {
var blobPath = makeBlobPath(Env, blobId);
Fs.unlink(blobPath, cb); // TODO COLDSTORAGE
Fs.unlink(blobPath, cb);
};
// removeProof

View file

@ -567,7 +567,7 @@ var listChannels = function (root, handler, cb, fast) {
var metadataName;
// if the current file is not the channel data, then it must be metadata
if (!/^[0-9a-fA-F]{32}\.ndjson$/.test(item)) {
if (!/^[0-9a-fA-F]{32, 33}\.ndjson$/.test(item)) {
metadataName = item;
channelName = item.replace(/\.metadata/, '');
@ -584,7 +584,7 @@ var listChannels = function (root, handler, cb, fast) {
}
var channel = metadataName.replace(/\.metadata.ndjson$/, '');
if ([32, 34, 44].indexOf(channel.length) === -1) { return; }
if ([32, 33, 34, 44].indexOf(channel.length) === -1) { return; }
// otherwise throw it on the pile
sema.take(function (give) {

View file

@ -4,6 +4,7 @@
const HK = require("../hk-util");
const Store = require("../storage/file");
const BlobStore = require("../storage/blob");
const Block = require("../commands/block");
const Util = require("../common-util");
const nThen = require("nthen");
const Meta = require("../metadata");
@ -47,6 +48,7 @@ const init = function (config, _cb) {
Env.paths = {
pin: config.pinPath,
block: config.blockPath,
};
Env.inactiveTime = config.inactiveTime;
@ -391,7 +393,8 @@ const getPinState = function (data, cb) {
const _getFileSize = function (channel, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
if (!Core.isValidId(channel)) { return void cb('INVALID_CHAN'); }
if (channel.length === 32) {
if (channel.length === HK.STANDARD_CHANNEL_LENGTH ||
channel.length === HK.ADMIN_CHANNEL_LENGTH) {
return void store.getChannelSize(channel, function (e, size) {
if (e) {
if (e.code === 'ENOENT') { return void cb(void 0, 0); }
@ -687,6 +690,10 @@ COMMANDS.HASH_CHANNEL_LIST = function (data, cb) {
cb(void 0, hash);
};
COMMANDS.VALIDATE_ANCESTOR_PROOF = function (data, cb) {
Block.validateAncestorProof(Env, data && data.proof, cb);
};
process.on('message', function (data) {
if (!data || !data.txid || !data.pid) {
return void process.send({

View file

@ -444,6 +444,13 @@ Workers.initialize = function (Env, config, _cb) {
}, cb);
};
Env.validateAncestorProof = function (proof, cb) {
sendCommand({
command: 'VALIDATE_ANCESTOR_PROOF',
proof: proof,
}, cb);
};
cb(void 0);
});
};

14
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "cryptpad",
"version": "4.3.0",
"version": "4.5.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -403,9 +403,9 @@
}
},
"chainpad-server": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-5.0.0.tgz",
"integrity": "sha512-rfJxcWdF5InMPnNkhMWD+VRwzKUcUQktMG7DpEs90zuB7w6e8rs4MAOTEmc2rgK5EB0fYTlOMdSft58hKnbgHw==",
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-5.1.0.tgz",
"integrity": "sha512-BdjgOOLTXXo1EjQ7lURDe7oqsqfQISNvwhILfp3K3diY2K1hxpPLbjYzOSgxNOTADeOAff0xnInR5eUCESVWaQ==",
"requires": {
"nthen": "0.1.8",
"pull-stream": "^3.6.9",
@ -1706,9 +1706,9 @@
}
},
"lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"lodash.merge": {

View file

@ -1,7 +1,7 @@
{
"name": "cryptpad",
"description": "realtime collaborative visual editor with zero knowlege server",
"version": "4.3.0",
"version": "4.5.0",
"license": "AGPL-3.0+",
"repository": {
"type": "git",
@ -14,7 +14,7 @@
"dependencies": {
"@mcrowe/minibloom": "^0.2.0",
"chainpad-crypto": "^0.2.5",
"chainpad-server": "^5.0.0",
"chainpad-server": "^5.1.0",
"express": "~4.16.0",
"fs-extra": "^7.0.0",
"get-folder-size": "^2.0.1",

View file

@ -0,0 +1,96 @@
var EN = require("../www/common/translations/messages.json");
var simpleTags = [
'<br>',
'<br />',
'<br/>',
'<a href="/login/">',
'<a href="/register/">',
// FIXME
"<a href='#'>",
'<h3>',
'</h3>',
// FIXME register_notes
'<ul class="cp-notes-list">',
'</ul>',
'<li>',
'</li>',
'<span class="red">',
'</span>',
];
['a', 'b', 'em', 'p', 'i'].forEach(function (tag) {
simpleTags.push('<' + tag + '>');
simpleTags.push('</' + tag + '>');
});
// these keys are known to be problematic
var KNOWN_ISSUES = [ // FIXME
//'newVersion',
//'fm_info_anonymous',
//'register_notes',
];
var processLang = function (map, lang, primary) {
var announced = false;
var announce = function () {
if (announced) { return; }
announced = true;
console.log("NEXT LANGUAGE: ", lang);
};
Object.keys(map).forEach(function (k) {
if (!EN[k]) { return; }
if (KNOWN_ISSUES.indexOf(k) !== -1) { return; }
var s = map[k];
if (typeof(s) !== 'string') { return; }
var usesHTML;
s.replace(/<.*?>/g, function (html) {
if (simpleTags.indexOf(html) !== -1) { return; }
announce();
usesHTML = true;
if (!primary) {
console.log("{%s}", html);
}
});
if (usesHTML) {
announce();
console.log("%s", s);
console.log("[%s]\n", k);
}
});
};
processLang(EN, 'en', true);
[
'ar',
'bn_BD',
'ca',
'de',
'es',
'fi',
'fr',
'hi',
'it',
'ja',
'nb',
'nl',
'pl',
'pt-br',
'ro',
'ru',
'sv',
'te',
'tr',
'zh',
].forEach(function (lang) {
var map = require("../www/common/translations/messages." + lang + ".json");
if (!Object.keys(map).length) { return; }
processLang(map, lang);
});

139
server.js
View file

@ -16,15 +16,19 @@ var Env = require("./lib/env").create(config);
var app = Express();
var canonicalizeOrigin = function (s) {
return (s || '').trim().replace(/\/+$/, '');
};
(function () {
// you absolutely must provide an 'httpUnsafeOrigin'
if (typeof(config.httpUnsafeOrigin) !== 'string') {
throw new Error("No 'httpUnsafeOrigin' provided");
}
config.httpUnsafeOrigin = config.httpUnsafeOrigin.trim();
config.httpUnsafeOrigin = canonicalizeOrigin(config.httpUnsafeOrigin);
if (typeof(config.httpSafeOrigin) === 'string') {
config.httpSafeOrigin = config.httpSafeOrigin.trim().replace(/\/$/, '');
config.httpSafeOrigin = canonicalizeOrigin(config.httpSafeOrigin);
}
// fall back to listening on a local address
@ -39,6 +43,7 @@ var app = Express();
}
if (typeof(config.httpSafeOrigin) !== 'string') {
Env.NO_SANDBOX = true;
if (typeof(config.httpSafePort) !== 'number') {
config.httpSafePort = config.httpPort + 1;
}
@ -102,18 +107,37 @@ var setHeaders = (function () {
return function (req, res) {
// apply a bunch of cross-origin headers for XLSX export in FF and printing elsewhere
applyHeaderMap(res, {
"Cross-Origin-Resource-Policy": 'cross-origin',
"Cross-Origin-Opener-Policy": /^\/sheet\//.test(req.url)? 'same-origin': '',
"Cross-Origin-Embedder-Policy": 'require-corp',
});
if (Env.NO_SANDBOX) { // handles correct configuration for local development
// https://stackoverflow.com/questions/11531121/add-duplicate-http-response-headers-in-nodejs
applyHeaderMap(res, {
"Cross-Origin-Resource-Policy": 'cross-origin',
});
}
// Don't set CSP headers on /api/config because they aren't necessary and they cause problems
// when duplicated by NGINX in production environments
if (/^\/api\/config/.test(req.url)) { return; }
if (/^\/api\/(broadcast|config)/.test(req.url)) {
/*
if (Env.NO_SANDBOX) {
applyHeaderMap(res, {
"Cross-Origin-Resource-Policy": 'cross-origin',
});
}
*/
return;
}
applyHeaderMap(res, {
"Cross-Origin-Resource-Policy": 'cross-origin',
});
// targeted CSP, generic policies, maybe custom headers
const h = [
/^\/common\/onlyoffice\/.*\/index\.html.*/,
/^\/(sheet|ooslide|oodoc)\/inner\.html.*/,
/^\/(sheet|presentation|doc)\/inner\.html.*/,
].some((regex) => {
return regex.test(req.url);
}) ? padHeaders : headers;
@ -197,46 +221,14 @@ app.use("/customize.dist", Express.static(__dirname + '/customize.dist'));
app.use(/^\/[^\/]*$/, Express.static('customize'));
app.use(/^\/[^\/]*$/, Express.static('customize.dist'));
var serveConfig = (function () {
// if dev mode: never cache
var cacheString = function () {
return (Env.FRESH_KEY? '-' + Env.FRESH_KEY: '') + (Env.DEV_MODE? '-' + (+new Date()): '');
};
var template = function (host) {
return [
'define(function(){',
'var obj = ' + JSON.stringify({
requireConf: {
waitSeconds: 600,
urlArgs: 'ver=' + Package.version + cacheString(),
},
removeDonateButton: (config.removeDonateButton === true),
allowSubscriptions: (config.allowSubscriptions === true),
websocketPath: config.externalWebsocketURL,
httpUnsafeOrigin: config.httpUnsafeOrigin,
adminEmail: Env.adminEmail,
adminKeys: Env.admins,
inactiveTime: Env.inactiveTime,
supportMailbox: Env.supportMailbox,
defaultStorageLimit: Env.defaultStorageLimit,
maxUploadSize: Env.maxUploadSize,
premiumUploadSize: Env.premiumUploadSize,
}, null, '\t'),
'obj.httpSafeOrigin = ' + (function () {
if (config.httpSafeOrigin) { return '"' + config.httpSafeOrigin + '"'; }
if (config.httpSafePort) {
return "(function () { return window.location.origin.replace(/\:[0-9]+$/, ':" +
config.httpSafePort + "'); }())";
}
return 'window.location.origin';
}()),
'return obj',
'});'
].join(';\n')
};
// if dev mode: never cache
var cacheString = function () {
return (Env.FRESH_KEY? '-' + Env.FRESH_KEY: '') + (Env.DEV_MODE? '-' + (+new Date()): '');
};
var makeRouteCache = function (template, cacheName) {
var cleanUp = {};
var cache = Env[cacheName] = Env[cacheName] || {};
return function (req, res) {
var host = req.headers.host.replace(/\:[0-9]+/, '');
@ -251,24 +243,75 @@ var serveConfig = (function () {
// FIXME mutable
// we must be able to clear the cache when updating any mutable key
// if there's nothing cached for that key...
if (!Env.configCache[cacheKey]) {
if (!cache[cacheKey]) {
// generate the response and cache it in memory
Env.configCache[cacheKey] = template(host);
cache[cacheKey] = template(host);
// and create a function to conditionally evict cache entries
// which have not been accessed in the last 20 seconds
cleanUp[cacheKey] = Util.throttle(function () {
delete cleanUp[cacheKey];
delete Env.configCache[cacheKey];
delete cache[cacheKey];
}, 20000);
}
// successive calls to this function
cleanUp[cacheKey]();
return void res.send(Env.configCache[cacheKey]);
return void res.send(cache[cacheKey]);
};
}());
};
var serveConfig = makeRouteCache(function (host) {
return [
'define(function(){',
'var obj = ' + JSON.stringify({
requireConf: {
waitSeconds: 600,
urlArgs: 'ver=' + Package.version + cacheString(),
},
removeDonateButton: (config.removeDonateButton === true),
allowSubscriptions: (config.allowSubscriptions === true),
websocketPath: config.externalWebsocketURL,
httpUnsafeOrigin: config.httpUnsafeOrigin,
adminEmail: Env.adminEmail,
adminKeys: Env.admins,
inactiveTime: Env.inactiveTime,
supportMailbox: Env.supportMailbox,
defaultStorageLimit: Env.defaultStorageLimit,
maxUploadSize: Env.maxUploadSize,
premiumUploadSize: Env.premiumUploadSize,
restrictRegistration: Env.restrictRegistration, // FIXME see the race condition in env.js
}, null, '\t'),
'obj.httpSafeOrigin = ' + (function () {
if (config.httpSafeOrigin) { return '"' + config.httpSafeOrigin + '"'; }
if (config.httpSafePort) {
return "(function () { return window.location.origin.replace(/\:[0-9]+$/, ':" +
config.httpSafePort + "'); }())";
}
return 'window.location.origin';
}()),
'return obj',
'});'
].join(';\n')
}, 'configCache');
var serveBroadcast = makeRouteCache(function (host) {
var maintenance = Env.maintenance;
if (maintenance && maintenance.end && maintenance.end < (+new Date())) {
maintenance = undefined;
}
return [
'define(function(){',
'return ' + JSON.stringify({
lastBroadcastHash: Env.lastBroadcastHash,
surveyURL: Env.surveyURL,
maintenance: maintenance
}, null, '\t'),
'});'
].join(';\n')
}, 'broadcastCache');
app.get('/api/config', serveConfig);
app.get('/api/broadcast', serveBroadcast);
var four04_path = Path.resolve(__dirname + '/customize.dist/404.html');
var custom_four04_path = Path.resolve(__dirname + '/customize/404.html');

View file

@ -14,8 +14,12 @@
display: flex;
flex-flow: column;
a {
color: @cryptpad_color_link;
text-decoration: underline;
}
.cp-admin-setlimit-form {
.cp-admin-setlimit-form, .cp-admin-broadcast-form {
label {
font-weight: normal !important;
}
@ -199,5 +203,85 @@
}
}
.cp-admin-broadcast-form {
input.flatpickr-input {
width: 307.875px !important; // same width as flatpickr calendar
}
.cp-broadcast-active {
display: flex;
flex-flow: column;
align-items: start;
padding: 10px;
background-color: @cp_sidebar-left-bg;
color: @cp_sidebar-left-fg;
p {
margin: 0;
}
}
.cp-broadcast-form-submit {
margin-top: 30px;
button {
margin-bottom: 10px !important;
}
}
.cp-broadcast-container {
display: flex;
flex-flow: column;
}
.cp-broadcast-lang {
margin: 30px;
margin-bottom: 0;
display: flex;
flex-flow: column;
align-items: baseline;
.cp-checkmark {
margin: 5px 0;
}
}
div.cp-broadcast-languages {
& > label.cp-checkmark:not(:last-child) {
margin-right: 20px;
}
}
.cp-broadcast-preview {
vertical-align: bottom !important;
}
.cp-broadcast-delete {
width: 100%;
min-width: 600px;
tbody {
tr {
background-color: @cp_support-msg-bg;
padding: 5px;
td {
padding: 5px;
button {
margin: 0 !important;
}
}
}
}
.cp-notification {
display: flex;
align-items: center;
.cp-avatar, .cp-broadcast, .cp-notification-dismiss {
display: none;
}
p {
margin: 0 !important;
}
.cp-notification-content {
width: 100%;
padding: 10px;
}
.cp-clickable {
cursor: pointer;
&:hover {
background-color: @cp_dropdown-bg-hover;
}
}
}
}
}
}

View file

@ -1,6 +1,7 @@
define([
'jquery',
'/api/config',
'/customize/application_config.js',
'/bower_components/chainpad-crypto/crypto.js',
'/common/toolbar.js',
'/bower_components/nthen/index.js',
@ -14,12 +15,16 @@ define([
'/common/common-signing-keys.js',
'/support/ui.js',
'/lib/datepicker/flatpickr.js',
'css!/lib/datepicker/flatpickr.min.css',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/admin/app-admin.less',
], function (
$,
ApiConfig,
AppConfig,
Crypto,
Toolbar,
nThen,
@ -31,7 +36,8 @@ define([
Util,
Hash,
Keys,
Support
Support,
Flatpickr
)
{
var APP = {
@ -47,7 +53,7 @@ define([
'cp-admin-update-limit',
'cp-admin-archive',
'cp-admin-unarchive',
// 'cp-admin-registration',
'cp-admin-registration',
],
'quota': [ // Msg.admin_cat_quota
'cp-admin-defaultlimit',
@ -67,6 +73,11 @@ define([
'cp-admin-support-list',
'cp-admin-support-init'
],
'broadcast': [ // Msg.admin_cat_broadcast
'cp-admin-maintenance',
'cp-admin-survey',
'cp-admin-broadcast',
],
'performance': [ // Msg.admin_cat_performance
'cp-admin-refresh-performance',
'cp-admin-performance-profiling',
@ -242,36 +253,32 @@ define([
create['registration'] = function () {
var key = 'registration';
var $div = makeBlock(key, true); // Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton
var $button = $div.find('button');
var $div = makeBlock(key); // Msg.admin_registrationHint, .admin_registrationTitle, .admin_registrationButton
var state = APP.instanceStatus.restrictRegistration;
if (state) {
$button.text(Messages.admin_registrationAllow);
} else {
$button.removeClass('btn-primary').addClass('btn-danger');
}
var called = false;
$div.find('button').click(function () {
called = true;
var $cbox = $(UI.createCheckbox('cp-settings-userfeedback',
Messages.admin_registrationTitle,
state, { label: { class: 'noTitle' } }));
var spinner = UI.makeSpinner($cbox);
var $checkbox = $cbox.find('input').on('change', function() {
spinner.spin();
var val = $checkbox.is(':checked') || false;
$checkbox.attr('disabled', 'disabled');
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE',
data: ['RESTRICT_REGISTRATION', [!state]]
data: ['RESTRICT_REGISTRATION', [val]]
}, function (e) {
if (e) { UI.warn(Messages.error); console.error(e); }
APP.updateStatus(function () {
called = false;
spinner.done();
state = APP.instanceStatus.restrictRegistration;
if (state) {
console.log($button);
$button.text(Messages.admin_registrationAllow);
$button.addClass('btn-primary').removeClass('btn-danger');
} else {
$button.text(Messages.admin_registrationButton);
$button.removeClass('btn-primary').addClass('btn-danger');
}
$checkbox[0].checked = state;
$checkbox.removeAttr('disabled');
});
});
});
$cbox.appendTo($div);
return $div;
};
@ -496,7 +503,7 @@ define([
}
var size = Array.isArray(obj) && obj[0];
if (typeof(size) !== "number") { return; }
UI.alert(Util.getPrettySize(size, Messages));
UI.alert(getPrettySize(size));
});
});
@ -559,6 +566,13 @@ define([
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'GET_FILE_DESCRIPTOR_COUNT',
}, function (e, data) {
if (e || (data && data.error)) {
console.error(e, data);
$div.append(h('pre', {
style: 'text-decoration: underline',
}, String(e || data.error)));
return;
}
console.log(e, data);
$div.find('pre').remove();
$div.append(h('pre', String(data)));
@ -930,6 +944,542 @@ define([
return;
};
var getApi = function (cb) {
return function () {
require(['/api/broadcast?'+ (+new Date())], function (Broadcast) {
cb(Broadcast);
setTimeout(function () {
try {
var ctx = require.s.contexts._;
var defined = ctx.defined;
Object.keys(defined).forEach(function (href) {
if (/^\/api\/broadcast\?[0-9]{13}/.test(href)) {
delete defined[href];
return;
}
});
} catch (e) {}
});
});
};
};
// Update the lastBroadcastHash in /api/broadcast if we can do it.
// To do so, find the last "BROADCAST_CUSTOM" in the current history and use the previous
// message's hash.
// If the last BROADCAST_CUSTOM has been deleted by an admin, we can use the most recent
// message's hash.
var checkLastBroadcastHash = function () {
var deleted = [];
require(['/api/broadcast?'+ (+new Date())], function (BCast) {
var hash = BCast.lastBroadcastHash || '1'; // Truthy value if no lastKnownHash
common.mailbox.getNotificationsHistory('broadcast', null, hash, function (e, msgs) {
if (e) { return void console.error(e); }
// No history, nothing to change
if (!Array.isArray(msgs)) { return; }
if (!msgs.length) { return; }
var lastHash;
var next = false;
// Start from the most recent messages until you find a CUSTOM message and
// check if it has been deleted
msgs.reverse().some(function (data) {
var c = data.content;
// This is the hash we want to keep
if (next) {
if (!c || !c.hash) { return; }
lastHash = c.hash;
next = false;
return true;
}
// initialize with the most recent hash
if (!lastHash && c && c.hash) { lastHash = c.hash; }
var msg = c && c.msg;
if (!msg) { return; }
// Remember all deleted messages
if (msg.type === "BROADCAST_DELETE") {
deleted.push(Util.find(msg, ['content', 'uid']));
}
// Only check custom messages
if (msg.type !== "BROADCAST_CUSTOM") { return; }
// If the most recent CUSTOM message has been deleted, it means we don't
// need to keep any message and we can continue with lastHash as the most
// recent broadcast message.
if (deleted.indexOf(msg.uid) !== -1) { return true; }
// We just found the oldest message we want to keep, move one iteration
// further into the loop to get the next message's hash.
// If this is the end of the loop, don't bump lastBroadcastHash at all.
next = true;
});
// If we don't have to bump our lastBroadcastHash, abort
if (next) { return; }
// Otherwise, bump to lastHash
console.warn('Updating last broadcast hash to', lastHash);
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE',
data: ['SET_LAST_BROADCAST_HASH', [lastHash]]
}, function (e) {
if (e) {
console.error(e);
return;
}
console.log('lastBroadcastHash updated');
});
});
});
};
create['broadcast'] = function () {
var key = 'broadcast';
var $div = makeBlock(key); // Msg.admin_broadcastHint, admin_broadcastTitle
var form = h('div.cp-admin-broadcast-form');
var $form = $(form).appendTo($div);
var refresh = getApi(function (Broadcast) {
var button = h('button.btn.btn-primary', Messages.admin_broadcastButton);
var $button = $(button);
var removeButton = h('button.btn.btn-danger', Messages.admin_broadcastCancel);
var active = h('div.cp-broadcast-active', h('p', Messages.admin_broadcastActive));
var $active = $(active);
var activeUid;
var deleted = [];
// Render active message (if there is one)
var hash = Broadcast.lastBroadcastHash || '1'; // Truthy value if no lastKnownHash
common.mailbox.getNotificationsHistory('broadcast', null, hash, function (e, msgs) {
if (e) { return void console.error(e); }
if (!Array.isArray(msgs)) { return; }
if (!msgs.length) {
$active.hide();
}
msgs.reverse().some(function (data) {
var c = data.content;
var msg = c && c.msg;
if (!msg) { return; }
if (msg.type === "BROADCAST_DELETE") {
deleted.push(Util.find(msg, ['content', 'uid']));
}
if (msg.type !== "BROADCAST_CUSTOM") { return; }
if (deleted.indexOf(msg.uid) !== -1) { return true; }
// We found an active custom message, show it
var el = common.mailbox.createElement(data);
var table = h('table.cp-broadcast-delete');
var $table = $(table);
var uid = Util.find(data, ['content', 'msg', 'uid']);
var time = Util.find(data, ['content', 'msg', 'content', 'time']);
var tr = h('tr', { 'data-uid': uid }, [
h('td', 'ID: '+uid),
h('td', new Date(time || 0).toLocaleString()),
h('td', el),
h('td.delete', removeButton),
]);
$table.append(tr);
$active.append(table);
activeUid = uid;
return true;
});
if (!activeUid) { $active.hide(); }
});
// Custom message
var container = h('div.cp-broadcast-container');
var $container = $(container);
var languages = Messages._languages;
var keys = Object.keys(languages).sort();
// Always keep the textarea ordered by language code
var reorder = function () {
$container.find('.cp-broadcast-lang').each(function (i, el) {
var $el = $(el);
var l = $el.attr('data-lang');
$el.css('order', keys.indexOf(l));
});
};
// Remove a textarea
var removeLang = function (l) {
$container.find('.cp-broadcast-lang[data-lang="'+l+'"]').remove();
var hasDefault = $container.find('.cp-broadcast-lang .cp-checkmark input:checked').length;
if (!hasDefault) {
$container.find('.cp-broadcast-lang').first().find('.cp-checkmark input').prop('checked', 'checked');
}
};
var getData = function () { return false; };
var onPreview = function (l) {
var data = getData();
if (data === false) { return void UI.warn(Messages.error); }
var msg = {
uid: Util.uid(),
type: 'BROADCAST_CUSTOM',
content: data
};
common.mailbox.onMessage({
lang: l,
type: 'broadcast',
content: {
msg: msg,
hash: 'LOCAL|' + JSON.stringify(msg).slice(0,58)
}
}, function () {
UI.log(Messages.saved);
});
};
// Add a textarea
var addLang = function (l) {
if ($container.find('.cp-broadcast-lang[data-lang="'+l+'"]').length) { return; }
var preview = h('button.btn.btn-secondary', Messages.broadcast_preview);
$(preview).click(function () {
onPreview(l);
});
var bcastDefault = Messages.broadcast_defaultLanguage;
var first = !$container.find('.cp-broadcast-lang').length;
var radio = UI.createRadio('broadcastDefault', null, bcastDefault, first, {
'data-lang': l,
label: {class: 'noTitle'}
});
$container.append(h('div.cp-broadcast-lang', { 'data-lang': l }, [
h('h4', languages[l]),
h('label', Messages.kanban_body),
h('textarea'),
radio,
preview
]));
reorder();
};
// Checkboxes to select translations
var boxes = keys.map(function (l) {
var $cbox = $(UI.createCheckbox('cp-broadcast-custom-lang-'+l,
languages[l], false, { label: { class: 'noTitle' } }));
var $check = $cbox.find('input').on('change', function () {
var c = $check.is(':checked');
if (c) { return void addLang(l); }
removeLang(l);
});
if (l === 'en') {
setTimeout(function () {
$check.click();
});
}
return $cbox[0];
});
// Extract form data
getData = function () {
var map = {};
var defaultLanguage;
var error = false;
$container.find('.cp-broadcast-lang').each(function (i, el) {
var $el = $(el);
var l = $el.attr('data-lang');
if (!l) { error = true; return; }
var text = $el.find('textarea').val();
if (!text.trim()) { error = true; return; }
if ($el.find('.cp-checkmark input').is(':checked')) {
defaultLanguage = l;
}
map[l] = text;
});
if (!Object.keys(map).length) {
console.error('You must select at least one language');
return false;
}
if (error) {
console.error('One of the selected languages has no data');
return false;
}
return {
defaultLanguage: defaultLanguage,
content: map
};
};
var send = function (data) {
$button.prop('disabled', 'disabled');
//data.time = +new Date(); // FIXME not used anymore?
common.mailbox.sendTo('BROADCAST_CUSTOM', data, {}, function (err) {
if (err) {
$button.prop('disabled', '');
console.error(err);
return UI.warn(Messages.error);
}
UI.log(Messages.saved);
refresh();
checkLastBroadcastHash();
});
};
$button.click(function () {
var data = getData();
if (data === false) { return void UI.warn(Messages.error); }
send(data);
});
UI.confirmButton(removeButton, {
classes: 'btn-danger',
}, function () {
if (!activeUid) { return; }
common.mailbox.sendTo('BROADCAST_DELETE', {
uid: activeUid
}, {}, function (err) {
if (err) { return UI.warn(Messages.error); }
UI.log(Messages.saved);
refresh();
checkLastBroadcastHash();
});
});
// Make the form
$form.empty().append([
active,
h('label', Messages.broadcast_translations),
h('div.cp-broadcast-languages', boxes),
container,
h('div.cp-broadcast-form-submit', [
h('br'),
button
])
]);
});
refresh();
return $div;
};
create['maintenance'] = function () {
var key = 'maintenance';
var $div = makeBlock(key); // Msg.admin_maintenanceHint, admin_maintenanceTitle
var form = h('div.cp-admin-broadcast-form');
var $form = $(form).appendTo($div);
var refresh = getApi(function (Broadcast) {
var button = h('button.btn.btn-primary', Messages.admin_maintenanceButton);
var $button = $(button);
var removeButton = h('button.btn.btn-danger', Messages.admin_maintenanceCancel);
var active;
if (Broadcast && Broadcast.maintenance) {
var m = Broadcast.maintenance;
if (m.start && m.end && m.end >= (+new Date())) {
active = h('div.cp-broadcast-active', [
UI.setHTML(h('p'), Messages._getKey('broadcast_maintenance', [
new Date(m.start).toLocaleString(),
new Date(m.end).toLocaleString(),
])),
removeButton
]);
}
}
// Start and end date pickers
var start = h('input');
var end = h('input');
var $start = $(start);
var $end = $(end);
var is24h = false;
try {
is24h = !new Intl.DateTimeFormat(navigator.language, { hour: 'numeric' }).format(0).match(/AM/);
} catch (e) {}
var endPickr = Flatpickr(end, {
enableTime: true,
time_24hr: is24h,
minDate: new Date()
});
Flatpickr(start, {
enableTime: true,
time_24hr: is24h,
minDate: new Date(),
onChange: function () {
endPickr.set('minDate', new Date($start.val()));
}
});
// Extract form data
var getData = function () {
var start = +new Date($start.val());
var end = +new Date($end.val());
if (isNaN(start) || isNaN(end)) {
console.error('Invalid dates');
return false;
}
return {
start: start,
end: end
};
};
var send = function (data) {
$button.prop('disabled', 'disabled');
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE',
data: ['SET_MAINTENANCE', [data]]
}, function (e) {
if (e) {
UI.warn(Messages.error); console.error(e);
$button.prop('disabled', '');
return;
}
// Maintenance applied, send notification
common.mailbox.sendTo('BROADCAST_MAINTENANCE', {}, {}, function () {
refresh();
checkLastBroadcastHash();
});
});
};
$button.click(function () {
var data = getData();
if (data === false) { return void UI.warn(Messages.error); }
send(data);
});
UI.confirmButton(removeButton, {
classes: 'btn-danger',
}, function () {
send("");
});
$form.empty().append([
active,
h('label', Messages.broadcast_start),
start,
h('label', Messages.broadcast_end),
end,
h('br'),
h('div.cp-broadcast-form-submit', [
button
])
]);
});
refresh();
common.makeUniversal('broadcast', {
onEvent: function (obj) {
var cmd = obj.ev;
if (cmd !== "MAINTENANCE") { return; }
refresh();
}
});
return $div;
};
create['survey'] = function () {
var key = 'survey';
var $div = makeBlock(key); // Msg.admin_surveyHint, admin_surveyTitle
var form = h('div.cp-admin-broadcast-form');
var $form = $(form).appendTo($div);
var refresh = getApi(function (Broadcast) {
var button = h('button.btn.btn-primary', Messages.admin_surveyButton);
var $button = $(button);
var removeButton = h('button.btn.btn-danger', Messages.admin_surveyCancel);
var active;
if (Broadcast && Broadcast.surveyURL) {
var a = h('a', {href: Broadcast.surveyURL}, Messages.admin_surveyActive);
$(a).click(function (e) {
e.preventDefault();
common.openUnsafeURL(Broadcast.surveyURL);
});
active = h('div.cp-broadcast-active', [
h('p', a),
removeButton
]);
}
// Survey form
var label = h('label', Messages.broadcast_surveyURL);
var input = h('input');
var $input = $(input);
// Extract form data
var getData = function () {
var url = $input.val();
if (!Util.isValidURL(url)) {
console.error('Invalid URL');
return false;
}
return url;
};
var send = function (data) {
$button.prop('disabled', 'disabled');
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'ADMIN_DECREE',
data: ['SET_SURVEY_URL', [data]]
}, function (e) {
if (e) {
$button.prop('disabled', '');
UI.warn(Messages.error); console.error(e);
return;
}
// Maintenance applied, send notification
common.mailbox.sendTo('BROADCAST_SURVEY', {
url: data
}, {}, function () {
refresh();
checkLastBroadcastHash();
});
});
};
$button.click(function () {
var data = getData();
if (data === false) { return void UI.warn(Messages.error); }
send(data);
});
UI.confirmButton(removeButton, {
classes: 'btn-danger',
}, function () {
send("");
});
$form.empty().append([
active,
label,
input,
h('br'),
h('div.cp-broadcast-form-submit', [
button
])
]);
});
refresh();
common.makeUniversal('broadcast', {
onEvent: function (obj) {
var cmd = obj.ev;
if (cmd !== "SURVEY") { return; }
refresh();
}
});
return $div;
};
var onRefreshPerformance = Util.mkEvent();
create['refresh-performance'] = function () {
@ -1010,6 +1560,7 @@ define([
stats: 'fa fa-line-chart',
quota: 'fa fa-hdd-o',
support: 'fa fa-life-ring',
broadcast: 'fa fa-bullhorn',
performance: 'fa fa-heartbeat',
};
@ -1094,8 +1645,7 @@ define([
var privateData = metadataMgr.getPrivateData();
common.setTabTitle(Messages.adminPage || 'Administration');
if (!privateData.edPublic || !ApiConfig.adminKeys || !Array.isArray(ApiConfig.adminKeys)
|| ApiConfig.adminKeys.indexOf(privateData.edPublic) === -1) {
if (!common.isAdmin()) {
return void UI.errorLoadingScreen(Messages.admin_authError || '403 Forbidden');
}

View file

@ -3,8 +3,9 @@ define([], function () {
var failMessages = [];
var passed = 0;
var ASSERTS = [];
var MESSAGES = [];
var assert = function (test, msg) {
MESSAGES.push(msg || false);
ASSERTS.push(function (cb, i) {
test(function (result) {
if (result === true) {
@ -17,7 +18,7 @@ define([], function () {
output: result,
});
}
});
}, msg);
});
};

View file

@ -0,0 +1,431 @@
@import (reference) '../../customize/src/less2/include/framework.less';
@import (reference) '../../customize/src/less2/include/sidebar-layout.less';
@import (reference) '../../customize/src/less2/include/tools.less';
@import (reference) '../../customize/src/less2/include/avatar.less';
&.cp-app-calendar {
.framework_min_main();
.sidebar-layout_main();
display: flex;
flex-flow: column;
.cp-toolbar-bottom-mid > div {
.cp-small { display: none; }
}
#cp-sidebarlayout-container #cp-sidebarlayout-rightside {
padding: 0;
& > div {
margin: 0;
}
.cp-forcehide {
display: none !important;
}
.tui-full-calendar-layout {
background-color: @cp_sidebar-right-bg !important;
color: @cryptpad_text_col;
display: flex;
flex-flow: column;
.tui-full-calendar-week-container {
min-height: 0;
display: flex;
flex-flow: column;
.tui-full-calendar-vlayout-area {
display: flex;
flex-flow: column;
flex: 1;
min-height: 0;
& > div:last-child {
flex: 1;
min-height: 0;
}
}
}
.tui-full-calendar-weekday-filled {
background-color: @cp_dropdown-bg-hover !important;
}
.tui-full-calendar-timegrid-hourmarker-time {
color: @cp_calendar-now !important;
}
.tui-full-calendar-timegrid-hourmarker-line-left, .tui-full-calendar-timegrid-hourmarker-line-today {
border-color: @cp_calendar-now !important;
}
.tui-full-calendar-timegrid-todaymarker {
background-color: @cp_calendar-now !important;
}
.tui-full-calendar-month {
display: flex;
flex-flow: column;
& > div:last-child {
display: flex;
flex-flow: column;
flex: 1;
min-height: 0;
overflow: hidden;
}
.tui-full-calendar-today .tui-full-calendar-weekday-grid-date-decorator {
background-color: @cp_calendar-now !important;
color: @cp_calendar-now-fg !important;
}
.tui-full-calendar-weekday-schedule-time .tui-full-calendar-weekday-schedule-title {
color: @cryptpad_text_col !important;
}
.tui-full-calendar-extra-date {
.tui-full-calendar-weekday-grid-date {
color: @cp_sidebar-hint !important;
opacity: 0.5;
}
}
.tui-full-calendar-weekday-grid-date {
color: @cryptpad_text_col !important;
}
.tui-full-calendar-month-dayname-item span {
color: @cryptpad_text_col !important;
}
}
.tui-full-calendar-dayname * {
color: @cryptpad_text_col !important;
}
.tui-full-calendar-month-more {
background-color: @cp_sidebar-right-bg !important;
color: @cryptpad_text_col;
span {
color: @cryptpad_text_col !important;
}
}
}
.tui-full-calendar-timegrid-timezone {
background-color: @cp_sidebar-right-bg !important;
.tui-full-calendar-timegrid-hour {
color: @cryptpad_text_col !important;
}
color: @cryptpad_text_col;
}
.tui-full-calendar-timegrid-gridline, .tui-full-calendar-time-date {
border-color: @cp_calendar-border !important;
}
.tui-full-calendar-splitter, .tui-full-calendar-left, .tui-full-calendar-dayname-container, .tui-full-calendar-weekday-grid-line {
border-color: @cp_calendar-border !important;
}
.tui-full-calendar-popup-container {
background: @cp_flatpickr-bg;
color: @cryptpad_text_col;
.tui-full-calendar-icon:not(.tui-full-calendar-calendar-dot):not(.tui-full-calendar-dropdown-arrow):not(.tui-full-calendar-ic-checkbox) {
display: none;
}
}
li.tui-full-calendar-popup-section-item {
padding: 0 6px;
height: 32px;
}
.tui-full-calendar-popup-section-item {
height: auto;
margin: 0;
&:not(li):not(button) {
padding: 0;
margin-top: 5px;
}
#tui-full-calendar-schedule-calendar {
width: 179px;
top: 0;
}
&:not(button) {
border: none;
display: inline-flex;
align-items: center;
&:hover {
background-color: @cp_dropdown-bg-hover;
}
.tui-full-calendar-content {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font: @colortheme_app-font;
}
input { flex: 1; }
}
}
.tui-full-calendar-section-date-dash {
height: auto;
}
.tui-full-calendar-section-title, .tui-full-calendar-section-location {
width: 100%;
}
.tui-full-calendar-dropdown-menu {
top: 38px;
width: 221px; // same as button
background-color: @cp_dropdown-bg;
color: @cp_dropdown-fg;
}
.tui-full-calendar-section-state, #tui-full-calendar-schedule-private {
display: none !important;
}
.tui-full-calendar-popup:not(.tui-full-calendar-popup-detail) {
.tui-full-calendar-section-calendar {
width: 221px; // 50%
}
.tui-full-calendar-popup-section {
display: flex;
align-items: center;
flex-wrap: wrap;
.tui-full-calendar-section-start-date, .tui-full-calendar-section-end-date {
flex: 1;
}
.tui-full-calendar-section-allday {
width: 100%;
height: 32px;
}
}
}
.tui-full-calendar-popup-detail {
font: @colortheme_app-font;
color: @cryptpad_text_col;
.tui-full-calendar-popup-container {
padding-bottom: 17px;
}
.tui-full-calendar-popup-detail-date {
font-size: 14px;
}
.tui-full-calendar-section-button {
border: 0;
display: flex;
align-items: center;
button {
flex: 1;
margin: 0;
}
}
.tui-full-calendar-popup-vertical-line {
visibility: hidden;
width: 10px;
}
}
.cp-calendar-add-notif {
flex-flow: column;
align-items: baseline !important;
margin: 10px 0;
.cp-notif-label {
color: @cp_sidebar-hint;
margin-right: 20px;
}
* {
font-size: @colortheme_app-font-size;
font-weight: normal;
}
& > div {
display: flex;
}
.cp-calendar-notif-list-container {
margin-bottom: 10px;
}
.cp-calendar-notif-list {
display: flex;
flex-flow: column;
.cp-notif-entry {
margin-bottom: 2px;
.cp-notif-value {
width: 170px;
display: inline-flex;
.cp-before {
flex: 1;
min-width: 0;
}
}
span:not(:last-child) {
margin-right: 5px;
}
}
}
.cp-notif-empty {
display: none;
}
.cp-calendar-notif-list:empty ~ .cp-notif-empty {
display: block;
}
.cp-calendar-notif-form {
align-items: center;
margin-bottom: 20px;
input {
width: 100px;
}
}
}
.cp-calendar-close {
height: auto;
line-height: initial;
border: 1px solid;
&:not(:hover) {
background: transparent;
}
}
}
#cp-toolbar .cp-calendar-browse {
display: flex;
align-items: center;
}
#cp-sidebarlayout-leftside {
& > div {
padding: 10px
}
.cp-calendar-new {
display: flex;
align-items: center;
justify-content: space-between;
}
.cp-calendar-list {
overflow-y: auto;
.cp-calendar-team {
height: 30px;
.avatar_main(30px);
.cp-avatar {
margin-right: 10px;
}
.cp-name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
display: flex;
align-items: center;
justify-content: center;
margin: 5px 0;
&:not(:first-child) {
margin-top: 30px;
}
}
.cp-calendar-entry {
display: flex;
align-items: center;
justify-content: space-between;
padding: 5px;
&:not(.cp-unclickable) {
cursor: pointer;
}
.cp-dropdown-container {
position: initial;
}
&.cp-ghost {
padding: 0;
button {
.tools_unselectable();
cursor: pointer;
width: 100%;
display: flex;
justify-content: space-between;
background: transparent;
border: 1px solid @cryptpad_text_col;
height: 36px;
font: @colortheme_app-font;
align-items: center;
color: @cryptpad_text_col;
&:hover {
background: @cp_sidebar-left-active;
}
}
}
&:not(:last-child) {
margin-bottom: 10px;
}
&:hover {
background: fade(@cryptpad_text_col, 10%);
}
&.cp-restricted {
color: @cp_drive-header-fg;
}
.cp-calendar-icon {
width: 36px;
display: inline-flex;
height: 36px;
margin: -5px;
align-items: center;
justify-content: center;
}
&.cp-active {
background: @cp_sidebar-left-active;
.cp-calendar-inactive {
display: none;
}
}
&:not(.cp-active) {
.cp-calendar-icon {
background: transparent !important;
}
.cp-calendar-active {
display: none;
}
}
.tools_unselectable();
.cp-calendar-color {
display: inline-block;
border-radius: 50%;
width: 15px;
height: 15px;
flex-shrink: 0;
}
.cp-calendar-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 5px;
}
}
}
}
.cp-calendar-colorpicker {
width: 100px;
height: 25px;
cursor: pointer;
border: 1px solid @cp_forms-border;
}
@media (max-width: @browser_media-medium-screen) {
.cp-calendar-newevent {
i {
margin: 0 !important;
}
span {
display: none;
}
}
.tui-full-calendar-dayname-leftmargin, .tui-full-calendar-timegrid-right {
margin-left: 40px !important;
}
.tui-full-calendar-allday-left, .tui-full-calendar-timegrid-left {
width: 40px !important;
}
.tui-full-calendar-dayname > span {
display: flex;
flex-flow: column;
line-height: 0;
justify-content: center;
align-items: center;
height: 100%;
}
.tui-full-calendar-dayname * {
font-size: 11px;
line-height: initial;
height: auto;
}
.cp-toolbar-bottom-mid > div {
:not(:first-child) {
display: none;
}
:first-child {
display: inline-block;
}
}
}
}

208
www/calendar/export.js Normal file
View file

@ -0,0 +1,208 @@
// This file is used when a user tries to export the entire CryptDrive.
// Calendars will be exported using this format instead of plain text.
define([
'/customize/pages.js',
], function (Pages) {
var module = {};
var getICSDate = function (str) {
var date = new Date(str);
var m = date.getUTCMonth() + 1;
var d = date.getUTCDate();
var h = date.getUTCHours();
var min = date.getUTCMinutes();
var year = date.getUTCFullYear().toString();
var month = m < 10 ? "0" + m : m.toString();
var day = d < 10 ? "0" + d : d.toString();
var hours = h < 10 ? "0" + h : h.toString();
var minutes = min < 10 ? "0" + min : min.toString();
return year + month + day + "T" + hours + minutes + "00Z";
};
var getDate = function (str, end) {
var date = new Date(str);
if (end) {
date.setDate(date.getDate() + 1);
}
var m = date.getUTCMonth() + 1;
var d = date.getUTCDate();
var year = date.getUTCFullYear().toString();
var month = m < 10 ? "0" + m : m.toString();
var day = d < 10 ? "0" + d : d.toString();
return year+month+day;
};
var MINUTE = 60;
var HOUR = MINUTE * 60;
var DAY = HOUR * 24;
module.main = function (userDoc) {
var content = userDoc.content;
var ICS = [
'BEGIN:VCALENDAR',
'VERSION:2.0',
'PRODID:-//CryptPad//CryptPad Calendar '+Pages.versionString+'//EN',
'METHOD:PUBLISH',
];
Object.keys(content).forEach(function (uid) {
var data = content[uid];
// DTSTAMP: now...
// UID: uid
var start, end;
if (data.isAllDay && data.startDay && data.endDay) {
start = "DTSTART;VALUE=DATE:" + getDate(data.startDay);
end = "DTEND;VALUE=DATE:" + getDate(data.endDay, true);
} else {
start = "DTSTART:"+getICSDate(data.start);
end = "DTEND:"+getICSDate(data.end);
}
Array.prototype.push.apply(ICS, [
'BEGIN:VEVENT',
'DTSTAMP:'+getICSDate(+new Date()),
'UID:'+uid,
start,
end,
'SUMMARY:'+ data.title,
'LOCATION:'+ data.location,
]);
if (Array.isArray(data.reminders)) {
data.reminders.forEach(function (valueMin) {
var time = valueMin * 60;
var days = Math.floor(time / DAY);
time -= days * DAY;
var hours = Math.floor(time / HOUR);
time -= hours * HOUR;
var minutes = Math.floor(time / MINUTE);
time -= minutes * MINUTE;
var seconds = time;
var str = "-P" + days + "D";
if (hours || minutes || seconds) {
str += "T" + hours + "H" + minutes + "M" + seconds + "S";
}
Array.prototype.push.apply(ICS, [
'BEGIN:VALARM',
'ACTION:DISPLAY',
'DESCRIPTION:This is an event reminder',
'TRIGGER:'+str,
'END:VALARM'
]);
});
}
if (Array.isArray(data.cp_hidden)) {
Array.prototype.push.apply(ICS, data.cp_hidden);
}
ICS.push('END:VEVENT');
});
ICS.push('END:VCALENDAR');
return new Blob([ ICS.join('\n') ], { type: 'text/calendar;charset=utf-8' });
};
module.import = function (content, id, cb) {
require(['/lib/ical.min.js'], function () {
var ICAL = window.ICAL;
var res = {};
var vcalendar;
try {
var jcalData = ICAL.parse(content);
vcalendar = new ICAL.Component(jcalData);
} catch (e) {
return void cb(e);
}
//var method = vcalendar.getFirstPropertyValue('method');
//if (method !== "PUBLISH") { return void cb('NOT_SUPPORTED'); }
// Add all timezones in iCalendar object to TimezoneService
// if they are not already registered.
var timezones = vcalendar.getAllSubcomponents("vtimezone");
timezones.forEach(function (timezone) {
if (!(ICAL.TimezoneService.has(timezone.getFirstPropertyValue("tzid")))) {
ICAL.TimezoneService.register(timezone);
}
});
var events = vcalendar.getAllSubcomponents('vevent');
events.forEach(function (ev) {
var uid = ev.getFirstPropertyValue('uid');
if (!uid) { return; }
// Get start and end time
var isAllDay = false;
var start = ev.getFirstPropertyValue('dtstart');
var end = ev.getFirstPropertyValue('dtend');
if (start.isDate && end.isDate) {
isAllDay = true;
start = String(start);
end.adjust(-1); // Substract one day
end = String(end);
} else {
start = +start.toJSDate();
end = +end.toJSDate();
}
// Store other properties
var used = ['dtstart', 'dtend', 'uid', 'summary', 'location', 'dtstamp'];
var hidden = [];
ev.getAllProperties().forEach(function (p) {
if (used.indexOf(p.name) !== -1) { return; }
// This is an unused property
hidden.push(p.toICALString());
});
// Get reminders
var reminders = [];
ev.getAllSubcomponents('valarm').forEach(function (al) {
var action = al.getFirstPropertyValue('action');
if (action !== 'DISPLAY') {
// Email notification: keep it in "hidden" and create a cryptpad notification
hidden.push(al.toString());
}
var trigger = al.getFirstPropertyValue('trigger');
var minutes = -trigger.toSeconds() / 60;
if (reminders.indexOf(minutes) === -1) { reminders.push(minutes); }
});
// Create event
res[uid] = {
calendarId: id,
id: uid,
category: 'time',
title: ev.getFirstPropertyValue('summary'),
location: ev.getFirstPropertyValue('location'),
isAllDay: isAllDay,
start: start,
end: end,
reminders: reminders,
cp_hidden: hidden
};
if (!hidden.length) { delete res[uid].cp_hidden; }
if (!reminders.length) { delete res[uid].reminders; }
});
cb(null, res);
});
};
return module;
});

12
www/calendar/index.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer" />
<script async data-bootload="main.js" data-main="/common/boot.js?ver=1.0" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
<link href="/customize/src/outer.css?ver=1.3.2" rel="stylesheet" type="text/css">
</head>
<body>
<iframe-placeholder>

18
www/calendar/inner.html Normal file
View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html class="cp-app-noscroll">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script async data-bootload="/calendar/inner.js" data-main="/common/sframe-boot.js?ver=1.7" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
<style>
.loading-hidden { display: none; }
</style>
</head>
<body class="cp-app-calendar">
<div id="cp-toolbar" class="cp-toolbar-container"></div>
<div id="cp-sidebarlayout-container"></div>
<noscript>
<p><strong>OOPS</strong> In order to do encryption in your browser, Javascript is really <strong>really</strong> required.</p>
<p><strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.</p>
</noscript>
</body>

1292
www/calendar/inner.js Normal file

File diff suppressed because it is too large Load diff

24
www/calendar/main.js Normal file
View file

@ -0,0 +1,24 @@
// 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',
'/common/dom-ready.js',
'/common/sframe-common-outer.js',
], function (nThen, ApiConfig, DomReady, SFCommonO) {
// Loaded in load #2
nThen(function (waitFor) {
DomReady.onReady(waitFor());
}).nThen(function (waitFor) {
SFCommonO.initIframe(waitFor);
}).nThen(function (/*waitFor*/) {
var addData = function (meta) {
meta.calendarHash = Boolean(window.location.hash);
};
SFCommonO.start({
addData: addData,
noRealtime: true,
cache: true,
});
});
});

View file

@ -1,7 +1,6 @@
@import (reference) "../include/colortheme-all.less";
@import (reference) "../include/font.less";
//@import (reference) "../include/forms.less";
@import (reference) "../include/alertify.less";
@import (reference) "../../customize/src/less2/include/colortheme-all.less";
@import (reference) "../../customize/src/less2/include/font.less";
@import (reference) "../../customize/src/less2/include/alertify.less";
html, body {
.font_main();
@ -52,12 +51,29 @@ html, body {
.advisory-text {
display: inline-block;
word-break: break-all;
word-break: break-word;
padding: 5px;
//font-size: 16px;
border: 1px solid red;
background-color: @cp_alerts-danger-bg;
color: @cp_alerts-danger-text;
&.cp-danger {
border: 1px solid @cp_alerts-danger-bg;
background-color: @cp_alerts-danger-bg;
color: @cp_alerts-danger-text;
}
&.cp-warning {
border: 1px solid @cp_alerts-warning-bg;
background-color: @cp_alerts-warning-bg;
color: @cp_alerts-warning-text;
}
code {
word-break: keep-all;
font-style: italic;
}
a {
color: @cryptpad_color_link;
}
}
.cp-app-checkup-version {
text-decoration: underline;
}
iframe {

View file

@ -12,45 +12,108 @@ define([
'/common/common-util.js',
'/common/pinpad.js',
'/common/outer/network-config.js',
'/customize/pages.js',
'/bower_components/tweetnacl/nacl-fast.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/pages/page-checkup.less',
'less!/checkup/app-checkup.less',
], function ($, ApiConfig, Assertions, h, Messages, DomReady,
nThen, SFCommonO, Login, Hash, Util, Pinpad,
NetConfig) {
var assert = Assertions();
NetConfig, Pages) {
var Assert = Assertions();
var trimSlashes = function (s) {
if (typeof(s) !== 'string') { return s; }
return s.replace(/\/+$/, '');
};
var _alert = function (content) {
return h('span.advisory-text', content);
var assert = function (f, msg) {
Assert(f, msg || h('span.advisory-text.cp-danger'));
};
var CONFIG_PATH = function () {
return h('code', 'cryptpad/config/config.js');
};
var API_CONFIG_LINK = function () {
return h('a', {
href: '/api/config',
target: '_blank',
}, '/api/config');
};
var RESTART_WARNING = function () {
return h('span', [
'Changes to ',
CONFIG_PATH(),
' will require a server restart in order for ',
API_CONFIG_LINK(),
' to be updated.',
]);
};
var trimmedSafe = trimSlashes(ApiConfig.httpSafeOrigin);
var trimmedUnsafe = trimSlashes(ApiConfig.httpUnsafeOrigin);
assert(function (cb) {
assert(function (cb, msg) {
msg.appendChild(h('span', [
"CryptPad's sandbox requires that both ",
h('code', 'httpUnsafeOrigin'),
' and ',
h('code', 'httpSafeOrigin'),
" be configured in ",
CONFIG_PATH(),
'. ',
RESTART_WARNING(),
]));
//console.error(trimmedSafe, trimmedUnsafe);
cb(Boolean(trimmedSafe && trimmedUnsafe));
}, _alert("Sandbox configuration: ensure that both httpUnsafeOrigin and httpSafeOrigin are defined"));
});
assert(function (cb, msg) {
msg.appendChild(h('span', [
h('code', 'httpUnsafeOrigin'),
' and ',
h('code', 'httpSafeOrigin'),
' are equivalent. ',
"In order for CryptPad's security features to be as effective as intended they must be different. ",
"See ",
CONFIG_PATH(),
'. ',
RESTART_WARNING(),
]));
assert(function (cb) {
return void cb(trimmedSafe !== trimmedUnsafe);
}, _alert('Sandbox configuration: httpUnsafeOrigin !== httpSafeOrigin'));
});
assert(function (cb) {
cb(trimmedSafe === ApiConfig.httpSafeOrigin);
}, "httpSafeOrigin must not have a trailing slash");
assert(function (cb, msg) {
msg.appendChild(h('span', [
h('code', 'httpUnsafeOrigin'),
' and ',
h('code', 'httpSafeOrigin'),
' must not contain trailing slashes. This can be configured in ',
CONFIG_PATH(),
'. ',
RESTART_WARNING(),
]));
cb(trimmedSafe === ApiConfig.httpSafeOrigin && trimmedUnsafe === ApiConfig.httpUnsafeOrigin);
});
assert(function (cb) {
assert(function (cb, msg) {
msg.appendChild(h("span", [
"It appears that you are trying to load this page via an origin other than its main domain (",
h('code', ApiConfig.httpUnsafeOrigin),
"). See the ",
h('code', 'httpUnsafeOrigin'),
" option in ",
CONFIG_PATH(),
" which is exposed via ",
API_CONFIG_LINK(),
'.',
]));
var origin = window.location.origin;
return void cb(ApiConfig.httpUnsafeOrigin === origin);
}, _alert('Sandbox configuration: loading via httpUnsafeOrigin'));
});
var checkAvailability = function (url, cb) {
$.ajax({
@ -62,12 +125,38 @@ define([
});
};
assert(function (cb) {
assert(function (cb, msg) {
msg.appendChild(h('span', [
"The main domain (configured via ",
h('code', 'httpUnsafeOrigin'),
' as ',
ApiConfig.httpUnsafeOrigin,
' in ',
CONFIG_PATH(),
' and exposed via ',
API_CONFIG_LINK(),
') could not be reached.',
]));
checkAvailability(trimmedUnsafe, cb);
}, _alert("Main domain is not available"));
});
// Try loading an iframe on the safe domain
assert(function (cb) {
assert(function (cb, msg) {
msg.appendChild(h('span', [
"Your browser was not able to load an iframe using the origin specified as ",
h('code', "httpSafeOrigin"),
" (",
ApiConfig.httpSafeOrigin,
") in ",
CONFIG_PATH(),
". This can be caused by an invalid ",
h('code', 'httpUnsafeDomain'),
', invalid CSP configuration in your reverse proxy, invalid SSL certificates, and many other factors. ',
'More information about your particular error may be found in your browser console. ',
RESTART_WARNING(),
]));
var to;
nThen(function (waitFor) {
DomReady.onReady(waitFor());
@ -82,16 +171,24 @@ define([
clearTimeout(to);
cb(true);
});
}, _alert("Sandbox domain is not available"));
});
// Test Websocket
var evWSError = Util.mkEvent(true);
assert(function (cb) {
assert(function (_cb, msg) {
var timeoutErr = 'Could not connect to the websocket server within 5 seconds.';
var cb = Util.once(Util.both(_cb, function (status) {
if (status === true) { return; }
msg.appendChild(h('span#websocket', [
status || 'Unknown websocket error',
]));
}));
var ws = new WebSocket(NetConfig.getWebsocketURL());
var to = setTimeout(function () {
console.error('Websocket TIMEOUT');
evWSError.fire();
cb('TIMEOUT (5 seconds)');
cb(timeoutErr);
}, 5000);
ws.onopen = function () {
clearTimeout(to);
@ -99,14 +196,40 @@ define([
};
ws.onerror = function (err) {
clearTimeout(to);
console.error('Websocket error', err);
console.error('[Websocket error]', err);
evWSError.fire();
cb('WebSocket error: check your console');
cb('Unable to connect to the websocket server. More information may be available in your browser console ([Websocket error]).');
};
}, _alert("Websocket is not available"));
});
// Test login block
assert(function (cb) {
assert(function (_cb, msg) {
var websocketErr = "No WebSocket available";
var cb = Util.once(Util.both(_cb, function (status) {
if (status === true) { return; }
if (status === websocketErr) {
msg.appendChild(h('span', [
websocketErr,
' See ',
h('a', {
href: '#websocket',
}, 'the related websocket error'),
]));
return;
}
// else
msg.appendChild(h('span', [
"Unable to create, retrieve, or remove encrypted credentials from the server. ",
"This is most commonly caused by a mismatch between the value of the ",
h('code', 'blockPath'),
' value configured in ',
CONFIG_PATH(),
" and the corresponding settings in your reverse proxy's configuration file,",
" but it can also be explained by a websocket error. ",
RESTART_WARNING(),
]));
}));
var bytes = new Uint8Array(Login.requiredBytes);
var opt = Login.allocateBytes(bytes);
@ -121,7 +244,7 @@ define([
opt.keys = secret.keys;
opt.channelHex = secret.channel;
var RT, rpc, exists;
var RT, rpc, exists, restricted;
nThen(function (waitFor) {
Util.fetch(blockUrl, waitFor(function (err) {
@ -132,7 +255,7 @@ define([
// If WebSockets aren't working, don't wait forever here
evWSError.reg(function () {
waitFor.abort();
cb("No WebSocket (test number 6)");
cb(websocketErr);
});
// Create proxy
Login.loadUserObject(opt, waitFor(function (err, rt) {
@ -163,6 +286,12 @@ define([
// Write block
if (exists) { return; }
rpc.writeLoginBlock(blockRequest, waitFor(function (e) {
// we should tolerate restricted registration
// and proceed to clean up after any data we've created
if (e === 'E_RESTRICTED') {
restricted = true;
return void cb(true);
}
if (e) {
waitFor.abort();
console.error("Can't write login block", e);
@ -170,6 +299,7 @@ define([
}
}));
}).nThen(function (waitFor) {
if (restricted) { return; }
// Read block
Util.fetch(blockUrl, waitFor(function (e) {
if (e) {
@ -181,6 +311,7 @@ define([
}).nThen(function (waitFor) {
// Remove block
rpc.removeLoginBlock(removeRequest, waitFor(function (e) {
if (restricted) { return; } // an ENOENT is expected in the case of restricted registration, but we call this anyway to clean up any mess from previous tests.
if (e) {
waitFor.abort();
console.error("Can't remove login block", e);
@ -200,7 +331,207 @@ define([
cb(true);
});
}, _alert("Login block is not working (write/read/remove)"));
});
var sheetURL = '/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/index.html';
assert(function (cb, msg) {
msg.innerText = "Missing HTTP headers required for .xlsx export from sheets. ";
var url = sheetURL;
var expect = {
'cross-origin-resource-policy': 'cross-origin',
'cross-origin-embedder-policy': 'require-corp',
//'cross-origin-opener-policy': 'same-origin', // FIXME this is in our nginx config but not server.js
};
$.ajax(url, {
complete: function (xhr) {
cb(!Object.keys(expect).some(function (k) {
var response = xhr.getResponseHeader(k);
if (response !== expect[k]) {
msg.appendChild(h('span', [
'A value of ',
h('code', expect[k]),
' was expected for the ',
h('code', k),
' HTTP header, but instead a value of "',
h('code', response),
'" was received.',
]));
return true; // returning true indicates that a value is incorrect
}
}));
},
});
});
assert(function (cb, msg) {
msg.innerText = "Missing HTTP header required to disable Google's Floc.";
$.ajax('/?'+ (+new Date()), {
complete: function (xhr) {
cb(xhr.getResponseHeader('permissions-policy') === 'interest-cohort=()');
},
});
});
assert(function (cb, msg) {
msg = msg;
return void cb(true);
/*
msg.appendChild(h('span', [
"The spreadsheet editor's code was not served with the required Content-Security Policy headers. ",
"This is most often caused by incorrectly configured sandbox parameters (",
h('code', 'httpUnsafeOrigin'),
' and ',
h('code', 'httpSafeOrigin'),
' in ',
CONFIG_PATH,
"), or settings in your reverse proxy's configuration which don't match your application server's config. ",
RESTART_WARNING(),
]));
$.ajax(sheetURL, {
complete: function (xhr) {
var csp = xhr.getResponseHeader('Content-Security-Policy');
if (!/unsafe\-eval/.test(csp)) {
// OnlyOffice requires unsafe-eval
console.error('CSP', csp);
return cb("expected 'unsafe-eval'");
}
if (!/unsafe\-inline/.test(csp)) {
// OnlyOffice also requires unsafe-inline
console.error('CSP', csp);
return cb("expected 'unsafe-inline'");
}
cb(true);
},
}); */
});
assert(function (cb, msg) {
msg.appendChild(h('span', [
h('code', '/api/broadcast'),
" could not be loaded. This can be caused by an outdated application server or an incorrectly configured reverse proxy. ",
"Even if the most recent code has been downloaded it's possible the application server has not been restarted. ",
"Your browser console may provide more details as to why this resource could not be loaded. ",
]));
$.ajax('/api/broadcast', {
dataType: 'text',
complete: function (xhr) {
console.log(xhr);
cb(xhr.status === 200);
},
});
});
var checkAPIHeaders = function (url, cb) {
$.ajax(url, {
dataType: 'text',
complete: function (xhr) {
var allHeaders = xhr.getAllResponseHeaders();
var headers = {};
var duplicated = allHeaders.split('\n').some(function (header) {
var duplicate;
header.replace(/([^:]+):(.*)/, function (all, type, value) {
type = type.trim();
if (typeof(headers[type]) !== 'undefined') {
duplicate = true;
}
headers[type] = value.trim();
});
return duplicate;
});
var expect = {
'cross-origin-resource-policy': 'cross-origin',
};
var incorrect = Object.keys(expect).some(function (k) {
var response = xhr.getResponseHeader(k);
if (response !== expect[k]) {
return true;
}
});
if (duplicated || incorrect) { console.error(allHeaders); }
cb(!duplicated && !incorrect);
},
});
};
var INCORRECT_HEADER_TEXT = ' was served with duplicated or incorrect headers. Compare your reverse-proxy configuration against the provided example.';
assert(function (cb, msg) {
var url = '/api/config';
msg.innerText = url + INCORRECT_HEADER_TEXT;
checkAPIHeaders(url, cb);
});
assert(function (cb, msg) {
var url = '/api/broadcast';
msg.innerText = url + INCORRECT_HEADER_TEXT;
checkAPIHeaders(url, cb);
});
var setWarningClass = function (msg) {
$(msg).removeClass('cp-danger').addClass('cp-warning');
};
assert(function (cb, msg) {
var email = ApiConfig.adminEmail;
if (typeof(email) === 'string' && email && email !== 'i.did.not.read.my.config@cryptpad.fr') {
return void cb(true);
}
setWarningClass(msg);
msg.appendChild(h('span', [
'This instance does not provide a valid ',
h('code', 'adminEmail'),
' which can make it difficult to contact its adminstrator to report vulnerabilities or abusive content.',
' This can be configured in ', CONFIG_PATH(), '. ',
RESTART_WARNING(),
]));
cb(email);
});
assert(function (cb, msg) {
var support = ApiConfig.supportMailbox;
setWarningClass(msg);
msg.appendChild(h('span', [
"This instance's encrypted support ticket functionality has not been enabled. This can make it difficult for its users to safely report issues that concern sensitive information. ",
"This can be configured via the ",
h('code', 'supportMailbox'),
" attribute in ",
CONFIG_PATH(),
". ",
RESTART_WARNING(),
]));
cb(support && typeof(support) === 'string' && support.length === 44);
});
assert(function (cb, msg) {
var adminKeys = ApiConfig.adminKeys;
if (Array.isArray(adminKeys) && adminKeys.length >= 1 && typeof(adminKeys[0]) === 'string' && adminKeys[0].length === 44) {
return void cb(true);
}
setWarningClass(msg);
msg.appendChild(h('span', [
"This instance has not been configured to support web administration. This can be enabled by adding a registered user's public signing key to the ",
h('code', 'adminKeys'),
' array in ',
CONFIG_PATH(),
'. ',
RESTART_WARNING(),
]));
cb(false);
});
if (false) {
assert(function (cb, msg) {
msg.innerText = 'fake test to simulate failure';
cb(false);
});
}
var row = function (cells) {
return h('tr', cells.map(function (cell) {
@ -220,7 +551,20 @@ define([
var completed = 0;
var $progress = $('#cp-progress');
assert.run(function (state) {
var versionStatement = function () {
return h('p', [
"This instance is running ",
h('span.cp-app-checkup-version',[
"CryptPad",
' ',
Pages.versionString,
]),
'.',
]);
};
Assert.run(function (state) {
var errors = state.errors;
var failed = errors.length;
@ -228,12 +572,17 @@ define([
var statusClass = failed? 'failure': 'success';
var failedDetails = "Details found below";
var successDetails = "This checkup only tests the most common configuration issues. You may still experience errors or incorrect behaviour.";
var details = h('p', failed? failedDetails: successDetails);
var summary = h('div.summary.' + statusClass, [
versionStatement(),
h('p', Messages._getKey('assert_numberOfTestsPassed', [
state.passed,
state.total
])),
h('p', "Details found below"),
details,
]);
var report = h('div.report', [
@ -248,6 +597,7 @@ define([
completed++;
Messages.assert_numberOfTestsCompleted = "{0} / {1} tests completed.";
$progress.html('').append(h('div.report.pending.summary', [
versionStatement(),
h('p', [
h('i.fa.fa-spinner.fa-pulse'),
h('span', Messages._getKey('assert_numberOfTestsCompleted', [completed, total]))

View file

@ -129,13 +129,28 @@
}
@media (max-width: @browser_media-medium-screen) {
#cp-app-code-container {
flex: 1;
max-width: 100%;
resize: none;
}
#cp-app-code-preview {
display: none !important;
#cp-app-code-editor {
&.cp-app-code-present {
#cp-app-code-container { display: none !important; }
#cp-app-code-preview {
flex: 1;
max-width: 100%;
border: 0;
#cp-app-code-preview-content {
margin: 10px;
}
}
}
&:not(.cp-app-code-present) {
#cp-app-code-container {
flex: 1;
max-width: 100%;
resize: none;
}
#cp-app-code-preview {
display: none !important;
}
}
}
}
#cp-app-code-print {

View file

@ -12,7 +12,7 @@ define(function() {
* You should never remove the drive from this list.
*/
config.availablePadTypes = ['drive', 'teams', 'pad', 'sheet', 'code', 'slide', 'poll', 'kanban', 'whiteboard',
/*'oodoc', 'ooslide',*/ 'file', /*'todo',*/ 'contacts'];
/*'doc', 'presentation',*/ 'file', /*'todo',*/ 'contacts' /*, 'calendar' */];
/* 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.
@ -20,7 +20,7 @@ define(function() {
* users and these users will be redirected to the login page if they still try to access
* the app
*/
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications', 'support'];
config.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support'];
/* CryptPad is available is multiple languages, but only English and French are maintained
* by the developers. The other languages may be outdated, and any missing string for a langauge
@ -43,9 +43,15 @@ define(function() {
/* You can display a link to your own privacy policy in the static pages footer.
* To do so, set the following value to the absolute URL of your privacy policy.
*/
config.privacy = '/privacy.html';
// config.privacy = 'https://xwiki.com/en/company/PrivacyPolicy';
/* We (the project's developers) include the ability to display a 'Roadmap' in static pages footer.
* This is disabled by default.
* We use this to publish the project's development roadmap, but you can use it however you like.
* To do so, set the following value to an absolute URL.
*/
//config.roadmap = 'https://cryptpad.fr/kanban/#/2/kanban/view/PLM0C3tFWvYhd+EPzXrbT+NxB76Z5DtZhAA5W5hG9wo/';
/* Cryptpad apps use a common API to display notifications to users
* by default, notifications are hidden after 5 seconds
* You can change their duration here (measured in milliseconds)
@ -115,8 +121,8 @@ define(function() {
todo: 'cptools-todo',
contacts: 'fa-address-book',
kanban: 'cptools-kanban',
oodoc: 'fa-file-word-o',
ooslide: 'fa-file-powerpoint-o',
doc: 'fa-file-word-o',
presentation: 'fa-file-powerpoint-o',
sheet: 'cptools-sheet',
drive: 'fa-hdd-o',
teams: 'fa-users',
@ -162,8 +168,6 @@ define(function() {
// making it much faster to open new tabs.
config.disableWorkers = false;
config.surveyURL = "https://survey.cryptpad.fr/index.php/672782";
// Teams are always loaded during the initial loading screen (for the first tab only if
// SharedWorkers are available). Allowing users to be members of multiple teams can
// make them have a very slow loading time. To avoid impacting the user experience
@ -179,5 +183,23 @@ define(function() {
// You can change the value here.
// config.maxOwnedTeams = 5;
// The userlist displayed in collaborative documents is stored alongside the document data.
// Everytime someone with edit rights joins a document or modify their user data (display
// name, avatar, color, etc.), they update the "userlist" part of the document. When too many
// editors are in the same document, all these changes increase the risks of conflicts which
// require CPU time to solve. A "degraded" mode can now be set when a certain number of editors
// are in a document at the same time. This mode disables the userlist, the chat and the
// position of other users' cursor. You can configure the number of user from which the session
// will enter into degraded mode. A big number may result in collaborative edition being broken,
// but this number depends on the network and CPU performances of each user's device.
config.degradedLimit = 8;
// In "legacy" mode, one-time users were always creating an "anonymous" drive when visiting CryptPad
// in which they could store their pads. The new "driveless" mode allow users to open an existing
// pad without creating a drive in the background. The drive will only be created if they visit
// a different page (Drive, Settings, etc.) or try to create a new pad themselves. You can disable
// the driveless mode by changing the following value to "false"
config.allowDrivelessMode = true;
return config;
});

View file

@ -15,6 +15,6 @@ define(['/customize/application_config.js'], function (AppConfig) {
MAX_TEAMS_SLOTS: AppConfig.maxTeamsSlots || 5,
MAX_TEAMS_OWNED: AppConfig.maxOwnedTeams || 5,
// Apps
criticalApps: ['profile', 'settings', 'debug', 'admin', 'support', 'notifications']
criticalApps: ['profile', 'settings', 'debug', 'admin', 'support', 'notifications', 'calendar']
};
});

View file

@ -644,6 +644,10 @@ Version 4: Data URL when not a realtime link yet (new pad or "static" app)
'/' + curvePublic.replace(/\//g, '-') + '/';
};
Hash.isValidChannel = function (channelId) {
return /^[a-zA-Z0-9]{32,48}$/.test(channelId);
};
Hash.isValidHref = function (href) {
// Non-empty href?
if (!href) { return; }

View file

@ -739,6 +739,7 @@ define([
}
});
};
// TODO: make it such that the confirmButton's width does not change
UI.confirmButton = function (originalBtn, config, _cb) {
config = config || {};
var cb = Util.mkAsync(_cb);
@ -1257,10 +1258,13 @@ define([
Messages.dontShowAgain
]);
var footerSel = 'div.cp-corner-footer';
var popup = h('div.cp-corner-container', [
setHTML(h('div.cp-corner-text'), text),
h('div.cp-corner-actions', actions),
setHTML(h('div.cp-corner-footer'), footer),
(typeof(footer) === 'string'?
setHTML(h(footerSel), footer):
h(footerSel, footer)),
opts.dontShowAgain ? dontShowAgain : undefined
]);
@ -1430,13 +1434,13 @@ define([
*/
UI.createDrawer = function ($button, $content) {
$button.click(function () {
var topPos = $button[0].getBoundingClientRect().bottom;
$content.toggle();
$button.removeClass('cp-toolbar-button-active');
if ($content.is(':visible')) {
$button.addClass('cp-toolbar-button-active');
$content.focus();
var wh = $(window).height();
var topPos = $button[0].getBoundingClientRect().bottom;
$content.css('max-height', Math.floor(wh - topPos - 1)+'px');
}
});

View file

@ -1,6 +1,7 @@
define([
'jquery',
'/api/config',
'/api/broadcast',
'/common/common-util.js',
'/common/common-hash.js',
'/common/common-language.js',
@ -17,7 +18,7 @@ define([
'/common/visible.js',
'css!/customize/fonts/cptools/style.css',
], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, Clipboard,
], function ($, Config, Broadcast, Util, Hash, Language, UI, Constants, Feedback, h, Clipboard,
Messages, AppConfig, Pages, NThen, InviteInner, Visible) {
var UIElements = {};
var urlArgs = Config.requireConf.urlArgs;
@ -126,7 +127,7 @@ define([
dcAlert = undefined;
};
var importContent = function (type, f, cfg) {
var importContent = UIElements.importContent = function (type, f, cfg) {
return function () {
var $files = $('<input>', {type:"file"});
if (cfg && cfg.accept) {
@ -369,7 +370,7 @@ define([
h('div.cp-teams-invite-block', [
h('span', Messages.team_inviteLinkSetPassword),
h('a.cp-teams-help.fa.fa-question-circle', {
href: origin + 'https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders',
href: origin + Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders'),
target: "_blank",
'data-tippy-placement': "right"
})
@ -574,12 +575,18 @@ define([
}
else if (callback) {*/
// Old import button, used in settings
button
.click(common.prepareFeedback(type))
.click(importContent((data && data.binary) ? 'application/octet-stream' : 'text/plain', callback, {
var importer = importContent((data && data.binary) ? 'application/octet-stream' : 'text/plain', callback, {
accept: data ? data.accept : undefined,
binary: data ? data.binary : undefined
}));
});
var handler = data.first? function () {
data.first(importer);
}: importer; //importContent;
button
.click(common.prepareFeedback(type))
.click(handler);
//}
break;
case 'upload':
@ -714,8 +721,14 @@ define([
callback(err);
return void UI.warn(Messages.fm_forbidden);
}
var cMsg = common.isLoggedIn() ? Messages.movedToTrash : Messages.deleted;
var msg = common.fixLinks($('<div>').html(cMsg));
var msg;
if (common.isLoggedIn()) {
msg = Pages.setHTML(h('div'), Messages.movedToTrash);
$(msg).find('a').attr('href', '/drive/');
common.fixLinks(msg);
} else {
msg = h('div', Messages.deleted);
}
UI.alert(msg);
callback();
return;
@ -781,6 +794,28 @@ define([
h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_savetodrive)
])).click(common.prepareFeedback(type));
break;
case 'storeindrive':
button = $(h('button.cp-toolbar-storeindrive', {
style: 'display:none;'
}, [
h('i.fa.fa-hdd-o'),
h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_storeInDrive)
])).click(common.prepareFeedback(type)).click(function () {
$(button).hide();
common.getSframeChannel().query("Q_AUTOSTORE_STORE", null, function (err, obj) {
var error = err || (obj && obj.error);
if (error) {
$(button).show();
if (error === 'E_OVER_LIMIT') {
return void UI.warn(Messages.pinLimitReached);
}
return void UI.warn(Messages.autostore_error);
}
$(document).trigger('cpPadStored');
UI.log(Messages.autostore_saved);
});
});
break;
case 'hashtag':
button = $('<button>', {
'class': 'fa fa-hashtag cp-toolbar-icon-hashtag',
@ -1105,6 +1140,10 @@ define([
if (apps[type]) {
href = "https://docs.cryptpad.fr/en/user_guide/apps/" + apps[type] + ".html";
}
if (type === 'drive') {
href = "https://docs.cryptpad.fr/en/user_guide/drive.html";
}
href = Pages.localizeDocsLink(href);
var content = setHTML(h('p'), Messages.help_genericMore);
$(content).find('a').attr({
@ -1332,7 +1371,7 @@ define([
// Button
var $button = $('<button>', {
'class': ''
'class': config.buttonCls || ''
}).append($('<span>', {'class': 'cp-dropdown-button-title'}).html(config.text || ""));
if (config.caretDown) {
$('<span>', {
@ -1349,13 +1388,20 @@ define([
var $innerblock = $('<div>', {'class': 'cp-dropdown-content'});
if (config.left) { $innerblock.addClass('cp-dropdown-left'); }
var hide = function () {
window.setTimeout(function () { $innerblock.hide(); }, 0);
};
config.options.forEach(function (o) {
if (!isValidOption(o)) { return; }
if (isElement(o)) { return $innerblock.append($(o)); }
var $el = $('<' + o.tag + '>', o.attributes || {}).html(o.content || '');
$el.appendTo($innerblock);
if (typeof(o.action) === 'function') {
$el.click(o.action);
$el.click(function (e) {
var close = o.action(e);
if (close) { hide(); }
});
}
});
@ -1375,10 +1421,6 @@ define([
}
};
var hide = function () {
window.setTimeout(function () { $innerblock.hide(); }, 0);
};
var show = function () {
var wh = $(window).height();
var button = $button[0].getBoundingClientRect();
@ -1552,6 +1594,8 @@ define([
faqLine,
]);
$(content).find('a').attr('target', '_blank');
var buttons = [
{
className: 'primary',
@ -1636,6 +1680,18 @@ define([
},
});
}
if (padType !== 'calendar' && accountName) {
options.push({
tag: 'a',
attributes: {
'class': 'fa fa-calendar',
},
content: h('span', Messages.calendar),
action: function () {
Common.openURL('/calendar/');
},
});
}
if (padType !== 'contacts' && accountName) {
options.push({
tag: 'a',
@ -1735,7 +1791,14 @@ define([
});
}*/
options.push({ tag: 'hr' });
// We have code to hide 2 separators in a row, but in the case of survey, they may be
// in the DOM but hidden. We need to know if there are other elements in this
// section to determine if we have to manually hide a separator.
var surveyAlone = true;
if (Config.allowSubscriptions) {
surveyAlone = false;
options.push({
tag: 'a',
attributes: {
@ -1748,6 +1811,7 @@ define([
});
}
if (!priv.plan && !Config.removeDonateButton) {
surveyAlone = false;
options.push({
tag: 'a',
attributes: {
@ -1760,19 +1824,20 @@ define([
});
}
if (AppConfig.surveyURL) {
options.push({
tag: 'a',
attributes: {
'class': 'cp-toolbar-survey fa fa-graduation-cap'
},
content: h('span', Messages.survey),
action: function () {
Common.openUnsafeURL(AppConfig.surveyURL);
Feedback.send('SURVEY_CLICKED');
},
});
}
// If you set "" in the admin panel, it will remove the AppConfig survey
var surveyURL = typeof(Broadcast.surveyURL) !== "undefined" ? Broadcast.surveyURL
: AppConfig.surveyURL;
options.push({
tag: 'a',
attributes: {
'class': 'cp-toolbar-survey fa fa-graduation-cap'
},
content: h('span', Messages.survey),
action: function () {
Common.openUnsafeURL(surveyURL);
Feedback.send('SURVEY_CLICKED');
},
});
options.push({ tag: 'hr' });
// Add login or logout button depending on the current status
@ -1808,14 +1873,16 @@ define([
Common.setLoginRedirect('login');
},
});
options.push({
tag: 'a',
attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'},
content: h('span', Messages.login_register),
action: function () {
Common.setLoginRedirect('register');
},
});
if (!Config.restrictRegistration) {
options.push({
tag: 'a',
attributes: {'class': 'cp-toolbar-menu-register fa fa-user-plus'},
content: h('span', Messages.login_register),
action: function () {
Common.setLoginRedirect('register');
},
});
}
}
var $icon = $('<span>', {'class': 'fa fa-user-secret'});
//var $userbig = $('<span>', {'class': 'big'}).append($displayedName.clone());
@ -1839,6 +1906,29 @@ define([
};
var $userAdmin = UIElements.createDropdown(dropdownConfigUser);
var $survey = $userAdmin.find('.cp-toolbar-survey');
if (!surveyURL) {
$survey.hide();
if (surveyAlone) { $survey.next('hr').hide(); }
}
Common.makeUniversal('broadcast', {
onEvent: function (obj) {
var cmd = obj.ev;
if (cmd !== "SURVEY") { return; }
var url = obj.data;
if (url === surveyURL) { return; }
if (url && !Util.isValidURL(url)) { return; }
surveyURL = url;
if (!url) {
$survey.hide();
if (surveyAlone) { $survey.next('hr').hide(); }
return;
}
$survey.show();
if (surveyAlone) { $survey.next('hr').show(); }
}
});
/*
// Uncomment these lines to have a language selector in the admin menu
// FIXME clicking on the inner menu hides the outer one
@ -1955,6 +2045,7 @@ define([
if (p === 'todo') { return; }
if (p === 'file') { return; }
if (p === 'accounts') { return; }
if (p === 'calendar') { return; }
if (!common.isLoggedIn() && AppConfig.registeredOnlyTypes &&
AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; }
return true;
@ -2139,7 +2230,7 @@ define([
UI.getFileIcon({type: type})[0],
h('div.cp-creation-title-text', [
h('span', newPadH3Title),
createHelper('https://docs.cryptpad.fr/en/user_guide/apps/general.html#new-document', Messages.creation_helperText)
createHelper(Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/apps/general.html#new-document'), Messages.creation_helperText)
])
]);
$creation.append(title);
@ -2535,9 +2626,11 @@ define([
$creation.focus();
};
var autoStoreModal = {};
UIElements.onServerError = function (common, err, toolbar, cb) {
//if (["EDELETED", "EEXPIRED", "ERESTRICTED"].indexOf(err.type) === -1) { return; }
var priv = common.getMetadataMgr().getPrivateData();
var sframeChan = common.getSframeChannel();
var msg = err.type;
if (err.type === 'EEXPIRED') {
msg = Messages.expiredError;
@ -2547,10 +2640,36 @@ define([
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
} else if (err.type === 'EDELETED') {
if (priv.burnAfterReading) { return void cb(); }
if (autoStoreModal[priv.channel]) {
autoStoreModal[priv.channel].delete();
delete autoStoreModal[priv.channel];
}
if (err.ownDeletion) {
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
(cb || function () {})();
return;
}
// View users have the wrong seed, thay can't retireve access directly
// Version 1 hashes don't support passwords
if (!priv.readOnly && !priv.oldVersionHash) {
sframeChan.event('EV_SHARE_OPEN', {hidden: true}); // Close share modal
UIElements.displayPasswordPrompt(common, {
fromServerError: true,
loaded: err.loaded,
});
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
(cb || function () {})();
return;
}
msg = Messages.deletedError;
if (err.loaded) {
msg += Messages.errorCopy;
}
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
} else if (err.type === 'ERESTRICTED') {
msg = Messages.restrictedError;
@ -2559,7 +2678,6 @@ define([
msg = Messages.oo_deletedVersion;
if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); }
}
var sframeChan = common.getSframeChannel();
sframeChan.event('EV_SHARE_OPEN', {hidden: true});
UI.errorLoadingScreen(msg, Boolean(err.loaded), Boolean(err.loaded));
(cb || function () {})();
@ -2568,7 +2686,10 @@ define([
UIElements.displayPasswordPrompt = function (common, cfg, isError) {
var error;
if (isError) { error = setHTML(h('p.cp-password-error'), Messages.password_error); }
var info = h('p.cp-password-info', Messages.password_info);
var info_loaded = setHTML(h('p.cp-password-info'), Messages.errorCopy);
var password = UI.passwordInput({placeholder: Messages.password_placeholder});
var $password = $(password);
var button = h('button.btn.btn-primary', Messages.password_submit);
@ -2580,6 +2701,21 @@ define([
var submit = function () {
var value = $password.find('.cp-password-input').val();
// Password-prompt called from UIElements.onServerError
if (cfg.fromServerError) {
common.getSframeChannel().query('Q_PASSWORD_CHECK', value, function (err, obj) {
if (obj && obj.error) {
console.error(obj.error);
return void UI.warn(Messages.error);
}
// On success, outer will reload the page: this is a wrong password
UIElements.displayPasswordPrompt(common, cfg, true);
});
return;
}
// Initial load
UI.addLoadingScreen({newProgress: true});
if (window.CryptPad_updateLoadingProgress) {
window.CryptPad_updateLoadingProgress({
@ -2593,6 +2729,8 @@ define([
}
});
};
$password.find('.cp-password-input').on('keydown', function (e) { if (e.which === 13) { submit(); } });
$(button).on('click', function () { submit(); });
@ -2600,12 +2738,13 @@ define([
var block = h('div#cp-loading-password-prompt', [
error,
info,
cfg.loaded ? info_loaded : undefined,
h('p.cp-password-form', [
password,
button
])
]),
]);
UI.errorLoadingScreen(block);
UI.errorLoadingScreen(block, Boolean(cfg.loaded), Boolean(cfg.loaded));
$password.find('.cp-password-input').focus();
};
@ -2665,13 +2804,6 @@ define([
common.openURL(priv.accounts.donateURL);
Feedback.send('CROWDFUNDING_YES');
});
$(modal.popup).find('a').click(function (e) {
e.stopPropagation();
e.preventDefault();
modal.delete();
common.openURL(priv.accounts.donateURL);
Feedback.send('CROWDFUNDING_LINK');
});
$(no).click(function () {
modal.delete();
Feedback.send('CROWDFUNDING_NO');
@ -2698,7 +2830,6 @@ define([
};
var storePopupState = false;
var autoStoreModal = {};
UIElements.displayStorePadPopup = function (common, data) {
if (storePopupState) { return; }
storePopupState = true;
@ -2708,22 +2839,30 @@ define([
// This pad will be deleted automatically, it shouldn't be stored
if (priv.burnAfterReading) { return; }
var typeMsg = priv.pathname.indexOf('/file/') !== -1 ? Messages.autostore_file :
priv.pathname.indexOf('/drive/') !== -1 ? Messages.autostore_sf :
Messages.autostore_pad;
var text = Messages._getKey('autostore_notstored', [typeMsg]);
var footer = Messages.autostore_settings;
var footer = Pages.setHTML(h('span'), Messages.autostore_settings);
var hide = h('button.cp-corner-cancel', Messages.autostore_hide);
var store = h('button.cp-corner-primary', Messages.autostore_store);
var actions = h('div', [hide, store]);
var initialHide = data && data.autoStore && data.autoStore === -1;
if (initialHide) {
$('.cp-toolbar-storeindrive').show();
UIElements.displayCrowdfunding(common);
return;
}
var modal = UI.cornerPopup(text, actions, footer, {hidden: initialHide});
// Once the store pad popup is created, put the crowdfunding one in the queue
UIElements.displayCrowdfunding(common);
autoStoreModal[priv.channel] = modal;
$(modal.popup).find('.cp-corner-footer a').click(function (e) {
@ -2733,6 +2872,7 @@ define([
$(hide).click(function () {
delete autoStoreModal[priv.channel];
$('.cp-toolbar-storeindrive').show();
modal.delete();
});
var waitingForStoringCb = false;
@ -2849,7 +2989,7 @@ define([
var dismiss = function () {
common.mailbox.dismiss(data, function (err) {
console.log(err);
if (err) { console.log(err); }
});
};
var answer = function (yes) {
@ -2858,6 +2998,7 @@ define([
href: msg.content.href,
password: msg.content.password,
title: msg.content.title,
calendar: msg.content.calendar,
answer: yes
}, {
channel: msg.content.user.notifications,
@ -2893,16 +3034,29 @@ define([
// Add the pad to your drive
// This command will also add your mailbox to the metadata log
// The callback is called when the pad is stored, independantly of the metadata command
sframeChan.query('Q_ACCEPT_OWNERSHIP', data, function (err, res) {
if (err || (res && res.error)) {
return void console.error(err | res.error);
}
UI.log(Messages.saved);
if (autoStoreModal[data.channel]) {
autoStoreModal[data.channel].delete();
delete autoStoreModal[data.channel];
}
});
if (data.calendar) {
var calendarModule = common.makeUniversal('calendar');
var calendarData = data.calendar;
calendarData.href = data.href;
calendarData.teamId = 1;
calendarModule.execCommand('ADD', calendarData, function (obj) {
if (obj && obj.error) {
console.error(obj.error);
return void UI.warn(Messages.error);
}
});
} else {
sframeChan.query('Q_ACCEPT_OWNERSHIP', data, function (err, res) {
if (err || (res && res.error)) {
return void console.error(err | res.error);
}
UI.log(Messages.saved);
if (autoStoreModal[data.channel]) {
autoStoreModal[data.channel].delete();
delete autoStoreModal[data.channel];
}
});
}
// Remove yourself from the pending owners
sframeChan.query('Q_SET_PAD_METADATA', {

View file

@ -554,6 +554,16 @@
return false;
};
Util.isValidURL = function (str) {
var pattern = new RegExp('^(https?:\\/\\/)'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
return !!pattern.test(str);
};
var emoji_patt = /([\uD800-\uDBFF][\uDC00-\uDFFF])/;
var isEmoji = function (str) {
return emoji_patt.test(str);
@ -575,6 +585,18 @@
return isEmoji(emojis[0])? emojis[0]: str[0];
};
Util.getRandomColor = function (light) {
var getColor = function () {
if (light) {
return Math.floor(Math.random() * 156) + 70;
}
return Math.floor(Math.random() * 200) + 25;
};
return '#' + getColor().toString(16) +
getColor().toString(16) +
getColor().toString(16);
};
if (typeof(module) !== 'undefined' && module.exports) {
module.exports = Util;
} else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) {

View file

@ -13,7 +13,7 @@ define([
], function (Crypto, CPNetflux, Netflux, Util, Hash, Realtime, NetConfig, Cache, Pinpad, nThen) {
var finish = function (S, err, doc) {
if (S.done) { return; }
S.cb(err, doc);
S.cb((err && err.error), doc, err);
S.done = true;
if (!S.hasNetwork) {
@ -135,13 +135,15 @@ define([
config.onError = function (info) {
console.warn(info);
finish(Session, info.error);
finish(Session, info);
};
config.onChannelError = function (info) {
console.error(info);
finish(Session, info.error);
finish(Session, info);
};
config.onCacheReady = opt.onCacheReady;
// We use the new onMessage handler to compute the progress:
// we should receive 2 checkpoints max, so 100 messages max
// We're going to consider that 1 message = 1%, and we'll send 100%

View file

@ -481,10 +481,20 @@ define([
});
};
common.isNewChannel = function (href, password, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
var channel = Hash.hrefToHexChannelId(href, password);
postMessage('IS_NEW_CHANNEL', {channel: channel}, function (obj) {
var error = obj && obj.error;
if (error) { return void cb(error); }
if (!obj) { return void cb('ERROR'); }
cb (null, obj.isNew);
}, {timeout: -1});
};
// This function is used when we want to open a pad. We first need
// to check if it exists. With the cached drive, we need to wait for
// the network to be available before we can continue.
common.isNewChannel = function (href, password, _cb) {
common.hasChannelHistory = function (href, password, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
var channel = Hash.hrefToHexChannelId(href, password);
var error;
@ -1095,6 +1105,7 @@ define([
common.changePadPassword = function (Crypt, Crypto, data, cb) {
var href = data.href;
var oldPassword = data.oldPassword;
var newPassword = data.password;
var teamId = data.teamId;
if (!href) { return void cb({ error: 'EINVAL_HREF' }); }
@ -1123,7 +1134,9 @@ define([
var isSharedFolder = parsed.type === 'drive';
var optsGet = {};
var optsGet = {
password: oldPassword
};
var optsPut = {
password: newPassword,
metadata: {},
@ -1133,7 +1146,7 @@ define([
var cryptgetVal;
Nthen(function (waitFor) {
if (parsed.hashData && parsed.hashData.password) {
if (parsed.hashData && parsed.hashData.password && !oldPassword) {
common.getPadAttribute('password', waitFor(function (err, password) {
optsGet.password = password;
}), href);
@ -1179,7 +1192,6 @@ define([
} else if (mailbox && typeof(mailbox) === "object") {
m = {};
Object.keys(mailbox).forEach(function (ed) {
console.log(mailbox[ed]);
try {
m[ed] = newCrypto.encrypt(oldCrypto.decrypt(mailbox[ed], true, true));
} catch (e) {
@ -1214,6 +1226,7 @@ define([
cryptgetVal = JSON.stringify(parsed);
}
}), optsGet);
Cache.clearChannel(newSecret.channel, waitFor());
}).nThen(function (waitFor) {
optsPut.metadata.restricted = oldMetadata.restricted;
optsPut.metadata.allowed = oldMetadata.allowed;
@ -1418,6 +1431,7 @@ define([
common.changeOOPassword = function (data, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
var href = data.href;
var oldPassword = data.oldPassword;
var newPassword = data.password;
var teamId = data.teamId;
if (!href) { return void cb({ error: 'EINVAL_HREF' }); }
@ -1431,7 +1445,6 @@ define([
var oldMetadata;
var oldRtChannel;
var privateData;
var padData;
var newSecret;
if (parsed.hashData.version >= 2) {
@ -1452,19 +1465,22 @@ define([
validateKey: newSecret.keys.validateKey
},
};
var optsGet = {};
var optsGet = {
password: oldPassword
};
Nthen(function (waitFor) {
common.getPadAttribute('', waitFor(function (err, _data) {
padData = _data;
optsGet.password = padData.password;
if (!oldPassword && _data) {
optsGet.password = _data.password;
}
}), href);
common.getAccessKeys(waitFor(function (keys) {
optsGet.accessKeys = keys;
optsPut.accessKeys = keys;
}));
}).nThen(function (waitFor) {
oldSecret = Hash.getSecrets(parsed.type, parsed.hash, padData.password);
oldSecret = Hash.getSecrets(parsed.type, parsed.hash, optsGet.password);
require([
'/common/cryptget.js',
@ -1592,6 +1608,7 @@ define([
}
}));
}));
Cache.clearChannel(newSecret.channel, waitFor());
}).nThen(function (waitFor) {
// The new rt channel is ready
// The blob uses its own encryption and doesn't need to be reencrypted
@ -1718,6 +1735,7 @@ define([
var removeData = obj.Block.remove(blockKeys);
postMessage("DELETE_ACCOUNT", {
keys: Block.keysToRPCFormat(blockKeys),
removeData: removeData
}, function (obj) {
if (obj.state) {
@ -1838,9 +1856,16 @@ define([
};
var content = Block.serialize(JSON.stringify(temp), blockKeys);
console.error("OLD AND NEW BLOCK KEYS", oldBlockKeys, blockKeys);
content.registrationProof = Block.proveAncestor(oldBlockKeys);
console.log("writing new login block");
common.writeLoginBlock(content, waitFor(function (obj) {
var data = {
keys: Block.keysToRPCFormat(blockKeys),
content: content,
};
common.writeLoginBlock(data, waitFor(function (obj) {
if (obj && obj.error) {
waitFor.abort();
return void cb(obj);
@ -1858,8 +1883,11 @@ define([
// Remove block hash
if (blockHash) {
console.log('removing old login block');
var removeData = Block.remove(oldBlockKeys);
common.removeLoginBlock(removeData, waitFor(function (obj) {
var data = {
keys: Block.keysToRPCFormat(oldBlockKeys), // { edPrivate, edPublic }
content: Block.remove(oldBlockKeys),
};
common.removeLoginBlock(data, waitFor(function (obj) {
if (obj && obj.error) { return void console.error(obj.error); }
}));
}
@ -2011,7 +2039,6 @@ define([
});
};
var provideFeedback = function () {
if (typeof(window.Proxy) === 'undefined') {
Feedback.send("NO_PROXIES");
@ -2048,7 +2075,6 @@ define([
if (!common.hasCSSVariables()) {
Feedback.send('NO_CSS_VARIABLES');
}
Feedback.reportScreenDimensions();
Feedback.reportLanguage();
};
@ -2273,7 +2299,8 @@ define([
cache: rdyCfg.cache,
noDrive: rdyCfg.noDrive,
disableCache: localStorage['CRYPTPAD_STORE|disableCache'],
driveEvents: !rdyCfg.noDrive //rdyCfg.driveEvents // Boolean
driveEvents: !rdyCfg.noDrive, //rdyCfg.driveEvents // Boolean
lastVisit: Number(localStorage.lastVisit) || undefined
};
common.userHash = userHash;
@ -2358,9 +2385,14 @@ define([
};
postMsg('INIT');
/*
window.addEventListener('beforeunload', function () {
postMsg('CLOSE');
});
*/
window.addEventListener('unload', function () {
postMsg('CLOSE');
});
} else if (false && !noWorker && !noSharedWorker && 'serviceWorker' in navigator) {
var initializing = true;
var stopWaiting = waitFor2(); // Call this function when we're ready
@ -2469,6 +2501,9 @@ define([
data = data.returned;
}
if (data.loggedIn) {
window.CP_logged_in = true;
}
if (data.anonHash && !cfg.userHash) { LocalStore.setFSHash(data.anonHash); }
initialized = true;
@ -2500,6 +2535,24 @@ define([
}
if (parsedNew.hashData) { oldHref = newHref; }
};
// If you're in noDrive mode, check if an FS_hash is added and reload if that's the case
if (rdyCfg.noDrive && !localStorage[Constants.fileHashKey]) {
window.addEventListener('storage', function (e) {
if (e.key !== Constants.fileHashKey) { return; }
// New entry added to FS_hash: drive created in another tab, reload
var o = e.oldValue;
var n = e.newValue;
if (!o && n) {
postMessage('HAS_DRIVE', null, function(obj) {
// If we're still in noDrive mode, reload
if (!obj.state) {
LocalStore.loginReload();
}
// Otherwise this worker is connected, nothing to do
});
}
});
}
// Listen for login/logout in other tabs
window.addEventListener('storage', function (e) {
if (e.key !== Constants.userHashKey) { return; }
@ -2515,16 +2568,6 @@ define([
console.log('onLogout: disconnect');
postMessage("DISCONNECT");
});
}).nThen(function (waitFor) {
if (common.createReadme || sessionStorage.createReadme) {
var data = {
driveReadme: Messages.driveReadme,
driveReadmeTitle: Messages.driveReadmeTitle,
};
postMessage("CREATE_README", data, waitFor(function (e) {
if (e && e.error) { return void console.error(e.error); }
}));
}
}).nThen(function (waitFor) {
if (common.migrateAnonDrive || sessionStorage.migrateAnonDrive) {
common.mergeAnonDrive(waitFor());
@ -2534,6 +2577,12 @@ define([
AppConfig.afterLogin(common, waitFor());
}
}).nThen(function () {
// Last visit is used to warn you about missed events from your calendars
localStorage.lastVisit = +new Date();
setInterval(function () {
// Bump last visit every minute
localStorage.lastVisit = +new Date();
}, 60000);
f(void 0, env);
if (typeof(window.onhashchange) === 'function') { window.onhashchange(); }
});

View file

@ -9,7 +9,7 @@ define([
'/common/media-tag.js',
'/customize/messages.js',
'/common/highlight/highlight.pack.js',
'/bower_components/diff-dom/diffDOM.js',
'/lib/diff-dom/diffDOM.js',
'/bower_components/tweetnacl/nacl-fast.min.js',
'css!/common/highlight/styles/'+ (window.CryptPad_theme === 'dark' ? 'dark.css' : 'github.css')
],function ($, ApiConfig, Marked, Hash, Util, h, MT, MediaTag, Messages) {
@ -40,6 +40,7 @@ define([
Mermaid = _Mermaid;
Mermaid.initialize({
gantt: { axisFormat: '%m-%d', },
flowchart: { htmlLabels: false, },
theme: (window.CryptPad_theme === 'dark') ? 'dark' : 'default',
"themeCSS": mermaidThemeCSS,
});

View file

@ -19,6 +19,7 @@ define([
'/common/proxy-manager.js',
'/customize/application_config.js',
'/customize/messages.js',
'/customize/pages.js',
], function (
$,
ApiConfig,
@ -37,7 +38,8 @@ define([
h,
ProxyManager,
AppConfig,
Messages)
Messages,
Pages)
{
var APP = window.APP = {
@ -120,8 +122,8 @@ define([
var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"});
//var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o cp-app-drive-icon-expcol"});
var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o cp-app-drive-icon-expcol"});
var $listIcon = $('<button>', {"class": "fa fa-list"});
var $gridIcon = $('<button>', {"class": "fa fa-th-large"});
//var $listIcon = $('<button>', {"class": "fa fa-list"});
//var $gridIcon = $('<button>', {"class": "fa fa-th-large"});
var $sortAscIcon = $('<span>', {"class": "fa fa-angle-up sortasc"});
var $sortDescIcon = $('<span>', {"class": "fa fa-angle-down sortdesc"});
var $closeIcon = $('<span>', {"class": "fa fa-times"});
@ -646,11 +648,6 @@ define([
} else {
displayedCategories = [FILES_DATA];
currentPath = [FILES_DATA];
if (Object.keys(files.root).length && !proxy.anonymousAlert) {
var msg = common.fixLinks($('<div>').html(Messages.fm_alert_anonymous));
UI.alert(msg);
proxy.anonymousAlert = true;
}
}
}
@ -1128,7 +1125,7 @@ define([
var priv = metadataMgr.getPrivateData();
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
if (useUnsafe === true) {
if (useUnsafe === true || APP.newSharedFolder) {
return void window.open(APP.origin + href);
}
@ -2410,36 +2407,52 @@ define([
return $box;
};
var getOppositeViewMode = function (viewMode) {
viewMode = viewMode || getViewMode();
var newViewMode = viewMode === 'grid'? 'list': 'grid';
return newViewMode;
};
// Create the button allowing the user to switch from list to icons modes
var createViewModeButton = function ($container) {
var $listButton = $listIcon.clone();
var $gridButton = $gridIcon.clone();
var viewMode = getViewMode();
var gridIcon = h('i.fa.fa-th-large', { title: Messages.fm_viewGridButton });
var listIcon = h('i.fa.fa-list', { title: Messages.fm_viewListButton });
$listButton.click(function () {
$gridButton.show();
$listButton.hide();
setViewMode('list');
$('#' + FOLDER_CONTENT_ID).removeClass('cp-app-drive-content-grid');
$('#' + FOLDER_CONTENT_ID).addClass('cp-app-drive-content-list');
Feedback.send('DRIVE_LIST_MODE');
});
$gridButton.click(function () {
$listButton.show();
$gridButton.hide();
setViewMode('grid');
$('#' + FOLDER_CONTENT_ID).addClass('cp-app-drive-content-grid');
$('#' + FOLDER_CONTENT_ID).removeClass('cp-app-drive-content-list');
Feedback.send('DRIVE_GRID_MODE');
});
var $button = $(h('button.cp-app-drive-viewmode-button', [
gridIcon,
listIcon
]));
var $gridIcon = $(gridIcon);
var $listIcon = $(listIcon);
var showMode = function (mode) {
if (mode === 'grid') {
$gridIcon.hide();
$listIcon.show();
} else {
$listIcon.hide();
$gridIcon.show();
}
};
setViewMode(viewMode || 'grid');
showMode(viewMode);
if (getViewMode() === 'list') {
$listButton.hide();
} else {
$gridButton.hide();
}
$listButton.attr('title', Messages.fm_viewListButton);
$gridButton.attr('title', Messages.fm_viewGridButton);
$container.append($listButton).append($gridButton);
$button.click(function (e) {
console.error(e);
var viewMode = getViewMode();
var newViewMode = getOppositeViewMode(viewMode);
setViewMode(newViewMode);
showMode(newViewMode);
var $folder = $('#' + FOLDER_CONTENT_ID);
if (newViewMode === 'list') {
$folder.removeClass('cp-app-drive-content-grid').addClass('cp-app-drive-content-list');
Feedback.send('DRIVE_LIST_MODE');
} else {
$folder.addClass('cp-app-drive-content-grid').removeClass('cp-app-drive-content-list');
Feedback.send('DRIVE_GRID_MODE');
}
});
$container.append($button);
};
var emptyTrashModal = function () {
var ownedInTrash = manager.ownedInTrash();
@ -2495,7 +2508,7 @@ define([
// Get the upload options
var addSharedFolderModal = function (cb) {
var docsHref = common.getBounceURL("https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners");
var docsHref = common.getBounceURL(Pages.localizeDocsLink("https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners"));
// Ask for name, password and owner
var content = h('div', [
@ -2508,7 +2521,7 @@ define([
style: 'display:flex;align-items:center;justify-content:space-between'
}, [
UI.createCheckbox('cp-app-drive-sf-owned', Messages.sharedFolders_create_owned, true),
UI.createHelper(docsHref, Messages.creation_owned1) // TODO
UI.createHelper(docsHref, Messages.creation_owned1)
]),
]);
@ -2543,6 +2556,7 @@ define([
if (type === 'todo') { return; }
if (type === 'file') { return; }
if (type === 'accounts') { return; }
if (type === 'calendar') { return; }
if (!APP.loggedIn && AppConfig.registeredOnlyTypes &&
AppConfig.registeredOnlyTypes.indexOf(type) !== -1) {
return;
@ -4398,7 +4412,7 @@ define([
style: 'display:flex;align-items:center;justify-content:space-between'
}, [
UI.createCheckbox('cp-upload-owned', Messages.sharedFolders_create_owned, true),
UI.createHelper('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners', Messages.creation_owned1)
UI.createHelper(Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners'), Messages.creation_owned1)
]),
]);
return void UI.confirm(convertContent, function(res) {

View file

@ -1,5 +1,10 @@
define([
'/common/common-language.js',
'less!/customize/src/less2/pages/page-feedback.less',
], function (Language) {
Language.applyTranslation();
var optoutLink = document.querySelector('#optout a');
if (optoutLink) {
optoutLink.setAttribute('href', '/settings/');
}
});

View file

@ -11,9 +11,9 @@ body {
</style>
</head>
<body>
<p data-localization="feedback_about">If you're reading this, you were probably curious why CryptPad is requesting web pages when you perform certain actions</p>
<p data-localization="feedback_about">If you're reading this, you were probably curious why CryptPad is requesting web pages when you perform certain actions.</p>
<p data-localization="feedback_privacy">We care about your privacy, and at the same time we want CryptPad to be very easy to use.
We use this file to figure out which UI features matter to our users, by requesting it along with a parameter specifying which action was taken.</p>
<p data-localization="feedback_optout">If you would like to opt out, visit <a href="/settings/">your user settings page</a>, where you'll find a checkbox to enable or disable user feedback</p>
<p data-localization="feedback_optout" id="optout">If you would like to opt out, visit <a href="/settings/">your user settings page</a>, where you'll find a checkbox to enable or disable user feedback.</p>

View file

@ -25,10 +25,12 @@ define([
var sframeChan = common.getSframeChannel();
var metadataMgr = common.getMetadataMgr();
var channel = data.channel;
var priv = metadataMgr.getPrivateData();
var channel = data.channel || priv.channel;
var owners = data.owners || [];
var pending_owners = data.pending_owners || [];
var teamOwner = data.teamId;
var title = opts.title;
opts = opts || {};
var redrawAll = function () {};
@ -115,7 +117,7 @@ define([
if (!friend) { return; }
common.mailbox.sendTo("RM_OWNER", {
channel: channel,
title: data.title,
title: data.title || title,
pending: pending
}, {
channel: friend.notifications,
@ -266,12 +268,15 @@ define([
return void UI.warn(text);
}
var isTemplate = priv.isTemplate || opts.isTemplate;
// never store calendars in the team drive
if (opts.calendar) { return; }
toAddTeams.forEach(function (obj) {
sframeChan.query('Q_STORE_IN_TEAM', {
href: data.href || data.rohref,
password: data.password,
path: isTemplate ? ['template'] : undefined,
title: data.title || '',
title: data.title || title || "",
teamId: obj.id
}, waitFor(function (err) {
if (err) { return void console.error(err); }
@ -320,6 +325,12 @@ define([
}));
}
}).nThen(function (waitFor) {
var href = data.href;
var hashes = priv.hashes || {};
var bestHash = hashes.editHash || hashes.viewHash || hashes.fileHash;
if (data.fakeHref) {
href = Hash.hashToHref(bestHash, priv.app);
}
sel.forEach(function (el) {
var curve = $(el).attr('data-curve');
if (curve === user.curvePublic) { return; }
@ -327,9 +338,10 @@ define([
if (!friend) { return; }
common.mailbox.sendTo("ADD_OWNER", {
channel: channel,
href: data.href,
password: data.password,
title: data.title
href: href,
calendar: opts.calendar,
password: data.password || priv.password,
title: data.title || title
}, {
channel: friend.notifications,
curvePublic: friend.curvePublic
@ -398,7 +410,8 @@ define([
var sframeChan = common.getSframeChannel();
var metadataMgr = common.getMetadataMgr();
var channel = data.channel;
var priv = metadataMgr.getPrivateData();
var channel = data.channel || priv.channel;
var owners = data.owners || [];
var restricted = data.restricted || false;
var allowed = data.allowed || [];
@ -832,7 +845,7 @@ define([
// In the properties, we should have the edit href if we know it.
// We should know it because the pad is stored, but it's better to check...
if (!data.noEditPassword && owned && data.href) { // FIXME SHEET fix password change for sheets
if (!data.noEditPassword && !opts.noEditPassword && owned && data.href) { // FIXME SHEET fix password change for sheets
var isOO = parsed.type === 'sheet';
var isFile = parsed.hashData.type === 'file';
var isSharedFolder = parsed.type === 'drive';
@ -888,9 +901,17 @@ define([
});
}
var href = data.href;
var hashes = priv.hashes || {};
var bestHash = hashes.editHash || hashes.viewHash || hashes.fileHash;
if (data.fakeHref) {
href = Hash.hashToHref(bestHash, priv.app);
}
var isNotStored = Boolean(data.fakeHref);
sframeChan.query(q, {
teamId: typeof(owned) !== "boolean" ? owned : undefined,
href: data.href,
href: href,
oldPassword: priv.password,
password: newPass
}, function (err, data) {
$(passwordOk).text(Messages.properties_changePasswordButton);
@ -924,22 +945,26 @@ define([
// Pad password changed: update the href
// Use hidden hash if needed (we're an owner of this pad so we know it is stored)
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
var href = (priv.readOnly && data.roHref) ? data.roHref : data.href;
if (isNotStored) { useUnsafe = true; }
var _href = (priv.readOnly && data.roHref) ? data.roHref : data.href;
if (useUnsafe !== true) {
var newParsed = Hash.parsePadUrl(href);
var newParsed = Hash.parsePadUrl(_href);
var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass);
var newHash = Hash.getHiddenHashFromKeys(parsed.type, newSecret, {});
href = Hash.hashToHref(newHash, parsed.type);
_href = Hash.hashToHref(newHash, parsed.type);
}
// Trigger a page reload if the href didn't change
if (_href === href) { _href = undefined; }
if (data.warning) {
return void UI.alert(Messages.properties_passwordWarning, function () {
common.gotoURL(href);
common.gotoURL(_href);
}, {force: true});
}
return void UI.alert(Messages.properties_passwordSuccess, function () {
if (!isSharedFolder) {
common.gotoURL(href);
common.gotoURL(_href);
}
}, {force: true});
});
@ -956,14 +981,14 @@ define([
spinner.spin();
sframeChan.query('Q_DELETE_OWNED', {
teamId: typeof(owned) !== "boolean" ? owned : undefined,
channel: data.channel
channel: data.channel || priv.channel
}, function (err, obj) {
spinner.done();
UI.findCancelButton().click();
if (err || (obj && obj.error)) { UI.warn(Messages.error); }
});
});
$d.append(h('br'));
if (!opts.noEditPassword) { $d.append(h('br')); }
$d.append(h('div', [
h('label', Messages.access_destroyPad),
h('br'),
@ -995,7 +1020,7 @@ define([
var owned = Modal.isOwned(Env, data);
// Request edit access
if (common.isLoggedIn() && ((data.roHref && !data.href) || data.fakeHref) && !owned) {
if (common.isLoggedIn() && ((data.roHref && !data.href) || data.fakeHref) && !owned && !opts.calendar) {
var requestButton = h('button.btn.btn-secondary.no-margin.cp-access-margin-right',
Messages.requestEdit_button);
var requestBlock = h('p', requestButton);
@ -1033,7 +1058,7 @@ define([
var canMute = data.mailbox && owned === true && (
(typeof (data.mailbox) === "string" && data.owners[0] === edPublic) ||
data.mailbox[edPublic]);
if (owned === true) {
if (owned === true && !opts.calendar) {
var cbox = UI.createCheckbox('cp-access-mute', Messages.access_muteRequests, !canMute);
var $cbox = $(cbox);
var spinner = UI.makeSpinner($cbox);

View file

@ -386,11 +386,11 @@ define([
'tabindex': '-1',
'data-icon': "fa-eye",
}, Messages.pad_mediatagPreview)),
h('li.cp-svg', h('a.cp-app-code-context-openin.dropdown-item', {
h('li', h('a.cp-app-code-context-openin.dropdown-item', {
'tabindex': '-1',
'data-icon': "fa-external-link",
}, Messages.pad_mediatagOpen)),
h('li.cp-svg', h('a.cp-app-code-context-share.dropdown-item', {
h('li', h('a.cp-app-code-context-share.dropdown-item', {
'tabindex': '-1',
'data-icon': "fa-shhare-alt",
}, Messages.pad_mediatagShare)),
@ -398,7 +398,7 @@ define([
'tabindex': '-1',
'data-icon': "fa-cloud-upload",
}, Messages.pad_mediatagImport)),
h('li', h('a.cp-app-code-context-download.dropdown-item', {
h('li.cp-svg', h('a.cp-app-code-context-download.dropdown-item', {
'tabindex': '-1',
'data-icon': "fa-download",
}, Messages.download_mt_button)),
@ -429,6 +429,52 @@ define([
common.importMediaTag($mt);
}
else if ($this.hasClass("cp-app-code-context-download")) {
if ($mt.is('pre.mermaid') || $mt.is('pre.markmap')) {
(function () {
var name = Messages.mediatag_defaultImageName + '.svg';
var svg = $mt.find('svg')[0].cloneNode(true);
$(svg).attr('xmlns', 'http://www.w3.org/2000/svg').attr('width', $mt.width()).attr('height', $mt.height());
$(svg).find('foreignObject').each(function (i, el) {
var $el = $(el);
$el.find('br').after('\n');
$el.find('br').remove();
var t = $el[0].innerText || $el[0].textContent;
t.split('\n').forEach(function (text, i) {
var dy = (i+1)+'em';
$el.after(h('text', {y:0, dy:dy, style: ''}, text));
});
$el.remove();
});
var html = svg.outerHTML;
html = html.replace('<br>', '<br/>');
var b = new Blob([html], { type: 'image/svg+xml' });
window.saveAs(b, name);
})();
return;
}
if ($mt.is('pre.mathjax')) {
(function () {
var name = Messages.mediatag_defaultImageName + '.png';
var svg = $mt.find('> span > svg')[0];
var clone = svg.cloneNode(true);
var html = clone.outerHTML;
var b = new Blob([html], { type: 'image/svg+xml' });
var blobURL = URL.createObjectURL(b);
var i = new Image();
i.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = i.width;
canvas.height = i.height;
var context = canvas.getContext('2d');
context.drawImage(i, 0, 0, i.width, i.height);
canvas.toBlob(function (blob) {
window.saveAs(blob, name);
});
};
i.src = blobURL;
})();
return;
}
var media = Util.find($mt, [0, '_mediaObject']);
if (!media) { return void console.error('no media'); }
if (!media.complete) { return void UI.warn(Messages.mediatag_notReady); }

View file

@ -10,8 +10,9 @@ define([
'/common/clipboard.js',
'/customize/messages.js',
'/bower_components/nthen/index.js',
'/customize/pages.js',
], function ($, Util, Hash, UI, UIElements, Feedback, Modal, h, Clipboard,
Messages, nThen) {
Messages, nThen, Pages) {
var Share = {};
var createShareWithFriends = function (config, onShare, linkGetter) {
@ -111,6 +112,7 @@ define([
password: config.password,
isTemplate: config.isTemplate,
name: myName,
isCalendar: Boolean(config.calendar),
title: title
}, {
viewed: team && team.id,
@ -122,6 +124,19 @@ define([
}
// If it's a team with edit right, add the pad directly
if (!team) { return; }
if (config.calendar) {
var calendarModule = common.makeUniversal('calendar');
var calendarData = config.calendar;
calendarData.href = href;
calendarData.teamId = team.id;
calendarModule.execCommand('ADD', calendarData, function (obj) {
if (obj && obj.error) {
console.error(obj.error);
return void UI.warn(Messages.error);
}
});
return;
}
sframeChan.query('Q_STORE_IN_TEAM', {
href: href,
password: config.password,
@ -252,7 +267,7 @@ define([
h('a', {href: '#'}, Messages.passwordFaqLink)
]);
$(link).click(function () {
opts.common.openUnsafeURL("https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders");
opts.common.openUnsafeURL(Pages.localizeDocsLink("https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders"));
});
return link;
};

View file

@ -7,7 +7,8 @@ define([
'/common/common-util.js',
'/common/common-constants.js',
'/customize/messages.js',
], function($, h, Hash, UI, UIElements, Util, Constants, Messages) {
'/customize/pages.js',
], function($, h, Hash, UI, UIElements, Util, Constants, Messages, Pages) {
var handlers = {};
@ -395,7 +396,10 @@ define([
handlers['SAFE_LINKS_DEFAULT'] = function (common, data) {
var content = data.content;
content.getFormatText = function () {
return Messages.settings_safeLinkDefault;
var msg = Pages.setHTML(h('span'), Messages.settings_safeLinkDefault);
var i = msg.querySelector('i');
if (i) { i.classList = 'fa fa-shhare-alt'; }
return msg.innerHTML;
};
content.handler = function () {
@ -406,6 +410,120 @@ define([
}
};
handlers['BROADCAST_SURVEY'] = function (common, data) {
var content = data.content;
var msg = content.msg.content;
content.getFormatText = function () {
return Messages.broadcast_newSurvey;
};
content.handler = function () {
common.openUnsafeURL(msg.url);
defaultDismiss(common, data)();
};
if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data);
}
};
handlers['BROADCAST_CUSTOM'] = function (common, data) {
var content = data.content;
var msg = content.msg.content;
var text = msg.content;
var defaultL = msg.defaultLanguage;
var myLang = data.lang || Messages._languageUsed;
// Check if our language is available
var toShow = text[myLang];
// Otherwise, fallback to the default language if it exists
if (!toShow && defaultL) { toShow = text[defaultL]; }
// No translation available, dismiss
if (!toShow) { return defaultDismiss(common, data)(); }
var slice = toShow.length > 200;
toShow = Util.fixHTML(toShow);
content.getFormatText = function () {
if (slice) {
return toShow.slice(0, 200) + '...';
}
return toShow;
};
if (slice) {
content.handler = function () {
var content = h('div', [
h('h4', Messages.broadcast_newCustom),
h('div.cp-admin-message', toShow)
]);
UI.alert(content);
};
}
if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data);
}
};
handlers['REMINDER'] = function (common, data) {
var content = data.content;
var msg = content.msg.content;
var missed = content.msg.missed;
var start = msg.start;
var title = Util.fixHTML(msg.title);
content.getFormatText = function () {
var now = +new Date();
// Events that have already started
var wasRefresh = content.autorefresh;
content.autorefresh = false;
var nowDateStr = new Date().toLocaleDateString();
var startDate = new Date(start);
if (msg.isAllDay && msg.startDay) {
startDate = new Date(msg.startDay);
}
// Missed events
if (start < now && missed) {
return Messages._getKey('reminder_missed', [title, startDate.toLocaleString()]);
}
// Starting now
if (start < now && wasRefresh) {
return Messages._getKey('reminder_now', [title]);
}
// In progress, is all day
if (start < now && msg.isAllDay) {
return Messages._getKey('reminder_inProgressAllDay', [title]);
}
// In progress, normal event
if (start < now) {
return Messages._getKey('reminder_inProgress', [title, startDate.toLocaleString()]);
}
// Not started yet
// No precise time for allDay events
if (msg.isAllDay) {
return Messages._getKey('reminder_date', [title, startDate.toLocaleDateString()]);
}
// In less than an hour: show countdown in minutes
if ((start - now) < 3600000) {
var minutes = Math.round((start - now) / 60000);
content.autorefresh = true;
return Messages._getKey('reminder_minutes', [title, minutes]);
}
// Not today: show full date
if (nowDateStr !== startDate.toLocaleDateString()) {
return Messages._getKey('reminder_date', [title, startDate.toLocaleString()]);
}
// Today: show time
return Messages._getKey('reminder_time', [title, startDate.toLocaleTimeString()]);
};
if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data);
}
};
// NOTE: don't forget to fixHTML everything returned by "getFormatText"
return {

View file

@ -1,7 +1,7 @@
@import (reference) "../../customize/src/less2/include/framework.less";
// body
body.cp-app-sheet, body.cp-app-oodoc, body.cp-app-ooslide {
body.cp-app-sheet, body.cp-app-doc, body.cp-app-presentation {
display: flex;
flex-flow: column;
@ -10,14 +10,14 @@ body.cp-app-sheet, body.cp-app-oodoc, body.cp-app-ooslide {
@bg-color: @colortheme_apps[sheet],
);
}
&.cp-app-oodoc {
&.cp-app-doc {
.framework_main(
@bg-color: @colortheme_apps[oodoc],
@bg-color: @colortheme_apps[doc],
);
}
&.cp-app-ooslide {
&.cp-app-presentation {
.framework_main(
@bg-color: @colortheme_apps[ooslide],
@bg-color: @colortheme_apps[presentation],
);
}

View file

@ -51,7 +51,6 @@ define([
{
var saveAs = window.saveAs;
var Nacl = window.nacl;
var APP = window.APP = {
$: $,
urlArgs: Util.find(ApiConfig, ['requireConf', 'urlArgs'])
@ -74,11 +73,12 @@ define([
};
var supportsXLSX = function () {
return !(typeof(Atomics) === "undefined" || typeof (SharedArrayBuffer) === "undefined");
return !(typeof(Atomics) === "undefined" || typeof (SharedArrayBuffer) === "undefined" || typeof(WebAssembly) === 'undefined');
};
var toolbar;
var cursor;
var andThen = function (common) {
@ -231,7 +231,7 @@ define([
var title = common.getMetadataMgr().getMetadataLazy().title;
var file = {};
switch(type) {
case 'oodoc':
case 'doc':
file.type = 'docx';
file.title = title + '.docx' || 'document.docx';
file.doc = 'text';
@ -241,7 +241,7 @@ define([
file.title = title + '.xlsx' || 'spreadsheet.xlsx';
file.doc = 'spreadsheet';
break;
case 'ooslide':
case 'presentation':
file.type = 'pptx';
file.title = title + '.pptx' || 'presentation.pptx';
file.doc = 'presentation';
@ -263,6 +263,9 @@ define([
i = i || 0;
var idx = sortCpIndex(hashes);
var lastIndex = idx[idx.length - 1 - i];
if (typeof(lastIndex) === "undefined" || !hashes[lastIndex]) {
return {};
}
var last = JSON.parse(JSON.stringify(hashes[lastIndex]));
return last;
};
@ -352,10 +355,39 @@ define([
}
};
// Add a lock
var isLockedModal = {
content: UI.dialog.customModal(h('div.cp-oo-x2tXls', [
h('span.fa.fa-spin.fa-spinner'),
h('span', Messages.oo_isLocked)
]))
};
var onUploaded = function (ev, data, err) {
content.saveLock = undefined;
if (err) {
console.error(err);
if (content.saveLock === myOOId) { delete content.saveLock; } // Unlock checkpoints
if (APP.migrateModal) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
setEditable(true);
delete content.migration;
APP.migrateModal.closeModal();
APP.onLocal();
}
if (isLockedModal.modal && err === "TOO_LARGE") {
if (APP.migrate) {
UI.warn(Messages.oo_cantMigrate);
}
APP.cantCheckpoint = true;
isLockedModal.modal.closeModal();
delete isLockedModal.modal;
if (content.saveLock === myOOId) {
delete content.saveLock;
}
APP.onLocal();
return;
}
return void UI.alert(Messages.oo_saveError);
}
// Get the last cp idx
@ -366,7 +398,8 @@ define([
content.hashes[i] = {
file: data.url,
hash: ev.hash,
index: ev.index
index: ev.index,
version: NEW_VERSION
};
oldHashes = JSON.parse(JSON.stringify(content.hashes));
content.locks = {};
@ -417,14 +450,6 @@ define([
};
APP.FM = common.createFileManager(fmConfig);
// Add a lock
var isLockedModal = {
content: UI.dialog.customModal(h('div.cp-oo-x2tXls', [
h('span.fa.fa-spin.fa-spinner'),
h('span', Messages.oo_isLocked)
]))
};
var resetData = function (blob, type) {
// If a read-only refresh popup was planned, abort it
delete APP.refreshPopup;
@ -448,7 +473,19 @@ define([
};
var saveToServer = function () {
if (APP.cantCheckpoint) { return; } // TOO_LARGE
var text = getContent();
if (!text) {
setEditable(false, true);
sframeChan.query('Q_CLEAR_CACHE_CHANNELS', [
'chainpad',
content.channel,
], function () {});
UI.alert(Messages.realtime_unrecoverableError, function () {
common.gotoURL();
});
return;
}
var blob = new Blob([text], {type: 'plain/text'});
var file = getFileType();
blob.name = (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;
@ -458,6 +495,9 @@ define([
};
fixSheets();
if (!isLockedModal.modal) {
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
}
ooChannel.ready = false;
ooChannel.queue = [];
data.callback = function () {
@ -471,6 +511,8 @@ define([
var noLogin = false;
var makeCheckpoint = function (force) {
if (APP.cantCheckpoint) { return; } // TOO_LARGE
var locked = content.saveLock;
var lastCp = getLastCp();
@ -557,10 +599,10 @@ define([
case 'sheet' :
newText = EmptyCell(useNewDefault);
break;
case 'oodoc':
case 'doc':
newText = EmptyDoc();
break;
case 'ooslide':
case 'presentation':
newText = EmptySlide();
break;
default:
@ -593,7 +635,13 @@ define([
if (arrayBuffer) {
var u8 = new Uint8Array(arrayBuffer);
FileCrypto.decrypt(u8, key, function (err, decrypted) {
if (err) { return void console.error(err); }
if (err) {
if (err === "DECRYPTION_ERROR") {
console.warn(err);
return void onCpError(err);
}
return void console.error(err);
}
var blob = new Blob([decrypted.content], {type: 'plain/text'});
if (cb) {
return cb(blob, getFileType());
@ -788,6 +836,7 @@ define([
var i = 1;
var p = Object.keys(content.ids || {}).map(function (id) {
var nId = id.slice(0,32);
if (!users[nId]) { return; }
var ooId = content.ids[id].ooid;
var idx = content.ids[id].index;
if (!ooId || ooId === myOOId) { return; }
@ -831,14 +880,31 @@ define([
};
// Get all existing locks
var getUserLock = function (id) {
var getUserLock = function (id, forceArray) {
var type = common.getMetadataMgr().getPrivateData().ooType;
content.locks = content.locks || {};
var l = content.locks[id] || {};
return Object.keys(l).map(function (uid) { return l[uid]; });
if (type === "sheet" || forceArray) {
return Object.keys(l).map(function (uid) { return l[uid]; });
}
var res = {};
Object.keys(l).forEach(function (uid) {
res[uid] = l[uid];
});
return res;
};
var getLock = function () {
var type = common.getMetadataMgr().getPrivateData().ooType;
var locks = [];
Object.keys(content.locks).forEach(function (id) {
Array.prototype.push.apply(locks, getUserLock(id));
if (type === "sheet") {
Object.keys(content.locks || {}).forEach(function (id) {
Array.prototype.push.apply(locks, getUserLock(id));
});
return locks;
}
locks = {};
Object.keys(content.locks || {}).forEach(function (id) {
Util.extend(locks, getUserLock(id));
});
return locks;
};
@ -858,7 +924,7 @@ define([
var handleNewLocks = function (o, n) {
var hasNew = false;
// Check if we have at least one new lock
Object.keys(n).some(function (id) {
Object.keys(n || {}).some(function (id) {
if (typeof(n[id]) !== "object") { return; } // Ignore old format
// n[id] = { uid: lock, uid2: lock2 };
return Object.keys(n[id]).some(function (uid) {
@ -870,7 +936,7 @@ define([
});
});
// Remove old locks
Object.keys(o).forEach(function (id) {
Object.keys(o || {}).forEach(function (id) {
if (typeof(o[id]) !== "object") { return; } // Ignore old format
Object.keys(o[id]).forEach(function (uid) {
// Removed lock
@ -987,6 +1053,8 @@ define([
}, 50);
return;
}
var type = common.getMetadataMgr().getPrivateData().ooType;
content.locks = content.locks || {};
// Send the lock to other users
var msg = {
@ -996,8 +1064,13 @@ define([
};
var myId = getId();
content.locks[myId] = content.locks[myId] || {};
var uid = Util.uid();
content.locks[myId][uid] = msg;
var b = obj.block && obj.block[0];
if (type === "sheet" || typeof(b) !== "string") {
var uid = Util.uid();
content.locks[myId][uid] = msg;
} else {
if (typeof(b) === "string") { content.locks[myId][b] = msg; }
}
oldLocks = JSON.parse(JSON.stringify(content.locks));
// Remove old locks
deleteOfflineLocks();
@ -1088,8 +1161,8 @@ define([
type: "saveChanges",
changes: parseChanges(obj.changes),
changesIndex: ooChannel.cpIndex || 0,
locks: getUserLock(getId()),
excelAdditionalInfo: null
locks: getUserLock(getId(), true),
excelAdditionalInfo: obj.excelAdditionalInfo
}, null, function (err, hash) {
if (err) {
return void console.error(err);
@ -1124,6 +1197,7 @@ define([
var makeChannel = function () {
var msgEv = Util.mkEvent();
var iframe = $('#cp-app-oo-editor > iframe')[0].contentWindow;
var type = common.getMetadataMgr().getPrivateData().ooType;
window.addEventListener('message', function (msg) {
if (msg.source !== iframe) { return; }
msgEv.fire(msg);
@ -1135,7 +1209,11 @@ define([
APP.chan = chan;
var send = ooChannel.send = function (obj, force) {
if (APP.onStrictSaveChanges && !force) { return; } // can't push to OO before reloading cp
// can't push to OO before reloading cp
if (APP.onStrictSaveChanges && !force) { return; }
// We only need to release locks for sheets
if (type !== "sheet" && obj.type === "releaseLock") { return; }
debug(obj, 'toOO');
chan.event('CMD', obj);
};
@ -1164,6 +1242,17 @@ define([
}
}
break;
case "cursor":
cursor.updateCursor({
type: "cursor",
messages: [{
cursor: obj.cursor,
time: +new Date(),
user: myUniqueOOId,
useridoriginal: myOOId
}]
});
break;
case "getLock":
handleLock(obj, send);
break;
@ -1174,12 +1263,14 @@ define([
case "saveChanges":
// If we have unsaved data before reloading for a checkpoint...
if (APP.onStrictSaveChanges) {
delete APP.unsavedLocks;
APP.unsavedChanges = {
type: "saveChanges",
changes: parseChanges(obj.changes),
changesIndex: ooChannel.cpIndex || 0,
locks: getUserLock(getId()),
excelAdditionalInfo: null
locks: type === "sheet" ? [] : APP.unsavedLocks,
excelAdditionalInfo: null,
recover: true
};
APP.onStrictSaveChanges();
return;
@ -1274,22 +1365,23 @@ define([
var css = // Old OO
//'#id-toolbar-full .toolbar-group:nth-child(2), #id-toolbar-full .separator:nth-child(3) { display: none; }' +
//'#fm-btn-save { display: none !important; }' +
'#panel-settings-general tr.autosave { display: none !important; }' +
'#panel-settings-general tr.coauth { display: none !important; }' +
//'#panel-settings-general tr.autosave { display: none !important; }' +
//'#panel-settings-general tr.coauth { display: none !important; }' +
//'#header { display: none !important; }' +
'#title-doc-name { display: none !important; }' +
'#title-user-name { display: none !important; }' +
(supportsXLSX() ? '' : '#slot-btn-dt-print { display: none !important; }') +
// New OO:
'#asc-gen257 { display: none !important; }' + // Insert image from url
'section[data-tab="ins"] .separator:nth-last-child(2) { display: none !important; }' + // separator
'#slot-btn-insequation { display: none !important; }' + // Insert equation
'#asc-gen125 { display: none !important; }' + // Disable presenter mode
//'.toolbar .tabs .ribtab:not(.canedit) { display: none !important; }' + // Switch collaborative mode
'#fm-btn-info { display: none !important; }' + // Author name, doc title, etc. in "File" (menu entry)
'#panel-info { display: none !important; }' + // Same but content
'#image-button-from-url { display: none !important; }' + // Inline image settings: replace with url
'#asc-gen1839 { display: none !important; }' + // Image context menu: replace with url
'#asc-gen5883 { display: none !important; }' + // Rightside image menu: replace with url
'.cp-from-url, #textart-button-from-url { display: none !important; }' + // Spellcheck language
'.statusbar .cnt-lang { display: none !important; }' + // Spellcheck language
'.statusbar #btn-doc-spell { display: none !important; }' + // Spellcheck button
'#file-menu-panel .devider { display: none !important; }' + // separator in the "File" menu
'#left-btn-spellcheck, #left-btn-about { display: none !important; }'+
'div.btn-users.dropdown-toggle { display: none; !important }';
@ -1316,7 +1408,7 @@ define([
h('span.fa.fa-spin.fa-spinner'),
h('span', Messages.oo_sheetMigration_loading)
]);
UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
APP.migrateModal = UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
makeCheckpoint(true);
});
// DEPRECATED: from version 3, the queue is sent again during init
@ -1340,7 +1432,7 @@ define([
// Migration required but read-only: continue...
if (readOnly) {
setEditable(true);
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
} else {
// No changes after the cp: migrate now
onMigrateRdy.fire();
@ -1365,12 +1457,9 @@ define([
return;
}
if (lock) {
getEditor().setViewModeDisconnect();
} else if (readOnly) {
try {
getEditor().asc_setRestriction(true);
} catch (e) {}
if (lock || readOnly) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
//getEditor().setViewModeDisconnect(); // can't be used anymore, display an OO error popup
} else {
setEditable(true);
deleteOfflineLocks();
@ -1390,7 +1479,6 @@ define([
}
}
if (isLockedModal.modal && force) {
isLockedModal.modal.closeModal();
delete isLockedModal.modal;
@ -1400,7 +1488,8 @@ define([
}
if (APP.template) {
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
//getEditor().setViewModeDisconnect();
UI.removeLoadingScreen();
makeCheckpoint(true);
return;
@ -1414,7 +1503,7 @@ define([
} catch (e) {}
}
if (APP.migrate && !readOnly) {
if (lock && !readOnly) {
onMigrateRdy.fire();
}
@ -1438,6 +1527,29 @@ define([
};
*/
APP.getUserColor = function (userId) {
var hex;
Object.keys(content.ids || {}).some(function (k) {
var u = content.ids[k];
if (Number(u.ooid) === Number(userId)) {
var md = common.getMetadataMgr().getMetadataLazy();
if (md && md.users && md.users[u.netflux]) {
hex = md.users[u.netflux].color;
}
return true;
}
});
if (hex) {
var rgb = Util.hexToRGB(hex);
return {
r: rgb[0],
g: rgb[1],
b: rgb[2],
a: 255
};
}
};
APP.UploadImageFiles = function (files, type, id, jwt, cb) {
return void cb();
};
@ -1500,6 +1612,10 @@ define([
APP.loadingImage = 0;
APP.getImageURL = function(name, callback) {
if (name && /^data:image/.test(name)) {
return void callback('');
}
var mediasSources = getMediasSources();
var data = mediasSources[name];
@ -1775,10 +1891,10 @@ define([
if (type === "sheet" && extension !== 'xlsx') {
xlsData = x2tConvertDataInternal(x2t, data, filename, 'xlsx');
filename += '.xlsx';
} else if (type === "ooslide" && extension !== "pptx") {
} else if (type === "presentation" && extension !== "pptx") {
xlsData = x2tConvertDataInternal(x2t, data, filename, 'pptx');
filename += '.pptx';
} else if (type === "oodoc" && extension !== "docx") {
} else if (type === "doc" && extension !== "docx") {
xlsData = x2tConvertDataInternal(x2t, data, filename, 'docx');
filename += '.docx';
}
@ -1802,15 +1918,15 @@ define([
var ext = ['.xlsx', '.ods', '.bin', '.csv', '.pdf'];
var type = common.getMetadataMgr().getPrivateData().ooType;
var warning = '';
if (type==="ooslide") {
if (type==="presentation") {
ext = ['.pptx', /*'.odp',*/ '.bin'];
} else if (type==="oodoc") {
} else if (type==="doc") {
ext = ['.docx', /*'.odt',*/ '.bin'];
}
if (!supportsXLSX()) {
ext = ['.bin'];
warning = '<div class="alert alert-info cp-alert-top">'+Messages.oo_exportChrome+'</div>';
warning = h('div.alert.alert-info.cp-alert-top', Messages.oo_conversionSupport);
}
var types = ext.map(function (val) {
@ -1833,7 +1949,12 @@ define([
};
var $select = UIElements.createDropdown(dropdownConfig);
UI.prompt(Messages.exportPrompt+warning, Util.fixFileName(suggestion), function (filename) {
var promptMessage = h('span', [
Messages.exportPrompt,
warning
]);
UI.prompt(promptMessage, Util.fixFileName(suggestion), function (filename) {
// $select.getValue()
if (!(typeof(filename) === 'string' && filename)) { return; }
var ext = ($select.getValue() || '').slice(1);
@ -1969,7 +2090,7 @@ define([
UI.removeModals();
UI.confirm(Messages.oo_uploaded, function (yes) {
try {
getEditor().setViewModeDisconnect();
getEditor().asc_setRestriction(true);
} catch (e) {}
if (!yes) { return; }
common.gotoURL();
@ -2027,10 +2148,10 @@ define([
case 'sheet' :
newText = EmptyCell(useNewDefault);
break;
case 'oodoc':
case 'doc':
newText = EmptyDoc();
break;
case 'ooslide':
case 'presentation':
newText = EmptySlide();
break;
default:
@ -2084,19 +2205,22 @@ define([
}
};
var wasEditing = false;
var setStrictEditing = function () {
if (APP.isFast) { return; }
var editor = getEditor();
var editing = editor.asc_isDocumentModified();
var editing = editor.asc_isDocumentModified ? editor.asc_isDocumentModified() : editor.isDocumentModified();
if (editing) {
evOnPatch.fire();
} else {
evOnSync.fire();
}
wasEditing = Boolean(editing);
};
APP.onFastChange = function (isFast) {
APP.isFast = isFast;
if (isFast) {
wasEditing = false;
if (APP.hasChangedInterval) {
window.clearInterval(APP.hasChangedInterval);
}
@ -2119,6 +2243,9 @@ define([
};
var loadCp = function (cp, keepQueue) {
if (!isLockedModal.modal) {
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
}
loadLastDocument(cp, function () {
var file = getFileType();
var type = common.getMetadataMgr().getPrivateData().ooType;
@ -2135,7 +2262,9 @@ define([
APP.history = true;
APP.template = true;
var editor = getEditor();
if (editor) { editor.setViewModeDisconnect(); }
if (editor) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
}
var content = parsed.content;
// Get checkpoint
@ -2243,6 +2372,7 @@ define([
$contentContainer: $('#cp-app-oo-container')
};
toolbar = APP.toolbar = Toolbar.create(configTb);
toolbar.showColors();
Title.setToolbar(toolbar);
if (window.CP_DEV_MODE) {
@ -2274,7 +2404,7 @@ define([
var setHistoryMode = function (bool) {
if (bool) {
APP.history = true;
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
return;
}
// Cancel button: redraw from lastCp
@ -2389,25 +2519,41 @@ define([
var type = privateData.ooType;
var accept = [".bin", ".ods", ".xlsx"];
if (type === "ooslide") {
if (type === "presentation") {
accept = ['.bin', '.odp', '.pptx'];
} else if (type === "oodoc") {
} else if (type === "doc") {
accept = ['.bin', '.odt', '.docx'];
}
var first;
if (!supportsXLSX()) {
accept = ['.bin'];
first = function (cb) {
var msg = h('span', [
Messages.oo_conversionSupport,
' ', h('span', Messages.oo_importBin),
]);
UI.confirm(msg, function (yes) {
if (yes) {
cb();
}
});
};
}
if (common.isLoggedIn()) {
window.CryptPad_deleteLastCp = deleteLastCp;
var $importXLSX = common.createButton('import', true, {
accept: accept,
binary : ["ods", "xlsx", "odt", "docx", "odp", "pptx"]
binary : ["ods", "xlsx", "odt", "docx", "odp", "pptx"],
first: first,
}, importXLSXFile);
$importXLSX.appendTo(toolbar.$drawer);
common.createButton('hashtag', true).appendTo(toolbar.$drawer);
}
var $store = common.createButton('storeindrive', true);
toolbar.$drawer.append($store);
var $forget = common.createButton('forget', true, {}, function (err) {
if (err) { return; }
setEditable(false);
@ -2425,6 +2571,19 @@ define([
toolbar.$drawer.append($properties);
};
var noCache = false; // Prevent reload loops
var onCorruptedCache = function () {
if (noCache) {
UI.errorLoadingScreen(Messages.unableToDisplay, false, function () {
common.gotoURL('');
});
}
noCache = true;
var sframeChan = common.getSframeChannel();
sframeChan.event("EV_CORRUPTED_CACHE");
};
var firstReady = true;
config.onReady = function (info) {
if (APP.realtime !== info.realtime) {
APP.realtime = info.realtime;
@ -2457,10 +2616,8 @@ define([
newDoc = !content.hashes || Object.keys(content.hashes).length === 0;
} else if (!privateData.isNewFile) {
// This is an empty doc but not a new file: error
UI.errorLoadingScreen(Messages.unableToDisplay, false, function () {
common.gotoURL('');
});
throw new Error("Empty chainpad for a non-empty doc");
onCorruptedCache();
return void console.error("Empty chainpad for a non-empty doc");
} else {
Title.updateTitle(Title.defaultTitle);
}
@ -2481,7 +2638,11 @@ define([
APP.onLocal();
} else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
$(APP.helpMenu.menu).after(msg);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
}
} else if (content && content.version <= 3) { // V2 or V3
@ -2493,7 +2654,11 @@ define([
APP.onLocal();
} else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
$(APP.helpMenu.menu).after(msg);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
}
}
@ -2523,13 +2688,61 @@ define([
}
// Only execute the following code the first time we call onReady
if (!firstReady) {
setMyId();
oldHashes = JSON.parse(JSON.stringify(content.hashes));
initializing = false;
return void setEditable(!readOnly);
}
firstReady = false;
var useNewDefault = content.version && content.version >= 2;
openRtChannel(function () {
setMyId();
oldHashes = JSON.parse(JSON.stringify(content.hashes));
initializing = false;
common.openPadChat(APP.onLocal);
if (!readOnly) {
var cursors = {};
common.openCursorChannel(APP.onLocal);
cursor = common.createCursor(APP.onLocal);
cursor.onCursorUpdate(function (data) {
// Leaving user
if (data && data.leave && data.id) {
// When a netflux user leaves, remove all their cursors
Object.keys(cursors).forEach(function (ooid) {
var d = cursors[ooid];
if (d !== data.id) { return; } // Only continue for the leaving user
// Remove from OO UI
ooChannel.send({
type: "cursor",
messages: [{
cursor: "10;AgAAADIAAAAAAA==",
time: +new Date(),
user: ooid,
useridoriginal: String(ooid).slice(0,-1),
}]
});
// Remove from memory
delete cursors[ooid];
});
handleNewIds({}, content.ids);
}
// Cursor update
if (!data || !data.cursor) { return; }
// Store the new cursor in memory for this user, with their netflux ID
var ooid = Util.find(data.cursor, ['messages', 0, 'user']);
if (ooid) { cursors[ooid] = data.id.slice(0,32); }
// Update cursor in the UI
ooChannel.send(data.cursor);
});
}
if (APP.startWithTemplate) {
var template = APP.startWithTemplate;
loadTemplate(template.href, template.password, template.content);
@ -2551,6 +2764,9 @@ define([
var reloadPopup = false;
var checkNewCheckpoint = function () {
if (!isLockedModal.modal) {
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
}
var lastCp = getLastCp();
loadLastDocument(lastCp, function (err) {
console.error(err);
@ -2573,6 +2789,8 @@ define([
var wasMigrating = content.migration;
var myLocks = getUserLock(getId(), true);
content = json.content;
if (content.saveLock && wasLocked !== content.saveLock) {
@ -2598,8 +2816,10 @@ define([
checkNewCheckpoint();
});
};
if (editor.asc_isDocumentModified()) {
var editing = editor.asc_isDocumentModified ? editor.asc_isDocumentModified() : editor.isDocumentModify;
if (editing) {
setEditable(false);
APP.unsavedLocks = myLocks;
APP.onStrictSaveChanges = function () {
reload();
delete APP.onStrictSaveChanges;
@ -2642,10 +2862,12 @@ define([
common.gotoURL();
});
}
setEditable(true);
//setEditable(true);
try { getEditor().asc_setViewMode(false); } catch (e) {}
offline = false;
} else {
setEditable(false);
try { getEditor().asc_setViewMode(true); } catch (e) {}
//setEditable(false);
offline = true;
UI.findOKButton().click();
UIElements.disconnectAlert();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -780,94 +780,95 @@ nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else i
true;if(nTTRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}var nQuotient=nTTRemainder/1E3|0;var nRemainder=nTTRemainder-nQuotient*1E3;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else if(nTTQuotient>0){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/100|0;nRemainder=nRemainder-nQuotient*100;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[100];isPrevZero=
false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/10|0;nRemainder=nRemainder-nQuotient*10;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[10];isPrevZero=false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(0!==nRemainder)sGroup+=arrChinese[nRemainder];sResult=sGroup+sResult;if(nRemValue<=0)break}break}}return sResult}var c_oAscSpaces=[];c_oAscSpaces[10]=1;c_oAscSpaces[32]=
1;c_oAscSpaces[8194]=1;c_oAscSpaces[8195]=1;c_oAscSpaces[8197]=1;c_oAscSpaces[12288]=1;function IsSpace(nUnicode){return!!c_oAscSpaces[nUnicode]}function private_IsAbbreviation(sWord){if(sWord.toUpperCase()===sWord){for(var nPos=0,nLen=sWord.length;nPos<nLen;++nPos){var nCharCode=sWord.charCodeAt(nPos);if(44032<=nCharCode&&nCharCode<=55203||4352<=nCharCode&&nCharCode<=4607||12592<=nCharCode&&nCharCode<=12687||43360<=nCharCode&&nCharCode<=43391||55216<=nCharCode&&nCharCode<=55295||19968<=nCharCode&&
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,
0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|
oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&
getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,
Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,
"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;
script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?
!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();
scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=
value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||
12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=
null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);
this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=
this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle="#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};
CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,
Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;
var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",
false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);
delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,
src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();
this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;
this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;
if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;
var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],
true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==
type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=
-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData",
"data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-
1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+
";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==
obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;
if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=
_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,
callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());
return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+
option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}
AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=
function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?
this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=
0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=
-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=
0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,
VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=
arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]=
{};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,
VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=
VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=
VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,
x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=
x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect=
{IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=
oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,
StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<
nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle="#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,
y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};
CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,
value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);
while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!=="undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!==
"undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=
Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=
";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);
else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType="px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==
value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,
maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+
1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",
img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=
saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=
fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=
changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;
window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=
checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;
window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;
window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=
rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=
window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=
arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=
prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if(window.parent.APP&&window.parent.APP.getUserColor)try{var CPColor=window.parent.APP.getUserColor(userId);
if(CPColor)return true===isNumericValue?CPColor.r<<16&16711680|CPColor.g<<8&65280|CPColor.b&255:new CColor(CPColor.r,CPColor.g,CPColor.b,CPColor.a)}catch(e){}if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;
res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}
function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=
nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,
onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);
loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&
window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];
if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=
AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=
getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=
value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||
12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";
this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=
function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle=
"#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;
this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=
this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;
var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);
_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=
null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}
function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?
1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=
function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=
AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;
this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&
this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,
_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=
setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,
data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData",
"data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=
true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==
obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=
function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-
1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();
return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};
this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===
idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+
AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=
function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=
false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?
this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=
function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;
this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<
CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=
new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,
x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]={};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));
for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=
VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=
true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;
VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);
x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?
1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect={IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=
true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;
ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=
left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=
color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=
Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle=
"#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};
CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");
if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=
start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!==
"undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!=="undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=
Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();
else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=
rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType=
"px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&
"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},
timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;
var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};
window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=
sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;
window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;
window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=
unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;
window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=
getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;
window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=
parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=
prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=
private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;
window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
window["asc_initAdvancedOptions"]=function(_code,_file_hash,_docInfo){if(window.isNativeOpenPassword)return window["NativeFileOpen_error"](window.isNativeOpenPassword,_file_hash,_docInfo);var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;if(_code==90||_code==91){if(window["AscDesktopEditor"]&&0!==window["AscDesktopEditor"]["CryptoMode"]&&!_editor.isLoadFullApi){_editor.asc_initAdvancedOptions_params=[];_editor.asc_initAdvancedOptions_params.push(_code);_editor.asc_initAdvancedOptions_params.push(_file_hash);
_editor.asc_initAdvancedOptions_params.push(_docInfo);return}if(AscCommon.EncryptionWorker.isNeedCrypt()&&!window.checkPasswordFromPlugin){window.checkPasswordFromPlugin=true;window.g_asc_plugins.sendToEncryption({"type":"getPasswordByFile","hash":_file_hash,"docinfo":_docInfo});return}}window.checkPasswordFromPlugin=false;_editor._onNeedParams(undefined,_code==90||_code==91?true:undefined)};
window["asc_IsNeedBuildCryptedFile"]=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["CryptoMode"])return false;var _api=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;var _returnValue=false;var _users=null;if(_api.CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi._participants)_users=_api.CoAuthoringApi._CoAuthoringApi._participants;var _usersCount=0;for(var _user in _users)_usersCount++;var isOne=1>=_usersCount?true:false;

View file

@ -8412,18 +8412,18 @@ function(font_index,stream_index){this.embeddedFontFiles[font_index].SetStreamIn
false;var oThis=this;if(window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsLocalFile"]&&window["AscDesktopEditor"]["isBlockchainSupport"]){this.isBlockchainSupport=window["AscDesktopEditor"]["isBlockchainSupport"]()&&!window["AscDesktopEditor"]["IsLocalFile"]();if(this.isBlockchainSupport){Image.prototype.preload_crypto=function(_url){window["crypto_images_map"]=window["crypto_images_map"]||{};if(!window["crypto_images_map"][_url])window["crypto_images_map"][_url]=[];window["crypto_images_map"][_url].push(this);
window["AscDesktopEditor"]["PreloadCryptoImage"](_url,AscCommon.g_oDocumentUrls.getLocal(_url));oThis.Api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage)};Image.prototype["onload_crypto"]=function(_src,_crypto_data){if(_crypto_data&&AscCommon.EncryptionWorker&&AscCommon.EncryptionWorker.isCryptoImages()){AscCommon.EncryptionWorker.decryptImage(_src,this,_crypto_data);return}this.crossOrigin="";this.src=_src;oThis.Api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage)}}}this.put_Api=function(_api){this.Api=_api;if(this.Api.IsAsyncOpenDocumentImages!==undefined){this.bIsAsyncLoadDocumentImages=this.Api.IsAsyncOpenDocumentImages();if(this.bIsAsyncLoadDocumentImages)if(undefined===this.Api.asyncImageEndLoadedBackground)this.bIsAsyncLoadDocumentImages=false}};this.LoadDocumentImagesCallback=function(){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded()};this.LoadDocumentImages=
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;for(var i=0;i<_len;i++)this.LoadImageAsync(i);this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},
3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=
new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};
oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};
oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=
function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,
url);oThis.map_image_index[url]=oImage}})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=
0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,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";
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;if(_len===0)return void this.LoadDocumentImagesCallback();var todo=_len;var that=this;var done=function(){todo--;
if(todo===0){that.images_loading.splice(0,_len);setTimeout(function(){that.LoadDocumentImagesCallback()},100);done=function(){}}};for(var i=0;i<_len;i++)this.LoadImageAsync(i,done);return;this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=
0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();
oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=
new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i,
cb){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,url);oThis.map_image_index[url]=oImage}if(typeof cb==="function")cb()})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);
return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==
oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,
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=
@ -17184,8 +17184,8 @@ this.Lines.length-RangeOffset);if(this.Lines[0]!==LineIndex+1&&0===RangeIndex)th
this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.private_UpdateSpellChecking=function(){if(this.Paragraph&&this.Paragraph.SpellChecker){this.Paragraph.SpellChecker.ClearPausedEngine();this.Paragraph.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}};CParagraphContentWithContentBase.prototype.Is_UseInDocument=function(Id){if(this.Paragraph){for(var i=0;i<this.Content.length;++i)if(this.Content[i].Get_Id&&this.Content[i].Get_Id()===
Id)break;if(i<this.Content.length)return this.Paragraph.Is_UseInDocument(this.Get_Id())}return false};CParagraphContentWithContentBase.prototype.IsUseInDocument=function(sId){return this.Is_UseInDocument(sId)};CParagraphContentWithContentBase.prototype.protected_GetPrevRangeEndPos=function(LineIndex,RangeIndex){var RangeCount=this.protected_GetRangesCount(LineIndex-1);var RangeOffset=this.protected_GetRangeOffset(LineIndex-1,RangeCount-1);return LineIndex==0&&RangeIndex==0?0:this.Lines[RangeOffset+
1]};CParagraphContentWithContentBase.prototype.private_UpdateTrackRevisions=function(){if(this.Paragraph&&this.Paragraph.LogicDocument&&this.Paragraph.LogicDocument.GetTrackRevisionsManager){var RevisionsManager=this.Paragraph.LogicDocument.GetTrackRevisionsManager();RevisionsManager.CheckElement(this.Paragraph)}};CParagraphContentWithContentBase.prototype.CanSplit=function(){return true};CParagraphContentWithContentBase.prototype.PreDelete=function(){};CParagraphContentWithContentBase.prototype.private_UpdateDocumentOutline=
function(){if(this.Paragraph)this.Paragraph.UpdateDocumentOutline()};CParagraphContentWithContentBase.prototype.IsSolid=function(){return false};CParagraphContentWithContentBase.prototype.ConvertParaContentPosToRangePos=function(oContentPos,nDepth){return 0};CParagraphContentWithContentBase.prototype.ProcessNotInlineObjectCheck=function(oChecker){oChecker.Result=false;oChecker.Found=true};function CParagraphContentWithParagraphLikeContent(){CParagraphContentWithContentBase.call(this);this.Type=undefined;
this.Paragraph=null;this.m_oContentChanges=new AscCommon.CContentChanges;this.Content=[];this.State=new CParaRunState;this.Selection=this.State.Selection;this.NearPosArray=[];this.SearchMarks=[]}CParagraphContentWithParagraphLikeContent.prototype=Object.create(CParagraphContentWithContentBase.prototype);CParagraphContentWithParagraphLikeContent.prototype.constructor=CParagraphContentWithParagraphLikeContent;CParagraphContentWithParagraphLikeContent.prototype.Get_Type=function(){return this.Type};
function(){if(this.Paragraph&&this.Paragraph.UpdateDocumentOutline)this.Paragraph.UpdateDocumentOutline()};CParagraphContentWithContentBase.prototype.IsSolid=function(){return false};CParagraphContentWithContentBase.prototype.ConvertParaContentPosToRangePos=function(oContentPos,nDepth){return 0};CParagraphContentWithContentBase.prototype.ProcessNotInlineObjectCheck=function(oChecker){oChecker.Result=false;oChecker.Found=true};function CParagraphContentWithParagraphLikeContent(){CParagraphContentWithContentBase.call(this);
this.Type=undefined;this.Paragraph=null;this.m_oContentChanges=new AscCommon.CContentChanges;this.Content=[];this.State=new CParaRunState;this.Selection=this.State.Selection;this.NearPosArray=[];this.SearchMarks=[]}CParagraphContentWithParagraphLikeContent.prototype=Object.create(CParagraphContentWithContentBase.prototype);CParagraphContentWithParagraphLikeContent.prototype.constructor=CParagraphContentWithParagraphLikeContent;CParagraphContentWithParagraphLikeContent.prototype.Get_Type=function(){return this.Type};
CParagraphContentWithParagraphLikeContent.prototype.Copy=function(Selected,oPr){var NewElement=new this.constructor;var StartPos=0;var EndPos=this.Content.length-1;if(true===Selected&&true===this.State.Selection.Use){StartPos=this.State.Selection.StartPos;EndPos=this.State.Selection.EndPos;if(StartPos>EndPos){StartPos=this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if(StartPos===CurPos||EndPos===CurPos)NewElement.Add_ToContent(CurPos-
StartPos,Item.Copy(Selected,oPr));else NewElement.Add_ToContent(CurPos-StartPos,Item.Copy(false,oPr))}return NewElement};CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContent=function(oSelectedContent){var oNewElement=new this.constructor;var nStartPos=this.State.Selection.StartPos;var nEndPos=this.State.Selection.EndPos;if(nStartPos>nEndPos){nStartPos=this.State.Selection.EndPos;nEndPos=this.State.Selection.StartPos}var nItemPos=0;for(var nPos=nStartPos,nItemPos=0;nPos<=nEndPos;++nPos){var oNewItem=
this.Content[nPos].GetSelectedContent(oSelectedContent);if(oNewItem){oNewElement.AddToContent(nItemPos,oNewItem);nItemPos++}}if(0===nItemPos)return null;return oNewElement};CParagraphContentWithParagraphLikeContent.prototype.CopyContent=function(Selected){var CopyContent=[];var StartPos=0;var EndPos=this.Content.length-1;if(true===Selected&&true===this.State.Selection.Use){StartPos=this.State.Selection.StartPos;EndPos=this.State.Selection.EndPos;if(StartPos>EndPos){StartPos=this.State.Selection.EndPos;
@ -18283,155 +18283,156 @@ CChangesParaTextPrUnderline.prototype.private_SetValue=function(Value){this.Clas
AscDFH.historyitem_TextPr_FontSize;CChangesParaTextPrFontSize.prototype.private_SetValue=function(Value){this.Class.Value.FontSize=Value};CChangesParaTextPrFontSize.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrColor(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrColor.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrColor.prototype.constructor=CChangesParaTextPrColor;
CChangesParaTextPrColor.prototype.Type=AscDFH.historyitem_TextPr_Color;CChangesParaTextPrColor.prototype.private_SetValue=function(Value){this.Class.Value.Color=Value};CChangesParaTextPrColor.prototype.private_CreateObject=function(){return new CDocumentColor(0,0,0,false)};CChangesParaTextPrColor.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrVertAlign(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrVertAlign.prototype=
Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrVertAlign.prototype.constructor=CChangesParaTextPrVertAlign;CChangesParaTextPrVertAlign.prototype.Type=AscDFH.historyitem_TextPr_VertAlign;CChangesParaTextPrVertAlign.prototype.private_SetValue=function(Value){this.Class.Value.VertAlign=Value};CChangesParaTextPrVertAlign.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrHighLight(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,
Old,New,Color)}CChangesParaTextPrHighLight.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrHighLight.prototype.constructor=CChangesParaTextPrHighLight;CChangesParaTextPrHighLight.prototype.Type=AscDFH.historyitem_TextPr_HighLight;CChangesParaTextPrHighLight.prototype.private_SetValue=function(Value){this.Class.Value.HighLight=Value};CChangesParaTextPrHighLight.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=
2;else if(highlight_None===this.New)nFlags|=4;if(undefined===this.Old)nFlags|=8;else if(highlight_None===this.Old)nFlags|=16;Writer.WriteLong(nFlags);if(undefined!==this.New&&highlight_None!==this.New)this.New.Write_ToBinary(Writer);if(undefined!==this.Old&&highlight_None!==this.Old)this.Old.Write_ToBinary(Writer)};CChangesParaTextPrHighLight.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else if(nFlags&
4)this.New=highlight_None;else{this.New=new CDocumentColor(0,0,0);this.New.Read_FromBinary(Reader)}if(nFlags&8)this.Old=undefined;else if(nFlags&16)this.Old=highlight_None;else{this.Old=new CDocumentColor(0,0,0);this.Old.Read_FromBinary(Reader)}};CChangesParaTextPrHighLight.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrRStyle(Class,Old,New,Color){AscDFH.CChangesBaseStringProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRStyle.prototype=Object.create(AscDFH.CChangesBaseStringProperty.prototype);
CChangesParaTextPrRStyle.prototype.constructor=CChangesParaTextPrRStyle;CChangesParaTextPrRStyle.prototype.Type=AscDFH.historyitem_TextPr_RStyle;CChangesParaTextPrRStyle.prototype.private_SetValue=function(Value){this.Class.Value.RStyle=Value};CChangesParaTextPrRStyle.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSpacing(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrSpacing.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);
CChangesParaTextPrSpacing.prototype.constructor=CChangesParaTextPrSpacing;CChangesParaTextPrSpacing.prototype.Type=AscDFH.historyitem_TextPr_Spacing;CChangesParaTextPrSpacing.prototype.private_SetValue=function(Value){this.Class.Value.Spacing=Value};CChangesParaTextPrSpacing.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrDStrikeout(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrDStrikeout.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);
CChangesParaTextPrDStrikeout.prototype.constructor=CChangesParaTextPrDStrikeout;CChangesParaTextPrDStrikeout.prototype.Type=AscDFH.historyitem_TextPr_DStrikeout;CChangesParaTextPrDStrikeout.prototype.private_SetValue=function(Value){this.Class.Value.DStrikeout=Value};CChangesParaTextPrDStrikeout.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrCaps(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);
CChangesParaTextPrCaps.prototype.constructor=CChangesParaTextPrCaps;CChangesParaTextPrCaps.prototype.Type=AscDFH.historyitem_TextPr_Caps;CChangesParaTextPrCaps.prototype.private_SetValue=function(Value){this.Class.Value.Caps=Value};CChangesParaTextPrCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSmallCaps(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrSmallCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);
CChangesParaTextPrSmallCaps.prototype.constructor=CChangesParaTextPrSmallCaps;CChangesParaTextPrSmallCaps.prototype.Type=AscDFH.historyitem_TextPr_SmallCaps;CChangesParaTextPrSmallCaps.prototype.private_SetValue=function(Value){this.Class.Value.SmallCaps=Value};CChangesParaTextPrSmallCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrPosition(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrPosition.prototype=
Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrPosition.prototype.constructor=CChangesParaTextPrPosition;CChangesParaTextPrPosition.prototype.Type=AscDFH.historyitem_TextPr_Position;CChangesParaTextPrPosition.prototype.private_SetValue=function(Value){this.Class.Value.Position=Value};CChangesParaTextPrPosition.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrValue(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,
New,Color)}CChangesParaTextPrValue.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrValue.prototype.constructor=CChangesParaTextPrValue;CChangesParaTextPrValue.prototype.Type=AscDFH.historyitem_TextPr_Value;CChangesParaTextPrValue.prototype.private_SetValue=function(Value){this.Class.Value=Value};CChangesParaTextPrValue.prototype.private_CreateObject=function(){return new CTextPr};CChangesParaTextPrValue.prototype.private_IsCreateEmptyObject=function(){return true};
CChangesParaTextPrValue.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true;if(oChange.Type===this.Type)return false;if(!this.New)this.New=new CTextPr;switch(oChange.Type){case AscDFH.historyitem_TextPr_Bold:{this.New.Bold=oChange.New;break}case AscDFH.historyitem_TextPr_Italic:{this.New.Italic=oChange.New;break}case AscDFH.historyitem_TextPr_Strikeout:{this.New.Strikeout=oChange.New;break}case AscDFH.historyitem_TextPr_Underline:{this.New.Underline=oChange.New;break}case AscDFH.historyitem_TextPr_FontSize:{this.New.FontSize=
oChange.New;break}case AscDFH.historyitem_TextPr_Color:{this.New.Color=oChange.New;break}case AscDFH.historyitem_TextPr_VertAlign:{this.New.VertAlign=oChange.New;break}case AscDFH.historyitem_TextPr_HighLight:{this.New.HighLight=oChange.New;break}case AscDFH.historyitem_TextPr_RStyle:{this.New.RStyle=oChange.New;break}case AscDFH.historyitem_TextPr_Spacing:{this.New.Spacing=oChange.New;break}case AscDFH.historyitem_TextPr_DStrikeout:{this.New.DStrikeout=oChange.New;break}case AscDFH.historyitem_TextPr_Caps:{this.New.Caps=
oChange.New;break}case AscDFH.historyitem_TextPr_SmallCaps:{this.New.SmallCaps=oChange.New;break}case AscDFH.historyitem_TextPr_Position:{this.New.Position=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts:{this.New.RFonts=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Ascii:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Ascii=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.HAnsi=oChange.New;
break}case AscDFH.historyitem_TextPr_RFonts_CS:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Hint=oChange.New;break}case AscDFH.historyitem_TextPr_Lang:{this.New.Lang=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Bidi:{if(!this.New.Lang)this.New.Lang=
new CLang;this.New.Lang.Bidi=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Val=oChange.New;break}case AscDFH.historyitem_TextPr_Unifill:{this.New.Unifill=oChange.New;break}case AscDFH.historyitem_TextPr_FontSizeCS:{this.New.FontSizeCS=oChange.New;break}case AscDFH.historyitem_TextPr_Outline:{this.New.TextOutline=
oChange.New;break}case AscDFH.historyitem_TextPr_Fill:{this.New.TextFill=oChange.New;break}}return true};function CChangesParaTextPrRFonts(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFonts.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrRFonts.prototype.constructor=CChangesParaTextPrRFonts;CChangesParaTextPrRFonts.prototype.Type=AscDFH.historyitem_TextPr_RFonts;CChangesParaTextPrRFonts.prototype.private_SetValue=
function(Value){this.Class.Value.RFonts=Value};CChangesParaTextPrRFonts.prototype.private_CreateObject=function(){return new CRFonts};CChangesParaTextPrRFonts.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrRFonts.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||oChange.Type===AscDFH.historyitem_TextPr_Value)return false;if(!this.New)this.New=new CRFonts;switch(oChange.Type){case AscDFH.historyitem_TextPr_RFonts_Ascii:{this.New.Ascii=
oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{this.New.HAnsi=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_CS:{this.New.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{this.New.Hint=oChange.New;break}}return true};function CChangesParaTextPrRFontsAscii(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsAscii.prototype=
Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsAscii.prototype.constructor=CChangesParaTextPrRFontsAscii;CChangesParaTextPrRFontsAscii.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Ascii;CChangesParaTextPrRFontsAscii.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==
this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsAscii.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsAscii.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.Ascii=Value};CChangesParaTextPrRFontsAscii.prototype.Merge=
private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHAnsi(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHAnsi.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsHAnsi.prototype.constructor=CChangesParaTextPrRFontsHAnsi;CChangesParaTextPrRFontsHAnsi.prototype.Type=AscDFH.historyitem_TextPr_RFonts_HAnsi;CChangesParaTextPrRFontsHAnsi.prototype.WriteToBinary=function(Writer){var nFlags=
0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsHAnsi.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;
else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsHAnsi.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.HAnsi=Value};CChangesParaTextPrRFontsHAnsi.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsCS(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsCS.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsCS.prototype.constructor=
CChangesParaTextPrRFontsCS;CChangesParaTextPrRFontsCS.prototype.Type=AscDFH.historyitem_TextPr_RFonts_CS;CChangesParaTextPrRFontsCS.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsCS.prototype.ReadFromBinary=function(Reader){var nFlags=
Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsCS.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.CS=Value};CChangesParaTextPrRFontsCS.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,
Class,Old,New,Color)}CChangesParaTextPrRFontsEastAsia.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsEastAsia.prototype.constructor=CChangesParaTextPrRFontsEastAsia;CChangesParaTextPrRFontsEastAsia.prototype.Type=AscDFH.historyitem_TextPr_RFonts_EastAsia;CChangesParaTextPrRFontsEastAsia.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);
if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsEastAsia.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.EastAsia=
Value};CChangesParaTextPrRFontsEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHint(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHint.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrRFontsHint.prototype.constructor=CChangesParaTextPrRFontsHint;CChangesParaTextPrRFontsHint.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Hint;CChangesParaTextPrRFontsHint.prototype.private_SetValue=
function(Value){this.Class.Value.RFonts.Hint=Value};CChangesParaTextPrRFontsHint.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrLang(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLang.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrLang.prototype.constructor=CChangesParaTextPrLang;CChangesParaTextPrLang.prototype.Type=AscDFH.historyitem_TextPr_Lang;CChangesParaTextPrLang.prototype.private_SetValue=
function(Value){this.Class.Value.Lang=Value};CChangesParaTextPrLang.prototype.private_CreateObject=function(){return new CLang};CChangesParaTextPrLang.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrLang.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(AscDFH.historyitem_TextPr_Lang===oChange.Type||AscDFH.historyitem_TextPr_Value===oChange.Type)return false;if(!this.New)this.New=new CLang;switch(oChange.Type){case AscDFH.historyitem_TextPr_Lang_Bidi:{this.New.Bidi=
oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{this.New.Val=oChange.New;break}}return true};function CChangesParaTextPrLangBidi(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangBidi.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangBidi.prototype.constructor=CChangesParaTextPrLangBidi;CChangesParaTextPrLangBidi.prototype.Type=
AscDFH.historyitem_TextPr_Lang_Bidi;CChangesParaTextPrLangBidi.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Bidi=Value};CChangesParaTextPrLangBidi.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangEastAsia.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangEastAsia.prototype.constructor=CChangesParaTextPrLangEastAsia;
CChangesParaTextPrLangEastAsia.prototype.Type=AscDFH.historyitem_TextPr_Lang_EastAsia;CChangesParaTextPrLangEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.Lang.EastAsia=Value};CChangesParaTextPrLangEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangVal(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangVal.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangVal.prototype.constructor=
CChangesParaTextPrLangVal;CChangesParaTextPrLangVal.prototype.Type=AscDFH.historyitem_TextPr_Lang_Val;CChangesParaTextPrLangVal.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Val=Value};CChangesParaTextPrLangVal.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrUnifill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrUnifill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);
CChangesParaTextPrUnifill.prototype.constructor=CChangesParaTextPrUnifill;CChangesParaTextPrUnifill.prototype.Type=AscDFH.historyitem_TextPr_Unifill;CChangesParaTextPrUnifill.prototype.private_SetValue=function(Value){this.Class.Value.Unifill=Value};CChangesParaTextPrUnifill.prototype.private_CreateObject=function(){return new AscFormat.CUniFill};CChangesParaTextPrUnifill.prototype.Load=function(Color){this.Redo();var Unifill=this.Class.Value.Unifill;if(AscCommon.CollaborativeEditing&&Unifill&&Unifill.fill&&
Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_BLIP&&typeof Unifill.fill.RasterImageId==="string"&&Unifill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId)};CChangesParaTextPrUnifill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrFontSizeCS(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrFontSizeCS.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);
CChangesParaTextPrFontSizeCS.prototype.constructor=CChangesParaTextPrFontSizeCS;CChangesParaTextPrFontSizeCS.prototype.Type=AscDFH.historyitem_TextPr_FontSizeCS;CChangesParaTextPrFontSizeCS.prototype.private_SetValue=function(Value){this.Class.Value.FontSizeCS=Value};CChangesParaTextPrFontSizeCS.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrTextOutline(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextOutline.prototype=
Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextOutline.prototype.constructor=CChangesParaTextPrTextOutline;CChangesParaTextPrTextOutline.prototype.Type=AscDFH.historyitem_TextPr_Outline;CChangesParaTextPrTextOutline.prototype.private_SetValue=function(Value){this.Class.Value.TextOutline=Value};CChangesParaTextPrTextOutline.prototype.private_CreateObject=function(){return new AscFormat.CLn};CChangesParaTextPrTextOutline.prototype.Merge=private_ParaTextPrChangesOnMergeValue;
function CChangesParaTextPrTextFill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextFill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextFill.prototype.constructor=CChangesParaTextPrTextFill;CChangesParaTextPrTextFill.prototype.Type=AscDFH.historyitem_TextPr_Fill;CChangesParaTextPrTextFill.prototype.private_SetValue=function(Value){this.Class.Value.TextFill=Value};CChangesParaTextPrTextFill.prototype.private_CreateObject=
function(){return new AscFormat.CUniFill};CChangesParaTextPrTextFill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;"use strict";var drawing_Inline=1;var drawing_Anchor=2;var WRAPPING_TYPE_NONE=0;var WRAPPING_TYPE_SQUARE=1;var WRAPPING_TYPE_THROUGH=2;var WRAPPING_TYPE_TIGHT=3;var WRAPPING_TYPE_TOP_AND_BOTTOM=4;var WRAP_HIT_TYPE_POINT=0;var WRAP_HIT_TYPE_SECTION=1;var c_oAscAlignH=Asc.c_oAscAlignH;var c_oAscAlignV=Asc.c_oAscAlignV;function ParaDrawing(W,H,GraphicObj,DrawingDocument,DocumentContent,
Parent){CRunElementBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.DrawingType=drawing_Inline;this.GraphicObj=GraphicObj;this.X=0;this.Y=0;this.Width=0;this.Height=0;this.OrigX=0;this.OrigY=0;this.ShiftX=0;this.ShiftY=0;this.PageNum=0;this.LineNum=0;this.YOffset=0;this.DocumentContent=DocumentContent;this.DrawingDocument=DrawingDocument;this.Parent=Parent;this.LogicDocument=DrawingDocument?DrawingDocument.m_oLogicDocument:null;this.Distance={T:0,B:0,L:0,R:0};this.LayoutInCell=true;
this.RelativeHeight=undefined;this.SimplePos={Use:false,X:0,Y:0};this.Extent={W:W,H:H};this.EffectExtent={L:0,T:0,R:0,B:0};this.docPr=new AscFormat.CNvPr;this.SizeRelH=undefined;this.SizeRelV=undefined;this.AllowOverlap=true;this.Locked=null;this.Hidden=null;this.PositionH={RelativeFrom:c_oAscRelativeFromH.Column,Align:false,Value:0,Percent:false};this.PositionV={RelativeFrom:c_oAscRelativeFromV.Paragraph,Align:false,Value:0,Percent:false};this.PositionH_Old=undefined;this.PositionV_Old=undefined;
this.Internal_Position=new CAnchorPosition;this.wrappingType=WRAPPING_TYPE_THROUGH;this.useWrap=true;if(typeof CWrapPolygon!=="undefined")this.wrappingPolygon=new CWrapPolygon(this);this.document=editor.WordControl.m_oLogicDocument;this.drawingDocument=DrawingDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.selected=false;this.behindDoc=false;this.bNoNeedToAdd=false;this.pageIndex=-1;this.Lock=new AscCommon.CLock;this.ParaMath=null;this.SkipOnRecalculate=false;
this.LineTop=null;this.LineBottom=null;g_oTableId.Add(this,this.Id);if(this.graphicObjects){this.Set_RelativeHeight(this.graphicObjects.getZIndex());if(History.Is_On()&&!g_oTableId.m_bTurnOff)this.graphicObjects.addGraphicObject(this)}}ParaDrawing.prototype=Object.create(CRunElementBase.prototype);ParaDrawing.prototype.constructor=ParaDrawing;ParaDrawing.prototype.Type=para_Drawing;ParaDrawing.prototype.Get_Type=function(){return this.Type};ParaDrawing.prototype.Get_Width=function(){return this.Width};
ParaDrawing.prototype.Get_WidthVisible=function(){return this.WidthVisible};ParaDrawing.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible};ParaDrawing.prototype.GetSelectedContent=function(SelectedContent){if(this.GraphicObj&&this.GraphicObj.GetSelectedContent)this.GraphicObj.GetSelectedContent(SelectedContent)};ParaDrawing.prototype.GetSearchElementId=function(bNext,bCurrent){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetSearchElementId==="function")return this.GraphicObj.GetSearchElementId(bNext,
bCurrent);return null};ParaDrawing.prototype.CheckCorrect=function(){if(!this.GraphicObj)return false;if(this.GraphicObj&&this.GraphicObj.checkCorrect)return this.GraphicObj.checkCorrect();return true};ParaDrawing.prototype.GetAllDrawingObjects=function(DrawingObjects){if(null==DrawingObjects)DrawingObjects=[];if(this.GraphicObj.GetAllDrawingObjects)this.GraphicObj.GetAllDrawingObjects(DrawingObjects)};ParaDrawing.prototype.canRotate=function(){return AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canRotate==
"function"&&this.GraphicObj.canRotate()};ParaDrawing.prototype.GetParagraph=function(){return this.Get_ParentParagraph()};ParaDrawing.prototype.GetRun=function(){return this.Get_Run()};ParaDrawing.prototype.Get_Run=function(){var oParagraph=this.Get_ParentParagraph();if(oParagraph)return oParagraph.Get_DrawingObjectRun(this.Id);return null};ParaDrawing.prototype.Get_Props=function(OtherProps){var Props={};Props.Width=this.GraphicObj.extX;Props.Height=this.GraphicObj.extY;if(drawing_Inline===this.DrawingType)Props.WrappingStyle=
c_oAscWrapStyle2.Inline;else if(WRAPPING_TYPE_NONE===this.wrappingType)Props.WrappingStyle=this.behindDoc===true?c_oAscWrapStyle2.Behind:c_oAscWrapStyle2.InFront;else switch(this.wrappingType){case WRAPPING_TYPE_SQUARE:Props.WrappingStyle=c_oAscWrapStyle2.Square;break;case WRAPPING_TYPE_TIGHT:Props.WrappingStyle=c_oAscWrapStyle2.Tight;break;case WRAPPING_TYPE_THROUGH:Props.WrappingStyle=c_oAscWrapStyle2.Through;break;case WRAPPING_TYPE_TOP_AND_BOTTOM:Props.WrappingStyle=c_oAscWrapStyle2.TopAndBottom;
break;default:Props.WrappingStyle=c_oAscWrapStyle2.Inline;break}if(drawing_Inline===this.DrawingType)Props.Paddings={Left:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Right:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Top:0,Bottom:0};else{var oDistance=this.Get_Distance();Props.Paddings={Left:oDistance.L,Right:oDistance.R,Top:oDistance.T,Bottom:oDistance.B}}Props.AllowOverlap=this.AllowOverlap;Props.Position={X:this.X,Y:this.Y};Props.PositionH={RelativeFrom:this.PositionH.RelativeFrom,UseAlign:this.PositionH.Align,
Align:true===this.PositionH.Align?this.PositionH.Value:undefined,Value:true===this.PositionH.Align?0:this.PositionH.Value,Percent:this.PositionH.Percent};Props.PositionV={RelativeFrom:this.PositionV.RelativeFrom,UseAlign:this.PositionV.Align,Align:true===this.PositionV.Align?this.PositionV.Value:undefined,Value:true===this.PositionV.Align?0:this.PositionV.Value,Percent:this.PositionV.Percent};if(this.SizeRelH&&this.SizeRelH.Percent>0)Props.SizeRelH={RelativeFrom:AscFormat.ConvertRelSizeHToRelPosition(this.SizeRelH.RelativeFrom),
Value:this.SizeRelH.Percent*100>>0};if(this.SizeRelV&&this.SizeRelV.Percent>0)Props.SizeRelV={RelativeFrom:AscFormat.ConvertRelSizeVToRelPosition(this.SizeRelV.RelativeFrom),Value:this.SizeRelV.Percent*100>>0};Props.Internal_Position=this.Internal_Position;Props.Locked=this.Lock.Is_Locked();var ParentParagraph=this.Get_ParentParagraph();if(ParentParagraph&&undefined!==ParentParagraph.Parent){var DocContent=ParentParagraph.Parent;if(true===DocContent.Is_DrawingShape()||DocContent.GetTopDocumentContent()instanceof
CFootEndnote)Props.CanBeFlow=false}Props.title=this.docPr.title!==null?this.docPr.title:undefined;Props.description=this.docPr.descr!==null?this.docPr.descr:undefined;if(null!=OtherProps&&undefined!=OtherProps){if(undefined===OtherProps.Width||.001>Math.abs(Props.Width-OtherProps.Width))Props.Width=undefined;if(undefined===OtherProps.Height||.001>Math.abs(Props.Height-OtherProps.Height))Props.Height=undefined;if(undefined===OtherProps.WrappingStyle||Props.WrappingStyle!=OtherProps.WrappingStyle)Props.WrappingStyle=
undefined;if(undefined===OtherProps.ImageUrl||Props.ImageUrl!=OtherProps.ImageUrl)Props.ImageUrl=undefined;if(undefined===OtherProps.Paddings.Left||.001>Math.abs(Props.Paddings.Left-OtherProps.Paddings.Left))Props.Paddings.Left=undefined;if(undefined===OtherProps.Paddings.Right||.001>Math.abs(Props.Paddings.Right-OtherProps.Paddings.Right))Props.Paddings.Right=undefined;if(undefined===OtherProps.Paddings.Top||.001>Math.abs(Props.Paddings.Top-OtherProps.Paddings.Top))Props.Paddings.Top=undefined;if(undefined===
OtherProps.Paddings.Bottom||.001>Math.abs(Props.Paddings.Bottom-OtherProps.Paddings.Bottom))Props.Paddings.Bottom=undefined;if(undefined===OtherProps.AllowOverlap||Props.AllowOverlap!=OtherProps.AllowOverlap)Props.AllowOverlap=undefined;if(undefined===OtherProps.Position.X||.001>Math.abs(Props.Position.X-OtherProps.Position.X))Props.Position.X=undefined;if(undefined===OtherProps.Position.Y||.001>Math.abs(Props.Position.Y-OtherProps.Position.Y))Props.Position.Y=undefined;if(undefined===OtherProps.PositionH.RelativeFrom||
Props.PositionH.RelativeFrom!=OtherProps.PositionH.RelativeFrom)Props.PositionH.RelativeFrom=undefined;if(undefined===OtherProps.PositionH.UseAlign||Props.PositionH.UseAlign!=OtherProps.PositionH.UseAlign)Props.PositionH.UseAlign=undefined;if(Props.PositionH.RelativeFrom===OtherProps.PositionH.RelativeFrom&&Props.PositionH.UseAlign===OtherProps.PositionH.UseAlign){if(true!=Props.PositionH.UseAlign&&.001>Math.abs(Props.PositionH.Value-OtherProps.PositionH.Value))Props.PositionH.Value=undefined;if(true===
Props.PositionH.UseAlign&&Props.PositionH.Align!=OtherProps.PositionH.Align)Props.PositionH.Align=undefined}if(undefined===OtherProps.PositionV.RelativeFrom||Props.PositionV.RelativeFrom!=OtherProps.PositionV.RelativeFrom)Props.PositionV.RelativeFrom=undefined;if(undefined===OtherProps.PositionV.UseAlign||Props.PositionV.UseAlign!=OtherProps.PositionV.UseAlign)Props.PositionV.UseAlign=undefined;if(Props.PositionV.RelativeFrom===OtherProps.PositionV.RelativeFrom&&Props.PositionV.UseAlign===OtherProps.PositionV.UseAlign){if(true!=
Props.PositionV.UseAlign&&.001>Math.abs(Props.PositionV.Value-OtherProps.PositionV.Value))Props.PositionV.Value=undefined;if(true===Props.PositionV.UseAlign&&Props.PositionV.Align!=OtherProps.PositionV.Align)Props.PositionV.Align=undefined}if(false===OtherProps.Locked)Props.Locked=false;if(false===OtherProps.CanBeFlow||false===Props.CanBeFlow)Props.CanBeFlow=false;else Props.CanBeFlow=true;if(undefined===OtherProps.title||Props.title!==OtherProps.title)Props.title=undefined;if(undefined===OtherProps.description||
Props.description!==OtherProps.description)Props.description=undefined}return Props};ParaDrawing.prototype.Is_UseInDocument=function(){if(this.Parent){var Run=this.Parent.Get_DrawingObjectRun(this.Id);if(Run)return Run.Is_UseInDocument(this.Get_Id())}return false};ParaDrawing.prototype.IsUseInDocument=function(){return this.Is_UseInDocument()};ParaDrawing.prototype.CheckGroupSizes=function(){if(this.GraphicObj&&this.GraphicObj.CheckGroupSizes)this.GraphicObj.CheckGroupSizes()};ParaDrawing.prototype.Set_DrawingType=
function(DrawingType){History.Add(new CChangesParaDrawingDrawingType(this,this.DrawingType,DrawingType));this.DrawingType=DrawingType};ParaDrawing.prototype.Set_WrappingType=function(WrapType){History.Add(new CChangesParaDrawingWrappingType(this,this.wrappingType,WrapType));this.wrappingType=WrapType};ParaDrawing.prototype.Set_Distance=function(L,T,R,B){var oDistance=this.Get_Distance();if(!AscFormat.isRealNumber(L))L=oDistance.L;if(!AscFormat.isRealNumber(T))T=oDistance.T;if(!AscFormat.isRealNumber(R))R=
oDistance.R;if(!AscFormat.isRealNumber(B))B=oDistance.B;History.Add(new CChangesParaDrawingDistance(this,{Left:this.Distance.L,Top:this.Distance.T,Right:this.Distance.R,Bottom:this.Distance.B},{Left:L,Top:T,Right:R,Bottom:B}));this.Distance.L=L;this.Distance.R=R;this.Distance.T=T;this.Distance.B=B};ParaDrawing.prototype.Set_AllowOverlap=function(AllowOverlap){History.Add(new CChangesParaDrawingAllowOverlap(this,this.AllowOverlap,AllowOverlap));this.AllowOverlap=AllowOverlap};ParaDrawing.prototype.Set_PositionH=
function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionH(this,{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionH.RelativeFrom=RelativeFrom;this.PositionH.Align=
Align;this.PositionH.Value=_Value;this.PositionH.Percent=_Percent};ParaDrawing.prototype.Set_PositionV=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionV(this,{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent},{RelativeFrom:RelativeFrom,
Align:Align,Value:_Value,Percent:_Percent}));this.PositionV.RelativeFrom=RelativeFrom;this.PositionV.Align=Align;this.PositionV.Value=_Value;this.PositionV.Percent=_Percent};ParaDrawing.prototype.GetPositionH=function(){return{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent}};ParaDrawing.prototype.GetPositionV=function(){return{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,
Percent:this.PositionV.Percent}};ParaDrawing.prototype.Set_BehindDoc=function(BehindDoc){History.Add(new CChangesParaDrawingBehindDoc(this,this.behindDoc,BehindDoc));this.behindDoc=BehindDoc};ParaDrawing.prototype.Set_GraphicObject=function(graphicObject){var oldId=AscCommon.isRealObject(this.GraphicObj)?this.GraphicObj.Get_Id():null;var newId=AscCommon.isRealObject(graphicObject)?graphicObject.Get_Id():null;History.Add(new CChangesParaDrawingGraphicObject(this,oldId,newId));if(graphicObject)graphicObject.handleUpdateExtents();
this.GraphicObj=graphicObject};ParaDrawing.prototype.setSimplePos=function(use,x,y){History.Add(new CChangesParaDrawingSimplePos(this,{Use:this.SimplePos.Use,X:this.SimplePos.X,Y:this.SimplePos.Y},{Use:use,X:x,Y:y}));this.SimplePos.Use=use;this.SimplePos.X=x;this.SimplePos.Y=y};ParaDrawing.prototype.setExtent=function(extX,extY){History.Add(new CChangesParaDrawingExtent(this,{W:this.Extent.W,H:this.Extent.H},{W:extX,H:extY}));this.Extent.W=extX;this.Extent.H=extY};ParaDrawing.prototype.addWrapPolygon=
function(wrapPolygon){History.Add(new CChangesParaDrawingWrapPolygon(this,this.wrappingPolygon,wrapPolygon));this.wrappingPolygon=wrapPolygon};ParaDrawing.prototype.Set_Locked=function(bLocked){History.Add(new CChangesParaDrawingLocked(this,this.Locked,bLocked));this.Locked=bLocked};ParaDrawing.prototype.Set_RelativeHeight=function(nRelativeHeight){History.Add(new CChangesParaDrawingRelativeHeight(this,this.RelativeHeight,nRelativeHeight));this.Set_RelativeHeight2(nRelativeHeight)};ParaDrawing.prototype.Set_RelativeHeight2=
function(nRelativeHeight){this.RelativeHeight=nRelativeHeight;if(this.graphicObjects&&AscFormat.isRealNumber(nRelativeHeight)&&nRelativeHeight>this.graphicObjects.maximalGraphicObjectZIndex)this.graphicObjects.maximalGraphicObjectZIndex=nRelativeHeight};ParaDrawing.prototype.setEffectExtent=function(L,T,R,B){var oEE=this.EffectExtent;History.Add(new CChangesParaDrawingEffectExtent(this,{L:oEE.L,T:oEE.T,R:oEE.R,B:oEE.B},{L:L,T:T,R:R,B:B}));this.EffectExtent.L=L;this.EffectExtent.T=T;this.EffectExtent.R=
R;this.EffectExtent.B=B};ParaDrawing.prototype.Set_Parent=function(oParent){History.Add(new CChangesParaDrawingParent(this,this.Parent,oParent));this.Parent=oParent};ParaDrawing.prototype.IsWatermark=function(){if(!this.GraphicObj)return false;if(this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_Shape&&this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ImageShape)return false;if(this.Is_Inline())return false;var oParagraph=this.GetParagraph();if(!(oParagraph instanceof Paragraph))return false;
var oContent=oParagraph.Parent;if(!oContent||oContent.Is_DrawingShape(false))return false;var oHdrFtr=oContent.IsHdrFtr(true);if(!oHdrFtr)return false;var oRun=this.Get_Run();if(!oRun)return false;var arrDocPos=oRun.GetDocumentPositionFromObject();for(var nIndex=0,nCount=arrDocPos.length;nIndex<nCount;++nIndex){var oClass=arrDocPos[nIndex].Class;var oSdt=null;if(oClass instanceof CDocumentContent&&oClass.Parent instanceof CBlockLevelSdt)oSdt=oClass.Parent;else if(oClass instanceof CInlineLevelSdt)oSdt=
oClass;if(oSdt){var oPr=oSdt.Pr;if(AscCommon.isRealObject(oPr)&&AscCommon.isRealObject(oPr.DocPartObj)&&oPr.DocPartObj.Gallery==="Watermarks")return true}}return false};ParaDrawing.prototype.Set_ParaMath=function(ParaMath){History.Add(new CChangesParaDrawingParaMath(this,this.ParaMath,ParaMath));this.ParaMath=ParaMath};ParaDrawing.prototype.Set_LayoutInCell=function(LayoutInCell){if(this.LayoutInCell===LayoutInCell)return;History.Add(new CChangesParaDrawingLayoutInCell(this,this.LayoutInCell,LayoutInCell));
this.LayoutInCell=LayoutInCell};ParaDrawing.prototype.SetSizeRelH=function(oSize){History.Add(new CChangesParaDrawingSizeRelH(this,this.SizeRelH,oSize));this.SizeRelH=oSize};ParaDrawing.prototype.SetSizeRelV=function(oSize){History.Add(new CChangesParaDrawingSizeRelV(this,this.SizeRelV,oSize));this.SizeRelV=oSize};ParaDrawing.prototype.getXfrmExtX=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&
AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX))return this.GraphicObj.spPr.xfrm.extX;if(AscFormat.isRealNumber(this.Extent.W))return this.Extent.W;return 0};ParaDrawing.prototype.getXfrmExtY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY))return this.GraphicObj.spPr.xfrm.extY;if(AscFormat.isRealNumber(this.Extent.H))return this.Extent.H;
return 0};ParaDrawing.prototype.getXfrmRot=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))return this.GraphicObj.spPr.xfrm.rot;return 0};ParaDrawing.prototype.Get_Bounds=function(){var InsL,InsT,InsR,InsB;InsL=0;InsT=0;InsR=0;InsB=0;if(!this.Is_Inline()){var oDistance=this.Get_Distance();if(oDistance){InsL=oDistance.L;InsT=oDistance.T;InsR=
oDistance.R;InsB=oDistance.B}}var ExtX=this.getXfrmExtX();var ExtY=this.getXfrmExtY();var Rot=this.getXfrmRot();var X,Y,W,H;if(AscFormat.checkNormalRotate(Rot)){X=this.X;Y=this.Y;W=ExtX;H=ExtY}else{X=this.X+ExtX/2-ExtY/2;Y=this.Y+ExtY/2-ExtX/2;W=ExtY;H=ExtX}return{Left:X-this.EffectExtent.L-InsL,Top:Y-this.EffectExtent.T-InsT,Bottom:Y+H+this.EffectExtent.B+InsB,Right:X+W+this.EffectExtent.R+InsR}};ParaDrawing.prototype.Search=function(Str,Props,SearchEngine,Type){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.Search==="function")this.GraphicObj.Search(Str,Props,SearchEngine,Type)};ParaDrawing.prototype.Set_Props=function(Props){var bCheckWrapPolygon=false;var isPictureCC=false;var oRun=this.GetRun();if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=0,nCount=arrContentControls.length;nIndex<nCount;++nIndex)if(arrContentControls[nIndex].IsPicture()){isPictureCC=true;break}}if(undefined!=Props.WrappingStyle&&!isPictureCC){if(drawing_Inline===this.DrawingType&&
c_oAscWrapStyle2.Inline!=Props.WrappingStyle&&undefined===Props.Paddings)this.Set_Distance(3.2,0,3.2,0);this.Set_DrawingType(c_oAscWrapStyle2.Inline===Props.WrappingStyle?drawing_Inline:drawing_Anchor);if(c_oAscWrapStyle2.Inline===Props.WrappingStyle)if(AscCommon.isRealObject(this.GraphicObj.bounds)&&AscFormat.isRealNumber(this.GraphicObj.bounds.w)&&AscFormat.isRealNumber(this.GraphicObj.bounds.h))this.CheckWH();if(c_oAscWrapStyle2.Behind===Props.WrappingStyle||c_oAscWrapStyle2.InFront===Props.WrappingStyle){this.Set_WrappingType(WRAPPING_TYPE_NONE);
this.Set_BehindDoc(c_oAscWrapStyle2.Behind===Props.WrappingStyle?true:false)}else{switch(Props.WrappingStyle){case c_oAscWrapStyle2.Square:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);break;case c_oAscWrapStyle2.Tight:{bCheckWrapPolygon=true;this.Set_WrappingType(WRAPPING_TYPE_TIGHT);break}case c_oAscWrapStyle2.Through:{this.Set_WrappingType(WRAPPING_TYPE_THROUGH);bCheckWrapPolygon=true;break}case c_oAscWrapStyle2.TopAndBottom:this.Set_WrappingType(WRAPPING_TYPE_TOP_AND_BOTTOM);break;default:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);
break}this.Set_BehindDoc(false)}}if(undefined!=Props.Paddings)this.Set_Distance(Props.Paddings.Left,Props.Paddings.Top,Props.Paddings.Right,Props.Paddings.Bottom);if(undefined!=Props.AllowOverlap)this.Set_AllowOverlap(Props.AllowOverlap);if(undefined!=Props.PositionH)this.Set_PositionH(Props.PositionH.RelativeFrom,Props.PositionH.UseAlign,true===Props.PositionH.UseAlign?Props.PositionH.Align:Props.PositionH.Value,Props.PositionH.Percent);if(undefined!=Props.PositionV)this.Set_PositionV(Props.PositionV.RelativeFrom,
Props.PositionV.UseAlign,true===Props.PositionV.UseAlign?Props.PositionV.Align:Props.PositionV.Value,Props.PositionV.Percent);if(undefined!=Props.SizeRelH)this.SetSizeRelH({RelativeFrom:AscFormat.ConvertRelPositionHToRelSize(Props.SizeRelH.RelativeFrom),Percent:Props.SizeRelH.Value/100});if(undefined!=Props.SizeRelV)this.SetSizeRelV({RelativeFrom:AscFormat.ConvertRelPositionVToRelSize(Props.SizeRelV.RelativeFrom),Percent:Props.SizeRelV.Value/100});if(this.SizeRelH&&!this.SizeRelV)this.SetSizeRelV({RelativeFrom:AscCommon.c_oAscSizeRelFromV.sizerelfromvPage,
Percent:0});if(this.SizeRelV&&!this.SizeRelH)this.SetSizeRelH({RelativeFrom:AscCommon.c_oAscSizeRelFromH.sizerelfromhPage,Percent:0});if(bCheckWrapPolygon)this.Check_WrapPolygon();if(undefined!=Props.description)this.docPr.setDescr(Props.description);if(undefined!=Props.title)this.docPr.setTitle(Props.title)};ParaDrawing.prototype.CheckWH=function(){if(!this.GraphicObj)return;var oldExtW=this.Extent.W;var oldExtH=this.Extent.H;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&
AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){this.Extent.W=this.GraphicObj.spPr.xfrm.extX;this.Extent.H=this.GraphicObj.spPr.xfrm.extY}this.GraphicObj.recalculate();this.Extent.W=oldExtW;this.Extent.H=oldExtH;var extX,extY,rot;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm){if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){extX=this.GraphicObj.spPr.xfrm.extX;extY=this.GraphicObj.spPr.xfrm.extY}else{extX=5;extY=5}if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))rot=
this.GraphicObj.spPr.xfrm.rot;else rot=0}else{extX=5;extY=5;rot=0}this.setExtent(extX,extY);var EEL=0,EET=0,EER=0,EEB=0;{var xc=this.GraphicObj.localTransform.TransformPointX(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var yc=this.GraphicObj.localTransform.TransformPointY(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var oBounds=this.GraphicObj.bounds;var LineCorrect=0;if(this.GraphicObj.pen&&this.GraphicObj.pen.Fill&&this.GraphicObj.pen.Fill.fill){LineCorrect=this.GraphicObj.pen.w==null?12700:
parseInt(this.GraphicObj.pen.w);LineCorrect/=72E3}var l=oBounds.x;var r=l+oBounds.w;var t=oBounds.y;var b=t+oBounds.h;var startX,startY;if(!AscFormat.checkNormalRotate(rot)){var temp=extX;extX=extY;extY=temp}startX=xc-extX/2;startY=yc-extY/2;if(l>startX)l=startX;if(r<startX+extX)r=startX+extX;if(t>startY)t=startY;if(b<startY+extY)b=startY+extY;EEL=xc-extX/2-l+LineCorrect;EET=yc-extY/2-t+LineCorrect;EER=r+LineCorrect-(xc+extX/2);EEB=b+LineCorrect-(yc+extY/2)}this.setEffectExtent(EEL,EET,EER,EEB);this.Check_WrapPolygon()};
ParaDrawing.prototype.Check_WrapPolygon=function(){if((this.wrappingType===WRAPPING_TYPE_TIGHT||this.wrappingType===WRAPPING_TYPE_THROUGH)&&this.wrappingPolygon&&!this.wrappingPolygon.edited){this.GraphicObj.recalculate();this.wrappingPolygon.setArrRelPoints(this.wrappingPolygon.calculate(this.GraphicObj))}};ParaDrawing.prototype.Draw=function(X,Y,pGraphics,PDSE){var nPageIndex=null;if(AscCommon.isRealObject(PDSE))nPageIndex=PDSE.Page;if(pGraphics.Start_Command){pGraphics.m_aDrawings.push(new AscFormat.ParaDrawingStruct(undefined,
this));return}if(this.Is_Inline()){pGraphics.shapePageIndex=nPageIndex;this.draw(pGraphics,PDSE);pGraphics.shapePageIndex=null}if(pGraphics.End_Command)pGraphics.End_Command()};ParaDrawing.prototype.Measure=function(){if(!this.GraphicObj){this.Width=0;this.Height=0;return}if(AscFormat.isRealNumber(this.Extent.W)&&AscFormat.isRealNumber(this.Extent.H)&&(!this.GraphicObj.checkAutofit||!this.GraphicObj.checkAutofit())&&!this.SizeRelH&&!this.SizeRelV){var oEffectExtent=this.EffectExtent;var W,H;if(AscFormat.isRealNumber(this.GraphicObj.rot))if(AscFormat.checkNormalRotate(this.GraphicObj.rot)){W=
this.Extent.W;H=this.Extent.H}else{W=this.Extent.H;H=this.Extent.W}else{W=this.Extent.W;H=this.Extent.H}this.Width=W+AscFormat.getValOrDefault(oEffectExtent.L,0)+AscFormat.getValOrDefault(oEffectExtent.R,0);this.Height=H+AscFormat.getValOrDefault(oEffectExtent.T,0)+AscFormat.getValOrDefault(oEffectExtent.B,0);this.WidthVisible=this.Width}else{this.GraphicObj.recalculate();if(this.GraphicObj.recalculateText)this.GraphicObj.recalculateText();if(this.PositionH.UseAlign||this.Is_Inline())this.Width=this.GraphicObj.bounds.w;
else this.Width=this.GraphicObj.extX;this.WidthVisible=this.Width;if(this.PositionV.UseAlign||this.Is_Inline())this.Height=this.GraphicObj.bounds.h;else this.Height=this.GraphicObj.extY}};ParaDrawing.prototype.SaveRecalculateObject=function(Copy){var DrawingObj={};DrawingObj.Type=this.Type;DrawingObj.DrawingType=this.DrawingType;DrawingObj.WrappingType=this.wrappingType;if(drawing_Anchor===this.Get_DrawingType()&&true===this.Use_TextWrap()){var oDistance=this.Get_Distance();DrawingObj.FlowPos={X:this.X-
oDistance.L,Y:this.Y-oDistance.T,W:this.Width+oDistance.R,H:this.Height+oDistance.B}}DrawingObj.PageNum=this.PageNum;DrawingObj.X=this.X;DrawingObj.Y=this.Y;DrawingObj.spRecaclcObject=this.GraphicObj.getRecalcObject();return DrawingObj};ParaDrawing.prototype.LoadRecalculateObject=function(RecalcObj){this.updatePosition3(RecalcObj.PageNum,RecalcObj.X,RecalcObj.Y);this.GraphicObj.setRecalcObject(RecalcObj.spRecaclcObject)};ParaDrawing.prototype.Reassign_ImageUrls=function(mapUrls){if(this.GraphicObj)this.GraphicObj.Reassign_ImageUrls(mapUrls)};
ParaDrawing.prototype.PrepareRecalculateObject=function(){};ParaDrawing.prototype.Is_RealContent=function(){return true};ParaDrawing.prototype.Can_AddNumbering=function(){if(drawing_Inline===this.DrawingType)return true;return false};ParaDrawing.prototype.Copy=function(oPr){var c=new ParaDrawing(this.Extent.W,this.Extent.H,null,editor.WordControl.m_oLogicDocument.DrawingDocument,null,null);c.Set_DrawingType(this.DrawingType);if(AscCommon.isRealObject(this.GraphicObj)){var oCopyPr=new AscFormat.CCopyObjectProperties;
oCopyPr.contentCopyPr=oPr;c.Set_GraphicObject(this.GraphicObj.copy(oCopyPr));c.GraphicObj.setParent(c)}var d=this.Distance;c.Set_PositionH(this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent);c.Set_PositionV(this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);c.Set_Distance(d.L,d.T,d.R,d.B);c.Set_AllowOverlap(this.AllowOverlap);c.Set_WrappingType(this.wrappingType);if(this.wrappingPolygon)c.wrappingPolygon.fromOther(this.wrappingPolygon);
c.Set_BehindDoc(this.behindDoc);c.Set_RelativeHeight(this.RelativeHeight);if(this.SizeRelH)c.SetSizeRelH({RelativeFrom:this.SizeRelH.RelativeFrom,Percent:this.SizeRelH.Percent});if(this.SizeRelV)c.SetSizeRelV({RelativeFrom:this.SizeRelV.RelativeFrom,Percent:this.SizeRelV.Percent});if(AscFormat.isRealNumber(this.Extent.W)&&AscFormat.isRealNumber(this.Extent.H))c.setExtent(this.Extent.W,this.Extent.H);var EE=this.EffectExtent;if(EE.L>0||EE.T>0||EE.R>0||EE.B>0)c.setEffectExtent(EE.L,EE.T,EE.R,EE.B);
c.docPr.setFromOther(this.docPr);if(this.ParaMath)c.Set_ParaMath(this.ParaMath.Copy());return c};ParaDrawing.prototype.IsEqual=function(oElement){return false};ParaDrawing.prototype.Get_Id=function(){return this.Id};ParaDrawing.prototype.GetId=function(){return this.Id};ParaDrawing.prototype.setParagraphTabs=function(tabs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphTabs==="function")this.GraphicObj.setParagraphTabs(tabs)};ParaDrawing.prototype.IsMovingTableBorder=
function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.IsMovingTableBorder==="function")return this.GraphicObj.IsMovingTableBorder();return false};ParaDrawing.prototype.SetVerticalClip=function(Top,Bottom){this.LineTop=Top;this.LineBottom=Bottom};ParaDrawing.prototype.Update_Position=function(Paragraph,ParaLayout,PageLimits,PageLimitsOrigin,LineNum){if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom2;this.PositionH.Align=this.PositionH_Old.Align2;
this.PositionH.Value=this.PositionH_Old.Value2;this.PositionH.Percent=this.PositionH_Old.Percent2}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom2;this.PositionV.Align=this.PositionV_Old.Align2;this.PositionV.Value=this.PositionV_Old.Value2;this.PositionV.Percent=this.PositionV_Old.Percent2}var oDocumentContent=this.Parent&&this.Parent.Parent;if(oDocumentContent&&oDocumentContent.IsBlockLevelSdtContent())oDocumentContent=oDocumentContent.Parent.Parent;
this.Parent=Paragraph;this.DocumentContent=oDocumentContent;var PageNum=ParaLayout.PageNum;var OtherFlowObjects=editor.WordControl.m_oLogicDocument.DrawingObjects.getAllFloatObjectsOnPage(PageNum,this.Parent.Parent);var bInline=this.Is_Inline();this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,ParaLayout,PageLimits);this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent);
this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);var bCorrect=false;if(oDocumentContent&&oDocumentContent.IsTableCellContent&&oDocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(bInline,PageLimits,this.AllowOverlap,this.Use_TextWrap(),OtherFlowObjects,
bCorrect);this.GraphicObj.bounds.l=this.GraphicObj.bounds.x+this.Internal_Position.CalcX;this.GraphicObj.bounds.r=this.GraphicObj.bounds.x+this.GraphicObj.bounds.w+this.Internal_Position.CalcX;this.GraphicObj.bounds.t=this.GraphicObj.bounds.y+this.Internal_Position.CalcY;this.GraphicObj.bounds.b=this.GraphicObj.bounds.y+this.GraphicObj.bounds.h+this.Internal_Position.CalcY;var OldPageNum=this.PageNum;this.PageNum=PageNum;this.LineNum=LineNum;this.X=this.Internal_Position.CalcX;this.Y=this.Internal_Position.CalcY;
if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom;this.PositionH.Align=this.PositionH_Old.Align;this.PositionH.Value=this.PositionH_Old.Value;this.PositionH.Percent=this.PositionH_Old.Percent;var Value=this.Internal_Position.Calculate_X_Value(this.PositionH_Old.RelativeFrom);this.Set_PositionH(this.PositionH_Old.RelativeFrom,false,Value,false);this.X=this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,
this.PositionH.Percent)}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom;this.PositionV.Align=this.PositionV_Old.Align;this.PositionV.Value=this.PositionV_Old.Value;this.PositionV.Percent=this.PositionV_Old.Percent;var Value=this.Internal_Position.Calculate_Y_Value(this.PositionV_Old.RelativeFrom);this.Set_PositionV(this.PositionV_Old.RelativeFrom,false,Value,false);this.Y=this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,
this.PositionV.Value,this.PositionV.Percent)}this.OrigX=this.X;this.OrigY=this.Y;this.ShiftX=0;this.ShiftY=0;this.updatePosition3(this.PageNum,this.X,this.Y,OldPageNum);this.useWrap=this.Use_TextWrap()};ParaDrawing.prototype.GetClipRect=function(){if(this.Is_Inline()||this.Use_TextWrap()){var oCell;if(this.DocumentContent&&(oCell=this.DocumentContent.IsTableCellContent(true))){var arrPages=oCell.GetCurPageByAbsolutePage(this.PageNum);for(var nIndex=0,nCount=arrPages.length;nIndex<nCount;++nIndex){var oPageBounds=
oCell.GetPageBounds(arrPages[nIndex]);if(this.GraphicObj.bounds.isIntersect(oPageBounds.Left,oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom))return new AscFormat.CGraphicBounds(oPageBounds.Left,oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom)}}}return null};ParaDrawing.prototype.Update_PositionYHeaderFooter=function(TopMarginY,BottomMarginY){this.Internal_Position.Update_PositionYHeaderFooter(TopMarginY,BottomMarginY);this.Internal_Position.Calculate_Y(this.Is_Inline(),this.PositionV.RelativeFrom,
this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);this.OrigY=this.Internal_Position.CalcY;this.Y=this.OrigY+this.ShiftY;this.updatePosition3(this.PageNum,this.X,this.Y,this.PageNum)};ParaDrawing.prototype.Reset_SavedPosition=function(){this.PositionV_Old=undefined;this.PositionH_Old=undefined};ParaDrawing.prototype.setParagraphBorders=function(val){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphBorders==="function")this.GraphicObj.setParagraphBorders(val)};
ParaDrawing.prototype.deselect=function(){this.selected=false;if(this.GraphicObj&&this.GraphicObj.deselect)this.GraphicObj.deselect()};ParaDrawing.prototype.updatePosition3=function(pageIndex,x,y,oldPageNum){var _x=x,_y=y;this.graphicObjects.removeById(pageIndex,this.Get_Id());if(AscFormat.isRealNumber(oldPageNum))this.graphicObjects.removeById(oldPageNum,this.Get_Id());var bChangePageIndex=this.pageIndex!==pageIndex;this.setPageIndex(pageIndex);if(typeof this.GraphicObj.setStartPage==="function"){var bIsHfdFtr=
this.DocumentContent&&this.DocumentContent.IsHdrFtr();this.GraphicObj.setStartPage(pageIndex,bIsHfdFtr,bIsHfdFtr||bChangePageIndex)}if(!(this.DocumentContent&&this.DocumentContent.IsHdrFtr()&&this.DocumentContent.Get_StartPage_Absolute()!==pageIndex)){this.graphicObjects.addObjectOnPage(pageIndex,this.GraphicObj);this.bNoNeedToAdd=false}else this.bNoNeedToAdd=true;if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.GraphicObj.posX)&&AscFormat.isRealNumber(this.GraphicObj.posY))||
!(Math.abs(this.GraphicObj.posX-_x)<MOVE_DELTA&&Math.abs(this.GraphicObj.posY-_y)<MOVE_DELTA))this.GraphicObj.updatePosition(_x,_y);if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.wrappingPolygon.posX)&&AscFormat.isRealNumber(this.wrappingPolygon.posY))||!(Math.abs(this.wrappingPolygon.posX-_x)<MOVE_DELTA&&Math.abs(this.wrappingPolygon.posY-_y)<MOVE_DELTA))this.wrappingPolygon.updatePosition(_x,_y);this.calculateSnapArrays()};ParaDrawing.prototype.calculateAfterChangeTheme=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.calculateAfterChangeTheme==="function")this.GraphicObj.calculateAfterChangeTheme()};ParaDrawing.prototype.selectionIsEmpty=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.selectionIsEmpty==="function")return this.GraphicObj.selectionIsEmpty();return false};ParaDrawing.prototype.recalculateDocContent=function(){};ParaDrawing.prototype.Shift=function(Dx,Dy){this.ShiftX=Dx;this.ShiftY=Dy;this.X=this.OrigX+Dx;this.Y=this.OrigY+Dy;this.updatePosition3(this.PageNum,
this.X,this.Y)};ParaDrawing.prototype.IsLayoutInCell=function(){if(this.LogicDocument&&this.LogicDocument.GetCompatibilityMode()>=AscCommon.document_compatibility_mode_Word15)return true;return this.LayoutInCell};ParaDrawing.prototype.Get_Distance=function(){var oDist=this.Distance;return new AscFormat.CDistance(AscFormat.getValOrDefault(oDist.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.T,0),AscFormat.getValOrDefault(oDist.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.B,
0))};ParaDrawing.prototype.Set_XYForAdd=function(X,Y,NearPos,PageNum){if(null!==NearPos){var Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,true,true);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.TurnOff_InterfaceEvents();oLogicDocument.Recalculate();oLogicDocument.TurnOn_InterfaceEvents(false);this.SetSkipOnRecalculate(false)}if(null!==
nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,true,true)}};ParaDrawing.prototype.SetSkipOnRecalculate=function(isSkip){this.SkipOnRecalculate=isSkip};ParaDrawing.prototype.IsSkipOnRecalculate=function(){return this.SkipOnRecalculate};ParaDrawing.prototype.Set_XY=function(X,Y,Paragraph,PageNum,bResetAlign){if(Paragraph){var PageNumOld=this.PageNum;var ContentPos=
Paragraph.Get_DrawingObjectContentPos(this.Get_Id());if(null===ContentPos)return;var Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.Recalculate();this.SetSkipOnRecalculate(false)}if(null!==
nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);if(!this.LogicDocument||null===this.LogicDocument.FullRecalc.Id||PageNum<this.LogicDocument.FullRecalc.PageIndex&&PageNumOld<this.LogicDocument.FullRecalc.PageIndex)Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false)}};ParaDrawing.prototype.private_SetXYByLayout=function(X,Y,PageNum,
Layout,bChangeX,bChangeY){if(!Layout)return;this.PageNum=PageNum;this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,Layout.ParagraphLayout,Layout.PageLimitsOrigin);this.Internal_Position.Calculate_X(false,c_oAscRelativeFromH.Page,false,X-Layout.PageLimitsOrigin.X,false);this.Internal_Position.Calculate_Y(false,c_oAscRelativeFromV.Page,false,Y-Layout.PageLimitsOrigin.Y,false);var bCorrect=false;if(this.DocumentContent&&this.DocumentContent.IsTableCellContent&&
this.DocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(false,Layout.PageLimits,this.AllowOverlap,this.Use_TextWrap(),[],bCorrect);if(true===bChangeX){this.X=this.Internal_Position.CalcX;var ValueX=this.Internal_Position.Calculate_X_Value(this.PositionH.RelativeFrom);this.Set_PositionH(this.PositionH.RelativeFrom,false,ValueX,false);
this.X=this.Internal_Position.Calculate_X(false,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(true===bChangeY){this.Y=this.Internal_Position.CalcY;var ValueY=this.Internal_Position.Calculate_Y_Value(this.PositionV.RelativeFrom);this.Set_PositionV(this.PositionV.RelativeFrom,false,ValueY,false);this.Y=this.Internal_Position.Calculate_Y(false,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}};ParaDrawing.prototype.Get_DrawingType=
function(){return this.DrawingType};ParaDrawing.prototype.Is_Inline=function(){if(this.Parent&&this.Parent.Get_ParentTextTransform&&this.Parent.Get_ParentTextTransform())return true;return drawing_Inline===this.DrawingType?true:false};ParaDrawing.prototype.IsInline=function(){return this.Is_Inline()};ParaDrawing.prototype.Use_TextWrap=function(){if(!this.Parent||!this.Parent.Get_FramePr||null!==this.Parent.Get_FramePr()&&undefined!==this.Parent.Get_FramePr())return false;return drawing_Anchor===this.DrawingType&&
!(this.wrappingType===WRAPPING_TYPE_NONE)};ParaDrawing.prototype.IsUseTextWrap=function(){return this.Use_TextWrap()};ParaDrawing.prototype.Draw_Selection=function(){var Padding=this.DrawingDocument.GetMMPerDot(6);var extX,extY;if(this.GraphicObj){extX=this.GraphicObj.extX;extY=this.GraphicObj.extY}else{extX=this.getXfrmExtX();extY=this.getXfrmExtY()}var rot=this.getXfrmRot();if(AscFormat.checkNormalRotate(rot))this.DrawingDocument.AddPageSelection(this.PageNum,this.X-this.EffectExtent.L-Padding,
this.Y-this.EffectExtent.T-Padding,this.EffectExtent.L+extX+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extY+this.EffectExtent.B+2*Padding);else this.DrawingDocument.AddPageSelection(this.PageNum,this.X+extX/2-extY/2-this.EffectExtent.L-Padding,this.Y+extY/2-extX/2-this.EffectExtent.T-Padding,this.EffectExtent.L+extY+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extX+this.EffectExtent.B+2*Padding)};ParaDrawing.prototype.CanInsertToPos=function(oAnchorPos){if(!oAnchorPos||!oAnchorPos.Paragraph||
!oAnchorPos.Paragraph.Parent)return false;return!((this.IsShape()||this.IsGroup())&&(true===oAnchorPos.Paragraph.Parent.Is_DrawingShape()||true===oAnchorPos.Paragraph.Parent.IsFootnote()))};ParaDrawing.prototype.OnEnd_MoveInline=function(NearPos){if(!this.Parent)return;NearPos.Paragraph.Check_NearestPos(NearPos);var oRun=this.GetRun();var oPictureCC=false;if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=
arrContentControls[nIndex];break}}var oDstRun=null;var arrClasses=NearPos.Paragraph.GetClassesByPos(NearPos.ContentPos);for(var nIndex=arrClasses.length-1;nIndex>=0;--nIndex)if(arrClasses[nIndex]instanceof ParaRun){oDstRun=arrClasses[nIndex];break}if(!oDstRun||oPictureCC&&oDstRun===oRun||oDstRun.GetParentForm()){NearPos.Paragraph.Clear_NearestPosArray();return}var NewParaDrawing=this.Copy();var RunPr=this.Remove_FromDocument(false);this.DocumentContent.Select_DrawingObject(NewParaDrawing.GetId());
NewParaDrawing.Add_ToDocument(NearPos,true,RunPr,undefined,oPictureCC)};ParaDrawing.prototype.Get_ParentTextTransform=function(){if(this.Parent)return this.Parent.Get_ParentTextTransform();return null};ParaDrawing.prototype.GoTo_Text=function(bBefore,bUpdateStates){var Paragraph=this.Get_ParentParagraph();if(Paragraph){Paragraph.MoveCursorToDrawing(this.Id,bBefore);Paragraph.Document_SetThisElementCurrent(undefined===bUpdateStates?true:bUpdateStates)}};ParaDrawing.prototype.Remove_FromDocument=function(bRecalculate){var oResult=
null;if(!this.Parent)return oResult;var oRun=this.Parent.Get_DrawingObjectRun(this.Id);if(oRun){var oGrObject=this.GraphicObj;if(oGrObject&&oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine)oGrObject.setSignature(oGrObject.signatureLine);var oPictureCC=null;var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}if(oPictureCC)oPictureCC.RemoveContentControlWrapper();
oRun.Remove_DrawingObject(this.Id);if(oRun.IsInHyperlink())oResult=new CTextPr;else oResult=oRun.GetTextPr();if(oGrObject&&oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine){editor.sendEvent("asc_onRemoveSignature",oGrObject.signatureLine.id);oGrObject.setSignature(oGrObject.signatureLine)}}if(false!=bRecalculate)editor.WordControl.m_oLogicDocument.Recalculate();return oResult};ParaDrawing.prototype.Get_ParentParagraph=function(){if(this.Parent instanceof Paragraph)return this.Parent;
if(this.Parent instanceof ParaRun)return this.Parent.Paragraph;if(this.Parent&&this.Parent.GetParagraph())return this.Parent.GetParagraph();return null};ParaDrawing.prototype.SelectAsText=function(){var oParagraph=this.GetParagraph();var oRun=this.GetRun();if(!oParagraph||!oRun)return;var oDocument=oParagraph.GetLogicDocument();if(!oDocument)return;oDocument.RemoveSelection();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this));var oStartPos=oDocument.GetContentPosition(false);
oRun.SetCursorPosition(oRun.GetElementPosition(this)+1);var oEndPos=oDocument.GetContentPosition(false);oDocument.RemoveSelection();oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};ParaDrawing.prototype.Add_ToDocument=function(NearPos,bRecalculate,RunPr,Run,oPictureCC){NearPos.Paragraph.Check_NearestPos(NearPos);var LogicDocument=this.DrawingDocument.m_oLogicDocument;var Para=new Paragraph(this.DrawingDocument,LogicDocument);var DrawingRun=new ParaRun(Para);DrawingRun.Add_ToContent(0,
this);if(RunPr)DrawingRun.Set_Pr(RunPr.Copy());if(Run)DrawingRun.SetReviewTypeWithInfo(Run.GetReviewType(),Run.GetReviewInfo());if(oPictureCC){var oSdt=new CInlineLevelSdt;oSdt.SetPicturePr(true);oSdt.ReplacePlaceHolderWithContent();oSdt.AddToContent(0,DrawingRun);Para.Add_ToContent(0,oSdt);var oFormPr=oPictureCC.GetFormPr();if(oFormPr)oSdt.SetFormPr(oFormPr.Copy())}else Para.Add_ToContent(0,DrawingRun);var SelectedElement=new CSelectedElement(Para,false);var SelectedContent=new CSelectedContent;
SelectedContent.Add(SelectedElement);SelectedContent.SetMoveDrawing(true);SelectedContent.DrawingObjects.push(this);NearPos.Paragraph.Parent.InsertContent(SelectedContent,NearPos);NearPos.Paragraph.Clear_NearestPosArray();NearPos.Paragraph.Correct_Content();this.Set_Parent(NearPos.Paragraph);if(false!=bRecalculate)LogicDocument.Recalculate()};ParaDrawing.prototype.Add_ToDocument2=function(Paragraph){var DrawingRun=new ParaRun(Paragraph);DrawingRun.Add_ToContent(0,this);Paragraph.Add_ToContent(0,DrawingRun);
this.Set_Parent(Paragraph)};ParaDrawing.prototype.UpdateCursorType=function(X,Y,PageIndex){this.DrawingDocument.SetCursorType("move",new AscCommon.CMouseMoveData);if(null!=this.Parent){var Lock=this.Parent.Lock;if(true===Lock.Is_Locked()){var PNum=Math.max(0,Math.min(PageIndex-this.Parent.PageNum,this.Parent.Pages.length-1));var _X=this.Parent.Pages[PNum].X;var _Y=this.Parent.Pages[PNum].Y;var MMData=new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Parent.Get_StartPage_Absolute()+
(PageIndex-this.Parent.PageNum));MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=Lock.Get_UserId();MMData.HaveChanges=Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}}};ParaDrawing.prototype.Get_AnchorPos=function(){if(!this.Parent)return null;return this.Parent.Get_AnchorPos(this)};ParaDrawing.prototype.CheckRecalcAutoFit=function(oSectPr){if(this.GraphicObj&&
this.GraphicObj.CheckNeedRecalcAutoFit)if(this.GraphicObj.CheckNeedRecalcAutoFit(oSectPr)){if(this.GraphicObj)this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.Measure()}};ParaDrawing.prototype.Get_ParentObject_or_DocumentPos=function(){if(this.Parent!=null)return this.Parent.Get_ParentObject_or_DocumentPos()};ParaDrawing.prototype.Refresh_RecalcData=function(Data){var oRun=this.GetRun();if(oRun){if(AscCommon.isRealObject(Data))switch(Data.Type){case AscDFH.historyitem_Drawing_Distance:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&
this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}case AscDFH.historyitem_Drawing_SetExtent:{oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_SetSizeRelH:case AscDFH.historyitem_Drawing_SetSizeRelV:case AscDFH.historyitem_Drawing_SetGraphicObject:{if(this.GraphicObj){this.GraphicObj.handleUpdateExtents&&this.GraphicObj.handleUpdateExtents();this.GraphicObj.addToRecalculate()}oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_WrappingType:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&
this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}}return oRun.Refresh_RecalcData2()}};ParaDrawing.prototype.Refresh_RecalcData2=function(Data){var oRun=this.GetRun();if(oRun)return oRun.Refresh_RecalcData2()};ParaDrawing.prototype.hyperlinkCheck=function(bCheck){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCheck==="function")return this.GraphicObj.hyperlinkCheck(bCheck);return null};ParaDrawing.prototype.hyperlinkCanAdd=function(bCheckInHyperlink){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkCanAdd(bCheckInHyperlink);return false};ParaDrawing.prototype.hyperlinkRemove=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkRemove();return false};ParaDrawing.prototype.hyperlinkModify=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkModify==="function")return this.GraphicObj.hyperlinkModify(HyperProps)};
ParaDrawing.prototype.hyperlinkAdd=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkAdd==="function")return this.GraphicObj.hyperlinkAdd(HyperProps)};ParaDrawing.prototype.documentStatistics=function(stat){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentStatistics==="function")this.GraphicObj.documentStatistics(stat)};ParaDrawing.prototype.documentCreateFontCharMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.documentCreateFontCharMap==="function")this.GraphicObj.documentCreateFontCharMap(fontMap)};ParaDrawing.prototype.documentCreateFontMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontMap==="function")this.GraphicObj.documentCreateFontMap(fontMap)};ParaDrawing.prototype.tableCheckSplit=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckSplit==="function")return this.GraphicObj.tableCheckSplit();
return false};ParaDrawing.prototype.tableCheckMerge=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckMerge==="function")return this.GraphicObj.tableCheckMerge();return false};ParaDrawing.prototype.tableSelect=function(Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSelect==="function")return this.GraphicObj.tableSelect(Type)};ParaDrawing.prototype.tableRemoveTable=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveTable===
"function")return this.GraphicObj.tableRemoveTable()};ParaDrawing.prototype.tableSplitCell=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSplitCell==="function")return this.GraphicObj.tableSplitCell(Cols,Rows)};ParaDrawing.prototype.tableMergeCells=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableMergeCells==="function")return this.GraphicObj.tableMergeCells(Cols,Rows)};ParaDrawing.prototype.tableRemoveCol=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.tableRemoveCol==="function")return this.GraphicObj.tableRemoveCol()};ParaDrawing.prototype.tableAddCol=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddCol==="function")return this.GraphicObj.tableAddCol(bBefore,nCount)};ParaDrawing.prototype.tableRemoveRow=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveRow==="function")return this.GraphicObj.tableRemoveRow()};ParaDrawing.prototype.tableAddRow=
function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddRow==="function")return this.GraphicObj.tableAddRow(bBefore,nCount)};ParaDrawing.prototype.getCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurrentParagraph==="function")return this.GraphicObj.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs);if(this.Parent instanceof Paragraph)return this.Parent};ParaDrawing.prototype.GetSelectedText=
function(bClearText,oPr){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetSelectedText==="function")return this.GraphicObj.GetSelectedText(bClearText,oPr);return""};ParaDrawing.prototype.getCurPosXY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurPosXY==="function")return this.GraphicObj.getCurPosXY();return{X:0,Y:0}};ParaDrawing.prototype.setParagraphKeepLines=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepLines===
"function")return this.GraphicObj.setParagraphKeepLines(Value)};ParaDrawing.prototype.setParagraphKeepNext=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepNext==="function")return this.GraphicObj.setParagraphKeepNext(Value)};ParaDrawing.prototype.setParagraphWidowControl=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphWidowControl==="function")return this.GraphicObj.setParagraphWidowControl(Value)};ParaDrawing.prototype.setParagraphPageBreakBefore=
function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphPageBreakBefore==="function")return this.GraphicObj.setParagraphPageBreakBefore(Value)};ParaDrawing.prototype.isTextSelectionUse=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.isTextSelectionUse();return false};ParaDrawing.prototype.paragraphFormatPaste=function(CopyTextPr,CopyParaPr,Bool){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.paragraphFormatPaste(CopyTextPr,CopyParaPr,Bool)};ParaDrawing.prototype.getNearestPos=function(x,y,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getNearestPos==="function")return this.GraphicObj.getNearestPos(x,y,pageIndex);return null};ParaDrawing.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.Type);Writer.WriteString2(this.Id)};ParaDrawing.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Drawing);
Writer.WriteString2(this.Id);AscFormat.writeDouble(Writer,this.Extent.W);AscFormat.writeDouble(Writer,this.Extent.H);AscFormat.writeObject(Writer,this.GraphicObj);AscFormat.writeObject(Writer,this.DocumentContent);AscFormat.writeObject(Writer,this.Parent);AscFormat.writeObject(Writer,this.wrappingPolygon);AscFormat.writeLong(Writer,this.RelativeHeight);AscFormat.writeObject(Writer,this.docPr)};ParaDrawing.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.DrawingDocument=
editor.WordControl.m_oLogicDocument.DrawingDocument;this.LogicDocument=this.DrawingDocument?this.DrawingDocument.m_oLogicDocument:null;this.Extent.W=AscFormat.readDouble(Reader);this.Extent.H=AscFormat.readDouble(Reader);this.GraphicObj=AscFormat.readObject(Reader);this.DocumentContent=AscFormat.readObject(Reader);this.Parent=AscFormat.readObject(Reader);this.wrappingPolygon=AscFormat.readObject(Reader);this.RelativeHeight=AscFormat.readLong(Reader);this.docPr=AscFormat.readObject(Reader);if(this.wrappingPolygon)this.wrappingPolygon.wordGraphicObject=
this;this.drawingDocument=editor.WordControl.m_oLogicDocument.DrawingDocument;this.document=editor.WordControl.m_oLogicDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.graphicObjects.addGraphicObject(this);g_oTableId.Add(this,this.Id)};ParaDrawing.prototype.Load_LinkData=function(){};ParaDrawing.prototype.draw=function(graphics,PDSE){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.draw==="function"){graphics.SaveGrState();var bInline=this.Is_Inline();
if(bInline&&AscCommon.isRealObject(PDSE)&&AscFormat.isRealNumber(this.LineTop)&&AscFormat.isRealNumber(this.LineBottom)&&AscCommon.isRealObject(this.GraphicObj.bounds)){var x,y,w,h;var oEffectExtent=this.EffectExtent;x=PDSE.X;y=this.LineTop;w=this.GraphicObj.bounds.r-this.GraphicObj.bounds.l+AscFormat.getValOrDefault(oEffectExtent.R,0)+AscFormat.getValOrDefault(oEffectExtent.L,0);h=this.LineBottom-this.LineTop;graphics.AddClipRect(x,y,w,h)}this.GraphicObj.draw(graphics);graphics.RestoreGrState()}};
ParaDrawing.prototype.drawAdjustments=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.drawAdjustments==="function")this.GraphicObj.drawAdjustments()};ParaDrawing.prototype.getTransformMatrix=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getTransformMatrix==="function")return this.GraphicObj.getTransformMatrix();return null};ParaDrawing.prototype.getExtensions=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getExtensions===
"function")return this.GraphicObj.getExtensions();return null};ParaDrawing.prototype.isGroup=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isGroup==="function")return this.GraphicObj.isGroup();return false};ParaDrawing.prototype.isShapeChild=function(bRetShape){if(!this.Is_Inline()||!this.DocumentContent)return bRetShape?null:false;var cur_doc_content=this.DocumentContent;var oCell;while(oCell=cur_doc_content.IsTableCellContent(true))cur_doc_content=oCell.Row.Table.Parent;
if(AscCommon.isRealObject(cur_doc_content.Parent)&&typeof cur_doc_content.Parent.getObjectType==="function"&&cur_doc_content.Parent.getObjectType()===AscDFH.historyitem_type_Shape)return bRetShape?cur_doc_content.Parent:true;return bRetShape?null:false};ParaDrawing.prototype.checkShapeChildAndGetTopParagraph=function(paragraph){var parent_paragraph=!paragraph?this.Get_ParentParagraph():paragraph;var parent_doc_content=parent_paragraph.Parent;if(parent_doc_content.Parent instanceof AscFormat.CShape)if(!parent_doc_content.Parent.group)return parent_doc_content.Parent.parent.Get_ParentParagraph();
Old,New,Color)}CChangesParaTextPrHighLight.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrHighLight.prototype.constructor=CChangesParaTextPrHighLight;CChangesParaTextPrHighLight.prototype.Type=AscDFH.historyitem_TextPr_HighLight;CChangesParaTextPrHighLight.prototype.private_SetValue=function(Value){if(this.Class.Value)this.Class.Value.HighLight=Value};CChangesParaTextPrHighLight.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;
if(undefined===this.New)nFlags|=2;else if(highlight_None===this.New)nFlags|=4;if(undefined===this.Old)nFlags|=8;else if(highlight_None===this.Old)nFlags|=16;Writer.WriteLong(nFlags);if(undefined!==this.New&&highlight_None!==this.New)this.New.Write_ToBinary(Writer);if(undefined!==this.Old&&highlight_None!==this.Old)this.Old.Write_ToBinary(Writer)};CChangesParaTextPrHighLight.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&
2)this.New=undefined;else if(nFlags&4)this.New=highlight_None;else{this.New=new CDocumentColor(0,0,0);this.New.Read_FromBinary(Reader)}if(nFlags&8)this.Old=undefined;else if(nFlags&16)this.Old=highlight_None;else{this.Old=new CDocumentColor(0,0,0);this.Old.Read_FromBinary(Reader)}};CChangesParaTextPrHighLight.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrRStyle(Class,Old,New,Color){AscDFH.CChangesBaseStringProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRStyle.prototype=
Object.create(AscDFH.CChangesBaseStringProperty.prototype);CChangesParaTextPrRStyle.prototype.constructor=CChangesParaTextPrRStyle;CChangesParaTextPrRStyle.prototype.Type=AscDFH.historyitem_TextPr_RStyle;CChangesParaTextPrRStyle.prototype.private_SetValue=function(Value){this.Class.Value.RStyle=Value};CChangesParaTextPrRStyle.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSpacing(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}
CChangesParaTextPrSpacing.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrSpacing.prototype.constructor=CChangesParaTextPrSpacing;CChangesParaTextPrSpacing.prototype.Type=AscDFH.historyitem_TextPr_Spacing;CChangesParaTextPrSpacing.prototype.private_SetValue=function(Value){this.Class.Value.Spacing=Value};CChangesParaTextPrSpacing.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrDStrikeout(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,
Class,Old,New,Color)}CChangesParaTextPrDStrikeout.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesParaTextPrDStrikeout.prototype.constructor=CChangesParaTextPrDStrikeout;CChangesParaTextPrDStrikeout.prototype.Type=AscDFH.historyitem_TextPr_DStrikeout;CChangesParaTextPrDStrikeout.prototype.private_SetValue=function(Value){this.Class.Value.DStrikeout=Value};CChangesParaTextPrDStrikeout.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrCaps(Class,
Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesParaTextPrCaps.prototype.constructor=CChangesParaTextPrCaps;CChangesParaTextPrCaps.prototype.Type=AscDFH.historyitem_TextPr_Caps;CChangesParaTextPrCaps.prototype.private_SetValue=function(Value){this.Class.Value.Caps=Value};CChangesParaTextPrCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSmallCaps(Class,
Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrSmallCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesParaTextPrSmallCaps.prototype.constructor=CChangesParaTextPrSmallCaps;CChangesParaTextPrSmallCaps.prototype.Type=AscDFH.historyitem_TextPr_SmallCaps;CChangesParaTextPrSmallCaps.prototype.private_SetValue=function(Value){this.Class.Value.SmallCaps=Value};CChangesParaTextPrSmallCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;
function CChangesParaTextPrPosition(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrPosition.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrPosition.prototype.constructor=CChangesParaTextPrPosition;CChangesParaTextPrPosition.prototype.Type=AscDFH.historyitem_TextPr_Position;CChangesParaTextPrPosition.prototype.private_SetValue=function(Value){this.Class.Value.Position=Value};CChangesParaTextPrPosition.prototype.Merge=
private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrValue(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrValue.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrValue.prototype.constructor=CChangesParaTextPrValue;CChangesParaTextPrValue.prototype.Type=AscDFH.historyitem_TextPr_Value;CChangesParaTextPrValue.prototype.private_SetValue=function(Value){this.Class.Value=Value};CChangesParaTextPrValue.prototype.private_CreateObject=
function(){return new CTextPr};CChangesParaTextPrValue.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrValue.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true;if(oChange.Type===this.Type)return false;if(!this.New)this.New=new CTextPr;switch(oChange.Type){case AscDFH.historyitem_TextPr_Bold:{this.New.Bold=oChange.New;break}case AscDFH.historyitem_TextPr_Italic:{this.New.Italic=oChange.New;break}case AscDFH.historyitem_TextPr_Strikeout:{this.New.Strikeout=
oChange.New;break}case AscDFH.historyitem_TextPr_Underline:{this.New.Underline=oChange.New;break}case AscDFH.historyitem_TextPr_FontSize:{this.New.FontSize=oChange.New;break}case AscDFH.historyitem_TextPr_Color:{this.New.Color=oChange.New;break}case AscDFH.historyitem_TextPr_VertAlign:{this.New.VertAlign=oChange.New;break}case AscDFH.historyitem_TextPr_HighLight:{this.New.HighLight=oChange.New;break}case AscDFH.historyitem_TextPr_RStyle:{this.New.RStyle=oChange.New;break}case AscDFH.historyitem_TextPr_Spacing:{this.New.Spacing=
oChange.New;break}case AscDFH.historyitem_TextPr_DStrikeout:{this.New.DStrikeout=oChange.New;break}case AscDFH.historyitem_TextPr_Caps:{this.New.Caps=oChange.New;break}case AscDFH.historyitem_TextPr_SmallCaps:{this.New.SmallCaps=oChange.New;break}case AscDFH.historyitem_TextPr_Position:{this.New.Position=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts:{this.New.RFonts=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Ascii:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Ascii=
oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.HAnsi=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_CS:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;
this.New.RFonts.Hint=oChange.New;break}case AscDFH.historyitem_TextPr_Lang:{this.New.Lang=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Bidi:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Bidi=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Val=oChange.New;break}case AscDFH.historyitem_TextPr_Unifill:{this.New.Unifill=
oChange.New;break}case AscDFH.historyitem_TextPr_FontSizeCS:{this.New.FontSizeCS=oChange.New;break}case AscDFH.historyitem_TextPr_Outline:{this.New.TextOutline=oChange.New;break}case AscDFH.historyitem_TextPr_Fill:{this.New.TextFill=oChange.New;break}}return true};function CChangesParaTextPrRFonts(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFonts.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrRFonts.prototype.constructor=
CChangesParaTextPrRFonts;CChangesParaTextPrRFonts.prototype.Type=AscDFH.historyitem_TextPr_RFonts;CChangesParaTextPrRFonts.prototype.private_SetValue=function(Value){this.Class.Value.RFonts=Value};CChangesParaTextPrRFonts.prototype.private_CreateObject=function(){return new CRFonts};CChangesParaTextPrRFonts.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrRFonts.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||
oChange.Type===AscDFH.historyitem_TextPr_Value)return false;if(!this.New)this.New=new CRFonts;switch(oChange.Type){case AscDFH.historyitem_TextPr_RFonts_Ascii:{this.New.Ascii=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{this.New.HAnsi=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_CS:{this.New.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{this.New.Hint=oChange.New;break}}return true};
function CChangesParaTextPrRFontsAscii(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsAscii.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsAscii.prototype.constructor=CChangesParaTextPrRFontsAscii;CChangesParaTextPrRFontsAscii.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Ascii;CChangesParaTextPrRFontsAscii.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===
this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsAscii.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};
CChangesParaTextPrRFontsAscii.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.Ascii=Value};CChangesParaTextPrRFontsAscii.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHAnsi(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHAnsi.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsHAnsi.prototype.constructor=CChangesParaTextPrRFontsHAnsi;CChangesParaTextPrRFontsHAnsi.prototype.Type=
AscDFH.historyitem_TextPr_RFonts_HAnsi;CChangesParaTextPrRFontsHAnsi.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsHAnsi.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=
false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsHAnsi.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.HAnsi=Value};CChangesParaTextPrRFontsHAnsi.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsCS(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsCS.prototype=
Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsCS.prototype.constructor=CChangesParaTextPrRFontsCS;CChangesParaTextPrRFontsCS.prototype.Type=AscDFH.historyitem_TextPr_RFonts_CS;CChangesParaTextPrRFontsCS.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};
CChangesParaTextPrRFontsCS.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsCS.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.CS=Value};CChangesParaTextPrRFontsCS.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;
function CChangesParaTextPrRFontsEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsEastAsia.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsEastAsia.prototype.constructor=CChangesParaTextPrRFontsEastAsia;CChangesParaTextPrRFontsEastAsia.prototype.Type=AscDFH.historyitem_TextPr_RFonts_EastAsia;CChangesParaTextPrRFontsEastAsia.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=
1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsEastAsia.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),
Index:-1}};CChangesParaTextPrRFontsEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.EastAsia=Value};CChangesParaTextPrRFontsEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHint(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHint.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrRFontsHint.prototype.constructor=CChangesParaTextPrRFontsHint;
CChangesParaTextPrRFontsHint.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Hint;CChangesParaTextPrRFontsHint.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.Hint=Value};CChangesParaTextPrRFontsHint.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrLang(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLang.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrLang.prototype.constructor=
CChangesParaTextPrLang;CChangesParaTextPrLang.prototype.Type=AscDFH.historyitem_TextPr_Lang;CChangesParaTextPrLang.prototype.private_SetValue=function(Value){this.Class.Value.Lang=Value};CChangesParaTextPrLang.prototype.private_CreateObject=function(){return new CLang};CChangesParaTextPrLang.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrLang.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(AscDFH.historyitem_TextPr_Lang===oChange.Type||
AscDFH.historyitem_TextPr_Value===oChange.Type)return false;if(!this.New)this.New=new CLang;switch(oChange.Type){case AscDFH.historyitem_TextPr_Lang_Bidi:{this.New.Bidi=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{this.New.Val=oChange.New;break}}return true};function CChangesParaTextPrLangBidi(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangBidi.prototype=
Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangBidi.prototype.constructor=CChangesParaTextPrLangBidi;CChangesParaTextPrLangBidi.prototype.Type=AscDFH.historyitem_TextPr_Lang_Bidi;CChangesParaTextPrLangBidi.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Bidi=Value};CChangesParaTextPrLangBidi.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,
Class,Old,New,Color)}CChangesParaTextPrLangEastAsia.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangEastAsia.prototype.constructor=CChangesParaTextPrLangEastAsia;CChangesParaTextPrLangEastAsia.prototype.Type=AscDFH.historyitem_TextPr_Lang_EastAsia;CChangesParaTextPrLangEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.Lang.EastAsia=Value};CChangesParaTextPrLangEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangVal(Class,
Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangVal.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangVal.prototype.constructor=CChangesParaTextPrLangVal;CChangesParaTextPrLangVal.prototype.Type=AscDFH.historyitem_TextPr_Lang_Val;CChangesParaTextPrLangVal.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Val=Value};CChangesParaTextPrLangVal.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;
function CChangesParaTextPrUnifill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrUnifill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrUnifill.prototype.constructor=CChangesParaTextPrUnifill;CChangesParaTextPrUnifill.prototype.Type=AscDFH.historyitem_TextPr_Unifill;CChangesParaTextPrUnifill.prototype.private_SetValue=function(Value){this.Class.Value.Unifill=Value};CChangesParaTextPrUnifill.prototype.private_CreateObject=
function(){return new AscFormat.CUniFill};CChangesParaTextPrUnifill.prototype.Load=function(Color){this.Redo();var Unifill=this.Class.Value.Unifill;if(AscCommon.CollaborativeEditing&&Unifill&&Unifill.fill&&Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_BLIP&&typeof Unifill.fill.RasterImageId==="string"&&Unifill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId)};CChangesParaTextPrUnifill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrFontSizeCS(Class,
Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrFontSizeCS.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrFontSizeCS.prototype.constructor=CChangesParaTextPrFontSizeCS;CChangesParaTextPrFontSizeCS.prototype.Type=AscDFH.historyitem_TextPr_FontSizeCS;CChangesParaTextPrFontSizeCS.prototype.private_SetValue=function(Value){this.Class.Value.FontSizeCS=Value};CChangesParaTextPrFontSizeCS.prototype.Merge=private_ParaTextPrChangesOnMergeValue;
function CChangesParaTextPrTextOutline(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextOutline.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextOutline.prototype.constructor=CChangesParaTextPrTextOutline;CChangesParaTextPrTextOutline.prototype.Type=AscDFH.historyitem_TextPr_Outline;CChangesParaTextPrTextOutline.prototype.private_SetValue=function(Value){this.Class.Value.TextOutline=Value};CChangesParaTextPrTextOutline.prototype.private_CreateObject=
function(){return new AscFormat.CLn};CChangesParaTextPrTextOutline.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrTextFill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextFill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextFill.prototype.constructor=CChangesParaTextPrTextFill;CChangesParaTextPrTextFill.prototype.Type=AscDFH.historyitem_TextPr_Fill;CChangesParaTextPrTextFill.prototype.private_SetValue=
function(Value){this.Class.Value.TextFill=Value};CChangesParaTextPrTextFill.prototype.private_CreateObject=function(){return new AscFormat.CUniFill};CChangesParaTextPrTextFill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;"use strict";var drawing_Inline=1;var drawing_Anchor=2;var WRAPPING_TYPE_NONE=0;var WRAPPING_TYPE_SQUARE=1;var WRAPPING_TYPE_THROUGH=2;var WRAPPING_TYPE_TIGHT=3;var WRAPPING_TYPE_TOP_AND_BOTTOM=4;var WRAP_HIT_TYPE_POINT=0;var WRAP_HIT_TYPE_SECTION=1;var c_oAscAlignH=Asc.c_oAscAlignH;
var c_oAscAlignV=Asc.c_oAscAlignV;function ParaDrawing(W,H,GraphicObj,DrawingDocument,DocumentContent,Parent){CRunElementBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.DrawingType=drawing_Inline;this.GraphicObj=GraphicObj;this.X=0;this.Y=0;this.Width=0;this.Height=0;this.OrigX=0;this.OrigY=0;this.ShiftX=0;this.ShiftY=0;this.PageNum=0;this.LineNum=0;this.YOffset=0;this.DocumentContent=DocumentContent;this.DrawingDocument=DrawingDocument;this.Parent=Parent;this.LogicDocument=DrawingDocument?
DrawingDocument.m_oLogicDocument:null;this.Distance={T:0,B:0,L:0,R:0};this.LayoutInCell=true;this.RelativeHeight=undefined;this.SimplePos={Use:false,X:0,Y:0};this.Extent={W:W,H:H};this.EffectExtent={L:0,T:0,R:0,B:0};this.docPr=new AscFormat.CNvPr;this.SizeRelH=undefined;this.SizeRelV=undefined;this.AllowOverlap=true;this.Locked=null;this.Hidden=null;this.PositionH={RelativeFrom:c_oAscRelativeFromH.Column,Align:false,Value:0,Percent:false};this.PositionV={RelativeFrom:c_oAscRelativeFromV.Paragraph,
Align:false,Value:0,Percent:false};this.PositionH_Old=undefined;this.PositionV_Old=undefined;this.Internal_Position=new CAnchorPosition;this.wrappingType=WRAPPING_TYPE_THROUGH;this.useWrap=true;if(typeof CWrapPolygon!=="undefined")this.wrappingPolygon=new CWrapPolygon(this);this.document=editor.WordControl.m_oLogicDocument;this.drawingDocument=DrawingDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.selected=false;this.behindDoc=false;this.bNoNeedToAdd=false;this.pageIndex=
-1;this.Lock=new AscCommon.CLock;this.ParaMath=null;this.SkipOnRecalculate=false;this.LineTop=null;this.LineBottom=null;g_oTableId.Add(this,this.Id);if(this.graphicObjects){this.Set_RelativeHeight(this.graphicObjects.getZIndex());if(History.Is_On()&&!g_oTableId.m_bTurnOff)this.graphicObjects.addGraphicObject(this)}}ParaDrawing.prototype=Object.create(CRunElementBase.prototype);ParaDrawing.prototype.constructor=ParaDrawing;ParaDrawing.prototype.Type=para_Drawing;ParaDrawing.prototype.Get_Type=function(){return this.Type};
ParaDrawing.prototype.Get_Width=function(){return this.Width};ParaDrawing.prototype.Get_WidthVisible=function(){return this.WidthVisible};ParaDrawing.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible};ParaDrawing.prototype.GetSelectedContent=function(SelectedContent){if(this.GraphicObj&&this.GraphicObj.GetSelectedContent)this.GraphicObj.GetSelectedContent(SelectedContent)};ParaDrawing.prototype.GetSearchElementId=function(bNext,bCurrent){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.GetSearchElementId==="function")return this.GraphicObj.GetSearchElementId(bNext,bCurrent);return null};ParaDrawing.prototype.CheckCorrect=function(){if(!this.GraphicObj)return false;if(this.GraphicObj&&this.GraphicObj.checkCorrect)return this.GraphicObj.checkCorrect();return true};ParaDrawing.prototype.GetAllDrawingObjects=function(DrawingObjects){if(null==DrawingObjects)DrawingObjects=[];if(this.GraphicObj.GetAllDrawingObjects)this.GraphicObj.GetAllDrawingObjects(DrawingObjects)};
ParaDrawing.prototype.canRotate=function(){return AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canRotate=="function"&&this.GraphicObj.canRotate()};ParaDrawing.prototype.GetParagraph=function(){return this.Get_ParentParagraph()};ParaDrawing.prototype.GetRun=function(){return this.Get_Run()};ParaDrawing.prototype.Get_Run=function(){var oParagraph=this.Get_ParentParagraph();if(oParagraph)return oParagraph.Get_DrawingObjectRun(this.Id);return null};ParaDrawing.prototype.Get_Props=function(OtherProps){var Props=
{};Props.Width=this.GraphicObj.extX;Props.Height=this.GraphicObj.extY;if(drawing_Inline===this.DrawingType)Props.WrappingStyle=c_oAscWrapStyle2.Inline;else if(WRAPPING_TYPE_NONE===this.wrappingType)Props.WrappingStyle=this.behindDoc===true?c_oAscWrapStyle2.Behind:c_oAscWrapStyle2.InFront;else switch(this.wrappingType){case WRAPPING_TYPE_SQUARE:Props.WrappingStyle=c_oAscWrapStyle2.Square;break;case WRAPPING_TYPE_TIGHT:Props.WrappingStyle=c_oAscWrapStyle2.Tight;break;case WRAPPING_TYPE_THROUGH:Props.WrappingStyle=
c_oAscWrapStyle2.Through;break;case WRAPPING_TYPE_TOP_AND_BOTTOM:Props.WrappingStyle=c_oAscWrapStyle2.TopAndBottom;break;default:Props.WrappingStyle=c_oAscWrapStyle2.Inline;break}if(drawing_Inline===this.DrawingType)Props.Paddings={Left:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Right:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Top:0,Bottom:0};else{var oDistance=this.Get_Distance();Props.Paddings={Left:oDistance.L,Right:oDistance.R,Top:oDistance.T,Bottom:oDistance.B}}Props.AllowOverlap=this.AllowOverlap;Props.Position=
{X:this.X,Y:this.Y};Props.PositionH={RelativeFrom:this.PositionH.RelativeFrom,UseAlign:this.PositionH.Align,Align:true===this.PositionH.Align?this.PositionH.Value:undefined,Value:true===this.PositionH.Align?0:this.PositionH.Value,Percent:this.PositionH.Percent};Props.PositionV={RelativeFrom:this.PositionV.RelativeFrom,UseAlign:this.PositionV.Align,Align:true===this.PositionV.Align?this.PositionV.Value:undefined,Value:true===this.PositionV.Align?0:this.PositionV.Value,Percent:this.PositionV.Percent};
if(this.SizeRelH&&this.SizeRelH.Percent>0)Props.SizeRelH={RelativeFrom:AscFormat.ConvertRelSizeHToRelPosition(this.SizeRelH.RelativeFrom),Value:this.SizeRelH.Percent*100>>0};if(this.SizeRelV&&this.SizeRelV.Percent>0)Props.SizeRelV={RelativeFrom:AscFormat.ConvertRelSizeVToRelPosition(this.SizeRelV.RelativeFrom),Value:this.SizeRelV.Percent*100>>0};Props.Internal_Position=this.Internal_Position;Props.Locked=this.Lock.Is_Locked();var ParentParagraph=this.Get_ParentParagraph();if(ParentParagraph&&undefined!==
ParentParagraph.Parent){var DocContent=ParentParagraph.Parent;if(true===DocContent.Is_DrawingShape()||DocContent.GetTopDocumentContent()instanceof CFootEndnote)Props.CanBeFlow=false}Props.title=this.docPr.title!==null?this.docPr.title:undefined;Props.description=this.docPr.descr!==null?this.docPr.descr:undefined;if(null!=OtherProps&&undefined!=OtherProps){if(undefined===OtherProps.Width||.001>Math.abs(Props.Width-OtherProps.Width))Props.Width=undefined;if(undefined===OtherProps.Height||.001>Math.abs(Props.Height-
OtherProps.Height))Props.Height=undefined;if(undefined===OtherProps.WrappingStyle||Props.WrappingStyle!=OtherProps.WrappingStyle)Props.WrappingStyle=undefined;if(undefined===OtherProps.ImageUrl||Props.ImageUrl!=OtherProps.ImageUrl)Props.ImageUrl=undefined;if(undefined===OtherProps.Paddings.Left||.001>Math.abs(Props.Paddings.Left-OtherProps.Paddings.Left))Props.Paddings.Left=undefined;if(undefined===OtherProps.Paddings.Right||.001>Math.abs(Props.Paddings.Right-OtherProps.Paddings.Right))Props.Paddings.Right=
undefined;if(undefined===OtherProps.Paddings.Top||.001>Math.abs(Props.Paddings.Top-OtherProps.Paddings.Top))Props.Paddings.Top=undefined;if(undefined===OtherProps.Paddings.Bottom||.001>Math.abs(Props.Paddings.Bottom-OtherProps.Paddings.Bottom))Props.Paddings.Bottom=undefined;if(undefined===OtherProps.AllowOverlap||Props.AllowOverlap!=OtherProps.AllowOverlap)Props.AllowOverlap=undefined;if(undefined===OtherProps.Position.X||.001>Math.abs(Props.Position.X-OtherProps.Position.X))Props.Position.X=undefined;
if(undefined===OtherProps.Position.Y||.001>Math.abs(Props.Position.Y-OtherProps.Position.Y))Props.Position.Y=undefined;if(undefined===OtherProps.PositionH.RelativeFrom||Props.PositionH.RelativeFrom!=OtherProps.PositionH.RelativeFrom)Props.PositionH.RelativeFrom=undefined;if(undefined===OtherProps.PositionH.UseAlign||Props.PositionH.UseAlign!=OtherProps.PositionH.UseAlign)Props.PositionH.UseAlign=undefined;if(Props.PositionH.RelativeFrom===OtherProps.PositionH.RelativeFrom&&Props.PositionH.UseAlign===
OtherProps.PositionH.UseAlign){if(true!=Props.PositionH.UseAlign&&.001>Math.abs(Props.PositionH.Value-OtherProps.PositionH.Value))Props.PositionH.Value=undefined;if(true===Props.PositionH.UseAlign&&Props.PositionH.Align!=OtherProps.PositionH.Align)Props.PositionH.Align=undefined}if(undefined===OtherProps.PositionV.RelativeFrom||Props.PositionV.RelativeFrom!=OtherProps.PositionV.RelativeFrom)Props.PositionV.RelativeFrom=undefined;if(undefined===OtherProps.PositionV.UseAlign||Props.PositionV.UseAlign!=
OtherProps.PositionV.UseAlign)Props.PositionV.UseAlign=undefined;if(Props.PositionV.RelativeFrom===OtherProps.PositionV.RelativeFrom&&Props.PositionV.UseAlign===OtherProps.PositionV.UseAlign){if(true!=Props.PositionV.UseAlign&&.001>Math.abs(Props.PositionV.Value-OtherProps.PositionV.Value))Props.PositionV.Value=undefined;if(true===Props.PositionV.UseAlign&&Props.PositionV.Align!=OtherProps.PositionV.Align)Props.PositionV.Align=undefined}if(false===OtherProps.Locked)Props.Locked=false;if(false===OtherProps.CanBeFlow||
false===Props.CanBeFlow)Props.CanBeFlow=false;else Props.CanBeFlow=true;if(undefined===OtherProps.title||Props.title!==OtherProps.title)Props.title=undefined;if(undefined===OtherProps.description||Props.description!==OtherProps.description)Props.description=undefined}return Props};ParaDrawing.prototype.Is_UseInDocument=function(){if(this.Parent){var Run=this.Parent.Get_DrawingObjectRun(this.Id);if(Run)return Run.Is_UseInDocument(this.Get_Id())}return false};ParaDrawing.prototype.IsUseInDocument=function(){return this.Is_UseInDocument()};
ParaDrawing.prototype.CheckGroupSizes=function(){if(this.GraphicObj&&this.GraphicObj.CheckGroupSizes)this.GraphicObj.CheckGroupSizes()};ParaDrawing.prototype.Set_DrawingType=function(DrawingType){History.Add(new CChangesParaDrawingDrawingType(this,this.DrawingType,DrawingType));this.DrawingType=DrawingType};ParaDrawing.prototype.Set_WrappingType=function(WrapType){History.Add(new CChangesParaDrawingWrappingType(this,this.wrappingType,WrapType));this.wrappingType=WrapType};ParaDrawing.prototype.Set_Distance=
function(L,T,R,B){var oDistance=this.Get_Distance();if(!AscFormat.isRealNumber(L))L=oDistance.L;if(!AscFormat.isRealNumber(T))T=oDistance.T;if(!AscFormat.isRealNumber(R))R=oDistance.R;if(!AscFormat.isRealNumber(B))B=oDistance.B;History.Add(new CChangesParaDrawingDistance(this,{Left:this.Distance.L,Top:this.Distance.T,Right:this.Distance.R,Bottom:this.Distance.B},{Left:L,Top:T,Right:R,Bottom:B}));this.Distance.L=L;this.Distance.R=R;this.Distance.T=T;this.Distance.B=B};ParaDrawing.prototype.Set_AllowOverlap=
function(AllowOverlap){History.Add(new CChangesParaDrawingAllowOverlap(this,this.AllowOverlap,AllowOverlap));this.AllowOverlap=AllowOverlap};ParaDrawing.prototype.Set_PositionH=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionH(this,{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,
Value:this.PositionH.Value,Percent:this.PositionH.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionH.RelativeFrom=RelativeFrom;this.PositionH.Align=Align;this.PositionH.Value=_Value;this.PositionH.Percent=_Percent};ParaDrawing.prototype.Set_PositionV=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionV(this,
{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionV.RelativeFrom=RelativeFrom;this.PositionV.Align=Align;this.PositionV.Value=_Value;this.PositionV.Percent=_Percent};ParaDrawing.prototype.GetPositionH=function(){return{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent}};
ParaDrawing.prototype.GetPositionV=function(){return{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent}};ParaDrawing.prototype.Set_BehindDoc=function(BehindDoc){History.Add(new CChangesParaDrawingBehindDoc(this,this.behindDoc,BehindDoc));this.behindDoc=BehindDoc};ParaDrawing.prototype.Set_GraphicObject=function(graphicObject){var oldId=AscCommon.isRealObject(this.GraphicObj)?this.GraphicObj.Get_Id():null;var newId=AscCommon.isRealObject(graphicObject)?
graphicObject.Get_Id():null;History.Add(new CChangesParaDrawingGraphicObject(this,oldId,newId));if(graphicObject)graphicObject.handleUpdateExtents();this.GraphicObj=graphicObject};ParaDrawing.prototype.setSimplePos=function(use,x,y){History.Add(new CChangesParaDrawingSimplePos(this,{Use:this.SimplePos.Use,X:this.SimplePos.X,Y:this.SimplePos.Y},{Use:use,X:x,Y:y}));this.SimplePos.Use=use;this.SimplePos.X=x;this.SimplePos.Y=y};ParaDrawing.prototype.setExtent=function(extX,extY){History.Add(new CChangesParaDrawingExtent(this,
{W:this.Extent.W,H:this.Extent.H},{W:extX,H:extY}));this.Extent.W=extX;this.Extent.H=extY};ParaDrawing.prototype.addWrapPolygon=function(wrapPolygon){History.Add(new CChangesParaDrawingWrapPolygon(this,this.wrappingPolygon,wrapPolygon));this.wrappingPolygon=wrapPolygon};ParaDrawing.prototype.Set_Locked=function(bLocked){History.Add(new CChangesParaDrawingLocked(this,this.Locked,bLocked));this.Locked=bLocked};ParaDrawing.prototype.Set_RelativeHeight=function(nRelativeHeight){History.Add(new CChangesParaDrawingRelativeHeight(this,
this.RelativeHeight,nRelativeHeight));this.Set_RelativeHeight2(nRelativeHeight)};ParaDrawing.prototype.Set_RelativeHeight2=function(nRelativeHeight){this.RelativeHeight=nRelativeHeight;if(this.graphicObjects&&AscFormat.isRealNumber(nRelativeHeight)&&nRelativeHeight>this.graphicObjects.maximalGraphicObjectZIndex)this.graphicObjects.maximalGraphicObjectZIndex=nRelativeHeight};ParaDrawing.prototype.setEffectExtent=function(L,T,R,B){var oEE=this.EffectExtent;History.Add(new CChangesParaDrawingEffectExtent(this,
{L:oEE.L,T:oEE.T,R:oEE.R,B:oEE.B},{L:L,T:T,R:R,B:B}));this.EffectExtent.L=L;this.EffectExtent.T=T;this.EffectExtent.R=R;this.EffectExtent.B=B};ParaDrawing.prototype.Set_Parent=function(oParent){History.Add(new CChangesParaDrawingParent(this,this.Parent,oParent));this.Parent=oParent};ParaDrawing.prototype.IsWatermark=function(){if(!this.GraphicObj)return false;if(this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_Shape&&this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ImageShape)return false;
if(this.Is_Inline())return false;var oParagraph=this.GetParagraph();if(!(oParagraph instanceof Paragraph))return false;var oContent=oParagraph.Parent;if(!oContent||oContent.Is_DrawingShape(false))return false;var oHdrFtr=oContent.IsHdrFtr(true);if(!oHdrFtr)return false;var oRun=this.Get_Run();if(!oRun)return false;var arrDocPos=oRun.GetDocumentPositionFromObject();for(var nIndex=0,nCount=arrDocPos.length;nIndex<nCount;++nIndex){var oClass=arrDocPos[nIndex].Class;var oSdt=null;if(oClass instanceof
CDocumentContent&&oClass.Parent instanceof CBlockLevelSdt)oSdt=oClass.Parent;else if(oClass instanceof CInlineLevelSdt)oSdt=oClass;if(oSdt){var oPr=oSdt.Pr;if(AscCommon.isRealObject(oPr)&&AscCommon.isRealObject(oPr.DocPartObj)&&oPr.DocPartObj.Gallery==="Watermarks")return true}}return false};ParaDrawing.prototype.Set_ParaMath=function(ParaMath){History.Add(new CChangesParaDrawingParaMath(this,this.ParaMath,ParaMath));this.ParaMath=ParaMath};ParaDrawing.prototype.Set_LayoutInCell=function(LayoutInCell){if(this.LayoutInCell===
LayoutInCell)return;History.Add(new CChangesParaDrawingLayoutInCell(this,this.LayoutInCell,LayoutInCell));this.LayoutInCell=LayoutInCell};ParaDrawing.prototype.SetSizeRelH=function(oSize){History.Add(new CChangesParaDrawingSizeRelH(this,this.SizeRelH,oSize));this.SizeRelH=oSize};ParaDrawing.prototype.SetSizeRelV=function(oSize){History.Add(new CChangesParaDrawingSizeRelV(this,this.SizeRelV,oSize));this.SizeRelV=oSize};ParaDrawing.prototype.getXfrmExtX=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX))return this.GraphicObj.spPr.xfrm.extX;if(AscFormat.isRealNumber(this.Extent.W))return this.Extent.W;return 0};ParaDrawing.prototype.getXfrmExtY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY))return this.GraphicObj.spPr.xfrm.extY;
if(AscFormat.isRealNumber(this.Extent.H))return this.Extent.H;return 0};ParaDrawing.prototype.getXfrmRot=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))return this.GraphicObj.spPr.xfrm.rot;return 0};ParaDrawing.prototype.Get_Bounds=function(){var InsL,InsT,InsR,InsB;InsL=0;InsT=0;InsR=0;InsB=0;if(!this.Is_Inline()){var oDistance=this.Get_Distance();
if(oDistance){InsL=oDistance.L;InsT=oDistance.T;InsR=oDistance.R;InsB=oDistance.B}}var ExtX=this.getXfrmExtX();var ExtY=this.getXfrmExtY();var Rot=this.getXfrmRot();var X,Y,W,H;if(AscFormat.checkNormalRotate(Rot)){X=this.X;Y=this.Y;W=ExtX;H=ExtY}else{X=this.X+ExtX/2-ExtY/2;Y=this.Y+ExtY/2-ExtX/2;W=ExtY;H=ExtX}return{Left:X-this.EffectExtent.L-InsL,Top:Y-this.EffectExtent.T-InsT,Bottom:Y+H+this.EffectExtent.B+InsB,Right:X+W+this.EffectExtent.R+InsR}};ParaDrawing.prototype.Search=function(Str,Props,
SearchEngine,Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.Search==="function")this.GraphicObj.Search(Str,Props,SearchEngine,Type)};ParaDrawing.prototype.Set_Props=function(Props){var bCheckWrapPolygon=false;var isPictureCC=false;var oRun=this.GetRun();if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=0,nCount=arrContentControls.length;nIndex<nCount;++nIndex)if(arrContentControls[nIndex].IsPicture()){isPictureCC=true;break}}if(undefined!=Props.WrappingStyle&&
!isPictureCC){if(drawing_Inline===this.DrawingType&&c_oAscWrapStyle2.Inline!=Props.WrappingStyle&&undefined===Props.Paddings)this.Set_Distance(3.2,0,3.2,0);this.Set_DrawingType(c_oAscWrapStyle2.Inline===Props.WrappingStyle?drawing_Inline:drawing_Anchor);if(c_oAscWrapStyle2.Inline===Props.WrappingStyle)if(AscCommon.isRealObject(this.GraphicObj.bounds)&&AscFormat.isRealNumber(this.GraphicObj.bounds.w)&&AscFormat.isRealNumber(this.GraphicObj.bounds.h))this.CheckWH();if(c_oAscWrapStyle2.Behind===Props.WrappingStyle||
c_oAscWrapStyle2.InFront===Props.WrappingStyle){this.Set_WrappingType(WRAPPING_TYPE_NONE);this.Set_BehindDoc(c_oAscWrapStyle2.Behind===Props.WrappingStyle?true:false)}else{switch(Props.WrappingStyle){case c_oAscWrapStyle2.Square:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);break;case c_oAscWrapStyle2.Tight:{bCheckWrapPolygon=true;this.Set_WrappingType(WRAPPING_TYPE_TIGHT);break}case c_oAscWrapStyle2.Through:{this.Set_WrappingType(WRAPPING_TYPE_THROUGH);bCheckWrapPolygon=true;break}case c_oAscWrapStyle2.TopAndBottom:this.Set_WrappingType(WRAPPING_TYPE_TOP_AND_BOTTOM);
break;default:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);break}this.Set_BehindDoc(false)}}if(undefined!=Props.Paddings)this.Set_Distance(Props.Paddings.Left,Props.Paddings.Top,Props.Paddings.Right,Props.Paddings.Bottom);if(undefined!=Props.AllowOverlap)this.Set_AllowOverlap(Props.AllowOverlap);if(undefined!=Props.PositionH)this.Set_PositionH(Props.PositionH.RelativeFrom,Props.PositionH.UseAlign,true===Props.PositionH.UseAlign?Props.PositionH.Align:Props.PositionH.Value,Props.PositionH.Percent);if(undefined!=
Props.PositionV)this.Set_PositionV(Props.PositionV.RelativeFrom,Props.PositionV.UseAlign,true===Props.PositionV.UseAlign?Props.PositionV.Align:Props.PositionV.Value,Props.PositionV.Percent);if(undefined!=Props.SizeRelH)this.SetSizeRelH({RelativeFrom:AscFormat.ConvertRelPositionHToRelSize(Props.SizeRelH.RelativeFrom),Percent:Props.SizeRelH.Value/100});if(undefined!=Props.SizeRelV)this.SetSizeRelV({RelativeFrom:AscFormat.ConvertRelPositionVToRelSize(Props.SizeRelV.RelativeFrom),Percent:Props.SizeRelV.Value/
100});if(this.SizeRelH&&!this.SizeRelV)this.SetSizeRelV({RelativeFrom:AscCommon.c_oAscSizeRelFromV.sizerelfromvPage,Percent:0});if(this.SizeRelV&&!this.SizeRelH)this.SetSizeRelH({RelativeFrom:AscCommon.c_oAscSizeRelFromH.sizerelfromhPage,Percent:0});if(bCheckWrapPolygon)this.Check_WrapPolygon();if(undefined!=Props.description)this.docPr.setDescr(Props.description);if(undefined!=Props.title)this.docPr.setTitle(Props.title)};ParaDrawing.prototype.CheckWH=function(){if(!this.GraphicObj)return;var oldExtW=
this.Extent.W;var oldExtH=this.Extent.H;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){this.Extent.W=this.GraphicObj.spPr.xfrm.extX;this.Extent.H=this.GraphicObj.spPr.xfrm.extY}this.GraphicObj.recalculate();this.Extent.W=oldExtW;this.Extent.H=oldExtH;var extX,extY,rot;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm){if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){extX=
this.GraphicObj.spPr.xfrm.extX;extY=this.GraphicObj.spPr.xfrm.extY}else{extX=5;extY=5}if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))rot=this.GraphicObj.spPr.xfrm.rot;else rot=0}else{extX=5;extY=5;rot=0}this.setExtent(extX,extY);var EEL=0,EET=0,EER=0,EEB=0;{var xc=this.GraphicObj.localTransform.TransformPointX(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var yc=this.GraphicObj.localTransform.TransformPointY(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var oBounds=this.GraphicObj.bounds;
var LineCorrect=0;if(this.GraphicObj.pen&&this.GraphicObj.pen.Fill&&this.GraphicObj.pen.Fill.fill){LineCorrect=this.GraphicObj.pen.w==null?12700:parseInt(this.GraphicObj.pen.w);LineCorrect/=72E3}var l=oBounds.x;var r=l+oBounds.w;var t=oBounds.y;var b=t+oBounds.h;var startX,startY;if(!AscFormat.checkNormalRotate(rot)){var temp=extX;extX=extY;extY=temp}startX=xc-extX/2;startY=yc-extY/2;if(l>startX)l=startX;if(r<startX+extX)r=startX+extX;if(t>startY)t=startY;if(b<startY+extY)b=startY+extY;EEL=xc-extX/
2-l+LineCorrect;EET=yc-extY/2-t+LineCorrect;EER=r+LineCorrect-(xc+extX/2);EEB=b+LineCorrect-(yc+extY/2)}this.setEffectExtent(EEL,EET,EER,EEB);this.Check_WrapPolygon()};ParaDrawing.prototype.Check_WrapPolygon=function(){if((this.wrappingType===WRAPPING_TYPE_TIGHT||this.wrappingType===WRAPPING_TYPE_THROUGH)&&this.wrappingPolygon&&!this.wrappingPolygon.edited){this.GraphicObj.recalculate();this.wrappingPolygon.setArrRelPoints(this.wrappingPolygon.calculate(this.GraphicObj))}};ParaDrawing.prototype.Draw=
function(X,Y,pGraphics,PDSE){var nPageIndex=null;if(AscCommon.isRealObject(PDSE))nPageIndex=PDSE.Page;if(pGraphics.Start_Command){pGraphics.m_aDrawings.push(new AscFormat.ParaDrawingStruct(undefined,this));return}if(this.Is_Inline()){pGraphics.shapePageIndex=nPageIndex;this.draw(pGraphics,PDSE);pGraphics.shapePageIndex=null}if(pGraphics.End_Command)pGraphics.End_Command()};ParaDrawing.prototype.Measure=function(){if(!this.GraphicObj){this.Width=0;this.Height=0;return}if(AscFormat.isRealNumber(this.Extent.W)&&
AscFormat.isRealNumber(this.Extent.H)&&(!this.GraphicObj.checkAutofit||!this.GraphicObj.checkAutofit())&&!this.SizeRelH&&!this.SizeRelV){var oEffectExtent=this.EffectExtent;var W,H;if(AscFormat.isRealNumber(this.GraphicObj.rot))if(AscFormat.checkNormalRotate(this.GraphicObj.rot)){W=this.Extent.W;H=this.Extent.H}else{W=this.Extent.H;H=this.Extent.W}else{W=this.Extent.W;H=this.Extent.H}this.Width=W+AscFormat.getValOrDefault(oEffectExtent.L,0)+AscFormat.getValOrDefault(oEffectExtent.R,0);this.Height=
H+AscFormat.getValOrDefault(oEffectExtent.T,0)+AscFormat.getValOrDefault(oEffectExtent.B,0);this.WidthVisible=this.Width}else{this.GraphicObj.recalculate();if(this.GraphicObj.recalculateText)this.GraphicObj.recalculateText();if(this.PositionH.UseAlign||this.Is_Inline())this.Width=this.GraphicObj.bounds.w;else this.Width=this.GraphicObj.extX;this.WidthVisible=this.Width;if(this.PositionV.UseAlign||this.Is_Inline())this.Height=this.GraphicObj.bounds.h;else this.Height=this.GraphicObj.extY}};ParaDrawing.prototype.SaveRecalculateObject=
function(Copy){var DrawingObj={};DrawingObj.Type=this.Type;DrawingObj.DrawingType=this.DrawingType;DrawingObj.WrappingType=this.wrappingType;if(drawing_Anchor===this.Get_DrawingType()&&true===this.Use_TextWrap()){var oDistance=this.Get_Distance();DrawingObj.FlowPos={X:this.X-oDistance.L,Y:this.Y-oDistance.T,W:this.Width+oDistance.R,H:this.Height+oDistance.B}}DrawingObj.PageNum=this.PageNum;DrawingObj.X=this.X;DrawingObj.Y=this.Y;DrawingObj.spRecaclcObject=this.GraphicObj.getRecalcObject();return DrawingObj};
ParaDrawing.prototype.LoadRecalculateObject=function(RecalcObj){this.updatePosition3(RecalcObj.PageNum,RecalcObj.X,RecalcObj.Y);this.GraphicObj.setRecalcObject(RecalcObj.spRecaclcObject)};ParaDrawing.prototype.Reassign_ImageUrls=function(mapUrls){if(this.GraphicObj)this.GraphicObj.Reassign_ImageUrls(mapUrls)};ParaDrawing.prototype.PrepareRecalculateObject=function(){};ParaDrawing.prototype.Is_RealContent=function(){return true};ParaDrawing.prototype.Can_AddNumbering=function(){if(drawing_Inline===
this.DrawingType)return true;return false};ParaDrawing.prototype.Copy=function(oPr){var c=new ParaDrawing(this.Extent.W,this.Extent.H,null,editor.WordControl.m_oLogicDocument.DrawingDocument,null,null);c.Set_DrawingType(this.DrawingType);if(AscCommon.isRealObject(this.GraphicObj)){var oCopyPr=new AscFormat.CCopyObjectProperties;oCopyPr.contentCopyPr=oPr;c.Set_GraphicObject(this.GraphicObj.copy(oCopyPr));c.GraphicObj.setParent(c)}var d=this.Distance;c.Set_PositionH(this.PositionH.RelativeFrom,this.PositionH.Align,
this.PositionH.Value,this.PositionH.Percent);c.Set_PositionV(this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);c.Set_Distance(d.L,d.T,d.R,d.B);c.Set_AllowOverlap(this.AllowOverlap);c.Set_WrappingType(this.wrappingType);if(this.wrappingPolygon)c.wrappingPolygon.fromOther(this.wrappingPolygon);c.Set_BehindDoc(this.behindDoc);c.Set_RelativeHeight(this.RelativeHeight);if(this.SizeRelH)c.SetSizeRelH({RelativeFrom:this.SizeRelH.RelativeFrom,Percent:this.SizeRelH.Percent});
if(this.SizeRelV)c.SetSizeRelV({RelativeFrom:this.SizeRelV.RelativeFrom,Percent:this.SizeRelV.Percent});if(AscFormat.isRealNumber(this.Extent.W)&&AscFormat.isRealNumber(this.Extent.H))c.setExtent(this.Extent.W,this.Extent.H);var EE=this.EffectExtent;if(EE.L>0||EE.T>0||EE.R>0||EE.B>0)c.setEffectExtent(EE.L,EE.T,EE.R,EE.B);c.docPr.setFromOther(this.docPr);if(this.ParaMath)c.Set_ParaMath(this.ParaMath.Copy());return c};ParaDrawing.prototype.IsEqual=function(oElement){return false};ParaDrawing.prototype.Get_Id=
function(){return this.Id};ParaDrawing.prototype.GetId=function(){return this.Id};ParaDrawing.prototype.setParagraphTabs=function(tabs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphTabs==="function")this.GraphicObj.setParagraphTabs(tabs)};ParaDrawing.prototype.IsMovingTableBorder=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.IsMovingTableBorder==="function")return this.GraphicObj.IsMovingTableBorder();return false};ParaDrawing.prototype.SetVerticalClip=
function(Top,Bottom){this.LineTop=Top;this.LineBottom=Bottom};ParaDrawing.prototype.Update_Position=function(Paragraph,ParaLayout,PageLimits,PageLimitsOrigin,LineNum){if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom2;this.PositionH.Align=this.PositionH_Old.Align2;this.PositionH.Value=this.PositionH_Old.Value2;this.PositionH.Percent=this.PositionH_Old.Percent2}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom2;
this.PositionV.Align=this.PositionV_Old.Align2;this.PositionV.Value=this.PositionV_Old.Value2;this.PositionV.Percent=this.PositionV_Old.Percent2}var oDocumentContent=this.Parent&&this.Parent.Parent;if(oDocumentContent&&oDocumentContent.IsBlockLevelSdtContent())oDocumentContent=oDocumentContent.Parent.Parent;this.Parent=Paragraph;this.DocumentContent=oDocumentContent;var PageNum=ParaLayout.PageNum;var OtherFlowObjects=editor.WordControl.m_oLogicDocument.DrawingObjects.getAllFloatObjectsOnPage(PageNum,
this.Parent.Parent);var bInline=this.Is_Inline();this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,ParaLayout,PageLimits);this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent);this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);var bCorrect=false;if(oDocumentContent&&
oDocumentContent.IsTableCellContent&&oDocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(bInline,PageLimits,this.AllowOverlap,this.Use_TextWrap(),OtherFlowObjects,bCorrect);this.GraphicObj.bounds.l=this.GraphicObj.bounds.x+this.Internal_Position.CalcX;this.GraphicObj.bounds.r=this.GraphicObj.bounds.x+this.GraphicObj.bounds.w+this.Internal_Position.CalcX;
this.GraphicObj.bounds.t=this.GraphicObj.bounds.y+this.Internal_Position.CalcY;this.GraphicObj.bounds.b=this.GraphicObj.bounds.y+this.GraphicObj.bounds.h+this.Internal_Position.CalcY;var OldPageNum=this.PageNum;this.PageNum=PageNum;this.LineNum=LineNum;this.X=this.Internal_Position.CalcX;this.Y=this.Internal_Position.CalcY;if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom;this.PositionH.Align=this.PositionH_Old.Align;this.PositionH.Value=this.PositionH_Old.Value;
this.PositionH.Percent=this.PositionH_Old.Percent;var Value=this.Internal_Position.Calculate_X_Value(this.PositionH_Old.RelativeFrom);this.Set_PositionH(this.PositionH_Old.RelativeFrom,false,Value,false);this.X=this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom;this.PositionV.Align=this.PositionV_Old.Align;this.PositionV.Value=
this.PositionV_Old.Value;this.PositionV.Percent=this.PositionV_Old.Percent;var Value=this.Internal_Position.Calculate_Y_Value(this.PositionV_Old.RelativeFrom);this.Set_PositionV(this.PositionV_Old.RelativeFrom,false,Value,false);this.Y=this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}this.OrigX=this.X;this.OrigY=this.Y;this.ShiftX=0;this.ShiftY=0;this.updatePosition3(this.PageNum,this.X,this.Y,OldPageNum);this.useWrap=
this.Use_TextWrap()};ParaDrawing.prototype.GetClipRect=function(){if(this.Is_Inline()||this.Use_TextWrap()){var oCell;if(this.DocumentContent&&(oCell=this.DocumentContent.IsTableCellContent(true))){var arrPages=oCell.GetCurPageByAbsolutePage(this.PageNum);for(var nIndex=0,nCount=arrPages.length;nIndex<nCount;++nIndex){var oPageBounds=oCell.GetPageBounds(arrPages[nIndex]);if(this.GraphicObj.bounds.isIntersect(oPageBounds.Left,oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom))return new AscFormat.CGraphicBounds(oPageBounds.Left,
oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom)}}}return null};ParaDrawing.prototype.Update_PositionYHeaderFooter=function(TopMarginY,BottomMarginY){this.Internal_Position.Update_PositionYHeaderFooter(TopMarginY,BottomMarginY);this.Internal_Position.Calculate_Y(this.Is_Inline(),this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);this.OrigY=this.Internal_Position.CalcY;this.Y=this.OrigY+this.ShiftY;this.updatePosition3(this.PageNum,this.X,this.Y,this.PageNum)};
ParaDrawing.prototype.Reset_SavedPosition=function(){this.PositionV_Old=undefined;this.PositionH_Old=undefined};ParaDrawing.prototype.setParagraphBorders=function(val){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphBorders==="function")this.GraphicObj.setParagraphBorders(val)};ParaDrawing.prototype.deselect=function(){this.selected=false;if(this.GraphicObj&&this.GraphicObj.deselect)this.GraphicObj.deselect()};ParaDrawing.prototype.updatePosition3=function(pageIndex,
x,y,oldPageNum){var _x=x,_y=y;this.graphicObjects.removeById(pageIndex,this.Get_Id());if(AscFormat.isRealNumber(oldPageNum))this.graphicObjects.removeById(oldPageNum,this.Get_Id());var bChangePageIndex=this.pageIndex!==pageIndex;this.setPageIndex(pageIndex);if(typeof this.GraphicObj.setStartPage==="function"){var bIsHfdFtr=this.DocumentContent&&this.DocumentContent.IsHdrFtr();this.GraphicObj.setStartPage(pageIndex,bIsHfdFtr,bIsHfdFtr||bChangePageIndex)}if(!(this.DocumentContent&&this.DocumentContent.IsHdrFtr()&&
this.DocumentContent.Get_StartPage_Absolute()!==pageIndex)){this.graphicObjects.addObjectOnPage(pageIndex,this.GraphicObj);this.bNoNeedToAdd=false}else this.bNoNeedToAdd=true;if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.GraphicObj.posX)&&AscFormat.isRealNumber(this.GraphicObj.posY))||!(Math.abs(this.GraphicObj.posX-_x)<MOVE_DELTA&&Math.abs(this.GraphicObj.posY-_y)<MOVE_DELTA))this.GraphicObj.updatePosition(_x,_y);if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.wrappingPolygon.posX)&&
AscFormat.isRealNumber(this.wrappingPolygon.posY))||!(Math.abs(this.wrappingPolygon.posX-_x)<MOVE_DELTA&&Math.abs(this.wrappingPolygon.posY-_y)<MOVE_DELTA))this.wrappingPolygon.updatePosition(_x,_y);this.calculateSnapArrays()};ParaDrawing.prototype.calculateAfterChangeTheme=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.calculateAfterChangeTheme==="function")this.GraphicObj.calculateAfterChangeTheme()};ParaDrawing.prototype.selectionIsEmpty=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.selectionIsEmpty==="function")return this.GraphicObj.selectionIsEmpty();return false};ParaDrawing.prototype.recalculateDocContent=function(){};ParaDrawing.prototype.Shift=function(Dx,Dy){this.ShiftX=Dx;this.ShiftY=Dy;this.X=this.OrigX+Dx;this.Y=this.OrigY+Dy;this.updatePosition3(this.PageNum,this.X,this.Y)};ParaDrawing.prototype.IsLayoutInCell=function(){if(this.LogicDocument&&this.LogicDocument.GetCompatibilityMode()>=AscCommon.document_compatibility_mode_Word15)return true;
return this.LayoutInCell};ParaDrawing.prototype.Get_Distance=function(){var oDist=this.Distance;return new AscFormat.CDistance(AscFormat.getValOrDefault(oDist.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.T,0),AscFormat.getValOrDefault(oDist.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.B,0))};ParaDrawing.prototype.Set_XYForAdd=function(X,Y,NearPos,PageNum){if(null!==NearPos){var Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,
Y,PageNum,Layout,true,true);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.TurnOff_InterfaceEvents();oLogicDocument.Recalculate();oLogicDocument.TurnOn_InterfaceEvents(false);this.SetSkipOnRecalculate(false)}if(null!==nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,
Y,PageNum,Layout,true,true)}};ParaDrawing.prototype.SetSkipOnRecalculate=function(isSkip){this.SkipOnRecalculate=isSkip};ParaDrawing.prototype.IsSkipOnRecalculate=function(){return this.SkipOnRecalculate};ParaDrawing.prototype.Set_XY=function(X,Y,Paragraph,PageNum,bResetAlign){if(Paragraph){var PageNumOld=this.PageNum;var ContentPos=Paragraph.Get_DrawingObjectContentPos(this.Get_Id());if(null===ContentPos)return;var Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,
Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.Recalculate();this.SetSkipOnRecalculate(false)}if(null!==nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);if(!this.LogicDocument||null===this.LogicDocument.FullRecalc.Id||PageNum<
this.LogicDocument.FullRecalc.PageIndex&&PageNumOld<this.LogicDocument.FullRecalc.PageIndex)Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false)}};ParaDrawing.prototype.private_SetXYByLayout=function(X,Y,PageNum,Layout,bChangeX,bChangeY){if(!Layout)return;this.PageNum=PageNum;this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),
this.EffectExtent,this.YOffset,Layout.ParagraphLayout,Layout.PageLimitsOrigin);this.Internal_Position.Calculate_X(false,c_oAscRelativeFromH.Page,false,X-Layout.PageLimitsOrigin.X,false);this.Internal_Position.Calculate_Y(false,c_oAscRelativeFromV.Page,false,Y-Layout.PageLimitsOrigin.Y,false);var bCorrect=false;if(this.DocumentContent&&this.DocumentContent.IsTableCellContent&&this.DocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==
c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(false,Layout.PageLimits,this.AllowOverlap,this.Use_TextWrap(),[],bCorrect);if(true===bChangeX){this.X=this.Internal_Position.CalcX;var ValueX=this.Internal_Position.Calculate_X_Value(this.PositionH.RelativeFrom);this.Set_PositionH(this.PositionH.RelativeFrom,false,ValueX,false);this.X=this.Internal_Position.Calculate_X(false,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(true===
bChangeY){this.Y=this.Internal_Position.CalcY;var ValueY=this.Internal_Position.Calculate_Y_Value(this.PositionV.RelativeFrom);this.Set_PositionV(this.PositionV.RelativeFrom,false,ValueY,false);this.Y=this.Internal_Position.Calculate_Y(false,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}};ParaDrawing.prototype.Get_DrawingType=function(){return this.DrawingType};ParaDrawing.prototype.Is_Inline=function(){if(this.Parent&&this.Parent.Get_ParentTextTransform&&
this.Parent.Get_ParentTextTransform())return true;return drawing_Inline===this.DrawingType?true:false};ParaDrawing.prototype.IsInline=function(){return this.Is_Inline()};ParaDrawing.prototype.Use_TextWrap=function(){if(!this.Parent||!this.Parent.Get_FramePr||null!==this.Parent.Get_FramePr()&&undefined!==this.Parent.Get_FramePr())return false;return drawing_Anchor===this.DrawingType&&!(this.wrappingType===WRAPPING_TYPE_NONE)};ParaDrawing.prototype.IsUseTextWrap=function(){return this.Use_TextWrap()};
ParaDrawing.prototype.Draw_Selection=function(){var Padding=this.DrawingDocument.GetMMPerDot(6);var extX,extY;if(this.GraphicObj){extX=this.GraphicObj.extX;extY=this.GraphicObj.extY}else{extX=this.getXfrmExtX();extY=this.getXfrmExtY()}var rot=this.getXfrmRot();if(AscFormat.checkNormalRotate(rot))this.DrawingDocument.AddPageSelection(this.PageNum,this.X-this.EffectExtent.L-Padding,this.Y-this.EffectExtent.T-Padding,this.EffectExtent.L+extX+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extY+this.EffectExtent.B+
2*Padding);else this.DrawingDocument.AddPageSelection(this.PageNum,this.X+extX/2-extY/2-this.EffectExtent.L-Padding,this.Y+extY/2-extX/2-this.EffectExtent.T-Padding,this.EffectExtent.L+extY+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extX+this.EffectExtent.B+2*Padding)};ParaDrawing.prototype.CanInsertToPos=function(oAnchorPos){if(!oAnchorPos||!oAnchorPos.Paragraph||!oAnchorPos.Paragraph.Parent)return false;return!((this.IsShape()||this.IsGroup())&&(true===oAnchorPos.Paragraph.Parent.Is_DrawingShape()||
true===oAnchorPos.Paragraph.Parent.IsFootnote()))};ParaDrawing.prototype.OnEnd_MoveInline=function(NearPos){if(!this.Parent)return;NearPos.Paragraph.Check_NearestPos(NearPos);var oRun=this.GetRun();var oPictureCC=false;if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}}var oDstRun=null;var arrClasses=NearPos.Paragraph.GetClassesByPos(NearPos.ContentPos);
for(var nIndex=arrClasses.length-1;nIndex>=0;--nIndex)if(arrClasses[nIndex]instanceof ParaRun){oDstRun=arrClasses[nIndex];break}if(!oDstRun||oPictureCC&&oDstRun===oRun||oDstRun.GetParentForm()){NearPos.Paragraph.Clear_NearestPosArray();return}var NewParaDrawing=this.Copy();var RunPr=this.Remove_FromDocument(false);this.DocumentContent.Select_DrawingObject(NewParaDrawing.GetId());NewParaDrawing.Add_ToDocument(NearPos,true,RunPr,undefined,oPictureCC)};ParaDrawing.prototype.Get_ParentTextTransform=function(){if(this.Parent)return this.Parent.Get_ParentTextTransform();
return null};ParaDrawing.prototype.GoTo_Text=function(bBefore,bUpdateStates){var Paragraph=this.Get_ParentParagraph();if(Paragraph){Paragraph.MoveCursorToDrawing(this.Id,bBefore);Paragraph.Document_SetThisElementCurrent(undefined===bUpdateStates?true:bUpdateStates)}};ParaDrawing.prototype.Remove_FromDocument=function(bRecalculate){var oResult=null;if(!this.Parent)return oResult;var oRun=this.Parent.Get_DrawingObjectRun(this.Id);if(oRun){var oGrObject=this.GraphicObj;if(oGrObject&&oGrObject.getObjectType()===
AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine)oGrObject.setSignature(oGrObject.signatureLine);var oPictureCC=null;var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}if(oPictureCC)oPictureCC.RemoveContentControlWrapper();oRun.Remove_DrawingObject(this.Id);if(oRun.IsInHyperlink())oResult=new CTextPr;else oResult=oRun.GetTextPr();if(oGrObject&&
oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine){editor.sendEvent("asc_onRemoveSignature",oGrObject.signatureLine.id);oGrObject.setSignature(oGrObject.signatureLine)}}if(false!=bRecalculate)editor.WordControl.m_oLogicDocument.Recalculate();return oResult};ParaDrawing.prototype.Get_ParentParagraph=function(){if(this.Parent instanceof Paragraph)return this.Parent;if(this.Parent instanceof ParaRun)return this.Parent.Paragraph;if(this.Parent&&this.Parent.GetParagraph())return this.Parent.GetParagraph();
return null};ParaDrawing.prototype.SelectAsText=function(){var oParagraph=this.GetParagraph();var oRun=this.GetRun();if(!oParagraph||!oRun)return;var oDocument=oParagraph.GetLogicDocument();if(!oDocument)return;oDocument.RemoveSelection();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this));var oStartPos=oDocument.GetContentPosition(false);oRun.SetCursorPosition(oRun.GetElementPosition(this)+1);var oEndPos=oDocument.GetContentPosition(false);oDocument.RemoveSelection();
oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};ParaDrawing.prototype.Add_ToDocument=function(NearPos,bRecalculate,RunPr,Run,oPictureCC){NearPos.Paragraph.Check_NearestPos(NearPos);var LogicDocument=this.DrawingDocument.m_oLogicDocument;var Para=new Paragraph(this.DrawingDocument,LogicDocument);var DrawingRun=new ParaRun(Para);DrawingRun.Add_ToContent(0,this);if(RunPr)DrawingRun.Set_Pr(RunPr.Copy());if(Run)DrawingRun.SetReviewTypeWithInfo(Run.GetReviewType(),Run.GetReviewInfo());if(oPictureCC){var oSdt=
new CInlineLevelSdt;oSdt.SetPicturePr(true);oSdt.ReplacePlaceHolderWithContent();oSdt.AddToContent(0,DrawingRun);Para.Add_ToContent(0,oSdt);var oFormPr=oPictureCC.GetFormPr();if(oFormPr)oSdt.SetFormPr(oFormPr.Copy())}else Para.Add_ToContent(0,DrawingRun);var SelectedElement=new CSelectedElement(Para,false);var SelectedContent=new CSelectedContent;SelectedContent.Add(SelectedElement);SelectedContent.SetMoveDrawing(true);SelectedContent.DrawingObjects.push(this);NearPos.Paragraph.Parent.InsertContent(SelectedContent,
NearPos);NearPos.Paragraph.Clear_NearestPosArray();NearPos.Paragraph.Correct_Content();this.Set_Parent(NearPos.Paragraph);if(false!=bRecalculate)LogicDocument.Recalculate()};ParaDrawing.prototype.Add_ToDocument2=function(Paragraph){var DrawingRun=new ParaRun(Paragraph);DrawingRun.Add_ToContent(0,this);Paragraph.Add_ToContent(0,DrawingRun);this.Set_Parent(Paragraph)};ParaDrawing.prototype.UpdateCursorType=function(X,Y,PageIndex){this.DrawingDocument.SetCursorType("move",new AscCommon.CMouseMoveData);
if(null!=this.Parent){var Lock=this.Parent.Lock;if(true===Lock.Is_Locked()){var PNum=Math.max(0,Math.min(PageIndex-this.Parent.PageNum,this.Parent.Pages.length-1));var _X=this.Parent.Pages[PNum].X;var _Y=this.Parent.Pages[PNum].Y;var MMData=new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Parent.Get_StartPage_Absolute()+(PageIndex-this.Parent.PageNum));MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;
MMData.UserId=Lock.Get_UserId();MMData.HaveChanges=Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}}};ParaDrawing.prototype.Get_AnchorPos=function(){if(!this.Parent)return null;return this.Parent.Get_AnchorPos(this)};ParaDrawing.prototype.CheckRecalcAutoFit=function(oSectPr){if(this.GraphicObj&&this.GraphicObj.CheckNeedRecalcAutoFit)if(this.GraphicObj.CheckNeedRecalcAutoFit(oSectPr)){if(this.GraphicObj)this.GraphicObj.recalcWrapPolygon&&
this.GraphicObj.recalcWrapPolygon();this.Measure()}};ParaDrawing.prototype.Get_ParentObject_or_DocumentPos=function(){if(this.Parent!=null)return this.Parent.Get_ParentObject_or_DocumentPos()};ParaDrawing.prototype.Refresh_RecalcData=function(Data){var oRun=this.GetRun();if(oRun){if(AscCommon.isRealObject(Data))switch(Data.Type){case AscDFH.historyitem_Drawing_Distance:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}case AscDFH.historyitem_Drawing_SetExtent:{oRun.RecalcInfo.Measure=
true;break}case AscDFH.historyitem_Drawing_SetSizeRelH:case AscDFH.historyitem_Drawing_SetSizeRelV:case AscDFH.historyitem_Drawing_SetGraphicObject:{if(this.GraphicObj){this.GraphicObj.handleUpdateExtents&&this.GraphicObj.handleUpdateExtents();this.GraphicObj.addToRecalculate()}oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_WrappingType:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}}return oRun.Refresh_RecalcData2()}};
ParaDrawing.prototype.Refresh_RecalcData2=function(Data){var oRun=this.GetRun();if(oRun)return oRun.Refresh_RecalcData2()};ParaDrawing.prototype.hyperlinkCheck=function(bCheck){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCheck==="function")return this.GraphicObj.hyperlinkCheck(bCheck);return null};ParaDrawing.prototype.hyperlinkCanAdd=function(bCheckInHyperlink){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkCanAdd(bCheckInHyperlink);
return false};ParaDrawing.prototype.hyperlinkRemove=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkRemove();return false};ParaDrawing.prototype.hyperlinkModify=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkModify==="function")return this.GraphicObj.hyperlinkModify(HyperProps)};ParaDrawing.prototype.hyperlinkAdd=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.hyperlinkAdd==="function")return this.GraphicObj.hyperlinkAdd(HyperProps)};ParaDrawing.prototype.documentStatistics=function(stat){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentStatistics==="function")this.GraphicObj.documentStatistics(stat)};ParaDrawing.prototype.documentCreateFontCharMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontCharMap==="function")this.GraphicObj.documentCreateFontCharMap(fontMap)};
ParaDrawing.prototype.documentCreateFontMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontMap==="function")this.GraphicObj.documentCreateFontMap(fontMap)};ParaDrawing.prototype.tableCheckSplit=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckSplit==="function")return this.GraphicObj.tableCheckSplit();return false};ParaDrawing.prototype.tableCheckMerge=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.tableCheckMerge==="function")return this.GraphicObj.tableCheckMerge();return false};ParaDrawing.prototype.tableSelect=function(Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSelect==="function")return this.GraphicObj.tableSelect(Type)};ParaDrawing.prototype.tableRemoveTable=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveTable==="function")return this.GraphicObj.tableRemoveTable()};ParaDrawing.prototype.tableSplitCell=
function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSplitCell==="function")return this.GraphicObj.tableSplitCell(Cols,Rows)};ParaDrawing.prototype.tableMergeCells=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableMergeCells==="function")return this.GraphicObj.tableMergeCells(Cols,Rows)};ParaDrawing.prototype.tableRemoveCol=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveCol===
"function")return this.GraphicObj.tableRemoveCol()};ParaDrawing.prototype.tableAddCol=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddCol==="function")return this.GraphicObj.tableAddCol(bBefore,nCount)};ParaDrawing.prototype.tableRemoveRow=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveRow==="function")return this.GraphicObj.tableRemoveRow()};ParaDrawing.prototype.tableAddRow=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.tableAddRow==="function")return this.GraphicObj.tableAddRow(bBefore,nCount)};ParaDrawing.prototype.getCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurrentParagraph==="function")return this.GraphicObj.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs);if(this.Parent instanceof Paragraph)return this.Parent};ParaDrawing.prototype.GetSelectedText=function(bClearText,oPr){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.GetSelectedText==="function")return this.GraphicObj.GetSelectedText(bClearText,oPr);return""};ParaDrawing.prototype.getCurPosXY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurPosXY==="function")return this.GraphicObj.getCurPosXY();return{X:0,Y:0}};ParaDrawing.prototype.setParagraphKeepLines=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepLines==="function")return this.GraphicObj.setParagraphKeepLines(Value)};
ParaDrawing.prototype.setParagraphKeepNext=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepNext==="function")return this.GraphicObj.setParagraphKeepNext(Value)};ParaDrawing.prototype.setParagraphWidowControl=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphWidowControl==="function")return this.GraphicObj.setParagraphWidowControl(Value)};ParaDrawing.prototype.setParagraphPageBreakBefore=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.setParagraphPageBreakBefore==="function")return this.GraphicObj.setParagraphPageBreakBefore(Value)};ParaDrawing.prototype.isTextSelectionUse=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.isTextSelectionUse();return false};ParaDrawing.prototype.paragraphFormatPaste=function(CopyTextPr,CopyParaPr,Bool){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.paragraphFormatPaste(CopyTextPr,
CopyParaPr,Bool)};ParaDrawing.prototype.getNearestPos=function(x,y,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getNearestPos==="function")return this.GraphicObj.getNearestPos(x,y,pageIndex);return null};ParaDrawing.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.Type);Writer.WriteString2(this.Id)};ParaDrawing.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Drawing);Writer.WriteString2(this.Id);AscFormat.writeDouble(Writer,
this.Extent.W);AscFormat.writeDouble(Writer,this.Extent.H);AscFormat.writeObject(Writer,this.GraphicObj);AscFormat.writeObject(Writer,this.DocumentContent);AscFormat.writeObject(Writer,this.Parent);AscFormat.writeObject(Writer,this.wrappingPolygon);AscFormat.writeLong(Writer,this.RelativeHeight);AscFormat.writeObject(Writer,this.docPr)};ParaDrawing.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.DrawingDocument=editor.WordControl.m_oLogicDocument.DrawingDocument;this.LogicDocument=
this.DrawingDocument?this.DrawingDocument.m_oLogicDocument:null;this.Extent.W=AscFormat.readDouble(Reader);this.Extent.H=AscFormat.readDouble(Reader);this.GraphicObj=AscFormat.readObject(Reader);this.DocumentContent=AscFormat.readObject(Reader);this.Parent=AscFormat.readObject(Reader);this.wrappingPolygon=AscFormat.readObject(Reader);this.RelativeHeight=AscFormat.readLong(Reader);this.docPr=AscFormat.readObject(Reader);if(this.wrappingPolygon)this.wrappingPolygon.wordGraphicObject=this;this.drawingDocument=
editor.WordControl.m_oLogicDocument.DrawingDocument;this.document=editor.WordControl.m_oLogicDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.graphicObjects.addGraphicObject(this);g_oTableId.Add(this,this.Id)};ParaDrawing.prototype.Load_LinkData=function(){};ParaDrawing.prototype.draw=function(graphics,PDSE){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.draw==="function"){graphics.SaveGrState();var bInline=this.Is_Inline();if(bInline&&AscCommon.isRealObject(PDSE)&&
AscFormat.isRealNumber(this.LineTop)&&AscFormat.isRealNumber(this.LineBottom)&&AscCommon.isRealObject(this.GraphicObj.bounds)){var x,y,w,h;var oEffectExtent=this.EffectExtent;x=PDSE.X;y=this.LineTop;w=this.GraphicObj.bounds.r-this.GraphicObj.bounds.l+AscFormat.getValOrDefault(oEffectExtent.R,0)+AscFormat.getValOrDefault(oEffectExtent.L,0);h=this.LineBottom-this.LineTop;graphics.AddClipRect(x,y,w,h)}this.GraphicObj.draw(graphics);graphics.RestoreGrState()}};ParaDrawing.prototype.drawAdjustments=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.drawAdjustments==="function")this.GraphicObj.drawAdjustments()};ParaDrawing.prototype.getTransformMatrix=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getTransformMatrix==="function")return this.GraphicObj.getTransformMatrix();return null};ParaDrawing.prototype.getExtensions=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getExtensions==="function")return this.GraphicObj.getExtensions();return null};ParaDrawing.prototype.isGroup=
function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isGroup==="function")return this.GraphicObj.isGroup();return false};ParaDrawing.prototype.isShapeChild=function(bRetShape){if(!this.Is_Inline()||!this.DocumentContent)return bRetShape?null:false;var cur_doc_content=this.DocumentContent;var oCell;while(oCell=cur_doc_content.IsTableCellContent(true))cur_doc_content=oCell.Row.Table.Parent;if(AscCommon.isRealObject(cur_doc_content.Parent)&&typeof cur_doc_content.Parent.getObjectType===
"function"&&cur_doc_content.Parent.getObjectType()===AscDFH.historyitem_type_Shape)return bRetShape?cur_doc_content.Parent:true;return bRetShape?null:false};ParaDrawing.prototype.checkShapeChildAndGetTopParagraph=function(paragraph){var parent_paragraph=!paragraph?this.Get_ParentParagraph():paragraph;var parent_doc_content=parent_paragraph.Parent;if(parent_doc_content.Parent instanceof AscFormat.CShape)if(!parent_doc_content.Parent.group)return parent_doc_content.Parent.parent.Get_ParentParagraph();
else{var top_group=parent_doc_content.Parent.group;while(top_group.group)top_group=top_group.group;return top_group.parent.Get_ParentParagraph()}else if(parent_doc_content.IsTableCellContent()){var top_doc_content=parent_doc_content;var oCell;while(oCell=top_doc_content.IsTableCellContent(true))top_doc_content=oCell.Row.Table.Parent;if(top_doc_content.Parent instanceof AscFormat.CShape)if(!top_doc_content.Parent.group)return top_doc_content.Parent.parent.Get_ParentParagraph();else{var top_group=top_doc_content.Parent.group;
while(top_group.group)top_group=top_group.group;return top_group.parent.Get_ParentParagraph()}else return parent_paragraph}return parent_paragraph};ParaDrawing.prototype.hit=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hit==="function")return this.GraphicObj.hit(x,y);return false};ParaDrawing.prototype.hitToTextRect=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hitToTextRect==="function")return this.GraphicObj.hitToTextRect(x,
y);return false};ParaDrawing.prototype.cursorGetPos=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorGetPos==="function")return this.GraphicObj.cursorGetPos();return{X:0,Y:0}};ParaDrawing.prototype.getResizeCoefficients=function(handleNum,x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getResizeCoefficients==="function")return this.GraphicObj.getResizeCoefficients(handleNum,x,y);return{kd1:1,kd2:1}};ParaDrawing.prototype.getParagraphParaPr=
@ -20067,59 +20068,59 @@ this.CheckFootnote(X,Y,CurPage);if(isInText&&null!=oHyperlink&&(Y<=this.Pages[Cu
Asc.c_oAscMouseMoveDataTypes.Common;if(isInText&&(null!=oHyperlink||bPageRefLink)&&true===AscCommon.global_keyboardEvent.CtrlKey)this.DrawingDocument.SetCursorType("pointer",MMData);else this.DrawingDocument.SetCursorType("text",MMData);var Bounds=this.Pages[CurPage].Bounds;if(true===this.Lock.Is_Locked()&&X<Bounds.Right&&X>Bounds.Left&&Y>Bounds.Top&&Y<Bounds.Bottom&&this.LogicDocument&&!this.LogicDocument.IsViewModeInReview()){var _X=this.Pages[CurPage].X;var _Y=this.Pages[CurPage].Y;var MMData=
new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Get_AbsolutePage(CurPage),text_transform);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=this.Lock.Get_UserId();MMData.HaveChanges=this.Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}};Paragraph.prototype.Document_CreateFontMap=function(FontMap){if(true===this.FontMap.NeedRecalc){this.FontMap.Map=
{};this.private_CompileParaPr();var FontScheme=this.Get_Theme().themeElements.fontScheme;var CurTextPr=this.CompiledPr.Pr.TextPr.Copy();CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);CurTextPr.Merge(this.TextPr.Value);CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Create_FontMap(this.FontMap.Map);this.FontMap.NeedRecalc=false}for(var Key in this.FontMap.Map)FontMap[Key]=this.FontMap.Map[Key]};
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Get_AllFontNames(AllFonts)};Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=
this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,
false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=
StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=
arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&this.bFromDocument){if(!this.LogicDocument)return;
var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:
0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=
0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();
this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&
Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof
CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=
undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?
true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);
this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=
FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=
FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=
FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=
true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,
Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;
if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&
this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=
Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;
W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();
if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-
this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);
NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();
this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;
var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=
ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&
Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,
0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=
0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,
oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=
function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=
g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=
0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=
function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/
LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;
TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();
var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();
if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=
this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+
1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);
NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;
ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=
false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,
oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,
false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();
NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,
Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;
this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();
return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);
bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)if(this.Content[Index]&&typeof this.Content[Index].Get_AllFontNames==="function")this.Content[Index].Get_AllFontNames(AllFonts)};
Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===
this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;
if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();
for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&
this.bFromDocument){if(!this.LogicDocument)return;var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();
var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==
Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,
true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();
if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;
if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=
function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=
FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=
NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=
FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;
this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=
function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,
Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=
Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=
oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=
Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();
if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-
this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);
var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);
if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=
H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();
while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();
var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=
function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=
this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=
DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,
0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=
oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,
Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||
null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=
g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();
if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();
var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=
new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);
this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=
Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=
true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;
oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,
false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();
this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,
false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];
this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,
ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;
this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
true;break}case AscDFH.historyitem_Paragraph_Shd_Value:case AscDFH.historyitem_Paragraph_Shd_Color:case AscDFH.historyitem_Paragraph_Shd_Unifill:case AscDFH.historyitem_Paragraph_Shd:{if(this.Parent){var oDrawingShape=this.Parent.Is_DrawingShape(true);if(oDrawingShape&&oDrawingShape.getObjectType&&oDrawingShape.getObjectType()===AscDFH.historyitem_type_Shape)if(oDrawingShape.chekBodyPrTransform(oDrawingShape.getBodyPr())||oDrawingShape.checkContentWordArt(oDrawingShape.getDocContent()))bNeedRecalc=
true;if(this.Parent.IsTableHeader())bNeedRecalc=true}break}case AscDFH.historyitem_Paragraph_SectionPr:{if(this.Parent instanceof CDocument){this.Parent.UpdateContentIndexing();var nSectionIndex=this.Parent.GetSectionIndexByElementIndex(this.GetIndex());var oFirstElement=this.Parent.GetFirstElementInSection(nSectionIndex);if(oFirstElement)this.Parent.Refresh_RecalcData2(oFirstElement.GetIndex(),oFirstElement.private_GetRelativePageIndex(0))}break}case AscDFH.historyitem_Paragraph_PrChange:{if(Data instanceof
CChangesParagraphPrChange&&Data.IsChangedNumbering())bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_SuppressLineNumbers:{History.AddLineNumbersToRecalculateData();break}}if(true===bNeedRecalc){var Prev=this.Get_DocumentPrev();if(0===CurPage&&null!=Prev&&type_Paragraph===Prev.GetType()&&true===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)Prev.Refresh_RecalcData2(Prev.Pages.length-1);return this.Refresh_RecalcData2(CurPage)}};Paragraph.prototype.Refresh_RecalcData2=function(CurPage){if(!CurPage)CurPage=

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View file

@ -778,94 +778,95 @@ nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else i
true;if(nTTRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}var nQuotient=nTTRemainder/1E3|0;var nRemainder=nTTRemainder-nQuotient*1E3;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else if(nTTQuotient>0){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/100|0;nRemainder=nRemainder-nQuotient*100;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[100];isPrevZero=
false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/10|0;nRemainder=nRemainder-nQuotient*10;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[10];isPrevZero=false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(0!==nRemainder)sGroup+=arrChinese[nRemainder];sResult=sGroup+sResult;if(nRemValue<=0)break}break}}return sResult}var c_oAscSpaces=[];c_oAscSpaces[10]=1;c_oAscSpaces[32]=
1;c_oAscSpaces[8194]=1;c_oAscSpaces[8195]=1;c_oAscSpaces[8197]=1;c_oAscSpaces[12288]=1;function IsSpace(nUnicode){return!!c_oAscSpaces[nUnicode]}function private_IsAbbreviation(sWord){if(sWord.toUpperCase()===sWord){for(var nPos=0,nLen=sWord.length;nPos<nLen;++nPos){var nCharCode=sWord.charCodeAt(nPos);if(44032<=nCharCode&&nCharCode<=55203||4352<=nCharCode&&nCharCode<=4607||12592<=nCharCode&&nCharCode<=12687||43360<=nCharCode&&nCharCode<=43391||55216<=nCharCode&&nCharCode<=55295||19968<=nCharCode&&
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,
0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|
oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&
getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,
Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,
"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;
script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?
!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();
scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=
value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||
12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=
null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);
this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=
this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle="#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};
CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,
Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;
var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",
false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);
delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,
src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();
this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;
this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;
if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;
var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],
true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==
type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=
-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData",
"data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-
1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+
";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==
obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;
if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=
_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,
callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());
return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+
option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}
AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=
function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?
this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=
0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=
-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=
0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,
VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=
arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]=
{};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,
VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=
VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=
VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,
x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=
x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect=
{IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=
oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,
StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<
nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle="#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,
y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};
CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,
value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);
while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!=="undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!==
"undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=
Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=
";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);
else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType="px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==
value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,
maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+
1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",
img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=
saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=
fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=
changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;
window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=
checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;
window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;
window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=
rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=
window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=
arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=
prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if(window.parent.APP&&window.parent.APP.getUserColor)try{var CPColor=window.parent.APP.getUserColor(userId);
if(CPColor)return true===isNumericValue?CPColor.r<<16&16711680|CPColor.g<<8&65280|CPColor.b&255:new CColor(CPColor.r,CPColor.g,CPColor.b,CPColor.a)}catch(e){}if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;
res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}
function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=
nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,
onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);
loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&
window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];
if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=
AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=
getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=
value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||
12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";
this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=
function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle=
"#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;
this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=
this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;
var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);
_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=
null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}
function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?
1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=
function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=
AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;
this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&
this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,
_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=
setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,
data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData",
"data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=
true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==
obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=
function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-
1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();
return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};
this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===
idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+
AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=
function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=
false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?
this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=
function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;
this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<
CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=
new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,
x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]={};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));
for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=
VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=
true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;
VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);
x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?
1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect={IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=
true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;
ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=
left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=
color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=
Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle=
"#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};
CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");
if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=
start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!==
"undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!=="undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=
Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();
else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=
rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType=
"px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&
"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},
timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;
var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};
window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=
sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;
window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;
window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=
unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;
window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=
getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;
window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=
parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=
prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=
private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;
window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
window["asc_initAdvancedOptions"]=function(_code,_file_hash,_docInfo){if(window.isNativeOpenPassword)return window["NativeFileOpen_error"](window.isNativeOpenPassword,_file_hash,_docInfo);var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;if(_code==90||_code==91){if(window["AscDesktopEditor"]&&0!==window["AscDesktopEditor"]["CryptoMode"]&&!_editor.isLoadFullApi){_editor.asc_initAdvancedOptions_params=[];_editor.asc_initAdvancedOptions_params.push(_code);_editor.asc_initAdvancedOptions_params.push(_file_hash);
_editor.asc_initAdvancedOptions_params.push(_docInfo);return}if(AscCommon.EncryptionWorker.isNeedCrypt()&&!window.checkPasswordFromPlugin){window.checkPasswordFromPlugin=true;window.g_asc_plugins.sendToEncryption({"type":"getPasswordByFile","hash":_file_hash,"docinfo":_docInfo});return}}window.checkPasswordFromPlugin=false;_editor._onNeedParams(undefined,_code==90||_code==91?true:undefined)};
window["asc_IsNeedBuildCryptedFile"]=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["CryptoMode"])return false;var _api=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;var _returnValue=false;var _users=null;if(_api.CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi._participants)_users=_api.CoAuthoringApi._CoAuthoringApi._participants;var _usersCount=0;for(var _user in _users)_usersCount++;var isOne=1>=_usersCount?true:false;

View file

@ -8402,18 +8402,18 @@ function(font_index,stream_index){this.embeddedFontFiles[font_index].SetStreamIn
false;var oThis=this;if(window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsLocalFile"]&&window["AscDesktopEditor"]["isBlockchainSupport"]){this.isBlockchainSupport=window["AscDesktopEditor"]["isBlockchainSupport"]()&&!window["AscDesktopEditor"]["IsLocalFile"]();if(this.isBlockchainSupport){Image.prototype.preload_crypto=function(_url){window["crypto_images_map"]=window["crypto_images_map"]||{};if(!window["crypto_images_map"][_url])window["crypto_images_map"][_url]=[];window["crypto_images_map"][_url].push(this);
window["AscDesktopEditor"]["PreloadCryptoImage"](_url,AscCommon.g_oDocumentUrls.getLocal(_url));oThis.Api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage)};Image.prototype["onload_crypto"]=function(_src,_crypto_data){if(_crypto_data&&AscCommon.EncryptionWorker&&AscCommon.EncryptionWorker.isCryptoImages()){AscCommon.EncryptionWorker.decryptImage(_src,this,_crypto_data);return}this.crossOrigin="";this.src=_src;oThis.Api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage)}}}this.put_Api=function(_api){this.Api=_api;if(this.Api.IsAsyncOpenDocumentImages!==undefined){this.bIsAsyncLoadDocumentImages=this.Api.IsAsyncOpenDocumentImages();if(this.bIsAsyncLoadDocumentImages)if(undefined===this.Api.asyncImageEndLoadedBackground)this.bIsAsyncLoadDocumentImages=false}};this.LoadDocumentImagesCallback=function(){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded()};this.LoadDocumentImages=
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;for(var i=0;i<_len;i++)this.LoadImageAsync(i);this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},
3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=
new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};
oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};
oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=
function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,
url);oThis.map_image_index[url]=oImage}})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=
0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,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";
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;if(_len===0)return void this.LoadDocumentImagesCallback();var todo=_len;var that=this;var done=function(){todo--;
if(todo===0){that.images_loading.splice(0,_len);setTimeout(function(){that.LoadDocumentImagesCallback()},100);done=function(){}}};for(var i=0;i<_len;i++)this.LoadImageAsync(i,done);return;this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=
0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();
oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=
new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i,
cb){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,url);oThis.map_image_index[url]=oImage}if(typeof cb==="function")cb()})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);
return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==
oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,
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 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==
@ -16494,8 +16494,8 @@ LineIndex+1}var RangeOffset=1+this.Lines[0]+this.Lines[LineIndex+1]+RangeIndex*2
function(LineIndex,RangeIndex,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.private_UpdateSpellChecking=function(){if(this.Paragraph&&this.Paragraph.SpellChecker){this.Paragraph.SpellChecker.ClearPausedEngine();this.Paragraph.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}};CParagraphContentWithContentBase.prototype.Is_UseInDocument=function(Id){if(this.Paragraph){for(var i=0;i<this.Content.length;++i)if(this.Content[i].Get_Id&&
this.Content[i].Get_Id()===Id)break;if(i<this.Content.length)return this.Paragraph.Is_UseInDocument(this.Get_Id())}return false};CParagraphContentWithContentBase.prototype.IsUseInDocument=function(sId){return this.Is_UseInDocument(sId)};CParagraphContentWithContentBase.prototype.protected_GetPrevRangeEndPos=function(LineIndex,RangeIndex){var RangeCount=this.protected_GetRangesCount(LineIndex-1);var RangeOffset=this.protected_GetRangeOffset(LineIndex-1,RangeCount-1);return LineIndex==0&&RangeIndex==
0?0:this.Lines[RangeOffset+1]};CParagraphContentWithContentBase.prototype.private_UpdateTrackRevisions=function(){if(this.Paragraph&&this.Paragraph.LogicDocument&&this.Paragraph.LogicDocument.GetTrackRevisionsManager){var RevisionsManager=this.Paragraph.LogicDocument.GetTrackRevisionsManager();RevisionsManager.CheckElement(this.Paragraph)}};CParagraphContentWithContentBase.prototype.CanSplit=function(){return true};CParagraphContentWithContentBase.prototype.PreDelete=function(){};CParagraphContentWithContentBase.prototype.private_UpdateDocumentOutline=
function(){if(this.Paragraph)this.Paragraph.UpdateDocumentOutline()};CParagraphContentWithContentBase.prototype.IsSolid=function(){return false};CParagraphContentWithContentBase.prototype.ConvertParaContentPosToRangePos=function(oContentPos,nDepth){return 0};CParagraphContentWithContentBase.prototype.ProcessNotInlineObjectCheck=function(oChecker){oChecker.Result=false;oChecker.Found=true};function CParagraphContentWithParagraphLikeContent(){CParagraphContentWithContentBase.call(this);this.Type=undefined;
this.Paragraph=null;this.m_oContentChanges=new AscCommon.CContentChanges;this.Content=[];this.State=new CParaRunState;this.Selection=this.State.Selection;this.NearPosArray=[];this.SearchMarks=[]}CParagraphContentWithParagraphLikeContent.prototype=Object.create(CParagraphContentWithContentBase.prototype);CParagraphContentWithParagraphLikeContent.prototype.constructor=CParagraphContentWithParagraphLikeContent;CParagraphContentWithParagraphLikeContent.prototype.Get_Type=function(){return this.Type};
function(){if(this.Paragraph&&this.Paragraph.UpdateDocumentOutline)this.Paragraph.UpdateDocumentOutline()};CParagraphContentWithContentBase.prototype.IsSolid=function(){return false};CParagraphContentWithContentBase.prototype.ConvertParaContentPosToRangePos=function(oContentPos,nDepth){return 0};CParagraphContentWithContentBase.prototype.ProcessNotInlineObjectCheck=function(oChecker){oChecker.Result=false;oChecker.Found=true};function CParagraphContentWithParagraphLikeContent(){CParagraphContentWithContentBase.call(this);
this.Type=undefined;this.Paragraph=null;this.m_oContentChanges=new AscCommon.CContentChanges;this.Content=[];this.State=new CParaRunState;this.Selection=this.State.Selection;this.NearPosArray=[];this.SearchMarks=[]}CParagraphContentWithParagraphLikeContent.prototype=Object.create(CParagraphContentWithContentBase.prototype);CParagraphContentWithParagraphLikeContent.prototype.constructor=CParagraphContentWithParagraphLikeContent;CParagraphContentWithParagraphLikeContent.prototype.Get_Type=function(){return this.Type};
CParagraphContentWithParagraphLikeContent.prototype.Copy=function(Selected,oPr){var NewElement=new this.constructor;var StartPos=0;var EndPos=this.Content.length-1;if(true===Selected&&true===this.State.Selection.Use){StartPos=this.State.Selection.StartPos;EndPos=this.State.Selection.EndPos;if(StartPos>EndPos){StartPos=this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if(StartPos===CurPos||EndPos===CurPos)NewElement.Add_ToContent(CurPos-
StartPos,Item.Copy(Selected,oPr));else NewElement.Add_ToContent(CurPos-StartPos,Item.Copy(false,oPr))}return NewElement};CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContent=function(oSelectedContent){var oNewElement=new this.constructor;var nStartPos=this.State.Selection.StartPos;var nEndPos=this.State.Selection.EndPos;if(nStartPos>nEndPos){nStartPos=this.State.Selection.EndPos;nEndPos=this.State.Selection.StartPos}var nItemPos=0;for(var nPos=nStartPos,nItemPos=0;nPos<=nEndPos;++nPos){var oNewItem=
this.Content[nPos].GetSelectedContent(oSelectedContent);if(oNewItem){oNewElement.AddToContent(nItemPos,oNewItem);nItemPos++}}if(0===nItemPos)return null;return oNewElement};CParagraphContentWithParagraphLikeContent.prototype.CopyContent=function(Selected){var CopyContent=[];var StartPos=0;var EndPos=this.Content.length-1;if(true===Selected&&true===this.State.Selection.Use){StartPos=this.State.Selection.StartPos;EndPos=this.State.Selection.EndPos;if(StartPos>EndPos){StartPos=this.State.Selection.EndPos;
@ -16697,155 +16697,156 @@ CChangesParaTextPrUnderline.prototype.private_SetValue=function(Value){this.Clas
AscDFH.historyitem_TextPr_FontSize;CChangesParaTextPrFontSize.prototype.private_SetValue=function(Value){this.Class.Value.FontSize=Value};CChangesParaTextPrFontSize.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrColor(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrColor.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrColor.prototype.constructor=CChangesParaTextPrColor;
CChangesParaTextPrColor.prototype.Type=AscDFH.historyitem_TextPr_Color;CChangesParaTextPrColor.prototype.private_SetValue=function(Value){this.Class.Value.Color=Value};CChangesParaTextPrColor.prototype.private_CreateObject=function(){return new CDocumentColor(0,0,0,false)};CChangesParaTextPrColor.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrVertAlign(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrVertAlign.prototype=
Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrVertAlign.prototype.constructor=CChangesParaTextPrVertAlign;CChangesParaTextPrVertAlign.prototype.Type=AscDFH.historyitem_TextPr_VertAlign;CChangesParaTextPrVertAlign.prototype.private_SetValue=function(Value){this.Class.Value.VertAlign=Value};CChangesParaTextPrVertAlign.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrHighLight(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,
Old,New,Color)}CChangesParaTextPrHighLight.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrHighLight.prototype.constructor=CChangesParaTextPrHighLight;CChangesParaTextPrHighLight.prototype.Type=AscDFH.historyitem_TextPr_HighLight;CChangesParaTextPrHighLight.prototype.private_SetValue=function(Value){this.Class.Value.HighLight=Value};CChangesParaTextPrHighLight.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=
2;else if(highlight_None===this.New)nFlags|=4;if(undefined===this.Old)nFlags|=8;else if(highlight_None===this.Old)nFlags|=16;Writer.WriteLong(nFlags);if(undefined!==this.New&&highlight_None!==this.New)this.New.Write_ToBinary(Writer);if(undefined!==this.Old&&highlight_None!==this.Old)this.Old.Write_ToBinary(Writer)};CChangesParaTextPrHighLight.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else if(nFlags&
4)this.New=highlight_None;else{this.New=new CDocumentColor(0,0,0);this.New.Read_FromBinary(Reader)}if(nFlags&8)this.Old=undefined;else if(nFlags&16)this.Old=highlight_None;else{this.Old=new CDocumentColor(0,0,0);this.Old.Read_FromBinary(Reader)}};CChangesParaTextPrHighLight.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrRStyle(Class,Old,New,Color){AscDFH.CChangesBaseStringProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRStyle.prototype=Object.create(AscDFH.CChangesBaseStringProperty.prototype);
CChangesParaTextPrRStyle.prototype.constructor=CChangesParaTextPrRStyle;CChangesParaTextPrRStyle.prototype.Type=AscDFH.historyitem_TextPr_RStyle;CChangesParaTextPrRStyle.prototype.private_SetValue=function(Value){this.Class.Value.RStyle=Value};CChangesParaTextPrRStyle.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSpacing(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrSpacing.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);
CChangesParaTextPrSpacing.prototype.constructor=CChangesParaTextPrSpacing;CChangesParaTextPrSpacing.prototype.Type=AscDFH.historyitem_TextPr_Spacing;CChangesParaTextPrSpacing.prototype.private_SetValue=function(Value){this.Class.Value.Spacing=Value};CChangesParaTextPrSpacing.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrDStrikeout(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrDStrikeout.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);
CChangesParaTextPrDStrikeout.prototype.constructor=CChangesParaTextPrDStrikeout;CChangesParaTextPrDStrikeout.prototype.Type=AscDFH.historyitem_TextPr_DStrikeout;CChangesParaTextPrDStrikeout.prototype.private_SetValue=function(Value){this.Class.Value.DStrikeout=Value};CChangesParaTextPrDStrikeout.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrCaps(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);
CChangesParaTextPrCaps.prototype.constructor=CChangesParaTextPrCaps;CChangesParaTextPrCaps.prototype.Type=AscDFH.historyitem_TextPr_Caps;CChangesParaTextPrCaps.prototype.private_SetValue=function(Value){this.Class.Value.Caps=Value};CChangesParaTextPrCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSmallCaps(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrSmallCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);
CChangesParaTextPrSmallCaps.prototype.constructor=CChangesParaTextPrSmallCaps;CChangesParaTextPrSmallCaps.prototype.Type=AscDFH.historyitem_TextPr_SmallCaps;CChangesParaTextPrSmallCaps.prototype.private_SetValue=function(Value){this.Class.Value.SmallCaps=Value};CChangesParaTextPrSmallCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrPosition(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrPosition.prototype=
Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrPosition.prototype.constructor=CChangesParaTextPrPosition;CChangesParaTextPrPosition.prototype.Type=AscDFH.historyitem_TextPr_Position;CChangesParaTextPrPosition.prototype.private_SetValue=function(Value){this.Class.Value.Position=Value};CChangesParaTextPrPosition.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrValue(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,
New,Color)}CChangesParaTextPrValue.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrValue.prototype.constructor=CChangesParaTextPrValue;CChangesParaTextPrValue.prototype.Type=AscDFH.historyitem_TextPr_Value;CChangesParaTextPrValue.prototype.private_SetValue=function(Value){this.Class.Value=Value};CChangesParaTextPrValue.prototype.private_CreateObject=function(){return new CTextPr};CChangesParaTextPrValue.prototype.private_IsCreateEmptyObject=function(){return true};
CChangesParaTextPrValue.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true;if(oChange.Type===this.Type)return false;if(!this.New)this.New=new CTextPr;switch(oChange.Type){case AscDFH.historyitem_TextPr_Bold:{this.New.Bold=oChange.New;break}case AscDFH.historyitem_TextPr_Italic:{this.New.Italic=oChange.New;break}case AscDFH.historyitem_TextPr_Strikeout:{this.New.Strikeout=oChange.New;break}case AscDFH.historyitem_TextPr_Underline:{this.New.Underline=oChange.New;break}case AscDFH.historyitem_TextPr_FontSize:{this.New.FontSize=
oChange.New;break}case AscDFH.historyitem_TextPr_Color:{this.New.Color=oChange.New;break}case AscDFH.historyitem_TextPr_VertAlign:{this.New.VertAlign=oChange.New;break}case AscDFH.historyitem_TextPr_HighLight:{this.New.HighLight=oChange.New;break}case AscDFH.historyitem_TextPr_RStyle:{this.New.RStyle=oChange.New;break}case AscDFH.historyitem_TextPr_Spacing:{this.New.Spacing=oChange.New;break}case AscDFH.historyitem_TextPr_DStrikeout:{this.New.DStrikeout=oChange.New;break}case AscDFH.historyitem_TextPr_Caps:{this.New.Caps=
oChange.New;break}case AscDFH.historyitem_TextPr_SmallCaps:{this.New.SmallCaps=oChange.New;break}case AscDFH.historyitem_TextPr_Position:{this.New.Position=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts:{this.New.RFonts=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Ascii:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Ascii=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.HAnsi=oChange.New;
break}case AscDFH.historyitem_TextPr_RFonts_CS:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Hint=oChange.New;break}case AscDFH.historyitem_TextPr_Lang:{this.New.Lang=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Bidi:{if(!this.New.Lang)this.New.Lang=
new CLang;this.New.Lang.Bidi=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Val=oChange.New;break}case AscDFH.historyitem_TextPr_Unifill:{this.New.Unifill=oChange.New;break}case AscDFH.historyitem_TextPr_FontSizeCS:{this.New.FontSizeCS=oChange.New;break}case AscDFH.historyitem_TextPr_Outline:{this.New.TextOutline=
oChange.New;break}case AscDFH.historyitem_TextPr_Fill:{this.New.TextFill=oChange.New;break}}return true};function CChangesParaTextPrRFonts(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFonts.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrRFonts.prototype.constructor=CChangesParaTextPrRFonts;CChangesParaTextPrRFonts.prototype.Type=AscDFH.historyitem_TextPr_RFonts;CChangesParaTextPrRFonts.prototype.private_SetValue=
function(Value){this.Class.Value.RFonts=Value};CChangesParaTextPrRFonts.prototype.private_CreateObject=function(){return new CRFonts};CChangesParaTextPrRFonts.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrRFonts.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||oChange.Type===AscDFH.historyitem_TextPr_Value)return false;if(!this.New)this.New=new CRFonts;switch(oChange.Type){case AscDFH.historyitem_TextPr_RFonts_Ascii:{this.New.Ascii=
oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{this.New.HAnsi=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_CS:{this.New.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{this.New.Hint=oChange.New;break}}return true};function CChangesParaTextPrRFontsAscii(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsAscii.prototype=
Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsAscii.prototype.constructor=CChangesParaTextPrRFontsAscii;CChangesParaTextPrRFontsAscii.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Ascii;CChangesParaTextPrRFontsAscii.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==
this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsAscii.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsAscii.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.Ascii=Value};CChangesParaTextPrRFontsAscii.prototype.Merge=
private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHAnsi(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHAnsi.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsHAnsi.prototype.constructor=CChangesParaTextPrRFontsHAnsi;CChangesParaTextPrRFontsHAnsi.prototype.Type=AscDFH.historyitem_TextPr_RFonts_HAnsi;CChangesParaTextPrRFontsHAnsi.prototype.WriteToBinary=function(Writer){var nFlags=
0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsHAnsi.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;
else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsHAnsi.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.HAnsi=Value};CChangesParaTextPrRFontsHAnsi.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsCS(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsCS.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsCS.prototype.constructor=
CChangesParaTextPrRFontsCS;CChangesParaTextPrRFontsCS.prototype.Type=AscDFH.historyitem_TextPr_RFonts_CS;CChangesParaTextPrRFontsCS.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsCS.prototype.ReadFromBinary=function(Reader){var nFlags=
Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsCS.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.CS=Value};CChangesParaTextPrRFontsCS.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,
Class,Old,New,Color)}CChangesParaTextPrRFontsEastAsia.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsEastAsia.prototype.constructor=CChangesParaTextPrRFontsEastAsia;CChangesParaTextPrRFontsEastAsia.prototype.Type=AscDFH.historyitem_TextPr_RFonts_EastAsia;CChangesParaTextPrRFontsEastAsia.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);
if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsEastAsia.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.EastAsia=
Value};CChangesParaTextPrRFontsEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHint(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHint.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrRFontsHint.prototype.constructor=CChangesParaTextPrRFontsHint;CChangesParaTextPrRFontsHint.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Hint;CChangesParaTextPrRFontsHint.prototype.private_SetValue=
function(Value){this.Class.Value.RFonts.Hint=Value};CChangesParaTextPrRFontsHint.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrLang(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLang.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrLang.prototype.constructor=CChangesParaTextPrLang;CChangesParaTextPrLang.prototype.Type=AscDFH.historyitem_TextPr_Lang;CChangesParaTextPrLang.prototype.private_SetValue=
function(Value){this.Class.Value.Lang=Value};CChangesParaTextPrLang.prototype.private_CreateObject=function(){return new CLang};CChangesParaTextPrLang.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrLang.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(AscDFH.historyitem_TextPr_Lang===oChange.Type||AscDFH.historyitem_TextPr_Value===oChange.Type)return false;if(!this.New)this.New=new CLang;switch(oChange.Type){case AscDFH.historyitem_TextPr_Lang_Bidi:{this.New.Bidi=
oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{this.New.Val=oChange.New;break}}return true};function CChangesParaTextPrLangBidi(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangBidi.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangBidi.prototype.constructor=CChangesParaTextPrLangBidi;CChangesParaTextPrLangBidi.prototype.Type=
AscDFH.historyitem_TextPr_Lang_Bidi;CChangesParaTextPrLangBidi.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Bidi=Value};CChangesParaTextPrLangBidi.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangEastAsia.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangEastAsia.prototype.constructor=CChangesParaTextPrLangEastAsia;
CChangesParaTextPrLangEastAsia.prototype.Type=AscDFH.historyitem_TextPr_Lang_EastAsia;CChangesParaTextPrLangEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.Lang.EastAsia=Value};CChangesParaTextPrLangEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangVal(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangVal.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangVal.prototype.constructor=
CChangesParaTextPrLangVal;CChangesParaTextPrLangVal.prototype.Type=AscDFH.historyitem_TextPr_Lang_Val;CChangesParaTextPrLangVal.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Val=Value};CChangesParaTextPrLangVal.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrUnifill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrUnifill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);
CChangesParaTextPrUnifill.prototype.constructor=CChangesParaTextPrUnifill;CChangesParaTextPrUnifill.prototype.Type=AscDFH.historyitem_TextPr_Unifill;CChangesParaTextPrUnifill.prototype.private_SetValue=function(Value){this.Class.Value.Unifill=Value};CChangesParaTextPrUnifill.prototype.private_CreateObject=function(){return new AscFormat.CUniFill};CChangesParaTextPrUnifill.prototype.Load=function(Color){this.Redo();var Unifill=this.Class.Value.Unifill;if(AscCommon.CollaborativeEditing&&Unifill&&Unifill.fill&&
Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_BLIP&&typeof Unifill.fill.RasterImageId==="string"&&Unifill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId)};CChangesParaTextPrUnifill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrFontSizeCS(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrFontSizeCS.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);
CChangesParaTextPrFontSizeCS.prototype.constructor=CChangesParaTextPrFontSizeCS;CChangesParaTextPrFontSizeCS.prototype.Type=AscDFH.historyitem_TextPr_FontSizeCS;CChangesParaTextPrFontSizeCS.prototype.private_SetValue=function(Value){this.Class.Value.FontSizeCS=Value};CChangesParaTextPrFontSizeCS.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrTextOutline(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextOutline.prototype=
Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextOutline.prototype.constructor=CChangesParaTextPrTextOutline;CChangesParaTextPrTextOutline.prototype.Type=AscDFH.historyitem_TextPr_Outline;CChangesParaTextPrTextOutline.prototype.private_SetValue=function(Value){this.Class.Value.TextOutline=Value};CChangesParaTextPrTextOutline.prototype.private_CreateObject=function(){return new AscFormat.CLn};CChangesParaTextPrTextOutline.prototype.Merge=private_ParaTextPrChangesOnMergeValue;
function CChangesParaTextPrTextFill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextFill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextFill.prototype.constructor=CChangesParaTextPrTextFill;CChangesParaTextPrTextFill.prototype.Type=AscDFH.historyitem_TextPr_Fill;CChangesParaTextPrTextFill.prototype.private_SetValue=function(Value){this.Class.Value.TextFill=Value};CChangesParaTextPrTextFill.prototype.private_CreateObject=
function(){return new AscFormat.CUniFill};CChangesParaTextPrTextFill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;"use strict";var drawing_Inline=1;var drawing_Anchor=2;var WRAPPING_TYPE_NONE=0;var WRAPPING_TYPE_SQUARE=1;var WRAPPING_TYPE_THROUGH=2;var WRAPPING_TYPE_TIGHT=3;var WRAPPING_TYPE_TOP_AND_BOTTOM=4;var WRAP_HIT_TYPE_POINT=0;var WRAP_HIT_TYPE_SECTION=1;var c_oAscAlignH=Asc.c_oAscAlignH;var c_oAscAlignV=Asc.c_oAscAlignV;function ParaDrawing(W,H,GraphicObj,DrawingDocument,DocumentContent,
Parent){CRunElementBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.DrawingType=drawing_Inline;this.GraphicObj=GraphicObj;this.X=0;this.Y=0;this.Width=0;this.Height=0;this.OrigX=0;this.OrigY=0;this.ShiftX=0;this.ShiftY=0;this.PageNum=0;this.LineNum=0;this.YOffset=0;this.DocumentContent=DocumentContent;this.DrawingDocument=DrawingDocument;this.Parent=Parent;this.LogicDocument=DrawingDocument?DrawingDocument.m_oLogicDocument:null;this.Distance={T:0,B:0,L:0,R:0};this.LayoutInCell=true;
this.RelativeHeight=undefined;this.SimplePos={Use:false,X:0,Y:0};this.Extent={W:W,H:H};this.EffectExtent={L:0,T:0,R:0,B:0};this.docPr=new AscFormat.CNvPr;this.SizeRelH=undefined;this.SizeRelV=undefined;this.AllowOverlap=true;this.Locked=null;this.Hidden=null;this.PositionH={RelativeFrom:c_oAscRelativeFromH.Column,Align:false,Value:0,Percent:false};this.PositionV={RelativeFrom:c_oAscRelativeFromV.Paragraph,Align:false,Value:0,Percent:false};this.PositionH_Old=undefined;this.PositionV_Old=undefined;
this.Internal_Position=new CAnchorPosition;this.wrappingType=WRAPPING_TYPE_THROUGH;this.useWrap=true;if(typeof CWrapPolygon!=="undefined")this.wrappingPolygon=new CWrapPolygon(this);this.document=editor.WordControl.m_oLogicDocument;this.drawingDocument=DrawingDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.selected=false;this.behindDoc=false;this.bNoNeedToAdd=false;this.pageIndex=-1;this.Lock=new AscCommon.CLock;this.ParaMath=null;this.SkipOnRecalculate=false;
this.LineTop=null;this.LineBottom=null;g_oTableId.Add(this,this.Id);if(this.graphicObjects){this.Set_RelativeHeight(this.graphicObjects.getZIndex());if(History.Is_On()&&!g_oTableId.m_bTurnOff)this.graphicObjects.addGraphicObject(this)}}ParaDrawing.prototype=Object.create(CRunElementBase.prototype);ParaDrawing.prototype.constructor=ParaDrawing;ParaDrawing.prototype.Type=para_Drawing;ParaDrawing.prototype.Get_Type=function(){return this.Type};ParaDrawing.prototype.Get_Width=function(){return this.Width};
ParaDrawing.prototype.Get_WidthVisible=function(){return this.WidthVisible};ParaDrawing.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible};ParaDrawing.prototype.GetSelectedContent=function(SelectedContent){if(this.GraphicObj&&this.GraphicObj.GetSelectedContent)this.GraphicObj.GetSelectedContent(SelectedContent)};ParaDrawing.prototype.GetSearchElementId=function(bNext,bCurrent){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetSearchElementId==="function")return this.GraphicObj.GetSearchElementId(bNext,
bCurrent);return null};ParaDrawing.prototype.CheckCorrect=function(){if(!this.GraphicObj)return false;if(this.GraphicObj&&this.GraphicObj.checkCorrect)return this.GraphicObj.checkCorrect();return true};ParaDrawing.prototype.GetAllDrawingObjects=function(DrawingObjects){if(null==DrawingObjects)DrawingObjects=[];if(this.GraphicObj.GetAllDrawingObjects)this.GraphicObj.GetAllDrawingObjects(DrawingObjects)};ParaDrawing.prototype.canRotate=function(){return AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canRotate==
"function"&&this.GraphicObj.canRotate()};ParaDrawing.prototype.GetParagraph=function(){return this.Get_ParentParagraph()};ParaDrawing.prototype.GetRun=function(){return this.Get_Run()};ParaDrawing.prototype.Get_Run=function(){var oParagraph=this.Get_ParentParagraph();if(oParagraph)return oParagraph.Get_DrawingObjectRun(this.Id);return null};ParaDrawing.prototype.Get_Props=function(OtherProps){var Props={};Props.Width=this.GraphicObj.extX;Props.Height=this.GraphicObj.extY;if(drawing_Inline===this.DrawingType)Props.WrappingStyle=
c_oAscWrapStyle2.Inline;else if(WRAPPING_TYPE_NONE===this.wrappingType)Props.WrappingStyle=this.behindDoc===true?c_oAscWrapStyle2.Behind:c_oAscWrapStyle2.InFront;else switch(this.wrappingType){case WRAPPING_TYPE_SQUARE:Props.WrappingStyle=c_oAscWrapStyle2.Square;break;case WRAPPING_TYPE_TIGHT:Props.WrappingStyle=c_oAscWrapStyle2.Tight;break;case WRAPPING_TYPE_THROUGH:Props.WrappingStyle=c_oAscWrapStyle2.Through;break;case WRAPPING_TYPE_TOP_AND_BOTTOM:Props.WrappingStyle=c_oAscWrapStyle2.TopAndBottom;
break;default:Props.WrappingStyle=c_oAscWrapStyle2.Inline;break}if(drawing_Inline===this.DrawingType)Props.Paddings={Left:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Right:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Top:0,Bottom:0};else{var oDistance=this.Get_Distance();Props.Paddings={Left:oDistance.L,Right:oDistance.R,Top:oDistance.T,Bottom:oDistance.B}}Props.AllowOverlap=this.AllowOverlap;Props.Position={X:this.X,Y:this.Y};Props.PositionH={RelativeFrom:this.PositionH.RelativeFrom,UseAlign:this.PositionH.Align,
Align:true===this.PositionH.Align?this.PositionH.Value:undefined,Value:true===this.PositionH.Align?0:this.PositionH.Value,Percent:this.PositionH.Percent};Props.PositionV={RelativeFrom:this.PositionV.RelativeFrom,UseAlign:this.PositionV.Align,Align:true===this.PositionV.Align?this.PositionV.Value:undefined,Value:true===this.PositionV.Align?0:this.PositionV.Value,Percent:this.PositionV.Percent};if(this.SizeRelH&&this.SizeRelH.Percent>0)Props.SizeRelH={RelativeFrom:AscFormat.ConvertRelSizeHToRelPosition(this.SizeRelH.RelativeFrom),
Value:this.SizeRelH.Percent*100>>0};if(this.SizeRelV&&this.SizeRelV.Percent>0)Props.SizeRelV={RelativeFrom:AscFormat.ConvertRelSizeVToRelPosition(this.SizeRelV.RelativeFrom),Value:this.SizeRelV.Percent*100>>0};Props.Internal_Position=this.Internal_Position;Props.Locked=this.Lock.Is_Locked();var ParentParagraph=this.Get_ParentParagraph();if(ParentParagraph&&undefined!==ParentParagraph.Parent){var DocContent=ParentParagraph.Parent;if(true===DocContent.Is_DrawingShape()||DocContent.GetTopDocumentContent()instanceof
CFootEndnote)Props.CanBeFlow=false}Props.title=this.docPr.title!==null?this.docPr.title:undefined;Props.description=this.docPr.descr!==null?this.docPr.descr:undefined;if(null!=OtherProps&&undefined!=OtherProps){if(undefined===OtherProps.Width||.001>Math.abs(Props.Width-OtherProps.Width))Props.Width=undefined;if(undefined===OtherProps.Height||.001>Math.abs(Props.Height-OtherProps.Height))Props.Height=undefined;if(undefined===OtherProps.WrappingStyle||Props.WrappingStyle!=OtherProps.WrappingStyle)Props.WrappingStyle=
undefined;if(undefined===OtherProps.ImageUrl||Props.ImageUrl!=OtherProps.ImageUrl)Props.ImageUrl=undefined;if(undefined===OtherProps.Paddings.Left||.001>Math.abs(Props.Paddings.Left-OtherProps.Paddings.Left))Props.Paddings.Left=undefined;if(undefined===OtherProps.Paddings.Right||.001>Math.abs(Props.Paddings.Right-OtherProps.Paddings.Right))Props.Paddings.Right=undefined;if(undefined===OtherProps.Paddings.Top||.001>Math.abs(Props.Paddings.Top-OtherProps.Paddings.Top))Props.Paddings.Top=undefined;if(undefined===
OtherProps.Paddings.Bottom||.001>Math.abs(Props.Paddings.Bottom-OtherProps.Paddings.Bottom))Props.Paddings.Bottom=undefined;if(undefined===OtherProps.AllowOverlap||Props.AllowOverlap!=OtherProps.AllowOverlap)Props.AllowOverlap=undefined;if(undefined===OtherProps.Position.X||.001>Math.abs(Props.Position.X-OtherProps.Position.X))Props.Position.X=undefined;if(undefined===OtherProps.Position.Y||.001>Math.abs(Props.Position.Y-OtherProps.Position.Y))Props.Position.Y=undefined;if(undefined===OtherProps.PositionH.RelativeFrom||
Props.PositionH.RelativeFrom!=OtherProps.PositionH.RelativeFrom)Props.PositionH.RelativeFrom=undefined;if(undefined===OtherProps.PositionH.UseAlign||Props.PositionH.UseAlign!=OtherProps.PositionH.UseAlign)Props.PositionH.UseAlign=undefined;if(Props.PositionH.RelativeFrom===OtherProps.PositionH.RelativeFrom&&Props.PositionH.UseAlign===OtherProps.PositionH.UseAlign){if(true!=Props.PositionH.UseAlign&&.001>Math.abs(Props.PositionH.Value-OtherProps.PositionH.Value))Props.PositionH.Value=undefined;if(true===
Props.PositionH.UseAlign&&Props.PositionH.Align!=OtherProps.PositionH.Align)Props.PositionH.Align=undefined}if(undefined===OtherProps.PositionV.RelativeFrom||Props.PositionV.RelativeFrom!=OtherProps.PositionV.RelativeFrom)Props.PositionV.RelativeFrom=undefined;if(undefined===OtherProps.PositionV.UseAlign||Props.PositionV.UseAlign!=OtherProps.PositionV.UseAlign)Props.PositionV.UseAlign=undefined;if(Props.PositionV.RelativeFrom===OtherProps.PositionV.RelativeFrom&&Props.PositionV.UseAlign===OtherProps.PositionV.UseAlign){if(true!=
Props.PositionV.UseAlign&&.001>Math.abs(Props.PositionV.Value-OtherProps.PositionV.Value))Props.PositionV.Value=undefined;if(true===Props.PositionV.UseAlign&&Props.PositionV.Align!=OtherProps.PositionV.Align)Props.PositionV.Align=undefined}if(false===OtherProps.Locked)Props.Locked=false;if(false===OtherProps.CanBeFlow||false===Props.CanBeFlow)Props.CanBeFlow=false;else Props.CanBeFlow=true;if(undefined===OtherProps.title||Props.title!==OtherProps.title)Props.title=undefined;if(undefined===OtherProps.description||
Props.description!==OtherProps.description)Props.description=undefined}return Props};ParaDrawing.prototype.Is_UseInDocument=function(){if(this.Parent){var Run=this.Parent.Get_DrawingObjectRun(this.Id);if(Run)return Run.Is_UseInDocument(this.Get_Id())}return false};ParaDrawing.prototype.IsUseInDocument=function(){return this.Is_UseInDocument()};ParaDrawing.prototype.CheckGroupSizes=function(){if(this.GraphicObj&&this.GraphicObj.CheckGroupSizes)this.GraphicObj.CheckGroupSizes()};ParaDrawing.prototype.Set_DrawingType=
function(DrawingType){History.Add(new CChangesParaDrawingDrawingType(this,this.DrawingType,DrawingType));this.DrawingType=DrawingType};ParaDrawing.prototype.Set_WrappingType=function(WrapType){History.Add(new CChangesParaDrawingWrappingType(this,this.wrappingType,WrapType));this.wrappingType=WrapType};ParaDrawing.prototype.Set_Distance=function(L,T,R,B){var oDistance=this.Get_Distance();if(!AscFormat.isRealNumber(L))L=oDistance.L;if(!AscFormat.isRealNumber(T))T=oDistance.T;if(!AscFormat.isRealNumber(R))R=
oDistance.R;if(!AscFormat.isRealNumber(B))B=oDistance.B;History.Add(new CChangesParaDrawingDistance(this,{Left:this.Distance.L,Top:this.Distance.T,Right:this.Distance.R,Bottom:this.Distance.B},{Left:L,Top:T,Right:R,Bottom:B}));this.Distance.L=L;this.Distance.R=R;this.Distance.T=T;this.Distance.B=B};ParaDrawing.prototype.Set_AllowOverlap=function(AllowOverlap){History.Add(new CChangesParaDrawingAllowOverlap(this,this.AllowOverlap,AllowOverlap));this.AllowOverlap=AllowOverlap};ParaDrawing.prototype.Set_PositionH=
function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionH(this,{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionH.RelativeFrom=RelativeFrom;this.PositionH.Align=
Align;this.PositionH.Value=_Value;this.PositionH.Percent=_Percent};ParaDrawing.prototype.Set_PositionV=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionV(this,{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent},{RelativeFrom:RelativeFrom,
Align:Align,Value:_Value,Percent:_Percent}));this.PositionV.RelativeFrom=RelativeFrom;this.PositionV.Align=Align;this.PositionV.Value=_Value;this.PositionV.Percent=_Percent};ParaDrawing.prototype.GetPositionH=function(){return{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent}};ParaDrawing.prototype.GetPositionV=function(){return{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,
Percent:this.PositionV.Percent}};ParaDrawing.prototype.Set_BehindDoc=function(BehindDoc){History.Add(new CChangesParaDrawingBehindDoc(this,this.behindDoc,BehindDoc));this.behindDoc=BehindDoc};ParaDrawing.prototype.Set_GraphicObject=function(graphicObject){var oldId=AscCommon.isRealObject(this.GraphicObj)?this.GraphicObj.Get_Id():null;var newId=AscCommon.isRealObject(graphicObject)?graphicObject.Get_Id():null;History.Add(new CChangesParaDrawingGraphicObject(this,oldId,newId));if(graphicObject)graphicObject.handleUpdateExtents();
this.GraphicObj=graphicObject};ParaDrawing.prototype.setSimplePos=function(use,x,y){History.Add(new CChangesParaDrawingSimplePos(this,{Use:this.SimplePos.Use,X:this.SimplePos.X,Y:this.SimplePos.Y},{Use:use,X:x,Y:y}));this.SimplePos.Use=use;this.SimplePos.X=x;this.SimplePos.Y=y};ParaDrawing.prototype.setExtent=function(extX,extY){History.Add(new CChangesParaDrawingExtent(this,{W:this.Extent.W,H:this.Extent.H},{W:extX,H:extY}));this.Extent.W=extX;this.Extent.H=extY};ParaDrawing.prototype.addWrapPolygon=
function(wrapPolygon){History.Add(new CChangesParaDrawingWrapPolygon(this,this.wrappingPolygon,wrapPolygon));this.wrappingPolygon=wrapPolygon};ParaDrawing.prototype.Set_Locked=function(bLocked){History.Add(new CChangesParaDrawingLocked(this,this.Locked,bLocked));this.Locked=bLocked};ParaDrawing.prototype.Set_RelativeHeight=function(nRelativeHeight){History.Add(new CChangesParaDrawingRelativeHeight(this,this.RelativeHeight,nRelativeHeight));this.Set_RelativeHeight2(nRelativeHeight)};ParaDrawing.prototype.Set_RelativeHeight2=
function(nRelativeHeight){this.RelativeHeight=nRelativeHeight;if(this.graphicObjects&&AscFormat.isRealNumber(nRelativeHeight)&&nRelativeHeight>this.graphicObjects.maximalGraphicObjectZIndex)this.graphicObjects.maximalGraphicObjectZIndex=nRelativeHeight};ParaDrawing.prototype.setEffectExtent=function(L,T,R,B){var oEE=this.EffectExtent;History.Add(new CChangesParaDrawingEffectExtent(this,{L:oEE.L,T:oEE.T,R:oEE.R,B:oEE.B},{L:L,T:T,R:R,B:B}));this.EffectExtent.L=L;this.EffectExtent.T=T;this.EffectExtent.R=
R;this.EffectExtent.B=B};ParaDrawing.prototype.Set_Parent=function(oParent){History.Add(new CChangesParaDrawingParent(this,this.Parent,oParent));this.Parent=oParent};ParaDrawing.prototype.IsWatermark=function(){if(!this.GraphicObj)return false;if(this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_Shape&&this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ImageShape)return false;if(this.Is_Inline())return false;var oParagraph=this.GetParagraph();if(!(oParagraph instanceof Paragraph))return false;
var oContent=oParagraph.Parent;if(!oContent||oContent.Is_DrawingShape(false))return false;var oHdrFtr=oContent.IsHdrFtr(true);if(!oHdrFtr)return false;var oRun=this.Get_Run();if(!oRun)return false;var arrDocPos=oRun.GetDocumentPositionFromObject();for(var nIndex=0,nCount=arrDocPos.length;nIndex<nCount;++nIndex){var oClass=arrDocPos[nIndex].Class;var oSdt=null;if(oClass instanceof CDocumentContent&&oClass.Parent instanceof CBlockLevelSdt)oSdt=oClass.Parent;else if(oClass instanceof CInlineLevelSdt)oSdt=
oClass;if(oSdt){var oPr=oSdt.Pr;if(AscCommon.isRealObject(oPr)&&AscCommon.isRealObject(oPr.DocPartObj)&&oPr.DocPartObj.Gallery==="Watermarks")return true}}return false};ParaDrawing.prototype.Set_ParaMath=function(ParaMath){History.Add(new CChangesParaDrawingParaMath(this,this.ParaMath,ParaMath));this.ParaMath=ParaMath};ParaDrawing.prototype.Set_LayoutInCell=function(LayoutInCell){if(this.LayoutInCell===LayoutInCell)return;History.Add(new CChangesParaDrawingLayoutInCell(this,this.LayoutInCell,LayoutInCell));
this.LayoutInCell=LayoutInCell};ParaDrawing.prototype.SetSizeRelH=function(oSize){History.Add(new CChangesParaDrawingSizeRelH(this,this.SizeRelH,oSize));this.SizeRelH=oSize};ParaDrawing.prototype.SetSizeRelV=function(oSize){History.Add(new CChangesParaDrawingSizeRelV(this,this.SizeRelV,oSize));this.SizeRelV=oSize};ParaDrawing.prototype.getXfrmExtX=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&
AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX))return this.GraphicObj.spPr.xfrm.extX;if(AscFormat.isRealNumber(this.Extent.W))return this.Extent.W;return 0};ParaDrawing.prototype.getXfrmExtY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY))return this.GraphicObj.spPr.xfrm.extY;if(AscFormat.isRealNumber(this.Extent.H))return this.Extent.H;
return 0};ParaDrawing.prototype.getXfrmRot=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))return this.GraphicObj.spPr.xfrm.rot;return 0};ParaDrawing.prototype.Get_Bounds=function(){var InsL,InsT,InsR,InsB;InsL=0;InsT=0;InsR=0;InsB=0;if(!this.Is_Inline()){var oDistance=this.Get_Distance();if(oDistance){InsL=oDistance.L;InsT=oDistance.T;InsR=
oDistance.R;InsB=oDistance.B}}var ExtX=this.getXfrmExtX();var ExtY=this.getXfrmExtY();var Rot=this.getXfrmRot();var X,Y,W,H;if(AscFormat.checkNormalRotate(Rot)){X=this.X;Y=this.Y;W=ExtX;H=ExtY}else{X=this.X+ExtX/2-ExtY/2;Y=this.Y+ExtY/2-ExtX/2;W=ExtY;H=ExtX}return{Left:X-this.EffectExtent.L-InsL,Top:Y-this.EffectExtent.T-InsT,Bottom:Y+H+this.EffectExtent.B+InsB,Right:X+W+this.EffectExtent.R+InsR}};ParaDrawing.prototype.Search=function(Str,Props,SearchEngine,Type){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.Search==="function")this.GraphicObj.Search(Str,Props,SearchEngine,Type)};ParaDrawing.prototype.Set_Props=function(Props){var bCheckWrapPolygon=false;var isPictureCC=false;var oRun=this.GetRun();if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=0,nCount=arrContentControls.length;nIndex<nCount;++nIndex)if(arrContentControls[nIndex].IsPicture()){isPictureCC=true;break}}if(undefined!=Props.WrappingStyle&&!isPictureCC){if(drawing_Inline===this.DrawingType&&
c_oAscWrapStyle2.Inline!=Props.WrappingStyle&&undefined===Props.Paddings)this.Set_Distance(3.2,0,3.2,0);this.Set_DrawingType(c_oAscWrapStyle2.Inline===Props.WrappingStyle?drawing_Inline:drawing_Anchor);if(c_oAscWrapStyle2.Inline===Props.WrappingStyle)if(AscCommon.isRealObject(this.GraphicObj.bounds)&&AscFormat.isRealNumber(this.GraphicObj.bounds.w)&&AscFormat.isRealNumber(this.GraphicObj.bounds.h))this.CheckWH();if(c_oAscWrapStyle2.Behind===Props.WrappingStyle||c_oAscWrapStyle2.InFront===Props.WrappingStyle){this.Set_WrappingType(WRAPPING_TYPE_NONE);
this.Set_BehindDoc(c_oAscWrapStyle2.Behind===Props.WrappingStyle?true:false)}else{switch(Props.WrappingStyle){case c_oAscWrapStyle2.Square:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);break;case c_oAscWrapStyle2.Tight:{bCheckWrapPolygon=true;this.Set_WrappingType(WRAPPING_TYPE_TIGHT);break}case c_oAscWrapStyle2.Through:{this.Set_WrappingType(WRAPPING_TYPE_THROUGH);bCheckWrapPolygon=true;break}case c_oAscWrapStyle2.TopAndBottom:this.Set_WrappingType(WRAPPING_TYPE_TOP_AND_BOTTOM);break;default:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);
break}this.Set_BehindDoc(false)}}if(undefined!=Props.Paddings)this.Set_Distance(Props.Paddings.Left,Props.Paddings.Top,Props.Paddings.Right,Props.Paddings.Bottom);if(undefined!=Props.AllowOverlap)this.Set_AllowOverlap(Props.AllowOverlap);if(undefined!=Props.PositionH)this.Set_PositionH(Props.PositionH.RelativeFrom,Props.PositionH.UseAlign,true===Props.PositionH.UseAlign?Props.PositionH.Align:Props.PositionH.Value,Props.PositionH.Percent);if(undefined!=Props.PositionV)this.Set_PositionV(Props.PositionV.RelativeFrom,
Props.PositionV.UseAlign,true===Props.PositionV.UseAlign?Props.PositionV.Align:Props.PositionV.Value,Props.PositionV.Percent);if(undefined!=Props.SizeRelH)this.SetSizeRelH({RelativeFrom:AscFormat.ConvertRelPositionHToRelSize(Props.SizeRelH.RelativeFrom),Percent:Props.SizeRelH.Value/100});if(undefined!=Props.SizeRelV)this.SetSizeRelV({RelativeFrom:AscFormat.ConvertRelPositionVToRelSize(Props.SizeRelV.RelativeFrom),Percent:Props.SizeRelV.Value/100});if(this.SizeRelH&&!this.SizeRelV)this.SetSizeRelV({RelativeFrom:AscCommon.c_oAscSizeRelFromV.sizerelfromvPage,
Percent:0});if(this.SizeRelV&&!this.SizeRelH)this.SetSizeRelH({RelativeFrom:AscCommon.c_oAscSizeRelFromH.sizerelfromhPage,Percent:0});if(bCheckWrapPolygon)this.Check_WrapPolygon();if(undefined!=Props.description)this.docPr.setDescr(Props.description);if(undefined!=Props.title)this.docPr.setTitle(Props.title)};ParaDrawing.prototype.CheckWH=function(){if(!this.GraphicObj)return;var oldExtW=this.Extent.W;var oldExtH=this.Extent.H;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&
AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){this.Extent.W=this.GraphicObj.spPr.xfrm.extX;this.Extent.H=this.GraphicObj.spPr.xfrm.extY}this.GraphicObj.recalculate();this.Extent.W=oldExtW;this.Extent.H=oldExtH;var extX,extY,rot;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm){if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){extX=this.GraphicObj.spPr.xfrm.extX;extY=this.GraphicObj.spPr.xfrm.extY}else{extX=5;extY=5}if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))rot=
this.GraphicObj.spPr.xfrm.rot;else rot=0}else{extX=5;extY=5;rot=0}this.setExtent(extX,extY);var EEL=0,EET=0,EER=0,EEB=0;{var xc=this.GraphicObj.localTransform.TransformPointX(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var yc=this.GraphicObj.localTransform.TransformPointY(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var oBounds=this.GraphicObj.bounds;var LineCorrect=0;if(this.GraphicObj.pen&&this.GraphicObj.pen.Fill&&this.GraphicObj.pen.Fill.fill){LineCorrect=this.GraphicObj.pen.w==null?12700:
parseInt(this.GraphicObj.pen.w);LineCorrect/=72E3}var l=oBounds.x;var r=l+oBounds.w;var t=oBounds.y;var b=t+oBounds.h;var startX,startY;if(!AscFormat.checkNormalRotate(rot)){var temp=extX;extX=extY;extY=temp}startX=xc-extX/2;startY=yc-extY/2;if(l>startX)l=startX;if(r<startX+extX)r=startX+extX;if(t>startY)t=startY;if(b<startY+extY)b=startY+extY;EEL=xc-extX/2-l+LineCorrect;EET=yc-extY/2-t+LineCorrect;EER=r+LineCorrect-(xc+extX/2);EEB=b+LineCorrect-(yc+extY/2)}this.setEffectExtent(EEL,EET,EER,EEB);this.Check_WrapPolygon()};
ParaDrawing.prototype.Check_WrapPolygon=function(){if((this.wrappingType===WRAPPING_TYPE_TIGHT||this.wrappingType===WRAPPING_TYPE_THROUGH)&&this.wrappingPolygon&&!this.wrappingPolygon.edited){this.GraphicObj.recalculate();this.wrappingPolygon.setArrRelPoints(this.wrappingPolygon.calculate(this.GraphicObj))}};ParaDrawing.prototype.Draw=function(X,Y,pGraphics,PDSE){var nPageIndex=null;if(AscCommon.isRealObject(PDSE))nPageIndex=PDSE.Page;if(pGraphics.Start_Command){pGraphics.m_aDrawings.push(new AscFormat.ParaDrawingStruct(undefined,
this));return}if(this.Is_Inline()){pGraphics.shapePageIndex=nPageIndex;this.draw(pGraphics,PDSE);pGraphics.shapePageIndex=null}if(pGraphics.End_Command)pGraphics.End_Command()};ParaDrawing.prototype.Measure=function(){if(!this.GraphicObj){this.Width=0;this.Height=0;return}if(AscFormat.isRealNumber(this.Extent.W)&&AscFormat.isRealNumber(this.Extent.H)&&(!this.GraphicObj.checkAutofit||!this.GraphicObj.checkAutofit())&&!this.SizeRelH&&!this.SizeRelV){var oEffectExtent=this.EffectExtent;var W,H;if(AscFormat.isRealNumber(this.GraphicObj.rot))if(AscFormat.checkNormalRotate(this.GraphicObj.rot)){W=
this.Extent.W;H=this.Extent.H}else{W=this.Extent.H;H=this.Extent.W}else{W=this.Extent.W;H=this.Extent.H}this.Width=W+AscFormat.getValOrDefault(oEffectExtent.L,0)+AscFormat.getValOrDefault(oEffectExtent.R,0);this.Height=H+AscFormat.getValOrDefault(oEffectExtent.T,0)+AscFormat.getValOrDefault(oEffectExtent.B,0);this.WidthVisible=this.Width}else{this.GraphicObj.recalculate();if(this.GraphicObj.recalculateText)this.GraphicObj.recalculateText();if(this.PositionH.UseAlign||this.Is_Inline())this.Width=this.GraphicObj.bounds.w;
else this.Width=this.GraphicObj.extX;this.WidthVisible=this.Width;if(this.PositionV.UseAlign||this.Is_Inline())this.Height=this.GraphicObj.bounds.h;else this.Height=this.GraphicObj.extY}};ParaDrawing.prototype.SaveRecalculateObject=function(Copy){var DrawingObj={};DrawingObj.Type=this.Type;DrawingObj.DrawingType=this.DrawingType;DrawingObj.WrappingType=this.wrappingType;if(drawing_Anchor===this.Get_DrawingType()&&true===this.Use_TextWrap()){var oDistance=this.Get_Distance();DrawingObj.FlowPos={X:this.X-
oDistance.L,Y:this.Y-oDistance.T,W:this.Width+oDistance.R,H:this.Height+oDistance.B}}DrawingObj.PageNum=this.PageNum;DrawingObj.X=this.X;DrawingObj.Y=this.Y;DrawingObj.spRecaclcObject=this.GraphicObj.getRecalcObject();return DrawingObj};ParaDrawing.prototype.LoadRecalculateObject=function(RecalcObj){this.updatePosition3(RecalcObj.PageNum,RecalcObj.X,RecalcObj.Y);this.GraphicObj.setRecalcObject(RecalcObj.spRecaclcObject)};ParaDrawing.prototype.Reassign_ImageUrls=function(mapUrls){if(this.GraphicObj)this.GraphicObj.Reassign_ImageUrls(mapUrls)};
ParaDrawing.prototype.PrepareRecalculateObject=function(){};ParaDrawing.prototype.Is_RealContent=function(){return true};ParaDrawing.prototype.Can_AddNumbering=function(){if(drawing_Inline===this.DrawingType)return true;return false};ParaDrawing.prototype.Copy=function(oPr){var c=new ParaDrawing(this.Extent.W,this.Extent.H,null,editor.WordControl.m_oLogicDocument.DrawingDocument,null,null);c.Set_DrawingType(this.DrawingType);if(AscCommon.isRealObject(this.GraphicObj)){var oCopyPr=new AscFormat.CCopyObjectProperties;
oCopyPr.contentCopyPr=oPr;c.Set_GraphicObject(this.GraphicObj.copy(oCopyPr));c.GraphicObj.setParent(c)}var d=this.Distance;c.Set_PositionH(this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent);c.Set_PositionV(this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);c.Set_Distance(d.L,d.T,d.R,d.B);c.Set_AllowOverlap(this.AllowOverlap);c.Set_WrappingType(this.wrappingType);if(this.wrappingPolygon)c.wrappingPolygon.fromOther(this.wrappingPolygon);
c.Set_BehindDoc(this.behindDoc);c.Set_RelativeHeight(this.RelativeHeight);if(this.SizeRelH)c.SetSizeRelH({RelativeFrom:this.SizeRelH.RelativeFrom,Percent:this.SizeRelH.Percent});if(this.SizeRelV)c.SetSizeRelV({RelativeFrom:this.SizeRelV.RelativeFrom,Percent:this.SizeRelV.Percent});if(AscFormat.isRealNumber(this.Extent.W)&&AscFormat.isRealNumber(this.Extent.H))c.setExtent(this.Extent.W,this.Extent.H);var EE=this.EffectExtent;if(EE.L>0||EE.T>0||EE.R>0||EE.B>0)c.setEffectExtent(EE.L,EE.T,EE.R,EE.B);
c.docPr.setFromOther(this.docPr);if(this.ParaMath)c.Set_ParaMath(this.ParaMath.Copy());return c};ParaDrawing.prototype.IsEqual=function(oElement){return false};ParaDrawing.prototype.Get_Id=function(){return this.Id};ParaDrawing.prototype.GetId=function(){return this.Id};ParaDrawing.prototype.setParagraphTabs=function(tabs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphTabs==="function")this.GraphicObj.setParagraphTabs(tabs)};ParaDrawing.prototype.IsMovingTableBorder=
function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.IsMovingTableBorder==="function")return this.GraphicObj.IsMovingTableBorder();return false};ParaDrawing.prototype.SetVerticalClip=function(Top,Bottom){this.LineTop=Top;this.LineBottom=Bottom};ParaDrawing.prototype.Update_Position=function(Paragraph,ParaLayout,PageLimits,PageLimitsOrigin,LineNum){if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom2;this.PositionH.Align=this.PositionH_Old.Align2;
this.PositionH.Value=this.PositionH_Old.Value2;this.PositionH.Percent=this.PositionH_Old.Percent2}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom2;this.PositionV.Align=this.PositionV_Old.Align2;this.PositionV.Value=this.PositionV_Old.Value2;this.PositionV.Percent=this.PositionV_Old.Percent2}var oDocumentContent=this.Parent&&this.Parent.Parent;if(oDocumentContent&&oDocumentContent.IsBlockLevelSdtContent())oDocumentContent=oDocumentContent.Parent.Parent;
this.Parent=Paragraph;this.DocumentContent=oDocumentContent;var PageNum=ParaLayout.PageNum;var OtherFlowObjects=editor.WordControl.m_oLogicDocument.DrawingObjects.getAllFloatObjectsOnPage(PageNum,this.Parent.Parent);var bInline=this.Is_Inline();this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,ParaLayout,PageLimits);this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent);
this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);var bCorrect=false;if(oDocumentContent&&oDocumentContent.IsTableCellContent&&oDocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(bInline,PageLimits,this.AllowOverlap,this.Use_TextWrap(),OtherFlowObjects,
bCorrect);this.GraphicObj.bounds.l=this.GraphicObj.bounds.x+this.Internal_Position.CalcX;this.GraphicObj.bounds.r=this.GraphicObj.bounds.x+this.GraphicObj.bounds.w+this.Internal_Position.CalcX;this.GraphicObj.bounds.t=this.GraphicObj.bounds.y+this.Internal_Position.CalcY;this.GraphicObj.bounds.b=this.GraphicObj.bounds.y+this.GraphicObj.bounds.h+this.Internal_Position.CalcY;var OldPageNum=this.PageNum;this.PageNum=PageNum;this.LineNum=LineNum;this.X=this.Internal_Position.CalcX;this.Y=this.Internal_Position.CalcY;
if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom;this.PositionH.Align=this.PositionH_Old.Align;this.PositionH.Value=this.PositionH_Old.Value;this.PositionH.Percent=this.PositionH_Old.Percent;var Value=this.Internal_Position.Calculate_X_Value(this.PositionH_Old.RelativeFrom);this.Set_PositionH(this.PositionH_Old.RelativeFrom,false,Value,false);this.X=this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,
this.PositionH.Percent)}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom;this.PositionV.Align=this.PositionV_Old.Align;this.PositionV.Value=this.PositionV_Old.Value;this.PositionV.Percent=this.PositionV_Old.Percent;var Value=this.Internal_Position.Calculate_Y_Value(this.PositionV_Old.RelativeFrom);this.Set_PositionV(this.PositionV_Old.RelativeFrom,false,Value,false);this.Y=this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,
this.PositionV.Value,this.PositionV.Percent)}this.OrigX=this.X;this.OrigY=this.Y;this.ShiftX=0;this.ShiftY=0;this.updatePosition3(this.PageNum,this.X,this.Y,OldPageNum);this.useWrap=this.Use_TextWrap()};ParaDrawing.prototype.GetClipRect=function(){if(this.Is_Inline()||this.Use_TextWrap()){var oCell;if(this.DocumentContent&&(oCell=this.DocumentContent.IsTableCellContent(true))){var arrPages=oCell.GetCurPageByAbsolutePage(this.PageNum);for(var nIndex=0,nCount=arrPages.length;nIndex<nCount;++nIndex){var oPageBounds=
oCell.GetPageBounds(arrPages[nIndex]);if(this.GraphicObj.bounds.isIntersect(oPageBounds.Left,oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom))return new AscFormat.CGraphicBounds(oPageBounds.Left,oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom)}}}return null};ParaDrawing.prototype.Update_PositionYHeaderFooter=function(TopMarginY,BottomMarginY){this.Internal_Position.Update_PositionYHeaderFooter(TopMarginY,BottomMarginY);this.Internal_Position.Calculate_Y(this.Is_Inline(),this.PositionV.RelativeFrom,
this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);this.OrigY=this.Internal_Position.CalcY;this.Y=this.OrigY+this.ShiftY;this.updatePosition3(this.PageNum,this.X,this.Y,this.PageNum)};ParaDrawing.prototype.Reset_SavedPosition=function(){this.PositionV_Old=undefined;this.PositionH_Old=undefined};ParaDrawing.prototype.setParagraphBorders=function(val){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphBorders==="function")this.GraphicObj.setParagraphBorders(val)};
ParaDrawing.prototype.deselect=function(){this.selected=false;if(this.GraphicObj&&this.GraphicObj.deselect)this.GraphicObj.deselect()};ParaDrawing.prototype.updatePosition3=function(pageIndex,x,y,oldPageNum){var _x=x,_y=y;this.graphicObjects.removeById(pageIndex,this.Get_Id());if(AscFormat.isRealNumber(oldPageNum))this.graphicObjects.removeById(oldPageNum,this.Get_Id());var bChangePageIndex=this.pageIndex!==pageIndex;this.setPageIndex(pageIndex);if(typeof this.GraphicObj.setStartPage==="function"){var bIsHfdFtr=
this.DocumentContent&&this.DocumentContent.IsHdrFtr();this.GraphicObj.setStartPage(pageIndex,bIsHfdFtr,bIsHfdFtr||bChangePageIndex)}if(!(this.DocumentContent&&this.DocumentContent.IsHdrFtr()&&this.DocumentContent.Get_StartPage_Absolute()!==pageIndex)){this.graphicObjects.addObjectOnPage(pageIndex,this.GraphicObj);this.bNoNeedToAdd=false}else this.bNoNeedToAdd=true;if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.GraphicObj.posX)&&AscFormat.isRealNumber(this.GraphicObj.posY))||
!(Math.abs(this.GraphicObj.posX-_x)<MOVE_DELTA&&Math.abs(this.GraphicObj.posY-_y)<MOVE_DELTA))this.GraphicObj.updatePosition(_x,_y);if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.wrappingPolygon.posX)&&AscFormat.isRealNumber(this.wrappingPolygon.posY))||!(Math.abs(this.wrappingPolygon.posX-_x)<MOVE_DELTA&&Math.abs(this.wrappingPolygon.posY-_y)<MOVE_DELTA))this.wrappingPolygon.updatePosition(_x,_y);this.calculateSnapArrays()};ParaDrawing.prototype.calculateAfterChangeTheme=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.calculateAfterChangeTheme==="function")this.GraphicObj.calculateAfterChangeTheme()};ParaDrawing.prototype.selectionIsEmpty=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.selectionIsEmpty==="function")return this.GraphicObj.selectionIsEmpty();return false};ParaDrawing.prototype.recalculateDocContent=function(){};ParaDrawing.prototype.Shift=function(Dx,Dy){this.ShiftX=Dx;this.ShiftY=Dy;this.X=this.OrigX+Dx;this.Y=this.OrigY+Dy;this.updatePosition3(this.PageNum,
this.X,this.Y)};ParaDrawing.prototype.IsLayoutInCell=function(){if(this.LogicDocument&&this.LogicDocument.GetCompatibilityMode()>=AscCommon.document_compatibility_mode_Word15)return true;return this.LayoutInCell};ParaDrawing.prototype.Get_Distance=function(){var oDist=this.Distance;return new AscFormat.CDistance(AscFormat.getValOrDefault(oDist.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.T,0),AscFormat.getValOrDefault(oDist.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.B,
0))};ParaDrawing.prototype.Set_XYForAdd=function(X,Y,NearPos,PageNum){if(null!==NearPos){var Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,true,true);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.TurnOff_InterfaceEvents();oLogicDocument.Recalculate();oLogicDocument.TurnOn_InterfaceEvents(false);this.SetSkipOnRecalculate(false)}if(null!==
nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,true,true)}};ParaDrawing.prototype.SetSkipOnRecalculate=function(isSkip){this.SkipOnRecalculate=isSkip};ParaDrawing.prototype.IsSkipOnRecalculate=function(){return this.SkipOnRecalculate};ParaDrawing.prototype.Set_XY=function(X,Y,Paragraph,PageNum,bResetAlign){if(Paragraph){var PageNumOld=this.PageNum;var ContentPos=
Paragraph.Get_DrawingObjectContentPos(this.Get_Id());if(null===ContentPos)return;var Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.Recalculate();this.SetSkipOnRecalculate(false)}if(null!==
nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);if(!this.LogicDocument||null===this.LogicDocument.FullRecalc.Id||PageNum<this.LogicDocument.FullRecalc.PageIndex&&PageNumOld<this.LogicDocument.FullRecalc.PageIndex)Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false)}};ParaDrawing.prototype.private_SetXYByLayout=function(X,Y,PageNum,
Layout,bChangeX,bChangeY){if(!Layout)return;this.PageNum=PageNum;this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,Layout.ParagraphLayout,Layout.PageLimitsOrigin);this.Internal_Position.Calculate_X(false,c_oAscRelativeFromH.Page,false,X-Layout.PageLimitsOrigin.X,false);this.Internal_Position.Calculate_Y(false,c_oAscRelativeFromV.Page,false,Y-Layout.PageLimitsOrigin.Y,false);var bCorrect=false;if(this.DocumentContent&&this.DocumentContent.IsTableCellContent&&
this.DocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(false,Layout.PageLimits,this.AllowOverlap,this.Use_TextWrap(),[],bCorrect);if(true===bChangeX){this.X=this.Internal_Position.CalcX;var ValueX=this.Internal_Position.Calculate_X_Value(this.PositionH.RelativeFrom);this.Set_PositionH(this.PositionH.RelativeFrom,false,ValueX,false);
this.X=this.Internal_Position.Calculate_X(false,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(true===bChangeY){this.Y=this.Internal_Position.CalcY;var ValueY=this.Internal_Position.Calculate_Y_Value(this.PositionV.RelativeFrom);this.Set_PositionV(this.PositionV.RelativeFrom,false,ValueY,false);this.Y=this.Internal_Position.Calculate_Y(false,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}};ParaDrawing.prototype.Get_DrawingType=
function(){return this.DrawingType};ParaDrawing.prototype.Is_Inline=function(){if(this.Parent&&this.Parent.Get_ParentTextTransform&&this.Parent.Get_ParentTextTransform())return true;return drawing_Inline===this.DrawingType?true:false};ParaDrawing.prototype.IsInline=function(){return this.Is_Inline()};ParaDrawing.prototype.Use_TextWrap=function(){if(!this.Parent||!this.Parent.Get_FramePr||null!==this.Parent.Get_FramePr()&&undefined!==this.Parent.Get_FramePr())return false;return drawing_Anchor===this.DrawingType&&
!(this.wrappingType===WRAPPING_TYPE_NONE)};ParaDrawing.prototype.IsUseTextWrap=function(){return this.Use_TextWrap()};ParaDrawing.prototype.Draw_Selection=function(){var Padding=this.DrawingDocument.GetMMPerDot(6);var extX,extY;if(this.GraphicObj){extX=this.GraphicObj.extX;extY=this.GraphicObj.extY}else{extX=this.getXfrmExtX();extY=this.getXfrmExtY()}var rot=this.getXfrmRot();if(AscFormat.checkNormalRotate(rot))this.DrawingDocument.AddPageSelection(this.PageNum,this.X-this.EffectExtent.L-Padding,
this.Y-this.EffectExtent.T-Padding,this.EffectExtent.L+extX+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extY+this.EffectExtent.B+2*Padding);else this.DrawingDocument.AddPageSelection(this.PageNum,this.X+extX/2-extY/2-this.EffectExtent.L-Padding,this.Y+extY/2-extX/2-this.EffectExtent.T-Padding,this.EffectExtent.L+extY+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extX+this.EffectExtent.B+2*Padding)};ParaDrawing.prototype.CanInsertToPos=function(oAnchorPos){if(!oAnchorPos||!oAnchorPos.Paragraph||
!oAnchorPos.Paragraph.Parent)return false;return!((this.IsShape()||this.IsGroup())&&(true===oAnchorPos.Paragraph.Parent.Is_DrawingShape()||true===oAnchorPos.Paragraph.Parent.IsFootnote()))};ParaDrawing.prototype.OnEnd_MoveInline=function(NearPos){if(!this.Parent)return;NearPos.Paragraph.Check_NearestPos(NearPos);var oRun=this.GetRun();var oPictureCC=false;if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=
arrContentControls[nIndex];break}}var oDstRun=null;var arrClasses=NearPos.Paragraph.GetClassesByPos(NearPos.ContentPos);for(var nIndex=arrClasses.length-1;nIndex>=0;--nIndex)if(arrClasses[nIndex]instanceof ParaRun){oDstRun=arrClasses[nIndex];break}if(!oDstRun||oPictureCC&&oDstRun===oRun||oDstRun.GetParentForm()){NearPos.Paragraph.Clear_NearestPosArray();return}var NewParaDrawing=this.Copy();var RunPr=this.Remove_FromDocument(false);this.DocumentContent.Select_DrawingObject(NewParaDrawing.GetId());
NewParaDrawing.Add_ToDocument(NearPos,true,RunPr,undefined,oPictureCC)};ParaDrawing.prototype.Get_ParentTextTransform=function(){if(this.Parent)return this.Parent.Get_ParentTextTransform();return null};ParaDrawing.prototype.GoTo_Text=function(bBefore,bUpdateStates){var Paragraph=this.Get_ParentParagraph();if(Paragraph){Paragraph.MoveCursorToDrawing(this.Id,bBefore);Paragraph.Document_SetThisElementCurrent(undefined===bUpdateStates?true:bUpdateStates)}};ParaDrawing.prototype.Remove_FromDocument=function(bRecalculate){var oResult=
null;if(!this.Parent)return oResult;var oRun=this.Parent.Get_DrawingObjectRun(this.Id);if(oRun){var oGrObject=this.GraphicObj;if(oGrObject&&oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine)oGrObject.setSignature(oGrObject.signatureLine);var oPictureCC=null;var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}if(oPictureCC)oPictureCC.RemoveContentControlWrapper();
oRun.Remove_DrawingObject(this.Id);if(oRun.IsInHyperlink())oResult=new CTextPr;else oResult=oRun.GetTextPr();if(oGrObject&&oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine){editor.sendEvent("asc_onRemoveSignature",oGrObject.signatureLine.id);oGrObject.setSignature(oGrObject.signatureLine)}}if(false!=bRecalculate)editor.WordControl.m_oLogicDocument.Recalculate();return oResult};ParaDrawing.prototype.Get_ParentParagraph=function(){if(this.Parent instanceof Paragraph)return this.Parent;
if(this.Parent instanceof ParaRun)return this.Parent.Paragraph;if(this.Parent&&this.Parent.GetParagraph())return this.Parent.GetParagraph();return null};ParaDrawing.prototype.SelectAsText=function(){var oParagraph=this.GetParagraph();var oRun=this.GetRun();if(!oParagraph||!oRun)return;var oDocument=oParagraph.GetLogicDocument();if(!oDocument)return;oDocument.RemoveSelection();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this));var oStartPos=oDocument.GetContentPosition(false);
oRun.SetCursorPosition(oRun.GetElementPosition(this)+1);var oEndPos=oDocument.GetContentPosition(false);oDocument.RemoveSelection();oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};ParaDrawing.prototype.Add_ToDocument=function(NearPos,bRecalculate,RunPr,Run,oPictureCC){NearPos.Paragraph.Check_NearestPos(NearPos);var LogicDocument=this.DrawingDocument.m_oLogicDocument;var Para=new Paragraph(this.DrawingDocument,LogicDocument);var DrawingRun=new ParaRun(Para);DrawingRun.Add_ToContent(0,
this);if(RunPr)DrawingRun.Set_Pr(RunPr.Copy());if(Run)DrawingRun.SetReviewTypeWithInfo(Run.GetReviewType(),Run.GetReviewInfo());if(oPictureCC){var oSdt=new CInlineLevelSdt;oSdt.SetPicturePr(true);oSdt.ReplacePlaceHolderWithContent();oSdt.AddToContent(0,DrawingRun);Para.Add_ToContent(0,oSdt);var oFormPr=oPictureCC.GetFormPr();if(oFormPr)oSdt.SetFormPr(oFormPr.Copy())}else Para.Add_ToContent(0,DrawingRun);var SelectedElement=new CSelectedElement(Para,false);var SelectedContent=new CSelectedContent;
SelectedContent.Add(SelectedElement);SelectedContent.SetMoveDrawing(true);SelectedContent.DrawingObjects.push(this);NearPos.Paragraph.Parent.InsertContent(SelectedContent,NearPos);NearPos.Paragraph.Clear_NearestPosArray();NearPos.Paragraph.Correct_Content();this.Set_Parent(NearPos.Paragraph);if(false!=bRecalculate)LogicDocument.Recalculate()};ParaDrawing.prototype.Add_ToDocument2=function(Paragraph){var DrawingRun=new ParaRun(Paragraph);DrawingRun.Add_ToContent(0,this);Paragraph.Add_ToContent(0,DrawingRun);
this.Set_Parent(Paragraph)};ParaDrawing.prototype.UpdateCursorType=function(X,Y,PageIndex){this.DrawingDocument.SetCursorType("move",new AscCommon.CMouseMoveData);if(null!=this.Parent){var Lock=this.Parent.Lock;if(true===Lock.Is_Locked()){var PNum=Math.max(0,Math.min(PageIndex-this.Parent.PageNum,this.Parent.Pages.length-1));var _X=this.Parent.Pages[PNum].X;var _Y=this.Parent.Pages[PNum].Y;var MMData=new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Parent.Get_StartPage_Absolute()+
(PageIndex-this.Parent.PageNum));MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=Lock.Get_UserId();MMData.HaveChanges=Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}}};ParaDrawing.prototype.Get_AnchorPos=function(){if(!this.Parent)return null;return this.Parent.Get_AnchorPos(this)};ParaDrawing.prototype.CheckRecalcAutoFit=function(oSectPr){if(this.GraphicObj&&
this.GraphicObj.CheckNeedRecalcAutoFit)if(this.GraphicObj.CheckNeedRecalcAutoFit(oSectPr)){if(this.GraphicObj)this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.Measure()}};ParaDrawing.prototype.Get_ParentObject_or_DocumentPos=function(){if(this.Parent!=null)return this.Parent.Get_ParentObject_or_DocumentPos()};ParaDrawing.prototype.Refresh_RecalcData=function(Data){var oRun=this.GetRun();if(oRun){if(AscCommon.isRealObject(Data))switch(Data.Type){case AscDFH.historyitem_Drawing_Distance:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&
this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}case AscDFH.historyitem_Drawing_SetExtent:{oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_SetSizeRelH:case AscDFH.historyitem_Drawing_SetSizeRelV:case AscDFH.historyitem_Drawing_SetGraphicObject:{if(this.GraphicObj){this.GraphicObj.handleUpdateExtents&&this.GraphicObj.handleUpdateExtents();this.GraphicObj.addToRecalculate()}oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_WrappingType:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&
this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}}return oRun.Refresh_RecalcData2()}};ParaDrawing.prototype.Refresh_RecalcData2=function(Data){var oRun=this.GetRun();if(oRun)return oRun.Refresh_RecalcData2()};ParaDrawing.prototype.hyperlinkCheck=function(bCheck){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCheck==="function")return this.GraphicObj.hyperlinkCheck(bCheck);return null};ParaDrawing.prototype.hyperlinkCanAdd=function(bCheckInHyperlink){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkCanAdd(bCheckInHyperlink);return false};ParaDrawing.prototype.hyperlinkRemove=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkRemove();return false};ParaDrawing.prototype.hyperlinkModify=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkModify==="function")return this.GraphicObj.hyperlinkModify(HyperProps)};
ParaDrawing.prototype.hyperlinkAdd=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkAdd==="function")return this.GraphicObj.hyperlinkAdd(HyperProps)};ParaDrawing.prototype.documentStatistics=function(stat){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentStatistics==="function")this.GraphicObj.documentStatistics(stat)};ParaDrawing.prototype.documentCreateFontCharMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.documentCreateFontCharMap==="function")this.GraphicObj.documentCreateFontCharMap(fontMap)};ParaDrawing.prototype.documentCreateFontMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontMap==="function")this.GraphicObj.documentCreateFontMap(fontMap)};ParaDrawing.prototype.tableCheckSplit=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckSplit==="function")return this.GraphicObj.tableCheckSplit();
return false};ParaDrawing.prototype.tableCheckMerge=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckMerge==="function")return this.GraphicObj.tableCheckMerge();return false};ParaDrawing.prototype.tableSelect=function(Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSelect==="function")return this.GraphicObj.tableSelect(Type)};ParaDrawing.prototype.tableRemoveTable=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveTable===
"function")return this.GraphicObj.tableRemoveTable()};ParaDrawing.prototype.tableSplitCell=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSplitCell==="function")return this.GraphicObj.tableSplitCell(Cols,Rows)};ParaDrawing.prototype.tableMergeCells=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableMergeCells==="function")return this.GraphicObj.tableMergeCells(Cols,Rows)};ParaDrawing.prototype.tableRemoveCol=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.tableRemoveCol==="function")return this.GraphicObj.tableRemoveCol()};ParaDrawing.prototype.tableAddCol=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddCol==="function")return this.GraphicObj.tableAddCol(bBefore,nCount)};ParaDrawing.prototype.tableRemoveRow=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveRow==="function")return this.GraphicObj.tableRemoveRow()};ParaDrawing.prototype.tableAddRow=
function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddRow==="function")return this.GraphicObj.tableAddRow(bBefore,nCount)};ParaDrawing.prototype.getCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurrentParagraph==="function")return this.GraphicObj.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs);if(this.Parent instanceof Paragraph)return this.Parent};ParaDrawing.prototype.GetSelectedText=
function(bClearText,oPr){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetSelectedText==="function")return this.GraphicObj.GetSelectedText(bClearText,oPr);return""};ParaDrawing.prototype.getCurPosXY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurPosXY==="function")return this.GraphicObj.getCurPosXY();return{X:0,Y:0}};ParaDrawing.prototype.setParagraphKeepLines=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepLines===
"function")return this.GraphicObj.setParagraphKeepLines(Value)};ParaDrawing.prototype.setParagraphKeepNext=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepNext==="function")return this.GraphicObj.setParagraphKeepNext(Value)};ParaDrawing.prototype.setParagraphWidowControl=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphWidowControl==="function")return this.GraphicObj.setParagraphWidowControl(Value)};ParaDrawing.prototype.setParagraphPageBreakBefore=
function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphPageBreakBefore==="function")return this.GraphicObj.setParagraphPageBreakBefore(Value)};ParaDrawing.prototype.isTextSelectionUse=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.isTextSelectionUse();return false};ParaDrawing.prototype.paragraphFormatPaste=function(CopyTextPr,CopyParaPr,Bool){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.paragraphFormatPaste(CopyTextPr,CopyParaPr,Bool)};ParaDrawing.prototype.getNearestPos=function(x,y,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getNearestPos==="function")return this.GraphicObj.getNearestPos(x,y,pageIndex);return null};ParaDrawing.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.Type);Writer.WriteString2(this.Id)};ParaDrawing.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Drawing);
Writer.WriteString2(this.Id);AscFormat.writeDouble(Writer,this.Extent.W);AscFormat.writeDouble(Writer,this.Extent.H);AscFormat.writeObject(Writer,this.GraphicObj);AscFormat.writeObject(Writer,this.DocumentContent);AscFormat.writeObject(Writer,this.Parent);AscFormat.writeObject(Writer,this.wrappingPolygon);AscFormat.writeLong(Writer,this.RelativeHeight);AscFormat.writeObject(Writer,this.docPr)};ParaDrawing.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.DrawingDocument=
editor.WordControl.m_oLogicDocument.DrawingDocument;this.LogicDocument=this.DrawingDocument?this.DrawingDocument.m_oLogicDocument:null;this.Extent.W=AscFormat.readDouble(Reader);this.Extent.H=AscFormat.readDouble(Reader);this.GraphicObj=AscFormat.readObject(Reader);this.DocumentContent=AscFormat.readObject(Reader);this.Parent=AscFormat.readObject(Reader);this.wrappingPolygon=AscFormat.readObject(Reader);this.RelativeHeight=AscFormat.readLong(Reader);this.docPr=AscFormat.readObject(Reader);if(this.wrappingPolygon)this.wrappingPolygon.wordGraphicObject=
this;this.drawingDocument=editor.WordControl.m_oLogicDocument.DrawingDocument;this.document=editor.WordControl.m_oLogicDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.graphicObjects.addGraphicObject(this);g_oTableId.Add(this,this.Id)};ParaDrawing.prototype.Load_LinkData=function(){};ParaDrawing.prototype.draw=function(graphics,PDSE){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.draw==="function"){graphics.SaveGrState();var bInline=this.Is_Inline();
if(bInline&&AscCommon.isRealObject(PDSE)&&AscFormat.isRealNumber(this.LineTop)&&AscFormat.isRealNumber(this.LineBottom)&&AscCommon.isRealObject(this.GraphicObj.bounds)){var x,y,w,h;var oEffectExtent=this.EffectExtent;x=PDSE.X;y=this.LineTop;w=this.GraphicObj.bounds.r-this.GraphicObj.bounds.l+AscFormat.getValOrDefault(oEffectExtent.R,0)+AscFormat.getValOrDefault(oEffectExtent.L,0);h=this.LineBottom-this.LineTop;graphics.AddClipRect(x,y,w,h)}this.GraphicObj.draw(graphics);graphics.RestoreGrState()}};
ParaDrawing.prototype.drawAdjustments=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.drawAdjustments==="function")this.GraphicObj.drawAdjustments()};ParaDrawing.prototype.getTransformMatrix=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getTransformMatrix==="function")return this.GraphicObj.getTransformMatrix();return null};ParaDrawing.prototype.getExtensions=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getExtensions===
"function")return this.GraphicObj.getExtensions();return null};ParaDrawing.prototype.isGroup=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isGroup==="function")return this.GraphicObj.isGroup();return false};ParaDrawing.prototype.isShapeChild=function(bRetShape){if(!this.Is_Inline()||!this.DocumentContent)return bRetShape?null:false;var cur_doc_content=this.DocumentContent;var oCell;while(oCell=cur_doc_content.IsTableCellContent(true))cur_doc_content=oCell.Row.Table.Parent;
if(AscCommon.isRealObject(cur_doc_content.Parent)&&typeof cur_doc_content.Parent.getObjectType==="function"&&cur_doc_content.Parent.getObjectType()===AscDFH.historyitem_type_Shape)return bRetShape?cur_doc_content.Parent:true;return bRetShape?null:false};ParaDrawing.prototype.checkShapeChildAndGetTopParagraph=function(paragraph){var parent_paragraph=!paragraph?this.Get_ParentParagraph():paragraph;var parent_doc_content=parent_paragraph.Parent;if(parent_doc_content.Parent instanceof AscFormat.CShape)if(!parent_doc_content.Parent.group)return parent_doc_content.Parent.parent.Get_ParentParagraph();
Old,New,Color)}CChangesParaTextPrHighLight.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrHighLight.prototype.constructor=CChangesParaTextPrHighLight;CChangesParaTextPrHighLight.prototype.Type=AscDFH.historyitem_TextPr_HighLight;CChangesParaTextPrHighLight.prototype.private_SetValue=function(Value){if(this.Class.Value)this.Class.Value.HighLight=Value};CChangesParaTextPrHighLight.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;
if(undefined===this.New)nFlags|=2;else if(highlight_None===this.New)nFlags|=4;if(undefined===this.Old)nFlags|=8;else if(highlight_None===this.Old)nFlags|=16;Writer.WriteLong(nFlags);if(undefined!==this.New&&highlight_None!==this.New)this.New.Write_ToBinary(Writer);if(undefined!==this.Old&&highlight_None!==this.Old)this.Old.Write_ToBinary(Writer)};CChangesParaTextPrHighLight.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&
2)this.New=undefined;else if(nFlags&4)this.New=highlight_None;else{this.New=new CDocumentColor(0,0,0);this.New.Read_FromBinary(Reader)}if(nFlags&8)this.Old=undefined;else if(nFlags&16)this.Old=highlight_None;else{this.Old=new CDocumentColor(0,0,0);this.Old.Read_FromBinary(Reader)}};CChangesParaTextPrHighLight.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrRStyle(Class,Old,New,Color){AscDFH.CChangesBaseStringProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRStyle.prototype=
Object.create(AscDFH.CChangesBaseStringProperty.prototype);CChangesParaTextPrRStyle.prototype.constructor=CChangesParaTextPrRStyle;CChangesParaTextPrRStyle.prototype.Type=AscDFH.historyitem_TextPr_RStyle;CChangesParaTextPrRStyle.prototype.private_SetValue=function(Value){this.Class.Value.RStyle=Value};CChangesParaTextPrRStyle.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSpacing(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}
CChangesParaTextPrSpacing.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrSpacing.prototype.constructor=CChangesParaTextPrSpacing;CChangesParaTextPrSpacing.prototype.Type=AscDFH.historyitem_TextPr_Spacing;CChangesParaTextPrSpacing.prototype.private_SetValue=function(Value){this.Class.Value.Spacing=Value};CChangesParaTextPrSpacing.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrDStrikeout(Class,Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,
Class,Old,New,Color)}CChangesParaTextPrDStrikeout.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesParaTextPrDStrikeout.prototype.constructor=CChangesParaTextPrDStrikeout;CChangesParaTextPrDStrikeout.prototype.Type=AscDFH.historyitem_TextPr_DStrikeout;CChangesParaTextPrDStrikeout.prototype.private_SetValue=function(Value){this.Class.Value.DStrikeout=Value};CChangesParaTextPrDStrikeout.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrCaps(Class,
Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesParaTextPrCaps.prototype.constructor=CChangesParaTextPrCaps;CChangesParaTextPrCaps.prototype.Type=AscDFH.historyitem_TextPr_Caps;CChangesParaTextPrCaps.prototype.private_SetValue=function(Value){this.Class.Value.Caps=Value};CChangesParaTextPrCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrSmallCaps(Class,
Old,New,Color){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrSmallCaps.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesParaTextPrSmallCaps.prototype.constructor=CChangesParaTextPrSmallCaps;CChangesParaTextPrSmallCaps.prototype.Type=AscDFH.historyitem_TextPr_SmallCaps;CChangesParaTextPrSmallCaps.prototype.private_SetValue=function(Value){this.Class.Value.SmallCaps=Value};CChangesParaTextPrSmallCaps.prototype.Merge=private_ParaTextPrChangesOnMergeValue;
function CChangesParaTextPrPosition(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrPosition.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrPosition.prototype.constructor=CChangesParaTextPrPosition;CChangesParaTextPrPosition.prototype.Type=AscDFH.historyitem_TextPr_Position;CChangesParaTextPrPosition.prototype.private_SetValue=function(Value){this.Class.Value.Position=Value};CChangesParaTextPrPosition.prototype.Merge=
private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrValue(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrValue.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrValue.prototype.constructor=CChangesParaTextPrValue;CChangesParaTextPrValue.prototype.Type=AscDFH.historyitem_TextPr_Value;CChangesParaTextPrValue.prototype.private_SetValue=function(Value){this.Class.Value=Value};CChangesParaTextPrValue.prototype.private_CreateObject=
function(){return new CTextPr};CChangesParaTextPrValue.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrValue.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true;if(oChange.Type===this.Type)return false;if(!this.New)this.New=new CTextPr;switch(oChange.Type){case AscDFH.historyitem_TextPr_Bold:{this.New.Bold=oChange.New;break}case AscDFH.historyitem_TextPr_Italic:{this.New.Italic=oChange.New;break}case AscDFH.historyitem_TextPr_Strikeout:{this.New.Strikeout=
oChange.New;break}case AscDFH.historyitem_TextPr_Underline:{this.New.Underline=oChange.New;break}case AscDFH.historyitem_TextPr_FontSize:{this.New.FontSize=oChange.New;break}case AscDFH.historyitem_TextPr_Color:{this.New.Color=oChange.New;break}case AscDFH.historyitem_TextPr_VertAlign:{this.New.VertAlign=oChange.New;break}case AscDFH.historyitem_TextPr_HighLight:{this.New.HighLight=oChange.New;break}case AscDFH.historyitem_TextPr_RStyle:{this.New.RStyle=oChange.New;break}case AscDFH.historyitem_TextPr_Spacing:{this.New.Spacing=
oChange.New;break}case AscDFH.historyitem_TextPr_DStrikeout:{this.New.DStrikeout=oChange.New;break}case AscDFH.historyitem_TextPr_Caps:{this.New.Caps=oChange.New;break}case AscDFH.historyitem_TextPr_SmallCaps:{this.New.SmallCaps=oChange.New;break}case AscDFH.historyitem_TextPr_Position:{this.New.Position=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts:{this.New.RFonts=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Ascii:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Ascii=
oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.HAnsi=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_CS:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;
this.New.RFonts.Hint=oChange.New;break}case AscDFH.historyitem_TextPr_Lang:{this.New.Lang=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Bidi:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Bidi=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Val=oChange.New;break}case AscDFH.historyitem_TextPr_Unifill:{this.New.Unifill=
oChange.New;break}case AscDFH.historyitem_TextPr_FontSizeCS:{this.New.FontSizeCS=oChange.New;break}case AscDFH.historyitem_TextPr_Outline:{this.New.TextOutline=oChange.New;break}case AscDFH.historyitem_TextPr_Fill:{this.New.TextFill=oChange.New;break}}return true};function CChangesParaTextPrRFonts(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFonts.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrRFonts.prototype.constructor=
CChangesParaTextPrRFonts;CChangesParaTextPrRFonts.prototype.Type=AscDFH.historyitem_TextPr_RFonts;CChangesParaTextPrRFonts.prototype.private_SetValue=function(Value){this.Class.Value.RFonts=Value};CChangesParaTextPrRFonts.prototype.private_CreateObject=function(){return new CRFonts};CChangesParaTextPrRFonts.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrRFonts.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||
oChange.Type===AscDFH.historyitem_TextPr_Value)return false;if(!this.New)this.New=new CRFonts;switch(oChange.Type){case AscDFH.historyitem_TextPr_RFonts_Ascii:{this.New.Ascii=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_HAnsi:{this.New.HAnsi=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_CS:{this.New.CS=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_RFonts_Hint:{this.New.Hint=oChange.New;break}}return true};
function CChangesParaTextPrRFontsAscii(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsAscii.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsAscii.prototype.constructor=CChangesParaTextPrRFontsAscii;CChangesParaTextPrRFontsAscii.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Ascii;CChangesParaTextPrRFontsAscii.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===
this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsAscii.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};
CChangesParaTextPrRFontsAscii.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.Ascii=Value};CChangesParaTextPrRFontsAscii.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHAnsi(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHAnsi.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsHAnsi.prototype.constructor=CChangesParaTextPrRFontsHAnsi;CChangesParaTextPrRFontsHAnsi.prototype.Type=
AscDFH.historyitem_TextPr_RFonts_HAnsi;CChangesParaTextPrRFontsHAnsi.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsHAnsi.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=
false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsHAnsi.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.HAnsi=Value};CChangesParaTextPrRFontsHAnsi.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsCS(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsCS.prototype=
Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsCS.prototype.constructor=CChangesParaTextPrRFontsCS;CChangesParaTextPrRFontsCS.prototype.Type=AscDFH.historyitem_TextPr_RFonts_CS;CChangesParaTextPrRFontsCS.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};
CChangesParaTextPrRFontsCS.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),Index:-1}};CChangesParaTextPrRFontsCS.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.CS=Value};CChangesParaTextPrRFontsCS.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;
function CChangesParaTextPrRFontsEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsEastAsia.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesParaTextPrRFontsEastAsia.prototype.constructor=CChangesParaTextPrRFontsEastAsia;CChangesParaTextPrRFontsEastAsia.prototype.Type=AscDFH.historyitem_TextPr_RFonts_EastAsia;CChangesParaTextPrRFontsEastAsia.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=
1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteString2(this.New.Name);if(undefined!==this.Old)Writer.WriteString2(this.Old.Name)};CChangesParaTextPrRFontsEastAsia.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New={Name:Reader.GetString2(),Index:-1};if(nFlags&4)this.Old=undefined;else this.Old={Name:Reader.GetString2(),
Index:-1}};CChangesParaTextPrRFontsEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.EastAsia=Value};CChangesParaTextPrRFontsEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrRFontsHint(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrRFontsHint.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrRFontsHint.prototype.constructor=CChangesParaTextPrRFontsHint;
CChangesParaTextPrRFontsHint.prototype.Type=AscDFH.historyitem_TextPr_RFonts_Hint;CChangesParaTextPrRFontsHint.prototype.private_SetValue=function(Value){this.Class.Value.RFonts.Hint=Value};CChangesParaTextPrRFontsHint.prototype.Merge=private_ParaTextPrChangesOnMergeRFontsValue;function CChangesParaTextPrLang(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLang.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrLang.prototype.constructor=
CChangesParaTextPrLang;CChangesParaTextPrLang.prototype.Type=AscDFH.historyitem_TextPr_Lang;CChangesParaTextPrLang.prototype.private_SetValue=function(Value){this.Class.Value.Lang=Value};CChangesParaTextPrLang.prototype.private_CreateObject=function(){return new CLang};CChangesParaTextPrLang.prototype.private_IsCreateEmptyObject=function(){return true};CChangesParaTextPrLang.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(AscDFH.historyitem_TextPr_Lang===oChange.Type||
AscDFH.historyitem_TextPr_Value===oChange.Type)return false;if(!this.New)this.New=new CLang;switch(oChange.Type){case AscDFH.historyitem_TextPr_Lang_Bidi:{this.New.Bidi=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_EastAsia:{this.New.EastAsia=oChange.New;break}case AscDFH.historyitem_TextPr_Lang_Val:{this.New.Val=oChange.New;break}}return true};function CChangesParaTextPrLangBidi(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangBidi.prototype=
Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangBidi.prototype.constructor=CChangesParaTextPrLangBidi;CChangesParaTextPrLangBidi.prototype.Type=AscDFH.historyitem_TextPr_Lang_Bidi;CChangesParaTextPrLangBidi.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Bidi=Value};CChangesParaTextPrLangBidi.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangEastAsia(Class,Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,
Class,Old,New,Color)}CChangesParaTextPrLangEastAsia.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangEastAsia.prototype.constructor=CChangesParaTextPrLangEastAsia;CChangesParaTextPrLangEastAsia.prototype.Type=AscDFH.historyitem_TextPr_Lang_EastAsia;CChangesParaTextPrLangEastAsia.prototype.private_SetValue=function(Value){this.Class.Value.Lang.EastAsia=Value};CChangesParaTextPrLangEastAsia.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;function CChangesParaTextPrLangVal(Class,
Old,New,Color){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrLangVal.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesParaTextPrLangVal.prototype.constructor=CChangesParaTextPrLangVal;CChangesParaTextPrLangVal.prototype.Type=AscDFH.historyitem_TextPr_Lang_Val;CChangesParaTextPrLangVal.prototype.private_SetValue=function(Value){this.Class.Value.Lang.Val=Value};CChangesParaTextPrLangVal.prototype.Merge=private_ParaTextPrChangesOnMergeLangValue;
function CChangesParaTextPrUnifill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrUnifill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrUnifill.prototype.constructor=CChangesParaTextPrUnifill;CChangesParaTextPrUnifill.prototype.Type=AscDFH.historyitem_TextPr_Unifill;CChangesParaTextPrUnifill.prototype.private_SetValue=function(Value){this.Class.Value.Unifill=Value};CChangesParaTextPrUnifill.prototype.private_CreateObject=
function(){return new AscFormat.CUniFill};CChangesParaTextPrUnifill.prototype.Load=function(Color){this.Redo();var Unifill=this.Class.Value.Unifill;if(AscCommon.CollaborativeEditing&&Unifill&&Unifill.fill&&Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_BLIP&&typeof Unifill.fill.RasterImageId==="string"&&Unifill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId)};CChangesParaTextPrUnifill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrFontSizeCS(Class,
Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrFontSizeCS.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesParaTextPrFontSizeCS.prototype.constructor=CChangesParaTextPrFontSizeCS;CChangesParaTextPrFontSizeCS.prototype.Type=AscDFH.historyitem_TextPr_FontSizeCS;CChangesParaTextPrFontSizeCS.prototype.private_SetValue=function(Value){this.Class.Value.FontSizeCS=Value};CChangesParaTextPrFontSizeCS.prototype.Merge=private_ParaTextPrChangesOnMergeValue;
function CChangesParaTextPrTextOutline(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextOutline.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextOutline.prototype.constructor=CChangesParaTextPrTextOutline;CChangesParaTextPrTextOutline.prototype.Type=AscDFH.historyitem_TextPr_Outline;CChangesParaTextPrTextOutline.prototype.private_SetValue=function(Value){this.Class.Value.TextOutline=Value};CChangesParaTextPrTextOutline.prototype.private_CreateObject=
function(){return new AscFormat.CLn};CChangesParaTextPrTextOutline.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrTextFill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextFill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextFill.prototype.constructor=CChangesParaTextPrTextFill;CChangesParaTextPrTextFill.prototype.Type=AscDFH.historyitem_TextPr_Fill;CChangesParaTextPrTextFill.prototype.private_SetValue=
function(Value){this.Class.Value.TextFill=Value};CChangesParaTextPrTextFill.prototype.private_CreateObject=function(){return new AscFormat.CUniFill};CChangesParaTextPrTextFill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;"use strict";var drawing_Inline=1;var drawing_Anchor=2;var WRAPPING_TYPE_NONE=0;var WRAPPING_TYPE_SQUARE=1;var WRAPPING_TYPE_THROUGH=2;var WRAPPING_TYPE_TIGHT=3;var WRAPPING_TYPE_TOP_AND_BOTTOM=4;var WRAP_HIT_TYPE_POINT=0;var WRAP_HIT_TYPE_SECTION=1;var c_oAscAlignH=Asc.c_oAscAlignH;
var c_oAscAlignV=Asc.c_oAscAlignV;function ParaDrawing(W,H,GraphicObj,DrawingDocument,DocumentContent,Parent){CRunElementBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.DrawingType=drawing_Inline;this.GraphicObj=GraphicObj;this.X=0;this.Y=0;this.Width=0;this.Height=0;this.OrigX=0;this.OrigY=0;this.ShiftX=0;this.ShiftY=0;this.PageNum=0;this.LineNum=0;this.YOffset=0;this.DocumentContent=DocumentContent;this.DrawingDocument=DrawingDocument;this.Parent=Parent;this.LogicDocument=DrawingDocument?
DrawingDocument.m_oLogicDocument:null;this.Distance={T:0,B:0,L:0,R:0};this.LayoutInCell=true;this.RelativeHeight=undefined;this.SimplePos={Use:false,X:0,Y:0};this.Extent={W:W,H:H};this.EffectExtent={L:0,T:0,R:0,B:0};this.docPr=new AscFormat.CNvPr;this.SizeRelH=undefined;this.SizeRelV=undefined;this.AllowOverlap=true;this.Locked=null;this.Hidden=null;this.PositionH={RelativeFrom:c_oAscRelativeFromH.Column,Align:false,Value:0,Percent:false};this.PositionV={RelativeFrom:c_oAscRelativeFromV.Paragraph,
Align:false,Value:0,Percent:false};this.PositionH_Old=undefined;this.PositionV_Old=undefined;this.Internal_Position=new CAnchorPosition;this.wrappingType=WRAPPING_TYPE_THROUGH;this.useWrap=true;if(typeof CWrapPolygon!=="undefined")this.wrappingPolygon=new CWrapPolygon(this);this.document=editor.WordControl.m_oLogicDocument;this.drawingDocument=DrawingDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.selected=false;this.behindDoc=false;this.bNoNeedToAdd=false;this.pageIndex=
-1;this.Lock=new AscCommon.CLock;this.ParaMath=null;this.SkipOnRecalculate=false;this.LineTop=null;this.LineBottom=null;g_oTableId.Add(this,this.Id);if(this.graphicObjects){this.Set_RelativeHeight(this.graphicObjects.getZIndex());if(History.Is_On()&&!g_oTableId.m_bTurnOff)this.graphicObjects.addGraphicObject(this)}}ParaDrawing.prototype=Object.create(CRunElementBase.prototype);ParaDrawing.prototype.constructor=ParaDrawing;ParaDrawing.prototype.Type=para_Drawing;ParaDrawing.prototype.Get_Type=function(){return this.Type};
ParaDrawing.prototype.Get_Width=function(){return this.Width};ParaDrawing.prototype.Get_WidthVisible=function(){return this.WidthVisible};ParaDrawing.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible};ParaDrawing.prototype.GetSelectedContent=function(SelectedContent){if(this.GraphicObj&&this.GraphicObj.GetSelectedContent)this.GraphicObj.GetSelectedContent(SelectedContent)};ParaDrawing.prototype.GetSearchElementId=function(bNext,bCurrent){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.GetSearchElementId==="function")return this.GraphicObj.GetSearchElementId(bNext,bCurrent);return null};ParaDrawing.prototype.CheckCorrect=function(){if(!this.GraphicObj)return false;if(this.GraphicObj&&this.GraphicObj.checkCorrect)return this.GraphicObj.checkCorrect();return true};ParaDrawing.prototype.GetAllDrawingObjects=function(DrawingObjects){if(null==DrawingObjects)DrawingObjects=[];if(this.GraphicObj.GetAllDrawingObjects)this.GraphicObj.GetAllDrawingObjects(DrawingObjects)};
ParaDrawing.prototype.canRotate=function(){return AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canRotate=="function"&&this.GraphicObj.canRotate()};ParaDrawing.prototype.GetParagraph=function(){return this.Get_ParentParagraph()};ParaDrawing.prototype.GetRun=function(){return this.Get_Run()};ParaDrawing.prototype.Get_Run=function(){var oParagraph=this.Get_ParentParagraph();if(oParagraph)return oParagraph.Get_DrawingObjectRun(this.Id);return null};ParaDrawing.prototype.Get_Props=function(OtherProps){var Props=
{};Props.Width=this.GraphicObj.extX;Props.Height=this.GraphicObj.extY;if(drawing_Inline===this.DrawingType)Props.WrappingStyle=c_oAscWrapStyle2.Inline;else if(WRAPPING_TYPE_NONE===this.wrappingType)Props.WrappingStyle=this.behindDoc===true?c_oAscWrapStyle2.Behind:c_oAscWrapStyle2.InFront;else switch(this.wrappingType){case WRAPPING_TYPE_SQUARE:Props.WrappingStyle=c_oAscWrapStyle2.Square;break;case WRAPPING_TYPE_TIGHT:Props.WrappingStyle=c_oAscWrapStyle2.Tight;break;case WRAPPING_TYPE_THROUGH:Props.WrappingStyle=
c_oAscWrapStyle2.Through;break;case WRAPPING_TYPE_TOP_AND_BOTTOM:Props.WrappingStyle=c_oAscWrapStyle2.TopAndBottom;break;default:Props.WrappingStyle=c_oAscWrapStyle2.Inline;break}if(drawing_Inline===this.DrawingType)Props.Paddings={Left:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Right:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Top:0,Bottom:0};else{var oDistance=this.Get_Distance();Props.Paddings={Left:oDistance.L,Right:oDistance.R,Top:oDistance.T,Bottom:oDistance.B}}Props.AllowOverlap=this.AllowOverlap;Props.Position=
{X:this.X,Y:this.Y};Props.PositionH={RelativeFrom:this.PositionH.RelativeFrom,UseAlign:this.PositionH.Align,Align:true===this.PositionH.Align?this.PositionH.Value:undefined,Value:true===this.PositionH.Align?0:this.PositionH.Value,Percent:this.PositionH.Percent};Props.PositionV={RelativeFrom:this.PositionV.RelativeFrom,UseAlign:this.PositionV.Align,Align:true===this.PositionV.Align?this.PositionV.Value:undefined,Value:true===this.PositionV.Align?0:this.PositionV.Value,Percent:this.PositionV.Percent};
if(this.SizeRelH&&this.SizeRelH.Percent>0)Props.SizeRelH={RelativeFrom:AscFormat.ConvertRelSizeHToRelPosition(this.SizeRelH.RelativeFrom),Value:this.SizeRelH.Percent*100>>0};if(this.SizeRelV&&this.SizeRelV.Percent>0)Props.SizeRelV={RelativeFrom:AscFormat.ConvertRelSizeVToRelPosition(this.SizeRelV.RelativeFrom),Value:this.SizeRelV.Percent*100>>0};Props.Internal_Position=this.Internal_Position;Props.Locked=this.Lock.Is_Locked();var ParentParagraph=this.Get_ParentParagraph();if(ParentParagraph&&undefined!==
ParentParagraph.Parent){var DocContent=ParentParagraph.Parent;if(true===DocContent.Is_DrawingShape()||DocContent.GetTopDocumentContent()instanceof CFootEndnote)Props.CanBeFlow=false}Props.title=this.docPr.title!==null?this.docPr.title:undefined;Props.description=this.docPr.descr!==null?this.docPr.descr:undefined;if(null!=OtherProps&&undefined!=OtherProps){if(undefined===OtherProps.Width||.001>Math.abs(Props.Width-OtherProps.Width))Props.Width=undefined;if(undefined===OtherProps.Height||.001>Math.abs(Props.Height-
OtherProps.Height))Props.Height=undefined;if(undefined===OtherProps.WrappingStyle||Props.WrappingStyle!=OtherProps.WrappingStyle)Props.WrappingStyle=undefined;if(undefined===OtherProps.ImageUrl||Props.ImageUrl!=OtherProps.ImageUrl)Props.ImageUrl=undefined;if(undefined===OtherProps.Paddings.Left||.001>Math.abs(Props.Paddings.Left-OtherProps.Paddings.Left))Props.Paddings.Left=undefined;if(undefined===OtherProps.Paddings.Right||.001>Math.abs(Props.Paddings.Right-OtherProps.Paddings.Right))Props.Paddings.Right=
undefined;if(undefined===OtherProps.Paddings.Top||.001>Math.abs(Props.Paddings.Top-OtherProps.Paddings.Top))Props.Paddings.Top=undefined;if(undefined===OtherProps.Paddings.Bottom||.001>Math.abs(Props.Paddings.Bottom-OtherProps.Paddings.Bottom))Props.Paddings.Bottom=undefined;if(undefined===OtherProps.AllowOverlap||Props.AllowOverlap!=OtherProps.AllowOverlap)Props.AllowOverlap=undefined;if(undefined===OtherProps.Position.X||.001>Math.abs(Props.Position.X-OtherProps.Position.X))Props.Position.X=undefined;
if(undefined===OtherProps.Position.Y||.001>Math.abs(Props.Position.Y-OtherProps.Position.Y))Props.Position.Y=undefined;if(undefined===OtherProps.PositionH.RelativeFrom||Props.PositionH.RelativeFrom!=OtherProps.PositionH.RelativeFrom)Props.PositionH.RelativeFrom=undefined;if(undefined===OtherProps.PositionH.UseAlign||Props.PositionH.UseAlign!=OtherProps.PositionH.UseAlign)Props.PositionH.UseAlign=undefined;if(Props.PositionH.RelativeFrom===OtherProps.PositionH.RelativeFrom&&Props.PositionH.UseAlign===
OtherProps.PositionH.UseAlign){if(true!=Props.PositionH.UseAlign&&.001>Math.abs(Props.PositionH.Value-OtherProps.PositionH.Value))Props.PositionH.Value=undefined;if(true===Props.PositionH.UseAlign&&Props.PositionH.Align!=OtherProps.PositionH.Align)Props.PositionH.Align=undefined}if(undefined===OtherProps.PositionV.RelativeFrom||Props.PositionV.RelativeFrom!=OtherProps.PositionV.RelativeFrom)Props.PositionV.RelativeFrom=undefined;if(undefined===OtherProps.PositionV.UseAlign||Props.PositionV.UseAlign!=
OtherProps.PositionV.UseAlign)Props.PositionV.UseAlign=undefined;if(Props.PositionV.RelativeFrom===OtherProps.PositionV.RelativeFrom&&Props.PositionV.UseAlign===OtherProps.PositionV.UseAlign){if(true!=Props.PositionV.UseAlign&&.001>Math.abs(Props.PositionV.Value-OtherProps.PositionV.Value))Props.PositionV.Value=undefined;if(true===Props.PositionV.UseAlign&&Props.PositionV.Align!=OtherProps.PositionV.Align)Props.PositionV.Align=undefined}if(false===OtherProps.Locked)Props.Locked=false;if(false===OtherProps.CanBeFlow||
false===Props.CanBeFlow)Props.CanBeFlow=false;else Props.CanBeFlow=true;if(undefined===OtherProps.title||Props.title!==OtherProps.title)Props.title=undefined;if(undefined===OtherProps.description||Props.description!==OtherProps.description)Props.description=undefined}return Props};ParaDrawing.prototype.Is_UseInDocument=function(){if(this.Parent){var Run=this.Parent.Get_DrawingObjectRun(this.Id);if(Run)return Run.Is_UseInDocument(this.Get_Id())}return false};ParaDrawing.prototype.IsUseInDocument=function(){return this.Is_UseInDocument()};
ParaDrawing.prototype.CheckGroupSizes=function(){if(this.GraphicObj&&this.GraphicObj.CheckGroupSizes)this.GraphicObj.CheckGroupSizes()};ParaDrawing.prototype.Set_DrawingType=function(DrawingType){History.Add(new CChangesParaDrawingDrawingType(this,this.DrawingType,DrawingType));this.DrawingType=DrawingType};ParaDrawing.prototype.Set_WrappingType=function(WrapType){History.Add(new CChangesParaDrawingWrappingType(this,this.wrappingType,WrapType));this.wrappingType=WrapType};ParaDrawing.prototype.Set_Distance=
function(L,T,R,B){var oDistance=this.Get_Distance();if(!AscFormat.isRealNumber(L))L=oDistance.L;if(!AscFormat.isRealNumber(T))T=oDistance.T;if(!AscFormat.isRealNumber(R))R=oDistance.R;if(!AscFormat.isRealNumber(B))B=oDistance.B;History.Add(new CChangesParaDrawingDistance(this,{Left:this.Distance.L,Top:this.Distance.T,Right:this.Distance.R,Bottom:this.Distance.B},{Left:L,Top:T,Right:R,Bottom:B}));this.Distance.L=L;this.Distance.R=R;this.Distance.T=T;this.Distance.B=B};ParaDrawing.prototype.Set_AllowOverlap=
function(AllowOverlap){History.Add(new CChangesParaDrawingAllowOverlap(this,this.AllowOverlap,AllowOverlap));this.AllowOverlap=AllowOverlap};ParaDrawing.prototype.Set_PositionH=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionH(this,{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,
Value:this.PositionH.Value,Percent:this.PositionH.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionH.RelativeFrom=RelativeFrom;this.PositionH.Align=Align;this.PositionH.Value=_Value;this.PositionH.Percent=_Percent};ParaDrawing.prototype.Set_PositionV=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionV(this,
{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionV.RelativeFrom=RelativeFrom;this.PositionV.Align=Align;this.PositionV.Value=_Value;this.PositionV.Percent=_Percent};ParaDrawing.prototype.GetPositionH=function(){return{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent}};
ParaDrawing.prototype.GetPositionV=function(){return{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent}};ParaDrawing.prototype.Set_BehindDoc=function(BehindDoc){History.Add(new CChangesParaDrawingBehindDoc(this,this.behindDoc,BehindDoc));this.behindDoc=BehindDoc};ParaDrawing.prototype.Set_GraphicObject=function(graphicObject){var oldId=AscCommon.isRealObject(this.GraphicObj)?this.GraphicObj.Get_Id():null;var newId=AscCommon.isRealObject(graphicObject)?
graphicObject.Get_Id():null;History.Add(new CChangesParaDrawingGraphicObject(this,oldId,newId));if(graphicObject)graphicObject.handleUpdateExtents();this.GraphicObj=graphicObject};ParaDrawing.prototype.setSimplePos=function(use,x,y){History.Add(new CChangesParaDrawingSimplePos(this,{Use:this.SimplePos.Use,X:this.SimplePos.X,Y:this.SimplePos.Y},{Use:use,X:x,Y:y}));this.SimplePos.Use=use;this.SimplePos.X=x;this.SimplePos.Y=y};ParaDrawing.prototype.setExtent=function(extX,extY){History.Add(new CChangesParaDrawingExtent(this,
{W:this.Extent.W,H:this.Extent.H},{W:extX,H:extY}));this.Extent.W=extX;this.Extent.H=extY};ParaDrawing.prototype.addWrapPolygon=function(wrapPolygon){History.Add(new CChangesParaDrawingWrapPolygon(this,this.wrappingPolygon,wrapPolygon));this.wrappingPolygon=wrapPolygon};ParaDrawing.prototype.Set_Locked=function(bLocked){History.Add(new CChangesParaDrawingLocked(this,this.Locked,bLocked));this.Locked=bLocked};ParaDrawing.prototype.Set_RelativeHeight=function(nRelativeHeight){History.Add(new CChangesParaDrawingRelativeHeight(this,
this.RelativeHeight,nRelativeHeight));this.Set_RelativeHeight2(nRelativeHeight)};ParaDrawing.prototype.Set_RelativeHeight2=function(nRelativeHeight){this.RelativeHeight=nRelativeHeight;if(this.graphicObjects&&AscFormat.isRealNumber(nRelativeHeight)&&nRelativeHeight>this.graphicObjects.maximalGraphicObjectZIndex)this.graphicObjects.maximalGraphicObjectZIndex=nRelativeHeight};ParaDrawing.prototype.setEffectExtent=function(L,T,R,B){var oEE=this.EffectExtent;History.Add(new CChangesParaDrawingEffectExtent(this,
{L:oEE.L,T:oEE.T,R:oEE.R,B:oEE.B},{L:L,T:T,R:R,B:B}));this.EffectExtent.L=L;this.EffectExtent.T=T;this.EffectExtent.R=R;this.EffectExtent.B=B};ParaDrawing.prototype.Set_Parent=function(oParent){History.Add(new CChangesParaDrawingParent(this,this.Parent,oParent));this.Parent=oParent};ParaDrawing.prototype.IsWatermark=function(){if(!this.GraphicObj)return false;if(this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_Shape&&this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ImageShape)return false;
if(this.Is_Inline())return false;var oParagraph=this.GetParagraph();if(!(oParagraph instanceof Paragraph))return false;var oContent=oParagraph.Parent;if(!oContent||oContent.Is_DrawingShape(false))return false;var oHdrFtr=oContent.IsHdrFtr(true);if(!oHdrFtr)return false;var oRun=this.Get_Run();if(!oRun)return false;var arrDocPos=oRun.GetDocumentPositionFromObject();for(var nIndex=0,nCount=arrDocPos.length;nIndex<nCount;++nIndex){var oClass=arrDocPos[nIndex].Class;var oSdt=null;if(oClass instanceof
CDocumentContent&&oClass.Parent instanceof CBlockLevelSdt)oSdt=oClass.Parent;else if(oClass instanceof CInlineLevelSdt)oSdt=oClass;if(oSdt){var oPr=oSdt.Pr;if(AscCommon.isRealObject(oPr)&&AscCommon.isRealObject(oPr.DocPartObj)&&oPr.DocPartObj.Gallery==="Watermarks")return true}}return false};ParaDrawing.prototype.Set_ParaMath=function(ParaMath){History.Add(new CChangesParaDrawingParaMath(this,this.ParaMath,ParaMath));this.ParaMath=ParaMath};ParaDrawing.prototype.Set_LayoutInCell=function(LayoutInCell){if(this.LayoutInCell===
LayoutInCell)return;History.Add(new CChangesParaDrawingLayoutInCell(this,this.LayoutInCell,LayoutInCell));this.LayoutInCell=LayoutInCell};ParaDrawing.prototype.SetSizeRelH=function(oSize){History.Add(new CChangesParaDrawingSizeRelH(this,this.SizeRelH,oSize));this.SizeRelH=oSize};ParaDrawing.prototype.SetSizeRelV=function(oSize){History.Add(new CChangesParaDrawingSizeRelV(this,this.SizeRelV,oSize));this.SizeRelV=oSize};ParaDrawing.prototype.getXfrmExtX=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX))return this.GraphicObj.spPr.xfrm.extX;if(AscFormat.isRealNumber(this.Extent.W))return this.Extent.W;return 0};ParaDrawing.prototype.getXfrmExtY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY))return this.GraphicObj.spPr.xfrm.extY;
if(AscFormat.isRealNumber(this.Extent.H))return this.Extent.H;return 0};ParaDrawing.prototype.getXfrmRot=function(){if(AscCommon.isRealObject(this.GraphicObj)&&AscCommon.isRealObject(this.GraphicObj.spPr)&&AscCommon.isRealObject(this.GraphicObj.spPr.xfrm)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))return this.GraphicObj.spPr.xfrm.rot;return 0};ParaDrawing.prototype.Get_Bounds=function(){var InsL,InsT,InsR,InsB;InsL=0;InsT=0;InsR=0;InsB=0;if(!this.Is_Inline()){var oDistance=this.Get_Distance();
if(oDistance){InsL=oDistance.L;InsT=oDistance.T;InsR=oDistance.R;InsB=oDistance.B}}var ExtX=this.getXfrmExtX();var ExtY=this.getXfrmExtY();var Rot=this.getXfrmRot();var X,Y,W,H;if(AscFormat.checkNormalRotate(Rot)){X=this.X;Y=this.Y;W=ExtX;H=ExtY}else{X=this.X+ExtX/2-ExtY/2;Y=this.Y+ExtY/2-ExtX/2;W=ExtY;H=ExtX}return{Left:X-this.EffectExtent.L-InsL,Top:Y-this.EffectExtent.T-InsT,Bottom:Y+H+this.EffectExtent.B+InsB,Right:X+W+this.EffectExtent.R+InsR}};ParaDrawing.prototype.Search=function(Str,Props,
SearchEngine,Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.Search==="function")this.GraphicObj.Search(Str,Props,SearchEngine,Type)};ParaDrawing.prototype.Set_Props=function(Props){var bCheckWrapPolygon=false;var isPictureCC=false;var oRun=this.GetRun();if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=0,nCount=arrContentControls.length;nIndex<nCount;++nIndex)if(arrContentControls[nIndex].IsPicture()){isPictureCC=true;break}}if(undefined!=Props.WrappingStyle&&
!isPictureCC){if(drawing_Inline===this.DrawingType&&c_oAscWrapStyle2.Inline!=Props.WrappingStyle&&undefined===Props.Paddings)this.Set_Distance(3.2,0,3.2,0);this.Set_DrawingType(c_oAscWrapStyle2.Inline===Props.WrappingStyle?drawing_Inline:drawing_Anchor);if(c_oAscWrapStyle2.Inline===Props.WrappingStyle)if(AscCommon.isRealObject(this.GraphicObj.bounds)&&AscFormat.isRealNumber(this.GraphicObj.bounds.w)&&AscFormat.isRealNumber(this.GraphicObj.bounds.h))this.CheckWH();if(c_oAscWrapStyle2.Behind===Props.WrappingStyle||
c_oAscWrapStyle2.InFront===Props.WrappingStyle){this.Set_WrappingType(WRAPPING_TYPE_NONE);this.Set_BehindDoc(c_oAscWrapStyle2.Behind===Props.WrappingStyle?true:false)}else{switch(Props.WrappingStyle){case c_oAscWrapStyle2.Square:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);break;case c_oAscWrapStyle2.Tight:{bCheckWrapPolygon=true;this.Set_WrappingType(WRAPPING_TYPE_TIGHT);break}case c_oAscWrapStyle2.Through:{this.Set_WrappingType(WRAPPING_TYPE_THROUGH);bCheckWrapPolygon=true;break}case c_oAscWrapStyle2.TopAndBottom:this.Set_WrappingType(WRAPPING_TYPE_TOP_AND_BOTTOM);
break;default:this.Set_WrappingType(WRAPPING_TYPE_SQUARE);break}this.Set_BehindDoc(false)}}if(undefined!=Props.Paddings)this.Set_Distance(Props.Paddings.Left,Props.Paddings.Top,Props.Paddings.Right,Props.Paddings.Bottom);if(undefined!=Props.AllowOverlap)this.Set_AllowOverlap(Props.AllowOverlap);if(undefined!=Props.PositionH)this.Set_PositionH(Props.PositionH.RelativeFrom,Props.PositionH.UseAlign,true===Props.PositionH.UseAlign?Props.PositionH.Align:Props.PositionH.Value,Props.PositionH.Percent);if(undefined!=
Props.PositionV)this.Set_PositionV(Props.PositionV.RelativeFrom,Props.PositionV.UseAlign,true===Props.PositionV.UseAlign?Props.PositionV.Align:Props.PositionV.Value,Props.PositionV.Percent);if(undefined!=Props.SizeRelH)this.SetSizeRelH({RelativeFrom:AscFormat.ConvertRelPositionHToRelSize(Props.SizeRelH.RelativeFrom),Percent:Props.SizeRelH.Value/100});if(undefined!=Props.SizeRelV)this.SetSizeRelV({RelativeFrom:AscFormat.ConvertRelPositionVToRelSize(Props.SizeRelV.RelativeFrom),Percent:Props.SizeRelV.Value/
100});if(this.SizeRelH&&!this.SizeRelV)this.SetSizeRelV({RelativeFrom:AscCommon.c_oAscSizeRelFromV.sizerelfromvPage,Percent:0});if(this.SizeRelV&&!this.SizeRelH)this.SetSizeRelH({RelativeFrom:AscCommon.c_oAscSizeRelFromH.sizerelfromhPage,Percent:0});if(bCheckWrapPolygon)this.Check_WrapPolygon();if(undefined!=Props.description)this.docPr.setDescr(Props.description);if(undefined!=Props.title)this.docPr.setTitle(Props.title)};ParaDrawing.prototype.CheckWH=function(){if(!this.GraphicObj)return;var oldExtW=
this.Extent.W;var oldExtH=this.Extent.H;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){this.Extent.W=this.GraphicObj.spPr.xfrm.extX;this.Extent.H=this.GraphicObj.spPr.xfrm.extY}this.GraphicObj.recalculate();this.Extent.W=oldExtW;this.Extent.H=oldExtH;var extX,extY,rot;if(this.GraphicObj.spPr&&this.GraphicObj.spPr.xfrm){if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.extY)){extX=
this.GraphicObj.spPr.xfrm.extX;extY=this.GraphicObj.spPr.xfrm.extY}else{extX=5;extY=5}if(AscFormat.isRealNumber(this.GraphicObj.spPr.xfrm.rot))rot=this.GraphicObj.spPr.xfrm.rot;else rot=0}else{extX=5;extY=5;rot=0}this.setExtent(extX,extY);var EEL=0,EET=0,EER=0,EEB=0;{var xc=this.GraphicObj.localTransform.TransformPointX(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var yc=this.GraphicObj.localTransform.TransformPointY(this.GraphicObj.extX/2,this.GraphicObj.extY/2);var oBounds=this.GraphicObj.bounds;
var LineCorrect=0;if(this.GraphicObj.pen&&this.GraphicObj.pen.Fill&&this.GraphicObj.pen.Fill.fill){LineCorrect=this.GraphicObj.pen.w==null?12700:parseInt(this.GraphicObj.pen.w);LineCorrect/=72E3}var l=oBounds.x;var r=l+oBounds.w;var t=oBounds.y;var b=t+oBounds.h;var startX,startY;if(!AscFormat.checkNormalRotate(rot)){var temp=extX;extX=extY;extY=temp}startX=xc-extX/2;startY=yc-extY/2;if(l>startX)l=startX;if(r<startX+extX)r=startX+extX;if(t>startY)t=startY;if(b<startY+extY)b=startY+extY;EEL=xc-extX/
2-l+LineCorrect;EET=yc-extY/2-t+LineCorrect;EER=r+LineCorrect-(xc+extX/2);EEB=b+LineCorrect-(yc+extY/2)}this.setEffectExtent(EEL,EET,EER,EEB);this.Check_WrapPolygon()};ParaDrawing.prototype.Check_WrapPolygon=function(){if((this.wrappingType===WRAPPING_TYPE_TIGHT||this.wrappingType===WRAPPING_TYPE_THROUGH)&&this.wrappingPolygon&&!this.wrappingPolygon.edited){this.GraphicObj.recalculate();this.wrappingPolygon.setArrRelPoints(this.wrappingPolygon.calculate(this.GraphicObj))}};ParaDrawing.prototype.Draw=
function(X,Y,pGraphics,PDSE){var nPageIndex=null;if(AscCommon.isRealObject(PDSE))nPageIndex=PDSE.Page;if(pGraphics.Start_Command){pGraphics.m_aDrawings.push(new AscFormat.ParaDrawingStruct(undefined,this));return}if(this.Is_Inline()){pGraphics.shapePageIndex=nPageIndex;this.draw(pGraphics,PDSE);pGraphics.shapePageIndex=null}if(pGraphics.End_Command)pGraphics.End_Command()};ParaDrawing.prototype.Measure=function(){if(!this.GraphicObj){this.Width=0;this.Height=0;return}if(AscFormat.isRealNumber(this.Extent.W)&&
AscFormat.isRealNumber(this.Extent.H)&&(!this.GraphicObj.checkAutofit||!this.GraphicObj.checkAutofit())&&!this.SizeRelH&&!this.SizeRelV){var oEffectExtent=this.EffectExtent;var W,H;if(AscFormat.isRealNumber(this.GraphicObj.rot))if(AscFormat.checkNormalRotate(this.GraphicObj.rot)){W=this.Extent.W;H=this.Extent.H}else{W=this.Extent.H;H=this.Extent.W}else{W=this.Extent.W;H=this.Extent.H}this.Width=W+AscFormat.getValOrDefault(oEffectExtent.L,0)+AscFormat.getValOrDefault(oEffectExtent.R,0);this.Height=
H+AscFormat.getValOrDefault(oEffectExtent.T,0)+AscFormat.getValOrDefault(oEffectExtent.B,0);this.WidthVisible=this.Width}else{this.GraphicObj.recalculate();if(this.GraphicObj.recalculateText)this.GraphicObj.recalculateText();if(this.PositionH.UseAlign||this.Is_Inline())this.Width=this.GraphicObj.bounds.w;else this.Width=this.GraphicObj.extX;this.WidthVisible=this.Width;if(this.PositionV.UseAlign||this.Is_Inline())this.Height=this.GraphicObj.bounds.h;else this.Height=this.GraphicObj.extY}};ParaDrawing.prototype.SaveRecalculateObject=
function(Copy){var DrawingObj={};DrawingObj.Type=this.Type;DrawingObj.DrawingType=this.DrawingType;DrawingObj.WrappingType=this.wrappingType;if(drawing_Anchor===this.Get_DrawingType()&&true===this.Use_TextWrap()){var oDistance=this.Get_Distance();DrawingObj.FlowPos={X:this.X-oDistance.L,Y:this.Y-oDistance.T,W:this.Width+oDistance.R,H:this.Height+oDistance.B}}DrawingObj.PageNum=this.PageNum;DrawingObj.X=this.X;DrawingObj.Y=this.Y;DrawingObj.spRecaclcObject=this.GraphicObj.getRecalcObject();return DrawingObj};
ParaDrawing.prototype.LoadRecalculateObject=function(RecalcObj){this.updatePosition3(RecalcObj.PageNum,RecalcObj.X,RecalcObj.Y);this.GraphicObj.setRecalcObject(RecalcObj.spRecaclcObject)};ParaDrawing.prototype.Reassign_ImageUrls=function(mapUrls){if(this.GraphicObj)this.GraphicObj.Reassign_ImageUrls(mapUrls)};ParaDrawing.prototype.PrepareRecalculateObject=function(){};ParaDrawing.prototype.Is_RealContent=function(){return true};ParaDrawing.prototype.Can_AddNumbering=function(){if(drawing_Inline===
this.DrawingType)return true;return false};ParaDrawing.prototype.Copy=function(oPr){var c=new ParaDrawing(this.Extent.W,this.Extent.H,null,editor.WordControl.m_oLogicDocument.DrawingDocument,null,null);c.Set_DrawingType(this.DrawingType);if(AscCommon.isRealObject(this.GraphicObj)){var oCopyPr=new AscFormat.CCopyObjectProperties;oCopyPr.contentCopyPr=oPr;c.Set_GraphicObject(this.GraphicObj.copy(oCopyPr));c.GraphicObj.setParent(c)}var d=this.Distance;c.Set_PositionH(this.PositionH.RelativeFrom,this.PositionH.Align,
this.PositionH.Value,this.PositionH.Percent);c.Set_PositionV(this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);c.Set_Distance(d.L,d.T,d.R,d.B);c.Set_AllowOverlap(this.AllowOverlap);c.Set_WrappingType(this.wrappingType);if(this.wrappingPolygon)c.wrappingPolygon.fromOther(this.wrappingPolygon);c.Set_BehindDoc(this.behindDoc);c.Set_RelativeHeight(this.RelativeHeight);if(this.SizeRelH)c.SetSizeRelH({RelativeFrom:this.SizeRelH.RelativeFrom,Percent:this.SizeRelH.Percent});
if(this.SizeRelV)c.SetSizeRelV({RelativeFrom:this.SizeRelV.RelativeFrom,Percent:this.SizeRelV.Percent});if(AscFormat.isRealNumber(this.Extent.W)&&AscFormat.isRealNumber(this.Extent.H))c.setExtent(this.Extent.W,this.Extent.H);var EE=this.EffectExtent;if(EE.L>0||EE.T>0||EE.R>0||EE.B>0)c.setEffectExtent(EE.L,EE.T,EE.R,EE.B);c.docPr.setFromOther(this.docPr);if(this.ParaMath)c.Set_ParaMath(this.ParaMath.Copy());return c};ParaDrawing.prototype.IsEqual=function(oElement){return false};ParaDrawing.prototype.Get_Id=
function(){return this.Id};ParaDrawing.prototype.GetId=function(){return this.Id};ParaDrawing.prototype.setParagraphTabs=function(tabs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphTabs==="function")this.GraphicObj.setParagraphTabs(tabs)};ParaDrawing.prototype.IsMovingTableBorder=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.IsMovingTableBorder==="function")return this.GraphicObj.IsMovingTableBorder();return false};ParaDrawing.prototype.SetVerticalClip=
function(Top,Bottom){this.LineTop=Top;this.LineBottom=Bottom};ParaDrawing.prototype.Update_Position=function(Paragraph,ParaLayout,PageLimits,PageLimitsOrigin,LineNum){if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom2;this.PositionH.Align=this.PositionH_Old.Align2;this.PositionH.Value=this.PositionH_Old.Value2;this.PositionH.Percent=this.PositionH_Old.Percent2}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom2;
this.PositionV.Align=this.PositionV_Old.Align2;this.PositionV.Value=this.PositionV_Old.Value2;this.PositionV.Percent=this.PositionV_Old.Percent2}var oDocumentContent=this.Parent&&this.Parent.Parent;if(oDocumentContent&&oDocumentContent.IsBlockLevelSdtContent())oDocumentContent=oDocumentContent.Parent.Parent;this.Parent=Paragraph;this.DocumentContent=oDocumentContent;var PageNum=ParaLayout.PageNum;var OtherFlowObjects=editor.WordControl.m_oLogicDocument.DrawingObjects.getAllFloatObjectsOnPage(PageNum,
this.Parent.Parent);var bInline=this.Is_Inline();this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,ParaLayout,PageLimits);this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent);this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);var bCorrect=false;if(oDocumentContent&&
oDocumentContent.IsTableCellContent&&oDocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(bInline,PageLimits,this.AllowOverlap,this.Use_TextWrap(),OtherFlowObjects,bCorrect);this.GraphicObj.bounds.l=this.GraphicObj.bounds.x+this.Internal_Position.CalcX;this.GraphicObj.bounds.r=this.GraphicObj.bounds.x+this.GraphicObj.bounds.w+this.Internal_Position.CalcX;
this.GraphicObj.bounds.t=this.GraphicObj.bounds.y+this.Internal_Position.CalcY;this.GraphicObj.bounds.b=this.GraphicObj.bounds.y+this.GraphicObj.bounds.h+this.Internal_Position.CalcY;var OldPageNum=this.PageNum;this.PageNum=PageNum;this.LineNum=LineNum;this.X=this.Internal_Position.CalcX;this.Y=this.Internal_Position.CalcY;if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom;this.PositionH.Align=this.PositionH_Old.Align;this.PositionH.Value=this.PositionH_Old.Value;
this.PositionH.Percent=this.PositionH_Old.Percent;var Value=this.Internal_Position.Calculate_X_Value(this.PositionH_Old.RelativeFrom);this.Set_PositionH(this.PositionH_Old.RelativeFrom,false,Value,false);this.X=this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom;this.PositionV.Align=this.PositionV_Old.Align;this.PositionV.Value=
this.PositionV_Old.Value;this.PositionV.Percent=this.PositionV_Old.Percent;var Value=this.Internal_Position.Calculate_Y_Value(this.PositionV_Old.RelativeFrom);this.Set_PositionV(this.PositionV_Old.RelativeFrom,false,Value,false);this.Y=this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}this.OrigX=this.X;this.OrigY=this.Y;this.ShiftX=0;this.ShiftY=0;this.updatePosition3(this.PageNum,this.X,this.Y,OldPageNum);this.useWrap=
this.Use_TextWrap()};ParaDrawing.prototype.GetClipRect=function(){if(this.Is_Inline()||this.Use_TextWrap()){var oCell;if(this.DocumentContent&&(oCell=this.DocumentContent.IsTableCellContent(true))){var arrPages=oCell.GetCurPageByAbsolutePage(this.PageNum);for(var nIndex=0,nCount=arrPages.length;nIndex<nCount;++nIndex){var oPageBounds=oCell.GetPageBounds(arrPages[nIndex]);if(this.GraphicObj.bounds.isIntersect(oPageBounds.Left,oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom))return new AscFormat.CGraphicBounds(oPageBounds.Left,
oPageBounds.Top,oPageBounds.Right,oPageBounds.Bottom)}}}return null};ParaDrawing.prototype.Update_PositionYHeaderFooter=function(TopMarginY,BottomMarginY){this.Internal_Position.Update_PositionYHeaderFooter(TopMarginY,BottomMarginY);this.Internal_Position.Calculate_Y(this.Is_Inline(),this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);this.OrigY=this.Internal_Position.CalcY;this.Y=this.OrigY+this.ShiftY;this.updatePosition3(this.PageNum,this.X,this.Y,this.PageNum)};
ParaDrawing.prototype.Reset_SavedPosition=function(){this.PositionV_Old=undefined;this.PositionH_Old=undefined};ParaDrawing.prototype.setParagraphBorders=function(val){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphBorders==="function")this.GraphicObj.setParagraphBorders(val)};ParaDrawing.prototype.deselect=function(){this.selected=false;if(this.GraphicObj&&this.GraphicObj.deselect)this.GraphicObj.deselect()};ParaDrawing.prototype.updatePosition3=function(pageIndex,
x,y,oldPageNum){var _x=x,_y=y;this.graphicObjects.removeById(pageIndex,this.Get_Id());if(AscFormat.isRealNumber(oldPageNum))this.graphicObjects.removeById(oldPageNum,this.Get_Id());var bChangePageIndex=this.pageIndex!==pageIndex;this.setPageIndex(pageIndex);if(typeof this.GraphicObj.setStartPage==="function"){var bIsHfdFtr=this.DocumentContent&&this.DocumentContent.IsHdrFtr();this.GraphicObj.setStartPage(pageIndex,bIsHfdFtr,bIsHfdFtr||bChangePageIndex)}if(!(this.DocumentContent&&this.DocumentContent.IsHdrFtr()&&
this.DocumentContent.Get_StartPage_Absolute()!==pageIndex)){this.graphicObjects.addObjectOnPage(pageIndex,this.GraphicObj);this.bNoNeedToAdd=false}else this.bNoNeedToAdd=true;if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.GraphicObj.posX)&&AscFormat.isRealNumber(this.GraphicObj.posY))||!(Math.abs(this.GraphicObj.posX-_x)<MOVE_DELTA&&Math.abs(this.GraphicObj.posY-_y)<MOVE_DELTA))this.GraphicObj.updatePosition(_x,_y);if(this.GraphicObj.bNeedUpdatePosition||!(AscFormat.isRealNumber(this.wrappingPolygon.posX)&&
AscFormat.isRealNumber(this.wrappingPolygon.posY))||!(Math.abs(this.wrappingPolygon.posX-_x)<MOVE_DELTA&&Math.abs(this.wrappingPolygon.posY-_y)<MOVE_DELTA))this.wrappingPolygon.updatePosition(_x,_y);this.calculateSnapArrays()};ParaDrawing.prototype.calculateAfterChangeTheme=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.calculateAfterChangeTheme==="function")this.GraphicObj.calculateAfterChangeTheme()};ParaDrawing.prototype.selectionIsEmpty=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.selectionIsEmpty==="function")return this.GraphicObj.selectionIsEmpty();return false};ParaDrawing.prototype.recalculateDocContent=function(){};ParaDrawing.prototype.Shift=function(Dx,Dy){this.ShiftX=Dx;this.ShiftY=Dy;this.X=this.OrigX+Dx;this.Y=this.OrigY+Dy;this.updatePosition3(this.PageNum,this.X,this.Y)};ParaDrawing.prototype.IsLayoutInCell=function(){if(this.LogicDocument&&this.LogicDocument.GetCompatibilityMode()>=AscCommon.document_compatibility_mode_Word15)return true;
return this.LayoutInCell};ParaDrawing.prototype.Get_Distance=function(){var oDist=this.Distance;return new AscFormat.CDistance(AscFormat.getValOrDefault(oDist.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.T,0),AscFormat.getValOrDefault(oDist.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.B,0))};ParaDrawing.prototype.Set_XYForAdd=function(X,Y,NearPos,PageNum){if(null!==NearPos){var Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,
Y,PageNum,Layout,true,true);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.TurnOff_InterfaceEvents();oLogicDocument.Recalculate();oLogicDocument.TurnOn_InterfaceEvents(false);this.SetSkipOnRecalculate(false)}if(null!==nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,
Y,PageNum,Layout,true,true)}};ParaDrawing.prototype.SetSkipOnRecalculate=function(isSkip){this.SkipOnRecalculate=isSkip};ParaDrawing.prototype.IsSkipOnRecalculate=function(){return this.SkipOnRecalculate};ParaDrawing.prototype.Set_XY=function(X,Y,Paragraph,PageNum,bResetAlign){if(Paragraph){var PageNumOld=this.PageNum;var ContentPos=Paragraph.Get_DrawingObjectContentPos(this.Get_Id());if(null===ContentPos)return;var Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,
Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.Recalculate();this.SetSkipOnRecalculate(false)}if(null!==nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);if(!this.LogicDocument||null===this.LogicDocument.FullRecalc.Id||PageNum<
this.LogicDocument.FullRecalc.PageIndex&&PageNumOld<this.LogicDocument.FullRecalc.PageIndex)Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false)}};ParaDrawing.prototype.private_SetXYByLayout=function(X,Y,PageNum,Layout,bChangeX,bChangeY){if(!Layout)return;this.PageNum=PageNum;this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),
this.EffectExtent,this.YOffset,Layout.ParagraphLayout,Layout.PageLimitsOrigin);this.Internal_Position.Calculate_X(false,c_oAscRelativeFromH.Page,false,X-Layout.PageLimitsOrigin.X,false);this.Internal_Position.Calculate_Y(false,c_oAscRelativeFromV.Page,false,Y-Layout.PageLimitsOrigin.Y,false);var bCorrect=false;if(this.DocumentContent&&this.DocumentContent.IsTableCellContent&&this.DocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==
c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(false,Layout.PageLimits,this.AllowOverlap,this.Use_TextWrap(),[],bCorrect);if(true===bChangeX){this.X=this.Internal_Position.CalcX;var ValueX=this.Internal_Position.Calculate_X_Value(this.PositionH.RelativeFrom);this.Set_PositionH(this.PositionH.RelativeFrom,false,ValueX,false);this.X=this.Internal_Position.Calculate_X(false,this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(true===
bChangeY){this.Y=this.Internal_Position.CalcY;var ValueY=this.Internal_Position.Calculate_Y_Value(this.PositionV.RelativeFrom);this.Set_PositionV(this.PositionV.RelativeFrom,false,ValueY,false);this.Y=this.Internal_Position.Calculate_Y(false,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}};ParaDrawing.prototype.Get_DrawingType=function(){return this.DrawingType};ParaDrawing.prototype.Is_Inline=function(){if(this.Parent&&this.Parent.Get_ParentTextTransform&&
this.Parent.Get_ParentTextTransform())return true;return drawing_Inline===this.DrawingType?true:false};ParaDrawing.prototype.IsInline=function(){return this.Is_Inline()};ParaDrawing.prototype.Use_TextWrap=function(){if(!this.Parent||!this.Parent.Get_FramePr||null!==this.Parent.Get_FramePr()&&undefined!==this.Parent.Get_FramePr())return false;return drawing_Anchor===this.DrawingType&&!(this.wrappingType===WRAPPING_TYPE_NONE)};ParaDrawing.prototype.IsUseTextWrap=function(){return this.Use_TextWrap()};
ParaDrawing.prototype.Draw_Selection=function(){var Padding=this.DrawingDocument.GetMMPerDot(6);var extX,extY;if(this.GraphicObj){extX=this.GraphicObj.extX;extY=this.GraphicObj.extY}else{extX=this.getXfrmExtX();extY=this.getXfrmExtY()}var rot=this.getXfrmRot();if(AscFormat.checkNormalRotate(rot))this.DrawingDocument.AddPageSelection(this.PageNum,this.X-this.EffectExtent.L-Padding,this.Y-this.EffectExtent.T-Padding,this.EffectExtent.L+extX+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extY+this.EffectExtent.B+
2*Padding);else this.DrawingDocument.AddPageSelection(this.PageNum,this.X+extX/2-extY/2-this.EffectExtent.L-Padding,this.Y+extY/2-extX/2-this.EffectExtent.T-Padding,this.EffectExtent.L+extY+this.EffectExtent.R+2*Padding,this.EffectExtent.T+extX+this.EffectExtent.B+2*Padding)};ParaDrawing.prototype.CanInsertToPos=function(oAnchorPos){if(!oAnchorPos||!oAnchorPos.Paragraph||!oAnchorPos.Paragraph.Parent)return false;return!((this.IsShape()||this.IsGroup())&&(true===oAnchorPos.Paragraph.Parent.Is_DrawingShape()||
true===oAnchorPos.Paragraph.Parent.IsFootnote()))};ParaDrawing.prototype.OnEnd_MoveInline=function(NearPos){if(!this.Parent)return;NearPos.Paragraph.Check_NearestPos(NearPos);var oRun=this.GetRun();var oPictureCC=false;if(oRun){var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}}var oDstRun=null;var arrClasses=NearPos.Paragraph.GetClassesByPos(NearPos.ContentPos);
for(var nIndex=arrClasses.length-1;nIndex>=0;--nIndex)if(arrClasses[nIndex]instanceof ParaRun){oDstRun=arrClasses[nIndex];break}if(!oDstRun||oPictureCC&&oDstRun===oRun||oDstRun.GetParentForm()){NearPos.Paragraph.Clear_NearestPosArray();return}var NewParaDrawing=this.Copy();var RunPr=this.Remove_FromDocument(false);this.DocumentContent.Select_DrawingObject(NewParaDrawing.GetId());NewParaDrawing.Add_ToDocument(NearPos,true,RunPr,undefined,oPictureCC)};ParaDrawing.prototype.Get_ParentTextTransform=function(){if(this.Parent)return this.Parent.Get_ParentTextTransform();
return null};ParaDrawing.prototype.GoTo_Text=function(bBefore,bUpdateStates){var Paragraph=this.Get_ParentParagraph();if(Paragraph){Paragraph.MoveCursorToDrawing(this.Id,bBefore);Paragraph.Document_SetThisElementCurrent(undefined===bUpdateStates?true:bUpdateStates)}};ParaDrawing.prototype.Remove_FromDocument=function(bRecalculate){var oResult=null;if(!this.Parent)return oResult;var oRun=this.Parent.Get_DrawingObjectRun(this.Id);if(oRun){var oGrObject=this.GraphicObj;if(oGrObject&&oGrObject.getObjectType()===
AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine)oGrObject.setSignature(oGrObject.signatureLine);var oPictureCC=null;var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}if(oPictureCC)oPictureCC.RemoveContentControlWrapper();oRun.Remove_DrawingObject(this.Id);if(oRun.IsInHyperlink())oResult=new CTextPr;else oResult=oRun.GetTextPr();if(oGrObject&&
oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine){editor.sendEvent("asc_onRemoveSignature",oGrObject.signatureLine.id);oGrObject.setSignature(oGrObject.signatureLine)}}if(false!=bRecalculate)editor.WordControl.m_oLogicDocument.Recalculate();return oResult};ParaDrawing.prototype.Get_ParentParagraph=function(){if(this.Parent instanceof Paragraph)return this.Parent;if(this.Parent instanceof ParaRun)return this.Parent.Paragraph;if(this.Parent&&this.Parent.GetParagraph())return this.Parent.GetParagraph();
return null};ParaDrawing.prototype.SelectAsText=function(){var oParagraph=this.GetParagraph();var oRun=this.GetRun();if(!oParagraph||!oRun)return;var oDocument=oParagraph.GetLogicDocument();if(!oDocument)return;oDocument.RemoveSelection();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this));var oStartPos=oDocument.GetContentPosition(false);oRun.SetCursorPosition(oRun.GetElementPosition(this)+1);var oEndPos=oDocument.GetContentPosition(false);oDocument.RemoveSelection();
oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};ParaDrawing.prototype.Add_ToDocument=function(NearPos,bRecalculate,RunPr,Run,oPictureCC){NearPos.Paragraph.Check_NearestPos(NearPos);var LogicDocument=this.DrawingDocument.m_oLogicDocument;var Para=new Paragraph(this.DrawingDocument,LogicDocument);var DrawingRun=new ParaRun(Para);DrawingRun.Add_ToContent(0,this);if(RunPr)DrawingRun.Set_Pr(RunPr.Copy());if(Run)DrawingRun.SetReviewTypeWithInfo(Run.GetReviewType(),Run.GetReviewInfo());if(oPictureCC){var oSdt=
new CInlineLevelSdt;oSdt.SetPicturePr(true);oSdt.ReplacePlaceHolderWithContent();oSdt.AddToContent(0,DrawingRun);Para.Add_ToContent(0,oSdt);var oFormPr=oPictureCC.GetFormPr();if(oFormPr)oSdt.SetFormPr(oFormPr.Copy())}else Para.Add_ToContent(0,DrawingRun);var SelectedElement=new CSelectedElement(Para,false);var SelectedContent=new CSelectedContent;SelectedContent.Add(SelectedElement);SelectedContent.SetMoveDrawing(true);SelectedContent.DrawingObjects.push(this);NearPos.Paragraph.Parent.InsertContent(SelectedContent,
NearPos);NearPos.Paragraph.Clear_NearestPosArray();NearPos.Paragraph.Correct_Content();this.Set_Parent(NearPos.Paragraph);if(false!=bRecalculate)LogicDocument.Recalculate()};ParaDrawing.prototype.Add_ToDocument2=function(Paragraph){var DrawingRun=new ParaRun(Paragraph);DrawingRun.Add_ToContent(0,this);Paragraph.Add_ToContent(0,DrawingRun);this.Set_Parent(Paragraph)};ParaDrawing.prototype.UpdateCursorType=function(X,Y,PageIndex){this.DrawingDocument.SetCursorType("move",new AscCommon.CMouseMoveData);
if(null!=this.Parent){var Lock=this.Parent.Lock;if(true===Lock.Is_Locked()){var PNum=Math.max(0,Math.min(PageIndex-this.Parent.PageNum,this.Parent.Pages.length-1));var _X=this.Parent.Pages[PNum].X;var _Y=this.Parent.Pages[PNum].Y;var MMData=new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Parent.Get_StartPage_Absolute()+(PageIndex-this.Parent.PageNum));MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;
MMData.UserId=Lock.Get_UserId();MMData.HaveChanges=Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}}};ParaDrawing.prototype.Get_AnchorPos=function(){if(!this.Parent)return null;return this.Parent.Get_AnchorPos(this)};ParaDrawing.prototype.CheckRecalcAutoFit=function(oSectPr){if(this.GraphicObj&&this.GraphicObj.CheckNeedRecalcAutoFit)if(this.GraphicObj.CheckNeedRecalcAutoFit(oSectPr)){if(this.GraphicObj)this.GraphicObj.recalcWrapPolygon&&
this.GraphicObj.recalcWrapPolygon();this.Measure()}};ParaDrawing.prototype.Get_ParentObject_or_DocumentPos=function(){if(this.Parent!=null)return this.Parent.Get_ParentObject_or_DocumentPos()};ParaDrawing.prototype.Refresh_RecalcData=function(Data){var oRun=this.GetRun();if(oRun){if(AscCommon.isRealObject(Data))switch(Data.Type){case AscDFH.historyitem_Drawing_Distance:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}case AscDFH.historyitem_Drawing_SetExtent:{oRun.RecalcInfo.Measure=
true;break}case AscDFH.historyitem_Drawing_SetSizeRelH:case AscDFH.historyitem_Drawing_SetSizeRelV:case AscDFH.historyitem_Drawing_SetGraphicObject:{if(this.GraphicObj){this.GraphicObj.handleUpdateExtents&&this.GraphicObj.handleUpdateExtents();this.GraphicObj.addToRecalculate()}oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_WrappingType:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}}return oRun.Refresh_RecalcData2()}};
ParaDrawing.prototype.Refresh_RecalcData2=function(Data){var oRun=this.GetRun();if(oRun)return oRun.Refresh_RecalcData2()};ParaDrawing.prototype.hyperlinkCheck=function(bCheck){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCheck==="function")return this.GraphicObj.hyperlinkCheck(bCheck);return null};ParaDrawing.prototype.hyperlinkCanAdd=function(bCheckInHyperlink){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkCanAdd(bCheckInHyperlink);
return false};ParaDrawing.prototype.hyperlinkRemove=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkRemove();return false};ParaDrawing.prototype.hyperlinkModify=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkModify==="function")return this.GraphicObj.hyperlinkModify(HyperProps)};ParaDrawing.prototype.hyperlinkAdd=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.hyperlinkAdd==="function")return this.GraphicObj.hyperlinkAdd(HyperProps)};ParaDrawing.prototype.documentStatistics=function(stat){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentStatistics==="function")this.GraphicObj.documentStatistics(stat)};ParaDrawing.prototype.documentCreateFontCharMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontCharMap==="function")this.GraphicObj.documentCreateFontCharMap(fontMap)};
ParaDrawing.prototype.documentCreateFontMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontMap==="function")this.GraphicObj.documentCreateFontMap(fontMap)};ParaDrawing.prototype.tableCheckSplit=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckSplit==="function")return this.GraphicObj.tableCheckSplit();return false};ParaDrawing.prototype.tableCheckMerge=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.tableCheckMerge==="function")return this.GraphicObj.tableCheckMerge();return false};ParaDrawing.prototype.tableSelect=function(Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSelect==="function")return this.GraphicObj.tableSelect(Type)};ParaDrawing.prototype.tableRemoveTable=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveTable==="function")return this.GraphicObj.tableRemoveTable()};ParaDrawing.prototype.tableSplitCell=
function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSplitCell==="function")return this.GraphicObj.tableSplitCell(Cols,Rows)};ParaDrawing.prototype.tableMergeCells=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableMergeCells==="function")return this.GraphicObj.tableMergeCells(Cols,Rows)};ParaDrawing.prototype.tableRemoveCol=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveCol===
"function")return this.GraphicObj.tableRemoveCol()};ParaDrawing.prototype.tableAddCol=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddCol==="function")return this.GraphicObj.tableAddCol(bBefore,nCount)};ParaDrawing.prototype.tableRemoveRow=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveRow==="function")return this.GraphicObj.tableRemoveRow()};ParaDrawing.prototype.tableAddRow=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.tableAddRow==="function")return this.GraphicObj.tableAddRow(bBefore,nCount)};ParaDrawing.prototype.getCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurrentParagraph==="function")return this.GraphicObj.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs);if(this.Parent instanceof Paragraph)return this.Parent};ParaDrawing.prototype.GetSelectedText=function(bClearText,oPr){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.GetSelectedText==="function")return this.GraphicObj.GetSelectedText(bClearText,oPr);return""};ParaDrawing.prototype.getCurPosXY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurPosXY==="function")return this.GraphicObj.getCurPosXY();return{X:0,Y:0}};ParaDrawing.prototype.setParagraphKeepLines=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepLines==="function")return this.GraphicObj.setParagraphKeepLines(Value)};
ParaDrawing.prototype.setParagraphKeepNext=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepNext==="function")return this.GraphicObj.setParagraphKeepNext(Value)};ParaDrawing.prototype.setParagraphWidowControl=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphWidowControl==="function")return this.GraphicObj.setParagraphWidowControl(Value)};ParaDrawing.prototype.setParagraphPageBreakBefore=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.setParagraphPageBreakBefore==="function")return this.GraphicObj.setParagraphPageBreakBefore(Value)};ParaDrawing.prototype.isTextSelectionUse=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.isTextSelectionUse();return false};ParaDrawing.prototype.paragraphFormatPaste=function(CopyTextPr,CopyParaPr,Bool){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.paragraphFormatPaste(CopyTextPr,
CopyParaPr,Bool)};ParaDrawing.prototype.getNearestPos=function(x,y,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getNearestPos==="function")return this.GraphicObj.getNearestPos(x,y,pageIndex);return null};ParaDrawing.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.Type);Writer.WriteString2(this.Id)};ParaDrawing.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Drawing);Writer.WriteString2(this.Id);AscFormat.writeDouble(Writer,
this.Extent.W);AscFormat.writeDouble(Writer,this.Extent.H);AscFormat.writeObject(Writer,this.GraphicObj);AscFormat.writeObject(Writer,this.DocumentContent);AscFormat.writeObject(Writer,this.Parent);AscFormat.writeObject(Writer,this.wrappingPolygon);AscFormat.writeLong(Writer,this.RelativeHeight);AscFormat.writeObject(Writer,this.docPr)};ParaDrawing.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.DrawingDocument=editor.WordControl.m_oLogicDocument.DrawingDocument;this.LogicDocument=
this.DrawingDocument?this.DrawingDocument.m_oLogicDocument:null;this.Extent.W=AscFormat.readDouble(Reader);this.Extent.H=AscFormat.readDouble(Reader);this.GraphicObj=AscFormat.readObject(Reader);this.DocumentContent=AscFormat.readObject(Reader);this.Parent=AscFormat.readObject(Reader);this.wrappingPolygon=AscFormat.readObject(Reader);this.RelativeHeight=AscFormat.readLong(Reader);this.docPr=AscFormat.readObject(Reader);if(this.wrappingPolygon)this.wrappingPolygon.wordGraphicObject=this;this.drawingDocument=
editor.WordControl.m_oLogicDocument.DrawingDocument;this.document=editor.WordControl.m_oLogicDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.graphicObjects.addGraphicObject(this);g_oTableId.Add(this,this.Id)};ParaDrawing.prototype.Load_LinkData=function(){};ParaDrawing.prototype.draw=function(graphics,PDSE){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.draw==="function"){graphics.SaveGrState();var bInline=this.Is_Inline();if(bInline&&AscCommon.isRealObject(PDSE)&&
AscFormat.isRealNumber(this.LineTop)&&AscFormat.isRealNumber(this.LineBottom)&&AscCommon.isRealObject(this.GraphicObj.bounds)){var x,y,w,h;var oEffectExtent=this.EffectExtent;x=PDSE.X;y=this.LineTop;w=this.GraphicObj.bounds.r-this.GraphicObj.bounds.l+AscFormat.getValOrDefault(oEffectExtent.R,0)+AscFormat.getValOrDefault(oEffectExtent.L,0);h=this.LineBottom-this.LineTop;graphics.AddClipRect(x,y,w,h)}this.GraphicObj.draw(graphics);graphics.RestoreGrState()}};ParaDrawing.prototype.drawAdjustments=function(){if(AscCommon.isRealObject(this.GraphicObj)&&
typeof this.GraphicObj.drawAdjustments==="function")this.GraphicObj.drawAdjustments()};ParaDrawing.prototype.getTransformMatrix=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getTransformMatrix==="function")return this.GraphicObj.getTransformMatrix();return null};ParaDrawing.prototype.getExtensions=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getExtensions==="function")return this.GraphicObj.getExtensions();return null};ParaDrawing.prototype.isGroup=
function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isGroup==="function")return this.GraphicObj.isGroup();return false};ParaDrawing.prototype.isShapeChild=function(bRetShape){if(!this.Is_Inline()||!this.DocumentContent)return bRetShape?null:false;var cur_doc_content=this.DocumentContent;var oCell;while(oCell=cur_doc_content.IsTableCellContent(true))cur_doc_content=oCell.Row.Table.Parent;if(AscCommon.isRealObject(cur_doc_content.Parent)&&typeof cur_doc_content.Parent.getObjectType===
"function"&&cur_doc_content.Parent.getObjectType()===AscDFH.historyitem_type_Shape)return bRetShape?cur_doc_content.Parent:true;return bRetShape?null:false};ParaDrawing.prototype.checkShapeChildAndGetTopParagraph=function(paragraph){var parent_paragraph=!paragraph?this.Get_ParentParagraph():paragraph;var parent_doc_content=parent_paragraph.Parent;if(parent_doc_content.Parent instanceof AscFormat.CShape)if(!parent_doc_content.Parent.group)return parent_doc_content.Parent.parent.Get_ParentParagraph();
else{var top_group=parent_doc_content.Parent.group;while(top_group.group)top_group=top_group.group;return top_group.parent.Get_ParentParagraph()}else if(parent_doc_content.IsTableCellContent()){var top_doc_content=parent_doc_content;var oCell;while(oCell=top_doc_content.IsTableCellContent(true))top_doc_content=oCell.Row.Table.Parent;if(top_doc_content.Parent instanceof AscFormat.CShape)if(!top_doc_content.Parent.group)return top_doc_content.Parent.parent.Get_ParentParagraph();else{var top_group=top_doc_content.Parent.group;
while(top_group.group)top_group=top_group.group;return top_group.parent.Get_ParentParagraph()}else return parent_paragraph}return parent_paragraph};ParaDrawing.prototype.hit=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hit==="function")return this.GraphicObj.hit(x,y);return false};ParaDrawing.prototype.hitToTextRect=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hitToTextRect==="function")return this.GraphicObj.hitToTextRect(x,
y);return false};ParaDrawing.prototype.cursorGetPos=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorGetPos==="function")return this.GraphicObj.cursorGetPos();return{X:0,Y:0}};ParaDrawing.prototype.getResizeCoefficients=function(handleNum,x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getResizeCoefficients==="function")return this.GraphicObj.getResizeCoefficients(handleNum,x,y);return{kd1:1,kd2:1}};ParaDrawing.prototype.getParagraphParaPr=
@ -19395,59 +19396,59 @@ this.CheckFootnote(X,Y,CurPage);if(isInText&&null!=oHyperlink&&(Y<=this.Pages[Cu
Asc.c_oAscMouseMoveDataTypes.Common;if(isInText&&(null!=oHyperlink||bPageRefLink)&&true===AscCommon.global_keyboardEvent.CtrlKey)this.DrawingDocument.SetCursorType("pointer",MMData);else this.DrawingDocument.SetCursorType("text",MMData);var Bounds=this.Pages[CurPage].Bounds;if(true===this.Lock.Is_Locked()&&X<Bounds.Right&&X>Bounds.Left&&Y>Bounds.Top&&Y<Bounds.Bottom&&this.LogicDocument&&!this.LogicDocument.IsViewModeInReview()){var _X=this.Pages[CurPage].X;var _Y=this.Pages[CurPage].Y;var MMData=
new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Get_AbsolutePage(CurPage),text_transform);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=this.Lock.Get_UserId();MMData.HaveChanges=this.Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}};Paragraph.prototype.Document_CreateFontMap=function(FontMap){if(true===this.FontMap.NeedRecalc){this.FontMap.Map=
{};this.private_CompileParaPr();var FontScheme=this.Get_Theme().themeElements.fontScheme;var CurTextPr=this.CompiledPr.Pr.TextPr.Copy();CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);CurTextPr.Merge(this.TextPr.Value);CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Create_FontMap(this.FontMap.Map);this.FontMap.NeedRecalc=false}for(var Key in this.FontMap.Map)FontMap[Key]=this.FontMap.Map[Key]};
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Get_AllFontNames(AllFonts)};Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=
this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,
false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=
StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=
arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&this.bFromDocument){if(!this.LogicDocument)return;
var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:
0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=
0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();
this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&
Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof
CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=
undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?
true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);
this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=
FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=
FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=
FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=
true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,
Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;
if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&
this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=
Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;
W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();
if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-
this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);
NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();
this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;
var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=
ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&
Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,
0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=
0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,
oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=
function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=
g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=
0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=
function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/
LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;
TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();
var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();
if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=
this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+
1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);
NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;
ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=
false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,
oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,
false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();
NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,
Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;
this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();
return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);
bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)if(this.Content[Index]&&typeof this.Content[Index].Get_AllFontNames==="function")this.Content[Index].Get_AllFontNames(AllFonts)};
Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===
this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;
if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();
for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&
this.bFromDocument){if(!this.LogicDocument)return;var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();
var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==
Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,
true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();
if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;
if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=
function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=
FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=
NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=
FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;
this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=
function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,
Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=
Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=
oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=
Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();
if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-
this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);
var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);
if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=
H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();
while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();
var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=
function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=
this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=
DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,
0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=
oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,
Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||
null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=
g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();
if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();
var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=
new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);
this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=
Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=
true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;
oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,
false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();
this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,
false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];
this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,
ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;
this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
true;break}case AscDFH.historyitem_Paragraph_Shd_Value:case AscDFH.historyitem_Paragraph_Shd_Color:case AscDFH.historyitem_Paragraph_Shd_Unifill:case AscDFH.historyitem_Paragraph_Shd:{if(this.Parent){var oDrawingShape=this.Parent.Is_DrawingShape(true);if(oDrawingShape&&oDrawingShape.getObjectType&&oDrawingShape.getObjectType()===AscDFH.historyitem_type_Shape)if(oDrawingShape.chekBodyPrTransform(oDrawingShape.getBodyPr())||oDrawingShape.checkContentWordArt(oDrawingShape.getDocContent()))bNeedRecalc=
true;if(this.Parent.IsTableHeader())bNeedRecalc=true}break}case AscDFH.historyitem_Paragraph_SectionPr:{if(this.Parent instanceof CDocument){this.Parent.UpdateContentIndexing();var nSectionIndex=this.Parent.GetSectionIndexByElementIndex(this.GetIndex());var oFirstElement=this.Parent.GetFirstElementInSection(nSectionIndex);if(oFirstElement)this.Parent.Refresh_RecalcData2(oFirstElement.GetIndex(),oFirstElement.private_GetRelativePageIndex(0))}break}case AscDFH.historyitem_Paragraph_PrChange:{if(Data instanceof
CChangesParagraphPrChange&&Data.IsChangedNumbering())bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_SuppressLineNumbers:{History.AddLineNumbersToRecalculateData();break}}if(true===bNeedRecalc){var Prev=this.Get_DocumentPrev();if(0===CurPage&&null!=Prev&&type_Paragraph===Prev.GetType()&&true===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)Prev.Refresh_RecalcData2(Prev.Pages.length-1);return this.Refresh_RecalcData2(CurPage)}};Paragraph.prototype.Refresh_RecalcData2=function(CurPage){if(!CurPage)CurPage=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Some files were not shown because too many files have changed in this diff Show more