mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-31 10:21:37 +08:00
Compare commits
783 Commits
v9.0.0.66
...
fix/bug597
| Author | SHA1 | Date | |
|---|---|---|---|
| 950482095c | |||
| 8ca89ca9b7 | |||
| da705edfb8 | |||
| 2ed318df0f | |||
| 771ee80ec5 | |||
| 4ddf4521c4 | |||
| 1491bd8802 | |||
| e7de9af0e0 | |||
| 703ec47e67 | |||
| 708e37d0a5 | |||
| e11b946d62 | |||
| 331401ea86 | |||
| 40809ea3c2 | |||
| b79001a9fd | |||
| 49d4b5c1d2 | |||
| fa513eb83f | |||
| e84e0a6ce8 | |||
| 13158b2956 | |||
| 9e8beb5651 | |||
| 711e80e62c | |||
| 3404aab782 | |||
| 9c3ba26fab | |||
| 02f4c10cd6 | |||
| 0d912533bf | |||
| 066793921b | |||
| 9b2b7263c2 | |||
| 31c28903d6 | |||
| 518a38e178 | |||
| 631c2d4490 | |||
| 0d0003ad5a | |||
| eb3bedd840 | |||
| 0e9db67173 | |||
| 1a65242d46 | |||
| 30da4b631f | |||
| a988e6741c | |||
| 29c2239df2 | |||
| 0d7ddfb580 | |||
| a7b5866bc6 | |||
| 8bbb21263d | |||
| a652bd6591 | |||
| 78532c27cf | |||
| 63d3999072 | |||
| d055522aa0 | |||
| c5e63a8d26 | |||
| e56da8e641 | |||
| ba63cfc622 | |||
| 7486182be7 | |||
| 6f171bd5d7 | |||
| dad2fdd3e0 | |||
| 48bc54311c | |||
| a71b7ec6e7 | |||
| 292e6b0431 | |||
| 5649de0877 | |||
| 7aa2056785 | |||
| b1c8969ede | |||
| d3805e81d7 | |||
| 8171939be6 | |||
| 5178de4254 | |||
| f3ee3c8c91 | |||
| e108591a7e | |||
| 29f1dc454b | |||
| b534907bc9 | |||
| b957d3aeea | |||
| 520c345f00 | |||
| 08ce05e5d3 | |||
| a8125114de | |||
| 13a4986eb7 | |||
| 62003d97bb | |||
| 3e0a88a487 | |||
| 1969229659 | |||
| 98af93c631 | |||
| a4ebe56f28 | |||
| 247b90ce1a | |||
| aef05de075 | |||
| 5b12d7fff3 | |||
| 4223f9c265 | |||
| 9e60a7e3ab | |||
| 5de9bd7e67 | |||
| dacde4c593 | |||
| 97385c3f37 | |||
| edd17cd7c3 | |||
| e373adf717 | |||
| 2ad1771333 | |||
| 73f40edc7e | |||
| 182a3cea90 | |||
| 72f0b0403e | |||
| 3d5d871911 | |||
| 1fbffa673c | |||
| 06c47b07ec | |||
| e2bcf62cc4 | |||
| f5a91c33b5 | |||
| 79ab0bc04b | |||
| 242aa2c9d6 | |||
| e01517714c | |||
| 3f7edeec4f | |||
| 9cef29c201 | |||
| 688632c373 | |||
| c86387c015 | |||
| e8f7720387 | |||
| 4ea504f688 | |||
| c3dd5c8fc9 | |||
| 6e1357f276 | |||
| fee71647a9 | |||
| 6c516b7ce2 | |||
| 53d5f4517b | |||
| 03e21d19f1 | |||
| cd05b830b1 | |||
| bf05a63db0 | |||
| bc96c82ff9 | |||
| 4187522006 | |||
| a82cf375b7 | |||
| 81f057ba78 | |||
| c2a733f465 | |||
| fcd7818675 | |||
| baf8321c61 | |||
| 826bd168ad | |||
| b1dff84b1b | |||
| c65460e49b | |||
| f5fa14a230 | |||
| db744e6fdc | |||
| a15156fcb3 | |||
| dbc54e5879 | |||
| 2a09e2ef67 | |||
| 17534abdda | |||
| e4a7cf63c9 | |||
| 0eadce28da | |||
| 29c53f751b | |||
| 6500e65edc | |||
| e8ecb2cdfb | |||
| 3046b1557f | |||
| fbf4ef22d8 | |||
| 628908e96c | |||
| 78df0b3780 | |||
| d8c0e9b68d | |||
| df8f8636b6 | |||
| 5722599351 | |||
| f4489a3926 | |||
| 91f27bf771 | |||
| eb3daff8d6 | |||
| 6d707ebae2 | |||
| bab8da0475 | |||
| 66501ab353 | |||
| a865901405 | |||
| c1987b196e | |||
| 8899966508 | |||
| 41dc23ce53 | |||
| 3a555aa223 | |||
| 2168216009 | |||
| 13b42d71e2 | |||
| 58cd88a93f | |||
| 4dc1d88bc9 | |||
| ef2d554265 | |||
| 2d08404f72 | |||
| cd6c4c56c3 | |||
| 96f7de8534 | |||
| dba4be73dd | |||
| f3101fd2ec | |||
| 08716fc4ce | |||
| 986125a3e6 | |||
| b655a4e109 | |||
| 7ce6602951 | |||
| f45b3ba0da | |||
| 5ec24525b8 | |||
| 0c601c1c82 | |||
| c7d3e5df14 | |||
| 2351b1f052 | |||
| b93ea3bb41 | |||
| 697f604fc4 | |||
| a817cd54d5 | |||
| 1fc61459b8 | |||
| e1b3474a06 | |||
| 041325b440 | |||
| 064a04a600 | |||
| df4e1445f6 | |||
| cc6132cd77 | |||
| c7a209048f | |||
| a359060684 | |||
| 08fafaa655 | |||
| 57923e4266 | |||
| b488623e81 | |||
| 2462074f63 | |||
| 5e121188d8 | |||
| 114f9a0da3 | |||
| 7c4b85600d | |||
| 48e2defbcd | |||
| 07bd804009 | |||
| 348fc71e1c | |||
| d123b0f610 | |||
| 13e30bf918 | |||
| e74a96884c | |||
| c67d87b1f0 | |||
| 1e73aed4a5 | |||
| 63da89d846 | |||
| 9f223deee7 | |||
| d49789ea19 | |||
| 738583d0d4 | |||
| 47a1e26ff5 | |||
| ecca7a5cdd | |||
| 407993cd40 | |||
| 7e5d3bb3eb | |||
| 381daebcb9 | |||
| 7e6d6b407c | |||
| 5e9f0d762a | |||
| f5ddf8c6ce | |||
| 4f95713790 | |||
| 337847f606 | |||
| a84491cf74 | |||
| 689eaddd5b | |||
| 2cc56a9f9f | |||
| 33c6640ce0 | |||
| e6e93549c9 | |||
| 00e5c8bd2e | |||
| ae063b3d41 | |||
| 01d6a7d090 | |||
| 98c998b3ee | |||
| f6c8356684 | |||
| 880951a611 | |||
| 2895f829e3 | |||
| 671b88d8bc | |||
| c0ba4267d2 | |||
| 29355d337b | |||
| 6f7a414888 | |||
| 031fc7517b | |||
| a040e89ae5 | |||
| e025ae2779 | |||
| 21ca48c6f6 | |||
| ec906774dd | |||
| e17b99554d | |||
| 09ac9f8609 | |||
| 97178ae328 | |||
| 1dc8990c9d | |||
| f68825c6d3 | |||
| 4770a2b22b | |||
| dda00c3b18 | |||
| 156578ca82 | |||
| 2ec63f2cb7 | |||
| 62d2deaefb | |||
| fbed837a47 | |||
| 0715c0c5a5 | |||
| 103c8dd575 | |||
| 5dc5a200b8 | |||
| 23008b3737 | |||
| 03f490047d | |||
| 36454f4c6e | |||
| 34e1dabefb | |||
| 3d39d5837f | |||
| a6efd8a374 | |||
| 3bfa3643e6 | |||
| 453e17ac0e | |||
| 88620dc8cd | |||
| cc9b00329e | |||
| 88c84ad577 | |||
| ee22e8e8b4 | |||
| 1756d58c6d | |||
| ecab418202 | |||
| d3430ace10 | |||
| 10a6f6e617 | |||
| 8c6a26895b | |||
| 5142536e17 | |||
| fd05f3b16d | |||
| e0840e73d2 | |||
| ae2918ec71 | |||
| 17369e8bee | |||
| 3047a9fb47 | |||
| 1495581b00 | |||
| 6c2fce16a8 | |||
| 58be006bb9 | |||
| 6c2a8205ec | |||
| 29cee43448 | |||
| 0154543b01 | |||
| 3e2dee5719 | |||
| 8b4fe95291 | |||
| c25f8cc204 | |||
| 010d1ce4c9 | |||
| 6ac9349ccb | |||
| c3bf7ad49b | |||
| b5d56d1d6d | |||
| d3aae6dfcb | |||
| fb07c0c468 | |||
| 327d00bacf | |||
| fe0d95009c | |||
| bcc5f67ec8 | |||
| 9200c29d42 | |||
| c13027c9d1 | |||
| 6acb9855a1 | |||
| 1619e421f2 | |||
| 2b1e5faef9 | |||
| ea214f942f | |||
| ccbff8d8da | |||
| 1cd72ab988 | |||
| 63937e706e | |||
| 54a903d2e7 | |||
| e48fab418d | |||
| 537304ad24 | |||
| fa9e3cb48e | |||
| d362999e2a | |||
| 6e73b593ba | |||
| 46fbf81b4d | |||
| 519a93ecaf | |||
| 90ded6788f | |||
| 1f4a420d35 | |||
| 087146ce77 | |||
| b4ac2a9515 | |||
| d11e0492f2 | |||
| 4b3c4242f6 | |||
| 482a821974 | |||
| 2e1538b3dc | |||
| 48ec45c1dd | |||
| 809ed63ca0 | |||
| 91badde27d | |||
| 618b1a9ca8 | |||
| 95d523370d | |||
| a2768af989 | |||
| 85e8d253a9 | |||
| d4e623f277 | |||
| 827dc4c1b9 | |||
| 5d033bef69 | |||
| 18e22f0f05 | |||
| 426cd08d57 | |||
| d1a64d29c0 | |||
| b8053ae388 | |||
| c56cfaf71f | |||
| 2680fd7073 | |||
| cfdeca436b | |||
| db3769eb13 | |||
| e5fcbcf5f3 | |||
| 6d4ff364b3 | |||
| 8a9277d1d8 | |||
| f3d3755a31 | |||
| ffab501ce9 | |||
| 74b21f5b4c | |||
| 3e9d3bed35 | |||
| 8ddb6e7f05 | |||
| db9fd85f22 | |||
| e54e8d7a8a | |||
| 8e0e1203c6 | |||
| 9a74609366 | |||
| d9f24ca635 | |||
| ebddab233c | |||
| 0bdd7f098d | |||
| efadc23a50 | |||
| 36db67cba3 | |||
| c9e5320ea3 | |||
| 58f12dbbee | |||
| 1656d0dd6d | |||
| 39090a2423 | |||
| 8241d85596 | |||
| 8ebc312dc7 | |||
| aaf744353f | |||
| 4cff6dfe57 | |||
| 15ee6ecf91 | |||
| 67a5b7f087 | |||
| c6e2ad0fef | |||
| 5b9141ce1d | |||
| 502312fe20 | |||
| a10b8ee6fb | |||
| 7c6cd1107d | |||
| 05be4876e8 | |||
| d9806dfbc8 | |||
| 00e9d050ae | |||
| 405a2c1f59 | |||
| d287fc016e | |||
| 383a616c97 | |||
| 4e272d8ecf | |||
| f6900b5d11 | |||
| 0a7a3c3a99 | |||
| 556ea0dce4 | |||
| 62dde72acc | |||
| 5e45f5fb09 | |||
| 750b28d866 | |||
| 33b246b9da | |||
| 6c8e053bb2 | |||
| db7ebc5765 | |||
| 84462ab1da | |||
| 7cb08f3a87 | |||
| 16b28e60a4 | |||
| 8ac1c4d158 | |||
| 5f78402f2a | |||
| fa80e4913f | |||
| aa5012928c | |||
| c0f5336a5a | |||
| 646f2ca6b1 | |||
| 18f92b56ba | |||
| bc34a76127 | |||
| ad5670cde7 | |||
| b09fc50b62 | |||
| b04f9bda4a | |||
| 046b39478a | |||
| 4e59cac4cd | |||
| 0d79f941b9 | |||
| d69d71ec07 | |||
| 0ebc0da7b2 | |||
| 3db0662c14 | |||
| 49477554a4 | |||
| 55e758e3f8 | |||
| c11171fbf2 | |||
| 8c4fc0d94c | |||
| e6570a6ccc | |||
| ecda52ae5c | |||
| 5df1ec97c3 | |||
| 78577f70e5 | |||
| 78e20f5358 | |||
| dba3b263e6 | |||
| 40ce56d7f8 | |||
| 33864a1a1e | |||
| 602879432a | |||
| cbc36b0b0a | |||
| dfc4048630 | |||
| adc2930f0b | |||
| 599566c5e2 | |||
| 17c1e0a2bb | |||
| 462523cfa5 | |||
| fcdbdff42f | |||
| e7b231feed | |||
| 3264e0764e | |||
| 5f4cfa5bdf | |||
| b159b76018 | |||
| a006479964 | |||
| 2012fef748 | |||
| c8288b8b7b | |||
| 7f31f40843 | |||
| 414b376f04 | |||
| 10427d151d | |||
| 8e9198f307 | |||
| a3399b3119 | |||
| 646bbd405f | |||
| 04663e7653 | |||
| 240b78b0a6 | |||
| 9a147d9817 | |||
| e20231dc88 | |||
| 9c7d4e6d90 | |||
| c936c4419c | |||
| 622617d16d | |||
| 1daaaad842 | |||
| 4d9744190e | |||
| 575e45a0b2 | |||
| e9e88f616b | |||
| ee67e5dbc5 | |||
| c53f6fe09f | |||
| 624e5477ae | |||
| 5938d38219 | |||
| 6cc0b5e215 | |||
| 3d9045e0d4 | |||
| 01e1cb14bf | |||
| 011e2a8592 | |||
| b3e297bb08 | |||
| 68e10572f1 | |||
| ae1266d506 | |||
| b86dfb8d90 | |||
| fd9d46fc3c | |||
| c53009ee3d | |||
| 02a845d451 | |||
| b380692fe5 | |||
| 8123c0e409 | |||
| cae981891b | |||
| 49fad86617 | |||
| feb3c7af90 | |||
| 0f169b1491 | |||
| 22e89be7a3 | |||
| ced5bb6c71 | |||
| 26cb45ceaa | |||
| 9091f12828 | |||
| 500cf8fca3 | |||
| b17b3dec40 | |||
| 57b854355e | |||
| 2d758b155d | |||
| 29c81f7653 | |||
| d86afbe693 | |||
| b9120f5c29 | |||
| 49841da755 | |||
| 76bed5ae36 | |||
| 4451768f4e | |||
| 102fdb83bc | |||
| a5f5a2921f | |||
| 353f8ddbac | |||
| 916f293c89 | |||
| f6e214b0c3 | |||
| 4f63982e2f | |||
| f570c88d29 | |||
| 10e6664313 | |||
| 00a82a7693 | |||
| 0dfe7c8dcc | |||
| 04b54cf980 | |||
| 56b09897d7 | |||
| e3e49b4497 | |||
| 4f31164447 | |||
| 5179739cf6 | |||
| d044959b0d | |||
| 3886951671 | |||
| 326fe32013 | |||
| 344a0caf37 | |||
| bed33af917 | |||
| 777eb2697d | |||
| a824e9c25d | |||
| 6402c0cb73 | |||
| 14df0d2b58 | |||
| 29c01ac9c9 | |||
| cc9cb8ca05 | |||
| ba77ddc78e | |||
| 03463ee0e4 | |||
| 32cfb4f71b | |||
| 243cc43771 | |||
| daf8fb9dd7 | |||
| a90422c3a7 | |||
| 16e7528cff | |||
| ae71fefd92 | |||
| 8be104e3c1 | |||
| fbcb387f51 | |||
| c4eb6ef445 | |||
| 4754569381 | |||
| 44948c850e | |||
| 3163177b89 | |||
| 66513e895f | |||
| 8bcf2ee154 | |||
| 7d9e756f3f | |||
| b2d28a7185 | |||
| f285120de5 | |||
| 5f56a0d2d7 | |||
| 79bb238b5f | |||
| 8c6baa9c0b | |||
| 5c2171db93 | |||
| e73b1e2db2 | |||
| 1a62f01cf7 | |||
| b518d5642f | |||
| e9dcafed07 | |||
| 9bd79e2752 | |||
| 77f363f737 | |||
| 3a866d2f55 | |||
| 3b8b1cff55 | |||
| a96d51bad2 | |||
| 1eb681992e | |||
| c140c6ef6a | |||
| 8c5a8fd7bc | |||
| 0d148f0efa | |||
| 9395c14324 | |||
| 3bd151445d | |||
| 90b0b667ce | |||
| c741cc4bba | |||
| c58203cdc1 | |||
| e56f807826 | |||
| ef3a93cb13 | |||
| fa55bd4c95 | |||
| 62a4de7a1d | |||
| a85d77b493 | |||
| 57b2cc5436 | |||
| 5894736c2a | |||
| fa407297c7 | |||
| 3d77b1d8c6 | |||
| fc2aca59aa | |||
| 0b79502804 | |||
| ab893e371c | |||
| 5174ea0ce6 | |||
| 44bb82919f | |||
| e2021faa33 | |||
| 3ac479ccdc | |||
| 9a4dd96072 | |||
| 3e9afa1d15 | |||
| 1c9e394549 | |||
| f8a901e2d0 | |||
| 59cd16f300 | |||
| b063c4af35 | |||
| 5942b88c8d | |||
| 9f50c9d660 | |||
| 942480d895 | |||
| e16972f410 | |||
| 77855a12e9 | |||
| cc8c771f61 | |||
| 31e5d626ca | |||
| 5067d33c84 | |||
| 931b66e038 | |||
| cb9dce54a7 | |||
| 5892c2fa1b | |||
| d50ee7467e | |||
| 6b3173e65f | |||
| 65fc2852ec | |||
| f51fb711b4 | |||
| d15ac8b84f | |||
| 00176a0425 | |||
| 14f0a757ac | |||
| 0385087f98 | |||
| 7b51ade6f5 | |||
| 49bd1657ab | |||
| 366b122c51 | |||
| d50f2b3ccc | |||
| f7110040b1 | |||
| 8ff979c2e9 | |||
| e4a69da400 | |||
| 9b24261b2b | |||
| 211f151346 | |||
| adc9445231 | |||
| 6c8cbec6ba | |||
| 9507e3b3f2 | |||
| a49951f392 | |||
| 3963f1fcef | |||
| 755a357e3d | |||
| 2a7256eb48 | |||
| 41e0b5fe83 | |||
| 5caf111308 | |||
| 7e7265827d | |||
| 65829b6e96 | |||
| e10aa90618 | |||
| 5210ffbd50 | |||
| 9b45589937 | |||
| 9c9ac53475 | |||
| d70c26f5ce | |||
| 0e8c37c293 | |||
| 284d54f456 | |||
| 6070cd54e2 | |||
| 5fd6709d04 | |||
| 0424b92b04 | |||
| 923f39fada | |||
| 6b6118ffcc | |||
| 84de7e98be | |||
| 906aace0df | |||
| 3fbb430b7f | |||
| c2de8a822a | |||
| 490180dbba | |||
| d928151fdb | |||
| c63a8adbb3 | |||
| a7e647d58a | |||
| b7062837c8 | |||
| f7a46174ad | |||
| 992bc0095f | |||
| bf67498f3e | |||
| c4676f1b28 | |||
| b4c9184a0d | |||
| 748b5d061b | |||
| ea15b54837 | |||
| 9d19af8749 | |||
| 05cef3635c | |||
| 1b03e3e71f | |||
| d15d681659 | |||
| 58189602cc | |||
| 6fd19e7618 | |||
| dbfdfcb202 | |||
| bf00185275 | |||
| 801b5e604e | |||
| 6ed57dae6c | |||
| cb34481460 | |||
| a1ff4a8de2 | |||
| d82f9a4d7a | |||
| 6d9d709183 | |||
| 3f317a6d1f | |||
| c2c085f57d | |||
| 5719444c94 | |||
| 2c5d36d618 | |||
| 36d8b8afe9 | |||
| 0f6cd18603 | |||
| 32c22eee70 | |||
| cea739dc2c | |||
| 4a769c1faa | |||
| a77f612973 | |||
| 198e878eb5 | |||
| 0942bc78ab | |||
| ca53d3d035 | |||
| a4f271d7b0 | |||
| c99b304ec2 | |||
| 1b032f3d74 | |||
| db57d253d9 | |||
| 8e64dcc5a4 | |||
| b48909edaa | |||
| 1bfb055a50 | |||
| 149d3a2030 | |||
| 8bad09ea5a | |||
| 91656095fa | |||
| 9e89e48c07 | |||
| 1e2b91e77f | |||
| fe89b146d7 | |||
| 1c5bd6cbab | |||
| 8ba7535fc8 | |||
| 038fa50194 | |||
| c94a294317 | |||
| d220685cff | |||
| edae000326 | |||
| 2cbc83b389 | |||
| d05afa3106 | |||
| de56349019 | |||
| 821f9cacd0 | |||
| eb472e27b4 | |||
| 4f38f17bd1 | |||
| 9f4a145b48 | |||
| 51aed7ae53 | |||
| eaa0bbf047 | |||
| e78391c68b | |||
| 109a5fe2b4 | |||
| a908c42910 | |||
| ecf59a75a7 | |||
| a19bf4bedd | |||
| 9039ff53db | |||
| b53b2859de | |||
| fe1372882e | |||
| 34e0b7e69a | |||
| 856ae09f69 | |||
| 28f2e14bce | |||
| e74199b3d2 | |||
| b8d9ba3b1d | |||
| 5fe6dd8730 | |||
| ab573cf9ba | |||
| 92902724a0 | |||
| 7e116dbd41 | |||
| c964ed7d58 | |||
| 88db7ec840 | |||
| b456a094ee | |||
| a19dc86ea9 | |||
| 62ba3fa029 | |||
| 58c2fa783e | |||
| 678101f7e4 | |||
| 17fb69ee8a | |||
| 0833c97c99 | |||
| 5d64c7c6e7 | |||
| 0f3ef78362 | |||
| fa65a546da | |||
| 1a54c8f8b9 | |||
| 9aa6bceddf | |||
| 6d6f87cae6 | |||
| 3d9a783d46 | |||
| 21028c2ca5 | |||
| 8c16766e9f | |||
| c8ca725523 | |||
| b0b99dec3e | |||
| 3c2fd33c7a | |||
| f9062d7d38 | |||
| 25fa05b701 | |||
| 6f66b0c533 | |||
| 99252cc950 | |||
| bf89efd471 | |||
| 8f14a0f30b | |||
| 494b7b52cb | |||
| e5d6f5df47 | |||
| 6f1ffaad40 | |||
| e76398db01 | |||
| 7c9ae624e9 | |||
| cafdb1d2a5 | |||
| 06bfb07f0d | |||
| e3c60a6b05 | |||
| 4a03b8cc4a | |||
| 5a0d23f6af | |||
| 652940657c | |||
| 421f5bb0f2 | |||
| 61640a9a06 | |||
| 87f0835010 | |||
| eb71d95944 | |||
| cab887c161 | |||
| b1b4c0e5ff | |||
| c5cd520bfe | |||
| f0dbf92bde | |||
| 1d27cc61f4 | |||
| f535cef848 | |||
| 7ad49a5650 | |||
| 71201f4446 | |||
| 3ad2fff67b | |||
| 66b56360da | |||
| e8f88ab20d | |||
| 7857106d76 | |||
| 64c74192c7 | |||
| 3ec47d195e | |||
| daf6dd5af2 | |||
| 9b8f01b293 | |||
| 3c60ee114c | |||
| 8165c6ffde | |||
| 7dc753a868 | |||
| ea475e2828 | |||
| c1f29d5317 | |||
| 5cb7ad11e4 | |||
| 68c9d3cfa5 | |||
| bbb9165a99 | |||
| 17fe60ecdc | |||
| ec01f4a77e | |||
| ef1fc051d5 | |||
| daa90eee79 | |||
| f253eb5448 | |||
| a7457fd058 | |||
| 6791799fcb | |||
| a03e397234 | |||
| 4db56e4536 | |||
| 99224aecb9 | |||
| dcf8f0fb01 | |||
| d04146db5b | |||
| 5a7d3de597 | |||
| 6cb6631d1a | |||
| 1a3ce88654 | |||
| 037879ca65 | |||
| cabecb0116 |
1
Common/.gitignore
vendored
Normal file
1
Common/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
**/module.version
|
||||
@ -26,14 +26,21 @@ bundle_xcframeworks {
|
||||
}
|
||||
}
|
||||
|
||||
core_win_arm64 {
|
||||
DEFINES += MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0
|
||||
}
|
||||
|
||||
core_windows {
|
||||
VS_VERSION=140
|
||||
VS_DEBUG=
|
||||
VS_ARCH=x64
|
||||
core_debug:VS_DEBUG=gd-
|
||||
core_win_32:VS_ARCH=x32
|
||||
core_win_arm64:VS_ARCH=a64
|
||||
vs2019:VS_VERSION=142
|
||||
|
||||
DEFINES += BOOST_USE_WINDOWS_H BOOST_WINAPI_NO_REDECLARATIONS
|
||||
|
||||
BOOST_POSTFIX = -vc$${VS_VERSION}-mt-$${VS_DEBUG}$${VS_ARCH}-1_72
|
||||
|
||||
core_boost_libs:LIBS += -L$$CORE_BOOST_LIBS -llibboost_system$$BOOST_POSTFIX -llibboost_filesystem$$BOOST_POSTFIX
|
||||
|
||||
2
Common/3dParty/brotli/.gitignore
vendored
Normal file
2
Common/3dParty/brotli/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
brotli/
|
||||
module.version
|
||||
9
Common/3dParty/brotli/brotli.pri
Normal file
9
Common/3dParty/brotli/brotli.pri
Normal file
@ -0,0 +1,9 @@
|
||||
SRC_DIR = $$PWD/brotli/c
|
||||
DEFINES += FT_CONFIG_OPTION_USE_BROTLI
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$SRC_DIR/include
|
||||
|
||||
SOURCES += $$files($$SRC_DIR/common/*.c)
|
||||
SOURCES += $$files($$SRC_DIR/dec/*.c)
|
||||
#SOURCES += $$files($$SRC_DIR/enc/*.c)
|
||||
20
Common/3dParty/brotli/make.py
Executable file
20
Common/3dParty/brotli/make.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append("../../../../build_tools/scripts")
|
||||
import base
|
||||
|
||||
def clear_module():
|
||||
if base.is_dir("brotli"):
|
||||
base.delete_dir_with_access_error("brotli")
|
||||
return
|
||||
|
||||
base.check_module_version("1", clear_module)
|
||||
|
||||
# fetch harfbuzz
|
||||
if not base.is_dir("brotli"):
|
||||
base.cmd("git", ["clone", "https://github.com/google/brotli.git"])
|
||||
os.chdir("brotli")
|
||||
base.cmd("git", ["checkout", "a47d7475063eb223c87632eed806c0070e70da29"])
|
||||
os.chdir("../")
|
||||
4
Common/3dParty/heif/.gitignore
vendored
Normal file
4
Common/3dParty/heif/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
x265_git
|
||||
libde265
|
||||
libheif
|
||||
ios-cmake
|
||||
42
Common/3dParty/heif/heif.pri
Normal file
42
Common/3dParty/heif/heif.pri
Normal file
@ -0,0 +1,42 @@
|
||||
DEFINES += LIBHEIF_STATIC_BUILD
|
||||
|
||||
HEIF_BUILDS_PLATFORM_PREFIX = $$CORE_BUILDS_PLATFORM_PREFIX
|
||||
core_ios : xcframework_platform_ios_simulator {
|
||||
HEIF_BUILDS_PLATFORM_PREFIX = ios_simulator
|
||||
}
|
||||
|
||||
HEIF_BUILD_PATH = $$PWD/libheif/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/libheif/libheif/api \
|
||||
$$HEIF_BUILD_PATH # for heif_version.h
|
||||
|
||||
core_windows {
|
||||
core_debug {
|
||||
BUILD_TYPE = Debug
|
||||
} else {
|
||||
BUILD_TYPE = Release
|
||||
}
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/$$BUILD_TYPE -lx265-static \
|
||||
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265/$$BUILD_TYPE -llibde265 \
|
||||
-L$$HEIF_BUILD_PATH/libheif/$$BUILD_TYPE -lheif
|
||||
}
|
||||
|
||||
core_linux | core_android {
|
||||
# we need to wrap x265 and de265 libraries in `whole-archive` flags to avoid "undefined symbol" errors when later linking with graphics.so
|
||||
LIBS += \
|
||||
-Wl,--whole-archive \
|
||||
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX -lx265 \
|
||||
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265 -lde265 \
|
||||
-Wl,--no-whole-archive \
|
||||
-L$$HEIF_BUILD_PATH/libheif -lheif
|
||||
}
|
||||
|
||||
core_mac | core_ios {
|
||||
LIBS += \
|
||||
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX -lx265 \
|
||||
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265 -lde265 \
|
||||
-L$$HEIF_BUILD_PATH/libheif -lheif
|
||||
}
|
||||
@ -12,7 +12,7 @@
|
||||
#include "StaticFunctions.h"
|
||||
#include "ConstValues.h"
|
||||
|
||||
#define DEFAULT_FONT_SIZE 14
|
||||
#define DEFAULT_FONT_SIZE 12
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
@ -49,6 +49,8 @@ namespace NSCSS
|
||||
if (!oElement.m_sId.empty())
|
||||
m_sId += L'+' + oElement.m_sId;
|
||||
|
||||
m_arParentsStyles.insert(oElement.m_arParentsStyles.begin(), oElement.m_arParentsStyles.end());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -69,6 +71,8 @@ namespace NSCSS
|
||||
m_oDisplay = oElement.m_oDisplay;
|
||||
m_oTransform = oElement.m_oTransform;
|
||||
|
||||
m_arParentsStyles = oElement.m_arParentsStyles;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -109,7 +113,8 @@ namespace NSCSS
|
||||
bool CCompiledStyle::Empty() const
|
||||
{
|
||||
return m_oBackground.Empty() && m_oBorder.Empty() && m_oFont.Empty() &&
|
||||
m_oMargin.Empty() && m_oPadding.Empty() && m_oText.Empty() && m_oDisplay.Empty();
|
||||
m_oMargin.Empty() && m_oPadding.Empty() && m_oText.Empty() &&
|
||||
m_oDisplay.Empty() && m_oTransform.Empty();
|
||||
}
|
||||
|
||||
void CCompiledStyle::AddPropSel(const std::wstring& sProperty, const std::wstring& sValue, const unsigned int unLevel, const bool& bHardMode)
|
||||
@ -314,6 +319,7 @@ namespace NSCSS
|
||||
}
|
||||
//BORDER TOP
|
||||
CASE(L"border-top"):
|
||||
CASE(L"mso-border-top-alt"):
|
||||
{
|
||||
m_oBorder.SetTopSide(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
@ -335,6 +341,7 @@ namespace NSCSS
|
||||
}
|
||||
//BORDER RIGHT
|
||||
CASE(L"border-right"):
|
||||
CASE(L"mso-border-right-alt"):
|
||||
{
|
||||
m_oBorder.SetRightSide(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
@ -356,6 +363,7 @@ namespace NSCSS
|
||||
}
|
||||
//BORDER bottom
|
||||
CASE(L"border-bottom"):
|
||||
CASE(L"mso-border-bottom-alt"):
|
||||
{
|
||||
m_oBorder.SetBottomSide(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
@ -377,6 +385,7 @@ namespace NSCSS
|
||||
}
|
||||
//BORDER LEFT
|
||||
CASE(L"border-left"):
|
||||
CASE(L"mso-border-left-alt"):
|
||||
{
|
||||
m_oBorder.SetLeftSide(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
@ -435,6 +444,11 @@ namespace NSCSS
|
||||
m_oDisplay.SetVAlign(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
}
|
||||
CASE(L"white-space"):
|
||||
{
|
||||
m_oDisplay.SetWhiteSpace(pPropertie.second, unLevel, bHardMode);
|
||||
break;
|
||||
}
|
||||
//TRANSFORM
|
||||
CASE(L"transform"):
|
||||
{
|
||||
@ -521,7 +535,7 @@ namespace NSCSS
|
||||
{
|
||||
return m_sId;
|
||||
}
|
||||
|
||||
|
||||
bool CCompiledStyle::HaveThisParent(const std::wstring &wsParentName) const
|
||||
{
|
||||
return m_arParentsStyles.end() != m_arParentsStyles.find(wsParentName);
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
#ifndef CCOMPILEDSTYLE_H
|
||||
#define CCOMPILEDSTYLE_H
|
||||
|
||||
#include "CssCalculator_global.h"
|
||||
#include "ConstValues.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
@ -13,14 +13,9 @@ namespace NSCSS
|
||||
delete m_pInternal;
|
||||
}
|
||||
|
||||
CCompiledStyle CCssCalculator::GetCompiledStyle(const std::vector<CNode> &arSelectors) const
|
||||
bool CCssCalculator::CalculateCompiledStyle(std::vector<CNode>& arSelectors) const
|
||||
{
|
||||
return m_pInternal->GetCompiledStyle(arSelectors);
|
||||
}
|
||||
|
||||
bool CCssCalculator::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors) const
|
||||
{
|
||||
return m_pInternal->GetCompiledStyle(oStyle, arSelectors);
|
||||
return m_pInternal->CalculateCompiledStyle(arSelectors);
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator::CalculateStyleId(const CNode& oNode)
|
||||
@ -63,6 +58,11 @@ namespace NSCSS
|
||||
return m_pInternal->GetDpi();
|
||||
}
|
||||
|
||||
bool CCssCalculator::HaveStylesById(const std::wstring& wsId) const
|
||||
{
|
||||
return m_pInternal->HaveStylesById(wsId);
|
||||
}
|
||||
|
||||
void CCssCalculator::ClearPageData()
|
||||
{
|
||||
m_pInternal->ClearPageData();
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
#define CCSSCALCULATOR_H
|
||||
|
||||
#include "CssCalculator_global.h"
|
||||
#include "CCompiledStyle.h"
|
||||
#include "ConstValues.h"
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "StyleProperties.h"
|
||||
#include "CNode.h"
|
||||
#include <vector>
|
||||
|
||||
namespace NSCSS
|
||||
@ -19,8 +17,7 @@ namespace NSCSS
|
||||
CCssCalculator();
|
||||
~CCssCalculator();
|
||||
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors) const;
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors) const;
|
||||
bool CalculateCompiledStyle(std::vector<CNode>& arSelectors) const;
|
||||
|
||||
std::wstring CalculateStyleId(const CNode& oNode);
|
||||
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
|
||||
@ -35,6 +32,8 @@ namespace NSCSS
|
||||
std::wstring GetEncoding() const;
|
||||
unsigned short int GetDpi() const;
|
||||
|
||||
bool HaveStylesById(const std::wstring& wsId) const;
|
||||
|
||||
void ClearPageData();
|
||||
void ClearEmbeddedStyles();
|
||||
void ClearAllowedStyleFiles();
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
@ -186,7 +184,7 @@ namespace NSCSS
|
||||
}
|
||||
#endif
|
||||
|
||||
const CElement* CStyleStorage::FindElement(const std::wstring& wsSelector)
|
||||
const CElement* CStyleStorage::FindElement(const std::wstring& wsSelector) const
|
||||
{
|
||||
if (wsSelector.empty())
|
||||
return nullptr;
|
||||
@ -472,7 +470,7 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
const CElement* CStyleStorage::FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData)
|
||||
const CElement* CStyleStorage::FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData) const
|
||||
{
|
||||
std::map<std::wstring, CElement*>::const_iterator itFound = mStyleData.find(wsSelector);
|
||||
|
||||
@ -488,6 +486,95 @@ namespace NSCSS
|
||||
{}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
bool CCssCalculator_Private::CalculateCompiledStyle(std::vector<CNode>& arSelectors)
|
||||
{
|
||||
if (arSelectors.empty())
|
||||
return false;
|
||||
|
||||
if (L"#text" == arSelectors.back().m_wsName)
|
||||
{
|
||||
if (arSelectors.size() > 1 && arSelectors.back().m_pCompiledStyle->Empty())
|
||||
*arSelectors.back().m_pCompiledStyle += *(arSelectors.end() - 2)->m_pCompiledStyle;
|
||||
|
||||
if(arSelectors.crend() != std::find_if(arSelectors.crbegin(), arSelectors.crend(),
|
||||
[](const CNode& oNode){ return IsTableElement(oNode.m_wsName); }))
|
||||
{
|
||||
arSelectors.back().m_pCompiledStyle->m_oBackground.Clear();
|
||||
arSelectors.back().m_pCompiledStyle->m_oBorder.Clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::map<std::vector<CNode>, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
|
||||
|
||||
if (oItem != m_mUsedStyles.end())
|
||||
{
|
||||
arSelectors.back().SetCompiledStyle(new CCompiledStyle(oItem->second));
|
||||
return true;
|
||||
}
|
||||
|
||||
arSelectors.back().m_pCompiledStyle->SetDpi(m_nDpi);
|
||||
unsigned int unStart = 0;
|
||||
|
||||
std::vector<CNode>::const_reverse_iterator itFound = std::find_if(arSelectors.crbegin(), arSelectors.crend(), [](const CNode& oNode){ return !oNode.m_pCompiledStyle->Empty(); });
|
||||
|
||||
if (itFound != arSelectors.crend())
|
||||
unStart = itFound.base() - arSelectors.cbegin();
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, unStart);
|
||||
std::vector<std::wstring> arPrevNodes;
|
||||
bool bInTable = false;
|
||||
|
||||
for (size_t i = 0; i < unStart; ++i)
|
||||
{
|
||||
if (!bInTable)
|
||||
bInTable = IsTableElement(arSelectors[i].m_wsName);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for (size_t i = unStart; i < arSelectors.size(); ++i)
|
||||
{
|
||||
if (0 != i)
|
||||
*arSelectors[i].m_pCompiledStyle += *arSelectors[i - 1].m_pCompiledStyle;
|
||||
|
||||
arSelectors[i].m_pCompiledStyle->AddParent(arSelectors[i].m_wsName);
|
||||
|
||||
if (!bInTable)
|
||||
bInTable = IsTableElement(arSelectors[i].m_wsName);
|
||||
|
||||
if (bInTable)
|
||||
{
|
||||
arSelectors[i].m_pCompiledStyle->m_oBackground.Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oBorder.Clear();
|
||||
}
|
||||
|
||||
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_mAttributes, i + 1);
|
||||
|
||||
for (const CElement* oElement : FindElements(arNodes, arPrevNodes))
|
||||
arSelectors[i].m_pCompiledStyle->AddStyle(oElement->GetStyle(), i + 1);
|
||||
|
||||
if (!arSelectors[i].m_wsStyle.empty())
|
||||
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
|
||||
// Скидываем некоторые внешние стили, которые внутри таблицы переопределяются
|
||||
if (bInTable && i < arSelectors.size() - 1)
|
||||
{
|
||||
arSelectors[i].m_pCompiledStyle->m_oFont.GetLineHeight().Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oPadding.Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oMargin.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
arSelectors.back().m_pCompiledStyle->SetID(CalculateStyleId(arSelectors.back()));
|
||||
|
||||
if (!arSelectors.back().m_pCompiledStyle->Empty())
|
||||
m_mUsedStyles[arSelectors] = *arSelectors.back().m_pCompiledStyle;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
//TODO:: пересмотреть данный метод
|
||||
@ -505,11 +592,11 @@ namespace NSCSS
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors)
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors, unsigned int unStart)
|
||||
{
|
||||
std::vector<std::wstring> arNodes;
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend() - unStart; ++oNode)
|
||||
{
|
||||
if (!oNode->m_wsName.empty())
|
||||
arNodes.push_back(oNode->m_wsName);
|
||||
@ -620,6 +707,16 @@ namespace NSCSS
|
||||
FindPrevAndKindElements(pFoundName, arNextNodes, arFindedElements, wsName, arClasses);
|
||||
}
|
||||
|
||||
const CElement* pFoundAll = m_oStyleStorage.FindElement(L"*");
|
||||
|
||||
if (nullptr != pFoundAll)
|
||||
{
|
||||
if (!pFoundAll->Empty())
|
||||
arFindedElements.push_back(pFoundAll);
|
||||
|
||||
FindPrevAndKindElements(pFoundAll, arNextNodes, arFindedElements, wsName, arClasses);
|
||||
}
|
||||
|
||||
if (arFindedElements.size() > 1)
|
||||
{
|
||||
std::sort(arFindedElements.rbegin(), arFindedElements.rend(),
|
||||
@ -631,79 +728,6 @@ namespace NSCSS
|
||||
}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle CCssCalculator_Private::GetCompiledStyle(const std::vector<CNode>& arSelectors)
|
||||
{
|
||||
if (arSelectors.empty())
|
||||
return CCompiledStyle();
|
||||
|
||||
CCompiledStyle oStyle;
|
||||
|
||||
GetCompiledStyle(oStyle, arSelectors);
|
||||
|
||||
return oStyle;
|
||||
}
|
||||
|
||||
bool CCssCalculator_Private::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors)
|
||||
{
|
||||
if (arSelectors.empty())
|
||||
return false;
|
||||
|
||||
const std::map<std::vector<CNode>, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
|
||||
|
||||
if (oItem != m_mUsedStyles.end())
|
||||
{
|
||||
oStyle = oItem->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
oStyle.SetDpi(m_nDpi);
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
|
||||
std::vector<std::wstring> arPrevNodes;
|
||||
bool bInTable = false;
|
||||
|
||||
for (size_t i = 0; i < arSelectors.size(); ++i)
|
||||
{
|
||||
oStyle.AddParent(arSelectors[i].m_wsName);
|
||||
|
||||
if (!bInTable)
|
||||
bInTable = IsTableElement(arSelectors[i].m_wsName);
|
||||
|
||||
if (bInTable)
|
||||
{
|
||||
oStyle.m_oBackground.Clear();
|
||||
oStyle.m_oBorder.Clear();
|
||||
}
|
||||
|
||||
CCompiledStyle oTempStyle;
|
||||
|
||||
oTempStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
|
||||
|
||||
for (const CElement* oElement : FindElements(arNodes, arPrevNodes))
|
||||
oTempStyle.AddStyle(oElement->GetStyle(), i + 1);
|
||||
|
||||
if (!arSelectors[i].m_wsStyle.empty())
|
||||
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
|
||||
oStyle += oTempStyle;
|
||||
|
||||
// Скидываем некоторые внешние стили, которые внутри таблицы переопределяются
|
||||
if (bInTable && i < arSelectors.size() - 1)
|
||||
{
|
||||
oStyle.m_oFont.GetLineHeight().Clear();
|
||||
oStyle.m_oPadding.Clear();
|
||||
oStyle.m_oMargin.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
oStyle.SetID(CalculateStyleId(arSelectors.back()));
|
||||
|
||||
if (!oStyle.Empty())
|
||||
m_mUsedStyles[arSelectors] = oStyle;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator_Private::CalculateStyleId(const CNode& oNode)
|
||||
{
|
||||
return oNode.m_wsName + ((!oNode.m_wsClass.empty()) ? L'.' + oNode.m_wsClass : L"") + ((oNode.m_wsId.empty()) ? L"" : L'#' + oNode.m_wsId) + L'-' + std::to_wstring(++m_nCountNodes);
|
||||
@ -766,6 +790,11 @@ namespace NSCSS
|
||||
return m_nDpi;
|
||||
}
|
||||
|
||||
bool CCssCalculator_Private::HaveStylesById(const std::wstring& wsId) const
|
||||
{
|
||||
return nullptr != m_oStyleStorage.FindElement(L'#' + wsId);
|
||||
}
|
||||
|
||||
void CCssCalculator_Private::ClearEmbeddedStyles()
|
||||
{
|
||||
m_oStyleStorage.ClearEmbeddedStyles();
|
||||
@ -910,4 +939,11 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ namespace NSCSS
|
||||
void ClearPageData();
|
||||
#endif
|
||||
|
||||
const CElement* FindElement(const std::wstring& wsSelector);
|
||||
const CElement* FindElement(const std::wstring& wsSelector) const;
|
||||
private:
|
||||
typedef struct
|
||||
{
|
||||
@ -77,7 +77,7 @@ namespace NSCSS
|
||||
|
||||
void GetOutputData(KatanaOutput* oOutput, std::map<std::wstring, CElement*>& mStyleData);
|
||||
|
||||
const CElement* FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData);
|
||||
const CElement* FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData) const;
|
||||
};
|
||||
|
||||
class CCssCalculator_Private
|
||||
@ -102,8 +102,7 @@ namespace NSCSS
|
||||
~CCssCalculator_Private();
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors);
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors);
|
||||
bool CalculateCompiledStyle(std::vector<CNode>& arSelectors);
|
||||
|
||||
std::wstring CalculateStyleId(const CNode& oNode);
|
||||
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
|
||||
@ -111,7 +110,7 @@ namespace NSCSS
|
||||
void ClearPageData();
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors);
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors, unsigned int unStart = 0);
|
||||
std::vector<const CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes);
|
||||
|
||||
void AddStyles(const std::string& sStyle);
|
||||
@ -123,6 +122,8 @@ namespace NSCSS
|
||||
std::wstring GetEncoding() const;
|
||||
unsigned short int GetDpi() const;
|
||||
|
||||
bool HaveStylesById(const std::wstring& wsId) const;
|
||||
|
||||
void ClearEmbeddedStyles();
|
||||
void ClearAllowedStyleFiles();
|
||||
void ClearStylesFromFile(const std::wstring& wsFilePath);
|
||||
|
||||
@ -1,19 +1,58 @@
|
||||
#include "CNode.h"
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
#include "CCompiledStyle.h"
|
||||
#endif
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
CNode::CNode()
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
: m_pCompiledStyle(new CCompiledStyle())
|
||||
#endif
|
||||
{}
|
||||
|
||||
CNode::CNode(const CNode& oNode)
|
||||
: m_wsName(oNode.m_wsName), m_wsClass(oNode.m_wsClass), m_wsId(oNode.m_wsId),
|
||||
m_wsStyle(oNode.m_wsStyle), m_mAttributes(oNode.m_mAttributes)
|
||||
{
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
m_pCompiledStyle = new CCompiledStyle();
|
||||
*m_pCompiledStyle = *oNode.m_pCompiledStyle;
|
||||
#endif
|
||||
}
|
||||
|
||||
CNode::CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId)
|
||||
: m_wsName(wsName), m_wsClass(wsClass), m_wsId(wsId)
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
, m_pCompiledStyle(new CCompiledStyle())
|
||||
#endif
|
||||
{}
|
||||
|
||||
CNode::~CNode()
|
||||
{
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
if (nullptr != m_pCompiledStyle)
|
||||
delete m_pCompiledStyle;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CNode::Empty() const
|
||||
{
|
||||
return m_wsName.empty() && m_wsClass.empty() && m_wsId.empty() && m_wsStyle.empty();
|
||||
}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
void CNode::SetCompiledStyle(CCompiledStyle* pCompiledStyle)
|
||||
{
|
||||
if (nullptr != m_pCompiledStyle)
|
||||
delete m_pCompiledStyle;
|
||||
|
||||
m_pCompiledStyle = new CCompiledStyle();
|
||||
*m_pCompiledStyle = *pCompiledStyle;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CNode::Clear()
|
||||
{
|
||||
m_wsName .clear();
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
class CCompiledStyle;
|
||||
#endif
|
||||
class CNode
|
||||
{
|
||||
public:
|
||||
@ -16,12 +19,21 @@ namespace NSCSS
|
||||
std::wstring m_wsStyle; // Стиль тэга
|
||||
std::map<std::wstring, std::wstring> m_mAttributes; // Остальные аттрибуты тэга
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle *m_pCompiledStyle;
|
||||
#endif
|
||||
public:
|
||||
CNode();
|
||||
CNode(const CNode& oNode);
|
||||
CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId);
|
||||
~CNode();
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
void SetCompiledStyle(CCompiledStyle* pCompiledStyle);
|
||||
#endif
|
||||
|
||||
void Clear();
|
||||
|
||||
std::vector<std::wstring> GetData() const;
|
||||
|
||||
@ -1328,8 +1328,14 @@ namespace NSCSS
|
||||
|
||||
// DISPLAY
|
||||
CDisplay::CDisplay()
|
||||
: m_oDisplay(L"inline", 0)
|
||||
{}
|
||||
{
|
||||
m_eWhiteSpace.SetMapping({{L"normal", EWhiteSpace::Normal },
|
||||
{L"nowrap", EWhiteSpace::Nowrap },
|
||||
{L"pre", EWhiteSpace::Pre },
|
||||
{L"pre-line", EWhiteSpace::Pre_Line},
|
||||
{L"pre-wrap", EWhiteSpace::Pre_Wrap}},
|
||||
EWhiteSpace::Normal);
|
||||
}
|
||||
|
||||
void CDisplay::Equation(CDisplay &oFirstDisplay, CDisplay &oSecondDisplay)
|
||||
{
|
||||
@ -1342,6 +1348,8 @@ namespace NSCSS
|
||||
CString::Equation(oFirstDisplay.m_oHAlign, oSecondDisplay.m_oHAlign);
|
||||
|
||||
CString::Equation(oFirstDisplay.m_oDisplay, oSecondDisplay.m_oDisplay);
|
||||
|
||||
CEnum::Equation(oFirstDisplay.m_eWhiteSpace, oSecondDisplay.m_eWhiteSpace);
|
||||
}
|
||||
|
||||
bool CDisplay::SetX(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -1405,6 +1413,11 @@ namespace NSCSS
|
||||
return m_oDisplay.SetValue(wsValue, NSConstValues::DISPLAY_VALUES, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CDisplay::SetWhiteSpace(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_eWhiteSpace.SetValue(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
const CDigit& CDisplay::GetX() const
|
||||
{
|
||||
return m_oX;
|
||||
@ -1440,34 +1453,42 @@ namespace NSCSS
|
||||
return m_oDisplay;
|
||||
}
|
||||
|
||||
const CEnum& CDisplay::GetWhiteSpace() const
|
||||
{
|
||||
return m_eWhiteSpace;
|
||||
}
|
||||
|
||||
bool CDisplay::Empty() const
|
||||
{
|
||||
return m_oX.Empty() && m_oY.Empty() && m_oWidth.Empty() && m_oHeight.Empty() &&
|
||||
m_oHeight.Empty() && m_oVAlign.Empty() && m_oDisplay.Empty();
|
||||
m_oHeight.Empty() && m_oVAlign.Empty() && m_oDisplay.Empty() &&
|
||||
(m_eWhiteSpace.Empty() || m_eWhiteSpace == EWhiteSpace::Normal);
|
||||
}
|
||||
|
||||
CDisplay &CDisplay::operator+=(const CDisplay &oDisplay)
|
||||
{
|
||||
m_oX += oDisplay.m_oX;
|
||||
m_oY += oDisplay.m_oY;
|
||||
m_oWidth = oDisplay.m_oWidth;
|
||||
m_oHeight = oDisplay.m_oHeight;
|
||||
m_oHAlign += oDisplay.m_oHAlign;
|
||||
m_oVAlign += oDisplay.m_oVAlign;
|
||||
m_oDisplay += oDisplay.m_oDisplay;
|
||||
m_oX += oDisplay.m_oX;
|
||||
m_oY += oDisplay.m_oY;
|
||||
m_oWidth = oDisplay.m_oWidth;
|
||||
m_oHeight = oDisplay.m_oHeight;
|
||||
m_oHAlign += oDisplay.m_oHAlign;
|
||||
m_oVAlign += oDisplay.m_oVAlign;
|
||||
m_oDisplay += oDisplay.m_oDisplay;
|
||||
m_eWhiteSpace += oDisplay.m_eWhiteSpace;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool CDisplay::operator==(const CDisplay &oDisplay) const
|
||||
{
|
||||
return m_oX == oDisplay.m_oX &&
|
||||
m_oY == oDisplay.m_oY &&
|
||||
m_oWidth == oDisplay.m_oWidth &&
|
||||
m_oHeight == oDisplay.m_oHeight &&
|
||||
m_oHAlign == oDisplay.m_oHAlign &&
|
||||
m_oVAlign == oDisplay.m_oVAlign &&
|
||||
m_oDisplay == oDisplay.m_oDisplay;
|
||||
return m_oX == oDisplay.m_oX &&
|
||||
m_oY == oDisplay.m_oY &&
|
||||
m_oWidth == oDisplay.m_oWidth &&
|
||||
m_oHeight == oDisplay.m_oHeight &&
|
||||
m_oHAlign == oDisplay.m_oHAlign &&
|
||||
m_oVAlign == oDisplay.m_oVAlign &&
|
||||
m_oDisplay == oDisplay.m_oDisplay &&
|
||||
m_eWhiteSpace == oDisplay.m_eWhiteSpace.ToInt();
|
||||
}
|
||||
|
||||
// STROKE
|
||||
|
||||
@ -328,6 +328,15 @@ namespace NSCSS
|
||||
};
|
||||
|
||||
// PROPERTIES
|
||||
typedef enum
|
||||
{
|
||||
Normal,
|
||||
Nowrap,
|
||||
Pre,
|
||||
Pre_Line,
|
||||
Pre_Wrap
|
||||
} EWhiteSpace;
|
||||
|
||||
class CDisplay
|
||||
{
|
||||
public:
|
||||
@ -347,6 +356,8 @@ namespace NSCSS
|
||||
|
||||
bool SetDisplay(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
bool SetWhiteSpace(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetX() const;
|
||||
const CDigit& GetY() const;
|
||||
const CDigit& GetWidth() const;
|
||||
@ -357,6 +368,8 @@ namespace NSCSS
|
||||
|
||||
const CString& GetDisplay() const;
|
||||
|
||||
const CEnum& GetWhiteSpace() const;
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
CDisplay& operator+=(const CDisplay& oDisplay);
|
||||
@ -371,6 +384,8 @@ namespace NSCSS
|
||||
CString m_oVAlign;
|
||||
|
||||
CString m_oDisplay;
|
||||
|
||||
CEnum m_eWhiteSpace;
|
||||
};
|
||||
|
||||
class CStroke
|
||||
|
||||
@ -22,10 +22,10 @@ namespace NSCSS
|
||||
: m_oStyle(oStyle), m_bIsPStyle(bIsPStyle)
|
||||
{}
|
||||
|
||||
bool CheckArrays(const std::vector<std::wstring>& arInitial, const std::set<std::wstring>& arFirst, const std::set<std::wstring>& arSecond)
|
||||
bool CheckArrays(const std::vector<std::wstring>& arInitial, const std::set<std::wstring>& arFirst, const std::set<std::wstring>& arSecond)
|
||||
{
|
||||
std::unordered_set<std::wstring> arInitialSet(arInitial.begin(), arInitial.end());
|
||||
|
||||
|
||||
std::vector<std::wstring> arCommonElements1;
|
||||
std::vector<std::wstring> arCommonElements2;
|
||||
|
||||
@ -470,9 +470,6 @@ namespace NSCSS
|
||||
|
||||
int nSpace{0};
|
||||
|
||||
if (NULL != pPadding && !pPadding->Empty() && !pPadding->Zero())
|
||||
nSpace = pPadding->ToInt(NSCSS::Point);
|
||||
|
||||
return L"w:val=\"" + wsStyle + L"\" w:sz=\"" + std::to_wstring(nWidth) + + L"\" w:space=\"" + std::to_wstring(nSpace) + L"\" w:color=\"" + wsColor + L"\"";
|
||||
}
|
||||
|
||||
@ -559,7 +556,7 @@ namespace NSCSS
|
||||
|
||||
if (oXmlElement.Empty())
|
||||
return false;
|
||||
|
||||
|
||||
m_sStyle += oXmlElement.GetPStyle(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -15,6 +15,10 @@
|
||||
#include "../../../UnicodeConverter/UnicodeConverter.h"
|
||||
#include "../../../HtmlFile2/src/StringFinder.h"
|
||||
|
||||
#if defined(CreateDirectory)
|
||||
#undef CreateDirectory
|
||||
#endif
|
||||
|
||||
static std::string nonbreaking_inline = "|a|abbr|acronym|b|bdo|big|cite|code|dfn|em|font|i|img|kbd|nobr|s|small|span|strike|strong|sub|sup|tt|";
|
||||
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|";
|
||||
@ -68,10 +72,10 @@ static std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert)
|
||||
{
|
||||
if (bNeedConvert)
|
||||
{ // Определение кодировки
|
||||
std::string sEncoding = NSStringFinder::FindPropety(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\""}).m_sValue;
|
||||
std::string sEncoding = NSStringFinder::FindProperty(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\"", "'"}).m_sValue;
|
||||
|
||||
if (sEncoding.empty())
|
||||
sEncoding = NSStringFinder::FindPropety(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
|
||||
sEncoding = NSStringFinder::FindProperty(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
|
||||
|
||||
if (!sEncoding.empty() && !NSStringFinder::Equals("utf-8", sEncoding))
|
||||
{
|
||||
@ -210,7 +214,7 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
|
||||
NSStringFinder::TFoundedData<char> oData;
|
||||
|
||||
// Content-Type
|
||||
oData = NSStringFinder::FindPropety(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
|
||||
const std::string sContentType{oData.m_sValue};
|
||||
|
||||
if (sContentType.empty())
|
||||
@ -226,18 +230,18 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
|
||||
unCharsetBegin = oData.m_unEndPosition;
|
||||
|
||||
// name
|
||||
// std::string sName = NSStringFinder::FindPropety(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
|
||||
// std::string sName = NSStringFinder::FindProperty(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
|
||||
// unContentPosition = std::max(unContentPosition, unLastPosition);
|
||||
|
||||
// Content-Location
|
||||
oData = NSStringFinder::FindPropety(sMhtContent, "content-location", {":"}, {";", "\\n", "\\r"});
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-location", {":"}, {";", "\\n", "\\r"});
|
||||
std::string sContentLocation{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
|
||||
// Content-ID
|
||||
oData = NSStringFinder::FindPropety(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
|
||||
std::string sContentID{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
@ -251,7 +255,7 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
|
||||
sContentLocation = "cid:" + sContentID;
|
||||
|
||||
// Content-Transfer-Encoding
|
||||
oData = NSStringFinder::FindPropety(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
|
||||
const std::string sContentEncoding{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
@ -265,7 +269,7 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
|
||||
|
||||
if (std::string::npos != unCharsetEnd && unCharsetBegin < unCharsetEnd)
|
||||
{
|
||||
sCharset = NSStringFinder::FindPropety(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
|
||||
sCharset = NSStringFinder::FindProperty(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
|
||||
NSStringFinder::CutInside<std::string>(sCharset, "\"");
|
||||
}
|
||||
|
||||
@ -337,7 +341,7 @@ static std::string mhtTohtml(const std::string& sFileContent)
|
||||
NSStringUtils::CStringBuilderA oRes;
|
||||
|
||||
// Поиск boundary
|
||||
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindPropety(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
|
||||
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindProperty(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
|
||||
|
||||
size_t nFound{oData.m_unEndPosition};
|
||||
std::string sBoundary{oData.m_sValue};
|
||||
@ -436,17 +440,17 @@ static void substitute_xml_entities_into_text(std::string& 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),
|
||||
// Since the attribute value does not use control characters (value <= 0x09),
|
||||
// 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; });
|
||||
std::string::iterator itFound = std::find_if(text.begin(), text.end(), [](unsigned char chValue){ return chValue <= 0x09; });
|
||||
|
||||
while (itFound != text.end())
|
||||
{
|
||||
itFound = text.erase(itFound);
|
||||
itFound = std::find_if(itFound, text.end(), [](char chValue){ return chValue <= 0x1F; });
|
||||
itFound = std::find_if(itFound, text.end(), [](unsigned char chValue){ return chValue <= 0x09; });
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,6 +493,7 @@ static void build_doctype(GumboNode* node, NSStringUtils::CStringBuilderA& oBuil
|
||||
oBuilder.WriteString("<!DOCTYPE ");
|
||||
oBuilder.WriteString(node->v.document.name);
|
||||
std::string pi(node->v.document.public_identifier);
|
||||
remove_control_symbols(pi);
|
||||
if ((node->v.document.public_identifier != NULL) && !pi.empty())
|
||||
{
|
||||
oBuilder.WriteString(" PUBLIC \"");
|
||||
@ -509,6 +514,10 @@ static void build_attributes(const GumboVector* attribs, NSStringUtils::CStringB
|
||||
GumboAttribute* at = static_cast<GumboAttribute*>(attribs->data[i]);
|
||||
std::string sVal(at->value);
|
||||
std::string sName(at->name);
|
||||
|
||||
remove_control_symbols(sVal);
|
||||
remove_control_symbols(sName);
|
||||
|
||||
atts.WriteString(" ");
|
||||
|
||||
bool bCheck = false;
|
||||
@ -569,6 +578,7 @@ static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA
|
||||
if (child->type == GUMBO_NODE_TEXT)
|
||||
{
|
||||
std::string val(child->v.text.text);
|
||||
remove_control_symbols(val);
|
||||
substitute_xml_entities_into_text(val);
|
||||
|
||||
// Избавление от FF
|
||||
@ -608,6 +618,7 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
|
||||
}
|
||||
|
||||
std::string tagname = get_tag_name(node);
|
||||
remove_control_symbols(tagname);
|
||||
|
||||
if (NodeIsUnprocessed(tagname))
|
||||
return;
|
||||
|
||||
43
Common/3dParty/hunspell/autogen/generate.py
Normal file
43
Common/3dParty/hunspell/autogen/generate.py
Normal file
@ -0,0 +1,43 @@
|
||||
import os
|
||||
import glob
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
curDirectory = os.path.dirname(os.path.realpath(__file__))
|
||||
dictionatiesDirectory = curDirectory + "/../../../../../dictionaries"
|
||||
|
||||
all_dictionaties = {}
|
||||
for dir in glob.glob(dictionatiesDirectory + "/*"):
|
||||
if not os.path.isdir(dir):
|
||||
continue
|
||||
dictionaryName = os.path.basename(dir)
|
||||
configFile = dictionatiesDirectory + "/" + dictionaryName + "/" + dictionaryName + ".json"
|
||||
if not os.path.isfile(configFile):
|
||||
continue
|
||||
isHyphen = False
|
||||
hyphenFile = dictionatiesDirectory + "/" + dictionaryName + "/hyph_" + dictionaryName + ".dic"
|
||||
if os.path.isfile(hyphenFile):
|
||||
isHyphen = True
|
||||
with open(configFile, 'r', encoding='utf-8') as file:
|
||||
data = json.loads(file.read())
|
||||
for lang in data["codes"]:
|
||||
all_dictionaties[str(lang)] = {
|
||||
"name": dictionaryName,
|
||||
"hyphen": isHyphen
|
||||
}
|
||||
|
||||
content = ""
|
||||
content += "#define DictionaryRec_count " + str(len(all_dictionaties)) + "\n"
|
||||
content += "typedef struct {\n"
|
||||
content += " const char* m_name;\n"
|
||||
content += " int m_lang;\n"
|
||||
content += "} DictionaryRec;\n\n"
|
||||
content += "static const DictionaryRec Dictionaries[DictionaryRec_count] = {\n"
|
||||
|
||||
for lang in all_dictionaties:
|
||||
info = all_dictionaties[lang]
|
||||
content += " { \"" + info["name"] + "\", " + str(lang) + " },\n"
|
||||
content += "};\n"
|
||||
|
||||
with open("./records.h", 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
73
Common/3dParty/hunspell/autogen/records.h
Normal file
73
Common/3dParty/hunspell/autogen/records.h
Normal file
@ -0,0 +1,73 @@
|
||||
#define DictionaryRec_count 65
|
||||
typedef struct {
|
||||
const char* m_name;
|
||||
int m_lang;
|
||||
} DictionaryRec;
|
||||
|
||||
static const DictionaryRec Dictionaries[DictionaryRec_count] = {
|
||||
{ "ar", 1025 },
|
||||
{ "ar", 2049 },
|
||||
{ "ar", 3073 },
|
||||
{ "ar", 4097 },
|
||||
{ "ar", 5121 },
|
||||
{ "ar", 6145 },
|
||||
{ "ar", 7169 },
|
||||
{ "ar", 8193 },
|
||||
{ "ar", 9217 },
|
||||
{ "ar", 10241 },
|
||||
{ "ar", 11265 },
|
||||
{ "ar", 12289 },
|
||||
{ "ar", 13313 },
|
||||
{ "ar", 14337 },
|
||||
{ "ar", 15361 },
|
||||
{ "ar", 16385 },
|
||||
{ "az_Latn_AZ", 1068 },
|
||||
{ "bg_BG", 1026 },
|
||||
{ "ca_ES", 1027 },
|
||||
{ "ca_ES_valencia", 2051 },
|
||||
{ "cs_CZ", 1029 },
|
||||
{ "da_DK", 1030 },
|
||||
{ "de_AT", 3079 },
|
||||
{ "de_CH", 2055 },
|
||||
{ "de_DE", 1031 },
|
||||
{ "el_GR", 1032 },
|
||||
{ "en_AU", 3081 },
|
||||
{ "en_CA", 4105 },
|
||||
{ "en_GB", 2057 },
|
||||
{ "en_US", 1033 },
|
||||
{ "en_ZA", 7177 },
|
||||
{ "es_ES", 3082 },
|
||||
{ "eu_ES", 1069 },
|
||||
{ "fr_FR", 1036 },
|
||||
{ "gl_ES", 1110 },
|
||||
{ "hr_HR", 1050 },
|
||||
{ "hu_HU", 1038 },
|
||||
{ "id_ID", 1057 },
|
||||
{ "it_IT", 1040 },
|
||||
{ "kk_KZ", 1087 },
|
||||
{ "ko_KR", 1042 },
|
||||
{ "lb_LU", 1134 },
|
||||
{ "lt_LT", 1063 },
|
||||
{ "lv_LV", 1062 },
|
||||
{ "mn_MN", 1104 },
|
||||
{ "nb_NO", 1044 },
|
||||
{ "nl_NL", 1043 },
|
||||
{ "nl_NL", 2067 },
|
||||
{ "nn_NO", 2068 },
|
||||
{ "oc_FR", 1154 },
|
||||
{ "pl_PL", 1045 },
|
||||
{ "pt_BR", 1046 },
|
||||
{ "pt_PT", 2070 },
|
||||
{ "ro_RO", 1048 },
|
||||
{ "ru_RU", 1049 },
|
||||
{ "sk_SK", 1051 },
|
||||
{ "sl_SI", 1060 },
|
||||
{ "sr_Cyrl_RS", 10266 },
|
||||
{ "sr_Latn_RS", 9242 },
|
||||
{ "sv_SE", 1053 },
|
||||
{ "tr_TR", 1055 },
|
||||
{ "uk_UA", 1058 },
|
||||
{ "uz_Cyrl_UZ", 2115 },
|
||||
{ "uz_Latn_UZ", 1091 },
|
||||
{ "vi_VN", 1066 },
|
||||
};
|
||||
@ -1,4 +1,4 @@
|
||||
ICU_MAJOR_VER = 58
|
||||
ICU_MAJOR_VER = 74
|
||||
|
||||
core_windows {
|
||||
exists($$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu) {
|
||||
@ -20,8 +20,15 @@ core_linux {
|
||||
core_mac {
|
||||
INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/include
|
||||
|
||||
LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicuuc.$${ICU_MAJOR_VER}.dylib
|
||||
LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicudata.$${ICU_MAJOR_VER}.dylib
|
||||
ICU_LIBS_PATH_MAC = $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build
|
||||
bundle_dylibs {
|
||||
LIBS += $$ICU_LIBS_PATH_MAC/libicudata.a
|
||||
LIBS += $$ICU_LIBS_PATH_MAC/libicui18n.a
|
||||
LIBS += $$ICU_LIBS_PATH_MAC/libicuuc.a
|
||||
} else {
|
||||
LIBS += $$ICU_LIBS_PATH_MAC/libicuuc.$${ICU_MAJOR_VER}.dylib
|
||||
LIBS += $$ICU_LIBS_PATH_MAC/libicudata.$${ICU_MAJOR_VER}.dylib
|
||||
}
|
||||
}
|
||||
|
||||
core_ios {
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
ICU_VERSION="58"
|
||||
|
||||
ICU_DIR="$PWD/icu"
|
||||
|
||||
ICU_SOURCE="${ICU_DIR}/source"
|
||||
@ -47,8 +45,6 @@ defines_utypes=(
|
||||
|
||||
function prebuild() {
|
||||
|
||||
svn export http://source.icu-project.org/repos/icu/tags/release-${ICU_VERSION}/icu4c/ ${ICU_DIR} --native-eol LF
|
||||
|
||||
echo "===== REMOVING data from bundle ====="
|
||||
|
||||
#Data bundle reduction
|
||||
|
||||
4
Common/3dParty/md/.gitignore
vendored
Normal file
4
Common/3dParty/md/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
md4c
|
||||
# Except this file
|
||||
!.gitignore
|
||||
13
Common/3dParty/md/fetch.py
Normal file
13
Common/3dParty/md/fetch.py
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../../../../build_tools/scripts')
|
||||
import config
|
||||
import base
|
||||
import os
|
||||
|
||||
base_directory = os.getcwd()
|
||||
|
||||
if not base.is_dir("md4c"):
|
||||
base.cmd("git", ["clone", "https://github.com/mity/md4c.git"])
|
||||
base.cmd_in_dir("md4c", "git", ["checkout", "481fbfbdf72daab2912380d62bb5f2187d438408"])
|
||||
105
Common/3dParty/md/md2html.cpp
Normal file
105
Common/3dParty/md/md2html.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
#include "md2html.h"
|
||||
|
||||
#include "md4c/src/md4c-html.h"
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
|
||||
namespace Md
|
||||
{
|
||||
void ToHtml(const MD_CHAR* pValue, MD_SIZE uSize, void* pData)
|
||||
{
|
||||
if (NULL != pData)
|
||||
(*(std::string*)pData).append(pValue, uSize);
|
||||
}
|
||||
|
||||
std::string ConvertMdStringToHtml(const std::string& sMdString)
|
||||
{
|
||||
std::string sData;
|
||||
md_html(sMdString.c_str(), sMdString.length(), ToHtml, &sData, 0, 0);
|
||||
return sData;
|
||||
}
|
||||
|
||||
void ToHtmlFile(const MD_CHAR* pValue, MD_SIZE uSize, void* pData)
|
||||
{
|
||||
if (NULL != pData)
|
||||
((NSFile::CFileBinary*)pData)->WriteFile(pValue, uSize);
|
||||
}
|
||||
|
||||
void WriteBaseHtmlStyles(NSFile::CFileBinary& oFile)
|
||||
{
|
||||
oFile.WriteStringUTF8(L"<style>");
|
||||
|
||||
// Main styles
|
||||
oFile.WriteStringUTF8(L"* { font-family: Arial; color:black; white-space:pre; }");
|
||||
oFile.WriteStringUTF8(L"p { margin: 0 0 10px; display: block; }");
|
||||
oFile.WriteStringUTF8(L"a { color: #0553c1; text-decoration: underline; } a:visited { color: #954f72; text-decoration: underline; }");
|
||||
oFile.WriteStringUTF8(L"ul { margin-top: 0; margin-bottom: 10px; }");
|
||||
oFile.WriteStringUTF8(L"img { vertical-align: middle; }");
|
||||
|
||||
// Styles for tables
|
||||
oFile.WriteStringUTF8(L"table { margin-bottom: 20px; width: 100%; max-width: 100%; border-spacing:0; border-collapse: collapse; border-color: gray;}");
|
||||
oFile.WriteStringUTF8(L"thead { display: table-header-group; vertical-align: middle; }");
|
||||
oFile.WriteStringUTF8(L"tr { display: table-row; }");
|
||||
oFile.WriteStringUTF8(L"th { text-align: left; display: table-cell; font-weight: bold; }");
|
||||
|
||||
oFile.WriteStringUTF8(L"table thead tr th { vertical-align: bottom; border-bottom: 2px solid #ddd; }");
|
||||
oFile.WriteStringUTF8(L"table thead tr th, table tbody tr th, table thead tr td, table tbody tr td { padding 8px; line-height: 1.4; vertical-align: top; border-top: 1px solid #ddd; }");
|
||||
oFile.WriteStringUTF8(L"table > caption + thead > tr > th, table > colgroup + thead > tr > th, table > thead > tr > th, table > caption + thead > tr > td, table > colgroup + thead > tr > td, table > thead > tr > td { border-top: 0; }");
|
||||
|
||||
// Styles for blockquote
|
||||
oFile.WriteStringUTF8(L"blockquote { border-left: 3px solid #e9e9e9; margin: 1.5em 0; padding: 0.5em 10px 0.5em 24px; font-size: 1.25rem; display: block; margin-top: 8pt; font-style: italic; color: #404040; }");
|
||||
|
||||
// Styles for code
|
||||
oFile.WriteStringUTF8(L"code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; }");
|
||||
oFile.WriteStringUTF8(L"pre code { padding: 0px; white-space: pre-wrap; border-radius: 0; background-color: #f5f5f5; color:black; }");
|
||||
oFile.WriteStringUTF8(L"pre { display: block; padding: 9.5px; margin: 0 0 10px; line-height: 1.4; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; }");
|
||||
oFile.WriteStringUTF8(L"code, pre { font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; }");
|
||||
|
||||
// Styles for headings
|
||||
oFile.WriteStringUTF8(L"h1 { font-size: 20pt; color: #0f4761; margin-top: 18pt; margin-bottom: 4pt; }");
|
||||
oFile.WriteStringUTF8(L"h2 { font-size: 16pt; color: #0f4761; margin-top: 8pt; margin-bottom: 4pt; }");
|
||||
oFile.WriteStringUTF8(L"h3 { font-size: 14pt; color: #0f4761; margin-top: 8pt; margin-bottom: 4pt; }");
|
||||
oFile.WriteStringUTF8(L"h4 { font-style: italic; color: #0f4761; margin-top: 4pt; margin-bottom: 2pt; }");
|
||||
oFile.WriteStringUTF8(L"h5 { color: #0f4761; margin-top: 4pt; margin-bottom: 2pt; }");
|
||||
oFile.WriteStringUTF8(L"h6 { font-style: italic; color: #595959; margin-top: 2pt; margin-bottom: 0; }");
|
||||
|
||||
oFile.WriteStringUTF8(L"</style>");
|
||||
}
|
||||
|
||||
bool ConvertMdFileToHtml(const std::wstring& wsPathToMdFile, const std::wstring& wsPathToHtmlFile)
|
||||
{
|
||||
std::string sMdData;
|
||||
|
||||
if (!NSFile::CFileBinary::ReadAllTextUtf8A(wsPathToMdFile, sMdData))
|
||||
return false;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
|
||||
if (!oFile.CreateFile(wsPathToHtmlFile))
|
||||
return false;
|
||||
|
||||
oFile.WriteStringUTF8(L"<html><body>");
|
||||
|
||||
oFile.WriteStringUTF8(L"<head>");
|
||||
//oFile.WriteStringUTF8(L"<meta charset=\"UTF-8\">");
|
||||
oFile.WriteStringUTF8(L"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
|
||||
WriteBaseHtmlStyles(oFile);
|
||||
oFile.WriteStringUTF8(L"</head>");
|
||||
|
||||
bool bResult = true;
|
||||
|
||||
if (0 != md_html(sMdData.c_str(), sMdData.length(), ToHtmlFile, &oFile,
|
||||
MD_DIALECT_GITHUB | MD_FLAG_NOINDENTEDCODEBLOCKS | MD_HTML_FLAG_SKIP_UTF8_BOM,
|
||||
0))
|
||||
bResult = false;
|
||||
|
||||
oFile.WriteStringUTF8(L"</body></html>");
|
||||
|
||||
oFile.CloseFile();
|
||||
|
||||
if (!bResult)
|
||||
NSFile::CFileBinary::Remove(wsPathToHtmlFile);
|
||||
|
||||
return bResult;
|
||||
}
|
||||
}
|
||||
|
||||
19
Common/3dParty/md/md2html.h
Normal file
19
Common/3dParty/md/md2html.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef MD2HTML_H
|
||||
#define MD2HTML_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef MDCONVERTER_DECL_EXPORT
|
||||
#define MDCONVERTER_DECL_EXPORT
|
||||
#else
|
||||
#include "../../../DesktopEditor/common/base_export.h"
|
||||
#define MDCONVERTER_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
namespace Md
|
||||
{
|
||||
std::string MDCONVERTER_DECL_EXPORT ConvertMdStringToHtml(const std::string& sMdString);
|
||||
bool MDCONVERTER_DECL_EXPORT ConvertMdFileToHtml(const std::wstring& wsPathToMdFile, const std::wstring& wsPathToHtmlFile);
|
||||
}
|
||||
|
||||
#endif // MD2HTML_H
|
||||
11
Common/3dParty/md/md2html.pri
Normal file
11
Common/3dParty/md/md2html.pri
Normal file
@ -0,0 +1,11 @@
|
||||
DEFINES += MD4C_USE_UTF8
|
||||
|
||||
HEADERS += $$PWD/md4c/src/md4c.h \
|
||||
$$PWD/md4c/src/md4c-html.h \
|
||||
$$PWD/md4c/src/entity.h \
|
||||
$$PWD/md2html.h \
|
||||
|
||||
SOURCES += $$PWD/md4c/src/md4c.c \
|
||||
$$PWD/md4c/src/md4c-html.c \
|
||||
$$PWD/md4c/src/entity.c \
|
||||
$$PWD/md2html.cpp
|
||||
16
Common/3dParty/md/test/TestMd.pro
Normal file
16
Common/3dParty/md/test/TestMd.pro
Normal file
@ -0,0 +1,16 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
TARGET = test
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../../
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/md/md2html.pri)
|
||||
|
||||
DESTDIR = $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX
|
||||
1
Common/3dParty/md/test/files/file-1.md
Normal file
1
Common/3dParty/md/test/files/file-1.md
Normal file
@ -0,0 +1 @@
|
||||
* foo **bar [link](http://example.com) baz**
|
||||
10
Common/3dParty/md/test/main.cpp
Normal file
10
Common/3dParty/md/test/main.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "../md2html.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout << (ConvertMdFileToHtml(L"YOUR_PATH", L"YOUR_PATH") ? "Good" : "Bad") << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -34,6 +34,8 @@
|
||||
#include "../../../../DesktopEditor/common/StringExt.h"
|
||||
|
||||
#include <wininet.h>
|
||||
#include <objbase.h>
|
||||
#include <urlmon.h>
|
||||
#pragma comment(lib, "Wininet")
|
||||
#pragma comment(lib, "Ole32.lib")
|
||||
|
||||
|
||||
@ -240,7 +240,7 @@ bool COfficeFileFormatChecker::isPdfFormatFile(unsigned char *pBuffer, int dwByt
|
||||
|
||||
documentID.clear();
|
||||
|
||||
if (dwBytes < 1)
|
||||
if (dwBytes < 5 || (pBuffer[0] == 'P' && pBuffer[1] == 'K'))
|
||||
return false;
|
||||
|
||||
pBuffer[dwBytes - 1] = '\0';
|
||||
@ -937,6 +937,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
}
|
||||
else if (0 == sExt.compare(L".mht") || 0 == sExt.compare(L".mhtml"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
|
||||
else if (0 == sExt.compare(L".md"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
|
||||
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xls") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xlsb"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
|
||||
@ -945,7 +947,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PDF;
|
||||
else if (0 == sExt.compare(L".doct")) // случай архива с html viewer
|
||||
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"))
|
||||
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"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT;
|
||||
else if (0 == sExt.compare(L".pages"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
|
||||
@ -1599,12 +1601,15 @@ bool COfficeFileFormatChecker::isOOXFlatFormatFile(unsigned char *pBuffer, int d
|
||||
const char *xlsxPackage = "progid=\"Excel.Sheet\"";
|
||||
const char *pptxPackage = "progid=\"PowerPoint.Show\"";
|
||||
const char *packageFormatLine = "xmlns:pkg=\"http://schemas.microsoft.com/office/2006/xmlPackage\"";
|
||||
const char* workbookFormatLine = "<Workbook";
|
||||
const char* htmlFormatLine = "<html";
|
||||
|
||||
if (std::string::npos != xml_string.find(docxFormatLine))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_FLAT;
|
||||
}
|
||||
else if (std::string::npos != xml_string.find(xlsxFormatLine))
|
||||
else if (std::string::npos != xml_string.find(xlsxFormatLine) && ( std::string::npos != xml_string.find(workbookFormatLine) ||
|
||||
std::string::npos == xml_string.find(htmlFormatLine)))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_FLAT;
|
||||
}
|
||||
@ -1665,6 +1670,14 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".fodt";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT:
|
||||
return L".ott";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES:
|
||||
return L".pages";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP:
|
||||
return L".hwp";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX:
|
||||
return L".hwpx";
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MD:
|
||||
return L".md";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
|
||||
return L".pptx";
|
||||
@ -1688,6 +1701,8 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".otp";
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG:
|
||||
return L".odg";
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY:
|
||||
return L".key";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
|
||||
return L".xlsx";
|
||||
@ -1709,6 +1724,8 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".fods";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS:
|
||||
return L".ots";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS:
|
||||
return L".numbers";
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF:
|
||||
@ -1838,6 +1855,14 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT;
|
||||
if (L".ott" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT;
|
||||
if (L".pages" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
|
||||
if (L".hwp" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
|
||||
if (L".hwpx" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX;
|
||||
if (L".md" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
|
||||
|
||||
if (L".pptx" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
|
||||
@ -1861,6 +1886,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP;
|
||||
if (L".odg" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG;
|
||||
if (L".key" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
|
||||
|
||||
if (L".xlsx" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
|
||||
@ -1888,6 +1915,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS;
|
||||
if (L".ods" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS;
|
||||
if (L".numbers" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
|
||||
|
||||
if (L".ooxml" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_OTHER_OOXML;
|
||||
|
||||
@ -58,7 +58,8 @@
|
||||
#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_HWPX AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001a
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_MD AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001b
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_XML AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0030
|
||||
|
||||
@ -154,4 +155,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
|
||||
|
||||
105
Common/base.pri
105
Common/base.pri
@ -47,7 +47,7 @@ win32 {
|
||||
DEFINES += COPYRIGHT_YEAR=$${CURRENT_YEAR}
|
||||
|
||||
QMAKE_TARGET_COMPANY = $$PUBLISHER_NAME
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved
|
||||
QMAKE_TARGET_COPYRIGHT = © $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved.
|
||||
|
||||
# CONFIGURATION
|
||||
CONFIG(debug, debug|release) {
|
||||
@ -91,6 +91,10 @@ isEqual(QT_MAJOR_VERSION, 5) {
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||
DEFINES += QT_VERSION_6
|
||||
|
||||
core_windows {
|
||||
QMAKE_CXXFLAGS += /permissive-
|
||||
}
|
||||
}
|
||||
|
||||
ios {
|
||||
@ -108,6 +112,10 @@ win32:contains(QMAKE_TARGET.arch, x86_64): {
|
||||
win32:!contains(QMAKE_TARGET.arch, x86_64): {
|
||||
CONFIG += core_win_32
|
||||
}
|
||||
win32:contains(QMAKE_TARGET.arch, arm64): {
|
||||
CONFIG -= core_win_32
|
||||
CONFIG += core_win_arm64
|
||||
}
|
||||
|
||||
linux-clang-libc++ {
|
||||
CONFIG += core_linux
|
||||
@ -190,6 +198,8 @@ core_windows {
|
||||
DEFINES += WIN32 _WIN32
|
||||
DEFINES += NOMINMAX
|
||||
|
||||
#DEFINES += WIN32_LEAN_AND_MEAN
|
||||
|
||||
# use default _ITERATOR_DEBUG_LEVEL value
|
||||
#core_debug:DEFINES += "_ITERATOR_DEBUG_LEVEL=0"
|
||||
}
|
||||
@ -199,6 +209,25 @@ core_win_64 {
|
||||
|
||||
core_linux {
|
||||
DEFINES += LINUX _LINUX
|
||||
|
||||
QMAKE_CUSTOM_SYSROOT = $$(QMAKE_CUSTOM_SYSROOT)
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT)/usr/bin/
|
||||
|
||||
core_linux_64 {
|
||||
!linux_arm64 { # x86_64
|
||||
QMAKE_CUSTOM_SYSROOT_LIB = $$(QMAKE_CUSTOM_SYSROOT)/usr/lib/x86_64-linux-gnu
|
||||
!isEmpty(QMAKE_CUSTOM_SYSROOT) {
|
||||
message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
|
||||
QMAKE_CXXFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_LFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
core_linux_host_arm64 {
|
||||
message("build on arm64")
|
||||
@ -211,7 +240,11 @@ core_mac {
|
||||
QMAKE_LFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
|
||||
|
||||
# xcode15 add new linker
|
||||
QMAKE_LFLAGS += -Wl,-ld_classic
|
||||
greaterThan(QMAKE_XCODE_VERSION, 1499) {
|
||||
QMAKE_LFLAGS += -Wl,-ld_classic
|
||||
} else {
|
||||
CONFIG += c++14
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += "-Wno-implicit-function-declaration"
|
||||
|
||||
@ -228,8 +261,8 @@ core_linux_clang {
|
||||
# PREFIXES
|
||||
core_windows {
|
||||
CONFIG -= debug_and_release debug_and_release_target
|
||||
QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
|
||||
QMAKE_CXXFLAGS -= -Zc:strictStrings
|
||||
QMAKE_CXXFLAGS_RELEASE += /Zc:strictStrings-
|
||||
QMAKE_CXXFLAGS += /Zc:strictStrings-
|
||||
QMAKE_CXXFLAGS += /MP
|
||||
|
||||
MSVC_VERSION_DETECT = $$(VisualStudioVersion)
|
||||
@ -285,6 +318,9 @@ core_win_32 {
|
||||
core_win_64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_64
|
||||
}
|
||||
core_win_arm64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_arm64
|
||||
}
|
||||
core_linux_32 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = linux_32
|
||||
}
|
||||
@ -311,8 +347,8 @@ linux_arm64 {
|
||||
|
||||
!isEmpty(ARM64_TOOLCHAIN_BIN){
|
||||
!isEmpty(ARM64_TOOLCHAIN_BIN_PREFIX){
|
||||
|
||||
ARM64_TOOLCHAIN_BIN_FULL = $$ARM64_TOOLCHAIN_BIN/$$ARM64_TOOLCHAIN_BIN_PREFIX
|
||||
message("using arm64 toolchain $$ARM64_TOOLCHAIN_BIN")
|
||||
|
||||
QMAKE_CC = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "gcc")
|
||||
QMAKE_CXX = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
@ -572,42 +608,45 @@ core_windows {
|
||||
DEFINES += CRYPTOPP_DISABLE_ASM
|
||||
}
|
||||
|
||||
core_ios:CONFIG+=support_bundle_dylibs
|
||||
core_ios|core_mac {
|
||||
CONFIG += support_bundle_dylibs
|
||||
}
|
||||
|
||||
!support_bundle_dylibs:CONFIG-=bundle_dylibs
|
||||
|
||||
core_ios {
|
||||
bundle_dylibs {
|
||||
plugin {
|
||||
CONFIG -= plugin
|
||||
CONFIG += lib_bundle
|
||||
bundle_dylibs {
|
||||
plugin {
|
||||
CONFIG -= plugin
|
||||
CONFIG += lib_bundle
|
||||
|
||||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
|
||||
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @executable_path/Frameworks
|
||||
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @loader_path/Frameworks
|
||||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
|
||||
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @executable_path/Frameworks
|
||||
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @loader_path/Frameworks
|
||||
|
||||
# correct version to < 256
|
||||
VERSIONS = $$split(VERSION, ".")
|
||||
VERSION_1 = $$member(VERSIONS, 0)
|
||||
VERSION_2 = $$member(VERSIONS, 1)
|
||||
VERSION_3 = $$member(VERSIONS, 2)
|
||||
VERSION_4 = $$member(VERSIONS, 3)
|
||||
# correct version to < 256
|
||||
VERSIONS = $$split(VERSION, ".")
|
||||
VERSION_1 = $$member(VERSIONS, 0)
|
||||
VERSION_2 = $$member(VERSIONS, 1)
|
||||
VERSION_3 = $$member(VERSIONS, 2)
|
||||
VERSION_4 = $$member(VERSIONS, 3)
|
||||
|
||||
greaterThan(VERSION_1, 255): VERSION_1 = 255
|
||||
greaterThan(VERSION_2, 255): VERSION_2 = 255
|
||||
greaterThan(VERSION_3, 255): VERSION_3 = 255
|
||||
greaterThan(VERSION_4, 255): VERSION_4 = 255
|
||||
greaterThan(VERSION_1, 255): VERSION_1 = 255
|
||||
greaterThan(VERSION_2, 255): VERSION_2 = 255
|
||||
greaterThan(VERSION_3, 255): VERSION_3 = 255
|
||||
greaterThan(VERSION_4, 255): VERSION_4 = 255
|
||||
|
||||
VERSION_CORRECT = $$VERSION_1
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_2)
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_3)
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_4)
|
||||
VERSION_CORRECT = $$VERSION_1
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_2)
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_3)
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
|
||||
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_4)
|
||||
|
||||
VERSION = $$VERSION_CORRECT
|
||||
}
|
||||
VERSION = $$VERSION_CORRECT
|
||||
MAJOR_VERSION = $$VERSION_1
|
||||
# set framework version as A
|
||||
QMAKE_FRAMEWORK_VERSION = A
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
Common/js/.gitignore
vendored
1
Common/js/.gitignore
vendored
@ -1 +1,2 @@
|
||||
emsdk
|
||||
__pycache__
|
||||
|
||||
@ -416,6 +416,16 @@ namespace agg
|
||||
{
|
||||
return self_type(rgba::from_wavelength(wl, gamma));
|
||||
}
|
||||
|
||||
bool operator==(const self_type& other)
|
||||
{
|
||||
return a == other.a && r == other.r && g == other.g && b == other.b;
|
||||
}
|
||||
|
||||
bool operator!=(const self_type& other)
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1465,7 +1465,29 @@ namespace agg
|
||||
}
|
||||
};
|
||||
|
||||
template<class ColorT, class Order> struct comp_op_rgba_draw_on_black
|
||||
{
|
||||
typedef ColorT color_type;
|
||||
typedef Order order_type;
|
||||
typedef typename color_type::value_type value_type;
|
||||
typedef typename color_type::calc_type calc_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = color_type::base_shift,
|
||||
base_mask = color_type::base_mask
|
||||
};
|
||||
|
||||
static AGG_INLINE void blend_pix(value_type* p,
|
||||
unsigned sr, unsigned sg, unsigned sb,
|
||||
unsigned sa, unsigned cover)
|
||||
{
|
||||
|
||||
if (0x00 != p[Order::R] || 0x00 != p[Order::G] || 0x00 != p[Order::B])
|
||||
return;
|
||||
|
||||
comp_op_rgba_src_over <ColorT,Order>::blend_pix(p, sr, sg, sb, sa, cover);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1515,6 +1537,9 @@ namespace agg
|
||||
comp_op_rgba_contrast <ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_invert <ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix,
|
||||
|
||||
//Custom function
|
||||
comp_op_rgba_draw_on_black<ColorT,Order>::blend_pix,
|
||||
0
|
||||
};
|
||||
|
||||
@ -1551,6 +1576,9 @@ namespace agg
|
||||
comp_op_invert, //----comp_op_invert
|
||||
comp_op_invert_rgb, //----comp_op_invert_rgb
|
||||
|
||||
//Custom modes
|
||||
comp_op_draw_on_black, //----comp_op_draw_on_black
|
||||
|
||||
end_of_comp_op_e
|
||||
};
|
||||
|
||||
|
||||
@ -1000,7 +1000,17 @@ namespace agg
|
||||
{
|
||||
if (i < RES && j < RES)
|
||||
{
|
||||
precalc[i][j] = c;
|
||||
if (m_oGradientInfo.luminocity)
|
||||
{
|
||||
ColorT fillC;
|
||||
fillC.r = m_oGradientInfo.shading.fill_color.r * c.r / 255 + 255 - c.r;
|
||||
fillC.g = m_oGradientInfo.shading.fill_color.g * c.g / 255 + 255 - c.g;
|
||||
fillC.b = m_oGradientInfo.shading.fill_color.b * c.b / 255 + 255 - c.b;
|
||||
fillC.a = 255;
|
||||
precalc[i][j] = fillC;
|
||||
}
|
||||
else
|
||||
precalc[i][j] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ namespace NSDirectory
|
||||
rmdir((char*)pUtf8);
|
||||
delete [] pUtf8;
|
||||
|
||||
if (deleteRoot = false)CreateDirectory(strDirectory);
|
||||
if (deleteRoot == false)CreateDirectory(strDirectory);
|
||||
#elif MAC
|
||||
BYTE* pUtf8 = NULL;
|
||||
LONG lLen = 0;
|
||||
@ -514,7 +514,7 @@ namespace NSDirectory
|
||||
rmdir((char*)pUtf8);
|
||||
delete [] pUtf8;
|
||||
|
||||
if (deleteRoot = false)CreateDirectory(strDirectory);
|
||||
if (deleteRoot == false)CreateDirectory(strDirectory);
|
||||
#endif
|
||||
}
|
||||
std::wstring GetFolderPath(const std::wstring& wsFolderPath)
|
||||
|
||||
@ -1629,6 +1629,10 @@ namespace NSFile
|
||||
{
|
||||
wsTemp = L"";
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
if (wsTempDir)
|
||||
free(wsTempDir);
|
||||
#endif
|
||||
wsTemp += L"x";
|
||||
int nTime = (int)time(NULL);
|
||||
for (int nIndex = 0; nIndex < 1000; ++nIndex)
|
||||
@ -1864,7 +1868,7 @@ namespace NSFile
|
||||
|
||||
namespace NSFile
|
||||
{
|
||||
bool CBase64Converter::Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags)
|
||||
bool CBase64Converter::Encode(const BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags)
|
||||
{
|
||||
if (!pDataSrc || nLenSrc < 1)
|
||||
return false;
|
||||
|
||||
@ -212,7 +212,7 @@ namespace NSFile
|
||||
class KERNEL_DECL CBase64Converter
|
||||
{
|
||||
public:
|
||||
static bool Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags = NSBase64::B64_BASE64_FLAG_NONE);
|
||||
static bool Encode(const BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags = NSBase64::B64_BASE64_FLAG_NONE);
|
||||
static bool Decode(const char* pDataSrc, int nLenSrc, BYTE*& pDataDst, int& nLenDst);
|
||||
};
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ namespace NSProcessEnv
|
||||
static const char* gc_proxy = "proxy";
|
||||
static const char* gc_proxyUser = "proxyUser";
|
||||
static const char* gc_proxyHeader = "proxyHeader";
|
||||
static const char* gc_oformAsPdf = "oformAsPdf";
|
||||
}
|
||||
|
||||
// serialize
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
@ -59,7 +59,7 @@ namespace NSSystemUtils
|
||||
static const wchar_t* gc_EnvLastModifiedBy = L"LAST_MODIFIED_BY";
|
||||
static const wchar_t* gc_EnvModified = L"MODIFIED";
|
||||
static const wchar_t* gc_EnvMemoryLimit = L"X2T_MEMORY_LIMIT";
|
||||
static const wchar_t* gc_EnvMemoryLimitDefault = L"4GiB";
|
||||
static const wchar_t* gc_EnvMemoryLimitDefault = L"3GiB";
|
||||
|
||||
KERNEL_DECL std::string GetEnvVariableA(const std::wstring& strName);
|
||||
KERNEL_DECL std::wstring GetEnvVariable(const std::wstring& strName);
|
||||
|
||||
@ -46,8 +46,10 @@
|
||||
#define CXIMAGE_SUPPORT_PSD 1
|
||||
|
||||
#ifndef BUILDING_WASM_MODULE
|
||||
#define CXIMAGE_SUPPORT_HEIF 1
|
||||
#define CXIMAGE_SUPPORT_RAW 1
|
||||
#else
|
||||
#define CXIMAGE_SUPPORT_HEIF 0
|
||||
#define CXIMAGE_SUPPORT_RAW 0
|
||||
#endif
|
||||
|
||||
|
||||
@ -133,13 +133,17 @@ CXIMAGE_FORMAT_PSD = 20,
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
CXIMAGE_FORMAR_PIC = 25,
|
||||
#endif
|
||||
#if CXIMAGE_SUPPORT_HEIF
|
||||
CXIMAGE_FORMAT_HEIF = 26,
|
||||
#endif
|
||||
CMAX_IMAGE_FORMATS = CXIMAGE_SUPPORT_BMP + CXIMAGE_SUPPORT_GIF + CXIMAGE_SUPPORT_JPG +
|
||||
CXIMAGE_SUPPORT_PNG + CXIMAGE_SUPPORT_MNG + CXIMAGE_SUPPORT_ICO +
|
||||
CXIMAGE_SUPPORT_TIF + CXIMAGE_SUPPORT_TGA + CXIMAGE_SUPPORT_PCX +
|
||||
CXIMAGE_SUPPORT_WBMP+ CXIMAGE_SUPPORT_WMF + CXIMAGE_SUPPORT_PIC +
|
||||
CXIMAGE_SUPPORT_JBG + CXIMAGE_SUPPORT_JP2 + CXIMAGE_SUPPORT_JPC +
|
||||
CXIMAGE_SUPPORT_PGX + CXIMAGE_SUPPORT_PNM + CXIMAGE_SUPPORT_RAS +
|
||||
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD + 1
|
||||
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD +
|
||||
CXIMAGE_SUPPORT_HEIF + 1
|
||||
};
|
||||
|
||||
#if CXIMAGE_SUPPORT_EXIF
|
||||
|
||||
@ -23,14 +23,14 @@
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma warning (disable : 4550)
|
||||
|
||||
#pragma warning (disable : 4550)
|
||||
|
||||
/*
|
||||
* TIFF Library
|
||||
*
|
||||
* Read and return a packed RGBA image.
|
||||
*/
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -828,11 +828,12 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
|
||||
nrowsub = nrow;
|
||||
if ((nrowsub%subsamplingver)!=0)
|
||||
nrowsub+=subsamplingver-nrowsub%subsamplingver;
|
||||
|
||||
if (TIFFReadEncodedStrip(tif,
|
||||
TIFFComputeStrip(tif,row+img->row_offset, 0),
|
||||
buf,
|
||||
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0
|
||||
&& img->stoponerr)
|
||||
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0
|
||||
&& img->stoponerr)
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
@ -23,6 +23,30 @@ public class NativeLibraryLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private static String libPrefix;
|
||||
private static String libExtension;
|
||||
|
||||
private static boolean loadIfExist(String libPath) {
|
||||
File libFile = new File(libPath);
|
||||
if (libFile.exists()) {
|
||||
System.load(libPath);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void load(Path libDirPath, String libName) {
|
||||
String libPath = libDirPath.resolve(libPrefix + libName + libExtension).toString();
|
||||
if (OSChecker.isMac()) {
|
||||
if (!loadIfExist(libPath)) {
|
||||
// if dylib does not exist, load framework library
|
||||
System.load(libDirPath.resolve(libName + ".framework/" + libName).toString());
|
||||
}
|
||||
} else {
|
||||
System.load(libPath);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
Path libDirPath = getLibPath();
|
||||
@ -31,8 +55,8 @@ public class NativeLibraryLoader {
|
||||
System.load(libDirPath.resolve("icudt58.dll").toString());
|
||||
System.load(libDirPath.resolve("icuuc58.dll").toString());
|
||||
} else if (OSChecker.isMac()) {
|
||||
System.load(libDirPath.resolve("libicudata.58.dylib").toString());
|
||||
System.load(libDirPath.resolve("libicuuc.58.dylib").toString());
|
||||
loadIfExist(libDirPath.resolve("libicudata.58.dylib").toString());
|
||||
loadIfExist(libDirPath.resolve("libicuuc.58.dylib").toString());
|
||||
} else if (OSChecker.isLinux()) {
|
||||
System.load(libDirPath.resolve("libicudata.so.58").toString());
|
||||
System.load(libDirPath.resolve("libicuuc.so.58").toString());
|
||||
@ -42,24 +66,25 @@ public class NativeLibraryLoader {
|
||||
|
||||
String[] libs = {"UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer", "doctrenderer", "docbuilder.jni"};
|
||||
|
||||
String prefix = "";
|
||||
libPrefix = "";
|
||||
if (OSChecker.isMac() || OSChecker.isLinux()) {
|
||||
prefix = "lib";
|
||||
libPrefix = "lib";
|
||||
}
|
||||
|
||||
String extension = "";
|
||||
libExtension = "";
|
||||
if (OSChecker.isWindows()) {
|
||||
extension = ".dll";
|
||||
libExtension = ".dll";
|
||||
} else if (OSChecker.isMac()) {
|
||||
extension = ".dylib";
|
||||
libExtension = ".dylib";
|
||||
} else {
|
||||
extension = ".so";
|
||||
libExtension = ".so";
|
||||
}
|
||||
|
||||
for (String lib : libs) {
|
||||
System.load(libDirPath.resolve(prefix + lib + extension).toString());
|
||||
load(libDirPath, lib);
|
||||
}
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
throw new RuntimeException("Cannot load dynamic libraries. Check if JAR file is in the same directory as all docbuilder libraries.");
|
||||
}
|
||||
}
|
||||
|
||||
1
DesktopEditor/doctrenderer/docbuilder.net/.gitignore
vendored
Normal file
1
DesktopEditor/doctrenderer/docbuilder.net/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
deploy/
|
||||
@ -24,6 +24,10 @@ def _loadLibrary(path):
|
||||
library_name = 'libdocbuilder.c.so'
|
||||
elif 'darwin' == os_name:
|
||||
library_name = 'libdocbuilder.c.dylib'
|
||||
# if there is no dylib file, get library from framework
|
||||
if not os.path.exists(path + '/' + library_name):
|
||||
path = path + '/docbuilder.c.framework'
|
||||
library_name = 'docbuilder.c'
|
||||
|
||||
_lib = ctypes.CDLL(path + '/' + library_name)
|
||||
|
||||
@ -437,7 +441,7 @@ class CDocBuilderValue:
|
||||
return CDocBuilderValue(OBJECT_HANDLE(_lib.CDocBuilderValue_Call6(self._internal, ctypes.c_wchar_p(name), values[0]._internal, values[1]._internal, values[2]._internal, values[3]._internal, values[4]._internal, values[5]._internal)))
|
||||
else:
|
||||
raise TypeError("Call() expects at most 6 arguments")
|
||||
|
||||
|
||||
def append(self, value):
|
||||
if not self.IsArray():
|
||||
raise TypeError("Object is not an array")
|
||||
@ -479,7 +483,7 @@ class CDocBuilder:
|
||||
# using self._lib instead of global _lib because it might be already garbage collected during this function call
|
||||
self._lib.CDocBuilder_Destroy(self._internal)
|
||||
|
||||
def OpenFile(self, path, params):
|
||||
def OpenFile(self, path, params=""):
|
||||
return _lib.CDocBuilder_OpenFile(self._internal, ctypes.c_wchar_p(path), ctypes.c_wchar_p(params))
|
||||
|
||||
def CreateFile(self, type):
|
||||
|
||||
@ -74,6 +74,7 @@ CV8RealTimeWorker::CV8RealTimeWorker(NSDoctRenderer::CDocBuilder* pBuilder, cons
|
||||
global->set("native", oNativeCtrl);
|
||||
|
||||
CBuilderEmbed* pBuilderJSNative = static_cast<CBuilderEmbed*>(oBuilderJS->getNative());
|
||||
pBuilderJSNative->SetExternalize(true);
|
||||
pBuilderJSNative->m_pBuilder = pBuilder;
|
||||
}
|
||||
CV8RealTimeWorker::~CV8RealTimeWorker()
|
||||
@ -1241,13 +1242,13 @@ namespace NSDoctRenderer
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (_currentPos < _commandsLen && !(_commandsPtr[_currentPos] == '\"' && _commandsPtr[_currentPos - 1] != '\\'))
|
||||
while (_currentPos < _commandsLen && !((_commandsPtr[_currentPos] == '\"' || _commandsPtr[_currentPos] == '\'') && _commandsPtr[_currentPos - 1] != '\\'))
|
||||
++_currentPos;
|
||||
|
||||
++_currentPos;
|
||||
size_t _start = _currentPos;
|
||||
|
||||
while (_currentPos < _commandsLen && !(_commandsPtr[_currentPos] == '\"' && _commandsPtr[_currentPos - 1] != '\\'))
|
||||
while (_currentPos < _commandsLen && !((_commandsPtr[_currentPos] == '\"' || _commandsPtr[_currentPos] == '\'') && _commandsPtr[_currentPos - 1] != '\\'))
|
||||
++_currentPos;
|
||||
|
||||
if (_currentPos > _start)
|
||||
@ -1272,7 +1273,7 @@ namespace NSDoctRenderer
|
||||
if (m_pInternal->m_nFileType != -1 && m_pInternal->m_bIsOpenedFromSimpleJS)
|
||||
{
|
||||
m_pInternal->m_bIsOpenedFromSimpleJS = false;
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_pInternal->m_nFileType = -1;
|
||||
@ -1513,7 +1514,8 @@ namespace NSDoctRenderer
|
||||
if (nCountParameters > 2)
|
||||
sParams = _builder_params[2].c_str();
|
||||
|
||||
this->SaveFile(nFormat, _builder_params[1].c_str(), sParams);
|
||||
int nSaveError = this->SaveFile(nFormat, _builder_params[1].c_str(), sParams);
|
||||
bIsNoError = (0 == nSaveError);
|
||||
}
|
||||
else if ("WriteData" == sFuncNum)
|
||||
{
|
||||
|
||||
@ -547,6 +547,7 @@ namespace NSDoctRenderer
|
||||
CApplicationFontsWorker oWorker;
|
||||
oWorker.m_bIsUseSystemFonts = m_oParams.m_bIsSystemFonts;
|
||||
oWorker.m_arAdditionalFolders = m_oParams.m_arFontDirs;
|
||||
oWorker.m_arAdditionalFolders.push_back(NSFile::GetProcessDirectory() + L"/fonts");
|
||||
oWorker.m_bIsNeedThumbnails = false;
|
||||
oWorker.m_sDirectory = sDirectory;
|
||||
// это не рабочая папка, где только шрифты
|
||||
@ -927,7 +928,7 @@ namespace NSDoctRenderer
|
||||
|
||||
COfficeFileFormatChecker oChecker;
|
||||
if (!oChecker.isOfficeFile(sFileCopy))
|
||||
return false;
|
||||
return 1;
|
||||
|
||||
if (oChecker.nFileType & AVS_OFFICESTUDIO_FILE_DOCUMENT)
|
||||
m_nFileType = 0;
|
||||
|
||||
@ -283,16 +283,26 @@ public:
|
||||
return NULL;
|
||||
return m_pFile->ConvertToPixels(nPageIndex, nRasterW, nRasterH, true, m_pFontManager, nBackgroundColor, (nBackgroundColor == 0xFFFFFF) ? false : true);
|
||||
}
|
||||
BYTE* SplitPages(int* arrPageIndex, int nLength)
|
||||
BYTE* SplitPages(int* arrPageIndex, int nLength, BYTE* data, LONG size)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->SplitPages(arrPageIndex, nLength);
|
||||
return ((CPdfFile*)m_pFile)->SplitPages(arrPageIndex, nLength, data, size);
|
||||
return NULL;
|
||||
}
|
||||
bool MergePages(BYTE* data, LONG size, int nMaxID, const std::string& sPrefixForm)
|
||||
bool MergePages(BYTE* data, LONG size, int nMaxID, const std::string& sPrefixForm, bool bCopy = false)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
{
|
||||
// Память из CDrawingFileEmbed освобождается сразу после вызова функции, поэтому копируем
|
||||
if (bCopy)
|
||||
{
|
||||
BYTE* pCopy = (BYTE*)malloc(size);
|
||||
memcpy(pCopy, data, size);
|
||||
data = pCopy;
|
||||
}
|
||||
// Захватывает полученную память, будет освобождена либо в деструкторе MemStream, либо free в случае неудачи
|
||||
return ((CPdfFile*)m_pFile)->MergePages(data, size, nMaxID, sPrefixForm);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool UnmergePages()
|
||||
@ -420,22 +430,32 @@ public:
|
||||
oRenderer.SetExternalImageStorage(m_pImageStorage);
|
||||
oRenderer.SetTextAssociationType(NSDocxRenderer::TextAssociationType::tatParagraphToShape);
|
||||
|
||||
std::vector<std::wstring> arShapes;
|
||||
if (0 == mode)
|
||||
arShapes = oRenderer.ScanPage(m_pFile, nPageIndex);
|
||||
else
|
||||
arShapes = oRenderer.ScanPagePptx(m_pFile, nPageIndex);
|
||||
|
||||
int nLen = (int)arShapes.size();
|
||||
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
oRes.AddInt(nLen);
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
std::vector<std::wstring> arShapes = (0 == mode) ? oRenderer.ScanPage(m_pFile, nPageIndex) : oRenderer.ScanPagePptx(m_pFile, nPageIndex);
|
||||
int nLen = (int)arShapes.size();
|
||||
|
||||
for (int i = 0; i < nLen; ++i)
|
||||
oRes.WriteString(arShapes[i]);
|
||||
oRes.SkipLen();
|
||||
oRes.AddInt(nLen);
|
||||
|
||||
oRes.WriteLen();
|
||||
for (int i = 0; i < nLen; ++i)
|
||||
oRes.WriteString(arShapes[i]);
|
||||
|
||||
oRes.WriteLen();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
oRes = oRenderer.ScanPageBin(m_pFile, nPageIndex);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
|
||||
@ -166,6 +166,48 @@ JSSmart<CJSValue> CDrawingFileEmbed::FreeWasmData(JSSmart<CJSValue> typedArray)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::SplitPages(JSSmart<CJSValue> arrPageIndexes, JSSmart<CJSValue> data)
|
||||
{
|
||||
JSSmart<CJSArray> arrPages = arrPageIndexes->toArray();
|
||||
CJSDataBuffer changes;
|
||||
if (data->isTypedArray())
|
||||
changes = data->toTypedArray()->getData();
|
||||
|
||||
int nCountPages = arrPages->getCount();
|
||||
int* pPages = NULL;
|
||||
if (0 < nCountPages)
|
||||
pPages = new int[nCountPages];
|
||||
|
||||
for (int i = 0; i < nCountPages; i++)
|
||||
pPages[i] = arrPages->get(i)->toInt32();
|
||||
|
||||
JSSmart<CJSValue> res = WasmMemoryToJS(m_pFile->SplitPages(pPages, nCountPages, changes.Data, (LONG)changes.Len));
|
||||
if (pPages)
|
||||
delete [] pPages;
|
||||
return res;
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::MergePages(JSSmart<CJSValue> data, JSSmart<CJSValue> nMaxID, JSSmart<CJSValue> sPrefixForm)
|
||||
{
|
||||
bool result = false;
|
||||
if (m_pFile)
|
||||
{
|
||||
JSSmart<CJSTypedArray> dataPtr = data->toTypedArray();
|
||||
int maxID = nMaxID->toInt32();
|
||||
std::string prefix = sPrefixForm->toStringA();
|
||||
CJSDataBuffer buffer = dataPtr->getData();
|
||||
result = m_pFile->MergePages(buffer.Data, (LONG)buffer.Len, maxID, prefix, true);
|
||||
if (buffer.IsExternalize)
|
||||
buffer.Free();
|
||||
}
|
||||
return CJSContext::createBool(result);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::UnmergePages()
|
||||
{
|
||||
if (m_pFile)
|
||||
return CJSContext::createBool(m_pFile->UnmergePages());
|
||||
return CJSContext::createBool(false);
|
||||
}
|
||||
|
||||
bool EmbedDrawingFile(JSSmart<NSJSBase::CJSContext>& context, IOfficeDrawingFile* pFile)
|
||||
{
|
||||
CJSContext::Embed<CDrawingFileEmbed>(false);
|
||||
|
||||
@ -51,6 +51,10 @@ public:
|
||||
|
||||
JSSmart<CJSValue> FreeWasmData(JSSmart<CJSValue> typedArray);
|
||||
|
||||
JSSmart<CJSValue> SplitPages(JSSmart<CJSValue> arrPageIndexes, JSSmart<CJSValue> data);
|
||||
JSSmart<CJSValue> MergePages(JSSmart<CJSValue> data, JSSmart<CJSValue> nMaxID, JSSmart<CJSValue> sPrefixForm);
|
||||
JSSmart<CJSValue> UnmergePages();
|
||||
|
||||
DECLARE_EMBED_METHODS
|
||||
};
|
||||
|
||||
|
||||
@ -196,7 +196,9 @@ JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSVa
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::Destroy()
|
||||
{
|
||||
// For save image bits, if needed.
|
||||
m_pInternal->Destroy();
|
||||
RELEASEOBJECT(m_pInternal);
|
||||
return NULL;
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::EndDraw()
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
public:
|
||||
CBuilderDocumentEmbed() : m_pBuilder(NULL), m_bIsValid(false) {}
|
||||
~CBuilderDocumentEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); }
|
||||
~CBuilderDocumentEmbed() { if(m_pBuilder && !m_isExternalize) RELEASEOBJECT(m_pBuilder); }
|
||||
|
||||
virtual void* getObject() { return (void*)m_pBuilder; }
|
||||
NSDoctRenderer::CDocBuilder_Private* GetPrivate(NSDoctRenderer::CDocBuilder* pBuilder) { return pBuilder->GetPrivate(); }
|
||||
|
||||
@ -88,6 +88,7 @@ JSSmart<CJSValue> CBuilderEmbed::OpenTmpFile(JSSmart<CJSValue> path, JSSmart<CJS
|
||||
JSSmart<CJSObject> oBuilderTmpDoc = CJSContext::createEmbedObject("CBuilderDocumentEmbed");
|
||||
CBuilderDocumentEmbed* pBuilderTmpDocNative = static_cast<CBuilderDocumentEmbed*>(oBuilderTmpDoc->getNative());
|
||||
pBuilderTmpDocNative->m_pBuilder = m_pBuilder;
|
||||
pBuilderTmpDocNative->SetExternalize(true);
|
||||
pBuilderTmpDocNative->_OpenFile(sPath, sParams);
|
||||
return oBuilderTmpDoc->toValue();
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public:
|
||||
NSDoctRenderer::CDocBuilder* m_pBuilder;
|
||||
|
||||
CBuilderEmbed() : m_pBuilder(NULL) {}
|
||||
~CBuilderEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); }
|
||||
~CBuilderEmbed() { if(m_pBuilder && !m_isExternalize) RELEASEOBJECT(m_pBuilder); }
|
||||
|
||||
virtual void* getObject() { return (void*)m_pBuilder; }
|
||||
NSDoctRenderer::CDocBuilder_Private* GetPrivate() { return m_pBuilder->GetPrivate(); }
|
||||
|
||||
@ -27,6 +27,9 @@
|
||||
-(JSValue*) ScanPage : (JSValue*)nPageIndex : (JSValue*)mode;
|
||||
-(JSValue*) GetImageBase64 : (JSValue*)rId;
|
||||
-(JSValue*) FreeWasmData : (JSValue*)typedArray;
|
||||
-(JSValue*) SplitPages : (JSValue*)arrPageIndexes : (JSValue*)data;
|
||||
-(JSValue*) MergePages : (JSValue*)data : (JSValue*)nMaxID : (JSValue*)sPrefixForm;
|
||||
-(JSValue*) UnmergePages;
|
||||
@end
|
||||
|
||||
@interface CJSCDrawingFileEmbed : NSObject<IJSCDrawingFileEmbed, JSEmbedObjectProtocol>
|
||||
@ -61,6 +64,9 @@ FUNCTION_WRAPPER_JS_0(IsNeedCMap, IsNeedCMap)
|
||||
FUNCTION_WRAPPER_JS_2(ScanPage, ScanPage)
|
||||
FUNCTION_WRAPPER_JS_1(GetImageBase64, GetImageBase64)
|
||||
FUNCTION_WRAPPER_JS_1(FreeWasmData, FreeWasmData)
|
||||
FUNCTION_WRAPPER_JS_2(SplitPages, SplitPages)
|
||||
FUNCTION_WRAPPER_JS_3(MergePages, MergePages)
|
||||
FUNCTION_WRAPPER_JS_0(UnmergePages, UnmergePages)
|
||||
@end
|
||||
|
||||
class CDrawingFileEmbedAdapter : public CJSEmbedObjectAdapterJSC
|
||||
|
||||
@ -30,6 +30,9 @@ namespace NSDrawingFileEmbed
|
||||
FUNCTION_WRAPPER_V8_2(_ScanPage, ScanPage)
|
||||
FUNCTION_WRAPPER_V8_1(_GetImageBase64, GetImageBase64)
|
||||
FUNCTION_WRAPPER_V8_1(_FreeWasmData, FreeWasmData)
|
||||
FUNCTION_WRAPPER_V8_2(_SplitPages, SplitPages)
|
||||
FUNCTION_WRAPPER_V8_3(_MergePages, MergePages)
|
||||
FUNCTION_WRAPPER_V8_0(_UnmergePages, UnmergePages)
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
|
||||
{
|
||||
@ -59,6 +62,9 @@ namespace NSDrawingFileEmbed
|
||||
NSV8Objects::Template_Set(result, "ScanPage", _ScanPage);
|
||||
NSV8Objects::Template_Set(result, "GetImageBase64", _GetImageBase64);
|
||||
NSV8Objects::Template_Set(result, "FreeWasmData", _FreeWasmData);
|
||||
NSV8Objects::Template_Set(result, "SplitPages", _SplitPages);
|
||||
NSV8Objects::Template_Set(result, "MergePages", _MergePages);
|
||||
NSV8Objects::Template_Set(result, "UnmergePages", _UnmergePages);
|
||||
|
||||
return handle_scope.Escape(result);
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ namespace NSGraphics
|
||||
|
||||
m_pRenderer = NSGraphics::Create();
|
||||
m_pRenderer->SetFontManager(pManager);
|
||||
RELEASEINTERFACE(pManager);
|
||||
|
||||
int nRasterW = (int)width_px;
|
||||
int nRasterH = (int)height_px;
|
||||
|
||||
@ -115,17 +115,16 @@ namespace NSGraphics
|
||||
class CGraphics
|
||||
{
|
||||
public:
|
||||
CGraphicsAppImage* m_pAppImage;
|
||||
CGraphicsAppImage* m_pAppImage = nullptr;
|
||||
CBgraFrame m_oFrame;
|
||||
|
||||
private:
|
||||
NSGraphics::IGraphicsRenderer* m_pRenderer;
|
||||
NSGraphics::IGraphicsRenderer* m_pRenderer = nullptr;
|
||||
CGrState m_oGrState;
|
||||
|
||||
public:
|
||||
CGraphics()
|
||||
{
|
||||
m_pAppImage = NULL;
|
||||
}
|
||||
~CGraphics()
|
||||
{
|
||||
|
||||
@ -31,6 +31,7 @@ namespace NSJSBase {
|
||||
{
|
||||
embed_native_internal = nullptr;
|
||||
m_pAdapter = nullptr;
|
||||
m_isExternalize = false;
|
||||
}
|
||||
|
||||
CJSEmbedObject::~CJSEmbedObject()
|
||||
@ -44,6 +45,16 @@ namespace NSJSBase {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CJSEmbedObject::SetExternalize(const bool& isExternalize)
|
||||
{
|
||||
m_isExternalize = isExternalize;
|
||||
}
|
||||
|
||||
bool CJSEmbedObject::GetExternalize()
|
||||
{
|
||||
return m_isExternalize;
|
||||
}
|
||||
|
||||
CJSEmbedObjectAdapterBase* CJSEmbedObject::getAdapter()
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
@ -194,10 +194,18 @@ namespace NSJSBase
|
||||
*/
|
||||
virtual CJSEmbedObjectAdapterBase* getAdapter();
|
||||
|
||||
/**
|
||||
* Use the externalize flag if you are monitoring the object's destruction yourself.
|
||||
*/
|
||||
virtual void SetExternalize(const bool& isExternalize = true);
|
||||
virtual bool GetExternalize();
|
||||
|
||||
protected:
|
||||
CJSEmbedObjectPrivateBase* embed_native_internal;
|
||||
CJSEmbedObjectAdapterBase* m_pAdapter;
|
||||
|
||||
bool m_isExternalize;
|
||||
|
||||
friend class CJSEmbedObjectPrivateBase;
|
||||
friend class CJSEmbedObjectPrivate;
|
||||
};
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
@protocol JSEmbedObjectProtocol
|
||||
-(void*) getNative;
|
||||
-(void) freeNative;
|
||||
@end
|
||||
|
||||
#if __has_feature(objc_arc)
|
||||
@ -41,6 +42,10 @@
|
||||
-(void*) getNative \
|
||||
{ \
|
||||
return m_internal; \
|
||||
} \
|
||||
-(void) freeNative \
|
||||
{ \
|
||||
RELEASEOBJECT(m_internal); \
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
|
||||
@ -34,6 +34,7 @@ namespace NSJSBase
|
||||
|
||||
// embed
|
||||
id CreateEmbedNativeObject(NSString* name);
|
||||
void FreeNativeObject(id embedded_object);
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
|
||||
@ -232,10 +232,14 @@ namespace NSJSBase
|
||||
{
|
||||
[m_internal->context evaluateScript:@"function jsc_toBase64(r){for(var o=[\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\",\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"+\",\"/\"],a=r.length,f=4*(a/3>>0),n=f/76>>0,t=19,v=0,e=[],i=\"\",s=0;s<=n;s++){s==n&&(t=f%76/4>>0);for(var u=0;u<t;u++){for(var c=0,h=0;h<3;h++)c|=r[0+v++],c<<=8;i=\"\";for(var A=0;A<4;A++){i+=o[c>>>26&255],c<<=6,c&=4294967295}e.push(i)}}if(n=a%3!=0?a%3+1:0){for(c=0,h=0;h<3;h++)h<a%3&&(c|=r[0+v++]),c<<=8;i=\"\";for(A=0;A<n;A++){i+=o[c>>>26&255],c<<=6}t=0!=n?4-n:0;for(u=0;u<t;u++)i+=\"=\";e.push(i)}return e.join(\"\")}function jsc_fromBase64(r,o){for(var a,f=r.length,n=0,t=new Array(void 0===o?f:o),v=t,e=0,i=0;e<f;){for(var s=0,u=0,c=0;c<4&&!(f<=e);c++){var h=65<=(a=r.charCodeAt(e++))&&a<=90?a-65:97<=a&&a<=122?a-71:48<=a&&a<=57?a+4:43==a?62:47==a?63:-1;-1!=h?(s<<=6,s|=h,u+=6):c--}for(s<<=24-u,i=u>>>3,c=0;c<i;c++)v[n++]=(16711680&s)>>>16,s<<=8}return t}\n"];
|
||||
}
|
||||
// insert CreateEmbedObject() function to global object of this context
|
||||
// insert embed functions to global object of this context
|
||||
m_internal->context[@"CreateEmbedObject"] = ^(NSString* name) {
|
||||
return CreateEmbedNativeObject(name);
|
||||
};
|
||||
m_internal->context[@"FreeEmbedObject"] = ^(id embedded_object) {
|
||||
FreeNativeObject(embedded_object);
|
||||
};
|
||||
|
||||
|
||||
JSValue* global_js = [m_internal->context globalObject];
|
||||
[global_js setValue:global_js forProperty:[[NSString alloc] initWithUTF8String:"window"]];
|
||||
@ -246,6 +250,8 @@ namespace NSJSBase
|
||||
{
|
||||
CGlobalContext::GetInstance().UnregisterContextForId(*i);
|
||||
}
|
||||
// remove any exceptions pending to not prevent any JSValue deallocations
|
||||
m_internal->context.exception = nil;
|
||||
m_internal->context = nil;
|
||||
}
|
||||
|
||||
@ -503,6 +509,15 @@ namespace NSJSBase
|
||||
return pEmbedObj;
|
||||
}
|
||||
|
||||
void FreeNativeObject(id embedded_object)
|
||||
{
|
||||
// check if the object was actually embedded and do nothing if it wasn't
|
||||
if ([embedded_object conformsToProtocol:@protocol(JSEmbedObjectProtocol)])
|
||||
{
|
||||
[embedded_object freeNative];
|
||||
}
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> CJSEmbedObjectAdapterJSC::Native2Value(JSValue* value)
|
||||
{
|
||||
return js_value(value);
|
||||
|
||||
@ -214,12 +214,41 @@ namespace NSJSBase
|
||||
m_internal->m_contextPersistent.Reset(isolate, v8::Context::New(isolate));
|
||||
// create temporary local handle to context
|
||||
m_internal->m_context = v8::Local<v8::Context>::New(isolate, m_internal->m_contextPersistent);
|
||||
// insert CreateEmbedObject() function to global object of this context
|
||||
// insert embed functions to global object of this context
|
||||
m_internal->InsertToGlobal("CreateEmbedObject", CreateEmbedNativeObject);
|
||||
m_internal->InsertToGlobal("FreeEmbedObject", FreeNativeObject);
|
||||
// clear temporary local handle
|
||||
m_internal->m_context.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
class WeakHandleVisitor : public v8::PersistentHandleVisitor
|
||||
{
|
||||
private:
|
||||
WeakHandleVisitor() = default;
|
||||
|
||||
public:
|
||||
void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t class_id) override
|
||||
{
|
||||
if (class_id == CJSEmbedObjectPrivate::kWeakHandleId)
|
||||
{
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Local<v8::Object> handle = value->Get(isolate).As<v8::Object>();
|
||||
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(handle->GetInternalField(0));
|
||||
CJSEmbedObject* native = static_cast<CJSEmbedObject*>(field->Value());
|
||||
delete native;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
static WeakHandleVisitor* getInstance()
|
||||
{
|
||||
static WeakHandleVisitor visitor;
|
||||
return &visitor;
|
||||
}
|
||||
};
|
||||
|
||||
void CJSContext::Dispose()
|
||||
{
|
||||
#ifdef V8_INSPECTOR
|
||||
@ -228,7 +257,13 @@ namespace NSJSBase
|
||||
#endif
|
||||
|
||||
m_internal->m_contextPersistent.Reset();
|
||||
m_internal->m_isolate->Dispose();
|
||||
// destroy native object in the weak handles before isolate disposal
|
||||
v8::Isolate* isolate = m_internal->m_isolate;
|
||||
{
|
||||
v8::Isolate::Scope scope(isolate);
|
||||
isolate->VisitHandlesWithClassIds(WeakHandleVisitor::getInstance());
|
||||
}
|
||||
isolate->Dispose();
|
||||
m_internal->m_isolate = NULL;
|
||||
}
|
||||
|
||||
@ -655,4 +690,22 @@ namespace NSJSBase
|
||||
NSJSBase::CJSEmbedObjectPrivate::CreateWeaker(obj);
|
||||
args.GetReturnValue().Set(obj);
|
||||
}
|
||||
|
||||
void FreeNativeObject(const v8::FunctionCallbackInfo<v8::Value>& args)
|
||||
{
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
if (args.Length() != 1)
|
||||
{
|
||||
args.GetReturnValue().Set(v8::Undefined(isolate));
|
||||
return;
|
||||
}
|
||||
|
||||
v8::Local<v8::Object> obj = args[0].As<v8::Object>();
|
||||
v8::Local<v8::External> field = v8::Local<v8::External>::Cast(obj->GetInternalField(0));
|
||||
CJSEmbedObject* native = static_cast<CJSEmbedObject*>(field->Value());
|
||||
delete native;
|
||||
// weak persistent handle will be cleared and removed in CJSEmbedObjectPrivate destructor
|
||||
}
|
||||
}
|
||||
|
||||
@ -883,6 +883,7 @@ namespace NSJSBase
|
||||
|
||||
// embed
|
||||
void CreateEmbedNativeObject(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void FreeNativeObject(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
class CJSEmbedObjectAdapterV8Template : public CJSEmbedObjectAdapterBase
|
||||
{
|
||||
@ -900,6 +901,8 @@ namespace NSJSBase
|
||||
{
|
||||
public:
|
||||
v8::Persistent<v8::Object> handle;
|
||||
// contstant id for all weak native handles
|
||||
static const uint16_t kWeakHandleId = 1;
|
||||
|
||||
CJSEmbedObjectPrivate(v8::Local<v8::Object> obj)
|
||||
{
|
||||
@ -918,6 +921,8 @@ namespace NSJSBase
|
||||
|
||||
handle.Reset(CV8Worker::GetCurrent(), obj);
|
||||
handle.SetWeak(pEmbedObject, EmbedObjectWeakCallback, v8::WeakCallbackType::kParameter);
|
||||
// set class_id for being able to iterate over all these handles to destroy them on isolate disposal
|
||||
handle.SetWrapperClassId(kWeakHandleId);
|
||||
|
||||
pEmbedObject->embed_native_internal = this;
|
||||
}
|
||||
@ -931,8 +936,6 @@ namespace NSJSBase
|
||||
|
||||
static void EmbedObjectWeakCallback(const v8::WeakCallbackInfo<CJSEmbedObject>& data)
|
||||
{
|
||||
v8::Isolate* isolate = data.GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
CJSEmbedObject* wrap = data.GetParameter();
|
||||
((CJSEmbedObjectPrivate*)wrap->embed_native_internal)->handle.Reset();
|
||||
delete wrap;
|
||||
|
||||
@ -1,4 +1,15 @@
|
||||
#include "Embed.h"
|
||||
#include <iostream>
|
||||
|
||||
CTestEmbed::CTestEmbed()
|
||||
{
|
||||
std::cout << "debug: CTestEmbed constructed" << std::endl;
|
||||
}
|
||||
|
||||
CTestEmbed::~CTestEmbed()
|
||||
{
|
||||
std::cout << "debug: CTestEmbed destroyed" << std::endl;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SUM_DEL
|
||||
JSSmart<CJSValue> CTestEmbed::FunctionSum(JSSmart<CJSValue> param1, JSSmart<CJSValue> param2)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef _BUILD_NATIVE_HASH_EMBED_H_
|
||||
#define _BUILD_NATIVE_HASH_EMBED_H_
|
||||
#ifndef CTESTEMBED_H_
|
||||
#define CTESTEMBED_H_
|
||||
|
||||
#include "js_internal/js_base.h"
|
||||
|
||||
@ -10,13 +10,8 @@ using namespace NSJSBase;
|
||||
class CTestEmbed : public CJSEmbedObject
|
||||
{
|
||||
public:
|
||||
CTestEmbed()
|
||||
{
|
||||
}
|
||||
|
||||
~CTestEmbed()
|
||||
{
|
||||
}
|
||||
CTestEmbed();
|
||||
~CTestEmbed();
|
||||
|
||||
virtual void* getObject() override { return NULL; }
|
||||
|
||||
@ -33,4 +28,4 @@ public:
|
||||
DECLARE_EMBED_METHODS
|
||||
};
|
||||
|
||||
#endif // _BUILD_NATIVE_HASH_EMBED_H_
|
||||
#endif // CTESTEMBED_H_
|
||||
|
||||
@ -1,278 +1,14 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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-12 Ernesta Birznieka-Upisha
|
||||
* 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 "test_functions.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "embed/Default.h"
|
||||
#include "js_internal/js_base.h"
|
||||
#include "Embed.h"
|
||||
|
||||
using namespace NSJSBase;
|
||||
int main(int argc, char *argv[])
|
||||
int main()
|
||||
{
|
||||
#if 0
|
||||
// Primitives example
|
||||
// TODO: test
|
||||
|
||||
JSSmart<CJSContext> oContext1 = new CJSContext(false);
|
||||
oContext1->Initialize();
|
||||
|
||||
JSSmart<CJSContext> oContext2 = new CJSContext;
|
||||
// oContext2->Initialize();
|
||||
|
||||
// Work with first context
|
||||
oContext1->Enter();
|
||||
|
||||
{
|
||||
CJSContextScope scope(oContext1);
|
||||
CJSLocalScope local_scope;
|
||||
JSSmart<CJSValue> oResLocal = oContext1->runScript("function f() { return 'Local scope test'; }; f();");
|
||||
std::cout << oResLocal->toStringA() << std::endl;
|
||||
}
|
||||
JSSmart<CJSObject> oGlobal1 = oContext1->GetGlobal();
|
||||
JSSmart<CJSValue> oVar2 = oContext1->createString("Hel");
|
||||
oGlobal1->set("v1", oVar2.GetPointer());
|
||||
oContext1->runScript("var res = v1 + 'lo'");
|
||||
|
||||
oContext1->Exit();
|
||||
|
||||
// Work with second context with CJSContextScope usage
|
||||
{
|
||||
CJSContextScope scope(oContext2);
|
||||
|
||||
JSSmart<CJSObject> oGlobal2 = oContext2->GetGlobal();
|
||||
JSSmart<CJSValue> oVar4 = oContext2->createString("Wor");
|
||||
oGlobal2->set("v1", oVar4.GetPointer());
|
||||
oContext2->runScript("var res = v1 + 'ld!'");
|
||||
}
|
||||
|
||||
// Print result from first context
|
||||
oContext1->Enter();
|
||||
|
||||
JSSmart<CJSValue> oRes1 = oContext1->runScript("function f() { return res; }; f();");
|
||||
std::string strRes1 = oRes1->toStringA();
|
||||
std::cout << strRes1 << std::endl;
|
||||
|
||||
// Print second variable
|
||||
oContext2->Enter();
|
||||
|
||||
JSSmart<CJSValue> oRes2 = oContext1->runScript("function f() { return res; }; f();");
|
||||
std::string strRes2 = oRes2->toStringA();
|
||||
std::cout << strRes2 << std::endl;
|
||||
|
||||
oContext2->Exit();
|
||||
oContext1->Exit();
|
||||
|
||||
// oContext1->Dispose();
|
||||
oContext2->Dispose();
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// External embed example
|
||||
|
||||
JSSmart<CJSContext> oContext1 = new CJSContext();
|
||||
|
||||
// Embedding
|
||||
CJSContextScope scope(oContext1);
|
||||
CJSContext::Embed<CTestEmbed>();
|
||||
|
||||
JSSmart<CJSValue> oResTestEmbed1 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSum(10, 5); })();");
|
||||
std::cout << "FunctionSum(10, 5) = " << oResTestEmbed1->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> oResTestEmbed2 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSquare(4); })();");
|
||||
std::cout << "FunctionSquare(4) = " << oResTestEmbed2->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> oResTestEmbed3 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionDel(30, 3); })();");
|
||||
std::cout << "FunctionDel(30, 3) = " << oResTestEmbed3->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> oResTestEmbed4 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionGet(); })();");
|
||||
std::cout << "FunctionGet() = " << oResTestEmbed4->toInt32() << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// CZipEmbed example
|
||||
|
||||
JSSmart<CJSContext> oContext1 = new CJSContext();
|
||||
JSSmart<CJSContext> oContext2 = new CJSContext();
|
||||
|
||||
// Work with first context
|
||||
oContext1->Enter();
|
||||
CreateDefaults();
|
||||
JSSmart<CJSValue> oRes1 = oContext1->runScript(
|
||||
"var oZip = CreateEmbedObject('CZipEmbed');\n"
|
||||
"var files = oZip.open('" CURR_DIR "');\n"
|
||||
"oZip.close();");
|
||||
oContext1->Exit();
|
||||
|
||||
// Work with second context
|
||||
{
|
||||
CJSContextScope scope(oContext2);
|
||||
// CreateDefaults();
|
||||
JSSmart<CJSValue> oRes2 = oContext2->runScript(
|
||||
"var oZip = CreateEmbedObject('CZipEmbed');\n"
|
||||
"var files = oZip.open('" CURR_DIR "/../embed');\n"
|
||||
"oZip.close();");
|
||||
}
|
||||
|
||||
// Print first result
|
||||
oContext1->Enter();
|
||||
JSSmart<CJSObject> oGlobal1 = oContext1->GetGlobal();
|
||||
JSSmart<CJSArray> oFiles1 = oGlobal1->get("files")->toArray();
|
||||
std::cout << "\nRESULT FROM CONTEXT 1:\n";
|
||||
for (int i = 0; i < oFiles1->getCount(); i++)
|
||||
{
|
||||
std::cout << oFiles1->get(i)->toStringA() << std::endl;
|
||||
}
|
||||
|
||||
// Print second result
|
||||
oContext2->Enter();
|
||||
JSSmart<CJSObject> oGlobal2 = oContext2->GetGlobal();
|
||||
JSSmart<CJSArray> oFiles2 = oGlobal2->get("files")->toArray();
|
||||
std::cout << "\nRESULT FROM CONTEXT 2:\n";
|
||||
for (int i = 0; i < oFiles2->getCount(); i++)
|
||||
{
|
||||
std::cout << oFiles2->get(i)->toStringA() << std::endl;
|
||||
}
|
||||
oContext2->Exit();
|
||||
oContext1->Exit();
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// CHashEmbed example
|
||||
|
||||
JSSmart<CJSContext> oContext1 = new CJSContext();
|
||||
|
||||
// Call hash() on first context
|
||||
CJSContextScope scope(oContext1);
|
||||
CreateDefaults();
|
||||
JSSmart<CJSValue> oRes1 = oContext1->runScript(
|
||||
"var oHash = CreateEmbedObject('CHashEmbed');\n"
|
||||
"var str = 'test';\n"
|
||||
"var hash = oHash.hash(str, str.length, 0);");
|
||||
|
||||
// Print first result
|
||||
JSSmart<CJSObject> oGlobal1 = oContext1->GetGlobal();
|
||||
JSSmart<CJSTypedArray> oHash = oGlobal1->get("hash")->toTypedArray();
|
||||
std::cout << "\nRESULTED HASH:\n";
|
||||
for (int i = 0; i < oHash->getCount(); i++)
|
||||
{
|
||||
std::cout << std::hex << static_cast<unsigned>(oHash->getData().Data[i]);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
// Call hash2() on first context
|
||||
JSSmart<CJSValue> oRes2 = oContext1->runScript(
|
||||
"var str2 = 'test';\n"
|
||||
"var hash2 = oHash.hash2(str2, 'yrGivlyCImiWnryRee1OJw==', 100000, 7);");
|
||||
|
||||
// Print first result
|
||||
JSSmart<CJSTypedArray> oHash2 = oGlobal1->get("hash2")->toTypedArray();
|
||||
std::cout << "\nRESULTED HASH2:\n";
|
||||
for (int i = 0; i < oHash2->getCount(); i++)
|
||||
{
|
||||
std::cout << std::hex << static_cast<unsigned>(oHash2->getData().Data[i]);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
// Mixed embed example
|
||||
|
||||
JSSmart<CJSContext> oContext1 = new CJSContext();
|
||||
|
||||
// External CTestEmbed
|
||||
CJSContextScope scope(oContext1);
|
||||
CJSContext::Embed<CTestEmbed>(false);
|
||||
|
||||
JSSmart<CJSValue> oResTestEmbed1 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSum(10, 5); })();");
|
||||
if (oResTestEmbed1->isNumber())
|
||||
std::cout << "FunctionSum(10, 5) = " << oResTestEmbed1->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSObject> oTestEmbed = CJSContext::createEmbedObject("CTestEmbed");
|
||||
|
||||
// JSSmart<CJSValue> oResTestEmbed2 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSquare(4); })();");
|
||||
JSSmart<CJSValue> args2[1];
|
||||
args2[0] = CJSContext::createInt(4);
|
||||
JSSmart<CJSValue> oResTestEmbed2 = oTestEmbed->call_func("FunctionSquare", 1, args2);
|
||||
if (oResTestEmbed2->isNumber())
|
||||
std::cout << "FunctionSquare(4) = " << oResTestEmbed2->toInt32() << std::endl;
|
||||
|
||||
// JSSmart<CJSValue> oResTestEmbed3 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionDel(30, 3); })();");
|
||||
JSSmart<CJSValue> args3[2];
|
||||
args3[0] = CJSContext::createInt(30);
|
||||
args3[1] = CJSContext::createInt(3);
|
||||
JSSmart<CJSValue> oResTestEmbed3 = oTestEmbed->call_func("FunctionDel", 2, args3);
|
||||
if (oResTestEmbed3->isNumber())
|
||||
std::cout << "FunctionDel(30, 3) = " << oResTestEmbed3->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> oResTestEmbed4 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionGet(); })();");
|
||||
if (oResTestEmbed4->isNumber())
|
||||
std::cout << "FunctionGet() = " << oResTestEmbed4->toInt32() << std::endl;
|
||||
|
||||
// Internal CHashEmbed
|
||||
CreateDefaults();
|
||||
oContext1->runScript(
|
||||
"var oHash = CreateEmbedObject('CHashEmbed');\n"
|
||||
"var str = 'test';\n"
|
||||
"var hash = oHash.hash(str, str.length, 0);");
|
||||
|
||||
// Print hash
|
||||
JSSmart<CJSObject> oGlobal = oContext1->GetGlobal();
|
||||
JSSmart<CJSTypedArray> oHash = oGlobal->get("hash")->toTypedArray();
|
||||
std::cout << "\nRESULTED HASH:\n";
|
||||
for (int i = 0; i < oHash->getCount(); i++)
|
||||
{
|
||||
std::cout << std::hex << static_cast<unsigned>(oHash->getData().Data[i]);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
// Internal CZipEmbed
|
||||
oContext1->runScript(
|
||||
"var oZip = CreateEmbedObject('CZipEmbed');\n"
|
||||
"var files = oZip.open('" CURR_DIR "');\n"
|
||||
"oZip.close();");
|
||||
|
||||
// Print files
|
||||
JSSmart<CJSArray> oFiles1 = oGlobal->get("files")->toArray();
|
||||
std::cout << "\nFILES IN CURRENT DIRECTORY:\n";
|
||||
for (int i = 0; i < oFiles1->getCount(); i++)
|
||||
{
|
||||
std::cout << oFiles1->get(i)->toStringA() << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
// testMultipleContexts();
|
||||
testEmbedExternal();
|
||||
// testEmbedInternal();
|
||||
// testHashEmbed();
|
||||
// testEmbedMixed();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
14
DesktopEditor/doctrenderer/test/embed/external/main.mm
vendored
Normal file
14
DesktopEditor/doctrenderer/test/embed/external/main.mm
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
#include "test_functions.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// all test functions should be called inside the `@autoreleasepool` block!
|
||||
@autoreleasepool
|
||||
{
|
||||
testEmbedExternal();
|
||||
// testHashEmbed();
|
||||
// testEmbedMixed();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -29,10 +29,18 @@ core_linux {
|
||||
LIBS += -ldl
|
||||
}
|
||||
|
||||
SOURCES += main.cpp \
|
||||
Embed.cpp
|
||||
|
||||
HEADERS += \
|
||||
Embed.h
|
||||
Embed.h \
|
||||
test_functions.h
|
||||
|
||||
SOURCES += \
|
||||
Embed.cpp \
|
||||
test_functions.cpp
|
||||
|
||||
use_javascript_core {
|
||||
OBJECTIVE_SOURCES += main.mm
|
||||
} else {
|
||||
SOURCES += main.cpp
|
||||
}
|
||||
|
||||
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(Embed.h)
|
||||
|
||||
286
DesktopEditor/doctrenderer/test/embed/external/test_functions.cpp
vendored
Normal file
286
DesktopEditor/doctrenderer/test/embed/external/test_functions.cpp
vendored
Normal file
@ -0,0 +1,286 @@
|
||||
#include "test_functions.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "embed/Default.h"
|
||||
#include "js_internal/js_base.h"
|
||||
#include "Embed.h"
|
||||
|
||||
using namespace NSJSBase;
|
||||
|
||||
void testMultipleContexts()
|
||||
{
|
||||
// passing `false` when creating CJSContext means that we need to initialize it manually
|
||||
JSSmart<CJSContext> context1 = new CJSContext(false);
|
||||
context1->Initialize();
|
||||
|
||||
// while creating CJSContext without any arguments will create initialized CJSContext
|
||||
JSSmart<CJSContext> context2 = new CJSContext;
|
||||
// we don't need it:
|
||||
// oContext2->Initialize();
|
||||
|
||||
// entering the first context
|
||||
context1->Enter();
|
||||
{
|
||||
// entering the first context the second time in scope creation - it's allowed and the scopes stack correctly
|
||||
CJSContextScope scope(context1);
|
||||
// allocate new local variables inside a custom local scope instead of
|
||||
// the one that is provided by CJSContextScope by default
|
||||
CJSLocalScope local_scope;
|
||||
JSSmart<CJSValue> res_local = context1->runScript("(function() { return 'Local scope test'; })();");
|
||||
std::cout << res_local->toStringA() << std::endl;
|
||||
// the first context is going to be exited at the end of the scope
|
||||
}
|
||||
// at this moment we are still inside the first context, since we have entered it twices
|
||||
JSSmart<CJSObject> global1 = context1->GetGlobal();
|
||||
JSSmart<CJSValue> var = context1->createString("Hel");
|
||||
global1->set("v1", var);
|
||||
// here `res` is set to be "Hello"
|
||||
context1->runScript("var res = v1 + 'lo'");
|
||||
// exit from the first context
|
||||
context1->Exit();
|
||||
|
||||
// now we are going to work with the second context
|
||||
{
|
||||
// enter the second context via context scope
|
||||
CJSContextScope scope(context2);
|
||||
|
||||
JSSmart<CJSObject> global2 = context2->GetGlobal();
|
||||
JSSmart<CJSValue> var = context2->createString("Wor");
|
||||
global2->set("v1", var);
|
||||
// `res` is "World!"
|
||||
context2->runScript("var res = v1 + 'ld!'");
|
||||
// the second context is going to be exited at the end of the scope
|
||||
}
|
||||
|
||||
// enter the first context
|
||||
context1->Enter();
|
||||
// print `res` variable from the first context
|
||||
JSSmart<CJSValue> res1 = context1->runScript("(function() { return res; })();");
|
||||
std::string str_res1 = res1->toStringA();
|
||||
std::cout << str_res1 << ", ";
|
||||
// make new variable `v2` in first context
|
||||
// important to note, that accessing previous `global1` object is undefined behaviour and can lead to crashes!
|
||||
// that is because when we exited from the first context, every local handle inside CJSValue and CJSObject was invalidated
|
||||
global1 = context1->GetGlobal();
|
||||
global1->set("v2", CJSContext::createInt(42));
|
||||
|
||||
// enter from the second context (notice, we haven't exited the first context before)
|
||||
context2->Enter();
|
||||
// print `res` variable from the second context
|
||||
JSSmart<CJSValue> res2 = context1->runScript("(function() { return res; })();");
|
||||
std::string str_res2 = res2->toStringA();
|
||||
std::cout << str_res2 << std::endl;
|
||||
|
||||
// exit from the second context
|
||||
context2->Exit();
|
||||
|
||||
// at this moment we are still in the first context
|
||||
// we can validate that accessing `v2` variable, which exists only in the first context
|
||||
global1 = context1->GetGlobal();
|
||||
std::cout << global1->get("v2")->toInt32() << std::endl;
|
||||
// exit from the first context
|
||||
context1->Exit();
|
||||
|
||||
// manual disposing is not necessary, since it's going to be called in CJSContext's destructor anyway
|
||||
// so we don't need to explicitly write:
|
||||
// oContext1->Dispose();
|
||||
|
||||
// but still nothing wrong will happen if we do:
|
||||
context2->Dispose();
|
||||
}
|
||||
|
||||
void testEmbedExternal()
|
||||
{
|
||||
JSSmart<CJSContext> context = new CJSContext();
|
||||
|
||||
// Embedding
|
||||
CJSContextScope scope(context);
|
||||
CJSContext::Embed<CTestEmbed>();
|
||||
|
||||
JSSmart<CJSValue> res1 = context->runScript("(function() { let value = CreateEmbedObject('CTestEmbed'); let ret = value.FunctionSum(10, 5); FreeEmbedObject(value); return ret; })();");
|
||||
std::cout << "FunctionSum(10, 5) = " << res1->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> res2 = context->runScript("(function() { let value = CreateEmbedObject('CTestEmbed'); let ret = value.FunctionSquare(4); FreeEmbedObject(value); return ret; })();");
|
||||
std::cout << "FunctionSquare(4) = " << res2->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> res3 = context->runScript("(function() { let value = CreateEmbedObject('CTestEmbed'); let ret = value.FunctionDel(30, 3); FreeEmbedObject(value); return ret; })();");
|
||||
std::cout << "FunctionDel(30, 3) = " << res3->toInt32() << std::endl;
|
||||
|
||||
JSSmart<CJSValue> res4 = context->runScript("(function() { let value = CreateEmbedObject('CTestEmbed'); let ret = value.FunctionGet(); FreeEmbedObject(value); return ret; })();");
|
||||
std::cout << "FunctionGet() = " << res4->toInt32() << std::endl;
|
||||
}
|
||||
|
||||
void testEmbedInternal()
|
||||
{
|
||||
// create both contexts
|
||||
JSSmart<CJSContext> context1 = new CJSContext();
|
||||
JSSmart<CJSContext> context2 = new CJSContext();
|
||||
|
||||
// work with the first context
|
||||
context1->Enter();
|
||||
// create embedding info for internally embedded objects (CZipEmbed is the one of them)
|
||||
CreateDefaults();
|
||||
context1->runScript(
|
||||
"var oZip = CreateEmbedObject('CZipEmbed');\n"
|
||||
"var files = oZip.open('" CURR_DIR "');\n"
|
||||
"oZip.close();"
|
||||
);
|
||||
context1->Exit();
|
||||
|
||||
// work with the second context via context scope
|
||||
{
|
||||
CJSContextScope scope(context2);
|
||||
// function CJSContext::Embed() is context-independent, so we don't actually need to call it in another context
|
||||
// CreateDefaults();
|
||||
context2->runScript(
|
||||
"var oZip = CreateEmbedObject('CZipEmbed');\n"
|
||||
"var files = oZip.open('" CURR_DIR "/../../../embed');\n"
|
||||
"oZip.close();"
|
||||
);
|
||||
}
|
||||
|
||||
// print the files from the first context
|
||||
context1->Enter();
|
||||
JSSmart<CJSObject> global1 = context1->GetGlobal();
|
||||
JSSmart<CJSArray> file_list1 = global1->get("files")->toArray();
|
||||
std::cout << "\nRESULT FROM CONTEXT 1:\n";
|
||||
for (int i = 0; i < file_list1->getCount(); i++)
|
||||
{
|
||||
std::cout << file_list1->get(i)->toStringA() << std::endl;
|
||||
}
|
||||
|
||||
// print the files from the second result (note, we haven't exited the first context before)
|
||||
context2->Enter();
|
||||
JSSmart<CJSObject> global2 = context2->GetGlobal();
|
||||
JSSmart<CJSArray> file_list2 = global2->get("files")->toArray();
|
||||
std::cout << "\nRESULT FROM CONTEXT 2:\n";
|
||||
for (int i = 0; i < file_list2->getCount(); i++)
|
||||
{
|
||||
std::cout << file_list2->get(i)->toStringA() << std::endl;
|
||||
}
|
||||
|
||||
// exit the contexts in reverse order
|
||||
context2->Exit();
|
||||
context1->Exit();
|
||||
}
|
||||
|
||||
void testHashEmbed()
|
||||
{
|
||||
JSSmart<CJSContext> context = new CJSContext();
|
||||
|
||||
// test hash()
|
||||
CJSContextScope scope(context);
|
||||
CreateDefaults();
|
||||
context->runScript(
|
||||
"var oHash = CreateEmbedObject('CHashEmbed');\n"
|
||||
"var str = 'test';\n"
|
||||
"var hash = oHash.hash(str, str.length, 0);"
|
||||
);
|
||||
|
||||
JSSmart<CJSObject> global = context->GetGlobal();
|
||||
JSSmart<CJSTypedArray> res_hash = global->get("hash")->toTypedArray();
|
||||
std::cout << "\nRESULTED HASH:\n";
|
||||
for (int i = 0; i < res_hash->getCount(); i++)
|
||||
{
|
||||
std::cout << std::hex << static_cast<unsigned>(res_hash->getData().Data[i]);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
// test hash2()
|
||||
context->runScript(
|
||||
"var str2 = 'test';\n"
|
||||
"var hash2 = oHash.hash2(str2, 'yrGivlyCImiWnryRee1OJw==', 100000, 7);"
|
||||
);
|
||||
|
||||
JSSmart<CJSTypedArray> res_hash2 = global->get("hash2")->toTypedArray();
|
||||
std::cout << "\nRESULTED HASH2:\n";
|
||||
for (int i = 0; i < res_hash2->getCount(); i++)
|
||||
{
|
||||
std::cout << std::hex << static_cast<unsigned>(res_hash2->getData().Data[i]);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void testEmbedMixed()
|
||||
{
|
||||
JSSmart<CJSContext> context = new CJSContext();
|
||||
CJSContextScope scope(context);
|
||||
|
||||
|
||||
// --- test external embedding with CTestEmbed ---
|
||||
// embed with `false` - means we are not able to create the object directly from JavaScript.
|
||||
CJSContext::Embed<CTestEmbed>(false);
|
||||
|
||||
// example of incorrect usage:
|
||||
JSSmart<CJSValue> res1 = context->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSum(10, 5); })();");
|
||||
if (res1->isNumber())
|
||||
{
|
||||
// this wouldn't print anything, since `res1` not a number - embedded object was not created in JS and exception was thrown.
|
||||
std::cout << "FunctionSum(10, 5) = " << res1->toInt32() << std::endl;
|
||||
}
|
||||
|
||||
// example of correct usage:
|
||||
JSSmart<CJSObject> embedded_object = CJSContext::createEmbedObject("CTestEmbed");
|
||||
JSSmart<CJSValue> args2[1];
|
||||
args2[0] = CJSContext::createInt(4);
|
||||
JSSmart<CJSValue> res2 = embedded_object->call_func("FunctionSquare", 1, args2);
|
||||
if (res2->isNumber())
|
||||
{
|
||||
// should print: "FunctionSquare(4) = 16"
|
||||
std::cout << "FunctionSquare(4) = " << res2->toInt32() << std::endl;
|
||||
}
|
||||
|
||||
// another example of correct usage:
|
||||
JSSmart<CJSValue> args3[2];
|
||||
args3[0] = CJSContext::createInt(30);
|
||||
args3[1] = CJSContext::createInt(3);
|
||||
JSSmart<CJSValue> oResTestEmbed3 = embedded_object->call_func("FunctionDel", 2, args3);
|
||||
if (oResTestEmbed3->isNumber())
|
||||
{
|
||||
// should print: "FunctionDel(30, 3) = 10"
|
||||
std::cout << "FunctionDel(30, 3) = " << oResTestEmbed3->toInt32() << std::endl;
|
||||
}
|
||||
|
||||
// another example of incorrect usage:
|
||||
JSSmart<CJSValue> oResTestEmbed4 = context->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionGet(); })();");
|
||||
if (oResTestEmbed4->isNumber())
|
||||
{
|
||||
// again, this won't be executed and nothing will be printed
|
||||
std::cout << "FunctionGet() = " << oResTestEmbed4->toInt32() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
// --- test internal embedding with CHashEmbed ---
|
||||
CreateDefaults();
|
||||
context->runScript(
|
||||
"var oHash = CreateEmbedObject('CHashEmbed');\n"
|
||||
"var str = 'test';\n"
|
||||
"var hash = oHash.hash(str, str.length, 0);"
|
||||
);
|
||||
// print hash
|
||||
JSSmart<CJSObject> global = context->GetGlobal();
|
||||
JSSmart<CJSTypedArray> hash = global->get("hash")->toTypedArray();
|
||||
std::cout << "\nRESULTED HASH:\n";
|
||||
for (int i = 0; i < hash->getCount(); i++)
|
||||
{
|
||||
std::cout << std::hex << static_cast<unsigned>(hash->getData().Data[i]);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
// --- test internal embedding with CZipEmbed ---
|
||||
context->runScript(
|
||||
"var oZip = CreateEmbedObject('CZipEmbed');\n"
|
||||
"var files = oZip.open('" CURR_DIR "');\n"
|
||||
"oZip.close();"
|
||||
);
|
||||
|
||||
// print files
|
||||
JSSmart<CJSArray> file_list = global->get("files")->toArray();
|
||||
std::cout << "\nFILES IN CURRENT DIRECTORY:\n";
|
||||
for (int i = 0; i < file_list->getCount(); i++)
|
||||
{
|
||||
std::cout << file_list->get(i)->toStringA() << std::endl;
|
||||
}
|
||||
}
|
||||
34
DesktopEditor/doctrenderer/test/embed/external/test_functions.h
vendored
Normal file
34
DesktopEditor/doctrenderer/test/embed/external/test_functions.h
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef TEST_FUNCTIONS_H_
|
||||
#define TEST_FUNCTIONS_H_
|
||||
|
||||
|
||||
/**
|
||||
* NOTE: V8 ONLY!
|
||||
* The function tests the work of two CJSContexts in one thread.
|
||||
* Current working context is managed with Enter() and Exit() functions, or with CJSContextScope.
|
||||
*/
|
||||
void testMultipleContexts();
|
||||
|
||||
/**
|
||||
* The function tests external embedding functionality by embedding CTestEmbed class.
|
||||
*/
|
||||
void testEmbedExternal();
|
||||
|
||||
/**
|
||||
* NOTE: V8 ONLY!
|
||||
* The function tests internal embedding functionality by using CZipEmbed class.
|
||||
* It also shows how embedding works for two CJSContext in the same thread (similar to testMultipleContexts()).
|
||||
*/
|
||||
void testEmbedInternal();
|
||||
|
||||
/**
|
||||
* The function tests CHashEmbed class that is embedded internally.
|
||||
*/
|
||||
void testHashEmbed();
|
||||
|
||||
/**
|
||||
* The function tests both internal and external embedding in a more complicated way.
|
||||
*/
|
||||
void testEmbedMixed();
|
||||
|
||||
#endif // TEST_FUNCTIONS_H_
|
||||
@ -1853,6 +1853,16 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles(const bool& bIsUs
|
||||
#if defined(_MAC) && !defined(_IOS)
|
||||
std::vector<std::wstring> _array = NSDirectory::GetFiles(L"/Library/Fonts", true);
|
||||
NSDirectory::GetFiles2(L"/System/Library/Fonts", _array, true);
|
||||
|
||||
std::set<std::wstring> installedList = GetInstalledFontsMac();
|
||||
for (const auto& sysPath : installedList) {
|
||||
if (0 == sysPath.find(L"/System/Library/Fonts/"))
|
||||
continue;
|
||||
if (0 == sysPath.find(L"/Library/Fonts/"))
|
||||
continue;
|
||||
_array.push_back(sysPath);
|
||||
}
|
||||
|
||||
return _array;
|
||||
#endif
|
||||
|
||||
@ -1958,6 +1968,10 @@ namespace NSFonts
|
||||
if (FT_Open_Face(m_internal->m_library, &oOpenArgs, nFaceIndex, &pFace))
|
||||
return;
|
||||
|
||||
bool bIsASC = false;
|
||||
if (pFace->family_name && (0 == strcmp(pFace->family_name, "ASCW3")))
|
||||
bIsASC = true;
|
||||
|
||||
for (int nCharMap = 0; nCharMap < pFace->num_charmaps; nCharMap++)
|
||||
{
|
||||
FT_Set_Charmap(pFace, pFace->charmaps[nCharMap]);
|
||||
@ -1967,7 +1981,8 @@ namespace NSFonts
|
||||
|
||||
while (indexG)
|
||||
{
|
||||
pChecker->Check((int)character, indexG);
|
||||
if (!bIsASC || (character < 35 || character > 255))
|
||||
pChecker->Check((int)character, indexG);
|
||||
character = FT_Get_Next_Char(pFace, character, &indexG);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include "FontManager.h"
|
||||
#include <set>
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
@ -354,6 +355,10 @@ public:
|
||||
void InitFromReg();
|
||||
#endif
|
||||
|
||||
#if defined(_MAC) && !defined(_IOS)
|
||||
std::set<std::wstring> GetInstalledFontsMac();
|
||||
#endif
|
||||
|
||||
NSFonts::IFontManager* GenerateFontManager();
|
||||
|
||||
std::wstring GetFontBySymbol(int symbol);
|
||||
|
||||
@ -877,6 +877,11 @@ public:
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang SC", 36));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang TC", 37));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang HK", 38));
|
||||
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti SC", 39));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti TC", 40));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti SC", 41));
|
||||
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti TC", 42));
|
||||
#endif
|
||||
|
||||
NSFonts::CApplicationFontsSymbols oApplicationChecker;
|
||||
@ -1604,6 +1609,14 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
|
||||
if (m_sDirectory.empty())
|
||||
return NULL;
|
||||
|
||||
for (std::vector<std::wstring>::iterator i = m_arAdditionalFolders.begin(); i != m_arAdditionalFolders.end(); i++)
|
||||
{
|
||||
if (0 == i->find(L"./"))
|
||||
*i = NSFile::GetProcessDirectory() + L"/" + i->substr(2);
|
||||
else if (0 == i->find(L"../"))
|
||||
*i = NSFile::GetProcessDirectory() + L"/" + *i;
|
||||
}
|
||||
|
||||
std::wstring strAllFontsJSPath = m_sDirectory + L"/AllFonts.js";
|
||||
std::wstring strFontsSelectionBin = m_sDirectory + L"/font_selection.bin";
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#include <vector>
|
||||
#include "../graphics/pro/Fonts.h"
|
||||
|
||||
#define ONLYOFFICE_FONTS_VERSION 12
|
||||
#define ONLYOFFICE_FONTS_VERSION 14
|
||||
#define ONLYOFFICE_ALL_FONTS_VERSION 2
|
||||
|
||||
class CApplicationFontsWorkerBreaker
|
||||
|
||||
@ -29,39 +29,36 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_PRESENTATION_SLDSZ_INCLUDE_H_
|
||||
#define PPTX_PRESENTATION_SLDSZ_INCLUDE_H_
|
||||
#include "ApplicationFonts.h"
|
||||
#include "../common/File.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreText/CoreText.h>
|
||||
|
||||
#include "./../WrapperWritingElement.h"
|
||||
#include "./../Limit/SlideSize.h"
|
||||
|
||||
namespace PPTX
|
||||
std::set<std::wstring> CApplicationFonts::GetInstalledFontsMac()
|
||||
{
|
||||
namespace nsPresentation
|
||||
std::set<std::wstring> paths;
|
||||
|
||||
CFArrayRef fontURLs = CTFontManagerCopyAvailableFontURLs();
|
||||
if (!fontURLs)
|
||||
return paths;
|
||||
|
||||
NSStringEncoding encode = CFStringConvertEncodingToNSStringEncoding (kCFStringEncodingUTF32LE);
|
||||
|
||||
CFIndex count = CFArrayGetCount(fontURLs);
|
||||
for (CFIndex i = 0; i < count; ++i)
|
||||
{
|
||||
class SldSz : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SldSz)
|
||||
CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(fontURLs, i);
|
||||
if (!url)
|
||||
continue;
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node);
|
||||
virtual std::wstring toXML() const;
|
||||
NSString* nsPath = [(__bridge NSURL *)url path];
|
||||
if (!nsPath)
|
||||
continue;
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
|
||||
NSData* pSData = [nsPath dataUsingEncoding: encode];
|
||||
paths.emplace(std::wstring((wchar_t*)[pSData bytes], [pSData length] / sizeof (wchar_t)));
|
||||
}
|
||||
|
||||
public:
|
||||
int cx;
|
||||
int cy;
|
||||
nullable_limit<Limit::SlideSize> type;
|
||||
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds();
|
||||
void Normalize();
|
||||
};
|
||||
} // namespace nsPresentation
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_PRESENTATION_SLDSZ_INCLUDE_H_
|
||||
CFRelease(fontURLs);
|
||||
return paths;
|
||||
}
|
||||
@ -83,6 +83,7 @@
|
||||
"./../../graphics/pro/js/wasm/src/lib",
|
||||
|
||||
"./../../../Common/3dParty/harfbuzz/harfbuzz/src",
|
||||
"./../../../Common/3dParty/brotli/brotli/c/include",
|
||||
|
||||
"./../../../OfficeUtils/src",
|
||||
"./../../../OfficeUtils/src/zlib-1.2.11",
|
||||
@ -113,6 +114,8 @@
|
||||
"BUILD_ZLIB_AS_SOURCES",
|
||||
"IMAGE_CHECKER_DISABLE_XML",
|
||||
|
||||
"FT_CONFIG_OPTION_USE_BROTLI",
|
||||
|
||||
"BUILDING_WASM_MODULE"
|
||||
],
|
||||
"compile_files_array": [
|
||||
@ -349,6 +352,26 @@
|
||||
{
|
||||
"folder": "./../../../Common/3dParty/hyphen/js/src",
|
||||
"files": ["hyphen.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "./../../../Common/3dParty/brotli/brotli/c/common",
|
||||
"files": [
|
||||
"constants.c",
|
||||
"context.c",
|
||||
"dictionary.c",
|
||||
"platform.c",
|
||||
"shared_dictionary.c",
|
||||
"transform.c"
|
||||
]
|
||||
},
|
||||
{
|
||||
"folder": "./../../../Common/3dParty/brotli/brotli/c/dec",
|
||||
"files": [
|
||||
"bit_reader.c",
|
||||
"decode.c",
|
||||
"huffman.c",
|
||||
"state.c"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -917,15 +917,15 @@ function onLoadFontsModule(window, undefined)
|
||||
this._mapToNames = AscCommon.spellcheckGetLanguages();
|
||||
|
||||
let _langKey = "" + lang;
|
||||
let _langName = this._mapToNames[_langKey];
|
||||
if (_langName === undefined)
|
||||
let _langObj = this._mapToNames[_langKey];
|
||||
if (!_langObj || !_langObj["hyphen"] || !_langObj["name"])
|
||||
{
|
||||
this._dictionaries[_langKey] = false;
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
this._loadDictionaryAttemt(_langKey, _langName, callback);
|
||||
this._loadDictionaryAttemt(_langKey, _langObj["name"], callback);
|
||||
};
|
||||
|
||||
this._loadDictionaryAttemt = function(langKey, langName, callback, currentAttempt)
|
||||
|
||||
@ -1020,22 +1020,39 @@ void CBooleanOperations::TracePaths()
|
||||
{
|
||||
size_t length = Segments1.size();
|
||||
Result.StartFigure();
|
||||
bool first_start = true;
|
||||
for (size_t i = 0; i < length + Segments2.size(); i++)
|
||||
{
|
||||
Segment s = i >= length ? Segments2[i - length] : Segments1[i];
|
||||
bool valid = s.IsValid(Op),
|
||||
start = true;
|
||||
start = true;
|
||||
PointD start_point;
|
||||
while (valid)
|
||||
{
|
||||
if (!start || (Op == Intersection && s.Inters && !GetNextSegment(s).Inters))
|
||||
SetVisited(s);
|
||||
|
||||
if (start)
|
||||
if (first_start)
|
||||
{
|
||||
Result.MoveTo(s.P.X, s.P.Y);
|
||||
start_point = s.P;
|
||||
}
|
||||
else if (start)
|
||||
{
|
||||
double x, y;
|
||||
Result.GetLastPoint(x, y);
|
||||
if (isZero(start_point.X - x) && isZero(start_point.Y - y))
|
||||
{
|
||||
Result.MoveTo(s.P.X, s.P.Y);
|
||||
start_point = s.P;
|
||||
}
|
||||
else
|
||||
Result.LineTo(s.P.X, s.P.Y);
|
||||
}
|
||||
else if (s.IsCurve)
|
||||
Result.CurveTo(s.HI.X + s.P.X, s.HI.Y + s.P.Y,
|
||||
s.HO.X + s.P.X, s.HO.Y + s.P.Y,
|
||||
s.P.X, s.P.Y);
|
||||
s.HO.X + s.P.X, s.HO.Y + s.P.Y,
|
||||
s.P.X, s.P.Y);
|
||||
else
|
||||
Result.LineTo(s.P.X, s.P.Y);
|
||||
|
||||
@ -1065,6 +1082,9 @@ void CBooleanOperations::TracePaths()
|
||||
|
||||
if (start)
|
||||
start = false;
|
||||
|
||||
if (first_start)
|
||||
first_start = false;
|
||||
}
|
||||
|
||||
if (!start && AllOverlap()) break;
|
||||
@ -1645,12 +1665,14 @@ int CBooleanOperations::CheckInters(const PointD& point, const Segment& segment,
|
||||
std::vector<double> roots = curve.GetCurveLineIntersection(segment.P.X,segment.P.Y, point.X - segment.P.X, point.Y - segment.P.Y);
|
||||
Curve line(segment, Segment(point));
|
||||
|
||||
int count = 0;
|
||||
for (const auto& r : roots)
|
||||
if (line.GetTimeOf(curve.GetPoint(r)) != -1)
|
||||
count++;
|
||||
return roots.size() % 2;
|
||||
|
||||
return count;
|
||||
// int count = 0;
|
||||
// for (const auto& r : roots)
|
||||
// if (line.GetTimeOf(curve.GetPoint(r)) != -1)
|
||||
// count++;
|
||||
|
||||
// return count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -863,20 +863,22 @@ namespace Aggplus
|
||||
|
||||
double CGraphicsPath::GetArea(unsigned idx, bool isCurve) const noexcept
|
||||
{
|
||||
float area;
|
||||
double area;
|
||||
if (isCurve)
|
||||
{
|
||||
std::vector<PointD> points = GetPoints(idx, 4);
|
||||
area = 3 * ((points[3].Y - points[0].Y) * (points[1].X + points[2].X)
|
||||
- (points[3].X - points[0].X) * (points[1].Y * points[2].Y)
|
||||
+ points[1].Y * (points[0].X - points[2].X)
|
||||
- points[1].X * (points[0].Y - points[2].Y)
|
||||
+ points[3].Y * (points[2].X + points[0].X / 3)
|
||||
- points[3].X * (points[2].Y - points[0].Y / 3)) / 20;
|
||||
area = (points[3].Y - points[0].Y) * (points[1].X + points[2].X)
|
||||
- (points[3].X - points[0].X) * (points[1].Y + points[2].Y)
|
||||
+ points[1].Y * (points[0].X - points[2].X)
|
||||
- points[1].X * (points[0].Y - points[2].Y)
|
||||
+ points[3].Y * (points[2].X + points[0].X / 3.0)
|
||||
- points[3].X * (points[2].Y + points[0].Y / 3.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<PointD> points = GetPoints(idx, 2);
|
||||
area = 4.0 * (points[1].Y * points[0].X - points[1].X * points[0].Y) / 3.0;
|
||||
}
|
||||
|
||||
std::vector<PointD> points = GetPoints(idx, 2);
|
||||
area = (points[1].Y * points[0].X - points[1].X * points[0].Y) / 20;
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ int CAnnotFieldInfo::GetFlag() const { return m_nFlag; }
|
||||
int CAnnotFieldInfo::GetID() const { return m_nID; }
|
||||
int CAnnotFieldInfo::GetAnnotFlag() const { return m_nAnnotFlag; }
|
||||
int CAnnotFieldInfo::GetPage() const { return m_nPage; }
|
||||
int CAnnotFieldInfo::GetCopyAP() const { return m_nCopyAP; }
|
||||
int CAnnotFieldInfo::GetCopyAP() const { return m_nCopyAP; }
|
||||
void CAnnotFieldInfo::GetBE(BYTE& nS, double& dI) { nS = m_pBE.first; dI = m_pBE.second; }
|
||||
BYTE* CAnnotFieldInfo::GetRender(LONG& nLen)
|
||||
{
|
||||
@ -224,6 +224,7 @@ BYTE* CAnnotFieldInfo::GetRender(LONG& nLen)
|
||||
const std::wstring& CAnnotFieldInfo::GetNM() { return m_wsNM; }
|
||||
const std::wstring& CAnnotFieldInfo::GetLM() { return m_wsLM; }
|
||||
const std::wstring& CAnnotFieldInfo::GetOUserID() { return m_wsOUserID; }
|
||||
const std::wstring& CAnnotFieldInfo::GetOMetadata() { return m_wsOMetadata; }
|
||||
const std::wstring& CAnnotFieldInfo::GetContents() { return m_wsContents; }
|
||||
const std::vector<double>& CAnnotFieldInfo::GetC() { return m_arrC; }
|
||||
|
||||
@ -362,6 +363,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_wsOUserID = pReader->ReadString();
|
||||
if (nFlags & (1 << 8))
|
||||
m_nCopyAP = pReader->ReadInt();
|
||||
if (nFlags & (1 << 9))
|
||||
m_wsOMetadata = pReader->ReadString();
|
||||
|
||||
if (IsMarkup())
|
||||
{
|
||||
@ -680,6 +683,7 @@ int CAnnotFieldInfo::CWidgetAnnotPr::GetR() const { return m_nR; }
|
||||
int CAnnotFieldInfo::CWidgetAnnotPr::GetFlag() const { return m_nFlag; }
|
||||
int CAnnotFieldInfo::CWidgetAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
int CAnnotFieldInfo::CWidgetAnnotPr::GetParentID() const { return m_nParentID; }
|
||||
int CAnnotFieldInfo::CWidgetAnnotPr::GetMEOptions() const { return m_nMEOptions; }
|
||||
int CAnnotFieldInfo::CWidgetAnnotPr::GetFontStyle() const { return m_nFontStyle; }
|
||||
double CAnnotFieldInfo::CWidgetAnnotPr::GetFontSize() const { return m_dFS; }
|
||||
double CAnnotFieldInfo::CWidgetAnnotPr::GetFontSizeAP() const { return m_dFSAP; }
|
||||
@ -689,7 +693,6 @@ 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; }
|
||||
@ -890,8 +893,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();
|
||||
if (nFlags & (1 << 21))
|
||||
m_nMEOptions = pReader->ReadInt();
|
||||
|
||||
// Action
|
||||
int nAction = pReader->ReadInt();
|
||||
@ -1143,6 +1146,10 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
}
|
||||
if (nFlags & (1 << 9))
|
||||
pParent->nMaxLen = pReader->ReadInt();
|
||||
if (nFlags & (1 << 10))
|
||||
pParent->sTU = pReader->ReadString();
|
||||
if (nFlags & (1 << 11))
|
||||
pParent->nMEOptions = pReader->ReadInt();
|
||||
m_arrParents.push_back(pParent);
|
||||
}
|
||||
|
||||
@ -1151,7 +1158,10 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
std::string sImagePath = pReader->ReadStringA();
|
||||
m_arrButtonImg.push_back(pCorrector->GetImagePath(UTF8_TO_U(sImagePath)));
|
||||
std::wstring sImage = UTF8_TO_U(sImagePath);
|
||||
if (sImagePath.find("data:") != 0 && !sImagePath.empty())
|
||||
sImage = pCorrector->GetImagePath(sImage);
|
||||
m_arrButtonImg.push_back(sImage);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -185,6 +185,7 @@ public:
|
||||
int GetFlag() const;
|
||||
int GetFlags() const;
|
||||
int GetParentID() const;
|
||||
int GetMEOptions() const;
|
||||
int GetFontStyle() const;
|
||||
double GetFontSize() const;
|
||||
double GetFontSizeAP() const;
|
||||
@ -194,7 +195,6 @@ 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();
|
||||
@ -215,6 +215,7 @@ public:
|
||||
int m_nFlag;
|
||||
int m_nFlags;
|
||||
int m_nParentID;
|
||||
int m_nMEOptions;
|
||||
int m_nFontStyle;
|
||||
double m_dFS;
|
||||
double m_dFSAP;
|
||||
@ -224,7 +225,6 @@ 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;
|
||||
@ -471,6 +471,7 @@ public:
|
||||
const std::wstring& GetNM();
|
||||
const std::wstring& GetLM();
|
||||
const std::wstring& GetOUserID();
|
||||
const std::wstring& GetOMetadata();
|
||||
const std::wstring& GetContents();
|
||||
const std::vector<double>& GetC();
|
||||
|
||||
@ -527,6 +528,7 @@ private:
|
||||
std::wstring m_wsNM;
|
||||
std::wstring m_wsLM;
|
||||
std::wstring m_wsOUserID;
|
||||
std::wstring m_wsOMetadata;
|
||||
std::wstring m_wsContents;
|
||||
std::pair<BYTE, double> m_pBE;
|
||||
std::vector<double> m_arrC;
|
||||
@ -571,10 +573,12 @@ public:
|
||||
int nFlags;
|
||||
int nMaxLen;
|
||||
int nParentID;
|
||||
int nMEOptions;
|
||||
int nFieldFlag;
|
||||
std::wstring sName;
|
||||
std::wstring sV;
|
||||
std::wstring sDV;
|
||||
std::wstring sTU;
|
||||
std::vector<int> arrI;
|
||||
std::vector<std::wstring> arrV;
|
||||
std::vector<CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget*> arrAction;
|
||||
|
||||
@ -18,6 +18,12 @@ SOURCES += \
|
||||
$$FONT_ENGINE_PATH/FontPath.cpp \
|
||||
$$FONT_ENGINE_PATH/GlyphString.cpp
|
||||
|
||||
core_mac {
|
||||
OBJECTIVE_SOURCES += $$FONT_ENGINE_PATH/ApplicationFonts_mac.mm
|
||||
LIBS += -framework Foundation
|
||||
LIBS += -framework CoreText
|
||||
}
|
||||
|
||||
# Application fonts worker
|
||||
HEADERS += $$FONT_ENGINE_PATH/ApplicationFontsWorker.h
|
||||
SOURCES += $$FONT_ENGINE_PATH/ApplicationFontsWorker.cpp
|
||||
@ -38,6 +44,10 @@ enable_support_shaper {
|
||||
}
|
||||
# -------------------------------------------------
|
||||
|
||||
# ------------------- brotli ----------------------
|
||||
include($$PWD/../../../Common/3dParty/brotli/brotli.pri)
|
||||
# -------------------------------------------------
|
||||
|
||||
# ------------------- hyphen ----------------------
|
||||
HEADERS += $$FONT_ENGINE_PATH/languages.h
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import os
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
base.cmd_in_dir("./../../../../../core/Common/js", "make.py", ["./../../DesktopEditor/graphics/pro/js/drawingfile.json"])
|
||||
base.cmd_in_dir("./../../../../../core/Common/js", sys.executable, ["make.py", "./../../DesktopEditor/graphics/pro/js/drawingfile.json"])
|
||||
|
||||
src_dir = "./deploy/"
|
||||
dst_dir = "./../../../../../sdkjs/pdf/src/engine/"
|
||||
|
||||
@ -70,6 +70,7 @@
|
||||
"../../../../PdfFile/lib/goo", "../../../../PdfFile/lib/fofi", "../../../../PdfFile/lib/splash", "../../../../PdfFile/lib",
|
||||
"../../../raster/Jp2/openjpeg", "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2",
|
||||
"../../../../Common/3dParty/openssl/openssl/include",
|
||||
"../../../../Common/3dParty/openssl/build/linux_64/include",
|
||||
"../../../../DocxRenderer"
|
||||
],
|
||||
"define": [
|
||||
@ -162,7 +163,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../Common/3dParty/icu/icu/source/common/",
|
||||
"files": ["ucnv.c", "ustr_wcs.cpp", "ucnv_err.c", "ucnv_bld.cpp", "ustrtrns.cpp", "ucnv_cb.c", "udata.cpp", "ucnv_io.cpp", "uhash.c", "udatamem.c", "cmemory.c", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucnvlat1.c", "ucnv_u16.c", "ucnv_u8.c", "ucnv_u32.c", "ucnv_u7.c", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnv_lmb.c", "ucnvhz.c", "ucnvscsu.c", "ucnvisci.c", "ucnvbocu.cpp", "ucnv_ct.c", "ucnv_cnv.c", "stringpiece.cpp", "charstr.cpp", "umapfile.c", "ucmndata.c", "ucnv_ext.cpp", "uobject.cpp", "umath.c", "ubidi_props.c", "uchar.c", "uinvchar.c", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "utf_impl.c", "ustrcase.cpp", "cstring.c", "bytestrie.cpp"]
|
||||
"files": ["ustr_wcs.cpp", "ustrtrns.cpp", "udata.cpp", "ucnv_io.cpp", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnvbocu.cpp", "stringpiece.cpp", "charstr.cpp", "ucnv_ext.cpp", "uobject.cpp", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "ustrcase.cpp", "bytestrie.cpp", "utf_impl.cpp", "cmemory.cpp", "uhash.cpp", "udatamem.cpp", "umapfile.cpp", "uinvchar.cpp", "uchar.cpp", "ubidi_props.cpp", "characterproperties.cpp", "ucptrie.cpp", "edits.cpp", "umutablecptrie.cpp", "bytesinkutil.cpp", "emojiprops.cpp", "cstring.cpp", "ucmndata.cpp", "ucnv.cpp", "ucnv_u7.cpp", "ucnv_u8.cpp", "ucnv_u16.cpp", "ucnv_u32.cpp", "ucnv_err.cpp", "ucnv_cnv.cpp", "ucnv_lmb.cpp", "ucnv_cb.cpp", "ucnv_ct.cpp", "ucharstrieiterator.cpp", "ucnvlat1.cpp", "uvectr32.cpp", "ucnvhz.cpp", "ucnvscsu.cpp", "ucnv_bld.cpp", "ucnvisci.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../Common/3dParty/cryptopp/",
|
||||
@ -186,7 +187,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/",
|
||||
"files": ["PdfFile.cpp", "PdfReader.cpp", "PdfWriter.cpp", "PdfEditor.cpp"]
|
||||
"files": ["PdfFile.cpp", "PdfReader.cpp", "PdfWriter.cpp", "PdfEditor.cpp", "OnlineOfficeBinToPdf.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcReader/",
|
||||
@ -194,7 +195,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcWriter/",
|
||||
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp"]
|
||||
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontOTWriter.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/Resources/",
|
||||
@ -202,7 +203,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/lib/",
|
||||
"files": ["fofi/FofiBase.cc", "fofi/FofiEncodings.cc", "fofi/FofiIdentifier.cc", "fofi/FofiTrueType.cc", "fofi/FofiType1.cc", "fofi/FofiType1C.cc", "goo/FixedPoint.cc", "goo/gfile.cc", "goo/GHash.cc", "goo/GList.cc", "goo/gmem.cc", "goo/gmempp.cc", "goo/GString.cc", "goo/parseargs.c", "goo/Trace.cc", "splash/Splash.cc", "splash/SplashBitmap.cc", "splash/SplashClip.cc", "splash/SplashFont.cc", "splash/SplashFontEngine.cc", "splash/SplashFontFile.cc", "splash/SplashFontFileID.cc", "splash/SplashFTFont.cc", "splash/SplashFTFontEngine.cc", "splash/SplashFTFontFile.cc", "splash/SplashPath.cc", "splash/SplashPattern.cc", "splash/SplashScreen.cc", "splash/SplashState.cc", "splash/SplashXPath.cc", "splash/SplashXPathScanner.cc", "xpdf/AcroForm.cc", "xpdf/Annot.cc", "xpdf/Array.cc", "xpdf/BuiltinFont.cc", "xpdf/BuiltinFontTables.cc", "xpdf/Catalog.cc", "xpdf/CharCodeToUnicode.cc", "xpdf/CMap.cc", "xpdf/Decrypt.cc", "xpdf/Dict.cc", "xpdf/DisplayState.cc", "xpdf/Error.cc", "xpdf/FontEncodingTables.cc", "xpdf/Function.cc", "xpdf/Gfx.cc", "xpdf/GfxFont.cc", "xpdf/GfxState.cc", "xpdf/GlobalParams.cc", "xpdf/ImageOutputDev.cc", "xpdf/JArithmeticDecoder.cc", "xpdf/JBIG2Stream.cc", "xpdf/JPXStream.cc", "xpdf/Lexer.cc", "xpdf/Link.cc", "xpdf/NameToCharCode.cc", "xpdf/Object.cc", "xpdf/OptionalContent.cc", "xpdf/Outline.cc", "xpdf/OutputDev.cc", "xpdf/Page.cc", "xpdf/Parser.cc", "xpdf/PDF417Barcode.cc", "xpdf/PDFCore.cc", "xpdf/PDFDoc.cc", "xpdf/PDFDocEncoding.cc", "xpdf/PreScanOutputDev.cc", "xpdf/PSOutputDev.cc", "xpdf/PSTokenizer.cc", "xpdf/SecurityHandler.cc", "xpdf/ShadingImage.cc", "xpdf/SplashOutputDev.cc", "xpdf/Stream.cc", "xpdf/TextOutputDev.cc", "xpdf/TextString.cc", "xpdf/TileCache.cc", "xpdf/TileCompositor.cc", "xpdf/TileMap.cc", "xpdf/UnicodeMap.cc", "xpdf/UnicodeRemapping.cc", "xpdf/UnicodeTypeTable.cc", "xpdf/UTF8.cc", "xpdf/WebFont.cc", "xpdf/XFAScanner.cc", "xpdf/XRef.cc", "xpdf/Zoox.cc"]
|
||||
"files": ["fofi/FoFiBase.cc", "fofi/FoFiEncodings.cc", "fofi/FoFiIdentifier.cc", "fofi/FoFiTrueType.cc", "fofi/FoFiType1.cc", "fofi/FoFiType1C.cc", "goo/FixedPoint.cc", "goo/gfile.cc", "goo/GHash.cc", "goo/GList.cc", "goo/gmem.cc", "goo/gmempp.cc", "goo/GString.cc", "goo/parseargs.c", "goo/Trace.cc", "splash/Splash.cc", "splash/SplashBitmap.cc", "splash/SplashClip.cc", "splash/SplashFont.cc", "splash/SplashFontEngine.cc", "splash/SplashFontFile.cc", "splash/SplashFontFileID.cc", "splash/SplashFTFont.cc", "splash/SplashFTFontEngine.cc", "splash/SplashFTFontFile.cc", "splash/SplashPath.cc", "splash/SplashPattern.cc", "splash/SplashScreen.cc", "splash/SplashState.cc", "splash/SplashXPath.cc", "splash/SplashXPathScanner.cc", "xpdf/AcroForm.cc", "xpdf/Annot.cc", "xpdf/Array.cc", "xpdf/BuiltinFont.cc", "xpdf/BuiltinFontTables.cc", "xpdf/Catalog.cc", "xpdf/CharCodeToUnicode.cc", "xpdf/CMap.cc", "xpdf/Decrypt.cc", "xpdf/Dict.cc", "xpdf/DisplayState.cc", "xpdf/Error.cc", "xpdf/FontEncodingTables.cc", "xpdf/Function.cc", "xpdf/Gfx.cc", "xpdf/GfxFont.cc", "xpdf/GfxState.cc", "xpdf/GlobalParams.cc", "xpdf/ImageOutputDev.cc", "xpdf/JArithmeticDecoder.cc", "xpdf/JBIG2Stream.cc", "xpdf/JPXStream.cc", "xpdf/Lexer.cc", "xpdf/Link.cc", "xpdf/NameToCharCode.cc", "xpdf/Object.cc", "xpdf/OptionalContent.cc", "xpdf/Outline.cc", "xpdf/OutputDev.cc", "xpdf/Page.cc", "xpdf/Parser.cc", "xpdf/PDF417Barcode.cc", "xpdf/PDFCore.cc", "xpdf/PDFDoc.cc", "xpdf/PDFDocEncoding.cc", "xpdf/PreScanOutputDev.cc", "xpdf/PSOutputDev.cc", "xpdf/PSTokenizer.cc", "xpdf/SecurityHandler.cc", "xpdf/ShadingImage.cc", "xpdf/SplashOutputDev.cc", "xpdf/Stream.cc", "xpdf/TextOutputDev.cc", "xpdf/TextString.cc", "xpdf/TileCache.cc", "xpdf/TileCompositor.cc", "xpdf/TileMap.cc", "xpdf/UnicodeMap.cc", "xpdf/UnicodeRemapping.cc", "xpdf/UnicodeTypeTable.cc", "xpdf/UTF8.cc", "xpdf/WebFont.cc", "xpdf/XFAScanner.cc", "xpdf/XRef.cc", "xpdf/Zoox.cc"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2/",
|
||||
|
||||
@ -717,6 +717,7 @@ SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontCidTT.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontTT.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontTTWriter.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontOTWriter.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/GState.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Image.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Info.cpp \
|
||||
|
||||
@ -40,7 +40,7 @@ var UpdateFontsSource = {
|
||||
function CFile()
|
||||
{
|
||||
this.nativeFile = 0;
|
||||
this.stream = [];
|
||||
this.stream = -1;
|
||||
this.stream_size = 0;
|
||||
this.type = -1;
|
||||
this.pages = [];
|
||||
@ -128,49 +128,29 @@ CFile.prototype["close"] = function()
|
||||
this.pages = [];
|
||||
this.info = null;
|
||||
this.StartID = null;
|
||||
for (let i = 0; i < this.stream.length; i++)
|
||||
this._free(this.stream[i]);
|
||||
this.stream = [];
|
||||
if (this.stream > 0)
|
||||
this._free(this.stream);
|
||||
this.stream = -1;
|
||||
self.drawingFile = null;
|
||||
};
|
||||
|
||||
CFile.prototype["getFileBinary"] = function()
|
||||
{
|
||||
if (this.stream.length == 0)
|
||||
if (0 >= this.stream)
|
||||
return "";
|
||||
return new Uint8Array(Module["HEAP8"].buffer, this.stream[0], this.stream_size);
|
||||
return new Uint8Array(Module["HEAP8"].buffer, this.stream, this.stream_size);
|
||||
};
|
||||
|
||||
CFile.prototype["isNeedPassword"] = function()
|
||||
{
|
||||
return this._isNeedPassword;
|
||||
};
|
||||
CFile.prototype["SplitPages"] = function(arrPageIndex)
|
||||
CFile.prototype["SplitPages"] = function(arrPageIndex, arrayBufferChanges)
|
||||
{
|
||||
let ptr = this._SplitPages(arrPageIndex);
|
||||
|
||||
if (!ptr)
|
||||
return null;
|
||||
|
||||
let lenArr = new Int32Array(Module["HEAP8"].buffer, ptr, 1);
|
||||
if (!lenArr)
|
||||
{
|
||||
Module["_free"](ptr);
|
||||
return null;
|
||||
}
|
||||
|
||||
let len = lenArr[0];
|
||||
if (len <= 4)
|
||||
{
|
||||
Module["_free"](ptr);
|
||||
return null;
|
||||
}
|
||||
len -= 4;
|
||||
|
||||
let buffer = new Uint8Array(len);
|
||||
buffer.set(new Uint8Array(Module["HEAP8"].buffer, ptr + 4, len));
|
||||
Module["_free"](ptr);
|
||||
return buffer;
|
||||
let ptr = this._SplitPages(arrPageIndex, arrayBufferChanges);
|
||||
let res = ptr.getMemory(true);
|
||||
ptr.free();
|
||||
return res;
|
||||
};
|
||||
CFile.prototype["MergePages"] = function(arrayBuffer, maxID, prefixForm)
|
||||
{
|
||||
@ -563,9 +543,10 @@ function readAnnot(reader, rec, readDoubleFunc, readDouble2Func, readStringFunc,
|
||||
// User ID
|
||||
if (flags & (1 << 7))
|
||||
rec["OUserID"] = readStringFunc.call(reader);
|
||||
// User ID
|
||||
if (flags & (1 << 8))
|
||||
rec["AP"]["Copy"] = reader.readInt();
|
||||
// if (flags & (1 << 8))
|
||||
// reader.readInt();
|
||||
if (flags & (1 << 9))
|
||||
rec["meta"] = readStringFunc.call(reader);
|
||||
}
|
||||
function readAnnotAP(reader, AP)
|
||||
{
|
||||
@ -601,7 +582,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
{
|
||||
// Markup
|
||||
let flags = 0;
|
||||
if ((rec["Type"] < 18 && rec["Type"] != 1 && rec["Type"] != 15) || rec["Type"] == 25)
|
||||
if ((rec["type"] < 18 && rec["type"] != 1 && rec["type"] != 15) || rec["type"] == 25)
|
||||
{
|
||||
flags = reader.readInt();
|
||||
if (flags & (1 << 0))
|
||||
@ -656,7 +637,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
rec["Subj"] = readStringFunc.call(reader);
|
||||
}
|
||||
// Text
|
||||
if (rec["Type"] == 0)
|
||||
if (rec["type"] == 0)
|
||||
{
|
||||
// Background color - C->IC
|
||||
if (rec["C"])
|
||||
@ -680,7 +661,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
|
||||
}
|
||||
// Line
|
||||
else if (rec["Type"] == 3)
|
||||
else if (rec["type"] == 3)
|
||||
{
|
||||
// L
|
||||
rec["L"] = [];
|
||||
@ -730,7 +711,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
}
|
||||
}
|
||||
// Ink
|
||||
else if (rec["Type"] == 14)
|
||||
else if (rec["type"] == 14)
|
||||
{
|
||||
// offsets like getStructure and viewer.navigate
|
||||
let n = reader.readInt();
|
||||
@ -744,7 +725,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
}
|
||||
}
|
||||
// Highlight, Underline, Squiggly, Strikeout
|
||||
else if (rec["Type"] > 7 && rec["Type"] < 12)
|
||||
else if (rec["type"] > 7 && rec["type"] < 12)
|
||||
{
|
||||
// QuadPoints
|
||||
let n = reader.readInt();
|
||||
@ -753,7 +734,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
rec["QuadPoints"].push(readDoubleFunc.call(reader));
|
||||
}
|
||||
// Square, Circle
|
||||
else if (rec["Type"] == 4 || rec["Type"] == 5)
|
||||
else if (rec["type"] == 4 || rec["type"] == 5)
|
||||
{
|
||||
// Rect and RD differences
|
||||
if (flags & (1 << 15))
|
||||
@ -772,7 +753,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
}
|
||||
}
|
||||
// Polygon, PolyLine
|
||||
else if (rec["Type"] == 6 || rec["Type"] == 7)
|
||||
else if (rec["type"] == 6 || rec["type"] == 7)
|
||||
{
|
||||
let nVertices = reader.readInt();
|
||||
rec["Vertices"] = [];
|
||||
@ -800,8 +781,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
rec["IT"] = reader.readByte();
|
||||
}
|
||||
// Popup
|
||||
/*
|
||||
else if (rec["Type"] == 15)
|
||||
else if (rec["type"] == 15)
|
||||
{
|
||||
flags = reader.readInt();
|
||||
rec["Open"] = (flags >> 0) & 1;
|
||||
@ -809,9 +789,8 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
if (flags & (1 << 1))
|
||||
rec["PopupParent"] = reader.readInt();
|
||||
}
|
||||
*/
|
||||
// FreeText
|
||||
else if (rec["Type"] == 2)
|
||||
else if (rec["type"] == 2)
|
||||
{
|
||||
// Background color - C->IC
|
||||
if (!isRead && rec["C"])
|
||||
@ -867,7 +846,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
}
|
||||
}
|
||||
// Caret
|
||||
else if (rec["Type"] == 13)
|
||||
else if (rec["type"] == 13)
|
||||
{
|
||||
// Rect and RD differenses
|
||||
if (flags & (1 << 15))
|
||||
@ -882,7 +861,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
rec["Sy"] = reader.readByte();
|
||||
}
|
||||
// FileAttachment
|
||||
else if (rec["Type"] == 16)
|
||||
else if (rec["type"] == 16)
|
||||
{
|
||||
if (flags & (1 << 15))
|
||||
rec["Icon"] = readStringFunc.call(reader);
|
||||
@ -981,7 +960,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
rec["Desc"] = readStringFunc.call(reader);
|
||||
}
|
||||
// Stamp
|
||||
else if (rec["Type"] == 12)
|
||||
else if (rec["type"] == 12)
|
||||
{
|
||||
rec["Icon"] = readStringFunc.call(reader);
|
||||
rec["Rotate"] = readDouble2Func.call(reader);
|
||||
@ -989,6 +968,55 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
for (let i = 0; i < 8; ++i)
|
||||
rec["InRect"].push(readDouble2Func.call(reader));
|
||||
}
|
||||
// Redact
|
||||
else if (rec["type"] == 25)
|
||||
{
|
||||
// QuadPoints
|
||||
if (flags & (1 << 15))
|
||||
{
|
||||
let n = reader.readInt();
|
||||
rec["QuadPoints"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
rec["QuadPoints"].push(readDoubleFunc.call(reader));
|
||||
}
|
||||
// IC
|
||||
if (flags & (1 << 16))
|
||||
{
|
||||
let n = reader.readInt();
|
||||
rec["IC"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
rec["IC"].push(readDouble2Func.call(reader));
|
||||
}
|
||||
// OverlayText
|
||||
if (flags & (1 << 17))
|
||||
rec["OverlayText"] = readStringFunc.call(reader);
|
||||
// Repeat
|
||||
rec["Repeat"] = (flags >> 18) & 1;
|
||||
// Q - alignment
|
||||
if (flags & (1 << 19))
|
||||
{
|
||||
// 0 - left-justified, 1 - centered, 2 - right-justified
|
||||
rec["alignment"] = reader.readByte();
|
||||
}
|
||||
// Font from DA
|
||||
if (flags & (1 << 20))
|
||||
{
|
||||
rec["font"] = {};
|
||||
let n = reader.readInt();
|
||||
rec["font"]["color"] = [];
|
||||
for (let i = 0; i < n; ++i)
|
||||
rec["font"]["color"].push(readDouble2Func.call(reader));
|
||||
rec["font"]["size"] = readDoubleFunc.call(reader);
|
||||
rec["font"]["name"] = readStringFunc.call(reader);
|
||||
if (!isRead)
|
||||
{
|
||||
let fontActual = readStringFunc.call(reader);
|
||||
if (fontActual != "")
|
||||
rec["font"]["actual"] = fontActual;
|
||||
}
|
||||
rec["font"]["style"] = reader.readInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readStringFunc, isRead = false)
|
||||
{
|
||||
@ -1007,7 +1035,7 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["font"]["color"].push(readDouble2Func.call(reader));
|
||||
}
|
||||
// 0 - left-justified, 1 - centered, 2 - right-justified
|
||||
if (!isRead || (rec["Type"] != 29 && rec["Type"] != 28 && rec["Type"] != 27))
|
||||
if (!isRead || (rec["type"] != 29 && rec["type"] != 28 && rec["type"] != 27))
|
||||
rec["alignment"] = reader.readByte();
|
||||
rec["flag"] = reader.readInt();
|
||||
// 12.7.3.1
|
||||
@ -1020,7 +1048,7 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
let flags = reader.readInt();
|
||||
// Alternative field name, used in tooltip and error messages - TU
|
||||
if (flags & (1 << 0))
|
||||
rec["userName"] = readStringFunc.call(reader);
|
||||
rec["tooltip"] = readStringFunc.call(reader);
|
||||
// Default style string (CSS2 format) - DS
|
||||
if (flags & (1 << 1))
|
||||
rec["defaultStyle"] = readStringFunc.call(reader);
|
||||
@ -1064,8 +1092,10 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
||||
rec["name"] = readStringFunc.call(reader);
|
||||
if (flags & (1 << 19))
|
||||
rec["font"]["AP"] = readStringFunc.call(reader);
|
||||
if (flags & (1 << 20))
|
||||
rec["meta"] = readStringFunc.call(reader);
|
||||
// if (flags & (1 << 20))
|
||||
// readStringFunc.call(reader);
|
||||
if (flags & (1 << 21))
|
||||
rec["MEOptions"] = reader.readInt();
|
||||
// Action
|
||||
let nAction = reader.readInt();
|
||||
if (nAction > 0)
|
||||
@ -1337,6 +1367,10 @@ CFile.prototype["getInteractiveFormsInfo"] = function()
|
||||
}
|
||||
if (flags & (1 << 9))
|
||||
rec["maxLen"] = reader.readInt();
|
||||
if (flags & (1 << 10))
|
||||
rec["tooltip"] = reader.readString();
|
||||
if (flags & (1 << 11))
|
||||
rec["MEOptions"] = reader.readInt();
|
||||
res["Parents"].push(rec);
|
||||
}
|
||||
|
||||
@ -1491,7 +1525,7 @@ CFile.prototype["getAnnotationsInfo"] = function(pageIndex)
|
||||
// 11 - Strikeout, 12 - Stamp, 13 - Caret, 14 - Ink, 15 - Popup, 16 - FileAttachment,
|
||||
// 17 - Sound, 18 - Movie, 19 - Widget, 20 - Screen, 21 - PrinterMark,
|
||||
// 22 - TrapNet, 23 - Watermark, 24 - 3D, 25 - Redact
|
||||
rec["Type"] = reader.readByte();
|
||||
rec["type"] = reader.readByte();
|
||||
// Annot
|
||||
readAnnot(reader, rec, reader.readDouble, reader.readDouble2, reader.readString);
|
||||
// Annot type
|
||||
@ -1548,35 +1582,50 @@ CFile.prototype["readAnnotationsInfoFromBinary"] = function(AnnotInfo)
|
||||
let reader = new CBinaryReader(AnnotInfo, 0, AnnotInfo.length);
|
||||
if (!reader) return [];
|
||||
|
||||
let res = [];
|
||||
let res = { annots:[], imgs:[] };
|
||||
while (reader.isValid())
|
||||
{
|
||||
let nCommand = reader.readByte();
|
||||
let nPos = reader.pos;
|
||||
let nSize = reader.readInt();
|
||||
if (nCommand != 164) // ctAnnotField
|
||||
if (nCommand == 164) // ctAnnotField
|
||||
{
|
||||
let rec = {};
|
||||
// Annotation type
|
||||
// 0 - Text, 1 - Link, 2 - FreeText, 3 - Line, 4 - Square, 5 - Circle,
|
||||
// 6 - Polygon, 7 - PolyLine, 8 - Highlight, 9 - Underline, 10 - Squiggly,
|
||||
// 11 - Strikeout, 12 - Stamp, 13 - Caret, 14 - Ink, 15 - Popup, 16 - FileAttachment,
|
||||
// 17 - Sound, 18 - Movie, 19 - Widget, 20 - Screen, 21 - PrinterMark,
|
||||
// 22 - TrapNet, 23 - Watermark, 24 - 3D, 25 - Redact
|
||||
rec["type"] = reader.readByte();
|
||||
// Annot
|
||||
readAnnot(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
|
||||
// Annot type
|
||||
readAnnotType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
|
||||
if (rec["type"] >= 26 && rec["type"] <= 33)
|
||||
{
|
||||
// Widget type
|
||||
readWidgetType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
|
||||
}
|
||||
res.annots.push(rec);
|
||||
}
|
||||
else if (nCommand == 166) // ctWidgetsInfo
|
||||
{
|
||||
reader.readInt(); // CO must be 0
|
||||
reader.readInt(); // Parents must be 0
|
||||
// ButtonImg
|
||||
let n = reader.readInt();
|
||||
for (let i = 0; i < n; ++i)
|
||||
{
|
||||
let data = reader.readString();
|
||||
res.imgs.push(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.pos = nPos + nSize;
|
||||
continue;
|
||||
}
|
||||
let rec = {};
|
||||
// Annotation type
|
||||
// 0 - Text, 1 - Link, 2 - FreeText, 3 - Line, 4 - Square, 5 - Circle,
|
||||
// 6 - Polygon, 7 - PolyLine, 8 - Highlight, 9 - Underline, 10 - Squiggly,
|
||||
// 11 - Strikeout, 12 - Stamp, 13 - Caret, 14 - Ink, 15 - Popup, 16 - FileAttachment,
|
||||
// 17 - Sound, 18 - Movie, 19 - Widget, 20 - Screen, 21 - PrinterMark,
|
||||
// 22 - TrapNet, 23 - Watermark, 24 - 3D, 25 - Redact
|
||||
rec["Type"] = reader.readByte();
|
||||
// Annot
|
||||
readAnnot(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
|
||||
// Annot type
|
||||
readAnnotType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
|
||||
if (rec["Type"] >= 26 && rec["Type"] <= 33)
|
||||
{
|
||||
// Widget type
|
||||
readWidgetType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
|
||||
}
|
||||
res.push(rec);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -1586,8 +1635,13 @@ CFile.prototype["readAnnotationsInfoFromBinary"] = function(AnnotInfo)
|
||||
CFile.prototype["scanPage"] = function(page, mode)
|
||||
{
|
||||
let ptr = this._scanPage(page, mode);
|
||||
let reader = ptr.getReader();
|
||||
if (mode == 2) {
|
||||
data = ptr.getMemory(true);
|
||||
ptr.free();
|
||||
return data;
|
||||
}
|
||||
|
||||
let reader = ptr.getReader();
|
||||
if (!reader) return [];
|
||||
|
||||
let shapesCount = reader.readInt();
|
||||
|
||||
@ -42,6 +42,19 @@ CNativePointer.prototype.free = function()
|
||||
g_native_drawing_file["FreeWasmData"](this.ptr);
|
||||
this.ptr = null;
|
||||
};
|
||||
CNativePointer.prototype.getMemory = function(isCopy)
|
||||
{
|
||||
if (!this.ptr)
|
||||
return null;
|
||||
|
||||
if (!isCopy)
|
||||
return this.ptr;
|
||||
|
||||
let copyArray = new Uint8Array(this.ptr.length);
|
||||
copyArray.set(this.ptr);
|
||||
|
||||
return copyArray;
|
||||
};
|
||||
CNativePointer.prototype.getReader = function()
|
||||
{
|
||||
if (!this.ptr)
|
||||
@ -94,10 +107,33 @@ CFile.prototype._getError = function()
|
||||
return g_native_drawing_file["GetErrorCode"]();
|
||||
};
|
||||
|
||||
CFile.prototype._addPDF = function(buffer, password)
|
||||
CFile.prototype._SplitPages = function(pages, changes)
|
||||
{
|
||||
return g_native_drawing_file["AddPDF"]();
|
||||
}
|
||||
let dataChanges = null;
|
||||
if (changes)
|
||||
dataChanges = (undefined !== changes.byteLength) ? new Uint8Array(changes) : changes;
|
||||
g_module_pointer.ptr = g_native_drawing_file["SplitPages"](pages, dataChanges);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
{
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
if (!maxID)
|
||||
maxID = 0;
|
||||
if (!prefixForm)
|
||||
prefixForm = "";
|
||||
|
||||
let data = (undefined !== buffer.byteLength) ? new Uint8Array(buffer) : buffer;
|
||||
return g_native_drawing_file["MergePages"](data, maxID, prefixForm);
|
||||
};
|
||||
|
||||
CFile.prototype._UndoMergePages = function()
|
||||
{
|
||||
return g_native_drawing_file["UnmergePages"]();
|
||||
};
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
|
||||
@ -39,7 +39,7 @@ CWasmPointer.prototype.free = function()
|
||||
Module["_free"](this.ptr);
|
||||
this.ptr = 0;
|
||||
};
|
||||
CWasmPointer.prototype.getReader = function()
|
||||
CWasmPointer.prototype.getMemory = function(isCopy)
|
||||
{
|
||||
if (!this.ptr)
|
||||
return null;
|
||||
@ -59,8 +59,23 @@ CWasmPointer.prototype.getReader = function()
|
||||
}
|
||||
|
||||
len -= 4;
|
||||
let buffer = new Uint8Array(Module["HEAP8"].buffer, this.ptr + 4, len);
|
||||
return new CBinaryReader(buffer, 0, len);
|
||||
|
||||
let noCopyArray = new Uint8Array(Module["HEAP8"].buffer, this.ptr + 4, len);
|
||||
if (!isCopy)
|
||||
return noCopyArray;
|
||||
|
||||
let copyArray = new Uint8Array(len);
|
||||
copyArray.set(noCopyArray);
|
||||
|
||||
return copyArray;
|
||||
};
|
||||
CWasmPointer.prototype.getReader = function()
|
||||
{
|
||||
let noCopyArray = this.getMemory(false);
|
||||
if (!noCopyArray)
|
||||
return null;
|
||||
|
||||
return new CBinaryReader(noCopyArray, 0, noCopyArray.length);
|
||||
};
|
||||
|
||||
var g_module_pointer = new CWasmPointer();
|
||||
@ -86,9 +101,8 @@ CFile.prototype._openFile = function(buffer, password)
|
||||
{
|
||||
let data = new Uint8Array(buffer);
|
||||
this.stream_size = data.length;
|
||||
let stream = Module["_malloc"](this.stream_size);
|
||||
Module["HEAP8"].set(data, stream);
|
||||
this.stream.push(stream);
|
||||
this.stream = Module["_malloc"](this.stream_size);
|
||||
Module["HEAP8"].set(data, this.stream);
|
||||
}
|
||||
|
||||
let passwordPtr = 0;
|
||||
@ -99,7 +113,7 @@ CFile.prototype._openFile = function(buffer, password)
|
||||
Module["HEAP8"].set(passwordBuf, passwordPtr);
|
||||
}
|
||||
|
||||
this.nativeFile = Module["_Open"](this.stream[0], this.stream_size, passwordPtr);
|
||||
this.nativeFile = Module["_Open"](this.stream, this.stream_size, passwordPtr);
|
||||
|
||||
if (passwordPtr)
|
||||
Module["_free"](passwordPtr);
|
||||
@ -113,7 +127,7 @@ CFile.prototype._closeFile = function()
|
||||
|
||||
CFile.prototype._getType = function()
|
||||
{
|
||||
return Module["_GetType"](this.stream[0], this.stream_size);
|
||||
return Module["_GetType"](this.nativeFile);
|
||||
};
|
||||
|
||||
CFile.prototype._getError = function()
|
||||
@ -121,13 +135,27 @@ CFile.prototype._getError = function()
|
||||
return Module["_GetErrorCode"](this.nativeFile);
|
||||
};
|
||||
|
||||
CFile.prototype._SplitPages = function(memoryBuffer)
|
||||
CFile.prototype._SplitPages = function(memoryBuffer, arrayBufferChanges)
|
||||
{
|
||||
let changesPtr = 0;
|
||||
let changesLen = 0;
|
||||
if (arrayBufferChanges)
|
||||
{
|
||||
let changes = new Uint8Array(arrayBufferChanges);
|
||||
changesLen = changes.length;
|
||||
changesPtr = Module["_malloc"](changesLen);
|
||||
Module["HEAP8"].set(changes, changesPtr);
|
||||
}
|
||||
|
||||
let pointer = Module["_malloc"](memoryBuffer.length * 4);
|
||||
Module["HEAP32"].set(memoryBuffer, pointer >> 2);
|
||||
let ptr = Module["_SplitPages"](this.nativeFile, pointer, memoryBuffer.length);
|
||||
let ptr = Module["_SplitPages"](this.nativeFile, pointer, memoryBuffer.length, changesPtr, changesLen);
|
||||
Module["_free"](pointer);
|
||||
return ptr;
|
||||
if (changesPtr)
|
||||
Module["_free"](changesPtr);
|
||||
|
||||
g_module_pointer.ptr = ptr;
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
@ -151,10 +179,7 @@ CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
}
|
||||
|
||||
let bRes = Module["_MergePages"](this.nativeFile, stream2, data.length, maxID, prefixPtr);
|
||||
if (bRes == 1)
|
||||
this.stream.push(stream2);
|
||||
else
|
||||
Module["_free"](stream2);
|
||||
stream2 = 0; // Success or not, stream2 is either taken or freed
|
||||
|
||||
if (prefixPtr)
|
||||
Module["_free"](prefixPtr);
|
||||
@ -164,13 +189,7 @@ CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
|
||||
CFile.prototype._UndoMergePages = function()
|
||||
{
|
||||
let bRes = Module["_UnmergePages"](this.nativeFile);
|
||||
if (bRes == 1)
|
||||
{
|
||||
let str = this.stream.pop();
|
||||
Module["_free"](str);
|
||||
}
|
||||
return bRes == 1;
|
||||
return Module["_UnmergePages"](this.nativeFile) == 1;
|
||||
};
|
||||
|
||||
// FONTS
|
||||
|
||||
@ -68,25 +68,6 @@ WASM_EXPORT int IsFontBinaryExist(char* path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
WASM_EXPORT int GetType(BYTE* data, LONG size)
|
||||
{
|
||||
// 0 - PDF
|
||||
// 1 - DJVU
|
||||
// 2 - XPS
|
||||
LONG nHeaderSearchSize = 1024;
|
||||
LONG nSize = size < nHeaderSearchSize ? size : nHeaderSearchSize;
|
||||
char* pData = (char*)data;
|
||||
for (int i = 0; i < nSize - 5; ++i)
|
||||
{
|
||||
int nPDF = strncmp(&pData[i], "%PDF-", 5);
|
||||
if (!nPDF)
|
||||
return 0;
|
||||
}
|
||||
if ( (8 <= size) && (0x41 == data[0] && 0x54 == data[1] && 0x26 == data[2] && 0x54 == data[3] &&
|
||||
0x46 == data[4] && 0x4f == data[5] && 0x52 == data[6] && 0x4d == data[7]))
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
WASM_EXPORT CDrawingFile* Open(BYTE* data, LONG size, const char* password)
|
||||
{
|
||||
if (!g_applicationFonts)
|
||||
@ -102,6 +83,13 @@ WASM_EXPORT CDrawingFile* Open(BYTE* data, LONG size, const char* password)
|
||||
pFile->OpenFile(data, size, sPassword);
|
||||
return pFile;
|
||||
}
|
||||
WASM_EXPORT int GetType(CDrawingFile* pFile)
|
||||
{
|
||||
// 0 - PDF
|
||||
// 1 - DJVU
|
||||
// 2 - XPS
|
||||
return pFile->GetType();
|
||||
}
|
||||
WASM_EXPORT int GetErrorCode(CDrawingFile* pFile)
|
||||
{
|
||||
if (!pFile)
|
||||
@ -111,6 +99,7 @@ WASM_EXPORT int GetErrorCode(CDrawingFile* pFile)
|
||||
WASM_EXPORT void Close(CDrawingFile* pFile)
|
||||
{
|
||||
delete pFile;
|
||||
g_applicationFonts->GetStreams()->Clear();
|
||||
NSFonts::NSApplicationFontStream::SetGlobalMemoryStorage(NULL);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetInfo(CDrawingFile* pFile)
|
||||
@ -177,9 +166,9 @@ WASM_EXPORT BYTE* ScanPage(CDrawingFile* pFile, int nPageIndex, int mode)
|
||||
{
|
||||
return pFile->ScanPage(nPageIndex, mode);
|
||||
}
|
||||
WASM_EXPORT BYTE* SplitPages(CDrawingFile* pFile, int* arrPageIndex, int nLength)
|
||||
WASM_EXPORT BYTE* SplitPages(CDrawingFile* pFile, int* arrPageIndex, int nLength, BYTE* data, LONG size)
|
||||
{
|
||||
return pFile->SplitPages(arrPageIndex, nLength);
|
||||
return pFile->SplitPages(arrPageIndex, nLength, data, size);
|
||||
}
|
||||
WASM_EXPORT int MergePages(CDrawingFile* pFile, BYTE* data, LONG size, int nMaxID, const char* sPrefixForm)
|
||||
{
|
||||
|
||||
@ -278,6 +278,13 @@ void ReadAnnot(BYTE* pWidgets, int& i)
|
||||
std::cout << "User ID " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
if (nFlags & (1 << 9))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << "OMetadata " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
}
|
||||
|
||||
void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
@ -415,6 +422,19 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
i += 4;
|
||||
std::cout << "MaxLen " << nPathLength << ", ";
|
||||
}
|
||||
if (nFlags & (1 << 10))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << "TU " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
if (nFlags & (1 << 11))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << "MEOptions " << nPathLength << ", ";
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
@ -574,12 +594,11 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
|
||||
std::cout << "Font button " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
if (nFlags & (1 << 20))
|
||||
if (nFlags & (1 << 21))
|
||||
{
|
||||
nPathLength = READ_INT(pWidgets + i);
|
||||
i += 4;
|
||||
std::cout << "OMetadata " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
std::cout << "MEOptions " << nPathLength << ", ";
|
||||
}
|
||||
|
||||
//Action
|
||||
@ -929,6 +948,37 @@ void ReadInteractiveFormsFonts(CDrawingFile* pGrFile, int nType)
|
||||
free(pFonts);
|
||||
}
|
||||
|
||||
bool GetFromBase64(const std::wstring& sPath, BYTE** pBuffer, int* nBufferLen)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(sPath))
|
||||
{
|
||||
DWORD dwFileSize = oFile.GetFileSize();
|
||||
BYTE* pFileContent = new BYTE[dwFileSize];
|
||||
if (!pFileContent)
|
||||
{
|
||||
oFile.CloseFile();
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwReaded;
|
||||
if (!oFile.ReadFile(pFileContent, dwFileSize, dwReaded))
|
||||
return false;
|
||||
|
||||
*nBufferLen = NSBase64::Base64DecodeGetRequiredLength(dwFileSize);
|
||||
*pBuffer = new BYTE[*nBufferLen];
|
||||
if (!(*pBuffer))
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pFileContent);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!NSBase64::Base64Decode((const char*)pFileContent, dwFileSize, *pBuffer, nBufferLen))
|
||||
return false;
|
||||
}
|
||||
oFile.CloseFile();
|
||||
return true;
|
||||
}
|
||||
#include "../../../../../fontengine/ApplicationFontsWorker.h"
|
||||
#include "../../../../../common/Directory.h"
|
||||
|
||||
@ -991,40 +1041,57 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// SPLIT & MERGE
|
||||
BYTE* pSplitPages = NULL;
|
||||
if (true)
|
||||
{
|
||||
std::vector<int> arrPages = { 0 };
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
pSplitPages = SplitPages(pGrFile, arrPages.data(), arrPages.size());
|
||||
if (pSplitPages)
|
||||
{
|
||||
int nLength = READ_INT(pSplitPages);
|
||||
RELEASEARRAYOBJECTS(pFileData);
|
||||
|
||||
// SPLIT & MERGE
|
||||
if (false)
|
||||
{
|
||||
int nBufferLen = NULL;
|
||||
BYTE* pBuffer = NULL;
|
||||
|
||||
if (GetFromBase64(NSFile::GetProcessDirectory() + L"/split1.txt", &pBuffer, &nBufferLen))
|
||||
{
|
||||
std::vector<int> arrPages = { 0 };
|
||||
BYTE* pSplitPages = SplitPages(pGrFile, arrPages.data(), arrPages.size(), pBuffer, nBufferLen);
|
||||
int nLength = READ_INT(pSplitPages);
|
||||
|
||||
if (nLength > 4)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.CreateFileW(NSFile::GetProcessDirectory() + L"/test" + std::to_wstring(i) + L".pdf"))
|
||||
if (oFile.CreateFileW(NSFile::GetProcessDirectory() + L"/split1.pdf"))
|
||||
oFile.WriteFile(pSplitPages + 4, nLength - 4);
|
||||
oFile.CloseFile();
|
||||
|
||||
if (MergePages(pGrFile, pSplitPages + 4, nLength - 4, 0, "merge") == 0)
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
BYTE* pMallocData = (BYTE*)malloc(nLength - 4);
|
||||
memcpy(pMallocData, pSplitPages + 4, nLength - 4);
|
||||
|
||||
if (!UnmergePages(pGrFile))
|
||||
std::cout << "error" << std::endl;
|
||||
MergePages(pGrFile, pMallocData, nLength - 4, 0, "merge1");
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
}
|
||||
}
|
||||
BYTE* pFileMerge = NULL;
|
||||
if (false)
|
||||
{
|
||||
DWORD nFileMergeLen = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(NSFile::GetProcessDirectory() + L"/test_merge.pdf", &pFileMerge, nFileMergeLen))
|
||||
RELEASEARRAYOBJECTS(pBuffer);
|
||||
|
||||
if (GetFromBase64(NSFile::GetProcessDirectory() + L"/split2.txt", &pBuffer, &nBufferLen))
|
||||
{
|
||||
if (MergePages(pGrFile, pFileMerge, nFileMergeLen, 0, "merge") == 0)
|
||||
RELEASEARRAYOBJECTS(pFileMerge);
|
||||
std::vector<int> arrPages = { 0 };
|
||||
BYTE* pSplitPages = SplitPages(pGrFile, arrPages.data(), arrPages.size(), pBuffer, nBufferLen);
|
||||
int nLength = READ_INT(pSplitPages);
|
||||
|
||||
if (nLength > 4)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.CreateFileW(NSFile::GetProcessDirectory() + L"/split2.pdf"))
|
||||
oFile.WriteFile(pSplitPages + 4, nLength - 4);
|
||||
oFile.CloseFile();
|
||||
|
||||
BYTE* pMallocData = (BYTE*)malloc(nLength - 4);
|
||||
memcpy(pMallocData, pSplitPages + 4, nLength - 4);
|
||||
|
||||
MergePages(pGrFile, pMallocData, nLength - 4, 0, "merge2");
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pBuffer);
|
||||
}
|
||||
|
||||
// INFO
|
||||
@ -1988,6 +2055,83 @@ int main(int argc, char* argv[])
|
||||
i += 4;
|
||||
std::cout << "Y4 " << (double)nPathLength / 10000.0 << ", ";
|
||||
}
|
||||
else if (sType == "Redact")
|
||||
{
|
||||
if (nFlags & (1 << 15))
|
||||
{
|
||||
std::cout << "QuadPoints";
|
||||
int nQuadPointsLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
|
||||
for (int j = 0; j < nQuadPointsLength; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << " " << (double)nPathLength / 100.0;
|
||||
}
|
||||
std::cout << ", ";
|
||||
}
|
||||
if (nFlags & (1 << 16))
|
||||
{
|
||||
int nICLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << "IC ";
|
||||
|
||||
for (int j = 0; j < nICLength; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << (double)nPathLength / 10000.0 << " ";
|
||||
}
|
||||
std::cout << ", ";
|
||||
}
|
||||
if (nFlags & (1 << 17))
|
||||
{
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << "OverlayText " << std::string((char*)(pAnnots + i), nPathLength) << ", ";
|
||||
i += nPathLength;
|
||||
}
|
||||
if (nFlags & (1 << 18))
|
||||
std::cout << "Repeat true, ";
|
||||
else
|
||||
std::cout << "Repeat false, ";
|
||||
if (nFlags & (1 << 19))
|
||||
{
|
||||
std::string arrQ[] = {"left-justified", "centered", "right-justified"};
|
||||
nPathLength = READ_BYTE(pAnnots + i);
|
||||
i += 1;
|
||||
std::cout << "Q " << arrQ[nPathLength] << ", ";
|
||||
}
|
||||
if (nFlags & (1 << 20))
|
||||
{
|
||||
int nICLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << "DA color ";
|
||||
|
||||
for (int j = 0; j < nICLength; ++j)
|
||||
{
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << (double)nPathLength / 10000.0 << " ";
|
||||
}
|
||||
std::cout << ", size ";
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << (double)nPathLength / 100.0 << ", font ";
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << std::string((char*)(pAnnots + i), nPathLength) << " actual ";
|
||||
i += nPathLength;
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << std::string((char*)(pAnnots + i), nPathLength) << ", style ";
|
||||
i += nPathLength;
|
||||
nPathLength = READ_INT(pAnnots + i);
|
||||
i += 4;
|
||||
std::cout << nPathLength << ", ";
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << std::endl << "]" << std::endl;
|
||||
}
|
||||
@ -2019,10 +2163,6 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
Close(pGrFile);
|
||||
RELEASEARRAYOBJECTS(pFileData);
|
||||
RELEASEARRAYOBJECTS(pSplitPages);
|
||||
RELEASEARRAYOBJECTS(pFileMerge);
|
||||
RELEASEARRAYOBJECTS(pCMapData);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2,8 +2,11 @@
|
||||
#define _WASM_SERIALIZE_H
|
||||
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include "../../../../../common/File.h"
|
||||
|
||||
#define CLEAR_STACK(stack) while (!(stack).empty()) (stack).pop()
|
||||
|
||||
namespace NSWasm
|
||||
{
|
||||
class CData
|
||||
@ -15,6 +18,8 @@ namespace NSWasm
|
||||
BYTE* m_pDataCur;
|
||||
size_t m_lSizeCur;
|
||||
|
||||
std::stack<size_t> m_lStack;
|
||||
|
||||
public:
|
||||
CData()
|
||||
{
|
||||
@ -24,10 +29,70 @@ namespace NSWasm
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = m_lSize;
|
||||
}
|
||||
CData(const CData& other)
|
||||
{
|
||||
m_lSize = other.m_lSize;
|
||||
m_lSizeCur = other.m_lSizeCur;
|
||||
|
||||
m_pData = (BYTE*)malloc(m_lSize * sizeof(BYTE));
|
||||
memcpy(m_pData, other.m_pData, other.m_lSizeCur * sizeof(BYTE));
|
||||
m_pDataCur = m_pData + m_lSizeCur;
|
||||
|
||||
m_lStack = other.m_lStack;
|
||||
}
|
||||
CData(CData&& other)
|
||||
{
|
||||
m_lSize = other.m_lSize;
|
||||
m_lSizeCur = other.m_lSizeCur;
|
||||
|
||||
m_pData = other.m_pData;
|
||||
m_pDataCur = other.m_pDataCur;
|
||||
|
||||
m_lStack = std::move(other.m_lStack);
|
||||
|
||||
other.ClearWithoutAttack();
|
||||
}
|
||||
virtual ~CData()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
CData& operator= (const CData& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
Clear();
|
||||
|
||||
m_lSize = other.m_lSize;
|
||||
m_lSizeCur = other.m_lSizeCur;
|
||||
|
||||
m_pData = (BYTE*)malloc(m_lSize * sizeof(BYTE));
|
||||
memcpy(m_pData, other.m_pData, other.m_lSizeCur * sizeof(BYTE));
|
||||
m_pDataCur = m_pData + m_lSizeCur;
|
||||
|
||||
m_lStack = other.m_lStack;
|
||||
|
||||
return *this;
|
||||
}
|
||||
CData& operator= (CData&& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
Clear();
|
||||
|
||||
m_lSize = other.m_lSize;
|
||||
m_lSizeCur = other.m_lSizeCur;
|
||||
|
||||
m_pData = other.m_pData;
|
||||
m_pDataCur = other.m_pDataCur;
|
||||
|
||||
other.ClearWithoutAttack();
|
||||
|
||||
m_lStack = std::move(other.m_lStack);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void AddSize(size_t nSize)
|
||||
{
|
||||
@ -68,6 +133,20 @@ namespace NSWasm
|
||||
}
|
||||
|
||||
public:
|
||||
void StartRecord(BYTE type)
|
||||
{
|
||||
AddSize(5); // sizeof (BYTE + unsigned int)
|
||||
WriteBYTE(type);
|
||||
AddInt(0);
|
||||
m_lStack.push(m_lSizeCur);
|
||||
}
|
||||
void EndRecord()
|
||||
{
|
||||
size_t start = m_lStack.top();
|
||||
unsigned int len = m_lSizeCur - start;
|
||||
memcpy(m_pData + start - 4, &len, sizeof(unsigned int));
|
||||
m_lStack.pop();
|
||||
}
|
||||
void AddInt(unsigned int value)
|
||||
{
|
||||
AddSize(4);
|
||||
@ -75,6 +154,13 @@ namespace NSWasm
|
||||
m_pDataCur += 4;
|
||||
m_lSizeCur += 4;
|
||||
}
|
||||
void AddSInt(int value)
|
||||
{
|
||||
AddSize(4);
|
||||
memcpy(m_pDataCur, &value, sizeof(int));
|
||||
m_pDataCur += 4;
|
||||
m_lSizeCur += 4;
|
||||
}
|
||||
void AddInt(unsigned int value, size_t pos)
|
||||
{
|
||||
if (pos < m_lSizeCur)
|
||||
@ -93,6 +179,10 @@ namespace NSWasm
|
||||
m_pDataCur += sizeof(BYTE);
|
||||
m_lSizeCur += sizeof(BYTE);
|
||||
}
|
||||
void WriteBool(bool value)
|
||||
{
|
||||
WriteBYTE(value ? 1 : 0);
|
||||
}
|
||||
void WriteDouble(double value)
|
||||
{
|
||||
int nV = value * 10000;
|
||||
@ -151,6 +241,37 @@ namespace NSWasm
|
||||
WriteString(pDataUtf8, (unsigned int)lDataUtf8);
|
||||
RELEASEARRAYOBJECTS(pDataUtf8);
|
||||
}
|
||||
void WriteStringUtf16(const std::wstring& sStr, const bool& isBytes = false)
|
||||
{
|
||||
unsigned int size = static_cast<unsigned int>(sStr.length());
|
||||
|
||||
int len = 0;
|
||||
size_t posLen = m_lSizeCur;
|
||||
|
||||
// len reserve
|
||||
AddInt(0);
|
||||
|
||||
if (sizeof(wchar_t) == 4)
|
||||
{
|
||||
AddSize(4 * size + 2/*'\0'*/);
|
||||
NSFile::CUtf8Converter::GetUtf16StringFromUnicode_4bytes(sStr.c_str(), (LONG)size, m_pDataCur, len, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t bufferLen = 2 * size;
|
||||
AddSize(bufferLen);
|
||||
len = (int)(bufferLen);
|
||||
memcpy(m_pDataCur, sStr.c_str(), bufferLen);
|
||||
}
|
||||
|
||||
m_pDataCur += static_cast<unsigned int>(len);
|
||||
m_lSizeCur += static_cast<unsigned int>(len);
|
||||
|
||||
if (!isBytes)
|
||||
len /= 2;
|
||||
|
||||
AddInt((unsigned int)len, posLen);
|
||||
}
|
||||
void Write(BYTE* value, unsigned int len)
|
||||
{
|
||||
if (!value || len == 0)
|
||||
@ -165,6 +286,13 @@ namespace NSWasm
|
||||
return m_pData;
|
||||
}
|
||||
|
||||
BYTE* MoveBuffer()
|
||||
{
|
||||
BYTE* pData = m_pData;
|
||||
ClearWithoutAttack();
|
||||
return pData;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
if (m_pData)
|
||||
@ -175,6 +303,8 @@ namespace NSWasm
|
||||
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
|
||||
CLEAR_STACK(m_lStack);
|
||||
}
|
||||
void ClearWithoutAttack()
|
||||
{
|
||||
@ -183,11 +313,15 @@ namespace NSWasm
|
||||
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
|
||||
CLEAR_STACK(m_lStack);
|
||||
}
|
||||
void ClearNoAttack()
|
||||
{
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
|
||||
CLEAR_STACK(m_lStack);
|
||||
}
|
||||
unsigned int GetSize()
|
||||
{
|
||||
|
||||
@ -14,13 +14,15 @@ DEFINES += \
|
||||
MNG_STORE_CHUNKS\
|
||||
MNG_ERROR_TELLTALE
|
||||
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/heif/heif.pri)
|
||||
|
||||
core_linux {
|
||||
DEFINES += HAVE_UNISTD_H HAVE_FCNTL_H
|
||||
QMAKE_CXXFLAGS += -Wno-narrowing
|
||||
}
|
||||
|
||||
core_linux_clang {
|
||||
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
|
||||
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
|
||||
}
|
||||
|
||||
core_mac {
|
||||
@ -285,6 +287,9 @@ SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/PICFile.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/pic.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/heif/heif.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_cm.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_debug.c \
|
||||
|
||||
@ -371,6 +371,7 @@ namespace NSStructures
|
||||
*
|
||||
* Наверное напишу адаптор который переводит порядок точек из 6 типа в общий.
|
||||
*/
|
||||
agg::rgba8 fill_color;
|
||||
std::vector<std::vector<Point>> patch;
|
||||
std::vector<std::vector<agg::rgba8>> patch_colors; // 2 на 2 цвета по углам
|
||||
std::vector<std::vector<float>> patch_parameters; // 2 на 2 параметра
|
||||
@ -388,8 +389,8 @@ namespace NSStructures
|
||||
xsize(1.0f), ysize(1.0f),
|
||||
linstretch(1.0f), linoffset(0.0f),
|
||||
continue_shading_f(false),
|
||||
continue_shading_b(false)
|
||||
|
||||
continue_shading_b(false),
|
||||
luminocity(false)
|
||||
{
|
||||
}
|
||||
void setAngleDegrees(float deg)
|
||||
@ -404,6 +405,57 @@ namespace NSStructures
|
||||
{
|
||||
discrete_step = 1.0f / n;
|
||||
}
|
||||
bool checkLuminosity() const
|
||||
{
|
||||
if (shading.patch_colors.empty())
|
||||
return false;
|
||||
|
||||
for (const auto& ar : shading.patch_colors)
|
||||
for (const auto& c : ar)
|
||||
if (c.r != c.g || c.g != c.b)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool colorEqual(const agg::rgba8& c1, const agg::rgba8& c2) const
|
||||
{
|
||||
return c1.r == c2.r &&
|
||||
c1.g == c2.g &&
|
||||
c1.b == c2.b &&
|
||||
c1.a == c2.a;
|
||||
}
|
||||
bool isOneColor() const
|
||||
{
|
||||
switch (shading.shading_type)
|
||||
{
|
||||
case ShadingInfo::FunctionOnly:
|
||||
case ShadingInfo::Parametric:
|
||||
return false;
|
||||
case ShadingInfo::TriangleInterpolation:
|
||||
return colorEqual(shading.triangle_colors[0], shading.triangle_colors[1]) &&
|
||||
colorEqual(shading.triangle_colors[1], shading.triangle_colors[2]);
|
||||
case ShadingInfo::CurveInterpolation:
|
||||
case ShadingInfo::TensorCurveInterpolation:
|
||||
return colorEqual(shading.patch_colors[0][0], shading.patch_colors[0][1]) &&
|
||||
colorEqual(shading.patch_colors[0][1], shading.patch_colors[1][0]) &&
|
||||
colorEqual(shading.patch_colors[1][0], shading.patch_colors[1][1]);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
agg::rgba8 getFillColor() const
|
||||
{
|
||||
if (!shading.triangle_colors.empty())
|
||||
return shading.triangle_colors[0];
|
||||
if (!shading.patch_colors.empty())
|
||||
return shading.patch_colors[0][0];
|
||||
return agg::rgba8(0, 0, 0);
|
||||
}
|
||||
void setFillColor(const agg::rgba8& color)
|
||||
{
|
||||
shading.fill_color = color;
|
||||
luminocity = true;
|
||||
}
|
||||
void transform(const Aggplus::CMatrix& matrix)
|
||||
{
|
||||
// shading transform
|
||||
@ -502,6 +554,7 @@ namespace NSStructures
|
||||
float linstretch; // stretch linear gradient, can be negative (eq angle = 180) can not be zero
|
||||
float linoffset; // offset relative to image size
|
||||
float continue_shading_b, continue_shading_f;
|
||||
bool luminocity;
|
||||
ShadingInfo shading;
|
||||
};
|
||||
|
||||
@ -643,6 +696,7 @@ namespace NSStructures
|
||||
const std::vector<std::vector<float>> &curve_parametrs,
|
||||
const std::vector<std::vector<agg::rgba8>> &curve_colors,
|
||||
bool parametric,
|
||||
bool luminosity = false,
|
||||
float t0 = 0.0f, float t1 = 1.0f)
|
||||
{
|
||||
GradientInfo ginfo;
|
||||
@ -651,6 +705,7 @@ namespace NSStructures
|
||||
|
||||
ginfo.shading.f_type = ShadingInfo::UseNew;
|
||||
ginfo.shading.function = ColorFunction<agg::rgba8>(256, t0, t1);
|
||||
ginfo.luminocity = luminosity;
|
||||
ginfo.continue_shading_f = false;
|
||||
ginfo.continue_shading_b = false;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user