Compare commits

...

814 Commits

Author SHA1 Message Date
fcd7818675 Add test for heif 2025-08-04 12:51:33 +03:00
6d707ebae2 Fix decode 2025-07-28 13:28:20 +03:00
41dc23ce53 Add Release/Debug libs 2025-07-24 12:10:26 +03:00
a817cd54d5 Fix static build 2025-07-17 20:11:46 +03:00
f5ddf8c6ce Fix build 2025-07-10 18:27:15 +03:00
29355d337b Fix encode 2025-07-07 18:01:25 +03:00
8c6a26895b Add read from memory 2025-07-02 13:22:30 +03:00
0154543b01 Remove temp file 2025-06-30 16:25:28 +03:00
3e2dee5719 Fix heif encode 2025-06-30 16:13:03 +03:00
c25f8cc204 Fix heif image convert 2025-06-30 13:51:05 +03:00
d3aae6dfcb Add heif decode and encode 2025-06-29 10:08:51 +03:00
03463ee0e4 Merge remote-tracking branch 'origin/release/v9.0.0' into develop 2025-05-29 12:34:25 +03:00
32cfb4f71b Merge remote-tracking branch 'origin/fix/customs' into release/v9.0.0 2025-05-29 12:29:52 +03:00
243cc43771 fix bug #74488 2025-05-29 12:28:55 +03:00
a90422c3a7 Merge pull request 'Fixed scale calculation for embedded emfs in emfplus' (#329) from fix/metafile into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/329
2025-05-28 14:33:29 +00:00
16e7528cff Fixed scale calculation for embedded emfs in emfplus 2025-05-28 17:07:02 +03:00
8be104e3c1 Merge pull request 'Fix bugs 65813, 74529, 74727' (#328) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/328
2025-05-28 11:58:51 +00:00
fbcb387f51 Fix bug 65813 2025-05-28 14:52:41 +03:00
4754569381 Fix bug 74727 2025-05-28 11:51:47 +03:00
44948c850e Merge pull request 'fix/Tensor-luminosity-gradient' (#326) from fix/Tensor-luminosity-gradient into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/326
2025-05-27 18:38:41 +00:00
3163177b89 Fix gradient drawing 2025-05-27 21:21:20 +03:00
66513e895f Merge pull request 'For bug #8257' (#325) from fix/metafile into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/325
2025-05-27 17:43:27 +00:00
8bcf2ee154 Merge pull request 'Fix bug #74694' (#324) from fix/html into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/324
2025-05-27 17:42:28 +00:00
7d9e756f3f For bug #8257 2025-05-27 20:19:17 +03:00
b2d28a7185 Fix bug #74694 2025-05-27 20:01:50 +03:00
1a62f01cf7 Fix bug 74529 2025-05-27 13:42:54 +03:00
b518d5642f Merge pull request 'Fin button form rotate' (#323) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/323
2025-05-27 06:46:28 +00:00
e9dcafed07 Add GetFillColor method 2025-05-27 02:05:51 +03:00
9bd79e2752 Fix boolean operations 2025-05-27 02:05:24 +03:00
77f363f737 add operator == and != in agg::rgba8 2025-05-27 02:04:54 +03:00
3a866d2f55 Add generations for dictionaries 2025-05-26 21:29:11 +03:00
0d148f0efa Fin button form rotate 2025-05-26 17:32:28 +03:00
c741cc4bba Merge pull request 'Fix html bugs' (#322) from fix/html-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/322
2025-05-26 13:16:59 +00:00
c58203cdc1 Merge pull request 'Fix pdf bugs' (#321) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/321
2025-05-26 10:19:29 +00:00
e56f807826 Fix bug 74615 2025-05-26 13:04:12 +03:00
ef3a93cb13 Fix bug 74616 2025-05-26 12:15:03 +03:00
fa55bd4c95 . 2025-05-26 11:13:39 +03:00
62a4de7a1d . 2025-05-26 10:34:59 +03:00
a85d77b493 Merge pull request 'adding size calculation' (#319) from feature/SizeMath into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/319
2025-05-26 07:22:01 +00:00
57b2cc5436 Fix typo 2025-05-25 23:33:11 +03:00
5894736c2a Fixed the merge conflict 2025-05-25 22:52:30 +03:00
fa407297c7 Merge branch 'release/v9.0.0' into fix/html-bugs 2025-05-25 22:42:15 +03:00
3d77b1d8c6 Fix bug #73904 2025-05-25 21:44:24 +03:00
fc2aca59aa Fix luminosity drawing 2025-05-25 14:29:00 +03:00
e2021faa33 adding size calculation 2025-05-23 22:28:44 +03:00
9a4dd96072 Fix ListBox rotate 2025-05-23 17:53:27 +03:00
3e9afa1d15 Merge pull request 'fix bug #74531' (#318) from fix/bug74531 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/318
2025-05-23 14:46:22 +00:00
1c9e394549 fix bug #74531 2025-05-23 20:42:25 +06:00
f8a901e2d0 Rotate form 2025-05-23 17:04:56 +03:00
59cd16f300 Merge pull request 'Fix pdf bugs' (#316) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/316
2025-05-23 06:52:19 +00:00
b063c4af35 Merge branch 'release/v9.0.0' into fix/customs 2025-05-22 17:27:54 +03:00
9f50c9d660 Fix bug 74581
Fix inheritable page attributes
2025-05-22 13:59:53 +03:00
e16972f410 . 2025-05-22 11:38:59 +03:00
77855a12e9 fix bug #74247 2025-05-22 11:28:52 +03:00
cc8c771f61 Fix build on linux 2025-05-22 11:00:48 +03:00
31e5d626ca vsdx in ole 2025-05-21 19:27:10 +03:00
5067d33c84 fix binary xlsx 2025-05-21 19:24:00 +03:00
6b3173e65f Merge pull request 'fix/bug74095' (#313) from fix/bug74095 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/313
2025-05-21 13:19:31 +00:00
65fc2852ec . 2025-05-20 18:21:22 +03:00
0385087f98 Fix prev commit 2025-05-20 13:44:38 +03:00
366b122c51 editing the conversion of diacritics and text 2025-05-20 13:30:38 +03:00
f7110040b1 . 2025-05-20 12:44:56 +03:00
adc9445231 For bug 73837 2025-05-19 10:21:21 +03:00
a49951f392 Merge pull request 'Fix memory leak' (#312) from fix/bug-73947 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/312
2025-05-16 14:07:49 +00:00
3963f1fcef For bug 73947 2025-05-16 17:02:02 +03:00
41e0b5fe83 ConvertToOrigin for vsdx 2025-05-15 19:22:20 +03:00
5caf111308 Merge pull request 'Fix getReader' (#311) from fix/pdf-split into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/311
2025-05-15 14:09:03 +00:00
7e7265827d Fix getReader 2025-05-15 17:06:41 +03:00
65829b6e96 Merge branch 'release/v9.0.0' of https://git.onlyoffice.com/ONLYOFFICE/core into release/v9.0.0 2025-05-15 16:04:51 +03:00
e10aa90618 Realize pdf split/merge in native js wrapper 2025-05-15 16:04:29 +03:00
5210ffbd50 . 2025-05-15 15:43:41 +03:00
9b45589937 fix bug 2025-05-15 14:03:45 +03:00
9c9ac53475 Merge pull request 'Fix bug 74294' (#310) from fix/bug-74294 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/310
2025-05-15 07:57:12 +00:00
d70c26f5ce . 2025-05-15 10:28:36 +03:00
6070cd54e2 Fix bug 74450 2025-05-14 17:11:16 +03:00
5fd6709d04 for bug #74435 2025-05-14 17:01:32 +03:00
0424b92b04 Refactoring 2025-05-14 16:58:42 +03:00
923f39fada Fix bug 74294 2025-05-14 16:45:35 +03:00
6b6118ffcc fix bug #74435 2025-05-14 16:41:24 +03:00
84de7e98be for bug #73678 2025-05-14 16:33:56 +03:00
906aace0df Fix bug #73486 2025-05-14 16:29:35 +03:00
3fbb430b7f Merge pull request 'fix bug #74140' (#308) from fix/bug74140 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/308
2025-05-13 17:37:02 +00:00
c2de8a822a read themes in incorrect vsdx 2025-05-13 20:35:14 +03:00
490180dbba Add new extensions 2025-05-13 18:15:49 +03:00
d928151fdb Merge pull request 'Fix bugs 74314, 74420' (#309) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/309
2025-05-13 14:07:48 +00:00
c63a8adbb3 Fix bug 74420 2025-05-13 15:16:01 +03:00
a7e647d58a fix bug #74140 2025-05-13 18:14:42 +06:00
b7062837c8 fix bug #70991 2025-05-13 14:53:00 +03:00
f7a46174ad Fix bug 74314 2025-05-13 14:32:07 +03:00
992bc0095f [android] Add MD format 2025-05-13 10:49:09 +03:00
bf67498f3e Mark params for opening file as default 2025-05-13 10:27:46 +03:00
c4676f1b28 Merge pull request 'Fix bug #74141' (#306) from fix/bug74141 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/306
2025-05-12 18:33:05 +00:00
b4c9184a0d Merge pull request 'Fix bug 74168' (#307) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/307
2025-05-12 15:32:02 +00:00
748b5d061b Fix bug 74168 2025-05-12 18:28:22 +03:00
ea15b54837 Fix bug #73907 2025-05-12 17:42:12 +03:00
9d19af8749 Fix bug 74168 2025-05-12 17:05:14 +03:00
05cef3635c Refactoring 2025-05-12 14:49:14 +03:00
1b03e3e71f Fix bug #74141 2025-05-12 17:34:15 +06:00
d15d681659 for bug #70752 2025-05-12 14:04:40 +03:00
58189602cc Fix bug #73990 2025-05-12 06:23:30 +03:00
6fd19e7618 for bug #71673 2025-05-08 11:28:57 +03:00
dbfdfcb202 Merge pull request 'Fix pdf bugs' (#305) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/305
2025-05-07 15:51:57 +00:00
801b5e604e Fix bug 74372 2025-05-07 17:26:58 +03:00
cb34481460 Fix bug 74364 2025-05-07 13:12:48 +03:00
a1ff4a8de2 Merge pull request 'Fix pdf bugs' (#304) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/304
2025-05-06 17:52:56 +00:00
d82f9a4d7a Merge pull request 'fix defined names binary conversion' (#303) from fix/binary-conversion into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/303
2025-05-06 13:50:30 +00:00
6d9d709183 Fix bug 74357 2025-05-06 15:16:12 +03:00
3f317a6d1f fix defined names binary conversion 2025-05-06 17:44:50 +06:00
c2c085f57d Checkbox with text color 2025-05-06 14:02:44 +03:00
5719444c94 fix bug #74289 2025-05-06 13:20:53 +03:00
2c5d36d618 fix bug #74324 2025-05-06 10:47:34 +03:00
36d8b8afe9 Merge pull request 'Fix bug #73314' (#302) from fix/bug73314 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/302
2025-05-06 07:39:14 +00:00
0f6cd18603 Merge pull request 'Added md file conversion' (#300) from feature/md2html into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/300
2025-05-05 19:12:38 +00:00
32c22eee70 Merge pull request 'Fix bug 74294, 74244' (#301) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/301
2025-05-05 13:19:39 +00:00
cea739dc2c Fix test 2025-05-05 16:12:10 +03:00
4a769c1faa Fix bug 74294 2025-05-05 15:46:25 +03:00
a77f612973 Added md to html conversion in x2t 2025-05-05 15:13:07 +03:00
198e878eb5 for bug #74280 2025-05-05 14:56:54 +03:00
0942bc78ab fix bug #74290 2025-05-05 13:14:35 +03:00
ca53d3d035 fix bug #71673 2025-05-01 08:34:01 +03:00
a4f271d7b0 Merge pull request 'Fix bug #74258' (#296) from fix/bug74258 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/296
2025-05-01 04:21:44 +00:00
c99b304ec2 Fix bug 74312 2025-04-30 18:17:21 +03:00
1b032f3d74 Improved styling when converting md file to html 2025-04-30 18:15:41 +03:00
db57d253d9 Merge pull request 'Fix bugs 74268, 74307' (#298) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/298
2025-04-30 13:23:38 +00:00
b48909edaa Fix test 2025-04-30 14:00:30 +03:00
1bfb055a50 Fix bug 74307 2025-04-30 13:58:58 +03:00
149d3a2030 Fix bug 74268 2025-04-30 13:04:25 +03:00
8bad09ea5a Merge pull request 'Fix originalIndex with SplitPages' (#297) from fix/pdf-split into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/297
2025-04-30 09:23:52 +00:00
91656095fa Fix originalIndex with SplitPages 2025-04-30 12:20:11 +03:00
9e89e48c07 Fix bug #74258 2025-04-30 14:47:40 +06:00
fe89b146d7 Merge branch 'fix/SMCustomShape' into fix/customs 2025-04-29 17:00:50 +03:00
1c5bd6cbab Merge pull request 'Fix bug 74279' (#295) from fix/x2ttester into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/295
2025-04-29 13:43:41 +00:00
8ba7535fc8 fix bug #74281 2025-04-29 16:42:02 +03:00
038fa50194 Fix bug 74279 2025-04-29 14:58:38 +03:00
c94a294317 Merge pull request 'Fix SplitPages with changes' (#294) from fix/pdf-split into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/294
2025-04-29 10:53:41 +00:00
d220685cff Fix delete annot with split changes 2025-04-29 13:32:48 +03:00
edae000326 Fix index split pages 2025-04-29 12:53:40 +03:00
2cbc83b389 Test split with changes 2025-04-29 11:02:51 +03:00
d05afa3106 fix bug #74254 2025-04-28 18:44:15 +03:00
de56349019 fix bug #74171 2025-04-28 18:20:13 +03:00
821f9cacd0 for vsdx binary 2025-04-28 18:04:37 +03:00
4f38f17bd1 Fix build 2025-04-28 14:56:07 +03:00
9f4a145b48 Fix SaveToMemory 2025-04-28 14:12:49 +03:00
eaa0bbf047 Merge pull request 'For bug 74253' (#293) from fix/bug-74253 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/293
2025-04-28 09:00:58 +00:00
e78391c68b For bug 74253 2025-04-28 11:29:09 +03:00
109a5fe2b4 Split with changes 2025-04-28 10:40:06 +03:00
a908c42910 Added md file conversion to html 2025-04-27 19:20:17 +03:00
36b7400e0e Merge pull request 'Fix use of DR in forms' (#292) from fix/pdf-merge into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/292
2025-04-25 09:51:20 +00:00
a19bf4bedd for bug#74095 2025-04-25 12:38:40 +03:00
8318535aae Fix use of DR in forms 2025-04-25 12:19:55 +03:00
21f5e09237 [android] Add OFDFile 2025-04-24 14:42:45 +03:00
de9c51a2db for bug #74054 2025-04-24 13:10:22 +03:00
f42079a55f . 2025-04-24 11:10:04 +03:00
5e0b5b6e34 fix bug #74054 2025-04-24 10:42:59 +03:00
9b87eba66b Fix xp builds 2025-04-24 07:01:49 +03:00
09f2db26e0 Fix jsc build 2025-04-24 06:56:09 +03:00
aa038179cc . 2025-04-23 21:38:52 +03:00
c09d5197b7 Merge pull request 'Fix MergePages' (#291) from fix/pdf-merge into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/291
2025-04-23 14:01:51 +00:00
c6f616d42e Fix MovePage for merge pages 2025-04-23 16:38:31 +03:00
dcc208257e Fix length of stream not ref 2025-04-23 14:14:05 +03:00
cc369ffbcb Merge pull request 'Added OFD format' (#287) from feature/OFD into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/287
2025-04-23 09:29:56 +00:00
93018caf09 Merge pull request 'Fix bug 74175' (#290) from fix/bug-74175 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/290
2025-04-23 08:52:17 +00:00
d80d6c4168 Fix bug 74175 2025-04-23 11:10:49 +03:00
5360487954 Fix bug with unregistered version 2025-04-23 10:18:19 +03:00
cd73ab58b1 Merge pull request 'Fix bug 74165' (#289) from fix/bug-74165 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/289
2025-04-22 14:10:46 +00:00
1119fd4307 Fix bug 74165 2025-04-22 16:26:42 +03:00
0769a5ed3b Merge pull request 'Fix pdf bugs' (#288) from fix/pdf-merge into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/288
2025-04-22 12:30:12 +00:00
82ad23840f Fix bug 74164 2025-04-22 14:36:51 +03:00
5cb971d600 Fix FakePage resources 2025-04-22 13:35:40 +03:00
c66cb32dde Added a restriction on the scope of files in OFD format. 2025-04-22 13:29:16 +03:00
ab62a3ebcf Improved work with text when converting OFD format 2025-04-22 11:19:43 +03:00
04d3e94dcc Fix bug 74157 2025-04-22 11:01:57 +03:00
1c4462e2e9 Fix bug 74159 2025-04-22 09:39:18 +03:00
91dc5b8582 Fix null EncodeGID 2025-04-21 18:18:18 +03:00
e9cf55f8db Restore old version of test 2025-04-21 18:17:00 +03:00
43fc84e6ef Merge pull request 'feature/docbuilderpy' (#286) from feature/docbuilderpy into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/286
2025-04-21 15:15:19 +00:00
5a8bd3f8ce DrawTextToRenderer for Unicode 2025-04-21 17:17:30 +03:00
84dda72a13 Fix DR 2025-04-21 17:11:38 +03:00
5819c36cee Merge branch hotfix/v8.3.3 into release/v9.0.0 2025-04-21 09:03:56 +00:00
c964ed7d58 Merge branch hotfix/v8.3.3 into develop 2025-04-21 09:03:54 +00:00
b5b9d948b9 fix bug #74091 2025-04-21 11:26:38 +03:00
72ac94412d Merge pull request 'UndoMergePages' (#285) from fix/merge-pages into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/285
2025-04-21 08:15:44 +00:00
4125e698d6 Fix build 2025-04-20 02:33:48 +03:00
7c2a95202c Merge pull request 'release/v9.0.0' (#284) from release/v9.0.0 into feature/OFD
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/284
2025-04-19 14:38:42 +00:00
c3527ad8d4 Added OFD format to OfficeChecker 2025-04-19 17:24:14 +03:00
9fe692b048 Refactoring 2025-04-19 16:57:31 +03:00
df66cbbca9 add visio theme elements 2025-04-18 18:19:39 +03:00
d877278d8d Refactor API calls in docbuilder_test.py 2025-04-18 17:27:35 +03:00
41a4edb223 Merge pull request 'Fix bug 74090' (#283) from fix/bug-74090 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/283
2025-04-18 08:40:10 +00:00
0979902167 Fix bug 74090 2025-04-18 11:35:24 +03:00
20618403b6 Add UndoMergePages 2025-04-18 10:20:36 +03:00
131efd2eaa Add array and Call-based methods 2025-04-17 23:42:27 +03:00
8871c785dd new odf math semantic 2025-04-16 16:51:51 +03:00
8bbdb30419 Merge pull request 'Feature Split/Merge pdf' (#282) from feature/pdf-page into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/282
2025-04-16 11:24:55 +00:00
15370bcbce Merge remote-tracking branch 'origin/release/v9.0.0' into feature/pdf-page
# Conflicts:
#	DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js
2025-04-16 14:15:21 +03:00
48c9a001dd Fix button icon in AP 2025-04-16 12:10:40 +03:00
4c806b07a2 Remove exit from context on builder.ExecuteCommand 2025-04-16 11:37:24 +03:00
6a75bc62f0 Fix build for win32 platform 2025-04-15 21:46:53 +03:00
6cb7e763d3 Improved rendering of text in OFD format and refactoring 2025-04-15 19:31:32 +03:00
0d55fddd02 Merge remote-tracking branch 'origin/hotfix/v8.3.3' into release/v9.0.0 2025-04-15 17:37:15 +03:00
1dfb9bff3a Merge pull request 'fix bug #74037' (#281) from fix/bug74037 into hotfix/v8.3.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/281
2025-04-15 14:36:41 +00:00
4dd15a8e80 Add IsNeedCMap 2025-04-15 17:23:00 +03:00
bd60a20b91 fix bug #74037 2025-04-15 19:52:26 +06:00
bd7914e7c7 fix bug #70716 2025-04-15 14:42:26 +03:00
c7fa85602d Fix bugs 2025-04-15 14:35:49 +03:00
809effa5df fix bug #73705 2025-04-15 10:46:03 +03:00
2f42eb6c42 Merge remote-tracking branch 'origin/hotfix/v8.3.3' into release/v9.0.0 2025-04-14 16:53:53 +03:00
641a505cf8 Merge pull request 'fix bug #73391' (#280) from fix/bug73391 into hotfix/v8.3.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/280
2025-04-14 13:49:30 +00:00
f5f3d2572e Add PrefixForm for rename same full names 2025-04-14 15:53:51 +03:00
68992278ce fix bug #73391 2025-04-14 15:49:07 +06:00
95476fc998 Fix build 2025-04-13 10:20:21 +03:00
fa5fa35a34 Fix bug 73788 2025-04-12 14:34:01 +03:00
c503044fc9 [android] Add support ODG 2025-04-11 17:00:28 +03:00
4bef318bd6 . 2025-04-11 16:29:23 +03:00
6546ae3fd9 Merge pull request 'Fix bug 73997' (#279) from fix/bug-73997 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/279
2025-04-11 13:16:34 +00:00
ac300f57a6 MaxLen separately for field and parent 2025-04-11 16:09:29 +03:00
c7a4edec03 . 2025-04-11 15:02:03 +03:00
aaeb745ad3 Fix create Annot not as ref 2025-04-11 13:05:43 +03:00
0a85051119 Fix bug 73997 2025-04-11 12:32:04 +03:00
85c60f172c Fix add not supported annots 2025-04-11 11:19:22 +03:00
7a9c57038e . 2025-04-11 10:18:19 +03:00
888f67dab2 fix bug #70741 2025-04-11 10:18:06 +03:00
87a9b92fea Improved rendering of text in OFD format and refactoring 2025-04-10 18:05:38 +03:00
185be63b27 Add STREAM_FILTER_ALREADY_DECODE 2025-04-10 16:50:50 +03:00
7cd7b03b89 Add nMaxID 2025-04-10 15:50:01 +03:00
3fe4c2ac21 Add getPagesInfo 2025-04-10 10:48:05 +03:00
776569ca81 fix xfrm 2025-04-09 20:03:25 +03:00
7b264e940d Merge Outlines two files 2025-04-09 15:38:21 +03:00
160e99ab90 . 2025-04-09 15:06:00 +03:00
6988009971 fix bug #73902 2025-04-09 15:05:34 +03:00
66bed0e286 fix vsdt_bin 2025-04-09 11:54:08 +03:00
36aae7a6ab Merge pull request 'fix bug #73914' (#278) from fix/bug73914 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/278
2025-04-09 07:20:18 +00:00
3f42678932 fix bug #73914 2025-04-08 20:57:25 +06:00
4bd0a53c9e Improved OFD format conversion 2025-04-08 17:43:28 +03:00
e9162eb230 add ansi to vsdx binary 2025-04-08 13:34:48 +03:00
44684c462e fix vsdx binary 2025-04-07 18:11:00 +03:00
21028c2ca5 Merge pull request 'hotfix/v8.3.3' (#276) from hotfix/v8.3.3 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/276
2025-04-07 11:58:23 +00:00
81be9c1c1f Merge pull request 'hotfix/v8.3.3' (#275) from hotfix/v8.3.3 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/275
2025-04-07 11:57:57 +00:00
c84f2a11d5 Fix build with MacOS.sdk 15.4 2025-04-07 14:51:15 +03:00
21451d83e4 add to binary 2025-04-07 14:01:59 +03:00
21ec043636 Fix merge Fields AcroForm 2025-04-07 13:24:33 +03:00
83e6e5971c Merge remote-tracking branch 'origin/release/v9.0.0' into feature/pdf-page
# Conflicts:
#	DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js
#	PdfFile/OnlineOfficeBinToPdf.cpp
#	PdfFile/PdfEditor.cpp
#	PdfFile/PdfFile.cpp
#	PdfFile/PdfFile.h
#	PdfFile/SrcReader/PdfAnnot.cpp
#	PdfFile/SrcReader/PdfAnnot.h
#	PdfFile/SrcWriter/Document.cpp
#	PdfFile/SrcWriter/Document.h
#	PdfFile/test/test.cpp
2025-04-07 11:35:37 +03:00
aeb78a561e Merge pull request 'feature/clang' (#274) from feature/clang into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/274
2025-04-06 10:38:04 +00:00
75c0dde6d2 Refactoring 2025-04-06 13:36:24 +03:00
2cb34822cd Rename config value with code style 2025-04-06 13:26:49 +03:00
e5c7a043be Refactoring 2025-04-06 13:22:47 +03:00
b8cdfa9b36 Merge pull request 'Create radiobutton and Checkbox' (#273) from feature/forms into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/273
2025-04-04 14:47:19 +00:00
7893197071 Merge remote-tracking branch 'origin/release/v9.0.0' into feature/forms 2025-04-04 17:24:52 +03:00
f2bda6c81a Fix Adobe bug radiobutton BG 2025-04-04 17:23:50 +03:00
3d2cb819d5 Merge pull request 'fix bug #73815' (#270) from fix/bug73815 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/270
2025-04-04 11:37:41 +00:00
b0b99dec3e add test 2025-04-04 14:21:04 +03:00
3c2fd33c7a Merge pull request 'FIx bug #73451' (#272) from fix/bug73451 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/272
2025-04-04 10:44:44 +00:00
f9062d7d38 Merge pull request 'Fix bug #73585' (#271) from fix/bug73585 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/271
2025-04-04 10:44:33 +00:00
ddb544ce34 Chenges all AP.N.Yes when delete annot 2025-04-04 11:48:45 +03:00
f441ec5c35 Testing clang build 2025-04-04 08:56:02 +03:00
d7a8c30461 Fix name of AP.N.Yes 2025-04-03 17:33:47 +03:00
e8bb81b88e fix bug #73815 2025-04-03 15:21:38 +06:00
99252cc950 fix bug 2025-04-02 19:47:58 +03:00
fee4394d3f Update radiobutton Opt choice 2025-04-02 18:13:18 +03:00
744d90e655 [x2t] Fix typo 2025-04-02 16:38:15 +03:00
5692732901 Rename Yes AP 2025-04-01 18:03:16 +03:00
1aaec18152 Fix Cirle radiobutton 2025-04-01 16:06:20 +03:00
266425e817 Fix radiobutton AP 2025-04-01 15:42:39 +03:00
5b8549db9d Write style checked symbol 2025-04-01 12:08:10 +03:00
8f0a4ebfc9 Merge branch hotfix/v8.3.2 into release/v9.0.0 2025-04-01 08:34:23 +00:00
be5627ba60 Merge branch hotfix/v8.3.2 into hotfix/v8.3.3 2025-04-01 08:34:21 +00:00
cafdb1d2a5 Merge branch hotfix/v8.3.2 into develop 2025-04-01 08:34:19 +00:00
34f36cefc3 Delete apValue 2025-04-01 10:07:16 +03:00
7ceefa54cb Improved OFD format conversion 2025-04-01 00:39:17 +03:00
e4188148ba Create DrawCheckBoxSquare 2025-03-31 18:00:10 +03:00
a92bf23081 Fix EBorderType 2025-03-31 15:42:54 +03:00
1d9230b731 Create DrawCheckBoxCircle 2025-03-31 15:27:17 +03:00
d2b5299b99 Fix ResetTextFormField 2025-03-31 11:41:11 +03:00
29c8e185ca Fix ExportValue from parent 2025-03-28 17:31:56 +03:00
723e4713fd Crate parents for widget 2025-03-28 14:02:01 +03:00
7e235780fc Merge pull request 'Feature pdf forms' (#269) from feature/forms into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/269
2025-03-27 14:11:51 +00:00
cfbed19648 Merge pull request 'Fix bug #73694' (#268) from fix/bug73694 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/268
2025-03-27 11:55:55 +00:00
0e09d4ab7a Fix bug #73694 2025-03-27 16:23:39 +06:00
eb37cabb4e Fix write Action 2025-03-27 12:43:02 +03:00
4b611b304b Read/Write parent field actions 2025-03-27 11:36:43 +03:00
c5e6fb69c8 Edit merged annots 2025-03-26 14:06:29 +03:00
af5feabdac Merge pull request 'Fix missing header' (#266) from fix/missing-header into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/266
2025-03-26 10:55:35 +00:00
716cbd42b2 Fix missing header 2025-03-26 13:50:27 +03:00
eebe3f321a Delete merged object 2025-03-25 17:24:33 +03:00
925c40aa80 Added OFD rendering to the renderer 2025-03-24 18:34:04 +03:00
b6741a504f Fix delete indirect objects 2025-03-24 17:41:26 +03:00
3522897670 . 2025-03-24 13:21:24 +03:00
6973cb4c54 Merge remote-tracking branch 'origin/hotfix/v8.3.3' into release/v9.0.0 2025-03-24 13:14:04 +03:00
fedf33e2c2 Fix AP_N_Yes for radiobutton 2025-03-24 13:11:12 +03:00
a0c49966b9 Merge pull request 'fix bug #73582' (#264) from fix/bug73582 into hotfix/v8.3.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/264
2025-03-24 10:11:00 +00:00
58f4828563 Merge pull request 'fix bug #73587' (#263) from fix/bug73587 into hotfix/v8.3.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/263
2025-03-24 10:09:10 +00:00
9e52adeb53 Merge pull request 'feature/SMCustomShape' (#262) from feature/SMCustomShape into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/262
2025-03-24 10:05:16 +00:00
aed320e57a Fix build 2025-03-24 09:12:42 +03:00
96a7e3ac36 Fix bug 73514 2025-03-24 09:05:21 +03:00
caa34c540a Add CObjectsManager 2025-03-21 16:58:43 +03:00
b67ed51103 AddTest 2025-03-21 16:04:03 +03:00
cf91b46ea7 . 2025-03-21 15:27:18 +03:00
7857106d76 Fix bug #73585 2025-03-21 13:43:19 +05:00
44d76014bf Add nStartRefID to Editor 2025-03-20 18:52:59 +03:00
dad19380a2 Merge remote-tracking branch 'origin/release/v9.0.0' into feature/vs 2025-03-20 14:36:55 +03:00
23410ccbf9 Merge pull request 'feature/add-direct-xlst-xlsb-conversion' (#260) from feature/add-direct-xlst-xlsb-conversion into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/260
2025-03-20 11:34:44 +00:00
64c74192c7 FIx bug #73451 2025-03-20 16:09:36 +05:00
ce129fe49d Fix pane conversion 2025-03-20 17:08:25 +06:00
ed0f4f9e5e Fix cond fmts formula conversion 2025-03-20 16:27:31 +06:00
d8f9aab1ed Merge branch 'release/v9.0.0' into feature/add-direct-xlst-xlsb-conversion 2025-03-20 13:25:09 +06:00
37fc9784a7 Fix conditional formating conversion 2025-03-19 19:21:58 +06:00
7252d29579 Improved pars of the OFD format structure 2025-03-19 15:47:49 +03:00
d257c68d5f Merge branch hotfix/v8.3.2 into master 2025-03-19 12:45:29 +00:00
051169b0f5 Merge remote-tracking branch 'origin/release/v9.0.0' into feature/vs 2025-03-19 10:42:46 +03:00
6a4ba5ec8d fix bug #73554 2025-03-19 10:39:55 +03:00
9390761867 fix bug #73587 2025-03-19 13:10:50 +06:00
e100f594d7 fix bug #73582 2025-03-18 18:12:52 +03:00
d620a53cd0 Fix drawingfile 2025-03-18 13:32:06 +03:00
1181cb222d Fix memory bug 2025-03-18 13:15:55 +03:00
df0528c69f Fix nStartRefID 2025-03-18 12:35:52 +03:00
49da36637d Fix unique ID objects 2025-03-18 11:49:43 +03:00
850fd21f09 Merge remote-tracking branch 'origin/release/v9.0.0' into feature/vs 2025-03-18 09:43:02 +03:00
fdc374256a Merge branch 'hotfix/v8.3.2' into release/v9.0.0 2025-03-18 09:42:31 +03:00
ed12f6766d Merge remote-tracking branch 'origin/hotfix/v8.3.2' into feature/vs 2025-03-18 09:41:23 +03:00
4e7ccd2506 Add nStartRefID 2025-03-17 18:09:07 +03:00
c4bcf11d91 Merge pull request 'Fix docbuilder from archives' (#259) from fix/docbuilder-register into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/259
2025-03-17 12:14:54 +00:00
72ee82211d Add note 2025-03-17 15:36:03 +04:00
2ab94263f2 Remove lib directory 2025-03-17 15:29:49 +04:00
b7a335ef83 Merge branch 'release/v9.0.0' into feature/add-direct-xlst-xlsb-conversion 2025-03-17 15:42:21 +06:00
410e8100fe Merge pull request 'Fix bug #73467' (#257) from fix/bug73467 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/257
2025-03-17 07:19:06 +00:00
3e3ac51f56 Merge pull request 'Fix bug #73483' (#258) from fix/bug-73483 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/258
2025-03-15 19:40:35 +00:00
2d0bb82f41 refactoring 2025-03-15 15:01:50 +03:00
005b790e14 . 2025-03-15 11:14:36 +03:00
4f4f61bb19 Fix bug #73483 2025-03-15 01:04:27 +03:00
6fe0f2828e Fix bug #73467 2025-03-14 21:53:47 +06:00
58074d649d Merge pull request 'Fix bug #73487' (#256) from fix/bug-73487 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/256
2025-03-14 15:42:43 +00:00
1346f56d67 Fix bug #73487 2025-03-14 17:00:37 +03:00
2652fb4e65 Fix bug 73507 2025-03-14 11:19:14 +03:00
2a5d7a78a3 Fix merge pages 2025-03-14 10:56:41 +03:00
16c77add4d visio crypt, template, macros, plugins 2025-03-13 19:23:34 +03:00
684e83f0f3 Merge branch 'hotfix/v8.3.2' into release/v9.0.0 2025-03-13 15:52:33 +03:00
a8d8f44cef fix bug #73437
(cherry picked from commit 9cde3dc699)
2025-03-13 15:51:51 +03:00
4ca218486f Merge pull request 'fux bug #73517' (#255) from fix/bug73517 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/255
2025-03-13 12:48:21 +00:00
10bf096b4d fux bug #73517 2025-03-13 13:57:18 +06:00
3b67e4ee0c fix bug #73494 2025-03-13 10:55:16 +03:00
670dae5f36 Merge pull request 'Fix html bugs' (#254) from fix/html-bugs into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/254
2025-03-12 16:31:02 +00:00
95a5a2ccbc Merge pull request 'Fix bug #73496' (#253) from fix/bug-73496 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/253
2025-03-12 16:29:28 +00:00
16023ed916 . 2025-03-12 19:08:23 +03:00
6e6a71e46d Fix bug #73496 2025-03-12 18:01:36 +03:00
c9e3c3452f fix bug #73500 2025-03-12 17:24:35 +03:00
561221102e fix bug #73509 2025-03-12 16:59:27 +03:00
4dd6d5ffc7 Merge pull request 'Fix bug 73493' (#252) from fix/bug-73493 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/252
2025-03-12 13:28:15 +00:00
89d965283b Fix command with empty states 2025-03-12 16:23:09 +03:00
6e9500a6e7 Fix bug 73493 2025-03-12 16:18:35 +03:00
71f164b029 Merge pull request 'Fix bug 73484' (#250) from fix/x2ttester into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/250
2025-03-12 07:13:03 +00:00
a438ae3d2e . 2025-03-11 22:06:23 +03:00
7edb3bd141 Merge remote-tracking branch 'origin/hotfix/v8.3.2' into release/v9.0.0 2025-03-11 20:51:21 +03:00
37a5ce4781 Merge pull request 'fix bug #73433' (#251) from fix/bug73433 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/251
2025-03-11 17:50:57 +00:00
18b8e3ed7c Fix bug 73484 2025-03-11 20:12:42 +03:00
20a4bcf708 Fix bug #73486 2025-03-11 17:32:45 +03:00
c0222c03db Fix bug #73485 2025-03-11 17:32:14 +03:00
52de014e14 Fix empty Opt 2025-03-11 15:51:16 +03:00
80ed0318b6 fix bug #73433 2025-03-11 18:34:32 +06:00
adea12d9f7 Parent Opt with pair string 2025-03-11 14:52:17 +03:00
3a8601c354 Ff separately parent and widget 2025-03-11 13:23:38 +03:00
86c994d0a0 Fix test 2025-03-11 12:03:08 +03:00
ba1597a8d5 Create AddEditPage 2025-03-11 12:02:23 +03:00
84ecffa75e Added a parse of the basic structure and text in word format 2025-03-11 11:06:07 +03:00
d83cbfc031 Merge remote-tracking branch 'origin/hotfix/v8.3.2' into release/v9.0.0 2025-03-10 20:11:19 +03:00
3723ba064c Merge pull request 'fix bug #73466' (#249) from fix/bug73466 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/249
2025-03-10 14:21:20 +00:00
7a3815bc5f Add CryptoPP to drawingfile 2025-03-10 15:40:16 +03:00
08ae28224f conversion of functions 2025-03-10 14:54:58 +03:00
4d23382c92 Added a parse of the basic structure of the OFD format 2025-03-10 14:21:25 +03:00
ac2562f83e fix bug #73466 2025-03-10 14:32:00 +06:00
e1274dadea . 2025-03-08 08:36:37 +03:00
4342c245c5 Merge remote-tracking branch 'origin/release/v9.0.0' into feature/vs 2025-03-07 14:35:58 +03:00
52602f902e Merge pull request 'fix bug #73437' (#247) from fix/bug73437 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/247
2025-03-07 11:35:29 +00:00
56179f70bf add binary vsdx 2025-03-07 14:34:34 +03:00
9cde3dc699 fix bug #73437 2025-03-07 17:28:54 +06:00
85b6e2d568 Merge pull request 'Fix bug 72950' (#245) from fix/bug-72950 into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/245
2025-03-07 08:11:42 +00:00
43becd1cdb Fix registerLibrary method 2025-03-07 11:03:20 +03:00
8791f446b7 Add PdfWriter to build drawingfile 2025-03-06 18:16:14 +03:00
6aa68f1c81 Add GetPropertyInt method 2025-03-06 15:56:30 +03:00
bd838daa90 Merge pull request 'Feature forms' (#246) from feature/forms into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/246
2025-03-06 07:10:18 +00:00
484d9342ac Merge remote-tracking branch 'origin/release/v9.0.0' into feature/forms 2025-03-06 09:12:10 +03:00
e9852e812f Turn on ligatures for arabic & syriac scripts 2025-03-05 19:13:38 +03:00
d2ea9521b5 Add support license 2025-03-05 18:59:59 +03:00
e1c1ff3eb4 Fix pages from arrPageIndex 2025-03-05 18:02:48 +03:00
d76dddeda6 Fix test 2025-03-05 17:54:47 +03:00
1830a1103a Fix SplitPages 2025-03-05 15:40:12 +03:00
631f498532 Create OMetadata 2025-03-05 14:12:58 +03:00
4957b61033 SplitPages in PdfReader 2025-03-05 13:31:38 +03:00
06f8099497 Merge pull request 'Fix pdf properties exists' (#244) from fix/pdf-properties into hotfix/v8.3.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/244
2025-03-04 17:24:26 +00:00
ba9d3bcda5 Fix pdf properties exists 2025-03-04 19:46:43 +03:00
462556599f Build drawingfile 2025-03-04 18:49:04 +03:00
a7551f69eb Fix formula with blank value conversion 2025-03-04 21:22:36 +06:00
a3878b3770 Fix bug 72950 2025-03-04 16:34:29 +03:00
7a1c1be599 remove unused function 2025-03-04 15:37:49 +06:00
0796745158 Add PdfWriter to drawingfile 2025-03-03 19:14:08 +03:00
b177d01071 Add text example 2025-03-03 18:38:24 +03:00
06cc67a925 add pars and conversion sm in custom shape 2025-03-03 14:43:41 +03:00
55cae3d38c fix table formula conversion 2025-03-03 16:58:13 +06:00
fc540fdf5f Merge remote-tracking branch 'origin/feature/add-direct-xlst-xlsb-conversion' into feature/vs 2025-03-01 21:09:10 +03:00
06a287dffe fix shared strings fonts conversion 2025-02-28 17:42:29 +06:00
6e6ffbf604 Create AddPDF 2025-02-28 14:03:47 +03:00
3d58a8565a Fix definded names conversion 2025-02-28 16:54:38 +06:00
9ed356c103 fix empty cells conversion 2025-02-28 14:38:04 +06:00
b20cdcd107 Merge branch 'develop' into feature/add-direct-xlst-xlsb-conversion 2025-02-28 13:12:52 +06:00
c1f29d5317 Fix bug #73314 2025-02-27 20:13:08 +05:00
4d4a67b15a Create AddFromFile and AddFromMemory 2025-02-27 17:45:12 +03:00
3d7638c3cc Merge branch hotfix/v8.3.1 into master 2025-02-27 13:17:57 +00:00
cca89624c6 Merge remote-tracking branch 'origin/feature/add-direct-xlst-xlsb-conversion' into feature/vs 2025-02-27 16:00:36 +03:00
ccad697cd8 Merge remote-tracking branch 'origin/hotfix/v8.3.1' into develop 2025-02-27 15:58:46 +03:00
dd60367d01 Fix building fonts module 2025-02-27 11:18:24 +03:00
54bbbbc3d7 Merge pull request 'fix bug #73349' (#241) from fix/bug73349 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/241
2025-02-26 19:29:42 +00:00
9b901f7834 fix bug #73349 2025-02-26 17:56:41 +03:00
258890352a Fix getAnnotationsInfo 2025-02-26 17:55:29 +03:00
09567e225e Fix shared strings conversion 2025-02-26 18:34:22 +06:00
62dbbc6d0d Fix CPdfReader functions 2025-02-26 15:18:18 +03:00
4f59af17b8 Fix bug 72130 2025-02-26 15:08:48 +03:00
b9258429f6 Merge pull request 'Fix bug #73343' (#240) from fix/bug73343 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/240
2025-02-25 15:20:32 +00:00
e8f2c55ad4 Merge pull request 'Fix bug #72788' (#239) from fix/bug72788 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/239
2025-02-25 15:20:12 +00:00
4085f58b09 Fix CPdfReader functions 2025-02-25 17:48:42 +03:00
46f6ba4d0a Fix for subsystem python module 2025-02-25 16:55:32 +03:00
f5d2ff992a Fix worksheetProp conversion 2025-02-25 18:09:10 +06:00
09b55bd1f1 Merge pull request 'Fix bug 71688' (#238) from fix/bug-71688 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/238
2025-02-24 13:29:36 +00:00
176053e8d8 Fix bug 71688 2025-02-24 16:16:51 +03:00
f28dc0a36a Create CPdfReaderContext 2025-02-24 15:47:03 +03:00
01365f938c Fix bug 73299 2025-02-24 15:09:43 +03:00
d168e4594f Fix bug #73343 2025-02-24 17:09:36 +05:00
79145ad0c7 Merge branch 'develop' into feature/add-direct-xlst-xlsb-conversion 2025-02-24 16:46:51 +06:00
cad36a73be Merge remote-tracking branch 'origin/hotfix/v8.3.1' into develop 2025-02-24 12:14:01 +03:00
0c9fa4709f Merge branch release/v8.3.0 into master 2025-02-24 09:08:09 +00:00
27d2e40da7 Merge pull request 'fix bug #73336' (#237) from fix/bug73336 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/237
2025-02-24 09:00:39 +00:00
14b09ce582 fix bug #73336 2025-02-24 11:49:41 +03:00
aeeab690b1 Fix builder bugs. Recteate context with snapshots if needed. 2025-02-24 01:10:39 +03:00
54c0943754 Add sheet&table names pre reading for formulas 2025-02-21 19:30:10 +06:00
016a0a971b Fix bug #72788 2025-02-20 20:28:22 +05:00
49a40fa841 MergePages SplitPages commands 2025-02-20 17:39:10 +03:00
f9662752f7 Merge remote-tracking branch 'origin/fix/pdf-copy-ap' into feature/pdf-page
# Conflicts:
#	PdfFile/PdfFile.cpp
#	PdfFile/PdfFile.h
#	PdfFile/SrcWriter/Document.cpp
#	PdfFile/SrcWriter/Document.h
2025-02-20 15:19:54 +03:00
7eb0892ab9 Fix DR AcroForm MergePages 2025-02-20 14:56:34 +03:00
bb65d1a90b Add connections conversion 2025-02-20 17:53:40 +06:00
0136530b93 Merge branch 'develop' into feature/add-direct-xlst-xlsb-conversion 2025-02-20 13:51:33 +06:00
afe55a456f Merge branch 'fix/bug70671' into hotfix/v8.3.1 2025-02-19 18:06:22 +03:00
a430ba92ad Merge pull request 'fix/odf_tests' (#125) from fix/odf_tests into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/125
2025-02-19 14:59:35 +00:00
efc1149235 Merge pull request 'Fix bug #70575' (#236) from fix/bug70575 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/236
2025-02-19 14:58:17 +00:00
edcd907749 Fix MergePages 2025-02-19 17:51:10 +03:00
567cc14bc7 Merge pull request 'Fix bug #72790' (#232) from fix/bug72790 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/232
2025-02-19 12:51:51 +00:00
0fc7f2a8b3 Merge remote-tracking branch 'origin/fix/bug73248' into develop 2025-02-19 15:36:32 +03:00
b14fa1c2a1 fix bug #73248 2025-02-19 15:35:55 +03:00
2c27cfc720 . 2025-02-19 15:32:12 +03:00
e1b13913ac Fix EditPdf 2025-02-19 11:38:55 +03:00
1d31e5836b fix fileFormatChecker 2025-02-18 20:23:49 +03:00
9f3ab7cc29 Create MergePages 2025-02-18 16:00:57 +03:00
6adf65d3a8 fix bug #73221 2025-02-18 09:51:43 +03:00
229b263a9f Fix AcroForm SplitPage 2025-02-17 18:07:17 +03:00
093e1348fa Merge pull request 'Fix bug #71975' (#235) from fix/bug71975 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/235
2025-02-17 13:40:22 +00:00
b78157487a Merge pull request 'Fix bug #73238' (#233) from fix/bug73238 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/233
2025-02-17 13:37:03 +00:00
77b30109f0 Merge remote-tracking branch 'origin/hotfix/v8.3.1' into fix/bug71975 2025-02-17 18:33:19 +05:00
efd047be74 Fix bug #71975 2025-02-17 18:27:48 +05:00
61abfdb272 Merge pull request 'Fix bugs 73220, 73178' (#234) from fix/bug-73220 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/234
2025-02-17 11:16:05 +00:00
f5088f43d8 Fix bug 73178 2025-02-17 14:10:38 +03:00
9757220019 Merge branch 'develop' into feature/add-direct-xlst-xlsb-conversion 2025-02-17 17:07:33 +06:00
6b3c395220 Fix bug 73220 2025-02-17 13:44:01 +03:00
67cb29652d Fix bug #73238 2025-02-15 17:41:26 +05:00
d0cb082b33 Fix bug #72790 2025-02-15 12:53:35 +05:00
028157d2ef Fix AcroForm 2025-02-14 17:36:31 +03:00
bc0a582bf6 Fix pivot conversion 2025-02-14 19:57:08 +06:00
2eff67efc3 Merge pull request 'Fix bug #73222' (#231) from fix/bug73222 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/231
2025-02-14 12:09:16 +00:00
84416ef5b6 Merge pull request 'Fix bug #72871' (#230) from fix/bug72871 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/230
2025-02-14 12:08:56 +00:00
3428537113 Add table conversion 2025-02-14 17:29:45 +06:00
d09ab5ecfe Only text fo apValue 2025-02-14 12:16:11 +03:00
447ade207f Fix bug #73222 2025-02-14 13:56:53 +05:00
8bc887142c Return fontInfo for readAnnotAP 2025-02-14 11:51:33 +03:00
af4e0243d2 XRef write to stream 2025-02-14 11:07:27 +03:00
4de7ba4e52 Fix Skip Action GoTo another Page 2025-02-13 18:04:00 +03:00
ddd7628bbe fix bug #73097 2025-02-13 17:48:33 +03:00
1f86b0265a Fix bug #72871 2025-02-13 18:20:31 +05:00
e7a7400801 Add ext conversion 2025-02-13 19:16:16 +06:00
e484db496b . 2025-02-13 15:14:51 +03:00
5bc1c8d860 fix bug #73215 2025-02-13 15:12:58 +03:00
feeb471aad Add drawing & comments conversion 2025-02-13 17:49:54 +06:00
dbdf4bd120 Merge pull request 'Fix Metafile conversion' (#228) from fix/bugs-metafile into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/228
2025-02-13 09:59:40 +00:00
600d2a6ac5 Fix build 2025-02-13 11:44:21 +03:00
cd102c738f Choice widget Opt only Parent 2025-02-13 11:37:28 +03:00
70be48fec3 Test SplitPage 2025-02-13 11:11:11 +03:00
c60ff31fd4 Fix Resources ref 2025-02-13 10:13:44 +03:00
a93db0e012 . 2025-02-12 18:15:00 +03:00
7c1636a33e add hyperlinks conversion 2025-02-12 20:17:03 +06:00
f145378002 fix additional sdtPr 2025-02-12 15:35:26 +03:00
3ec3aa8575 add protection & mergeCells conversion 2025-02-12 16:38:51 +06:00
3227b91a7c Add cond format conversion 2025-02-12 14:20:22 +06:00
4e800f6952 Merge remote-tracking branch 'origin/hotfix/v8.3.1' into develop 2025-02-12 11:19:53 +03:00
8098fec345 Merge pull request 'Fix bug #72825' (#227) from fix/bug72825 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/227
2025-02-11 18:11:08 +00:00
7bfcea0fff Merge pull request 'Fix bug #72875' (#226) from fix/bug72875 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/226
2025-02-11 18:10:41 +00:00
4b4845c558 Merge pull request 'Fix bug #72414' (#225) from fix/bug72414 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/225
2025-02-11 18:10:03 +00:00
b26e3e2fee Merge pull request 'fix/bug70675' (#224) from fix/bug70675 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/224
2025-02-11 18:09:33 +00:00
388951670c Merge pull request 'Fix bug #72790' (#223) from fix/bug72790 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/223
2025-02-11 18:08:55 +00:00
826d3fc678 Fix build 2025-02-11 17:55:09 +03:00
ec0ed4d2f0 Unique obj split pages 2025-02-11 17:23:08 +03:00
ed63f9cf29 Fix row cords conversion 2025-02-11 19:40:31 +06:00
7556d0859d Fix shared fmla conversion 2025-02-11 17:32:56 +06:00
7d3488abc9 Merge pull request 'fix/bug-68408' (#229) from fix/bug-68408 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/229
2025-02-11 11:10:20 +00:00
fff7f4e63f Test SplitPages 2025-02-11 13:47:26 +03:00
fea3910254 adding reading attributes 2025-02-11 13:22:50 +03:00
2d58b08f0f Merge pull request 'PDF MovePage' (#222) from fix/pre8.3.1 into hotfix/v8.3.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/222
2025-02-11 09:06:33 +00:00
612142f0ae Refactoring 2025-02-11 11:24:08 +03:00
2a0c84513b For bug #72962 2025-02-11 11:24:07 +03:00
b7d3464609 Edited default mode ShapeRendering for metafile to svg conversion 2025-02-11 11:24:07 +03:00
beb8574dfd Fix bug #72962 2025-02-11 11:24:07 +03:00
c22cc89ef0 Merge remote-tracking branch 'origin/release/v8.3.0' into fix/bug71975 2025-02-11 13:10:43 +05:00
58255093bf Fix bug #70575 2025-02-11 05:49:33 +05:00
68c9d3cfa5 Add logic for one color gradient 2025-02-10 20:58:02 +03:00
7e8e4586ca Create SplitPage 2025-02-10 18:34:57 +03:00
6411aed137 Fix shared formula conversion 2025-02-10 21:33:10 +06:00
bbb9165a99 Add logic for luminocity gradient 2025-02-10 18:06:32 +03:00
17fe60ecdc Add color mixing in gradient render 2025-02-10 18:05:43 +03:00
50846677d5 Add missed files 2025-02-10 13:30:46 +03:00
650a5c4c1f Add simple worksheet xlsb writing 2025-02-10 16:12:16 +06:00
3b450306f1 Merge branch 'hotfix/v8.3.1' of git.onlyoffice.com:ONLYOFFICE/core into hotfix/v8.3.1 2025-02-10 12:07:58 +03:00
c67ec5f632 Add missed file 2025-02-10 11:20:06 +03:00
62450ee1fb add additional props sdt 2025-02-10 10:46:34 +03:00
ad301b6f50 Merge branch 'feature/docbuilder-license' into hotfix/v8.3.1 2025-02-09 00:46:23 +03:00
d251682639 Refactoring 2025-02-09 00:32:48 +03:00
896427db83 For bug 72964 2025-02-08 21:59:52 +03:00
e03f02103b For bug #70575 2025-02-07 18:22:26 +05:00
27c7920def Fix actual pos MovePage 2025-02-07 13:02:22 +03:00
a1b0421ec1 Fix MovePage 2025-02-07 13:02:21 +03:00
b7972ea391 Create MovePage 2025-02-07 13:02:21 +03:00
662f318d6b add workbook conversion 2025-02-07 15:39:51 +06:00
9352721ec4 Fix copy Stamp InRect 2025-02-07 10:44:31 +03:00
eb751507c0 Add worksheet direct conversion method 2025-02-07 13:32:02 +06:00
17840c5ed7 for bug #68408 2025-02-06 16:58:59 +03:00
ff4726e6ec for bug #68408 2025-02-06 15:53:53 +03:00
4e9cd74367 for bug #68408 2025-02-06 15:52:02 +03:00
b8737d2474 for bug #68408 2025-02-06 15:50:15 +03:00
2f4b7442c7 Fix CJSContext::GetCurrent method for jsc version 2025-02-06 12:44:39 +03:00
e2df5a8ab0 Fix C&IC FreeText 2025-02-06 11:58:24 +03:00
d97d2668d2 Merge branch release/v8.3.0 into master 2025-02-05 17:15:43 +00:00
d196a15a0e Change xlst->xlsb conversion 2025-02-05 20:06:59 +06:00
8a86347eb6 Fix build 2025-02-05 13:56:51 +03:00
d6675bb981 Merge remote-tracking branch 'origin/release/v8.3.0' into fix/pdf-copy-ap 2025-02-05 12:52:01 +03:00
eba03f9833 Merge remote-tracking branch 'origin/fix/pdf-copy-paste' into fix/pdf-copy-ap 2025-02-05 12:13:05 +03:00
45da53e9ae Refactoring standarttester 2025-02-04 20:12:07 +03:00
618a7ea09e Merge remote-tracking branch 'origin/release/v8.3.0' into fix/bug70675 2025-02-04 17:19:00 +05:00
e7a462fb60 Fix actual pos MovePage 2025-02-04 13:10:54 +03:00
a33743cff2 fix bug #73052 2025-02-04 13:44:41 +06:00
a83e19cbdf fix bug #72176 2025-02-03 16:35:23 +00:00
8a991ae24a Merge pull request 'Fix bug #72857' (#208) from fix/bug72857 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/208
2025-02-03 14:35:21 +00:00
6caca87b64 Merge pull request 'For bug #72496' (#207) from fix/bug72496 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/207
2025-02-03 14:35:10 +00:00
9ab884ae24 Merge pull request 'Fix hwp conversion' (#217) from fix/hwp into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/217
2025-02-03 14:15:54 +00:00
e493d976e3 Fix bug #73036 2025-02-03 16:59:47 +03:00
d75e7342cf Fix bug #73042 2025-02-03 15:45:09 +03:00
ddd750be9c Merge pull request 'Fix write base fonts' (#216) from fix/pdf-standart-fonts into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/216
2025-02-03 12:40:28 +00:00
79a4434583 Fix bug #73040 2025-02-03 15:35:39 +03:00
44ff2aff3c Fix empty FreeText AP 2025-02-03 15:32:41 +03:00
2f4b3e41b3 Fix write base fonts 2025-02-03 15:24:08 +03:00
fe208f5243 Merge pull request 'Fix bug #72961' (#215) from fix/bug-72961 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/215
2025-02-03 11:15:35 +00:00
e41c1d9703 Fix bug #72961 2025-02-03 14:12:29 +03:00
1cb56e532c Fix bug #72790 2025-02-03 15:39:18 +05:00
5c5f98a6e3 Fix bug 73014 2025-02-03 10:45:38 +03:00
f9dd82ad47 Merge pull request 'Fix HWP conversion' (#211) from fix/hwp into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/211
2025-02-03 06:43:31 +00:00
084c8f4b94 Fix bug #72999 2025-02-03 07:17:39 +03:00
bf15325a9e Fix bug #73000 2025-02-03 05:25:55 +03:00
1b50b3a53a Fix bug 72868 2025-02-01 17:39:08 +03:00
70b40c46d2 Fix bug #72721 2025-02-01 11:36:52 +03:00
23798f3c96 Fix ios build 2025-01-31 17:14:07 +03:00
aeb657ef25 Fix MovePage 2025-01-31 14:53:23 +03:00
a9b225782d Create MovePage 2025-01-31 13:38:29 +03:00
d91c6ff830 Merge pull request 'fix/pivot-xlst-conversion' (#210) from fix/pivot-xlst-conversion into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/210
2025-01-31 10:05:08 +00:00
b75a577793 Merge branch 'develop' into fix/pivot-xlst-conversion 2025-01-31 13:40:45 +06:00
1e8d22080d Merge pull request 'Fix hwp bugs' (#209) from fix/hwp into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/209
2025-01-31 05:08:55 +00:00
90bcd47fb7 The conversion of the character spacing to hwp has been removed 2025-01-31 03:15:19 +03:00
c1adf0b30c Fix bug #72685 2025-01-31 03:15:12 +03:00
b65ed1ccb4 Fix bug #72825 2025-01-31 03:40:47 +05:00
8e4bbb5e27 Fix bug #72875 2025-01-30 22:13:22 +05:00
81a4d9ccd0 Fix bug 72936 2025-01-30 16:51:25 +03:00
b46df522e9 Copy AP 2025-01-30 15:27:33 +03:00
a97014c173 Disable use filesystem in metafiles (js module) 2025-01-30 14:26:57 +03:00
b3951d083a Fix elements align in html conversion 2025-01-30 10:37:42 +00:00
7d78b37540 Fix bug #72932 2025-01-30 10:37:42 +00:00
ff162d451e Merge pull request 'Fix hwp bug' (#205) from fix/hwp into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/205
2025-01-30 10:33:13 +00:00
5dc6402006 Fix test file 2025-01-30 13:12:27 +03:00
fae17d9bfc Merge pull request 'For bug #72694' (#204) from fix/bug72694 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/204
2025-01-30 08:02:28 +00:00
931f4edae4 For bug #72694 2025-01-30 13:36:42 +06:00
3609cf1237 Fix bug #72933 2025-01-30 00:49:49 +03:00
cc8fa641aa Merge pull request 'Fix bug 72811' (#203) from fix/bug-72811 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/203
2025-01-29 16:20:19 +00:00
3b9a865d77 Fix bug 72811 2025-01-29 19:07:58 +03:00
f3b0a992bd Fix typo 2025-01-29 18:57:35 +03:00
74f3e7f279 Merge pull request 'Fix hwp conversion' (#202) from fix/hwp into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/202
2025-01-29 15:45:08 +00:00
d195aa4a79 Fix build 2025-01-29 18:31:12 +03:00
4a384edf08 For bug #72496 2025-01-29 20:23:33 +05:00
30f96cbc6c Fix bug #72705 2025-01-29 18:15:29 +03:00
007362d8be Fix bug #72780 2025-01-29 17:57:54 +03:00
f4aac048ea fix bug #72012 2025-01-29 17:44:17 +03:00
f815fec8ed Fix bug #72714 2025-01-29 17:14:53 +03:00
4ec217226d Fix bug #72721 2025-01-29 16:32:43 +03:00
3cef41e876 Added bookmark conversion, fix bugs, refactoring in hwp format 2025-01-29 16:22:03 +03:00
20bff1d6fe for bug #72794 2025-01-29 11:17:21 +00:00
8da1a109de Fix bug #72857 2025-01-29 02:28:47 +05:00
704cef604e fix bug #72496 2025-01-28 19:26:15 +03:00
3c850e2086 Fix bug #72667 2025-01-28 13:47:20 +00:00
ab660cb8a3 Merge pull request 'for bug #72496' (#198) from For/bug72496 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/198
2025-01-28 13:12:05 +00:00
af4343b1d8 for bug #72496 2025-01-28 16:06:39 +03:00
7e4fe558f4 Fix bug #72847 2025-01-28 15:17:08 +03:00
f942e56361 fix namespaces 2025-01-28 13:46:28 +03:00
8b85f6987f Merge pull request 'Fix bug #72839' (#197) from fix/bug-72839 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/197
2025-01-28 09:13:21 +00:00
cbe412d3c7 Fix bug #72839 2025-01-28 12:03:31 +03:00
c2eb402ebf Fix readAnnotationsInfoFromBinary 2025-01-28 12:01:22 +03:00
dabedf6121 Fix test Text 2025-01-28 11:12:35 +03:00
4db56e4536 Add lminosity gradient to test case 2025-01-28 11:03:29 +03:00
99224aecb9 Add fill color for tensor patch gradient 2025-01-28 11:02:01 +03:00
dd02c9594b Fix ctAnnotField 2025-01-28 10:20:48 +03:00
6913cae8f3 Fix bug #72414 2025-01-28 06:09:12 +05:00
d3d9c8df94 Added text indent in hwp conversion 2025-01-27 22:14:25 +03:00
01b582c4b9 Added BorderFill in hwp conversion 2025-01-27 22:01:41 +03:00
4568144a22 Merge branch 'fix/bug72794' into release/v8.3.0 2025-01-27 20:38:15 +03:00
cc4df3726a fix bug #72745 2025-01-27 20:37:02 +03:00
894f88e475 Separation of common parts into functions 2025-01-27 18:54:09 +03:00
696610862a . 2025-01-27 18:27:20 +03:00
da6a5e9e98 for binary 2025-01-27 15:30:56 +03:00
d395e63b80 Merge pull request 'Fix bug #72657' (#188) from fix/bug72657 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/188
2025-01-27 12:30:02 +00:00
0350675df6 Fix min version 2025-01-27 13:58:30 +03:00
ba46a97bde Create readAnnotationsInfoFromBinary 2025-01-27 13:52:54 +03:00
aead2e9fb8 Merge pull request 'Fix bug#72779' (#196) from fix/bug72779 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/196
2025-01-27 10:03:20 +00:00
d12bad7bd1 Fix bug#72779 2025-01-27 15:58:25 +06:00
da2284fff6 Fix bug #72712 2025-01-26 18:26:03 +00:00
1382aa0b3d Fix bug #72780 2025-01-26 18:26:03 +00:00
8ba5df60d9 Fix bug #72705 2025-01-26 18:26:03 +00:00
5299872b17 Fixes for snapshots 2025-01-26 20:18:14 +03:00
e1757dd5d1 fix bug #72796 2025-01-26 12:10:44 +03:00
87dcea55b1 fix build 2025-01-26 11:58:12 +03:00
b5c5a5f1ed Fix bug #72781 2025-01-25 17:56:11 +00:00
6979e17c3d Added polygon and curve conversion in hwp format 2025-01-25 17:56:11 +00:00
c43fb92860 Fixed the correction of large text size in svg 2025-01-25 18:27:22 +03:00
c2dc112949 Merge pull request 'release/v8.3.0' (#192) from release/v8.3.0 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/192
2025-01-25 10:45:02 +00:00
63887c95b6 Use wmf&emf instead conversion to svg in zip images (for native convertations) 2025-01-25 13:39:35 +03:00
d3d4e86925 Merge pull request 'Fix bug #72365' (#179) from fix/bug72365 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/179
2025-01-25 09:25:56 +00:00
f6383571eb fix bug #72794 2025-01-25 12:18:30 +03:00
a6f6a67aed Fix prev commit 2025-01-24 23:30:51 +03:00
f9543ef9de Year Up 2025-01-24 23:03:42 +03:00
bb58be4f18 Add new method for images inside zip 2025-01-24 22:51:04 +03:00
40efe7dabc Fix build 2025-01-24 18:10:29 +00:00
80b7caaf7a Fix bug #72721 2025-01-24 18:10:29 +00:00
08e3dfb061 Fix bug #72772 2025-01-24 18:10:29 +00:00
3a9d91b291 Fix bug #72719 2025-01-24 18:10:29 +00:00
45b26554b2 Merge pull request 'Fix bug #72175' (#191) from fix/bug72175 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/191
2025-01-24 16:19:30 +00:00
09c4df8e05 Fix remove AP when transform 2025-01-24 17:53:23 +03:00
85533a6553 fix bug #72768 2025-01-24 17:35:53 +03:00
65898a94ad Merge pull request 'Fix hwp bugs' (#187) from fix/hwp into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/187
2025-01-24 11:31:39 +00:00
86009ff6fa Fix bug #72175 2025-01-24 12:46:02 +03:00
b91dfb075e Fix bug #72657 2025-01-24 13:42:37 +06:00
f057a16bc1 Fix bug #72700 2025-01-24 04:32:32 +03:00
bd76adc97f Fix bug #72714 2025-01-23 23:36:47 +03:00
27b5dbf15e Fix bad conversion hwp to ooxml 2025-01-23 23:08:52 +03:00
58a7c7cd9d Merge branch 'release/v8.3.0' of git.onlyoffice.com:ONLYOFFICE/core into release/v8.3.0 2025-01-23 15:12:51 +03:00
18fa4639b0 fix convert to ooxml 2025-01-23 15:12:43 +03:00
389e5314df Fix bug #72692 2025-01-23 15:03:17 +03:00
42636a8ab1 Merge pull request 'Fix bug #72173' (#185) from fix/bug72173 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/185
2025-01-23 11:45:45 +00:00
a3c87e7119 Fix crash with fonts with symbol > 0x10FFFF and wirh \n in name 2025-01-23 14:41:39 +03:00
2115371c0c Fix bug #72173 2025-01-23 13:17:46 +03:00
bd95478d77 Fix build 2025-01-22 19:40:15 +03:00
965680de23 Fix build 2025-01-22 19:32:31 +03:00
ad44ddf682 Fix build 2025-01-22 18:55:57 +03:00
06386d5458 Fix build 2025-01-22 18:25:41 +03:00
ffda83848d Fix bug 70819 2025-01-22 15:48:26 +03:00
55dc0b789f Merge remote-tracking branch 'origin/feature/hwpx' into release/v8.3.0 2025-01-22 14:28:50 +03:00
53e3f8c561 Merge pull request 'feature/docx-renderer' (#183) from feature/docx-renderer into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/183
2025-01-22 11:25:17 +00:00
731a7addee Comment logic 2025-01-22 12:57:21 +03:00
36b82c1ef9 add default font size on odf math 2025-01-22 12:42:46 +03:00
229a8f9dad . 2025-01-22 12:14:08 +03:00
5f5d74df92 . 2025-01-22 12:13:15 +03:00
66ea88bf14 fix bug #72043 2025-01-22 12:08:39 +03:00
3953044063 Add clearing 2025-01-22 11:36:13 +03:00
9a4a1546cb Fix bug #72655 2025-01-21 23:19:08 +03:00
4085ee5002 Merge pull request 'Fix bug #69572' (#180) from fix/bug69572 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/180
2025-01-21 15:03:02 +00:00
f6ef582658 Merge pull request 'Fix bug#72187' (#176) from fix/bug72187 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/176
2025-01-21 15:02:15 +00:00
7b62295149 Fix bug 72544 2025-01-21 17:38:05 +03:00
421dcd780d Fix bug #69572 2025-01-21 20:17:24 +06:00
b9e7a3143c Fix bug 72595 2025-01-21 15:57:35 +03:00
c85713d82a Merge branch 'develop' into fix/pivot-xlst-conversion 2025-01-21 17:44:15 +06:00
6d970d0706 Merge pull request 'feature/xlsb-worksheet-writing-optimization' (#178) from feature/xlsb-worksheet-writing-optimization into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/178
2025-01-21 10:13:50 +00:00
6026841c00 Refactoring 2025-01-21 13:01:02 +03:00
1e6d0a9f25 fix text entry 2025-01-21 12:14:13 +03:00
adad3a05ba Fix build 2025-01-21 11:51:14 +03:00
99fa27e693 Merge branch 'release/v8.3.0' into feature/hwpx 2025-01-21 11:50:09 +03:00
cf047defac Fix array formula conversion 2025-01-21 14:44:31 +06:00
6b66c8fb50 Merge pull request 'Fix bug#72189' (#177) from fix/bug72189 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/177
2025-01-21 07:49:05 +00:00
9faa7fb69d Added hwpx format to ASCConverter 2025-01-21 02:49:51 +03:00
84042360ab Fixed bugs in hwpx conversion 2025-01-21 02:49:10 +03:00
8a8a6e78eb fix bug #72578 2025-01-20 21:49:25 +03:00
8bd655dd17 fix bug #72611 2025-01-20 21:22:45 +03:00
34ecf84835 Merge pull request 'Fix bug #72414' (#161) from fix/bug72414 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/161
2025-01-20 18:05:36 +00:00
4cf79c985d Merge pull request 'Fix bug #72432' (#162) from fix/bug72432 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/162
2025-01-20 18:05:05 +00:00
18e359c1a6 Merge pull request 'Fix bug #72375' (#163) from fix/bug72375 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/163
2025-01-20 18:04:21 +00:00
dc777f43d9 Merge pull request 'Fix bug #72264' (#164) from fix/bug72264 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/164
2025-01-20 18:03:52 +00:00
8cd7ca9731 Merge pull request 'Fix bug #72039' (#165) from fix/bug72039 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/165
2025-01-20 18:03:13 +00:00
8f91c47178 Merge pull request 'Fix bug #69238' (#166) from fix/bug69238 into release/v8.3.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/166
2025-01-20 18:02:44 +00:00
fdac954df5 Add main logic of tables (in developing) 2025-01-20 16:14:28 +03:00
70c98eb9f3 Fix build 2025-01-20 15:42:37 +03:00
aa72db079f Fix shared formulas conversion 2025-01-20 18:27:09 +06:00
024efd2e35 Fix bug #72535 2025-01-20 11:12:14 +00:00
da252bfa5e Fix bug #72589 2025-01-20 11:05:28 +00:00
c9ce68eab3 Improved work with external style files in html 2025-01-20 11:05:28 +00:00
3af549a158 Fix bug #72586 2025-01-20 11:05:28 +00:00
34627ff1c5 Fix bug #72519 2025-01-20 11:05:28 +00:00
483ead4243 Add pivot cache ext xlst writing 2025-01-20 14:20:47 +06:00
0c2b49af11 Fix build for win XP 2025-01-20 10:53:51 +03:00
4324ea847c Reafactoring and fixed bugs in hwp conversion 2025-01-19 20:06:41 +03:00
aa0ba83d32 Fix bug#72189 2025-01-17 18:44:27 +03:00
cabecb0116 Improved the speed of html format conversion 2025-01-17 17:31:25 +03:00
b78e2cb33c Adding parsing of hwpx format elements 2025-01-17 02:42:21 +03:00
ddd92777b4 Restored pivotTable writing 2025-01-16 20:15:16 +06:00
07ab24638e fix utf8 cashes writing 2025-01-16 14:56:29 +06:00
7c2105b613 Fix bug #72365 2025-01-15 22:13:04 +05:00
2027defafb Fix bug #69238
Merge remote-tracking branch 'origin/release/v8.3.0' into fix/bug69238
2025-01-15 21:11:24 +05:00
ffe44155e2 Revert "add pivot cache defenition xlst reading&writing"
This reverts commit 9c70225a9e.
2025-01-15 21:39:48 +06:00
2ea586ec6f Fix bug #72414 2025-01-15 20:13:21 +05:00
7c2093a4c7 Add pivot cache records xlst writing 2025-01-15 21:12:17 +06:00
4f6fa2a15c Fix pivot cache definition xml writing 2025-01-15 19:38:31 +06:00
43f1ac0596 Adding parsing of hwpx format elements 2025-01-15 01:28:37 +03:00
9c70225a9e add pivot cache defenition xlst reading&writing 2025-01-14 20:12:03 +06:00
02bd5c4b0b Fix bug#72187 2025-01-14 10:17:09 +03:00
6c79ab37fa Fix bug 72193 2025-01-13 17:16:52 +03:00
fdcb2cf7ba Fix bug #72432 2025-01-13 18:19:42 +05:00
b42e3ad01f Add pivot cache xlst conversion 2025-01-13 18:34:46 +06:00
07bf7a44aa Fix bug #72375 2025-01-13 17:08:46 +05:00
3a40dc1f8b Fix chart protection conversion 2025-01-13 14:54:15 +06:00
a2bfbd8368 Adding parsing of hwpx format elements 2025-01-13 01:12:37 +03:00
25553904df Adding parsing of hwpx format elements 2025-01-12 17:25:13 +03:00
954ef08975 Adding parsing of hwpx format elements 2025-01-12 00:34:45 +03:00
6952bedbc3 Add chartsheet binary writing 2025-01-10 21:49:03 +06:00
bf299e82bb add worksheet ext conversion 2025-01-10 17:23:18 +06:00
915790e26e Revert "Add ext lst binary conversion optimization" 2025-01-10 17:06:08 +06:00
e18a26a252 Merge branch 'develop' into feature/xlsb-worksheet-writing-optimization 2025-01-10 13:11:26 +06:00
73ccefd720 Add ext lst binary conversion optimization 2025-01-09 22:03:52 +06:00
11385b946d Add picture worksheet xlsb conversion optimisation 2025-01-09 18:01:18 +06:00
7598e882b8 Merge pull request 'release/v8.3.0' (#150) from release/v8.3.0 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/150
2025-01-02 19:52:29 +00:00
00abbab370 Fix bug #72264 2024-12-26 17:52:59 +05:00
51cc45d178 Refactoring AnnotField 2024-12-24 10:58:05 +03:00
91eb74773b Merge branch 'fix/bug72039' of git.onlyoffice.com:ONLYOFFICE/core into fix/bug72039
# Conflicts:
#	OdfFile/Reader/Format/draw_shapes_docx.cpp
2024-12-23 20:31:41 +05:00
5b8d2660aa Fix bug #72039 2024-12-23 20:24:05 +05:00
36b0cc524e Fix bug #72039 2024-12-23 17:33:13 +05:00
9dc3d3ed82 Merge pull request 'release/v8.3.0' (#142) from release/v8.3.0 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/142
2024-12-23 07:15:49 +00:00
5f2d7b2f5a Add base xml for tables 2024-12-20 19:27:23 +03:00
02aeaa6a64 Fix bug with ascent/descent 2024-12-20 17:38:56 +03:00
6fe92e1725 Fix table header columns conversion 2024-12-20 17:58:52 +05:00
e512ceedec Fix cell ref reading 2024-12-20 18:30:08 +06:00
d05a40389e Add activeX controls & listParts conversion optimisation 2024-12-20 14:50:18 +06:00
ea0494e8c2 Add autofilter conversion optimization 2024-12-19 18:52:50 +06:00
127680c988 Add dcon conversion optimization 2024-12-19 16:09:08 +06:00
cdbd9bdba3 Add protected ranges conversion optimisation 2024-12-19 15:03:59 +06:00
1910151224 Add legacy drawing && ole objects conversion optimization 2024-12-18 18:42:57 +06:00
cd27981734 Add headfooter & pageSetup conversion optimization 2024-12-18 16:44:09 +06:00
9509d5e730 Add merge cells conversion optimisation 2024-12-18 14:51:48 +06:00
219733c437 Add dvals&hyperlinks conversion optimisation 2024-12-17 21:00:42 +06:00
48d86cb7ce Add base classes 2024-12-17 15:39:50 +03:00
9991cc8c03 Rewrite split lines logic 2024-12-17 15:13:53 +03:00
36a3b693d5 Update paragraph logic for enums 2024-12-17 13:44:31 +03:00
ad4fee9581 Fix cond fmt conversion 2024-12-16 21:27:31 +06:00
2af29de849 Add condfmt conversion 2024-12-16 20:08:13 +06:00
d58424d089 Fix build 2024-12-14 11:38:11 +03:00
fe2ca8c566 Delete unused headers & add new files 2024-12-14 11:33:47 +03:00
20d2ff7954 Refactoring 2024-12-14 11:18:42 +03:00
b125c19d02 Remove useless call 2024-12-14 07:13:48 +03:00
2f2d11a5f6 Fix bug with recalc size of space 2024-12-14 06:51:59 +03:00
de4897fdef Add HorVerLinesCollector 2024-12-13 16:54:16 +03:00
f9952d0f94 Refactoring for future tables 2024-12-13 15:50:32 +03:00
0c847ce1d8 Fix worksheet protection conversion 2024-12-13 16:57:17 +06:00
f1905b524b Fix formula conversion 2024-12-13 16:00:00 +06:00
d7b435a446 Delete unused file 2024-12-13 12:28:13 +03:00
f742a0ef10 Add worksheet protection conversion 2024-12-12 21:01:16 +06:00
3547ad9c57 Add fmtinfo & colinfo conversion 2024-12-12 17:21:40 +06:00
0d2248352b Add worksheet views conversion 2024-12-12 14:40:55 +06:00
012a724069 add sheet dimension binary writing 2024-12-11 20:54:38 +06:00
2e50a2ede4 Add compressed cells processing to xlsx->xlsb conversion 2024-12-11 17:23:50 +06:00
78d7d40c0a Add sheet property binary conversion 2024-12-11 15:54:15 +06:00
dac47c3214 Fix string cells conversion 2024-12-10 19:31:58 +06:00
be3a84dcf7 Add metadata binary writing 2024-12-10 18:19:06 +06:00
22a2079c5f Add datatable formula conversion 2024-12-10 17:25:53 +06:00
fe2bac216f Add array fmla conversion 2024-12-10 16:09:54 +06:00
d89e94bb8e Merge branch 'develop' into feature/xlsb-worksheet-writing-optimization 2024-12-10 13:03:42 +06:00
a95aba3ff4 Merge pull request 'release/v8.3.0' (#129) from release/v8.3.0 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/129
2024-12-10 04:18:28 +00:00
a1ebcaea23 Merge branch hotfix/v8.2.2 into develop 2024-12-09 12:00:03 +00:00
ab10854dde Fix shared formula conversion 2024-12-09 17:50:36 +06:00
3f25120e04 Add shared formula conversion 2024-12-06 19:04:26 +06:00
44d0a0ca23 Add normal formula conversion 2024-12-06 15:13:20 +06:00
ec645c0202 Add worksheet direct binary writing 2024-12-04 21:41:19 +06:00
63134aa586 Merge branch 'develop' into feature/xlsb-worksheet-writing-optimization 2024-12-04 21:01:44 +06:00
8489127f71 Merge pull request 'release/v8.3.0' (#114) from release/v8.3.0 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/114
2024-12-04 11:00:36 +00:00
e024463770 Merge branch 'develop' into feature/xlsb-worksheet-writing-optimization 2024-12-04 14:20:37 +06:00
168dc1ddb8 Merge remote-tracking branch 'origin/develop' into fix/bug69238 2024-12-03 13:27:22 +05:00
8918b7fae0 Fix formula conversion order 2024-12-03 13:26:51 +05:00
925ffa09e2 Merge remote-tracking branch 'origin/develop' into fix/bug69238 2024-11-29 19:33:13 +05:00
25fa85c218 Merge branch 'develop' into feature/xlsb-worksheet-writing-optimization 2024-11-29 13:41:35 +06:00
6e20c656e7 Add pivot records reading memory optimisation 2024-11-28 20:42:58 +06:00
a158529c70 Add pivot cache records direct writing 2024-11-28 18:53:05 +06:00
87b5ae8f75 Merge branch hotfix/v8.2.2 into master 2024-11-28 12:16:10 +00:00
1c163421c7 Add stream cache writer getting 2024-11-28 15:25:59 +06:00
10ff332f4d Merge remote-tracking branch 'origin/develop' into fix/bug69238 2024-11-27 15:45:33 +05:00
d5e7ccac2d Add odf tests 2024-11-27 13:21:20 +05:00
925f3614c7 Merge branch 'fix/bug69238' into fix/odf_tests 2024-11-22 17:36:10 +05:00
ce0f8251d3 Fix bug #69238 2024-11-22 17:32:40 +05:00
6b21323e8c Merge branch hotfix/v8.2.1 into master 2024-11-22 10:46:53 +00:00
42466cf648 Fix atan2 custom shape formula conversion 2024-10-31 18:08:36 +05:00
d21d0caa68 Fix bug #70675 2024-10-16 18:42:07 +05:00
63bf1797c0 Fix bug #70671 2024-10-14 17:57:28 +05:00
f8ba0c59a6 Add license check for onlyoffice docbuilder builds 2024-09-25 16:04:17 +04:00
0553db3a69 Merge branch 'fix/bug69957' into fix/odf_tests 2024-09-04 16:37:16 +05:00
a7ef6ea3be Merge branch 'fix/bug69988' into fix/odf_tests 2024-09-04 16:36:08 +05:00
d72b9b47ed Test docx to odt invisible symbols size 2024-08-30 16:49:22 +05:00
7e7186f068 Test odt to docx tab size conversion 2024-08-29 21:39:58 +05:00
2d61e8bbd2 Merge remote-tracking branch 'origin/fix/bug44363' into fix/odf_tests 2024-08-29 19:43:48 +05:00
c4c350f1aa Init testing document tab size conversion 2024-08-29 18:56:57 +05:00
2f382d21dc Test odt to docx page size conversion 2024-08-29 18:04:53 +05:00
a968a3a035 Merge remote-tracking branch 'origin/fix/bug44363' into fix/odf_tests 2024-08-28 17:08:54 +05:00
deb875337d Merge remote-tracking branch 'origin/release/v8.2.0' into fix/odf_tests 2024-08-28 16:54:23 +05:00
1b0791364b Refactor odf tests 2024-08-14 17:14:00 +03:00
d939aa7247 Fix build 2024-08-14 17:12:56 +03:00
813 changed files with 52696 additions and 10141 deletions

View File

@ -4,6 +4,7 @@ CORE_BOOST_LIBS = $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/lib
core_ios:CONFIG += disable_enum_constexpr_conversion
core_android:CONFIG += disable_enum_constexpr_conversion
core_mac:CONFIG += disable_enum_constexpr_conversion
core_linux_clang:CONFIG += disable_enum_constexpr_conversion
core_android {
INCLUDEPATH += $$PWD/build/android/include

View File

@ -0,0 +1,818 @@
// https://android.googlesource.com/platform/external/harfbuzz/+/ics-mr0/contrib/tables/script-properties.h
/*
* https://unicode.org/reports/tr29/
As far as a user is concerned, the underlying representation of text is not important,
but it is important that an editing interface present a uniform implementation of what
the user thinks of as characters. Grapheme clusters can be treated as units, by default,
for processes such as the formatting of drop caps, as well as the implementation of text
selection, arrow key movement or backspacing through text, and so forth. For example,
when a grapheme cluster is represented internally by a character sequence consisting of
base character + accents, then using the right arrow key would skip from the start of the
base character to the end of the last accent.
This document defines a default specification for grapheme clusters. It may be customized
for particular languages, operations, or other situations. For example, arrow key movement
could be tailored by language, or could use knowledge specific to particular fonts to move
in a more granular manner, in circumstances where it would be useful to edit individual
components. This could apply, for example, to the complex editorial requirements for the
Northern Thai script Tai Tham (Lanna). Similarly, editing a grapheme cluster element by
element may be preferable in some circumstances. For example, on a given system the backspace
key might delete by code point, while the delete key may delete an entire cluster.
* */
#include "../../../core/DesktopEditor/common/File.h"
#include "../../../core/DesktopEditor/raster/BgraFrame.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_OUTLINE_H
#include <hb-ft.h>
#include <hb-ot.h>
#include <hb.h>
class CDrawer
{
public:
CBgraFrame m_oFrame;
BYTE *pixels;
int width;
int height;
int pitch;
BYTE Rshift;
BYTE Gshift;
BYTE Bshift;
BYTE Ashift;
public:
CDrawer(int w, int h)
{
width = w;
height = h;
pitch = 4 * width;
m_oFrame.put_Width(width);
m_oFrame.put_Height(height);
m_oFrame.put_Stride(pitch);
int size = 4 * width * height;
BYTE *pPixels = new BYTE[size];
for (int i = 0; i < size; i += 4)
{
pPixels[i] = 0xFF;
pPixels[i + 1] = 0xFF;
pPixels[i + 2] = 0xFF;
pPixels[i + 3] = 0xFF;
}
pixels = pPixels;
m_oFrame.put_Data(pPixels);
Bshift = 24;
Gshift = 16;
Rshift = 8;
Ashift = 0;
}
void Save()
{
m_oFrame.SaveFile(NSFile::GetProcessDirectory() + L"/output.png", 4);
}
};
#define NUM_EXAMPLES 3
/* fonts */
const char *fonts_paths[NUM_EXAMPLES] = {
"C:/Windows/Fonts/calibri.ttf",
//"C:/Windows/Fonts/arial.ttf",
"C:/Users/korol/AppData/Local/Microsoft/Windows/Fonts/ArabicTest.ttf",
"C:/Windows/Fonts/simsun.ttc"
};
#define NUM_GLYPH_TYPES 5
const char *num_glyph_types[NUM_GLYPH_TYPES] = {"UNCLASSIFIED", "BASE_GLYPH", "LIGATURE", "MARK", "COMPONENT"};
/* tranlations courtesy of google */
const char *texts[NUM_EXAMPLES] = {
"fi",
"لا لآ لأ لا",
"懶惰的姜貓"
};
const hb_direction_t text_directions[NUM_EXAMPLES] = {
HB_DIRECTION_LTR,
HB_DIRECTION_RTL,
HB_DIRECTION_TTB,
};
const int text_skip[NUM_EXAMPLES] = {
0,
0,
1,
};
/* XXX: These are not correct, though it doesn't seem to break anything
* regardless of their value. */
const char *languages[NUM_EXAMPLES] = {
"en",
"ar",
"ch",
};
const hb_script_t scripts[NUM_EXAMPLES] = {
HB_SCRIPT_LATIN,
HB_SCRIPT_ARABIC,
HB_SCRIPT_HAN,
};
enum
{
ENGLISH = 0,
ARABIC,
CHINESE
};
typedef struct _spanner_baton_t
{
/* rendering part - assumes 32bpp surface */
uint32_t *pixels; // set to the glyph's origin.
uint32_t *first_pixel, *last_pixel; // bounds check
uint32_t pitch;
uint32_t rshift;
uint32_t gshift;
uint32_t bshift;
uint32_t ashift;
/* sizing part */
int min_span_x;
int max_span_x;
int min_y;
int max_y;
} spanner_baton_t;
/* This spanner is write only, suitable for write-only mapped buffers,
but can cause dark streaks where glyphs overlap, like in arabic scripts.
Note how spanners don't clip against surface width - resize the window
and see what it leads to. */
void spanner_wo(int y, int count, const FT_Span *spans, void *user)
{
spanner_baton_t *baton = (spanner_baton_t *)user;
uint32_t *scanline = baton->pixels - y * ((int)baton->pitch / 4);
if (scanline < baton->first_pixel)
return;
for (int i = 0; i < count; i++)
{
uint32_t color = ((spans[i].coverage / 2) << baton->rshift) | ((spans[i].coverage / 2) << baton->gshift) | ((spans[i].coverage / 2) << baton->bshift);
uint32_t *start = scanline + spans[i].x;
if (start + spans[i].len > baton->last_pixel)
return;
for (int x = 0; x < spans[i].len; x++)
*start++ = color;
}
}
/* This spanner does read/modify/write, trading performance for accuracy.
The color here is simply half coverage value in all channels,
effectively mid-gray.
Suitable for when artifacts mostly do come up and annoy.
This might be optimized if one does rmw only for some values of x.
But since the whole buffer has to be rw anyway, and the previous value
is probably still in the cache, there's little point to. */
void spanner_rw(int y, int count, const FT_Span *spans, void *user)
{
spanner_baton_t *baton = (spanner_baton_t *)user;
uint32_t *scanline = baton->pixels - y * ((int)baton->pitch / 4);
if (scanline < baton->first_pixel)
return;
for (int i = 0; i < count; i++)
{
uint32_t color = ((spans[i].coverage / 2) << baton->rshift) | ((spans[i].coverage / 2) << baton->gshift) | ((spans[i].coverage / 2) << baton->bshift);
uint32_t *start = scanline + spans[i].x;
if (start + spans[i].len > baton->last_pixel)
return;
for (int x = 0; x < spans[i].len; x++)
*start++ |= color;
}
}
/* This spanner is for obtaining exact bounding box for the string.
Unfortunately this can't be done without rendering it (or pretending to).
After this runs, we get min and max values of coordinates used.
*/
void spanner_sizer(int y, int count, const FT_Span *spans, void *user)
{
spanner_baton_t *baton = (spanner_baton_t *)user;
if (y < baton->min_y)
baton->min_y = y;
if (y > baton->max_y)
baton->max_y = y;
for (int i = 0; i < count; i++)
{
if (spans[i].x + spans[i].len > baton->max_span_x)
baton->max_span_x = spans[i].x + spans[i].len;
if (spans[i].x < baton->min_span_x)
baton->min_span_x = spans[i].x;
}
}
FT_SpanFunc spanner = spanner_wo;
void ftfdump(FT_Face ftf)
{
for (int i = 0; i < ftf->num_charmaps; i++)
{
printf(
"%d: %s %s %c%c%c%c plat=%hu id=%hu\n", i, ftf->family_name, ftf->style_name, ftf->charmaps[i]->encoding >> 24, (ftf->charmaps[i]->encoding >> 16) & 0xff,
(ftf->charmaps[i]->encoding >> 8) & 0xff, (ftf->charmaps[i]->encoding) & 0xff, ftf->charmaps[i]->platform_id, ftf->charmaps[i]->encoding_id);
}
}
/* See http://www.microsoft.com/typography/otspec/name.htm
for a list of some possible platform-encoding pairs.
We're interested in 0-3 aka 3-1 - UCS-2.
Otherwise, fail. If a font has some unicode map, but lacks
UCS-2 - it is a broken or irrelevant font. What exactly
Freetype will select on face load (it promises most wide
unicode, and if that will be slower that UCS-2 - left as
an excercise to check. */
int force_ucs2_charmap(FT_Face ftf)
{
for (int i = 0; i < ftf->num_charmaps; i++)
if (((ftf->charmaps[i]->platform_id == 0) && (ftf->charmaps[i]->encoding_id == 3)) || ((ftf->charmaps[i]->platform_id == 3) && (ftf->charmaps[i]->encoding_id == 1)))
return FT_Set_Charmap(ftf, ftf->charmaps[i]);
return -1;
}
void hline(CDrawer *s, int min_x, int max_x, int y, uint32_t color)
{
if (y < 0)
y = 0;
uint32_t *pix = (uint32_t *)s->pixels + (y * s->pitch) / 4 + min_x;
uint32_t *end = (uint32_t *)s->pixels + (y * s->pitch) / 4 + max_x;
while (pix - 1 != end)
*pix++ = color;
}
void vline(CDrawer *s, int min_y, int max_y, int x, uint32_t color)
{
if (min_y < 0)
min_y = 0;
uint32_t *pix = (uint32_t *)s->pixels + (min_y * s->pitch) / 4 + x;
uint32_t *end = (uint32_t *)s->pixels + (max_y * s->pitch) / 4 + x;
while (pix - s->pitch / 4 != end)
{
*pix = color;
pix += s->pitch / 4;
}
}
void assert(const bool &valid)
{
// TODO:
}
#define MAIN_CC_NO_PRIVATE_API
#ifndef MAIN_CC_NO_PRIVATE_API
/* Only this part of this mini app uses private API */
#include "hb-open-file.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsubgpos.hh"
#include "hb-static.cc"
using namespace OT;
static void print_layout_info_using_private_api(hb_blob_t *blob)
{
const char *font_data = hb_blob_get_data(blob, nullptr);
hb_blob_t *font_blob = hb_sanitize_context_t().sanitize_blob<OpenTypeFontFile>(blob);
const OpenTypeFontFile *sanitized = font_blob->as<OpenTypeFontFile>();
if (!font_blob->data)
{
printf("Sanitization of the file wasn't successful. Exit");
exit(1);
}
const OpenTypeFontFile &ot = *sanitized;
switch (ot.get_tag())
{
case OpenTypeFontFile::TrueTypeTag:
printf("OpenType font with TrueType outlines\n");
break;
case OpenTypeFontFile::CFFTag:
printf("OpenType font with CFF (Type1) outlines\n");
break;
case OpenTypeFontFile::TTCTag:
printf("TrueType Collection of OpenType fonts\n");
break;
case OpenTypeFontFile::TrueTag:
printf("Obsolete Apple TrueType font\n");
break;
case OpenTypeFontFile::Typ1Tag:
printf("Obsolete Apple Type1 font in SFNT container\n");
break;
case OpenTypeFontFile::DFontTag:
printf("DFont Mac Resource Fork\n");
break;
default:
printf("Unknown font format\n");
break;
}
unsigned num_faces = hb_face_count(blob);
printf("%d font(s) found in file\n", num_faces);
for (unsigned n_font = 0; n_font < num_faces; ++n_font)
{
const OpenTypeFontFace &font = ot.get_face(n_font);
printf("Font %d of %d:\n", n_font, num_faces);
unsigned num_tables = font.get_table_count();
printf(" %d table(s) found in font\n", num_tables);
for (unsigned n_table = 0; n_table < num_tables; ++n_table)
{
const OpenTypeTable &table = font.get_table(n_table);
printf(" Table %2d of %2d: %.4s (0x%08x+0x%08x)\n", n_table, num_tables, (const char *)table.tag, (unsigned)table.offset, (unsigned)table.length);
switch (table.tag)
{
case HB_OT_TAG_GSUB:
case HB_OT_TAG_GPOS:
{
const GSUBGPOS &g = *reinterpret_cast<const GSUBGPOS *>(font_data + table.offset);
unsigned num_scripts = g.get_script_count();
printf(" %d script(s) found in table\n", num_scripts);
for (unsigned n_script = 0; n_script < num_scripts; ++n_script)
{
const Script &script = g.get_script(n_script);
printf(" Script %2d of %2d: %.4s\n", n_script, num_scripts, (const char *)g.get_script_tag(n_script));
if (!script.has_default_lang_sys())
printf(" No default language system\n");
int num_langsys = script.get_lang_sys_count();
printf(" %d language system(s) found in script\n", num_langsys);
for (int n_langsys = script.has_default_lang_sys() ? -1 : 0; n_langsys < num_langsys; ++n_langsys)
{
const LangSys &langsys = n_langsys == -1 ? script.get_default_lang_sys() : script.get_lang_sys(n_langsys);
if (n_langsys == -1)
printf(" Default Language System\n");
else
printf(" Language System %2d of %2d: %.4s\n", n_langsys, num_langsys, (const char *)script.get_lang_sys_tag(n_langsys));
if (!langsys.has_required_feature())
printf(" No required feature\n");
else
printf(" Required feature index: %d\n", langsys.get_required_feature_index());
unsigned num_features = langsys.get_feature_count();
printf(" %d feature(s) found in language system\n", num_features);
for (unsigned n_feature = 0; n_feature < num_features; ++n_feature)
{
printf(" Feature index %2d of %2d: %d\n", n_feature, num_features, langsys.get_feature_index(n_feature));
}
}
}
unsigned num_features = g.get_feature_count();
printf(" %d feature(s) found in table\n", num_features);
for (unsigned n_feature = 0; n_feature < num_features; ++n_feature)
{
const Feature &feature = g.get_feature(n_feature);
unsigned num_lookups = feature.get_lookup_count();
printf(" Feature %2d of %2d: %c%c%c%c\n", n_feature, num_features, HB_UNTAG(g.get_feature_tag(n_feature)));
printf(" %d lookup(s) found in feature\n", num_lookups);
for (unsigned n_lookup = 0; n_lookup < num_lookups; ++n_lookup)
{
printf(" Lookup index %2d of %2d: %d\n", n_lookup, num_lookups, feature.get_lookup_index(n_lookup));
}
}
unsigned num_lookups = g.get_lookup_count();
printf(" %d lookup(s) found in table\n", num_lookups);
for (unsigned n_lookup = 0; n_lookup < num_lookups; ++n_lookup)
{
const Lookup &lookup = g.get_lookup(n_lookup);
printf(" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups, lookup.get_type(), lookup.get_props());
}
}
break;
case GDEF::tableTag:
{
const GDEF &gdef = *reinterpret_cast<const GDEF *>(font_data + table.offset);
printf(" Has %sglyph classes\n", gdef.has_glyph_classes() ? "" : "no ");
printf(" Has %smark attachment types\n", gdef.has_mark_attachment_types() ? "" : "no ");
printf(" Has %sattach points\n", gdef.has_attach_points() ? "" : "no ");
printf(" Has %slig carets\n", gdef.has_lig_carets() ? "" : "no ");
printf(" Has %smark sets\n", gdef.has_mark_sets() ? "" : "no ");
hb_position_t caret_array[16];
unsigned int caret_count = 16;
unsigned int num_carets = gdef.get_lig_carets(nullptr, HB_DIRECTION_LTR, 302, 0, &caret_count, caret_array);
int y = 0;
++y;
break;
}
}
}
}
}
/* end of private API use */
#endif
struct hb_feature_test {
hb_tag_t tag;
uint32_t value;
};
int main(int argc, char *argv[])
{
// hb_blob_t* blobFileTest = hb_blob_create_from_file("C:/Windows/Fonts/calibri.ttf");
// print_layout_info_using_private_api(blobFileTest);
int ptSize = 40 * 64;
int device_hdpi = 72;
int device_vdpi = 72;
/* Init freetype */
FT_Library ft_library;
assert(!FT_Init_FreeType(&ft_library));
/* Load our fonts */
FT_Face ft_face[NUM_EXAMPLES];
assert(!FT_New_Face(ft_library, fonts_paths[0], 0, &ft_face[ENGLISH]));
assert(!FT_Set_Char_Size(ft_face[ENGLISH], 0, ptSize, device_hdpi, device_vdpi));
ftfdump(ft_face[ENGLISH]); // wonderful world of encodings ...
// force_ucs2_charmap(ft_face[ENGLISH]); // which we ignore.
assert(!FT_New_Face(ft_library, fonts_paths[1], 0, &ft_face[ARABIC]));
assert(!FT_Set_Char_Size(ft_face[ARABIC], 0, ptSize, device_hdpi, device_vdpi));
ftfdump(ft_face[ARABIC]);
// force_ucs2_charmap(ft_face[ARABIC]);
assert(!FT_New_Face(ft_library, fonts_paths[2], 0, &ft_face[CHINESE]));
assert(!FT_Set_Char_Size(ft_face[CHINESE], 0, ptSize, device_hdpi, device_vdpi));
ftfdump(ft_face[CHINESE]);
// force_ucs2_charmap(ft_face[CHINESE]);
/* Get our harfbuzz font structs */
hb_font_t *hb_ft_font[NUM_EXAMPLES];
hb_ft_font[ENGLISH] = hb_ft_font_create(ft_face[ENGLISH], NULL);
// hb_blob_t* blobFile = hb_blob_create_from_file(sFont1.c_str());
// hb_face_t* faceFile = hb_face_create(blobFile, 0);
// hb_ft_font[ENGLISH] = hb_font_create(faceFile);
hb_ft_font[ARABIC] = hb_ft_font_create(ft_face[ARABIC], NULL);
hb_ft_font[CHINESE] = hb_ft_font_create(ft_face[CHINESE], NULL);
hb_ft_font_set_funcs(hb_ft_font[ENGLISH]);
hb_ft_font_set_funcs(hb_ft_font[ARABIC]);
hb_ft_font_set_funcs(hb_ft_font[CHINESE]);
/** Setup our SDL window **/
int width = 800;
int height = 600;
int bpp = 32;
CDrawer oDrawer(width, height);
/* Create a buffer for harfbuzz to use */
hb_buffer_t *buf = hb_buffer_create();
for (int i = 0; i < NUM_EXAMPLES; ++i)
{
if (text_skip[i])
continue;
hb_buffer_set_direction(buf, text_directions[i]); /* or LTR */
hb_buffer_set_script(buf, scripts[i]); /* see hb-unicode.h */
hb_buffer_set_language(buf, hb_language_from_string(languages[i], strlen(languages[i])));
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
// hb_buffer_set_cluster_level (buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
hb_buffer_set_cluster_level(buf, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES);
hb_feature_test features[] {
{HB_TAG('r','l','i','g'), 1},
{HB_TAG('l','i','g','a'), 0},
{HB_TAG('c','l','i','g'), 1},
{HB_TAG('h','l','i','g'), 1},
{HB_TAG('d','l','i','g'), 1},
{HB_TAG('k','e','r','n'), 2},
{0, 0}
};
int userfeatures_count = 0;
hb_feature_t userfeatures[100];
hb_feature_test* current_feature = features;
while (current_feature->tag != 0)
{
if (current_feature->value != 2)
{
userfeatures[userfeatures_count].tag = current_feature->tag;
userfeatures[userfeatures_count].value = current_feature->value;
userfeatures[userfeatures_count].start = HB_FEATURE_GLOBAL_START;
userfeatures[userfeatures_count].end = HB_FEATURE_GLOBAL_END;
userfeatures_count++;
}
current_feature++;
}
/* Layout the text */
hb_buffer_add_utf8(buf, texts[i], strlen(texts[i]), 0, strlen(texts[i]));
// detect script by codes
hb_buffer_guess_segment_properties(buf);
// const char*const pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr };
// bool ok = hb_shape_full(hb_ft_font[i], buf, userfeatures, userfeatures_count, pHbShapers);
hb_shape(hb_ft_font[i], buf, (userfeatures_count != 0) ? userfeatures : NULL, userfeatures_count);
unsigned int glyph_count;
hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);
hb_glyph_position_t *glyph_pos = hb_buffer_get_glyph_positions(buf, &glyph_count);
#if 1
hb_position_t caret_array[16];
unsigned int caret_count = 16;
unsigned int num_carets = hb_ot_layout_get_ligature_carets(hb_ft_font[i], text_directions[i], glyph_info[0].codepoint, -1, &caret_count, caret_array);
#endif
/* set up rendering via spanners */
spanner_baton_t stuffbaton;
FT_Raster_Params ftr_params;
ftr_params.target = 0;
ftr_params.flags = FT_RASTER_FLAG_DIRECT | FT_RASTER_FLAG_AA;
ftr_params.user = &stuffbaton;
ftr_params.black_spans = 0;
ftr_params.bit_set = 0;
ftr_params.bit_test = 0;
/* Calculate string bounding box in pixels */
ftr_params.gray_spans = spanner_sizer;
/* See http://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html */
int max_x = INT_MIN; // largest coordinate a pixel has been set at, or the pen was advanced to.
int min_x = INT_MAX; // smallest coordinate a pixel has been set at, or the pen was advanced to.
int max_y = INT_MIN; // this is max topside bearing along the string.
int min_y = INT_MAX; // this is max value of (height - topbearing) along the string.
/* Naturally, the above comments swap their meaning between horizontal and vertical scripts,
since the pen changes the axis it is advanced along.
However, their differences still make up the bounding box for the string.
Also note that all this is in FT coordinate system where y axis points upwards.
*/
int sizer_x = 0;
int sizer_y = 0; /* in FT coordinate system. */
printf("----------------------------------------------------\n");
for (unsigned j = 0; j < glyph_count; ++j)
{
hb_ot_layout_glyph_class_t glyph_type = hb_ot_layout_get_glyph_class(hb_font_get_face(hb_ft_font[i]), glyph_info[j].codepoint);
hb_glyph_flags_t glyph_type_flags = hb_glyph_info_get_glyph_flags(&glyph_info[j]);
printf(
"glyph(%s, flags: %d): gid:%d, cluster:%d, [%d, %d, %d, %d, %d]\n", num_glyph_types[glyph_type], glyph_type_flags, (int)glyph_info[j].codepoint, (int)glyph_info[j].cluster,
glyph_pos[j].x_advance, glyph_pos[j].y_advance, glyph_pos[j].x_offset, glyph_pos[j].y_offset, glyph_pos[j].var);
}
FT_Error fterr;
for (unsigned j = 0; j < glyph_count; ++j)
{
if ((fterr = FT_Load_Glyph(ft_face[i], glyph_info[j].codepoint, 0)))
{
printf("load %08x failed fterr=%d.\n", glyph_info[j].codepoint, fterr);
}
else
{
if (ft_face[i]->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
{
printf("glyph->format = %4s\n", (char *)&ft_face[i]->glyph->format);
}
else
{
int gx = sizer_x + (glyph_pos[j].x_offset / 64);
int gy = sizer_y + (glyph_pos[j].y_offset / 64); // note how the sign differs from the rendering pass
stuffbaton.min_span_x = INT_MAX;
stuffbaton.max_span_x = INT_MIN;
stuffbaton.min_y = INT_MAX;
stuffbaton.max_y = INT_MIN;
if ((fterr = FT_Outline_Render(ft_library, &ft_face[i]->glyph->outline, &ftr_params)))
printf("FT_Outline_Render() failed err=%d\n", fterr);
if (stuffbaton.min_span_x != INT_MAX)
{
/* Update values if the spanner was actually called. */
if (min_x > stuffbaton.min_span_x + gx)
min_x = stuffbaton.min_span_x + gx;
if (max_x < stuffbaton.max_span_x + gx)
max_x = stuffbaton.max_span_x + gx;
if (min_y > stuffbaton.min_y + gy)
min_y = stuffbaton.min_y + gy;
if (max_y < stuffbaton.max_y + gy)
max_y = stuffbaton.max_y + gy;
}
else
{
/* The spanner wasn't called at all - an empty glyph, like space. */
if (min_x > gx)
min_x = gx;
if (max_x < gx)
max_x = gx;
if (min_y > gy)
min_y = gy;
if (max_y < gy)
max_y = gy;
}
}
}
sizer_x += glyph_pos[j].x_advance / 64;
sizer_y += glyph_pos[j].y_advance / 64; // note how the sign differs from the rendering pass
}
/* Still have to take into account last glyph's advance. Or not? */
if (min_x > sizer_x)
min_x = sizer_x;
if (max_x < sizer_x)
max_x = sizer_x;
if (min_y > sizer_y)
min_y = sizer_y;
if (max_y < sizer_y)
max_y = sizer_y;
/* The bounding box */
int bbox_w = max_x - min_x;
int bbox_h = max_y - min_y;
/* Two offsets below position the bounding box with respect to the 'origin',
which is sort of origin of string's first glyph.
baseline_offset - offset perpendecular to the baseline to the topmost (horizontal),
or leftmost (vertical) pixel drawn.
baseline_shift - offset along the baseline, from the first drawn glyph's origin
to the leftmost (horizontal), or topmost (vertical) pixel drawn.
Thus those offsets allow positioning the bounding box to fit the rendered string,
as they are in fact offsets from the point given to the renderer, to the top left
corner of the bounding box.
NB: baseline is defined as y==0 for horizontal and x==0 for vertical scripts.
(0,0) here is where the first glyph's origin ended up after shaping, not taking
into account glyph_pos[0].xy_offset (yeah, my head hurts too).
*/
int baseline_offset;
int baseline_shift;
if (HB_DIRECTION_IS_HORIZONTAL(hb_buffer_get_direction(buf)))
{
baseline_offset = max_y;
baseline_shift = min_x;
}
if (HB_DIRECTION_IS_VERTICAL(hb_buffer_get_direction(buf)))
{
baseline_offset = min_x;
baseline_shift = max_y;
}
/* The pen/baseline start coordinates in window coordinate system
- with those text placement in the window is controlled.
- note that for RTL scripts pen still goes LTR */
int x = 0, y = 50 + i * 75;
if (i == ENGLISH)
{
x = 20;
} /* left justify */
if (i == ARABIC)
{
x = width - bbox_w - 20;
} /* right justify */
if (i == CHINESE)
{
x = width / 2 - bbox_w / 2;
} /* center, and for TTB script h_advance is half-width. */
/* Draw baseline and the bounding box */
/* The below is complicated since we simultaneously
convert to the window coordinate system. */
int left, right, top, bottom;
if (HB_DIRECTION_IS_HORIZONTAL(hb_buffer_get_direction(buf)))
{
/* bounding box in window coordinates without offsets */
left = x;
right = x + bbox_w;
top = y - bbox_h;
bottom = y;
/* apply offsets */
left += baseline_shift;
right += baseline_shift;
top -= baseline_offset - bbox_h;
bottom -= baseline_offset - bbox_h;
/* draw the baseline */
hline(&oDrawer, x, x + bbox_w, y, 0x0000ff00);
}
if (HB_DIRECTION_IS_VERTICAL(hb_buffer_get_direction(buf)))
{
left = x;
right = x + bbox_w;
top = y;
bottom = y + bbox_h;
left += baseline_offset;
right += baseline_offset;
top -= baseline_shift;
bottom -= baseline_shift;
vline(&oDrawer, y, y + bbox_h, x, 0x0000ff00);
}
/* +1/-1 are for the bbox borders be the next pixel outside the bbox itself */
hline(&oDrawer, left - 1, right + 1, top - 1, 0xffff0000);
hline(&oDrawer, left - 1, right + 1, bottom + 1, 0xffff0000);
vline(&oDrawer, top - 1, bottom + 1, left - 1, 0xffff0000);
vline(&oDrawer, top - 1, bottom + 1, right + 1, 0xffff0000);
/* set rendering spanner */
ftr_params.gray_spans = spanner;
/* initialize rendering part of the baton */
stuffbaton.pixels = NULL;
stuffbaton.first_pixel = (uint32_t *)oDrawer.pixels;
stuffbaton.last_pixel = (uint32_t *)(((uint8_t *)oDrawer.pixels) + oDrawer.pitch * oDrawer.height);
stuffbaton.pitch = oDrawer.pitch;
stuffbaton.rshift = oDrawer.Rshift;
stuffbaton.gshift = oDrawer.Gshift;
stuffbaton.bshift = oDrawer.Bshift;
/* render */
for (unsigned j = 0; j < glyph_count; ++j)
{
if ((fterr = FT_Load_Glyph(ft_face[i], glyph_info[j].codepoint, 0)))
{
printf("load %08x failed fterr=%d.\n", glyph_info[j].codepoint, fterr);
}
else
{
if (ft_face[i]->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
{
printf("glyph->format = %4s\n", (char *)&ft_face[i]->glyph->format);
}
else
{
int gx = x + (glyph_pos[j].x_offset / 64);
int gy = y - (glyph_pos[j].y_offset / 64);
stuffbaton.pixels = (uint32_t *)(((uint8_t *)oDrawer.pixels) + gy * oDrawer.pitch) + gx;
if ((fterr = FT_Outline_Render(ft_library, &ft_face[i]->glyph->outline, &ftr_params)))
printf("FT_Outline_Render() failed err=%d\n", fterr);
}
}
x += glyph_pos[j].x_advance / 64;
y -= glyph_pos[j].y_advance / 64;
}
/* clean up the buffer, but don't kill it just yet */
hb_buffer_clear_contents(buf);
}
/* Cleanup */
hb_buffer_destroy(buf);
for (int i = 0; i < NUM_EXAMPLES; ++i)
hb_font_destroy(hb_ft_font[i]);
FT_Done_FreeType(ft_library);
oDrawer.Save();
return 0;
}

View File

@ -0,0 +1,19 @@
CONFIG -= qt
TARGET = test
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CORE_ROOT_DIR = $$PWD/../../../../../core
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
include($$CORE_ROOT_DIR/DesktopEditor/graphics/pro/freetype.pri)
include($$CORE_ROOT_DIR/Common/3dParty/harfbuzz/harfbuzz.pri)
SOURCES += main.cpp
ADD_DEPENDENCY(UnicodeConverter, kernel, graphics)
DESTDIR = $$PWD/build

View File

@ -49,6 +49,8 @@ namespace NSCSS
if (!oElement.m_sId.empty())
m_sId += L'+' + oElement.m_sId;
m_arParentsStyles.insert(oElement.m_arParentsStyles.begin(), oElement.m_arParentsStyles.end());
return *this;
}
@ -69,6 +71,8 @@ namespace NSCSS
m_oDisplay = oElement.m_oDisplay;
m_oTransform = oElement.m_oTransform;
m_arParentsStyles = oElement.m_arParentsStyles;
return *this;
}
@ -109,7 +113,8 @@ namespace NSCSS
bool CCompiledStyle::Empty() const
{
return m_oBackground.Empty() && m_oBorder.Empty() && m_oFont.Empty() &&
m_oMargin.Empty() && m_oPadding.Empty() && m_oText.Empty() && m_oDisplay.Empty();
m_oMargin.Empty() && m_oPadding.Empty() && m_oText.Empty() &&
m_oDisplay.Empty() && m_oTransform.Empty();
}
void CCompiledStyle::AddPropSel(const std::wstring& sProperty, const std::wstring& sValue, const unsigned int unLevel, const bool& bHardMode)
@ -314,6 +319,7 @@ namespace NSCSS
}
//BORDER TOP
CASE(L"border-top"):
CASE(L"mso-border-top-alt"):
{
m_oBorder.SetTopSide(pPropertie.second, unLevel, bHardMode);
break;
@ -335,6 +341,7 @@ namespace NSCSS
}
//BORDER RIGHT
CASE(L"border-right"):
CASE(L"mso-border-right-alt"):
{
m_oBorder.SetRightSide(pPropertie.second, unLevel, bHardMode);
break;
@ -356,6 +363,7 @@ namespace NSCSS
}
//BORDER bottom
CASE(L"border-bottom"):
CASE(L"mso-border-bottom-alt"):
{
m_oBorder.SetBottomSide(pPropertie.second, unLevel, bHardMode);
break;
@ -377,6 +385,7 @@ namespace NSCSS
}
//BORDER LEFT
CASE(L"border-left"):
CASE(L"mso-border-left-alt"):
{
m_oBorder.SetLeftSide(pPropertie.second, unLevel, bHardMode);
break;
@ -521,7 +530,7 @@ namespace NSCSS
{
return m_sId;
}
bool CCompiledStyle::HaveThisParent(const std::wstring &wsParentName) const
{
return m_arParentsStyles.end() != m_arParentsStyles.find(wsParentName);

View File

@ -1,9 +1,6 @@
#ifndef CCOMPILEDSTYLE_H
#define CCOMPILEDSTYLE_H
#include "CssCalculator_global.h"
#include "ConstValues.h"
#include <map>
#include <set>
#include <vector>

View File

@ -13,14 +13,9 @@ namespace NSCSS
delete m_pInternal;
}
CCompiledStyle CCssCalculator::GetCompiledStyle(const std::vector<CNode> &arSelectors) const
bool CCssCalculator::CalculateCompiledStyle(std::vector<CNode>& arSelectors) const
{
return m_pInternal->GetCompiledStyle(arSelectors);
}
bool CCssCalculator::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors) const
{
return m_pInternal->GetCompiledStyle(oStyle, arSelectors);
return m_pInternal->CalculateCompiledStyle(arSelectors);
}
std::wstring CCssCalculator::CalculateStyleId(const CNode& oNode)
@ -63,6 +58,26 @@ namespace NSCSS
return m_pInternal->GetDpi();
}
void CCssCalculator::ClearPageData()
{
m_pInternal->ClearPageData();
}
void CCssCalculator::ClearEmbeddedStyles()
{
m_pInternal->ClearEmbeddedStyles();
}
void CCssCalculator::ClearAllowedStyleFiles()
{
m_pInternal->ClearAllowedStyleFiles();
}
void CCssCalculator::ClearStylesFromFile(const std::wstring& wsFilePath)
{
m_pInternal->ClearStylesFromFile(wsFilePath);
}
void CCssCalculator::Clear()
{
m_pInternal->Clear();

View File

@ -2,10 +2,8 @@
#define CCSSCALCULATOR_H
#include "CssCalculator_global.h"
#include "CCompiledStyle.h"
#include "ConstValues.h"
#include <iostream>
#include <map>
#include "StyleProperties.h"
#include "CNode.h"
#include <vector>
namespace NSCSS
@ -19,8 +17,7 @@ namespace NSCSS
CCssCalculator();
~CCssCalculator();
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors) const;
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors) const;
bool CalculateCompiledStyle(std::vector<CNode>& arSelectors) const;
std::wstring CalculateStyleId(const CNode& oNode);
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
@ -35,6 +32,10 @@ namespace NSCSS
std::wstring GetEncoding() const;
unsigned short int GetDpi() const;
void ClearPageData();
void ClearEmbeddedStyles();
void ClearAllowedStyleFiles();
void ClearStylesFromFile(const std::wstring& wsFilePath);
void Clear();
};
}

View File

@ -2,15 +2,10 @@
#include <string>
#include <vector>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <numeric>
#include "../../katana-parser/src/selector.h"
#include "../../../../../UnicodeConverter/UnicodeConverter.h"
#include "ConstValues.h"
#include "../../../../../DesktopEditor/common/File.h"
#include "StaticFunctions.h"
@ -41,58 +36,120 @@ bool operator<(const std::vector<NSCSS::CNode> &arLeftSelectors, const std::vect
namespace NSCSS
{
CCssCalculator_Private::CCssCalculator_Private() : m_nDpi(96), m_nCountNodes(0), m_sEncoding(L"UTF-8"){}
CStyleStorage::CStyleStorage()
{}
CCssCalculator_Private::~CCssCalculator_Private()
CStyleStorage::~CStyleStorage()
{
m_arFiles.clear();
for (std::map<std::wstring, CElement*>::iterator oIter = m_mData.begin(); oIter != m_mData.end(); ++oIter)
if (oIter->second != NULL)
delete oIter->second;
m_mData.clear();
Clear();
}
inline void CCssCalculator_Private::GetOutputData(KatanaOutput *oOutput)
void CStyleStorage::Clear()
{
if ( NULL == oOutput )
return;
for (TStyleFileData* pStyleFileData : m_arStyleFiles)
{
if (nullptr == pStyleFileData)
continue;
switch (oOutput->mode) {
case KatanaParserModeStylesheet:
GetStylesheet(oOutput->stylesheet);
break;
case KatanaParserModeRule:
GetRule(oOutput->rule);
break;
case KatanaParserModeKeyframeRule:
case KatanaParserModeKeyframeKeyList:
case KatanaParserModeMediaList:
case KatanaParserModeValue:
case KatanaParserModeSelector:
case KatanaParserModeDeclarationList:
break;
for (std::map<std::wstring, CElement*>::iterator oIter = pStyleFileData->m_mStyleData.begin(); oIter != pStyleFileData->m_mStyleData.end(); ++oIter)
if (oIter->second != nullptr)
delete oIter->second;
delete pStyleFileData;
}
m_arStyleFiles.clear();
m_arEmptyStyleFiles.clear();
ClearEmbeddedStyles();
ClearAllowedStyleFiles();
#ifdef CSS_CALCULATOR_WITH_XHTML
ClearPageData();
#endif
}
void CStyleStorage::AddStyles(const std::string& sStyle)
{
if (sStyle.empty())
return;
KatanaOutput *output = katana_parse(sStyle.c_str(), sStyle.length(), KatanaParserModeStylesheet);
this->GetOutputData(output, m_mEmbeddedStyleData);
katana_destroy_output(output);
}
void CStyleStorage::AddStyles(const std::wstring& wsStyle)
{
if (wsStyle.empty())
return;
#ifdef CSS_CALCULATOR_WITH_XHTML
std::wregex oRegex(L"@page\\s*([^{]*)(\\{[^}]*\\})");
std::wsmatch oMatch;
std::wstring::const_iterator oSearchStart(wsStyle.cbegin());
while (std::regex_search(oSearchStart, wsStyle.cend(), oMatch, oRegex))
{
AddPageData(oMatch[1].str(), oMatch[2].str());
oSearchStart = oMatch.suffix().first;
}
#endif
AddStyles(U_TO_UTF8(wsStyle));
}
void CStyleStorage::AddStylesFromFile(const std::wstring& wsFileName)
{
std::set<std::wstring>::const_iterator itEmptyFileFound = m_arEmptyStyleFiles.find(wsFileName);
if (m_arEmptyStyleFiles.cend() != itEmptyFileFound)
return;
std::vector<TStyleFileData*>::const_iterator itFound = std::find_if(m_arStyleFiles.cbegin(), m_arStyleFiles.cend(),
[wsFileName](const TStyleFileData* pStyleFileData)
{ return wsFileName == pStyleFileData->m_wsStyleFilepath; });
m_arAllowedStyleFiles.insert(wsFileName);
if (m_arStyleFiles.cend() != itFound)
return;
TStyleFileData *pStyleFileData = new TStyleFileData();
pStyleFileData->m_wsStyleFilepath = wsFileName;
AddStyles(NS_STATIC_FUNCTIONS::GetContentAsUTF8(wsFileName), pStyleFileData->m_mStyleData);
if (!pStyleFileData->m_mStyleData.empty())
m_arStyleFiles.push_back(pStyleFileData);
else
{
m_arEmptyStyleFiles.insert(wsFileName);
delete pStyleFileData;
}
}
void CStyleStorage::ClearStylesFromFile(const std::wstring& wsFileName)
{
std::vector<TStyleFileData*>::const_iterator itFound = std::find_if(m_arStyleFiles.cbegin(), m_arStyleFiles.cend(),
[wsFileName](const TStyleFileData* pStyleFileData)
{ return wsFileName == pStyleFileData->m_wsStyleFilepath; });
if (m_arStyleFiles.cend() != itFound)
{
m_arStyleFiles.erase(itFound);
delete *itFound;
}
}
#ifdef CSS_CALCULATOR_WITH_XHTML
std::map<std::wstring, std::wstring> CCssCalculator_Private::GetPageData(const std::wstring &wsPageName)
void CStyleStorage::AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles)
{
if (m_arPageDatas.empty())
return {};
for (const TPageData& oPageData : m_arPageDatas)
{
if (std::find(oPageData.m_wsNames.begin(), oPageData.m_wsNames.end(), wsPageName) != oPageData.m_wsNames.end())
return oPageData.m_mData;
}
return {};
m_arPageDatas.push_back({NS_STATIC_FUNCTIONS::GetWordsW(wsPageName), NS_STATIC_FUNCTIONS::GetRules(wsStyles)});
}
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
void CStyleStorage::SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode)
{
for (const std::pair<std::wstring, std::wstring> &oData : mData)
{
@ -107,149 +164,84 @@ namespace NSCSS
}
}
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors)
std::map<std::wstring, std::wstring> CStyleStorage::GetPageData(const std::wstring& wsPageName)
{
std::vector<std::wstring> arNodes;
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
{
if (!oNode->m_wsName.empty())
arNodes.push_back(oNode->m_wsName);
if (!oNode->m_wsClass.empty())
{
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
{
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
arNodes.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
[](std::wstring sRes, const std::wstring& sClass)
{return sRes += L'.' + sClass + L' ';}));
}
else
arNodes.push_back(L'.' + oNode->m_wsClass);
}
if (!oNode->m_wsId.empty())
arNodes.push_back(L'#' + oNode->m_wsId);
}
return arNodes;
}
void CCssCalculator_Private::FindPrevAndKindElements(const CElement *pElement, const std::vector<std::wstring> &arNextNodes, std::vector<CElement*>& arFindedElements, const std::wstring &wsName, const std::vector<std::wstring> &arClasses)
{
if (arNextNodes.empty())
return;
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
if (!arTempPrev.empty())
arFindedElements.insert(arFindedElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindedElements.insert(arFindedElements.end(), arTempKins.begin(), arTempKins.end());
}
std::vector<CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes)
{
if (arNodes.empty())
if (m_arPageDatas.empty())
return {};
std::vector<CElement*> arFindedElements;
std::wstring wsName, wsId;
std::vector<std::wstring> arClasses;
if (!arNodes.empty() && arNodes.back()[0] == L'#')
for (const TPageData& oPageData : m_arPageDatas)
{
wsId = arNodes.back();
arNodes.pop_back();
arNextNodes.push_back(wsId);
if (std::find(oPageData.m_wsNames.begin(), oPageData.m_wsNames.end(), wsPageName) != oPageData.m_wsNames.end())
return oPageData.m_mData;
}
if (!arNodes.empty() && arNodes.back()[0] == L'.')
{
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
arNextNodes.push_back(arNodes.back());
arNodes.pop_back();
}
return {};
}
if (!arNodes.empty())
{
wsName = arNodes.back();
arNodes.pop_back();
arNextNodes.push_back(wsName);
}
const std::map<std::wstring, CElement*>::const_iterator oFindName = m_mData.find(wsName);
std::map<std::wstring, CElement*>::const_iterator oFindId;
if (!wsId.empty())
{
oFindId = m_mData.find(wsId);
if (m_mData.cend() != oFindId)
{
if (!oFindId->second->Empty())
arFindedElements.push_back(oFindId->second);
FindPrevAndKindElements(oFindId->second, arNextNodes, arFindedElements, wsName);
}
}
if (!arClasses.empty())
{
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
{
const std::map<std::wstring, CElement*>::const_iterator oFindClass = m_mData.find(*iClass);
if (oFindClass != m_mData.cend())
{
if (!oFindClass->second->Empty())
arFindedElements.push_back(oFindClass->second);
FindPrevAndKindElements(oFindClass->second, arNextNodes, arFindedElements, wsName);
}
}
}
if (oFindName != m_mData.cend())
{
if (!oFindName->second->Empty())
arFindedElements.push_back(oFindName->second);
FindPrevAndKindElements(oFindName->second, arNextNodes, arFindedElements, wsName, arClasses);
}
if (arFindedElements.size() > 1)
{
std::sort(arFindedElements.rbegin(), arFindedElements.rend(),
[](CElement* oFirstElement, CElement* oSecondElement)
{
return oFirstElement->GetWeight() > oSecondElement->GetWeight();
});
}
return arFindedElements;
void CStyleStorage::ClearPageData()
{
m_arPageDatas.clear();
}
#endif
void CCssCalculator_Private::AddPageData(const std::wstring &wsPageNames, const std::wstring &wsStyles)
const CElement* CStyleStorage::FindElement(const std::wstring& wsSelector)
{
m_arPageDatas.push_back({NS_STATIC_FUNCTIONS::GetWordsW(wsPageNames), NS_STATIC_FUNCTIONS::GetRules(wsStyles)});
if (wsSelector.empty())
return nullptr;
const CElement* pFoundElement = FindSelectorFromStyleData(wsSelector, m_mEmbeddedStyleData);
if (nullptr != pFoundElement)
return pFoundElement;
for (std::vector<TStyleFileData*>::const_reverse_iterator itIter = m_arStyleFiles.crbegin(); itIter < m_arStyleFiles.crend(); ++itIter)
{
if (m_arAllowedStyleFiles.cend() == std::find(m_arAllowedStyleFiles.cbegin(), m_arAllowedStyleFiles.cend(), (*itIter)->m_wsStyleFilepath))
continue;
pFoundElement = FindSelectorFromStyleData(wsSelector, (*itIter)->m_mStyleData);
if (nullptr != pFoundElement)
return pFoundElement;
}
return nullptr;
}
inline void CCssCalculator_Private::GetStylesheet(const KatanaStylesheet *oStylesheet)
void CStyleStorage::AddStyles(const std::string& sStyle, std::map<std::wstring, CElement*>& mStyleData)
{
if (sStyle.empty())
return;
KatanaOutput *output = katana_parse(sStyle.c_str(), sStyle.length(), KatanaParserModeStylesheet);
this->GetOutputData(output, mStyleData);
katana_destroy_output(output);
}
void CStyleStorage::ClearEmbeddedStyles()
{
for (std::map<std::wstring, CElement*>::iterator oIter = m_mEmbeddedStyleData.begin(); oIter != m_mEmbeddedStyleData.end(); ++oIter)
if (oIter->second != nullptr)
delete oIter->second;
m_mEmbeddedStyleData.clear();
}
void CStyleStorage::ClearAllowedStyleFiles()
{
m_arAllowedStyleFiles.clear();
}
void CStyleStorage::GetStylesheet(const KatanaStylesheet* oStylesheet, std::map<std::wstring, CElement*>& mStyleData)
{
for (size_t i = 0; i < oStylesheet->imports.length; ++i)
GetRule((KatanaRule*)oStylesheet->imports.data[i]);
GetRule((KatanaRule*)oStylesheet->imports.data[i], mStyleData);
for (size_t i = 0; i < oStylesheet->rules.length; ++i)
GetRule((KatanaRule*)oStylesheet->rules.data[i]);
GetRule((KatanaRule*)oStylesheet->rules.data[i], mStyleData);
}
inline void CCssCalculator_Private::GetRule(const KatanaRule *oRule)
void CStyleStorage::GetRule(const KatanaRule* oRule, std::map<std::wstring, CElement*>& mStyleData)
{
if ( NULL == oRule )
return;
@ -257,7 +249,7 @@ namespace NSCSS
switch (oRule->type) {
case KatanaRuleStyle:
{
GetStyleRule((KatanaStyleRule*)oRule);
GetStyleRule((KatanaStyleRule*)oRule, mStyleData);
break;
}
default:
@ -265,7 +257,7 @@ namespace NSCSS
}
}
inline void CCssCalculator_Private::GetStyleRule(const KatanaStyleRule *oRule)
void CStyleStorage::GetStyleRule(const KatanaStyleRule* oRule, std::map<std::wstring, CElement*>& mStyleData)
{
if (oRule->declarations->length == 0)
return;
@ -281,7 +273,7 @@ namespace NSCSS
for (std::vector<std::wstring>::reverse_iterator oWord = arWords.rbegin(); oWord != arWords.rend(); ++oWord)
{
const size_t posPoint = oWord->find(L'.');
const size_t posPoint = oWord->find(L'.');
const size_t posLattice = oWord->find(L'#');
const std::wstring sName = (posPoint != std::wstring::npos) ? oWord->substr(0, posPoint) : (posLattice != std::wstring::npos) ? oWord->substr(0, posLattice) : *oWord;
@ -297,8 +289,8 @@ namespace NSCSS
{
if (NULL == oFirstElement && bCreateFirst)
{
const std::map<std::wstring, CElement*>::const_iterator& oFindId = m_mData.find(sId);
if (oFindId != m_mData.end())
const std::map<std::wstring, CElement*>::const_iterator& oFindId = mStyleData.find(sId);
if (oFindId != mStyleData.end())
{
oIdElement = oFindId->second;
bCreateFirst = false;
@ -326,8 +318,8 @@ namespace NSCSS
{
if (NULL == oFirstElement && bCreateFirst)
{
const std::map<std::wstring, CElement*>::const_iterator& oFindClass = m_mData.find(sClass);
if (oFindClass != m_mData.end())
const std::map<std::wstring, CElement*>::const_iterator& oFindClass = mStyleData.find(sClass);
if (oFindClass != mStyleData.end())
{
oClassElement = oFindClass->second;
bCreateFirst = false;
@ -359,8 +351,8 @@ namespace NSCSS
{
if (NULL == oFirstElement && bCreateFirst)
{
const std::map<std::wstring, CElement*>::const_iterator& oFindName = m_mData.find(sName);
if (oFindName != m_mData.end())
const std::map<std::wstring, CElement*>::const_iterator& oFindName = mStyleData.find(sName);
if (oFindName != mStyleData.end())
{
oNameElement = oFindName->second;
bCreateFirst = false;
@ -392,11 +384,16 @@ namespace NSCSS
oLastElement->AddProperties(mStyle);
if (NULL != oFirstElement)
m_mData[oFirstElement->GetSelector()] = oFirstElement;
mStyleData[oFirstElement->GetSelector()] = oFirstElement;
}
}
inline std::vector<std::wstring> CCssCalculator_Private::GetSelectorList(const KatanaArray* oSelectors) const
std::wstring CStyleStorage::GetValueList(const KatanaArray* oValues)
{
return StringifyValueList(oValues);
}
std::vector<std::wstring> CStyleStorage::GetSelectorList(const KatanaArray* oSelectors) const
{
if (oSelectors->length == 0)
return std::vector<std::wstring>();
@ -409,7 +406,7 @@ namespace NSCSS
return arSelectors;
}
inline std::wstring CCssCalculator_Private::GetSelector(const KatanaSelector *oSelector) const
std::wstring CStyleStorage::GetSelector(const KatanaSelector* oSelector) const
{
KatanaParser oParser;
oParser.options = &kKatanaDefaultOptions;
@ -428,7 +425,7 @@ namespace NSCSS
return wsText;
}
inline std::map<std::wstring, std::wstring> CCssCalculator_Private::GetDeclarationList(const KatanaArray* oDeclarations) const
std::map<std::wstring, std::wstring> CStyleStorage::GetDeclarationList(const KatanaArray* oDeclarations) const
{
if(oDeclarations->length == 0)
return std::map<std::wstring, std::wstring>();
@ -441,7 +438,7 @@ namespace NSCSS
return arDeclarations;
}
inline std::pair<std::wstring, std::wstring> CCssCalculator_Private::GetDeclaration(const KatanaDeclaration* oDecl) const
std::pair<std::wstring, std::wstring> CStyleStorage::GetDeclaration(const KatanaDeclaration* oDecl) const
{
std::wstring sValueList = StringifyValueList(oDecl->values);
@ -451,25 +448,45 @@ namespace NSCSS
return std::make_pair(UTF8_TO_U(std::string(oDecl->property)), sValueList);
}
inline std::wstring CCssCalculator_Private::GetValueList(const KatanaArray *oValues)
void CStyleStorage::GetOutputData(KatanaOutput* oOutput, std::map<std::wstring, CElement*>& mStyleData)
{
return StringifyValueList(oValues);
if ( NULL == oOutput )
return;
switch (oOutput->mode) {
case KatanaParserModeStylesheet:
GetStylesheet(oOutput->stylesheet, mStyleData);
break;
case KatanaParserModeRule:
GetRule(oOutput->rule, mStyleData);
break;
case KatanaParserModeKeyframeRule:
case KatanaParserModeKeyframeKeyList:
case KatanaParserModeMediaList:
case KatanaParserModeValue:
case KatanaParserModeSelector:
case KatanaParserModeDeclarationList:
break;
}
}
const CElement* CStyleStorage::FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData)
{
std::map<std::wstring, CElement*>::const_iterator itFound = mStyleData.find(wsSelector);
if (mStyleData.cend() != itFound)
return itFound->second;
return nullptr;
}
CCssCalculator_Private::CCssCalculator_Private() : m_nDpi(96), m_nCountNodes(0), m_sEncoding(L"UTF-8"){}
CCssCalculator_Private::~CCssCalculator_Private()
{}
#ifdef CSS_CALCULATOR_WITH_XHTML
CCompiledStyle CCssCalculator_Private::GetCompiledStyle(const std::vector<CNode>& arSelectors)
{
if (arSelectors.empty())
return CCompiledStyle();
CCompiledStyle oStyle;
GetCompiledStyle(oStyle, arSelectors);
return oStyle;
}
bool CCssCalculator_Private::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors)
bool CCssCalculator_Private::CalculateCompiledStyle(std::vector<CNode>& arSelectors)
{
if (arSelectors.empty())
return false;
@ -478,58 +495,214 @@ namespace NSCSS
if (oItem != m_mUsedStyles.end())
{
oStyle = oItem->second;
arSelectors.back().SetCompiledStyle(new CCompiledStyle(oItem->second));
return true;
}
oStyle.SetDpi(m_nDpi);
arSelectors.back().m_pCompiledStyle->SetDpi(m_nDpi);
unsigned int unStart = 0;
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
std::vector<CNode>::const_reverse_iterator itFound = std::find_if(arSelectors.crbegin(), arSelectors.crend(), [](const CNode& oNode){ return !oNode.m_pCompiledStyle->Empty(); });
if (itFound != arSelectors.crend())
unStart = itFound.base() - arSelectors.cbegin();
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors, unStart);
std::vector<std::wstring> arPrevNodes;
bool bInTable = false;
for (size_t i = 0; i < arSelectors.size(); ++i)
for (size_t i = 0; i < unStart; ++i)
{
oStyle.AddParent(arSelectors[i].m_wsName);
if (!bInTable)
bInTable = IsTableElement(arSelectors[i].m_wsName);
else
break;
}
for (size_t i = unStart; i < arSelectors.size(); ++i)
{
if (0 != i)
*arSelectors[i].m_pCompiledStyle += *arSelectors[i - 1].m_pCompiledStyle;
arSelectors[i].m_pCompiledStyle->AddParent(arSelectors[i].m_wsName);
if (!bInTable)
bInTable = IsTableElement(arSelectors[i].m_wsName);
if (bInTable)
{
oStyle.m_oBackground.Clear();
oStyle.m_oBorder.Clear();
arSelectors[i].m_pCompiledStyle->m_oBackground.Clear();
arSelectors[i].m_pCompiledStyle->m_oBorder.Clear();
}
CCompiledStyle oTempStyle;
oTempStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_mAttributes, i + 1);
for (const CElement* oElement : FindElements(arNodes, arPrevNodes))
oTempStyle.AddStyle(oElement->GetStyle(), i + 1);
arSelectors[i].m_pCompiledStyle->AddStyle(oElement->GetStyle(), i + 1);
if (!arSelectors[i].m_wsStyle.empty())
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
oStyle += oTempStyle;
arSelectors[i].m_pCompiledStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
// Скидываем некоторые внешние стили, которые внутри таблицы переопределяются
if (bInTable && i < arSelectors.size() - 1)
{
oStyle.m_oFont.GetLineHeight().Clear();
oStyle.m_oPadding.Clear();
oStyle.m_oMargin.Clear();
arSelectors[i].m_pCompiledStyle->m_oFont.GetLineHeight().Clear();
arSelectors[i].m_pCompiledStyle->m_oPadding.Clear();
arSelectors[i].m_pCompiledStyle->m_oMargin.Clear();
}
}
oStyle.SetID(CalculateStyleId(arSelectors.back()));
arSelectors.back().m_pCompiledStyle->SetID(CalculateStyleId(arSelectors.back()));
if (!oStyle.Empty())
m_mUsedStyles[arSelectors] = oStyle;
if (!arSelectors.back().m_pCompiledStyle->Empty())
m_mUsedStyles[arSelectors] = *arSelectors.back().m_pCompiledStyle;
return true;
}
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
{
//TODO:: пересмотреть данный метод
m_oStyleStorage.SetPageData(oPage, mData, unLevel, bHardMode);
}
std::map<std::wstring, std::wstring> CCssCalculator_Private::GetPageData(const std::wstring &wsPageName)
{
return m_oStyleStorage.GetPageData(wsPageName);
}
void CCssCalculator_Private::ClearPageData()
{
m_oStyleStorage.ClearPageData();
}
#endif
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors, unsigned int unStart)
{
std::vector<std::wstring> arNodes;
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend() - unStart; ++oNode)
{
if (!oNode->m_wsName.empty())
arNodes.push_back(oNode->m_wsName);
if (!oNode->m_wsClass.empty())
{
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
{
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
arNodes.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
[](std::wstring sRes, const std::wstring& sClass)
{return sRes += L'.' + sClass + L' ';}));
}
else
arNodes.push_back(L'.' + oNode->m_wsClass);
}
if (!oNode->m_wsId.empty())
arNodes.push_back(L'#' + oNode->m_wsId);
}
return arNodes;
}
void CCssCalculator_Private::FindPrevAndKindElements(const CElement *pElement, const std::vector<std::wstring> &arNextNodes, std::vector<const CElement*>& arFindedElements, const std::wstring &wsName, const std::vector<std::wstring> &arClasses)
{
if (arNextNodes.empty())
return;
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
if (!arTempPrev.empty())
arFindedElements.insert(arFindedElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindedElements.insert(arFindedElements.end(), arTempKins.begin(), arTempKins.end());
}
std::vector<const CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes)
{
if (arNodes.empty())
return {};
std::vector<const CElement*> arFindedElements;
std::wstring wsName, wsId;
std::vector<std::wstring> arClasses;
if (!arNodes.empty() && arNodes.back()[0] == L'#')
{
wsId = arNodes.back();
arNodes.pop_back();
arNextNodes.push_back(wsId);
}
if (!arNodes.empty() && arNodes.back()[0] == L'.')
{
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
arNextNodes.push_back(arNodes.back());
arNodes.pop_back();
}
if (!arNodes.empty())
{
wsName = arNodes.back();
arNodes.pop_back();
arNextNodes.push_back(wsName);
}
if (!wsId.empty())
{
const CElement* pFoundId = m_oStyleStorage.FindElement(wsId);
if(nullptr != pFoundId)
{
if (!pFoundId->Empty())
arFindedElements.push_back(pFoundId);
FindPrevAndKindElements(pFoundId, arNextNodes, arFindedElements, wsName);
}
}
if (!arClasses.empty())
{
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
{
const CElement* pFoundClass = m_oStyleStorage.FindElement(*iClass);
if (nullptr != pFoundClass)
{
if (!pFoundClass->Empty())
arFindedElements.push_back(pFoundClass);
FindPrevAndKindElements(pFoundClass, arNextNodes, arFindedElements, wsName);
}
}
}
const CElement* pFoundName = m_oStyleStorage.FindElement(wsName);
if (nullptr != pFoundName)
{
if (!pFoundName->Empty())
arFindedElements.push_back(pFoundName);
FindPrevAndKindElements(pFoundName, arNextNodes, arFindedElements, wsName, arClasses);
}
if (arFindedElements.size() > 1)
{
std::sort(arFindedElements.rbegin(), arFindedElements.rend(),
[](const CElement* oFirstElement, const CElement* oSecondElement)
{ return oFirstElement->GetWeight() > oSecondElement->GetWeight(); });
}
return arFindedElements;
}
#ifdef CSS_CALCULATOR_WITH_XHTML
std::wstring CCssCalculator_Private::CalculateStyleId(const CNode& oNode)
{
return oNode.m_wsName + ((!oNode.m_wsClass.empty()) ? L'.' + oNode.m_wsClass : L"") + ((oNode.m_wsId.empty()) ? L"" : L'#' + oNode.m_wsId) + L'-' + std::to_wstring(++m_nCountNodes);
@ -566,42 +739,20 @@ namespace NSCSS
return true;
}
#endif
void CCssCalculator_Private::AddStyles(const std::string &sStyle)
{
if (sStyle.empty())
return;
KatanaOutput *output = katana_parse(sStyle.c_str(), sStyle.length(), KatanaParserModeStylesheet);
this->GetOutputData(output);
katana_destroy_output(output);
void CCssCalculator_Private::AddStyles(const std::string& sStyle)
{
m_oStyleStorage.AddStyles(sStyle);
}
void CCssCalculator_Private::AddStyles(const std::wstring &wsStyle)
void CCssCalculator_Private::AddStyles(const std::wstring& wsStyle)
{
if (wsStyle.empty())
return;
std::wregex oRegex(L"@page\\s*([^{]*)(\\{[^}]*\\})");
std::wsmatch oMatch;
std::wstring::const_iterator oSearchStart(wsStyle.cbegin());
while (std::regex_search(oSearchStart, wsStyle.cend(), oMatch, oRegex))
{
AddPageData(oMatch[1].str(), oMatch[2].str());
oSearchStart = oMatch.suffix().first;
}
AddStyles(U_TO_UTF8(wsStyle));
m_oStyleStorage.AddStyles(wsStyle);
}
void CCssCalculator_Private::AddStylesFromFile(const std::wstring& wsFileName)
{
if (std::find(m_arFiles.begin(), m_arFiles.end(), wsFileName) != m_arFiles.end())
return;
m_arFiles.push_back(wsFileName);
AddStyles(NS_STATIC_FUNCTIONS::GetContentAsUTF8(wsFileName));
m_oStyleStorage.AddStylesFromFile(wsFileName);
}
void CCssCalculator_Private::SetDpi(unsigned short int nValue)
@ -614,9 +765,23 @@ namespace NSCSS
return m_nDpi;
}
const std::map<std::wstring, CElement *> *CCssCalculator_Private::GetData() const
void CCssCalculator_Private::ClearEmbeddedStyles()
{
return &m_mData;
m_oStyleStorage.ClearEmbeddedStyles();
#ifdef CSS_CALCULATOR_WITH_XHTML
m_mUsedStyles.clear();
#endif
}
void CCssCalculator_Private::ClearAllowedStyleFiles()
{
m_oStyleStorage.ClearAllowedStyleFiles();
}
void CCssCalculator_Private::ClearStylesFromFile(const std::wstring& wsFilePath)
{
m_oStyleStorage.ClearStylesFromFile(wsFilePath);
}
std::wstring CCssCalculator_Private::GetEncoding() const
@ -629,10 +794,21 @@ namespace NSCSS
m_sEncoding = L"UTF-8";
m_nDpi = 96;
m_mData.clear();
m_arFiles.clear();
m_oStyleStorage.Clear();
#ifdef CSS_CALCULATOR_WITH_XHTML
m_mUsedStyles.clear();
#endif
}
bool IsTableElement(const std::wstring& wsNameTag)
{
return L"td" == wsNameTag || L"tr" == wsNameTag || L"table" == wsNameTag ||
L"tbody" == wsNameTag || L"thead" == wsNameTag || L"tfoot" == wsNameTag ||
L"th" == wsNameTag;
}
}
inline static std::wstring StringifyValueList(const KatanaArray* oValues)
{
if (NULL == oValues)
@ -735,7 +911,7 @@ inline static std::wstring StringifyValue(const KatanaValue* oValue)
inline static bool IsTableElement(const std::wstring& wsNameTag)
{
return L"td" == wsNameTag || L"tr" == wsNameTag || L"table" == wsNameTag ||
return L"td" == wsNameTag || L"tr" == wsNameTag || L"table" == wsNameTag ||
L"tbody" == wsNameTag || L"thead" == wsNameTag || L"tfoot" == wsNameTag ||
L"th" == wsNameTag;
}

View File

@ -3,11 +3,9 @@
#include <vector>
#include <map>
#include <list>
#include <functional>
#include <set>
#include "CElement.h"
#include "ConstValues.h"
#include "CUnitMeasureConverter.h"
#include "StyleProperties.h"
#include "../../katana-parser/src/katana.h"
#ifdef CSS_CALCULATOR_WITH_XHTML
@ -16,15 +14,43 @@
namespace NSCSS
{
class CCssCalculator_Private
class CStyleStorage
{
unsigned short int m_nDpi;
unsigned short int m_nCountNodes;
public:
CStyleStorage();
~CStyleStorage();
std::list<std::wstring> m_arFiles;
void Clear();
std::map<std::wstring, CElement*> m_mData;
void AddStyles(const std::string& sStyle);
void AddStyles(const std::wstring& wsStyle);
void AddStylesFromFile(const std::wstring& wsFileName);
void ClearEmbeddedStyles();
void ClearAllowedStyleFiles();
void ClearStylesFromFile(const std::wstring& wsFileName);
#ifdef CSS_CALCULATOR_WITH_XHTML
void AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles);
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
std::map<std::wstring, std::wstring> GetPageData(const std::wstring& wsPageName);
void ClearPageData();
#endif
const CElement* FindElement(const std::wstring& wsSelector);
private:
typedef struct
{
std::wstring m_wsStyleFilepath;
std::map<std::wstring, CElement*> m_mStyleData;
} TStyleFileData;
std::set<std::wstring> m_arEmptyStyleFiles;
std::set<std::wstring> m_arAllowedStyleFiles;
std::vector<TStyleFileData*> m_arStyleFiles;
std::map<std::wstring, CElement*> m_mEmbeddedStyleData;
#ifdef CSS_CALCULATOR_WITH_XHTML
typedef struct
{
std::vector<std::wstring> m_wsNames;
@ -32,27 +58,14 @@ namespace NSCSS
} TPageData;
std::vector<TPageData> m_arPageDatas;
#ifdef CSS_CALCULATOR_WITH_XHTML
std::map<std::vector<CNode>, CCompiledStyle> m_mUsedStyles;
std::map<std::wstring, std::wstring> GetPageData(const std::wstring& wsPageName);
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors);
void FindPrevAndKindElements(const CElement* pElement, const std::vector<std::wstring>& arNextNodes, std::vector<CElement*>& arFindedElements, const std::wstring& wsName, const std::vector<std::wstring>& arClasses = {});
std::vector<CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes);
#endif
private:
void AddStyles(const std::string& sStyle, std::map<std::wstring, CElement*>& mStyleData);
std::wstring m_sEncoding;
void GetStylesheet(const KatanaStylesheet* oStylesheet, std::map<std::wstring, CElement*>& mStyleData);
void GetRule(const KatanaRule* oRule, std::map<std::wstring, CElement*>& mStyleData);
void AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles);
void GetStylesheet(const KatanaStylesheet* oStylesheet);
void GetRule(const KatanaRule* oRule);
void GetStyleRule(const KatanaStyleRule* oRule);
void GetStyleRule(const KatanaStyleRule* oRule, std::map<std::wstring, CElement*>& mStyleData);
std::wstring GetValueList(const KatanaArray* oValues);
@ -62,20 +75,44 @@ namespace NSCSS
std::map<std::wstring, std::wstring> GetDeclarationList(const KatanaArray* oDeclarations) const;
std::pair<std::wstring, std::wstring> GetDeclaration(const KatanaDeclaration* oDecl) const;
void GetOutputData(KatanaOutput* oOutput);
void GetOutputData(KatanaOutput* oOutput, std::map<std::wstring, CElement*>& mStyleData);
const CElement* FindSelectorFromStyleData(const std::wstring& wsSelector, const std::map<std::wstring, CElement*>& mStyleData);
};
class CCssCalculator_Private
{
unsigned short int m_nDpi;
unsigned short int m_nCountNodes;
CStyleStorage m_oStyleStorage;
#ifdef CSS_CALCULATOR_WITH_XHTML
std::map<std::vector<CNode>, CCompiledStyle> m_mUsedStyles;
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
std::map<std::wstring, std::wstring> GetPageData(const std::wstring &wsPageName);
#endif
void FindPrevAndKindElements(const CElement* pElement, const std::vector<std::wstring>& arNextNodes, std::vector<const CElement*>& arFindedElements, const std::wstring& wsName, const std::vector<std::wstring>& arClasses = {});
std::wstring m_sEncoding;
public:
CCssCalculator_Private();
~CCssCalculator_Private();
#ifdef CSS_CALCULATOR_WITH_XHTML
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors);
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors);
bool CalculateCompiledStyle(std::vector<CNode>& arSelectors);
std::wstring CalculateStyleId(const CNode& oNode);
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
void ClearPageData();
#endif
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors, unsigned int unStart = 0);
std::vector<const CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes);
void AddStyles(const std::string& sStyle);
void AddStyles(const std::wstring& wsStyle);
void AddStylesFromFile(const std::wstring& wsFileName);
@ -85,10 +122,12 @@ namespace NSCSS
std::wstring GetEncoding() const;
unsigned short int GetDpi() const;
const std::map<std::wstring, CElement*>* GetData() const;
void ClearEmbeddedStyles();
void ClearAllowedStyleFiles();
void ClearStylesFromFile(const std::wstring& wsFilePath);
void Clear();
};
inline bool IsTableElement(const std::wstring& wsNameTag);
}
#endif // CCSSCALCULATOR_PRIVATE_H

View File

@ -40,6 +40,7 @@ namespace NSCSS
{
m_sSelector = sSelector;
m_sFullSelector = m_sSelector;
UpdateWeight();
}
void NSCSS::CElement::AddPropertie(const std::wstring &sName, const std::wstring& sValue)
@ -67,6 +68,7 @@ namespace NSCSS
m_arPrevElements.push_back(oPrevElement);
oPrevElement->m_sFullSelector += L' ' + m_sFullSelector;
UpdateWeight();
}
void CElement::AddKinElement(CElement *oKinElement)
@ -76,6 +78,7 @@ namespace NSCSS
m_arKinElements.push_back(oKinElement);
oKinElement->m_sFullSelector += m_sFullSelector;
oKinElement->UpdateWeight();
}
std::map<std::wstring, std::wstring> CElement::GetStyle() const
@ -230,11 +233,14 @@ namespace NSCSS
return NULL;
}
std::vector<unsigned short> CElement::GetWeight()
void CElement::UpdateWeight()
{
if (m_arWeight.empty())
m_arWeight = NS_STATIC_FUNCTIONS::GetWeightSelector(m_sFullSelector);
}
std::vector<unsigned short> CElement::GetWeight() const
{
return m_arWeight;
}

View File

@ -44,7 +44,8 @@ namespace NSCSS
CElement *FindPrevElement(const std::wstring& sSelector) const;
std::vector<unsigned short int> GetWeight();
void UpdateWeight();
std::vector<unsigned short int> GetWeight() const;
void IncreasedWeight();
};
}

View File

@ -1,19 +1,58 @@
#include "CNode.h"
#ifdef CSS_CALCULATOR_WITH_XHTML
#include "CCompiledStyle.h"
#endif
namespace NSCSS
{
CNode::CNode()
#ifdef CSS_CALCULATOR_WITH_XHTML
: m_pCompiledStyle(new CCompiledStyle())
#endif
{}
CNode::CNode(const CNode& oNode)
: m_wsName(oNode.m_wsName), m_wsClass(oNode.m_wsClass), m_wsId(oNode.m_wsId),
m_wsStyle(oNode.m_wsStyle), m_mAttributes(oNode.m_mAttributes)
{
#ifdef CSS_CALCULATOR_WITH_XHTML
m_pCompiledStyle = new CCompiledStyle();
*m_pCompiledStyle = *oNode.m_pCompiledStyle;
#endif
}
CNode::CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId)
: m_wsName(wsName), m_wsClass(wsClass), m_wsId(wsId)
#ifdef CSS_CALCULATOR_WITH_XHTML
, m_pCompiledStyle(new CCompiledStyle())
#endif
{}
CNode::~CNode()
{
#ifdef CSS_CALCULATOR_WITH_XHTML
if (nullptr != m_pCompiledStyle)
delete m_pCompiledStyle;
#endif
}
bool CNode::Empty() const
{
return m_wsName.empty() && m_wsClass.empty() && m_wsId.empty() && m_wsStyle.empty();
}
#ifdef CSS_CALCULATOR_WITH_XHTML
void CNode::SetCompiledStyle(CCompiledStyle* pCompiledStyle)
{
if (nullptr != m_pCompiledStyle)
delete m_pCompiledStyle;
m_pCompiledStyle = new CCompiledStyle();
*m_pCompiledStyle = *pCompiledStyle;
}
#endif
void CNode::Clear()
{
m_wsName .clear();

View File

@ -7,6 +7,9 @@
namespace NSCSS
{
#ifdef CSS_CALCULATOR_WITH_XHTML
class CCompiledStyle;
#endif
class CNode
{
public:
@ -16,12 +19,21 @@ namespace NSCSS
std::wstring m_wsStyle; // Стиль тэга
std::map<std::wstring, std::wstring> m_mAttributes; // Остальные аттрибуты тэга
#ifdef CSS_CALCULATOR_WITH_XHTML
CCompiledStyle *m_pCompiledStyle;
#endif
public:
CNode();
CNode(const CNode& oNode);
CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId);
~CNode();
bool Empty() const;
#ifdef CSS_CALCULATOR_WITH_XHTML
void SetCompiledStyle(CCompiledStyle* pCompiledStyle);
#endif
void Clear();
std::vector<std::wstring> GetData() const;

View File

@ -48,7 +48,6 @@ namespace NS_STATIC_FUNCTIONS
if (sEncoding.empty())
sEncoding = "utf-8";
if (!sEncoding.empty() && sEncoding != "utf-8" && sEncoding != "UTF-8")
{
NSUnicodeConverter::CUnicodeConverter oConverter;

View File

@ -1328,7 +1328,6 @@ namespace NSCSS
// DISPLAY
CDisplay::CDisplay()
: m_oDisplay(L"inline", 0)
{}
void CDisplay::Equation(CDisplay &oFirstDisplay, CDisplay &oSecondDisplay)

View File

@ -22,10 +22,10 @@ namespace NSCSS
: m_oStyle(oStyle), m_bIsPStyle(bIsPStyle)
{}
bool CheckArrays(const std::vector<std::wstring>& arInitial, const std::set<std::wstring>& arFirst, const std::set<std::wstring>& arSecond)
bool CheckArrays(const std::vector<std::wstring>& arInitial, const std::set<std::wstring>& arFirst, const std::set<std::wstring>& arSecond)
{
std::unordered_set<std::wstring> arInitialSet(arInitial.begin(), arInitial.end());
std::vector<std::wstring> arCommonElements1;
std::vector<std::wstring> arCommonElements2;
@ -316,7 +316,7 @@ namespace NSCSS
std::wstring wsTextAlign{oStyle.m_oText.GetAlign().ToWString()};
if (wsTextAlign.empty() && bInTable)
if (wsTextAlign.empty())
wsTextAlign = oStyle.m_oDisplay.GetHAlign().ToWString();
oXmlElement.AddPropertiesInP(PProperties::P_Jc, wsTextAlign);
@ -470,9 +470,6 @@ namespace NSCSS
int nSpace{0};
if (NULL != pPadding && !pPadding->Empty() && !pPadding->Zero())
nSpace = pPadding->ToInt(NSCSS::Point);
return L"w:val=\"" + wsStyle + L"\" w:sz=\"" + std::to_wstring(nWidth) + + L"\" w:space=\"" + std::to_wstring(nSpace) + L"\" w:color=\"" + wsColor + L"\"";
}
@ -559,7 +556,7 @@ namespace NSCSS
if (oXmlElement.Empty())
return false;
m_sStyle += oXmlElement.GetPStyle(true);
return true;
}

View File

@ -25,3 +25,5 @@ if not base.is_dir("katana-parser"):
base.replaceInFileUtf8(base_directory + "/katana-parser/src/tokenizer.c", "static inline bool2 katana_is_html_space(char c);", "static inline bool katana_is_html_space(char c);")
base.replaceInFileUtf8(base_directory + "/katana-parser/src/parser.c", "katanaget_text(parser->scanner)", "/*katanaget_text(parser->scanner)*/\"error\"")
base.replaceInFileUtf8(base_directory + "/katana-parser/src/parser.c", "#define KATANA_PARSER_STRING(literal) (KatanaParserString){", "#define KATANA_PARSER_STRING(literal) {")
# katana may not be able to handle an empty string correctly in some cases (bug#73485)
base.replaceInFileUtf8(base_directory + "/katana-parser/src/foundation.c", "size_t len = strlen(str);", "if (NULL == str)\n return;\n size_t len = strlen(str);")

View File

@ -19,7 +19,6 @@ static std::string nonbreaking_inline = "|a|abbr|acronym|b|bdo|big|cite|code|df
static std::string empty_tags = "|area|base|basefont|bgsound|br|command|col|embed|event-source|frame|hr|image|img|input|keygen|link|menuitem|meta|param|source|spacer|track|wbr|";
static std::string preserve_whitespace = "|pre|textarea|script|style|";
static std::string special_handling = "|html|body|";
static std::string no_entity_sub = ""; //"|style|";
static std::string treat_like_inline = "|p|";
static std::vector<std::string> html_tags = {"div","span","a","img","p","h1","h2","h3","h4","h5","h6",
@ -69,10 +68,10 @@ static std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert)
{
if (bNeedConvert)
{ // Определение кодировки
std::string sEncoding = NSStringFinder::FindPropety(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\""}).m_sValue;
std::string sEncoding = NSStringFinder::FindProperty(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\""}).m_sValue;
if (sEncoding.empty())
sEncoding = NSStringFinder::FindPropety(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
sEncoding = NSStringFinder::FindProperty(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
if (!sEncoding.empty() && !NSStringFinder::Equals("utf-8", sEncoding))
{
@ -211,7 +210,7 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
NSStringFinder::TFoundedData<char> oData;
// Content-Type
oData = NSStringFinder::FindPropety(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
oData = NSStringFinder::FindProperty(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
const std::string sContentType{oData.m_sValue};
if (sContentType.empty())
@ -227,18 +226,18 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
unCharsetBegin = oData.m_unEndPosition;
// name
// std::string sName = NSStringFinder::FindPropety(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
// std::string sName = NSStringFinder::FindProperty(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
// unContentPosition = std::max(unContentPosition, unLastPosition);
// Content-Location
oData = NSStringFinder::FindPropety(sMhtContent, "content-location", {":"}, {";", "\\n", "\\r"});
oData = NSStringFinder::FindProperty(sMhtContent, "content-location", {":"}, {";", "\\n", "\\r"});
std::string sContentLocation{oData.m_sValue};
if (!oData.Empty())
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
// Content-ID
oData = NSStringFinder::FindPropety(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
oData = NSStringFinder::FindProperty(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
std::string sContentID{oData.m_sValue};
if (!oData.Empty())
@ -252,7 +251,7 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
sContentLocation = "cid:" + sContentID;
// Content-Transfer-Encoding
oData = NSStringFinder::FindPropety(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
oData = NSStringFinder::FindProperty(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
const std::string sContentEncoding{oData.m_sValue};
if (!oData.Empty())
@ -266,7 +265,7 @@ static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::s
if (std::string::npos != unCharsetEnd && unCharsetBegin < unCharsetEnd)
{
sCharset = NSStringFinder::FindPropety(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
sCharset = NSStringFinder::FindProperty(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
NSStringFinder::CutInside<std::string>(sCharset, "\"");
}
@ -338,7 +337,7 @@ static std::string mhtTohtml(const std::string& sFileContent)
NSStringUtils::CStringBuilderA oRes;
// Поиск boundary
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindPropety(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindProperty(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
size_t nFound{oData.m_unEndPosition};
std::string sBoundary{oData.m_sValue};
@ -436,9 +435,25 @@ static void substitute_xml_entities_into_text(std::string& text)
replace_all(text, ">", "&gt;");
}
// After running through Gumbo, the values of type "&#1;" are replaced with the corresponding code '0x01'
// Since the attribute value does not use control characters (value <= 0x09),
// then just delete them, otherwise XmlUtils::CXmlLiteReader crashes on them.
// bug#73486
static void remove_control_symbols(std::string& text)
{
std::string::iterator itFound = std::find_if(text.begin(), text.end(), [](unsigned char chValue){ return chValue <= 0x09; });
while (itFound != text.end())
{
itFound = text.erase(itFound);
itFound = std::find_if(itFound, text.end(), [](unsigned char chValue){ return chValue <= 0x09; });
}
}
// Заменяет сущности " в text
static void substitute_xml_entities_into_attributes(std::string& text)
{
remove_control_symbols(text);
substitute_xml_entities_into_text(text);
replace_all(text, "\"", "&quot;");
}
@ -474,6 +489,7 @@ static void build_doctype(GumboNode* node, NSStringUtils::CStringBuilderA& oBuil
oBuilder.WriteString("<!DOCTYPE ");
oBuilder.WriteString(node->v.document.name);
std::string pi(node->v.document.public_identifier);
remove_control_symbols(pi);
if ((node->v.document.public_identifier != NULL) && !pi.empty())
{
oBuilder.WriteString(" PUBLIC \"");
@ -486,7 +502,7 @@ static void build_doctype(GumboNode* node, NSStringUtils::CStringBuilderA& oBuil
}
}
static void build_attributes(const GumboVector* attribs, bool no_entities, NSStringUtils::CStringBuilderA& atts)
static void build_attributes(const GumboVector* attribs, NSStringUtils::CStringBuilderA& atts)
{
std::vector<std::string> arrRepeat;
for (size_t i = 0; i < attribs->length; ++i)
@ -494,6 +510,10 @@ static void build_attributes(const GumboVector* attribs, bool no_entities, NSStr
GumboAttribute* at = static_cast<GumboAttribute*>(attribs->data[i]);
std::string sVal(at->value);
std::string sName(at->name);
remove_control_symbols(sVal);
remove_control_symbols(sName);
atts.WriteString(" ");
bool bCheck = false;
@ -532,8 +552,7 @@ static void build_attributes(const GumboVector* attribs, bool no_entities, NSStr
std::string qs ="\"";
atts.WriteString("=");
atts.WriteString(qs);
if(!no_entities)
substitute_xml_entities_into_attributes(sVal);
substitute_xml_entities_into_attributes(sVal);
atts.WriteString(sVal);
atts.WriteString(qs);
}
@ -542,7 +561,6 @@ static void build_attributes(const GumboVector* attribs, bool no_entities, NSStr
static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA& contents, bool bCheckValidNode)
{
std::string key = "|" + get_tag_name(node) + "|";
bool no_entity_substitution = no_entity_sub.find(key) != std::string::npos;
bool keep_whitespace = preserve_whitespace.find(key) != std::string::npos;
bool is_inline = nonbreaking_inline.find(key) != std::string::npos;
bool is_like_inline = treat_like_inline.find(key) != std::string::npos;
@ -556,8 +574,8 @@ static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA
if (child->type == GUMBO_NODE_TEXT)
{
std::string val(child->v.text.text);
if(!no_entity_substitution)
substitute_xml_entities_into_text(val);
remove_control_symbols(val);
substitute_xml_entities_into_text(val);
// Избавление от FF
size_t found = val.find_first_of("\014");
@ -596,6 +614,7 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
}
std::string tagname = get_tag_name(node);
remove_control_symbols(tagname);
if (NodeIsUnprocessed(tagname))
return;
@ -613,7 +632,6 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
std::string closeTag = "";
std::string key = "|" + tagname + "|";
bool is_empty_tag = empty_tags.find(key) != std::string::npos;
bool no_entity_substitution = no_entity_sub.find(key) != std::string::npos;
// determine closing tag type
if (is_empty_tag)
@ -626,7 +644,7 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
// build attr string
const GumboVector* attribs = &node->v.element.attributes;
build_attributes(attribs, no_entity_substitution, oBuilder);
build_attributes(attribs, oBuilder);
oBuilder.WriteString(close + ">");
// prettyprint your contents

View File

@ -0,0 +1,43 @@
import os
import glob
import json
import subprocess
curDirectory = os.path.dirname(os.path.realpath(__file__))
dictionatiesDirectory = curDirectory + "/../../../../../dictionaries"
all_dictionaties = {}
for dir in glob.glob(dictionatiesDirectory + "/*"):
if not os.path.isdir(dir):
continue
dictionaryName = os.path.basename(dir)
configFile = dictionatiesDirectory + "/" + dictionaryName + "/" + dictionaryName + ".json"
if not os.path.isfile(configFile):
continue
isHyphen = False
hyphenFile = dictionatiesDirectory + "/" + dictionaryName + "/hyph_" + dictionaryName + ".dic"
if os.path.isfile(hyphenFile):
isHyphen = True
with open(configFile, 'r', encoding='utf-8') as file:
data = json.loads(file.read())
for lang in data["codes"]:
all_dictionaties[str(lang)] = {
"name": dictionaryName,
"hyphen": isHyphen
}
content = ""
content += "#define DictionaryRec_count " + str(len(all_dictionaties)) + "\n"
content += "typedef struct {\n"
content += " const char* m_name;\n"
content += " int m_lang;\n"
content += "} DictionaryRec;\n\n"
content += "static const DictionaryRec Dictionaries[DictionaryRec_count] = {\n"
for lang in all_dictionaties:
info = all_dictionaties[lang]
content += " { \"" + info["name"] + "\", " + str(lang) + " },\n"
content += "};\n"
with open("./records.h", 'w', encoding='utf-8') as f:
f.write(content)

View File

@ -0,0 +1,73 @@
#define DictionaryRec_count 65
typedef struct {
const char* m_name;
int m_lang;
} DictionaryRec;
static const DictionaryRec Dictionaries[DictionaryRec_count] = {
{ "ar", 1025 },
{ "ar", 2049 },
{ "ar", 3073 },
{ "ar", 4097 },
{ "ar", 5121 },
{ "ar", 6145 },
{ "ar", 7169 },
{ "ar", 8193 },
{ "ar", 9217 },
{ "ar", 10241 },
{ "ar", 11265 },
{ "ar", 12289 },
{ "ar", 13313 },
{ "ar", 14337 },
{ "ar", 15361 },
{ "ar", 16385 },
{ "az_Latn_AZ", 1068 },
{ "bg_BG", 1026 },
{ "ca_ES", 1027 },
{ "ca_ES_valencia", 2051 },
{ "cs_CZ", 1029 },
{ "da_DK", 1030 },
{ "de_AT", 3079 },
{ "de_CH", 2055 },
{ "de_DE", 1031 },
{ "el_GR", 1032 },
{ "en_AU", 3081 },
{ "en_CA", 4105 },
{ "en_GB", 2057 },
{ "en_US", 1033 },
{ "en_ZA", 7177 },
{ "es_ES", 3082 },
{ "eu_ES", 1069 },
{ "fr_FR", 1036 },
{ "gl_ES", 1110 },
{ "hr_HR", 1050 },
{ "hu_HU", 1038 },
{ "id_ID", 1057 },
{ "it_IT", 1040 },
{ "kk_KZ", 1087 },
{ "ko_KR", 1042 },
{ "lb_LU", 1134 },
{ "lt_LT", 1063 },
{ "lv_LV", 1062 },
{ "mn_MN", 1104 },
{ "nb_NO", 1044 },
{ "nl_NL", 1043 },
{ "nl_NL", 2067 },
{ "nn_NO", 2068 },
{ "oc_FR", 1154 },
{ "pl_PL", 1045 },
{ "pt_BR", 1046 },
{ "pt_PT", 2070 },
{ "ro_RO", 1048 },
{ "ru_RU", 1049 },
{ "sk_SK", 1051 },
{ "sl_SI", 1060 },
{ "sr_Cyrl_RS", 10266 },
{ "sr_Latn_RS", 9242 },
{ "sv_SE", 1053 },
{ "tr_TR", 1055 },
{ "uk_UA", 1058 },
{ "uz_Cyrl_UZ", 2115 },
{ "uz_Latn_UZ", 1091 },
{ "vi_VN", 1066 },
};

4
Common/3dParty/md/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
md4c
# Except this file
!.gitignore

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
import sys
sys.path.append('../../../../build_tools/scripts')
import config
import base
import os
base_directory = os.getcwd()
if not base.is_dir("md4c"):
base.cmd("git", ["clone", "https://github.com/mity/md4c.git"])
base.cmd_in_dir("md4c", "git", ["checkout", "481fbfbdf72daab2912380d62bb5f2187d438408"])

View File

@ -0,0 +1,102 @@
#include "md2html.h"
#include "md4c/src/md4c-html.h"
#include "../../../DesktopEditor/common/File.h"
namespace Md
{
void ToHtml(const MD_CHAR* pValue, MD_SIZE uSize, void* pData)
{
if (NULL != pData)
(*(std::string*)pData).append(pValue, uSize);
}
std::string ConvertMdStringToHtml(const std::string& sMdString)
{
std::string sData;
md_html(sMdString.c_str(), sMdString.length(), ToHtml, &sData, 0, 0);
return sData;
}
void ToHtmlFile(const MD_CHAR* pValue, MD_SIZE uSize, void* pData)
{
if (NULL != pData)
((NSFile::CFileBinary*)pData)->WriteFile(pValue, uSize);
}
void WriteBaseHtmlStyles(NSFile::CFileBinary& oFile)
{
oFile.WriteStringUTF8(L"<style>");
// Main styles
oFile.WriteStringUTF8(L"* { font-family: Arial; }");
oFile.WriteStringUTF8(L"p { margin: 0 0 10px; display: block; }");
oFile.WriteStringUTF8(L"a { color: #0553c1; text-decoration: underline; } a:visited { color: #954f72; text-decoration: underline; }");
oFile.WriteStringUTF8(L"ul { margin-top: 0; margin-bottom: 10px; }");
oFile.WriteStringUTF8(L"img { vertical-align: middle; }");
// Styles for tables
oFile.WriteStringUTF8(L"table { margin-bottom: 20px; width: 100%; max-width: 100%; border-spacing:0; border-collapse: collapse; border-color: gray;}");
oFile.WriteStringUTF8(L"thead { display: table-header-group; vertical-align: middle; }");
oFile.WriteStringUTF8(L"tr { display: table-row; }");
oFile.WriteStringUTF8(L"th { text-align: left; display: table-cell; font-weight: bold; }");
oFile.WriteStringUTF8(L"table thead tr th { vertical-align: bottom; border-bottom: 2px solid #ddd; }");
oFile.WriteStringUTF8(L"table thead tr th, table tbody tr th, table thead tr td, table tbody tr td { padding 8px; line-height: 1.4; vertical-align: top; border-top: 1px solid #ddd; }");
oFile.WriteStringUTF8(L"table > caption + thead > tr > th, table > colgroup + thead > tr > th, table > thead > tr > th, table > caption + thead > tr > td, table > colgroup + thead > tr > td, table > thead > tr > td { border-top: 0; }");
// Styles for blockquote
oFile.WriteStringUTF8(L"blockquote { border-left: 3px solid #e9e9e9; margin: 1.5em 0; padding: 0.5em 10px 0.5em 24px; font-size: 1.25rem; display: block; margin-top: 8pt; font-style: italic; color: #404040; }");
// Styles for code
oFile.WriteStringUTF8(L"code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; }");
oFile.WriteStringUTF8(L"pre code { padding: 0px; white-space: pre-wrap; background-color: transparent; border-radius: 0; color: inherit; }");
oFile.WriteStringUTF8(L"pre { display: block; padding: 9.5px; margin: 0 0 10px; line-height: 1.4; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; }");
oFile.WriteStringUTF8(L"code, pre { font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; }");
// Styles for headings
oFile.WriteStringUTF8(L"h1 { font-size: 20pt; color: #0f4761; margin-top: 18pt; margin-bottom: 4pt; }");
oFile.WriteStringUTF8(L"h2 { font-size: 16pt; color: #0f4761; margin-top: 8pt; margin-bottom: 4pt; }");
oFile.WriteStringUTF8(L"h3 { font-size: 14pt; color: #0f4761; margin-top: 8pt; margin-bottom: 4pt; }");
oFile.WriteStringUTF8(L"h4 { font-style: italic; color: #0f4761; margin-top: 4pt; margin-bottom: 2pt; }");
oFile.WriteStringUTF8(L"h5 { color: #0f4761; margin-top: 4pt; margin-bottom: 2pt; }");
oFile.WriteStringUTF8(L"h6 { font-style: italic; color: #595959; margin-top: 2pt; margin-bottom: 0; }");
oFile.WriteStringUTF8(L"</style>");
}
bool ConvertMdFileToHtml(const std::wstring& wsPathToMdFile, const std::wstring& wsPathToHtmlFile)
{
std::string sMdData;
if (!NSFile::CFileBinary::ReadAllTextUtf8A(wsPathToMdFile, sMdData))
return false;
NSFile::CFileBinary oFile;
if (!oFile.CreateFile(wsPathToHtmlFile))
return false;
oFile.WriteStringUTF8(L"<html><body>");
oFile.WriteStringUTF8(L"<head>");
WriteBaseHtmlStyles(oFile);
oFile.WriteStringUTF8(L"</head>");
bool bResult = true;
if (0 != md_html(sMdData.c_str(), sMdData.length(), ToHtmlFile, &oFile, MD_DIALECT_GITHUB, 0))
bResult = false;
oFile.WriteStringUTF8(L"</body></html>");
oFile.CloseFile();
if (!bResult)
NSFile::CFileBinary::Remove(wsPathToHtmlFile);
return bResult;
}
}

View File

@ -0,0 +1,19 @@
#ifndef MD2HTML_H
#define MD2HTML_H
#include <string>
#ifndef MDCONVERTER_DECL_EXPORT
#define MDCONVERTER_DECL_EXPORT
#else
#include "../../../DesktopEditor/common/base_export.h"
#define MDCONVERTER_DECL_EXPORT Q_DECL_EXPORT
#endif
namespace Md
{
std::string MDCONVERTER_DECL_EXPORT ConvertMdStringToHtml(const std::string& sMdString);
bool MDCONVERTER_DECL_EXPORT ConvertMdFileToHtml(const std::wstring& wsPathToMdFile, const std::wstring& wsPathToHtmlFile);
}
#endif // MD2HTML_H

View File

@ -0,0 +1,11 @@
DEFINES += MD4C_USE_UTF8
HEADERS += $$PWD/md4c/src/md4c.h \
$$PWD/md4c/src/md4c-html.h \
$$PWD/md4c/src/entity.h \
$$PWD/md2html.h \
SOURCES += $$PWD/md4c/src/md4c.c \
$$PWD/md4c/src/md4c-html.c \
$$PWD/md4c/src/entity.c \
$$PWD/md2html.cpp

View File

@ -0,0 +1,16 @@
QT -= core
QT -= gui
TARGET = test
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CORE_ROOT_DIR = $$PWD/../../../../
SOURCES += main.cpp
include($$CORE_ROOT_DIR/Common/3dParty/md/md2html.pri)
DESTDIR = $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX

View File

@ -0,0 +1 @@
* foo **bar [link](http://example.com) baz**

View File

@ -0,0 +1,10 @@
#include <iostream>
#include "../md2html.h"
int main(int argc, char *argv[])
{
std::cout << (ConvertMdFileToHtml(L"YOUR_PATH", L"YOUR_PATH") ? "Good" : "Bad") << std::endl;
return 0;
}

View File

@ -68,6 +68,7 @@ public:
bool isOOXFormatFile(const std::wstring& fileName, bool unpacked = false);
bool isOpenOfficeFormatFile(const std::wstring& fileName, std::wstring& documentID);
bool isOnlyOfficeFormatFile(const std::wstring& fileName);
bool isMacFormatFile(const std::wstring& fileName);
bool isDocFormatFile(const std::wstring& fileName);
bool isXlsFormatFile(const std::wstring& fileName);
@ -80,6 +81,7 @@ public:
bool isMS_MITCRYPTOFormatFile(POLE::Storage* storage, std::wstring& documentID);
bool isVbaProjectFile(POLE::Storage* storage);
bool isMS_OFFCRYPTOFormatFile(const std::wstring& fileName, std::wstring& documentID);
bool isHwpFile(POLE::Storage* storage);
bool iXmlFile(const std::wstring& fileName);
@ -101,9 +103,11 @@ public:
bool isBinaryDoctFormatFile(unsigned char* pBuffer, int dwBytes);
bool isBinaryXlstFormatFile(unsigned char* pBuffer, int dwBytes);
bool isBinaryPpttFormatFile(unsigned char* pBuffer, int dwBytes);
bool isBinaryVsdtFormatFile(unsigned char* pBuffer, int dwBytes);
bool isDjvuFormatFile(unsigned char* pBuffer, int dwBytes);
bool isMobiFormatFile(unsigned char* pBuffer, int dwBytes);
bool isFB2FormatFile(unsigned char* pBuffer, int dwBytes);
bool isXpsFile(const std::wstring& fileName);
bool isOFDFile(const std::wstring& fileName);
};

View File

@ -44,6 +44,7 @@
#include "3dParty/pole/pole.h"
#include <algorithm>
#include <limits>
#include "OfficeFileFormatDefines.h"
@ -222,6 +223,16 @@ bool COfficeFileFormatChecker::isBinaryPpttFormatFile(unsigned char *pBuffer, in
return false;
}
bool COfficeFileFormatChecker::isBinaryVsdtFormatFile(unsigned char* pBuffer, int dwBytes)
{
if (pBuffer == NULL)
return false;
if ((4 <= dwBytes) && ('V' == pBuffer[0] && 'S' == pBuffer[1] && 'D' == pBuffer[2] && 'Y' == pBuffer[3]))
return true;
return false;
}
bool COfficeFileFormatChecker::isPdfFormatFile(unsigned char *pBuffer, int dwBytes, std::wstring &documentID)
{
if (pBuffer == NULL)
@ -451,6 +462,20 @@ bool COfficeFileFormatChecker::isVbaProjectFile(POLE::Storage *storage)
}
return true;
}
bool COfficeFileFormatChecker::isHwpFile(POLE::Storage* storage)
{
if (storage == NULL)
return false;
unsigned char buffer[10];
POLE::Stream stream(storage, L"BodyText/Section0");
if (stream.read(buffer, 10) < 1)
{
return false;
}
return true;
}
bool COfficeFileFormatChecker::isXlsFormatFile(POLE::Storage *storage)
{
if (storage == NULL)
@ -721,6 +746,11 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_VBAPROJECT;
return true;
}
else if (isHwpFile(&storage))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
return true;
}
}
NSFile::CFileBinary file;
if (!file.OpenFile(fileName))
@ -767,6 +797,20 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
bufferDetect = NULL;
return true;
}
else if (isOFDFile(fileName))
{
if (bufferDetect)
delete[] bufferDetect;
bufferDetect = NULL;
return true;
}
else if (isMacFormatFile(fileName))
{
if (bufferDetect)
delete[] bufferDetect;
bufferDetect = NULL;
return true;
}
}
//-----------------------------------------------------------------------------------------------
@ -790,6 +834,10 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
{
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
}
else if (isBinaryVsdtFormatFile(bufferDetect, sizeRead)) // min size - 4
{
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_DRAW;
}
else if (isOOXFlatFormatFile(bufferDetect, sizeRead))
{
// nFileType;
@ -889,6 +937,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
}
else if (0 == sExt.compare(L".mht") || 0 == sExt.compare(L".mhtml"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
else if (0 == sExt.compare(L".md"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xls") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xlsb"))
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
@ -897,7 +947,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PDF;
else if (0 == sExt.compare(L".doct")) // случай архива с html viewer
nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY;
else if (0 == sExt.compare(L".txt") || 0 == sExt.compare(L".xml") || 0 == sExt.compare(L".rtf") || 0 == sExt.compare(L".doc") || 0 == sExt.compare(L".docx") || 0 == sExt.compare(L".md"))
else if (0 == sExt.compare(L".txt") || 0 == sExt.compare(L".xml") || 0 == sExt.compare(L".rtf") || 0 == sExt.compare(L".doc") || 0 == sExt.compare(L".docx"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT;
else if (0 == sExt.compare(L".pages"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
@ -1124,6 +1174,10 @@ bool COfficeFileFormatChecker::isOnlyOfficeFormatFile(const std::wstring &fileNa
{
nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY;
}
else if (isBinaryVsdtFormatFile(pBuffer, nBufferSize))
{
nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY;
}
delete[] pBuffer;
pBuffer = NULL;
@ -1133,6 +1187,222 @@ bool COfficeFileFormatChecker::isOnlyOfficeFormatFile(const std::wstring &fileNa
}
return false;
}
struct TIWAField
{
size_t m_unStart;
size_t m_unEnd;
unsigned m_uIndex;
unsigned m_unWireType;
uint64_t m_oValue;
};
bool ReadUVar(BYTE* pBuffer, size_t unEndPos, size_t& unPos, uint64_t& unValue)
{
std::vector<unsigned char> arBytes;
arBytes.reserve(8);
unValue = 0;
bool bNext = true;
while (unPos < unEndPos && bNext)
{
const unsigned char c = pBuffer[unPos++];
arBytes.push_back((unsigned char)(c & ~0x80));
bNext = c & 0x80;
}
if (bNext && unPos == unEndPos)
return false;
for (std::vector<unsigned char>::const_reverse_iterator it = arBytes.rbegin(); it != arBytes.rend(); ++it)
{
if (std::numeric_limits<uint64_t>::max() >> 7 < unValue ||
std::numeric_limits<uint64_t>::max() - (unValue << 7) < *it) // overflow
return false;
unValue = (unValue << 7) + *it;
}
return true;
}
bool ReadIWAField(BYTE* pBuffer, size_t unEndPos, size_t& unPos, TIWAField& oIWAField)
{
if (NULL == pBuffer || unPos + 2 > unEndPos)
return false;
unsigned uSpec;
uSpec = (unsigned)pBuffer[unPos++];
oIWAField.m_unWireType = uSpec & 0x7;
oIWAField.m_unStart = unPos;
switch (oIWAField.m_unWireType)
{
case 0:
{
if (!ReadUVar(pBuffer, unEndPos, unPos, oIWAField.m_oValue))
return false;
break;
}
case 1:
{
unPos += 4;
break;
}
case 2:
{
uint64_t unLen;
if (!ReadUVar(pBuffer, unEndPos, unPos, unLen) || unPos + unLen > unEndPos)
return false;
oIWAField.m_unStart = unPos;
unPos += unLen;
break;
}
case 5:
{
unPos += 2;
break;
}
default:
return false;
}
oIWAField.m_unEnd = unPos;
oIWAField.m_uIndex = uSpec >> 3;
return true;
}
bool DetectIWorkFormat(const std::wstring& fileName, int &nType)
{
COfficeUtils OfficeUtils(NULL);
ULONG unSize = 0;
BYTE* pBuffer = NULL;
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"Index/Document.iwa", &pBuffer, unSize);
if (hresult != S_OK || NULL == pBuffer)
return false;
#define CLEAR_BUFFER_AND_RETURN(return_value)\
do{\
delete[] pBuffer;\
return return_value;\
}while(false)
if (unSize < 13)
CLEAR_BUFFER_AND_RETURN(false);
size_t uPos = 6;
for (; uPos < 12; ++uPos)
{
if (0x08 == pBuffer[uPos] && 0x01 == pBuffer[uPos + 1])
{
--uPos;
break;
}
}
if (12 == uPos)
CLEAR_BUFFER_AND_RETURN(false);
uint64_t unHeaderLen;
if (!ReadUVar(pBuffer, unSize, uPos, unHeaderLen))
CLEAR_BUFFER_AND_RETURN(false);
const size_t uStartPos = uPos;
if (unHeaderLen < 8 || unSize < unHeaderLen + uStartPos)
CLEAR_BUFFER_AND_RETURN(false);
uPos += 2;
TIWAField oMessageField;
if (!ReadIWAField(pBuffer, uStartPos + unHeaderLen, uPos, oMessageField) || 2 != oMessageField.m_unWireType ||
2 != oMessageField.m_uIndex)
CLEAR_BUFFER_AND_RETURN(false);
size_t uSubPos = oMessageField.m_unStart;
TIWAField oField;
if (!ReadIWAField(pBuffer, oMessageField.m_unEnd, uSubPos, oField) || 0 != oField.m_unWireType ||
1 != oField.m_uIndex)
CLEAR_BUFFER_AND_RETURN(false);
switch (oField.m_oValue)
{
case 1:
{
uint32_t unDataLen = 0;
TIWAField oTempField;
if (ReadIWAField(pBuffer, oMessageField.m_unEnd, uSubPos, oTempField) &&
ReadIWAField(pBuffer, oMessageField.m_unEnd, uSubPos, oTempField) && 0 == oTempField.m_unWireType &&
3 == oTempField.m_uIndex)
unDataLen += oTempField.m_oValue;
size_t unTempPos = uStartPos + unHeaderLen;
// keynote: presentation ref in 2
// number: sheet ref in 1
if (ReadIWAField(pBuffer, uStartPos + unDataLen, unTempPos, oTempField) &&
(2 != oTempField.m_unWireType || 1 != oTempField.m_uIndex || oTempField.m_unEnd - oTempField.m_unStart < 2))
{
nType = AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
CLEAR_BUFFER_AND_RETURN(true);
}
else if (ReadIWAField(pBuffer, uStartPos + unDataLen, unTempPos, oTempField) &&
(2 != oTempField.m_unWireType || 2 != oTempField.m_uIndex || oTempField.m_unEnd - oTempField.m_unStart < 2))
{
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
CLEAR_BUFFER_AND_RETURN(true);
}
break;
}
case 10000:
{
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
CLEAR_BUFFER_AND_RETURN(true);
}
}
CLEAR_BUFFER_AND_RETURN(false);
}
bool COfficeFileFormatChecker::isMacFormatFile(const std::wstring& fileName)
{
if (DetectIWorkFormat(fileName, nFileType))
return true;
std::wstring::size_type nExtPos = fileName.rfind(L'.');
std::wstring sExt = L"unknown";
if (nExtPos != std::wstring::npos)
sExt = fileName.substr(nExtPos);
std::transform(sExt.begin(), sExt.end(), sExt.begin(), tolower);
if (0 == sExt.compare(L".pages"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
else if (0 == sExt.compare(L".numbers"))
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
else if (0 == sExt.compare(L".key"))
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
else
return false;
return true;
}
bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring &fileName, std::wstring &documentID)
{
documentID.clear();
@ -1397,6 +1667,14 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
return L".fodt";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT:
return L".ott";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES:
return L".pages";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP:
return L".hwp";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX:
return L".hwpx";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MD:
return L".md";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
return L".pptx";
@ -1418,6 +1696,10 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
return L".fodp";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP:
return L".otp";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG:
return L".odg";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY:
return L".key";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
return L".xlsx";
@ -1439,6 +1721,8 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
return L".fods";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS:
return L".ots";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS:
return L".numbers";
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF:
@ -1449,6 +1733,8 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
return L".djvu";
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS:
return L".xps";
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_OFD:
return L".ofd";
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG:
return L".svg";
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLR:
@ -1490,12 +1776,15 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
case AVS_OFFICESTUDIO_FILE_CANVAS_WORD:
case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET:
case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION:
case AVS_OFFICESTUDIO_FILE_CANVAS_DRAW:
return L".bin";
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_DOCUMENT:
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
return L".doct";
case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY:
return L".xlst";
case AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY:
return L".vsdt";
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION:
case AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING:
case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY:
@ -1563,6 +1852,14 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT;
if (L".ott" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT;
if (L".pages" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES;
if (L".hwp" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP;
if (L".hwpx" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX;
if (L".md" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
if (L".pptx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
@ -1584,6 +1881,10 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT;
if (L".otp" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP;
if (L".odg" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODG;
if (L".key" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_KEY;
if (L".xlsx" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
@ -1611,6 +1912,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS;
if (L".ods" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS;
if (L".numbers" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS;
if (L".ooxml" == ext)
return AVS_OFFICESTUDIO_FILE_OTHER_OOXML;
@ -1623,6 +1926,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU;
if (L".xps" == ext || L".oxps" == ext)
return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS;
if (L"ofd" == ext)
return AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_OFD;
if (L".jpg" == ext || L".jpeg" == ext || L".jpe" == ext || L".jfif" == ext)
return AVS_OFFICESTUDIO_FILE_IMAGE_JPG;
@ -1657,6 +1962,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
return AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY;
if (L".pptt" == ext)
return AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY;
if (L".vsdt" == ext)
return AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY;
if (L".vsdx" == ext)
return AVS_OFFICESTUDIO_FILE_DRAW_VSDX;
@ -1759,3 +2066,26 @@ bool COfficeFileFormatChecker::isXpsFile(const std::wstring &fileName)
}
return false;
}
bool COfficeFileFormatChecker::isOFDFile(const std::wstring& fileName)
{
COfficeUtils OfficeUtils(NULL);
ULONG nBufferSize = 0;
BYTE *pBuffer = NULL;
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"OFD.xml", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)
{
if (19 <= nBufferSize && NULL != strstr((char *)pBuffer, "ofd:OFD"))
nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_OFD;
delete[] pBuffer;
pBuffer = NULL;
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN)
return true;
}
return false;
}

View File

@ -58,7 +58,8 @@
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0017
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_PAGES AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0018
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_HWP AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0019
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0020
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_HWPX AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001a
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_MD AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x001b
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_XML AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0030
@ -103,6 +104,7 @@
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRMenu AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0007
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_HTMLRCanvas AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0008
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0009
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_OFD AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x000a
#define AVS_OFFICESTUDIO_FILE_IMAGE 0x0400
#define AVS_OFFICESTUDIO_FILE_IMAGE_JPG AVS_OFFICESTUDIO_FILE_IMAGE + 0x0001
@ -138,12 +140,14 @@
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0002
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0003
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_VSDY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0004
#define AVS_OFFICESTUDIO_FILE_CANVAS 0x2000
#define AVS_OFFICESTUDIO_FILE_CANVAS_WORD AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001
#define AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002
#define AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003
#define AVS_OFFICESTUDIO_FILE_CANVAS_PDF AVS_OFFICESTUDIO_FILE_CANVAS + 0x0004
#define AVS_OFFICESTUDIO_FILE_CANVAS_DRAW AVS_OFFICESTUDIO_FILE_CANVAS + 0x0005
#define AVS_OFFICESTUDIO_FILE_DRAW 0x4000
#define AVS_OFFICESTUDIO_FILE_DRAW_VSDX AVS_OFFICESTUDIO_FILE_DRAW + 0x0001

View File

@ -109,6 +109,31 @@ win32:!contains(QMAKE_TARGET.arch, x86_64): {
CONFIG += core_win_32
}
linux-clang-libc++ {
CONFIG += core_linux
CONFIG += core_linux_64
CONFIG += core_linux_clang
message("linux-64-clang-libc++")
}
linux-clang-libc++-32 {
CONFIG += core_linux
CONFIG += core_linux_32
CONFIG += core_linux_clang
message("linux-32-clang-libc++")
}
linux-clang {
CONFIG += core_linux
CONFIG += core_linux_64
CONFIG += core_linux_clang
message("linux-64-clang")
}
linux-clang-32 {
CONFIG += core_linux
CONFIG += core_linux_32
CONFIG += core_linux_clang
message("linux-32-clang")
}
linux-g++ {
CONFIG += core_linux
linux-g++:contains(QMAKE_HOST.arch, x86_64): {
@ -196,6 +221,10 @@ core_mac {
}
}
core_linux_clang {
QMAKE_CFLAGS += -Wno-implicit-function-declaration
}
# PREFIXES
core_windows {
CONFIG -= debug_and_release debug_and_release_target
@ -416,6 +445,12 @@ message($$CORE_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX)
# COMPILER
CONFIG += c++11
#CONFIG += enable_cpp_17
enable_cpp_17 {
CONFIG += c++1z
DEFINES += _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
}
!core_windows {
QMAKE_CXXFLAGS += -Wno-register
QMAKE_CFLAGS += -Wno-register
@ -423,7 +458,11 @@ CONFIG += c++11
core_linux {
core_static_link_libstd {
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
!core_linux_clang {
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
} else {
# TODO: add libc++abi?
}
message(core_static_link_libstd)
}
plugin {

View File

@ -416,6 +416,16 @@ namespace agg
{
return self_type(rgba::from_wavelength(wl, gamma));
}
bool operator==(const self_type& other)
{
return a == other.a && r == other.r && g == other.g && b == other.b;
}
bool operator!=(const self_type& other)
{
return !operator==(other);
}
};

View File

@ -207,9 +207,9 @@ namespace agg
}
p[Order::A] = (value_type)((alpha + a) - ((alpha * a + base_mask) >> base_shift));
p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
if (r != cr) p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
if (g != cg) p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
if (b != cb) p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
}
static AGG_INLINE void blend_pix_subpix(value_type* p,
@ -1465,7 +1465,29 @@ namespace agg
}
};
template<class ColorT, class Order> struct comp_op_rgba_draw_on_black
{
typedef ColorT color_type;
typedef Order order_type;
typedef typename color_type::value_type value_type;
typedef typename color_type::calc_type calc_type;
enum base_scale_e
{
base_shift = color_type::base_shift,
base_mask = color_type::base_mask
};
static AGG_INLINE void blend_pix(value_type* p,
unsigned sr, unsigned sg, unsigned sb,
unsigned sa, unsigned cover)
{
if (0x00 != p[Order::R] || 0x00 != p[Order::G] || 0x00 != p[Order::B])
return;
comp_op_rgba_src_over <ColorT,Order>::blend_pix(p, sr, sg, sb, sa, cover);
}
};
@ -1515,6 +1537,9 @@ namespace agg
comp_op_rgba_contrast <ColorT,Order>::blend_pix,
comp_op_rgba_invert <ColorT,Order>::blend_pix,
comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix,
//Custom function
comp_op_rgba_draw_on_black<ColorT,Order>::blend_pix,
0
};
@ -1551,6 +1576,9 @@ namespace agg
comp_op_invert, //----comp_op_invert
comp_op_invert_rgb, //----comp_op_invert_rgb
//Custom modes
comp_op_draw_on_black, //----comp_op_draw_on_black
end_of_comp_op_e
};

View File

@ -1000,7 +1000,17 @@ namespace agg
{
if (i < RES && j < RES)
{
precalc[i][j] = c;
if (m_oGradientInfo.luminocity)
{
ColorT fillC;
fillC.r = m_oGradientInfo.shading.fill_color.r * c.r / 255 + 255 - c.r;
fillC.g = m_oGradientInfo.shading.fill_color.g * c.g / 255 + 255 - c.g;
fillC.b = m_oGradientInfo.shading.fill_color.b * c.b / 255 + 255 - c.b;
fillC.a = 255;
precalc[i][j] = fillC;
}
else
precalc[i][j] = c;
}
}
}

View File

@ -1629,6 +1629,10 @@ namespace NSFile
{
wsTemp = L"";
}
#if defined(_WIN32) || defined (_WIN64)
if (wsTempDir)
free(wsTempDir);
#endif
wsTemp += L"x";
int nTime = (int)time(NULL);
for (int nIndex = 0; nIndex < 1000; ++nIndex)

View File

@ -319,7 +319,14 @@ namespace NSStringUtils
{
WriteEncodeXmlString(sString.c_str(), (int)sString.length());
}
void CStringBuilder::WriteEncodeXmlString(const std::string& sString)
{
WriteEncodeXmlString(std::wstring(sString.begin(), sString.end()));
}
void CStringBuilder::WriteUtf8EncodeXmlString(const std::string& sString)
{
WriteEncodeXmlString(NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sString.c_str(), sString.size()));
}
void CStringBuilder::WriteEncodeXmlString(const wchar_t* pString, int nCount)
{
if (sizeof(wchar_t) == 2)

View File

@ -110,6 +110,9 @@ namespace NSStringUtils
void WriteEncodeXmlString(const std::wstring& sString);
void WriteEncodeXmlString(const wchar_t* pString, int nCount = -1);
void WriteEncodeXmlString(const std::string& sString);
void WriteUtf8EncodeXmlString(const std::string& sString);
void WriteEncodeXmlStringHHHH(const std::wstring& sString);
void WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount = -1);

View File

@ -38,6 +38,7 @@
#define CXIMAGE_SUPPORT_PNM 1
#define CXIMAGE_SUPPORT_RAS 1
#define CXIMAGE_SUPPORT_PIC 1
#define CXIMAGE_SUPPORT_HEIF 1
#define CXIMAGE_SUPPORT_JBG 0 // GPL'd see ../jbig/copying.txt & ../jbig/patents.htm

View File

@ -133,13 +133,17 @@ CXIMAGE_FORMAT_PSD = 20,
#if CXIMAGE_SUPPORT_PIC
CXIMAGE_FORMAR_PIC = 25,
#endif
#if CXIMAGE_SUPPORT_HEIF
CXIMAGE_FORMAT_HEIF = 26,
#endif
CMAX_IMAGE_FORMATS = CXIMAGE_SUPPORT_BMP + CXIMAGE_SUPPORT_GIF + CXIMAGE_SUPPORT_JPG +
CXIMAGE_SUPPORT_PNG + CXIMAGE_SUPPORT_MNG + CXIMAGE_SUPPORT_ICO +
CXIMAGE_SUPPORT_TIF + CXIMAGE_SUPPORT_TGA + CXIMAGE_SUPPORT_PCX +
CXIMAGE_SUPPORT_WBMP+ CXIMAGE_SUPPORT_WMF + CXIMAGE_SUPPORT_PIC +
CXIMAGE_SUPPORT_JBG + CXIMAGE_SUPPORT_JP2 + CXIMAGE_SUPPORT_JPC +
CXIMAGE_SUPPORT_PGX + CXIMAGE_SUPPORT_PNM + CXIMAGE_SUPPORT_RAS +
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD + 1
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD +
CXIMAGE_SUPPORT_HEIF + 1
};
#if CXIMAGE_SUPPORT_EXIF

View File

@ -332,6 +332,7 @@
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
# include <math.h>
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)

View File

@ -23,14 +23,14 @@
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#pragma warning (disable : 4550)
#pragma warning (disable : 4550)
/*
* TIFF Library
*
* Read and return a packed RGBA image.
*/
*/
#include "tiffiop.h"
#include <stdio.h>
@ -828,11 +828,12 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
nrowsub = nrow;
if ((nrowsub%subsamplingver)!=0)
nrowsub+=subsamplingver-nrowsub%subsamplingver;
if (TIFFReadEncodedStrip(tif,
TIFFComputeStrip(tif,row+img->row_offset, 0),
buf,
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0
&& img->stoponerr)
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0
&& img->stoponerr)
{
ret = 0;
break;

View File

@ -0,0 +1,61 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef DOC_BUILDER_ADDON_PRIVATE
#define DOC_BUILDER_ADDON_PRIVATE
#include <string>
#include "../docbuilder.h"
namespace NSDoctRenderer
{
class CDocBuilderAddon
{
private:
std::wstring m_sWorkDirectory;
public:
CDocBuilderAddon(const std::wstring& sWorkDir)
{
m_sWorkDirectory = sWorkDir;
}
public:
std::wstring GetX2tSaveAddon(NSDoctRenderer::CDocBuilder* builder, const int& filetype)
{
return L"";
}
int GetX2tPreSaveError(NSDoctRenderer::CDocBuilder* builder, const int& filetype)
{
return 0;
}
};
}
#endif // DOC_BUILDER_ADDON_PRIVATE

View File

@ -33,6 +33,7 @@
#include "./../common_deploy.h"
#include "../docbuilder.h"
#include "../../common/File.h"
#include "../../common/SystemUtils.h"
#ifdef LINUX
#include "../../../DesktopEditor/common/File.h"
@ -78,6 +79,15 @@ void parse_args(NSDoctRenderer::CDocBuilder* builder, int argc, char *argv[])
}
}
bool CheckLicense(const std::wstring& sSrc, const std::wstring& sDst)
{
if (sDst.empty())
return false;
NSFile::CFileBinary::Remove(sDst);
NSFile::CFileBinary::Copy(sSrc, sDst);
return NSFile::CFileBinary::Exists(sDst);
}
#ifdef WIN32
int wmain(int argc, wchar_t *argv[])
#else
@ -89,6 +99,7 @@ int main(int argc, char *argv[])
bool bIsHelp = false;
bool bIsFonts = false;
bool bIsLicense = false;
for (int i = 0; i < argc; ++i)
{
#ifdef WIN32
@ -121,6 +132,33 @@ int main(int argc, char *argv[])
{
bIsFonts = true;
}
else if (sParam == "-register")
{
bIsLicense = true;
}
else
{
if (bIsLicense)
{
std::wstring sLicensePathSrc = UTF8_TO_U(sParam);
if (!NSFile::CFileBinary::Exists(sLicensePathSrc))
return 1;
std::wstring sLicensePath = NSSystemUtils::GetEnvVariable(L"ONLYOFFICE_BUILDER_LICENSE");
if (CheckLicense(sLicensePathSrc, sLicensePath))
return 0;
sLicensePath = NSFile::GetProcessDirectory() + L"/license.xml";
if (CheckLicense(sLicensePathSrc, sLicensePath))
return 0;
sLicensePath = NSSystemUtils::GetAppDataDir() + L"/docbuilder/license.xml";
if (CheckLicense(sLicensePathSrc, sLicensePath))
return 0;
return 1;
}
}
}
if (bIsFonts)

View File

@ -191,7 +191,7 @@ namespace NSDoctRenderer
m_strSdkPath = oNode.ReadNodeText(L"sdkjs");
if (!m_strSdkPath.empty())
{
if (!NSDirectory::Exists(m_strSdkPath))
if (0 == m_strSdkPath.find(L"./") || !NSDirectory::Exists(m_strSdkPath))
m_strSdkPath = sConfigDir + m_strSdkPath;
}

View File

@ -47,14 +47,6 @@ namespace NSDoctRenderer
RELEASEOBJECT(m_pInternal);
}
int CDocBuilder::OpenFile(const wchar_t* path, const wchar_t* params)
{
m_pInternal->m_nFileType = -1;
if (!NSDirectory::Exists(m_pInternal->m_sTmpFolder))
NSDirectory::CreateDirectory(m_pInternal->m_sTmpFolder);
return m_pInternal->OpenFile(path, params);
}
int CDocBuilder::SaveFile(const int& type, const wchar_t* path, const wchar_t* params)
{
return m_pInternal->SaveFile(type, path, params);
@ -65,7 +57,7 @@ namespace NSDoctRenderer
}
bool CDocBuilder::ExecuteCommand(const wchar_t* command, CDocBuilderValue* retValue)
{
return m_pInternal->ExecuteCommand(command, retValue);
return m_pInternal->ExecuteCommand(command, retValue, false, false);
}
CDocBuilderContext CDocBuilder::GetContext(bool enterContext)

View File

@ -475,6 +475,13 @@ namespace NSDoctRenderer
*/
void SetPropertyW(const wchar_t* param, const wchar_t* value);
/**
* GetProperty method.
* @param param The parameter name in the Unicode format, the value is always --argument.
* @return int value for property
*/
int GetPropertyInt(const wchar_t* param);
/**
* Writes data to the log file. It is used for logs in JS code.
* @param path The path to the file where all the logs will be written.
@ -526,6 +533,7 @@ namespace NSDoctRenderer
CDocBuilder_Private* m_pInternal;
friend class CBuilderDocumentEmbed;
friend class CBuilderEmbed;
};
/**

View File

@ -16,18 +16,18 @@ static std::wstring wstringFromJavaString(JNIEnv* env, jstring jstr)
return wstr;
}
jlong Java_docbuilder_CDocBuilder_c_1Create(JNIEnv* env, jclass cls)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilder_c_1Create(JNIEnv* env, jclass cls)
{
return reinterpret_cast<jlong>(new CDocBuilder());
}
void Java_docbuilder_CDocBuilder_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
delete pSelf;
}
jint Java_docbuilder_CDocBuilder_c_1OpenFile(JNIEnv* env, jclass cls, jlong self, jstring path, jstring params)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1OpenFile(JNIEnv* env, jclass cls, jlong self, jstring path, jstring params)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strPath = wstringFromJavaString(env, path);
@ -35,34 +35,34 @@ jint Java_docbuilder_CDocBuilder_c_1OpenFile(JNIEnv* env, jclass cls, jlong self
return (jint)pSelf->OpenFile(strPath.c_str(), strParams.c_str());
}
jboolean Java_docbuilder_CDocBuilder_c_1CreateFileByType(JNIEnv* env, jclass cls, jlong self, jint type)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1CreateFileByType(JNIEnv* env, jclass cls, jlong self, jint type)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
return (jboolean)pSelf->CreateFile((int)type);
}
jboolean Java_docbuilder_CDocBuilder_c_1CreateFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1CreateFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strExtension = wstringFromJavaString(env, extension);
return (jboolean)pSelf->CreateFile(strExtension.c_str());
}
void Java_docbuilder_CDocBuilder_c_1SetTmpFolder(JNIEnv* env, jclass cls, jlong self, jstring folder)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1SetTmpFolder(JNIEnv* env, jclass cls, jlong self, jstring folder)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strFolder = wstringFromJavaString(env, folder);
pSelf->SetTmpFolder(strFolder.c_str());
}
jint Java_docbuilder_CDocBuilder_c_1SaveFileByType(JNIEnv* env, jclass cls, jlong self, jint type, jstring path)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByType(JNIEnv* env, jclass cls, jlong self, jint type, jstring path)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strPath = wstringFromJavaString(env, path);
return (jint)pSelf->SaveFile((int)type, strPath.c_str());
}
jint Java_docbuilder_CDocBuilder_c_1SaveFileByTypeWithParams(JNIEnv* env, jclass cls, jlong self, jint type, jstring path, jstring params)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByTypeWithParams(JNIEnv* env, jclass cls, jlong self, jint type, jstring path, jstring params)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strPath = wstringFromJavaString(env, path);
@ -70,7 +70,7 @@ jint Java_docbuilder_CDocBuilder_c_1SaveFileByTypeWithParams(JNIEnv* env, jclass
return (jint)pSelf->SaveFile((int)type, strPath.c_str(), strParams.c_str());
}
jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByExtension(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strExtension = wstringFromJavaString(env, extension);
@ -78,7 +78,7 @@ jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtension(JNIEnv* env, jclass cls,
return (jint)pSelf->SaveFile(strExtension.c_str(), strPath.c_str());
}
jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtensionWithParams(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path, jstring params)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilder_c_1SaveFileByExtensionWithParams(JNIEnv* env, jclass cls, jlong self, jstring extension, jstring path, jstring params)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strExtension = wstringFromJavaString(env, extension);
@ -87,20 +87,20 @@ jint Java_docbuilder_CDocBuilder_c_1SaveFileByExtensionWithParams(JNIEnv* env, j
return (jint)pSelf->SaveFile(strExtension.c_str(), strPath.c_str(), strParams.c_str());
}
void Java_docbuilder_CDocBuilder_c_1CloseFile(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1CloseFile(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
pSelf->CloseFile();
}
jboolean Java_docbuilder_CDocBuilder_c_1ExecuteCommand(JNIEnv* env, jclass cls, jlong self, jstring command)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1ExecuteCommand(JNIEnv* env, jclass cls, jlong self, jstring command)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strCommand = wstringFromJavaString(env, command);
return (jboolean)pSelf->ExecuteCommand(strCommand.c_str());
}
jboolean Java_docbuilder_CDocBuilder_c_1ExecuteCommandWithRetValue(JNIEnv* env, jclass cls, jlong self, jstring command, jlong retValue)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1ExecuteCommandWithRetValue(JNIEnv* env, jclass cls, jlong self, jstring command, jlong retValue)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strCommand = wstringFromJavaString(env, command);
@ -108,14 +108,14 @@ jboolean Java_docbuilder_CDocBuilder_c_1ExecuteCommandWithRetValue(JNIEnv* env,
return (jboolean)pSelf->ExecuteCommand(strCommand.c_str(), pRetValue);
}
jboolean Java_docbuilder_CDocBuilder_c_1Run(JNIEnv* env, jclass cls, jlong self, jstring path)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1Run(JNIEnv* env, jclass cls, jlong self, jstring path)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strPath = wstringFromJavaString(env, path);
return (jboolean)pSelf->Run(strPath.c_str());
}
jboolean Java_docbuilder_CDocBuilder_c_1RunText(JNIEnv* env, jclass cls, jlong self, jstring commands)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1RunText(JNIEnv* env, jclass cls, jlong self, jstring commands)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
const char* strUtfCommands = env->GetStringUTFChars(commands, nullptr);
@ -124,7 +124,7 @@ jboolean Java_docbuilder_CDocBuilder_c_1RunText(JNIEnv* env, jclass cls, jlong s
return result;
}
void Java_docbuilder_CDocBuilder_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring param, jstring value)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring param, jstring value)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
const char* strUtfParam = env->GetStringUTFChars(param, nullptr);
@ -133,7 +133,7 @@ void Java_docbuilder_CDocBuilder_c_1SetProperty(JNIEnv* env, jclass cls, jlong s
env->ReleaseStringUTFChars(param, strUtfParam);
}
void Java_docbuilder_CDocBuilder_c_1WriteData(JNIEnv* env, jclass cls, jlong self, jstring path, jstring data, jboolean append)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1WriteData(JNIEnv* env, jclass cls, jlong self, jstring path, jstring data, jboolean append)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
std::wstring strPath = wstringFromJavaString(env, path);
@ -141,13 +141,13 @@ void Java_docbuilder_CDocBuilder_c_1WriteData(JNIEnv* env, jclass cls, jlong sel
pSelf->WriteData(strPath.c_str(), strData.c_str(), (bool)append);
}
jboolean Java_docbuilder_CDocBuilder_c_1IsSaveWithDoctrendererMode(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilder_c_1IsSaveWithDoctrendererMode(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
return (jboolean)pSelf->IsSaveWithDoctrendererMode();
}
jstring Java_docbuilder_CDocBuilder_c_1GetVersion(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jstring JNICALL Java_docbuilder_CDocBuilder_c_1GetVersion(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
char* strUtfVersion = pSelf->GetVersion();
@ -156,30 +156,30 @@ jstring Java_docbuilder_CDocBuilder_c_1GetVersion(JNIEnv* env, jclass cls, jlong
return jstrVersion;
}
jlong Java_docbuilder_CDocBuilder_c_1GetContext(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilder_c_1GetContext(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
return reinterpret_cast<jlong>(new CDocBuilderContext(pSelf->GetContext()));
}
jlong Java_docbuilder_CDocBuilder_c_1GetContextWithEnterParam(JNIEnv* env, jclass cls, jlong self, jboolean enterContext)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilder_c_1GetContextWithEnterParam(JNIEnv* env, jclass cls, jlong self, jboolean enterContext)
{
CDocBuilder* pSelf = reinterpret_cast<CDocBuilder*>(self);
return reinterpret_cast<jlong>(new CDocBuilderContext(pSelf->GetContext((bool)enterContext)));
}
void Java_docbuilder_CDocBuilder_c_1Initialize(JNIEnv* env, jclass cls)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1Initialize(JNIEnv* env, jclass cls)
{
CDocBuilder::Initialize();
}
void Java_docbuilder_CDocBuilder_c_1InitializeWithDirectory(JNIEnv* env, jclass cls, jstring directory)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1InitializeWithDirectory(JNIEnv* env, jclass cls, jstring directory)
{
std::wstring strDirectory = wstringFromJavaString(env, directory);
CDocBuilder::Initialize(strDirectory.c_str());
}
void Java_docbuilder_CDocBuilder_c_1Dispose(JNIEnv* env, jclass cls)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilder_c_1Dispose(JNIEnv* env, jclass cls)
{
CDocBuilder::Dispose();
}

View File

@ -4,60 +4,60 @@
using namespace NSDoctRenderer;
jlong Java_docbuilder_CDocBuilderContext_c_1Create(JNIEnv* env, jclass cls)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1Create(JNIEnv* env, jclass cls)
{
return reinterpret_cast<jlong>(new CDocBuilderContext());
}
jlong Java_docbuilder_CDocBuilderContext_c_1Copy(JNIEnv* env, jclass cls, jlong other)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1Copy(JNIEnv* env, jclass cls, jlong other)
{
CDocBuilderContext* pOther = reinterpret_cast<CDocBuilderContext*>(other);
return reinterpret_cast<jlong>(new CDocBuilderContext(*pOther));
}
void Java_docbuilder_CDocBuilderContext_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderContext_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
delete pSelf;
}
jlong Java_docbuilder_CDocBuilderContext_c_1CreateUndefined(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateUndefined(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateUndefined()));
}
jlong Java_docbuilder_CDocBuilderContext_c_1CreateNull(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateNull(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateNull()));
}
jlong Java_docbuilder_CDocBuilderContext_c_1CreateObject(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateObject(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateObject()));
}
jlong Java_docbuilder_CDocBuilderContext_c_1CreateArray(JNIEnv* env, jclass cls, jlong self, jint length)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateArray(JNIEnv* env, jclass cls, jlong self, jint length)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->CreateArray((int)length)));
}
jlong Java_docbuilder_CDocBuilderContext_c_1GetGlobal(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1GetGlobal(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return reinterpret_cast<jlong>(new CDocBuilderValue(pSelf->GetGlobal()));
}
jlong Java_docbuilder_CDocBuilderContext_c_1CreateScope(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContext_c_1CreateScope(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return reinterpret_cast<jlong>(new CDocBuilderContextScope(pSelf->CreateScope()));
}
jboolean Java_docbuilder_CDocBuilderContext_c_1IsError(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderContext_c_1IsError(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContext* pSelf = reinterpret_cast<CDocBuilderContext*>(self);
return (jboolean)pSelf->IsError();

View File

@ -4,24 +4,24 @@
using namespace NSDoctRenderer;
jlong Java_docbuilder_CDocBuilderContextScope_c_1Create(JNIEnv* env, jclass cls)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Create(JNIEnv* env, jclass cls)
{
return reinterpret_cast<jlong>(new CDocBuilderContextScope());
}
jlong Java_docbuilder_CDocBuilderContextScope_c_1Copy(JNIEnv* env, jclass cls, jlong other)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Copy(JNIEnv* env, jclass cls, jlong other)
{
CDocBuilderContextScope* pOther = reinterpret_cast<CDocBuilderContextScope*>(other);
return reinterpret_cast<jlong>(new CDocBuilderContextScope(*pOther));
}
void Java_docbuilder_CDocBuilderContextScope_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContextScope* pSelf = reinterpret_cast<CDocBuilderContextScope*>(self);
delete pSelf;
}
void Java_docbuilder_CDocBuilderContextScope_c_1Close(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderContextScope_c_1Close(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderContextScope* pSelf = reinterpret_cast<CDocBuilderContextScope*>(self);
pSelf->Close();

View File

@ -8,114 +8,114 @@
using namespace NSDoctRenderer;
jlong Java_docbuilder_CDocBuilderValue_c_1Create(JNIEnv* env, jclass cls)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Create(JNIEnv* env, jclass cls)
{
return reinterpret_cast<jlong>(new CDocBuilderValue());
}
jlong Java_docbuilder_CDocBuilderValue_c_1Copy(JNIEnv* env, jclass cls, jlong other)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Copy(JNIEnv* env, jclass cls, jlong other)
{
CDocBuilderValue* pOther = reinterpret_cast<CDocBuilderValue*>(other);
return reinterpret_cast<jlong>(new CDocBuilderValue(*pOther));
}
void Java_docbuilder_CDocBuilderValue_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1Destroy(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
delete pSelf;
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsEmpty(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsEmpty(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsEmpty();
}
void Java_docbuilder_CDocBuilderValue_c_1Clear(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1Clear(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
pSelf->Clear();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsNull(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsNull(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsNull();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsUndefined(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsUndefined(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsUndefined();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsBool(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsBool(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsBool();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsInt(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsInt(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsInt();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsDouble(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsDouble(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsDouble();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsString(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsString(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsString();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsFunction(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsFunction(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsFunction();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsObject(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsObject(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsObject();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1IsArray(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1IsArray(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->IsArray();
}
jint Java_docbuilder_CDocBuilderValue_c_1GetLength(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilderValue_c_1GetLength(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jint)pSelf->GetLength();
}
jboolean Java_docbuilder_CDocBuilderValue_c_1ToBool(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jboolean JNICALL Java_docbuilder_CDocBuilderValue_c_1ToBool(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jboolean)pSelf->ToBool();
}
jint Java_docbuilder_CDocBuilderValue_c_1ToInt(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jint JNICALL Java_docbuilder_CDocBuilderValue_c_1ToInt(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jint)pSelf->ToInt();
}
jdouble Java_docbuilder_CDocBuilderValue_c_1ToDouble(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jdouble JNICALL Java_docbuilder_CDocBuilderValue_c_1ToDouble(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
return (jdouble)pSelf->ToDouble();
}
jstring Java_docbuilder_CDocBuilderValue_c_1ToString(JNIEnv* env, jclass cls, jlong self)
JNIEXPORT jstring JNICALL Java_docbuilder_CDocBuilderValue_c_1ToString(JNIEnv* env, jclass cls, jlong self)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CString strValue = pSelf->ToString();
@ -123,7 +123,7 @@ jstring Java_docbuilder_CDocBuilderValue_c_1ToString(JNIEnv* env, jclass cls, jl
return env->NewStringUTF(strUtfData.c_str());
}
jlong Java_docbuilder_CDocBuilderValue_c_1GetProperty(JNIEnv* env, jclass cls, jlong self, jstring name)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1GetProperty(JNIEnv* env, jclass cls, jlong self, jstring name)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
const char* strUtfName = env->GetStringUTFChars(name, nullptr);
@ -132,14 +132,14 @@ jlong Java_docbuilder_CDocBuilderValue_c_1GetProperty(JNIEnv* env, jclass cls, j
return reinterpret_cast<jlong>(pValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1GetByIndex(JNIEnv* env, jclass cls, jlong self, jint index)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1GetByIndex(JNIEnv* env, jclass cls, jlong self, jint index)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pValue = new CDocBuilderValue(pSelf->Get((int)index));
return reinterpret_cast<jlong>(pValue);
}
void Java_docbuilder_CDocBuilderValue_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring name, jlong value)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1SetProperty(JNIEnv* env, jclass cls, jlong self, jstring name, jlong value)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pValue = reinterpret_cast<CDocBuilderValue*>(value);
@ -149,29 +149,29 @@ void Java_docbuilder_CDocBuilderValue_c_1SetProperty(JNIEnv* env, jclass cls, jl
env->ReleaseStringUTFChars(name, strUtfName);
}
void Java_docbuilder_CDocBuilderValue_c_1SetByIndex(JNIEnv* env, jclass cls, jlong self, jint index, jlong value)
JNIEXPORT void JNICALL Java_docbuilder_CDocBuilderValue_c_1SetByIndex(JNIEnv* env, jclass cls, jlong self, jint index, jlong value)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pValue = reinterpret_cast<CDocBuilderValue*>(value);
pSelf->Set((int)index, *pValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithBool(JNIEnv* env, jclass cls, jboolean value)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithBool(JNIEnv* env, jclass cls, jboolean value)
{
return reinterpret_cast<jlong>(new CDocBuilderValue((bool)value));
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithInt(JNIEnv* env, jclass cls, jint value)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithInt(JNIEnv* env, jclass cls, jint value)
{
return reinterpret_cast<jlong>(new CDocBuilderValue((int)value));
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithDouble(JNIEnv* env, jclass cls, jdouble value)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithDouble(JNIEnv* env, jclass cls, jdouble value)
{
return reinterpret_cast<jlong>(new CDocBuilderValue((double)value));
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithString(JNIEnv* env, jclass cls, jstring str)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateWithString(JNIEnv* env, jclass cls, jstring str)
{
const char* strUtf = env->GetStringUTFChars(str, nullptr);
CDocBuilderValue* pValue = new CDocBuilderValue(strUtf);
@ -179,22 +179,22 @@ jlong Java_docbuilder_CDocBuilderValue_c_1CreateWithString(JNIEnv* env, jclass c
return reinterpret_cast<jlong>(pValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateUndefined(JNIEnv* env, jclass cls)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateUndefined(JNIEnv* env, jclass cls)
{
return reinterpret_cast<jlong>(new CDocBuilderValue(CDocBuilderValue::CreateUndefined()));
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateNull(JNIEnv* env, jclass cls)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateNull(JNIEnv* env, jclass cls)
{
return reinterpret_cast<jlong>(new CDocBuilderValue(CDocBuilderValue::CreateNull()));
}
jlong Java_docbuilder_CDocBuilderValue_c_1CreateArray(JNIEnv* env, jclass cls, jint length)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1CreateArray(JNIEnv* env, jclass cls, jint length)
{
return reinterpret_cast<jlong>(new CDocBuilderValue(CDocBuilderValue::CreateArray((int)length)));
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call0(JNIEnv* env, jclass cls, jlong self, jstring name)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call0(JNIEnv* env, jclass cls, jlong self, jstring name)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
const char* strUtfName = env->GetStringUTFChars(name, nullptr);
@ -203,7 +203,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call0(JNIEnv* env, jclass cls, jlong s
return reinterpret_cast<jlong>(pReturnValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call1(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call1(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
@ -213,7 +213,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call1(JNIEnv* env, jclass cls, jlong s
return reinterpret_cast<jlong>(pReturnValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call2(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call2(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
@ -224,7 +224,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call2(JNIEnv* env, jclass cls, jlong s
return reinterpret_cast<jlong>(pReturnValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call3(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call3(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
@ -236,7 +236,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call3(JNIEnv* env, jclass cls, jlong s
return reinterpret_cast<jlong>(pReturnValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call4(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call4(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
@ -249,7 +249,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call4(JNIEnv* env, jclass cls, jlong s
return reinterpret_cast<jlong>(pReturnValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call5(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call5(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);
@ -263,7 +263,7 @@ jlong Java_docbuilder_CDocBuilderValue_c_1Call5(JNIEnv* env, jclass cls, jlong s
return reinterpret_cast<jlong>(pReturnValue);
}
jlong Java_docbuilder_CDocBuilderValue_c_1Call6(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5, jlong p6)
JNIEXPORT jlong JNICALL Java_docbuilder_CDocBuilderValue_c_1Call6(JNIEnv* env, jclass cls, jlong self, jstring name, jlong p1, jlong p2, jlong p3, jlong p4, jlong p5, jlong p6)
{
CDocBuilderValue* pSelf = reinterpret_cast<CDocBuilderValue*>(self);
CDocBuilderValue* pParam1 = reinterpret_cast<CDocBuilderValue*>(p1);

View File

@ -2,6 +2,7 @@ import ctypes
import os
import platform
import atexit
import subprocess
OBJECT_HANDLE = ctypes.c_void_p
STRING_HANDLE = ctypes.c_void_p
@ -382,6 +383,20 @@ class CDocBuilderValue:
def __setitem__(self, key, value):
self.Set(key, value)
def __getattr__(self, name):
def method(*args):
return self.Call(name, *args)
return method
def __len__(self):
return self.GetLength()
def __iter__(self):
if not self.IsArray():
raise TypeError("Object is not iterable")
for i in range(self.GetLength()):
yield self.Get(i)
@staticmethod
def CreateUndefined():
return CDocBuilderValue(OBJECT_HANDLE(_lib.CDocBuilderValue_CreateUndefined()))
@ -422,6 +437,36 @@ class CDocBuilderValue:
return CDocBuilderValue(OBJECT_HANDLE(_lib.CDocBuilderValue_Call6(self._internal, ctypes.c_wchar_p(name), values[0]._internal, values[1]._internal, values[2]._internal, values[3]._internal, values[4]._internal, values[5]._internal)))
else:
raise TypeError("Call() expects at most 6 arguments")
def append(self, value):
if not self.IsArray():
raise TypeError("Object is not an array")
length = self.GetLength()
self.Set(length, value)
return self
def extend(self, iterable):
if not self.IsArray():
raise TypeError("Object is not an array")
length = self.GetLength()
for i, value in enumerate(iterable, start=length):
self.Set(i, value)
return self
def insert(self, i, x):
if not self.IsArray():
raise TypeError("Object is not an array")
length = self.GetLength()
if i < 0:
if abs(i) > length:
raise IndexError("list index out of range")
i = max(0, length + i)
if i >= length:
raise IndexError("list index out of range")
for idx in range(length, i, -1):
self.Set(idx, self.Get(idx - 1))
self.Set(i, x)
class CDocBuilder:
_initialized = False
@ -434,7 +479,7 @@ class CDocBuilder:
# using self._lib instead of global _lib because it might be already garbage collected during this function call
self._lib.CDocBuilder_Destroy(self._internal)
def OpenFile(self, path, params):
def OpenFile(self, path, params=""):
return _lib.CDocBuilder_OpenFile(self._internal, ctypes.c_wchar_p(path), ctypes.c_wchar_p(params))
def CreateFile(self, type):
@ -608,8 +653,17 @@ class FileTypes:
PNG = _IMAGE_MASK + 0x0005
BMP = _IMAGE_MASK + 0x0008
# NOTE: do not change builder_path manually!
builder_path = os.path.dirname(os.path.realpath(__file__))
_loadLibrary(builder_path)
CDocBuilder.Initialize(builder_path)
def registerLibrary(license_path):
docbuilder_bin = os.path.join(builder_path, "docbuilder")
if ("windows" == platform.system().lower()):
docbuilder_bin += ".exe"
return subprocess.call([docbuilder_bin, "-register", license_path], stderr=subprocess.STDOUT, shell=True)
command = docbuilder_bin + " -register \"" + license_path.replace('\"', '\\\"') + "\""
return subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
atexit.register(CDocBuilder.Dispose)

View File

@ -13,16 +13,16 @@ scope = context.CreateScope()
globalObj = context.GetGlobal()
api = globalObj['Api']
document = api.Call('GetDocument')
paragraph1 = api.Call('CreateParagraph')
paragraph1.Call('SetSpacingAfter', 1000, False)
paragraph1.Call('AddText', 'Hello from Python!')
document = api.GetDocument()
paragraph1 = api.CreateParagraph()
paragraph1.SetSpacingAfter(1000, False)
paragraph1.AddText('Hello from Python!')
paragraph2 = api.Call('CreateParagraph')
paragraph2.Call('AddText', 'Goodbye!')
paragraph2 = api.CreateParagraph()
paragraph2.AddText('Goodbye!')
content = [paragraph1, paragraph2]
document.Call('InsertContent', content)
document.InsertContent(content)
dstPath = os.getcwd() + '/result.docx'
builder.SaveFile(docbuilder.FileTypes.Document.DOCX, dstPath)

View File

@ -0,0 +1,29 @@
import os
import sys
sys.path.append('path_to_docbuilder')
import docbuilder
builder = docbuilder.CDocBuilder()
builder.CreateFile(docbuilder.FileTypes.Document.DOCX)
context = builder.GetContext()
scope = context.CreateScope()
globalObj = context.GetGlobal()
api = globalObj['Api']
document = api.Call('GetDocument')
paragraph1 = api.Call('CreateParagraph')
paragraph1.Call('SetSpacingAfter', 1000, False)
paragraph1.Call('AddText', 'Hello from Python!')
paragraph2 = api.Call('CreateParagraph')
paragraph2.Call('AddText', 'Goodbye!')
content = [paragraph1, paragraph2]
document.Call('InsertContent', content)
dstPath = os.getcwd() + '/result.docx'
builder.SaveFile(docbuilder.FileTypes.Document.DOCX, dstPath)
builder.CloseFile()

View File

@ -82,7 +82,7 @@ CV8RealTimeWorker::~CV8RealTimeWorker()
m_context->Dispose();
}
bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue)
bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue, const bool& isEnterContextSrc)
{
LOGGER_SPEED_START();
@ -92,14 +92,24 @@ bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRender
std::string commandA = U_TO_UTF8(command);
//commandA = "Api." + commandA;
CJSContextScope scope(m_context);
bool isEnterContext = isEnterContextSrc;
if (!isEnterContext && !m_context->IsEntered())
isEnterContext = true;
if (isEnterContext)
m_context->Enter();
JSSmart<CJSTryCatch> try_catch = m_context->GetExceptions();
LOGGER_SPEED_LAP("compile_command");
JSSmart<CJSValue> retNativeVal = m_context->runScript(commandA, try_catch);
if(try_catch->Check())
{
if (isEnterContext)
m_context->Exit();
return false;
}
if (retValue)
{
@ -110,6 +120,9 @@ bool CV8RealTimeWorker::ExecuteCommand(const std::wstring& command, NSDoctRender
LOGGER_SPEED_LAP("run_command");
if (isEnterContext)
m_context->Exit();
return true;
}
@ -240,6 +253,14 @@ bool CV8RealTimeWorker::InitVariables()
if (try_catch->Check())
return false;
}
if (!m_sJSCodeStart.empty())
{
m_context->runScript(m_sJSCodeStart, try_catch);
if (try_catch->Check())
return false;
}
return true;
}
@ -336,7 +357,17 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
return !bIsBreak;
}
bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams)
bool CV8RealTimeWorker::NewSimpleJSInstance()
{
return InitVariables();
}
bool CV8RealTimeWorker::IsSimpleJSInstance()
{
return (-1 == m_nFileType);
}
bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams, const bool& isEnterContext)
{
NSDoctRenderer::DoctRendererFormat::FormatFile _formatDst = NSDoctRenderer::DoctRendererFormat::DOCT;
if (type & AVS_OFFICESTUDIO_FILE_PRESENTATION)
@ -362,7 +393,9 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
}
}
CJSContextScope scope(m_context);
if (isEnterContext)
m_context->Enter();
JSSmart<CJSTryCatch> try_catch = m_context->GetExceptions();
NSNativeControl::CNativeControl* pNative = NULL;
@ -391,7 +424,7 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
bIsSilentMode = true;
if (bIsSilentMode)
this->ExecuteCommand(L"Api.asc_SetSilentMode(false);");
this->ExecuteCommand(L"Api.asc_SetSilentMode(false);", NULL, isEnterContext);
std::wstring strError;
bool bIsError = Doct_renderer_SaveFile_ForBuilder(_formatDst,
@ -403,7 +436,10 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
sJsonParams);
if (bIsSilentMode)
this->ExecuteCommand(L"Api.asc_SetSilentMode(true);");
this->ExecuteCommand(L"Api.asc_SetSilentMode(true);", NULL, isEnterContext);
if (isEnterContext)
m_context->Exit();
return bIsError;
}
@ -1231,8 +1267,29 @@ namespace NSDoctRenderer
nCount = nIndex;
}
int CDocBuilder::OpenFile(const wchar_t* path, const wchar_t* params)
{
if (m_pInternal->m_nFileType != -1 && m_pInternal->m_bIsOpenedFromSimpleJS)
{
m_pInternal->m_bIsOpenedFromSimpleJS = false;
return true;
}
m_pInternal->m_nFileType = -1;
if (!NSDirectory::Exists(m_pInternal->m_sTmpFolder))
NSDirectory::CreateDirectory(m_pInternal->m_sTmpFolder);
return m_pInternal->OpenFile(path, params);
}
bool CDocBuilder::CreateFile(const int& type)
{
if (m_pInternal->m_nFileType != -1 && m_pInternal->m_bIsOpenedFromSimpleJS)
{
m_pInternal->m_bIsOpenedFromSimpleJS = false;
return true;
}
m_pInternal->m_nFileType = -1;
if (!NSDirectory::Exists(m_pInternal->m_sTmpFolder))
NSDirectory::CreateDirectory(m_pInternal->m_sTmpFolder);
@ -1391,7 +1448,7 @@ namespace NSDoctRenderer
if (!sJsCommands.empty())
{
std::wstring sUnicodeCommand = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sJsCommands.c_str(), (LONG)sJsCommands.length());
bIsNoError = this->ExecuteCommand(sUnicodeCommand.c_str());
bIsNoError = this->m_pInternal->ExecuteCommand(sUnicodeCommand.c_str(), NULL, bIsBuilderJSCloseFile);
sJsCommands = "";
if (!bIsNoError)
return false;
@ -1413,6 +1470,10 @@ namespace NSDoctRenderer
if (0 == _builder_params[nCheckParam].find(L"jsValue(") && _builder_params[nCheckParam].length() > 9)
{
std::wstring sParam = _builder_params[nCheckParam].substr(8, _builder_params[nCheckParam].length() - 9);
if (NULL == m_pInternal->m_pWorker)
m_pInternal->CheckWorker();
_builder_params[nCheckParam] = m_pInternal->m_pWorker->GetJSVariable(sParam);
}
}
@ -1478,7 +1539,7 @@ namespace NSDoctRenderer
{
// Такого быть не должно!!! Так как результат никуда не сохранится. пустое действие.
std::wstring sUnicodeCommand = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sJsCommands.c_str(), (LONG)sJsCommands.length());
bool bIsNoError = this->ExecuteCommand(sUnicodeCommand.c_str());
bool bIsNoError = this->m_pInternal->ExecuteCommand(sUnicodeCommand.c_str(), NULL, true);
sJsCommands = "";
if (!bIsNoError)
return false;
@ -1539,6 +1600,15 @@ namespace NSDoctRenderer
return this->SetProperty(sA.c_str(), value);
}
int CDocBuilder::GetPropertyInt(const wchar_t* param)
{
std::wstring sParam = std::wstring(param);
std::string sParamA = U_TO_UTF8(sParam);
if ("--save-use-only-names" == sParamA)
return m_pInternal->m_bIsServerSafeVersion ? 1 : 0;
return -1;
}
void CDocBuilder::Initialize(const wchar_t* directory)
{
std::wstring sDirectory = L"";

View File

@ -63,6 +63,8 @@
#include "../common/ProcessEnv.h"
#include "docbuilder_addon.h"
#ifdef CreateFile
#undef CreateFile
#endif
@ -422,6 +424,7 @@ public:
int m_nFileType;
std::string m_sUtf8ArgumentJSON;
std::string m_sGlobalVariable;
std::string m_sJSCodeStart;
CJSContextData m_oContextData;
@ -434,14 +437,17 @@ public:
static void _LOGGING_ERROR_(const std::wstring& strType, const std::wstring& strError);
bool ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue = NULL);
bool ExecuteCommand(const std::wstring& command, NSDoctRenderer::CDocBuilderValue* retValue = NULL, const bool& isEnterContext = true);
std::string GetGlobalVariable();
std::wstring GetJSVariable(std::wstring sParam);
bool OpenFile(const std::wstring& sBasePath, const std::wstring& path, const NSDoctRenderer::DoctRendererEditorType& editorType, NSDoctRenderer::CDoctRendererConfig* config, CV8Params* pParams = NULL);
bool SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams = L"");
bool SaveFileWithChanges(int type, const std::wstring& _path, const std::wstring& sJsonParams = L"", const bool& isEnterContext = true);
bool InitVariables();
bool NewSimpleJSInstance();
bool IsSimpleJSInstance();
};
namespace NSDoctRenderer
@ -455,7 +461,8 @@ namespace NSDoctRenderer
std::wstring m_sTmpFolder;
std::wstring m_sFileDir;
int m_nFileType;
bool m_bJavascriptBeforeEditor;
std::wstring m_sCommandsBeforeContextCreated;
std::wstring m_sX2tPath;
@ -474,11 +481,13 @@ namespace NSDoctRenderer
NSDoctRenderer::CDocBuilder* m_pParent;
bool m_bIsOpenedFromSimpleJS;
static std::wstring m_sExternalDirectory;
public:
CDocBuilder_Private() : CDoctRendererConfig(), m_sTmpFolder(NSFile::CFileBinary::GetTempPath()), m_nFileType(-1),
m_pWorker(NULL), m_pAdditionalData(NULL), m_bIsInit(false), m_bIsServerSafeVersion(false),
m_sGlobalVariable(""), m_bIsGlobalVariableUse(false), m_pParent(NULL), m_bJavascriptBeforeEditor(false)
m_sGlobalVariable(""), m_bIsGlobalVariableUse(false), m_pParent(NULL), m_sCommandsBeforeContextCreated(L""), m_bIsOpenedFromSimpleJS(false)
{
}
@ -637,10 +646,14 @@ namespace NSDoctRenderer
{
NSDirectory::CreateDirectory(m_sFileDir + L"/media");
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
}
if (m_bJavascriptBeforeEditor)
CheckWorkerAfterOpen();
if (m_pWorker && m_pWorker->IsSimpleJSInstance() && !m_bIsOpenedFromSimpleJS)
{
RELEASEOBJECT(m_pWorker);
CheckWorker();
}
return bRet;
}
return bRet;
#else
@ -931,8 +944,11 @@ namespace NSDoctRenderer
if (0 == nReturnCode)
{
if (m_bJavascriptBeforeEditor)
CheckWorkerAfterOpen();
if (m_pWorker && m_pWorker->IsSimpleJSInstance() && !m_bIsOpenedFromSimpleJS)
{
RELEASEOBJECT(m_pWorker);
CheckWorker();
}
return 0;
}
@ -981,10 +997,16 @@ namespace NSDoctRenderer
return _path;
}
int SaveFile(const int& type, const std::wstring& path, const wchar_t* params = NULL)
int SaveFile(const int& type, const std::wstring& path, const wchar_t* params = NULL, const bool& isEnterContext = true)
{
Init();
CDocBuilderAddon oSaveAddon(m_sX2tPath);
int nPreSaveError = oSaveAddon.GetX2tPreSaveError(m_pParent, m_nFileType);
if (0 != nPreSaveError)
return nPreSaveError;
if (-1 == m_nFileType)
{
CV8RealTimeWorker::_LOGGING_ERROR_(L"error (save)", L"file not opened!");
@ -1023,7 +1045,7 @@ namespace NSDoctRenderer
}
}
this->m_pWorker->SaveFileWithChanges(type, m_sFileDir + L"/Editor2.bin", sJsonParams);
this->m_pWorker->SaveFileWithChanges(type, m_sFileDir + L"/Editor2.bin", sJsonParams, isEnterContext);
sFileBin = L"/Editor2.bin";
}
@ -1068,6 +1090,8 @@ namespace NSDoctRenderer
if (!sOptions.empty())
oBuilder.WriteString(UTF8_TO_U(sOptions));
oBuilder.WriteString(oSaveAddon.GetX2tSaveAddon(m_pParent, m_nFileType));
oBuilder.WriteString(L"</TaskQueueDataConvert>");
std::wstring sXmlConvert = oBuilder.GetData();
@ -1220,62 +1244,75 @@ namespace NSDoctRenderer
{
if (NULL == m_pWorker)
{
m_pWorker = new CV8RealTimeWorker(m_pParent, GetEditorType(), this);
NSDoctRenderer::DoctRendererEditorType editorType = GetEditorType();
m_pWorker = new CV8RealTimeWorker(m_pParent, editorType, this);
m_pWorker->m_sUtf8ArgumentJSON = m_oParams.m_sArgumentJSON;
m_pWorker->m_sGlobalVariable = m_sGlobalVariable;
m_pWorker->m_sJSCodeStart = U_TO_UTF8(m_sCommandsBeforeContextCreated);
return CheckWorkerAfterOpen();
m_pWorker->m_nFileType = m_nFileType;
if (-1 != m_nFileType)
m_sCommandsBeforeContextCreated = L"";
else
{
m_pWorker->NewSimpleJSInstance();
return true;
}
CV8Params oParams;
oParams.IsServerSaveVersion = m_bIsServerSafeVersion;
oParams.DocumentDirectory = m_sFileDir;
return m_pWorker->OpenFile(m_sX2tPath, m_sFileDir, editorType, this, &oParams);
}
return true;
}
bool CheckWorkerAfterOpen()
{
if (!m_pWorker)
return false;
m_pWorker->m_nFileType = m_nFileType;
if (-1 == m_nFileType)
{
m_bJavascriptBeforeEditor = true;
return false;
}
m_bJavascriptBeforeEditor = false;
CV8Params oParams;
oParams.IsServerSaveVersion = m_bIsServerSafeVersion;
oParams.DocumentDirectory = m_sFileDir;
return m_pWorker->OpenFile(m_sX2tPath, m_sFileDir, GetEditorType(), this, &oParams);
}
int SaveFile(const std::wstring& ext, const std::wstring& path, const wchar_t* params = NULL)
{
int nType = GetFormatByTexExtention(ext);
return SaveFile(nType, path, params);
}
bool ExecuteCommand(const std::wstring& command, CDocBuilderValue* retValue = NULL)
bool ExecuteCommand(const std::wstring& command, CDocBuilderValue* retValue = NULL, const bool& forceExecute = false, const bool& isEnterContext = true)
{
if (command.length() < 7 && !retValue) // minimum command (!!!)
return true;
if (m_nFileType == -1 && !forceExecute)
{
m_sCommandsBeforeContextCreated += command;
return true;
}
Init();
bool bRes = CheckWorker();
if (CheckWorker())
{
bool bIsOpenedFromSimpleJSOld = m_bIsOpenedFromSimpleJS;
bool bResult = m_pWorker->ExecuteCommand(command, retValue, isEnterContext);
if (!bResult && !bIsOpenedFromSimpleJSOld && m_bIsOpenedFromSimpleJS)
{
RELEASEOBJECT(m_pWorker);
CheckWorker();
return m_pWorker->ExecuteCommand(command, retValue, isEnterContext);
}
else
{
return bResult;
}
}
if (!bRes && m_pWorker && m_bJavascriptBeforeEditor)
m_pWorker->InitVariables();
return m_pWorker->ExecuteCommand(command, retValue);
return false;
}
CDocBuilderContext GetContext(bool enterContext)
{
CDocBuilderContext ctx;
CheckWorker();
if (!CheckWorker())
return ctx;
ctx.m_internal->m_context = m_pWorker->m_context;
ctx.m_internal->m_context_data = &m_pWorker->m_oContextData;

View File

@ -0,0 +1,130 @@
QT -= core
QT -= gui
VERSION = 1.0.0.3
TARGET = doctrenderer
TEMPLATE = lib
CONFIG += shared
CONFIG += plugin
CORE_ROOT_DIR = $$PWD/../..
PWD_ROOT_DIR = $$PWD
PWD_CUR = $$PWD
include($$PWD_CUR/../../Common/base.pri)
DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING
DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network)
#CONFIG += build_xp
#CONFIG += v8_version_60
core_android:DEFINES += DISABLE_MEMORY_LIMITATION
HEADERS += \
$$PWD_CUR/config.h \
$$PWD_CUR/editors.h \
$$PWD_CUR/doctrenderer.h \
$$PWD_CUR/docbuilder.h
SOURCES += \
$$PWD_CUR/editors.cpp \
$$PWD_CUR/nativecontrol.cpp \
$$PWD_CUR/doctrenderer.cpp \
$$PWD_CUR/docbuilder.cpp \
$$PWD_CUR/docbuilder_p.cpp \
$$PWD_CUR/graphics.cpp \
$$PWD_CUR/hash.cpp
SOURCES += \
$$PWD_CUR/../../Common/OfficeFileFormatChecker2.cpp \
$$PWD_CUR/../../Common/3dParty/pole/pole.cpp \
$$PWD_CUR/../../OOXML/Base/unicode_util.cpp
HEADERS += \
$$PWD_CUR/docbuilder_p.h \
$$PWD_CUR/nativecontrol.h \
$$PWD_CUR/graphics.h \
$$PWD_CUR/hash.h \
$$PWD_CUR/server.h
HEADERS += \
$$PWD_CUR/embed/PointerEmbed.h \
$$PWD_CUR/embed/ZipEmbed.h \
$$PWD_CUR/embed/GraphicsEmbed.h \
$$PWD_CUR/embed/MemoryStreamEmbed.h \
$$PWD_CUR/embed/NativeControlEmbed.h \
$$PWD_CUR/embed/NativeBuilderEmbed.h \
$$PWD_CUR/embed/NativeBuilderDocumentEmbed.h \
$$PWD_CUR/embed/TextMeasurerEmbed.h \
$$PWD_CUR/embed/HashEmbed.h \
$$PWD_CUR/embed/Default.h \
$$PWD_CUR/js_internal/js_base.h
SOURCES += \
$$PWD_CUR/embed/PointerEmbed.cpp \
$$PWD_CUR/embed/ZipEmbed.cpp \
$$PWD_CUR/embed/GraphicsEmbed.cpp \
$$PWD_CUR/embed/MemoryStreamEmbed.cpp \
$$PWD_CUR/embed/NativeControlEmbed.cpp \
$$PWD_CUR/embed/NativeBuilderEmbed.cpp \
$$PWD_CUR/embed/NativeBuilderDocumentEmbed.cpp \
$$PWD_CUR/embed/TextMeasurerEmbed.cpp \
$$PWD_CUR/embed/HashEmbed.cpp \
$$PWD_CUR/embed/Default.cpp
# Serialize objects to JS
HEADERS += \
$$PWD_CUR/json/json.h \
$$PWD_CUR/json/json_p.h \
$$PWD_CUR/json/json_values.h \
$$PWD_CUR/json/serialization.h
SOURCES += \
$$PWD_CUR/json/json.cpp \
$$PWD_CUR/json/json_values.cpp
include($$PWD_CUR/js_internal/js_base.pri)
!use_javascript_core {
build_xp:DESTDIR=$$DESTDIR/xp
}
use_javascript_core {
OBJECTIVE_SOURCES += $$PWD_CUR/../common/Mac/NSString+StringUtils.mm
}
# files for embedded classes
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/GraphicsEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/HashEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/MemoryStreamEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeBuilderEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeBuilderDocumentEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeControlEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/PointerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/TextMeasurerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/ZipEmbed.h)
include($$PWD_CUR/../graphics/pro/textshaper.pri)
include($$PWD_CUR/../../Common/3dParty/openssl/openssl.pri)
# downloader
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
CONFIG += drawingfile_support
drawingfile_support {
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
HEADERS += \
$$PWD_CUR/drawingfile.h \
$$PWD_CUR/embed/DrawingFileEmbed.h
SOURCES += \
$$PWD_CUR/../graphics/pro/js/wasm/src/HTMLRendererText.cpp \
$$PWD_CUR/embed/DrawingFileEmbed.cpp
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/DrawingFileEmbed.h)
}

View File

@ -1,128 +1,3 @@
QT -= core
QT -= gui
INCLUDEPATH += $$PWD/addon
VERSION = 1.0.0.3
TARGET = doctrenderer
TEMPLATE = lib
CONFIG += shared
CONFIG += plugin
CORE_ROOT_DIR = $$PWD/../..
PWD_ROOT_DIR = $$PWD
include(../../Common/base.pri)
DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING
DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network)
#CONFIG += build_xp
#CONFIG += v8_version_60
core_android:DEFINES += DISABLE_MEMORY_LIMITATION
HEADERS += \
config.h \
editors.h \
doctrenderer.h \
docbuilder.h
SOURCES += \
editors.cpp \
nativecontrol.cpp \
doctrenderer.cpp \
docbuilder.cpp \
docbuilder_p.cpp \
graphics.cpp \
hash.cpp
SOURCES += \
../../Common/OfficeFileFormatChecker2.cpp \
../../Common/3dParty/pole/pole.cpp \
../../OOXML/Base/unicode_util.cpp
HEADERS += \
docbuilder_p.h \
nativecontrol.h \
graphics.h \
hash.h \
server.h
HEADERS += \
embed/PointerEmbed.h \
embed/ZipEmbed.h \
embed/GraphicsEmbed.h \
embed/MemoryStreamEmbed.h \
embed/NativeControlEmbed.h \
embed/NativeBuilderEmbed.h \
embed/NativeBuilderDocumentEmbed.h \
embed/TextMeasurerEmbed.h \
embed/HashEmbed.h \
embed/Default.h \
js_internal/js_base.h
SOURCES += \
embed/PointerEmbed.cpp \
embed/ZipEmbed.cpp \
embed/GraphicsEmbed.cpp \
embed/MemoryStreamEmbed.cpp \
embed/NativeControlEmbed.cpp \
embed/NativeBuilderEmbed.cpp \
embed/NativeBuilderDocumentEmbed.cpp \
embed/TextMeasurerEmbed.cpp \
embed/HashEmbed.cpp \
embed/Default.cpp
# Serialize objects to JS
HEADERS += \
json/json.h \
json/json_p.h \
json/json_values.h \
json/serialization.h
SOURCES += \
json/json.cpp \
json/json_values.cpp
include($$PWD/js_internal/js_base.pri)
!use_javascript_core {
build_xp:DESTDIR=$$DESTDIR/xp
}
use_javascript_core {
OBJECTIVE_SOURCES += ../common/Mac/NSString+StringUtils.mm
}
# files for embedded classes
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/GraphicsEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/HashEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/MemoryStreamEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderDocumentEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeControlEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/PointerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/TextMeasurerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/ZipEmbed.h)
include(../graphics/pro/textshaper.pri)
include(../../Common/3dParty/openssl/openssl.pri)
# downloader
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
CONFIG += drawingfile_support
drawingfile_support {
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
HEADERS += \
drawingfile.h \
embed/DrawingFileEmbed.h
SOURCES += \
../graphics/pro/js/wasm/src/HTMLRendererText.cpp \
embed/DrawingFileEmbed.cpp
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/DrawingFileEmbed.h)
}
include(doctrenderer.pri)

View File

@ -171,7 +171,6 @@ public:
return m_pFile ? true : false;
}
bool OpenFile(BYTE* data, LONG size, const std::wstring& sPassword)
{
CloseFile();
@ -284,6 +283,24 @@ public:
return NULL;
return m_pFile->ConvertToPixels(nPageIndex, nRasterW, nRasterH, true, m_pFontManager, nBackgroundColor, (nBackgroundColor == 0xFFFFFF) ? false : true);
}
BYTE* SplitPages(int* arrPageIndex, int nLength, BYTE* data, LONG size)
{
if (m_nType == 0)
return ((CPdfFile*)m_pFile)->SplitPages(arrPageIndex, nLength, data, size);
return NULL;
}
bool MergePages(BYTE* data, LONG size, int nMaxID, const std::string& sPrefixForm)
{
if (m_nType == 0)
return ((CPdfFile*)m_pFile)->MergePages(data, size, nMaxID, sPrefixForm);
return false;
}
bool UnmergePages()
{
if (m_nType == 0)
return ((CPdfFile*)m_pFile)->UnmergePages();
return false;
}
BYTE* GetGlyphs(int nPageIndex)
{

View File

@ -6,16 +6,16 @@ namespace NSDoctRenderer
{
namespace
{
void AppendScript(NSStringUtils::CStringBuilderA* builder, const std::wstring& path)
bool AppendScript(NSStringUtils::CStringBuilderA* builder, const std::wstring& path, const std::string& header = "", const std::string& footer = "")
{
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(path))
return;
return false;
int size = (int)oFile.GetFileSize();
if (size < 3)
return;
return false;
BYTE* pData = new BYTE[size];
DWORD dwReadSize = 0;
@ -26,9 +26,18 @@ namespace NSDoctRenderer
if (pData[0] == 0xEF && pData[1] == 0xBB && pData[2] == 0xBF)
nOffset = 3;
if (!header.empty())
builder->WriteString(header);
builder->WriteString((char*)(pData + nOffset), size - nOffset);
if (!footer.empty())
builder->WriteString(footer);
builder->WriteString("\n\n");
RELEASEARRAYOBJECTS(pData);
return true;
}
bool RunScript(JSSmart<NSJSBase::CJSContext>& context, JSSmart<NSJSBase::CJSTryCatch>& try_catch, const std::wstring& path)
@ -114,6 +123,7 @@ namespace NSDoctRenderer
AppendScript(builder, sFontsPath);
AppendScript(builder, config->m_strSdkPath + L"/word/sdk-all.js");
AppendScript(builder, config->m_strSdkPath + L"/pdf/src/engine/drawingfile_native.js");
AppendScript(builder, config->m_strSdkPath + L"/pdf/src/annotations/stamps.json", "window[\"native_pdf_stamps\"]=", ";");
sCachePath = config->m_strSdkPath + L"/pdf/sdk-all";
break;
}

View File

@ -1,5 +1,6 @@
#include "DrawingFileEmbed.h"
#include "../drawingfile.h"
#include "../../raster/BgraFrame.h"
JSSmart<CJSValue> WasmMemoryToJS(BYTE* pWasmData)
{
@ -165,6 +166,48 @@ JSSmart<CJSValue> CDrawingFileEmbed::FreeWasmData(JSSmart<CJSValue> typedArray)
return NULL;
}
JSSmart<CJSValue> CDrawingFileEmbed::SplitPages(JSSmart<CJSValue> arrPageIndexes, JSSmart<CJSValue> data)
{
JSSmart<CJSArray> arrPages = arrPageIndexes->toArray();
CJSDataBuffer changes;
if (data->isTypedArray())
changes = data->toTypedArray()->getData();
int nCountPages = arrPages->getCount();
int* pPages = NULL;
if (0 < nCountPages)
pPages = new int[nCountPages];
for (int i = 0; i < nCountPages; i++)
pPages[i] = arrPages->get(i)->toInt32();
JSSmart<CJSValue> res = WasmMemoryToJS(m_pFile->SplitPages(pPages, nCountPages, changes.Data, (LONG)changes.Len));
if (pPages)
delete [] pPages;
return res;
}
JSSmart<CJSValue> CDrawingFileEmbed::MergePages(JSSmart<CJSValue> data, JSSmart<CJSValue> nMaxID, JSSmart<CJSValue> sPrefixForm)
{
bool result = false;
if (m_pFile)
{
JSSmart<CJSTypedArray> dataPtr = data->toTypedArray();
int maxID = nMaxID->toInt32();
std::string prefix = sPrefixForm->toStringA();
CJSDataBuffer buffer = dataPtr->getData();
result = m_pFile->MergePages(buffer.Data, (LONG)buffer.Len, maxID, prefix);
if (buffer.IsExternalize)
buffer.Free();
}
return CJSContext::createBool(result);
}
JSSmart<CJSValue> CDrawingFileEmbed::UnmergePages()
{
if (m_pFile)
return CJSContext::createBool(m_pFile->UnmergePages());
return CJSContext::createBool(false);
}
bool EmbedDrawingFile(JSSmart<NSJSBase::CJSContext>& context, IOfficeDrawingFile* pFile)
{
CJSContext::Embed<CDrawingFileEmbed>(false);

View File

@ -51,6 +51,10 @@ public:
JSSmart<CJSValue> FreeWasmData(JSSmart<CJSValue> typedArray);
JSSmart<CJSValue> SplitPages(JSSmart<CJSValue> arrPageIndexes, JSSmart<CJSValue> data);
JSSmart<CJSValue> MergePages(JSSmart<CJSValue> data, JSSmart<CJSValue> nMaxID, JSSmart<CJSValue> sPrefixForm);
JSSmart<CJSValue> UnmergePages();
DECLARE_EMBED_METHODS
};

View File

@ -160,16 +160,35 @@ void CGraphicsEmbed::SetAppImage(CGraphicsAppImage* appImage)
JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSValue> width_px, JSSmart<CJSValue> height_px, JSSmart<CJSValue> width_mm, JSSmart<CJSValue> height_mm)
{
NSNativeControl::CNativeControl* pControl = NULL;
if (!Native->isNull())
{
pControl = (NSNativeControl::CNativeControl*)Native->toObject()->getNative()->getObject();
JSSmart<CJSObject> pNativeObject = Native->toObject();
CJSEmbedObject* pNativeEmbedObject = pNativeObject->getNative();
if (m_pInternal->m_pAppImage)
if (m_pInternal->m_pAppImage && pNativeEmbedObject)
{
delete m_pInternal->m_pAppImage;
m_pInternal->m_pAppImage = new CGraphicsAppImage();
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
m_pInternal->m_pAppImage = NULL;
}
if (NULL == m_pInternal->m_pAppImage)
m_pInternal->m_pAppImage = new CGraphicsAppImage();
if (pNativeEmbedObject)
{
NSNativeControl::CNativeControl* pControl = (NSNativeControl::CNativeControl*)pNativeEmbedObject->getObject();
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
}
else
{
JSSmart<CJSValue> checkResources = pNativeObject->get("isResourcesObject");
if (checkResources->isBool() && true == checkResources->toBool())
{
m_pInternal->m_pAppImage->SetFontsDirectory(pNativeObject->get("fontsDirectory")->toStringW());
m_pInternal->m_pAppImage->SetImagesDirectory(pNativeObject->get("imagesDirectory")->toStringW());
}
}
}
m_pInternal->init(width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble());

View File

@ -8,7 +8,22 @@ JSSmart<CJSValue> CBuilderEmbed::OpenFile(JSSmart<CJSValue> sPath, JSSmart<CJSVa
{
std::wstring Path = sPath->toStringW();
std::wstring Params = sParams->toStringW();
// Since we now use snapshots, and we can't always determine which editor is needed
// (since the code may be BEFORE opening the file). And if the opening came from
// builderJS.OpenFile - in this case we skip reopening.
NSDoctRenderer::CDocBuilder_Private* pPrivate = GetPrivate();
if (pPrivate->m_pWorker->IsSimpleJSInstance())
pPrivate->m_bIsOpenedFromSimpleJS = true;
int ret = m_pBuilder->OpenFile(Path.c_str(), Params.c_str());
if (pPrivate->m_pWorker->IsSimpleJSInstance())
{
JSSmart<CJSContext> current = CJSContext::GetCurrent();
current->runScript("throw 0;");
}
return CJSContext::createInt(ret);
}
@ -20,7 +35,21 @@ JSSmart<CJSValue> CBuilderEmbed::CreateFile(JSSmart<CJSValue> type)
else
nFormat = type->toInt32();
// Since we now use snapshots, and we can't always determine which editor is needed
// (since the code may be BEFORE opening the file). And if the opening came from
// builderJS.OpenFile - in this case we skip reopening.
NSDoctRenderer::CDocBuilder_Private* pPrivate = GetPrivate();
if (pPrivate->m_pWorker->IsSimpleJSInstance())
pPrivate->m_bIsOpenedFromSimpleJS = true;
bool ret = m_pBuilder->CreateFile(nFormat);
if (pPrivate->m_pWorker->IsSimpleJSInstance())
{
JSSmart<CJSContext> current = CJSContext::GetCurrent();
current->runScript("throw 0;");
}
return CJSContext::createBool(ret);
}
@ -41,7 +70,7 @@ JSSmart<CJSValue> CBuilderEmbed::SaveFile(JSSmart<CJSValue> type, JSSmart<CJSVal
std::wstring sPath = path->toStringW();
std::wstring sParams = params->toStringW();
int ret = m_pBuilder->SaveFile(nFormat, sPath.c_str(), sParams.empty() ? NULL : sParams.c_str());
int ret = GetPrivate()->SaveFile(nFormat, sPath.c_str(), sParams.empty() ? NULL : sParams.c_str(), false);
return CJSContext::createInt(ret);
}

View File

@ -50,6 +50,7 @@ public:
~CBuilderEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); }
virtual void* getObject() { return (void*)m_pBuilder; }
NSDoctRenderer::CDocBuilder_Private* GetPrivate() { return m_pBuilder->GetPrivate(); }
public:
JSSmart<CJSValue> OpenFile(JSSmart<CJSValue> sPath, JSSmart<CJSValue> sParams);

View File

@ -258,3 +258,64 @@ JSSmart<CJSValue> CZipEmbed::getImageType(JSSmart<CJSValue> typedArray)
oBuffer.Free();
return CJSContext::createInt(bIsImageFile ? oChecker.eFileType : 0);
}
JSSmart<CJSValue> CZipEmbed::getImageBuffer(JSSmart<CJSValue> filePath)
{
if (!m_pFolder || !filePath->isString())
return CJSContext::createNull();
std::wstring sFilePath = filePath->toStringW();
IFolder::CBuffer* pBuffer;
if (!m_pFolder->read(sFilePath, pBuffer))
return CJSContext::createNull();
size_t nBufferSize = (size_t)pBuffer->Size;
CImageFileFormatChecker oChecker;
bool bIsImageFile = oChecker.isImageFile(pBuffer->Buffer, (DWORD)pBuffer->Size);
if (!bIsImageFile)
{
RELEASEOBJECT(pBuffer);
return CJSContext::createNull();
}
bool bIsNeedConvertMetfileToSvg = false;
// Make as wasm module
if (oChecker.eFileType == _CXIMAGE_FORMAT_WMF || oChecker.eFileType == _CXIMAGE_FORMAT_EMF)
oChecker.eFileType = _CXIMAGE_FORMAT_SVG;
else
bIsNeedConvertMetfileToSvg = false;
if (!bIsNeedConvertMetfileToSvg)
{
BYTE* pMemory = NSJSBase::NSAllocator::Alloc(nBufferSize);
memcpy(pMemory, pBuffer->Buffer, nBufferSize);
RELEASEOBJECT(pBuffer);
JSSmart<CJSObject> retObject = CJSContext::createObject();
retObject->set("type", CJSContext::createInt(oChecker.eFileType));
retObject->set("data", NSJSBase::CJSContext::createUint8Array(pMemory, (int)nBufferSize, false));
return retObject->toValue();
}
#ifndef GRAPHICS_DISABLE_METAFILE
MetaFile::IMetaFile* pMetaFile = MetaFile::Create(NULL);
pMetaFile->LoadFromBuffer(pBuffer->Buffer, (unsigned int)pBuffer->Size);
std::wstring wsSvg = pMetaFile->ConvertToSvg();
std::string sSvg = U_TO_UTF8(wsSvg);
pMetaFile->Release();
RELEASEOBJECT(pBuffer);
BYTE* pData = NSAllocator::Alloc(sSvg.length());
memcpy(pData, sSvg.c_str(), sSvg.length());
JSSmart<CJSObject> retObject = CJSContext::createObject();
retObject->set("type", CJSContext::createInt(24));
retObject->set("data", NSJSBase::CJSContext::createUint8Array(pData, sSvg.length(), false));
return retObject->toValue();
#else
return CJSContext::createNull();
#endif
}

View File

@ -36,6 +36,7 @@ public:
JSSmart<CJSValue> encodeImageData(JSSmart<CJSValue> typedArray, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> stride, JSSmart<CJSValue> format, JSSmart<CJSValue> isRgba);
JSSmart<CJSValue> encodeImage(JSSmart<CJSValue> typedArray, JSSmart<CJSValue> format);
JSSmart<CJSValue> getImageType(JSSmart<CJSValue> typedArray);
JSSmart<CJSValue> getImageBuffer(JSSmart<CJSValue> path);
DECLARE_EMBED_METHODS
};

View File

@ -27,6 +27,9 @@
-(JSValue*) ScanPage : (JSValue*)nPageIndex : (JSValue*)mode;
-(JSValue*) GetImageBase64 : (JSValue*)rId;
-(JSValue*) FreeWasmData : (JSValue*)typedArray;
-(JSValue*) SplitPages : (JSValue*)arrPageIndexes : (JSValue*)data;
-(JSValue*) MergePages : (JSValue*)data : (JSValue*)nMaxID : (JSValue*)sPrefixForm;
-(JSValue*) UnmergePages;
@end
@interface CJSCDrawingFileEmbed : NSObject<IJSCDrawingFileEmbed, JSEmbedObjectProtocol>
@ -61,6 +64,9 @@ FUNCTION_WRAPPER_JS_0(IsNeedCMap, IsNeedCMap)
FUNCTION_WRAPPER_JS_2(ScanPage, ScanPage)
FUNCTION_WRAPPER_JS_1(GetImageBase64, GetImageBase64)
FUNCTION_WRAPPER_JS_1(FreeWasmData, FreeWasmData)
FUNCTION_WRAPPER_JS_2(SplitPages, SplitPages)
FUNCTION_WRAPPER_JS_3(MergePages, MergePages)
FUNCTION_WRAPPER_JS_0(UnmergePages, UnmergePages)
@end
class CDrawingFileEmbedAdapter : public CJSEmbedObjectAdapterJSC

View File

@ -17,6 +17,7 @@
-(JSValue*) encodeImageData : (JSValue*)typedArray : (JSValue*)w : (JSValue*)h : (JSValue*)stride : (JSValue*)format : (JSValue*)isRgba;
-(JSValue*) encodeImage : (JSValue*)typedArray : (JSValue*)format;
-(JSValue*) getImageType : (JSValue*)typedArray;
-(JSValue*) getImageBuffer : (JSValue*)path;
@end
@interface CJSCZipEmbed : NSObject<IJSCZipEmbed, JSEmbedObjectProtocol>
@ -41,6 +42,7 @@ FUNCTION_WRAPPER_JS_2(decodeImage, decodeImage)
FUNCTION_WRAPPER_JS_6(encodeImageData, encodeImageData)
FUNCTION_WRAPPER_JS_2(encodeImage, encodeImage)
FUNCTION_WRAPPER_JS_1(getImageType, getImageType)
FUNCTION_WRAPPER_JS_1(getImageBuffer, getImageBuffer)
@end
class CZipEmbedAdapter : public CJSEmbedObjectAdapterJSC

View File

@ -30,6 +30,9 @@ namespace NSDrawingFileEmbed
FUNCTION_WRAPPER_V8_2(_ScanPage, ScanPage)
FUNCTION_WRAPPER_V8_1(_GetImageBase64, GetImageBase64)
FUNCTION_WRAPPER_V8_1(_FreeWasmData, FreeWasmData)
FUNCTION_WRAPPER_V8_2(_SplitPages, SplitPages)
FUNCTION_WRAPPER_V8_3(_MergePages, MergePages)
FUNCTION_WRAPPER_V8_0(_UnmergePages, UnmergePages)
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
{
@ -59,6 +62,9 @@ namespace NSDrawingFileEmbed
NSV8Objects::Template_Set(result, "ScanPage", _ScanPage);
NSV8Objects::Template_Set(result, "GetImageBase64", _GetImageBase64);
NSV8Objects::Template_Set(result, "FreeWasmData", _FreeWasmData);
NSV8Objects::Template_Set(result, "SplitPages", _SplitPages);
NSV8Objects::Template_Set(result, "MergePages", _MergePages);
NSV8Objects::Template_Set(result, "UnmergePages", _UnmergePages);
return handle_scope.Escape(result);
}

View File

@ -20,6 +20,7 @@ namespace NSZipEmbed
FUNCTION_WRAPPER_V8_6(_encodeImageData, encodeImageData)
FUNCTION_WRAPPER_V8_2(_encodeImage, encodeImage)
FUNCTION_WRAPPER_V8_1(_getImageType, getImageType)
FUNCTION_WRAPPER_V8_1(_getImageBuffer, getImageBuffer)
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
{
@ -39,6 +40,7 @@ namespace NSZipEmbed
NSV8Objects::Template_Set(result, "encodeImageData", _encodeImageData);
NSV8Objects::Template_Set(result, "encodeImage", _encodeImage);
NSV8Objects::Template_Set(result, "getImageType", _getImageType);
NSV8Objects::Template_Set(result, "getImageBuffer", _getImageBuffer);
return handle_scope.Escape(result);
}

View File

@ -483,6 +483,12 @@ namespace NSJSBase
*/
void Exit();
/**
* Сheck if context is current.
* This method is not safe.
*/
bool IsEntered();
/**
* Embeds specified class in JS contexts.
* @tparam T Embedded class name.

View File

@ -374,7 +374,7 @@ namespace NSJSBase
JSSmart<CJSContext> CJSContext::GetCurrent()
{
CJSContext* ret = new CJSContext();
CJSContext* ret = new CJSContext(false);
ret->m_internal->context = NSJSBase::CJSContextPrivate::GetCurrentContext();
return ret;
}
@ -439,6 +439,11 @@ namespace NSJSBase
{
}
bool CJSContext::IsEntered()
{
return true;
}
class CJSLocalScopePrivate
{
public:

View File

@ -255,6 +255,8 @@ namespace NSJSBase
m_internal->m_context = v8::Local<v8::Context>::New(isolate, m_internal->m_contextPersistent);
if (!m_internal->m_context.IsEmpty())
m_internal->m_context->Enter();
m_internal->m_entered = true;
}
void CJSContext::Exit()
@ -271,6 +273,13 @@ namespace NSJSBase
else
m_internal->m_context = m_internal->m_isolate->GetCurrentContext();
m_internal->m_isolate->Exit();
m_internal->m_entered = false;
}
bool CJSContext::IsEntered()
{
return m_internal->m_entered;
}
CJSValue* CJSContext::createUndefined()

View File

@ -857,12 +857,14 @@ namespace NSJSBase
v8::Local<v8::Context> m_context;
v8::StartupData m_startup_data;
bool m_entered;
public:
CJSContextPrivate() : m_isolate(NULL)
{
m_startup_data.data = NULL;
m_startup_data.raw_size = 0;
m_entered = false;
}
void InsertToGlobal(const std::string& name, v8::FunctionCallback creator)

View File

@ -356,6 +356,8 @@ public:
virtual void Check(const int& nCode, const unsigned int& nIndex)
{
if (nCode > m_nMaxSymbols)
return;
if (nCode > m_nMax)
m_nMax = nCode;
if (nCode < m_nMin)
@ -794,6 +796,8 @@ public:
std::wstring sNameCorrect = pPair->second.m_sName;
NSStringUtils::string_replace(sNameCorrect, L"\\", L"\\\\");
NSStringUtils::string_replace(sNameCorrect, L"\"", L"\\\"");
NSStringUtils::string_replace(sNameCorrect, L"\n", L"");
NSStringUtils::string_replace(sNameCorrect, L"\r", L"");
oWriterJS += sNameCorrect;
oWriterJS.AddSize(120);

View File

@ -451,7 +451,7 @@ namespace NSShaper
CheckUnicodeFaceName(face, family_name, family_name_len);
unsigned int nLen1 = (unsigned int)family_name_len;
unsigned int nLen2 = (unsigned int)strlen(face->style_name);
unsigned int nLen2 = (unsigned int)((face->style_name != NULL) ? strlen(face->style_name) : 0);
unsigned int nLen = 28 + nLen1 + 1 + nLen2 + 1 + 1 + (int)face->num_fixed_sizes;
@ -693,6 +693,13 @@ namespace NSShaper
g_userfeatures_init = true;
}
// Turn on ligatures on arabic script
if (nScript == HB_SCRIPT_ARABIC ||
nScript == HB_SCRIPT_SYRIAC)
{
nFeatures |= 1;
}
// font
hb_font_t* pFont;
if (NULL == font)

View File

@ -94,11 +94,14 @@ void CheckUnicodeFaceName(FT_Face pFace, int*& UName, unsigned int& ULen)
bool isBadASCII = false;
unsigned int face_name_len = 0;
while ('\0' != face_name[face_name_len])
if (NULL != face_name)
{
if ('?' == face_name[face_name_len])
isBadASCII = true;
++face_name_len;
while ('\0' != face_name[face_name_len])
{
if ('?' == face_name[face_name_len])
isBadASCII = true;
++face_name_len;
}
}
if (face_name_len > 6 &&

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -594,6 +594,13 @@ WASM_EXPORT unsigned char* ASC_HB_ShapeText(FT_Face pFace, hb_font_t* pFont, cha
g_userfeatures_init = true;
}
// Turn on ligatures on arabic script
if (nScript == HB_SCRIPT_ARABIC ||
nScript == HB_SCRIPT_SYRIAC)
{
nFeatures |= 1;
}
// font
if (NULL == pFont)
{

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -531,6 +531,45 @@ ZLib.prototype.getImageAsSvg = function(path)
return string;
};
/**
* Get image file raw data. this memory was copied and detach from archive.
* @returns {Uint8Array}
*/
ZLib.prototype.getImageBuffer = function(path)
{
let result = {
type : 0,
data : null
};
result.type = this.getImageType(path);
if (result.type === 0)
return null;
let fileData = this.getFile(path);
result.data = new Uint8Array(fileData.length);
result.data.set(fileData);
if (result.type != 10 &&
result.type != 21)
{
return result;
}
result.type = 24;
// Source was saved as result.data for using original image in native convertations.
// But for js we need svg for metafiles.
let encodedData = Module["_Raster_Encode"](this.files[path].p + 4, fileData.length, 24);
let encodedSize = Module["_Raster_GetEncodedSize"](encodedData);
let encodedBuffer = Module["_Raster_GetEncodedBuffer"](encodedData);
let fileDataEnc = new Uint8Array(Module["HEAP8"].buffer, encodedBuffer, encodedSize);
result.dataBlob = new Uint8Array(fileDataEnc.length);
result.dataBlob.set(fileDataEnc);
Module["_Raster_DestroyEncodedData"](encodedData);
return result;
};
/**
* Get image blob for browser
* @returns {Blob}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,7 +35,7 @@
window['AscFonts'] = window['AscFonts'] || {};
var AscFonts = window['AscFonts'];
var g_native_engine = CreateEmbedObject("CTextMeasurerEmbed");
var g_native_engine = null;
function CReturnObject()
{
@ -236,4 +236,6 @@ AscFonts.Hyphen_Word = function(lang, word)
AscFonts.onLoadModule();
AscFonts.onLoadModule();
window["InitNativeTextMeasurer"] = function() { g_native_engine = CreateEmbedObject("CTextMeasurerEmbed"); };
})(window, undefined);

View File

@ -100,6 +100,7 @@
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
"GRAPHICS_NO_USE_DYNAMIC_LIBRARY",
"HYPHEN_ENGINE_DISABLE_FILESYSTEM",
"METAFILE_DISABLE_FILESYSTEM",
"HAVE_UNISTD_H", "HAVE_FCNTL_H", "_ARM_ALIGN_",
"METAFILE_SUPPORT_WMF_EMF",
@ -259,10 +260,13 @@
"folder": "../../../OfficeUtils/js",
"files": ["../src/ZipBuffer.cpp", "wasm/src/base.cpp", "../src/zlib_addon.c"]
},
{
"folder": "../../",
"files": ["graphics/Image.cpp", "raster/BgraFrame.cpp", "raster/ImageFileFormatChecker.cpp"]
"files": ["graphics/Image.cpp", "raster/BgraFrame.cpp", "raster/ImageFileFormatChecker.cpp", "graphics/Matrix.cpp"]
},
{
"folder": "../../agg-2.4/src/",
"files": ["agg_trans_affine.cpp"]
},
{
"folder": "../../raster/",

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -761,6 +761,14 @@ function onLoadFontsModule(window, undefined)
{
return this.engine["getImageBlob"](path);
};
/**
* Get image file raw data. this memory was copied and detach from archive.
* @returns {Uint8Array}
*/
ZLib.prototype.getImageBuffer = function(path)
{
return this.engine["getImageBuffer"](path);
};
/**
* Get all file paths in archive
* @returns {Array}
@ -772,10 +780,84 @@ function onLoadFontsModule(window, undefined)
AscCommon.ZLib = ZLib;
function ZlibImageBlobs()
{
this.url2BlobUrl = {};
this.blobUrl2Data = {};
this.url2Base64 = {};
this.nativeBlobCounter = 1;
}
ZlibImageBlobs.prototype.getBlobUrl = function(path, zip)
{
if (this.url2BlobUrl[path])
return this.url2BlobUrl[path];
let result = zip.getImageBuffer(path);
if (result == null)
return "";
let blobUrl = "";
let blobType = AscCommon.openXml.GetMimeType((24 !== result["type"]) ? AscCommon.GetFileExtension(path) : "svg");
if (window["NATIVE_EDITOR_ENJINE"])
{
blobUrl = "blob:internal-image" + this.nativeBlobCounter++;
}
else
{
try
{
let blob = new Blob([result["dataBlob"] ? result["dataBlob"] : result["data"]], {type: blobType});
blobUrl = window.URL.createObjectURL(blob);
}
catch (e)
{
blobUrl = "error";
AscCommon.consoleLog("ERROR: Image blob was not loaded");
}
}
this.blobUrl2Data[blobUrl] = result;
this.url2BlobUrl[path] = blobUrl;
return blobUrl;
};
ZlibImageBlobs.prototype.getImageBase64 = function(url)
{
if (this.url2Base64[url])
return this.url2Base64[url];
let obj = this.blobUrl2Data[url];
if (!obj)
return url;
let header = "";
switch (obj.type)
{
case 3:
header = "data:image/jpeg;base64,";
break;
case 24:
header = "data:image/svg+xml;base64,";
break;
case 4:
default:
header = "data:image/png;base64,";
}
this.url2Base64[url] = header + AscCommon.Base64.encode(obj.data);
return this.url2Base64[url];
};
window["AscCommon"].g_oDocumentBlobUrls = new ZlibImageBlobs();
if (AscCommon["CZLibEngineJS"])
AscCommon["CZLibEngineJS"].prototype["isModuleInit"] = true;
window.nativeZlibEngine = new ZLib();
if (window["NATIVE_EDITOR_ENJINE"])
window["InitNativeZLib"] = function() { window.nativeZlibEngine = new ZLib(); };
else
window.nativeZlibEngine = new ZLib();
function Hyphenation()
{

View File

@ -1020,22 +1020,39 @@ void CBooleanOperations::TracePaths()
{
size_t length = Segments1.size();
Result.StartFigure();
bool first_start = true;
for (size_t i = 0; i < length + Segments2.size(); i++)
{
Segment s = i >= length ? Segments2[i - length] : Segments1[i];
bool valid = s.IsValid(Op),
start = true;
start = true;
PointD start_point;
while (valid)
{
if (!start || (Op == Intersection && s.Inters && !GetNextSegment(s).Inters))
SetVisited(s);
if (start)
if (first_start)
{
Result.MoveTo(s.P.X, s.P.Y);
start_point = s.P;
}
else if (start)
{
double x, y;
Result.GetLastPoint(x, y);
if (isZero(start_point.X - x) && isZero(start_point.Y - y))
{
Result.MoveTo(s.P.X, s.P.Y);
start_point = s.P;
}
else
Result.LineTo(s.P.X, s.P.Y);
}
else if (s.IsCurve)
Result.CurveTo(s.HI.X + s.P.X, s.HI.Y + s.P.Y,
s.HO.X + s.P.X, s.HO.Y + s.P.Y,
s.P.X, s.P.Y);
s.HO.X + s.P.X, s.HO.Y + s.P.Y,
s.P.X, s.P.Y);
else
Result.LineTo(s.P.X, s.P.Y);
@ -1065,6 +1082,9 @@ void CBooleanOperations::TracePaths()
if (start)
start = false;
if (first_start)
first_start = false;
}
if (!start && AllOverlap()) break;
@ -1645,12 +1665,14 @@ int CBooleanOperations::CheckInters(const PointD& point, const Segment& segment,
std::vector<double> roots = curve.GetCurveLineIntersection(segment.P.X,segment.P.Y, point.X - segment.P.X, point.Y - segment.P.Y);
Curve line(segment, Segment(point));
int count = 0;
for (const auto& r : roots)
if (line.GetTimeOf(curve.GetPoint(r)) != -1)
count++;
return roots.size() % 2;
return count;
// int count = 0;
// for (const auto& r : roots)
// if (line.GetTimeOf(curve.GetPoint(r)) != -1)
// count++;
// return count;
}
return 0;
}

View File

@ -863,20 +863,22 @@ namespace Aggplus
double CGraphicsPath::GetArea(unsigned idx, bool isCurve) const noexcept
{
float area;
double area;
if (isCurve)
{
std::vector<PointD> points = GetPoints(idx, 4);
area = 3 * ((points[3].Y - points[0].Y) * (points[1].X + points[2].X)
- (points[3].X - points[0].X) * (points[1].Y * points[2].Y)
+ points[1].Y * (points[0].X - points[2].X)
- points[1].X * (points[0].Y - points[2].Y)
+ points[3].Y * (points[2].X + points[0].X / 3)
- points[3].X * (points[2].Y - points[0].Y / 3)) / 20;
area = (points[3].Y - points[0].Y) * (points[1].X + points[2].X)
- (points[3].X - points[0].X) * (points[1].Y + points[2].Y)
+ points[1].Y * (points[0].X - points[2].X)
- points[1].X * (points[0].Y - points[2].Y)
+ points[3].Y * (points[2].X + points[0].X / 3.0)
- points[3].X * (points[2].Y + points[0].Y / 3.0);
}
else
{
std::vector<PointD> points = GetPoints(idx, 2);
area = 4.0 * (points[1].Y * points[0].X - points[1].X * points[0].Y) / 3.0;
}
std::vector<PointD> points = GetPoints(idx, 2);
area = (points[1].Y * points[0].X - points[1].X * points[0].Y) / 20;
return area;
}

View File

@ -153,13 +153,6 @@ IMetafileToRenderter::IMetafileToRenderter(IRenderer* pRenderer)
}
IMetafileToRenderter::~IMetafileToRenderter()
{
for (std::vector<std::wstring>::iterator i = m_arTempFiles.begin(); i != m_arTempFiles.end(); i++)
{
std::wstring sPath = *i;
if (NSFile::CFileBinary::Exists(sPath))
NSFile::CFileBinary::Remove(sPath);
}
if (m_pPicker)
{
CMetafileFontPicker* pPicker = (CMetafileFontPicker*)m_pPicker;
@ -234,8 +227,6 @@ std::wstring IMetafileToRenderter::GetImagePath(const std::wstring& sPath)
oFrame.put_Data(NULL);
sImagePath = sTempFile;
}
m_arTempFiles.push_back(sTempFile);
}
RELEASEARRAYOBJECTS(pImageBuffer);

View File

@ -49,7 +49,6 @@ public:
protected:
std::wstring m_sTempDir;
std::vector<std::wstring> m_arTempFiles;
std::wstring m_sThemesDir;
std::wstring m_sMediaDir;

View File

@ -48,7 +48,7 @@
CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annotaion)
{
m_nType = -1;
m_nType = EAnnotType::Unknown;
m_nFlag = 0;
m_nID = 0;
@ -94,118 +94,108 @@ CAnnotFieldInfo::~CAnnotFieldInfo()
RELEASEOBJECT(m_pWidgetPr);
}
void CAnnotFieldInfo::CreateMarkup()
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
}
void CAnnotFieldInfo::SetType(int nType)
{
m_nType = nType;
switch (nType)
m_nType = static_cast<EAnnotType>(nType);
switch (m_nType)
{
case 0:
case EAnnotType::Text:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pTextPr);
m_pTextPr = new CAnnotFieldInfo::CTextAnnotPr();
break;
}
case 2:
case EAnnotType::FreeText:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pFreeTextPr);
m_pFreeTextPr = new CAnnotFieldInfo::CFreeTextAnnotPr();
break;
}
case 3:
case EAnnotType::Line:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pLinePr);
m_pLinePr = new CAnnotFieldInfo::CLineAnnotPr();
break;
}
case 4:
case 5:
case EAnnotType::Square:
case EAnnotType::Circle:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pSquareCirclePr);
m_pSquareCirclePr = new CAnnotFieldInfo::CSquareCircleAnnotPr();
break;
}
case 6:
case 7:
case EAnnotType::PolygonLine:
case EAnnotType::PolyLine:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pPolygonLinePr);
m_pPolygonLinePr = new CAnnotFieldInfo::CPolygonLineAnnotPr();
break;
}
case 8:
case 9:
case 10:
case 11:
case EAnnotType::Highlight:
case EAnnotType::Underline:
case EAnnotType::Squiggly:
case EAnnotType::Strikeout:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pTextMarkupPr);
m_pTextMarkupPr = new CAnnotFieldInfo::CTextMarkupAnnotPr();
break;
}
case 12:
case EAnnotType::Stamp:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pStampPr);
m_pStampPr = new CAnnotFieldInfo::CStampAnnotPr();
break;
}
case 13:
case EAnnotType::Caret:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pCaretPr);
m_pCaretPr = new CAnnotFieldInfo::CCaretAnnotPr();
break;
}
case 14:
case EAnnotType::Ink:
{
RELEASEOBJECT(m_pMarkupPr);
m_pMarkupPr = new CAnnotFieldInfo::CMarkupAnnotPr();
CreateMarkup();
RELEASEOBJECT(m_pInkPr);
m_pInkPr = new CAnnotFieldInfo::CInkAnnotPr();
break;
}
case 15:
case EAnnotType::Popup:
{
RELEASEOBJECT(m_pPopupPr);
m_pPopupPr = new CAnnotFieldInfo::CPopupAnnotPr();
break;
}
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case EAnnotType::Widget:
case EAnnotType::WidgetPushButton:
case EAnnotType::WidgetRadioButton:
case EAnnotType::WidgetCheckBox:
case EAnnotType::WidgetText:
case EAnnotType::WidgetCombobox:
case EAnnotType::WidgetListbox:
case EAnnotType::WidgetSignature:
{
RELEASEOBJECT(m_pWidgetPr);
m_pWidgetPr = new CAnnotFieldInfo::CWidgetAnnotPr(nType);
break;
}
default:
break;
}
}
CAnnotFieldInfo::EAnnotType CAnnotFieldInfo::GetType() { return m_nType; }
void CAnnotFieldInfo::GetBounds(double& dX1, double& dY1, double& dX2, double& dY2)
{
@ -224,6 +214,7 @@ int CAnnotFieldInfo::GetFlag() const { return m_nFlag; }
int CAnnotFieldInfo::GetID() const { return m_nID; }
int CAnnotFieldInfo::GetAnnotFlag() const { return m_nAnnotFlag; }
int CAnnotFieldInfo::GetPage() const { return m_nPage; }
int CAnnotFieldInfo::GetCopyAP() const { return m_nCopyAP; }
void CAnnotFieldInfo::GetBE(BYTE& nS, double& dI) { nS = m_pBE.first; dI = m_pBE.second; }
BYTE* CAnnotFieldInfo::GetRender(LONG& nLen)
{
@ -343,6 +334,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
if (nFlags & (1 << 3))
{
int n = pReader->ReadInt();
m_arrC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrC.push_back(pReader->ReadDouble());
}
@ -353,6 +345,7 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
if (m_oBorder.nType == 2)
{
int n = pReader->ReadInt();
m_oBorder.arrDash.reserve(n);
for (int i = 0; i < n; ++i)
m_oBorder.arrDash.push_back(pReader->ReadDouble());
}
@ -367,6 +360,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
}
if (nFlags & (1 << 7))
m_wsOUserID = pReader->ReadString();
if (nFlags & (1 << 8))
m_nCopyAP = pReader->ReadInt();
if (IsMarkup())
{
@ -428,6 +423,7 @@ void CAnnotFieldInfo::CMarkupAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
if (nFlags & (1 << 3))
{
int nFont = pReader->ReadInt();
m_arrRC.reserve(nFont);
for (int i = 0; i < nFont; ++i)
{
CFontData* pFont = new CFontData();
@ -480,6 +476,7 @@ void CAnnotFieldInfo::CInkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* p
{
std::vector<double> arrLine;
int m = pReader->ReadInt();
arrLine.reserve(m);
for (int j = 0; j < m; ++j)
arrLine.push_back(pReader->ReadDouble());
if (!arrLine.empty())
@ -512,6 +509,7 @@ void CAnnotFieldInfo::CLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
if (nFlags & (1 << 16))
{
int n = pReader->ReadInt();
m_arrIC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrIC.push_back(pReader->ReadDouble());
}
@ -539,6 +537,7 @@ void CAnnotFieldInfo::CTextMarkupAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRe
{
m_nSubtype = nType;
int n = pReader->ReadInt();
m_arrQuadPoints.reserve(n);
for (int i = 0; i < n; ++i)
m_arrQuadPoints.push_back(pReader->ReadDouble());
}
@ -559,6 +558,7 @@ void CAnnotFieldInfo::CSquareCircleAnnotPr::Read(NSOnlineOfficeBinToPdf::CBuffer
if (nFlags & (1 << 16))
{
int n = pReader->ReadInt();
m_arrIC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrIC.push_back(pReader->ReadDouble());
}
@ -572,6 +572,7 @@ const std::vector<double>& CAnnotFieldInfo::CPolygonLineAnnotPr::GetVertices() {
void CAnnotFieldInfo::CPolygonLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, BYTE nType, int nFlags)
{
int n = pReader->ReadInt();
m_arrVertices.reserve(n);
for (int i = 0; i < n; ++i)
m_arrVertices.push_back(pReader->ReadDouble());
@ -584,6 +585,7 @@ void CAnnotFieldInfo::CPolygonLineAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferR
if (nFlags & (1 << 16))
{
int n = pReader->ReadInt();
m_arrIC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrIC.push_back(pReader->ReadDouble());
}
@ -613,6 +615,7 @@ void CAnnotFieldInfo::CFreeTextAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRead
if (nFlags & (1 << 16))
{
int n = pReader->ReadInt();
m_arrCL.reserve(n);
for (int i = 0; i < n; ++i)
m_arrCL.push_back(pReader->ReadDouble());
}
@ -625,6 +628,7 @@ void CAnnotFieldInfo::CFreeTextAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferRead
if (nFlags & (1 << 21))
{
int n = pReader->ReadInt();
m_arrIC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrIC.push_back(pReader->ReadDouble());
}
@ -685,6 +689,7 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetDV() { return m_wsDV; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetT() { return m_wsT; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontName() { return m_wsFN; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontKey() { return m_wsFK; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetOMetadata() { return m_wsOMetadata; }
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetTC() { return m_arrTC; }
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBC() { return m_arrBC; }
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBG() { return m_arrBG; }
@ -814,6 +819,7 @@ CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPd
{
pRes->nKind = pReader->ReadByte();
int n = pReader->ReadInt();
pRes->arrStr.reserve(n);
for (int i = 0; i < n; ++i)
pRes->arrStr.push_back(pReader->ReadString());
break;
@ -822,6 +828,7 @@ CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* ReadAction(NSOnlineOfficeBinToPd
{
pRes->nInt1 = pReader->ReadInt();
int n = pReader->ReadInt();
pRes->arrStr.reserve(n);
for (int i = 0; i < n; ++i)
pRes->arrStr.push_back(pReader->ReadString());
break;
@ -841,6 +848,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
m_nFontStyle = pReader->ReadInt();
int n = pReader->ReadInt();
m_arrTC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrTC.push_back(pReader->ReadDouble());
@ -863,6 +871,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
if (nFlags & (1 << 5))
{
int n = pReader->ReadInt();
m_arrBC.reserve(n);
for (int i = 0; i < n; ++i)
m_arrBC.push_back(pReader->ReadDouble());
}
@ -871,6 +880,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
if (nFlags & (1 << 7))
{
int n = pReader->ReadInt();
m_arrBG.reserve(n);
for (int i = 0; i < n; ++i)
m_arrBG.push_back(pReader->ReadDouble());
}
@ -880,6 +890,8 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
m_nParentID = pReader->ReadInt();
if (nFlags & (1 << 18))
m_wsT = pReader->ReadString();
if (nFlags & (1 << 20))
m_wsOMetadata = pReader->ReadString();
// Action
int nAction = pReader->ReadInt();
@ -976,7 +988,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CTextWidgetPr::Read(NSOnlineOfficeBinToPdf
m_wsV = pReader->ReadString();
if (nFlags & (1 << 10))
m_nMaxLen = pReader->ReadInt();
if (nWidgetFlag & (1 << 25))
if (nFlags & (1 << 11))
m_wsRV = pReader->ReadString();
if (nFlags & (1 << 12))
m_wsAPV = pReader->ReadString();
@ -1006,6 +1018,7 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr::Read(NSOnlineOfficeBinToP
if (nFlags & (1 << 10))
{
int n = pReader->ReadInt();
m_arrOpt.reserve(n);
for (int i = 0; i < n; ++i)
{
std::wstring s1 = pReader->ReadString();
@ -1020,12 +1033,14 @@ void CAnnotFieldInfo::CWidgetAnnotPr::CChoiceWidgetPr::Read(NSOnlineOfficeBinToP
if (nFlags & (1 << 13))
{
int n = pReader->ReadInt();
m_arrV.reserve(n);
for (int i = 0; i < n; ++i)
m_arrV.push_back(pReader->ReadString());
}
if (nFlags & (1 << 14))
{
int n = pReader->ReadInt();
m_arrI.reserve(n);
for (int i = 0; i < n; ++i)
m_arrI.push_back(pReader->ReadInt());
}
@ -1052,16 +1067,24 @@ CWidgetsInfo::~CWidgetsInfo()
for (int i = 0; i < m_arrParents.size(); ++i)
RELEASEOBJECT(m_arrParents[i]);
}
const std::vector<int>& CWidgetsInfo::GetCO() { return m_arrCO; }
const std::vector< std::pair<int, int> >& CWidgetsInfo::GetCO() { return m_arrCO; }
const std::vector<std::wstring>& CWidgetsInfo::GetButtonImg() { return m_arrButtonImg; }
const std::vector<CWidgetsInfo::CParent*>& CWidgetsInfo::GetParents() { return m_arrParents; }
void CWidgetsInfo::ChangeCO(int i, int nNum, int nGen)
{
if (i < 0 || i > m_arrCO.size() - 1)
return;
m_arrCO[i] = std::make_pair(nNum, nGen);
}
bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
{
int n = pReader->ReadInt();
m_arrCO.reserve(n);
for (int i = 0; i < n; ++i)
m_arrCO.push_back(pReader->ReadInt());
m_arrCO.push_back(std::make_pair(pReader->ReadInt(), -1));
n = pReader->ReadInt();
m_arrParents.reserve(n);
for (int i = 0; i < n; ++i)
{
CParent* pParent = new CParent();
@ -1077,6 +1100,7 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
if (nFlags & (1 << 3))
{
int n = pReader->ReadInt();
pParent->arrI.reserve(n);
for (int i = 0; i < n; ++i)
pParent->arrI.push_back(pReader->ReadInt());
}
@ -1085,13 +1109,45 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
if (nFlags & (1 << 5))
{
int n = pReader->ReadInt();
pParent->arrV.reserve(n);
for (int i = 0; i < n; ++i)
pParent->arrV.push_back(pReader->ReadString());
}
if (nFlags & (1 << 6))
{
int n = pReader->ReadInt();
pParent->arrOpt.reserve(n);
for (int i = 0; i < n; ++i)
{
std::wstring s1 = pReader->ReadString();
std::wstring s2 = pReader->ReadString();
pParent->arrOpt.push_back(std::make_pair(s1, s2));
}
}
if (nFlags & (1 << 7))
pParent->nFieldFlag = pReader->ReadInt();
if (nFlags & (1 << 8))
{
// Action
int nAction = pReader->ReadInt();
for (int i = 0; i < nAction; ++i)
{
std::wstring wsType = pReader->ReadString();
CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget* pA = ReadAction(pReader);
if (pA)
{
pA->wsType = wsType;
pParent->arrAction.push_back(pA);
}
}
}
if (nFlags & (1 << 9))
pParent->nMaxLen = pReader->ReadInt();
m_arrParents.push_back(pParent);
}
n = pReader->ReadInt();
m_arrButtonImg.reserve(n);
for (int i = 0; i < n; ++i)
{
std::string sImagePath = pReader->ReadStringA();

View File

@ -39,6 +39,36 @@ class IMetafileToRenderter;
class GRAPHICS_DECL CAnnotFieldInfo : public IAdvancedCommand
{
public:
enum EAnnotType
{
Unknown = -1,
Text = 0,
Link = 1,
FreeText = 2,
Line = 3,
Square = 4,
Circle = 5,
PolygonLine = 6,
PolyLine = 7,
Highlight = 8,
Underline = 9,
Squiggly = 10,
Strikeout = 11,
Stamp = 12,
Caret = 13,
Ink = 14,
Popup = 15,
FileAttachment = 16,
Widget = 26,
WidgetPushButton = 27,
WidgetRadioButton = 28,
WidgetCheckBox = 29,
WidgetText = 30,
WidgetCombobox = 31,
WidgetListbox = 32,
WidgetSignature = 33
};
class GRAPHICS_DECL CWidgetAnnotPr
{
public:
@ -164,6 +194,7 @@ public:
const std::wstring& GetT();
const std::wstring& GetFontName();
const std::wstring& GetFontKey();
const std::wstring& GetOMetadata();
const std::vector<double>& GetTC();
const std::vector<double>& GetBC();
const std::vector<double>& GetBG();
@ -193,6 +224,7 @@ public:
std::wstring m_wsT;
std::wstring m_wsFN;
std::wstring m_wsFK;
std::wstring m_wsOMetadata;
std::vector<double> m_arrTC;
std::vector<double> m_arrBC;
std::vector<double> m_arrBG;
@ -423,7 +455,9 @@ public:
CAnnotFieldInfo();
virtual ~CAnnotFieldInfo();
void CreateMarkup();
void SetType(int nType);
EAnnotType GetType();
void GetBounds(double& dX1, double& dY1, double& dX2, double& dY2);
void GetBorder(BYTE& nType, double& dWidth, std::vector<double>& arrDash);
@ -431,6 +465,7 @@ public:
int GetID() const;
int GetAnnotFlag() const;
int GetPage() const;
int GetCopyAP() const;
void GetBE(BYTE& nS, double& dI);
BYTE* GetRender(LONG& nLen);
const std::wstring& GetNM();
@ -479,7 +514,7 @@ private:
std::vector<double> arrDash;
};
int m_nType;
EAnnotType m_nType;
double m_dX1;
double m_dY1;
double m_dX2;
@ -488,6 +523,7 @@ private:
int m_nID;
int m_nAnnotFlag;
int m_nPage;
int m_nCopyAP;
std::wstring m_wsNM;
std::wstring m_wsLM;
std::wstring m_wsOUserID;
@ -533,25 +569,31 @@ public:
{
int nID;
int nFlags;
int nMaxLen;
int nParentID;
int nFieldFlag;
std::wstring sName;
std::wstring sV;
std::wstring sDV;
std::vector<int> arrI;
std::vector<std::wstring> arrV;
std::vector<CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget*> arrAction;
std::vector< std::pair<std::wstring, std::wstring> > arrOpt;
};
CWidgetsInfo();
virtual ~CWidgetsInfo();
const std::vector<int>& GetCO();
const std::vector< std::pair<int, int> >& GetCO();
const std::vector<std::wstring>& GetButtonImg();
const std::vector<CParent*>& GetParents();
void ChangeCO(int i, int nNum, int nGen);
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
private:
std::vector<int> m_arrCO;
std::vector< std::pair<int, int> > m_arrCO;
std::vector<std::wstring> m_arrButtonImg;
std::vector<CParent*> m_arrParents;
};

View File

@ -7,7 +7,7 @@ import os
base.configure_common_apps()
base.cmd_in_dir("./../../../../../core/Common/js", "make.py", ["./../../DesktopEditor/graphics/pro/js/drawingfile.json"])
base.cmd_in_dir("./../../../../../core/Common/js", sys.executable, ["make.py", "./../../DesktopEditor/graphics/pro/js/drawingfile.json"])
src_dir = "./deploy/"
dst_dir = "./../../../../../sdkjs/pdf/src/engine/"

View File

@ -51,6 +51,9 @@
"_IsNeedCMap",
"_SetCMapData",
"_ScanPage",
"_SplitPages",
"_MergePages",
"_UnmergePages",
"_GetImageBase64",
"_GetImageBase64Len",
"_GetImageBase64Ptr",
@ -67,6 +70,7 @@
"../../../../PdfFile/lib/goo", "../../../../PdfFile/lib/fofi", "../../../../PdfFile/lib/splash", "../../../../PdfFile/lib",
"../../../raster/Jp2/openjpeg", "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2",
"../../../../Common/3dParty/openssl/openssl/include",
"../../../../Common/3dParty/openssl/build/linux_64/include",
"../../../../DocxRenderer"
],
"define": [
@ -86,7 +90,7 @@
"NO_CONSOLE_IO", "USE_EXTERNAL_JPEG2000", "USE_JPIP", "OPJ_STATIC", "FONT_ENGINE_DISABLE_FILESYSTEM",
"IMAGE_CHECKER_DISABLE_XML",
"USE_OPENSSL_HASH",
"DISABLE_FULL_DOCUMENT_CREATION", "DISABLE_FILESYSTEM"
"DISABLE_FULL_DOCUMENT_CREATION", "DISABLE_FILESYSTEM", "CRYPTOPP_DISABLE_ASM", "DISABLE_TYPE_MISMATCH"
],
"compile_files_array": [
{
@ -135,7 +139,7 @@
},
{
"folder": "./wasm/src/",
"files": ["lib/wasm_jmp.cpp", "drawingfile.cpp", "metafile.cpp", "pdfwriter.cpp", "HTMLRendererText.cpp"]
"files": ["lib/wasm_jmp.cpp", "drawingfile.cpp", "metafile.cpp", "HTMLRendererText.cpp"]
},
{
"folder": "freetype-2.10.4/src/",
@ -143,7 +147,7 @@
},
{
"folder": "../../",
"files": ["GraphicsRenderer.cpp", "pro/pro_Graphics.cpp", "pro/pro_Fonts.cpp", "pro/pro_Image.cpp", "Graphics.cpp", "Brush.cpp", "BaseThread.cpp", "GraphicsPath.cpp", "BooleanOperations.cpp", "Image.cpp", "Matrix.cpp", "Clip.cpp", "TemporaryCS.cpp", "AlphaMask.cpp", "GraphicsLayer.cpp", "commands/DocInfo.cpp", "commands/AnnotField.cpp", "commands/FormField.cpp"]
"files": ["GraphicsRenderer.cpp", "pro/pro_Graphics.cpp", "pro/pro_Fonts.cpp", "pro/pro_Image.cpp", "Graphics.cpp", "Brush.cpp", "BaseThread.cpp", "GraphicsPath.cpp", "BooleanOperations.cpp", "Image.cpp", "Matrix.cpp", "Clip.cpp", "TemporaryCS.cpp", "AlphaMask.cpp", "GraphicsLayer.cpp", "commands/DocInfo.cpp", "commands/AnnotField.cpp", "commands/FormField.cpp", "MetafileToRenderer.cpp", "MetafileToRendererReader.cpp"]
},
{
"folder": "../../../fontengine/",
@ -155,12 +159,16 @@
},
{
"folder": "../../../common/",
"files": ["File.cpp", "Directory.cpp", "ByteBuilder.cpp", "Base64.cpp", "StringExt.cpp", "Path.cpp"]
"files": ["File.cpp", "Directory.cpp", "ByteBuilder.cpp", "Base64.cpp", "StringExt.cpp", "Path.cpp", "SystemUtils.cpp"]
},
{
"folder": "../../../../Common/3dParty/icu/icu/source/common/",
"files": ["ucnv.c", "ustr_wcs.cpp", "ucnv_err.c", "ucnv_bld.cpp", "ustrtrns.cpp", "ucnv_cb.c", "udata.cpp", "ucnv_io.cpp", "uhash.c", "udatamem.c", "cmemory.c", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucnvlat1.c", "ucnv_u16.c", "ucnv_u8.c", "ucnv_u32.c", "ucnv_u7.c", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnv_lmb.c", "ucnvhz.c", "ucnvscsu.c", "ucnvisci.c", "ucnvbocu.cpp", "ucnv_ct.c", "ucnv_cnv.c", "stringpiece.cpp", "charstr.cpp", "umapfile.c", "ucmndata.c", "ucnv_ext.cpp", "uobject.cpp", "umath.c", "ubidi_props.c", "uchar.c", "uinvchar.c", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "utf_impl.c", "ustrcase.cpp", "cstring.c", "bytestrie.cpp"]
},
{
"folder": "../../../../Common/3dParty/cryptopp/",
"files": ["cryptlib.cpp", "cpu.cpp", "integer.cpp", "3way.cpp", "adler32.cpp", "algebra.cpp", "algparam.cpp", "allocate.cpp", "arc4.cpp", "aria.cpp", "aria_simd.cpp", "ariatab.cpp", "asn.cpp", "authenc.cpp", "base32.cpp", "base64.cpp", "basecode.cpp", "bfinit.cpp", "blake2.cpp", "blake2s_simd.cpp", "blake2b_simd.cpp", "blowfish.cpp", "blumshub.cpp", "camellia.cpp", "cast.cpp", "casts.cpp", "cbcmac.cpp", "ccm.cpp", "chacha.cpp", "chacha_simd.cpp", "chacha_avx.cpp", "chachapoly.cpp", "cham.cpp", "cham_simd.cpp", "channels.cpp", "cmac.cpp", "crc.cpp", "crc_simd.cpp", "darn.cpp", "default.cpp", "des.cpp", "dessp.cpp", "dh.cpp", "dh2.cpp", "dll.cpp", "donna_32.cpp", "donna_64.cpp", "donna_sse.cpp", "dsa.cpp", "eax.cpp", "ec2n.cpp", "ecp.cpp", "eccrypto.cpp", "eprecomp.cpp", "elgamal.cpp", "emsa2.cpp", "eprecomp.cpp", "esign.cpp", "files.cpp", "filters.cpp", "fips140.cpp", "gcm.cpp", "gcm_simd.cpp", "gf256.cpp", "gf2_32.cpp", "gf2n.cpp", "gf2n_simd.cpp", "gfpcrypt.cpp", "gost.cpp", "gzip.cpp", "hc128.cpp", "hc256.cpp", "hex.cpp", "hight.cpp", "hmac.cpp", "hrtimer.cpp", "ida.cpp", "idea.cpp", "iterhash.cpp", "kalyna.cpp", "md5.cpp", "randpool.cpp", "osrng.cpp", "rijndael.cpp", "modes.cpp", "misc.cpp", "rdtables.cpp", "sha.cpp", "mqueue.cpp", "queue.cpp"]
},
{
"folder": "../../../../OfficeUtils/src/",
"files": ["OfficeUtils.cpp", "ZipBuffer.cpp", "ZipUtilsCP.cpp", "zlib_addon.c"]
@ -179,7 +187,23 @@
},
{
"folder": "../../../../PdfFile/",
"files": ["SrcReader/Adaptors.cpp", "SrcReader/GfxClip.cpp", "SrcReader/RendererOutputDev.cpp", "SrcReader/JPXStream2.cpp", "SrcReader/PdfAnnot.cpp", "Resources/BaseFonts.cpp", "Resources/CMapMemory/cmap_memory.cpp", "lib/fofi/FofiBase.cc", "lib/fofi/FofiEncodings.cc", "lib/fofi/FofiIdentifier.cc", "lib/fofi/FofiTrueType.cc", "lib/fofi/FofiType1.cc", "lib/fofi/FofiType1C.cc", "lib/goo/FixedPoint.cc", "lib/goo/gfile.cc", "lib/goo/GHash.cc", "lib/goo/GList.cc", "lib/goo/gmem.cc", "lib/goo/gmempp.cc", "lib/goo/GString.cc", "lib/goo/parseargs.c", "lib/goo/Trace.cc", "lib/splash/Splash.cc", "lib/splash/SplashBitmap.cc", "lib/splash/SplashClip.cc", "lib/splash/SplashFont.cc", "lib/splash/SplashFontEngine.cc", "lib/splash/SplashFontFile.cc", "lib/splash/SplashFontFileID.cc", "lib/splash/SplashFTFont.cc", "lib/splash/SplashFTFontEngine.cc", "lib/splash/SplashFTFontFile.cc", "lib/splash/SplashPath.cc", "lib/splash/SplashPattern.cc", "lib/splash/SplashScreen.cc", "lib/splash/SplashState.cc", "lib/splash/SplashXPath.cc", "lib/splash/SplashXPathScanner.cc", "lib/xpdf/AcroForm.cc", "lib/xpdf/Annot.cc", "lib/xpdf/Array.cc", "lib/xpdf/BuiltinFont.cc", "lib/xpdf/BuiltinFontTables.cc", "lib/xpdf/Catalog.cc", "lib/xpdf/CharCodeToUnicode.cc", "lib/xpdf/CMap.cc", "lib/xpdf/Decrypt.cc", "lib/xpdf/Dict.cc", "lib/xpdf/DisplayState.cc", "lib/xpdf/Error.cc", "lib/xpdf/FontEncodingTables.cc", "lib/xpdf/Function.cc", "lib/xpdf/Gfx.cc", "lib/xpdf/GfxFont.cc", "lib/xpdf/GfxState.cc", "lib/xpdf/GlobalParams.cc", "lib/xpdf/ImageOutputDev.cc", "lib/xpdf/JArithmeticDecoder.cc", "lib/xpdf/JBIG2Stream.cc", "lib/xpdf/JPXStream.cc", "lib/xpdf/Lexer.cc", "lib/xpdf/Link.cc", "lib/xpdf/NameToCharCode.cc", "lib/xpdf/Object.cc", "lib/xpdf/OptionalContent.cc", "lib/xpdf/Outline.cc", "lib/xpdf/OutputDev.cc", "lib/xpdf/Page.cc", "lib/xpdf/Parser.cc", "lib/xpdf/PDF417Barcode.cc", "lib/xpdf/PDFCore.cc", "lib/xpdf/PDFDoc.cc", "lib/xpdf/PDFDocEncoding.cc", "lib/xpdf/PreScanOutputDev.cc", "lib/xpdf/PSOutputDev.cc", "lib/xpdf/PSTokenizer.cc", "lib/xpdf/SecurityHandler.cc", "lib/xpdf/ShadingImage.cc", "lib/xpdf/SplashOutputDev.cc", "lib/xpdf/Stream.cc", "lib/xpdf/TextOutputDev.cc", "lib/xpdf/TextString.cc", "lib/xpdf/TileCache.cc", "lib/xpdf/TileCompositor.cc", "lib/xpdf/TileMap.cc", "lib/xpdf/UnicodeMap.cc", "lib/xpdf/UnicodeRemapping.cc", "lib/xpdf/UnicodeTypeTable.cc", "lib/xpdf/UTF8.cc", "lib/xpdf/WebFont.cc", "lib/xpdf/XFAScanner.cc", "lib/xpdf/XRef.cc", "lib/xpdf/Zoox.cc", "PdfFile.cpp", "PdfReader.cpp"]
"files": ["PdfFile.cpp", "PdfReader.cpp", "PdfWriter.cpp", "PdfEditor.cpp", "OnlineOfficeBinToPdf.cpp"]
},
{
"folder": "../../../../PdfFile/SrcReader/",
"files": ["Adaptors.cpp", "GfxClip.cpp", "RendererOutputDev.cpp", "JPXStream2.cpp", "PdfAnnot.cpp"]
},
{
"folder": "../../../../PdfFile/SrcWriter/",
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp"]
},
{
"folder": "../../../../PdfFile/Resources/",
"files": ["BaseFonts.cpp", "CMapMemory/cmap_memory.cpp"]
},
{
"folder": "../../../../PdfFile/lib/",
"files": ["fofi/FoFiBase.cc", "fofi/FoFiEncodings.cc", "fofi/FoFiIdentifier.cc", "fofi/FoFiTrueType.cc", "fofi/FoFiType1.cc", "fofi/FoFiType1C.cc", "goo/FixedPoint.cc", "goo/gfile.cc", "goo/GHash.cc", "goo/GList.cc", "goo/gmem.cc", "goo/gmempp.cc", "goo/GString.cc", "goo/parseargs.c", "goo/Trace.cc", "splash/Splash.cc", "splash/SplashBitmap.cc", "splash/SplashClip.cc", "splash/SplashFont.cc", "splash/SplashFontEngine.cc", "splash/SplashFontFile.cc", "splash/SplashFontFileID.cc", "splash/SplashFTFont.cc", "splash/SplashFTFontEngine.cc", "splash/SplashFTFontFile.cc", "splash/SplashPath.cc", "splash/SplashPattern.cc", "splash/SplashScreen.cc", "splash/SplashState.cc", "splash/SplashXPath.cc", "splash/SplashXPathScanner.cc", "xpdf/AcroForm.cc", "xpdf/Annot.cc", "xpdf/Array.cc", "xpdf/BuiltinFont.cc", "xpdf/BuiltinFontTables.cc", "xpdf/Catalog.cc", "xpdf/CharCodeToUnicode.cc", "xpdf/CMap.cc", "xpdf/Decrypt.cc", "xpdf/Dict.cc", "xpdf/DisplayState.cc", "xpdf/Error.cc", "xpdf/FontEncodingTables.cc", "xpdf/Function.cc", "xpdf/Gfx.cc", "xpdf/GfxFont.cc", "xpdf/GfxState.cc", "xpdf/GlobalParams.cc", "xpdf/ImageOutputDev.cc", "xpdf/JArithmeticDecoder.cc", "xpdf/JBIG2Stream.cc", "xpdf/JPXStream.cc", "xpdf/Lexer.cc", "xpdf/Link.cc", "xpdf/NameToCharCode.cc", "xpdf/Object.cc", "xpdf/OptionalContent.cc", "xpdf/Outline.cc", "xpdf/OutputDev.cc", "xpdf/Page.cc", "xpdf/Parser.cc", "xpdf/PDF417Barcode.cc", "xpdf/PDFCore.cc", "xpdf/PDFDoc.cc", "xpdf/PDFDocEncoding.cc", "xpdf/PreScanOutputDev.cc", "xpdf/PSOutputDev.cc", "xpdf/PSTokenizer.cc", "xpdf/SecurityHandler.cc", "xpdf/ShadingImage.cc", "xpdf/SplashOutputDev.cc", "xpdf/Stream.cc", "xpdf/TextOutputDev.cc", "xpdf/TextString.cc", "xpdf/TileCache.cc", "xpdf/TileCompositor.cc", "xpdf/TileMap.cc", "xpdf/UnicodeMap.cc", "xpdf/UnicodeRemapping.cc", "xpdf/UnicodeTypeTable.cc", "xpdf/UTF8.cc", "xpdf/WebFont.cc", "xpdf/XFAScanner.cc", "xpdf/XRef.cc", "xpdf/Zoox.cc"]
},
{
"folder": "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2/",
@ -223,7 +247,7 @@
},
{
"folder": "../../../../DocxRenderer/src/logic/elements",
"files": ["BaseItem.cpp", "ContText.cpp", "Paragraph.cpp", "Shape.cpp", "TextLine.cpp"]
"files": ["BaseItem.cpp", "ContText.cpp", "Paragraph.cpp", "Shape.cpp", "TextLine.cpp", "Table.cpp"]
},
{
"folder": "../../../common",

View File

@ -619,10 +619,7 @@ INCLUDEPATH += \
$$PDF_ROOT_DIR/lib/splash \
$$PDF_ROOT_DIR/lib
HEADERS += \
$$PDF_ROOT_DIR/lib/aconf.h \
$$$files($$PDF_ROOT_DIR/lib/*.h)
HEADERS += $$files($$PDF_ROOT_DIR/lib/*.h, true)
SOURCES += $$files($$PDF_ROOT_DIR/lib/*.c, true)
SOURCES += $$files($$PDF_ROOT_DIR/lib/*.cc, true)
@ -644,9 +641,7 @@ SOURCES += \
$$PDF_ROOT_DIR/SrcReader/GfxClip.cpp \
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.cpp \
$$PDF_ROOT_DIR/Resources/BaseFonts.cpp \
$$PDF_ROOT_DIR/Resources/CMapMemory/cmap_memory.cpp \
$$PDF_ROOT_DIR/PdfReader.cpp \
$$PDF_ROOT_DIR/PdfFile.cpp
$$PDF_ROOT_DIR/Resources/CMapMemory/cmap_memory.cpp
HEADERS +=\
$$PDF_ROOT_DIR/Resources/Fontd050000l.h \
@ -670,9 +665,87 @@ HEADERS +=\
$$PDF_ROOT_DIR/SrcReader/MemoryUtils.h \
$$PDF_ROOT_DIR/SrcReader/GfxClip.h \
$$PDF_ROOT_DIR/SrcReader/FontsWasm.h \
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.h \
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.h
DEFINES += CRYPTOPP_DISABLE_ASM
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib
# PdfWriter
HEADERS += \
$$PDF_ROOT_DIR/SrcWriter/AcroForm.h \
$$PDF_ROOT_DIR/SrcWriter/Annotation.h \
$$PDF_ROOT_DIR/SrcWriter/Catalog.h \
$$PDF_ROOT_DIR/SrcWriter/Consts.h \
$$PDF_ROOT_DIR/SrcWriter/Destination.h \
$$PDF_ROOT_DIR/SrcWriter/Document.h \
$$PDF_ROOT_DIR/SrcWriter/Encodings.h \
$$PDF_ROOT_DIR/SrcWriter/Encrypt.h \
$$PDF_ROOT_DIR/SrcWriter/EncryptDictionary.h \
$$PDF_ROOT_DIR/SrcWriter/Field.h \
$$PDF_ROOT_DIR/SrcWriter/Font.h \
$$PDF_ROOT_DIR/SrcWriter/Font14.h \
$$PDF_ROOT_DIR/SrcWriter/FontCidTT.h \
$$PDF_ROOT_DIR/SrcWriter/FontTT.h \
$$PDF_ROOT_DIR/SrcWriter/FontTTWriter.h \
$$PDF_ROOT_DIR/SrcWriter/GState.h \
$$PDF_ROOT_DIR/SrcWriter/Image.h \
$$PDF_ROOT_DIR/SrcWriter/Info.h \
$$PDF_ROOT_DIR/SrcWriter/Objects.h \
$$PDF_ROOT_DIR/SrcWriter/Outline.h \
$$PDF_ROOT_DIR/SrcWriter/Pages.h \
$$PDF_ROOT_DIR/SrcWriter/Pattern.h \
$$PDF_ROOT_DIR/SrcWriter/ResourcesDictionary.h \
$$PDF_ROOT_DIR/SrcWriter/Shading.h \
$$PDF_ROOT_DIR/SrcWriter/Streams.h \
$$PDF_ROOT_DIR/SrcWriter/Types.h \
$$PDF_ROOT_DIR/SrcWriter/Utils.h \
$$PDF_ROOT_DIR/SrcWriter/Metadata.h \
$$PDF_ROOT_DIR/SrcWriter/ICCProfile.h \
$$PDF_ROOT_DIR/SrcWriter/States.h
SOURCES += \
$$PDF_ROOT_DIR/SrcWriter/AcroForm.cpp \
$$PDF_ROOT_DIR/SrcWriter/Annotation.cpp \
$$PDF_ROOT_DIR/SrcWriter/Catalog.cpp \
$$PDF_ROOT_DIR/SrcWriter/Destination.cpp \
$$PDF_ROOT_DIR/SrcWriter/Document.cpp \
$$PDF_ROOT_DIR/SrcWriter/Encrypt.cpp \
$$PDF_ROOT_DIR/SrcWriter/EncryptDictionary.cpp \
$$PDF_ROOT_DIR/SrcWriter/Field.cpp \
$$PDF_ROOT_DIR/SrcWriter/Font.cpp \
$$PDF_ROOT_DIR/SrcWriter/Font14.cpp \
$$PDF_ROOT_DIR/SrcWriter/FontCidTT.cpp \
$$PDF_ROOT_DIR/SrcWriter/FontTT.cpp \
$$PDF_ROOT_DIR/SrcWriter/FontTTWriter.cpp \
$$PDF_ROOT_DIR/SrcWriter/GState.cpp \
$$PDF_ROOT_DIR/SrcWriter/Image.cpp \
$$PDF_ROOT_DIR/SrcWriter/Info.cpp \
$$PDF_ROOT_DIR/SrcWriter/Objects.cpp \
$$PDF_ROOT_DIR/SrcWriter/Outline.cpp \
$$PDF_ROOT_DIR/SrcWriter/Pages.cpp \
$$PDF_ROOT_DIR/SrcWriter/Pattern.cpp \
$$PDF_ROOT_DIR/SrcWriter/ResourcesDictionary.cpp \
$$PDF_ROOT_DIR/SrcWriter/Shading.cpp \
$$PDF_ROOT_DIR/SrcWriter/Streams.cpp \
$$PDF_ROOT_DIR/SrcWriter/Utils.cpp \
$$PDF_ROOT_DIR/SrcWriter/Metadata.cpp \
$$PDF_ROOT_DIR/SrcWriter/States.cpp
# PdfFile
HEADERS += \
$$PDF_ROOT_DIR/PdfFile.h \
$$PDF_ROOT_DIR/PdfWriter.h \
$$PDF_ROOT_DIR/PdfReader.h \
$$PDF_ROOT_DIR/PdfFile.h
$$PDF_ROOT_DIR/PdfEditor.h \
$$PDF_ROOT_DIR/OnlineOfficeBinToPdf.h
SOURCES += \
$$PDF_ROOT_DIR/PdfFile.cpp \
$$PDF_ROOT_DIR/PdfWriter.cpp \
$$PDF_ROOT_DIR/PdfReader.cpp \
$$PDF_ROOT_DIR/PdfEditor.cpp \
$$PDF_ROOT_DIR/OnlineOfficeBinToPdf.cpp
# DocxRenderer
DOCX_RENDERER_ROOT_DIR = $$CORE_ROOT_DIR/DocxRenderer
@ -682,6 +755,7 @@ HEADERS += \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/DropCap.h \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Paragraph.h \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Shape.h \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Table.h \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/TextLine.h \
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ExternalImageStorage.h \
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontStyleManager.h \
@ -706,6 +780,7 @@ SOURCES += \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/ContText.cpp \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Paragraph.cpp \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Shape.cpp \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Table.cpp \
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/TextLine.cpp \
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontManager.cpp \
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontStyleManager.cpp \
@ -727,7 +802,6 @@ HEADERS += \
../wasm/src/Text.h
SOURCES += \
../wasm/src/pdfwriter.cpp \
../wasm/src/HTMLRendererText.cpp \
../wasm/src/drawingfile.cpp \
../wasm/src/drawingfile_test.cpp

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
* (c) Copyright Ascensio System SIA 2010-2024
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,19 @@ CNativePointer.prototype.free = function()
g_native_drawing_file["FreeWasmData"](this.ptr);
this.ptr = null;
};
CNativePointer.prototype.getMemory = function(isCopy)
{
if (!this.ptr)
return null;
if (!isCopy)
return this.ptr;
let copyArray = new Uint8Array(this.ptr.length);
copyArray.set(this.ptr);
return copyArray;
};
CNativePointer.prototype.getReader = function()
{
if (!this.ptr)
@ -94,6 +107,34 @@ CFile.prototype._getError = function()
return g_native_drawing_file["GetErrorCode"]();
};
CFile.prototype._SplitPages = function(pages, changes)
{
let dataChanges = null;
if (changes)
dataChanges = (undefined !== changes.byteLength) ? new Uint8Array(changes) : changes;
g_module_pointer.ptr = g_native_drawing_file["SplitPages"](pages, dataChanges);
return g_module_pointer;
};
CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
{
if (!buffer)
return false;
if (!maxID)
maxID = 0;
if (!prefixForm)
prefixForm = "";
let data = (undefined !== buffer.byteLength) ? new Uint8Array(buffer) : buffer;
return g_native_drawing_file["MergePages"](data, maxID, prefixForm);
};
CFile.prototype._UndoMergePages = function()
{
return g_native_drawing_file["UnmergePages"]();
};
// FONTS
CFile.prototype._isNeedCMap = function()
{

View File

@ -39,7 +39,7 @@ CWasmPointer.prototype.free = function()
Module["_free"](this.ptr);
this.ptr = 0;
};
CWasmPointer.prototype.getReader = function()
CWasmPointer.prototype.getMemory = function(isCopy)
{
if (!this.ptr)
return null;
@ -59,8 +59,23 @@ CWasmPointer.prototype.getReader = function()
}
len -= 4;
let buffer = new Uint8Array(Module["HEAP8"].buffer, this.ptr + 4, len);
return new CBinaryReader(buffer, 0, len);
let noCopyArray = new Uint8Array(Module["HEAP8"].buffer, this.ptr + 4, len);
if (!isCopy)
return noCopyArray;
let copyArray = new Uint8Array(len);
copyArray.set(noCopyArray);
return copyArray;
};
CWasmPointer.prototype.getReader = function()
{
let noCopyArray = this.getMemory(false);
if (!noCopyArray)
return null;
return new CBinaryReader(noCopyArray, 0, noCopyArray.length);
};
var g_module_pointer = new CWasmPointer();
@ -86,8 +101,9 @@ CFile.prototype._openFile = function(buffer, password)
{
let data = new Uint8Array(buffer);
this.stream_size = data.length;
this.stream = Module["_malloc"](this.stream_size);
Module["HEAP8"].set(data, this.stream);
let stream = Module["_malloc"](this.stream_size);
Module["HEAP8"].set(data, stream);
this.stream.push(stream);
}
let passwordPtr = 0;
@ -98,7 +114,7 @@ CFile.prototype._openFile = function(buffer, password)
Module["HEAP8"].set(passwordBuf, passwordPtr);
}
this.nativeFile = Module["_Open"](this.stream, this.stream_size, passwordPtr);
this.nativeFile = Module["_Open"](this.stream[0], this.stream_size, passwordPtr);
if (passwordPtr)
Module["_free"](passwordPtr);
@ -112,7 +128,7 @@ CFile.prototype._closeFile = function()
CFile.prototype._getType = function()
{
return Module["_GetType"](this.stream, this.stream_size);
return Module["_GetType"](this.stream[0], this.stream_size);
};
CFile.prototype._getError = function()
@ -120,6 +136,72 @@ CFile.prototype._getError = function()
return Module["_GetErrorCode"](this.nativeFile);
};
CFile.prototype._SplitPages = function(memoryBuffer, arrayBufferChanges)
{
let changesPtr = 0;
let changesLen = 0;
if (arrayBufferChanges)
{
let changes = new Uint8Array(arrayBufferChanges);
changesLen = changes.length;
changesPtr = Module["_malloc"](changesLen);
Module["HEAP8"].set(changes, changesPtr);
}
let pointer = Module["_malloc"](memoryBuffer.length * 4);
Module["HEAP32"].set(memoryBuffer, pointer >> 2);
let ptr = Module["_SplitPages"](this.nativeFile, pointer, memoryBuffer.length, changesPtr, changesLen);
Module["_free"](pointer);
if (changesPtr)
Module["_free"](changesPtr);
g_module_pointer.ptr = ptr;
return g_module_pointer;
};
CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
{
if (!buffer)
return false;
let data = (undefined !== buffer.byteLength) ? new Uint8Array(buffer) : buffer;
let stream2 = Module["_malloc"](data.length);
Module["HEAP8"].set(data, stream2);
if (!maxID)
maxID = 0;
let prefixPtr = 0;
if (prefixForm)
{
let prefixBuf = prefixForm.toUtf8();
prefixPtr = Module["_malloc"](prefixBuf.length);
Module["HEAP8"].set(prefixBuf, prefixPtr);
}
let bRes = Module["_MergePages"](this.nativeFile, stream2, data.length, maxID, prefixPtr);
if (bRes == 1)
this.stream.push(stream2);
else
Module["_free"](stream2);
if (prefixPtr)
Module["_free"](prefixPtr);
return bRes == 1;
};
CFile.prototype._UndoMergePages = function()
{
let bRes = Module["_UnmergePages"](this.nativeFile);
if (bRes == 1)
{
let str = this.stream.pop();
Module["_free"](str);
}
return bRes == 1;
};
// FONTS
CFile.prototype._isNeedCMap = function()
{

View File

@ -42,6 +42,12 @@ CBinaryReader.prototype.readByte = function()
this.pos += 1;
return val;
};
CBinaryReader.prototype.readShort = function()
{
let val = this.data[this.pos] | this.data[this.pos + 1] << 8;
this.pos += 2;
return val;
};
CBinaryReader.prototype.readInt = function()
{
let val = this.data[this.pos] | this.data[this.pos + 1] << 8 | this.data[this.pos + 2] << 16 | this.data[this.pos + 3] << 24;
@ -56,6 +62,10 @@ CBinaryReader.prototype.readDouble2 = function()
{
return this.readInt() / 10000;
};
CBinaryReader.prototype.readDouble3 = function()
{
return this.readInt() / 100000;
};
CBinaryReader.prototype.readString = function()
{
let len = this.readInt();
@ -63,9 +73,20 @@ CBinaryReader.prototype.readString = function()
this.pos += len;
return val;
};
CBinaryReader.prototype.readString2 = function()
{
let len = this.readShort();
let val = "";
for (let i = 0; i < len; ++i)
{
let c = this.readShort();
val += String.fromCharCode(c);
}
return val;
};
CBinaryReader.prototype.readData = function()
{
let len = this.readInt();
let len = this.readInt() - 4;
let val = this.data.slice(this.pos, this.pos + len);
this.pos += len;
return val;

View File

@ -125,7 +125,7 @@ WASM_EXPORT BYTE* GetGlyphs(CDrawingFile* pFile, int nPageIndex)
{
return pFile->GetGlyphs(nPageIndex);
}
WASM_EXPORT BYTE* GetLinks (CDrawingFile* pFile, int nPageIndex)
WASM_EXPORT BYTE* GetLinks(CDrawingFile* pFile, int nPageIndex)
{
return pFile->GetLinks(nPageIndex);
}
@ -177,6 +177,18 @@ WASM_EXPORT BYTE* ScanPage(CDrawingFile* pFile, int nPageIndex, int mode)
{
return pFile->ScanPage(nPageIndex, mode);
}
WASM_EXPORT BYTE* SplitPages(CDrawingFile* pFile, int* arrPageIndex, int nLength, BYTE* data, LONG size)
{
return pFile->SplitPages(arrPageIndex, nLength, data, size);
}
WASM_EXPORT int MergePages(CDrawingFile* pFile, BYTE* data, LONG size, int nMaxID, const char* sPrefixForm)
{
return pFile->MergePages(data, size, nMaxID, sPrefixForm) ? 1 : 0;
}
WASM_EXPORT int UnmergePages(CDrawingFile* pFile)
{
return pFile->UnmergePages() ? 1 : 0;
}
WASM_EXPORT void* GetImageBase64(CDrawingFile* pFile, int rId)
{

Some files were not shown because too many files have changed in this diff Show More