Compare commits

...

492 Commits

Author SHA1 Message Date
f96dd51403 Fix bug #73727 2025-09-08 17:40:18 +03:00
a96460f096 Merge pull request 'hotfix/v9.0.4' (#434) from hotfix/v9.0.4 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/434
2025-09-08 07:20:47 +00:00
d5d211dbe0 Merge pull request 'fix bug 75855' (#399) from fix/bug-75855 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/399
2025-09-08 07:19:46 +00:00
602207ab6d Update unit-tests 2025-09-08 09:48:38 +03:00
39e6c1e2c6 Fix curve intersection 2025-09-08 09:47:53 +03:00
1d723fee65 Merge pull request 'fix/CustomShapePath' (#433) from fix/CustomShapePath into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/433
2025-09-06 11:54:07 +00:00
3be712f2a1 . 2025-09-04 23:38:11 +03:00
62317f95a1 [android] remove legacy packaging 2025-09-04 17:33:46 +03:00
5463d8dcc0 fix bug #76571 2025-09-04 16:05:19 +03:00
a696f9a7a9 Merge pull request 'fix/bug76397' (#431) from fix/bug76397 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/431
2025-09-03 14:49:42 +00:00
801fad7c74 fix bug 2025-09-03 16:55:27 +03:00
a1e120e901 Merge pull request 'Fix bug #76513' (#432) from fix/bug-76513 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/432
2025-09-03 12:51:56 +00:00
c84855b17e [android] improved clarity 2025-09-03 12:49:15 +03:00
8a339386f4 Fix build 2025-09-03 08:46:43 +03:00
47aa4ebb77 Fix build 2025-09-02 23:33:04 +03:00
f52643b750 Add method for system directory 2025-09-02 22:46:39 +03:00
da278aba0b fix/bug76397
fix bug when text:section  is interpreted like text:properties
2025-09-02 18:05:49 +03:00
e6da8e50f5 Fix bug #76513 2025-09-02 17:05:44 +03:00
950482095c fix bug #76358 2025-09-02 10:11:09 +03:00
8ca89ca9b7 [android] Update icu path, enable resource shrinking 2025-09-02 08:21:01 +03:00
da705edfb8 fix bug #76472 2025-09-01 17:03:24 +03:00
2ed318df0f fix bug #76417 2025-09-01 15:41:29 +03:00
771ee80ec5 fix bug #71797 2025-09-01 13:12:46 +03:00
4ddf4521c4 fix macros in embedded 2025-09-01 12:41:04 +03:00
03d7f3489c path conversion 2025-08-29 15:05:49 +03:00
1491bd8802 Merge pull request 'Fix bugs' (#429) from fix/fb2-html-hwp into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/429
2025-08-29 10:12:51 +00:00
e7de9af0e0 Fix build 2025-08-28 19:33:34 +03:00
703ec47e67 Merge pull request 'fix bug #76433' (#428) from fix/bug76433 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/428
2025-08-28 15:07:44 +00:00
708e37d0a5 Merge pull request 'Fix bug 45529' (#427) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/427
2025-08-28 15:06:51 +00:00
e11b946d62 fix bug #76433 2025-08-28 21:05:16 +06:00
331401ea86 Fix bug 45529 2025-08-28 18:02:53 +03:00
40809ea3c2 fix build 2025-08-28 15:34:21 +03:00
b79001a9fd Merge branch 'fix/ofd' into fix/fb2-html-hwp 2025-08-28 14:57:02 +03:00
49d4b5c1d2 Merge remote-tracking branch 'origin/fix/html-bugs' into fix/fb2-html-hwp 2025-08-28 14:56:12 +03:00
fa513eb83f Merge remote-tracking branch 'origin/fix/hwp-bugs' into fix/fb2-html-hwp 2025-08-28 14:55:56 +03:00
e84e0a6ce8 Merge branch 'fix/fb2' into fix/fb2-html-hwp 2025-08-28 14:55:43 +03:00
13158b2956 Merge pull request 'fix bug #76439' (#422) from fix/bug76439 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/422
2025-08-28 11:22:22 +00:00
9e8beb5651 Merge pull request 'fix/bug56564' (#425) from fix/bug56564 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/425
2025-08-28 11:20:43 +00:00
711e80e62c Merge pull request 'Fix bug 76484, 76443' (#426) from fix/bug-76484 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/426
2025-08-28 10:28:36 +00:00
3404aab782 Fix bug 76484 2025-08-28 12:10:22 +03:00
9c3ba26fab fix/bug56564 2025-08-28 11:38:17 +03:00
02f4c10cd6 Merge branch 'fix/bug56564' of git.onlyoffice.com:ONLYOFFICE/core into fix/bug56564 2025-08-28 11:30:09 +03:00
0d912533bf fix/bug56564 2025-08-28 11:30:06 +03:00
066793921b revert 518a38e178
revert fix/bug56564

fix bug with uncorrected table of contents
2025-08-28 08:29:11 +00:00
9b2b7263c2 revert 518a38e178
revert fix/bug56564

fix bug with uncorrected table of contents
2025-08-28 08:25:05 +00:00
31c28903d6 Merge pull request 'Fix bug 56419' (#423) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/423
2025-08-27 22:46:36 +00:00
518a38e178 fix/bug56564
fix bug with uncorrected table of contents
2025-08-27 22:39:10 +03:00
631c2d4490 Fix bug 56419 2025-08-27 22:04:15 +03:00
0d0003ad5a fix bug #76439 2025-08-27 19:12:03 +06:00
eb3bedd840 Fix build with xcode 14- 2025-08-27 13:55:11 +03:00
0e9db67173 Merge pull request 'Fix bug 76416' (#421) from fix/bug-76416 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/421
2025-08-27 09:18:46 +00:00
1a65242d46 Fix build 2025-08-27 12:04:48 +03:00
30da4b631f Fix build 2025-08-26 16:07:41 +03:00
a988e6741c Merge branch 'release/v9.1.0' of https://git.onlyoffice.com/ONLYOFFICE/core into release/v9.1.0 2025-08-26 09:56:18 +03:00
29c2239df2 Fix build 2025-08-26 09:56:07 +03:00
0d7ddfb580 Merge pull request 'Fix bug 56063' (#420) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/420
2025-08-26 06:03:47 +00:00
a7b5866bc6 Fix bug in HWP 2025-08-26 08:44:29 +03:00
8bbb21263d Fix build 2025-08-25 22:53:43 +03:00
a652bd6591 Fix bug 56063 2025-08-25 16:19:02 +03:00
78532c27cf Fix bug 76416 2025-08-25 16:01:47 +03:00
63d3999072 Fix build with c++17 2025-08-22 23:50:22 +03:00
d055522aa0 Merge branch 'feature/libheif' into release/v9.1.0 2025-08-22 22:33:26 +03:00
c5e63a8d26 fix bug #76396 2025-08-22 16:23:28 +03:00
e56da8e641 Add ios and android libheif support 2025-08-22 13:15:44 +04:00
ba63cfc622 Merge pull request 'feature/custom-sysroot' (#417) from feature/custom-sysroot into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/417
2025-08-22 07:50:56 +00:00
7486182be7 Merge pull request 'release/v9.1.0' (#416) from release/v9.1.0 into feature/custom-sysroot
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/416
2025-08-22 07:41:42 +00:00
6f171bd5d7 Merge pull request 'Fix bug 57050' (#415) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/415
2025-08-21 16:39:09 +00:00
dad2fdd3e0 Fix prev 2025-08-21 19:38:49 +03:00
48bc54311c Fix bug 57050 2025-08-21 19:08:37 +03:00
a71b7ec6e7 Fix pro file path 2025-08-21 17:07:56 +03:00
292e6b0431 Merge pull request 'fix/fix-bugs' (#414) from fix/fix-bugs into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/414
2025-08-21 13:52:17 +00:00
5649de0877 Merge remote-tracking branch 'origin/fix/bug73365' into fix/fix-bugs 2025-08-21 16:50:07 +03:00
7aa2056785 Merge branch 'fix/bug73365' of git.onlyoffice.com:ONLYOFFICE/core into fix/bug73365 2025-08-21 14:29:40 +03:00
b1c8969ede fix/bug73365
fix bug when after conversion text move to next column. Also detect and fix a new bug, when we have explicit break column but break is happening early
2025-08-21 14:28:47 +03:00
d3805e81d7 Refactoring win arm build 2025-08-20 17:43:39 +03:00
7e78b9b190 Merge pull request 'release/v9.1.0' (#412) from release/v9.1.0 into fix/CustomShapePath
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/412
2025-08-20 13:56:34 +00:00
8171939be6 Merge pull request 'fix/rtfFormat' (#411) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/411
2025-08-19 13:19:54 +00:00
5178de4254 Fix bug 75790 2025-08-19 15:49:48 +03:00
f3ee3c8c91 Fix image size in HWP format 2025-08-19 12:16:12 +03:00
e108591a7e Fix bug #74898 2025-08-19 12:15:09 +03:00
29f1dc454b Fix bug #73730 2025-08-19 11:42:46 +03:00
b534907bc9 Remove checkout 2025-08-19 10:16:18 +03:00
4a8b7455ca Revert previous commit 2025-08-18 23:09:48 +03:00
b957d3aeea Fix build 2025-08-18 23:07:48 +03:00
be93c7f621 Fix linux build 2025-08-18 23:05:07 +03:00
520c345f00 Merge branch 'release/v9.1.0' of https://git.onlyoffice.com/ONLYOFFICE/core into release/v9.1.0 2025-08-18 21:52:43 +03:00
08ce05e5d3 Fix windows build 2025-08-18 21:52:32 +03:00
a8125114de fix bug #76361 (add custom xml in pptx) 2025-08-18 21:50:39 +03:00
13a4986eb7 Merge pull request 'fix/bug-with-break-column' (#410) from fix/bug-with-break-column into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/410
2025-08-18 10:40:53 +00:00
62003d97bb revert 98af93c631
revert fix/bug-with-break-columns

update comments
2025-08-18 10:40:37 +00:00
3e0a88a487 fix/bug-with-break-columns
update comments
2025-08-18 13:36:58 +03:00
1969229659 fix/bug-with-break-columns
update comments
2025-08-18 13:31:19 +03:00
98af93c631 fix/bug-with-break-columns
update comments
2025-08-18 13:25:23 +03:00
a4ebe56f28 Fix/bug73365
fix bug with convert from docx to odt
2025-08-17 10:18:47 +03:00
247b90ce1a Merge pull request 'feature/win-arm64' (#408) from feature/win-arm64 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/408
2025-08-16 11:14:01 +00:00
aef05de075 Merge pull request 'Switch to mac framework builds' (#400) from feature/mac-frameworks into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/400
2025-08-16 11:12:57 +00:00
5b12d7fff3 Fix boost build 2025-08-14 22:23:52 +03:00
4223f9c265 Change major ver of icu 2025-08-14 18:23:18 +03:00
9e60a7e3ab Fix build for boost 2025-08-14 17:58:05 +03:00
5de9bd7e67 For bug 75790 extra underline 2025-08-14 16:49:55 +03:00
dacde4c593 fix bug #76316 2025-08-14 13:46:25 +03:00
97385c3f37 fix bug #76313 2025-08-14 11:23:35 +03:00
edd17cd7c3 Fix for win_arm64 2025-08-13 21:28:33 +03:00
e373adf717 Merge pull request 'fix/fix-bugs-9.1' (#407) from fix/fix-bugs-9.1 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/407
2025-08-13 13:48:07 +00:00
2ad1771333 fix bug with break columns
Clear comment text_elements.cpp

(cherry picked from commit e01517714c)
2025-08-13 16:46:14 +03:00
73f40edc7e Fix bug with break columns
clear all comments into code

(cherry picked from commit 3f7edeec4f)
2025-08-13 16:46:08 +03:00
182a3cea90 Fix bug with columns break
Fix bug with convert from odf to docx

(cherry picked from commit 688632c373)
2025-08-13 16:45:54 +03:00
72f0b0403e Fix for Linux 2025-08-13 16:19:47 +04:00
3d5d871911 Merge branch 'develop' into fix/bug73365 2025-08-13 14:16:58 +03:00
1fbffa673c fix/bug73365 2025-08-13 11:42:59 +03:00
06c47b07ec Remove usage of C++17 features in heif code 2025-08-13 11:38:12 +04:00
e2bcf62cc4 Fix for windows 2025-08-13 11:36:10 +04:00
f5a91c33b5 Fix line break and tab bug 2025-08-12 19:12:23 +03:00
79ab0bc04b Change gitignore files 2025-08-12 19:08:56 +03:00
242aa2c9d6 Merge pull request 'Fix bug with columns break' (#406) from fix/bug-with-break-columns into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/406
2025-08-12 12:27:57 +00:00
e01517714c fix bug with break columns
Clear comment text_elements.cpp
2025-08-12 12:24:11 +03:00
3f7edeec4f Fix bug with break columns
clear all comments into code
2025-08-12 12:16:40 +03:00
9cef29c201 Fix for unix 2025-08-11 18:52:51 +04:00
688632c373 Fix bug with columns break
Fix bug with convert from odf to docx
2025-08-11 17:03:03 +03:00
c86387c015 Merge branch 'feature/mac-frameworks' into feature/libheif 2025-08-11 16:26:32 +04:00
e8f7720387 Move libs and includes to heif.pri 2025-08-11 16:26:17 +04:00
4ea504f688 Fix bug #76165 2025-08-11 00:31:40 +03:00
c3dd5c8fc9 Add heif directory to 3dParty 2025-08-09 00:15:39 +04:00
6e1357f276 fix bug #76039
(cherry picked from commit 53d5f4517b)
2025-08-08 17:22:58 +03:00
fee71647a9 fix bug #74231
(cherry picked from commit 03e21d19f1)
2025-08-08 17:22:43 +03:00
6c516b7ce2 fix bug #74142
(cherry picked from commit cd05b830b1)
2025-08-08 17:22:32 +03:00
53d5f4517b fix bug #76039 2025-08-08 09:59:00 +03:00
03e21d19f1 fix bug #74231 2025-08-07 17:59:21 +03:00
cd05b830b1 fix bug #74142 2025-08-07 13:39:44 +03:00
bf05a63db0 Merge branch hotfix/v9.0.4 into develop 2025-08-06 08:28:20 +00:00
bc96c82ff9 Merge branch hotfix/v9.0.4 into master 2025-08-05 14:08:27 +00:00
4187522006 fix bug #70515 2025-08-05 11:27:20 +03:00
a82cf375b7 Fixed a color bug in OFD 2025-08-04 17:54:26 +03:00
81f057ba78 Merge branch 'hotfix/v9.0.4' into feature/libheif 2025-08-04 17:47:50 +04:00
c2a733f465 Fixed PageBlock positioning in OFD 2025-08-04 14:45:28 +03:00
fcd7818675 Add test for heif 2025-08-04 12:51:33 +03:00
baf8321c61 Fix bug 57586 (up version for fonts selection) 2025-08-02 21:33:34 +03:00
826bd168ad fix bug #74266 2025-08-01 15:51:04 +03:00
b1dff84b1b fix bug #74757 2025-08-01 15:32:24 +03:00
c65460e49b . 2025-08-01 15:30:40 +03:00
f5fa14a230 Merge branch 'develop' of git.onlyoffice.com:ONLYOFFICE/core into develop 2025-08-01 13:23:45 +03:00
db744e6fdc fix bug #76172 2025-08-01 13:23:19 +03:00
a15156fcb3 Merge remote-tracking branch 'origin/hotfix/v9.0.4' into develop 2025-08-01 13:13:23 +03:00
dbc54e5879 Fix typo 2025-08-01 12:33:09 +03:00
2a09e2ef67 Merge pull request 'Fix bug #76008' (#404) from fix/bug-76008 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/404
2025-07-31 19:27:02 +00:00
17534abdda Fix bug #76008 2025-07-31 22:16:41 +03:00
e4a7cf63c9 Added support for Annotations in OFD 2025-07-31 21:04:31 +03:00
0eadce28da fix bug #74757 2025-07-31 15:51:45 +03:00
29c53f751b Merge pull request 'fix bug #76186' (#402) from fix/bug76186 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/402
2025-07-31 12:17:57 +00:00
6500e65edc fix bug #76186 2025-07-31 18:13:52 +06:00
e8ecb2cdfb Fix bug 57586 2025-07-31 12:27:49 +03:00
3046b1557f Update gitignore 2025-07-31 11:25:31 +03:00
fbf4ef22d8 Fix remove MEOptions 2025-07-31 11:23:14 +03:00
9b7bb7c602 fix bug 70337 2025-07-30 16:47:18 +03:00
628908e96c Merge remote-tracking branch 'origin/fix/pdf-rtl' into develop 2025-07-30 16:40:22 +03:00
78df0b3780 Fix emscripten 2025-07-30 16:35:55 +03:00
d8c0e9b68d Merge remote-tracking branch 'origin/develop' into fix/pdf-rtl
# Conflicts:
#	DesktopEditor/graphics/commands/AnnotField.cpp
#	DesktopEditor/graphics/pro/js/wasm/js/drawingfile.js
#	DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp
#	PdfFile/PdfWriter.cpp
#	PdfFile/SrcReader/PdfAnnot.cpp
2025-07-30 16:30:59 +03:00
df8f8636b6 Fix MEOptions to 21 widget and 11 parent 2025-07-30 16:20:57 +03:00
5722599351 fix bug #76106 2025-07-30 15:09:53 +03:00
f4489a3926 for bug #76151 2025-07-29 18:08:30 +03:00
91f27bf771 fix bug #76151 2025-07-29 17:21:32 +03:00
49a743944f fix bug 75855 2025-07-29 11:27:44 +03:00
eb3daff8d6 fix bug #70652 2025-07-28 19:01:26 +03:00
6d707ebae2 Fix decode 2025-07-28 13:28:20 +03:00
bab8da0475 Change framework versions to A 2025-07-28 10:54:50 +04:00
66501ab353 Fixed a problem with text rendering in OFD 2025-07-26 18:58:32 +03:00
a865901405 Fix bug 57586 2025-07-25 11:21:08 +03:00
c1987b196e Fix Stamp InRect 2025-07-25 09:31:46 +03:00
8899966508 Add use fonts folder to builder 2025-07-24 14:50:08 +03:00
41dc23ce53 Add Release/Debug libs 2025-07-24 12:10:26 +03:00
3a555aa223 fix bug #76084 2025-07-24 09:58:08 +03:00
2168216009 Fix meta drawingfile 2025-07-23 17:16:00 +03:00
13b42d71e2 Write OMetadata for all annots 2025-07-23 17:11:35 +03:00
58cd88a93f OMetadata for all annots 2025-07-23 17:03:45 +03:00
4dc1d88bc9 Fix Java wrapper for mac frameworks 2025-07-21 19:21:51 +04:00
ef2d554265 Return AP for readAnnotationsInfoFromBinary 2025-07-21 16:08:26 +03:00
2d08404f72 ctWidgetsInfo add to readAnnotationsInfoFromBinary 2025-07-21 13:10:55 +03:00
cd6c4c56c3 . 2025-07-21 11:45:33 +03:00
96f7de8534 Add executable rights 2025-07-20 15:20:37 +03:00
dba4be73dd Add support woff2 fonts 2025-07-20 14:53:35 +03:00
f3101fd2ec fix bug #76021 2025-07-18 18:45:36 +03:00
08716fc4ce fix bug #75800 2025-07-18 16:59:16 +03:00
986125a3e6 fix bug #76005 2025-07-18 16:29:32 +03:00
b655a4e109 Merge remote-tracking branch 'origin/fix/pdf-copy-paste' into develop 2025-07-18 16:14:07 +03:00
7ce6602951 Merge remote-tracking branch 'origin/feature/pdf-redact' into fix/pdf-copy-paste 2025-07-18 16:12:09 +03:00
f45b3ba0da Fix DA in SetFont 2025-07-18 14:24:27 +03:00
5ec24525b8 Not need AP 2025-07-18 13:25:11 +03:00
0c601c1c82 Redact read font from DA 2025-07-18 12:02:20 +03:00
c7d3e5df14 Fix python wrapper 2025-07-18 12:05:57 +04:00
2351b1f052 Link statically with ICU on framework builds 2025-07-18 12:05:57 +04:00
b93ea3bb41 Add support for mac framework builds 2025-07-18 12:05:57 +04:00
697f604fc4 . 2025-07-18 10:25:34 +03:00
a817cd54d5 Fix static build 2025-07-17 20:11:46 +03:00
1fc61459b8 Fixed a numbering bug in html 2025-07-17 18:06:58 +03:00
e1b3474a06 Create Redact 2025-07-17 17:57:16 +03:00
041325b440 Merge pull request 'For bug 70337' (#397) from fix/docx-renderer into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/397
2025-07-17 12:26:02 +00:00
064a04a600 Fix bug #38609 2025-07-17 15:18:21 +03:00
df4e1445f6 fix bug #75800 2025-07-17 10:36:02 +03:00
cc6132cd77 For bug 70337
Fix shape rotation and negative position for pdf editor
2025-07-16 19:08:01 +03:00
c7a209048f Merge pull request 'feature/add-xls-writing' (#396) from feature/add-xls-writing into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/396
2025-07-16 12:27:45 +00:00
a359060684 Merge remote-tracking branch 'origin/hotfix/v9.0.4' into fix/pdf-copy-paste 2025-07-16 12:14:51 +03:00
08fafaa655 fix formula writing 2025-07-15 19:18:08 +06:00
57923e4266 Merge pull request 'Fix bug 75958' (#395) from fix/bug-75958 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/395
2025-07-15 09:32:15 +00:00
b488623e81 Fix bug 75958 2025-07-15 12:11:33 +03:00
2462074f63 Merge branch 'develop' into feature/add-xls-writing 2025-07-15 13:11:37 +06:00
5e121188d8 Merge pull request 'Fix bugs 75871, 75897' (#394) from fix/bug-75871 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/394
2025-07-15 06:49:52 +00:00
114f9a0da3 Fix build for gcc 5.4.1 2025-07-15 00:01:49 +03:00
7c4b85600d Fix sst writing 2025-07-14 19:14:56 +06:00
48e2defbcd Fix bug 75897 2025-07-14 15:55:17 +03:00
07bd804009 Merge pull request 'Refactoring the hwpx parser' (#393) from fix/HWP into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/393
2025-07-14 11:50:21 +00:00
348fc71e1c Merge pull request 'Fix bug #75723' (#392) from fix/bug-75723 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/392
2025-07-14 11:49:43 +00:00
d123b0f610 fix bug #75882 2025-07-14 14:29:50 +03:00
13e30bf918 Fix bug 75871 2025-07-14 12:54:33 +03:00
e74a96884c Fix multy sheet writing 2025-07-14 15:44:41 +06:00
c67d87b1f0 Fix split button AP 2025-07-14 12:05:54 +03:00
1e73aed4a5 Merge branch 'develop' into feature/add-xls-writing 2025-07-14 13:11:35 +06:00
63da89d846 Merge pull request 'hotfix/v9.0.4' (#391) from hotfix/v9.0.4 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/391
2025-07-12 06:44:47 +00:00
9f223deee7 fix row conversion 2025-07-11 20:55:58 +06:00
d49789ea19 Removed dbcells writing 2025-07-11 20:55:32 +06:00
738583d0d4 Fix empty document writing 2025-07-11 18:55:15 +06:00
47a1e26ff5 Fix build 2025-07-11 14:24:06 +03:00
ecca7a5cdd Add default values for xls records 2025-07-11 14:47:35 +06:00
407993cd40 fix bug #73585 2025-07-11 11:05:39 +03:00
7e5d3bb3eb fix bug #75841 2025-07-11 09:20:57 +03:00
381daebcb9 . 2025-07-10 19:21:27 +03:00
7e6d6b407c Merge pull request 'Fix metadata xlst conversion' (#390) from fix/metadata-conversion into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/390
2025-07-10 15:43:16 +00:00
5e9f0d762a Fix metadata xlst conversion 2025-07-10 21:41:22 +06:00
f5ddf8c6ce Fix build 2025-07-10 18:27:15 +03:00
4f95713790 Fix bug #75723 2025-07-10 16:15:10 +03:00
337847f606 Fixed a tab bug in hwpx 2025-07-10 13:51:56 +03:00
a84491cf74 Fix param type 2025-07-10 13:36:06 +03:00
689eaddd5b fix bug #75885 2025-07-09 21:05:46 +03:00
2cc56a9f9f fix bug #75880 2025-07-09 20:56:05 +03:00
33c6640ce0 fix bug #75754 2025-07-09 18:15:26 +03:00
e6e93549c9 Merge remote-tracking branch 'origin/hotfix/v9.0.4' into fix/HWP 2025-07-09 15:47:38 +03:00
00e5c8bd2e Fixed a bug with glued text in hwpx 2025-07-09 15:46:06 +03:00
ae063b3d41 Merge pull request 'Fix bug 75687' (#389) from fix/pre9.0.4 into hotfix/v9.0.4
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/389
2025-07-09 08:32:03 +00:00
01d6a7d090 Add message for arm64 building 2025-07-08 18:30:59 +03:00
98c998b3ee Refactoring 2025-07-08 15:07:40 +03:00
f6c8356684 Merge branch hotfix/v9.0.3 into master 2025-07-08 11:37:44 +00:00
880951a611 Refactoring 2025-07-08 14:24:44 +03:00
2895f829e3 Refactoring ZipFolder 2025-07-08 14:24:28 +03:00
671b88d8bc Add ibXF writing 2025-07-08 15:58:44 +06:00
c0ba4267d2 Fix for arm 2025-07-07 22:58:32 +03:00
29355d337b Fix encode 2025-07-07 18:01:25 +03:00
6f7a414888 Merge branch hotfix/v9.0.2 into develop 2025-07-07 14:38:42 +00:00
031fc7517b Merge pull request 'hotfix/v9.0.2' (#388) from hotfix/v9.0.2 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/388
2025-07-07 12:59:29 +00:00
a040e89ae5 Merge branch 'develop' into feature/add-xls-writing 2025-07-07 13:09:31 +06:00
e025ae2779 Refactoring 2025-07-06 22:53:38 +03:00
21ca48c6f6 Fir bug 75101 2025-07-04 23:08:11 +03:00
ec906774dd Fix bug 75101 2025-07-04 23:04:18 +03:00
e17b99554d Fix Split mode 2025-07-04 19:40:08 +03:00
09ac9f8609 add mandatory formatting writing 2025-07-04 21:25:30 +06:00
97178ae328 Merge pull request 'fix images' (#387) from fix/fix-bugs-9.0.3 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/387
2025-07-04 14:33:59 +00:00
1dc8990c9d fix images 2025-07-04 17:31:44 +03:00
f68825c6d3 Merge pull request 'For bug 75781' (#386) from fix/pdf-button into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/386
2025-07-04 12:42:28 +00:00
4770a2b22b Fix bug 75687 2025-07-04 14:27:16 +03:00
dda00c3b18 Fix get MK.RI & MK.IX 2025-07-04 14:18:04 +03:00
156578ca82 Fix base64 image 2025-07-04 14:16:48 +03:00
2ec63f2cb7 Change ChangeFullNameAnnot 2025-07-04 12:26:42 +03:00
62d2deaefb Add featHdr writing 2025-07-04 15:00:26 +06:00
fbed837a47 Fix change parrent FullName 2025-07-04 10:59:33 +03:00
0715c0c5a5 Fix merge prefix name 2025-07-04 10:53:00 +03:00
103c8dd575 Fix return errors 2025-07-03 20:45:30 +03:00
5dc5a200b8 Merge pull request 'Fix HWP bugs' (#385) from fix/HWP-bugs into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/385
2025-07-03 17:18:28 +00:00
23008b3737 Fix bug #75718 2025-07-03 19:43:13 +03:00
03f490047d Merge pull request 'fix/fix-bugs-9.0.3' (#384) from fix/fix-bugs-9.0.3 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/384
2025-07-03 16:12:58 +00:00
36454f4c6e Fix bug #75679 2025-07-03 18:52:52 +03:00
34e1dabefb fix bug #75722 2025-07-03 18:37:03 +03:00
3d39d5837f Fixed unnecessary strikethrough in hwp conversion 2025-07-03 17:58:31 +03:00
a6efd8a374 Fix bug #75673 2025-07-03 17:39:25 +03:00
3bfa3643e6 . 2025-07-03 16:36:19 +03:00
453e17ac0e Fix xls writing 2025-07-03 19:03:13 +06:00
88620dc8cd Merge pull request 'fix bug #75733' (#383) from fix/fix-bugs-9.0.3 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/383
2025-07-03 11:35:06 +00:00
cc9b00329e fix bug #75733 2025-07-03 14:17:49 +03:00
88c84ad577 Fix loading dicts for hyphenation 2025-07-02 23:06:18 +00:00
ee22e8e8b4 Merge pull request 'Fix bug 55007' (#380) from fix/bug-55007 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/380
2025-07-02 15:56:14 +00:00
1756d58c6d Merge pull request 'Fix bug 75688' (#381) from fix/bug-75688 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/381
2025-07-02 15:44:05 +00:00
ecab418202 Fix bug 75688 2025-07-02 16:51:09 +03:00
d3430ace10 Add worksheet filepos writing 2025-07-02 18:08:15 +06:00
10a6f6e617 fix bug #75568 2025-07-02 14:04:02 +03:00
8c6a26895b Add read from memory 2025-07-02 13:22:30 +03:00
5142536e17 Add worksheet pos collecting 2025-07-01 21:47:46 +06:00
fd05f3b16d fix bug #75551 2025-07-01 17:18:46 +03:00
e0840e73d2 . 2025-07-01 17:00:40 +03:00
ae2918ec71 fix ShortXLUnicodeString writing 2025-07-01 18:36:07 +06:00
17369e8bee fix bug #75568 2025-07-01 12:30:41 +03:00
3047a9fb47 Fix bug 55007 2025-07-01 12:19:18 +03:00
1495581b00 Merge remote-tracking branch 'origin/fix/pdf-copy-ap' into develop 2025-07-01 11:42:38 +03:00
6c2fce16a8 Merge remote-tracking branch 'origin/develop' into fix/pdf-copy-ap 2025-07-01 11:41:07 +03:00
58be006bb9 fix bug #75635 2025-07-01 11:37:15 +03:00
6c2a8205ec Fix m_bSplit 2025-07-01 11:07:39 +03:00
29cee43448 Add split mode for PdfWriter 2025-07-01 10:46:38 +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
8b4fe95291 Merge pull request 'Fix bugs 75101, 75574' (#379) from fix/bug-75101 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/379
2025-06-30 11:03:08 +00:00
c25f8cc204 Fix heif image convert 2025-06-30 13:51:05 +03:00
010d1ce4c9 PDF Write TU for parent field 2025-06-30 13:48:39 +03:00
6ac9349ccb Fix bug 75574 2025-06-30 13:33:19 +03:00
c3bf7ad49b Fix bug 75101 2025-06-30 11:13:56 +03:00
b5d56d1d6d Fix build 2025-06-29 11:27:02 +03:00
d3aae6dfcb Add heif decode and encode 2025-06-29 10:08:51 +03:00
fb07c0c468 Add xls_writer 2025-06-27 21:10:21 +06:00
327d00bacf Merge branch 'develop' into feature/add-xls-writing 2025-06-27 14:30:49 +06:00
fe0d95009c Merge pull request 'fix bug #69371' (#378) from fix/bug69371 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/378
2025-06-26 14:29:06 +00:00
bcc5f67ec8 Merge branch hotfix/v9.0.2 into master 2025-06-26 12:55:22 +00:00
9200c29d42 Merge branch 'develop' into feature/add-xls-writing 2025-06-26 17:03:58 +06:00
c13027c9d1 fix bug #69371 2025-06-26 16:43:29 +06:00
6acb9855a1 For bug 74201 2025-06-26 12:48:51 +03:00
1619e421f2 . 2025-06-25 18:20:20 +03:00
2b1e5faef9 Added tabulation support in HWP 2025-06-25 17:38:26 +03:00
ea214f942f Add dbQueryExt writin 2025-06-25 15:41:22 +06:00
ccbff8d8da Merge branch 'develop' into feature/add-xls-writing 2025-06-25 14:15:44 +06:00
1cd72ab988 Fix for 64 bit 2025-06-24 22:26:46 +03:00
63937e706e Merge remote-tracking branch 'origin/hotfix/v9.0.3' into develop 2025-06-24 19:23:51 +03:00
54a903d2e7 fix bug #74484 2025-06-24 18:56:47 +03:00
e48fab418d Merge pull request 'For bug 71235' (#377) from fix/bug-71235 into hotfix/v9.0.3
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/377
2025-06-24 14:41:58 +00:00
537304ad24 add querytable writing 2025-06-24 19:14:23 +06:00
fa9e3cb48e For bug 71235 2025-06-24 12:34:05 +03:00
d362999e2a Add custom sysroot in base.pri 2025-06-24 10:47:06 +03:00
6e73b593ba fix bug #75443 2025-06-24 09:59:21 +03:00
46fbf81b4d [x2t] Fix typo 2025-06-23 19:36:13 +03:00
519a93ecaf Merge pull request '[x2t] Add oformAsPdf to params.xml to override checker format' (#376) from fix/oformAsPdf2 into hotfix/v9.0.2
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/376
2025-06-23 16:15:07 +00:00
90ded6788f [x2t] Add oformAsPdf to params.xml to override checker format 2025-06-23 19:01:04 +03:00
1f4a420d35 Add dcon writing 2025-06-23 20:39:43 +06:00
087146ce77 Merge pull request 'fix bugs' (#373) from fix/OOXml2Odt into hotfix/v9.0.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/373
2025-06-23 13:27:05 +00:00
b4ac2a9515 Merge pull request 'for bug #75064' (#374) from for/bug75064 into fix/OOXml2Odt
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/374
2025-06-23 13:23:15 +00:00
d11e0492f2 Add bookExt writing 2025-06-23 17:09:12 +06:00
4b3c4242f6 Add theme writing 2025-06-23 15:33:42 +06:00
482a821974 fix text in controls xlsx 2025-06-21 16:42:56 +03:00
2e1538b3dc Merge branch 'fix/pre9.0.1' into hotfix/v9.0.1 2025-06-21 10:20:55 +03:00
48ec45c1dd Add metadata writing 2025-06-20 20:59:37 +06:00
809ed63ca0 for bug #75064 2025-06-20 17:10:17 +03:00
91badde27d Add mdblock writing 2025-06-20 18:26:22 +06:00
618b1a9ca8 Add MDTInfo writing 2025-06-20 15:35:28 +06:00
95d523370d Merge pull request 'Fix bug 71235' (#372) from fix/bug-71235 into fix/pre9.0.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/372
2025-06-20 09:27:56 +00:00
a2768af989 Fix DW 2025-06-20 11:44:36 +03:00
85e8d253a9 Add userBview writing 2025-06-20 14:34:10 +06:00
d4e623f277 Fix WritePrivateDictionary 2025-06-20 11:07:57 +03:00
827dc4c1b9 Merge branch 'develop' into feature/add-xls-writing 2025-06-19 20:52:27 +06:00
5d033bef69 fix bugs 2025-06-19 17:07:15 +03:00
18e22f0f05 Add autofilter12 writing 2025-06-19 19:56:05 +06:00
426cd08d57 Refactoring 2025-06-19 16:18:03 +03:00
d1a64d29c0 Fix WriteCharsets
In this case, the SID is our assigned ushCode glyph on the entry in the page content stream
2025-06-19 15:28:59 +03:00
b8053ae388 Merge remote-tracking branch 'origin/fix/pre9.0.1' into develop 2025-06-19 13:44:30 +03:00
c56cfaf71f Add dfttext writing 2025-06-19 15:12:24 +06:00
2680fd7073 Merge branch 'fix/fix-bugs-9.0' into fix/pre9.0.1 2025-06-19 12:12:23 +03:00
cfdeca436b fix bug #75232 2025-06-19 12:06:36 +03:00
db3769eb13 WritePrivateDictionary 2025-06-18 16:42:10 +03:00
e5fcbcf5f3 Add dropbar writing 2025-06-18 19:26:48 +06:00
6d4ff364b3 nsid 2025-06-18 14:57:25 +03:00
8a9277d1d8 Add MEOptions 2025-06-18 13:49:50 +03:00
f3d3755a31 Add axm writing 2025-06-18 16:44:17 +06:00
ffab501ce9 Add seriesformat writing 2025-06-18 15:25:05 +06:00
74b21f5b4c Merge branch release/v9.0.0 into master 2025-06-18 09:23:26 +00:00
3e9d3bed35 Merge pull request 'fix/fix-bugs-9.0' (#370) from fix/fix-bugs-9.0 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/370
2025-06-17 15:35:44 +00:00
8ddb6e7f05 for bug #75064 2025-06-17 18:33:18 +03:00
db9fd85f22 Add dataformat writing 2025-06-17 21:21:29 +06:00
e54e8d7a8a fix bug #74263 2025-06-17 16:38:32 +03:00
8e0e1203c6 Complete CharStringType2Interpreter 2025-06-17 15:38:40 +03:00
9a74609366 Add axes writing 2025-06-17 16:52:32 +06:00
d9f24ca635 Merge pull request 'Fix bug 73392' (#369) from fix/bug-73392 into fix/pre9.0.1
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/369
2025-06-17 09:33:50 +00:00
ebddab233c Fix bug 73392 2025-06-17 12:25:00 +03:00
0bdd7f098d for bug #75177 2025-06-17 11:58:13 +03:00
efadc23a50 Create CharStringType2Interpreter 2025-06-17 11:06:09 +03:00
36db67cba3 Fix bug 74031 2025-06-17 02:33:31 +03:00
c9e5320ea3 Merge pull request 'For bug 75249' (#368) from fix/pdf-bugs into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/368
2025-06-16 16:57:49 +00:00
58f12dbbee For bug 75249 2025-06-16 19:47:39 +03:00
1656d0dd6d Merge pull request 'fix/fix-bugs-9.0' (#367) from fix/fix-bugs-9.0 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/367
2025-06-16 15:02:01 +00:00
39090a2423 fix bug #74447 2025-06-16 17:56:49 +03:00
8241d85596 fix bug #70421 2025-06-16 16:52:57 +03:00
8ebc312dc7 Merge pull request 'Fix bug 75259' (#366) from fix/bug-75259 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/366
2025-06-16 13:30:21 +00:00
aaf744353f Add dat writing 2025-06-16 19:29:39 +06:00
4cff6dfe57 Fix bug 75259 2025-06-16 16:21:29 +03:00
15ee6ecf91 Merge remote-tracking branch 'origin/release/v9.0.0' into fix/bug-71235 2025-06-16 14:46:06 +03:00
67a5b7f087 Add frame writing 2025-06-16 17:04:24 +06:00
c6e2ad0fef Merge pull request 'Fix bugs 75158, 66505' (#365) from fix/bug-75158 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/365
2025-06-16 10:57:32 +00:00
5b9141ce1d Fix bug 66505
In pdf, child field actions become parent - this applies to date format, text field format and placeholder
2025-06-16 13:48:36 +03:00
502312fe20 Fix bug 75158 2025-06-16 12:55:01 +03:00
a10b8ee6fb Merge pull request 'Fix bug 74554' (#364) from fix/bug-74554 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/364
2025-06-16 09:21:27 +00:00
7c6cd1107d Fix bug 74554 2025-06-16 12:08:45 +03:00
05be4876e8 Fix build 2025-06-13 15:30:29 +03:00
d9806dfbc8 Merge pull request 'Fix HWP/HWPX bugs' (#363) from fix/hwp into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/363
2025-06-13 06:13:46 +00:00
00e9d050ae Fixed a bug in reading HWP 2025-06-13 01:53:41 +03:00
405a2c1f59 Fix bug in HWP/HWPX with breaks 2025-06-13 01:05:20 +03:00
d287fc016e Fix bug #73665 2025-06-13 01:04:32 +03:00
383a616c97 For bug #73683 2025-06-12 23:28:06 +03:00
4e272d8ecf Refactoring 2025-06-12 21:44:21 +03:00
f6900b5d11 Fixed a bug in reading HWP 2025-06-12 21:43:58 +03:00
0a7a3c3a99 Fix bug 73477 2025-06-12 21:07:47 +03:00
556ea0dce4 Merge pull request 'fix/fix-bugs-9.0' (#362) from fix/fix-bugs-9.0 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/362
2025-06-12 13:13:54 +00:00
62dde72acc shape props for controls xlsx in binary 2025-06-12 16:09:30 +03:00
5e45f5fb09 fix bug #75177 2025-06-12 09:53:51 +03:00
750b28d866 Add Attachedlabel writing 2025-06-11 20:51:44 +06:00
33b246b9da Fix bug 75176 2025-06-11 17:26:12 +03:00
6c8e053bb2 Fix bug #73728 2025-06-11 14:48:32 +03:00
db7ebc5765 Add ld writing 2025-06-11 17:44:00 +06:00
84462ab1da Merge pull request 'Fix bug 75102' (#361) from fix/bug-75102 into release/v9.0.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/361
2025-06-11 11:08:25 +00:00
7cb08f3a87 Fix bug #75154 2025-06-11 13:54:25 +03:00
16b28e60a4 Fix remove name of Fields 2025-06-11 13:52:00 +03:00
8ac1c4d158 Add series list writing 2025-06-11 16:39:25 +06:00
5f78402f2a Fix bug 75102 2025-06-11 13:01:50 +03:00
fa80e4913f Create CharStringType2Flattener 2025-06-11 11:46:26 +03:00
18f92b56ba Merge branch 'develop' into feature/add-xls-writing 2025-06-10 18:13:13 +06:00
b04f9bda4a For bug #73716 2025-06-10 14:11:39 +03:00
d69d71ec07 Create CPrimitiveWriter 2025-06-10 11:42:30 +03:00
599566c5e2 Create CCFFWriter 2025-06-06 17:15:37 +03:00
e7b231feed Fix type overflow 2025-06-06 14:49:08 +03:00
a006479964 Fix CStream::ReadOffset 2025-06-06 11:29:46 +03:00
646bbd405f For CCFFReader 2025-06-05 17:53:19 +03:00
e20231dc88 For CCFFReader 2025-06-05 16:21:18 +03:00
575e45a0b2 Complete COpenTypeReader, Create CCFFReader 2025-06-05 14:45:04 +03:00
3d9045e0d4 Read Head, MaxP, HHea, HMtx 2025-06-04 18:55:02 +03:00
02a845d451 Merge remote-tracking branch 'origin/release/v9.0.0' into fix/bug-71235
# Conflicts:
#	DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp
2025-06-04 13:25:38 +03:00
03463ee0e4 Merge remote-tracking branch 'origin/release/v9.0.0' into develop 2025-05-29 12:34:25 +03:00
942480d895 Create COpenTypeReader 2025-05-22 13:01:48 +03:00
931b66e038 Create FontCFFWriter 2025-05-21 18:15:25 +03:00
d50ee7467e Add crt chart types writing 2025-05-21 19:40:59 +06:00
f51fb711b4 Fix Strings count & PrivateDictStart 2025-05-20 17:58:50 +03:00
d15ac8b84f Add axis parent writing 2025-05-20 20:06:59 +06:00
00176a0425 Add chartformats wriging 2025-05-20 19:23:50 +06:00
14f0a757ac Add series data writing 2025-05-20 17:30:22 +06:00
49bd1657ab Merge remote-tracking branch 'origin/release/v9.0.0' into fix/bug-71235 2025-05-20 13:34:22 +03:00
9b24261b2b Add sxviewlink wriging 2025-05-19 18:04:46 +06:00
211f151346 Add chartSheet writing 2025-05-19 14:58:19 +06:00
6c8cbec6ba Add worbook stream writing 2025-05-16 21:04:58 +06:00
755a357e3d Add sheetExt writing 2025-05-16 17:55:57 +06:00
2a7256eb48 Add customview binary writing 2025-05-16 17:17:47 +06:00
0e8c37c293 Add supbook writing 2025-05-14 21:16:18 +06:00
bf00185275 Add SXSRC binary writing 2025-05-07 21:24:14 +06:00
6ed57dae6c Add pivot cache definition writing 2025-05-07 16:33:41 +06:00
eb472e27b4 add PIVOTEX writing 2025-04-28 18:40:36 +06:00
51aed7ae53 Add PIVOTIVD- PIVOTLI writing 2025-04-28 15:47:20 +06:00
ecf59a75a7 Add pivotView writing 2025-04-25 18:57:23 +06:00
9039ff53db Add fngroups writing 2025-04-25 14:52:32 +06:00
b53b2859de Add lblWriting 2025-04-24 20:58:14 +06:00
fe1372882e Add Hfpicture writing 2025-04-24 19:38:47 +06:00
34e0b7e69a Add record12 writing 2025-04-24 18:22:50 +06:00
856ae09f69 Add sortdatafilter writing 2025-04-23 21:04:59 +06:00
28f2e14bce Add autofilter binary writing 2025-04-23 18:49:34 +06:00
b8d9ba3b1d Add dcon writing 2025-04-23 16:08:28 +06:00
5fe6dd8730 Add extsst binary writing 2025-04-22 20:13:40 +06:00
ab573cf9ba Merge branch 'develop' into feature/add-xls-writing 2025-04-22 14:57:43 +06:00
92902724a0 Add SharedStringsWriting 2025-04-21 20:01:53 +06:00
7e116dbd41 Add bundlesheet writing 2025-04-21 15:06:55 +06:00
c964ed7d58 Merge branch hotfix/v8.3.3 into develop 2025-04-21 09:03:54 +00:00
88db7ec840 Merge branch hotfix/v8.3.3 into master 2025-04-21 09:03:52 +00:00
b456a094ee Add xfext writing 2025-04-21 14:24:55 +06:00
a19dc86ea9 Add tablestyles writing 2025-04-18 19:50:05 +06:00
62ba3fa029 Add formatting binary writing 2025-04-18 19:02:23 +06:00
58c2fa783e Add xf binary writing 2025-04-18 17:47:05 +06:00
678101f7e4 Add window1 binary writing 2025-04-17 20:54:48 +06:00
17fb69ee8a Add protection writing to global substream 2025-04-17 18:13:45 +06:00
0833c97c99 add globals substream writing 2025-04-16 20:18:43 +06:00
5d64c7c6e7 Add note records writing 2025-04-16 19:39:06 +06:00
0f3ef78362 Add protection binary writing 2025-04-16 15:45:22 +06:00
fa65a546da Merge branch hotfix/v8.3.3 into master 2025-04-16 07:32:32 +00:00
1a54c8f8b9 Merge branch 'develop' into feature/add-xls-writing 2025-04-15 13:05:01 +06:00
6d6f87cae6 Add worksheet substream wrting 2025-04-07 19:41:34 +06:00
3d9a783d46 fix globals writing 2025-04-07 18:31:40 +06: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
8c16766e9f Merge branch 'develop' into feature/add-xls-writing 2025-04-07 13:14:58 +06:00
c8ca725523 Add hlink writing 2025-04-04 17:53:24 +06: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
25fa05b701 add condfmts union writing 2025-04-03 20:17:58 +06:00
6f66b0c533 Add condfmt12 writing 2025-04-03 19:59:03 +06:00
bf89efd471 Add cf12 writing 2025-04-02 22:00:58 +06:00
8f14a0f30b Fix cf writing 2025-04-02 20:26:21 +06:00
494b7b52cb Add dxfn12 writing 2025-04-02 17:54:32 +06:00
e5d6f5df47 Add dxfn struct writing 2025-04-02 16:41:21 +06:00
6f1ffaad40 Merge branch 'develop' into feature/add-xls-writing 2025-04-02 15:17:33 +06:00
e76398db01 Add cond fmt records writing 2025-04-01 21:08:05 +06:00
cafdb1d2a5 Merge branch hotfix/v8.3.2 into develop 2025-04-01 08:34:19 +00:00
06bfb07f0d Merge branch hotfix/v8.3.2 into master 2025-04-01 08:34:17 +00:00
421f5bb0f2 Add window binary writing 2025-03-31 15:43:12 +06:00
61640a9a06 Add celltable writing 2025-03-28 19:13:13 +06:00
87f0835010 Add formula writing 2025-03-28 17:00:25 +06:00
eb71d95944 Merge branch 'develop' into feature/add-xls-writing 2025-03-27 16:30:56 +06:00
1d27cc61f4 Add simple cells writing 2025-03-26 16:24:26 +06:00
f535cef848 Add dimensions writing 2025-03-25 20:20:00 +06:00
7ad49a5650 Add headerFooter & columns writing 2025-03-25 18:14:24 +06:00
3ad2fff67b Add page setup binary writing 2025-03-25 15:53:51 +06:00
66b56360da Add BOF writing 2025-03-25 14:47:44 +06:00
e8f88ab20d Add globals xls writing 2025-03-24 18:42:03 +06:00
7857106d76 Fix bug #73585 2025-03-21 13:43:19 +05:00
64c74192c7 FIx bug #73451 2025-03-20 16:09:36 +05:00
ec01f4a77e Create String Index 2025-02-06 11:16:49 +03:00
6791799fcb Write Top DICT 2025-01-30 17:14:45 +03:00
a03e397234 Read/Write Top DICT 2025-01-29 18:38:44 +03:00
dcf8f0fb01 Header and Name Index 2025-01-24 17:51:50 +03:00
d04146db5b Create CIDFontType0C 2025-01-23 17:51:48 +03:00
1242 changed files with 23020 additions and 6976 deletions

1
Common/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
**/module.version

View File

@ -26,14 +26,21 @@ bundle_xcframeworks {
}
}
core_win_arm64 {
DEFINES += MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0
}
core_windows {
VS_VERSION=140
VS_DEBUG=
VS_ARCH=x64
core_debug:VS_DEBUG=gd-
core_win_32:VS_ARCH=x32
core_win_arm64:VS_ARCH=a64
vs2019:VS_VERSION=142
DEFINES += BOOST_USE_WINDOWS_H BOOST_WINAPI_NO_REDECLARATIONS
BOOST_POSTFIX = -vc$${VS_VERSION}-mt-$${VS_DEBUG}$${VS_ARCH}-1_72
core_boost_libs:LIBS += -L$$CORE_BOOST_LIBS -llibboost_system$$BOOST_POSTFIX -llibboost_filesystem$$BOOST_POSTFIX

2
Common/3dParty/brotli/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
brotli/
module.version

View File

@ -0,0 +1,9 @@
SRC_DIR = $$PWD/brotli/c
DEFINES += FT_CONFIG_OPTION_USE_BROTLI
INCLUDEPATH += \
$$SRC_DIR/include
SOURCES += $$files($$SRC_DIR/common/*.c)
SOURCES += $$files($$SRC_DIR/dec/*.c)
#SOURCES += $$files($$SRC_DIR/enc/*.c)

20
Common/3dParty/brotli/make.py Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
import sys
import os
sys.path.append("../../../../build_tools/scripts")
import base
def clear_module():
if base.is_dir("brotli"):
base.delete_dir_with_access_error("brotli")
return
base.check_module_version("1", clear_module)
# fetch harfbuzz
if not base.is_dir("brotli"):
base.cmd("git", ["clone", "https://github.com/google/brotli.git"])
os.chdir("brotli")
base.cmd("git", ["checkout", "a47d7475063eb223c87632eed806c0070e70da29"])
os.chdir("../")

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

@ -0,0 +1,4 @@
x265_git
libde265
libheif
ios-cmake

View File

@ -0,0 +1,42 @@
DEFINES += LIBHEIF_STATIC_BUILD
HEIF_BUILDS_PLATFORM_PREFIX = $$CORE_BUILDS_PLATFORM_PREFIX
core_ios : xcframework_platform_ios_simulator {
HEIF_BUILDS_PLATFORM_PREFIX = ios_simulator
}
HEIF_BUILD_PATH = $$PWD/libheif/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX
INCLUDEPATH += \
$$PWD/libheif/libheif/api \
$$HEIF_BUILD_PATH # for heif_version.h
core_windows {
core_debug {
BUILD_TYPE = Debug
} else {
BUILD_TYPE = Release
}
LIBS += \
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/$$BUILD_TYPE -lx265-static \
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265/$$BUILD_TYPE -llibde265 \
-L$$HEIF_BUILD_PATH/libheif/$$BUILD_TYPE -lheif
}
core_linux | core_android {
# we need to wrap x265 and de265 libraries in `whole-archive` flags to avoid "undefined symbol" errors when later linking with graphics.so
LIBS += \
-Wl,--whole-archive \
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX -lx265 \
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265 -lde265 \
-Wl,--no-whole-archive \
-L$$HEIF_BUILD_PATH/libheif -lheif
}
core_mac | core_ios {
LIBS += \
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX -lx265 \
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265 -lde265 \
-L$$HEIF_BUILD_PATH/libheif -lheif
}

View File

@ -493,7 +493,7 @@ namespace NSCSS
if (L"#text" == arSelectors.back().m_wsName)
{
if (arSelectors.size() > 1)
if (arSelectors.size() > 1 && arSelectors.back().m_pCompiledStyle->Empty())
*arSelectors.back().m_pCompiledStyle += *(arSelectors.end() - 2)->m_pCompiledStyle;
if(arSelectors.crend() != std::find_if(arSelectors.crbegin(), arSelectors.crend(),

View File

@ -15,6 +15,10 @@
#include "../../../UnicodeConverter/UnicodeConverter.h"
#include "../../../HtmlFile2/src/StringFinder.h"
#if defined(CreateDirectory)
#undef CreateDirectory
#endif
static std::string nonbreaking_inline = "|a|abbr|acronym|b|bdo|big|cite|code|dfn|em|font|i|img|kbd|nobr|s|small|span|strike|strong|sub|sup|tt|";
static std::string empty_tags = "|area|base|basefont|bgsound|br|command|col|embed|event-source|frame|hr|image|img|input|keygen|link|menuitem|meta|param|source|spacer|track|wbr|";
static std::string preserve_whitespace = "|pre|textarea|script|style|";
@ -68,7 +72,7 @@ static std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert)
{
if (bNeedConvert)
{ // Определение кодировки
std::string sEncoding = NSStringFinder::FindProperty(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\""}).m_sValue;
std::string sEncoding = NSStringFinder::FindProperty(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\"", "'"}).m_sValue;
if (sEncoding.empty())
sEncoding = NSStringFinder::FindProperty(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;

View File

@ -1,4 +1,4 @@
ICU_MAJOR_VER = 58
ICU_MAJOR_VER = 74
core_windows {
exists($$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu) {
@ -20,8 +20,15 @@ core_linux {
core_mac {
INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/include
LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicuuc.$${ICU_MAJOR_VER}.dylib
LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicudata.$${ICU_MAJOR_VER}.dylib
ICU_LIBS_PATH_MAC = $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build
bundle_dylibs {
LIBS += $$ICU_LIBS_PATH_MAC/libicudata.a
LIBS += $$ICU_LIBS_PATH_MAC/libicui18n.a
LIBS += $$ICU_LIBS_PATH_MAC/libicuuc.a
} else {
LIBS += $$ICU_LIBS_PATH_MAC/libicuuc.$${ICU_MAJOR_VER}.dylib
LIBS += $$ICU_LIBS_PATH_MAC/libicudata.$${ICU_MAJOR_VER}.dylib
}
}
core_ios {

View File

@ -1,7 +1,5 @@
#!/bin/bash
ICU_VERSION="58"
ICU_DIR="$PWD/icu"
ICU_SOURCE="${ICU_DIR}/source"
@ -47,8 +45,6 @@ defines_utypes=(
function prebuild() {
svn export http://source.icu-project.org/repos/icu/tags/release-${ICU_VERSION}/icu4c/ ${ICU_DIR} --native-eol LF
echo "===== REMOVING data from bundle ====="
#Data bundle reduction

View File

@ -34,6 +34,8 @@
#include "../../../../DesktopEditor/common/StringExt.h"
#include <wininet.h>
#include <objbase.h>
#include <urlmon.h>
#pragma comment(lib, "Wininet")
#pragma comment(lib, "Ole32.lib")

View File

@ -240,7 +240,7 @@ bool COfficeFileFormatChecker::isPdfFormatFile(unsigned char *pBuffer, int dwByt
documentID.clear();
if (dwBytes < 1)
if (dwBytes < 5 || (pBuffer[0] == 'P' && pBuffer[1] == 'K'))
return false;
pBuffer[dwBytes - 1] = '\0';

View File

@ -47,7 +47,7 @@ win32 {
DEFINES += COPYRIGHT_YEAR=$${CURRENT_YEAR}
QMAKE_TARGET_COMPANY = $$PUBLISHER_NAME
QMAKE_TARGET_COPYRIGHT = Copyright (C) $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved
QMAKE_TARGET_COPYRIGHT = © $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved.
# CONFIGURATION
CONFIG(debug, debug|release) {
@ -91,6 +91,10 @@ isEqual(QT_MAJOR_VERSION, 5) {
greaterThan(QT_MAJOR_VERSION, 5) {
DEFINES += QT_VERSION_6
core_windows {
QMAKE_CXXFLAGS += /permissive-
}
}
ios {
@ -108,6 +112,10 @@ win32:contains(QMAKE_TARGET.arch, x86_64): {
win32:!contains(QMAKE_TARGET.arch, x86_64): {
CONFIG += core_win_32
}
win32:contains(QMAKE_TARGET.arch, arm64): {
CONFIG -= core_win_32
CONFIG += core_win_arm64
}
linux-clang-libc++ {
CONFIG += core_linux
@ -190,6 +198,8 @@ core_windows {
DEFINES += WIN32 _WIN32
DEFINES += NOMINMAX
#DEFINES += WIN32_LEAN_AND_MEAN
# use default _ITERATOR_DEBUG_LEVEL value
#core_debug:DEFINES += "_ITERATOR_DEBUG_LEVEL=0"
}
@ -199,6 +209,25 @@ core_win_64 {
core_linux {
DEFINES += LINUX _LINUX
QMAKE_CUSTOM_SYSROOT = $$(QMAKE_CUSTOM_SYSROOT)
QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT)/usr/bin/
core_linux_64 {
!linux_arm64 { # x86_64
QMAKE_CUSTOM_SYSROOT_LIB = $$(QMAKE_CUSTOM_SYSROOT)/usr/lib/x86_64-linux-gnu
!isEmpty(QMAKE_CUSTOM_SYSROOT) {
message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT")
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc")
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
QMAKE_CXXFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
QMAKE_LFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
}
}
}
}
core_linux_host_arm64 {
message("build on arm64")
@ -211,7 +240,11 @@ core_mac {
QMAKE_LFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
# xcode15 add new linker
QMAKE_LFLAGS += -Wl,-ld_classic
greaterThan(QMAKE_XCODE_VERSION, 1499) {
QMAKE_LFLAGS += -Wl,-ld_classic
} else {
CONFIG += c++14
}
QMAKE_CFLAGS += "-Wno-implicit-function-declaration"
@ -228,8 +261,8 @@ core_linux_clang {
# PREFIXES
core_windows {
CONFIG -= debug_and_release debug_and_release_target
QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
QMAKE_CXXFLAGS -= -Zc:strictStrings
QMAKE_CXXFLAGS_RELEASE += /Zc:strictStrings-
QMAKE_CXXFLAGS += /Zc:strictStrings-
QMAKE_CXXFLAGS += /MP
MSVC_VERSION_DETECT = $$(VisualStudioVersion)
@ -285,6 +318,9 @@ core_win_32 {
core_win_64 {
CORE_BUILDS_PLATFORM_PREFIX = win_64
}
core_win_arm64 {
CORE_BUILDS_PLATFORM_PREFIX = win_arm64
}
core_linux_32 {
CORE_BUILDS_PLATFORM_PREFIX = linux_32
}
@ -311,8 +347,8 @@ linux_arm64 {
!isEmpty(ARM64_TOOLCHAIN_BIN){
!isEmpty(ARM64_TOOLCHAIN_BIN_PREFIX){
ARM64_TOOLCHAIN_BIN_FULL = $$ARM64_TOOLCHAIN_BIN/$$ARM64_TOOLCHAIN_BIN_PREFIX
message("using arm64 toolchain $$ARM64_TOOLCHAIN_BIN")
QMAKE_CC = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "gcc")
QMAKE_CXX = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
@ -572,42 +608,45 @@ core_windows {
DEFINES += CRYPTOPP_DISABLE_ASM
}
core_ios:CONFIG+=support_bundle_dylibs
core_ios|core_mac {
CONFIG += support_bundle_dylibs
}
!support_bundle_dylibs:CONFIG-=bundle_dylibs
core_ios {
bundle_dylibs {
plugin {
CONFIG -= plugin
CONFIG += lib_bundle
bundle_dylibs {
plugin {
CONFIG -= plugin
CONFIG += lib_bundle
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @executable_path/Frameworks
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @loader_path/Frameworks
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @executable_path/Frameworks
#QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @loader_path/Frameworks
# correct version to < 256
VERSIONS = $$split(VERSION, ".")
VERSION_1 = $$member(VERSIONS, 0)
VERSION_2 = $$member(VERSIONS, 1)
VERSION_3 = $$member(VERSIONS, 2)
VERSION_4 = $$member(VERSIONS, 3)
# correct version to < 256
VERSIONS = $$split(VERSION, ".")
VERSION_1 = $$member(VERSIONS, 0)
VERSION_2 = $$member(VERSIONS, 1)
VERSION_3 = $$member(VERSIONS, 2)
VERSION_4 = $$member(VERSIONS, 3)
greaterThan(VERSION_1, 255): VERSION_1 = 255
greaterThan(VERSION_2, 255): VERSION_2 = 255
greaterThan(VERSION_3, 255): VERSION_3 = 255
greaterThan(VERSION_4, 255): VERSION_4 = 255
greaterThan(VERSION_1, 255): VERSION_1 = 255
greaterThan(VERSION_2, 255): VERSION_2 = 255
greaterThan(VERSION_3, 255): VERSION_3 = 255
greaterThan(VERSION_4, 255): VERSION_4 = 255
VERSION_CORRECT = $$VERSION_1
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_2)
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_3)
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_4)
VERSION_CORRECT = $$VERSION_1
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_2)
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_3)
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".")
VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_4)
VERSION = $$VERSION_CORRECT
}
VERSION = $$VERSION_CORRECT
MAJOR_VERSION = $$VERSION_1
# set framework version as A
QMAKE_FRAMEWORK_VERSION = A
}
}

View File

@ -1 +1,2 @@
emsdk
__pycache__

View File

@ -96,6 +96,7 @@ SOURCES += ./../DesktopEditor/common/ProcessEnv.cpp
core_windows {
LIBS += -lRpcrt4
LIBS += -lShell32
!build_xp:LIBS += -lole32
}
core_ios {

View File

@ -506,7 +506,7 @@ namespace NSDirectory
rmdir((char*)pUtf8);
delete [] pUtf8;
if (deleteRoot = false)CreateDirectory(strDirectory);
if (deleteRoot == false)CreateDirectory(strDirectory);
#elif MAC
BYTE* pUtf8 = NULL;
LONG lLen = 0;
@ -514,7 +514,7 @@ namespace NSDirectory
rmdir((char*)pUtf8);
delete [] pUtf8;
if (deleteRoot = false)CreateDirectory(strDirectory);
if (deleteRoot == false)CreateDirectory(strDirectory);
#endif
}
std::wstring GetFolderPath(const std::wstring& wsFolderPath)

View File

@ -1868,7 +1868,7 @@ namespace NSFile
namespace NSFile
{
bool CBase64Converter::Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags)
bool CBase64Converter::Encode(const BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags)
{
if (!pDataSrc || nLenSrc < 1)
return false;

View File

@ -212,7 +212,7 @@ namespace NSFile
class KERNEL_DECL CBase64Converter
{
public:
static bool Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags = NSBase64::B64_BASE64_FLAG_NONE);
static bool Encode(const BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags = NSBase64::B64_BASE64_FLAG_NONE);
static bool Decode(const char* pDataSrc, int nLenSrc, BYTE*& pDataDst, int& nLenDst);
};

View File

@ -46,6 +46,7 @@ namespace NSProcessEnv
static const char* gc_proxy = "proxy";
static const char* gc_proxyUser = "proxyUser";
static const char* gc_proxyHeader = "proxyHeader";
static const char* gc_oformAsPdf = "oformAsPdf";
}
// serialize

View File

@ -29,9 +29,9 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <stdlib.h>
#include "SystemUtils.h"
#include "Directory.h"
#include <stdlib.h>
#ifdef _WIN32
#include "ShlObj.h"
@ -41,15 +41,74 @@
#ifdef CreateFile
#undef CreateFile
#endif
#ifdef GetSystemDirectory
#undef GetSystemDirectory
#endif
#endif
#if defined(_MAC) && !defined(_IOS)
#include <pwd.h>
#include <unistd.h>
#if 0
#include <CoreFoundation/CoreFoundation.h>
std::wstring getDirectoryPathMac(const NSSystemUtils::SystemDirectoryType& type)
{
// Определяем тип директории
CFSearchPathDirectory searchPath = kCFDocumentDirectory;
switch (type) {
case 1:
searchPath = kCFDownloadsDirectory;
break;
case 2:
searchPath = kCFDesktopDirectory;
break;
default:
break;
}
// Получаем массив путей
CFArrayRef pathsArray = CFCopySearchPathForDirectoriesInDomains(searchPath, kCFUserDomainMask, true);
std::wstring result = L"";
if (pathsArray && CFArrayGetCount(pathsArray) > 0)
{
CFStringRef pathString = (CFStringRef)CFArrayGetValueAtIndex(pathsArray, 0);
if (pathString)
{
CFIndex length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(pathString), kCFStringEncodingUTF8) + 1;
char* buffer = new char[length];
if (CFStringGetCString(pathString, buffer, length, kCFStringEncodingUTF8))
{
std::string resultA = std::string(buffer);
result = UTF8_TO_U(resultA);
}
delete[] buffer;
}
}
if (pathsArray)
CFRelease(pathsArray);
return result;
}
#endif
#endif
#if defined(_LINUX) && !defined(_MAC) && !defined(__ANDROID__)
#include <pwd.h>
#include <unistd.h>
#endif
namespace NSSystemUtils
{
std::string GetEnvVariableA(const std::wstring& strName)
{
std::wstring sTmp = GetEnvVariable(strName);
return U_TO_UTF8(sTmp);
}
std::string GetEnvVariableA(const std::wstring& strName)
{
std::wstring sTmp = GetEnvVariable(strName);
return U_TO_UTF8(sTmp);
}
std::wstring GetEnvVariable(const std::wstring& strName)
{
@ -78,50 +137,129 @@ namespace NSSystemUtils
#endif
}
std::wstring GetAppDataDir()
{
std::wstring sBranding = GetBuildBranding();
std::wstring sAppDataPath;
std::wstring GetAppDataDir()
{
std::wstring sBranding = GetBuildBranding();
std::wstring sAppDataPath;
#ifdef _WIN32
wchar_t sAppDataLocal[65535];
wchar_t sAppDataLocal[65535];
if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, sAppDataLocal)))
{
sAppDataPath = std::wstring(sAppDataLocal);
}
{
sAppDataPath = std::wstring(sAppDataLocal);
}
#else
std::wstring sHomeDir = NSSystemUtils::GetEnvVariable(L"HOME");
std::wstring sHomeDir = NSSystemUtils::GetEnvVariable(L"HOME");
if (!sHomeDir.empty())
{
if (NSDirectory::Exists(sHomeDir + L"/.local/share"))
sHomeDir = sHomeDir + L"/.local/share";
else if (NSDirectory::Exists(sHomeDir + L"/.local"))
sHomeDir = sHomeDir + L"/.local";
}
if (!sHomeDir.empty())
{
if (NSDirectory::Exists(sHomeDir + L"/.local/share"))
sHomeDir = sHomeDir + L"/.local/share";
else if (NSDirectory::Exists(sHomeDir + L"/.local"))
sHomeDir = sHomeDir + L"/.local";
}
sAppDataPath = sHomeDir;
sAppDataPath = sHomeDir;
#endif
if (!NSDirectory::Exists(sAppDataPath))
return L"";
if (!NSDirectory::Exists(sAppDataPath))
return L"";
sAppDataPath += (L"/" + sBranding);
sAppDataPath += (L"/" + sBranding);
if (!NSDirectory::Exists(sAppDataPath))
NSDirectory::CreateDirectory(sAppDataPath);
if (!NSDirectory::Exists(sAppDataPath))
NSDirectory::CreateDirectory(sAppDataPath);
return sAppDataPath;
}
return sAppDataPath;
}
std::wstring GetBuildBranding()
{
std::string sBrandingA = "ONLYOFFICE";
#ifdef BUILD_BRANDING_NAME
sBrandingA = BUILD_BRANDING_NAME;
#endif
std::wstring GetBuildBranding()
{
std::string sBrandingA = "ONLYOFFICE";
#ifdef BUILD_BRANDING_NAME
sBrandingA = BUILD_BRANDING_NAME;
#endif
return UTF8_TO_U(sBrandingA);
}
}
return UTF8_TO_U(sBrandingA);
}
std::wstring GetSystemDirectory(const SystemDirectoryType& type)
{
std::wstring result = L"";
if (type == SystemDirectoryType::Undefined)
return result;
#if defined(_WIN32) && !defined(WIN_XP_OR_VISTA)
KNOWNFOLDERID folderId = FOLDERID_Documents;
switch (type)
{
case SystemDirectoryType::Downloads:
folderId = FOLDERID_Downloads;
break;
case SystemDirectoryType::Desktop:
folderId = FOLDERID_Desktop;
break;
default:
break;
}
PWSTR dirPath = NULL;
HRESULT hr = SHGetKnownFolderPath(folderId, 0, NULL, &dirPath);
if (SUCCEEDED(hr))
result = std::wstring(dirPath);
if (dirPath)
CoTaskMemFree(dirPath);
#endif
#if defined(_LINUX) && !defined(_MAC) && !defined(__ANDROID__)
std::wstring home_dir = NSSystemUtils::GetEnvVariable(L"HOME");
result = home_dir + L"/Documents";
switch (type)
{
case SystemDirectoryType::Downloads:
result = home_dir + L"/Downloads";
break;
case SystemDirectoryType::Desktop:
result = home_dir + L"/Desktop";
break;
default:
break;
}
#endif
#if defined(_MAC) && !defined(_IOS)
#if 0
result = getDirectoryPathMac(type);
#endif
if (!result.empty())
return result;
std::wstring home_dir = NSSystemUtils::GetEnvVariable(L"HOME");
result = home_dir + L"/Documents";
switch (type)
{
case SystemDirectoryType::Downloads:
result = home_dir + L"/Downloads";
break;
case SystemDirectoryType::Desktop:
result = home_dir + L"/Desktop";
break;
default:
break;
}
#endif
return result;
}
} // namespace NSSystemUtils

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
@ -59,11 +59,21 @@ namespace NSSystemUtils
static const wchar_t* gc_EnvLastModifiedBy = L"LAST_MODIFIED_BY";
static const wchar_t* gc_EnvModified = L"MODIFIED";
static const wchar_t* gc_EnvMemoryLimit = L"X2T_MEMORY_LIMIT";
static const wchar_t* gc_EnvMemoryLimitDefault = L"4GiB";
static const wchar_t* gc_EnvMemoryLimitDefault = L"3GiB";
KERNEL_DECL std::string GetEnvVariableA(const std::wstring& strName);
KERNEL_DECL std::wstring GetEnvVariable(const std::wstring& strName);
KERNEL_DECL std::wstring GetAppDataDir();
KERNEL_DECL std::wstring GetBuildBranding();
KERNEL_DECL std::string GetEnvVariableA(const std::wstring& strName);
KERNEL_DECL std::wstring GetEnvVariable(const std::wstring& strName);
KERNEL_DECL std::wstring GetAppDataDir();
KERNEL_DECL std::wstring GetBuildBranding();
enum class SystemDirectoryType
{
Documents = 0,
Downloads = 1,
Desktop = 2,
Undefined = 255
};
KERNEL_DECL std::wstring GetSystemDirectory(const SystemDirectoryType& type);
}
#endif // _SYSTEMUTILS_H

View File

@ -46,8 +46,10 @@
#define CXIMAGE_SUPPORT_PSD 1
#ifndef BUILDING_WASM_MODULE
#define CXIMAGE_SUPPORT_HEIF 1
#define CXIMAGE_SUPPORT_RAW 1
#else
#define CXIMAGE_SUPPORT_HEIF 0
#define CXIMAGE_SUPPORT_RAW 0
#endif

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

@ -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

@ -23,6 +23,30 @@ public class NativeLibraryLoader {
}
}
private static String libPrefix;
private static String libExtension;
private static boolean loadIfExist(String libPath) {
File libFile = new File(libPath);
if (libFile.exists()) {
System.load(libPath);
return true;
}
return false;
}
private static void load(Path libDirPath, String libName) {
String libPath = libDirPath.resolve(libPrefix + libName + libExtension).toString();
if (OSChecker.isMac()) {
if (!loadIfExist(libPath)) {
// if dylib does not exist, load framework library
System.load(libDirPath.resolve(libName + ".framework/" + libName).toString());
}
} else {
System.load(libPath);
}
}
static {
try {
Path libDirPath = getLibPath();
@ -31,8 +55,8 @@ public class NativeLibraryLoader {
System.load(libDirPath.resolve("icudt58.dll").toString());
System.load(libDirPath.resolve("icuuc58.dll").toString());
} else if (OSChecker.isMac()) {
System.load(libDirPath.resolve("libicudata.58.dylib").toString());
System.load(libDirPath.resolve("libicuuc.58.dylib").toString());
loadIfExist(libDirPath.resolve("libicudata.58.dylib").toString());
loadIfExist(libDirPath.resolve("libicuuc.58.dylib").toString());
} else if (OSChecker.isLinux()) {
System.load(libDirPath.resolve("libicudata.so.58").toString());
System.load(libDirPath.resolve("libicuuc.so.58").toString());
@ -42,24 +66,25 @@ public class NativeLibraryLoader {
String[] libs = {"UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer", "doctrenderer", "docbuilder.jni"};
String prefix = "";
libPrefix = "";
if (OSChecker.isMac() || OSChecker.isLinux()) {
prefix = "lib";
libPrefix = "lib";
}
String extension = "";
libExtension = "";
if (OSChecker.isWindows()) {
extension = ".dll";
libExtension = ".dll";
} else if (OSChecker.isMac()) {
extension = ".dylib";
libExtension = ".dylib";
} else {
extension = ".so";
libExtension = ".so";
}
for (String lib : libs) {
System.load(libDirPath.resolve(prefix + lib + extension).toString());
load(libDirPath, lib);
}
} catch (UnsatisfiedLinkError e) {
} catch (Exception e) {
System.out.println(e.getMessage());
throw new RuntimeException("Cannot load dynamic libraries. Check if JAR file is in the same directory as all docbuilder libraries.");
}
}

View File

@ -0,0 +1 @@
deploy/

View File

@ -24,6 +24,10 @@ def _loadLibrary(path):
library_name = 'libdocbuilder.c.so'
elif 'darwin' == os_name:
library_name = 'libdocbuilder.c.dylib'
# if there is no dylib file, get library from framework
if not os.path.exists(path + '/' + library_name):
path = path + '/docbuilder.c.framework'
library_name = 'docbuilder.c'
_lib = ctypes.CDLL(path + '/' + library_name)
@ -437,7 +441,7 @@ class CDocBuilderValue:
return CDocBuilderValue(OBJECT_HANDLE(_lib.CDocBuilderValue_Call6(self._internal, ctypes.c_wchar_p(name), values[0]._internal, values[1]._internal, values[2]._internal, values[3]._internal, values[4]._internal, values[5]._internal)))
else:
raise TypeError("Call() expects at most 6 arguments")
def append(self, value):
if not self.IsArray():
raise TypeError("Object is not an array")

View File

@ -74,6 +74,7 @@ CV8RealTimeWorker::CV8RealTimeWorker(NSDoctRenderer::CDocBuilder* pBuilder, cons
global->set("native", oNativeCtrl);
CBuilderEmbed* pBuilderJSNative = static_cast<CBuilderEmbed*>(oBuilderJS->getNative());
pBuilderJSNative->SetExternalize(true);
pBuilderJSNative->m_pBuilder = pBuilder;
}
CV8RealTimeWorker::~CV8RealTimeWorker()
@ -1272,7 +1273,7 @@ namespace NSDoctRenderer
if (m_pInternal->m_nFileType != -1 && m_pInternal->m_bIsOpenedFromSimpleJS)
{
m_pInternal->m_bIsOpenedFromSimpleJS = false;
return true;
return 0;
}
m_pInternal->m_nFileType = -1;
@ -1513,7 +1514,8 @@ namespace NSDoctRenderer
if (nCountParameters > 2)
sParams = _builder_params[2].c_str();
this->SaveFile(nFormat, _builder_params[1].c_str(), sParams);
int nSaveError = this->SaveFile(nFormat, _builder_params[1].c_str(), sParams);
bIsNoError = (0 == nSaveError);
}
else if ("WriteData" == sFuncNum)
{

View File

@ -547,6 +547,7 @@ namespace NSDoctRenderer
CApplicationFontsWorker oWorker;
oWorker.m_bIsUseSystemFonts = m_oParams.m_bIsSystemFonts;
oWorker.m_arAdditionalFolders = m_oParams.m_arFontDirs;
oWorker.m_arAdditionalFolders.push_back(NSFile::GetProcessDirectory() + L"/fonts");
oWorker.m_bIsNeedThumbnails = false;
oWorker.m_sDirectory = sDirectory;
// это не рабочая папка, где только шрифты
@ -927,7 +928,7 @@ namespace NSDoctRenderer
COfficeFileFormatChecker oChecker;
if (!oChecker.isOfficeFile(sFileCopy))
return false;
return 1;
if (oChecker.nFileType & AVS_OFFICESTUDIO_FILE_DOCUMENT)
m_nFileType = 0;

View File

@ -196,7 +196,9 @@ JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSVa
}
JSSmart<CJSValue> CGraphicsEmbed::Destroy()
{
// For save image bits, if needed.
m_pInternal->Destroy();
RELEASEOBJECT(m_pInternal);
return NULL;
}
JSSmart<CJSValue> CGraphicsEmbed::EndDraw()

View File

@ -45,7 +45,7 @@ public:
public:
CBuilderDocumentEmbed() : m_pBuilder(NULL), m_bIsValid(false) {}
~CBuilderDocumentEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); }
~CBuilderDocumentEmbed() { if(m_pBuilder && !m_isExternalize) RELEASEOBJECT(m_pBuilder); }
virtual void* getObject() { return (void*)m_pBuilder; }
NSDoctRenderer::CDocBuilder_Private* GetPrivate(NSDoctRenderer::CDocBuilder* pBuilder) { return pBuilder->GetPrivate(); }

View File

@ -88,6 +88,7 @@ JSSmart<CJSValue> CBuilderEmbed::OpenTmpFile(JSSmart<CJSValue> path, JSSmart<CJS
JSSmart<CJSObject> oBuilderTmpDoc = CJSContext::createEmbedObject("CBuilderDocumentEmbed");
CBuilderDocumentEmbed* pBuilderTmpDocNative = static_cast<CBuilderDocumentEmbed*>(oBuilderTmpDoc->getNative());
pBuilderTmpDocNative->m_pBuilder = m_pBuilder;
pBuilderTmpDocNative->SetExternalize(true);
pBuilderTmpDocNative->_OpenFile(sPath, sParams);
return oBuilderTmpDoc->toValue();
}

View File

@ -47,7 +47,7 @@ public:
NSDoctRenderer::CDocBuilder* m_pBuilder;
CBuilderEmbed() : m_pBuilder(NULL) {}
~CBuilderEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); }
~CBuilderEmbed() { if(m_pBuilder && !m_isExternalize) RELEASEOBJECT(m_pBuilder); }
virtual void* getObject() { return (void*)m_pBuilder; }
NSDoctRenderer::CDocBuilder_Private* GetPrivate() { return m_pBuilder->GetPrivate(); }

View File

@ -42,6 +42,7 @@ namespace NSGraphics
m_pRenderer = NSGraphics::Create();
m_pRenderer->SetFontManager(pManager);
RELEASEINTERFACE(pManager);
int nRasterW = (int)width_px;
int nRasterH = (int)height_px;

View File

@ -31,6 +31,7 @@ namespace NSJSBase {
{
embed_native_internal = nullptr;
m_pAdapter = nullptr;
m_isExternalize = false;
}
CJSEmbedObject::~CJSEmbedObject()
@ -44,6 +45,16 @@ namespace NSJSBase {
return nullptr;
}
void CJSEmbedObject::SetExternalize(const bool& isExternalize)
{
m_isExternalize = isExternalize;
}
bool CJSEmbedObject::GetExternalize()
{
return m_isExternalize;
}
CJSEmbedObjectAdapterBase* CJSEmbedObject::getAdapter()
{
return nullptr;

View File

@ -194,10 +194,18 @@ namespace NSJSBase
*/
virtual CJSEmbedObjectAdapterBase* getAdapter();
/**
* Use the externalize flag if you are monitoring the object's destruction yourself.
*/
virtual void SetExternalize(const bool& isExternalize = true);
virtual bool GetExternalize();
protected:
CJSEmbedObjectPrivateBase* embed_native_internal;
CJSEmbedObjectAdapterBase* m_pAdapter;
bool m_isExternalize;
friend class CJSEmbedObjectPrivateBase;
friend class CJSEmbedObjectPrivate;
};

View File

@ -1853,6 +1853,16 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles(const bool& bIsUs
#if defined(_MAC) && !defined(_IOS)
std::vector<std::wstring> _array = NSDirectory::GetFiles(L"/Library/Fonts", true);
NSDirectory::GetFiles2(L"/System/Library/Fonts", _array, true);
std::set<std::wstring> installedList = GetInstalledFontsMac();
for (const auto& sysPath : installedList) {
if (0 == sysPath.find(L"/System/Library/Fonts/"))
continue;
if (0 == sysPath.find(L"/Library/Fonts/"))
continue;
_array.push_back(sysPath);
}
return _array;
#endif
@ -1958,6 +1968,10 @@ namespace NSFonts
if (FT_Open_Face(m_internal->m_library, &oOpenArgs, nFaceIndex, &pFace))
return;
bool bIsASC = false;
if (pFace->family_name && (0 == strcmp(pFace->family_name, "ASCW3")))
bIsASC = true;
for (int nCharMap = 0; nCharMap < pFace->num_charmaps; nCharMap++)
{
FT_Set_Charmap(pFace, pFace->charmaps[nCharMap]);
@ -1967,7 +1981,8 @@ namespace NSFonts
while (indexG)
{
pChecker->Check((int)character, indexG);
if (!bIsASC || (character < 35 || character > 255))
pChecker->Check((int)character, indexG);
character = FT_Get_Next_Char(pFace, character, &indexG);
}
}

View File

@ -38,6 +38,7 @@
#include <vector>
#include <list>
#include "FontManager.h"
#include <set>
namespace NSFonts
{
@ -354,6 +355,10 @@ public:
void InitFromReg();
#endif
#if defined(_MAC) && !defined(_IOS)
std::set<std::wstring> GetInstalledFontsMac();
#endif
NSFonts::IFontManager* GenerateFontManager();
std::wstring GetFontBySymbol(int symbol);

View File

@ -877,6 +877,11 @@ public:
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang SC", 36));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang TC", 37));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"PingFang HK", 38));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti SC", 39));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Heiti TC", 40));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti SC", 41));
mapFontsPriorityStandard.insert(std::pair<std::wstring, int>(L"Songti TC", 42));
#endif
NSFonts::CApplicationFontsSymbols oApplicationChecker;
@ -1604,6 +1609,14 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
if (m_sDirectory.empty())
return NULL;
for (std::vector<std::wstring>::iterator i = m_arAdditionalFolders.begin(); i != m_arAdditionalFolders.end(); i++)
{
if (0 == i->find(L"./"))
*i = NSFile::GetProcessDirectory() + L"/" + i->substr(2);
else if (0 == i->find(L"../"))
*i = NSFile::GetProcessDirectory() + L"/" + *i;
}
std::wstring strAllFontsJSPath = m_sDirectory + L"/AllFonts.js";
std::wstring strFontsSelectionBin = m_sDirectory + L"/font_selection.bin";

View File

@ -36,7 +36,7 @@
#include <vector>
#include "../graphics/pro/Fonts.h"
#define ONLYOFFICE_FONTS_VERSION 12
#define ONLYOFFICE_FONTS_VERSION 14
#define ONLYOFFICE_ALL_FONTS_VERSION 2
class CApplicationFontsWorkerBreaker

View File

@ -29,37 +29,36 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "ApplicationFonts.h"
#include "../common/File.h"
#import <Foundation/Foundation.h>
#import <CoreText/CoreText.h>
#include "./../WrapperWritingElement.h"
#include "./../Limit/FrameShape.h"
#include "./../Limit/AlbumLayout.h"
namespace PPTX
std::set<std::wstring> CApplicationFonts::GetInstalledFontsMac()
{
namespace nsPresentation
std::set<std::wstring> paths;
CFArrayRef fontURLs = CTFontManagerCopyAvailableFontURLs();
if (!fontURLs)
return paths;
NSStringEncoding encode = CFStringConvertEncodingToNSStringEncoding (kCFStringEncodingUTF32LE);
CFIndex count = CFArrayGetCount(fontURLs);
for (CFIndex i = 0; i < count; ++i)
{
class PhotoAlbum : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(PhotoAlbum)
CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(fontURLs, i);
if (!url)
continue;
public:
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
NSString* nsPath = [(__bridge NSURL *)url path];
if (!nsPath)
continue;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
nullable_bool bw;
nullable_limit<Limit::FrameShape> frame;
nullable_limit<Limit::AlbumLayout> layout;
nullable_bool showCaptions;
protected:
virtual void FillParentPointersForChilds();
};
} // namespace nsPresentation
} // namespace PPTX
NSData* pSData = [nsPath dataUsingEncoding: encode];
paths.emplace(std::wstring((wchar_t*)[pSData bytes], [pSData length] / sizeof (wchar_t)));
}
CFRelease(fontURLs);
return paths;
}

View File

@ -83,6 +83,7 @@
"./../../graphics/pro/js/wasm/src/lib",
"./../../../Common/3dParty/harfbuzz/harfbuzz/src",
"./../../../Common/3dParty/brotli/brotli/c/include",
"./../../../OfficeUtils/src",
"./../../../OfficeUtils/src/zlib-1.2.11",
@ -113,6 +114,8 @@
"BUILD_ZLIB_AS_SOURCES",
"IMAGE_CHECKER_DISABLE_XML",
"FT_CONFIG_OPTION_USE_BROTLI",
"BUILDING_WASM_MODULE"
],
"compile_files_array": [
@ -349,6 +352,26 @@
{
"folder": "./../../../Common/3dParty/hyphen/js/src",
"files": ["hyphen.cpp"]
},
{
"folder": "./../../../Common/3dParty/brotli/brotli/c/common",
"files": [
"constants.c",
"context.c",
"dictionary.c",
"platform.c",
"shared_dictionary.c",
"transform.c"
]
},
{
"folder": "./../../../Common/3dParty/brotli/brotli/c/dec",
"files": [
"bit_reader.c",
"decode.c",
"huffman.c",
"state.c"
]
}
]
}

View File

@ -917,15 +917,15 @@ function onLoadFontsModule(window, undefined)
this._mapToNames = AscCommon.spellcheckGetLanguages();
let _langKey = "" + lang;
let _langName = this._mapToNames[_langKey];
if (_langName === undefined)
let _langObj = this._mapToNames[_langKey];
if (!_langObj || !_langObj["hyphen"] || !_langObj["name"])
{
this._dictionaries[_langKey] = false;
callback();
return;
}
this._loadDictionaryAttemt(_langKey, _langName, callback);
this._loadDictionaryAttemt(_langKey, _langObj["name"], callback);
};
this._loadDictionaryAttemt = function(langKey, langName, callback, currentAttempt)

View File

@ -75,7 +75,7 @@ bool Segment::IsValid(const BooleanOpType& op) const noexcept
else if (Id == 2 && Winding == 1)
return true;
}
else if (Winding == op)
else if (Winding && op == Intersection || !Winding && op == Union)
return true;
return false;
}
@ -396,18 +396,12 @@ Curve Curve::GetPart(double from, double to) const noexcept
if (from > 0)
{
result = Subdivide(from)[1];
result.Segment2.HI.X -= result.Segment2.P.X;
result.Segment2.HI.Y -= result.Segment2.P.Y;
result.Segment2.HO.X -= result.Segment2.P.X;
result.Segment2.HO.Y -= result.Segment2.P.Y;
result.Segment2.SetHandles(result.Segment2.HI, result.Segment2.HO);
}
if (to < 1)
{
result = result.Subdivide((to - from) / (1 - from))[0];
result.Segment2.HI.X -= result.Segment2.P.X;
result.Segment2.HI.Y -= result.Segment2.P.Y;
result.Segment2.HO.X -= result.Segment2.P.X;
result.Segment2.HO.Y -= result.Segment2.P.Y;
result.Segment2.SetHandles(result.Segment2.HI, result.Segment2.HO);
}
if (from > to)
@ -688,8 +682,7 @@ void Curve::Flip() noexcept
PointD tmpHI = Segment2.P + Segment2.HI;
PointD tmpHO = Segment2.P + Segment2.HO;
std::swap(Segment1.P, Segment2.P);
Segment2.HI = tmpHI - Segment2.P;
Segment2.HO = tmpHO - Segment2.P;
Segment2.SetHandles(tmpHO, tmpHI);
}
bool Curve::IsStraight() const noexcept
@ -743,10 +736,12 @@ bool Location::IsTouching() noexcept
CBooleanOperations::CBooleanOperations(const CGraphicsPath& path1,
const CGraphicsPath& path2,
BooleanOpType op,
long fillType) :
long fillType,
bool isLuminosity) :
Op(op),
Close1(path1.Is_poly_closed()),
Close2(path2.Is_poly_closed()),
IsLuminosity(isLuminosity),
FillType(fillType),
Path1(path1),
Path2(path2)
@ -936,14 +931,13 @@ void CBooleanOperations::TraceAllOverlap()
}
else
{
int count1 = 0, count2 = 0;
bool winding1{false},
winding2{false};
for (const auto& s : Segments1)
{
if (!s.Inters)
{
int touchCount = 0;
for (const auto& c : OriginCurves2)
count1 += CheckInters(MIN_POINT, s, c, touchCount);
winding1 = IsInside(s);
break;
}
}
@ -952,9 +946,7 @@ void CBooleanOperations::TraceAllOverlap()
{
if (!s.Inters)
{
int touchCount = 0;
for (const auto& c : OriginCurves1)
count2 += CheckInters(MIN_POINT, s, c, touchCount);
winding2 = IsInside(s);
break;
}
}
@ -966,19 +958,19 @@ void CBooleanOperations::TraceAllOverlap()
}
else if (Op == Union)
{
if (count1 % 2 == 0 && count2 % 2 == 0)
if (!winding1 && !winding2)
TracePaths();
else if (count1 % 2 == 0)
else if (!winding1)
Result = std::move(Path1);
else
Result = std::move(Path2);
}
else if (count1 % 2 == 0 && count2 % 2 == 0)
else if (!winding1 && !winding2)
Result = std::move(Path1);
else
{
Result.StartFigure();
for (const auto& seg : count1 % 2 == 0 ? Segments1 : Segments2)
for (const auto& seg : !winding1 ? Segments1 : Segments2)
{
if (!seg.Inters && !seg.Visited)
{
@ -1020,35 +1012,18 @@ 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;
PointD start_point;
while (valid)
{
if (!start || (Op == Intersection && s.Inters && !GetNextSegment(s).Inters))
SetVisited(s);
if (first_start)
{
if (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,
@ -1082,9 +1057,6 @@ void CBooleanOperations::TracePaths()
if (start)
start = false;
if (first_start)
first_start = false;
}
if (!start && AllOverlap()) break;
@ -1247,6 +1219,14 @@ Curve CBooleanOperations::GetNextCurve(const Curve& curve) const noexcept
: Curves2[curve.Segment1.Index + 1];
}
Segment CBooleanOperations::GetPreviousSegment(const Segment& segment) const noexcept
{
if (segment.Index == 0)
return segment.Id == 1 ? Segments1[Segments1.size() - 1] : Segments2[Segments2.size() - 1];
else
return segment.Id == 1 ? Segments1[segment.Index - 1] : Segments2[segment.Index - 1];
}
Segment CBooleanOperations::GetNextSegment(const Segment& segment) const noexcept
{
bool path1 = segment.Id == 1;
@ -1559,9 +1539,9 @@ int CBooleanOperations::AddCurveIntersection(const Curve& curve1, const Curve& c
double d1 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x2[1], y2[1], false),
d2 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x2[2], y2[2], false),
factor = (d1 * d2) > 0 ? 3.0 / 4.0 : 4.0 / 9.0,
dMin = factor * min(0, d1, d2),
dMax = factor * max(0, d1, d2),
factor = (d1 * d2) > 0.0 ? 3.0 / 4.0 : 4.0 / 9.0,
dMin = factor * min(0.0, d1, d2),
dMax = factor * max(0.0, d1, d2),
dp0 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[0], y1[0], false),
dp1 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[1], y1[1], false),
dp2 = getSignedDistance(x2[0], y2[0], x2[3], y2[3], x1[2], y1[2], false),
@ -1665,18 +1645,29 @@ 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));
return roots.size() % 2;
if (IsLuminosity)
return roots.size() % 2;
// int count = 0;
// for (const auto& r : roots)
// if (line.GetTimeOf(curve.GetPoint(r)) != -1)
// count++;
int count = 0;
for (const auto& r : roots)
if (line.GetTimeOf(curve.GetPoint(r)) != -1)
count++;
// return count;
return count;
}
return 0;
}
bool CBooleanOperations::IsInside(const Segment& segment) const
{
int count = 0;
int touchCount = 0;
for(const auto& c : segment.Id == 1 ? OriginCurves2 : OriginCurves1)
count += CheckInters(MIN_POINT, segment, c, touchCount);
return count % 2;
}
void CBooleanOperations::SetWinding()
{
if (Locations.empty() || (Locations.size() == 2 && Locations[0]->Ends))
@ -1691,21 +1682,15 @@ void CBooleanOperations::SetWinding()
if (!s.Inters)
s2 = s;
int count = 0,
touchCount = 0;
for (const auto& c : OriginCurves2)
count += CheckInters(MIN_POINT, s1, c, touchCount);
bool winding = IsInside(s1);
for (auto& s : Segments1)
s.Winding = count % 2;
s.Winding = winding;
count = 0;
touchCount = 0;
for (const auto& c : OriginCurves1)
count += CheckInters(MIN_POINT, s2, c, touchCount);
winding = IsInside(s2);
for (auto& s : Segments2)
s.Winding = count % 2;
s.Winding = winding;
}
else
{
@ -1717,18 +1702,36 @@ void CBooleanOperations::SetWinding()
if (s.IsEmpty() || s.Inters || s == start)
continue;
int count = 0,
touchCount = 0;
for (const auto& c : (s.Id == 1 ? OriginCurves2 : OriginCurves1))
count += CheckInters(MIN_POINT, s, c, touchCount);
bool winding = IsInside(s);
int winding1 = false;
if (s.Id == 1 ? !Close1 : !Close2)
winding1 = IsInside(GetPreviousSegment(start));
do
{
if (s.Id == 1 )
Segments1[s.Index].Winding = count % 2;
if (s.Id == 1)
{
Segments1[s.Index].Winding = winding;
if (!Close1 && s.Index == Segments1.size() - 1)
{
winding = winding1;
s = Segments1[0];
}
else
s = GetNextSegment(s);
}
else
Segments2[s.Index].Winding = count % 2;
s = GetNextSegment(s);
{
Segments2[s.Index].Winding = winding;
if (!Close2 && s.Index == Segments2.size() - 1)
{
winding = winding1;
s = Segments2[0];
}
else
s = GetNextSegment(s);
}
} while (!s.IsEmpty() && !s.Inters && s != start);
}
}
@ -1928,7 +1931,8 @@ void CBooleanOperations::AddOffsets(std::vector<double>& offsets,
CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1,
const CGraphicsPath& path2,
BooleanOpType op,
long fillType)
long fillType,
bool isLuminosity)
{
std::vector<CGraphicsPath> paths1 = path1.GetSubPaths(),
paths2 = path2.GetSubPaths(),
@ -1938,7 +1942,7 @@ CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1,
{
for (const auto& p2 : paths2)
{
CBooleanOperations operation(p1, p2, op, fillType);
CBooleanOperations operation(p1, p2, op, fillType, isLuminosity);
paths.push_back(operation.GetResult());
}
}

View File

@ -17,10 +17,10 @@ namespace Aggplus
bool IsCurve = false;
bool Visited = false;
bool PolyClosed = false;
bool Winding = false;
int Index = -1;
int Id = 0;
int Winding = 0;
int Index = -1;
int Id = 0;
std::shared_ptr<Location> Inters{nullptr};
@ -107,7 +107,7 @@ namespace Aggplus
class CBooleanOperations
{
public:
CBooleanOperations(const CGraphicsPath& path1, const CGraphicsPath& path2, BooleanOpType op, long fillType = c_nWindingFillMode);
CBooleanOperations(const CGraphicsPath& path1, const CGraphicsPath& path2, BooleanOpType op, long fillType, bool isLuminosity);
~CBooleanOperations();
CGraphicsPath&& GetResult();
@ -124,6 +124,7 @@ namespace Aggplus
Curve GetCurve(const Segment& segment) const noexcept;
Curve GetPreviousCurve(const Curve& curve) const noexcept;
Curve GetNextCurve(const Curve& curve) const noexcept;
Segment GetPreviousSegment(const Segment& segment) const noexcept;
Segment GetNextSegment(const Segment& segment) const noexcept;
void SetVisited(const Segment& segment);
@ -141,6 +142,7 @@ namespace Aggplus
int AddCurveIntersection(const Curve& curve1, const Curve& curve2, const Curve& startCurve1, const Curve& startCurve2, bool flip,
int recursion = 0, int calls = 0, double tMin = 0.0, double tMax = 1.0, double uMin = 0.0, double uMax = 1.0);
int CheckInters(const PointD& point, const Segment& segment, const Curve& curve, int& touchCount) const;
bool IsInside(const Segment& segment) const;
void SetWinding();
// Location
@ -156,6 +158,7 @@ namespace Aggplus
bool Close1 = true;
bool Close2 = true;
bool IsLuminosity = false;
// c_nStroke, c_nWindingFillMode, c_nEvenOddFillMode
long FillType = c_nWindingFillMode;

View File

@ -189,7 +189,7 @@ namespace Aggplus
Exclusion = 3
};
GRAPHICS_DECL CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1, const CGraphicsPath& path2, BooleanOpType op, long fillType = c_nWindingFillMode);
GRAPHICS_DECL CGraphicsPath CalcBooleanOperation(const CGraphicsPath& path1, const CGraphicsPath& path2, BooleanOpType op, long fillType = c_nWindingFillMode, bool isLuminosity = false);
} // namespace Aggplus

View File

@ -244,7 +244,7 @@ inline void getConvexHull(const double& dq0, const double& dq1,
}
}
if (dist1 < 0.0 || dist2 < 0.0)
if (dist1 < 0.0 || (dist1 == 0.0 && dist2 < 0.0))
std::swap(top, bottom);
}

View File

@ -214,7 +214,7 @@ int CAnnotFieldInfo::GetFlag() const { return m_nFlag; }
int CAnnotFieldInfo::GetID() const { return m_nID; }
int CAnnotFieldInfo::GetAnnotFlag() const { return m_nAnnotFlag; }
int CAnnotFieldInfo::GetPage() const { return m_nPage; }
int CAnnotFieldInfo::GetCopyAP() const { return m_nCopyAP; }
int CAnnotFieldInfo::GetCopyAP() const { return m_nCopyAP; }
void CAnnotFieldInfo::GetBE(BYTE& nS, double& dI) { nS = m_pBE.first; dI = m_pBE.second; }
BYTE* CAnnotFieldInfo::GetRender(LONG& nLen)
{
@ -224,6 +224,7 @@ BYTE* CAnnotFieldInfo::GetRender(LONG& nLen)
const std::wstring& CAnnotFieldInfo::GetNM() { return m_wsNM; }
const std::wstring& CAnnotFieldInfo::GetLM() { return m_wsLM; }
const std::wstring& CAnnotFieldInfo::GetOUserID() { return m_wsOUserID; }
const std::wstring& CAnnotFieldInfo::GetOMetadata() { return m_wsOMetadata; }
const std::wstring& CAnnotFieldInfo::GetContents() { return m_wsContents; }
const std::vector<double>& CAnnotFieldInfo::GetC() { return m_arrC; }
@ -362,6 +363,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
m_wsOUserID = pReader->ReadString();
if (nFlags & (1 << 8))
m_nCopyAP = pReader->ReadInt();
if (nFlags & (1 << 9))
m_wsOMetadata = pReader->ReadString();
if (IsMarkup())
{
@ -680,6 +683,7 @@ int CAnnotFieldInfo::CWidgetAnnotPr::GetR() const { return m_nR; }
int CAnnotFieldInfo::CWidgetAnnotPr::GetFlag() const { return m_nFlag; }
int CAnnotFieldInfo::CWidgetAnnotPr::GetFlags() const { return m_nFlags; }
int CAnnotFieldInfo::CWidgetAnnotPr::GetParentID() const { return m_nParentID; }
int CAnnotFieldInfo::CWidgetAnnotPr::GetMEOptions() const { return m_nMEOptions; }
int CAnnotFieldInfo::CWidgetAnnotPr::GetFontStyle() const { return m_nFontStyle; }
double CAnnotFieldInfo::CWidgetAnnotPr::GetFontSize() const { return m_dFS; }
double CAnnotFieldInfo::CWidgetAnnotPr::GetFontSizeAP() const { return m_dFSAP; }
@ -689,7 +693,6 @@ const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetDV() { return m_wsDV; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetT() { return m_wsT; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontName() { return m_wsFN; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetFontKey() { return m_wsFK; }
const std::wstring& CAnnotFieldInfo::CWidgetAnnotPr::GetOMetadata() { return m_wsOMetadata; }
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetTC() { return m_arrTC; }
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBC() { return m_arrBC; }
const std::vector<double>& CAnnotFieldInfo::CWidgetAnnotPr::GetBG() { return m_arrBG; }
@ -890,8 +893,8 @@ void CAnnotFieldInfo::CWidgetAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader
m_nParentID = pReader->ReadInt();
if (nFlags & (1 << 18))
m_wsT = pReader->ReadString();
if (nFlags & (1 << 20))
m_wsOMetadata = pReader->ReadString();
if (nFlags & (1 << 21))
m_nMEOptions = pReader->ReadInt();
// Action
int nAction = pReader->ReadInt();
@ -1143,6 +1146,10 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
}
if (nFlags & (1 << 9))
pParent->nMaxLen = pReader->ReadInt();
if (nFlags & (1 << 10))
pParent->sTU = pReader->ReadString();
if (nFlags & (1 << 11))
pParent->nMEOptions = pReader->ReadInt();
m_arrParents.push_back(pParent);
}
@ -1151,7 +1158,10 @@ bool CWidgetsInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafil
for (int i = 0; i < n; ++i)
{
std::string sImagePath = pReader->ReadStringA();
m_arrButtonImg.push_back(pCorrector->GetImagePath(UTF8_TO_U(sImagePath)));
std::wstring sImage = UTF8_TO_U(sImagePath);
if (sImagePath.find("data:") != 0 && !sImagePath.empty())
sImage = pCorrector->GetImagePath(sImage);
m_arrButtonImg.push_back(sImage);
}
return true;

View File

@ -185,6 +185,7 @@ public:
int GetFlag() const;
int GetFlags() const;
int GetParentID() const;
int GetMEOptions() const;
int GetFontStyle() const;
double GetFontSize() const;
double GetFontSizeAP() const;
@ -194,7 +195,6 @@ public:
const std::wstring& GetT();
const std::wstring& GetFontName();
const std::wstring& GetFontKey();
const std::wstring& GetOMetadata();
const std::vector<double>& GetTC();
const std::vector<double>& GetBC();
const std::vector<double>& GetBG();
@ -215,6 +215,7 @@ public:
int m_nFlag;
int m_nFlags;
int m_nParentID;
int m_nMEOptions;
int m_nFontStyle;
double m_dFS;
double m_dFSAP;
@ -224,7 +225,6 @@ public:
std::wstring m_wsT;
std::wstring m_wsFN;
std::wstring m_wsFK;
std::wstring m_wsOMetadata;
std::vector<double> m_arrTC;
std::vector<double> m_arrBC;
std::vector<double> m_arrBG;
@ -471,6 +471,7 @@ public:
const std::wstring& GetNM();
const std::wstring& GetLM();
const std::wstring& GetOUserID();
const std::wstring& GetOMetadata();
const std::wstring& GetContents();
const std::vector<double>& GetC();
@ -527,6 +528,7 @@ private:
std::wstring m_wsNM;
std::wstring m_wsLM;
std::wstring m_wsOUserID;
std::wstring m_wsOMetadata;
std::wstring m_wsContents;
std::pair<BYTE, double> m_pBE;
std::vector<double> m_arrC;
@ -571,10 +573,12 @@ public:
int nFlags;
int nMaxLen;
int nParentID;
int nMEOptions;
int nFieldFlag;
std::wstring sName;
std::wstring sV;
std::wstring sDV;
std::wstring sTU;
std::vector<int> arrI;
std::vector<std::wstring> arrV;
std::vector<CAnnotFieldInfo::CWidgetAnnotPr::CActionWidget*> arrAction;

View File

@ -18,6 +18,12 @@ SOURCES += \
$$FONT_ENGINE_PATH/FontPath.cpp \
$$FONT_ENGINE_PATH/GlyphString.cpp
core_mac {
OBJECTIVE_SOURCES += $$FONT_ENGINE_PATH/ApplicationFonts_mac.mm
LIBS += -framework Foundation
LIBS += -framework CoreText
}
# Application fonts worker
HEADERS += $$FONT_ENGINE_PATH/ApplicationFontsWorker.h
SOURCES += $$FONT_ENGINE_PATH/ApplicationFontsWorker.cpp
@ -38,6 +44,10 @@ enable_support_shaper {
}
# -------------------------------------------------
# ------------------- brotli ----------------------
include($$PWD/../../../Common/3dParty/brotli/brotli.pri)
# -------------------------------------------------
# ------------------- hyphen ----------------------
HEADERS += $$FONT_ENGINE_PATH/languages.h

View File

@ -163,7 +163,7 @@
},
{
"folder": "../../../../Common/3dParty/icu/icu/source/common/",
"files": ["ucnv.c", "ustr_wcs.cpp", "ucnv_err.c", "ucnv_bld.cpp", "ustrtrns.cpp", "ucnv_cb.c", "udata.cpp", "ucnv_io.cpp", "uhash.c", "udatamem.c", "cmemory.c", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucnvlat1.c", "ucnv_u16.c", "ucnv_u8.c", "ucnv_u32.c", "ucnv_u7.c", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnv_lmb.c", "ucnvhz.c", "ucnvscsu.c", "ucnvisci.c", "ucnvbocu.cpp", "ucnv_ct.c", "ucnv_cnv.c", "stringpiece.cpp", "charstr.cpp", "umapfile.c", "ucmndata.c", "ucnv_ext.cpp", "uobject.cpp", "umath.c", "ubidi_props.c", "uchar.c", "uinvchar.c", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "utf_impl.c", "ustrcase.cpp", "cstring.c", "bytestrie.cpp"]
"files": ["ustr_wcs.cpp", "ustrtrns.cpp", "udata.cpp", "ucnv_io.cpp", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnvbocu.cpp", "stringpiece.cpp", "charstr.cpp", "ucnv_ext.cpp", "uobject.cpp", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "ustrcase.cpp", "bytestrie.cpp", "utf_impl.cpp", "cmemory.cpp", "uhash.cpp", "udatamem.cpp", "umapfile.cpp", "uinvchar.cpp", "uchar.cpp", "ubidi_props.cpp", "characterproperties.cpp", "ucptrie.cpp", "edits.cpp", "umutablecptrie.cpp", "bytesinkutil.cpp", "emojiprops.cpp", "cstring.cpp", "ucmndata.cpp", "ucnv.cpp", "ucnv_u7.cpp", "ucnv_u8.cpp", "ucnv_u16.cpp", "ucnv_u32.cpp", "ucnv_err.cpp", "ucnv_cnv.cpp", "ucnv_lmb.cpp", "ucnv_cb.cpp", "ucnv_ct.cpp", "ucharstrieiterator.cpp", "ucnvlat1.cpp", "uvectr32.cpp", "ucnvhz.cpp", "ucnvscsu.cpp", "ucnv_bld.cpp", "ucnvisci.cpp"]
},
{
"folder": "../../../../Common/3dParty/cryptopp/",
@ -195,7 +195,7 @@
},
{
"folder": "../../../../PdfFile/SrcWriter/",
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp"]
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontOTWriter.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp"]
},
{
"folder": "../../../../PdfFile/Resources/",

View File

@ -717,6 +717,7 @@ SOURCES += \
$$PDF_ROOT_DIR/SrcWriter/FontCidTT.cpp \
$$PDF_ROOT_DIR/SrcWriter/FontTT.cpp \
$$PDF_ROOT_DIR/SrcWriter/FontTTWriter.cpp \
$$PDF_ROOT_DIR/SrcWriter/FontOTWriter.cpp \
$$PDF_ROOT_DIR/SrcWriter/GState.cpp \
$$PDF_ROOT_DIR/SrcWriter/Image.cpp \
$$PDF_ROOT_DIR/SrcWriter/Info.cpp \

View File

@ -543,9 +543,10 @@ function readAnnot(reader, rec, readDoubleFunc, readDouble2Func, readStringFunc,
// User ID
if (flags & (1 << 7))
rec["OUserID"] = readStringFunc.call(reader);
// User ID
if (flags & (1 << 8))
rec["AP"]["Copy"] = reader.readInt();
// if (flags & (1 << 8))
// reader.readInt();
if (flags & (1 << 9))
rec["meta"] = readStringFunc.call(reader);
}
function readAnnotAP(reader, AP)
{
@ -581,7 +582,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
{
// Markup
let flags = 0;
if ((rec["Type"] < 18 && rec["Type"] != 1 && rec["Type"] != 15) || rec["Type"] == 25)
if ((rec["type"] < 18 && rec["type"] != 1 && rec["type"] != 15) || rec["type"] == 25)
{
flags = reader.readInt();
if (flags & (1 << 0))
@ -636,7 +637,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
rec["Subj"] = readStringFunc.call(reader);
}
// Text
if (rec["Type"] == 0)
if (rec["type"] == 0)
{
// Background color - C->IC
if (rec["C"])
@ -660,7 +661,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
}
// Line
else if (rec["Type"] == 3)
else if (rec["type"] == 3)
{
// L
rec["L"] = [];
@ -710,7 +711,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
}
}
// Ink
else if (rec["Type"] == 14)
else if (rec["type"] == 14)
{
// offsets like getStructure and viewer.navigate
let n = reader.readInt();
@ -724,7 +725,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
}
}
// Highlight, Underline, Squiggly, Strikeout
else if (rec["Type"] > 7 && rec["Type"] < 12)
else if (rec["type"] > 7 && rec["type"] < 12)
{
// QuadPoints
let n = reader.readInt();
@ -733,7 +734,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
rec["QuadPoints"].push(readDoubleFunc.call(reader));
}
// Square, Circle
else if (rec["Type"] == 4 || rec["Type"] == 5)
else if (rec["type"] == 4 || rec["type"] == 5)
{
// Rect and RD differences
if (flags & (1 << 15))
@ -752,7 +753,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
}
}
// Polygon, PolyLine
else if (rec["Type"] == 6 || rec["Type"] == 7)
else if (rec["type"] == 6 || rec["type"] == 7)
{
let nVertices = reader.readInt();
rec["Vertices"] = [];
@ -780,8 +781,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
rec["IT"] = reader.readByte();
}
// Popup
/*
else if (rec["Type"] == 15)
else if (rec["type"] == 15)
{
flags = reader.readInt();
rec["Open"] = (flags >> 0) & 1;
@ -789,9 +789,8 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
if (flags & (1 << 1))
rec["PopupParent"] = reader.readInt();
}
*/
// FreeText
else if (rec["Type"] == 2)
else if (rec["type"] == 2)
{
// Background color - C->IC
if (!isRead && rec["C"])
@ -847,7 +846,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
}
}
// Caret
else if (rec["Type"] == 13)
else if (rec["type"] == 13)
{
// Rect and RD differenses
if (flags & (1 << 15))
@ -862,7 +861,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
rec["Sy"] = reader.readByte();
}
// FileAttachment
else if (rec["Type"] == 16)
else if (rec["type"] == 16)
{
if (flags & (1 << 15))
rec["Icon"] = readStringFunc.call(reader);
@ -961,7 +960,7 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
rec["Desc"] = readStringFunc.call(reader);
}
// Stamp
else if (rec["Type"] == 12)
else if (rec["type"] == 12)
{
rec["Icon"] = readStringFunc.call(reader);
rec["Rotate"] = readDouble2Func.call(reader);
@ -969,6 +968,55 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
for (let i = 0; i < 8; ++i)
rec["InRect"].push(readDouble2Func.call(reader));
}
// Redact
else if (rec["type"] == 25)
{
// QuadPoints
if (flags & (1 << 15))
{
let n = reader.readInt();
rec["QuadPoints"] = [];
for (let i = 0; i < n; ++i)
rec["QuadPoints"].push(readDoubleFunc.call(reader));
}
// IC
if (flags & (1 << 16))
{
let n = reader.readInt();
rec["IC"] = [];
for (let i = 0; i < n; ++i)
rec["IC"].push(readDouble2Func.call(reader));
}
// OverlayText
if (flags & (1 << 17))
rec["OverlayText"] = readStringFunc.call(reader);
// Repeat
rec["Repeat"] = (flags >> 18) & 1;
// Q - alignment
if (flags & (1 << 19))
{
// 0 - left-justified, 1 - centered, 2 - right-justified
rec["alignment"] = reader.readByte();
}
// Font from DA
if (flags & (1 << 20))
{
rec["font"] = {};
let n = reader.readInt();
rec["font"]["color"] = [];
for (let i = 0; i < n; ++i)
rec["font"]["color"].push(readDouble2Func.call(reader));
rec["font"]["size"] = readDoubleFunc.call(reader);
rec["font"]["name"] = readStringFunc.call(reader);
if (!isRead)
{
let fontActual = readStringFunc.call(reader);
if (fontActual != "")
rec["font"]["actual"] = fontActual;
}
rec["font"]["style"] = reader.readInt();
}
}
}
function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readStringFunc, isRead = false)
{
@ -987,7 +1035,7 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
rec["font"]["color"].push(readDouble2Func.call(reader));
}
// 0 - left-justified, 1 - centered, 2 - right-justified
if (!isRead || (rec["Type"] != 29 && rec["Type"] != 28 && rec["Type"] != 27))
if (!isRead || (rec["type"] != 29 && rec["type"] != 28 && rec["type"] != 27))
rec["alignment"] = reader.readByte();
rec["flag"] = reader.readInt();
// 12.7.3.1
@ -1000,7 +1048,7 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
let flags = reader.readInt();
// Alternative field name, used in tooltip and error messages - TU
if (flags & (1 << 0))
rec["userName"] = readStringFunc.call(reader);
rec["tooltip"] = readStringFunc.call(reader);
// Default style string (CSS2 format) - DS
if (flags & (1 << 1))
rec["defaultStyle"] = readStringFunc.call(reader);
@ -1044,8 +1092,10 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
rec["name"] = readStringFunc.call(reader);
if (flags & (1 << 19))
rec["font"]["AP"] = readStringFunc.call(reader);
if (flags & (1 << 20))
rec["meta"] = readStringFunc.call(reader);
// if (flags & (1 << 20))
// readStringFunc.call(reader);
if (flags & (1 << 21))
rec["MEOptions"] = reader.readInt();
// Action
let nAction = reader.readInt();
if (nAction > 0)
@ -1317,6 +1367,10 @@ CFile.prototype["getInteractiveFormsInfo"] = function()
}
if (flags & (1 << 9))
rec["maxLen"] = reader.readInt();
if (flags & (1 << 10))
rec["tooltip"] = reader.readString();
if (flags & (1 << 11))
rec["MEOptions"] = reader.readInt();
res["Parents"].push(rec);
}
@ -1471,7 +1525,7 @@ CFile.prototype["getAnnotationsInfo"] = function(pageIndex)
// 11 - Strikeout, 12 - Stamp, 13 - Caret, 14 - Ink, 15 - Popup, 16 - FileAttachment,
// 17 - Sound, 18 - Movie, 19 - Widget, 20 - Screen, 21 - PrinterMark,
// 22 - TrapNet, 23 - Watermark, 24 - 3D, 25 - Redact
rec["Type"] = reader.readByte();
rec["type"] = reader.readByte();
// Annot
readAnnot(reader, rec, reader.readDouble, reader.readDouble2, reader.readString);
// Annot type
@ -1528,35 +1582,50 @@ CFile.prototype["readAnnotationsInfoFromBinary"] = function(AnnotInfo)
let reader = new CBinaryReader(AnnotInfo, 0, AnnotInfo.length);
if (!reader) return [];
let res = [];
let res = { annots:[], imgs:[] };
while (reader.isValid())
{
let nCommand = reader.readByte();
let nPos = reader.pos;
let nSize = reader.readInt();
if (nCommand != 164) // ctAnnotField
if (nCommand == 164) // ctAnnotField
{
let rec = {};
// Annotation type
// 0 - Text, 1 - Link, 2 - FreeText, 3 - Line, 4 - Square, 5 - Circle,
// 6 - Polygon, 7 - PolyLine, 8 - Highlight, 9 - Underline, 10 - Squiggly,
// 11 - Strikeout, 12 - Stamp, 13 - Caret, 14 - Ink, 15 - Popup, 16 - FileAttachment,
// 17 - Sound, 18 - Movie, 19 - Widget, 20 - Screen, 21 - PrinterMark,
// 22 - TrapNet, 23 - Watermark, 24 - 3D, 25 - Redact
rec["type"] = reader.readByte();
// Annot
readAnnot(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
// Annot type
readAnnotType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
if (rec["type"] >= 26 && rec["type"] <= 33)
{
// Widget type
readWidgetType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
}
res.annots.push(rec);
}
else if (nCommand == 166) // ctWidgetsInfo
{
reader.readInt(); // CO must be 0
reader.readInt(); // Parents must be 0
// ButtonImg
let n = reader.readInt();
for (let i = 0; i < n; ++i)
{
let data = reader.readString();
res.imgs.push(data);
}
}
else
{
reader.pos = nPos + nSize;
continue;
}
let rec = {};
// Annotation type
// 0 - Text, 1 - Link, 2 - FreeText, 3 - Line, 4 - Square, 5 - Circle,
// 6 - Polygon, 7 - PolyLine, 8 - Highlight, 9 - Underline, 10 - Squiggly,
// 11 - Strikeout, 12 - Stamp, 13 - Caret, 14 - Ink, 15 - Popup, 16 - FileAttachment,
// 17 - Sound, 18 - Movie, 19 - Widget, 20 - Screen, 21 - PrinterMark,
// 22 - TrapNet, 23 - Watermark, 24 - 3D, 25 - Redact
rec["Type"] = reader.readByte();
// Annot
readAnnot(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
// Annot type
readAnnotType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
if (rec["Type"] >= 26 && rec["Type"] <= 33)
{
// Widget type
readWidgetType(reader, rec, reader.readDouble3, reader.readDouble3, reader.readString2, true);
}
res.push(rec);
}
return res;

View File

@ -99,6 +99,7 @@ WASM_EXPORT int GetErrorCode(CDrawingFile* pFile)
WASM_EXPORT void Close(CDrawingFile* pFile)
{
delete pFile;
g_applicationFonts->GetStreams()->Clear();
NSFonts::NSApplicationFontStream::SetGlobalMemoryStorage(NULL);
}
WASM_EXPORT BYTE* GetInfo(CDrawingFile* pFile)

View File

@ -278,6 +278,13 @@ void ReadAnnot(BYTE* pWidgets, int& i)
std::cout << "User ID " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
i += nPathLength;
}
if (nFlags & (1 << 9))
{
nPathLength = READ_INT(pWidgets + i);
i += 4;
std::cout << "OMetadata " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
i += nPathLength;
}
}
void ReadInteractiveForms(BYTE* pWidgets, int& i)
@ -415,6 +422,19 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
i += 4;
std::cout << "MaxLen " << nPathLength << ", ";
}
if (nFlags & (1 << 10))
{
nPathLength = READ_INT(pWidgets + i);
i += 4;
std::cout << "TU " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
i += nPathLength;
}
if (nFlags & (1 << 11))
{
nPathLength = READ_INT(pWidgets + i);
i += 4;
std::cout << "MEOptions " << nPathLength << ", ";
}
std::cout << std::endl;
}
@ -574,12 +594,11 @@ void ReadInteractiveForms(BYTE* pWidgets, int& i)
std::cout << "Font button " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
i += nPathLength;
}
if (nFlags & (1 << 20))
if (nFlags & (1 << 21))
{
nPathLength = READ_INT(pWidgets + i);
i += 4;
std::cout << "OMetadata " << std::string((char*)(pWidgets + i), nPathLength) << ", ";
i += nPathLength;
std::cout << "MEOptions " << nPathLength << ", ";
}
//Action
@ -2036,6 +2055,83 @@ int main(int argc, char* argv[])
i += 4;
std::cout << "Y4 " << (double)nPathLength / 10000.0 << ", ";
}
else if (sType == "Redact")
{
if (nFlags & (1 << 15))
{
std::cout << "QuadPoints";
int nQuadPointsLength = READ_INT(pAnnots + i);
i += 4;
for (int j = 0; j < nQuadPointsLength; ++j)
{
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << " " << (double)nPathLength / 100.0;
}
std::cout << ", ";
}
if (nFlags & (1 << 16))
{
int nICLength = READ_INT(pAnnots + i);
i += 4;
std::cout << "IC ";
for (int j = 0; j < nICLength; ++j)
{
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << (double)nPathLength / 10000.0 << " ";
}
std::cout << ", ";
}
if (nFlags & (1 << 17))
{
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << "OverlayText " << std::string((char*)(pAnnots + i), nPathLength) << ", ";
i += nPathLength;
}
if (nFlags & (1 << 18))
std::cout << "Repeat true, ";
else
std::cout << "Repeat false, ";
if (nFlags & (1 << 19))
{
std::string arrQ[] = {"left-justified", "centered", "right-justified"};
nPathLength = READ_BYTE(pAnnots + i);
i += 1;
std::cout << "Q " << arrQ[nPathLength] << ", ";
}
if (nFlags & (1 << 20))
{
int nICLength = READ_INT(pAnnots + i);
i += 4;
std::cout << "DA color ";
for (int j = 0; j < nICLength; ++j)
{
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << (double)nPathLength / 10000.0 << " ";
}
std::cout << ", size ";
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << (double)nPathLength / 100.0 << ", font ";
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << std::string((char*)(pAnnots + i), nPathLength) << " actual ";
i += nPathLength;
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << std::string((char*)(pAnnots + i), nPathLength) << ", style ";
i += nPathLength;
nPathLength = READ_INT(pAnnots + i);
i += 4;
std::cout << nPathLength << ", ";
}
}
std::cout << std::endl << "]" << std::endl;
}

View File

@ -14,13 +14,15 @@ DEFINES += \
MNG_STORE_CHUNKS\
MNG_ERROR_TELLTALE
include($$CORE_ROOT_DIR/Common/3dParty/heif/heif.pri)
core_linux {
DEFINES += HAVE_UNISTD_H HAVE_FCNTL_H
QMAKE_CXXFLAGS += -Wno-narrowing
}
core_linux_clang {
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
}
core_mac {
@ -285,6 +287,9 @@ SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/PICFile.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/pic.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/heif/heif.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_cm.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_debug.c \

View File

@ -453,6 +453,723 @@ TEST(BooleanOperations, CurveIntersCurve)
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, RectIntersRect)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(55.0, 25.0);
path1.LineTo(255.0, 25.0);
path1.LineTo(255.0, 225.0);
path1.LineTo(55.0, 225.0);
path1.LineTo(55.0, 25.0);
path1.CloseFigure();
path2.StartFigure();
path2.MoveTo(152.0, 28.0);
path2.LineTo(352.0, 28.0);
path2.LineTo(352.0, 228.0);
path2.LineTo(152.0, 228.0);
path2.LineTo(152.0, 28.0);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(255.0, 28.0);
resultIntersect.LineTo(255.0, 225.0);
resultIntersect.LineTo(152.0, 225.0);
resultIntersect.LineTo(152.0, 28.0);
resultIntersect.LineTo(255.0, 28.0);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(55.0, 25.0);
resultUnite.LineTo(255.0, 25.0);
resultUnite.LineTo(255.0, 28.0);
resultUnite.LineTo(352.0, 28.0);
resultUnite.LineTo(352.0, 228.0);
resultUnite.LineTo(152.0, 228.0);
resultUnite.LineTo(152.0, 225.0);
resultUnite.LineTo(55.0, 225.0);
resultUnite.LineTo(55.0, 25.0);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(55.0, 25.0);
resultSubtract.LineTo(255.0, 25.0);
resultSubtract.LineTo(255.0, 28.0);
resultSubtract.LineTo(152.0, 28.0);
resultSubtract.LineTo(152.0, 225.0);
resultSubtract.LineTo(55.0, 225.0);
resultSubtract.LineTo(55.0, 25.0);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, EllipseIntersEllipse)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.AddEllipse(148.0, 82.0, 200.0, 200.0);
path2.AddEllipse(39.0, 130.0, 200.0, 200.0);
resultIntersect.StartFigure();
resultIntersect.MoveTo(225.883, 279.546);
resultIntersect.CurveTo(181.297, 269.48, 148.0, 229.628, 148.0, 182.0);
resultIntersect.CurveTo(148.0, 163.973, 152.77, 147.06, 161.117, 132.454);
resultIntersect.CurveTo(205.703, 142.52, 239.0, 182.372, 239.0, 230.0);
resultIntersect.CurveTo(239.0, 248.027, 234.23, 264.94, 225.883, 279.546);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(348.0, 182.0);
resultUnite.CurveTo(348.0, 237.228, 303.228, 282.0, 248.0, 282.0);
resultUnite.CurveTo(240.4, 282.0, 232.998, 281.152, 225.883, 279.546);
resultUnite.CurveTo(208.658, 309.686, 176.201, 330.0, 139.0, 330.0);
resultUnite.CurveTo(83.7715, 330.0, 39.0, 285.228, 39.0, 230.0);
resultUnite.CurveTo(39.0, 174.772, 83.7715, 130.0, 139.0, 130.0);
resultUnite.CurveTo(146.6, 130.0, 154.002, 130.848, 161.117, 132.454);
resultUnite.CurveTo(178.342, 102.314, 210.799, 82.0, 248.0, 82.0);
resultUnite.CurveTo(303.228, 82.0, 348.0, 126.772, 348.0, 182.0);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(348.0, 182.0);
resultSubtract.CurveTo(348.0, 237.228, 303.228, 282.0, 248.0, 282.0);
resultSubtract.CurveTo(240.4, 282.0, 232.998, 281.152, 225.883, 279.546);
resultSubtract.CurveTo(234.23, 264.94, 239.0, 248.027, 239.0, 230.0);
resultSubtract.CurveTo(239.0, 182.372, 205.703, 142.52, 161.117, 132.454);
resultSubtract.CurveTo(178.342, 102.314, 210.799, 82.0, 248.0, 82.0);
resultSubtract.CurveTo(303.228, 82.0, 348.0, 126.772, 348.0, 182.0);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, EllipseIntersCross)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.AddEllipse(33.0, 60.0, 200.0, 200.0);
path2.StartFigure();
path2.MoveTo(147.0, 235.0);
path2.LineTo(167.5, 235.0);
path2.LineTo(167.5, 214.5);
path2.LineTo(188.0, 214.5);
path2.LineTo(188.0, 235.0);
path2.LineTo(208.5, 235.0);
path2.LineTo(208.5, 255.5);
path2.LineTo(188.0, 255.5);
path2.LineTo(188.0, 276.0);
path2.LineTo(167.5, 276.0);
path2.LineTo(167.5, 255.5);
path2.LineTo(147.0, 255.5);
path2.LineTo(147.0, 235.0);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(199.146, 235);
resultIntersect.CurveTo(188.719, 244.203, 176.358, 251.266, 162.75, 255.5);
resultIntersect.LineTo(147, 255.5);
resultIntersect.LineTo(147, 235);
resultIntersect.LineTo(167.5, 235);
resultIntersect.LineTo(167.5, 214.5);
resultIntersect.LineTo(188, 214.5);
resultIntersect.LineTo(188, 235);
resultIntersect.LineTo(199.146, 235);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(233, 160);
resultUnite.CurveTo(233, 189.867, 219.906, 216.676, 199.146, 235);
resultUnite.LineTo(208.5, 235);
resultUnite.LineTo(208.5, 255.5);
resultUnite.LineTo(188, 255.5);
resultUnite.LineTo(188, 276);
resultUnite.LineTo(167.5, 276);
resultUnite.LineTo(167.5, 255.5);
resultUnite.LineTo(162.75, 255.5);
resultUnite.CurveTo(153.353, 258.424, 143.36, 260, 133, 260);
resultUnite.CurveTo(77.7715, 260, 33, 215.228, 33, 160);
resultUnite.CurveTo(33, 104.772, 77.7715, 60, 133, 60);
resultUnite.CurveTo(188.228, 60, 233, 104.772, 233, 160);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(233, 160);
resultSubtract.CurveTo(233, 189.867, 219.906, 216.676, 199.146, 235);
resultSubtract.LineTo(188, 235);
resultSubtract.LineTo(188, 214.5);
resultSubtract.LineTo(167.5, 214.5);
resultSubtract.LineTo(167.5, 235);
resultSubtract.LineTo(147, 235);
resultSubtract.LineTo(147, 255.5);
resultSubtract.LineTo(162.75, 255.5);
resultSubtract.CurveTo(153.353, 258.424, 143.36, 260, 133, 260);
resultSubtract.CurveTo(77.7715, 260, 33, 215.228, 33, 160);
resultSubtract.CurveTo(33, 104.772, 77.7715, 60, 133, 60);
resultSubtract.CurveTo(188.228, 60, 233, 104.772, 233, 160);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, TriangleIntersEllipse)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(227, 157);
path1.LineTo(327, 357);
path1.LineTo(127, 257);
path1.LineTo(227, 157);
path1.CloseFigure();
path2.AddEllipse(64, 119, 200, 200);
resultIntersect.StartFigure();
resultIntersect.MoveTo(227, 157);
resultIntersect.LineTo(263.419, 229.839);
resultIntersect.CurveTo(260.127, 260.386, 243.078, 286.812, 218.593, 302.797);
resultIntersect.LineTo(127, 257);
resultIntersect.LineTo(227, 157);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(263.419, 229.839);
resultUnite.LineTo(327, 357);
resultUnite.LineTo(218.593, 302.797);
resultUnite.CurveTo(202.897, 313.044, 184.144, 319, 164, 319);
resultUnite.CurveTo(108.772, 319, 64, 274.228, 64, 219);
resultUnite.CurveTo(64, 163.772, 108.772, 119, 164, 119);
resultUnite.CurveTo(219.228, 119, 264, 163.772, 264, 219);
resultUnite.CurveTo(264, 222.662, 263.803, 226.279, 263.419, 229.839);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(263.419, 229.839);
resultSubtract.LineTo(327, 357);
resultSubtract.LineTo(218.593, 302.797);
resultSubtract.CurveTo(243.078, 286.812, 260.127, 260.386, 263.419, 229.839);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, TwoVerticesInters)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(-300, -300);
path1.LineTo(-100, -300);
path1.LineTo(-100, -100);
path1.LineTo(-300, -100);
path1.LineTo(-300, -300);
path1.CloseFigure();
path2.StartFigure();
path2.MoveTo(-100, -200);
path2.LineTo(0, 0);
path2.LineTo(-200, -100);
path2.LineTo(-100, -200);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(-100, -200);
resultIntersect.LineTo(-100, -100);
resultIntersect.LineTo(-200, -100);
resultIntersect.LineTo(-100, -200);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(-300, -300);
resultUnite.LineTo(-100, -300);
resultUnite.LineTo(-100, -200);
resultUnite.LineTo(0, 0);
resultUnite.LineTo(-200, -100);
resultUnite.LineTo(-300, -100);
resultUnite.LineTo(-300, -300);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(-300, -300);
resultSubtract.LineTo(-100, -300);
resultSubtract.LineTo(-100, -200);
resultSubtract.LineTo(-200, -100);
resultSubtract.LineTo(-300, -100);
resultSubtract.LineTo(-300, -300);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, RectIntersEllipse)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(60, 45);
path1.LineTo(260, 45);
path1.LineTo(260, 245);
path1.LineTo(60, 245);
path1.LineTo(60, 45);
path1.CloseFigure();
path2.AddEllipse(138, 147, 128, 128);
resultIntersect.StartFigure();
resultIntersect.MoveTo(260, 183.908);
resultIntersect.LineTo(260, 238.092);
resultIntersect.CurveTo(258.883, 240.478, 257.623, 242.785, 256.232, 245);
resultIntersect.LineTo(147.768, 245);
resultIntersect.CurveTo(141.579, 235.149, 138, 223.493, 138, 211);
resultIntersect.CurveTo(138, 175.654, 166.654, 147, 202, 147);
resultIntersect.CurveTo(227.663, 147, 249.798, 162.105, 260, 183.908);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(60, 45);
resultUnite.LineTo(260, 45);
resultUnite.LineTo(260, 183.908);
resultUnite.CurveTo(263.849, 192.136, 266, 201.317, 266, 211);
resultUnite.CurveTo(266, 220.683, 263.849, 229.864, 260, 238.092);
resultUnite.LineTo(260, 245);
resultUnite.LineTo(256.232, 245);
resultUnite.CurveTo(244.91, 263.021, 224.854, 275, 202, 275);
resultUnite.CurveTo(179.146, 275, 159.09, 263.021, 147.768, 245);
resultUnite.LineTo(60, 245);
resultUnite.LineTo(60, 45);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(60, 45);
resultSubtract.LineTo(260, 45);
resultSubtract.LineTo(260, 183.908);
resultSubtract.CurveTo(249.798, 162.105, 227.663, 147, 202, 147);
resultSubtract.CurveTo(166.654, 147, 138, 175.654, 138, 211);
resultSubtract.CurveTo(138, 223.493, 141.579, 235.149, 147.768, 245);
resultSubtract.LineTo(60, 245);
resultSubtract.LineTo(60, 45);
resultSubtract.MoveTo(260, 238.092);
resultSubtract.LineTo(260, 245);
resultSubtract.LineTo(256.232, 245);
resultSubtract.CurveTo(257.623, 242.785, 258.883, 240.478, 260, 238.092);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, RectIntersCross)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(-147, -176);
path1.LineTo(53, -176);
path1.LineTo(53, 24);
path1.LineTo(-147, 24);
path1.LineTo(-147, -176);
path1.CloseFigure();
path2.StartFigure();
path2.MoveTo(-171, -111);
path2.LineTo(-89.5, -111);
path2.LineTo(-89.5, -192.5);
path2.LineTo(-8, -192.5);
path2.LineTo(-8, -111);
path2.LineTo(73.5, -111);
path2.LineTo(73.5, -29.5);
path2.LineTo(-8, -29.5);
path2.LineTo(-8, 52);
path2.LineTo(-89.5, 52);
path2.LineTo(-89.5, -29.5);
path2.LineTo(-171, -29.5);
path2.LineTo(-171, -111);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(-89.5, -176);
resultIntersect.LineTo(-8, -176);
resultIntersect.LineTo(-8, -111);
resultIntersect.LineTo(53, -111);
resultIntersect.LineTo(53, -29.5);
resultIntersect.LineTo(-8, -29.5);
resultIntersect.LineTo(-8, 24);
resultIntersect.LineTo(-89.5, 24);
resultIntersect.LineTo(-89.5, -29.5);
resultIntersect.LineTo(-147, -29.5);
resultIntersect.LineTo(-147, -111);
resultIntersect.LineTo(-89.5, -111);
resultIntersect.LineTo(-89.5, -176);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(-147, -176);
resultUnite.LineTo(-89.5, -176);
resultUnite.LineTo(-89.5, -192.5);
resultUnite.LineTo(-8, -192.5);
resultUnite.LineTo(-8, -176);
resultUnite.LineTo(53, -176);
resultUnite.LineTo(53, -111);
resultUnite.LineTo(73.5, -111);
resultUnite.LineTo(73.5, -29.5);
resultUnite.LineTo(53, -29.5);
resultUnite.LineTo(53, 24);
resultUnite.LineTo(-8, 24);
resultUnite.LineTo(-8, 52);
resultUnite.LineTo(-89.5, 52);
resultUnite.LineTo(-89.5, 24);
resultUnite.LineTo(-147, 24);
resultUnite.LineTo(-147, -29.5);
resultUnite.LineTo(-171, -29.5);
resultUnite.LineTo(-171, -111);
resultUnite.LineTo(-147, -111);
resultUnite.LineTo(-147, -176);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(-147, -176);
resultSubtract.LineTo(-89.5, -176);
resultSubtract.LineTo(-89.5, -111);
resultSubtract.LineTo(-147, -111);
resultSubtract.LineTo(-147, -176);
resultSubtract.MoveTo(-8, -176);
resultSubtract.LineTo(53, -176);
resultSubtract.LineTo(53, -111);
resultSubtract.LineTo(-8, -111);
resultSubtract.LineTo(-8, -176);
resultSubtract.MoveTo(53, -29.5);
resultSubtract.LineTo(53, 24);
resultSubtract.LineTo(-8, 24);
resultSubtract.LineTo(-8, -29.5);
resultSubtract.LineTo(53, -29.5);
resultSubtract.MoveTo(-89.5, 24);
resultSubtract.LineTo(-147, 24);
resultSubtract.LineTo(-147, -29.5);
resultSubtract.LineTo(-89.5, -29.5);
resultSubtract.LineTo(-89.5, 24);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, CrossIntersTriangle)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(-93, -87);
path1.LineTo(-2.5, -87);
path1.LineTo(-2.5, -177.5);
path1.LineTo(88, -177.5);
path1.LineTo(88, -87);
path1.LineTo(178.5, -87);
path1.LineTo(178.5, 3.5);
path1.LineTo(88, 3.5);
path1.LineTo(88, 94);
path1.LineTo(-2.5, 94);
path1.LineTo(-2.5, 3.5);
path1.LineTo(-93, 3.5);
path1.LineTo(-93, -87);
path1.CloseFigure();
path2.StartFigure();
path2.MoveTo(36, -193);
path2.LineTo(181, 97);
path2.LineTo(-109, -48);
path2.LineTo(36, -193);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(-70, -87);
resultIntersect.LineTo(-2.5, -87);
resultIntersect.LineTo(-2.5, -154.5);
resultIntersect.LineTo(20.5, -177.5);
resultIntersect.LineTo(43.75, -177.5);
resultIntersect.LineTo(88, -89);
resultIntersect.LineTo(88, -87);
resultIntersect.LineTo(89, -87);
resultIntersect.LineTo(134.25, 3.5);
resultIntersect.LineTo(88, 3.5);
resultIntersect.LineTo(88, 50.5);
resultIntersect.LineTo(-2.5, 5.25);
resultIntersect.LineTo(-2.5, 3.5);
resultIntersect.LineTo(-6, 3.5);
resultIntersect.LineTo(-93, -40);
resultIntersect.LineTo(-93, -64);
resultIntersect.LineTo(-70, -87);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(-93, -87);
resultUnite.LineTo(-70, -87);
resultUnite.LineTo(-2.5, -154.5);
resultUnite.LineTo(-2.5, -177.5);
resultUnite.LineTo(20.5, -177.5);
resultUnite.LineTo(36, -193);
resultUnite.LineTo(43.75, -177.5);
resultUnite.LineTo(88, -177.5);
resultUnite.LineTo(88, -89);
resultUnite.LineTo(89, -87);
resultUnite.LineTo(178.5, -87);
resultUnite.LineTo(178.5, 3.5);
resultUnite.LineTo(134.25, 3.5);
resultUnite.LineTo(181, 97);
resultUnite.LineTo(88, 50.5);
resultUnite.LineTo(88, 94);
resultUnite.LineTo(-2.5, 94);
resultUnite.LineTo(-2.5, 5.25);
resultUnite.LineTo(-6, 3.5);
resultUnite.LineTo(-93, 3.5);
resultUnite.LineTo(-93, -40);
resultUnite.LineTo(-109, -48);
resultUnite.LineTo(-93, -64);
resultUnite.LineTo(-93, -87);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(-93, -87);
resultSubtract.LineTo(-70, -87);
resultSubtract.LineTo(-93, -64);
resultSubtract.LineTo(-93, -87);
resultSubtract.MoveTo(-2.5, -154.5);
resultSubtract.LineTo(-2.5, -177.5);
resultSubtract.LineTo(20.5, -177.5);
resultSubtract.LineTo(-2.5, -154.5);
resultSubtract.MoveTo(43.75, -177.5);
resultSubtract.LineTo(88, -177.5);
resultSubtract.LineTo(88, -89);
resultSubtract.LineTo(43.75, -177.5);
resultSubtract.MoveTo(89, -87);
resultSubtract.LineTo(178.5, -87);
resultSubtract.LineTo(178.5, 3.5);
resultSubtract.LineTo(134.25, 3.5);
resultSubtract.LineTo(89, -87);
resultSubtract.MoveTo(88, 50.5);
resultSubtract.LineTo(88, 94);
resultSubtract.LineTo(-2.5, 94);
resultSubtract.LineTo(-2.5, 5.25);
resultSubtract.LineTo(88, 50.5);
resultSubtract.MoveTo(-6, 3.5);
resultSubtract.LineTo(-93, 3.5);
resultSubtract.LineTo(-93, -40);
resultSubtract.LineTo(-6, 3.5);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, CrossIntersCross)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(-161, -129);
path1.LineTo(-99, -129);
path1.LineTo(-99, -191);
path1.LineTo(-37, -191);
path1.LineTo(-37, -129);
path1.LineTo(25, -129);
path1.LineTo(25, -67);
path1.LineTo(-37, -67);
path1.LineTo(-37, -5);
path1.LineTo(-99, -5);
path1.LineTo(-99, -67);
path1.LineTo(-161, -67);
path1.LineTo(-161, -129);
path1.CloseFigure();
path2.StartFigure();
path2.MoveTo(-172, -191);
path2.LineTo(-122, -191);
path2.LineTo(-122, -241);
path2.LineTo(-72, -241);
path2.LineTo(-72, -191);
path2.LineTo(-22, -191);
path2.LineTo(-22, -141);
path2.LineTo(-72, -141);
path2.LineTo(-72, -91);
path2.LineTo(-122, -91);
path2.LineTo(-122, -141);
path2.LineTo(-172, -141);
path2.LineTo(-172, -191);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(-122, -129);
resultIntersect.LineTo(-99, -129);
resultIntersect.LineTo(-99, -191);
resultIntersect.LineTo(-72, -191);
resultIntersect.LineTo(-37, -191);
resultIntersect.LineTo(-37, -141);
resultIntersect.LineTo(-72, -141);
resultIntersect.LineTo(-72, -91);
resultIntersect.LineTo(-122, -91);
resultIntersect.LineTo(-122, -129);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(-161, -129);
resultUnite.LineTo(-122, -129);
resultUnite.LineTo(-122, -141);
resultUnite.LineTo(-172, -141);
resultUnite.LineTo(-172, -191);
resultUnite.LineTo(-122, -191);
resultUnite.LineTo(-122, -241);
resultUnite.LineTo(-72, -241);
resultUnite.LineTo(-72, -191);
resultUnite.LineTo(-37, -191);
resultUnite.LineTo(-22, -191);
resultUnite.LineTo(-22, -141);
resultUnite.LineTo(-37, -141);
resultUnite.LineTo(-37, -129);
resultUnite.LineTo(25, -129);
resultUnite.LineTo(25, -67);
resultUnite.LineTo(-37, -67);
resultUnite.LineTo(-37, -5);
resultUnite.LineTo(-99, -5);
resultUnite.LineTo(-99, -67);
resultUnite.LineTo(-161, -67);
resultUnite.LineTo(-161, -129);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(-161, -129);
resultSubtract.LineTo(-122, -129);
resultSubtract.LineTo(-122, -91);
resultSubtract.LineTo(-72, -91);
resultSubtract.LineTo(-72, -141);
resultSubtract.LineTo(-37, -141);
resultSubtract.LineTo(-37, -129);
resultSubtract.LineTo(25, -129);
resultSubtract.LineTo(25, -67);
resultSubtract.LineTo(-37, -67);
resultSubtract.LineTo(-37, -5);
resultSubtract.LineTo(-99, -5);
resultSubtract.LineTo(-99, -67);
resultSubtract.LineTo(-161, -67);
resultSubtract.LineTo(-161, -129);
resultSubtract.MoveTo(-72, -191);
resultSubtract.LineTo(-37, -191);
resultSubtract.LineTo(-72, -191);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, EllipseTouchEllipse)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.AddEllipse(43, 88, 200, 200);
path2.AddEllipse(45, 117, 120, 120);
resultIntersect.StartFigure();
resultIntersect.MoveTo(165, 177);
resultIntersect.CurveTo(165, 210.137, 138.137, 237, 105, 237);
resultIntersect.CurveTo(71.8629, 237, 45, 210.137, 45, 177);
resultIntersect.CurveTo(45, 143.863, 71.8629, 117, 105, 117);
resultIntersect.CurveTo(138.137, 117, 165, 143.863, 165, 177);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(243, 188);
resultUnite.CurveTo(243, 243.228, 198.228, 288, 143, 288);
resultUnite.CurveTo(87.7715, 288, 43, 243.228, 43, 188);
resultUnite.CurveTo(43, 132.772, 87.7715, 88, 143, 88);
resultUnite.CurveTo(198.228, 88, 243, 132.772, 243, 188);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(243, 188);
resultSubtract.CurveTo(243, 243.228, 198.228, 288, 143, 288);
resultSubtract.CurveTo(87.7715, 288, 43, 243.228, 43, 188);
resultSubtract.CurveTo(43, 132.772, 87.7715, 88, 143, 88);
resultSubtract.CurveTo(198.228, 88, 243, 132.772, 243, 188);
resultSubtract.MoveTo(165, 177);
resultSubtract.CurveTo(165, 143.863, 138.137, 117, 105, 117);
resultSubtract.CurveTo(71.8629, 117, 45, 143.863, 45, 177);
resultSubtract.CurveTo(45, 210.137, 71.8629, 237, 105, 237);
resultSubtract.CurveTo(138.137, 237, 165, 210.137, 165, 177);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);
}
TEST(BooleanOperations, TriangleOverlapTriangle)
{
Aggplus::CGraphicsPath path1, path2, resultIntersect, resultUnite, resultSubtract;
path1.StartFigure();
path1.MoveTo(-200, -300);
path1.LineTo(-100, -100);
path1.LineTo(-300, -200);
path1.LineTo(-200, -300);
path1.CloseFigure();
path2.StartFigure();
path2.MoveTo(-181, -291);
path2.LineTo(-81, -91);
path2.LineTo(-281, -191);
path2.LineTo(-181, -291);
path2.CloseFigure();
resultIntersect.StartFigure();
resultIntersect.MoveTo(-190.667, -281.333);
resultIntersect.LineTo(-100.333, -100.667);
resultIntersect.LineTo(-281, -191);
resultIntersect.LineTo(-190.667, -281.333);
resultIntersect.CloseFigure();
resultUnite.StartFigure();
resultUnite.MoveTo(-200, -300);
resultUnite.LineTo(-190.667, -281.333);
resultUnite.LineTo(-181, -291);
resultUnite.LineTo(-81, -91);
resultUnite.LineTo(-100.333, -100.667);
resultUnite.LineTo(-100, -100);
resultUnite.LineTo(-300, -200);
resultUnite.LineTo(-200, -300);
resultUnite.CloseFigure();
resultSubtract.StartFigure();
resultSubtract.MoveTo(-200, -300);
resultSubtract.LineTo(-190.667, -281.333);
resultSubtract.LineTo(-281, -191);
resultSubtract.LineTo(-100.333, -100.667);
resultSubtract.LineTo(-100, -100);
resultSubtract.LineTo(-300, -200);
resultSubtract.LineTo(-200, -300);
resultSubtract.CloseFigure();
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Intersection) == resultIntersect);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Union) == resultUnite);
EXPECT_TRUE(Aggplus::CalcBooleanOperation(path1, path2, Aggplus::Subtraction) == resultSubtract);

View File

@ -0,0 +1,9 @@
#include "../../pro/Graphics.h"
int main(int argc, char *argv[])
{
Aggplus::CImage img(L"C:\\Users\\KProkhorov\\Work\\core\\DesktopEditor\\graphics\\tests\\testHeic\\image1.heic");
img.SaveFile(L"C:\\Users\\KProkhorov\\Work\\core\\DesktopEditor\\graphics\\tests\\testHeic\\image1.bmp", 1);
return 0;
}

View File

@ -0,0 +1,24 @@
QT -= core
QT -= gui
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
CORE_ROOT_DIR = $$PWD/../../../..
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
ADD_DEPENDENCY(kernel, graphics, UnicodeConverter)
GRAPHICS_AGG_PATH = $$PWD/../../../agg-2.4
INCLUDEPATH += \
$$GRAPHICS_AGG_PATH/include
SOURCES += main.cpp
DESTDIR = $$PWD_ROOT_DIR/build/$$CORE_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX

View File

@ -44,6 +44,10 @@
#include "PICT/PICFile.h"
#endif
#if CXIMAGE_SUPPORT_HEIF
#include "heif/heif.h"
#endif
#include <cmath>
#define BGRA_FRAME_CXIMAGE_MAX_MEMORY 67108864 // 256Mb (*4 channel)
@ -444,11 +448,18 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
#endif
#if CXIMAGE_SUPPORT_PIC
if (CXIMAGE_FORMAR_PIC == m_nFileType)
{
PICT::CPictFile PIC;
return PIC.Open(this, strFileName, !m_bIsRGBA);
}
if (CXIMAGE_FORMAR_PIC == m_nFileType)
{
PICT::CPictFile PIC;
return PIC.Open(this, strFileName, !m_bIsRGBA);
}
#endif
#if CXIMAGE_SUPPORT_HEIF
if (CXIMAGE_FORMAT_HEIF == m_nFileType)
{
return NSHeif::CHeifFile::Open(this, strFileName);
}
#endif
NSFile::CFileBinary oFile;
@ -534,6 +545,13 @@ bool CBgraFrame::Decode(BYTE* pBuffer, int nSize, unsigned int nFileType)
}
#endif
#if CXIMAGE_SUPPORT_HEIF
if (CXIMAGE_FORMAT_HEIF == m_nFileType)
{
return NSHeif::CHeifFile::Open(this, pBuffer, nSize);
}
#endif
CxImage img;
if (!img.Decode(pBuffer, nSize, m_nFileType))
@ -562,28 +580,32 @@ bool CBgraFrame::SaveFile(const std::wstring& strFileName, unsigned int nFileTyp
return res;
}
else
#endif
#if CXIMAGE_SUPPORT_HEIF
if (CXIMAGE_FORMAT_HEIF == nFileType)
{
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(strFileName))
return false;
CxImage img;
if (!img.CreateFromArray(m_pData, m_lWidth, m_lHeight, lBitsPerPixel * 8, lStride, (m_lStride >= 0) ? true : false, !m_bIsRGBA))
return false;
if (m_pPalette)
{
img.SetPalette((RGBQUAD*)m_pPalette, m_lPaletteColors);
}
if (!img.Encode(oFile.GetFileNative(), nFileType))
return false;
oFile.CloseFile();
return NSHeif::CHeifFile::Save(m_pData, m_lWidth, m_lHeight, m_lStride, strFileName);
}
#endif
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(strFileName))
return false;
CxImage img;
if (!img.CreateFromArray(m_pData, m_lWidth, m_lHeight, lBitsPerPixel * 8, lStride, (m_lStride >= 0) ? true : false, !m_bIsRGBA))
return false;
if (m_pPalette)
{
img.SetPalette((RGBQUAD*)m_pPalette, m_lPaletteColors);
}
if (!img.Encode(oFile.GetFileNative(), nFileType))
return false;
oFile.CloseFile();
return true;
}
bool CBgraFrame::Encode(BYTE*& pBuffer, int& nSize, unsigned int nFileType)

View File

@ -32,6 +32,9 @@
#include "ImageFileFormatChecker.h"
#include "../common/File.h"
#include "../cximage/CxImage/ximacfg.h"
#if CXIMAGE_SUPPORT_HEIF
#include "heif/heif.h"
#endif
#ifndef IMAGE_CHECKER_DISABLE_XML
#include "../xml/include/xmlutils.h"
@ -432,6 +435,15 @@ bool CImageFileFormatChecker::isPicFile(BYTE *pBuffer, DWORD dwBytes)
return false;
}
bool CImageFileFormatChecker::isHeifFile(BYTE* pBuffer, DWORD dwBytes)
{
#if CXIMAGE_SUPPORT_HEIF
return NSHeif::CHeifFile::isHeif(pBuffer, dwBytes);
#else
return false;
#endif
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CImageFileFormatChecker::isImageFile(const std::wstring& fileName)
{
@ -554,6 +566,10 @@ bool CImageFileFormatChecker::isImageFile(const std::wstring& fileName)
{
eFileType = _CXIMAGE_FORMAT_PIC;
}
else if (isHeifFile(fileName))
{
eFileType = _CXIMAGE_FORMAT_HEIF;
}
///////////////////////////////////////////////////////////////////////
delete [] buffer;
@ -669,6 +685,10 @@ bool CImageFileFormatChecker::isImageFile(BYTE* buffer, DWORD sizeRead)
{
eFileType = _CXIMAGE_FORMAT_PIC;
}
if (isHeifFile(buffer, sizeRead))
{
eFileType = _CXIMAGE_FORMAT_HEIF;
}
///////////////////////////////////////////////////////////////////////
if (eFileType) return true;
return false;
@ -786,6 +806,14 @@ bool CImageFileFormatChecker::isSvgFile(const std::wstring& fileName)
return bFind;
#endif
}
bool CImageFileFormatChecker::isHeifFile(const std::wstring& fileName)
{
#if CXIMAGE_SUPPORT_HEIF
return NSHeif::CHeifFile::isHeif(fileName);
#else
return false;
#endif
}
std::wstring CImageFileFormatChecker::DetectFormatByData(BYTE *Data, int DataSize)
{

View File

@ -63,6 +63,7 @@ enum __ENUM_CXIMAGE_FORMATS
_CXIMAGE_FORMAT_SVM = 23,
_CXIMAGE_FORMAT_SVG = 24,
_CXIMAGE_FORMAT_PIC = 25,
_CXIMAGE_FORMAT_HEIF = 26,
};
class GRAPHICS_DECL CImageFileFormatChecker
@ -82,6 +83,7 @@ public:
bool isRawFile(const std::wstring& fileName);
bool isSvgFile(const std::wstring& fileName);
bool isHeifFile(const std::wstring& fileName);
bool isImageFile(BYTE* pBuffer,DWORD dwBytes);
bool isBmpFile(BYTE* pBuffer,DWORD dwBytes);
@ -111,6 +113,7 @@ public:
bool isSvgFile(BYTE* pBuffer,DWORD dwBytes);
bool isRawFile(BYTE* pBuffer,DWORD dwBytes);
bool isPicFile(BYTE* pBuffer,DWORD dwBytes);
bool isHeifFile(BYTE* pBuffer, DWORD dwBytes);
std::wstring DetectFormatByData(BYTE *Data, int DataSize);

View File

@ -79,9 +79,9 @@ bool CSvgFile::GetBounds(double &dX, double &dY, double &dWidth, double &dHeight
else
dHeight = m_oContainer.GetViewBox().m_oHeight.ToDouble(NSCSS::Pixel);
if (0. == dWidth)
if (DBL_EPSILON > dWidth)
dWidth = SVG_FILE_WIDTH;
if (0. == dHeight)
if (DBL_EPSILON > dHeight)
dHeight = SVG_FILE_HEIGHT;
return true;

View File

@ -260,6 +260,8 @@ namespace SVG
{
oSecondPoint = Point{arValues[arValues.size() - 2], arValues[arValues.size() - 1]};
arValues.erase(arValues.end() - 2, arValues.end());
return new CLineElement(oSecondPoint + oTranslatePoint);
}

View File

@ -697,12 +697,18 @@ int AquirePixelsMemory(ImagePICT* image)
return 0;
}
image->m_nPixelsSize = image->m_nHeight * image->m_nWidth * image->number_channels;
int nPixelsSize_new = image->m_nHeight * image->m_nWidth * image->number_channels;
if (image->ppixels == NULL)
image->ppixels = (unsigned char*) malloc(image->m_nPixelsSize);
else
image->ppixels = (unsigned char*) realloc(image->ppixels, image->m_nPixelsSize);
{
image->ppixels = (unsigned char*)malloc(nPixelsSize_new);
memset(image->ppixels, 0xff, nPixelsSize_new);
}
else if (nPixelsSize_new != image->m_nPixelsSize)
{
image->ppixels = (unsigned char*)realloc(image->ppixels, nPixelsSize_new);
}
image->m_nPixelsSize = nPixelsSize_new;
return 1;
}

View File

@ -0,0 +1,154 @@
#include "heif.h"
#include "../../common/File.h"
#include <functional>
#define CONCAT_IMPL(x, y) x##y
#define CONCAT(x, y) CONCAT_IMPL(x, y)
#define defer(code) Defer CONCAT(_defer_, __COUNTER__)([&](){code;})
class Defer {
std::function<void()> func;
public:
explicit Defer(std::function<void()> func) : func(func) {}
~Defer() { func(); }
};
namespace NSHeif {
NSUnicodeConverter::CUnicodeConverter CHeifFile::m_oConverter{};
bool CHeifFile::isHeif(const std::wstring& fileName)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
return !IsError(heif_context_read_from_file(ctx, m_oConverter.fromUnicode(fileName, "UTF-8").c_str(), nullptr));
}
bool CHeifFile::isHeif(BYTE* buffer, DWORD size)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
return !IsError(heif_context_read_from_memory_without_copy(ctx, buffer, size, nullptr));
}
bool CHeifFile::Open(CBgraFrame *frame, const std::wstring& fileName)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
if (IsError(heif_context_read_from_file(ctx, m_oConverter.fromUnicode(fileName, "UTF-8").c_str(), nullptr)))
return false;
return Decode(ctx, frame);
}
bool CHeifFile::Open(CBgraFrame *frame, BYTE* buffer, DWORD size)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
if (IsError(heif_context_read_from_memory_without_copy(ctx, buffer, size, nullptr)))
return false;
return Decode(ctx, frame);
}
bool CHeifFile::Save(const BYTE* source, int width, int height, int sourceStride, const std::wstring& dstPath)
{
if (!source)
return false;
heif_image* img;
defer(heif_image_release(img););
if (IsError(heif_image_create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_RGB, &img)))
return false;
if (IsError(heif_image_add_plane(img, heif_channel_interleaved, width, height, 24)))
return false;
int stride;
BYTE* data = heif_image_get_plane(img, heif_channel_interleaved, &stride);
if (!data || stride == 0)
return false;
for (size_t i = 0; i < height; ++i)
{
const BYTE* row = source + (height - i - 1) * (sourceStride < 0 ? -sourceStride : sourceStride);
for (size_t j = 0; j < width; ++j)
{
data[(i * width + j) * 3 + 0] = row[(width - j - 1) * 4 + 2];
data[(i * width + j) * 3 + 1] = row[(width - j - 1) * 4 + 1];
data[(i * width + j) * 3 + 2] = row[(width - j - 1) * 4 + 0];
}
}
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
heif_encoder* encoder;
defer(heif_encoder_release(encoder););
if (IsError(heif_context_get_encoder_for_format(ctx, heif_compression_HEVC, &encoder)))
return false;
if (IsError(heif_context_encode_image(ctx, img, encoder, nullptr, nullptr)))
return false;
if (IsError(heif_context_write_to_file(ctx, m_oConverter.fromUnicode(dstPath, "UTF-8").c_str())))
return false;
return true;
}
inline bool CHeifFile::IsError(heif_error err)
{
return err.code != heif_error_Ok;
}
inline bool CHeifFile::Decode(heif_context* ctx, CBgraFrame* frame)
{
heif_image_handle* handle;
defer(heif_image_handle_release(handle););
if (IsError(heif_context_get_primary_image_handle(ctx, &handle)))
return false;
heif_image* img;
defer(heif_image_release(img););
if (IsError(heif_decode_image(handle, &img, heif_colorspace_RGB, heif_chroma_444, nullptr)))
return false;
int width = heif_image_get_primary_width(img);
int height = heif_image_get_primary_height(img);
int stride_R, stride_G, stride_B;
const BYTE* source_R = heif_image_get_plane_readonly(img, heif_channel_R, &stride_R);
const BYTE* source_G = heif_image_get_plane_readonly(img, heif_channel_G, &stride_G);
const BYTE* source_B = heif_image_get_plane_readonly(img, heif_channel_B, &stride_B);
if (stride_R == 0 || !source_R)
return false;
BYTE* data = new BYTE[4 * width * height];
frame->put_Width(width);
frame->put_Height(height);
frame->put_Stride(4 * width);
frame->put_Data(data);
for (size_t i = 0; i < height; ++i)
{
const BYTE* row_R = source_R + i * stride_R;
const BYTE* row_G = source_G + i * stride_G;
const BYTE* row_B = source_B + i * stride_B;
for (size_t j = 0; j < width; ++j)
{
data[(i * width + j) * 4 + 0] = row_B[j];
data[(i * width + j) * 4 + 1] = row_G[j];
data[(i * width + j) * 4 + 2] = row_R[j];
data[(i * width + j) * 4 + 3] = 255;
}
}
return true;
}
}

View File

@ -0,0 +1,22 @@
#include "../BgraFrame.h"
#include "../../Common/3dParty/heif/libheif/libheif/api/libheif/heif.h"
#include "../../UnicodeConverter/UnicodeConverter.h"
namespace NSHeif {
class GRAPHICS_DECL CHeifFile {
private:
CHeifFile() = delete;
public:
static bool isHeif(const std::wstring& fileName);
static bool isHeif(BYTE* buffer, DWORD size);
static bool Open(CBgraFrame* frame, const std::wstring& fileName);
static bool Open(CBgraFrame* frame, BYTE* buffer, DWORD size);
static bool Save(const BYTE* source, int width, int height, int sourceStride, const std::wstring& dstPath);
private:
static bool IsError(heif_error err);
static bool Decode(heif_context* ctx, CBgraFrame* frame);
static NSUnicodeConverter::CUnicodeConverter m_oConverter;
};
}

View File

@ -220,7 +220,8 @@ namespace NSDocxRenderer
m_oCurrVectorGraphics,
m_oClipVectorGraphics,
m_lClipMode,
lType);
lType,
m_oBrush.m_oGradientInfo.checkLuminosity());
if (new_vector_graphics.IsEmpty())
{

View File

@ -1100,16 +1100,15 @@ namespace NSDocxRenderer
// WriteRecord WriteXfrm
oWriter.StartRecord(0);
oWriter.WriteBYTE(kBin_g_nodeAttributeStart);
oWriter.WriteBYTE(0); oWriter.AddInt(static_cast<unsigned int>(left * c_dMMToEMU));
oWriter.WriteBYTE(1); oWriter.AddInt(static_cast<unsigned int>(top * c_dMMToEMU));
oWriter.WriteBYTE(2); oWriter.AddInt(static_cast<unsigned int>(width * c_dMMToEMU));
oWriter.WriteBYTE(3); oWriter.AddInt(static_cast<unsigned int>(height * c_dMMToEMU));
oWriter.WriteBYTE(0); oWriter.AddSInt(static_cast<int>(left * c_dMMToEMU));
oWriter.WriteBYTE(1); oWriter.AddSInt(static_cast<int>(top * c_dMMToEMU));
oWriter.WriteBYTE(2); oWriter.AddSInt(static_cast<int>(width * c_dMMToEMU));
oWriter.WriteBYTE(3); oWriter.AddSInt(static_cast<int>(height * c_dMMToEMU));
if (fabs(m_dRotation) > c_dMIN_ROTATION)
{
double degree = m_dRotation;
if (m_dRotation < 0) degree = 360.0 - m_dRotation;
oWriter.WriteBYTE(10); oWriter.AddInt(degree * c_dDegreeToAngle);
int degree = static_cast<int>(m_dRotation * c_dDegreeToAngle);
oWriter.WriteBYTE(10); oWriter.AddSInt(degree);
}
oWriter.WriteBYTE(kBin_g_nodeAttributeEnd);
oWriter.EndRecord();

View File

@ -319,10 +319,10 @@ namespace NSDocxRenderer
// c_nStroke = 0x0001;
// c_nWindingFillMode = 0x0100;
// c_nEvenOddFillMode = 0x0200;
CVectorGraphics CVectorGraphics::CalcBoolean(const CVectorGraphics& vg1, const CVectorGraphics& vg2, long clipType, long fillType)
CVectorGraphics CVectorGraphics::CalcBoolean(const CVectorGraphics& vg1, const CVectorGraphics& vg2, long clipType, long fillType, bool isLuminosity)
{
auto op = GetOpType(clipType);
Aggplus::CGraphicsPath result = Aggplus::CalcBooleanOperation(vg1.GetGraphicsPath(), vg2.GetGraphicsPath(), op, fillType);
Aggplus::CGraphicsPath result = Aggplus::CalcBooleanOperation(vg1.GetGraphicsPath(), vg2.GetGraphicsPath(), op, fillType, isLuminosity);
return CVectorGraphics(result);
}

View File

@ -80,7 +80,7 @@ namespace NSDocxRenderer
void Transform(const Aggplus::CMatrix& matrix);
void DrawOnRenderer(IRenderer* renderer) const noexcept;
static CVectorGraphics CalcBoolean(const CVectorGraphics& vg1, const CVectorGraphics& vg2, long clipType, long fillType = c_nWindingFillMode);
static CVectorGraphics CalcBoolean(const CVectorGraphics& vg1, const CVectorGraphics& vg2, long clipType, long fillType = c_nWindingFillMode, bool isLuminosity = false);
private:
std::list<CPathCommand> m_arData;

View File

@ -3,7 +3,8 @@
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/xml/include/xmlutils.h"
#include "../../HtmlFile2/htmlfile2.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/common/Path.h"
#include "../../DesktopEditor/common/ProcessEnv.h"
#include "src/CBookInfo.h"
#include <iostream>
@ -158,10 +159,17 @@ HRESULT CEpubFile::Convert(const std::wstring& sInputFile, const std::wstring& s
oFile.SetCoreDirectory(NSFile::GetDirectoryName(sContent));
std::vector<std::wstring> arFiles;
for (const CBookContentItem& oContent : m_arContents)
{
std::wstring sFile = m_mapRefs[oContent.m_sID].GetRef();
std::wstring sFile = NSSystemPath::ShortenPath(m_mapRefs[oContent.m_sID].GetRef());
replace_all(sFile, L"%20", L" ");
if (sFile.length() > 3 && L'.' == sFile[0] && L'.' == sFile[1] && L'/' == sFile[2] &&
NSProcessEnv::IsPresent(NSProcessEnv::Converter::gc_allowPrivateIP) &&
!NSProcessEnv::GetBoolValue(NSProcessEnv::Converter::gc_allowPrivateIP))
continue;
arFiles.push_back(m_sTempDir + ((!sContentPath.empty()) ? (L"/" + sContentPath) : L"" ) + L"/" + sFile);
}

View File

@ -153,6 +153,17 @@ std::wstring EncodeXmlString(const std::wstring& s)
return sRes;
}
enum class EParagraphPropertie
{
Sup,
Sub,
Strikethrough,
Emphasis,
Strong
};
typedef std::vector<EParagraphPropertie> ParagraphProperties;
class CFb2File_Private
{
public:
@ -175,6 +186,8 @@ private:
bool m_bInNote;
bool m_bInTable;
ParagraphProperties m_arParagraphProperties;
// STitleInfo* m_pSrcTitleInfo; // Данные об исходнике книги
// SPublishInfo* m_pPublishInfo; // Сведения об издании книги
// std::map<std::wstring, std::wstring> m_mCustomInfo; // Произвольная информация
@ -221,6 +234,58 @@ public:
return m_oLightReader.ReadNextNode() && m_oLightReader.GetName() == L"FictionBook";
}
void OpenP(NSStringUtils::CStringBuilder& oBuilder)
{
if (m_bInP || m_bInTable)
return;
oBuilder.WriteString(L"<p>");
m_bInP = true;
}
void CloseP(NSStringUtils::CStringBuilder& oBuilder)
{
if (!m_bInP || m_bInTable)
return;
oBuilder.WriteString(L"</p>");
m_bInP = false;
}
void WriteText(NSStringUtils::CStringBuilder& oBuilder, const std::wstring& wsText, const std::vector<EParagraphPropertie>& arPProperties)
{
if (wsText.end() == std::find_if_not(wsText.begin(), wsText.end(), [](wchar_t wchChar){ return iswspace(wchChar) && 0xa0 != wchChar;}))
return;
OpenP(oBuilder);
for (const EParagraphPropertie ePropertie : arPProperties)
{
switch(ePropertie)
{
case EParagraphPropertie::Sup: oBuilder.WriteString(L"<sup>"); break;
case EParagraphPropertie::Sub: oBuilder.WriteString(L"<sub>"); break;
case EParagraphPropertie::Strikethrough: oBuilder.WriteString(L"<strikethrough>"); break;
case EParagraphPropertie::Emphasis: oBuilder.WriteString(L"<emphasis>"); break;
case EParagraphPropertie::Strong: oBuilder.WriteString(L"<strong>"); break;
}
}
oBuilder.WriteEncodeXmlString(wsText);
for (ParagraphProperties::const_reverse_iterator itPropertie = arPProperties.crbegin(); itPropertie != arPProperties.crend(); ++itPropertie)
{
switch(*itPropertie)
{
case EParagraphPropertie::Sup: oBuilder.WriteString(L"</sup>"); break;
case EParagraphPropertie::Sub: oBuilder.WriteString(L"</sub>"); break;
case EParagraphPropertie::Strikethrough: oBuilder.WriteString(L"</strikethrough>"); break;
case EParagraphPropertie::Emphasis: oBuilder.WriteString(L"</emphasis>"); break;
case EParagraphPropertie::Strong: oBuilder.WriteString(L"</strong>"); break;
}
}
}
// Читает image
// НЕ имеет право писать p
void readImage(NSStringUtils::CStringBuilder& oBuilder)
@ -1449,7 +1514,7 @@ public:
// html -> fb2
void readStream(NSStringUtils::CStringBuilder& oXml)
void readStream(NSStringUtils::CStringBuilder& oXml, ParagraphProperties& arPProperties)
{
int nDepth = m_oLightReader.GetDepth();
if (m_oLightReader.IsEmptyNode() || !m_oLightReader.ReadNextSiblingNode2(nDepth))
@ -1458,7 +1523,7 @@ public:
{
std::wstring sName = m_oLightReader.GetName();
if (sName == L"#text")
oXml.WriteEncodeXmlString(m_oLightReader.GetText());
WriteText(oXml, m_oLightReader.GetText(), arPProperties);
else if (sName == L"br" && !m_bInTable)
{
bool bPBB = false, bCBB = false;
@ -1501,26 +1566,18 @@ public:
m_oLightReader.MoveToElement();
if (m_bFootnote && !sFootnoteName.empty())
{
readStream(oFootnote);
readStream(oFootnote, arPProperties);
m_mFootnotes.insert(std::make_pair(sFootnoteName, oFootnote.GetData()));
m_bFootnote = false;
}
else
readStream(oXml);
readStream(oXml, arPProperties);
}
else if (sName == L"p")
{
if (!m_bInTable && !m_bInP)
{
oXml.WriteString(L"<p>");
m_bInP = true;
}
readStream(oXml);
if (!m_bInTable && m_bInP)
{
oXml.WriteString(L"</p>");
m_bInP = false;
}
OpenP(oXml);
readStream(oXml, arPProperties);
CloseP(oXml);
}
else if (sName == L"title")
{
@ -1564,7 +1621,7 @@ public:
bInH = true;
m_bInP = true;
}
readStream(oXml);
readStream(oXml, arPProperties);
if (bInH)
{
oXml.WriteString(L"</p></title>");
@ -1590,52 +1647,55 @@ public:
sAlign = sStyle.substr(nAlign + 1, (nAlignEnd < sStyle.length() ? nAlignEnd : sStyle.length()) - nAlign);
if (sAlign == L"super")
{
oXml.WriteString(L"<sup>");
readStream(oXml);
oXml.WriteString(L"</sup>");
arPProperties.push_back(EParagraphPropertie::Sup);
readStream(oXml, arPProperties);
arPProperties.pop_back();
}
else if (sAlign == L"sub")
{
oXml.WriteString(L"<sub>");
readStream(oXml);
oXml.WriteString(L"</sub>");
arPProperties.push_back(EParagraphPropertie::Sub);
readStream(oXml, arPProperties);
arPProperties.pop_back();
}
else
readStream(oXml);
readStream(oXml, arPProperties);
}
else
readStream(oXml);
readStream(oXml, arPProperties);
}
else if (sName == L"s")
{
oXml.WriteString(L"<strikethrough>");
readStream(oXml);
oXml.WriteString(L"</strikethrough>");
arPProperties.push_back(EParagraphPropertie::Strikethrough);
readStream(oXml, arPProperties);
arPProperties.pop_back();
}
else if (sName == L"i")
{
oXml.WriteString(L"<emphasis>");
readStream(oXml);
oXml.WriteString(L"</emphasis>");
arPProperties.push_back(EParagraphPropertie::Emphasis);
readStream(oXml, arPProperties);
arPProperties.pop_back();
}
else if (sName == L"b")
{
oXml.WriteString(L"<strong>");
readStream(oXml);
oXml.WriteString(L"</strong>");
arPProperties.push_back(EParagraphPropertie::Strong);
readStream(oXml, arPProperties);
arPProperties.pop_back();
}
else if (sName == L"table")
{
oXml.WriteString(L"<table>");
m_bInTable = true;
readStream(oXml);
ParagraphProperties arTableProperties;
readStream(oXml, arTableProperties);
oXml.WriteString(L"</table>");
m_bInTable = false;
}
else if (sName == L"tr")
{
oXml.WriteString(L"<tr>");
readStream(oXml);
readStream(oXml, arPProperties);
oXml.WriteString(L"</tr>");
}
else if (sName == L"td" || sName == L"th")
@ -1650,7 +1710,7 @@ public:
}
m_oLightReader.MoveToElement();
oXml.WriteString(L">");
readStream(oXml);
readStream(oXml, arPProperties);
oXml.WriteString(L"</td>");
}
else if (sName == L"a")
@ -1690,13 +1750,13 @@ public:
m_oLightReader.MoveToElement();
oXml.WriteString(L">");
readStream(oXml);
readStream(oXml, arPProperties);
oXml.WriteString(L"</a>");
}
else if (sName == L"ul")
readLi(oXml, true);
readLi(oXml, true, arPProperties);
else if (sName == L"ol")
readLi(oXml, false);
readLi(oXml, false, arPProperties);
else if (sName == L"img")
{
std::wstring sId, sBinary;
@ -1716,11 +1776,11 @@ public:
oXml.WriteString(L"<image l:href=\"#img" + sId + L".png\"/>");
}
else
readStream(oXml);
readStream(oXml, arPProperties);
} while (m_oLightReader.ReadNextSiblingNode2(nDepth));
}
void readLi(NSStringUtils::CStringBuilder& oXml, bool bUl)
void readLi(NSStringUtils::CStringBuilder& oXml, bool bUl, ParagraphProperties& arProperties)
{
int nNum = 1;
while (m_oLightReader.MoveToNextAttribute())
@ -1734,9 +1794,8 @@ public:
{
if (m_oLightReader.GetName() == L"li")
{
if (!m_bInP)
oXml.WriteString(L"<p>");
m_bInP = true;
OpenP(oXml);
if (bUl)
oXml.AddCharSafe(183);
else
@ -1773,10 +1832,9 @@ public:
oXml.WriteString(sPoint);
}
oXml.WriteString(L" ");
readStream(oXml);
if (m_bInP)
oXml.WriteString(L"</p>");
m_bInP = false;
readStream(oXml, arProperties);
CloseP(oXml);
}
} while (m_oLightReader.ReadNextSiblingNode2(nDeath));
}
@ -2113,6 +2171,7 @@ HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sD
//XmlUtils::CXmlLiteReader oIndexHtml;
std::wstring xhtml = htmlToXhtml(sContent, bNeedConvert);
if (!m_internal->m_oLightReader.FromString(xhtml))
return S_FALSE;
@ -2123,7 +2182,8 @@ HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sD
//std::vector<std::wstring> arrBinary;
NSStringUtils::CStringBuilder oDocument;
m_internal->readStream(oDocument);
ParagraphProperties arProperties;
m_internal->readStream(oDocument, arProperties);
NSStringUtils::CStringBuilder oRes;
oRes.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\"?><FictionBook xmlns=\"http://www.gribuser.ru/xml/fictionbook/2.0\" xmlns:l=\"http://www.w3.org/1999/xlink\">");

View File

@ -265,6 +265,7 @@ struct CTextSettings
bool bMergeText; // Объединять подяр идущий текст в 1?
int nLi; // Уровень списка
bool bNumberingLi; // Является ли список нумерованным
bool bWritedLi; // Записан ли уже w:numPr
std::wstring sPStyle;
@ -278,12 +279,12 @@ struct CTextSettings
NSCSS::CCompiledStyle oAdditionalStyle;
CTextSettings()
: bBdo(false), bPre(false), bQ(false), bAddSpaces(true), bMergeText(false), nLi(-1), bNumberingLi(false), eTextMode(Normal)
: bBdo(false), bPre(false), bQ(false), bAddSpaces(true), bMergeText(false), nLi(-1), bNumberingLi(false), bWritedLi(false), eTextMode(Normal)
{}
CTextSettings(const CTextSettings& oTS) :
bBdo(oTS.bBdo), bPre(oTS.bPre), bQ(oTS.bQ), bAddSpaces(oTS.bAddSpaces), bMergeText(oTS.bMergeText),
nLi(oTS.nLi),bNumberingLi(oTS.bNumberingLi), sPStyle(oTS.sPStyle), eTextMode(oTS.eTextMode)
nLi(oTS.nLi), bNumberingLi(oTS.bNumberingLi), bWritedLi(oTS.bWritedLi), sPStyle(oTS.sPStyle), eTextMode(oTS.eTextMode)
{}
void AddPStyle(const std::wstring& wsStyle)
@ -3962,6 +3963,7 @@ private:
m_oLightReader.MoveToElement();
oTSLiP.nLi++;
oTSLiP.bWritedLi = false;
if (!wsValue.empty())
{
@ -4230,7 +4232,7 @@ private:
CloseP(oXml, sSelectors);
}
bool readImage (NSStringUtils::CStringBuilder* oXml, std::vector<NSCSS::CNode>& sSelectors, const CTextSettings& oTS)
bool readImage (NSStringUtils::CStringBuilder* oXml, std::vector<NSCSS::CNode>& sSelectors, CTextSettings& oTS)
{
std::wstring wsAlt, sSrcM;
bool bRes = false;
@ -4355,7 +4357,7 @@ private:
return true;
}
std::wstring wrP(NSStringUtils::CStringBuilder* oXml, std::vector<NSCSS::CNode>& sSelectors, const CTextSettings& oTS)
std::wstring wrP(NSStringUtils::CStringBuilder* oXml, std::vector<NSCSS::CNode>& sSelectors, CTextSettings& oTS)
{
OpenP(oXml);
@ -4386,8 +4388,18 @@ private:
}
if (oTS.nLi >= 0)
oXml->WriteString(L"<w:numPr><w:ilvl w:val=\"" + std::to_wstring(oTS.nLi) + L"\"/><w:numId w:val=\"" +
(!oTS.bNumberingLi ? L"1" : std::to_wstring(m_nNumberingId + 1)) + L"\"/></w:numPr>");
{
if (!oTS.bWritedLi)
{
oXml->WriteString(L"<w:numPr><w:ilvl w:val=\"" + std::to_wstring(oTS.nLi) + L"\"/><w:numId w:val=\"" +
(!oTS.bNumberingLi ? L"1" : std::to_wstring(m_nNumberingId + 1)) + L"\"/></w:numPr>");
oTS.bWritedLi = true;
}
else if (sSelectors.back().m_pCompiledStyle->m_oText.GetIndent().Empty() &&
oTS.oAdditionalStyle.m_oText.GetIndent().Empty())
oXml->WriteString(L"<w:ind w:left=\"" + std::to_wstring(720 * (oTS.nLi + 1)) + L"\"/>");
}
oXml->WriteString(oTS.sPStyle + sPSettings);
oXml->WriteNodeEnd(L"w:pPr");

View File

@ -99,8 +99,8 @@ SOURCES += \
HEADERS += \
HWPFile.h \
HwpDoc/Common/Common.h \
HwpDoc/Common/XMLNode.h \
HwpDoc/Common/WriterContext.h \
HwpDoc/Common/XMLReader.h \
HwpDoc/Conversion/ConversionState.h \
HwpDoc/Conversion/Converter2OOXML.h \
HwpDoc/Conversion/FootnoteConverter.h \

View File

@ -1,25 +0,0 @@
#ifndef XMLNODEH_H
#define XMLNODEH_H
#include "../../../DesktopEditor/xml/include/xmlutils.h"
namespace HWP
{
class CXMLNode : public XmlUtils::CXmlNode
{
public:
CXMLNode();
CXMLNode(const XmlUtils::CXmlNode& oNode);
bool GetAttributeBool(const std::wstring& wsName);
int GetAttributeColor(const std::wstring& wsName, const int& _default = 0x00000000);
CXMLNode GetChild(const std::wstring& wsName);
std::vector<CXMLNode> GetChilds();
std::vector<CXMLNode> GetChilds(const std::wstring& wsName);
};
int ConvertWidthToHWP(const std::wstring& wsValue);
int ConvertHexToInt(const std::string& wsValue, const int& _default = 0x00000000);
}
#endif // XMLNODEH_H

View File

@ -1,86 +1,300 @@
#include "XMLNode.h"
#include "XMLReader.h"
#include <cmath>
#include <cctype>
namespace HWP
{
CXMLNode::CXMLNode()
: XmlUtils::CXmlNode()
CXMLReader::CXMLReader()
: m_pReader(new XmlUtils::CXmlLiteReader), m_bParseAttribute(false)
{}
CXMLNode::CXMLNode(const CXmlNode& oNode)
: XmlUtils::CXmlNode(oNode)
{}
bool CXMLNode::GetAttributeBool(const std::wstring& wsName)
CXMLReader::~CXMLReader()
{
return L"1" == XmlUtils::CXmlNode::GetAttribute(wsName, L"0");
if (nullptr != m_pReader)
delete m_pReader;
}
int CXMLNode::GetAttributeColor(const std::wstring& wsName, const int& _default)
XmlUtils::CXmlLiteReader* CXMLReader::GetReader()
{
return ConvertHexToInt(XmlUtils::CXmlNode::GetAttributeA(wsName), _default);
return m_pReader;
}
CXMLNode CXMLNode::GetChild(const std::wstring& wsName)
unsigned int CXMLReader::GetDepth()
{
return CXMLNode(XmlUtils::CXmlNode::GetNode(wsName));
return (nullptr != m_pReader) ? m_pReader->GetDepth() : 0;
}
std::vector<CXMLNode> CXMLNode::GetChilds()
bool CXMLReader::IsEmptyNode()
{
std::vector<XmlUtils::CXmlNode> arChilds;
XmlUtils::CXmlNode::GetChilds(arChilds);
std::vector<CXMLNode> arNewChilds(arChilds.size());
for (unsigned int unIndex = 0; unIndex < arChilds.size(); ++unIndex)
arNewChilds[unIndex] = CXMLNode(arChilds[unIndex]);
return arNewChilds;
return (nullptr != m_pReader) ? m_pReader->IsEmptyNode() : true;
}
std::vector<CXMLNode> CXMLNode::GetChilds(const std::wstring& wsName)
bool CXMLReader::GetBool()
{
std::vector<XmlUtils::CXmlNode> arChilds{XmlUtils::CXmlNode::GetNodes(wsName)};
std::vector<CXMLNode> arNewChilds(arChilds.size());
for (unsigned int unIndex = 0; unIndex < arChilds.size(); ++unIndex)
arNewChilds[unIndex] = CXMLNode(arChilds[unIndex]);
return arNewChilds;
return "1" == GetTextAValue(*this);
}
int ConvertWidthToHWP(const std::wstring& wsValue)
int CXMLReader::GetColor(const int& nDefault)
{
if (wsValue.empty() || L"0.1" == wsValue || L"0.1 mm" == wsValue)
return ConvertHexToInt(GetTextAValue(*this), nDefault);
}
int CXMLReader::GetInt()
{
return GetIntValue(*this);
}
double CXMLReader::GetDouble()
{
return GetDoubleValue(*this);
}
std::string CXMLReader::GetTextA()
{
if (nullptr == m_pReader)
return std::string();
return (m_bParseAttribute) ? m_pReader->GetTextA() : m_pReader->GetText2A();
}
std::wstring CXMLReader::GetText()
{
if (nullptr == m_pReader)
return std::wstring();
return (m_bParseAttribute) ? m_pReader->GetText() : m_pReader->GetText2();
}
const char* CXMLReader::GetTextChar()
{
if (nullptr == m_pReader)
return "";
return m_pReader->GetTextChar();
}
template<typename T>
T CXMLReader::GetAttribute(const std::string& sName, T _default, T (*GetValue)(CXMLReader&))
{
if (!MoveToFirstAttribute())
return _default;
T oValue = _default;
do
{
if (sName == m_pReader->GetNameA())
{
oValue = GetValue(*this);
break;
}
}while(m_pReader->MoveToNextAttribute());
MoveToElement();
return oValue;
}
int CXMLReader::GetAttributeInt(const std::string& sName, int nDefault)
{
return GetAttribute<int>(sName, nDefault, &GetIntValue);
}
bool CXMLReader::GetAttributeBool(const std::string& sName)
{
return GetAttribute<bool>(sName, false, &GetBoolValue);
}
double CXMLReader::GetAttributeDouble(const std::string& sName)
{
return GetAttribute<double>(sName, 0., &GetDoubleValue);
}
std::string CXMLReader::GetAttributeA(const std::string& sName)
{
return GetAttribute<std::string>(sName, "", &GetTextAValue);
}
std::wstring CXMLReader::GetAttribute(const std::string& sName)
{
return GetAttribute<std::wstring>(sName, L"", &GetTextValue);
}
bool CXMLReader::MoveToFirstAttribute()
{
if (nullptr == m_pReader || !m_pReader->MoveToFirstAttribute())
return false;
m_bParseAttribute = true;
return true;
}
bool CXMLReader::MoveToNextAttribute()
{
return (nullptr != m_pReader) ? m_pReader->MoveToNextAttribute() : false;
}
bool CXMLReader::MoveToElement()
{
if (nullptr == m_pReader || !m_pReader->MoveToElement())
return false;
m_bParseAttribute = false;
return true;
}
std::wstring CXMLReader::GetInnerXml()
{
return m_pReader->GetInnerXml();
}
std::string CXMLReader::GetName()
{
return (nullptr != m_pReader) ? m_pReader->GetNameA() : std::string();
}
bool CXMLReader::ReadNextSiblingNode(unsigned int unDepth)
{
return (nullptr != m_pReader) ? m_pReader->ReadNextSiblingNode(unDepth) : false;
}
bool CXMLReader::ReadNextNode()
{
return (nullptr != m_pReader) ? m_pReader->ReadNextNode() : false;
}
bool CXMLReader::Read(XmlUtils::XmlNodeType& eNodeType)
{
return (nullptr != m_pReader) ? m_pReader->Read(eNodeType) : false;
}
int CXMLReader::GetIntValue(CXMLReader& oXmlReader)
{
return std::atoi(oXmlReader.GetTextA().c_str());
}
bool CXMLReader::GetBoolValue(CXMLReader& oXmlReader)
{
return "1" == oXmlReader.GetTextA();
}
double CXMLReader::GetDoubleValue(CXMLReader& oXmlReader)
{
const std::string sValue{oXmlReader.GetTextA()};
const char* pCur = sValue.c_str();
while (std::isspace(*pCur))
++pCur;
if (!pCur)
return 0.;
bool bNegative = false;
while ('-' == *pCur || '+' == *pCur)
{
if ('-' == *pCur)
bNegative = !bNegative;
++pCur;
}
if (!pCur)
return 0.;
double dResult = 0.;
while (std::isdigit(*pCur))
dResult = dResult * 10. + (*pCur++ - '0');
if (',' == *pCur || '.' == *pCur)
{
++pCur;
double dFraction = 0.0;
double dDivisor = 1.0;
while (std::isdigit(*pCur))
{
dFraction = dFraction * 10. + (*pCur++ - '0');
dDivisor *= 10;
}
dResult += dFraction / dDivisor;
}
if ('e' == *pCur || 'E' == *pCur)
{
++pCur;
bool bExpNegative = false;
while ('-' == *pCur || '+' == *pCur)
{
if ('-' == *pCur)
bExpNegative = !bExpNegative;
++pCur;
}
int nExponent = 0;
while (std::isdigit(*pCur))
nExponent = nExponent * 10 + (*pCur++ - '0');
if (bExpNegative)
nExponent = -nExponent;
dResult *= std::pow(10., nExponent);
}
return bNegative ? -dResult : dResult;
}
std::string CXMLReader::GetTextAValue(CXMLReader& oXmlReader)
{
return oXmlReader.GetTextA();
}
std::wstring CXMLReader::GetTextValue(CXMLReader& oXmlReader)
{
return oXmlReader.GetText();
}
int ConvertWidthToHWP(const std::string& sValue)
{
if (sValue.empty() || "0.1" == sValue || "0.1 mm" == sValue)
return 0;
else if (L"0.12" == wsValue || L"0.12 mm" == wsValue)
else if ("0.12" == sValue || "0.12 mm" == sValue)
return 1;
else if (L"0.15" == wsValue || L"0.15 mm" == wsValue)
else if ("0.15" == sValue || "0.15 mm" == sValue)
return 2;
else if (L"0.2" == wsValue || L"0.2 mm" == wsValue)
else if ("0.2" == sValue || "0.2 mm" == sValue)
return 3;
else if (L"0.25" == wsValue || L"0.25 mm" == wsValue)
else if ("0.25" == sValue || "0.25 mm" == sValue)
return 4;
else if (L"0.3" == wsValue || L"0.3 mm" == wsValue)
else if ("0.3" == sValue || "0.3 mm" == sValue)
return 5;
else if (L"0.4" == wsValue || L"0.4 mm" == wsValue)
else if ("0.4" == sValue || "0.4 mm" == sValue)
return 6;
else if (L"0.5" == wsValue || L"0.5 mm" == wsValue)
else if ("0.5" == sValue || "0.5 mm" == sValue)
return 7;
else if (L"0.6" == wsValue || L"0.6 mm" == wsValue)
else if ("0.6" == sValue || "0.6 mm" == sValue)
return 8;
else if (L"0.7" == wsValue || L"0.7 mm" == wsValue)
else if ("0.7" == sValue || "0.7 mm" == sValue)
return 9;
else if (L"1.0" == wsValue || L"1.0 mm" == wsValue)
else if ("1.0" == sValue || "1.0 mm" == sValue)
return 10;
else if (L"1.5" == wsValue || L"1.5 mm" == wsValue)
else if ("1.5" == sValue || "1.5 mm" == sValue)
return 11;
else if (L"2.0" == wsValue || L"2.0 mm" == wsValue)
else if ("2.0" == sValue || "2.0 mm" == sValue)
return 12;
else if (L"3.0" == wsValue || L"3.0 mm" == wsValue)
else if ("3.0" == sValue || "3.0 mm" == sValue)
return 13;
else if (L"4.0" == wsValue || L"4.0 mm" == wsValue)
else if ("4.0" == sValue || "4.0 mm" == sValue)
return 14;
else if (L"5.0" == wsValue || L"5.0 mm" == wsValue)
else if ("5.0" == sValue || "5.0 mm" == sValue)
return 15;
return 0;

View File

@ -0,0 +1,110 @@
#ifndef XMLNODEH_H
#define XMLNODEH_H
#include "../../../DesktopEditor/xml/include/xmlutils.h"
namespace HWP
{
class CXMLReader
{
XmlUtils::CXmlLiteReader *m_pReader;
bool m_bParseAttribute;
public:
CXMLReader();
~CXMLReader();
XmlUtils::CXmlLiteReader* GetReader();
unsigned int GetDepth();
bool IsEmptyNode();
bool GetBool();
int GetColor(const int& nDefault = 0x000000);
int GetInt();
double GetDouble();
std::string GetTextA();
std::wstring GetText();
const char* GetTextChar();
int GetAttributeInt(const std::string& sName, int nDefault = 0);
bool GetAttributeBool(const std::string& sName);
double GetAttributeDouble(const std::string& sName);
std::string GetAttributeA(const std::string& sName);
std::wstring GetAttribute(const std::string& sName);
bool MoveToFirstAttribute();
bool MoveToNextAttribute();
bool MoveToElement();
std::wstring GetInnerXml();
std::string GetName();
bool ReadNextSiblingNode(unsigned int unDepth);
bool ReadNextNode();
bool Read(XmlUtils::XmlNodeType& eNodeType);
private:
static int GetIntValue(CXMLReader& oXmlReader);
static bool GetBoolValue(CXMLReader& oXmlReader);
static double GetDoubleValue(CXMLReader& oXmlReader);
static std::string GetTextAValue(CXMLReader& oXmlReader);
static std::wstring GetTextValue(CXMLReader& oXmlReader);
template<typename T>
T GetAttribute(const std::string& sName, T _default, T (*GetValue)(CXMLReader& oXmlReader));
};
#define WHILE_READ_NEXT_NODE_WITH_DEPTH(xml_reader, name_depth)\
if (!xml_reader.IsEmptyNode())\
{\
const int n##name_depth = xml_reader.GetDepth();\
while (xml_reader.ReadNextSiblingNode(n##name_depth))\
{
#define WHILE_READ_NEXT_NODE_WITH_DEPTH_AND_NAME(xml_reader, name_depth)\
if (!xml_reader.IsEmptyNode())\
{\
const int n##name_depth##Depth = xml_reader.GetDepth();\
std::string sNode##name_depth##Name;\
while (xml_reader.ReadNextSiblingNode(n##name_depth##Depth))\
{\
sNode##name_depth##Name = xml_reader.GetName();
#define WHILE_READ_NEXT_NODE(xml_reader) WHILE_READ_NEXT_NODE_WITH_DEPTH(xml_reader, Depth)
#define WHILE_READ_NEXT_NODE_WITH_NAME(xml_reader)\
if (!xml_reader.IsEmptyNode())\
{\
const int nDepth = xml_reader.GetDepth();\
std::string sNodeName;\
while (xml_reader.ReadNextSiblingNode(nDepth))\
{\
sNodeName = xml_reader.GetName();
#define WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(xml_reader, name_depth, node_name)\
WHILE_READ_NEXT_NODE_WITH_DEPTH(xml_reader, name_depth)\
if (node_name != xml_reader.GetName())\
continue;
#define WHILE_READ_NEXT_NODE_WITH_ONE_NAME(xml_reader, node_name) WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(xml_reader, Depth, node_name)
#define END_WHILE } }
#define START_READ_ATTRIBUTES(xml_reader)\
if (xml_reader.MoveToFirstAttribute())\
{\
std::string sAttributeName;\
do\
{\
sAttributeName = xml_reader.GetName();
#define END_READ_ATTRIBUTES(xml_reader)\
}\
while(xml_reader.MoveToNextAttribute());\
xml_reader.MoveToElement();\
}
int ConvertWidthToHWP(const std::string& sValue);
int ConvertHexToInt(const std::string& sValue, const int& _default = 0x00000000);
}
#endif // XMLNODEH_H

View File

@ -18,7 +18,27 @@ struct TConversionState
bool m_bOpenedR;
bool m_bIsNote;
bool m_bInTable;
bool m_bLastEmptyNode;
struct TLastNode
{
unsigned int m_unParaIndex;
enum class ELastNodeType
{
Empty,
Paragraph,
Table
} m_eType;
TLastNode()
: m_unParaIndex(0), m_eType(ELastNodeType::Empty)
{}
void Clear()
{
m_unParaIndex = 0;
m_eType = ELastNodeType::Empty;
}
} m_oLastNode;
bool m_bInTextBox; // TODO:: используется, чтобы в wps:txbx не появилась новая фигура (посмотреть этот момент нужно подробнее)
@ -47,7 +67,7 @@ struct TConversionState
std::map<unsigned int, const CCtrlField*> m_mOpenField;
TConversionState()
: m_bOpenedP(false), m_bOpenedR(false), m_bIsNote(false), m_bInTable(false), m_bLastEmptyNode(false), m_bInTextBox(false), m_ushLastCharShapeId(-1), m_ushSecdIndex(0), m_unParaIndex(0),
: m_bOpenedP(false), m_bOpenedR(false), m_bIsNote(false), m_bInTable(false), m_bInTextBox(false), m_ushLastCharShapeId(-1), m_ushSecdIndex(0), m_unParaIndex(0),
m_pSectionDef(nullptr), m_pColumnDef(nullptr), m_pPageNum(nullptr), m_pNewNumber(nullptr), m_pRelationships(nullptr), m_eBreakType(EBreakType::None)
{}
};

View File

@ -5,10 +5,9 @@
#include "../../../DesktopEditor/common/File.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/SystemUtils.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include "../../../DesktopEditor/graphics/pro/Graphics.h"
#include "../../../DesktopEditor/graphics/pro/Image.h"
#include "../Paragraph/ParaText.h"
#include "../Paragraph/CtrlTable.h"
@ -23,7 +22,6 @@
#include "Transform.h"
#define PARA_SPACING_SCALE 0.85
#define SPACING_SCALE_MS_WORD 1.21
namespace HWP
{
@ -283,6 +281,8 @@ void CConverter2OOXML::Convert()
m_oDocXml.WriteString(L"</w:pPr></w:p>");
++oState.m_ushSecdIndex;
oState.m_oLastNode.Clear();
}
}
@ -300,6 +300,14 @@ void CConverter2OOXML::WriteCharacter(const CCtrlCharacter* pCharacter, short sh
{
case ECtrlCharType::PARAGRAPH_BREAK:
{
// Таблицы пишутся без тега <w:p>, поэтому для них не открывается параграф
if (TConversionState::TLastNode::ELastNodeType::Table == oState.m_oLastNode.m_eType &&
oState.m_unParaIndex == oState.m_oLastNode.m_unParaIndex && !oState.m_bInTable)
{
oState.m_oLastNode.m_eType = TConversionState::TLastNode::ELastNodeType::Table;
break;
}
if (!oState.m_bOpenedP)
WriteEmptyParagraph(shParaShapeID, shParaStyleID, pCharacter->GetCharShapeId(), oBuilder, oState);
else
@ -312,6 +320,12 @@ void CConverter2OOXML::WriteCharacter(const CCtrlCharacter* pCharacter, short sh
oState.m_eBreakType = TConversionState::EBreakType::TextWrapping;
break;
}
case ECtrlCharType::TABULATION:
{
OpenParagraph(shParaShapeID, shParaStyleID, oBuilder, oState);
oBuilder.WriteString(L"<w:r><w:tab/></w:r>");
break;
}
case ECtrlCharType::HARD_HYPHEN:
case ECtrlCharType::HARD_SPACE:
break;
@ -369,6 +383,9 @@ void CConverter2OOXML::WriteShape(const CCtrlGeneralShape* pShape, short shParaS
void CConverter2OOXML::WriteNote(const CCtrlNote* pNote, short shParaShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
{
if (nullptr == pNote)
return;
oBuilder.WriteString(L"<w:r>");
CRunnerStyle oRunnerStyle;
@ -493,7 +510,7 @@ void CConverter2OOXML::WriteCaption(const CCtrlCommon* pCtrlCommon, NSStringUtil
void CConverter2OOXML::WriteEmptyParagraph(short shParaShapeID, short shParaStyleID, short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
{
if (oState.m_bOpenedP || oState.m_bLastEmptyNode)
if (oState.m_bOpenedP)
return;
oBuilder.WriteString(L"<w:p>");
@ -504,8 +521,6 @@ void CConverter2OOXML::WriteEmptyParagraph(short shParaShapeID, short shParaStyl
oBuilder.WriteString(L"</w:pPr>");
oBuilder.WriteString(L"</w:p>");
oState.m_bLastEmptyNode = true;
}
void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
@ -537,7 +552,6 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
case ECtrlObjectType::ParaText:
{
WriteText((const CParaText*)pCtrl, pParagraph->GetRangeTags(), pParagraph->GetShapeID(), pParagraph->GetStyleID(), oBuilder, oState);
// WriteText(((const CParaText*)pCtrl)->GetText(), pParagraph->GetShapeID(), ((const CParaText*)pCtrl)->GetCharShapeID(), oBuilder, oState);
break;
}
case ECtrlObjectType::Character:
@ -602,7 +616,6 @@ void CConverter2OOXML::WriteParagraph(const CHWPPargraph* pParagraph, NSStringUt
}
CloseParagraph(oBuilder, oState);
oState.m_bLastEmptyNode = false;
}
void CConverter2OOXML::WriteParagraphProperties(short shParaShapeID, short shParaStyleID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
@ -662,6 +675,60 @@ void CConverter2OOXML::WriteParaShapeProperties(short shParaShapeID, short shPar
case EHeadingType::NONE:
break;
}
if (oState.m_bInTable)
return;
const CHwpRecordTabDef* pTabDef = m_pContext->GetTabDef(pParaShape->GetTabDef());
if (nullptr != pTabDef && 0 != pTabDef->GetCount())
{
oBuilder.WriteString(L"<w:tabs>");
const TTab *pTab = nullptr;
for (unsigned int unIndex = 0; unIndex < pTabDef->GetCount(); ++unIndex)
{
pTab = pTabDef->GetTab(unIndex);
if (nullptr == pTab)
continue;
oBuilder.WriteString(L"<w:tab w:val=\"");
switch (pTab->m_eType)
{
case TTab::EType::LEFT: oBuilder.WriteString(L"start"); break;
case TTab::EType::RIGHT: oBuilder.WriteString(L"end"); break;
case TTab::EType::CENTER: oBuilder.WriteString(L"center"); break;
case TTab::EType::DECIMAL: oBuilder.WriteString(L"decimal"); break;
}
oBuilder.WriteString(L"\" w:leader=\"");
switch (pTab->m_eLeader)
{
case ELineStyle2::NONE: oBuilder.WriteString(L"none"); break;
case ELineStyle2::SOLID:
case ELineStyle2::DOUBLE_SLIM:
case ELineStyle2::SLIM_THICK:
case ELineStyle2::THICK_SLIM:
case ELineStyle2::SLIM_THICK_SLIM:
oBuilder.WriteString(L"heavy"); break;
case ELineStyle2::DASH:
case ELineStyle2::LONG_DASH:
case ELineStyle2::DASH_DOT:
case ELineStyle2::DASH_DOT_DOT:
oBuilder.WriteString(L"hyphen"); break;
case ELineStyle2::DOT:
case ELineStyle2::CIRCLE:
oBuilder.WriteString(L"dot"); break;
}
oBuilder.WriteString(L"\" w:pos=\"" + std::to_wstring(pTab->m_nPos / 10) + L"\"/>");
}
oBuilder.WriteString(L"</w:tabs>");
}
}
void CConverter2OOXML::WriteTable(const CCtrlTable* pTable, short shParaShapeID, short shParaStyleID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
@ -669,14 +736,18 @@ void CConverter2OOXML::WriteTable(const CCtrlTable* pTable, short shParaShapeID,
if (nullptr == pTable || pTable->Empty())
return;
if (TConversionState::TLastNode::ELastNodeType::Table == oState.m_oLastNode.m_eType)
oBuilder.WriteString(L"<w:p><w:r><w:rPr><w:vanish/></w:rPr></w:r></w:p>");
CloseParagraph(oBuilder, oState);
++m_ushTableCount;
oBuilder.WriteString(L"<w:tbl>");
const bool bTableInTable = oState.m_bInTable;
oState.m_bInTable = true;
oState.m_bLastEmptyNode = false;
WriteTableProperties(pTable, shParaShapeID, shParaStyleID, oBuilder, oState);
@ -754,7 +825,10 @@ void CConverter2OOXML::WriteTable(const CCtrlTable* pTable, short shParaShapeID,
oBuilder.WriteString(L"</w:tbl>");
oState.m_bInTable = false;
oState.m_oLastNode.m_eType = TConversionState::TLastNode::ELastNodeType::Table;
oState.m_oLastNode.m_unParaIndex = oState.m_unParaIndex;
oState.m_bInTable = bTableInTable;
}
void CConverter2OOXML::WriteTableProperties(const CCtrlTable* pTable, short shParaShapeID, short shParaStyleID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
@ -778,8 +852,6 @@ void CConverter2OOXML::WriteTableProperties(const CCtrlTable* pTable, short shPa
oBuilder.WriteString(L"</w:tblCellMar>");
}
oBuilder.WriteString(L"<w:tblLayout w:type=\"fixed\"/>");
WriteParaShapeProperties(shParaShapeID, shParaStyleID, oBuilder, oState);
// const CHWPRecordBorderFill* pBorderFill = nullptr;
@ -831,8 +903,10 @@ void CConverter2OOXML::WriteCell(const CTblCell* pCell, NSStringUtils::CStringBu
for (const CHWPPargraph* pParagraph : pCell->GetParagraphs())
{
NSStringUtils::CStringBuilder oCellBuilder;
TConversionState oCellState;
oCellState.m_pRelationships = oState.m_pRelationships;
oCellState.m_bInTable = oState.m_bInTable;
WriteParagraph(pParagraph, oCellBuilder, oCellState);
@ -1218,8 +1292,8 @@ void CConverter2OOXML::WriteSectionSettings(TConversionState& oState)
else
{
m_oDocXml.WriteString(L"<w:pgSz w:w=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetWidth())) + L"\" w:h=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetHeight())) + L"\"/>");
m_oDocXml.WriteString(L"<w:pgMar w:top=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginTop())) + L"\" w:right=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginRight())) + L"\" w:bottom=\"" +
std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginBottom())) + L"\" w:left=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginRight())) + L"\" w:header=\"" +
m_oDocXml.WriteString(L"<w:pgMar w:top=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginTop() + pPage->GetMarginHeader())) + L"\" w:right=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginRight())) + L"\" w:bottom=\"" +
std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginBottom() + pPage->GetMarginFooter())) + L"\" w:left=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginRight())) + L"\" w:header=\"" +
std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginHeader())) + L"\" w:footer=\"" + std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginFooter())) + L"\" w:gutter=\"" +
std::to_wstring(Transform::HWPUINT2Twips(pPage->GetMarginGutter())) + L"\"/>");
}
@ -1347,83 +1421,18 @@ bool CConverter2OOXML::SaveSVGFile(const HWP_STRING& sSVG, HWP_STRING& sFileName
return false;
}
NSGraphics::IGraphicsRenderer* pGrRenderer = NSGraphics::Create();
pGrRenderer->SetFontManager(pSvgReader->get_FontManager());
double dX, dY, dW, dH;
pSvgReader->GetBounds(&dX, &dY, &dW, &dH);
if (dW < 0) dW = -dW;
if (dH < 0) dH = -dH;
double dOneMaxSize = (double)1000.;
if (dW > dH && dW > dOneMaxSize)
{
dH *= (dOneMaxSize / dW);
dW = dOneMaxSize;
}
else if (dH > dW && dH > dOneMaxSize)
{
dW *= (dOneMaxSize / dH);
dH = dOneMaxSize;
}
int nWidth = static_cast<int>(dW + 0.5);
int nHeight = static_cast<int>(dH + 0.5);
double dWidth = 25.4 * nWidth / 96;
double dHeight = 25.4 * nHeight / 96;
unsigned char* pBgraData = (unsigned char*)malloc(nWidth * nHeight * 4);
if (!pBgraData)
{
double dKoef = 2000.0 / (nWidth > nHeight ? nWidth : nHeight);
nWidth = (int)(dKoef * nWidth);
nHeight = (int)(dKoef * nHeight);
dWidth = 25.4 * nWidth / 96;
dHeight = 25.4 * nHeight / 96;
pBgraData = (unsigned char*)malloc(nWidth * nHeight * 4);
}
if (!pBgraData)
return false;
unsigned int alfa = 0xffffff;
//дефолтный тон должен быть прозрачным, а не белым
//memset(pBgraData, 0xff, nWidth * nHeight * 4);
for (int i = 0; i < nWidth * nHeight; i++)
{
((unsigned int*)pBgraData)[i] = alfa;
}
CBgraFrame oFrame;
oFrame.put_Data(pBgraData);
oFrame.put_Width(nWidth);
oFrame.put_Height(nHeight);
oFrame.put_Stride(-4 * nWidth);
pGrRenderer->CreateFromBgraFrame(&oFrame);
pGrRenderer->SetSwapRGB(false);
pGrRenderer->put_Width(dWidth);
pGrRenderer->put_Height(dHeight);
pSvgReader->SetTempDirectory(m_sTempDirectory);
pSvgReader->DrawOnRenderer(pGrRenderer, 0, 0, dWidth, dHeight);
sFileName = sFileName.substr(0, sFileName.find(L'.'));
sFileName += L".png";
oFrame.SaveFile(m_sTempDirectory + L"/word/media/" + sFileName, 4);
oFrame.put_Data(NULL);
const std::wstring wsImagePath{m_sTempDirectory + L"/word/media/" + sFileName};
RELEASEINTERFACE(pGrRenderer);
if (pBgraData)
free(pBgraData);
pSvgReader->ConvertToRaster(wsImagePath.c_str(), 4, dW, dH);
RELEASEINTERFACE(pSvgReader);
RELEASEINTERFACE(pFonts);
@ -1562,10 +1571,7 @@ void CConverter2OOXML::CloseDrawingNode(const CCtrlObjElement* pCtrlShape, NSStr
if (pCtrlShape->GetTreatAsChar())
oBuilder.WriteString(L"</wp:inline>");
else
{
oBuilder.WriteString(L"<wp14:sizeRelH relativeFrom=\"page\"><wp14:pctWidth>0</wp14:pctWidth></wp14:sizeRelH><wp14:sizeRelV relativeFrom=\"page\"><wp14:pctHeight>0</wp14:pctHeight></wp14:sizeRelV>");
oBuilder.WriteString(L"</wp:anchor>");
}
oBuilder.WriteString(L"</w:drawing>");
}
@ -1637,56 +1643,14 @@ void CConverter2OOXML::WriteShapeExtent(const CCtrlObjElement* pCtrlShape, NSStr
if (nullptr == pCtrlShape)
return;
double dScaleX = 1., dScaleY = 1.;
const int nOrgWidth{pCtrlShape->GetOrgWidth()}, nOrgHeight{pCtrlShape->GetOrgHeight()};
const int nCurWidth{pCtrlShape->GetCurWidth()}, nCurHeight{pCtrlShape->GetCurHeight()};
if (0 != nCurWidth && 0 != nOrgWidth)
dScaleX = (double)nCurWidth / (double)nOrgWidth;
if (0 != nCurHeight && 0 != nOrgHeight)
dScaleY = (double)nCurHeight / (double)nOrgHeight;
if (0 != pCtrlShape->GetWidth() && 0 != nCurWidth)
dScaleX *= (double)pCtrlShape->GetWidth() / (double)nCurWidth;
if (0 != pCtrlShape->GetHeight() && 0 != nCurHeight)
dScaleY *= (double)pCtrlShape->GetHeight() / (double)nCurHeight;
int nFinalWidth {pCtrlShape->GetWidth() };
int nFinalHeight{pCtrlShape->GetHeight()};
int nFinalWidth = std::abs(pCtrlShape->GetCurWidth());
int nFinalHeight = std::abs(pCtrlShape->GetCurHeight());
if (0 == nFinalWidth)
{
if (nullptr != pWidth && 0 != *pWidth)
nFinalWidth = *pWidth;
else
nFinalWidth = nCurWidth;
}
if (nullptr != pWidth && 0 != *pWidth)
dScaleX *= (double)*pWidth / (double)nFinalWidth;
nFinalWidth = pCtrlShape->GetWidth();
if (0 == nFinalHeight)
{
if (nullptr != pHeight && 0 != *pHeight)
nFinalHeight = *pHeight;
else
nFinalHeight = nCurHeight;
}
if (nullptr != pHeight && 0 != *pHeight)
dScaleY *= (double)*pHeight / (double)nFinalHeight;
TMatrix oFinalMatrix{pCtrlShape->GetFinalMatrix()};
oFinalMatrix.ApplyToSize(dScaleX, dScaleY);
nFinalWidth = ceil((double)nFinalWidth * dScaleX);
nFinalHeight = ceil((double)nFinalHeight * dScaleY);
nFinalWidth -= (pCtrlShape->GetLeftInMargin() + pCtrlShape->GetRightInMargin());
nFinalHeight -= (pCtrlShape->GetTopInMargin() + pCtrlShape->GetBottomInMargin());
nFinalHeight = pCtrlShape->GetHeight();
if (nullptr != pWidth)
*pWidth = Transform::HWPUINT2OOXML(nFinalWidth);
@ -1725,6 +1689,7 @@ void CConverter2OOXML::WriteShapeWrapMode(const CCtrlCommon* pCtrlShape, NSStrin
}
case ETextWrap::BEHIND_TEXT:
case ETextWrap::IN_FRONT_OF_TEXT:
default:
{
oBuilder.WriteString(L"<wp:wrapNone/>");
break;
@ -1739,7 +1704,6 @@ void CConverter2OOXML::OpenParagraph(short shParaShapeID, short shParaStyleID, N
oBuilder.WriteString(L"<w:p>");
oState.m_bOpenedP = true;
oState.m_bLastEmptyNode = false;
WriteParagraphProperties(shParaShapeID, shParaStyleID, oBuilder, oState);
}
@ -1750,6 +1714,9 @@ void CConverter2OOXML::CloseParagraph(NSStringUtils::CStringBuilder& oBuilder, T
oBuilder.WriteString(L"</w:p>");
oState.m_bOpenedP = false;
oState.m_oLastNode.m_unParaIndex = oState.m_unParaIndex;
oState.m_oLastNode.m_eType = TConversionState::TLastNode::ELastNodeType::Paragraph;
}
void CConverter2OOXML::WriteText(const CParaText* pParaText, const std::vector<TRangeTag>& arRangeTags, short shParaShapeID, short shParaStyleID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState)
@ -1860,10 +1827,7 @@ std::vector<std::wstring> SplitText(const std::wstring& wsText)
void CConverter2OOXML::WriteText(const HWP_STRING& wsText, short shParaShapeID, short shParaStyleID, short shCharShapeID, NSStringUtils::CStringBuilder& oBuilder, TConversionState& oState, const CRunnerStyle& oExternalStyle)
{
if (!oState.m_bOpenedP && wsText.empty())
{
WriteEmptyParagraph(shParaShapeID, shParaStyleID, shCharShapeID, oBuilder, oState);
return;
}
OpenParagraph(shParaShapeID, shParaStyleID, oBuilder, oState);
@ -2058,7 +2022,11 @@ void CConverter2OOXML::WriteAutoNumber(const CCtrlAutoNumber* pAutoNumber, short
return;
}
case ENumType::TOTAL_PAGE:
ushValue = m_ushPageCount; break;
{
OpenParagraph(shParaShapeID, shParaStyleID, oBuilder, oState);
oBuilder.WriteString(L"<w:fldSimple w:instr=\"NUMPAGES \\* ARABIC\"><w:r><w:t>1</w:t></w:r></w:fldSimple>");
return;
}
case ENumType::FOOTNOTE:
{
OpenParagraph(shParaShapeID, shParaStyleID, oBuilder, oState);

View File

@ -24,8 +24,6 @@
namespace HWP
{
struct TContentType
{
HWP_STRING m_wsName;

View File

@ -109,6 +109,9 @@ std::wstring CFootnoteConverter::CreateHeadOrFoot(const CCtrlHeadFoot* pCtrlHead
oFile.CloseFile();
if (arRelationships.empty())
return wsFileName;
// TODO:: пока это копия из Converter2OOXML
NSFile::CFileBinary oRelsWriter;
if (oRelsWriter.CreateFileW(oConverter.GetTempDirectory() + L"/word/_rels/" + wsFileName + L".rels"))

View File

@ -11,6 +11,8 @@ namespace HWP
#define DEFAULT_STYLE_NAME L"Style"
#define DEFAULT_SPACING 240
#define SPACING_SCALE_MS_WORD 1.21
#define ADD_COLOR(r, g, b, enum_value) {{r, g, b}, enum_value}
static const std::vector<std::pair<TColor, EHighlightColors>> s_arHighlightColors
@ -232,6 +234,8 @@ CRunnerStyle CStyleConverter::GenerateRunnerStyle(const CHWPRecordCharShape& oCh
oRunnerStyle.SetAscii(oCharShape.GetFontName(ELang::LATIN));
oRunnerStyle.SetEastAsia(oCharShape.GetFontName(ELang::HANGUL));
oRunnerStyle.SetRatio(oCharShape.GetRatio(ELang::LATIN));
oRunnerStyle.SetSpacing(static_cast<short>((double)oCharShape.GetSpacing(ELang::LATIN) * SPACING_SCALE_MS_WORD));
if (oCharShape.Bold())
oRunnerStyle.SetBold(true);
@ -239,9 +243,14 @@ CRunnerStyle CStyleConverter::GenerateRunnerStyle(const CHWPRecordCharShape& oCh
if (oCharShape.Italic())
oRunnerStyle.SetItalic(true);
if (oCharShape.StrikeOut())
if (oCharShape.StrikeOut() && ELineStyle2::NONE != oCharShape.GetStrikeOutType())
oRunnerStyle.SetStrike(EStrikeType::Single);
if (oCharShape.SuperScript())
oRunnerStyle.SetVerticalAlign(EVerticalAlignRun::Superscript);
else if (oCharShape.SubScript())
oRunnerStyle.SetVerticalAlign(EVerticalAlignRun::Subscript);
const int nHeight = static_cast<int>(((double)(std::abs)(oCharShape.GetHeight()) * ((double)oCharShape.GetRelSize(ELang::HANGUL) / 100.) / 100.) * 2.);
oRunnerStyle.SetSz(nHeight);
@ -275,7 +284,7 @@ CRunnerStyle CStyleConverter::GenerateRunnerStyle(const CHWPRecordCharShape& oCh
case ELineStyle1::SOLID_3D_REVERS_LI: oRunnerStyle.SetU({EUType::Thick, oCharShape.GetUnderlineColor()}); break;
}
}
else if (EUnderline::CENTER == eUnderlineType)
else if (EUnderline::CENTER == eUnderlineType && !oCharShape.StrikeOut())
{
if (eUnderlineStyle == ELineStyle1::DOUBLE_SLIM ||
eUnderlineStyle == ELineStyle1::DOUBLE_WAVE)
@ -439,6 +448,12 @@ void CStyleConverter::WriteRunnerProperties(const CRunnerStyle& oRunnerStyle, NS
if (oRunnerStyle.ColorIsSet())
oBuilder.WriteString(L"<w:color w:val=\"" + oRunnerStyle.GetColor().ToHEX() + L"\"/>");
if (oRunnerStyle.RatioIsSet() && 100 != oRunnerStyle.GetRatio())
oBuilder.WriteString(L"<w:w w:val=\"" + std::to_wstring(oRunnerStyle.GetRatio()) + L"\"/>");
if (oRunnerStyle.SpacingIsSet() && 0 != oRunnerStyle.GetSpacing())
oBuilder.WriteString(L"<w:spacing w:val=\"" + std::to_wstring(oRunnerStyle.GetSpacing()) + L"\"/>");
if (oRunnerStyle.UIsSet())
{
oBuilder.WriteString(L"<w:u w:val=\"");
@ -709,9 +724,10 @@ CRunnerStyle& CRunnerStyle::operator-=(const CRunnerStyle& oRunnerStyle)
m_nSz -= oRunnerStyle.m_nSz;
m_oColor -= oRunnerStyle.m_oColor;
m_nShadeColor -= oRunnerStyle.m_nShadeColor;
m_shRatio -= oRunnerStyle.m_shRatio;
m_oU -= oRunnerStyle.m_oU;
m_eStrike -= oRunnerStyle.m_eStrike;
m_nSpacing -= oRunnerStyle.m_nSpacing;
m_shSpacing -= oRunnerStyle.m_shSpacing;
m_oHighlight -= oRunnerStyle.m_oHighlight;
m_eVerticalAlign -= oRunnerStyle.m_eVerticalAlign;
@ -727,9 +743,10 @@ void CRunnerStyle::Clear()
m_nSz.UnSet();
m_oColor.UnSet();
m_nShadeColor.UnSet();
m_shRatio.UnSet();
m_oU.UnSet();
m_eStrike.UnSet();
m_nSpacing.UnSet();
m_shSpacing.UnSet();
m_oHighlight.UnSet();
m_eVerticalAlign.UnSet();
}
@ -737,8 +754,8 @@ void CRunnerStyle::Clear()
bool CRunnerStyle::Empty() const
{
return !m_oRFonts.m_wsAscii.IsSet() && !m_oRFonts.m_wsEastAsia.IsSet() && !m_bBold.IsSet() && !m_bItalic.IsSet() &&
!m_nSz.IsSet() && !m_oColor.IsSet() && !m_nShadeColor.IsSet() && !m_oU.IsSet() && !m_eStrike.IsSet() &&
!m_nSpacing.IsSet() && !m_oHighlight.IsSet() && !m_eVerticalAlign.IsSet();
!m_nSz.IsSet() && !m_oColor.IsSet() && !m_nShadeColor.IsSet() && !m_shRatio.IsSet() && !m_oU.IsSet() &&
!m_eStrike.IsSet() && !m_shSpacing.IsSet() && !m_oHighlight.IsSet() && !m_eVerticalAlign.IsSet();
}
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, std::wstring, Ascii, m_oRFonts.m_wsAscii);
@ -748,9 +765,10 @@ CREATE_BODY_METHODS_FOR_PROPERTY_BOOL(CRunnerStyle, Italic, m_bItalic);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, int, Sz, m_nSz);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, TColor, Color, m_oColor);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, int, ShadeColor, m_nShadeColor)
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, short, Ratio, m_shRatio)
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, TU, U, m_oU);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, EStrikeType, Strike, m_eStrike);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, int, Spacing, m_nSpacing);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, short, Spacing, m_shSpacing);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, EHighlightColors, Highlight, m_oHighlight);
CREATE_BODY_METHODS_FOR_PROPERTY(CRunnerStyle, EVerticalAlignRun, VerticalAlign, m_eVerticalAlign);

View File

@ -190,9 +190,10 @@ public:
CREATE_METHODS_FOR_PROPERTY(int, Sz);
CREATE_METHODS_FOR_PROPERTY(TColor, Color);
CREATE_METHODS_FOR_PROPERTY(int, ShadeColor);
CREATE_METHODS_FOR_PROPERTY(short, Ratio);
CREATE_METHODS_FOR_PROPERTY(TU, U);
CREATE_METHODS_FOR_PROPERTY(EStrikeType, Strike);
CREATE_METHODS_FOR_PROPERTY(int, Spacing);
CREATE_METHODS_FOR_PROPERTY(short, Spacing);
CREATE_METHODS_FOR_PROPERTY(EHighlightColors, Highlight);
CREATE_METHODS_FOR_PROPERTY(EVerticalAlignRun, VerticalAlign);
private:
@ -202,9 +203,10 @@ private:
CProperty<int> m_nSz;
CProperty<TColor> m_oColor;
CProperty<int> m_nShadeColor;
CProperty<short> m_shRatio;
CProperty<TU> m_oU;
CProperty<EStrikeType> m_eStrike;
CProperty<int> m_nSpacing;
CProperty<short> m_shSpacing;
CProperty<EHighlightColors> m_oHighlight;
CProperty<EVerticalAlignRun> m_eVerticalAlign;
};

View File

@ -182,81 +182,94 @@ bool CHWPDocInfo::Parse(CHWPStream& oBuffer, int nVersion)
return true;
}
bool CHWPDocInfo::Parse(CXMLNode& oNode, int nVersion)
bool CHWPDocInfo::Parse(CXMLReader& oReader, int nVersion)
{
for (CXMLNode& oChild : oNode.GetChilds())
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if (L"hh:beginNum" == oChild.GetName())
m_arRecords.push_back(new CHWPRecordDocumentProperties(*this, oChild, nVersion));
else if (L"hh:refList" == oChild.GetName())
ReadRefList(oChild, nVersion);
if ("hh:beginNum" == sNodeName)
m_arRecords.push_back(new CHWPRecordDocumentProperties(*this, oReader, nVersion));
else if ("hh:refList" == sNodeName)
ReadRefList(oReader, nVersion);
}
END_WHILE
return true;
}
bool CHWPDocInfo::ReadRefList(CXMLNode& oNode, int nVersion)
bool CHWPDocInfo::ReadRefList(CXMLReader& oReader, int nVersion)
{
for (CXMLNode& oChild : oNode.GetChilds())
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if (L"hh:fontfaces" == oChild.GetName())
if ("hh:fontfaces" == sNodeName)
{
for (CXMLNode& oFontFaceNode : oChild.GetChilds(L"hh:fontface"))
for (CXMLNode& oFontNode : oFontFaceNode.GetChilds(L"hh:font"))
m_arFaseNames.push_back(new CHWPRecordFaceName(*this, oFontNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, FontFace, "hh:fontface")
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Font, "hh:font")
m_arFaseNames.push_back(new CHWPRecordFaceName(*this, oReader, nVersion));
END_WHILE
END_WHILE
}
else if (L"hh:borderFills" == oChild.GetName())
else if ("hh:borderFills" == sNodeName)
{
for (CXMLNode& oBorderFillNode : oChild.GetChilds(L"hh:borderFill"))
m_arBorderFills.push_back(new CHWPRecordBorderFill(*this, oBorderFillNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, BorderFill, "hh:borderFill")
m_arBorderFills.push_back(new CHWPRecordBorderFill(*this, oReader, nVersion));
END_WHILE
}
else if (L"hh:charProperties" == oChild.GetName())
else if ("hh:charProperties" == sNodeName)
{
for (CXMLNode& oCharPrNode : oChild.GetChilds(L"hh:charPr"))
m_arCharShapes.push_back(new CHWPRecordCharShape(*this, oCharPrNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, CharPr, "hh:charPr")
m_arCharShapes.push_back(new CHWPRecordCharShape(*this, oReader, nVersion));
END_WHILE
}
else if (L"hh:tabProperties" == oChild.GetName())
else if ("hh:tabProperties" == sNodeName)
{
for (CXMLNode& oTabPrNode : oChild.GetChilds(L"hh:tabPr"))
m_arTabDefs.push_back(new CHwpRecordTabDef(*this, oTabPrNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, TabPr, "hh:tabPr")
m_arTabDefs.push_back(new CHwpRecordTabDef(*this, oReader, nVersion));
END_WHILE
}
else if (L"hh:numberings" == oChild.GetName())
else if ("hh:numberings" == sNodeName)
{
for (CXMLNode& oNumberingNode : oChild.GetChilds(L"hh:numbering"))
m_arNumberings.push_back(new CHWPRecordNumbering(*this, oNumberingNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Numbering, "hh:numbering")
m_arNumberings.push_back(new CHWPRecordNumbering(*this, oReader, nVersion));
END_WHILE
}
else if (L"hh:bullets" == oChild.GetName())
else if ("hh:bullets" == sNodeName)
{
for (CXMLNode& oBulletNode : oChild.GetChilds())
m_arBullets.push_back(new CHWPRecordBullet(*this, oBulletNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH(oReader, Bullet)
m_arBullets.push_back(new CHWPRecordBullet(*this, oReader, nVersion));
END_WHILE
}
else if (L"hh:paraProperties" == oChild.GetName())
else if ("hh:paraProperties" == sNodeName)
{
for (CXMLNode& oParaPrNode : oChild.GetChilds(L"hh:paraPr"))
m_arParaShapes.push_back(new CHWPRecordParaShape(*this, oParaPrNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, ParaPr, "hh:paraPr")
m_arParaShapes.push_back(new CHWPRecordParaShape(*this, oReader, nVersion));
END_WHILE
}
else if (L"hh:styles" == oChild.GetName())
else if ("hh:styles" == sNodeName)
{
for (CXMLNode& oStyleNode : oChild.GetChilds(L"hh:style"))
m_arStyles.push_back(new CHWPRecordStyle(*this, oStyleNode, nVersion));
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Style, "hh:style")
m_arStyles.push_back(new CHWPRecordStyle(*this, oReader, nVersion));
END_WHILE
}
}
END_WHILE
return true;
}
bool CHWPDocInfo::ReadContentHpf(CXMLNode& oNode, int nVersion)
bool CHWPDocInfo::ReadContentHpf(CXMLReader& oReader, int nVersion)
{
CHWPRecordBinData *pRecordBinData = nullptr;
for (CXMLNode& oChild : oNode.GetChilds(L"opf:manifest"))
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "opf:manifest")
{
for (CXMLNode& oGrandChild : oChild.GetChilds(L"opf:item"))
WHILE_READ_NEXT_NODE_WITH_DEPTH_ONE_NAME(oReader, Item, "opf:item")
{
pRecordBinData = new CHWPRecordBinData(oGrandChild, nVersion);
pRecordBinData = new CHWPRecordBinData(oReader, nVersion);
m_mBinDatas.insert(std::make_pair<HWP_STRING, CHWPRecord*>(pRecordBinData->GetItemID(), (HWP::CHWPRecord*)pRecordBinData));
}
END_WHILE
}
END_WHILE
return true;
}

View File

@ -4,7 +4,7 @@
#include "HanType.h"
#include "HWPStream.h"
#include "HWPElements/HWPRecord.h"
#include "Common/XMLNode.h"
#include "Common/XMLReader.h"
#include <map>
@ -46,8 +46,8 @@ public:
~CHWPDocInfo();
bool Parse(CHWPStream& oBuffer, int nVersion);
bool Parse(CXMLNode& oNode, int nVersion);
bool ReadContentHpf(CXMLNode& oNode, int nVersion);
bool Parse(CXMLReader& oReader, int nVersion);
bool ReadContentHpf(CXMLReader& oReader, int nVersion);
const CHWPRecord* GetRecord(int nIndex) const;
const CHWPRecord* GetFaceName(int nIndex) const;
@ -65,7 +65,7 @@ public:
EHanType GetHanType() const;
ECompatDoc GetCompatibleDoc() const;
private:
bool ReadRefList(CXMLNode& oNode, int nVersion);
bool ReadRefList(CXMLReader& oReader, int nVersion);
};
}

View File

@ -74,35 +74,41 @@ CHWPRecordBinData::CHWPRecordBinData(CHWPDocInfo& oDocInfo, int nTagNum, int nLe
oBuffer.Skip(nSize - oBuffer.GetDistanceToLastPos(true));
}
CHWPRecordBinData::CHWPRecordBinData(CXMLNode& oNode, int nVersion)
CHWPRecordBinData::CHWPRecordBinData(CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_BIN_DATA, 0, 0)
{
m_sItemID = oNode.GetAttribute(L"id");
std::string sType;
HWP_STRING sSubPath;
HWP_STRING sType = oNode.GetAttribute(L"isEmbeded");
START_READ_ATTRIBUTES(oReader)
{
if ("id" == sAttributeName)
m_sItemID = oReader.GetText();
else if ("isEmbeded" == sAttributeName)
sType = oReader.GetTextA();
else if ("href" == sAttributeName)
m_sAPath = oReader.GetText();
else if ("sub-path" == sAttributeName)
sSubPath = oReader.GetText();
else if ("media-type" == sAttributeName)
{
m_sFormat = oReader.GetText();
if (L"0" == sType)
std::wregex oRegex(L"image/(.*)");
m_sFormat = std::regex_replace(m_sFormat, oRegex, L"$1");
}
}
END_READ_ATTRIBUTES(oReader)
if ("0" == sType)
{
m_eType = EType::LINK;
m_sAPath = oNode.GetAttribute(L"sub-path");
if (m_sAPath.empty())
m_sAPath = oNode.GetAttribute(L"href");
if (!sSubPath.empty())
m_sAPath = sSubPath;
}
else if (L"1" == sType)
{
else if ("1" == sType)
m_eType = EType::EMBEDDING;
m_sAPath = oNode.GetAttribute(L"href");
}
else
m_sAPath = oNode.GetAttribute(L"href");
m_sFormat = oNode.GetAttribute(L"media-type");
std::wregex oRegex(L"image/(.*)");
m_sFormat = std::regex_replace(m_sFormat, oRegex, L"$1");
}
HWP_STRING CHWPRecordBinData::GetPath() const

View File

@ -4,7 +4,7 @@
#include "HWPRecord.h"
#include "../HWPStream.h"
#include "../HWPDocInfo.h"
#include "../Common/XMLNode.h"
#include "../Common/XMLReader.h"
namespace HWP
{
@ -44,7 +44,7 @@ class CHWPRecordBinData : public CHWPRecord
HWP_STRING m_sItemID;
public:
CHWPRecordBinData(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
CHWPRecordBinData(CXMLNode& oNode, int nVersion);
CHWPRecordBinData(CXMLReader& oReader, int nVersion);
HWP_STRING GetPath() const;
HWP_STRING GetItemID() const;

View File

@ -58,19 +58,26 @@ EColorFillPattern GetColorFillPattern(int nPattern)
}
}
void TBorder::ReadFromNode(CXMLNode& oNode)
void TBorder::Read(CXMLReader& oReader)
{
m_eStyle = GetLineStyle2(oNode.GetAttribute(L"type"));
m_nColor = oNode.GetAttributeColor(L"color");
m_chWidth = (HWP_BYTE)ConvertWidthToHWP(oNode.GetAttribute(L"width"));
START_READ_ATTRIBUTES(oReader)
{
if ("type" == sAttributeName)
m_eStyle = GetLineStyle2(oReader.GetText());
else if ("color" == sAttributeName)
m_nColor = oReader.GetInt();
else if ("width" == sAttributeName)
m_chWidth = (HWP_BYTE)ConvertWidthToHWP(oReader.GetTextA());
}
END_READ_ATTRIBUTES(oReader)
}
CFill::CFill()
: m_nFillType(0)
: m_nFillType(0), m_eHatchStyle(EColorFillPattern::NONE), m_eMode(EImageFillType::NONE), m_chAlpha(0xff)
{}
CFill::CFill(CHWPStream& oBuffer, int nOff, int nSize)
: m_nFillType(0)
: m_nFillType(0), m_eHatchStyle(EColorFillPattern::NONE), m_eMode(EImageFillType::NONE), m_chAlpha(0xff)
{
oBuffer.SavePosition();
@ -147,82 +154,117 @@ CFill::CFill(CHWPStream& oBuffer, int nOff, int nSize)
m_nSize = oBuffer.GetDistanceToLastPos(true);
}
CFill::CFill(CXMLNode& oNode)
: m_nFillType(0)
CFill::CFill(CXMLReader& oReader)
: m_nFillType(0), m_eHatchStyle(EColorFillPattern::NONE), m_eMode(EImageFillType::NONE), m_chAlpha(0xff)
{
for (CXMLNode& oChild : oNode.GetChilds())
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if (L"hc:winBrush" == oChild.GetName())
if ("hc:winBrush" == sNodeName)
{
ReadWinBrush(oChild);
ReadWinBrush(oReader);
m_nFillType |= 0x01;
}
else if (L"hc:gradation" == oChild.GetName())
else if ("hc:gradation" == sNodeName)
{
ReadGradation(oChild);
ReadGradation(oReader);
m_nFillType |= 0x04;
}
else if (L"hc:imgBrush" == oChild.GetName())
else if ("hc:imgBrush" == sNodeName)
{
ReadImgBrush(oChild);
ReadImgBrush(oReader);
m_nFillType |= 0x02;
}
}
END_WHILE
}
void CFill::ReadWinBrush(CXMLNode& oNode)
void CFill::ReadWinBrush(CXMLReader& oReader)
{
m_nFaceColor = oNode.GetAttributeColor(L"faceColor", 0xFFFFFFFF);
m_nHatchColor = oNode.GetAttributeColor(L"hatchColor", 0x000000);
m_eHatchStyle = GetColorFillPattern(oNode.GetAttributeInt(L"hatchStyle", -1));
m_chAlpha = (HWP_BYTE)oNode.GetAttributeInt(L"alpha", 255);
}
m_eHatchStyle = EColorFillPattern::NONE;
m_chAlpha = 0xff;
void CFill::ReadGradation(CXMLNode& oNode)
{
m_eGradType = ::HWP::GetGradFillType(oNode.GetAttributeInt(L"type"));
m_nAngle = oNode.GetAttributeInt(L"angle");
m_nCenterX = oNode.GetAttributeInt(L"centerX");
m_nCenterY = oNode.GetAttributeInt(L"centerY");
m_nStep = oNode.GetAttributeInt(L"step");
m_nColorNum = oNode.GetAttributeInt(L"colorNum");
m_chStepCenter = (HWP_BYTE)oNode.GetAttributeInt(L"stepCenter");
m_chAlpha = (HWP_BYTE)oNode.GetAttributeInt(L"alpha", 255);
std::vector<XmlUtils::CXmlNode> arChilds;
oNode.GetNodes(L"hc:color", arChilds);
m_arColors.resize(arChilds.size());
for (unsigned int unIndex = 0; unIndex < arChilds.size(); ++unIndex)
m_arColors[unIndex] = CXMLNode(arChilds[unIndex]).GetAttributeColor(L"value");
}
void CFill::ReadImgBrush(CXMLNode& oNode)
{
m_eMode = GetImageFillType(oNode.GetAttributeInt(L"mode", (int)EImageFillType::NONE));
for (CXMLNode& oChild : oNode.GetChilds())
START_READ_ATTRIBUTES(oReader)
{
if (L"hc:img" == oChild.GetName())
{
m_chBright = (HWP_BYTE)oChild.GetAttributeInt(L"bright");
m_chContrast = (HWP_BYTE)oChild.GetAttributeInt(L"contrast");
HWP_STRING sEffect = oChild.GetAttribute(L"effect");
if (L"REAL_PIC" == sEffect)
m_chEffect = 0;
else if (L"GRAY_SCALE" == sEffect)
m_chEffect = 1;
else if (L"BLACK_WHITE" == sEffect)
m_chEffect = 2;
m_sBinItemID = oChild.GetAttribute(L"binaryItemIDRef");
m_chAlpha = (HWP_BYTE)oChild.GetAttributeInt(L"alpha", 255);
}
if ("faceColor" == sAttributeName)
m_nFaceColor = oReader.GetColor(0xFFFFFFFF);
else if ("hatchColor" == sAttributeName)
m_nHatchColor = oReader.GetColor();
else if ("hatchStyle" == sAttributeName)
m_eHatchStyle = GetColorFillPattern(oReader.GetInt());
else if ("alpha" == sAttributeName)
m_chAlpha = (HWP_BYTE)oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
}
void CFill::ReadGradation(CXMLReader& oReader)
{
START_READ_ATTRIBUTES(oReader)
{
if ("type" == sAttributeName)
m_eGradType = ::HWP::GetGradFillType(oReader.GetInt());
else if ("angle" == sAttributeName)
m_nAngle = oReader.GetInt();
else if ("centerX" == sAttributeName)
m_nCenterX = oReader.GetInt();
else if ("centerY" == sAttributeName)
m_nCenterY = oReader.GetInt();
else if ("step" == sAttributeName)
m_nStep = oReader.GetInt();
else if ("colorNum" == sAttributeName)
m_nColorNum = oReader.GetInt();
else if ("stepCenter" == sAttributeName)
m_chStepCenter = (HWP_BYTE)oReader.GetInt();
else if ("alpha" == sAttributeName)
m_chAlpha = (HWP_BYTE)oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hc:color")
{
START_READ_ATTRIBUTES(oReader)
{
if ("value" != oReader.GetName())
continue;
m_arColors.push_back(oReader.GetColor(true));
}
END_READ_ATTRIBUTES(oReader)
}
END_WHILE
}
void CFill::ReadImgBrush(CXMLReader& oReader)
{
m_eMode = GetImageFillType(oReader.GetAttributeInt("mode"));
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hc:img")
{
START_READ_ATTRIBUTES(oReader)
{
if ("bright" == sAttributeName)
m_chBright = (HWP_BYTE)oReader.GetInt();
else if ("contrast" == sAttributeName)
m_chContrast = (HWP_BYTE)oReader.GetInt();
else if ("effect" == sAttributeName)
{
const std::string sEffect{oReader.GetTextA()};
if ("REAL_PIC" == sEffect)
m_chEffect = 0;
else if ("GRAY_SCALE" == sEffect)
m_chEffect = 1;
else if ("BLACK_WHITE" == sEffect)
m_chEffect = 2;
}
else if ("binaryItemIDRef" == sAttributeName)
m_sBinItemID = oReader.GetText();
else if ("alpha" == sAttributeName)
m_chAlpha = (HWP_BYTE)oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
}
END_WHILE
}
int CFill::GetSize() const
@ -333,66 +375,88 @@ CHWPRecordBorderFill::CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, int nTagNum, i
m_pFill = new CFill(oBuffer, 0, 0); // TODO:: перейти от использования off и size
}
CHWPRecordBorderFill::CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion)
CHWPRecordBorderFill::CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_BORDER_FILL, 0, 0), m_pFill(nullptr)
{
m_bThreeD = oNode.GetAttributeBool(L"threeD");
m_bShadow = oNode.GetAttributeBool(L"shadow");
m_bBreakCellSeparateLine = oNode.GetAttributeBool(L"breakCellSeparateLine");
HWP_STRING sChildName;
for (CXMLNode& oChild : oNode.GetChilds())
START_READ_ATTRIBUTES(oReader)
{
if (L"hh:slash" == oChild.GetName())
{
HWP_STRING sType = oChild.GetAttribute(L"type");
if (L"NONE" == sType)
m_chSlash = 0x0;
else if (L"CENTER" == sType)
m_chSlash = 0b010;
else if (L"CENTER_BELOW" == sType)
m_chSlash = 0b011;
else if (L"CENTER_ABOVE" == sType)
m_chSlash = 0b110;
else if (L"ALL" == sType)
m_chSlash = 0b111;
m_chCrookedSlash = oChild.GetAttributeBool(L"Crooked");
m_bCounterSlash = oChild.GetAttributeBool(L"isCounter");
}
else if (L"hh:backSlash" == oChild.GetName())
{
HWP_STRING sType = oChild.GetAttribute(L"type");
if (L"NONE" == sType)
m_chBackSlash = 0x0;
else if (L"CENTER" == sType)
m_chBackSlash = 0b010;
else if (L"CENTER_BELOW" == sType)
m_chBackSlash = 0b011;
else if (L"CENTER_ABOVE" == sType)
m_chBackSlash = 0b110;
else if (L"ALL" == sType)
m_chBackSlash = 0b111;
m_chCrookedBackSlash = oChild.GetAttributeBool(L"Crooked");
m_bCounterBackSlash = oChild.GetAttributeBool(L"isCounter");
}
else if (L"hh:leftBorder" == oChild.GetName())
m_oLeft.ReadFromNode(oChild);
else if (L"hh:rightBorder" == oChild.GetName())
m_oRight.ReadFromNode(oChild);
else if (L"hh:topBorder" == oChild.GetName())
m_oTop.ReadFromNode(oChild);
else if (L"hh:bottomBorder" == oChild.GetName())
m_oBottom.ReadFromNode(oChild);
else if (L"hh:diagonal" == oChild.GetName())
m_oDiagonal.ReadFromNode(oChild);
else if (L"hc:fillBrush" == oChild.GetName())
m_pFill = new CFill(oChild);
if ("threeD" == sAttributeName)
m_bThreeD = oReader.GetBool();
else if ("shadow" == sAttributeName)
m_bShadow = oReader.GetBool();
else if ("breakCellSeparateLine" == sAttributeName)
m_bBreakCellSeparateLine = oReader.GetBool();
}
END_READ_ATTRIBUTES(oReader)
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if ("hh:slash" == sNodeName)
{
START_READ_ATTRIBUTES(oReader)
{
if ("type" == sAttributeName)
{
const std::string sType{oReader.GetTextA()};
if ("NONE" == sType)
m_chSlash = 0x0;
else if ("CENTER" == sType)
m_chSlash = 0b010;
else if ("CENTER_BELOW" == sType)
m_chSlash = 0b011;
else if ("CENTER_ABOVE" == sType)
m_chSlash = 0b110;
else if ("ALL" == sType)
m_chSlash = 0b111;
}
else if ("Crooked" == sAttributeName)
m_chCrookedSlash = oReader.GetBool();
else if ("isCounter" == sAttributeName)
m_bCounterSlash = oReader.GetBool();
}
END_READ_ATTRIBUTES(oReader)
}
else if ("hh:backSlash" == sNodeName)
{
START_READ_ATTRIBUTES(oReader)
{
if ("type" == sAttributeName)
{
const std::string sType{oReader.GetTextA()};
if ("NONE" == sType)
m_chBackSlash = 0x0;
else if ("CENTER" == sType)
m_chBackSlash = 0b010;
else if ("CENTER_BELOW" == sType)
m_chBackSlash = 0b011;
else if ("CENTER_ABOVE" == sType)
m_chBackSlash = 0b110;
else if ("ALL" == sType)
m_chBackSlash = 0b111;
}
else if ("Crooked" == sAttributeName)
m_chCrookedBackSlash = oReader.GetBool();
else if ("isCounter" == sAttributeName)
m_bCounterBackSlash = oReader.GetBool();
}
END_READ_ATTRIBUTES(oReader)
}
else if ("hh:leftBorder" == sNodeName)
m_oLeft.Read(oReader);
else if ("hh:rightBorder" == sNodeName)
m_oRight.Read(oReader);
else if ("hh:topBorder" == sNodeName)
m_oTop.Read(oReader);
else if ("hh:bottomBorder" == sNodeName)
m_oBottom.Read(oReader);
else if ("hh:diagonal" == sNodeName)
m_oDiagonal.Read(oReader);
else if ("hc:fillBrush" == sNodeName)
m_pFill = new CFill(oReader);
}
END_WHILE
}
CHWPRecordBorderFill::~CHWPRecordBorderFill()

View File

@ -4,7 +4,7 @@
#include "../HWPDocInfo.h"
#include "HwpRecordTypes.h"
#include "../HWPStream.h"
#include "../Common/XMLNode.h"
#include "../Common/XMLReader.h"
#include <vector>
namespace HWP
@ -15,7 +15,7 @@ struct TBorder
HWP_BYTE m_chWidth;
int m_nColor;
void ReadFromNode(CXMLNode& oNode);
void Read(CXMLReader& oReader);
};
enum class EImageFillType
@ -86,13 +86,13 @@ class CFill : public IRef
HWP_BYTE m_chAlpha;
void ReadWinBrush(CXMLNode& oNode);
void ReadGradation(CXMLNode& oNode);
void ReadImgBrush(CXMLNode& oNode);
void ReadWinBrush(CXMLReader& oReader);
void ReadGradation(CXMLReader& oReader);
void ReadImgBrush(CXMLReader& oReader);
public:
CFill();
CFill(CHWPStream& oBuffer, int nOff, int nSize);
CFill(CXMLNode& oNode);
CFill(CXMLReader& oReader);
int GetSize() const;
bool NoneFill() const;
@ -136,7 +136,7 @@ class CHWPRecordBorderFill : public CHWPRecord
public:
CHWPRecordBorderFill(int nTagNum, int nLevel, int nSize);
CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion);
CHWPRecordBorderFill(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion);
~CHWPRecordBorderFill();
TBorder GetLeftBorder() const;

View File

@ -45,25 +45,32 @@ CHWPRecordBullet::CHWPRecordBullet(CHWPDocInfo& oDocInfo, int nTagNum, int nLeve
oBuffer.ReadChar(m_chCheckBulletChar);
}
CHWPRecordBullet::CHWPRecordBullet(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion)
CHWPRecordBullet::CHWPRecordBullet(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_BULLET, 0, 0), m_pParent(&oDocInfo)
{
std::wstring wsAttributeValue = oNode.GetAttribute(L"char");
if (!wsAttributeValue.empty())
m_chBulletChar = wsAttributeValue.at(0);
wsAttributeValue = oNode.GetAttribute(L"checkedChar");
if (!wsAttributeValue.empty())
m_chCheckBulletChar = wsAttributeValue.at(0);
m_nBulletImage = oNode.GetAttributeInt(L"useImage");
for (CXMLNode& oChild : oNode.GetChilds())
START_READ_ATTRIBUTES(oReader)
{
if (L"hc:img" == oChild.GetName())
m_sBinItemRefID = oChild.GetAttribute(L"binaryItemIDRef");
if ("char" == sAttributeName)
{
const HWP_STRING wsValue{oReader.GetText()};
if (!wsValue.empty())
m_chBulletChar = wsValue.at(0);
}
else if ("checkedChar" == sAttributeName)
{
const HWP_STRING wsValue{oReader.GetText()};
if (!wsValue.empty())
m_chCheckBulletChar = wsValue.at(0);
}
else if ("useImage" == sAttributeName)
m_nBulletImage = oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
WHILE_READ_NEXT_NODE_WITH_ONE_NAME(oReader, "hc:img")
m_sBinItemRefID = oReader.GetAttribute("binaryItemIDRef");
END_WHILE
}
}

View File

@ -5,7 +5,7 @@
#include "../HWPStream.h"
#include "../HWPDocInfo.h"
#include "HWPRecordNumbering.h"
#include "../Common/XMLNode.h"
#include "../Common/XMLReader.h"
namespace HWP
{
@ -24,7 +24,7 @@ class CHWPRecordBullet : public CHWPRecord
HWP_CHAR m_chCheckBulletChar;
public:
CHWPRecordBullet(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
CHWPRecordBullet(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion);
CHWPRecordBullet(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion);
};
}

View File

@ -107,15 +107,29 @@ EShadow GetShadow(const HWP_STRING& sValue)
ELSE_STRING_IN_ENUM(NONE, EShadow);
}
void CHWPRecordCharShape::ReadContainerData(CXMLNode& oNode, short arValues[], int nDefaultValue)
void CHWPRecordCharShape::ReadContainerData(CXMLReader& oReader, short arValues[], int nDefaultValue)
{
arValues[(int)ELang::HANGUL] = oNode.GetAttributeInt(L"hangul", nDefaultValue);
arValues[(int)ELang::LATIN] = oNode.GetAttributeInt(L"latin", nDefaultValue);
arValues[(int)ELang::HANJA] = oNode.GetAttributeInt(L"hanja", nDefaultValue);
arValues[(int)ELang::JAPANESE] = oNode.GetAttributeInt(L"japanese", nDefaultValue);
arValues[(int)ELang::OTHER] = oNode.GetAttributeInt(L"other", nDefaultValue);
arValues[(int)ELang::SYMBOL] = oNode.GetAttributeInt(L"symbol", nDefaultValue);
arValues[(int)ELang::USER] = oNode.GetAttributeInt(L"user", nDefaultValue);
for (unsigned int unIndex = 0; unIndex < (int)ELang::MAX; ++unIndex)
arValues[unIndex] = nDefaultValue;
START_READ_ATTRIBUTES(oReader)
{
if ("hangul" == sAttributeName)
arValues[(int)ELang::HANGUL] = oReader.GetInt();
else if ("latin" == sAttributeName)
arValues[(int)ELang::LATIN] = oReader.GetInt();
else if ("hanja" == sAttributeName)
arValues[(int)ELang::HANJA] = oReader.GetInt();
else if ("japanese" == sAttributeName)
arValues[(int)ELang::JAPANESE] = oReader.GetInt();
else if ("other" == sAttributeName)
arValues[(int)ELang::OTHER] = oReader.GetInt();
else if ("symbol" == sAttributeName)
arValues[(int)ELang::SYMBOL] = oReader.GetInt();
else if ("user" == sAttributeName)
arValues[(int)ELang::USER] = oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
}
CHWPRecordCharShape::CHWPRecordCharShape(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion)
@ -134,27 +148,26 @@ CHWPRecordCharShape::CHWPRecordCharShape(CHWPDocInfo& oDocInfo, int nTagNum, int
m_arFontNames[nIndex] = pFaceName->GetFaceName();
}
#define READ_SHORT (short)(oBuffer[0] & 0x00FF); oBuffer.Skip(1)
#define READ_ELEMENT(_type) (_type)(oBuffer[0] & 0x00FF); oBuffer.Skip(1)
for (int nIndex = 0; nIndex < MAX_ELEMENTS; ++nIndex)
{
m_arRatios[nIndex] = READ_SHORT;
m_arRatios[nIndex] = READ_ELEMENT(short);
}
for (int nIndex = 0; nIndex < MAX_ELEMENTS; ++nIndex)
{
m_arSpacings[nIndex] = READ_SHORT;
m_arSpacings[nIndex] = READ_ELEMENT(HWP_BYTE);
}
for (int nIndex = 0; nIndex < MAX_ELEMENTS; ++nIndex)
{
m_arRelSizes[nIndex] = READ_SHORT;
m_arRelSizes[nIndex] = READ_ELEMENT(short);
}
for (int nIndex = 0; nIndex < MAX_ELEMENTS; ++nIndex)
{
m_arCharOffset[nIndex] = (HWP_BYTE)(oBuffer[0] & 0x00FF);
oBuffer.Skip(1);
m_arCharOffset[nIndex] = READ_ELEMENT(HWP_BYTE);
}
oBuffer.ReadInt(m_nHeight);
@ -195,103 +208,138 @@ CHWPRecordCharShape::CHWPRecordCharShape(CHWPDocInfo& oDocInfo, int nTagNum, int
oBuffer.RemoveLastSavedPos();
}
CHWPRecordCharShape::CHWPRecordCharShape(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion)
CHWPRecordCharShape::CHWPRecordCharShape(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_HWP_CHAR_SHAPE, 0, 0), m_pParent(&oDocInfo),
m_bItalic(false), m_bBold(false), m_bEmboss(false), m_bEngrave(false),
m_bSuperScript(false), m_bSubScript(false)
m_nHeight(1000), m_bItalic(false), m_bBold(false), m_eUnderline(EUnderline::NONE),
m_eUnderLineShape(ELineStyle1::SOLID), m_eOutline(EOutline::NONE), m_eShadow(EShadow::NONE), m_bEmboss(false), m_bEngrave(false),
m_bSuperScript(false), m_bSubScript(false), m_eStrikeOutShape(ELineStyle2::NONE), m_nShadeColor(0xFFFFFFFF)
{
m_eUnderline = EUnderline::NONE;
m_eUnderLineShape = ELineStyle1::SOLID;
m_eOutline = EOutline::NONE;
m_eShadow = EShadow::NONE;
m_eStrikeOutShape = ELineStyle2::NONE;
m_nHeight = oNode.GetAttributeInt(L"height", 1000);
m_nTextColor = oNode.GetAttributeColor(L"textColor", 0x000000);
m_nShadeColor = oNode.GetAttributeColor(L"shadeColor", 0xFFFFFFFF);
m_bUseFontSpace = oNode.GetAttributeBool(L"useFontSpace");
m_bUseKerning = oNode.GetAttributeBool(L"useKerning");
m_eSymMark = GetAccent(oNode.GetAttribute(L"symMark"));
m_shBorderFillIDRef = oNode.GetAttributeInt(L"borderFillIDRef");
for (CXMLNode& oChild : oNode.GetChilds())
START_READ_ATTRIBUTES(oReader)
{
if (L"hh:fontRef" == oChild.GetName())
if ("height" == sAttributeName)
m_nHeight = oReader.GetInt();
else if ("textColor" == sAttributeName)
m_nTextColor = oReader.GetColor();
else if ("shadeColor" == sAttributeName)
m_nShadeColor = oReader.GetColor(0xFFFFFFFF);
else if ("useFontSpace" == sAttributeName)
m_bUseFontSpace = oReader.GetBool();
else if ("useKerning" == sAttributeName)
m_bUseKerning = oReader.GetBool();
else if ("symMark" == sAttributeName)
m_eSymMark = GetAccent(oReader.GetText());
else if ("borderFillIDRef" == sAttributeName)
m_shBorderFillIDRef = oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if ("hh:fontRef" == sNodeName)
{
if (nullptr == m_pParent)
continue;
const CHWPRecordFaceName* pFaceName = nullptr;
#define UPDATE_FACENAME(node_name, elang_type) \
pFaceName = dynamic_cast<const CHWPRecordFaceName*>(m_pParent->GetFaceName(oChild.GetAttributeInt(node_name))); \
if (nullptr != pFaceName) \
m_arFontNames[(int)elang_type] = pFaceName->GetFaceName()
#define UPDATE_FACENAME(elang_type)\
{\
pFaceName = dynamic_cast<const CHWPRecordFaceName*>(m_pParent->GetFaceName(oReader.GetInt()));\
if (nullptr != pFaceName)\
m_arFontNames[(int)elang_type] = pFaceName->GetFaceName();\
}
UPDATE_FACENAME(L"hangul", ELang::HANGUL);
UPDATE_FACENAME(L"latin", ELang::LATIN);
UPDATE_FACENAME(L"hanja", ELang::HANJA);
UPDATE_FACENAME(L"japanese", ELang::JAPANESE);
UPDATE_FACENAME(L"other", ELang::OTHER);
UPDATE_FACENAME(L"symbol", ELang::SYMBOL);
UPDATE_FACENAME(L"user", ELang::USER);
START_READ_ATTRIBUTES(oReader)
{
if ("hangul" == sAttributeName)
UPDATE_FACENAME(ELang::HANGUL)
else if ("latin" == sAttributeName)
UPDATE_FACENAME(ELang::LATIN)
else if ("hanja" == sAttributeName)
UPDATE_FACENAME(ELang::HANJA)
else if ("japanese" == sAttributeName)
UPDATE_FACENAME(ELang::JAPANESE)
else if ("other" == sAttributeName)
UPDATE_FACENAME(ELang::OTHER)
else if ("symbol" == sAttributeName)
UPDATE_FACENAME(ELang::SYMBOL)
else if ("user" == sAttributeName)
UPDATE_FACENAME(ELang::USER)
}
END_READ_ATTRIBUTES(oReader)
}
else if (L"hh:ratio" == oChild.GetName())
ReadContainerData(oChild, m_arRatios, 100);
else if (L"hh:spacing" == oChild.GetName())
ReadContainerData(oChild, m_arSpacings);
else if (L"hh:relSz" == oChild.GetName())
ReadContainerData(oChild, m_arRelSizes, 100);
else if (L"hh:offset" == oChild.GetName())
ReadContainerData(oChild, m_arCharOffset);
else if (L"hh:underline" == oChild.GetName())
else if ("hh:ratio" == sNodeName)
ReadContainerData(oReader, m_arRatios, 100);
else if ("hh:spacing" == sNodeName)
ReadContainerData(oReader, m_arSpacings);
else if ("hh:relSz" == sNodeName)
ReadContainerData(oReader, m_arRelSizes, 100);
else if ("hh:offset" == sNodeName)
ReadContainerData(oReader, m_arCharOffset);
else if ("hh:underline" == sNodeName)
{
m_eUnderline = GetUnderline(oChild.GetAttribute(L"type"));
m_eUnderLineShape = GetLineStyle1(oChild.GetAttribute(L"shape"));
m_nUnderlineColor = oChild.GetAttributeColor(L"color");
START_READ_ATTRIBUTES(oReader)
{
if ("type" == sAttributeName)
m_eUnderline = GetUnderline(oReader.GetText());
else if ("shape" == sAttributeName)
m_eUnderLineShape = GetLineStyle1(oReader.GetText());
else if ("color" == sAttributeName)
m_nUnderlineColor = oReader.GetColor();
}
END_READ_ATTRIBUTES(oReader)
}
else if (L"hh:strikeout" == oChild.GetName())
else if ("hh:strikeout" == sNodeName)
{
m_eStrikeOutShape = GetLineStyle2(oChild.GetAttribute(L"shape"));
m_nStrikeOutColor = oChild.GetAttributeColor(L"color");
START_READ_ATTRIBUTES(oReader)
{
if ("shape" == sAttributeName)
m_eStrikeOutShape = GetLineStyle2(oReader.GetText());
else if ("color" == sAttributeName)
m_nStrikeOutColor = oReader.GetColor();
}
END_READ_ATTRIBUTES(oReader)
}
else if ("hh:outline" == sNodeName)
m_eOutline = GetOutline(oReader.GetAttribute("type"));
else if ("hh:shadow" == sNodeName)
{
START_READ_ATTRIBUTES(oReader)
{
if ("type" == sAttributeName)
{
const std::string sType{oReader.GetTextA()};
if (L"3D" == oChild.GetAttribute(L"shape"))
m_eStrikeOutShape = ELineStyle2::NONE;
if ("DROP" == sType)
m_eShadow = EShadow::DISCRETE;
else if ("CONTINUOUS" == sType)
m_eShadow = EShadow::CONTINUOUS;
else
m_eShadow = EShadow::NONE;
}
else if ("color" == sAttributeName)
m_nShadowColor = oReader.GetColor();
else if ("offsetX" == sAttributeName)
m_chShadowOffsetX = (HWP_BYTE)oReader.GetInt();
else if ("offsetY" == sAttributeName)
m_chShadowOffsetY = (HWP_BYTE)oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
}
else if (L"hh:outline" == oChild.GetName())
{
m_eOutline = GetOutline(oChild.GetAttribute(L"type"));
}
else if (L"hh:shadow" == oChild.GetName())
{
HWP_STRING sType = oChild.GetAttribute(L"type");
if (L"DROP" == sType)
m_eShadow = EShadow::DISCRETE;
else if (L"CONTINUOUS" == sType)
m_eShadow = EShadow::CONTINUOUS;
else
m_eShadow = EShadow::NONE;
m_nShadowColor = oChild.GetAttributeColor(L"color");
m_chShadowOffsetX = (HWP_BYTE)oChild.GetAttributeInt(L"offsetX");
m_chShadowOffsetY = (HWP_BYTE)oChild.GetAttributeInt(L"offsetY");
}
else if (L"hh:italic" == oChild.GetName())
else if ("hh:italic" == sNodeName)
m_bItalic = true;
else if (L"hh:bold" == oChild.GetName())
else if ("hh:bold" == sNodeName)
m_bBold = true;
else if (L"hh:emboss" == oChild.GetName())
else if ("hh:emboss" == sNodeName)
m_bEmboss = true;
else if (L"hh:engrave" == oChild.GetName())
m_bEmboss = true;
else if (L"hh:supscript" == oChild.GetName())
else if ("hh:engrave" == sNodeName)
m_bEngrave = true;
else if ("hh:supscript" == sNodeName)
m_bSuperScript = true;
else if (L"hh:subscript" == oChild.GetName())
else if ("hh:subscript" == sNodeName)
m_bSubScript = true;
}
END_WHILE
}
bool CHWPRecordCharShape::Bold() const
@ -311,7 +359,17 @@ bool CHWPRecordCharShape::Underline() const
bool CHWPRecordCharShape::StrikeOut() const
{
return ELineStyle2::NONE != m_eStrikeOutShape;
return 0x01 == m_chStrikeOut;
}
bool CHWPRecordCharShape::SuperScript() const
{
return m_bSuperScript;
}
bool CHWPRecordCharShape::SubScript() const
{
return m_bSubScript;
}
int CHWPRecordCharShape::GetHeight() const
@ -360,6 +418,14 @@ HWP_STRING CHWPRecordCharShape::GetFontName(ELang eLang) const
return m_arFontNames[(int)eLang];
}
short CHWPRecordCharShape::GetRatio(ELang eLang) const
{
if (ELang::MAX == eLang)
return 0;
return m_arRatios[(int)eLang];
}
short CHWPRecordCharShape::GetSpacing(ELang eLang) const
{
if (ELang::MAX == eLang)

View File

@ -5,7 +5,7 @@
#include "../HWPStream.h"
#include "HWPRecord.h"
#include "HwpRecordTypes.h"
#include "../Common/XMLNode.h"
#include "../Common/XMLReader.h"
namespace HWP
{
@ -100,15 +100,17 @@ class CHWPRecordCharShape : public CHWPRecord
short m_shBorderFillIDRef;
int m_nStrikeOutColor;
void ReadContainerData(CXMLNode& oNode, short arValues[], int nDefaultValue = 0);
void ReadContainerData(CXMLReader& oReader, short arValues[], int nDefaultValue = 0);
public:
CHWPRecordCharShape(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
CHWPRecordCharShape(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion);
CHWPRecordCharShape(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion);
bool Bold() const;
bool Italic() const;
bool Underline() const;
bool StrikeOut() const;
bool SuperScript() const;
bool SubScript() const;
int GetHeight() const;
@ -121,6 +123,7 @@ public:
short GetRelSize(ELang eLang) const;
HWP_STRING GetFontName(ELang eLang) const;
short GetRatio(ELang eLang) const;
short GetSpacing(ELang eLang) const;
int GetTextColor() const;
int GetShadeColor() const;

View File

@ -16,14 +16,24 @@ CHWPRecordDocumentProperties::CHWPRecordDocumentProperties(CHWPDocInfo& oDocInfo
oBuffer.ReadInt(m_nCharUnitLocInPara);
}
CHWPRecordDocumentProperties::CHWPRecordDocumentProperties(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion)
CHWPRecordDocumentProperties::CHWPRecordDocumentProperties(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_DOCUMENT_PROPERTIES, 0, 0), m_pParent(&oDocInfo)
{
m_shFigureStartNo = oNode.GetAttributeInt(L"page");
m_shFootNoteStartNo = oNode.GetAttributeInt(L"footnote");
m_shEndNoteStartNo = oNode.GetAttributeInt(L"endnote");
m_shFigureStartNo = oNode.GetAttributeInt(L"pic");
m_shTableStartNo = oNode.GetAttributeInt(L"tbl");
m_shEqStartNo = oNode.GetAttributeInt(L"equation");
START_READ_ATTRIBUTES(oReader)
{
if ("page" == sAttributeName)
m_shPageStartNo = oReader.GetInt();
else if ("footnote" == sAttributeName)
m_shFootNoteStartNo = oReader.GetInt();
else if ("endnote" == sAttributeName)
m_shEndNoteStartNo = oReader.GetInt();
else if ("pic" == sAttributeName)
m_shFigureStartNo = oReader.GetInt();
else if ("tbl" == sAttributeName)
m_shTableStartNo = oReader.GetInt();
else if ("equation" == sAttributeName)
m_shEqStartNo = oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
}
}

View File

@ -4,7 +4,7 @@
#include "../HWPDocInfo.h"
#include "../HWPStream.h"
#include "HWPRecord.h"
#include "../Common/XMLNode.h"
#include "../Common/XMLReader.h"
namespace HWP
{
@ -24,7 +24,7 @@ class CHWPRecordDocumentProperties : public CHWPRecord
int m_nCharUnitLocInPara;
public:
CHWPRecordDocumentProperties(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
CHWPRecordDocumentProperties(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion);
CHWPRecordDocumentProperties(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion);
};
}

View File

@ -53,47 +53,71 @@ CHWPRecordFaceName::CHWPRecordFaceName(CHWPDocInfo& oDocInfo, int nTagNum, int n
oBuffer.ReadString(m_sBasicFaceName, EStringCharacter::UTF16);
}
CHWPRecordFaceName::CHWPRecordFaceName(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion)
CHWPRecordFaceName::CHWPRecordFaceName(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_FACE_NAME, 0, 0), m_pParent(&oDocInfo)
{
m_sFaceName = oNode.GetAttribute(L"face");
m_sFaceName = oReader.GetAttribute("face");
for (CXMLNode& oChild: oNode.GetChilds())
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if (L"hh:substFont" == oChild.GetName())
if ("hh:substFont" == sNodeName)
{
m_bSubstExists = true;
m_sSubstFace = oChild.GetAttribute(L"face");
HWP_STRING sType = oChild.GetAttribute(L"type");
START_READ_ATTRIBUTES(oReader)
{
if ("face" == sAttributeName)
m_sSubstFace = oReader.GetText();
else if ("type" == sAttributeName)
{
const std::string sType{oReader.GetTextA()};
if (L"TTF" == sType)
m_eSubstType = EAltType::FFT;
else if (L"HFT" == sType)
m_eSubstType = EAltType::HFT;
else
m_eSubstType = EAltType::UNKNOWN;
if ("TTF" == sType)
m_eSubstType = EAltType::FFT;
else if ("HFT" == sType)
m_eSubstType = EAltType::HFT;
else
m_eSubstType = EAltType::UNKNOWN;
}
}
END_READ_ATTRIBUTES(oReader)
}
else if (L"hh:typeInfo" == oChild.GetName())
else if ("hh:typeInfo" == sNodeName)
{
m_bAttrExists = true;
m_sBasicFaceName = oChild.GetAttribute(L"familyType");
START_READ_ATTRIBUTES(oReader)
{
if ("familyType" == sAttributeName)
{
m_sBasicFaceName = oReader.GetText();
if (!m_sBasicFaceName.empty())
m_bBasicFaceExists = true;
m_chSerifStyle = (HWP_BYTE)oChild.GetAttributeInt(L"serifStyle");
m_shWeight = oChild.GetAttributeInt(L"weight");
m_shPropotion = oChild.GetAttributeInt(L"proportion");
m_shContrast = oChild.GetAttributeInt(L"contrast");
m_shStrokeVariation = oChild.GetAttributeInt(L"strokeVariation");
m_shArmStyle = oChild.GetAttributeInt(L"armStyle");
m_shLetterform = oChild.GetAttributeInt(L"letterform");
m_shMidLine = oChild.GetAttributeInt(L"midline");
m_shXHeight = oChild.GetAttributeInt(L"xHeight");
if (!m_sBasicFaceName.empty())
m_bBasicFaceExists = true;
}
else if ("serifStyle" == sAttributeName)
m_chSerifStyle = (HWP_BYTE)oReader.GetInt();
else if ("weight" == sAttributeName)
m_shWeight = oReader.GetInt();
else if ("proportion" == sAttributeName)
m_shPropotion = oReader.GetInt();
else if ("contrast" == sAttributeName)
m_shContrast = oReader.GetInt();
else if ("strokeVariation" == sAttributeName)
m_shStrokeVariation = oReader.GetInt();
else if ("armStyle" == sAttributeName)
m_shArmStyle = oReader.GetInt();
else if ("letterform" == sAttributeName)
m_shLetterform = oReader.GetInt();
else if ("midline" == sAttributeName)
m_shMidLine = oReader.GetInt();
else if ("xHeight" == sAttributeName)
m_shXHeight = oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
}
}
END_WHILE
}
HWP_STRING CHWPRecordFaceName::GetFaceName() const

View File

@ -1,7 +1,7 @@
#ifndef HWPRECORDFACENAME_H
#define HWPRECORDFACENAME_H
#include "../Common/XMLNode.h"
#include "../Common/XMLReader.h"
#include "../HWPDocInfo.h"
#include "../HWPStream.h"
#include "HWPRecord.h"
@ -41,7 +41,7 @@ class CHWPRecordFaceName : public CHWPRecord
short m_shXHeight;
public:
CHWPRecordFaceName(CHWPDocInfo& oDocInfo, int nTagNum, int nLevel, int nSize, CHWPStream& oBuffer, int nOff, int nVersion);
CHWPRecordFaceName(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion);
CHWPRecordFaceName(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion);
HWP_STRING GetFaceName() const;
};

View File

@ -54,52 +54,68 @@ CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, int nTagNum, int
oBuffer.RemoveLastSavedPos();
}
CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLNode& oNode, int nVersion)
CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLReader& oReader, int nVersion)
: CHWPRecord(EHWPTag::HWPTAG_NUMBERING, 0, 0), m_pParent(&oDocInfo)
{
m_shStart = oNode.GetAttributeInt(L"start", 1);
m_shStart = oReader.GetAttributeInt("start", 1);
unsigned int unIndex = 0;
HWP_STRING sType;
short shLevel = 0;
std::string sNumFormat;
for (CXMLNode& oChild : oNode.GetChilds())
WHILE_READ_NEXT_NODE_WITH_NAME(oReader)
{
if (L"hh:paraHead" == oChild.GetName() ||
L"paraHead" == oChild.GetName())
if ("hh:paraHead" == sNodeName ||
"paraHead" == sNodeName)
{
sType = oChild.GetAttribute(L"align");
START_READ_ATTRIBUTES(oReader)
{
if ("align" == sAttributeName)
{
const std::string sType{oReader.GetTextA()};
if (L"LEFT" == sType)
m_arNumbering[unIndex].m_chAlign = 0;
else if (L"CENTER" == sType)
m_arNumbering[unIndex].m_chAlign = 1;
else if (L"RIGHT" == sType)
m_arNumbering[unIndex].m_chAlign = 2;
if ("LEFT" == sType)
m_arNumbering[unIndex].m_chAlign = 0;
else if ("CENTER" == sType)
m_arNumbering[unIndex].m_chAlign = 1;
else if ("RIGHT" == sType)
m_arNumbering[unIndex].m_chAlign = 2;
}
else if ("useInstWidth" == sAttributeName)
m_arNumbering[unIndex].m_bUseInstWidth = oReader.GetBool();
else if ("autoIndent" == sAttributeName)
m_arNumbering[unIndex].m_bAutoIndent = oReader.GetBool();
else if ("widthAdjust" == sAttributeName)
m_arNumbering[unIndex].m_shWidthAdjust = oReader.GetInt();
else if ("textOffsetType" == sAttributeName)
{
const std::string sType{oReader.GetTextA()};
m_arNumbering[unIndex].m_bUseInstWidth = oChild.GetAttributeBool(L"useInstWidth");
m_arNumbering[unIndex].m_bAutoIndent = oChild.GetAttributeBool(L"autoIndent");
m_arNumbering[unIndex].m_shWidthAdjust = oChild.GetAttributeInt(L"widthAdjust");
if ("PERCENT" == sType)
m_arNumbering[unIndex].m_chTextOffsetType = 0;
else if ("HWPUNIT" == sType)
m_arNumbering[unIndex].m_chTextOffsetType = 1;
}
else if ("textOffset" == sAttributeName)
m_arNumbering[unIndex].m_shTextOffset = oReader.GetInt();
else if ("charPrIDRef" == sAttributeName)
m_arNumbering[unIndex].m_nCharShape = std::abs(oReader.GetInt());
else if ("start" == sAttributeName)
m_arNumbering[unIndex].m_nStartNumber = oReader.GetInt();
else if ("numFormat" == sAttributeName)
sNumFormat = oReader.GetTextA();
else if ("level" == sAttributeName)
shLevel = oReader.GetInt();
}
END_READ_ATTRIBUTES(oReader)
sType = oChild.GetAttribute(L"textOffsetType");
if (L"PERCENT" == sType)
m_arNumbering[unIndex].m_chTextOffsetType = 0;
else if (L"HWPUNIT" == sType)
m_arNumbering[unIndex].m_chTextOffsetType = 1;
m_arNumbering[unIndex].m_shTextOffset = oChild.GetAttributeInt(L"textOffset");
short shLevel = oChild.GetAttributeInt(L"level");
sType = oChild.GetAttribute(L"numFormat");
if (L"DIGIT" == sType)
if ("DIGIT" == sNumFormat)
{
if (shLevel > 0 && shLevel < 11)
m_arNumbering[unIndex].m_sNumFormat = L'^' + std::to_wstring(shLevel) + L'.';
}
else if (L"HANGUL_SYLLABLE" == sType ||
L"HANGUL_JAMO" == sType)
else if ("HANGUL_SYLLABLE" == sNumFormat ||
"HANGUL_JAMO" == sNumFormat)
{
switch (shLevel)
{
@ -115,7 +131,7 @@ CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLNode& oNode,
case 10: m_arNumbering[unIndex].m_sNumFormat = L"^차."; break;
}
}
else if (L"CIRCLED_DIGIT" == sType)
else if ("CIRCLED_DIGIT" == sNumFormat)
{
switch (shLevel)
{
@ -131,7 +147,7 @@ CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLNode& oNode,
case 10: m_arNumbering[unIndex].m_sNumFormat = L"^\u2469."; break;
}
}
else if (L"LATIN_SMALL" == sType)
else if ("LATIN_SMALL" == sNumFormat)
{
switch (shLevel)
{
@ -147,7 +163,7 @@ CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLNode& oNode,
case 10: m_arNumbering[unIndex].m_sNumFormat = L"^j."; break;
}
}
else if (L"CIRCLED_HANGUL_SYLLABLE" == sType)
else if ("CIRCLED_HANGUL_SYLLABLE" == sNumFormat)
{
switch (shLevel)
{
@ -163,7 +179,7 @@ CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLNode& oNode,
case 10: m_arNumbering[unIndex].m_sNumFormat = L"^\u3277."; break;
}
}
else if (L"ROMAN_SMALL" == sType)
else if ("ROMAN_SMALL" == sNumFormat)
{
switch (shLevel)
{
@ -180,14 +196,13 @@ CHWPRecordNumbering::CHWPRecordNumbering(CHWPDocInfo& oDocInfo, CXMLNode& oNode,
}
}
m_arNumbering[unIndex].m_nCharShape = std::abs(oChild.GetAttributeInt(L"charPrIDRef"));
m_arNumbering[unIndex].m_nStartNumber = oChild.GetAttributeInt(L"start");
++unIndex;
}
if (7 == unIndex)
return;
}
END_WHILE
}
short CHWPRecordNumbering::GetStart() const

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