mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-18 05:38:07 +08:00
Compare commits
911 Commits
v8.2.2.8
...
feature/gr
| Author | SHA1 | Date | |
|---|---|---|---|
| c22407d445 | |||
| f80c07e275 | |||
| 748def3c76 | |||
| 7f173e2013 | |||
| c964ed7d58 | |||
| 4c806b07a2 | |||
| 6a75bc62f0 | |||
| 1dfb9bff3a | |||
| bd60a20b91 | |||
| 641a505cf8 | |||
| 68992278ce | |||
| fa5fa35a34 | |||
| 21028c2ca5 | |||
| c84f2a11d5 | |||
| 3c2fd33c7a | |||
| f9062d7d38 | |||
| be5627ba60 | |||
| cafdb1d2a5 | |||
| af5feabdac | |||
| 716cbd42b2 | |||
| 3522897670 | |||
| 6973cb4c54 | |||
| a0c49966b9 | |||
| 58f4828563 | |||
| 9e52adeb53 | |||
| 96a7e3ac36 | |||
| b67ed51103 | |||
| cf91b46ea7 | |||
| 7857106d76 | |||
| dad19380a2 | |||
| 23410ccbf9 | |||
| 64c74192c7 | |||
| ce129fe49d | |||
| ed0f4f9e5e | |||
| d8f9aab1ed | |||
| 37fc9784a7 | |||
| d257c68d5f | |||
| 051169b0f5 | |||
| 6a4ba5ec8d | |||
| 9390761867 | |||
| e100f594d7 | |||
| 1181cb222d | |||
| 850fd21f09 | |||
| fdc374256a | |||
| ed12f6766d | |||
| c4bcf11d91 | |||
| 72ee82211d | |||
| 2ab94263f2 | |||
| b7a335ef83 | |||
| 410e8100fe | |||
| 3e3ac51f56 | |||
| 2d0bb82f41 | |||
| 005b790e14 | |||
| 4f4f61bb19 | |||
| 6fe0f2828e | |||
| 58074d649d | |||
| 1346f56d67 | |||
| 2652fb4e65 | |||
| 16c77add4d | |||
| 684e83f0f3 | |||
| a8d8f44cef | |||
| 4ca218486f | |||
| 10bf096b4d | |||
| 3b67e4ee0c | |||
| 670dae5f36 | |||
| 95a5a2ccbc | |||
| 16023ed916 | |||
| 6e6a71e46d | |||
| c9e3c3452f | |||
| 561221102e | |||
| 4dd6d5ffc7 | |||
| 89d965283b | |||
| 6e9500a6e7 | |||
| 71f164b029 | |||
| a438ae3d2e | |||
| 7edb3bd141 | |||
| 37a5ce4781 | |||
| 18b8e3ed7c | |||
| 20a4bcf708 | |||
| c0222c03db | |||
| 80ed0318b6 | |||
| d83cbfc031 | |||
| 3723ba064c | |||
| 08ae28224f | |||
| ac2562f83e | |||
| e1274dadea | |||
| 4342c245c5 | |||
| 52602f902e | |||
| 56179f70bf | |||
| 9cde3dc699 | |||
| 85b6e2d568 | |||
| 43becd1cdb | |||
| 6aa68f1c81 | |||
| bd838daa90 | |||
| 484d9342ac | |||
| e9852e812f | |||
| d2ea9521b5 | |||
| d76dddeda6 | |||
| 631f498532 | |||
| 06f8099497 | |||
| ba9d3bcda5 | |||
| a7551f69eb | |||
| a3878b3770 | |||
| 7a1c1be599 | |||
| b177d01071 | |||
| 06cc67a925 | |||
| 55cae3d38c | |||
| fc540fdf5f | |||
| 06a287dffe | |||
| 3d58a8565a | |||
| 9ed356c103 | |||
| b20cdcd107 | |||
| 3d7638c3cc | |||
| cca89624c6 | |||
| ccad697cd8 | |||
| dd60367d01 | |||
| 54bbbbc3d7 | |||
| 9b901f7834 | |||
| 09567e225e | |||
| 4f59af17b8 | |||
| b9258429f6 | |||
| e8f2c55ad4 | |||
| 46f6ba4d0a | |||
| f5d2ff992a | |||
| 09b55bd1f1 | |||
| 176053e8d8 | |||
| 01365f938c | |||
| d168e4594f | |||
| 79145ad0c7 | |||
| cad36a73be | |||
| 0c9fa4709f | |||
| 27d2e40da7 | |||
| 14b09ce582 | |||
| aeeab690b1 | |||
| 54c0943754 | |||
| 016a0a971b | |||
| bb65d1a90b | |||
| 0136530b93 | |||
| afe55a456f | |||
| a430ba92ad | |||
| efc1149235 | |||
| 567cc14bc7 | |||
| 0fc7f2a8b3 | |||
| b14fa1c2a1 | |||
| 2c27cfc720 | |||
| 1d31e5836b | |||
| 6adf65d3a8 | |||
| 093e1348fa | |||
| b78157487a | |||
| 77b30109f0 | |||
| efd047be74 | |||
| 61abfdb272 | |||
| f5088f43d8 | |||
| 9757220019 | |||
| 6b3c395220 | |||
| 67cb29652d | |||
| d0cb082b33 | |||
| bc0a582bf6 | |||
| 2eff67efc3 | |||
| 84416ef5b6 | |||
| 3428537113 | |||
| d09ab5ecfe | |||
| 447ade207f | |||
| 8bc887142c | |||
| ddd7628bbe | |||
| 1f86b0265a | |||
| e7a7400801 | |||
| e484db496b | |||
| 5bc1c8d860 | |||
| feeb471aad | |||
| dbdf4bd120 | |||
| 600d2a6ac5 | |||
| cd102c738f | |||
| a93db0e012 | |||
| 7c1636a33e | |||
| f145378002 | |||
| 3ec3aa8575 | |||
| 3227b91a7c | |||
| 4e800f6952 | |||
| 8098fec345 | |||
| 7bfcea0fff | |||
| 4b4845c558 | |||
| b26e3e2fee | |||
| 388951670c | |||
| ed63f9cf29 | |||
| 7556d0859d | |||
| 7d3488abc9 | |||
| fea3910254 | |||
| 2d58b08f0f | |||
| 612142f0ae | |||
| 2a0c84513b | |||
| b7d3464609 | |||
| beb8574dfd | |||
| c22cc89ef0 | |||
| 58255093bf | |||
| 6411aed137 | |||
| 50846677d5 | |||
| 650a5c4c1f | |||
| 3b450306f1 | |||
| c67ec5f632 | |||
| 62450ee1fb | |||
| ad301b6f50 | |||
| d251682639 | |||
| 896427db83 | |||
| e03f02103b | |||
| 27c7920def | |||
| a1b0421ec1 | |||
| b7972ea391 | |||
| 662f318d6b | |||
| eb751507c0 | |||
| 17840c5ed7 | |||
| ff4726e6ec | |||
| 4e9cd74367 | |||
| b8737d2474 | |||
| 2f4b7442c7 | |||
| d97d2668d2 | |||
| d196a15a0e | |||
| 45da53e9ae | |||
| 618a7ea09e | |||
| a33743cff2 | |||
| a83e19cbdf | |||
| 8a991ae24a | |||
| 6caca87b64 | |||
| 9ab884ae24 | |||
| e493d976e3 | |||
| d75e7342cf | |||
| ddd750be9c | |||
| 79a4434583 | |||
| 44ff2aff3c | |||
| 2f4b3e41b3 | |||
| fe208f5243 | |||
| e41c1d9703 | |||
| 1cb56e532c | |||
| 5c5f98a6e3 | |||
| f9dd82ad47 | |||
| 084c8f4b94 | |||
| bf15325a9e | |||
| 1b50b3a53a | |||
| 70b40c46d2 | |||
| 23798f3c96 | |||
| d91c6ff830 | |||
| b75a577793 | |||
| 1e8d22080d | |||
| 90bcd47fb7 | |||
| c1adf0b30c | |||
| b65ed1ccb4 | |||
| 8e4bbb5e27 | |||
| 81a4d9ccd0 | |||
| a97014c173 | |||
| b3951d083a | |||
| 7d78b37540 | |||
| ff162d451e | |||
| 5dc6402006 | |||
| fae17d9bfc | |||
| 931f4edae4 | |||
| 3609cf1237 | |||
| cc8fa641aa | |||
| 3b9a865d77 | |||
| f3b0a992bd | |||
| 74f3e7f279 | |||
| d195aa4a79 | |||
| 4a384edf08 | |||
| 30f96cbc6c | |||
| 007362d8be | |||
| f4aac048ea | |||
| f815fec8ed | |||
| 4ec217226d | |||
| 3cef41e876 | |||
| 20bff1d6fe | |||
| 8da1a109de | |||
| 704cef604e | |||
| 3c850e2086 | |||
| ab660cb8a3 | |||
| af4343b1d8 | |||
| 7e4fe558f4 | |||
| f942e56361 | |||
| 8b85f6987f | |||
| cbe412d3c7 | |||
| 6913cae8f3 | |||
| d3d9c8df94 | |||
| 01b582c4b9 | |||
| 4568144a22 | |||
| cc4df3726a | |||
| 696610862a | |||
| da6a5e9e98 | |||
| d395e63b80 | |||
| 0350675df6 | |||
| aead2e9fb8 | |||
| d12bad7bd1 | |||
| da2284fff6 | |||
| 1382aa0b3d | |||
| 8ba5df60d9 | |||
| 5299872b17 | |||
| e1757dd5d1 | |||
| 87dcea55b1 | |||
| b5c5a5f1ed | |||
| 6979e17c3d | |||
| c43fb92860 | |||
| c2dc112949 | |||
| 63887c95b6 | |||
| d3d4e86925 | |||
| f6383571eb | |||
| a6f6a67aed | |||
| f9543ef9de | |||
| bb58be4f18 | |||
| 40efe7dabc | |||
| 80b7caaf7a | |||
| 08e3dfb061 | |||
| 3a9d91b291 | |||
| 45b26554b2 | |||
| 09c4df8e05 | |||
| 85533a6553 | |||
| 65898a94ad | |||
| 86009ff6fa | |||
| b91dfb075e | |||
| f057a16bc1 | |||
| bd76adc97f | |||
| 27b5dbf15e | |||
| 58a7c7cd9d | |||
| 18fa4639b0 | |||
| 389e5314df | |||
| 42636a8ab1 | |||
| a3c87e7119 | |||
| 2115371c0c | |||
| bd95478d77 | |||
| 965680de23 | |||
| ad44ddf682 | |||
| 06386d5458 | |||
| ffda83848d | |||
| 55dc0b789f | |||
| 53e3f8c561 | |||
| 731a7addee | |||
| 36b82c1ef9 | |||
| 229a8f9dad | |||
| 5f5d74df92 | |||
| 66ea88bf14 | |||
| 3953044063 | |||
| 9a4a1546cb | |||
| 4085ee5002 | |||
| f6ef582658 | |||
| 7b62295149 | |||
| 421dcd780d | |||
| b9e7a3143c | |||
| c85713d82a | |||
| 6d970d0706 | |||
| 6026841c00 | |||
| 1e6d0a9f25 | |||
| adad3a05ba | |||
| 99fa27e693 | |||
| cf047defac | |||
| 6b66c8fb50 | |||
| 9faa7fb69d | |||
| 84042360ab | |||
| 8a8a6e78eb | |||
| 8bd655dd17 | |||
| 34ecf84835 | |||
| 4cf79c985d | |||
| 18e359c1a6 | |||
| dc777f43d9 | |||
| 8cd7ca9731 | |||
| 8f91c47178 | |||
| fdac954df5 | |||
| 70c98eb9f3 | |||
| aa72db079f | |||
| 024efd2e35 | |||
| da252bfa5e | |||
| c9ce68eab3 | |||
| 3af549a158 | |||
| 34627ff1c5 | |||
| 483ead4243 | |||
| 0c2b49af11 | |||
| 4324ea847c | |||
| df76ff3778 | |||
| 172bb09305 | |||
| aa0ba83d32 | |||
| fb934ef527 | |||
| a2b817bbc2 | |||
| ecd80408e2 | |||
| b78e2cb33c | |||
| ddd92777b4 | |||
| f0c52d2e81 | |||
| 23ac269339 | |||
| 07ab24638e | |||
| 8239d6f51d | |||
| 3adf336384 | |||
| 8e1810697f | |||
| 7c2105b613 | |||
| 2027defafb | |||
| ffe44155e2 | |||
| 2ea586ec6f | |||
| 7c2093a4c7 | |||
| 4f6fa2a15c | |||
| a6940c42ac | |||
| 6ed1cb60d6 | |||
| 2c9e58280b | |||
| f18b50cd4f | |||
| aa2af5d280 | |||
| dde69ba65f | |||
| f51b58c927 | |||
| 43f1ac0596 | |||
| 321e0de9f3 | |||
| ca77113e79 | |||
| 9c70225a9e | |||
| 2098c72a35 | |||
| 06e34fc303 | |||
| 7b56d56c0e | |||
| aa90104b18 | |||
| 98b285ab64 | |||
| cbd7e8ee7b | |||
| b76235d4fc | |||
| b9e1d77038 | |||
| 8f448d3842 | |||
| 89d7242d21 | |||
| 9aaa241523 | |||
| 02bd5c4b0b | |||
| 4003a39ef9 | |||
| a5fed4af70 | |||
| a9d8cbbc57 | |||
| 6c79ab37fa | |||
| 17762b71db | |||
| be2f142fd3 | |||
| fdcb2cf7ba | |||
| b42e3ad01f | |||
| 07bf7a44aa | |||
| 3a40dc1f8b | |||
| a2bfbd8368 | |||
| 25553904df | |||
| 954ef08975 | |||
| aea8b7873c | |||
| 6952bedbc3 | |||
| a7774a6bc3 | |||
| bf299e82bb | |||
| 915790e26e | |||
| e18a26a252 | |||
| 4d15b5c19d | |||
| 73ccefd720 | |||
| 11385b946d | |||
| e230fa1d43 | |||
| 3d30144ebb | |||
| 3365ca15d6 | |||
| c0debdfe39 | |||
| f7d55d48fe | |||
| f2510a9410 | |||
| f2a8a9878b | |||
| 39adc06921 | |||
| 64af642c40 | |||
| ef26ac732e | |||
| 8bbaaf4cef | |||
| de821b73c8 | |||
| a7d5fe3994 | |||
| 7deeefbcf4 | |||
| 3666bdf6fc | |||
| eaa7bb30db | |||
| d4619c5786 | |||
| 0f3852ab1e | |||
| fb5b1c5a6e | |||
| 7598e882b8 | |||
| cef8ac9fd9 | |||
| 45aa5df267 | |||
| e8c94aa103 | |||
| aa5b7e1276 | |||
| dd98d0c11d | |||
| 08971025bd | |||
| 00f6a823d6 | |||
| b4f4da26d6 | |||
| 1c9f7ac597 | |||
| 673139f5a9 | |||
| 4bf0cee034 | |||
| 00abbab370 | |||
| 3125a7a928 | |||
| f20c944c72 | |||
| 6d7dc6517b | |||
| 6fd84c6c8c | |||
| d37f31208c | |||
| c472b19e0d | |||
| 7b03bcde89 | |||
| 51cc45d178 | |||
| 03a7eb0fd4 | |||
| c0a779727e | |||
| 52d3f0bc19 | |||
| c17497e304 | |||
| 6bc4ecbc73 | |||
| 2246077589 | |||
| 91eb74773b | |||
| 5b8d2660aa | |||
| 60ad1c10fd | |||
| 36b0cc524e | |||
| bb33e70b3e | |||
| 9dc3d3ed82 | |||
| 5f2d7b2f5a | |||
| 02aeaa6a64 | |||
| 7696541430 | |||
| 6fe92e1725 | |||
| e512ceedec | |||
| d05a40389e | |||
| ea0494e8c2 | |||
| 614156f575 | |||
| 127680c988 | |||
| cdbd9bdba3 | |||
| 397abd51a5 | |||
| d311090ced | |||
| 1910151224 | |||
| 4a110d68c1 | |||
| cd27981734 | |||
| 505a3c6224 | |||
| 75a21ee162 | |||
| 9509d5e730 | |||
| 440cf968d5 | |||
| 3daa374a51 | |||
| 5d83d912fc | |||
| 695fd3ba1c | |||
| 75f68904f2 | |||
| b99badda9f | |||
| 219733c437 | |||
| 48d86cb7ce | |||
| 9991cc8c03 | |||
| 36a3b693d5 | |||
| dbd6be9520 | |||
| 42ef948fcc | |||
| 69f4ac3ed7 | |||
| 328e379ec2 | |||
| ad4fee9581 | |||
| 2af29de849 | |||
| 7d65d4b11a | |||
| 57ba4355f9 | |||
| 2eea44bc8c | |||
| cb982a1ad4 | |||
| 0aca0a0a5a | |||
| 0c1df859e2 | |||
| 7a153285c8 | |||
| c2d00ee819 | |||
| 3603787df8 | |||
| d58424d089 | |||
| fe2ca8c566 | |||
| 20d2ff7954 | |||
| b125c19d02 | |||
| 2f2d11a5f6 | |||
| de4897fdef | |||
| f9952d0f94 | |||
| 5483a8d36b | |||
| 80ac89f16b | |||
| fcf9830aa6 | |||
| 0c847ce1d8 | |||
| f1905b524b | |||
| d7b435a446 | |||
| f742a0ef10 | |||
| 887d963d8d | |||
| 3547ad9c57 | |||
| 0d2248352b | |||
| bc4c39b7aa | |||
| 012a724069 | |||
| 8d89026d19 | |||
| 4e6e3ce5f0 | |||
| 3d7eced836 | |||
| 2e50a2ede4 | |||
| 78d7d40c0a | |||
| 7130b1be34 | |||
| a5917c389f | |||
| eee80b0f87 | |||
| dac47c3214 | |||
| be3a84dcf7 | |||
| 35dff37820 | |||
| 22a2079c5f | |||
| 2f45a87669 | |||
| fe2bac216f | |||
| 185b3d54eb | |||
| f7f059b6c0 | |||
| 2a9044d066 | |||
| d89e94bb8e | |||
| a95aba3ff4 | |||
| a93f00d0af | |||
| 9a1abe9819 | |||
| f8f9d55ab8 | |||
| a1ebcaea23 | |||
| ab10854dde | |||
| 99b777a5eb | |||
| d1506ec9fa | |||
| 9fc74159ff | |||
| ec14915925 | |||
| f9f4efc383 | |||
| 12ad4e604b | |||
| e0ad062380 | |||
| b72f678c1d | |||
| 7b67dfa57c | |||
| 5153ac069b | |||
| a08b614bce | |||
| 59f41bcdec | |||
| e8aa709d4e | |||
| c4515aca3a | |||
| 3f25120e04 | |||
| 3fde7b3f92 | |||
| b776b7b63f | |||
| d69601c2d2 | |||
| 44d0a0ca23 | |||
| 912482beee | |||
| c0ca4189d3 | |||
| 134a214a0b | |||
| 95f604ec68 | |||
| ecd71dd92a | |||
| d8bd9ef845 | |||
| d3a317ed4b | |||
| 37141b6ba3 | |||
| bd3cabd236 | |||
| ec645c0202 | |||
| 63134aa586 | |||
| c2403aa0b7 | |||
| bdf70dd99e | |||
| 8489127f71 | |||
| 9f18cbce01 | |||
| 05a6f6afaf | |||
| e024463770 | |||
| 7e11af5553 | |||
| 3275182013 | |||
| ca2b6d78aa | |||
| 6a24fd149a | |||
| 168dc1ddb8 | |||
| 8918b7fae0 | |||
| 4501adbc61 | |||
| 0c1864a136 | |||
| 3e2373687c | |||
| 779af49e0d | |||
| cb2f1c5577 | |||
| 446a0f9524 | |||
| 1c839e6c62 | |||
| f7d7dc8c6b | |||
| 6d789e966a | |||
| d20d1af154 | |||
| 925ffa09e2 | |||
| dd0ed96e5a | |||
| 25b30981ce | |||
| ebfee2376f | |||
| fa33af2304 | |||
| 25fa85c218 | |||
| 6e20c656e7 | |||
| 6b9fc964b9 | |||
| 9242ab9743 | |||
| a158529c70 | |||
| 87b5ae8f75 | |||
| e14cc2d5c5 | |||
| 1c163421c7 | |||
| cd73a4d9e3 | |||
| 1b39b9f416 | |||
| 4e57fda1f6 | |||
| f3d65cb04c | |||
| 4ba288978d | |||
| c862d58966 | |||
| c6effb6de2 | |||
| 295dbbbb86 | |||
| 96b34ee008 | |||
| 265db0216b | |||
| 76f2d81655 | |||
| 10ff332f4d | |||
| d5e7ccac2d | |||
| f57179911f | |||
| 863144596c | |||
| a82a8977c3 | |||
| 0109c69e38 | |||
| 92ce5d81ad | |||
| 482da0dab3 | |||
| 32afe4f24e | |||
| 182dd9e072 | |||
| 2ba281a5ee | |||
| b3a30cf2ea | |||
| c321783b44 | |||
| 182cd8d74a | |||
| 98a1988d9a | |||
| acd9219b16 | |||
| 0cbcaa209c | |||
| a53e46be24 | |||
| ab8070aa56 | |||
| 6a930c5aa4 | |||
| 6c0715cc66 | |||
| 925f3614c7 | |||
| ce0f8251d3 | |||
| f019dfbb07 | |||
| fefcef7da4 | |||
| 361bc70fe3 | |||
| 09b4ab5092 | |||
| 6b21323e8c | |||
| e1fcf17b34 | |||
| c83a8a3a54 | |||
| 54f0635500 | |||
| bb48b57af9 | |||
| 8a000efb7f | |||
| 1c362612e3 | |||
| 78404c4ffe | |||
| 3a49869ce0 | |||
| a1a6e6c9a0 | |||
| 4199716550 | |||
| 6d68d7aee5 | |||
| cf346bd535 | |||
| 61e6b54710 | |||
| 536dac5fc9 | |||
| 65ba8ffd3b | |||
| c6467d67c5 | |||
| 5a9812887b | |||
| e637b47d68 | |||
| 0078a2e19b | |||
| d2713d0cfd | |||
| 4bf363f458 | |||
| c1b01029df | |||
| 4b299fedd7 | |||
| dc4074299c | |||
| 2d161f1341 | |||
| fea872d779 | |||
| 6c614051d9 | |||
| 2517316e2b | |||
| c83e50d164 | |||
| 66bc0223cb | |||
| 9ea09f95f8 | |||
| d66d95d4c6 | |||
| 024c288e12 | |||
| caac75fcc1 | |||
| eb88373ec5 | |||
| 4e86a9a08a | |||
| 099ebc3de9 | |||
| 4c3b9411b4 | |||
| 555b91e385 | |||
| 9713138f4f | |||
| 0934c2cda4 | |||
| bb204098a1 | |||
| c65e8d4a04 | |||
| a0cecd357f | |||
| 6a4f30d6fa | |||
| cfde4aa357 | |||
| 2a2f33fd6f | |||
| 8ad76e4e1f | |||
| b0b3d6b280 | |||
| e8257896d4 | |||
| 1e9a63083b | |||
| 40a1e15033 | |||
| 6c93c8b16c | |||
| 8813f8bb19 | |||
| 8e498c8299 | |||
| 706a2252fa | |||
| d423549ae4 | |||
| cef0adda0a | |||
| d73d682cbc | |||
| b3f5d84a51 | |||
| 23c2ecfe54 | |||
| 62ad5bf127 | |||
| ecc1e974ae | |||
| ef61b90242 | |||
| 00bdf67b8a | |||
| ee83f6c826 | |||
| ec50e77695 | |||
| 72fbe98925 | |||
| 4ef62b88cb | |||
| 3e8d5926ba | |||
| 0284c8df70 | |||
| 3d4faa267e | |||
| edc0ae2b8d | |||
| e7d081aefb | |||
| cc2867e292 | |||
| 92b0f4e654 | |||
| 46d4d76f26 | |||
| 53593c96af | |||
| 21f75547fb | |||
| 0daee49007 | |||
| 8e3df35232 | |||
| 521d7c1ee8 | |||
| f1e80adb9c | |||
| 3503eee5b6 | |||
| 1041802214 | |||
| cebc04b852 | |||
| dbfdffd0c5 | |||
| b8d2cba3ae | |||
| b56d62442d | |||
| 5d70f47ebc | |||
| 859351a8d1 | |||
| fbd408ec6d | |||
| c631b62e51 | |||
| 0dc65baa25 | |||
| 50fec65617 | |||
| cf66adea28 | |||
| 42466cf648 | |||
| 2b00698810 | |||
| 97f0958f09 | |||
| ac7614c4e6 | |||
| b4bb20bea7 | |||
| 2ce37e34c4 | |||
| 8cf7809359 | |||
| 277dd4a464 | |||
| cb8466de27 | |||
| c8b8462d31 | |||
| d75a3a5587 | |||
| 77b5ffb56d | |||
| ca70de93a4 | |||
| 04565bbdd4 | |||
| 4266857c6e | |||
| 8e6e510cd6 | |||
| 986d0f0d95 | |||
| 6caf517fe5 | |||
| d65d37476e | |||
| ffe85bd64f | |||
| d4c4b804c7 | |||
| 1de2807051 | |||
| 3003c66eba | |||
| cc4c0dd68e | |||
| e25a952279 | |||
| 894f78d143 | |||
| eeac44a1ab | |||
| a8e3dd2ef5 | |||
| 20a2aa1ef1 | |||
| 7d10e1e995 | |||
| c3531cb19c | |||
| ba6de346dc | |||
| f2aa34b5ce | |||
| cba68e2d2a | |||
| f8dd9fb085 | |||
| 39e95e8b49 | |||
| b98922dbfd | |||
| b2e807ec33 | |||
| 1eba4aefa8 | |||
| 956508f994 | |||
| e27415bb84 | |||
| 2afbd3c429 | |||
| 8cadb329b9 | |||
| d21d0caa68 | |||
| af7cb378ac | |||
| 81e075e715 | |||
| f7607e1c92 | |||
| 1022d29fe8 | |||
| d8d540bd02 | |||
| 63bf1797c0 | |||
| 93900a0be8 | |||
| 9ba32e031d | |||
| d69e4ca0ba | |||
| ef2963242a | |||
| cbfc2d5052 | |||
| 1a979fe30a | |||
| ff2146b671 | |||
| d1d5a46896 | |||
| dcc4342483 | |||
| ef5e71e941 | |||
| 5c1b611b88 | |||
| c6e15b7526 | |||
| d9902ba6f9 | |||
| 633af32919 | |||
| 40d3cd1a85 | |||
| 32103b8b9f | |||
| 1244ba5fe5 | |||
| 66231b65c1 | |||
| 7aa2d36d85 | |||
| 982d2d1872 | |||
| 71b1e4fbf3 | |||
| 1a1ec927e2 | |||
| c421936857 | |||
| 3580e84184 | |||
| 1538997b63 | |||
| bdb902128d | |||
| bb41c8b85f | |||
| fbee170e87 | |||
| 115917b9e5 | |||
| c67b78508e | |||
| 3d38fdd005 | |||
| f8ba0c59a6 | |||
| 296dba3a4e | |||
| 38457c0115 | |||
| 40789fbd24 | |||
| 4adc16620b | |||
| 0bfe049e84 | |||
| a6d8deedcd | |||
| 26b69e8612 | |||
| 9fa00c8609 | |||
| 59bb3035bb | |||
| dbb757a954 | |||
| 55a2fb1b00 | |||
| e9c200e455 | |||
| 887898fe58 | |||
| 627d02b006 | |||
| c9fad9a83f | |||
| 9b05fa38ea | |||
| 7062a26561 | |||
| 311d35f332 | |||
| a7fb914f5e | |||
| c068fd2ee0 | |||
| cfbb7d1216 | |||
| abd2421cc1 | |||
| 592fbfccbb | |||
| cf51a10da9 | |||
| 5f2c00a017 | |||
| bb7b63c86e | |||
| 0553db3a69 | |||
| a7ef6ea3be | |||
| 00ccd7f7a0 | |||
| 3604ca9450 | |||
| 01428dc78a | |||
| d72b9b47ed | |||
| 8ae7e577f0 | |||
| d7922089ea | |||
| 3231593049 | |||
| 7e7186f068 | |||
| 2d61e8bbd2 | |||
| 41dcf2eac4 | |||
| c4c350f1aa | |||
| 2f382d21dc | |||
| a968a3a035 | |||
| deb875337d | |||
| 9f62108376 | |||
| 0eedb80d36 | |||
| 8daa8dd509 | |||
| 8b82e48562 | |||
| 2425a40d36 | |||
| 4384ca2274 | |||
| b3590d66f0 | |||
| 1b0791364b | |||
| d939aa7247 | |||
| 14a8a4d8bb | |||
| 7a9549633b | |||
| 8507c8d4d9 |
141
Apple/IWork.cpp
Normal file
141
Apple/IWork.cpp
Normal file
@ -0,0 +1,141 @@
|
||||
#include "IWork.h"
|
||||
#include "../DesktopEditor/common/File.h"
|
||||
#include "../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include <libetonyek/libetonyek.h>
|
||||
#include <libodfgen/OdtGenerator.hxx>
|
||||
#include <libodfgen/OdsGenerator.hxx>
|
||||
#include <libodfgen/OdpGenerator.hxx>
|
||||
#include <libodfgen/test/StringDocumentHandler.hxx>
|
||||
|
||||
#include <memory>
|
||||
#include <fstream>
|
||||
|
||||
class CIWorkFile_Private
|
||||
{
|
||||
public:
|
||||
std::wstring m_sTempDirectory;
|
||||
|
||||
public:
|
||||
CIWorkFile_Private()
|
||||
{
|
||||
}
|
||||
~CIWorkFile_Private()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
CIWorkFile::CIWorkFile()
|
||||
{
|
||||
m_internal = new CIWorkFile_Private();
|
||||
}
|
||||
|
||||
CIWorkFile::~CIWorkFile()
|
||||
{
|
||||
delete m_internal;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
#define DATA_TYPE_INPUTFILE std::string
|
||||
#else
|
||||
#define DATA_TYPE_INPUTFILE std::wstring
|
||||
#endif
|
||||
|
||||
bool GetRVNGInputStream(const DATA_TYPE_INPUTFILE& sFile, std::shared_ptr<librevenge::RVNGInputStream>& oRVNGInputStream, libetonyek::EtonyekDocument::Type& oDocumentType)
|
||||
{
|
||||
oRVNGInputStream.reset(new librevenge::RVNGFileStream(sFile.c_str()));
|
||||
|
||||
oDocumentType = libetonyek::EtonyekDocument::TYPE_UNKNOWN;
|
||||
const libetonyek::EtonyekDocument::Confidence confidence = libetonyek::EtonyekDocument::isSupported(oRVNGInputStream.get(), &oDocumentType);
|
||||
|
||||
return libetonyek::EtonyekDocument::CONFIDENCE_NONE != confidence;
|
||||
}
|
||||
|
||||
IWorkFileType CIWorkFile::GetType(const std::wstring& sFile) const
|
||||
{
|
||||
//TODO:: так как на данный момент мы работает только напрямую с файлом, то работа с директорией нам пока не нужна
|
||||
if (NSDirectory::PathIsDirectory(sFile))
|
||||
return IWorkFileType::None;
|
||||
|
||||
std::shared_ptr<librevenge::RVNGInputStream> input;
|
||||
libetonyek::EtonyekDocument::Type oDocumentType;
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
std::string sFileA = U_TO_UTF8(sFile);
|
||||
if (!GetRVNGInputStream(sFileA, input, oDocumentType))
|
||||
return IWorkFileType::None;
|
||||
#else
|
||||
if (!GetRVNGInputStream(sFile, input, oDocumentType))
|
||||
return IWorkFileType::None;
|
||||
#endif
|
||||
|
||||
switch (oDocumentType)
|
||||
{
|
||||
case libetonyek::EtonyekDocument::TYPE_PAGES:
|
||||
return IWorkFileType::Pages;
|
||||
case libetonyek::EtonyekDocument::TYPE_NUMBERS:
|
||||
return IWorkFileType::Numbers;
|
||||
case libetonyek::EtonyekDocument::TYPE_KEYNOTE:
|
||||
return IWorkFileType::Keynote;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return IWorkFileType::None;
|
||||
}
|
||||
|
||||
template<class Generator>
|
||||
int Convert(const std::wstring& wsOutputFile, std::shared_ptr<librevenge::RVNGInputStream>& ptrInput, const std::wstring& wsPassword = L"", const std::wstring& wsTempDirectory = L"")
|
||||
{
|
||||
StringDocumentHandler content;
|
||||
Generator generator;
|
||||
generator.addDocumentHandler(&content, ODF_FLAT_XML);
|
||||
|
||||
bool bRes = libetonyek::EtonyekDocument::parse(ptrInput.get(), &generator);
|
||||
if (!bRes)
|
||||
return 1;
|
||||
|
||||
const std::string sOutputFileA = U_TO_UTF8(wsOutputFile);
|
||||
std::ofstream output(sOutputFileA.c_str());
|
||||
output << content.cstr();
|
||||
|
||||
if (output.bad())
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CIWorkFile::Convert2Odf(const std::wstring& sFile, const std::wstring& sOutputFile) const
|
||||
{
|
||||
//TODO:: так как на данный момент мы работает только напрямую с файлом, то работа с директорией нам пока не нужна
|
||||
if (NSDirectory::PathIsDirectory(sFile))
|
||||
return -1;
|
||||
|
||||
std::shared_ptr<librevenge::RVNGInputStream> input;
|
||||
libetonyek::EtonyekDocument::Type oDocumentType;
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
std::string sFileA = U_TO_UTF8(sFile);
|
||||
if (!GetRVNGInputStream(sFileA, input, oDocumentType))
|
||||
return -1;
|
||||
#else
|
||||
if (!GetRVNGInputStream(sFile, input, oDocumentType))
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
switch (oDocumentType)
|
||||
{
|
||||
case libetonyek::EtonyekDocument::TYPE_PAGES: return Convert<OdtGenerator>(sOutputFile, input);
|
||||
case libetonyek::EtonyekDocument::TYPE_NUMBERS: return Convert<OdsGenerator>(sOutputFile, input);
|
||||
case libetonyek::EtonyekDocument::TYPE_KEYNOTE: return Convert<OdpGenerator>(sOutputFile, input);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CIWorkFile::SetTmpDirectory(const std::wstring& sFolder)
|
||||
{
|
||||
m_internal->m_sTempDirectory = sFolder;
|
||||
}
|
||||
36
Apple/IWork.h
Normal file
36
Apple/IWork.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef _IWORKFILE_IWORKFILE_H
|
||||
#define _IWORKFILE_IWORKFILE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef IWORK_USE_DYNAMIC_LIBRARY
|
||||
#define IWORK_FILE_DECL_EXPORT
|
||||
#else
|
||||
#include "../DesktopEditor/common/base_export.h"
|
||||
#define IWORK_FILE_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
enum class IWorkFileType
|
||||
{
|
||||
Pages = 0,
|
||||
Numbers = 1,
|
||||
Keynote = 2,
|
||||
|
||||
None = 255
|
||||
};
|
||||
|
||||
class CIWorkFile_Private;
|
||||
class IWORK_FILE_DECL_EXPORT CIWorkFile
|
||||
{
|
||||
private:
|
||||
CIWorkFile_Private* m_internal;
|
||||
public:
|
||||
CIWorkFile();
|
||||
~CIWorkFile();
|
||||
|
||||
IWorkFileType GetType(const std::wstring& sFile) const;
|
||||
int Convert2Odf(const std::wstring& sFile, const std::wstring& sOutputFile) const;
|
||||
void SetTmpDirectory(const std::wstring& sFolder);
|
||||
};
|
||||
|
||||
#endif // _IWORKFILE_IWORKFILE_H
|
||||
46
Apple/IWork.pro
Normal file
46
Apple/IWork.pro
Normal file
@ -0,0 +1,46 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 0.0.0.1
|
||||
TARGET = IWorkFile
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
DEFINES += IWORK_USE_DYNAMIC_LIBRARY
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
ADD_DEPENDENCY(kernel, UnicodeConverter)
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD
|
||||
|
||||
core_android:DEFINES += NOT_USE_PTHREAD_CANCEL USE_FILE32API
|
||||
|
||||
# BOOST
|
||||
CONFIG += core_boost_regex
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/boost/boost.pri)
|
||||
|
||||
# ZLIB
|
||||
CONFIG += build_all_zlib build_zlib_as_sources
|
||||
include($$PWD/../OfficeUtils/OfficeUtils.pri)
|
||||
|
||||
# LIBXML
|
||||
CONFIG += core_static_link_xml_full
|
||||
CONFIG += core_only_libxml
|
||||
include($$PWD/../DesktopEditor/xml/build/qt/libxml2.pri)
|
||||
|
||||
#
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/apple/apple.pri)
|
||||
|
||||
# TEST
|
||||
HEADERS += $$ODF_LIB_ROOT/test/StringDocumentHandler.h
|
||||
SOURCES += $$ODF_LIB_ROOT/test/StringDocumentHandler.cxx
|
||||
|
||||
SOURCES += IWork.cpp
|
||||
|
||||
HEADERS += IWork.h
|
||||
0
Apple/test/examples/DO NOT REMOVE
Normal file
0
Apple/test/examples/DO NOT REMOVE
Normal file
45
Apple/test/main.cpp
Normal file
45
Apple/test/main.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../IWork.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CIWorkFile oFile;
|
||||
|
||||
std::wstring sExamplesDir = NSFile::GetProcessDirectory() + L"/../examples";
|
||||
oFile.Convert2Odf(sExamplesDir + L"/new.pages", sExamplesDir + L"/out_new.odt");
|
||||
oFile.Convert2Odf(sExamplesDir + L"/old.pages", sExamplesDir + L"/out_old.odt");
|
||||
|
||||
return 0;
|
||||
}
|
||||
20
Apple/test/test.pro
Normal file
20
Apple/test/test.pro
Normal file
@ -0,0 +1,20 @@
|
||||
CONFIG -= qt
|
||||
QT -= core gui
|
||||
|
||||
TARGET = test
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
TEMPLATE = app
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, IWorkFile)
|
||||
|
||||
core_linux:include($$PWD/../../Common/3dParty/icu/icu.pri)
|
||||
core_windows:LIBS += -lgdi32 -ladvapi32 -luser32 -lshell32
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
DESTDIR = $$PWD/build
|
||||
8
Common/3dParty/apple/.gitignore
vendored
Normal file
8
Common/3dParty/apple/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Ignore everything in this directory
|
||||
glm
|
||||
mdds
|
||||
librevenge
|
||||
libodfgen
|
||||
libetonyek
|
||||
# Except this file
|
||||
!.gitignore
|
||||
36
Common/3dParty/apple/apple.pri
Normal file
36
Common/3dParty/apple/apple.pri
Normal file
@ -0,0 +1,36 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
# LIBREVENGE
|
||||
REVENGE_LIB_ROOT = $$PWD/librevenge
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$REVENGE_LIB_ROOT/inc
|
||||
|
||||
HEADERS += $$files($$REVENGE_LIB_ROOT/inc/*.h, true)
|
||||
HEADERS += $$files($$REVENGE_LIB_ROOT/src/lib/*.h, true)
|
||||
SOURCES += $$files($$REVENGE_LIB_ROOT/src/lib/*.cpp, true)
|
||||
|
||||
# LIBODFGEN
|
||||
ODF_LIB_ROOT = $$PWD/libodfgen
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$ODF_LIB_ROOT/inc
|
||||
|
||||
HEADERS += $$files($$ODF_LIB_ROOT/inc/libodfgen/*.hxx, true)
|
||||
HEADERS += $$files($$ODF_LIB_ROOT/src/*.hxx, true)
|
||||
SOURCES += $$files($$ODF_LIB_ROOT/src/*.cxx, true)
|
||||
|
||||
# LIBETONYEK
|
||||
ETONYEK_LIB_ROOT = $$PWD/libetonyek
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$ETONYEK_LIB_ROOT/inc \
|
||||
$$ETONYEK_LIB_ROOT/src/lib \
|
||||
$$ETONYEK_LIB_ROOT/src/lib/contexts \
|
||||
$$PWD/mdds/include \
|
||||
$$PWD/glm
|
||||
|
||||
HEADERS += $$files($$ETONYEK_LIB_ROOT/inc/libetonyek/*.h, true)
|
||||
HEADERS += $$files($$ETONYEK_LIB_ROOT/src/lib/*.h, true)
|
||||
SOURCES += $$files($$ETONYEK_LIB_ROOT/src/lib/*.cpp, true)
|
||||
|
||||
121
Common/3dParty/apple/fetch.py
Normal file
121
Common/3dParty/apple/fetch.py
Normal file
@ -0,0 +1,121 @@
|
||||
import sys
|
||||
sys.path.append('../../../../build_tools/scripts')
|
||||
import base
|
||||
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"])
|
||||
|
||||
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 += "#ifndef _MSC_VER\n"
|
||||
fix_cpp_version += "namespace std {\n"
|
||||
fix_cpp_version += " template<bool __v>\n"
|
||||
fix_cpp_version += " using bool_constant = integral_constant<bool, __v>;\n\n"
|
||||
fix_cpp_version += " template <class... _Types>\n"
|
||||
fix_cpp_version += " using void_t = void;\n"
|
||||
fix_cpp_version += "}\n#endif\n"
|
||||
fix_cpp_version += "#endif\n\n"
|
||||
fix_cpp_version += "namespace mdds {"
|
||||
|
||||
base.replaceInFile("./mdds/include/mdds/global.hpp", "namespace mdds {", fix_cpp_version)
|
||||
|
||||
if not base.is_dir("librevenge"):
|
||||
base.cmd("git", ["clone", "https://github.com/Distrotech/librevenge.git"])
|
||||
base.cmd_in_dir("librevenge", "git", ["checkout", "becd044b519ab83893ad6398e3cbb499a7f0aaf4", "--quiet"])
|
||||
|
||||
stat_windows = ""
|
||||
stat_windows += "#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)\n"
|
||||
stat_windows += "#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)\n"
|
||||
stat_windows += "#endif\n"
|
||||
stat_windows += "#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)\n"
|
||||
stat_windows += "#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)\n"
|
||||
stat_windows += "#endif\n"
|
||||
|
||||
base.replaceInFile("./librevenge/src/lib/RVNGDirectoryStream.cpp", "#include <librevenge-stream/librevenge-stream.h>",
|
||||
"#include <librevenge-stream/librevenge-stream.h>\n\n" + stat_windows)
|
||||
|
||||
fix_RVNG_H = "explicit RVNGFileStream(const char *filename);\n"
|
||||
fix_RVNG_H += " #if defined(_WIN32) || defined(_WIN64)\n"
|
||||
fix_RVNG_H += " explicit RVNGFileStream(const wchar_t *filename);\n"
|
||||
fix_RVNG_H += " #endif\n"
|
||||
|
||||
base.replaceInFile("./librevenge/inc/librevenge-stream/RVNGStreamImplementation.h", "explicit RVNGFileStream(const char *filename);", fix_RVNG_H)
|
||||
|
||||
fix_RVNG_CPP_include = "#if defined(_WIN32) || defined(_WIN64)\n"
|
||||
fix_RVNG_CPP_include += "#include <sys/stat.h>\n\n"
|
||||
fix_RVNG_CPP_include += "static __inline int wstat(wchar_t const* const _FileName, struct stat* const _Stat)\n"
|
||||
fix_RVNG_CPP_include += "{\n"
|
||||
fix_RVNG_CPP_include += " _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat64i32));\n";
|
||||
fix_RVNG_CPP_include += " return _wstat64i32(_FileName, (struct _stat64i32*)_Stat);\n";
|
||||
fix_RVNG_CPP_include += "}\n"
|
||||
fix_RVNG_CPP_include += "#endif\n\n"
|
||||
fix_RVNG_CPP_include += "namespace librevenge"
|
||||
|
||||
base.replaceInFile("./librevenge/src/lib/RVNGStreamImplementation.cpp", "namespace librevenge", fix_RVNG_CPP_include)
|
||||
|
||||
fix_RVNG_CPP = "#if defined(_WIN32) || defined(_WIN64)\n"
|
||||
fix_RVNG_CPP += "RVNGFileStream::RVNGFileStream(const wchar_t *filename) :\n"
|
||||
fix_RVNG_CPP += " RVNGInputStream(),\n"
|
||||
fix_RVNG_CPP += " d(new RVNGFileStreamPrivate())\n"
|
||||
fix_RVNG_CPP += "{\n"
|
||||
fix_RVNG_CPP += " d->file = _wfopen(filename, L\"rb\");\n"
|
||||
fix_RVNG_CPP += " if (!d->file || ferror(d->file))\n"
|
||||
fix_RVNG_CPP += " {\n"
|
||||
fix_RVNG_CPP += " delete d;\n"
|
||||
fix_RVNG_CPP += " d = 0;\n"
|
||||
fix_RVNG_CPP += " return;\n"
|
||||
fix_RVNG_CPP += " }\n\n"
|
||||
fix_RVNG_CPP += " struct stat status;\n"
|
||||
fix_RVNG_CPP += " const int retval = wstat(filename, &status);\n"
|
||||
fix_RVNG_CPP += " if ((0 != retval) || !S_ISREG(status.st_mode))\n"
|
||||
fix_RVNG_CPP += " {\n"
|
||||
fix_RVNG_CPP += " delete d;\n"
|
||||
fix_RVNG_CPP += " d = 0;\n"
|
||||
fix_RVNG_CPP += " return;\n"
|
||||
fix_RVNG_CPP += " }\n\n"
|
||||
fix_RVNG_CPP += " fseek(d->file, 0, SEEK_END);\n\n"
|
||||
fix_RVNG_CPP += " d->streamSize = (unsigned long) ftell(d->file);\n"
|
||||
fix_RVNG_CPP += " if (d->streamSize == (unsigned long)-1)\n"
|
||||
fix_RVNG_CPP += " d->streamSize = 0;\n"
|
||||
fix_RVNG_CPP += " if (d->streamSize > (std::numeric_limits<unsigned long>::max)() / 2)\n"
|
||||
fix_RVNG_CPP += " d->streamSize = (std::numeric_limits<unsigned long>::max)() / 2;\n"
|
||||
fix_RVNG_CPP += " fseek(d->file, 0, SEEK_SET);\n"
|
||||
fix_RVNG_CPP += "}\n"
|
||||
fix_RVNG_CPP += "#endif\n\n"
|
||||
fix_RVNG_CPP += "RVNGFileStream::~RVNGFileStream()"
|
||||
|
||||
base.replaceInFile("./librevenge/src/lib/RVNGStreamImplementation.cpp", "RVNGFileStream::~RVNGFileStream()", fix_RVNG_CPP)
|
||||
|
||||
if not base.is_dir("libodfgen"):
|
||||
base.cmd("git", ["clone", "https://github.com/Distrotech/libodfgen.git"])
|
||||
base.cmd_in_dir("libodfgen", "git", ["checkout", "8ef8c171ebe3c5daebdce80ee422cf7bb96aa3bc", "--quiet"])
|
||||
|
||||
if not base.is_dir("libetonyek"):
|
||||
base.cmd("git", ["clone", "https://github.com/LibreOffice/libetonyek.git"])
|
||||
base.cmd_in_dir("libetonyek", "git", ["checkout", "cb396b4a9453a457469b62a740d8fb933c9442c3", "--quiet"])
|
||||
|
||||
base.replaceInFile("./libetonyek/src/lib/IWORKTable.cpp", "is_tree_valid", "valid_tree")
|
||||
|
||||
cmd_args = sys.argv[1:]
|
||||
use_gperf = False
|
||||
|
||||
for arg in cmd_args:
|
||||
if '--gperf' == arg:
|
||||
use_gperf = True
|
||||
|
||||
if use_gperf:
|
||||
base_gperf_args = ["--compare-strncmp", "--enum", "--null-strings", "--readonly-tables", "--language", "C++"]
|
||||
base_gperf_files = ["IWORKToken.gperf", "KEY1Token.gperf", "KEY2Token.gperf", "NUM1Token.gperf", "PAG1Token.gperf"]
|
||||
|
||||
for file in base_gperf_files:
|
||||
base.cmd_in_dir("./libetonyek/src/lib", "gperf", base_gperf_args + [file, "--output-file", file[0:file.find(".")] + ".inc"])
|
||||
else:
|
||||
base.copy_dir_content("./headers", "./libetonyek/src/lib")
|
||||
|
||||
|
||||
|
||||
2563
Common/3dParty/apple/headers/IWORKToken.inc
Normal file
2563
Common/3dParty/apple/headers/IWORKToken.inc
Normal file
File diff suppressed because it is too large
Load Diff
727
Common/3dParty/apple/headers/KEY1Token.inc
Normal file
727
Common/3dParty/apple/headers/KEY1Token.inc
Normal file
@ -0,0 +1,727 @@
|
||||
/* C++ code produced by gperf version 3.0.1 */
|
||||
/* Command-line: gperf --compare-strncmp --enum --null-strings --readonly-tables --language C++ --output-file KEY1Token.inc KEY1Token.gperf */
|
||||
/* Computed positions: -k'1,3,6,9,14,$' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
#line 10 "KEY1Token.gperf"
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
using namespace KEY1Token;
|
||||
#line 18 "KEY1Token.gperf"
|
||||
struct Token
|
||||
{
|
||||
const char *name;
|
||||
int id;
|
||||
};
|
||||
#include <string.h>
|
||||
/* maximum key range = 602, duplicates = 0 */
|
||||
|
||||
class Perfect_Hash
|
||||
{
|
||||
private:
|
||||
static inline unsigned int hash (const char *str, unsigned int len);
|
||||
public:
|
||||
static const struct Token *in_word_set (const char *str, unsigned int len);
|
||||
};
|
||||
|
||||
inline unsigned int
|
||||
Perfect_Hash::hash (register const char *str, register unsigned int len)
|
||||
{
|
||||
static const unsigned short asso_values[] =
|
||||
{
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 220, 612, 0, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 0, 0, 0, 0,
|
||||
0, 0, 10, 612, 612, 612, 0, 612, 30, 15,
|
||||
55, 612, 5, 60, 5, 612, 10, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 0, 612, 20, 165, 115,
|
||||
65, 0, 105, 135, 175, 60, 0, 0, 30, 145,
|
||||
10, 5, 155, 10, 5, 30, 5, 200, 15, 20,
|
||||
0, 190, 0, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612, 612, 612, 612, 612,
|
||||
612, 612, 612, 612, 612, 612
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
hval += asso_values[(unsigned char)str[13]];
|
||||
/*FALLTHROUGH*/
|
||||
case 13:
|
||||
case 12:
|
||||
case 11:
|
||||
case 10:
|
||||
case 9:
|
||||
hval += asso_values[(unsigned char)str[8]];
|
||||
/*FALLTHROUGH*/
|
||||
case 8:
|
||||
case 7:
|
||||
case 6:
|
||||
hval += asso_values[(unsigned char)str[5]];
|
||||
/*FALLTHROUGH*/
|
||||
case 5:
|
||||
case 4:
|
||||
case 3:
|
||||
hval += asso_values[(unsigned char)str[2]];
|
||||
/*FALLTHROUGH*/
|
||||
case 2:
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval + asso_values[(unsigned char)str[len - 1]];
|
||||
}
|
||||
|
||||
const struct Token *
|
||||
Perfect_Hash::in_word_set (register const char *str, register unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 203,
|
||||
MIN_WORD_LENGTH = 1,
|
||||
MAX_WORD_LENGTH = 39,
|
||||
MIN_HASH_VALUE = 10,
|
||||
MAX_HASH_VALUE = 611
|
||||
};
|
||||
|
||||
static const struct Token wordlist[] =
|
||||
{
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 199 "KEY1Token.gperf"
|
||||
{"theme",theme},
|
||||
{(char*)0},
|
||||
#line 211 "KEY1Token.gperf"
|
||||
{"tr",tr},
|
||||
{(char*)0},
|
||||
#line 196 "KEY1Token.gperf"
|
||||
{"text",text},
|
||||
#line 207 "KEY1Token.gperf"
|
||||
{"title",title},
|
||||
{(char*)0},
|
||||
#line 198 "KEY1Token.gperf"
|
||||
{"textbox",textbox},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 65 "KEY1Token.gperf"
|
||||
{"element",element},
|
||||
{(char*)0},
|
||||
#line 132 "KEY1Token.gperf"
|
||||
{"none",none},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0},
|
||||
#line 175 "KEY1Token.gperf"
|
||||
{"size",size},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 209 "KEY1Token.gperf"
|
||||
{"tl",tl},
|
||||
{(char*)0},
|
||||
#line 206 "KEY1Token.gperf"
|
||||
{"tile",tile},
|
||||
#line 168 "KEY1Token.gperf"
|
||||
{"serie",serie},
|
||||
{(char*)0},
|
||||
#line 221 "KEY1Token.gperf"
|
||||
{"version",version},
|
||||
{(char*)0},
|
||||
#line 112 "KEY1Token.gperf"
|
||||
{"line",line},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 174 "KEY1Token.gperf"
|
||||
{"showZero",showZero},
|
||||
{(char*)0},
|
||||
#line 133 "KEY1Token.gperf"
|
||||
{"notes",notes},
|
||||
{(char*)0},
|
||||
#line 188 "KEY1Token.gperf"
|
||||
{"stroke-style",stroke_style},
|
||||
{(char*)0},
|
||||
#line 32 "KEY1Token.gperf"
|
||||
{"axes",axes},
|
||||
#line 172 "KEY1Token.gperf"
|
||||
{"shape",shape},
|
||||
{(char*)0},
|
||||
#line 187 "KEY1Token.gperf"
|
||||
{"stroke-color",stroke_color},
|
||||
#line 166 "KEY1Token.gperf"
|
||||
{"sequence",sequence},
|
||||
{(char*)0},
|
||||
#line 183 "KEY1Token.gperf"
|
||||
{"start",start},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 182 "KEY1Token.gperf"
|
||||
{"span",span},
|
||||
#line 185 "KEY1Token.gperf"
|
||||
{"steps",steps},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 93 "KEY1Token.gperf"
|
||||
{"ident",ident},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 134 "KEY1Token.gperf"
|
||||
{"null",null},
|
||||
#line 197 "KEY1Token.gperf"
|
||||
{"text-attributes",text_attributes},
|
||||
{(char*)0},
|
||||
#line 130 "KEY1Token.gperf"
|
||||
{"natural-size",natural_size},
|
||||
{(char*)0},
|
||||
#line 131 "KEY1Token.gperf"
|
||||
{"node",node},
|
||||
#line 111 "KEY1Token.gperf"
|
||||
{"level",level},
|
||||
{(char*)0},
|
||||
#line 225 "KEY1Token.gperf"
|
||||
{"visible",visible},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 95 "KEY1Token.gperf"
|
||||
{"image",image},
|
||||
{(char*)0},
|
||||
#line 171 "KEY1Token.gperf"
|
||||
{"shadow-style",shadow_style},
|
||||
{(char*)0},
|
||||
#line 67 "KEY1Token.gperf"
|
||||
{"end-color",end_color},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 208 "KEY1Token.gperf"
|
||||
{"titleVisible",titleVisible},
|
||||
#line 212 "KEY1Token.gperf"
|
||||
{"tracks-master",tracks_master},
|
||||
#line 53 "KEY1Token.gperf"
|
||||
{"data",data},
|
||||
#line 177 "KEY1Token.gperf"
|
||||
{"slide",slide},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 62 "KEY1Token.gperf"
|
||||
{"div",div},
|
||||
#line 195 "KEY1Token.gperf"
|
||||
{"tail",tail},
|
||||
#line 170 "KEY1Token.gperf"
|
||||
{"seriesDirection",seriesDirection},
|
||||
#line 169 "KEY1Token.gperf"
|
||||
{"series",series},
|
||||
{(char*)0},
|
||||
#line 162 "KEY1Token.gperf"
|
||||
{"relative",relative},
|
||||
#line 60 "KEY1Token.gperf"
|
||||
{"direction",direction},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 27 "KEY1Token.gperf"
|
||||
{"altLineVisible",altLineVisible},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 173 "KEY1Token.gperf"
|
||||
{"showGrid",showGrid},
|
||||
#line 33 "KEY1Token.gperf"
|
||||
{"axis",axis},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 161 "KEY1Token.gperf"
|
||||
{"reference",reference},
|
||||
#line 114 "KEY1Token.gperf"
|
||||
{"line-tail-style",line_tail_style},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 73 "KEY1Token.gperf"
|
||||
{"font",font},
|
||||
{(char*)0},
|
||||
#line 137 "KEY1Token.gperf"
|
||||
{"offset",offset},
|
||||
#line 92 "KEY1Token.gperf"
|
||||
{"id",id},
|
||||
{(char*)0},
|
||||
#line 160 "KEY1Token.gperf"
|
||||
{"rect",rect},
|
||||
#line 180 "KEY1Token.gperf"
|
||||
{"solid",solid},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 66 "KEY1Token.gperf"
|
||||
{"end",end},
|
||||
#line 77 "KEY1Token.gperf"
|
||||
{"font-name",font_name},
|
||||
{(char*)0},
|
||||
#line 159 "KEY1Token.gperf"
|
||||
{"radius",radius},
|
||||
#line 61 "KEY1Token.gperf"
|
||||
{"display-name",display_name},
|
||||
{(char*)0},
|
||||
#line 68 "KEY1Token.gperf"
|
||||
{"file",file},
|
||||
{(char*)0},
|
||||
#line 45 "KEY1Token.gperf"
|
||||
{"center",center},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 109 "KEY1Token.gperf"
|
||||
{"left",left},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 51 "KEY1Token.gperf"
|
||||
{"content",content},
|
||||
#line 64 "KEY1Token.gperf"
|
||||
{"duration",duration},
|
||||
#line 71 "KEY1Token.gperf"
|
||||
{"fill-type",fill_type},
|
||||
#line 163 "KEY1Token.gperf"
|
||||
{"right",right},
|
||||
#line 139 "KEY1Token.gperf"
|
||||
{"orientation",orientation},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 78 "KEY1Token.gperf"
|
||||
{"font-size",font_size},
|
||||
#line 50 "KEY1Token.gperf"
|
||||
{"color",color},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 129 "KEY1Token.gperf"
|
||||
{"name",name},
|
||||
#line 28 "KEY1Token.gperf"
|
||||
{"angle",angle},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 215 "KEY1Token.gperf"
|
||||
{"type",type},
|
||||
#line 52 "KEY1Token.gperf"
|
||||
{"dash-style",dash_style},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 82 "KEY1Token.gperf"
|
||||
{"gradient",gradient},
|
||||
#line 56 "KEY1Token.gperf"
|
||||
{"dataFormatterPrefix",dataFormatterPrefix},
|
||||
#line 54 "KEY1Token.gperf"
|
||||
{"dataFormatterHasThousandsSeparators",dataFormatterHasThousandsSeparators},
|
||||
#line 135 "KEY1Token.gperf"
|
||||
{"number",number},
|
||||
#line 38 "KEY1Token.gperf"
|
||||
{"br",br},
|
||||
#line 222 "KEY1Token.gperf"
|
||||
{"vertical",vertical},
|
||||
#line 57 "KEY1Token.gperf"
|
||||
{"dataFormatterSuffix",dataFormatterSuffix},
|
||||
#line 193 "KEY1Token.gperf"
|
||||
{"table",table},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 24 "KEY1Token.gperf"
|
||||
{"DefaultLegendRelativePosition",DefaultLegendRelativePosition},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 146 "KEY1Token.gperf"
|
||||
{"pattern",pattern},
|
||||
{(char*)0},
|
||||
#line 55 "KEY1Token.gperf"
|
||||
{"dataFormatterNumberOfDecimals",dataFormatterNumberOfDecimals},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 165 "KEY1Token.gperf"
|
||||
{"segment",segment},
|
||||
{(char*)0},
|
||||
#line 59 "KEY1Token.gperf"
|
||||
{"dict",dict},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 153 "KEY1Token.gperf"
|
||||
{"presentation",presentation},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 35 "KEY1Token.gperf"
|
||||
{"bl",bl},
|
||||
#line 126 "KEY1Token.gperf"
|
||||
{"metadata",metadata},
|
||||
{(char*)0},
|
||||
#line 86 "KEY1Token.gperf"
|
||||
{"guide",guide},
|
||||
{(char*)0},
|
||||
#line 181 "KEY1Token.gperf"
|
||||
{"spacing",spacing},
|
||||
#line 120 "KEY1Token.gperf"
|
||||
{"majorTickPositions",majorTickPositions},
|
||||
{(char*)0},
|
||||
#line 70 "KEY1Token.gperf"
|
||||
{"fill-style",fill_style},
|
||||
{(char*)0},
|
||||
#line 118 "KEY1Token.gperf"
|
||||
{"lock-aspect-ratio",lock_aspect_ratio},
|
||||
{(char*)0},
|
||||
#line 44 "KEY1Token.gperf"
|
||||
{"byte-size",byte_size},
|
||||
{(char*)0},
|
||||
#line 40 "KEY1Token.gperf"
|
||||
{"bullet",bullet},
|
||||
#line 25 "KEY1Token.gperf"
|
||||
{"DefaultLegendSize",DefaultLegendSize},
|
||||
#line 128 "KEY1Token.gperf"
|
||||
{"minorTickPositions",minorTickPositions},
|
||||
{(char*)0},
|
||||
#line 202 "KEY1Token.gperf"
|
||||
{"tickLabelsAngle",tickLabelsAngle},
|
||||
#line 127 "KEY1Token.gperf"
|
||||
{"middle",middle},
|
||||
{(char*)0},
|
||||
#line 152 "KEY1Token.gperf"
|
||||
{"pos",pos},
|
||||
#line 155 "KEY1Token.gperf"
|
||||
{"prototype-data",prototype_data},
|
||||
#line 31 "KEY1Token.gperf"
|
||||
{"array",array},
|
||||
{(char*)0},
|
||||
#line 122 "KEY1Token.gperf"
|
||||
{"master-slide",master_slide},
|
||||
#line 117 "KEY1Token.gperf"
|
||||
{"location",location},
|
||||
#line 176 "KEY1Token.gperf"
|
||||
{"size-technique",size_technique},
|
||||
{(char*)0},
|
||||
#line 79 "KEY1Token.gperf"
|
||||
{"font-superscript",font_superscript},
|
||||
#line 138 "KEY1Token.gperf"
|
||||
{"opacity",opacity},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 100 "KEY1Token.gperf"
|
||||
{"interBarGap",interBarGap},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 156 "KEY1Token.gperf"
|
||||
{"prototype-drawables",prototype_drawables},
|
||||
{(char*)0},
|
||||
#line 58 "KEY1Token.gperf"
|
||||
{"description",description},
|
||||
#line 43 "KEY1Token.gperf"
|
||||
{"bullets",bullets},
|
||||
{(char*)0},
|
||||
#line 76 "KEY1Token.gperf"
|
||||
{"font-ligatures",font_ligatures},
|
||||
{(char*)0},
|
||||
#line 191 "KEY1Token.gperf"
|
||||
{"symbol",symbol},
|
||||
#line 154 "KEY1Token.gperf"
|
||||
{"prototype-bullets",prototype_bullets},
|
||||
{(char*)0},
|
||||
#line 194 "KEY1Token.gperf"
|
||||
{"tab-stops",tab_stops},
|
||||
#line 90 "KEY1Token.gperf"
|
||||
{"horizontal",horizontal},
|
||||
{(char*)0},
|
||||
#line 204 "KEY1Token.gperf"
|
||||
{"tickLabelsVisible",tickLabelsVisible},
|
||||
{(char*)0},
|
||||
#line 192 "KEY1Token.gperf"
|
||||
{"symbolFillMode",symbolFillMode},
|
||||
#line 74 "KEY1Token.gperf"
|
||||
{"font-color",font_color},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 124 "KEY1Token.gperf"
|
||||
{"master-slides",master_slides},
|
||||
#line 147 "KEY1Token.gperf"
|
||||
{"pieSliceOffset",pieSliceOffset},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 42 "KEY1Token.gperf"
|
||||
{"bullet-indentation",bullet_indentation},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 87 "KEY1Token.gperf"
|
||||
{"guides",guides},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 88 "KEY1Token.gperf"
|
||||
{"head",head},
|
||||
#line 226 "KEY1Token.gperf"
|
||||
{"width",width},
|
||||
#line 89 "KEY1Token.gperf"
|
||||
{"hidden",hidden},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 46 "KEY1Token.gperf"
|
||||
{"character",character},
|
||||
#line 69 "KEY1Token.gperf"
|
||||
{"fill-color",fill_color},
|
||||
#line 81 "KEY1Token.gperf"
|
||||
{"g",g},
|
||||
#line 75 "KEY1Token.gperf"
|
||||
{"font-kerning",font_kerning},
|
||||
{(char*)0},
|
||||
#line 103 "KEY1Token.gperf"
|
||||
{"justified",justified},
|
||||
{(char*)0},
|
||||
#line 116 "KEY1Token.gperf"
|
||||
{"lineVisible",lineVisible},
|
||||
#line 107 "KEY1Token.gperf"
|
||||
{"labelVisible",labelVisible},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 119 "KEY1Token.gperf"
|
||||
{"locked",locked},
|
||||
#line 189 "KEY1Token.gperf"
|
||||
{"stroke-width",stroke_width},
|
||||
{(char*)0},
|
||||
#line 200 "KEY1Token.gperf"
|
||||
{"thumbnail",thumbnail},
|
||||
#line 201 "KEY1Token.gperf"
|
||||
{"thumbnails",thumbnails},
|
||||
#line 190 "KEY1Token.gperf"
|
||||
{"styles",styles},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 136 "KEY1Token.gperf"
|
||||
{"numberOfPoints",numberOfPoints},
|
||||
#line 49 "KEY1Token.gperf"
|
||||
{"chartFrame",chartFrame},
|
||||
#line 167 "KEY1Token.gperf"
|
||||
{"sequence-bullet-style",sequence_bullet_style},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 214 "KEY1Token.gperf"
|
||||
{"transition-style",transition_style},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 110 "KEY1Token.gperf"
|
||||
{"legend",legend},
|
||||
#line 148 "KEY1Token.gperf"
|
||||
{"pieSlicePercentVisible",pieSlicePercentVisible},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 47 "KEY1Token.gperf"
|
||||
{"character-bullet-style",character_bullet_style},
|
||||
{(char*)0},
|
||||
#line 213 "KEY1Token.gperf"
|
||||
{"transformation",transformation},
|
||||
#line 224 "KEY1Token.gperf"
|
||||
{"visibility",visibility},
|
||||
#line 186 "KEY1Token.gperf"
|
||||
{"string",string},
|
||||
{(char*)0},
|
||||
#line 39 "KEY1Token.gperf"
|
||||
{"buildChunkingStyle",buildChunkingStyle},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 184 "KEY1Token.gperf"
|
||||
{"start-color",start_color},
|
||||
{(char*)0},
|
||||
#line 210 "KEY1Token.gperf"
|
||||
{"top",top},
|
||||
#line 63 "KEY1Token.gperf"
|
||||
{"drawables",drawables},
|
||||
#line 179 "KEY1Token.gperf"
|
||||
{"slide-size",slide_size},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 113 "KEY1Token.gperf"
|
||||
{"line-head-style",line_head_style},
|
||||
#line 157 "KEY1Token.gperf"
|
||||
{"prototype-plugin",prototype_plugin},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 80 "KEY1Token.gperf"
|
||||
{"font-underline",font_underline},
|
||||
{(char*)0},
|
||||
#line 97 "KEY1Token.gperf"
|
||||
{"image-scale",image_scale},
|
||||
{(char*)0},
|
||||
#line 106 "KEY1Token.gperf"
|
||||
{"labelPosition",labelPosition},
|
||||
{(char*)0},
|
||||
#line 96 "KEY1Token.gperf"
|
||||
{"image-data",image_data},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 145 "KEY1Token.gperf"
|
||||
{"path",path},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 34 "KEY1Token.gperf"
|
||||
{"background-fill-style",background_fill_style},
|
||||
#line 158 "KEY1Token.gperf"
|
||||
{"prototype-plugins",prototype_plugins},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 123 "KEY1Token.gperf"
|
||||
{"master-slide-id",master_slide_id},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 178 "KEY1Token.gperf"
|
||||
{"slide-list",slide_list},
|
||||
#line 121 "KEY1Token.gperf"
|
||||
{"marker-type",marker_type},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0},
|
||||
#line 91 "KEY1Token.gperf"
|
||||
{"http://developer.apple.com/schemas/APXL",NS_URI_KEY},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 98 "KEY1Token.gperf"
|
||||
{"image-bullet-style",image_bullet_style},
|
||||
#line 30 "KEY1Token.gperf"
|
||||
{"application-version",application_version},
|
||||
{(char*)0},
|
||||
#line 149 "KEY1Token.gperf"
|
||||
{"plugin",plugin},
|
||||
#line 151 "KEY1Token.gperf"
|
||||
{"point_at_top",point_at_top},
|
||||
#line 104 "KEY1Token.gperf"
|
||||
{"key",key},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 29 "KEY1Token.gperf"
|
||||
{"application-name",application_name},
|
||||
{(char*)0},
|
||||
#line 223 "KEY1Token.gperf"
|
||||
{"vertical-alignment",vertical_alignment},
|
||||
#line 83 "KEY1Token.gperf"
|
||||
{"gradient-angle",gradient_angle},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 144 "KEY1Token.gperf"
|
||||
{"paragraph-tail-indent",paragraph_tail_indent},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0},
|
||||
#line 142 "KEY1Token.gperf"
|
||||
{"paragraph-first-line-indent",paragraph_first_line_indent},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 72 "KEY1Token.gperf"
|
||||
{"floating-content",floating_content},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 150 "KEY1Token.gperf"
|
||||
{"plugin-data",plugin_data},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 36 "KEY1Token.gperf"
|
||||
{"body",body},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 41 "KEY1Token.gperf"
|
||||
{"bullet-characters",bullet_characters},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 143 "KEY1Token.gperf"
|
||||
{"paragraph-head-indent",paragraph_head_indent},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 99 "KEY1Token.gperf"
|
||||
{"inherited",inherited},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 125 "KEY1Token.gperf"
|
||||
{"match-point",match_point},
|
||||
{(char*)0},
|
||||
#line 216 "KEY1Token.gperf"
|
||||
{"ui-state",ui_state},
|
||||
#line 102 "KEY1Token.gperf"
|
||||
{"is-filled",is_filled},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 115 "KEY1Token.gperf"
|
||||
{"lineOpacity",lineOpacity},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0},
|
||||
#line 37 "KEY1Token.gperf"
|
||||
{"bottom",bottom},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 140 "KEY1Token.gperf"
|
||||
{"page-number",page_number},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 205 "KEY1Token.gperf"
|
||||
{"time-stamp",time_stamp},
|
||||
{(char*)0},
|
||||
#line 203 "KEY1Token.gperf"
|
||||
{"tickLabelsOpacity",tickLabelsOpacity},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 94 "KEY1Token.gperf"
|
||||
{"id-ref",id_ref},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 141 "KEY1Token.gperf"
|
||||
{"paragraph-alignment",paragraph_alignment},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 164 "KEY1Token.gperf"
|
||||
{"scale-to-fit",scale_to_fit},
|
||||
{(char*)0},
|
||||
#line 101 "KEY1Token.gperf"
|
||||
{"interSeriesGap",interSeriesGap},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 219 "KEY1Token.gperf"
|
||||
{"userMaximum",userMaximum},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 217 "KEY1Token.gperf"
|
||||
{"useUserMaximum",useUserMaximum},
|
||||
#line 108 "KEY1Token.gperf"
|
||||
{"layerElementsForShadowing",layerElementsForShadowing},
|
||||
{(char*)0},
|
||||
#line 105 "KEY1Token.gperf"
|
||||
{"labelOpacity",labelOpacity},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 48 "KEY1Token.gperf"
|
||||
{"chart-prototype",chart_prototype},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 220 "KEY1Token.gperf"
|
||||
{"userMinimum",userMinimum},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 218 "KEY1Token.gperf"
|
||||
{"useUserMinimum",useUserMinimum},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 26 "KEY1Token.gperf"
|
||||
{"altLineOpacity",altLineOpacity},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0},
|
||||
#line 85 "KEY1Token.gperf"
|
||||
{"grow-horizontally",grow_horizontally},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 84 "KEY1Token.gperf"
|
||||
{"gridOpacity",gridOpacity}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (s && *str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#line 227 "KEY1Token.gperf"
|
||||
|
||||
300
Common/3dParty/apple/headers/KEY2Token.inc
Normal file
300
Common/3dParty/apple/headers/KEY2Token.inc
Normal file
@ -0,0 +1,300 @@
|
||||
/* C++ code produced by gperf version 3.0.1 */
|
||||
/* Command-line: gperf --compare-strncmp --enum --null-strings --readonly-tables --language C++ --output-file KEY2Token.inc KEY2Token.gperf */
|
||||
/* Computed positions: -k'1,4,$' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
#line 10 "KEY2Token.gperf"
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
using namespace KEY2Token;
|
||||
#line 18 "KEY2Token.gperf"
|
||||
struct Token
|
||||
{
|
||||
const char *name;
|
||||
int id;
|
||||
};
|
||||
#include <string.h>
|
||||
/* maximum key range = 140, duplicates = 0 */
|
||||
|
||||
class Perfect_Hash
|
||||
{
|
||||
private:
|
||||
static inline unsigned int hash (const char *str, unsigned int len);
|
||||
public:
|
||||
static const struct Token *in_word_set (const char *str, unsigned int len);
|
||||
};
|
||||
|
||||
inline unsigned int
|
||||
Perfect_Hash::hash (register const char *str, register unsigned int len)
|
||||
{
|
||||
static const unsigned char asso_values[] =
|
||||
{
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 5, 65,
|
||||
0, 141, 35, 0, 141, 5, 141, 0, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 0, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 0, 25, 0,
|
||||
15, 0, 55, 10, 10, 5, 141, 15, 20, 0,
|
||||
10, 25, 40, 141, 25, 25, 5, 0, 30, 5,
|
||||
141, 40, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
|
||||
141, 141, 141, 141, 141, 141
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
hval += asso_values[(unsigned char)str[3]];
|
||||
/*FALLTHROUGH*/
|
||||
case 3:
|
||||
case 2:
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval + asso_values[(unsigned char)str[len - 1]];
|
||||
}
|
||||
|
||||
const struct Token *
|
||||
Perfect_Hash::in_word_set (register const char *str, register unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 67,
|
||||
MIN_WORD_LENGTH = 1,
|
||||
MAX_WORD_LENGTH = 46,
|
||||
MIN_HASH_VALUE = 1,
|
||||
MAX_HASH_VALUE = 140
|
||||
};
|
||||
|
||||
static const struct Token wordlist[] =
|
||||
{
|
||||
{(char*)0},
|
||||
#line 49 "KEY2Token.gperf"
|
||||
{"c",c},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 65 "KEY2Token.gperf"
|
||||
{"metadata",metadata},
|
||||
#line 89 "KEY2Token.gperf"
|
||||
{"type",type},
|
||||
#line 84 "KEY2Token.gperf"
|
||||
{"theme",theme},
|
||||
#line 58 "KEY2Token.gperf"
|
||||
{"i",i},
|
||||
#line 50 "KEY2Token.gperf"
|
||||
{"comment",comment},
|
||||
#line 41 "KEY2Token.gperf"
|
||||
{"animationType",animationType},
|
||||
#line 66 "KEY2Token.gperf"
|
||||
{"name",name},
|
||||
#line 26 "KEY2Token.gperf"
|
||||
{"2005112100",VERSION_STR_3},
|
||||
{(char*)0},
|
||||
#line 62 "KEY2Token.gperf"
|
||||
{"master-slide",master_slide},
|
||||
{(char*)0},
|
||||
#line 83 "KEY2Token.gperf"
|
||||
{"text",text},
|
||||
#line 85 "KEY2Token.gperf"
|
||||
{"theme-list",theme_list},
|
||||
#line 28 "KEY2Token.gperf"
|
||||
{"92008102400",VERSION_STR_5},
|
||||
{(char*)0},
|
||||
#line 36 "KEY2Token.gperf"
|
||||
{"animationEndOffset",animationEndOffset},
|
||||
{(char*)0},
|
||||
#line 39 "KEY2Token.gperf"
|
||||
{"animationStartOffset",animationStartOffset},
|
||||
#line 27 "KEY2Token.gperf"
|
||||
{"72007061400",VERSION_STR_4},
|
||||
#line 35 "KEY2Token.gperf"
|
||||
{"animationDuration",animationDuration},
|
||||
#line 40 "KEY2Token.gperf"
|
||||
{"animationTimingReferent",animationTimingReferent},
|
||||
#line 73 "KEY2Token.gperf"
|
||||
{"size",size},
|
||||
#line 86 "KEY2Token.gperf"
|
||||
{"title",title},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 55 "KEY2Token.gperf"
|
||||
{"headline",headline},
|
||||
#line 53 "KEY2Token.gperf"
|
||||
{"direction",direction},
|
||||
#line 52 "KEY2Token.gperf"
|
||||
{"depth",depth},
|
||||
#line 78 "KEY2Token.gperf"
|
||||
{"sticky-note",sticky_note},
|
||||
#line 34 "KEY2Token.gperf"
|
||||
{"animationDelayAutomaticWith",animationDelayAutomaticWith},
|
||||
#line 30 "KEY2Token.gperf"
|
||||
{"animationAuto",animationAuto},
|
||||
{(char*)0},
|
||||
#line 67 "KEY2Token.gperf"
|
||||
{"notes",notes},
|
||||
#line 54 "KEY2Token.gperf"
|
||||
{"events",events},
|
||||
#line 42 "KEY2Token.gperf"
|
||||
{"authors",authors},
|
||||
#line 63 "KEY2Token.gperf"
|
||||
{"master-slides",master_slides},
|
||||
#line 70 "KEY2Token.gperf"
|
||||
{"page",page},
|
||||
#line 74 "KEY2Token.gperf"
|
||||
{"slide",slide},
|
||||
#line 80 "KEY2Token.gperf"
|
||||
{"string",string},
|
||||
#line 56 "KEY2Token.gperf"
|
||||
{"headlineParagraphStyle",headlineParagraphStyle},
|
||||
#line 37 "KEY2Token.gperf"
|
||||
{"animationInterchunkAuto",animationInterchunkAuto},
|
||||
{(char*)0},
|
||||
#line 24 "KEY2Token.gperf"
|
||||
{"2004102100",VERSION_STR_2},
|
||||
#line 77 "KEY2Token.gperf"
|
||||
{"slide-style",slide_style},
|
||||
#line 33 "KEY2Token.gperf"
|
||||
{"animationDelayAutmaticAfter",animationDelayAutomaticAfter},
|
||||
#line 61 "KEY2Token.gperf"
|
||||
{"keywords",keywords},
|
||||
#line 32 "KEY2Token.gperf"
|
||||
{"animationDelay",animationDelay},
|
||||
#line 75 "KEY2Token.gperf"
|
||||
{"slide-list",slide_list},
|
||||
{(char*)0},
|
||||
#line 31 "KEY2Token.gperf"
|
||||
{"animationAutoPlay",animationAutoPlay},
|
||||
#line 60 "KEY2Token.gperf"
|
||||
{"key",key},
|
||||
#line 51 "KEY2Token.gperf"
|
||||
{"decimal-number",number},
|
||||
#line 82 "KEY2Token.gperf"
|
||||
{"stylesheet",stylesheet},
|
||||
{(char*)0},
|
||||
#line 79 "KEY2Token.gperf"
|
||||
{"sticky-notes",sticky_notes},
|
||||
#line 29 "KEY2Token.gperf"
|
||||
{"BGBuildDurationProperty",BGBuildDurationProperty},
|
||||
#line 38 "KEY2Token.gperf"
|
||||
{"animationInterchunkDelay",animationInterchunkDelay},
|
||||
#line 45 "KEY2Token.gperf"
|
||||
{"build",build},
|
||||
#line 68 "KEY2Token.gperf"
|
||||
{"number",number},
|
||||
#line 87 "KEY2Token.gperf"
|
||||
{"title-placeholder",title_placeholder},
|
||||
#line 69 "KEY2Token.gperf"
|
||||
{"object-placeholder",object_placeholder},
|
||||
{(char*)0},
|
||||
#line 64 "KEY2Token.gperf"
|
||||
{"master-ref",master_ref},
|
||||
#line 46 "KEY2Token.gperf"
|
||||
{"build-chunk",build_chunk},
|
||||
#line 90 "KEY2Token.gperf"
|
||||
{"version",version},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 25 "KEY2Token.gperf"
|
||||
{"2005092101",COMPATIBLE_VERSION_STR_3,},
|
||||
{(char*)0},
|
||||
#line 48 "KEY2Token.gperf"
|
||||
{"bullets",bullets},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 47 "KEY2Token.gperf"
|
||||
{"build-chunks",build_chunks},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 72 "KEY2Token.gperf"
|
||||
{"presentation",presentation},
|
||||
{(char*)0},
|
||||
#line 76 "KEY2Token.gperf"
|
||||
{"slide-number-placeholder",slide_number_placeholder},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 59 "KEY2Token.gperf"
|
||||
{"info-ref",info_ref},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 57 "KEY2Token.gperf"
|
||||
{"http://developer.apple.com/namespaces/keynote2",NS_URI_KEY},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 88 "KEY2Token.gperf"
|
||||
{"title-placeholder-ref",title_placeholder_ref},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 43 "KEY2Token.gperf"
|
||||
{"body-placeholder",body_placeholder},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 81 "KEY2Token.gperf"
|
||||
{"style-ref",style_ref},
|
||||
{(char*)0},
|
||||
#line 71 "KEY2Token.gperf"
|
||||
{"parent-build-ref",parent_build_ref},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 44 "KEY2Token.gperf"
|
||||
{"body-placeholder-ref",body_placeholder_ref}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (s && *str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#line 91 "KEY2Token.gperf"
|
||||
|
||||
151
Common/3dParty/apple/headers/NUM1Token.inc
Normal file
151
Common/3dParty/apple/headers/NUM1Token.inc
Normal file
@ -0,0 +1,151 @@
|
||||
/* C++ code produced by gperf version 3.0.1 */
|
||||
/* Command-line: gperf --compare-strncmp --enum --null-strings --readonly-tables --language C++ --output-file NUM1Token.inc NUM1Token.gperf */
|
||||
/* Computed positions: -k'$' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
#line 10 "NUM1Token.gperf"
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
using namespace NUM1Token;
|
||||
#line 18 "NUM1Token.gperf"
|
||||
struct Token
|
||||
{
|
||||
const char *name;
|
||||
int id;
|
||||
};
|
||||
#include <string.h>
|
||||
/* maximum key range = 34, duplicates = 0 */
|
||||
|
||||
class Perfect_Hash
|
||||
{
|
||||
private:
|
||||
static inline unsigned int hash (const char *str, unsigned int len);
|
||||
public:
|
||||
static const struct Token *in_word_set (const char *str, unsigned int len);
|
||||
};
|
||||
|
||||
inline unsigned int
|
||||
Perfect_Hash::hash (register const char *str, register unsigned int len)
|
||||
{
|
||||
static const unsigned char asso_values[] =
|
||||
{
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 0, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 0, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
0, 10, 41, 41, 41, 0, 0, 41, 41, 41,
|
||||
41, 5, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41
|
||||
};
|
||||
return len + asso_values[(unsigned char)str[len - 1]];
|
||||
}
|
||||
|
||||
const struct Token *
|
||||
Perfect_Hash::in_word_set (register const char *str, register unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 10,
|
||||
MIN_WORD_LENGTH = 7,
|
||||
MAX_WORD_LENGTH = 40,
|
||||
MIN_HASH_VALUE = 7,
|
||||
MAX_HASH_VALUE = 40
|
||||
};
|
||||
|
||||
static const struct Token wordlist[] =
|
||||
{
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 29 "NUM1Token.gperf"
|
||||
{"version",version},
|
||||
#line 25 "NUM1Token.gperf"
|
||||
{"document",document},
|
||||
#line 30 "NUM1Token.gperf"
|
||||
{"workspace",workspace},
|
||||
#line 28 "NUM1Token.gperf"
|
||||
{"stylesheet",stylesheet},
|
||||
#line 24 "NUM1Token.gperf"
|
||||
{"92008102400",VERSION_STR_2},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 32 "NUM1Token.gperf"
|
||||
{"workspace-name",workspace_name},
|
||||
#line 33 "NUM1Token.gperf"
|
||||
{"workspace-style",workspace_style},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 27 "NUM1Token.gperf"
|
||||
{"page-info",page_info},
|
||||
#line 31 "NUM1Token.gperf"
|
||||
{"workspace-array",workspace_array},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 26 "NUM1Token.gperf"
|
||||
{"http://developer.apple.com/namespaces/ls",NS_URI_LS}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (s && *str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#line 34 "NUM1Token.gperf"
|
||||
|
||||
209
Common/3dParty/apple/headers/PAG1Token.inc
Normal file
209
Common/3dParty/apple/headers/PAG1Token.inc
Normal file
@ -0,0 +1,209 @@
|
||||
/* C++ code produced by gperf version 3.0.1 */
|
||||
/* Command-line: gperf --compare-strncmp --enum --null-strings --readonly-tables --language C++ --output-file PAG1Token.inc PAG1Token.gperf */
|
||||
/* Computed positions: -k'1,6' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
#line 10 "PAG1Token.gperf"
|
||||
|
||||
#if defined __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
using namespace PAG1Token;
|
||||
#line 18 "PAG1Token.gperf"
|
||||
struct Token
|
||||
{
|
||||
const char *name;
|
||||
int id;
|
||||
};
|
||||
#include <string.h>
|
||||
/* maximum key range = 51, duplicates = 0 */
|
||||
|
||||
class Perfect_Hash
|
||||
{
|
||||
private:
|
||||
static inline unsigned int hash (const char *str, unsigned int len);
|
||||
public:
|
||||
static const struct Token *in_word_set (const char *str, unsigned int len);
|
||||
};
|
||||
|
||||
inline unsigned int
|
||||
Perfect_Hash::hash (register const char *str, register unsigned int len)
|
||||
{
|
||||
static const unsigned char asso_values[] =
|
||||
{
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 25, 55, 0, 55, 10,
|
||||
55, 55, 55, 55, 55, 55, 55, 10, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
5, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 5, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 5, 25, 15,
|
||||
20, 0, 20, 15, 5, 55, 55, 5, 10, 55,
|
||||
0, 15, 5, 55, 0, 0, 0, 55, 5, 10,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
hval += asso_values[(unsigned char)str[5]];
|
||||
/*FALLTHROUGH*/
|
||||
case 5:
|
||||
case 4:
|
||||
case 3:
|
||||
case 2:
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval;
|
||||
}
|
||||
|
||||
const struct Token *
|
||||
Perfect_Hash::in_word_set (register const char *str, register unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 31,
|
||||
MIN_WORD_LENGTH = 4,
|
||||
MAX_WORD_LENGTH = 40,
|
||||
MIN_HASH_VALUE = 4,
|
||||
MAX_HASH_VALUE = 54
|
||||
};
|
||||
|
||||
static const struct Token wordlist[] =
|
||||
{
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 38 "PAG1Token.gperf"
|
||||
{"note",note},
|
||||
#line 49 "PAG1Token.gperf"
|
||||
{"rpage",rpage},
|
||||
#line 39 "PAG1Token.gperf"
|
||||
{"number",number},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 41 "PAG1Token.gperf"
|
||||
{"page",page},
|
||||
#line 52 "PAG1Token.gperf"
|
||||
{"stylesheet",stylesheet},
|
||||
#line 33 "PAG1Token.gperf"
|
||||
{"header",header},
|
||||
#line 51 "PAG1Token.gperf"
|
||||
{"slprint-info",slprint_info},
|
||||
{(char*)0},
|
||||
#line 47 "PAG1Token.gperf"
|
||||
{"prototype",prototype},
|
||||
#line 44 "PAG1Token.gperf"
|
||||
{"page-scale",page_scale},
|
||||
#line 37 "PAG1Token.gperf"
|
||||
{"layout",layout},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 27 "PAG1Token.gperf"
|
||||
{"cell",cell},
|
||||
#line 40 "PAG1Token.gperf"
|
||||
{"order",order},
|
||||
#line 43 "PAG1Token.gperf"
|
||||
{"page-height",page_height},
|
||||
#line 53 "PAG1Token.gperf"
|
||||
{"textbox",textbox},
|
||||
{(char*)0},
|
||||
#line 28 "PAG1Token.gperf"
|
||||
{"date",date},
|
||||
#line 45 "PAG1Token.gperf"
|
||||
{"page-width",page_width},
|
||||
#line 31 "PAG1Token.gperf"
|
||||
{"footer",footer},
|
||||
#line 54 "PAG1Token.gperf"
|
||||
{"version",version},
|
||||
#line 29 "PAG1Token.gperf"
|
||||
{"document",document},
|
||||
#line 26 "PAG1Token.gperf"
|
||||
{"body",body},
|
||||
#line 42 "PAG1Token.gperf"
|
||||
{"page-group",page_group},
|
||||
#line 24 "PAG1Token.gperf"
|
||||
{"92008102400",VERSION_STR_4},
|
||||
#line 25 "PAG1Token.gperf"
|
||||
{"SLCreationDateProperty",SLCreationDateProperty},
|
||||
#line 50 "PAG1Token.gperf"
|
||||
{"section-prototypes",section_prototypes},
|
||||
#line 35 "PAG1Token.gperf"
|
||||
{"kSFWPFootnoteGapProperty",kSFWPFootnoteGapProperty},
|
||||
#line 36 "PAG1Token.gperf"
|
||||
{"kSFWPFootnoteKindProperty",kSFWPFootnoteKindProperty},
|
||||
#line 48 "PAG1Token.gperf"
|
||||
{"publication-info",publication_info},
|
||||
{(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 46 "PAG1Token.gperf"
|
||||
{"print-info",print_info},
|
||||
{(char*)0}, {(char*)0},
|
||||
#line 32 "PAG1Token.gperf"
|
||||
{"footnote",footnote},
|
||||
{(char*)0},
|
||||
#line 34 "PAG1Token.gperf"
|
||||
{"http://developer.apple.com/namespaces/sl",NS_URI_SL},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
{(char*)0}, {(char*)0}, {(char*)0}, {(char*)0},
|
||||
#line 30 "PAG1Token.gperf"
|
||||
{"drawables",drawables}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (s && *str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#line 55 "PAG1Token.gperf"
|
||||
|
||||
818
Common/3dParty/harfbuzz/test/main.cpp
Normal file
818
Common/3dParty/harfbuzz/test/main.cpp
Normal file
@ -0,0 +1,818 @@
|
||||
// https://android.googlesource.com/platform/external/harfbuzz/+/ics-mr0/contrib/tables/script-properties.h
|
||||
|
||||
/*
|
||||
* https://unicode.org/reports/tr29/
|
||||
|
||||
As far as a user is concerned, the underlying representation of text is not important,
|
||||
but it is important that an editing interface present a uniform implementation of what
|
||||
the user thinks of as characters. Grapheme clusters can be treated as units, by default,
|
||||
for processes such as the formatting of drop caps, as well as the implementation of text
|
||||
selection, arrow key movement or backspacing through text, and so forth. For example,
|
||||
when a grapheme cluster is represented internally by a character sequence consisting of
|
||||
base character + accents, then using the right arrow key would skip from the start of the
|
||||
base character to the end of the last accent.
|
||||
|
||||
This document defines a default specification for grapheme clusters. It may be customized
|
||||
for particular languages, operations, or other situations. For example, arrow key movement
|
||||
could be tailored by language, or could use knowledge specific to particular fonts to move
|
||||
in a more granular manner, in circumstances where it would be useful to edit individual
|
||||
components. This could apply, for example, to the complex editorial requirements for the
|
||||
Northern Thai script Tai Tham (Lanna). Similarly, editing a grapheme cluster element by
|
||||
element may be preferable in some circumstances. For example, on a given system the backspace
|
||||
key might delete by code point, while the delete key may delete an entire cluster.
|
||||
* */
|
||||
|
||||
#include "../../../core/DesktopEditor/common/File.h"
|
||||
#include "../../../core/DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
#include FT_OUTLINE_H
|
||||
|
||||
#include <hb-ft.h>
|
||||
#include <hb-ot.h>
|
||||
#include <hb.h>
|
||||
|
||||
class CDrawer
|
||||
{
|
||||
public:
|
||||
CBgraFrame m_oFrame;
|
||||
BYTE *pixels;
|
||||
int width;
|
||||
int height;
|
||||
int pitch;
|
||||
BYTE Rshift;
|
||||
BYTE Gshift;
|
||||
BYTE Bshift;
|
||||
BYTE Ashift;
|
||||
|
||||
public:
|
||||
CDrawer(int w, int h)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
pitch = 4 * width;
|
||||
m_oFrame.put_Width(width);
|
||||
m_oFrame.put_Height(height);
|
||||
m_oFrame.put_Stride(pitch);
|
||||
|
||||
int size = 4 * width * height;
|
||||
BYTE *pPixels = new BYTE[size];
|
||||
for (int i = 0; i < size; i += 4)
|
||||
{
|
||||
pPixels[i] = 0xFF;
|
||||
pPixels[i + 1] = 0xFF;
|
||||
pPixels[i + 2] = 0xFF;
|
||||
pPixels[i + 3] = 0xFF;
|
||||
}
|
||||
pixels = pPixels;
|
||||
m_oFrame.put_Data(pPixels);
|
||||
|
||||
Bshift = 24;
|
||||
Gshift = 16;
|
||||
Rshift = 8;
|
||||
Ashift = 0;
|
||||
}
|
||||
void Save()
|
||||
{
|
||||
m_oFrame.SaveFile(NSFile::GetProcessDirectory() + L"/output.png", 4);
|
||||
}
|
||||
};
|
||||
|
||||
#define NUM_EXAMPLES 3
|
||||
|
||||
/* fonts */
|
||||
const char *fonts_paths[NUM_EXAMPLES] = {
|
||||
"C:/Windows/Fonts/calibri.ttf",
|
||||
//"C:/Windows/Fonts/arial.ttf",
|
||||
"C:/Users/korol/AppData/Local/Microsoft/Windows/Fonts/ArabicTest.ttf",
|
||||
"C:/Windows/Fonts/simsun.ttc"
|
||||
};
|
||||
|
||||
#define NUM_GLYPH_TYPES 5
|
||||
const char *num_glyph_types[NUM_GLYPH_TYPES] = {"UNCLASSIFIED", "BASE_GLYPH", "LIGATURE", "MARK", "COMPONENT"};
|
||||
|
||||
/* tranlations courtesy of google */
|
||||
const char *texts[NUM_EXAMPLES] = {
|
||||
"fi",
|
||||
"لا لآ لأ لا",
|
||||
"懶惰的姜貓"
|
||||
};
|
||||
|
||||
const hb_direction_t text_directions[NUM_EXAMPLES] = {
|
||||
HB_DIRECTION_LTR,
|
||||
HB_DIRECTION_RTL,
|
||||
HB_DIRECTION_TTB,
|
||||
};
|
||||
|
||||
const int text_skip[NUM_EXAMPLES] = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
};
|
||||
|
||||
/* XXX: These are not correct, though it doesn't seem to break anything
|
||||
* regardless of their value. */
|
||||
const char *languages[NUM_EXAMPLES] = {
|
||||
"en",
|
||||
"ar",
|
||||
"ch",
|
||||
};
|
||||
|
||||
const hb_script_t scripts[NUM_EXAMPLES] = {
|
||||
HB_SCRIPT_LATIN,
|
||||
HB_SCRIPT_ARABIC,
|
||||
HB_SCRIPT_HAN,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ENGLISH = 0,
|
||||
ARABIC,
|
||||
CHINESE
|
||||
};
|
||||
|
||||
typedef struct _spanner_baton_t
|
||||
{
|
||||
/* rendering part - assumes 32bpp surface */
|
||||
uint32_t *pixels; // set to the glyph's origin.
|
||||
uint32_t *first_pixel, *last_pixel; // bounds check
|
||||
uint32_t pitch;
|
||||
uint32_t rshift;
|
||||
uint32_t gshift;
|
||||
uint32_t bshift;
|
||||
uint32_t ashift;
|
||||
|
||||
/* sizing part */
|
||||
int min_span_x;
|
||||
int max_span_x;
|
||||
int min_y;
|
||||
int max_y;
|
||||
} spanner_baton_t;
|
||||
|
||||
/* This spanner is write only, suitable for write-only mapped buffers,
|
||||
but can cause dark streaks where glyphs overlap, like in arabic scripts.
|
||||
|
||||
Note how spanners don't clip against surface width - resize the window
|
||||
and see what it leads to. */
|
||||
void spanner_wo(int y, int count, const FT_Span *spans, void *user)
|
||||
{
|
||||
spanner_baton_t *baton = (spanner_baton_t *)user;
|
||||
uint32_t *scanline = baton->pixels - y * ((int)baton->pitch / 4);
|
||||
if (scanline < baton->first_pixel)
|
||||
return;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint32_t color = ((spans[i].coverage / 2) << baton->rshift) | ((spans[i].coverage / 2) << baton->gshift) | ((spans[i].coverage / 2) << baton->bshift);
|
||||
|
||||
uint32_t *start = scanline + spans[i].x;
|
||||
if (start + spans[i].len > baton->last_pixel)
|
||||
return;
|
||||
|
||||
for (int x = 0; x < spans[i].len; x++)
|
||||
*start++ = color;
|
||||
}
|
||||
}
|
||||
|
||||
/* This spanner does read/modify/write, trading performance for accuracy.
|
||||
The color here is simply half coverage value in all channels,
|
||||
effectively mid-gray.
|
||||
Suitable for when artifacts mostly do come up and annoy.
|
||||
This might be optimized if one does rmw only for some values of x.
|
||||
But since the whole buffer has to be rw anyway, and the previous value
|
||||
is probably still in the cache, there's little point to. */
|
||||
void spanner_rw(int y, int count, const FT_Span *spans, void *user)
|
||||
{
|
||||
spanner_baton_t *baton = (spanner_baton_t *)user;
|
||||
uint32_t *scanline = baton->pixels - y * ((int)baton->pitch / 4);
|
||||
if (scanline < baton->first_pixel)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint32_t color = ((spans[i].coverage / 2) << baton->rshift) | ((spans[i].coverage / 2) << baton->gshift) | ((spans[i].coverage / 2) << baton->bshift);
|
||||
uint32_t *start = scanline + spans[i].x;
|
||||
if (start + spans[i].len > baton->last_pixel)
|
||||
return;
|
||||
|
||||
for (int x = 0; x < spans[i].len; x++)
|
||||
*start++ |= color;
|
||||
}
|
||||
}
|
||||
|
||||
/* This spanner is for obtaining exact bounding box for the string.
|
||||
Unfortunately this can't be done without rendering it (or pretending to).
|
||||
After this runs, we get min and max values of coordinates used.
|
||||
*/
|
||||
void spanner_sizer(int y, int count, const FT_Span *spans, void *user)
|
||||
{
|
||||
spanner_baton_t *baton = (spanner_baton_t *)user;
|
||||
|
||||
if (y < baton->min_y)
|
||||
baton->min_y = y;
|
||||
if (y > baton->max_y)
|
||||
baton->max_y = y;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (spans[i].x + spans[i].len > baton->max_span_x)
|
||||
baton->max_span_x = spans[i].x + spans[i].len;
|
||||
if (spans[i].x < baton->min_span_x)
|
||||
baton->min_span_x = spans[i].x;
|
||||
}
|
||||
}
|
||||
|
||||
FT_SpanFunc spanner = spanner_wo;
|
||||
|
||||
void ftfdump(FT_Face ftf)
|
||||
{
|
||||
for (int i = 0; i < ftf->num_charmaps; i++)
|
||||
{
|
||||
printf(
|
||||
"%d: %s %s %c%c%c%c plat=%hu id=%hu\n", i, ftf->family_name, ftf->style_name, ftf->charmaps[i]->encoding >> 24, (ftf->charmaps[i]->encoding >> 16) & 0xff,
|
||||
(ftf->charmaps[i]->encoding >> 8) & 0xff, (ftf->charmaps[i]->encoding) & 0xff, ftf->charmaps[i]->platform_id, ftf->charmaps[i]->encoding_id);
|
||||
}
|
||||
}
|
||||
|
||||
/* See http://www.microsoft.com/typography/otspec/name.htm
|
||||
for a list of some possible platform-encoding pairs.
|
||||
We're interested in 0-3 aka 3-1 - UCS-2.
|
||||
Otherwise, fail. If a font has some unicode map, but lacks
|
||||
UCS-2 - it is a broken or irrelevant font. What exactly
|
||||
Freetype will select on face load (it promises most wide
|
||||
unicode, and if that will be slower that UCS-2 - left as
|
||||
an excercise to check. */
|
||||
int force_ucs2_charmap(FT_Face ftf)
|
||||
{
|
||||
for (int i = 0; i < ftf->num_charmaps; i++)
|
||||
if (((ftf->charmaps[i]->platform_id == 0) && (ftf->charmaps[i]->encoding_id == 3)) || ((ftf->charmaps[i]->platform_id == 3) && (ftf->charmaps[i]->encoding_id == 1)))
|
||||
return FT_Set_Charmap(ftf, ftf->charmaps[i]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void hline(CDrawer *s, int min_x, int max_x, int y, uint32_t color)
|
||||
{
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
uint32_t *pix = (uint32_t *)s->pixels + (y * s->pitch) / 4 + min_x;
|
||||
uint32_t *end = (uint32_t *)s->pixels + (y * s->pitch) / 4 + max_x;
|
||||
|
||||
while (pix - 1 != end)
|
||||
*pix++ = color;
|
||||
}
|
||||
|
||||
void vline(CDrawer *s, int min_y, int max_y, int x, uint32_t color)
|
||||
{
|
||||
if (min_y < 0)
|
||||
min_y = 0;
|
||||
|
||||
uint32_t *pix = (uint32_t *)s->pixels + (min_y * s->pitch) / 4 + x;
|
||||
uint32_t *end = (uint32_t *)s->pixels + (max_y * s->pitch) / 4 + x;
|
||||
|
||||
while (pix - s->pitch / 4 != end)
|
||||
{
|
||||
*pix = color;
|
||||
pix += s->pitch / 4;
|
||||
}
|
||||
}
|
||||
|
||||
void assert(const bool &valid)
|
||||
{
|
||||
// TODO:
|
||||
}
|
||||
|
||||
#define MAIN_CC_NO_PRIVATE_API
|
||||
#ifndef MAIN_CC_NO_PRIVATE_API
|
||||
/* Only this part of this mini app uses private API */
|
||||
#include "hb-open-file.hh"
|
||||
#include "hb-ot-layout-gdef-table.hh"
|
||||
#include "hb-ot-layout-gsubgpos.hh"
|
||||
#include "hb-static.cc"
|
||||
|
||||
using namespace OT;
|
||||
|
||||
static void print_layout_info_using_private_api(hb_blob_t *blob)
|
||||
{
|
||||
const char *font_data = hb_blob_get_data(blob, nullptr);
|
||||
hb_blob_t *font_blob = hb_sanitize_context_t().sanitize_blob<OpenTypeFontFile>(blob);
|
||||
const OpenTypeFontFile *sanitized = font_blob->as<OpenTypeFontFile>();
|
||||
if (!font_blob->data)
|
||||
{
|
||||
printf("Sanitization of the file wasn't successful. Exit");
|
||||
exit(1);
|
||||
}
|
||||
const OpenTypeFontFile &ot = *sanitized;
|
||||
|
||||
switch (ot.get_tag())
|
||||
{
|
||||
case OpenTypeFontFile::TrueTypeTag:
|
||||
printf("OpenType font with TrueType outlines\n");
|
||||
break;
|
||||
case OpenTypeFontFile::CFFTag:
|
||||
printf("OpenType font with CFF (Type1) outlines\n");
|
||||
break;
|
||||
case OpenTypeFontFile::TTCTag:
|
||||
printf("TrueType Collection of OpenType fonts\n");
|
||||
break;
|
||||
case OpenTypeFontFile::TrueTag:
|
||||
printf("Obsolete Apple TrueType font\n");
|
||||
break;
|
||||
case OpenTypeFontFile::Typ1Tag:
|
||||
printf("Obsolete Apple Type1 font in SFNT container\n");
|
||||
break;
|
||||
case OpenTypeFontFile::DFontTag:
|
||||
printf("DFont Mac Resource Fork\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown font format\n");
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned num_faces = hb_face_count(blob);
|
||||
printf("%d font(s) found in file\n", num_faces);
|
||||
for (unsigned n_font = 0; n_font < num_faces; ++n_font)
|
||||
{
|
||||
const OpenTypeFontFace &font = ot.get_face(n_font);
|
||||
printf("Font %d of %d:\n", n_font, num_faces);
|
||||
|
||||
unsigned num_tables = font.get_table_count();
|
||||
printf(" %d table(s) found in font\n", num_tables);
|
||||
for (unsigned n_table = 0; n_table < num_tables; ++n_table)
|
||||
{
|
||||
const OpenTypeTable &table = font.get_table(n_table);
|
||||
printf(" Table %2d of %2d: %.4s (0x%08x+0x%08x)\n", n_table, num_tables, (const char *)table.tag, (unsigned)table.offset, (unsigned)table.length);
|
||||
|
||||
switch (table.tag)
|
||||
{
|
||||
|
||||
case HB_OT_TAG_GSUB:
|
||||
case HB_OT_TAG_GPOS:
|
||||
{
|
||||
|
||||
const GSUBGPOS &g = *reinterpret_cast<const GSUBGPOS *>(font_data + table.offset);
|
||||
|
||||
unsigned num_scripts = g.get_script_count();
|
||||
printf(" %d script(s) found in table\n", num_scripts);
|
||||
for (unsigned n_script = 0; n_script < num_scripts; ++n_script)
|
||||
{
|
||||
const Script &script = g.get_script(n_script);
|
||||
printf(" Script %2d of %2d: %.4s\n", n_script, num_scripts, (const char *)g.get_script_tag(n_script));
|
||||
|
||||
if (!script.has_default_lang_sys())
|
||||
printf(" No default language system\n");
|
||||
int num_langsys = script.get_lang_sys_count();
|
||||
printf(" %d language system(s) found in script\n", num_langsys);
|
||||
for (int n_langsys = script.has_default_lang_sys() ? -1 : 0; n_langsys < num_langsys; ++n_langsys)
|
||||
{
|
||||
const LangSys &langsys = n_langsys == -1 ? script.get_default_lang_sys() : script.get_lang_sys(n_langsys);
|
||||
if (n_langsys == -1)
|
||||
printf(" Default Language System\n");
|
||||
else
|
||||
printf(" Language System %2d of %2d: %.4s\n", n_langsys, num_langsys, (const char *)script.get_lang_sys_tag(n_langsys));
|
||||
if (!langsys.has_required_feature())
|
||||
printf(" No required feature\n");
|
||||
else
|
||||
printf(" Required feature index: %d\n", langsys.get_required_feature_index());
|
||||
|
||||
unsigned num_features = langsys.get_feature_count();
|
||||
printf(" %d feature(s) found in language system\n", num_features);
|
||||
for (unsigned n_feature = 0; n_feature < num_features; ++n_feature)
|
||||
{
|
||||
printf(" Feature index %2d of %2d: %d\n", n_feature, num_features, langsys.get_feature_index(n_feature));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned num_features = g.get_feature_count();
|
||||
printf(" %d feature(s) found in table\n", num_features);
|
||||
for (unsigned n_feature = 0; n_feature < num_features; ++n_feature)
|
||||
{
|
||||
const Feature &feature = g.get_feature(n_feature);
|
||||
unsigned num_lookups = feature.get_lookup_count();
|
||||
printf(" Feature %2d of %2d: %c%c%c%c\n", n_feature, num_features, HB_UNTAG(g.get_feature_tag(n_feature)));
|
||||
|
||||
printf(" %d lookup(s) found in feature\n", num_lookups);
|
||||
for (unsigned n_lookup = 0; n_lookup < num_lookups; ++n_lookup)
|
||||
{
|
||||
printf(" Lookup index %2d of %2d: %d\n", n_lookup, num_lookups, feature.get_lookup_index(n_lookup));
|
||||
}
|
||||
}
|
||||
|
||||
unsigned num_lookups = g.get_lookup_count();
|
||||
printf(" %d lookup(s) found in table\n", num_lookups);
|
||||
for (unsigned n_lookup = 0; n_lookup < num_lookups; ++n_lookup)
|
||||
{
|
||||
const Lookup &lookup = g.get_lookup(n_lookup);
|
||||
printf(" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups, lookup.get_type(), lookup.get_props());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GDEF::tableTag:
|
||||
{
|
||||
|
||||
const GDEF &gdef = *reinterpret_cast<const GDEF *>(font_data + table.offset);
|
||||
|
||||
printf(" Has %sglyph classes\n", gdef.has_glyph_classes() ? "" : "no ");
|
||||
printf(" Has %smark attachment types\n", gdef.has_mark_attachment_types() ? "" : "no ");
|
||||
printf(" Has %sattach points\n", gdef.has_attach_points() ? "" : "no ");
|
||||
printf(" Has %slig carets\n", gdef.has_lig_carets() ? "" : "no ");
|
||||
printf(" Has %smark sets\n", gdef.has_mark_sets() ? "" : "no ");
|
||||
|
||||
hb_position_t caret_array[16];
|
||||
unsigned int caret_count = 16;
|
||||
|
||||
unsigned int num_carets = gdef.get_lig_carets(nullptr, HB_DIRECTION_LTR, 302, 0, &caret_count, caret_array);
|
||||
int y = 0;
|
||||
++y;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end of private API use */
|
||||
#endif
|
||||
|
||||
struct hb_feature_test {
|
||||
hb_tag_t tag;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// hb_blob_t* blobFileTest = hb_blob_create_from_file("C:/Windows/Fonts/calibri.ttf");
|
||||
// print_layout_info_using_private_api(blobFileTest);
|
||||
|
||||
int ptSize = 40 * 64;
|
||||
int device_hdpi = 72;
|
||||
int device_vdpi = 72;
|
||||
|
||||
/* Init freetype */
|
||||
FT_Library ft_library;
|
||||
assert(!FT_Init_FreeType(&ft_library));
|
||||
|
||||
/* Load our fonts */
|
||||
FT_Face ft_face[NUM_EXAMPLES];
|
||||
assert(!FT_New_Face(ft_library, fonts_paths[0], 0, &ft_face[ENGLISH]));
|
||||
assert(!FT_Set_Char_Size(ft_face[ENGLISH], 0, ptSize, device_hdpi, device_vdpi));
|
||||
ftfdump(ft_face[ENGLISH]); // wonderful world of encodings ...
|
||||
// force_ucs2_charmap(ft_face[ENGLISH]); // which we ignore.
|
||||
|
||||
assert(!FT_New_Face(ft_library, fonts_paths[1], 0, &ft_face[ARABIC]));
|
||||
assert(!FT_Set_Char_Size(ft_face[ARABIC], 0, ptSize, device_hdpi, device_vdpi));
|
||||
ftfdump(ft_face[ARABIC]);
|
||||
// force_ucs2_charmap(ft_face[ARABIC]);
|
||||
|
||||
assert(!FT_New_Face(ft_library, fonts_paths[2], 0, &ft_face[CHINESE]));
|
||||
assert(!FT_Set_Char_Size(ft_face[CHINESE], 0, ptSize, device_hdpi, device_vdpi));
|
||||
ftfdump(ft_face[CHINESE]);
|
||||
// force_ucs2_charmap(ft_face[CHINESE]);
|
||||
|
||||
/* Get our harfbuzz font structs */
|
||||
hb_font_t *hb_ft_font[NUM_EXAMPLES];
|
||||
hb_ft_font[ENGLISH] = hb_ft_font_create(ft_face[ENGLISH], NULL);
|
||||
|
||||
// hb_blob_t* blobFile = hb_blob_create_from_file(sFont1.c_str());
|
||||
// hb_face_t* faceFile = hb_face_create(blobFile, 0);
|
||||
// hb_ft_font[ENGLISH] = hb_font_create(faceFile);
|
||||
|
||||
hb_ft_font[ARABIC] = hb_ft_font_create(ft_face[ARABIC], NULL);
|
||||
hb_ft_font[CHINESE] = hb_ft_font_create(ft_face[CHINESE], NULL);
|
||||
|
||||
hb_ft_font_set_funcs(hb_ft_font[ENGLISH]);
|
||||
hb_ft_font_set_funcs(hb_ft_font[ARABIC]);
|
||||
hb_ft_font_set_funcs(hb_ft_font[CHINESE]);
|
||||
|
||||
/** Setup our SDL window **/
|
||||
int width = 800;
|
||||
int height = 600;
|
||||
int bpp = 32;
|
||||
|
||||
CDrawer oDrawer(width, height);
|
||||
|
||||
/* Create a buffer for harfbuzz to use */
|
||||
hb_buffer_t *buf = hb_buffer_create();
|
||||
for (int i = 0; i < NUM_EXAMPLES; ++i)
|
||||
{
|
||||
if (text_skip[i])
|
||||
continue;
|
||||
|
||||
hb_buffer_set_direction(buf, text_directions[i]); /* or LTR */
|
||||
hb_buffer_set_script(buf, scripts[i]); /* see hb-unicode.h */
|
||||
hb_buffer_set_language(buf, hb_language_from_string(languages[i], strlen(languages[i])));
|
||||
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
|
||||
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
|
||||
hb_buffer_set_cluster_level(buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
|
||||
|
||||
hb_feature_test features[] {
|
||||
{HB_TAG('r','l','i','g'), 1},
|
||||
{HB_TAG('l','i','g','a'), 0},
|
||||
{HB_TAG('c','l','i','g'), 1},
|
||||
{HB_TAG('h','l','i','g'), 1},
|
||||
{HB_TAG('d','l','i','g'), 1},
|
||||
{HB_TAG('k','e','r','n'), 2},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
int userfeatures_count = 0;
|
||||
hb_feature_t userfeatures[100];
|
||||
|
||||
hb_feature_test* current_feature = features;
|
||||
while (current_feature->tag != 0)
|
||||
{
|
||||
if (current_feature->value != 2)
|
||||
{
|
||||
userfeatures[userfeatures_count].tag = current_feature->tag;
|
||||
userfeatures[userfeatures_count].value = current_feature->value;
|
||||
userfeatures[userfeatures_count].start = HB_FEATURE_GLOBAL_START;
|
||||
userfeatures[userfeatures_count].end = HB_FEATURE_GLOBAL_END;
|
||||
userfeatures_count++;
|
||||
}
|
||||
current_feature++;
|
||||
}
|
||||
|
||||
/* Layout the text */
|
||||
hb_buffer_add_utf8(buf, texts[i], strlen(texts[i]), 0, strlen(texts[i]));
|
||||
|
||||
// detect script by codes
|
||||
hb_buffer_guess_segment_properties(buf);
|
||||
|
||||
// const char*const pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr };
|
||||
// bool ok = hb_shape_full(hb_ft_font[i], buf, userfeatures, userfeatures_count, pHbShapers);
|
||||
|
||||
hb_shape(hb_ft_font[i], buf, (userfeatures_count != 0) ? userfeatures : NULL, userfeatures_count);
|
||||
|
||||
unsigned int glyph_count;
|
||||
hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);
|
||||
hb_glyph_position_t *glyph_pos = hb_buffer_get_glyph_positions(buf, &glyph_count);
|
||||
|
||||
#if 1
|
||||
hb_position_t caret_array[16];
|
||||
unsigned int caret_count = 16;
|
||||
|
||||
unsigned int num_carets = hb_ot_layout_get_ligature_carets(hb_ft_font[i], text_directions[i], glyph_info[0].codepoint, -1, &caret_count, caret_array);
|
||||
#endif
|
||||
|
||||
/* set up rendering via spanners */
|
||||
spanner_baton_t stuffbaton;
|
||||
|
||||
FT_Raster_Params ftr_params;
|
||||
ftr_params.target = 0;
|
||||
ftr_params.flags = FT_RASTER_FLAG_DIRECT | FT_RASTER_FLAG_AA;
|
||||
ftr_params.user = &stuffbaton;
|
||||
ftr_params.black_spans = 0;
|
||||
ftr_params.bit_set = 0;
|
||||
ftr_params.bit_test = 0;
|
||||
|
||||
/* Calculate string bounding box in pixels */
|
||||
ftr_params.gray_spans = spanner_sizer;
|
||||
|
||||
/* See http://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html */
|
||||
|
||||
int max_x = INT_MIN; // largest coordinate a pixel has been set at, or the pen was advanced to.
|
||||
int min_x = INT_MAX; // smallest coordinate a pixel has been set at, or the pen was advanced to.
|
||||
int max_y = INT_MIN; // this is max topside bearing along the string.
|
||||
int min_y = INT_MAX; // this is max value of (height - topbearing) along the string.
|
||||
/* Naturally, the above comments swap their meaning between horizontal and vertical scripts,
|
||||
since the pen changes the axis it is advanced along.
|
||||
However, their differences still make up the bounding box for the string.
|
||||
Also note that all this is in FT coordinate system where y axis points upwards.
|
||||
*/
|
||||
|
||||
int sizer_x = 0;
|
||||
int sizer_y = 0; /* in FT coordinate system. */
|
||||
|
||||
printf("----------------------------------------------------\n");
|
||||
for (unsigned j = 0; j < glyph_count; ++j)
|
||||
{
|
||||
hb_ot_layout_glyph_class_t glyph_type = hb_ot_layout_get_glyph_class(hb_font_get_face(hb_ft_font[i]), glyph_info[j].codepoint);
|
||||
hb_glyph_flags_t glyph_type_flags = hb_glyph_info_get_glyph_flags(&glyph_info[j]);
|
||||
printf(
|
||||
"glyph(%s, flags: %d): gid:%d, cluster:%d, [%d, %d, %d, %d, %d]\n", num_glyph_types[glyph_type], glyph_type_flags, (int)glyph_info[j].codepoint, (int)glyph_info[j].cluster,
|
||||
glyph_pos[j].x_advance, glyph_pos[j].y_advance, glyph_pos[j].x_offset, glyph_pos[j].y_offset, glyph_pos[j].var);
|
||||
}
|
||||
|
||||
FT_Error fterr;
|
||||
for (unsigned j = 0; j < glyph_count; ++j)
|
||||
{
|
||||
if ((fterr = FT_Load_Glyph(ft_face[i], glyph_info[j].codepoint, 0)))
|
||||
{
|
||||
printf("load %08x failed fterr=%d.\n", glyph_info[j].codepoint, fterr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ft_face[i]->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
|
||||
{
|
||||
printf("glyph->format = %4s\n", (char *)&ft_face[i]->glyph->format);
|
||||
}
|
||||
else
|
||||
{
|
||||
int gx = sizer_x + (glyph_pos[j].x_offset / 64);
|
||||
int gy = sizer_y + (glyph_pos[j].y_offset / 64); // note how the sign differs from the rendering pass
|
||||
|
||||
stuffbaton.min_span_x = INT_MAX;
|
||||
stuffbaton.max_span_x = INT_MIN;
|
||||
stuffbaton.min_y = INT_MAX;
|
||||
stuffbaton.max_y = INT_MIN;
|
||||
|
||||
if ((fterr = FT_Outline_Render(ft_library, &ft_face[i]->glyph->outline, &ftr_params)))
|
||||
printf("FT_Outline_Render() failed err=%d\n", fterr);
|
||||
|
||||
if (stuffbaton.min_span_x != INT_MAX)
|
||||
{
|
||||
/* Update values if the spanner was actually called. */
|
||||
if (min_x > stuffbaton.min_span_x + gx)
|
||||
min_x = stuffbaton.min_span_x + gx;
|
||||
|
||||
if (max_x < stuffbaton.max_span_x + gx)
|
||||
max_x = stuffbaton.max_span_x + gx;
|
||||
|
||||
if (min_y > stuffbaton.min_y + gy)
|
||||
min_y = stuffbaton.min_y + gy;
|
||||
|
||||
if (max_y < stuffbaton.max_y + gy)
|
||||
max_y = stuffbaton.max_y + gy;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The spanner wasn't called at all - an empty glyph, like space. */
|
||||
if (min_x > gx)
|
||||
min_x = gx;
|
||||
if (max_x < gx)
|
||||
max_x = gx;
|
||||
if (min_y > gy)
|
||||
min_y = gy;
|
||||
if (max_y < gy)
|
||||
max_y = gy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sizer_x += glyph_pos[j].x_advance / 64;
|
||||
sizer_y += glyph_pos[j].y_advance / 64; // note how the sign differs from the rendering pass
|
||||
}
|
||||
/* Still have to take into account last glyph's advance. Or not? */
|
||||
if (min_x > sizer_x)
|
||||
min_x = sizer_x;
|
||||
if (max_x < sizer_x)
|
||||
max_x = sizer_x;
|
||||
if (min_y > sizer_y)
|
||||
min_y = sizer_y;
|
||||
if (max_y < sizer_y)
|
||||
max_y = sizer_y;
|
||||
|
||||
/* The bounding box */
|
||||
int bbox_w = max_x - min_x;
|
||||
int bbox_h = max_y - min_y;
|
||||
|
||||
/* Two offsets below position the bounding box with respect to the 'origin',
|
||||
which is sort of origin of string's first glyph.
|
||||
|
||||
baseline_offset - offset perpendecular to the baseline to the topmost (horizontal),
|
||||
or leftmost (vertical) pixel drawn.
|
||||
|
||||
baseline_shift - offset along the baseline, from the first drawn glyph's origin
|
||||
to the leftmost (horizontal), or topmost (vertical) pixel drawn.
|
||||
|
||||
Thus those offsets allow positioning the bounding box to fit the rendered string,
|
||||
as they are in fact offsets from the point given to the renderer, to the top left
|
||||
corner of the bounding box.
|
||||
|
||||
NB: baseline is defined as y==0 for horizontal and x==0 for vertical scripts.
|
||||
(0,0) here is where the first glyph's origin ended up after shaping, not taking
|
||||
into account glyph_pos[0].xy_offset (yeah, my head hurts too).
|
||||
*/
|
||||
|
||||
int baseline_offset;
|
||||
int baseline_shift;
|
||||
|
||||
if (HB_DIRECTION_IS_HORIZONTAL(hb_buffer_get_direction(buf)))
|
||||
{
|
||||
baseline_offset = max_y;
|
||||
baseline_shift = min_x;
|
||||
}
|
||||
if (HB_DIRECTION_IS_VERTICAL(hb_buffer_get_direction(buf)))
|
||||
{
|
||||
baseline_offset = min_x;
|
||||
baseline_shift = max_y;
|
||||
}
|
||||
|
||||
/* The pen/baseline start coordinates in window coordinate system
|
||||
- with those text placement in the window is controlled.
|
||||
- note that for RTL scripts pen still goes LTR */
|
||||
int x = 0, y = 50 + i * 75;
|
||||
if (i == ENGLISH)
|
||||
{
|
||||
x = 20;
|
||||
} /* left justify */
|
||||
if (i == ARABIC)
|
||||
{
|
||||
x = width - bbox_w - 20;
|
||||
} /* right justify */
|
||||
if (i == CHINESE)
|
||||
{
|
||||
x = width / 2 - bbox_w / 2;
|
||||
} /* center, and for TTB script h_advance is half-width. */
|
||||
|
||||
/* Draw baseline and the bounding box */
|
||||
/* The below is complicated since we simultaneously
|
||||
convert to the window coordinate system. */
|
||||
int left, right, top, bottom;
|
||||
|
||||
if (HB_DIRECTION_IS_HORIZONTAL(hb_buffer_get_direction(buf)))
|
||||
{
|
||||
/* bounding box in window coordinates without offsets */
|
||||
left = x;
|
||||
right = x + bbox_w;
|
||||
top = y - bbox_h;
|
||||
bottom = y;
|
||||
|
||||
/* apply offsets */
|
||||
left += baseline_shift;
|
||||
right += baseline_shift;
|
||||
top -= baseline_offset - bbox_h;
|
||||
bottom -= baseline_offset - bbox_h;
|
||||
|
||||
/* draw the baseline */
|
||||
hline(&oDrawer, x, x + bbox_w, y, 0x0000ff00);
|
||||
}
|
||||
|
||||
if (HB_DIRECTION_IS_VERTICAL(hb_buffer_get_direction(buf)))
|
||||
{
|
||||
left = x;
|
||||
right = x + bbox_w;
|
||||
top = y;
|
||||
bottom = y + bbox_h;
|
||||
|
||||
left += baseline_offset;
|
||||
right += baseline_offset;
|
||||
top -= baseline_shift;
|
||||
bottom -= baseline_shift;
|
||||
|
||||
vline(&oDrawer, y, y + bbox_h, x, 0x0000ff00);
|
||||
}
|
||||
|
||||
/* +1/-1 are for the bbox borders be the next pixel outside the bbox itself */
|
||||
hline(&oDrawer, left - 1, right + 1, top - 1, 0xffff0000);
|
||||
hline(&oDrawer, left - 1, right + 1, bottom + 1, 0xffff0000);
|
||||
vline(&oDrawer, top - 1, bottom + 1, left - 1, 0xffff0000);
|
||||
vline(&oDrawer, top - 1, bottom + 1, right + 1, 0xffff0000);
|
||||
|
||||
/* set rendering spanner */
|
||||
ftr_params.gray_spans = spanner;
|
||||
|
||||
/* initialize rendering part of the baton */
|
||||
stuffbaton.pixels = NULL;
|
||||
stuffbaton.first_pixel = (uint32_t *)oDrawer.pixels;
|
||||
stuffbaton.last_pixel = (uint32_t *)(((uint8_t *)oDrawer.pixels) + oDrawer.pitch * oDrawer.height);
|
||||
stuffbaton.pitch = oDrawer.pitch;
|
||||
stuffbaton.rshift = oDrawer.Rshift;
|
||||
stuffbaton.gshift = oDrawer.Gshift;
|
||||
stuffbaton.bshift = oDrawer.Bshift;
|
||||
|
||||
/* render */
|
||||
for (unsigned j = 0; j < glyph_count; ++j)
|
||||
{
|
||||
if ((fterr = FT_Load_Glyph(ft_face[i], glyph_info[j].codepoint, 0)))
|
||||
{
|
||||
printf("load %08x failed fterr=%d.\n", glyph_info[j].codepoint, fterr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ft_face[i]->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
|
||||
{
|
||||
printf("glyph->format = %4s\n", (char *)&ft_face[i]->glyph->format);
|
||||
}
|
||||
else
|
||||
{
|
||||
int gx = x + (glyph_pos[j].x_offset / 64);
|
||||
int gy = y - (glyph_pos[j].y_offset / 64);
|
||||
|
||||
stuffbaton.pixels = (uint32_t *)(((uint8_t *)oDrawer.pixels) + gy * oDrawer.pitch) + gx;
|
||||
|
||||
if ((fterr = FT_Outline_Render(ft_library, &ft_face[i]->glyph->outline, &ftr_params)))
|
||||
printf("FT_Outline_Render() failed err=%d\n", fterr);
|
||||
}
|
||||
}
|
||||
|
||||
x += glyph_pos[j].x_advance / 64;
|
||||
y -= glyph_pos[j].y_advance / 64;
|
||||
}
|
||||
|
||||
/* clean up the buffer, but don't kill it just yet */
|
||||
hb_buffer_clear_contents(buf);
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
hb_buffer_destroy(buf);
|
||||
for (int i = 0; i < NUM_EXAMPLES; ++i)
|
||||
hb_font_destroy(hb_ft_font[i]);
|
||||
|
||||
FT_Done_FreeType(ft_library);
|
||||
|
||||
oDrawer.Save();
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
Common/3dParty/harfbuzz/test/test.pro
Normal file
19
Common/3dParty/harfbuzz/test/test.pro
Normal file
@ -0,0 +1,19 @@
|
||||
CONFIG -= qt
|
||||
TARGET = test
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../../../core
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
include($$CORE_ROOT_DIR/DesktopEditor/graphics/pro/freetype.pri)
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/harfbuzz/harfbuzz.pri)
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, graphics)
|
||||
DESTDIR = $$PWD/build
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ namespace NSCSS
|
||||
m_arParentsStyles(oStyle.m_arParentsStyles), m_sId(oStyle.m_sId),
|
||||
m_nDpi(oStyle.m_nDpi), m_UnitMeasure(oStyle.m_UnitMeasure), m_dCoreFontSize(oStyle.m_dCoreFontSize),
|
||||
m_oFont(oStyle.m_oFont), m_oMargin(oStyle.m_oMargin), m_oPadding(oStyle.m_oPadding), m_oBackground(oStyle.m_oBackground),
|
||||
m_oText(oStyle.m_oText), m_oBorder(oStyle.m_oBorder), m_oDisplay(oStyle.m_oDisplay){}
|
||||
m_oText(oStyle.m_oText), m_oBorder(oStyle.m_oBorder), m_oDisplay(oStyle.m_oDisplay), m_oTransform(oStyle.m_oTransform){}
|
||||
|
||||
CCompiledStyle::~CCompiledStyle()
|
||||
{
|
||||
@ -44,6 +44,7 @@ namespace NSCSS
|
||||
m_oPadding += oElement.m_oPadding;
|
||||
m_oText += oElement.m_oText;
|
||||
m_oDisplay += oElement.m_oDisplay;
|
||||
m_oTransform += oElement.m_oTransform;
|
||||
|
||||
if (!oElement.m_sId.empty())
|
||||
m_sId += L'+' + oElement.m_sId;
|
||||
@ -66,6 +67,7 @@ namespace NSCSS
|
||||
m_oPadding = oElement.m_oPadding;
|
||||
m_oText = oElement.m_oText;
|
||||
m_oDisplay = oElement.m_oDisplay;
|
||||
m_oTransform = oElement.m_oTransform;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -78,7 +80,8 @@ namespace NSCSS
|
||||
m_oMargin == oStyle.m_oMargin &&
|
||||
m_oPadding == oStyle.m_oPadding &&
|
||||
m_oText == oStyle.m_oText &&
|
||||
m_oDisplay == oStyle.m_oDisplay;
|
||||
m_oDisplay == oStyle.m_oDisplay &&
|
||||
m_oTransform == oStyle.m_oTransform;
|
||||
}
|
||||
|
||||
void CCompiledStyle::StyleEquation(CCompiledStyle &oFirstStyle, CCompiledStyle &oSecondStyle)
|
||||
@ -90,6 +93,7 @@ namespace NSCSS
|
||||
NSProperties::CText ::Equation(oFirstStyle.m_oText, oSecondStyle.m_oText);
|
||||
NSProperties::CBorder ::Equation(oFirstStyle.m_oBorder, oSecondStyle.m_oBorder);
|
||||
NSProperties::CDisplay ::Equation(oFirstStyle.m_oDisplay, oSecondStyle.m_oDisplay);
|
||||
NSProperties::CTransform ::Equation(oFirstStyle.m_oTransform, oSecondStyle.m_oTransform);
|
||||
}
|
||||
|
||||
void CCompiledStyle::SetDpi(const unsigned short &uiDpi)
|
||||
@ -431,6 +435,12 @@ namespace NSCSS
|
||||
m_oDisplay.SetVAlign(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
}
|
||||
//TRANSFORM
|
||||
CASE(L"transform"):
|
||||
{
|
||||
m_oTransform.SetMatrix(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
}
|
||||
default: AddOtherStyle(pPropertie, unLevel, bHardMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,11 +31,12 @@ namespace NSCSS
|
||||
NSProperties::CText m_oText;
|
||||
NSProperties::CBorder m_oBorder;
|
||||
NSProperties::CDisplay m_oDisplay;
|
||||
NSProperties::CTransform m_oTransform;
|
||||
|
||||
CCompiledStyle();
|
||||
CCompiledStyle(const CCompiledStyle& oStyle);
|
||||
|
||||
~CCompiledStyle();
|
||||
virtual ~CCompiledStyle();
|
||||
|
||||
void SetDpi(const unsigned short& uiDpi);
|
||||
void SetUnitMeasure(const UnitMeasure& enUnitMeasure);
|
||||
|
||||
@ -13,14 +13,14 @@ namespace NSCSS
|
||||
delete m_pInternal;
|
||||
}
|
||||
|
||||
CCompiledStyle CCssCalculator::GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings, const UnitMeasure& unitMeasure) const
|
||||
CCompiledStyle CCssCalculator::GetCompiledStyle(const std::vector<CNode> &arSelectors) const
|
||||
{
|
||||
return m_pInternal->GetCompiledStyle(arSelectors, bIsSettings, unitMeasure);
|
||||
return m_pInternal->GetCompiledStyle(arSelectors);
|
||||
}
|
||||
|
||||
bool CCssCalculator::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors, const bool &bIsSettings, const UnitMeasure &unitMeasure) const
|
||||
bool CCssCalculator::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors) const
|
||||
{
|
||||
return m_pInternal->GetCompiledStyle(oStyle, arSelectors, bIsSettings, unitMeasure);
|
||||
return m_pInternal->GetCompiledStyle(oStyle, arSelectors);
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator::CalculateStyleId(const CNode& oNode)
|
||||
@ -48,26 +48,11 @@ namespace NSCSS
|
||||
m_pInternal->AddStylesFromFile(wsFileName);
|
||||
}
|
||||
|
||||
void CCssCalculator::SetUnitMeasure(const UnitMeasure& nType)
|
||||
{
|
||||
m_pInternal->SetUnitMeasure(nType);
|
||||
}
|
||||
|
||||
void CCssCalculator::SetDpi(const unsigned short int& nValue)
|
||||
{
|
||||
m_pInternal->SetDpi(nValue);
|
||||
}
|
||||
|
||||
void CCssCalculator::SetBodyTree(const CTree &oTree)
|
||||
{
|
||||
m_pInternal->SetBodyTree(oTree);
|
||||
}
|
||||
|
||||
UnitMeasure CCssCalculator::GetUnitMeasure() const
|
||||
{
|
||||
return m_pInternal->GetUnitMeasure();
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator::GetEncoding() const
|
||||
{
|
||||
return m_pInternal->GetEncoding();
|
||||
@ -78,6 +63,26 @@ namespace NSCSS
|
||||
return m_pInternal->GetDpi();
|
||||
}
|
||||
|
||||
void CCssCalculator::ClearPageData()
|
||||
{
|
||||
m_pInternal->ClearPageData();
|
||||
}
|
||||
|
||||
void CCssCalculator::ClearEmbeddedStyles()
|
||||
{
|
||||
m_pInternal->ClearEmbeddedStyles();
|
||||
}
|
||||
|
||||
void CCssCalculator::ClearAllowedStyleFiles()
|
||||
{
|
||||
m_pInternal->ClearAllowedStyleFiles();
|
||||
}
|
||||
|
||||
void CCssCalculator::ClearStylesFromFile(const std::wstring& wsFilePath)
|
||||
{
|
||||
m_pInternal->ClearStylesFromFile(wsFilePath);
|
||||
}
|
||||
|
||||
void CCssCalculator::Clear()
|
||||
{
|
||||
m_pInternal->Clear();
|
||||
|
||||
@ -19,8 +19,8 @@ namespace NSCSS
|
||||
CCssCalculator();
|
||||
~CCssCalculator();
|
||||
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point) const;
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point) const;
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors) const;
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors) const;
|
||||
|
||||
std::wstring CalculateStyleId(const CNode& oNode);
|
||||
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
|
||||
@ -30,14 +30,15 @@ namespace NSCSS
|
||||
void AddStyles (const std::wstring& wsStyle);
|
||||
void AddStylesFromFile(const std::wstring& wsFileName);
|
||||
|
||||
void SetUnitMeasure(const UnitMeasure& nType);
|
||||
void SetDpi(const unsigned short int& nValue);
|
||||
void SetBodyTree(const CTree &oTree);
|
||||
|
||||
UnitMeasure GetUnitMeasure() const;
|
||||
std::wstring GetEncoding() const;
|
||||
unsigned short int GetDpi() const;
|
||||
|
||||
void ClearPageData();
|
||||
void ClearEmbeddedStyles();
|
||||
void ClearAllowedStyleFiles();
|
||||
void ClearStylesFromFile(const std::wstring& wsFilePath);
|
||||
void Clear();
|
||||
};
|
||||
}
|
||||
|
||||
@ -5,12 +5,9 @@
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <numeric>
|
||||
|
||||
#include "../../katana-parser/src/selector.h"
|
||||
#include "../../../../../UnicodeConverter/UnicodeConverter.h"
|
||||
#include "ConstValues.h"
|
||||
#include "../../../../../DesktopEditor/common/File.h"
|
||||
#include "StaticFunctions.h"
|
||||
|
||||
@ -41,61 +38,120 @@ bool operator<(const std::vector<NSCSS::CNode> &arLeftSelectors, const std::vect
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
CCssCalculator_Private::CCssCalculator_Private() : m_nDpi(96), m_nCountNodes(0), m_UnitMeasure(Point), m_mStatictics(NULL), m_sEncoding(L"UTF-8"){}
|
||||
CStyleStorage::CStyleStorage()
|
||||
{}
|
||||
|
||||
CCssCalculator_Private::~CCssCalculator_Private()
|
||||
CStyleStorage::~CStyleStorage()
|
||||
{
|
||||
m_arFiles.clear();
|
||||
|
||||
for (std::map<std::wstring, CElement*>::iterator oIter = m_mData.begin(); oIter != m_mData.end(); ++oIter)
|
||||
if (oIter->second != NULL)
|
||||
delete oIter->second;
|
||||
|
||||
m_mData.clear();
|
||||
|
||||
if (NULL != m_mStatictics)
|
||||
delete m_mStatictics;
|
||||
Clear();
|
||||
}
|
||||
|
||||
inline void CCssCalculator_Private::GetOutputData(KatanaOutput *oOutput)
|
||||
void CStyleStorage::Clear()
|
||||
{
|
||||
if ( NULL == oOutput )
|
||||
return;
|
||||
for (TStyleFileData* pStyleFileData : m_arStyleFiles)
|
||||
{
|
||||
if (nullptr == pStyleFileData)
|
||||
continue;
|
||||
|
||||
switch (oOutput->mode) {
|
||||
case KatanaParserModeStylesheet:
|
||||
GetStylesheet(oOutput->stylesheet);
|
||||
break;
|
||||
case KatanaParserModeRule:
|
||||
GetRule(oOutput->rule);
|
||||
break;
|
||||
case KatanaParserModeKeyframeRule:
|
||||
case KatanaParserModeKeyframeKeyList:
|
||||
case KatanaParserModeMediaList:
|
||||
case KatanaParserModeValue:
|
||||
case KatanaParserModeSelector:
|
||||
case KatanaParserModeDeclarationList:
|
||||
break;
|
||||
for (std::map<std::wstring, CElement*>::iterator oIter = pStyleFileData->m_mStyleData.begin(); oIter != pStyleFileData->m_mStyleData.end(); ++oIter)
|
||||
if (oIter->second != nullptr)
|
||||
delete oIter->second;
|
||||
|
||||
delete pStyleFileData;
|
||||
}
|
||||
|
||||
m_arStyleFiles.clear();
|
||||
m_arEmptyStyleFiles.clear();
|
||||
|
||||
ClearEmbeddedStyles();
|
||||
ClearAllowedStyleFiles();
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
ClearPageData();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CStyleStorage::AddStyles(const std::string& sStyle)
|
||||
{
|
||||
if (sStyle.empty())
|
||||
return;
|
||||
|
||||
KatanaOutput *output = katana_parse(sStyle.c_str(), sStyle.length(), KatanaParserModeStylesheet);
|
||||
this->GetOutputData(output, m_mEmbeddedStyleData);
|
||||
katana_destroy_output(output);
|
||||
}
|
||||
|
||||
void CStyleStorage::AddStyles(const std::wstring& wsStyle)
|
||||
{
|
||||
if (wsStyle.empty())
|
||||
return;
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
std::wregex oRegex(L"@page\\s*([^{]*)(\\{[^}]*\\})");
|
||||
std::wsmatch oMatch;
|
||||
std::wstring::const_iterator oSearchStart(wsStyle.cbegin());
|
||||
|
||||
while (std::regex_search(oSearchStart, wsStyle.cend(), oMatch, oRegex))
|
||||
{
|
||||
AddPageData(oMatch[1].str(), oMatch[2].str());
|
||||
oSearchStart = oMatch.suffix().first;
|
||||
}
|
||||
#endif
|
||||
|
||||
AddStyles(U_TO_UTF8(wsStyle));
|
||||
}
|
||||
|
||||
void CStyleStorage::AddStylesFromFile(const std::wstring& wsFileName)
|
||||
{
|
||||
std::set<std::wstring>::const_iterator itEmptyFileFound = m_arEmptyStyleFiles.find(wsFileName);
|
||||
|
||||
if (m_arEmptyStyleFiles.cend() != itEmptyFileFound)
|
||||
return;
|
||||
|
||||
std::vector<TStyleFileData*>::const_iterator itFound = std::find_if(m_arStyleFiles.cbegin(), m_arStyleFiles.cend(),
|
||||
[wsFileName](const TStyleFileData* pStyleFileData)
|
||||
{ return wsFileName == pStyleFileData->m_wsStyleFilepath; });
|
||||
|
||||
m_arAllowedStyleFiles.insert(wsFileName);
|
||||
|
||||
if (m_arStyleFiles.cend() != itFound)
|
||||
return;
|
||||
|
||||
TStyleFileData *pStyleFileData = new TStyleFileData();
|
||||
|
||||
pStyleFileData->m_wsStyleFilepath = wsFileName;
|
||||
|
||||
AddStyles(NS_STATIC_FUNCTIONS::GetContentAsUTF8(wsFileName), pStyleFileData->m_mStyleData);
|
||||
|
||||
if (!pStyleFileData->m_mStyleData.empty())
|
||||
m_arStyleFiles.push_back(pStyleFileData);
|
||||
else
|
||||
{
|
||||
m_arEmptyStyleFiles.insert(wsFileName);
|
||||
delete pStyleFileData;
|
||||
}
|
||||
}
|
||||
|
||||
void CStyleStorage::ClearStylesFromFile(const std::wstring& wsFileName)
|
||||
{
|
||||
std::vector<TStyleFileData*>::const_iterator itFound = std::find_if(m_arStyleFiles.cbegin(), m_arStyleFiles.cend(),
|
||||
[wsFileName](const TStyleFileData* pStyleFileData)
|
||||
{ return wsFileName == pStyleFileData->m_wsStyleFilepath; });
|
||||
|
||||
if (m_arStyleFiles.cend() != itFound)
|
||||
{
|
||||
m_arStyleFiles.erase(itFound);
|
||||
delete *itFound;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
std::map<std::wstring, std::wstring> CCssCalculator_Private::GetPageData(const std::wstring &wsPageName)
|
||||
void CStyleStorage::AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles)
|
||||
{
|
||||
if (m_arPageDatas.empty())
|
||||
return {};
|
||||
|
||||
for (const TPageData& oPageData : m_arPageDatas)
|
||||
{
|
||||
if (std::find(oPageData.m_wsNames.begin(), oPageData.m_wsNames.end(), wsPageName) != oPageData.m_wsNames.end())
|
||||
return oPageData.m_mData;
|
||||
}
|
||||
|
||||
return {};
|
||||
m_arPageDatas.push_back({NS_STATIC_FUNCTIONS::GetWordsW(wsPageName), NS_STATIC_FUNCTIONS::GetRules(wsStyles)});
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
|
||||
|
||||
void CStyleStorage::SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
for (const std::pair<std::wstring, std::wstring> &oData : mData)
|
||||
{
|
||||
@ -110,162 +166,84 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors)
|
||||
std::map<std::wstring, std::wstring> CStyleStorage::GetPageData(const std::wstring& wsPageName)
|
||||
{
|
||||
std::vector<std::wstring> arNodes;
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
|
||||
{
|
||||
if (!oNode->m_wsName.empty())
|
||||
arNodes.push_back(oNode->m_wsName);
|
||||
|
||||
if (!oNode->m_wsClass.empty())
|
||||
{
|
||||
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
|
||||
{
|
||||
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
|
||||
|
||||
arNodes.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
|
||||
[](std::wstring sRes, const std::wstring& sClass)
|
||||
{return sRes += L'.' + sClass + L' ';}));
|
||||
}
|
||||
else
|
||||
arNodes.push_back(L'.' + oNode->m_wsClass);
|
||||
}
|
||||
|
||||
if (!oNode->m_wsId.empty())
|
||||
arNodes.push_back(L'#' + oNode->m_wsId);
|
||||
}
|
||||
|
||||
return arNodes;
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::FindPrevAndKindElements(const CElement *pElement, const std::vector<std::wstring> &arNextNodes, std::vector<CElement*>& arFindedElements, const std::wstring &wsName, const std::vector<std::wstring> &arClasses)
|
||||
{
|
||||
if (arNextNodes.empty())
|
||||
return;
|
||||
|
||||
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
|
||||
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
|
||||
|
||||
if (!arTempPrev.empty())
|
||||
arFindedElements.insert(arFindedElements.end(), arTempPrev.begin(), arTempPrev.end());
|
||||
|
||||
if (!arTempKins.empty())
|
||||
arFindedElements.insert(arFindedElements.end(), arTempKins.begin(), arTempKins.end());
|
||||
}
|
||||
|
||||
std::vector<CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes, bool bIsSettings)
|
||||
{
|
||||
if (arNodes.empty())
|
||||
if (m_arPageDatas.empty())
|
||||
return {};
|
||||
|
||||
std::vector<CElement*> arFindedElements;
|
||||
|
||||
std::wstring wsName, wsId;
|
||||
std::vector<std::wstring> arClasses;
|
||||
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'#')
|
||||
for (const TPageData& oPageData : m_arPageDatas)
|
||||
{
|
||||
wsId = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsId);
|
||||
if (std::find(oPageData.m_wsNames.begin(), oPageData.m_wsNames.end(), wsPageName) != oPageData.m_wsNames.end())
|
||||
return oPageData.m_mData;
|
||||
}
|
||||
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'.')
|
||||
{
|
||||
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
|
||||
arNextNodes.push_back(arNodes.back());
|
||||
arNodes.pop_back();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!arNodes.empty())
|
||||
{
|
||||
wsName = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsName);
|
||||
}
|
||||
|
||||
const std::map<std::wstring, CElement*>::const_iterator oFindName = m_mData.find(wsName);
|
||||
std::map<std::wstring, CElement*>::const_iterator oFindId;
|
||||
|
||||
if (!wsId.empty())
|
||||
{
|
||||
oFindId = m_mData.find(wsId);
|
||||
|
||||
if (oFindId != m_mData.end() && NULL != m_mStatictics)
|
||||
{
|
||||
std::map<StatistickElement, unsigned int>::const_iterator oFindCountId = m_mStatictics->find(StatistickElement{StatistickElement::IsId, wsId});
|
||||
|
||||
if ((m_mStatictics->end() != oFindCountId) &&
|
||||
(((bIsSettings && oFindCountId->second < MaxNumberRepetitions) ||
|
||||
(!bIsSettings && oFindCountId->second >= MaxNumberRepetitions))))
|
||||
{
|
||||
if (!oFindId->second->Empty())
|
||||
arFindedElements.push_back(oFindId->second);
|
||||
}
|
||||
|
||||
FindPrevAndKindElements(oFindId->second, arNextNodes, arFindedElements, wsName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!arClasses.empty())
|
||||
{
|
||||
if (!bIsSettings)
|
||||
{
|
||||
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
|
||||
{
|
||||
const std::map<std::wstring, CElement*>::const_iterator oFindClass = m_mData.find(*iClass);
|
||||
if (oFindClass != m_mData.end())
|
||||
{
|
||||
if (!oFindClass->second->Empty())
|
||||
arFindedElements.push_back(oFindClass->second);
|
||||
|
||||
FindPrevAndKindElements(oFindClass->second, arNextNodes, arFindedElements, wsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oFindName != m_mData.end())
|
||||
{
|
||||
if (!bIsSettings)
|
||||
{
|
||||
if (!oFindName->second->Empty())
|
||||
arFindedElements.push_back(oFindName->second);
|
||||
|
||||
FindPrevAndKindElements(oFindName->second, arNextNodes, arFindedElements, wsName, arClasses);
|
||||
}
|
||||
}
|
||||
|
||||
if (arFindedElements.size() > 1)
|
||||
{
|
||||
std::sort(arFindedElements.rbegin(), arFindedElements.rend(),
|
||||
[](CElement* oFirstElement, CElement* oSecondElement)
|
||||
{
|
||||
return oFirstElement->GetWeight() > oSecondElement->GetWeight();
|
||||
});
|
||||
}
|
||||
|
||||
return arFindedElements;
|
||||
void CStyleStorage::ClearPageData()
|
||||
{
|
||||
m_arPageDatas.clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
void CCssCalculator_Private::AddPageData(const std::wstring &wsPageNames, const std::wstring &wsStyles)
|
||||
const CElement* CStyleStorage::FindElement(const std::wstring& wsSelector)
|
||||
{
|
||||
m_arPageDatas.push_back({NS_STATIC_FUNCTIONS::GetWordsW(wsPageNames), NS_STATIC_FUNCTIONS::GetRules(wsStyles)});
|
||||
if (wsSelector.empty())
|
||||
return nullptr;
|
||||
|
||||
const CElement* pFoundElement = FindSelectorFromStyleData(wsSelector, m_mEmbeddedStyleData);
|
||||
|
||||
if (nullptr != pFoundElement)
|
||||
return pFoundElement;
|
||||
|
||||
for (std::vector<TStyleFileData*>::const_reverse_iterator itIter = m_arStyleFiles.crbegin(); itIter < m_arStyleFiles.crend(); ++itIter)
|
||||
{
|
||||
if (m_arAllowedStyleFiles.cend() == std::find(m_arAllowedStyleFiles.cbegin(), m_arAllowedStyleFiles.cend(), (*itIter)->m_wsStyleFilepath))
|
||||
continue;
|
||||
|
||||
pFoundElement = FindSelectorFromStyleData(wsSelector, (*itIter)->m_mStyleData);
|
||||
|
||||
if (nullptr != pFoundElement)
|
||||
return pFoundElement;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline void CCssCalculator_Private::GetStylesheet(const KatanaStylesheet *oStylesheet)
|
||||
|
||||
void CStyleStorage::AddStyles(const std::string& sStyle, std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
if (sStyle.empty())
|
||||
return;
|
||||
|
||||
KatanaOutput *output = katana_parse(sStyle.c_str(), sStyle.length(), KatanaParserModeStylesheet);
|
||||
this->GetOutputData(output, mStyleData);
|
||||
katana_destroy_output(output);
|
||||
}
|
||||
|
||||
void CStyleStorage::ClearEmbeddedStyles()
|
||||
{
|
||||
for (std::map<std::wstring, CElement*>::iterator oIter = m_mEmbeddedStyleData.begin(); oIter != m_mEmbeddedStyleData.end(); ++oIter)
|
||||
if (oIter->second != nullptr)
|
||||
delete oIter->second;
|
||||
|
||||
m_mEmbeddedStyleData.clear();
|
||||
}
|
||||
|
||||
void CStyleStorage::ClearAllowedStyleFiles()
|
||||
{
|
||||
m_arAllowedStyleFiles.clear();
|
||||
}
|
||||
|
||||
void CStyleStorage::GetStylesheet(const KatanaStylesheet* oStylesheet, std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
for (size_t i = 0; i < oStylesheet->imports.length; ++i)
|
||||
GetRule((KatanaRule*)oStylesheet->imports.data[i]);
|
||||
GetRule((KatanaRule*)oStylesheet->imports.data[i], mStyleData);
|
||||
|
||||
for (size_t i = 0; i < oStylesheet->rules.length; ++i)
|
||||
GetRule((KatanaRule*)oStylesheet->rules.data[i]);
|
||||
GetRule((KatanaRule*)oStylesheet->rules.data[i], mStyleData);
|
||||
}
|
||||
|
||||
inline void CCssCalculator_Private::GetRule(const KatanaRule *oRule)
|
||||
void CStyleStorage::GetRule(const KatanaRule* oRule, std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
if ( NULL == oRule )
|
||||
return;
|
||||
@ -273,7 +251,7 @@ namespace NSCSS
|
||||
switch (oRule->type) {
|
||||
case KatanaRuleStyle:
|
||||
{
|
||||
GetStyleRule((KatanaStyleRule*)oRule);
|
||||
GetStyleRule((KatanaStyleRule*)oRule, mStyleData);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -281,7 +259,7 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
inline void CCssCalculator_Private::GetStyleRule(const KatanaStyleRule *oRule)
|
||||
void CStyleStorage::GetStyleRule(const KatanaStyleRule* oRule, std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
if (oRule->declarations->length == 0)
|
||||
return;
|
||||
@ -297,7 +275,7 @@ namespace NSCSS
|
||||
|
||||
for (std::vector<std::wstring>::reverse_iterator oWord = arWords.rbegin(); oWord != arWords.rend(); ++oWord)
|
||||
{
|
||||
const size_t posPoint = oWord->find(L'.');
|
||||
const size_t posPoint = oWord->find(L'.');
|
||||
const size_t posLattice = oWord->find(L'#');
|
||||
|
||||
const std::wstring sName = (posPoint != std::wstring::npos) ? oWord->substr(0, posPoint) : (posLattice != std::wstring::npos) ? oWord->substr(0, posLattice) : *oWord;
|
||||
@ -313,8 +291,8 @@ namespace NSCSS
|
||||
{
|
||||
if (NULL == oFirstElement && bCreateFirst)
|
||||
{
|
||||
const std::map<std::wstring, CElement*>::const_iterator& oFindId = m_mData.find(sId);
|
||||
if (oFindId != m_mData.end())
|
||||
const std::map<std::wstring, CElement*>::const_iterator& oFindId = mStyleData.find(sId);
|
||||
if (oFindId != mStyleData.end())
|
||||
{
|
||||
oIdElement = oFindId->second;
|
||||
bCreateFirst = false;
|
||||
@ -342,8 +320,8 @@ namespace NSCSS
|
||||
{
|
||||
if (NULL == oFirstElement && bCreateFirst)
|
||||
{
|
||||
const std::map<std::wstring, CElement*>::const_iterator& oFindClass = m_mData.find(sClass);
|
||||
if (oFindClass != m_mData.end())
|
||||
const std::map<std::wstring, CElement*>::const_iterator& oFindClass = mStyleData.find(sClass);
|
||||
if (oFindClass != mStyleData.end())
|
||||
{
|
||||
oClassElement = oFindClass->second;
|
||||
bCreateFirst = false;
|
||||
@ -375,8 +353,8 @@ namespace NSCSS
|
||||
{
|
||||
if (NULL == oFirstElement && bCreateFirst)
|
||||
{
|
||||
const std::map<std::wstring, CElement*>::const_iterator& oFindName = m_mData.find(sName);
|
||||
if (oFindName != m_mData.end())
|
||||
const std::map<std::wstring, CElement*>::const_iterator& oFindName = mStyleData.find(sName);
|
||||
if (oFindName != mStyleData.end())
|
||||
{
|
||||
oNameElement = oFindName->second;
|
||||
bCreateFirst = false;
|
||||
@ -408,11 +386,16 @@ namespace NSCSS
|
||||
oLastElement->AddProperties(mStyle);
|
||||
|
||||
if (NULL != oFirstElement)
|
||||
m_mData[oFirstElement->GetSelector()] = oFirstElement;
|
||||
mStyleData[oFirstElement->GetSelector()] = oFirstElement;
|
||||
}
|
||||
}
|
||||
|
||||
inline std::vector<std::wstring> CCssCalculator_Private::GetSelectorList(const KatanaArray* oSelectors) const
|
||||
std::wstring CStyleStorage::GetValueList(const KatanaArray* oValues)
|
||||
{
|
||||
return StringifyValueList(oValues);
|
||||
}
|
||||
|
||||
std::vector<std::wstring> CStyleStorage::GetSelectorList(const KatanaArray* oSelectors) const
|
||||
{
|
||||
if (oSelectors->length == 0)
|
||||
return std::vector<std::wstring>();
|
||||
@ -425,7 +408,7 @@ namespace NSCSS
|
||||
return arSelectors;
|
||||
}
|
||||
|
||||
inline std::wstring CCssCalculator_Private::GetSelector(const KatanaSelector *oSelector) const
|
||||
std::wstring CStyleStorage::GetSelector(const KatanaSelector* oSelector) const
|
||||
{
|
||||
KatanaParser oParser;
|
||||
oParser.options = &kKatanaDefaultOptions;
|
||||
@ -444,7 +427,7 @@ namespace NSCSS
|
||||
return wsText;
|
||||
}
|
||||
|
||||
inline std::map<std::wstring, std::wstring> CCssCalculator_Private::GetDeclarationList(const KatanaArray* oDeclarations) const
|
||||
std::map<std::wstring, std::wstring> CStyleStorage::GetDeclarationList(const KatanaArray* oDeclarations) const
|
||||
{
|
||||
if(oDeclarations->length == 0)
|
||||
return std::map<std::wstring, std::wstring>();
|
||||
@ -457,7 +440,7 @@ namespace NSCSS
|
||||
return arDeclarations;
|
||||
}
|
||||
|
||||
inline std::pair<std::wstring, std::wstring> CCssCalculator_Private::GetDeclaration(const KatanaDeclaration* oDecl) const
|
||||
std::pair<std::wstring, std::wstring> CStyleStorage::GetDeclaration(const KatanaDeclaration* oDecl) const
|
||||
{
|
||||
std::wstring sValueList = StringifyValueList(oDecl->values);
|
||||
|
||||
@ -467,52 +450,213 @@ namespace NSCSS
|
||||
return std::make_pair(UTF8_TO_U(std::string(oDecl->property)), sValueList);
|
||||
}
|
||||
|
||||
inline std::wstring CCssCalculator_Private::GetValueList(const KatanaArray *oValues)
|
||||
void CStyleStorage::GetOutputData(KatanaOutput* oOutput, std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
return StringifyValueList(oValues);
|
||||
if ( NULL == oOutput )
|
||||
return;
|
||||
|
||||
switch (oOutput->mode) {
|
||||
case KatanaParserModeStylesheet:
|
||||
GetStylesheet(oOutput->stylesheet, mStyleData);
|
||||
break;
|
||||
case KatanaParserModeRule:
|
||||
GetRule(oOutput->rule, mStyleData);
|
||||
break;
|
||||
case KatanaParserModeKeyframeRule:
|
||||
case KatanaParserModeKeyframeKeyList:
|
||||
case KatanaParserModeMediaList:
|
||||
case KatanaParserModeValue:
|
||||
case KatanaParserModeSelector:
|
||||
case KatanaParserModeDeclarationList:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const CElement* CStyleStorage::FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
std::map<std::wstring, CElement*>::const_iterator itFound = mStyleData.find(wsSelector);
|
||||
|
||||
if (mStyleData.cend() != itFound)
|
||||
return itFound->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCssCalculator_Private::CCssCalculator_Private() : m_nDpi(96), m_nCountNodes(0), m_sEncoding(L"UTF-8"){}
|
||||
|
||||
CCssCalculator_Private::~CCssCalculator_Private()
|
||||
{}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
//TODO:: пересмотреть данный метод
|
||||
m_oStyleStorage.SetPageData(oPage, mData, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
std::map<std::wstring, std::wstring> CCssCalculator_Private::GetPageData(const std::wstring &wsPageName)
|
||||
{
|
||||
return m_oStyleStorage.GetPageData(wsPageName);
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::ClearPageData()
|
||||
{
|
||||
m_oStyleStorage.ClearPageData();
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors)
|
||||
{
|
||||
std::vector<std::wstring> arNodes;
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
|
||||
{
|
||||
if (!oNode->m_wsName.empty())
|
||||
arNodes.push_back(oNode->m_wsName);
|
||||
|
||||
if (!oNode->m_wsClass.empty())
|
||||
{
|
||||
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
|
||||
{
|
||||
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
|
||||
|
||||
arNodes.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
|
||||
[](std::wstring sRes, const std::wstring& sClass)
|
||||
{return sRes += L'.' + sClass + L' ';}));
|
||||
}
|
||||
else
|
||||
arNodes.push_back(L'.' + oNode->m_wsClass);
|
||||
}
|
||||
|
||||
if (!oNode->m_wsId.empty())
|
||||
arNodes.push_back(L'#' + oNode->m_wsId);
|
||||
}
|
||||
|
||||
return arNodes;
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::FindPrevAndKindElements(const CElement *pElement, const std::vector<std::wstring> &arNextNodes, std::vector<const CElement*>& arFindedElements, const std::wstring &wsName, const std::vector<std::wstring> &arClasses)
|
||||
{
|
||||
if (arNextNodes.empty())
|
||||
return;
|
||||
|
||||
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
|
||||
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
|
||||
|
||||
if (!arTempPrev.empty())
|
||||
arFindedElements.insert(arFindedElements.end(), arTempPrev.begin(), arTempPrev.end());
|
||||
|
||||
if (!arTempKins.empty())
|
||||
arFindedElements.insert(arFindedElements.end(), arTempKins.begin(), arTempKins.end());
|
||||
}
|
||||
|
||||
std::vector<const CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes)
|
||||
{
|
||||
if (arNodes.empty())
|
||||
return {};
|
||||
|
||||
std::vector<const CElement*> arFindedElements;
|
||||
|
||||
std::wstring wsName, 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());
|
||||
arNodes.pop_back();
|
||||
}
|
||||
|
||||
if (!arNodes.empty())
|
||||
{
|
||||
wsName = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsName);
|
||||
}
|
||||
|
||||
if (!wsId.empty())
|
||||
{
|
||||
const CElement* pFoundId = m_oStyleStorage.FindElement(wsId);
|
||||
|
||||
if(nullptr != pFoundId)
|
||||
{
|
||||
if (!pFoundId->Empty())
|
||||
arFindedElements.push_back(pFoundId);
|
||||
|
||||
FindPrevAndKindElements(pFoundId, arNextNodes, arFindedElements, wsName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!arClasses.empty())
|
||||
{
|
||||
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
|
||||
{
|
||||
const CElement* pFoundClass = m_oStyleStorage.FindElement(*iClass);
|
||||
|
||||
if (nullptr != pFoundClass)
|
||||
{
|
||||
if (!pFoundClass->Empty())
|
||||
arFindedElements.push_back(pFoundClass);
|
||||
|
||||
FindPrevAndKindElements(pFoundClass, arNextNodes, arFindedElements, wsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CElement* pFoundName = m_oStyleStorage.FindElement(wsName);
|
||||
|
||||
if (nullptr != pFoundName)
|
||||
{
|
||||
if (!pFoundName->Empty())
|
||||
arFindedElements.push_back(pFoundName);
|
||||
|
||||
FindPrevAndKindElements(pFoundName, arNextNodes, arFindedElements, wsName, arClasses);
|
||||
}
|
||||
|
||||
if (arFindedElements.size() > 1)
|
||||
{
|
||||
std::sort(arFindedElements.rbegin(), arFindedElements.rend(),
|
||||
[](const CElement* oFirstElement, const CElement* oSecondElement)
|
||||
{ return oFirstElement->GetWeight() > oSecondElement->GetWeight(); });
|
||||
}
|
||||
|
||||
return arFindedElements;
|
||||
}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle CCssCalculator_Private::GetCompiledStyle(const std::vector<CNode>& arSelectors, const bool& bIsSettings, const UnitMeasure& unitMeasure)
|
||||
CCompiledStyle CCssCalculator_Private::GetCompiledStyle(const std::vector<CNode>& arSelectors)
|
||||
{
|
||||
if (arSelectors.empty())
|
||||
return CCompiledStyle();
|
||||
|
||||
CCompiledStyle oStyle;
|
||||
|
||||
GetCompiledStyle(oStyle, arSelectors, bIsSettings, unitMeasure);
|
||||
GetCompiledStyle(oStyle, arSelectors);
|
||||
|
||||
return oStyle;
|
||||
}
|
||||
|
||||
bool CCssCalculator_Private::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors, const bool &bIsSettings, const UnitMeasure &unitMeasure)
|
||||
bool CCssCalculator_Private::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors)
|
||||
{
|
||||
if (arSelectors.empty())
|
||||
return false;
|
||||
|
||||
SetUnitMeasure(unitMeasure);
|
||||
const std::map<std::vector<CNode>, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
|
||||
|
||||
if (!bIsSettings)
|
||||
if (oItem != m_mUsedStyles.end())
|
||||
{
|
||||
const std::map<std::vector<CNode>, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
|
||||
|
||||
if (oItem != m_mUsedStyles.end())
|
||||
{
|
||||
oStyle = oItem->second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (NULL == m_mStatictics || m_mStatictics->empty())
|
||||
{
|
||||
oStyle.SetDpi(m_nDpi);
|
||||
oStyle.SetUnitMeasure(m_UnitMeasure);
|
||||
oStyle.SetID(arSelectors.back().m_wsName + ((!arSelectors.back().m_wsClass.empty()) ? L'.' + arSelectors.back().m_wsClass : L"") + ((arSelectors.back().m_wsId.empty()) ? L"" : L'#' + arSelectors.back().m_wsId) + L'-' + std::to_wstring(++m_nCountNodes));
|
||||
|
||||
return false;
|
||||
oStyle = oItem->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
oStyle.SetDpi(m_nDpi);
|
||||
oStyle.SetUnitMeasure(m_UnitMeasure);
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
|
||||
std::vector<std::wstring> arPrevNodes;
|
||||
@ -535,25 +679,10 @@ namespace NSCSS
|
||||
|
||||
oTempStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
|
||||
|
||||
for (const CElement* oElement : FindElements(arNodes, arPrevNodes, bIsSettings))
|
||||
for (const CElement* oElement : FindElements(arNodes, arPrevNodes))
|
||||
oTempStyle.AddStyle(oElement->GetStyle(), i + 1);
|
||||
|
||||
if (NULL != m_mStatictics)
|
||||
{
|
||||
std::map<StatistickElement, unsigned int>::const_iterator oFindCountStyle = m_mStatictics->find(StatistickElement{StatistickElement::IsStyle, arSelectors[i].m_wsStyle});
|
||||
|
||||
if (oFindCountStyle != m_mStatictics->end())
|
||||
{
|
||||
if ((bIsSettings && oFindCountStyle->second < MaxNumberRepetitions) ||
|
||||
(!bIsSettings && oFindCountStyle->second >= MaxNumberRepetitions))
|
||||
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
else if (!bIsSettings)
|
||||
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
}
|
||||
else /*if (bIsSettings)*/
|
||||
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
}
|
||||
else
|
||||
if (!arSelectors[i].m_wsStyle.empty())
|
||||
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
|
||||
oStyle += oTempStyle;
|
||||
@ -569,7 +698,7 @@ namespace NSCSS
|
||||
|
||||
oStyle.SetID(CalculateStyleId(arSelectors.back()));
|
||||
|
||||
if (!bIsSettings && !oStyle.Empty())
|
||||
if (!oStyle.Empty())
|
||||
m_mUsedStyles[arSelectors] = oStyle;
|
||||
|
||||
return true;
|
||||
@ -597,7 +726,7 @@ namespace NSCSS
|
||||
SetPageData(oPageData, GetPageData(mRules[L"page"]), i + 1, true);
|
||||
}
|
||||
|
||||
for (const CElement* oElement : FindElements(arNodes, arNextNodes, false))
|
||||
for (const CElement* oElement : FindElements(arNodes, arNextNodes))
|
||||
{
|
||||
std::map<std::wstring, std::wstring> mRules = oElement->GetStyle();
|
||||
if (mRules.end() != mRules.find(L"page"))
|
||||
@ -611,42 +740,20 @@ namespace NSCSS
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
void CCssCalculator_Private::AddStyles(const std::string &sStyle)
|
||||
{
|
||||
if (sStyle.empty())
|
||||
return;
|
||||
|
||||
KatanaOutput *output = katana_parse(sStyle.c_str(), sStyle.length(), KatanaParserModeStylesheet);
|
||||
this->GetOutputData(output);
|
||||
katana_destroy_output(output);
|
||||
void CCssCalculator_Private::AddStyles(const std::string& sStyle)
|
||||
{
|
||||
m_oStyleStorage.AddStyles(sStyle);
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::AddStyles(const std::wstring &wsStyle)
|
||||
void CCssCalculator_Private::AddStyles(const std::wstring& wsStyle)
|
||||
{
|
||||
if (wsStyle.empty())
|
||||
return;
|
||||
|
||||
std::wregex oRegex(L"@page\\s*([^{]*)(\\{[^}]*\\})");
|
||||
std::wsmatch oMatch;
|
||||
std::wstring::const_iterator oSearchStart(wsStyle.cbegin());
|
||||
|
||||
while (std::regex_search(oSearchStart, wsStyle.cend(), oMatch, oRegex))
|
||||
{
|
||||
AddPageData(oMatch[1].str(), oMatch[2].str());
|
||||
oSearchStart = oMatch.suffix().first;
|
||||
}
|
||||
|
||||
AddStyles(U_TO_UTF8(wsStyle));
|
||||
m_oStyleStorage.AddStyles(wsStyle);
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::AddStylesFromFile(const std::wstring& wsFileName)
|
||||
{
|
||||
if (std::find(m_arFiles.begin(), m_arFiles.end(), wsFileName) != m_arFiles.end())
|
||||
return;
|
||||
|
||||
m_arFiles.push_back(wsFileName);
|
||||
|
||||
AddStyles(NS_STATIC_FUNCTIONS::GetContentAsUTF8(wsFileName));
|
||||
m_oStyleStorage.AddStylesFromFile(wsFileName);
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::SetDpi(unsigned short int nValue)
|
||||
@ -654,32 +761,28 @@ namespace NSCSS
|
||||
m_nDpi = nValue;
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::SetBodyTree(const CTree &oTree)
|
||||
{
|
||||
if (NULL == m_mStatictics)
|
||||
m_mStatictics = new std::map<StatistickElement, unsigned int>();
|
||||
|
||||
CTree::CountingNumberRepetitions(oTree, *m_mStatictics);
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::SetUnitMeasure(const UnitMeasure& nType)
|
||||
{
|
||||
m_UnitMeasure = nType;
|
||||
}
|
||||
|
||||
unsigned short int CCssCalculator_Private::GetDpi() const
|
||||
{
|
||||
return m_nDpi;
|
||||
}
|
||||
|
||||
const std::map<std::wstring, CElement *> *CCssCalculator_Private::GetData() const
|
||||
void CCssCalculator_Private::ClearEmbeddedStyles()
|
||||
{
|
||||
return &m_mData;
|
||||
m_oStyleStorage.ClearEmbeddedStyles();
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
m_mUsedStyles.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
UnitMeasure CCssCalculator_Private::GetUnitMeasure() const
|
||||
void CCssCalculator_Private::ClearAllowedStyleFiles()
|
||||
{
|
||||
return m_UnitMeasure;
|
||||
m_oStyleStorage.ClearAllowedStyleFiles();
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::ClearStylesFromFile(const std::wstring& wsFilePath)
|
||||
{
|
||||
m_oStyleStorage.ClearStylesFromFile(wsFilePath);
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator_Private::GetEncoding() const
|
||||
@ -691,12 +794,22 @@ namespace NSCSS
|
||||
{
|
||||
m_sEncoding = L"UTF-8";
|
||||
m_nDpi = 96;
|
||||
m_UnitMeasure = Point;
|
||||
|
||||
m_mData.clear();
|
||||
m_arFiles.clear();
|
||||
m_oStyleStorage.Clear();
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
m_mUsedStyles.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsTableElement(const std::wstring& wsNameTag)
|
||||
{
|
||||
return L"td" == wsNameTag || L"tr" == wsNameTag || L"table" == wsNameTag ||
|
||||
L"tbody" == wsNameTag || L"thead" == wsNameTag || L"tfoot" == wsNameTag ||
|
||||
L"th" == wsNameTag;
|
||||
}
|
||||
}
|
||||
|
||||
inline static std::wstring StringifyValueList(const KatanaArray* oValues)
|
||||
{
|
||||
if (NULL == oValues)
|
||||
@ -797,11 +910,4 @@ inline static std::wstring StringifyValue(const KatanaValue* oValue)
|
||||
return str;
|
||||
}
|
||||
|
||||
inline static bool IsTableElement(const std::wstring& wsNameTag)
|
||||
{
|
||||
return L"td" == wsNameTag || L"tr" == wsNameTag || L"table" == wsNameTag ||
|
||||
L"tbody" == wsNameTag || L"thead" == wsNameTag || L"tfoot" == wsNameTag ||
|
||||
L"th" == wsNameTag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include "CElement.h"
|
||||
#include "ConstValues.h"
|
||||
#include "CUnitMeasureConverter.h"
|
||||
#include "StyleProperties.h"
|
||||
#include "../../katana-parser/src/katana.h"
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
@ -16,16 +14,43 @@
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
class CCssCalculator_Private
|
||||
class CStyleStorage
|
||||
{
|
||||
unsigned short int m_nDpi;
|
||||
unsigned short int m_nCountNodes;
|
||||
UnitMeasure m_UnitMeasure;
|
||||
public:
|
||||
CStyleStorage();
|
||||
~CStyleStorage();
|
||||
|
||||
std::list<std::wstring> m_arFiles;
|
||||
void Clear();
|
||||
|
||||
std::map<std::wstring, CElement*> m_mData;
|
||||
void AddStyles(const std::string& sStyle);
|
||||
void AddStyles(const std::wstring& wsStyle);
|
||||
void AddStylesFromFile(const std::wstring& wsFileName);
|
||||
|
||||
void ClearEmbeddedStyles();
|
||||
void ClearAllowedStyleFiles();
|
||||
void ClearStylesFromFile(const std::wstring& wsFileName);
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
void AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles);
|
||||
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
|
||||
std::map<std::wstring, std::wstring> GetPageData(const std::wstring& wsPageName);
|
||||
void ClearPageData();
|
||||
#endif
|
||||
|
||||
const CElement* FindElement(const std::wstring& wsSelector);
|
||||
private:
|
||||
typedef struct
|
||||
{
|
||||
std::wstring m_wsStyleFilepath;
|
||||
std::map<std::wstring, CElement*> m_mStyleData;
|
||||
} TStyleFileData;
|
||||
|
||||
std::set<std::wstring> m_arEmptyStyleFiles;
|
||||
std::set<std::wstring> m_arAllowedStyleFiles;
|
||||
std::vector<TStyleFileData*> m_arStyleFiles;
|
||||
std::map<std::wstring, CElement*> m_mEmbeddedStyleData;
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
typedef struct
|
||||
{
|
||||
std::vector<std::wstring> m_wsNames;
|
||||
@ -33,29 +58,14 @@ namespace NSCSS
|
||||
} TPageData;
|
||||
|
||||
std::vector<TPageData> m_arPageDatas;
|
||||
|
||||
std::map<StatistickElement, unsigned int> *m_mStatictics; // Количество повторений свойств id и style у селекторов
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
std::map<std::vector<CNode>, CCompiledStyle> m_mUsedStyles;
|
||||
|
||||
std::map<std::wstring, std::wstring> GetPageData(const std::wstring& wsPageName);
|
||||
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors);
|
||||
|
||||
void FindPrevAndKindElements(const CElement* pElement, const std::vector<std::wstring>& arNextNodes, std::vector<CElement*>& arFindedElements, const std::wstring& wsName, const std::vector<std::wstring>& arClasses = {});
|
||||
std::vector<CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes, bool bIsSettings);
|
||||
#endif
|
||||
private:
|
||||
void AddStyles(const std::string& sStyle, std::map<std::wstring, CElement*>& mStyleData);
|
||||
|
||||
std::wstring m_sEncoding;
|
||||
void GetStylesheet(const KatanaStylesheet* oStylesheet, std::map<std::wstring, CElement*>& mStyleData);
|
||||
void GetRule(const KatanaRule* oRule, std::map<std::wstring, CElement*>& mStyleData);
|
||||
|
||||
void AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles);
|
||||
|
||||
void GetStylesheet(const KatanaStylesheet* oStylesheet);
|
||||
void GetRule(const KatanaRule* oRule);
|
||||
|
||||
void GetStyleRule(const KatanaStyleRule* oRule);
|
||||
void GetStyleRule(const KatanaStyleRule* oRule, std::map<std::wstring, CElement*>& mStyleData);
|
||||
|
||||
std::wstring GetValueList(const KatanaArray* oValues);
|
||||
|
||||
@ -65,36 +75,60 @@ namespace NSCSS
|
||||
std::map<std::wstring, std::wstring> GetDeclarationList(const KatanaArray* oDeclarations) const;
|
||||
std::pair<std::wstring, std::wstring> GetDeclaration(const KatanaDeclaration* oDecl) const;
|
||||
|
||||
void GetOutputData(KatanaOutput* oOutput);
|
||||
void GetOutputData(KatanaOutput* oOutput, std::map<std::wstring, CElement*>& mStyleData);
|
||||
|
||||
const CElement* FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData);
|
||||
};
|
||||
|
||||
class CCssCalculator_Private
|
||||
{
|
||||
unsigned short int m_nDpi;
|
||||
unsigned short int m_nCountNodes;
|
||||
|
||||
CStyleStorage m_oStyleStorage;
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
std::map<std::vector<CNode>, CCompiledStyle> m_mUsedStyles;
|
||||
|
||||
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
|
||||
std::map<std::wstring, std::wstring> GetPageData(const std::wstring &wsPageName);
|
||||
#endif
|
||||
|
||||
void FindPrevAndKindElements(const CElement* pElement, const std::vector<std::wstring>& arNextNodes, std::vector<const CElement*>& arFindedElements, const std::wstring& wsName, const std::vector<std::wstring>& arClasses = {});
|
||||
|
||||
std::wstring m_sEncoding;
|
||||
public:
|
||||
CCssCalculator_Private();
|
||||
~CCssCalculator_Private();
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point);
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point);
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors);
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors);
|
||||
|
||||
std::wstring CalculateStyleId(const CNode& oNode);
|
||||
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
|
||||
|
||||
void ClearPageData();
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors);
|
||||
std::vector<const CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes);
|
||||
|
||||
void AddStyles(const std::string& sStyle);
|
||||
void AddStyles(const std::wstring& wsStyle);
|
||||
void AddStylesFromFile(const std::wstring& wsFileName);
|
||||
|
||||
void SetUnitMeasure(const UnitMeasure& nType);
|
||||
void SetDpi(unsigned short int nValue);
|
||||
void SetBodyTree(const CTree &oTree);
|
||||
|
||||
UnitMeasure GetUnitMeasure() const;
|
||||
std::wstring GetEncoding() const;
|
||||
unsigned short int GetDpi() const;
|
||||
|
||||
const std::map<std::wstring, CElement*>* GetData() const;
|
||||
|
||||
void ClearEmbeddedStyles();
|
||||
void ClearAllowedStyleFiles();
|
||||
void ClearStylesFromFile(const std::wstring& wsFilePath);
|
||||
void Clear();
|
||||
|
||||
};
|
||||
|
||||
inline bool IsTableElement(const std::wstring& wsNameTag);
|
||||
}
|
||||
#endif // CCSSCALCULATOR_PRIVATE_H
|
||||
|
||||
@ -40,6 +40,7 @@ namespace NSCSS
|
||||
{
|
||||
m_sSelector = sSelector;
|
||||
m_sFullSelector = m_sSelector;
|
||||
UpdateWeight();
|
||||
}
|
||||
|
||||
void NSCSS::CElement::AddPropertie(const std::wstring &sName, const std::wstring& sValue)
|
||||
@ -67,6 +68,7 @@ namespace NSCSS
|
||||
|
||||
m_arPrevElements.push_back(oPrevElement);
|
||||
oPrevElement->m_sFullSelector += L' ' + m_sFullSelector;
|
||||
UpdateWeight();
|
||||
}
|
||||
|
||||
void CElement::AddKinElement(CElement *oKinElement)
|
||||
@ -76,6 +78,7 @@ namespace NSCSS
|
||||
|
||||
m_arKinElements.push_back(oKinElement);
|
||||
oKinElement->m_sFullSelector += m_sFullSelector;
|
||||
oKinElement->UpdateWeight();
|
||||
}
|
||||
|
||||
std::map<std::wstring, std::wstring> CElement::GetStyle() const
|
||||
@ -230,11 +233,14 @@ namespace NSCSS
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector<unsigned short> CElement::GetWeight()
|
||||
void CElement::UpdateWeight()
|
||||
{
|
||||
if (m_arWeight.empty())
|
||||
m_arWeight = NS_STATIC_FUNCTIONS::GetWeightSelector(m_sFullSelector);
|
||||
}
|
||||
|
||||
std::vector<unsigned short> CElement::GetWeight() const
|
||||
{
|
||||
return m_arWeight;
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,8 @@ namespace NSCSS
|
||||
|
||||
CElement *FindPrevElement(const std::wstring& sSelector) const;
|
||||
|
||||
std::vector<unsigned short int> GetWeight();
|
||||
void UpdateWeight();
|
||||
std::vector<unsigned short int> GetWeight() const;
|
||||
void IncreasedWeight();
|
||||
};
|
||||
}
|
||||
|
||||
@ -2,29 +2,6 @@
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
bool StatistickElement::operator<(const StatistickElement &oStatistickElement) const
|
||||
{
|
||||
return sValue < oStatistickElement.sValue;
|
||||
}
|
||||
|
||||
void CTree::Clear()
|
||||
{
|
||||
m_arrChild.clear();
|
||||
m_oNode.Clear();
|
||||
}
|
||||
|
||||
void CTree::CountingNumberRepetitions(const CTree &oTree, std::map<StatistickElement, unsigned int> &mStatictics)
|
||||
{
|
||||
if (!oTree.m_oNode.m_wsId.empty())
|
||||
++mStatictics[StatistickElement{StatistickElement::IsId, L'#' + oTree.m_oNode.m_wsId}];
|
||||
if (!oTree.m_oNode.m_wsStyle.empty())
|
||||
++mStatictics[StatistickElement{StatistickElement::IsStyle, oTree.m_oNode.m_wsStyle}];
|
||||
|
||||
if (!oTree.m_arrChild.empty())
|
||||
for (const CTree& oChildren : oTree.m_arrChild)
|
||||
CountingNumberRepetitions(oChildren, mStatictics);
|
||||
}
|
||||
|
||||
namespace NSConstValues
|
||||
{
|
||||
const std::map<std::wstring, std::wstring> COLORS
|
||||
|
||||
@ -16,28 +16,6 @@ namespace NSCSS
|
||||
ScalingDirectionY = 2
|
||||
} ScalingDirection;
|
||||
|
||||
struct StatistickElement
|
||||
{
|
||||
enum TypeElement
|
||||
{
|
||||
IsStyle = 0,
|
||||
IsId
|
||||
} m_enType;
|
||||
std::wstring sValue;
|
||||
|
||||
bool operator<(const StatistickElement& oStatistickElement) const;
|
||||
};
|
||||
|
||||
struct CTree
|
||||
{
|
||||
NSCSS::CNode m_oNode;
|
||||
std::vector<CTree> m_arrChild;
|
||||
|
||||
void Clear();
|
||||
|
||||
static void CountingNumberRepetitions(const CTree &oTree, std::map<StatistickElement, unsigned int> &mStatictics);
|
||||
};
|
||||
|
||||
namespace NSConstValues
|
||||
{
|
||||
extern const std::map<std::wstring, std::wstring> COLORS;
|
||||
|
||||
@ -48,7 +48,6 @@ namespace NS_STATIC_FUNCTIONS
|
||||
if (sEncoding.empty())
|
||||
sEncoding = "utf-8";
|
||||
|
||||
|
||||
if (!sEncoding.empty() && sEncoding != "utf-8" && sEncoding != "UTF-8")
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
|
||||
@ -513,6 +513,9 @@ namespace NSCSS
|
||||
return (*static_cast<std::wstring*>(m_oValue)) == (*static_cast<std::wstring*>(oColor.m_oValue));
|
||||
case ColorUrl:
|
||||
return (*static_cast<CURL*>(m_oValue)) == (*static_cast<CURL*>(oColor.m_oValue));
|
||||
case ColorContextStroke:
|
||||
case ColorContextFill:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -532,6 +535,9 @@ namespace NSCSS
|
||||
return (*static_cast<std::wstring*>(m_oValue)) != (*static_cast<std::wstring*>(oColor.m_oValue));
|
||||
case ColorUrl:
|
||||
return (*static_cast<CURL*>(m_oValue)) != (*static_cast<CURL*>(oColor.m_oValue));
|
||||
case ColorContextStroke:
|
||||
case ColorContextFill:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,6 +567,9 @@ namespace NSCSS
|
||||
m_oValue = new CURL(*static_cast<CURL*>(oColor.m_oValue));
|
||||
break;
|
||||
}
|
||||
case ColorContextStroke:
|
||||
case ColorContextFill:
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -580,6 +589,39 @@ namespace NSCSS
|
||||
: CValue(NULL, 0, false), m_oOpacity(1.), m_enType(ColorEmpty)
|
||||
{}
|
||||
|
||||
CColor::CColor(const CColor& oColor)
|
||||
: CValue(NULL, 0, false), m_oOpacity(oColor.m_oOpacity), m_enType(oColor.m_enType)
|
||||
{
|
||||
switch (m_enType)
|
||||
{
|
||||
case ColorRGB:
|
||||
{
|
||||
TRGB *pRGB = static_cast<TRGB*>(oColor.m_oValue);
|
||||
m_oValue = new TRGB(*pRGB);
|
||||
break;
|
||||
}
|
||||
case ColorHEX:
|
||||
{
|
||||
std::wstring* pValue = static_cast<std::wstring*>(oColor.m_oValue);
|
||||
m_oValue = new std::wstring(*pValue);
|
||||
break;
|
||||
}
|
||||
case ColorUrl:
|
||||
{
|
||||
CURL *pURL = static_cast<CURL*>(oColor.m_oValue);
|
||||
m_oValue = new CURL(*pURL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CColor::~CColor()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void CColor::SetEmpty(unsigned int unLevel)
|
||||
{
|
||||
Clear();
|
||||
@ -875,6 +917,25 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring CColor::ToHEX() const
|
||||
{
|
||||
switch(m_enType)
|
||||
{
|
||||
case ColorRGB:
|
||||
{
|
||||
TRGB* pRGB = static_cast<TRGB*>(m_oValue);
|
||||
return ConvertRGBtoHEX(*pRGB);
|
||||
}
|
||||
case ColorHEX:
|
||||
{
|
||||
std::wstring *pValue = static_cast<std::wstring*>(m_oValue);
|
||||
return *pValue;
|
||||
}
|
||||
default:
|
||||
return std::wstring();
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring CColor::EquateToColor(const std::vector<std::pair<TRGB, std::wstring>> &arColors) const
|
||||
{
|
||||
if (arColors.empty())
|
||||
|
||||
@ -224,6 +224,8 @@ namespace NSCSS
|
||||
{
|
||||
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);
|
||||
@ -240,6 +242,7 @@ namespace NSCSS
|
||||
int ToInt() const override;
|
||||
double ToDouble() const override;
|
||||
std::wstring ToWString() const override;
|
||||
std::wstring ToHEX() const;
|
||||
std::wstring EquateToColor(const std::vector<std::pair<TRGB, std::wstring>>& arColors) const;
|
||||
TRGB ToRGB() const;
|
||||
|
||||
|
||||
@ -316,7 +316,7 @@ namespace NSCSS
|
||||
|
||||
std::wstring wsTextAlign{oStyle.m_oText.GetAlign().ToWString()};
|
||||
|
||||
if (wsTextAlign.empty() && bInTable)
|
||||
if (wsTextAlign.empty())
|
||||
wsTextAlign = oStyle.m_oDisplay.GetHAlign().ToWString();
|
||||
|
||||
oXmlElement.AddPropertiesInP(PProperties::P_Jc, wsTextAlign);
|
||||
@ -485,7 +485,7 @@ namespace NSCSS
|
||||
return;
|
||||
|
||||
if (!oStyle.m_oFont.GetSize().Empty())
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Sz, std::to_wstring(static_cast<int>(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Point) * 2. + 0.5))); // Значения шрифта увеличивает на 2
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Sz, std::to_wstring(static_cast<int>(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Point) * 2. * oStyle.m_oTransform.GetMatrix().GetFinalValue().sy() + 0.5))); // Значения шрифта увеличивает на 2
|
||||
|
||||
if (oStyle.m_oText.GetDecoration().m_oLine.Underline())
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_U, (!oStyle.m_oText.GetDecoration().m_oStyle.Empty()) ? oStyle.m_oText.GetDecoration().m_oStyle.ToWString() : L"single");
|
||||
|
||||
@ -25,3 +25,5 @@ if not base.is_dir("katana-parser"):
|
||||
base.replaceInFileUtf8(base_directory + "/katana-parser/src/tokenizer.c", "static inline bool2 katana_is_html_space(char c);", "static inline bool katana_is_html_space(char c);")
|
||||
base.replaceInFileUtf8(base_directory + "/katana-parser/src/parser.c", "katanaget_text(parser->scanner)", "/*katanaget_text(parser->scanner)*/\"error\"")
|
||||
base.replaceInFileUtf8(base_directory + "/katana-parser/src/parser.c", "#define KATANA_PARSER_STRING(literal) (KatanaParserString){", "#define KATANA_PARSER_STRING(literal) {")
|
||||
# katana may not be able to handle an empty string correctly in some cases (bug#73485)
|
||||
base.replaceInFileUtf8(base_directory + "/katana-parser/src/foundation.c", "size_t len = strlen(str);", "if (NULL == str)\n return;\n size_t len = strlen(str);")
|
||||
|
||||
@ -19,7 +19,6 @@ static std::string nonbreaking_inline = "|a|abbr|acronym|b|bdo|big|cite|code|df
|
||||
static std::string empty_tags = "|area|base|basefont|bgsound|br|command|col|embed|event-source|frame|hr|image|img|input|keygen|link|menuitem|meta|param|source|spacer|track|wbr|";
|
||||
static std::string preserve_whitespace = "|pre|textarea|script|style|";
|
||||
static std::string special_handling = "|html|body|";
|
||||
static std::string no_entity_sub = ""; //"|style|";
|
||||
static std::string treat_like_inline = "|p|";
|
||||
|
||||
static std::vector<std::string> html_tags = {"div","span","a","img","p","h1","h2","h3","h4","h5","h6",
|
||||
@ -436,9 +435,25 @@ static void substitute_xml_entities_into_text(std::string& text)
|
||||
replace_all(text, ">", ">");
|
||||
}
|
||||
|
||||
// After running through Gumbo, the values of type "" are replaced with the corresponding code '0x01'
|
||||
// Since the attribute value does not use control characters (value <= 0x1F),
|
||||
// then just delete them, otherwise XmlUtils::CXmlLiteReader crashes on them.
|
||||
// bug#73486
|
||||
static void remove_control_symbols(std::string& text)
|
||||
{
|
||||
std::string::iterator itFound = std::find_if(text.begin(), text.end(), [](char chValue){ return chValue <= 0x1F; });
|
||||
|
||||
while (itFound != text.end())
|
||||
{
|
||||
itFound = text.erase(itFound);
|
||||
itFound = std::find_if(itFound, text.end(), [](char chValue){ return chValue <= 0x1F; });
|
||||
}
|
||||
}
|
||||
|
||||
// Заменяет сущности " в text
|
||||
static void substitute_xml_entities_into_attributes(std::string& text)
|
||||
{
|
||||
remove_control_symbols(text);
|
||||
substitute_xml_entities_into_text(text);
|
||||
replace_all(text, "\"", """);
|
||||
}
|
||||
@ -486,7 +501,7 @@ static void build_doctype(GumboNode* node, NSStringUtils::CStringBuilderA& oBuil
|
||||
}
|
||||
}
|
||||
|
||||
static void build_attributes(const GumboVector* attribs, bool no_entities, NSStringUtils::CStringBuilderA& atts)
|
||||
static void build_attributes(const GumboVector* attribs, NSStringUtils::CStringBuilderA& atts)
|
||||
{
|
||||
std::vector<std::string> arrRepeat;
|
||||
for (size_t i = 0; i < attribs->length; ++i)
|
||||
@ -532,8 +547,7 @@ static void build_attributes(const GumboVector* attribs, bool no_entities, NSStr
|
||||
std::string qs ="\"";
|
||||
atts.WriteString("=");
|
||||
atts.WriteString(qs);
|
||||
if(!no_entities)
|
||||
substitute_xml_entities_into_attributes(sVal);
|
||||
substitute_xml_entities_into_attributes(sVal);
|
||||
atts.WriteString(sVal);
|
||||
atts.WriteString(qs);
|
||||
}
|
||||
@ -542,7 +556,6 @@ static void build_attributes(const GumboVector* attribs, bool no_entities, NSStr
|
||||
static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA& contents, bool bCheckValidNode)
|
||||
{
|
||||
std::string key = "|" + get_tag_name(node) + "|";
|
||||
bool no_entity_substitution = no_entity_sub.find(key) != std::string::npos;
|
||||
bool keep_whitespace = preserve_whitespace.find(key) != std::string::npos;
|
||||
bool is_inline = nonbreaking_inline.find(key) != std::string::npos;
|
||||
bool is_like_inline = treat_like_inline.find(key) != std::string::npos;
|
||||
@ -556,8 +569,7 @@ static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA
|
||||
if (child->type == GUMBO_NODE_TEXT)
|
||||
{
|
||||
std::string val(child->v.text.text);
|
||||
if(!no_entity_substitution)
|
||||
substitute_xml_entities_into_text(val);
|
||||
substitute_xml_entities_into_text(val);
|
||||
|
||||
// Избавление от FF
|
||||
size_t found = val.find_first_of("\014");
|
||||
@ -613,7 +625,6 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
|
||||
std::string closeTag = "";
|
||||
std::string key = "|" + tagname + "|";
|
||||
bool is_empty_tag = empty_tags.find(key) != std::string::npos;
|
||||
bool no_entity_substitution = no_entity_sub.find(key) != std::string::npos;
|
||||
|
||||
// determine closing tag type
|
||||
if (is_empty_tag)
|
||||
@ -626,7 +637,7 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
|
||||
|
||||
// build attr string
|
||||
const GumboVector* attribs = &node->v.element.attributes;
|
||||
build_attributes(attribs, no_entity_substitution, oBuilder);
|
||||
build_attributes(attribs, oBuilder);
|
||||
oBuilder.WriteString(close + ">");
|
||||
|
||||
// prettyprint your contents
|
||||
|
||||
@ -244,3 +244,4 @@
|
||||
#define AVS_FILEUTILS_ERROR_CONVERT_LIMITS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005d)
|
||||
#define AVS_FILEUTILS_ERROR_CONVERT_ROWLIMITS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005e)
|
||||
#define AVS_FILEUTILS_ERROR_CONVERT_DETECT (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x005f)
|
||||
#define AVS_FILEUTILS_ERROR_CONVERT_CELLLIMITS (AVS_ERROR_FIRST + AVS_FILEUTILS_ERROR_FIRST + 0x0060)
|
||||
|
||||
@ -68,6 +68,7 @@ public:
|
||||
bool isOOXFormatFile(const std::wstring& fileName, bool unpacked = false);
|
||||
bool isOpenOfficeFormatFile(const std::wstring& fileName, std::wstring& documentID);
|
||||
bool isOnlyOfficeFormatFile(const std::wstring& fileName);
|
||||
bool isMacFormatFile(const std::wstring& fileName);
|
||||
|
||||
bool isDocFormatFile(const std::wstring& fileName);
|
||||
bool isXlsFormatFile(const std::wstring& fileName);
|
||||
@ -80,6 +81,7 @@ public:
|
||||
bool isMS_MITCRYPTOFormatFile(POLE::Storage* storage, std::wstring& documentID);
|
||||
bool isVbaProjectFile(POLE::Storage* storage);
|
||||
bool isMS_OFFCRYPTOFormatFile(const std::wstring& fileName, std::wstring& documentID);
|
||||
bool isHwpFile(POLE::Storage* storage);
|
||||
|
||||
bool iXmlFile(const std::wstring& fileName);
|
||||
|
||||
@ -101,6 +103,7 @@ public:
|
||||
bool isBinaryDoctFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isBinaryXlstFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isBinaryPpttFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isBinaryVsdtFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
|
||||
bool isDjvuFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
bool isMobiFormatFile(unsigned char* pBuffer, int dwBytes);
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
|
||||
#include "3dParty/pole/pole.h"
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
#include "OfficeFileFormatDefines.h"
|
||||
|
||||
@ -222,6 +223,16 @@ bool COfficeFileFormatChecker::isBinaryPpttFormatFile(unsigned char *pBuffer, in
|
||||
|
||||
return false;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isBinaryVsdtFormatFile(unsigned char* pBuffer, int dwBytes)
|
||||
{
|
||||
if (pBuffer == NULL)
|
||||
return false;
|
||||
|
||||
if ((4 <= dwBytes) && ('V' == pBuffer[0] && 'S' == pBuffer[1] && 'D' == pBuffer[2] && 'Y' == pBuffer[3]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isPdfFormatFile(unsigned char *pBuffer, int dwBytes, std::wstring &documentID)
|
||||
{
|
||||
if (pBuffer == NULL)
|
||||
@ -451,6 +462,20 @@ bool COfficeFileFormatChecker::isVbaProjectFile(POLE::Storage *storage)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isHwpFile(POLE::Storage* storage)
|
||||
{
|
||||
if (storage == NULL)
|
||||
return false;
|
||||
|
||||
unsigned char buffer[10];
|
||||
|
||||
POLE::Stream stream(storage, L"BodyText/Section0");
|
||||
if (stream.read(buffer, 10) < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isXlsFormatFile(POLE::Storage *storage)
|
||||
{
|
||||
if (storage == NULL)
|
||||
@ -721,6 +746,11 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_VBAPROJECT;
|
||||
return true;
|
||||
}
|
||||
else if (isHwpFile(&storage))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
NSFile::CFileBinary file;
|
||||
if (!file.OpenFile(fileName))
|
||||
@ -740,13 +770,40 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
if (OfficeUtils.IsArchive(fileName) == S_OK && (false == isPdfFormatFile(bufferDetect, dwDetectdBytes, sDocumentID)))
|
||||
{
|
||||
if (isOOXFormatFile(fileName))
|
||||
{
|
||||
if (bufferDetect)
|
||||
delete[] bufferDetect;
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
else if (isOpenOfficeFormatFile(fileName, sDocumentID))
|
||||
return true;
|
||||
{
|
||||
if (bufferDetect)
|
||||
delete[] bufferDetect;
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
else if (isOnlyOfficeFormatFile(fileName))
|
||||
return true;
|
||||
{
|
||||
if (bufferDetect)
|
||||
delete[] bufferDetect;
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
else if (isXpsFile(fileName))
|
||||
{
|
||||
if (bufferDetect)
|
||||
delete[] bufferDetect;
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
else if (isMacFormatFile(fileName))
|
||||
{
|
||||
if (bufferDetect)
|
||||
delete[] bufferDetect;
|
||||
bufferDetect = NULL;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
@ -770,6 +827,10 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
|
||||
}
|
||||
else if (isBinaryVsdtFormatFile(bufferDetect, sizeRead)) // min size - 4
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_DRAW;
|
||||
}
|
||||
else if (isOOXFlatFormatFile(bufferDetect, sizeRead))
|
||||
{
|
||||
// nFileType;
|
||||
@ -879,6 +940,16 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY;
|
||||
else if (0 == sExt.compare(L".txt") || 0 == sExt.compare(L".xml") || 0 == sExt.compare(L".rtf") || 0 == sExt.compare(L".doc") || 0 == sExt.compare(L".docx") || 0 == sExt.compare(L".md"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT;
|
||||
else if (0 == sExt.compare(L".pages"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
|
||||
else if (0 == sExt.compare(L".numbers"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
|
||||
else if (0 == sExt.compare(L".key"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
|
||||
else if (0 == sExt.compare(L".hwp"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
|
||||
else if (0 == sExt.compare(L".hwpx"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX;
|
||||
|
||||
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN)
|
||||
return true;
|
||||
@ -1094,6 +1165,10 @@ bool COfficeFileFormatChecker::isOnlyOfficeFormatFile(const std::wstring &fileNa
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY;
|
||||
}
|
||||
else if (isBinaryVsdtFormatFile(pBuffer, nBufferSize))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY;
|
||||
}
|
||||
|
||||
delete[] pBuffer;
|
||||
pBuffer = NULL;
|
||||
@ -1103,6 +1178,222 @@ bool COfficeFileFormatChecker::isOnlyOfficeFormatFile(const std::wstring &fileNa
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
struct TIWAField
|
||||
{
|
||||
size_t m_unStart;
|
||||
size_t m_unEnd;
|
||||
unsigned m_uIndex;
|
||||
unsigned m_unWireType;
|
||||
uint64_t m_oValue;
|
||||
};
|
||||
|
||||
bool ReadUVar(BYTE* pBuffer, size_t unEndPos, size_t& unPos, uint64_t& unValue)
|
||||
{
|
||||
std::vector<unsigned char> arBytes;
|
||||
arBytes.reserve(8);
|
||||
|
||||
unValue = 0;
|
||||
|
||||
bool bNext = true;
|
||||
while (unPos < unEndPos && bNext)
|
||||
{
|
||||
const unsigned char c = pBuffer[unPos++];
|
||||
arBytes.push_back((unsigned char)(c & ~0x80));
|
||||
bNext = c & 0x80;
|
||||
}
|
||||
|
||||
if (bNext && unPos == unEndPos)
|
||||
return false;
|
||||
|
||||
for (std::vector<unsigned char>::const_reverse_iterator it = arBytes.rbegin(); it != arBytes.rend(); ++it)
|
||||
{
|
||||
if (std::numeric_limits<uint64_t>::max() >> 7 < unValue ||
|
||||
std::numeric_limits<uint64_t>::max() - (unValue << 7) < *it) // overflow
|
||||
return false;
|
||||
|
||||
unValue = (unValue << 7) + *it;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadIWAField(BYTE* pBuffer, size_t unEndPos, size_t& unPos, TIWAField& oIWAField)
|
||||
{
|
||||
if (NULL == pBuffer || unPos + 2 > unEndPos)
|
||||
return false;
|
||||
|
||||
unsigned uSpec;
|
||||
|
||||
uSpec = (unsigned)pBuffer[unPos++];
|
||||
oIWAField.m_unWireType = uSpec & 0x7;
|
||||
|
||||
oIWAField.m_unStart = unPos;
|
||||
|
||||
switch (oIWAField.m_unWireType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (!ReadUVar(pBuffer, unEndPos, unPos, oIWAField.m_oValue))
|
||||
return false;
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
unPos += 4;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
uint64_t unLen;
|
||||
if (!ReadUVar(pBuffer, unEndPos, unPos, unLen) || unPos + unLen > unEndPos)
|
||||
return false;
|
||||
|
||||
oIWAField.m_unStart = unPos;
|
||||
unPos += unLen;
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
unPos += 2;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
oIWAField.m_unEnd = unPos;
|
||||
oIWAField.m_uIndex = uSpec >> 3;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DetectIWorkFormat(const std::wstring& fileName, int &nType)
|
||||
{
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
|
||||
ULONG unSize = 0;
|
||||
BYTE* pBuffer = NULL;
|
||||
|
||||
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"Index/Document.iwa", &pBuffer, unSize);
|
||||
|
||||
if (hresult != S_OK || NULL == pBuffer)
|
||||
return false;
|
||||
|
||||
#define CLEAR_BUFFER_AND_RETURN(return_value)\
|
||||
do{\
|
||||
delete[] pBuffer;\
|
||||
return return_value;\
|
||||
}while(false)
|
||||
|
||||
if (unSize < 13)
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
|
||||
size_t uPos = 6;
|
||||
|
||||
for (; uPos < 12; ++uPos)
|
||||
{
|
||||
if (0x08 == pBuffer[uPos] && 0x01 == pBuffer[uPos + 1])
|
||||
{
|
||||
--uPos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (12 == uPos)
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
|
||||
uint64_t unHeaderLen;
|
||||
if (!ReadUVar(pBuffer, unSize, uPos, unHeaderLen))
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
|
||||
const size_t uStartPos = uPos;
|
||||
|
||||
if (unHeaderLen < 8 || unSize < unHeaderLen + uStartPos)
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
|
||||
uPos += 2;
|
||||
|
||||
TIWAField oMessageField;
|
||||
|
||||
if (!ReadIWAField(pBuffer, uStartPos + unHeaderLen, uPos, oMessageField) || 2 != oMessageField.m_unWireType ||
|
||||
2 != oMessageField.m_uIndex)
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
|
||||
size_t uSubPos = oMessageField.m_unStart;
|
||||
TIWAField oField;
|
||||
|
||||
if (!ReadIWAField(pBuffer, oMessageField.m_unEnd, uSubPos, oField) || 0 != oField.m_unWireType ||
|
||||
1 != oField.m_uIndex)
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
|
||||
switch (oField.m_oValue)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
uint32_t unDataLen = 0;
|
||||
|
||||
TIWAField oTempField;
|
||||
if (ReadIWAField(pBuffer, oMessageField.m_unEnd, uSubPos, oTempField) &&
|
||||
ReadIWAField(pBuffer, oMessageField.m_unEnd, uSubPos, oTempField) && 0 == oTempField.m_unWireType &&
|
||||
3 == oTempField.m_uIndex)
|
||||
unDataLen += oTempField.m_oValue;
|
||||
|
||||
size_t unTempPos = uStartPos + unHeaderLen;
|
||||
|
||||
// keynote: presentation ref in 2
|
||||
// number: sheet ref in 1
|
||||
if (ReadIWAField(pBuffer, uStartPos + unDataLen, unTempPos, oTempField) &&
|
||||
(2 != oTempField.m_unWireType || 1 != oTempField.m_uIndex || oTempField.m_unEnd - oTempField.m_unStart < 2))
|
||||
{
|
||||
nType = AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
|
||||
CLEAR_BUFFER_AND_RETURN(true);
|
||||
}
|
||||
else if (ReadIWAField(pBuffer, uStartPos + unDataLen, unTempPos, oTempField) &&
|
||||
(2 != oTempField.m_unWireType || 2 != oTempField.m_uIndex || oTempField.m_unEnd - oTempField.m_unStart < 2))
|
||||
{
|
||||
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
|
||||
CLEAR_BUFFER_AND_RETURN(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 10000:
|
||||
{
|
||||
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
|
||||
CLEAR_BUFFER_AND_RETURN(true);
|
||||
}
|
||||
}
|
||||
|
||||
CLEAR_BUFFER_AND_RETURN(false);
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isMacFormatFile(const std::wstring& fileName)
|
||||
{
|
||||
if (DetectIWorkFormat(fileName, nFileType))
|
||||
return true;
|
||||
|
||||
std::wstring::size_type nExtPos = fileName.rfind(L'.');
|
||||
std::wstring sExt = L"unknown";
|
||||
|
||||
if (nExtPos != std::wstring::npos)
|
||||
sExt = fileName.substr(nExtPos);
|
||||
|
||||
std::transform(sExt.begin(), sExt.end(), sExt.begin(), tolower);
|
||||
|
||||
if (0 == sExt.compare(L".pages"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
|
||||
else if (0 == sExt.compare(L".numbers"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
|
||||
else if (0 == sExt.compare(L".key"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring &fileName, std::wstring &documentID)
|
||||
{
|
||||
documentID.clear();
|
||||
@ -1345,6 +1636,7 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM:
|
||||
return L".dotm";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT:
|
||||
return L".doc";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT:
|
||||
return L".odt";
|
||||
@ -1387,6 +1679,8 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".fodp";
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP:
|
||||
return L".otp";
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG:
|
||||
return L".odg";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
|
||||
return L".xlsx";
|
||||
@ -1459,12 +1753,15 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_WORD:
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET:
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION:
|
||||
case AVS_OFFICESTUDIO_FILE_CANVAS_DRAW:
|
||||
return L".bin";
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT:
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
|
||||
return L".doct";
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY:
|
||||
return L".xlst";
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY:
|
||||
return L".vsdt";
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION:
|
||||
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING:
|
||||
case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY:
|
||||
@ -1553,6 +1850,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT;
|
||||
if (L".otp" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP;
|
||||
if (L".odg" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG;
|
||||
|
||||
if (L".xlsx" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
|
||||
@ -1626,6 +1925,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY;
|
||||
if (L".pptt" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY;
|
||||
if (L".vsdt" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY;
|
||||
|
||||
if (L".vsdx" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DRAW_VSDX;
|
||||
|
||||
@ -56,6 +56,9 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0015
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0016
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0017
|
||||
#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 + 0x0020
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_XML AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0030
|
||||
|
||||
@ -72,6 +75,7 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x000a
|
||||
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX_PACKAGE AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x000b
|
||||
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x000c
|
||||
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x000d
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET 0x0100
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001
|
||||
@ -87,6 +91,7 @@
|
||||
#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_CROSSPLATFORM 0x0200
|
||||
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001
|
||||
@ -133,12 +138,14 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0002
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0003
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0004
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_CANVAS 0x2000
|
||||
#define AVS_OFFICESTUDIO_FILE_CANVAS_WORD AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001
|
||||
#define AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002
|
||||
#define AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003
|
||||
#define AVS_OFFICESTUDIO_FILE_CANVAS_PDF AVS_OFFICESTUDIO_FILE_CANVAS + 0x0004
|
||||
#define AVS_OFFICESTUDIO_FILE_CANVAS_DRAW AVS_OFFICESTUDIO_FILE_CANVAS + 0x0005
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW 0x4000
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW_VSDX AVS_OFFICESTUDIO_FILE_DRAW + 0x0001
|
||||
@ -146,4 +153,4 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW_VSTX AVS_OFFICESTUDIO_FILE_DRAW + 0x0003
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW_VSDM AVS_OFFICESTUDIO_FILE_DRAW + 0x0004
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW_VSSM AVS_OFFICESTUDIO_FILE_DRAW + 0x0005
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW_VSTM AVS_OFFICESTUDIO_FILE_DRAW + 0x0006
|
||||
#define AVS_OFFICESTUDIO_FILE_DRAW_VSTM AVS_OFFICESTUDIO_FILE_DRAW + 0x0006
|
||||
@ -4,6 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#define LOG_BUFFER_SIZE 1000
|
||||
|
||||
// not intended for use in production. only for testing/debugging purposes
|
||||
namespace Logging
|
||||
{
|
||||
void logBytes(char* name, unsigned char* str, int len)
|
||||
|
||||
@ -207,9 +207,9 @@ namespace agg
|
||||
}
|
||||
|
||||
p[Order::A] = (value_type)((alpha + a) - ((alpha * a + base_mask) >> base_shift));
|
||||
p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
if (r != cr) p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
if (g != cg) p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
if (b != cb) p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
}
|
||||
|
||||
static AGG_INLINE void blend_pix_subpix(value_type* p,
|
||||
|
||||
@ -332,6 +332,7 @@
|
||||
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
|
||||
*/
|
||||
# include <float.h>
|
||||
# include <math.h>
|
||||
|
||||
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
|
||||
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
|
||||
|
||||
61
DesktopEditor/doctrenderer/addon/docbuilder_addon.h
Normal file
61
DesktopEditor/doctrenderer/addon/docbuilder_addon.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef DOC_BUILDER_ADDON_PRIVATE
|
||||
#define DOC_BUILDER_ADDON_PRIVATE
|
||||
|
||||
#include <string>
|
||||
#include "../docbuilder.h"
|
||||
|
||||
namespace NSDoctRenderer
|
||||
{
|
||||
class CDocBuilderAddon
|
||||
{
|
||||
private:
|
||||
std::wstring m_sWorkDirectory;
|
||||
public:
|
||||
CDocBuilderAddon(const std::wstring& sWorkDir)
|
||||
{
|
||||
m_sWorkDirectory = sWorkDir;
|
||||
}
|
||||
public:
|
||||
std::wstring GetX2tSaveAddon(NSDoctRenderer::CDocBuilder* builder, const int& filetype)
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
int GetX2tPreSaveError(NSDoctRenderer::CDocBuilder* builder, const int& filetype)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // DOC_BUILDER_ADDON_PRIVATE
|
||||
@ -33,6 +33,7 @@
|
||||
#include "./../common_deploy.h"
|
||||
#include "../docbuilder.h"
|
||||
#include "../../common/File.h"
|
||||
#include "../../common/SystemUtils.h"
|
||||
|
||||
#ifdef LINUX
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
@ -78,6 +79,15 @@ void parse_args(NSDoctRenderer::CDocBuilder* builder, int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckLicense(const std::wstring& sSrc, const std::wstring& sDst)
|
||||
{
|
||||
if (sDst.empty())
|
||||
return false;
|
||||
NSFile::CFileBinary::Remove(sDst);
|
||||
NSFile::CFileBinary::Copy(sSrc, sDst);
|
||||
return NSFile::CFileBinary::Exists(sDst);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
int wmain(int argc, wchar_t *argv[])
|
||||
#else
|
||||
@ -89,6 +99,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
bool bIsHelp = false;
|
||||
bool bIsFonts = false;
|
||||
bool bIsLicense = false;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
#ifdef WIN32
|
||||
@ -121,6 +132,33 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
bIsFonts = true;
|
||||
}
|
||||
else if (sParam == "-register")
|
||||
{
|
||||
bIsLicense = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsLicense)
|
||||
{
|
||||
std::wstring sLicensePathSrc = UTF8_TO_U(sParam);
|
||||
if (!NSFile::CFileBinary::Exists(sLicensePathSrc))
|
||||
return 1;
|
||||
|
||||
std::wstring sLicensePath = NSSystemUtils::GetEnvVariable(L"ONLYOFFICE_BUILDER_LICENSE");
|
||||
if (CheckLicense(sLicensePathSrc, sLicensePath))
|
||||
return 0;
|
||||
|
||||
sLicensePath = NSFile::GetProcessDirectory() + L"/license.xml";
|
||||
if (CheckLicense(sLicensePathSrc, sLicensePath))
|
||||
return 0;
|
||||
|
||||
sLicensePath = NSSystemUtils::GetAppDataDir() + L"/docbuilder/license.xml";
|
||||
if (CheckLicense(sLicensePathSrc, sLicensePath))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsFonts)
|
||||
|
||||
@ -38,6 +38,9 @@
|
||||
#include "../xml/include/xmlutils.h"
|
||||
#include "../fontengine/TextHyphen.h"
|
||||
|
||||
#define VALUE_TO_STRING(x) #x
|
||||
#define VALUE(x) VALUE_TO_STRING(x)
|
||||
|
||||
namespace NSDoctRenderer
|
||||
{
|
||||
class CAdditionalData
|
||||
@ -188,7 +191,7 @@ namespace NSDoctRenderer
|
||||
m_strSdkPath = oNode.ReadNodeText(L"sdkjs");
|
||||
if (!m_strSdkPath.empty())
|
||||
{
|
||||
if (!NSDirectory::Exists(m_strSdkPath))
|
||||
if (0 == m_strSdkPath.find(L"./") || !NSDirectory::Exists(m_strSdkPath))
|
||||
m_strSdkPath = sConfigDir + m_strSdkPath;
|
||||
}
|
||||
|
||||
@ -203,28 +206,14 @@ namespace NSDoctRenderer
|
||||
|
||||
char* GetVersion()
|
||||
{
|
||||
std::wstring sFile = m_strSdkPath + L"/word/sdk-all-min.js";
|
||||
std::string sVersion = VALUE(INTVER);
|
||||
|
||||
std::string sData;
|
||||
if (!NSFile::CFileBinary::ReadAllTextUtf8A(sFile, sData))
|
||||
return NULL;
|
||||
|
||||
std::string::size_type startPos = sData.find("Version:");
|
||||
if (std::string::npos == startPos)
|
||||
return NULL;
|
||||
|
||||
startPos += 8;
|
||||
|
||||
std::string::size_type endPos = sData.find(')', startPos);
|
||||
if (std::string::npos == endPos)
|
||||
return NULL;
|
||||
|
||||
size_t sSrcLen = endPos - startPos + 1;
|
||||
size_t sSrcLen = sVersion.size();
|
||||
if (sSrcLen == 0)
|
||||
return NULL;
|
||||
|
||||
char* sRet = new char[sSrcLen + 1];
|
||||
memcpy(sRet, sData.c_str() + startPos, sSrcLen);
|
||||
memcpy(sRet, sVersion.c_str(), sSrcLen);
|
||||
sRet[sSrcLen] = '\0';
|
||||
return sRet;
|
||||
}
|
||||
|
||||
@ -47,14 +47,6 @@ namespace NSDoctRenderer
|
||||
RELEASEOBJECT(m_pInternal);
|
||||
}
|
||||
|
||||
int CDocBuilder::OpenFile(const wchar_t* path, const wchar_t* params)
|
||||
{
|
||||
m_pInternal->m_nFileType = -1;
|
||||
if (!NSDirectory::Exists(m_pInternal->m_sTmpFolder))
|
||||
NSDirectory::CreateDirectory(m_pInternal->m_sTmpFolder);
|
||||
|
||||
return m_pInternal->OpenFile(path, params);
|
||||
}
|
||||
int CDocBuilder::SaveFile(const int& type, const wchar_t* path, const wchar_t* params)
|
||||
{
|
||||
return m_pInternal->SaveFile(type, path, params);
|
||||
@ -65,7 +57,7 @@ namespace NSDoctRenderer
|
||||
}
|
||||
bool CDocBuilder::ExecuteCommand(const wchar_t* command, CDocBuilderValue* retValue)
|
||||
{
|
||||
return m_pInternal->ExecuteCommand(command, retValue);
|
||||
return m_pInternal->ExecuteCommand(command, retValue, false, false);
|
||||
}
|
||||
|
||||
CDocBuilderContext CDocBuilder::GetContext(bool enterContext)
|
||||
|
||||
@ -475,6 +475,13 @@ namespace NSDoctRenderer
|
||||
*/
|
||||
void SetPropertyW(const wchar_t* param, const wchar_t* value);
|
||||
|
||||
/**
|
||||
* GetProperty method.
|
||||
* @param param The parameter name in the Unicode format, the value is always --argument.
|
||||
* @return int value for property
|
||||
*/
|
||||
int GetPropertyInt(const wchar_t* param);
|
||||
|
||||
/**
|
||||
* Writes data to the log file. It is used for logs in JS code.
|
||||
* @param path The path to the file where all the logs will be written.
|
||||
@ -526,6 +533,7 @@ namespace NSDoctRenderer
|
||||
CDocBuilder_Private* m_pInternal;
|
||||
|
||||
friend class CBuilderDocumentEmbed;
|
||||
friend class CBuilderEmbed;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -16,18 +16,18 @@ static std::wstring wstringFromJavaString(JNIEnv* env, jstring jstr)
|
||||
return wstr;
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilder_c_1Create(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilder_c_1Create(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilder());
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
delete pSelf;
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilder_c_1OpenFile(JNIEnv* env, jclass cls, jlong self, jstring path, jstring params)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1OpenFile(JNIEnv* env, jclass cls, jlong self, jstring path, jstring params)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strPath = wstringFromJavaString(env, path);
|
||||
@ -35,34 +35,34 @@ jint Java_docbuilder_CDocBuilder_c_1OpenFile(JNIEnv* env, jclass cls, jlong self
|
||||
return (jint)pSelf->OpenFile(strPath.c_str(), strParams.c_str());
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1CreateFileByType(JNIEnv* env, jclass cls, jlong self, jint type)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1CreateFileByType(JNIEnv* env, jclass cls, jlong self, jint type)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
return (jboolean)pSelf->CreateFile((int)type);
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1CreateFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1CreateFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strExtension = wstringFromJavaString(env, extension);
|
||||
return (jboolean)pSelf->CreateFile(strExtension.c_str());
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1SetTmpFolder(JNIEnv* env, jclass cls, jlong self, jstring folder)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1SetTmpFolder(JNIEnv* env, jclass cls, jlong self, jstring folder)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strFolder = wstringFromJavaString(env, folder);
|
||||
pSelf->SetTmpFolder(strFolder.c_str());
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilder_c_1SaveFileByType(JNIEnv* env, jclass cls, jlong self, jint type, jstring path)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByType(JNIEnv* env, jclass cls, jlong self, jint type, jstring path)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strPath = wstringFromJavaString(env, path);
|
||||
return (jint)pSelf->SaveFile((int)type, strPath.c_str());
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilder_c_1SaveFileByTypeWithParams(JNIEnv* env, jclass cls, jlong self, jint type, jstring path, jstring params)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByTypeWithParams(JNIEnv* env, jclass cls, jlong self, jint type, jstring path, jstring params)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strPath = wstringFromJavaString(env, path);
|
||||
@ -70,7 +70,7 @@ jint Java_docbuilder_CDocBuilder_c_1SaveFileByTypeWithParams(JNIEnv* env, jclass
|
||||
return (jint)pSelf->SaveFile((int)type, strPath.c_str(), strParams.c_str());
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strExtension = wstringFromJavaString(env, extension);
|
||||
@ -78,7 +78,7 @@ jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtension(JNIEnv* env, jclass cls,
|
||||
return (jint)pSelf->SaveFile(strExtension.c_str(), strPath.c_str());
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtensionWithParams(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path, jstring params)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByExtensionWithParams(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path, jstring params)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strExtension = wstringFromJavaString(env, extension);
|
||||
@ -87,20 +87,20 @@ jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtensionWithParams(JNIEnv* env, j
|
||||
return (jint)pSelf->SaveFile(strExtension.c_str(), strPath.c_str(), strParams.c_str());
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1CloseFile(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1CloseFile(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
pSelf->CloseFile();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1ExecuteCommand(JNIEnv* env, jclass cls, jlong self, jstring command)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1ExecuteCommand(JNIEnv* env, jclass cls, jlong self, jstring command)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strCommand = wstringFromJavaString(env, command);
|
||||
return (jboolean)pSelf->ExecuteCommand(strCommand.c_str());
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1ExecuteCommandWithRetValue(JNIEnv* env, jclass cls, jlong self, jstring command, jlong retValue)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1ExecuteCommandWithRetValue(JNIEnv* env, jclass cls, jlong self, jstring command, jlong retValue)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strCommand = wstringFromJavaString(env, command);
|
||||
@ -108,14 +108,14 @@ jboolean Java_docbuilder_CDocBuilder_c_1ExecuteCommandWithRetValue(JNIEnv* env,
|
||||
return (jboolean)pSelf->ExecuteCommand(strCommand.c_str(), pRetValue);
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1Run(JNIEnv* env, jclass cls, jlong self, jstring path)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1Run(JNIEnv* env, jclass cls, jlong self, jstring path)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strPath = wstringFromJavaString(env, path);
|
||||
return (jboolean)pSelf->Run(strPath.c_str());
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1RunText(JNIEnv* env, jclass cls, jlong self, jstring commands)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1RunText(JNIEnv* env, jclass cls, jlong self, jstring commands)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
const char* strUtfCommands = env->GetStringUTFChars(commands, nullptr);
|
||||
@ -124,7 +124,7 @@ jboolean Java_docbuilder_CDocBuilder_c_1RunText(JNIEnv* env, jclass cls, jlong s
|
||||
return result;
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring param, jstring value)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring param, jstring value)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
const char* strUtfParam = env->GetStringUTFChars(param, nullptr);
|
||||
@ -133,7 +133,7 @@ void Java_docbuilder_CDocBuilder_c_1SetProperty(JNIEnv* env, jclass cls, jlong s
|
||||
env->ReleaseStringUTFChars(param, strUtfParam);
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1WriteData(JNIEnv* env, jclass cls, jlong self, jstring path, jstring data, jboolean append)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1WriteData(JNIEnv* env, jclass cls, jlong self, jstring path, jstring data, jboolean append)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
std::wstring strPath = wstringFromJavaString(env, path);
|
||||
@ -141,13 +141,13 @@ void Java_docbuilder_CDocBuilder_c_1WriteData(JNIEnv* env, jclass cls, jlong sel
|
||||
pSelf->WriteData(strPath.c_str(), strData.c_str(), (bool)append);
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilder_c_1IsSaveWithDoctrendererMode(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1IsSaveWithDoctrendererMode(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
return (jboolean)pSelf->IsSaveWithDoctrendererMode();
|
||||
}
|
||||
|
||||
jstring Java_docbuilder_CDocBuilder_c_1GetVersion(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jstring JNICALL Java_docbuilder_CDocBuilder_c_1GetVersion(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
char* strUtfVersion = pSelf->GetVersion();
|
||||
@ -156,30 +156,30 @@ jstring Java_docbuilder_CDocBuilder_c_1GetVersion(JNIEnv* env, jclass cls, jlong
|
||||
return jstrVersion;
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilder_c_1GetContext(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilder_c_1GetContext(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContext(pSelf->GetContext()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilder_c_1GetContextWithEnterParam(JNIEnv* env, jclass cls, jlong self, jboolean enterContext)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilder_c_1GetContextWithEnterParam(JNIEnv* env, jclass cls, jlong self, jboolean enterContext)
|
||||
{
|
||||
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContext(pSelf->GetContext((bool)enterContext)));
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1Initialize(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1Initialize(JNIEnv* env, jclass cls)
|
||||
{
|
||||
CDocBuilder::Initialize();
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1InitializeWithDirectory(JNIEnv* env, jclass cls, jstring directory)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1InitializeWithDirectory(JNIEnv* env, jclass cls, jstring directory)
|
||||
{
|
||||
std::wstring strDirectory = wstringFromJavaString(env, directory);
|
||||
CDocBuilder::Initialize(strDirectory.c_str());
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilder_c_1Dispose(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1Dispose(JNIEnv* env, jclass cls)
|
||||
{
|
||||
CDocBuilder::Dispose();
|
||||
}
|
||||
|
||||
@ -4,60 +4,60 @@
|
||||
|
||||
using namespace NSDoctRenderer;
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1Create(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1Create(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContext());
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1Copy(JNIEnv* env, jclass cls, jlong other)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1Copy(JNIEnv* env, jclass cls, jlong other)
|
||||
{
|
||||
CDocBuilderContext* pOther = reinterpret_cast<CDocBuilderContext*>(other);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContext(*pOther));
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderContext_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderContext_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
delete pSelf;
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1CreateUndefined(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateUndefined(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateUndefined()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1CreateNull(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateNull(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateNull()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1CreateObject(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateObject(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateObject()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1CreateArray(JNIEnv* env, jclass cls, jlong self, jint length)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateArray(JNIEnv* env, jclass cls, jlong self, jint length)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateArray((int)length)));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1GetGlobal(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1GetGlobal(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->GetGlobal()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContext_c_1CreateScope(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateScope(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContextScope(pSelf->CreateScope()));
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderContext_c_1IsError(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderContext_c_1IsError(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
|
||||
return (jboolean)pSelf->IsError();
|
||||
|
||||
@ -4,24 +4,24 @@
|
||||
|
||||
using namespace NSDoctRenderer;
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContextScope_c_1Create(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Create(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContextScope());
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderContextScope_c_1Copy(JNIEnv* env, jclass cls, jlong other)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Copy(JNIEnv* env, jclass cls, jlong other)
|
||||
{
|
||||
CDocBuilderContextScope* pOther = reinterpret_cast<CDocBuilderContextScope*>(other);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderContextScope(*pOther));
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderContextScope_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContextScope* pSelf = reinterpret_cast<CDocBuilderContextScope*>(self);
|
||||
delete pSelf;
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderContextScope_c_1Close(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Close(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderContextScope* pSelf = reinterpret_cast<CDocBuilderContextScope*>(self);
|
||||
pSelf->Close();
|
||||
|
||||
@ -8,114 +8,114 @@
|
||||
|
||||
using namespace NSDoctRenderer;
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Create(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Create(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue());
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Copy(JNIEnv* env, jclass cls, jlong other)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Copy(JNIEnv* env, jclass cls, jlong other)
|
||||
{
|
||||
CDocBuilderValue* pOther = reinterpret_cast<CDocBuilderValue*>(other);
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(*pOther));
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderValue_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
delete pSelf;
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsEmpty(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsEmpty(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsEmpty();
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderValue_c_1Clear(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1Clear(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
pSelf->Clear();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsNull(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsNull(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsNull();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsUndefined(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsUndefined(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsUndefined();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsBool(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsBool(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsBool();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsInt(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsInt(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsInt();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsDouble(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsDouble(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsDouble();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsString(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsString(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsString();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsFunction(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsFunction(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsFunction();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsObject(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsObject(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsObject();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1IsArray(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsArray(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->IsArray();
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilderValue_c_1GetLength(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilderValue_c_1GetLength(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jint)pSelf->GetLength();
|
||||
}
|
||||
|
||||
jboolean Java_docbuilder_CDocBuilderValue_c_1ToBool(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1ToBool(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jboolean)pSelf->ToBool();
|
||||
}
|
||||
|
||||
jint Java_docbuilder_CDocBuilderValue_c_1ToInt(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilderValue_c_1ToInt(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jint)pSelf->ToInt();
|
||||
}
|
||||
|
||||
jdouble Java_docbuilder_CDocBuilderValue_c_1ToDouble(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jdouble JNICALL Java_docbuilder_CDocBuilderValue_c_1ToDouble(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
return (jdouble)pSelf->ToDouble();
|
||||
}
|
||||
|
||||
jstring Java_docbuilder_CDocBuilderValue_c_1ToString(JNIEnv* env, jclass cls, jlong self)
|
||||
JNIEXPORT jstring JNICALL Java_docbuilder_CDocBuilderValue_c_1ToString(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CString strValue = pSelf->ToString();
|
||||
@ -123,7 +123,7 @@ jstring Java_docbuilder_CDocBuilderValue_c_1ToString(JNIEnv* env, jclass cls, jl
|
||||
return env->NewStringUTF(strUtfData.c_str());
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1GetProperty(JNIEnv* env, jclass cls, jlong self, jstring name)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1GetProperty(JNIEnv* env, jclass cls, jlong self, jstring name)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
const char* strUtfName = env->GetStringUTFChars(name, nullptr);
|
||||
@ -132,14 +132,14 @@ jlong Java_docbuilder_CDocBuilderValue_c_1GetProperty(JNIEnv* env, jclass cls, j
|
||||
return reinterpret_cast<jlong>(pValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1GetByIndex(JNIEnv* env, jclass cls, jlong self, jint index)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1GetByIndex(JNIEnv* env, jclass cls, jlong self, jint index)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pValue = new CDocBuilderValue(pSelf->Get((int)index));
|
||||
return reinterpret_cast<jlong>(pValue);
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderValue_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring name, jlong value)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring name, jlong value)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pValue = reinterpret_cast<CDocBuilderValue*>(value);
|
||||
@ -149,29 +149,29 @@ void Java_docbuilder_CDocBuilderValue_c_1SetProperty(JNIEnv* env, jclass cls, jl
|
||||
env->ReleaseStringUTFChars(name, strUtfName);
|
||||
}
|
||||
|
||||
void Java_docbuilder_CDocBuilderValue_c_1SetByIndex(JNIEnv* env, jclass cls, jlong self, jint index, jlong value)
|
||||
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1SetByIndex(JNIEnv* env, jclass cls, jlong self, jint index, jlong value)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pValue = reinterpret_cast<CDocBuilderValue*>(value);
|
||||
pSelf->Set((int)index, *pValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithBool(JNIEnv* env, jclass cls, jboolean value)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithBool(JNIEnv* env, jclass cls, jboolean value)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue((bool)value));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithInt(JNIEnv* env, jclass cls, jint value)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithInt(JNIEnv* env, jclass cls, jint value)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue((int)value));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithDouble(JNIEnv* env, jclass cls, jdouble value)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithDouble(JNIEnv* env, jclass cls, jdouble value)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue((double)value));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithString(JNIEnv* env, jclass cls, jstring str)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithString(JNIEnv* env, jclass cls, jstring str)
|
||||
{
|
||||
const char* strUtf = env->GetStringUTFChars(str, nullptr);
|
||||
CDocBuilderValue* pValue = new CDocBuilderValue(strUtf);
|
||||
@ -179,22 +179,22 @@ jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithString(JNIEnv* env, jclass c
|
||||
return reinterpret_cast<jlong>(pValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateUndefined(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateUndefined(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(CDocBuilderValue::CreateUndefined()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateNull(JNIEnv* env, jclass cls)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateNull(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(CDocBuilderValue::CreateNull()));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1CreateArray(JNIEnv* env, jclass cls, jint length)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateArray(JNIEnv* env, jclass cls, jint length)
|
||||
{
|
||||
return reinterpret_cast<jlong>(new CDocBuilderValue(CDocBuilderValue::CreateArray((int)length)));
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call0(JNIEnv* env, jclass cls, jlong self, jstring name)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call0(JNIEnv* env, jclass cls, jlong self, jstring name)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
const char* strUtfName = env->GetStringUTFChars(name, nullptr);
|
||||
@ -203,7 +203,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call0(JNIEnv* env, jclass cls, jlong s
|
||||
return reinterpret_cast<jlong>(pReturnValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call1(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call1(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
|
||||
@ -213,7 +213,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call1(JNIEnv* env, jclass cls, jlong s
|
||||
return reinterpret_cast<jlong>(pReturnValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call2(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call2(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
|
||||
@ -224,7 +224,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call2(JNIEnv* env, jclass cls, jlong s
|
||||
return reinterpret_cast<jlong>(pReturnValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call3(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call3(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
|
||||
@ -236,7 +236,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call3(JNIEnv* env, jclass cls, jlong s
|
||||
return reinterpret_cast<jlong>(pReturnValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call4(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call4(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
|
||||
@ -249,7 +249,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call4(JNIEnv* env, jclass cls, jlong s
|
||||
return reinterpret_cast<jlong>(pReturnValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call5(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call5(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
|
||||
@ -263,7 +263,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call5(JNIEnv* env, jclass cls, jlong s
|
||||
return reinterpret_cast<jlong>(pReturnValue);
|
||||
}
|
||||
|
||||
jlong Java_docbuilder_CDocBuilderValue_c_1Call6(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5, jlong p6)
|
||||
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call6(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5, jlong p6)
|
||||
{
|
||||
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
|
||||
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
|
||||
|
||||
@ -2,6 +2,7 @@ import ctypes
|
||||
import os
|
||||
import platform
|
||||
import atexit
|
||||
import subprocess
|
||||
|
||||
OBJECT_HANDLE = ctypes.c_void_p
|
||||
STRING_HANDLE = ctypes.c_void_p
|
||||
@ -608,8 +609,17 @@ class FileTypes:
|
||||
PNG = _IMAGE_MASK + 0x0005
|
||||
BMP = _IMAGE_MASK + 0x0008
|
||||
|
||||
# NOTE: do not change builder_path manually!
|
||||
builder_path = os.path.dirname(os.path.realpath(__file__))
|
||||
_loadLibrary(builder_path)
|
||||
CDocBuilder.Initialize(builder_path)
|
||||
|
||||
def registerLibrary(license_path):
|
||||
docbuilder_bin = os.path.join(builder_path, "docbuilder")
|
||||
if ("windows" == platform.system().lower()):
|
||||
docbuilder_bin += ".exe"
|
||||
return subprocess.call([docbuilder_bin, "-register", license_path], stderr=subprocess.STDOUT, shell=True)
|
||||
command = docbuilder_bin + " -register \"" + license_path.replace('\"', '\\\"') + "\""
|
||||
return subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
|
||||
|
||||
atexit.register(CDocBuilder.Dispose)
|
||||
|
||||
@ -82,7 +82,7 @@ CV8RealTimeWorker::~CV8RealTimeWorker()
|
||||
m_context->Dispose();
|
||||
}
|
||||
|
||||
bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue)
|
||||
bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue, const bool& isEnterContext)
|
||||
{
|
||||
LOGGER_SPEED_START();
|
||||
|
||||
@ -92,14 +92,20 @@ bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRender
|
||||
std::string commandA = U_TO_UTF8(command);
|
||||
//commandA = "Api." + commandA;
|
||||
|
||||
CJSContextScope scope(m_context);
|
||||
if (isEnterContext)
|
||||
m_context->Enter();
|
||||
|
||||
JSSmart<CJSTryCatch> try_catch = m_context->GetExceptions();
|
||||
|
||||
LOGGER_SPEED_LAP("compile_command");
|
||||
|
||||
JSSmart<CJSValue> retNativeVal = m_context->runScript(commandA, try_catch);
|
||||
if(try_catch->Check())
|
||||
{
|
||||
if (isEnterContext)
|
||||
m_context->Exit();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (retValue)
|
||||
{
|
||||
@ -110,6 +116,9 @@ bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRender
|
||||
|
||||
LOGGER_SPEED_LAP("run_command");
|
||||
|
||||
if (isEnterContext)
|
||||
m_context->Exit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -240,6 +249,14 @@ bool CV8RealTimeWorker::InitVariables()
|
||||
if (try_catch->Check())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_sJSCodeStart.empty())
|
||||
{
|
||||
m_context->runScript(m_sJSCodeStart, try_catch);
|
||||
if (try_catch->Check())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -296,7 +313,7 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
|
||||
else if (1 == m_nFileType)
|
||||
pNative->m_strEditorType = L"presentation";
|
||||
else if (7 == m_nFileType)
|
||||
pNative->m_strEditorType = L"draw";
|
||||
pNative->m_strEditorType = L"visio";
|
||||
else
|
||||
pNative->m_strEditorType = L"spreadsheet";
|
||||
|
||||
@ -336,7 +353,17 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
|
||||
return !bIsBreak;
|
||||
}
|
||||
|
||||
bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams)
|
||||
bool CV8RealTimeWorker::NewSimpleJSInstance()
|
||||
{
|
||||
return InitVariables();
|
||||
}
|
||||
|
||||
bool CV8RealTimeWorker::IsSimpleJSInstance()
|
||||
{
|
||||
return (-1 == m_nFileType);
|
||||
}
|
||||
|
||||
bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams, const bool& isEnterContext)
|
||||
{
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile _formatDst = NSDoctRenderer::DoctRendererFormat::DOCT;
|
||||
if (type & AVS_OFFICESTUDIO_FILE_PRESENTATION)
|
||||
@ -362,7 +389,9 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
|
||||
}
|
||||
}
|
||||
|
||||
CJSContextScope scope(m_context);
|
||||
if (isEnterContext)
|
||||
m_context->Enter();
|
||||
|
||||
JSSmart<CJSTryCatch> try_catch = m_context->GetExceptions();
|
||||
|
||||
NSNativeControl::CNativeControl* pNative = NULL;
|
||||
@ -391,7 +420,7 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
|
||||
bIsSilentMode = true;
|
||||
|
||||
if (bIsSilentMode)
|
||||
this->ExecuteCommand(L"Api.asc_SetSilentMode(false);");
|
||||
this->ExecuteCommand(L"Api.asc_SetSilentMode(false);", NULL, isEnterContext);
|
||||
|
||||
std::wstring strError;
|
||||
bool bIsError = Doct_renderer_SaveFile_ForBuilder(_formatDst,
|
||||
@ -403,7 +432,10 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
|
||||
sJsonParams);
|
||||
|
||||
if (bIsSilentMode)
|
||||
this->ExecuteCommand(L"Api.asc_SetSilentMode(true);");
|
||||
this->ExecuteCommand(L"Api.asc_SetSilentMode(true);", NULL, isEnterContext);
|
||||
|
||||
if (isEnterContext)
|
||||
m_context->Exit();
|
||||
|
||||
return bIsError;
|
||||
}
|
||||
@ -1231,8 +1263,29 @@ namespace NSDoctRenderer
|
||||
nCount = nIndex;
|
||||
}
|
||||
|
||||
int CDocBuilder::OpenFile(const wchar_t* path, const wchar_t* params)
|
||||
{
|
||||
if (m_pInternal->m_nFileType != -1 && m_pInternal->m_bIsOpenedFromSimpleJS)
|
||||
{
|
||||
m_pInternal->m_bIsOpenedFromSimpleJS = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
m_pInternal->m_nFileType = -1;
|
||||
if (!NSDirectory::Exists(m_pInternal->m_sTmpFolder))
|
||||
NSDirectory::CreateDirectory(m_pInternal->m_sTmpFolder);
|
||||
|
||||
return m_pInternal->OpenFile(path, params);
|
||||
}
|
||||
|
||||
bool CDocBuilder::CreateFile(const int& type)
|
||||
{
|
||||
if (m_pInternal->m_nFileType != -1 && m_pInternal->m_bIsOpenedFromSimpleJS)
|
||||
{
|
||||
m_pInternal->m_bIsOpenedFromSimpleJS = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
m_pInternal->m_nFileType = -1;
|
||||
if (!NSDirectory::Exists(m_pInternal->m_sTmpFolder))
|
||||
NSDirectory::CreateDirectory(m_pInternal->m_sTmpFolder);
|
||||
@ -1391,7 +1444,7 @@ namespace NSDoctRenderer
|
||||
if (!sJsCommands.empty())
|
||||
{
|
||||
std::wstring sUnicodeCommand = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sJsCommands.c_str(), (LONG)sJsCommands.length());
|
||||
bIsNoError = this->ExecuteCommand(sUnicodeCommand.c_str());
|
||||
bIsNoError = this->m_pInternal->ExecuteCommand(sUnicodeCommand.c_str(), NULL, bIsBuilderJSCloseFile);
|
||||
sJsCommands = "";
|
||||
if (!bIsNoError)
|
||||
return false;
|
||||
@ -1413,6 +1466,10 @@ namespace NSDoctRenderer
|
||||
if (0 == _builder_params[nCheckParam].find(L"jsValue(") && _builder_params[nCheckParam].length() > 9)
|
||||
{
|
||||
std::wstring sParam = _builder_params[nCheckParam].substr(8, _builder_params[nCheckParam].length() - 9);
|
||||
|
||||
if (NULL == m_pInternal->m_pWorker)
|
||||
m_pInternal->CheckWorker();
|
||||
|
||||
_builder_params[nCheckParam] = m_pInternal->m_pWorker->GetJSVariable(sParam);
|
||||
}
|
||||
}
|
||||
@ -1478,7 +1535,7 @@ namespace NSDoctRenderer
|
||||
{
|
||||
// Такого быть не должно!!! Так как результат никуда не сохранится. пустое действие.
|
||||
std::wstring sUnicodeCommand = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sJsCommands.c_str(), (LONG)sJsCommands.length());
|
||||
bool bIsNoError = this->ExecuteCommand(sUnicodeCommand.c_str());
|
||||
bool bIsNoError = this->m_pInternal->ExecuteCommand(sUnicodeCommand.c_str(), NULL, true);
|
||||
sJsCommands = "";
|
||||
if (!bIsNoError)
|
||||
return false;
|
||||
@ -1539,6 +1596,15 @@ namespace NSDoctRenderer
|
||||
return this->SetProperty(sA.c_str(), value);
|
||||
}
|
||||
|
||||
int CDocBuilder::GetPropertyInt(const wchar_t* param)
|
||||
{
|
||||
std::wstring sParam = std::wstring(param);
|
||||
std::string sParamA = U_TO_UTF8(sParam);
|
||||
if ("--save-use-only-names" == sParamA)
|
||||
return m_pInternal->m_bIsServerSafeVersion ? 1 : 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CDocBuilder::Initialize(const wchar_t* directory)
|
||||
{
|
||||
std::wstring sDirectory = L"";
|
||||
|
||||
@ -63,6 +63,8 @@
|
||||
|
||||
#include "../common/ProcessEnv.h"
|
||||
|
||||
#include "docbuilder_addon.h"
|
||||
|
||||
#ifdef CreateFile
|
||||
#undef CreateFile
|
||||
#endif
|
||||
@ -422,6 +424,7 @@ public:
|
||||
int m_nFileType;
|
||||
std::string m_sUtf8ArgumentJSON;
|
||||
std::string m_sGlobalVariable;
|
||||
std::string m_sJSCodeStart;
|
||||
|
||||
CJSContextData m_oContextData;
|
||||
|
||||
@ -434,14 +437,17 @@ public:
|
||||
|
||||
static void _LOGGING_ERROR_(const std::wstring& strType, const std::wstring& strError);
|
||||
|
||||
bool ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue = NULL);
|
||||
bool ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue = NULL, const bool& isEnterContext = true);
|
||||
|
||||
std::string GetGlobalVariable();
|
||||
std::wstring GetJSVariable(std::wstring sParam);
|
||||
|
||||
bool OpenFile(const std::wstring& sBasePath, const std::wstring& path, const NSDoctRenderer::DoctRendererEditorType& editorType, NSDoctRenderer::CDoctRendererConfig* config, CV8Params* pParams = NULL);
|
||||
bool SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams = L"");
|
||||
bool SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams = L"", const bool& isEnterContext = true);
|
||||
bool InitVariables();
|
||||
|
||||
bool NewSimpleJSInstance();
|
||||
bool IsSimpleJSInstance();
|
||||
};
|
||||
|
||||
namespace NSDoctRenderer
|
||||
@ -455,7 +461,8 @@ namespace NSDoctRenderer
|
||||
std::wstring m_sTmpFolder;
|
||||
std::wstring m_sFileDir;
|
||||
int m_nFileType;
|
||||
bool m_bJavascriptBeforeEditor;
|
||||
|
||||
std::wstring m_sCommandsBeforeContextCreated;
|
||||
|
||||
std::wstring m_sX2tPath;
|
||||
|
||||
@ -474,11 +481,13 @@ namespace NSDoctRenderer
|
||||
|
||||
NSDoctRenderer::CDocBuilder* m_pParent;
|
||||
|
||||
bool m_bIsOpenedFromSimpleJS;
|
||||
|
||||
static std::wstring m_sExternalDirectory;
|
||||
public:
|
||||
CDocBuilder_Private() : CDoctRendererConfig(), m_sTmpFolder(NSFile::CFileBinary::GetTempPath()), m_nFileType(-1),
|
||||
m_pWorker(NULL), m_pAdditionalData(NULL), m_bIsInit(false), m_bIsServerSafeVersion(false),
|
||||
m_sGlobalVariable(""), m_bIsGlobalVariableUse(false), m_pParent(NULL), m_bJavascriptBeforeEditor(false)
|
||||
m_sGlobalVariable(""), m_bIsGlobalVariableUse(false), m_pParent(NULL), m_sCommandsBeforeContextCreated(L""), m_bIsOpenedFromSimpleJS(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -637,10 +646,14 @@ namespace NSDoctRenderer
|
||||
{
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/media");
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
|
||||
}
|
||||
|
||||
if (m_bJavascriptBeforeEditor)
|
||||
CheckWorkerAfterOpen();
|
||||
if (m_pWorker && m_pWorker->IsSimpleJSInstance() && !m_bIsOpenedFromSimpleJS)
|
||||
{
|
||||
RELEASEOBJECT(m_pWorker);
|
||||
CheckWorker();
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
#else
|
||||
@ -931,8 +944,11 @@ namespace NSDoctRenderer
|
||||
|
||||
if (0 == nReturnCode)
|
||||
{
|
||||
if (m_bJavascriptBeforeEditor)
|
||||
CheckWorkerAfterOpen();
|
||||
if (m_pWorker && m_pWorker->IsSimpleJSInstance() && !m_bIsOpenedFromSimpleJS)
|
||||
{
|
||||
RELEASEOBJECT(m_pWorker);
|
||||
CheckWorker();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -981,10 +997,16 @@ namespace NSDoctRenderer
|
||||
return _path;
|
||||
}
|
||||
|
||||
int SaveFile(const int& type, const std::wstring& path, const wchar_t* params = NULL)
|
||||
int SaveFile(const int& type, const std::wstring& path, const wchar_t* params = NULL, const bool& isEnterContext = true)
|
||||
{
|
||||
Init();
|
||||
|
||||
CDocBuilderAddon oSaveAddon(m_sX2tPath);
|
||||
|
||||
int nPreSaveError = oSaveAddon.GetX2tPreSaveError(m_pParent, m_nFileType);
|
||||
if (0 != nPreSaveError)
|
||||
return nPreSaveError;
|
||||
|
||||
if (-1 == m_nFileType)
|
||||
{
|
||||
CV8RealTimeWorker::_LOGGING_ERROR_(L"error (save)", L"file not opened!");
|
||||
@ -1023,7 +1045,7 @@ namespace NSDoctRenderer
|
||||
}
|
||||
}
|
||||
|
||||
this->m_pWorker->SaveFileWithChanges(type, m_sFileDir + L"/Editor2.bin", sJsonParams);
|
||||
this->m_pWorker->SaveFileWithChanges(type, m_sFileDir + L"/Editor2.bin", sJsonParams, isEnterContext);
|
||||
sFileBin = L"/Editor2.bin";
|
||||
}
|
||||
|
||||
@ -1068,6 +1090,8 @@ namespace NSDoctRenderer
|
||||
if (!sOptions.empty())
|
||||
oBuilder.WriteString(UTF8_TO_U(sOptions));
|
||||
|
||||
oBuilder.WriteString(oSaveAddon.GetX2tSaveAddon(m_pParent, m_nFileType));
|
||||
|
||||
oBuilder.WriteString(L"</TaskQueueDataConvert>");
|
||||
|
||||
std::wstring sXmlConvert = oBuilder.GetData();
|
||||
@ -1220,62 +1244,75 @@ namespace NSDoctRenderer
|
||||
{
|
||||
if (NULL == m_pWorker)
|
||||
{
|
||||
m_pWorker = new CV8RealTimeWorker(m_pParent, GetEditorType(), this);
|
||||
NSDoctRenderer::DoctRendererEditorType editorType = GetEditorType();
|
||||
m_pWorker = new CV8RealTimeWorker(m_pParent, editorType, this);
|
||||
m_pWorker->m_sUtf8ArgumentJSON = m_oParams.m_sArgumentJSON;
|
||||
m_pWorker->m_sGlobalVariable = m_sGlobalVariable;
|
||||
m_pWorker->m_sJSCodeStart = U_TO_UTF8(m_sCommandsBeforeContextCreated);
|
||||
|
||||
return CheckWorkerAfterOpen();
|
||||
m_pWorker->m_nFileType = m_nFileType;
|
||||
|
||||
if (-1 != m_nFileType)
|
||||
m_sCommandsBeforeContextCreated = L"";
|
||||
else
|
||||
{
|
||||
m_pWorker->NewSimpleJSInstance();
|
||||
return true;
|
||||
}
|
||||
|
||||
CV8Params oParams;
|
||||
oParams.IsServerSaveVersion = m_bIsServerSafeVersion;
|
||||
oParams.DocumentDirectory = m_sFileDir;
|
||||
|
||||
return m_pWorker->OpenFile(m_sX2tPath, m_sFileDir, editorType, this, &oParams);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckWorkerAfterOpen()
|
||||
{
|
||||
if (!m_pWorker)
|
||||
return false;
|
||||
|
||||
m_pWorker->m_nFileType = m_nFileType;
|
||||
if (-1 == m_nFileType)
|
||||
{
|
||||
m_bJavascriptBeforeEditor = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bJavascriptBeforeEditor = false;
|
||||
|
||||
CV8Params oParams;
|
||||
oParams.IsServerSaveVersion = m_bIsServerSafeVersion;
|
||||
oParams.DocumentDirectory = m_sFileDir;
|
||||
|
||||
return m_pWorker->OpenFile(m_sX2tPath, m_sFileDir, GetEditorType(), this, &oParams);
|
||||
}
|
||||
|
||||
int SaveFile(const std::wstring& ext, const std::wstring& path, const wchar_t* params = NULL)
|
||||
{
|
||||
int nType = GetFormatByTexExtention(ext);
|
||||
return SaveFile(nType, path, params);
|
||||
}
|
||||
|
||||
bool ExecuteCommand(const std::wstring& command, CDocBuilderValue* retValue = NULL)
|
||||
bool ExecuteCommand(const std::wstring& command, CDocBuilderValue* retValue = NULL, const bool& forceExecute = false, const bool& isEnterContext = true)
|
||||
{
|
||||
if (command.length() < 7 && !retValue) // minimum command (!!!)
|
||||
return true;
|
||||
|
||||
if (m_nFileType == -1 && !forceExecute)
|
||||
{
|
||||
m_sCommandsBeforeContextCreated += command;
|
||||
return true;
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
bool bRes = CheckWorker();
|
||||
if (CheckWorker())
|
||||
{
|
||||
bool bIsOpenedFromSimpleJSOld = m_bIsOpenedFromSimpleJS;
|
||||
bool bResult = m_pWorker->ExecuteCommand(command, retValue, isEnterContext);
|
||||
if (!bResult && !bIsOpenedFromSimpleJSOld && m_bIsOpenedFromSimpleJS)
|
||||
{
|
||||
RELEASEOBJECT(m_pWorker);
|
||||
CheckWorker();
|
||||
return m_pWorker->ExecuteCommand(command, retValue, isEnterContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
return bResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bRes && m_pWorker && m_bJavascriptBeforeEditor)
|
||||
m_pWorker->InitVariables();
|
||||
|
||||
return m_pWorker->ExecuteCommand(command, retValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
CDocBuilderContext GetContext(bool enterContext)
|
||||
{
|
||||
CDocBuilderContext ctx;
|
||||
|
||||
CheckWorker();
|
||||
if (!CheckWorker())
|
||||
return ctx;
|
||||
|
||||
ctx.m_internal->m_context = m_pWorker->m_context;
|
||||
ctx.m_internal->m_context_data = &m_pWorker->m_oContextData;
|
||||
|
||||
@ -986,7 +986,7 @@ namespace NSDoctRenderer
|
||||
case DoctRendererFormat::IMAGE:
|
||||
{
|
||||
editorType = NSDoctRenderer::DoctRendererEditorType::VISIO;
|
||||
m_pInternal->m_strEditorType = L"draw";
|
||||
m_pInternal->m_strEditorType = L"visio";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
130
DesktopEditor/doctrenderer/doctrenderer.pri
Normal file
130
DesktopEditor/doctrenderer/doctrenderer.pri
Normal file
@ -0,0 +1,130 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 1.0.0.3
|
||||
TARGET = doctrenderer
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
|
||||
PWD_CUR = $$PWD
|
||||
include($$PWD_CUR/../../Common/base.pri)
|
||||
|
||||
DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING
|
||||
DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING
|
||||
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network)
|
||||
|
||||
#CONFIG += build_xp
|
||||
#CONFIG += v8_version_60
|
||||
core_android:DEFINES += DISABLE_MEMORY_LIMITATION
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_CUR/config.h \
|
||||
$$PWD_CUR/editors.h \
|
||||
$$PWD_CUR/doctrenderer.h \
|
||||
$$PWD_CUR/docbuilder.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD_CUR/editors.cpp \
|
||||
$$PWD_CUR/nativecontrol.cpp \
|
||||
$$PWD_CUR/doctrenderer.cpp \
|
||||
$$PWD_CUR/docbuilder.cpp \
|
||||
$$PWD_CUR/docbuilder_p.cpp \
|
||||
$$PWD_CUR/graphics.cpp \
|
||||
$$PWD_CUR/hash.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$PWD_CUR/../../Common/OfficeFileFormatChecker2.cpp \
|
||||
$$PWD_CUR/../../Common/3dParty/pole/pole.cpp \
|
||||
$$PWD_CUR/../../OOXML/Base/unicode_util.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_CUR/docbuilder_p.h \
|
||||
$$PWD_CUR/nativecontrol.h \
|
||||
$$PWD_CUR/graphics.h \
|
||||
$$PWD_CUR/hash.h \
|
||||
$$PWD_CUR/server.h
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_CUR/embed/PointerEmbed.h \
|
||||
$$PWD_CUR/embed/ZipEmbed.h \
|
||||
$$PWD_CUR/embed/GraphicsEmbed.h \
|
||||
$$PWD_CUR/embed/MemoryStreamEmbed.h \
|
||||
$$PWD_CUR/embed/NativeControlEmbed.h \
|
||||
$$PWD_CUR/embed/NativeBuilderEmbed.h \
|
||||
$$PWD_CUR/embed/NativeBuilderDocumentEmbed.h \
|
||||
$$PWD_CUR/embed/TextMeasurerEmbed.h \
|
||||
$$PWD_CUR/embed/HashEmbed.h \
|
||||
$$PWD_CUR/embed/Default.h \
|
||||
$$PWD_CUR/js_internal/js_base.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD_CUR/embed/PointerEmbed.cpp \
|
||||
$$PWD_CUR/embed/ZipEmbed.cpp \
|
||||
$$PWD_CUR/embed/GraphicsEmbed.cpp \
|
||||
$$PWD_CUR/embed/MemoryStreamEmbed.cpp \
|
||||
$$PWD_CUR/embed/NativeControlEmbed.cpp \
|
||||
$$PWD_CUR/embed/NativeBuilderEmbed.cpp \
|
||||
$$PWD_CUR/embed/NativeBuilderDocumentEmbed.cpp \
|
||||
$$PWD_CUR/embed/TextMeasurerEmbed.cpp \
|
||||
$$PWD_CUR/embed/HashEmbed.cpp \
|
||||
$$PWD_CUR/embed/Default.cpp
|
||||
|
||||
# Serialize objects to JS
|
||||
HEADERS += \
|
||||
$$PWD_CUR/json/json.h \
|
||||
$$PWD_CUR/json/json_p.h \
|
||||
$$PWD_CUR/json/json_values.h \
|
||||
$$PWD_CUR/json/serialization.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD_CUR/json/json.cpp \
|
||||
$$PWD_CUR/json/json_values.cpp
|
||||
|
||||
include($$PWD_CUR/js_internal/js_base.pri)
|
||||
|
||||
!use_javascript_core {
|
||||
build_xp:DESTDIR=$$DESTDIR/xp
|
||||
}
|
||||
|
||||
use_javascript_core {
|
||||
OBJECTIVE_SOURCES += $$PWD_CUR/../common/Mac/NSString+StringUtils.mm
|
||||
}
|
||||
|
||||
# files for embedded classes
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/GraphicsEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/HashEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/MemoryStreamEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeBuilderEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeBuilderDocumentEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeControlEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/PointerEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/TextMeasurerEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/ZipEmbed.h)
|
||||
|
||||
include($$PWD_CUR/../graphics/pro/textshaper.pri)
|
||||
include($$PWD_CUR/../../Common/3dParty/openssl/openssl.pri)
|
||||
|
||||
# downloader
|
||||
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
|
||||
CONFIG += drawingfile_support
|
||||
drawingfile_support {
|
||||
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
|
||||
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_CUR/drawingfile.h \
|
||||
$$PWD_CUR/embed/DrawingFileEmbed.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD_CUR/../graphics/pro/js/wasm/src/HTMLRendererText.cpp \
|
||||
$$PWD_CUR/embed/DrawingFileEmbed.cpp
|
||||
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/DrawingFileEmbed.h)
|
||||
}
|
||||
@ -1,128 +1,3 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
INCLUDEPATH += $$PWD/addon
|
||||
|
||||
VERSION = 1.0.0.3
|
||||
TARGET = doctrenderer
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include(../../Common/base.pri)
|
||||
|
||||
DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING
|
||||
DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING
|
||||
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network)
|
||||
|
||||
#CONFIG += build_xp
|
||||
#CONFIG += v8_version_60
|
||||
core_android:DEFINES += DISABLE_MEMORY_LIMITATION
|
||||
|
||||
HEADERS += \
|
||||
config.h \
|
||||
editors.h \
|
||||
doctrenderer.h \
|
||||
docbuilder.h
|
||||
|
||||
SOURCES += \
|
||||
editors.cpp \
|
||||
nativecontrol.cpp \
|
||||
doctrenderer.cpp \
|
||||
docbuilder.cpp \
|
||||
docbuilder_p.cpp \
|
||||
graphics.cpp \
|
||||
hash.cpp
|
||||
|
||||
SOURCES += \
|
||||
../../Common/OfficeFileFormatChecker2.cpp \
|
||||
../../Common/3dParty/pole/pole.cpp \
|
||||
../../OOXML/Base/unicode_util.cpp
|
||||
|
||||
HEADERS += \
|
||||
docbuilder_p.h \
|
||||
nativecontrol.h \
|
||||
graphics.h \
|
||||
hash.h \
|
||||
server.h
|
||||
|
||||
HEADERS += \
|
||||
embed/PointerEmbed.h \
|
||||
embed/ZipEmbed.h \
|
||||
embed/GraphicsEmbed.h \
|
||||
embed/MemoryStreamEmbed.h \
|
||||
embed/NativeControlEmbed.h \
|
||||
embed/NativeBuilderEmbed.h \
|
||||
embed/NativeBuilderDocumentEmbed.h \
|
||||
embed/TextMeasurerEmbed.h \
|
||||
embed/HashEmbed.h \
|
||||
embed/Default.h \
|
||||
js_internal/js_base.h
|
||||
|
||||
SOURCES += \
|
||||
embed/PointerEmbed.cpp \
|
||||
embed/ZipEmbed.cpp \
|
||||
embed/GraphicsEmbed.cpp \
|
||||
embed/MemoryStreamEmbed.cpp \
|
||||
embed/NativeControlEmbed.cpp \
|
||||
embed/NativeBuilderEmbed.cpp \
|
||||
embed/NativeBuilderDocumentEmbed.cpp \
|
||||
embed/TextMeasurerEmbed.cpp \
|
||||
embed/HashEmbed.cpp \
|
||||
embed/Default.cpp
|
||||
|
||||
# Serialize objects to JS
|
||||
HEADERS += \
|
||||
json/json.h \
|
||||
json/json_p.h \
|
||||
json/json_values.h \
|
||||
json/serialization.h
|
||||
|
||||
SOURCES += \
|
||||
json/json.cpp \
|
||||
json/json_values.cpp
|
||||
|
||||
include($$PWD/js_internal/js_base.pri)
|
||||
|
||||
!use_javascript_core {
|
||||
build_xp:DESTDIR=$$DESTDIR/xp
|
||||
}
|
||||
|
||||
use_javascript_core {
|
||||
OBJECTIVE_SOURCES += ../common/Mac/NSString+StringUtils.mm
|
||||
}
|
||||
|
||||
# files for embedded classes
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/GraphicsEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/HashEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/MemoryStreamEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderDocumentEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeControlEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/PointerEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/TextMeasurerEmbed.h)
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/ZipEmbed.h)
|
||||
|
||||
include(../graphics/pro/textshaper.pri)
|
||||
include(../../Common/3dParty/openssl/openssl.pri)
|
||||
|
||||
# downloader
|
||||
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
|
||||
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
|
||||
CONFIG += drawingfile_support
|
||||
drawingfile_support {
|
||||
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
|
||||
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
|
||||
HEADERS += \
|
||||
drawingfile.h \
|
||||
embed/DrawingFileEmbed.h
|
||||
|
||||
SOURCES += \
|
||||
../../HtmlRenderer/src/HTMLRendererText.cpp \
|
||||
embed/DrawingFileEmbed.cpp
|
||||
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/DrawingFileEmbed.h)
|
||||
}
|
||||
include(doctrenderer.pri)
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
#include "../../PdfFile/PdfFile.h"
|
||||
#include "../../XpsFile/XpsFile.h"
|
||||
#include "../../DjVuFile/DjVu.h"
|
||||
#include "../../DesktopEditor/graphics/pro/js/wasm/src/serialize.h"
|
||||
#include "../../HtmlRenderer/include/HTMLRendererText.h"
|
||||
#include "../graphics/pro/js/wasm/src/serialize.h"
|
||||
#include "../graphics/pro/js/wasm/src/HTMLRendererText.h"
|
||||
#include "../../DocxRenderer/DocxRenderer.h"
|
||||
|
||||
#define CHECKER_FILE_BUFFER_LEN 4096
|
||||
@ -542,8 +542,8 @@ private:
|
||||
}
|
||||
if (m_nType == 0)
|
||||
nRotate = ((CPdfFile*)m_pFile)->GetRotate(nPageIndex);
|
||||
nWidth = dWidth;
|
||||
nHeight = dHeight;
|
||||
nWidth = round(dWidth);
|
||||
nHeight = round(dHeight);
|
||||
nPageDpiX = dPageDpiX;
|
||||
}
|
||||
|
||||
|
||||
@ -6,16 +6,16 @@ namespace NSDoctRenderer
|
||||
{
|
||||
namespace
|
||||
{
|
||||
void AppendScript(NSStringUtils::CStringBuilderA* builder, const std::wstring& path)
|
||||
bool AppendScript(NSStringUtils::CStringBuilderA* builder, const std::wstring& path, const std::string& header = "", const std::string& footer = "")
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
|
||||
if (!oFile.OpenFile(path))
|
||||
return;
|
||||
return false;
|
||||
|
||||
int size = (int)oFile.GetFileSize();
|
||||
if (size < 3)
|
||||
return;
|
||||
return false;
|
||||
|
||||
BYTE* pData = new BYTE[size];
|
||||
DWORD dwReadSize = 0;
|
||||
@ -26,9 +26,18 @@ namespace NSDoctRenderer
|
||||
if (pData[0] == 0xEF && pData[1] == 0xBB && pData[2] == 0xBF)
|
||||
nOffset = 3;
|
||||
|
||||
if (!header.empty())
|
||||
builder->WriteString(header);
|
||||
|
||||
builder->WriteString((char*)(pData + nOffset), size - nOffset);
|
||||
|
||||
if (!footer.empty())
|
||||
builder->WriteString(footer);
|
||||
|
||||
builder->WriteString("\n\n");
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RunScript(JSSmart<NSJSBase::CJSContext>& context, JSSmart<NSJSBase::CJSTryCatch>& try_catch, const std::wstring& path)
|
||||
@ -100,12 +109,12 @@ namespace NSDoctRenderer
|
||||
}
|
||||
case DoctRendererEditorType::VISIO:
|
||||
{
|
||||
if (!NSFile::CFileBinary::Exists(config->m_strSdkPath + L"/draw/sdk-all-min.js"))
|
||||
if (!NSFile::CFileBinary::Exists(config->m_strSdkPath + L"/visio/sdk-all-min.js"))
|
||||
return L"";
|
||||
AppendScript(builder, config->m_strSdkPath + L"/draw/sdk-all-min.js");
|
||||
AppendScript(builder, config->m_strSdkPath + L"/visio/sdk-all-min.js");
|
||||
AppendScript(builder, sFontsPath);
|
||||
AppendScript(builder, config->m_strSdkPath + L"/draw/sdk-all.js");
|
||||
sCachePath = config->m_strSdkPath + L"/draw/sdk-all";
|
||||
AppendScript(builder, config->m_strSdkPath + L"/visio/sdk-all.js");
|
||||
sCachePath = config->m_strSdkPath + L"/visio/sdk-all";
|
||||
break;
|
||||
}
|
||||
case DoctRendererEditorType::PDF:
|
||||
@ -114,6 +123,7 @@ namespace NSDoctRenderer
|
||||
AppendScript(builder, sFontsPath);
|
||||
AppendScript(builder, config->m_strSdkPath + L"/word/sdk-all.js");
|
||||
AppendScript(builder, config->m_strSdkPath + L"/pdf/src/engine/drawingfile_native.js");
|
||||
AppendScript(builder, config->m_strSdkPath + L"/pdf/src/annotations/stamps.json", "window[\"native_pdf_stamps\"]=", ";");
|
||||
sCachePath = config->m_strSdkPath + L"/pdf/sdk-all";
|
||||
break;
|
||||
}
|
||||
@ -147,7 +157,7 @@ namespace NSDoctRenderer
|
||||
}
|
||||
case DoctRendererEditorType::VISIO:
|
||||
{
|
||||
return config->m_strSdkPath + L"/draw/sdk-all.bin";
|
||||
return config->m_strSdkPath + L"/visio/sdk-all.bin";
|
||||
}
|
||||
case DoctRendererEditorType::PDF:
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "DrawingFileEmbed.h"
|
||||
#include "../drawingfile.h"
|
||||
#include "../../raster/BgraFrame.h"
|
||||
|
||||
JSSmart<CJSValue> WasmMemoryToJS(BYTE* pWasmData)
|
||||
{
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
#include "../graphics.h"
|
||||
#include <map>
|
||||
#include "../../../Common/Network/FileTransporter/include/FileTransporter.h"
|
||||
|
||||
// APPLICATION INFO
|
||||
class CGraphicsAppImage_private
|
||||
@ -10,6 +12,8 @@ public:
|
||||
std::wstring m_sThemesDirectory;
|
||||
bool m_bIsRgba;
|
||||
|
||||
std::map<std::wstring, std::wstring> m_mapDownloads;
|
||||
|
||||
CGraphicsAppImage_private()
|
||||
{
|
||||
m_pFonts = NULL;
|
||||
@ -21,6 +25,52 @@ public:
|
||||
~CGraphicsAppImage_private()
|
||||
{
|
||||
RELEASEINTERFACE(m_pFonts);
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator i = m_mapDownloads.begin(); i != m_mapDownloads.end(); i++)
|
||||
{
|
||||
std::wstring sTmp = i->second;
|
||||
if (NSFile::CFileBinary::Exists(sTmp))
|
||||
NSFile::CFileBinary::Remove(sTmp);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsNeedDownload(const std::wstring& sUrl)
|
||||
{
|
||||
if ((0 == sUrl.find(L"www.")) ||
|
||||
(0 == sUrl.find(L"http://")) ||
|
||||
(0 == sUrl.find(L"https://")))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring GetImagePath(const std::wstring& sUrl)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::iterator find = m_mapDownloads.find(sUrl);
|
||||
if (find != m_mapDownloads.end())
|
||||
return find->second;
|
||||
|
||||
NSNetwork::NSFileTransport::CFileDownloader oDownloader(sUrl, false);
|
||||
|
||||
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"IMG");
|
||||
if (NSFile::CFileBinary::Exists(sTmpFile))
|
||||
NSFile::CFileBinary::Remove(sTmpFile);
|
||||
sTmpFile = sTmpFile + L".png";
|
||||
|
||||
oDownloader.SetFilePath(sTmpFile);
|
||||
oDownloader.Start(0);
|
||||
while ( oDownloader.IsRunned() )
|
||||
{
|
||||
NSThreads::Sleep( 10 );
|
||||
}
|
||||
bool bIsDownloaded = oDownloader.IsFileDownloaded();
|
||||
|
||||
if (bIsDownloaded)
|
||||
{
|
||||
m_mapDownloads.insert(std::pair<std::wstring, std::wstring>(sUrl, sTmpFile));
|
||||
return sTmpFile;
|
||||
}
|
||||
|
||||
return sUrl;
|
||||
}
|
||||
};
|
||||
|
||||
@ -110,16 +160,35 @@ void CGraphicsEmbed::SetAppImage(CGraphicsAppImage* appImage)
|
||||
|
||||
JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSValue> width_px, JSSmart<CJSValue> height_px, JSSmart<CJSValue> width_mm, JSSmart<CJSValue> height_mm)
|
||||
{
|
||||
NSNativeControl::CNativeControl* pControl = NULL;
|
||||
if (!Native->isNull())
|
||||
{
|
||||
pControl = (NSNativeControl::CNativeControl*)Native->toObject()->getNative()->getObject();
|
||||
JSSmart<CJSObject> pNativeObject = Native->toObject();
|
||||
CJSEmbedObject* pNativeEmbedObject = pNativeObject->getNative();
|
||||
|
||||
if (m_pInternal->m_pAppImage)
|
||||
if (m_pInternal->m_pAppImage && pNativeEmbedObject)
|
||||
{
|
||||
delete m_pInternal->m_pAppImage;
|
||||
m_pInternal->m_pAppImage = new CGraphicsAppImage();
|
||||
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
|
||||
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
|
||||
m_pInternal->m_pAppImage = NULL;
|
||||
}
|
||||
|
||||
if (NULL == m_pInternal->m_pAppImage)
|
||||
m_pInternal->m_pAppImage = new CGraphicsAppImage();
|
||||
|
||||
if (pNativeEmbedObject)
|
||||
{
|
||||
NSNativeControl::CNativeControl* pControl = (NSNativeControl::CNativeControl*)pNativeEmbedObject->getObject();
|
||||
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
|
||||
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
|
||||
}
|
||||
else
|
||||
{
|
||||
JSSmart<CJSValue> checkResources = pNativeObject->get("isResourcesObject");
|
||||
if (checkResources->isBool() && true == checkResources->toBool())
|
||||
{
|
||||
m_pInternal->m_pAppImage->SetFontsDirectory(pNativeObject->get("fontsDirectory")->toStringW());
|
||||
m_pInternal->m_pAppImage->SetImagesDirectory(pNativeObject->get("imagesDirectory")->toStringW());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pInternal->init(width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble());
|
||||
@ -270,11 +339,19 @@ JSSmart<CJSValue> CGraphicsEmbed::ClearLastFont()
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawImage2(JSSmart<CJSValue> img, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> alpha, JSSmart<CJSValue> srcRect)
|
||||
{
|
||||
m_pInternal->drawImage(img->toStringW(), x->toDouble(), y->toDouble(), w->toDouble(), h->toDouble(), alpha->toInt32());
|
||||
std::wstring sUrl = img->toStringW();
|
||||
if (m_pInternal->m_pAppImage && m_pInternal->m_pAppImage->m_internal->IsNeedDownload(sUrl))
|
||||
sUrl = m_pInternal->m_pAppImage->m_internal->GetImagePath(sUrl);
|
||||
|
||||
m_pInternal->drawImage(sUrl, x->toDouble(), y->toDouble(), w->toDouble(), h->toDouble(), alpha->toInt32());
|
||||
return NULL;
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawImage (JSSmart<CJSValue> img, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> alpha, JSSmart<CJSValue> srcRect, JSSmart<CJSValue> nativeImage)
|
||||
{
|
||||
std::wstring sUrl = img->toStringW();
|
||||
if (m_pInternal->m_pAppImage && m_pInternal->m_pAppImage->m_internal->IsNeedDownload(sUrl))
|
||||
sUrl = m_pInternal->m_pAppImage->m_internal->GetImagePath(sUrl);
|
||||
|
||||
m_pInternal->drawImage(img->toStringW(), x->toDouble(), y->toDouble(), w->toDouble(), h->toDouble(), alpha->toInt32());
|
||||
return NULL;
|
||||
}
|
||||
@ -579,7 +656,11 @@ JSSmart<CJSValue> CGraphicsEmbed::GetBrushColor()
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::put_brushTexture(JSSmart<CJSValue> src, JSSmart<CJSValue> type)
|
||||
{
|
||||
m_pInternal->put_brushTexture(src->toStringW(), type->toInt32());
|
||||
std::wstring sUrl = src->toStringW();
|
||||
if (m_pInternal->m_pAppImage && m_pInternal->m_pAppImage->m_internal->IsNeedDownload(sUrl))
|
||||
sUrl = m_pInternal->m_pAppImage->m_internal->GetImagePath(sUrl);
|
||||
|
||||
m_pInternal->put_brushTexture(sUrl, type->toInt32());
|
||||
return NULL;
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::put_brushTextureMode(JSSmart<CJSValue> mode)
|
||||
|
||||
@ -31,6 +31,8 @@ public:
|
||||
|
||||
private:
|
||||
CGraphicsAppImage_private* m_internal;
|
||||
|
||||
friend class CGraphicsEmbed;
|
||||
};
|
||||
|
||||
namespace NSGraphics { class CGraphics; }
|
||||
|
||||
@ -8,7 +8,22 @@ JSSmart<CJSValue> CBuilderEmbed::OpenFile(JSSmart<CJSValue> sPath, JSSmart<CJSVa
|
||||
{
|
||||
std::wstring Path = sPath->toStringW();
|
||||
std::wstring Params = sParams->toStringW();
|
||||
|
||||
// Since we now use snapshots, and we can't always determine which editor is needed
|
||||
// (since the code may be BEFORE opening the file). And if the opening came from
|
||||
// builderJS.OpenFile - in this case we skip reopening.
|
||||
NSDoctRenderer::CDocBuilder_Private* pPrivate = GetPrivate();
|
||||
if (pPrivate->m_pWorker->IsSimpleJSInstance())
|
||||
pPrivate->m_bIsOpenedFromSimpleJS = true;
|
||||
|
||||
int ret = m_pBuilder->OpenFile(Path.c_str(), Params.c_str());
|
||||
|
||||
if (pPrivate->m_pWorker->IsSimpleJSInstance())
|
||||
{
|
||||
JSSmart<CJSContext> current = CJSContext::GetCurrent();
|
||||
current->runScript("throw 0;");
|
||||
}
|
||||
|
||||
return CJSContext::createInt(ret);
|
||||
}
|
||||
|
||||
@ -20,7 +35,21 @@ JSSmart<CJSValue> CBuilderEmbed::CreateFile(JSSmart<CJSValue> type)
|
||||
else
|
||||
nFormat = type->toInt32();
|
||||
|
||||
// Since we now use snapshots, and we can't always determine which editor is needed
|
||||
// (since the code may be BEFORE opening the file). And if the opening came from
|
||||
// builderJS.OpenFile - in this case we skip reopening.
|
||||
NSDoctRenderer::CDocBuilder_Private* pPrivate = GetPrivate();
|
||||
if (pPrivate->m_pWorker->IsSimpleJSInstance())
|
||||
pPrivate->m_bIsOpenedFromSimpleJS = true;
|
||||
|
||||
bool ret = m_pBuilder->CreateFile(nFormat);
|
||||
|
||||
if (pPrivate->m_pWorker->IsSimpleJSInstance())
|
||||
{
|
||||
JSSmart<CJSContext> current = CJSContext::GetCurrent();
|
||||
current->runScript("throw 0;");
|
||||
}
|
||||
|
||||
return CJSContext::createBool(ret);
|
||||
}
|
||||
|
||||
@ -41,7 +70,7 @@ JSSmart<CJSValue> CBuilderEmbed::SaveFile(JSSmart<CJSValue> type, JSSmart<CJSVal
|
||||
|
||||
std::wstring sPath = path->toStringW();
|
||||
std::wstring sParams = params->toStringW();
|
||||
int ret = m_pBuilder->SaveFile(nFormat, sPath.c_str(), sParams.empty() ? NULL : sParams.c_str());
|
||||
int ret = GetPrivate()->SaveFile(nFormat, sPath.c_str(), sParams.empty() ? NULL : sParams.c_str(), false);
|
||||
return CJSContext::createInt(ret);
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ public:
|
||||
~CBuilderEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); }
|
||||
|
||||
virtual void* getObject() { return (void*)m_pBuilder; }
|
||||
NSDoctRenderer::CDocBuilder_Private* GetPrivate() { return m_pBuilder->GetPrivate(); }
|
||||
|
||||
public:
|
||||
JSSmart<CJSValue> OpenFile(JSSmart<CJSValue> sPath, JSSmart<CJSValue> sParams);
|
||||
|
||||
@ -258,3 +258,64 @@ JSSmart<CJSValue> CZipEmbed::getImageType(JSSmart<CJSValue> typedArray)
|
||||
oBuffer.Free();
|
||||
return CJSContext::createInt(bIsImageFile ? oChecker.eFileType : 0);
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> CZipEmbed::getImageBuffer(JSSmart<CJSValue> filePath)
|
||||
{
|
||||
if (!m_pFolder || !filePath->isString())
|
||||
return CJSContext::createNull();
|
||||
|
||||
std::wstring sFilePath = filePath->toStringW();
|
||||
IFolder::CBuffer* pBuffer;
|
||||
if (!m_pFolder->read(sFilePath, pBuffer))
|
||||
return CJSContext::createNull();
|
||||
|
||||
size_t nBufferSize = (size_t)pBuffer->Size;
|
||||
|
||||
CImageFileFormatChecker oChecker;
|
||||
bool bIsImageFile = oChecker.isImageFile(pBuffer->Buffer, (DWORD)pBuffer->Size);
|
||||
|
||||
if (!bIsImageFile)
|
||||
{
|
||||
RELEASEOBJECT(pBuffer);
|
||||
return CJSContext::createNull();
|
||||
}
|
||||
|
||||
bool bIsNeedConvertMetfileToSvg = false;
|
||||
|
||||
// Make as wasm module
|
||||
if (oChecker.eFileType == _CXIMAGE_FORMAT_WMF || oChecker.eFileType == _CXIMAGE_FORMAT_EMF)
|
||||
oChecker.eFileType = _CXIMAGE_FORMAT_SVG;
|
||||
else
|
||||
bIsNeedConvertMetfileToSvg = false;
|
||||
|
||||
if (!bIsNeedConvertMetfileToSvg)
|
||||
{
|
||||
BYTE* pMemory = NSJSBase::NSAllocator::Alloc(nBufferSize);
|
||||
memcpy(pMemory, pBuffer->Buffer, nBufferSize);
|
||||
RELEASEOBJECT(pBuffer);
|
||||
|
||||
JSSmart<CJSObject> retObject = CJSContext::createObject();
|
||||
retObject->set("type", CJSContext::createInt(oChecker.eFileType));
|
||||
retObject->set("data", NSJSBase::CJSContext::createUint8Array(pMemory, (int)nBufferSize, false));
|
||||
return retObject->toValue();
|
||||
}
|
||||
|
||||
#ifndef GRAPHICS_DISABLE_METAFILE
|
||||
MetaFile::IMetaFile* pMetaFile = MetaFile::Create(NULL);
|
||||
pMetaFile->LoadFromBuffer(pBuffer->Buffer, (unsigned int)pBuffer->Size);
|
||||
std::wstring wsSvg = pMetaFile->ConvertToSvg();
|
||||
std::string sSvg = U_TO_UTF8(wsSvg);
|
||||
pMetaFile->Release();
|
||||
RELEASEOBJECT(pBuffer);
|
||||
|
||||
BYTE* pData = NSAllocator::Alloc(sSvg.length());
|
||||
memcpy(pData, sSvg.c_str(), sSvg.length());
|
||||
|
||||
JSSmart<CJSObject> retObject = CJSContext::createObject();
|
||||
retObject->set("type", CJSContext::createInt(24));
|
||||
retObject->set("data", NSJSBase::CJSContext::createUint8Array(pData, sSvg.length(), false));
|
||||
return retObject->toValue();
|
||||
#else
|
||||
return CJSContext::createNull();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ public:
|
||||
JSSmart<CJSValue> encodeImageData(JSSmart<CJSValue> typedArray, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> stride, JSSmart<CJSValue> format, JSSmart<CJSValue> isRgba);
|
||||
JSSmart<CJSValue> encodeImage(JSSmart<CJSValue> typedArray, JSSmart<CJSValue> format);
|
||||
JSSmart<CJSValue> getImageType(JSSmart<CJSValue> typedArray);
|
||||
JSSmart<CJSValue> getImageBuffer(JSSmart<CJSValue> path);
|
||||
|
||||
DECLARE_EMBED_METHODS
|
||||
};
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
-(JSValue*) encodeImageData : (JSValue*)typedArray : (JSValue*)w : (JSValue*)h : (JSValue*)stride : (JSValue*)format : (JSValue*)isRgba;
|
||||
-(JSValue*) encodeImage : (JSValue*)typedArray : (JSValue*)format;
|
||||
-(JSValue*) getImageType : (JSValue*)typedArray;
|
||||
-(JSValue*) getImageBuffer : (JSValue*)path;
|
||||
@end
|
||||
|
||||
@interface CJSCZipEmbed : NSObject<IJSCZipEmbed, JSEmbedObjectProtocol>
|
||||
@ -41,6 +42,7 @@ FUNCTION_WRAPPER_JS_2(decodeImage, decodeImage)
|
||||
FUNCTION_WRAPPER_JS_6(encodeImageData, encodeImageData)
|
||||
FUNCTION_WRAPPER_JS_2(encodeImage, encodeImage)
|
||||
FUNCTION_WRAPPER_JS_1(getImageType, getImageType)
|
||||
FUNCTION_WRAPPER_JS_1(getImageBuffer, getImageBuffer)
|
||||
@end
|
||||
|
||||
class CZipEmbedAdapter : public CJSEmbedObjectAdapterJSC
|
||||
|
||||
@ -20,6 +20,7 @@ namespace NSZipEmbed
|
||||
FUNCTION_WRAPPER_V8_6(_encodeImageData, encodeImageData)
|
||||
FUNCTION_WRAPPER_V8_2(_encodeImage, encodeImage)
|
||||
FUNCTION_WRAPPER_V8_1(_getImageType, getImageType)
|
||||
FUNCTION_WRAPPER_V8_1(_getImageBuffer, getImageBuffer)
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
|
||||
{
|
||||
@ -39,6 +40,7 @@ namespace NSZipEmbed
|
||||
NSV8Objects::Template_Set(result, "encodeImageData", _encodeImageData);
|
||||
NSV8Objects::Template_Set(result, "encodeImage", _encodeImage);
|
||||
NSV8Objects::Template_Set(result, "getImageType", _getImageType);
|
||||
NSV8Objects::Template_Set(result, "getImageBuffer", _getImageBuffer);
|
||||
|
||||
return handle_scope.Escape(result);
|
||||
}
|
||||
|
||||
@ -313,7 +313,10 @@ namespace NSGraphics
|
||||
}
|
||||
void CGraphics::drawImage(const std::wstring& img, double x, double y, double w, double h, BYTE alpha)
|
||||
{
|
||||
std::wstring strImage = (0 == img.find(L"theme") ? m_pAppImage->GetThemesDirectory() : m_pAppImage->GetImagesDirectory()) + L'/' + img;
|
||||
std::wstring strImage = img;
|
||||
if (!NSFile::CFileBinary::Exists(img))
|
||||
strImage = (0 == img.find(L"theme") ? m_pAppImage->GetThemesDirectory() : m_pAppImage->GetImagesDirectory()) + L'/' + img;
|
||||
|
||||
#ifdef ENABLE_GR_LOGS
|
||||
std::wcout << L"drawImage " << strImage << L" " << x << " " << y << L" " << w << L" " << h << L" " << alpha << std::endl;
|
||||
#endif
|
||||
@ -1250,7 +1253,10 @@ namespace NSGraphics
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring strImage = (0 == src.find(L"theme") ? m_pAppImage->GetThemesDirectory() : m_pAppImage->GetImagesDirectory()) + L'/' + src;
|
||||
std::wstring strImage = src;
|
||||
if (!NSFile::CFileBinary::Exists(src))
|
||||
strImage = (0 == src.find(L"theme") ? m_pAppImage->GetThemesDirectory() : m_pAppImage->GetImagesDirectory()) + L'/' + src;
|
||||
|
||||
std::wstring sName = strImage.substr(0, strImage.rfind(L'.') + 1);
|
||||
std::wstring sExt = src.substr(src.rfind(L'.') + 1);
|
||||
if (sExt == L"svg")
|
||||
|
||||
@ -374,7 +374,7 @@ namespace NSJSBase
|
||||
|
||||
JSSmart<CJSContext> CJSContext::GetCurrent()
|
||||
{
|
||||
CJSContext* ret = new CJSContext();
|
||||
CJSContext* ret = new CJSContext(false);
|
||||
ret->m_internal->context = NSJSBase::CJSContextPrivate::GetCurrentContext();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ v8::Local<v8::String> CreateV8String(v8::Isolate* i, const std::string& str);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#ifdef _DEBUG
|
||||
#define ANDROID_LOGS
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#ifdef ANDROID_LOGS
|
||||
#include <android/log.h>
|
||||
|
||||
@ -356,6 +356,8 @@ public:
|
||||
|
||||
virtual void Check(const int& nCode, const unsigned int& nIndex)
|
||||
{
|
||||
if (nCode > m_nMaxSymbols)
|
||||
return;
|
||||
if (nCode > m_nMax)
|
||||
m_nMax = nCode;
|
||||
if (nCode < m_nMin)
|
||||
@ -794,6 +796,8 @@ public:
|
||||
std::wstring sNameCorrect = pPair->second.m_sName;
|
||||
NSStringUtils::string_replace(sNameCorrect, L"\\", L"\\\\");
|
||||
NSStringUtils::string_replace(sNameCorrect, L"\"", L"\\\"");
|
||||
NSStringUtils::string_replace(sNameCorrect, L"\n", L"");
|
||||
NSStringUtils::string_replace(sNameCorrect, L"\r", L"");
|
||||
oWriterJS += sNameCorrect;
|
||||
|
||||
oWriterJS.AddSize(120);
|
||||
|
||||
@ -451,7 +451,7 @@ namespace NSShaper
|
||||
CheckUnicodeFaceName(face, family_name, family_name_len);
|
||||
|
||||
unsigned int nLen1 = (unsigned int)family_name_len;
|
||||
unsigned int nLen2 = (unsigned int)strlen(face->style_name);
|
||||
unsigned int nLen2 = (unsigned int)((face->style_name != NULL) ? strlen(face->style_name) : 0);
|
||||
|
||||
unsigned int nLen = 28 + nLen1 + 1 + nLen2 + 1 + 1 + (int)face->num_fixed_sizes;
|
||||
|
||||
@ -693,6 +693,13 @@ namespace NSShaper
|
||||
g_userfeatures_init = true;
|
||||
}
|
||||
|
||||
// Turn on ligatures on arabic script
|
||||
if (nScript == HB_SCRIPT_ARABIC ||
|
||||
nScript == HB_SCRIPT_SYRIAC)
|
||||
{
|
||||
nFeatures |= 1;
|
||||
}
|
||||
|
||||
// font
|
||||
hb_font_t* pFont;
|
||||
if (NULL == font)
|
||||
|
||||
@ -94,11 +94,14 @@ void CheckUnicodeFaceName(FT_Face pFace, int*& UName, unsigned int& ULen)
|
||||
bool isBadASCII = false;
|
||||
|
||||
unsigned int face_name_len = 0;
|
||||
while ('\0' != face_name[face_name_len])
|
||||
if (NULL != face_name)
|
||||
{
|
||||
if ('?' == face_name[face_name_len])
|
||||
isBadASCII = true;
|
||||
++face_name_len;
|
||||
while ('\0' != face_name[face_name_len])
|
||||
{
|
||||
if ('?' == face_name[face_name_len])
|
||||
isBadASCII = true;
|
||||
++face_name_len;
|
||||
}
|
||||
}
|
||||
|
||||
if (face_name_len > 6 &&
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -594,6 +594,13 @@ WASM_EXPORT unsigned char* ASC_HB_ShapeText(FT_Face pFace, hb_font_t* pFont, cha
|
||||
g_userfeatures_init = true;
|
||||
}
|
||||
|
||||
// Turn on ligatures on arabic script
|
||||
if (nScript == HB_SCRIPT_ARABIC ||
|
||||
nScript == HB_SCRIPT_SYRIAC)
|
||||
{
|
||||
nFeatures |= 1;
|
||||
}
|
||||
|
||||
// font
|
||||
if (NULL == pFont)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -531,6 +531,45 @@ ZLib.prototype.getImageAsSvg = function(path)
|
||||
|
||||
return string;
|
||||
};
|
||||
/**
|
||||
* Get image file raw data. this memory was copied and detach from archive.
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
ZLib.prototype.getImageBuffer = function(path)
|
||||
{
|
||||
let result = {
|
||||
type : 0,
|
||||
data : null
|
||||
};
|
||||
result.type = this.getImageType(path);
|
||||
if (result.type === 0)
|
||||
return null;
|
||||
|
||||
let fileData = this.getFile(path);
|
||||
result.data = new Uint8Array(fileData.length);
|
||||
result.data.set(fileData);
|
||||
|
||||
if (result.type != 10 &&
|
||||
result.type != 21)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result.type = 24;
|
||||
// Source was saved as result.data for using original image in native convertations.
|
||||
// But for js we need svg for metafiles.
|
||||
|
||||
let encodedData = Module["_Raster_Encode"](this.files[path].p + 4, fileData.length, 24);
|
||||
let encodedSize = Module["_Raster_GetEncodedSize"](encodedData);
|
||||
let encodedBuffer = Module["_Raster_GetEncodedBuffer"](encodedData);
|
||||
|
||||
let fileDataEnc = new Uint8Array(Module["HEAP8"].buffer, encodedBuffer, encodedSize);
|
||||
result.dataBlob = new Uint8Array(fileDataEnc.length);
|
||||
result.dataBlob.set(fileDataEnc);
|
||||
|
||||
Module["_Raster_DestroyEncodedData"](encodedData);
|
||||
return result;
|
||||
};
|
||||
/**
|
||||
* Get image blob for browser
|
||||
* @returns {Blob}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -35,7 +35,7 @@
|
||||
window['AscFonts'] = window['AscFonts'] || {};
|
||||
var AscFonts = window['AscFonts'];
|
||||
|
||||
var g_native_engine = CreateEmbedObject("CTextMeasurerEmbed");
|
||||
var g_native_engine = null;
|
||||
|
||||
function CReturnObject()
|
||||
{
|
||||
@ -236,4 +236,6 @@ AscFonts.Hyphen_Word = function(lang, word)
|
||||
AscFonts.onLoadModule();
|
||||
AscFonts.onLoadModule();
|
||||
|
||||
window["InitNativeTextMeasurer"] = function() { g_native_engine = CreateEmbedObject("CTextMeasurerEmbed"); };
|
||||
|
||||
})(window, undefined);
|
||||
|
||||
@ -100,6 +100,7 @@
|
||||
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
|
||||
"GRAPHICS_NO_USE_DYNAMIC_LIBRARY",
|
||||
"HYPHEN_ENGINE_DISABLE_FILESYSTEM",
|
||||
"METAFILE_DISABLE_FILESYSTEM",
|
||||
|
||||
"HAVE_UNISTD_H", "HAVE_FCNTL_H", "_ARM_ALIGN_",
|
||||
"METAFILE_SUPPORT_WMF_EMF",
|
||||
@ -259,10 +260,13 @@
|
||||
"folder": "../../../OfficeUtils/js",
|
||||
"files": ["../src/ZipBuffer.cpp", "wasm/src/base.cpp", "../src/zlib_addon.c"]
|
||||
},
|
||||
|
||||
{
|
||||
"folder": "../../",
|
||||
"files": ["graphics/Image.cpp", "raster/BgraFrame.cpp", "raster/ImageFileFormatChecker.cpp"]
|
||||
"files": ["graphics/Image.cpp", "raster/BgraFrame.cpp", "raster/ImageFileFormatChecker.cpp", "graphics/Matrix.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../agg-2.4/src/",
|
||||
"files": ["agg_trans_affine.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../raster/",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -761,6 +761,14 @@ function onLoadFontsModule(window, undefined)
|
||||
{
|
||||
return this.engine["getImageBlob"](path);
|
||||
};
|
||||
/**
|
||||
* Get image file raw data. this memory was copied and detach from archive.
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
ZLib.prototype.getImageBuffer = function(path)
|
||||
{
|
||||
return this.engine["getImageBuffer"](path);
|
||||
};
|
||||
/**
|
||||
* Get all file paths in archive
|
||||
* @returns {Array}
|
||||
@ -772,10 +780,84 @@ function onLoadFontsModule(window, undefined)
|
||||
|
||||
AscCommon.ZLib = ZLib;
|
||||
|
||||
function ZlibImageBlobs()
|
||||
{
|
||||
this.url2BlobUrl = {};
|
||||
this.blobUrl2Data = {};
|
||||
this.url2Base64 = {};
|
||||
|
||||
this.nativeBlobCounter = 1;
|
||||
}
|
||||
ZlibImageBlobs.prototype.getBlobUrl = function(path, zip)
|
||||
{
|
||||
if (this.url2BlobUrl[path])
|
||||
return this.url2BlobUrl[path];
|
||||
|
||||
let result = zip.getImageBuffer(path);
|
||||
if (result == null)
|
||||
return "";
|
||||
|
||||
let blobUrl = "";
|
||||
let blobType = AscCommon.openXml.GetMimeType((24 !== result["type"]) ? AscCommon.GetFileExtension(path) : "svg");
|
||||
|
||||
if (window["NATIVE_EDITOR_ENJINE"])
|
||||
{
|
||||
blobUrl = "blob:internal-image" + this.nativeBlobCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
let blob = new Blob([result["dataBlob"] ? result["dataBlob"] : result["data"]], {type: blobType});
|
||||
blobUrl = window.URL.createObjectURL(blob);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
blobUrl = "error";
|
||||
AscCommon.consoleLog("ERROR: Image blob was not loaded");
|
||||
}
|
||||
}
|
||||
|
||||
this.blobUrl2Data[blobUrl] = result;
|
||||
this.url2BlobUrl[path] = blobUrl;
|
||||
return blobUrl;
|
||||
};
|
||||
ZlibImageBlobs.prototype.getImageBase64 = function(url)
|
||||
{
|
||||
if (this.url2Base64[url])
|
||||
return this.url2Base64[url];
|
||||
|
||||
let obj = this.blobUrl2Data[url];
|
||||
if (!obj)
|
||||
return url;
|
||||
|
||||
let header = "";
|
||||
switch (obj.type)
|
||||
{
|
||||
case 3:
|
||||
header = "data:image/jpeg;base64,";
|
||||
break;
|
||||
case 24:
|
||||
header = "data:image/svg+xml;base64,";
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
header = "data:image/png;base64,";
|
||||
}
|
||||
|
||||
this.url2Base64[url] = header + AscCommon.Base64.encode(obj.data);
|
||||
return this.url2Base64[url];
|
||||
};
|
||||
|
||||
window["AscCommon"].g_oDocumentBlobUrls = new ZlibImageBlobs();
|
||||
|
||||
if (AscCommon["CZLibEngineJS"])
|
||||
AscCommon["CZLibEngineJS"].prototype["isModuleInit"] = true;
|
||||
|
||||
window.nativeZlibEngine = new ZLib();
|
||||
if (window["NATIVE_EDITOR_ENJINE"])
|
||||
window["InitNativeZLib"] = function() { window.nativeZlibEngine = new ZLib(); };
|
||||
else
|
||||
window.nativeZlibEngine = new ZLib();
|
||||
|
||||
function Hyphenation()
|
||||
{
|
||||
|
||||
@ -142,6 +142,14 @@ std::vector<double> Curve::GetYValues() const noexcept
|
||||
return {Segment1.P.Y, Segment2.P.Y + Segment2.HI.Y, Segment2.P.Y + Segment2.HO.Y, Segment2.P.Y};
|
||||
}
|
||||
|
||||
std::vector<double> Curve::GetBound() const noexcept
|
||||
{
|
||||
return {min(Segment1.P.X, Segment2.P.X + Segment2.HI.X, Segment2.P.X + Segment2.HO.X, Segment2.P.X),
|
||||
min(Segment1.P.Y, Segment2.P.Y + Segment2.HI.Y, Segment2.P.Y + Segment2.HO.Y, Segment2.P.Y),
|
||||
max(Segment1.P.X, Segment2.P.X + Segment2.HI.X, Segment2.P.X + Segment2.HO.X, Segment2.P.X),
|
||||
max(Segment1.P.Y, Segment2.P.Y + Segment2.HI.Y, Segment2.P.Y + Segment2.HO.Y, Segment2.P.Y)};
|
||||
}
|
||||
|
||||
std::vector<double> Curve::GetPeeks() const
|
||||
{
|
||||
std::vector<double> x = GetXValues(),
|
||||
@ -232,6 +240,7 @@ double Curve::GetTimeOf(const PointD& point) const noexcept
|
||||
if (getDistance(point, GetPoint(u)) <= GEOMETRIC_EPSILON)
|
||||
return u;
|
||||
}
|
||||
roots.clear();
|
||||
}
|
||||
}
|
||||
bool firstDist = d0 <= GEOMETRIC_EPSILON,
|
||||
@ -269,8 +278,31 @@ double Curve::GetTimeAt(const double& offset) const noexcept
|
||||
by = 6 * (y[0] + y[2]) - 12 * y[1],
|
||||
cy = 3 * (y[1] - y[0]);
|
||||
|
||||
return findRoot(length, start, offset, ax, bx, cx,
|
||||
ay, by, cy, start + guess, a, b);
|
||||
double vx = start + guess;
|
||||
for (size_t i = 0; i < 32; i++)
|
||||
{
|
||||
length += integrate(ax, bx, cx, ay, by, cy, start, vx, getIterations(start, vx));
|
||||
start = vx;
|
||||
|
||||
double dx = vx - (length - offset) / CurveLength(vx, ax, bx, cx, ay, by, cy);
|
||||
if (fabs(vx - dx) < EPSILON)
|
||||
{
|
||||
vx = dx;
|
||||
break;
|
||||
}
|
||||
|
||||
if (length - offset > 0)
|
||||
{
|
||||
b = vx;
|
||||
vx = dx <= a ? (a + b) * 0.5 : dx;
|
||||
}
|
||||
else{
|
||||
a = vx;
|
||||
vx = dx >= b ? (a + b) * 0.5 : dx;
|
||||
}
|
||||
}
|
||||
|
||||
return clamp(vx, a, b);
|
||||
}
|
||||
|
||||
PointD Curve::Get(const double& t, const int& type) const noexcept
|
||||
@ -407,15 +439,15 @@ std::vector<std::pair<double, double>> Curve::GetOverlaps(const Curve& curve) co
|
||||
std::swap(y1, y2);
|
||||
}
|
||||
|
||||
double d20 = getDistance(px, py, vx, vy, x2[0], y2[0], true),
|
||||
d23 = getDistance(px, py, vx, vy, x2[3], y2[3], true);
|
||||
double d20 = fabs(getSignedDistance(px, py, vx, vy, x2[0], y2[0], true)),
|
||||
d23 = fabs(getSignedDistance(px, py, vx, vy, x2[3], y2[3], true));
|
||||
|
||||
if (d20 < GEOMETRIC_EPSILON && d23 < GEOMETRIC_EPSILON)
|
||||
{
|
||||
double d11 = getDistance(px, py, vx, vy, x1[1], y1[1], true),
|
||||
d12 = getDistance(px, py, vx, vy, x1[2], y1[2], true),
|
||||
d21 = getDistance(px, py, vx, vy, x2[1], y2[1], true),
|
||||
d22 = getDistance(px, py, vx, vy, x2[2], y2[2], true);
|
||||
double d11 = fabs(getSignedDistance(px, py, vx, vy, x1[1], y1[1], true)),
|
||||
d12 = fabs(getSignedDistance(px, py, vx, vy, x1[2], y1[2], true)),
|
||||
d21 = fabs(getSignedDistance(px, py, vx, vy, x2[1], y2[1], true)),
|
||||
d22 = fabs(getSignedDistance(px, py, vx, vy, x2[2], y2[2], true));
|
||||
|
||||
if (!straightBoth &&
|
||||
d11 < GEOMETRIC_EPSILON &&
|
||||
@ -611,10 +643,10 @@ int Curve::SolveCubic(double a, double b, double c, double d,
|
||||
q = c2 * x + d;
|
||||
|
||||
double t = q / a,
|
||||
r = pow(fabs(t), 1 / 3),
|
||||
r = pow(fabs(t), 1.0 / 3.0),
|
||||
s = t < 0 ? -1 : 1,
|
||||
td = -qd / a,
|
||||
rd = td > 0 ? 1.324717957244746 * std::max(r, sqrt(td)) : r,
|
||||
rd = td > 0 ? 1.324717957244746 * std::max(r, std::sqrt(td)) : r,
|
||||
x0 = x - s * rd;
|
||||
|
||||
if (x0 != x)
|
||||
@ -715,9 +747,9 @@ CBooleanOperations::CBooleanOperations(const CGraphicsPath& path1,
|
||||
Op(op),
|
||||
Close1(path1.Is_poly_closed()),
|
||||
Close2(path2.Is_poly_closed()),
|
||||
FillType(fillType),
|
||||
Path1(path1),
|
||||
Path2(path2),
|
||||
FillType(fillType)
|
||||
Path2(path2)
|
||||
{
|
||||
TraceBoolean();
|
||||
}
|
||||
@ -995,7 +1027,7 @@ void CBooleanOperations::TracePaths()
|
||||
start = true;
|
||||
while (valid)
|
||||
{
|
||||
if (!start || (Op == Intersection && s.Inters))
|
||||
if (!start || (Op == Intersection && s.Inters && !GetNextSegment(s).Inters))
|
||||
SetVisited(s);
|
||||
|
||||
if (start)
|
||||
@ -1221,35 +1253,22 @@ void CBooleanOperations::SetVisited(const Segment& segment)
|
||||
Segments2[segment.Index].Visited = true;
|
||||
}
|
||||
|
||||
std::vector<std::vector<double>> CBooleanOperations::GetBoundsForCurves(const std::vector<Curve>& curves) const noexcept
|
||||
{
|
||||
std::vector<std::vector<double>> bounds;
|
||||
for (int i = 0; i < curves.size(); i++)
|
||||
{
|
||||
std::vector<double> x = curves[i].GetXValues(),
|
||||
y = curves[i].GetYValues();
|
||||
bounds.push_back({min(x[0], x[1], x[2], x[3]),
|
||||
min(y[0], y[1], y[2], y[3]),
|
||||
max(x[0], x[1], x[2], x[3]),
|
||||
max(y[0], y[1], y[2], y[3])});
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
|
||||
std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
|
||||
{
|
||||
std::vector<std::vector<double>> bounds1 = GetBoundsForCurves(Curves1);
|
||||
std::vector<std::vector<double>> bounds2 = GetBoundsForCurves(Curves2);
|
||||
std::vector<std::vector<double>> allBounds, bounds2;
|
||||
for (const auto& c : Curves1)
|
||||
allBounds.push_back(c.GetBound());
|
||||
for (const auto& c : Curves2)
|
||||
bounds2.push_back(c.GetBound());
|
||||
|
||||
bool self = bounds1 == bounds2;
|
||||
bool self = allBounds == bounds2;
|
||||
|
||||
std::vector<std::vector<double>> allBounds(bounds1);
|
||||
if (!self)
|
||||
for (auto it = bounds2.begin(); it != bounds2.end(); ++it) // std::copy(bounds2.begin(), bounds2.end(), std::back_inserter(allBounds));
|
||||
for (auto it = bounds2.begin(); it != bounds2.end(); ++it)
|
||||
allBounds.push_back(*it);
|
||||
|
||||
int allLength = static_cast<int>(allBounds.size()),
|
||||
length1 = static_cast<int>(bounds1.size());
|
||||
length1 = static_cast<int>(Curves1.size());
|
||||
|
||||
std::vector<int> allIdicesByPri1(allLength);
|
||||
for (int i = 0; i < allLength; i++)
|
||||
@ -1265,56 +1284,47 @@ std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
|
||||
std::vector<std::vector<int>> allCollisions(length1);
|
||||
for (int i = 0; i < allLength; i++)
|
||||
{
|
||||
int curIndex = allIdicesByPri1[i];
|
||||
std::vector<double> curBounds = allBounds[curIndex];
|
||||
std::vector<int> curCollisions;
|
||||
bool isCurrent1 = curIndex < length1,
|
||||
bool isCurrent1 = allIdicesByPri1[i] < length1,
|
||||
isCurrent2 = self || !isCurrent1;
|
||||
int origIndex = self ? curIndex : curIndex - length1;
|
||||
int origIndex = self ? allIdicesByPri1[i] : allIdicesByPri1[i] - length1;
|
||||
|
||||
if (!activeIndicesByPri2.empty())
|
||||
{
|
||||
int pruneCount = binarySearch(allBounds, activeIndicesByPri2, 2,
|
||||
curBounds[0] - GEOMETRIC_EPSILON) + 1;
|
||||
allBounds[allIdicesByPri1[i]][0] - GEOMETRIC_EPSILON) + 1;
|
||||
|
||||
activeIndicesByPri2.erase(activeIndicesByPri2.begin(),
|
||||
activeIndicesByPri2.begin() + pruneCount);
|
||||
|
||||
double curSec2 = curBounds[3],
|
||||
curSec1 = curBounds[1];
|
||||
for (int j = 0; j < static_cast<int>(activeIndicesByPri2.size()); j++)
|
||||
{
|
||||
int activeIndex = activeIndicesByPri2[j];
|
||||
std::vector<double> activeBounds = allBounds[activeIndex];
|
||||
bool isActive1 = activeIndex < length1,
|
||||
bool isActive1 = activeIndicesByPri2[j] < length1,
|
||||
isActive2 = self || !isActive1,
|
||||
isActive1Or2 = (isCurrent1 && isActive2) || (isCurrent2 && isActive1),
|
||||
inRange1 = curSec1 <= activeBounds[3] + GEOMETRIC_EPSILON,
|
||||
inRange2 = curSec2 >= activeBounds[1] - GEOMETRIC_EPSILON;
|
||||
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))
|
||||
{
|
||||
if (isCurrent1 && isActive2)
|
||||
curCollisions.push_back(self ? activeIndex : activeIndex - length1);
|
||||
curCollisions.push_back(self ? activeIndicesByPri2[j] : activeIndicesByPri2[j] - length1);
|
||||
if (isCurrent2 && isActive1)
|
||||
allCollisions[activeIndex].push_back(origIndex);
|
||||
allCollisions[activeIndicesByPri2[j]].push_back(origIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isCurrent1)
|
||||
{
|
||||
if (bounds1 == bounds2)
|
||||
curCollisions.push_back(curIndex);
|
||||
allCollisions[curIndex] = curCollisions;
|
||||
if (self) curCollisions.push_back(allIdicesByPri1[i]);
|
||||
allCollisions[allIdicesByPri1[i]] = curCollisions;
|
||||
}
|
||||
if (activeIndicesByPri2.size() > 0)
|
||||
{
|
||||
double curPri2 = curBounds[2];
|
||||
int index = binarySearch(allBounds, activeIndicesByPri2, 2, curPri2);
|
||||
activeIndicesByPri2.insert(activeIndicesByPri2.begin() + (1 + index), curIndex);
|
||||
int index = 1 + binarySearch(allBounds, activeIndicesByPri2, 2, allBounds[allIdicesByPri1[i]][2]);
|
||||
activeIndicesByPri2.insert(activeIndicesByPri2.begin() + index, allIdicesByPri1[i]);
|
||||
}
|
||||
else
|
||||
activeIndicesByPri2.push_back(curIndex);
|
||||
activeIndicesByPri2.push_back(allIdicesByPri1[i]);
|
||||
}
|
||||
|
||||
for (auto& c : allCollisions)
|
||||
@ -1387,11 +1397,6 @@ bool CBooleanOperations::IsCrossing(std::shared_ptr<Location> loc) noexcept
|
||||
return t1Inside ? inRange1 : inRange2;
|
||||
}
|
||||
|
||||
bool CBooleanOperations::FilterIntersections(std::shared_ptr<Location> loc) noexcept
|
||||
{
|
||||
return loc->Overlap || IsCrossing(loc);
|
||||
}
|
||||
|
||||
bool CBooleanOperations::IntersectsBounds() noexcept
|
||||
{
|
||||
RectF_T<double> rect1, rect2;
|
||||
@ -1406,17 +1411,12 @@ bool CBooleanOperations::IntersectsBounds() noexcept
|
||||
|
||||
void CBooleanOperations::GetIntersection()
|
||||
{
|
||||
if (!IntersectsBounds())
|
||||
return;
|
||||
if (!IntersectsBounds()) return;
|
||||
|
||||
std::vector<std::vector<int>> boundsCollisions = FindBoundsCollisions();
|
||||
for (int index1 = 0; index1 < Curves1.size(); index1++)
|
||||
{
|
||||
std::vector<int> collisions1 = boundsCollisions[index1];
|
||||
if (!collisions1.empty())
|
||||
for (int j = 0; j < collisions1.size(); j++)
|
||||
GetCurveIntersection(Curves1[index1], Curves2[collisions1[j]]);
|
||||
}
|
||||
for (int j = 0; j < boundsCollisions[index1].size(); j++)
|
||||
GetCurveIntersection(Curves1[index1], Curves2[boundsCollisions[index1][j]]);
|
||||
}
|
||||
|
||||
void CBooleanOperations::GetCurveIntersection(const Curve& curve1, const Curve& curve2)
|
||||
@ -1537,15 +1537,15 @@ int CBooleanOperations::AddCurveIntersection(const Curve& curve1, const Curve& c
|
||||
x2 = curve2.GetXValues(),
|
||||
y2 = curve2.GetYValues();
|
||||
|
||||
double d1 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x2[1], y2[1]),
|
||||
d2 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x2[2], y2[2]),
|
||||
double d1 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x2[1], y2[1], false),
|
||||
d2 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x2[2], y2[2], false),
|
||||
factor = (d1 * d2) > 0 ? 3.0 / 4.0 : 4.0 / 9.0,
|
||||
dMin = factor * min(0, d1, d2),
|
||||
dMax = factor * max(0, d1, d2),
|
||||
dp0 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[0], y1[0]),
|
||||
dp1 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[1], y1[1]),
|
||||
dp2 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[2], y1[2]),
|
||||
dp3 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[3], y1[3]);
|
||||
dp0 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[0], y1[0], false),
|
||||
dp1 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[1], y1[1], false),
|
||||
dp2 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[2], y1[2], false),
|
||||
dp3 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[3], y1[3], false);
|
||||
|
||||
std::vector<PointD> top;
|
||||
std::vector<PointD> bottom;
|
||||
@ -1883,7 +1883,7 @@ void CBooleanOperations::AddLocation(Curve curve1, Curve curve2, double t1,
|
||||
loc1->Inters = loc2;
|
||||
loc2->Inters = loc1;
|
||||
|
||||
if (!filter || FilterIntersections(loc1))
|
||||
if (!filter || loc1->Overlap || IsCrossing(loc1))
|
||||
InsertLocation(loc1, overlap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +54,7 @@ namespace Aggplus
|
||||
|
||||
std::vector<double> GetXValues() const noexcept;
|
||||
std::vector<double> GetYValues() const noexcept;
|
||||
std::vector<double> GetBound() const noexcept;
|
||||
std::vector<double> GetPeeks() const;
|
||||
double GetLength(double a = 0, double b = 1) const;
|
||||
double GetSquaredLineLength() const noexcept;
|
||||
@ -81,7 +82,6 @@ namespace Aggplus
|
||||
void Flip() noexcept;
|
||||
|
||||
bool IsStraight() const noexcept;
|
||||
bool HasHandle() const noexcept;
|
||||
bool operator==(const Curve& other) const noexcept;
|
||||
bool operator!=(const Curve& other) const noexcept;
|
||||
};
|
||||
@ -128,12 +128,10 @@ namespace Aggplus
|
||||
void SetVisited(const Segment& segment);
|
||||
|
||||
// Bounds
|
||||
std::vector<std::vector<double>> GetBoundsForCurves(const std::vector<Curve>& curves) const noexcept;
|
||||
std::vector<std::vector<int>> FindBoundsCollisions();
|
||||
|
||||
// Intersection
|
||||
bool IsCrossing(std::shared_ptr<Location> loc) noexcept;
|
||||
bool FilterIntersections(std::shared_ptr<Location> loc) noexcept;
|
||||
bool IntersectsBounds() noexcept;
|
||||
void GetIntersection();
|
||||
void GetCurveIntersection(const Curve& curve1, const Curve& curve2);
|
||||
|
||||
@ -33,164 +33,33 @@
|
||||
|
||||
namespace Aggplus
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
CClipMask::CClipMask() : m_pixf(m_alpha_rbuf)
|
||||
{
|
||||
m_pMask = NULL;
|
||||
m_bIsClip = false;
|
||||
|
||||
m_lWidth = 0;
|
||||
m_lHeight = 0;
|
||||
}
|
||||
|
||||
CClipMask::~CClipMask()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void CClipMask::Destroy()
|
||||
{
|
||||
if (NULL != m_pMask)
|
||||
delete [] m_pMask;
|
||||
}
|
||||
|
||||
void CClipMask::Reset()
|
||||
{
|
||||
m_bIsClip = false;
|
||||
}
|
||||
|
||||
void CClipMask::Create(LONG width, LONG height)
|
||||
{
|
||||
Destroy();
|
||||
m_pMask = new BYTE[width * height];
|
||||
|
||||
m_alpha_rbuf.attach(m_pMask, width, height, width);
|
||||
m_lWidth = width;
|
||||
m_lHeight = height;
|
||||
|
||||
m_pixf.attach(m_alpha_rbuf);
|
||||
m_base_renderer.attach(m_pixf);
|
||||
m_renderer.attach(m_base_renderer);
|
||||
|
||||
m_renderer.color(agg::gray8(0xFF, 0xFF));
|
||||
}
|
||||
|
||||
void CClipMask::ResetClip()
|
||||
{
|
||||
}
|
||||
|
||||
void CClipMask::GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix)
|
||||
{
|
||||
if (NULL == pPath)
|
||||
return;
|
||||
|
||||
memset(m_pMask, 0, m_lWidth * m_lHeight);
|
||||
|
||||
m_rasterizer.reset();
|
||||
|
||||
typedef agg::conv_transform<agg::path_storage> trans_type;
|
||||
trans_type trans(pPath->m_internal->m_agg_ps, pMatrix->m_internal->m_agg_mtx);
|
||||
|
||||
typedef agg::conv_curve<trans_type> conv_crv_type;
|
||||
conv_crv_type c_c_path(trans);
|
||||
|
||||
m_rasterizer.add_path(c_c_path);
|
||||
|
||||
agg::render_scanlines(m_rasterizer, m_sl, m_renderer);
|
||||
|
||||
m_bIsClip = true;
|
||||
}
|
||||
|
||||
agg::rendering_buffer CClipMask::GetRenderingBuffer()
|
||||
{
|
||||
return m_alpha_rbuf;
|
||||
}
|
||||
BYTE* CClipMask::GetMask()
|
||||
{
|
||||
return m_pMask;
|
||||
}
|
||||
bool CClipMask::IsClip()
|
||||
{
|
||||
return m_bIsClip;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CClip::CClip() : m_pixf(m_alpha_rbuf)
|
||||
{
|
||||
m_pMask = NULL;
|
||||
m_bIsClip = false;
|
||||
|
||||
m_lWidth = 0;
|
||||
m_lHeight = 0;
|
||||
}
|
||||
|
||||
CClip::~CClip()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void CClip::Destroy()
|
||||
{
|
||||
if (NULL != m_pMask)
|
||||
delete [] m_pMask;
|
||||
}
|
||||
|
||||
void CClip::Reset()
|
||||
{
|
||||
m_bIsClip = false;
|
||||
}
|
||||
|
||||
void CClip::Create(LONG width, LONG height)
|
||||
{
|
||||
}
|
||||
|
||||
void CClip::ResetClip()
|
||||
{
|
||||
}
|
||||
|
||||
void CClip::GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix)
|
||||
{
|
||||
if (NULL == pPath)
|
||||
return;
|
||||
|
||||
m_rasterizer.reset();
|
||||
|
||||
typedef agg::conv_transform<agg::path_storage> trans_type;
|
||||
trans_type trans(pPath->m_internal->m_agg_ps, pMatrix->m_internal->m_agg_mtx);
|
||||
|
||||
typedef agg::conv_curve<trans_type> conv_crv_type;
|
||||
conv_crv_type c_c_path(trans);
|
||||
|
||||
m_rasterizer.add_path(c_c_path);
|
||||
|
||||
m_bIsClip = true;
|
||||
}
|
||||
|
||||
agg::rendering_buffer CClip::GetRenderingBuffer()
|
||||
{
|
||||
return m_alpha_rbuf;
|
||||
}
|
||||
BYTE* CClip::GetMask()
|
||||
{
|
||||
return m_pMask;
|
||||
}
|
||||
bool CClip::IsClip()
|
||||
{
|
||||
return m_bIsClip;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CClipMulti::CClipMulti()
|
||||
{
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
}
|
||||
|
||||
CClipMulti::~CClipMulti()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CClipMulti::GetRasterizer
|
||||
*
|
||||
* @return Ponter to new rasterizer if there was no
|
||||
* clip yet, otherwise - nullptr
|
||||
*/
|
||||
CClipMulti::clip_rasterizer* CClipMulti::GetRasterizer()
|
||||
{
|
||||
if (!m_bIsClip)
|
||||
{
|
||||
m_rasterizer.reset();
|
||||
return &m_rasterizer;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CClipMulti::Create(LONG width, LONG height)
|
||||
{
|
||||
m_lWidth = width;
|
||||
@ -200,9 +69,16 @@ namespace Aggplus
|
||||
m_bIsClip2 = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CClipMulti::GenerateClip
|
||||
* @param pPath - vector graphics path for clip
|
||||
* @param pMatrix - transform matrix
|
||||
*
|
||||
* Create new rasterizer from path with transform maatrix and start clip.
|
||||
*/
|
||||
void CClipMulti::GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix)
|
||||
{
|
||||
if (NULL == pPath)
|
||||
if (pPath == nullptr)
|
||||
return;
|
||||
|
||||
m_rasterizer.reset();
|
||||
@ -212,83 +88,81 @@ namespace Aggplus
|
||||
|
||||
typedef agg::conv_curve<trans_type> conv_crv_type;
|
||||
conv_crv_type c_c_path(trans);
|
||||
|
||||
|
||||
m_rasterizer.add_path(c_c_path);
|
||||
m_rasterizer.filling_rule(pPath->m_internal->m_bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
GenerateClip2(pPath->m_internal->m_bEvenOdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CClipMulti::GenerateClip2
|
||||
* @param bEvenOdd - fill mode
|
||||
*
|
||||
* Set fill mode and start clip 1.
|
||||
*/
|
||||
void CClipMulti::GenerateClip2(bool bEvenOdd)
|
||||
{
|
||||
m_rasterizer.filling_rule(bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
m_bIsClip = true;
|
||||
m_bIsClip2 = false;
|
||||
}
|
||||
|
||||
void CClipMulti::Combine(CGraphicsPath* pPath, CMatrix* pMatrix, agg::sbool_op_e op)
|
||||
/**
|
||||
* @brief CClipMulti::Combine
|
||||
* @param bEvenOdd - fill mode
|
||||
* @param op - boolean operation
|
||||
* @param pRasterizer - another rasterizer for clip
|
||||
*
|
||||
* Performs the boolean operation. If there is no clip - create it.
|
||||
* If the first paart of the clip, execute it in storage. Perform
|
||||
* the second clip with storage.
|
||||
*/
|
||||
void CClipMulti::Combine(bool bEvenOdd, agg::sbool_op_e op, clip_rasterizer* pRasterizer)
|
||||
{
|
||||
if (!pRasterizer)
|
||||
return;
|
||||
|
||||
if (!m_bIsClip)
|
||||
return GenerateClip(pPath, pMatrix);
|
||||
return GenerateClip2(bEvenOdd);
|
||||
|
||||
if (!m_bIsClip2)
|
||||
{
|
||||
// смешивать надо с растерайзером
|
||||
agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> rasterizer;
|
||||
rasterizer.clip_box(0, 0, m_lWidth, m_lHeight);
|
||||
pRasterizer->filling_rule(bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
typedef agg::conv_transform<agg::path_storage> trans_type;
|
||||
trans_type trans(pPath->m_internal->m_agg_ps, pMatrix->m_internal->m_agg_mtx);
|
||||
|
||||
typedef agg::conv_curve<trans_type> conv_crv_type;
|
||||
conv_crv_type c_c_path(trans);
|
||||
|
||||
rasterizer.add_path(c_c_path);
|
||||
rasterizer.filling_rule(pPath->m_internal->m_bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
scanline_type sl1;
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
agg::sbool_combine_shapes_aa(op, m_rasterizer, rasterizer, sl1, sl2, sl, m_storage1);
|
||||
agg::sbool_combine_shapes_aa(op, m_rasterizer, *pRasterizer, sl1, sl2, sl, m_storage1);
|
||||
|
||||
m_lCurStorage = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// надо смешивать со стораджем
|
||||
agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> rasterizer;
|
||||
rasterizer.clip_box(0, 0, m_lWidth, m_lHeight);
|
||||
pRasterizer->filling_rule(op ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
typedef agg::conv_transform<agg::path_storage> trans_type;
|
||||
trans_type trans(pPath->m_internal->m_agg_ps, pMatrix->m_internal->m_agg_mtx);
|
||||
|
||||
typedef agg::conv_curve<trans_type> conv_crv_type;
|
||||
conv_crv_type c_c_path(trans);
|
||||
|
||||
rasterizer.add_path(c_c_path);
|
||||
rasterizer.filling_rule(pPath->m_internal->m_bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
scanline_type sl1;
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
scanline_type sl;
|
||||
|
||||
agg::sbool_combine_shapes_aa(op, rasterizer, (m_lCurStorage == 1) ? m_storage1 : m_storage2, sl1, sl2, sl,
|
||||
(m_lCurStorage == 1) ? m_storage2 : m_storage1);
|
||||
agg::sbool_combine_shapes_aa(op, *pRasterizer, (m_lCurStorage == 1) ? m_storage1 : m_storage2, sl1, sl2, sl,
|
||||
(m_lCurStorage == 1) ? m_storage2 : m_storage1);
|
||||
|
||||
if (1 == m_lCurStorage)
|
||||
{
|
||||
//m_storage1.prepare();
|
||||
m_lCurStorage = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_storage2.prepare();
|
||||
m_lCurStorage = 1;
|
||||
}
|
||||
}
|
||||
m_bIsClip2 = true;
|
||||
}
|
||||
|
||||
bool CClipMulti::IsClip()
|
||||
bool CClipMulti::IsClip() const
|
||||
{
|
||||
return m_bIsClip;
|
||||
}
|
||||
bool CClipMulti::IsClip2()
|
||||
|
||||
bool CClipMulti::IsClip2() const
|
||||
{
|
||||
return m_bIsClip2;
|
||||
}
|
||||
@ -296,10 +170,6 @@ namespace Aggplus
|
||||
void CClipMulti::Reset()
|
||||
{
|
||||
m_rasterizer.reset();
|
||||
|
||||
//m_storage1.prepare();
|
||||
//m_storage2.prepare();
|
||||
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
}
|
||||
|
||||
@ -54,95 +54,28 @@
|
||||
namespace Aggplus
|
||||
{
|
||||
|
||||
class CClipMask
|
||||
{
|
||||
typedef agg::renderer_base<agg::pixfmt_gray8> ren_base;
|
||||
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
|
||||
|
||||
friend class CGraphicsPath;
|
||||
public:
|
||||
BYTE* m_pMask;
|
||||
LONG m_lWidth;
|
||||
LONG m_lHeight;
|
||||
|
||||
agg::rendering_buffer m_alpha_rbuf;
|
||||
|
||||
agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> m_rasterizer;
|
||||
|
||||
agg::pixfmt_gray8 m_pixf;
|
||||
ren_base m_base_renderer;
|
||||
renderer m_renderer;
|
||||
|
||||
agg::scanline_p8 m_sl;
|
||||
|
||||
bool m_bIsClip;
|
||||
|
||||
public:
|
||||
CClipMask();
|
||||
~CClipMask();
|
||||
|
||||
void Destroy();
|
||||
void Reset();
|
||||
|
||||
public:
|
||||
void Create(LONG width, LONG height);
|
||||
void ResetClip();
|
||||
|
||||
void GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix);
|
||||
|
||||
agg::rendering_buffer GetRenderingBuffer();
|
||||
BYTE* GetMask();
|
||||
bool IsClip();
|
||||
};
|
||||
|
||||
class CClip
|
||||
{
|
||||
typedef agg::renderer_base<agg::pixfmt_gray8> ren_base;
|
||||
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
|
||||
|
||||
friend class CGraphicsPath;
|
||||
public:
|
||||
BYTE* m_pMask;
|
||||
LONG m_lWidth;
|
||||
LONG m_lHeight;
|
||||
|
||||
agg::rendering_buffer m_alpha_rbuf;
|
||||
|
||||
agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> m_rasterizer;
|
||||
|
||||
agg::pixfmt_gray8 m_pixf;
|
||||
ren_base m_base_renderer;
|
||||
renderer m_renderer;
|
||||
|
||||
agg::scanline_p8 m_sl;
|
||||
|
||||
bool m_bIsClip;
|
||||
|
||||
public:
|
||||
CClip();
|
||||
~CClip();
|
||||
|
||||
void Destroy();
|
||||
void Reset();
|
||||
|
||||
public:
|
||||
void Create(LONG width, LONG height);
|
||||
void ResetClip();
|
||||
|
||||
void GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix);
|
||||
|
||||
agg::rendering_buffer GetRenderingBuffer();
|
||||
BYTE* GetMask();
|
||||
bool IsClip();
|
||||
};
|
||||
|
||||
/**
|
||||
* @class CClipMulti
|
||||
* @brief Class providing boolean logic
|
||||
* for a raster graphics clip.
|
||||
*
|
||||
* Boolean algebra for rasterizer scanlines, which are
|
||||
* received from CGraphicsPath.
|
||||
*/
|
||||
class CClipMulti
|
||||
{
|
||||
typedef agg::scanline_p8 scanline_type;
|
||||
|
||||
public:
|
||||
agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> m_rasterizer;
|
||||
typedef agg::scanline_p8 scanline_type;
|
||||
typedef agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> clip_rasterizer;
|
||||
|
||||
clip_rasterizer m_rasterizer;
|
||||
|
||||
/**
|
||||
* @brief Interfaces for implementation graphics renderer scanlines.
|
||||
*
|
||||
* Scan lines can be stored in rasterizer as in case clip1
|
||||
* or in storage otherwise(clip2).
|
||||
*/
|
||||
agg::scanline_storage_aa8 m_storage1;
|
||||
agg::scanline_storage_aa8 m_storage2;
|
||||
|
||||
@ -158,13 +91,16 @@ public:
|
||||
CClipMulti();
|
||||
~CClipMulti();
|
||||
|
||||
clip_rasterizer* GetRasterizer();
|
||||
|
||||
void Create(LONG width, LONG height);
|
||||
void GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix);
|
||||
void GenerateClip2(bool bEvenOdd);
|
||||
|
||||
void Combine(CGraphicsPath* pPath, CMatrix* pMatrix, agg::sbool_op_e op);
|
||||
void Combine(bool bEvenOdd, agg::sbool_op_e op, clip_rasterizer* pRasterizer);
|
||||
|
||||
bool IsClip();
|
||||
bool IsClip2();
|
||||
bool IsClip() const;
|
||||
bool IsClip2() const;
|
||||
|
||||
void Reset();
|
||||
};
|
||||
|
||||
@ -502,18 +502,41 @@ namespace Aggplus
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphics::CombineClip(CGraphicsPath* pPath, agg::sbool_op_e op)
|
||||
Status CGraphics::CombineClip(CGraphicsPath* pPath, agg::sbool_op_e op, NSStructures::CPen* pPen)
|
||||
{
|
||||
Aggplus::CMatrix m;
|
||||
return InternalClip(pPath, (m_bIntegerGrid || pPath->m_internal->m_pTransform != NULL) ? &m : &m_oFullTransform, op);
|
||||
return InternalClip(pPath, (m_bIntegerGrid || pPath->m_internal->m_pTransform != NULL) ? &m : &m_oFullTransform, op, pPen);
|
||||
}
|
||||
|
||||
Status CGraphics::InternalClip(CGraphicsPath* pPath, CMatrix* pTransform, agg::sbool_op_e op)
|
||||
Status CGraphics::InternalClip(CGraphicsPath* pPath, CMatrix* pTransform, agg::sbool_op_e op, NSStructures::CPen* pPen)
|
||||
{
|
||||
if (NULL == pPath)
|
||||
return InvalidParameter;
|
||||
|
||||
m_oClip.Combine(pPath, pTransform, op);
|
||||
bool bTempRasterizer = false;
|
||||
CClipMulti::clip_rasterizer* pRasterizer = m_oClip.GetRasterizer();
|
||||
if (!pRasterizer)
|
||||
{
|
||||
pRasterizer = new CClipMulti::clip_rasterizer();
|
||||
pRasterizer->clip_box(0, 0, m_oClip.m_lWidth, m_oClip.m_lHeight);
|
||||
bTempRasterizer = true;
|
||||
}
|
||||
|
||||
agg::trans_affine* pAffine = NULL;
|
||||
if (pPen)
|
||||
pAffine = DoStrokePath(pPen, pPath, pRasterizer);
|
||||
else
|
||||
{
|
||||
typedef agg::conv_transform<agg::path_storage> trans_type;
|
||||
trans_type trans(pPath->m_internal->m_agg_ps, pTransform->m_internal->m_agg_mtx);
|
||||
|
||||
typedef agg::conv_curve<trans_type> conv_crv_type;
|
||||
conv_crv_type c_c_path(trans);
|
||||
|
||||
pRasterizer->add_path(c_c_path);
|
||||
}
|
||||
|
||||
m_oClip.Combine(pPath->m_internal->m_bEvenOdd, op, pRasterizer);
|
||||
|
||||
// write to clips history
|
||||
CGraphics_ClipStateRecord* pRecord = new CGraphics_ClipStateRecord();
|
||||
@ -522,6 +545,11 @@ namespace Aggplus
|
||||
pRecord->Operation = op;
|
||||
m_oClipState.AddRecord(pRecord);
|
||||
|
||||
if (pAffine)
|
||||
delete pAffine;
|
||||
if (bTempRasterizer)
|
||||
delete pRasterizer;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
@ -610,180 +638,7 @@ namespace Aggplus
|
||||
|
||||
m_rasterizer.get_rasterizer().reset();
|
||||
|
||||
agg::line_join_e LineJoin = agg::round_join;
|
||||
switch(pPen->LineJoin)
|
||||
{
|
||||
case LineJoinMiter : LineJoin = agg::miter_join_revert; break;
|
||||
case LineJoinBevel : LineJoin = agg::bevel_join; break;
|
||||
case LineJoinRound : LineJoin = agg::round_join; break;
|
||||
case LineJoinMiterClipped : LineJoin = agg::miter_join_revert; break;
|
||||
default: break;
|
||||
}
|
||||
agg::line_cap_e LineCap = agg::round_cap;
|
||||
switch(pPen->LineStartCap)
|
||||
{
|
||||
case LineCapFlat : LineCap = agg::butt_cap; break;
|
||||
case LineCapRound : LineCap = agg::round_cap; break;
|
||||
case LineCapSquare : LineCap = agg::square_cap; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
double dWidth = pPen->Size;
|
||||
if (!m_bIntegerGrid && m_bIs0PenWidthAs1px)
|
||||
{
|
||||
double dWidthMinSize, dSqrtDet = sqrt(abs(m_oFullTransform.m_internal->m_agg_mtx.determinant()));
|
||||
if (0 == dWidth)
|
||||
{
|
||||
double dX = 0.72, dY = 0.72;
|
||||
agg::trans_affine invert = ~m_oFullTransform.m_internal->m_agg_mtx;
|
||||
invert.transform_2x2(&dX, &dY);
|
||||
dWidth = std::min(abs(dX), abs(dY));
|
||||
}
|
||||
else if (0 != dSqrtDet && dWidth < (dWidthMinSize = 1.0 / dSqrtDet))
|
||||
dWidth = dWidthMinSize;
|
||||
}
|
||||
|
||||
double dblMiterLimit = pPen->MiterLimit;
|
||||
|
||||
agg::path_storage path_copy(pPath->m_internal->m_agg_ps);
|
||||
bool bIsUseIdentity = m_bIntegerGrid;
|
||||
if (!bIsUseIdentity)
|
||||
{
|
||||
agg::trans_affine* full_trans = &m_oFullTransform.m_internal->m_agg_mtx;
|
||||
double dDet = full_trans->determinant();
|
||||
|
||||
if (fabs(dDet) < 0.0001)
|
||||
{
|
||||
path_copy.transform_all_paths(m_oFullTransform.m_internal->m_agg_mtx);
|
||||
dWidth *= sqrt(fabs(dDet));
|
||||
|
||||
bIsUseIdentity = true;
|
||||
}
|
||||
}
|
||||
|
||||
typedef agg::conv_curve<agg::path_storage> conv_crv_type;
|
||||
|
||||
conv_crv_type c_c_path(path_copy);
|
||||
c_c_path.approximation_scale(25.0);
|
||||
c_c_path.approximation_method(agg::curve_inc);
|
||||
DashStyle eStyle = (DashStyle)pPen->DashStyle;
|
||||
|
||||
if (DashStyleCustom == eStyle)
|
||||
{
|
||||
if (0 == pPen->Count || NULL == pPen->DashPattern)
|
||||
{
|
||||
eStyle = DashStyleSolid;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bFoundNormal = false;
|
||||
for (int i = 0; i < pPen->Count; i++)
|
||||
{
|
||||
if (fabs(pPen->DashPattern[i]) > 0.0001)
|
||||
{
|
||||
bFoundNormal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFoundNormal)
|
||||
eStyle = DashStyleSolid;
|
||||
}
|
||||
}
|
||||
|
||||
agg::trans_affine* pAffine = &m_oFullTransform.m_internal->m_agg_mtx;
|
||||
if (bIsUseIdentity)
|
||||
pAffine = new agg::trans_affine();
|
||||
|
||||
if (DashStyleSolid == eStyle)
|
||||
{
|
||||
typedef agg::conv_stroke<conv_crv_type> Path_Conv_StrokeN;
|
||||
Path_Conv_StrokeN pgN(c_c_path);
|
||||
|
||||
//pgN.line_join(agg::miter_join_revert);
|
||||
|
||||
pgN.line_cap(LineCap);
|
||||
|
||||
pgN.line_join(LineJoin);
|
||||
pgN.inner_join(agg::inner_round);
|
||||
|
||||
pgN.miter_limit(dblMiterLimit);
|
||||
pgN.width(dWidth);
|
||||
|
||||
pgN.approximation_scale(25.0);
|
||||
|
||||
typedef agg::conv_transform<Path_Conv_StrokeN> transStroke;
|
||||
|
||||
transStroke trans(pgN, *pAffine);
|
||||
m_rasterizer.get_rasterizer().add_path(trans);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef agg::conv_dash<conv_crv_type> Path_Conv_Dash;
|
||||
Path_Conv_Dash poly2_dash(c_c_path);
|
||||
|
||||
typedef agg::conv_stroke<Path_Conv_Dash> Path_Conv_StrokeD;
|
||||
Path_Conv_StrokeD pgD(poly2_dash);
|
||||
|
||||
switch (eStyle)
|
||||
{
|
||||
case DashStyleDash:
|
||||
poly2_dash.add_dash(3.00*dWidth, dWidth);
|
||||
break;
|
||||
case DashStyleDot:
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
break;
|
||||
case DashStyleDashDot:
|
||||
poly2_dash.add_dash(3.00*dWidth, dWidth);
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
break;
|
||||
case DashStyleDashDotDot:
|
||||
poly2_dash.add_dash(3.00*dWidth, dWidth);
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
break;
|
||||
default:
|
||||
case DashStyleCustom:
|
||||
{
|
||||
double offset = pPen->DashOffset;
|
||||
double* params = pPen->DashPattern;
|
||||
LONG lCount = pPen->Count;
|
||||
LONG lCount2 = lCount / 2;
|
||||
|
||||
double dKoef = 1.0;
|
||||
|
||||
for (LONG i = 0; i < lCount2; ++i)
|
||||
{
|
||||
if (0 == i)
|
||||
{
|
||||
poly2_dash.add_dash((params[i * 2]) * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
else
|
||||
{
|
||||
poly2_dash.add_dash(params[i * 2] * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
}
|
||||
if (1 == (lCount % 2))
|
||||
{
|
||||
poly2_dash.add_dash(params[lCount - 1] * dKoef, 0);
|
||||
}
|
||||
poly2_dash.dash_start(offset * dKoef);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double dWidthMinSize = 1.0 / sqrt(abs(m_oCoordTransform.m_internal->m_agg_mtx.determinant()));
|
||||
if ((0 == dWidth && !m_bIntegerGrid) || dWidth < dWidthMinSize)
|
||||
dWidth = dWidthMinSize;
|
||||
|
||||
pgD.line_cap(LineCap);
|
||||
pgD.line_join(LineJoin);
|
||||
pgD.miter_limit(dblMiterLimit);
|
||||
pgD.width(dWidth);
|
||||
|
||||
agg::conv_transform<Path_Conv_StrokeD> trans(pgD, *pAffine);
|
||||
m_rasterizer.get_rasterizer().add_path(trans);
|
||||
}
|
||||
agg::trans_affine* pAffine = DoStrokePath(pPen, pPath, &m_rasterizer.get_rasterizer());
|
||||
|
||||
CColor oColor((BYTE)(pPen->Alpha * m_dGlobalAlpha), pPen->Color, m_bSwapRGB);
|
||||
CBrushSolid oBrush(oColor);
|
||||
@ -798,8 +653,7 @@ namespace Aggplus
|
||||
if (gamma >= 0)
|
||||
m_rasterizer.gamma(1.0);
|
||||
|
||||
if (bIsUseIdentity)
|
||||
RELEASEOBJECT(pAffine);
|
||||
RELEASEOBJECT(pAffine);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
@ -2243,6 +2097,186 @@ namespace Aggplus
|
||||
break;
|
||||
}
|
||||
}
|
||||
template<class Rasterizer>
|
||||
agg::trans_affine* CGraphics::DoStrokePath(NSStructures::CPen* pPen, CGraphicsPath* pPath, Rasterizer* pRasterizer)
|
||||
{
|
||||
agg::line_join_e LineJoin = agg::round_join;
|
||||
switch(pPen->LineJoin)
|
||||
{
|
||||
case LineJoinMiter : LineJoin = agg::miter_join_revert; break;
|
||||
case LineJoinBevel : LineJoin = agg::bevel_join; break;
|
||||
case LineJoinRound : LineJoin = agg::round_join; break;
|
||||
case LineJoinMiterClipped : LineJoin = agg::miter_join_revert; break;
|
||||
default: break;
|
||||
}
|
||||
agg::line_cap_e LineCap = agg::round_cap;
|
||||
switch(pPen->LineStartCap)
|
||||
{
|
||||
case LineCapFlat : LineCap = agg::butt_cap; break;
|
||||
case LineCapRound : LineCap = agg::round_cap; break;
|
||||
case LineCapSquare : LineCap = agg::square_cap; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
double dWidth = pPen->Size;
|
||||
if (!m_bIntegerGrid && m_bIs0PenWidthAs1px)
|
||||
{
|
||||
double dWidthMinSize, dSqrtDet = sqrt(abs(m_oFullTransform.m_internal->m_agg_mtx.determinant()));
|
||||
if (0 == dWidth)
|
||||
{
|
||||
double dX = 0.72, dY = 0.72;
|
||||
agg::trans_affine invert = ~m_oFullTransform.m_internal->m_agg_mtx;
|
||||
invert.transform_2x2(&dX, &dY);
|
||||
dWidth = std::min(abs(dX), abs(dY));
|
||||
}
|
||||
else if (0 != dSqrtDet && dWidth < (dWidthMinSize = 1.0 / dSqrtDet))
|
||||
dWidth = dWidthMinSize;
|
||||
}
|
||||
|
||||
double dblMiterLimit = pPen->MiterLimit;
|
||||
|
||||
agg::path_storage path_copy(pPath->m_internal->m_agg_ps);
|
||||
bool bIsUseIdentity = m_bIntegerGrid;
|
||||
if (!bIsUseIdentity)
|
||||
{
|
||||
agg::trans_affine* full_trans = &m_oFullTransform.m_internal->m_agg_mtx;
|
||||
double dDet = full_trans->determinant();
|
||||
|
||||
if (fabs(dDet) < 0.0001)
|
||||
{
|
||||
path_copy.transform_all_paths(m_oFullTransform.m_internal->m_agg_mtx);
|
||||
dWidth *= sqrt(fabs(dDet));
|
||||
|
||||
bIsUseIdentity = true;
|
||||
}
|
||||
}
|
||||
|
||||
typedef agg::conv_curve<agg::path_storage> conv_crv_type;
|
||||
|
||||
conv_crv_type c_c_path(path_copy);
|
||||
c_c_path.approximation_scale(25.0);
|
||||
c_c_path.approximation_method(agg::curve_inc);
|
||||
DashStyle eStyle = (DashStyle)pPen->DashStyle;
|
||||
|
||||
if (DashStyleCustom == eStyle)
|
||||
{
|
||||
if (0 == pPen->Count || NULL == pPen->DashPattern)
|
||||
{
|
||||
eStyle = DashStyleSolid;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bFoundNormal = false;
|
||||
for (int i = 0; i < pPen->Count; i++)
|
||||
{
|
||||
if (fabs(pPen->DashPattern[i]) > 0.0001)
|
||||
{
|
||||
bFoundNormal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFoundNormal)
|
||||
eStyle = DashStyleSolid;
|
||||
}
|
||||
}
|
||||
|
||||
agg::trans_affine* pAffine = &m_oFullTransform.m_internal->m_agg_mtx;
|
||||
if (bIsUseIdentity)
|
||||
pAffine = new agg::trans_affine();
|
||||
|
||||
if (DashStyleSolid == eStyle)
|
||||
{
|
||||
typedef agg::conv_stroke<conv_crv_type> Path_Conv_StrokeN;
|
||||
Path_Conv_StrokeN pgN(c_c_path);
|
||||
|
||||
//pgN.line_join(agg::miter_join_revert);
|
||||
|
||||
pgN.line_cap(LineCap);
|
||||
|
||||
pgN.line_join(LineJoin);
|
||||
pgN.inner_join(agg::inner_round);
|
||||
|
||||
pgN.miter_limit(dblMiterLimit);
|
||||
pgN.width(dWidth);
|
||||
|
||||
pgN.approximation_scale(25.0);
|
||||
|
||||
typedef agg::conv_transform<Path_Conv_StrokeN> transStroke;
|
||||
|
||||
transStroke trans(pgN, *pAffine);
|
||||
pRasterizer->add_path(trans);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef agg::conv_dash<conv_crv_type> Path_Conv_Dash;
|
||||
Path_Conv_Dash poly2_dash(c_c_path);
|
||||
|
||||
typedef agg::conv_stroke<Path_Conv_Dash> Path_Conv_StrokeD;
|
||||
Path_Conv_StrokeD pgD(poly2_dash);
|
||||
|
||||
switch (eStyle)
|
||||
{
|
||||
case DashStyleDash:
|
||||
poly2_dash.add_dash(3.00*dWidth, dWidth);
|
||||
break;
|
||||
case DashStyleDot:
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
break;
|
||||
case DashStyleDashDot:
|
||||
poly2_dash.add_dash(3.00*dWidth, dWidth);
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
break;
|
||||
case DashStyleDashDotDot:
|
||||
poly2_dash.add_dash(3.00*dWidth, dWidth);
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
poly2_dash.add_dash(dWidth, dWidth);
|
||||
break;
|
||||
default:
|
||||
case DashStyleCustom:
|
||||
{
|
||||
double offset = pPen->DashOffset;
|
||||
double* params = pPen->DashPattern;
|
||||
LONG lCount = pPen->Count;
|
||||
LONG lCount2 = lCount / 2;
|
||||
|
||||
double dKoef = 1.0;
|
||||
|
||||
for (LONG i = 0; i < lCount2; ++i)
|
||||
{
|
||||
if (0 == i)
|
||||
{
|
||||
poly2_dash.add_dash((params[i * 2]) * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
else
|
||||
{
|
||||
poly2_dash.add_dash(params[i * 2] * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
}
|
||||
if (1 == (lCount % 2))
|
||||
{
|
||||
poly2_dash.add_dash(params[lCount - 1] * dKoef, 0);
|
||||
}
|
||||
poly2_dash.dash_start(offset * dKoef);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double dWidthMinSize = 1.0 / sqrt(abs(m_oCoordTransform.m_internal->m_agg_mtx.determinant()));
|
||||
if ((0 == dWidth && !m_bIntegerGrid) || dWidth < dWidthMinSize)
|
||||
dWidth = dWidthMinSize;
|
||||
|
||||
pgD.line_cap(LineCap);
|
||||
pgD.line_join(LineJoin);
|
||||
pgD.miter_limit(dblMiterLimit);
|
||||
pgD.width(dWidth);
|
||||
|
||||
agg::conv_transform<Path_Conv_StrokeD> trans(pgD, *pAffine);
|
||||
pRasterizer->add_path(trans);
|
||||
}
|
||||
|
||||
return bIsUseIdentity ? pAffine : NULL;
|
||||
}
|
||||
// text methods
|
||||
int CGraphics::FillGlyph2(int nX, int nY, TGlyph* pGlyph, Aggplus::CBrush* pBrush)
|
||||
{
|
||||
|
||||
@ -360,8 +360,8 @@ public:
|
||||
Status SetClip(CGraphicsPath* pPath);
|
||||
Status ResetClip();
|
||||
Status ExclugeClip(CGraphicsPath* pPath);
|
||||
Status CombineClip(CGraphicsPath* pPath, agg::sbool_op_e op);
|
||||
Status InternalClip(CGraphicsPath* pPath, CMatrix* pTransform, agg::sbool_op_e op);
|
||||
Status CombineClip(CGraphicsPath* pPath, agg::sbool_op_e op, NSStructures::CPen* pPen = NULL);
|
||||
Status InternalClip(CGraphicsPath* pPath, CMatrix* pTransform, agg::sbool_op_e op, NSStructures::CPen* pPen = NULL);
|
||||
|
||||
// измерение текста
|
||||
INT MeasureString(const std::wstring& strText, CFontManager* pManager, double* lWidth, double* lHeight);
|
||||
@ -453,6 +453,8 @@ protected:
|
||||
void DoFillPathTextureClampSz3(const CMatrix &mImgMtx, const void *pImgBuff, DWORD dwImgWidth, DWORD dwImgHeight, int nImgStride, Aggplus::WrapMode wrapmode, BYTE Alpha = 255);
|
||||
|
||||
void DoFillPath(const CBrush* Brush);
|
||||
template<class Rasterizer>
|
||||
agg::trans_affine* DoStrokePath(NSStructures::CPen* pPen, CGraphicsPath* pPath, Rasterizer* ras);
|
||||
|
||||
// text methods
|
||||
int FillGlyph2(int nX, int nY, TGlyph* pGlyph, Aggplus::CBrush* pBrush);
|
||||
|
||||
@ -57,7 +57,6 @@ namespace Aggplus
|
||||
*this = paths[0];
|
||||
else
|
||||
{
|
||||
StartFigure();
|
||||
for (const auto& p : paths)
|
||||
{
|
||||
unsigned length = p.GetPointCount();
|
||||
@ -76,6 +75,7 @@ namespace Aggplus
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
//AddPath(p);
|
||||
if (p.Is_poly_closed()) CloseFigure();
|
||||
}
|
||||
}
|
||||
@ -139,11 +139,13 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps.move_to(x, y);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::LineTo(double x, double y)
|
||||
{
|
||||
m_internal->m_agg_ps.line_to(x, y);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
|
||||
{
|
||||
m_internal->m_agg_ps.curve4(x1, y1, x2, y2, x3, y3);
|
||||
@ -152,17 +154,17 @@ namespace Aggplus
|
||||
|
||||
Status CGraphicsPath::AddLine(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
if (Is_poly_closed())
|
||||
{
|
||||
m_internal->m_agg_ps.move_to(x1, y1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_internal->m_agg_ps.line_to(x1, y1);
|
||||
}
|
||||
if (Is_poly_closed())
|
||||
{
|
||||
m_internal->m_agg_ps.move_to(x1, y1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_internal->m_agg_ps.line_to(x1, y1);
|
||||
}
|
||||
|
||||
m_internal->m_agg_ps.line_to(x2, y2);
|
||||
return Ok;
|
||||
m_internal->m_agg_ps.line_to(x2, y2);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::AddLines(double* pPoints, int nCount)
|
||||
@ -171,22 +173,12 @@ namespace Aggplus
|
||||
{
|
||||
return InvalidParameter;
|
||||
}
|
||||
int nRet = 0;
|
||||
|
||||
if (!m_internal->m_bIsMoveTo)
|
||||
{
|
||||
MoveTo(pPoints[0], pPoints[1]);
|
||||
}
|
||||
|
||||
/*if (Is_poly_closed())
|
||||
{
|
||||
m_agg_ps.move_to((double)pPoints[0], (double)pPoints[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_agg_ps.line_to((double)pPoints[0], (double)pPoints[1]);
|
||||
}*/
|
||||
|
||||
int n = (nCount / 2) - 1;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
@ -194,6 +186,7 @@ namespace Aggplus
|
||||
const double* points = &pPoints[i * 2];
|
||||
m_internal->m_agg_ps.line_to(points[0], points[1]);
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
@ -207,6 +200,7 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps.curve4(x2, y2, x3, y3, x4, y4);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::AddBeziers(double* pPoints, int nCount)
|
||||
{
|
||||
if (8 > nCount)
|
||||
@ -256,22 +250,24 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps.join_path(arc, 0);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::AddRectangle(double x, double y, double width, double height)
|
||||
{
|
||||
m_internal->m_agg_ps.move_to(x, y);
|
||||
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::AddPolygon(double* pPoints, int nCount)
|
||||
{
|
||||
if (2 > nCount)
|
||||
{
|
||||
return InvalidParameter;
|
||||
}
|
||||
int nRet = 0;
|
||||
|
||||
if (Is_poly_closed())
|
||||
{
|
||||
@ -293,6 +289,7 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps.close_polygon();
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::AddPath(const CGraphicsPath& oPath)
|
||||
{
|
||||
typedef agg::conv_curve<agg::path_storage> conv_crv_type;
|
||||
@ -303,6 +300,7 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps.join_path(p3, 0);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::AddArc(double x, double y, double width, double height, double startAngle, double sweepAngle)
|
||||
{
|
||||
if(sweepAngle >= 360.0)
|
||||
@ -470,6 +468,7 @@ namespace Aggplus
|
||||
}
|
||||
return (Ok == MoveTo(x, y));
|
||||
}
|
||||
|
||||
bool CGraphicsPath::_LineTo(double x, double y)
|
||||
{
|
||||
if (NULL != m_internal->m_pTransform)
|
||||
@ -478,6 +477,7 @@ namespace Aggplus
|
||||
}
|
||||
return (Ok == LineTo(x, y));
|
||||
}
|
||||
|
||||
bool CGraphicsPath::_CurveTo(double x1, double y1, double x2, double y2, double x3, double y3)
|
||||
{
|
||||
if (NULL != m_internal->m_pTransform)
|
||||
@ -488,6 +488,7 @@ namespace Aggplus
|
||||
}
|
||||
return (Ok == CurveTo(x1, y1, x2, y2, x3, y3));
|
||||
}
|
||||
|
||||
bool CGraphicsPath::_Close()
|
||||
{
|
||||
return (Ok == CloseFigure());
|
||||
@ -502,6 +503,7 @@ namespace Aggplus
|
||||
pFont->LoadString1(strText, (float)x, (float)y);
|
||||
return (TRUE == pFont->GetStringPath(this)) ? Ok : InvalidParameter;
|
||||
}
|
||||
|
||||
Status CGraphicsPath::AddString(const unsigned int* pGids, const unsigned int nGidsCount, NSFonts::IFontManager* pFont, double x, double y)
|
||||
{
|
||||
if (NULL == pFont)
|
||||
@ -580,40 +582,40 @@ namespace Aggplus
|
||||
m_internal->m_agg_ps = psNew;
|
||||
}
|
||||
|
||||
int CGraphicsPath::EllipseArc(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, INT bClockDirection)
|
||||
int CGraphicsPath::EllipseArc(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, bool bClockDirection)
|
||||
{
|
||||
int nRet = 0;
|
||||
|
||||
while ( fAngle1 < 0 )
|
||||
while (fAngle1 < 0)
|
||||
fAngle1 += 360;
|
||||
|
||||
while ( fAngle1 > 360 )
|
||||
while (fAngle1 > 360)
|
||||
fAngle1 -= 360;
|
||||
|
||||
while ( fAngle2 < 0 )
|
||||
while (fAngle2 < 0)
|
||||
fAngle2 += 360;
|
||||
|
||||
while ( fAngle2 >= 360 )
|
||||
while (fAngle2 >= 360)
|
||||
fAngle2 -= 360;
|
||||
|
||||
if ( !bClockDirection )
|
||||
if (!bClockDirection)
|
||||
{
|
||||
if ( fAngle1 <= fAngle2 )
|
||||
nRet = EllipseArc2( fX, fY, fXRad, fYRad, fAngle1, fAngle2, FALSE );
|
||||
if (fAngle1 <= fAngle2)
|
||||
nRet = EllipseArc2(fX, fY, fXRad, fYRad, fAngle1, fAngle2, false);
|
||||
else
|
||||
{
|
||||
nRet += EllipseArc2( fX, fY, fXRad, fYRad, fAngle1, 360, FALSE );
|
||||
nRet += EllipseArc2( fX, fY, fXRad, fYRad, 0, fAngle2, FALSE );
|
||||
nRet += EllipseArc2(fX, fY, fXRad, fYRad, fAngle1, 360, false);
|
||||
nRet += EllipseArc2(fX, fY, fXRad, fYRad, 0, fAngle2, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fAngle1 >= fAngle2 )
|
||||
nRet = EllipseArc2( fX, fY, fXRad, fYRad, fAngle1, fAngle2, TRUE );
|
||||
if (fAngle1 >= fAngle2)
|
||||
nRet = EllipseArc2(fX, fY, fXRad, fYRad, fAngle1, fAngle2, true);
|
||||
else
|
||||
{
|
||||
nRet += EllipseArc2( fX, fY, fXRad, fYRad, fAngle1, 0, TRUE );
|
||||
nRet += EllipseArc2( fX, fY, fXRad, fYRad, 360, fAngle2, TRUE );
|
||||
nRet += EllipseArc2(fX, fY, fXRad, fYRad, fAngle1, 0, true);
|
||||
nRet += EllipseArc2(fX, fY, fXRad, fYRad, 360, fAngle2, true);
|
||||
}
|
||||
}
|
||||
return nRet;
|
||||
@ -624,10 +626,10 @@ namespace Aggplus
|
||||
// Функция для перевода реального угла в параметрическое задание эллписа
|
||||
// т.е. x= a cos(t) y = b sin(t) - параметрическое задание эллписа.
|
||||
// x = r cos(p), y = r sin(p) => t = atan2( sin(p) / b, cos(p) / a );
|
||||
return atan2( sin( fAngle ) / fYRad, cos( fAngle ) / fXRad );
|
||||
return atan2(sin(fAngle) / fYRad, cos(fAngle) / fXRad);
|
||||
}
|
||||
|
||||
int CGraphicsPath::EllipseArc2(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, INT bClockDirection)
|
||||
int CGraphicsPath::EllipseArc2(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, bool bClockDirection)
|
||||
{
|
||||
// переведем углы в радианы
|
||||
int nRet = 0;
|
||||
@ -638,79 +640,75 @@ namespace Aggplus
|
||||
// Выясним в каких четвертях находятся начальная и конечная точки
|
||||
unsigned int nFirstPointQuard = int(fAngle1) / 90 + 1;
|
||||
unsigned int nSecondPointQuard = int(fAngle2) / 90 + 1;
|
||||
nSecondPointQuard = std::min( 4, std::max( 1, (int)nSecondPointQuard ) );
|
||||
nFirstPointQuard = std::min( 4, std::max( 1, (int)nFirstPointQuard ) );
|
||||
nSecondPointQuard = std::min(4, std::max(1, (int)nSecondPointQuard));
|
||||
nFirstPointQuard = std::min(4, std::max(1, (int)nFirstPointQuard));
|
||||
// Проведем линию в начальную точку дуги
|
||||
double fStartX = 0.0, fStartY = 0.0, fEndX = 0.0, fEndY = 0.0;
|
||||
|
||||
fStartX = fX + fXRad * cos( AngToEllPrm( dAngle1, fXRad, fYRad ) );
|
||||
fStartY = fY + fYRad * sin( AngToEllPrm( dAngle1, fXRad, fYRad ) );
|
||||
fStartX = fX + fXRad * cos(AngToEllPrm(dAngle1, fXRad, fYRad));
|
||||
fStartY = fY + fYRad * sin(AngToEllPrm(dAngle1, fXRad, fYRad));
|
||||
|
||||
LineTo(fStartX, fStartY);
|
||||
|
||||
// Дальше рисуем по четверям
|
||||
|
||||
double fCurX = fStartX, fCurY = fStartY;
|
||||
double dStartAngle = dAngle1;
|
||||
double dEndAngle = 0;
|
||||
|
||||
if ( !bClockDirection )
|
||||
if (!bClockDirection)
|
||||
{
|
||||
for( unsigned int nIndex = nFirstPointQuard; nIndex <= nSecondPointQuard; nIndex++ )
|
||||
for(unsigned int nIndex = nFirstPointQuard; nIndex <= nSecondPointQuard; nIndex++)
|
||||
{
|
||||
if ( nIndex == nSecondPointQuard )
|
||||
if (nIndex == nSecondPointQuard)
|
||||
dEndAngle = dAngle2;
|
||||
else
|
||||
dEndAngle = (90 * (nIndex ) ) * 3.141592f / 180;
|
||||
if ( !( nIndex == nFirstPointQuard ) )
|
||||
dStartAngle = (90 * (nIndex - 1 ) ) * 3.141592f / 180;
|
||||
dEndAngle = (90 * nIndex) * 3.141592f / 180;
|
||||
if (!( nIndex == nFirstPointQuard))
|
||||
dStartAngle = (90 * (nIndex - 1)) * 3.141592f / 180;
|
||||
|
||||
EllipseArc3(fX, fY, fXRad, fYRad, AngToEllPrm( dStartAngle, fXRad, fYRad ), AngToEllPrm( dEndAngle, fXRad, fYRad ), &fEndX, &fEndY, FALSE);
|
||||
EllipseArc3(fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), &fEndX, &fEndY, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned int nIndex = nFirstPointQuard; nIndex >= nSecondPointQuard; nIndex-- )
|
||||
for(unsigned int nIndex = nFirstPointQuard; nIndex >= nSecondPointQuard; nIndex--)
|
||||
{
|
||||
if ( nIndex == nFirstPointQuard )
|
||||
if (nIndex == nFirstPointQuard)
|
||||
dStartAngle = dAngle1;
|
||||
else
|
||||
dStartAngle = (90 * (nIndex ) ) * 3.141592f / 180;
|
||||
if ( !( nIndex == nSecondPointQuard ) )
|
||||
dEndAngle = (90 * (nIndex - 1 ) ) * 3.141592f / 180;
|
||||
dStartAngle = (90 * nIndex) * 3.141592f / 180;
|
||||
if (!( nIndex == nSecondPointQuard))
|
||||
dEndAngle = (90 * (nIndex - 1)) * 3.141592f / 180;
|
||||
else
|
||||
dEndAngle = dAngle2;
|
||||
|
||||
EllipseArc3(fX, fY, fXRad, fYRad, AngToEllPrm( dStartAngle, fXRad, fYRad ), AngToEllPrm( dEndAngle, fXRad, fYRad ), &fEndX, &fEndY, FALSE);
|
||||
EllipseArc3(fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), &fEndX, &fEndY, false);
|
||||
}
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
int CGraphicsPath::EllipseArc3(double fX, double fY, double fXRad, double fYRad, double dAngle1, double dAngle2, double *pfXCur, double *pfYCur, INT bClockDirection)
|
||||
int CGraphicsPath::EllipseArc3(double fX, double fY, double fXRad, double fYRad, double dAngle1, double dAngle2, double *pfXCur, double *pfYCur, bool bClockDirection)
|
||||
{
|
||||
// Рассчитаем начальную, конечную и контрольные точки
|
||||
double fX1 = 0.0, fX2 = 0.0, fY1 = 0.0, fY2 = 0.0;
|
||||
double fCX1 = 0.0, fCX2 = 0.0, fCY1 = 0.0, fCY2 = 0.0;
|
||||
|
||||
double fAlpha = sin( dAngle2 - dAngle1 ) * ( sqrt( 4.0 + 3.0 * tan( (dAngle2 - dAngle1) / 2.0 ) * tan( (dAngle2 - dAngle1) / 2.0 ) ) - 1.0 ) / 3.0;
|
||||
double fAlpha = sin(dAngle2 - dAngle1) * (sqrt( 4.0 + 3.0 * tan((dAngle2 - dAngle1) / 2.0) * tan((dAngle2 - dAngle1) / 2.0 )) - 1.0 ) / 3.0;
|
||||
|
||||
double fKoef = 1;
|
||||
fX1 = fX + fXRad * cos(dAngle1);
|
||||
fY1 = fY + fYRad * sin(dAngle1);
|
||||
|
||||
fX1 = fX + fXRad * cos( dAngle1 );
|
||||
fY1 = fY + fYRad * sin( dAngle1 );
|
||||
fX2 = fX + fXRad * cos(dAngle2);
|
||||
fY2 = fY + fYRad * sin(dAngle2);
|
||||
|
||||
fX2 = fX + fXRad * cos( dAngle2 );
|
||||
fY2 = fY + fYRad * sin( dAngle2 );
|
||||
fCX1 = fX1 - fAlpha * fXRad * sin (dAngle1);
|
||||
fCY1 = fY1 + fAlpha * fYRad * cos (dAngle1);
|
||||
|
||||
fCX1 = fX1 - fAlpha * fXRad * sin ( dAngle1 );
|
||||
fCY1 = fY1 + fAlpha * fYRad * cos ( dAngle1 );
|
||||
fCX2 = fX2 + fAlpha * fXRad * sin (dAngle2);
|
||||
fCY2 = fY2 - fAlpha * fYRad * cos (dAngle2);
|
||||
|
||||
fCX2 = fX2 + fAlpha * fXRad * sin ( dAngle2 );
|
||||
fCY2 = fY2 - fAlpha * fYRad * cos ( dAngle2 );
|
||||
|
||||
if ( !bClockDirection )
|
||||
if (!bClockDirection)
|
||||
{
|
||||
CurveTo(fCX1, fCY1, fCX2, fCY2, fX2, fY2);
|
||||
|
||||
@ -1043,8 +1041,6 @@ namespace Aggplus
|
||||
return false;
|
||||
}
|
||||
|
||||
int nRet = 0;
|
||||
|
||||
if (!m_internal->m_bIsMoveTo)
|
||||
{
|
||||
_MoveTo(pData[0], pData[1]);
|
||||
@ -1373,8 +1369,6 @@ namespace Aggplus
|
||||
_LineTo(fStartX, fStartY);
|
||||
|
||||
// Дальше рисуем по четверям
|
||||
|
||||
double fCurX = fStartX, fCurY = fStartY;
|
||||
double dStartAngle = dAngle1;
|
||||
double dEndAngle = 0;
|
||||
|
||||
@ -1420,8 +1414,6 @@ namespace Aggplus
|
||||
|
||||
double fAlpha = sin( dAngle2 - dAngle1 ) * ( sqrt( 4.0 + 3.0 * tan( (dAngle2 - dAngle1) / 2.0 ) * tan( (dAngle2 - dAngle1) / 2.0 ) ) - 1.0 ) / 3.0;
|
||||
|
||||
double fKoef = 1;
|
||||
|
||||
fX1 = fX + fXRad * cos( dAngle1 );
|
||||
fY1 = fY + fYRad * sin( dAngle1 );
|
||||
|
||||
|
||||
@ -42,6 +42,11 @@
|
||||
|
||||
namespace Aggplus
|
||||
{
|
||||
/**
|
||||
* @class CGraphicsPath
|
||||
*
|
||||
* A container class that implements the logic of graphic paths.
|
||||
*/
|
||||
class CGraphicsPath_private;
|
||||
class GRAPHICS_DECL CGraphicsPath : public NSFonts::ISimpleGraphicsPath
|
||||
{
|
||||
@ -57,6 +62,9 @@ namespace Aggplus
|
||||
Status Reset();
|
||||
void SetRuler(bool bEvenOdd);
|
||||
|
||||
/**
|
||||
* @brief Methods implementing basic path commands.
|
||||
*/
|
||||
Status StartFigure();
|
||||
Status CloseFigure();
|
||||
bool Is_poly_closed() const;
|
||||
@ -64,7 +72,10 @@ namespace Aggplus
|
||||
Status LineTo(double x, double y);
|
||||
Status CurveTo(double x1, double y1, double x2, double y2, double x3, double y3);
|
||||
|
||||
// методы, которые просто будем сводить к трем основным
|
||||
/**
|
||||
* @brief Methods implementing additional commands for
|
||||
* more convenient creation of path.
|
||||
*/
|
||||
Status AddLine(double x1, double y1, double x2, double y2);
|
||||
Status AddLines(double* pPoints, int nCount);
|
||||
Status AddBezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4);
|
||||
@ -76,6 +87,9 @@ namespace Aggplus
|
||||
Status AddPath(const CGraphicsPath& oPath);
|
||||
Status AddArc(double x, double y, double width, double height, double startAngle, double sweepAngle);
|
||||
|
||||
/**
|
||||
* @brief Getter methods.
|
||||
*/
|
||||
ULONG GetPointCount() const;
|
||||
Status GetPathPoints(PointF* points, int count) const;
|
||||
Status GetLastPoint(double& x, double& y);
|
||||
@ -83,27 +97,41 @@ namespace Aggplus
|
||||
void GetBounds(double& left, double& top, double& width, double& height) const;
|
||||
void GetBoundsAccurate(double& left, double& top, double& width, double& height) const;
|
||||
|
||||
/**
|
||||
* @brief Methods implementing baasic path commands using
|
||||
* a transformation matrix to points.
|
||||
*/
|
||||
Status Transform(const CMatrix* matrix);
|
||||
virtual bool _MoveTo(double x, double y);
|
||||
virtual bool _LineTo(double x, double y);
|
||||
virtual bool _CurveTo(double x1, double y1, double x2, double y2, double x3, double y3);
|
||||
virtual bool _Close();
|
||||
|
||||
/**
|
||||
* @brief Methods for adding paths for text in Font manager.
|
||||
*/
|
||||
Status AddString(const std::wstring& strText, NSFonts::IFontManager* pFont, double x, double y);
|
||||
Status AddString(const unsigned int* pGids, const unsigned int nGidsCount, NSFonts::IFontManager* pFont, double x, double y);
|
||||
Status AddStringC(const LONG& lText, NSFonts::IFontManager* pFont, double x, double y);
|
||||
void z_Stroke(const double& size);
|
||||
void Widen(const double& size, const Aggplus::LineJoin& join, const CMatrix* matrix, float flatness);
|
||||
|
||||
int EllipseArc(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, INT bClockDirection);
|
||||
/**
|
||||
* @brief Methods implementing commands for creating arcs
|
||||
* (simple versions of Bezier curves).
|
||||
*/
|
||||
int EllipseArc(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, bool bClockDirection);
|
||||
double AngToEllPrm(double fAngle, double fXRad, double fYRad);
|
||||
int EllipseArc2(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, INT bClockDirection);
|
||||
int EllipseArc3(double fX, double fY, double fXRad, double fYRad, double dAngle1, double dAngle2, double* pfXCur, double* pfYCur, INT bClockDirection = FALSE);
|
||||
int EllipseArc2(double fX, double fY, double fXRad, double fYRad, double fAngle1, double fAngle2, bool bClockDirection);
|
||||
int EllipseArc3(double fX, double fY, double fXRad, double fYRad, double dAngle1, double dAngle2, double* pfXCur, double* pfYCur, bool bClockDirection = false);
|
||||
int Ellipse(double fX, double fY, double fXRad, double fYRad);
|
||||
Status AddArc2(double fX, double fY, double fWidth, double fHeight, double fStartAngle, double fSweepAngle);
|
||||
bool IsPointInPath(const double& x, const double& y);
|
||||
|
||||
// Methods for Path Clip
|
||||
/**
|
||||
* @brief Methods that are used when performing Boolean operations
|
||||
* on paths.
|
||||
*/
|
||||
unsigned GetCloseCount() const noexcept;
|
||||
unsigned GetMoveCount() const noexcept;
|
||||
bool IsClockwise() const noexcept;
|
||||
|
||||
@ -822,7 +822,8 @@ HRESULT CGraphicsRenderer::EndCommand(const DWORD& lType)
|
||||
m_pPath->SetRuler(bIsIn ? false : true);
|
||||
|
||||
INT bIsIntersect = (c_nClipRegionIntersect == (0x0100 & m_lCurrentClipMode));
|
||||
m_pRenderer->CombineClip(m_pPath, bIsIntersect ? agg::sbool_and : agg::sbool_or);
|
||||
INT bIsStrokePath = (c_nClipToStrokePath == (0x0010 & m_lCurrentClipMode));
|
||||
m_pRenderer->CombineClip(m_pPath, bIsIntersect ? agg::sbool_and : agg::sbool_or, bIsStrokePath ? &m_oPen : NULL);
|
||||
|
||||
//m_pRenderer->SetClip(m_pPath);
|
||||
break;
|
||||
|
||||
@ -96,6 +96,9 @@ const long c_nBaselineShift = 0xa041;
|
||||
// типы клипа
|
||||
const long c_nClipRegionTypeWinding = 0x0000;
|
||||
const long c_nClipRegionTypeEvenOdd = 0x0001;
|
||||
// тип преобразования пути для клипов
|
||||
const long c_nClipToPath = 0x0000;
|
||||
const long c_nClipToStrokePath = 0x0010;
|
||||
// тип объединения клипов
|
||||
const long c_nClipRegionIntersect = 0x0000;
|
||||
const long c_nClipRegionUnion = 0x0100;
|
||||
|
||||
@ -312,14 +312,14 @@ namespace Aggplus
|
||||
agg::trans_affine& m1 = mm1->m_internal->m_agg_mtx;
|
||||
agg::trans_affine& m2 = mm2->m_internal->m_agg_mtx;
|
||||
|
||||
bool bMain = (fabs(m1.sx - m2.sx) < eps &&
|
||||
fabs(m1.sy - m2.sy) < eps &&
|
||||
fabs(m1.shx - m2.shx) < eps &&
|
||||
fabs(m1.shy - m2.shy) < eps) ? true : false;
|
||||
bool bMain = fabs(m1.sx - m2.sx) < eps &&
|
||||
fabs(m1.sy - m2.sy) < eps &&
|
||||
fabs(m1.shx - m2.shx) < eps &&
|
||||
fabs(m1.shy - m2.shy) < eps;
|
||||
|
||||
if (!bMain || bIsOnlyMain)
|
||||
return bMain;
|
||||
|
||||
return (fabs(m1.tx - m2.tx) < eps && fabs(m1.ty - m2.ty) < eps) ? true : false;
|
||||
return fabs(m1.tx - m2.tx) < eps && fabs(m1.ty - m2.ty) < eps;
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,13 +153,6 @@ IMetafileToRenderter::IMetafileToRenderter(IRenderer* pRenderer)
|
||||
}
|
||||
IMetafileToRenderter::~IMetafileToRenderter()
|
||||
{
|
||||
for (std::vector<std::wstring>::iterator i = m_arTempFiles.begin(); i != m_arTempFiles.end(); i++)
|
||||
{
|
||||
std::wstring sPath = *i;
|
||||
if (NSFile::CFileBinary::Exists(sPath))
|
||||
NSFile::CFileBinary::Remove(sPath);
|
||||
}
|
||||
|
||||
if (m_pPicker)
|
||||
{
|
||||
CMetafileFontPicker* pPicker = (CMetafileFontPicker*)m_pPicker;
|
||||
@ -234,8 +227,6 @@ std::wstring IMetafileToRenderter::GetImagePath(const std::wstring& sPath)
|
||||
oFrame.put_Data(NULL);
|
||||
sImagePath = sTempFile;
|
||||
}
|
||||
|
||||
m_arTempFiles.push_back(sTempFile);
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(pImageBuffer);
|
||||
|
||||
@ -49,7 +49,6 @@ public:
|
||||
|
||||
protected:
|
||||
std::wstring m_sTempDir;
|
||||
std::vector<std::wstring> m_arTempFiles;
|
||||
|
||||
std::wstring m_sThemesDir;
|
||||
std::wstring m_sMediaDir;
|
||||
|
||||
@ -129,9 +129,7 @@ inline bool isCollinear(const Aggplus::PointD& p1, const Aggplus::PointD& p2)
|
||||
|
||||
inline int getIterations(const double& a, const double& b)
|
||||
{
|
||||
double n1 = 2.0, n2 = 16.0;
|
||||
|
||||
return std::max(n1, std::min(n2, ceil(fabs(b - a) * 32)));
|
||||
return std::max(2, std::min(16, static_cast<int>(ceil(fabs(b - a) * 32))));
|
||||
}
|
||||
|
||||
inline double CurveLength(const double& t, const double& ax, const double& bx, const double& cx,
|
||||
@ -143,64 +141,17 @@ inline double CurveLength(const double& t, const double& ax, const double& bx, c
|
||||
inline double integrate(const double& ax, const double& bx, const double& cx, const double& ay,
|
||||
const double& by, const double& cy, const double& a, const double& b, size_t n = 16)
|
||||
{
|
||||
std::vector<double> x = ABSCISSAS[n - 2],
|
||||
w = WEIGHT[n - 2];
|
||||
|
||||
double A = (b - a) * 0.5,
|
||||
B = A + a;
|
||||
double sum = n & 1 ? CurveLength(B, ax, bx, cx, ay, by, cy) : 0.0;
|
||||
double A = (b - a) * 0.5;
|
||||
double sum = n & 1 ? CurveLength(A + a, ax, bx, cx, ay, by, cy) : 0.0;
|
||||
|
||||
for (size_t i = 0; i < (n + 1) >> 1; i++)
|
||||
{
|
||||
double Ax = A * x[i];
|
||||
sum += w[i] * (CurveLength(B + Ax, ax, bx, cx, ay, by, cy) +
|
||||
CurveLength(B - Ax, ax, bx, cx, ay, by, cy));
|
||||
}
|
||||
sum += WEIGHT[n - 2][i] * (CurveLength(A + a + A * ABSCISSAS[n - 2][i], ax, bx, cx, ay, by, cy) +
|
||||
CurveLength(A + a - A * ABSCISSAS[n - 2][i], ax, bx, cx, ay, by, cy));
|
||||
|
||||
return A * sum;
|
||||
}
|
||||
|
||||
double fLength(const double& t, double& length, double& start, const double& offset,
|
||||
const double& ax, const double& bx, const double& cx, const double& ay,
|
||||
const double& by, const double& cy)
|
||||
{
|
||||
length += integrate(ax, bx, cx, ay, by, cy, start, t, getIterations(start, t));
|
||||
start = t;
|
||||
|
||||
return length - offset;
|
||||
}
|
||||
|
||||
double findRoot(double& length, double& start, const double& offset, const double& ax,
|
||||
const double& bx, const double& cx, const double& ay, const double& by,
|
||||
const double& cy, double x, double a, double b)
|
||||
{
|
||||
for (size_t i = 0; i < 32; i++)
|
||||
{
|
||||
double fx = fLength(x, length, start, offset, ax, bx, cx, ay, by, cy),
|
||||
dx = fx / CurveLength(x, ax, bx, cx, ay, by, cy),
|
||||
nx = x - dx;
|
||||
|
||||
if (fabs(dx) < EPSILON)
|
||||
{
|
||||
x = nx;
|
||||
break;
|
||||
}
|
||||
|
||||
if (fx > 0)
|
||||
{
|
||||
b = x;
|
||||
x = nx <= a ? (a + b) * 0.5 : nx;
|
||||
}
|
||||
else{
|
||||
a = x;
|
||||
x = nx >= b ? (a + b) * 0.5 : nx;
|
||||
}
|
||||
}
|
||||
|
||||
return clamp(x, a, b);
|
||||
}
|
||||
|
||||
bool intersect(std::vector<double> v, Aggplus::PointD& res)
|
||||
inline bool intersect(std::vector<double> v, Aggplus::PointD& res)
|
||||
{
|
||||
v[2] -= v[0];
|
||||
v[3] -= v[1];
|
||||
@ -229,7 +180,7 @@ bool intersect(std::vector<double> v, Aggplus::PointD& res)
|
||||
return false;
|
||||
}
|
||||
|
||||
void getConvexHull(const double& dq0, const double& dq1,
|
||||
inline void getConvexHull(const double& dq0, const double& dq1,
|
||||
const double& dq2, const double& dq3,
|
||||
std::vector<Aggplus::PointD>& top,
|
||||
std::vector<Aggplus::PointD>& bottom)
|
||||
@ -297,7 +248,7 @@ void getConvexHull(const double& dq0, const double& dq1,
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
double clipConvexHullPart(const std::vector<Aggplus::PointD>& part, const bool& top,
|
||||
inline double clipConvexHullPart(const std::vector<Aggplus::PointD>& part, const bool& top,
|
||||
const double& threshold)
|
||||
{
|
||||
double px = part[0].X,
|
||||
@ -348,7 +299,7 @@ inline int binarySearch(const std::vector<std::vector<double>>& allBounds,
|
||||
}
|
||||
|
||||
inline double getSignedDistance(const double& px, const double& py, double vx, double vy,
|
||||
const double& x, const double& y, bool asVector = false)
|
||||
const double& x, const double& y, const bool& asVector)
|
||||
{
|
||||
if (!asVector)
|
||||
{
|
||||
@ -371,38 +322,6 @@ inline double getSignedDistance(const double& px, const double& py, double vx, d
|
||||
return vx0 ? distX : vy0 ? distY : distXY;
|
||||
}
|
||||
|
||||
inline double getDistance(const double& px, const double& py, const double& vx, const double& vy,
|
||||
const double& x, const double& y, const bool& asVector)
|
||||
{
|
||||
return fabs(getSignedDistance(px, py, vx, vy, x, y, asVector));
|
||||
}
|
||||
|
||||
inline double getDistance(const double& px, const double& py, const double& vx, const double& vy,
|
||||
const double& x, const double& y)
|
||||
{
|
||||
if (vx == 0)
|
||||
{
|
||||
if (vy > 0)
|
||||
return std::abs(x - px);
|
||||
else
|
||||
return std::abs(px - x);
|
||||
}
|
||||
if (vy == 0)
|
||||
{
|
||||
if (vx < 0)
|
||||
return std::abs(y - py);
|
||||
else
|
||||
return std::abs(py -y);
|
||||
}
|
||||
|
||||
bool dir = vy > vx;
|
||||
double dist = (x- px) * vy - (y - py) * vx,
|
||||
epsY = vy * sqrt(1 + (vx * vx) / (vy * vy)),
|
||||
epsX = vx * sqrt(1 + (vy * vy) / (vx * vx));
|
||||
|
||||
return dist / (dir ? epsY : epsX);
|
||||
}
|
||||
|
||||
inline double getDistance(const double& x1, const double& y1, const double& x2, const double& y2)
|
||||
{
|
||||
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
||||
@ -450,7 +369,7 @@ inline double getDiscriminant(const double& a, const double& b, const double& c)
|
||||
return D;
|
||||
}
|
||||
|
||||
int solveQuadratic(double a, double b, double c, std::vector<double>& roots,
|
||||
inline int solveQuadratic(double a, double b, double c, std::vector<double>& roots,
|
||||
const double& mn, const double& mx)
|
||||
{
|
||||
double x1 = MAX, x2 = MAX;
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annotaion)
|
||||
{
|
||||
m_nType = -1;
|
||||
m_nType = EAnnotType::Unknown;
|
||||
|
||||
m_nFlag = 0;
|
||||
m_nID = 0;
|
||||
@ -75,6 +75,7 @@ CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annot
|
||||
m_pPopupPr = NULL;
|
||||
m_pFreeTextPr = NULL;
|
||||
m_pCaretPr = NULL;
|
||||
m_pStampPr = NULL;
|
||||
m_pWidgetPr = NULL;
|
||||
}
|
||||
CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
@ -89,112 +90,112 @@ CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
RELEASEOBJECT(m_pPopupPr);
|
||||
RELEASEOBJECT(m_pFreeTextPr);
|
||||
RELEASEOBJECT(m_pCaretPr);
|
||||
RELEASEOBJECT(m_pStampPr);
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
}
|
||||
|
||||
void CAnnotFieldInfo::CreateMarkup()
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
}
|
||||
void CAnnotFieldInfo::SetType(int nType)
|
||||
{
|
||||
m_nType = nType;
|
||||
switch (nType)
|
||||
m_nType = static_cast<EAnnotType>(nType);
|
||||
switch (m_nType)
|
||||
{
|
||||
case 0:
|
||||
case EAnnotType::Text:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pTextPr);
|
||||
m_pTextPr = new CAnnotFieldInfo::CTextAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case EAnnotType::FreeText:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pFreeTextPr);
|
||||
m_pFreeTextPr = new CAnnotFieldInfo::CFreeTextAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case EAnnotType::Line:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pLinePr);
|
||||
m_pLinePr = new CAnnotFieldInfo::CLineAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
case EAnnotType::Square:
|
||||
case EAnnotType::Circle:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pSquareCirclePr);
|
||||
m_pSquareCirclePr = new CAnnotFieldInfo::CSquareCircleAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
case 7:
|
||||
case EAnnotType::PolygonLine:
|
||||
case EAnnotType::PolyLine:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pPolygonLinePr);
|
||||
m_pPolygonLinePr = new CAnnotFieldInfo::CPolygonLineAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case EAnnotType::Highlight:
|
||||
case EAnnotType::Underline:
|
||||
case EAnnotType::Squiggly:
|
||||
case EAnnotType::Strikeout:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pTextMarkupPr);
|
||||
m_pTextMarkupPr = new CAnnotFieldInfo::CTextMarkupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
case EAnnotType::Stamp:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pStampPr);
|
||||
m_pStampPr = new CAnnotFieldInfo::CStampAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Caret:
|
||||
{
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pCaretPr);
|
||||
m_pCaretPr = new CAnnotFieldInfo::CCaretAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
case EAnnotType::Ink:
|
||||
{
|
||||
RELEASEOBJECT(m_pMarkupPr);
|
||||
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
|
||||
|
||||
CreateMarkup();
|
||||
RELEASEOBJECT(m_pInkPr);
|
||||
m_pInkPr = new CAnnotFieldInfo::CInkAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
case EAnnotType::Popup:
|
||||
{
|
||||
RELEASEOBJECT(m_pPopupPr);
|
||||
m_pPopupPr = new CAnnotFieldInfo::CPopupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 29:
|
||||
case 30:
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:
|
||||
case EAnnotType::Widget:
|
||||
case EAnnotType::WidgetPushButton:
|
||||
case EAnnotType::WidgetRadioButton:
|
||||
case EAnnotType::WidgetCheckBox:
|
||||
case EAnnotType::WidgetText:
|
||||
case EAnnotType::WidgetCombobox:
|
||||
case EAnnotType::WidgetListbox:
|
||||
case EAnnotType::WidgetSignature:
|
||||
{
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
m_pWidgetPr = new CAnnotFieldInfo::CWidgetAnnotPr(nType);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
CAnnotFieldInfo::EAnnotType CAnnotFieldInfo::GetType() { return m_nType; }
|
||||
|
||||
void CAnnotFieldInfo::GetBounds(double& dX1, double& dY1, double& dX2, double& dY2)
|
||||
{
|
||||
@ -285,6 +286,10 @@ bool CAnnotFieldInfo::IsCaret() const
|
||||
{
|
||||
return (m_nType == 13);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsStamp() const
|
||||
{
|
||||
return (m_nType == 12);
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CMarkupAnnotPr* CAnnotFieldInfo::GetMarkupAnnotPr() { return m_pMarkupPr; }
|
||||
CAnnotFieldInfo::CTextAnnotPr* CAnnotFieldInfo::GetTextAnnotPr() { return m_pTextPr; }
|
||||
@ -296,6 +301,7 @@ CAnnotFieldInfo::CPolygonLineAnnotPr* CAnnotFieldInfo::GetPolygonLineAnnotPr()
|
||||
CAnnotFieldInfo::CPopupAnnotPr* CAnnotFieldInfo::GetPopupAnnotPr() { return m_pPopupPr; }
|
||||
CAnnotFieldInfo::CFreeTextAnnotPr* CAnnotFieldInfo::GetFreeTextAnnotPr() { return m_pFreeTextPr; }
|
||||
CAnnotFieldInfo::CCaretAnnotPr* CAnnotFieldInfo::GetCaretAnnotPr() { return m_pCaretPr; }
|
||||
CAnnotFieldInfo::CStampAnnotPr* CAnnotFieldInfo::GetStampAnnotPr() { return m_pStampPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr* CAnnotFieldInfo::GetWidgetAnnotPr() { return m_pWidgetPr; }
|
||||
|
||||
bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
@ -327,6 +333,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -337,6 +344,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
if (m_oBorder.nType == 2)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_oBorder.arrDash.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_oBorder.arrDash.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -375,6 +383,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_pFreeTextPr->Read(pReader, nFlags);
|
||||
else if (IsCaret())
|
||||
m_pCaretPr->Read(pReader, nFlags);
|
||||
else if (IsStamp())
|
||||
m_pStampPr->Read(pReader, nFlags);
|
||||
}
|
||||
else if (IsPopup())
|
||||
m_pPopupPr->Read(pReader);
|
||||
@ -410,6 +420,7 @@ void CAnnotFieldInfo::CMarkupAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
int nFont = pReader->ReadInt();
|
||||
m_arrRC.reserve(nFont);
|
||||
for (int i = 0; i < nFont; ++i)
|
||||
{
|
||||
CFontData* pFont = new CFontData();
|
||||
@ -462,6 +473,7 @@ void CAnnotFieldInfo::CInkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* p
|
||||
{
|
||||
std::vector<double> arrLine;
|
||||
int m = pReader->ReadInt();
|
||||
arrLine.reserve(m);
|
||||
for (int j = 0; j < m; ++j)
|
||||
arrLine.push_back(pReader->ReadDouble());
|
||||
if (!arrLine.empty())
|
||||
@ -494,6 +506,7 @@ void CAnnotFieldInfo::CLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
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());
|
||||
}
|
||||
@ -521,6 +534,7 @@ void CAnnotFieldInfo::CTextMarkupAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRe
|
||||
{
|
||||
m_nSubtype = nType;
|
||||
int n = pReader->ReadInt();
|
||||
m_arrQuadPoints.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -541,6 +555,7 @@ void CAnnotFieldInfo::CSquareCircleAnnotPr::Read(NSOnlineOfficeBinToPdf::CBuffer
|
||||
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());
|
||||
}
|
||||
@ -554,6 +569,7 @@ const std::vector<double>& CAnnotFieldInfo::CPolygonLineAnnotPr::GetVertices() {
|
||||
void CAnnotFieldInfo::CPolygonLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrVertices.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrVertices.push_back(pReader->ReadDouble());
|
||||
|
||||
@ -566,6 +582,7 @@ void CAnnotFieldInfo::CPolygonLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferR
|
||||
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());
|
||||
}
|
||||
@ -595,6 +612,7 @@ void CAnnotFieldInfo::CFreeTextAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRead
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrCL.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrCL.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -607,6 +625,7 @@ void CAnnotFieldInfo::CFreeTextAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRead
|
||||
if (nFlags & (1 << 21))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrIC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrIC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -627,6 +646,19 @@ void CAnnotFieldInfo::CCaretAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
m_nSy = pReader->ReadByte();
|
||||
}
|
||||
|
||||
double CAnnotFieldInfo::CStampAnnotPr::GetRotate() { return m_nRotate; }
|
||||
const std::wstring& CAnnotFieldInfo::CStampAnnotPr::GetName() { return m_wsName; }
|
||||
void CAnnotFieldInfo::CStampAnnotPr::GetInRect(double& dRD1, double& dRD2, double& dRD3, double& dRD4) { dRD1 = m_dInRect[0]; dRD2 = m_dInRect[1]; dRD3 = m_dInRect[2]; dRD4 = m_dInRect[3]; }
|
||||
void CAnnotFieldInfo::CStampAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags)
|
||||
{
|
||||
m_wsName = pReader->ReadString();
|
||||
m_nRotate = pReader->ReadDouble();
|
||||
m_dInRect[0] = pReader->ReadDouble();
|
||||
m_dInRect[1] = pReader->ReadDouble();
|
||||
m_dInRect[2] = pReader->ReadDouble();
|
||||
m_dInRect[3] = 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; }
|
||||
@ -654,6 +686,7 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetDV() { return m_wsDV; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetT() { return m_wsT; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontName() { return m_wsFN; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontKey() { return m_wsFK; }
|
||||
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetOMetadata() { return m_wsOMetadata; }
|
||||
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; }
|
||||
@ -783,6 +816,7 @@ CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPd
|
||||
{
|
||||
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;
|
||||
@ -791,6 +825,7 @@ CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPd
|
||||
{
|
||||
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;
|
||||
@ -810,6 +845,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
m_nFontStyle = pReader->ReadInt();
|
||||
|
||||
int n = pReader->ReadInt();
|
||||
m_arrTC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrTC.push_back(pReader->ReadDouble());
|
||||
|
||||
@ -832,6 +868,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
if (nFlags & (1 << 5))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -840,6 +877,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
if (nFlags & (1 << 7))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBG.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBG.push_back(pReader->ReadDouble());
|
||||
}
|
||||
@ -849,6 +887,8 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
|
||||
m_nParentID = pReader->ReadInt();
|
||||
if (nFlags & (1 << 18))
|
||||
m_wsT = pReader->ReadString();
|
||||
if (nFlags & (1 << 20))
|
||||
m_wsOMetadata = pReader->ReadString();
|
||||
|
||||
// Action
|
||||
int nAction = pReader->ReadInt();
|
||||
@ -975,6 +1015,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr::Read(NSOnlineOfficeBinToP
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrOpt.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::wstring s1 = pReader->ReadString();
|
||||
@ -989,12 +1030,14 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr::Read(NSOnlineOfficeBinToP
|
||||
if (nFlags & (1 << 13))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrV.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrV.push_back(pReader->ReadString());
|
||||
}
|
||||
if (nFlags & (1 << 14))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrI.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrI.push_back(pReader->ReadInt());
|
||||
}
|
||||
@ -1027,10 +1070,12 @@ const std::vector<CWidgetsInfo::CParent*>& CWidgetsInfo::GetParents() { return m
|
||||
bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrCO.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrCO.push_back(pReader->ReadInt());
|
||||
|
||||
n = pReader->ReadInt();
|
||||
m_arrParents.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
CParent* pParent = new CParent();
|
||||
@ -1046,6 +1091,7 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
if (nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
pParent->arrI.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pParent->arrI.push_back(pReader->ReadInt());
|
||||
}
|
||||
@ -1054,6 +1100,7 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
if (nFlags & (1 << 5))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
pParent->arrV.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
pParent->arrV.push_back(pReader->ReadString());
|
||||
}
|
||||
@ -1061,6 +1108,7 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
}
|
||||
|
||||
n = pReader->ReadInt();
|
||||
m_arrButtonImg.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::string sImagePath = pReader->ReadStringA();
|
||||
|
||||
@ -39,6 +39,36 @@ class IMetafileToRenderter;
|
||||
class GRAPHICS_DECL CAnnotFieldInfo : public IAdvancedCommand
|
||||
{
|
||||
public:
|
||||
enum EAnnotType
|
||||
{
|
||||
Unknown = -1,
|
||||
Text = 0,
|
||||
Link = 1,
|
||||
FreeText = 2,
|
||||
Line = 3,
|
||||
Square = 4,
|
||||
Circle = 5,
|
||||
PolygonLine = 6,
|
||||
PolyLine = 7,
|
||||
Highlight = 8,
|
||||
Underline = 9,
|
||||
Squiggly = 10,
|
||||
Strikeout = 11,
|
||||
Stamp = 12,
|
||||
Caret = 13,
|
||||
Ink = 14,
|
||||
Popup = 15,
|
||||
FileAttachment = 16,
|
||||
Widget = 26,
|
||||
WidgetPushButton = 27,
|
||||
WidgetRadioButton = 28,
|
||||
WidgetCheckBox = 29,
|
||||
WidgetText = 30,
|
||||
WidgetCombobox = 31,
|
||||
WidgetListbox = 32,
|
||||
WidgetSignature = 33
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CWidgetAnnotPr
|
||||
{
|
||||
public:
|
||||
@ -164,6 +194,7 @@ public:
|
||||
const std::wstring& GetT();
|
||||
const std::wstring& GetFontName();
|
||||
const std::wstring& GetFontKey();
|
||||
const std::wstring& GetOMetadata();
|
||||
const std::vector<double>& GetTC();
|
||||
const std::vector<double>& GetBC();
|
||||
const std::vector<double>& GetBG();
|
||||
@ -193,6 +224,7 @@ public:
|
||||
std::wstring m_wsT;
|
||||
std::wstring m_wsFN;
|
||||
std::wstring m_wsFK;
|
||||
std::wstring m_wsOMetadata;
|
||||
std::vector<double> m_arrTC;
|
||||
std::vector<double> m_arrBC;
|
||||
std::vector<double> m_arrBG;
|
||||
@ -405,10 +437,27 @@ public:
|
||||
double m_dRD[4]{};
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CStampAnnotPr
|
||||
{
|
||||
public:
|
||||
double GetRotate();
|
||||
const std::wstring& GetName();
|
||||
void GetInRect(double& dRD1, double& dRD2, double& dRD3, double& dRD4);
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags);
|
||||
|
||||
private:
|
||||
double m_nRotate;
|
||||
std::wstring m_wsName;
|
||||
double m_dInRect[4]{};
|
||||
};
|
||||
|
||||
CAnnotFieldInfo();
|
||||
virtual ~CAnnotFieldInfo();
|
||||
|
||||
void CreateMarkup();
|
||||
void SetType(int nType);
|
||||
EAnnotType GetType();
|
||||
|
||||
void GetBounds(double& dX1, double& dY1, double& dX2, double& dY2);
|
||||
void GetBorder(BYTE& nType, double& dWidth, std::vector<double>& arrDash);
|
||||
@ -439,6 +488,7 @@ public:
|
||||
bool IsPopup() const;
|
||||
bool IsFreeText() const;
|
||||
bool IsCaret() const;
|
||||
bool IsStamp() const;
|
||||
|
||||
CMarkupAnnotPr* GetMarkupAnnotPr();
|
||||
CTextAnnotPr* GetTextAnnotPr();
|
||||
@ -450,6 +500,7 @@ public:
|
||||
CPopupAnnotPr* GetPopupAnnotPr();
|
||||
CFreeTextAnnotPr* GetFreeTextAnnotPr();
|
||||
CCaretAnnotPr* GetCaretAnnotPr();
|
||||
CStampAnnotPr* GetStampAnnotPr();
|
||||
CWidgetAnnotPr* GetWidgetAnnotPr();
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
@ -462,7 +513,7 @@ private:
|
||||
std::vector<double> arrDash;
|
||||
};
|
||||
|
||||
int m_nType;
|
||||
EAnnotType m_nType;
|
||||
double m_dX1;
|
||||
double m_dY1;
|
||||
double m_dX2;
|
||||
@ -491,6 +542,7 @@ private:
|
||||
CPopupAnnotPr* m_pPopupPr;
|
||||
CFreeTextAnnotPr* m_pFreeTextPr;
|
||||
CCaretAnnotPr* m_pCaretPr;
|
||||
CStampAnnotPr* m_pStampPr;
|
||||
CWidgetAnnotPr* m_pWidgetPr;
|
||||
};
|
||||
|
||||
|
||||
@ -123,6 +123,7 @@ namespace MetaFile
|
||||
|
||||
virtual bool LoadFromFile(const wchar_t* wsFilePath) = 0;
|
||||
virtual bool LoadFromBuffer(BYTE* pBuffer, unsigned int unSize) = 0;
|
||||
virtual bool LoadFromString(const std::wstring& data) = 0;
|
||||
virtual bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight) = 0;
|
||||
virtual void Close() = 0;
|
||||
virtual void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH) = 0;
|
||||
@ -131,6 +132,7 @@ namespace MetaFile
|
||||
virtual NSFonts::IFontManager* get_FontManager() = 0;
|
||||
|
||||
virtual std::wstring ConvertToSvg(unsigned int unWidth = 0, unsigned int unHeight = 0) = 0;
|
||||
virtual void SetTempDirectory(const std::wstring& dir) = 0;
|
||||
|
||||
//Для тестов
|
||||
#ifdef METAFILE_SUPPORT_WMF_EMF
|
||||
|
||||
@ -135,7 +135,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "./wasm/src/",
|
||||
"files": ["lib/wasm_jmp.cpp", "drawingfile.cpp", "metafile.cpp", "pdfwriter.cpp"]
|
||||
"files": ["lib/wasm_jmp.cpp", "drawingfile.cpp", "metafile.cpp", "pdfwriter.cpp", "HTMLRendererText.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "freetype-2.10.4/src/",
|
||||
@ -201,10 +201,6 @@
|
||||
"folder": "../",
|
||||
"files": ["officedrawingfile.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../HtmlRenderer/src/",
|
||||
"files": ["HTMLRendererText.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../UnicodeConverter/",
|
||||
"files": ["UnicodeConverter.cpp"]
|
||||
@ -227,7 +223,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DocxRenderer/src/logic/elements",
|
||||
"files": ["BaseItem.cpp", "ContText.cpp", "DropCap.cpp", "Paragraph.cpp", "Shape.cpp", "TextLine.cpp"]
|
||||
"files": ["BaseItem.cpp", "ContText.cpp", "Paragraph.cpp", "Shape.cpp", "TextLine.cpp", "Table.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../common",
|
||||
|
||||
@ -19,7 +19,7 @@ include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
|
||||
include(../../freetype.pri)
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, HtmlRenderer)
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel)
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/agg-2.4/include \
|
||||
@ -682,6 +682,7 @@ HEADERS += \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/DropCap.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Paragraph.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Shape.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Table.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/TextLine.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ExternalImageStorage.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontStyleManager.h \
|
||||
@ -704,9 +705,9 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/BaseItem.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/ContText.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/DropCap.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Paragraph.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Shape.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Table.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/TextLine.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontManager.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontStyleManager.cpp \
|
||||
@ -720,14 +721,15 @@ SOURCES += \
|
||||
$$DOCX_RENDERER_ROOT_DIR/DocxRenderer.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/resources.cpp
|
||||
|
||||
HEADERS += $$CORE_ROOT_DIR/HtmlRenderer/include/HTMLRendererText.h
|
||||
SOURCES += $$CORE_ROOT_DIR/HtmlRenderer/src/HTMLRendererText.cpp
|
||||
HEADERS += $$CORE_ROOT_DIR/DesktopEditor/doctrenderer/drawingfile.h
|
||||
|
||||
HEADERS += \
|
||||
../wasm/src/drawingfile.h \
|
||||
../wasm/src/serialize.h
|
||||
../wasm/src/serialize.h \
|
||||
../wasm/src/HTMLRendererText.h \
|
||||
../wasm/src/Text.h
|
||||
|
||||
SOURCES += \
|
||||
../wasm/src/pdfwriter.cpp \
|
||||
../wasm/src/HTMLRendererText.cpp \
|
||||
../wasm/src/drawingfile.cpp \
|
||||
../wasm/src/drawingfile_test.cpp
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* (c) Copyright Ascensio System SIA 2010-2024
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -68,16 +68,6 @@ CFile.prototype.unlockPageNumForFontsLoader = function()
|
||||
drawingFile.fontPageUpdateType = UpdateFontsSource.Undefined;
|
||||
};
|
||||
|
||||
CFile.prototype.getOriginPage = function(originIndex)
|
||||
{
|
||||
for (let i = 0; i < this.pages.length; ++i)
|
||||
{
|
||||
if (this.pages[i]["originIndex"] == originIndex)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
CFile.prototype["getPages"] = function()
|
||||
{
|
||||
return this.pages;
|
||||
@ -126,6 +116,11 @@ CFile.prototype["loadFromDataWithPassword"] = function(password)
|
||||
return error;
|
||||
};
|
||||
|
||||
CFile.prototype["getType"] = function()
|
||||
{
|
||||
return this.type;
|
||||
};
|
||||
|
||||
CFile.prototype["close"] = function()
|
||||
{
|
||||
this._closeFile();
|
||||
@ -236,18 +231,17 @@ CFile.prototype["getLinks"] = function(pageIndex)
|
||||
// TEXT
|
||||
CFile.prototype["getGlyphs"] = function(pageIndex)
|
||||
{
|
||||
let i = this.getOriginPage(pageIndex);
|
||||
if (i < 0)
|
||||
return null;
|
||||
let page = this.pages[i];
|
||||
if (!page || page.fonts.length > 0)
|
||||
let page = this.pages[pageIndex];
|
||||
if (page.originIndex == undefined)
|
||||
return [];
|
||||
if (page.fonts.length > 0)
|
||||
{
|
||||
// waiting fonts
|
||||
return null;
|
||||
}
|
||||
|
||||
this.lockPageNumForFontsLoader(i, UpdateFontsSource.Page);
|
||||
let res = this._getGlyphs(pageIndex);
|
||||
this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Page);
|
||||
let res = this._getGlyphs(page.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()
|
||||
@ -501,8 +495,8 @@ function readAnnotAP(reader, AP)
|
||||
{
|
||||
// number for relations with AP
|
||||
AP["i"] = reader.readInt();
|
||||
AP["x"] = reader.readInt();
|
||||
AP["y"] = reader.readInt();
|
||||
AP["x"] = reader.readDouble();
|
||||
AP["y"] = reader.readDouble();
|
||||
AP["w"] = reader.readInt();
|
||||
AP["h"] = reader.readInt();
|
||||
let n = reader.readInt();
|
||||
@ -525,6 +519,9 @@ function readAnnotAP(reader, AP)
|
||||
// 0 - Normal, 1 - Multiply, 2 - Screen, 3 - Overlay, 4 - Darken, 5 - Lighten, 6 - ColorDodge, 7 - ColorBurn, 8 - HardLight,
|
||||
// 9 - SoftLight, 10 - Difference, 11 - Exclusion, 12 - Hue, 13 - Saturation, 14 - Color, 15 - Luminosity
|
||||
APi["BlendMode"] = reader.readByte();
|
||||
let k = reader.readByte();
|
||||
if (k != 0)
|
||||
APi["apValue"] = reader.readString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -657,6 +654,8 @@ CFile.prototype["getInteractiveFormsInfo"] = function()
|
||||
rec["name"] = reader.readString();
|
||||
if (flags & (1 << 19))
|
||||
rec["font"]["AP"] = reader.readString();
|
||||
if (flags & (1 << 20))
|
||||
rec["meta"] = reader.readString();
|
||||
// Action
|
||||
let nAction = reader.readInt();
|
||||
if (nAction > 0)
|
||||
@ -1131,7 +1130,7 @@ CFile.prototype["getAnnotationsInfo"] = function(pageIndex)
|
||||
// FreeText
|
||||
else if (rec["Type"] == 2)
|
||||
{
|
||||
// Bachground color - C->IC
|
||||
// Background color - C->IC
|
||||
if (rec["C"])
|
||||
{
|
||||
rec["IC"] = rec["C"];
|
||||
@ -1281,6 +1280,15 @@ CFile.prototype["getAnnotationsInfo"] = function(pageIndex)
|
||||
if (flags & (1 << 26))
|
||||
rec["Desc"] = reader.readString();
|
||||
}
|
||||
// Stamp
|
||||
else if (rec["Type"] == 12)
|
||||
{
|
||||
rec["Icon"] = reader.readString();
|
||||
rec["Rotate"] = reader.readDouble2();
|
||||
rec["InRect"] = [];
|
||||
for (let i = 0; i < 8; ++i)
|
||||
rec["InRect"].push(reader.readDouble2());
|
||||
}
|
||||
res.push(rec);
|
||||
}
|
||||
|
||||
@ -1377,18 +1385,17 @@ CFile.prototype["free"] = function(pointer)
|
||||
// PIXMAP
|
||||
CFile.prototype["getPagePixmap"] = function(pageIndex, width, height, backgroundColor)
|
||||
{
|
||||
let i = this.getOriginPage(pageIndex);
|
||||
if (i < 0)
|
||||
let page = this.pages[pageIndex];
|
||||
if (page.originIndex == undefined)
|
||||
return null;
|
||||
let page = this.pages[i];
|
||||
if (!page || page.fonts.length > 0)
|
||||
if (page.fonts.length > 0)
|
||||
{
|
||||
// waiting fonts
|
||||
return null;
|
||||
}
|
||||
|
||||
this.lockPageNumForFontsLoader(i, UpdateFontsSource.Page);
|
||||
let ptr = this._getPixmap(pageIndex, width, height, backgroundColor);
|
||||
this.lockPageNumForFontsLoader(pageIndex, UpdateFontsSource.Page);
|
||||
let ptr = this._getPixmap(page.originIndex, width, height, backgroundColor);
|
||||
this.unlockPageNumForFontsLoader();
|
||||
|
||||
if (page.fonts.length > 0)
|
||||
|
||||
@ -29,8 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "../include/HTMLRendererText.h"
|
||||
#include "./Text.h"
|
||||
#include "HTMLRendererText.h"
|
||||
#include "Text.h"
|
||||
|
||||
namespace NSHtmlRenderer
|
||||
{
|
||||
@ -40,52 +40,35 @@ namespace NSHtmlRenderer
|
||||
double m_dWidth;
|
||||
double m_dHeght;
|
||||
|
||||
NSStructures::CBrush m_oBrush;
|
||||
NSStructures::CBrush m_oLastBrush;
|
||||
|
||||
NSStructures::CFont m_oFont;
|
||||
NSStructures::CFont* m_pFont;
|
||||
NSStructures::CFont m_oInstalledFont;
|
||||
LONG m_lCurrentFont;
|
||||
double m_dCurrentFontSize;
|
||||
|
||||
Aggplus::CMatrix m_oTransform;
|
||||
Aggplus::CMatrix m_oLastTransform;
|
||||
|
||||
bool m_bIsChangedFontParamBetweenDrawText;
|
||||
LONG m_lCurrentCommandType;
|
||||
LONG m_lSrcFileType;
|
||||
|
||||
CHText m_oSmartText;
|
||||
CMetafile m_oPage;
|
||||
NSWasm::CData m_oPage;
|
||||
|
||||
int* m_pTempUnicodes;
|
||||
int m_nTempUnicodesAlloc;
|
||||
int m_nTempUnicodesLen;
|
||||
int* m_pTempUnicodes; // массив юникодов
|
||||
int m_nTempUnicodesAlloc; // размер выделенной памяти
|
||||
int m_nTempUnicodesLen; // размер используемой памяти
|
||||
|
||||
bool m_bIsFontsInit;
|
||||
|
||||
public:
|
||||
CHTMLRendererText_Private()
|
||||
{
|
||||
m_bIsChangedFontParamBetweenDrawText = true;
|
||||
m_lSrcFileType = 0;
|
||||
m_pTempUnicodes = NULL;
|
||||
m_nTempUnicodesLen = 0;
|
||||
m_nTempUnicodesAlloc = 0;
|
||||
|
||||
m_bIsFontsInit = false;
|
||||
|
||||
m_lCurrentFont = 0;
|
||||
m_dCurrentFontSize = 0;
|
||||
m_pFont = &m_oFont;
|
||||
}
|
||||
~CHTMLRendererText_Private()
|
||||
{
|
||||
RELEASEARRAYOBJECTS(m_pTempUnicodes);
|
||||
}
|
||||
|
||||
public:
|
||||
void GetUnicodes(const std::wstring& sText)
|
||||
{
|
||||
int nLen = (int)sText.length();
|
||||
@ -101,7 +84,7 @@ namespace NSHtmlRenderer
|
||||
|
||||
if (sizeof(wchar_t) == 2)
|
||||
{
|
||||
for (int nIndex = 0, nGlyphIndex = 0; nIndex < nLen; ++nIndex, ++nGlyphIndex)
|
||||
for (int nIndex = 0; nIndex < nLen; ++nIndex)
|
||||
{
|
||||
int code = (int)pWchars[nIndex];
|
||||
if (code >= 0xD800 && code <= 0xDFFF && (nIndex + 1) < nLen)
|
||||
@ -109,32 +92,25 @@ namespace NSHtmlRenderer
|
||||
++nIndex;
|
||||
code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & pWchars[nIndex]));
|
||||
}
|
||||
|
||||
m_pTempUnicodes[m_nTempUnicodesLen++] = code;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int nIndex = 0; nIndex < nLen; ++nIndex )
|
||||
{
|
||||
for (int nIndex = 0; nIndex < nLen; ++nIndex)
|
||||
m_pTempUnicodes[m_nTempUnicodesLen++] = (int)pWchars[nIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WriteText(const int* pUnicodes, const int* pGids, const int& nCount, const double& x, const double& y,
|
||||
const double& width, const double& height, const bool& bIsChangedFontParamBetweenDrawText)
|
||||
void WriteText(const int* pUnicodes, const int* pGids, const int& nCount, const double& x, const double& y)
|
||||
{
|
||||
bool bIsDumpFont = false;
|
||||
if (!m_oInstalledFont.IsEqual(&m_oFont))
|
||||
{
|
||||
m_oInstalledFont = m_oFont;
|
||||
bIsDumpFont = true;
|
||||
|
||||
m_dCurrentFontSize = m_oInstalledFont.Size;
|
||||
}
|
||||
|
||||
m_oSmartText.CommandText(pUnicodes, pGids, nCount, x, y, width, height, bIsDumpFont, this);
|
||||
m_oSmartText.CommandText(pUnicodes, pGids, nCount, x, y, bIsDumpFont);
|
||||
}
|
||||
};
|
||||
|
||||
@ -149,9 +125,6 @@ namespace NSHtmlRenderer
|
||||
|
||||
void CHTMLRendererText::Init(IOfficeDrawingFile* pFile, int nCacheSize)
|
||||
{
|
||||
m_pInternal->m_oBrush.SetDefaultParams();
|
||||
m_pInternal->m_oLastBrush.SetDefaultParams();
|
||||
|
||||
m_pInternal->m_oFont.SetDefaultParams();
|
||||
m_pInternal->m_oInstalledFont.SetDefaultParams();
|
||||
m_pInternal->m_oInstalledFont.Name = L"";
|
||||
@ -159,87 +132,38 @@ namespace NSHtmlRenderer
|
||||
m_pInternal->m_oTransform.Reset();
|
||||
m_pInternal->m_oLastTransform.Reset();
|
||||
|
||||
m_pInternal->m_oLastBrush.Color1 = -1;
|
||||
m_pInternal->m_dCurrentFontSize = 0.0;
|
||||
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = false;
|
||||
m_pInternal->m_lCurrentCommandType = -1;
|
||||
|
||||
m_pInternal->m_oSmartText.NewPage();
|
||||
|
||||
if (!m_pInternal->m_bIsFontsInit)
|
||||
{
|
||||
m_pInternal->m_oSmartText.m_oFontManager.m_pFont = &m_pInternal->m_oFont;
|
||||
|
||||
m_pInternal->m_oSmartText.m_pLastBrush = &m_pInternal->m_oLastBrush;
|
||||
m_pInternal->m_oSmartText.m_pBrush = &m_pInternal->m_oBrush;
|
||||
|
||||
m_pInternal->m_oSmartText.m_pFont = &m_pInternal->m_oFont;
|
||||
|
||||
m_pInternal->m_oSmartText.m_oFontManager.Init(pFile->GetFonts(), nCacheSize);
|
||||
m_pInternal->m_oSmartText.m_pTransform = &m_pInternal->m_oTransform;
|
||||
m_pInternal->m_oSmartText.m_pLastTransform = &m_pInternal->m_oLastTransform;
|
||||
|
||||
m_pInternal->m_oSmartText.m_pPageMeta = &m_pInternal->m_oPage;
|
||||
|
||||
OfficeDrawingFileType eType = pFile->GetType();
|
||||
switch (eType)
|
||||
{
|
||||
case odftPDF:
|
||||
{
|
||||
m_pInternal->m_lSrcFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
|
||||
m_pInternal->m_oSmartText.m_dTextSpaceEps = 0.1;
|
||||
break;
|
||||
}
|
||||
case odftDJVU:
|
||||
{
|
||||
m_pInternal->m_lSrcFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU;
|
||||
m_pInternal->m_oSmartText.m_dTextSpaceEps = 0.1;
|
||||
break;
|
||||
}
|
||||
case odftXPS:
|
||||
{
|
||||
m_pInternal->m_lSrcFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS;
|
||||
m_pInternal->m_oSmartText.m_dTextSpaceEps = 0.1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_pInternal->m_bIsFontsInit = true;
|
||||
m_pInternal->m_oSmartText.Init(pFile->GetFonts(), nCacheSize);
|
||||
}
|
||||
|
||||
m_pInternal->m_oPage.ClearNoAttack();
|
||||
m_pInternal->m_oPage.WriteLONG(0);
|
||||
|
||||
m_pInternal->m_oPage.SkipLen();
|
||||
// статистика
|
||||
m_pInternal->m_oPage.WriteLONG(0);
|
||||
m_pInternal->m_oPage.WriteLONG(0);
|
||||
m_pInternal->m_oPage.WriteLONG(0);
|
||||
m_pInternal->m_oPage.WriteLONG(0);
|
||||
|
||||
m_pInternal->m_oPage.AddInt(0);
|
||||
m_pInternal->m_oPage.AddInt(0);
|
||||
m_pInternal->m_oPage.AddInt(0);
|
||||
m_pInternal->m_oPage.AddInt(0);
|
||||
}
|
||||
|
||||
BYTE* CHTMLRendererText::GetBuffer()
|
||||
{
|
||||
m_pInternal->m_oSmartText.ClosePage();
|
||||
LONG lPos = m_pInternal->m_oPage.GetPosition();
|
||||
m_pInternal->m_oPage.Seek(0);
|
||||
// len
|
||||
m_pInternal->m_oPage.WriteLONG(lPos);
|
||||
// stat
|
||||
m_pInternal->m_oPage.WriteLONG(m_pInternal->m_oSmartText.m_lCountParagraphs);
|
||||
m_pInternal->m_oPage.WriteLONG(m_pInternal->m_oSmartText.m_lCountWords);
|
||||
m_pInternal->m_oPage.WriteLONG(m_pInternal->m_oSmartText.m_lCountSymbols);
|
||||
m_pInternal->m_oPage.WriteLONG(m_pInternal->m_oSmartText.m_lCountSpaces);
|
||||
// seek to end
|
||||
m_pInternal->m_oPage.Seek(lPos);
|
||||
|
||||
m_pInternal->m_oPage.WriteLen();
|
||||
// статистика
|
||||
m_pInternal->m_oPage.AddInt(m_pInternal->m_oSmartText.m_nCountParagraphs, 4);
|
||||
m_pInternal->m_oPage.AddInt(m_pInternal->m_oSmartText.m_nCountWords, 8);
|
||||
m_pInternal->m_oPage.AddInt(m_pInternal->m_oSmartText.m_nCountSymbols, 12);
|
||||
m_pInternal->m_oPage.AddInt(m_pInternal->m_oSmartText.m_nCountSpaces, 16);
|
||||
|
||||
m_pInternal->m_oSmartText.ClearStatistics();
|
||||
return m_pInternal->m_oPage.GetData();
|
||||
return m_pInternal->m_oPage.GetBuffer();
|
||||
}
|
||||
|
||||
HRESULT CHTMLRendererText::get_Type(LONG* lType)
|
||||
{
|
||||
*lType = c_nHtmlRendrererText;
|
||||
@ -247,10 +171,7 @@ namespace NSHtmlRenderer
|
||||
}
|
||||
|
||||
//-------- Функции для работы со страницей --------------------------------------------------
|
||||
HRESULT CHTMLRendererText::NewPage()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::NewPage() { return S_OK; }
|
||||
HRESULT CHTMLRendererText::get_Height(double* dHeight)
|
||||
{
|
||||
*dHeight = m_pInternal->m_dHeght;
|
||||
@ -311,36 +232,12 @@ namespace NSHtmlRenderer
|
||||
HRESULT CHTMLRendererText::put_BrushTransform(const Aggplus::CMatrix& oMatrix) { return S_OK; }
|
||||
|
||||
// brush ------------------------------------------------------------------------------------
|
||||
HRESULT CHTMLRendererText::get_BrushType(LONG* lType)
|
||||
{
|
||||
*lType = m_pInternal->m_oBrush.Type;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::put_BrushType(const LONG& lType)
|
||||
{
|
||||
m_pInternal->m_oBrush.Type = lType;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_BrushColor1(LONG* lColor)
|
||||
{
|
||||
*lColor = m_pInternal->m_oBrush.Color1;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::put_BrushColor1(const LONG& lColor)
|
||||
{
|
||||
m_pInternal->m_oBrush.Color1 = lColor;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_BrushAlpha1(LONG* lAlpha)
|
||||
{
|
||||
*lAlpha = m_pInternal->m_oBrush.Alpha1;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::put_BrushAlpha1(const LONG& lAlpha)
|
||||
{
|
||||
m_pInternal->m_oBrush.Alpha1 = lAlpha;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_BrushType(LONG* lType) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::put_BrushType(const LONG& lType) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::get_BrushColor1(LONG* lColor) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::put_BrushColor1(const LONG& lColor) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::get_BrushAlpha1(LONG* lAlpha) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::put_BrushAlpha1(const LONG& lAlpha) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::get_BrushColor2(LONG* lColor) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::put_BrushColor2(const LONG& lColor) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::get_BrushAlpha2(LONG* lAlpha) { return S_OK; }
|
||||
@ -366,7 +263,6 @@ namespace NSHtmlRenderer
|
||||
HRESULT CHTMLRendererText::put_FontName(const std::wstring& bsName)
|
||||
{
|
||||
m_pInternal->m_oFont.Name = bsName;
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = true;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_FontPath(std::wstring* bsName)
|
||||
@ -377,7 +273,6 @@ namespace NSHtmlRenderer
|
||||
HRESULT CHTMLRendererText::put_FontPath(const std::wstring& bsName)
|
||||
{
|
||||
m_pInternal->m_oFont.Path = bsName;
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = true;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_FontSize(double* dSize)
|
||||
@ -387,11 +282,7 @@ namespace NSHtmlRenderer
|
||||
}
|
||||
HRESULT CHTMLRendererText::put_FontSize(const double& dSize)
|
||||
{
|
||||
if (m_pInternal->m_oFont.Size != dSize)
|
||||
{
|
||||
m_pInternal->m_oFont.Size = dSize;
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = true;
|
||||
}
|
||||
m_pInternal->m_oFont.Size = dSize;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_FontStyle(LONG* lStyle)
|
||||
@ -401,12 +292,7 @@ namespace NSHtmlRenderer
|
||||
}
|
||||
HRESULT CHTMLRendererText::put_FontStyle(const LONG& lStyle)
|
||||
{
|
||||
LONG lOld = m_pInternal->m_oFont.GetStyle();
|
||||
if (lOld != lStyle)
|
||||
{
|
||||
m_pInternal->m_oFont.SetStyle(lStyle);
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = true;
|
||||
}
|
||||
m_pInternal->m_oFont.SetStyle(lStyle);
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::get_FontStringGID(INT* bGID)
|
||||
@ -443,58 +329,34 @@ namespace NSHtmlRenderer
|
||||
//-------- Функции для вывода текста --------------------------------------------------------
|
||||
HRESULT CHTMLRendererText::CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType)
|
||||
return S_OK;
|
||||
|
||||
int _c = (int)c;
|
||||
m_pInternal->WriteText(&_c, NULL, 1, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText);
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = false;
|
||||
m_pInternal->WriteText(&_c, NULL, 1, x, y);
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType)
|
||||
return S_OK;
|
||||
|
||||
m_pInternal->GetUnicodes(bsText);
|
||||
m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, NULL, m_pInternal->m_nTempUnicodesLen, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText);
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = false;
|
||||
m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, NULL, m_pInternal->m_nTempUnicodesLen, x, y);
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType)
|
||||
return S_OK;
|
||||
|
||||
int _c = (int)c;
|
||||
int _g = (int)gid;
|
||||
|
||||
m_pInternal->WriteText(&_c, &_g, 1, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText);
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = false;
|
||||
m_pInternal->WriteText(&_c, &_g, 1, x, y);
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType)
|
||||
return S_OK;
|
||||
|
||||
m_pInternal->GetUnicodes(bsUnicodeText);
|
||||
m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, (const int*)pGids, m_pInternal->m_nTempUnicodesLen, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText);
|
||||
m_pInternal->m_bIsChangedFontParamBetweenDrawText = false;
|
||||
m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, (const int*)pGids, m_pInternal->m_nTempUnicodesLen, x, y);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------- Маркеры для команд ---------------------------------------------------------------
|
||||
HRESULT CHTMLRendererText::BeginCommand(const DWORD& lType)
|
||||
{
|
||||
m_pInternal->m_lCurrentCommandType = lType;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::EndCommand(const DWORD& lType)
|
||||
{
|
||||
m_pInternal->m_lCurrentCommandType = -1;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CHTMLRendererText::BeginCommand(const DWORD& lType) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::EndCommand(const DWORD& lType) { return S_OK; }
|
||||
|
||||
//-------- Функции для работы с Graphics Path -----------------------------------------------
|
||||
HRESULT CHTMLRendererText::PathCommandMoveTo(const double& x, const double& y) { return S_OK; }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user