mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
901 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c83535528 | |||
| 35a86586ab | |||
| 00fa7e7afe | |||
| dc574f6606 | |||
| c886341ac1 | |||
| 4a93c91011 | |||
| 209a3874c8 | |||
| abc74e21d0 | |||
| e78b399810 | |||
| 1f976ae79a | |||
| 4b9da896ab | |||
| 6561216356 | |||
| 6d53f5745b | |||
| b3d9d4cc6e | |||
| 03b10cb446 | |||
| b87dad75fc | |||
| 0275791b2c | |||
| a30e9ac37f | |||
| cdc74ada43 | |||
| 74920d70b7 | |||
| 5a2b693092 | |||
| e2bae2e187 | |||
| 2cd312f396 | |||
| d796de176c | |||
| d44da46e1e | |||
| 2e83d4e9c8 | |||
| 8293a06d40 | |||
| 6b78d139ee | |||
| 51c33e0701 | |||
| a707ded8b2 | |||
| 0756b8ff90 | |||
| a2d1a74e3d | |||
| 840d679e49 | |||
| 22d4592a1a | |||
| 446ef4d577 | |||
| 6e789e0697 | |||
| fc2cb5f533 | |||
| 5388697b0c | |||
| 82909e892f | |||
| 941b9d0ec1 | |||
| 136d123ba2 | |||
| c036733ff8 | |||
| 9ac1a088b5 | |||
| a29d7cb8b3 | |||
| 8264f89be2 | |||
| 98f7b9d647 | |||
| 711d0017df | |||
| 6bf0f0faf3 | |||
| 021f9f64b4 | |||
| 925979c534 | |||
| b9c53b877c | |||
| a081b37d6d | |||
| 01107f5a07 | |||
| 72a48b656f | |||
| 9834392df8 | |||
| 3428df7bac | |||
| d71477e8a3 | |||
| c100d54aa5 | |||
| cb0360008b | |||
| bf78be5e81 | |||
| ba1a0f7763 | |||
| f77fe887ae | |||
| 57e5fea9cc | |||
| 046e0f7710 | |||
| 3dba3a4d06 | |||
| 2b78a8b617 | |||
| c73bd8b904 | |||
| 92d8d9ad05 | |||
| 9ce86699ed | |||
| c051240cd4 | |||
| 978d80e198 | |||
| 23c427495b | |||
| cac9293d87 | |||
| 137d757631 | |||
| 06052da308 | |||
| 9cd8cb0662 | |||
| f76bf0cee1 | |||
| c8ef152d08 | |||
| b058f017e0 | |||
| 0ffc7ef04c | |||
| 853b22bf73 | |||
| 93ed14aba2 | |||
| f5e4369384 | |||
| 9e6b88c920 | |||
| 2a9ffc41b5 | |||
| cb84378637 | |||
| 9c05b99951 | |||
| cad1004d28 | |||
| 70dbebf727 | |||
| d5087108d0 | |||
| 29822ad719 | |||
| b47c766b24 | |||
| 67bb9f18e6 | |||
| c81c98f524 | |||
| 06079aa022 | |||
| 1e66105813 | |||
| 03dec3dcf6 | |||
| 560b07f3ca | |||
| 3ca8446729 | |||
| aad0ec464f | |||
| 89a8a1d62a | |||
| 3219de14ee | |||
| 8906ea6707 | |||
| d8e9b2d2b4 | |||
| 15ccea0306 | |||
| d1f99b7018 | |||
| 1a3191216a | |||
| 6f447ee939 | |||
| 7414003d86 | |||
| b5d2b40acb | |||
| b18a789e99 | |||
| 8e67aa129e | |||
| e447369665 | |||
| 1e8e50e0a8 | |||
| dc84658b7f | |||
| 74bbbfd0e9 | |||
| 47e72c2210 | |||
| 81db77330f | |||
| e68e8ba644 | |||
| cfa3ad151e | |||
| d0e5d86243 | |||
| 27a93dc070 | |||
| 069a9f3d3a | |||
| 56cfa9d57d | |||
| e475ed88fa | |||
| f1271da9aa | |||
| f9cfdd85ca | |||
| c8e5debf80 | |||
| c8eb931b92 | |||
| 9ed41ccb67 | |||
| 05f0c63e40 | |||
| f5c80ed236 | |||
| f9f0a7896f | |||
| 56a0d29f10 | |||
| eecf99373f | |||
| ef970a6009 | |||
| bd0feeadeb | |||
| eeb982cb64 | |||
| 7c380c7bae | |||
| baa03b2bfa | |||
| 90609cc515 | |||
| d5da22e62b | |||
| fc612032fd | |||
| dd1757e777 | |||
| 140802ac66 | |||
| a6b459923e | |||
| b86f0cc869 | |||
| c82c994184 | |||
| 06f3e4562a | |||
| 68e99604f7 | |||
| 17ec7bc611 | |||
| 85cfd2bf70 | |||
| 904eece17a | |||
| ab1bd76a48 | |||
| 2746b35e12 | |||
| 6b755c03d3 | |||
| 4d9c7a4c01 | |||
| 5d7042746f | |||
| f583be5ee4 | |||
| 0870527a82 | |||
| ac70b849ca | |||
| 4f529461f5 | |||
| ed261400d1 | |||
| 0ef7b83ec9 | |||
| 1c91c72039 | |||
| ba9423c5ff | |||
| a2b318f6fb | |||
| 2bcaff66bf | |||
| 0f2e6a251e | |||
| 3267e7e0fc | |||
| be358da524 | |||
| 8044c5157c | |||
| 7a05534142 | |||
| 537fbfb5e8 | |||
| a42d8eb10a | |||
| 0c4f285410 | |||
| dece8bdcba | |||
| 6eedc2a2f9 | |||
| 044e501b69 | |||
| 5d2b5c92d5 | |||
| 29a65be954 | |||
| 0e4f194269 | |||
| 8fe6e1ce23 | |||
| 65076f0a5e | |||
| eeb325b8ad | |||
| 7c836c61a0 | |||
| 2dea9f2096 | |||
| c0d4bcd16a | |||
| 53f766271f | |||
| 9db42c3494 | |||
| 2a32233d13 | |||
| ec9e3d098f | |||
| e65851ef3b | |||
| f5837dcf44 | |||
| 40dba648f1 | |||
| b9fd01d632 | |||
| f15b5cd463 | |||
| efde950a11 | |||
| 5c61f9e6f1 | |||
| c1fd29423c | |||
| de9f4a9814 | |||
| 87d864527b | |||
| a862facf6a | |||
| 11291cba06 | |||
| b881f02a02 | |||
| 4385caa969 | |||
| 087594e557 | |||
| 133a05542f | |||
| 3703cde00a | |||
| 903ae550d0 | |||
| bb31a9733a | |||
| 42b4cdf733 | |||
| 55b2fff256 | |||
| 36bb26c9fe | |||
| 6285a59b43 | |||
| 2e28ca5550 | |||
| a9a7dce495 | |||
| fd0b734a2b | |||
| 3d18db25e3 | |||
| dae7dac2d5 | |||
| a519bcf0c4 | |||
| 14c0a2a7c0 | |||
| 06f6278e59 | |||
| 77b206a62c | |||
| 74359e39a8 | |||
| 531b4ba0dc | |||
| d003dd8310 | |||
| c58817fc18 | |||
| 0c1c2b4c2e | |||
| 8008ff2e29 | |||
| 24acbd309a | |||
| 23f7029703 | |||
| 8c212908bd | |||
| 19420e98d4 | |||
| fe50098db7 | |||
| 37a554f1f9 | |||
| fbd9eba8bd | |||
| 272a270bc8 | |||
| ffdb21583e | |||
| 9bce904409 | |||
| c5c78fce18 | |||
| 0e6e32d4da | |||
| 0c29e4d08e | |||
| 16238f5e80 | |||
| 9d520219ae | |||
| 9e342b93cf | |||
| be1d417639 | |||
| 9acd562c20 | |||
| 17126e2f6a | |||
| c36a6d8ce2 | |||
| 3fd3940119 | |||
| e7ab7b1558 | |||
| 38a2f8535f | |||
| e310954222 | |||
| a7b7484cdf | |||
| d1488f6a0a | |||
| 497b201dc1 | |||
| 2440bf68a5 | |||
| 288b0dcb90 | |||
| 94059919d7 | |||
| 65c35b9af7 | |||
| bee3ff541a | |||
| 9b64445e3e | |||
| 00802528e5 | |||
| e4c1384bbd | |||
| 817b90418f | |||
| ba57308120 | |||
| df6fb494be | |||
| 931e19048b | |||
| f5fb1cd5a7 | |||
| 63f6e16664 | |||
| 709360930a | |||
| 6c2b1bf1a9 | |||
| a705625321 | |||
| bf75cfab48 | |||
| 3bfb4d4f29 | |||
| d4fd9314bc | |||
| 0937f5ef8f | |||
| d2a3c8b139 | |||
| 39765a5a61 | |||
| b75eeaefe6 | |||
| ff0f86b4ba | |||
| 83feb20265 | |||
| 07711ba4d1 | |||
| 1d1054d762 | |||
| a0ebe7acb3 | |||
| 154f9691a3 | |||
| 88741b4e82 | |||
| 76f94eaacc | |||
| c886e0da68 | |||
| 996b85951d | |||
| 4ee53a3e27 | |||
| 22943dcf0b | |||
| 2ace756da4 | |||
| d964cb3d37 | |||
| d1ac7c9e34 | |||
| 9267fc8aeb | |||
| 1fcc07708b | |||
| 63ff79af7f | |||
| 10d2e2c960 | |||
| 2da99edbd6 | |||
| fb5c459e05 | |||
| c5d85bc2b9 | |||
| 836b6a638b | |||
| ea59351da8 | |||
| 64bb70bbef | |||
| b451472ba3 | |||
| 0a702d44e4 | |||
| ca8b6d9c5c | |||
| 14f0249708 | |||
| f6e6fb28ef | |||
| cd82eb40b6 | |||
| 4813f1d07a | |||
| 771c813936 | |||
| 9728a2277b | |||
| a4245ef832 | |||
| 06136ddd0d | |||
| 390a568555 | |||
| 8d098d9951 | |||
| 35bd761c9c | |||
| 78bc7afa13 | |||
| 8742086a0a | |||
| 98a8a865fe | |||
| 10348a72f1 | |||
| 30264e12d1 | |||
| 3c19d5e26e | |||
| 7b0b4b9cd9 | |||
| 9ba942e3a1 | |||
| 84b3883a1f | |||
| 8c726e475a | |||
| 334c31fcda | |||
| 70db061853 | |||
| e6cb6d9438 | |||
| 973e263b46 | |||
| 53b55326be | |||
| 6530ff95db | |||
| ac98378b4b | |||
| 397352fb75 | |||
| 50a765eb4c | |||
| 8c0f2a6b2c | |||
| b5b7ec1633 | |||
| d0b49a7741 | |||
| 77c3a821a0 | |||
| ce43301d5f | |||
| 3cc2d904d4 | |||
| 158546d3fa | |||
| 4570ac9d1a | |||
| 55531d6ede | |||
| d67dc8939a | |||
| 15152283b7 | |||
| 8032e05f7a | |||
| 4ed4163588 | |||
| 6ff2719109 | |||
| f79027d21e | |||
| 9098f18db2 | |||
| effb0f0066 | |||
| 79964fc766 | |||
| 0337c4265a | |||
| d590eebbe1 | |||
| 1eea84e369 | |||
| e628644d44 | |||
| b8d065fcdc | |||
| 80e3d5a0a8 | |||
| 0f0a448541 | |||
| 592edbc574 | |||
| 170d26562a | |||
| 40dc29d815 | |||
| 7950b821a0 | |||
| d36c3aeea3 | |||
| 38f20032f4 | |||
| 6d57eaa978 | |||
| 1534aa4e0c | |||
| 03c6ffa870 | |||
| db74e10f48 | |||
| 2efb111c91 | |||
| edb35f0c55 | |||
| ce1fbdeb4d | |||
| a6b33f977b | |||
| 78cd4ed710 | |||
| 510291b65a | |||
| fb28aadbb9 | |||
| b255b5e655 | |||
| 25c133d870 | |||
| cb86631775 | |||
| a696c46700 | |||
| 6c4bbae905 | |||
| 0a01752648 | |||
| 3e97080d33 | |||
| f93add5032 | |||
| 9b3d0bb323 | |||
| 00be628ec6 | |||
| d9baf576a5 | |||
| 5d917b93e3 | |||
| 55eac108a4 | |||
| 8d6402acdd | |||
| db5b10ef6d | |||
| 65d846b761 | |||
| d4708d8d2e | |||
| ad4e5d348b | |||
| c62b479832 | |||
| 5003ac4eae | |||
| 90a3231c75 | |||
| beb6bb4dcf | |||
| c888b809b3 | |||
| 660acc4e0b | |||
| 2bf24200fb | |||
| 839ecaaefc | |||
| b4ca670737 | |||
| 86d4eb2ac3 | |||
| a1a81a808c | |||
| 2ed79e00e7 | |||
| a4ec9b1b6d | |||
| 178e809729 | |||
| 2056d81343 | |||
| 388c12e177 | |||
| d375e15418 | |||
| a2820bdd79 | |||
| 3cb4c2d23b | |||
| 5752f56314 | |||
| 9c896ec55e | |||
| 1078df18f8 | |||
| 3729083e3e | |||
| 8856759922 | |||
| 7c26ca6899 | |||
| 3df76f6c67 | |||
| 24f8b68c0d | |||
| 84c4447fa2 | |||
| 5650a56262 | |||
| 27cac74a8d | |||
| 5d505d58ce | |||
| 72af33964d | |||
| da6b89af94 | |||
| 12f644a898 | |||
| de9812479d | |||
| f8db90b29a | |||
| 9cdd43cfa9 | |||
| 389387eebf | |||
| 0ed170de45 | |||
| 2b0611ac25 | |||
| 11ebcfa476 | |||
| be0e9d4a08 | |||
| 02310f1d64 | |||
| 8d143b8682 | |||
| 4bb6c8554c | |||
| 1d04e2dddc | |||
| af184659f3 | |||
| 7698d47e09 | |||
| bfa4e0a5d0 | |||
| 92519a5d62 | |||
| 9febebf33c | |||
| ef365fc08e | |||
| 6c28c529e3 | |||
| e78bc7ea57 | |||
| 9746b63f46 | |||
| 458c9ba638 | |||
| 86f7a181f8 | |||
| be6871a2a4 | |||
| f43a38bdc9 | |||
| 2a8e8995bd | |||
| 95bba9d44a | |||
| cab34310bf | |||
| 9b8d805ea9 | |||
| 9cf28e70e0 | |||
| 558cfb8048 | |||
| c031c8e9cd | |||
| b0363dad58 | |||
| 4ff7be8245 | |||
| 476ebe6e95 | |||
| 37f5bdcaf5 | |||
| 09c30e2686 | |||
| 8210595178 | |||
| ec9a1802bf | |||
| f8f307aa29 | |||
| fb9d4d0460 | |||
| c92847d254 | |||
| ac865d292f | |||
| 6a0d882178 | |||
| 086212209f | |||
| bf0b1e8d97 | |||
| f591bcbd45 | |||
| 5490140a02 | |||
| 37402ebb39 | |||
| ef277b4656 | |||
| 89c2322393 | |||
| ee19ab476f | |||
| 06c8c0e075 | |||
| 10bf455263 | |||
| 9df5a2616c | |||
| a26264775b | |||
| 6973cec1a1 | |||
| 396fc30ac5 | |||
| 383bae3750 | |||
| 974b9bcc1b | |||
| bbc0f1231d | |||
| 90565663d5 | |||
| 208bf78003 | |||
| 6aa9b0518b | |||
| bb8ce719b7 | |||
| 02d93007d4 | |||
| a009d4d918 | |||
| d7a801402e | |||
| bbcd181d9d | |||
| cdbf82ab7e | |||
| 727be4a0da | |||
| 9f57fdb739 | |||
| 2dc209afcc | |||
| 3a97757b86 | |||
| 14c517eaf5 | |||
| 110cee404a | |||
| 0586cabee5 | |||
| 0e9fc9329d | |||
| a3d95d67c5 | |||
| af3cf7f33a | |||
| 7393a8220b | |||
| e00e309662 | |||
| d294c98f9e | |||
| bf804905c7 | |||
| a8e537220b | |||
| 2567e61944 | |||
| 1ee41654a2 | |||
| a1a0feb432 | |||
| 9372226d5c | |||
| a2f6876f60 | |||
| 5b53f2395f | |||
| f8a9135f93 | |||
| e13a95fa0a | |||
| 38c31f25e1 | |||
| e4f9cf881b | |||
| 79882d03af | |||
| 8382ba6fee | |||
| a6bd2e1a74 | |||
| ae20888616 | |||
| ad29f72359 | |||
| 0c1185c9d6 | |||
| e1a08edb99 | |||
| 54f3716ce6 | |||
| 6bafc487d4 | |||
| b2be8e63b6 | |||
| 26e5889be5 | |||
| 2559e97f48 | |||
| e37ef6b999 | |||
| b32d52bb85 | |||
| 571bad5381 | |||
| 2fea55841a | |||
| 2e3a753280 | |||
| f81b269215 | |||
| 9f9a19e84b | |||
| 633f2b56f9 | |||
| 0ba261fa11 | |||
| e3b71d57fc | |||
| a6f8b7c7ac | |||
| f542483beb | |||
| a67b397491 | |||
| 495493ee59 | |||
| b3dec6066a | |||
| 4a0ae7eff3 | |||
| 16f55bc01a | |||
| 436b268e49 | |||
| 539d7b1356 | |||
| 4dd2aa8df6 | |||
| b85d11cc05 | |||
| 3eb5c21b10 | |||
| 9d35757245 | |||
| c7e73feb0f | |||
| 53accfc084 | |||
| eb032af457 | |||
| 63cfded90c | |||
| 64453f020c | |||
| ef3e4c2cfa | |||
| 7f6d04eb34 | |||
| f02690c3fe | |||
| 09d3f946e7 | |||
| 0fb91dc2f8 | |||
| 589f5cdbe9 | |||
| eb8cea5cb2 | |||
| 6174e93a7c | |||
| ca716c5b7d | |||
| 5bf3e4d7ab | |||
| 9644701947 | |||
| ed9bb79889 | |||
| 043f193f2c | |||
| 83230fb3ec | |||
| 9a91fac28c | |||
| e98b542eae | |||
| 825a5d78af | |||
| 66e103fd94 | |||
| a76b7ec328 | |||
| 4df0f97918 | |||
| 79ae7e99d7 | |||
| 17de9d8da0 | |||
| d7dcd96a90 | |||
| 4cdc2b1ea5 | |||
| a3fc7849ae | |||
| 387b89e720 | |||
| 8c560d638d | |||
| 2c45908473 | |||
| 1541e891b4 | |||
| daf2f1a20f | |||
| fa7690a239 | |||
| 4a621f44c2 | |||
| 01ee676614 | |||
| 2e20dd9058 | |||
| 13f125f508 | |||
| c025e51106 | |||
| edcff7f718 | |||
| e5e0949f39 | |||
| 08e6fee7a8 | |||
| 9afcc242b7 | |||
| bd0b0e7830 | |||
| b48fd55607 | |||
| 06fb3f0203 | |||
| cb55300286 | |||
| be7b3c1bbc | |||
| 5a6d6c9057 | |||
| a2a65579c1 | |||
| 59c0abbee9 | |||
| e4896d7893 | |||
| fac71f7b4a | |||
| 90fd93de9a | |||
| 30ab4a55d1 | |||
| 942d39598e | |||
| be6ade46dd | |||
| 047de070cb | |||
| 4b2439b7d8 | |||
| c2d4d4f9bd | |||
| f687d21149 | |||
| b416c5e85a | |||
| 7a92cca760 | |||
| c71b649621 | |||
| 1f18cd62a5 | |||
| 0594d9decd | |||
| a3fb1eccd1 | |||
| 4603f6db84 | |||
| 985a4b41dc | |||
| 5be7c96319 | |||
| b3a9d8d07d | |||
| e9944e0147 | |||
| 5dbc4b4d49 | |||
| 0363867177 | |||
| b2cd5f0211 | |||
| 5a10bb897e | |||
| 89bbbb0aac | |||
| f26de54016 | |||
| 12789ab7f6 | |||
| 1e5819f9f9 | |||
| 810e01e7e9 | |||
| 22bae397cf | |||
| 7c9444e086 | |||
| 46d0acb106 | |||
| 04374ade42 | |||
| f5fa11dde5 | |||
| 389472e2fb | |||
| f8ba2aeeb3 | |||
| 2c2e74d182 | |||
| 3afc193c73 | |||
| 3450f81f99 | |||
| 7d4f6a24d6 | |||
| 190f1ffc10 | |||
| d377bef3a1 | |||
| 3d2c71b51a | |||
| 91688ebc5d | |||
| f9e7e8c91f | |||
| d83c208339 | |||
| 95b7dae910 | |||
| d065709e0a | |||
| b686c743c2 | |||
| 65ceacc5ac | |||
| 971611603b | |||
| 4049fb98e6 | |||
| f95e5a4487 | |||
| a03f7f47bd | |||
| f3b673e85e | |||
| fb72127183 | |||
| a2480098c7 | |||
| 69cf19ddfb | |||
| 8da953facf | |||
| 471bc8a248 | |||
| 1495779207 | |||
| fd02518b7a | |||
| 170974ac60 | |||
| 7c1ab855d1 | |||
| 0ca8ac97c6 | |||
| e5bf10efb4 | |||
| 541b5d7647 | |||
| bd0864fca3 | |||
| 8cd34880e4 | |||
| 24f0fd731d | |||
| a031523e13 | |||
| d5f42cec2b | |||
| 8c95392373 | |||
| 107e6daf2f | |||
| 9df683049d | |||
| f997885e3c | |||
| b41ca06e50 | |||
| 1779672ea6 | |||
| 494f895ce1 | |||
| 327f6982a5 | |||
| a4a6441377 | |||
| a5eda01ad3 | |||
| 1e42d594b7 | |||
| 50733e3979 | |||
| d1ad3cd973 | |||
| f205b21b76 | |||
| 683cb6b09a | |||
| 2cadcaaad5 | |||
| 517d173c45 | |||
| 05abe91a14 | |||
| 39fe62c91a | |||
| 7c0926e250 | |||
| 54e5f27ced | |||
| 885a225c2e | |||
| 155fea77dc | |||
| d15f25f6ed | |||
| f06abd20e1 | |||
| ee3011a7b4 | |||
| d0a64944b7 | |||
| 56105807bf | |||
| 81292abb87 | |||
| e6345385b3 | |||
| c127afb750 | |||
| 58492a53f8 | |||
| 01b12e4a99 | |||
| a90d4dfd99 | |||
| 94c48a6a3e | |||
| 953af5b6b1 | |||
| 77c47267f6 | |||
| 8d37f4b433 | |||
| 757dc61ce8 | |||
| f9c3a41a1d | |||
| eba362d724 | |||
| 3bf78a7828 | |||
| d34b9bb1dd | |||
| 4929328d7f | |||
| 42170638c2 | |||
| 7c02a9d9fc | |||
| 3254167f08 | |||
| 8ae8b79e9e | |||
| c71da950ee | |||
| 2bac3ef4cc | |||
| 058b9a5fd4 | |||
| dd599d1f80 | |||
| 36d9b5044c | |||
| fdd4c9b5c4 | |||
| b092ff1371 | |||
| d0b617a10c | |||
| 8123b8d899 | |||
| 828112bc48 | |||
| f3803591aa | |||
| 93f8485c6e | |||
| 1524c0f1c8 | |||
| 6d6e217e64 | |||
| 8110e5de7c | |||
| f328523112 | |||
| 11d6bfaa01 | |||
| aec48da361 | |||
| 27840241ab | |||
| fd3c746db2 | |||
| 6878e82310 | |||
| 4743d856d9 | |||
| 76c55a87cb | |||
| 864d0af190 | |||
| 40e05fcb72 | |||
| 443fd59974 | |||
| 063c3cf659 | |||
| 68422064cf | |||
| bb11c8d2ca | |||
| c4e94c2293 | |||
| d43120cb0e | |||
| 586e4a8edf | |||
| 63670c57a8 | |||
| 091d594e0f | |||
| e8657eff2a | |||
| 8e2bd3331b | |||
| 33b018c910 | |||
| a9f0fcdd47 | |||
| 1c70fb74a2 | |||
| 6000880da6 | |||
| aeae070e20 | |||
| 166564dc6e | |||
| 1254020428 | |||
| ccd2814bee | |||
| 152300c88e | |||
| 1a75df8721 | |||
| c6b6a54d79 | |||
| d931a2d160 | |||
| 27dcbf4b8b | |||
| c8d01a6352 | |||
| d27fc163ca | |||
| 55766a4b7a | |||
| 3c70dc0db4 | |||
| 0894bcef72 | |||
| 4b4c0bf00a | |||
| e3fc5f2513 | |||
| 5e2618a81a | |||
| e18873cfa6 | |||
| 357539e84e | |||
| cf76729189 | |||
| 0f9c06bd31 | |||
| bdf9e04eb3 | |||
| f4af806e4f | |||
| 7cbfe8eea4 | |||
| dcd956e1b6 | |||
| ae784a8e29 | |||
| 6d5e9a6835 | |||
| 819dd7b55f | |||
| 473caef815 | |||
| 19a5e3e384 | |||
| b1a743bc02 | |||
| 157934032e | |||
| 26fe7c877d | |||
| 29252d6ae5 | |||
| 7f289d4ef0 | |||
| fe97761316 | |||
| a4f5d5cd09 | |||
| 6f45b3d20c | |||
| e549e89cd0 | |||
| ae204cabcd | |||
| 1a36dc4571 | |||
| 72bd9836fe | |||
| 2a2cafbd65 | |||
| 91c9fd0679 | |||
| e0278e4b13 | |||
| 9f5157dc36 | |||
| 32d9962dd1 | |||
| 4b1334390c | |||
| 3fa91220ae | |||
| 03dee31707 | |||
| ab2a640201 | |||
| 261430fdf9 | |||
| 549436e319 | |||
| 83caf6bb40 | |||
| c9a901a737 | |||
| ddeca339dd | |||
| 34de10c65f | |||
| 054f1ef270 | |||
| ca45de67c2 | |||
| 2dcad83f5e | |||
| 07e9cc5be2 | |||
| 1659e1380b | |||
| 6c51371d66 | |||
| baeae4a367 | |||
| 2c489d7831 | |||
| a554a07954 | |||
| 48ad1ef291 | |||
| ffb82e3d61 | |||
| ecb8bcd0d4 | |||
| 7671dcdac6 | |||
| 40595468e7 | |||
| cd943c43fd | |||
| 3b84a04b3a | |||
| 948f3b5e09 | |||
| 775ff2e284 | |||
| 762d17016d | |||
| d9e7574642 | |||
| b81f542613 | |||
| 07bab0c3b5 | |||
| 9a2e6069b3 | |||
| 87631cdf58 | |||
| fdf85aeae6 | |||
| dee89eaa13 | |||
| ed3fff4db5 | |||
| 015a667484 | |||
| f5355c19df | |||
| c38482bb24 | |||
| f39af219f4 | |||
| 0df2234609 | |||
| d15e479a17 | |||
| cfc17ec834 | |||
| ded9f4198f | |||
| 5984794ca5 | |||
| 69c37ebe64 | |||
| aeb8d53d92 | |||
| 2dc0233b90 | |||
| b8fb0d58ad | |||
| e28d040b7b | |||
| e63e2c77b8 | |||
| 3da2f58ce7 | |||
| 9a1f910a4b | |||
| e5d3ad3083 | |||
| 3513563ae7 | |||
| 0f32054f5c | |||
| e693cb433e | |||
| 8e6c09d77a | |||
| 78e211cad4 | |||
| 262021c12e | |||
| 65b243b19f | |||
| f9c0982d85 | |||
| 00a553f3f6 | |||
| e606d8a110 | |||
| 71fa7b2196 | |||
| 049bf6cdd8 | |||
| 9ba46bb6ba | |||
| a0402e1096 | |||
| e096c40166 | |||
| 762b0a07ea | |||
| 784c7186a8 | |||
| 209f664782 | |||
| 67e82e22d8 | |||
| 28c7b54c47 | |||
| 6cc1d99de6 | |||
| 723badfdab |
47
.gitignore
vendored
47
.gitignore
vendored
@ -1,41 +1,4 @@
|
||||
build/
|
||||
dictionaries/
|
||||
LicenceManager/
|
||||
Common/boost_1_58_0
|
||||
Common/3dParty/boost/boost_1_58_0
|
||||
Common/3dParty/boost/boost.data
|
||||
Common/3dParty/boost/ios
|
||||
Common/3dParty/boost/osx
|
||||
Common/3dParty/icu/icu
|
||||
Common/3dParty/icu/win_64
|
||||
Common/3dParty/icu/win_32
|
||||
Common/3dParty/icu/linux_64
|
||||
Common/3dParty/icu/linux_32
|
||||
Common/3dParty/icu/mac_64
|
||||
Common/3dParty/icu/ios
|
||||
Common/3dParty/icu/android
|
||||
Common/3dParty/icu/mac-build
|
||||
Common/3dParty/cef/win_64
|
||||
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/.cipd
|
||||
Common/3dParty/v8/.gclient
|
||||
Common/3dParty/v8/.gclient_entries
|
||||
Common/3dParty/v8/v8
|
||||
Common/3dParty/v8/depot_tools
|
||||
Common/3dParty/v8/win_64
|
||||
Common/3dParty/v8/win_32
|
||||
Common/3dParty/v8/linux_64
|
||||
Common/3dParty/v8/linux_32
|
||||
Common/3dParty/v8/mac_64
|
||||
Common/3dParty/openssl/openssl
|
||||
**/core_build
|
||||
**/Release
|
||||
**/Debug
|
||||
@ -50,15 +13,7 @@ Thumbs.db
|
||||
*.xcuserstate
|
||||
*.xcuserdatad
|
||||
**/Makefile.*
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2.idl
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2.tlb
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2.h
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_i.c
|
||||
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
|
||||
ASCOfficeXlsFile2/win32/dlldata.c
|
||||
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
X2tConverter/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/Makefile
|
||||
X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
|
||||
**/Makefile
|
||||
*.7z
|
||||
*.obj
|
||||
*.pdb
|
||||
|
||||
@ -100,9 +100,6 @@ namespace DocFileFormat
|
||||
|
||||
typedef std::pair <int, int> Int_Pair;
|
||||
|
||||
static const int gc_nZeroWidth = 222;
|
||||
|
||||
|
||||
#define ENCODING_UTF16 1200
|
||||
#define ENCODING_WINDOWS_1250 1250
|
||||
#define ENCODING_UTF8 65001
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@ -123,15 +123,15 @@ namespace XMLTools
|
||||
private:
|
||||
std::wstring m_Name;
|
||||
std::wstring m_ElementText;
|
||||
std::map<std::wstring, std::wstring> m_AttributeMap;
|
||||
std::map<std::wstring, int> m_ChildMap; //for uniq
|
||||
std::unordered_map<std::wstring, std::wstring> m_AttributeMap;
|
||||
std::unordered_map<std::wstring, int> m_ChildMap; //for uniq
|
||||
std::list<XMLElement> m_Elements;
|
||||
|
||||
typedef std::list<XMLElement>::iterator ElementsIterator;
|
||||
typedef std::list<XMLElement>::const_iterator ElementsIteratorConst;
|
||||
|
||||
typedef std::map<std::wstring, std::wstring>::iterator AttMapIterator;
|
||||
typedef std::map<std::wstring, std::wstring>::const_iterator AttMapIteratorConst;
|
||||
typedef std::unordered_map<std::wstring, std::wstring>::iterator AttMapIterator;
|
||||
typedef std::unordered_map<std::wstring, std::wstring>::const_iterator AttMapIteratorConst;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ namespace DocFileFormat
|
||||
|
||||
if (_webHidden)
|
||||
{
|
||||
XMLTools::XMLElement * webHidden = new XMLTools::XMLElement ( L"w:webHidden" );
|
||||
XMLTools::XMLElement *webHidden = new XMLTools::XMLElement ( L"w:webHidden" );
|
||||
parent->AppendChild( *webHidden );
|
||||
RELEASEOBJECT( webHidden );
|
||||
}
|
||||
@ -141,322 +141,308 @@ namespace DocFileFormat
|
||||
{
|
||||
int nProperty = 0; //for unknown test
|
||||
|
||||
switch ( (int)( iter->OpCode ) )
|
||||
switch ((int)(iter->OpCode))
|
||||
{
|
||||
case sprmOldCIstd :
|
||||
case sprmCIstd : // style id
|
||||
case sprmOldCIstd:
|
||||
case sprmCIstd: // style id
|
||||
{
|
||||
if (_isRunStyleNeeded && !_webHidden)
|
||||
{
|
||||
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
_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 );
|
||||
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:
|
||||
}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 ) );
|
||||
LanguageId langid(FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping(lang, Default);
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
langid.Convert(langIDMapping);
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmOldCLid:
|
||||
case sprmCRgLid1_80:
|
||||
case sprmCRgLid1:
|
||||
RELEASEOBJECT(langIDMapping);
|
||||
}break;
|
||||
case sprmOldCLid:
|
||||
case sprmCRgLid1_80:
|
||||
case sprmCRgLid1:
|
||||
{ //east asia
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
LanguageId langid(FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping(lang, EastAsian);
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
langid.Convert(langIDMapping);
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
RELEASEOBJECT(langIDMapping);
|
||||
}break;
|
||||
case sprmCLidBi:
|
||||
{
|
||||
LanguageId langid(FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
|
||||
case sprmCLidBi:
|
||||
{
|
||||
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping(lang, Complex);
|
||||
|
||||
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
|
||||
langid.Convert(langIDMapping);
|
||||
|
||||
langid.Convert( langIDMapping );
|
||||
|
||||
RELEASEOBJECT( langIDMapping );
|
||||
}break;
|
||||
|
||||
case sprmCBrc80:
|
||||
case sprmCBrc:
|
||||
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 ));
|
||||
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);
|
||||
|
||||
case sprmCCv:
|
||||
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 :
|
||||
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() )
|
||||
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 ) );
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>(_doc->FontTable->operator [] (nIndex));
|
||||
if (ffn)
|
||||
m_sDefaultFont = ffn->xszFtn;
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCHpsBi :
|
||||
case sprmCHpsBi:
|
||||
{
|
||||
appendValueElement( parent, L"szCs",
|
||||
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
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 :
|
||||
// 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 );
|
||||
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 );
|
||||
case sprmCHps:
|
||||
{
|
||||
appendValueElement(parent, L"sz",
|
||||
FormatUtils::IntToWideString(FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize)), true);
|
||||
}break;
|
||||
|
||||
case sprmCMajority :
|
||||
case sprmCMajority:
|
||||
{ //for complex props
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsPos:
|
||||
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);
|
||||
appendValueElement(parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
case sprmCHpsPos:
|
||||
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);
|
||||
appendValueElement(parent, L"position", nVertPos, true);
|
||||
}break;
|
||||
|
||||
case sprmOldCHpsKern:
|
||||
case sprmCHpsKern:
|
||||
case sprmOldCHpsKern:
|
||||
case sprmCHpsKern:
|
||||
{
|
||||
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
appendValueElement(parent, L"kern", FormatUtils::IntToWideString(FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize)), true);
|
||||
}break;
|
||||
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
{ // font family
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
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 ) );
|
||||
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 );
|
||||
ascii->SetValue(FormatUtils::XmlEncode(m_sAsciiFont, true));
|
||||
rFonts->AppendAttribute(*ascii);
|
||||
RELEASEOBJECT(ascii);
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCRgFtc1:
|
||||
case sprmCRgFtc1:
|
||||
{
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
size_t nIndex = FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
|
||||
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
|
||||
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 ) );
|
||||
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 );
|
||||
eastAsia->SetValue(FormatUtils::XmlEncode(m_sEastAsiaFont));
|
||||
rFonts->AppendAttribute(*eastAsia);
|
||||
RELEASEOBJECT(eastAsia);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmCRgFtc2:
|
||||
case sprmCRgFtc2:
|
||||
{
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
size_t nIndex = FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
|
||||
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
|
||||
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 ) );
|
||||
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 );
|
||||
ansi->SetValue(FormatUtils::XmlEncode(m_shAnsiFont));
|
||||
rFonts->AppendAttribute(*ansi);
|
||||
RELEASEOBJECT(ansi);
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmOldCKul:
|
||||
case sprmCKul:
|
||||
}break;
|
||||
case sprmOldCKul:
|
||||
case sprmCKul:
|
||||
{ //Underlining
|
||||
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
|
||||
appendValueElement(parent, L"u", FormatUtils::MapValueToWideString(iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16), true);
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmCCharScale:
|
||||
break;
|
||||
case sprmCCharScale:
|
||||
{ //char width
|
||||
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
|
||||
}break;
|
||||
|
||||
case sprmCSfxText:
|
||||
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:
|
||||
appendValueElement(parent, L"effect", FormatUtils::MapValueToWideString(iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16), true);
|
||||
}break;
|
||||
case sprmCIdctHint:
|
||||
{
|
||||
switch(iter->Arguments[0])
|
||||
XMLTools::XMLAttribute hint(L"w:hint");
|
||||
switch (iter->Arguments[0])
|
||||
{
|
||||
case 0: break; // default
|
||||
case 1: break; // eastAsia
|
||||
case 2: break; // cs
|
||||
case 1:
|
||||
{
|
||||
hint.SetValue(L"eastAsia");
|
||||
rFonts->AppendAttribute(hint);
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
hint.SetValue(L"eastAsia");
|
||||
rFonts->AppendAttribute(hint);
|
||||
}break;
|
||||
case 0: break; // default
|
||||
case 0xFF: break; //No ST_Hint equivalent
|
||||
}
|
||||
|
||||
}break;
|
||||
|
||||
case sprmCPbiIBullet:
|
||||
case sprmCPbiIBullet:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
|
||||
if (nIndex >=0)
|
||||
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())
|
||||
@ -465,28 +451,34 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmCPbiGrf:
|
||||
case sprmCPbiGrf:
|
||||
{
|
||||
//used picture bullet
|
||||
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
int val = FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
|
||||
}break;
|
||||
|
||||
case sprmCRsidProp:
|
||||
case sprmCRsidText:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (iter->argumentsSize == 2)
|
||||
case sprmCRsidProp:
|
||||
case sprmCRsidText:
|
||||
break;
|
||||
case sprmCFUsePgsuSettings:
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}else
|
||||
if (iter->argumentsSize == 1)
|
||||
appendFlagElement(parent, *iter, L"snapToGrid", true);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
switch (iter->argumentsSize)
|
||||
{
|
||||
case 1:
|
||||
nProperty = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
|
||||
break;
|
||||
case 2:
|
||||
nProperty = FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
break;
|
||||
case 4:
|
||||
nProperty = FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize);
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -544,7 +536,7 @@ namespace DocFileFormat
|
||||
|
||||
if ( flag == 0 )
|
||||
{
|
||||
val->SetValue( L"false" );
|
||||
val->SetValue( L"0" );
|
||||
ele->AppendAttribute( *val );
|
||||
node->AppendChild( *ele );
|
||||
}
|
||||
@ -587,7 +579,7 @@ namespace DocFileFormat
|
||||
//invert it
|
||||
if ( stylesVal )
|
||||
{
|
||||
val->SetValue( L"false" );
|
||||
val->SetValue( L"0" );
|
||||
ele->AppendAttribute( *val );
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ namespace DocFileFormat
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
_UINT32 Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
_UINT32 Converter::Convert(WordDocument* doc, WordprocessingDocument* docx)
|
||||
{
|
||||
if (!doc || !docx) return S_FALSE;
|
||||
|
||||
@ -81,21 +81,9 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//write document.xml and the header and footers
|
||||
MainDocumentMapping mainDocMapping( &context, progress );
|
||||
MainDocumentMapping mainDocMapping( &context);
|
||||
doc->Convert( &mainDocMapping );
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 810000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 810000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
//Write numbering.xml
|
||||
if (doc->listTable)
|
||||
{
|
||||
@ -103,129 +91,43 @@ namespace DocFileFormat
|
||||
doc->listTable->Convert( &numberingMapping );
|
||||
}
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 850000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 850000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//write the footnotes
|
||||
FootnotesMapping footnotesMapping( &context );
|
||||
doc->Convert( &footnotesMapping );
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 900000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 900000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//write the endnotes
|
||||
EndnotesMapping endnotesMapping( &context );
|
||||
doc->Convert( &endnotesMapping );
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 925000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 925000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//write the comments
|
||||
CommentsMapping commentsMapping( &context );
|
||||
doc->Convert( &commentsMapping );
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 950000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 950000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//write settings.xml at last because of the rsid list
|
||||
if (doc->DocProperties)
|
||||
{
|
||||
SettingsMapping settingsMapping( &context );
|
||||
doc->DocProperties->Convert( &settingsMapping );
|
||||
}
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 975000 );
|
||||
|
||||
short cancel = 0;
|
||||
progress->OnProgressEx( progress->caller, DOC_ONPROGRESSEVENT_ID, 975000, &cancel );
|
||||
|
||||
if ( cancel != 0 )
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_UINT32 Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
_UINT32 Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, bool &bMacros)
|
||||
{
|
||||
WordDocument doc(progress, m_sTempFolder, m_nUserLCID);
|
||||
WordDocument doc(m_sTempFolder, m_nUserLCID);
|
||||
WordprocessingDocument docx(strDstDirectory, &doc);
|
||||
|
||||
_UINT32 result = doc.LoadDocument(strSrcFile, password);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
result = Convert(&doc, &docx, progress);
|
||||
result = Convert(&doc, &docx);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
docx.SaveDocument(bMacros);
|
||||
|
||||
if (progress)progress->OnProgress(progress->caller, DOC_ONPROGRESSEVENT_ID, 1000000);
|
||||
|
||||
short cancel = 0;
|
||||
if (progress)progress->OnProgressEx(progress->caller, DOC_ONPROGRESSEVENT_ID, 1000000, &cancel);
|
||||
|
||||
if (0 != cancel)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
result = docx.SaveDocument(bMacros);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include <string>
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
class WordDocument;
|
||||
@ -50,9 +48,9 @@ namespace DocFileFormat
|
||||
std::wstring m_sTempFolder;
|
||||
int m_nUserLCID;
|
||||
|
||||
_UINT32 LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
_UINT32 LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, bool &bMacros);
|
||||
|
||||
private:
|
||||
_UINT32 Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
_UINT32 Convert(WordDocument* doc, WordprocessingDocument* docx);
|
||||
};
|
||||
}
|
||||
|
||||
@ -52,9 +52,9 @@ namespace DocFileFormat
|
||||
m_bInternalXmlWriter = false;
|
||||
|
||||
_writeWebHidden = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
|
||||
m_context->_docx->_isSectionPageBreak = 0;
|
||||
//--------------------------------------------
|
||||
_embeddedObject = false;
|
||||
}
|
||||
@ -68,11 +68,12 @@ namespace DocFileFormat
|
||||
m_bInternalXmlWriter = false;
|
||||
|
||||
_writeWebHidden = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
_embeddedObject = false;
|
||||
|
||||
_cacheListNum = -1;
|
||||
|
||||
m_context->_docx->_isSectionPageBreak = 0;
|
||||
}
|
||||
|
||||
DocumentMapping::~DocumentMapping()
|
||||
@ -115,7 +116,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
|
||||
{
|
||||
ListNumCache* listNum = dynamic_cast<ListNumCache*> (m_document->ListPlex->Elements[i-1]);
|
||||
ListNumCache* listNum = dynamic_cast<ListNumCache*> (m_document->ListPlex->Elements[i - 1]);
|
||||
|
||||
return listNum->value;
|
||||
}
|
||||
@ -233,7 +234,7 @@ namespace DocFileFormat
|
||||
}
|
||||
//-----------------------------------------------------------
|
||||
//_cacheListNum = getListNumCache(fc, fcEnd);
|
||||
_isSectionPageBreak = 0;
|
||||
m_context->_docx->_isSectionPageBreak = 0;
|
||||
if (sectionEnd)
|
||||
{
|
||||
// this is the last paragraph of this section
|
||||
@ -244,7 +245,7 @@ namespace DocFileFormat
|
||||
ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr);
|
||||
papx->Convert(&oMapping);
|
||||
|
||||
_isSectionPageBreak = oMapping.get_section_page_break();
|
||||
m_context->_docx->_isSectionPageBreak = oMapping.get_section_page_break();
|
||||
}
|
||||
|
||||
++_sectionNr;
|
||||
@ -360,8 +361,10 @@ namespace DocFileFormat
|
||||
|
||||
RELEASEOBJECT(chpxFcs);
|
||||
RELEASEOBJECT(chpxs);
|
||||
|
||||
|
||||
return cpEnd++;
|
||||
|
||||
return (std::max)(cp, cpEnd); //ralph_scovile.doc
|
||||
}
|
||||
|
||||
void DocumentMapping::writeParagraphRsid (const ParagraphPropertyExceptions* papx)
|
||||
@ -515,6 +518,7 @@ namespace DocFileFormat
|
||||
std::wstring PAGEREF ( L"PAGEREF" );
|
||||
std::wstring PAGE ( L"PAGE" );
|
||||
std::wstring SHAPE ( L"SHAPE" );
|
||||
std::wstring NREF ( L"NREF");
|
||||
|
||||
if (arField.empty() == false)
|
||||
f = arField[0];
|
||||
@ -535,8 +539,9 @@ namespace DocFileFormat
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.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 bSHAPE = search( f.begin(), f.end(), SHAPE.begin(), SHAPE.end()) != f.end();
|
||||
|
||||
bool bSHAPE = search( f.begin(), f.end(), SHAPE.begin(), SHAPE.end()) != f.end();
|
||||
bool bNREF = search( f.begin(), f.end(), NREF.begin(), NREF.end()) != f.end();
|
||||
|
||||
bool bPAGEREF = false;
|
||||
if (bHYPERLINK && arField.size() > 1)
|
||||
{
|
||||
@ -630,8 +635,8 @@ namespace DocFileFormat
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
_writeTocLink = _writeTocLink.substr(0, d);
|
||||
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
_writeAfterRun += _writeTocLink;
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor=\"");
|
||||
_writeAfterRun += XmlUtils::EncodeXmlString(_writeTocLink);
|
||||
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
|
||||
|
||||
break;
|
||||
@ -823,8 +828,10 @@ namespace DocFileFormat
|
||||
}
|
||||
else if (TextMark::PageBreakOrSectionMark == code)
|
||||
{
|
||||
if (_isSectionPageBreak == 0)
|
||||
if (m_context->_docx->_isSectionPageBreak == 0 || m_context->_docx->_isSectionPageBreak == 2)
|
||||
{
|
||||
m_context->_docx->_isSectionPageBreak = -1;
|
||||
|
||||
writeTextElement(text, textType);
|
||||
|
||||
text.clear();
|
||||
@ -912,22 +919,26 @@ namespace DocFileFormat
|
||||
|
||||
//<w:sym w:font="Symbol" w:char="F062"/>
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
|
||||
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
if (false == s.HexValue.empty()) //09FluGuide.doc - поврежденный
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
|
||||
if (false == s.FontName.empty()) // ??? default
|
||||
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
|
||||
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
}
|
||||
}
|
||||
else if ((TextMark::DrawnObject == code) && fSpec)
|
||||
{
|
||||
Spa* pSpa = NULL;
|
||||
Spa* pSpa = NULL;
|
||||
if (typeid(*this) == typeid(MainDocumentMapping))
|
||||
{
|
||||
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlex->GetStruct(cp));
|
||||
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlex->GetStruct(cp));
|
||||
}
|
||||
else if ((typeid(*this) == typeid(HeaderMapping) ) || ( typeid(*this) == typeid(FooterMapping)))
|
||||
{
|
||||
int headerCp = ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn );
|
||||
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlexHeader->GetStruct(headerCp));
|
||||
int headerCp = ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn );
|
||||
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlexHeader->GetStruct(headerCp));
|
||||
}
|
||||
|
||||
bool bPicture = false;
|
||||
@ -1029,7 +1040,7 @@ namespace DocFileFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
VMLShapeMapping oVmlMapper(m_context, &pictWriter, NULL, &oPicture, _caller, isInline);
|
||||
VMLShapeMapping oVmlMapper(m_context, &pictWriter, NULL, &oPicture, _caller, isInline, false);
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
|
||||
@ -1786,7 +1797,11 @@ namespace DocFileFormat
|
||||
{
|
||||
if ((m_document->FootnoteReferenceCharactersPlex != NULL) && (m_document->FootnoteReferenceCharactersPlex->IsCpExists(cp)))
|
||||
{
|
||||
FootnoteDescriptor* desc = dynamic_cast<FootnoteDescriptor*>(m_document->FootnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
FootnoteDescriptor* desc = NULL;
|
||||
|
||||
if (_footnoteNr < m_document->FootnoteReferenceCharactersPlex->Elements.size())
|
||||
desc = dynamic_cast<FootnoteDescriptor*>(m_document->FootnoteReferenceCharactersPlex->Elements[_footnoteNr]);
|
||||
|
||||
if ((desc) && (false == desc->bUsed))
|
||||
{
|
||||
desc->bUsed = true;
|
||||
|
||||
@ -154,7 +154,7 @@ namespace DocFileFormat
|
||||
int _endnoteNr;
|
||||
int _commentNr;
|
||||
bool _isTextBoxContent;
|
||||
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues
|
||||
// int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already
|
||||
bool _writeWebHidden;
|
||||
std::wstring _writeAfterRun;
|
||||
std::wstring _lastOLEObject;
|
||||
|
||||
@ -444,40 +444,50 @@ namespace DocFileFormat
|
||||
rsidRoot = FormatUtils::BytesToInt32(bytes, 588, size);
|
||||
//unused 2
|
||||
|
||||
if (size > 594 && size > 609) //start && stop bound /* && fib->m_FibNew.nFibNew > Fib2002*/
|
||||
if (size > 594 && size > 609)
|
||||
{
|
||||
//split bytes 592,593,594,595 into bits
|
||||
fTreatLockAtnAsReadOnly = FormatUtils::GetBitFromBytes((bytes + 592), 4, 0);
|
||||
fStyleLock = FormatUtils::GetBitFromBytes((bytes + 592), 4, 1);
|
||||
fAutoFmtOverride = FormatUtils::GetBitFromBytes((bytes + 592), 4, 2);
|
||||
fRemoveWordML = FormatUtils::GetBitFromBytes((bytes + 592), 4, 3);
|
||||
fApplyCustomXForm = FormatUtils::GetBitFromBytes((bytes + 592), 4, 4);
|
||||
fStyeLockEnforced = FormatUtils::GetBitFromBytes((bytes + 592), 4, 5);
|
||||
fFakeLockAtn = FormatUtils::GetBitFromBytes((bytes + 592), 4, 6);
|
||||
fIgnoreMixedContent = FormatUtils::GetBitFromBytes((bytes + 592), 4, 7);
|
||||
fShowPlaceholderText = FormatUtils::GetBitFromBytes((bytes + 592), 4, 8);
|
||||
grf = FormatUtils::GetUIntFromBytesBits((bytes + 592), 4, 9, 23);
|
||||
const size_t dop2003_offset = 594;
|
||||
|
||||
//split bytes 596 and 597 into bits
|
||||
fReadingModeInkLockDown = FormatUtils::GetBitFromBytes((bytes + 596), 2, 0);
|
||||
fAcetateShowInkAtn = FormatUtils::GetBitFromBytes((bytes + 596), 2, 1);
|
||||
fFilterDttm = FormatUtils::GetBitFromBytes((bytes + 596), 2, 2);
|
||||
fEnforceDocProt = FormatUtils::GetBitFromBytes((bytes + 596), 2, 3);
|
||||
iDocProtCur = (unsigned short)FormatUtils::GetUIntFromBytesBits((bytes + 596), 2, 4, 3);
|
||||
fDispBkSpSaved = FormatUtils::GetBitFromBytes((bytes + 596), 2, 7);
|
||||
_UINT32 flags = FormatUtils::BytesToUInt32(bytes, dop2003_offset, size);
|
||||
fTreatLockAtnAsReadOnly = GETBIT(flags, 0);
|
||||
fStyleLock = GETBIT(flags, 1);
|
||||
fAutoFmtOverride = GETBIT(flags, 2);
|
||||
fRemoveWordML = GETBIT(flags, 3);
|
||||
fApplyCustomXForm = GETBIT(flags, 4);
|
||||
fStyeLockEnforced = GETBIT(flags, 5);
|
||||
fFakeLockAtn = GETBIT(flags, 6);
|
||||
fIgnoreMixedContent = GETBIT(flags, 7);
|
||||
fShowPlaceholderText = GETBIT(flags, 8);
|
||||
bool unused = GETBIT(flags, 9);
|
||||
fWord97Doc = GETBIT(flags, 10);
|
||||
fStyleLockTheme = GETBIT(flags, 11);
|
||||
fStyleLockQFSet = GETBIT(flags, 12);
|
||||
//empty = 19
|
||||
|
||||
dxaPageLock = FormatUtils::BytesToInt16(bytes, 598, size);
|
||||
dyaPageLock = FormatUtils::BytesToInt16(bytes, 600, size);
|
||||
pctFontLock = FormatUtils::BytesToInt32(bytes, 602, size);
|
||||
grfitbid = bytes[606];
|
||||
//unsigned char 607 is unused
|
||||
ilfoMacAtCleanup = FormatUtils::BytesToUInt16(bytes, 608, size);
|
||||
BYTE flags2 = bytes[dop2003_offset + 4];
|
||||
fReadingModeInkLockDown = GETBIT(flags2, 0);
|
||||
fAcetateShowInkAtn = GETBIT(flags2, 1);
|
||||
fFilterDttm = GETBIT(flags2, 2);
|
||||
fEnforceDocProt = GETBIT(flags2, 3);
|
||||
iDocProtCur = GETBITS(flags2, 4, 6);
|
||||
fDispBkSpSaved = GETBIT(flags2, 7);
|
||||
|
||||
//empty2 = 8
|
||||
dxaPageLock = FormatUtils::BytesToInt32(bytes, dop2003_offset + 6, size);
|
||||
dyaPageLock = FormatUtils::BytesToInt32(bytes, dop2003_offset + 10, size);
|
||||
pctFontLock = FormatUtils::BytesToInt32(bytes, dop2003_offset + 14, size);
|
||||
|
||||
grfitbid = bytes[dop2003_offset + 18];
|
||||
//empty3 = 8
|
||||
ilfoMacAtCleanup = FormatUtils::BytesToUInt16(bytes, dop2003_offset + 20, size);
|
||||
|
||||
if (size > 616 && size > 621) //start && stop bound /* && fib->m_FibNew.nFibNew > Fib2003*/
|
||||
{
|
||||
const size_t dop2007_offset = 616;
|
||||
|
||||
//4 bytes reserved
|
||||
bool fRMTrackFormatting = FormatUtils::GetBitFromBytes((bytes + 620), 2, 0);
|
||||
bool fRMTrackMoves = FormatUtils::GetBitFromBytes((bytes + 620), 2, 1);
|
||||
bool fRMTrackFormatting = FormatUtils::GetBitFromBytes((bytes + dop2007_offset + 4), 2, 0);
|
||||
bool fRMTrackMoves = FormatUtils::GetBitFromBytes((bytes + dop2007_offset + 4), 2, 1);
|
||||
//dopMth = 34 bytes from 624 = 658
|
||||
|
||||
if (size > 674/* && fib->m_FibNew.nFibNew > Fib2007*/)
|
||||
@ -799,13 +809,12 @@ namespace DocFileFormat
|
||||
fFakeLockAtn = false;
|
||||
fIgnoreMixedContent = false;
|
||||
fShowPlaceholderText = false;
|
||||
grf = 0;
|
||||
fReadingModeInkLockDown = false;
|
||||
fAcetateShowInkAtn = false;
|
||||
fFilterDttm = false;
|
||||
fEnforceDocProt = false;
|
||||
iDocProtCur = 0;
|
||||
fDispBkSpSaved = true;
|
||||
fDispBkSpSaved = false;
|
||||
dxaPageLock = 0;
|
||||
dyaPageLock = 0;
|
||||
pctFontLock = 0;
|
||||
|
||||
@ -570,7 +570,11 @@ namespace DocFileFormat
|
||||
bool fIgnoreMixedContent;
|
||||
// XML Option: Show placeholder text for all empty XML elements
|
||||
bool fShowPlaceholderText;
|
||||
unsigned int grf;
|
||||
|
||||
bool fWord97Doc = false;
|
||||
bool fStyleLockTheme = false;
|
||||
bool fStyleLockQFSet = false;
|
||||
|
||||
// Reading mode: ink lock down
|
||||
bool fReadingModeInkLockDown;
|
||||
// Track changes: Show ink annotations
|
||||
@ -587,9 +591,9 @@ namespace DocFileFormat
|
||||
unsigned short iDocProtCur;
|
||||
bool fDispBkSpSaved;
|
||||
// Reading Layout page size lockdown
|
||||
short dxaPageLock;
|
||||
int dxaPageLock;
|
||||
// Reading Layout page size lockdown
|
||||
short dyaPageLock;
|
||||
int dyaPageLock;
|
||||
// Reading Layout font lockdown
|
||||
int pctFontLock;
|
||||
unsigned char grfitbid;
|
||||
|
||||
@ -34,9 +34,8 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
MainDocumentMapping::MainDocumentMapping (ConversionContext* ctx, const ProgressCallback* ffCallBack) : DocumentMapping( ctx, this ), m_ffCallBack(NULL)
|
||||
MainDocumentMapping::MainDocumentMapping (ConversionContext* ctx) : DocumentMapping( ctx, this )
|
||||
{
|
||||
m_ffCallBack = ffCallBack;
|
||||
}
|
||||
|
||||
MainDocumentMapping::~MainDocumentMapping()
|
||||
@ -168,24 +167,6 @@ namespace DocFileFormat
|
||||
|
||||
cp = m_document->FIB->m_RgLw97.ccpText;
|
||||
}
|
||||
|
||||
if (m_ffCallBack)
|
||||
{
|
||||
if (( (unsigned int) cp > (progressStep * index) ) && (m_ffCallBack))
|
||||
{
|
||||
double progress = ( double( 800000 - 500000 ) / m_document->FIB->m_RgLw97.ccpText * cp );
|
||||
|
||||
m_ffCallBack->OnProgress (m_ffCallBack->caller, DOC_ONPROGRESSEVENT_ID, long( 500000 + progress ));
|
||||
|
||||
short bCancel = 0;
|
||||
m_ffCallBack->OnProgressEx (m_ffCallBack->caller, DOC_ONPROGRESSEVENT_ID, long( 500000 + progress ), &bCancel);
|
||||
|
||||
if (0 != bCancel)
|
||||
return;
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//write the section properties of the body with the last SEPX
|
||||
|
||||
@ -41,12 +41,9 @@ namespace DocFileFormat
|
||||
class MainDocumentMapping : public DocumentMapping
|
||||
{
|
||||
public:
|
||||
MainDocumentMapping (ConversionContext* ctx, const ProgressCallback* ffCallBack);
|
||||
MainDocumentMapping (ConversionContext* ctx);
|
||||
virtual ~MainDocumentMapping();
|
||||
|
||||
virtual void Apply (IVisitable* visited);
|
||||
|
||||
private:
|
||||
|
||||
const ProgressCallback* m_ffCallBack;
|
||||
};
|
||||
}
|
||||
@ -40,7 +40,7 @@ namespace DocFileFormat
|
||||
public:
|
||||
static const unsigned short TYPE_CODE_0xF00D = 0xF00D;
|
||||
|
||||
OfficeArtClientTextbox () : Record(), m_nIndex(0)
|
||||
OfficeArtClientTextbox () : Record()
|
||||
{
|
||||
|
||||
}
|
||||
@ -50,24 +50,15 @@ namespace DocFileFormat
|
||||
unsigned int number = Reader->ReadUInt16();
|
||||
m_nIndex = Reader->ReadUInt16();
|
||||
}
|
||||
|
||||
virtual ~OfficeArtClientTextbox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual Record* NewObject(IBinaryReader* reader, unsigned int bodySize, unsigned int typeCode, unsigned int version, unsigned int instance)
|
||||
{
|
||||
return new OfficeArtClientTextbox(reader, bodySize, typeCode, version, instance);
|
||||
}
|
||||
|
||||
inline int GetIndex ()
|
||||
{
|
||||
return m_nIndex;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
int m_nIndex;
|
||||
int m_nIndex = 0;
|
||||
};
|
||||
}
|
||||
@ -661,7 +661,8 @@ namespace DocFileFormat
|
||||
//Vinci_Customer_Case_Study.doc
|
||||
_isSectionPageBreak = 1;
|
||||
}
|
||||
else _isSectionPageBreak = 2;
|
||||
else
|
||||
_isSectionPageBreak = 2;
|
||||
|
||||
RELEASEOBJECT( sectionPropertiesMapping );
|
||||
_pPr->AppendChild( sectPr );
|
||||
|
||||
@ -393,8 +393,15 @@ namespace DocFileFormat
|
||||
//read from pcd.fc to fcEnd
|
||||
|
||||
int cb = fcEnd - (int)pcd.fc;
|
||||
if (cb <= 0)
|
||||
break;
|
||||
if (cb == 0) //ralph_scovile.doc
|
||||
{
|
||||
if (pcd.cpEnd - pcd.cpStart < 2) // com2010_0624pl01.doc
|
||||
cb = pcdFcEnd - (int)pcd.fc;
|
||||
if (cb <= 0)
|
||||
break;
|
||||
}
|
||||
else if (cb < 0)
|
||||
break;
|
||||
|
||||
if (!ReadSymbolsBuffer((int)pcd.fc, cb, pcd.code_page, word, encodingChars))
|
||||
break;
|
||||
|
||||
@ -439,15 +439,15 @@ namespace DocFileFormat
|
||||
val.SetValue( getBorderType( brc->brcType ));
|
||||
border->AppendAttribute( val );
|
||||
|
||||
XMLTools::XMLAttribute color( L"w:color" );
|
||||
color.SetValue( RGBColor( brc->cv, RedFirst ).SixDigitHexCode);
|
||||
border->AppendAttribute( color );
|
||||
|
||||
XMLTools::XMLAttribute space( L"w:space" , FormatUtils::IntToWideString( brc->dptSpace ));
|
||||
border->AppendAttribute( space );
|
||||
|
||||
XMLTools::XMLAttribute sz( L"w:sz", FormatUtils::IntToWideString( brc->dptLineWidth ));
|
||||
border->AppendAttribute( sz );
|
||||
|
||||
XMLTools::XMLAttribute space( L"w:space" , FormatUtils::IntToWideString( brc->dptSpace ));
|
||||
border->AppendAttribute( space );
|
||||
|
||||
XMLTools::XMLAttribute color( L"w:color" );
|
||||
color.SetValue( RGBColor( brc->cv, RedFirst ).SixDigitHexCode);
|
||||
border->AppendAttribute( color );
|
||||
|
||||
if ( brc->fShadow )
|
||||
{
|
||||
|
||||
@ -108,7 +108,7 @@ namespace DocFileFormat
|
||||
switch (iter->OpCode)
|
||||
{
|
||||
case sprmOldSGprfIhdt:
|
||||
case sprmSGprfIhdt:
|
||||
//case sprmSGprfIhdt: //betesil_pl_it.doc
|
||||
{
|
||||
fHF = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
}break;
|
||||
@ -162,6 +162,7 @@ namespace DocFileFormat
|
||||
//MUST be ignored if the section does not have page number restart enabled.([MS-DOC] — v20101113. стр 152)
|
||||
bool bWasSprmSFPgnRestart = false;
|
||||
std::wstring wsSprmSPgnStart;
|
||||
int nProperty = 0; // for unknown
|
||||
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = sepx->grpprl->begin(); iter != sepx->grpprl->end(); ++iter)
|
||||
{
|
||||
@ -474,9 +475,14 @@ namespace DocFileFormat
|
||||
break;
|
||||
|
||||
default:
|
||||
if (iter->argumentsSize == 2)
|
||||
{
|
||||
int sz = iter->argumentsSize;
|
||||
}break;
|
||||
nProperty = FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
}
|
||||
else if (iter->argumentsSize == 1)
|
||||
{
|
||||
nProperty = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,6 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
Spa();
|
||||
|
||||
virtual ~Spa();
|
||||
|
||||
virtual ByteStructure* ConstructObject(VirtualStreamReader* reader, int length);
|
||||
@ -68,7 +67,6 @@ namespace DocFileFormat
|
||||
{
|
||||
return spid;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// Shape Identifier. Used in conjunction with the office art data
|
||||
|
||||
@ -114,7 +114,7 @@ namespace DocFileFormat
|
||||
TC80 oTC80;
|
||||
|
||||
oTC80.ftsWidth = Global::dxa;
|
||||
oTC80.wWidth = 3190;
|
||||
oTC80.wWidth = 0;
|
||||
|
||||
oTC80.brcTop = new BorderCode();
|
||||
oTC80.brcLeft = new BorderCode();
|
||||
|
||||
@ -98,12 +98,23 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"w:styleId", FormatUtils::XmlEncode(MakeStyleId( *iter )));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
// <w:name val="" />
|
||||
// <w:name val="" />
|
||||
std::wstring sName = FormatUtils::XmlEncode(getStyleName(*iter), true);
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:name", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::XmlEncode(getStyleName( *iter ), true ));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
if ((*iter)->sti == StyleIdentifier::Normal)
|
||||
m_pXmlWriter->WriteAttribute(L"w:val", L"Normal");
|
||||
else
|
||||
m_pXmlWriter->WriteAttribute(L"w:val", sName);
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
|
||||
// <w:basedOn val="" />
|
||||
if ((*iter)->sti == StyleIdentifier::Normal) // ??? < sti < 159
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:aliases", TRUE);
|
||||
m_pXmlWriter->WriteAttribute(L"w:val", sName);
|
||||
m_pXmlWriter->WriteNodeEnd(L"", TRUE);
|
||||
}
|
||||
|
||||
// <w:basedOn val="" />
|
||||
if ( ( (*iter)->istdBase != 4095 ) && ( (*iter)->istdBase < sheet->Styles->size() ) )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:basedOn", TRUE );
|
||||
@ -111,7 +122,7 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
}
|
||||
|
||||
// <w:next val="" />
|
||||
// <w:next val="" />
|
||||
if ( (*iter)->istdNext < sheet->Styles->size() )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:next", TRUE );
|
||||
@ -119,7 +130,7 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
|
||||
}
|
||||
|
||||
// <w:link val="" />
|
||||
// <w:link val="" />
|
||||
if ( (*iter)->istdLink < sheet->Styles->size() )
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:link", TRUE );
|
||||
|
||||
@ -63,10 +63,6 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(_tcPr);
|
||||
RELEASEOBJECT(_tcMar);
|
||||
RELEASEOBJECT(_tcBorders);
|
||||
RELEASEOBJECT(_brcTop);
|
||||
RELEASEOBJECT(_brcLeft);
|
||||
RELEASEOBJECT(_brcRight);
|
||||
RELEASEOBJECT(_brcBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +93,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool bPresentDefTable = false;
|
||||
for (std::list<SinglePropertyModifier>::reverse_iterator iter = tapx->grpprl->rbegin(); iter != tapx->grpprl->rend(); ++iter)
|
||||
{
|
||||
@ -111,6 +106,18 @@ namespace DocFileFormat
|
||||
bPresentDefTable = true;
|
||||
|
||||
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
|
||||
|
||||
bool bUseWidth = true;
|
||||
|
||||
for (size_t j = 0; j < tdef.rgTc80.size(); ++j)
|
||||
{ // 1bc0f6c0-b226-4bcb-912c-e7f97b009d8a.doc
|
||||
// Технические_Требования_1_287_ДИТ.DOC
|
||||
if (tdef.rgTc80[j].horzMerge == 0 && tdef.rgTc80[j].wWidth < 1)
|
||||
{
|
||||
bUseWidth = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int cc = tdef.numberOfColumns;
|
||||
|
||||
_tGrid = tdef.rgdxaCenter;
|
||||
@ -172,33 +179,23 @@ namespace DocFileFormat
|
||||
_gridSpan = 1;
|
||||
|
||||
nComputedCellWidths += (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ 0 ]);
|
||||
nComputedCellWidth += tdef.rgTc80[ _cellIndex].wWidth > 1 ? tdef.rgTc80[ _cellIndex].wWidth : (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ]);
|
||||
//Технические_Требования_1_287_ДИТ.DOC
|
||||
|
||||
nComputedCellWidth += bUseWidth ? tdef.rgTc80[ _cellIndex].wWidth :
|
||||
(tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ]);
|
||||
}
|
||||
|
||||
if (!IsTableBordersDefined(tapx->grpprl))
|
||||
{
|
||||
RELEASEOBJECT(_brcTop);
|
||||
_brcTop = new BorderCode(*_tcDef.brcTop);
|
||||
|
||||
RELEASEOBJECT(_brcLeft);
|
||||
_brcLeft = new BorderCode(*_tcDef.brcLeft);
|
||||
|
||||
RELEASEOBJECT(_brcRight);
|
||||
_brcRight = new BorderCode(*_tcDef.brcRight);
|
||||
|
||||
RELEASEOBJECT(_brcBottom);
|
||||
_brcBottom = new BorderCode(*_tcDef.brcBottom);
|
||||
_brcTop = std::shared_ptr<BorderCode>(new BorderCode(*_tcDef.brcTop));
|
||||
_brcLeft = std::shared_ptr<BorderCode>(new BorderCode(*_tcDef.brcLeft));
|
||||
_brcRight = std::shared_ptr<BorderCode>(new BorderCode(*_tcDef.brcRight));
|
||||
_brcBottom = std::shared_ptr<BorderCode>(new BorderCode(*_tcDef.brcBottom));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDxaCol:
|
||||
{
|
||||
}break;
|
||||
|
||||
case sprmTCellPadding:
|
||||
{
|
||||
unsigned char first = iter->Arguments[0];
|
||||
@ -237,10 +234,9 @@ namespace DocFileFormat
|
||||
apppendCellShading(iter->Arguments, iter->argumentsSize, _cellIndex);
|
||||
}
|
||||
}break;
|
||||
|
||||
case sprmOldTDefTableShd:
|
||||
case sprmTDefTableShd:
|
||||
{ // cell shading for cells 0-20
|
||||
{ // cell shading for cells 0-20
|
||||
apppendCellShading(iter->Arguments, iter->argumentsSize, _cellIndex);
|
||||
}break;
|
||||
|
||||
@ -248,14 +244,12 @@ namespace DocFileFormat
|
||||
{ // cell shading for cells 21-42
|
||||
apppendCellShading(iter->Arguments, iter->argumentsSize, (_cellIndex - 21));
|
||||
}break;
|
||||
|
||||
case sprmTDefTableShd3rd:
|
||||
{ // cell shading for cells 43-62
|
||||
apppendCellShading(iter->Arguments, iter->argumentsSize, (_cellIndex - 43));
|
||||
}break;
|
||||
|
||||
case sprmTCellWidth:
|
||||
{ //width
|
||||
{ //width
|
||||
unsigned char first = iter->Arguments[0];
|
||||
unsigned char lim = iter->Arguments[1];
|
||||
|
||||
@ -265,10 +259,9 @@ namespace DocFileFormat
|
||||
_width = FormatUtils::BytesToInt16(iter->Arguments, 3, iter->argumentsSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case sprmTVertAlign:
|
||||
{ //vertical alignment
|
||||
{ //vertical alignment
|
||||
unsigned char first = iter->Arguments[0];
|
||||
unsigned char lim = iter->Arguments[1];
|
||||
|
||||
@ -278,7 +271,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTFitText:
|
||||
{ //Autofit
|
||||
unsigned char first = iter->Arguments[0];
|
||||
@ -290,10 +282,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmOldTSetBrc:
|
||||
case sprmTSetBrc:
|
||||
{ //borders (cell definition)
|
||||
{ //borders (cell definition)
|
||||
unsigned char min = iter->Arguments[0];
|
||||
unsigned char max = iter->Arguments[1];
|
||||
|
||||
@ -307,35 +298,34 @@ namespace DocFileFormat
|
||||
|
||||
if( FormatUtils::BitmaskToBool( bordersToApply, 0x01 ) )
|
||||
{
|
||||
RELEASEOBJECT( _brcTop );
|
||||
_brcTop = new BorderCode( brcBytes, brcSize );
|
||||
_brcTop = std::shared_ptr<BorderCode>(new BorderCode( brcBytes, brcSize ));
|
||||
}
|
||||
|
||||
if( FormatUtils::BitmaskToBool( bordersToApply, 0x02 ) )
|
||||
{
|
||||
RELEASEOBJECT( _brcLeft );
|
||||
_brcLeft = new BorderCode( brcBytes, brcSize );
|
||||
_brcLeft = std::shared_ptr<BorderCode>(new BorderCode( brcBytes, brcSize ));
|
||||
}
|
||||
|
||||
if ( FormatUtils::BitmaskToBool( bordersToApply, 0x04 ) )
|
||||
{
|
||||
RELEASEOBJECT( _brcBottom );
|
||||
_brcBottom = new BorderCode( brcBytes, brcSize );
|
||||
_brcBottom = std::shared_ptr<BorderCode>(new BorderCode( brcBytes, brcSize ));
|
||||
}
|
||||
|
||||
if ( FormatUtils::BitmaskToBool( bordersToApply, 0x08 ) )
|
||||
{
|
||||
RELEASEOBJECT( _brcRight );
|
||||
_brcRight = new BorderCode( brcBytes, brcSize );
|
||||
_brcRight = std::shared_ptr<BorderCode>(new BorderCode( brcBytes, brcSize ));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_gridSpan <= 1 && nComputedCellWidth > _width && _width > 1)
|
||||
int nComputedCellWidthsGrid = 0;
|
||||
|
||||
for (size_t ccc = 0; ccc < _grid->size() && ccc <= _gridIndex; ccc++)
|
||||
{
|
||||
nComputedCellWidthsGrid += _grid->at(ccc);
|
||||
}//zadost.doc
|
||||
if (_gridSpan <= 1 && nComputedCellWidth > _width && _width > 1 && nComputedCellWidths > nComputedCellWidthsGrid)
|
||||
{
|
||||
int width_current = 0;
|
||||
for (int i = _gridIndex; i < _grid->size(); i++)
|
||||
@ -349,21 +339,15 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
XMLTools::XMLElement tcW ( L"w:tcW" );
|
||||
|
||||
|
||||
|
||||
XMLTools::XMLAttribute tcWVal ( L"w:w", FormatUtils::IntToWideString( _width > 1 ? _width : nComputedCellWidth) );
|
||||
XMLTools::XMLAttribute tcWType ( L"w:type", (_width > 1 || nComputedCellWidth > 0) ? FormatUtils::MapValueToWideString( _ftsWidth, &Global::CellWidthTypeMap[0][0], 4, 5 ) : L"auto");
|
||||
|
||||
tcW.AppendAttribute( tcWType );
|
||||
tcW.AppendAttribute( tcWVal );
|
||||
tcW.AppendAttribute( tcWType );
|
||||
_tcPr->AppendChild( tcW );
|
||||
|
||||
int nComputedCellWidthsGrid = 0;
|
||||
|
||||
for (size_t ccc = 0; ccc < _grid->size() && ccc <= _gridIndex; ccc++)
|
||||
{
|
||||
nComputedCellWidthsGrid += _grid->at(ccc);
|
||||
}
|
||||
if ( _gridSpan == 1 && ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidths > nComputedCellWidthsGrid ) )
|
||||
{
|
||||
//check the number of merged cells
|
||||
@ -394,28 +378,28 @@ namespace DocFileFormat
|
||||
if (_brcTop)
|
||||
{
|
||||
XMLTools::XMLElement topBorder( L"w:top" );
|
||||
appendBorderAttributes(_brcTop, &topBorder);
|
||||
appendBorderAttributes(_brcTop.get(), &topBorder);
|
||||
addOrSetBorder(_tcBorders, &topBorder );
|
||||
}
|
||||
|
||||
if (_brcLeft )
|
||||
{
|
||||
XMLTools::XMLElement leftBorder( L"w:left" );
|
||||
appendBorderAttributes(_brcLeft, &leftBorder);
|
||||
appendBorderAttributes(_brcLeft.get(), &leftBorder);
|
||||
addOrSetBorder(_tcBorders, &leftBorder);
|
||||
}
|
||||
|
||||
if (_brcBottom)
|
||||
{
|
||||
XMLTools::XMLElement bottomBorder( L"w:bottom" );
|
||||
appendBorderAttributes(_brcBottom, &bottomBorder);
|
||||
appendBorderAttributes(_brcBottom.get(), &bottomBorder);
|
||||
addOrSetBorder(_tcBorders, &bottomBorder);
|
||||
}
|
||||
|
||||
if (_brcRight)
|
||||
{
|
||||
XMLTools::XMLElement rightBorder( L"w:right" );
|
||||
appendBorderAttributes( _brcRight, &rightBorder );
|
||||
appendBorderAttributes( _brcRight.get(), &rightBorder );
|
||||
addOrSetBorder( _tcBorders, &rightBorder );
|
||||
}
|
||||
|
||||
|
||||
@ -87,15 +87,15 @@ namespace DocFileFormat
|
||||
const std::vector<short>* _grid;
|
||||
std::vector<short> _tGrid;
|
||||
|
||||
short _width;
|
||||
int _width;
|
||||
Global::CellWidthType _ftsWidth;
|
||||
TC80 _tcDef;
|
||||
unsigned int _depth;
|
||||
|
||||
BorderCode* _brcTop;
|
||||
BorderCode* _brcLeft;
|
||||
BorderCode* _brcRight;
|
||||
BorderCode* _brcBottom;
|
||||
std::shared_ptr<BorderCode> _brcLeft;
|
||||
std::shared_ptr<BorderCode> _brcTop;
|
||||
std::shared_ptr<BorderCode> _brcBottom;
|
||||
std::shared_ptr<BorderCode> _brcRight;
|
||||
|
||||
int _gridSpan;
|
||||
bool _bCoverCell;
|
||||
|
||||
@ -47,491 +47,390 @@ TablePropertiesMapping::~TablePropertiesMapping()
|
||||
RELEASEOBJECT (_tblPr);
|
||||
RELEASEOBJECT (_tblGrid);
|
||||
RELEASEOBJECT (_tblBorders);
|
||||
RELEASEOBJECT (brcLeft);
|
||||
RELEASEOBJECT (brcTop);
|
||||
RELEASEOBJECT (brcBottom);
|
||||
RELEASEOBJECT (brcRight);
|
||||
RELEASEOBJECT (brcHorz);
|
||||
RELEASEOBJECT (brcVert);
|
||||
}
|
||||
}
|
||||
namespace DocFileFormat
|
||||
|
||||
void TablePropertiesMapping::Apply(IVisitable* visited)
|
||||
{
|
||||
void TablePropertiesMapping::Apply(IVisitable* visited)
|
||||
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited);
|
||||
|
||||
XMLTools::XMLElement tblCellMar(L"w:tblCellMar");
|
||||
XMLTools::XMLElement tblLayout(L"w:tblLayout");
|
||||
XMLTools::XMLElement tblpPr(L"w:tblpPr");
|
||||
XMLTools::XMLAttribute layoutType(L"w:type", L"fixed");
|
||||
|
||||
_CP_OPT(short) tblIndent;
|
||||
short gabHalf = 0;
|
||||
short marginLeft = 0;
|
||||
short marginRight = 0;
|
||||
|
||||
short cellSpacing = 0;
|
||||
|
||||
BYTE itcFirst = 0;
|
||||
BYTE itcLim = 0;
|
||||
|
||||
bool bTableW = false;
|
||||
|
||||
for (std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++)
|
||||
{
|
||||
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>( visited );
|
||||
|
||||
XMLTools::XMLElement tblCellMar ( L"w:tblCellMar");
|
||||
XMLTools::XMLElement tblLayout ( L"w:tblLayout");
|
||||
XMLTools::XMLElement tblpPr ( L"w:tblpPr");
|
||||
XMLTools::XMLAttribute layoutType ( L"w:type", L"");
|
||||
|
||||
bool bLayoutFixed = true;
|
||||
//layoutType.SetValue(L"fixed");
|
||||
|
||||
_CP_OPT(short) tblIndent;
|
||||
short gabHalf = 0;
|
||||
short marginLeft = 0;
|
||||
short marginRight = 0;
|
||||
|
||||
BYTE itcFirst = 0;
|
||||
BYTE itcLim = 0;
|
||||
|
||||
bool bTableW = false;
|
||||
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ )
|
||||
switch (iter->OpCode)
|
||||
{
|
||||
switch( iter->OpCode )
|
||||
case sprmOldTDxaGapHalf:
|
||||
case sprmTDxaGapHalf:
|
||||
{
|
||||
gabHalf = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
}break;
|
||||
case sprmOldTDefTable:
|
||||
case sprmTDefTable:
|
||||
{
|
||||
//table definition
|
||||
SprmTDefTable tDef(iter->Arguments, iter->argumentsSize);
|
||||
//Workaround for retrieving the indent of the table:
|
||||
//In some files there is a indent but no sprmTWidthIndent is set.
|
||||
//For this cases we can calculate the indent of the table by getting the
|
||||
//first boundary of the TDef and adding the padding of the cells
|
||||
|
||||
tblIndent = gabHalf + FormatUtils::BytesToInt16(iter->Arguments, 1, iter->argumentsSize);
|
||||
//If there follows a real sprmTWidthIndent, this value will be overwritten
|
||||
|
||||
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
|
||||
}break;
|
||||
case sprmTTableWidth:
|
||||
{
|
||||
//preferred table width
|
||||
unsigned char fts = iter->Arguments[0];
|
||||
short width = FormatUtils::BytesToInt16(iter->Arguments, 1, iter->argumentsSize);
|
||||
|
||||
XMLTools::XMLElement tblW(L"w:tblW");
|
||||
|
||||
XMLTools::XMLAttribute w(L"w:w", FormatUtils::IntToWideString(width));
|
||||
XMLTools::XMLAttribute type(L"w:type", FormatUtils::MapValueToWideString(fts, &WidthType[0][0], 4, 5));
|
||||
|
||||
tblW.AppendAttribute(type);
|
||||
tblW.AppendAttribute(w);
|
||||
|
||||
_tblPr->AppendChild(tblW);
|
||||
|
||||
bTableW = true;
|
||||
}break;
|
||||
case sprmTMerge:
|
||||
{
|
||||
itcFirst = iter->Arguments[0];
|
||||
itcLim = iter->Arguments[1];
|
||||
}break;
|
||||
case sprmTSplit:
|
||||
{
|
||||
|
||||
}break;
|
||||
case sprmOldTJc:
|
||||
case sprmTJc:
|
||||
case sprmTJcRow:
|
||||
{
|
||||
appendValueElement(_tblPr, L"jc", FormatUtils::MapValueToWideString(iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15), true);
|
||||
}break;
|
||||
case sprmTWidthIndent:
|
||||
{
|
||||
tblIndent = FtsWWidth_Indent(iter->Arguments).wWidth;
|
||||
}break;
|
||||
case sprmTIstd:
|
||||
case sprmTIstdPermute:
|
||||
{
|
||||
if (_isTableStyleNeeded)
|
||||
{
|
||||
case sprmOldTDxaGapHalf:
|
||||
case sprmTDxaGapHalf:
|
||||
size_t ind = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
|
||||
|
||||
std::wstring id = ind < _styles->Styles->size() ? StyleSheetMapping::MakeStyleId(_styles->Styles->at(ind)) : L"";
|
||||
|
||||
if (id != std::wstring(L"TableNormal") && !id.empty())
|
||||
{
|
||||
gabHalf = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmOldTDefTable:
|
||||
case sprmTDefTable:
|
||||
{
|
||||
//table definition
|
||||
SprmTDefTable tDef( iter->Arguments, iter->argumentsSize );
|
||||
//Workaround for retrieving the indent of the table:
|
||||
//In some files there is a indent but no sprmTWidthIndent is set.
|
||||
//For this cases we can calculate the indent of the table by getting the
|
||||
//first boundary of the TDef and adding the padding of the cells
|
||||
|
||||
tblIndent = gabHalf + FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
//If there follows a real sprmTWidthIndent, this value will be overwritten
|
||||
|
||||
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTTableWidth:
|
||||
{
|
||||
//preferred table width
|
||||
unsigned char fts = iter->Arguments[0];
|
||||
short width = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
|
||||
XMLTools::XMLElement tblW( L"w:tblW");
|
||||
|
||||
XMLTools::XMLAttribute w( L"w:w", FormatUtils::IntToWideString( width ) );
|
||||
XMLTools::XMLAttribute type( L"w:type", FormatUtils::MapValueToWideString( fts, &WidthType[0][0], 4, 5 ) );
|
||||
|
||||
tblW.AppendAttribute( type );
|
||||
tblW.AppendAttribute( w );
|
||||
|
||||
_tblPr->AppendChild( tblW );
|
||||
|
||||
bTableW = true;
|
||||
}
|
||||
break;
|
||||
case sprmTMerge:
|
||||
{
|
||||
itcFirst = iter->Arguments[0];
|
||||
itcLim = iter->Arguments[1];
|
||||
}break;
|
||||
case sprmTSplit:
|
||||
{
|
||||
|
||||
}break;
|
||||
case sprmOldTJc:
|
||||
case sprmTJc:
|
||||
case sprmTJcRow:
|
||||
{ //justification
|
||||
|
||||
appendValueElement( _tblPr, L"jc" , FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ), true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTWidthIndent:
|
||||
{ //indent
|
||||
|
||||
tblIndent = FtsWWidth_Indent(iter->Arguments).wWidth;
|
||||
// tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTIstd:
|
||||
case sprmTIstdPermute:
|
||||
{ //style
|
||||
|
||||
if ( _isTableStyleNeeded )
|
||||
{
|
||||
size_t ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
std::wstring id = ind < _styles->Styles->size() ? StyleSheetMapping::MakeStyleId( _styles->Styles->at( ind ) ) : L"";
|
||||
|
||||
if( id != std::wstring( L"TableNormal") && !id.empty() )
|
||||
{
|
||||
appendValueElement( _tblPr, L"tblStyle", id, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTFBiDi:
|
||||
case sprmTFBiDi90:
|
||||
{ //bidi
|
||||
|
||||
appendValueElement( _tblPr, L"bidiVisual", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmOldTTlp:
|
||||
case sprmTTlp:
|
||||
{ //table look
|
||||
|
||||
appendValueElement( _tblPr, L"tblLook", FormatUtils::IntToFormattedWideString( FormatUtils::BytesToInt16( iter->Arguments, 2, iter->argumentsSize ), L"%04x" ), true );
|
||||
}
|
||||
break;
|
||||
case sprmTFAutofit:
|
||||
{//autofit
|
||||
|
||||
layoutType.SetValue(L"fixed");
|
||||
if ( iter->Arguments[0] == 1 )
|
||||
{
|
||||
layoutType.SetValue( L"auto" );
|
||||
bLayoutFixed = false;
|
||||
}
|
||||
}break;
|
||||
case sprmTCellPadding:
|
||||
case sprmTCellPaddingDefault:
|
||||
case sprmTCellPaddingOuter:
|
||||
{ //default cell padding (margin)
|
||||
|
||||
unsigned char grfbrc = iter->Arguments[2];
|
||||
short wMar = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize );
|
||||
std::wstring strValue = FormatUtils::IntToWideString( wMar );
|
||||
|
||||
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x01 ) )
|
||||
{
|
||||
appendDxaElement( &tblCellMar, L"top" , strValue, true );
|
||||
}
|
||||
|
||||
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x02 ) )
|
||||
{
|
||||
marginLeft = wMar;
|
||||
}
|
||||
|
||||
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x04 ) )
|
||||
{
|
||||
appendDxaElement( &tblCellMar, L"bottom", strValue, true );
|
||||
}
|
||||
|
||||
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x08 ) )
|
||||
{
|
||||
marginRight = wMar;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTCHorzBands:
|
||||
{ //row count
|
||||
|
||||
appendValueElement( _tblPr, L"tblStyleRowBandSize", iter->Arguments[0], true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTCVertBands:
|
||||
{ //col count
|
||||
|
||||
appendValueElement( _tblPr, L"tblStyleColBandSize", iter->Arguments[0], true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTFNoAllowOverlap:
|
||||
{ //overlap
|
||||
|
||||
std::wstring tblOverlapVal = std::wstring( L"overlap");
|
||||
|
||||
if ( iter->Arguments[0] )
|
||||
{
|
||||
tblOverlapVal = std::wstring( L"never");
|
||||
}
|
||||
|
||||
appendValueElement( _tblPr, L"tblOverlap", tblOverlapVal, true );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmOldTSetShd :
|
||||
case sprmTSetShdTable :
|
||||
{ //shading
|
||||
|
||||
appendShading( _tblPr, ShadingDescriptor( iter->Arguments, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTTableBorders80:
|
||||
{ //borders 80 exceptions
|
||||
|
||||
const int size = 4;
|
||||
unsigned char brc80[size];
|
||||
|
||||
//top border
|
||||
memcpy( brc80, iter->Arguments, size );
|
||||
RELEASEOBJECT( brcTop );
|
||||
brcTop = new BorderCode( brc80, size );
|
||||
|
||||
//left
|
||||
memcpy( brc80, ( iter->Arguments + 4 ), size );
|
||||
RELEASEOBJECT( brcLeft );
|
||||
brcLeft = new BorderCode( brc80, size );
|
||||
|
||||
//bottom
|
||||
memcpy( brc80, ( iter->Arguments + 8 ), size );
|
||||
RELEASEOBJECT( brcBottom );
|
||||
brcBottom = new BorderCode( brc80, size );
|
||||
|
||||
//right
|
||||
memcpy( brc80, ( iter->Arguments + 12 ), size );
|
||||
RELEASEOBJECT( brcRight );
|
||||
brcRight = new BorderCode( brc80, size );
|
||||
|
||||
//inside H
|
||||
memcpy( brc80, ( iter->Arguments + 16 ), size );
|
||||
RELEASEOBJECT( brcHorz );
|
||||
brcHorz = new BorderCode( brc80, size );
|
||||
|
||||
//inside V
|
||||
memcpy( brc80, ( iter->Arguments + 20 ), size );
|
||||
RELEASEOBJECT( brcVert );
|
||||
brcVert = new BorderCode( brc80, size );
|
||||
}
|
||||
break;
|
||||
|
||||
//border exceptions
|
||||
case sprmOldTTableBorders:
|
||||
case sprmTTableBorders:
|
||||
{
|
||||
const int size = 8;
|
||||
unsigned char brc[size];
|
||||
|
||||
//top border
|
||||
memcpy( brc, iter->Arguments, size );
|
||||
RELEASEOBJECT( brcTop );
|
||||
brcTop = new BorderCode( brc, size );
|
||||
|
||||
//left
|
||||
memcpy( brc, ( iter->Arguments + 8 ), size );
|
||||
RELEASEOBJECT( brcLeft );
|
||||
brcLeft = new BorderCode( brc, size );
|
||||
|
||||
//bottom
|
||||
memcpy( brc, ( iter->Arguments + 16 ), size );
|
||||
RELEASEOBJECT( brcBottom );
|
||||
brcBottom = new BorderCode( brc, size );
|
||||
|
||||
//right
|
||||
memcpy( brc, ( iter->Arguments + 24 ), size );
|
||||
RELEASEOBJECT( brcRight );
|
||||
brcRight = new BorderCode( brc, size );
|
||||
|
||||
//inside H
|
||||
memcpy( brc, ( iter->Arguments + 32 ), size );
|
||||
RELEASEOBJECT( brcHorz );
|
||||
brcHorz = new BorderCode( brc, size );
|
||||
|
||||
//inside V
|
||||
memcpy( brc, ( iter->Arguments + 40 ), size );
|
||||
RELEASEOBJECT( brcVert );
|
||||
brcVert = new BorderCode( brc, size );
|
||||
}
|
||||
break;
|
||||
|
||||
//floating table properties
|
||||
case sprmTPc:
|
||||
{
|
||||
unsigned char flag = ( iter->Arguments[0] & 0x30 ) >> 4;
|
||||
|
||||
appendValueAttribute( &tblpPr, L"w:vertAnchor", FormatUtils::MapValueToWideString( flag, &Global::VerticalPositionCode[0][0], 4, 7 ) );
|
||||
|
||||
flag = ( iter->Arguments[0] & 0xC0 ) >> 6;
|
||||
|
||||
appendValueAttribute( &tblpPr, L"w:horzAnchor", FormatUtils::MapValueToWideString( flag, &Global::HorizontalPositionCode[0][0], 4, 7 ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDxaFromText:
|
||||
{
|
||||
appendValueAttribute( &tblpPr, L"w:leftFromText", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDxaFromTextRight:
|
||||
{
|
||||
appendValueAttribute( &tblpPr, L"w:rightFromText", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDyaFromText:
|
||||
{
|
||||
appendValueAttribute( &tblpPr, L"w:topFromText", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDyaFromTextBottom:
|
||||
{
|
||||
appendValueAttribute( &tblpPr, L"w:bottomFromText", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDxaAbs:
|
||||
{
|
||||
appendValueAttribute( &tblpPr, L"w:tblpX", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDyaAbs:
|
||||
{
|
||||
appendValueAttribute( &tblpPr, L"w:tblpY", FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (false == bTableW)
|
||||
{
|
||||
XMLTools::XMLElement tblW( L"w:tblW");
|
||||
|
||||
XMLTools::XMLAttribute w( L"w:w", L"0");
|
||||
XMLTools::XMLAttribute type( L"w:type", L"auto" );
|
||||
|
||||
tblW.AppendAttribute( type );
|
||||
tblW.AppendAttribute( w );
|
||||
|
||||
_tblPr->AppendChild( tblW );
|
||||
}
|
||||
|
||||
//indent
|
||||
if ( tblIndent )
|
||||
{
|
||||
XMLTools::XMLElement tblInd( L"w:tblInd");
|
||||
|
||||
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( *tblIndent ) );
|
||||
tblInd.AppendAttribute( tblIndW );
|
||||
|
||||
XMLTools::XMLAttribute tblIndType( L"w:type", L"dxa");
|
||||
tblInd.AppendAttribute( tblIndType );
|
||||
|
||||
_tblPr->AppendChild( tblInd );
|
||||
}
|
||||
|
||||
//append floating props
|
||||
if ( tblpPr.GetAttributeCount() > 0 )
|
||||
{
|
||||
_tblPr->AppendChild( tblpPr );
|
||||
}
|
||||
|
||||
//set borders
|
||||
if ( brcTop != NULL )
|
||||
{
|
||||
XMLTools::XMLElement topBorder( L"w:top");
|
||||
appendBorderAttributes( brcTop, &topBorder );
|
||||
addOrSetBorder( _tblBorders, &topBorder );
|
||||
}
|
||||
|
||||
if ( brcLeft != NULL )
|
||||
{
|
||||
XMLTools::XMLElement leftBorder( L"w:left");
|
||||
appendBorderAttributes( brcLeft, &leftBorder );
|
||||
addOrSetBorder( _tblBorders, &leftBorder );
|
||||
}
|
||||
|
||||
if ( brcBottom != NULL )
|
||||
{
|
||||
XMLTools::XMLElement bottomBorder( L"w:bottom");
|
||||
appendBorderAttributes( brcBottom, &bottomBorder );
|
||||
addOrSetBorder( _tblBorders, &bottomBorder );
|
||||
}
|
||||
|
||||
if ( brcRight != NULL )
|
||||
{
|
||||
XMLTools::XMLElement rightBorder( L"w:right");
|
||||
appendBorderAttributes( brcRight, &rightBorder );
|
||||
addOrSetBorder( _tblBorders, &rightBorder );
|
||||
}
|
||||
|
||||
if ( brcHorz != NULL )
|
||||
{
|
||||
XMLTools::XMLElement insideHBorder( L"w:insideH");
|
||||
appendBorderAttributes( brcHorz, &insideHBorder );
|
||||
addOrSetBorder( _tblBorders, &insideHBorder );
|
||||
}
|
||||
|
||||
if ( brcVert != NULL )
|
||||
{
|
||||
XMLTools::XMLElement insideVBorder( L"w:insideV");
|
||||
appendBorderAttributes( brcVert, &insideVBorder );
|
||||
addOrSetBorder( _tblBorders, &insideVBorder );
|
||||
}
|
||||
|
||||
if ( _tblBorders->GetChildCount() > 0 )
|
||||
{
|
||||
_tblPr->AppendChild( *_tblBorders );
|
||||
}
|
||||
|
||||
if (false == layoutType.GetValue().empty())
|
||||
{
|
||||
tblLayout.AppendAttribute(layoutType);
|
||||
}
|
||||
_tblPr->AppendChild( tblLayout );
|
||||
|
||||
if ( ( marginLeft == 0 ) && ( gabHalf != 0 ) )
|
||||
{
|
||||
appendDxaElement( &tblCellMar, L"left", FormatUtils::IntToWideString( gabHalf ), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendDxaElement( &tblCellMar, L"left", FormatUtils::IntToWideString( marginLeft ), true );
|
||||
}
|
||||
|
||||
if ( ( marginRight == 0 ) && ( gabHalf != 0 ) )
|
||||
{
|
||||
appendDxaElement( &tblCellMar, L"right", FormatUtils::IntToWideString( gabHalf ), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendDxaElement( &tblCellMar, L"right", FormatUtils::IntToWideString( marginRight ), true );
|
||||
}
|
||||
|
||||
_tblPr->AppendChild( tblCellMar );
|
||||
|
||||
//write Properties
|
||||
if ( ( _tblPr->GetChildCount() > 0 ) || ( _tblPr->GetAttributeCount() > 0 ) )
|
||||
{
|
||||
m_pXmlWriter->WriteString( _tblPr->GetXMLString() );
|
||||
}
|
||||
|
||||
//append the grid
|
||||
_tblGrid = new XMLTools::XMLElement( L"w:tblGrid");
|
||||
|
||||
//Если _grid состоит из одних DocFormatUtils::gc_nZeroWidth и layout != "fixed", значит это doc полученный нами при конвертации из html. Таблицу размеров писать не нужно
|
||||
|
||||
bool bWriteGridCol = false;
|
||||
if (true == bLayoutFixed)
|
||||
bWriteGridCol = true;
|
||||
else
|
||||
{
|
||||
for ( size_t i = 0, nSize = _grid->size(); i < nSize; i++ )
|
||||
{
|
||||
if(_grid->at(i) % DocFileFormat::gc_nZeroWidth != 0)
|
||||
{
|
||||
bWriteGridCol = true;
|
||||
break;
|
||||
appendValueElement(_tblPr, L"tblStyle", id, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true == bWriteGridCol)
|
||||
}break;
|
||||
case sprmTFBiDi:
|
||||
case sprmTFBiDi90:
|
||||
{
|
||||
for ( size_t i = 0; i < _grid->size(); i++ )
|
||||
appendValueElement(_tblPr, L"bidiVisual", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize), true);
|
||||
}break;
|
||||
case sprmOldTTlp:
|
||||
case sprmTTlp:
|
||||
{
|
||||
appendValueElement(_tblPr, L"tblLook", FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt16(iter->Arguments, 2, iter->argumentsSize), L"%04x"), true);
|
||||
}break;
|
||||
case sprmTFAutofit:
|
||||
{
|
||||
if (iter->Arguments[0] == 1)
|
||||
{
|
||||
XMLTools::XMLElement gridCol( L"w:gridCol");
|
||||
XMLTools::XMLAttribute gridColW( L"w:w", FormatUtils::IntToWideString( _grid->at( i ) ) );
|
||||
gridCol.AppendAttribute( gridColW );
|
||||
_tblGrid->AppendChild( gridCol );
|
||||
layoutType.SetValue(L"auto");
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case sprmTCellSpacing:
|
||||
case sprmTCellSpacingDefault:
|
||||
{
|
||||
unsigned char grfbrc = iter->Arguments[2];
|
||||
short wSpc = FormatUtils::BytesToInt16(iter->Arguments, 4, iter->argumentsSize);
|
||||
std::wstring strValue = FormatUtils::IntToWideString(wSpc);
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x01))
|
||||
{
|
||||
appendDxaElement(_tblPr, L"tblCellSpacing", strValue, true);
|
||||
}
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x02))
|
||||
{
|
||||
cellSpacing = wSpc;
|
||||
}
|
||||
}break;
|
||||
case sprmTCellPadding:
|
||||
case sprmTCellPaddingDefault:
|
||||
case sprmTCellPaddingOuter:
|
||||
{//default cell padding (margin)
|
||||
unsigned char grfbrc = iter->Arguments[2];
|
||||
short wMar = FormatUtils::BytesToInt16(iter->Arguments, 4, iter->argumentsSize);
|
||||
std::wstring strValue = FormatUtils::IntToWideString(wMar);
|
||||
|
||||
m_pXmlWriter->WriteString( _tblGrid->GetXMLString() );
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x01))
|
||||
{
|
||||
appendDxaElement(&tblCellMar, L"top", strValue, true);
|
||||
}
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x02))
|
||||
{
|
||||
marginLeft = wMar;
|
||||
}
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x04))
|
||||
{
|
||||
appendDxaElement(&tblCellMar, L"bottom", strValue, true);
|
||||
}
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x08))
|
||||
{
|
||||
marginRight = wMar;
|
||||
}
|
||||
}break;
|
||||
case sprmTCHorzBands:
|
||||
{
|
||||
appendValueElement(_tblPr, L"tblStyleRowBandSize", iter->Arguments[0], true);
|
||||
}break;
|
||||
case sprmTCVertBands:
|
||||
{
|
||||
appendValueElement(_tblPr, L"tblStyleColBandSize", iter->Arguments[0], true);
|
||||
}break;
|
||||
case sprmTFNoAllowOverlap:
|
||||
{
|
||||
std::wstring tblOverlapVal(L"overlap");
|
||||
|
||||
if (iter->Arguments[0])
|
||||
{
|
||||
tblOverlapVal = L"never";
|
||||
}
|
||||
|
||||
appendValueElement(_tblPr, L"tblOverlap", tblOverlapVal, true);
|
||||
}break;
|
||||
case sprmOldTSetShd:
|
||||
case sprmTSetShdTable:
|
||||
{
|
||||
|
||||
appendShading(_tblPr, ShadingDescriptor(iter->Arguments, iter->argumentsSize));
|
||||
}break;
|
||||
case sprmTTableBorders80:
|
||||
{
|
||||
const int size = 4;
|
||||
unsigned char brc80[size];
|
||||
|
||||
memcpy(brc80, iter->Arguments, size);
|
||||
brcTop = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 4), size);
|
||||
brcLeft = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 8), size);
|
||||
brcBottom = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 12), size);
|
||||
brcRight = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 16), size);
|
||||
brcHorz = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 20), size);
|
||||
brcVert = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
}break;
|
||||
case sprmOldTTableBorders:
|
||||
case sprmTTableBorders:
|
||||
{
|
||||
const int size = 8;
|
||||
unsigned char brc[size];
|
||||
|
||||
memcpy(brc, iter->Arguments, size);
|
||||
brcTop = std::shared_ptr<BorderCode>(new BorderCode(brc, size));
|
||||
|
||||
memcpy(brc, (iter->Arguments + 8), size);
|
||||
brcLeft = std::shared_ptr<BorderCode>(new BorderCode(brc, size));
|
||||
|
||||
memcpy(brc, (iter->Arguments + 16), size);
|
||||
brcBottom = std::shared_ptr<BorderCode>(new BorderCode(brc, size));
|
||||
|
||||
memcpy(brc, (iter->Arguments + 24), size);
|
||||
brcRight = std::shared_ptr<BorderCode>(new BorderCode(brc, size));
|
||||
|
||||
memcpy(brc, (iter->Arguments + 32), size);
|
||||
brcHorz = std::shared_ptr<BorderCode>(new BorderCode(brc, size));
|
||||
|
||||
memcpy(brc, (iter->Arguments + 40), size);
|
||||
brcVert = std::shared_ptr<BorderCode>(new BorderCode(brc, size));
|
||||
}break;
|
||||
case sprmTPc:
|
||||
{
|
||||
unsigned char flag = (iter->Arguments[0] & 0x30) >> 4;
|
||||
|
||||
appendValueAttribute(&tblpPr, L"w:vertAnchor", FormatUtils::MapValueToWideString(flag, &Global::VerticalPositionCode[0][0], 4, 7));
|
||||
|
||||
flag = (iter->Arguments[0] & 0xC0) >> 6;
|
||||
|
||||
appendValueAttribute(&tblpPr, L"w:horzAnchor", FormatUtils::MapValueToWideString(flag, &Global::HorizontalPositionCode[0][0], 4, 7));
|
||||
}break;
|
||||
case sprmTDxaFromText:
|
||||
{
|
||||
appendValueAttribute(&tblpPr, L"w:leftFromText", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
}break;
|
||||
case sprmTDxaFromTextRight:
|
||||
{
|
||||
appendValueAttribute(&tblpPr, L"w:rightFromText", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
}break;
|
||||
case sprmTDyaFromText:
|
||||
{
|
||||
appendValueAttribute(&tblpPr, L"w:topFromText", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
}break;
|
||||
case sprmTDyaFromTextBottom:
|
||||
{
|
||||
appendValueAttribute(&tblpPr, L"w:bottomFromText", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
}break;
|
||||
case sprmTDxaAbs:
|
||||
{
|
||||
appendValueAttribute(&tblpPr, L"w:tblpX", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
}break;
|
||||
case sprmTDyaAbs:
|
||||
{
|
||||
appendValueAttribute(&tblpPr, L"w:tblpY", FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if (false == bTableW)
|
||||
{
|
||||
XMLTools::XMLElement tblW(L"w:tblW");
|
||||
|
||||
XMLTools::XMLAttribute w(L"w:w", L"0");
|
||||
XMLTools::XMLAttribute type(L"w:type", L"auto");
|
||||
|
||||
tblW.AppendAttribute(type);
|
||||
tblW.AppendAttribute(w);
|
||||
|
||||
_tblPr->AppendChild(tblW);
|
||||
}
|
||||
|
||||
if (tblIndent)
|
||||
{
|
||||
XMLTools::XMLElement tblInd(L"w:tblInd");
|
||||
|
||||
XMLTools::XMLAttribute tblIndW(L"w:w", FormatUtils::IntToWideString(*tblIndent));
|
||||
tblInd.AppendAttribute(tblIndW);
|
||||
|
||||
XMLTools::XMLAttribute tblIndType(L"w:type", L"dxa");
|
||||
tblInd.AppendAttribute(tblIndType);
|
||||
|
||||
_tblPr->AppendChild(tblInd);
|
||||
}
|
||||
|
||||
if (tblpPr.GetAttributeCount() > 0)
|
||||
{
|
||||
_tblPr->AppendChild(tblpPr);
|
||||
}
|
||||
|
||||
if (brcTop)
|
||||
{
|
||||
XMLTools::XMLElement topBorder(L"w:top");
|
||||
appendBorderAttributes(brcTop.get(), &topBorder);
|
||||
addOrSetBorder(_tblBorders, &topBorder);
|
||||
}
|
||||
|
||||
if (brcLeft)
|
||||
{
|
||||
XMLTools::XMLElement leftBorder(L"w:left");
|
||||
appendBorderAttributes(brcLeft.get(), &leftBorder);
|
||||
addOrSetBorder(_tblBorders, &leftBorder);
|
||||
}
|
||||
|
||||
if (brcBottom)
|
||||
{
|
||||
XMLTools::XMLElement bottomBorder(L"w:bottom");
|
||||
appendBorderAttributes(brcBottom.get(), &bottomBorder);
|
||||
addOrSetBorder(_tblBorders, &bottomBorder);
|
||||
}
|
||||
|
||||
if (brcRight)
|
||||
{
|
||||
XMLTools::XMLElement rightBorder(L"w:right");
|
||||
appendBorderAttributes(brcRight.get(), &rightBorder);
|
||||
addOrSetBorder(_tblBorders, &rightBorder);
|
||||
}
|
||||
|
||||
if (brcHorz)
|
||||
{
|
||||
XMLTools::XMLElement insideHBorder(L"w:insideH");
|
||||
appendBorderAttributes(brcHorz.get(), &insideHBorder);
|
||||
addOrSetBorder(_tblBorders, &insideHBorder);
|
||||
}
|
||||
|
||||
if (brcVert)
|
||||
{
|
||||
XMLTools::XMLElement insideVBorder(L"w:insideV");
|
||||
appendBorderAttributes(brcVert.get(), &insideVBorder);
|
||||
addOrSetBorder(_tblBorders, &insideVBorder);
|
||||
}
|
||||
|
||||
if (_tblBorders->GetChildCount() > 0)
|
||||
{
|
||||
_tblPr->AppendChild(*_tblBorders);
|
||||
}
|
||||
|
||||
if (false == layoutType.GetValue().empty())
|
||||
{
|
||||
tblLayout.AppendAttribute(layoutType);
|
||||
}
|
||||
_tblPr->AppendChild(tblLayout);
|
||||
|
||||
if ((marginLeft == 0) && (gabHalf != 0))
|
||||
{
|
||||
appendDxaElement(&tblCellMar, L"left", FormatUtils::IntToWideString(gabHalf), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
appendDxaElement(&tblCellMar, L"left", FormatUtils::IntToWideString(marginLeft), true);
|
||||
}
|
||||
|
||||
if ((marginRight == 0) && (gabHalf != 0))
|
||||
{
|
||||
appendDxaElement(&tblCellMar, L"right", FormatUtils::IntToWideString(gabHalf), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
appendDxaElement(&tblCellMar, L"right", FormatUtils::IntToWideString(marginRight), true);
|
||||
}
|
||||
|
||||
_tblPr->AppendChild(tblCellMar);
|
||||
|
||||
if ((_tblPr->GetChildCount() > 0) || (_tblPr->GetAttributeCount() > 0))
|
||||
{
|
||||
m_pXmlWriter->WriteString(_tblPr->GetXMLString());
|
||||
}
|
||||
|
||||
//append the grid
|
||||
_tblGrid = new XMLTools::XMLElement(L"w:tblGrid");
|
||||
|
||||
for (size_t i = 0; i < _grid->size(); i++)
|
||||
{
|
||||
XMLTools::XMLElement gridCol(L"w:gridCol");
|
||||
XMLTools::XMLAttribute gridColW(L"w:w", FormatUtils::IntToWideString(_grid->at(i)));
|
||||
gridCol.AppendAttribute(gridColW);
|
||||
_tblGrid->AppendChild(gridCol);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteString(_tblGrid->GetXMLString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,12 +84,12 @@ namespace DocFileFormat
|
||||
StyleSheet* _styles;
|
||||
std::vector<short>* _grid;
|
||||
|
||||
BorderCode* brcLeft;
|
||||
BorderCode* brcTop;
|
||||
BorderCode* brcBottom;
|
||||
BorderCode* brcRight;
|
||||
BorderCode* brcHorz;
|
||||
BorderCode* brcVert;
|
||||
std::shared_ptr<BorderCode> brcLeft;
|
||||
std::shared_ptr<BorderCode> brcTop;
|
||||
std::shared_ptr<BorderCode> brcBottom;
|
||||
std::shared_ptr<BorderCode> brcRight;
|
||||
std::shared_ptr<BorderCode> brcHorz;
|
||||
std::shared_ptr<BorderCode> brcVert;
|
||||
|
||||
bool _isTableStyleNeeded;
|
||||
};
|
||||
|
||||
@ -53,6 +53,13 @@ namespace DocFileFormat
|
||||
{
|
||||
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>( visited );
|
||||
|
||||
std::shared_ptr<BorderCode> brcLeft;
|
||||
std::shared_ptr<BorderCode> brcTop;
|
||||
std::shared_ptr<BorderCode> brcBottom;
|
||||
std::shared_ptr<BorderCode> brcRight;
|
||||
std::shared_ptr<BorderCode> brcHorz;
|
||||
std::shared_ptr<BorderCode> brcVert;
|
||||
|
||||
//delete infos
|
||||
RevisionData rev( _rowEndChpx );
|
||||
|
||||
@ -84,7 +91,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}break;
|
||||
case sprmTWidthAfter:
|
||||
{ //width after
|
||||
{ //width after
|
||||
XMLTools::XMLElement wAfter( L"w:wAfter" );
|
||||
XMLTools::XMLAttribute wAfterValue( L"w:w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ) ) );
|
||||
wAfter.AppendAttribute( wAfterValue );
|
||||
@ -94,7 +101,7 @@ namespace DocFileFormat
|
||||
_trPr->AppendChild( wAfter, true );
|
||||
}break;
|
||||
case sprmTWidthBefore:
|
||||
{ //width before
|
||||
{ //width before
|
||||
short before = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
|
||||
if ( before != 0 )
|
||||
@ -110,7 +117,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case sprmOldTDyaRowHeight:
|
||||
case sprmTDyaRowHeight:
|
||||
{ //row height
|
||||
{ //row height
|
||||
XMLTools::XMLElement rowHeight( L"w:trHeight" );
|
||||
XMLTools::XMLAttribute rowHeightVal( L"w:val" );
|
||||
XMLTools::XMLAttribute rowHeightRule( L"w:hRule" );
|
||||
@ -142,113 +149,98 @@ namespace DocFileFormat
|
||||
case sprmOldTFCantSplit:
|
||||
case sprmTFCantSplit:
|
||||
case sprmTFCantSplit90:
|
||||
{ //can't split
|
||||
{ //can't split
|
||||
appendFlagElement( _trPr, *iter, L"cantSplit", true );
|
||||
}break;
|
||||
|
||||
//div id
|
||||
}break;
|
||||
case sprmTIpgp:// = PGPInfo.ipgpSelf (PGPInfo structure describes the border and margin properties)
|
||||
{ //div id
|
||||
}break;
|
||||
case sprmTCellSpacing:
|
||||
case sprmTCellSpacingDefault:
|
||||
{
|
||||
unsigned char grfbrc = iter->Arguments[2];
|
||||
short wSpc = FormatUtils::BytesToInt16(iter->Arguments, 4, iter->argumentsSize);
|
||||
std::wstring strValue = FormatUtils::IntToWideString(wSpc);
|
||||
if (FormatUtils::BitmaskToBool((int)grfbrc, 0x01))
|
||||
{
|
||||
appendDxaElement(_trPr, L"tblCellSpacing", strValue, true);
|
||||
}
|
||||
}break;
|
||||
case sprmTTableBorders80:
|
||||
{
|
||||
const int size = 4;
|
||||
unsigned char brc80[size];
|
||||
|
||||
memcpy(brc80, iter->Arguments, size);
|
||||
brcTop = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 4), size);
|
||||
brcLeft = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 8), size);
|
||||
brcBottom = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 12), size);
|
||||
brcRight = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 16), size);
|
||||
brcHorz = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
|
||||
memcpy(brc80, (iter->Arguments + 20), size);
|
||||
brcVert = std::shared_ptr<BorderCode>(new BorderCode(brc80, size));
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
//borders 80 exceptions
|
||||
//case SinglePropertyModifier.OperationCode.sprmTTableBorders80:
|
||||
// unsigned char[] brc80 = new unsigned char[4];
|
||||
// //top border
|
||||
// Array.Copy(sprm.Arguments, 0, brc80, 0, 4);
|
||||
// brcTop = new BorderCode(brc80);
|
||||
// //left
|
||||
// Array.Copy(sprm.Arguments, 4, brc80, 0, 4);
|
||||
// brcLeft = new BorderCode(brc80);
|
||||
// //bottom
|
||||
// Array.Copy(sprm.Arguments, 8, brc80, 0, 4);
|
||||
// brcBottom = new BorderCode(brc80);
|
||||
// //right
|
||||
// Array.Copy(sprm.Arguments, 12, brc80, 0, 4);
|
||||
// brcRight = new BorderCode(brc80);
|
||||
// //inside H
|
||||
// Array.Copy(sprm.Arguments, 16, brc80, 0, 4);
|
||||
// brcHorz = new BorderCode(brc80);
|
||||
// //inside V
|
||||
// Array.Copy(sprm.Arguments, 20, brc80, 0, 4);
|
||||
// brcVert = new BorderCode(brc80);
|
||||
// break;
|
||||
|
||||
//border exceptions
|
||||
//case SinglePropertyModifier.OperationCode.sprmTTableBorders:
|
||||
// unsigned char[] brc = new unsigned char[8];
|
||||
// //top border
|
||||
// Array.Copy(sprm.Arguments, 0, brc, 0, 8);
|
||||
// brcTop = new BorderCode(brc);
|
||||
// //left
|
||||
// Array.Copy(sprm.Arguments, 8, brc, 0, 8);
|
||||
// brcLeft = new BorderCode(brc);
|
||||
// //bottom
|
||||
// Array.Copy(sprm.Arguments, 16, brc, 0, 8);
|
||||
// brcBottom = new BorderCode(brc);
|
||||
// //right
|
||||
// Array.Copy(sprm.Arguments, 24, brc, 0, 8);
|
||||
// brcRight = new BorderCode(brc);
|
||||
// //inside H
|
||||
// Array.Copy(sprm.Arguments, 32, brc, 0, 8);
|
||||
// brcHorz = new BorderCode(brc);
|
||||
// //inside V
|
||||
// Array.Copy(sprm.Arguments, 40, brc, 0, 8);
|
||||
// brcVert = new BorderCode(brc);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
//set borders
|
||||
//if (brcTop != null)
|
||||
//{
|
||||
// XmlNode topBorder = _nodeFactory.CreateNode(XmlNodeType.Element, "w", "top", OpenXmlNamespaces.WordprocessingML);
|
||||
// appendBorderAttributes(brcTop, topBorder);
|
||||
// addOrSetBorder(_tblBorders, topBorder);
|
||||
//}
|
||||
//if (brcLeft != null)
|
||||
//{
|
||||
// XmlNode leftBorder = _nodeFactory.CreateNode(XmlNodeType.Element, "w", "left", OpenXmlNamespaces.WordprocessingML);
|
||||
// appendBorderAttributes(brcLeft, leftBorder);
|
||||
// addOrSetBorder(_tblBorders, leftBorder);
|
||||
//}
|
||||
//if (brcBottom != null)
|
||||
//{
|
||||
// XmlNode bottomBorder = _nodeFactory.CreateNode(XmlNodeType.Element, "w", "bottom", OpenXmlNamespaces.WordprocessingML);
|
||||
// appendBorderAttributes(brcBottom, bottomBorder);
|
||||
// addOrSetBorder(_tblBorders, bottomBorder);
|
||||
//}
|
||||
//if (brcRight != null)
|
||||
//{
|
||||
// XmlNode rightBorder = _nodeFactory.CreateNode(XmlNodeType.Element, "w", "right", OpenXmlNamespaces.WordprocessingML);
|
||||
// appendBorderAttributes(brcRight, rightBorder);
|
||||
// addOrSetBorder(_tblBorders, rightBorder);
|
||||
//}
|
||||
//if (brcHorz != null)
|
||||
//{
|
||||
// XmlNode insideHBorder = _nodeFactory.CreateNode(XmlNodeType.Element, "w", "insideH", OpenXmlNamespaces.WordprocessingML);
|
||||
// appendBorderAttributes(brcHorz, insideHBorder);
|
||||
// addOrSetBorder(_tblBorders, insideHBorder);
|
||||
//}
|
||||
//if (brcVert != null)
|
||||
//{
|
||||
// XmlNode insideVBorder = _nodeFactory.CreateNode(XmlNodeType.Element, "w", "insideV", OpenXmlNamespaces.WordprocessingML);
|
||||
// appendBorderAttributes(brcVert, insideVBorder);
|
||||
// addOrSetBorder(_tblBorders, insideVBorder);
|
||||
//}
|
||||
//if (_tblBorders.ChildNodes.Count > 0)
|
||||
//{
|
||||
// _tblPrEx.AppendChild(_tblBorders);
|
||||
//}
|
||||
|
||||
//set exceptions
|
||||
XMLTools::XMLElement* _tblBorders = new XMLTools::XMLElement(L"w:tblBorders");
|
||||
if (brcTop)
|
||||
{
|
||||
XMLTools::XMLElement border(L"w:top");
|
||||
appendBorderAttributes(brcTop.get(), &border);
|
||||
addOrSetBorder(_tblBorders, &border);
|
||||
}
|
||||
if (brcLeft)
|
||||
{
|
||||
XMLTools::XMLElement border(L"w:left");
|
||||
appendBorderAttributes(brcLeft.get(), &border);
|
||||
addOrSetBorder(_tblBorders, &border);
|
||||
}
|
||||
if (brcBottom)
|
||||
{
|
||||
XMLTools::XMLElement border(L"w:left");
|
||||
appendBorderAttributes(brcBottom.get(), &border);
|
||||
addOrSetBorder(_tblBorders, &border);
|
||||
}
|
||||
if (brcRight)
|
||||
{
|
||||
XMLTools::XMLElement border(L"w:right");
|
||||
appendBorderAttributes(brcRight.get(), &border);
|
||||
addOrSetBorder(_tblBorders, &border);
|
||||
}
|
||||
if (brcHorz)
|
||||
{
|
||||
XMLTools::XMLElement border(L"w:insideH");
|
||||
appendBorderAttributes(brcHorz.get(), &border);
|
||||
addOrSetBorder(_tblBorders, &border);
|
||||
}
|
||||
if (brcVert)
|
||||
{
|
||||
XMLTools::XMLElement border(L"w:insideV");
|
||||
appendBorderAttributes(brcHorz.get(), &border);
|
||||
addOrSetBorder(_tblBorders, &border);
|
||||
}
|
||||
if (_tblBorders->GetChildCount() > 0)
|
||||
{
|
||||
_tblPrEx->AppendChild(*_tblBorders);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
if ( _tblPrEx->GetChildCount() > 0 )
|
||||
{
|
||||
_trPr->AppendChild( *(_tblPrEx) );
|
||||
m_pXmlWriter->WriteString(_tblPrEx->GetXMLString());
|
||||
}
|
||||
|
||||
//write Properties
|
||||
if ( ( _trPr->GetChildCount() > 0 ) || ( _trPr->GetAttributeCount() > 0 ) )
|
||||
{
|
||||
m_pXmlWriter->WriteString( _trPr->GetXMLString() );
|
||||
|
||||
@ -39,16 +39,16 @@ namespace DocFileFormat
|
||||
class Tbkd : public ByteStructure
|
||||
{
|
||||
public:
|
||||
friend class TextboxMapping;
|
||||
|
||||
static const int STRUCTURE_SIZE = 6;
|
||||
|
||||
Tbkd() : ipgd(0), itxbxs(0), dcpDepend(0), icol(0), fTableBreak(false), fColumnBreak(false), fMarked(false), fUnk(false), fTextOverflow(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual ~Tbkd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual ByteStructure* ConstructObject (VirtualStreamReader* reader, int length)
|
||||
@ -72,7 +72,7 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
bool bUsed = false;
|
||||
/// Except in textbox BKD, index to PGD in plfpgd that describes the page this break is on
|
||||
short ipgd;
|
||||
/// In textbox BKD
|
||||
|
||||
@ -83,102 +83,102 @@ namespace DocFileFormat
|
||||
{
|
||||
m_document = static_cast<WordDocument*>(visited);
|
||||
|
||||
if (m_document)
|
||||
if (!m_document) return;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"v:textbox", true);
|
||||
if (m_dxTextLeft >= 0 && m_dyTextTop >= 0 && m_dxTextRight >= 0 && m_dyTextBottom >= 0)
|
||||
{
|
||||
//if (m_nTBIndex < m_document->TextboxBreakPlex->Elements.size())
|
||||
// return;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"v:textbox", true);
|
||||
if(m_dxTextLeft >= 0 && m_dyTextTop >= 0 && m_dxTextRight >= 0 && m_dyTextBottom >= 0)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"inset" , FormatUtils::DoubleToWideString(m_dxTextLeft) + L"pt," +
|
||||
FormatUtils::DoubleToWideString(m_dyTextTop) + L"pt," +
|
||||
FormatUtils::DoubleToWideString(m_dxTextRight) + L"pt," +
|
||||
FormatUtils::DoubleToWideString(m_dyTextBottom) + L"pt");
|
||||
}
|
||||
if (!m_sTextBoxStyle.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"style", m_sTextBoxStyle);
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true, false );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:txbxContent" );
|
||||
|
||||
int cp = 0;
|
||||
int cpEnd = 0;
|
||||
Tbkd* bkd = NULL;
|
||||
|
||||
int txtbxSubdocStart =
|
||||
m_document->FIB->m_RgLw97.ccpText +
|
||||
m_document->FIB->m_RgLw97.ccpFtn +
|
||||
m_document->FIB->m_RgLw97.ccpHdr +
|
||||
m_document->FIB->m_RgLw97.ccpAtn +
|
||||
m_document->FIB->m_RgLw97.ccpEdn ;
|
||||
|
||||
if (typeid(*_caller) == typeid(MainDocumentMapping))
|
||||
{
|
||||
if (m_nTBIndex < m_document->TextboxBreakPlex->Elements.size() )//file(21).doc
|
||||
{
|
||||
bkd = static_cast<Tbkd*>(m_document->TextboxBreakPlex->Elements[m_nTBIndex]);
|
||||
}
|
||||
|
||||
if (m_nTBIndex + 1 < m_document->TextboxBreakPlex->CharacterPositions.size())
|
||||
{
|
||||
cp = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex];
|
||||
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex + 1];
|
||||
}
|
||||
else if (m_nTBIndex + 1 < m_document->TextboxIndividualPlex->CharacterPositions.size())
|
||||
{
|
||||
//todooo сделать чище
|
||||
cp = m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex] + 2;
|
||||
cpEnd = m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex + 1];
|
||||
}
|
||||
}
|
||||
else if ((typeid(*_caller) == typeid(HeaderMapping)) || (typeid(*_caller) == typeid(FooterMapping)))
|
||||
{
|
||||
txtbxSubdocStart += m_document->FIB->m_RgLw97.ccpTxbx;
|
||||
|
||||
bkd = static_cast<Tbkd*>(m_document->TextboxBreakPlexHeader->Elements[m_nTBIndex]);
|
||||
|
||||
cp = txtbxSubdocStart + m_document->TextboxBreakPlexHeader->CharacterPositions[m_nTBIndex];
|
||||
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlexHeader->CharacterPositions[m_nTBIndex + 1];
|
||||
}
|
||||
|
||||
_isTextBoxContent = true;
|
||||
|
||||
//convert the textbox text
|
||||
_lastValidPapx = (*(m_document->AllPapxFkps->begin()))->grppapx[0];
|
||||
|
||||
ParagraphPropertyExceptions* papx_prev = NULL;
|
||||
while (cp < cpEnd)
|
||||
{
|
||||
int fc = m_document->FindFileCharPos(cp);
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx( fc );
|
||||
if (papx_prev && papx_prev == papx)//file(21).doc
|
||||
break;
|
||||
papx_prev = papx;
|
||||
|
||||
TableInfo tai( papx, m_document->nWordVersion );
|
||||
|
||||
if ( tai.fInTable )
|
||||
{
|
||||
//this PAPX is for a table
|
||||
Table table( this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ) );
|
||||
table.Convert( this );
|
||||
cp = table.GetCPEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph( cp, 0x7fffffff );
|
||||
}
|
||||
}
|
||||
_isTextBoxContent = false;
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:txbxContent" );
|
||||
m_pXmlWriter->WriteNodeEnd( L"v:textbox" );
|
||||
m_pXmlWriter->WriteAttribute(L"inset", FormatUtils::DoubleToWideString(m_dxTextLeft) + L"pt," +
|
||||
FormatUtils::DoubleToWideString(m_dyTextTop) + L"pt," +
|
||||
FormatUtils::DoubleToWideString(m_dxTextRight) + L"pt," +
|
||||
FormatUtils::DoubleToWideString(m_dyTextBottom) + L"pt");
|
||||
}
|
||||
if (!m_sTextBoxStyle.empty())
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute(L"style", m_sTextBoxStyle);
|
||||
}
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true, false);
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:txbxContent");
|
||||
|
||||
int cpStart = 0;
|
||||
int cpEnd = 0;
|
||||
Tbkd* bkd = NULL;
|
||||
|
||||
int txtbxSubdocStart =
|
||||
m_document->FIB->m_RgLw97.ccpText +
|
||||
m_document->FIB->m_RgLw97.ccpFtn +
|
||||
m_document->FIB->m_RgLw97.ccpHdr +
|
||||
m_document->FIB->m_RgLw97.ccpAtn +
|
||||
m_document->FIB->m_RgLw97.ccpEdn;
|
||||
|
||||
if (typeid(*_caller) == typeid(MainDocumentMapping))
|
||||
{
|
||||
if (m_nTBIndex < m_document->TextboxBreakPlex->Elements.size())//file(21).doc
|
||||
{
|
||||
bkd = static_cast<Tbkd*>(m_document->TextboxBreakPlex->Elements[m_nTBIndex]);
|
||||
}
|
||||
|
||||
if (m_nTBIndex + 1 < m_document->TextboxIndividualPlex->CharacterPositions.size())
|
||||
{//Jukivka.doc
|
||||
cpStart = txtbxSubdocStart + m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex];
|
||||
cpEnd = txtbxSubdocStart + m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex + 1];
|
||||
}
|
||||
else if (m_nTBIndex + 1 < m_document->TextboxBreakPlex->CharacterPositions.size())
|
||||
{
|
||||
cpStart = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex];
|
||||
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex + 1];
|
||||
}
|
||||
|
||||
}
|
||||
else if ((typeid(*_caller) == typeid(HeaderMapping)) || (typeid(*_caller) == typeid(FooterMapping)))
|
||||
{
|
||||
txtbxSubdocStart += m_document->FIB->m_RgLw97.ccpTxbx;
|
||||
|
||||
bkd = static_cast<Tbkd*>(m_document->TextboxBreakPlexHeader->Elements[m_nTBIndex]);
|
||||
|
||||
cpStart = txtbxSubdocStart + m_document->TextboxBreakPlexHeader->CharacterPositions[m_nTBIndex];
|
||||
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlexHeader->CharacterPositions[m_nTBIndex + 1];
|
||||
}
|
||||
bool bUsed = bkd ? bkd->bUsed : false;
|
||||
_isTextBoxContent = true;
|
||||
|
||||
//convert the textbox text
|
||||
_lastValidPapx = (*(m_document->AllPapxFkps->begin()))->grppapx[0];
|
||||
|
||||
ParagraphPropertyExceptions* papx_prev = NULL;
|
||||
int cp = cpStart;
|
||||
while (cp < cpEnd && cp >= cpStart && !bUsed)
|
||||
{
|
||||
int fc = m_document->FindFileCharPos(cp);
|
||||
if (fc < 0) break;
|
||||
|
||||
ParagraphPropertyExceptions* papx = findValidPapx(fc);
|
||||
if (papx_prev && papx_prev == papx)//file(21).doc
|
||||
break;
|
||||
papx_prev = papx;
|
||||
|
||||
TableInfo tai(papx, m_document->nWordVersion);
|
||||
|
||||
if (tai.fInTable)
|
||||
{
|
||||
//this PAPX is for a table
|
||||
Table table(this, cp, ((tai.iTap > 0) ? (1) : (0)));
|
||||
table.Convert(this);
|
||||
cp = table.GetCPEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
//this PAPX is for a normal paragraph
|
||||
cp = writeParagraph(cp, 0x7fffffff);
|
||||
}
|
||||
}
|
||||
_isTextBoxContent = false;
|
||||
|
||||
if (bkd)
|
||||
bkd->bUsed = true;
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd(L"w:txbxContent");
|
||||
m_pXmlWriter->WriteNodeEnd(L"v:textbox");
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,6 @@ namespace DocFileFormat
|
||||
class TextboxMapping : public DocumentMapping
|
||||
{
|
||||
public:
|
||||
|
||||
TextboxMapping(ConversionContext* ctx, int textboxIndex, XMLTools::CStringXmlWriter* writer, IMapping* caller);
|
||||
TextboxMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, IMapping* caller);
|
||||
|
||||
|
||||
@ -228,7 +228,7 @@ namespace DocFileFormat
|
||||
style +=( L";" );
|
||||
}
|
||||
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture, bool inGroup) : PropertiesMapping(writer)
|
||||
{
|
||||
m_context = ctx;
|
||||
m_isOlePreview = olePreview;
|
||||
@ -236,6 +236,7 @@ namespace DocFileFormat
|
||||
m_nImageId = 0;
|
||||
m_caller = caller;
|
||||
m_isInlinePicture = isInlinePicture;
|
||||
m_inGroup = inGroup;
|
||||
|
||||
m_isBullete = false;
|
||||
m_isEquation = false;
|
||||
@ -318,7 +319,7 @@ namespace DocFileFormat
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
{
|
||||
ODRAW::OfficeArtFOPTEPtr & iter = options[i];
|
||||
switch ( iter->opid )
|
||||
switch (iter->opid)
|
||||
{
|
||||
case wzEquationXML:
|
||||
{
|
||||
@ -327,10 +328,10 @@ namespace DocFileFormat
|
||||
{
|
||||
m_isEquation = true;
|
||||
m_isEmbedded = true;
|
||||
|
||||
|
||||
m_embeddedData = pXml->data;
|
||||
|
||||
if (ParseEmbeddedEquation( m_embeddedData, m_equationXml))
|
||||
if (ParseEmbeddedEquation(m_embeddedData, m_equationXml))
|
||||
{
|
||||
m_isEmbedded = false;
|
||||
}
|
||||
@ -340,74 +341,74 @@ namespace DocFileFormat
|
||||
{//встроенная неведомая хуйня
|
||||
ODRAW::MetroBlob* blob = dynamic_cast<ODRAW::MetroBlob*>(iter.get());
|
||||
if (blob)
|
||||
{
|
||||
m_isBlob = true;
|
||||
m_isEmbedded = true;
|
||||
{
|
||||
m_isBlob = true;
|
||||
m_isEmbedded = true;
|
||||
//if (ParseEmbeddedBlob( blob->data.first, blob->data.second)) // todoooo
|
||||
//{
|
||||
// m_isEmbedded = false;
|
||||
//}
|
||||
}
|
||||
}break;
|
||||
//BORDERS
|
||||
//BORDERS
|
||||
case ODRAW::borderBottomColor:
|
||||
if (!pict->brcBottom)
|
||||
{
|
||||
RGBColor bottomColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
|
||||
RGBColor bottomColor((int)iter->op, RedFirst);
|
||||
m_pXmlWriter->WriteAttribute(L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case ODRAW::borderLeftColor:
|
||||
if (!pict->brcLeft)
|
||||
{
|
||||
RGBColor leftColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
|
||||
}
|
||||
{
|
||||
RGBColor leftColor((int)iter->op, RedFirst);
|
||||
m_pXmlWriter->WriteAttribute(L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case ODRAW::borderRightColor:
|
||||
if (!pict->brcRight)
|
||||
{
|
||||
RGBColor rightColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
|
||||
{
|
||||
RGBColor rightColor((int)iter->op, RedFirst);
|
||||
m_pXmlWriter->WriteAttribute(L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
case ODRAW::borderTopColor:
|
||||
if (!pict->brcTop)
|
||||
{
|
||||
RGBColor topColor( (int)iter->op, RedFirst );
|
||||
m_pXmlWriter->WriteAttribute( L"o:bordertopcolor", L"#" + topColor.SixDigitHexCode);
|
||||
RGBColor topColor((int)iter->op, RedFirst);
|
||||
m_pXmlWriter->WriteAttribute(L"o:bordertopcolor", L"#" + topColor.SixDigitHexCode);
|
||||
}
|
||||
break;
|
||||
//CROPPING
|
||||
//CROPPING
|
||||
case ODRAW::cropFromBottom:
|
||||
{
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropBottom = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"cropbottom", FormatUtils::IntToWideString( cropBottom ) + L"f" );
|
||||
appendValueAttribute(m_imageData, L"cropbottom", FormatUtils::IntToWideString(cropBottom) + L"f");
|
||||
}
|
||||
break;
|
||||
case ODRAW::cropFromLeft:
|
||||
{
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropLeft = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"cropleft", FormatUtils::IntToWideString( cropLeft ) + L"f" );
|
||||
appendValueAttribute(m_imageData, L"cropleft", FormatUtils::IntToWideString(cropLeft) + L"f");
|
||||
}
|
||||
break;
|
||||
case ODRAW::cropFromRight:
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropRight = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"cropright", FormatUtils::IntToWideString( cropRight ) + L"f" );
|
||||
appendValueAttribute(m_imageData, L"cropright", FormatUtils::IntToWideString(cropRight) + L"f");
|
||||
}
|
||||
break;
|
||||
case ODRAW::cropFromTop:
|
||||
{
|
||||
//cast to signed integer
|
||||
int cropTop = (int)iter->op;
|
||||
appendValueAttribute(m_imageData, L"croptop", FormatUtils::IntToWideString( cropTop ) + L"f" );
|
||||
appendValueAttribute(m_imageData, L"croptop", FormatUtils::IntToWideString(cropTop) + L"f");
|
||||
}
|
||||
break;
|
||||
//------------------------------------------------------------
|
||||
//------------------------------------------------------------
|
||||
case ODRAW::ePropertyId_rotation:
|
||||
{
|
||||
double dAngle = (double)((int)iter->op) / 65535.0;
|
||||
@ -426,7 +427,8 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case ODRAW::posrelh:
|
||||
{
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
if (false == m_inGroup)
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
}break;
|
||||
case ODRAW::posv:
|
||||
{
|
||||
@ -434,7 +436,8 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case ODRAW::posrelv:
|
||||
{
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
if (false == m_inGroup)
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
}break;
|
||||
case ODRAW::groupShapeBooleanProperties:
|
||||
{
|
||||
@ -443,7 +446,7 @@ namespace DocFileFormat
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument)
|
||||
{
|
||||
//The shape is behind the text, so the z-index must be negative.
|
||||
appendStyleProperty(strStyle, L"z-index", L"-1" );
|
||||
appendStyleProperty(strStyle, L"z-index", L"-1");
|
||||
}
|
||||
//else if (!m_isInlinePicture)
|
||||
//{
|
||||
@ -455,8 +458,20 @@ namespace DocFileFormat
|
||||
appendStyleProperty(strStyle, L"visibility", L"hidden");
|
||||
}
|
||||
}break;
|
||||
case ODRAW::blipBooleanProperties:
|
||||
{
|
||||
ODRAW::BlipBooleanProperties * bools = (ODRAW::BlipBooleanProperties *)(iter.get());
|
||||
if (bools)
|
||||
{
|
||||
if (bools->fUsefPictureGray && bools->fPictureGray)
|
||||
appendValueAttribute(m_imageData, L"grayscale", L"t");
|
||||
if (bools->fUsefPictureBiLevel && bools->fPictureBiLevel)
|
||||
appendValueAttribute(m_imageData, L"bilevel", L"t");
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
{
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ namespace DocFileFormat
|
||||
class VMLPictureMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
public:
|
||||
VMLPictureMapping( ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false );
|
||||
VMLPictureMapping( ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false, bool inGroup = false);
|
||||
virtual ~VMLPictureMapping();
|
||||
virtual void Apply( IVisitable* visited );
|
||||
private:
|
||||
@ -88,6 +88,7 @@ namespace DocFileFormat
|
||||
|
||||
bool m_isOlePreview;
|
||||
bool m_isInlinePicture;
|
||||
bool m_inGroup;
|
||||
|
||||
XMLTools::XMLElement* m_imageData;
|
||||
|
||||
|
||||
@ -48,8 +48,9 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
VMLShapeMapping::VMLShapeMapping (ConversionContext* pConv, XMLTools::CStringXmlWriter* pWriter, Spa* pSpa, PictureDescriptor* pPicture, IMapping* pCaller, bool isInlineShape) : PropertiesMapping(pWriter)
|
||||
VMLShapeMapping::VMLShapeMapping (ConversionContext* pConv, XMLTools::CStringXmlWriter* pWriter, Spa* pSpa, PictureDescriptor* pPicture, IMapping* pCaller, bool isInlineShape, bool inGroup) : PropertiesMapping(pWriter)
|
||||
{
|
||||
m_inGroup = inGroup;
|
||||
m_isInlineShape = isInlineShape;
|
||||
m_isBullete = false;
|
||||
m_isPictureBroken = false;
|
||||
@ -87,6 +88,11 @@ namespace DocFileFormat
|
||||
{
|
||||
m_pBlipStore = static_cast<BlipStoreContainer*>(recBs);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
m_nAdjValues[i] = 0x7fffffff;
|
||||
}
|
||||
}
|
||||
|
||||
VMLShapeMapping::~VMLShapeMapping()
|
||||
@ -191,7 +197,7 @@ namespace DocFileFormat
|
||||
ShapeContainer* pChildShape = static_cast<ShapeContainer*>(container->Children[i]);
|
||||
if (pChildShape)
|
||||
{
|
||||
VMLShapeMapping vmlShapeMapping(m_context, m_pXmlWriter, m_pSpa, NULL, m_pCaller);
|
||||
VMLShapeMapping vmlShapeMapping(m_context, m_pXmlWriter, m_pSpa, NULL, m_pCaller, false, true);
|
||||
pChildShape->Convert(&vmlShapeMapping);
|
||||
}
|
||||
}
|
||||
@ -306,6 +312,8 @@ namespace DocFileFormat
|
||||
int nAdjValues = 0;
|
||||
int nLTxID = -1;
|
||||
|
||||
int nProperty = 0;
|
||||
|
||||
std::wstring sTextboxStyle;
|
||||
|
||||
ODRAW::OfficeArtFOPTEPtr opSegmentInfo;
|
||||
@ -559,6 +567,7 @@ namespace DocFileFormat
|
||||
case ODRAW::fillFocus:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"focus", (FormatUtils::IntToWideString(iter->op) + L"%"));
|
||||
appendValueAttribute(&m_fill, L"focusposition", L".5, .5");
|
||||
appendValueAttribute(&m_fill, L"focussize", L"");
|
||||
}break;
|
||||
case ODRAW::fillType:
|
||||
@ -596,12 +605,14 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case ODRAW::fillOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"opacity", (FormatUtils::IntToWideString(iter->op) + L"f"));
|
||||
double opa = (iter->op / pow((double)2, (double)16));
|
||||
appendValueAttribute(&m_fill, L"opacity", FormatUtils::DoubleToFormattedWideString(opa, L"%.2f"));
|
||||
}
|
||||
break;
|
||||
case ODRAW::fillBackOpacity:
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"o:opacity2", (FormatUtils::IntToWideString(iter->op) + L"f"));
|
||||
double opa = (iter->op / pow((double)2, (double)16));
|
||||
appendValueAttribute(&m_fill, L"o:opacity2", FormatUtils::DoubleToFormattedWideString(opa, L"%.2f"));
|
||||
}break;
|
||||
// SHADOW
|
||||
case ODRAW::shadowType:
|
||||
@ -646,8 +657,14 @@ namespace DocFileFormat
|
||||
}break;
|
||||
case ODRAW::shadowStyleBooleanProperties:
|
||||
{
|
||||
//ODRAW::ShadowStyleBooleanProperties
|
||||
|
||||
ODRAW::ShadowStyleBooleanProperties* booleans = dynamic_cast<ODRAW::ShadowStyleBooleanProperties*>(iter.get());
|
||||
if (booleans)
|
||||
{
|
||||
if (booleans->fUsefShadow && booleans->fShadow)
|
||||
{
|
||||
bShadow = true;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
// OLE
|
||||
case ODRAW::pictureId:
|
||||
@ -826,6 +843,10 @@ namespace DocFileFormat
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
case ODRAW::hspNext:
|
||||
{
|
||||
appendStyleProperty(sTextboxStyle, L"mso-next-textbox", std::wstring(L"_x0000_s") + FormatUtils::IntToWideString((unsigned int)iter->op));
|
||||
}break;
|
||||
case ODRAW::textBooleanProperties:
|
||||
{
|
||||
ODRAW::TextBooleanProperties *props = dynamic_cast<ODRAW::TextBooleanProperties*>(iter.get());
|
||||
@ -835,7 +856,6 @@ namespace DocFileFormat
|
||||
appendStyleProperty(sTextboxStyle, L"mso-fit-shape-to-text", L"t");
|
||||
}
|
||||
}break;
|
||||
|
||||
// Word Art
|
||||
case ODRAW::gtextUNICODE:
|
||||
{
|
||||
@ -894,7 +914,7 @@ namespace DocFileFormat
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
int val = iter->op;
|
||||
nProperty = iter->op;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@ -956,12 +976,14 @@ namespace DocFileFormat
|
||||
{
|
||||
if (nAdjValues > 0)
|
||||
{
|
||||
std::wstring adjTag = std::to_wstring(m_nAdjValues[0]);
|
||||
std::wstring adjTag;
|
||||
|
||||
for (int i = 1; i < nAdjValues; ++i)
|
||||
adjTag += L"," + std::to_wstring(m_nAdjValues[i]);
|
||||
for (int i = 0; i < nAdjValues; ++i)
|
||||
{
|
||||
adjTag += L"," + (m_nAdjValues[i] != 0x7fffffff ? std::to_wstring(m_nAdjValues[i]) : L"");
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteAttribute(L"adj", adjTag);
|
||||
m_pXmlWriter->WriteAttribute(L"adj", adjTag.substr(1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1012,13 +1034,6 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_shadow, L"origin", FormatUtils::DoubleToWideString(*ShadowOriginX) + std::wstring(L"," ) + FormatUtils::DoubleToWideString(*ShadowOriginY));
|
||||
}
|
||||
|
||||
// write shadow
|
||||
if (m_shadow.GetAttributeCount() > 0)
|
||||
{
|
||||
appendValueAttribute(&m_shadow, L"on", bShadow ? L"t" : L"f" );
|
||||
m_pXmlWriter->WriteString(m_shadow.GetXMLString());
|
||||
}
|
||||
|
||||
//write the viewpoint
|
||||
if ( ViewPointX || ViewPointY || ViewPointZ )
|
||||
{
|
||||
@ -1087,6 +1102,13 @@ namespace DocFileFormat
|
||||
{
|
||||
m_pXmlWriter->WriteString(m_fill.GetXMLString());
|
||||
}
|
||||
|
||||
// write shadow
|
||||
if (m_shadow.GetAttributeCount() > 0)
|
||||
{
|
||||
appendValueAttribute(&m_shadow, L"on", bShadow ? L"t" : L"f");
|
||||
m_pXmlWriter->WriteString(m_shadow.GetXMLString());
|
||||
}
|
||||
// write imagedata
|
||||
if (m_imagedata.GetAttributeCount())
|
||||
{
|
||||
@ -1141,8 +1163,8 @@ namespace DocFileFormat
|
||||
//Word appends a OfficeArtClientTextbox record to the container.
|
||||
//This record stores the index of the textbox.
|
||||
|
||||
int nIndex = pTextBox->GetIndex();
|
||||
if (nIndex)
|
||||
int nIndex = pTextBox->m_nIndex;
|
||||
if (nIndex > 0)
|
||||
{
|
||||
TextboxMapping textboxMapping(m_context, nIndex - 1, m_pXmlWriter, m_pCaller);
|
||||
textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom);
|
||||
@ -1153,12 +1175,6 @@ namespace DocFileFormat
|
||||
}
|
||||
else if( hasTextbox )
|
||||
{
|
||||
//Open Office textbox
|
||||
|
||||
//Open Office doesn't append a OfficeArtClientTextbox record to the container.
|
||||
//We don't know how Word gets the relation to the text, but we assume that the first textbox in the document
|
||||
//get the index 0, the second textbox gets the index 1 (and so on).
|
||||
|
||||
if (-1 != nLTxID)
|
||||
{
|
||||
TextboxMapping textboxMapping(m_context, nLTxID - 1, m_pXmlWriter, m_pCaller);
|
||||
@ -1696,7 +1712,7 @@ namespace DocFileFormat
|
||||
switch (val)
|
||||
{
|
||||
case 0: return L"square";
|
||||
//case 1: return L"ByPoints";
|
||||
case 1: return L"tight";
|
||||
case 2: return L"none";
|
||||
//case 3: return L"TopBottom";
|
||||
//case 3: return L"Through";
|
||||
@ -1731,7 +1747,8 @@ namespace DocFileFormat
|
||||
case ODRAW::posrelh:
|
||||
{
|
||||
nRelH = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
if (false == m_inGroup)
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
}break;
|
||||
case ODRAW::posv:
|
||||
{
|
||||
@ -1740,7 +1757,8 @@ namespace DocFileFormat
|
||||
case ODRAW::posrelv:
|
||||
{
|
||||
nRelV = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
if (false == m_inGroup)
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
}break;
|
||||
// BOOLEANS
|
||||
case ODRAW::groupShapeBooleanProperties:
|
||||
@ -1752,7 +1770,7 @@ namespace DocFileFormat
|
||||
//за текстом (The shape is behind the text, so the z-index must be negative.)
|
||||
m_isInlineShape = false;
|
||||
|
||||
if (!bZIndex)
|
||||
if (false == bZIndex/* && false == m_inGroup*/) // Пример.doc
|
||||
{
|
||||
appendStyleProperty(oStyle, L"z-index", FormatUtils::IntToWideString(-zIndex - 0x7ffff));
|
||||
bZIndex = true;
|
||||
@ -1807,7 +1825,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (nRelH < 0 && m_pSpa)
|
||||
if (nRelH < 0 && m_pSpa && false == m_inGroup)
|
||||
{
|
||||
//if (m_pSpa->bx == TEXT && bZIndex)
|
||||
//{
|
||||
@ -1820,7 +1838,7 @@ namespace DocFileFormat
|
||||
else if (m_pSpa->bx == TEXT)
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(msoprhText));
|
||||
}
|
||||
if (nRelV < 0 && m_pSpa)
|
||||
if (nRelV < 0 && m_pSpa && false == m_inGroup)
|
||||
{
|
||||
//if (m_pSpa->by == TEXT && bZIndex)
|
||||
//{
|
||||
@ -1837,12 +1855,12 @@ namespace DocFileFormat
|
||||
{
|
||||
m_isInlineShape = true;
|
||||
}
|
||||
if (!m_isInlineShape && !bZIndex)
|
||||
if (false == m_isInlineShape && false == bZIndex && false == m_inGroup)
|
||||
{
|
||||
appendStyleProperty( oStyle, L"z-index", FormatUtils::IntToWideString(zIndex + 0x7ffff));
|
||||
bZIndex = true;
|
||||
}
|
||||
if (false == m_isInlineShape)
|
||||
if (false == m_isInlineShape && false == m_inGroup)
|
||||
{
|
||||
if (nPosH >= 0)
|
||||
{
|
||||
@ -2019,8 +2037,12 @@ namespace DocFileFormat
|
||||
std::wstring result;
|
||||
for (size_t i = 0; i < pColors->complex.data.size(); ++i)
|
||||
{
|
||||
result += FormatUtils::IntToWideString((int)pColors->complex.data[i].dPosition);
|
||||
result += L"f #";
|
||||
if (pColors->complex.data[i].position.Fractional == 0)
|
||||
result += FormatUtils::IntToWideString(pColors->complex.data[i].position.Integral);
|
||||
else
|
||||
result += FormatUtils::IntToWideString(pColors->complex.data[i].position.Fractional) +L"f";
|
||||
|
||||
result += L" #";
|
||||
result += pColors->complex.data[i].color.sColorRGB;
|
||||
result += L";";
|
||||
}
|
||||
@ -2306,16 +2328,19 @@ namespace DocFileFormat
|
||||
strStyle += L"margin-left:" + FormatUtils::IntToWideString( (int)x.ToPoints()) + L"pt;";
|
||||
strStyle += L"margin-top:" + FormatUtils::IntToWideString( (int)y.ToPoints()) + L"pt;";
|
||||
|
||||
std::wstring xMargin;
|
||||
std::wstring yMargin;
|
||||
if (m_pSpa->bx == PAGE) xMargin = L"page;";
|
||||
if (m_pSpa->by == PAGE) yMargin = L"page;";
|
||||
|
||||
if (m_pSpa->bx == MARGIN) xMargin = L"margin;";
|
||||
if (m_pSpa->by == MARGIN) yMargin = L"margin;";
|
||||
if (false == m_inGroup)
|
||||
{
|
||||
std::wstring xMargin;
|
||||
std::wstring yMargin;
|
||||
if (m_pSpa->bx == PAGE) xMargin = L"page;";
|
||||
if (m_pSpa->by == PAGE) yMargin = L"page;";
|
||||
|
||||
if (!xMargin.empty()) strStyle += L"mso-position-horizontal-relative:" + xMargin;
|
||||
if (!yMargin.empty()) strStyle += L"mso-position-vertical-relative:" + yMargin;
|
||||
if (m_pSpa->bx == MARGIN) xMargin = L"margin;";
|
||||
if (m_pSpa->by == MARGIN) yMargin = L"margin;";
|
||||
|
||||
if (!xMargin.empty()) strStyle += L"mso-position-horizontal-relative:" + xMargin;
|
||||
if (!yMargin.empty()) strStyle += L"mso-position-vertical-relative:" + yMargin;
|
||||
}
|
||||
|
||||
std::wstring strSize = FormatUtils::IntToWideString(primitive->dxa) + L"," + FormatUtils::IntToWideString(primitive->dya);
|
||||
std::wstring strOrigin = FormatUtils::IntToWideString(primitive->xa) + L"," + FormatUtils::IntToWideString(primitive->ya);
|
||||
|
||||
@ -57,7 +57,7 @@ namespace DocFileFormat
|
||||
{
|
||||
public:
|
||||
|
||||
VMLShapeMapping (ConversionContext* ctx ,XMLTools::CStringXmlWriter* writer, Spa* pSpa, PictureDescriptor* pict, IMapping* caller, bool bullet = false);
|
||||
VMLShapeMapping (ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, Spa* pSpa, PictureDescriptor* pict, IMapping* caller, bool bullet = false, bool in_group = false);
|
||||
virtual ~VMLShapeMapping();
|
||||
virtual void Apply(IVisitable* visited);
|
||||
|
||||
@ -67,6 +67,7 @@ namespace DocFileFormat
|
||||
static std::wstring mapHorizontalPositionRelative (int hRel );
|
||||
static std::wstring mapWrapText (int val_);
|
||||
|
||||
bool m_inGroup;
|
||||
bool m_isBullete;
|
||||
bool m_isPictureBroken;
|
||||
std::wstring m_shapeId;
|
||||
|
||||
@ -80,7 +80,7 @@ namespace DocFileFormat
|
||||
254, 437,//PC 437
|
||||
255, 850//OEM
|
||||
};
|
||||
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder, const int userLCID) :
|
||||
WordDocument::WordDocument (const std::wstring & sTempFolder, const int userLCID) :
|
||||
m_PieceTable(NULL), WordDocumentStream(NULL), TableStream(NULL), DataStream(NULL), FIB(NULL),
|
||||
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
|
||||
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
|
||||
@ -93,7 +93,6 @@ namespace DocFileFormat
|
||||
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL),
|
||||
AnnotStartPlex(NULL), AnnotEndPlex(NULL), encryptionHeader(NULL)
|
||||
{
|
||||
m_pCallFunc = pCallFunc;
|
||||
m_sTempFolder = sTempFolder;
|
||||
m_nUserLCID = userLCID;
|
||||
|
||||
@ -315,21 +314,7 @@ namespace DocFileFormat
|
||||
|
||||
BookmarkAnnotNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAtnBkmk, FIB->m_FibWord97.lcbSttbfAtnBkmk, nWordVersion, true);
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress (m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 100000);
|
||||
|
||||
SHORT bCancel = 0;
|
||||
m_pCallFunc->OnProgressEx(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 100000, &bCancel);
|
||||
|
||||
if (bCancel)
|
||||
{
|
||||
Clear();
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
// Read all needed PLCFs
|
||||
// Read all needed PLCFs
|
||||
if (FIB->m_RgLw97.ccpFtn > 0)
|
||||
{
|
||||
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, nWordVersion);
|
||||
@ -422,20 +407,6 @@ namespace DocFileFormat
|
||||
|
||||
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 200000 );
|
||||
|
||||
SHORT bCancel = 0;
|
||||
m_pCallFunc->OnProgressEx(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 200000, &bCancel);
|
||||
|
||||
if (bCancel)
|
||||
{
|
||||
Clear();
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
// Read the FKPs
|
||||
AllPapxFkps = FormattedDiskPagePAPX::GetAllPAPXFKPs (FIB, WordDocumentStream, TableStream, DataStream);
|
||||
AllChpxFkps = FormattedDiskPageCHPX::GetAllCHPXFKPs (FIB, WordDocumentStream, TableStream);
|
||||
@ -452,19 +423,6 @@ namespace DocFileFormat
|
||||
AnnotationOwners = new AnnotationOwnerList (FIB, TableStream);
|
||||
}
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 300000 );
|
||||
|
||||
SHORT bCancel = 0;
|
||||
m_pCallFunc->OnProgressEx(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 300000, &bCancel);
|
||||
|
||||
if (bCancel)
|
||||
{
|
||||
Clear();
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
}
|
||||
if (FontTable)
|
||||
{
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
@ -556,20 +514,6 @@ namespace DocFileFormat
|
||||
|
||||
std::sort (AllPapxVector->begin(), AllPapxVector->end());
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 400000 );
|
||||
|
||||
SHORT bCancel = 0;
|
||||
m_pCallFunc->OnProgressEx(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 400000, &bCancel);
|
||||
|
||||
if (bCancel)
|
||||
{
|
||||
Clear();
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
//build a dictionary of all SEPX
|
||||
if ( !SectionPlex->Elements.empty() )
|
||||
{
|
||||
@ -594,20 +538,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 500000 );
|
||||
|
||||
SHORT bCancel = 0;
|
||||
m_pCallFunc->OnProgressEx(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 500000, &bCancel);
|
||||
|
||||
if (bCancel)
|
||||
{
|
||||
Clear();
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
bool WordDocument::LoadDocumentFlat()
|
||||
|
||||
@ -58,7 +58,6 @@
|
||||
#include "EndnoteDescriptor.h"
|
||||
#include "FieldCharacter.h"
|
||||
#include "IVisitable.h"
|
||||
#include "../Common/Callback.h"
|
||||
|
||||
namespace CRYPT
|
||||
{
|
||||
@ -92,7 +91,7 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
|
||||
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder, const int userLCID);
|
||||
WordDocument (const std::wstring & tempFolder, const int userLCID);
|
||||
virtual ~WordDocument();
|
||||
|
||||
_UINT32 LoadDocument(const std::wstring & fileName, const std::wstring & password);
|
||||
@ -155,8 +154,6 @@ namespace DocFileFormat
|
||||
std::wstring m_sTempDecryptFileName;
|
||||
int m_nUserLCID;
|
||||
|
||||
const ProgressCallback* m_pCallFunc;
|
||||
|
||||
POLE::Stream * WordDocumentStream; // The stream "WordDocument"
|
||||
POLE::Stream * TableStream; // The stream "0Table" or "1Table"
|
||||
POLE::Stream * DataStream; // The stream called "Data"
|
||||
|
||||
@ -49,9 +49,10 @@ namespace DocFileFormat
|
||||
|
||||
WordprocessingDocument::~WordprocessingDocument()
|
||||
{
|
||||
_isSectionPageBreak = 0;
|
||||
}
|
||||
|
||||
void WordprocessingDocument::SaveDocument(bool &bMacros)
|
||||
_UINT32 WordprocessingDocument::SaveDocument(bool &bMacros)
|
||||
{
|
||||
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
|
||||
NSDirectory::CreateDirectory( pathWord );
|
||||
@ -179,5 +180,6 @@ namespace DocFileFormat
|
||||
{
|
||||
SaveToFile(pathWord, ( std::wstring( L"footer" ) + FormatUtils::IntToWideString(++footersCount) + std::wstring( L".xml" ) ), *iter);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,9 +76,11 @@ namespace DocFileFormat
|
||||
std::list<std::wstring> FooterXMLList;
|
||||
|
||||
public:
|
||||
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already
|
||||
|
||||
WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile);
|
||||
virtual ~WordprocessingDocument();
|
||||
|
||||
void SaveDocument(bool &bMacros);
|
||||
_UINT32 SaveDocument(bool &bMacros);
|
||||
};
|
||||
}
|
||||
@ -34,7 +34,7 @@
|
||||
#include "../DocDocxConverter/Converter.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
_UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
_UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros)
|
||||
{
|
||||
_UINT32 hr = 0;
|
||||
|
||||
@ -43,12 +43,12 @@ _UINT32 COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::w
|
||||
docToDocx.m_sTempFolder = m_sTempFolder;
|
||||
docToDocx.m_nUserLCID = m_nUserLCID;
|
||||
|
||||
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack, bMacros);
|
||||
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, bMacros);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
_UINT32 COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack )
|
||||
_UINT32 COfficeDocFile::SaveToFile (const std::wstring & sDstFileName, const std::wstring & sSrcFileName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -29,8 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef DOC_FORMAT_LIB
|
||||
#define DOC_FORMAT_LIB
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h>
|
||||
@ -38,8 +37,6 @@
|
||||
|
||||
#include "../../DesktopEditor/common/ASCVariant.h"
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
class COfficeDocFile
|
||||
{
|
||||
public:
|
||||
@ -49,9 +46,8 @@ public:
|
||||
std::wstring m_sTempFolder;
|
||||
int m_nUserLCID;
|
||||
|
||||
_UINT32 LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
_UINT32 LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros);
|
||||
_UINT32 SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName);
|
||||
|
||||
};
|
||||
|
||||
#endif //DOC_FORMAT_LIB
|
||||
|
||||
@ -74,6 +74,8 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<IncludePath>D:\_Work\core\Common\3dParty\boost\build\win_64\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\_Work\core\Common\3dParty\boost\build\win_64\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
@ -103,7 +105,7 @@
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
||||
@ -40,12 +40,12 @@ namespace Writers
|
||||
{
|
||||
m_nCount = 0;
|
||||
}
|
||||
void CustomXmlWriter::WriteCustom(const std::wstring& sCustomXmlPropertiesContent, const std::wstring& sCustomXmlContent)
|
||||
void CustomXmlWriter::WriteCustom(const std::wstring& sCustomXmlPropertiesContent, const std::wstring& sCustomXmlContent, bool bGlossaryMode)
|
||||
{
|
||||
m_nCount++;
|
||||
|
||||
std::wstring sCustomXmlDir = m_sDir + FILE_SEPARATOR_STR;
|
||||
sCustomXmlDir += OOX::FileTypes::CustomXmlProps.DefaultDirectory().GetPath();
|
||||
sCustomXmlDir += OOX::FileTypes::CustomXml.DefaultDirectory().GetPath();
|
||||
|
||||
std::wstring sCustomXmlRelsDir = sCustomXmlDir + FILE_SEPARATOR_STR + L"_rels";
|
||||
|
||||
@ -53,6 +53,8 @@ namespace Writers
|
||||
sCustomXMLPropsFilename += std::to_wstring(m_nCount) + OOX::FileTypes::CustomXmlProps.DefaultFileName().GetExtention();
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXMLPropsFilename, sCustomXmlPropertiesContent);
|
||||
OOX::CContentTypes& oContentTypes = *m_pDrawingConverter->GetContentTypes();
|
||||
oContentTypes.Registration( OOX::FileTypes::CustomXmlProps.OverrideType(), OOX::FileTypes::CustomXml.DefaultDirectory(), sCustomXMLPropsFilename );
|
||||
|
||||
std::wstring sCustomXmlFilename;
|
||||
sCustomXmlFilename = OOX::FileTypes::CustomXml.DefaultFileName().GetBasename() + std::to_wstring(m_nCount);
|
||||
@ -65,9 +67,9 @@ namespace Writers
|
||||
m_pDrawingConverter->WriteRels(OOX::FileTypes::CustomXmlProps.RelationType(), sCustomXMLPropsFilename, L"", &lId);
|
||||
m_pDrawingConverter->SaveDstContentRels(sCustomXmlRelsDir + FILE_SEPARATOR_STR + sCustomXmlFilename + L".rels");
|
||||
|
||||
arItems.push_back(sCustomXmlFilename);
|
||||
arItems.push_back(std::make_pair(sCustomXmlFilename, bGlossaryMode));
|
||||
}
|
||||
void CustomXmlWriter::WriteCustomSettings(const std::wstring& sUrl, const std::wstring& sXml)
|
||||
void CustomXmlWriter::WriteCustomSettings(const std::wstring& sUrl, const std::wstring& sXml, bool bGlossaryMode)
|
||||
{
|
||||
m_nCount++;
|
||||
OOX::CCustomXMLProps oCustomXMLProps(NULL);
|
||||
@ -79,7 +81,7 @@ namespace Writers
|
||||
oCustomXMLProps.m_oShemaRefs->m_arrItems.push_back(pShemaRef);
|
||||
|
||||
std::wstring sCustomXmlPropsDir = m_sDir + FILE_SEPARATOR_STR;
|
||||
sCustomXmlPropsDir += OOX::FileTypes::CustomXmlProps.DefaultDirectory().GetPath();
|
||||
sCustomXmlPropsDir += OOX::FileTypes::CustomXml.DefaultDirectory().GetPath();
|
||||
NSDirectory::CreateDirectories(sCustomXmlPropsDir);
|
||||
std::wstring sCustomXMLPropsFilename = OOX::FileTypes::CustomXmlProps.DefaultFileName().GetBasename();
|
||||
sCustomXMLPropsFilename += std::to_wstring(m_nCount) + OOX::FileTypes::CustomXmlProps.DefaultFileName().GetExtention();
|
||||
@ -99,6 +101,6 @@ namespace Writers
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXmlFilename, sXml);
|
||||
|
||||
arItems.push_back(sCustomXmlFilename);
|
||||
arItems.push_back(std::make_pair(sCustomXmlFilename, bGlossaryMode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,12 +46,12 @@ namespace Writers
|
||||
std::wstring m_sDir;
|
||||
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
|
||||
public:
|
||||
std::vector<std::wstring> arItems;
|
||||
std::vector<std::pair<std::wstring, bool>> arItems;
|
||||
|
||||
CustomXmlWriter(std::wstring sDir, NSBinPptxRW::CDrawingConverter* pDrawingConverter);
|
||||
|
||||
void WriteCustomSettings(const std::wstring& sUrl, const std::wstring& sXml);
|
||||
void WriteCustom(const std::wstring& sCustomXmlPropertiesContent, const std::wstring& sCustomXmlContents);
|
||||
void WriteCustomSettings(const std::wstring& sUrl, const std::wstring& sXml, bool bGlossaryMode);
|
||||
void WriteCustom(const std::wstring& sCustomXmlPropertiesContent, const std::wstring& sCustomXmlContents, bool bGlossaryMode);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,8 @@ FileWriter::FileWriter(std::wstring sDirOutput,std::wstring sFontDir, bool bNoFo
|
||||
m_pComments (NULL),
|
||||
m_pApp (NULL),
|
||||
m_pCore (NULL),
|
||||
m_pCustomProperties (NULL)
|
||||
m_pCustomProperties (NULL),
|
||||
m_pCurrentSettings (NULL)
|
||||
{
|
||||
}
|
||||
FileWriter::~FileWriter()
|
||||
@ -61,6 +62,8 @@ FileWriter::~FileWriter()
|
||||
RELEASEOBJECT(m_pApp);
|
||||
RELEASEOBJECT(m_pCore);
|
||||
RELEASEOBJECT(m_pCustomProperties);
|
||||
|
||||
m_pCurrentSettings = NULL;
|
||||
}
|
||||
void FileWriter::Write()
|
||||
{
|
||||
|
||||
@ -61,6 +61,7 @@ namespace OOX
|
||||
{
|
||||
class CApp;
|
||||
class CCore;
|
||||
class CSettings;
|
||||
}
|
||||
namespace PPTX
|
||||
{
|
||||
@ -80,7 +81,7 @@ namespace Writers
|
||||
numbering(sDirOutput),
|
||||
footnotes(sDirOutput),
|
||||
endnotes(sDirOutput),
|
||||
settings(sDirOutput, headers_footers),
|
||||
settings(sDirOutput),
|
||||
comments(sDirOutput),
|
||||
web_settings(sDirOutput)
|
||||
{}
|
||||
@ -167,6 +168,7 @@ namespace Writers
|
||||
BinDocxRW::CComments* m_pComments;
|
||||
OOX::CApp* m_pApp;
|
||||
OOX::CCore* m_pCore;
|
||||
OOX::CSettings* m_pCurrentSettings;
|
||||
PPTX::CustomProperties* m_pCustomProperties;
|
||||
|
||||
bool m_bGlossaryMode = false;
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Writers
|
||||
}
|
||||
std::wstring AddImageGetNewPath()
|
||||
{
|
||||
OOX::CSystemUtility::CreateDirectories(m_sMediaDir);
|
||||
NSDirectory::CreateDirectories(m_sMediaDir);
|
||||
|
||||
std::wstring sNewImgName = L"image" + std::to_wstring(nImageCount + 1) + L".jpg";
|
||||
std::wstring sNewImg = m_sMediaDir + FILE_SEPARATOR_STR + sNewImgName;
|
||||
|
||||
@ -382,107 +382,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class Shd
|
||||
{
|
||||
public:
|
||||
BYTE Value;
|
||||
docRGB Color;
|
||||
docRGB Fill;
|
||||
CThemeColor ThemeColor;
|
||||
CThemeColor ThemeFill;
|
||||
|
||||
bool bValue = false;
|
||||
bool bColor = false;
|
||||
bool bThemeColor = false;
|
||||
bool bThemeFill = false;
|
||||
bool bFill = false;
|
||||
|
||||
Shd(){}
|
||||
|
||||
std::wstring ToString()
|
||||
{
|
||||
std::wstring sShd;
|
||||
if(bValue || bColor || (bThemeColor && ThemeColor.IsNoEmpty()) || (bThemeFill && ThemeFill.IsNoEmpty()))
|
||||
{
|
||||
sShd += L"<w:shd";
|
||||
if(bValue)
|
||||
{
|
||||
switch(Value)
|
||||
{
|
||||
case SimpleTypes::shdClear : sShd += L" w:val=\"clear\""; break;
|
||||
case SimpleTypes::shdDiagCross : sShd += L" w:val=\"diagCross\""; break;
|
||||
case SimpleTypes::shdDiagStripe : sShd += L" w:val=\"diagStripe\""; break;
|
||||
case SimpleTypes::shdHorzCross : sShd += L" w:val=\"horzCross\""; break;
|
||||
case SimpleTypes::shdHorzStripe : sShd += L" w:val=\"horzStripe\""; break;
|
||||
case SimpleTypes::shdNil : sShd += L" w:val=\"nil\""; break;
|
||||
case SimpleTypes::shdPct10 : sShd += L" w:val=\"pct10\""; break;
|
||||
case SimpleTypes::shdPct12 : sShd += L" w:val=\"pct12\""; break;
|
||||
case SimpleTypes::shdPct15 : sShd += L" w:val=\"pct15\""; break;
|
||||
case SimpleTypes::shdPct20 : sShd += L" w:val=\"pct20\""; break;
|
||||
case SimpleTypes::shdPct25 : sShd += L" w:val=\"pct25\""; break;
|
||||
case SimpleTypes::shdPct30 : sShd += L" w:val=\"pct30\""; break;
|
||||
case SimpleTypes::shdPct35 : sShd += L" w:val=\"pct35\""; break;
|
||||
case SimpleTypes::shdPct37 : sShd += L" w:val=\"pct37\""; break;
|
||||
case SimpleTypes::shdPct40 : sShd += L" w:val=\"pct40\""; break;
|
||||
case SimpleTypes::shdPct45 : sShd += L" w:val=\"pct45\""; break;
|
||||
case SimpleTypes::shdPct5 : sShd += L" w:val=\"pct5\""; break;
|
||||
case SimpleTypes::shdPct50 : sShd += L" w:val=\"pct50\""; break;
|
||||
case SimpleTypes::shdPct55 : sShd += L" w:val=\"pct55\""; break;
|
||||
case SimpleTypes::shdPct60 : sShd += L" w:val=\"pct60\""; break;
|
||||
case SimpleTypes::shdPct62 : sShd += L" w:val=\"pct62\""; break;
|
||||
case SimpleTypes::shdPct65 : sShd += L" w:val=\"pct65\""; break;
|
||||
case SimpleTypes::shdPct70 : sShd += L" w:val=\"pct70\""; break;
|
||||
case SimpleTypes::shdPct75 : sShd += L" w:val=\"pct75\""; break;
|
||||
case SimpleTypes::shdPct80 : sShd += L" w:val=\"pct80\""; break;
|
||||
case SimpleTypes::shdPct85 : sShd += L" w:val=\"pct85\""; break;
|
||||
case SimpleTypes::shdPct87 : sShd += L" w:val=\"pct87\""; break;
|
||||
case SimpleTypes::shdPct90 : sShd += L" w:val=\"pct90\""; break;
|
||||
case SimpleTypes::shdPct95 : sShd += L" w:val=\"pct95\""; break;
|
||||
case SimpleTypes::shdReverseDiagStripe : sShd += L" w:val=\"reverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdSolid : sShd += L" w:val=\"solid\""; break;
|
||||
case SimpleTypes::shdThinDiagCross : sShd += L" w:val=\"thinDiagCross\""; break;
|
||||
case SimpleTypes::shdThinDiagStripe : sShd += L" w:val=\"thinDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinHorzCross : sShd += L" w:val=\"thinHorzCross\""; break;
|
||||
case SimpleTypes::shdThinHorzStripe : sShd += L" w:val=\"thinHorzStripe\""; break;
|
||||
case SimpleTypes::shdThinReverseDiagStripe : sShd += L" w:val=\"thinReverseDiagStripe\""; break;
|
||||
case SimpleTypes::shdThinVertStripe : sShd += L" w:val=\"thinVertStripe\""; break;
|
||||
case SimpleTypes::shdVertStripe : sShd += L" w:val=\"vertStripe\""; break;
|
||||
default : sShd += L" w:val=\"solid\""; break;
|
||||
}
|
||||
}
|
||||
if (bColor)
|
||||
sShd += L" w:color=\"" + Color.ToString() + L"\"";
|
||||
|
||||
if (bFill)
|
||||
sShd += L" w:fill=\"" + Fill.ToString() + L"\"";
|
||||
|
||||
if(bThemeColor && ThemeColor.IsNoEmpty())
|
||||
{
|
||||
if(ThemeColor.Auto && !bFill)
|
||||
sShd += L" w:fill=\"auto\"";
|
||||
if(ThemeColor.bColor)
|
||||
sShd += L" w:themeFill=\"" + ThemeColor.ToStringColor() + L"\"";
|
||||
if(ThemeColor.bTint)
|
||||
sShd += L" w:themeFillTint=\"" + ThemeColor.ToStringTint() + L"\"";
|
||||
if(ThemeColor.bShade)
|
||||
sShd += L" w:themeFillShade=\"" + ThemeColor.ToStringShade() + L"\"";
|
||||
}
|
||||
if(bThemeFill && ThemeFill.IsNoEmpty())
|
||||
{
|
||||
if(ThemeFill.Auto && !bColor)
|
||||
sShd += L" w:color=\"auto\"";
|
||||
if(ThemeFill.bColor)
|
||||
sShd += L" w:themeColor=\"" + ThemeFill.ToStringColor() + L"\"";
|
||||
if(ThemeFill.bTint)
|
||||
sShd += L" w:themeTint=\"" + ThemeFill.ToStringTint() + L"\"";
|
||||
if(ThemeFill.bShade)
|
||||
sShd += L" w:themeShade=\"" + ThemeFill.ToStringShade() + L"\"";
|
||||
}
|
||||
sShd += L"/>";
|
||||
}
|
||||
return sShd;
|
||||
}
|
||||
};
|
||||
class Tab
|
||||
{
|
||||
public:
|
||||
@ -578,7 +477,9 @@ public:
|
||||
bool bLangEA;
|
||||
bool bThemeColor;
|
||||
bool bVanish;
|
||||
bool bSnapToGrid;
|
||||
|
||||
long CompressText;
|
||||
bool bDoNotWriteNullProp;
|
||||
public:
|
||||
rPr(boost::unordered_map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
|
||||
@ -596,7 +497,6 @@ public:
|
||||
DStrikeout = false;
|
||||
Caps = false;
|
||||
SmallCaps = false;
|
||||
|
||||
bBold = false;
|
||||
bItalic = false;
|
||||
bUnderline = false;
|
||||
@ -627,6 +527,7 @@ public:
|
||||
bThemeColor = false;
|
||||
ThemeColor.Reset();
|
||||
bVanish = false;
|
||||
bSnapToGrid = true;
|
||||
|
||||
nHighLight = 0; //not set
|
||||
Outline.clear();
|
||||
@ -636,10 +537,25 @@ public:
|
||||
MoveFrom.clear();
|
||||
MoveTo.clear();
|
||||
rPrChange.clear();
|
||||
|
||||
FontAscii.clear();
|
||||
FontHAnsi.clear();
|
||||
FontAE.clear();
|
||||
FontCS.clear();
|
||||
FontAsciiTheme.clear();
|
||||
FontHAnsiTheme.clear();
|
||||
FontAETheme.clear();
|
||||
FontCSTheme.clear();
|
||||
Shd.clear();
|
||||
RStyle.clear();
|
||||
LangBidi.clear();
|
||||
LangEA.clear();
|
||||
|
||||
CompressText = -1; //not set
|
||||
}
|
||||
bool IsNoEmpty()
|
||||
{
|
||||
return bBold || bItalic || bUnderline || bStrikeout || bFontAscii || bFontHAnsi || bFontAE || bFontCS || bFontSize || bColor || bVertAlign || nHighLight > 0 || bShd ||
|
||||
return !bSnapToGrid || bBold || bItalic || bUnderline || bStrikeout || bFontAscii || bFontHAnsi || bFontAE || bFontCS || bFontSize || bColor || bVertAlign || nHighLight > 0 || bShd ||
|
||||
bRStyle || bSpacing || bDStrikeout || bCaps || bSmallCaps || bPosition || bFontHint || bBoldCs || bItalicCs || bFontSizeCs || bCs || bRtl || bLang || bLangBidi || bLangEA || bThemeColor || bVanish ||
|
||||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !MoveFrom.empty() || !MoveTo.empty() || !rPrChange.empty() || !FontAsciiTheme.empty() || !FontHAnsiTheme.empty() || !FontAETheme.empty() || !FontCSTheme.empty();
|
||||
}
|
||||
@ -701,47 +617,51 @@ public:
|
||||
sFont += _T("/>");
|
||||
pCStringWriter->WriteString(sFont);
|
||||
}
|
||||
if (CompressText >= 0 && CompressText <= 600)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:w w:val=\"" + std::to_wstring(CompressText) + L"\"/>");
|
||||
}
|
||||
if(bBold)
|
||||
{
|
||||
if(Bold)
|
||||
pCStringWriter->WriteString(L"<w:b/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:b w:val=\"false\"/>");
|
||||
pCStringWriter->WriteString(L"<w:b w:val=\"0\"/>");
|
||||
}
|
||||
if(bBoldCs)
|
||||
{
|
||||
if(BoldCs)
|
||||
pCStringWriter->WriteString(L"<w:bCs/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:bCs w:val=\"false\"/>");
|
||||
pCStringWriter->WriteString(L"<w:bCs w:val=\"0\"/>");
|
||||
}
|
||||
if(bItalic)
|
||||
{
|
||||
if(Italic)
|
||||
pCStringWriter->WriteString(L"<w:i/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:i w:val=\"false\"/>");
|
||||
pCStringWriter->WriteString(L"<w:i w:val=\"0\"/>");
|
||||
}
|
||||
if(bItalicCs)
|
||||
{
|
||||
if(ItalicCs)
|
||||
pCStringWriter->WriteString(L"<w:iCs />");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:iCs w:val=\"false\"/>");
|
||||
pCStringWriter->WriteString(L"<w:iCs w:val=\"0\"/>");
|
||||
}
|
||||
if(bCaps)
|
||||
{
|
||||
if(Caps)
|
||||
pCStringWriter->WriteString(L"<w:caps/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:caps w:val=\"false\"/>");
|
||||
pCStringWriter->WriteString(L"<w:caps w:val=\"0\"/>");
|
||||
}
|
||||
if(bSmallCaps)
|
||||
{
|
||||
if(SmallCaps)
|
||||
pCStringWriter->WriteString(L"<w:smallCaps/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:smallCaps w:val=\"false\"/>");
|
||||
pCStringWriter->WriteString(L"<w:smallCaps w:val=\"0\"/>");
|
||||
}
|
||||
if(bStrikeout)
|
||||
{
|
||||
@ -783,6 +703,10 @@ public:
|
||||
sColor += L"/>";
|
||||
pCStringWriter->WriteString(sColor);
|
||||
}
|
||||
if (!bSnapToGrid)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:snapToGrid w:val=\"0\"/>");
|
||||
}
|
||||
if(bSpacing)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:spacing w:val=\"" + std::to_wstring(Spacing) + L"\"/>");
|
||||
@ -798,8 +722,8 @@ public:
|
||||
}
|
||||
if(bFontSizeCs)
|
||||
{
|
||||
if(false == bFontSize)
|
||||
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
//if(false == bFontSize) - Sample Doc.docx
|
||||
// pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
}
|
||||
if(nHighLight > 0)
|
||||
@ -984,10 +908,10 @@ public:
|
||||
std::wstring sType;
|
||||
switch(byteType)
|
||||
{
|
||||
case styletype_Character: sType = _T("character");break;
|
||||
case styletype_Numbering: sType = _T("numbering");break;
|
||||
case styletype_Table: sType = _T("table");break;
|
||||
default: sType = _T("paragraph");break;
|
||||
case styletype_Character: sType = _T("character");break;
|
||||
case styletype_Numbering: sType = _T("numbering");break;
|
||||
case styletype_Table: sType = _T("table");break;
|
||||
default: sType = _T("paragraph");break;
|
||||
}
|
||||
if(!Id.empty())
|
||||
{
|
||||
@ -1009,12 +933,31 @@ public:
|
||||
|
||||
sStyle += L">";
|
||||
pCStringWriter->WriteString(sStyle);
|
||||
if(!Aliases.empty())
|
||||
|
||||
if(!Name.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:name w:val=\"" + Name + L"\"/>");
|
||||
}
|
||||
if (!Aliases.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:aliases w:val=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Aliases);
|
||||
pCStringWriter->WriteString(L"\"/>");
|
||||
}
|
||||
if (!BasedOn.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:basedOn w:val=\"" + BasedOn + L"\"/>");
|
||||
}
|
||||
if (!NextId.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:next w:val=\"" + NextId + L"\"/>");
|
||||
}
|
||||
if (!Link.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:link w:val=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Link);
|
||||
pCStringWriter->WriteString(L"\"/>");
|
||||
}
|
||||
if(bautoRedefine)
|
||||
{
|
||||
if(autoRedefine)
|
||||
@ -1022,17 +965,44 @@ public:
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:autoRedefine val=\"false\"/>");
|
||||
}
|
||||
if(!Name.empty())
|
||||
if (bhidden)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:name w:val=\"" + Name + L"\"/>");
|
||||
if (hidden)
|
||||
pCStringWriter->WriteString(L"<w:hidden/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:hidden val=\"false\"/>");
|
||||
}
|
||||
if(!BasedOn.empty())
|
||||
if (buiPriority)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:basedOn w:val=\"" + BasedOn + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:uiPriority w:val=\"" + std::to_wstring(uiPriority) + L"\"/>");
|
||||
}
|
||||
if(!NextId.empty())
|
||||
if (bsemiHidden)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:next w:val=\"" + NextId + L"\"/>");
|
||||
if (semiHidden)
|
||||
pCStringWriter->WriteString(L"<w:semiHidden/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:semiHidden val=\"false\"/>");
|
||||
}
|
||||
if (bunhideWhenUsed)
|
||||
{
|
||||
if (unhideWhenUsed)
|
||||
pCStringWriter->WriteString(L"<w:unhideWhenUsed/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:unhideWhenUsed val=\"false\"/>");
|
||||
}
|
||||
if (bqFormat)
|
||||
{
|
||||
if (qFormat)
|
||||
pCStringWriter->WriteString(L"<w:qFormat/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:qFormat val=\"false\"/>");
|
||||
}
|
||||
if (blocked)
|
||||
{
|
||||
if (locked)
|
||||
pCStringWriter->WriteString(L"<w:locked/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:locked val=\"false\"/>");
|
||||
}
|
||||
if(bpersonal)
|
||||
{
|
||||
@ -1055,61 +1025,17 @@ public:
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:personalReply val=\"false\"/>");
|
||||
}
|
||||
if(!Link.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:link w:val=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Link);
|
||||
pCStringWriter->WriteString(L"\"/>");
|
||||
}
|
||||
if(blocked)
|
||||
{
|
||||
if(locked)
|
||||
pCStringWriter->WriteString(L"<w:locked/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:locked val=\"false\"/>");
|
||||
}
|
||||
if(bqFormat)
|
||||
{
|
||||
if(qFormat)
|
||||
pCStringWriter->WriteString(L"<w:qFormat/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:qFormat val=\"false\"/>");
|
||||
}
|
||||
if(buiPriority)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:uiPriority w:val=\"" + std::to_wstring(uiPriority) + L"\"/>");
|
||||
}
|
||||
if(bhidden)
|
||||
{
|
||||
if(hidden)
|
||||
pCStringWriter->WriteString(L"<w:hidden/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:hidden val=\"false\"/>");
|
||||
}
|
||||
if(bsemiHidden)
|
||||
{
|
||||
if(semiHidden)
|
||||
pCStringWriter->WriteString(L"<w:semiHidden/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:semiHidden val=\"false\"/>");
|
||||
}
|
||||
if(bunhideWhenUsed)
|
||||
{
|
||||
if(unhideWhenUsed)
|
||||
pCStringWriter->WriteString(L"<w:unhideWhenUsed/>");
|
||||
else
|
||||
pCStringWriter->WriteString(L"<w:unhideWhenUsed val=\"false\"/>");
|
||||
}
|
||||
if(!TextPr.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(TextPr);
|
||||
}
|
||||
if(!ParaPr.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:pPr>");
|
||||
pCStringWriter->WriteString(ParaPr);
|
||||
pCStringWriter->WriteString(L"</w:pPr>");
|
||||
}
|
||||
if(!TextPr.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(TextPr);
|
||||
}
|
||||
|
||||
if(!TablePr.empty())
|
||||
pCStringWriter->WriteString(TablePr);
|
||||
if(!RowPr.empty())
|
||||
@ -1364,14 +1290,6 @@ public:
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:color=\"" + Color.ToString() + L"\"");
|
||||
}
|
||||
if(bSize)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(Size) + L"\"");
|
||||
}
|
||||
if(bSpace)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(Space) + L"\"");
|
||||
}
|
||||
if(bThemeColor && ThemeColor.IsNoEmpty())
|
||||
{
|
||||
if(ThemeColor.Auto && !bColor)
|
||||
@ -1392,6 +1310,14 @@ public:
|
||||
pCStringWriter->WriteString(L" w:themeShade=\"" + ThemeColor.ToStringShade() + L"\"");
|
||||
}
|
||||
}
|
||||
if(bSize)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(Size) + L"\"");
|
||||
}
|
||||
if(bSpace)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(Space) + L"\"");
|
||||
}
|
||||
pCStringWriter->WriteString(L"/>");
|
||||
}
|
||||
else
|
||||
@ -1441,18 +1367,18 @@ public:
|
||||
}
|
||||
void Write(NSStringUtils::CStringBuilder* pCStringWriter, bool bCell)
|
||||
{
|
||||
if(bLeft)
|
||||
oLeft.Write(L"w:left", pCStringWriter, bCell);
|
||||
if(bTop)
|
||||
oTop.Write(L"w:top", pCStringWriter, bCell);
|
||||
if(bRight)
|
||||
oRight.Write(L"w:right", pCStringWriter, bCell);
|
||||
if(bLeft)
|
||||
oLeft.Write(L"w:left", pCStringWriter, bCell);
|
||||
if(bBottom)
|
||||
oBottom.Write(L"w:bottom", pCStringWriter, bCell);
|
||||
if(bInsideV)
|
||||
oInsideV.Write(L"w:insideV", pCStringWriter, bCell);
|
||||
if(bRight)
|
||||
oRight.Write(L"w:right", pCStringWriter, bCell);
|
||||
if(bInsideH)
|
||||
oInsideH.Write(L"w:insideH", pCStringWriter, bCell);
|
||||
if(bInsideV)
|
||||
oInsideV.Write(L"w:insideV", pCStringWriter, bCell);
|
||||
if(bBetween)
|
||||
oBetween.Write(L"w:between", pCStringWriter, bCell);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -38,8 +38,8 @@
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class CComments;
|
||||
class CSettingsCustom;
|
||||
class CSettings;
|
||||
}
|
||||
namespace BinDocxRW {
|
||||
|
||||
@ -56,35 +56,24 @@ class Binary_CommonReader2 : public Binary_CommonReader
|
||||
public:
|
||||
Binary_CommonReader2(NSBinPptxRW::CBinaryFileReader& poBufferedStream);
|
||||
docRGB ReadColor();
|
||||
void ReadColor2(SimpleTypes::CHexColor<>& color);
|
||||
void ReadHexColor(SimpleTypes::CHexColor<> *pColor);
|
||||
void ReadThemeColor(int length, CThemeColor& oCThemeColor);
|
||||
int _ReadThemeColor(BYTE type, long length, void* poResult);
|
||||
int ReadThemeColorContent(BYTE type, long length, void* poResult);
|
||||
template<typename T> int ReadTrackRevision(long length, T* poResult);
|
||||
int ReadShd(BYTE type, long length, void* poResult);
|
||||
int ReadShdComplexType(BYTE type, long length, void* poResult);
|
||||
private:
|
||||
template<typename T> int ReadTrackRevisionInner(BYTE type, long length, T* poResult);
|
||||
};
|
||||
class Binary_VbaProjectTableReader : public Binary_CommonReader
|
||||
{
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
|
||||
public:
|
||||
|
||||
Binary_VbaProjectTableReader (NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read ();
|
||||
};
|
||||
|
||||
class Binary_HdrFtrTableReader : public Binary_CommonReader
|
||||
{
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
CComments* m_pComments;
|
||||
|
||||
int nCurType;
|
||||
int nCurHeaderType;
|
||||
public:
|
||||
Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
|
||||
|
||||
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments);
|
||||
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read();
|
||||
int ReadHdrFtrContent (BYTE type, long length, void* poResult);
|
||||
int ReadHdrFtrFEO (BYTE type, long length, void* poResult);
|
||||
@ -251,10 +240,13 @@ class Binary_SettingsTableReader : public Binary_CommonReader
|
||||
Binary_rPrReader m_oBinary_rPrReader;
|
||||
Writers::SettingWriter& m_oSettingWriter;
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
OOX::CSettingsCustom& m_oSettingsCustom;
|
||||
|
||||
OOX::CSettingsCustom* m_pSettingsCustom;
|
||||
public:
|
||||
Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, OOX::CSettingsCustom& oSettingsCustom);
|
||||
Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, OOX::CSettingsCustom* pSettingsCustom);
|
||||
int Read();
|
||||
int ReadDocProtect(BYTE type, long length, void* poResult);
|
||||
int ReadWriteProtect(BYTE type, long length, void* poResult);
|
||||
int ReadSettings(BYTE type, long length, void* poResult);
|
||||
int ReadCompat(BYTE type, long length, void* poResult);
|
||||
int ReadCompatSetting(BYTE type, long length, void* poResult);
|
||||
@ -296,13 +288,12 @@ private:
|
||||
NSStringUtils::CStringBuilder m_oCur_pPr;
|
||||
BYTE m_byteLastElemType;
|
||||
public:
|
||||
CComments* m_pComments;
|
||||
Writers::ContentWriter& m_oDocumentWriter;
|
||||
Writers::MediaWriter& m_oMediaWriter;
|
||||
|
||||
bool m_bUsedParaIdCounter;
|
||||
|
||||
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments);
|
||||
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter);
|
||||
~Binary_DocumentTableReader();
|
||||
|
||||
int Read();
|
||||
@ -485,16 +476,16 @@ public:
|
||||
int ReadSdtFormPr(BYTE type, long length, void* poResult);
|
||||
int ReadSdtTextFormPr(BYTE type, long length, void* poResult);
|
||||
int ReadSdtTextFormPrComb(BYTE type, long length, void* poResult);
|
||||
int ReadSdtPicture(BYTE type, long length, void* poResult);
|
||||
};
|
||||
class Binary_NotesTableReader : public Binary_CommonReader
|
||||
{
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
CComments* m_pComments;
|
||||
bool m_bIsFootnote;
|
||||
nullable<SimpleTypes::CDecimalNumber<>> m_oId;
|
||||
nullable<SimpleTypes::CFtnEdn<>> m_oType;
|
||||
public:
|
||||
Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote);
|
||||
Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, bool bIsFootnote);
|
||||
int Read();
|
||||
int ReadNotes(BYTE type, long length, void* poResult);
|
||||
int ReadNote(BYTE type, long length, void* poResult);
|
||||
@ -506,8 +497,9 @@ private:
|
||||
NSBinPptxRW::CBinaryFileReader& m_oBufferedStream;
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
std::wstring m_sFileInDir;
|
||||
bool m_bMacro;
|
||||
public:
|
||||
BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReader& oBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReader& oBufferedStream, Writers::FileWriter& oFileWriter, bool bMacro = false);
|
||||
int ReadFile();
|
||||
int ReadMainTable();
|
||||
};
|
||||
|
||||
@ -36,55 +36,28 @@
|
||||
namespace Writers
|
||||
{
|
||||
static std::wstring g_string_set_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><w:settings xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\">");
|
||||
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults>");
|
||||
static std::wstring g_string_set_End = _T("</w:settings>");
|
||||
|
||||
class SettingWriter
|
||||
{
|
||||
std::wstring m_sDir;
|
||||
NSStringUtils::CStringBuilder m_oSettingWriter;
|
||||
HeaderFooterWriter& m_oHeaderFooterWriter;
|
||||
public:
|
||||
SettingWriter(std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir),m_oHeaderFooterWriter(oHeaderFooterWriter)
|
||||
SettingWriter(std::wstring sDir) : m_sDir(sDir)
|
||||
{
|
||||
}
|
||||
void Write(bool bGlossary = false)
|
||||
{
|
||||
Prepare();
|
||||
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + (bGlossary ? (FILE_SEPARATOR_STR + std::wstring(L"glossary")) : L"") + FILE_SEPARATOR_STR + L"settings.xml";
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath.GetPath());
|
||||
oFile.WriteStringUTF8(g_string_set_Start);
|
||||
oFile.WriteStringUTF8(m_oSettingWriter.GetData());
|
||||
oFile.WriteStringUTF8(g_string_set_Default);
|
||||
oFile.WriteStringUTF8(g_string_set_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
void AddSetting(std::wstring sSetting)
|
||||
{
|
||||
m_oSettingWriter.WriteString(sSetting);
|
||||
}
|
||||
void Prepare()
|
||||
{
|
||||
if(BinDocxRW::g_nCurFormatVersion < 5)
|
||||
{
|
||||
bool bevenAndOddHeaders = false;
|
||||
for(size_t i = 0, length = m_oHeaderFooterWriter.m_aHeaders.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pHeader = m_oHeaderFooterWriter.m_aHeaders[i];
|
||||
if(SimpleTypes::hdrftrEven == pHeader->eType)
|
||||
bevenAndOddHeaders = true;
|
||||
}
|
||||
for(size_t i = 0, length = m_oHeaderFooterWriter.m_aFooters.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pFooter = m_oHeaderFooterWriter.m_aFooters[i];
|
||||
if(SimpleTypes::hdrftrEven == pFooter->eType)
|
||||
bevenAndOddHeaders = true;
|
||||
}
|
||||
if(bevenAndOddHeaders)
|
||||
AddSetting(L"<w:evenAndOddHeaders/>");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -110,7 +110,7 @@ const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
|
||||
|
||||
const static wchar_t* g_sFormatSignature = L"DOCY";
|
||||
const int g_nFormatVersion = 5;
|
||||
const int g_nFormatVersionNoBase64 = 10;
|
||||
const int g_nFormatVersionNoBase64 = 10;
|
||||
extern int g_nCurFormatVersion;
|
||||
namespace c_oAscWrapStyle{enum c_oSerFormat
|
||||
{
|
||||
@ -416,7 +416,9 @@ extern int g_nCurFormatVersion;
|
||||
FontAsciiTheme = 40,
|
||||
FontHAnsiTheme = 41,
|
||||
FontAETheme = 42,
|
||||
FontCSTheme = 43
|
||||
FontCSTheme = 43,
|
||||
CompressText = 44,
|
||||
SnapToGrid = 45
|
||||
};}
|
||||
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
|
||||
{
|
||||
@ -864,7 +866,10 @@ extern int g_nCurFormatVersion;
|
||||
BookFoldPrinting = 15,
|
||||
BookFoldPrintingSheets = 16,
|
||||
BookFoldRevPrinting = 17,
|
||||
SpecialFormsHighlight = 18
|
||||
SpecialFormsHighlight = 18,
|
||||
DocumentProtection = 19,
|
||||
WriteProtection = 20
|
||||
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
@ -1153,7 +1158,8 @@ extern int g_nCurFormatVersion;
|
||||
Custom = 0,
|
||||
ItemId = 1,
|
||||
Uri = 2,
|
||||
Content = 3
|
||||
Content = 3,
|
||||
ContentA = 4
|
||||
};}
|
||||
namespace c_oSerApp{enum c_oSerApp
|
||||
{
|
||||
@ -1166,7 +1172,8 @@ extern int g_nCurFormatVersion;
|
||||
Name = 1,
|
||||
Hidden = 2,
|
||||
Title = 3,
|
||||
Descr = 4
|
||||
Descr = 4,
|
||||
Form = 5
|
||||
};}
|
||||
namespace c_oSerEmbedded{enum c_oSerEmbedded
|
||||
{
|
||||
@ -1232,7 +1239,17 @@ extern int g_nCurFormatVersion;
|
||||
TextFormPrCombSym = 53,
|
||||
TextFormPrCombFont = 54,
|
||||
TextFormPrMaxCharacters = 55,
|
||||
TextFormPrCombBorder = 56
|
||||
TextFormPrCombBorder = 56,
|
||||
TextFormPrAutoFit = 57,
|
||||
TextFormPrMultiLine = 58,
|
||||
PictureFormPr = 60,
|
||||
PictureFormPrScaleFlag = 61,
|
||||
PictureFormPrLockProportions = 62,
|
||||
PictureFormPrRespectBorders = 63,
|
||||
PictureFormPrShiftX = 64,
|
||||
PictureFormPrShiftY = 65,
|
||||
FormPrBorder = 70,
|
||||
FormPrShd = 71
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
@ -1291,4 +1308,46 @@ extern int g_nCurFormatVersion;
|
||||
Flags2 = 5,
|
||||
Flags3 = 6
|
||||
};}
|
||||
namespace c_oDocProtect {
|
||||
enum c_oDocProtect
|
||||
{
|
||||
AlgorithmName = 0,
|
||||
Edit = 1,
|
||||
Enforcment = 2,
|
||||
Formatting = 3,
|
||||
HashValue = 4,
|
||||
SaltValue = 5,
|
||||
SpinCount = 6,
|
||||
|
||||
AlgIdExt = 7,
|
||||
AlgIdExtSource = 8,
|
||||
CryptAlgorithmClass = 9,
|
||||
CryptAlgorithmSid = 10,
|
||||
CryptAlgorithmType = 11,
|
||||
CryptProvider = 12,
|
||||
CryptProviderType = 13,
|
||||
CryptProviderTypeExt = 14,
|
||||
CryptProviderTypeExtSource = 15
|
||||
};
|
||||
}
|
||||
namespace c_oWriteProtect {
|
||||
enum c_oWriteProtect
|
||||
{
|
||||
AlgorithmName = 0,
|
||||
Recommended = 1,
|
||||
HashValue = 2,
|
||||
SaltValue = 3,
|
||||
SpinCount = 4,
|
||||
|
||||
AlgIdExt = 7,
|
||||
AlgIdExtSource = 8,
|
||||
CryptAlgorithmClass = 9,
|
||||
CryptAlgorithmSid = 10,
|
||||
CryptAlgorithmType = 11,
|
||||
CryptProvider = 12,
|
||||
CryptProviderType = 13,
|
||||
CryptProviderTypeExt = 14,
|
||||
CryptProviderTypeExtSource = 15
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -88,8 +88,12 @@ namespace BinDocxRW
|
||||
OOX::IFileContainer* m_pCurRels;
|
||||
std::map<int, bool> m_mapIgnoreComments;
|
||||
|
||||
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
|
||||
m_pCBufferedStream(pCBufferedStream), m_pFontProcessor(pFontProcessor), m_pOfficeDrawingConverter(pOfficeDrawingConverter), m_pEmbeddedFontsManager(pEmbeddedFontsManager)
|
||||
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager)
|
||||
:
|
||||
m_pCBufferedStream(pCBufferedStream),
|
||||
m_pFontProcessor(pFontProcessor),
|
||||
m_pOfficeDrawingConverter(pOfficeDrawingConverter),
|
||||
m_pEmbeddedFontsManager(pEmbeddedFontsManager)
|
||||
{
|
||||
m_pMain = NULL;
|
||||
m_pSettings = NULL;
|
||||
@ -331,7 +335,6 @@ namespace BinDocxRW
|
||||
|
||||
void WriteAltChunk(OOX::Media& oAltChunk, OOX::CStyles* styles);
|
||||
|
||||
void WriteVbaProject(OOX::VbaProject& oVbaProject);
|
||||
void Write(std::vector<OOX::WritingElement*> & aElems);
|
||||
void WriteDocumentContent(const std::vector<OOX::WritingElement*> & aElems);
|
||||
void WriteBackground (OOX::WritingElement* pBackground);
|
||||
@ -495,9 +498,10 @@ namespace BinDocxRW
|
||||
void WriteSdtPrDate(const OOX::Logic::CDate& oDate);
|
||||
void WriteDocPartList(const OOX::Logic::CSdtDocPart& oSdtDocPart);
|
||||
void WriteDropDownList(const OOX::Logic::CSdtDropDownList& oDropDownList);
|
||||
void WriteSdtFormPr(const ComplexTypes::Word::CFormPr& oFormPr);
|
||||
void WriteSdtFormPr(const OOX::Logic::CFormPr& oFormPr);
|
||||
void WriteSdtTextFormPr(const OOX::Logic::CTextFormPr& oTextFormPr);
|
||||
void WriteSdtTextFormPrComb(const ComplexTypes::Word::CComb& oComb);
|
||||
void WriteSdtPicture(const OOX::Logic::CSdtPicture& oSdtPicture);
|
||||
};
|
||||
class BinaryCustomsTableWriter
|
||||
{
|
||||
@ -544,6 +548,8 @@ namespace BinDocxRW
|
||||
void WriteColorSchemeMapping(const PPTX::Logic::ClrMap& oColorSchemeMapping);
|
||||
void WriteCompat(const OOX::Settings::CCompat& oCompat);
|
||||
void WriteCompatSetting(const OOX::Settings::CCompatSetting& oCompatSetting);
|
||||
void WriteDocumentProtection(const OOX::Settings::CDocProtect& oDocProtect);
|
||||
void WriteWriteProtection(const OOX::Settings::CWriteProtection& oWriteProtection);
|
||||
};
|
||||
class BinaryNotesTableWriter
|
||||
{
|
||||
|
||||
@ -516,8 +516,7 @@ namespace BinXlsxRW{
|
||||
{
|
||||
pWorksheet = new OOX::Spreadsheet::CWorksheet(NULL);
|
||||
pWorksheet->m_oSheetFormatPr.Init();
|
||||
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight.Init();
|
||||
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight->SetValue(15);
|
||||
pWorksheet->m_oSheetFormatPr->m_oDefaultRowHeight = 15.;
|
||||
pWorksheet->m_oPageMargins.Init();
|
||||
pWorksheet->m_oPageMargins.Init();
|
||||
pWorksheet->m_oPageMargins->m_oLeft.Init();
|
||||
|
||||
@ -122,6 +122,9 @@ namespace BinDocxRW
|
||||
if (L"pkg:xmlData" == sName)
|
||||
{
|
||||
std::wstring data = oReader.GetInnerXml();
|
||||
XmlUtils::replace_all(data, L"
", L"");
|
||||
XmlUtils::replace_all(data, L"	", L"");
|
||||
//todooo убрать "красивую" разметку xml
|
||||
WriteXmlFile(*name, data);
|
||||
}
|
||||
if (L"pkg:binaryData" == sName)
|
||||
@ -142,6 +145,7 @@ namespace BinDocxRW
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(path.GetPath()))
|
||||
{
|
||||
file.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
|
||||
file.WriteStringUTF8(data);
|
||||
file.CloseFile();
|
||||
}
|
||||
@ -175,13 +179,10 @@ namespace BinDocxRW
|
||||
};
|
||||
}
|
||||
|
||||
BinDocxRW::CDocxSerializer::CDocxSerializer()
|
||||
BinDocxRW::CDocxSerializer::CDocxSerializer() : m_bIsMacro(false), m_bIsNoBase64Save(false), m_bIsNoBase64(false)
|
||||
{
|
||||
m_pParamsWriter = NULL;
|
||||
m_pCurFileWriter = NULL;
|
||||
|
||||
m_bIsNoBase64Save = false;
|
||||
m_bIsNoBase64 = false;
|
||||
}
|
||||
BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
{
|
||||
@ -414,7 +415,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
|
||||
oDrawingConverter.SetSrcPath(sFileInDir);
|
||||
|
||||
BinaryFileReader oBinaryFileReader(sFileInDir, oBufferedStream, *m_pCurFileWriter);
|
||||
BinaryFileReader oBinaryFileReader(sFileInDir, oBufferedStream, *m_pCurFileWriter, m_bIsMacro);
|
||||
oBinaryFileReader.ReadFile();
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//themes
|
||||
@ -475,7 +476,7 @@ bool BinDocxRW::CDocxSerializer::getXmlContent(NSBinPptxRW::CBinaryFileReader& o
|
||||
{
|
||||
long nLength = oBufferedStream.GetLong();
|
||||
Writers::ContentWriter oTempContentWriter;
|
||||
BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter, m_pCurFileWriter->m_pComments);
|
||||
BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter);
|
||||
oBinary_DocumentTableReader.ReadDocumentContentOut(nLength);
|
||||
|
||||
sOutputXml = oTempContentWriter.m_oContent.GetData();
|
||||
@ -563,7 +564,7 @@ bool BinDocxRW::CDocxSerializer::getXmlContentElem(OOX::EElementType eType, NSBi
|
||||
{
|
||||
long nLength = oBufferedStream.GetLong();
|
||||
Writers::ContentWriter oTempContentWriter;
|
||||
BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter, m_pCurFileWriter->m_pComments);
|
||||
BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter);
|
||||
|
||||
if(OOX::et_m_oMathPara == eType)
|
||||
{
|
||||
@ -591,13 +592,17 @@ void BinDocxRW::CDocxSerializer::setEmbeddedFontsDir(const std::wstring& sEmbedd
|
||||
{
|
||||
m_sEmbeddedFontsDir = sEmbeddedFontsDir;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setIsNoBase64Save(bool bIsNoBase64Save)
|
||||
void BinDocxRW::CDocxSerializer::setIsNoBase64Save(bool val)
|
||||
{
|
||||
m_bIsNoBase64Save = bIsNoBase64Save;
|
||||
m_bIsNoBase64Save = val;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setIsNoBase64(bool bIsNoBase64)
|
||||
void BinDocxRW::CDocxSerializer::setIsNoBase64(bool val)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
m_bIsNoBase64 = val;
|
||||
}
|
||||
void BinDocxRW::CDocxSerializer::setMacroEnabled(bool val)
|
||||
{
|
||||
m_bIsMacro = val;
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::unpackageFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath)
|
||||
{
|
||||
|
||||
@ -49,14 +49,16 @@ namespace BinDocxRW
|
||||
|
||||
class CDocxSerializer
|
||||
{
|
||||
public:
|
||||
private:
|
||||
std::wstring m_sFontDir;
|
||||
std::wstring m_sEmbeddedFontsDir;
|
||||
bool m_bIsMacro;
|
||||
bool m_bIsNoBase64Save;
|
||||
bool m_bIsNoBase64;
|
||||
ParamsWriter* m_pParamsWriter;
|
||||
public:
|
||||
Writers::FileWriter* m_pCurFileWriter;
|
||||
|
||||
ParamsWriter* m_pParamsWriter;
|
||||
|
||||
CDocxSerializer();
|
||||
virtual ~CDocxSerializer();
|
||||
|
||||
@ -75,8 +77,9 @@ namespace BinDocxRW
|
||||
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
|
||||
void setIsNoBase64Save (bool bIsNoBase64Save);
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
void setSaveChartAsImg (bool bSaveChartAsImg);
|
||||
void setIsNoBase64Save (bool val);
|
||||
void setIsNoBase64 (bool val);
|
||||
void setSaveChartAsImg (bool val);
|
||||
void setMacroEnabled (bool val);
|
||||
};
|
||||
}
|
||||
|
||||
@ -42,15 +42,13 @@
|
||||
#include "ChartWriter.h"
|
||||
|
||||
#include "../BinReader/DefaultThemeWriter.h"
|
||||
//#include "../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
|
||||
|
||||
namespace BinXlsxRW{
|
||||
int g_nCurFormatVersion = 0;
|
||||
|
||||
CXlsxSerializer::CXlsxSerializer()
|
||||
CXlsxSerializer::CXlsxSerializer() : m_bIsMacro(false), m_bIsNoBase64(false)
|
||||
{
|
||||
m_pExternalDrawingConverter = NULL;
|
||||
m_bIsNoBase64 = false;
|
||||
}
|
||||
CXlsxSerializer::~CXlsxSerializer()
|
||||
{
|
||||
@ -98,18 +96,18 @@ namespace BinXlsxRW{
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedDir);
|
||||
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
return oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
|
||||
return oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions, m_bIsMacro);
|
||||
}
|
||||
_UINT32 CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
_UINT32 CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
|
||||
pFontPicker->Init(m_sFontDir);
|
||||
NSFonts::IFontManager* pFontManager = pFontPicker->get_FontManager();
|
||||
NSFonts::IFontManager* pFontManager = pFontPicker->get_FontManager();
|
||||
DocWrapper::FontProcessor fp;
|
||||
fp.setFontManager(pFontManager);
|
||||
|
||||
|
||||
NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager = NULL;
|
||||
if(false == m_sEmbeddedFontsDir.empty())
|
||||
if (false == m_sEmbeddedFontsDir.empty())
|
||||
{
|
||||
NSDirectory::CreateDirectory(m_sEmbeddedFontsDir);
|
||||
|
||||
@ -122,12 +120,12 @@ namespace BinXlsxRW{
|
||||
//pEmbeddedFontsManager добавляются все цифры
|
||||
//для заголовков
|
||||
pEmbeddedFontsManager->CheckFont(_T("Calibri"), pFontManager);
|
||||
pEmbeddedFontsManager->CheckString(std::wstring(_T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")));
|
||||
pEmbeddedFontsManager->CheckString(std::wstring(_T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")));
|
||||
|
||||
//дополнение для ошибок "#NULL!", "#DIV/0!"...
|
||||
pEmbeddedFontsManager->CheckString(std::wstring(_T("#!/?")));
|
||||
pEmbeddedFontsManager->CheckString(std::wstring(_T("#!/?")));
|
||||
//дополнение для num форматов по умолчанию с id от 0 до 49
|
||||
pEmbeddedFontsManager->CheckString(std::wstring(_T(".%E+-():")));
|
||||
pEmbeddedFontsManager->CheckString(std::wstring(_T(".%E+-():")));
|
||||
}
|
||||
|
||||
NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter;
|
||||
@ -141,7 +139,19 @@ namespace BinXlsxRW{
|
||||
RELEASEOBJECT(pFontPicker);
|
||||
return result;
|
||||
}
|
||||
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, NSCommon::smart_ptr<OOX::File> &file, const int& nChartNumber)
|
||||
_UINT32 CXlsxSerializer::xml2Xlsx(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
oDrawingConverter.SetDstPath(sDstPath + FILE_SEPARATOR_STR + L"xl");
|
||||
oDrawingConverter.SetSrcPath(strFileInDir, 2);
|
||||
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
return oBinaryFileReader.Xml2Xlsx(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions, m_bIsMacro);
|
||||
}
|
||||
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, NSCommon::smart_ptr<OOX::File> &file)
|
||||
{
|
||||
if (NULL == pReader) return false;
|
||||
if (NULL == m_pExternalDrawingConverter) return false;
|
||||
@ -182,7 +192,7 @@ namespace BinXlsxRW{
|
||||
NSCommon::smart_ptr<OOX::Spreadsheet::CChartFile> chart_file = file.smart_dynamic_cast<OOX::Spreadsheet::CChartFile>();
|
||||
if (chart_file.IsInit())
|
||||
{
|
||||
sFileName = L"chart" + std::to_wstring(nChartNumber) + L".xml";
|
||||
sFileName = L"chart" + std::to_wstring(chart_file->GetGlobalNumber()) + L".xml";
|
||||
|
||||
bResult = (0 == oBinaryChartReader.ReadCT_ChartFile(lLength, chart_file.GetPointer()));
|
||||
|
||||
@ -218,7 +228,7 @@ namespace BinXlsxRW{
|
||||
NSCommon::smart_ptr<OOX::Spreadsheet::CChartExFile> chartEx_file = file.smart_dynamic_cast<OOX::Spreadsheet::CChartExFile>();
|
||||
if (chartEx_file.IsInit())
|
||||
{
|
||||
sFileName = L"chartEx" + std::to_wstring(nChartNumber) + L".xml";
|
||||
sFileName = L"chartEx" + std::to_wstring(chartEx_file->GetGlobalNumber()) + L".xml";
|
||||
|
||||
bResult = (0 == oBinaryChartReader.ReadCT_ChartExFile(lLength, chartEx_file.GetPointer()));
|
||||
|
||||
@ -259,9 +269,13 @@ namespace BinXlsxRW{
|
||||
{
|
||||
m_pExternalDrawingConverter = pDrawingConverter;
|
||||
}
|
||||
void CXlsxSerializer::setIsNoBase64(bool bIsNoBase64)
|
||||
void CXlsxSerializer::setIsNoBase64(bool val)
|
||||
{
|
||||
m_bIsNoBase64 = bIsNoBase64;
|
||||
m_bIsNoBase64 = val;
|
||||
}
|
||||
void CXlsxSerializer::setMacroEnabled(bool val)
|
||||
{
|
||||
m_bIsMacro = val;
|
||||
}
|
||||
|
||||
bool CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, NSCommon::smart_ptr<OOX::File> &file)
|
||||
|
||||
@ -55,22 +55,25 @@ namespace BinXlsxRW {
|
||||
std::wstring m_sEmbeddedFontsDir;
|
||||
NSBinPptxRW::CDrawingConverter* m_pExternalDrawingConverter;
|
||||
bool m_bIsNoBase64;
|
||||
bool m_bIsMacro;
|
||||
public:
|
||||
CXlsxSerializer();
|
||||
~CXlsxSerializer();
|
||||
|
||||
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
_UINT32 loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
|
||||
_UINT32 saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, NSCommon::smart_ptr<OOX::File> &file, const int& nChartNumber);
|
||||
_UINT32 saveToFile (const std::wstring& sDstPath, const std::wstring& sSrcFileName, const std::wstring& sXMLOptions);
|
||||
//------------------------------------------------
|
||||
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
void setFontDir (const std::wstring& sFontDir);
|
||||
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
|
||||
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
void setIsNoBase64 (bool val);
|
||||
void setMacroEnabled (bool val);
|
||||
|
||||
_UINT32 xml2Xlsx (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, NSCommon::smart_ptr<OOX::File> &file);
|
||||
bool writeChartXlsx (const std::wstring& sDstFile, NSCommon::smart_ptr<OOX::File> &file);
|
||||
bool hasPivot (const std::wstring& sSrcPath);
|
||||
};
|
||||
|
||||
@ -37,41 +37,38 @@
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace xml {
|
||||
namespace xml {
|
||||
|
||||
class sax;
|
||||
class sax;
|
||||
class attributes;
|
||||
|
||||
class attributes;
|
||||
typedef attributes attributes_wc;
|
||||
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
|
||||
|
||||
typedef attributes attributes_wc;
|
||||
}
|
||||
namespace common
|
||||
{
|
||||
|
||||
typedef shared_ptr< attributes_wc >::Type attributes_wc_ptr;
|
||||
// Базовый класс для элемента, который может быть прочитан sax-reader -ом
|
||||
// Для каждого элемента будут вызваны методы
|
||||
// add_attributes, add_child_element, add_text как колбеки для чтения соответствующих данных
|
||||
|
||||
}
|
||||
|
||||
namespace common {
|
||||
|
||||
// Базовый класс для элемента, который может быть прочитан sax-reader -ом
|
||||
// Для каждого элемента будут вызваны методы
|
||||
// add_attributes, add_child_element, add_text как колбеки для чтения соответствующих данных
|
||||
|
||||
class read_doc_element
|
||||
{
|
||||
public:
|
||||
bool read_sax( xml::sax * Reader);
|
||||
virtual ~read_doc_element() = 0;
|
||||
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
|
||||
private:
|
||||
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
|
||||
virtual void add_text (const std::wstring & Text) = 0;
|
||||
virtual void add_space (const std::wstring & Text) = 0;
|
||||
|
||||
};
|
||||
|
||||
inline read_doc_element::~read_doc_element()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
class read_doc_element
|
||||
{
|
||||
public:
|
||||
bool read_sax( xml::sax * Reader);
|
||||
virtual ~read_doc_element() = 0;
|
||||
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
|
||||
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
|
||||
private:
|
||||
virtual void add_text (const std::wstring & Text) = 0;
|
||||
virtual void add_space (const std::wstring & Text) = 0;
|
||||
};
|
||||
|
||||
inline read_doc_element::~read_doc_element()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ enum ElementType
|
||||
typeTextReferenceMarkStart,
|
||||
typeTextReferenceMarkEnd,
|
||||
typeTextReferenceRef,
|
||||
typeTextTabStop,
|
||||
|
||||
typeFieldFieldmarkStart,
|
||||
typeFieldFieldmarkEnd,
|
||||
@ -260,6 +261,8 @@ enum ElementType
|
||||
typeStyleFooterLeft,
|
||||
typeStyleFootnoteSep,
|
||||
|
||||
typeStyleProperties,
|
||||
|
||||
typeLoextHeaderFirst,
|
||||
typeLoextFooterFirst,
|
||||
|
||||
@ -279,6 +282,7 @@ enum ElementType
|
||||
|
||||
typeStylePageLayout,
|
||||
typeStyleMap,
|
||||
typeStylePageMaster, // openoffice xml 1.0
|
||||
|
||||
typeTableTemplate,
|
||||
typeTableTemplateElement,
|
||||
@ -344,6 +348,7 @@ enum ElementType
|
||||
typeTableTableRowNoGroup,
|
||||
typeTableTableSource,
|
||||
typeTableTableProtection,
|
||||
typeTableSubTable, //openoffice xml 1.0
|
||||
|
||||
typeTableDataPilotTables,
|
||||
typeTableDataPilotTable,
|
||||
|
||||
@ -85,6 +85,7 @@ SOURCES += \
|
||||
../src/odf/style_chart_properties.cpp \
|
||||
../src/odf/style_graphic_properties.cpp \
|
||||
../src/odf/style_map.cpp \
|
||||
../src/odf/style_properties.cpp \
|
||||
../src/odf/style_paragraph_properties.cpp \
|
||||
../src/odf/style_paragraph_properties_docx.cpp \
|
||||
../src/odf/style_paragraph_properties_pptx.cpp \
|
||||
@ -220,7 +221,9 @@ SOURCES += \
|
||||
../src/odf/datatypes/styleprint.cpp \
|
||||
../src/odf/datatypes/charttimeunit.cpp \
|
||||
../src/odf/datatypes/drawangle.cpp \
|
||||
../src/odf/datatypes/messagetype.cpp \
|
||||
../src/odf/datatypes/timeperiod.cpp \
|
||||
../src/odf/datatypes/messagetype.cpp \
|
||||
../src/odf/datatypes/stylecellprotect.cpp \
|
||||
../src/docx/xlsx_conditionalFormatting.cpp \
|
||||
../src/docx/xlsx_dxfs.cpp \
|
||||
../src/docx/docx_content_type.cpp \
|
||||
@ -484,7 +487,9 @@ HEADERS += \
|
||||
../src/odf/datatypes/styleprint.h \
|
||||
../src/odf/datatypes/drawangle.h \
|
||||
../src/odf/datatypes/charttimeunit.h \
|
||||
../src/odf/datatypes/messagetype.h \
|
||||
../src/odf/datatypes/timeperiod.h \
|
||||
../src/odf/datatypes/messagetype.h \
|
||||
./src/odf/datatypes/stylecellprotect.h \
|
||||
../src/docx/docx_content_type.h \
|
||||
../src/docx/docx_conversion_context.h \
|
||||
../src/docx/docx_conversion_state.h \
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
#include "../src/odf/style_chart_properties.cpp"
|
||||
#include "../src/odf/style_graphic_properties.cpp"
|
||||
#include "../src/odf/style_map.cpp"
|
||||
#include "../src/odf/style_properties.cpp"
|
||||
#include "../src/odf/style_paragraph_properties.cpp"
|
||||
#include "../src/odf/style_paragraph_properties_docx.cpp"
|
||||
#include "../src/odf/style_paragraph_properties_pptx.cpp"
|
||||
|
||||
@ -134,4 +134,6 @@
|
||||
#include "../src/odf/datatypes/styleprint.cpp"
|
||||
#include "../src/odf/datatypes/charttimeunit.cpp"
|
||||
#include "../src/odf/datatypes/drawangle.cpp"
|
||||
#include "../src/odf/datatypes/messagetype.cpp""
|
||||
#include "../src/odf/datatypes/messagetype.cpp"
|
||||
#include "../src/odf/datatypes/timeperiod.cpp"
|
||||
#include "../src/odf/datatypes/stylecellprotect.cpp"
|
||||
|
||||
@ -111,12 +111,15 @@ _UINT32 ConvertODF2OOXml(const std::wstring & srcPath, const std::wstring & dstP
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
case 4:
|
||||
nResult = ConvertOdt2Docx(inputOdf, dstPath, fontsPath);
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
nResult = ConvertOds2Xlsx(inputOdf, dstPath, fontsPath);
|
||||
break;
|
||||
case 3:
|
||||
case 6:
|
||||
nResult = ConvertOdp2Pptx(inputOdf, dstPath, fontsPath);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ std::wstring styles_map::name(const std::wstring & Name, odf_types::style_family
|
||||
}
|
||||
void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
{
|
||||
if(false == current_process_comment_)
|
||||
if (false == current_process_comment_)
|
||||
{
|
||||
for (size_t i = 0; i < get_comments_context().ref_start_.size(); i++)
|
||||
{
|
||||
@ -226,6 +226,8 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
state_.in_run_ = true;
|
||||
output_stream() << L"<w:r>";
|
||||
|
||||
start_changes();
|
||||
|
||||
if (!state_.text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
{
|
||||
if (!state_.text_properties_stack_.empty())
|
||||
@ -234,8 +236,8 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
get_styles_context().start();
|
||||
|
||||
|
||||
if(( textProp) && (textProp->content().r_style_))parenStyleId = _T("");
|
||||
textProp->content().docx_convert(*this);
|
||||
if(( textProp) && (textProp->content_.r_style_))parenStyleId = _T("");
|
||||
textProp->content_.docx_convert(*this);
|
||||
}
|
||||
|
||||
get_styles_context().docx_serialize_text_style( output_stream(), parenStyleId, text_tracked_context_.dumpRPr_);
|
||||
@ -1119,6 +1121,8 @@ void docx_conversion_context::process_styles()
|
||||
}
|
||||
_Wostream << L"</w:docDefaults>";
|
||||
|
||||
std::wstring default_style;
|
||||
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
if (false == arStyles[i]->is_automatic() &&
|
||||
@ -1134,6 +1138,11 @@ void docx_conversion_context::process_styles()
|
||||
if (bDefault) // style
|
||||
{
|
||||
_Wostream << L" w:default=\"1\"";
|
||||
|
||||
if (arStyles[i]->type() == odf_types::style_family::Paragraph)
|
||||
{
|
||||
default_style = id;
|
||||
}
|
||||
}
|
||||
else if (!arStyles[i]->is_default()) // default-style
|
||||
{
|
||||
@ -1150,6 +1159,10 @@ void docx_conversion_context::process_styles()
|
||||
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
else if (!bDefault && !default_style.empty())
|
||||
{
|
||||
_Wostream << L"<w:basedOn w:val=\"" << default_style << "\"/>";
|
||||
}
|
||||
// else if (false == bDefault && false == arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
// {
|
||||
//bDisplayed = false;
|
||||
@ -1197,7 +1210,7 @@ void docx_conversion_context::start_process_style_content()
|
||||
styles_context_.start();
|
||||
}
|
||||
|
||||
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns * columns)//from page layout
|
||||
void docx_conversion_context::process_section(std::wostream & strm, odf_reader::style_columns *columns_page)//from page layout
|
||||
{
|
||||
if (root()->odf_context().pageLayoutContainer().linenumbering())
|
||||
{
|
||||
@ -1209,7 +1222,8 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
|
||||
|
||||
oox::section_context::_section & section = get_section_context().get_last();
|
||||
|
||||
if (!columns)
|
||||
odf_reader::style_columns *columns = columns_page;
|
||||
//if (!columns)
|
||||
{
|
||||
if (const odf_reader::style_instance * secStyle = root()->odf_context().styleContainer().style_by_name(section.style_, odf_types::style_family::Section, process_headers_footers_))
|
||||
{
|
||||
@ -1266,20 +1280,27 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
|
||||
}
|
||||
for (size_t i = 0; page_width > 0, i < columns->style_columns_.size(); i++)
|
||||
{
|
||||
odf_reader::style_column * col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i].get());
|
||||
odf_reader::style_column *col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i].get());
|
||||
if (!col) continue;
|
||||
|
||||
double width = page_width * (col->style_rel_width_ ? col->style_rel_width_->get_value() / 65535. : 0);
|
||||
double percent = col->style_rel_width_ ? col->style_rel_width_->get_value() : 0;
|
||||
if (percent > 1000.) percent /= 100.;
|
||||
|
||||
double space = col->fo_end_indent_ ? col->fo_end_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
double width = page_width * percent / 100.;
|
||||
|
||||
double space_end = col->fo_end_indent_ ? col->fo_end_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
double space_start = col->fo_start_indent_ ? col->fo_start_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
|
||||
width -= space_end;
|
||||
width -= space_start;
|
||||
|
||||
if (i < columns->style_columns_.size() - 1)
|
||||
{
|
||||
col = dynamic_cast<odf_reader::style_column*>( columns->style_columns_[i + 1].get());
|
||||
space += col->fo_start_indent_ ? col->fo_start_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
space_start = col->fo_start_indent_ ? col->fo_start_indent_->get_value_unit(odf_types::length::pt) : 0;
|
||||
}
|
||||
|
||||
width_space.push_back(std::make_pair(width, space));
|
||||
width_space.push_back(std::make_pair(width, space_start + space_end));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1449,17 +1470,17 @@ odf_reader::style_text_properties_ptr docx_conversion_context::current_text_prop
|
||||
for (size_t i = 0; i < state_.text_properties_stack_.size(); i++)
|
||||
{
|
||||
if (state_.text_properties_stack_[i])
|
||||
cur->content().apply_from( state_.text_properties_stack_[i]->content() );
|
||||
cur->content_.apply_from( state_.text_properties_stack_[i]->content_);
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
|
||||
void docx_conversion_context::set_page_break_after(bool val)
|
||||
void docx_conversion_context::set_page_break_after(int val)
|
||||
{
|
||||
page_break_after_ = val;
|
||||
}
|
||||
|
||||
bool docx_conversion_context::get_page_break_after()
|
||||
int docx_conversion_context::get_page_break_after()
|
||||
{
|
||||
return page_break_after_ ;
|
||||
}
|
||||
@ -1471,12 +1492,12 @@ bool docx_conversion_context::get_page_break()
|
||||
{
|
||||
return page_break_;
|
||||
}
|
||||
void docx_conversion_context::set_page_break_before(bool val)
|
||||
void docx_conversion_context::set_page_break_before(int val)
|
||||
{
|
||||
page_break_before_ = val;
|
||||
}
|
||||
|
||||
bool docx_conversion_context::get_page_break_before()
|
||||
int docx_conversion_context::get_page_break_before()
|
||||
{
|
||||
return page_break_before_;
|
||||
}
|
||||
@ -1809,7 +1830,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
//process_paragraph_style(Context.get_current_paragraph_style()); ??
|
||||
|
||||
//if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
if (outline_level)
|
||||
if ((outline_level) && (*outline_level < 10))
|
||||
{
|
||||
output_stream() << L"<w:pPr>";
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *outline_level << L"\"/>";
|
||||
@ -1821,7 +1842,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
|
||||
output_stream() << get_section_context().dump_;
|
||||
get_section_context().dump_.clear();
|
||||
//if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
|
||||
if (outline_level)
|
||||
if ((outline_level) && (*outline_level < 10))
|
||||
{
|
||||
output_stream() << L"<w:outlineLvl w:val=\"" << *outline_level << L"\"/>";
|
||||
}
|
||||
@ -1924,15 +1945,8 @@ void docx_conversion_context::process_page_break_after(const odf_reader::style_i
|
||||
_CP_OPT(odf_types::fo_break) fo_break_val = inst->content()->get_style_paragraph_properties()->content_.fo_break_after_;
|
||||
if (fo_break_val)
|
||||
{
|
||||
if (fo_break_val->get_type() == odf_types::fo_break::Page)
|
||||
{
|
||||
set_page_break_after(true);
|
||||
break;
|
||||
}
|
||||
else if (fo_break_val->get_type() == odf_types::fo_break::Auto)
|
||||
{
|
||||
break;
|
||||
}
|
||||
set_page_break_after(fo_break_val->get_type());
|
||||
break;
|
||||
}
|
||||
}
|
||||
inst = inst->parent();
|
||||
@ -2224,37 +2238,37 @@ void docx_conversion_context::start_changes()
|
||||
if (state.active) continue;
|
||||
|
||||
std::wstring change_attr;
|
||||
change_attr += L" w:date=\"" + state.date + L"\"";
|
||||
change_attr += L" w:author=\"" + state.author + L"\"";
|
||||
change_attr += L" w:id=\"" + std::to_wstring(current_id_changes++) + L"\"";
|
||||
change_attr += L" w:date=\"" + state.date + L"\"";
|
||||
change_attr += L" w:author=\"" + state.author + L"\"";
|
||||
change_attr += L" w:id=\"" + std::to_wstring(current_id_changes++) + L"\"";
|
||||
|
||||
if (state.type == 1)
|
||||
if (state.type == 1)
|
||||
{
|
||||
text_tracked_context_.dumpRPrInsDel_ = L"<w:ins" + change_attr + L"/>";
|
||||
}
|
||||
|
||||
if (state.type == 2)
|
||||
if (state.type == 2)
|
||||
{
|
||||
text_tracked_context_.dumpRPrInsDel_ = L"<w:del" + change_attr + L"/>";
|
||||
}
|
||||
|
||||
if (state.type == 3)
|
||||
|
||||
if (state.type == 3 && false == state.style_name.empty())
|
||||
{
|
||||
odf_reader::style_instance * styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::Paragraph, false);
|
||||
if (styleInst)
|
||||
{
|
||||
odf_reader::style_paragraph_properties * props = styleInst->content()->get_style_paragraph_properties();
|
||||
odf_reader::style_text_properties * props_text = styleInst->content()->get_style_text_properties();
|
||||
|
||||
odf_reader::style_paragraph_properties * props = styleInst->content()->get_style_paragraph_properties();
|
||||
odf_reader::style_text_properties * props_text = styleInst->content()->get_style_text_properties();
|
||||
|
||||
text_tracked_context_.dumpPPr_ += L"<w:pPrChange" + change_attr;
|
||||
|
||||
|
||||
if (props)
|
||||
{
|
||||
props->docx_convert(*this);
|
||||
props->docx_convert(*this);
|
||||
text_tracked_context_.dumpPPr_ += get_styles_context().paragraph_attr().str();
|
||||
}
|
||||
text_tracked_context_.dumpPPr_ += L">";
|
||||
|
||||
|
||||
if (props) text_tracked_context_.dumpPPr_ += get_styles_context().paragraph_nodes().str();
|
||||
if (props_text)
|
||||
{
|
||||
@ -2269,7 +2283,7 @@ void docx_conversion_context::start_changes()
|
||||
else if (styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::Text, false))
|
||||
{
|
||||
text_tracked_context_.dumpRPr_ = L"<w:rPrChange" + change_attr + L">";
|
||||
odf_reader::style_text_properties * props = NULL;
|
||||
odf_reader::style_text_properties * props = NULL;
|
||||
props = styleInst->content()->get_style_text_properties();
|
||||
if (props)
|
||||
{
|
||||
@ -2281,8 +2295,8 @@ void docx_conversion_context::start_changes()
|
||||
else if (styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::Table, false))
|
||||
{
|
||||
text_tracked_context_.dumpTblPr_ = L"<w:TblPrChange" + change_attr + L">";
|
||||
odf_reader::style_table_properties * props = styleInst->content()->get_style_table_properties();
|
||||
odf_reader::style_table_cell_properties * props_cell = styleInst->content()->get_style_table_cell_properties();
|
||||
odf_reader::style_table_properties * props = styleInst->content()->get_style_table_properties();
|
||||
odf_reader::style_table_cell_properties * props_cell = styleInst->content()->get_style_table_cell_properties();
|
||||
if (props)
|
||||
{
|
||||
props->docx_convert(*this);
|
||||
@ -2293,7 +2307,7 @@ void docx_conversion_context::start_changes()
|
||||
else if (styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::TableCell, false))
|
||||
{
|
||||
text_tracked_context_.dumpTcPr_ = L"<w:TcPrChange" + change_attr + L">";
|
||||
odf_reader::style_table_cell_properties * props = styleInst->content()->get_style_table_cell_properties();
|
||||
odf_reader::style_table_cell_properties * props = styleInst->content()->get_style_table_cell_properties();
|
||||
if (props)
|
||||
{
|
||||
props->docx_convert(*this);
|
||||
@ -2302,6 +2316,13 @@ void docx_conversion_context::start_changes()
|
||||
text_tracked_context_.dumpTcPr_ += L"</w:TcPrChange>";
|
||||
}
|
||||
}
|
||||
else if (state.type == 3 && state.style_name.empty())
|
||||
{
|
||||
if (state_.in_run_)
|
||||
text_tracked_context_.dumpRPr_ += L"<w:rPrChange" + change_attr + L"/>";
|
||||
else
|
||||
text_tracked_context_.dumpPPr_ += L"<w:pPrChange" + change_attr + L"/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ public:
|
||||
|
||||
std::wstring & get_text_stream_frame()
|
||||
{
|
||||
if (frames_.size()>0)
|
||||
if (false == frames_.empty())
|
||||
return frames_.back().text_content;
|
||||
else
|
||||
return zero_string_;
|
||||
@ -235,7 +235,7 @@ public:
|
||||
bool & get_use_image_replace()
|
||||
{
|
||||
bool res = false;
|
||||
if (!frames_.empty()) return frames_.back().use_image_replace;
|
||||
if (false == frames_.empty()) return frames_.back().use_image_replace;
|
||||
else
|
||||
throw;
|
||||
}
|
||||
@ -245,11 +245,11 @@ public:
|
||||
}
|
||||
void clear_stream_shape()
|
||||
{
|
||||
shape_text_content_=L"";
|
||||
shape_text_content_ = L"";
|
||||
}
|
||||
void clear_stream_frame()
|
||||
{
|
||||
if (!frames_.empty())
|
||||
if (false == frames_.empty())
|
||||
frames_.back().text_content.clear();
|
||||
}
|
||||
void stop_shape()
|
||||
@ -276,7 +276,7 @@ public:
|
||||
|
||||
int get_current_frame_id() const
|
||||
{
|
||||
if (!frames_.empty()) return frames_.back().id;
|
||||
if (false == frames_.empty()) return frames_.back().id;
|
||||
else return 0;
|
||||
}
|
||||
bool in_group() { return !groups_.empty(); }
|
||||
@ -287,7 +287,7 @@ public:
|
||||
|
||||
odf_reader::draw_frame * get_current_frame() const
|
||||
{
|
||||
if (!frames_.empty()) return frames_.back().ptr;
|
||||
if (false == frames_.empty()) return frames_.back().ptr;
|
||||
else return NULL;
|
||||
}
|
||||
odf_reader::draw_shape * get_current_shape() const { return current_shape_; }
|
||||
@ -853,11 +853,11 @@ public:
|
||||
|
||||
odf_reader::style_text_properties_ptr current_text_properties();
|
||||
|
||||
void set_page_break_after(bool val);
|
||||
bool get_page_break_after();
|
||||
void set_page_break_after(int val);
|
||||
int get_page_break_after();
|
||||
|
||||
void set_page_break_before(bool val);
|
||||
bool get_page_break_before();
|
||||
void set_page_break_before(int val);
|
||||
int get_page_break_before();
|
||||
|
||||
void set_page_break (bool val);
|
||||
bool get_page_break ();
|
||||
@ -1044,8 +1044,8 @@ private:
|
||||
|
||||
bool first_element_list_item_;
|
||||
|
||||
bool page_break_after_;
|
||||
bool page_break_before_;
|
||||
int page_break_after_; // 0 = false, 1 - column, 2 -page
|
||||
int page_break_before_;
|
||||
bool page_break_;
|
||||
|
||||
bool in_automatic_style_;
|
||||
|
||||
@ -358,12 +358,12 @@ void docx_serialize_shape_child(std::wostream & strm, _docx_drawing & val)
|
||||
}
|
||||
void docx_serialize_group_child(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
std::wstring name_node = L"wpg:wgp";
|
||||
if (val.inGroup)name_node = L"wpg:grpSp";
|
||||
std::wstring node_name = L"wpg:wgp";
|
||||
if (val.inGroup)node_name = L"wpg:grpSp";
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(name_node)
|
||||
CP_XML_NODE(node_name)
|
||||
{
|
||||
CP_XML_NODE(L"wpg:cNvGrpSpPr")
|
||||
{
|
||||
|
||||
@ -183,13 +183,13 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
CP_XML_NODE(L"c:axPos")
|
||||
{
|
||||
if (content_.dimension_ == L"x")
|
||||
CP_XML_ATTR(L"val",L"b");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
CP_XML_ATTR(L"val", L"b");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
|
||||
if (content_.dimension_ == L"y")
|
||||
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
CP_XML_ATTR(L"val", L"l");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
}
|
||||
//oox_serialize_ln(_Wostream, content_.graphic_properties_);
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat, strAxisType;
|
||||
_CP_OPT(bool) bLinkData;
|
||||
_CP_OPT(int) nTypeFormat;
|
||||
|
||||
@ -197,6 +197,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
odf_reader::GetProperty(content_.properties_, L"percentage_num_format", strPercentFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"data-label-number", nTypeFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", bLinkData);
|
||||
odf_reader::GetProperty(content_.properties_, L"axis-type", strAxisType);
|
||||
|
||||
std::wstring formatCode;
|
||||
if ((nTypeFormat) && (*nTypeFormat == 2) && strPercentFormat)
|
||||
@ -213,7 +214,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
CP_XML_NODE(L"c:numFmt")
|
||||
{
|
||||
CP_XML_ATTR(L"formatCode", formatCode);
|
||||
CP_XML_ATTR(L"sourceLinked", bLinkData.get_value_or(true));
|
||||
CP_XML_ATTR(L"sourceLinked", bLinkData.get_value_or(strAxisType ? false : true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ void oox_chart_series::parse_properties()
|
||||
if (false == formatCode.empty())
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
data_labels_->set_formatCode(formatCode, bLinkData.get_value_or(true));
|
||||
data_labels_->set_formatCode(formatCode, bLinkData.get_value_or(false));
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
|
||||
if (intVal && labelPosEnabled_)
|
||||
|
||||
@ -263,10 +263,9 @@ void math_context::start()
|
||||
{
|
||||
text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties());
|
||||
|
||||
text_properties_->content().style_font_name_ = L"Cambria Math";
|
||||
text_properties_->content().fo_font_size_ = odf_types::length(base_font_size_, odf_types::length::pt);
|
||||
text_properties_->content_.style_font_name_ = L"Cambria Math";
|
||||
text_properties_->content_.fo_font_size_ = odf_types::length(base_font_size_, odf_types::length::pt);
|
||||
}
|
||||
|
||||
std::wstring math_context::end()
|
||||
{
|
||||
std::wstring math = math_stream_.str();
|
||||
|
||||
@ -83,11 +83,11 @@ std::size_t hash_value(xlsx_alignment const & val)
|
||||
|
||||
bool is_default(const xlsx_alignment & rVal)
|
||||
{
|
||||
/*const */xlsx_alignment defaultAlignment;
|
||||
xlsx_alignment defaultAlignment;
|
||||
return rVal == defaultAlignment;
|
||||
}
|
||||
|
||||
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
|
||||
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
|
||||
const odf_reader::text_format_properties_content_ptr textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
@ -44,9 +45,7 @@ namespace odf_reader {
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
}
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_conversion_context;
|
||||
@ -70,7 +69,6 @@ struct xlsx_alignment
|
||||
friend bool is_default(const xlsx_alignment & rVal);
|
||||
friend std::size_t hash_value(xlsx_alignment const & val);
|
||||
};
|
||||
|
||||
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
|
||||
const odf_reader::text_format_properties_content_ptr textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
|
||||
@ -89,19 +89,22 @@ namespace oox {
|
||||
_CP_OPT(std::wstring) text;
|
||||
_CP_OPT(std::wstring) formula2;
|
||||
_CP_OPT(int) rank;
|
||||
_CP_OPT(bool) bottom;
|
||||
//color scale icon set data_bar
|
||||
std::vector<_cfvo> cfvo;
|
||||
//color scale data_bar(1 element)
|
||||
std::vector<std::wstring> color;
|
||||
//data_bar icon_set
|
||||
//data bar icon_set
|
||||
_CP_OPT(bool) showValue;
|
||||
//data_bar
|
||||
//data bar
|
||||
_CP_OPT(int) minLength;
|
||||
_CP_OPT(int) maxLength;
|
||||
//icon set
|
||||
_CP_OPT(bool) reverse;
|
||||
_CP_OPT(bool) iconset_percent;
|
||||
_CP_OPT(int) iconset_type;
|
||||
//date is
|
||||
_CP_OPT(int) time_period;
|
||||
};
|
||||
struct conditionalFormatting
|
||||
{
|
||||
@ -144,9 +147,8 @@ public:
|
||||
if (c.rules[j].stopIfTrue) CP_XML_ATTR(L"stopIfTrue", *c.rules[j].stopIfTrue);
|
||||
if (c.rules[j].text) CP_XML_ATTR(L"text", *c.rules[j].text);
|
||||
if (c.rules[j].rank) CP_XML_ATTR(L"rank", *c.rules[j].rank);
|
||||
|
||||
//CP_XML_ATTR(L"bottom" , 0);
|
||||
//CP_XML_ATTR(L"equalAverage" , 0);
|
||||
if (c.rules[j].bottom) CP_XML_ATTR(L"bottom", *c.rules[j].bottom);
|
||||
//CP_XML_ATTR(L"equalAverage" , 0);
|
||||
//CP_XML_ATTR(L"aboveAverage" , 0);
|
||||
if (c.rules[j].type == 1)
|
||||
{
|
||||
@ -220,6 +222,23 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c.rules[j].type == 5)
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"timePeriod");
|
||||
switch (*c.rules[j].time_period)
|
||||
{
|
||||
case 0: CP_XML_ATTR(L"timePeriod", L"today"); break;
|
||||
case 1: CP_XML_ATTR(L"timePeriod", L"yesterday"); break;
|
||||
case 2: CP_XML_ATTR(L"timePeriod", L"tomorrow"); break;
|
||||
case 3: CP_XML_ATTR(L"timePeriod", L"last7Days"); break;
|
||||
case 4: CP_XML_ATTR(L"timePeriod", L"thisMonth"); break;
|
||||
case 5: CP_XML_ATTR(L"timePeriod", L"lastMonth"); break;
|
||||
case 6: CP_XML_ATTR(L"timePeriod", L"nextMonth"); break;
|
||||
case 7: CP_XML_ATTR(L"timePeriod", L"thisWeek"); break;
|
||||
case 8: CP_XML_ATTR(L"timePeriod", L"lastWeek"); break;
|
||||
case 9: CP_XML_ATTR(L"timePeriod", L"nextWeek"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,7 +262,7 @@ void xlsx_conditionalFormatting_context::serialize(std::wostream & _Wostream)
|
||||
return impl_->serialize(_Wostream);
|
||||
}
|
||||
|
||||
void xlsx_conditionalFormatting_context::add(std::wstring ref)
|
||||
void xlsx_conditionalFormatting_context::start(std::wstring ref)
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
impl_->conditionalFormattings_.push_back(conditionalFormatting());
|
||||
@ -255,7 +274,6 @@ void xlsx_conditionalFormatting_context::add_rule(int type)
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.push_back(rule());
|
||||
impl_->conditionalFormattings_.back().rules.back().type = type;
|
||||
|
||||
}
|
||||
void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
{
|
||||
@ -309,11 +327,35 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"begins-with")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"beginsWith";
|
||||
std::wstring text = f.substr(pos + 12, f.length() - pos - 13);
|
||||
|
||||
if (0 == text.find(L"\"") && text.length() - 1 == text.rfind(L"\""))
|
||||
{
|
||||
text = text.substr(1, text.length() - 2);
|
||||
}
|
||||
|
||||
impl_->conditionalFormattings_.back().rules.back().text = text;
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"ends-with")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"endsWith";
|
||||
std::wstring text = f.substr(pos + 10, f.length() - pos - 11);
|
||||
|
||||
if (0 == text.find(L"\"") && text.length() - 1 == text.rfind(L"\""))
|
||||
{
|
||||
text = text.substr(1, text.length() - 2);
|
||||
}
|
||||
|
||||
impl_->conditionalFormattings_.back().rules.back().text = text;
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
|
||||
std::wstring text = f.substr(14, f.length() - 15);
|
||||
std::wstring text = f.substr(pos + 14, f.length() - pos - 15);
|
||||
|
||||
if (std::wstring::npos != text.find(L"IF(") ||
|
||||
std::wstring::npos != text.find(L"AND(") ||
|
||||
@ -362,6 +404,21 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
}
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"bottom")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
|
||||
impl_->conditionalFormattings_.back().rules.back().bottom = true;
|
||||
if (0 < (pos = f.find(L"percent")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().percent = true;
|
||||
}
|
||||
if (0 <= (pos = f.find(L"(")))
|
||||
{
|
||||
val = f.substr(pos + 1, f.length() - pos - 2);
|
||||
if (!val.empty())
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"cellIs";
|
||||
@ -468,7 +525,9 @@ void xlsx_conditionalFormatting_context::set_showVal(bool val)
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().showValue = val;
|
||||
}
|
||||
|
||||
|
||||
void xlsx_conditionalFormatting_context::set_time_period(int val)
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().time_period = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,8 @@ public:
|
||||
xlsx_conditionalFormatting_context();
|
||||
~xlsx_conditionalFormatting_context();
|
||||
|
||||
void add(std::wstring ref);
|
||||
void start(std::wstring ref);
|
||||
void end(){}
|
||||
|
||||
void add_rule(int type);
|
||||
|
||||
@ -53,6 +54,7 @@ public:
|
||||
|
||||
void set_dxf (int dxf_id);
|
||||
void set_showVal(bool val);
|
||||
void set_time_period(int val);
|
||||
|
||||
void add_sfv (int type, std::wstring value);
|
||||
void add_color (std::wstring col);
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
|
||||
#include "xlsx_protection.h"
|
||||
#include "../odf/style_table_properties.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -44,7 +45,7 @@ bool xlsx_protection::operator == (const xlsx_protection & rVal) const
|
||||
{
|
||||
const bool res =
|
||||
hidden.get_value_or(false) == rVal.hidden.get_value_or(false) &&
|
||||
locked.get_value_or(false) == rVal.locked.get_value_or(false);
|
||||
locked.get_value_or(true) == rVal.locked.get_value_or(true);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -55,7 +56,10 @@ bool xlsx_protection::operator != (const xlsx_protection & rVal) const
|
||||
|
||||
void xlsx_serialize(std::wostream & _Wostream, const xlsx_protection & protection)
|
||||
{
|
||||
_Wostream << L"<protection ";
|
||||
if (is_default(protection))
|
||||
return;
|
||||
|
||||
_Wostream << L"<protection ";
|
||||
|
||||
if (protection.hidden)
|
||||
_Wostream << L"hidden=\"" << protection.hidden.get() << L"\" ";
|
||||
@ -64,7 +68,6 @@ void xlsx_serialize(std::wostream & _Wostream, const xlsx_protection & protectio
|
||||
|
||||
_Wostream << L"/>";
|
||||
}
|
||||
|
||||
std::size_t hash_value(xlsx_protection const & val)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
@ -72,5 +75,41 @@ std::size_t hash_value(xlsx_protection const & val)
|
||||
boost::hash_combine(seed, val.locked.get_value_or(false));
|
||||
return seed;
|
||||
}
|
||||
bool is_default(const xlsx_protection & rVal)
|
||||
{
|
||||
xlsx_protection defaultProtection;
|
||||
return rVal == defaultProtection;
|
||||
}
|
||||
xlsx_protection OdfProperties2XlsxProtection(const odf_reader::style_table_cell_properties_attlist *cellProp)
|
||||
{
|
||||
xlsx_protection protection;
|
||||
|
||||
if (cellProp->style_cell_protect_)
|
||||
{
|
||||
switch (cellProp->style_cell_protect_->get_type())
|
||||
{
|
||||
case odf_types::style_cell_protect::hidden_and_protected:
|
||||
case odf_types::style_cell_protect::protected_formula_hidden:
|
||||
{
|
||||
protection.locked = true;
|
||||
protection.hidden = true;
|
||||
|
||||
}break;
|
||||
case odf_types::style_cell_protect::protected_:
|
||||
{
|
||||
protection.locked = true;
|
||||
}break;
|
||||
case odf_types::style_cell_protect::formula_hidden:
|
||||
{
|
||||
protection.hidden = true;
|
||||
}break;
|
||||
case odf_types::style_cell_protect::none:
|
||||
{
|
||||
protection.locked = false;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
return protection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,9 @@
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
class style_table_cell_properties_attlist;
|
||||
}
|
||||
namespace oox {
|
||||
|
||||
/// \struct xlsx_protection
|
||||
@ -49,9 +52,11 @@ struct xlsx_protection
|
||||
bool operator == (const xlsx_protection & rVal) const;
|
||||
bool operator != (const xlsx_protection & rVal) const;
|
||||
|
||||
friend void xlsx_serialize(std::wostream & _Wostream, const xlsx_protection & font);
|
||||
friend bool is_default(const xlsx_protection & rVal);
|
||||
friend void xlsx_serialize(std::wostream & _Wostream, const xlsx_protection & font);
|
||||
friend std::size_t hash_value(xlsx_protection const & val);
|
||||
};
|
||||
xlsx_protection OdfProperties2XlsxProtection(const odf_reader::style_table_cell_properties_attlist *cellProp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,18 +133,21 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
|
||||
const size_t borderId = borders_.borderId(cellProp, default_border);
|
||||
|
||||
bool default_fill = false;
|
||||
const size_t fillId = fills_.fillId(textProp, parProp, cellProp, default_set,default_fill);
|
||||
const size_t fillId = fills_.fillId(textProp, parProp, cellProp, default_set, default_fill);
|
||||
|
||||
if (!default_border || !default_fill || is_visible_set/* || (fillId >2 && default_set!=default_fill)*/)
|
||||
if (!default_border || !default_fill || is_visible_set/* || (fillId > 2 && default_set != default_fill)*/)
|
||||
is_visible = true;
|
||||
|
||||
xlsx_alignment alignment = OdfProperties2XlsxAlignment(context, textProp, parProp, cellProp);
|
||||
const unsigned int id = next_index_;//static_cast<unsigned int>(cellXfs_.size());
|
||||
xlsx_protection protection = OdfProperties2XlsxProtection( cellProp);
|
||||
|
||||
const unsigned int id = next_index_;//static_cast<unsigned int>(cellXfs_.size());
|
||||
|
||||
xlsx_xf xfRecord;
|
||||
const bool dbgApplyAlignment = !is_default(alignment);
|
||||
xfRecord.applyAlignment = dbgApplyAlignment;
|
||||
|
||||
|
||||
xfRecord.applyAlignment = !is_default(alignment);
|
||||
xfRecord.alignment = alignment;
|
||||
|
||||
xfRecord.applyBorder = true;
|
||||
xfRecord.borderId = borderId;
|
||||
|
||||
@ -154,7 +157,8 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
|
||||
xfRecord.applyFont = true;
|
||||
xfRecord.fontId = fontId;
|
||||
|
||||
xfRecord.applyProtection = false; // TODO
|
||||
xfRecord.applyProtection = !is_default(protection);
|
||||
xfRecord.protection = protection;
|
||||
|
||||
if (false == num_format.empty())
|
||||
{
|
||||
@ -170,7 +174,6 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
|
||||
}
|
||||
|
||||
xfRecord.xfId = 0;
|
||||
xfRecord.alignment = alignment;
|
||||
|
||||
xlsx_xf_array::const_iterator i = cellXfs_.find(xfRecord);
|
||||
if (i != cellXfs_.end())
|
||||
|
||||
@ -137,8 +137,7 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
in_cell(false),
|
||||
bEndTable(false),
|
||||
bRTL(false),
|
||||
bHidden(false),
|
||||
bProtected(false)
|
||||
bHidden(false)
|
||||
{
|
||||
odf_reader::style_table_properties * table_prop = NULL;
|
||||
odf_reader::style_instance * tableStyle = context_->root()->odf_context().styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false);
|
||||
@ -176,13 +175,13 @@ void xlsx_table_state::set_rtl(bool val)
|
||||
|
||||
void xlsx_table_state::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
bProtected = val;
|
||||
protect_key = key;
|
||||
protection.bEnabled = val;
|
||||
protection.protect_key = key;
|
||||
|
||||
size_t pos = algorithm.find(L"#");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
protect_key_algorithm = algorithm.substr(pos + 1);
|
||||
protection.protect_key_algorithm = algorithm.substr(pos + 1);
|
||||
}
|
||||
|
||||
//test
|
||||
@ -193,7 +192,30 @@ void xlsx_table_state::set_protection(bool val, const std::wstring &key, const s
|
||||
//bool res = protect.Verify();
|
||||
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_protection_select_protected_cells(bool val)
|
||||
{
|
||||
protection.selectLockedCells = !val;
|
||||
}
|
||||
void xlsx_table_state::set_protection_select_unprotected_cells(bool val)
|
||||
{
|
||||
protection.selectUnockedCells = !val;
|
||||
}
|
||||
void xlsx_table_state::set_protection_insert_columns(bool val)
|
||||
{
|
||||
protection.insertColumns = !val;
|
||||
}
|
||||
void xlsx_table_state::set_protection_insert_rows(bool val)
|
||||
{
|
||||
protection.insertRows = !val;
|
||||
}
|
||||
void xlsx_table_state::set_protection_delete_columns(bool val)
|
||||
{
|
||||
protection.deleteColumns = !val;
|
||||
}
|
||||
void xlsx_table_state::set_protection_delete_rows(bool val)
|
||||
{
|
||||
protection.deleteRows = !val;
|
||||
}
|
||||
unsigned int xlsx_table_state::columns_count() const
|
||||
{
|
||||
return columns_count_;
|
||||
@ -487,16 +509,34 @@ void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
}
|
||||
void xlsx_table_state::serialize_protection (std::wostream & strm)
|
||||
{
|
||||
if (!bProtected) return;
|
||||
if (!protection.bEnabled) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"sheetProtection")
|
||||
{
|
||||
CP_XML_ATTR(L"sheet", 1);
|
||||
CP_XML_ATTR(L"objects", 1);
|
||||
CP_XML_ATTR(L"scenarios", 1);
|
||||
//convert protection odf->ooxml impossible without password !!!
|
||||
//CP_XML_ATTR(L"algorithmName", );
|
||||
//CP_XML_ATTR(L"hashValue", );
|
||||
//CP_XML_ATTR(L"saltValue", );
|
||||
//CP_XML_ATTR(L"spinCount", );
|
||||
|
||||
CP_XML_ATTR(L"sheet", 1);
|
||||
CP_XML_ATTR(L"objects", 0);
|
||||
CP_XML_ATTR(L"scenarios", 0);
|
||||
CP_XML_ATTR(L"formatCells", 1);
|
||||
CP_XML_ATTR(L"formatColumns", 1);
|
||||
CP_XML_ATTR(L"formatRows", 1);
|
||||
CP_XML_ATTR(L"insertColumns", protection.insertColumns);
|
||||
CP_XML_ATTR(L"insertRows", protection.insertRows);
|
||||
CP_XML_ATTR(L"insertHyperlinks", 1);
|
||||
CP_XML_ATTR(L"deleteColumns", protection.deleteColumns);
|
||||
CP_XML_ATTR(L"deleteRows", protection.deleteRows);
|
||||
CP_XML_ATTR(L"selectLockedCells", protection.selectLockedCells);
|
||||
CP_XML_ATTR(L"sort", 1);
|
||||
CP_XML_ATTR(L"autoFilter", 1);
|
||||
CP_XML_ATTR(L"pivotTables", 1);
|
||||
CP_XML_ATTR(L"selectUnlockedCells", protection.selectUnockedCells);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +128,13 @@ public:
|
||||
void set_rtl(bool val);
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
|
||||
void set_protection_select_protected_cells(bool val);
|
||||
void set_protection_select_unprotected_cells(bool val);
|
||||
void set_protection_insert_columns(bool val);
|
||||
void set_protection_insert_rows(bool val);
|
||||
void set_protection_delete_columns(bool val);
|
||||
void set_protection_delete_rows(bool val);
|
||||
|
||||
void start_column (unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
void start_row (const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
|
||||
@ -212,9 +219,18 @@ public:
|
||||
private:
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
bool bProtected;
|
||||
std::wstring protect_key;
|
||||
std::wstring protect_key_algorithm;
|
||||
struct _protection
|
||||
{
|
||||
bool bEnabled = false;
|
||||
std::wstring protect_key;
|
||||
std::wstring protect_key_algorithm;
|
||||
bool insertColumns = true;
|
||||
bool insertRows = true;
|
||||
bool deleteColumns = true;
|
||||
bool deleteRows = true;
|
||||
bool selectLockedCells = false;
|
||||
bool selectUnockedCells = false;
|
||||
} protection;
|
||||
bool bRTL;
|
||||
bool bEndTable;
|
||||
bool bHidden;
|
||||
|
||||
@ -139,6 +139,13 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
std::wstringstream workbook_content;
|
||||
|
||||
if (sheets_.empty())
|
||||
{ // owncloud new document ... oO
|
||||
start_table(L"Sheet1", L"");
|
||||
current_sheet().cols() << L"<col min=\"1\" max=\"1024\" width=\"11.6\" customWidth=\"0\"/>";
|
||||
end_table();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
xlsx_xml_worksheet_ptr& sheet = sheets_[i];
|
||||
@ -234,6 +241,13 @@ void xlsx_conversion_context::end_document()
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
if (table_structure_protected_)
|
||||
{
|
||||
CP_XML_NODE(L"workbookProtection")
|
||||
{
|
||||
CP_XML_ATTR(L"lockStructure", 1);
|
||||
}
|
||||
}
|
||||
serialize_bookViews (CP_XML_STREAM());
|
||||
|
||||
CP_XML_NODE(L"sheets")
|
||||
@ -602,7 +616,10 @@ void xlsx_conversion_context::start_office_spreadsheet(const odf_reader::office_
|
||||
{
|
||||
spreadsheet_ = elm;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_table_structure_protected(bool val)
|
||||
{
|
||||
table_structure_protected_ = val;
|
||||
}
|
||||
const odf_reader::office_element * xlsx_conversion_context::get_spreadsheet()
|
||||
{
|
||||
return spreadsheet_;
|
||||
@ -665,7 +682,27 @@ int xlsx_conversion_context::get_current_cell_style_id()
|
||||
{
|
||||
return get_table_context().get_current_cell_style_id();
|
||||
}
|
||||
int xlsx_conversion_context::get_dxfId_style(const std::wstring &style_name)
|
||||
{
|
||||
if (style_name.empty()) return -1;
|
||||
|
||||
int dxfId = -1;
|
||||
odf_reader::style_instance * instStyle =
|
||||
root()->odf_context().styleContainer().style_by_name(style_name, odf_types::style_family::TableCell, false);
|
||||
|
||||
if (!instStyle)
|
||||
instStyle = root()->odf_context().styleContainer().style_by_display_name(style_name, odf_types::style_family::TableCell, false);
|
||||
|
||||
if (instStyle)
|
||||
{
|
||||
odf_reader::text_format_properties_content_ptr textFormats = calc_text_properties_content(instStyle);
|
||||
odf_reader::graphic_format_properties graphicFormats = calc_graphic_properties_content(instStyle);
|
||||
odf_reader::style_table_cell_properties_attlist cellFormats = calc_table_cell_properties(instStyle);
|
||||
|
||||
dxfId = get_style_manager().dxfId(textFormats, &graphicFormats, &cellFormats);
|
||||
}
|
||||
return dxfId;
|
||||
}
|
||||
std::pair<double, double> xlsx_conversion_context::getMaxDigitSize()
|
||||
{
|
||||
if (maxDigitSize_.first <= 0.1)
|
||||
@ -732,7 +769,10 @@ xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
|
||||
{
|
||||
return get_table_context().get_drawing_context();
|
||||
}
|
||||
|
||||
xlsx_conditionalFormatting_context & xlsx_conversion_context::get_conditionalFormatting_context()
|
||||
{
|
||||
return get_table_context().state()->get_conditionalFormatting_context();
|
||||
}
|
||||
xlsx_drawing_context_handle_ptr & xlsx_conversion_context::get_drawing_context_handle()
|
||||
{
|
||||
return drawing_context_handle_;
|
||||
@ -784,39 +824,6 @@ void xlsx_conversion_context::add_pivot_sheet_source (const std::wstring & sheet
|
||||
{//ващето в либре жесткая привязка что на одном листе тока одна сводная может быть ..
|
||||
mapPivotsTableView_.insert(std::make_pair(sheet_name, index_table_view));
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_conditional_format(std::wstring ref)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().add(ref);
|
||||
}
|
||||
void xlsx_conversion_context::start_conditional_format_rule(int type)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().add_rule(type);
|
||||
}
|
||||
void xlsx_conversion_context::set_conditional_format_formula (std::wstring f)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().set_formula(f);
|
||||
}
|
||||
void xlsx_conversion_context::set_conditional_format_dxf (int dxfId)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().set_dxf(dxfId);
|
||||
}
|
||||
void xlsx_conversion_context::add_conditional_format_entry (int type, std::wstring value)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().add_sfv(type, value);
|
||||
}
|
||||
void xlsx_conversion_context::set_conditional_format_showval (bool val)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().set_showVal(val);
|
||||
}
|
||||
void xlsx_conversion_context::add_conditional_format_color (std::wstring col)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().add_color(col);
|
||||
}
|
||||
void xlsx_conversion_context::set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max)
|
||||
{
|
||||
get_table_context().state()->get_conditionalFormatting_context().set_dataBar(min, max);
|
||||
}
|
||||
void xlsx_conversion_context::add_jsaProject(const std::string &content)
|
||||
{
|
||||
if (content.empty()) return;
|
||||
|
||||
@ -83,6 +83,8 @@ public:
|
||||
void start_document ();
|
||||
void end_document ();
|
||||
|
||||
void set_table_structure_protected(bool val);
|
||||
|
||||
void start_chart(std::wstring name);
|
||||
void end_chart ();
|
||||
|
||||
@ -115,9 +117,6 @@ public:
|
||||
|
||||
void start_table_cell (const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned);
|
||||
void end_table_cell ();
|
||||
|
||||
void set_current_cell_style_id (unsigned int xfId);
|
||||
int get_current_cell_style_id ();
|
||||
|
||||
void start_table_covered_cell ();
|
||||
void end_table_covered_cell ();
|
||||
@ -129,24 +128,16 @@ public:
|
||||
|
||||
void start_hyperlink (const std::wstring & styleName);
|
||||
void end_hyperlink (std::wstring const & href);
|
||||
|
||||
void set_current_cell_style_id (unsigned int xfId);
|
||||
int get_current_cell_style_id ();
|
||||
|
||||
size_t get_default_cell_style() const { return default_style_; }
|
||||
int get_dxfId_style(const std::wstring &style_name);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
void add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view);
|
||||
|
||||
void start_conditional_format (std::wstring ref);
|
||||
void end_conditional_format (){}
|
||||
|
||||
void start_conditional_format_rule (int type);
|
||||
void end_conditional_format_rule () {}
|
||||
|
||||
void set_conditional_format_formula (std::wstring f);
|
||||
void set_conditional_format_dxf (int dxfId);
|
||||
void set_conditional_format_showval (bool val);
|
||||
|
||||
void add_conditional_format_color (std::wstring col);
|
||||
void add_conditional_format_entry (int type, std::wstring value);
|
||||
void set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max);
|
||||
|
||||
void add_jsaProject (const std::string &content);
|
||||
|
||||
void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props);
|
||||
@ -155,7 +146,6 @@ public:
|
||||
|
||||
void add_table_part(const std::wstring & table) {table_parts_.push_back(table);}
|
||||
size_t get_table_parts_size() {return table_parts_.size();}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
@ -172,26 +162,25 @@ public:
|
||||
const xlsx_table_context & get_table_context() const { return xlsx_table_context_; }
|
||||
xlsx_style_manager & get_style_manager() { return xlsx_style_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
math_context & get_math_context() { return math_context_; }
|
||||
num_format_context & get_num_format_context() { return num_format_context_; }
|
||||
size_t get_default_cell_style() const { return default_style_; }
|
||||
xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; }
|
||||
xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;}
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
xlsx_drawing_context & get_drawing_context();
|
||||
xlsx_comments_context & get_comments_context();
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context();
|
||||
|
||||
|
||||
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
|
||||
xlsx_dataValidations_context & get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
|
||||
void set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle);
|
||||
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
void set_mediaitems(mediaitems_ptr &items);
|
||||
|
||||
void set_mediaitems(mediaitems_ptr &items);
|
||||
//---------------------------------------
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
std::map<std::wstring, int> mapUsedNames_;
|
||||
private:
|
||||
@ -202,12 +191,14 @@ private:
|
||||
const odf_reader::office_element *spreadsheet_;
|
||||
odf_reader::odf_document *odf_document_;
|
||||
|
||||
bool table_structure_protected_ = false;
|
||||
|
||||
std::vector<xlsx_xml_worksheet_ptr> sheets_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
std::vector<std::wstring> table_parts_;
|
||||
|
||||
std::wstringstream defaultOutput_;
|
||||
std::pair<double, double> maxDigitSize_;
|
||||
std::pair<double, double> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
|
||||
@ -113,13 +113,13 @@ void calcext_conditional_format::xlsx_convert(oox::xlsx_conversion_context & Con
|
||||
{
|
||||
if (!calcext_target_range_address_) return;
|
||||
|
||||
Context.start_conditional_format(*calcext_target_range_address_);
|
||||
Context.get_conditionalFormatting_context().start(*calcext_target_range_address_);
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.end_conditional_format();
|
||||
Context.get_conditionalFormatting_context().end();
|
||||
}
|
||||
|
||||
// calcext_data_bar
|
||||
@ -130,7 +130,7 @@ const wchar_t * calcext_data_bar::name = L"data-bar";
|
||||
void calcext_data_bar::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"calcext:show-value", calcext_show_value_);
|
||||
calcext_data_bar_attr_.add_attributes(Attributes);
|
||||
attr_.add_attributes(Attributes);
|
||||
|
||||
}
|
||||
void calcext_data_bar::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -139,20 +139,19 @@ void calcext_data_bar::add_child_element( xml::sax * Reader, const std::wstring
|
||||
}
|
||||
void calcext_data_bar::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_conditional_format_rule(2);
|
||||
Context.get_conditionalFormatting_context().add_rule(2);
|
||||
if (calcext_show_value_)
|
||||
Context.set_conditional_format_showval(*calcext_show_value_);
|
||||
Context.get_conditionalFormatting_context().set_showVal(*calcext_show_value_);
|
||||
|
||||
if (calcext_data_bar_attr_.calcext_positive_color_)
|
||||
Context.add_conditional_format_color(L"ff" + calcext_data_bar_attr_.calcext_positive_color_->get_hex_value());
|
||||
if (attr_.calcext_positive_color_)
|
||||
Context.get_conditionalFormatting_context().add_color(L"ff" + attr_.calcext_positive_color_->get_hex_value());
|
||||
|
||||
Context.set_conditional_format_dataBar(calcext_data_bar_attr_.calcext_min_length_, calcext_data_bar_attr_.calcext_max_length_);
|
||||
Context.get_conditionalFormatting_context().set_dataBar(attr_.calcext_min_length_, attr_.calcext_max_length_);
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.end_conditional_format_rule();
|
||||
}
|
||||
// calcext_color_scale
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -168,12 +167,11 @@ void calcext_color_scale::add_child_element( xml::sax * Reader, const std::wstri
|
||||
}
|
||||
void calcext_color_scale::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_conditional_format_rule(3);
|
||||
Context.get_conditionalFormatting_context().add_rule(3);
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.end_conditional_format_rule();
|
||||
}
|
||||
// calcext_icon_set
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -183,7 +181,7 @@ const wchar_t * calcext_icon_set::name = L"icon-set";
|
||||
void calcext_icon_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"calcext:show-value", calcext_show_value_);
|
||||
calcext_icon_set_attr_.add_attributes(Attributes);
|
||||
attr_.add_attributes(Attributes);
|
||||
}
|
||||
void calcext_icon_set::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
@ -191,15 +189,15 @@ void calcext_icon_set::add_child_element( xml::sax * Reader, const std::wstring
|
||||
}
|
||||
void calcext_icon_set::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_conditional_format_rule(4);
|
||||
Context.get_conditionalFormatting_context().add_rule(4);
|
||||
|
||||
if (calcext_show_value_)
|
||||
Context.set_conditional_format_showval(*calcext_show_value_);
|
||||
Context.get_conditionalFormatting_context().set_showVal(*calcext_show_value_);
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.end_conditional_format_rule();
|
||||
}
|
||||
|
||||
// calcext_formatting_entry
|
||||
@ -219,7 +217,7 @@ void calcext_formatting_entry::add_child_element( xml::sax * Reader, const std::
|
||||
void calcext_formatting_entry::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
calcext_type::type type_ = calcext_type_.get_value_or(calcext_type::Number).get_type();
|
||||
Context.add_conditional_format_entry((int)type_, calcext_value_.get_value_or(L""));
|
||||
Context.get_conditionalFormatting_context().add_sfv((int)type_, calcext_value_.get_value_or(L""));
|
||||
}
|
||||
|
||||
// calcext_color_scale_entry
|
||||
@ -240,12 +238,12 @@ void calcext_color_scale_entry::add_child_element( xml::sax * Reader, const std:
|
||||
void calcext_color_scale_entry::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (calcext_color_)
|
||||
Context.add_conditional_format_color(L"ff" + calcext_color_->get_hex_value());
|
||||
Context.get_conditionalFormatting_context().add_color(L"ff" + calcext_color_->get_hex_value());
|
||||
else
|
||||
Context.add_conditional_format_color(L"ffffffff");
|
||||
Context.get_conditionalFormatting_context().add_color(L"ffffffff");
|
||||
|
||||
calcext_type::type type_ = calcext_type_.get_value_or(calcext_type::Number).get_type();
|
||||
Context.add_conditional_format_entry((int)type_, calcext_value_.get_value_or(L""));
|
||||
Context.get_conditionalFormatting_context().add_sfv((int)type_, calcext_value_.get_value_or(L""));
|
||||
}
|
||||
// calcext_condition
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -254,7 +252,7 @@ const wchar_t * calcext_condition::name = L"condition";
|
||||
|
||||
void calcext_condition::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
calcext_condition_attr_.add_attributes(Attributes);
|
||||
attr_.add_attributes(Attributes);
|
||||
}
|
||||
void calcext_condition::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
@ -262,28 +260,18 @@ void calcext_condition::add_child_element( xml::sax * Reader, const std::wstring
|
||||
}
|
||||
void calcext_condition::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_conditional_format_rule(1);
|
||||
Context.get_conditionalFormatting_context().add_rule(1);
|
||||
|
||||
if (calcext_condition_attr_.calcext_value_)
|
||||
if (attr_.calcext_value_)
|
||||
{
|
||||
Context.set_conditional_format_formula(*calcext_condition_attr_.calcext_value_);
|
||||
Context.get_conditionalFormatting_context().set_formula(*attr_.calcext_value_);
|
||||
}
|
||||
std::wstring style_name = calcext_condition_attr_.calcext_apply_style_name_.get_value_or(L"");
|
||||
std::wstring style_name = attr_.calcext_apply_style_name_.get_value_or(L"");
|
||||
|
||||
style_instance * instStyle =
|
||||
Context.root()->odf_context().styleContainer().style_by_name(style_name, style_family::TableCell, false);
|
||||
if (!instStyle)
|
||||
instStyle = Context.root()->odf_context().styleContainer().style_by_display_name(style_name, style_family::TableCell, false);
|
||||
if (instStyle)
|
||||
{
|
||||
text_format_properties_content_ptr textFormats = calc_text_properties_content (instStyle);
|
||||
graphic_format_properties graphicFormats = calc_graphic_properties_content (instStyle);
|
||||
style_table_cell_properties_attlist cellFormats = calc_table_cell_properties (instStyle);
|
||||
|
||||
int dxfId = Context.get_style_manager().dxfId(textFormats, &graphicFormats, &cellFormats);
|
||||
Context.set_conditional_format_dxf(dxfId);
|
||||
}
|
||||
Context.end_conditional_format_rule();
|
||||
int dxfId = Context.get_dxfId_style(style_name);
|
||||
|
||||
if (dxfId >= 0)
|
||||
Context.get_conditionalFormatting_context().set_dxf(dxfId);
|
||||
}
|
||||
// calcext_condition
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -292,7 +280,7 @@ const wchar_t * calcext_date_is::name = L"date-is";
|
||||
|
||||
void calcext_date_is::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
calcext_date_is_attr_.add_attributes(Attributes);
|
||||
attr_.add_attributes(Attributes);
|
||||
}
|
||||
void calcext_date_is::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
@ -300,8 +288,16 @@ void calcext_date_is::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
}
|
||||
void calcext_date_is::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
//Context.start_conditional_format_rule(5);
|
||||
//Context.end_conditional_format_rule();
|
||||
Context.get_conditionalFormatting_context().add_rule(5);
|
||||
|
||||
Context.get_conditionalFormatting_context().set_time_period(attr_.calcext_date_.get_value_or(odf_types::time_period::today).get_type());
|
||||
|
||||
std::wstring style_name = attr_.calcext_style_.get_value_or(L"");
|
||||
|
||||
int dxfId = Context.get_dxfId_style(style_name);
|
||||
|
||||
if (dxfId >= 0)
|
||||
Context.get_conditionalFormatting_context().set_dxf(dxfId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
|
||||
#include "datatypes/iconset_type.h"
|
||||
#include "datatypes/calcext_type.h"
|
||||
#include "datatypes/timeperiod.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
@ -87,7 +88,7 @@ public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
_CP_OPT(std::wstring) calcext_style_;
|
||||
_CP_OPT(std::wstring) calcext_date_;
|
||||
_CP_OPT(odf_types::time_period) calcext_date_;
|
||||
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -151,7 +152,7 @@ public:
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(bool) calcext_show_value_;
|
||||
calcext_icon_set_attr calcext_icon_set_attr_;
|
||||
calcext_icon_set_attr attr_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
@ -173,7 +174,7 @@ public:
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(bool) calcext_show_value_;
|
||||
calcext_data_bar_attr calcext_data_bar_attr_;
|
||||
calcext_data_bar_attr attr_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar)
|
||||
@ -212,7 +213,7 @@ public:
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
|
||||
calcext_date_is_attr calcext_date_is_attr_;
|
||||
calcext_date_is_attr attr_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is)
|
||||
|
||||
@ -231,7 +232,7 @@ public:
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
|
||||
calcext_condition_attr calcext_condition_attr_;
|
||||
calcext_condition_attr attr_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_condition)
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ text_format_properties_content_ptr calc_text_properties_content(const std::vecto
|
||||
for (size_t i = 0; i < textProps.size(); i++)
|
||||
{
|
||||
if (textProps[i])
|
||||
result->apply_from(textProps[i]->content());
|
||||
result->apply_from(textProps[i]->content_);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -106,15 +106,23 @@ void object_odf_context::set_style_name(std::wstring const & val)
|
||||
{
|
||||
style_name_ = val;
|
||||
}
|
||||
void object_odf_context::start_axis(std::wstring const & dimensionName, std::wstring const & name, std::wstring const & styleName)
|
||||
void object_odf_context::start_axis(std::wstring const & dimension, std::wstring const & name, std::wstring const & styleName)
|
||||
{
|
||||
in_axis_ = true;
|
||||
|
||||
axis ax;
|
||||
ax.dimension_ = dimensionName;
|
||||
ax.dimension_ = dimension;
|
||||
ax.chart_name_ = name;
|
||||
ax.style_name_ = styleName;
|
||||
|
||||
if (ax.dimension_.empty())
|
||||
{
|
||||
if (std::wstring::npos != ax.chart_name_.find(L"primary-"))
|
||||
{
|
||||
ax.dimension_ = ax.chart_name_.substr(8);
|
||||
}
|
||||
}
|
||||
|
||||
axises_.push_back(ax);
|
||||
}
|
||||
|
||||
@ -451,7 +459,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
}
|
||||
|
||||
std::wstring formatCode = L"General";
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat, strAxisType;
|
||||
_CP_OPT(int) nTypeFormat;
|
||||
_CP_OPT(bool) bLinkData;
|
||||
|
||||
@ -459,6 +467,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
odf_reader::GetProperty(series_[i].properties_, L"percentage_num_format", strPercentFormat);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", bLinkData);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"data-label-number", nTypeFormat);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"axis-type", strAxisType);
|
||||
|
||||
if ((nTypeFormat) && (*nTypeFormat == 2) && strPercentFormat)
|
||||
{
|
||||
@ -480,11 +489,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
if (last_set_class == chart_class::bubble)
|
||||
{ //bubble(x)
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(strAxisType ? false : true));
|
||||
current->set_values_series (4, domain_cash);
|
||||
//y
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(strAxisType ? false : true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
else
|
||||
@ -492,14 +501,14 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
if (false == domain_cash.empty() || false == cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(strAxisType ? false : true));
|
||||
current->set_values_series (2, domain_cash);
|
||||
}
|
||||
//y
|
||||
if (false == cell_cash.empty() || false == cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(strAxisType ? false : true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
}
|
||||
@ -507,7 +516,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
else
|
||||
{ //common
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(strAxisType ? false : true));
|
||||
current->set_values_series(1, cell_cash);
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class document_context;
|
||||
|
||||
|
||||
bool create_element_and_read(xml::sax * Reader,
|
||||
const std::wstring & Ns,
|
||||
@ -50,7 +50,8 @@ bool create_element_and_read(xml::sax * Reader,
|
||||
{
|
||||
if (office_element_ptr elm = office_element_creator::get()->create(Ns, Name, Context, isRoot))
|
||||
{
|
||||
elm->read_sax( Reader );
|
||||
elm->afterCreate();
|
||||
elm->read_sax( Reader );
|
||||
elm->afterReadContent();
|
||||
|
||||
if (_Element) // элемент читается повторно
|
||||
@ -63,7 +64,7 @@ bool create_element_and_read(xml::sax * Reader,
|
||||
}
|
||||
else
|
||||
{
|
||||
_CP_LOG << L"[error] : create element failed (" << Ns << L":" << Name << L")\n";
|
||||
_CP_LOG << L"[error] : create element failed (" << Ns << L":" << Name << L")\n";
|
||||
|
||||
not_applicable_element(L"[!!!]", Reader, Ns, Name);
|
||||
}
|
||||
@ -85,8 +86,37 @@ bool create_element_and_read(xml::sax * Reader,
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
void office_element::afterCreate()
|
||||
{
|
||||
if (!context_) return;
|
||||
|
||||
ElementType type_ = this->get_type();
|
||||
|
||||
context_->levels.push_back(this);
|
||||
}
|
||||
void office_element::afterReadContent()
|
||||
{
|
||||
if (!context_) return;
|
||||
|
||||
ElementType type_ = this->get_type();
|
||||
|
||||
std::wstring style = element_style_name.get_value_or(L"");
|
||||
|
||||
if ((type_ == typeTextH || type_ == typeTextP) && element_style_name)
|
||||
{
|
||||
if ((context_->last_paragraph) && (!context_->last_paragraph->next_element_style_name))
|
||||
{
|
||||
context_->last_paragraph->next_element_style_name = element_style_name;
|
||||
}
|
||||
|
||||
context_->last_paragraph = this;
|
||||
}
|
||||
|
||||
if (false == context_->levels.empty())
|
||||
context_->levels.pop_back();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,15 +400,25 @@ void common_xlink_attlist::serialize(CP_ATTR_NODE)
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool common_value_and_type_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
bool common_value_and_type_attlist::add_attributes(const xml::attributes_wc_ptr & Attributes)
|
||||
{
|
||||
CP_APPLY_ATTR(L"office:value-type" , office_value_type_);
|
||||
CP_APPLY_ATTR(L"office:value" , office_value_);
|
||||
CP_APPLY_ATTR(L"office:currency" , office_currency_);
|
||||
CP_APPLY_ATTR(L"office:date-value" , office_date_value_);
|
||||
CP_APPLY_ATTR(L"office:time-value" , office_time_value_);
|
||||
CP_APPLY_ATTR(L"office:boolean-value", office_boolean_value_);
|
||||
CP_APPLY_ATTR(L"office:string-value", office_string_value_);
|
||||
CP_APPLY_ATTR(L"office:value-type", office_value_type_);
|
||||
CP_APPLY_ATTR(L"office:value", office_value_);
|
||||
CP_APPLY_ATTR(L"office:currency", office_currency_);
|
||||
CP_APPLY_ATTR(L"office:date-value", office_date_value_);
|
||||
CP_APPLY_ATTR(L"office:time-value", office_time_value_);
|
||||
CP_APPLY_ATTR(L"office:boolean-value", office_boolean_value_);
|
||||
CP_APPLY_ATTR(L"office:string-value", office_string_value_);
|
||||
|
||||
if (!office_value_)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:value", office_value_); //openoffice xml 1.0
|
||||
}
|
||||
|
||||
if (!office_value_type_)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:value-type", office_value_type_); //openoffice xml 1.0
|
||||
}
|
||||
|
||||
if (office_value_type_ || office_value_ || office_currency_ || office_date_value_ || office_time_value_
|
||||
|| office_boolean_value_ || office_string_value_) return true;
|
||||
|
||||
86
ASCOfficeOdfFile/src/odf/datatypes/stylecellprotect.cpp
Normal file
86
ASCOfficeOdfFile/src/odf/datatypes/stylecellprotect.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "stylecellprotect.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const style_cell_protect & _Val)
|
||||
{
|
||||
switch (_Val.get_type())
|
||||
{
|
||||
case style_cell_protect::none:
|
||||
_Wostream << L"none";
|
||||
break;
|
||||
case style_cell_protect::formula_hidden:
|
||||
_Wostream << L"formula-hidden";
|
||||
break;
|
||||
case style_cell_protect::hidden_and_protected:
|
||||
_Wostream << L"hidden-and-protected";
|
||||
break;
|
||||
case style_cell_protect::protected_:
|
||||
_Wostream << L"protected";
|
||||
break;
|
||||
case style_cell_protect::protected_formula_hidden:
|
||||
_Wostream << L"protected formula-hidden";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
style_cell_protect style_cell_protect::parse(const std::wstring & Str)
|
||||
{
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if (tmp == L"formula_hidden")
|
||||
return style_cell_protect(formula_hidden);
|
||||
else if (tmp == L"hidden-and-protected")
|
||||
return style_cell_protect(hidden_and_protected);
|
||||
else if (tmp == L"protected")
|
||||
return style_cell_protect(protected_);
|
||||
else if (tmp == L"protected formula-hidden" ||
|
||||
tmp == L"formula-hidden protected")
|
||||
return style_cell_protect(protected_formula_hidden);
|
||||
else
|
||||
{
|
||||
return style_cell_protect(none);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} }
|
||||
@ -1,55 +1,75 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "../Reader/Records.h"
|
||||
|
||||
class CRecordRoundTripColorMappingAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
std::pair<boost::shared_array<unsigned char>, _INT32> data;
|
||||
|
||||
CRecordRoundTripColorMappingAtom()
|
||||
{
|
||||
}
|
||||
|
||||
~CRecordRoundTripColorMappingAtom()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
data = std::make_pair(boost::shared_array<unsigned char>(new unsigned char[m_oHeader.RecLen]), m_oHeader.RecLen);
|
||||
pStream->read(data.first.get(), data.second);
|
||||
}
|
||||
};
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include "odfattributes.h"
|
||||
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
class style_cell_protect
|
||||
{
|
||||
public:
|
||||
enum type
|
||||
{
|
||||
none,
|
||||
formula_hidden,
|
||||
hidden_and_protected,
|
||||
protected_,
|
||||
protected_formula_hidden
|
||||
};
|
||||
|
||||
style_cell_protect() {}
|
||||
|
||||
style_cell_protect(type _Type) : type_(_Type)
|
||||
{}
|
||||
|
||||
type get_type() const
|
||||
{
|
||||
return type_;
|
||||
};
|
||||
|
||||
static style_cell_protect parse(const std::wstring & Str);
|
||||
|
||||
private:
|
||||
type type_;
|
||||
};
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const style_cell_protect & _Val);
|
||||
|
||||
}
|
||||
|
||||
APPLY_PARSE_XML_ATTRIBUTES(odf_types::style_cell_protect);
|
||||
|
||||
}
|
||||
@ -126,7 +126,7 @@ style_family style_family::parse(const std::wstring & Str)
|
||||
return style_family( Default );
|
||||
else if (tmp == L"drawing-page")
|
||||
return style_family( DrawingPage );
|
||||
else if (tmp == L"graphic")
|
||||
else if (tmp == L"graphic" || tmp == L"graphics")
|
||||
return style_family( Graphic );
|
||||
else if (tmp == L"presentation")
|
||||
return style_family( Presentation );
|
||||
|
||||
91
ASCOfficeOdfFile/src/odf/datatypes/timeperiod.cpp
Normal file
91
ASCOfficeOdfFile/src/odf/datatypes/timeperiod.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "timeperiod.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const time_period & _Val)
|
||||
{
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case time_period::yesterday: _Wostream << L"yesterday"; break;
|
||||
case time_period::tomorrow: _Wostream << L"tomorrow"; break;
|
||||
case time_period::last7Days: _Wostream << L"last-7-days"; break;
|
||||
case time_period::thisMonth: _Wostream << L"this-month"; break;
|
||||
case time_period::lastMonth: _Wostream << L"last-month"; break;
|
||||
case time_period::nextMonth: _Wostream << L"next-month"; break;
|
||||
case time_period::thisWeek: _Wostream << L"this-week"; break;
|
||||
case time_period::lastWeek: _Wostream << L"last-week"; break;
|
||||
case time_period::nextWeek: _Wostream << L"next-week"; break;
|
||||
case time_period::today: _Wostream << L"today"; break;
|
||||
default:
|
||||
_Wostream << L"today"; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
time_period time_period::parse(const std::wstring & Str)
|
||||
{
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if (tmp == L"today")
|
||||
return time_period(today);
|
||||
else if (tmp == L"yesterday")
|
||||
return time_period(yesterday);
|
||||
else if (tmp == L"tomorrow")
|
||||
return time_period(tomorrow);
|
||||
else if (tmp == L"last-7-days")
|
||||
return time_period(last7Days);
|
||||
else if (tmp == L"this-month")
|
||||
return time_period(thisMonth);
|
||||
else if (tmp == L"last-month")
|
||||
return time_period(lastMonth);
|
||||
else if (tmp == L"next-month")
|
||||
return time_period(nextMonth);
|
||||
else if (tmp == L"this-week")
|
||||
return time_period(thisWeek);
|
||||
else if (tmp == L"last-week")
|
||||
return time_period(lastWeek);
|
||||
else if (tmp == L"next-week")
|
||||
return time_period(nextWeek);
|
||||
else
|
||||
{
|
||||
return time_period(today);
|
||||
}
|
||||
}
|
||||
|
||||
} }
|
||||
83
ASCOfficeOdfFile/src/odf/datatypes/timeperiod.h
Normal file
83
ASCOfficeOdfFile/src/odf/datatypes/timeperiod.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include "odfattributes.h"
|
||||
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
class time_period
|
||||
{
|
||||
public:
|
||||
enum type
|
||||
{
|
||||
today = 0,
|
||||
yesterday = 1,
|
||||
tomorrow = 2,
|
||||
last7Days = 3,
|
||||
thisMonth = 4,
|
||||
lastMonth = 5,
|
||||
nextMonth = 6,
|
||||
thisWeek = 7,
|
||||
lastWeek = 8,
|
||||
nextWeek = 9
|
||||
|
||||
};
|
||||
|
||||
time_period() {}
|
||||
|
||||
time_period(type _Type) : type_(_Type)
|
||||
{}
|
||||
|
||||
type get_type() const
|
||||
{
|
||||
return type_;
|
||||
};
|
||||
static time_period parse(const std::wstring & Str);
|
||||
|
||||
private:
|
||||
type type_;
|
||||
|
||||
};
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const time_period & _Val);
|
||||
|
||||
}
|
||||
|
||||
APPLY_PARSE_XML_ATTRIBUTES(odf_types::time_period);
|
||||
|
||||
}
|
||||
|
||||
@ -29,53 +29,40 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "documentcontext.h"
|
||||
#include "office_elements.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class document_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl() : last_element_(NULL) {}
|
||||
|
||||
public:
|
||||
void set_last_element(office_element* elem)
|
||||
{
|
||||
last_element_ = elem;
|
||||
}
|
||||
|
||||
office_element* get_last_element()
|
||||
{
|
||||
return last_element_;
|
||||
}
|
||||
|
||||
private:
|
||||
office_element * last_element_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
document_context::document_context() : impl_( new document_context::Impl() )
|
||||
|
||||
document_context::document_context() : last_paragraph(NULL)
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
|
||||
document_context::~document_context()
|
||||
{
|
||||
delete impl_;
|
||||
}
|
||||
void document_context::set_last_element(office_element* elem)
|
||||
{
|
||||
return impl_->set_last_element(elem);
|
||||
levels.clear();
|
||||
last_paragraph = NULL;
|
||||
}
|
||||
office_element* document_context::get_last_element()
|
||||
{
|
||||
return impl_->get_last_element();
|
||||
if (levels.size() > 1)
|
||||
return levels[levels.size() - 2];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
office_element* document_context::get_last_paragraph()
|
||||
{
|
||||
for (int i = levels.size() - 2; i >= 0; i--)
|
||||
{
|
||||
if (levels[i]->get_type() == typeTextH || levels[i]->get_type() == typeTextP)
|
||||
{
|
||||
return levels[i];
|
||||
}
|
||||
}
|
||||
|
||||
return last_paragraph;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
@ -42,14 +45,13 @@ public:
|
||||
document_context();
|
||||
virtual ~document_context();
|
||||
|
||||
void set_last_element(office_element* elem);
|
||||
office_element* get_last_paragraph();
|
||||
office_element* get_last_element();
|
||||
|
||||
int level;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
Impl * impl_;
|
||||
std::wstring office_class_; //openoffice xml 1.0
|
||||
|
||||
std::vector<office_element*> levels;
|
||||
office_element* last_paragraph;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -90,7 +90,14 @@ const wchar_t * draw_image::name = L"image";
|
||||
|
||||
void draw_image::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_image_attlist_.add_attributes(Attributes);
|
||||
office_element* last_element = getContext()->get_last_element();
|
||||
if ((!last_element) || (last_element->get_type() != typeDrawFrame))
|
||||
{
|
||||
draw_frame_ptr = office_element_creator::get()->create(L"draw", L"frame", getContext(), false);
|
||||
draw_frame_ptr->add_attributes(Attributes);
|
||||
}
|
||||
|
||||
draw_image_attlist_.add_attributes(Attributes);
|
||||
xlink_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
@ -325,6 +332,12 @@ std::wostream & draw_text_box::text_to_stream(std::wostream & _Wostream, bool bX
|
||||
|
||||
void draw_text_box::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
office_element* last_element = getContext()->get_last_element();
|
||||
if ((!last_element) || (last_element->get_type() != typeDrawFrame))
|
||||
{
|
||||
draw_frame_ptr = office_element_creator::get()->create(L"draw", L"frame", getContext(), false);
|
||||
draw_frame_ptr->add_attributes(Attributes);
|
||||
}
|
||||
draw_text_box_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
@ -340,7 +353,14 @@ const wchar_t * draw_object::name = L"object";
|
||||
|
||||
void draw_object::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_object_attlist_.add_attributes(Attributes);
|
||||
office_element* last_element = getContext()->get_last_element();
|
||||
if ((!last_element) || (last_element->get_type() != typeDrawFrame))
|
||||
{
|
||||
draw_frame_ptr = office_element_creator::get()->create(L"draw", L"frame", getContext(), false);
|
||||
draw_frame_ptr->add_attributes(Attributes);
|
||||
}
|
||||
|
||||
draw_object_attlist_.add_attributes(Attributes);
|
||||
xlink_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
@ -390,7 +410,7 @@ void draw_object_ole::detectObject(const std::wstring &fileName, std::wstring &p
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
while (sz_obj > 0)
|
||||
while (sz_obj > 4)
|
||||
{
|
||||
_UINT32 sz = 0;
|
||||
pStream->read((unsigned char*)&sz, 4); sz_obj-= 4;
|
||||
@ -440,6 +460,8 @@ std::wstring draw_object::office_convert(odf_document_ptr odfDocument, int type)
|
||||
std::wstring folderPath = odfDocument->get_folder();
|
||||
std::wstring objectOutPath = NSDirectory::CreateDirectoryWithUniqueName(folderPath);
|
||||
|
||||
if (objectOutPath.empty()) return L"";
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
oox::package::docx_document outputDocx;
|
||||
|
||||
@ -83,9 +83,10 @@ private:
|
||||
draw_image_attlist draw_image_attlist_;
|
||||
odf_types::common_xlink_attlist xlink_attlist_;
|
||||
|
||||
office_element_ptr office_binary_data_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr office_binary_data_;
|
||||
|
||||
office_element_ptr draw_frame_ptr; //openoffice xml 1.0
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_image);
|
||||
@ -172,10 +173,9 @@ public:
|
||||
office_element_ptr_array content_;
|
||||
|
||||
office_element_ptr office_event_listeners_;
|
||||
// в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
|
||||
office_element_ptr draw_glue_point_;
|
||||
|
||||
office_element_ptr draw_glue_point_;
|
||||
office_element_ptr draw_image_map_;
|
||||
//office_element_ptr draw_chart_map_;
|
||||
|
||||
office_element_ptr draw_contour_; // draw-contour-polygon or draw-contour-path
|
||||
|
||||
@ -189,8 +189,10 @@ public:
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
void docx_convert_start(oox::docx_conversion_context & Context);
|
||||
void docx_convert_end(oox::docx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_frame);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
@ -270,13 +272,14 @@ public:
|
||||
draw_text_box_attlist draw_text_box_attlist_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
office_element_ptr draw_frame_ptr; //openoffice xml 1.0
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
virtual void add_space(const std::wstring & Text){}
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_text_box);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
@ -315,6 +318,8 @@ private:
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
std::wstring office_convert(odf_document_ptr odfDocument, int type);
|
||||
|
||||
office_element_ptr draw_frame_ptr; //openoffice xml 1.0
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_object);
|
||||
|
||||
@ -167,9 +167,9 @@ length ComputeContextWidth(const style_page_layout_properties * pageProperties
|
||||
columnGap = styleColumns->fo_column_gap_.get_value_or( length(0, length::pt ));
|
||||
}
|
||||
}
|
||||
//$pageWidth - $pageLeftMargin - $pageRightMargin - $columnGap
|
||||
//$pageWidth - $pageLeftMargin - $pageRightMargin - $columnGap
|
||||
return length( (pageWidth.get_value_or(length(0, length::pt)).get_value_unit(length::pt) -
|
||||
pageMarginRight.get_value_or(length(0, length::pt)).get_value_unit(length::pt) -
|
||||
pageMarginRight.get_value_or(length(0, length::pt)).get_value_unit(length::pt) -
|
||||
pageMarginRight.get_value_or(length(0, length::pt)).get_value_unit(length::pt) -
|
||||
columnGap.get_value_unit(length::pt)) / columnsCount
|
||||
);
|
||||
@ -1153,19 +1153,36 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!xlink_attlist_.href_)
|
||||
return;
|
||||
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
size_t pos_replaicement = href.find(L"ObjectReplacements");
|
||||
const draw_frame *frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
|
||||
if (!frame && draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_image(*this));
|
||||
draw_image *image = dynamic_cast<draw_image *>(elm.get());
|
||||
image->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
frame->content_.push_back(elm);
|
||||
frame->docx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing) return;
|
||||
if (!xlink_attlist_.href_)
|
||||
return;
|
||||
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing)
|
||||
return;
|
||||
|
||||
size_t pos_replaicement = href.find(L"ObjectReplacements");
|
||||
if (pos_replaicement != std::wstring::npos)
|
||||
{
|
||||
if (!Context.get_drawing_context().get_use_image_replace())
|
||||
@ -1173,6 +1190,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (href.length() - (pos_replaicement + 18) < 2)
|
||||
return; //href="./ObjectReplacements/"
|
||||
}
|
||||
if (href[0] == L'#') href = href.substr(1);
|
||||
|
||||
if (drawing->type == oox::typeUnknown)
|
||||
drawing->type = oox::typeImage;
|
||||
@ -1245,6 +1263,24 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
const draw_frame *frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
|
||||
if (!frame && draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_text_box(*this));
|
||||
draw_text_box *text_box = dynamic_cast<draw_text_box *>(elm.get());
|
||||
text_box->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
frame->content_.push_back(elm);
|
||||
frame->docx_convert(Context);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
//тут может быть не только текст , но и таблицы, другие объекты ...
|
||||
oox::StreamsManPtr prev = Context.get_stream_man();
|
||||
|
||||
@ -1269,13 +1305,12 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.back_context_state();
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing) return;
|
||||
if (!drawing)
|
||||
return;
|
||||
|
||||
drawing->type = oox::typeShape;
|
||||
drawing->sub_type = 1; //textBox
|
||||
@ -1516,7 +1551,8 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing->inGroup = Context.get_drawing_context().in_group();
|
||||
|
||||
common_draw_docx_convert(Context, common_draw_attlists_, drawing);
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
@ -1555,14 +1591,36 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
try
|
||||
const draw_frame *frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
|
||||
if (!frame && draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_object(*this));
|
||||
draw_object *object = dynamic_cast<draw_object *>(elm.get());
|
||||
object->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
frame->content_.push_back(elm);
|
||||
frame->docx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
oox::_docx_drawing *drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
try
|
||||
{
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
std::wstring tempPath = Context.root()->get_temp_folder();
|
||||
std::wstring odfPath = Context.root()->get_folder();
|
||||
|
||||
if (!odf_document_ && !href.empty())
|
||||
{
|
||||
if (!odf_document_ && false == href.empty())
|
||||
{
|
||||
if (href[0] == L'#') href = href.substr(1);
|
||||
std::wstring objectPath = odfPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
// normalize path ???? todooo
|
||||
@ -1571,9 +1629,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
odf_document_ = odf_document_ptr(new odf_document(objectPath, tempPath, L"", NULL));
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
draw_frame* frame = NULL;
|
||||
oox::_docx_drawing * drawing = NULL;
|
||||
office_element* contentSubDoc = odf_document_ ? odf_document_->get_impl()->get_content() : NULL;
|
||||
office_element* contentSubDoc = odf_document_ ? odf_document_->get_impl()->get_content() : NULL;
|
||||
|
||||
object_odf_context objectBuild (href);
|
||||
if (contentSubDoc)
|
||||
@ -1581,10 +1637,6 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
process_build_object process_build_object_(objectBuild, odf_document_->odf_context());
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
|
||||
frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (frame)
|
||||
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
|
||||
if (objectBuild.table_table_)
|
||||
{
|
||||
oox::xlsx_conversion_context xlsx_context(odf_document_.get());
|
||||
|
||||
@ -213,9 +213,32 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
const std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
if (draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_image(*this));
|
||||
draw_image *image = dynamic_cast<draw_image *>(elm.get());
|
||||
image->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
Context.get_slide_context().set_image(href);
|
||||
frame->content_.push_back(elm);
|
||||
frame->pptx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
if (true == href.empty())
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (href[0] == L'#') href = href.substr(1);
|
||||
}
|
||||
Context.get_slide_context().set_image(href);
|
||||
////////////////////////////////////в принципе достаточно общая часть ...
|
||||
Context.get_text_context().start_object();
|
||||
|
||||
@ -243,6 +266,22 @@ void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
if (draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_text_box(*this));
|
||||
draw_text_box *text_box = dynamic_cast<draw_text_box *>(elm.get());
|
||||
text_box->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
frame->content_.push_back(elm);
|
||||
frame->pptx_convert(Context);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
Context.get_slide_context().set_text_box(); //rect с наваротами
|
||||
Context.get_text_context().start_object();
|
||||
|
||||
@ -260,14 +299,31 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
try
|
||||
if (draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_object(*this));
|
||||
draw_object *object = dynamic_cast<draw_object *>(elm.get());
|
||||
object->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
frame->content_.push_back(elm);
|
||||
frame->pptx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
try
|
||||
{
|
||||
std::wstring tempPath = Context.root()->get_temp_folder();
|
||||
std::wstring odfPath = Context.root()->get_folder();
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
if (!odf_document_ && !href.empty())
|
||||
if (!odf_document_ && false == href.empty())
|
||||
{
|
||||
if (href[0] == L'#') href = href.substr(1);
|
||||
|
||||
std::wstring objectPath = odfPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
// normalize path ???? todooo
|
||||
|
||||
@ -205,9 +205,24 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
if (draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_image(*this));
|
||||
draw_image *image = dynamic_cast<draw_image *>(elm.get());
|
||||
image->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
if (href.empty() && office_binary_data_)
|
||||
frame->content_.push_back(elm);
|
||||
frame->xlsx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
if (true == href.empty())
|
||||
{
|
||||
office_binary_data* binary_data = dynamic_cast<office_binary_data*>(office_binary_data_.get());
|
||||
|
||||
@ -216,6 +231,10 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
href = binary_data->write_to(Context.root()->get_folder());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (href[0] == L'#') href = href.substr(1);
|
||||
}
|
||||
|
||||
Context.get_drawing_context().set_image(href);
|
||||
|
||||
@ -246,6 +265,22 @@ void draw_chart::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_text_box(*this));
|
||||
draw_text_box *text_box = dynamic_cast<draw_text_box *>(elm.get());
|
||||
text_box->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
frame->content_.push_back(elm);
|
||||
frame->xlsx_convert(Context);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
Context.get_drawing_context().set_text_box();
|
||||
|
||||
Context.get_text_context().start_drawing_content();
|
||||
@ -264,12 +299,29 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (draw_frame_ptr)
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame *>(draw_frame_ptr.get());
|
||||
if (frame)
|
||||
{
|
||||
office_element_ptr elm = office_element_ptr(new draw_object(*this));
|
||||
draw_object *object = dynamic_cast<draw_object *>(elm.get());
|
||||
object->draw_frame_ptr = office_element_ptr();
|
||||
|
||||
frame->content_.push_back(elm);
|
||||
frame->xlsx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
try
|
||||
{
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
if (!odf_document_ && !href.empty())
|
||||
if (!odf_document_ && false == href.empty())
|
||||
{
|
||||
if (href[0] == L'#') href = href.substr(1);
|
||||
|
||||
std::wstring tempPath = Context.root()->get_temp_folder();
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
@ -297,21 +297,21 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
Context.text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties());
|
||||
|
||||
Context.text_properties_->content().style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content().fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
Context.text_properties_->content_.style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content_.fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
|
||||
if (mathsize_)
|
||||
Context.text_properties_->content().fo_font_size_ = mathsize_;
|
||||
Context.text_properties_->content_.fo_font_size_ = mathsize_;
|
||||
|
||||
if (color_)
|
||||
Context.text_properties_->content().fo_color_ = color_;
|
||||
Context.text_properties_->content_.fo_color_ = color_;
|
||||
|
||||
if (common_attlist_.mathvariant_)
|
||||
{
|
||||
if (common_attlist_.mathvariant_->style_.bold)
|
||||
Context.text_properties_->content().fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WBold);
|
||||
Context.text_properties_->content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WBold);
|
||||
if (common_attlist_.mathvariant_->style_.italic)
|
||||
Context.text_properties_->content().fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
|
||||
Context.text_properties_->content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -324,7 +324,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
CP_XML_NODE(L"m:ctrlPr")
|
||||
{
|
||||
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
Context.text_properties_->content_.oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -352,8 +352,8 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
//reset to default math text props
|
||||
Context.text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties());
|
||||
|
||||
Context.text_properties_->content().style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content().fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
Context.text_properties_->content_.style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content_.fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
{
|
||||
@ -365,7 +365,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
CP_XML_NODE(L"m:ctrlPr")
|
||||
{
|
||||
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
Context.text_properties_->content_.oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ void math_mi::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
Context.text_properties_->content_.oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
|
||||
CP_XML_NODE(L"m:t")
|
||||
{
|
||||
@ -160,7 +160,7 @@ void math_mo::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
// + доп стили текста ... todoooo
|
||||
|
||||
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
Context.text_properties_->content_.oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
|
||||
CP_XML_NODE(L"m:t")
|
||||
{
|
||||
@ -201,7 +201,7 @@ void math_mn::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
// + доп стили текста ... todoooo
|
||||
|
||||
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
Context.text_properties_->content_.oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
|
||||
|
||||
CP_XML_NODE(L"m:t")
|
||||
{
|
||||
|
||||
@ -65,10 +65,10 @@ void number_style_base::oox_convert_impl(oox::num_format_context & Context)
|
||||
{
|
||||
if (style_text_properties * textProp = dynamic_cast<style_text_properties*>(style_text_properties_.get()))
|
||||
{
|
||||
if (textProp->content().fo_color_)
|
||||
if (textProp->content_.fo_color_)
|
||||
{
|
||||
int r = 0, g = 0, b = 0;
|
||||
if (HEXStringToRGB(textProp->content().fo_color_->get_hex_value(), r, g, b))
|
||||
if (HEXStringToRGB(textProp->content_.fo_color_->get_hex_value(), r, g, b))
|
||||
{
|
||||
std::wostream & strm = Context.output();
|
||||
strm << L"[" << RGBToString(r, g, b) << L"]";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user