mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-06-29 05:53:07 +08:00
Compare commits
1627 Commits
v9.1.0.98
...
feature/li
| Author | SHA1 | Date | |
|---|---|---|---|
| 42aa73520b | |||
| ad6094b18c | |||
| c0cad5429e | |||
| e353ff1b96 | |||
| 5f6075ca33 | |||
| 55e5f973b0 | |||
| 78ed5b3d74 | |||
| ba0e0f7449 | |||
| ba992cc401 | |||
| fba14fcf7b | |||
| a2c24b8dc0 | |||
| 073f100fe0 | |||
| e30a6acc87 | |||
| a016fc2868 | |||
| b77b3dc7e2 | |||
| c0a9c1a1dc | |||
| a982ff0ce2 | |||
| a1fe8752fa | |||
| 30f21fc3c7 | |||
| b2c2a0ec6c | |||
| 77ef943473 | |||
| 67ae9115c9 | |||
| be921d6be7 | |||
| 67733c1733 | |||
| 76ee07f61c | |||
| ff32068a97 | |||
| a1ce3b53c2 | |||
| df08ed4614 | |||
| bd92a3550f | |||
| 812c59beaa | |||
| bee1e30e12 | |||
| 2da2866862 | |||
| 075052dd3f | |||
| 4207d697fa | |||
| c5b798b8a9 | |||
| 8a4e115384 | |||
| f4b2184985 | |||
| 6a6c85b6bd | |||
| 0e40482b9f | |||
| 742dfb54b8 | |||
| 52b21fbaed | |||
| aef42511ad | |||
| 692eb8c878 | |||
| 7f16ac66f0 | |||
| a94d46ee06 | |||
| 2dd929dc95 | |||
| 1cfce0fe84 | |||
| 1fc363c189 | |||
| 3a0c438b9c | |||
| 25b30b3a73 | |||
| 8c2c4060a7 | |||
| f2bf914e72 | |||
| 62a25fa847 | |||
| f5a0278d4b | |||
| 7ac9645010 | |||
| 4250382f87 | |||
| 4eca22efde | |||
| 9db2d2f328 | |||
| a868451b5d | |||
| cb217be2a2 | |||
| 6ccf19e036 | |||
| 2582927c72 | |||
| 764a8e4cd9 | |||
| 3fe3382c1e | |||
| b139dec538 | |||
| 0b12c5b521 | |||
| 4c0c47a3cf | |||
| 234f867837 | |||
| 6366306f9c | |||
| 75f97349ca | |||
| 9ef4de7010 | |||
| 6a45740f98 | |||
| dfe6d300d8 | |||
| cce7058d46 | |||
| 71a8a22d2e | |||
| 5bf72dcfb6 | |||
| 7c7ebd5f2a | |||
| 7890f5b87f | |||
| f6decd4754 | |||
| f4a0f3f01a | |||
| 69a066fac9 | |||
| 1a94960abf | |||
| 50816132e9 | |||
| 00bee83d0e | |||
| 37d83faffd | |||
| 8e596451a9 | |||
| 8364bc02a6 | |||
| 5b15d9b77b | |||
| c5a040c807 | |||
| bb9e3a2a7e | |||
| e2c560d5ad | |||
| 815b6623a3 | |||
| 051f1d2c94 | |||
| c2000257aa | |||
| c5b2f3d1f2 | |||
| 72f7aaa6c2 | |||
| 2ed3521355 | |||
| 1c1947459d | |||
| 29b2b2e086 | |||
| 2761614b8d | |||
| 2deb6b8c42 | |||
| 13b19cc13f | |||
| 9720bd18a4 | |||
| a46e0d0a67 | |||
| 59e4d02f01 | |||
| 99b31a46f7 | |||
| 5a0bc5a19d | |||
| 38bbe37f40 | |||
| eb4c5cfc2a | |||
| 6262048e75 | |||
| 7877f542b3 | |||
| f00581fd1d | |||
| bd3dd15a4f | |||
| a796e92fe1 | |||
| 9ddd969b01 | |||
| 828eee5ed5 | |||
| a95d8712d3 | |||
| 3f76fca0f7 | |||
| 1c9ce65ba9 | |||
| 09b1d56a9a | |||
| 3d7381dc68 | |||
| e33e3d6b42 | |||
| c03fd25b6d | |||
| bc59e34153 | |||
| 9679c6e7f8 | |||
| 2ffc0a7844 | |||
| c7c98d3f69 | |||
| d9d7ffef26 | |||
| c7e7fd4aa1 | |||
| 1846056b74 | |||
| 378841d655 | |||
| facd131d7b | |||
| f39716a5da | |||
| d1fada2542 | |||
| 16929b3a54 | |||
| a2f52951b2 | |||
| b0efeafd27 | |||
| f3d34b1363 | |||
| 07e563afe8 | |||
| 75b3665ad5 | |||
| bdbad87830 | |||
| 290e4a0884 | |||
| 0242c5885b | |||
| 8a3a922dba | |||
| b78bcb10dc | |||
| 1c13c80197 | |||
| 653ff24c0e | |||
| a62f97627b | |||
| ddd991601c | |||
| 57c26eb998 | |||
| 2c35b5f422 | |||
| ab76f46fd4 | |||
| 2dd2f3bcc6 | |||
| 612c26cf6c | |||
| 2873418d74 | |||
| 77346270a4 | |||
| 5f005b4501 | |||
| 5f39acbe51 | |||
| 6badba384c | |||
| 0830ed031e | |||
| e63d62bb04 | |||
| 90029fb2f3 | |||
| c96df4e62e | |||
| d4e1b31e10 | |||
| 1580494bdb | |||
| f4fc487ce3 | |||
| a5bfa94770 | |||
| 85a615cc9a | |||
| 91701ed58d | |||
| be200af7d9 | |||
| 279349323f | |||
| 1dae175272 | |||
| 7c6f9f2ad6 | |||
| efc9bab6ed | |||
| 73b32984e2 | |||
| 19758d579d | |||
| f269db67bb | |||
| 2fd10fc33f | |||
| 685b2bb9e0 | |||
| 55fe2e968f | |||
| d90c3aa3ac | |||
| 47fed9cb63 | |||
| e3e247e835 | |||
| bd245cd62a | |||
| 87c3f9beff | |||
| 9b196ada1f | |||
| 10b2b0d3d0 | |||
| cd58508d0f | |||
| d41aef7ec6 | |||
| cda332109e | |||
| bdc22190bd | |||
| 9989510d60 | |||
| 2f1a76fba6 | |||
| 0693bdc115 | |||
| ffb528636f | |||
| abc4619924 | |||
| fe36b3e1e6 | |||
| e72a4f8e8c | |||
| 0b2babbefc | |||
| 32da1a4901 | |||
| d2c6a4821c | |||
| 15e3b57c58 | |||
| 15f423dbb9 | |||
| 5d4e08a86f | |||
| 6b3db7355b | |||
| b5c29e49e2 | |||
| 9a4f929510 | |||
| 206ee9c976 | |||
| 7a8669d7f8 | |||
| ea28ff69a9 | |||
| 88626378a7 | |||
| 261cf72685 | |||
| 219bf06855 | |||
| 23e736051f | |||
| 8870516a8a | |||
| dbe56878b1 | |||
| 1f9ee8628e | |||
| 84aa409b1e | |||
| 6df60b9b4e | |||
| 22bbfa3729 | |||
| 52096d1b0b | |||
| b1623b203b | |||
| 8fa5f8944e | |||
| 27dc6403d7 | |||
| ecaef0fbed | |||
| ca08c74fb4 | |||
| 7d161bda01 | |||
| 2addc5a3d8 | |||
| 4e1afe5c55 | |||
| 9ae5855ed0 | |||
| 8d4e216852 | |||
| 866bf08da3 | |||
| 9e1bb2cd22 | |||
| bb97d00ae7 | |||
| 66eaed4f18 | |||
| 4739b9f9dd | |||
| 57c99df412 | |||
| e8f1691348 | |||
| 0b42267c43 | |||
| 6f1bfc3064 | |||
| f57f573ac4 | |||
| df86855ccf | |||
| 0579b93796 | |||
| 2074785963 | |||
| ed697edba2 | |||
| 686c72a1c8 | |||
| 41124d3301 | |||
| 95d6c6c927 | |||
| 9ae76b07a1 | |||
| da769a642b | |||
| 0d7e535114 | |||
| b18715ae81 | |||
| e0af1357e5 | |||
| d4f80ea036 | |||
| 8e90fbac69 | |||
| 12083ae8c9 | |||
| 322fda0e07 | |||
| b0d70ff38a | |||
| 2a409336a3 | |||
| 6819a41452 | |||
| 4cdc416e0b | |||
| 5d5732161a | |||
| 7046f1d465 | |||
| 61f25af847 | |||
| 9304d10674 | |||
| 21dd6c2a61 | |||
| 278dffc7c7 | |||
| b607aeb4c6 | |||
| bd7aa2df96 | |||
| 3d4dc3116e | |||
| f2fdcf4efd | |||
| ae7dbf291f | |||
| e83dbf57af | |||
| 3aa729d65b | |||
| cb0176ecca | |||
| e1b3fe270a | |||
| 615cf0982d | |||
| b75afead99 | |||
| 290a134cdb | |||
| 6d9a2e0d09 | |||
| 32c4964cca | |||
| a027644bf0 | |||
| 9983161e3d | |||
| 33c4b5130e | |||
| c2dd7b5108 | |||
| 0101774675 | |||
| de9709ea50 | |||
| 22e7c5bed4 | |||
| 11000aa465 | |||
| eada4b4ebe | |||
| 6630a882ed | |||
| e20143fa2e | |||
| 57ca5da2c0 | |||
| 08bad0753a | |||
| 6224b6384d | |||
| be1aed4cae | |||
| e40603df61 | |||
| 6d0db29975 | |||
| 3fe2ed032d | |||
| a43af51577 | |||
| cf0f2be204 | |||
| 44e3e77631 | |||
| e4df8df318 | |||
| 3676400e66 | |||
| 573b85932f | |||
| eca98f612c | |||
| c5f1a08422 | |||
| 3b0c9cea7e | |||
| 3dc0f482c8 | |||
| 7043b36093 | |||
| e429ff685f | |||
| 03334267c9 | |||
| 417c3a55ec | |||
| 90eb06ac20 | |||
| 031c1c91e6 | |||
| d17c22772f | |||
| 2a09f9da90 | |||
| 8a8e17562b | |||
| 52f8640b10 | |||
| 9f36c04d33 | |||
| 8a1a45f403 | |||
| 7dffc8245a | |||
| 869774bcc1 | |||
| 27103958fe | |||
| 2b46e0251f | |||
| 078a58772c | |||
| 95c9c95a2e | |||
| 1753007900 | |||
| f43230dcaf | |||
| df576b6e99 | |||
| bb7d2ce8ee | |||
| ed8a47cbb7 | |||
| 3c707ebbf4 | |||
| 3b2721e2da | |||
| b430c3f296 | |||
| c21827825b | |||
| 19c66750a8 | |||
| 0424c73db0 | |||
| dc6a72892c | |||
| 4b61f6e62a | |||
| 927f49291a | |||
| 72b57be353 | |||
| ef295fc115 | |||
| a62528e90e | |||
| d54f0326cd | |||
| 269dd9b8bc | |||
| 9da0b82ead | |||
| e3334cbea5 | |||
| 01c928c724 | |||
| cf72c836a1 | |||
| b9a905f6b2 | |||
| 644ec4e651 | |||
| e5c1dc4bc3 | |||
| 2c5cd93ac5 | |||
| 1ff1334746 | |||
| de096d4229 | |||
| 6c9d795167 | |||
| 8116322018 | |||
| 5428c28874 | |||
| e389b4d799 | |||
| 8c607a429a | |||
| 00e80b68f6 | |||
| 377317892d | |||
| ef77688ea2 | |||
| eb756fab5c | |||
| 2d2bb7cee7 | |||
| 1abe5b2dcc | |||
| 2b4bdfdc05 | |||
| 007c70bcc0 | |||
| 017b43dd66 | |||
| 88a6760086 | |||
| 98a0551123 | |||
| 6ca34d9c69 | |||
| 49cb1cdbca | |||
| 73e00a5096 | |||
| 462eeda60c | |||
| e1f81b6830 | |||
| d63a6e2ba4 | |||
| b9cf1bd204 | |||
| 81ec569f59 | |||
| 236913f902 | |||
| 2a6d9faaf8 | |||
| 7a78e1bbc6 | |||
| f2db0df9f5 | |||
| c2dfac0d27 | |||
| 902497b299 | |||
| 473f6aef1e | |||
| 35aa329619 | |||
| 6ace9b1cc5 | |||
| f6bc46c551 | |||
| 790049d14a | |||
| ccc9f8f91f | |||
| f2eace2b53 | |||
| dfe7a64e1a | |||
| 65f89c1e4b | |||
| ea7ff62816 | |||
| 4ac45f41cb | |||
| 947e5a1f5d | |||
| 3e724e6164 | |||
| 8ef0713adc | |||
| 2f74b3b69b | |||
| 7ce71b6f5d | |||
| 9b5847e653 | |||
| d81e26eff7 | |||
| 67e987e389 | |||
| bc91106ea4 | |||
| d91a19cbc2 | |||
| 970720575a | |||
| 85027065e6 | |||
| f11045c87f | |||
| 70e819c56b | |||
| 5a662b3567 | |||
| 0f920531ac | |||
| 84d3ea7a21 | |||
| 4893ff96fd | |||
| 6a7791ae0a | |||
| 78ac7bb427 | |||
| 8180a20cb8 | |||
| eb51861f39 | |||
| e4cc737c38 | |||
| f66c646c2c | |||
| 6c89a66b3d | |||
| b127bd3ac1 | |||
| 0cca75b662 | |||
| 08dc0c99cf | |||
| d2af89a2f6 | |||
| 836787f151 | |||
| eb78332705 | |||
| f232d0ca51 | |||
| 24d436fb9c | |||
| 1d362cf69a | |||
| 6c0326d660 | |||
| 4400c9d4f4 | |||
| 71c7d25c9e | |||
| ab1dd7a48b | |||
| 6e3d625420 | |||
| ebb0eb8136 | |||
| 10f34fb67d | |||
| 98d2f62f9e | |||
| 096df8fc31 | |||
| a7886c5cd6 | |||
| ee6ea683d1 | |||
| 9343f73818 | |||
| 61aeb6f386 | |||
| 06e8d136bf | |||
| c1d649b506 | |||
| 4386e9c794 | |||
| 4900305b4a | |||
| e1f923c593 | |||
| 07ef2269ac | |||
| cf44441645 | |||
| 7157d209d7 | |||
| 64a560679c | |||
| 2682e49090 | |||
| 7fd4219ff4 | |||
| 4f9c229f77 | |||
| 6d8454c39d | |||
| 58deecba88 | |||
| 1940bc53f7 | |||
| a6ac765676 | |||
| 08624e8334 | |||
| 1f078c8c49 | |||
| e6036b37be | |||
| 04f1c30036 | |||
| 86f84f89de | |||
| 17b80ac96e | |||
| 710bfef301 | |||
| aa75825a73 | |||
| f74caacbd0 | |||
| 4d903b58b8 | |||
| 6434965f09 | |||
| f60f957d00 | |||
| bad5b172d5 | |||
| 7b6f29a5f0 | |||
| b5e1cf9d06 | |||
| 0f73b2aa8b | |||
| e3b5d72ec8 | |||
| 8f8a9ad29b | |||
| 1417b4bbd4 | |||
| 87c9f66c58 | |||
| d0a9d2cfe2 | |||
| 627d5913e6 | |||
| 5ca60f6bcd | |||
| 72f679b649 | |||
| c84c35933e | |||
| 63f160641d | |||
| 7a8ccfdfa0 | |||
| 6091a7b5cd | |||
| 95b4461961 | |||
| ec5afc1f17 | |||
| 9dd13a2f74 | |||
| b850450c25 | |||
| 098d40d44f | |||
| 82769d3c0e | |||
| 5121f74851 | |||
| 6fa8b51541 | |||
| 3b32ba4d14 | |||
| e23acc8881 | |||
| c266ffa85f | |||
| bd2af5f455 | |||
| ec8c0182c3 | |||
| 04ad9d4e47 | |||
| 3261ba0d0c | |||
| 2189934a50 | |||
| e3842c796a | |||
| 7507b6c71f | |||
| 8a406c9612 | |||
| 3a004e8495 | |||
| 404748ec5a | |||
| d4f7767c45 | |||
| f91cc79e7d | |||
| b14e7fd3a2 | |||
| fce8173ce4 | |||
| 8f5bfef6b2 | |||
| f6bf73dfab | |||
| 3b10e1a0f3 | |||
| f7555af6b3 | |||
| 3e09e5ad48 | |||
| 655bc0698f | |||
| e16b85f671 | |||
| 981b8b16a3 | |||
| 70aa8c7e64 | |||
| 4144723822 | |||
| 2663e412ef | |||
| 9a91e8192c | |||
| bff86db600 | |||
| 668804035a | |||
| cb97ee9fdc | |||
| 56b8e41875 | |||
| 565b2ec494 | |||
| a243e60e5a | |||
| 96ce3c22f1 | |||
| 6b58358186 | |||
| 6c95810f63 | |||
| d9260e5eee | |||
| 63510a1fe9 | |||
| 1e05ab9acb | |||
| c1236815a3 | |||
| c822a995c1 | |||
| e612306d75 | |||
| 2d6382e61a | |||
| 2f34fd917e | |||
| 024a5e0192 | |||
| a6183fa4cd | |||
| 13912c93ef | |||
| adcdbc164f | |||
| a48a78c1c5 | |||
| da57bd115c | |||
| 71b21ea79d | |||
| 5fbb998524 | |||
| ea47a90763 | |||
| daefd8744a | |||
| 647327a0c5 | |||
| 58b221f4fa | |||
| 22eaf8241b | |||
| 64c7b7a3fd | |||
| 858c2e14c8 | |||
| 2024302fbe | |||
| 00f4752dda | |||
| 90b329e06c | |||
| d286b8459b | |||
| ff93f1e8b3 | |||
| 65a4fa90a5 | |||
| 4471940b92 | |||
| c4daa0acd4 | |||
| 6df0cf26f3 | |||
| 720d66ad74 | |||
| e6522c6ce4 | |||
| 9b3c2291d8 | |||
| e7cfb67962 | |||
| 8725be55f0 | |||
| 37ae77d0d2 | |||
| 4c6ded76a1 | |||
| 2d8701cd4f | |||
| d5c321d47d | |||
| bddfadabb2 | |||
| 324f7b3933 | |||
| edef6a83c8 | |||
| e7c21fb2cd | |||
| be8ba62c3f | |||
| fda8c8e445 | |||
| d9ebae1724 | |||
| 92ec3d854e | |||
| f4867bd9f9 | |||
| 9b9da90dcc | |||
| cba4bc8085 | |||
| 325c2d3000 | |||
| 3187913c8e | |||
| 8958d13b56 | |||
| 9d13526724 | |||
| 93f70176bc | |||
| e2ad965d7c | |||
| d535aa64ef | |||
| c155a4c53a | |||
| 97cbd8dcc7 | |||
| 5e58298d1e | |||
| d38576085c | |||
| 46dd9efa2e | |||
| 6af52920a2 | |||
| f13baca136 | |||
| 28a91a1519 | |||
| 0e48e65ef1 | |||
| ad1709d4af | |||
| e2c6ecec9b | |||
| ef55594f90 | |||
| 223bbe3347 | |||
| eca0cdb318 | |||
| 4a52368c30 | |||
| 73f4e20c56 | |||
| d53768969b | |||
| 324d6ec0bd | |||
| 767b652ef2 | |||
| 68f2f0760d | |||
| 694282a013 | |||
| e64eeb26af | |||
| 873b2b9351 | |||
| d5ecb00472 | |||
| 2ac6801afa | |||
| 213c65fe54 | |||
| 8269c14207 | |||
| f438a17779 | |||
| 9c8b739d0e | |||
| a9dc790f92 | |||
| 7f0720bb95 | |||
| 846b212882 | |||
| 344a096e24 | |||
| 15eb4793f5 | |||
| 3ce4b4bfe8 | |||
| b8fab6f4df | |||
| 14bb45d2fe | |||
| 347c1f82a9 | |||
| 7ebf12c1e4 | |||
| 1813e09e1f | |||
| e32b48524e | |||
| d2a986c480 | |||
| 73880f6207 | |||
| 24ad4adf6f | |||
| e4ea19ed81 | |||
| 575e379c4b | |||
| 86d8c7bfa3 | |||
| a3e1efb75b | |||
| e1f7feb5c1 | |||
| 2a3f565b44 | |||
| 13008c60e5 | |||
| df69099689 | |||
| 4e6f6e44bd | |||
| 67b54dc371 | |||
| b0c3172ae5 | |||
| 91d21a80ac | |||
| e820a9c936 | |||
| b38b12dfaf | |||
| 39b9e89e77 | |||
| 0b6ea2a399 | |||
| eee3161833 | |||
| fc422bb2e7 | |||
| f359f180bb | |||
| b0338919fe | |||
| 41358e3308 | |||
| 1a29fb1389 | |||
| 2fa048303f | |||
| 79f8e14d07 | |||
| e837479426 | |||
| e8f68e3a40 | |||
| 702987e00c | |||
| 83745da5f3 | |||
| 6b73faac12 | |||
| cab91648ce | |||
| 57b51a8854 | |||
| 4a84b8887f | |||
| 23027e4c2c | |||
| 52c61219dc | |||
| 2c37dac18c | |||
| aa7f104e60 | |||
| 83ea144c16 | |||
| ea6fdc8872 | |||
| b64b31a972 | |||
| 59fb6e4838 | |||
| d38ce5b836 | |||
| bb4ceb14e5 | |||
| ef9f25aa4d | |||
| 0c2a5eac1b | |||
| 0f85422315 | |||
| 38fa7436c0 | |||
| e2ce58a055 | |||
| cadba798b0 | |||
| 3941d5ced2 | |||
| c529cc6d5c | |||
| 31f274fbc4 | |||
| 58fe8ae679 | |||
| e3f77e11e0 | |||
| 6e696daa15 | |||
| 21dd930d30 | |||
| c4708222c6 | |||
| 34aae89432 | |||
| 273454a391 | |||
| ae4edab75e | |||
| e61aa447f2 | |||
| 6609e84bd1 | |||
| 402fe2c796 | |||
| e2aab8a241 | |||
| 555a251211 | |||
| 4a605d2424 | |||
| e49c4bc7fe | |||
| f5a4e570bb | |||
| af5a87327b | |||
| 11c637deeb | |||
| b3a7e20b35 | |||
| 915576a819 | |||
| 38a07b3c4d | |||
| ead20d7bfe | |||
| 90dc792fae | |||
| 0561ed2182 | |||
| 116ec89cd2 | |||
| f44de11437 | |||
| f5395b8b5f | |||
| 614222ee44 | |||
| 1b5d71a14c | |||
| 2ff12c06a4 | |||
| a3b6295058 | |||
| efd9e3a29e | |||
| 0fa13f3659 | |||
| 8133e3f7b7 | |||
| 7eabfd0838 | |||
| 3081d02c9c | |||
| fd2710e46e | |||
| bc076fb5b6 | |||
| 33fa3fa38b | |||
| 9bc03ffdef | |||
| 91afd3d340 | |||
| 6018add7a5 | |||
| b616ce6fd7 | |||
| 570482b60d | |||
| 201cae0e6f | |||
| 1cca5e3c12 | |||
| 048eebc613 | |||
| 7d06219664 | |||
| 760b4f9079 | |||
| 578118380e | |||
| 59f376908c | |||
| 38ceb61e4a | |||
| b3a76d5678 | |||
| c2d1bf113b | |||
| bde1115962 | |||
| d8dc82ea35 | |||
| 0ef0518f1a | |||
| f2da15defa | |||
| e3272a5e91 | |||
| d29dae37cb | |||
| d82c96dc0f | |||
| 69948ba383 | |||
| d04f9cb8cf | |||
| 5d6caf8a93 | |||
| f6ede7a53f | |||
| 3839ab4c15 | |||
| e936b0e4e7 | |||
| 6283a68841 | |||
| 75477e8c03 | |||
| 527cc5f89f | |||
| f4cb421b49 | |||
| 83d8a073a7 | |||
| 55ba36f4d2 | |||
| f760d03281 | |||
| 50ae7db2f0 | |||
| 0e02919540 | |||
| 1237991ffb | |||
| 5e5293b77b | |||
| 8250b59558 | |||
| 646c29166e | |||
| a2fc927b39 | |||
| b6f024b73f | |||
| 3aca7bec15 | |||
| 078ec02efd | |||
| dd17cb7243 | |||
| deff23eaac | |||
| b3988b002f | |||
| db2a9e88a1 | |||
| a8fe05fb6a | |||
| bb3091b6f1 | |||
| d908cb668e | |||
| d595d3ea86 | |||
| dde96288ed | |||
| 41d79b0df6 | |||
| 2330f1dae8 | |||
| 8f108582b9 | |||
| 6c6d575908 | |||
| 14dd41a2a2 | |||
| b000343b86 | |||
| c7e1250287 | |||
| dc6ca55b57 | |||
| 707aab41f3 | |||
| fba3767e36 | |||
| 7b8eae26c1 | |||
| c445c0444d | |||
| 94edfff846 | |||
| 482810712e | |||
| 43ba8fca21 | |||
| f38759d071 | |||
| 52e47745de | |||
| 554d3d0dfd | |||
| c9100737e0 | |||
| a22f0bfb60 | |||
| d21b44a0b8 | |||
| 0da5ad2f48 | |||
| 8611c5f781 | |||
| ea338db68a | |||
| 5089a76b43 | |||
| a8678c5d10 | |||
| ac5c7d6d76 | |||
| 080ae0d924 | |||
| 77c9bd8c6d | |||
| 8144f98bb8 | |||
| aec1220bff | |||
| 76f3afc6c0 | |||
| 3e78043cdd | |||
| 0319918827 | |||
| 80d8f4b12e | |||
| c52cfd0886 | |||
| 4c9a24bf71 | |||
| 9ece4889a1 | |||
| 00c24f9d68 | |||
| 0223b1beab | |||
| 5c15b76598 | |||
| 72315df901 | |||
| cb0e361490 | |||
| db279bd725 | |||
| 40c4c922c1 | |||
| 67f287f30f | |||
| 964a44ed93 | |||
| 57984ca8a2 | |||
| a30f7dfdf4 | |||
| b369c32e9e | |||
| 40a4fa1a92 | |||
| 3870d23511 | |||
| 9c12c0b30a | |||
| 2779542061 | |||
| e232fc779d | |||
| 3209c8e42e | |||
| 037057ea7a | |||
| d373a8cc4c | |||
| 13e2efe724 | |||
| b09d441987 | |||
| 9e835d5cc1 | |||
| f75df05824 | |||
| 0d6d273573 | |||
| d7a1642a62 | |||
| d74899a116 | |||
| 981df3fce7 | |||
| d0dfd6737c | |||
| 05d7d88481 | |||
| cec10b7058 | |||
| c3b3a1b5ef | |||
| 47258d9c30 | |||
| 10ab7009a1 | |||
| 3623b0970b | |||
| 7ecab52601 | |||
| 9fedabc0e2 | |||
| 85d98daedd | |||
| fa46455e74 | |||
| 0c87e66785 | |||
| 9dacd4a548 | |||
| e815f39905 | |||
| fb8a72cd6b | |||
| ad6113cf21 | |||
| 11914f8dc2 | |||
| 50b2656c44 | |||
| 39235f7fd6 | |||
| d2527e5707 | |||
| 3484834b9d | |||
| 81b4ba3493 | |||
| 44e217cf7c | |||
| 61311457be | |||
| e15391ea35 | |||
| fefeb483e5 | |||
| e31e02d993 | |||
| 5c7ef5a6eb | |||
| bcdcfa8bf7 | |||
| fc110a004d | |||
| 12d33fad53 | |||
| 2534d2b5c9 | |||
| 7019b192bd | |||
| ac97a5680b | |||
| bebb39a619 | |||
| 1ee8baa672 | |||
| d014383a6d | |||
| 6422ce7f78 | |||
| 31f7136f70 | |||
| f2023f626b | |||
| 6ea64599bd | |||
| d1d94f481d | |||
| 82eb921f05 | |||
| 84847f1e74 | |||
| 3730827cd8 | |||
| eab6d5530b | |||
| dd00be6dce | |||
| 8391667147 | |||
| b8748e40d5 | |||
| 39da47bc21 | |||
| 3a201b8b28 | |||
| bbfbe4a149 | |||
| 0c1c57ccb3 | |||
| fa532edad6 | |||
| df82306306 | |||
| 7a3464b985 | |||
| 49924e23ac | |||
| b5f0b39258 | |||
| 3f6a800dd8 | |||
| 1c8ad7a5c4 | |||
| 8464d3aeb7 | |||
| ed939ebd1d | |||
| fe6c5614d4 | |||
| 1eaac39e48 | |||
| 7624e24027 | |||
| 44ffa4b72e | |||
| 10bdf2703a | |||
| c488384dbc | |||
| cd80bca553 | |||
| 6e49670513 | |||
| b1b3e1fb7c | |||
| d78487e0f5 | |||
| 5069b68247 | |||
| 31433e20de | |||
| 86d0d2113e | |||
| 8f2b4e4153 | |||
| 0be867c47d | |||
| 78aae7e9d0 | |||
| 10e63543dc | |||
| 900cf01902 | |||
| f6a52876ce | |||
| 45ad566eb1 | |||
| 5bbea51848 | |||
| 28a1828000 | |||
| 816430e0e2 | |||
| 29a29cc818 | |||
| bf66c1d9c0 | |||
| 2a3982a884 | |||
| 9f94166f82 | |||
| f11beb659f | |||
| 9a9182a1e9 | |||
| c7cce459bc | |||
| b5fb8a34dc | |||
| 11f0c937f4 | |||
| 5e435d322f | |||
| 05660e8c31 | |||
| b9ff6ba943 | |||
| d603e4f5dd | |||
| 207dd32a5d | |||
| f2d0d7ac4c | |||
| 842d17f79e | |||
| d48a28fe1d | |||
| 2a22c5e1f3 | |||
| 629a35213e | |||
| 7b995bb45f | |||
| 08502f0b24 | |||
| aeca319710 | |||
| 7425d53eb3 | |||
| a056b2e4a9 | |||
| 2dd35a7d81 | |||
| 080d89c8a0 | |||
| 1809f7f4c2 | |||
| 4bfd4f0a08 | |||
| 3ef5651dfd | |||
| 8231809ef0 | |||
| 7f3d073d63 | |||
| 5f09e91944 | |||
| f4359e0b7f | |||
| ca9cf4ee61 | |||
| f52538f66a | |||
| bd76b2add0 | |||
| 0436e39722 | |||
| 15359be125 | |||
| 07be806ae3 | |||
| fc2a12c6f2 | |||
| 42030372fe | |||
| bbf6c2d8e9 | |||
| cb15cc18eb | |||
| 389bf976a9 | |||
| 4d1b516cc9 | |||
| 600a59c966 | |||
| 94f06bf997 | |||
| 230316aefa | |||
| 66b2f3c828 | |||
| 64e077da19 | |||
| 499fe52b8c | |||
| 6f9c376040 | |||
| f0b266793f | |||
| 490281dda0 | |||
| b98b808cda | |||
| 6c77718f17 | |||
| 1e18352e77 | |||
| c3f4f32702 | |||
| 50c7e106fb | |||
| 6b5ee390a2 | |||
| 6df7a7e01e | |||
| 6167f23a08 | |||
| 7c544729bc | |||
| 74a2b3b06f | |||
| 8f3e19a5db | |||
| d60c102dbb | |||
| 9049e2e6a8 | |||
| 67c6707072 | |||
| 0c29a5d436 | |||
| d709598563 | |||
| 0019f589bc | |||
| 02d492ff90 | |||
| a7026ccb8d | |||
| 200c17ee40 | |||
| 4543bfa6cd | |||
| 16e78d87a4 | |||
| 051597a78a | |||
| 7afad1fe49 | |||
| aa53d6302f | |||
| 13e03328af | |||
| 04ccd4fe27 | |||
| ae8fb19147 | |||
| 12083905dc | |||
| e653442b8c | |||
| 511cfb6158 | |||
| 7f665b96a5 | |||
| 6b80b39d4d | |||
| 8926c15908 | |||
| 033c45b7a0 | |||
| cbf138b1eb | |||
| 897f8fa9f2 | |||
| 8feb44225d | |||
| 517e337049 | |||
| c05231cf58 | |||
| 66b1007ab4 | |||
| 16d75fe498 | |||
| 62413b8df5 | |||
| fe2e1568fa | |||
| f93c259977 | |||
| 7e057bab6e | |||
| 910ff6a6dd | |||
| 22e5bcbde3 | |||
| 4bf8308bff | |||
| a77cbf903b | |||
| 9b4416952f | |||
| a320b5bd5a | |||
| 34a1f117c9 | |||
| ec4700ac38 | |||
| 6af3f2fe35 | |||
| b61d8df484 | |||
| fc3748e516 | |||
| 468dcd7ba4 | |||
| 85047874b7 | |||
| 52bf1a6988 | |||
| 27746f5c2b | |||
| d3710a755e | |||
| 5c8dcd7ed2 | |||
| 5c0b3744ee | |||
| 7048f132c6 | |||
| 1f3467d75f | |||
| 238cdc8084 | |||
| a1d8597b4f | |||
| 15dc718211 | |||
| 1db12e66c6 | |||
| 580283ef45 | |||
| 5de19652f2 | |||
| fd648a7dd3 | |||
| 76b5bd594d | |||
| 61b55c9230 | |||
| 22aecb56ec | |||
| 4d4f3be717 | |||
| 6e481f6a34 | |||
| 2059e4bb95 | |||
| 3586a010a8 | |||
| 146fc90746 | |||
| 4452d7bf3d | |||
| 673678e80a | |||
| b51960e925 | |||
| 6a5186c411 | |||
| b5ea9d68e2 | |||
| 71e96930c9 | |||
| d9be0df8fb | |||
| 0477002e85 | |||
| 68f1c6f97d | |||
| 3cee4b0212 | |||
| 6f85ce7116 | |||
| d920492afe | |||
| d69a54de38 | |||
| cfb62d599d | |||
| 919d117a1f | |||
| d4b289d0ca | |||
| cbb1df1522 | |||
| 3b0e98fc4a | |||
| a29eb52e1a | |||
| 270e8e41dd | |||
| 16eb1b51e7 | |||
| 751b82dc51 | |||
| 320e30c857 | |||
| e4c84e2972 | |||
| 527ff672d9 | |||
| aa24268a2e | |||
| 39e4c3a09c | |||
| a6898c8235 | |||
| 8158ace0eb | |||
| 463ca05404 | |||
| f38ce7b61b | |||
| 95a1b39fb1 | |||
| f58be7754a | |||
| a31c3ee00a | |||
| 548cee436a | |||
| b1a36d546b | |||
| 23e9187f5a | |||
| 07d3f371a2 | |||
| 278cac8a61 | |||
| 07fd1e87d7 | |||
| 817ee4dde0 | |||
| d93bd27896 | |||
| 0e991719bf | |||
| be56209baf | |||
| 6a573d0da7 | |||
| ca2504edb6 | |||
| e936e330d9 | |||
| 07bedd847e | |||
| bda95fc03d | |||
| c0c0289ffb | |||
| 5c110799a6 | |||
| 1b6c81407b | |||
| 1e0d662838 | |||
| ae2680c419 | |||
| 506a805654 | |||
| 1b61353b2e | |||
| 7777048790 | |||
| fd6c0907bd | |||
| 1bdff9e7fe | |||
| 8fab1802df | |||
| 2aef5daf12 | |||
| 6cf6ade6e3 | |||
| 2399ba41e4 | |||
| fe2fb0c08d | |||
| bfffcda0c5 | |||
| e96ceab1e3 | |||
| 317e21af6a | |||
| 5046c1b326 | |||
| 4bc78e7bb4 | |||
| 4f6daaae67 | |||
| 8203492999 | |||
| 6616a11e7c | |||
| 45e97b76f0 | |||
| d3017c2777 | |||
| 910f453ce8 | |||
| 54fb5a7891 | |||
| 93b96e5555 | |||
| 41c4032fe8 | |||
| 9e57f8c3b1 | |||
| 57221c0e32 | |||
| 76b7099a37 | |||
| 85f428fda6 | |||
| d97a62442f | |||
| 41fb12d58b | |||
| df49a4fbde | |||
| 3d586a4bb6 | |||
| 6d76fd71cc | |||
| ed0811d8ab | |||
| 84cc97f035 | |||
| 170cada6e6 | |||
| 984807d611 | |||
| 250c85c077 | |||
| dbd92bfdfa | |||
| e4825294ed | |||
| 17c336d57c | |||
| 4e7af40367 | |||
| b7230d16fc | |||
| 22a7e6bb05 | |||
| a4ed2dea41 | |||
| ab2eabdd23 | |||
| 2796fbed8b | |||
| ab052c7c59 | |||
| 2b209ed5e4 | |||
| 04bce828be | |||
| 4c5259494d | |||
| 289a77a978 | |||
| a22cc4e410 | |||
| 9ccbb25acd | |||
| 954d86ed0f | |||
| 091af38e0d | |||
| 4b335fc796 | |||
| 5e177412e2 | |||
| 2b214ab07d | |||
| c8b34959d7 | |||
| 2bf44900de | |||
| c235a4c646 | |||
| 3bdd0e2053 | |||
| 339820e5df | |||
| 1dd5eb3368 | |||
| 47e0a0c9e7 | |||
| 475cbb6f8a | |||
| 5a491aea3e | |||
| 2d7c5ec2df | |||
| ee784a7189 | |||
| 650fb84b6d | |||
| dec13334db | |||
| 4a2d0b5e1f | |||
| 54ce32cfaf | |||
| 38079e8692 | |||
| ac75675367 | |||
| a0fc634f5f | |||
| 1d58d8fc7f | |||
| 1624a2dda2 | |||
| b0a850745d | |||
| 2ebade4413 | |||
| a0a9d899a8 | |||
| 5e9f99e960 | |||
| a67935908a | |||
| da1bc5d2d6 | |||
| 7156669830 | |||
| 9d5388a7bf | |||
| 3b85841ea6 | |||
| 4899ed4e7f | |||
| f335a5b024 | |||
| 2cdb04656d | |||
| 6eeae2e804 | |||
| 3934c28eb8 | |||
| 82e281cf6b | |||
| f6337bb12c | |||
| 1d88830b38 | |||
| b4395efa91 | |||
| 32f683137a | |||
| 9737038776 | |||
| 915c3497e4 | |||
| d59573c3b3 | |||
| abb884c714 | |||
| befeed6233 | |||
| 54e329915c | |||
| f27d78ef48 | |||
| 58ee2582d6 | |||
| 4c3af930a5 | |||
| db86830824 | |||
| 77496c6df7 | |||
| dd73d05dd1 | |||
| cabd994f5f | |||
| 2a3f90ab93 | |||
| 1849f7a69f | |||
| e898a9bb99 | |||
| bed0f29ac6 | |||
| 320d000030 | |||
| 1fb9ef4713 | |||
| 264edeb9b6 | |||
| 4e48821faf | |||
| fd5d6f41dc | |||
| 29b9cf515a | |||
| 53c4f320f6 | |||
| e126ceef3c | |||
| df22ad3855 | |||
| a40e246d7d | |||
| 9a17338be7 | |||
| e344c4ca0d | |||
| 1aec69965d | |||
| 1212a78d58 | |||
| 869bbf6cc9 | |||
| afdac778b0 | |||
| 6de079a487 | |||
| 78085554b5 | |||
| 7310eb49a9 | |||
| 66d94cf00c | |||
| d0f1691a5e | |||
| 26b598784e | |||
| 8795539c20 | |||
| 0ccff9944d | |||
| c6d1f5e502 | |||
| fbc42a514f | |||
| 5b5a1d461c | |||
| c567c9739c | |||
| 992f6616e0 | |||
| 686b719bff | |||
| c5a047f83a | |||
| 97560748aa | |||
| 6481c2d531 | |||
| 0f51381926 | |||
| 7e012dac94 | |||
| c4525f8ae1 | |||
| fc0d3abd6a | |||
| cebd668fe9 | |||
| 2f965fd578 | |||
| 115c51cd7c | |||
| a123af1066 | |||
| e640331750 | |||
| a42310d2c5 | |||
| 24e7c822ff | |||
| 9c2c9509db | |||
| a3d947d855 | |||
| 9900726e43 | |||
| f05fa7c0ee | |||
| 9a46a6b514 | |||
| 497c64e713 | |||
| 104a6ee3ae | |||
| ed99de9976 | |||
| ada62871eb | |||
| 0d646a32c4 | |||
| 80a2cfc0fe | |||
| 8c91eea87a | |||
| 7a2c32cb47 | |||
| 503e462366 | |||
| 917c33e76d | |||
| 1301da284c | |||
| 4d9a4ed300 | |||
| 1937895a56 | |||
| 01fbf07c9e | |||
| 173a29419a | |||
| 526e53e465 | |||
| d208215814 | |||
| 605e5e2c9d | |||
| c45c63f914 | |||
| 66d36b64b0 | |||
| 59bd457253 | |||
| 4db7b36303 | |||
| 23cc9ec824 | |||
| 63d74183a1 | |||
| 542837dd3a | |||
| 7a4dfdbbe4 | |||
| a220822b7b | |||
| a9a391c960 | |||
| 7a8f926852 | |||
| 3bd50dbece | |||
| a306faf286 | |||
| 63d6430502 | |||
| 21a637594a | |||
| 5c5a18de0d | |||
| add2a66da9 | |||
| 954f3c91bb | |||
| 2213f6415d | |||
| e26f220a40 | |||
| 9f24bda011 | |||
| 0e68a83f0d | |||
| 10d05760dd | |||
| db5f239cb1 | |||
| 8cc18975b7 | |||
| 2bc14634bb | |||
| 408d677640 | |||
| dc904a1f13 | |||
| fdb9eaa2a5 | |||
| 3e9b0ffbda | |||
| e28aea4734 | |||
| 28584e7df1 | |||
| 7a6e00a792 | |||
| e7d913e1d2 | |||
| 3e2223ae6d | |||
| d3793169aa | |||
| 6dccf05e92 | |||
| eb2ba042ef | |||
| 1111f421d9 | |||
| 28c2e748a3 | |||
| e2bda52737 | |||
| ad496ca7cd | |||
| 8ee1c33532 | |||
| 6c9c2cf538 | |||
| 303c395c84 | |||
| 62d826d8c6 | |||
| 964a3b455b | |||
| 96ba4495ed | |||
| ec246526ac | |||
| 5cf633ede6 | |||
| a8d34f2437 | |||
| c3d2761c10 | |||
| dfbdb869d7 | |||
| 98d10c0c33 | |||
| 2f6b41d06a | |||
| ed7a50855e | |||
| 87e4738481 | |||
| c622fa54fc | |||
| c45b9fa0df | |||
| fe877b128b | |||
| aa4b0c8844 | |||
| 14e9a198c4 | |||
| b96e024145 | |||
| 4734d58ba6 | |||
| 526a21da57 | |||
| fb6bda209b | |||
| 414afabce7 | |||
| 4b0f79a1ab | |||
| c3c9dfcc70 | |||
| 2cd69351c7 | |||
| de8a054b26 | |||
| e1157b8507 | |||
| e5946892c9 | |||
| d399027127 | |||
| a873787fd7 | |||
| 2e732ce62f | |||
| 21a166208f | |||
| c3f98e011d | |||
| 49fc001aa3 | |||
| cc47abad5f | |||
| a7b0b0a938 | |||
| c8ebcfac87 | |||
| 44e6774c5a | |||
| 2931c4b53e | |||
| c4ad01a30f | |||
| 7ddb363d60 | |||
| 74ba5d20ec | |||
| ecd333e238 | |||
| b377493ecb | |||
| afeeeab564 | |||
| b52dff617b | |||
| 31644cc5d7 | |||
| 460abc0d55 | |||
| 1aa17ba09e | |||
| d50d1b04e5 | |||
| e2faddf21f | |||
| 670c788625 | |||
| cd2f1a2b2a | |||
| 71fe030440 | |||
| d654092289 | |||
| 01b2aaedb2 | |||
| 7577bd2d20 | |||
| 9453e9c87d | |||
| 580c896b72 | |||
| fbce3f44dc | |||
| 8916814106 | |||
| 46947ea869 | |||
| 9cbb2ae79e | |||
| bff6054c2b | |||
| 7ac1ab3f06 | |||
| b272bbe977 | |||
| 03a1d9fa4c | |||
| 81e517c320 | |||
| 5e5ac22fd3 | |||
| a64242d0ec | |||
| 5d383fe297 | |||
| 0fd709bf93 | |||
| e16d3b3695 | |||
| 3a047cfab0 | |||
| 0ed11abb38 | |||
| f2044aef8d | |||
| 61d199a0c1 | |||
| 7a463f7984 | |||
| 9322ad72d2 | |||
| e7a57c1584 | |||
| 1241d41102 | |||
| 4ea31dcb00 | |||
| 127803b181 | |||
| 54a0c7f231 | |||
| a4d60a1ae1 | |||
| b7b3e0dd65 | |||
| 3e31c4ca4f | |||
| c28a6bf1ea | |||
| 842a44ccf9 | |||
| 9f24254cc7 | |||
| 5c3f228ff3 | |||
| c71937d08e | |||
| 33b54e01a0 | |||
| e105eca426 | |||
| 02a923afb4 | |||
| 9b6e2477d5 | |||
| c7a0996a6c | |||
| 51de435393 | |||
| a0f67ef148 | |||
| c53e7416cc | |||
| a41a16b720 | |||
| 58e86051e6 | |||
| 10fbb547da | |||
| 0ce18534a5 | |||
| 054128d981 | |||
| 26adb8d565 | |||
| deb5b75e1f | |||
| 6d27231e15 | |||
| 3f7152be08 | |||
| a2a5ef8fcd | |||
| 1c877ebe59 | |||
| f03248ca86 | |||
| a4005412a7 | |||
| d5434f190f | |||
| e50016259a | |||
| 0ed5be36a8 | |||
| d5a6c935e5 | |||
| aa3d4cb3ce | |||
| 73fa9b6aac | |||
| c9a0d6e4e5 | |||
| a517cef437 | |||
| 130de28e4b | |||
| 2ee94c4920 | |||
| cd53c06be3 | |||
| 122a54f510 | |||
| c9905b3c4c | |||
| f96dd51403 | |||
| 9463ae5487 | |||
| 8676bde7bc | |||
| b425405744 | |||
| 28ffd27fca | |||
| 9bc9d86dd6 | |||
| a1891b597f | |||
| bf9ce4f535 | |||
| 508d8f25db | |||
| efbfcaed37 | |||
| deb90037d5 | |||
| 22c70d1c49 | |||
| 097aa15104 | |||
| d1fc31ac28 | |||
| b8efe6c554 | |||
| f95f4bdfd5 | |||
| 22a984b4ac | |||
| 13410f8467 | |||
| 3a389147dd | |||
| ba203f734d | |||
| 8a42229186 | |||
| 758454747d | |||
| fbf4c0f81a | |||
| d904245e9a | |||
| bf175e92a3 | |||
| 0c9b5821e7 | |||
| 98dae842ae | |||
| 7bb68aedca | |||
| 5475c246ab | |||
| 5864ab8e7a | |||
| 03809c0a1c | |||
| 6c3f0e88cb | |||
| bb40cd0467 | |||
| 5c98a92faf | |||
| 2b54cfaf37 | |||
| 00cd3a9497 | |||
| a488266ba1 | |||
| 65f4acc2ac | |||
| ff53c1b474 | |||
| a47f3df7bf | |||
| abd4c2f4a8 | |||
| 334f9602b4 | |||
| e32aea2138 | |||
| fed94358fe | |||
| 89b669e319 | |||
| db213d3ae4 | |||
| 79df81301f | |||
| 3cf3a3e098 | |||
| 197bbf7027 | |||
| d092b88d9b | |||
| a466592bc2 | |||
| 4bce73d81d | |||
| 2a6c50db89 | |||
| ed13e54d26 | |||
| e0dee3720f | |||
| 4686fb4081 | |||
| dda020a1d5 | |||
| e371f7ccf1 | |||
| 14a0e4713c | |||
| 74b9a426c2 | |||
| 43c7e2c9a8 | |||
| cac28771d3 | |||
| 39b9c28607 | |||
| 6e57d7e4e7 | |||
| a938ce4c76 | |||
| f831d9a22d | |||
| 930165a993 | |||
| fc56b22d40 | |||
| c53fff1ffb | |||
| 7f54430813 | |||
| ea42899b9e | |||
| b420fd731f | |||
| dbbf4d04f9 | |||
| d854608d45 | |||
| fe2b631c87 | |||
| 18d36179bd | |||
| 71e1f7c726 | |||
| 62132c27bd | |||
| 239d82deb4 | |||
| e4449d7aa9 | |||
| cb304293b7 | |||
| ffb62243a9 | |||
| 63a80580cc | |||
| fed142690b | |||
| 8d368ca91c | |||
| 2cc2434982 | |||
| f5989b979a | |||
| 5bab01517a | |||
| 62955d5f6e | |||
| cb68e4389e | |||
| 72a445fb54 | |||
| 9fc3fcabcb | |||
| 6af0b89c1d | |||
| 7451ba6e10 | |||
| c34b9e00e5 | |||
| e715da8680 | |||
| d6c58a4655 | |||
| 7a26c345c5 | |||
| 2a6e76a2bc | |||
| adfc79938d | |||
| c3ce1d2756 | |||
| cf5208d6a5 | |||
| 56e6a0a3b8 | |||
| c1bb697725 | |||
| 0a7ad2f560 | |||
| fede5921e1 | |||
| 897ea781b7 | |||
| f95014f46f | |||
| 92fae52a6d | |||
| afb0f44af2 | |||
| 1027f3cc6b | |||
| af20b1f63d | |||
| c779654a58 | |||
| d1c99891c6 | |||
| ffc94bf455 | |||
| 680c83853a | |||
| 33e698242c | |||
| e8ad643a0e | |||
| 609e3bc158 | |||
| f04c60fbb0 | |||
| 7e51dd143a | |||
| 31d65dea7c | |||
| 89172a9047 | |||
| 0103717241 | |||
| cc294ab2b2 | |||
| c012662402 | |||
| 0f1cb37153 | |||
| 95bad7b071 | |||
| 00c3085a90 | |||
| f1fa861c8a | |||
| 48d6ce60ee | |||
| c37f96da2d | |||
| 3b4097310b | |||
| 89473c5ba0 | |||
| 07afc6e4c3 | |||
| 05404c1bad | |||
| b0e810013d | |||
| 34c34018a0 | |||
| 05dd636a1c | |||
| e6158043b9 | |||
| cfd1dcc3ee | |||
| 7a2944ce58 | |||
| 8a11fa5aac | |||
| aa2127b55f | |||
| 86a2d66d83 | |||
| 9b3b6caef9 | |||
| 2aeec01f1e | |||
| 70412f5f8e | |||
| b1885e5b91 | |||
| 8e2d1e2c16 | |||
| d6ed01e1df | |||
| 0fcf29eddc | |||
| 474a500819 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -46,5 +46,6 @@ DesktopEditor/fontengine/js/common/freetype-2.10.4
|
||||
|
||||
.qtc_clangd
|
||||
Common/3dParty/openssl/openssl/
|
||||
Common/3dParty/libxml/libxml2/
|
||||
|
||||
msvc_make.bat
|
||||
|
||||
11
3DPARTY.md
11
3DPARTY.md
@ -16,3 +16,14 @@
|
||||
- cryptopp ([BSL](https://raw.githubusercontent.com/weidai11/cryptopp/master/License.txt))
|
||||
- openssl ([Apache-2.0](https://raw.githubusercontent.com/openssl/openssl/master/LICENSE.txt))
|
||||
- v8 ([3-clause BSD License](https://raw.githubusercontent.com/v8/v8/main/LICENSE))
|
||||
- googletest ([3-clause BSD License](https://raw.githubusercontent.com/google/googletest/refs/heads/main/LICENSE))
|
||||
- glm ([MIT](https://raw.githubusercontent.com/g-truc/glm/refs/heads/master/copying.txt))
|
||||
- mdds ([MIT](https://raw.githubusercontent.com/kohei-us/mdds/refs/heads/master/LICENSES/MIT.txt))
|
||||
- librevenge ([MPL-2](https://raw.githubusercontent.com/Distrotech/librevenge/refs/heads/distrotech-librevenge/COPYING.MPL))
|
||||
- libodfgen ([MPL-2](https://raw.githubusercontent.com/Distrotech/libodfgen/refs/heads/master/COPYING.MPL))
|
||||
- libetonyek ([MPL-2](https://raw.githubusercontent.com/LibreOffice/libetonyek/refs/heads/master/COPYING))
|
||||
- md4c ([MIT](https://raw.githubusercontent.com/mity/md4c/refs/heads/master/LICENSE.md))
|
||||
- libheif([MIT](https://raw.githubusercontent.com/strukturag/libheif/refs/heads/master/COPYING))
|
||||
- libde265([MIT](https://raw.githubusercontent.com/strukturag/libde265/refs/heads/master/COPYING))
|
||||
- x265([GPL 2.0](https://bitbucket.org/multicoreware/x265_git/raw/cfee9638c82b655c5887cedbdf1aa856f81b906a/COPYING))
|
||||
- pole([FREE](https://github.com/otofoto/Pole/blob/master/pole/LICENSE))
|
||||
|
||||
@ -1,3 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* 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, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* 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: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "IWork.h"
|
||||
#include "../DesktopEditor/common/File.h"
|
||||
#include "../DesktopEditor/common/Directory.h"
|
||||
@ -53,7 +88,7 @@ bool GetRVNGInputStream(const DATA_TYPE_INPUTFILE& sFile, std::shared_ptr<librev
|
||||
|
||||
IWorkFileType CIWorkFile::GetType(const std::wstring& sFile) const
|
||||
{
|
||||
//TODO:: так как на данный момент мы работает только напрямую с файлом, то работа с директорией нам пока не нужна
|
||||
//TODO:: since currently we work directly with file only, directory handling is not needed yet
|
||||
if (NSDirectory::PathIsDirectory(sFile))
|
||||
return IWorkFileType::None;
|
||||
|
||||
@ -107,7 +142,7 @@ int Convert(const std::wstring& wsOutputFile, std::shared_ptr<librevenge::RVNGIn
|
||||
|
||||
int CIWorkFile::Convert2Odf(const std::wstring& sFile, const std::wstring& sOutputFile) const
|
||||
{
|
||||
//TODO:: так как на данный момент мы работает только напрямую с файлом, то работа с директорией нам пока не нужна
|
||||
//TODO:: since currently we work directly with file only, directory handling is not needed yet
|
||||
if (NSDirectory::PathIsDirectory(sFile))
|
||||
return -1;
|
||||
|
||||
|
||||
@ -1,3 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* 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, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* 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: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _IWORKFILE_IWORKFILE_H
|
||||
#define _IWORKFILE_IWORKFILE_H
|
||||
|
||||
|
||||
@ -1,3 +1,36 @@
|
||||
# Copyright (C) Ascensio System SIA, 2009-2026
|
||||
#
|
||||
# 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, together with the
|
||||
# additional terms provided in the LICENSE file.
|
||||
#
|
||||
# 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: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
#
|
||||
# You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
# or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
# LV-1050, Latvia, European Union.
|
||||
#
|
||||
# The interactive user interfaces in modified versions of the Program
|
||||
# are required to display Appropriate Legal Notices in accordance with
|
||||
# Section 5 of the GNU AGPL version 3.
|
||||
#
|
||||
# No trademark rights are granted under this License.
|
||||
#
|
||||
# All non-code elements of the Product, including illustrations,
|
||||
# icon sets, and technical writing content, are licensed under the
|
||||
# Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
# https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
#
|
||||
# This license applies only to such non-code elements and does not
|
||||
# modify or replace the licensing terms applicable to the Program's
|
||||
# source code, which remains licensed under the GNU Affero General
|
||||
# Public License v3.
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
|
||||
@ -1,33 +1,36 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* 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.
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* 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
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* 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.
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* 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
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "../IWork.h"
|
||||
|
||||
@ -1,3 +1,36 @@
|
||||
# Copyright (C) Ascensio System SIA, 2009-2026
|
||||
#
|
||||
# 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, together with the
|
||||
# additional terms provided in the LICENSE file.
|
||||
#
|
||||
# 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: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
#
|
||||
# You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
# or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
# LV-1050, Latvia, European Union.
|
||||
#
|
||||
# The interactive user interfaces in modified versions of the Program
|
||||
# are required to display Appropriate Legal Notices in accordance with
|
||||
# Section 5 of the GNU AGPL version 3.
|
||||
#
|
||||
# No trademark rights are granted under this License.
|
||||
#
|
||||
# All non-code elements of the Product, including illustrations,
|
||||
# icon sets, and technical writing content, are licensed under the
|
||||
# Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
# https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
#
|
||||
# This license applies only to such non-code elements and does not
|
||||
# modify or replace the licensing terms applicable to the Program's
|
||||
# source code, which remains licensed under the GNU Affero General
|
||||
# Public License v3.
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
CONFIG -= qt
|
||||
QT -= core gui
|
||||
|
||||
|
||||
@ -6,12 +6,13 @@ import os
|
||||
if not base.is_dir("glm"):
|
||||
base.cmd("git", ["clone", "https://github.com/g-truc/glm.git"])
|
||||
base.cmd_in_dir("glm", "git", ["checkout", "33b4a621a697a305bc3a7610d290677b96beb181", "--quiet"])
|
||||
base.replaceInFile("./glm/glm/detail/func_common.inl", "vec<L, T, Q> v;", "vec<L, T, Q> v{};")
|
||||
|
||||
if not base.is_dir("mdds"):
|
||||
base.cmd("git", ["clone", "https://github.com/kohei-us/mdds.git"])
|
||||
base.cmd_in_dir("mdds", "git", ["checkout", "0783158939c6ce4b0b1b89e345ab983ccb0f0ad0"], "--quiet")
|
||||
|
||||
fix_cpp_version = "#if __cplusplus < 201402L\n"
|
||||
fix_cpp_version = "#if __cplusplus < 201703L\n"
|
||||
fix_cpp_version += "#ifndef _MSC_VER\n"
|
||||
fix_cpp_version += "namespace std {\n"
|
||||
fix_cpp_version += " template<bool __v>\n"
|
||||
|
||||
36
Common/3dParty/boost/patches/mpl_integral_wrapper.patch
Normal file
36
Common/3dParty/boost/patches/mpl_integral_wrapper.patch
Normal file
@ -0,0 +1,36 @@
|
||||
<<<<<<<
|
||||
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
|
||||
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
|
||||
public:
|
||||
typedef AUX_WRAPPER_INST(next_value) next;
|
||||
typedef AUX_WRAPPER_INST(prior_value) prior;
|
||||
#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|
||||
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
|
||||
|| (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1)))
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next;
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior;
|
||||
#else
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next;
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
|
||||
#endif
|
||||
=======
|
||||
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \
|
||||
|| defined(__clang__)
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
|
||||
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
|
||||
public:
|
||||
typedef AUX_WRAPPER_INST(next_value) next;
|
||||
typedef AUX_WRAPPER_INST(prior_value) prior;
|
||||
#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|
||||
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
|
||||
|| (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1)))
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next;
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior;
|
||||
#else
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next;
|
||||
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
|
||||
#endif
|
||||
>>>>>>>
|
||||
@ -3,6 +3,8 @@ DEPENDPATH += $$PWD
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/boost/boost.pri)
|
||||
|
||||
css_calculator_without_xhtml {
|
||||
HEADERS += \
|
||||
$$PWD/src/CCssCalculator_Private.h \
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
|
||||
#include <iostream>
|
||||
#include "../../../../../DesktopEditor/common/File.h"
|
||||
#include "StaticFunctions.h"
|
||||
#include "ConstValues.h"
|
||||
@ -18,14 +17,16 @@ namespace NSCSS
|
||||
{
|
||||
typedef std::map<std::wstring, std::wstring>::const_iterator styles_iterator;
|
||||
|
||||
CCompiledStyle::CCompiledStyle() : m_nDpi(96), m_UnitMeasure(Point), m_dCoreFontSize(DEFAULT_FONT_SIZE)
|
||||
CCompiledStyle::CCompiledStyle()
|
||||
: m_nDpi(96), m_UnitMeasure(Point), m_dCoreFontSize(DEFAULT_FONT_SIZE)
|
||||
{}
|
||||
|
||||
CCompiledStyle::CCompiledStyle(const CCompiledStyle& oStyle) :
|
||||
m_arParentsStyles(oStyle.m_arParentsStyles), m_sId(oStyle.m_sId),
|
||||
m_nDpi(oStyle.m_nDpi), m_UnitMeasure(oStyle.m_UnitMeasure), m_dCoreFontSize(oStyle.m_dCoreFontSize),
|
||||
m_oFont(oStyle.m_oFont), m_oMargin(oStyle.m_oMargin), m_oPadding(oStyle.m_oPadding), m_oBackground(oStyle.m_oBackground),
|
||||
m_oText(oStyle.m_oText), m_oBorder(oStyle.m_oBorder), m_oDisplay(oStyle.m_oDisplay), m_oTransform(oStyle.m_oTransform){}
|
||||
m_oText(oStyle.m_oText), m_oBorder(oStyle.m_oBorder), m_oDisplay(oStyle.m_oDisplay), m_oTransform(oStyle.m_oTransform)
|
||||
{}
|
||||
|
||||
CCompiledStyle::~CCompiledStyle()
|
||||
{
|
||||
@ -34,6 +35,8 @@ namespace NSCSS
|
||||
|
||||
CCompiledStyle& CCompiledStyle::operator+= (const CCompiledStyle &oElement)
|
||||
{
|
||||
m_arParentsStyles.insert(oElement.m_arParentsStyles.begin(), oElement.m_arParentsStyles.end());
|
||||
|
||||
if (oElement.Empty())
|
||||
return *this;
|
||||
|
||||
@ -49,8 +52,6 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@ -15,29 +15,33 @@ inline static std::wstring StringifyValueList(const KatanaArray* oValues);
|
||||
inline static std::wstring StringifyValue(const KatanaValue* oValue);
|
||||
inline static bool IsTableElement(const std::wstring& wsNameTag);
|
||||
|
||||
bool operator<(const std::vector<NSCSS::CNode> &arLeftSelectors, const std::vector<NSCSS::CNode> &arRightSelectors)
|
||||
{
|
||||
const size_t& sizeLeftSelectors = arLeftSelectors.size();
|
||||
const size_t& sizeRightSelectors = arRightSelectors.size();
|
||||
|
||||
if (sizeLeftSelectors < sizeRightSelectors)
|
||||
return true;
|
||||
else if (sizeLeftSelectors > sizeRightSelectors)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < arLeftSelectors.size(); ++i)
|
||||
{
|
||||
if (arLeftSelectors[i] < arRightSelectors[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
bool operator<(const std::vector<NSCSS::CNode> &arLeftSelectors, const std::vector<NSCSS::CNode> &arRightSelectors)
|
||||
{
|
||||
if (arLeftSelectors.size() < arRightSelectors.size())
|
||||
return true;
|
||||
else if (arLeftSelectors.size() > arRightSelectors.size())
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < arLeftSelectors.size(); ++i)
|
||||
{
|
||||
if (arLeftSelectors[i] == arRightSelectors[i])
|
||||
continue;
|
||||
|
||||
if (arLeftSelectors[i] < arRightSelectors[i])
|
||||
return true;
|
||||
else if (arRightSelectors[i] < arLeftSelectors[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CStyleStorage::CStyleStorage()
|
||||
{}
|
||||
{
|
||||
InitDefaultStyles();
|
||||
}
|
||||
|
||||
CStyleStorage::~CStyleStorage()
|
||||
{
|
||||
@ -62,6 +66,7 @@ namespace NSCSS
|
||||
m_arEmptyStyleFiles.clear();
|
||||
|
||||
ClearEmbeddedStyles();
|
||||
ClearDefaultStyles();
|
||||
ClearAllowedStyleFiles();
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
@ -208,6 +213,16 @@ namespace NSCSS
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const CElement* CStyleStorage::FindDefaultElement(const std::wstring& wsSelector) const
|
||||
{
|
||||
if (wsSelector.empty())
|
||||
return nullptr;
|
||||
|
||||
const CElement* pFoundElement = FindSelectorFromStyleData(wsSelector, m_mDefaultStyleData);
|
||||
|
||||
return (nullptr != pFoundElement) ? pFoundElement : nullptr;
|
||||
}
|
||||
|
||||
void CStyleStorage::AddStyles(const std::string& sStyle, std::map<std::wstring, CElement*>& mStyleData)
|
||||
{
|
||||
if (sStyle.empty())
|
||||
@ -227,6 +242,15 @@ namespace NSCSS
|
||||
m_mEmbeddedStyleData.clear();
|
||||
}
|
||||
|
||||
void CStyleStorage::ClearDefaultStyles()
|
||||
{
|
||||
for (std::map<std::wstring, CElement*>::iterator oIter = m_mDefaultStyleData.begin(); oIter != m_mDefaultStyleData.end(); ++oIter)
|
||||
if (oIter->second != nullptr)
|
||||
delete oIter->second;
|
||||
|
||||
m_mDefaultStyleData.clear();
|
||||
}
|
||||
|
||||
void CStyleStorage::ClearAllowedStyleFiles()
|
||||
{
|
||||
m_arAllowedStyleFiles.clear();
|
||||
@ -480,7 +504,34 @@ namespace NSCSS
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCssCalculator_Private::CCssCalculator_Private() : m_nDpi(96), m_nCountNodes(0), m_sEncoding(L"UTF-8"){}
|
||||
void CStyleStorage::InitDefaultStyles()
|
||||
{
|
||||
m_mDefaultStyleData[L"b"] = new CElement(L"b", {{L"font-weight", L"bold"}});
|
||||
m_mDefaultStyleData[L"center"] = new CElement(L"center", {{L"text-align", L"center"}});
|
||||
m_mDefaultStyleData[L"i"] = new CElement(L"i", {{L"font-style", L"italic"}});
|
||||
m_mDefaultStyleData[L"code"] = new CElement(L"code", {{L"font-family", L"Courier New"}});
|
||||
m_mDefaultStyleData[L"kbd"] = new CElement(L"kbd", {{L"font-family", L"Courier New"},
|
||||
{L"font_weight", L"bold"}});
|
||||
m_mDefaultStyleData[L"s"] = new CElement(L"s", {{L"text-decoration", L"line-through"}});
|
||||
m_mDefaultStyleData[L"u"] = new CElement(L"u", {{L"text-decoration", L"underline"}});
|
||||
m_mDefaultStyleData[L"mark"] = new CElement(L"mark", {{L"background-color", L"yellow"}});
|
||||
m_mDefaultStyleData[L"sup"] = new CElement(L"sup", {{L"vertical-align", L"top"}});
|
||||
m_mDefaultStyleData[L"sub"] = new CElement(L"sub", {{L"vertical-align", L"bottom"}});
|
||||
m_mDefaultStyleData[L"dd"] = new CElement(L"dd", {{L"margin-left", L"720tw"}});
|
||||
m_mDefaultStyleData[L"pre"] = new CElement(L"pre", {{L"font-family", L"Courier New"},
|
||||
{L"margin-top", L"0"},
|
||||
{L"margin-bottom", L"0"}});
|
||||
m_mDefaultStyleData[L"blockquote"] = new CElement(L"blockquote", {{L"margin", L"0px"}});
|
||||
m_mDefaultStyleData[L"ul"] = new CElement(L"ul", {{L"margin-top", L"100tw"},
|
||||
{L"margin-bottom", L"100tw"}});
|
||||
m_mDefaultStyleData[L"textarea"] = new CElement(L"textarea", {{L"border", L"1px solid black"}});
|
||||
m_mDefaultStyleData[L"th"] = new CElement(L"b", {{L"font-weight", L"bold"}});
|
||||
}
|
||||
|
||||
CCssCalculator_Private::CCssCalculator_Private()
|
||||
: m_nDpi(96), m_nCountNodes(0), m_sEncoding(L"UTF-8")
|
||||
{
|
||||
}
|
||||
|
||||
CCssCalculator_Private::~CCssCalculator_Private()
|
||||
{}
|
||||
@ -503,17 +554,25 @@ namespace NSCSS
|
||||
arSelectors.back().m_pCompiledStyle->m_oBorder.Clear();
|
||||
}
|
||||
|
||||
if (arSelectors.size() > 1)
|
||||
arSelectors.back().m_pCompiledStyle->AddParent(arSelectors[arSelectors.size() - 2].m_wsName);
|
||||
|
||||
arSelectors.back().m_pCompiledStyle->SetID(L"text-" + std::to_wstring(++m_nCountNodes));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::map<std::vector<CNode>, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
|
||||
const std::map<std::vector<CNode>, CCompiledStyle>::const_iterator oItem = m_mUsedStyles.find(arSelectors);
|
||||
|
||||
if (oItem != m_mUsedStyles.end())
|
||||
if (oItem != m_mUsedStyles.cend() && (arSelectors.back().m_wsId.empty() || !HaveStylesById(arSelectors.back().m_wsId)))
|
||||
{
|
||||
arSelectors.back().SetCompiledStyle(new CCompiledStyle(oItem->second));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!arSelectors.back().m_pCompiledStyle->Empty())
|
||||
return true;
|
||||
|
||||
arSelectors.back().m_pCompiledStyle->SetDpi(m_nDpi);
|
||||
unsigned int unStart = 0;
|
||||
|
||||
@ -522,8 +581,8 @@ namespace NSCSS
|
||||
if (itFound != arSelectors.crend())
|
||||
unStart = itFound.base() - arSelectors.cbegin();
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, unStart);
|
||||
std::vector<std::wstring> arPrevNodes;
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, unStart, arSelectors.size());
|
||||
std::vector<std::wstring> arPrevNodes = CalculateAllNodes(arSelectors, 0, unStart);
|
||||
bool bInTable = false;
|
||||
|
||||
for (size_t i = 0; i < unStart; ++i)
|
||||
@ -539,7 +598,8 @@ namespace NSCSS
|
||||
if (0 != i)
|
||||
*arSelectors[i].m_pCompiledStyle += *arSelectors[i - 1].m_pCompiledStyle;
|
||||
|
||||
arSelectors[i].m_pCompiledStyle->AddParent(arSelectors[i].m_wsName);
|
||||
if (i != arSelectors.size() - 1)
|
||||
arSelectors[i].m_pCompiledStyle->AddParent(arSelectors[i].m_wsName);
|
||||
|
||||
if (!bInTable)
|
||||
bInTable = IsTableElement(arSelectors[i].m_wsName);
|
||||
@ -548,6 +608,7 @@ namespace NSCSS
|
||||
{
|
||||
arSelectors[i].m_pCompiledStyle->m_oBackground.Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oBorder.Clear();
|
||||
arSelectors[i].m_pCompiledStyle->m_oDisplay.Clear();
|
||||
}
|
||||
|
||||
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_mAttributes, i + 1);
|
||||
@ -558,7 +619,7 @@ namespace NSCSS
|
||||
if (!arSelectors[i].m_wsStyle.empty())
|
||||
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
|
||||
|
||||
// Скидываем некоторые внешние стили, которые внутри таблицы переопределяются
|
||||
// Reset some external styles that are overridden inside the table
|
||||
if (bInTable && i < arSelectors.size() - 1)
|
||||
{
|
||||
arSelectors[i].m_pCompiledStyle->m_oFont.GetLineHeight().Clear();
|
||||
@ -577,7 +638,7 @@ namespace NSCSS
|
||||
|
||||
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
//TODO:: пересмотреть данный метод
|
||||
//TODO:: review this method
|
||||
m_oStyleStorage.SetPageData(oPage, mData, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
@ -592,11 +653,14 @@ namespace NSCSS
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors, unsigned int unStart)
|
||||
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors, unsigned int unStart, unsigned int unEnd)
|
||||
{
|
||||
if ((0 != unEnd && (unEnd < unStart || unEnd > arSelectors.size())) || (unStart == unEnd))
|
||||
return std::vector<std::wstring>();
|
||||
|
||||
std::vector<std::wstring> arNodes;
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend() - unStart; ++oNode)
|
||||
|
||||
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin() + ((0 != unEnd) ? (arSelectors.size() - unEnd) : 0); oNode != arSelectors.rend() - unStart; ++oNode)
|
||||
{
|
||||
if (!oNode->m_wsName.empty())
|
||||
arNodes.push_back(oNode->m_wsName);
|
||||
@ -608,8 +672,8 @@ namespace NSCSS
|
||||
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
|
||||
|
||||
arNodes.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
|
||||
[](std::wstring sRes, const std::wstring& sClass)
|
||||
{return sRes += L'.' + sClass + L' ';}));
|
||||
[](std::wstring sRes, const std::wstring& sClass)
|
||||
{return sRes += L'.' + sClass + L' ';}));
|
||||
}
|
||||
else
|
||||
arNodes.push_back(L'.' + oNode->m_wsClass);
|
||||
@ -627,7 +691,7 @@ namespace NSCSS
|
||||
if (arNextNodes.empty())
|
||||
return;
|
||||
|
||||
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
|
||||
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.cbegin(), arNextNodes.cend());
|
||||
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
|
||||
|
||||
if (!arTempPrev.empty())
|
||||
@ -637,6 +701,36 @@ namespace NSCSS
|
||||
arFindedElements.insert(arFindedElements.end(), arTempKins.begin(), arTempKins.end());
|
||||
}
|
||||
|
||||
inline std::wstring GetAlternativeDefaultNodeName(const std::wstring& wsNodeName)
|
||||
{
|
||||
if (L"strong" == wsNodeName)
|
||||
return L"b";
|
||||
|
||||
if (L"cite" == wsNodeName || L"dfn" == wsNodeName || L"em" == wsNodeName ||
|
||||
L"var" == wsNodeName || L"adress" == wsNodeName)
|
||||
return L"i";
|
||||
|
||||
if (L"tt" == wsNodeName || L"samp" == wsNodeName)
|
||||
return L"code";
|
||||
|
||||
if (L"strike" == wsNodeName || L"del" == wsNodeName)
|
||||
return L"s";
|
||||
|
||||
if (L"ins" == wsNodeName)
|
||||
return L"u";
|
||||
|
||||
if (L"xmp" == wsNodeName || L"nobr" == wsNodeName)
|
||||
return L"pre";
|
||||
|
||||
if (L"ol" == wsNodeName)
|
||||
return L"ul";
|
||||
|
||||
if (L"fieldset" == wsNodeName)
|
||||
return L"textarea";
|
||||
|
||||
return wsNodeName;
|
||||
}
|
||||
|
||||
std::vector<const CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes)
|
||||
{
|
||||
if (arNodes.empty())
|
||||
@ -644,20 +738,19 @@ namespace NSCSS
|
||||
|
||||
std::vector<const CElement*> arFindedElements;
|
||||
|
||||
std::wstring wsName, wsId;
|
||||
std::wstring wsName, wsClasses, wsId;
|
||||
std::vector<std::wstring> arClasses;
|
||||
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'#')
|
||||
{
|
||||
wsId = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsId);
|
||||
}
|
||||
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'.')
|
||||
{
|
||||
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
|
||||
arNextNodes.push_back(arNodes.back());
|
||||
wsClasses = arNodes.back();
|
||||
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(wsClasses, false, L" ");
|
||||
arNodes.pop_back();
|
||||
}
|
||||
|
||||
@ -665,7 +758,6 @@ namespace NSCSS
|
||||
{
|
||||
wsName = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsName);
|
||||
}
|
||||
|
||||
if (!wsId.empty())
|
||||
@ -697,6 +789,11 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
const CElement* pFoundDefault = m_oStyleStorage.FindDefaultElement(GetAlternativeDefaultNodeName(wsName));
|
||||
|
||||
if (nullptr != pFoundDefault)
|
||||
arFindedElements.push_back(pFoundDefault);
|
||||
|
||||
const CElement* pFoundName = m_oStyleStorage.FindElement(wsName);
|
||||
|
||||
if (nullptr != pFoundName)
|
||||
@ -724,6 +821,14 @@ namespace NSCSS
|
||||
{ return oFirstElement->GetWeight() > oSecondElement->GetWeight(); });
|
||||
}
|
||||
|
||||
if (!wsId.empty())
|
||||
arNextNodes.push_back(wsId);
|
||||
|
||||
if (!wsClasses.empty())
|
||||
arNextNodes.push_back(wsClasses);
|
||||
|
||||
arNextNodes.push_back(wsName);
|
||||
|
||||
return arFindedElements;
|
||||
}
|
||||
|
||||
@ -738,7 +843,7 @@ namespace NSCSS
|
||||
if (arSelectors.empty())
|
||||
return false;
|
||||
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
|
||||
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, 0, arSelectors.size());
|
||||
std::vector<std::wstring> arNextNodes;
|
||||
|
||||
for (size_t i = 0; i < arSelectors.size(); ++i)
|
||||
|
||||
@ -27,6 +27,7 @@ namespace NSCSS
|
||||
void AddStylesFromFile(const std::wstring& wsFileName);
|
||||
|
||||
void ClearEmbeddedStyles();
|
||||
void ClearDefaultStyles();
|
||||
void ClearAllowedStyleFiles();
|
||||
void ClearStylesFromFile(const std::wstring& wsFileName);
|
||||
|
||||
@ -38,6 +39,7 @@ namespace NSCSS
|
||||
#endif
|
||||
|
||||
const CElement* FindElement(const std::wstring& wsSelector) const;
|
||||
const CElement* FindDefaultElement(const std::wstring& wsSelector) const;
|
||||
private:
|
||||
typedef struct
|
||||
{
|
||||
@ -49,6 +51,7 @@ namespace NSCSS
|
||||
std::set<std::wstring> m_arAllowedStyleFiles;
|
||||
std::vector<TStyleFileData*> m_arStyleFiles;
|
||||
std::map<std::wstring, CElement*> m_mEmbeddedStyleData;
|
||||
std::map<std::wstring, CElement*> m_mDefaultStyleData;
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
typedef struct
|
||||
@ -78,6 +81,8 @@ 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;
|
||||
|
||||
void InitDefaultStyles();
|
||||
};
|
||||
|
||||
class CCssCalculator_Private
|
||||
@ -110,7 +115,7 @@ namespace NSCSS
|
||||
void ClearPageData();
|
||||
#endif
|
||||
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors, unsigned int unStart = 0);
|
||||
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors, unsigned int unStart, unsigned int unEnd);
|
||||
std::vector<const CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes);
|
||||
|
||||
void AddStyles(const std::string& sStyle);
|
||||
|
||||
@ -9,6 +9,13 @@ namespace NSCSS
|
||||
CElement::CElement()
|
||||
{
|
||||
}
|
||||
|
||||
CElement::CElement(const std::wstring& wsSelector, std::map<std::wstring, std::wstring> mStyle)
|
||||
: m_mStyle(mStyle), m_sSelector(wsSelector), m_sFullSelector(wsSelector)
|
||||
{
|
||||
UpdateWeight();
|
||||
}
|
||||
|
||||
CElement::~CElement()
|
||||
{
|
||||
for (CElement* oElement : m_arPrevElements)
|
||||
@ -18,7 +25,6 @@ namespace NSCSS
|
||||
continue;
|
||||
|
||||
m_mStyle.clear();
|
||||
|
||||
}
|
||||
|
||||
std::wstring CElement::GetSelector() const
|
||||
@ -176,14 +182,14 @@ namespace NSCSS
|
||||
return arElements;
|
||||
}
|
||||
|
||||
std::vector<CElement *> CElement::GetPrevElements(const std::vector<std::wstring>::const_reverse_iterator& oNodesRBegin, const std::vector<std::wstring>::const_reverse_iterator& oNodesREnd) const
|
||||
std::vector<CElement *> CElement::GetPrevElements(const std::vector<std::wstring>::const_iterator& oNodesBegin, const std::vector<std::wstring>::const_iterator& oNodesEnd) const
|
||||
{
|
||||
if (oNodesRBegin >= oNodesREnd || m_arPrevElements.empty())
|
||||
if (oNodesBegin >= oNodesEnd || m_arPrevElements.empty())
|
||||
return std::vector<CElement*>();
|
||||
|
||||
std::vector<CElement*> arElements;
|
||||
|
||||
for (std::vector<std::wstring>::const_reverse_iterator iWord = oNodesRBegin; iWord != oNodesREnd; ++iWord)
|
||||
for (std::vector<std::wstring>::const_iterator iWord = oNodesBegin; iWord != oNodesEnd; ++iWord)
|
||||
{
|
||||
if ((*iWord)[0] == L'.' && ((*iWord).find(L" ") != std::wstring::npos))
|
||||
{
|
||||
@ -195,7 +201,7 @@ namespace NSCSS
|
||||
if (oPrevElement->m_sSelector == wsClass)
|
||||
{
|
||||
arElements.push_back(oPrevElement);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesREnd);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesEnd);
|
||||
arElements.insert(arElements.end(), arTempElements.begin(), arTempElements.end());
|
||||
}
|
||||
}
|
||||
@ -208,9 +214,8 @@ namespace NSCSS
|
||||
if (oPrevElement->m_sSelector == *iWord)
|
||||
{
|
||||
arElements.push_back(oPrevElement);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesREnd);
|
||||
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesEnd);
|
||||
arElements.insert(arElements.end(), arTempElements.begin(), arTempElements.end());
|
||||
// return arElements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ namespace NSCSS
|
||||
|
||||
public:
|
||||
CElement();
|
||||
CElement(const std::wstring& wsSelector, std::map<std::wstring, std::wstring> mStyle);
|
||||
~CElement();
|
||||
|
||||
std::wstring GetSelector() const;
|
||||
@ -39,7 +40,7 @@ namespace NSCSS
|
||||
std::map<std::wstring, std::wstring> GetFullStyle(const std::vector<CNode>& arSelectors) const;
|
||||
std::map<std::wstring, std::wstring> GetFullStyle(const std::vector<std::wstring>& arNodes) const;
|
||||
std::vector<CElement *> GetNextOfKin(const std::wstring& sName, const std::vector<std::wstring>& arClasses = {}) const;
|
||||
std::vector<CElement *> GetPrevElements(const std::vector<std::wstring>::const_reverse_iterator& oNodesRBegin, const std::vector<std::wstring>::const_reverse_iterator& oNodesREnd) const;
|
||||
std::vector<CElement *> GetPrevElements(const std::vector<std::wstring>::const_iterator& oNodesBegin, const std::vector<std::wstring>::const_iterator& oNodesEnd) const;
|
||||
std::map<std::wstring, std::wstring> GetConvertStyle(const std::vector<CNode>& arNodes) const;
|
||||
|
||||
CElement *FindPrevElement(const std::wstring& sSelector) const;
|
||||
|
||||
@ -17,8 +17,7 @@ namespace NSCSS
|
||||
m_wsStyle(oNode.m_wsStyle), m_mAttributes(oNode.m_mAttributes)
|
||||
{
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
m_pCompiledStyle = new CCompiledStyle();
|
||||
*m_pCompiledStyle = *oNode.m_pCompiledStyle;
|
||||
m_pCompiledStyle = new CCompiledStyle(*oNode.m_pCompiledStyle);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -42,6 +41,23 @@ namespace NSCSS
|
||||
return m_wsName.empty() && m_wsClass.empty() && m_wsId.empty() && m_wsStyle.empty();
|
||||
}
|
||||
|
||||
bool CNode::GetAttributeValue(const std::wstring& wsAttributeName, std::wstring& wsAttributeValue) const
|
||||
{
|
||||
const std::map<std::wstring, std::wstring>::const_iterator itFound{m_mAttributes.find(wsAttributeName)};
|
||||
|
||||
if (m_mAttributes.cend() == itFound)
|
||||
return false;
|
||||
|
||||
wsAttributeValue = itFound->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::wstring CNode::GetAttributeValue(const std::wstring& wsAttributeName) const
|
||||
{
|
||||
const std::map<std::wstring, std::wstring>::const_iterator itFound{m_mAttributes.find(wsAttributeName)};
|
||||
return (m_mAttributes.cend() != itFound) ? itFound->second : std::wstring();
|
||||
}
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
void CNode::SetCompiledStyle(CCompiledStyle* pCompiledStyle)
|
||||
{
|
||||
@ -86,6 +102,9 @@ namespace NSCSS
|
||||
if(m_wsStyle != oNode.m_wsStyle)
|
||||
return m_wsStyle < oNode.m_wsStyle;
|
||||
|
||||
if (m_mAttributes.size() != oNode.m_mAttributes.size())
|
||||
return m_mAttributes.size() < oNode.m_mAttributes.size();
|
||||
|
||||
if (m_mAttributes != oNode.m_mAttributes)
|
||||
return m_mAttributes < oNode.m_mAttributes;
|
||||
|
||||
@ -94,10 +113,9 @@ namespace NSCSS
|
||||
|
||||
bool CNode::operator==(const CNode& oNode) const
|
||||
{
|
||||
return((m_wsId == oNode.m_wsId) &&
|
||||
(m_wsName == oNode.m_wsName) &&
|
||||
(m_wsClass == oNode.m_wsClass) &&
|
||||
(m_wsStyle == oNode.m_wsStyle) &&
|
||||
(m_mAttributes == oNode.m_mAttributes));
|
||||
return((m_wsName == oNode.m_wsName) &&
|
||||
(m_wsClass == oNode.m_wsClass) &&
|
||||
(m_wsStyle == oNode.m_wsStyle) &&
|
||||
(m_mAttributes == oNode.m_mAttributes));
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,11 +13,12 @@ namespace NSCSS
|
||||
class CNode
|
||||
{
|
||||
public:
|
||||
std::wstring m_wsName; // Имя тэга
|
||||
std::wstring m_wsClass; // Класс тэга
|
||||
std::wstring m_wsId; // Id тэга
|
||||
std::wstring m_wsStyle; // Стиль тэга
|
||||
std::map<std::wstring, std::wstring> m_mAttributes; // Остальные аттрибуты тэга
|
||||
std::wstring m_wsName; // Tag name
|
||||
std::wstring m_wsClass; // Tag class
|
||||
std::wstring m_wsId; // Tag id
|
||||
std::wstring m_wsStyle; // Tag style
|
||||
std::map<std::wstring, std::wstring> m_mAttributes; // Other tag attributes
|
||||
//TODO:: perhaps using std::wstring is excessive
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
CCompiledStyle *m_pCompiledStyle;
|
||||
@ -30,6 +31,9 @@ namespace NSCSS
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
bool GetAttributeValue(const std::wstring& wsAttributeName, std::wstring& wsAttributeValue) const;
|
||||
std::wstring GetAttributeValue(const std::wstring& wsAttributeName) const;
|
||||
|
||||
#ifdef CSS_CALCULATOR_WITH_XHTML
|
||||
void SetCompiledStyle(CCompiledStyle* pCompiledStyle);
|
||||
#endif
|
||||
|
||||
@ -23,7 +23,7 @@ namespace NSCSS
|
||||
case NSCSS::Inch:
|
||||
return dValue / (double)ushDPI;
|
||||
case NSCSS::Peak:
|
||||
return dValue * 6. / (double)ushDPI; // 1 дюйм = 6 пик
|
||||
return dValue * 6. / (double)ushDPI; // 1 inch = 6 peak
|
||||
case NSCSS::Twips:
|
||||
return dValue * 1440. / (double)ushDPI;
|
||||
default:
|
||||
@ -36,17 +36,17 @@ namespace NSCSS
|
||||
switch (enUnitMeasure)
|
||||
{
|
||||
case NSCSS::Point:
|
||||
return dValue * 28.3465 ; // 1 см = (2.54 / 72) пункта
|
||||
return dValue * 28.3465 ; // 1 cm = (2.54 / 72) points
|
||||
case NSCSS::Pixel:
|
||||
return dValue * (double)ushDPI / 2.54;
|
||||
case NSCSS::Millimeter:
|
||||
return dValue * 10.;
|
||||
case NSCSS::Inch:
|
||||
return dValue / 2.54; // 1 дюйм = 2.54 см
|
||||
return dValue / 2.54; // 1 inch = 2.54 cm
|
||||
case NSCSS::Peak:
|
||||
return dValue * 2.36; // 2.36 = 6 / 2.54
|
||||
case NSCSS::Twips:
|
||||
return dValue * 567.; // 1 см = (1440 / 2.54) твипов
|
||||
return dValue * 567.; // 1 cm = (1440 / 2.54) twips
|
||||
default:
|
||||
return dValue;
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace NSCSS
|
||||
switch (enUnitMeasure)
|
||||
{
|
||||
case NSCSS::Point:
|
||||
return dValue * 2.8346; // 1 мм = (25.4 / 72) пункта
|
||||
return dValue * 2.8346; // 1 mm = (25.4 / 72) points
|
||||
case NSCSS::Pixel:
|
||||
return dValue * (double)ushDPI / 25.4;
|
||||
case NSCSS::Cantimeter:
|
||||
@ -82,7 +82,7 @@ namespace NSCSS
|
||||
case NSCSS::Pixel:
|
||||
return dValue * (double)ushDPI;
|
||||
case NSCSS::Cantimeter:
|
||||
return dValue * 2.54; // 1 дюйм = 2.54 см
|
||||
return dValue * 2.54; // 1 inch = 2.54 cm
|
||||
case NSCSS::Millimeter:
|
||||
return dValue * 25.4;
|
||||
case NSCSS::Peak:
|
||||
@ -105,9 +105,9 @@ namespace NSCSS
|
||||
case NSCSS::Millimeter:
|
||||
return dValue * 0.3528;
|
||||
case NSCSS::Inch:
|
||||
return dValue / 72.; // 1 дюйм = 72 пункта
|
||||
return dValue / 72.; // 1 inch = 72 points
|
||||
case NSCSS::Peak:
|
||||
return dValue * 0.0833; // 0.0833 = 6 / 72 (1 пункт = 1/72 дюйма)
|
||||
return dValue * 0.0833; // 0.0833 = 6 / 72 (1 point = 1/72 inch)
|
||||
case NSCSS::Twips:
|
||||
return dValue * 20.; // 20 = 1440 / 72
|
||||
default:
|
||||
@ -122,7 +122,7 @@ namespace NSCSS
|
||||
case NSCSS::Point:
|
||||
return dValue * 12.; // 12 = 72 / 6
|
||||
case NSCSS::Pixel:
|
||||
return dValue * (double)ushDPI / 6.; // 1 дюйм = 6 пика
|
||||
return dValue * (double)ushDPI / 6.; // 1 inch = 6 peak
|
||||
case NSCSS::Cantimeter:
|
||||
return dValue * 0.423; // 0.423 = 2.54 / 6
|
||||
case NSCSS::Millimeter:
|
||||
@ -143,13 +143,13 @@ namespace NSCSS
|
||||
case NSCSS::Point:
|
||||
return dValue * 0.05; // 0.05 = 72. / 1440.
|
||||
case NSCSS::Pixel:
|
||||
return dValue * (double)ushDPI / 1440.; // 1 дюйм = 1440 твипов
|
||||
return dValue * (double)ushDPI / 1440.; // 1 inch = 1440 twips
|
||||
case NSCSS::Cantimeter:
|
||||
return dValue * 0.001764; // 0.001764 = 2.54 / 1440
|
||||
case NSCSS::Millimeter:
|
||||
return dValue * 0.01764;
|
||||
case NSCSS::Inch:
|
||||
return dValue * 1440.;
|
||||
return dValue / 1440.;
|
||||
case NSCSS::Peak:
|
||||
return dValue * 0.004167; // 0.004167 = 6 / 1440
|
||||
default:
|
||||
|
||||
@ -69,7 +69,10 @@ namespace NSCSS
|
||||
R_Highlight,
|
||||
R_Shd,
|
||||
R_SmallCaps,
|
||||
R_Kern
|
||||
R_Kern,
|
||||
R_Vanish,
|
||||
R_Strike,
|
||||
R_VertAlign
|
||||
} RunnerProperties;
|
||||
|
||||
typedef enum
|
||||
|
||||
@ -16,14 +16,14 @@ namespace NS_STATIC_FUNCTIONS
|
||||
std::string GetContentAsUTF8(const std::wstring& sFileName)
|
||||
{
|
||||
std::string sContent;
|
||||
// читаем файл как есть. utf-8 тут просто название.
|
||||
// read file as-is. utf-8 here is just a name.
|
||||
if(!NSFile::CFileBinary::ReadAllTextUtf8A(sFileName, sContent))
|
||||
return sContent;
|
||||
|
||||
std::string sEncoding;
|
||||
if (true)
|
||||
{
|
||||
// определяем кодировку
|
||||
//determining the encoding
|
||||
const std::string::size_type& posCharset = sContent.find("@charset");
|
||||
|
||||
if (std::string::npos != posCharset)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,11 +4,14 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include "../../../../DesktopEditor/graphics/Matrix.h"
|
||||
#include "CUnitMeasureConverter.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include "boost/blank.hpp"
|
||||
#include <boost/variant2/variant.hpp>
|
||||
|
||||
namespace NSCSS
|
||||
{
|
||||
namespace NSProperties
|
||||
@ -16,33 +19,34 @@ namespace NSCSS
|
||||
#define NEXT_LEVEL UINT_MAX, true
|
||||
|
||||
template<typename T>
|
||||
class CValue
|
||||
class CValueBase
|
||||
{
|
||||
friend class CString;
|
||||
friend class CMatrix;
|
||||
friend class CDigit;
|
||||
friend class CColor;
|
||||
friend class CEnum;
|
||||
friend class CURL;
|
||||
protected:
|
||||
CValueBase()
|
||||
: m_unLevel(0), m_bImportant(false)
|
||||
{}
|
||||
CValueBase(const CValueBase& oValue)
|
||||
: m_oValue(oValue.m_oValue), m_unLevel(oValue.m_unLevel), m_bImportant(oValue.m_bImportant)
|
||||
{}
|
||||
|
||||
CValueBase(const T& oValue, unsigned int unLevel, bool bImportant)
|
||||
: m_oValue(oValue), m_unLevel(unLevel), m_bImportant(bImportant)
|
||||
{}
|
||||
|
||||
T m_oValue;
|
||||
unsigned int m_unLevel;
|
||||
bool m_bImportant;
|
||||
public:
|
||||
CValue(const T& oValue, unsigned int unLevel, bool bImportant) :
|
||||
m_oValue(oValue), m_unLevel(unLevel), m_bImportant(bImportant)
|
||||
{
|
||||
}
|
||||
virtual bool Empty() const = 0;
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) = 0;
|
||||
|
||||
virtual bool Empty() const = 0;
|
||||
virtual void Clear() = 0;
|
||||
virtual int ToInt() const = 0;
|
||||
virtual double ToDouble() const = 0;
|
||||
virtual std::wstring ToWString() const = 0;
|
||||
|
||||
static void Equation(CValue &oFirstValue, CValue &oSecondValue)
|
||||
static void Equation(CValueBase &oFirstValue, CValueBase &oSecondValue)
|
||||
{
|
||||
if (oFirstValue.m_bImportant && !oSecondValue.m_bImportant && oFirstValue.Empty())
|
||||
oSecondValue.Clear();
|
||||
@ -57,18 +61,39 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
static bool LevelIsSame(const CValue& oFirstValue, const CValue& oSecondValue)
|
||||
static bool LevelIsSame(const CValueBase& oFirstValue, const CValueBase& oSecondValue)
|
||||
{
|
||||
return oFirstValue.m_unLevel == oSecondValue.m_unLevel;
|
||||
}
|
||||
|
||||
bool operator==(const T& oValue) const { return m_oValue == oValue; }
|
||||
bool operator>=(const T& oValue) const { return m_oValue >= oValue; }
|
||||
bool operator<=(const T& oValue) const { return m_oValue <= oValue; }
|
||||
bool operator> (const T& oValue) const { return m_oValue > oValue; }
|
||||
bool operator< (const T& oValue) const { return m_oValue < oValue; }
|
||||
friend bool operator==(const CValueBase& oLeftValue, const CValueBase& oRightValue)
|
||||
{
|
||||
if (oLeftValue.Empty() && oRightValue.Empty())
|
||||
return true;
|
||||
|
||||
virtual CValue& operator =(const CValue& oValue)
|
||||
if (( oLeftValue.Empty() && !oRightValue.Empty()) ||
|
||||
(!oLeftValue.Empty() && oRightValue.Empty()))
|
||||
return false;
|
||||
|
||||
return oLeftValue.m_oValue == oRightValue.m_oValue;
|
||||
}
|
||||
|
||||
friend bool operator!=(const CValueBase& oLeftValue, const CValueBase& oRightValue)
|
||||
{
|
||||
return !(oLeftValue == oRightValue);
|
||||
}
|
||||
|
||||
bool operator==(const T& oValue) const
|
||||
{
|
||||
return m_oValue == oValue;
|
||||
}
|
||||
|
||||
bool operator!=(const T& oValue) const
|
||||
{
|
||||
return m_oValue != oValue;
|
||||
}
|
||||
|
||||
virtual CValueBase& operator =(const CValueBase& oValue)
|
||||
{
|
||||
m_oValue = oValue.m_oValue;
|
||||
m_unLevel = oValue.m_unLevel;
|
||||
@ -77,70 +102,98 @@ namespace NSCSS
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual CValue& operator =(const T& oValue)
|
||||
virtual CValueBase& operator =(const T& oValue)
|
||||
{
|
||||
//m_oValue = oValue.m_oValue;
|
||||
m_oValue = oValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual CValue& operator+=(const CValue& oValue)
|
||||
virtual CValueBase& operator+=(const CValueBase& oValue)
|
||||
{
|
||||
if (m_unLevel > oValue.m_unLevel || (m_bImportant && !oValue.m_bImportant) || oValue.Empty())
|
||||
return *this;
|
||||
|
||||
m_oValue = oValue.m_oValue;
|
||||
m_unLevel = oValue.m_unLevel;
|
||||
m_bImportant = oValue.m_bImportant;
|
||||
*this = oValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual bool operator==(const CValue& oValue) const
|
||||
bool LessSignificantThen(const CValueBase& oValue) const
|
||||
{
|
||||
return m_oValue == oValue.m_oValue;
|
||||
}
|
||||
|
||||
virtual bool operator!=(const CValue& oValue) const
|
||||
{
|
||||
return m_oValue != oValue.m_oValue;
|
||||
return oValue.m_unLevel >= m_unLevel && (!m_bImportant || oValue.m_bImportant) && !oValue.Empty();
|
||||
}
|
||||
};
|
||||
|
||||
class CString : public CValue<std::wstring>
|
||||
template<typename T>
|
||||
class CValueOptional : public CValueBase<boost::optional<T>>
|
||||
{
|
||||
protected:
|
||||
CValueOptional() = default;
|
||||
|
||||
CValueOptional(const T& oValue, unsigned int unLevel = 0, bool bImportant = false)
|
||||
: CValueBase<boost::optional<T>>(oValue, unLevel, bImportant)
|
||||
{}
|
||||
public:
|
||||
virtual bool Empty() const override
|
||||
{
|
||||
return !this->m_oValue.has_value();
|
||||
}
|
||||
void Clear() override
|
||||
{
|
||||
this->m_oValue.reset();
|
||||
this->m_unLevel = 0;
|
||||
this->m_bImportant = false;
|
||||
}
|
||||
|
||||
bool operator==(const T& oValue) const
|
||||
{
|
||||
if (!this->m_oValue.has_value())
|
||||
return false;
|
||||
|
||||
return this->m_oValue.value() == oValue;
|
||||
}
|
||||
|
||||
virtual CValueOptional& operator=(const T& oValue)
|
||||
{
|
||||
this->m_oValue = oValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class CString : public CValueOptional<std::wstring>
|
||||
{
|
||||
public:
|
||||
CString();
|
||||
CString(const std::wstring& wsValue, unsigned int unLevel, bool bImportant = false);
|
||||
CString() = default;
|
||||
CString(const std::wstring& wsValue, unsigned int unLevel = 0, bool bImportant = false);
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) override;
|
||||
bool SetValue(const std::wstring& wsValue, const std::vector<std::wstring>& arValiableValues, unsigned int unLevel, bool bHardMode);
|
||||
bool SetValue(const std::wstring& wsValue, const std::map<std::wstring, std::wstring>& arValiableValues, unsigned int unLevel, bool bHardMode);
|
||||
|
||||
bool Empty() const override;
|
||||
void Clear() override;
|
||||
|
||||
int ToInt() const override;
|
||||
double ToDouble() const override;
|
||||
std::wstring ToWString() const override;
|
||||
|
||||
CString& operator+=(const CString& oString);
|
||||
bool operator==(const wchar_t* pValue) const;
|
||||
bool operator!=(const wchar_t* pValue) const;
|
||||
|
||||
using CValueOptional<std::wstring>::operator=;
|
||||
};
|
||||
|
||||
class CDigit : public CValue<double>
|
||||
class CDigit : public CValueOptional<double>
|
||||
{
|
||||
UnitMeasure m_enUnitMeasure;
|
||||
|
||||
double ConvertValue(double dPrevValue, UnitMeasure enUnitMeasure) const;
|
||||
public:
|
||||
CDigit();
|
||||
CDigit(double dValue);
|
||||
CDigit(double dValue, unsigned int unLevel, bool bImportant = false);
|
||||
CDigit(const double& dValue, unsigned int unLevel = 0, bool bImportant = false);
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true) override;
|
||||
bool SetValue(const CDigit& oValue);
|
||||
bool SetValue(const double& dValue, unsigned int unLevel, bool bHardMode);
|
||||
bool SetValue(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel = 0, bool bHardMode = true);
|
||||
|
||||
bool Empty() const override;
|
||||
bool Zero() const;
|
||||
void Clear() override;
|
||||
|
||||
@ -156,7 +209,7 @@ namespace NSCSS
|
||||
|
||||
UnitMeasure GetUnitMeasure() const;
|
||||
|
||||
bool operator==(const double& oValue) const;
|
||||
bool operator==(const double& dValue) const;
|
||||
bool operator==(const CDigit& oDigit) const;
|
||||
|
||||
bool operator!=(const double& oValue) const;
|
||||
@ -171,11 +224,19 @@ namespace NSCSS
|
||||
|
||||
CDigit& operator+=(const CDigit& oDigit);
|
||||
CDigit& operator-=(const CDigit& oDigit);
|
||||
CDigit& operator+=(double dValue);
|
||||
CDigit& operator-=(double dValue);
|
||||
CDigit& operator*=(double dValue);
|
||||
CDigit& operator/=(double dValue);
|
||||
CDigit& operator =(double dValue);
|
||||
CDigit& operator+=(const double& dValue);
|
||||
CDigit& operator-=(const double& dValue);
|
||||
CDigit& operator*=(const double& dValue);
|
||||
CDigit& operator/=(const double& dValue);
|
||||
|
||||
using CValueOptional<double>::operator=;
|
||||
private:
|
||||
UnitMeasure m_enUnitMeasure;
|
||||
|
||||
double ConvertValue(double dPrevValue, UnitMeasure enUnitMeasure) const;
|
||||
|
||||
template <typename Operation>
|
||||
CDigit ApplyOperation(const CDigit& oDigit, Operation operation) const;
|
||||
};
|
||||
|
||||
struct TRGB
|
||||
@ -186,6 +247,8 @@ namespace NSCSS
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
int ToInt() const;
|
||||
|
||||
bool operator==(const TRGB& oRGB) const;
|
||||
bool operator!=(const TRGB& oRGB) const;
|
||||
};
|
||||
@ -211,31 +274,58 @@ namespace NSCSS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ColorEmpty,
|
||||
ColorNone,
|
||||
ColorRGB,
|
||||
ColorHEX,
|
||||
ColorUrl,
|
||||
ColorContextStroke,
|
||||
ColorContextFill
|
||||
} ColorType;
|
||||
} EColorType;
|
||||
|
||||
class CColor : public CValue<void*>
|
||||
class CColorValue
|
||||
{
|
||||
using color_value = boost::variant2::variant<boost::blank, std::wstring, TRGB, CURL>;
|
||||
protected:
|
||||
EColorType m_eType;
|
||||
public:
|
||||
CColorValue();
|
||||
CColorValue(const CColorValue& oValue);
|
||||
CColorValue(const std::wstring& wsValue);
|
||||
CColorValue(const TRGB& oValue);
|
||||
CColorValue(const CURL& oValue);
|
||||
|
||||
EColorType GetType() const;
|
||||
|
||||
bool operator==(const CColorValue& oValue) const;
|
||||
|
||||
color_value m_oValue;
|
||||
};
|
||||
|
||||
class CColorValueContextStroke : public CColorValue
|
||||
{
|
||||
public:
|
||||
CColorValueContextStroke();
|
||||
};
|
||||
|
||||
class CColorValueContextFill : public CColorValue
|
||||
{
|
||||
public:
|
||||
CColorValueContextFill();
|
||||
};
|
||||
|
||||
class CColor : public CValueOptional<CColorValue>
|
||||
{
|
||||
public:
|
||||
CColor();
|
||||
CColor(const CColor& oColor);
|
||||
~CColor();
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true) override;
|
||||
bool SetOpacity(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true);
|
||||
|
||||
bool Empty() const override;
|
||||
bool None() const;
|
||||
bool Url() const;
|
||||
void Clear() override;
|
||||
|
||||
ColorType GetType() const;
|
||||
EColorType GetType() const;
|
||||
|
||||
double GetOpacity() const;
|
||||
|
||||
@ -249,21 +339,15 @@ namespace NSCSS
|
||||
static TRGB ConvertHEXtoRGB(const std::wstring& wsValue);
|
||||
static std::wstring ConvertRGBtoHEX(const TRGB& oValue);
|
||||
|
||||
bool operator==(const CColor& oColor) const;
|
||||
bool operator!=(const CColor& oColor) const;
|
||||
|
||||
CColor& operator =(const CColor& oColor);
|
||||
CColor& operator+=(const CColor& oColor);
|
||||
using CValueOptional<CColorValue>::operator=;
|
||||
private:
|
||||
CDigit m_oOpacity;
|
||||
ColorType m_enType;
|
||||
CDigit m_oOpacity;
|
||||
|
||||
void SetEmpty(unsigned int unLevel = 0);
|
||||
void SetRGB(unsigned char uchR, unsigned char uchG, unsigned char uchB);
|
||||
void SetRGB(const TRGB& oRGB);
|
||||
void SetHEX(const std::wstring& wsValue);
|
||||
void SetUrl(const std::wstring& wsValue);
|
||||
void SetNone();
|
||||
bool SetUrl(const std::wstring& wsValue);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@ -279,7 +363,7 @@ namespace NSCSS
|
||||
|
||||
typedef std::vector<std::pair<std::vector<double>, TransformType>> MatrixValues;
|
||||
|
||||
class CMatrix : public CValue<MatrixValues>
|
||||
class CMatrix : public CValueBase<MatrixValues>
|
||||
{
|
||||
std::vector<std::wstring> CutTransforms(const std::wstring& wsValue) const;
|
||||
public:
|
||||
@ -302,29 +386,29 @@ namespace NSCSS
|
||||
void ApplyTranform(Aggplus::CMatrix& oMatrix, Aggplus::MatrixOrder order = Aggplus::MatrixOrderPrepend) const;
|
||||
|
||||
bool operator==(const CMatrix& oMatrix) const;
|
||||
CMatrix& operator+=(const CMatrix& oMatrix);
|
||||
CMatrix& operator-=(const CMatrix& oMatrix);
|
||||
|
||||
using CValueBase<MatrixValues>::operator=;
|
||||
};
|
||||
|
||||
class CEnum : public CValue<int>
|
||||
class CEnum : public CValueOptional<int>
|
||||
{
|
||||
std::map<std::wstring, int> m_mMap;
|
||||
public:
|
||||
CEnum();
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) override;
|
||||
void SetMapping(const std::map<std::wstring, int>& mMap, int nDefaulvalue = -1);
|
||||
|
||||
bool Empty() const override;
|
||||
void Clear() override;
|
||||
|
||||
CEnum &operator =(int nValue);
|
||||
|
||||
bool operator==(int nValue) const;
|
||||
bool operator!=(int nValue) const;
|
||||
|
||||
int ToInt() const override;
|
||||
|
||||
using CValueOptional<int>::operator=;
|
||||
private:
|
||||
double ToDouble() const override;
|
||||
std::wstring ToWString() const override;
|
||||
|
||||
int m_nDefaultValue;
|
||||
std::map<std::wstring, int> m_mMap;
|
||||
};
|
||||
|
||||
// PROPERTIES
|
||||
@ -371,6 +455,7 @@ namespace NSCSS
|
||||
const CEnum& GetWhiteSpace() const;
|
||||
|
||||
bool Empty() const;
|
||||
void Clear();
|
||||
|
||||
CDisplay& operator+=(const CDisplay& oDisplay);
|
||||
bool operator==(const CDisplay& oDisplay) const;
|
||||
@ -472,7 +557,7 @@ namespace NSCSS
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
@ -524,7 +609,7 @@ namespace NSCSS
|
||||
|
||||
bool SetSides(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetCollapse(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
@ -532,28 +617,28 @@ namespace NSCSS
|
||||
//Left Side
|
||||
bool SetLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Top Side
|
||||
bool SetTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Right Side
|
||||
bool SetRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Bottom Side
|
||||
bool SetBottomSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
@ -616,6 +701,30 @@ namespace NSCSS
|
||||
bool operator==(const TTextDecoration& oTextDecoration) const;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Baseline,
|
||||
Sub,
|
||||
Super,
|
||||
Percentage,
|
||||
Length
|
||||
} EBaselineShift;
|
||||
|
||||
class CBaselineShift
|
||||
{
|
||||
CEnum m_eType;
|
||||
CDigit m_oValue;
|
||||
public:
|
||||
CBaselineShift();
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
EBaselineShift GetType() const;
|
||||
double GetValue() const;
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
};
|
||||
|
||||
class CText
|
||||
{
|
||||
public:
|
||||
@ -623,11 +732,12 @@ namespace NSCSS
|
||||
|
||||
static void Equation(CText &oFirstText, CText &oSecondText);
|
||||
|
||||
bool SetIndent (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetAlign (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetDecoration(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHighlight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetIndent (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetAlign (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetDecoration (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHighlight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBaselineShift (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetIndent() const;
|
||||
const CString& GetAlign() const;
|
||||
@ -635,6 +745,9 @@ namespace NSCSS
|
||||
const CColor& GetColor() const;
|
||||
const CColor& GetHighlight() const;
|
||||
|
||||
EBaselineShift GetBaselineShiftType() const;
|
||||
double GetBaselineShiftValue() const;
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
bool Underline() const;
|
||||
@ -644,6 +757,7 @@ namespace NSCSS
|
||||
CText& operator+=(const CText& oText);
|
||||
bool operator==(const CText& oText) const;
|
||||
private:
|
||||
CBaselineShift m_oBaselineShift;
|
||||
TTextDecoration m_oDecoration;
|
||||
CDigit m_oIndent;
|
||||
CString m_oAlign;
|
||||
@ -666,13 +780,15 @@ namespace NSCSS
|
||||
|
||||
bool SetValues (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
bool SetValues (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void UpdateAll (const double& dParentFontSize, const double& dCoreFontSize);
|
||||
void UpdateTop (const double& dParentFontSize, const double& dCoreFontSize);
|
||||
@ -685,6 +801,9 @@ namespace NSCSS
|
||||
const CDigit& GetBottom() const;
|
||||
const CDigit& GetLeft () const;
|
||||
|
||||
bool GetAfterAutospacing () const;
|
||||
bool GetBeforeAutospacing() const;
|
||||
|
||||
bool Empty() const;
|
||||
bool Zero() const;
|
||||
|
||||
@ -712,7 +831,7 @@ namespace NSCSS
|
||||
|
||||
bool SetValue (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLineHeight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetFamily (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStretch (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
@ -745,7 +864,7 @@ namespace NSCSS
|
||||
CDigit m_oSize;
|
||||
CDigit m_oLineHeight;
|
||||
CString m_oFamily;
|
||||
//TODO:: возможно стоит перейти в слудующих переменных на enum
|
||||
//TODO:: perhaps should switch to enum for the following variables
|
||||
CString m_oStretch;
|
||||
CString m_oStyle;
|
||||
CString m_oVariant;
|
||||
@ -762,6 +881,12 @@ namespace NSCSS
|
||||
bool SetFooter (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeader (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
bool SetWidth (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeight (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetMargin (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetFooter (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeader (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetWidth() const;
|
||||
const CDigit& GetHeight() const;
|
||||
const CIndent& GetMargin() const;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#include "CDocumentStyle.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
#include <wchar.h>
|
||||
#include <math.h>
|
||||
@ -9,7 +8,7 @@
|
||||
#include <list>
|
||||
|
||||
#define DEFAULT_LINEHEIGHT 240
|
||||
#define LINEHEIGHTSCALE 10 // Значение LineHeight в OOXML должно быть в 10 раз больше чем указано в стиле
|
||||
#define LINEHEIGHTSCALE 10 // LineHeight value in OOXML must be 10 times larger than specified in style
|
||||
|
||||
#define VALUE_TO_INT(value, unit_measure) \
|
||||
(NSCSS::UnitMeasure::None != value.GetUnitMeasure()) ? \
|
||||
@ -22,6 +21,11 @@ namespace NSCSS
|
||||
: m_oStyle(oStyle), m_bIsPStyle(bIsPStyle)
|
||||
{}
|
||||
|
||||
void CStyleUsed::SetFinalId(const std::wstring& wsFinalId)
|
||||
{
|
||||
m_wsFinalId = wsFinalId;
|
||||
}
|
||||
|
||||
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());
|
||||
@ -57,19 +61,14 @@ namespace NSCSS
|
||||
m_oStyle == oUsedStyle.m_oStyle;
|
||||
}
|
||||
|
||||
std::wstring CStyleUsed::getId()
|
||||
std::wstring CStyleUsed::GetId() const
|
||||
{
|
||||
if (m_bIsPStyle)
|
||||
return m_oStyle.GetId();
|
||||
|
||||
return m_oStyle.GetId() + L"-c";
|
||||
return m_wsFinalId;
|
||||
}
|
||||
|
||||
CDocumentStyle::CDocumentStyle() : m_arStandardStyles(Names_Standard_Styles)
|
||||
{
|
||||
for (const std::wstring& oNameStandardStyle : Names_Standard_Styles)
|
||||
m_arStandardStyles.push_back(oNameStandardStyle + L"-c");
|
||||
}
|
||||
CDocumentStyle::CDocumentStyle()
|
||||
: m_arStandardStyles(Names_Standard_Styles)
|
||||
{}
|
||||
|
||||
CDocumentStyle::~CDocumentStyle()
|
||||
{
|
||||
@ -85,7 +84,7 @@ namespace NSCSS
|
||||
|
||||
std::wstring CDocumentStyle::GetIdAndClear()
|
||||
{
|
||||
std::wstring sId = m_sId;
|
||||
const std::wstring sId = m_sId;
|
||||
Clear();
|
||||
return sId;
|
||||
}
|
||||
@ -110,10 +109,10 @@ namespace NSCSS
|
||||
m_sId = sId;
|
||||
}
|
||||
|
||||
void CDocumentStyle::CombineStandardStyles(const std::vector<std::wstring>& arStandartedStyles, CXmlElement& oElement)
|
||||
bool CDocumentStyle::CombineStandardStyles(const std::vector<std::wstring>& arStandartedStyles, CXmlElement& oElement)
|
||||
{
|
||||
if (arStandartedStyles.empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
std::vector<std::wstring> arStyles;
|
||||
for (const std::wstring& sStyleName : arStandartedStyles)
|
||||
@ -123,7 +122,7 @@ namespace NSCSS
|
||||
}
|
||||
|
||||
if (arStyles.empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
std::wstring sId;
|
||||
for (std::vector<std::wstring>::const_reverse_iterator iStyleName = arStyles.rbegin(); iStyleName != arStyles.rend(); ++iStyleName)
|
||||
@ -142,18 +141,25 @@ namespace NSCSS
|
||||
|
||||
oElement.AddBasicProperties(BProperties::B_Name, sId);
|
||||
oElement.AddBasicProperties(BProperties::B_StyleId, sId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDocumentStyle::CreateStandardStyle(const std::wstring& sNameStyle, CXmlElement& oElement)
|
||||
bool CDocumentStyle::CreateStandardStyle(const std::wstring& sNameStyle, CXmlElement& oElement)
|
||||
{
|
||||
if (std::find(m_arStandardStyles.begin(), m_arStandardStyles.end(), sNameStyle) != m_arStandardStyles.end())
|
||||
{
|
||||
oElement.CreateDefaultElement(sNameStyle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CDocumentStyle::ConvertStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oElement, bool bIsPStyle)
|
||||
bool CDocumentStyle::ConvertStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oElement, bool bIsPStyle)
|
||||
{
|
||||
if (oStyle.GetId().empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
std::wstring sName = oStyle.GetId();
|
||||
const size_t posPoint = sName.find(L'.');
|
||||
@ -183,25 +189,25 @@ namespace NSCSS
|
||||
for (std::wstring& sParentName : arParentsName)
|
||||
sParentName += L"-c";
|
||||
|
||||
bool bResult{false};
|
||||
|
||||
if (!arParentsName.empty())
|
||||
{
|
||||
CombineStandardStyles(arParentsName, oParentStyle);
|
||||
bResult = CombineStandardStyles(arParentsName, oParentStyle);
|
||||
|
||||
if (!oParentStyle.Empty())
|
||||
{
|
||||
oParentStyle.AddBasicProperties(BProperties::B_BasedOn, L"normal");
|
||||
oParentStyle.AddBasicProperties(BProperties::B_StyleId, L"(" + oParentStyle.GetStyleId() + L")");
|
||||
oParentStyle.AddBasicProperties(BProperties::B_StyleId, oParentStyle.GetStyleId());
|
||||
if (!bIsPStyle)
|
||||
{
|
||||
oParentStyle.AddBasicProperties(BProperties::B_StyleId, oParentStyle.GetStyleId() + L"-c");
|
||||
oParentStyle.AddBasicProperties(BProperties::B_Type, L"character");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CXmlElement oStandardXmlElement;
|
||||
if (std::find(m_arStandardStyles.begin(), m_arStandardStyles.end(), sName) != m_arStandardStyles.end())
|
||||
CreateStandardStyle(sName, oStandardXmlElement);
|
||||
if (CreateStandardStyle(sName, oStandardXmlElement))
|
||||
bResult = true;
|
||||
|
||||
if (oStandardXmlElement.Empty() && !oParentStyle.Empty())
|
||||
{
|
||||
@ -221,7 +227,7 @@ namespace NSCSS
|
||||
if (oStyle.Empty())
|
||||
{
|
||||
m_sId = sParentsStyleID;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
oElement.AddBasicProperties(BProperties::B_BasedOn, sParentsStyleID);
|
||||
@ -234,7 +240,7 @@ namespace NSCSS
|
||||
if (oStyle.Empty())
|
||||
{
|
||||
m_sId = sStandPlusParent;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
oElement.AddBasicProperties(BProperties::B_BasedOn, sStandPlusParent);
|
||||
}
|
||||
@ -258,7 +264,7 @@ namespace NSCSS
|
||||
if (oStyle.Empty())
|
||||
{
|
||||
m_sId = sStandPlusParent;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
oElement.AddBasicProperties(BProperties::B_BasedOn, oTempElement.GetStyleId());
|
||||
}
|
||||
@ -281,7 +287,7 @@ namespace NSCSS
|
||||
if (oStyle.Empty())
|
||||
{
|
||||
m_sId = sStandartStyleID;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
oElement.AddBasicProperties(BProperties::B_BasedOn, sStandartStyleID);
|
||||
}
|
||||
@ -289,7 +295,7 @@ namespace NSCSS
|
||||
if (oStyle.Empty() && oElement.Empty())
|
||||
{
|
||||
m_sId = L"normal";
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
m_sId = oStyle.GetId();
|
||||
@ -302,15 +308,19 @@ namespace NSCSS
|
||||
oElement.AddBasicProperties(BProperties::B_Name, m_sId);
|
||||
oElement.AddBasicProperties(BProperties::B_Type, bIsPStyle ? L"paragraph" : L"character");
|
||||
oElement.AddBasicProperties(BProperties::B_CustomStyle, L"1");
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void CDocumentStyle::SetPStyle (const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite)
|
||||
bool CDocumentStyle::SetPStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite)
|
||||
{
|
||||
bool bResult{false};
|
||||
|
||||
if (!bIsLite)
|
||||
ConvertStyle(oStyle, oXmlElement, true);
|
||||
bResult = ConvertStyle(oStyle, oXmlElement, true);
|
||||
|
||||
if (oStyle.Empty())
|
||||
return;
|
||||
return bResult;
|
||||
|
||||
const bool bInTable{oStyle.HaveThisParent(L"table")};
|
||||
|
||||
@ -341,14 +351,14 @@ namespace NSCSS
|
||||
sSpacingValue.reserve(128);
|
||||
|
||||
if (!oStyle.m_oMargin.GetTop().Empty() && !oStyle.m_oMargin.GetTop().Zero())
|
||||
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"0\"";
|
||||
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"1\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"0\"";
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"1\"";
|
||||
|
||||
if (!oStyle.m_oMargin.GetBottom().Empty() && !oStyle.m_oMargin.GetBottom().Zero())
|
||||
sSpacingValue += L" w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"0\"";
|
||||
sSpacingValue += L" w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"1\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"0\"";
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"1\"";
|
||||
|
||||
if (!oStyle.m_oFont.GetLineHeight().Empty() && !oStyle.m_oFont.GetLineHeight().Zero())
|
||||
{
|
||||
@ -390,6 +400,8 @@ namespace NSCSS
|
||||
SetBorderStyle(oStyle, oXmlElement, PProperties::P_LeftBorder);
|
||||
}
|
||||
}
|
||||
|
||||
return bResult || !oXmlElement.Empty();
|
||||
}
|
||||
|
||||
void CDocumentStyle::SetBorderStyle(const CCompiledStyle &oStyle, CXmlElement &oXmlElement, const PProperties &enBorderProperty)
|
||||
@ -441,7 +453,7 @@ namespace NSCSS
|
||||
int nWidth = static_cast<int>(std::round(oBorder.GetWidth().ToDouble(Point) * 8.));
|
||||
|
||||
if (L"double" == wsStyle)
|
||||
nWidth /= 3; // в ooxml double граница формируется из трёх линий
|
||||
nWidth /= 3; // in ooxml double border is formed from three lines
|
||||
|
||||
if (nWidth <= 3)
|
||||
nWidth = 2;
|
||||
@ -473,16 +485,18 @@ namespace NSCSS
|
||||
return L"w:val=\"" + wsStyle + L"\" w:sz=\"" + std::to_wstring(nWidth) + + L"\" w:space=\"" + std::to_wstring(nSpace) + L"\" w:color=\"" + wsColor + L"\"";
|
||||
}
|
||||
|
||||
void CDocumentStyle::SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite)
|
||||
bool CDocumentStyle::SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite)
|
||||
{
|
||||
bool bResult{false};
|
||||
|
||||
if (!bIsLite)
|
||||
ConvertStyle(oStyle, oXmlElement, false);
|
||||
bResult = ConvertStyle(oStyle, oXmlElement, false);
|
||||
|
||||
if (oStyle.Empty() && oXmlElement.Empty())
|
||||
return;
|
||||
return bResult;
|
||||
|
||||
if (!oStyle.m_oFont.GetSize().Empty())
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Sz, std::to_wstring(static_cast<int>(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Point) * 2. * oStyle.m_oTransform.GetMatrix().GetFinalValue().sy() + 0.5))); // Значения шрифта увеличивает на 2
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Sz, std::to_wstring(static_cast<int>(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Point) * 2. * oStyle.m_oTransform.GetMatrix().GetFinalValue().sy() + 0.5))); // Font value is multiplied by 2
|
||||
|
||||
if (oStyle.m_oText.GetDecoration().m_oLine.Underline())
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_U, (!oStyle.m_oText.GetDecoration().m_oStyle.Empty()) ? oStyle.m_oText.GetDecoration().m_oStyle.ToWString() : L"single");
|
||||
@ -509,10 +523,25 @@ namespace NSCSS
|
||||
else if (L"serif" == wsFontFamily)
|
||||
wsFontFamily = L"Times New Roman";
|
||||
|
||||
if (oStyle.m_oDisplay.GetDisplay() == L"none")
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Vanish, L"true");
|
||||
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_RFonts, oStyle.m_oFont.GetFamily().ToWString());
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_I, oStyle.m_oFont.GetStyle().ToWString());
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_B, oStyle.m_oFont.GetWeight().ToWString());
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_SmallCaps, oStyle.m_oFont.GetVariant().ToWString());
|
||||
|
||||
if (oStyle.m_oText.LineThrough())
|
||||
{
|
||||
if (L"double" == oStyle.m_oText.GetDecoration().m_oStyle.ToWString())
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Strike, L"dstrike");
|
||||
else
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Strike, L"strike");
|
||||
}
|
||||
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_VertAlign, oStyle.m_oDisplay.GetVAlign().ToWString());
|
||||
|
||||
return bResult || !oXmlElement.Empty();
|
||||
}
|
||||
|
||||
bool CDocumentStyle::WriteRStyle(const NSCSS::CCompiledStyle& oStyle)
|
||||
@ -528,16 +557,16 @@ namespace NSCSS
|
||||
|
||||
if (oItem != m_arStyleUsed.end())
|
||||
{
|
||||
m_sId = (*oItem).getId();
|
||||
m_sId = (*oItem).GetId();
|
||||
return true;
|
||||
}
|
||||
|
||||
CXmlElement oXmlElement;
|
||||
SetRStyle(oStyle, oXmlElement);
|
||||
|
||||
if (oXmlElement.Empty())
|
||||
if (!SetRStyle(oStyle, oXmlElement))
|
||||
return false;
|
||||
|
||||
structStyle.SetFinalId(m_sId);
|
||||
m_arStyleUsed.push_back(structStyle);
|
||||
m_sStyle += oXmlElement.GetRStyle();
|
||||
|
||||
@ -590,16 +619,16 @@ namespace NSCSS
|
||||
|
||||
if (oItem != m_arStyleUsed.end())
|
||||
{
|
||||
m_sId = (*oItem).getId();
|
||||
m_sId = (*oItem).GetId();
|
||||
return true;
|
||||
}
|
||||
|
||||
CXmlElement oXmlElement;
|
||||
SetPStyle(oStyle, oXmlElement);
|
||||
|
||||
if (oXmlElement.Empty())
|
||||
if (!SetPStyle(oStyle, oXmlElement))
|
||||
return false;
|
||||
|
||||
structStyle.SetFinalId(m_sId);
|
||||
m_arStyleUsed.push_back(structStyle);
|
||||
m_sStyle += oXmlElement.GetPStyle();
|
||||
|
||||
|
||||
@ -12,16 +12,19 @@ namespace NSCSS
|
||||
{
|
||||
CCompiledStyle m_oStyle;
|
||||
bool m_bIsPStyle;
|
||||
std::wstring m_wsFinalId;
|
||||
|
||||
public:
|
||||
CStyleUsed(const CCompiledStyle& oStyle, bool bIsPStyle);
|
||||
|
||||
void SetFinalId(const std::wstring& wsFinalId);
|
||||
|
||||
bool operator==(const CStyleUsed& oUsedStyle) const;
|
||||
|
||||
std::wstring getId();
|
||||
std::wstring GetId() const;
|
||||
};
|
||||
|
||||
static const std::vector<std::wstring> Names_Standard_Styles = {L"a", L"li", L"h1", L"h2", L"h3", L"h4", L"h5", L"h6",L"p", L"div"};
|
||||
static const std::vector<std::wstring> Names_Standard_Styles = {L"a", L"a-c", L"li", L"h1", L"h2", L"h3", L"h4", L"h5", L"h6", L"h1-c", L"h2-c", L"h3-c", L"h4-c", L"h5-c", L"h6-c"};
|
||||
|
||||
class CSSCALCULATOR_EXPORT CDocumentStyle
|
||||
{
|
||||
@ -36,12 +39,12 @@ namespace NSCSS
|
||||
std::wstring m_sStyle;
|
||||
std::wstring m_sId;
|
||||
|
||||
void CombineStandardStyles(const std::vector<std::wstring>& arStandartedStyles, CXmlElement& oElement);
|
||||
void CreateStandardStyle (const std::wstring& sNameStyle, CXmlElement& oElement);
|
||||
void ConvertStyle (const NSCSS::CCompiledStyle& oStyle, CXmlElement& oElement, bool bIsPStyle);
|
||||
bool CombineStandardStyles(const std::vector<std::wstring>& arStandartedStyles, CXmlElement& oElement);
|
||||
bool CreateStandardStyle (const std::wstring& sNameStyle, CXmlElement& oElement);
|
||||
bool ConvertStyle (const NSCSS::CCompiledStyle& oStyle, CXmlElement& oElement, bool bIsPStyle);
|
||||
|
||||
void SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite = false);
|
||||
void SetPStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite = false);
|
||||
bool SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite = false);
|
||||
bool SetPStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite = false);
|
||||
|
||||
void SetBorderStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, const PProperties& enBorderProperty);
|
||||
public:
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
#include <cwctype>
|
||||
#include <functional>
|
||||
|
||||
#include <iostream>
|
||||
#include "../ConstValues.h"
|
||||
|
||||
#define DEFAULTFONTNAME L"Times New Roman"
|
||||
@ -67,7 +66,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h1-c");
|
||||
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"0");
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
}
|
||||
else if (sNameDefaultElement == L"h2")
|
||||
{
|
||||
@ -78,7 +77,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h2-c");
|
||||
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"1");
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
}
|
||||
else if (sNameDefaultElement == L"h3")
|
||||
{
|
||||
@ -89,7 +88,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h3-c");
|
||||
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"2");
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
}
|
||||
else if (sNameDefaultElement == L"h4")
|
||||
{
|
||||
@ -100,7 +99,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h4-c");
|
||||
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"3");
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
}
|
||||
else if (sNameDefaultElement == L"h5")
|
||||
{
|
||||
@ -111,7 +110,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h5-c");
|
||||
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"4");
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
|
||||
}
|
||||
else if (sNameDefaultElement == L"h6")
|
||||
@ -123,13 +122,13 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h6-c");
|
||||
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"5");
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
}
|
||||
else if (sNameDefaultElement == L"h1-c")
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"h1-c");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Title 1 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Heading 1 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h1");
|
||||
@ -142,7 +141,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"h2-c");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Title 2 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Heading 2 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
|
||||
@ -155,7 +154,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"h3-c");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Title 3 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Heading 3 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
|
||||
@ -168,7 +167,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"h4-c");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Title 4 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Heading 4 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
|
||||
@ -181,7 +180,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"h5-c");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Title 5 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Heading 5 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
|
||||
@ -194,7 +193,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"h6-c");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Title 6 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Heading 6 Sign");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
|
||||
@ -473,6 +472,25 @@ std::wstring CXmlElement::ConvertRStyle(bool bIsLite) const
|
||||
sRStyle += L"<w:kern w:val=\"" + oItem.second + L"\"/>";
|
||||
break;
|
||||
}
|
||||
case CSSProperties::RunnerProperties::R_Vanish:
|
||||
{
|
||||
if (oItem.second == L"true")
|
||||
sRStyle += L"<w:vanish/>";
|
||||
break;
|
||||
}
|
||||
case CSSProperties::RunnerProperties::R_Strike:
|
||||
{
|
||||
sRStyle += L"<w:" + oItem.second + L"/>";
|
||||
break;
|
||||
}
|
||||
case CSSProperties::RunnerProperties::R_VertAlign:
|
||||
{
|
||||
if (L"top" == oItem.second)
|
||||
sRStyle += L"<w:vertAlign w:val=\"superscript\"/>";
|
||||
else if (L"bottom" == oItem.second)
|
||||
sRStyle += L"<w:vertAlign w:val=\"subscript\"/>";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -371,10 +371,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
std::cout << "-----END-----" << std::endl;
|
||||
|
||||
// Тесты багов
|
||||
// Bug tests
|
||||
/*
|
||||
// Стандарный katana_parser не считывает @page
|
||||
// Также, если заккомитить всё, что было до тестов бага, то всё будет крашиться с ошибкой "-1073741819"
|
||||
// Standard katana_parser doesn't read @page
|
||||
// Also, if you uncomment everything before bug tests, it will crash with error "-1073741819"
|
||||
|
||||
const char* css = "#page{margin:10px; padding:5pt} "
|
||||
"@page{color:white;}";
|
||||
@ -382,7 +382,7 @@ int main(int argc, char *argv[])
|
||||
katana_dump_output(output);
|
||||
katana_destroy_output(output);
|
||||
|
||||
// Из-за того, что стандарный katana_parser не считывает @page, не считывает и CCssCalculator
|
||||
// Because standard katana_parser doesn't read @page, CCssCalculator doesn't read it either
|
||||
|
||||
std::wstring sFilePath = NSFile::GetProcessDirectory() + L"../../../../cssFiles/test.css";
|
||||
NSCSS::CCssCalculator oCSS;
|
||||
|
||||
@ -10,14 +10,14 @@ base_directory = os.getcwd()
|
||||
|
||||
if not base.is_dir("gumbo-parser"):
|
||||
base.cmd("git", ["clone", "https://github.com/google/gumbo-parser.git"])
|
||||
base.cmd_in_dir("gumbo-parser", "git", ["checkout", "aa91b27b02c0c80c482e24348a457ed7c3c088e0"])
|
||||
base.cmd_in_dir("gumbo-parser", "git", ["checkout", "aa91b27b02c0c80c482e24348a457ed7c3c088e0", "--quiet"])
|
||||
|
||||
# fix gumbo
|
||||
base.replaceInFile(base_directory + "/gumbo-parser/src/tag.c", "isspace(*c)", "isspace((unsigned char)*c)")
|
||||
|
||||
if not base.is_dir("katana-parser"):
|
||||
base.cmd("git", ["clone", "https://github.com/jasenhuang/katana-parser.git"])
|
||||
base.cmd_in_dir("katana-parser", "git", ["checkout", "be6df458d4540eee375c513958dcb862a391cdd1"])
|
||||
base.cmd_in_dir("katana-parser", "git", ["checkout", "be6df458d4540eee375c513958dcb862a391cdd1", "--quiet"])
|
||||
|
||||
# fix katana
|
||||
base.replaceInFileUtf8(base_directory + "/katana-parser/src/tokenizer.c", "static inline bool katana_is_html_space(char c);", "static inline bool2 katana_is_html_space(char c);")
|
||||
|
||||
@ -7,4 +7,5 @@ core_windows:INCLUDEPATH += $$PWD/gumbo-parser/visualc/include
|
||||
HEADERS += $$files($$PWD/gumbo-parser/src/*.h, true) \
|
||||
$$PWD/htmltoxhtml.h
|
||||
|
||||
SOURCES += $$files($$PWD/gumbo-parser/src/*.c, true)
|
||||
SOURCES += $$files($$PWD/gumbo-parser/src/*.c, true) \
|
||||
$$PWD/htmltoxhtml.cpp
|
||||
|
||||
657
Common/3dParty/html/htmltoxhtml.cpp
Normal file
657
Common/3dParty/html/htmltoxhtml.cpp
Normal file
@ -0,0 +1,657 @@
|
||||
#include "htmltoxhtml.h"
|
||||
|
||||
#include <map>
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gumbo-parser/src/gumbo.h"
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../../../DesktopEditor/common/StringBuilder.h"
|
||||
#include "../../../UnicodeConverter/UnicodeConverter.h"
|
||||
#include "../../../HtmlFile2/src/StringFinder.h"
|
||||
|
||||
namespace HTML
|
||||
{
|
||||
#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|";
|
||||
static std::string special_handling = "|html|body|";
|
||||
static std::string treat_like_inline = "|p|";
|
||||
|
||||
static std::vector<std::string> html_tags = {"div","span","a","img","p","h1","h2","h3","h4","h5","h6",
|
||||
"ul", "ol", "li","td","tr","table","thead","tbody","tfoot","th",
|
||||
"br","form","input","button","section","nav","header","footer",
|
||||
"main","figure","figcaption","strong","em","i", "b", "u","pre",
|
||||
"code","blockquote","hr","script","link","meta","style","title",
|
||||
"head","body","html","legend","optgroup","option","select","dl",
|
||||
"dt","dd","time","data","abbr","address","area","base","bdi",
|
||||
"bdo","cite","col","iframe","video","source","track","textarea",
|
||||
"label","fieldset","colgroup","del","ins","details","summary",
|
||||
"dialog","embed","kbd","map","mark","menu","meter","object",
|
||||
"output","param","progress","q","samp","small","sub","sup","var",
|
||||
"wbr","acronym","applet","article","aside","audio","basefont",
|
||||
"bgsound","big","blink","canvas","caption","center","command",
|
||||
"comment","datalist","dfn","dir","font","frame","frameset",
|
||||
"hgroup","isindex","keygen","marquee","nobr","noembed","noframes",
|
||||
"noscript","plaintext","rp","rt","ruby","s","strike","tt","xmp"};
|
||||
|
||||
static std::vector<std::string> unchecked_nodes_new = {"svg"};
|
||||
|
||||
static void replace_all(std::string& s, const std::string& s1, const std::string& s2)
|
||||
{
|
||||
size_t pos = s.find(s1);
|
||||
while(pos != std::string::npos)
|
||||
{
|
||||
s.replace(pos, s1.length(), s2);
|
||||
pos = s.find(s1, pos + s2.length());
|
||||
}
|
||||
}
|
||||
|
||||
static bool NodeIsUnprocessed(const std::string& sTagName)
|
||||
{
|
||||
return "xml" == sTagName;
|
||||
}
|
||||
|
||||
static bool IsUnckeckedNodes(const std::string& sValue)
|
||||
{
|
||||
return unchecked_nodes_new.end() != std::find(unchecked_nodes_new.begin(), unchecked_nodes_new.end(), sValue);
|
||||
}
|
||||
|
||||
static std::string Base64ToString(const std::string& sContent, const std::string& sCharset)
|
||||
{
|
||||
std::string sRes;
|
||||
int nSrcLen = (int)sContent.length();
|
||||
int nDecodeLen = NSBase64::Base64DecodeGetRequiredLength(nSrcLen);
|
||||
BYTE* pData = new BYTE[nDecodeLen];
|
||||
if (TRUE == NSBase64::Base64Decode(sContent.c_str(), nSrcLen, pData, &nDecodeLen))
|
||||
{
|
||||
std::wstring sConvert;
|
||||
if(!sCharset.empty() && NSStringFinder::Equals<std::string>("utf-8", sCharset))
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sConvert = oConverter.toUnicode(reinterpret_cast<char *>(pData), (unsigned)nDecodeLen, sCharset.data());
|
||||
}
|
||||
sRes = sConvert.empty() ? std::string(reinterpret_cast<char *>(pData), nDecodeLen) : U_TO_UTF8(sConvert);
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
return sRes;
|
||||
}
|
||||
|
||||
static std::string QuotedPrintableDecode(const std::string& sContent, std::string& sCharset)
|
||||
{
|
||||
NSStringUtils::CStringBuilderA sRes;
|
||||
size_t ip = 0;
|
||||
size_t i = sContent.find('=');
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
size_t nIgnore = 12;
|
||||
std::string charset = sContent.substr(0, nIgnore);
|
||||
if(charset == "=00=00=FE=FF")
|
||||
sCharset = "UTF-32BE";
|
||||
else if(charset == "=FF=FE=00=00")
|
||||
sCharset = "UTF-32LE";
|
||||
else if(charset == "=2B=2F=76=38" || charset == "=2B=2F=76=39" ||
|
||||
charset == "=2B=2F=76=2B" || charset == "=2B=2F=76=2F")
|
||||
sCharset = "UTF-7";
|
||||
else if(charset == "=DD=73=66=73")
|
||||
sCharset = "UTF-EBCDIC";
|
||||
else if(charset == "=84=31=95=33")
|
||||
sCharset = "GB-18030";
|
||||
else
|
||||
{
|
||||
nIgnore -= 3;
|
||||
charset.erase(nIgnore);
|
||||
if(charset == "=EF=BB=BF")
|
||||
sCharset = "UTF-8";
|
||||
else if(charset == "=F7=64=4C")
|
||||
sCharset = "UTF-1";
|
||||
else if(charset == "=0E=FE=FF")
|
||||
sCharset = "SCSU";
|
||||
else if(charset == "=FB=EE=28")
|
||||
sCharset = "BOCU-1";
|
||||
else
|
||||
{
|
||||
nIgnore -= 3;
|
||||
charset.erase(nIgnore);
|
||||
if(charset == "=FE=FF")
|
||||
sCharset = "UTF-16BE";
|
||||
else if(charset == "=FF=FE")
|
||||
sCharset = "UTF-16LE";
|
||||
else
|
||||
nIgnore -= 6;
|
||||
}
|
||||
}
|
||||
|
||||
ip = nIgnore;
|
||||
i = sContent.find('=', ip);
|
||||
}
|
||||
|
||||
while(i != std::string::npos && i + 2 < sContent.length())
|
||||
{
|
||||
sRes.WriteString(sContent.c_str() + ip, i - ip);
|
||||
std::string str = sContent.substr(i + 1, 2);
|
||||
if(str.front() == '\n' || str.front() == '\r')
|
||||
{
|
||||
char ch = str[1];
|
||||
if(ch != '\n' && ch != '\r')
|
||||
sRes.WriteString(&ch, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* err;
|
||||
char ch = (int)strtol(str.data(), &err, 16);
|
||||
if(*err)
|
||||
sRes.WriteString('=' + str);
|
||||
else
|
||||
sRes.WriteString(&ch, 1);
|
||||
}
|
||||
ip = i + 3;
|
||||
i = sContent.find('=', ip);
|
||||
}
|
||||
if(ip != std::string::npos)
|
||||
sRes.WriteString(sContent.c_str() + ip);
|
||||
return sRes.GetData();
|
||||
}
|
||||
|
||||
static std::string mhtTohtml(const std::string& sFileContent);
|
||||
|
||||
static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::string>& sRes, NSStringUtils::CStringBuilderA& oRes)
|
||||
{
|
||||
size_t unContentPosition = 0, unCharsetBegin = 0, unCharsetEnd = std::string::npos;
|
||||
|
||||
NSStringFinder::TFoundedData<char> oData;
|
||||
|
||||
// Content-Type
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
|
||||
const std::string sContentType{oData.m_sValue};
|
||||
|
||||
if (sContentType.empty())
|
||||
return;
|
||||
|
||||
if (NSStringFinder::Equals(sContentType, "multipart/alternative"))
|
||||
{
|
||||
oRes.WriteString(mhtTohtml(sMhtContent.substr(oData.m_unEndPosition, sMhtContent.length() - oData.m_unEndPosition)));
|
||||
return;
|
||||
}
|
||||
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
unCharsetBegin = oData.m_unEndPosition;
|
||||
|
||||
// name
|
||||
// std::string sName = NSStringFinder::FindProperty(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
|
||||
// unContentPosition = std::max(unContentPosition, unLastPosition);
|
||||
|
||||
// Content-Location
|
||||
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::FindProperty(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
|
||||
std::string sContentID{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
{
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
unCharsetEnd = std::min(unCharsetEnd, oData.m_unBeginPosition);
|
||||
NSStringFinder::CutInside<std::string>(sContentID, "<", ">");
|
||||
}
|
||||
|
||||
if (sContentLocation.empty() && !sContentID.empty())
|
||||
sContentLocation = "cid:" + sContentID;
|
||||
|
||||
// Content-Transfer-Encoding
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
|
||||
const std::string sContentEncoding{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
{
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
unCharsetEnd = std::min(unCharsetEnd, oData.m_unBeginPosition);
|
||||
}
|
||||
|
||||
// charset
|
||||
std::string sCharset = "utf-8";
|
||||
|
||||
if (std::string::npos != unCharsetEnd && unCharsetBegin < unCharsetEnd)
|
||||
{
|
||||
sCharset = NSStringFinder::FindProperty(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
|
||||
NSStringFinder::CutInside<std::string>(sCharset, "\"");
|
||||
}
|
||||
|
||||
// Content
|
||||
std::string sContent = sMhtContent.substr(unContentPosition, sMhtContent.length() - unContentPosition);
|
||||
|
||||
// std::wstring sExtention = NSFile::GetFileExtention(UTF8_TO_U(sName));
|
||||
// std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
|
||||
// Main document
|
||||
if (NSStringFinder::Equals(sContentType, "multipart/alternative"))
|
||||
oRes.WriteString(mhtTohtml(sContent));
|
||||
else if ((NSStringFinder::Find(sContentType, "text") /*&& (sExtention.empty() || NSStringFinder::EqualOf(sExtention, {L"htm", L"html", L"xhtml", L"css"}))*/)
|
||||
|| (NSStringFinder::Equals(sContentType, "application/octet-stream") && NSStringFinder::Find(sContentLocation, "css")))
|
||||
{
|
||||
// Styles are enclosed in <style> tag
|
||||
const bool bAddTagStyle = NSStringFinder::Equals(sContentType, "text/css") /*|| NSStringFinder::Equals(sExtention, L"css")*/ || NSStringFinder::Find(sContentLocation, "css");
|
||||
|
||||
if (bAddTagStyle)
|
||||
oRes.WriteString("<style>");
|
||||
|
||||
if (NSStringFinder::Equals(sContentEncoding, "base64"))
|
||||
sContent = Base64ToString(sContent, sCharset);
|
||||
else if (NSStringFinder::EqualOf(sContentEncoding, {"8bit", "7bit"}) || sContentEncoding.empty())
|
||||
{
|
||||
if (!NSStringFinder::Equals(sCharset, "utf-8") && !sCharset.empty())
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sContent = U_TO_UTF8(oConverter.toUnicode(sContent, sCharset.data()));
|
||||
}
|
||||
}
|
||||
else if (NSStringFinder::Equals(sContentEncoding, "quoted-printable"))
|
||||
{
|
||||
sContent = QuotedPrintableDecode(sContent, sCharset);
|
||||
if (!NSStringFinder::Equals(sCharset, "utf-8") && !sCharset.empty())
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sContent = U_TO_UTF8(oConverter.toUnicode(sContent, sCharset.data()));
|
||||
}
|
||||
}
|
||||
|
||||
if (NSStringFinder::Equals(sContentType, "text/html"))
|
||||
sContent = U_TO_UTF8(htmlToXhtml(sContent, false));
|
||||
|
||||
oRes.WriteString(sContent);
|
||||
|
||||
if(bAddTagStyle)
|
||||
oRes.WriteString("</style>");
|
||||
}
|
||||
// Images
|
||||
else if ((NSStringFinder::Find(sContentType, "image") /*|| NSStringFinder::Equals(sExtention, L"gif")*/ || NSStringFinder::Equals(sContentType, "application/octet-stream")) &&
|
||||
NSStringFinder::Equals(sContentEncoding, "base64"))
|
||||
{
|
||||
// if (NSStringFinder::Equals(sExtention, L"ico") || NSStringFinder::Find(sContentType, "ico"))
|
||||
// sContentType = "image/jpg";
|
||||
// else if(NSStringFinder::Equals(sExtention, L"gif"))
|
||||
// sContentType = "image/gif";
|
||||
int nSrcLen = (int)sContent.length();
|
||||
int nDecodeLen = NSBase64::Base64DecodeGetRequiredLength(nSrcLen);
|
||||
BYTE* pData = new BYTE[nDecodeLen];
|
||||
if (TRUE == NSBase64::Base64Decode(sContent.c_str(), nSrcLen, pData, &nDecodeLen))
|
||||
sRes.insert(std::make_pair(sContentLocation, "data:" + sContentType + ";base64," + sContent));
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
|
||||
static std::string mhtTohtml(const std::string& sFileContent)
|
||||
{
|
||||
std::map<std::string, std::string> sRes;
|
||||
NSStringUtils::CStringBuilderA oRes;
|
||||
|
||||
// Search for boundary
|
||||
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindProperty(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
|
||||
|
||||
size_t nFound{oData.m_unEndPosition};
|
||||
std::string sBoundary{oData.m_sValue};
|
||||
|
||||
if (sBoundary.empty())
|
||||
{
|
||||
size_t nFoundEnd = sFileContent.length();
|
||||
nFound = 0;
|
||||
ReadMht(sFileContent.substr(nFound, nFoundEnd), sRes, oRes);
|
||||
return oRes.GetData();
|
||||
}
|
||||
|
||||
NSStringFinder::CutInside<std::string>(sBoundary, "\"");
|
||||
|
||||
size_t nFoundEnd{nFound};
|
||||
|
||||
sBoundary = "--" + sBoundary;
|
||||
size_t nBoundaryLength = sBoundary.length();
|
||||
|
||||
nFound = sFileContent.find(sBoundary, nFound) + nBoundaryLength;
|
||||
|
||||
// Loop through boundary
|
||||
while(nFound != std::string::npos)
|
||||
{
|
||||
nFoundEnd = sFileContent.find(sBoundary, nFound + nBoundaryLength);
|
||||
if(nFoundEnd == std::string::npos)
|
||||
break;
|
||||
|
||||
ReadMht(sFileContent.substr(nFound, nFoundEnd - nFound), sRes, oRes);
|
||||
|
||||
nFound = sFileContent.find(sBoundary, nFoundEnd);
|
||||
}
|
||||
|
||||
std::string sFile = oRes.GetData();
|
||||
for(const std::pair<std::string, std::string>& item : sRes)
|
||||
{
|
||||
std::string sName = item.first;
|
||||
size_t found = sFile.find(sName);
|
||||
size_t sfound = sName.rfind('/');
|
||||
if(found == std::string::npos && sfound != std::string::npos)
|
||||
found = sFile.find(sName.erase(0, sfound + 1));
|
||||
while(found != std::string::npos)
|
||||
{
|
||||
size_t fq = sFile.find_last_of("\"\'>=", found);
|
||||
|
||||
if (std::string::npos == fq)
|
||||
break;
|
||||
|
||||
char ch = sFile[fq];
|
||||
if(ch != '\"' && ch != '\'')
|
||||
fq++;
|
||||
size_t tq = sFile.find_first_of("\"\'<> ", found) + 1;
|
||||
|
||||
if (std::string::npos == tq)
|
||||
break;
|
||||
|
||||
if(sFile[tq] != '\"' && sFile[tq] != '\'')
|
||||
tq--;
|
||||
if(ch != '>')
|
||||
{
|
||||
std::string is = '\"' + item.second + '\"';
|
||||
sFile.replace(fq, tq - fq, is);
|
||||
found = sFile.find(sName, fq + is.length());
|
||||
}
|
||||
else
|
||||
found = sFile.find(sName, tq);
|
||||
}
|
||||
}
|
||||
|
||||
return sFile;
|
||||
}
|
||||
|
||||
// Replaces entities &,<,> in text
|
||||
static void substitute_xml_entities_into_text(std::string& text)
|
||||
{
|
||||
// replacing & must come first
|
||||
replace_all(text, "&", "&");
|
||||
replace_all(text, "<", "<");
|
||||
replace_all(text, ">", ">");
|
||||
}
|
||||
|
||||
// After running through Gumbo, the values of type "" are replaced with the corresponding code '0x01'
|
||||
// Since the attribute value does not use control characters (value <= 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(), [](unsigned char chValue){ return chValue <= 0x09; });
|
||||
|
||||
while (itFound != text.end())
|
||||
{
|
||||
itFound = text.erase(itFound);
|
||||
itFound = std::find_if(itFound, text.end(), [](unsigned char chValue){ return chValue <= 0x09; });
|
||||
}
|
||||
}
|
||||
|
||||
// Replaces entity " in text
|
||||
static void substitute_xml_entities_into_attributes(std::string& text)
|
||||
{
|
||||
remove_control_symbols(text);
|
||||
substitute_xml_entities_into_text(text);
|
||||
replace_all(text, "\"", """);
|
||||
}
|
||||
|
||||
static std::string handle_unknown_tag(GumboStringPiece* text)
|
||||
{
|
||||
if (text->data == NULL)
|
||||
return "";
|
||||
GumboStringPiece gsp = *text;
|
||||
gumbo_tag_from_original_text(&gsp);
|
||||
std::string sAtr = std::string(gsp.data, gsp.length);
|
||||
size_t found = sAtr.find_first_of("-'+,./=?;!*#@$_%<>&;\"\'()[]{}");
|
||||
while(found != std::string::npos)
|
||||
{
|
||||
sAtr.erase(found, 1);
|
||||
found = sAtr.find_first_of("-'+,./=?;!*#@$_%<>&;\"\'()[]{}", found);
|
||||
}
|
||||
return sAtr;
|
||||
}
|
||||
|
||||
static std::string get_tag_name(GumboNode* node)
|
||||
{
|
||||
std::string tagname = (node->type == GUMBO_NODE_DOCUMENT ? "document" : gumbo_normalized_tagname(node->v.element.tag));
|
||||
if (tagname.empty())
|
||||
tagname = handle_unknown_tag(&node->v.element.original_tag);
|
||||
return tagname;
|
||||
}
|
||||
|
||||
static void build_doctype(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder)
|
||||
{
|
||||
if (node->v.document.has_doctype)
|
||||
{
|
||||
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 \"");
|
||||
oBuilder.WriteString(pi);
|
||||
oBuilder.WriteString("\" \"");
|
||||
oBuilder.WriteString(node->v.document.system_identifier);
|
||||
oBuilder.WriteString("\"");
|
||||
}
|
||||
oBuilder.WriteString(">");
|
||||
}
|
||||
}
|
||||
|
||||
static void build_attributes(const GumboVector* attribs, NSStringUtils::CStringBuilderA& atts)
|
||||
{
|
||||
std::vector<std::string> arrRepeat;
|
||||
for (size_t i = 0; i < attribs->length; ++i)
|
||||
{
|
||||
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;
|
||||
size_t nBad = sName.find_first_of("+,.=?#%<>&;\"\'()[]{}");
|
||||
while(nBad != std::string::npos)
|
||||
{
|
||||
sName.erase(nBad, 1);
|
||||
nBad = sName.find_first_of("+,.=?#%<>&;\"\'()[]{}", nBad);
|
||||
if(sName.empty())
|
||||
break;
|
||||
bCheck = true;
|
||||
}
|
||||
if(sName.empty())
|
||||
continue;
|
||||
while(sName.front() >= '0' && sName.front() <= '9')
|
||||
{
|
||||
sName.erase(0, 1);
|
||||
if(sName.empty())
|
||||
break;
|
||||
bCheck = true;
|
||||
}
|
||||
if(bCheck)
|
||||
{
|
||||
GumboAttribute* check = gumbo_get_attribute(attribs, sName.c_str());
|
||||
if(check || std::find(arrRepeat.begin(), arrRepeat.end(), sName) != arrRepeat.end())
|
||||
continue;
|
||||
else
|
||||
arrRepeat.push_back(sName);
|
||||
}
|
||||
|
||||
if(sName.empty())
|
||||
continue;
|
||||
atts.WriteString(sName);
|
||||
|
||||
// determine original quote character used if it exists
|
||||
std::string qs ="\"";
|
||||
atts.WriteString("=");
|
||||
atts.WriteString(qs);
|
||||
substitute_xml_entities_into_attributes(sVal);
|
||||
atts.WriteString(sVal);
|
||||
atts.WriteString(qs);
|
||||
}
|
||||
}
|
||||
|
||||
static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder, bool bCheckValidNode = true);
|
||||
|
||||
static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA& contents, bool bCheckValidNode)
|
||||
{
|
||||
std::string key = "|" + get_tag_name(node) + "|";
|
||||
bool keep_whitespace = preserve_whitespace.find(key) != std::string::npos;
|
||||
bool is_inline = nonbreaking_inline.find(key) != std::string::npos;
|
||||
bool is_like_inline = treat_like_inline.find(key) != std::string::npos;
|
||||
|
||||
GumboVector* children = &node->v.element.children;
|
||||
|
||||
for (size_t i = 0; i < children->length; i++)
|
||||
{
|
||||
GumboNode* child = static_cast<GumboNode*> (children->data[i]);
|
||||
|
||||
if (child->type == GUMBO_NODE_TEXT)
|
||||
{
|
||||
std::string val(child->v.text.text);
|
||||
remove_control_symbols(val);
|
||||
substitute_xml_entities_into_text(val);
|
||||
|
||||
// Remove FF
|
||||
size_t found = val.find_first_of("\014");
|
||||
while(found != std::string::npos)
|
||||
{
|
||||
val.erase(found, 1);
|
||||
found = val.find_first_of("\014", found);
|
||||
}
|
||||
|
||||
contents.WriteString(val);
|
||||
}
|
||||
else if ((child->type == GUMBO_NODE_ELEMENT) || (child->type == GUMBO_NODE_TEMPLATE))
|
||||
prettyprint(child, contents, bCheckValidNode);
|
||||
else if (child->type == GUMBO_NODE_WHITESPACE)
|
||||
{
|
||||
if (keep_whitespace || is_inline || is_like_inline)
|
||||
contents.WriteString(child->v.text.text);
|
||||
}
|
||||
else if (child->type != GUMBO_NODE_COMMENT)
|
||||
{
|
||||
// Error message
|
||||
// Does this actually exist: (child->type == GUMBO_NODE_CDATA)
|
||||
// fprintf(stderr, "unknown element of type: %d\n", child->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder, bool bCheckValidNode)
|
||||
{
|
||||
// special case the document node
|
||||
if (node->type == GUMBO_NODE_DOCUMENT)
|
||||
{
|
||||
build_doctype(node, oBuilder);
|
||||
prettyprint_contents(node, oBuilder, bCheckValidNode);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string tagname = get_tag_name(node);
|
||||
remove_control_symbols(tagname);
|
||||
|
||||
if (NodeIsUnprocessed(tagname))
|
||||
return;
|
||||
|
||||
if (bCheckValidNode)
|
||||
bCheckValidNode = !IsUnckeckedNodes(tagname);
|
||||
|
||||
if (bCheckValidNode && html_tags.end() == std::find(html_tags.begin(), html_tags.end(), tagname))
|
||||
{
|
||||
prettyprint_contents(node, oBuilder, bCheckValidNode);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string close = "";
|
||||
std::string closeTag = "";
|
||||
std::string key = "|" + tagname + "|";
|
||||
bool is_empty_tag = empty_tags.find(key) != std::string::npos;
|
||||
|
||||
// determine closing tag type
|
||||
if (is_empty_tag)
|
||||
close = "/";
|
||||
else
|
||||
closeTag = "</" + tagname + ">";
|
||||
|
||||
// build results
|
||||
oBuilder.WriteString("<" + tagname);
|
||||
|
||||
// build attr string
|
||||
const GumboVector* attribs = &node->v.element.attributes;
|
||||
build_attributes(attribs, oBuilder);
|
||||
oBuilder.WriteString(close + ">");
|
||||
|
||||
// prettyprint your contents
|
||||
prettyprint_contents(node, oBuilder, bCheckValidNode);
|
||||
oBuilder.WriteString(closeTag);
|
||||
}
|
||||
|
||||
std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert)
|
||||
{
|
||||
if (bNeedConvert)
|
||||
{ // Encoding detection
|
||||
std::string sEncoding = NSStringFinder::FindProperty(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\"", "'"}).m_sValue;
|
||||
|
||||
if (sEncoding.empty())
|
||||
sEncoding = NSStringFinder::FindProperty(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
|
||||
|
||||
if (!sEncoding.empty() && !NSStringFinder::Equals("utf-8", sEncoding))
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sFileContent = U_TO_UTF8(oConverter.toUnicode(sFileContent, sEncoding.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
// Remove extra characters before <...
|
||||
boost::regex oRegex("<[a-zA-Z]");
|
||||
boost::match_results<typename std::string::const_iterator> oResult;
|
||||
|
||||
if (boost::regex_search(sFileContent, oResult, oRegex))
|
||||
sFileContent.erase(0, oResult.position());
|
||||
|
||||
//Remove <a ... />
|
||||
while (NSStringFinder::RemoveEmptyTag(sFileContent, "a"));
|
||||
//Remove <title ... />
|
||||
while (NSStringFinder::RemoveEmptyTag(sFileContent, "title"));
|
||||
//Remove <script ... />
|
||||
while (NSStringFinder::RemoveEmptyTag(sFileContent, "script"));
|
||||
|
||||
// Gumbo
|
||||
GumboOptions options = kGumboDefaultOptions;
|
||||
GumboOutput* output = gumbo_parse_with_options(&options, sFileContent.data(), sFileContent.length());
|
||||
|
||||
// prettyprint
|
||||
NSStringUtils::CStringBuilderA oBuilder;
|
||||
prettyprint(output->document, oBuilder);
|
||||
|
||||
// Convert from string utf8 to wstring
|
||||
return UTF8_TO_U(oBuilder.GetData());
|
||||
}
|
||||
|
||||
std::wstring mhtToXhtml(std::string& sFileContent)
|
||||
{
|
||||
sFileContent = mhtTohtml(sFileContent);
|
||||
|
||||
// Gumbo
|
||||
GumboOptions options = kGumboDefaultOptions;
|
||||
GumboOutput* output = gumbo_parse_with_options(&options, sFileContent.data(), sFileContent.length());
|
||||
|
||||
// prettyprint
|
||||
NSStringUtils::CStringBuilderA oBuilder;
|
||||
prettyprint(output->document, oBuilder);
|
||||
|
||||
// Convert from string utf8 to wstring
|
||||
return UTF8_TO_U(oBuilder.GetData());
|
||||
}
|
||||
}
|
||||
@ -2,658 +2,11 @@
|
||||
#define HTMLTOXHTML_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gumbo-parser/src/gumbo.h"
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../../../DesktopEditor/common/StringBuilder.h"
|
||||
#include "../../../DesktopEditor/xml/include/xmlutils.h"
|
||||
#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|";
|
||||
static std::string special_handling = "|html|body|";
|
||||
static std::string treat_like_inline = "|p|";
|
||||
|
||||
static std::vector<std::string> html_tags = {"div","span","a","img","p","h1","h2","h3","h4","h5","h6",
|
||||
"ul", "ol", "li","td","tr","table","thead","tbody","tfoot","th",
|
||||
"br","form","input","button","section","nav","header","footer",
|
||||
"main","figure","figcaption","strong","em","i", "b", "u","pre",
|
||||
"code","blockquote","hr","script","link","meta","style","title",
|
||||
"head","body","html","legend","optgroup","option","select","dl",
|
||||
"dt","dd","time","data","abbr","address","area","base","bdi",
|
||||
"bdo","cite","col","iframe","video","source","track","textarea",
|
||||
"label","fieldset","colgroup","del","ins","details","summary",
|
||||
"dialog","embed","kbd","map","mark","menu","meter","object",
|
||||
"output","param","progress","q","samp","small","sub","sup","var",
|
||||
"wbr","acronym","applet","article","aside","audio","basefont",
|
||||
"bgsound","big","blink","canvas","caption","center","command",
|
||||
"comment","datalist","dfn","dir","font","frame","frameset",
|
||||
"hgroup","isindex","keygen","marquee","nobr","noembed","noframes",
|
||||
"noscript","plaintext","rp","rt","ruby","s","strike","tt","xmp"};
|
||||
|
||||
static std::vector<std::string> unchecked_nodes_new = {"svg"};
|
||||
|
||||
static void prettyprint(GumboNode*, NSStringUtils::CStringBuilderA& oBuilder, bool bCheckValidNode = true);
|
||||
static std::string mhtTohtml(const std::string &sFileContent);
|
||||
|
||||
// Заменяет в строке s все символы s1 на s2
|
||||
static void replace_all(std::string& s, const std::string& s1, const std::string& s2)
|
||||
namespace HTML
|
||||
{
|
||||
size_t pos = s.find(s1);
|
||||
while(pos != std::string::npos)
|
||||
{
|
||||
s.replace(pos, s1.length(), s2);
|
||||
pos = s.find(s1, pos + s2.length());
|
||||
}
|
||||
}
|
||||
|
||||
static bool NodeIsUnprocessed(const std::string& wsTagName)
|
||||
{
|
||||
return "xml" == wsTagName;
|
||||
}
|
||||
|
||||
static bool IsUnckeckedNodes(const std::string& sValue)
|
||||
{
|
||||
return unchecked_nodes_new.end() != std::find(unchecked_nodes_new.begin(), unchecked_nodes_new.end(), sValue);
|
||||
}
|
||||
|
||||
static std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert)
|
||||
{
|
||||
if (bNeedConvert)
|
||||
{ // Определение кодировки
|
||||
std::string sEncoding = NSStringFinder::FindProperty(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\"", "'"}).m_sValue;
|
||||
|
||||
if (sEncoding.empty())
|
||||
sEncoding = NSStringFinder::FindProperty(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
|
||||
|
||||
if (!sEncoding.empty() && !NSStringFinder::Equals("utf-8", sEncoding))
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sFileContent = U_TO_UTF8(oConverter.toUnicode(sFileContent, sEncoding.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
// Избавляемся от лишних символов до <...
|
||||
boost::regex oRegex("<[a-zA-Z]");
|
||||
boost::match_results<typename std::string::const_iterator> oResult;
|
||||
|
||||
if (boost::regex_search(sFileContent, oResult, oRegex))
|
||||
sFileContent.erase(0, oResult.position());
|
||||
|
||||
//Избавление от <a ... />
|
||||
while (NSStringFinder::RemoveEmptyTag(sFileContent, "a"));
|
||||
//Избавление от <title ... />
|
||||
while (NSStringFinder::RemoveEmptyTag(sFileContent, "title"));
|
||||
//Избавление от <script ... />
|
||||
while (NSStringFinder::RemoveEmptyTag(sFileContent, "script"));
|
||||
|
||||
// Gumbo
|
||||
GumboOptions options = kGumboDefaultOptions;
|
||||
GumboOutput* output = gumbo_parse_with_options(&options, sFileContent.data(), sFileContent.length());
|
||||
|
||||
// prettyprint
|
||||
NSStringUtils::CStringBuilderA oBuilder;
|
||||
prettyprint(output->document, oBuilder);
|
||||
|
||||
// Конвертирование из string utf8 в wstring
|
||||
return UTF8_TO_U(oBuilder.GetData());
|
||||
}
|
||||
|
||||
static std::string Base64ToString(const std::string& sContent, const std::string& sCharset)
|
||||
{
|
||||
std::string sRes;
|
||||
int nSrcLen = (int)sContent.length();
|
||||
int nDecodeLen = NSBase64::Base64DecodeGetRequiredLength(nSrcLen);
|
||||
BYTE* pData = new BYTE[nDecodeLen];
|
||||
if (TRUE == NSBase64::Base64Decode(sContent.c_str(), nSrcLen, pData, &nDecodeLen))
|
||||
{
|
||||
std::wstring sConvert;
|
||||
if(!sCharset.empty() && NSStringFinder::Equals<std::string>("utf-8", sCharset))
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sConvert = oConverter.toUnicode(reinterpret_cast<char *>(pData), (unsigned)nDecodeLen, sCharset.data());
|
||||
}
|
||||
sRes = sConvert.empty() ? std::string(reinterpret_cast<char *>(pData), nDecodeLen) : U_TO_UTF8(sConvert);
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
return sRes;
|
||||
}
|
||||
|
||||
static std::string QuotedPrintableDecode(const std::string& sContent, std::string& sCharset)
|
||||
{
|
||||
NSStringUtils::CStringBuilderA sRes;
|
||||
size_t ip = 0;
|
||||
size_t i = sContent.find('=');
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
size_t nIgnore = 12;
|
||||
std::string charset = sContent.substr(0, nIgnore);
|
||||
if(charset == "=00=00=FE=FF")
|
||||
sCharset = "UTF-32BE";
|
||||
else if(charset == "=FF=FE=00=00")
|
||||
sCharset = "UTF-32LE";
|
||||
else if(charset == "=2B=2F=76=38" || charset == "=2B=2F=76=39" ||
|
||||
charset == "=2B=2F=76=2B" || charset == "=2B=2F=76=2F")
|
||||
sCharset = "UTF-7";
|
||||
else if(charset == "=DD=73=66=73")
|
||||
sCharset = "UTF-EBCDIC";
|
||||
else if(charset == "=84=31=95=33")
|
||||
sCharset = "GB-18030";
|
||||
else
|
||||
{
|
||||
nIgnore -= 3;
|
||||
charset.erase(nIgnore);
|
||||
if(charset == "=EF=BB=BF")
|
||||
sCharset = "UTF-8";
|
||||
else if(charset == "=F7=64=4C")
|
||||
sCharset = "UTF-1";
|
||||
else if(charset == "=0E=FE=FF")
|
||||
sCharset = "SCSU";
|
||||
else if(charset == "=FB=EE=28")
|
||||
sCharset = "BOCU-1";
|
||||
else
|
||||
{
|
||||
nIgnore -= 3;
|
||||
charset.erase(nIgnore);
|
||||
if(charset == "=FE=FF")
|
||||
sCharset = "UTF-16BE";
|
||||
else if(charset == "=FF=FE")
|
||||
sCharset = "UTF-16LE";
|
||||
else
|
||||
nIgnore -= 6;
|
||||
}
|
||||
}
|
||||
|
||||
ip = nIgnore;
|
||||
i = sContent.find('=', ip);
|
||||
}
|
||||
|
||||
while(i != std::string::npos && i + 2 < sContent.length())
|
||||
{
|
||||
sRes.WriteString(sContent.c_str() + ip, i - ip);
|
||||
std::string str = sContent.substr(i + 1, 2);
|
||||
if(str.front() == '\n' || str.front() == '\r')
|
||||
{
|
||||
char ch = str[1];
|
||||
if(ch != '\n' && ch != '\r')
|
||||
sRes.WriteString(&ch, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* err;
|
||||
char ch = (int)strtol(str.data(), &err, 16);
|
||||
if(*err)
|
||||
sRes.WriteString('=' + str);
|
||||
else
|
||||
sRes.WriteString(&ch, 1);
|
||||
}
|
||||
ip = i + 3;
|
||||
i = sContent.find('=', ip);
|
||||
}
|
||||
if(ip != std::string::npos)
|
||||
sRes.WriteString(sContent.c_str() + ip);
|
||||
return sRes.GetData();
|
||||
}
|
||||
|
||||
static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::string>& sRes, NSStringUtils::CStringBuilderA& oRes)
|
||||
{
|
||||
size_t unContentPosition = 0, unCharsetBegin = 0, unCharsetEnd = std::string::npos;
|
||||
|
||||
NSStringFinder::TFoundedData<char> oData;
|
||||
|
||||
// Content-Type
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
|
||||
const std::string sContentType{oData.m_sValue};
|
||||
|
||||
if (sContentType.empty())
|
||||
return;
|
||||
|
||||
if (NSStringFinder::Equals(sContentType, "multipart/alternative"))
|
||||
{
|
||||
oRes.WriteString(mhtTohtml(sMhtContent.substr(oData.m_unEndPosition, sMhtContent.length() - oData.m_unEndPosition)));
|
||||
return;
|
||||
}
|
||||
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
unCharsetBegin = oData.m_unEndPosition;
|
||||
|
||||
// name
|
||||
// std::string sName = NSStringFinder::FindProperty(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
|
||||
// unContentPosition = std::max(unContentPosition, unLastPosition);
|
||||
|
||||
// Content-Location
|
||||
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::FindProperty(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
|
||||
std::string sContentID{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
{
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
unCharsetEnd = std::min(unCharsetEnd, oData.m_unBeginPosition);
|
||||
NSStringFinder::CutInside<std::string>(sContentID, "<", ">");
|
||||
}
|
||||
|
||||
if (sContentLocation.empty() && !sContentID.empty())
|
||||
sContentLocation = "cid:" + sContentID;
|
||||
|
||||
// Content-Transfer-Encoding
|
||||
oData = NSStringFinder::FindProperty(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
|
||||
const std::string sContentEncoding{oData.m_sValue};
|
||||
|
||||
if (!oData.Empty())
|
||||
{
|
||||
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
|
||||
unCharsetEnd = std::min(unCharsetEnd, oData.m_unBeginPosition);
|
||||
}
|
||||
|
||||
// charset
|
||||
std::string sCharset = "utf-8";
|
||||
|
||||
if (std::string::npos != unCharsetEnd && unCharsetBegin < unCharsetEnd)
|
||||
{
|
||||
sCharset = NSStringFinder::FindProperty(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
|
||||
NSStringFinder::CutInside<std::string>(sCharset, "\"");
|
||||
}
|
||||
|
||||
// Content
|
||||
std::string sContent = sMhtContent.substr(unContentPosition, sMhtContent.length() - unContentPosition);
|
||||
|
||||
// std::wstring sExtention = NSFile::GetFileExtention(UTF8_TO_U(sName));
|
||||
// std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
|
||||
// Основной документ
|
||||
if (NSStringFinder::Equals(sContentType, "multipart/alternative"))
|
||||
oRes.WriteString(mhtTohtml(sContent));
|
||||
else if ((NSStringFinder::Find(sContentType, "text") /*&& (sExtention.empty() || NSStringFinder::EqualOf(sExtention, {L"htm", L"html", L"xhtml", L"css"}))*/)
|
||||
|| (NSStringFinder::Equals(sContentType, "application/octet-stream") && NSStringFinder::Find(sContentLocation, "css")))
|
||||
{
|
||||
// Стили заключаются в тэг <style>
|
||||
const bool bAddTagStyle = NSStringFinder::Equals(sContentType, "text/css") /*|| NSStringFinder::Equals(sExtention, L"css")*/ || NSStringFinder::Find(sContentLocation, "css");
|
||||
|
||||
if (bAddTagStyle)
|
||||
oRes.WriteString("<style>");
|
||||
|
||||
if (NSStringFinder::Equals(sContentEncoding, "base64"))
|
||||
sContent = Base64ToString(sContent, sCharset);
|
||||
else if (NSStringFinder::EqualOf(sContentEncoding, {"8bit", "7bit"}) || sContentEncoding.empty())
|
||||
{
|
||||
if (!NSStringFinder::Equals(sCharset, "utf-8") && !sCharset.empty())
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sContent = U_TO_UTF8(oConverter.toUnicode(sContent, sCharset.data()));
|
||||
}
|
||||
}
|
||||
else if (NSStringFinder::Equals(sContentEncoding, "quoted-printable"))
|
||||
{
|
||||
sContent = QuotedPrintableDecode(sContent, sCharset);
|
||||
if (!NSStringFinder::Equals(sCharset, "utf-8") && !sCharset.empty())
|
||||
{
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
sContent = U_TO_UTF8(oConverter.toUnicode(sContent, sCharset.data()));
|
||||
}
|
||||
}
|
||||
|
||||
if (NSStringFinder::Equals(sContentType, "text/html"))
|
||||
sContent = U_TO_UTF8(htmlToXhtml(sContent, false));
|
||||
|
||||
oRes.WriteString(sContent);
|
||||
|
||||
if(bAddTagStyle)
|
||||
oRes.WriteString("</style>");
|
||||
}
|
||||
// Картинки
|
||||
else if ((NSStringFinder::Find(sContentType, "image") /*|| NSStringFinder::Equals(sExtention, L"gif")*/ || NSStringFinder::Equals(sContentType, "application/octet-stream")) &&
|
||||
NSStringFinder::Equals(sContentEncoding, "base64"))
|
||||
{
|
||||
// if (NSStringFinder::Equals(sExtention, L"ico") || NSStringFinder::Find(sContentType, "ico"))
|
||||
// sContentType = "image/jpg";
|
||||
// else if(NSStringFinder::Equals(sExtention, L"gif"))
|
||||
// sContentType = "image/gif";
|
||||
int nSrcLen = (int)sContent.length();
|
||||
int nDecodeLen = NSBase64::Base64DecodeGetRequiredLength(nSrcLen);
|
||||
BYTE* pData = new BYTE[nDecodeLen];
|
||||
if (TRUE == NSBase64::Base64Decode(sContent.c_str(), nSrcLen, pData, &nDecodeLen))
|
||||
sRes.insert(std::make_pair(sContentLocation, "data:" + sContentType + ";base64," + sContent));
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
|
||||
static std::string mhtTohtml(const std::string& sFileContent)
|
||||
{
|
||||
std::map<std::string, std::string> sRes;
|
||||
NSStringUtils::CStringBuilderA oRes;
|
||||
|
||||
// Поиск boundary
|
||||
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindProperty(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
|
||||
|
||||
size_t nFound{oData.m_unEndPosition};
|
||||
std::string sBoundary{oData.m_sValue};
|
||||
|
||||
if (sBoundary.empty())
|
||||
{
|
||||
size_t nFoundEnd = sFileContent.length();
|
||||
nFound = 0;
|
||||
ReadMht(sFileContent.substr(nFound, nFoundEnd), sRes, oRes);
|
||||
return oRes.GetData();
|
||||
}
|
||||
|
||||
NSStringFinder::CutInside<std::string>(sBoundary, "\"");
|
||||
|
||||
size_t nFoundEnd{nFound};
|
||||
|
||||
sBoundary = "--" + sBoundary;
|
||||
size_t nBoundaryLength = sBoundary.length();
|
||||
|
||||
nFound = sFileContent.find(sBoundary, nFound) + nBoundaryLength;
|
||||
|
||||
// Цикл по boundary
|
||||
while(nFound != std::string::npos)
|
||||
{
|
||||
nFoundEnd = sFileContent.find(sBoundary, nFound + nBoundaryLength);
|
||||
if(nFoundEnd == std::string::npos)
|
||||
break;
|
||||
|
||||
ReadMht(sFileContent.substr(nFound, nFoundEnd - nFound), sRes, oRes);
|
||||
|
||||
nFound = sFileContent.find(sBoundary, nFoundEnd);
|
||||
}
|
||||
|
||||
std::string sFile = oRes.GetData();
|
||||
for(const std::pair<std::string, std::string>& item : sRes)
|
||||
{
|
||||
std::string sName = item.first;
|
||||
size_t found = sFile.find(sName);
|
||||
size_t sfound = sName.rfind('/');
|
||||
if(found == std::string::npos && sfound != std::string::npos)
|
||||
found = sFile.find(sName.erase(0, sfound + 1));
|
||||
while(found != std::string::npos)
|
||||
{
|
||||
size_t fq = sFile.find_last_of("\"\'>=", found);
|
||||
|
||||
if (std::string::npos == fq)
|
||||
break;
|
||||
|
||||
char ch = sFile[fq];
|
||||
if(ch != '\"' && ch != '\'')
|
||||
fq++;
|
||||
size_t tq = sFile.find_first_of("\"\'<> ", found) + 1;
|
||||
|
||||
if (std::string::npos == tq)
|
||||
break;
|
||||
|
||||
if(sFile[tq] != '\"' && sFile[tq] != '\'')
|
||||
tq--;
|
||||
if(ch != '>')
|
||||
{
|
||||
std::string is = '\"' + item.second + '\"';
|
||||
sFile.replace(fq, tq - fq, is);
|
||||
found = sFile.find(sName, fq + is.length());
|
||||
}
|
||||
else
|
||||
found = sFile.find(sName, tq);
|
||||
}
|
||||
}
|
||||
|
||||
return sFile;
|
||||
}
|
||||
|
||||
static std::wstring mhtToXhtml(std::string& sFileContent)
|
||||
{
|
||||
sFileContent = mhtTohtml(sFileContent);
|
||||
|
||||
// Gumbo
|
||||
GumboOptions options = kGumboDefaultOptions;
|
||||
GumboOutput* output = gumbo_parse_with_options(&options, sFileContent.data(), sFileContent.length());
|
||||
|
||||
// prettyprint
|
||||
NSStringUtils::CStringBuilderA oBuilder;
|
||||
prettyprint(output->document, oBuilder);
|
||||
|
||||
// Конвертирование из string utf8 в wstring
|
||||
return UTF8_TO_U(oBuilder.GetData());
|
||||
}
|
||||
|
||||
// Заменяет сущности &,<,> в text
|
||||
static void substitute_xml_entities_into_text(std::string& text)
|
||||
{
|
||||
// replacing & must come first
|
||||
replace_all(text, "&", "&");
|
||||
replace_all(text, "<", "<");
|
||||
replace_all(text, ">", ">");
|
||||
}
|
||||
|
||||
// After running through Gumbo, the values of type "" are replaced with the corresponding code '0x01'
|
||||
// Since the attribute value does not use control characters (value <= 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(), [](unsigned char chValue){ return chValue <= 0x09; });
|
||||
|
||||
while (itFound != text.end())
|
||||
{
|
||||
itFound = text.erase(itFound);
|
||||
itFound = std::find_if(itFound, text.end(), [](unsigned char chValue){ return chValue <= 0x09; });
|
||||
}
|
||||
}
|
||||
|
||||
// Заменяет сущности " в text
|
||||
static void substitute_xml_entities_into_attributes(std::string& text)
|
||||
{
|
||||
remove_control_symbols(text);
|
||||
substitute_xml_entities_into_text(text);
|
||||
replace_all(text, "\"", """);
|
||||
}
|
||||
|
||||
static std::string handle_unknown_tag(GumboStringPiece* text)
|
||||
{
|
||||
if (text->data == NULL)
|
||||
return "";
|
||||
GumboStringPiece gsp = *text;
|
||||
gumbo_tag_from_original_text(&gsp);
|
||||
std::string sAtr = std::string(gsp.data, gsp.length);
|
||||
size_t found = sAtr.find_first_of("-'+,./=?;!*#@$_%<>&;\"\'()[]{}");
|
||||
while(found != std::string::npos)
|
||||
{
|
||||
sAtr.erase(found, 1);
|
||||
found = sAtr.find_first_of("-'+,./=?;!*#@$_%<>&;\"\'()[]{}", found);
|
||||
}
|
||||
return sAtr;
|
||||
}
|
||||
|
||||
static std::string get_tag_name(GumboNode* node)
|
||||
{
|
||||
std::string tagname = (node->type == GUMBO_NODE_DOCUMENT ? "document" : gumbo_normalized_tagname(node->v.element.tag));
|
||||
if (tagname.empty())
|
||||
tagname = handle_unknown_tag(&node->v.element.original_tag);
|
||||
return tagname;
|
||||
}
|
||||
|
||||
static void build_doctype(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder)
|
||||
{
|
||||
if (node->v.document.has_doctype)
|
||||
{
|
||||
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 \"");
|
||||
oBuilder.WriteString(pi);
|
||||
oBuilder.WriteString("\" \"");
|
||||
oBuilder.WriteString(node->v.document.system_identifier);
|
||||
oBuilder.WriteString("\"");
|
||||
}
|
||||
oBuilder.WriteString(">");
|
||||
}
|
||||
}
|
||||
|
||||
static void build_attributes(const GumboVector* attribs, NSStringUtils::CStringBuilderA& atts)
|
||||
{
|
||||
std::vector<std::string> arrRepeat;
|
||||
for (size_t i = 0; i < attribs->length; ++i)
|
||||
{
|
||||
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;
|
||||
size_t nBad = sName.find_first_of("+,.=?#%<>&;\"\'()[]{}");
|
||||
while(nBad != std::string::npos)
|
||||
{
|
||||
sName.erase(nBad, 1);
|
||||
nBad = sName.find_first_of("+,.=?#%<>&;\"\'()[]{}", nBad);
|
||||
if(sName.empty())
|
||||
break;
|
||||
bCheck = true;
|
||||
}
|
||||
if(sName.empty())
|
||||
continue;
|
||||
while(sName.front() >= '0' && sName.front() <= '9')
|
||||
{
|
||||
sName.erase(0, 1);
|
||||
if(sName.empty())
|
||||
break;
|
||||
bCheck = true;
|
||||
}
|
||||
if(bCheck)
|
||||
{
|
||||
GumboAttribute* check = gumbo_get_attribute(attribs, sName.c_str());
|
||||
if(check || std::find(arrRepeat.begin(), arrRepeat.end(), sName) != arrRepeat.end())
|
||||
continue;
|
||||
else
|
||||
arrRepeat.push_back(sName);
|
||||
}
|
||||
|
||||
if(sName.empty())
|
||||
continue;
|
||||
atts.WriteString(sName);
|
||||
|
||||
// determine original quote character used if it exists
|
||||
std::string qs ="\"";
|
||||
atts.WriteString("=");
|
||||
atts.WriteString(qs);
|
||||
substitute_xml_entities_into_attributes(sVal);
|
||||
atts.WriteString(sVal);
|
||||
atts.WriteString(qs);
|
||||
}
|
||||
}
|
||||
|
||||
static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA& contents, bool bCheckValidNode)
|
||||
{
|
||||
std::string key = "|" + get_tag_name(node) + "|";
|
||||
bool keep_whitespace = preserve_whitespace.find(key) != std::string::npos;
|
||||
bool is_inline = nonbreaking_inline.find(key) != std::string::npos;
|
||||
bool is_like_inline = treat_like_inline.find(key) != std::string::npos;
|
||||
|
||||
GumboVector* children = &node->v.element.children;
|
||||
|
||||
for (size_t i = 0; i < children->length; i++)
|
||||
{
|
||||
GumboNode* child = static_cast<GumboNode*> (children->data[i]);
|
||||
|
||||
if (child->type == GUMBO_NODE_TEXT)
|
||||
{
|
||||
std::string val(child->v.text.text);
|
||||
remove_control_symbols(val);
|
||||
substitute_xml_entities_into_text(val);
|
||||
|
||||
// Избавление от FF
|
||||
size_t found = val.find_first_of("\014");
|
||||
while(found != std::string::npos)
|
||||
{
|
||||
val.erase(found, 1);
|
||||
found = val.find_first_of("\014", found);
|
||||
}
|
||||
|
||||
contents.WriteString(val);
|
||||
}
|
||||
else if ((child->type == GUMBO_NODE_ELEMENT) || (child->type == GUMBO_NODE_TEMPLATE))
|
||||
prettyprint(child, contents, bCheckValidNode);
|
||||
else if (child->type == GUMBO_NODE_WHITESPACE)
|
||||
{
|
||||
if (keep_whitespace || is_inline || is_like_inline)
|
||||
contents.WriteString(child->v.text.text);
|
||||
}
|
||||
else if (child->type != GUMBO_NODE_COMMENT)
|
||||
{
|
||||
// Сообщение об ошибке
|
||||
// Does this actually exist: (child->type == GUMBO_NODE_CDATA)
|
||||
// fprintf(stderr, "unknown element of type: %d\n", child->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder, bool bCheckValidNode)
|
||||
{
|
||||
// special case the document node
|
||||
if (node->type == GUMBO_NODE_DOCUMENT)
|
||||
{
|
||||
build_doctype(node, oBuilder);
|
||||
prettyprint_contents(node, oBuilder, bCheckValidNode);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string tagname = get_tag_name(node);
|
||||
remove_control_symbols(tagname);
|
||||
|
||||
if (NodeIsUnprocessed(tagname))
|
||||
return;
|
||||
|
||||
if (bCheckValidNode)
|
||||
bCheckValidNode = !IsUnckeckedNodes(tagname);
|
||||
|
||||
if (bCheckValidNode && html_tags.end() == std::find(html_tags.begin(), html_tags.end(), tagname))
|
||||
{
|
||||
prettyprint_contents(node, oBuilder, bCheckValidNode);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string close = "";
|
||||
std::string closeTag = "";
|
||||
std::string key = "|" + tagname + "|";
|
||||
bool is_empty_tag = empty_tags.find(key) != std::string::npos;
|
||||
|
||||
// determine closing tag type
|
||||
if (is_empty_tag)
|
||||
close = "/";
|
||||
else
|
||||
closeTag = "</" + tagname + ">";
|
||||
|
||||
// build results
|
||||
oBuilder.WriteString("<" + tagname);
|
||||
|
||||
// build attr string
|
||||
const GumboVector* attribs = &node->v.element.attributes;
|
||||
build_attributes(attribs, oBuilder);
|
||||
oBuilder.WriteString(close + ">");
|
||||
|
||||
// prettyprint your contents
|
||||
prettyprint_contents(node, oBuilder, bCheckValidNode);
|
||||
oBuilder.WriteString(closeTag);
|
||||
std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert);
|
||||
std::wstring mhtToXhtml(std::string& sFileContent);
|
||||
}
|
||||
|
||||
#endif // HTMLTOXHTML_H
|
||||
|
||||
3
Common/3dParty/hunspell/.gitignore
vendored
3
Common/3dParty/hunspell/.gitignore
vendored
@ -1,5 +1,2 @@
|
||||
emsdk/
|
||||
hunspell/
|
||||
deploy/
|
||||
o
|
||||
hunspell.data
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "spell",
|
||||
"res_folder": "./deploy/spell",
|
||||
"wasm": true,
|
||||
"asm": true,
|
||||
"embed_mem_file": true,
|
||||
"run_before": "before.py",
|
||||
"run_after": "import sys;sys.path.append(\"../../../../build_tools/scripts\");import base;base.configure_common_apps();base.replaceInFile(\"./deploy/spell/spell.js\", \"__ATPOSTRUN__=[];\", \"__ATPOSTRUN__=[function(){self.onEngineInit();}];\");base.replaceInFile(\"./deploy/spell/spell.js\", \"function getBinaryPromise(){\", \"function getBinaryPromise2(){\");base.replaceInFile(\"./deploy/spell/spell_ie.js\", \"__ATPOSTRUN__=[];\", \"__ATPOSTRUN__=[function(){self.onEngineInit();}];\");base.replaceInFile(\"./deploy/spell/spell_ie.js\", \"function getBinaryPromise(){\", \"function getBinaryPromise2(){\");base.copy_file(\"./wasm/js/code.js\", \"./deploy/spell.js\");base.copy_file(\"./wasm/js/index.html\", \"./deploy/index.html\")",
|
||||
"base_js_content": "./wasm/js/spell.js",
|
||||
|
||||
"compiler_flags": [
|
||||
"-O3",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
"-Wno-unused-command-line-argument",
|
||||
"-s ALLOW_MEMORY_GROWTH=1",
|
||||
"-s FILESYSTEM=0",
|
||||
"-s ENVIRONMENT='web,worker'"
|
||||
],
|
||||
"exported_functions": [
|
||||
"_malloc",
|
||||
"_free",
|
||||
"_Spellchecker_Malloc",
|
||||
"_Spellchecker_Free",
|
||||
"_Spellchecker_Create",
|
||||
"_Spellchecker_Destroy",
|
||||
"_Spellchecker_AddDictionary",
|
||||
"_Spellchecker_RemoveDicrionary",
|
||||
"_Spellchecker_Load",
|
||||
"_Spellchecker_Spell",
|
||||
"_Spellchecker_Suggest",
|
||||
"_Spellchecker_RemoveEngine",
|
||||
"_Spellchecker_TotalAllocatedMemory"
|
||||
],
|
||||
"include_path": ["./hunspell/src/hunspell", "./wasm/src"],
|
||||
"define": ["WIN32", "NDEBUG", "HUNSPELL_STATIC", "BUILDING_LIBHUNSPELL", "HUNSPELL_WASM_MODULE"],
|
||||
"compile_files_array": [
|
||||
{
|
||||
"name": "h",
|
||||
"folder": "./hunspell/src/hunspell/",
|
||||
"files": ["affentry.cxx", "affixmgr.cxx", "csutil.cxx", "hashmgr.cxx", "hunspell.cxx", "hunzip.cxx", "phonet.cxx", "replist.cxx", "suggestmgr.cxx"]
|
||||
},
|
||||
{
|
||||
"name": "s",
|
||||
"folder": "./wasm/src/",
|
||||
"files": ["filemgr_wrapper_new.cxx", "base.cpp"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,33 +1,36 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* 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.
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* 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
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* 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.
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* 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
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "../../../../Common/3dParty/hunspell/hunspell/src/hunspell/hunspell.h"
|
||||
|
||||
@ -1,125 +0,0 @@
|
||||
function CSpellchecker(settings)
|
||||
{
|
||||
useWasm = false;
|
||||
var webAsmObj = window["WebAssembly"];
|
||||
if (typeof webAsmObj === "object")
|
||||
{
|
||||
if (typeof webAsmObj["Memory"] === "function")
|
||||
{
|
||||
if ((typeof webAsmObj["instantiateStreaming"] === "function") || (typeof webAsmObj["instantiate"] === "function"))
|
||||
useWasm = true;
|
||||
}
|
||||
}
|
||||
|
||||
var enginePath = "./spell/";
|
||||
if (settings && settings.enginePath)
|
||||
{
|
||||
enginePath = settings.enginePath;
|
||||
if (enginePath.substring(enginePath.length - 1) != "/")
|
||||
enginePath += "/";
|
||||
}
|
||||
|
||||
var dictionariesPath = "./../dictionaries";
|
||||
if (settings && settings.dictionariesPath)
|
||||
{
|
||||
dictionariesPath = settings.dictionariesPath;
|
||||
if (dictionariesPath.substring(dictionariesPath.length - 1) == "/")
|
||||
dictionariesPath = dictionariesPath.substr(0, dictionariesPath.length - 1);
|
||||
}
|
||||
|
||||
var isUseSharedWorker = !!window.SharedWorker;
|
||||
if (isUseSharedWorker && (false === settings.useShared))
|
||||
isUseSharedWorker = false;
|
||||
|
||||
var worker_src = useWasm ? "spell.js" : "spell_ie.js";
|
||||
worker_src = enginePath + worker_src;
|
||||
|
||||
var _worker = this;
|
||||
var _port = null;
|
||||
if (isUseSharedWorker)
|
||||
{
|
||||
this.worker = new SharedWorker(worker_src, "onlyoffice-spellchecker");
|
||||
_port = this.worker.port;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.worker = new Worker(worker_src);
|
||||
_port = this.worker;
|
||||
}
|
||||
|
||||
this.languages = {
|
||||
"1068" : "az_Latn_AZ",
|
||||
"1026" : "bg_BG",
|
||||
"1027" : "ca_ES",
|
||||
"2051" : "ca_ES_valencia",
|
||||
"1029" : "cs_CZ",
|
||||
"1030" : "da_DK",
|
||||
"3079" : "de_AT",
|
||||
"2055" : "de_CH",
|
||||
"1031" : "de_DE",
|
||||
"1032" : "el_GR",
|
||||
"3081" : "en_AU",
|
||||
"4105" : "en_CA",
|
||||
"2057" : "en_GB",
|
||||
"1033" : "en_US",
|
||||
"7177" : "en_ZA",
|
||||
"3082" : "es_ES",
|
||||
"1069" : "eu_ES",
|
||||
"1036" : "fr_FR",
|
||||
"1110" : "gl_ES",
|
||||
"1050" : "hr_HR",
|
||||
"1038" : "hu_HU",
|
||||
"1057" : "id_ID",
|
||||
"1040" : "it_IT",
|
||||
"1087" : "kk_KZ",
|
||||
"1042" : "ko_KR",
|
||||
"1134" : "lb_LU",
|
||||
"1063" : "lt_LT",
|
||||
"1062" : "lv_LV",
|
||||
"1104" : "mn_MN",
|
||||
"1044" : "nb_NO",
|
||||
"1043" : "nl_NL",
|
||||
"2068" : "nn_NO",
|
||||
"1045" : "pl_PL",
|
||||
"1046" : "pt_BR",
|
||||
"2070" : "pt_PT",
|
||||
"1048" : "ro_RO",
|
||||
"1049" : "ru_RU",
|
||||
"1051" : "sk_SK",
|
||||
"1060" : "sl_SI",
|
||||
"10266" : "sr_Cyrl_RS",
|
||||
"9242" : "sr_Latn_RS",
|
||||
"1053" : "sv_SE",
|
||||
"1055" : "tr_TR",
|
||||
"1058" : "uk_UA",
|
||||
"1066" : "vi_VN",
|
||||
"2067" : "nl_NL" // nl_BE
|
||||
};
|
||||
|
||||
_port.onmessage = function(message) {
|
||||
_worker.oncommand && _worker.oncommand(message.data);
|
||||
};
|
||||
_port.postMessage({ "type" : "init", "dictionaries_path" : dictionariesPath, "languages" : this.languages });
|
||||
|
||||
this.stop = function()
|
||||
{
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
};
|
||||
|
||||
this.command = function(message)
|
||||
{
|
||||
_port && _port.postMessage(message);
|
||||
};
|
||||
this.oncommand = function(message) { console.log(message); };
|
||||
|
||||
this.checkDictionary = function(lang) {
|
||||
return (undefined !== this.languages["" + lang]) ? true : false;
|
||||
};
|
||||
this.getLanguages = function() {
|
||||
var ret = [];
|
||||
for (var lang in this.languages)
|
||||
ret.push(lang);
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Demo of spellchecker</title>
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<script src="./spell.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.spellcheck = new CSpellchecker({
|
||||
enginePath : "./spell",
|
||||
dictionariesPath : "./../dictionaries"
|
||||
});
|
||||
|
||||
window.spellcheck.oncommand = function(message) {
|
||||
console.log(message);
|
||||
};
|
||||
|
||||
window.spellcheck.command({
|
||||
"type" : "spell",
|
||||
"usrLang" : [1033, 1033, 1049],
|
||||
"usrWords" : ["hello", "hellop", "привет"]
|
||||
});
|
||||
|
||||
window.spellcheck.command({
|
||||
"type" : "suggest",
|
||||
"usrLang" : [1033],
|
||||
"usrWords" : ["hellop"]
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,546 +0,0 @@
|
||||
var printErr = undefined;
|
||||
var FS = undefined;
|
||||
var print = undefined;
|
||||
|
||||
var fetch = self.fetch;
|
||||
var getBinaryPromise = null;
|
||||
if (self.AscDesktopEditor && document.currentScript && 0 == document.currentScript.src.indexOf("file:///"))
|
||||
{
|
||||
fetch = undefined; // fetch not support file:/// scheme
|
||||
getBinaryPromise = function() {
|
||||
var wasmPath = "ascdesktop://fonts/" + wasmBinaryFile.substr(8);
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', wasmPath, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
|
||||
if (xhr.overrideMimeType)
|
||||
xhr.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
else
|
||||
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||
|
||||
xhr.onload = function () {
|
||||
if (this.status == 200) {
|
||||
resolve(new Uint8Array(this.response));
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getBinaryPromise = function() {
|
||||
return getBinaryPromise2();
|
||||
}
|
||||
}
|
||||
|
||||
//polyfill
|
||||
|
||||
//module
|
||||
|
||||
self.spellchecker = null;
|
||||
function onMessageEvent(data, port)
|
||||
{
|
||||
if (data.type == "init")
|
||||
{
|
||||
if (self.spellchecker)
|
||||
return;
|
||||
self.spellchecker = new Spellchecker();
|
||||
self.spellchecker.languagesPath = data.dictionaries_path;
|
||||
var languages = data.languages;
|
||||
for (var i in languages)
|
||||
self.spellchecker.addDefaultLanguage(i, languages[i]);
|
||||
self.spellchecker.init();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.spellchecker)
|
||||
return;
|
||||
|
||||
self.spellchecker.messages.push(data);
|
||||
if (port)
|
||||
self.spellchecker.ports.push(port);
|
||||
|
||||
if (1 < self.spellchecker.messages.length)
|
||||
{
|
||||
// значит еще грузим что-то
|
||||
return;
|
||||
}
|
||||
|
||||
self.spellchecker.checkMessage();
|
||||
}
|
||||
|
||||
self.onconnect = function(e)
|
||||
{
|
||||
var port = e.ports[0];
|
||||
port.onmessage = function(e) {
|
||||
onMessageEvent(e.data, port);
|
||||
}
|
||||
};
|
||||
self.onmessage = function(e)
|
||||
{
|
||||
onMessageEvent(e.data);
|
||||
};
|
||||
self.engineInit = false;
|
||||
self.onEngineInit = function()
|
||||
{
|
||||
self.engineInit = true;
|
||||
if (self.spellchecker)
|
||||
{
|
||||
self.spellchecker.init();
|
||||
self.spellchecker.checkMessage();
|
||||
}
|
||||
};
|
||||
|
||||
function Dictionary()
|
||||
{
|
||||
this.dataAff = null;
|
||||
this.dataDic = null;
|
||||
this.status = 0;
|
||||
this.id = 0;
|
||||
this.language = null;
|
||||
|
||||
this.load_file = function(src, params)
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.sender = this;
|
||||
xhr.params = params;
|
||||
xhr.open('GET', src, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
if (xhr.overrideMimeType)
|
||||
xhr.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
else
|
||||
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||
|
||||
xhr.onload = function()
|
||||
{
|
||||
if (xhr.sender.status >= 2)
|
||||
return;
|
||||
|
||||
if (this.response && this.status == 200)
|
||||
{
|
||||
var uintData = new Uint8Array(this.response);
|
||||
switch (this.params)
|
||||
{
|
||||
case "aff":
|
||||
{
|
||||
this.sender.dataAff = uintData;
|
||||
break;
|
||||
}
|
||||
case "dic":
|
||||
{
|
||||
this.sender.dataDic = uintData;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
xhr.sender.status++;
|
||||
}
|
||||
|
||||
if (xhr.sender.status == 2)
|
||||
{
|
||||
self.spellchecker.onLoadDictionary(this.sender);
|
||||
}
|
||||
};
|
||||
xhr.onerror = function()
|
||||
{
|
||||
xhr.sender.status = 2;
|
||||
self.spellchecker.onLoadDictionary(this.sender);
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
};
|
||||
|
||||
this.load = function()
|
||||
{
|
||||
if (!this.language)
|
||||
{
|
||||
this.status = 2;
|
||||
self.spellchecker.onLoadDictionary(this);
|
||||
return;
|
||||
}
|
||||
this.load_file(self.spellchecker.languagesPath + "/" + this.language.aff, "aff");
|
||||
this.load_file(self.spellchecker.languagesPath + "/" + this.language.dic, "dic");
|
||||
};
|
||||
|
||||
this.freeUnusedData = function()
|
||||
{
|
||||
this.dataAff = null;
|
||||
this.dataDic = null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function Spellchecker()
|
||||
{
|
||||
this.languagesPath = "";
|
||||
this.languages = {};
|
||||
this.readyLanguages = {};
|
||||
this.messages = [];
|
||||
this.ports = [];
|
||||
this.tmpStrings = new ArrayBuffer(1000);
|
||||
this.engine = 0;
|
||||
|
||||
this.maxEngines = 3;
|
||||
this.maxDictionaries = 5;
|
||||
this.languageQueue = [];
|
||||
|
||||
this.maxDictionariesHandler = function()
|
||||
{
|
||||
if (this.languageQueue.length > this.maxDictionaries)
|
||||
{
|
||||
var toDelete = this.languageQueue.length - this.maxDictionaries;
|
||||
for (let i = 0; i < toDelete; i++)
|
||||
{
|
||||
var lk = this.languageQueue[0];
|
||||
this.deleteDictionaty(lk);
|
||||
delete this.readyLanguages[lk];
|
||||
this.languageQueue.shift();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.deleteDictionaty = function(lk)
|
||||
{
|
||||
if (!lk)
|
||||
return;
|
||||
|
||||
var affID = lk + ".aff";
|
||||
var dicID = lk + ".dic"
|
||||
var engineID = affID + dicID;
|
||||
var engineIDptr = this.allocString(engineID);
|
||||
var langAffptr = this.allocString(affID);
|
||||
var langDicptr = this.allocString(dicID);
|
||||
Module._Spellchecker_RemoveDicrionary(this.engine, langAffptr);
|
||||
Module._Spellchecker_RemoveDicrionary(this.engine, langDicptr);
|
||||
Module._Spellchecker_RemoveEngine(this.engine, engineIDptr);
|
||||
this.freeString(engineIDptr);
|
||||
this.freeString(langAffptr);
|
||||
this.freeString(langDicptr);
|
||||
};
|
||||
|
||||
this.init = function()
|
||||
{
|
||||
if (0 == this.engine && self.engineInit)
|
||||
this.engine = this.createEngine();
|
||||
};
|
||||
|
||||
this.addDefaultLanguage = function(id, path)
|
||||
{
|
||||
this.languages["" + id] = {
|
||||
aff : path + "/" + path + ".aff",
|
||||
dic : path + "/" + path + ".dic"
|
||||
};
|
||||
};
|
||||
|
||||
this.onLoadDictionary = function(dictionary)
|
||||
{
|
||||
if (!dictionary.dataAff || !dictionary.dataDic)
|
||||
{
|
||||
this.checkMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
var aff_path = this.allocString(dictionary.id + ".aff");
|
||||
var dic_path = this.allocString(dictionary.id + ".dic");
|
||||
|
||||
var pointerAff = Module._Spellchecker_Malloc(dictionary.dataAff.length);
|
||||
Module.HEAP8.set(dictionary.dataAff, pointerAff);
|
||||
var pointerDic = Module._Spellchecker_Malloc(dictionary.dataDic.length);
|
||||
Module.HEAP8.set(dictionary.dataDic, pointerDic);
|
||||
|
||||
Module._Spellchecker_AddDictionary(this.engine, aff_path, pointerAff, dictionary.dataAff.length);
|
||||
Module._Spellchecker_AddDictionary(this.engine, dic_path, pointerDic, dictionary.dataDic.length);
|
||||
|
||||
this.freeString(aff_path);
|
||||
this.freeString(dic_path);
|
||||
|
||||
dictionary.freeUnusedData();
|
||||
|
||||
this.checkMessage();
|
||||
};
|
||||
|
||||
this.checkMessage = function()
|
||||
{
|
||||
if (0 == this.messages.length || !self.engineInit)
|
||||
return;
|
||||
|
||||
var m = this.messages[0];
|
||||
var isReady = true;
|
||||
for (var indexLang = 0, lenLangs = m.usrLang.length; indexLang < lenLangs; indexLang++)
|
||||
{
|
||||
var lang_key = "" + m.usrLang[indexLang];
|
||||
var readyLang = this.readyLanguages[lang_key];
|
||||
if (!readyLang)
|
||||
{
|
||||
// начнем грузить
|
||||
var langToReady = new Dictionary();
|
||||
langToReady.id = lang_key;
|
||||
langToReady.language = this.languages[lang_key];
|
||||
this.readyLanguages[lang_key] = langToReady;
|
||||
this.languageQueue.push(lang_key); // push lang info into the queue
|
||||
langToReady.load();
|
||||
|
||||
isReady = false;
|
||||
break;
|
||||
}
|
||||
else if (readyLang.status != 2)
|
||||
{
|
||||
// ждем
|
||||
isReady = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// все готово.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isReady)
|
||||
{
|
||||
// ждем
|
||||
return;
|
||||
}
|
||||
|
||||
switch (m.type)
|
||||
{
|
||||
case "spell":
|
||||
{
|
||||
this.Spell(m);
|
||||
break;
|
||||
}
|
||||
case "suggest":
|
||||
{
|
||||
this.Suggest(m);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.maxDictionariesHandler();
|
||||
this.messages.shift();
|
||||
};
|
||||
|
||||
this.allocString = function(string)
|
||||
{
|
||||
var inputLen = string.length;
|
||||
var testLen = 6 * inputLen + 1;
|
||||
if (testLen > this.tmpStrings.byteLength)
|
||||
this.tmpStrings = new ArrayBuffer(testLen);
|
||||
|
||||
var code = 0;
|
||||
var index = 0;
|
||||
|
||||
var outputIndex = 0;
|
||||
var outputDataTmp = new Uint8Array(this.tmpStrings);
|
||||
var outputData = outputDataTmp;
|
||||
|
||||
while (index < inputLen)
|
||||
{
|
||||
code = string.charCodeAt(index++);
|
||||
if (code >= 0xD800 && code <= 0xDFFF && index < inputLen)
|
||||
{
|
||||
code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & string.charCodeAt(index++)));
|
||||
}
|
||||
|
||||
if (code < 0x80)
|
||||
{
|
||||
outputData[outputIndex++] = code;
|
||||
}
|
||||
else if (code < 0x0800)
|
||||
{
|
||||
outputData[outputIndex++] = 0xC0 | (code >> 6);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x10000)
|
||||
{
|
||||
outputData[outputIndex++] = 0xE0 | (code >> 12);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x1FFFFF)
|
||||
{
|
||||
outputData[outputIndex++] = 0xF0 | (code >> 18);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 12) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x3FFFFFF)
|
||||
{
|
||||
outputData[outputIndex++] = 0xF8 | (code >> 24);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 18) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 12) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x7FFFFFFF)
|
||||
{
|
||||
outputData[outputIndex++] = 0xFC | (code >> 30);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 24) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 18) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 12) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
}
|
||||
|
||||
outputData[outputIndex++] = 0;
|
||||
|
||||
var tmpBuffer = new Uint8Array(this.tmpStrings, 0, outputIndex);
|
||||
var pointer = Module._Spellchecker_Malloc(outputIndex);
|
||||
Module.HEAP8.set(tmpBuffer, pointer);
|
||||
return pointer;
|
||||
};
|
||||
this.freeString = function(stringPointer)
|
||||
{
|
||||
Module._Spellchecker_Free(stringPointer);
|
||||
};
|
||||
|
||||
this.readFromUtf8 = function(buffer, start, len)
|
||||
{
|
||||
var result = "";
|
||||
var index = start;
|
||||
var end = start + len;
|
||||
while (index < end)
|
||||
{
|
||||
var u0 = buffer[index++];
|
||||
if (!(u0 & 128))
|
||||
{
|
||||
result += String.fromCharCode(u0);
|
||||
continue;
|
||||
}
|
||||
var u1 = buffer[index++] & 63;
|
||||
if ((u0 & 224) == 192)
|
||||
{
|
||||
result += String.fromCharCode((u0 & 31) << 6 | u1);
|
||||
continue;
|
||||
}
|
||||
var u2 = buffer[index++] & 63;
|
||||
if ((u0 & 240) == 224)
|
||||
{
|
||||
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
||||
}
|
||||
else
|
||||
{
|
||||
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | buffer[index++] & 63;
|
||||
}
|
||||
if (u0 < 65536)
|
||||
{
|
||||
result += String.fromCharCode(u0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var ch = u0 - 65536;
|
||||
result += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
this.readSuggests = function(pointer)
|
||||
{
|
||||
if (0 == pointer)
|
||||
return [];
|
||||
|
||||
var lenArray = new Int32Array(Module["HEAP8"].buffer, pointer, 4);
|
||||
var len = lenArray[0];
|
||||
len -= 4;
|
||||
|
||||
var buffer = new Uint8Array(Module["HEAP8"].buffer, pointer + 4, len);
|
||||
var index = 0;
|
||||
var ret = [];
|
||||
while (index < len)
|
||||
{
|
||||
var lenRec = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24;
|
||||
index += 4;
|
||||
ret.push(this.readFromUtf8(buffer, index, lenRec));
|
||||
index += lenRec;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
this.createEngine = function()
|
||||
{
|
||||
return Module._Spellchecker_Create(this.maxEngines);
|
||||
};
|
||||
this.destroyEngine = function()
|
||||
{
|
||||
Module._Spellchecker_Destroy();
|
||||
};
|
||||
|
||||
this.Spell = function(data)
|
||||
{
|
||||
var len = Math.min(data.usrLang.length, data.usrWords.length);
|
||||
if (0 == len)
|
||||
return;
|
||||
data.usrCorrect = new Array(len);
|
||||
var curLang = "";
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
if (curLang != ("" + data.usrLang[i]))
|
||||
{
|
||||
curLang = "" + data.usrLang[i];
|
||||
var aff = this.allocString(curLang + ".aff");
|
||||
var dic = this.allocString(curLang + ".dic");
|
||||
ret = Module._Spellchecker_Load(this.engine, aff, dic);
|
||||
this.freeString(aff);
|
||||
this.freeString(dic);
|
||||
}
|
||||
var word = this.allocString(data.usrWords[i]);
|
||||
data.usrCorrect[i] = (1 == Module._Spellchecker_Spell(this.engine, word)) ? true : false;
|
||||
this.freeString(word);
|
||||
}
|
||||
|
||||
this.sendAnswer(data);
|
||||
};
|
||||
|
||||
this.Suggest = function(data)
|
||||
{
|
||||
var len = Math.min(data.usrLang.length, data.usrWords.length);
|
||||
if (0 == len)
|
||||
return;
|
||||
data.usrSuggest = new Array(len);
|
||||
var curLang = "";
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
if (curLang != ("" + data.usrLang[i]))
|
||||
{
|
||||
curLang = "" + data.usrLang[i];
|
||||
var aff = this.allocString(curLang + ".aff");
|
||||
var dic = this.allocString(curLang + ".dic");
|
||||
|
||||
ret = Module._Spellchecker_Load(this.engine, aff, dic);
|
||||
|
||||
this.freeString(aff);
|
||||
this.freeString(dic);
|
||||
}
|
||||
var word = this.allocString(data.usrWords[i]);
|
||||
var pointerSuggests = Module._Spellchecker_Suggest(this.engine, word);
|
||||
data.usrSuggest[i] = this.readSuggests(pointerSuggests);
|
||||
this.freeString(word);
|
||||
}
|
||||
|
||||
this.sendAnswer(data);
|
||||
};
|
||||
|
||||
this.sendAnswer = function(data)
|
||||
{
|
||||
if (self.spellchecker.ports.length == 0)
|
||||
{
|
||||
self.postMessage(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
var port = self.spellchecker.ports.shift();
|
||||
port.postMessage(data);
|
||||
}
|
||||
|
||||
setTimeout(function(){
|
||||
self.spellchecker.checkMessage();
|
||||
}, 1);
|
||||
};
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
#include "base.h"
|
||||
#include "engine.h"
|
||||
|
||||
std::map<std::string, CFileMemory*> CSpellchecker::g_dictionaries;
|
||||
|
||||
void* Spellchecker_Malloc(unsigned int size)
|
||||
{
|
||||
return ::malloc(size);
|
||||
}
|
||||
void Spellchecker_Free(void* p)
|
||||
{
|
||||
if (p)
|
||||
::free(p);
|
||||
}
|
||||
|
||||
CSpellchecker* Spellchecker_Create(size_t max_engine_number)
|
||||
{
|
||||
return new CSpellchecker(max_engine_number);
|
||||
}
|
||||
void Spellchecker_Destroy(CSpellchecker* p)
|
||||
{
|
||||
delete p;
|
||||
}
|
||||
|
||||
int Spellchecker_AddDictionary(CSpellchecker* p, const char* id, unsigned char* data, unsigned int size)
|
||||
{
|
||||
if (!p)
|
||||
return 0;
|
||||
return p->AddDictionary(id, data, size);
|
||||
}
|
||||
void Spellchecker_RemoveDicrionary(CSpellchecker* p, const char* id)
|
||||
{
|
||||
if (!p)
|
||||
return;
|
||||
p->RemoveDictionary(id);
|
||||
}
|
||||
|
||||
int Spellchecker_Load(CSpellchecker* p, const char* aff_id, const char* dic_id)
|
||||
{
|
||||
if (!p) return 0;
|
||||
return p->Load(aff_id, dic_id);
|
||||
}
|
||||
int Spellchecker_Spell(CSpellchecker* p, const char* word_utf8)
|
||||
{
|
||||
return p->Spell(word_utf8);
|
||||
}
|
||||
unsigned char* Spellchecker_Suggest(CSpellchecker* p, const char* word_utf8)
|
||||
{;
|
||||
return p->Suggest(word_utf8);
|
||||
}
|
||||
void Spellchecker_RemoveEngine(CSpellchecker* p, const char* sid)
|
||||
{
|
||||
p->RemoveEngine(sid);
|
||||
}
|
||||
|
||||
double Spellchecker_TotalAllocatedMemory()
|
||||
{
|
||||
struct mallinfo a;
|
||||
a = mallinfo(); // Debug
|
||||
return (double)a.uordblks / 1000. / 1000.;
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
#include <memory>
|
||||
#include <malloc.h>
|
||||
class CSpellchecker;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void* Spellchecker_Malloc(unsigned int size);
|
||||
void Spellchecker_Free(void* p);
|
||||
|
||||
CSpellchecker* Spellchecker_Create(size_t max_engine_number);
|
||||
void Spellchecker_Destroy(CSpellchecker*);
|
||||
|
||||
int Spellchecker_AddDictionary(CSpellchecker* p, const char* sid, unsigned char* data, unsigned int size);
|
||||
void Spellchecker_RemoveDicrionary(CSpellchecker* p, const char* sid);
|
||||
|
||||
int Spellchecker_Load(CSpellchecker* p, const char* aff_id, const char* dic_id);
|
||||
int Spellchecker_Spell(CSpellchecker* p, const char* word_utf8);
|
||||
void Spellchecker_RemoveEngine(CSpellchecker* p, const char* sid);
|
||||
unsigned char* Spellchecker_Suggest(CSpellchecker* p, const char* word_utf8);
|
||||
|
||||
double Spellchecker_TotalAllocatedMemory(); //Debug
|
||||
}
|
||||
@ -1,355 +0,0 @@
|
||||
#include "hunspell.h"
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include "base.h"
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <memory.h>
|
||||
//#define WASM_LOGGING fprintf
|
||||
|
||||
class CFileMemory
|
||||
{
|
||||
public:
|
||||
unsigned char* data;
|
||||
unsigned int len;
|
||||
|
||||
public:
|
||||
CFileMemory(unsigned char* _data = NULL, unsigned int _len = 0)
|
||||
{
|
||||
data = _data;
|
||||
len = _len;
|
||||
}
|
||||
~CFileMemory()
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
Spellchecker_Free(data);
|
||||
data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CSuggests
|
||||
{
|
||||
protected:
|
||||
char* m_pData;
|
||||
size_t m_lSize;
|
||||
|
||||
char* m_pDataCur;
|
||||
size_t m_lSizeCur;
|
||||
|
||||
public:
|
||||
CSuggests()
|
||||
{
|
||||
m_pData = NULL;
|
||||
m_lSize = 0;
|
||||
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = m_lSize;
|
||||
}
|
||||
CSuggests(const size_t& nLen)
|
||||
{
|
||||
m_lSize = nLen;
|
||||
m_pData = (char*)malloc(m_lSize * sizeof(char));
|
||||
|
||||
m_lSizeCur = 0;
|
||||
m_pDataCur = m_pData;
|
||||
}
|
||||
virtual ~CSuggests()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
inline void AddSize(const size_t& nSize)
|
||||
{
|
||||
if (NULL == m_pData)
|
||||
{
|
||||
m_lSize = 1000;
|
||||
if (nSize > m_lSize)
|
||||
m_lSize = nSize;
|
||||
|
||||
m_pData = (char*)malloc(m_lSize * sizeof(char));
|
||||
|
||||
m_lSizeCur = 0;
|
||||
m_pDataCur = m_pData;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((m_lSizeCur + nSize) > m_lSize)
|
||||
{
|
||||
while ((m_lSizeCur + nSize) > m_lSize)
|
||||
{
|
||||
m_lSize *= 2;
|
||||
}
|
||||
|
||||
char* pRealloc = (char*)realloc(m_pData, m_lSize * sizeof(char));
|
||||
if (NULL != pRealloc)
|
||||
{
|
||||
// реаллок сработал
|
||||
m_pData = pRealloc;
|
||||
m_pDataCur = m_pData + m_lSizeCur;
|
||||
}
|
||||
else
|
||||
{
|
||||
char* pMalloc = (char*)malloc(m_lSize * sizeof(char));
|
||||
memcpy(pMalloc, m_pData, m_lSizeCur * sizeof(char));
|
||||
|
||||
free(m_pData);
|
||||
m_pData = pMalloc;
|
||||
m_pDataCur = m_pData + m_lSizeCur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void AddInt(const unsigned int& value)
|
||||
{
|
||||
AddSize(4);
|
||||
memcpy(m_pDataCur, &value, sizeof(unsigned int));
|
||||
m_pDataCur += 4;
|
||||
m_lSizeCur += 4;
|
||||
}
|
||||
void WriteString(const char* value, const unsigned int& len)
|
||||
{
|
||||
AddSize(len + 4);
|
||||
memcpy(m_pDataCur, &len, sizeof(unsigned int));
|
||||
m_pDataCur += 4;
|
||||
m_lSizeCur += 4;
|
||||
memcpy(m_pDataCur, value, len);
|
||||
m_pDataCur += len;
|
||||
m_lSizeCur += len;
|
||||
}
|
||||
unsigned char* GetBuffer()
|
||||
{
|
||||
return (unsigned char*)m_pData;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
free(m_pData);
|
||||
|
||||
m_pData = NULL;
|
||||
m_lSize = 0;
|
||||
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
}
|
||||
void ClearNoAttack()
|
||||
{
|
||||
m_pDataCur = m_pData;
|
||||
m_lSizeCur = 0;
|
||||
}
|
||||
unsigned int GetSize()
|
||||
{
|
||||
return (unsigned int)m_lSizeCur;
|
||||
}
|
||||
|
||||
void SkipLen()
|
||||
{
|
||||
AddInt(0);
|
||||
}
|
||||
void WriteLen()
|
||||
{
|
||||
unsigned int len = (unsigned int)m_lSizeCur;
|
||||
memcpy(m_pData, &len, sizeof(unsigned int));
|
||||
}
|
||||
};
|
||||
|
||||
class LimitedEngineMap
|
||||
{
|
||||
public:
|
||||
LimitedEngineMap(size_t _maxEngineNumer)
|
||||
{
|
||||
m_nMaxEngineNumber = _maxEngineNumer;
|
||||
}
|
||||
~LimitedEngineMap()
|
||||
{
|
||||
for (std::pair<const std::string, Hunhandle*> &i : m_mapDictionariesEngines)
|
||||
{
|
||||
Hunspell_destroy(i.second);
|
||||
}
|
||||
m_mapDictionariesEngines.clear();
|
||||
}
|
||||
std::map<std::string, Hunhandle*>::iterator find(const std::string &to_find)
|
||||
{
|
||||
return m_mapDictionariesEngines.find(to_find);
|
||||
}
|
||||
std::map<std::string, Hunhandle*>::iterator end()
|
||||
{
|
||||
return m_mapDictionariesEngines.end();
|
||||
}
|
||||
std::pair<std::map<std::string, Hunhandle*>::iterator,bool> insert(const std::pair<std::string, Hunhandle*> &data)
|
||||
{
|
||||
if (m_qEngineQueue.size() == m_nMaxEngineNumber)
|
||||
{
|
||||
if (m_mapDictionariesEngines.find(m_qEngineQueue.front()) !=
|
||||
m_mapDictionariesEngines.end())
|
||||
{
|
||||
Hunspell_destroy(m_mapDictionariesEngines[m_qEngineQueue.front()]);
|
||||
m_mapDictionariesEngines.erase(m_qEngineQueue.front());
|
||||
m_qEngineQueue.pop();
|
||||
}
|
||||
|
||||
}
|
||||
m_qEngineQueue.push(data.first);
|
||||
return m_mapDictionariesEngines.insert(data);
|
||||
}
|
||||
void RemoveEngine(const char* id)
|
||||
{
|
||||
if (m_mapDictionariesEngines.find(id) == m_mapDictionariesEngines.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::queue<std::string> new_queue;;
|
||||
Hunspell_destroy(m_mapDictionariesEngines[id]);
|
||||
m_mapDictionariesEngines.erase(id);
|
||||
while (!m_qEngineQueue.empty())
|
||||
{
|
||||
if (m_qEngineQueue.front() != id)
|
||||
{
|
||||
new_queue.push(m_qEngineQueue.front());
|
||||
}
|
||||
m_qEngineQueue.pop();
|
||||
}
|
||||
m_qEngineQueue = new_queue;
|
||||
}
|
||||
private:
|
||||
std::map<std::string, Hunhandle*> m_mapDictionariesEngines;
|
||||
std::queue<std::string> m_qEngineQueue;
|
||||
size_t m_nMaxEngineNumber;
|
||||
};
|
||||
|
||||
class CSpellchecker
|
||||
{
|
||||
public:
|
||||
static std::map<std::string, CFileMemory*> g_dictionaries;
|
||||
|
||||
public:
|
||||
LimitedEngineMap m_oDictionariesEngines;
|
||||
std::string m_sCurrentDictionaryId;
|
||||
Hunhandle* m_pCurrentDictionary;
|
||||
CSuggests m_oSuggests;
|
||||
|
||||
public:
|
||||
CSpellchecker(size_t _MaxEngineNumber) :
|
||||
m_oDictionariesEngines(_MaxEngineNumber)
|
||||
{
|
||||
m_sCurrentDictionaryId = "";
|
||||
m_pCurrentDictionary = NULL;
|
||||
}
|
||||
~CSpellchecker()
|
||||
{
|
||||
|
||||
m_pCurrentDictionary = NULL;
|
||||
|
||||
for (std::pair<const std::string, CFileMemory*> &i : g_dictionaries)
|
||||
{
|
||||
delete i.second;
|
||||
}
|
||||
g_dictionaries.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
int AddDictionary(const char*& id, unsigned char* data, unsigned int size)
|
||||
{
|
||||
#ifdef WASM_LOGGING
|
||||
WASM_LOGGING(stderr, "add dictionary: [%s, %d]\n", id, (int)size);
|
||||
#endif
|
||||
|
||||
RemoveDictionary(id);
|
||||
g_dictionaries.insert(std::pair<std::string, CFileMemory*>(std::string(id), new CFileMemory(data, size)));
|
||||
return 1;
|
||||
}
|
||||
void RemoveDictionary(const char*& id)
|
||||
{
|
||||
std::string sid(id);
|
||||
std::map<std::string, CFileMemory*>::iterator iter = g_dictionaries.find(sid);
|
||||
if (iter != g_dictionaries.end())
|
||||
{
|
||||
CFileMemory* file = iter->second;
|
||||
g_dictionaries.erase(iter);
|
||||
delete file;
|
||||
}
|
||||
}
|
||||
static CFileMemory* Get(const char*& id)
|
||||
{
|
||||
std::map<std::string, CFileMemory*>::iterator iter = g_dictionaries.find(std::string(id));
|
||||
if (iter == g_dictionaries.end())
|
||||
return NULL;
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
int Load(const char*& aff_id, const char*& dic_id)
|
||||
{
|
||||
#ifdef WASM_LOGGING
|
||||
WASM_LOGGING(stderr, "load: [%s, %s]\n", aff_id, dic_id);
|
||||
#endif
|
||||
return (NULL != SetLanguage(aff_id, dic_id)) ? 1 : 0;
|
||||
}
|
||||
int Spell(const char*& word)
|
||||
{
|
||||
#ifdef WASM_LOGGING
|
||||
WASM_LOGGING(stderr, "spell: [%s]\n", word);
|
||||
#endif
|
||||
if (!m_pCurrentDictionary)
|
||||
return 0;
|
||||
return Hunspell_spell(m_pCurrentDictionary, word);
|
||||
}
|
||||
unsigned char* Suggest(const char*& word)
|
||||
{
|
||||
#ifdef WASM_LOGGING
|
||||
WASM_LOGGING(stderr, "suggest: [%s]\n", word);
|
||||
#endif
|
||||
if (!m_pCurrentDictionary)
|
||||
return NULL;
|
||||
|
||||
char** pSuggest;
|
||||
int nSuggestCount = Hunspell_suggest(m_pCurrentDictionary, &pSuggest, word);
|
||||
|
||||
m_oSuggests.ClearNoAttack();
|
||||
m_oSuggests.SkipLen();
|
||||
|
||||
for (int i = 0; i < nSuggestCount; ++i)
|
||||
{
|
||||
m_oSuggests.WriteString(pSuggest[i], (unsigned int)strlen(pSuggest[i]));
|
||||
}
|
||||
|
||||
m_oSuggests.WriteLen();
|
||||
|
||||
if (0 < nSuggestCount)
|
||||
Hunspell_free_list(m_pCurrentDictionary, &pSuggest, nSuggestCount);
|
||||
|
||||
return m_oSuggests.GetBuffer();
|
||||
}
|
||||
void RemoveEngine(const char* id)
|
||||
{
|
||||
m_oDictionariesEngines.RemoveEngine(id);
|
||||
if (m_sCurrentDictionaryId == id)
|
||||
{
|
||||
m_sCurrentDictionaryId = "";
|
||||
m_pCurrentDictionary = NULL;
|
||||
}
|
||||
}
|
||||
protected:
|
||||
Hunhandle* SetLanguage(const std::string& aff_id, const std::string& dic_id)
|
||||
{
|
||||
if ((aff_id + dic_id) == m_sCurrentDictionaryId)
|
||||
return m_pCurrentDictionary;
|
||||
|
||||
m_sCurrentDictionaryId = aff_id + dic_id;
|
||||
m_pCurrentDictionary = NULL;
|
||||
|
||||
std::map<std::string, Hunhandle*>::iterator iterEngine = m_oDictionariesEngines.find(m_sCurrentDictionaryId);
|
||||
if (iterEngine != m_oDictionariesEngines.end())
|
||||
{
|
||||
m_pCurrentDictionary = iterEngine->second;
|
||||
return m_pCurrentDictionary;
|
||||
}
|
||||
|
||||
Hunhandle* pDictionary = Hunspell_create(aff_id.c_str(), dic_id.c_str());
|
||||
m_oDictionariesEngines.insert(std::pair<std::string, Hunhandle*>(m_sCurrentDictionaryId, pDictionary));
|
||||
m_pCurrentDictionary = pDictionary;
|
||||
return m_pCurrentDictionary;
|
||||
}
|
||||
};
|
||||
@ -1,58 +0,0 @@
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "filemgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#include "./engine.h"
|
||||
|
||||
int FileMgr::fail(const char * err, const char * par) {
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char * file, const char * key)
|
||||
: hin(NULL), fin(NULL), linenum(0)
|
||||
{
|
||||
in[0] = '\0';
|
||||
|
||||
CFileMemory* file_memory = CSpellchecker::Get(file);
|
||||
if (!file_memory)
|
||||
{
|
||||
fail(MSG_OPEN, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
size = file_memory->len;
|
||||
memory = (char*)file_memory->data;
|
||||
}
|
||||
}
|
||||
|
||||
FileMgr::~FileMgr()
|
||||
{
|
||||
if (fin) fclose(fin);
|
||||
if (hin) delete hin;
|
||||
}
|
||||
|
||||
char * FileMgr::getline() {
|
||||
if(index >= size)
|
||||
return NULL;
|
||||
int i = 0,
|
||||
l = BUFSIZE -1;
|
||||
for(;index < size && memory[index] != '\n' && memory[index] != EOF && i <= l; index++, i++)
|
||||
in[i] = memory[index];
|
||||
in[i] = '\0';
|
||||
index++;
|
||||
if(index < size)
|
||||
linenum++;
|
||||
return strdup(in);
|
||||
}
|
||||
|
||||
int FileMgr::getlinenum() {
|
||||
return linenum;
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
//#include "license.hunspell"
|
||||
//#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "./filemgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#include "./engine.h"
|
||||
|
||||
int FileMgr::fail(const char *err, const char *par)
|
||||
{
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char *file, const char *key)
|
||||
: hin(NULL), linenum(0), memin(NULL)
|
||||
{
|
||||
in[0] = '\0';
|
||||
|
||||
CFileMemory *file_memory = CSpellchecker::Get(file);
|
||||
if (!file_memory)
|
||||
{
|
||||
fail(MSG_OPEN, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
memin.from_buffer((char *)file_memory->data, file_memory->len);
|
||||
}
|
||||
}
|
||||
|
||||
FileMgr::~FileMgr()
|
||||
{
|
||||
if (hin)
|
||||
delete hin;
|
||||
}
|
||||
|
||||
bool FileMgr::getline(std::string &dest)
|
||||
{
|
||||
bool ret = memin.get_line(dest);
|
||||
if (ret)
|
||||
++linenum;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int FileMgr::getlinenum()
|
||||
{
|
||||
return linenum;
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
#include "./base.h"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
CSpellchecker* spell = Spellchecker_Create(100);
|
||||
|
||||
FILE* fAff = fopen("en_GB.aff", "rb");
|
||||
fseek(fAff, 0, SEEK_END);
|
||||
unsigned int nAffSize = (unsigned int)ftell(fAff);
|
||||
fseek(fAff, 0, SEEK_SET);
|
||||
unsigned char* pAffData = (unsigned char*)Spellchecker_Malloc(nAffSize);
|
||||
size_t nAffSizeRead = fread((void*)pAffData, 1, (size_t)nAffSize, fAff);
|
||||
fclose(fAff);
|
||||
|
||||
FILE* fDic = fopen("en_GB.dic", "rb");
|
||||
fseek(fDic, 0, SEEK_END);
|
||||
unsigned int nDicSize = (unsigned int)ftell(fDic);
|
||||
fseek(fDic, 0, SEEK_SET);
|
||||
unsigned char* pDicData = (unsigned char*)Spellchecker_Malloc(nDicSize);
|
||||
size_t nDicSizeRead = fread((void*)pDicData, 1, (size_t)nDicSize, fDic);
|
||||
fclose(fDic);
|
||||
|
||||
int bIsAdd1 = Spellchecker_AddDictionary(spell, "en_US.aff", pAffData, nAffSize);
|
||||
int bIsAdd2 = Spellchecker_AddDictionary(spell, "en_US.dic", pDicData, nDicSize);
|
||||
while(1) {
|
||||
Spellchecker_Load(spell, "en_US.aff", "en_US.dic");
|
||||
Spellchecker_RemoveEngine(spell, "en_US.affen_US.dic");
|
||||
std::cout << Spellchecker_Debug() << std::endl;
|
||||
}
|
||||
|
||||
// int nCheck1 = Spellchecker_Spell(spell, "hello");
|
||||
// int nCheck2 = Spellchecker_Spell(spell, "hellop");
|
||||
// unsigned char* pSuggestData = Spellchecker_Suggest(spell, "hellop");
|
||||
Spellchecker_Destroy(spell);
|
||||
return 0;
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
class string_buffer_stream
|
||||
{
|
||||
private:
|
||||
char* m_buffer;
|
||||
unsigned int m_pos;
|
||||
unsigned int m_size;
|
||||
|
||||
public:
|
||||
string_buffer_stream(char* buf = NULL, unsigned int len = 0)
|
||||
{
|
||||
m_buffer = buf;
|
||||
m_pos = 0;
|
||||
m_size = len;
|
||||
}
|
||||
void from_buffer(char* buf, unsigned int len)
|
||||
{
|
||||
m_buffer = buf;
|
||||
m_pos = 0;
|
||||
m_size = len;
|
||||
}
|
||||
|
||||
// emulate
|
||||
// https://en.cppreference.com/w/cpp/string/basic_string/getline
|
||||
bool get_line(std::string& data)
|
||||
{
|
||||
data.erase();
|
||||
|
||||
if (m_pos >= m_size)
|
||||
return false;
|
||||
|
||||
while (m_pos < m_size)
|
||||
{
|
||||
char c = m_buffer[m_pos++];
|
||||
if (c == '\n')
|
||||
break;
|
||||
if (c == '\r')
|
||||
{
|
||||
if (m_pos < m_size && m_buffer[m_pos] == '\n')
|
||||
++m_pos;
|
||||
break;
|
||||
}
|
||||
data += c;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@ -1,14 +0,0 @@
|
||||
import sys
|
||||
sys.path.append("../../../../../../build_tools/scripts")
|
||||
import base
|
||||
|
||||
base.configure_common_apps()
|
||||
base.replaceInFile("../deploy/engine/hyphen.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[onLoadModule];")
|
||||
base.replaceInFile("../deploy/engine/hyphen_ie.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[onLoadModule];")
|
||||
base.replaceInFile("../deploy/engine/hyphen.js", "__ATPOSTRUN__ = [];", "__ATPOSTRUN__=[onLoadModule];")
|
||||
base.replaceInFile("../deploy/engine/hyphen_ie.js", "__ATPOSTRUN__ = [];", "__ATPOSTRUN__=[onLoadModule];")
|
||||
|
||||
base.replaceInFile("../deploy/engine/hyphen.js", "function getBinaryPromise()", "function getBinaryPromise2()")
|
||||
base.replaceInFile("../deploy/engine/hyphen_ie.js", "function getBinaryPromise()", "function getBinaryPromise2()")
|
||||
|
||||
base.copy_file("../library.js", "../deploy/hyphen.js")
|
||||
@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "hyphen",
|
||||
"res_folder": "../deploy/engine",
|
||||
"wasm": true,
|
||||
"asm": true,
|
||||
"embed_mem_file": true,
|
||||
"run_before": "",
|
||||
"run_after": "after.py",
|
||||
"base_js_content": "../module.js",
|
||||
|
||||
"compiler_flags": [
|
||||
"-O3",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
"-Wno-unused-command-line-argument",
|
||||
"-sALLOW_MEMORY_GROWTH"
|
||||
],
|
||||
"exported_functions": [
|
||||
"_malloc",
|
||||
"_free",
|
||||
"_hyphenCreateApplication",
|
||||
"_hyphenDestroyApplication",
|
||||
"_hyphenLoadDictionary",
|
||||
"_hyphenWord"
|
||||
],
|
||||
"include_path": ["../src"],
|
||||
"define": ["GRAPHICS_NO_USE_DYNAMIC_LIBRARY", "HYPHEN_ENGINE_DISABLE_FILESYSTEM"],
|
||||
"compile_files_array": [
|
||||
{
|
||||
"name": "h_e",
|
||||
"folder": "../../../../../DesktopEditor/fontengine",
|
||||
"files": ["TextHyphen.cpp"]
|
||||
},
|
||||
{
|
||||
"name": "h_m",
|
||||
"folder": "../src",
|
||||
"files": ["hyphen.cpp"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
(function(window) {
|
||||
|
||||
window.hyphen = window.hyphen || {};
|
||||
window.hyphen.isReady = false;
|
||||
|
||||
var not_ready = function() {
|
||||
console.log('Module is not ready');
|
||||
}
|
||||
|
||||
window.hyphen.destroyApplication = not_ready;
|
||||
window.hyphen.loadDictionary = not_ready;
|
||||
window.hyphen.hyphenWord = not_ready;
|
||||
|
||||
window.hyphen.onLoadModule = function(exports) {
|
||||
window.hyphen.isReady = true;
|
||||
|
||||
window.hyphen.destroyApplication = exports.destroyApplication;
|
||||
window.hyphen.loadDictionary = exports.loadDictionary;
|
||||
window.hyphen.hyphenWord = exports.hyphenWord;
|
||||
};
|
||||
|
||||
window.hyphen.loadModule = function() {
|
||||
var path = '../deploy/engine/';
|
||||
|
||||
// wasm support check
|
||||
var useWasm = false;
|
||||
const webAsmObj = window['WebAssembly'];
|
||||
if (typeof webAsmObj === 'object') {
|
||||
if (typeof webAsmObj['Memory'] === 'function') {
|
||||
if ((typeof webAsmObj['instantiateStreaming'] === 'function') || (typeof webAsmObj['instantiate'] === 'function')) {
|
||||
useWasm = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
path += (useWasm ? 'hyphen.js' : 'hyphen_ie.js');
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = path;
|
||||
document.head.appendChild(script);
|
||||
|
||||
}
|
||||
})(self);
|
||||
@ -1,81 +0,0 @@
|
||||
(function(window) {
|
||||
|
||||
var isModuleLoaded = false;
|
||||
var application;
|
||||
|
||||
function onLoadModule() {
|
||||
isModuleLoaded = true;
|
||||
application = Module._hyphenCreateApplication();
|
||||
if (window.hyphen) {
|
||||
window.hyphen.onLoadModule && window.hyphen.onLoadModule({
|
||||
destroyApplication: function() {
|
||||
Module._hyphenDestroyApplication(application);
|
||||
},
|
||||
loadDictionary: hyphenLoadDictionary,
|
||||
hyphenWord: hyphenWord
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//desktop_fetch
|
||||
|
||||
//polyfill
|
||||
|
||||
//string_utf8
|
||||
|
||||
//module
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Number} app
|
||||
* @param {Number} lang
|
||||
* @param {arraybuffer} dict
|
||||
* @returns {Boolean} isSuccess
|
||||
*/
|
||||
function hyphenLoadDictionary(lang, dict)
|
||||
{
|
||||
if (!isModuleLoaded)
|
||||
return;
|
||||
|
||||
let dictSize = dict.byteLength;
|
||||
let dictPointer = Module._malloc(dictSize);
|
||||
Module.HEAP8.set(new Uint8ClampedArray(dict), dictPointer);
|
||||
|
||||
let result = Module._hyphenLoadDictionary(application, lang, dictPointer, dictSize);
|
||||
|
||||
Module._free(dictPointer);
|
||||
|
||||
return (result === 0) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Number} lang
|
||||
* @param {String} word
|
||||
* @returns {Array}
|
||||
* Returns hyphen vector of word
|
||||
*/
|
||||
function hyphenWord(lang, word)
|
||||
{
|
||||
if (!isModuleLoaded)
|
||||
return;
|
||||
|
||||
let wordPointer = word.toUtf8Pointer();
|
||||
let wordLen = wordPointer.length;
|
||||
let hyphens = [];
|
||||
|
||||
if (wordPointer)
|
||||
{
|
||||
const ptr = Module._hyphenWord(application, lang, wordPointer.ptr, wordLen);
|
||||
wordPointer.free();
|
||||
|
||||
let vector = new Uint8ClampedArray(Module.HEAP8.buffer, ptr, wordLen + 5);
|
||||
for (let i = 0; vector[i] != 0; i++)
|
||||
{
|
||||
if (1 == (vector[i] & 1))
|
||||
hyphens.push((i + 1));
|
||||
}
|
||||
}
|
||||
return hyphens;
|
||||
}
|
||||
})(self);
|
||||
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "../../../../../DesktopEditor/fontengine/TextHyphen.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WASM_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define WASM_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WASM_EXPORT NSHyphen::CEngine* hyphenCreateApplication()
|
||||
{
|
||||
return new NSHyphen::CEngine();
|
||||
}
|
||||
WASM_EXPORT void hyphenDestroyApplication(NSHyphen::CEngine* app)
|
||||
{
|
||||
delete app;
|
||||
}
|
||||
|
||||
WASM_EXPORT int hyphenLoadDictionary(NSHyphen::CEngine* app, const int lang, const char *dict, const unsigned int dict_size)
|
||||
{
|
||||
return app->LoadDictionary(lang, (const unsigned char*)dict, dict_size);
|
||||
}
|
||||
WASM_EXPORT int hyphenCheckDictionary(NSHyphen::CEngine* app, const int lang)
|
||||
{
|
||||
return app->IsDictionaryExist(lang) ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT char* hyphenWord(NSHyphen::CEngine* app, const int lang, const char *word, const int word_len)
|
||||
{
|
||||
return app->Process(lang, word, word_len);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>test</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<textarea id = "textarea"></textarea>
|
||||
<button type = "submit">OK</button>
|
||||
<select name = "combobox" id = "combobox">
|
||||
<option></option>
|
||||
<option value = "bg_BG">bg_BG</option>
|
||||
<option value = "ca_ES">ca_ES</option>
|
||||
<option value = "da_DK">da_DK</option>
|
||||
<option value = "de_AT">de_AT</option>
|
||||
<option value = "de_CH">de_CH</option>
|
||||
<option value = "de_DE">de_DE</option>
|
||||
<option value = "el_GR">el_GR</option>
|
||||
<option value = "en_AU">en_AU</option>
|
||||
<option value = "en_GB">en_GB</option>
|
||||
<option value = "en_US">en_US</option>
|
||||
<option value = "es_ES">es_ES</option>
|
||||
<option value = "fr_FR">fr_FR</option>
|
||||
<option value = "gl_ES">gl_ES</option>
|
||||
<option value = "hr_HR">hr_HR</option>
|
||||
<option value = "hu_HU">hu_HU</option>
|
||||
<option value = "id_ID">id_ID</option>
|
||||
<option value = "it_IT">it_IT</option>
|
||||
<option value = "lv_LV">lv_LV</option>
|
||||
<option value = "mn_MN">mn_MN</option>
|
||||
<option value = "nb_NO">nb_NO</option>
|
||||
<option value = "nl_NL">nl_NL</option>
|
||||
<option value = "nn_NO">nn_NO</option>
|
||||
<option value = "pl_PL">pl_PL</option>
|
||||
<option value = "pt_BR">pt_BR</option>
|
||||
<option value = "pt_PT">pt_PT</option>
|
||||
<option value = "ro_RO">ro_RO</option>
|
||||
<option value = "ru_RU">ru_RU</option>
|
||||
<option value = "sk_SK">sk_SK</option>
|
||||
<option value = "sl_SI">sl_SI</option>
|
||||
<option value = "sr_Cyrl_RS">sr_Cyrl_RS</option>
|
||||
<option value = "sr_Latn_RS">sr_Latn_RS</option>
|
||||
<option value = "sv_SE">sv_SE</option>
|
||||
<option value = "uk_UA">uk_UA</option>
|
||||
</select>
|
||||
</form>
|
||||
<script src = "../deploy/hyphen.js"></script>
|
||||
<script src = "main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,117 +0,0 @@
|
||||
(function (window, undefined) {
|
||||
|
||||
window.hyphen.loadModule();
|
||||
|
||||
var langs = {
|
||||
"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,
|
||||
"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,
|
||||
"nl_NL" : 2067
|
||||
};
|
||||
|
||||
var textarea = document.getElementById("textarea");
|
||||
var form = document.querySelector("form");
|
||||
var combobox = document.getElementById("combobox");
|
||||
|
||||
combobox.value = "en_US";
|
||||
textarea.value = "expedition";
|
||||
|
||||
form.onsubmit = function(event)
|
||||
{
|
||||
if(combobox.value == "")
|
||||
return;
|
||||
|
||||
var lang = combobox.value;
|
||||
var text = textarea.value.split("\n").join(" ").split(" ");
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
var path = '../../../../../../dictionaries/' + lang + '/' + 'hyph_' + lang + '.dic';
|
||||
|
||||
request.responseType = 'arraybuffer';
|
||||
|
||||
if (request.overrideMimeType) {
|
||||
request.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
} else {
|
||||
request.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||
}
|
||||
request.open('GET', path, true);
|
||||
request.send(null);
|
||||
|
||||
request.onload = function ()
|
||||
{
|
||||
var dict = request.response;
|
||||
var langInt = langs[lang];
|
||||
window.hyphen.loadDictionary(langInt, dict);
|
||||
|
||||
for (var i = 0; i < text.length; i++)
|
||||
{
|
||||
var hyphens = window.hyphen.hyphenWord(langInt, text[i].toLowerCase());
|
||||
|
||||
let itemUtf8 = text[i].toUtf8(true);
|
||||
let start = 0;
|
||||
let hword = "";
|
||||
|
||||
for (let j = 0, len = hyphens.length; j < len; j++)
|
||||
{
|
||||
hword += "".fromUtf8(itemUtf8, start, hyphens[j] - start);
|
||||
hword += "=";
|
||||
start = hyphens[j];
|
||||
}
|
||||
|
||||
if (start < itemUtf8.length)
|
||||
{
|
||||
hword += "".fromUtf8(itemUtf8, start);
|
||||
hword += "=";
|
||||
}
|
||||
|
||||
console.log(hword);
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
})(self);
|
||||
@ -1,10 +0,0 @@
|
||||
button {
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
#textarea{
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
@ -4,10 +4,18 @@ core_windows {
|
||||
exists($$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu) {
|
||||
INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu/include
|
||||
} else {
|
||||
INCLUDEPATH += $$PWD/icu/include
|
||||
build_xp {
|
||||
INCLUDEPATH += $$PWD/icu58/include
|
||||
} else {
|
||||
INCLUDEPATH += $$PWD/icu/include
|
||||
}
|
||||
}
|
||||
|
||||
LIBS += -L$$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build -licuuc
|
||||
ICU_LIBS_PATH_WIN = $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build
|
||||
build_xp {
|
||||
ICU_LIBS_PATH_WIN = $$ICU_LIBS_PATH_WIN/xp
|
||||
}
|
||||
LIBS += -L$$ICU_LIBS_PATH_WIN -licuuc
|
||||
}
|
||||
|
||||
core_linux {
|
||||
|
||||
2
Common/3dParty/libvlc/.gitignore
vendored
2
Common/3dParty/libvlc/.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
vlc
|
||||
vlc.*
|
||||
src
|
||||
!build
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* deprecated.h: libvlc deprecated API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2008 VLC authors and VideoLAN
|
||||
* $Id: 27323a434498604ca281900c3e4087a42d22a5d8 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc.h: libvlc external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2009 VLC authors and VideoLAN
|
||||
* $Id: b12d900469fa6438c41421f2ac7697b93ffc8a35 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_media.h: libvlc external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2009 VLC authors and VideoLAN
|
||||
* $Id: 383f366b6940f7b3d89f5945e015793833ea541f $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
@ -30,6 +30,12 @@
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <basetsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
|
||||
/** \defgroup libvlc_media LibVLC media
|
||||
* \ingroup libvlc
|
||||
* @ref libvlc_media_t is an abstract representation of a playable media.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_media_discoverer.h: libvlc external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2009 VLC authors and VideoLAN
|
||||
* $Id: 96c0515ffec98f439867814d68525288b2702b0f $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_media_library.h: libvlc external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2009 VLC authors and VideoLAN
|
||||
* $Id: facbf813aa16140461c6e72f166d2985c52b1d6f $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_media_list.h: libvlc_media_list API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2008 VLC authors and VideoLAN
|
||||
* $Id: fa3b90932be8c3a9cce27925d4867aeddde748d7 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Pierre d'Herbemont
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_media_list_player.h: libvlc_media_list API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2008 VLC authors and VideoLAN
|
||||
* $Id: 04f7d9b9f0d47e1b8304b51ca20fd2b1045a0ff2 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Pierre d'Herbemont
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_media_player.h: libvlc_media_player external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2015 VLC authors and VideoLAN
|
||||
* $Id: c431c235e92ced9e6e7d7712eb7ff0e73dc4f933 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
@ -559,6 +559,8 @@ LIBVLC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_m
|
||||
* render its video output. If LibVLC was built without Win32/Win64 API output
|
||||
* support, then this has no effects.
|
||||
*
|
||||
* \warning the HWND must have the WS_CLIPCHILDREN set in its style.
|
||||
*
|
||||
* \param p_mi the Media Player
|
||||
* \param drawable windows handle of the drawable
|
||||
*/
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
# define LIBVLC_VERSION_MINOR (0)
|
||||
|
||||
/** LibVLC revision */
|
||||
# define LIBVLC_VERSION_REVISION (18)
|
||||
# define LIBVLC_VERSION_REVISION (21)
|
||||
|
||||
# define LIBVLC_VERSION_EXTRA (0)
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* libvlc_vlm.h: libvlc_* new external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2008 VLC authors and VideoLAN
|
||||
* $Id: cfa2d956463056b287cdb0a4faeb46442040a010 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_access.h: Access descriptor, queries and methods
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2006 VLC authors and VideoLAN
|
||||
* $Id: da06554814885d03823aefbf58e858f6941b3400 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_actions.h: handle vlc actions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003-2016 VLC authors and VideoLAN
|
||||
* $Id: 404c1662a82ef3f3ffc983a81fa73b90f5773eef $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
|
||||
*
|
||||
|
||||
@ -129,7 +129,7 @@ struct audio_output
|
||||
/**< Stops the existing stream (optional, may be NULL).
|
||||
* \note A stream must have been started when called.
|
||||
*/
|
||||
int (*time_get)(audio_output_t *, mtime_t *delay);
|
||||
int (*time_get)(audio_output_t *, vlc_tick_t *delay);
|
||||
/**< Estimates playback buffer latency (optional, may be NULL).
|
||||
* \param delay pointer to the delay until the next sample to be written
|
||||
* to the playback buffer is rendered [OUT]
|
||||
@ -140,7 +140,7 @@ struct audio_output
|
||||
/**< Queues a block of samples for playback (mandatory, cannot be NULL).
|
||||
* \note A stream must have been started when called.
|
||||
*/
|
||||
void (*pause)( audio_output_t *, bool pause, mtime_t date);
|
||||
void (*pause)( audio_output_t *, bool pause, vlc_tick_t date);
|
||||
/**< Pauses or resumes playback (optional, may be NULL).
|
||||
* \param pause pause if true, resume from pause if false
|
||||
* \param date timestamp when the pause or resume was requested
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_aout_volume.h: audio volume module
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2002-2009 VLC authors and VideoLAN
|
||||
* $Id: df85b8fd14e00454e88c08061e3059fa67927dab $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
* Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_arrays.h : Arrays and data structures handling
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2004 VLC authors and VideoLAN
|
||||
* $Id: 39b69952ffce040330da239f52778c3e82024bc4 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
* Clément Stenac <zorglub@videolan.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_bits.h : Bit handling helpers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001, 2002, 2003, 2006, 2015 VLC authors and VideoLAN
|
||||
* $Id: 395a789eba46ac42413f5fb5418619332589f824 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
* Gildas Bazin <gbazin at videolan dot org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_block.h: Data blocks management functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003 VLC authors and VideoLAN
|
||||
* $Id: 1c9478301687233398adbb7de7da4ffc4a101f89 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
@ -49,7 +49,7 @@
|
||||
* - i_flags may not always be set (ie could be 0, even for a key frame
|
||||
* it depends where you receive the buffer (before/after a packetizer
|
||||
* and the demux/packetizer implementations.
|
||||
* - i_dts/i_pts could be VLC_TS_INVALID, it means no pts/dts
|
||||
* - i_dts/i_pts could be VLC_TICK_INVALID, it means no pts/dts
|
||||
* - i_length: length in microseond of the packet, can be null except in the
|
||||
* sout where it is mandatory.
|
||||
*
|
||||
@ -121,9 +121,9 @@ struct block_t
|
||||
uint32_t i_flags;
|
||||
unsigned i_nb_samples; /* Used for audio */
|
||||
|
||||
mtime_t i_pts;
|
||||
mtime_t i_dts;
|
||||
mtime_t i_length;
|
||||
vlc_tick_t i_pts;
|
||||
vlc_tick_t i_dts;
|
||||
vlc_tick_t i_length;
|
||||
|
||||
/* Rudimentary support for overloading block (de)allocation. */
|
||||
block_free_t pf_release;
|
||||
@ -175,7 +175,7 @@ VLC_API block_t *block_Realloc(block_t *, ssize_t pre, size_t body) VLC_USED;
|
||||
*
|
||||
* @note
|
||||
* If the block is in a chain, this function does <b>not</b> release any
|
||||
* subsequent block in the chain. Use block_ChainRelease() for that purpose.
|
||||
* subsequent block in the chain. Use block_ChainRelease() for that purpose.
|
||||
*
|
||||
* @param block block to release (cannot be NULL)
|
||||
*/
|
||||
@ -364,10 +364,10 @@ static size_t block_ChainExtract( block_t *p_list, void *p_data, size_t i_max )
|
||||
return i_total;
|
||||
}
|
||||
|
||||
static inline void block_ChainProperties( block_t *p_list, int *pi_count, size_t *pi_size, mtime_t *pi_length )
|
||||
static inline void block_ChainProperties( block_t *p_list, int *pi_count, size_t *pi_size, vlc_tick_t *pi_length )
|
||||
{
|
||||
size_t i_size = 0;
|
||||
mtime_t i_length = 0;
|
||||
vlc_tick_t i_length = 0;
|
||||
int i_count = 0;
|
||||
|
||||
while( p_list )
|
||||
@ -390,7 +390,7 @@ static inline void block_ChainProperties( block_t *p_list, int *pi_count, size_t
|
||||
static inline block_t *block_ChainGather( block_t *p_list )
|
||||
{
|
||||
size_t i_total = 0;
|
||||
mtime_t i_length = 0;
|
||||
vlc_tick_t i_length = 0;
|
||||
block_t *g;
|
||||
|
||||
if( p_list->p_next == NULL )
|
||||
@ -534,7 +534,7 @@ VLC_API void vlc_fifo_WaitCond(vlc_fifo_t *, vlc_cond_t *);
|
||||
* Atomically unlocks the FIFO and waits until one thread signals the FIFO up
|
||||
* to a certain date, then locks the FIFO again. See vlc_fifo_Wait().
|
||||
*/
|
||||
int vlc_fifo_TimedWaitCond(vlc_fifo_t *, vlc_cond_t *, mtime_t);
|
||||
int vlc_fifo_TimedWaitCond(vlc_fifo_t *, vlc_cond_t *, vlc_tick_t);
|
||||
|
||||
/**
|
||||
* Queues a linked-list of blocks into a locked FIFO.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003-2005 VLC authors and VideoLAN
|
||||
* Copyright © 2005-2010 Rémi Denis-Courmont
|
||||
* $Id: c77f19892047f406a69695a255aaf9ef6ef32ec3 $
|
||||
* $Id$
|
||||
*
|
||||
* Author: Rémi Denis-Courmont
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_codec.h: Definition of the decoder and encoder structures
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2003 VLC authors and VideoLAN
|
||||
* $Id: 3499ede27c1dbb94ff665a51d000c55bd45f2794 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Gildas Bazin <gbazin@netcourrier.com>
|
||||
*
|
||||
@ -169,7 +169,7 @@ struct decoder_t
|
||||
|
||||
/* Display date
|
||||
* XXX use decoder_GetDisplayDate */
|
||||
mtime_t (*pf_get_display_date)( decoder_t *, mtime_t );
|
||||
vlc_tick_t (*pf_get_display_date)( decoder_t *, vlc_tick_t );
|
||||
|
||||
/* Display rate
|
||||
* XXX use decoder_GetDisplayRate */
|
||||
@ -409,7 +409,7 @@ VLC_API int decoder_GetInputAttachments( decoder_t *, input_attachment_t ***ppp_
|
||||
* to mdate().
|
||||
* You MUST use it *only* for gathering statistics about speed.
|
||||
*/
|
||||
VLC_API mtime_t decoder_GetDisplayDate( decoder_t *, mtime_t ) VLC_USED;
|
||||
VLC_API vlc_tick_t decoder_GetDisplayDate( decoder_t *, vlc_tick_t ) VLC_USED;
|
||||
|
||||
/**
|
||||
* This function returns the current input rate.
|
||||
|
||||
@ -152,7 +152,11 @@
|
||||
* epoch). Note that date and time intervals can be manipulated using regular
|
||||
* arithmetic operators, and that no special functions are required.
|
||||
*/
|
||||
typedef int64_t mtime_t;
|
||||
typedef int64_t vlc_tick_t;
|
||||
typedef vlc_tick_t mtime_t; /* deprecated, use vlc_tick_t */
|
||||
|
||||
#define VLC_TICK_INVALID VLC_TS_INVALID
|
||||
#define VLC_TICK_0 VLC_TS_0
|
||||
|
||||
/**
|
||||
* The vlc_fourcc_t type.
|
||||
@ -943,6 +947,11 @@ static inline void SetQWLE (void *p, uint64_t qw)
|
||||
# define O_NONBLOCK 0
|
||||
# endif
|
||||
|
||||
/* the mingw32 swab() and win32 _swab() prototypes expect a char* instead of a
|
||||
const void* */
|
||||
# define swab(a,b,c) swab((char*) (a), (char*) (b), (c))
|
||||
|
||||
|
||||
# include <tchar.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_config_cat.h : Definition of configuration categories
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2003 VLC authors and VideoLAN
|
||||
* $Id: 55d2e468d1ccc3fcd8d165dcecc10ec753021a5e $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Anil Daoud <anil@videolan.org>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* It includes functions allowing to declare, get or set configuration options.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2006 VLC authors and VideoLAN
|
||||
* $Id: 209168615be2a7bc5db889282b32389093ab262e $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Gildas Bazin <gbazin@videolan.org>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_demux.h: Demuxer descriptor, queries and methods
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2005 VLC authors and VideoLAN
|
||||
* $Id: f359f547fa79d9818ed74420d906a6683be3d037 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_epg.h: Electronic Program Guide
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2007 VLC authors and VideoLAN
|
||||
* $Id: f7b9044e7c0aa1af4a44066d73f2ead943fc6a46 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_es.h: Elementary stream formats descriptions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2012 VLC authors and VideoLAN
|
||||
* $Id: 3c8e04e1b15740166df2e0b2d9a651ffb2c5bc2f $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_es_out.h: es_out (demuxer output) descriptor, queries and methods
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2004 VLC authors and VideoLAN
|
||||
* $Id: fe53c2a3d34f76eec76d83032cd0d3111be915aa $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
@ -93,8 +93,8 @@ enum es_out_query_e
|
||||
ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
|
||||
|
||||
/* PCR system clock manipulation for external clock synchronization */
|
||||
ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
|
||||
ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=mtime_t, res=can fail */
|
||||
ES_OUT_GET_PCR_SYSTEM, /* arg1=vlc_tick_t *, arg2=vlc_tick_t * res=can fail */
|
||||
ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=vlc_tick_t, res=can fail */
|
||||
|
||||
ES_OUT_POST_SUBNODE, /* arg1=input_item_node_t *, res=can fail */
|
||||
|
||||
@ -167,11 +167,11 @@ static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta
|
||||
return es_out_Control( out, ES_OUT_SET_META, p_meta );
|
||||
}
|
||||
|
||||
static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system, mtime_t *pi_delay )
|
||||
static inline int es_out_ControlGetPcrSystem( es_out_t *out, vlc_tick_t *pi_system, vlc_tick_t *pi_delay )
|
||||
{
|
||||
return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system, pi_delay );
|
||||
}
|
||||
static inline int es_out_ControlModifyPcrSystem( es_out_t *out, bool b_absolute, mtime_t i_system )
|
||||
static inline int es_out_ControlModifyPcrSystem( es_out_t *out, bool b_absolute, vlc_tick_t i_system )
|
||||
{
|
||||
return es_out_Control( out, ES_OUT_MODIFY_PCR_SYSTEM, b_absolute, i_system );
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Interface used to send events.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2007 VLC authors and VideoLAN
|
||||
* $Id: 229f4f677029763a837558932dad3e47b283e61c $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Pierre d'Herbemont
|
||||
*
|
||||
@ -142,7 +142,7 @@ typedef struct vlc_event_t
|
||||
} input_item_subitem_tree_added;
|
||||
struct vlc_input_item_duration_changed
|
||||
{
|
||||
mtime_t new_duration;
|
||||
vlc_tick_t new_duration;
|
||||
} input_item_duration_changed;
|
||||
struct vlc_input_item_preparsed_changed
|
||||
{
|
||||
|
||||
@ -95,7 +95,7 @@ struct filter_t
|
||||
int, int, int );
|
||||
|
||||
/** Generate a subpicture (sub source) */
|
||||
subpicture_t *(*pf_sub_source)( filter_t *, mtime_t );
|
||||
subpicture_t *(*pf_sub_source)( filter_t *, vlc_tick_t );
|
||||
|
||||
/** Filter a subpicture (sub filter) */
|
||||
subpicture_t *(*pf_sub_filter)( filter_t *, subpicture_t * );
|
||||
@ -431,7 +431,7 @@ VLC_API void filter_chain_VideoFlush( filter_chain_t * );
|
||||
* \param display_date of subpictures
|
||||
*/
|
||||
void filter_chain_SubSource(filter_chain_t *chain, spu_t *,
|
||||
mtime_t display_date);
|
||||
vlc_tick_t display_date);
|
||||
|
||||
/**
|
||||
* Apply filter chain to subpictures.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_fourcc.h: Definition of various FOURCC and helpers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2009 Laurent Aimar
|
||||
* $Id: 97827bd4c146461408fbfd5d0aed6e45a91dc89a $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ com>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_http.h: Shared code for HTTP clients
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001-2008 VLC authors and VideoLAN
|
||||
* $Id: a48ea794963ad476fc059eb3ffcf787186b78b47 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
* Christophe Massiot <massiot@via.ecp.fr>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_httpd.h: builtin HTTP/RTSP server.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2004-2006 VLC authors and VideoLAN
|
||||
* $Id: 29b8229e7b6baa7a8eedf37f6fdb1e97bf6a9ca7 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_image.h : wrapper for image reading/writing facilities
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2004 VLC authors and VideoLAN
|
||||
* $Id: 2b308fd0e52f4d4d6e20f95d08e0d63c53822eef $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Gildas Bazin <gbazin@videolan.org>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_input.h: Core input structures
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2015 VLC authors and VideoLAN
|
||||
* $Id: d20585ba33030980fa496cd042227b543f10827a $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
* Laurent Aimar <fenrir@via.ecp.fr>
|
||||
@ -485,8 +485,8 @@ enum input_query_e
|
||||
INPUT_SET_RENDERER, /* arg1=vlc_renderer_item_t* */
|
||||
|
||||
/* External clock managments */
|
||||
INPUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
|
||||
INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=mtime_t res=can fail */
|
||||
INPUT_GET_PCR_SYSTEM, /* arg1=vlc_tick_t *, arg2=vlc_tick_t * res=can fail */
|
||||
INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=vlc_tick_t res=can fail */
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
@ -631,14 +631,14 @@ static inline int input_GetEsObjects( input_thread_t *p_input, int i_id,
|
||||
/**
|
||||
* \see input_clock_GetSystemOrigin
|
||||
*/
|
||||
static inline int input_GetPcrSystem( input_thread_t *p_input, mtime_t *pi_system, mtime_t *pi_delay )
|
||||
static inline int input_GetPcrSystem( input_thread_t *p_input, vlc_tick_t *pi_system, vlc_tick_t *pi_delay )
|
||||
{
|
||||
return input_Control( p_input, INPUT_GET_PCR_SYSTEM, pi_system, pi_delay );
|
||||
}
|
||||
/**
|
||||
* \see input_clock_ChangeSystemOrigin
|
||||
*/
|
||||
static inline int input_ModifyPcrSystem( input_thread_t *p_input, bool b_absolute, mtime_t i_system )
|
||||
static inline int input_ModifyPcrSystem( input_thread_t *p_input, bool b_absolute, vlc_tick_t i_system )
|
||||
{
|
||||
return input_Control( p_input, INPUT_MODIFY_PCR_SYSTEM, b_absolute, i_system );
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_input_item.h: Core input item
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2009 VLC authors and VideoLAN
|
||||
* $Id: f22c3d9330af98a15992ef08e362424313774d6f $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
* Laurent Aimar <fenrir@via.ecp.fr>
|
||||
@ -66,7 +66,7 @@ struct input_item_t
|
||||
unsigned optflagc;
|
||||
input_item_opaque_t *opaques; /**< List of opaque pointer values */
|
||||
|
||||
mtime_t i_duration; /**< Duration in microseconds */
|
||||
vlc_tick_t i_duration; /**< Duration in microseconds */
|
||||
|
||||
|
||||
int i_categories; /**< Number of info categories */
|
||||
@ -265,8 +265,8 @@ VLC_API char * input_item_GetTitleFbName( input_item_t * p_i ) VLC_USED;
|
||||
VLC_API char * input_item_GetURI( input_item_t * p_i ) VLC_USED;
|
||||
VLC_API char * input_item_GetNowPlayingFb( input_item_t *p_item ) VLC_USED;
|
||||
VLC_API void input_item_SetURI( input_item_t * p_i, const char *psz_uri );
|
||||
VLC_API mtime_t input_item_GetDuration( input_item_t * p_i );
|
||||
VLC_API void input_item_SetDuration( input_item_t * p_i, mtime_t i_duration );
|
||||
VLC_API vlc_tick_t input_item_GetDuration( input_item_t * p_i );
|
||||
VLC_API void input_item_SetDuration( input_item_t * p_i, vlc_tick_t i_duration );
|
||||
VLC_API bool input_item_IsPreparsed( input_item_t *p_i );
|
||||
VLC_API bool input_item_IsArtFetched( input_item_t *p_i );
|
||||
|
||||
@ -327,7 +327,7 @@ VLC_API void input_item_MergeInfos( input_item_t *, info_category_t * );
|
||||
*/
|
||||
VLC_API input_item_t * input_item_NewExt( const char *psz_uri,
|
||||
const char *psz_name,
|
||||
mtime_t i_duration, int i_type,
|
||||
vlc_tick_t i_duration, int i_type,
|
||||
enum input_item_net_type i_net ) VLC_USED;
|
||||
|
||||
#define input_item_New( psz_uri, psz_name ) \
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* interface, such as message output.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999, 2000 VLC authors and VideoLAN
|
||||
* $Id: e90eaa2917329500f18ada6eeac4348ae8200925 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Vincent Seguin <seguin@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -71,7 +71,7 @@ VLC_API int vlc_sem_wait_i11e(vlc_sem_t *);
|
||||
* @return EINTR if an interruption occurred, otherwise 0 once the timestamp is
|
||||
* reached.
|
||||
*/
|
||||
VLC_API int vlc_mwait_i11e(mtime_t);
|
||||
VLC_API int vlc_mwait_i11e(vlc_tick_t);
|
||||
|
||||
/**
|
||||
* Interruptible variant of msleep().
|
||||
@ -84,7 +84,7 @@ VLC_API int vlc_mwait_i11e(mtime_t);
|
||||
* @return EINTR if an interruption occurred, otherwise 0 once the timeout
|
||||
* expired.
|
||||
*/
|
||||
static inline int vlc_msleep_i11e(mtime_t delay)
|
||||
static inline int vlc_msleep_i11e(vlc_tick_t delay)
|
||||
{
|
||||
return vlc_mwait_i11e(mdate() + delay);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_media_library.h: SQL-based media library
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2008-2010 the VideoLAN Team and AUTHORS
|
||||
* $Id: a35d9729ca3705ec792b7be9e1819919f6e601f6 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Antoine Lejeune <phytos@videolan.org>
|
||||
* Jean-Philippe André <jpeg@videolan.org>
|
||||
@ -116,7 +116,7 @@ typedef enum
|
||||
typedef enum {
|
||||
ML_TYPE_INT, /**< Object is an int */
|
||||
ML_TYPE_PSZ, /**< A string char* */
|
||||
ML_TYPE_TIME, /**< A timestamp mtime_t */
|
||||
ML_TYPE_TIME, /**< A timestamp vlc_tick_t */
|
||||
ML_TYPE_MEDIA, /**< A pointer to a media ml_media_t* */
|
||||
} ml_result_type_e;
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* interface, such as message output.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999, 2000, 2001, 2002 VLC authors and VideoLAN
|
||||
* $Id: 63f9476cd5e6d6d4e274b4d4a7b947ec59d2843e $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Vincent Seguin <seguin@via.ecp.fr>
|
||||
* Samuel Hocevar <sam@zoy.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_meta.h: Stream meta-data
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2004 VLC authors and VideoLAN
|
||||
* $Id: d390d0bc4df47994d296c5720d1869c458b16cb5 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_modules.h : Module descriptor and load functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001-2011 VLC authors and VideoLAN
|
||||
* $Id: c2d3c26d20c3c45529bc01afb40377560cdf7306 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_mouse.h: mouse related structures and functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2009 Laurent Aimar
|
||||
* $Id: 481c3598e905db66805cf9a8ca58f6702921e4f0 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
|
||||
*
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* Functions prototyped are implemented in interface/mtime.c.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1996, 1997, 1998, 1999, 2000 VLC authors and VideoLAN
|
||||
* $Id: 311eb670eb7b9f35668196b78c9fa3c5cf1779db $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Vincent Seguin <seguin@via.ecp.fr>
|
||||
*
|
||||
@ -40,7 +40,7 @@
|
||||
* returning the date of the first image to be displayed. It can be used in
|
||||
* comparaison with other values: all existing dates will be earlier.
|
||||
*****************************************************************************/
|
||||
#define LAST_MDATE ((mtime_t)((uint64_t)(-1)/2))
|
||||
#define LAST_MDATE ((vlc_tick_t)((uint64_t)(-1)/2))
|
||||
|
||||
/*****************************************************************************
|
||||
* MSTRTIME_MAX_SIZE: maximum possible size of mstrtime
|
||||
@ -61,7 +61,7 @@ VLC_API char * secstotimestr( char *psz_buffer, int32_t secs );
|
||||
*****************************************************************************/
|
||||
struct date_t
|
||||
{
|
||||
mtime_t date;
|
||||
vlc_tick_t date;
|
||||
uint32_t i_divider_num;
|
||||
uint32_t i_divider_den;
|
||||
uint32_t i_remainder;
|
||||
@ -69,10 +69,10 @@ struct date_t
|
||||
|
||||
VLC_API void date_Init( date_t *, uint32_t, uint32_t );
|
||||
VLC_API void date_Change( date_t *, uint32_t, uint32_t );
|
||||
VLC_API void date_Set( date_t *, mtime_t );
|
||||
VLC_API mtime_t date_Get( const date_t * );
|
||||
VLC_API void date_Move( date_t *, mtime_t );
|
||||
VLC_API mtime_t date_Increment( date_t *, uint32_t );
|
||||
VLC_API mtime_t date_Decrement( date_t *, uint32_t );
|
||||
VLC_API void date_Set( date_t *, vlc_tick_t );
|
||||
VLC_API vlc_tick_t date_Get( const date_t * );
|
||||
VLC_API void date_Move( date_t *, vlc_tick_t );
|
||||
VLC_API vlc_tick_t date_Increment( date_t *, uint32_t );
|
||||
VLC_API vlc_tick_t date_Decrement( date_t *, uint32_t );
|
||||
VLC_API uint64_t NTPtime64( void );
|
||||
#endif /* !__VLC_MTIME_ */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2002-2005 VLC authors and VideoLAN
|
||||
* Copyright © 2006-2007 Rémi Denis-Courmont
|
||||
* $Id: 010454a01c09730b342d9603d2dc1770361057d2 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
* Laurent Aimar <fenrir@via.ecp.fr>
|
||||
@ -183,6 +183,22 @@ VLC_API int vlc_close(int);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef _WIN32
|
||||
static inline int vlc_getsockopt(int s, int level, int name,
|
||||
void *val, socklen_t *len)
|
||||
{
|
||||
return getsockopt(s, level, name, (char *)val, len);
|
||||
}
|
||||
#define getsockopt vlc_getsockopt
|
||||
|
||||
static inline int vlc_setsockopt(int s, int level, int name,
|
||||
const void *val, socklen_t len)
|
||||
{
|
||||
return setsockopt(s, level, name, (const char *)val, len);
|
||||
}
|
||||
#define setsockopt vlc_setsockopt
|
||||
#endif
|
||||
|
||||
/* Portable network names/addresses resolution layer */
|
||||
|
||||
#define NI_MAXNUMERICHOST 64
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_objects.h: vlc_object_t definition and manipulation methods
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2002-2008 VLC authors and VideoLAN
|
||||
* $Id: 4a2814187a5cc68b0e65d6dce3dd4a0d9e8fbe59 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_picture.h: picture definitions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999 - 2009 VLC authors and VideoLAN
|
||||
* $Id: 74f156fbbd6e6a4479754c0e79fbd5374a4a1e2e $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Vincent Seguin <seguin@via.ecp.fr>
|
||||
* Samuel Hocevar <sam@via.ecp.fr>
|
||||
@ -79,7 +79,7 @@ struct picture_t
|
||||
* These properties can be modified using the video output thread API,
|
||||
* but should never be written directly */
|
||||
/**@{*/
|
||||
mtime_t date; /**< display date */
|
||||
vlc_tick_t date; /**< display date */
|
||||
bool b_force;
|
||||
/**@}*/
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_picture_fifo.h: picture fifo definitions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2009 VLC authors and VideoLAN
|
||||
* $Id: 73d1b20c279f628cf94bc7cfc83b2548878bcc07 $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
|
||||
*
|
||||
@ -77,12 +77,12 @@ VLC_API void picture_fifo_Push( picture_fifo_t *, picture_t * );
|
||||
*
|
||||
* All pictures inside the fifo will be released by picture_Release.
|
||||
*/
|
||||
VLC_API void picture_fifo_Flush( picture_fifo_t *, mtime_t date, bool flush_before );
|
||||
VLC_API void picture_fifo_Flush( picture_fifo_t *, vlc_tick_t date, bool flush_before );
|
||||
|
||||
/**
|
||||
* It applies a delta on all the picture timestamp.
|
||||
*/
|
||||
VLC_API void picture_fifo_OffsetDate( picture_fifo_t *, mtime_t delta );
|
||||
VLC_API void picture_fifo_OffsetDate( picture_fifo_t *, vlc_tick_t delta );
|
||||
|
||||
|
||||
#endif /* VLC_PICTURE_FIFO_H */
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* vlc_picture_pool.h: picture pool definitions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2009 VLC authors and VideoLAN
|
||||
* $Id: 8b04370bfb320749eec6bcf09aaf0ba76b78058f $
|
||||
* $Id$
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user