mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-14 03:46:06 +08:00
Compare commits
677 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 187bf8823a | |||
| cd7c85967c | |||
| 045b00ad5a | |||
| 9b5784e344 | |||
| 2b6650dde1 | |||
| ff8ecb2d2f | |||
| 5893b93e3a | |||
| 92313e106d | |||
| c462f522d6 | |||
| 5feb4b7b82 | |||
| 678ec98721 | |||
| c17fa8462d | |||
| 04eda04870 | |||
| cd9cc22185 | |||
| f01eb91316 | |||
| b9216e9bdc | |||
| 0295ef2d54 | |||
| 797b745b35 | |||
| 253c24cf03 | |||
| 02e8649a61 | |||
| 447dc81426 | |||
| 0f3c883d24 | |||
| 0b16b9a7f9 | |||
| 37c276b736 | |||
| 7014faa9a1 | |||
| 93287c84c8 | |||
| dafcbacfaf | |||
| 41ea42459a | |||
| bc68323506 | |||
| 1c73ff0c3f | |||
| 5a8c9069be | |||
| 4ba2e1fa6d | |||
| 95af281145 | |||
| 00fb2ba7bb | |||
| 0f65e36517 | |||
| aa1af73fda | |||
| 1610978821 | |||
| 20faf24556 | |||
| ae90e4ae96 | |||
| 6fae9115ea | |||
| c14a21b2da | |||
| b952692225 | |||
| 23249e69f9 | |||
| 09f6c3f4e8 | |||
| 111ceff368 | |||
| 867b0634f3 | |||
| f9c27275a7 | |||
| dd12ee0b9e | |||
| de83971832 | |||
| 0d158e46b5 | |||
| dde6b8bdc7 | |||
| b66bb0d63f | |||
| d666da2697 | |||
| 8e35f9b063 | |||
| 25268b706d | |||
| 97ff1efba8 | |||
| 1879ce8dbb | |||
| 50ff5fc0b2 | |||
| 537e774f79 | |||
| 6d3761c20b | |||
| ee41b4ccb2 | |||
| 7b0f902c0f | |||
| e6039f7f6f | |||
| 1c2b86519e | |||
| 755119c825 | |||
| 3a73480437 | |||
| 323d1b44cd | |||
| a99a195c68 | |||
| 0d979b8033 | |||
| dd3b671e57 | |||
| 74bd059607 | |||
| 83fa44edcd | |||
| 80fe4c0164 | |||
| 04f7527f9e | |||
| d92aa1f793 | |||
| af4e135fe2 | |||
| a5ef8c01b3 | |||
| 1b7f35b317 | |||
| 4079dea224 | |||
| 2ead42a513 | |||
| 427046cb8f | |||
| f4c112d523 | |||
| b082ffe20c | |||
| c589a6c947 | |||
| e60cc05b6e | |||
| 15b08aeebf | |||
| 672129c242 | |||
| 92689a7a57 | |||
| 31ebd7b14c | |||
| 1695668a6f | |||
| 77dfd5c12a | |||
| e600fe93b7 | |||
| 889a1f827a | |||
| 8cd55fb9c4 | |||
| 01b9309f09 | |||
| d3a4f00f76 | |||
| f65196d95b | |||
| 3ee5d685c2 | |||
| c0cd75dbd5 | |||
| a69453af4b | |||
| 3adcfecfb9 | |||
| a7d2191649 | |||
| db50e87fe0 | |||
| 36bdc7376a | |||
| 1321211336 | |||
| 8c834c5041 | |||
| c75aacaed8 | |||
| a4445cacaa | |||
| d6ad9e84e2 | |||
| d9687387f9 | |||
| eaa01c7995 | |||
| 597f360336 | |||
| d502206726 | |||
| d0d90c641c | |||
| 14fa14de3f | |||
| cced8f4912 | |||
| 2e40b96ed9 | |||
| 50ee7d7cc1 | |||
| f9b54bffd4 | |||
| a52a8e982e | |||
| 128529ba80 | |||
| a571c88798 | |||
| 34bb84a792 | |||
| 92d0d0d7ea | |||
| 449e3fc131 | |||
| ce9fdb33b5 | |||
| 2591f0a202 | |||
| 6bc04fc06f | |||
| 047850dbd6 | |||
| 465b903ec5 | |||
| 6afa54ebef | |||
| 27a0e77ef1 | |||
| c7b45910f8 | |||
| ab1abb96fe | |||
| 566d9e68e4 | |||
| 243b8eccdd | |||
| 76b682063e | |||
| effdab1ff4 | |||
| 658040f77b | |||
| 48aa99af83 | |||
| a1b738fc42 | |||
| 00e9ce56df | |||
| 2a4ce1f93f | |||
| 261e48227d | |||
| 29e3f90ebf | |||
| d4a70d306f | |||
| b9b843f25d | |||
| d7e2bedc6b | |||
| 234459f37c | |||
| 58cd45f4ee | |||
| 33f7ee49df | |||
| e7ed48af49 | |||
| cbd79c902e | |||
| 40c24b1577 | |||
| 95a49140cb | |||
| aad12cf471 | |||
| f0ffb7f14c | |||
| da329135e1 | |||
| 60ca9a2347 | |||
| 5fdace28d2 | |||
| 85549c5b20 | |||
| 4c8bc2227a | |||
| 23ca735f23 | |||
| 4acefb020f | |||
| 684d697cae | |||
| 1aa604c584 | |||
| 51569b626f | |||
| 89d7eb559d | |||
| f6b3a78fe8 | |||
| 1900e2f0a0 | |||
| d0e1785086 | |||
| 221d1ecbb5 | |||
| 2fc3b140d0 | |||
| bdb2ca8241 | |||
| 4055201322 | |||
| 5b305ec75d | |||
| 433686c01f | |||
| ccfc921883 | |||
| 6b0d6fe890 | |||
| 5ae20c58ed | |||
| 7b45fb8931 | |||
| d0ffc6f555 | |||
| 54e5bb8419 | |||
| f7bb1766c0 | |||
| f0bb87ba14 | |||
| a484dc1fd7 | |||
| 19cc78060c | |||
| 2682eda9c6 | |||
| 8d750adb7b | |||
| c517b3ac19 | |||
| f57b28cd24 | |||
| b8215e9e82 | |||
| f6305fca21 | |||
| 4cb984684d | |||
| 903d903aad | |||
| fe53ae9b11 | |||
| 8ca218d600 | |||
| 87a9542fc7 | |||
| 48a1f01220 | |||
| 8a2923e534 | |||
| 0ab7e55add | |||
| cb1cb43a0b | |||
| 0ca3432d05 | |||
| 50208be48d | |||
| c796f4a0f6 | |||
| 618da3c8cc | |||
| 9b4568e81a | |||
| 752acf1e46 | |||
| d9afc49bb3 | |||
| 4c6ba8ed41 | |||
| a0b32c1523 | |||
| a2cc70233e | |||
| 42c35a9803 | |||
| a395420d59 | |||
| c4ca4b5613 | |||
| 8100a2860f | |||
| dd83971001 | |||
| c4abf6d149 | |||
| c749cbf081 | |||
| c7accf4370 | |||
| b49e43c4cb | |||
| 322bc72ad1 | |||
| 33bf2df39d | |||
| aa344408b0 | |||
| 2a5d29c874 | |||
| 50ae01723c | |||
| c05ea1bd21 | |||
| 887905570a | |||
| ce76a7b075 | |||
| 6dda731502 | |||
| 3e9e70655c | |||
| ed9a6e7e5c | |||
| 284b04574a | |||
| 67eb5ac139 | |||
| 563014f8d7 | |||
| 290d845d7a | |||
| 935e9396af | |||
| 4de2649dcd | |||
| a8bcd38bce | |||
| 46bc4e5e96 | |||
| 56475b7e8a | |||
| 69a69d9fc2 | |||
| b470120075 | |||
| 7d2f96d284 | |||
| 0de5fb6bfc | |||
| e753476826 | |||
| 983873d010 | |||
| af037642dd | |||
| 68122490bf | |||
| 4833c652d8 | |||
| af0e9be136 | |||
| d987233335 | |||
| 5f100d4ea0 | |||
| d4e34e244f | |||
| 4b8bc2c8e7 | |||
| b04f44ee2c | |||
| fb3b6aff47 | |||
| 531460e37d | |||
| 09407b08ba | |||
| 83bc1b18b6 | |||
| 56279f7465 | |||
| 566eeb06ae | |||
| 7dc6d70b8a | |||
| f5c359650f | |||
| d665d9449e | |||
| 3c93563027 | |||
| b525e1deb4 | |||
| d5b80e2fa3 | |||
| 2bc2039c01 | |||
| a0fdb1cbcc | |||
| 664007983d | |||
| a15aee3244 | |||
| 5e034e2877 | |||
| 8d77cdaf24 | |||
| e73b5c29b2 | |||
| 6a3b4d12a5 | |||
| 992e62b8c8 | |||
| 021e01af4e | |||
| 55a1a2ca59 | |||
| e644ef4062 | |||
| 05bf38a35d | |||
| 45d51a0002 | |||
| 247f0a7d89 | |||
| 7c621a4a81 | |||
| 62ba68aaa8 | |||
| 0a816a2d6d | |||
| c64a33f42d | |||
| 0599018f99 | |||
| bf8bea5d07 | |||
| d9bd1cdb32 | |||
| e1a8bd3b3d | |||
| a8f7a1f044 | |||
| 17e8cfcaa8 | |||
| 5d4bdccbac | |||
| 5c43b5743d | |||
| 0af0739792 | |||
| a2034c19c7 | |||
| 5ae24e7e32 | |||
| cc69c8c1b4 | |||
| d0b2acb6b3 | |||
| 7df5ff1aeb | |||
| 7ea2b40585 | |||
| 163fc24ad6 | |||
| a7058f0dbd | |||
| bac1fee526 | |||
| eeb7d2ce09 | |||
| 4bbca69cf0 | |||
| dd43fe62d9 | |||
| 5631c4d57d | |||
| 7fd99856c4 | |||
| 88cde2bbfb | |||
| 61cadf944f | |||
| b86c6785dd | |||
| 1322918d6b | |||
| 9c602642e1 | |||
| d55edaad17 | |||
| 7dc887ff51 | |||
| 140b511c7e | |||
| eade6a9377 | |||
| 020557281c | |||
| 01f30301ed | |||
| 758ae9a1da | |||
| 99bcce647c | |||
| dcf6fadcad | |||
| 7ed3410362 | |||
| 0b3c1b8d55 | |||
| 628cb55e9b | |||
| b6ad4dd76c | |||
| bbb46566d6 | |||
| a17fa6ea9a | |||
| bb7f417889 | |||
| e6adb77560 | |||
| fa94d74a1d | |||
| cd83fa27b9 | |||
| 1db705b00d | |||
| 45237ad7d4 | |||
| d44aa0d28a | |||
| 405396afca | |||
| 3ec6827f76 | |||
| dfc92584f7 | |||
| 743488b7a5 | |||
| fca8c8b09c | |||
| 2b36fe96a2 | |||
| ed90117493 | |||
| f0cd60b93c | |||
| ca9e385bbc | |||
| cfe9398ff0 | |||
| 16728b5195 | |||
| c53b93b24c | |||
| c3cd1afa85 | |||
| 84f1c05d5f | |||
| 49aa15a751 | |||
| 0c5410df72 | |||
| 9b3c92d5f5 | |||
| a4881cd241 | |||
| 4b6a14f617 | |||
| c4013d747c | |||
| 98e31947cc | |||
| 86378add6a | |||
| d00536d05d | |||
| 377d79cfc6 | |||
| cfe59582fc | |||
| 2256d3ae5d | |||
| a8b57060ce | |||
| 655dd97626 | |||
| 451b4920c7 | |||
| b214dc93d8 | |||
| a2d0c4ad7d | |||
| 43f29d2877 | |||
| 5f5f22a0f0 | |||
| 5256afe04c | |||
| b9080eb9c2 | |||
| 5649fb3e2e | |||
| 348b8e4045 | |||
| 2087e9f195 | |||
| ccd84e1850 | |||
| 08ca56873e | |||
| 72761a21e3 | |||
| 9e5a1f004e | |||
| 57fea23de4 | |||
| bc67fc8e55 | |||
| 4aae1b21e9 | |||
| ae69f892f1 | |||
| 93d8634ca3 | |||
| bdd4b68f43 | |||
| a9a674c895 | |||
| ed575b3b68 | |||
| 016d46d030 | |||
| 486685e4b4 | |||
| 26a6a77b8d | |||
| 90aa7973ed | |||
| b2363c02c0 | |||
| 32b59120aa | |||
| 7186b56b64 | |||
| 6247490047 | |||
| f30e14c421 | |||
| e340a2af22 | |||
| 6a5cddf0ce | |||
| 312728fe9a | |||
| 182da130da | |||
| eb3ba8c42e | |||
| dec099b19b | |||
| 21762360ac | |||
| 563fe88842 | |||
| 0e085fbb13 | |||
| ed409e745a | |||
| 4bc58482b3 | |||
| 89ee039a05 | |||
| 5d5b1202c7 | |||
| c7646fd813 | |||
| b1d406b448 | |||
| ea37eab86e | |||
| d045609523 | |||
| 9336448ca9 | |||
| 5830e7824a | |||
| 821feb51b5 | |||
| 547979cd9b | |||
| c4481eb125 | |||
| ad0f2c89e0 | |||
| e15c75b6aa | |||
| b2fb7f0fe7 | |||
| 410e5ebd75 | |||
| 9c57088ef1 | |||
| 24230e12a3 | |||
| 2acef0d4a2 | |||
| aca5ffa36f | |||
| 4fc3726f37 | |||
| 2682e1fbac | |||
| f5c3ae779b | |||
| 068c60afa0 | |||
| 5b8ca5b417 | |||
| acfd12ea30 | |||
| a04b83cada | |||
| a7bf12c052 | |||
| 5c01b23dee | |||
| db11b75a2e | |||
| 2ba4c18cdf | |||
| b264f20f29 | |||
| 5e04ea62f7 | |||
| 3d1db63c0e | |||
| f124d18256 | |||
| 9bffb65dcb | |||
| 2fbcc3832f | |||
| 97b4311e95 | |||
| 228b3a52e9 | |||
| 2f2236646d | |||
| 30603d0561 | |||
| 933af771b7 | |||
| c04a537d69 | |||
| e49d78db47 | |||
| 99ec420ee5 | |||
| f764b034a1 | |||
| 73fe023460 | |||
| 242af3c80e | |||
| 7756e4b8bd | |||
| 56a1d1f627 | |||
| 11bd4ff61d | |||
| 93a06d7f86 | |||
| 76d2d429b7 | |||
| c6de37dbad | |||
| d022e669f0 | |||
| 184e79bae1 | |||
| e6581671c8 | |||
| e0a1c688bf | |||
| 9e0b301179 | |||
| 8680fb2e0e | |||
| c7c605a970 | |||
| 23d648d92d | |||
| b098c98dbb | |||
| b88726beaf | |||
| b2d3e5e194 | |||
| a8315efae0 | |||
| 3781cf6774 | |||
| 7e36d47991 | |||
| 419a01bd09 | |||
| 804a01cab3 | |||
| 931d6aa17c | |||
| 2861539949 | |||
| 281dad68fb | |||
| 04ba432cde | |||
| 61c943a3b2 | |||
| 9fdc7641b3 | |||
| 1029ee9101 | |||
| 9ef5bec2a5 | |||
| 93132eb8a0 | |||
| 9828c25e51 | |||
| db1204288b | |||
| 26c3d37be5 | |||
| 077ea08368 | |||
| 98eab74e97 | |||
| 2a7e88ca76 | |||
| 44491bbbb4 | |||
| 369596b860 | |||
| 15af8f561a | |||
| 58f8d13d71 | |||
| d6413057e2 | |||
| 008382213b | |||
| dd5b4a719b | |||
| 3d198bc211 | |||
| 05ff75eeb2 | |||
| d44ef86319 | |||
| 2f42dc2c35 | |||
| 597414ea6b | |||
| 7f06ce7064 | |||
| adf39680b6 | |||
| ce77d478e3 | |||
| e1e14ae243 | |||
| 4f6e364225 | |||
| 26c02c5766 | |||
| 0d8c668f95 | |||
| 310cff0dfe | |||
| 7f6611ab21 | |||
| bb37e348f5 | |||
| 6b5e03df5e | |||
| d0e0109560 | |||
| dc33f7f197 | |||
| 85f4aa5679 | |||
| d2c5ea026f | |||
| 419ec7ed33 | |||
| 5f7d9eea02 | |||
| 709ee1942d | |||
| 5039cec847 | |||
| e59eff3a16 | |||
| 2206b3b366 | |||
| a2d37e8a22 | |||
| b13eba5f01 | |||
| a48058c7d5 | |||
| ab76aff379 | |||
| b8b8a14268 | |||
| e5ef749718 | |||
| 5d524369b8 | |||
| e78fc0befc | |||
| d9986d09cd | |||
| bd67f4bf1c | |||
| 475bfaf93d | |||
| 1a8af4d8ed | |||
| cdf8dc7a4c | |||
| d71552bddd | |||
| 548c5ab608 | |||
| 6a01384023 | |||
| d70f36e36d | |||
| f65984f079 | |||
| 5b48a7a330 | |||
| 1496aece57 | |||
| 60cf51ad0d | |||
| 8e7231b322 | |||
| 2b339b6842 | |||
| fb0dbfc231 | |||
| 756613e883 | |||
| ede03fafea | |||
| bdec91bfd5 | |||
| 260c2edd21 | |||
| 3eeec8fc67 | |||
| ba6c7e8151 | |||
| 41a213491e | |||
| b599a6bc43 | |||
| a0fd139027 | |||
| 48852bc618 | |||
| 20b781cb7e | |||
| 704b3b709f | |||
| e4674915c2 | |||
| 51fe936e5f | |||
| d8b177411f | |||
| 717b628055 | |||
| e4f94646b6 | |||
| dcec7447e4 | |||
| 5f12552f78 | |||
| d293769c1f | |||
| b45e772a50 | |||
| fdb7716abc | |||
| f72d6dfe0e | |||
| 23029a6a92 | |||
| eda8e4d13f | |||
| 64f578e59f | |||
| 16c57b50cc | |||
| 83c0ba9dab | |||
| a2443dadeb | |||
| 789bb1d4b3 | |||
| 4138ae5ce2 | |||
| 239b5dbf11 | |||
| c046776b9c | |||
| 055a02570b | |||
| e7bbbec0de | |||
| 1e2e5996f3 | |||
| 875717acd4 | |||
| 033feeaf9d | |||
| de336e5f96 | |||
| 82b3dbdae6 | |||
| d1227f7759 | |||
| 4d134387f9 | |||
| 3f8600dfb7 | |||
| 511f043d63 | |||
| 69a41343c2 | |||
| 578327bab6 | |||
| 52908908a5 | |||
| 24d9b99a44 | |||
| dce58b628f | |||
| f42cb4580c | |||
| 52777e36cb | |||
| 7b7e9f3e6e | |||
| d39fa156e7 | |||
| 48bf40919c | |||
| fd53a987be | |||
| b4d298542a | |||
| bae854027b | |||
| 9723c379dd | |||
| e8d8b2e56c | |||
| adb84b0f05 | |||
| a4ee30d031 | |||
| e05194b277 | |||
| 21f7f6ed5b | |||
| 80863ae25b | |||
| 07562a9582 | |||
| 6da196e426 | |||
| d220cc8c79 | |||
| f53c3d9f50 | |||
| fa98f22e3d | |||
| e01c09bcc9 | |||
| 069544bf6c | |||
| b0f0f656af | |||
| 99191e65b0 | |||
| fb41720817 | |||
| 406c290be4 | |||
| 5ae4d7f819 | |||
| e69c1677b2 | |||
| 4d836c180a | |||
| e08b6542d4 | |||
| e1340c63ec | |||
| 4b122c0b94 | |||
| 867438833b | |||
| 8b80aa94b7 | |||
| f960fc60bb | |||
| 64213746b0 | |||
| 09941c67ac | |||
| c2605bb582 | |||
| ab2703c825 | |||
| 08ce8cb3f5 | |||
| 5efe043ab3 | |||
| f2af1ccd36 | |||
| 113d5b4ca3 | |||
| d3461dd3cb | |||
| e95a0fb765 | |||
| c5ce1e27e4 | |||
| 7ecc7fa1df | |||
| c46cd9e6e5 | |||
| e299e59d11 | |||
| 1e0f4d6fdb | |||
| 4dae8f50fa | |||
| 9cc5ed1db0 | |||
| 6d1dd9c420 | |||
| a038e1562f | |||
| 549e3dc579 | |||
| 8440b18223 | |||
| 9c7a03fdc5 | |||
| 9272b27a69 | |||
| ef57330a79 | |||
| d35619eeae | |||
| b38c552cc5 | |||
| 1b91ee579c | |||
| 337c92e522 | |||
| 8fe1eb7525 | |||
| 1deb2a6905 | |||
| 470eddf2b1 | |||
| 69a787411c | |||
| ffeb03e0d0 | |||
| cf4d74a7e3 | |||
| 90c0633212 | |||
| 3ea4898939 | |||
| 1d00c343c6 | |||
| 2a408f0e2b | |||
| 3813be21c7 | |||
| 047d0567e1 | |||
| 68c8c0cb29 | |||
| ab0c5703a5 | |||
| e22b63347f | |||
| 438ba3aded | |||
| 29b002ca80 |
7
.gitignore
vendored
7
.gitignore
vendored
@ -13,6 +13,11 @@ Common/3dParty/cef/win_32
|
||||
Common/3dParty/cef/linux_64
|
||||
Common/3dParty/cef/linux_32
|
||||
Common/3dParty/cef/mac_64
|
||||
Common/3dParty/curl/win_64
|
||||
Common/3dParty/curl/win_32
|
||||
Common/3dParty/curl/linux_64
|
||||
Common/3dParty/curl/linux_32
|
||||
Common/3dParty/curl/mac_64
|
||||
Common/3dParty/v8/v8
|
||||
Common/3dParty/v8/depot_tools
|
||||
Common/3dParty/v8/win_64
|
||||
@ -40,6 +45,8 @@ ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_i.c
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
|
||||
ASCOfficeXlsFile2/win32/dlldata.c
|
||||
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
X2tConverter/**/Makefile.*
|
||||
*.7z
|
||||
*.obj
|
||||
*.pdb
|
||||
*.tlb
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -58,6 +58,9 @@
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
|
||||
#define GETBIT(from, num) ((from & (1 << num)) != 0)
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
typedef unsigned char Bool8;
|
||||
@ -638,14 +641,12 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
std::string sCodePage;
|
||||
for (int i = 0; i < UNICODE_CONVERTER_ENCODINGS_COUNT; ++i)
|
||||
std::map<int, std::string>::const_iterator pFind = NSUnicodeConverter::mapEncodingsICU.find(code_page);
|
||||
if (pFind != NSUnicodeConverter::mapEncodingsICU.end())
|
||||
{
|
||||
if (code_page == NSUnicodeConverter::Encodings[i].WindowsCodePage)
|
||||
{
|
||||
sCodePage = NSUnicodeConverter::Encodings[i].Name;
|
||||
break;
|
||||
}
|
||||
sCodePage = pFind->second;
|
||||
}
|
||||
|
||||
if (sCodePage.empty())
|
||||
sCodePage = "CP1250"/* + std::to_string(code_page)*/;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -393,7 +393,7 @@ namespace XMLTools
|
||||
else
|
||||
{
|
||||
std::string s(m_str.begin(), m_str.end());
|
||||
file.WriteFile((unsigned char*)s.c_str(), s.length());
|
||||
file.WriteFile((unsigned char*)s.c_str(), (DWORD)s.length());
|
||||
}
|
||||
file.CloseFile();
|
||||
return true;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -41,7 +41,7 @@ namespace DocFileFormat
|
||||
public:
|
||||
AnnotationOwnerList(FileInformationBlock* fib, POLE::Stream* tableStream) : std::vector<std::wstring>()
|
||||
{
|
||||
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_bOlderVersion);
|
||||
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcGrpXstAtnOwners > reader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -40,7 +40,7 @@ namespace DocFileFormat
|
||||
|
||||
//read the user initials (LPXCharBuffer9)
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
short cch = reader->ReadByte();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -41,9 +41,9 @@ namespace DocFileFormat
|
||||
static const int STRUCTURE_SIZE = 30;
|
||||
static const int STRUCTURE_SIZE_OLD = 20;
|
||||
|
||||
static const int GetSize(bool bOldVersion)
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return bOldVersion ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
|
||||
inline std::wstring GetUserInitials() const
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -118,70 +118,78 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
/// Creates a new BorderCode with default values
|
||||
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
{
|
||||
}
|
||||
|
||||
/// Parses the unsigned char for a BRC
|
||||
BorderCode( unsigned char* bytes, int size ):
|
||||
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
|
||||
{
|
||||
if ( FormatUtils::ArraySum( bytes, size ) == ( size * 255 ) )
|
||||
{
|
||||
this->fNil = true;
|
||||
fNil = true;
|
||||
}
|
||||
else if ( size == 8 )
|
||||
{
|
||||
//it's a border code of Word 2000/2003
|
||||
this->cv = FormatUtils::BytesToInt32( bytes, 0, size );
|
||||
this->ico = std::wstring( Global::ColorIdentifier[0] );
|
||||
cv = FormatUtils::BytesToInt32( bytes, 0, size );
|
||||
ico = std::wstring( Global::ColorIdentifier[0] );
|
||||
|
||||
this->dptLineWidth = bytes[4];
|
||||
this->brcType = bytes[5];
|
||||
dptLineWidth = bytes[4];
|
||||
brcType = bytes[5];
|
||||
|
||||
short val = FormatUtils::BytesToInt16( bytes, 6, size );
|
||||
this->dptSpace = val & 0x001F;
|
||||
dptSpace = val & 0x001F;
|
||||
|
||||
//not sure if this is correct, the values from the spec are definitly wrong:
|
||||
this->fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
|
||||
this->fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
|
||||
fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
|
||||
fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
|
||||
}
|
||||
else if ( size == 4 )
|
||||
{
|
||||
//it's a border code of Word 97
|
||||
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
|
||||
this->dptLineWidth = (unsigned char)( val & 0x00FF );
|
||||
this->brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
|
||||
|
||||
dptLineWidth = (unsigned char)( val & 0x00FF );
|
||||
brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
|
||||
|
||||
val = FormatUtils::BytesToUInt16( bytes, 2, size );
|
||||
this->ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorIdentifier[0][0], 17, 12 );
|
||||
this->dptSpace = ( val & 0x1F00 ) >> 8;
|
||||
|
||||
ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorNameIdentifier[0][0], 17, 12 );
|
||||
dptSpace = ( val & 0x1F00 ) >> 8;
|
||||
}
|
||||
else
|
||||
else if (size == 2)
|
||||
{
|
||||
//throw new ByteParseException("Cannot parse the struct BRC, the length of the struct doesn't match");
|
||||
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
|
||||
|
||||
dptLineWidth = GETBITS(val, 0, 2);
|
||||
brcType = GETBITS(val, 3, 4);
|
||||
fShadow = GETBIT(val, 5);
|
||||
ico = FormatUtils::MapValueToWideString(GETBITS(val, 6, 10), &Global::ColorNameIdentifier[0][0], 17, 12 );
|
||||
dptSpace = GETBITS(val, 11, 15);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BorderCode( const BorderCode& bc )
|
||||
{
|
||||
if ( this != &bc )
|
||||
{
|
||||
this->cv = bc.cv;
|
||||
this->dptLineWidth = bc.dptLineWidth;
|
||||
this->brcType = bc.brcType;
|
||||
this->ico = bc.ico;
|
||||
this->dptSpace = bc.dptSpace;
|
||||
this->fShadow = bc.fShadow;
|
||||
this->fFrame = bc.fFrame;
|
||||
this->fNil = bc.fNil;
|
||||
cv = bc.cv;
|
||||
dptLineWidth = bc.dptLineWidth;
|
||||
brcType = bc.brcType;
|
||||
ico = bc.ico;
|
||||
dptSpace = bc.dptSpace;
|
||||
fShadow = bc.fShadow;
|
||||
fFrame = bc.fFrame;
|
||||
fNil = bc.fNil;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator == ( const BorderCode& bc )
|
||||
{
|
||||
if ( ( this->cv == bc.cv ) && ( this->dptLineWidth == bc.dptLineWidth ) && ( this->brcType == bc.brcType ) &&
|
||||
( this->ico == bc.ico ) && ( this->dptSpace == bc.dptSpace ) && ( this->fShadow == bc.fShadow ) &&
|
||||
( this->fFrame == bc.fFrame ) && ( this->fNil == bc.fNil ) )
|
||||
if ( ( cv == bc.cv ) && ( dptLineWidth == bc.dptLineWidth ) && ( brcType == bc.brcType ) &&
|
||||
( ico == bc.ico ) && ( dptSpace == bc.dptSpace ) && ( fShadow == bc.fShadow ) &&
|
||||
( fFrame == bc.fFrame ) && ( fNil == bc.fNil ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -129,355 +129,360 @@ namespace DocFileFormat
|
||||
parent->AppendChild( *webHidden );
|
||||
RELEASEOBJECT( webHidden );
|
||||
}
|
||||
std::list<SinglePropertyModifier>::iterator end = sprms->end();
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
|
||||
if ((sprms) && (!sprms->empty()))
|
||||
{
|
||||
int nProperty = 0; //for unknown test
|
||||
|
||||
switch ( (int)( iter->OpCode ) )
|
||||
std::list<SinglePropertyModifier>::iterator end = sprms->end();
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
|
||||
{
|
||||
case sprmOldCIstd :
|
||||
case sprmCIstd : // style id
|
||||
int nProperty = 0; //for unknown test
|
||||
|
||||
switch ( (int)( iter->OpCode ) )
|
||||
{
|
||||
if (_isRunStyleNeeded && !_webHidden)
|
||||
case sprmOldCIstd :
|
||||
case sprmCIstd : // style id
|
||||
{
|
||||
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (_currentIstd < _doc->Styles->Styles->size())
|
||||
if (_isRunStyleNeeded && !_webHidden)
|
||||
{
|
||||
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
|
||||
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (_currentIstd < _doc->Styles->Styles->size())
|
||||
{
|
||||
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCFBiDi :
|
||||
appendFlagElement( parent, *iter, L"rtl", true );
|
||||
_isRTL = true;
|
||||
break;
|
||||
|
||||
case sprmOldCFBold :
|
||||
case sprmCFBold :
|
||||
appendFlagElement( parent, *iter, L"b", true );
|
||||
break;
|
||||
|
||||
case sprmCFBoldBi :
|
||||
appendFlagElement( parent, *iter, L"bCs", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFCaps :
|
||||
case sprmCFCaps :
|
||||
appendFlagElement( parent, *iter, L"caps", true );
|
||||
break;
|
||||
|
||||
case sprmCFComplexScripts :
|
||||
appendFlagElement( parent, *iter, L"cs", true );
|
||||
break;
|
||||
|
||||
case sprmCFDStrike :
|
||||
appendFlagElement( parent, *iter, L"dstrike", true );
|
||||
break;
|
||||
|
||||
case sprmCFEmboss :
|
||||
appendFlagElement( parent, *iter, L"emboss", true );
|
||||
break;
|
||||
|
||||
case sprmCFImprint :
|
||||
appendFlagElement( parent, *iter, L"imprint", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFItalic :
|
||||
case sprmCFItalic :
|
||||
appendFlagElement( parent, *iter, L"i", true );
|
||||
break;
|
||||
|
||||
case sprmCFItalicBi:
|
||||
appendFlagElement( parent, *iter, L"iCs", true );
|
||||
break;
|
||||
|
||||
case 0x0875:
|
||||
appendFlagElement( parent, *iter, L"noProof", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFOutline:
|
||||
case sprmCFOutline:
|
||||
appendFlagElement( parent, *iter, L"outline", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFShadow:
|
||||
case sprmCFShadow:
|
||||
appendFlagElement( parent, *iter, L"shadow", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFSmallCaps:
|
||||
case sprmCFSmallCaps:
|
||||
appendFlagElement( parent, *iter, L"smallCaps", true );
|
||||
break;
|
||||
|
||||
case sprmCFSpecVanish:
|
||||
appendFlagElement( parent, *iter, L"specVanish", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFStrike:
|
||||
case sprmCFStrike:
|
||||
appendFlagElement( parent, *iter, L"strike", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFVanish:
|
||||
case sprmCFVanish:
|
||||
appendFlagElement( parent, *iter, L"vanish", true );
|
||||
break;
|
||||
|
||||
case 0x0811:
|
||||
appendFlagElement( parent, *iter, L"webHidden", true );
|
||||
break;
|
||||
|
||||
case sprmOldCIss:
|
||||
case sprmCIss:
|
||||
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
|
||||
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
|
||||
break;
|
||||
|
||||
case sprmCRgLid0_80:
|
||||
case sprmCRgLid0:
|
||||
{ //latin
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmOldCLid:
|
||||
case sprmCRgLid1_80:
|
||||
case sprmCRgLid1:
|
||||
{ //east asia
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCLidBi:
|
||||
{
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCBrc80:
|
||||
case sprmCBrc:
|
||||
{ //borders
|
||||
XMLTools::XMLElement bdr( L"w:bdr" );
|
||||
BorderCode bc( iter->Arguments, iter->argumentsSize );
|
||||
appendBorderAttributes( &bc, &bdr );
|
||||
parent->AppendChild( bdr );
|
||||
}break;
|
||||
|
||||
case sprmCShd80:
|
||||
case sprmCShd:
|
||||
{ //shading
|
||||
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
appendShading( parent, desc );
|
||||
}break;
|
||||
|
||||
case sprmOldCIco:
|
||||
case sprmCIco:
|
||||
case sprmCIcoBi:
|
||||
{//color
|
||||
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
|
||||
}break;
|
||||
|
||||
case sprmCCv:
|
||||
{
|
||||
std::wstringstream sstream;
|
||||
|
||||
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
|
||||
colorVal->SetValue(sstream.str());
|
||||
}break;
|
||||
|
||||
case sprmCOldHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
case sprmCHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCDxaSpace:
|
||||
case sprmCDxaSpace:
|
||||
{
|
||||
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCFtcBi :
|
||||
{//default from FontTable
|
||||
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
if (ffn)
|
||||
m_sDefaultFont = ffn->xszFtn;
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCHpsBi :
|
||||
{
|
||||
appendValueElement( parent, L"szCs",
|
||||
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}
|
||||
break;
|
||||
// Font Size in points (2~3276) default 20-half-points
|
||||
case sprmOldCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
|
||||
true );
|
||||
}break;
|
||||
case sprmCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCMajority :
|
||||
{ //for complex props
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
case sprmCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsKern:
|
||||
case sprmCHpsKern:
|
||||
{
|
||||
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
{ // font family
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sAsciiFont = ffn->xszFtn;
|
||||
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
|
||||
rFonts->AppendAttribute( *ascii );
|
||||
RELEASEOBJECT( ascii );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCRgFtc1:
|
||||
{
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sEastAsiaFont = ffn->xszFtn;
|
||||
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
|
||||
rFonts->AppendAttribute( *eastAsia );
|
||||
RELEASEOBJECT( eastAsia );
|
||||
}
|
||||
}
|
||||
}break;
|
||||
break;
|
||||
|
||||
case sprmCFBiDi :
|
||||
appendFlagElement( parent, *iter, L"rtl", true );
|
||||
_isRTL = true;
|
||||
break;
|
||||
|
||||
case sprmOldCFBold :
|
||||
case sprmCFBold :
|
||||
appendFlagElement( parent, *iter, L"b", true );
|
||||
break;
|
||||
|
||||
case sprmCFBoldBi :
|
||||
appendFlagElement( parent, *iter, L"bCs", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFCaps :
|
||||
case sprmCFCaps :
|
||||
appendFlagElement( parent, *iter, L"caps", true );
|
||||
break;
|
||||
|
||||
case sprmCFComplexScripts :
|
||||
appendFlagElement( parent, *iter, L"cs", true );
|
||||
break;
|
||||
|
||||
case sprmCFDStrike :
|
||||
appendFlagElement( parent, *iter, L"dstrike", true );
|
||||
break;
|
||||
|
||||
case sprmCFEmboss :
|
||||
appendFlagElement( parent, *iter, L"emboss", true );
|
||||
break;
|
||||
|
||||
case sprmCFImprint :
|
||||
appendFlagElement( parent, *iter, L"imprint", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFItalic :
|
||||
case sprmCFItalic :
|
||||
appendFlagElement( parent, *iter, L"i", true );
|
||||
break;
|
||||
|
||||
case sprmCFItalicBi:
|
||||
appendFlagElement( parent, *iter, L"iCs", true );
|
||||
break;
|
||||
|
||||
case 0x0875:
|
||||
appendFlagElement( parent, *iter, L"noProof", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFOutline:
|
||||
case sprmCFOutline:
|
||||
appendFlagElement( parent, *iter, L"outline", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFShadow:
|
||||
case sprmCFShadow:
|
||||
appendFlagElement( parent, *iter, L"shadow", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFSmallCaps:
|
||||
case sprmCFSmallCaps:
|
||||
appendFlagElement( parent, *iter, L"smallCaps", true );
|
||||
break;
|
||||
|
||||
case sprmCFSpecVanish:
|
||||
appendFlagElement( parent, *iter, L"specVanish", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFStrike:
|
||||
case sprmCFStrike:
|
||||
appendFlagElement( parent, *iter, L"strike", true );
|
||||
break;
|
||||
|
||||
case sprmOldCFVanish:
|
||||
case sprmCFVanish:
|
||||
appendFlagElement( parent, *iter, L"vanish", true );
|
||||
break;
|
||||
|
||||
case 0x0811:
|
||||
appendFlagElement( parent, *iter, L"webHidden", true );
|
||||
break;
|
||||
|
||||
case sprmOldCIss:
|
||||
case sprmCIss:
|
||||
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
|
||||
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
|
||||
break;
|
||||
|
||||
case sprmCRgLid0_80:
|
||||
case sprmCRgLid0:
|
||||
{ //latin
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmOldCLid:
|
||||
case sprmCRgLid1_80:
|
||||
case sprmCRgLid1:
|
||||
{ //east asia
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCLidBi:
|
||||
{
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCBrc80:
|
||||
case sprmCBrc:
|
||||
{ //borders
|
||||
XMLTools::XMLElement bdr( L"w:bdr" );
|
||||
BorderCode bc( iter->Arguments, iter->argumentsSize );
|
||||
appendBorderAttributes( &bc, &bdr );
|
||||
parent->AppendChild( bdr );
|
||||
}break;
|
||||
|
||||
case sprmCShd80:
|
||||
case sprmCShd:
|
||||
{ //shading
|
||||
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
appendShading( parent, desc );
|
||||
}break;
|
||||
|
||||
case sprmOldCIco:
|
||||
case sprmCIco:
|
||||
case sprmCIcoBi:
|
||||
{//color
|
||||
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
|
||||
}break;
|
||||
|
||||
case sprmCCv:
|
||||
{
|
||||
std::wstringstream sstream;
|
||||
|
||||
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
|
||||
colorVal->SetValue(sstream.str());
|
||||
}break;
|
||||
|
||||
case sprmCOldHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
case sprmCHighlight:
|
||||
{
|
||||
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCDxaSpace:
|
||||
case sprmCDxaSpace:
|
||||
{
|
||||
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCFtcBi :
|
||||
{//default from FontTable
|
||||
SHORT nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
case sprmCRgFtc2:
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
if (ffn)
|
||||
m_sDefaultFont = ffn->xszFtn;
|
||||
}
|
||||
}break;
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
case sprmCHpsBi :
|
||||
{
|
||||
appendValueElement( parent, L"szCs",
|
||||
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}
|
||||
break;
|
||||
// Font Size in points (2~3276) default 20-half-points
|
||||
case sprmOldCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
|
||||
true );
|
||||
}break;
|
||||
case sprmCHps :
|
||||
{
|
||||
appendValueElement (parent, L"sz",
|
||||
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCMajority :
|
||||
{ //for complex props
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
case sprmCHpsPos:
|
||||
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
|
||||
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
appendValueElement (parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsKern:
|
||||
case sprmCHpsKern:
|
||||
{
|
||||
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
{ // font family
|
||||
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sAsciiFont = ffn->xszFtn;
|
||||
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
|
||||
rFonts->AppendAttribute( *ascii );
|
||||
RELEASEOBJECT( ascii );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCRgFtc1:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_sEastAsiaFont = ffn->xszFtn;
|
||||
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
|
||||
rFonts->AppendAttribute( *eastAsia );
|
||||
RELEASEOBJECT( eastAsia );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmCRgFtc2:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_shAnsiFont = ffn->xszFtn;
|
||||
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
|
||||
rFonts->AppendAttribute( *ansi );
|
||||
RELEASEOBJECT( ansi );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmOldCKul:
|
||||
case sprmCKul:
|
||||
{ //Underlining
|
||||
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmCCharScale:
|
||||
{ //char width
|
||||
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCSfxText:
|
||||
{ //animation
|
||||
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
|
||||
}break;
|
||||
|
||||
case sprmCIdctHint:
|
||||
{
|
||||
switch(iter->Arguments[0])
|
||||
{
|
||||
case 0: break; // default
|
||||
case 1: break; // eastAsia
|
||||
case 2: break; // cs
|
||||
case 0xFF: break; //No ST_Hint equivalent
|
||||
}
|
||||
|
||||
}break;
|
||||
|
||||
case sprmCPbiIBullet:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (nIndex >=0)
|
||||
{
|
||||
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
|
||||
if (it != _doc->PictureBulletsCPsMap.end())
|
||||
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
//добавить
|
||||
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
m_shAnsiFont = ffn->xszFtn;
|
||||
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
|
||||
rFonts->AppendAttribute( *ansi );
|
||||
RELEASEOBJECT( ansi );
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmOldCKul:
|
||||
case sprmCKul:
|
||||
{ //Underlining
|
||||
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
|
||||
}
|
||||
}break;
|
||||
break;
|
||||
|
||||
case sprmCPbiGrf:
|
||||
{
|
||||
//used picture bullet
|
||||
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
case sprmCCharScale:
|
||||
{ //char width
|
||||
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCSfxText:
|
||||
{ //animation
|
||||
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
|
||||
}break;
|
||||
|
||||
}break;
|
||||
case sprmCIdctHint:
|
||||
{
|
||||
switch(iter->Arguments[0])
|
||||
{
|
||||
case 0: break; // default
|
||||
case 1: break; // eastAsia
|
||||
case 2: break; // cs
|
||||
case 0xFF: break; //No ST_Hint equivalent
|
||||
}
|
||||
|
||||
case sprmCRsidProp:
|
||||
case sprmCRsidText:
|
||||
break;
|
||||
}break;
|
||||
|
||||
default:
|
||||
if (iter->argumentsSize == 2)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}else
|
||||
if (iter->argumentsSize == 1)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
case sprmCPbiIBullet:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (nIndex >=0)
|
||||
{
|
||||
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
|
||||
if (it != _doc->PictureBulletsCPsMap.end())
|
||||
{
|
||||
//добавить
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCPbiGrf:
|
||||
{
|
||||
//used picture bullet
|
||||
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
}break;
|
||||
|
||||
case sprmCRsidProp:
|
||||
case sprmCRsidText:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (iter->argumentsSize == 2)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}else
|
||||
if (iter->argumentsSize == 1)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -35,19 +35,188 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class CharacterPropertyExceptions: public PropertyExceptions
|
||||
{
|
||||
public:
|
||||
/// Creates a CHPX wich doesn't modify anything.
|
||||
/// The grpprl list is empty
|
||||
CharacterPropertyExceptions(): PropertyExceptions()
|
||||
{
|
||||
}
|
||||
class CharacterPropertyExceptions: public PropertyExceptions
|
||||
{
|
||||
public:
|
||||
/// Creates a CHPX wich doesn't modify anything.
|
||||
/// The grpprl list is empty
|
||||
CharacterPropertyExceptions(): PropertyExceptions()
|
||||
{
|
||||
}
|
||||
|
||||
/// Parses the bytes to retrieve a CHPX
|
||||
CharacterPropertyExceptions( unsigned char* bytes, int size, bool oldVersion) :
|
||||
PropertyExceptions( bytes, size, oldVersion )
|
||||
{
|
||||
}
|
||||
};
|
||||
/// Parses the bytes to retrieve a CHPX
|
||||
CharacterPropertyExceptions( unsigned char* bytes, int size, int nWordVersion) :
|
||||
PropertyExceptions( bytes, size, nWordVersion )
|
||||
{
|
||||
if (nWordVersion > 1)
|
||||
{
|
||||
RELEASEOBJECT( grpprl );
|
||||
grpprl = new std::list<SinglePropertyModifier>();
|
||||
|
||||
MemoryStream oStream(bytes, size);
|
||||
int pos = 0;
|
||||
|
||||
if (nWordVersion == 3)
|
||||
{
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned char val;
|
||||
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
|
||||
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
|
||||
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
|
||||
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
|
||||
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
|
||||
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
|
||||
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
|
||||
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
|
||||
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
|
||||
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
|
||||
|
||||
bool fsIco = GETBIT(fChar, 10);
|
||||
bool fsFtc = GETBIT(fChar, 11);
|
||||
bool fsHps = GETBIT(fChar, 12);
|
||||
bool fsKul = GETBIT(fChar, 13);
|
||||
bool fsPos = GETBIT(fChar, 14);
|
||||
bool fsSpace = GETBIT(fChar, 15);
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
int fff = oStream.ReadUInt16(); pos += 2;//?????
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
|
||||
|
||||
if (hps > 0)
|
||||
{
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
|
||||
}
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fText = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned short qpsSpace = GETBITS(fText, 0, 5);
|
||||
unsigned char wSpare2 = GETBITS(fText, 6, 7);
|
||||
unsigned char ico = GETBITS(fText, 8, 11);
|
||||
unsigned char kul = GETBITS(fText, 12, 14);
|
||||
bool fSysVanish = GETBIT(fChar, 15);
|
||||
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
|
||||
|
||||
//sizeof(CHP) == 12 == 0xC
|
||||
if (pos + 4 > size) return;
|
||||
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char fnPic = oStream.ReadByte(); pos += 1;
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
|
||||
}
|
||||
else if (nWordVersion == 2)
|
||||
{
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned char val;
|
||||
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
|
||||
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
|
||||
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCIbstRMark, 1, &val));
|
||||
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
|
||||
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
|
||||
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
|
||||
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
|
||||
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
|
||||
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
|
||||
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
|
||||
val = GETBIT(fChar, 10); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
|
||||
val = GETBIT(fChar, 11); grpprl->push_back(SinglePropertyModifier(sprmOldCFObj, 1, &val));
|
||||
val = GETBIT(fChar, 12); grpprl->push_back(SinglePropertyModifier(sprmCFBoldBi, 1, &val));
|
||||
val = GETBIT(fChar, 13); grpprl->push_back(SinglePropertyModifier(sprmCFItalicBi, 1, &val));
|
||||
val = GETBIT(fChar, 14); grpprl->push_back(SinglePropertyModifier(sprmCFBiDi, 1, &val));
|
||||
val = GETBIT(fChar, 15); grpprl->push_back(SinglePropertyModifier(sprmCFDiacColor, 1, &val));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fChar2 = oStream.ReadUInt16(); pos += 2;
|
||||
bool fsIco = GETBIT(fChar2, 0);
|
||||
bool fsFtc = GETBIT(fChar2, 1);
|
||||
bool fsHps = GETBIT(fChar2, 2);
|
||||
bool fsKul = GETBIT(fChar2, 3);
|
||||
bool fsPos = GETBIT(fChar2, 4);
|
||||
bool fsSpace = GETBIT(fChar2, 5);
|
||||
bool fsLid = GETBIT(fChar2, 6);
|
||||
bool fsIcoBi = GETBIT(fChar2, 7);
|
||||
bool fsFtcBi = GETBIT(fChar2, 8);
|
||||
bool fsHpsBi = GETBIT(fChar2, 9);
|
||||
bool fsLidBi = GETBIT(fChar2, 10);
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
|
||||
|
||||
if (hps > 0)
|
||||
{
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
|
||||
}
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short fText = oStream.ReadUInt16(); pos += 2;
|
||||
|
||||
unsigned short qpsSpace = GETBITS(fText, 0, 5);
|
||||
unsigned char wSpare2 = GETBITS(fText, 6, 7);
|
||||
unsigned char ico = GETBITS(fText, 8, 11);
|
||||
unsigned char kul = GETBITS(fText, 12, 14);
|
||||
bool fSysVanish = GETBIT(fChar, 15);
|
||||
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
|
||||
|
||||
//if (pos + 1 > size) return;
|
||||
//unsigned char icoBi = oStream.ReadUInt16(); pos += 1;//wSpare3
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short lid = oStream.ReadUInt16(); pos += 2;
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCLid, 2, (BYTE*)&lid));
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short ftcBi = oStream.ReadUInt16(); pos += 2;
|
||||
grpprl->push_back(SinglePropertyModifier(sprmCFtcBi, 4, (BYTE*)&ftcBi));
|
||||
|
||||
//if (pos + 2 > size) return;
|
||||
//unsigned short hpsBi = oStream.ReadUInt16(); pos += 2;
|
||||
//grpprl->push_back(SinglePropertyModifier(sprmCHpsBi, 4, (BYTE*)&hpsBi));
|
||||
|
||||
//if (pos + 2 > size) return;
|
||||
//unsigned short lidBi = oStream.ReadUInt16(); pos += 2;
|
||||
//grpprl->push_back(SinglePropertyModifier(sprmCLidBi, 2, (BYTE*)&lidBi));
|
||||
|
||||
if (pos + 4 > size) return;
|
||||
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
|
||||
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
|
||||
|
||||
if (pos + 1 > size) return;
|
||||
unsigned char fnPic = oStream.ReadByte(); pos += 1;
|
||||
|
||||
if (pos + 2 > size) return;
|
||||
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -72,10 +72,14 @@ namespace DocFileFormat
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
|
||||
unsigned short index_author = atrdPre10->GetAuthorIndex();
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
|
||||
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:author",
|
||||
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
|
||||
}
|
||||
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
|
||||
|
||||
//!!!TODO!!!
|
||||
@ -95,7 +99,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx(fc);
|
||||
TableInfo tai(papx);
|
||||
TableInfo tai(papx, m_document->nWordVersion);
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -107,7 +111,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph(cp);
|
||||
cp = writeParagraph(cp, 0x7fffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -69,8 +69,13 @@ namespace OpenXmlContentTypes
|
||||
static const wchar_t* Tiff = L"image/tiff";
|
||||
static const wchar_t* Wmf = L"image/x-wmf";
|
||||
static const wchar_t* Bmp = L"image/bmp";
|
||||
static const wchar_t* Pcz = L"image/x-pcz";
|
||||
}
|
||||
namespace DocPrContentTypes
|
||||
{
|
||||
static const wchar_t* App = L"application/vnd.openxmlformats-officedocument.extended-properties+xml";
|
||||
static const wchar_t* Core = L"application/vnd.openxmlformats-package.core-properties+xml";
|
||||
}
|
||||
|
||||
namespace WordprocessingMLContentTypes
|
||||
{
|
||||
// WordprocessingML content types
|
||||
@ -136,7 +141,7 @@ namespace OpenXmlNamespaces
|
||||
|
||||
namespace OpenXmlRelationshipTypes
|
||||
{
|
||||
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
static const wchar_t* ExtendedProperties = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
|
||||
|
||||
static const wchar_t* Theme = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
@ -158,6 +163,7 @@ namespace OpenXmlRelationshipTypes
|
||||
static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
|
||||
static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
static const wchar_t* VbaProject = L"http://schemas.microsoft.com/office/2006/relationships/vbaProject";
|
||||
static const wchar_t* Hyperlink = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
||||
}
|
||||
|
||||
namespace MicrosoftWordRelationshipTypes
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -47,30 +47,17 @@ namespace DocFileFormat
|
||||
|
||||
virtual ~ConversionContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Adds a new RSID to the set
|
||||
inline void AddRsid(const std::wstring& rsid)
|
||||
{
|
||||
if (AllRsids.find(rsid) == AllRsids.end())
|
||||
AllRsids.insert(rsid);
|
||||
}
|
||||
|
||||
inline WordDocument* GetDocument()
|
||||
{
|
||||
return _doc;
|
||||
}
|
||||
|
||||
inline WordprocessingDocument* GetXmlDocument()
|
||||
{
|
||||
return _docx;
|
||||
}
|
||||
|
||||
public:
|
||||
WordprocessingDocument* _docx;
|
||||
WordDocument* _doc;
|
||||
/// A set thta contains all revision ids.
|
||||
|
||||
std::set<std::wstring> AllRsids;
|
||||
};
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -63,8 +63,16 @@ namespace DocFileFormat
|
||||
{
|
||||
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
{
|
||||
if (!doc || !docx) return S_FALSE;
|
||||
|
||||
ConversionContext context( doc, docx );
|
||||
|
||||
//Write fontTable.xml
|
||||
if (doc->FontTable)
|
||||
{
|
||||
FontTableMapping fontTableMapping( &context );
|
||||
doc->FontTable->Convert( &fontTableMapping );
|
||||
}
|
||||
//Write styles.xml
|
||||
if (doc->Styles)
|
||||
{
|
||||
@ -107,14 +115,6 @@ namespace DocFileFormat
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//Write fontTable.xml
|
||||
if (doc->FontTable)
|
||||
{
|
||||
FontTableMapping fontTableMapping( &context );
|
||||
doc->FontTable->Convert( &fontTableMapping );
|
||||
}
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000 );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -59,29 +59,30 @@ namespace DocFileFormat
|
||||
short wdy;
|
||||
|
||||
public:
|
||||
/// Creates a new DateAndTime with default values
|
||||
DateAndTime()
|
||||
{
|
||||
setDefaultValues();
|
||||
}
|
||||
|
||||
/// Parses the unsigned char sto retrieve a DateAndTime
|
||||
DateAndTime( unsigned char* bytes, int size )
|
||||
{
|
||||
if ( size == 4 )
|
||||
{
|
||||
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
|
||||
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
|
||||
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
|
||||
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
|
||||
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
|
||||
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
|
||||
}
|
||||
}
|
||||
DateAndTime()
|
||||
{
|
||||
setDefaultValues();
|
||||
}
|
||||
DateAndTime( unsigned int val )
|
||||
{
|
||||
DateAndTime((unsigned char*)&val, 4);
|
||||
}
|
||||
DateAndTime( unsigned char* bytes, int size )
|
||||
{
|
||||
if ( size == 4 )
|
||||
{
|
||||
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
|
||||
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
|
||||
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
|
||||
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
|
||||
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
|
||||
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
|
||||
}
|
||||
}
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
SYSTEMTIME ToSYSTEMTIME()
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -39,10 +39,12 @@
|
||||
#include "../Common/TextMark.h"
|
||||
#include "../Common/FormatUtils.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
_fldCharCounter(0), AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
_endnoteNr(0), _commentNr(0), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
@ -50,17 +52,15 @@ namespace DocFileFormat
|
||||
m_bInternalXmlWriter = false;
|
||||
|
||||
_writeWebHidden = false;
|
||||
_writeInstrText = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
|
||||
//--------------------------------------------
|
||||
_embeddedObject = false;
|
||||
_writeInstrText = false;
|
||||
}
|
||||
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
|
||||
_fldCharCounter(0), AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0),
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0),
|
||||
_commentNr(0), _caller(caller)
|
||||
{
|
||||
m_document = NULL;
|
||||
@ -68,7 +68,6 @@ namespace DocFileFormat
|
||||
m_bInternalXmlWriter = false;
|
||||
|
||||
_writeWebHidden = false;
|
||||
_writeInstrText = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
_embeddedObject = false;
|
||||
@ -88,7 +87,12 @@ namespace DocFileFormat
|
||||
int DocumentMapping::getCurrentSection(int cp)
|
||||
{
|
||||
//if cp is the last char of a section, the next section will start at cp +1
|
||||
int current = 0;
|
||||
size_t current = 0;
|
||||
|
||||
if (m_document->SectionPlex->CharacterPositions.empty())
|
||||
{
|
||||
return cp;
|
||||
}
|
||||
|
||||
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
|
||||
{
|
||||
@ -107,7 +111,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ( !m_document->ListPlex ) return -1;
|
||||
|
||||
for (int i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
|
||||
for (size_t i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
|
||||
{
|
||||
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
|
||||
{
|
||||
@ -141,7 +145,7 @@ namespace DocFileFormat
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
|
||||
int DocumentMapping::writeParagraph(int cp)
|
||||
int DocumentMapping::writeParagraph(int cp, int cpEnd)
|
||||
{
|
||||
//search the paragraph end
|
||||
int cpParaEnd = cp;
|
||||
@ -171,7 +175,7 @@ namespace DocFileFormat
|
||||
{
|
||||
cpParaEnd++;
|
||||
|
||||
return writeParagraph(cp, cpParaEnd, false);
|
||||
return writeParagraph(cp, (std::min)(cpEnd, cpParaEnd), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,8 +191,8 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos(cp);
|
||||
int fcEnd = m_document->FindFileCharPos(cpEnd);
|
||||
|
||||
if (fc < 0 || fcEnd < 0)
|
||||
return 0;
|
||||
if (fc < 0 || fcEnd < 0 || fc == fcEnd)
|
||||
return -1;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx(fc);
|
||||
|
||||
@ -382,7 +386,7 @@ namespace DocFileFormat
|
||||
int DocumentMapping::writeRun (std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp)
|
||||
{
|
||||
int cp = initialCp;
|
||||
int result_cp = cp + chars->size();
|
||||
int result_cp = cp + (int)chars->size();
|
||||
|
||||
if ((_skipRuns <= 0) && (chars->size() > 0))
|
||||
{
|
||||
@ -496,7 +500,7 @@ namespace DocFileFormat
|
||||
{
|
||||
textType = std::wstring(L"delText");
|
||||
}
|
||||
else if (_writeInstrText)
|
||||
else if ((!_fieldLevels.empty()) && (_fieldLevels.back().bBegin && !_fieldLevels.back().bSeparate))
|
||||
{
|
||||
textType = std::wstring(L"instrText");
|
||||
}
|
||||
@ -534,8 +538,7 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::PageBreakOrSectionMark == code)
|
||||
{
|
||||
//write page break, section breaks are written by writeParagraph() method
|
||||
if (/*!isSectionEnd(c)*/_isSectionPageBreak == 0)
|
||||
if (_isSectionPageBreak == 0)
|
||||
{
|
||||
writeTextElement(text, textType);
|
||||
|
||||
@ -560,31 +563,43 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::FieldBeginMark == code)
|
||||
{
|
||||
_fieldLevels.push_back(fieldLevels());
|
||||
|
||||
int cpFieldStart = initialCp + i;
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
std::wstring f;
|
||||
if (cpFieldEnd < m_document->Text->size())
|
||||
f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
std::wstring f, sFieldString;
|
||||
if (cpFieldEnd < (int)m_document->Text->size())
|
||||
sFieldString = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
|
||||
std::wstring EMBED ( L" EMBED" );
|
||||
std::wstring LINK ( L" LINK" );
|
||||
std::wstring FORM ( L" FORM" );
|
||||
std::wstring Excel ( L" Excel" );
|
||||
std::wstring Word ( L" Word" );
|
||||
std::wstring opendocument(L" opendocument" );
|
||||
std::wstring Equation ( L" Equation" );
|
||||
std::wstring MERGEFORMAT( L" MERGEFORMAT" );
|
||||
std::wstring QUOTE ( L" QUOTE" );
|
||||
std::vector<std::wstring> arField;
|
||||
boost::algorithm::split(arField, sFieldString, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
|
||||
|
||||
std::wstring EMBED ( L"EMBED" );
|
||||
std::wstring embed ( L"embed" );
|
||||
std::wstring LINK ( L"LINK" );
|
||||
std::wstring FORM ( L"FORM" );
|
||||
std::wstring Excel ( L"Excel" );
|
||||
std::wstring Word ( L"Word" );
|
||||
std::wstring opendocument(L"opendocument" );
|
||||
std::wstring Equation ( L"Equation" );
|
||||
std::wstring MERGEFORMAT( L"MERGEFORMAT" );
|
||||
std::wstring QUOTE ( L"QUOTE" );
|
||||
std::wstring chart ( L"Chart" );
|
||||
std::wstring PBrush ( L" PBrush" );
|
||||
std::wstring TOC ( L" TOC" );
|
||||
std::wstring HYPERLINK ( L" HYPERLINK" );
|
||||
std::wstring PAGEREF ( L" PAGEREF" );
|
||||
std::wstring PBrush ( L"PBrush" );
|
||||
std::wstring TOC ( L"TOC" );
|
||||
std::wstring HYPERLINK ( L"HYPERLINK" );
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
else
|
||||
f = sFieldString;
|
||||
|
||||
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end() ||
|
||||
search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end();
|
||||
bool bLINK = search( f.begin(), f.end(), LINK.begin(), LINK.end()) != f.end();
|
||||
bool bOpendocument = search( f.begin(), f.end(), opendocument.begin(), opendocument.end()) != f.end();
|
||||
bool bFORM = search( f.begin(), f.end(), FORM.begin(), FORM.end()) != f.end();
|
||||
@ -592,33 +607,59 @@ namespace DocFileFormat
|
||||
bool bExcel = search( f.begin(), f.end(), Excel.begin(), Excel.end()) != f.end();
|
||||
bool bWord = search( f.begin(), f.end(), Word.begin(), Word.end()) != f.end();
|
||||
bool bHYPERLINK = search( f.begin(), f.end(), HYPERLINK.begin(), HYPERLINK.end()) != f.end();
|
||||
bool bPAGEREF = search( f.begin(), f.end(), PAGEREF.begin(), PAGEREF.end()) != f.end();
|
||||
bool bQUOTE = search( f.begin(), f.end(), QUOTE.begin(), QUOTE.end()) != f.end();
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = !bPAGEREF && search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
|
||||
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
{
|
||||
std::wstring f1 = arField[1];
|
||||
bPAGEREF = search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end();
|
||||
}
|
||||
|
||||
if (bTOC)
|
||||
_bContentWrite = true;
|
||||
|
||||
if ( bFORM )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
|
||||
std::wstring FORMTEXT ( L" FORMTEXT" );
|
||||
std::wstring FORMCHECKBOX ( L" FORMCHECKBOX" );
|
||||
std::wstring FORMDROPDOWN ( L" FORMDROPDOWN" );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
|
||||
bool bFORMTEXT = search( f.begin(), f.end(), FORMTEXT.begin(), FORMTEXT.end()) != f.end();
|
||||
bool bFORMCHECKBOX = search( f.begin(), f.end(), FORMCHECKBOX.begin(), FORMCHECKBOX.end()) != f.end();
|
||||
bool bFORMDROPDOWN = search( f.begin(), f.end(), FORMDROPDOWN.begin(), FORMDROPDOWN.end()) != f.end();
|
||||
|
||||
/*if (cpPic < cpFieldEnd)
|
||||
if (bFORMTEXT || bFORMCHECKBOX || bFORMDROPDOWN)
|
||||
{
|
||||
int fcPic = _doc.PieceTable.FileCharacterPositions[cpPic];
|
||||
CharacterPropertyExceptions chpxPic = _doc.GetCharacterPropertyExceptions(fcPic, fcPic + 1)[0];
|
||||
NilPicfAndBinData npbd = new NilPicfAndBinData(chpxPic, _doc.DataStream);
|
||||
FormFieldData ffdata = new FormFieldData(npbd.binData);
|
||||
ffdata.Convert(new FormFieldDataMapping(m_pXmlWriter));
|
||||
}*/
|
||||
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
int fcPic = m_document->FindFileCharPos( cpPic );
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
|
||||
if (chpxs)
|
||||
{
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
FormFieldData ffdata (2, chpxSep, m_document->DataStream, false);
|
||||
FormFieldDataMapping data_mapping(m_pXmlWriter, m_context, _caller);
|
||||
ffdata.Convert(&data_mapping);
|
||||
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_writeInstrText = true;
|
||||
|
||||
_fldCharCounter++;
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if ( ( bMERGEFORMAT || bExcel || bWord || bOpendocument )
|
||||
&&
|
||||
@ -632,61 +673,72 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
|
||||
|
||||
_writeInstrText = true;
|
||||
|
||||
_fldCharCounter++;
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else if ( (bHYPERLINK && bPAGEREF) || bPAGE)
|
||||
else if (bHYPERLINK && bPAGEREF)
|
||||
{
|
||||
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
|
||||
std::vector<std::wstring> toc;
|
||||
|
||||
if ((search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end()) || bPAGE)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
if (arField.size() > 1)
|
||||
f = arField[1];
|
||||
|
||||
_writeInstrText = true;
|
||||
_fldCharCounter++;
|
||||
if ( _bContentWrite )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( cpFieldSep2 < cpFieldEnd)
|
||||
for (size_t i = 1; i < arField.size(); i++)
|
||||
{
|
||||
cpFieldSep2 = searchNextTextMark(m_document->Text, cpFieldSep1 + 1, TextMark::FieldSeparator);
|
||||
std::wstring f1( ( m_document->Text->begin() + cpFieldSep1 ), ( m_document->Text->begin() + cpFieldSep2 + 1 ) );
|
||||
toc.push_back(f1);
|
||||
|
||||
if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
|
||||
{
|
||||
int d = f1.find(PAGEREF);
|
||||
std::wstring f1 = arField[1];
|
||||
int d = (int)f1.find(PAGEREF);
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
_writeWebHidden = true;
|
||||
std::wstring _writeTocLink =f1.substr(d + 9);
|
||||
d = _writeTocLink.find(L" ");
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
_writeTocLink = _writeTocLink.substr(0, d);
|
||||
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun += _writeTocLink;
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
|
||||
//if (_writeInstrText == true)
|
||||
//{
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:fldChar" ), true );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:fldCharType" ), L"separate" );
|
||||
// m_pXmlWriter->WriteNodeEnd( L"" ), true );
|
||||
//}
|
||||
_writeInstrText = false;
|
||||
|
||||
break;
|
||||
//cp = cpFieldSep1;
|
||||
}
|
||||
cpFieldSep1 = cpFieldSep2;
|
||||
//cpFieldSep1 = cpFieldSep2;
|
||||
}
|
||||
_skipRuns = 5; //with separator
|
||||
}
|
||||
}
|
||||
else if ( bEMBED || bLINK || bQUOTE)
|
||||
//else if ( bHYPERLINK )
|
||||
//{//todooo - выделение гиперссылки отдельно
|
||||
// std::vector<std::wstring> arRefs;
|
||||
// boost::algorithm::split(arRefs, f, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
//
|
||||
// std::wstring sLink = arRefs[2];
|
||||
// m_pXmlWriter->WriteNodeBegin( L"w:hyperlink", true );
|
||||
|
||||
// int relID = m_context->_docx->RegisterHyperlink(_caller, sLink);
|
||||
// m_pXmlWriter->WriteAttribute( L"r:id", L"rId"+ FormatUtils::IntToWideString( relID ) );
|
||||
// m_pXmlWriter->WriteAttribute( L"w:history", 1 );
|
||||
// m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
// if (arRefs.size() > 2)
|
||||
// {
|
||||
// writeTextElement(arRefs[3].substr(1, arRefs[3].length() - 2), textType);
|
||||
// }
|
||||
// m_pXmlWriter->WriteNodeEnd( L"w:hyperlink", false, true );
|
||||
|
||||
// _skipRuns = 1;
|
||||
//}
|
||||
else if ( bEMBED || (bLINK && !bHYPERLINK)|| bQUOTE)
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
@ -714,9 +766,9 @@ namespace DocFileFormat
|
||||
if (!m_shapeIdOwner.empty()) //4571833.doc
|
||||
oVmlMapper.m_shapeId = m_shapeIdOwner;
|
||||
|
||||
if (m_document->bOlderVersion)
|
||||
{
|
||||
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
|
||||
if (m_document->nWordVersion > 0)
|
||||
{
|
||||
OleObject ole ( chpxObj, m_document);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
|
||||
@ -732,7 +784,7 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
|
||||
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
|
||||
|
||||
oleWriter.WriteNodeBegin (L"w:object", true);
|
||||
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
|
||||
@ -750,7 +802,7 @@ namespace DocFileFormat
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
|
||||
OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion);
|
||||
OleObject ole ( chpxSep, m_document);
|
||||
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
@ -790,15 +842,16 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
_writeInstrText = true;
|
||||
_fldCharCounter++;
|
||||
_fieldLevels.back().bBegin = true;
|
||||
}
|
||||
}
|
||||
else if (TextMark::FieldSeparator == code)
|
||||
{
|
||||
if (_fldCharCounter > 0)
|
||||
if (!_fieldLevels.empty())
|
||||
{
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
_fieldLevels.back().bSeparate = true;
|
||||
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
elem.AppendAttribute( L"w:fldCharType", L"separate" );
|
||||
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString() );
|
||||
@ -807,26 +860,34 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::FieldEndMark == code)
|
||||
{
|
||||
if (_fldCharCounter > 0)
|
||||
{
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
elem.AppendAttribute( L"w:fldCharType", L"end" );
|
||||
if (!_fieldLevels.empty())
|
||||
{
|
||||
if (!text.empty())
|
||||
{
|
||||
writeTextElement(text, textType);
|
||||
text.clear();
|
||||
}
|
||||
if (_fieldLevels.back().bBegin)
|
||||
{
|
||||
_fieldLevels.back().bEnd = true;
|
||||
|
||||
XMLTools::XMLElement elem( L"w:fldChar" );
|
||||
elem.AppendAttribute( L"w:fldCharType", L"end" );
|
||||
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString());
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString());
|
||||
}
|
||||
|
||||
_fldCharCounter--;
|
||||
_fieldLevels.pop_back();
|
||||
}
|
||||
if (_writeWebHidden)
|
||||
{
|
||||
_writeAfterRun = std::wstring (L"</w:hyperlink>");
|
||||
}
|
||||
_writeWebHidden = false;
|
||||
|
||||
if ( _fldCharCounter == 0 )
|
||||
{
|
||||
_writeInstrText = false;
|
||||
}
|
||||
_writeWebHidden = false;
|
||||
_embeddedObject = false;
|
||||
|
||||
if (_fieldLevels.empty())
|
||||
_bContentWrite = false;
|
||||
}
|
||||
else if ((TextMark::Symbol == code) && fSpec)
|
||||
{
|
||||
@ -852,7 +913,7 @@ namespace DocFileFormat
|
||||
|
||||
if (pSpa)
|
||||
{
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->bOlderVersion);
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
|
||||
|
||||
if (pShape)
|
||||
@ -874,9 +935,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((TextMark::Picture == code) && fSpec )
|
||||
else if (TextMark::Picture == code && fSpec)
|
||||
{
|
||||
PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
|
||||
PictureDescriptor oPicture (chpx, m_document->nWordVersion > 0 ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
|
||||
|
||||
bool isInline = _isTextBoxContent;
|
||||
|
||||
@ -912,7 +973,7 @@ namespace DocFileFormat
|
||||
|
||||
if (oVmlMapper.m_isEmbedded)
|
||||
{
|
||||
OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion);
|
||||
OleObject ole ( chpx, m_document);
|
||||
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
|
||||
|
||||
ole.isEquation = oVmlMapper.m_isEquation;
|
||||
@ -1113,20 +1174,7 @@ namespace DocFileFormat
|
||||
if ( fc >= nMinVal )
|
||||
{
|
||||
ret = m_document->AllPapx->find(nMinVal)->second;
|
||||
//? if (!ret && m_document->AllPapx->size() > 0)
|
||||
//? {
|
||||
//? map<int, ParagraphPropertyExceptions*>::iterator it = m_document->AllPapx->end();
|
||||
//? it--;
|
||||
//? do
|
||||
//? {
|
||||
//? if (it->first < nMinVal && it->second)
|
||||
//? break;
|
||||
//? it--;
|
||||
//? }
|
||||
//? while(it != m_document->AllPapx->begin());
|
||||
//?
|
||||
//? ret = it->second;
|
||||
//? }
|
||||
|
||||
_lastValidPapx = ret;
|
||||
}
|
||||
}
|
||||
@ -1173,21 +1221,23 @@ namespace DocFileFormat
|
||||
int fc2 = m_document->FindFileCharPos( cp );
|
||||
int fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
//build the table grid
|
||||
std::vector<short>* grid = buildTableGrid( cp, nestingLevel );
|
||||
std::vector<short> grid;
|
||||
buildTableGrid( cp, nestingLevel, grid);
|
||||
|
||||
//find first row end
|
||||
int fcRowEnd = findRowEndFc( cp, nestingLevel );
|
||||
|
||||
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
|
||||
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
|
||||
|
||||
//start table
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
|
||||
|
||||
//Convert it
|
||||
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, grid );
|
||||
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid);
|
||||
|
||||
row1Tapx.Convert( tpMapping );
|
||||
|
||||
@ -1200,11 +1250,11 @@ namespace DocFileFormat
|
||||
//only convert the cells with the given nesting level
|
||||
while ( tai.iTap == nestingLevel )
|
||||
{
|
||||
cp = writeTableRow( cp, grid, nestingLevel );
|
||||
cp = writeTableRow( cp, &grid, nestingLevel );
|
||||
//?fc = m_document->FindFileCharPos(cp );
|
||||
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1213,92 +1263,151 @@ namespace DocFileFormat
|
||||
//convert until the end of table is reached
|
||||
while ( tai.fInTable )
|
||||
{
|
||||
cp = writeTableRow( cp, grid, nestingLevel );
|
||||
cp = writeTableRow( cp, &grid, nestingLevel );
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
|
||||
//close w:tbl
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:tbl" );
|
||||
|
||||
RELEASEOBJECT( grid );
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
std::vector<short>* DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel)
|
||||
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid)
|
||||
{
|
||||
ParagraphPropertyExceptions* backup = _lastValidPapx;
|
||||
|
||||
std::vector<short> boundaries;
|
||||
std::vector<short>* grid = new std::vector<short>();
|
||||
std::map<short, short> boundaries;
|
||||
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
int fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
|
||||
ParagraphPropertyExceptions* papx_prev = NULL;
|
||||
|
||||
short max_boundary = -1;
|
||||
|
||||
bool fEndNestingLevel = false;
|
||||
|
||||
unsigned int iTap_current = 1;
|
||||
|
||||
while ( tai.fInTable )
|
||||
{
|
||||
//check all SPRMs of this TAPX
|
||||
iTap_current = 1;
|
||||
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
|
||||
{
|
||||
//find the tDef SPRM
|
||||
if ( iter->OpCode == sprmTDefTable || iter->OpCode == sprmOldTDefTable)
|
||||
DWORD code = iter->OpCode;
|
||||
|
||||
switch(iter->OpCode)
|
||||
{
|
||||
unsigned char itcMac = iter->Arguments[0];
|
||||
|
||||
for (int i = 0; i < itcMac; i++)
|
||||
case sprmPFInnerTableCell:
|
||||
case sprmPFInnerTtp:
|
||||
{
|
||||
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
|
||||
fEndNestingLevel = ( iter->Arguments[0] == 1 ) ? (true) : (false);
|
||||
}break;
|
||||
|
||||
if ( find( boundaries.begin(), boundaries.end(), boundary1 ) == boundaries.end() )
|
||||
case sprmPItap:
|
||||
{
|
||||
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if (nestingLevel == iTap_current)
|
||||
{
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
|
||||
{
|
||||
//find the tDef SPRM
|
||||
DWORD code = iter->OpCode;
|
||||
|
||||
switch(iter->OpCode)
|
||||
{
|
||||
case sprmTDefTable:
|
||||
case sprmOldTDefTable:
|
||||
{
|
||||
boundaries.push_back( boundary1 );
|
||||
}
|
||||
unsigned char itcMac = iter->Arguments[0];
|
||||
|
||||
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
|
||||
short boundary1, boundary2;
|
||||
for (unsigned char i = 0; i < itcMac; i++)
|
||||
{
|
||||
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
|
||||
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
|
||||
|
||||
if ( find( boundaries.begin(), boundaries.end(), boundary2 ) == boundaries.end() )
|
||||
{
|
||||
boundaries.push_back( boundary2 );
|
||||
}
|
||||
AddBoundary(boundary1, boundary2, boundaries);
|
||||
}
|
||||
if (max_boundary < boundary2)
|
||||
max_boundary = boundary2;
|
||||
|
||||
AddBoundary(boundary2, max_boundary, boundaries);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nestingLevel > 1 && fEndNestingLevel && !boundaries.empty())
|
||||
break;
|
||||
//get the next papx
|
||||
papx = findValidPapx( fcRowEnd );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
|
||||
|
||||
if (papx_prev && papx_prev == papx )
|
||||
break;//file(12).doc
|
||||
papx_prev = papx;
|
||||
}
|
||||
|
||||
//build the grid based on the boundaries
|
||||
sort( boundaries.begin(), boundaries.end() );
|
||||
}
|
||||
|
||||
if ( !boundaries.empty() )
|
||||
{
|
||||
for ( unsigned int i = 0; i < ( boundaries.size() - 1 ); i++ )
|
||||
for ( std::map<short, short>::iterator it = boundaries.begin(); it != boundaries.end(); ++it)
|
||||
{
|
||||
grid->push_back( boundaries[i + 1] - boundaries[i] );
|
||||
grid.push_back( it->second );
|
||||
}
|
||||
}
|
||||
|
||||
_lastValidPapx = backup;
|
||||
|
||||
return grid;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DocumentMapping::AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries)
|
||||
{
|
||||
if (boundary2 - boundary1 < 3)
|
||||
return;
|
||||
|
||||
std::map<short, short>::iterator pFind = boundaries.find(boundary1);
|
||||
|
||||
while(true)
|
||||
{
|
||||
if (pFind == boundaries.end())
|
||||
{
|
||||
boundaries.insert(std::make_pair(boundary1, boundary2 - boundary1));
|
||||
break;
|
||||
}
|
||||
else if (pFind->second != boundary2 - boundary1)
|
||||
{
|
||||
if (pFind->second > boundary2 - boundary1)
|
||||
{
|
||||
short new_size = boundary2 - boundary1;
|
||||
boundary1 = boundary2;
|
||||
boundary2 = pFind->second + pFind->first;
|
||||
pFind->second = new_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
boundary1 = pFind->second + pFind->first;
|
||||
}
|
||||
pFind = boundaries.find(boundary1);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Finds the FC of the next row end mark.
|
||||
@ -1308,7 +1417,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( nestingLevel > 1 )
|
||||
{
|
||||
@ -1324,7 +1433,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
|
||||
cp++;
|
||||
}
|
||||
@ -1347,7 +1456,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
@ -1366,7 +1475,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( nestingLevel > 1 )
|
||||
{
|
||||
@ -1386,7 +1495,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
|
||||
cp++;
|
||||
}
|
||||
@ -1409,7 +1518,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
@ -1424,14 +1533,14 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
//start w:tr
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tr" );
|
||||
|
||||
//convert the properties
|
||||
int fcRowEnd = findRowEndFc( cp, nestingLevel );
|
||||
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
|
||||
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
|
||||
TableRowPropertiesMapping* trpMapping = new TableRowPropertiesMapping( m_pXmlWriter, *(chpxs->begin()) );
|
||||
@ -1455,7 +1564,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos(cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1472,7 +1581,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1491,15 +1600,10 @@ namespace DocFileFormat
|
||||
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel )
|
||||
{
|
||||
int cp = initialCp;
|
||||
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
|
||||
|
||||
//start w:tc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
|
||||
|
||||
//find cell end
|
||||
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
|
||||
|
||||
//convert the properties
|
||||
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, gridIndex, cellIndex );
|
||||
XMLTools::CStringXmlWriter writerTcPr;
|
||||
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( &writerTcPr, grid, gridIndex, cellIndex, nestingLevel );
|
||||
|
||||
if ( tapx != NULL )
|
||||
{
|
||||
@ -1508,8 +1612,19 @@ namespace DocFileFormat
|
||||
|
||||
gridIndex = gridIndex + tcpMapping->GetGridSpan();
|
||||
|
||||
bool bCoverCell = tcpMapping->IsCoverCell();
|
||||
|
||||
RELEASEOBJECT( tcpMapping );
|
||||
|
||||
if (bCoverCell)
|
||||
{
|
||||
return cpCellEnd;
|
||||
}
|
||||
|
||||
//start w:tc
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
|
||||
m_pXmlWriter->WriteString(writerTcPr.GetXmlString());
|
||||
|
||||
//write the paragraphs of the cell
|
||||
while ( cp < cpCellEnd )
|
||||
{
|
||||
@ -1517,7 +1632,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
//cp = writeParagraph(cp);
|
||||
|
||||
@ -1537,7 +1652,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1556,7 +1671,7 @@ namespace DocFileFormat
|
||||
int fc = m_document->FindFileCharPos( initialCp );
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
while ( !tai.fInnerTableCell )
|
||||
{
|
||||
@ -1565,7 +1680,7 @@ namespace DocFileFormat
|
||||
fc = m_document->FindFileCharPos( cpCellEnd );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
tai = TableInfo( papx );
|
||||
tai = TableInfo( papx, m_document->nWordVersion );
|
||||
}
|
||||
|
||||
cpCellEnd++;
|
||||
@ -1686,13 +1801,8 @@ namespace DocFileFormat
|
||||
// Checks if the CHPX is special
|
||||
bool DocumentMapping::isSpecial(CharacterPropertyExceptions* chpx)
|
||||
{
|
||||
/*
|
||||
for (list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
|
||||
{
|
||||
short value = FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
int c = 0;
|
||||
}
|
||||
*/
|
||||
if (!chpx) return false;
|
||||
if (!chpx->grpprl) return false;
|
||||
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
|
||||
{
|
||||
@ -1762,6 +1872,11 @@ namespace DocFileFormat
|
||||
{
|
||||
SectionPropertyExceptions* ret = NULL;
|
||||
|
||||
if (!m_document->AllSepx)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ret = m_document->AllSepx->operator [](cp);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -48,6 +48,8 @@
|
||||
#include "OleObjectMapping.h"
|
||||
#include "ConversionContext.h"
|
||||
#include "IMapping.h"
|
||||
#include "FormFieldData.h"
|
||||
#include "FormFieldDataMapping.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -85,7 +87,7 @@ namespace DocFileFormat
|
||||
bool isSectionEnd ( int cp );
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
int writeParagraph( int cp );
|
||||
int writeParagraph( int cp, int cpEnd );
|
||||
// Writes a Paragraph that starts at the given cpStart and
|
||||
// ends at the given cpEnd
|
||||
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
|
||||
@ -108,7 +110,7 @@ namespace DocFileFormat
|
||||
// Writes the table starts at the given cp value
|
||||
int writeTable ( int initialCp, unsigned int nestingLevel );
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
|
||||
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid);
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
|
||||
// Finds the FC of the next row end mark.
|
||||
@ -133,6 +135,8 @@ namespace DocFileFormat
|
||||
// Searches the given vector for the next FieldEnd character.
|
||||
int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark );
|
||||
Symbol getSymbol ( const CharacterPropertyExceptions* chpx );
|
||||
|
||||
void AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries);
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
bool m_bInternalXmlWriter;
|
||||
|
||||
@ -152,11 +156,19 @@ namespace DocFileFormat
|
||||
int _commentNr;
|
||||
bool _isTextBoxContent;
|
||||
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues
|
||||
bool _writeInstrText;
|
||||
bool _writeWebHidden;
|
||||
unsigned int _fldCharCounter;
|
||||
std::wstring _writeAfterRun;
|
||||
std::wstring _lastOLEObject;
|
||||
int _cacheListNum;
|
||||
|
||||
struct fieldLevels
|
||||
{
|
||||
bool bBegin = false;
|
||||
bool bSeparate = false;
|
||||
//bool bInstrText = false;
|
||||
bool bEnd = false;
|
||||
};
|
||||
std::vector<fieldLevels> _fieldLevels;
|
||||
bool _bContentWrite;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -48,22 +48,89 @@ namespace DocFileFormat
|
||||
{
|
||||
Initialize();
|
||||
|
||||
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_bOlderVersion);
|
||||
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_nWordVersion);
|
||||
|
||||
//setDefaultCompatibilityOptions( fib->m_FibBase.nFib );
|
||||
|
||||
unsigned int size = fib->m_FibWord97.lcbDop;
|
||||
unsigned char* bytes = tStream.ReadBytes( size, true );
|
||||
unsigned int size = fib->m_FibWord97.lcbDop;
|
||||
unsigned char* bytes = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
if ( size > 0 )
|
||||
if (fib->m_nWordVersion == 2)
|
||||
{
|
||||
unsigned char* Temp = tStream.ReadBytes(size, true);
|
||||
tStream.Seek(fib->m_FibWord97.fcDop, 0);
|
||||
delete []Temp;
|
||||
|
||||
unsigned char flags1 = tStream.ReadByte();
|
||||
|
||||
fFacingPages = GETBIT(flags1, 0);
|
||||
fWindowControl = GETBIT(flags1, 1);
|
||||
Fpc = GETBITS(flags1, 5, 6);
|
||||
bool fWide = GETBIT(flags1, 7);
|
||||
|
||||
grpfIhdt = tStream.ReadByte();
|
||||
|
||||
unsigned short flags2 = tStream.ReadUInt16();
|
||||
rncFtn = GETBIT(flags2, 0);
|
||||
nFtn = GETBITS(flags2, 1, 15);
|
||||
|
||||
unsigned char irmBar = tStream.ReadByte();
|
||||
|
||||
unsigned char flags3 = tStream.ReadByte();
|
||||
unsigned char irmProps = GETBITS(flags3, 0, 6);
|
||||
fRevMarking = GETBIT(flags3, 7);
|
||||
|
||||
unsigned short flags4 = tStream.ReadUInt16();
|
||||
fBackup = GETBIT(flags4, 0);
|
||||
fExactWords = GETBIT(flags4, 1);
|
||||
fPagHidden = GETBIT(flags4, 2);
|
||||
fPagResults = GETBIT(flags4, 3);
|
||||
fLockAtn = GETBIT(flags4, 4);
|
||||
fMirrorMargins = GETBIT(flags4, 5);
|
||||
bool fKeepFileFormat = GETBIT(flags4, 6);
|
||||
fDflttrueType = GETBIT(flags4, 7);
|
||||
|
||||
fPagSuppressTopSpacing = GETBIT(flags4, 8);
|
||||
fMaybeRTLTables = GETBIT(flags4, 9);
|
||||
|
||||
bool fSpares = tStream.ReadUInt16();
|
||||
dxaTab = tStream.ReadUInt16();
|
||||
|
||||
wSpare = tStream.ReadUInt16();//ftcDefaultBi
|
||||
dxaHotZ = tStream.ReadUInt16();
|
||||
|
||||
wSpare2 = tStream.ReadUInt16();
|
||||
wSpare3 = tStream.ReadUInt16();
|
||||
|
||||
dttmCreated = DateAndTime( tStream.ReadUInt32() );
|
||||
dttmRevised = DateAndTime( tStream.ReadUInt32() );
|
||||
dttmLastPrint = DateAndTime( tStream.ReadUInt32() );
|
||||
|
||||
nRevision = tStream.ReadUInt16();
|
||||
tmEdited = tStream.ReadUInt32();
|
||||
|
||||
cWords = tStream.ReadUInt32();
|
||||
cCh = tStream.ReadUInt32();
|
||||
cPg = tStream.ReadUInt16();
|
||||
|
||||
unsigned short rgwSpareDocSum[2];
|
||||
rgwSpareDocSum[0] = tStream.ReadUInt16();
|
||||
rgwSpareDocSum[1] = tStream.ReadUInt16();
|
||||
|
||||
}
|
||||
else if ( size > 0 )
|
||||
{
|
||||
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
|
||||
bytes = tStream.ReadBytes( size, true );
|
||||
|
||||
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
|
||||
fWindowControl = FormatUtils::GetBitFromBytes( bytes, 2, 1 );
|
||||
fPMHMainDoc = FormatUtils::GetBitFromBytes( bytes, 2, 2 );
|
||||
grfSuppression = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 3, 2 );
|
||||
Fpc = (short)(short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
|
||||
Fpc = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
|
||||
|
||||
grpfIhdt = FormatUtils::BytesToUChar( bytes, 1, size );
|
||||
|
||||
rncFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 0, 2 );
|
||||
nFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 2, 14 );
|
||||
@ -545,6 +612,7 @@ namespace DocFileFormat
|
||||
fSwapBordersFacingPgs = false;
|
||||
dxaTab = 0;
|
||||
wSpare = 0;
|
||||
wSpare3 = 0;
|
||||
dxaHotZ = 0;
|
||||
cConsecHypLim = 0;
|
||||
wSpare2 = 0;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -177,7 +177,8 @@ namespace DocFileFormat
|
||||
unsigned short cConsecHypLim;
|
||||
// Reserved
|
||||
unsigned short wSpare2;
|
||||
// Date and time document was created
|
||||
unsigned short wSpare3;
|
||||
// Date and time document was created
|
||||
DateAndTime dttmCreated;
|
||||
// Date and time document was last revised
|
||||
DateAndTime dttmRevised;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
@ -35,143 +35,148 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream )
|
||||
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream ) : bStandard(false), bXOR(false), bAES(false)
|
||||
{
|
||||
VirtualStreamReader tStream( tableStream, 0, fib->m_bOlderVersion);
|
||||
VirtualStreamReader tStream( tableStream, 0, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibBase.fObfuscation)
|
||||
if (fib->m_FibBase.fObfuscation || fib->m_nWordVersion > 0)
|
||||
{
|
||||
//xor
|
||||
return;
|
||||
}
|
||||
unsigned short vMajor = tStream.ReadUInt16();
|
||||
unsigned short vMinor = tStream.ReadUInt16();
|
||||
|
||||
if(0x0001 == vMajor) // RC4 encryption header structure
|
||||
{// fib->m_FibBase.lKey == 52
|
||||
bStandard = true;
|
||||
|
||||
crypt_data_rc4.Salt.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b4 = tStream.ReadUInt32();
|
||||
bXOR = true;
|
||||
|
||||
crypt_data_rc4.EncryptedVerifier.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b4 = tStream.ReadUInt32();
|
||||
|
||||
crypt_data_rc4.EncryptedVerifierHash.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b4 = tStream.ReadUInt32();
|
||||
crypt_data_xor.key = fib->m_FibBase.lKey >> 16;
|
||||
crypt_data_xor.hash = fib->m_FibBase.lKey - (crypt_data_xor.key << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
bStandard = false;
|
||||
crypt_data_aes.bAgile = false;
|
||||
unsigned short vMajor = tStream.ReadUInt16();
|
||||
unsigned short vMinor = tStream.ReadUInt16();
|
||||
|
||||
unsigned short flags = tStream.ReadUInt32();
|
||||
unsigned char *pDataRead = NULL;
|
||||
if(0x0001 == vMajor) // RC4 encryption header structure
|
||||
{// fib->m_FibBase.lKey == 52
|
||||
bStandard = true;
|
||||
|
||||
bool fCryptoAPI = GETBIT(flags, 1);
|
||||
bool fDocProps = GETBIT(flags, 2);
|
||||
bool fExternal = GETBIT(flags, 3);
|
||||
bool fAES = GETBIT(flags, 4);
|
||||
|
||||
//EncryptionHeader
|
||||
int HeaderSize = tStream.ReadUInt32();
|
||||
int Flags = tStream.ReadUInt32();
|
||||
int SizeExtra = tStream.ReadUInt32();
|
||||
int AlgID = tStream.ReadUInt32();
|
||||
int AlgIDHash = tStream.ReadUInt32();
|
||||
int KeySize = tStream.ReadUInt32();
|
||||
int ProviderType= tStream.ReadUInt32();
|
||||
int Reserved1 = tStream.ReadUInt32();
|
||||
int Reserved2 = tStream.ReadUInt32();
|
||||
|
||||
int pos = tStream.GetPosition();
|
||||
int size = tStream.GetSize();
|
||||
|
||||
std::vector<char> dataCSPName;
|
||||
while(pos < size - 1)
|
||||
crypt_data_rc4.Salt.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.Salt.b4 = tStream.ReadUInt32();
|
||||
|
||||
crypt_data_rc4.EncryptedVerifier.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifier.b4 = tStream.ReadUInt32();
|
||||
|
||||
crypt_data_rc4.EncryptedVerifierHash.b1 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b2 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b3 = tStream.ReadUInt32();
|
||||
crypt_data_rc4.EncryptedVerifierHash.b4 = tStream.ReadUInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
if (dataCSPName[dataCSPName.size() - 1] == 0 && dataCSPName[dataCSPName.size() - 2] == 0)
|
||||
bAES = true;
|
||||
crypt_data_aes.bAgile = false;
|
||||
|
||||
unsigned short flags = tStream.ReadUInt32();
|
||||
unsigned char *pDataRead = NULL;
|
||||
|
||||
bool fCryptoAPI = GETBIT(flags, 1);
|
||||
crypt_data_aes.fDocProps = GETBIT(flags, 2);
|
||||
bool fExternal = GETBIT(flags, 3);
|
||||
bool fAES = GETBIT(flags, 4);
|
||||
|
||||
//EncryptionHeader
|
||||
int HeaderSize = tStream.ReadUInt32();
|
||||
int Flags = tStream.ReadUInt32();
|
||||
int SizeExtra = tStream.ReadUInt32();
|
||||
int AlgID = tStream.ReadUInt32();
|
||||
int AlgIDHash = tStream.ReadUInt32();
|
||||
int KeySize = tStream.ReadUInt32();
|
||||
int ProviderType= tStream.ReadUInt32();
|
||||
int Reserved1 = tStream.ReadUInt32();
|
||||
int Reserved2 = tStream.ReadUInt32();
|
||||
|
||||
int pos = tStream.GetPosition();
|
||||
int size = tStream.GetSize();
|
||||
|
||||
std::vector<char> dataCSPName;
|
||||
while(pos < size - 1)
|
||||
{
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
dataCSPName.push_back(tStream.ReadByte());
|
||||
if (dataCSPName[dataCSPName.size() - 1] == 0 && dataCSPName[dataCSPName.size() - 2] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
pos+=2;//unicode null-terminate string
|
||||
}
|
||||
//EncryptionVerifier
|
||||
crypt_data_aes.saltSize = tStream.ReadUInt32();
|
||||
pDataRead = tStream.ReadBytes(crypt_data_aes.saltSize, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
pDataRead = tStream.ReadBytes(0x10, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierInput = std::string((char*)pDataRead, 0x10);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
crypt_data_aes.hashSize = tStream.ReadUInt32();
|
||||
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
|
||||
pDataRead = tStream.ReadBytes(szEncryptedVerifierHash, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
pos = tStream.GetPosition();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
switch(AlgIDHash)
|
||||
{
|
||||
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
|
||||
case 0x0000:
|
||||
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
|
||||
}
|
||||
crypt_data_aes.spinCount = 0;
|
||||
|
||||
switch(AlgID)
|
||||
{
|
||||
case 0x0000:
|
||||
if (fAES) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
if (fCryptoAPI) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
case 0x6801:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
|
||||
if (crypt_data_aes.keySize == 0) crypt_data_aes.keySize = 5; // 40 bit
|
||||
break;
|
||||
case 0x660E:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 128 /8;
|
||||
break;
|
||||
case 0x660F:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 192 /8;
|
||||
break;
|
||||
case 0x6610:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 256 /8;
|
||||
break;
|
||||
}
|
||||
pos+=2;//unicode null-terminate string
|
||||
}
|
||||
//EncryptionVerifier
|
||||
crypt_data_aes.saltSize = tStream.ReadUInt32();
|
||||
pDataRead = tStream.ReadBytes(crypt_data_aes.saltSize, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
pDataRead = tStream.ReadBytes(0x10, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierInput = std::string((char*)pDataRead, 0x10);
|
||||
delete pDataRead;
|
||||
}
|
||||
|
||||
crypt_data_aes.hashSize = tStream.ReadUInt32();
|
||||
|
||||
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
|
||||
pDataRead = tStream.ReadBytes(szEncryptedVerifierHash, true);
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
|
||||
delete pDataRead;
|
||||
//switch(ProviderType)
|
||||
//{
|
||||
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
|
||||
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
|
||||
//}
|
||||
}
|
||||
|
||||
pos = tStream.GetPosition();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
switch(AlgIDHash)
|
||||
{
|
||||
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
|
||||
case 0x0000:
|
||||
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
|
||||
}
|
||||
crypt_data_aes.spinCount = 0;
|
||||
|
||||
switch(AlgID)
|
||||
{
|
||||
case 0x0000:
|
||||
if (fAES) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
if (fCryptoAPI) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
case 0x6801:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
|
||||
crypt_data_aes.keySize = KeySize / 8;
|
||||
|
||||
if (crypt_data_aes.keySize == 0) crypt_data_aes.keySize = 5; // 40 bit
|
||||
break;
|
||||
case 0x660E:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 128 /8;
|
||||
break;
|
||||
case 0x660F:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 192 /8;
|
||||
break;
|
||||
case 0x6610:
|
||||
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
|
||||
crypt_data_aes.keySize = 256 /8;
|
||||
break;
|
||||
}
|
||||
|
||||
//switch(ProviderType)
|
||||
//{
|
||||
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
|
||||
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -52,6 +52,10 @@ namespace DocFileFormat
|
||||
private:
|
||||
CRYPT::_rc4CryptData crypt_data_rc4;
|
||||
CRYPT::_ecmaCryptData crypt_data_aes;
|
||||
CRYPT::_xorCryptData crypt_data_xor;
|
||||
|
||||
bool bStandard;
|
||||
bool bXOR;
|
||||
bool bAES;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -79,7 +79,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -69,14 +69,22 @@ namespace DocFileFormat
|
||||
newObject->prq = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x03 );
|
||||
newObject->fTrueType = FormatUtils::BitmaskToBool ( ffid, 0x04 );
|
||||
newObject->ff = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x70 );
|
||||
newObject->wWeight = reader->ReadInt16();
|
||||
newObject->chs = reader->ReadByte();
|
||||
|
||||
//int sz_fonts = 150; //.. нужно генерить уникальное todooo
|
||||
int szAlt = 0;
|
||||
if (reader->nWordVersion == 2)
|
||||
{
|
||||
newObject->wWeight = reader->ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
newObject->wWeight = reader->ReadInt16();
|
||||
newObject->chs = reader->ReadByte();
|
||||
|
||||
int szAlt = reader->ReadByte();
|
||||
szAlt = reader->ReadByte();
|
||||
}
|
||||
|
||||
if (!reader->olderVersion)
|
||||
if (reader->nWordVersion == 0)
|
||||
{
|
||||
//read the 10 bytes panose
|
||||
newObject->panoseSize = 10;
|
||||
@ -97,7 +105,7 @@ namespace DocFileFormat
|
||||
|
||||
unsigned char *bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszFtn), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250 );
|
||||
}
|
||||
@ -131,7 +139,7 @@ namespace DocFileFormat
|
||||
|
||||
bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszAlt), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250);
|
||||
}
|
||||
@ -151,7 +159,7 @@ namespace DocFileFormat
|
||||
{
|
||||
long strStart = reader->GetPosition();
|
||||
|
||||
if (reader->olderVersion)
|
||||
if (reader->nWordVersion > 0)
|
||||
{//ansi string only
|
||||
while ( reader->ReadByte() != 0 )
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -48,7 +48,8 @@ namespace DocFileFormat
|
||||
|
||||
class FontFamilyName: public ByteStructure
|
||||
{
|
||||
friend class CharacterPropertiesMapping;
|
||||
friend class WordDocument;
|
||||
friend class CharacterPropertiesMapping;
|
||||
friend class DocumentMapping;
|
||||
friend class FontTableMapping;
|
||||
friend class StyleSheetMapping;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -34,32 +34,30 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
|
||||
FontTableMapping::FontTableMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
|
||||
{
|
||||
_ctx = ctx;
|
||||
}
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
FontTableMapping::~FontTableMapping()
|
||||
{
|
||||
RELEASEOBJECT (m_pXmlWriter);
|
||||
}
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
void FontTableMapping::Apply( IVisitable* visited )
|
||||
{
|
||||
StringTable<FontFamilyName>* table = static_cast<StringTable<FontFamilyName>*>( visited );
|
||||
|
||||
this->_ctx->_docx->RegisterFontTable();
|
||||
_ctx->_docx->RegisterFontTable();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fonts", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int sz_fonts = table->Data.size();
|
||||
int sz_fonts = table->Data.size();
|
||||
int users_fonts = 0;
|
||||
|
||||
for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ )
|
||||
@ -140,6 +138,6 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fonts");
|
||||
|
||||
this->_ctx->_docx->FontTableXML = std::wstring( m_pXmlWriter->GetXmlString() );
|
||||
_ctx->_docx->FontTableXML = m_pXmlWriter->GetXmlString() ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -71,7 +71,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -89,7 +89,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -81,7 +81,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -93,7 +93,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
|
||||
cp++;
|
||||
|
||||
170
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
Normal file
170
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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 Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "FormFieldData.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
std::wstring readXstz(VirtualStreamReader *reader)
|
||||
{
|
||||
if (!reader) return L"";
|
||||
|
||||
unsigned short flags, cch, chTerm;
|
||||
|
||||
cch = reader->ReadUInt16();
|
||||
|
||||
std::wstring ret;
|
||||
|
||||
if (cch > 0)
|
||||
{
|
||||
std::shared_ptr<unsigned char>data = std::shared_ptr<unsigned char>(reader->ReadBytes(cch * 2, true));
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
ret = std::wstring((wchar_t*)data.get(), cch );
|
||||
#else
|
||||
ret = convertUtf16ToWString((UTF16*)data.get(), cch );
|
||||
#endif
|
||||
}
|
||||
chTerm = reader->ReadUInt16();
|
||||
|
||||
return ret;
|
||||
};
|
||||
void FormFieldData::_HFD::read(VirtualStreamReader *reader)
|
||||
{
|
||||
if (!reader) return;
|
||||
}
|
||||
void FormFieldData::_FFData::read(VirtualStreamReader *reader)
|
||||
{
|
||||
if (!reader) return;
|
||||
|
||||
bExist = true;
|
||||
|
||||
unsigned short flags;
|
||||
|
||||
version = reader->ReadUInt32();
|
||||
flags = reader->ReadUInt16();
|
||||
|
||||
iType = GETBITS(flags, 0, 1);
|
||||
iRes = GETBITS(flags, 2, 6);
|
||||
fOwnHelp = GETBIT(flags, 7);
|
||||
fOwnStat = GETBIT(flags, 8);
|
||||
fProt = GETBIT(flags, 9);
|
||||
iSize = GETBIT(flags, 10);
|
||||
iTypeTxt = GETBITS(flags, 11, 13);
|
||||
fRecalc = GETBIT(flags, 14);
|
||||
fHasListBox = GETBIT(flags, 15);
|
||||
|
||||
cch_field = reader->ReadUInt16();
|
||||
hps = reader->ReadUInt16();
|
||||
|
||||
xstzName = readXstz(reader);
|
||||
xstzTextDef = readXstz(reader);
|
||||
|
||||
wDef = reader->ReadUInt16();
|
||||
|
||||
xstzTextFormat = readXstz(reader);
|
||||
xstzHelpText = readXstz(reader);
|
||||
xstzStatText = readXstz(reader);
|
||||
xstzEntryMcr = readXstz(reader);
|
||||
xstzExitMcr = readXstz(reader);
|
||||
}
|
||||
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion )
|
||||
{
|
||||
binary_data_size = 0;
|
||||
|
||||
if (!chpx) return;
|
||||
|
||||
int fc = -1;
|
||||
bool bNilPICFAndBinData = false;
|
||||
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
|
||||
{
|
||||
switch ( iter->OpCode)
|
||||
{
|
||||
case sprmCFSpec:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case sprmCFFldVanish:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case sprmCPicLocation:
|
||||
{
|
||||
fc = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
case sprmCRsidText:
|
||||
{
|
||||
rsid = FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize), L"%08x");
|
||||
}
|
||||
break;
|
||||
case sprmCFData:
|
||||
{
|
||||
bNilPICFAndBinData = true; // or bPICFAndOfficeArtData - shape, pic, ole
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fc >= 0 && bNilPICFAndBinData)
|
||||
{
|
||||
VirtualStreamReader reader(stream, fc, nWordVersion);
|
||||
|
||||
int sz_stream = reader.GetSize();
|
||||
|
||||
int lcb = reader.ReadUInt32();
|
||||
int cbHeader = reader.ReadUInt16();
|
||||
|
||||
if (cbHeader != 0x44) return;
|
||||
|
||||
//ignored
|
||||
reader.ReadBytes(62, false);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 1:
|
||||
HFD.read(&reader);
|
||||
case 2:
|
||||
FFData.read(&reader);
|
||||
break;
|
||||
default:
|
||||
binary_data_size = lcb - cbHeader;
|
||||
binary_data = std::shared_ptr<unsigned char>(reader.ReadBytes(binary_data_size, true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
126
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
Normal file
126
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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 Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "IVisitable.h"
|
||||
#include "CharacterPropertyExceptions.h"
|
||||
#include "StructuredStorageReader.h"
|
||||
#include "VirtualStreamReader.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class FormFieldData : public IVisitable
|
||||
{
|
||||
public:
|
||||
|
||||
struct _HFD
|
||||
{
|
||||
bool bExist = false;
|
||||
|
||||
bool fNew = false;
|
||||
bool fNoHist = false;
|
||||
bool fImageMap = false;
|
||||
bool fLocation = false;
|
||||
bool fTooltip = false;
|
||||
|
||||
std::wstring clsid;
|
||||
|
||||
_UINT32 streamVersion = 0;
|
||||
bool hlstmfHasMoniker = false;
|
||||
bool hlstmfIsAbsolute = false;
|
||||
bool hlstmfSiteGaveDisplayName = false;
|
||||
bool hlstmfHasLocationStr = false;
|
||||
bool hlstmfHasDisplayName = false;
|
||||
bool hlstmfHasGUID = false;
|
||||
bool hlstmfHasCreationTime = false;
|
||||
bool hlstmfHasFrameName = false;
|
||||
bool hlstmfMonikerSavedAsStr = false;
|
||||
bool hlstmfAbsFromGetdataRel = false;
|
||||
|
||||
std::wstring displayName;
|
||||
std::wstring targetFrameName;
|
||||
std::wstring moniker;
|
||||
|
||||
std::wstring oleMoniker_clsid;
|
||||
std::wstring oleMoniker_data;
|
||||
std::wstring location;
|
||||
|
||||
std::wstring guid;
|
||||
_UINT64 fileTime = 0;
|
||||
|
||||
void read(VirtualStreamReader* reader);
|
||||
};
|
||||
struct _FFData
|
||||
{
|
||||
bool bExist = false;
|
||||
_UINT32 version = 0;
|
||||
|
||||
unsigned char iType = 0;
|
||||
unsigned char iRes = 0;
|
||||
bool fOwnHelp = false;
|
||||
bool fOwnStat = false;
|
||||
bool fProt = false;
|
||||
bool iSize = false;
|
||||
unsigned char iTypeTxt = 0;
|
||||
bool fRecalc = false;
|
||||
bool fHasListBox = false;
|
||||
|
||||
unsigned short cch_field = 0;
|
||||
unsigned short hps = 0;
|
||||
std::wstring xstzName;
|
||||
std::wstring xstzTextDef;
|
||||
unsigned short wDef = 0;
|
||||
std::wstring xstzTextFormat;
|
||||
std::wstring xstzHelpText;
|
||||
std::wstring xstzStatText;
|
||||
std::wstring xstzEntryMcr;
|
||||
std::wstring xstzExitMcr;
|
||||
|
||||
//STTB hsttbDropList;
|
||||
void read(VirtualStreamReader* reader);
|
||||
};
|
||||
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion );
|
||||
virtual ~FormFieldData() {}
|
||||
private:
|
||||
friend class FormFieldDataMapping;
|
||||
|
||||
std::wstring name;
|
||||
std::wstring rsid;
|
||||
|
||||
_FFData FFData;
|
||||
_HFD HFD;
|
||||
|
||||
std::shared_ptr<unsigned char> binary_data;
|
||||
int binary_data_size;
|
||||
|
||||
};
|
||||
}
|
||||
87
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
Normal file
87
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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 Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ConversionContext.h"
|
||||
#include "FormFieldData.h"
|
||||
|
||||
#include "AbstractOpenXmlMapping.h"
|
||||
#include "IMapping.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class FormFieldDataMapping: public AbstractOpenXmlMapping, public IMapping
|
||||
{
|
||||
public:
|
||||
FormFieldDataMapping(XMLTools::CStringXmlWriter* writer, ConversionContext* context, IMapping* caller)
|
||||
: AbstractOpenXmlMapping(writer), m_context(NULL),_caller(NULL)
|
||||
{
|
||||
m_context = context;
|
||||
_caller = caller;
|
||||
}
|
||||
|
||||
virtual void Apply(IVisitable* visited)
|
||||
{
|
||||
FormFieldData* ffData = static_cast<FormFieldData*>(visited);
|
||||
|
||||
if ( ffData == NULL ) return;
|
||||
|
||||
if (ffData->FFData.bExist)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:ffData");
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:name", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.xstzName);
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:name", true, true );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:calcOnExit", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.fRecalc);
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:calcOnExit", true, true );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:textInput");
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:maxLength", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.cch_field);
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:maxLength", true, true );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:textInput" );
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:ffData" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
ConversionContext* m_context;
|
||||
IMapping* _caller;
|
||||
};
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -52,8 +52,8 @@ namespace DocFileFormat
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion ):
|
||||
FormattedDiskPage(), rgb(NULL), grpchpxSize(NULL), grpchpx(NULL)
|
||||
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion ):
|
||||
FormattedDiskPage(), rgb(NULL), grpchpxSize(0), grpchpx(NULL)
|
||||
{
|
||||
Type = Character;
|
||||
WordStream = wordStream;
|
||||
@ -80,7 +80,6 @@ namespace DocFileFormat
|
||||
j += 4;
|
||||
}
|
||||
|
||||
//create arrays
|
||||
grpchpxSize = crun;
|
||||
rgb = new unsigned char[crun];
|
||||
grpchpx = new CharacterPropertyExceptions*[grpchpxSize];
|
||||
@ -104,11 +103,10 @@ namespace DocFileFormat
|
||||
|
||||
//read the bytes of chpx
|
||||
chpx = new unsigned char[cb];
|
||||
//Array.Copy(bytes, (wordOffset * 2) + 1, chpx, 0, chpx.Length);
|
||||
memcpy( chpx, ( bytes + (wordOffset * 2) + 1 ), cb );
|
||||
|
||||
//parse CHPX and fill grpchpx
|
||||
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, oldVersion);
|
||||
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, nWordVersion);
|
||||
|
||||
RELEASEARRAYOBJECTS( chpx );
|
||||
}
|
||||
@ -139,7 +137,7 @@ namespace DocFileFormat
|
||||
}
|
||||
//there are n offsets and n-1 fkp's in the bin table
|
||||
|
||||
if (fib->m_bOlderVersion)
|
||||
if (fib->m_nWordVersion > 0)
|
||||
{
|
||||
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBteChpx - 8 ) / 6 ) + 1;
|
||||
|
||||
@ -162,7 +160,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -178,7 +176,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
|
||||
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -50,7 +50,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
virtual ~FormattedDiskPageCHPX();
|
||||
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion );
|
||||
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion );
|
||||
/// Parses the 0Table (or 1Table) for FKP _entries containing CHPX
|
||||
static std::list<FormattedDiskPageCHPX*>* GetAllCHPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream );
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -52,59 +52,53 @@ namespace DocFileFormat
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex):
|
||||
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex):
|
||||
FormattedDiskPage(), rgbx(NULL), grppapxSize(0), grppapx(NULL)
|
||||
{
|
||||
Type = Paragraph;
|
||||
WordStream = wordStream;
|
||||
{
|
||||
Type = Paragraph;
|
||||
WordStream = wordStream;
|
||||
|
||||
//read the 512 bytes (FKP)
|
||||
unsigned char* bytes = NULL;
|
||||
bytes = new unsigned char[512];
|
||||
|
||||
WordStream->seek( offset);
|
||||
WordStream->read( bytes, 512);
|
||||
//read the 512 bytes (FKP)
|
||||
unsigned char* bytes = NULL;
|
||||
bytes = new unsigned char[512];
|
||||
|
||||
//get the count
|
||||
crun = bytes[511];
|
||||
WordStream->seek( offset);
|
||||
WordStream->read( bytes, 512);
|
||||
|
||||
//create and fill the array with the adresses
|
||||
rgfcSize = crun + 1;
|
||||
rgfc = new int[rgfcSize];
|
||||
//get the count
|
||||
crun = bytes[511];
|
||||
|
||||
int j = 0;
|
||||
//create and fill the array with the adresses
|
||||
rgfcSize = crun + 1;
|
||||
rgfc = new int[rgfcSize];
|
||||
|
||||
int j = 0;
|
||||
|
||||
for ( unsigned int i = 0; i < rgfcSize; i++ )
|
||||
{
|
||||
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
|
||||
j += 4;
|
||||
}
|
||||
for ( unsigned int i = 0; i < rgfcSize; i++ )
|
||||
{
|
||||
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
|
||||
j += 4;
|
||||
}
|
||||
rgbx = new BX[crun];
|
||||
grppapxSize = crun;
|
||||
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
|
||||
|
||||
//create arrays
|
||||
rgbx = new BX[crun];
|
||||
grppapxSize = crun;
|
||||
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
|
||||
for ( unsigned int i = 0; i < grppapxSize; i++ )
|
||||
{
|
||||
grppapx[i] = NULL;
|
||||
}
|
||||
|
||||
for ( unsigned int i = 0; i < grppapxSize; i++ )
|
||||
{
|
||||
grppapx[i] = NULL;
|
||||
}
|
||||
j = 4 * ( crun + 1 );
|
||||
|
||||
j = 4 * ( crun + 1 );
|
||||
|
||||
//read the 12 for PHE
|
||||
unsigned char* phe = NULL;
|
||||
phe = new unsigned char[12];
|
||||
|
||||
unsigned char* papx = NULL;
|
||||
unsigned char phe[12];
|
||||
|
||||
for ( int i = 0; i < crun; i++ )
|
||||
for ( unsigned char i = 0; i < crun; i++ )
|
||||
{
|
||||
BX bx;
|
||||
bx.wordOffset = bytes[j];
|
||||
j++;
|
||||
|
||||
if (fComplex || !oldVersion)
|
||||
if (fComplex || nWordVersion == 0)
|
||||
{
|
||||
memcpy( phe, ( bytes + j), 12 );
|
||||
|
||||
@ -113,6 +107,13 @@ namespace DocFileFormat
|
||||
|
||||
j += 12;
|
||||
}
|
||||
else if (nWordVersion == 2)
|
||||
{
|
||||
memcpy( phe, ( bytes + bx.wordOffset * 2 + j + 1), 6);
|
||||
|
||||
//fill the rgbx array
|
||||
bx.phe = ParagraphHeight( phe, 6, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( phe, ( bytes + j), 6);
|
||||
@ -126,29 +127,27 @@ namespace DocFileFormat
|
||||
|
||||
if ( bx.wordOffset != 0 )
|
||||
{
|
||||
//read first unsigned char of PAPX
|
||||
//PAPX is stored in a FKP; so the first unsigned char is a count of words
|
||||
unsigned char padbyte = 0;
|
||||
unsigned char cw = bytes[bx.wordOffset * 2];
|
||||
|
||||
//if that unsigned char is zero, it's a pad unsigned char, and the word count is the following unsigned char
|
||||
if ( cw == 0 )
|
||||
{
|
||||
padbyte = 1;
|
||||
cw = bytes[bx.wordOffset * 2 + 1];
|
||||
}
|
||||
|
||||
if ( cw != 0 )
|
||||
{
|
||||
int sz = cw * 2;
|
||||
//read the bytes for papx
|
||||
papx = new unsigned char[cw * 2];
|
||||
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), ( cw * 2 ) );
|
||||
unsigned char* papx = new unsigned char[sz];
|
||||
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), sz );
|
||||
|
||||
//parse PAPX and fill grppapx
|
||||
grppapx[i] = new ParagraphPropertyExceptions( papx, ( cw * 2 ), dataStream, oldVersion );
|
||||
grppapx[i] = new ParagraphPropertyExceptions( papx, sz, dataStream, nWordVersion );
|
||||
|
||||
RELEASEARRAYOBJECTS( papx );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -157,7 +156,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS( phe );
|
||||
RELEASEARRAYOBJECTS( bytes );
|
||||
}
|
||||
|
||||
@ -179,7 +177,7 @@ namespace DocFileFormat
|
||||
|
||||
//there are n offsets and n-1 fkp's in the bin table
|
||||
|
||||
if (fib->m_bOlderVersion && fib->m_FibBase.fComplex == false)
|
||||
if (fib->m_nWordVersion > 0 && fib->m_FibBase.fComplex == false)
|
||||
{
|
||||
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBtePapx - 8 ) / 6 ) + 1;
|
||||
|
||||
@ -202,7 +200,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
|
||||
}
|
||||
|
||||
//if (PAPXlist->back()->rgfc[PAPXlist->back()->rgfcSize-1] < last)
|
||||
@ -226,7 +224,7 @@ namespace DocFileFormat
|
||||
int offset = fkpnr * 512;
|
||||
|
||||
//parse the FKP and add it to the list
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
|
||||
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -63,7 +63,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
virtual ~FormattedDiskPagePAPX();
|
||||
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex);
|
||||
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex);
|
||||
/// Parses the 0Table (or 1Table) for FKP _entries containing PAPX
|
||||
static std::list<FormattedDiskPagePAPX*>* GetAllPAPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream, POLE::Stream* dataStream);
|
||||
/// Returns a list of all PAPX FCs between they given boundaries.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -38,10 +38,30 @@ namespace Global
|
||||
static const wchar_t ColorIdentifier[17][12] =
|
||||
{
|
||||
L"auto",
|
||||
L"000000",//L"black",
|
||||
L"0000FF",//L"blue",
|
||||
L"00FFFF",//L"cyan",
|
||||
L"00FF00",// L"green",
|
||||
L"FF00FF",//L"magenta",
|
||||
L"FF0000",//L"red",
|
||||
L"FFFF00",//L"yellow",
|
||||
L"FFFFFF",//L"white",
|
||||
L"darkBlue",
|
||||
L"darkCyan",
|
||||
L"darkGreen",
|
||||
L"darkMagenta",
|
||||
L"darkRed",
|
||||
L"darkYellow",
|
||||
L"darkGray",
|
||||
L"lightGray"
|
||||
};
|
||||
static const wchar_t ColorNameIdentifier[17][12] =
|
||||
{
|
||||
L"auto",
|
||||
L"black",
|
||||
L"blue",
|
||||
L"cyan",
|
||||
L"green",
|
||||
L"green",
|
||||
L"magenta",
|
||||
L"red",
|
||||
L"yellow",
|
||||
@ -55,7 +75,6 @@ namespace Global
|
||||
L"darkGray",
|
||||
L"lightGray"
|
||||
};
|
||||
|
||||
static const wchar_t UnderlineCode[56][16] =
|
||||
{
|
||||
L"none",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -38,110 +38,83 @@ namespace DocFileFormat
|
||||
{
|
||||
HeaderAndFooterTable::HeaderAndFooterTable (FileInformationBlock* fib, POLE::Stream* pTableStream)
|
||||
{
|
||||
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_bOlderVersion);
|
||||
m_nCurrentIndex = 0;
|
||||
|
||||
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcPlcfHdd > tableReader.GetSize()) return;
|
||||
|
||||
unsigned int tableSize = fib->m_FibWord97.lcbPlcfHdd / 4;//in bytes
|
||||
|
||||
if ( ( tableSize > 0 ) && ( fib->m_RgLw97.ccpHdr > 0 ) )
|
||||
if ( tableSize < 1 || fib->m_RgLw97.ccpHdr <1 )
|
||||
return;
|
||||
|
||||
int* table = new int[tableSize];
|
||||
|
||||
for (unsigned int i = 0; i < tableSize; ++i)
|
||||
{
|
||||
int* table = new int[tableSize];
|
||||
|
||||
for (unsigned int i = 0; i < tableSize; ++i)
|
||||
{
|
||||
table[i] = tableReader.ReadInt32();
|
||||
}
|
||||
|
||||
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
|
||||
|
||||
|
||||
//the first 6 _entries are about footnote and endnote formatting
|
||||
//so skip these _entries
|
||||
int pos = (fib->m_FibBase.fComplex || !fib->m_bOlderVersion) ? 6 : 0;
|
||||
|
||||
int count = ( tableSize - pos - 2) / 6;
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
//Even Header
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arEvenHeaders.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arEvenHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//Odd Header
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arOddHeaders.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arOddHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//Even Footer
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arEvenFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arEvenFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//Odd Footer
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arOddFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arOddFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
//First Page Header
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arFirstHeaders.push_back (NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arFirstHeaders.push_back (new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ));
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
||||
if (pos >= tableSize)
|
||||
break;
|
||||
|
||||
//First Page Footers
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arFirstFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arFirstFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
RELEASEARRAYOBJECTS(table);
|
||||
table[i] = tableReader.ReadInt32();
|
||||
}
|
||||
|
||||
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
|
||||
|
||||
int count = 0;
|
||||
int pos = (fib->m_FibBase.fComplex || fib->m_nWordVersion == 0) ? 6 : 0;
|
||||
//the first 6 _entries are about footnote and endnote formatting -Word97 so skip these
|
||||
|
||||
std::vector<std::vector<CharacterRange*>*> arHeadersFooters;
|
||||
|
||||
if (fib->m_nWordVersion == 2)
|
||||
{
|
||||
count = ( tableSize - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
count = ( tableSize - pos - 1) / 6;
|
||||
|
||||
arHeadersFooters.push_back(&m_arEvenHeaders);
|
||||
arHeadersFooters.push_back(&m_arOddHeaders);
|
||||
arHeadersFooters.push_back(&m_arEvenFooters);
|
||||
arHeadersFooters.push_back(&m_arOddFooters);
|
||||
arHeadersFooters.push_back(&m_arFirstHeaders);
|
||||
arHeadersFooters.push_back(&m_arFirstFooters);
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
//Even Header
|
||||
if (fib->m_nWordVersion == 2)
|
||||
{
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
m_arCommonHeadersFooters.push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arCommonHeadersFooters.push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t j = 0; j < 6; j++)
|
||||
{
|
||||
if ( table[pos] == table[pos + 1] )
|
||||
{
|
||||
arHeadersFooters[j]->push_back( NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
arHeadersFooters[j]->push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
|
||||
}
|
||||
pos++;
|
||||
|
||||
if (pos >= tableSize) break;
|
||||
}
|
||||
}
|
||||
if (pos >= tableSize) break;
|
||||
}
|
||||
RELEASEARRAYOBJECTS(table);
|
||||
}
|
||||
|
||||
HeaderAndFooterTable::~HeaderAndFooterTable()
|
||||
@ -152,5 +125,7 @@ namespace DocFileFormat
|
||||
for_each (m_arFirstHeaders.begin(), m_arFirstHeaders.end(), DeleteDynamicObject());
|
||||
for_each (m_arOddFooters.begin(), m_arOddFooters.end(), DeleteDynamicObject());
|
||||
for_each (m_arOddHeaders.begin(), m_arOddHeaders.end(), DeleteDynamicObject());
|
||||
|
||||
for_each (m_arCommonHeadersFooters.begin(), m_arCommonHeadersFooters.end(), DeleteDynamicObject());
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -34,10 +34,12 @@
|
||||
#include "CharacterRange.h"
|
||||
#include "FileInformationBlock.h"
|
||||
|
||||
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex) {\
|
||||
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex)\
|
||||
{\
|
||||
if (m_ar##NAME.empty()) return NULL; \
|
||||
if (nIndex < (int)m_ar##NAME.size()) return m_ar##NAME[nIndex];\
|
||||
return NULL; } \
|
||||
return NULL; \
|
||||
}\
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -54,8 +56,17 @@ namespace DocFileFormat
|
||||
GET_CHARS_RANGE (EvenFooters);
|
||||
GET_CHARS_RANGE (OddFooters);
|
||||
|
||||
inline CharacterRange* GetNextHeaderFooter()
|
||||
{
|
||||
if (m_nCurrentIndex < m_arCommonHeadersFooters.size())
|
||||
return m_arCommonHeadersFooters[m_nCurrentIndex++];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
private:
|
||||
|
||||
size_t m_nCurrentIndex;
|
||||
std::vector<CharacterRange*> m_arCommonHeadersFooters;
|
||||
|
||||
std::vector<CharacterRange*> m_arFirstHeaders;
|
||||
std::vector<CharacterRange*> m_arEvenHeaders;
|
||||
std::vector<CharacterRange*> m_arOddHeaders;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -71,7 +71,7 @@ namespace DocFileFormat
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
TableInfo tai( papx );
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
@ -84,7 +84,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp );
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -33,6 +33,9 @@
|
||||
|
||||
#include "IMapping.h"
|
||||
|
||||
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
|
||||
#define GETBIT(from, num) ((from & (1 << num)) != 0)
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class IVisitable
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -152,37 +152,53 @@ namespace DocFileFormat
|
||||
}
|
||||
OutlineListDescriptor::OutlineListDescriptor( unsigned char * data, int length )
|
||||
{
|
||||
int pos = 0;
|
||||
if (length < 212)
|
||||
{
|
||||
//int sz = FormatUtils::BytesToUChar(data, 0, length);
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0 ; i < 9; i++)
|
||||
{
|
||||
lvl[i].Parse(data + pos, length - pos);
|
||||
pos += 16;
|
||||
for (int i = 0 ; i < 9; i++)
|
||||
{
|
||||
lvl[i].Parse(data + pos, 1);
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
|
||||
short strLen = length - pos;
|
||||
|
||||
while (strLen > 0)
|
||||
{
|
||||
if (data[strLen + 20 - 1] != 0)
|
||||
break;
|
||||
strLen--;
|
||||
for (int i = 0 ; i < 9; i++)
|
||||
{
|
||||
lvl[i].Parse(data + pos, length - pos);
|
||||
pos += 16;
|
||||
}
|
||||
|
||||
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
|
||||
|
||||
short strLen = length - pos;
|
||||
|
||||
while (strLen > 0)
|
||||
{
|
||||
if (data[strLen + 20 - 1] != 0)
|
||||
break;
|
||||
strLen--;
|
||||
}
|
||||
if (strLen > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
|
||||
}
|
||||
}
|
||||
if (strLen > 0)
|
||||
{
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
|
||||
}
|
||||
}
|
||||
|
||||
ByteStructure* OutlineListDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
|
||||
{
|
||||
unsigned char *data = reader->ReadBytes(212, true);
|
||||
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, 212);
|
||||
int sz = GetSize(reader->nWordVersion);
|
||||
|
||||
unsigned char *data = reader->ReadBytes(sz, true);
|
||||
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, sz);
|
||||
|
||||
delete []data;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -143,8 +143,13 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring xst; //64 chars ansi
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 212;
|
||||
static const int STRUCTURE_SIZE_OLD = 10;
|
||||
public:
|
||||
static const int GetSize(int nWordVersion)
|
||||
{
|
||||
return (nWordVersion == 2) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
|
||||
}
|
||||
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
|
||||
|
||||
virtual ~OutlineListDescriptor();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -49,7 +49,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ( fib->m_FibWord97.lcbPlfLfo > 0 )
|
||||
{
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_bOlderVersion);
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcPlfLfo > reader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -77,7 +77,7 @@ namespace DocFileFormat
|
||||
//this papx has no istd, so use PX to parse it
|
||||
unsigned char *bytes = reader->ReadBytes( cbGrpprlPapx, true );
|
||||
|
||||
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->olderVersion);
|
||||
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->nWordVersion);
|
||||
grpprlPapx = new ParagraphPropertyExceptions( *(px->grpprl) );
|
||||
|
||||
RELEASEOBJECT( px );
|
||||
@ -85,7 +85,7 @@ namespace DocFileFormat
|
||||
|
||||
//read the group of chpx sprms
|
||||
bytes = reader->ReadBytes( cbGrpprlChpx, true );
|
||||
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->olderVersion );
|
||||
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->nWordVersion );
|
||||
RELEASEARRAYOBJECTS( bytes );
|
||||
|
||||
//read the number text
|
||||
@ -116,6 +116,10 @@ namespace DocFileFormat
|
||||
|
||||
void NumberingLevelDescriptor::Parse(unsigned char * data, int length )
|
||||
{
|
||||
if (length < 16)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bEnabled = true;
|
||||
|
||||
nfc = FormatUtils::BytesToUChar(data, 0, length);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -45,7 +45,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ( fib->m_FibWord97.lcbPlfLst > 0 )
|
||||
{
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_bOlderVersion);
|
||||
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_nWordVersion);
|
||||
|
||||
if (fib->m_FibWord97.fcPlfLst > reader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -110,7 +110,7 @@ namespace DocFileFormat
|
||||
int countText = m_document->FIB->m_RgLw97.ccpText;
|
||||
int countTextRel = m_document->FIB->m_RgLw97.ccpText - 1;
|
||||
|
||||
while (cp < countText)
|
||||
while (cp < countText && cp >= 0)
|
||||
{
|
||||
fc = m_document->FindFileCharPos(cp);
|
||||
|
||||
@ -120,7 +120,7 @@ namespace DocFileFormat
|
||||
|
||||
if (papx)
|
||||
{
|
||||
TableInfo tai(papx);
|
||||
TableInfo tai(papx, m_document->nWordVersion);
|
||||
if (tai.fInTable)
|
||||
{
|
||||
int cpStart = cp;
|
||||
@ -135,7 +135,7 @@ namespace DocFileFormat
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph(cp);
|
||||
cp = writeParagraph(cp, countTextRel);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -124,7 +124,7 @@ public:
|
||||
|
||||
if (m_Data)
|
||||
{
|
||||
rdByte = m_Data[m_Position];
|
||||
rdByte = (m_Position < m_Size) ? m_Data[m_Position] : 0;
|
||||
m_Position += sizeof(rdByte);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -38,8 +38,8 @@ namespace DocFileFormat
|
||||
{
|
||||
if (m_context)
|
||||
{
|
||||
m_document = m_context->GetDocument();
|
||||
m_xmldocument = m_context->GetXmlDocument();
|
||||
m_document = m_context->_doc;
|
||||
m_xmldocument = m_context->_docx;
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,9 +338,9 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
|
||||
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, bool bOlderVersion)
|
||||
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, int nWordVersion)
|
||||
{
|
||||
if (bOlderVersion && nfc > 5)
|
||||
if (nWordVersion > 0 && nfc > 5)
|
||||
{
|
||||
if (nfc == 0xff) return std::wstring( L"bullet");
|
||||
else return std::wstring( L"none");
|
||||
@ -582,7 +582,7 @@ namespace DocFileFormat
|
||||
// The style id is used for a reverse reference.
|
||||
// It can happen that the reference points to the wrong style.
|
||||
|
||||
if (styleIndex != ListData::ISTD_NIL)
|
||||
if (styleIndex != ListData::ISTD_NIL && styleIndex < m_document->Styles->Styles->size())
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:pStyle", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId(m_document->Styles->Styles->at(styleIndex))));
|
||||
@ -633,7 +633,7 @@ namespace DocFileFormat
|
||||
|
||||
if ((chpxs != NULL) && (!chpxs->empty()))
|
||||
{
|
||||
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->FIB->m_bOlderVersion);
|
||||
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->nWordVersion);
|
||||
|
||||
if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL))
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -65,7 +65,7 @@ namespace DocFileFormat
|
||||
|
||||
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
|
||||
/// Converts the number format code of the binary format.
|
||||
static std::wstring GetNumberFormatWideString(int nfc, bool bOlderVersion = false);
|
||||
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
|
||||
|
||||
virtual ~NumberingMapping();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -60,7 +60,7 @@ namespace DocFileFormat
|
||||
|
||||
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
|
||||
{
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_bOlderVersion);
|
||||
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
|
||||
|
||||
if (pFIB->m_FibWord97.fcDggInfo > oStearmReader.GetSize()) return;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
@ -110,6 +110,11 @@ namespace DocFileFormat
|
||||
unused2 = Reader->ReadByte();
|
||||
unused3 = Reader->ReadByte();
|
||||
|
||||
if (btMacOS != btWin32)
|
||||
{
|
||||
btWin32 = btMacOS = (Global::BlipType)this->Instance;
|
||||
}
|
||||
|
||||
if (BodySize > 0x24)
|
||||
{
|
||||
Blip = RecordFactory::ReadRecord(Reader, 0);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
* (c) Copyright Ascensio System SIA 2010-2018
|
||||
*
|
||||
* 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)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user