mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-17 05:16:04 +08:00
Compare commits
974 Commits
feature/te
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 64c7b7a3fd | |||
| d286b8459b | |||
| ff93f1e8b3 | |||
| 4471940b92 | |||
| 6df0cf26f3 | |||
| 720d66ad74 | |||
| e6522c6ce4 | |||
| 9b3c2291d8 | |||
| e7cfb67962 | |||
| 8725be55f0 | |||
| 37ae77d0d2 | |||
| 4c6ded76a1 | |||
| 2d8701cd4f | |||
| d5c321d47d | |||
| 324f7b3933 | |||
| edef6a83c8 | |||
| e7c21fb2cd | |||
| be8ba62c3f | |||
| fda8c8e445 | |||
| d9ebae1724 | |||
| f4867bd9f9 | |||
| 9b9da90dcc | |||
| cba4bc8085 | |||
| 325c2d3000 | |||
| 3187913c8e | |||
| 8958d13b56 | |||
| 9d13526724 | |||
| 93f70176bc | |||
| e2ad965d7c | |||
| d535aa64ef | |||
| c155a4c53a | |||
| 97cbd8dcc7 | |||
| d38576085c | |||
| 46dd9efa2e | |||
| 6af52920a2 | |||
| f13baca136 | |||
| 28a91a1519 | |||
| 0e48e65ef1 | |||
| ad1709d4af | |||
| e2c6ecec9b | |||
| ef55594f90 | |||
| 223bbe3347 | |||
| eca0cdb318 | |||
| 4a52368c30 | |||
| 73f4e20c56 | |||
| d53768969b | |||
| 324d6ec0bd | |||
| 767b652ef2 | |||
| 68f2f0760d | |||
| 694282a013 | |||
| e64eeb26af | |||
| 873b2b9351 | |||
| d5ecb00472 | |||
| 2ac6801afa | |||
| 213c65fe54 | |||
| 8269c14207 | |||
| f438a17779 | |||
| 9c8b739d0e | |||
| 7f0720bb95 | |||
| 846b212882 | |||
| 344a096e24 | |||
| 15eb4793f5 | |||
| 3ce4b4bfe8 | |||
| b8fab6f4df | |||
| 7ebf12c1e4 | |||
| 1813e09e1f | |||
| d2a986c480 | |||
| 73880f6207 | |||
| 24ad4adf6f | |||
| e4ea19ed81 | |||
| 575e379c4b | |||
| 86d8c7bfa3 | |||
| a3e1efb75b | |||
| e1f7feb5c1 | |||
| 13008c60e5 | |||
| df69099689 | |||
| 4e6f6e44bd | |||
| 67b54dc371 | |||
| b0c3172ae5 | |||
| 91d21a80ac | |||
| e820a9c936 | |||
| b38b12dfaf | |||
| 39b9e89e77 | |||
| 0b6ea2a399 | |||
| eee3161833 | |||
| fc422bb2e7 | |||
| f359f180bb | |||
| b0338919fe | |||
| 41358e3308 | |||
| 1a29fb1389 | |||
| 2fa048303f | |||
| e837479426 | |||
| e8f68e3a40 | |||
| 702987e00c | |||
| 83745da5f3 | |||
| 6b73faac12 | |||
| cab91648ce | |||
| 57b51a8854 | |||
| 4a84b8887f | |||
| 23027e4c2c | |||
| 52c61219dc | |||
| 2c37dac18c | |||
| aa7f104e60 | |||
| 83ea144c16 | |||
| ea6fdc8872 | |||
| b64b31a972 | |||
| 59fb6e4838 | |||
| d38ce5b836 | |||
| bb4ceb14e5 | |||
| ef9f25aa4d | |||
| 0c2a5eac1b | |||
| 0f85422315 | |||
| 38fa7436c0 | |||
| e2ce58a055 | |||
| cadba798b0 | |||
| 3941d5ced2 | |||
| c529cc6d5c | |||
| 31f274fbc4 | |||
| 58fe8ae679 | |||
| e3f77e11e0 | |||
| 6e696daa15 | |||
| 21dd930d30 | |||
| c4708222c6 | |||
| 34aae89432 | |||
| 273454a391 | |||
| ae4edab75e | |||
| e61aa447f2 | |||
| 6609e84bd1 | |||
| 402fe2c796 | |||
| e2aab8a241 | |||
| 555a251211 | |||
| 4a605d2424 | |||
| e49c4bc7fe | |||
| f5a4e570bb | |||
| af5a87327b | |||
| 11c637deeb | |||
| b3a7e20b35 | |||
| 915576a819 | |||
| 38a07b3c4d | |||
| ead20d7bfe | |||
| 90dc792fae | |||
| 0561ed2182 | |||
| 116ec89cd2 | |||
| f44de11437 | |||
| f5395b8b5f | |||
| 614222ee44 | |||
| 1b5d71a14c | |||
| 2ff12c06a4 | |||
| a3b6295058 | |||
| efd9e3a29e | |||
| 0fa13f3659 | |||
| 8133e3f7b7 | |||
| 7eabfd0838 | |||
| 3081d02c9c | |||
| fd2710e46e | |||
| bc076fb5b6 | |||
| 33fa3fa38b | |||
| 9bc03ffdef | |||
| 91afd3d340 | |||
| 6018add7a5 | |||
| b616ce6fd7 | |||
| 570482b60d | |||
| 201cae0e6f | |||
| 1cca5e3c12 | |||
| 048eebc613 | |||
| 760b4f9079 | |||
| 578118380e | |||
| 59f376908c | |||
| 38ceb61e4a | |||
| b3a76d5678 | |||
| c2d1bf113b | |||
| bde1115962 | |||
| d8dc82ea35 | |||
| 0ef0518f1a | |||
| f2da15defa | |||
| e3272a5e91 | |||
| d29dae37cb | |||
| d82c96dc0f | |||
| 69948ba383 | |||
| d04f9cb8cf | |||
| 5d6caf8a93 | |||
| f6ede7a53f | |||
| 3839ab4c15 | |||
| 6283a68841 | |||
| 75477e8c03 | |||
| 527cc5f89f | |||
| f4cb421b49 | |||
| 83d8a073a7 | |||
| 55ba36f4d2 | |||
| f760d03281 | |||
| 50ae7db2f0 | |||
| 0e02919540 | |||
| 1237991ffb | |||
| 5e5293b77b | |||
| 8250b59558 | |||
| 646c29166e | |||
| 3aca7bec15 | |||
| 078ec02efd | |||
| dd17cb7243 | |||
| deff23eaac | |||
| b3988b002f | |||
| db2a9e88a1 | |||
| a8fe05fb6a | |||
| bb3091b6f1 | |||
| d908cb668e | |||
| d595d3ea86 | |||
| 41d79b0df6 | |||
| 2330f1dae8 | |||
| 8f108582b9 | |||
| 6c6d575908 | |||
| 14dd41a2a2 | |||
| b000343b86 | |||
| c7e1250287 | |||
| dc6ca55b57 | |||
| 707aab41f3 | |||
| fba3767e36 | |||
| 7b8eae26c1 | |||
| c445c0444d | |||
| 94edfff846 | |||
| 482810712e | |||
| 43ba8fca21 | |||
| f38759d071 | |||
| 52e47745de | |||
| 554d3d0dfd | |||
| c9100737e0 | |||
| d21b44a0b8 | |||
| 0da5ad2f48 | |||
| 8611c5f781 | |||
| ea338db68a | |||
| 5089a76b43 | |||
| a8678c5d10 | |||
| ac5c7d6d76 | |||
| 080ae0d924 | |||
| 77c9bd8c6d | |||
| 8144f98bb8 | |||
| aec1220bff | |||
| 76f3afc6c0 | |||
| 3e78043cdd | |||
| 0319918827 | |||
| 80d8f4b12e | |||
| c52cfd0886 | |||
| 4c9a24bf71 | |||
| 9ece4889a1 | |||
| 00c24f9d68 | |||
| 0223b1beab | |||
| 5c15b76598 | |||
| 72315df901 | |||
| cb0e361490 | |||
| db279bd725 | |||
| 40c4c922c1 | |||
| 67f287f30f | |||
| 964a44ed93 | |||
| 57984ca8a2 | |||
| a30f7dfdf4 | |||
| b369c32e9e | |||
| 40a4fa1a92 | |||
| 9c12c0b30a | |||
| 2779542061 | |||
| e232fc779d | |||
| 3209c8e42e | |||
| 037057ea7a | |||
| d373a8cc4c | |||
| 13e2efe724 | |||
| b09d441987 | |||
| 9e835d5cc1 | |||
| f75df05824 | |||
| 0d6d273573 | |||
| d7a1642a62 | |||
| d74899a116 | |||
| 981df3fce7 | |||
| d0dfd6737c | |||
| 05d7d88481 | |||
| cec10b7058 | |||
| c3b3a1b5ef | |||
| 47258d9c30 | |||
| 10ab7009a1 | |||
| 3623b0970b | |||
| 7ecab52601 | |||
| 9fedabc0e2 | |||
| 85d98daedd | |||
| fa46455e74 | |||
| 0c87e66785 | |||
| 9dacd4a548 | |||
| e815f39905 | |||
| fb8a72cd6b | |||
| ad6113cf21 | |||
| 11914f8dc2 | |||
| 50b2656c44 | |||
| 39235f7fd6 | |||
| 3484834b9d | |||
| 61311457be | |||
| e15391ea35 | |||
| fefeb483e5 | |||
| e31e02d993 | |||
| 5c7ef5a6eb | |||
| bcdcfa8bf7 | |||
| fc110a004d | |||
| 12d33fad53 | |||
| 2534d2b5c9 | |||
| 7019b192bd | |||
| ac97a5680b | |||
| bebb39a619 | |||
| 1ee8baa672 | |||
| d014383a6d | |||
| 6422ce7f78 | |||
| 31f7136f70 | |||
| f2023f626b | |||
| 6ea64599bd | |||
| d1d94f481d | |||
| 82eb921f05 | |||
| 84847f1e74 | |||
| 3730827cd8 | |||
| eab6d5530b | |||
| dd00be6dce | |||
| 8391667147 | |||
| b8748e40d5 | |||
| 39da47bc21 | |||
| 3a201b8b28 | |||
| bbfbe4a149 | |||
| 0c1c57ccb3 | |||
| fa532edad6 | |||
| df82306306 | |||
| 7a3464b985 | |||
| 49924e23ac | |||
| 1eaac39e48 | |||
| 7624e24027 | |||
| 44ffa4b72e | |||
| 10bdf2703a | |||
| c488384dbc | |||
| cd80bca553 | |||
| 6e49670513 | |||
| b1b3e1fb7c | |||
| d78487e0f5 | |||
| 5069b68247 | |||
| 31433e20de | |||
| 86d0d2113e | |||
| 8f2b4e4153 | |||
| 0be867c47d | |||
| 78aae7e9d0 | |||
| 10e63543dc | |||
| 900cf01902 | |||
| f6a52876ce | |||
| 45ad566eb1 | |||
| 5bbea51848 | |||
| 28a1828000 | |||
| 816430e0e2 | |||
| 29a29cc818 | |||
| bf66c1d9c0 | |||
| 2a3982a884 | |||
| 9f94166f82 | |||
| f11beb659f | |||
| 9a9182a1e9 | |||
| c7cce459bc | |||
| b5fb8a34dc | |||
| 11f0c937f4 | |||
| 5e435d322f | |||
| 05660e8c31 | |||
| b9ff6ba943 | |||
| d603e4f5dd | |||
| 207dd32a5d | |||
| f2d0d7ac4c | |||
| 842d17f79e | |||
| d48a28fe1d | |||
| 2a22c5e1f3 | |||
| 629a35213e | |||
| 7b995bb45f | |||
| 08502f0b24 | |||
| aeca319710 | |||
| 7425d53eb3 | |||
| a056b2e4a9 | |||
| 2dd35a7d81 | |||
| 080d89c8a0 | |||
| 1809f7f4c2 | |||
| 4bfd4f0a08 | |||
| 3ef5651dfd | |||
| 8231809ef0 | |||
| 7f3d073d63 | |||
| 5f09e91944 | |||
| f4359e0b7f | |||
| ca9cf4ee61 | |||
| f52538f66a | |||
| bd76b2add0 | |||
| 0436e39722 | |||
| 15359be125 | |||
| 07be806ae3 | |||
| fc2a12c6f2 | |||
| 42030372fe | |||
| bbf6c2d8e9 | |||
| cb15cc18eb | |||
| 389bf976a9 | |||
| 4d1b516cc9 | |||
| 600a59c966 | |||
| 94f06bf997 | |||
| 230316aefa | |||
| 66b2f3c828 | |||
| 64e077da19 | |||
| 499fe52b8c | |||
| 6f9c376040 | |||
| 1e18352e77 | |||
| c3f4f32702 | |||
| 50c7e106fb | |||
| 6b5ee390a2 | |||
| 6df7a7e01e | |||
| 6167f23a08 | |||
| 7c544729bc | |||
| d60c102dbb | |||
| 9049e2e6a8 | |||
| 67c6707072 | |||
| 0c29a5d436 | |||
| d709598563 | |||
| 02d492ff90 | |||
| a7026ccb8d | |||
| 7afad1fe49 | |||
| aa53d6302f | |||
| ae8fb19147 | |||
| 12083905dc | |||
| e653442b8c | |||
| 511cfb6158 | |||
| 7f665b96a5 | |||
| 6b80b39d4d | |||
| 8926c15908 | |||
| 033c45b7a0 | |||
| cbf138b1eb | |||
| 897f8fa9f2 | |||
| 8feb44225d | |||
| 517e337049 | |||
| c05231cf58 | |||
| 66b1007ab4 | |||
| 16d75fe498 | |||
| 62413b8df5 | |||
| fe2e1568fa | |||
| f93c259977 | |||
| 7e057bab6e | |||
| 910ff6a6dd | |||
| 22e5bcbde3 | |||
| 4bf8308bff | |||
| a77cbf903b | |||
| 9b4416952f | |||
| a320b5bd5a | |||
| 34a1f117c9 | |||
| ec4700ac38 | |||
| 6af3f2fe35 | |||
| b61d8df484 | |||
| fc3748e516 | |||
| 468dcd7ba4 | |||
| 85047874b7 | |||
| 52bf1a6988 | |||
| 27746f5c2b | |||
| d3710a755e | |||
| 5c8dcd7ed2 | |||
| 5c0b3744ee | |||
| 7048f132c6 | |||
| 1f3467d75f | |||
| 238cdc8084 | |||
| a1d8597b4f | |||
| 15dc718211 | |||
| 1db12e66c6 | |||
| 580283ef45 | |||
| 5de19652f2 | |||
| fd648a7dd3 | |||
| 76b5bd594d | |||
| 61b55c9230 | |||
| 22aecb56ec | |||
| 4d4f3be717 | |||
| 6e481f6a34 | |||
| 2059e4bb95 | |||
| 3586a010a8 | |||
| 146fc90746 | |||
| 4452d7bf3d | |||
| 673678e80a | |||
| b51960e925 | |||
| 6a5186c411 | |||
| b5ea9d68e2 | |||
| 71e96930c9 | |||
| d9be0df8fb | |||
| 0477002e85 | |||
| 68f1c6f97d | |||
| 3cee4b0212 | |||
| 6f85ce7116 | |||
| d920492afe | |||
| d69a54de38 | |||
| cfb62d599d | |||
| 919d117a1f | |||
| d4b289d0ca | |||
| cbb1df1522 | |||
| 3b0e98fc4a | |||
| a29eb52e1a | |||
| 270e8e41dd | |||
| 16eb1b51e7 | |||
| 751b82dc51 | |||
| 320e30c857 | |||
| e4c84e2972 | |||
| 527ff672d9 | |||
| aa24268a2e | |||
| 39e4c3a09c | |||
| a6898c8235 | |||
| 8158ace0eb | |||
| 463ca05404 | |||
| f38ce7b61b | |||
| 95a1b39fb1 | |||
| f58be7754a | |||
| a31c3ee00a | |||
| 548cee436a | |||
| b1a36d546b | |||
| 23e9187f5a | |||
| 07d3f371a2 | |||
| 278cac8a61 | |||
| 07fd1e87d7 | |||
| 817ee4dde0 | |||
| d93bd27896 | |||
| 0e991719bf | |||
| be56209baf | |||
| 6a573d0da7 | |||
| ca2504edb6 | |||
| e936e330d9 | |||
| 07bedd847e | |||
| bda95fc03d | |||
| c0c0289ffb | |||
| 5c110799a6 | |||
| 1b6c81407b | |||
| 1e0d662838 | |||
| ae2680c419 | |||
| 506a805654 | |||
| 1b61353b2e | |||
| 7777048790 | |||
| fd6c0907bd | |||
| 1bdff9e7fe | |||
| 8fab1802df | |||
| 2aef5daf12 | |||
| 6cf6ade6e3 | |||
| 2399ba41e4 | |||
| fe2fb0c08d | |||
| bfffcda0c5 | |||
| e96ceab1e3 | |||
| 317e21af6a | |||
| 5046c1b326 | |||
| 4bc78e7bb4 | |||
| 4f6daaae67 | |||
| 8203492999 | |||
| 6616a11e7c | |||
| 45e97b76f0 | |||
| d3017c2777 | |||
| 910f453ce8 | |||
| 54fb5a7891 | |||
| 93b96e5555 | |||
| 41c4032fe8 | |||
| 9e57f8c3b1 | |||
| 57221c0e32 | |||
| 76b7099a37 | |||
| 85f428fda6 | |||
| d97a62442f | |||
| 41fb12d58b | |||
| df49a4fbde | |||
| 3d586a4bb6 | |||
| 6d76fd71cc | |||
| ed0811d8ab | |||
| 84cc97f035 | |||
| 170cada6e6 | |||
| 984807d611 | |||
| 250c85c077 | |||
| dbd92bfdfa | |||
| e4825294ed | |||
| 17c336d57c | |||
| 4e7af40367 | |||
| b7230d16fc | |||
| 22a7e6bb05 | |||
| a4ed2dea41 | |||
| ab2eabdd23 | |||
| 2796fbed8b | |||
| ab052c7c59 | |||
| 2b209ed5e4 | |||
| 04bce828be | |||
| 4c5259494d | |||
| 289a77a978 | |||
| a22cc4e410 | |||
| 9ccbb25acd | |||
| 954d86ed0f | |||
| 091af38e0d | |||
| 2b214ab07d | |||
| c8b34959d7 | |||
| 2bf44900de | |||
| c235a4c646 | |||
| 3bdd0e2053 | |||
| 339820e5df | |||
| 1dd5eb3368 | |||
| 47e0a0c9e7 | |||
| 475cbb6f8a | |||
| 5a491aea3e | |||
| 2d7c5ec2df | |||
| ee784a7189 | |||
| 650fb84b6d | |||
| 4a2d0b5e1f | |||
| 54ce32cfaf | |||
| 38079e8692 | |||
| ac75675367 | |||
| a0fc634f5f | |||
| 1d58d8fc7f | |||
| 1624a2dda2 | |||
| b0a850745d | |||
| 2ebade4413 | |||
| a0a9d899a8 | |||
| 5e9f99e960 | |||
| a67935908a | |||
| da1bc5d2d6 | |||
| 7156669830 | |||
| 9d5388a7bf | |||
| 3b85841ea6 | |||
| 4899ed4e7f | |||
| f335a5b024 | |||
| 2cdb04656d | |||
| 6eeae2e804 | |||
| 3934c28eb8 | |||
| 82e281cf6b | |||
| f6337bb12c | |||
| 1d88830b38 | |||
| b4395efa91 | |||
| 32f683137a | |||
| 9737038776 | |||
| 915c3497e4 | |||
| d59573c3b3 | |||
| abb884c714 | |||
| befeed6233 | |||
| 54e329915c | |||
| f27d78ef48 | |||
| 58ee2582d6 | |||
| 4c3af930a5 | |||
| db86830824 | |||
| 77496c6df7 | |||
| dd73d05dd1 | |||
| cabd994f5f | |||
| 2a3f90ab93 | |||
| 1849f7a69f | |||
| e898a9bb99 | |||
| bed0f29ac6 | |||
| 320d000030 | |||
| 1fb9ef4713 | |||
| 264edeb9b6 | |||
| 4e48821faf | |||
| fd5d6f41dc | |||
| 29b9cf515a | |||
| 53c4f320f6 | |||
| e126ceef3c | |||
| df22ad3855 | |||
| 9a17338be7 | |||
| e344c4ca0d | |||
| 1aec69965d | |||
| 1212a78d58 | |||
| 869bbf6cc9 | |||
| afdac778b0 | |||
| 6de079a487 | |||
| 78085554b5 | |||
| 7310eb49a9 | |||
| 66d94cf00c | |||
| d0f1691a5e | |||
| 26b598784e | |||
| 8795539c20 | |||
| 0ccff9944d | |||
| c6d1f5e502 | |||
| fbc42a514f | |||
| 5b5a1d461c | |||
| c567c9739c | |||
| 992f6616e0 | |||
| 686b719bff | |||
| c5a047f83a | |||
| 97560748aa | |||
| 6481c2d531 | |||
| 0f51381926 | |||
| 7e012dac94 | |||
| c4525f8ae1 | |||
| fc0d3abd6a | |||
| cebd668fe9 | |||
| 2f965fd578 | |||
| 115c51cd7c | |||
| a123af1066 | |||
| e640331750 | |||
| a42310d2c5 | |||
| 24e7c822ff | |||
| 9c2c9509db | |||
| a3d947d855 | |||
| 9900726e43 | |||
| f05fa7c0ee | |||
| 9a46a6b514 | |||
| 497c64e713 | |||
| 104a6ee3ae | |||
| ed99de9976 | |||
| ada62871eb | |||
| 0d646a32c4 | |||
| 80a2cfc0fe | |||
| 8c91eea87a | |||
| 7a2c32cb47 | |||
| 503e462366 | |||
| 917c33e76d | |||
| 1301da284c | |||
| 4d9a4ed300 | |||
| 1937895a56 | |||
| 01fbf07c9e | |||
| 173a29419a | |||
| 526e53e465 | |||
| d208215814 | |||
| 605e5e2c9d | |||
| c45c63f914 | |||
| 59bd457253 | |||
| 4db7b36303 | |||
| 23cc9ec824 | |||
| 63d74183a1 | |||
| 542837dd3a | |||
| 7a4dfdbbe4 | |||
| a220822b7b | |||
| a9a391c960 | |||
| 7a8f926852 | |||
| 3bd50dbece | |||
| a306faf286 | |||
| 63d6430502 | |||
| 21a637594a | |||
| 5c5a18de0d | |||
| add2a66da9 | |||
| 2213f6415d | |||
| e26f220a40 | |||
| 9f24bda011 | |||
| 0e68a83f0d | |||
| 10d05760dd | |||
| db5f239cb1 | |||
| 8cc18975b7 | |||
| 2bc14634bb | |||
| 408d677640 | |||
| dc904a1f13 | |||
| fdb9eaa2a5 | |||
| 3e9b0ffbda | |||
| e28aea4734 | |||
| 28584e7df1 | |||
| 7a6e00a792 | |||
| e7d913e1d2 | |||
| 3e2223ae6d | |||
| d3793169aa | |||
| 6dccf05e92 | |||
| eb2ba042ef | |||
| 1111f421d9 | |||
| 28c2e748a3 | |||
| e2bda52737 | |||
| ad496ca7cd | |||
| 8ee1c33532 | |||
| 6c9c2cf538 | |||
| 303c395c84 | |||
| 62d826d8c6 | |||
| 964a3b455b | |||
| 96ba4495ed | |||
| ec246526ac | |||
| 5cf633ede6 | |||
| a8d34f2437 | |||
| c3d2761c10 | |||
| dfbdb869d7 | |||
| 98d10c0c33 | |||
| 2f6b41d06a | |||
| ed7a50855e | |||
| 87e4738481 | |||
| c622fa54fc | |||
| c45b9fa0df | |||
| fe877b128b | |||
| aa4b0c8844 | |||
| 14e9a198c4 | |||
| b96e024145 | |||
| 4734d58ba6 | |||
| 526a21da57 | |||
| fb6bda209b | |||
| 414afabce7 | |||
| 4b0f79a1ab | |||
| c3c9dfcc70 | |||
| 2cd69351c7 | |||
| de8a054b26 | |||
| e1157b8507 | |||
| e5946892c9 | |||
| d399027127 | |||
| a873787fd7 | |||
| 2e732ce62f | |||
| 21a166208f | |||
| c3f98e011d | |||
| 49fc001aa3 | |||
| cc47abad5f | |||
| a7b0b0a938 | |||
| 44e6774c5a | |||
| c4ad01a30f | |||
| 7ddb363d60 | |||
| 74ba5d20ec | |||
| ecd333e238 | |||
| b377493ecb | |||
| afeeeab564 | |||
| b52dff617b | |||
| 31644cc5d7 | |||
| 460abc0d55 | |||
| 1aa17ba09e | |||
| d654092289 | |||
| 01b2aaedb2 | |||
| 7577bd2d20 | |||
| 9453e9c87d | |||
| 580c896b72 | |||
| 8916814106 | |||
| 03a1d9fa4c | |||
| 0fd709bf93 | |||
| 3a047cfab0 | |||
| 0ed11abb38 | |||
| 61d199a0c1 | |||
| e7a57c1584 | |||
| 4ea31dcb00 | |||
| 54a0c7f231 | |||
| a4d60a1ae1 | |||
| b7b3e0dd65 | |||
| c28a6bf1ea | |||
| 842a44ccf9 | |||
| 9f24254cc7 | |||
| e105eca426 | |||
| 02a923afb4 | |||
| c7a0996a6c | |||
| 51de435393 | |||
| 6d27231e15 | |||
| a2a5ef8fcd | |||
| 1c877ebe59 | |||
| f03248ca86 | |||
| a4005412a7 | |||
| d5434f190f | |||
| e50016259a | |||
| 0ed5be36a8 | |||
| d5a6c935e5 | |||
| aa3d4cb3ce | |||
| 73fa9b6aac | |||
| c9a0d6e4e5 | |||
| a517cef437 | |||
| 130de28e4b | |||
| 2ee94c4920 | |||
| cd53c06be3 | |||
| 122a54f510 | |||
| f96dd51403 | |||
| b425405744 | |||
| 28ffd27fca | |||
| 9bc9d86dd6 | |||
| a1891b597f | |||
| bf9ce4f535 | |||
| 508d8f25db | |||
| efbfcaed37 | |||
| deb90037d5 | |||
| d1fc31ac28 | |||
| b8efe6c554 | |||
| 13410f8467 | |||
| 3a389147dd | |||
| ba203f734d | |||
| 758454747d | |||
| d904245e9a | |||
| bf175e92a3 | |||
| 0c9b5821e7 | |||
| 98dae842ae | |||
| 7bb68aedca | |||
| 5475c246ab | |||
| 5864ab8e7a | |||
| 03809c0a1c | |||
| 6c3f0e88cb | |||
| bb40cd0467 | |||
| 5c98a92faf | |||
| 2b54cfaf37 | |||
| 00cd3a9497 | |||
| a488266ba1 | |||
| 65f4acc2ac | |||
| ff53c1b474 | |||
| a47f3df7bf | |||
| abd4c2f4a8 | |||
| 334f9602b4 | |||
| e32aea2138 | |||
| fed94358fe | |||
| 89b669e319 | |||
| db213d3ae4 | |||
| 79df81301f | |||
| 3cf3a3e098 | |||
| 197bbf7027 | |||
| d092b88d9b | |||
| a466592bc2 | |||
| 4bce73d81d | |||
| 2a6c50db89 | |||
| ed13e54d26 | |||
| e0dee3720f | |||
| 4686fb4081 | |||
| dda020a1d5 | |||
| e371f7ccf1 | |||
| 14a0e4713c | |||
| 74b9a426c2 | |||
| 43c7e2c9a8 | |||
| cac28771d3 | |||
| 39b9c28607 | |||
| 6e57d7e4e7 | |||
| a938ce4c76 | |||
| f831d9a22d | |||
| 930165a993 | |||
| fc56b22d40 | |||
| c53fff1ffb | |||
| 7f54430813 | |||
| ea42899b9e | |||
| b420fd731f | |||
| dbbf4d04f9 | |||
| d854608d45 | |||
| fe2b631c87 | |||
| 71e1f7c726 | |||
| 62132c27bd | |||
| 239d82deb4 | |||
| e4449d7aa9 | |||
| cb304293b7 | |||
| ffb62243a9 | |||
| 63a80580cc | |||
| fed142690b | |||
| 8d368ca91c | |||
| 2cc2434982 | |||
| f5989b979a | |||
| 5bab01517a | |||
| 62955d5f6e | |||
| cb68e4389e | |||
| 72a445fb54 | |||
| 9fc3fcabcb | |||
| 6af0b89c1d | |||
| 7451ba6e10 | |||
| c34b9e00e5 | |||
| e715da8680 | |||
| d6c58a4655 | |||
| 7a26c345c5 | |||
| 2a6e76a2bc | |||
| adfc79938d | |||
| c3ce1d2756 | |||
| cf5208d6a5 | |||
| 56e6a0a3b8 | |||
| c1bb697725 | |||
| 0a7ad2f560 | |||
| fede5921e1 | |||
| 897ea781b7 | |||
| f95014f46f | |||
| 92fae52a6d | |||
| afb0f44af2 | |||
| 1027f3cc6b | |||
| af20b1f63d | |||
| c779654a58 | |||
| d1c99891c6 | |||
| ffc94bf455 | |||
| 680c83853a | |||
| 33e698242c | |||
| e8ad643a0e | |||
| 609e3bc158 | |||
| f04c60fbb0 | |||
| 7e51dd143a | |||
| 31d65dea7c | |||
| 89172a9047 | |||
| 0103717241 | |||
| cc294ab2b2 | |||
| c012662402 | |||
| 0f1cb37153 | |||
| 95bad7b071 | |||
| 00c3085a90 | |||
| f1fa861c8a | |||
| 48d6ce60ee | |||
| c37f96da2d | |||
| 3b4097310b | |||
| 89473c5ba0 | |||
| 07afc6e4c3 | |||
| 05404c1bad | |||
| b0e810013d | |||
| 34c34018a0 | |||
| 05dd636a1c | |||
| e6158043b9 | |||
| cfd1dcc3ee | |||
| 7a2944ce58 | |||
| 8a11fa5aac | |||
| aa2127b55f | |||
| 86a2d66d83 | |||
| 9b3b6caef9 | |||
| 2aeec01f1e | |||
| 70412f5f8e | |||
| b1885e5b91 | |||
| 8e2d1e2c16 | |||
| d6ed01e1df | |||
| 0fcf29eddc | |||
| 474a500819 |
@ -6,12 +6,13 @@ import os
|
||||
if not base.is_dir("glm"):
|
||||
base.cmd("git", ["clone", "https://github.com/g-truc/glm.git"])
|
||||
base.cmd_in_dir("glm", "git", ["checkout", "33b4a621a697a305bc3a7610d290677b96beb181", "--quiet"])
|
||||
base.replaceInFile("./glm/glm/detail/func_common.inl", "vec<L, T, Q> v;", "vec<L, T, Q> v{};")
|
||||
|
||||
if not base.is_dir("mdds"):
|
||||
base.cmd("git", ["clone", "https://github.com/kohei-us/mdds.git"])
|
||||
base.cmd_in_dir("mdds", "git", ["checkout", "0783158939c6ce4b0b1b89e345ab983ccb0f0ad0"], "--quiet")
|
||||
|
||||
fix_cpp_version = "#if __cplusplus < 201402L\n"
|
||||
fix_cpp_version = "#if __cplusplus < 201703L\n"
|
||||
fix_cpp_version += "#ifndef _MSC_VER\n"
|
||||
fix_cpp_version += "namespace std {\n"
|
||||
fix_cpp_version += " template<bool __v>\n"
|
||||
|
||||
@ -3,6 +3,8 @@ DEPENDPATH += $$PWD
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/boost/boost.pri)
|
||||
|
||||
css_calculator_without_xhtml {
|
||||
HEADERS += \
|
||||
$$PWD/src/CCssCalculator_Private.h \
|
||||
|
||||
@ -514,6 +514,9 @@ namespace NSCSS
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!arSelectors.back().m_pCompiledStyle->Empty())
|
||||
return true;
|
||||
|
||||
arSelectors.back().m_pCompiledStyle->SetDpi(m_nDpi);
|
||||
unsigned int unStart = 0;
|
||||
|
||||
@ -522,8 +525,8 @@ namespace NSCSS
|
||||
if (itFound != arSelectors.crend())
|
||||
unStart = itFound.base() - arSelectors.cbegin();
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, unStart);
|
||||
std::vector<std::wstring> arPrevNodes;
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, unStart, arSelectors.size());
|
||||
std::vector<std::wstring> arPrevNodes = CalculateAllNodes(arSelectors, 0, unStart);
|
||||
bool bInTable = false;
|
||||
|
||||
for (size_t i = 0; i < unStart; ++i)
|
||||
@ -548,6 +551,7 @@ namespace NSCSS
|
||||
{
|
||||
arSelectors[i].m_pCompiledStyle->m_oBackground.Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oBorder.Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oDisplay.Clear();
|
||||
}
|
||||
|
||||
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_mAttributes, i + 1);
|
||||
@ -592,11 +596,14 @@ namespace NSCSS
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors, unsigned int unStart)
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors, unsigned int unStart, unsigned int unEnd)
|
||||
{
|
||||
if ((0 != unEnd && (unEnd < unStart || unEnd > arSelectors.size())) || (unStart == unEnd))
|
||||
return std::vector<std::wstring>();
|
||||
|
||||
std::vector<std::wstring> arNodes;
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend() - unStart; ++oNode)
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin() + ((0 != unEnd) ? (arSelectors.size() - unEnd) : 0); oNode != arSelectors.rend() - unStart; ++oNode)
|
||||
{
|
||||
if (!oNode->m_wsName.empty())
|
||||
arNodes.push_back(oNode->m_wsName);
|
||||
@ -627,7 +634,7 @@ namespace NSCSS
|
||||
if (arNextNodes.empty())
|
||||
return;
|
||||
|
||||
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
|
||||
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.cbegin(), arNextNodes.cend());
|
||||
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
|
||||
|
||||
if (!arTempPrev.empty())
|
||||
@ -644,20 +651,19 @@ namespace NSCSS
|
||||
|
||||
std::vector<const CElement*> arFindedElements;
|
||||
|
||||
std::wstring wsName, wsId;
|
||||
std::wstring wsName, wsClasses, wsId;
|
||||
std::vector<std::wstring> arClasses;
|
||||
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'#')
|
||||
{
|
||||
wsId = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsId);
|
||||
}
|
||||
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'.')
|
||||
{
|
||||
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
|
||||
arNextNodes.push_back(arNodes.back());
|
||||
wsClasses = arNodes.back();
|
||||
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(wsClasses, false, L" ");
|
||||
arNodes.pop_back();
|
||||
}
|
||||
|
||||
@ -665,7 +671,6 @@ namespace NSCSS
|
||||
{
|
||||
wsName = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsName);
|
||||
}
|
||||
|
||||
if (!wsId.empty())
|
||||
@ -724,6 +729,14 @@ namespace NSCSS
|
||||
{ return oFirstElement->GetWeight() > oSecondElement->GetWeight(); });
|
||||
}
|
||||
|
||||
if (!wsId.empty())
|
||||
arNextNodes.push_back(wsId);
|
||||
|
||||
if (!wsClasses.empty())
|
||||
arNextNodes.push_back(wsClasses);
|
||||
|
||||
arNextNodes.push_back(wsName);
|
||||
|
||||
return arFindedElements;
|
||||
}
|
||||
|
||||
@ -738,7 +751,7 @@ namespace NSCSS
|
||||
if (arSelectors.empty())
|
||||
return false;
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, 0, arSelectors.size());
|
||||
std::vector<std::wstring> arNextNodes;
|
||||
|
||||
for (size_t i = 0; i < arSelectors.size(); ++i)
|
||||
|
||||
@ -110,7 +110,7 @@ namespace NSCSS
|
||||
void ClearPageData();
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors, unsigned int unStart = 0);
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors, unsigned int unStart, unsigned int unEnd);
|
||||
std::vector<const CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes);
|
||||
|
||||
void AddStyles(const std::string& sStyle);
|
||||
|
||||
@ -176,14 +176,14 @@ namespace NSCSS
|
||||
return arElements;
|
||||
}
|
||||
|
||||
std::vector<CElement *> CElement::GetPrevElements(const std::vector<std::wstring>::const_reverse_iterator& oNodesRBegin, const std::vector<std::wstring>::const_reverse_iterator& oNodesREnd) const
|
||||
std::vector<CElement *> CElement::GetPrevElements(const std::vector<std::wstring>::const_iterator& oNodesBegin, const std::vector<std::wstring>::const_iterator& oNodesEnd) const
|
||||
{
|
||||
if (oNodesRBegin >= oNodesREnd || m_arPrevElements.empty())
|
||||
if (oNodesBegin >= oNodesEnd || m_arPrevElements.empty())
|
||||
return std::vector<CElement*>();
|
||||
|
||||
std::vector<CElement*> arElements;
|
||||
|
||||
for (std::vector<std::wstring>::const_reverse_iterator iWord = oNodesRBegin; iWord != oNodesREnd; ++iWord)
|
||||
for (std::vector<std::wstring>::const_iterator iWord = oNodesBegin; iWord != oNodesEnd; ++iWord)
|
||||
{
|
||||
if ((*iWord)[0] == L'.' && ((*iWord).find(L" ") != std::wstring::npos))
|
||||
{
|
||||
@ -195,7 +195,7 @@ namespace NSCSS
|
||||
if (oPrevElement->m_sSelector == wsClass)
|
||||
{
|
||||
arElements.push_back(oPrevElement);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesREnd);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesEnd);
|
||||
arElements.insert(arElements.end(), arTempElements.begin(), arTempElements.end());
|
||||
}
|
||||
}
|
||||
@ -208,9 +208,8 @@ namespace NSCSS
|
||||
if (oPrevElement->m_sSelector == *iWord)
|
||||
{
|
||||
arElements.push_back(oPrevElement);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesREnd);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesEnd);
|
||||
arElements.insert(arElements.end(), arTempElements.begin(), arTempElements.end());
|
||||
// return arElements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ namespace NSCSS
|
||||
std::map<std::wstring, std::wstring> GetFullStyle(const std::vector<CNode>& arSelectors) const;
|
||||
std::map<std::wstring, std::wstring> GetFullStyle(const std::vector<std::wstring>& arNodes) const;
|
||||
std::vector<CElement *> GetNextOfKin(const std::wstring& sName, const std::vector<std::wstring>& arClasses = {}) const;
|
||||
std::vector<CElement *> GetPrevElements(const std::vector<std::wstring>::const_reverse_iterator& oNodesRBegin, const std::vector<std::wstring>::const_reverse_iterator& oNodesREnd) const;
|
||||
std::vector<CElement *> GetPrevElements(const std::vector<std::wstring>::const_iterator& oNodesBegin, const std::vector<std::wstring>::const_iterator& oNodesEnd) const;
|
||||
std::map<std::wstring, std::wstring> GetConvertStyle(const std::vector<CNode>& arNodes) const;
|
||||
|
||||
CElement *FindPrevElement(const std::wstring& sSelector) const;
|
||||
|
||||
@ -18,6 +18,7 @@ namespace NSCSS
|
||||
std::wstring m_wsId; // Id тэга
|
||||
std::wstring m_wsStyle; // Стиль тэга
|
||||
std::map<std::wstring, std::wstring> m_mAttributes; // Остальные аттрибуты тэга
|
||||
//TODO:: возможно использование std::wstring излишне
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle *m_pCompiledStyle;
|
||||
|
||||
@ -149,7 +149,7 @@ namespace NSCSS
|
||||
case NSCSS::Millimeter:
|
||||
return dValue * 0.01764;
|
||||
case NSCSS::Inch:
|
||||
return dValue * 1440.;
|
||||
return dValue / 1440.;
|
||||
case NSCSS::Peak:
|
||||
return dValue * 0.004167; // 0.004167 = 6 / 1440
|
||||
default:
|
||||
|
||||
@ -69,7 +69,8 @@ namespace NSCSS
|
||||
R_Highlight,
|
||||
R_Shd,
|
||||
R_SmallCaps,
|
||||
R_Kern
|
||||
R_Kern,
|
||||
R_Vanish
|
||||
} RunnerProperties;
|
||||
|
||||
typedef enum
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,11 +4,14 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include "../../../../DesktopEditor/graphics/Matrix.h"
|
||||
#include "CUnitMeasureConverter.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include "boost/blank.hpp"
|
||||
#include <boost/variant2/variant.hpp>
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
namespace NSProperties
|
||||
@ -16,33 +19,34 @@ namespace NSCSS
|
||||
#define NEXT_LEVEL UINT_MAX, true
|
||||
|
||||
template<typename T>
|
||||
class CValue
|
||||
class CValueBase
|
||||
{
|
||||
friend class CString;
|
||||
friend class CMatrix;
|
||||
friend class CDigit;
|
||||
friend class CColor;
|
||||
friend class CEnum;
|
||||
friend class CURL;
|
||||
protected:
|
||||
CValueBase()
|
||||
: m_unLevel(0), m_bImportant(false)
|
||||
{}
|
||||
CValueBase(const CValueBase& oValue)
|
||||
: m_oValue(oValue.m_oValue), m_unLevel(oValue.m_unLevel), m_bImportant(oValue.m_bImportant)
|
||||
{}
|
||||
|
||||
CValueBase(const T& oValue, unsigned int unLevel, bool bImportant)
|
||||
: m_oValue(oValue), m_unLevel(unLevel), m_bImportant(bImportant)
|
||||
{}
|
||||
|
||||
T m_oValue;
|
||||
unsigned int m_unLevel;
|
||||
bool m_bImportant;
|
||||
public:
|
||||
CValue(const T& oValue, unsigned int unLevel, bool bImportant) :
|
||||
m_oValue(oValue), m_unLevel(unLevel), m_bImportant(bImportant)
|
||||
{
|
||||
}
|
||||
virtual bool Empty() const = 0;
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) = 0;
|
||||
|
||||
virtual bool Empty() const = 0;
|
||||
virtual void Clear() = 0;
|
||||
virtual int ToInt() const = 0;
|
||||
virtual double ToDouble() const = 0;
|
||||
virtual std::wstring ToWString() const = 0;
|
||||
|
||||
static void Equation(CValue &oFirstValue, CValue &oSecondValue)
|
||||
static void Equation(CValueBase &oFirstValue, CValueBase &oSecondValue)
|
||||
{
|
||||
if (oFirstValue.m_bImportant && !oSecondValue.m_bImportant && oFirstValue.Empty())
|
||||
oSecondValue.Clear();
|
||||
@ -57,18 +61,39 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
static bool LevelIsSame(const CValue& oFirstValue, const CValue& oSecondValue)
|
||||
static bool LevelIsSame(const CValueBase& oFirstValue, const CValueBase& oSecondValue)
|
||||
{
|
||||
return oFirstValue.m_unLevel == oSecondValue.m_unLevel;
|
||||
}
|
||||
|
||||
bool operator==(const T& oValue) const { return m_oValue == oValue; }
|
||||
bool operator>=(const T& oValue) const { return m_oValue >= oValue; }
|
||||
bool operator<=(const T& oValue) const { return m_oValue <= oValue; }
|
||||
bool operator> (const T& oValue) const { return m_oValue > oValue; }
|
||||
bool operator< (const T& oValue) const { return m_oValue < oValue; }
|
||||
friend bool operator==(const CValueBase& oLeftValue, const CValueBase& oRightValue)
|
||||
{
|
||||
if (oLeftValue.Empty() && oRightValue.Empty())
|
||||
return true;
|
||||
|
||||
virtual CValue& operator =(const CValue& oValue)
|
||||
if (( oLeftValue.Empty() && !oRightValue.Empty()) ||
|
||||
(!oLeftValue.Empty() && oRightValue.Empty()))
|
||||
return false;
|
||||
|
||||
return oLeftValue.m_oValue == oRightValue.m_oValue;
|
||||
}
|
||||
|
||||
friend bool operator!=(const CValueBase& oLeftValue, const CValueBase& oRightValue)
|
||||
{
|
||||
return !(oLeftValue == oRightValue);
|
||||
}
|
||||
|
||||
bool operator==(const T& oValue) const
|
||||
{
|
||||
return m_oValue == oValue;
|
||||
}
|
||||
|
||||
bool operator!=(const T& oValue) const
|
||||
{
|
||||
return m_oValue != oValue;
|
||||
}
|
||||
|
||||
virtual CValueBase& operator =(const CValueBase& oValue)
|
||||
{
|
||||
m_oValue = oValue.m_oValue;
|
||||
m_unLevel = oValue.m_unLevel;
|
||||
@ -77,70 +102,93 @@ namespace NSCSS
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual CValue& operator =(const T& oValue)
|
||||
virtual CValueBase& operator =(const T& oValue)
|
||||
{
|
||||
//m_oValue = oValue.m_oValue;
|
||||
m_oValue = oValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual CValue& operator+=(const CValue& oValue)
|
||||
virtual CValueBase& operator+=(const CValueBase& oValue)
|
||||
{
|
||||
if (m_unLevel > oValue.m_unLevel || (m_bImportant && !oValue.m_bImportant) || oValue.Empty())
|
||||
return *this;
|
||||
|
||||
m_oValue = oValue.m_oValue;
|
||||
m_unLevel = oValue.m_unLevel;
|
||||
m_bImportant = oValue.m_bImportant;
|
||||
*this = oValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
virtual bool operator==(const CValue& oValue) const
|
||||
template<typename T>
|
||||
class CValueOptional : public CValueBase<boost::optional<T>>
|
||||
{
|
||||
protected:
|
||||
CValueOptional() = default;
|
||||
|
||||
CValueOptional(const T& oValue, unsigned int unLevel = 0, bool bImportant = false)
|
||||
: CValueBase<boost::optional<T>>(oValue, unLevel, bImportant)
|
||||
{}
|
||||
public:
|
||||
virtual bool Empty() const override
|
||||
{
|
||||
return m_oValue == oValue.m_oValue;
|
||||
return !this->m_oValue.has_value();
|
||||
}
|
||||
void Clear() override
|
||||
{
|
||||
this->m_oValue.reset();
|
||||
this->m_unLevel = 0;
|
||||
this->m_bImportant = false;
|
||||
}
|
||||
|
||||
virtual bool operator!=(const CValue& oValue) const
|
||||
bool operator==(const T& oValue) const
|
||||
{
|
||||
return m_oValue != oValue.m_oValue;
|
||||
if (!this->m_oValue.has_value())
|
||||
return false;
|
||||
|
||||
return this->m_oValue.value() == oValue;
|
||||
}
|
||||
|
||||
virtual CValueOptional& operator=(const T& oValue)
|
||||
{
|
||||
this->m_oValue = oValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class CString : public CValue<std::wstring>
|
||||
class CString : public CValueOptional<std::wstring>
|
||||
{
|
||||
public:
|
||||
CString();
|
||||
CString(const std::wstring& wsValue, unsigned int unLevel, bool bImportant = false);
|
||||
CString() = default;
|
||||
CString(const std::wstring& wsValue, unsigned int unLevel = 0, bool bImportant = false);
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) override;
|
||||
bool SetValue(const std::wstring& wsValue, const std::vector<std::wstring>& arValiableValues, unsigned int unLevel, bool bHardMode);
|
||||
bool SetValue(const std::wstring& wsValue, const std::map<std::wstring, std::wstring>& arValiableValues, unsigned int unLevel, bool bHardMode);
|
||||
|
||||
bool Empty() const override;
|
||||
void Clear() override;
|
||||
|
||||
int ToInt() const override;
|
||||
double ToDouble() const override;
|
||||
std::wstring ToWString() const override;
|
||||
|
||||
CString& operator+=(const CString& oString);
|
||||
bool operator==(const wchar_t* pValue) const;
|
||||
bool operator!=(const wchar_t* pValue) const;
|
||||
|
||||
using CValueOptional<std::wstring>::operator=;
|
||||
};
|
||||
|
||||
class CDigit : public CValue<double>
|
||||
class CDigit : public CValueOptional<double>
|
||||
{
|
||||
UnitMeasure m_enUnitMeasure;
|
||||
|
||||
double ConvertValue(double dPrevValue, UnitMeasure enUnitMeasure) const;
|
||||
public:
|
||||
CDigit();
|
||||
CDigit(double dValue);
|
||||
CDigit(double dValue, unsigned int unLevel, bool bImportant = false);
|
||||
CDigit(const double& dValue, unsigned int unLevel = 0, bool bImportant = false);
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true) override;
|
||||
bool SetValue(const CDigit& oValue);
|
||||
bool SetValue(const double& dValue, unsigned int unLevel, bool bHardMode);
|
||||
bool SetValue(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel = 0, bool bHardMode = true);
|
||||
|
||||
bool Empty() const override;
|
||||
bool Zero() const;
|
||||
void Clear() override;
|
||||
|
||||
@ -156,7 +204,7 @@ namespace NSCSS
|
||||
|
||||
UnitMeasure GetUnitMeasure() const;
|
||||
|
||||
bool operator==(const double& oValue) const;
|
||||
bool operator==(const double& dValue) const;
|
||||
bool operator==(const CDigit& oDigit) const;
|
||||
|
||||
bool operator!=(const double& oValue) const;
|
||||
@ -171,11 +219,19 @@ namespace NSCSS
|
||||
|
||||
CDigit& operator+=(const CDigit& oDigit);
|
||||
CDigit& operator-=(const CDigit& oDigit);
|
||||
CDigit& operator+=(double dValue);
|
||||
CDigit& operator-=(double dValue);
|
||||
CDigit& operator*=(double dValue);
|
||||
CDigit& operator/=(double dValue);
|
||||
CDigit& operator =(double dValue);
|
||||
CDigit& operator+=(const double& dValue);
|
||||
CDigit& operator-=(const double& dValue);
|
||||
CDigit& operator*=(const double& dValue);
|
||||
CDigit& operator/=(const double& dValue);
|
||||
|
||||
using CValueOptional<double>::operator=;
|
||||
private:
|
||||
UnitMeasure m_enUnitMeasure;
|
||||
|
||||
double ConvertValue(double dPrevValue, UnitMeasure enUnitMeasure) const;
|
||||
|
||||
template <typename Operation>
|
||||
CDigit ApplyOperation(const CDigit& oDigit, Operation operation) const;
|
||||
};
|
||||
|
||||
struct TRGB
|
||||
@ -186,6 +242,8 @@ namespace NSCSS
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
int ToInt() const;
|
||||
|
||||
bool operator==(const TRGB& oRGB) const;
|
||||
bool operator!=(const TRGB& oRGB) const;
|
||||
};
|
||||
@ -211,31 +269,58 @@ namespace NSCSS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ColorEmpty,
|
||||
ColorNone,
|
||||
ColorRGB,
|
||||
ColorHEX,
|
||||
ColorUrl,
|
||||
ColorContextStroke,
|
||||
ColorContextFill
|
||||
} ColorType;
|
||||
} EColorType;
|
||||
|
||||
class CColor : public CValue<void*>
|
||||
class CColorValue
|
||||
{
|
||||
using color_value = boost::variant2::variant<boost::blank, std::wstring, TRGB, CURL>;
|
||||
protected:
|
||||
EColorType m_eType;
|
||||
public:
|
||||
CColorValue();
|
||||
CColorValue(const CColorValue& oValue);
|
||||
CColorValue(const std::wstring& wsValue);
|
||||
CColorValue(const TRGB& oValue);
|
||||
CColorValue(const CURL& oValue);
|
||||
|
||||
EColorType GetType() const;
|
||||
|
||||
bool operator==(const CColorValue& oValue) const;
|
||||
|
||||
color_value m_oValue;
|
||||
};
|
||||
|
||||
class CColorValueContextStroke : public CColorValue
|
||||
{
|
||||
public:
|
||||
CColorValueContextStroke();
|
||||
};
|
||||
|
||||
class CColorValueContextFill : public CColorValue
|
||||
{
|
||||
public:
|
||||
CColorValueContextFill();
|
||||
};
|
||||
|
||||
class CColor : public CValueOptional<CColorValue>
|
||||
{
|
||||
public:
|
||||
CColor();
|
||||
CColor(const CColor& oColor);
|
||||
~CColor();
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true) override;
|
||||
bool SetOpacity(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true);
|
||||
|
||||
bool Empty() const override;
|
||||
bool None() const;
|
||||
bool Url() const;
|
||||
void Clear() override;
|
||||
|
||||
ColorType GetType() const;
|
||||
EColorType GetType() const;
|
||||
|
||||
double GetOpacity() const;
|
||||
|
||||
@ -249,20 +334,15 @@ namespace NSCSS
|
||||
static TRGB ConvertHEXtoRGB(const std::wstring& wsValue);
|
||||
static std::wstring ConvertRGBtoHEX(const TRGB& oValue);
|
||||
|
||||
bool operator==(const CColor& oColor) const;
|
||||
bool operator!=(const CColor& oColor) const;
|
||||
|
||||
CColor& operator =(const CColor& oColor);
|
||||
CColor& operator+=(const CColor& oColor);
|
||||
using CValueOptional<CColorValue>::operator=;
|
||||
private:
|
||||
CDigit m_oOpacity;
|
||||
ColorType m_enType;
|
||||
CDigit m_oOpacity;
|
||||
|
||||
void SetEmpty(unsigned int unLevel = 0);
|
||||
void SetRGB(unsigned char uchR, unsigned char uchG, unsigned char uchB);
|
||||
void SetRGB(const TRGB& oRGB);
|
||||
void SetHEX(const std::wstring& wsValue);
|
||||
void SetUrl(const std::wstring& wsValue);
|
||||
bool SetUrl(const std::wstring& wsValue);
|
||||
void SetNone();
|
||||
};
|
||||
|
||||
@ -279,7 +359,7 @@ namespace NSCSS
|
||||
|
||||
typedef std::vector<std::pair<std::vector<double>, TransformType>> MatrixValues;
|
||||
|
||||
class CMatrix : public CValue<MatrixValues>
|
||||
class CMatrix : public CValueBase<MatrixValues>
|
||||
{
|
||||
std::vector<std::wstring> CutTransforms(const std::wstring& wsValue) const;
|
||||
public:
|
||||
@ -302,29 +382,29 @@ namespace NSCSS
|
||||
void ApplyTranform(Aggplus::CMatrix& oMatrix, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend) const;
|
||||
|
||||
bool operator==(const CMatrix& oMatrix) const;
|
||||
CMatrix& operator+=(const CMatrix& oMatrix);
|
||||
CMatrix& operator-=(const CMatrix& oMatrix);
|
||||
|
||||
using CValueBase<MatrixValues>::operator=;
|
||||
};
|
||||
|
||||
class CEnum : public CValue<int>
|
||||
class CEnum : public CValueOptional<int>
|
||||
{
|
||||
std::map<std::wstring, int> m_mMap;
|
||||
public:
|
||||
CEnum();
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) override;
|
||||
void SetMapping(const std::map<std::wstring, int>& mMap, int nDefaulvalue = -1);
|
||||
|
||||
bool Empty() const override;
|
||||
void Clear() override;
|
||||
|
||||
CEnum &operator =(int nValue);
|
||||
|
||||
bool operator==(int nValue) const;
|
||||
bool operator!=(int nValue) const;
|
||||
|
||||
int ToInt() const override;
|
||||
|
||||
using CValueOptional<int>::operator=;
|
||||
private:
|
||||
double ToDouble() const override;
|
||||
std::wstring ToWString() const override;
|
||||
|
||||
int m_nDefaultValue;
|
||||
std::map<std::wstring, int> m_mMap;
|
||||
};
|
||||
|
||||
// PROPERTIES
|
||||
@ -371,6 +451,7 @@ namespace NSCSS
|
||||
const CEnum& GetWhiteSpace() const;
|
||||
|
||||
bool Empty() const;
|
||||
void Clear();
|
||||
|
||||
CDisplay& operator+=(const CDisplay& oDisplay);
|
||||
bool operator==(const CDisplay& oDisplay) const;
|
||||
@ -472,7 +553,7 @@ namespace NSCSS
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
@ -524,7 +605,7 @@ namespace NSCSS
|
||||
|
||||
bool SetSides(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetCollapse(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
@ -532,28 +613,28 @@ namespace NSCSS
|
||||
//Left Side
|
||||
bool SetLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Top Side
|
||||
bool SetTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Right Side
|
||||
bool SetRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Bottom Side
|
||||
bool SetBottomSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
@ -616,6 +697,30 @@ namespace NSCSS
|
||||
bool operator==(const TTextDecoration& oTextDecoration) const;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Baseline,
|
||||
Sub,
|
||||
Super,
|
||||
Percentage,
|
||||
Length
|
||||
} EBaselineShift;
|
||||
|
||||
class CBaselineShift
|
||||
{
|
||||
CEnum m_eType;
|
||||
CDigit m_oValue;
|
||||
public:
|
||||
CBaselineShift();
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
EBaselineShift GetType() const;
|
||||
double GetValue() const;
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
};
|
||||
|
||||
class CText
|
||||
{
|
||||
public:
|
||||
@ -623,11 +728,12 @@ namespace NSCSS
|
||||
|
||||
static void Equation(CText &oFirstText, CText &oSecondText);
|
||||
|
||||
bool SetIndent (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetAlign (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetDecoration(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHighlight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetIndent (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetAlign (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetDecoration (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHighlight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBaselineShift (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetIndent() const;
|
||||
const CString& GetAlign() const;
|
||||
@ -635,6 +741,9 @@ namespace NSCSS
|
||||
const CColor& GetColor() const;
|
||||
const CColor& GetHighlight() const;
|
||||
|
||||
EBaselineShift GetBaselineShiftType() const;
|
||||
double GetBaselineShiftValue() const;
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
bool Underline() const;
|
||||
@ -644,6 +753,7 @@ namespace NSCSS
|
||||
CText& operator+=(const CText& oText);
|
||||
bool operator==(const CText& oText) const;
|
||||
private:
|
||||
CBaselineShift m_oBaselineShift;
|
||||
TTextDecoration m_oDecoration;
|
||||
CDigit m_oIndent;
|
||||
CString m_oAlign;
|
||||
@ -666,13 +776,15 @@ namespace NSCSS
|
||||
|
||||
bool SetValues (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
bool SetValues (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void UpdateAll (const double& dParentFontSize, const double& dCoreFontSize);
|
||||
void UpdateTop (const double& dParentFontSize, const double& dCoreFontSize);
|
||||
@ -685,6 +797,9 @@ namespace NSCSS
|
||||
const CDigit& GetBottom() const;
|
||||
const CDigit& GetLeft () const;
|
||||
|
||||
bool GetAfterAutospacing () const;
|
||||
bool GetBeforeAutospacing() const;
|
||||
|
||||
bool Empty() const;
|
||||
bool Zero() const;
|
||||
|
||||
@ -712,7 +827,7 @@ namespace NSCSS
|
||||
|
||||
bool SetValue (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLineHeight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetFamily (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStretch (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
@ -762,6 +877,12 @@ namespace NSCSS
|
||||
bool SetFooter (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeader (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
bool SetWidth (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeight (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetMargin (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetFooter (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeader (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetWidth() const;
|
||||
const CDigit& GetHeight() const;
|
||||
const CIndent& GetMargin() const;
|
||||
|
||||
@ -341,14 +341,14 @@ namespace NSCSS
|
||||
sSpacingValue.reserve(128);
|
||||
|
||||
if (!oStyle.m_oMargin.GetTop().Empty() && !oStyle.m_oMargin.GetTop().Zero())
|
||||
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"0\"";
|
||||
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"1\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"0\"";
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"1\"";
|
||||
|
||||
if (!oStyle.m_oMargin.GetBottom().Empty() && !oStyle.m_oMargin.GetBottom().Zero())
|
||||
sSpacingValue += L" w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"0\"";
|
||||
sSpacingValue += L" w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"1\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"0\"";
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"1\"";
|
||||
|
||||
if (!oStyle.m_oFont.GetLineHeight().Empty() && !oStyle.m_oFont.GetLineHeight().Zero())
|
||||
{
|
||||
@ -509,6 +509,9 @@ namespace NSCSS
|
||||
else if (L"serif" == wsFontFamily)
|
||||
wsFontFamily = L"Times New Roman";
|
||||
|
||||
if (oStyle.m_oDisplay.GetDisplay() == L"none")
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Vanish, L"true");
|
||||
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_RFonts, oStyle.m_oFont.GetFamily().ToWString());
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_I, oStyle.m_oFont.GetStyle().ToWString());
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_B, oStyle.m_oFont.GetWeight().ToWString());
|
||||
|
||||
@ -473,6 +473,12 @@ std::wstring CXmlElement::ConvertRStyle(bool bIsLite) const
|
||||
sRStyle += L"<w:kern w:val=\"" + oItem.second + L"\"/>";
|
||||
break;
|
||||
}
|
||||
case CSSProperties::RunnerProperties::R_Vanish:
|
||||
{
|
||||
if (oItem.second == L"true")
|
||||
sRStyle += L"<w:vanish/>";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -5,6 +5,9 @@
|
||||
|
||||
namespace Md
|
||||
{
|
||||
#define MD_PARSER_FLAGS MD_DIALECT_GITHUB | MD_FLAG_NOINDENTEDCODEBLOCKS | MD_HTML_FLAG_SKIP_UTF8_BOM | MD_FLAG_HARD_SOFT_BREAKS | MD_HTML_FLAG_XHTML | MD_FLAG_LATEXMATHSPANS
|
||||
#define MD_RENDERER_FLAGS MD_HTML_FLAG_XHTML
|
||||
|
||||
void ToHtml(const MD_CHAR* pValue, MD_SIZE uSize, void* pData)
|
||||
{
|
||||
if (NULL != pData)
|
||||
@ -14,7 +17,7 @@ void ToHtml(const MD_CHAR* pValue, MD_SIZE uSize, void* pData)
|
||||
std::string ConvertMdStringToHtml(const std::string& sMdString)
|
||||
{
|
||||
std::string sData;
|
||||
md_html(sMdString.c_str(), sMdString.length(), ToHtml, &sData, 0, 0);
|
||||
md_html(sMdString.c_str(), sMdString.length(), ToHtml, &sData, MD_PARSER_FLAGS, MD_RENDERER_FLAGS);
|
||||
return sData;
|
||||
}
|
||||
|
||||
@ -36,22 +39,21 @@ void WriteBaseHtmlStyles(NSFile::CFileBinary& oFile)
|
||||
oFile.WriteStringUTF8(L"img { vertical-align: middle; }");
|
||||
|
||||
// Styles for tables
|
||||
oFile.WriteStringUTF8(L"table { margin-bottom: 20px; width: 100%; max-width: 100%; border-spacing:0; border-collapse: collapse; border-color: gray;}");
|
||||
oFile.WriteStringUTF8(L"thead { display: table-header-group; vertical-align: middle; }");
|
||||
oFile.WriteStringUTF8(L"table { margin-bottom: 20px; width: 100%; max-width: 100%; border-spacing:0; border-collapse: collapse; border-color: gray; vertical-align:middle;}");
|
||||
oFile.WriteStringUTF8(L"thead { display: table-header-group;}");
|
||||
oFile.WriteStringUTF8(L"tr { display: table-row; }");
|
||||
oFile.WriteStringUTF8(L"th { text-align: left; display: table-cell; font-weight: bold; }");
|
||||
oFile.WriteStringUTF8(L"th { text-align: center; display: table-cell; font-weight: bold; }");
|
||||
|
||||
oFile.WriteStringUTF8(L"table thead tr th { vertical-align: bottom; border-bottom: 2px solid #ddd; }");
|
||||
oFile.WriteStringUTF8(L"table thead tr th, table tbody tr th, table thead tr td, table tbody tr td { padding 8px; line-height: 1.4; vertical-align: top; border-top: 1px solid #ddd; }");
|
||||
oFile.WriteStringUTF8(L"table > caption + thead > tr > th, table > colgroup + thead > tr > th, table > thead > tr > th, table > caption + thead > tr > td, table > colgroup + thead > tr > td, table > thead > tr > td { border-top: 0; }");
|
||||
oFile.WriteStringUTF8(L"table thead tr th, table thead tr td { border-bottom: 2px solid #ddd; border-top: none; }");
|
||||
oFile.WriteStringUTF8(L"table tbody tr th, table tbody tr td { padding 8px; line-height: 1.4; border-top: 1px solid #ddd; }");
|
||||
|
||||
// Styles for blockquote
|
||||
oFile.WriteStringUTF8(L"blockquote { border-left: 3px solid #e9e9e9; margin: 1.5em 0; padding: 0.5em 10px 0.5em 24px; font-size: 1.25rem; display: block; margin-top: 8pt; font-style: italic; color: #404040; }");
|
||||
|
||||
// Styles for code
|
||||
oFile.WriteStringUTF8(L"code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; }");
|
||||
oFile.WriteStringUTF8(L"pre code { padding: 0px; white-space: pre-wrap; border-radius: 0; background-color: #f5f5f5; color:black; }");
|
||||
oFile.WriteStringUTF8(L"pre { display: block; padding: 9.5px; margin: 0 0 10px; line-height: 1.4; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; }");
|
||||
oFile.WriteStringUTF8(L"code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; }");
|
||||
oFile.WriteStringUTF8(L"pre code { padding: 0px; white-space: pre-wrap; border-radius: 0; background-color: #f8f8f8; color:black; }");
|
||||
oFile.WriteStringUTF8(L"pre { display: block; padding: 9.5px; margin: 0 0 10px; line-height: 1.4; word-break: break-all; word-wrap: break-word; background-color: #f8f8f8; border: none; font-size: 1em; }");
|
||||
oFile.WriteStringUTF8(L"code, pre { font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; }");
|
||||
|
||||
// Styles for headings
|
||||
@ -87,9 +89,7 @@ bool ConvertMdFileToHtml(const std::wstring& wsPathToMdFile, const std::wstring&
|
||||
|
||||
bool bResult = true;
|
||||
|
||||
if (0 != md_html(sMdData.c_str(), sMdData.length(), ToHtmlFile, &oFile,
|
||||
MD_DIALECT_GITHUB | MD_FLAG_NOINDENTEDCODEBLOCKS | MD_HTML_FLAG_SKIP_UTF8_BOM,
|
||||
0))
|
||||
if (0 != md_html(sMdData.c_str(), sMdData.length(), ToHtmlFile, &oFile, MD_PARSER_FLAGS, MD_RENDERER_FLAGS))
|
||||
bResult = false;
|
||||
|
||||
oFile.WriteStringUTF8(L"</body></html>");
|
||||
|
||||
@ -90,7 +90,7 @@ static std::wstring convertUtf16ToWString(const UTF16 * Data, int nLength)
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
std::wstring wstr ((wchar_t *) pStrUtf32);
|
||||
std::wstring wstr ((wchar_t *) pStrUtf32, nLength);
|
||||
|
||||
delete [] pStrUtf32;
|
||||
return wstr;
|
||||
|
||||
1
Common/3dParty/socketio/.gitignore
vendored
1
Common/3dParty/socketio/.gitignore
vendored
@ -1 +1,2 @@
|
||||
socket.io-client-cpp/
|
||||
socketio.data
|
||||
4
Common/3dParty/v8_89/.gitignore
vendored
4
Common/3dParty/v8_89/.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
.cipd
|
||||
.gclient
|
||||
.gclient_entries
|
||||
.gclient*
|
||||
.gcs*
|
||||
v8
|
||||
depot_tools
|
||||
v8.data
|
||||
|
||||
@ -69,10 +69,12 @@ public:
|
||||
bool isOpenOfficeFormatFile(const std::wstring& fileName, std::wstring& documentID);
|
||||
bool isOnlyOfficeFormatFile(const std::wstring& fileName);
|
||||
bool isMacFormatFile(const std::wstring& fileName);
|
||||
bool isHwpxFile(const std::wstring& fileName);
|
||||
|
||||
bool isDocFormatFile(const std::wstring& fileName);
|
||||
bool isXlsFormatFile(const std::wstring& fileName);
|
||||
|
||||
bool isCompoundFile (POLE::Storage* storage);
|
||||
bool isOleObjectFile(POLE::Storage* storage);
|
||||
bool isDocFormatFile(POLE::Storage* storage);
|
||||
bool isXlsFormatFile(POLE::Storage* storage);
|
||||
@ -99,6 +101,7 @@ public:
|
||||
bool isPdfFormatFile(unsigned char* pBuffer, int dwBytes, std::wstring& documentID);
|
||||
bool isPdfOformFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isOpenOfficeFlatFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isHwpmlFile(unsigned char* pBuffer, int dwBytes);
|
||||
|
||||
bool isBinaryDoctFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isBinaryXlstFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
|
||||
@ -467,15 +467,18 @@ bool COfficeFileFormatChecker::isHwpFile(POLE::Storage* storage)
|
||||
if (storage == NULL)
|
||||
return false;
|
||||
|
||||
unsigned char buffer[10];
|
||||
unsigned char buffer[17];
|
||||
|
||||
POLE::Stream stream(storage, L"BodyText/Section0");
|
||||
if (stream.read(buffer, 10) < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
POLE::Stream stream(storage, L"FileHeader");
|
||||
|
||||
static constexpr const char* hwpFormatLine = "HWP Document File";
|
||||
|
||||
if (17 == stream.read(buffer, 17) && NULL != strstr((char*)buffer, hwpFormatLine))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isXlsFormatFile(POLE::Storage *storage)
|
||||
{
|
||||
if (storage == NULL)
|
||||
@ -549,6 +552,15 @@ bool COfficeFileFormatChecker::isPptFormatFile(POLE::Storage *storage)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isCompoundFile(POLE::Storage* storage)
|
||||
{
|
||||
if (storage == NULL) return false;
|
||||
|
||||
if (storage->GetAllStreams(L"/").size() == 1) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring COfficeFileFormatChecker::getDocumentID(const std::wstring &_fileName)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
@ -746,6 +758,11 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_VBAPROJECT;
|
||||
return true;
|
||||
}
|
||||
else if (isCompoundFile(&storage))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_COMPOUND;
|
||||
return true;
|
||||
}
|
||||
else if (isHwpFile(&storage))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
|
||||
@ -811,6 +828,13 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
else if (isHwpxFile(fileName))
|
||||
{
|
||||
if (bufferDetect)
|
||||
delete[] bufferDetect;
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
@ -890,6 +914,10 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
|
||||
}
|
||||
else if (isHwpmlFile(bufferDetect, sizeRead))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPML;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
file.CloseFile();
|
||||
}
|
||||
@ -939,7 +967,12 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
|
||||
else if (0 == sExt.compare(L".md"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
|
||||
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xls") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xlsb"))
|
||||
else if (0 == sExt.compare(L".tsv"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV;
|
||||
else if (0 == sExt.compare(L".scsv"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV;
|
||||
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".tsv") || 0 == sExt.compare(L".dsv") || 0 == sExt.compare(L".cssv")
|
||||
|| 0 == sExt.compare(L".xls") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xlsb"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
|
||||
@ -959,6 +992,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
|
||||
else if (0 == sExt.compare(L".hwpx"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX;
|
||||
else if (0 == sExt.compare(L".hml"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPML;
|
||||
|
||||
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN)
|
||||
return true;
|
||||
@ -1403,6 +1438,31 @@ bool COfficeFileFormatChecker::isMacFormatFile(const std::wstring& fileName)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isHwpxFile(const std::wstring &fileName)
|
||||
{
|
||||
COfficeUtils oOfficeUtils;
|
||||
|
||||
ULONG unSize = 0;
|
||||
BYTE* pBuffer = NULL;
|
||||
|
||||
HRESULT hresult = oOfficeUtils.LoadFileFromArchive(fileName, L"mimetype", &pBuffer, unSize);
|
||||
|
||||
if (hresult != S_OK || NULL == pBuffer)
|
||||
return false;
|
||||
|
||||
static constexpr const char* hwpxFormatLine = "application/hwp+zip";
|
||||
bool bResult = false;
|
||||
|
||||
if (19 <= unSize && NULL != strstr((char *)pBuffer, hwpxFormatLine))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX;
|
||||
bResult = true;
|
||||
}
|
||||
|
||||
delete[] pBuffer;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring &fileName, std::wstring &documentID)
|
||||
{
|
||||
documentID.clear();
|
||||
@ -1568,6 +1628,28 @@ bool COfficeFileFormatChecker::isOpenOfficeFlatFormatFile(unsigned char *pBuffer
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isHwpmlFile(unsigned char *pBuffer, int dwBytes)
|
||||
{
|
||||
if (NULL == pBuffer || dwBytes < 8)
|
||||
return false;
|
||||
|
||||
for (unsigned int unPos = 0; unPos < dwBytes - 8; ++unPos)
|
||||
{
|
||||
if ('<' != pBuffer[unPos])
|
||||
continue;
|
||||
|
||||
if (dwBytes - unPos >= 15 && '!' == pBuffer[unPos + 1] &&
|
||||
0 == memcmp(&pBuffer[unPos], "<!DOCTYPE HWPML", 15))
|
||||
return true;
|
||||
|
||||
if (dwBytes - unPos >= 6 && 0 == memcmp(&pBuffer[unPos], "<HWPML", 6))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isOOXFlatFormatFile(unsigned char *pBuffer, int dwBytes)
|
||||
{
|
||||
if (dwBytes < 8)
|
||||
@ -1676,6 +1758,8 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".hwp";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX:
|
||||
return L".hwpx";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPML:
|
||||
return L".hml";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MD:
|
||||
return L".md";
|
||||
|
||||
@ -1720,6 +1804,10 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".ods";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV:
|
||||
return L".csv";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV:
|
||||
return L".tsv";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV:
|
||||
return L".scsv";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT:
|
||||
return L".fods";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS:
|
||||
@ -1861,6 +1949,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
|
||||
if (L".hwpx" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX;
|
||||
if (L".hml" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPML;
|
||||
if (L".md" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
|
||||
|
||||
@ -1907,7 +1997,11 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB;
|
||||
if (L".xls" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
|
||||
if (L".csv" == ext)
|
||||
if (L".tsv" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV;
|
||||
if (L".scsv" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV;
|
||||
if (L".csv" == ext || L".dsv" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
if (L".fods" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT;
|
||||
|
||||
@ -59,7 +59,8 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0018
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0019
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001a
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_MD AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001b
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPML AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001b
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_MD AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001c
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_XML AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0030
|
||||
|
||||
@ -86,13 +87,14 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0005
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0006
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0007
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0008
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0009
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000a
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_FLAT AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000b
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_PACKAGE AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000c
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000d
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0014
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0024
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM 0x0200
|
||||
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001
|
||||
@ -135,6 +137,7 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_MS_MITCRYPTO AVS_OFFICESTUDIO_FILE_OTHER + 0x000b
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_MS_VBAPROJECT AVS_OFFICESTUDIO_FILE_OTHER + 0x000c
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_PACKAGE_IN_OLE AVS_OFFICESTUDIO_FILE_OTHER + 0x000d
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_COMPOUND AVS_OFFICESTUDIO_FILE_OTHER + 0x000e
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB 0x1000
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001
|
||||
|
||||
205
Common/base.pri
205
Common/base.pri
@ -33,8 +33,7 @@ OO_BUILD_BRANDING = $$(OO_BRANDING)
|
||||
OO_DESTDIR_BUILD_OVERRIDE = $$(DESTDIR_BUILD_OVERRIDE)
|
||||
|
||||
win32 {
|
||||
CURRENT_YEAR = $$system(wmic PATH Win32_LocalTime GET ^Year /FORMAT:VALUE | find \"=\")
|
||||
CURRENT_YEAR = $$replace(CURRENT_YEAR, "Year=", "")
|
||||
CURRENT_YEAR = $$system(powershell -NoLogo -NoProfile -Command "(Get-Date).Year")
|
||||
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\r", "")
|
||||
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\n", "")
|
||||
CURRENT_YEAR = $$replace(CURRENT_YEAR, "\t", "")
|
||||
@ -45,6 +44,7 @@ win32 {
|
||||
}
|
||||
|
||||
DEFINES += COPYRIGHT_YEAR=$${CURRENT_YEAR}
|
||||
#DEFINES += _LOGOUT_ALWAYS
|
||||
|
||||
QMAKE_TARGET_COMPANY = $$PUBLISHER_NAME
|
||||
QMAKE_TARGET_COPYRIGHT = © $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved.
|
||||
@ -118,13 +118,13 @@ win32:contains(QMAKE_TARGET.arch, arm64): {
|
||||
}
|
||||
|
||||
linux-clang-libc++ {
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux_64
|
||||
CONFIG += core_linux_clang
|
||||
message("linux-64-clang-libc++")
|
||||
}
|
||||
linux-clang-libc++-32 {
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux_32
|
||||
CONFIG += core_linux_clang
|
||||
message("linux-32-clang-libc++")
|
||||
@ -180,9 +180,9 @@ mac {
|
||||
!core_ios {
|
||||
CONFIG += core_mac
|
||||
CONFIG += core_mac_64
|
||||
|
||||
DEFINES += _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
}
|
||||
|
||||
DEFINES += _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
}
|
||||
|
||||
# DEFINES
|
||||
@ -199,31 +199,58 @@ core_win_64 {
|
||||
DEFINES += WIN64 _WIN64
|
||||
}
|
||||
|
||||
defineTest(startsWith) {
|
||||
tmp = $$2
|
||||
tmp ~= s,^$$re_escape($$1),,
|
||||
!equals(tmp, $$2): return(true)
|
||||
return(false)
|
||||
}
|
||||
|
||||
core_linux {
|
||||
DEFINES += LINUX _LINUX
|
||||
|
||||
QMAKE_CUSTOM_SYSROOT = $$(QMAKE_CUSTOM_SYSROOT)
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT)/usr/bin/
|
||||
QMAKE_CUSTOM_SYSROOT = $$(QMAKE_CUSTOM_SYSROOT)
|
||||
!isEmpty(QMAKE_CUSTOM_SYSROOT) {
|
||||
CONFIG += core_linix_use_sysroot
|
||||
message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT")
|
||||
|
||||
core_linux_64 {
|
||||
!linux_arm64 { # x86_64
|
||||
QMAKE_CUSTOM_SYSROOT_LIB = $$(QMAKE_CUSTOM_SYSROOT)/usr/lib/x86_64-linux-gnu
|
||||
!isEmpty(QMAKE_CUSTOM_SYSROOT) {
|
||||
message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
|
||||
QMAKE_CXXFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_LFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
|
||||
}
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT_BIN)
|
||||
isEmpty(QMAKE_CUSTOM_SYSROOT_BIN) {
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$QMAKE_CUSTOM_SYSROOT/usr/bin
|
||||
}
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , /)
|
||||
|
||||
startsWith($$QMAKE_CUSTOM_SYSROOT, $$QMAKE_CUSTOM_SYSROOT_BIN) {
|
||||
message("Using compilers from same sysroot")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_AR = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "ar") cqs
|
||||
QMAKE_RANLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "ranlib")
|
||||
QMAKE_STRIP = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "strip")
|
||||
} else {
|
||||
message("Using cross-compilers from host sysroot")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-g++")
|
||||
QMAKE_AR = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-ar") cqs
|
||||
QMAKE_RANLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-ranlib")
|
||||
QMAKE_STRIP = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-strip")
|
||||
QMAKE_OBJCOPY = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-objcopy")
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += --sysroot=$$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_CXXFLAGS += --sysroot=$$QMAKE_CUSTOM_SYSROOT -std=gnu++1y
|
||||
|
||||
QMAKE_LFLAGS += --sysroot=$$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_INCDIR += $$QMAKE_CUSTOM_SYSROOT/usr/include
|
||||
}
|
||||
}
|
||||
|
||||
gcc {
|
||||
COMPILER_VERSION = $$system($$QMAKE_CXX " -dumpversion")
|
||||
COMPILER_VERSION = $$system($$QMAKE_CXX " -dumpversion")
|
||||
COMPILER_MAJOR_VERSION_ARRAY = $$split(COMPILER_VERSION, ".")
|
||||
COMPILER_MAJOR_VERSION = $$member(COMPILER_MAJOR_VERSION_ARRAY, 0)
|
||||
lessThan(COMPILER_MAJOR_VERSION, 5): CONFIG += build_gcc_less_5
|
||||
@ -253,6 +280,11 @@ core_mac {
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12
|
||||
!apple_silicon:QMAKE_APPLE_DEVICE_ARCHS = x86_64
|
||||
}
|
||||
|
||||
!core_debug {
|
||||
equals(TEMPLATE, app):QMAKE_POST_LINK += strip $(TARGET)
|
||||
# TODO: plugin!
|
||||
}
|
||||
}
|
||||
|
||||
core_linux_clang {
|
||||
@ -311,6 +343,10 @@ core_linux {
|
||||
core_linux {
|
||||
equals(TEMPLATE, app):CONFIG += core_static_link_libstd
|
||||
plugin:CONFIG += core_static_link_libstd
|
||||
|
||||
|
||||
equals(TEMPLATE, app):QMAKE_LFLAGS_RELEASE += -Wl,-s
|
||||
plugin:QMAKE_LFLAGS_RELEASE += -Wl,-s
|
||||
}
|
||||
|
||||
core_win_32 {
|
||||
@ -320,7 +356,7 @@ core_win_64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_64
|
||||
}
|
||||
core_win_arm64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_arm64
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_arm64
|
||||
}
|
||||
core_linux_32 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = linux_32
|
||||
@ -342,27 +378,6 @@ core_linux_arm {
|
||||
linux_arm64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = linux_arm64
|
||||
DEFINES += _ARM_ALIGN_
|
||||
|
||||
ARM64_TOOLCHAIN_BIN = $$(ARM64_TOOLCHAIN_BIN)
|
||||
ARM64_TOOLCHAIN_BIN_PREFIX = $$(ARM64_TOOLCHAIN_BIN_PREFIX)
|
||||
|
||||
!isEmpty(ARM64_TOOLCHAIN_BIN){
|
||||
!isEmpty(ARM64_TOOLCHAIN_BIN_PREFIX){
|
||||
ARM64_TOOLCHAIN_BIN_FULL = $$ARM64_TOOLCHAIN_BIN/$$ARM64_TOOLCHAIN_BIN_PREFIX
|
||||
message("using arm64 toolchain $$ARM64_TOOLCHAIN_BIN")
|
||||
|
||||
QMAKE_CC = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "gcc")
|
||||
QMAKE_CXX = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
QMAKE_LINK = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
|
||||
QMAKE_AR = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "ar cqs")
|
||||
QMAKE_OBJCOPY = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "objcopy")
|
||||
QMAKE_NM = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "nm -P")
|
||||
QMAKE_STRIP = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "strip")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
core_ios {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = ios
|
||||
@ -689,3 +704,105 @@ ADD_INC_PATH = $$(ADDITIONAL_INCLUDE_PATH)
|
||||
!disable_precompiled_header {
|
||||
CONFIG += precompile_header
|
||||
}
|
||||
|
||||
SWIFT_SOURCES=
|
||||
defineTest(UseSwift) {
|
||||
isEmpty(SWIFT_SOURCES): return(false)
|
||||
# work only on ios and mac
|
||||
!core_ios:!core_mac {
|
||||
return(false)
|
||||
}
|
||||
|
||||
# path to the bridging header that exposes Objective-C code to Swift
|
||||
BRIDGING_HEADER = $$1
|
||||
# sdk and toolchain (set from environment variables)
|
||||
SDK_PATH = $$(SDK_PATH)
|
||||
XCODE_TOOLCHAIN_PATH = $$(XCODE_TOOLCHAIN_PATH)
|
||||
|
||||
IOS_TARGET_PLATFORM = apple-ios11.0
|
||||
SWIFT_GEN_HEADERS_PATH = $$PWD_ROOT_DIR/core_build/$$CORE_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX
|
||||
ARCHS = arm64
|
||||
# simulator
|
||||
xcframework_platform_ios_simulator {
|
||||
IOS_TARGET_PLATFORM = $${IOS_TARGET_PLATFORM}-simulator
|
||||
SWIFT_GEN_HEADERS_PATH = $$SWIFT_GEN_HEADERS_PATH/simulator
|
||||
ARCHS += x86_64
|
||||
}
|
||||
|
||||
# add swift compiler for each architecture
|
||||
SWIFT_COMPILERS_OUT =
|
||||
for(ARCH, ARCHS) {
|
||||
COMPILER_NAME = swift_compiler_$${ARCH}
|
||||
COMPILER_OUTPUT = $$SWIFT_GEN_HEADERS_PATH/swift_module_$${ARCH}.o
|
||||
SWIFT_COMPILERS_OUT += $$COMPILER_OUTPUT
|
||||
|
||||
$${COMPILER_NAME}.name = SwiftCompiler_$${ARCH}
|
||||
$${COMPILER_NAME}.input = SWIFT_SOURCES
|
||||
$${COMPILER_NAME}.output = $$COMPILER_OUTPUT
|
||||
SWIFT_CMD = swiftc -c $$SWIFT_SOURCES \
|
||||
-module-name SwiftModule \
|
||||
-whole-module-optimization \
|
||||
-emit-objc-header \
|
||||
-emit-objc-header-path $$SWIFT_GEN_HEADERS_PATH/SwiftModule-Swift.h \
|
||||
-emit-object \
|
||||
-sdk $$SDK_PATH \
|
||||
-target $${ARCH}-$${IOS_TARGET_PLATFORM} \
|
||||
-o $$COMPILER_OUTPUT \
|
||||
-framework UIKit
|
||||
|
||||
!isEmpty(BRIDGING_HEADER) {
|
||||
SWIFT_CMD += -import-objc-header $$BRIDGING_HEADER
|
||||
}
|
||||
|
||||
$${COMPILER_NAME}.commands = $$SWIFT_CMD
|
||||
$${COMPILER_NAME}.CONFIG = combine target_predeps no_link
|
||||
|
||||
export($${COMPILER_NAME}.name)
|
||||
export($${COMPILER_NAME}.input)
|
||||
export($${COMPILER_NAME}.output)
|
||||
export($${COMPILER_NAME}.commands)
|
||||
export($${COMPILER_NAME}.CONFIG)
|
||||
QMAKE_EXTRA_COMPILERS += $${COMPILER_NAME}
|
||||
}
|
||||
|
||||
# add lipo tool execution to form universal binary
|
||||
LIPO_OUT = $$SWIFT_GEN_HEADERS_PATH/swift_module.o
|
||||
lipo_tool.name = LipoTool
|
||||
# as input for lipo_tool we set SWIFT_SOURCES (not SWIFT_COMPILERS_OUT as it won't be executed otherwise!)
|
||||
lipo_tool.input = SWIFT_SOURCES
|
||||
# compiled swift sources go into depends
|
||||
lipo_tool.depends = $$SWIFT_COMPILERS_OUT
|
||||
lipo_tool.output = $$LIPO_OUT
|
||||
lipo_tool.commands = lipo -create $$SWIFT_COMPILERS_OUT -output $$LIPO_OUT
|
||||
lipo_tool.CONFIG = combine target_predeps no_link
|
||||
lipo_tool.variable_out = OBJECTS
|
||||
|
||||
export(lipo_tool.name)
|
||||
export(lipo_tool.input)
|
||||
export(lipo_tool.depends)
|
||||
export(lipo_tool.output)
|
||||
export(lipo_tool.commands)
|
||||
export(lipo_tool.CONFIG)
|
||||
export(lipo_tool.variable_out)
|
||||
QMAKE_EXTRA_COMPILERS += lipo_tool
|
||||
|
||||
export(QMAKE_EXTRA_COMPILERS)
|
||||
|
||||
INCLUDEPATH += $$SWIFT_GEN_HEADERS_PATH
|
||||
export(INCLUDEPATH)
|
||||
|
||||
# link with libs from toolchain
|
||||
SWIFT_LIB_PATH = $$XCODE_TOOLCHAIN_PATH/usr/lib/swift/iphoneos
|
||||
xcframework_platform_ios_simulator {
|
||||
SWIFT_LIB_PATH = $$XCODE_TOOLCHAIN_PATH/usr/lib/swift/iphonesimulator
|
||||
}
|
||||
LIBS += -L$$SWIFT_LIB_PATH
|
||||
LIBS += -lswiftCore -lswiftFoundation -lswiftObjectiveC
|
||||
|
||||
export(LIBS)
|
||||
|
||||
OTHER_FILES += $$SWIFT_SOURCES
|
||||
export(OTHER_FILES)
|
||||
return(true)
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,10 @@
|
||||
#undef DeleteFile
|
||||
#endif
|
||||
|
||||
#if defined(GetSystemDirectory)
|
||||
#undef GetSystemDirectory
|
||||
#endif
|
||||
|
||||
#ifndef _BUILD_FILE_CROSSPLATFORM_H_
|
||||
#define _BUILD_FILE_CROSSPLATFORM_H_
|
||||
|
||||
|
||||
@ -246,6 +246,11 @@ namespace NSSystemPath
|
||||
|
||||
wsNewPath.pop_back();
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
if (L'/' == strPath[0] || L'\\' == strPath[0])
|
||||
return L'/' + wsNewPath;
|
||||
#endif
|
||||
|
||||
return wsNewPath;
|
||||
}
|
||||
|
||||
|
||||
@ -29,11 +29,11 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef _SYSTEMUTILS_H
|
||||
#define _SYSTEMUTILS_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "../../Common/kernel_config.h"
|
||||
#include "../../OdfFile/Common/logging.h"
|
||||
|
||||
#define VALUE_STRINGIFY(d) L##d
|
||||
#define VALUE_TO_STR(v) VALUE_STRINGIFY(v)
|
||||
@ -59,7 +59,8 @@ namespace NSSystemUtils
|
||||
static const wchar_t* gc_EnvLastModifiedBy = L"LAST_MODIFIED_BY";
|
||||
static const wchar_t* gc_EnvModified = L"MODIFIED";
|
||||
static const wchar_t* gc_EnvMemoryLimit = L"X2T_MEMORY_LIMIT";
|
||||
static const wchar_t* gc_EnvMemoryLimitDefault = L"3GiB";
|
||||
static const wchar_t* gc_EnvMemoryLimitDefault = L"4GiB";
|
||||
static const wchar_t* gc_EnvSigningKeystorePassphrase = L"SIGNING_KEYSTORE_PASSPHRASE";
|
||||
|
||||
KERNEL_DECL std::string GetEnvVariableA(const std::wstring& strName);
|
||||
KERNEL_DECL std::wstring GetEnvVariable(const std::wstring& strName);
|
||||
@ -76,4 +77,3 @@ namespace NSSystemUtils
|
||||
};
|
||||
KERNEL_DECL std::wstring GetSystemDirectory(const SystemDirectoryType& type);
|
||||
}
|
||||
#endif // _SYSTEMUTILS_H
|
||||
|
||||
@ -16,7 +16,15 @@
|
||||
static tsize_t
|
||||
_tiffReadProcEx(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return (tsize_t)((CxFile*)fd)->Read(buf, 1, size);
|
||||
tsize_t nReadCount = (tsize_t)((CxFile*)fd)->Read(buf, 1, size);
|
||||
|
||||
if (nReadCount < size)
|
||||
{
|
||||
memset(static_cast<char*>(buf) + nReadCount, 0, size - nReadCount);
|
||||
return size;
|
||||
}
|
||||
|
||||
return nReadCount;
|
||||
}
|
||||
|
||||
static tsize_t
|
||||
|
||||
@ -26,7 +26,7 @@ def _loadLibrary(path):
|
||||
library_name = 'libdocbuilder.c.dylib'
|
||||
# if there is no dylib file, get library from framework
|
||||
if not os.path.exists(path + '/' + library_name):
|
||||
path = path + '/docbuilder.c.framework'
|
||||
path = path + '/docbuilder.c.framework/Versions/A'
|
||||
library_name = 'docbuilder.c'
|
||||
|
||||
_lib = ctypes.CDLL(path + '/' + library_name)
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
bool OpenFile(const std::wstring& sFile, const std::wstring& sPassword)
|
||||
bool OpenFile(const std::wstring& sFile, const wchar_t* sPassword)
|
||||
{
|
||||
CloseFile();
|
||||
|
||||
@ -171,7 +171,7 @@ public:
|
||||
|
||||
return m_pFile ? true : false;
|
||||
}
|
||||
bool OpenFile(BYTE* data, LONG size, const std::wstring& sPassword)
|
||||
bool OpenFile(BYTE* data, LONG size, const wchar_t* sPassword)
|
||||
{
|
||||
CloseFile();
|
||||
|
||||
@ -245,7 +245,18 @@ public:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CheckOwnerPassword(const wchar_t* sPassword)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->CheckOwnerPassword(sPassword);
|
||||
return true;
|
||||
}
|
||||
bool CheckPerm(int nPerm)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->CheckPerm(nPerm);
|
||||
return true;
|
||||
}
|
||||
BYTE* GetInfo()
|
||||
{
|
||||
NSWasm::CData oRes;
|
||||
@ -311,6 +322,28 @@ public:
|
||||
return ((CPdfFile*)m_pFile)->UnmergePages();
|
||||
return false;
|
||||
}
|
||||
bool RedactPage(int nPageIndex, double* arrRedactBox, int nLengthX8, BYTE* data, int size, bool bCopy = false)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
{
|
||||
// Память из CDrawingFileEmbed освобождается сразу после вызова функции, поэтому копируем
|
||||
if (bCopy)
|
||||
{
|
||||
BYTE* pCopy = (BYTE*)malloc(size);
|
||||
memcpy(pCopy, data, size);
|
||||
data = pCopy;
|
||||
}
|
||||
// Захватывает полученную память data
|
||||
return ((CPdfFile*)m_pFile)->RedactPage(nPageIndex, arrRedactBox, nLengthX8, data, size);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool UndoRedact()
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->UndoRedact();
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* GetGlyphs(int nPageIndex)
|
||||
{
|
||||
@ -421,6 +454,20 @@ public:
|
||||
if (m_nType == 0)
|
||||
((CPdfFile*)m_pFile)->SetCMapMemory(data, size);
|
||||
}
|
||||
void SetScanPageFonts(int nPageIndex)
|
||||
{
|
||||
if (NULL == m_pImageStorage)
|
||||
m_pImageStorage = NSDocxRenderer::CreateWasmImageStorage();
|
||||
|
||||
CDocxRenderer oRenderer(m_pApplicationFonts);
|
||||
oRenderer.SetExternalImageStorage(m_pImageStorage);
|
||||
oRenderer.SetTextAssociationType(NSDocxRenderer::TextAssociationType::tatParagraphToShape);
|
||||
|
||||
oRenderer.ScanPageBin(m_pFile, nPageIndex);
|
||||
|
||||
if (m_nType == 0)
|
||||
((CPdfFile*)m_pFile)->SetPageFonts(nPageIndex);
|
||||
}
|
||||
BYTE* ScanPage(int nPageIndex, int mode)
|
||||
{
|
||||
if (NULL == m_pImageStorage)
|
||||
@ -457,6 +504,9 @@ public:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (m_nType == 0)
|
||||
((CPdfFile*)m_pFile)->SetPageFonts(nPageIndex);
|
||||
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return res;
|
||||
@ -545,6 +595,13 @@ public:
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
BYTE* GetGIDByUnicode(const std::string& sPathA)
|
||||
{
|
||||
if (m_nType != 0)
|
||||
return NULL;
|
||||
std::wstring sFontName = UTF8_TO_U(sPathA);
|
||||
return ((CPdfFile*)m_pFile)->GetGIDByUnicode(sFontName);
|
||||
}
|
||||
|
||||
std::wstring GetFontBinaryNative(const std::wstring& sName)
|
||||
{
|
||||
|
||||
@ -26,7 +26,8 @@ CDrawingFileEmbed::~CDrawingFileEmbed()
|
||||
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::OpenFile(JSSmart<CJSValue> sFile, JSSmart<CJSValue> sPassword)
|
||||
{
|
||||
bool bResult = m_pFile->OpenFile(sFile->toStringW(), sPassword->isString() ? sPassword->toStringW() : L"");
|
||||
std::wstring wsPassword = sPassword->isString() ? sPassword->toStringW() : L"";
|
||||
bool bResult = m_pFile->OpenFile(sFile->toStringW(), sPassword->isString() ? wsPassword.c_str() : NULL);
|
||||
return CJSContext::createBool(bResult);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::CloseFile()
|
||||
@ -207,6 +208,40 @@ JSSmart<CJSValue> CDrawingFileEmbed::UnmergePages()
|
||||
return CJSContext::createBool(m_pFile->UnmergePages());
|
||||
return CJSContext::createBool(false);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::RedactPage(JSSmart<CJSValue> nPageIndex, JSSmart<CJSValue> arrRedactBox, JSSmart<CJSValue> dataFiller)
|
||||
{
|
||||
bool result = false;
|
||||
if (m_pFile)
|
||||
{
|
||||
int pageIndex = nPageIndex->toInt32();
|
||||
|
||||
JSSmart<CJSArray> arrBox = arrRedactBox->toArray();
|
||||
int nCountBox = arrBox->getCount();
|
||||
double* pBox = NULL;
|
||||
if (0 < nCountBox)
|
||||
pBox = new double[nCountBox];
|
||||
|
||||
for (int i = 0; i < nCountBox; i++)
|
||||
pBox[i] = arrBox->get(i)->toDouble();
|
||||
|
||||
JSSmart<CJSTypedArray> dataPtr = dataFiller->toTypedArray();
|
||||
CJSDataBuffer buffer = dataPtr->getData();
|
||||
|
||||
result = m_pFile->RedactPage(pageIndex, pBox, nCountBox / 8, buffer.Data, (int)buffer.Len, true);
|
||||
|
||||
if (pBox)
|
||||
delete[] pBox;
|
||||
if (buffer.IsExternalize)
|
||||
buffer.Free();
|
||||
}
|
||||
return CJSContext::createBool(result);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::UndoRedact()
|
||||
{
|
||||
if (m_pFile)
|
||||
return CJSContext::createBool(m_pFile->UndoRedact());
|
||||
return CJSContext::createBool(false);
|
||||
}
|
||||
|
||||
bool EmbedDrawingFile(JSSmart<NSJSBase::CJSContext>& context, IOfficeDrawingFile* pFile)
|
||||
{
|
||||
|
||||
@ -54,6 +54,8 @@ public:
|
||||
JSSmart<CJSValue> SplitPages(JSSmart<CJSValue> arrPageIndexes, JSSmart<CJSValue> data);
|
||||
JSSmart<CJSValue> MergePages(JSSmart<CJSValue> data, JSSmart<CJSValue> nMaxID, JSSmart<CJSValue> sPrefixForm);
|
||||
JSSmart<CJSValue> UnmergePages();
|
||||
JSSmart<CJSValue> RedactPage(JSSmart<CJSValue> nPageIndex, JSSmart<CJSValue> arrRedactBox, JSSmart<CJSValue> dataFiller);
|
||||
JSSmart<CJSValue> UndoRedact();
|
||||
|
||||
DECLARE_EMBED_METHODS
|
||||
};
|
||||
|
||||
@ -194,6 +194,9 @@ JSSmart<CJSValue> CNativeControlEmbed::ZipOpenBase64(JSSmart<CJSValue> name)
|
||||
|
||||
JSSmart<CJSValue> CNativeControlEmbed::ZipFileAsString(JSSmart<CJSValue> name)
|
||||
{
|
||||
if (m_pInternal->m_oZipWorker.m_sTmpFolder.empty())
|
||||
return CJSContext::createUndefined();
|
||||
|
||||
BYTE* pData = NULL;
|
||||
DWORD len = 0;
|
||||
m_pInternal->m_oZipWorker.GetFileData(name->toStringW(), pData, len);
|
||||
@ -202,6 +205,9 @@ JSSmart<CJSValue> CNativeControlEmbed::ZipFileAsString(JSSmart<CJSValue> name)
|
||||
|
||||
JSSmart<CJSValue> CNativeControlEmbed::ZipFileAsBinary(JSSmart<CJSValue> name)
|
||||
{
|
||||
if (m_pInternal->m_oZipWorker.m_sTmpFolder.empty())
|
||||
return CJSContext::createUndefined();
|
||||
|
||||
return CJSContext::createUint8Array(m_pInternal->m_oZipWorker.m_sTmpFolder + L"/" + name->toStringW());
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
-(JSValue*) SplitPages : (JSValue*)arrPageIndexes : (JSValue*)data;
|
||||
-(JSValue*) MergePages : (JSValue*)data : (JSValue*)nMaxID : (JSValue*)sPrefixForm;
|
||||
-(JSValue*) UnmergePages;
|
||||
-(JSValue*) RedactPage : (JSValue*)nPageIndex : (JSValue*)arrRedactBox : (JSValue*)dataFiller;
|
||||
-(JSValue*) UndoRedact;
|
||||
@end
|
||||
|
||||
@interface CJSCDrawingFileEmbed : NSObject<IJSCDrawingFileEmbed, JSEmbedObjectProtocol>
|
||||
@ -67,6 +69,8 @@ FUNCTION_WRAPPER_JS_1(FreeWasmData, FreeWasmData)
|
||||
FUNCTION_WRAPPER_JS_2(SplitPages, SplitPages)
|
||||
FUNCTION_WRAPPER_JS_3(MergePages, MergePages)
|
||||
FUNCTION_WRAPPER_JS_0(UnmergePages, UnmergePages)
|
||||
FUNCTION_WRAPPER_JS_3(RedactPage, RedactPage)
|
||||
FUNCTION_WRAPPER_JS_0(UndoRedact, UndoRedact)
|
||||
@end
|
||||
|
||||
class CDrawingFileEmbedAdapter : public CJSEmbedObjectAdapterJSC
|
||||
|
||||
@ -33,6 +33,8 @@ namespace NSDrawingFileEmbed
|
||||
FUNCTION_WRAPPER_V8_2(_SplitPages, SplitPages)
|
||||
FUNCTION_WRAPPER_V8_3(_MergePages, MergePages)
|
||||
FUNCTION_WRAPPER_V8_0(_UnmergePages, UnmergePages)
|
||||
FUNCTION_WRAPPER_V8_3(_RedactPage, RedactPage)
|
||||
FUNCTION_WRAPPER_V8_0(_UndoRedact, UndoRedact)
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
|
||||
{
|
||||
@ -65,6 +67,8 @@ namespace NSDrawingFileEmbed
|
||||
NSV8Objects::Template_Set(result, "SplitPages", _SplitPages);
|
||||
NSV8Objects::Template_Set(result, "MergePages", _MergePages);
|
||||
NSV8Objects::Template_Set(result, "UnmergePages", _UnmergePages);
|
||||
NSV8Objects::Template_Set(result, "RedactPage", _RedactPage);
|
||||
NSV8Objects::Template_Set(result, "UndoRedact", _UndoRedact);
|
||||
|
||||
return handle_scope.Escape(result);
|
||||
}
|
||||
|
||||
@ -461,6 +461,8 @@ namespace NSJSBase
|
||||
v8::SnapshotCreator snapshotCreator;
|
||||
v8::Isolate* isolate = snapshotCreator.GetIsolate();
|
||||
{
|
||||
CV8TryCatch try_catch(isolate);
|
||||
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
// Create a new context
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate);
|
||||
@ -472,11 +474,12 @@ namespace NSJSBase
|
||||
global->Set(context, v8::String::NewFromUtf8Literal(isolate, "self"), global).Check();
|
||||
global->Set(context, v8::String::NewFromUtf8Literal(isolate, "native"), v8::Undefined(isolate)).Check();
|
||||
|
||||
// Compile and run
|
||||
// Compile
|
||||
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, script.c_str()).ToLocalChecked();
|
||||
v8::Local<v8::Script> script = v8::Script::Compile(context, source).ToLocalChecked();
|
||||
|
||||
// Run
|
||||
script->Run(context).IsEmpty();
|
||||
|
||||
snapshotCreator.SetDefaultContext(context);
|
||||
}
|
||||
v8::StartupData data = snapshotCreator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
|
||||
|
||||
@ -62,7 +62,13 @@ v8::Local<v8::String> CreateV8String(v8::Isolate* i, const std::string& str);
|
||||
#include <android/log.h>
|
||||
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, "js", __VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "js", __VA_ARGS__)
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "js", __VA_ARGS__)
|
||||
#else
|
||||
// should be disabled for release builds
|
||||
#define LOGD(...)
|
||||
#endif // _DEBUG
|
||||
#endif // ANDROID_LOGS
|
||||
|
||||
#endif
|
||||
|
||||
@ -799,6 +805,9 @@ namespace NSJSBase
|
||||
CV8TryCatch() : CJSTryCatch(), try_catch(V8IsolateOneArg)
|
||||
{
|
||||
}
|
||||
CV8TryCatch(v8::Isolate* isolate) : CJSTryCatch(), try_catch(isolate)
|
||||
{
|
||||
}
|
||||
virtual ~CV8TryCatch()
|
||||
{
|
||||
}
|
||||
|
||||
@ -837,53 +837,63 @@ public:
|
||||
CSymbolSimpleChecker2 oAllChecker(arSymbolsAll, nMaxSymbol);
|
||||
|
||||
std::map<std::wstring, int> mapFontsPriorityStandard;
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"ASCW3", 1));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Arial", 2));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Times New Roman", 3));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Tahoma", 4));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Cambria", 5));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Calibri", 6));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Verdana", 7));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Georgia", 8));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Open Sans", 9));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Liberation Sans", 10));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Helvetica", 11));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Nimbus Sans L", 12));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"DejaVu Sans", 13));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Liberation Serif", 14));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Trebuchet MS", 15));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Courier New", 16));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Carlito", 17));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Segoe UI", 18));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimSun", 19));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MS Gothic", 20));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Nirmala UI", 21));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Batang", 22));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MS Mincho", 23));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Wingdings", 24));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Microsoft JhengHei", 25));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Microsoft JhengHei UI", 26));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Microsoft YaHei", 27));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PMingLiU", 28));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"MingLiU", 29));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"DFKai-SB", 30));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"FangSong", 31));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"KaiTi", 32));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimKai", 33));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"SimHei", 34));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Meiryo", 35));
|
||||
int nCurrentPriority = 1;
|
||||
|
||||
#define SET_FONT_PRIORITY(fontName) mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(fontName, nCurrentPriority++))
|
||||
|
||||
SET_FONT_PRIORITY(L"ASCW3");
|
||||
SET_FONT_PRIORITY(L"Arial");
|
||||
SET_FONT_PRIORITY(L"Times New Roman");
|
||||
SET_FONT_PRIORITY(L"Tahoma");
|
||||
SET_FONT_PRIORITY(L"Cambria");
|
||||
SET_FONT_PRIORITY(L"Calibri");
|
||||
SET_FONT_PRIORITY(L"Verdana");
|
||||
SET_FONT_PRIORITY(L"Georgia");
|
||||
SET_FONT_PRIORITY(L"Open Sans");
|
||||
SET_FONT_PRIORITY(L"Liberation Sans");
|
||||
SET_FONT_PRIORITY(L"Helvetica");
|
||||
SET_FONT_PRIORITY(L"Nimbus Sans L");
|
||||
SET_FONT_PRIORITY(L"DejaVu Sans");
|
||||
SET_FONT_PRIORITY(L"Liberation Serif");
|
||||
SET_FONT_PRIORITY(L"Trebuchet MS");
|
||||
SET_FONT_PRIORITY(L"Courier New");
|
||||
SET_FONT_PRIORITY(L"Carlito");
|
||||
SET_FONT_PRIORITY(L"Segoe UI");
|
||||
SET_FONT_PRIORITY(L"SimSun");
|
||||
SET_FONT_PRIORITY(L"MS Gothic");
|
||||
SET_FONT_PRIORITY(L"Nirmala UI");
|
||||
SET_FONT_PRIORITY(L"Batang");
|
||||
SET_FONT_PRIORITY(L"MS Mincho");
|
||||
SET_FONT_PRIORITY(L"Wingdings");
|
||||
SET_FONT_PRIORITY(L"Microsoft JhengHei");
|
||||
SET_FONT_PRIORITY(L"Microsoft JhengHei UI");
|
||||
SET_FONT_PRIORITY(L"Microsoft YaHei");
|
||||
SET_FONT_PRIORITY(L"PMingLiU");
|
||||
SET_FONT_PRIORITY(L"MingLiU");
|
||||
SET_FONT_PRIORITY(L"DFKai-SB");
|
||||
SET_FONT_PRIORITY(L"FangSong");
|
||||
SET_FONT_PRIORITY(L"KaiTi");
|
||||
SET_FONT_PRIORITY(L"SimKai");
|
||||
SET_FONT_PRIORITY(L"SimHei");
|
||||
SET_FONT_PRIORITY(L"Meiryo");
|
||||
|
||||
#ifdef _MAC
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang SC", 36));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang TC", 37));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang HK", 38));
|
||||
SET_FONT_PRIORITY(L"PingFang SC");
|
||||
SET_FONT_PRIORITY(L"PingFang TC");
|
||||
SET_FONT_PRIORITY(L"PingFang HK");
|
||||
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti SC", 39));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti TC", 40));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti SC", 41));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti TC", 42));
|
||||
SET_FONT_PRIORITY(L"Heiti SC");
|
||||
SET_FONT_PRIORITY(L"Heiti TC");
|
||||
SET_FONT_PRIORITY(L"Songti SC");
|
||||
SET_FONT_PRIORITY(L"Songti TC");
|
||||
#endif
|
||||
|
||||
SET_FONT_PRIORITY(L"Malgun Gothic");
|
||||
SET_FONT_PRIORITY(L"Nanum Gothic");
|
||||
SET_FONT_PRIORITY(L"NanumGothic");
|
||||
SET_FONT_PRIORITY(L"Noto Sans KR");
|
||||
SET_FONT_PRIORITY(L"TakaoGothic");
|
||||
|
||||
NSFonts::CApplicationFontsSymbols oApplicationChecker;
|
||||
|
||||
// приоритеты шрифтов. по имени (все стили)
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#include <vector>
|
||||
#include "../graphics/pro/Fonts.h"
|
||||
|
||||
#define ONLYOFFICE_FONTS_VERSION 14
|
||||
#define ONLYOFFICE_FONTS_VERSION 15
|
||||
#define ONLYOFFICE_ALL_FONTS_VERSION 2
|
||||
|
||||
class CApplicationFontsWorkerBreaker
|
||||
|
||||
@ -731,10 +731,10 @@ void CFontFile::CheckHintsSupport()
|
||||
int CFontFile::SetCMapForCharCode(long lUnicode, int *pnCMapIndex)
|
||||
{
|
||||
*pnCMapIndex = -1;
|
||||
if (!m_pFace)
|
||||
if (!m_pFace || !m_pFace->num_charmaps)
|
||||
return 0;
|
||||
|
||||
if ( m_bStringGID || 0 == m_pFace->num_charmaps )
|
||||
if ( m_bStringGID )
|
||||
return lUnicode;
|
||||
|
||||
int nCharIndex = 0;
|
||||
@ -1046,6 +1046,28 @@ int CFontFile::GetGIDByUnicode(int code)
|
||||
return unGID;
|
||||
}
|
||||
|
||||
int CFontFile::GetUnicodeByGID(int gid)
|
||||
{
|
||||
if (!m_pFace)
|
||||
return 0;
|
||||
|
||||
FT_ULong charcode;
|
||||
FT_UInt gindex;
|
||||
|
||||
charcode = FT_Get_First_Char(m_pFace, &gindex);
|
||||
|
||||
while (gindex != 0)
|
||||
{
|
||||
if (gindex == gid)
|
||||
{
|
||||
return charcode;
|
||||
}
|
||||
charcode = FT_Get_Next_Char(m_pFace, charcode, &gindex);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT CFontFile::GetString(CGlyphString& oString)
|
||||
{
|
||||
int nCountGlyph = oString.GetLength();
|
||||
|
||||
@ -254,6 +254,7 @@ public:
|
||||
double GetCharWidth(int gid);
|
||||
|
||||
int GetGIDByUnicode(int code);
|
||||
int GetUnicodeByGID(int gid);
|
||||
|
||||
int GetKerning(FT_UInt unPrevGID, FT_UInt unGID);
|
||||
void SetStringGID(const INT& bGID);
|
||||
|
||||
@ -851,6 +851,14 @@ unsigned int CFontManager::GetGIDByUnicode(const unsigned int& unCode)
|
||||
|
||||
return m_pFont->GetGIDByUnicode(unCode);
|
||||
}
|
||||
int CFontManager::GetUnicodeByGID(const int& gid)
|
||||
{
|
||||
if (!m_pFont)
|
||||
return 0;
|
||||
|
||||
return m_pFont->GetUnicodeByGID(gid);
|
||||
}
|
||||
|
||||
void CFontManager::SetSubpixelRendering(const bool& hmul, const bool& vmul)
|
||||
{
|
||||
if (hmul)
|
||||
|
||||
@ -186,6 +186,7 @@ public:
|
||||
virtual std::wstring GetFontType();
|
||||
virtual unsigned int GetNameIndex(const std::wstring& wsName);
|
||||
virtual unsigned int GetGIDByUnicode(const unsigned int& unCode);
|
||||
virtual int GetUnicodeByGID(const int& gid);
|
||||
|
||||
virtual void SetSubpixelRendering(const bool& hmul, const bool& vmul);
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ WASM_EXPORT unsigned int ASC_FT_SetCMapForCharCode(FT_Face face, unsigned int un
|
||||
return 0;
|
||||
|
||||
if ( 0 == face->num_charmaps )
|
||||
return unicode;
|
||||
return 0;
|
||||
|
||||
unsigned int nCharIndex = 0;
|
||||
|
||||
|
||||
@ -265,15 +265,15 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../",
|
||||
"files": ["graphics/Image.cpp", "raster/BgraFrame.cpp", "raster/ImageFileFormatChecker.cpp", "graphics/Matrix.cpp"]
|
||||
"files": ["graphics/Image.cpp", "raster/BgraFrame.cpp", "raster/ImageFileFormatChecker.cpp", "graphics/Matrix.cpp", "graphics/GraphicsPath.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../agg-2.4/src/",
|
||||
"files": ["agg_trans_affine.cpp"]
|
||||
"files": ["agg_trans_affine.cpp", "agg_bezier_arc.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../raster/",
|
||||
"files": ["PICT/PICFile.cpp", "PICT/pic.cpp"]
|
||||
"files": ["PICT/PICFile.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../graphics/pro/js/qt/raster",
|
||||
|
||||
@ -737,11 +737,13 @@ CBooleanOperations::CBooleanOperations(const CGraphicsPath& path1,
|
||||
const CGraphicsPath& path2,
|
||||
BooleanOpType op,
|
||||
long fillType,
|
||||
bool isLuminosity) :
|
||||
bool isLuminosity,
|
||||
bool isSelf) :
|
||||
Op(op),
|
||||
Close1(path1.Is_poly_closed()),
|
||||
Close2(path2.Is_poly_closed()),
|
||||
IsLuminosity(isLuminosity),
|
||||
IsSelf(isSelf),
|
||||
FillType(fillType),
|
||||
Path1(path1),
|
||||
Path2(path2)
|
||||
@ -758,12 +760,35 @@ CGraphicsPath&& CBooleanOperations::GetResult()
|
||||
return std::move(Result);
|
||||
}
|
||||
|
||||
bool CBooleanOperations::IsSelfInters(const CGraphicsPath& p)
|
||||
{
|
||||
PreparePath(p, 1, Segments1, Curves1);
|
||||
PreparePath(p, 2, Segments2, Curves2);
|
||||
|
||||
OriginCurves1 = Curves1;
|
||||
OriginCurves2 = Curves2;
|
||||
|
||||
GetIntersection();
|
||||
|
||||
if (Locations.empty())
|
||||
return false;
|
||||
else
|
||||
{
|
||||
for (const auto& l : Locations)
|
||||
{
|
||||
if (!isZero(l->Time) && !isZero(l->Time - 1.0) && l->C.Segment2.Index != l->Inters->C.Segment1.Index)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CBooleanOperations::TraceBoolean()
|
||||
{
|
||||
bool reverse = false;
|
||||
if ((Op == Subtraction || Op == Exclusion) ^
|
||||
Path1.IsClockwise() ^
|
||||
Path2.IsClockwise())
|
||||
if (((Op == Subtraction || Op == Exclusion) ^
|
||||
Path1.IsClockwise() ^
|
||||
Path2.IsClockwise()) && !IsSelf)
|
||||
reverse = true;
|
||||
|
||||
PreparePath(Path1, 1, Segments1, Curves1);
|
||||
@ -774,6 +799,37 @@ void CBooleanOperations::TraceBoolean()
|
||||
|
||||
GetIntersection();
|
||||
|
||||
if (IsSelf)
|
||||
{
|
||||
if (Op == Subtraction)
|
||||
return;
|
||||
|
||||
std::vector<std::vector<int>> adj_matr(Locations.size());
|
||||
|
||||
for (size_t i = 0; i < Locations.size(); i++)
|
||||
{
|
||||
std::vector<int> adj_vec;
|
||||
|
||||
if (CheckLocation(Locations[i], true))
|
||||
adj_vec.push_back(Locations[i]->C.Segment1.Index);
|
||||
if (CheckLocation(Locations[i], false))
|
||||
adj_vec.push_back(Locations[i]->C.Segment2.Index);
|
||||
if (CheckLocation(Locations[i]->Inters, true))
|
||||
adj_vec.push_back(Locations[i]->Inters->C.Segment1.Index);
|
||||
if (CheckLocation(Locations[i]->Inters, false))
|
||||
adj_vec.push_back(Locations[i]->Inters->C.Segment2.Index);
|
||||
adj_matr[i] = adj_vec;
|
||||
}
|
||||
|
||||
CreateNewPath(adj_matr);
|
||||
return;
|
||||
}
|
||||
else if (Path1 == Path2)
|
||||
{
|
||||
Result = std::move(Path1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Locations.empty())
|
||||
{
|
||||
int length = static_cast<int>(Locations.size());
|
||||
@ -802,6 +858,16 @@ void CBooleanOperations::TraceBoolean()
|
||||
TraceAllOverlap();
|
||||
return;
|
||||
}
|
||||
if (IsOneCurvePath(1))
|
||||
{
|
||||
TraceOneCurvePath1();
|
||||
return;
|
||||
}
|
||||
if (IsOneCurvePath(2))
|
||||
{
|
||||
TraceOneCurvePath2();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SetWinding();
|
||||
@ -1008,6 +1074,100 @@ void CBooleanOperations::TraceAllOverlap()
|
||||
}
|
||||
}
|
||||
|
||||
void CBooleanOperations::TraceOneCurvePath1()
|
||||
{
|
||||
if (Op == Intersection)
|
||||
{
|
||||
Result.StartFigure();
|
||||
for (const auto& s : Segments1)
|
||||
{
|
||||
if (s.Inters && Result.GetPointCount() == 0)
|
||||
{
|
||||
Result.MoveTo(s.P.X, s.P.Y);
|
||||
Segment s2 = GetNextSegment(s);
|
||||
if (s2.IsCurve)
|
||||
Result.CurveTo(s2.HI.X + s2.P.X, s2.HI.Y + s2.P.Y,
|
||||
s2.HO.X + s2.P.X, s2.HO.Y + s2.P.Y,
|
||||
s2.P.X, s2.P.Y);
|
||||
else
|
||||
Result.LineTo(s2.P.X, s2.P.Y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Op == Union)
|
||||
{
|
||||
Result.AddPath(Path2);
|
||||
for (size_t i = 0; i < Segments1.size(); i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
Result.MoveTo(Segments1[i].P.X, Segments1[i].P.Y);
|
||||
else if (Segments1[i].IsCurve)
|
||||
Result.CurveTo(Segments1[i].HI.X + Segments1[i].P.X, Segments1[i].HI.Y + Segments1[i].P.Y,
|
||||
Segments1[i].HO.X + Segments1[i].P.X, Segments1[i].HO.Y + Segments1[i].P.Y,
|
||||
Segments1[i].P.X, Segments1[i].P.Y);
|
||||
else
|
||||
Result.LineTo(Segments1[i].P.X, Segments1[i].P.Y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Result.StartFigure();
|
||||
|
||||
for (size_t i = 0; i < Segments1.size(); i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
Result.MoveTo(Segments1[i].P.X, Segments1[i].P.Y);
|
||||
else if (Segments1[i].IsCurve)
|
||||
Result.CurveTo(Segments1[i].HI.X + Segments1[i].P.X, Segments1[i].HI.Y + Segments1[i].P.Y,
|
||||
Segments1[i].HO.X + Segments1[i].P.X, Segments1[i].HO.Y + Segments1[i].P.Y,
|
||||
Segments1[i].P.X, Segments1[i].P.Y);
|
||||
else
|
||||
Result.LineTo(Segments1[i].P.X, Segments1[i].P.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBooleanOperations::TraceOneCurvePath2()
|
||||
{
|
||||
if (Op == Intersection)
|
||||
{
|
||||
Result.StartFigure();
|
||||
for (const auto& s : Segments2)
|
||||
{
|
||||
if (s.Inters && Result.GetPointCount() == 0)
|
||||
{
|
||||
Result.MoveTo(s.P.X, s.P.Y);
|
||||
Segment s2 = GetNextSegment(s);
|
||||
if (s2.IsCurve)
|
||||
Result.CurveTo(s2.HI.X + s2.P.X, s2.HI.Y + s2.P.Y,
|
||||
s2.HO.X + s2.P.X, s2.HO.Y + s2.P.Y,
|
||||
s2.P.X, s2.P.Y);
|
||||
else
|
||||
Result.LineTo(s2.P.X, s2.P.Y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Op == Union)
|
||||
{
|
||||
Result.AddPath(Path1);
|
||||
for (size_t i = 0; i < Segments2.size(); i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
Result.MoveTo(Segments2[i].P.X, Segments2[i].P.Y);
|
||||
else if (Segments2[i].IsCurve)
|
||||
Result.CurveTo(Segments2[i].HI.X + Segments2[i].P.X, Segments2[i].HI.Y + Segments2[i].P.Y,
|
||||
Segments2[i].HO.X + Segments2[i].P.X, Segments2[i].HO.Y + Segments2[i].P.Y,
|
||||
Segments2[i].P.X, Segments2[i].P.Y);
|
||||
else
|
||||
Result.LineTo(Segments2[i].P.X, Segments2[i].P.Y);
|
||||
}
|
||||
}
|
||||
else
|
||||
Result = std::move(Path1);
|
||||
}
|
||||
|
||||
void CBooleanOperations::TracePaths()
|
||||
{
|
||||
size_t length = Segments1.size();
|
||||
@ -1044,7 +1204,10 @@ void CBooleanOperations::TracePaths()
|
||||
Segment tmp = GetNextSegment(prev.Inters->S);
|
||||
if (tmp.IsEmpty()) break;
|
||||
if (tmp.IsValid(Op))
|
||||
{
|
||||
s = tmp;
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid && prev.Inters)
|
||||
@ -1253,6 +1416,218 @@ void CBooleanOperations::SetVisited(const Segment& segment)
|
||||
Segments2[segment.Index].Visited = true;
|
||||
}
|
||||
|
||||
void CBooleanOperations::CreateNewPath(const std::vector<std::vector<int>>& adjMatr) noexcept
|
||||
{
|
||||
int* loc_visited = new int[Locations.size()];
|
||||
memset(loc_visited, false, Locations.size());
|
||||
bool* seg_visited = new bool[Segments1.size()];
|
||||
memset(seg_visited, false, Segments1.size());
|
||||
|
||||
Result.StartFigure();
|
||||
for (int i = 0; i < Locations.size(); i++)
|
||||
{
|
||||
auto loc = Locations[i];
|
||||
if (loc_visited[i] == 2)
|
||||
continue;
|
||||
|
||||
bool finish = true;
|
||||
for (size_t j = 0; j < Segments1.size(); j++)
|
||||
finish = finish && seg_visited[j];
|
||||
|
||||
if (finish)
|
||||
break;
|
||||
|
||||
auto add_seg = [&](int x, int prev_x) {
|
||||
for (int j = adjMatr[x].size() - 1; j >= 0; j--)
|
||||
{
|
||||
int ver = adjMatr[x][j];
|
||||
if (seg_visited[ver] || ver == prev_x)
|
||||
continue;
|
||||
|
||||
seg_visited[ver] = true;
|
||||
if (Segments1[ver].IsCurve)
|
||||
{
|
||||
Segment seg;
|
||||
auto curve = Curves1[ver];
|
||||
auto curve1 = Curves1[ver == 0 ? Curves1.size() - 1 : ver - 1];
|
||||
if (curve.Segment2.Index == Locations[x]->C.Segment2.Index)
|
||||
{
|
||||
auto new_curve = curve.DivideAtTime(Locations[x]->Time);
|
||||
seg = new_curve.Segment1;
|
||||
}
|
||||
if (curve.Segment2.Index == Locations[x]->Inters->C.Segment2.Index)
|
||||
{
|
||||
auto new_curve = curve.DivideAtTime(Locations[x]->Inters->Time);
|
||||
seg = new_curve.Segment1;
|
||||
}
|
||||
if (curve1.Segment2.Index == Locations[x]->C.Segment2.Index)
|
||||
{
|
||||
auto new_curve = curve1.DivideAtTime(Locations[x]->Time);
|
||||
seg = new_curve.Segment2;
|
||||
}
|
||||
if (curve1.Segment2.Index == Locations[x]->Inters->C.Segment2.Index)
|
||||
{
|
||||
auto new_curve = curve1.DivideAtTime(Locations[x]->Inters->Time);
|
||||
seg = new_curve.Segment2;
|
||||
}
|
||||
Result.CurveTo(seg.HI.X + seg.P.X, seg.HI.Y + seg.P.Y,
|
||||
seg.HO.X + seg.P.X, seg.HO.Y + seg.P.Y,
|
||||
seg.P.X, seg.P.Y);
|
||||
}
|
||||
else
|
||||
Result.LineTo(Segments1[ver].P.X, Segments1[ver].P.Y);
|
||||
|
||||
return ver;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
auto add_loc = [&](int x, int prev_x) {
|
||||
while (1)
|
||||
{
|
||||
for (int j = 0; j < adjMatr.size(); j++)
|
||||
{
|
||||
if (std::find(adjMatr[j].begin(), adjMatr[j].end(), x) != adjMatr[j].end())
|
||||
{
|
||||
if (loc_visited[j] == 2 || j == prev_x)
|
||||
continue;
|
||||
|
||||
if (j != i)
|
||||
loc_visited[j]++;
|
||||
auto ll = Locations[j];
|
||||
Curve curve;
|
||||
double t;
|
||||
if ((x == Curves1.size() - 1 ? 0 : x + 1) == ll->C.Segment2.Index)
|
||||
{
|
||||
curve = Curves1[x];
|
||||
t = ll->Time;
|
||||
}
|
||||
if ((x == Curves1.size() - 1 ? 0 : x + 1) == ll->Inters->C.Segment2.Index)
|
||||
{
|
||||
curve = Curves1[x];
|
||||
t = ll->Inters->Time;
|
||||
}
|
||||
if (x == ll->C.Segment2.Index)
|
||||
{
|
||||
curve = Curves1[x == 0 ? Curves1.size() - 1 : x - 1];
|
||||
t = ll->Time;
|
||||
}
|
||||
if (x == ll->Inters->C.Segment2.Index)
|
||||
{
|
||||
curve = Curves1[x == 0 ? Curves1.size() - 1 : x - 1];
|
||||
t = ll->Inters->Time;
|
||||
}
|
||||
if (curve.Segment2.IsCurve)
|
||||
{
|
||||
auto new_curve = curve.DivideAtTime(t);
|
||||
Result.CurveTo(new_curve.Segment1.HI.X + new_curve.Segment1.P.X, new_curve.Segment1.HI.Y + new_curve.Segment1.P.Y,
|
||||
new_curve.Segment1.HO.X + new_curve.Segment1.P.X, new_curve.Segment1.HO.Y + new_curve.Segment1.P.Y,
|
||||
new_curve.Segment1.P.X, new_curve.Segment1.P.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pt = curve.GetPoint(t);
|
||||
Result.LineTo(pt.X, pt.Y);
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
}
|
||||
x = (x >= Curves1.size() - 1) ? 0 : x + 1;
|
||||
prev_x = -1;
|
||||
if (Curves1[x].Segment2.IsCurve)
|
||||
Result.CurveTo(Curves1[x].Segment2.HI.X + Curves1[x].Segment2.P.X, Curves1[x].Segment2.HI.Y + Curves1[x].Segment2.P.Y,
|
||||
Curves1[x].Segment2.HO.X + Curves1[x].Segment2.P.X, Curves1[x].Segment2.HO.Y + Curves1[x].Segment2.P.Y,
|
||||
Curves1[x].Segment2.P.X, Curves1[x].Segment2.P.Y);
|
||||
else
|
||||
Result.LineTo(Curves1[x].Segment2.P.X, Curves1[x].Segment2.P.Y);
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
loc_visited[i]++;
|
||||
auto p = loc->C.GetPoint(loc->Time);
|
||||
Result.MoveTo(p.X, p.Y);
|
||||
int cur_seg = -1;
|
||||
int cur_loc = i;
|
||||
while (1)
|
||||
{
|
||||
cur_seg = add_seg(cur_loc, cur_seg);
|
||||
if (cur_seg == -1)
|
||||
break;
|
||||
cur_loc = add_loc(cur_seg, cur_loc);
|
||||
if (cur_loc == i || cur_loc == -1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Locations.size(); i++)
|
||||
{
|
||||
if (loc_visited[i] != 2)
|
||||
{
|
||||
loc_visited[i]++;
|
||||
auto p = Locations[i]->C.GetPoint(Locations[i]->Time);
|
||||
Result.MoveTo(p.X, p.Y);
|
||||
auto prev_loc = Locations[i];
|
||||
|
||||
auto add_loc = [&](std::shared_ptr<Location> l1, std::shared_ptr<Location> l2) {
|
||||
auto add_pt = [&](std::shared_ptr<Location> lc, std::shared_ptr<Location> prev){
|
||||
if (prev->C.Segment2.IsCurve)
|
||||
{
|
||||
auto new_curve = prev->C;
|
||||
double t1 = prev->Time;
|
||||
double t2 = lc->Time;
|
||||
if (t2 < t1)
|
||||
{
|
||||
new_curve.Flip();
|
||||
t1 = 1.0 - t1;
|
||||
t2 = 1.0 - t2;
|
||||
}
|
||||
new_curve = new_curve.DivideAtTime(t1);
|
||||
new_curve = new_curve.DivideAtTime((t2 - t1) / (1.0 - t1));
|
||||
|
||||
Result.CurveTo(new_curve.Segment1.HI.X + new_curve.Segment1.P.X, new_curve.Segment1.HI.Y + new_curve.Segment1.P.Y,
|
||||
new_curve.Segment1.HO.X + new_curve.Segment1.P.X, new_curve.Segment1.HO.Y + new_curve.Segment1.P.Y,
|
||||
new_curve.Segment1.P.X, new_curve.Segment1.P.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pt = lc->C.GetPoint(lc->Time);
|
||||
Result.LineTo(pt.X, pt.Y);
|
||||
}
|
||||
};
|
||||
|
||||
if (l1->C.Segment2.Index == l2->C.Segment2.Index)
|
||||
add_pt(l1, l2);
|
||||
else if (l1->C.Segment2.Index == l2->Inters->C.Segment2.Index)
|
||||
add_pt(l1, l2->Inters);
|
||||
else if (l1->Inters->C.Segment2.Index == l2->C.Segment2.Index)
|
||||
add_pt(l1->Inters, l2);
|
||||
else if (l1->Inters->C.Segment2.Index == l2->Inters->C.Segment2.Index)
|
||||
add_pt(l1->Inters, l2->Inters);
|
||||
};
|
||||
|
||||
for (int j = i + 1; j < Locations.size(); j++)
|
||||
{
|
||||
if (loc_visited[j] == 2)
|
||||
continue;
|
||||
|
||||
loc_visited[j]++;
|
||||
add_loc(Locations[j], prev_loc);
|
||||
prev_loc = Locations[j];
|
||||
}
|
||||
add_loc(Locations[i], prev_loc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Result.CloseFigure();
|
||||
|
||||
delete[] seg_visited;
|
||||
delete[] loc_visited;
|
||||
}
|
||||
|
||||
std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
|
||||
{
|
||||
std::vector<std::vector<double>> allBounds, bounds2;
|
||||
@ -1296,13 +1671,14 @@ std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
|
||||
|
||||
activeIndicesByPri2.erase(activeIndicesByPri2.begin(),
|
||||
activeIndicesByPri2.begin() + pruneCount);
|
||||
|
||||
for (int j = 0; j < static_cast<int>(activeIndicesByPri2.size()); j++)
|
||||
{
|
||||
bool isActive1 = activeIndicesByPri2[j] < length1,
|
||||
isActive2 = self || !isActive1,
|
||||
isActive1Or2 = (isCurrent1 && isActive2) || (isCurrent2 && isActive1),
|
||||
inRange1 = allBounds[allIdicesByPri1[i]][1] <= allBounds[activeIndicesByPri2[j]][3] + GEOMETRIC_EPSILON,
|
||||
inRange2 = allBounds[allIdicesByPri1[i]][3] >= allBounds[activeIndicesByPri2[j]][1] - GEOMETRIC_EPSILON;
|
||||
isActive2 = self || !isActive1,
|
||||
isActive1Or2 = (isCurrent1 && isActive2) || (isCurrent2 && isActive1),
|
||||
inRange1 = allBounds[allIdicesByPri1[i]][1] <= allBounds[activeIndicesByPri2[j]][3] + GEOMETRIC_EPSILON,
|
||||
inRange2 = allBounds[allIdicesByPri1[i]][3] >= allBounds[activeIndicesByPri2[j]][1] - GEOMETRIC_EPSILON;
|
||||
|
||||
if (isActive1Or2 && (inRange2 && inRange1))
|
||||
{
|
||||
@ -1314,10 +1690,7 @@ std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
|
||||
}
|
||||
}
|
||||
if (isCurrent1)
|
||||
{
|
||||
if (self) curCollisions.push_back(allIdicesByPri1[i]);
|
||||
allCollisions[allIdicesByPri1[i]] = curCollisions;
|
||||
}
|
||||
if (activeIndicesByPri2.size() > 0)
|
||||
{
|
||||
int index = 1 + binarySearch(allBounds, activeIndicesByPri2, 2, allBounds[allIdicesByPri1[i]][2]);
|
||||
@ -1327,8 +1700,23 @@ std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
|
||||
activeIndicesByPri2.push_back(allIdicesByPri1[i]);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
std::vector<std::vector<int>> erase_ver(length1);
|
||||
for (auto& c : allCollisions)
|
||||
{
|
||||
std::sort(c.begin(), c.end());
|
||||
if (self)
|
||||
{
|
||||
c.erase(std::remove(c.begin(), c.end(), index), c.end());
|
||||
c.erase(std::remove(c.begin(), c.end(), index == allLength - 1 ? 0 : index + 1), c.end());
|
||||
c.erase(std::remove(c.begin(), c.end(), index == 0 ? allLength - 1 : index - 1), c.end());
|
||||
for (const auto& ind : erase_ver[index])
|
||||
c.erase(std::remove(c.begin(), c.end(), ind), c.end());
|
||||
for (const auto& ind : c)
|
||||
erase_ver[ind].push_back(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return allCollisions;
|
||||
}
|
||||
@ -1888,6 +2276,12 @@ bool CBooleanOperations::AllInters(const std::vector<Segment>& segments) const n
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBooleanOperations::IsOneCurvePath(int pathIndex) const noexcept
|
||||
{
|
||||
return Locations.size() == 4 && pathIndex == 1 ? (OriginCurves1.size() == 1 && OriginCurves2.size() != 1)
|
||||
: (OriginCurves2.size() == 1 && OriginCurves1.size() != 1);
|
||||
}
|
||||
|
||||
void CBooleanOperations::AddLocation(Curve curve1, Curve curve2, double t1,
|
||||
double t2, bool overlap, bool filter, bool ends)
|
||||
{
|
||||
@ -1928,6 +2322,29 @@ void CBooleanOperations::AddOffsets(std::vector<double>& offsets,
|
||||
offsets.push_back(count != 0 ? offset : offset / 32);
|
||||
}
|
||||
|
||||
bool CBooleanOperations::CheckLocation(std::shared_ptr<Location> loc, bool start) const noexcept
|
||||
{
|
||||
for (const auto& l : Locations)
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
if (l->C.Segment1.Index == loc->C.Segment1.Index && l->Time != loc->Time)
|
||||
return loc->Time < l->Time;
|
||||
if (l->Inters->C.Segment1.Index == loc->C.Segment1.Index && l->Inters->Time != loc->Time)
|
||||
return loc->Time < l->Inters->Time;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (l->C.Segment2.Index == loc->C.Segment2.Index && l->Time != loc->Time)
|
||||
return loc->Time > l->Time;
|
||||
if (l->Inters->C.Segment2.Index == loc->C.Segment2.Index && l->Inters->Time != loc->Time)
|
||||
return loc->Time > l->Inters->Time;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1,
|
||||
const CGraphicsPath& path2,
|
||||
BooleanOpType op,
|
||||
@ -1937,21 +2354,54 @@ CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1,
|
||||
std::vector<CGraphicsPath> paths1 = path1.GetSubPaths(),
|
||||
paths2 = path2.GetSubPaths(),
|
||||
paths;
|
||||
|
||||
for (const auto& p1 : paths1)
|
||||
int skip_end1 = -1;
|
||||
for (size_t i = 0; i < paths2.size(); i++)
|
||||
{
|
||||
for (const auto& p2 : paths2)
|
||||
int skip_end2 = -1;
|
||||
CBooleanOperations o;
|
||||
if (i > skip_end2 && o.IsSelfInters(paths2[i]))
|
||||
{
|
||||
CBooleanOperations operation(p1, p2, op, fillType, isLuminosity);
|
||||
CBooleanOperations operation(paths2[i], paths2[i], Intersection, fillType, isLuminosity, true);
|
||||
CGraphicsPath p = std::move(operation.GetResult());
|
||||
|
||||
std::vector<CGraphicsPath> tmp_paths = p.GetSubPaths();
|
||||
paths2[i] = tmp_paths[0];
|
||||
skip_end2 = i + tmp_paths.size() - 1;
|
||||
for (size_t k = 1; k < tmp_paths.size(); k++)
|
||||
paths2.insert(paths2.begin() + i + k, tmp_paths[k]);
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < paths1.size(); j++)
|
||||
{
|
||||
CBooleanOperations o2;
|
||||
if (j > skip_end1 && o2.IsSelfInters(paths1[j]))
|
||||
{
|
||||
CBooleanOperations operation(paths1[j], paths1[j], Intersection, fillType, isLuminosity, true);
|
||||
CGraphicsPath p = std::move(operation.GetResult());
|
||||
|
||||
std::vector<CGraphicsPath> tmp_paths = p.GetSubPaths();
|
||||
paths1[j] = tmp_paths[0];
|
||||
skip_end1 = j + tmp_paths.size() - 1;
|
||||
for (size_t k = 1; k < tmp_paths.size(); k++)
|
||||
paths1.insert(paths1.begin() + i + k, tmp_paths[k]);
|
||||
}
|
||||
|
||||
CBooleanOperations operation(paths1[j], paths2[i], op, fillType, isLuminosity, false);
|
||||
paths.push_back(operation.GetResult());
|
||||
}
|
||||
|
||||
if (op == Subtraction)
|
||||
{
|
||||
paths1 = CGraphicsPath(paths).GetSubPaths();
|
||||
paths.clear();
|
||||
}
|
||||
}
|
||||
|
||||
return CGraphicsPath(paths);
|
||||
return op == Subtraction ? CGraphicsPath(paths1) : CGraphicsPath(paths);
|
||||
}
|
||||
|
||||
//For unit-tests
|
||||
bool CGraphicsPath::operator==(const CGraphicsPath& other) noexcept
|
||||
// For Unit-tests
|
||||
bool CGraphicsPath::Equals(const CGraphicsPath& other) noexcept
|
||||
{
|
||||
unsigned pointsCount = GetPointCount(),
|
||||
otherPointsCount = other.GetPointCount();
|
||||
@ -1960,7 +2410,7 @@ bool CGraphicsPath::operator==(const CGraphicsPath& other) noexcept
|
||||
return false;
|
||||
|
||||
std::vector<PointD> points = GetPoints(0, pointsCount),
|
||||
otherPoints = other.GetPoints(0, otherPointsCount);
|
||||
otherPoints = other.GetPoints(0, otherPointsCount);
|
||||
|
||||
for (unsigned i = 0; i < pointsCount; i++)
|
||||
if (getDistance(points[i], otherPoints[i]) > POINT_EPSILON)
|
||||
|
||||
@ -107,15 +107,19 @@ namespace Aggplus
|
||||
class CBooleanOperations
|
||||
{
|
||||
public:
|
||||
CBooleanOperations(const CGraphicsPath& path1, const CGraphicsPath& path2, BooleanOpType op, long fillType, bool isLuminosity);
|
||||
CBooleanOperations() {};
|
||||
CBooleanOperations(const CGraphicsPath& path1, const CGraphicsPath& path2, BooleanOpType op, long fillType, bool isLuminosity, bool isSelf);
|
||||
~CBooleanOperations();
|
||||
CGraphicsPath&& GetResult();
|
||||
bool IsSelfInters(const CGraphicsPath& p);
|
||||
|
||||
// BooleanOp
|
||||
void TraceBoolean();
|
||||
void TraceOneInters();
|
||||
void TraceAllOverlap();
|
||||
void TracePaths();
|
||||
void TraceOneCurvePath1();
|
||||
void TraceOneCurvePath2();
|
||||
|
||||
// Path
|
||||
void PreparePath(const CGraphicsPath& path, int id, std::vector<Segment>& segments,
|
||||
@ -127,6 +131,7 @@ namespace Aggplus
|
||||
Segment GetPreviousSegment(const Segment& segment) const noexcept;
|
||||
Segment GetNextSegment(const Segment& segment) const noexcept;
|
||||
void SetVisited(const Segment& segment);
|
||||
void CreateNewPath(const std::vector<std::vector<int>>& adjMatr) noexcept;
|
||||
|
||||
// Bounds
|
||||
std::vector<std::vector<int>> FindBoundsCollisions();
|
||||
@ -151,7 +156,9 @@ namespace Aggplus
|
||||
void InsertLocation(std::shared_ptr<Location> loc, bool overlap);
|
||||
bool AllOverlap() const noexcept;
|
||||
bool AllInters(const std::vector<Segment>& segments) const noexcept;
|
||||
bool IsOneCurvePath(int pathIndex) const noexcept;
|
||||
void AddOffsets(std::vector<double>& offsets, const Curve& curve, bool end);
|
||||
bool CheckLocation(std::shared_ptr<Location> loc, bool start) const noexcept;
|
||||
|
||||
private:
|
||||
BooleanOpType Op = Intersection;
|
||||
@ -159,13 +166,14 @@ namespace Aggplus
|
||||
bool Close1 = true;
|
||||
bool Close2 = true;
|
||||
bool IsLuminosity = false;
|
||||
bool IsSelf = false;
|
||||
|
||||
// c_nStroke, c_nWindingFillMode, c_nEvenOddFillMode
|
||||
long FillType = c_nWindingFillMode;
|
||||
|
||||
CGraphicsPath Path1;
|
||||
CGraphicsPath Path2;
|
||||
CGraphicsPath Result;
|
||||
CGraphicsPath Path1{};
|
||||
CGraphicsPath Path2{};
|
||||
CGraphicsPath Result{};
|
||||
|
||||
std::vector<Segment> Segments1;
|
||||
std::vector<Segment> Segments2;
|
||||
|
||||
@ -2144,7 +2144,12 @@ namespace Aggplus
|
||||
agg::trans_affine* full_trans = &m_oFullTransform.m_internal->m_agg_mtx;
|
||||
double dDet = full_trans->determinant();
|
||||
|
||||
if (fabs(dDet) < 0.0001)
|
||||
double sx = sqrt(full_trans->sx * full_trans->sx + full_trans->shx * full_trans->shx);
|
||||
double sy = sqrt(full_trans->shy * full_trans->shy + full_trans->sy * full_trans->sy);
|
||||
double scale = std::max(sx, sy);
|
||||
double adaptive_threshold = 1.0 / (scale * scale * 10000.0);
|
||||
|
||||
if (fabs(dDet) < std::max(0.0001, adaptive_threshold))
|
||||
{
|
||||
path_copy.transform_all_paths(m_oFullTransform.m_internal->m_agg_mtx);
|
||||
dWidth *= sqrt(fabs(dDet));
|
||||
@ -2242,6 +2247,8 @@ namespace Aggplus
|
||||
LONG lCount2 = lCount / 2;
|
||||
|
||||
double dKoef = 1.0;
|
||||
if (bIsUseIdentity)
|
||||
dKoef = sqrt(fabs(m_oFullTransform.m_internal->m_agg_mtx.determinant()));
|
||||
|
||||
for (LONG i = 0; i < lCount2; ++i)
|
||||
{
|
||||
|
||||
@ -76,7 +76,7 @@ namespace Aggplus
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
if (p.Is_poly_closed()) CloseFigure();
|
||||
//if (p.Is_poly_closed()) CloseFigure();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -262,6 +262,25 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps.line_to(x + width, y);
|
||||
m_internal->m_agg_ps.line_to(x + width, y + height);
|
||||
m_internal->m_agg_ps.line_to(x, y + height);
|
||||
m_internal->m_agg_ps.line_to(x, y);
|
||||
m_internal->m_agg_ps.close_polygon();
|
||||
return Ok;
|
||||
}
|
||||
Status CGraphicsPath::AddRoundRectangle(double x, double y, double width, double height, double cx, double cy)
|
||||
{
|
||||
m_internal->m_agg_ps.move_to(x + cx, y);
|
||||
m_internal->m_agg_ps.line_to(x + width - cx, y);
|
||||
agg::bezier_arc arc1(x + width - cx, y + cy, cx, cy, -agg::pi / 2.0, agg::pi / 2.0);
|
||||
m_internal->m_agg_ps.join_path(arc1, 0);
|
||||
m_internal->m_agg_ps.line_to(x + width, y + height - cy);
|
||||
agg::bezier_arc arc2(x + width - cx, y + height - cy, cx, cy, 0.0, agg::pi / 2.0);
|
||||
m_internal->m_agg_ps.join_path(arc2, 0);
|
||||
m_internal->m_agg_ps.line_to(x + cx, y + height);
|
||||
agg::bezier_arc arc3(x + cx, y + height - cy, cx, cy, agg::pi / 2.0, agg::pi / 2.0);
|
||||
m_internal->m_agg_ps.join_path(arc3, 0);
|
||||
m_internal->m_agg_ps.line_to(x, y + cy);
|
||||
agg::bezier_arc arc4(x + cx, y + cy, cx, cy, agg::pi, agg::pi / 2.0);
|
||||
m_internal->m_agg_ps.join_path(arc4, 0);
|
||||
m_internal->m_agg_ps.close_polygon();
|
||||
return Ok;
|
||||
}
|
||||
@ -867,17 +886,17 @@ namespace Aggplus
|
||||
if (isCurve)
|
||||
{
|
||||
std::vector<PointD> points = GetPoints(idx, 4);
|
||||
area = (points[3].Y - points[0].Y) * (points[1].X + points[2].X)
|
||||
- (points[3].X - points[0].X) * (points[1].Y + points[2].Y)
|
||||
+ points[1].Y * (points[0].X - points[2].X)
|
||||
- points[1].X * (points[0].Y - points[2].Y)
|
||||
+ points[3].Y * (points[2].X + points[0].X / 3.0)
|
||||
- points[3].X * (points[2].Y + points[0].Y / 3.0);
|
||||
area = 3.0 * ((points[3].Y - points[0].Y) * (points[1].X + points[2].X)
|
||||
- (points[3].X - points[0].X) * (points[1].Y + points[2].Y)
|
||||
+ points[1].Y * (points[0].X - points[2].X)
|
||||
- points[1].X * (points[0].Y - points[2].Y)
|
||||
+ points[3].Y * (points[2].X + points[0].X / 3.0)
|
||||
- points[3].X * (points[2].Y + points[0].Y / 3.0)) / 20.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<PointD> points = GetPoints(idx, 2);
|
||||
area = 4.0 * (points[1].Y * points[0].X - points[1].X * points[0].Y) / 3.0;
|
||||
area = (points[1].Y * points[0].X - points[1].X * points[0].Y) / 2.0;
|
||||
}
|
||||
|
||||
return area;
|
||||
@ -898,14 +917,11 @@ namespace Aggplus
|
||||
PointD firstPoint = subPath.GetPoints(0, 1)[0];
|
||||
double x, y;
|
||||
subPath.GetLastPoint(x, y);
|
||||
if ((abs(firstPoint.X - x) <= 1e-2 && abs(firstPoint.Y - y) <= 1e-2) ||
|
||||
if ((abs(firstPoint.X - x) >= 1e-2 || abs(firstPoint.Y - y) >= 1e-2) ||
|
||||
subPath.GetPointCount() == 1)
|
||||
{
|
||||
if (!firstPoint.Equals(PointD(x, y)) || subPath.GetPointCount() == 1)
|
||||
subPath.LineTo(firstPoint.X, firstPoint.Y);
|
||||
subPath.CloseFigure();
|
||||
}
|
||||
subPath.LineTo(firstPoint.X, firstPoint.Y);
|
||||
|
||||
subPath.CloseFigure();
|
||||
result.push_back(subPath);
|
||||
subPath.Reset();
|
||||
}
|
||||
@ -933,7 +949,7 @@ namespace Aggplus
|
||||
double x, y;
|
||||
subPath.GetLastPoint(x, y);
|
||||
|
||||
if (!firstPoint.Equals(PointD(x, y)) || subPath.GetPointCount() == 1)
|
||||
if ((abs(firstPoint.X - x) >= 1e-2 || abs(firstPoint.Y - y) >= 1e-2) || subPath.GetPointCount() == 1)
|
||||
subPath.LineTo(firstPoint.X, firstPoint.Y);
|
||||
|
||||
subPath.CloseFigure();
|
||||
@ -987,6 +1003,26 @@ namespace Aggplus
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool CGraphicsPath::operator==(const CGraphicsPath& other) noexcept
|
||||
{
|
||||
unsigned pointsCount = GetPointCount(),
|
||||
otherPointsCount = other.GetPointCount();
|
||||
|
||||
if (pointsCount != otherPointsCount)
|
||||
return false;
|
||||
|
||||
std::vector<PointD> points = GetPoints(0, pointsCount),
|
||||
otherPoints = other.GetPoints(0, otherPointsCount);
|
||||
|
||||
bool reverse = IsClockwise() ^ other.IsClockwise();
|
||||
|
||||
for (unsigned i = 0; i < pointsCount; i++)
|
||||
if (!points[i].Equals(otherPoints[reverse ? pointsCount - i - 1 : i]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Aggplus
|
||||
|
||||
@ -72,6 +72,7 @@ namespace Aggplus
|
||||
Status AddCurve(double* pPoints, int nCount);
|
||||
Status AddEllipse(double x, double y, double width, double height);
|
||||
Status AddRectangle(double x, double y, double width, double height);
|
||||
Status AddRoundRectangle(double x, double y, double width, double height, double cx, double cy);
|
||||
Status AddPolygon(double* pPoints, int nCount);
|
||||
Status AddPath(const CGraphicsPath& oPath);
|
||||
Status AddArc(double x, double y, double width, double height, double startAngle, double sweepAngle);
|
||||
@ -116,6 +117,7 @@ namespace Aggplus
|
||||
std::vector<PointD> GetPoints(unsigned idx, unsigned count) const noexcept;
|
||||
std::vector<CGraphicsPath> GetSubPaths() const;
|
||||
|
||||
bool Equals(const CGraphicsPath& other) noexcept;
|
||||
CGraphicsPath& operator=(const CGraphicsPath& other) noexcept;
|
||||
CGraphicsPath& operator=(CGraphicsPath&& other) noexcept;
|
||||
bool operator==(const CGraphicsPath& other) noexcept;
|
||||
|
||||
@ -117,6 +117,7 @@ const long c_nDarkMode = 0x0008;
|
||||
const long c_nUseDictionaryFonts = 0x0010;
|
||||
const long c_nPenWidth0As1px = 0x0020;
|
||||
const long c_nSupportPathTextAsText = 0x0040;
|
||||
const long c_nFontSubstitution = 0x0080;
|
||||
|
||||
// типы рендерера
|
||||
const long c_nUnknownRenderer = 0x0000;
|
||||
@ -156,6 +157,7 @@ public:
|
||||
PageClear = 9,
|
||||
PageRotate = 10,
|
||||
Headings = 11,
|
||||
Redact = 12,
|
||||
|
||||
Undefined = 255
|
||||
};
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#include "../fontengine/FontManager.h"
|
||||
#include "../raster/BgraFrame.h"
|
||||
#include "../common/StringExt.h"
|
||||
#include "../GraphicsPath.h"
|
||||
#include "GraphicsPath.h"
|
||||
|
||||
// этот класс нужно переписать. должно работать как и в js
|
||||
// а не просто на каждом символе переключаться, если нужно
|
||||
@ -389,6 +389,8 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(c_nPathType);
|
||||
}
|
||||
bIsPathOpened = false;
|
||||
@ -633,6 +635,8 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(c_nPathType);
|
||||
}
|
||||
|
||||
@ -679,6 +683,8 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(c_nPathType);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
@ -855,6 +861,8 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
@ -868,8 +876,13 @@ namespace NSOnlineOfficeBinToPdf
|
||||
pRenderer->EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
pRenderer->EndCommand((DWORD)(oReader.ReadInt()));
|
||||
int nCommand = oReader.ReadInt();
|
||||
if (path.GetPointCount() && nCommand == c_nClipType)
|
||||
pRenderer->AddPath(path);
|
||||
pRenderer->EndCommand((DWORD)nCommand);
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
break;
|
||||
}
|
||||
case ctGradientFill:
|
||||
@ -1042,6 +1055,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
case ctPageClear:
|
||||
case ctPageRotate:
|
||||
case ctHeadings:
|
||||
case ctRedact:
|
||||
{
|
||||
IAdvancedCommand::AdvancedCommandType eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::Undefined;
|
||||
switch (eCommand)
|
||||
@ -1055,6 +1069,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
case ctPageClear: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::PageClear; break;
|
||||
case ctPageRotate: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::PageRotate; break;
|
||||
case ctHeadings: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::Headings; break;
|
||||
case ctRedact: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::Redact; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1065,7 +1080,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if ((IAdvancedCommand::AdvancedCommandType::Undefined != eAdvancedCommandType) &&
|
||||
(S_OK == pRenderer->IsSupportAdvancedCommand(eAdvancedCommandType)))
|
||||
{
|
||||
IAdvancedCommand* pCommand = oReader.Read(eCommand, pCorrector);
|
||||
IAdvancedCommand* pCommand = oReader.Read(eCommand, pCorrector, nLen);
|
||||
if (pCommand)
|
||||
{
|
||||
pRenderer->AdvancedCommand(pCommand);
|
||||
|
||||
@ -188,6 +188,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
ctShapeStart = 167,
|
||||
ctShapeEnd = 168,
|
||||
ctHeadings = 169,
|
||||
ctRedact = 170,
|
||||
|
||||
ctPageWidth = 200,
|
||||
ctPageHeight = 201,
|
||||
|
||||
@ -46,8 +46,16 @@ namespace NSOnlineOfficeBinToPdf
|
||||
RELEASEOBJECT(command);
|
||||
return command;
|
||||
}
|
||||
template<typename T>
|
||||
inline IAdvancedCommand* Read_Command_Len(CBufferReader* pReader, IMetafileToRenderter* pCorrector, int nLen)
|
||||
{
|
||||
T* command = new T();
|
||||
if (!command->Read(pReader, pCorrector, nLen))
|
||||
RELEASEOBJECT(command);
|
||||
return command;
|
||||
}
|
||||
|
||||
IAdvancedCommand* CBufferReader::Read(int type, IMetafileToRenderter* pCorrector)
|
||||
IAdvancedCommand* CBufferReader::Read(int type, IMetafileToRenderter* pCorrector, int nLen)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -58,11 +66,12 @@ namespace NSOnlineOfficeBinToPdf
|
||||
case ctFormField: return Read_Command<CFormFieldInfo> (this, pCorrector);
|
||||
case ctAnnotFieldDelete: return Read_Command<CAnnotFieldDelete>(this, pCorrector);
|
||||
case ctWidgetsInfo: return Read_Command<CWidgetsInfo> (this, pCorrector);
|
||||
case ctShapeStart: return Read_Command<CShapeStart> (this, pCorrector);
|
||||
case ctShapeStart: return Read_Command_Len<CShapeStart> (this, pCorrector, nLen);
|
||||
case ctShapeEnd: return new CEmptyComand(IAdvancedCommand::AdvancedCommandType::ShapeEnd);
|
||||
case ctPageClear: return new CEmptyComand(IAdvancedCommand::AdvancedCommandType::PageClear);
|
||||
case ctPageRotate: return Read_Command<CPageRotate> (this, pCorrector);
|
||||
case ctHeadings: return Read_Command<CHeadings> (this, pCorrector);
|
||||
case ctRedact: return Read_Command<CRedact> (this, pCorrector);
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
@ -190,8 +190,12 @@ namespace NSOnlineOfficeBinToPdf
|
||||
int len = 2 * ReadUShort();
|
||||
SkipString16(len);
|
||||
}
|
||||
inline int Tell()
|
||||
{
|
||||
return (int)(m_cur - m_buffer);
|
||||
}
|
||||
|
||||
IAdvancedCommand* Read(int type, IMetafileToRenderter* pCorrector);
|
||||
IAdvancedCommand* Read(int type, IMetafileToRenderter* pCorrector, int nLen = 0);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -226,7 +226,6 @@ public:
|
||||
|
||||
return *this;
|
||||
};
|
||||
|
||||
public:
|
||||
T X, Y, Width, Height;
|
||||
};
|
||||
|
||||
@ -46,6 +46,92 @@
|
||||
// void Set(const std::wstring& ws) { m_ws = ws; }
|
||||
// const std::wstring& Get() { return m_ws; }
|
||||
|
||||
CAnnotFieldInfo::CActionFieldPr* ReadAction(NSOnlineOfficeBinToPdf::CBufferReader* pReader)
|
||||
{
|
||||
CAnnotFieldInfo::CActionFieldPr* pRes = new CAnnotFieldInfo::CActionFieldPr();
|
||||
|
||||
pRes->nActionType = pReader->ReadByte();
|
||||
switch (pRes->nActionType)
|
||||
{
|
||||
case 14: // JavaScript
|
||||
{
|
||||
pRes->wsStr1 = pReader->ReadString();
|
||||
break;
|
||||
}
|
||||
case 1: // GoTo
|
||||
{
|
||||
pRes->nInt1 = pReader->ReadInt();
|
||||
pRes->nKind = pReader->ReadByte();
|
||||
switch (pRes->nKind)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
case 7:
|
||||
{
|
||||
pRes->nFlags = pReader->ReadByte();
|
||||
if (pRes->nFlags & (1 << 0))
|
||||
pRes->dD[0] = pReader->ReadDouble();
|
||||
if (pRes->nFlags & (1 << 1))
|
||||
pRes->dD[1] = pReader->ReadDouble();
|
||||
if (pRes->nFlags & (1 << 2))
|
||||
pRes->dD[2] = pReader->ReadDouble();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
pRes->dD[0] = pReader->ReadDouble();
|
||||
pRes->dD[1] = pReader->ReadDouble();
|
||||
pRes->dD[2] = pReader->ReadDouble();
|
||||
pRes->dD[3] = pReader->ReadDouble();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 5:
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: // Named
|
||||
{
|
||||
pRes->wsStr1 = pReader->ReadString();
|
||||
break;
|
||||
}
|
||||
case 6: // URI
|
||||
{
|
||||
pRes->wsStr1 = pReader->ReadString();
|
||||
break;
|
||||
}
|
||||
case 9: // Hide
|
||||
{
|
||||
pRes->nKind = pReader->ReadByte();
|
||||
int n = pReader->ReadInt();
|
||||
pRes->arrStr.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pRes->arrStr.push_back(pReader->ReadString());
|
||||
break;
|
||||
}
|
||||
case 12: // ResetForm
|
||||
{
|
||||
pRes->nInt1 = pReader->ReadInt();
|
||||
int n = pReader->ReadInt();
|
||||
pRes->arrStr.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pRes->arrStr.push_back(pReader->ReadString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pReader->ReadByte())
|
||||
pRes->pNext = ReadAction(pReader);
|
||||
|
||||
return pRes;
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annotaion)
|
||||
{
|
||||
m_nType = EAnnotType::Unknown;
|
||||
@ -76,6 +162,8 @@ CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annot
|
||||
m_pFreeTextPr = NULL;
|
||||
m_pCaretPr = NULL;
|
||||
m_pStampPr = NULL;
|
||||
m_pRedactPr = NULL;
|
||||
m_pLinkPr = NULL;
|
||||
m_pWidgetPr = NULL;
|
||||
}
|
||||
CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
@ -91,6 +179,8 @@ CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
RELEASEOBJECT(m_pFreeTextPr);
|
||||
RELEASEOBJECT(m_pCaretPr);
|
||||
RELEASEOBJECT(m_pStampPr);
|
||||
RELEASEOBJECT(m_pRedactPr);
|
||||
RELEASEOBJECT(m_pLinkPr);
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
}
|
||||
|
||||
@ -111,6 +201,12 @@ void CAnnotFieldInfo::SetType(int nType)
|
||||
m_pTextPr = new CAnnotFieldInfo::CTextAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Link:
|
||||
{
|
||||
RELEASEOBJECT(m_pLinkPr);
|
||||
m_pLinkPr = new CAnnotFieldInfo::CLinkAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::FreeText:
|
||||
{
|
||||
CreateMarkup();
|
||||
@ -178,6 +274,13 @@ void CAnnotFieldInfo::SetType(int nType)
|
||||
m_pPopupPr = new CAnnotFieldInfo::CPopupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Redact:
|
||||
{
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pRedactPr);
|
||||
m_pRedactPr = new CAnnotFieldInfo::CRedactAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Widget:
|
||||
case EAnnotType::WidgetPushButton:
|
||||
case EAnnotType::WidgetRadioButton:
|
||||
@ -292,6 +395,14 @@ bool CAnnotFieldInfo::IsStamp() const
|
||||
{
|
||||
return (m_nType == 12);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsRedact() const
|
||||
{
|
||||
return (m_nType == 25);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsLink() const
|
||||
{
|
||||
return (m_nType == 1);
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CMarkupAnnotPr* CAnnotFieldInfo::GetMarkupAnnotPr() { return m_pMarkupPr; }
|
||||
CAnnotFieldInfo::CTextAnnotPr* CAnnotFieldInfo::GetTextAnnotPr() { return m_pTextPr; }
|
||||
@ -304,6 +415,8 @@ CAnnotFieldInfo::CPopupAnnotPr* CAnnotFieldInfo::GetPopupAnnotPr()
|
||||
CAnnotFieldInfo::CFreeTextAnnotPr* CAnnotFieldInfo::GetFreeTextAnnotPr() { return m_pFreeTextPr; }
|
||||
CAnnotFieldInfo::CCaretAnnotPr* CAnnotFieldInfo::GetCaretAnnotPr() { return m_pCaretPr; }
|
||||
CAnnotFieldInfo::CStampAnnotPr* CAnnotFieldInfo::GetStampAnnotPr() { return m_pStampPr; }
|
||||
CAnnotFieldInfo::CRedactAnnotPr* CAnnotFieldInfo::GetRedactAnnotPr() { return m_pRedactPr; }
|
||||
CAnnotFieldInfo::CLinkAnnotPr* CAnnotFieldInfo::GetLinkAnnotPr() { return m_pLinkPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr* CAnnotFieldInfo::GetWidgetAnnotPr() { return m_pWidgetPr; }
|
||||
|
||||
bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
@ -391,11 +504,15 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_pCaretPr->Read(pReader, nFlags);
|
||||
else if (IsStamp())
|
||||
m_pStampPr->Read(pReader, nFlags);
|
||||
else if (IsRedact())
|
||||
m_pRedactPr->Read(pReader, nFlags);
|
||||
}
|
||||
else if (IsPopup())
|
||||
m_pPopupPr->Read(pReader);
|
||||
else if (IsWidget())
|
||||
m_pWidgetPr->Read(pReader, nType);
|
||||
else if (IsLink())
|
||||
m_pLinkPr->Read(pReader);
|
||||
|
||||
return m_nType != -1;
|
||||
}
|
||||
@ -665,6 +782,85 @@ void CAnnotFieldInfo::CStampAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
m_dInRect[3] = pReader->ReadDouble();
|
||||
}
|
||||
|
||||
BYTE CAnnotFieldInfo::CRedactAnnotPr::GetQ() const { return m_nQ; }
|
||||
int CAnnotFieldInfo::CRedactAnnotPr::GetFontStyle() const { return m_nFontStyle; }
|
||||
double CAnnotFieldInfo::CRedactAnnotPr::GetFontSize() const { return m_dFS; }
|
||||
const std::wstring& CAnnotFieldInfo::CRedactAnnotPr::GetFontName() { return m_wsFN; }
|
||||
const std::wstring& CAnnotFieldInfo::CRedactAnnotPr::GetOverlayText() { return m_wsOverlayText; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CRedactAnnotPr::GetIC() { return m_arrIC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CRedactAnnotPr::GetFontColor() { return m_arrFC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CRedactAnnotPr::GetQuadPoints() { return m_arrQuadPoints; }
|
||||
void CAnnotFieldInfo::CRedactAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags)
|
||||
{
|
||||
if (nFlags & (1 << 15))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrQuadPoints.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrIC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrIC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (nFlags & (1 << 17))
|
||||
m_wsOverlayText = pReader->ReadString();
|
||||
if (nFlags & (1 << 19))
|
||||
m_nQ = pReader->ReadByte();
|
||||
if (nFlags & (1 << 20))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrFC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrFC.push_back(pReader->ReadDouble());
|
||||
m_dFS = pReader->ReadDouble();
|
||||
m_wsFN = pReader->ReadString();
|
||||
m_nFontStyle = pReader->ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CLinkAnnotPr::CLinkAnnotPr()
|
||||
{
|
||||
m_pAction = NULL;
|
||||
m_pPA = NULL;
|
||||
}
|
||||
CAnnotFieldInfo::CLinkAnnotPr::~CLinkAnnotPr()
|
||||
{
|
||||
RELEASEOBJECT(m_pAction);
|
||||
RELEASEOBJECT(m_pPA);
|
||||
}
|
||||
BYTE CAnnotFieldInfo::CLinkAnnotPr::GetH() const { return m_nH; }
|
||||
int CAnnotFieldInfo::CLinkAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CLinkAnnotPr::GetQuadPoints() { return m_arrQuadPoints; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetA() { return m_pAction; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetPA() { return m_pPA; }
|
||||
void CAnnotFieldInfo::CLinkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader)
|
||||
{
|
||||
m_nFlags = pReader->ReadInt();
|
||||
if (m_nFlags & (1 << 0))
|
||||
{
|
||||
pReader->ReadString();
|
||||
m_pAction = ReadAction(pReader);
|
||||
}
|
||||
if (m_nFlags & (1 << 1))
|
||||
{
|
||||
pReader->ReadString();
|
||||
m_pPA = ReadAction(pReader);
|
||||
}
|
||||
if (m_nFlags & (1 << 2))
|
||||
m_nH = pReader->ReadByte();
|
||||
if (m_nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrQuadPoints.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
}
|
||||
|
||||
bool CAnnotFieldInfo::CPopupAnnotPr::IsOpen() const { return m_bOpen; }
|
||||
int CAnnotFieldInfo::CPopupAnnotPr::GetFlag() const { return m_nFlag; }
|
||||
int CAnnotFieldInfo::CPopupAnnotPr::GetParentID() const { return m_nParentID; }
|
||||
@ -696,7 +892,7 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontKey() { return m_w
|
||||
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetTC() { return m_arrTC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBC() { return m_arrBC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBG() { return m_arrBG; }
|
||||
const std::vector<CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget*>& CAnnotFieldInfo::CWidgetAnnotPr::GetActions() { return m_arrAction; }
|
||||
const std::vector<CAnnotFieldInfo::CActionFieldPr*>& CAnnotFieldInfo::CWidgetAnnotPr::GetActions() { return m_arrAction; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr* CAnnotFieldInfo::CWidgetAnnotPr::GetButtonWidgetPr() { return m_pButtonPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CTextWidgetPr* CAnnotFieldInfo::CWidgetAnnotPr::GetTextWidgetPr() { return m_pTextPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr* CAnnotFieldInfo::CWidgetAnnotPr::GetChoiceWidgetPr() { return m_pChoicePr; }
|
||||
@ -756,93 +952,8 @@ CAnnotFieldInfo::CWidgetAnnotPr::~CWidgetAnnotPr()
|
||||
RELEASEOBJECT(m_arrAction[i]);
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget::CActionWidget() : pNext(NULL) {}
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget::~CActionWidget() { RELEASEOBJECT(pNext); }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPdf::CBufferReader* pReader)
|
||||
{
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* pRes = new CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget();
|
||||
|
||||
pRes->nActionType = pReader->ReadByte();
|
||||
switch (pRes->nActionType)
|
||||
{
|
||||
case 14: // JavaScript
|
||||
{
|
||||
pRes->wsStr1 = pReader->ReadString();
|
||||
break;
|
||||
}
|
||||
case 1: // GoTo
|
||||
{
|
||||
pRes->nInt1 = pReader->ReadInt();
|
||||
pRes->nKind = pReader->ReadByte();
|
||||
switch (pRes->nKind)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
case 7:
|
||||
{
|
||||
pRes->nFlags = pReader->ReadByte();
|
||||
if (pRes->nFlags & (1 << 0))
|
||||
pRes->dD[0] = pReader->ReadDouble();
|
||||
if (pRes->nFlags & (1 << 1))
|
||||
pRes->dD[1] = pReader->ReadDouble();
|
||||
if (pRes->nFlags & (1 << 2))
|
||||
pRes->dD[2] = pReader->ReadDouble();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
pRes->dD[0] = pReader->ReadDouble();
|
||||
pRes->dD[1] = pReader->ReadDouble();
|
||||
pRes->dD[2] = pReader->ReadDouble();
|
||||
pRes->dD[3] = pReader->ReadDouble();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 5:
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: // Named
|
||||
{
|
||||
pRes->wsStr1 = pReader->ReadString();
|
||||
break;
|
||||
}
|
||||
case 6: // URI
|
||||
{
|
||||
pRes->wsStr1 = pReader->ReadString();
|
||||
break;
|
||||
}
|
||||
case 9: // Hide
|
||||
{
|
||||
pRes->nKind = pReader->ReadByte();
|
||||
int n = pReader->ReadInt();
|
||||
pRes->arrStr.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pRes->arrStr.push_back(pReader->ReadString());
|
||||
break;
|
||||
}
|
||||
case 12: // ResetForm
|
||||
{
|
||||
pRes->nInt1 = pReader->ReadInt();
|
||||
int n = pReader->ReadInt();
|
||||
pRes->arrStr.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pRes->arrStr.push_back(pReader->ReadString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pReader->ReadByte())
|
||||
pRes->pNext = ReadAction(pReader);
|
||||
|
||||
return pRes;
|
||||
}
|
||||
CAnnotFieldInfo::CActionFieldPr::CActionFieldPr() : pNext(NULL) {}
|
||||
CAnnotFieldInfo::CActionFieldPr::~CActionFieldPr() { RELEASEOBJECT(pNext); }
|
||||
void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType)
|
||||
{
|
||||
m_wsFN = pReader->ReadString();
|
||||
@ -901,7 +1012,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
for (int i = 0; i < nAction; ++i)
|
||||
{
|
||||
std::wstring wsType = pReader->ReadString();
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* pA = ReadAction(pReader);
|
||||
CAnnotFieldInfo::CActionFieldPr* pA = ReadAction(pReader);
|
||||
if (pA)
|
||||
{
|
||||
pA->wsType = wsType;
|
||||
@ -931,6 +1042,7 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetCA() {
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetRC() { return m_wsRC; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetAC() { return m_wsAC; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetAP_N_Yes() { return m_wsAP_N_Yes; }
|
||||
const std::vector< std::pair<std::wstring, std::wstring> >& CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::GetOpt() { return m_arrOpt; }
|
||||
void CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags)
|
||||
{
|
||||
if (nType == 27)
|
||||
@ -971,6 +1083,17 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CButtonWidgetPr::Read(NSOnlineOfficeBinToP
|
||||
if (nFlags & (1 << 9))
|
||||
m_wsV = pReader->ReadString();
|
||||
m_nStyle = pReader->ReadByte();
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrOpt.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::wstring s1 = pReader->ReadString();
|
||||
std::wstring s2 = pReader->ReadString();
|
||||
m_arrOpt.push_back(std::make_pair(s1, s2));
|
||||
}
|
||||
}
|
||||
if (nFlags & (1 << 14))
|
||||
m_wsAP_N_Yes = pReader->ReadString();
|
||||
}
|
||||
@ -1136,7 +1259,7 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
for (int i = 0; i < nAction; ++i)
|
||||
{
|
||||
std::wstring wsType = pReader->ReadString();
|
||||
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* pA = ReadAction(pReader);
|
||||
CAnnotFieldInfo::CActionFieldPr* pA = ReadAction(pReader);
|
||||
if (pA)
|
||||
{
|
||||
pA->wsType = wsType;
|
||||
@ -1166,3 +1289,46 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CRedact::CRedact() : IAdvancedCommand(AdvancedCommandType::Redact) {}
|
||||
CRedact::~CRedact()
|
||||
{
|
||||
for (int i = 0; i < m_arrRedact.size(); ++i)
|
||||
RELEASEOBJECT(m_arrRedact[i]);
|
||||
}
|
||||
const std::vector<CRedact::SRedact*>& CRedact::GetRedact() { return m_arrRedact; }
|
||||
bool CRedact::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrRedact.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
SRedact* pRedact = new SRedact();
|
||||
pRedact->sID = pReader->ReadString();
|
||||
int m = pReader->ReadInt();
|
||||
pRedact->arrQuadPoints.reserve(m * 8);
|
||||
for (int j = 0; j < m; ++j)
|
||||
{
|
||||
pRedact->arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
pRedact->arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
pRedact->arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
pRedact->arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
double x = pReader->ReadDouble();
|
||||
double y = pReader->ReadDouble();
|
||||
pRedact->arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
pRedact->arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
pRedact->arrQuadPoints.push_back(x);
|
||||
pRedact->arrQuadPoints.push_back(y);
|
||||
}
|
||||
pRedact->nFlag = pReader->ReadInt();
|
||||
if (pRedact->nFlag & (1 << 0))
|
||||
{
|
||||
pRedact->nRenderLen = pReader->ReadInt() - 4;
|
||||
pRedact->pRender = pReader->GetCurrentBuffer();
|
||||
pReader->Skip(pRedact->nRenderLen);
|
||||
}
|
||||
m_arrRedact.push_back(pRedact);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ public:
|
||||
Ink = 14,
|
||||
Popup = 15,
|
||||
FileAttachment = 16,
|
||||
Redact = 25,
|
||||
Widget = 26,
|
||||
WidgetPushButton = 27,
|
||||
WidgetRadioButton = 28,
|
||||
@ -69,6 +70,23 @@ public:
|
||||
WidgetSignature = 33
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CActionFieldPr
|
||||
{
|
||||
public:
|
||||
CActionFieldPr();
|
||||
~CActionFieldPr();
|
||||
|
||||
BYTE nKind;
|
||||
BYTE nFlags;
|
||||
BYTE nActionType;
|
||||
int nInt1;
|
||||
double dD[4]{};
|
||||
std::wstring wsType;
|
||||
std::wstring wsStr1;
|
||||
std::vector<std::wstring> arrStr;
|
||||
CActionFieldPr* pNext;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CWidgetAnnotPr
|
||||
{
|
||||
public:
|
||||
@ -89,6 +107,7 @@ public:
|
||||
const std::wstring& GetRC();
|
||||
const std::wstring& GetAC();
|
||||
const std::wstring& GetAP_N_Yes();
|
||||
const std::vector< std::pair<std::wstring, std::wstring> >& GetOpt();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags);
|
||||
|
||||
@ -107,6 +126,7 @@ public:
|
||||
std::wstring m_wsRC;
|
||||
std::wstring m_wsAC;
|
||||
std::wstring m_wsAP_N_Yes;
|
||||
std::vector< std::pair<std::wstring, std::wstring> > m_arrOpt;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CTextWidgetPr
|
||||
@ -158,23 +178,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CActionWidget
|
||||
{
|
||||
public:
|
||||
CActionWidget();
|
||||
~CActionWidget();
|
||||
|
||||
BYTE nKind;
|
||||
BYTE nFlags;
|
||||
BYTE nActionType;
|
||||
int nInt1;
|
||||
double dD[4]{};
|
||||
std::wstring wsType;
|
||||
std::wstring wsStr1;
|
||||
std::vector<std::wstring> arrStr;
|
||||
CActionWidget* pNext;
|
||||
};
|
||||
|
||||
CWidgetAnnotPr(BYTE nType);
|
||||
~CWidgetAnnotPr();
|
||||
|
||||
@ -198,7 +201,7 @@ public:
|
||||
const std::vector<double>& GetTC();
|
||||
const std::vector<double>& GetBC();
|
||||
const std::vector<double>& GetBG();
|
||||
const std::vector<CActionWidget*>& GetActions();
|
||||
const std::vector<CActionFieldPr*>& GetActions();
|
||||
|
||||
CButtonWidgetPr* GetButtonWidgetPr();
|
||||
CTextWidgetPr* GetTextWidgetPr();
|
||||
@ -228,7 +231,7 @@ public:
|
||||
std::vector<double> m_arrTC;
|
||||
std::vector<double> m_arrBC;
|
||||
std::vector<double> m_arrBG;
|
||||
std::vector<CActionWidget*> m_arrAction;
|
||||
std::vector<CActionFieldPr*> m_arrAction;
|
||||
|
||||
CButtonWidgetPr* m_pButtonPr;
|
||||
CTextWidgetPr* m_pTextPr;
|
||||
@ -388,7 +391,7 @@ public:
|
||||
{
|
||||
public:
|
||||
bool IsOpen() const;
|
||||
int GetFlag() const;
|
||||
int GetFlag() const;
|
||||
int GetParentID() const;
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader);
|
||||
@ -452,6 +455,53 @@ public:
|
||||
double m_dInRect[4]{};
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CRedactAnnotPr
|
||||
{
|
||||
public:
|
||||
BYTE GetQ() const;
|
||||
int GetFontStyle() const;
|
||||
double GetFontSize() const;
|
||||
const std::wstring& GetFontName();
|
||||
const std::wstring& GetOverlayText();
|
||||
const std::vector<double>& GetIC();
|
||||
const std::vector<double>& GetFontColor();
|
||||
const std::vector<double>& GetQuadPoints();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags);
|
||||
|
||||
private:
|
||||
BYTE m_nQ;
|
||||
int m_nFontStyle;
|
||||
double m_dFS;
|
||||
std::wstring m_wsFN;
|
||||
std::wstring m_wsOverlayText;
|
||||
std::vector<double> m_arrIC;
|
||||
std::vector<double> m_arrFC;
|
||||
std::vector<double> m_arrQuadPoints;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CLinkAnnotPr
|
||||
{
|
||||
public:
|
||||
CLinkAnnotPr();
|
||||
~CLinkAnnotPr();
|
||||
|
||||
BYTE GetH() const;
|
||||
int GetFlags() const;
|
||||
const std::vector<double>& GetQuadPoints();
|
||||
CActionFieldPr* GetA();
|
||||
CActionFieldPr* GetPA();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader);
|
||||
|
||||
private:
|
||||
BYTE m_nH;
|
||||
int m_nFlags;
|
||||
std::vector<double> m_arrQuadPoints;
|
||||
CActionFieldPr* m_pAction;
|
||||
CActionFieldPr* m_pPA;
|
||||
};
|
||||
|
||||
CAnnotFieldInfo();
|
||||
virtual ~CAnnotFieldInfo();
|
||||
|
||||
@ -491,6 +541,8 @@ public:
|
||||
bool IsFreeText() const;
|
||||
bool IsCaret() const;
|
||||
bool IsStamp() const;
|
||||
bool IsRedact() const;
|
||||
bool IsLink() const;
|
||||
|
||||
CMarkupAnnotPr* GetMarkupAnnotPr();
|
||||
CTextAnnotPr* GetTextAnnotPr();
|
||||
@ -503,6 +555,8 @@ public:
|
||||
CFreeTextAnnotPr* GetFreeTextAnnotPr();
|
||||
CCaretAnnotPr* GetCaretAnnotPr();
|
||||
CStampAnnotPr* GetStampAnnotPr();
|
||||
CRedactAnnotPr* GetRedactAnnotPr();
|
||||
CLinkAnnotPr* GetLinkAnnotPr();
|
||||
CWidgetAnnotPr* GetWidgetAnnotPr();
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
@ -547,6 +601,8 @@ private:
|
||||
CFreeTextAnnotPr* m_pFreeTextPr;
|
||||
CCaretAnnotPr* m_pCaretPr;
|
||||
CStampAnnotPr* m_pStampPr;
|
||||
CRedactAnnotPr* m_pRedactPr;
|
||||
CLinkAnnotPr* m_pLinkPr;
|
||||
CWidgetAnnotPr* m_pWidgetPr;
|
||||
};
|
||||
|
||||
@ -581,7 +637,7 @@ public:
|
||||
std::wstring sTU;
|
||||
std::vector<int> arrI;
|
||||
std::vector<std::wstring> arrV;
|
||||
std::vector<CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget*> arrAction;
|
||||
std::vector<CAnnotFieldInfo::CActionFieldPr*> arrAction;
|
||||
std::vector< std::pair<std::wstring, std::wstring> > arrOpt;
|
||||
};
|
||||
|
||||
@ -602,4 +658,27 @@ private:
|
||||
std::vector<CParent*> m_arrParents;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CRedact : public IAdvancedCommand
|
||||
{
|
||||
public:
|
||||
struct SRedact
|
||||
{
|
||||
std::wstring sID;
|
||||
std::vector<double> arrQuadPoints;
|
||||
int nFlag;
|
||||
LONG nRenderLen;
|
||||
BYTE* pRender;
|
||||
};
|
||||
|
||||
CRedact();
|
||||
virtual ~CRedact();
|
||||
|
||||
const std::vector<SRedact*>& GetRedact();
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
|
||||
private:
|
||||
std::vector<SRedact*> m_arrRedact;
|
||||
};
|
||||
|
||||
#endif // _BUILD_ANNOTFIELD_H_
|
||||
|
||||
@ -147,10 +147,20 @@ void CShapeStart::SetShapeImage(BYTE* pImgData, int nWidth, int nHeight)
|
||||
}
|
||||
}
|
||||
std::string& CShapeStart::GetShapeXML() { return m_sShapeXML; }
|
||||
const std::vector<std::wstring>& CShapeStart::GetRedactID() { return m_arrRedactID; }
|
||||
Aggplus::CImage* CShapeStart::GetShapeImage() { return m_pImage; }
|
||||
bool CShapeStart::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
bool CShapeStart::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector, int nLen)
|
||||
{
|
||||
int nStart = pReader->Tell();
|
||||
m_sShapeXML = pReader->ReadStringA();
|
||||
int nEnd = pReader->Tell();
|
||||
if (nEnd - nStart < nLen)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrRedactID.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrRedactID.push_back(pReader->ReadString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -169,7 +179,6 @@ CHeadings::CHeading::CHeading()
|
||||
nPage = 0;
|
||||
dX = 0.0;
|
||||
dY = 0.0;
|
||||
pParent = NULL;
|
||||
}
|
||||
CHeadings::CHeading::~CHeading()
|
||||
{
|
||||
@ -186,35 +195,26 @@ CHeadings::~CHeadings()
|
||||
const std::vector<CHeadings::CHeading*>& CHeadings::GetHeading() { return m_arrHeading; }
|
||||
bool CHeadings::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
int nPredLevel = 0, nHeaderLevel = 0;
|
||||
std::vector<CHeading*>* arrHeading = &m_arrHeading;
|
||||
CHeading* pParent = NULL;
|
||||
std::vector<CHeading*> arrParentStack;
|
||||
int nHeadings = pReader->ReadInt();
|
||||
for (int i = 0; i < nHeadings; ++i)
|
||||
{
|
||||
int nLevel = pReader->ReadInt();
|
||||
if (nLevel > nPredLevel && i > 0)
|
||||
{
|
||||
nHeaderLevel = nPredLevel;
|
||||
pParent = arrHeading->back();
|
||||
arrHeading = &pParent->arrHeading;
|
||||
}
|
||||
else if (nLevel < nPredLevel && nLevel <= nHeaderLevel)
|
||||
{
|
||||
nHeaderLevel = nLevel;
|
||||
pParent = pParent ? pParent->pParent : NULL;
|
||||
arrHeading = pParent ? &pParent->arrHeading : &m_arrHeading;
|
||||
}
|
||||
nPredLevel = nLevel;
|
||||
|
||||
CHeading* pHeading = new CHeading();
|
||||
pHeading->nPage = pReader->ReadInt();
|
||||
pHeading->dX = pReader->ReadDouble();
|
||||
pHeading->dY = pReader->ReadDouble();
|
||||
pHeading->wsTitle = pReader->ReadString();
|
||||
pHeading->pParent = pParent;
|
||||
|
||||
arrHeading->push_back(pHeading);
|
||||
while (arrParentStack.size() > nLevel)
|
||||
arrParentStack.pop_back();
|
||||
|
||||
if (arrParentStack.empty())
|
||||
m_arrHeading.push_back(pHeading);
|
||||
else
|
||||
arrParentStack.back()->arrHeading.push_back(pHeading);
|
||||
|
||||
arrParentStack.push_back(pHeading);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -139,15 +139,17 @@ public:
|
||||
~CShapeStart();
|
||||
|
||||
std::string& GetShapeXML();
|
||||
const std::vector<std::wstring>& GetRedactID();
|
||||
Aggplus::CImage* GetShapeImage();
|
||||
|
||||
void SetShapeXML(const std::string& sShapeXML);
|
||||
void SetShapeImage(BYTE* pImgData, int nWidth, int nHeight);
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector, int nLen);
|
||||
|
||||
private:
|
||||
std::string m_sShapeXML;
|
||||
std::vector<std::wstring> m_arrRedactID;
|
||||
Aggplus::CImage* m_pImage;
|
||||
};
|
||||
|
||||
@ -179,7 +181,6 @@ public:
|
||||
int nPage;
|
||||
double dX;
|
||||
double dY;
|
||||
CHeading* pParent;
|
||||
std::vector<CHeading*> arrHeading;
|
||||
|
||||
CHeading();
|
||||
|
||||
@ -639,6 +639,7 @@ namespace NSFonts
|
||||
virtual double GetCharWidth(int gid) = 0;
|
||||
|
||||
virtual int GetGIDByUnicode(int code) = 0;
|
||||
virtual int GetUnicodeByGID(int gid) = 0;
|
||||
|
||||
virtual int GetEmbeddingLicenceType() = 0;
|
||||
virtual void FillFontSelectFormat(CFontSelectFormat& oFormat) = 0;
|
||||
@ -736,6 +737,7 @@ namespace NSFonts
|
||||
|
||||
virtual unsigned int GetNameIndex(const std::wstring& wsName) = 0;
|
||||
virtual unsigned int GetGIDByUnicode(const unsigned int& unCode) = 0;
|
||||
virtual int GetUnicodeByGID(const int& gid) = 0;
|
||||
|
||||
virtual void GetFace(double& d0, double& d1, double& d2) = 0;
|
||||
virtual void GetLimitsY(double& dMin, double& dMax) = 0;
|
||||
|
||||
@ -46,14 +46,20 @@
|
||||
"_InitializeFontsRanges",
|
||||
"_SetFontBinary",
|
||||
"_GetFontBinary",
|
||||
"_GetGIDByUnicode",
|
||||
"_IsFontBinaryExist",
|
||||
"_DestroyTextInfo",
|
||||
"_IsNeedCMap",
|
||||
"_SetCMapData",
|
||||
"_SetScanPageFonts",
|
||||
"_ScanPage",
|
||||
"_SplitPages",
|
||||
"_MergePages",
|
||||
"_UnmergePages",
|
||||
"_RedactPage",
|
||||
"_UndoRedact",
|
||||
"_CheckOwnerPassword",
|
||||
"_CheckPerm",
|
||||
"_GetImageBase64",
|
||||
"_GetImageBase64Len",
|
||||
"_GetImageBase64Ptr",
|
||||
@ -95,7 +101,7 @@
|
||||
"compile_files_array": [
|
||||
{
|
||||
"folder": "../../../raster/",
|
||||
"files": ["BgraFrame.cpp", "ImageFileFormatChecker.cpp", "PICT/PICFile.cpp", "PICT/pic.cpp"]
|
||||
"files": ["BgraFrame.cpp", "ImageFileFormatChecker.cpp", "PICT/PICFile.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/CxImage/",
|
||||
@ -155,11 +161,11 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../agg-2.4/src/",
|
||||
"files": ["agg_arc.cpp", "agg_vcgen_stroke.cpp", "agg_vcgen_dash.cpp", "agg_trans_affine.cpp", "agg_curves.cpp", "agg_image_filters.cpp"]
|
||||
"files": ["agg_arc.cpp", "agg_vcgen_stroke.cpp", "agg_vcgen_dash.cpp", "agg_trans_affine.cpp", "agg_curves.cpp", "agg_image_filters.cpp", "agg_bezier_arc.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../common/",
|
||||
"files": ["File.cpp", "Directory.cpp", "ByteBuilder.cpp", "Base64.cpp", "StringExt.cpp", "Path.cpp", "SystemUtils.cpp"]
|
||||
"files": ["File.cpp", "Directory.cpp", "ByteBuilder.cpp", "Base64.cpp", "StringExt.cpp", "Path.cpp", "SystemUtils.cpp", "StringUTF32.cpp", "StringBuilder.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../Common/3dParty/icu/icu/source/common/",
|
||||
@ -191,11 +197,11 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcReader/",
|
||||
"files": ["Adaptors.cpp", "GfxClip.cpp", "RendererOutputDev.cpp", "JPXStream2.cpp", "PdfAnnot.cpp"]
|
||||
"files": ["Adaptors.cpp", "GfxClip.cpp", "RendererOutputDev.cpp", "JPXStream2.cpp", "PdfAnnot.cpp", "PdfFont.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcWriter/",
|
||||
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontOTWriter.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp"]
|
||||
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontOTWriter.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp", "RedactOutputDev.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/Resources/",
|
||||
@ -250,8 +256,8 @@
|
||||
"files": ["BaseItem.cpp", "ContText.cpp", "Paragraph.cpp", "Shape.cpp", "TextLine.cpp", "Table.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../common",
|
||||
"files": ["StringUTF32.cpp", "StringBuilder.cpp"]
|
||||
"folder": "../../../../OdfFile/Common",
|
||||
"files": ["logging.cpp"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -113,7 +113,6 @@ SOURCES += \
|
||||
../../../../raster/ImageFileFormatChecker.cpp \
|
||||
../../../../raster/Metafile/MetaFile.cpp \
|
||||
../../../../raster/PICT/PICFile.cpp \
|
||||
../../../../raster/PICT/pic.cpp \
|
||||
\
|
||||
../../../ArrowHead.cpp \
|
||||
../../../Brush.cpp \
|
||||
@ -640,6 +639,7 @@ SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcReader/Adaptors.cpp \
|
||||
$$PDF_ROOT_DIR/SrcReader/GfxClip.cpp \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.cpp \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfFont.cpp \
|
||||
$$PDF_ROOT_DIR/Resources/BaseFonts.cpp \
|
||||
$$PDF_ROOT_DIR/Resources/CMapMemory/cmap_memory.cpp
|
||||
|
||||
@ -665,6 +665,7 @@ HEADERS +=\
|
||||
$$PDF_ROOT_DIR/SrcReader/MemoryUtils.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/GfxClip.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/FontsWasm.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfFont.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.h
|
||||
|
||||
DEFINES += CRYPTOPP_DISABLE_ASM
|
||||
@ -701,7 +702,8 @@ HEADERS += \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Utils.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Metadata.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/ICCProfile.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/States.h
|
||||
$$PDF_ROOT_DIR/SrcWriter/States.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/RedactOutputDev.h
|
||||
|
||||
SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcWriter/AcroForm.cpp \
|
||||
@ -730,7 +732,8 @@ SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Streams.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Utils.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Metadata.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/States.cpp
|
||||
$$PDF_ROOT_DIR/SrcWriter/States.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/RedactOutputDev.cpp
|
||||
|
||||
# PdfFile
|
||||
|
||||
|
||||
@ -145,9 +145,17 @@ CFile.prototype["isNeedPassword"] = function()
|
||||
{
|
||||
return this._isNeedPassword;
|
||||
};
|
||||
CFile.prototype["SplitPages"] = function(arrPageIndex, arrayBufferChanges)
|
||||
CFile.prototype["CheckOwnerPassword"] = function(password)
|
||||
{
|
||||
let ptr = this._SplitPages(arrPageIndex, arrayBufferChanges);
|
||||
return this._CheckOwnerPassword(password);
|
||||
};
|
||||
CFile.prototype["CheckPerm"] = function(perm)
|
||||
{
|
||||
return this._CheckPerm(perm);
|
||||
};
|
||||
CFile.prototype["SplitPages"] = function(arrOriginIndex, arrayBufferChanges)
|
||||
{
|
||||
let ptr = this._SplitPages(arrOriginIndex, arrayBufferChanges);
|
||||
let res = ptr.getMemory(true);
|
||||
ptr.free();
|
||||
return res;
|
||||
@ -160,6 +168,14 @@ CFile.prototype["UndoMergePages"] = function()
|
||||
{
|
||||
return this._UndoMergePages();
|
||||
};
|
||||
CFile.prototype["RedactPage"] = function(originIndex, arrRedactBox, arrayBufferFiller)
|
||||
{
|
||||
return this._RedactPage(originIndex, arrRedactBox, arrayBufferFiller);
|
||||
};
|
||||
CFile.prototype["UndoRedact"] = function()
|
||||
{
|
||||
return this._UndoRedact();
|
||||
};
|
||||
|
||||
// INFO DOCUMENT
|
||||
CFile.prototype.getInfo = function()
|
||||
@ -251,9 +267,9 @@ CFile.prototype["getStructure"] = function()
|
||||
return res;
|
||||
};
|
||||
|
||||
CFile.prototype["getLinks"] = function(pageIndex)
|
||||
CFile.prototype["getLinks"] = function(originIndex)
|
||||
{
|
||||
let ptr = this._getLinks(pageIndex);
|
||||
let ptr = this._getLinks(originIndex);
|
||||
let reader = ptr.getReader();
|
||||
|
||||
if (!reader) return [];
|
||||
@ -276,11 +292,12 @@ CFile.prototype["getLinks"] = function(pageIndex)
|
||||
};
|
||||
|
||||
// TEXT
|
||||
CFile.prototype["getGlyphs"] = function(pageIndex)
|
||||
CFile.prototype["getGlyphs"] = function(originIndex)
|
||||
{
|
||||
let pageIndex = this.pages.findIndex(function(page) {
|
||||
return page.originIndex == originIndex;
|
||||
});
|
||||
let page = this.pages[pageIndex];
|
||||
if (page.originIndex == undefined)
|
||||
return [];
|
||||
if (page.fonts.length > 0)
|
||||
{
|
||||
// waiting fonts
|
||||
@ -288,7 +305,7 @@ CFile.prototype["getGlyphs"] = function(pageIndex)
|
||||
}
|
||||
|
||||
this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Page);
|
||||
let res = this._getGlyphs(page.originIndex);
|
||||
let res = this._getGlyphs(originIndex);
|
||||
// there is no need to delete the result; this buffer is used as a text buffer
|
||||
// for text commands on other pages. After receiving ALL text pages,
|
||||
// you need to call destroyTextInfo()
|
||||
@ -345,6 +362,11 @@ CFile.prototype["getFontByID"] = function(ID)
|
||||
return this._getFontByID(ID);
|
||||
};
|
||||
|
||||
CFile.prototype["getGIDByUnicode"] = function(ID)
|
||||
{
|
||||
return this._getGIDByUnicode(ID);
|
||||
};
|
||||
|
||||
CFile.prototype["setCMap"] = function(memoryBuffer)
|
||||
{
|
||||
if (!this.nativeFile)
|
||||
@ -404,9 +426,9 @@ function readAction(reader, rec, readDoubleFunc, readStringFunc)
|
||||
case 4:
|
||||
{
|
||||
rec["left"] = readDoubleFunc.call(reader);
|
||||
rec["bottom"] = readDoubleFunc.call(reader);
|
||||
rec["top"] = readDoubleFunc.call(reader);
|
||||
rec["right"] = readDoubleFunc.call(reader);
|
||||
rec["top"] = readDoubleFunc.call(reader);
|
||||
rec["bottom"] = readDoubleFunc.call(reader);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
@ -612,6 +634,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
oFont["vertical"] = readDoubleFunc.call(reader);
|
||||
if (nFontFlag & (1 << 6))
|
||||
oFont["actual"] = readStringFunc.call(reader);
|
||||
oFont["rtl"] = (nFontFlag >> 7) & 1;
|
||||
oFont["size"] = readDoubleFunc.call(reader);
|
||||
oFont["color"] = [];
|
||||
oFont["color"].push(readDouble2Func.call(reader));
|
||||
@ -1017,6 +1040,37 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
rec["font"]["style"] = reader.readInt();
|
||||
}
|
||||
}
|
||||
// Link
|
||||
else if (rec["type"] == 1)
|
||||
{
|
||||
flags = reader.readInt();
|
||||
if (flags & (1 << 0))
|
||||
{
|
||||
rec["A"] = {};
|
||||
if (isRead)
|
||||
readStringFunc.call(reader);
|
||||
readAction(reader, rec["A"], readDoubleFunc, readStringFunc);
|
||||
}
|
||||
if (flags & (1 << 1))
|
||||
{
|
||||
rec["PA"] = {};
|
||||
if (isRead)
|
||||
readStringFunc.call(reader);
|
||||
readAction(reader, rec["PA"], readDoubleFunc, readStringFunc);
|
||||
}
|
||||
// Selection mode - H
|
||||
// 0 - none, 1 - invert, 2 - push, 3 - outline
|
||||
if (flags & (1 << 2))
|
||||
rec["highlight"] = reader.readByte();
|
||||
// QuadPoints
|
||||
if (flags & (1 << 3))
|
||||
{
|
||||
let n = reader.readInt();
|
||||
rec["QuadPoints"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
rec["QuadPoints"].push(readDoubleFunc.call(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readStringFunc, isRead = false)
|
||||
{
|
||||
@ -1161,6 +1215,20 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["value"] = readStringFunc.call(reader);
|
||||
// 0 - check, 1 - cross, 2 - diamond, 3 - circle, 4 - star, 5 - square
|
||||
rec["style"] = reader.readByte();
|
||||
if (flags & (1 << 10))
|
||||
{
|
||||
let n = reader.readInt();
|
||||
rec["opt"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
{
|
||||
let opt1 = readStringFunc.call(reader);
|
||||
let opt2 = readStringFunc.call(reader);
|
||||
if (opt1 == "")
|
||||
rec["opt"].push(opt2);
|
||||
else
|
||||
rec["opt"].push([opt2, opt1]);
|
||||
}
|
||||
}
|
||||
if (flags & (1 << 14))
|
||||
rec["ExportValue"] = readStringFunc.call(reader);
|
||||
// 12.7.4.2.1
|
||||
@ -1399,7 +1467,7 @@ CFile.prototype["getInteractiveFormsInfo"] = function()
|
||||
// optional nWidget - rec["AP"]["i"]
|
||||
// optional sView - N/D/R
|
||||
// optional sButtonView - state pushbutton-annotation - Off/Yes(or rec["ExportValue"])
|
||||
CFile.prototype["getInteractiveFormsAP"] = function(pageIndex, width, height, backgroundColor, nWidget, sView, sButtonView)
|
||||
CFile.prototype["getInteractiveFormsAP"] = function(originIndex, width, height, backgroundColor, nWidget, sView, sButtonView)
|
||||
{
|
||||
let nView = -1;
|
||||
if (sView)
|
||||
@ -1415,8 +1483,11 @@ CFile.prototype["getInteractiveFormsAP"] = function(pageIndex, width, height, ba
|
||||
if (sButtonView)
|
||||
nButtonView = (sButtonView == "Off" ? 0 : 1);
|
||||
|
||||
let pageIndex = this.pages.findIndex(function(page) {
|
||||
return page.originIndex == originIndex;
|
||||
});
|
||||
this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Forms);
|
||||
let ptr = this._getInteractiveFormsAP(width, height, backgroundColor, pageIndex, nWidget, nView, nButtonView);
|
||||
let ptr = this._getInteractiveFormsAP(width, height, backgroundColor, originIndex, nWidget, nView, nButtonView);
|
||||
let reader = ptr.getReader();
|
||||
this.unlockPageNumForFontsLoader();
|
||||
|
||||
@ -1501,13 +1572,13 @@ CFile.prototype["getButtonIcons"] = function(pageIndex, width, height, backgroun
|
||||
ptr.free();
|
||||
return res;
|
||||
};
|
||||
// optional pageIndex - get annotations from specific page
|
||||
CFile.prototype["getAnnotationsInfo"] = function(pageIndex)
|
||||
// optional originIndex - get annotations from specific page
|
||||
CFile.prototype["getAnnotationsInfo"] = function(originIndex)
|
||||
{
|
||||
if (!this.nativeFile)
|
||||
return [];
|
||||
|
||||
let ptr = this._getAnnotationsInfo(pageIndex);
|
||||
let ptr = this._getAnnotationsInfo(originIndex);
|
||||
let reader = ptr.getReader();
|
||||
|
||||
if (!reader) return [];
|
||||
@ -1539,7 +1610,7 @@ CFile.prototype["getAnnotationsInfo"] = function(pageIndex)
|
||||
};
|
||||
// optional nAnnot ...
|
||||
// optional sView ...
|
||||
CFile.prototype["getAnnotationsAP"] = function(pageIndex, width, height, backgroundColor, nAnnot, sView)
|
||||
CFile.prototype["getAnnotationsAP"] = function(originIndex, width, height, backgroundColor, nAnnot, sView)
|
||||
{
|
||||
let nView = -1;
|
||||
if (sView)
|
||||
@ -1552,8 +1623,11 @@ CFile.prototype["getAnnotationsAP"] = function(pageIndex, width, height, backgro
|
||||
nView = 2;
|
||||
}
|
||||
|
||||
let pageIndex = this.pages.findIndex(function(page) {
|
||||
return page.originIndex == originIndex;
|
||||
});
|
||||
this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Annotation);
|
||||
let ptr = this._getAnnotationsAP(width, height, backgroundColor, pageIndex, nAnnot, nView);
|
||||
let ptr = this._getAnnotationsAP(width, height, backgroundColor, originIndex, nAnnot, nView);
|
||||
let reader = ptr.getReader();
|
||||
this.unlockPageNumForFontsLoader();
|
||||
|
||||
@ -1632,6 +1706,11 @@ CFile.prototype["readAnnotationsInfoFromBinary"] = function(AnnotInfo)
|
||||
};
|
||||
|
||||
// SCAN PAGES
|
||||
CFile.prototype["scanPageFonts"] = function(page)
|
||||
{
|
||||
this._setScanPageFonts(page);
|
||||
};
|
||||
|
||||
CFile.prototype["scanPage"] = function(page, mode)
|
||||
{
|
||||
let ptr = this._scanPage(page, mode);
|
||||
|
||||
@ -135,6 +135,27 @@ CFile.prototype._UndoMergePages = function()
|
||||
return g_native_drawing_file["UnmergePages"]();
|
||||
};
|
||||
|
||||
CFile.prototype._RedactPage = function(pageIndex, box, filler)
|
||||
{
|
||||
let dataFiller = (undefined !== filler.byteLength) ? new Uint8Array(filler) : filler;
|
||||
return g_native_drawing_file["RedactPage"](pageIndex, box, dataFiller);
|
||||
};
|
||||
|
||||
CFile.prototype._UndoRedact = function()
|
||||
{
|
||||
return g_native_drawing_file["UndoRedact"]();
|
||||
};
|
||||
|
||||
CFile.prototype._CheckOwnerPassword = function(password)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
CFile.prototype._CheckPerm = function(perm)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
{
|
||||
@ -151,6 +172,12 @@ CFile.prototype._getFontByID = function(ID)
|
||||
return g_native_drawing_file["GetFontBinary"](ID);
|
||||
};
|
||||
|
||||
CFile.prototype._getGIDByUnicode = function(ID)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetGIDByUnicode"](ID);
|
||||
return g_module_pointer;
|
||||
}
|
||||
|
||||
CFile.prototype._getInteractiveFormsFonts = function(type)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetInteractiveFormsFonts"](type);
|
||||
@ -225,6 +252,11 @@ CFile.prototype._getInteractiveFormsAP = function(width, height, backgroundColor
|
||||
};
|
||||
|
||||
// SCAN PAGES
|
||||
CFile.prototype._setScanPageFonts = function(page)
|
||||
{
|
||||
g_native_drawing_file["SetScanPageFonts"](page);
|
||||
};
|
||||
|
||||
CFile.prototype._scanPage = function(page, mode)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["ScanPage"](page, (mode === undefined) ? 0 : mode);
|
||||
|
||||
@ -106,7 +106,7 @@ CFile.prototype._openFile = function(buffer, password)
|
||||
}
|
||||
|
||||
let passwordPtr = 0;
|
||||
if (password)
|
||||
if (password !== undefined)
|
||||
{
|
||||
let passwordBuf = password.toUtf8();
|
||||
passwordPtr = Module["_malloc"](passwordBuf.length);
|
||||
@ -192,6 +192,61 @@ CFile.prototype._UndoMergePages = function()
|
||||
return Module["_UnmergePages"](this.nativeFile) == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._RedactPage = function(pageIndex, arrRedactBox, arrayBufferFiller)
|
||||
{
|
||||
let changesPtr = 0;
|
||||
let changesLen = 0;
|
||||
if (arrayBufferFiller)
|
||||
{
|
||||
let changes = new Uint8Array(arrayBufferFiller);
|
||||
changesLen = changes.length;
|
||||
changesPtr = Module["_malloc"](changesLen);
|
||||
Module["HEAP8"].set(changes, changesPtr);
|
||||
}
|
||||
|
||||
let memoryBuffer = new Int32Array(arrRedactBox.length);
|
||||
for (let i = 0; i < arrRedactBox.length; i++)
|
||||
memoryBuffer[i] = Math.round(arrRedactBox[i] * 10000);
|
||||
|
||||
let pointer = Module["_malloc"](memoryBuffer.length * 4);
|
||||
Module["HEAP32"].set(memoryBuffer, pointer >> 2);
|
||||
|
||||
let bRes = Module["_RedactPage"](this.nativeFile, pageIndex, pointer, memoryBuffer.length / 8, changesPtr, changesLen);
|
||||
changesPtr = 0; // Success or not, changesPtr is either taken or freed
|
||||
|
||||
Module["_free"](pointer);
|
||||
|
||||
return bRes == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._UndoRedact = function()
|
||||
{
|
||||
return Module["_UndoRedact"](this.nativeFile) == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._CheckOwnerPassword = function(password)
|
||||
{
|
||||
let passwordPtr = 0;
|
||||
if (password !== undefined)
|
||||
{
|
||||
let passwordBuf = password.toUtf8();
|
||||
passwordPtr = Module["_malloc"](passwordBuf.length);
|
||||
Module["HEAP8"].set(passwordBuf, passwordPtr);
|
||||
}
|
||||
|
||||
let bRes = Module["_CheckOwnerPassword"](this.nativeFile, passwordPtr);
|
||||
|
||||
if (passwordPtr)
|
||||
Module["_free"](passwordPtr);
|
||||
|
||||
return bRes == 1;
|
||||
}
|
||||
|
||||
CFile.prototype._CheckPerm = function(perm)
|
||||
{
|
||||
return Module["_CheckPerm"](this.nativeFile, perm) == 1;
|
||||
}
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
{
|
||||
@ -231,6 +286,34 @@ CFile.prototype._getFontByID = function(ID)
|
||||
return res;
|
||||
};
|
||||
|
||||
CFile.prototype._getGIDByUnicode = function(ID)
|
||||
{
|
||||
if (ID === undefined)
|
||||
return null;
|
||||
|
||||
let idBuffer = ID.toUtf8();
|
||||
let idPointer = Module["_malloc"](idBuffer.length);
|
||||
Module["HEAP8"].set(idBuffer, idPointer);
|
||||
g_module_pointer.ptr = Module["_GetGIDByUnicode"](this.nativeFile, idPointer);
|
||||
Module["_free"](idPointer);
|
||||
|
||||
let reader = g_module_pointer.getReader();
|
||||
if (!reader)
|
||||
return null;
|
||||
|
||||
let res = {};
|
||||
let nFontLength = reader.readInt();
|
||||
for (let i = 0; i < nFontLength; i++)
|
||||
{
|
||||
let np1 = reader.readInt();
|
||||
let np2 = reader.readInt();
|
||||
res[np2] = np1;
|
||||
}
|
||||
|
||||
g_module_pointer.free();
|
||||
return res;
|
||||
}
|
||||
|
||||
CFile.prototype._getInteractiveFormsFonts = function(type)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetInteractiveFormsFonts"](this.nativeFile, type);
|
||||
@ -305,6 +388,11 @@ CFile.prototype._getInteractiveFormsAP = function(width, height, backgroundColor
|
||||
};
|
||||
|
||||
// SCAN PAGES
|
||||
CFile.prototype._setScanPageFonts = function(page)
|
||||
{
|
||||
Module["_SetScanPageFonts"](this.nativeFile, page);
|
||||
};
|
||||
|
||||
CFile.prototype._scanPage = function(page, mode)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_ScanPage"](this.nativeFile, page, (mode === undefined) ? 0 : mode);
|
||||
|
||||
@ -80,7 +80,7 @@ WASM_EXPORT CDrawingFile* Open(BYTE* data, LONG size, const char* password)
|
||||
std::wstring sPassword = L"";
|
||||
if (NULL != password)
|
||||
sPassword = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)password, strlen(password));
|
||||
pFile->OpenFile(data, size, sPassword);
|
||||
pFile->OpenFile(data, size, password ? sPassword.c_str() : NULL);
|
||||
return pFile;
|
||||
}
|
||||
WASM_EXPORT int GetType(CDrawingFile* pFile)
|
||||
@ -150,6 +150,10 @@ WASM_EXPORT BYTE* GetFontBinary(CDrawingFile* pFile, char* path)
|
||||
{
|
||||
return pFile->GetFontBinary(std::string(path));
|
||||
}
|
||||
WASM_EXPORT BYTE* GetGIDByUnicode(CDrawingFile* pFile, char* path)
|
||||
{
|
||||
return pFile->GetGIDByUnicode(std::string(path));
|
||||
}
|
||||
WASM_EXPORT void DestroyTextInfo(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->DestroyTextInfo();
|
||||
@ -162,6 +166,10 @@ WASM_EXPORT void SetCMapData(CDrawingFile* pFile, BYTE* data, int size)
|
||||
{
|
||||
pFile->SetCMapData(data, size);
|
||||
}
|
||||
WASM_EXPORT void SetScanPageFonts(CDrawingFile* pFile, int nPageIndex)
|
||||
{
|
||||
return pFile->SetScanPageFonts(nPageIndex);
|
||||
}
|
||||
WASM_EXPORT BYTE* ScanPage(CDrawingFile* pFile, int nPageIndex, int mode)
|
||||
{
|
||||
return pFile->ScanPage(nPageIndex, mode);
|
||||
@ -178,6 +186,30 @@ WASM_EXPORT int UnmergePages(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->UnmergePages() ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int RedactPage(CDrawingFile* pFile, int nPageIndex, int* arrRedactBox, int nLengthX8, BYTE* data, int size)
|
||||
{
|
||||
double* arrDRedactBox = new double[nLengthX8 * 8];
|
||||
for (int i = 0; i < nLengthX8 * 8; ++i)
|
||||
arrDRedactBox[i] = arrRedactBox[i] / 10000.0;
|
||||
int nRes = pFile->RedactPage(nPageIndex, arrDRedactBox, nLengthX8, data, size) ? 1 : 0;
|
||||
delete[] arrDRedactBox;
|
||||
return nRes;
|
||||
}
|
||||
WASM_EXPORT int UndoRedact(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->UndoRedact() ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int CheckOwnerPassword(CDrawingFile* pFile, const char* password)
|
||||
{
|
||||
std::wstring sPassword = L"";
|
||||
if (NULL != password)
|
||||
sPassword = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)password, strlen(password));
|
||||
return pFile->CheckOwnerPassword(password ? sPassword.c_str() : NULL) ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int CheckPerm(CDrawingFile* pFile, int nPermFlag)
|
||||
{
|
||||
return pFile->CheckPerm(nPermFlag) ? 1 : 0;
|
||||
}
|
||||
|
||||
WASM_EXPORT void* GetImageBase64(CDrawingFile* pFile, int rId)
|
||||
{
|
||||
|
||||
@ -704,6 +704,23 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
i += 1;
|
||||
std::cout << "Style " << arrStyle[nPathLength] << ", ";
|
||||
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
int nOptLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
for (int j = 0; j < nOptLength; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << std::to_string(j) << " Opt1 " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << std::to_string(j) << " Opt2 " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
}
|
||||
if (nFlags & (1 << 14))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
@ -938,6 +955,36 @@ void ReadInteractiveFormsFonts(CDrawingFile* pGrFile, int nType)
|
||||
std::cout << "font" << j << ".txt";
|
||||
}
|
||||
|
||||
if (pFont)
|
||||
free(pFont);
|
||||
|
||||
if (false)
|
||||
continue;
|
||||
|
||||
pFont = GetGIDByUnicode(pGrFile, (char*)sFontName.c_str());
|
||||
nLength2 = READ_INT(pFont);
|
||||
i2 = 4;
|
||||
nLength2 -= 4;
|
||||
|
||||
while (i2 < nLength2)
|
||||
{
|
||||
int nFontLength = READ_INT(pFont + i2);
|
||||
i2 += 4;
|
||||
|
||||
std::cout << std::endl << "GIDtoUnicode" << std::endl;
|
||||
|
||||
for (int j = 0; j < nFontLength; ++j)
|
||||
{
|
||||
unsigned int code = READ_INT(pFont + i2);
|
||||
i2 += 4;
|
||||
unsigned int unicode = READ_INT(pFont + i2);
|
||||
i2 += 4;
|
||||
std::cout << "gid\t" << code << "\tunicode\t" << unicode << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
if (pFont)
|
||||
free(pFont);
|
||||
}
|
||||
@ -976,6 +1023,8 @@ bool GetFromBase64(const std::wstring& sPath, BYTE** pBuffer, int* nBufferLen)
|
||||
if (!NSBase64::Base64Decode((const char*)pFileContent, dwFileSize, *pBuffer, nBufferLen))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
oFile.CloseFile();
|
||||
return true;
|
||||
}
|
||||
@ -1023,7 +1072,7 @@ int main(int argc, char* argv[])
|
||||
if (!NSFile::CFileBinary::ReadAllBytes(sFilePath, &pFileData, nFileDataLen))
|
||||
return 1;
|
||||
|
||||
CDrawingFile* pGrFile = Open(pFileData, (LONG)nFileDataLen, "");
|
||||
CDrawingFile* pGrFile = Open(pFileData, (LONG)nFileDataLen, NULL);
|
||||
int nError = GetErrorCode(pGrFile);
|
||||
|
||||
if (nError != 0)
|
||||
@ -1031,7 +1080,7 @@ int main(int argc, char* argv[])
|
||||
Close(pGrFile);
|
||||
if (nError == 4)
|
||||
{
|
||||
std::string sPassword = "123456";
|
||||
std::string sPassword = "";
|
||||
pGrFile = Open(pFileData, nFileDataLen, sPassword.c_str());
|
||||
}
|
||||
else
|
||||
@ -1049,7 +1098,7 @@ int main(int argc, char* argv[])
|
||||
int nBufferLen = NULL;
|
||||
BYTE* pBuffer = NULL;
|
||||
|
||||
if (GetFromBase64(NSFile::GetProcessDirectory() + L"/split1.txt", &pBuffer, &nBufferLen))
|
||||
if (true && GetFromBase64(NSFile::GetProcessDirectory() + L"/split.txt", &pBuffer, &nBufferLen))
|
||||
{
|
||||
std::vector<int> arrPages = { 0 };
|
||||
BYTE* pSplitPages = SplitPages(pGrFile, arrPages.data(), arrPages.size(), pBuffer, nBufferLen);
|
||||
@ -1058,40 +1107,28 @@ int main(int argc, char* argv[])
|
||||
if (nLength > 4)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.CreateFileW(NSFile::GetProcessDirectory() + L"/split1.pdf"))
|
||||
if (oFile.CreateFileW(NSFile::GetProcessDirectory() + L"/split.pdf"))
|
||||
oFile.WriteFile(pSplitPages + 4, nLength - 4);
|
||||
oFile.CloseFile();
|
||||
|
||||
BYTE* pMallocData = (BYTE*)malloc(nLength - 4);
|
||||
memcpy(pMallocData, pSplitPages + 4, nLength - 4);
|
||||
|
||||
MergePages(pGrFile, pMallocData, nLength - 4, 0, "merge1");
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pBuffer);
|
||||
|
||||
if (GetFromBase64(NSFile::GetProcessDirectory() + L"/split2.txt", &pBuffer, &nBufferLen))
|
||||
if (true)
|
||||
{
|
||||
std::vector<int> arrPages = { 0 };
|
||||
BYTE* pSplitPages = SplitPages(pGrFile, arrPages.data(), arrPages.size(), pBuffer, nBufferLen);
|
||||
int nLength = READ_INT(pSplitPages);
|
||||
|
||||
if (nLength > 4)
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(NSFile::GetProcessDirectory() + L"/split.pdf"))
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.CreateFileW(NSFile::GetProcessDirectory() + L"/split2.pdf"))
|
||||
oFile.WriteFile(pSplitPages + 4, nLength - 4);
|
||||
oFile.CloseFile();
|
||||
DWORD dwFileSize = oFile.GetFileSize();
|
||||
BYTE* pFileContent = (BYTE*)malloc(dwFileSize);
|
||||
|
||||
BYTE* pMallocData = (BYTE*)malloc(nLength - 4);
|
||||
memcpy(pMallocData, pSplitPages + 4, nLength - 4);
|
||||
|
||||
MergePages(pGrFile, pMallocData, nLength - 4, 0, "merge2");
|
||||
DWORD dwReaded;
|
||||
if (oFile.ReadFile(pFileContent, dwFileSize, dwReaded))
|
||||
MergePages(pGrFile, pFileContent, dwReaded, 0, "merge1");
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pBuffer);
|
||||
}
|
||||
|
||||
// INFO
|
||||
@ -1135,17 +1172,38 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
int i = nTestPage;
|
||||
//for (int i = 0; i < nPagesCount; ++i)
|
||||
// OWNER PASSWORD
|
||||
if (false)
|
||||
{
|
||||
// RASTER
|
||||
if (true)
|
||||
std::string sPassword = "";
|
||||
std::cout << "CheckPerm 4 Edit " << CheckPerm(pGrFile, 4) << std::endl;
|
||||
std::cout << "CheckPerm 4 Print " << CheckPerm(pGrFile, 3) << std::endl;
|
||||
|
||||
std::cout << "CheckOwnerPassword " << CheckOwnerPassword(pGrFile, sPassword.c_str()) << std::endl;
|
||||
std::cout << "CheckPerm 4 Edit " << CheckPerm(pGrFile, 4) << std::endl;
|
||||
std::cout << "CheckPerm 4 Print " << CheckPerm(pGrFile, 3) << std::endl;
|
||||
}
|
||||
|
||||
// REDACT
|
||||
if (false)
|
||||
{
|
||||
BYTE* pColor = new BYTE[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int pRect[8] = { 307499, 217499, 307499, 1124999, 1799999, 1124999, 1799999, 217499 };
|
||||
if (!RedactPage(pGrFile, nTestPage, pRect, 1, pColor, 12))
|
||||
std::cout << "Redact false" << std::endl;
|
||||
}
|
||||
|
||||
// RASTER
|
||||
if (false)
|
||||
{
|
||||
int i = nTestPage;
|
||||
//for (int i = 0; i < nPagesCount; ++i)
|
||||
{
|
||||
nWidth = READ_INT(pInfo + i * 16 + 12);
|
||||
nHeight = READ_INT(pInfo + i * 16 + 16);
|
||||
|
||||
//nWidth *= 3;
|
||||
//nHeight *= 3;
|
||||
//nWidth *= 2;
|
||||
//nHeight *= 2;
|
||||
|
||||
BYTE* res = NULL;
|
||||
res = GetPixmap(pGrFile, i, nWidth, nHeight, 0xFFFFFF);
|
||||
@ -1162,11 +1220,10 @@ int main(int argc, char* argv[])
|
||||
RELEASEARRAYOBJECTS(res);
|
||||
}
|
||||
}
|
||||
|
||||
free(pInfo);
|
||||
|
||||
// LINKS
|
||||
if (true && nPagesCount > 0)
|
||||
if (false && nPagesCount > 0)
|
||||
{
|
||||
BYTE* pLinks = GetLinks(pGrFile, nTestPage);
|
||||
nLength = READ_INT(pLinks);
|
||||
@ -1202,7 +1259,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// STRUCTURE
|
||||
if (true)
|
||||
if (false)
|
||||
{
|
||||
BYTE* pStructure = GetStructure(pGrFile);
|
||||
nLength = READ_INT(pStructure);
|
||||
@ -1307,7 +1364,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// INTERACTIVE FORMS
|
||||
if (true)
|
||||
if (false)
|
||||
{
|
||||
ReadInteractiveFormsFonts(pGrFile, 1);
|
||||
ReadInteractiveFormsFonts(pGrFile, 2);
|
||||
@ -1426,7 +1483,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// ANNOTS
|
||||
if (true)
|
||||
if (false)
|
||||
{
|
||||
BYTE* pAnnots = GetAnnotationsInfo(pGrFile, -1);
|
||||
nLength = READ_INT(pAnnots);
|
||||
@ -1515,6 +1572,8 @@ int main(int argc, char* argv[])
|
||||
std::cout << "; font-actual:" << std::string((char*)(pAnnots + i), nPathLength) << "; ";
|
||||
i += nPathLength;
|
||||
}
|
||||
if (nFontFlag & (1 << 7))
|
||||
std::cout << "; dir:rtl; ";
|
||||
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
@ -2132,6 +2191,44 @@ int main(int argc, char* argv[])
|
||||
std::cout << nPathLength << ", ";
|
||||
}
|
||||
}
|
||||
else if (sType == "Link")
|
||||
{
|
||||
nFlags = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
if (nFlags & (1 << 0))
|
||||
{
|
||||
std::cout << std::endl << "A ";
|
||||
ReadAction(pAnnots, i);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
if (nFlags & (1 << 1))
|
||||
{
|
||||
std::cout << std::endl << "PA ";
|
||||
ReadAction(pAnnots, i);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
if (nFlags & (1 << 2))
|
||||
{
|
||||
std::string arrHighlighting[] = {"none", "invert", "push", "outline"};
|
||||
nPathLength = READ_BYTE(pAnnots + i);
|
||||
i += 1;
|
||||
std::cout << "Highlight " << arrHighlighting[nPathLength] << ", ";
|
||||
}
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
std::cout << "QuadPoints";
|
||||
int nQuadPointsLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
|
||||
for (int j = 0; j < nQuadPointsLength; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << " " << (double)nPathLength / 100.0;
|
||||
}
|
||||
std::cout << ", ";
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << std::endl << "]" << std::endl;
|
||||
}
|
||||
@ -2154,12 +2251,13 @@ int main(int argc, char* argv[])
|
||||
free(pAnnotAP);
|
||||
}
|
||||
|
||||
// SCAN PAGE
|
||||
if (false)
|
||||
// SCAN PAGE Fonts
|
||||
if (true)
|
||||
{
|
||||
BYTE* pScan = ScanPage(pGrFile, nTestPage, 1);
|
||||
if (pScan)
|
||||
free(pScan);
|
||||
SetScanPageFonts(pGrFile, nTestPage);
|
||||
|
||||
ReadInteractiveFormsFonts(pGrFile, 1);
|
||||
ReadInteractiveFormsFonts(pGrFile, 2);
|
||||
}
|
||||
|
||||
Close(pGrFile);
|
||||
|
||||
@ -121,7 +121,8 @@ METAFILE_PATH = $$PWD/../../raster/Metafile
|
||||
$$METAFILE_PATH/svg/SvgObjects/CFont.h \
|
||||
$$METAFILE_PATH/svg/SvgObjects/CStyle.h \
|
||||
$$METAFILE_PATH/svg/SvgObjects/CObjectBase.h \
|
||||
$$METAFILE_PATH/svg/SvgUtils.h
|
||||
$$METAFILE_PATH/svg/SvgUtils.h \
|
||||
$$METAFILE_PATH/svg/SvgReader.h
|
||||
|
||||
SOURCES += \
|
||||
$$METAFILE_PATH/svg/CSvgFile.cpp \
|
||||
@ -145,7 +146,8 @@ METAFILE_PATH = $$PWD/../../raster/Metafile
|
||||
$$METAFILE_PATH/svg/SvgObjects/CPolyline.cpp \
|
||||
$$METAFILE_PATH/svg/SvgObjects/CFont.cpp \
|
||||
$$METAFILE_PATH/svg/SvgObjects/CObjectBase.cpp \
|
||||
$$METAFILE_PATH/svg/SvgObjects/CStyle.cpp
|
||||
$$METAFILE_PATH/svg/SvgObjects/CStyle.cpp \
|
||||
$$METAFILE_PATH/svg/SvgReader.cpp
|
||||
|
||||
CONFIG += css_calculator_without_xhtml
|
||||
|
||||
|
||||
@ -63,9 +63,9 @@ public:
|
||||
|
||||
// Open
|
||||
virtual bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"") = 0;
|
||||
const wchar_t* owner_password = NULL, const wchar_t* user_password = NULL) = 0;
|
||||
virtual bool LoadFromMemory(unsigned char* data, unsigned long length, const std::wstring& options = L"",
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"") = 0;
|
||||
const wchar_t* owner_password = NULL, const wchar_t* user_password = NULL) = 0;
|
||||
|
||||
// Close
|
||||
virtual void Close() = 0;
|
||||
|
||||
@ -282,8 +282,7 @@ SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/JBig2File.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/PICFile.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/pic.cpp
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/PICFile.cpp
|
||||
|
||||
!build_xp {
|
||||
CONFIG += support_heif
|
||||
|
||||
@ -50,9 +50,9 @@ TEST(BooleanOperations, NoIntersOutside)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, NoIntersInside)
|
||||
@ -105,9 +105,9 @@ TEST(BooleanOperations, NoIntersInside)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, OneIntersOutside)
|
||||
@ -154,9 +154,9 @@ TEST(BooleanOperations, OneIntersOutside)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, OneIntersInside)
|
||||
@ -206,9 +206,9 @@ TEST(BooleanOperations, OneIntersInside)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, OverlapOutside)
|
||||
@ -258,9 +258,9 @@ TEST(BooleanOperations, OverlapOutside)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, OverlapInside)
|
||||
@ -312,9 +312,9 @@ TEST(BooleanOperations, OverlapInside)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, LineIntersLine)
|
||||
@ -368,9 +368,9 @@ TEST(BooleanOperations, LineIntersLine)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, CurveIntersLine)
|
||||
@ -415,9 +415,9 @@ TEST(BooleanOperations, CurveIntersLine)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, CurveIntersCurve)
|
||||
@ -453,9 +453,9 @@ TEST(BooleanOperations, CurveIntersCurve)
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, RectIntersRect)
|
||||
@ -508,9 +508,9 @@ TEST(BooleanOperations, RectIntersRect)
|
||||
resultSubtract.LineTo(55.0, 25.0);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, EllipseIntersEllipse)
|
||||
@ -550,9 +550,9 @@ TEST(BooleanOperations, EllipseIntersEllipse)
|
||||
resultSubtract.CurveTo(303.228, 82.0, 348.0, 126.772, 348.0, 182.0);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, EllipseIntersCross)
|
||||
@ -621,9 +621,9 @@ TEST(BooleanOperations, EllipseIntersCross)
|
||||
resultSubtract.CurveTo(188.228, 60, 233, 104.772, 233, 160);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, TriangleIntersEllipse)
|
||||
@ -665,9 +665,9 @@ TEST(BooleanOperations, TriangleIntersEllipse)
|
||||
resultSubtract.CurveTo(243.078, 286.812, 260.127, 260.386, 263.419, 229.839);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, TwoVerticesInters)
|
||||
@ -715,9 +715,9 @@ TEST(BooleanOperations, TwoVerticesInters)
|
||||
resultSubtract.LineTo(-300, -300);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, RectIntersEllipse)
|
||||
@ -773,9 +773,9 @@ TEST(BooleanOperations, RectIntersEllipse)
|
||||
resultSubtract.CurveTo(257.623, 242.785, 258.883, 240.478, 260, 238.092);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, RectIntersCross)
|
||||
@ -869,9 +869,9 @@ TEST(BooleanOperations, RectIntersCross)
|
||||
resultSubtract.LineTo(-89.5, 24);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, CrossIntersTriangle)
|
||||
@ -977,9 +977,9 @@ TEST(BooleanOperations, CrossIntersTriangle)
|
||||
resultSubtract.LineTo(-6, 3.5);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, CrossIntersCross)
|
||||
@ -1077,9 +1077,9 @@ TEST(BooleanOperations, CrossIntersCross)
|
||||
resultSubtract.LineTo(-72, -191);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, EllipseTouchEllipse)
|
||||
@ -1119,9 +1119,9 @@ TEST(BooleanOperations, EllipseTouchEllipse)
|
||||
resultSubtract.CurveTo(138.137, 237, 165, 210.137, 165, 177);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
TEST(BooleanOperations, TriangleOverlapTriangle)
|
||||
@ -1170,7 +1170,7 @@ TEST(BooleanOperations, TriangleOverlapTriangle)
|
||||
resultSubtract.LineTo(-200, -300);
|
||||
resultSubtract.CloseFigure();
|
||||
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection).Equals(resultIntersect));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union).Equals(resultUnite));
|
||||
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction).Equals(resultSubtract));
|
||||
}
|
||||
|
||||
@ -450,15 +450,15 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
if (CXIMAGE_FORMAR_PIC == m_nFileType)
|
||||
{
|
||||
PICT::CPictFile PIC;
|
||||
return PIC.Open(this, strFileName, !m_bIsRGBA);
|
||||
CPictFile pict_file;
|
||||
return pict_file.Open(this, strFileName, m_bIsRGBA);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CXIMAGE_SUPPORT_HEIF
|
||||
if (CXIMAGE_FORMAT_HEIF == m_nFileType)
|
||||
{
|
||||
return NSHeif::CHeifFile::Open(this, strFileName, m_bIsRGBA);
|
||||
return NSHeif::CHeifFile::Open(this, strFileName, m_bIsRGBA);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -540,8 +540,8 @@ bool CBgraFrame::Decode(BYTE* pBuffer, int nSize, unsigned int nFileType)
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
if (CXIMAGE_FORMAR_PIC == m_nFileType)
|
||||
{
|
||||
PICT::CPictFile PIC;
|
||||
return PIC.Open(this, pBuffer, nSize, !m_bIsRGBA);
|
||||
CPictFile pict_file;
|
||||
return pict_file.Open(this, pBuffer, nSize, m_bIsRGBA);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -202,6 +202,19 @@ bool CImageFileFormatChecker::isWbcFile(BYTE* pBuffer,DWORD dwBytes)
|
||||
|
||||
return false;
|
||||
}
|
||||
//raster graphics file format developed by Google
|
||||
bool CImageFileFormatChecker::isWebPFile(BYTE* pBuffer, DWORD dwBytes)
|
||||
{
|
||||
if (eFileType)return false;
|
||||
|
||||
if ((20 <= dwBytes) && ('R' == pBuffer[0] && 'I' == pBuffer[1] && 'F' == pBuffer[2] && 'F' == pBuffer[3]
|
||||
//4–7 length + 12
|
||||
&& 'W' == pBuffer[8] && 'E' == pBuffer[9] && 'B' == pBuffer[10] && 'P' == pBuffer[11])
|
||||
&& 'V' == pBuffer[12] && 'P' == pBuffer[13] && '8' == pBuffer[14])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
//webshot(wb ver 1) HEX 57 57 42 42 31 31 31 31
|
||||
//webshot (wb ver 2) HEX 00 00 02 00 02 10 c9 00 02 00 c8 06 4c 00 02 00
|
||||
bool CImageFileFormatChecker::isWbFile(BYTE* pBuffer,DWORD dwBytes)
|
||||
@ -509,6 +522,10 @@ bool CImageFileFormatChecker::isImageFile(const std::wstring& fileName)
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_WB;
|
||||
}
|
||||
else if (isWebPFile(buffer, sizeRead))
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_WEBP;
|
||||
}
|
||||
else if (isPsdFile(buffer,sizeRead))
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_PSD;
|
||||
|
||||
@ -64,6 +64,7 @@ enum __ENUM_CXIMAGE_FORMATS
|
||||
_CXIMAGE_FORMAT_SVG = 24,
|
||||
_CXIMAGE_FORMAT_PIC = 25,
|
||||
_CXIMAGE_FORMAT_HEIF = 26,
|
||||
_CXIMAGE_FORMAT_WEBP = 27
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CImageFileFormatChecker
|
||||
@ -96,6 +97,7 @@ public:
|
||||
bool isTiffFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isJpgFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isWbFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isWebPFile(BYTE* pBuffer, DWORD dwBytes);
|
||||
|
||||
bool isIcoFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isRasFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
|
||||
@ -53,7 +53,7 @@ namespace MetaFile
|
||||
virtual void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int nBlendMode) = 0;
|
||||
|
||||
virtual void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) = 0;
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) = 0;
|
||||
|
||||
virtual void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) = 0;
|
||||
|
||||
|
||||
@ -352,7 +352,7 @@ namespace MetaFile
|
||||
|
||||
}
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double _dX, double _dY, double* pDx, int iGraphicsMode, double dXScale, double dYScale)
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double _dX, double _dY, double* pDx, int iGraphicsMode, double dXScale, double dYScale, bool bUseGID)
|
||||
{
|
||||
CheckEndPath();
|
||||
const IFont* pFont = m_pFile->GetFont();
|
||||
@ -681,11 +681,12 @@ namespace MetaFile
|
||||
m_pRenderer->put_BrushColor1(m_pFile->GetTextColor());
|
||||
m_pRenderer->put_BrushAlpha1(255);
|
||||
|
||||
if (bUseGID)
|
||||
m_pRenderer->put_FontStringGID(TRUE);
|
||||
|
||||
// Рисуем сам текст
|
||||
if (NULL == pDx)
|
||||
{
|
||||
m_pRenderer->CommandDrawText(wsString, dX, dY, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int unUnicodeLen = 0;
|
||||
@ -704,6 +705,9 @@ namespace MetaFile
|
||||
}
|
||||
}
|
||||
|
||||
if (bUseGID)
|
||||
m_pRenderer->put_FontStringGID(FALSE);
|
||||
|
||||
if (bChangeCTM)
|
||||
m_pRenderer->ResetTransform();
|
||||
}
|
||||
@ -1233,7 +1237,7 @@ namespace MetaFile
|
||||
|
||||
// Вычисление минимально возможной ширины пера
|
||||
// # Код явялется дублированным из Graphics
|
||||
const double dSqrtDet = sqrt(abs(oMatrix.Determinant()));
|
||||
const double dSqrtDet = sqrt(fabs(oMatrix.Determinant()));
|
||||
const double dWidthMinSize = (dSqrtDet != 0) ? (1.0 / dSqrtDet) : dWidth;
|
||||
|
||||
if (0 == pPen->GetWidth())
|
||||
|
||||
@ -999,20 +999,21 @@ namespace MetaFile
|
||||
{
|
||||
std::wstring wsText;
|
||||
for (const wchar_t& wChar : wsString)
|
||||
if (wChar == L'<')
|
||||
{
|
||||
if (wChar == L'<')
|
||||
wsText += L"<";
|
||||
else if (wChar == L'>')
|
||||
else if (wChar == L'>')
|
||||
wsText += L">";
|
||||
else if (wChar == L'&')
|
||||
else if (wChar == L'&')
|
||||
wsText += L"&";
|
||||
else if (wChar == L'\'')
|
||||
else if (wChar == L'\'')
|
||||
wsText += L"'";
|
||||
else if (wChar == L'"')
|
||||
else if (wChar == L'"')
|
||||
wsText += L""";
|
||||
else if (wChar == L'\r' || (wChar >= 0x00 && wChar <=0x1F))
|
||||
continue;
|
||||
|
||||
else wsText += wChar;
|
||||
else wsText += wChar;
|
||||
}
|
||||
return wsText;
|
||||
}
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ namespace MetaFile
|
||||
void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int unBlendMode) override {};
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override {};
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override {};
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override {};
|
||||
|
||||
|
||||
@ -80,10 +80,10 @@ namespace MetaFile
|
||||
}
|
||||
|
||||
void CEmfInterpretatorArray::DrawString(std::wstring &wsText, unsigned int unCharsCount, double dX, double dY, double *pDx,
|
||||
int iGraphicsMode, double dXScale, double dYScale)
|
||||
int iGraphicsMode, double dXScale, double dYScale, bool bUseGID)
|
||||
{
|
||||
for (CEmfInterpretatorBase* pInterpretator : m_arInterpretators)
|
||||
pInterpretator->DrawString(wsText, unCharsCount, dX, dY, pDx, iGraphicsMode, dXScale, dYScale);
|
||||
pInterpretator->DrawString(wsText, unCharsCount, dX, dY, pDx, iGraphicsMode, dXScale, dYScale, bUseGID);
|
||||
}
|
||||
|
||||
void CEmfInterpretatorArray::DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints)
|
||||
|
||||
@ -36,7 +36,7 @@ namespace MetaFile
|
||||
void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int unBlendMode) override;
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override;
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override;
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override;
|
||||
|
||||
|
||||
@ -41,10 +41,10 @@ namespace MetaFile
|
||||
}
|
||||
|
||||
void CEmfInterpretatorRender::DrawString(std::wstring &wsText, unsigned int unCharsCount, double dX, double dY, double *pDx,
|
||||
int iGraphicsMode, double dXScale, double dYScale)
|
||||
int iGraphicsMode, double dXScale, double dYScale, bool bUseGID)
|
||||
{
|
||||
if (NULL != m_pMetaFileRenderer)
|
||||
m_pMetaFileRenderer->DrawString(wsText, unCharsCount, dX, dY, pDx, iGraphicsMode, dXScale, dYScale);
|
||||
m_pMetaFileRenderer->DrawString(wsText, unCharsCount, dX, dY, pDx, iGraphicsMode, dXScale, dYScale, bUseGID);
|
||||
}
|
||||
|
||||
void CEmfInterpretatorRender::DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints)
|
||||
|
||||
@ -22,7 +22,7 @@ namespace MetaFile
|
||||
void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int unBlendMode) override;
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override;
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override;
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override;
|
||||
|
||||
|
||||
@ -346,7 +346,7 @@ namespace MetaFile
|
||||
if (NULL != oTEmfExtTextoutA.oEmrText.pOutputDx)
|
||||
arDx = std::vector<double>(oTEmfExtTextoutA.oEmrText.pOutputDx, oTEmfExtTextoutA.oEmrText.pOutputDx + oTEmfExtTextoutA.oEmrText.unChars);
|
||||
|
||||
WriteText(wsText, TPointD(oTEmfExtTextoutA.oEmrText.oReference.X, oTEmfExtTextoutA.oEmrText.oReference.Y), oTEmfExtTextoutA.oBounds, TPointD(oTEmfExtTextoutA.dExScale, oTEmfExtTextoutA.dEyScale), arDx);
|
||||
WriteText(wsText, TPointD(oTEmfExtTextoutA.oEmrText.oReference.X, oTEmfExtTextoutA.oEmrText.oReference.Y), oTEmfExtTextoutA.oBounds, TPointD(oTEmfExtTextoutA.dExScale, oTEmfExtTextoutA.dEyScale), arDx, oTEmfExtTextoutA.oEmrText.unOptions & 0x00000010);
|
||||
}
|
||||
|
||||
void CEmfInterpretatorSvg::HANDLE_EMR_EXTTEXTOUTW(const TEmfExtTextoutW &oTEmfExtTextoutW)
|
||||
@ -358,7 +358,7 @@ namespace MetaFile
|
||||
if (NULL != oTEmfExtTextoutW.oEmrText.pOutputDx)
|
||||
arDx = std::vector<double>(oTEmfExtTextoutW.oEmrText.pOutputDx, oTEmfExtTextoutW.oEmrText.pOutputDx + oTEmfExtTextoutW.oEmrText.unChars);
|
||||
|
||||
WriteText(wsText, TPointD(oTEmfExtTextoutW.oEmrText.oReference.X, oTEmfExtTextoutW.oEmrText.oReference.Y), oTEmfExtTextoutW.oBounds, TPointD(oTEmfExtTextoutW.dExScale, oTEmfExtTextoutW.dEyScale), arDx);
|
||||
WriteText(wsText, TPointD(oTEmfExtTextoutW.oEmrText.oReference.X, oTEmfExtTextoutW.oEmrText.oReference.Y), oTEmfExtTextoutW.oBounds, TPointD(oTEmfExtTextoutW.dExScale, oTEmfExtTextoutW.dEyScale), arDx, oTEmfExtTextoutW.oEmrText.unOptions & 0x00000010);
|
||||
}
|
||||
|
||||
void CEmfInterpretatorSvg::HANDLE_EMR_LINETO(const TPointL &oPoint)
|
||||
|
||||
@ -202,7 +202,7 @@ namespace MetaFile
|
||||
void End() override {};
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override {};
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override {};
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override {};
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ namespace MetaFile
|
||||
void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int unBlendMode) override {};
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override {};
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override {};
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override {};
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ namespace MetaFile
|
||||
}
|
||||
|
||||
void CEmfParserBase::DrawText(std::wstring &wsString, unsigned int unCharsCount, int _nX, int _nY,
|
||||
int *pnDx, int iGraphicsMode, TScale oScale)
|
||||
int *pnDx, int iGraphicsMode, TScale oScale, bool bUseGID)
|
||||
{
|
||||
int nX = _nX;
|
||||
int nY = _nY;
|
||||
@ -448,7 +448,7 @@ namespace MetaFile
|
||||
}
|
||||
}
|
||||
|
||||
m_pInterpretator->DrawString(wsString, unCharsCount, dX, dY, pdDx, iGraphicsMode, oScale.X, oScale.Y);
|
||||
m_pInterpretator->DrawString(wsString, unCharsCount, dX, dY, pdDx, iGraphicsMode, oScale.X, oScale.Y, bUseGID);
|
||||
|
||||
if (pdDx)
|
||||
delete[] pdDx;
|
||||
@ -480,7 +480,7 @@ namespace MetaFile
|
||||
}
|
||||
}
|
||||
|
||||
DrawText(wsText, oText.unChars, oText.oReference.X, oText.oReference.Y, pDx, iGraphicsMode, oScale);
|
||||
DrawText(wsText, oText.unChars, oText.oReference.X, oText.oReference.Y, pDx, iGraphicsMode, oScale, oText.unOptions & 0x00000010);
|
||||
|
||||
if (pDx)
|
||||
delete[] pDx;
|
||||
@ -550,7 +550,7 @@ namespace MetaFile
|
||||
}
|
||||
|
||||
if (unLen)
|
||||
DrawText(wsText, unLen, oText.oReference.X, oText.oReference.Y, pDx, iGraphicsMode, oScale);
|
||||
DrawText(wsText, unLen, oText.oReference.X, oText.oReference.Y, pDx, iGraphicsMode, oScale, oText.unOptions & 0x00000010);
|
||||
|
||||
if (pDx)
|
||||
delete[] pDx;
|
||||
|
||||
@ -156,7 +156,7 @@ namespace MetaFile
|
||||
void ArcTo(int nL, int nT, int nR, int nB, double dStart, double dSweep);
|
||||
|
||||
void DrawPath(bool bStroke, bool bFill, bool bClosePath = true);
|
||||
void DrawText(std::wstring &wsString, unsigned int unCharsCount, int _nX, int _nY, int *pnDx, int iGraphicsMode, TScale oScale);
|
||||
void DrawText(std::wstring &wsString, unsigned int unCharsCount, int _nX, int _nY, int *pnDx, int iGraphicsMode, TScale oScale, bool bUseGID);
|
||||
void DrawTextA(TEmrTextA &oText, int iGraphicsMode, TScale oScale = TScale(1, 1));
|
||||
void DrawTextW(TEmrTextW &oText, int iGraphicsMode, TScale oScale = TScale(1, 1));
|
||||
|
||||
|
||||
@ -68,6 +68,10 @@ namespace MetaFile
|
||||
#ifdef METAFILE_SUPPORT_SVM
|
||||
m_oSvmFile.SetFontManager(m_pFontManager);
|
||||
#endif
|
||||
|
||||
#ifdef METAFILE_SUPPORT_SVG
|
||||
m_oSvgFile.SetFontManager(m_pFontManager);
|
||||
#endif
|
||||
m_lType = 0;
|
||||
}
|
||||
|
||||
@ -84,7 +88,6 @@ namespace MetaFile
|
||||
|
||||
std::wstring CMetaFile::ConvertToSvg(unsigned int unWidth, unsigned int unHeight)
|
||||
{
|
||||
|
||||
#ifdef METAFILE_SUPPORT_WMF_EMF
|
||||
if (c_lMetaWmf == m_lType)
|
||||
{
|
||||
|
||||
@ -217,15 +217,23 @@ namespace MetaFile
|
||||
m_pXmlWriter->WriteNodeEnd(wsNodeName, false, false);
|
||||
}
|
||||
|
||||
void CInterpretatorSvgBase::WriteText(const std::wstring &wsText, const TPointD &oCoord, const TRectL &oBounds, const TPointD &oScale, const std::vector<double>& arDx)
|
||||
void UpdateStringByGID(std::wstring &wsValue, const std::wstring& wsFontName, const double& dFontSize, const int& nFontStyle, NSFonts::IFontManager* pFontManeger)
|
||||
{
|
||||
if (nullptr == pFontManeger)
|
||||
return;
|
||||
|
||||
pFontManeger->LoadFontByName(wsFontName, dFontSize, nFontStyle, 96, 96);
|
||||
|
||||
for (wchar_t& wChar : wsValue)
|
||||
wChar = (wchar_t)pFontManeger->GetUnicodeByGID(wChar);
|
||||
}
|
||||
|
||||
void CInterpretatorSvgBase::WriteText(const std::wstring &wsText, const TPointD &oCoord, const TRectL &oBounds, const TPointD &oScale, const std::vector<double>& arDx, bool bUseGID)
|
||||
{
|
||||
if (NULL == m_pParser || NULL == m_pParser->GetFont())
|
||||
return;
|
||||
|
||||
const std::wstring wsNormalizedText = StringNormalization(wsText);
|
||||
|
||||
if (wsNormalizedText.empty())
|
||||
return;
|
||||
std::wstring wsNormalizedText{wsText};
|
||||
|
||||
AddClip();
|
||||
|
||||
@ -298,6 +306,22 @@ namespace MetaFile
|
||||
oFontName.WriteEncodeXmlString(pFontInfo->m_wsFontName);
|
||||
oFontName.WriteEncodeXmlString(L"\'");
|
||||
}
|
||||
|
||||
if (bUseGID)
|
||||
{
|
||||
int nStyle = 0;
|
||||
if (pFont->GetWeight() > 550)
|
||||
nStyle |= 0x01;
|
||||
if (pFont->IsItalic())
|
||||
nStyle |= 0x02;
|
||||
if (pFont->IsUnderline())
|
||||
nStyle |= (1 << 2);
|
||||
if (pFont->IsStrikeOut())
|
||||
nStyle |= (1 << 7);
|
||||
|
||||
UpdateStringByGID(wsNormalizedText, (NULL != pFontInfo) ? pFontInfo->m_wsFontName : pFont->GetFaceName(),
|
||||
dFontHeight, nStyle, m_pParser->GetFontManager());
|
||||
}
|
||||
#endif
|
||||
arNodeAttributes.Add(L"font-family", oFontName.GetData());
|
||||
}
|
||||
@ -424,7 +448,7 @@ namespace MetaFile
|
||||
arNodeAttributes.Add(L"x", wsXCoord);
|
||||
arNodeAttributes.Add(L"y", dYCoord);
|
||||
|
||||
WriteNode(L"text", arNodeAttributes, wsNormalizedText);
|
||||
WriteNode(L"text", arNodeAttributes, StringNormalization(wsNormalizedText));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -436,7 +460,7 @@ namespace MetaFile
|
||||
do
|
||||
{
|
||||
WriteNode(L"tspan", {{L"x", wsXCoord},
|
||||
{L"y", ConvertToWString(dYNewCoord)}}, wsNormalizedText.substr(unStart, unPosLineBreak - unStart));
|
||||
{L"y", ConvertToWString(dYNewCoord)}}, StringNormalization(wsNormalizedText.substr(unStart, unPosLineBreak - unStart)));
|
||||
|
||||
dYNewCoord += dFontHeight * 1.6;
|
||||
unStart = wsNormalizedText.find_first_not_of(L"\n", unPosLineBreak);
|
||||
|
||||
@ -106,7 +106,7 @@ namespace MetaFile
|
||||
void WriteNode(const std::wstring& wsNodeName, const NodeAttributes& arAttributes, const std::wstring& wsValueNode = L"");
|
||||
void WriteNodeBegin(const std::wstring& wsNodeName, const NodeAttributes& arAttributes);
|
||||
void WriteNodeEnd(const std::wstring& wsNodeName);
|
||||
void WriteText(const std::wstring& wsText, const TPointD& oCoord, const TRectL& oBounds = TRectL(), const TPointD& oScale = TPointD(1, 1), const std::vector<double>& arDx = {});
|
||||
void WriteText(const std::wstring& wsText, const TPointD& oCoord, const TRectL& oBounds = TRectL(), const TPointD& oScale = TPointD(1, 1), const std::vector<double>& arDx = {}, bool bUseGID = false);
|
||||
|
||||
void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int unBlendMode) override;
|
||||
|
||||
|
||||
@ -29,10 +29,10 @@ namespace MetaFile
|
||||
}
|
||||
|
||||
void CWmfInterpretatorRender::DrawString(std::wstring &wsText, unsigned int unCharsCount, double dX, double dY, double *pDx,
|
||||
int iGraphicsMode, double dXScale, double dYScale)
|
||||
int iGraphicsMode, double dXScale, double dYScale, bool bUseGID)
|
||||
{
|
||||
if (NULL != m_pMetaFileRenderer)
|
||||
m_pMetaFileRenderer->DrawString(wsText, unCharsCount, dX, dY, pDx, iGraphicsMode, dXScale, dYScale);
|
||||
m_pMetaFileRenderer->DrawString(wsText, unCharsCount, dX, dY, pDx, iGraphicsMode, dXScale, dYScale, bUseGID);
|
||||
}
|
||||
|
||||
void CWmfInterpretatorRender::DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints)
|
||||
|
||||
@ -19,7 +19,7 @@ namespace MetaFile
|
||||
void DrawBitmap(double dX, double dY, double dW, double dH, BYTE* pBuffer, unsigned int unWidth, unsigned int unHeight, unsigned int unBlendMode) override;
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override;
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override;
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override;
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ namespace MetaFile
|
||||
void End() override {};
|
||||
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double dX, double dY, double* pDx,
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1) override {};
|
||||
int iGraphicsMode = 1, double dXScale = 1, double dYScale = 1, bool bUseGID = false) override {};
|
||||
|
||||
void DrawDriverString(const std::wstring& wsString, const std::vector<TPointD>& arPoints) override {};
|
||||
|
||||
|
||||
@ -1740,8 +1740,8 @@ namespace MetaFile
|
||||
const TRectL& oEmfRect{oEmfParser.GetDCBounds()};
|
||||
const TRectL& oCurentRect{GetDCBounds()};
|
||||
|
||||
const double dScaleX = std::abs((oCurentRect.Right - oCurentRect.Left) / (oEmfRect.Right - oEmfRect.Left));
|
||||
const double dScaleY = std::abs((oCurentRect.Bottom - oCurentRect.Top) / (oEmfRect.Bottom - oEmfRect.Top));
|
||||
const double dScaleX = std::abs((double)(oCurentRect.Right - oCurentRect.Left) / (double)(oEmfRect.Right - oEmfRect.Left));
|
||||
const double dScaleY = std::abs((double)(oCurentRect.Bottom - oCurentRect.Top) / (double)(oEmfRect.Bottom - oEmfRect.Top));
|
||||
|
||||
const bool bAddGElement = !Equals(1., dScaleX) || !Equals(1., dScaleY);
|
||||
|
||||
|
||||
@ -3,11 +3,13 @@
|
||||
#include "SvgObjects/CContainer.h"
|
||||
#include "SvgObjects/CFont.h"
|
||||
|
||||
#include "CSvgParser.h"
|
||||
|
||||
#define SVG_FILE_WIDTH 300
|
||||
#define SVG_FILE_HEIGHT 150
|
||||
|
||||
CSvgFile::CSvgFile()
|
||||
: m_oContainer(L"svg")
|
||||
: m_pContainer(NULL), m_pFontManager(NULL)
|
||||
{}
|
||||
|
||||
CSvgFile::~CSvgFile()
|
||||
@ -24,7 +26,10 @@ bool CSvgFile::ReadFromBuffer(BYTE *pBuffer, unsigned int unSize)
|
||||
bool CSvgFile::ReadFromWString(const std::wstring &wsContext)
|
||||
{
|
||||
Clear();
|
||||
return m_oParser.LoadFromString(wsContext, &m_oContainer, this);
|
||||
|
||||
SVG::CSvgParser oSvgParser(m_pFontManager);
|
||||
|
||||
return oSvgParser.LoadFromString(wsContext, m_pContainer, this);
|
||||
}
|
||||
|
||||
bool CSvgFile::OpenFromFile(const std::wstring &wsFile)
|
||||
@ -33,58 +38,14 @@ bool CSvgFile::OpenFromFile(const std::wstring &wsFile)
|
||||
|
||||
m_wsWorkingDirectory = NSFile::GetDirectoryName(wsFile);
|
||||
|
||||
return m_oParser.LoadFromFile(wsFile, &m_oContainer, this);
|
||||
SVG::CSvgParser oSvgParser(m_pFontManager);
|
||||
|
||||
return oSvgParser.LoadFromFile(wsFile, m_pContainer, this);
|
||||
}
|
||||
|
||||
bool CSvgFile::GetBounds(double &dX, double &dY, double &dWidth, double &dHeight) const
|
||||
{
|
||||
if (m_oContainer.Empty())
|
||||
return false;
|
||||
|
||||
SVG::TRect oWindow = m_oContainer.GetWindow();
|
||||
|
||||
dX = oWindow.m_oX.ToDouble(NSCSS::Pixel, SVG_FILE_WIDTH);
|
||||
dY = oWindow.m_oY.ToDouble(NSCSS::Pixel, SVG_FILE_HEIGHT);
|
||||
|
||||
dWidth = 0.;
|
||||
dHeight = 0.;
|
||||
|
||||
if (!oWindow.m_oWidth.Empty() && !oWindow.m_oWidth.Zero())
|
||||
{
|
||||
if (NSCSS::Percent == oWindow.m_oWidth.GetUnitMeasure())
|
||||
{
|
||||
if (!m_oContainer.GetViewBox().m_oWidth.Empty() && !m_oContainer.GetViewBox().m_oWidth.Zero())
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, m_oContainer.GetViewBox().m_oWidth.ToDouble(NSCSS::Pixel));
|
||||
else
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, SVG_FILE_WIDTH);
|
||||
}
|
||||
else
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel);
|
||||
}
|
||||
else
|
||||
dWidth = m_oContainer.GetViewBox().m_oWidth.ToDouble(NSCSS::Pixel);
|
||||
|
||||
if (!oWindow.m_oHeight.Empty() && !oWindow.m_oHeight.Zero())
|
||||
{
|
||||
if (NSCSS::Percent == oWindow.m_oHeight.GetUnitMeasure())
|
||||
{
|
||||
if (!m_oContainer.GetViewBox().m_oHeight.Empty() && !m_oContainer.GetViewBox().m_oHeight.Zero())
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, m_oContainer.GetViewBox().m_oHeight.ToDouble(NSCSS::Pixel));
|
||||
else
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, SVG_FILE_WIDTH);
|
||||
}
|
||||
else
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel);
|
||||
}
|
||||
else
|
||||
dHeight = m_oContainer.GetViewBox().m_oHeight.ToDouble(NSCSS::Pixel);
|
||||
|
||||
if (DBL_EPSILON > dWidth)
|
||||
dWidth = SVG_FILE_WIDTH;
|
||||
if (DBL_EPSILON > dHeight)
|
||||
dHeight = SVG_FILE_HEIGHT;
|
||||
|
||||
return true;
|
||||
return CalculateFinalSize(true, dX, dY, dWidth, dHeight);
|
||||
}
|
||||
|
||||
const SVG::CSvgCalculator *CSvgFile::GetSvgCalculator() const
|
||||
@ -94,7 +55,7 @@ const SVG::CSvgCalculator *CSvgFile::GetSvgCalculator() const
|
||||
|
||||
void CSvgFile::SetFontManager(NSFonts::IFontManager *pFontManager)
|
||||
{
|
||||
m_oParser.SetFontManager(pFontManager);
|
||||
m_pFontManager = pFontManager;
|
||||
}
|
||||
|
||||
void CSvgFile::SetWorkingDirectory(const std::wstring &wsWorkingDirectory)
|
||||
@ -107,7 +68,13 @@ bool CSvgFile::MarkObject(SVG::CObject *pObject)
|
||||
if (NULL == pObject || pObject->GetId().empty())
|
||||
return false;
|
||||
|
||||
pObject->AddRef();
|
||||
pObject->Mark();
|
||||
|
||||
const MarkedMap::const_iterator itFound = m_mMarkedObjects.find(pObject->GetId());
|
||||
|
||||
if (m_mMarkedObjects.cend() != itFound)
|
||||
RELEASEINTERFACE(m_mMarkedObjects[pObject->GetId()])
|
||||
|
||||
m_mMarkedObjects[pObject->GetId()] = pObject;
|
||||
|
||||
return true;
|
||||
@ -160,69 +127,41 @@ void CSvgFile::AddFontFace(const SVG::TFontArguments& oArguments, const std::wst
|
||||
|
||||
bool CSvgFile::Draw(IRenderer *pRenderer, double dX, double dY, double dWidth, double dHeight)
|
||||
{
|
||||
if (NULL == pRenderer || m_oContainer.Empty())
|
||||
if (NULL == pRenderer || NULL == m_pContainer || m_pContainer->Empty())
|
||||
return false;
|
||||
|
||||
SVG::TRect oWindow = m_oContainer.GetWindow();
|
||||
SVG::TRect oViewBox = m_oContainer.GetViewBox();
|
||||
double dFileX, dFileY, dFileWidth, dFileHeight;
|
||||
|
||||
if (oWindow.m_oWidth.Empty() || oWindow.m_oWidth.Zero())
|
||||
{
|
||||
if (oViewBox.m_oWidth.Empty() || oViewBox.m_oWidth.Zero())
|
||||
oWindow.m_oWidth = SVG_FILE_WIDTH;
|
||||
else
|
||||
{
|
||||
oWindow.m_oWidth = oViewBox.m_oWidth;
|
||||
oViewBox.m_oWidth.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (oWindow.m_oHeight.Empty() || oWindow.m_oHeight.Zero())
|
||||
{
|
||||
if (oViewBox.m_oHeight.Empty() || oViewBox.m_oHeight.Zero())
|
||||
oWindow.m_oHeight = SVG_FILE_HEIGHT;
|
||||
else
|
||||
{
|
||||
oWindow.m_oHeight = oViewBox.m_oHeight;
|
||||
oViewBox.m_oHeight.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
double dViewBoxWidth = oViewBox.m_oWidth.ToDouble(NSCSS::Pixel, SVG_FILE_WIDTH);
|
||||
double dViewBoxHeight = oViewBox.m_oHeight.ToDouble(NSCSS::Pixel, SVG_FILE_HEIGHT);
|
||||
|
||||
double dWindowWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, dViewBoxWidth);
|
||||
double dWindowHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, dViewBoxHeight);
|
||||
|
||||
if (SVG::Equals(0., dWindowWidth) || SVG::Equals(0., dWindowHeight))
|
||||
if (!CalculateFinalSize(false, dFileX, dFileY, dFileWidth, dFileHeight))
|
||||
return false;
|
||||
|
||||
double oldTransform[6];
|
||||
oldTransform[0] = oldTransform[3] = 1;
|
||||
oldTransform[1] = oldTransform[2] = oldTransform[4] = oldTransform[5] = 0;
|
||||
|
||||
pRenderer->GetTransform(&oldTransform[0], &oldTransform[1], &oldTransform[2], &oldTransform[3], &oldTransform[4], &oldTransform[5]);
|
||||
pRenderer->ResetTransform();
|
||||
|
||||
double dM11 = dWidth / dWindowWidth;
|
||||
double dM22 = dHeight / dWindowHeight;
|
||||
const double dM11 = dWidth / dFileWidth;
|
||||
const double dM22 = dHeight / dFileHeight;
|
||||
|
||||
double dScaleX = 1, dScaleY = 1;
|
||||
double dScaleX = 1.,
|
||||
dScaleY = 1.;
|
||||
double dTranslateX = dFileX * dM11,
|
||||
dTranslateY = dFileY * dM22;
|
||||
|
||||
if (!SVG::Equals(0., dViewBoxWidth))
|
||||
dScaleX = dWindowWidth / dViewBoxWidth;
|
||||
const SVG::TRect oViewBox{m_pContainer->GetViewBox()};
|
||||
|
||||
if (!SVG::Equals(0., dViewBoxHeight))
|
||||
dScaleY = dWindowHeight / dViewBoxHeight;
|
||||
if (!oViewBox.m_oWidth.Empty() && !oViewBox.m_oHeight.Empty())
|
||||
{
|
||||
dScaleX = dFileWidth / oViewBox.m_oWidth .ToDouble(NSCSS::Pixel, SVG_FILE_WIDTH );
|
||||
dScaleY = dFileHeight / oViewBox.m_oHeight.ToDouble(NSCSS::Pixel, SVG_FILE_HEIGHT);
|
||||
|
||||
double dMinScale = std::min(dScaleX, dScaleY);
|
||||
dTranslateX -= oViewBox.m_oX.ToDouble(NSCSS::Pixel) * dScaleX * dM11;
|
||||
dTranslateY -= oViewBox.m_oY.ToDouble(NSCSS::Pixel) * dScaleY * dM22;
|
||||
}
|
||||
|
||||
double dSkipX = -oViewBox.m_oX.ToDouble(NSCSS::Pixel) * dScaleX * dM11;
|
||||
double dSkipY = -oViewBox.m_oY.ToDouble(NSCSS::Pixel) * dScaleY * dM22;
|
||||
pRenderer->SetTransform(dM11 * dScaleX, 0, 0, dM22 * dScaleY, dTranslateX, dTranslateY);
|
||||
|
||||
pRenderer->SetTransform(dM11 * dMinScale, 0, 0, dM22 * dMinScale, dSkipX, dSkipY);
|
||||
|
||||
bool bResult = m_oContainer.Draw(pRenderer, this);
|
||||
bool bResult = m_pContainer->Draw(pRenderer, this);
|
||||
|
||||
pRenderer->SetTransform(oldTransform[0], oldTransform[1], oldTransform[2], oldTransform[3], oldTransform[4], oldTransform[5]);
|
||||
|
||||
@ -231,7 +170,7 @@ bool CSvgFile::Draw(IRenderer *pRenderer, double dX, double dY, double dWidth, d
|
||||
|
||||
void CSvgFile::Clear()
|
||||
{
|
||||
m_oContainer.Clear();
|
||||
RELEASEINTERFACE(m_pContainer);
|
||||
m_oSvgCalculator.Clear();
|
||||
|
||||
for (MarkedMap::reference oIter : m_mMarkedObjects)
|
||||
@ -240,3 +179,141 @@ void CSvgFile::Clear()
|
||||
m_mMarkedObjects.clear();
|
||||
m_wsWorkingDirectory.clear();
|
||||
}
|
||||
|
||||
bool CSvgFile::CalculateFinalSize(bool bUseViewBox, double& dX, double& dY, double& dWidth, double& dHeight) const
|
||||
{
|
||||
if (NULL == m_pContainer || m_pContainer->Empty())
|
||||
return false;
|
||||
|
||||
const SVG::TRect oWindow = m_pContainer->GetWindow();
|
||||
const SVG::TRect oViewBox = m_pContainer->GetViewBox();
|
||||
|
||||
const double dViewBoxWidth {oViewBox.m_oWidth .ToDouble()};
|
||||
const double dViewBoxHeigth{oViewBox.m_oHeight.ToDouble()};
|
||||
|
||||
dX = 0.;
|
||||
dY = 0.;
|
||||
|
||||
dWidth = 0.;
|
||||
dHeight = 0.;
|
||||
|
||||
#define GET_PREV_WIDTH_VALUE ((NSCSS::UnitMeasure::Em == oWindow.m_oWidth.GetUnitMeasure() || NSCSS::UnitMeasure::Rem == oWindow.m_oWidth.GetUnitMeasure()) ? DEFAULT_FONT_SIZE : ((!SVG::Equals(0., dViewBoxWidth )) ? dViewBoxWidth : SVG_FILE_WIDTH))
|
||||
#define GET_PREV_HEIGHT_VALUE ((NSCSS::UnitMeasure::Em == oWindow.m_oHeight.GetUnitMeasure() || NSCSS::UnitMeasure::Rem == oWindow.m_oHeight.GetUnitMeasure()) ? DEFAULT_FONT_SIZE : ((!SVG::Equals(0., dViewBoxHeigth )) ? dViewBoxHeigth : SVG_FILE_HEIGHT))
|
||||
|
||||
if (!oWindow.m_oWidth.Empty() && !oWindow.m_oHeight.Empty())
|
||||
{
|
||||
dWidth = oWindow.m_oWidth .ToDouble(NSCSS::Pixel, GET_PREV_WIDTH_VALUE);
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, GET_PREV_HEIGHT_VALUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bUseViewBox)
|
||||
{
|
||||
if (!oViewBox.m_oWidth.Empty() && !oViewBox.m_oHeight.Empty())
|
||||
{
|
||||
if (!oWindow.m_oWidth.Empty())
|
||||
{
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, GET_PREV_WIDTH_VALUE);
|
||||
const double dAspectRatio{dViewBoxWidth / dViewBoxHeigth};
|
||||
dHeight = dWidth / dAspectRatio;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!oWindow.m_oHeight.Empty())
|
||||
{
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, GET_PREV_HEIGHT_VALUE);
|
||||
const double dAspectRatio{dViewBoxWidth / dViewBoxHeigth};
|
||||
dWidth = dHeight * dAspectRatio;
|
||||
return true;
|
||||
}
|
||||
|
||||
dX = oViewBox.m_oX.ToDouble();
|
||||
dY = oViewBox.m_oY.ToDouble();
|
||||
|
||||
dWidth = dViewBoxWidth;
|
||||
dHeight = dViewBoxHeigth;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!oWindow.m_oWidth.Empty() || !oWindow.m_oHeight.Empty())
|
||||
{
|
||||
if (!oViewBox.m_oWidth.Empty() && !oViewBox.m_oHeight.Empty())
|
||||
{
|
||||
const double dAspectRatio{dViewBoxWidth / dViewBoxHeigth};
|
||||
|
||||
if (!oWindow.m_oWidth.Empty())
|
||||
{
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, GET_PREV_WIDTH_VALUE);
|
||||
dHeight = dWidth / dAspectRatio;
|
||||
}
|
||||
else if (!oWindow.m_oHeight.Empty())
|
||||
{
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, GET_PREV_HEIGHT_VALUE);
|
||||
dWidth = dHeight * dAspectRatio;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NULL != m_pContainer && !m_pContainer->Empty())
|
||||
{
|
||||
SVG::SvgMatrix oTransform;
|
||||
const SVG::TBounds oBounds{m_pContainer->GetBounds(&oTransform)};
|
||||
|
||||
const double dContentWidth {oBounds.m_dRight - oBounds.m_dLeft};
|
||||
const double dContentHeight{oBounds.m_dBottom - oBounds.m_dTop };
|
||||
|
||||
const double dAspectRatio{dContentWidth / dContentHeight};
|
||||
|
||||
if (!oWindow.m_oWidth.Empty())
|
||||
{
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, GET_PREV_WIDTH_VALUE);
|
||||
dHeight = dWidth / dAspectRatio;
|
||||
}
|
||||
else if (!oWindow.m_oHeight.Empty())
|
||||
{
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, GET_PREV_HEIGHT_VALUE);
|
||||
dWidth = dHeight * dAspectRatio;
|
||||
}
|
||||
|
||||
dX = oBounds.m_dLeft;
|
||||
dY = oBounds.m_dTop;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!oWindow.m_oWidth.Empty())
|
||||
{
|
||||
dWidth = oWindow.m_oWidth.ToDouble(NSCSS::Pixel, GET_PREV_WIDTH_VALUE);
|
||||
dHeight = SVG_FILE_HEIGHT;
|
||||
}
|
||||
else if (!oWindow.m_oHeight.Empty())
|
||||
{
|
||||
dHeight = oWindow.m_oHeight.ToDouble(NSCSS::Pixel, GET_PREV_HEIGHT_VALUE);
|
||||
dWidth = SVG_FILE_WIDTH;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NULL != m_pContainer && !m_pContainer->Empty())
|
||||
{
|
||||
SVG::SvgMatrix oTransform;
|
||||
const SVG::TBounds oBounds{m_pContainer->GetBounds(&oTransform)};
|
||||
|
||||
dX = oBounds.m_dLeft;
|
||||
dY = oBounds.m_dTop;
|
||||
|
||||
dWidth = oBounds.m_dRight - oBounds.m_dLeft;
|
||||
dHeight = oBounds.m_dBottom - oBounds.m_dTop;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
dWidth = SVG_FILE_WIDTH;
|
||||
dHeight = SVG_FILE_HEIGHT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
#include "../../../graphics/IRenderer.h"
|
||||
#include "../../../graphics/pro/Fonts.h"
|
||||
|
||||
#include "CSvgParser.h"
|
||||
#include "SvgObjects/CStyle.h"
|
||||
|
||||
namespace SVG
|
||||
{
|
||||
struct TFontArguments;
|
||||
class CFont;
|
||||
class CGraphicsContainer;
|
||||
}
|
||||
|
||||
class CSvgFile
|
||||
@ -43,9 +43,11 @@ class CSvgFile
|
||||
private:
|
||||
void Clear();
|
||||
|
||||
SVG::CSvgParser m_oParser;
|
||||
SVG::CGraphicsContainer m_oContainer;
|
||||
bool CalculateFinalSize(bool bUseViewBox, double& dX, double& dY, double& dWidth, double& dHeight) const;
|
||||
|
||||
SVG::CGraphicsContainer *m_pContainer;
|
||||
SVG::CSvgCalculator m_oSvgCalculator;
|
||||
NSFonts::IFontManager *m_pFontManager;
|
||||
|
||||
typedef std::map<std::wstring, SVG::CObject*> MarkedMap;
|
||||
|
||||
|
||||
@ -24,16 +24,16 @@
|
||||
#include "SvgObjects/CMask.h"
|
||||
#include "SvgObjects/CUse.h"
|
||||
|
||||
#include "../../../../Common/3dParty/html/css/src/StaticFunctions.h"
|
||||
|
||||
namespace SVG
|
||||
{
|
||||
CSvgParser::CSvgParser()
|
||||
: m_pFontManager(NULL)
|
||||
{
|
||||
}
|
||||
CSvgParser::CSvgParser(NSFonts::IFontManager* pFontManager)
|
||||
: m_pFontManager(pFontManager)
|
||||
{}
|
||||
|
||||
CSvgParser::~CSvgParser()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void CSvgParser::SetFontManager(NSFonts::IFontManager *pFontManager)
|
||||
{
|
||||
@ -74,7 +74,7 @@ namespace SVG
|
||||
return std::string(itEncodingValueBegin, itEncodingValueEnd);
|
||||
}
|
||||
|
||||
bool CSvgParser::LoadFromFile(const std::wstring &wsFile, CGraphicsContainer* pContainer, CSvgFile* pFile) const
|
||||
bool CSvgParser::LoadFromFile(const std::wstring &wsFile, CGraphicsContainer*& pContainer, CSvgFile* pFile) const
|
||||
{
|
||||
if (wsFile.empty() || NULL == pFile)
|
||||
return false;
|
||||
@ -102,69 +102,54 @@ namespace SVG
|
||||
else
|
||||
return false;
|
||||
|
||||
XmlUtils::IXmlDOMDocument::DisableOutput();
|
||||
bool bResult = LoadFromString(wsContent, pContainer, pFile);
|
||||
XmlUtils::IXmlDOMDocument::EnableOutput();
|
||||
|
||||
return bResult;
|
||||
return LoadFromString(wsContent, pContainer, pFile);
|
||||
}
|
||||
|
||||
bool CSvgParser::LoadFromString(const std::wstring &wsContentent, CGraphicsContainer* pContainer, CSvgFile* pFile) const
|
||||
bool CSvgParser::LoadFromString(const std::wstring &wsContent, CGraphicsContainer*& pContainer, CSvgFile* pFile) const
|
||||
{
|
||||
if (wsContentent.empty() || NULL == pFile)
|
||||
if (wsContent.empty() || NULL == pFile)
|
||||
return false;
|
||||
|
||||
XmlUtils::CXmlNode oXml;
|
||||
if (!oXml.FromXmlString(wsContentent))
|
||||
CSvgReader oReader;
|
||||
if (!oReader.ReadFromString(wsContent))
|
||||
return false;
|
||||
|
||||
ScanStyles(oXml, pFile);
|
||||
ScanStyles(oReader, pFile);
|
||||
oReader.MoveToStart();
|
||||
|
||||
if (NULL != pContainer)
|
||||
pContainer->SetData(oXml);
|
||||
RELEASEINTERFACE(pContainer);
|
||||
|
||||
return LoadFromXmlNode(oXml, pContainer, pFile);
|
||||
pContainer = CObject::Create<CGraphicsContainer>(oReader, pFile);
|
||||
|
||||
if (NULL == pContainer)
|
||||
return false;
|
||||
|
||||
return ReadChildrens(oReader, pContainer, pFile, pContainer);
|
||||
}
|
||||
|
||||
bool CSvgParser::LoadFromXmlNode(XmlUtils::CXmlNode &oElement, CGraphicsContainer* pContainer, CSvgFile* pFile) const
|
||||
bool CSvgParser::ScanStyles(CSvgReader& oReader, CSvgFile *pFile) const
|
||||
{
|
||||
if (NULL == pFile || !oElement.IsValid())
|
||||
if (oReader.IsEmptyNode() || NULL == pFile)
|
||||
return false;
|
||||
|
||||
const CSvgCalculator *pSvgCalculator = pFile->GetSvgCalculator();
|
||||
const std::string sElementName = oReader.GetName();
|
||||
|
||||
if (NULL != pSvgCalculator)
|
||||
pSvgCalculator->SetData(pContainer);
|
||||
|
||||
return ReadChildrens(oElement, pContainer, pFile, pContainer);
|
||||
}
|
||||
|
||||
bool CSvgParser::ScanStyles(XmlUtils::CXmlNode &oElement, CSvgFile *pFile) const
|
||||
{
|
||||
if (!oElement.IsValid() || NULL == pFile)
|
||||
return false;
|
||||
|
||||
std::wstring wsElementName = oElement.GetName();
|
||||
|
||||
if (L"style" == wsElementName)
|
||||
if ("style" == sElementName)
|
||||
{
|
||||
ParseStyles(oElement.GetText(), pFile);
|
||||
ParseStyles(oReader.GetText(), pFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bScanResult = false;
|
||||
|
||||
if (L"svg" == wsElementName || L"g" == wsElementName || L"defs" == wsElementName)
|
||||
if ("svg" == sElementName || "g" == sElementName || "defs" == sElementName)
|
||||
{
|
||||
std::vector<XmlUtils::CXmlNode> arChilds;
|
||||
|
||||
oElement.GetChilds(arChilds);
|
||||
|
||||
for (XmlUtils::CXmlNode& oChild : arChilds)
|
||||
WHILE_READ_NEXT_NODE(oReader)
|
||||
{
|
||||
if (ScanStyles(oChild, pFile))
|
||||
if (ScanStyles(oReader, pFile))
|
||||
bScanResult = true;
|
||||
}
|
||||
END_WHILE
|
||||
}
|
||||
|
||||
return bScanResult;
|
||||
@ -224,155 +209,103 @@ namespace SVG
|
||||
oSearchStart = oMatch.suffix().first;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ObjectType>
|
||||
bool CSvgParser::ReadObject(XmlUtils::CXmlNode &oElement, CContainer<ObjectType> *pContainer, CSvgFile *pFile, CRenderedObject *pParent) const
|
||||
bool CSvgParser::ReadObject(CSvgReader& oReader, CContainer<ObjectType> *pContainer, CSvgFile *pFile, CRenderedObject *pParent) const
|
||||
{
|
||||
if (!oElement.IsValid() || NULL == pFile)
|
||||
if (NULL == pFile)
|
||||
return false;
|
||||
|
||||
std::wstring wsElementName = oElement.GetName();
|
||||
const std::string sElementName = oReader.GetName();
|
||||
|
||||
CObject *pObject = NULL;
|
||||
|
||||
if (L"svg" == wsElementName || L"g" == wsElementName || L"a" == wsElementName)
|
||||
if ("svg" == sElementName || "g" == sElementName || "a" == sElementName)
|
||||
{
|
||||
pObject = new CGraphicsContainer(oElement, pParent);
|
||||
if (!ReadChildrens(oElement, (CGraphicsContainer*)pObject, pFile, (CGraphicsContainer*)pObject))
|
||||
pObject = CObject::Create<CGraphicsContainer>(oReader, pFile, pParent);
|
||||
if (!ReadChildrens(oReader, (CGraphicsContainer*)pObject, pFile, (CGraphicsContainer*)pObject))
|
||||
{
|
||||
RELEASEOBJECT(pObject);
|
||||
RELEASEINTERFACE(pObject);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (L"line" == wsElementName)
|
||||
pObject = new CLine(oElement, pParent);
|
||||
else if (L"rect" == wsElementName)
|
||||
pObject = new CRect(oElement, pParent);
|
||||
else if (L"circle" == wsElementName)
|
||||
pObject = new CCircle(oElement, pParent);
|
||||
else if (L"ellipse" == wsElementName)
|
||||
pObject = new CEllipse(oElement, pParent);
|
||||
else if (L"path" == wsElementName)
|
||||
pObject = new CPath(oElement, pParent);
|
||||
else if (L"polyline" == wsElementName)
|
||||
pObject = new CPolyline(oElement, pParent);
|
||||
else if (L"polygon" == wsElementName)
|
||||
pObject = new CPolygon(oElement, pParent);
|
||||
else if (L"image" == wsElementName)
|
||||
pObject = new CImage(oElement, pParent);
|
||||
else if (L"use" == wsElementName)
|
||||
pObject = new CUse(oElement, pParent);
|
||||
else if (L"text" == wsElementName)
|
||||
else if ("line" == sElementName)
|
||||
pObject = CObject::Create<CLine>(oReader, pFile, pParent);
|
||||
else if ("rect" == sElementName)
|
||||
pObject = CObject::Create<CRect>(oReader, pFile, pParent);
|
||||
else if ("circle" == sElementName)
|
||||
pObject = CObject::Create<CCircle>(oReader, pFile, pParent);
|
||||
else if ("ellipse" == sElementName)
|
||||
pObject = CObject::Create<CEllipse>(oReader, pFile, pParent);
|
||||
else if ("path" == sElementName)
|
||||
pObject = CObject::Create<CPath>(oReader, pFile, pParent);
|
||||
else if ("polyline" == sElementName)
|
||||
pObject = CObject::Create<CPolyline>(oReader, pFile, pParent);
|
||||
else if ("polygon" == sElementName)
|
||||
pObject = CObject::Create<CPolygon>(oReader, pFile, pParent);
|
||||
else if ("image" == sElementName)
|
||||
pObject = CObject::Create<CImage>(oReader, pFile, pParent);
|
||||
else if ("use" == sElementName)
|
||||
pObject = CObject::Create<CUse>(oReader, pFile, pParent);
|
||||
else if ("text" == sElementName)
|
||||
pObject = CObject::Create<CText>(oReader, pFile, pParent, m_pFontManager);
|
||||
else if ("tspan" == sElementName)
|
||||
pObject = CObject::Create<CTSpan>(oReader, pFile, pParent, m_pFontManager);
|
||||
else if ("textPath" == sElementName)
|
||||
pObject = CObject::Create<CTextPath>(oReader, pFile, pParent, m_pFontManager);
|
||||
else if ("switch" == sElementName)
|
||||
{
|
||||
pObject = CText::Create(oElement, pParent, m_pFontManager);
|
||||
ReadChildrens(oElement, (CText*)pObject, pFile, (CText*)pObject);
|
||||
}
|
||||
else if (L"tspan" == wsElementName)
|
||||
{
|
||||
pObject = CTSpan::Create(oElement, pParent, m_pFontManager);
|
||||
ReadChildrens(oElement, (CTSpan*)pObject, pFile, (CTSpan*)pObject);
|
||||
}
|
||||
else if (L"textPath" == wsElementName)
|
||||
{
|
||||
pObject = CTextPath::Create(oElement, pParent, m_pFontManager, pFile);
|
||||
ReadChildrens(oElement, (CTextPath*)pObject, pFile);
|
||||
}
|
||||
else if (L"switch" == wsElementName)
|
||||
{
|
||||
pObject = new CSwitch(oElement, pParent);
|
||||
ReadChildrens(oElement, (CSwitch*)pObject, pFile);
|
||||
pObject = CObject::Create<CSwitch>(oReader, pFile, pParent);
|
||||
ReadChildrens(oReader, (CSwitch*)pObject, pFile);
|
||||
}
|
||||
//defs
|
||||
else if (L"defs" == wsElementName)
|
||||
return ReadChildrens<CRenderedObject>(oElement, NULL, pFile);
|
||||
else if(L"linearGradient" == wsElementName)
|
||||
else if ("defs" == sElementName)
|
||||
return ReadChildrens<CRenderedObject>(oReader, NULL, pFile);
|
||||
else if("linearGradient" == sElementName)
|
||||
pObject = CObject::Create<CLinearGradient>(oReader, pFile);
|
||||
else if ("radialGradient" == sElementName)
|
||||
pObject = CObject::Create<CRadialGradient>(oReader, pFile);
|
||||
else if ("pattern" == sElementName)
|
||||
{
|
||||
pObject = new CLinearGradient(oElement);
|
||||
ReadChildrens(oElement, (CLinearGradient*)pObject, pFile);
|
||||
pObject = CObject::Create<CPattern>(oReader, pFile);
|
||||
ReadChildrens(oReader, (CGraphicsContainer*)(&((CPattern*)pObject)->GetContainer()), pFile);
|
||||
}
|
||||
else if (L"radialGradient" == wsElementName)
|
||||
else if ("clipPath" == sElementName)
|
||||
{
|
||||
pObject = new CRadialGradient(oElement);
|
||||
ReadChildrens(oElement, (CRadialGradient*)pObject, pFile);
|
||||
pObject = CObject::Create<CClipPath>(oReader, pFile);
|
||||
ReadChildrens(oReader, (CGraphicsContainer*)(&((CClipPath*)pObject)->GetContainer()), pFile);
|
||||
}
|
||||
else if (L"stop" == wsElementName)
|
||||
else if ("marker" == sElementName)
|
||||
{
|
||||
CStopElement *pStopElement = new CStopElement(oElement);
|
||||
if (AddObject((ObjectType*)pStopElement, pContainer))
|
||||
{
|
||||
UpdateStyles(pStopElement, pFile);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEOBJECT(pStopElement);
|
||||
return false;
|
||||
}
|
||||
pObject = CObject::Create<CMarker>(oReader, pFile);
|
||||
ReadChildrens(oReader, (CMarker*)pObject, pFile);
|
||||
}
|
||||
else if (L"pattern" == wsElementName)
|
||||
else if ("mask" == sElementName)
|
||||
{
|
||||
pObject = new CPattern(oElement, m_pFontManager);
|
||||
ReadChildrens(oElement, (CGraphicsContainer*)(&((CPattern*)pObject)->GetContainer()), pFile);
|
||||
pObject = CObject::Create<CMask>(oReader, pFile);
|
||||
ReadChildrens(oReader, (CGraphicsContainer*)(&((CMask*)pObject)->GetContainer()), pFile);
|
||||
}
|
||||
else if (L"clipPath" == wsElementName)
|
||||
else if ("symbol" == sElementName)
|
||||
{
|
||||
pObject = new CClipPath(oElement);
|
||||
ReadChildrens(oElement, (CGraphicsContainer*)(&((CClipPath*)pObject)->GetContainer()), pFile);
|
||||
}
|
||||
else if (L"marker" == wsElementName)
|
||||
{
|
||||
pObject = new CMarker(oElement);
|
||||
ReadChildrens(oElement, (CMarker*)pObject, pFile);
|
||||
}
|
||||
else if (L"mask" == wsElementName)
|
||||
{
|
||||
pObject = new CMask(oElement);
|
||||
ReadChildrens(oElement, (CGraphicsContainer*)(&((CMask*)pObject)->GetContainer()), pFile);
|
||||
}
|
||||
else if (L"symbol" == wsElementName)
|
||||
{
|
||||
pObject = new CSymbol(oElement);
|
||||
if (ReadChildrens(oElement, (CSymbol*)pObject, pFile) && MarkObject(pObject, pFile))
|
||||
pObject = CObject::Create<CSymbol>(oReader, pFile);
|
||||
if (ReadChildrens(oReader, (CSymbol*)pObject, pFile))
|
||||
return true;
|
||||
else
|
||||
RELEASEOBJECT(pObject);
|
||||
RELEASEINTERFACE(pObject);
|
||||
}
|
||||
else if (L"font" == wsElementName)
|
||||
else if ("font" == sElementName)
|
||||
{
|
||||
pObject = new CFont(oElement);
|
||||
pObject = CObject::Create<CFont>(oReader, pFile, pFile);
|
||||
}
|
||||
|
||||
if (NULL != pObject)
|
||||
{
|
||||
if ((MarkObject(pObject, pFile) && (AppliedObject == pObject->GetType() || NULL == pContainer)) ||
|
||||
(RendererObject == pObject->GetType() && AddObject((ObjectType*)pObject, pContainer)))
|
||||
{
|
||||
UpdateStyles(pObject, pFile);
|
||||
return true;
|
||||
}
|
||||
delete pObject;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSvgParser::UpdateStyles(CObject *pObject, CSvgFile *pFile) const
|
||||
{
|
||||
if (NULL == pObject || NULL == pFile)
|
||||
return;
|
||||
|
||||
const CSvgCalculator *pSvgCalculator = pFile->GetSvgCalculator();
|
||||
|
||||
if (NULL != pSvgCalculator)
|
||||
pSvgCalculator->SetData(pObject);
|
||||
}
|
||||
|
||||
bool CSvgParser::MarkObject(CObject *pObject, CSvgFile *pFile) const
|
||||
{
|
||||
if (NULL == pObject || NULL == pFile)
|
||||
if (NULL == pObject)
|
||||
return false;
|
||||
|
||||
return pFile->MarkObject(pObject);
|
||||
if ((RendererObject == pObject->GetType() && (AddObject((ObjectType*)pObject, pContainer) || pObject->Marked())) ||
|
||||
AppliedObject == pObject->GetType())
|
||||
return true;
|
||||
|
||||
RELEASEINTERFACE(pObject);
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class ObjectType>
|
||||
@ -382,18 +315,15 @@ namespace SVG
|
||||
}
|
||||
|
||||
template <class ObjectType>
|
||||
bool CSvgParser::ReadChildrens(XmlUtils::CXmlNode &oElement, CContainer<ObjectType>* pContainer, CSvgFile* pFile, CRenderedObject *pParent) const
|
||||
bool CSvgParser::ReadChildrens(CSvgReader& oReader, CContainer<ObjectType>* pContainer, CSvgFile* pFile, CRenderedObject *pParent) const
|
||||
{
|
||||
std::vector<XmlUtils::CXmlNode> arChilds;
|
||||
bool bResult = false;
|
||||
|
||||
oElement.GetChilds(arChilds);
|
||||
WHILE_READ_NEXT_NODE(oReader)
|
||||
if (ReadObject(oReader, pContainer, pFile, pParent))
|
||||
bResult = true;
|
||||
END_WHILE
|
||||
|
||||
if (arChilds.empty())
|
||||
return false;
|
||||
|
||||
for (XmlUtils::CXmlNode& oChild : arChilds)
|
||||
ReadObject(oChild, pContainer, pFile, pParent);
|
||||
|
||||
return true;
|
||||
return bResult;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
|
||||
#include "../../../common/Directory.h"
|
||||
#include "../../../graphics/pro/Fonts.h"
|
||||
#include "../../../xml/include/xmlutils.h"
|
||||
|
||||
#include "SvgObjects/CContainer.h"
|
||||
#include "SvgReader.h"
|
||||
|
||||
class CSvgFile;
|
||||
|
||||
@ -14,26 +14,23 @@ namespace SVG
|
||||
class CSvgParser
|
||||
{
|
||||
public:
|
||||
CSvgParser();
|
||||
CSvgParser(NSFonts::IFontManager* pFontManager = NULL);
|
||||
~CSvgParser();
|
||||
|
||||
void SetFontManager(NSFonts::IFontManager* pFontManager);
|
||||
|
||||
bool LoadFromFile(const std::wstring& wsFile, CGraphicsContainer* pContainer, CSvgFile* pFile) const;
|
||||
bool LoadFromString(const std::wstring& wsContentent, CGraphicsContainer* pContainer, CSvgFile* pFile) const;
|
||||
bool LoadFromXmlNode(XmlUtils::CXmlNode& oElement, CGraphicsContainer* pContainer, CSvgFile* pFile) const;
|
||||
bool LoadFromFile(const std::wstring& wsFile, CGraphicsContainer*& pContainer, CSvgFile* pFile) const;
|
||||
bool LoadFromString(const std::wstring& wsContent, CGraphicsContainer*& pContainer, CSvgFile* pFile) const;
|
||||
|
||||
template <class ObjectType>
|
||||
bool ReadObject(XmlUtils::CXmlNode& oElement, CContainer<ObjectType>* pContainer, CSvgFile* pFile, CRenderedObject* pParent = NULL) const;
|
||||
bool ReadObject(CSvgReader& oReader, CContainer<ObjectType>* pContainer, CSvgFile* pFile, CRenderedObject* pParent = NULL) const;
|
||||
private:
|
||||
template <class ObjectType>
|
||||
bool ReadChildrens(XmlUtils::CXmlNode& oElement, CContainer<ObjectType>* pContainer, CSvgFile* pFile, CRenderedObject* pParent = NULL) const;
|
||||
bool ReadChildrens(CSvgReader& oReader, CContainer<ObjectType>* pContainer, CSvgFile* pFile, CRenderedObject* pParent = NULL) const;
|
||||
|
||||
bool ScanStyles(XmlUtils::CXmlNode& oElement, CSvgFile* pFile) const;
|
||||
bool ScanStyles(CSvgReader& oReader, CSvgFile* pFile) const;
|
||||
void ParseStyles(const std::wstring& wsStyles, CSvgFile *pFile) const;
|
||||
|
||||
void UpdateStyles(CObject* pObject, CSvgFile* pFile) const;
|
||||
bool MarkObject(CObject* pObject, CSvgFile* pFile) const;
|
||||
template <class ObjectType>
|
||||
bool AddObject(ObjectType* pObject, CContainer<ObjectType>* pContainer) const;
|
||||
|
||||
|
||||
@ -1,16 +1,27 @@
|
||||
#include "CCircle.h"
|
||||
|
||||
#include "CContainer.h"
|
||||
#include "CStyle.h"
|
||||
|
||||
namespace SVG
|
||||
{
|
||||
CCircle::CCircle(XmlUtils::CXmlNode& oNode, CRenderedObject* pParent)
|
||||
: CRenderedObject(oNode, pParent)
|
||||
CCircle::CCircle(CSvgReader& oReader, CRenderedObject* pParent)
|
||||
: CRenderedObject(oReader, pParent)
|
||||
{
|
||||
m_oCx.SetValue(oNode.GetAttribute(L"cx"));
|
||||
m_oCy.SetValue(oNode.GetAttribute(L"cy"));
|
||||
m_oR .SetValue(oNode.GetAttribute(L"r"));
|
||||
START_READ_ATTRIBUTES(oReader)
|
||||
SetAttribute(sAttributeName, oReader);
|
||||
END_READ_ATTRIBUTES(oReader)
|
||||
}
|
||||
|
||||
void CCircle::SetAttribute(const std::string& sName, CSvgReader& oReader)
|
||||
{
|
||||
if ("cx" == sName)
|
||||
m_oCx.SetValue(oReader.GetText());
|
||||
else if ("cy" == sName)
|
||||
m_oCy.SetValue(oReader.GetText());
|
||||
else if ("r" == sName)
|
||||
m_oR.SetValue(oReader.GetText());
|
||||
else
|
||||
CRenderedObject::SetAttribute(sName, oReader);
|
||||
}
|
||||
|
||||
void CCircle::SetData(const std::map<std::wstring, std::wstring> &mAttributes, unsigned short ushLevel, bool bHardMode)
|
||||
@ -51,7 +62,7 @@ namespace SVG
|
||||
nTypePath += c_nWindingFillMode;
|
||||
}
|
||||
|
||||
TBounds CCircle::GetBounds() const
|
||||
TBounds CCircle::GetBounds(SvgMatrix* pTransform) const
|
||||
{
|
||||
TBounds oBounds;
|
||||
|
||||
@ -60,6 +71,16 @@ namespace SVG
|
||||
oBounds.m_dRight = (m_oCx + m_oR).ToDouble(NSCSS::Pixel);
|
||||
oBounds.m_dBottom = (m_oCy + m_oR).ToDouble(NSCSS::Pixel);
|
||||
|
||||
if (nullptr != pTransform)
|
||||
{
|
||||
*pTransform += m_oTransformation.m_oTransform.GetMatrix();
|
||||
|
||||
pTransform->GetFinalValue().TransformPoint(oBounds.m_dLeft, oBounds.m_dTop );
|
||||
pTransform->GetFinalValue().TransformPoint(oBounds.m_dRight, oBounds.m_dBottom);
|
||||
|
||||
*pTransform -= m_oTransformation.m_oTransform.GetMatrix();
|
||||
}
|
||||
|
||||
return oBounds;
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,10 @@ namespace SVG
|
||||
{
|
||||
class CCircle : public CRenderedObject
|
||||
{
|
||||
friend class CObject;
|
||||
CCircle(CSvgReader& oReader, CRenderedObject* pParent = NULL);
|
||||
public:
|
||||
CCircle(XmlUtils::CXmlNode& oNode, CRenderedObject* pParent = NULL);
|
||||
void SetAttribute(const std::string& sName, CSvgReader& oReader) override;
|
||||
|
||||
void SetData(const std::map<std::wstring, std::wstring>& mAttributes, unsigned short ushLevel, bool bHardMode = false) override;
|
||||
|
||||
@ -16,7 +18,7 @@ namespace SVG
|
||||
private:
|
||||
void ApplyStyle(IRenderer* pRenderer, const TSvgStyles* pStyles, const CSvgFile *pFile, int& nTypePath, const CRenderedObject* pContexObject = NULL) const override;
|
||||
|
||||
TBounds GetBounds() const override;
|
||||
TBounds GetBounds(SvgMatrix* pTransform = nullptr) const override;
|
||||
|
||||
SvgDigit m_oCx;
|
||||
SvgDigit m_oCy;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user