Compare commits

...

735 Commits

Author SHA1 Message Date
447e1f5ccc Fix for snapshots 2024-08-28 13:08:06 +03:00
06ee659edc Fixwork with replaceAll function 2024-08-27 23:07:25 +03:00
fe35178e26 Add support snapshots 2024-08-27 22:52:05 +03:00
13590d4c2e Refactoring work with cache 2024-08-27 13:04:20 +03:00
84fc9f876e Add flag for fonts generation 2024-08-26 13:56:36 +03:00
c4530caac1 Merge pull request #1623 from ONLYOFFICE/release/v8.2.0
Release/v8.2.0
2024-08-21 04:17:49 -07:00
c018d57081 fix bug #69634 2024-08-21 12:52:16 +03:00
43f49b7a9d fix bug #69775 2024-08-21 12:14:48 +03:00
f8e19a7f0b Merge pull request #1620 from ONLYOFFICE/fix/bug-69767
Fix bug #69767
2024-08-20 05:39:52 -07:00
f245985bbd fix bug #69774 2024-08-20 11:29:57 +03:00
68171df991 Merge branch 'release/v8.2.0' of https://github.com/ONLYOFFICE/core into release/v8.2.0 2024-08-20 11:27:58 +03:00
bbf4003ec7 Refactoring 2024-08-20 11:00:12 +03:00
75cc7d8457 Fix bug #69767 2024-08-20 10:59:32 +03:00
7018402a58 Merge pull request #1619 from ONLYOFFICE/fix/pdf-bugs
Fix pdf bugs
2024-08-20 00:04:03 -07:00
6ce30ccaad Fix test 2024-08-20 09:23:10 +03:00
670677c23b Fix pdf clip 2024-08-20 09:22:39 +03:00
208f6efcc5 fix bug #69781 2024-08-20 08:39:42 +03:00
685165d270 fix bug #69780 2024-08-20 08:39:02 +03:00
f18eb2ef5b Developing 2024-08-20 00:23:59 +03:00
facdff46fe Refactoring 2024-08-19 18:24:06 +03:00
8843c3dd36 Merge pull request #1617 from ONLYOFFICE/feature/docbuilder-java
Add JAVA_HOME environment variable support when compiling docbuilder Java-wrapper
2024-08-19 04:50:27 -07:00
2708479152 Add class for embed pdf object 2024-08-19 13:57:26 +03:00
f3facfa8e8 Fix for some JDK versions 2024-08-19 14:13:19 +04:00
1e26e1723a For buf 59297 2024-08-19 12:57:30 +03:00
6d9242e1dd Add building support for JDK > 8 2024-08-19 13:49:43 +04:00
e8de8dc03b fix bug #60796 2024-08-16 17:39:11 +03:00
57447f757f Merge pull request #1618 from ONLYOFFICE/fix/pdf-time
Fix pdf clip
2024-08-16 04:24:27 -07:00
46d6eaa793 Fix test Save/Restore graphics 2024-08-16 13:35:03 +03:00
def502c7eb Refactoring drawingfile (native realization support) 2024-08-15 22:00:37 +03:00
1e5e43cbe5 Fix clip 2024-08-15 16:59:00 +03:00
60a888fc19 Fix PdfFile test 2024-08-15 16:58:39 +03:00
01ca25d798 Fix test 2024-08-15 16:58:20 +03:00
6812ebaa42 fix bug #68293 2024-08-15 10:46:06 +03:00
aacb2842f7 Fix typo 2024-08-14 16:39:41 +04:00
27a2a47cbe Fixes 2024-08-14 16:35:22 +04:00
02f8178c01 Merge pull request #1616 from ONLYOFFICE/fix/bug65304
Fix bug 65304
2024-08-14 01:55:26 -07:00
a0e2384409 fix bug #69490 2024-08-13 21:33:51 +03:00
56088e9eff Add support for JAVA_HOME environment variable 2024-08-13 20:44:46 +04:00
1d6b895496 Refactoring 2024-08-13 16:32:41 +03:00
fa4b8c8d76 Fix build 2024-08-13 11:40:51 +03:00
2db2b98c8f Fix bug 65304 2024-08-13 10:54:23 +03:00
f45fb3c6be for bug #69599 2024-08-13 09:40:06 +03:00
6f60d75863 Fix build 2024-08-13 00:24:51 +03:00
d1acdf35d8 Refactoring 2024-08-13 00:16:51 +03:00
a1bf6a76ed fix bug #69658 2024-08-12 19:25:27 +03:00
3634d59ece Merge branch 'release/v8.2.0' of https://github.com/ONLYOFFICE/core into release/v8.2.0 2024-08-12 19:07:54 +03:00
1b21e8f136 fix bug #69647 2024-08-12 19:07:07 +03:00
554ca5ec7c Merge pull request #1615 from ONLYOFFICE/fix/docbuilder-script-cache
Fix script caching on Windows
2024-08-12 08:15:16 -07:00
dc2e0edf80 fix bug #25787 2024-08-12 18:13:52 +03:00
e38fa336d2 Fix script caching with v8_89 2024-08-12 17:32:14 +04:00
357450f242 Merge pull request #1614 from ONLYOFFICE/fix/html
Fix html to ooxml conversion
2024-08-12 03:20:37 -07:00
4ed9925aff Merge pull request #1610 from ONLYOFFICE/feature/MetafileSize
The size setting of metafiles has been changed
2024-08-12 03:20:17 -07:00
796537565b Fixed unnecessary use of standard styles in html to ooxml conversion 2024-08-09 15:43:55 +03:00
fcf8e28ae8 Added tabs to the text in html to ooxml conversion 2024-08-09 15:27:29 +03:00
de949afbb6 fix bug #69618 2024-08-09 12:33:40 +03:00
fb7bb041c1 Merge pull request #1613 from ONLYOFFICE/fix/pdf-leaks
Fix pdf leaks, clip and read jpeg
2024-08-09 02:03:52 -07:00
8d6e15627b Refactoring RenderOutputDev and test diff 2024-08-08 18:42:43 +03:00
0583cbb5cc Merge branch 'release/v8.2.0' of https://github.com/ONLYOFFICE/core into release/v8.2.0 2024-08-08 17:31:35 +03:00
a68bec86df Improved html to ooxml conversion 2024-08-08 16:05:19 +03:00
6554185ec7 Refacroting DrawImage 2024-08-07 18:07:12 +03:00
22bbde155d fix bug #44738 2024-08-07 12:03:23 +03:00
4a123d33ea fix bug #69552 2024-08-07 08:18:32 +03:00
c7d0f27f6b Fix ReadImage 2024-08-06 18:59:28 +03:00
f1ddd51164 Add support /* comments in script files 2024-08-06 18:08:47 +03:00
1d636b717f [x2t] Fix bug 69574 2024-08-06 15:53:40 +03:00
c026f33aa7 Improved html to ooxml conversion 2024-08-06 15:47:58 +03:00
29e5769d6d fix bug #30042 2024-08-06 10:54:09 +03:00
6586fc39ee Merge pull request #1612 from ONLYOFFICE/feature/gradients
Feature/gradients
2024-08-05 11:50:27 -07:00
e8c7a4f670 Fix ReadDCT 2024-08-05 18:14:56 +03:00
ead6b305b2 Create ReadDCT for jpeg image in pdf 2024-08-05 16:36:50 +03:00
2de6a6d199 Merge pull request #1611 from ONLYOFFICE/feature/docbuilder-java
Feature/docbuilder java
2024-08-05 05:38:52 -07:00
c6ca99994b Fix build into JAR on mac and linux 2024-08-02 19:35:13 +04:00
b707510c88 Remove explicit workDirectory setting 2024-08-02 18:38:40 +04:00
7171dcb9f0 Set library path at runtime
Now there is no need to pass `-D...` parameter to run java program
2024-08-02 18:26:15 +04:00
49dedc7a6d fix bug #69392 2024-08-02 16:43:20 +03:00
431fa060c4 fix bug #69488 2024-08-02 16:10:50 +03:00
0fc5133d98 Fix for building test example 2024-08-02 16:05:08 +04:00
8d5fc7d6ca Fix build for JDK 8 and force build into JAR 2024-08-02 15:58:13 +04:00
3221d20d81 Remove docbuilder_jni_utils helper library 2024-08-02 12:36:17 +04:00
9fdb81554a fix bug #69518 2024-08-02 10:58:01 +03:00
95a1983e75 Refactoring RendererOutputDev 2024-08-01 18:59:19 +03:00
c27aa4d807 Improved html to ooxml conversion 2024-08-01 13:54:07 +03:00
c4f8c524b5 Merge remote-tracking branch 'origin/release/v8.2.0' into fix/pdf-leaks 2024-08-01 12:32:12 +03:00
f7d55c08d8 fix bug #69474 2024-07-31 21:56:23 +03:00
4cfb8cc97a fix bug #69104 2024-07-31 21:51:15 +03:00
a41ecb0715 for bug #69405 2024-07-31 21:32:50 +03:00
faa9e5e640 Merge pull request #1608 from ONLYOFFICE/fix/bug-65822
For bug 65822
2024-07-31 05:40:58 -07:00
ac2ee1b56d Save line AP 2024-07-31 14:01:34 +03:00
b722238d21 Draw AP for markup annots 2024-07-31 14:00:24 +03:00
83e20057f4 Merge pull request #1607 from ONLYOFFICE/feature/docx-renderer
Feature/docx renderer
2024-07-30 10:34:35 -07:00
373786fca6 Update Clip 2024-07-30 18:35:57 +03:00
0fa1b4feec Add return 0/1 for builder external scripts 2024-07-30 11:47:13 +03:00
6a6204ae33 Fix add to conts & highlights 2024-07-30 11:35:39 +03:00
f02147b97c Fix jar build 2024-07-30 12:25:54 +04:00
88b1660735 Add another way to load native libraries 2024-07-30 11:36:47 +04:00
f5f7cb1aec . 2024-07-29 22:13:28 +03:00
af01306997 . 2024-07-29 21:58:34 +03:00
ef30a30e00 Fix first word width in splitted lines 2024-07-29 20:33:20 +03:00
16ae48ef4e Fix memory leaks 2024-07-29 17:56:48 +03:00
0eb8c93cf9 Merge pull request #1606 from ONLYOFFICE/fix/bug66692
Fix bug #66692
2024-07-29 14:50:16 +03:00
c98285ffef Merge pull request #1605 from ONLYOFFICE/fix/bug66675
Fix bug #66675
2024-07-29 14:50:03 +03:00
4b99c4179b Fixed inaccuracies when converting html to ooxml elements big and small 2024-07-29 12:39:51 +03:00
e98dec952f Fix build 2024-07-26 21:43:43 +03:00
8b2d7035c1 Add build to JAR 2024-07-26 19:42:37 +04:00
234def9cd7 Autowrap function arguments
+ Add constructor from Java arrays
2024-07-26 19:10:32 +04:00
ce92766ef6 Fix paths 2024-07-26 17:16:06 +03:00
59c95c5039 Merge pull request #1597 from ONLYOFFICE/feature/pdf-layer
Feature pdf layer
2024-07-26 07:05:38 -07:00
a23002225a Merge pull request #1598 from ONLYOFFICE/fix/bug-59297
Feature pdf headings
2024-07-26 07:03:52 -07:00
cb64a5a266 Fix bug #66675 2024-07-26 16:51:24 +06:00
65483d0460 fix bug #69395 2024-07-26 13:31:16 +03:00
41758f0552 Merge pull request #1604 from ONLYOFFICE/feature/docx-renderer
Fix bug with spacing
2024-07-26 02:30:17 -07:00
bfd790ba11 Fix bug with spacing 2024-07-26 12:26:59 +03:00
81d9e3cfd7 Merge pull request #1603 from ONLYOFFICE/feature/docx_renderer
Feature/docx renderer
2024-07-26 01:42:31 -07:00
2920527898 Reformat code 2024-07-26 11:40:01 +03:00
7013fdcb8d Merge branch hotfix/v8.1.1 into release/v8.2.0 2024-07-26 08:05:06 +00:00
0d84e22e79 Fix spaces more 2024-07-25 19:13:29 +03:00
f2acef6bb2 Add docbuilder.utils.Utils class to edit PATH on Windows 2024-07-25 20:06:11 +04:00
84b8850a52 Fix bug with spaces 2024-07-25 16:12:40 +03:00
b2a3de852a Fix bug #66692 2024-07-25 17:51:20 +06:00
a8fa59d64d Added ruby support and bug fixes 2024-07-25 14:44:20 +03:00
59b84f26ee Merge remote-tracking branch 'origin/fix/bug68344' into release/v8.2.0 2024-07-25 10:44:47 +03:00
5b17009fb9 Merge remote-tracking branch 'origin/fix/bug68540' into release/v8.2.0 2024-07-25 10:41:50 +03:00
a5827f187c Merge remote-tracking branch 'origin/fix/bug68585' into release/v8.2.0 2024-07-25 10:41:09 +03:00
6ae25ca4c4 Merge remote-tracking branch 'origin/fix/bug69238' into release/v8.2.0 2024-07-25 10:39:58 +03:00
ff4425e977 fix grad 2024-07-24 18:36:10 +03:00
06edc93c7b Fix bug #69238 2024-07-24 18:16:50 +03:00
8f9b35d94a Fix inline destination 2024-07-24 16:35:14 +03:00
14c06e4e7b Fix x coord Outlines 2024-07-24 15:16:21 +03:00
abaaa54bc2 Fix SetByIndex and test example
(now it does work)
2024-07-24 14:05:29 +04:00
7d0683e338 Update test example
(it doesn't work yet)
2024-07-23 20:32:44 +04:00
f9d6b49a05 Rename Call() to call() 2024-07-23 20:31:43 +04:00
01916b7de6 Add file type constants 2024-07-23 19:49:14 +04:00
666d62239e Add class CDocBuilderContext to Java and JNI 2024-07-23 19:36:49 +04:00
2e25f5dc64 Get previous array on return 2024-07-23 18:36:27 +03:00
cc61536a90 Fix function naming for CDocBuilderContextScope 2024-07-23 19:36:01 +04:00
58b5417ab4 Add class CDocBuilderContextScope to Java and JNI 2024-07-23 19:10:08 +04:00
c056c14303 Add hint how to run compiled Java example 2024-07-23 18:15:39 +04:00
1b975c7048 Get headings as an array
Get headings as an array with levels and convert to tree
2024-07-23 17:07:04 +03:00
3fd5b5612b Add test Java example 2024-07-23 17:32:51 +04:00
b8a8d36b8b Improved html to ooxml conversion 2024-07-23 14:55:38 +03:00
ccbeb28f8a fix bug #69325 2024-07-23 14:23:35 +03:00
6ab0d9d106 Fixes in Java code 2024-07-22 21:31:27 +04:00
79309d3f02 Add Java code for CDocBuilder
+ Change private members to package-private
2024-07-22 17:09:48 +04:00
c8c4edf592 Add JNI code for CDocBuilder 2024-07-22 16:37:17 +04:00
64afe55078 Add Java code for CDocBuilderValue
+ Changed all JNI functions to static
2024-07-22 15:28:15 +04:00
967a5728c7 fix build 2024-07-22 11:46:35 +03:00
62b96623a0 Add missed files 2024-07-22 11:04:18 +03:00
8a105d35d5 Merge pull request #1596 from ONLYOFFICE/fix/bug-69284
Fix bug 69284
2024-07-22 00:56:50 -07:00
eaf2c02b86 Fix bug 69284 2024-07-20 13:37:23 +03:00
46f30b980f Add JNI code for CDocBuilderValue 2024-07-19 20:35:42 +04:00
ac4f15b999 Improved html to ooxml conversion 2024-07-19 16:59:58 +03:00
918a940e05 . 2024-07-19 15:18:58 +03:00
47961709ad Fix docbuilder.c ToString function 2024-07-19 13:13:34 +04:00
a47e72cf2f fix bug #69311 2024-07-19 11:07:47 +03:00
472c9ecd0d for bug #61035 2024-07-17 18:21:03 +03:00
7b8aa38c37 Fix bug 45813 2024-07-17 17:40:11 +03:00
5c87955ae2 Fix bug 56118 2024-07-17 16:12:53 +03:00
c37aa9d9dc Fix bug 55429 2024-07-17 16:11:02 +03:00
d699c30bda Fix bug 48721 2024-07-17 16:09:42 +03:00
9db017b9f4 Fix bug 69136 2024-07-17 12:16:44 +03:00
70fe676300 Improved colgroup support in html to ooxml conversion 2024-07-16 18:36:09 +03:00
e73d4455c2 Fix bug 55995
Support pTransferFunc for setSoftMask
2024-07-16 17:57:52 +03:00
3158e830ff Indetns fix 2024-07-16 13:56:17 +03:00
33daee696c Delete unused 2024-07-16 13:13:28 +03:00
305492ec7b Fix flip SoftMask 2024-07-15 18:22:06 +03:00
2d213df8af Create CSoftMask 2024-07-12 18:25:11 +03:00
4bb3953171 Added colgroup implementation for tables in html to ooxml conversion 2024-07-12 18:03:18 +03:00
f8e894af67 Testing agg::scanline_u8_am 2024-07-11 18:27:49 +03:00
777be23513 [android] Replace dependencies 2024-07-11 14:59:43 +03:00
b8af955fcd fix bug #69104 2024-07-11 10:52:47 +03:00
176290adaf Fix bug + refactoring 2024-07-10 19:34:01 +03:00
b3868ff146 fix bug #54575 2024-07-10 16:49:08 +03:00
f30aba8bf1 Added support for the rules attribute for tables in html to ooxml conversion 2024-07-10 15:23:05 +03:00
b039eeca38 fix bug #69097 2024-07-10 13:00:33 +03:00
450cbf0ab1 fix bug #69096 2024-07-10 12:10:14 +03:00
2e33e7d097 fix bug #69095 2024-07-10 12:00:34 +03:00
e9af537e63 Merge remote-tracking branch 'origin/hotfix/v8.1.1' into develop 2024-07-10 11:27:41 +03:00
849d3fb09a Merge pull request #1592 from ONLYOFFICE/fix/pdf-layer 2024-07-09 20:24:32 -07:00
ea76a114f3 Fix Alpha type SoftMask and nesting of layers 2024-07-09 23:15:22 +03:00
fb209c6c8a Fix bugs 2024-07-09 19:49:21 +03:00
d4af1308c0 Merge pull request #1591 from ONLYOFFICE/feature/svg-font
Added custom SVG font
2024-07-09 18:48:00 +03:00
824d9c59cf Fix shapes merging 2024-07-09 16:56:43 +03:00
d4f3cd3801 Fix bugs in html to ooxml conversion 2024-07-09 16:44:50 +03:00
c7fc2bc3a7 The blockquote tag implementation has been added to the html to ooxml conversion 2024-07-09 16:44:32 +03:00
f9ecfee609 Merge pull request #1590 from ONLYOFFICE/pdf/fix-rotate-layer
Fix rotate layer
2024-07-09 06:37:59 -07:00
a8c815d7bd Fix bugs
Fix paragpraph bug
Fix bug with lines in tables
2024-07-09 16:25:32 +03:00
64234659aa Merge pull request #1589 from ONLYOFFICE/fix/bug69073
Fix bug #69073
2024-07-09 06:16:59 -07:00
09c066def3 Change whitespaces on tabs 2024-07-09 19:15:12 +06:00
685434b2ab Merge remote-tracking branch 'origin/hotfix/v8.1.1' into develop 2024-07-09 16:04:22 +03:00
bcfb9b3630 Fix rotate layer 2024-07-09 16:02:57 +03:00
17e6ebeb31 Merge pull request #1584 from ONLYOFFICE/fix/bug68998
Fix bug #68998
2024-07-09 05:28:27 -07:00
ae0e888186 Merge pull request #1588 from ONLYOFFICE/fix/bug-69049
Fix bug 69049
2024-07-09 05:15:46 -07:00
4559d53a97 Change CContText logic 2024-07-09 15:01:34 +03:00
dac41ff6f7 Fix bug #69073 2024-07-09 17:12:21 +06:00
5e5fec1666 add bg 2024-07-09 11:37:35 +03:00
a2d32b59a1 Fix bug 69049 2024-07-09 10:33:56 +03:00
0889f82c76 Merge pull request #1587 from ONLYOFFICE/feature/x2ttester
Fix bug 69056
2024-07-08 11:22:05 -07:00
ee6ea32ad1 Fix bug 69056 2024-07-08 17:30:49 +03:00
69e6ff99f6 Merge pull request #1586 from ONLYOFFICE/fix/EmfPlus
Fix EmfPlus
2024-07-08 04:04:26 -07:00
b763041695 Fixed working with the embedded EmfPlusOnly metafile 2024-07-08 13:58:23 +03:00
adfc64f01e fix bug #69031 2024-07-06 14:00:09 +03:00
f465f17b93 Merge pull request #1585 from ONLYOFFICE/fix/pdf-layer
Fix bugs #69016, #56088, #69019
2024-07-05 09:09:27 -07:00
efd7b5ac9a fix bug #69023 2024-07-05 17:24:33 +03:00
2375b476d0 Fix drawMaskedImage 2024-07-05 17:05:48 +03:00
f97bb4e688 Fix actual fonts 2024-07-05 17:04:56 +03:00
aff7b42f71 Add Isolated for AlphaMask and TransparencyGroup 2024-07-05 15:46:57 +03:00
0675b8c5b5 Fix bug 69019 2024-07-05 15:28:30 +03:00
a27c26dbe3 Fix bug #68998 2024-07-05 18:09:07 +06:00
74d7bbca7c Improvement in html to xml conversion of image size calculation 2024-07-04 18:00:32 +03:00
6eba82f433 Improvement in html to ooxml conversion of multi-level lists 2024-07-04 18:00:06 +03:00
d1460a057e Merge remote-tracking branch 'origin/fix/bug68957' into develop 2024-07-04 15:36:26 +03:00
21ba3ac0c9 fix bug #68957 2024-07-04 15:35:36 +03:00
14196ddc9f Add Mask and Layer for pdf 2024-07-03 17:34:25 +03:00
18db2f8614 Merge pull request #1574 from ONLYOFFICE/fix/bug-68843
Fix bug #68843
2024-07-03 06:58:26 -07:00
81f01f49ed Merge pull request #1583 from ONLYOFFICE/fix/bug-68928
Fix bug 68928
2024-07-03 06:58:08 -07:00
4cb159a794 Fix bug #68928 2024-07-03 16:53:50 +03:00
e164168418 fix bug #68971 2024-07-03 15:07:35 +03:00
fd60059dd6 fix bug #68974 2024-07-03 15:03:03 +03:00
e40be65c55 Merge pull request #1582 from ONLYOFFICE/fix/bug-68951
Fix bug 68951
2024-07-02 09:19:54 -07:00
0bf9663169 Fix bug 68951 2024-07-02 18:51:25 +03:00
b1ff8b79d3 Merge remote-tracking branch 'origin/hotfix/v8.1.1' into develop 2024-07-02 09:52:52 +03:00
efb9095dc5 fix bug #55042 2024-07-02 09:43:40 +03:00
3aab7fd183 fix bug #45681 2024-07-01 17:33:14 +03:00
0c0cd575ad Merge pull request #1579 from ONLYOFFICE/fix/pdf-bugs
Fix bug 60317
2024-07-01 03:17:14 -07:00
82c06b5aaa Merge pull request #1581 from ONLYOFFICE/feature/libvlc-linux
Update libvlc build with changed RPATHs
2024-06-29 11:32:24 -07:00
efa4433195 Added rendering of custom fonts in svg 2024-06-28 21:18:00 +03:00
e9c9530d66 Update build with changed rpaths 2024-06-28 20:27:57 +04:00
6c36fc7146 Add script to change rpaths in libvlc build 2024-06-28 20:27:36 +04:00
34db65ff5e fix bug #68916 2024-06-28 14:36:40 +03:00
5770551ed4 Merge remote-tracking branch 'origin/hotfix/v8.1.1' into develop 2024-06-28 11:28:45 +03:00
75c56c13fc fix bug #68864 2024-06-28 11:10:48 +03:00
e5b0c0f1f9 fix bug #68873 2024-06-28 10:46:51 +03:00
723dcef8aa fix bug #68895 2024-06-28 10:34:42 +03:00
880b96acfc Fix build 2024-06-26 12:30:03 +03:00
81806d96d0 Fix bug 60317 2024-06-26 12:29:51 +03:00
49a9205aad Merge pull request #1576 from ONLYOFFICE/fix/bug68834
Fix bug #68834
2024-06-26 11:58:10 +03:00
971205b325 For bug 59297 2024-06-26 11:02:05 +03:00
73fc80aa7d Merge remote-tracking branch 'origin/fix/bug23800' into develop 2024-06-26 10:03:49 +03:00
84836a3e8b Merge remote-tracking branch 'origin/fix/bug53148' into develop 2024-06-26 10:03:27 +03:00
6dc7ff0874 fix bug #49062 2024-06-26 09:51:20 +03:00
eec0fa47ce Merge remote-tracking branch 'origin/hotfix/v8.1.1' into develop 2024-06-26 09:14:19 +03:00
ebadb754c5 fix bug #68471 2024-06-26 08:59:12 +03:00
7d3bf0c328 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2024-06-26 08:41:11 +03:00
7e7ed8d746 Merge pull request #1577 from ONLYOFFICE/feature/libvlc-linux
Add new libva libraries to linux libVLC build
2024-06-25 11:30:59 -07:00
cd7b39acf2 fix bug #68852 2024-06-25 18:47:51 +03:00
92a3c6cfce Fix Dockerfile 2024-06-25 19:14:16 +04:00
f3e6b5bc21 Add libva libraries to build 2024-06-25 18:42:16 +04:00
95d2939a73 Fix bug 61747 2024-06-25 17:39:06 +03:00
da06f82447 [x2t] Fix bug 68805 2024-06-25 17:17:03 +03:00
5ad4cca9f4 Fix bug #68834 2024-06-25 20:15:58 +06:00
3d528bf8b5 Fix bug #68843
Added switch implementation in svg
2024-06-25 16:39:42 +03:00
fe489b9da0 Rebuild libvlc with libva2 2024-06-25 17:38:25 +04:00
6d9bccee65 fix bug #68601 2024-06-25 16:22:35 +03:00
6ae6c37ef1 Added reading of custom fonts in svg 2024-06-25 15:51:04 +03:00
cc3528c226 Merge pull request #1573 from ONLYOFFICE/fix/bug-68549
Fix bug 68549
2024-06-25 03:36:54 -07:00
db4ae797a1 Fix bug 68549 2024-06-25 13:25:47 +03:00
b1810af6f0 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2024-06-25 10:59:46 +03:00
263b48dea0 Fix bug #53148 2024-06-24 23:04:22 +05:00
128e09f839 Merge pull request #1571 from ONLYOFFICE/fix/bug68007
Fix bug #68007
2024-06-24 17:36:58 +03:00
5b16ea0693 Merge pull request #1570 from ONLYOFFICE/fix/bug58826
Fix bug #58826
2024-06-24 17:36:42 +03:00
be821d6b45 Fix bug #23800 2024-06-24 19:29:28 +05:00
4c08e60ecc Merge pull request #1572 from ONLYOFFICE/fix/bug-68712
Fix bugs 68712, 68751
2024-06-24 07:27:18 -07:00
e55101141c [x2t] Save changes.zip in applyChangesPdf; Fix bug 67341 2024-06-24 16:03:28 +03:00
ce9268f166 Fix for PdfWriter 2024-06-24 15:46:28 +03:00
e7751e891a Fix bug #58826 2024-06-24 17:47:13 +06:00
a3a734a558 fix bug #68769 2024-06-23 10:43:21 +03:00
7326f88aa0 Create CAnnotFonts 2024-06-21 17:23:00 +03:00
83f98f3186 Merge branch 'fix/pre-hotfix' into hotfix/v8.1.1 2024-06-21 17:19:38 +03:00
2d6ef9a38b fix bug #68767 2024-06-21 16:02:21 +03:00
baae7b0a15 Fix bug 68754 2024-06-21 12:17:51 +03:00
5e7caad32a fix bug#68764 2024-06-20 16:16:28 +03:00
a517809a5d fix bug #68766 2024-06-20 16:11:44 +03:00
255fa70292 Fix bug 68751 2024-06-20 12:44:32 +03:00
71ecf1a1e0 Fix bug 68712 2024-06-19 18:29:03 +03:00
8d092ad6e4 Fix bug #68711 2024-06-19 17:55:43 +06:00
d9269bcd33 fix bug #68406 2024-06-19 13:23:11 +03:00
2f45e0952e Fix bug with cloud images 2024-06-19 11:28:22 +03:00
05293f43ce Merge branch release/v8.1.0 into master 2024-06-19 08:22:01 +00:00
df6c20b57d Fix bug #68007 2024-06-18 19:36:37 +06:00
59b3862d89 Fix bug #68585 2024-06-18 17:18:41 +05:00
e80e545024 Merge pull request #1566 from ONLYOFFICE/fix/bug-68688 2024-06-17 07:56:13 -07:00
2245952739 Merge pull request #1567 from ONLYOFFICE/fix/bug-68252 2024-06-17 07:55:25 -07:00
ff52afecc9 Fix bug #68252 2024-06-17 17:50:50 +03:00
5503208e95 Fix bug 68237 2024-06-17 17:29:04 +03:00
90c1ffe7de Fix bugs 68688, 68689
Related bugs 46629, 61014, 68479, 68545
2024-06-17 17:08:18 +03:00
23ef8fd8af Merge pull request #1565 from ONLYOFFICE/fix/bug-68638
Fix bug #68638
2024-06-17 05:01:09 -07:00
e5559e4cf8 Fix bug #68638 2024-06-17 14:22:19 +03:00
91b82d9dcb Merge remote-tracking branch 'origin/release/v8.1.0' into develop 2024-06-14 16:03:23 +03:00
142ed45a1b . 2024-06-14 16:02:49 +03:00
76623ec66d [pdf=>image] Support orientation 2024-06-14 15:51:28 +03:00
d5a4cf73ec Merge pull request #1564 from ONLYOFFICE/feature/StarMath
Fix StarMath
2024-06-14 05:36:03 -07:00
ef530fea0b fix bug 68587 2024-06-14 14:10:51 +03:00
a72b42bd6d Fix placeholder index attribute 2024-06-14 15:58:56 +05:00
e20f98aa4a Merge pull request #1563 from ONLYOFFICE/fix/bug-68629
Fix bug 68629
2024-06-14 02:48:42 -07:00
cc27db504f Fix embedded fonts 2024-06-14 12:34:34 +03:00
1da9dc12b5 Merge pull request #1562 from ONLYOFFICE/fix/svg
Fix svg
2024-06-14 02:11:45 -07:00
6cf95e6151 Fix bug #68638 2024-06-14 12:06:45 +03:00
ad4ba02895 For bug 65310 2024-06-14 11:16:08 +03:00
79c7fced0a For bug 68629 2024-06-14 11:15:33 +03:00
b63ff91ce4 Merge pull request #1561 from ONLYOFFICE/fix/bug-68629
For bug 68237
2024-06-13 23:34:45 -07:00
d0b6c55347 For bug 68237 2024-06-14 09:16:09 +03:00
53f9629194 Merge pull request #1560 from ONLYOFFICE/fix/bug-68609
Fix bug #68609
2024-06-13 09:56:58 -07:00
272b69ae70 Fix bug #68609 2024-06-13 19:43:25 +03:00
8c081c83c9 fix bug 68586 2024-06-13 19:31:38 +03:00
37bef7c398 Merge pull request #1559 from ONLYOFFICE/fix/bug-68546
Fix bug 68546
2024-06-13 08:26:39 -07:00
aae80a161c Clear 2024-06-13 18:04:39 +03:00
a498117748 Fix bug 68546 2024-06-13 17:54:14 +03:00
7a4cebb89c fix bug #68569 2024-06-13 17:46:06 +03:00
3a8c941649 Merge remote-tracking branch 'origin/release/v8.1.0' into develop 2024-06-13 17:22:43 +03:00
32464cb685 The size setting of metafiles has been changed 2024-06-13 17:22:09 +03:00
a8787e9220 Merge pull request #1558 from ONLYOFFICE/fix/bug68545
Fix bug 68545
2024-06-13 07:01:20 -07:00
17bc68d102 Fix bug 68545 2024-06-13 16:49:13 +03:00
ca17a96d32 Fix null 2024-06-13 13:08:21 +03:00
04419326f4 Fix bug 68545 2024-06-13 13:00:13 +03:00
adfbf6ea3f Merge pull request #1549 from ONLYOFFICE/fix/bug-68532
Fix bug 68532
2024-06-13 02:15:00 -07:00
61397b67c1 Merge pull request #1557 from ONLYOFFICE/fix/propsbinary 2024-06-13 02:06:29 -07:00
a6e87b589c add props to binary 2024-06-13 11:56:10 +03:00
5927b0113f Merge pull request #1556 from ONLYOFFICE/fix/bug68540
fix bug #68540
2024-06-11 22:01:39 +03:00
e03b3e9f1b fix bug #68540 2024-06-11 22:01:06 +03:00
ecef6154ff Merge pull request #1555 from ONLYOFFICE/fix/bug65788
fix bug #65788
2024-06-11 21:38:19 +03:00
e16578c3a1 fix bug #65788 2024-06-11 21:36:15 +03:00
3e709a99ed Merge pull request #1548 from ONLYOFFICE/fix/bug68485
Fix bug #68485
2024-06-11 19:56:16 +03:00
c2f0390b6a Merge pull request #1550 from ONLYOFFICE/fix/bug68503
Fix bug #68503
2024-06-11 19:56:04 +03:00
27619798b9 Merge pull request #1551 from ONLYOFFICE/fix/bug68510
Fix bug #68510
2024-06-11 19:55:50 +03:00
e62585a7fc Merge pull request #1553 from ONLYOFFICE/fix/bug68404
Fix bug #68404
2024-06-11 19:45:19 +03:00
19c4a674f6 Merge pull request #1554 from ONLYOFFICE/fix/bug68238
fix bug #68238
2024-06-11 19:45:06 +03:00
505d8093ef fix bug #68238 2024-06-11 19:42:41 +03:00
3316216f8e Fix bug #68404 2024-06-11 19:35:41 +06:00
7131129ba0 Merge pull request #1552 from ONLYOFFICE/feature/StarMath
Fix StarMath
2024-06-11 06:19:47 -07:00
4070725515 Fix bug #68510 2024-06-11 18:34:27 +06:00
5dfeeeb809 Fix bug #68503 2024-06-11 15:52:14 +06:00
14b66e2bb3 Fix bug 68532 2024-06-11 11:39:04 +03:00
9a5e1464bd Fix bug #68485 2024-06-11 12:32:39 +06:00
af9a69d0f2 Update logic & fix bugs 2024-06-11 08:00:48 +03:00
819e568a35 Merge pull request #1547 from ONLYOFFICE/fix/bug-64722
Fix bug #64722
2024-06-10 03:36:46 -07:00
c8ce9c8a35 Merge pull request #1546 from ONLYOFFICE/fix/bug-68479
Fix bug 68479
2024-06-10 01:39:53 -07:00
95f91b816a Fix bug #64722 2024-06-10 11:18:54 +03:00
29788a5d1b Fix bug 68479 2024-06-10 11:14:55 +03:00
a81fb19e1a fix bug 68445 2024-06-10 10:35:08 +03:00
c82c8743f8 improvement of parsing and bracket conversion 2024-06-10 10:08:23 +03:00
ebef9ad556 Merge pull request #1545 from ONLYOFFICE/fix/bug68186 2024-06-07 18:45:05 +03:00
a564d289b7 Merge pull request #1543 from ONLYOFFICE/fix/html-bugs
Fix html bugs
2024-06-07 18:31:25 +03:00
a98ee52dc5 Fix bug 68186 2024-06-07 17:32:55 +03:00
f39355156c Merge remote-tracking branch 'origin/release/v8.1.0' into develop 2024-06-07 17:28:36 +03:00
99a560bebd Merge pull request #1544 from ONLYOFFICE/fix/bug68390
Fix bug #68390
2024-06-07 14:28:46 +03:00
cb10bccd6a Merge pull request #1538 from ONLYOFFICE/fix/bug68404
Fix bug #68404
2024-06-07 14:27:57 +03:00
c219ce8b06 Merge pull request #1537 from ONLYOFFICE/fix/bug68402
Fix bug #68402
2024-06-07 14:27:04 +03:00
afc8dd6e48 Merge pull request #1536 from ONLYOFFICE/fix/bug68400
Fix bug #68400
2024-06-07 14:24:14 +03:00
505c28f88d Merge pull request #1532 from ONLYOFFICE/fix/bug68238
Fix bug #68238
2024-06-07 14:23:44 +03:00
49d789dc77 Merge pull request #1524 from ONLYOFFICE/fix/bug65172
Fix bug #65172
2024-06-07 14:22:56 +03:00
2da89c8b03 Fix bug #68390 2024-06-07 15:59:35 +06:00
24fb53ac6f Fix bug #68426 2024-06-07 12:20:28 +03:00
4af39960da Fix bug #50286 2024-06-07 12:20:08 +03:00
29115060b4 Merge pull request #1540 from ONLYOFFICE/release/v8.1.0
Release/v8.1.0
2024-06-06 23:03:36 +03:00
dc485997f0 Merge pull request #1539 from ONLYOFFICE/feature/StarMath
Fix StarMath
2024-06-06 22:15:52 +03:00
2e6d5450b4 fix bug #66811 2024-06-06 16:22:04 +03:00
4ed4c5596f Fix bug #68404 2024-06-06 17:38:26 +06:00
dea44f1829 Fix bug #68402 2024-06-06 16:57:06 +06:00
b428487d07 Merge pull request #1535 from ONLYOFFICE/fix/bug-68123
Fix bug 68123
2024-06-06 13:22:30 +03:00
f366cae604 Fix bug #68400 2024-06-06 16:20:11 +06:00
96ea86e3c0 Fix bug 68123 2024-06-06 13:09:07 +03:00
5c7d0a61be fix bug 68332 2024-06-06 11:59:48 +03:00
4014d4914f fix bug 68327 2024-06-06 11:02:30 +03:00
0b77fb2bba fix bug 68333 2024-06-06 10:38:01 +03:00
2e1ccbc985 For bug 46629 2024-06-06 10:21:51 +03:00
f5202108a1 Merge pull request #1534 from ONLYOFFICE/fix/bug-68252
Fix bug #68252
2024-06-06 09:45:18 +03:00
2f7407bd8e Merge pull request #1533 from ONLYOFFICE/fix/bug-67967
Fix bug 67967
2024-06-06 09:45:00 +03:00
ac721572f2 Fix bug #67967 2024-06-06 08:51:59 +03:00
33da43b2f4 Fix bug 67747 2024-06-05 19:57:56 +03:00
6000944cc9 Fix bug #68238 2024-06-05 19:20:58 +06:00
591dffc965 Merge pull request #1531 from ONLYOFFICE/feature/StarMath
fix bug 68328
2024-06-05 15:57:20 +03:00
cd74ef4ded fix bug 68328 2024-06-05 15:52:33 +03:00
c7612a259d Add support create & save pdf forms 2024-06-05 14:41:41 +03:00
f665afc1ad Fix bug #68344 2024-06-05 14:31:48 +05:00
586455310a Merge pull request #1530 from ONLYOFFICE/fix/pdf-tilingPattern
Fix swap RGB pdf tilingPattern
2024-06-05 12:25:31 +03:00
96008085d6 Fix swap RGB 2024-06-05 11:46:30 +03:00
282b87e518 Merge pull request #1529 from ONLYOFFICE/fix/bug-63346
Fix bugs 63346, 66523
2024-06-05 11:16:00 +03:00
115a60c273 For bug 68216 2024-06-05 02:26:58 +03:00
66d48673cf Fix min tilingPattern 2024-06-04 15:41:58 +03:00
29ef74770a Fix bug 66523 2024-06-04 13:22:18 +03:00
15247d39f0 Fix bug 63346 2024-06-04 12:22:21 +03:00
e18fc06c7b Fix bug in first word splitting 2024-06-04 11:12:18 +03:00
145154690b Merge pull request #1528 from ONLYOFFICE/fix/bug-68349
For bug 68349
2024-06-04 09:59:16 +03:00
4f28d8d3d8 For bug 68349 2024-06-04 09:55:42 +03:00
4cd6e99531 Merge pull request #1527 from ONLYOFFICE/release/v8.1.0
Release/v8.1.0
2024-06-03 20:10:54 +03:00
2d3cd6bd3a Merge remote-tracking branch 'origin/release/v8.1.0' into develop 2024-06-03 16:15:48 +03:00
2fdd88bee2 Merge remote-tracking branch 'origin/fix/bug68170' into release/v8.1.0 2024-06-03 14:50:28 +03:00
7c501fe5a3 Fix bug #68252 2024-06-03 12:06:29 +03:00
acbf5b0c40 Fix bug #68170
Add image alternative text and description
2024-06-03 13:22:38 +05:00
d843cf1fe1 Fix bug #63489
Convert text divided into columns
2024-06-03 13:21:35 +05:00
50529346e4 Merge remote-tracking branch 'origin/release/v8.1.0' into fix/bug63489 2024-06-03 13:21:03 +05:00
803fcf3602 fix bug #68304 2024-06-02 17:35:48 +03:00
d83930bf67 fix bug #68307 2024-06-02 16:59:20 +03:00
cd5ca284e1 Change IsDouble method: return true if value has integer type 2024-06-02 15:37:04 +03:00
7a1a59a883 For bug 68028 2024-06-02 10:20:52 +03:00
56a08867db refactoring 2024-05-31 21:45:44 +03:00
bfb97ef026 Merge pull request #1526 from ONLYOFFICE/fix/pdf-tilepattern
Fix pdf rotate point
2024-05-31 16:47:41 +03:00
742cfde620 Fix rotate point 2024-05-31 16:39:41 +03:00
600fd26e30 fix build 2024-05-31 13:45:15 +03:00
92fa08303e Merge pull request #1525 from ONLYOFFICE/fix/pdf-default-color
Fix default color
2024-05-31 11:52:22 +03:00
17bd0f99dd Fix default color 2024-05-31 11:49:05 +03:00
4eaf500040 Fix bug #65172 2024-05-30 23:20:35 +06:00
d5d4d06553 Merge pull request #1517 from ONLYOFFICE/fix/bug66009
Fix bug #66009
2024-05-30 16:47:53 +03:00
400da99fa9 Merge pull request #1522 from ONLYOFFICE/fix/bug68229
Fix bug #68229
2024-05-30 16:46:56 +03:00
85be8041b1 Merge remote-tracking branch 'origin/release/v8.1.0' into develop 2024-05-30 16:42:51 +03:00
b209e00333 fix bug #68276 2024-05-30 16:30:59 +03:00
f86548c873 Refactoring 2024-05-30 16:27:00 +03:00
1859173fb6 Merge pull request #1523 from ONLYOFFICE/fix/bug-68256
Fix bug 68256
2024-05-30 13:06:54 +03:00
dfb0aeefcb Fix read/write tilingPattern in pdf 2024-05-30 12:45:56 +03:00
6ba5d1141e Fix bug 68256 2024-05-30 12:45:17 +03:00
8d6a13b24a Fix bug #68229 2024-05-30 15:41:52 +06:00
a66fdc73a5 fix bug #68264 2024-05-29 20:35:44 +03:00
a2b8fcc5e1 for bug #61035 2024-05-29 20:03:17 +03:00
7ac5ff5383 Merge pull request #1521 from ONLYOFFICE/fix/bug-68233
Fix bug 68233
2024-05-29 15:50:42 +03:00
5e560528a4 Fix bug 68233 2024-05-29 15:08:32 +03:00
b8c57da779 Merge pull request #1519 from ONLYOFFICE/fix/html
Fix html/mht bugs
2024-05-29 11:43:39 +03:00
19951d807c Merge pull request #1520 from ONLYOFFICE/feature/jsc-inspectable-context
Set contexts inspectable for JSC
2024-05-29 09:58:59 +03:00
49d1426831 Fix bug #68230 2024-05-29 01:33:56 +03:00
e8ae960a26 Fix bug #68235 2024-05-29 01:32:54 +03:00
11ddc0ab4f Set contexts inspectable for JSC 2024-05-28 23:50:21 +04:00
5361740a02 Merge pull request #1518 from ONLYOFFICE/fix/bug-68225
Fix bug 68225
2024-05-28 16:44:09 +03:00
0050c6148c Fix bug 68225 2024-05-28 16:33:41 +03:00
8e3df68ffc fix bug #50594 2024-05-28 15:27:12 +03:00
ab829fa8db fix bug #68213 2024-05-28 11:28:19 +03:00
be64e3e624 Fix spacing 2024-05-28 11:05:59 +03:00
2f6a542d02 Fix tatPlainParagraph type 2024-05-28 05:48:49 +03:00
f69b52e232 Fix bug 68004 2024-05-28 04:57:26 +03:00
ce15265d5a Fix split logic (in progress) 2024-05-27 23:28:05 +03:00
370e317b79 Updated split logic (in progress) 2024-05-27 22:21:28 +03:00
bc56de19c1 Fix bug #66009 2024-05-27 20:11:30 +06:00
1de6787014 Merge pull request #1516 from ONLYOFFICE/feature/StarMath
fix StarMath attribute
2024-05-27 13:32:11 +03:00
b02189c14d Merge pull request #1504 from ONLYOFFICE/fix/html
Fix html bugs
2024-05-27 13:23:40 +03:00
63003a5e76 fix bug 68094 2024-05-27 11:57:54 +03:00
499810dbae . 2024-05-27 08:01:06 +03:00
f55d822c4f fix build 2024-05-26 20:17:44 +03:00
4c51371b96 Merge pull request #1513 from ONLYOFFICE/fix/pdf-rotate
Fix pdf rotate
2024-05-25 21:53:19 +03:00
4be711c0bf Merge remote-tracking branch 'origin/release/v8.1.0' into develop 2024-05-24 17:43:32 +03:00
986bcae0e2 Merge pull request #1514 from ONLYOFFICE/fix/bug68109
Fix bug #68109
2024-05-24 17:20:27 +03:00
96b87265bb Merge pull request #1515 from ONLYOFFICE/fix/bug68113
Fix bug #68113
2024-05-24 17:19:24 +03:00
0be217ba05 Fix bug #68109 2024-05-24 18:23:17 +06:00
af12226bfa Fix FlateDecode for annot view 2024-05-24 14:51:30 +03:00
d51f035561 Fix AddShape for NewPage 2024-05-24 14:32:29 +03:00
d01681bb1e Fix bug #66549 2024-05-24 12:02:18 +03:00
72e975f7d9 Merge pull request #1512 from ONLYOFFICE/fix/pdf-bug
Fix bugs 54371, 67641
2024-05-24 09:57:00 +03:00
ba87df6b9d Fix bug 67641 2024-05-24 09:36:51 +03:00
a1fed79a78 Fix bug 54371 2024-05-24 09:36:31 +03:00
08111e8fde fix bug #67992 2024-05-23 17:46:02 +03:00
1286b7f458 fix bug #68122 2024-05-23 17:27:42 +03:00
dcb4364410 Fix bug 67641 2024-05-23 17:23:06 +03:00
55a009713e Fix bug 54371 2024-05-23 16:56:40 +03:00
474828364f Merge remote-tracking branch 'origin/release/v8.1.0' into fix/pdf-rotate 2024-05-23 16:31:30 +03:00
9e145ef9e0 Merge pull request #1511 from ONLYOFFICE/fix/pdf-bug
Fix 67740
2024-05-23 16:27:40 +03:00
40b6178a0d Fix c_nPenWidth0As1px for annot/field renderer 2024-05-23 16:22:52 +03:00
a70f50206d fix bug #67917 2024-05-23 14:36:14 +03:00
40fa3e60c4 Merge remote-tracking branch 'origin/release/v8.1.0' into fix/bug63489 2024-05-23 16:35:05 +05:00
105a193742 fix bug #68143 2024-05-23 14:00:28 +03:00
4ca9a94609 Fix bugs in html 2024-05-23 13:00:50 +03:00
3bfb3ee045 Fix bug #68113 2024-05-23 15:17:23 +06:00
512df584ba Merge branch 'release/v8.1.0' of https://github.com/ONLYOFFICE/core into release/v8.1.0 2024-05-23 12:03:20 +03:00
84eebc69e1 fix bug #68135 2024-05-23 12:03:14 +03:00
7abb3899a7 Merge pull request #1499 from ONLYOFFICE/fix/bug65948
fix bug #65948
2024-05-23 11:48:49 +03:00
f19906c14c Merge pull request #1500 from ONLYOFFICE/fix/bug66694
Fix bug #66694
2024-05-23 11:48:09 +03:00
fd15cdf4d0 Merge pull request #1508 from ONLYOFFICE/fix/bug66675
Fix bug #66675
2024-05-23 11:47:32 +03:00
9d3e553086 Merge pull request #1510 from ONLYOFFICE/fix/bug68111
Fix bug #68111
2024-05-23 11:46:11 +03:00
a19b4a03b3 Fixed a bug with attributes of functions and indexes 2024-05-23 11:27:28 +03:00
90650b1af8 Merge remote-tracking branch 'origin/fix/bug67380' into release/v8.1.0 2024-05-22 19:27:19 +03:00
3780922610 Fix bug #68111 2024-05-22 21:42:33 +06:00
fbb7ab93d6 Fix bug 67740 2024-05-22 17:37:33 +03:00
ca5201e704 FreeText has Rotate 2024-05-22 16:49:19 +03:00
2b13696379 Merge pull request #1509 from ONLYOFFICE/feature/docbuilder-python
Add new features to python docbuilder wrapper
2024-05-22 16:41:20 +03:00
24b32a2ba7 Fix bug #67380 2024-05-22 17:56:53 +05:00
1cdb2b0f15 Add list constructor and automatic conversion to CValue in functions 2024-05-22 16:52:13 +04:00
7758da7173 Add number constants for file types 2024-05-22 15:55:39 +04:00
3cd89354bc Fix pdf rotate for drawingfile 2024-05-22 11:08:12 +03:00
5fbed3db1c Fix double hashtag for color in RC 2024-05-22 10:30:09 +03:00
f28119e646 fix bug #68010 2024-05-21 20:47:23 +03:00
a2b0495254 Fix bug #66675 2024-05-21 21:11:57 +06:00
28f873be5c Merge pull request #1507 from ONLYOFFICE/feature/docbuilder-python
Add functionality in docbuilder python wrapper
2024-05-21 18:10:39 +03:00
5dede9304b Add support added images on recognize 2024-05-21 16:52:54 +03:00
ab52ee7486 Move PATH modify to windows-only section 2024-05-21 17:37:34 +04:00
3bf80a74fe Add split logic in paragraph 2024-05-21 12:13:43 +03:00
8f711f607f fix bug #67989 2024-05-21 11:25:57 +03:00
f2c5fed3c1 Merge pull request #1506 from ONLYOFFICE/fix/pdf-free-text
Fix FreeText renderer length
2024-05-21 10:54:01 +03:00
1602fb2106 Fix FreeText renderer length 2024-05-21 10:49:49 +03:00
c3f72756a4 Merge pull request #1505 from ONLYOFFICE/fix/pdf-build 2024-05-21 10:19:51 +03:00
5f8b557eb5 Fix pdf build 2024-05-21 10:18:18 +03:00
de31b16f91 Add Split logic 2024-05-21 09:27:54 +03:00
9d8e75a957 Fix library names for linux and mac 2024-05-20 19:40:40 +04:00
839844cb4f Merge pull request #1503 from ONLYOFFICE/fix/pdf-shape-img
Fix pdf shape image
2024-05-20 17:57:59 +03:00
fac976a22e Read and write image ref for OShapes 2024-05-20 17:52:22 +03:00
84cb59d7b2 Merge pull request #1502 from ONLYOFFICE/fix/pdf-freetext-rc
Fix pdf freetext
2024-05-20 14:09:06 +03:00
788620079d Add loadLibrary() check and automatic Dispose() 2024-05-20 14:33:43 +04:00
0e5b95f1d8 Refactoring 2024-05-20 13:29:38 +04:00
d0a82d71ee Fix build 2024-05-20 12:29:00 +03:00
97f742f816 Merge remote-tracking branch 'origin/release/v8.1.0' into fix/pdf-freetext-rc
# Conflicts:
#	PdfFile/PdfEditor.cpp
2024-05-20 10:14:57 +03:00
58980e61b7 Fix typo and create folder for tests 2024-05-19 12:02:37 +03:00
5a04f9033b Fix build 2024-05-19 11:33:45 +03:00
28785f13bc Merge pull request #1501 from ONLYOFFICE/feature/docbuilder-python
Feature/docbuilder python
2024-05-19 11:23:46 +03:00
7a73d3288c Refactoring 2024-05-19 11:21:18 +03:00
d82b2dc6ef Fix bug #68073 2024-05-18 14:14:05 +03:00
6ad319554d Fix bug with font-size 2024-05-18 13:42:32 +03:00
ff3b94a23a Fix bug #68036 2024-05-18 13:05:58 +03:00
5227a593ed Fix bug #68034 2024-05-18 13:05:34 +03:00
c802944d3b Fixes in docbuilder.py
+ Add more complex example
+ Add .gitignore
2024-05-17 23:16:02 +04:00
93d77ee945 Added all classes to docbuilder.py 2024-05-17 22:09:38 +04:00
4c101b21d0 Changed lines ending for consistency 2024-05-17 22:07:17 +04:00
05366635c1 Remove development 2024-05-17 18:10:30 +03:00
d853d42090 Fix calculating glyph widths for Base14 fonts 2024-05-17 16:00:23 +03:00
cb06eae63e Merge remote-tracking branch 'origin/release/v8.1.0' into fix/bug63489 2024-05-17 17:20:42 +05:00
6ba40aba51 Fix bug #67380 2024-05-17 16:57:40 +05:00
b8d54fb295 fix bug #65948 2024-05-17 17:55:02 +06:00
84d7eb03f2 Add example of python wrapper 2024-05-17 14:11:22 +04:00
28cd584393 Fix delete functions and add simple c++ example 2024-05-17 14:10:50 +04:00
bd6cc8a759 Merge remote-tracking branch 'origin/fix/bug67926' into release/v8.1.0 2024-05-17 12:21:01 +03:00
7cfd4e2dfa Merge remote-tracking branch 'origin/fix/bug67822' into release/v8.1.0 2024-05-17 12:20:45 +03:00
f923f4e03d Merge remote-tracking branch 'origin/fix/bug67823' into release/v8.1.0 2024-05-17 12:20:32 +03:00
e8898ce424 Merge remote-tracking branch 'origin/fix/bug61378' into release/v8.1.0 2024-05-17 12:19:39 +03:00
ebe045a833 fix bug #67995 2024-05-17 11:56:18 +03:00
140f9970f9 Add wrapper library docbuilder_functions.dll and tests for it 2024-05-17 12:07:22 +04:00
3d23e74818 Fix bug #61378 2024-05-16 21:48:26 +05:00
c24c78267b Write Base14 fonts to pdf 2024-05-16 18:56:59 +03:00
a7501e370b Fix bug #66694 2024-05-16 19:06:13 +06:00
68200895d0 Merge pull request #1496 from ONLYOFFICE/fix/StarMath
Fix/StarMath
2024-05-16 13:57:28 +03:00
b6b99ee9f0 Redirect to annotation rendering 2024-05-15 17:43:59 +03:00
5ea601cde9 fix bug #67973 2024-05-15 16:25:51 +03:00
1e7611f3f9 Add method for duplicate image links on recognize 2024-05-15 13:20:20 +03:00
c14856ac6f fix bug #68011 2024-05-15 11:15:31 +03:00
8857d3daca fix bug #67972 2024-05-15 11:00:27 +03:00
ad1bd06bb3 fix bug #67968 2024-05-15 09:55:58 +03:00
52555f4d9d fix bug #67963 2024-05-15 09:24:08 +03:00
d85b3dd7f0 Support images on recognize 2024-05-14 21:43:21 +03:00
6af44146e5 Merge pull request #1495 from ONLYOFFICE/fix/bug66658
Fix bug 66658
2024-05-14 18:30:42 +03:00
f704c44e9e Merge pull request #1497 from ONLYOFFICE/fix/bug66678
Fix bug #66678
2024-05-14 18:30:10 +03:00
a9884c1efb Merge pull request #1498 from ONLYOFFICE/fix/bug66677
Fix bug #66677
2024-05-14 18:29:50 +03:00
2dc0956b3c Create CAnnotRenderer 2024-05-14 17:52:04 +03:00
7dbe7eb3e1 Fix bug #66677 2024-05-14 19:16:08 +06:00
5617968a0c Fix bug #67926 2024-05-14 17:51:19 +05:00
3b029ae4cd Merge branch 'release/v8.1.0' into fix/StarMath 2024-05-14 14:43:16 +03:00
73dc770870 Fix bug #66678 2024-05-14 17:41:48 +06:00
46e56afa5c bug fix(crashes, parsing correction) 2024-05-14 14:31:24 +03:00
e6842f50b3 Fix bug #bug66658 2024-05-14 15:20:51 +06:00
f4ec536794 Fix bug 67809 2024-05-14 10:40:54 +03:00
f008857ab2 Find Font for FreeText 2024-05-13 18:12:23 +03:00
e7022472ff Merge pull request #1492 from ONLYOFFICE/fix/bug67936
Fix bug #67936
2024-05-13 18:00:11 +03:00
b470c4b259 Merge pull request #1493 from ONLYOFFICE/fix/bug67933
Fix bug #67933
2024-05-13 17:59:56 +03:00
155103b40f Fix bug #67933 2024-05-13 15:30:01 +06:00
0eee7ea548 Merge pull request #1491 from ONLYOFFICE/fix/bug-67916
Fix bug #67916
2024-05-13 01:58:54 -07:00
b53527c9fd Fix bug #67936 2024-05-13 14:53:32 +06:00
fb12bfa57f Add MovablePoints on Label 2024-05-13 11:17:30 +03:00
1a5af05024 Merge pull request #1490 from ONLYOFFICE/release/v8.1.0
Release/v8.1.0
2024-05-13 00:36:14 -07:00
7a842c4b14 Merge pull request #1489 from ONLYOFFICE/fix/html
Fix html
2024-05-12 12:45:44 -07:00
9779e53fe7 The algorithm for checking arrays has been rewritten 2024-05-12 21:50:04 +03:00
5c495dcf8d Merge pull request #1488 from ONLYOFFICE/release/v8.1.0
Release/v8.1.0
2024-05-12 07:16:18 -07:00
6bccf233ee Merge pull request #1477 from ONLYOFFICE/fix/html
Fix bugs in html converter
2024-05-12 06:46:37 -07:00
83e020f492 Fix bug #67916 2024-05-10 14:32:23 +03:00
84e4797ddf fix bug #67940 2024-05-10 10:53:02 +03:00
40e7685751 fix bug #67941 2024-05-10 10:40:07 +03:00
bfdd7be53c Merge pull request #1487 from ONLYOFFICE/fix/bug67919
Fix bug #67919
2024-05-08 17:41:06 +03:00
198498a26d Merge pull request #1486 from ONLYOFFICE/fix/bug67922
Fix bug #67922
2024-05-08 17:40:34 +03:00
3ba74a0373 Merge pull request #1485 from ONLYOFFICE/fix/bug67923
Fix bug #67923
2024-05-08 17:40:17 +03:00
5c7b7615dd Fix find FreeText Fonts object 2024-05-08 17:40:11 +03:00
e2992c2a79 Fix bug #67919 2024-05-08 19:33:43 +06:00
aab5cfe30c Fix bug #67922 2024-05-08 19:15:45 +06:00
f32ace9737 Fix bug #67923 2024-05-08 18:50:17 +06:00
d8bed77b67 Fix bug #67823 2024-05-08 17:05:49 +05:00
7ae79f20b8 Fix bug #67822 2024-05-08 15:12:22 +05:00
0a09d4a872 Merge pull request #1482 from ONLYOFFICE/fix/bug67897
Fix bug67897
2024-05-08 13:06:42 +03:00
68e778ba1f Merge pull request #1483 from ONLYOFFICE/fix/bug67898
Fix bug #67898
2024-05-08 13:06:20 +03:00
6d28d1af1d Merge pull request #1484 from ONLYOFFICE/fix/bug67891
Fix bug #67891
2024-05-08 13:05:52 +03:00
7e7bc0eb0e Fix bug #67891 2024-05-08 15:39:02 +06:00
b32728c9f0 fix bug #66842 2024-05-08 12:06:28 +03:00
39748f9d9e fix bug #67895 2024-05-08 11:49:04 +03:00
dabe547fb4 [android] Build only arm arch 2024-05-08 11:33:09 +03:00
3104f84768 fix bug #67876 2024-05-08 10:53:05 +03:00
bb2967c3ea Write RD and CA for FreeText AP.N 2024-05-07 17:43:26 +03:00
de1c08d65a Fix bug #67898 2024-05-07 20:40:12 +06:00
a68f18c9f2 Fix bug #67897 2024-05-07 19:55:22 +06:00
d16d7a1e76 Merge pull request #1479 from ONLYOFFICE/fix/bug67867
Fix bug #67867
2024-05-07 15:21:18 +03:00
2338218fa6 Merge pull request #1478 from ONLYOFFICE/fix/bug67864
Fix bug67864
2024-05-07 15:21:05 +03:00
a46115f056 Merge pull request #1480 from ONLYOFFICE/fix/bug67860
Fix bug #67860
2024-05-07 15:20:53 +03:00
d61747c283 Merge pull request #1481 from ONLYOFFICE/feature/libvlc-player-vout
Add video output signal to libvlc
2024-05-07 05:12:50 -07:00
10afcda7a3 Add new signal to CVlcPlayer 2024-05-07 14:31:02 +04:00
680c3824f7 Fix bug #67860 2024-05-07 16:00:34 +06:00
194d1c2208 Fix bug #67864 2024-05-07 15:04:29 +06:00
88aba1cb02 Fix MK.IF.A default value 2024-05-07 11:43:20 +03:00
fd664bafae Fix bug #67867 2024-05-07 14:20:46 +06:00
c03ec96966 . 2024-05-07 10:40:24 +03:00
5e02a7c21e Merge remote-tracking branch 'origin/fix/xlsb_conversion' into release/v8.1.0 2024-05-07 10:25:34 +03:00
bce25e9788 Fix mac build 2024-05-06 22:14:57 +03:00
b8332ae05b Merge pull request #1461 from ONLYOFFICE/feature/libvlc-functions
Add some functionality to libvlc player
2024-05-06 09:39:26 -07:00
f1fbcf653b Create StartDrawFreeText 2024-05-06 17:48:12 +03:00
283d611ad7 Fix sparkline conversion 2024-05-06 20:44:19 +06:00
045ca4ad9e . 2024-05-06 16:03:34 +03:00
f7a623a052 Merge branch 'release/v8.1.0' of https://github.com/ONLYOFFICE/core into release/v8.1.0 2024-05-06 15:49:06 +03:00
0439347bc3 fix bug #67782 2024-05-06 15:49:01 +03:00
441716773f Add property for strip x2t library 2024-05-06 15:12:02 +03:00
801e068abb Merge remote-tracking branch 'origin/fix/bug67815' into release/v8.1.0 2024-05-06 14:35:09 +03:00
a44e22c726 fix bug #67818 2024-05-06 14:34:06 +03:00
63bd2a1cbf Fix bug #67815 2024-05-06 15:49:48 +05:00
c88c1aac96 [android] Fix copy libs and build 2024-05-04 20:52:51 +03:00
a2e76364e9 Fix bug #67827 2024-05-04 15:19:06 +03:00
051ae3fab6 Fix bug #67836 2024-05-04 00:34:50 +03:00
f1544a6f6c Fix bug#67829 2024-05-03 22:50:16 +03:00
715facaefc Create AP for FreeText 2024-05-03 17:32:37 +03:00
6de671ccd5 Added language consideration when converting EPUB files 2024-05-03 15:57:29 +03:00
e61a727180 Merge pull request #1475 from ONLYOFFICE/fix/pdf-link
Fix pdf link
2024-05-03 15:42:40 +03:00
30e09e731b Fix delete Link annot in edit mode 2024-05-03 15:39:54 +03:00
d516c625eb Fix EditPage when adding Link in edit mode 2024-05-03 15:39:13 +03:00
9dceffdbeb Fix write RC to NSStringUtils::CStringBuilder 2024-05-03 15:36:51 +03:00
e107a67f55 Fix delete Link annot in edit mode 2024-05-03 15:36:14 +03:00
ee85c3597e fix bug #67011 2024-05-03 15:06:19 +03:00
ddc413a1b3 Fix EditPage when adding Link in edit mode 2024-05-03 13:39:03 +03:00
5c6aaed51f Fix svg file size 2024-05-03 13:18:53 +03:00
234c1766dc Fix bug #67770 2024-05-03 13:18:26 +03:00
95d8fd2871 Fix bug #67767 2024-05-03 13:17:41 +03:00
a6d9af576d . 2024-05-03 12:38:06 +03:00
23c54255e3 Fix ptg conversion 2024-05-03 13:55:29 +06:00
013d6990ce Write RC to FreeText 2024-05-02 18:32:32 +03:00
25b33244a4 fix bug #67011 2024-05-02 15:57:47 +03:00
c8c4127fbb Merge pull request #1474 from ONLYOFFICE/fix/bug62568
Fix/bug62568
2024-05-02 14:53:13 +03:00
33fdfadcf7 fix bug #66679 2024-05-02 11:33:28 +03:00
3d7fa985f7 Change libraries list for x2t 2024-05-01 21:51:58 +03:00
63c9185fd2 Add choice of colors for non parametric gradients 2024-04-29 22:08:28 +03:00
e69dc4f898 Remove unneeded files from compilation 2024-04-27 16:45:28 +03:00
32b5dfc04a for bug #67352 2024-04-27 16:43:18 +03:00
2d78eda6ad Merge remote-tracking branch 'origin/fix/bug65612' into release/v8.1.0 2024-04-27 16:35:59 +03:00
ae03967fb6 Merge remote-tracking branch 'origin/fix/bug61378' into release/v8.1.0 2024-04-27 16:26:27 +03:00
5db50d2ff7 Merge branch 'release/v8.1.0' into fix/xlsb_conversion 2024-04-27 17:43:35 +06:00
af226ceb67 Merge pull request #1473 from ONLYOFFICE/fix/bug67544
fix bug #67544
2024-04-27 14:41:34 +03:00
b17a6be4d5 fix bug #67679 2024-04-27 14:27:17 +03:00
7f791ad265 fix bug #67544 2024-04-27 17:27:11 +06:00
03b568ad49 fix bug #67673 2024-04-27 12:24:30 +03:00
f9bfdee8c3 Merge pull request #1470 from ONLYOFFICE/release/v8.1.0
Release/v8.1.0
2024-04-27 11:53:22 +03:00
123fcf9d3c Merge pull request #1472 from ONLYOFFICE/fix/bug-63701
Fix bug #63701
2024-04-27 11:29:56 +03:00
e673fd5b38 Merge pull request #1471 from ONLYOFFICE/fix/bug-67716
Fix bug #67716
2024-04-27 11:29:24 +03:00
0b07bef0de Fix for pptx shapes 2024-04-27 02:22:33 +03:00
ba4c5b31d1 Fix previous commit 2024-04-27 01:46:43 +03:00
6b5f930a1e Add custom image storage to docxrenderer 2024-04-27 01:44:26 +03:00
51c6fe496b Add parametrs input 2024-04-26 19:40:08 +03:00
4880ff705b Merge branch 'release/v8.1.0' into fix/StarMath 2024-04-26 17:30:39 +03:00
4f7841fa85 Merge pull request #1464 from ONLYOFFICE/fix/bug67231
Fix bug 67231
2024-04-26 17:23:34 +03:00
3acb44a5c9 Fixed drop in assessment. fix bugs. 2024-04-26 17:08:50 +03:00
5108fa6b94 Fix bug 66740 2024-04-26 14:44:03 +03:00
db5909fdf5 Fix bug #67716 2024-04-26 14:39:34 +03:00
051a1fa7ef Fix bug 67444 2024-04-26 12:47:51 +03:00
2fa4cdebb9 Fix table conversion 2024-04-25 21:35:11 +06:00
3c2f4874fc Fix bug #63701 2024-04-25 16:15:48 +03:00
66d8690dc3 Fix bug 66872 2024-04-25 12:08:44 +03:00
0f9b8f14e6 Fix bug #61378 2024-04-24 22:19:35 +05:00
eb1bc2779b Fix formula types conversion 2024-04-24 18:35:38 +06:00
ed9a5f1a24 editing tabs 2024-04-23 15:55:32 +03:00
31090af440 Fix array formula conversion 2024-04-22 16:32:40 +06:00
73624f28ac Fix android build 2024-04-20 14:02:19 +03:00
9daa8a1239 Fix build 2024-04-20 13:21:45 +03:00
82b634878f Fix build 2024-04-20 12:40:01 +03:00
033f61576e Merge pull request #1466 from ONLYOFFICE/fix/mht
Improved html and mht conversion
2024-04-19 20:50:11 +03:00
283f21de86 Add class Custom label for handle click 2024-04-19 20:13:30 +03:00
6de60d2543 Fix bugs in html to ooxml conversion 2024-04-19 19:20:45 +03:00
b7af10970a Merge pull request #1465 from ONLYOFFICE/fix/csv-date-conversion
Fix csv date conversion
2024-04-19 14:26:56 +03:00
c18224ea07 Fix csv date conversion 2024-04-19 17:17:14 +06:00
0a088eb949 fix bug 67231 2024-04-18 21:32:51 +03:00
48df470387 Merge pull request #1463 from ONLYOFFICE/fix/pdf-text-annot
Fix pdf text annot
2024-04-18 18:19:01 +03:00
c3767cf68e Fix bug 67439 2024-04-18 18:01:23 +03:00
663248ae2b Merge branch 'release/v8.1.0' into fix/xlsb_conversion 2024-04-18 20:53:34 +06:00
040ead411f Fixed a bug with encoding detection 2024-04-18 15:04:50 +03:00
a94a068202 Fix cell error conversion 2024-04-18 17:58:50 +06:00
05ad136231 Draw AP for 11-16 types text annot 2024-04-18 12:18:57 +03:00
b6c81a1f05 Draw AP for 0-10 types text annot 2024-04-17 17:52:20 +03:00
513b39b156 Fix bugs in html to ooxml conversion 2024-04-17 16:33:44 +03:00
2956768477 Merge pull request #1462 from ONLYOFFICE/fix/pdf-annot-text
Fix pdf annot text
2024-04-17 13:17:01 +03:00
a782d26621 Fix build 2024-04-17 13:04:55 +03:00
c859b5c440 Rename IsEditPage 2024-04-17 12:50:43 +03:00
6065c8b1f2 Fix bug 67337 2024-04-17 12:47:42 +03:00
bd39d887cf Create DrawTextComment-N and -R 2024-04-16 17:35:52 +03:00
6778a4c0da Add operators check in pthtypesParsing 2024-04-16 18:17:49 +06:00
2901f337e7 Add some functionality to libvlc player 2024-04-16 15:15:37 +04:00
ca179304c3 Fix bugs in html to ooxml conversion 2024-04-15 21:46:24 +03:00
cb53604c13 Add parsing ptg types method 2024-04-15 19:27:19 +06:00
1e18eb4335 Merge pull request #1459 from ONLYOFFICE/fix/x2t_date_time 2024-04-12 20:32:58 +03:00
ddb01d9478 Sets bDateTime true by default 2024-04-12 20:19:12 +03:00
52a07814f4 Improving the quality of converting html tables to ooxml and refactoring 2024-04-12 13:17:13 +03:00
8309c5bbfe End every paragraph with a:endParaRPr 2024-04-11 15:12:26 +05:00
0700038802 Refactoring 2024-04-10 19:12:01 +03:00
d733af03aa Fix icon set conversion 2024-04-10 20:30:26 +06:00
3e4c531538 Add default parametrs and new gradient types 2024-04-10 01:18:40 +03:00
e728a58222 Fix cond fmt conversion from xlsb to xlsx 2024-04-09 22:17:25 +06:00
8491d20439 Add fmla test case 2024-04-09 20:31:24 +06:00
30ae04fd6e Update test files 2024-04-09 20:31:09 +06:00
471c9a4ebd Improved work with caption tables when html to ooxml conversion 2024-04-09 16:18:46 +03:00
f5ca81240b Fix connection conversion 2024-04-09 14:13:29 +06:00
2ab2cb7cf2 Fix connections conversion 2024-04-08 18:45:59 +06:00
29afb2aed9 Add Triangle gradient 2024-04-05 19:34:20 +03:00
10c6def10e Bug fixed. Editing sqrt and nroot, dropping parentheses. 2024-04-05 15:54:31 +03:00
7f17f30650 for bug 67231 2024-04-04 20:42:29 +03:00
463ca006ee Fixed bugs with tables in html to ooxml conversion 2024-04-04 16:48:52 +03:00
12fd3bd3ce Comment conditional formattings ext 2024-04-04 17:20:59 +06:00
86b53b7ede Refactoring 2024-04-04 10:22:35 +03:00
078e9afcc2 Fix conditional formatting conversion 2024-04-03 21:31:09 +06:00
21e3293895 fix image size from pixels to millimeters 2024-04-03 15:31:07 +03:00
cd86a8a3c7 fix image size and GenerateImg method 2024-04-02 00:47:50 +03:00
c44aed0e9a Refactoring 2024-03-30 12:53:30 +03:00
9e1e641218 Add test for Linear and Radial gradients 2024-03-29 12:37:31 +03:00
a31361fe05 Added a method for equating any one to the nearest of the given ones 2024-03-26 19:38:12 +03:00
9e260897b3 Fixed a bug with the percentage size of the svg file 2024-03-26 10:56:52 +03:00
03244e9e83 For bug #65612
Fix Split/Cover transition parameter conversion
2024-03-21 14:44:44 +05:00
c9fbe4189c Added merging of extra cells in html to ooxml conversion 2024-03-20 13:51:18 +03:00
fb4c8ebf32 Refactoring and fix bugs 2024-03-15 15:57:57 +03:00
dc3a4a3ed9 Merge branch hotfix/v8.0.1 into master 2024-03-15 11:12:24 +00:00
53ca119a99 Improved conversion of tables from html to ooxml 2024-03-15 12:58:03 +03:00
e18883f126 Fix bugs in html to ooxml conversion 2024-03-12 14:54:08 +03:00
8a9e5ad267 Fix bugs in html to ooxml conversion 2024-03-12 10:46:05 +03:00
f9cd49a756 Fix bugs 2024-03-07 16:05:31 +03:00
36dbd4f0e1 Refactoring 2024-03-06 15:55:12 +03:00
9e24a89fd4 Fix bugs 2024-03-04 15:56:02 +03:00
1a86da3559 Fix bug #66670 2024-03-01 16:33:44 +03:00
00c95da6c0 Merge pull request #1430 from ONLYOFFICE/fix/66463
Fix bug #66463
2024-03-01 15:37:29 +03:00
bb1d5401d2 Refactoring 2024-03-01 15:24:09 +03:00
e2dc625b0a Fix bugs and refactoring 2024-03-01 13:54:47 +03:00
ed0d1fbdb0 Refactoring 2024-02-27 14:54:45 +03:00
849ad8ac87 Fixed bugs with styles in html->ooxml conversion and refactoring 2024-02-27 14:18:04 +03:00
8ca63e5013 Merge branch hotfix/v8.0.1 into master 2024-02-26 07:33:51 +00:00
f8184532c8 Added support for reading @page and bug fixes in html to ooxml conversion 2024-02-22 18:10:26 +03:00
3320547735 Fix bug #66463 2024-02-21 22:41:35 +03:00
b56e21d6c7 Improved padding in html to ooxml conversion 2024-02-19 18:33:31 +03:00
56a09831cc Improved conversion of style settings of html tables to ooxml 2024-02-16 16:39:50 +03:00
4736f93aa8 Fixed the unnecessary appearance of the table border in html to ooxml conversion 2024-02-13 18:10:17 +03:00
479943f5e2 Improved conversion of html tables to ooxml 2024-02-09 16:36:54 +03:00
a7a80cb92e Fixed some inaccuracies in the conversion of html tables 2024-02-08 18:55:17 +03:00
92663a7ae3 Fix bug #62568 2024-02-06 17:37:12 +05:00
ee0ab7f042 Fix gradient path conversion 2024-02-06 17:36:36 +05:00
2e22646c34 Convert table templates 2024-02-06 17:36:06 +05:00
7e5da0b22c Fix bug #63701 2024-02-06 10:38:49 +03:00
b36c1ae9e7 Fix bug #59451 2024-02-05 18:05:55 +03:00
d1a35c2e9c Refactoring in HtmlFile2 2024-01-22 18:39:00 +03:00
6f5fa6c4ca Switching to case-insensitive search in html2 2023-12-26 20:31:04 +03:00
918 changed files with 32538 additions and 16081 deletions

View File

@ -1,16 +1,18 @@
INCLUDEPATH += $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/include
CORE_BOOST_LIBS = $$PWD/build/$$CORE_BUILDS_PLATFORM_PREFIX/lib
core_ios:CONFIG += disable_enum_constexpr_conversion
core_android:CONFIG += disable_enum_constexpr_conversion
core_mac:CONFIG += disable_enum_constexpr_conversion
core_android {
INCLUDEPATH += $$PWD/build/android/include
CORE_BOOST_LIBS = $$PWD/build/android/lib/$$CORE_BUILDS_PLATFORM_PREFIX
DEFINES += "_HAS_AUTO_PTR_ETC=0"
QMAKE_CFLAGS += -Wno-enum-constexpr-conversion
QMAKE_CXXFLAGS += -Wno-enum-constexpr-conversion
}
core_ios {
disable_enum_constexpr_conversion {
QMAKE_CFLAGS += -Wno-enum-constexpr-conversion
QMAKE_CXXFLAGS += -Wno-enum-constexpr-conversion
}

View File

@ -12,22 +12,20 @@
#include "StaticFunctions.h"
#include "ConstValues.h"
#define DEFAULTFONTSIZE 28 // 14 * 2
#define DEFAULT_FONT_SIZE 14
namespace NSCSS
{
typedef std::map<std::wstring, std::wstring>::const_iterator styles_iterator;
CCompiledStyle::CCompiledStyle() : m_nDpi(96), m_UnitMeasure(Point)
{
m_oFont.SetSize(std::to_wstring(DEFAULTFONTSIZE), 0, true);
}
{}
CCompiledStyle::CCompiledStyle(const CCompiledStyle& oStyle) :
m_arParentsStyles(oStyle.m_arParentsStyles), m_sId(oStyle.m_sId),
m_nDpi(oStyle.m_nDpi), m_UnitMeasure(oStyle.m_UnitMeasure),
m_oFont(oStyle.m_oFont), m_oMargin(oStyle.m_oMargin), m_oPadding(oStyle.m_oPadding), m_oBackground(oStyle.m_oBackground),
m_oText(oStyle.m_oText), m_oBorder(oStyle.m_oBorder), m_oDisplay(oStyle.m_oDisplay){}
CCompiledStyle::CCompiledStyle(const CCompiledStyle& oStyle) :
m_arParentsStyles(oStyle.m_arParentsStyles), m_sId(oStyle.m_sId),
m_nDpi(oStyle.m_nDpi), m_UnitMeasure(oStyle.m_UnitMeasure),
m_oFont(oStyle.m_oFont), m_oMargin(oStyle.m_oMargin), m_oPadding(oStyle.m_oPadding), m_oBackground(oStyle.m_oBackground),
m_oText(oStyle.m_oText), m_oBorder(oStyle.m_oBorder), m_oDisplay(oStyle.m_oDisplay){}
CCompiledStyle::~CCompiledStyle()
{
@ -36,6 +34,9 @@ namespace NSCSS
CCompiledStyle& CCompiledStyle::operator+= (const CCompiledStyle &oElement)
{
if (oElement.Empty())
return *this;
m_oBackground += oElement.m_oBackground;
m_oBorder += oElement.m_oBorder;
m_oFont += oElement.m_oFont;
@ -44,6 +45,9 @@ namespace NSCSS
m_oText += oElement.m_oText;
m_oDisplay += oElement.m_oDisplay;
if (!oElement.m_sId.empty())
m_sId += L'+' + oElement.m_sId;
return *this;
}
@ -68,9 +72,7 @@ namespace NSCSS
bool CCompiledStyle::operator== (const CCompiledStyle& oStyle) const
{
return GetId()[0] == oStyle.GetId()[0] &&
m_arParentsStyles == oStyle.m_arParentsStyles &&
m_oBackground == oStyle.m_oBackground &&
return m_oBackground == oStyle.m_oBackground &&
m_oBorder == oStyle.m_oBorder &&
m_oFont == oStyle.m_oFont &&
m_oMargin == oStyle.m_oMargin &&
@ -100,16 +102,6 @@ namespace NSCSS
m_UnitMeasure = enUnitMeasure;
}
void CCompiledStyle::SetSizeSourceWindow(const CSizeWindow &oSizeWindow)
{
m_oSourceWindow = oSizeWindow;
}
void CCompiledStyle::SetSizeDeviceWindow(const CSizeWindow &oSizeWindow)
{
m_oDeviceWindow = oSizeWindow;
}
bool CCompiledStyle::Empty() const
{
return m_oBackground.Empty() && m_oBorder.Empty() && m_oFont.Empty() &&
@ -124,8 +116,8 @@ namespace NSCSS
void CCompiledStyle::AddStyle(const std::map<std::wstring, std::wstring>& mStyle, const unsigned int unLevel, const bool& bHardMode)
{
const bool bIsThereBorder = (m_oBorder.Empty()) ? false : true;
const double dFontSize = m_oFont.GetSize().ToDouble(NSCSS::Twips);
const double dFontSize = (!m_oFont.GetSize().Empty()) ? m_oFont.GetSize().ToDouble(NSCSS::Point) : DEFAULT_FONT_SIZE;
for (std::pair<std::wstring, std::wstring> pPropertie : mStyle)
{
std::transform(pPropertie.first.begin(), pPropertie.first.end(), pPropertie.first.begin(), tolower);
@ -183,45 +175,48 @@ namespace NSCSS
if (bIsThereBorder)
break;
m_oMargin.AddValue(pPropertie.second, unLevel, bHardMode);
m_oMargin.SetValues(pPropertie.second, unLevel, bHardMode);
m_oMargin.UpdateAll(dFontSize);
break;
}
CASE(L"margin-top"):
CASE(L"topmargin"):
{
if (bIsThereBorder)
break;
m_oMargin.AddTop(pPropertie.second, unLevel, bHardMode);
m_oMargin.UpdateTop(dFontSize);
m_oMargin.SetTop(pPropertie.second, unLevel, bHardMode);
break;
}
CASE(L"margin-right"):
CASE(L"margin-block-end"):
CASE(L"rightmargin"):
{
if (bIsThereBorder)
break;
m_oMargin.AddRight(pPropertie.second, unLevel, bHardMode);
m_oMargin.SetRight(pPropertie.second, unLevel, bHardMode);
m_oMargin.UpdateRight(dFontSize);
break;
}
CASE(L"margin-bottom"):
CASE(L"bottommargin"):
{
if (bIsThereBorder)
break;
m_oMargin.AddBottom(pPropertie.second, unLevel, bHardMode);
m_oMargin.SetBottom(pPropertie.second, unLevel, bHardMode);
m_oMargin.UpdateBottom(dFontSize);
break;
}
CASE(L"margin-left"):
CASE(L"margin-block-start"):
CASE(L"leftmargin"):
{
if (bIsThereBorder)
break;
m_oMargin.AddLeft(pPropertie.second, unLevel, bHardMode);
m_oMargin.SetLeft(pPropertie.second, unLevel, bHardMode);
m_oMargin.UpdateLeft(dFontSize);
break;
}
@ -229,35 +224,35 @@ namespace NSCSS
CASE(L"padding"):
CASE(L"mso-padding-alt"):
{
m_oPadding.AddValue(pPropertie.second, unLevel, bHardMode);
m_oPadding.SetValues(pPropertie.second, unLevel, bHardMode);
m_oPadding.UpdateAll(dFontSize);
break;
}
CASE(L"padding-top"):
CASE(L"mso-padding-top-alt"):
{
m_oPadding.AddTop(pPropertie.second, unLevel, bHardMode);
m_oPadding.SetTop(pPropertie.second, unLevel, bHardMode);
m_oPadding.UpdateTop(dFontSize);
break;
}
CASE(L"padding-right"):
CASE(L"mso-padding-right-alt"):
{
m_oPadding.AddRight(pPropertie.second, unLevel, bHardMode);
m_oPadding.SetRight(pPropertie.second, unLevel, bHardMode);
m_oPadding.UpdateRight(dFontSize);
break;
}
CASE(L"padding-bottom"):
CASE(L"mso-padding-bottom-alt"):
{
m_oPadding.AddBottom(pPropertie.second, unLevel, bHardMode);
m_oPadding.SetBottom(pPropertie.second, unLevel, bHardMode);
m_oPadding.UpdateBottom(dFontSize);
break;
}
CASE(L"padding-left"):
CASE(L"mso-padding-left-alt"):
{
m_oPadding.AddLeft(pPropertie.second, unLevel, bHardMode);
m_oPadding.SetLeft(pPropertie.second, unLevel, bHardMode);
m_oPadding.UpdateLeft(dFontSize);
break;
}
@ -305,6 +300,11 @@ namespace NSCSS
m_oBorder.SetColor(pPropertie.second, unLevel, bHardMode);
break;
}
CASE(L"border-collapse"):
{
m_oBorder.SetCollapse(pPropertie.second, unLevel, bHardMode);
break;
}
//BORDER TOP
CASE(L"border-top"):
{
@ -393,20 +393,12 @@ namespace NSCSS
CASE(L"background-color"):
{
m_oBackground.SetColor(pPropertie.second, unLevel, bHardMode);
if (bIsThereBorder)
m_oBackground.InBorder();
break;
}
CASE(L"background"):
CASE(L"bgcolor"):
{
m_oBackground.SetBackground(pPropertie.second, unLevel, bHardMode);
if (bIsThereBorder)
m_oBackground.InBorder();
break;
}
//DISPLAY
@ -431,6 +423,7 @@ namespace NSCSS
break;
}
CASE(L"vertical-align"):
CASE(L"valign"):
{
m_oDisplay.SetVAlign(pPropertie.second, unLevel, bHardMode);
break;
@ -501,6 +494,11 @@ namespace NSCSS
return arParentsName;
}
std::set<std::wstring> CCompiledStyle::GetParentsNamesSet() const
{
return m_arParentsStyles;
}
void CCompiledStyle::SetID(const std::wstring& sId)
{
m_sId = sId;
@ -510,4 +508,9 @@ namespace NSCSS
{
return m_sId;
}
bool CCompiledStyle::HaveThisParent(const std::wstring &wsParentName) const
{
return m_arParentsStyles.end() != m_arParentsStyles.find(wsParentName);
}
}

View File

@ -22,9 +22,6 @@ namespace NSCSS
unsigned short int m_nDpi;
UnitMeasure m_UnitMeasure;
CSizeWindow m_oSourceWindow;
CSizeWindow m_oDeviceWindow;
public:
NSProperties::CFont m_oFont;
NSProperties::CIndent m_oMargin;
@ -41,8 +38,6 @@ namespace NSCSS
void SetDpi(const unsigned short& uiDpi);
void SetUnitMeasure(const UnitMeasure& enUnitMeasure);
void SetSizeSourceWindow(const CSizeWindow& oSizeWindow);
void SetSizeDeviceWindow(const CSizeWindow& oSizeWindow);
bool Empty() const;
@ -53,10 +48,13 @@ namespace NSCSS
void AddParent(const std::wstring& sParentName);
std::vector<std::wstring> GetParentsName() const;
std::set<std::wstring> GetParentsNamesSet() const;
void SetID(const std::wstring& sId);
std::wstring GetId() const;
bool HaveThisParent(const std::wstring& wsParentName) const;
CCompiledStyle& operator+= (const CCompiledStyle& oElement);
CCompiledStyle& operator= (const CCompiledStyle& oElement);
bool operator== (const CCompiledStyle& oElement) const;

View File

@ -1,7 +1,6 @@
#include "CCssCalculator.h"
#include "CCssCalculator_Private.h"
namespace NSCSS
{
CCssCalculator::CCssCalculator()
@ -24,6 +23,16 @@ namespace NSCSS
return m_pInternal->GetCompiledStyle(oStyle, arSelectors, bIsSettings, unitMeasure);
}
std::wstring CCssCalculator::CalculateStyleId(const CNode& oNode)
{
return m_pInternal->CalculateStyleId(oNode);
}
bool CCssCalculator::CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors)
{
return m_pInternal->CalculatePageStyle(oPageData, arSelectors);
}
void CCssCalculator::AddStyles(const std::string &sStyle)
{
m_pInternal->AddStyles(sStyle);
@ -54,26 +63,6 @@ namespace NSCSS
m_pInternal->SetBodyTree(oTree);
}
void CCssCalculator::SetSizeSourceWindow(const CSizeWindow &oSizeWindow)
{
m_pInternal->SetSizeSourceWindow(oSizeWindow);
}
void CCssCalculator::SetSizeDeviceWindow(const CSizeWindow &oSizeWindow)
{
m_pInternal->SetSizeDeviceWindow(oSizeWindow);
}
CSizeWindow CCssCalculator::GetSizeSourceWindow() const
{
return m_pInternal->GetSizeSourceWindow();
}
CSizeWindow CCssCalculator::GetSizeDeviceWindow() const
{
return m_pInternal->GetSizeDeviceWindow();
}
UnitMeasure CCssCalculator::GetUnitMeasure() const
{
return m_pInternal->GetUnitMeasure();

View File

@ -22,6 +22,9 @@ namespace NSCSS
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point) const;
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point) const;
std::wstring CalculateStyleId(const CNode& oNode);
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
// void AddStyle(const std::vector<std::string>& sSelectors, const std::string& sStyle);
void AddStyles (const std::string& sStyle);
void AddStyles (const std::wstring& wsStyle);
@ -31,12 +34,6 @@ namespace NSCSS
void SetDpi(const unsigned short int& nValue);
void SetBodyTree(const CTree &oTree);
void SetSizeSourceWindow(const CSizeWindow& oSizeWindow);
void SetSizeDeviceWindow(const CSizeWindow& oSizeWindow);
CSizeWindow GetSizeSourceWindow() const;
CSizeWindow GetSizeDeviceWindow() const;
UnitMeasure GetUnitMeasure() const;
std::wstring GetEncoding() const;
unsigned short int GetDpi() const;

View File

@ -16,8 +16,9 @@
#define MaxNumberRepetitions 6
inline static std::wstring StringifyValueList(const KatanaArray* oValues);
inline static std::wstring StringifyValue(const KatanaValue* oValue);
inline static std::wstring StringifyValueList(const KatanaArray* oValues);
inline static std::wstring StringifyValue(const KatanaValue* oValue);
inline static bool IsTableElement(const std::wstring& wsNameTag);
bool operator<(const std::vector<NSCSS::CNode> &arLeftSelectors, const std::vector<NSCSS::CNode> &arRightSelectors)
{
@ -52,13 +53,6 @@ namespace NSCSS
m_mData.clear();
#ifdef CSS_CALCULATOR_WITH_XHTML
for (std::map<std::vector<CNode>, CCompiledStyle*>::iterator iter = m_mUsedStyles.begin(); iter != m_mUsedStyles.end(); ++iter)
delete iter->second;
m_mUsedStyles.clear();
#endif
if (NULL != m_mStatictics)
delete m_mStatictics;
}
@ -86,6 +80,182 @@ namespace NSCSS
}
#ifdef CSS_CALCULATOR_WITH_XHTML
std::map<std::wstring, std::wstring> CCssCalculator_Private::GetPageData(const std::wstring &wsPageName)
{
if (m_arPageDatas.empty())
return {};
for (const TPageData& oPageData : m_arPageDatas)
{
if (std::find(oPageData.m_wsNames.begin(), oPageData.m_wsNames.end(), wsPageName) != oPageData.m_wsNames.end())
return oPageData.m_mData;
}
return {};
}
void CCssCalculator_Private::SetPageData(NSProperties::CPage &oPage, const std::map<std::wstring, std::wstring> &mData, unsigned int unLevel, bool bHardMode)
{
for (const std::pair<std::wstring, std::wstring> &oData : mData)
{
if (L"margin" == oData.first)
oPage.SetMargin(oData.second, unLevel, bHardMode);
else if (L"size" == oData.first)
oPage.SetSize(oData.second, unLevel, bHardMode);
else if (L"mso-header-margin" == oData.first)
oPage.SetHeader(oData.second, unLevel, bHardMode);
else if (L"mso-footer-margin" == oData.first)
oPage.SetFooter(oData.second, unLevel, bHardMode);
}
}
std::vector<std::wstring> CCssCalculator_Private::CalculateAllNodes(const std::vector<CNode> &arSelectors)
{
std::vector<std::wstring> arNodes;
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
{
if (!oNode->m_wsName.empty())
arNodes.push_back(oNode->m_wsName);
if (!oNode->m_wsClass.empty())
{
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
{
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
arNodes.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
[](std::wstring sRes, const std::wstring& sClass)
{return sRes += L'.' + sClass + L' ';}));
}
else
arNodes.push_back(L'.' + oNode->m_wsClass);
}
if (!oNode->m_wsId.empty())
arNodes.push_back(L'#' + oNode->m_wsId);
}
return arNodes;
}
void CCssCalculator_Private::FindPrevAndKindElements(const CElement *pElement, const std::vector<std::wstring> &arNextNodes, std::vector<CElement*>& arFindedElements, const std::wstring &wsName, const std::vector<std::wstring> &arClasses)
{
if (arNextNodes.empty())
return;
const std::vector<CElement*> arTempPrev = pElement->GetPrevElements(arNextNodes.crbegin() + 1, arNextNodes.crend());
const std::vector<CElement*> arTempKins = pElement->GetNextOfKin(wsName, arClasses);
if (!arTempPrev.empty())
arFindedElements.insert(arFindedElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindedElements.insert(arFindedElements.end(), arTempKins.begin(), arTempKins.end());
}
std::vector<CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes, bool bIsSettings)
{
if (arNodes.empty())
return {};
std::vector<CElement*> arFindedElements;
std::wstring wsName, wsId;
std::vector<std::wstring> arClasses;
if (!arNodes.empty() && arNodes.back()[0] == L'#')
{
wsId = arNodes.back();
arNodes.pop_back();
arNextNodes.push_back(wsId);
}
if (!arNodes.empty() && arNodes.back()[0] == L'.')
{
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
arNextNodes.push_back(arNodes.back());
arNodes.pop_back();
}
if (!arNodes.empty())
{
wsName = arNodes.back();
arNodes.pop_back();
arNextNodes.push_back(wsName);
}
const std::map<std::wstring, CElement*>::const_iterator oFindName = m_mData.find(wsName);
std::map<std::wstring, CElement*>::const_iterator oFindId;
if (!wsId.empty())
{
oFindId = m_mData.find(wsId);
if (oFindId != m_mData.end() && NULL != m_mStatictics)
{
std::map<StatistickElement, unsigned int>::const_iterator oFindCountId = m_mStatictics->find(StatistickElement{StatistickElement::IsId, wsId});
if ((m_mStatictics->end() != oFindCountId) &&
(((bIsSettings && oFindCountId->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountId->second >= MaxNumberRepetitions))))
{
if (!oFindId->second->Empty())
arFindedElements.push_back(oFindId->second);
}
FindPrevAndKindElements(oFindId->second, arNextNodes, arFindedElements, wsName);
}
}
if (!arClasses.empty())
{
if (!bIsSettings)
{
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
{
const std::map<std::wstring, CElement*>::const_iterator oFindClass = m_mData.find(*iClass);
if (oFindClass != m_mData.end())
{
if (!oFindClass->second->Empty())
arFindedElements.push_back(oFindClass->second);
FindPrevAndKindElements(oFindClass->second, arNextNodes, arFindedElements, wsName);
}
}
}
}
if (oFindName != m_mData.end())
{
if (!bIsSettings)
{
if (!oFindName->second->Empty())
arFindedElements.push_back(oFindName->second);
FindPrevAndKindElements(oFindName->second, arNextNodes, arFindedElements, wsName, arClasses);
}
}
if (arFindedElements.size() > 1)
{
std::sort(arFindedElements.rbegin(), arFindedElements.rend(),
[](CElement* oFirstElement, CElement* oSecondElement)
{
return oFirstElement->GetWeight() > oSecondElement->GetWeight();
});
}
return arFindedElements;
}
#endif
void CCssCalculator_Private::AddPageData(const std::wstring &wsPageNames, const std::wstring &wsStyles)
{
m_arPageDatas.push_back({NS_STATIC_FUNCTIONS::GetWordsW(wsPageNames), NS_STATIC_FUNCTIONS::GetRules(wsStyles)});
}
inline void CCssCalculator_Private::GetStylesheet(const KatanaStylesheet *oStylesheet)
{
for (size_t i = 0; i < oStylesheet->imports.length; ++i)
@ -308,231 +478,11 @@ namespace NSCSS
if (arSelectors.empty())
return CCompiledStyle();
SetUnitMeasure(unitMeasure);
CCompiledStyle oStyle;
if (!bIsSettings)
{
const std::map<std::vector<CNode>, CCompiledStyle*>::iterator oItem = m_mUsedStyles.find(arSelectors);
GetCompiledStyle(oStyle, arSelectors, bIsSettings, unitMeasure);
if (oItem != m_mUsedStyles.end())
return *oItem->second;
}
else if (NULL == m_mStatictics || m_mStatictics->empty())
{
CCompiledStyle oStyle;
oStyle.SetDpi(m_nDpi);
oStyle.SetUnitMeasure(m_UnitMeasure);
oStyle.SetID(arSelectors.back().m_wsName + ((!arSelectors.back().m_wsClass.empty()) ? L'.' + arSelectors.back().m_wsClass : L"") + ((arSelectors.back().m_wsId.empty()) ? L"" : L'#' + arSelectors.back().m_wsId) + L'-' + std::to_wstring(++m_nCountNodes));
oStyle.SetSizeDeviceWindow(m_oDeviceWindow);
oStyle.SetSizeSourceWindow(m_oSourceWindow);
return oStyle;
}
CCompiledStyle *pStyle = new CCompiledStyle();
pStyle->SetDpi(m_nDpi);
pStyle->SetUnitMeasure(m_UnitMeasure);
pStyle->SetSizeDeviceWindow(m_oDeviceWindow);
pStyle->SetSizeSourceWindow(m_oSourceWindow);
std::vector<std::wstring> arWords;
arWords.reserve(arSelectors.size() * 2);
std::vector<std::wstring> arNextNodes;
arNextNodes.reserve(arSelectors.size() * 2);
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
{
arWords.push_back(oNode->m_wsName);
//TODO:: проверить данный момент
// if (oNode->m_sName == L"td")
// pStyle->m_oMargin.SetPermission(false);
if (oNode->m_wsName == L"table")
pStyle->m_oBorder.Block();
if (!oNode->m_wsClass.empty())
{
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
{
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
if (arClasses.size() > 1)
arClasses.resize(unique(arClasses.begin(),arClasses.end()) - arClasses.begin());
switch (arClasses.size())
{
case 1:
{
arWords.push_back(L'.' + arClasses[0]);
break;
}
case 2:
{
arWords.push_back(L'.' + arClasses[0] + L" ." + arClasses[1]);
break;
}
case 3:
{
arWords.push_back(L'.' + arClasses[0] + L" ." + arClasses[1] + L" ." + arClasses[2]);
break;
}
default:
{
arWords.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
[](std::wstring sRes, const std::wstring& sClass)
{return sRes += L'.' + sClass + L' ';}));
break;
}
}
}
else
arWords.push_back(L'.' + oNode->m_wsClass);
}
if (!oNode->m_wsId.empty())
arWords.push_back(L'#' + oNode->m_wsId);
}
std::vector<CElement*> arElements;
for (size_t i = 0; i < arSelectors.size(); ++i)
{
std::wstring sName, sId;
std::vector<std::wstring> arClasses;
if (arWords.back()[0] == L'#')
{
sId = arWords.back();
arWords.pop_back();
arNextNodes.push_back(sId);
}
if (arWords.back()[0] == L'.')
{
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arWords.back(), false, L" ");
arNextNodes.push_back(arWords.back());
arWords.pop_back();
}
sName = arWords.back();
arWords.pop_back();
arNextNodes.push_back(sName);
pStyle->AddParent(sName);
const std::map<std::wstring, CElement*>::const_iterator oFindName = m_mData.find(sName);
std::map<std::wstring, CElement*>::const_iterator oFindId;
std::vector<CElement*> arFindElements;
if (!sId.empty())
{
oFindId = m_mData.find(sId);
if (oFindId != m_mData.end() && NULL != m_mStatictics)
{
std::map<StatistickElement, unsigned int>::const_iterator oFindCountId = m_mStatictics->find(StatistickElement{StatistickElement::IsId, sId});
if ((m_mStatictics->end() != oFindCountId) &&
(((bIsSettings && oFindCountId->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountId->second >= MaxNumberRepetitions))))
{
if (!oFindId->second->Empty())
arFindElements.push_back(oFindId->second);
}
const std::vector<CElement*> arTempPrev = oFindId->second->GetPrevElements(arNextNodes.rbegin() + ((arClasses.empty()) ? 1 : 2), arNextNodes.rend());
if (!arTempPrev.empty())
arFindElements.insert(arFindElements.end(), arTempPrev.begin(), arTempPrev.end());
}
}
if (!arClasses.empty())
{
if (!bIsSettings)
{
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
{
const std::map<std::wstring, CElement*>::const_iterator oFindClass = m_mData.find(*iClass);
if (oFindClass != m_mData.end())
{
if (!oFindClass->second->Empty())
arFindElements.push_back(oFindClass->second);
const std::vector<CElement*> arTempPrev = oFindClass->second->GetPrevElements(arNextNodes.rbegin() + 2, arNextNodes.rend());
const std::vector<CElement*> arTempKins = oFindClass->second->GetNextOfKin(sName);
if (!arTempPrev.empty())
arFindElements.insert(arFindElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindElements.insert(arFindElements.end(), arTempKins.begin(), arTempKins.end());
}
}
}
}
if (oFindName != m_mData.end())
{
if (!bIsSettings)
{
if (!oFindName->second->Empty())
arFindElements.push_back(oFindName->second);
const std::vector<CElement*> arTempPrev = oFindName->second->GetPrevElements(arNextNodes.rbegin() + 1, arNextNodes.rend());
const std::vector<CElement*> arTempKins = oFindName->second->GetNextOfKin(sName, arClasses);
if (!arTempPrev.empty())
arFindElements.insert(arFindElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindElements.insert(arFindElements.end(), arTempKins.begin(), arTempKins.end());
}
}
if (arFindElements.size() > 1)
{
std::sort(arFindElements.rbegin(), arFindElements.rend(),
[](CElement* oFirstElement, CElement* oSecondElement)
{
return oFirstElement->GetWeight() > oSecondElement->GetWeight();
});
}
pStyle->AddStyle(arSelectors[i].m_mAttributes, i + 1);
for (const CElement* oElement : arFindElements)
pStyle->AddStyle(oElement->GetStyle(), i + 1);
if (NULL != m_mStatictics)
{
std::map<StatistickElement, unsigned int>::const_iterator oFindCountStyle = m_mStatictics->find(StatistickElement{StatistickElement::IsStyle, arSelectors[i].m_wsStyle});
if (oFindCountStyle != m_mStatictics->end())
{
if ((bIsSettings && oFindCountStyle->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountStyle->second >= MaxNumberRepetitions))
pStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
else if (!bIsSettings)
pStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
}
else if (bIsSettings)
pStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
}
else
pStyle->AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
}
if (!bIsSettings)
{
pStyle->SetID(arSelectors.back().m_wsName + ((!arSelectors.back().m_wsClass.empty()) ? L'.' + arSelectors.back().m_wsClass : L"") + ((arSelectors.back().m_wsId.empty()) ? L"" : L'#' + arSelectors.back().m_wsId) + L'-' + std::to_wstring(++m_nCountNodes));
m_mUsedStyles[arSelectors] = pStyle;
}
return *pStyle;
return oStyle;
}
bool CCssCalculator_Private::GetCompiledStyle(CCompiledStyle &oStyle, const std::vector<CNode> &arSelectors, const bool &bIsSettings, const UnitMeasure &unitMeasure)
@ -544,11 +494,11 @@ namespace NSCSS
if (!bIsSettings)
{
const std::map<std::vector<CNode>, CCompiledStyle*>::iterator oItem = m_mUsedStyles.find(arSelectors);
const std::map<std::vector<CNode>, CCompiledStyle>::iterator oItem = m_mUsedStyles.find(arSelectors);
if (oItem != m_mUsedStyles.end())
{
oStyle = *oItem->second;
oStyle = oItem->second;
return true;
}
}
@ -558,180 +508,35 @@ namespace NSCSS
oStyle.SetUnitMeasure(m_UnitMeasure);
oStyle.SetID(arSelectors.back().m_wsName + ((!arSelectors.back().m_wsClass.empty()) ? L'.' + arSelectors.back().m_wsClass : L"") + ((arSelectors.back().m_wsId.empty()) ? L"" : L'#' + arSelectors.back().m_wsId) + L'-' + std::to_wstring(++m_nCountNodes));
oStyle.SetSizeDeviceWindow(m_oDeviceWindow);
oStyle.SetSizeSourceWindow(m_oSourceWindow);
return false;
}
oStyle.SetDpi(m_nDpi);
oStyle.SetUnitMeasure(m_UnitMeasure);
oStyle.SetSizeDeviceWindow(m_oDeviceWindow);
oStyle.SetSizeSourceWindow(m_oSourceWindow);
std::vector<std::wstring> arWords;
arWords.reserve(arSelectors.size() * 2);
std::vector<std::wstring> arNextNodes;
arNextNodes.reserve(arSelectors.size() * 2);
for (std::vector<CNode>::const_reverse_iterator oNode = arSelectors.rbegin(); oNode != arSelectors.rend(); ++oNode)
{
arWords.push_back(oNode->m_wsName);
// if (oNode->m_sName == L"td")
// oStyle.m_pMargin.SetPermission(false);
if (oNode->m_wsName == L"table")
oStyle.m_oBorder.Block();
if (!oNode->m_wsClass.empty())
{
if (oNode->m_wsClass.find(L' ') != std::wstring::npos)
{
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(oNode->m_wsClass, false, L" ");
if (arClasses.size() > 1)
arClasses.resize(unique(arClasses.begin(),arClasses.end()) - arClasses.begin());
switch (arClasses.size())
{
case 1:
{
arWords.push_back(L'.' + arClasses[0]);
break;
}
case 2:
{
arWords.push_back(L'.' + arClasses[0] + L" ." + arClasses[1]);
break;
}
case 3:
{
arWords.push_back(L'.' + arClasses[0] + L" ." + arClasses[1] + L" ." + arClasses[2]);
break;
}
default:
{
arWords.push_back(std::accumulate(arClasses.begin(), arClasses.end(), std::wstring(),
[](std::wstring sRes, const std::wstring& sClass)
{return sRes += L'.' + sClass + L' ';}));
break;
}
}
}
else
arWords.push_back(L'.' + oNode->m_wsClass);
}
if (!oNode->m_wsId.empty())
arWords.push_back(L'#' + oNode->m_wsId);
}
std::vector<CElement*> arElements;
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
std::vector<std::wstring> arPrevNodes;
bool bInTable = false;
for (size_t i = 0; i < arSelectors.size(); ++i)
{
std::wstring sName, sId;
std::vector<std::wstring> arClasses;
oStyle.AddParent(arSelectors[i].m_wsName);
if (arWords.back()[0] == L'#')
if (!bInTable)
bInTable = IsTableElement(arSelectors[i].m_wsName);
if (bInTable)
{
sId = arWords.back();
arWords.pop_back();
arNextNodes.push_back(sId);
oStyle.m_oBackground.Clear();
oStyle.m_oBorder.Clear();
}
if (arWords.back()[0] == L'.')
{
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arWords.back(), false, L" ");
arNextNodes.push_back(arWords.back());
arWords.pop_back();
}
CCompiledStyle oTempStyle;
sName = arWords.back();
arWords.pop_back();
arNextNodes.push_back(sName);
oStyle.AddParent(sName);
oTempStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
const std::map<std::wstring, CElement*>::const_iterator oFindName = m_mData.find(sName);
std::map<std::wstring, CElement*>::const_iterator oFindId;
std::vector<CElement*> arFindElements;
if (!sId.empty())
{
oFindId = m_mData.find(sId);
if (oFindId != m_mData.end() && NULL != m_mStatictics)
{
std::map<StatistickElement, unsigned int>::const_iterator oFindCountId = m_mStatictics->find(StatistickElement{StatistickElement::IsId, sId});
if ((m_mStatictics->end() != oFindCountId) &&
(((bIsSettings && oFindCountId->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountId->second >= MaxNumberRepetitions))))
{
if (!oFindId->second->Empty())
arFindElements.push_back(oFindId->second);
}
const std::vector<CElement*> arTempPrev = oFindId->second->GetPrevElements(arNextNodes.rbegin() + ((arClasses.empty()) ? 1 : 2), arNextNodes.rend());
if (!arTempPrev.empty())
arFindElements.insert(arFindElements.end(), arTempPrev.begin(), arTempPrev.end());
}
}
if (!arClasses.empty())
{
if (!bIsSettings)
{
for (std::vector<std::wstring>::const_reverse_iterator iClass = arClasses.rbegin(); iClass != arClasses.rend(); ++iClass)
{
const std::map<std::wstring, CElement*>::const_iterator oFindClass = m_mData.find(*iClass);
if (oFindClass != m_mData.end())
{
if (!oFindClass->second->Empty())
arFindElements.push_back(oFindClass->second);
const std::vector<CElement*> arTempPrev = oFindClass->second->GetPrevElements(arNextNodes.rbegin() + 2, arNextNodes.rend());
const std::vector<CElement*> arTempKins = oFindClass->second->GetNextOfKin(sName);
if (!arTempPrev.empty())
arFindElements.insert(arFindElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindElements.insert(arFindElements.end(), arTempKins.begin(), arTempKins.end());
}
}
}
}
if (oFindName != m_mData.end())
{
if (!bIsSettings)
{
if (!oFindName->second->Empty())
arFindElements.push_back(oFindName->second);
const std::vector<CElement*> arTempPrev = oFindName->second->GetPrevElements(arNextNodes.rbegin() + 1, arNextNodes.rend());
const std::vector<CElement*> arTempKins = oFindName->second->GetNextOfKin(sName, arClasses);
if (!arTempPrev.empty())
arFindElements.insert(arFindElements.end(), arTempPrev.begin(), arTempPrev.end());
if (!arTempKins.empty())
arFindElements.insert(arFindElements.end(), arTempKins.begin(), arTempKins.end());
}
}
if (arFindElements.size() > 1)
{
std::sort(arFindElements.rbegin(), arFindElements.rend(),
[](CElement* oFirstElement, CElement* oSecondElement)
{
return oFirstElement->GetWeight() > oSecondElement->GetWeight();
});
}
for (const CElement* oElement : FindElements(arNodes, arPrevNodes, bIsSettings))
oTempStyle.AddStyle(oElement->GetStyle(), i + 1);
if (NULL != m_mStatictics)
{
@ -741,31 +546,68 @@ namespace NSCSS
{
if ((bIsSettings && oFindCountStyle->second < MaxNumberRepetitions) ||
(!bIsSettings && oFindCountStyle->second >= MaxNumberRepetitions))
oStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
else if (!bIsSettings)
oStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
}
else if (bIsSettings)
oStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
else /*if (bIsSettings)*/
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
}
else
oStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
oTempStyle.AddStyle(arSelectors[i].m_wsStyle, i + 1, true);
for (const CElement* oElement : arFindElements)
oStyle.AddStyle(oElement->GetStyle(), i + 1);
oStyle += oTempStyle;
oStyle.AddStyle(arSelectors[i].m_mAttributes, i + 1);
// Скидываем некоторые внешние стили, которые внутри таблицы переопределяются
if (bInTable && i < arSelectors.size() - 1)
{
oStyle.m_oFont.GetLineHeight().Clear();
oStyle.m_oPadding.Clear();
oStyle.m_oMargin.Clear();
}
}
if (!bIsSettings)
oStyle.SetID(CalculateStyleId(arSelectors.back()));
if (!bIsSettings && !oStyle.Empty())
m_mUsedStyles[arSelectors] = oStyle;
return true;
}
std::wstring CCssCalculator_Private::CalculateStyleId(const CNode& oNode)
{
return oNode.m_wsName + ((!oNode.m_wsClass.empty()) ? L'.' + oNode.m_wsClass : L"") + ((oNode.m_wsId.empty()) ? L"" : L'#' + oNode.m_wsId) + L'-' + std::to_wstring(++m_nCountNodes);
}
bool CCssCalculator_Private::CalculatePageStyle(NSProperties::CPage &oPageData, const std::vector<CNode> &arSelectors)
{
if (arSelectors.empty())
return false;
std::vector<std::wstring> arNodes = CalculateAllNodes(arSelectors);
std::vector<std::wstring> arNextNodes;
for (size_t i = 0; i < arSelectors.size(); ++i)
{
oStyle.SetID(arSelectors.back().m_wsName + ((!arSelectors.back().m_wsClass.empty()) ? L'.' + arSelectors.back().m_wsClass : L"") + ((arSelectors.back().m_wsId.empty()) ? L"" : L'#' + arSelectors.back().m_wsId) + L'-' + std::to_wstring(++m_nCountNodes));
if (!arSelectors[i].m_wsStyle.empty() && std::wstring::npos != arSelectors[i].m_wsStyle.find(L"page"))
{
std::map<std::wstring, std::wstring> mRules = NS_STATIC_FUNCTIONS::GetRules(arSelectors[i].m_wsStyle);
if (mRules.end() != mRules.find(L"page"))
SetPageData(oPageData, GetPageData(mRules[L"page"]), i + 1, true);
}
CCompiledStyle *pTemp = new CCompiledStyle(oStyle);
for (const CElement* oElement : FindElements(arNodes, arNextNodes, false))
{
std::map<std::wstring, std::wstring> mRules = oElement->GetStyle();
if (mRules.end() != mRules.find(L"page"))
SetPageData(oPageData, GetPageData(mRules[L"page"]), i + 1, true);
}
m_mUsedStyles[arSelectors] = pTemp;
if (arSelectors[i].m_mAttributes.end() != arSelectors[i].m_mAttributes.find(L"page"))
SetPageData(oPageData, GetPageData(arSelectors[i].m_mAttributes.at(L"page")), i + 1, false);
}
return true;
}
#endif
@ -784,6 +626,16 @@ namespace NSCSS
if (wsStyle.empty())
return;
std::wregex oRegex(L"@page\\s*([^{]*)(\\{[^}]*\\})");
std::wsmatch oMatch;
std::wstring::const_iterator oSearchStart(wsStyle.cbegin());
while (std::regex_search(oSearchStart, wsStyle.cend(), oMatch, oRegex))
{
AddPageData(oMatch[1].str(), oMatch[2].str());
oSearchStart = oMatch.suffix().first;
}
AddStyles(U_TO_UTF8(wsStyle));
}
@ -810,26 +662,6 @@ namespace NSCSS
CTree::CountingNumberRepetitions(oTree, *m_mStatictics);
}
void CCssCalculator_Private::SetSizeSourceWindow(const CSizeWindow &oSizeWindow)
{
m_oSourceWindow = oSizeWindow;
}
void CCssCalculator_Private::SetSizeDeviceWindow(const CSizeWindow &oSizeWindow)
{
m_oDeviceWindow = oSizeWindow;
}
CSizeWindow CCssCalculator_Private::GetSizeSourceWindow() const
{
return m_oSourceWindow;
}
CSizeWindow CCssCalculator_Private::GetSizeDeviceWindow() const
{
return m_oDeviceWindow;
}
void CCssCalculator_Private::SetUnitMeasure(const UnitMeasure& nType)
{
m_UnitMeasure = nType;
@ -863,9 +695,6 @@ namespace NSCSS
m_mData.clear();
m_arFiles.clear();
m_oDeviceWindow.Clear();
m_oSourceWindow.Clear();
}
}
inline static std::wstring StringifyValueList(const KatanaArray* oValues)
@ -968,4 +797,11 @@ inline static std::wstring StringifyValue(const KatanaValue* oValue)
return str;
}
inline static bool IsTableElement(const std::wstring& wsNameTag)
{
return L"td" == wsNameTag || L"tr" == wsNameTag || L"table" == wsNameTag ||
L"tbody" == wsNameTag || L"thead" == wsNameTag || L"tfoot" == wsNameTag ||
L"th" == wsNameTag;
}

View File

@ -26,16 +26,31 @@ namespace NSCSS
std::map<std::wstring, CElement*> m_mData;
typedef struct
{
std::vector<std::wstring> m_wsNames;
std::map<std::wstring, std::wstring> m_mData;
} TPageData;
std::vector<TPageData> m_arPageDatas;
std::map<StatistickElement, unsigned int> *m_mStatictics; // Количество повторений свойств id и style у селекторов
#ifdef CSS_CALCULATOR_WITH_XHTML
std::map<std::vector<CNode>, CCompiledStyle*> m_mUsedStyles;
std::map<std::vector<CNode>, CCompiledStyle> m_mUsedStyles;
std::map<std::wstring, std::wstring> GetPageData(const std::wstring& wsPageName);
void SetPageData(NSProperties::CPage& oPage, const std::map<std::wstring, std::wstring>& mData, unsigned int unLevel, bool bHardMode = false);
std::vector<std::wstring> CalculateAllNodes(const std::vector<CNode>& arSelectors);
void FindPrevAndKindElements(const CElement* pElement, const std::vector<std::wstring>& arNextNodes, std::vector<CElement*>& arFindedElements, const std::wstring& wsName, const std::vector<std::wstring>& arClasses = {});
std::vector<CElement*> FindElements(std::vector<std::wstring>& arNodes, std::vector<std::wstring>& arNextNodes, bool bIsSettings);
#endif
std::wstring m_sEncoding;
CSizeWindow m_oSourceWindow;
CSizeWindow m_oDeviceWindow;
void AddPageData(const std::wstring& wsPageName, const std::wstring& wsStyles);
void GetStylesheet(const KatanaStylesheet* oStylesheet);
void GetRule(const KatanaRule* oRule);
@ -59,6 +74,9 @@ namespace NSCSS
#ifdef CSS_CALCULATOR_WITH_XHTML
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point);
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point);
std::wstring CalculateStyleId(const CNode& oNode);
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
#endif
void AddStyles(const std::string& sStyle);
@ -69,12 +87,6 @@ namespace NSCSS
void SetDpi(unsigned short int nValue);
void SetBodyTree(const CTree &oTree);
void SetSizeSourceWindow(const CSizeWindow& oSizeWindow);
void SetSizeDeviceWindow(const CSizeWindow& oSizeWindow);
CSizeWindow GetSizeSourceWindow() const;
CSizeWindow GetSizeDeviceWindow() const;
UnitMeasure GetUnitMeasure() const;
std::wstring GetEncoding() const;
unsigned short int GetDpi() const;

View File

@ -173,26 +173,26 @@ namespace NSCSS
return arElements;
}
std::vector<CElement *> CElement::GetPrevElements(const std::vector<std::wstring>::reverse_iterator &arNodesRBegin, const std::vector<std::wstring>::reverse_iterator &arNodesREnd) const
std::vector<CElement *> CElement::GetPrevElements(const std::vector<std::wstring>::const_reverse_iterator& oNodesRBegin, const std::vector<std::wstring>::const_reverse_iterator& oNodesREnd) const
{
if (arNodesRBegin >= arNodesREnd || m_arPrevElements.empty())
if (oNodesRBegin >= oNodesREnd || m_arPrevElements.empty())
return std::vector<CElement*>();
std::vector<CElement*> arElements;
for (std::vector<std::wstring>::reverse_iterator iWord = arNodesRBegin; iWord != arNodesREnd; ++iWord)
for (std::vector<std::wstring>::const_reverse_iterator iWord = oNodesRBegin; iWord != oNodesREnd; ++iWord)
{
if ((*iWord)[0] == L'.' && ((*iWord).find(L" ") != std::wstring::npos))
{
std::vector<std::wstring> arClasses = NS_STATIC_FUNCTIONS::GetWordsW(*iWord, false, L" ");
for (std::wstring sClass : arClasses)
for (const std::wstring& wsClass : arClasses)
{
for (CElement* oPrevElement : m_arPrevElements)
{
if (oPrevElement->m_sSelector == sClass)
if (oPrevElement->m_sSelector == wsClass)
{
arElements.push_back(oPrevElement);
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, arNodesREnd);
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesREnd);
arElements.insert(arElements.end(), arTempElements.begin(), arTempElements.end());
}
}
@ -205,7 +205,7 @@ namespace NSCSS
if (oPrevElement->m_sSelector == *iWord)
{
arElements.push_back(oPrevElement);
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, arNodesREnd);
std::vector<CElement*> arTempElements = oPrevElement->GetPrevElements(iWord + 1, oNodesREnd);
arElements.insert(arElements.end(), arTempElements.begin(), arTempElements.end());
// return arElements;
}

View File

@ -39,7 +39,7 @@ namespace NSCSS
std::map<std::wstring, std::wstring> GetFullStyle(const std::vector<CNode>& arSelectors) const;
std::map<std::wstring, std::wstring> GetFullStyle(const std::vector<std::wstring>& arNodes) const;
std::vector<CElement *> GetNextOfKin(const std::wstring& sName, const std::vector<std::wstring>& arClasses = {}) const;
std::vector<CElement *> GetPrevElements(const std::vector<std::wstring>::reverse_iterator &arNodesRBegin, const std::vector<std::wstring>::reverse_iterator &arNodesREnd) const;
std::vector<CElement *> GetPrevElements(const std::vector<std::wstring>::const_reverse_iterator& oNodesRBegin, const std::vector<std::wstring>::const_reverse_iterator& oNodesREnd) const;
std::map<std::wstring, std::wstring> GetConvertStyle(const std::vector<CNode>& arNodes) const;
CElement *FindPrevElement(const std::wstring& sSelector) const;

View File

@ -5,7 +5,7 @@ namespace NSCSS
CNode::CNode()
{}
CNode::CNode(std::wstring wsName, std::wstring wsClass, std::wstring wsId)
CNode::CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId)
: m_wsName(wsName), m_wsClass(wsClass), m_wsId(wsId)
{}

View File

@ -18,7 +18,7 @@ namespace NSCSS
public:
CNode();
CNode(std::wstring wsName, std::wstring wsClass, std::wstring wsId);
CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId);
bool Empty() const;

View File

@ -14,23 +14,21 @@ namespace NSCSS
{
switch (enUnitMeasure)
{
case NSCSS::Pixel:
return dValue;
case NSCSS::Point:
return 72. / (double)ushDPI * dValue;
return dValue * 72. / (double)ushDPI;
case NSCSS::Cantimeter:
return dValue / (double)ushDPI * 2.54;
case NSCSS::Millimeter:
return dValue / (double)ushDPI * 25.4;
case NSCSS::Inch:
return 1. / (double)ushDPI * dValue;
return dValue / (double)ushDPI;
case NSCSS::Peak:
return 0.16667 / (double)ushDPI * dValue;
return dValue * 6. / (double)ushDPI; // 1 дюйм = 6 пик
case NSCSS::Twips:
return (dValue / (double)ushDPI) * 144.;
return dValue * 1440. / (double)ushDPI;
default:
return dValue;
}
return 0.;
}
double CUnitMeasureConverter::ConvertCm(double dValue, UnitMeasure enUnitMeasure, unsigned short ushDPI)
@ -38,22 +36,20 @@ namespace NSCSS
switch (enUnitMeasure)
{
case NSCSS::Point:
return 28.35 * dValue;
return dValue * 28.3465 ; // 1 см = (2.54 / 72) пункта
case NSCSS::Pixel:
return (double)ushDPI / 2.54 * dValue;
case NSCSS::Cantimeter:
return dValue;
return dValue * (double)ushDPI / 2.54;
case NSCSS::Millimeter:
return dValue * 10.;
case NSCSS::Inch:
return dValue / 2.54f;
return dValue / 2.54; // 1 дюйм = 2.54 см
case NSCSS::Peak:
return 2.36 * dValue;
return dValue * 2.36; // 2.36 = 6 / 2.54
case NSCSS::Twips:
return (dValue) * 0.3937 * (double)ushDPI;
return dValue * 567.; // 1 см = (1440 / 2.54) твипов
default:
return dValue;
}
return 0.;
}
double CUnitMeasureConverter::ConvertMm(double dValue, NSCSS::UnitMeasure enUnitMeasure, unsigned short ushDPI)
@ -61,22 +57,20 @@ namespace NSCSS
switch (enUnitMeasure)
{
case NSCSS::Point:
return 2.835 * dValue;
return dValue * 2.8346; // 1 мм = (25.4 / 72) пункта
case NSCSS::Pixel:
return (double)ushDPI / 25.4 * dValue;
return dValue * (double)ushDPI / 25.4;
case NSCSS::Cantimeter:
return dValue / 10.;
case NSCSS::Millimeter:
return dValue;
case NSCSS::Inch:
return dValue / 25.4;
case NSCSS::Peak:
return 0.236 * dValue;
return dValue * 0.236; // 0.236 = 6 / 25.4
case NSCSS::Twips:
return (dValue / 10.) * 0.3937 * (double)ushDPI;
return dValue * 56.7;
default:
return dValue;
}
return 0.;
}
double CUnitMeasureConverter::ConvertIn(double dValue, NSCSS::UnitMeasure enUnitMeasure, unsigned short ushDPI)
@ -84,45 +78,41 @@ namespace NSCSS
switch (enUnitMeasure)
{
case NSCSS::Point:
return dValue / 6.;
return dValue / 72.;
case NSCSS::Pixel:
return dValue * (double)ushDPI;
case NSCSS::Cantimeter:
return dValue * 2.54;
return dValue * 2.54; // 1 дюйм = 2.54 см
case NSCSS::Millimeter:
return dValue * 25.4;
case NSCSS::Inch:
return dValue;
case NSCSS::Peak:
return dValue / 72.;
return dValue * 6.;
case NSCSS::Twips:
return dValue * 144.;
return dValue * 1440.;
default:
return dValue;
}
return 0.;
}
double CUnitMeasureConverter::ConvertPt(double dValue, NSCSS::UnitMeasure enUnitMeasure, unsigned short ushDPI)
{
switch (enUnitMeasure)
{
case NSCSS::Point:
return dValue;
case NSCSS::Pixel:
return (double)ushDPI / 72. * dValue;
return dValue * (double)ushDPI / 72.;
case NSCSS::Cantimeter:
return dValue * 0.03528;
return dValue * 0.03528; // 0.03528 = 2.54 / 72
case NSCSS::Millimeter:
return dValue * 0.3528;
case NSCSS::Inch:
return dValue / 72.;
return dValue / 72.; // 1 дюйм = 72 пункта
case NSCSS::Peak:
return dValue / 12.;
return dValue * 0.0833; // 0.0833 = 6 / 72 (1 пункт = 1/72 дюйма)
case NSCSS::Twips:
return (dValue / 72.) * 144.;
return dValue * 20.; // 20 = 1440 / 72
default:
return dValue;
}
return 0.;
}
double CUnitMeasureConverter::ConvertPc(double dValue, NSCSS::UnitMeasure enUnitMeasure, unsigned short ushDPI)
@ -130,27 +120,49 @@ namespace NSCSS
switch (enUnitMeasure)
{
case NSCSS::Point:
return dValue * 12.;
return dValue * 12.; // 12 = 72 / 6
case NSCSS::Pixel:
return (double)ushDPI / 6. * dValue;
return dValue * (double)ushDPI / 6.; // 1 дюйм = 6 пика
case NSCSS::Cantimeter:
return dValue * 0.423;
return dValue * 0.423; // 0.423 = 2.54 / 6
case NSCSS::Millimeter:
return dValue * 4.23;
return dValue * 4.233; // 4.23 = 25.4 / 6
case NSCSS::Inch:
return dValue / 6.;
case NSCSS::Peak:
return dValue;
case NSCSS::Twips:
return dValue * 24.;
return dValue * 3.333; // 3.333 = 20 / 6
default:
return dValue;
}
}
double CUnitMeasureConverter::ConvertTw(double dValue, UnitMeasure enUnitMeasure, unsigned short ushDPI)
{
switch (enUnitMeasure)
{
case NSCSS::Point:
return dValue * 0.05; // 0.05 = 72. / 1440.
case NSCSS::Pixel:
return dValue * (double)ushDPI / 1440.; // 1 дюйм = 1440 твипов
case NSCSS::Cantimeter:
return dValue * 0.001764; // 0.001764 = 2.54 / 1440
case NSCSS::Millimeter:
return dValue * 0.01764;
case NSCSS::Inch:
return dValue * 1440.;
case NSCSS::Peak:
return dValue * 0.004167; // 0.004167 = 6 / 1440
default:
return dValue;
}
return 0.;
}
bool CUnitMeasureConverter::GetValue(const std::wstring &wsValue, double &dValue, UnitMeasure &enUnitMeasure)
{
std::wregex oRegex(LR"((-?\.\d+|-?\d+(\.\d+)?)\s*(px|pt|cm|mm|in|pc|%|em|rem)?)");
if (wsValue.empty() || wsValue.end() == std::find_if(wsValue.begin(), wsValue.end(), [](wchar_t wChar) { return iswdigit(wChar);}))
return false;
std::wregex oRegex(LR"((-?\.\d+|-?\d+(\.\d+)?)\s*(px|pt|cm|mm|in|pc|%|em|rem|tw)?)");
std::wsmatch oMatches;
if(!std::regex_search(wsValue, oMatches, oRegex))
@ -176,6 +188,8 @@ namespace NSCSS
enUnitMeasure = Em;
else if (L"rem" == oMatches[3])
enUnitMeasure = Rem;
else if (L"tw" == oMatches[3])
enUnitMeasure = Twips;
else
enUnitMeasure = None;

View File

@ -30,6 +30,7 @@ namespace NSCSS
static double ConvertIn(double dValue, UnitMeasure enUnitMeasure, unsigned short ushDPI);
static double ConvertPt(double dValue, UnitMeasure enUnitMeasure, unsigned short ushDPI);
static double ConvertPc(double dValue, UnitMeasure enUnitMeasure, unsigned short ushDPI);
static double ConvertTw(double dValue, UnitMeasure enUnitMeasure, unsigned short ushDPI);
static bool GetValue(const std::wstring& wsValue, double& dValue, UnitMeasure& enUnitMeasure);
};

View File

@ -2,34 +2,6 @@
namespace NSCSS
{
CSizeWindow::CSizeWindow()
: m_ushWidth(0), m_ushHeight(0)
{}
CSizeWindow::CSizeWindow(unsigned short unWidth, unsigned short unHeight)
: m_ushWidth(unWidth), m_ushHeight(unHeight)
{}
bool CSizeWindow::Empty() const
{
return ((0 == m_ushWidth) && (0 == m_ushHeight));
}
void CSizeWindow::Clear()
{
m_ushWidth = m_ushHeight = 0;
}
bool CSizeWindow::operator==(const CSizeWindow &oSizeWindow) const
{
return ((m_ushWidth == oSizeWindow.m_ushWidth) && (m_ushHeight == oSizeWindow.m_ushHeight));
}
bool CSizeWindow::operator!=(const CSizeWindow &oSizeWindow) const
{
return ((m_ushWidth != oSizeWindow.m_ushWidth) || (m_ushHeight != oSizeWindow.m_ushHeight));
}
bool StatistickElement::operator<(const StatistickElement &oStatistickElement) const
{
return sValue < oStatistickElement.sValue;
@ -98,7 +70,7 @@ namespace NSCSS
{L"deepskyblue", L"00BFFF"}, {L"dodgerblue", L"1E90FF"}, {L"cornflowerblue",L"6495ED"},
{L"mediumdlateblue", L"7B68EE"}, {L"royalblue", L"4169E1"}, {L"blue", L"0000FF"}, {L"LightCoral", L"#F08080"}, {L"LightCoral", L"#F08080"}, {L"LightCoral", L"#F08080"},
{L"mediumblue", L"0000CD"}, {L"darkblue", L"00008B"}, {L"navy", L"000080"},
{L"midnightblue", L"191970"},
{L"midnightblue", L"191970"}, {L"navyblue", L"A0B0E0"},
/* White tones */
{L"white", L"FFFFFF"}, {L"snow", L"FFFAFA"}, {L"honeydew", L"F0FFF0"},
{L"mintcream", L"F5FFFA"}, {L"azure", L"F0FFFF"}, {L"aliceblue", L"F0F8FF"},

View File

@ -16,21 +16,6 @@ namespace NSCSS
ScalingDirectionY = 2
} ScalingDirection;
struct CSizeWindow
{
unsigned short m_ushWidth;
unsigned short m_ushHeight;
CSizeWindow();
CSizeWindow(unsigned short unWidth, unsigned short unHeight);
bool Empty() const;
void Clear();
bool operator==(const CSizeWindow& oSizeWindow) const;
bool operator!=(const CSizeWindow& oSizeWindow) const;
};
struct StatistickElement
{
enum TypeElement
@ -61,66 +46,69 @@ namespace NSCSS
{
typedef enum
{
B_CustomStyle = 0,
B_StyleId = 1,
B_Type = 2,
B_Default = 3,
B_CustomStyle,
B_StyleId,
B_Type,
B_Default,
B_Name = 4,
B_BasedOn = 5,
B_QFormat = 6,
B_Link = 7,
B_UnhideWhenUsed = 8,
B_UiPriority = 9,
B_Name,
B_BasedOn,
B_QFormat,
B_Link,
B_UnhideWhenUsed,
B_UiPriority,
B_SemiHidden
} BasicProperties;
typedef enum
{
P_Jc = 0,
P_Spacing = 1,
P_ContextualSpacing = 2,
P_Ind = 3,
P_OutlineLvl = 4,
P_Shd = 5,
P_Jc,
P_Spacing,
P_ContextualSpacing,
P_Ind,
P_OutlineLvl,
P_Shd,
// <pBdr>
P_TopBorder = 6,
P_LeftBorder = 7,
P_BottomBorder = 8,
P_RightBorder = 9,
P_TopBorder,
P_LeftBorder,
P_BottomBorder,
P_RightBorder,
// </pBdr>
P_KeepLines = 10,
P_KeepNext = 11,
P_KeepLines,
P_KeepNext,
} ParagraphProperties;
typedef enum
{
R_RFonts = 0,
R_Sz = 1,
R_B = 2,
R_I = 3,
R_Color = 4,
R_U = 5,
R_Highlight = 6,
R_SmallCaps = 7
R_RFonts ,
R_Sz,
R_B,
R_I,
R_Color,
R_U,
R_Highlight,
R_Shd,
R_SmallCaps,
R_Kern
} RunnerProperties;
typedef enum
{
T_TblInd = 0,
T_TblInd ,
// <tblCellMar>
T_CellTop = 1,
T_CellLeft = 2,
T_CellBottom = 3,
T_CellRight = 4,
T_CellTop,
T_CellLeft,
T_CellBottom,
T_CellRight,
// <tblCellMar>
// <tblBorders>
T_BorderTop = 5,
T_BorderLeft = 6,
T_BorderBottom = 7,
T_BorderRight = 8,
T_BorderInsideH = 9,
T_BorderInsideV = 10
T_BorderTop ,
T_BorderLeft,
T_BorderBottom,
T_BorderRight,
T_BorderInsideH,
T_BorderInsideV
// </tblBorders>
} TableProperties;
}

View File

@ -80,6 +80,52 @@ namespace NS_STATIC_FUNCTIONS
return arValues;
}
std::vector<std::wstring> ParseCSSPropertie(const std::wstring& wsInput)
{
std::vector<std::wstring> arResult;
std::wstring wsCurrent;
bool bInQuotes = false;
bool bInFunction = false;
int nParenDepth = 0;
for (wchar_t c : wsInput)
{
if (c == ' ' && !bInQuotes && !bInFunction)
{
if (!wsCurrent.empty())
{
arResult.push_back(wsCurrent);
wsCurrent.clear();
}
}
else if (c == '"' || c == '\'')
{
bInQuotes = !bInQuotes;
wsCurrent += c;
}
else if (c == '(')
{
bInFunction = true;
nParenDepth++;
wsCurrent += c;
}
else if (c == ')')
{
nParenDepth--;
if (nParenDepth == 0)
bInFunction = false;
wsCurrent += c;
}
else
wsCurrent += c;
}
if (!wsCurrent.empty())
arResult.push_back(wsCurrent);
return arResult;
}
std::vector<std::wstring> GetWordsW(const std::wstring& wsLine, bool bWithSigns, const std::wstring& wsDelimiters)
{
if (wsLine.empty())
@ -95,7 +141,9 @@ namespace NS_STATIC_FUNCTIONS
while (std::wstring::npos != unEnd)
{
arWords.emplace_back(wsLine.data() + unStart, unEnd - unStart + ((bWithSigns) ? 1 : 0));
if (unStart != unEnd)
arWords.emplace_back(wsLine.data() + unStart, unEnd - unStart + ((bWithSigns) ? 1 : 0));
unStart = wsLine.find_first_not_of(wsDelimiters, unEnd);
unEnd = wsLine.find_first_of(wsDelimiters, unStart);
}
@ -141,30 +189,17 @@ namespace NS_STATIC_FUNCTIONS
std::map<std::wstring, std::wstring> GetRules(const std::wstring& wsStyles)
{
if (wsStyles.empty())
return {};
std::wregex oCssPropertyRegex(L"([a-zA-Z-]+)\\s*:\\s*([^;\t\n\r\f\v]+)");
std::wsmatch oMatch;
std::wstring::const_iterator oSearchStart(wsStyles.cbegin());
std::map<std::wstring, std::wstring> mRules;
std::wstring::const_iterator oStartProperty = std::find_if_not(wsStyles.begin(), wsStyles.end(), std::iswspace);
std::wstring::const_iterator oEndProperty, oStartValue, oEndValue;
while (wsStyles.end() != oStartProperty)
while (std::regex_search(oSearchStart, wsStyles.cend(), oMatch, oCssPropertyRegex))
{
oEndProperty = std::find_if(oStartProperty, wsStyles.end(), [](const wchar_t &wcChar){ return L':' == wcChar;});
oStartValue = std::find_if_not(oEndProperty + 1, wsStyles.end(), std::iswspace);
if (wsStyles.end() == oEndProperty || wsStyles.end() == oStartValue)
break;
oEndValue = std::find_if(oStartValue, wsStyles.end(), [](const wchar_t &wcChar){ return L';' == wcChar;});
mRules.insert({std::wstring(oStartProperty, oEndProperty), std::wstring(oStartValue, oEndValue)});
if (wsStyles.end() == oEndValue)
break;
oStartProperty = std::find_if_not(oEndValue + 1, wsStyles.end(), std::iswspace);
mRules.insert(std::make_pair<std::wstring, std::wstring>(oMatch[1], oMatch[2]));
oSearchStart = oMatch.suffix().first;
}
return mRules;

View File

@ -20,6 +20,7 @@ namespace NSCSS
double ReadDouble(const std::wstring& wsValue);
std::vector<double> ReadDoubleValues(const std::wstring& wsValue);
std::vector<std::wstring> ParseCSSPropertie(const std::wstring& wsInput);
std::vector<std::wstring> GetWordsW(const std::wstring& wsLine, bool bWithSigns = false, const std::wstring& wsDelimiters = L" \n\r\t\f\v:;,!");
std::vector<unsigned short int> GetWeightSelector(const std::wstring& sSelector);
std::map<std::wstring, std::wstring> GetRules(const std::wstring& wsStyles);

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,8 @@ namespace NSCSS
{
namespace NSProperties
{
#define NEXT_LEVEL UINT_MAX, true
template<typename T>
class CValue
{
@ -21,6 +23,7 @@ namespace NSCSS
friend class CDigit;
friend class CColor;
friend class CEnum;
friend class CURL;
T m_oValue;
unsigned int m_unLevel;
@ -54,6 +57,11 @@ namespace NSCSS
}
}
static bool LevelIsSame(const CValue& oFirstValue, const CValue& oSecondValue)
{
return oFirstValue.m_unLevel == oSecondValue.m_unLevel;
}
bool operator==(const T& oValue) const { return m_oValue == oValue; }
bool operator>=(const T& oValue) const { return m_oValue >= oValue; }
bool operator<=(const T& oValue) const { return m_oValue <= oValue; }
@ -69,28 +77,33 @@ namespace NSCSS
return *this;
}
CValue& operator =(const T& oValue)
virtual CValue& operator =(const T& oValue)
{
//m_oValue = oValue.m_oValue;
return *this;
}
CValue& operator+=(const CValue& oValue)
virtual CValue& operator+=(const CValue& oValue)
{
if (m_unLevel > oValue.m_unLevel || (m_bImportant && !oValue.m_bImportant) || oValue.Empty())
return *this;
m_oValue = oValue.m_oValue;
m_unLevel = std::max(m_unLevel, oValue.m_unLevel);
m_bImportant = std::max(m_bImportant, oValue.m_bImportant);
m_unLevel = oValue.m_unLevel;
m_bImportant = oValue.m_bImportant;
return *this;
}
bool operator==(const CValue& oValue) const
virtual bool operator==(const CValue& oValue) const
{
return m_oValue == oValue.m_oValue;
}
virtual bool operator!=(const CValue& oValue) const
{
return m_oValue != oValue.m_oValue;
}
};
class CString : public CValue<std::wstring>
@ -124,13 +137,15 @@ namespace NSCSS
CDigit(double dValue, unsigned int unLevel, bool bImportant = false);
bool SetValue(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true) override;
bool SetValue(const CDigit& oValue);
bool SetValue(const double& dValue, unsigned int unLevel, bool bHardMode);
bool Empty() const override;
bool Zero() const;
void Clear() override;
void ConvertTo(UnitMeasure enUnitMeasure, double dPrevValue = 0.);
int ToInt() const override;
double ToDouble() const override;
std::wstring ToWString() const override;
@ -144,6 +159,9 @@ namespace NSCSS
bool operator==(const double& oValue) const;
bool operator==(const CDigit& oDigit) const;
bool operator!=(const double& oValue) const;
bool operator!=(const CDigit& oDigit) const;
CDigit operator+(const CDigit& oDigit) const;
CDigit operator-(const CDigit& oDigit) const;
CDigit operator*(const CDigit& oDigit) const;
@ -169,8 +187,28 @@ namespace NSCSS
bool Empty() const;
bool operator==(const TRGB& oRGB) const;
bool operator!=(const TRGB& oRGB) const;
};
class CURL
{
public:
CURL();
bool Empty() const;
bool LinkToId() const;
void Clear();
bool SetValue(const std::wstring& wsValue);
std::wstring GetValue() const;
bool operator==(const CURL& oValue) const;
bool operator!=(const CURL& oValue) const;
private:
std::wstring m_wsValue;
};
typedef enum
{
ColorEmpty,
@ -180,39 +218,8 @@ namespace NSCSS
ColorUrl
} ColorType;
class Q_DECL_EXPORT CColorValue
class CColor : public CValue<void*>
{
public:
CColorValue();
CColorValue(const CColorValue& oColorValue);
~CColorValue();
void SetRGB(unsigned char uchR, unsigned char uchG, unsigned char uchB);
void SetRGB(const TRGB& oRGB);
void SetHEX(const std::wstring& wsValue);
void SetUrl(const std::wstring& wsValue);
void SetNone();
void Clear();
bool Empty() const;
ColorType m_enType;
void* m_pColor = NULL;
std::wstring GetColor() const;
bool operator==(const CColorValue& oColorValue) const;
CColorValue& operator= (const CColorValue& oColorValue);
};
class CColor : public CValue<CColorValue>
{
CDigit m_oOpacity;
static TRGB ConvertHEXtoRGB(const std::wstring& wsValue);
static std::wstring ConvertRGBtoHEX(const TRGB& oValue);
static std::wstring CutURL(const std::wstring& wsValue);
void SetEmpty(unsigned int unLevel = 0);
public:
CColor();
@ -220,6 +227,8 @@ namespace NSCSS
bool SetOpacity(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true);
bool Empty() const override;
bool None() const;
bool Url() const;
void Clear() override;
ColorType GetType() const;
@ -229,7 +238,27 @@ namespace NSCSS
int ToInt() const override;
double ToDouble() const override;
std::wstring ToWString() const override;
std::wstring EquateToColor(const std::vector<std::pair<TRGB, std::wstring>>& arColors) const;
TRGB ToRGB() const;
static TRGB ConvertHEXtoRGB(const std::wstring& wsValue);
static std::wstring ConvertRGBtoHEX(const TRGB& oValue);
bool operator==(const CColor& oColor) const;
bool operator!=(const CColor& oColor) const;
CColor& operator =(const CColor& oColor);
CColor& operator+=(const CColor& oColor);
private:
CDigit m_oOpacity;
ColorType m_enType;
void SetEmpty(unsigned int unLevel = 0);
void SetRGB(unsigned char uchR, unsigned char uchG, unsigned char uchB);
void SetRGB(const TRGB& oRGB);
void SetHEX(const std::wstring& wsValue);
void SetUrl(const std::wstring& wsValue);
void SetNone();
};
typedef enum
@ -277,7 +306,7 @@ namespace NSCSS
CEnum();
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode) override;
void SetMapping(const std::map<std::wstring, int>& mMap);
void SetMapping(const std::map<std::wstring, int>& mMap, int nDefaulvalue = -1);
bool Empty() const override;
void Clear() override;
@ -370,19 +399,18 @@ namespace NSCSS
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetBackground(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
void InBorder();
const CColor& GetColor() const;
bool IsInBorder() const;
bool Empty() const;
void Clear();
bool Empty() const;
bool IsNone() const;
CBackground& operator =(const CBackground& oBackground);
CBackground& operator+=(const CBackground& oBackground);
bool operator==(const CBackground& oBackground) const;
private:
CColor m_oColor;
bool m_bInBorder;
};
class CTransform
@ -397,6 +425,11 @@ namespace NSCSS
bool SetMatrix(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetMatrix(const Aggplus::CMatrix &oMatrix);
void Translate(double dOffsetX, double dOffsetY);
void Scale(double dScaleX, double dScaleY);
void Rotate(double dValue);
void RotateAt(double dValue, double dX, double dY);
const CMatrix& GetMatrix() const;
bool Empty() const;
@ -411,14 +444,20 @@ namespace NSCSS
{
public:
CBorderSide();
CBorderSide(const CBorderSide& oBorderSide);
void Clear();
static void Equation(CBorderSide &oFirstBorderSide, CBorderSide &oSecondBorderSide);
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
void SetNone(unsigned int unLevel, bool bHardMode);
void Block();
void Unblock();
@ -429,9 +468,13 @@ namespace NSCSS
const CColor& GetColor() const;
bool Empty() const;
bool Zero() const;
bool Valid() const;
CBorderSide& operator+=(const CBorderSide& oBorderSide);
bool operator==(const CBorderSide& oBorderSide) const;
bool operator!=(const CBorderSide& oBorderSide) const;
CBorderSide& operator =(const CBorderSide& oBorderSide);
private:
CDigit m_oWidth;
CString m_oStyle;
@ -440,48 +483,71 @@ namespace NSCSS
bool m_bBlock;
};
typedef enum
{
Collapse,
Separate
} BorderCollapse;
class CBorder
{
public:
CBorder();
void Clear();
void ClearLeftSide();
void ClearTopSide();
void ClearRightSide();
void ClearBottomSide();
static void Equation(CBorder &oFirstBorder, CBorder &oSecondBorder);
bool SetSides(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetSides(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetCollapse(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
//Left Side
bool SetLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthLeftSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyleLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColorLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
//Top Side
bool SetTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthTopSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyleTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColorTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
//Right Side
bool SetRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthRightSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyleRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColorRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
//Bottom Side
bool SetBottomSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetWidthBottomSide(const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetStyleBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColorBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
void SetNone(unsigned int unLevel, bool bHardMode = false);
void Block();
void Unblock();
bool Empty() const;
bool Zero() const;
bool EqualSides() const;
const CEnum& GetCollapse() const;
const CBorderSide& GetLeftBorder() const;
const CBorderSide& GetTopBorder() const;
const CBorderSide& GetRightBorder() const;
@ -489,11 +555,15 @@ namespace NSCSS
CBorder& operator+=(const CBorder& oBorder);
bool operator==(const CBorder& oBorder) const;
bool operator!=(const CBorder& oBorder) const;
CBorder& operator =(const CBorder& oBorder);
private:
CBorderSide m_oLeft;
CBorderSide m_oTop;
CBorderSide m_oRight;
CBorderSide m_oBottom;
CEnum m_enCollapse;
};
class CTextDecorationLine
@ -513,6 +583,7 @@ namespace NSCSS
bool LineThrough() const;
CTextDecorationLine &operator+=(const CTextDecorationLine& oTextDecoration);
bool operator==(const CTextDecorationLine& oTextDecorationLine) const;
};
struct TTextDecoration
@ -522,6 +593,7 @@ namespace NSCSS
CColor m_oColor;
TTextDecoration& operator+=(const TTextDecoration& oTextDecoration);
bool operator==(const TTextDecoration& oTextDecoration) const;
};
class CText
@ -535,11 +607,13 @@ namespace NSCSS
bool SetAlign (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetDecoration(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetHighlight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
const CDigit& GetIndent() const;
const CString& GetAlign() const;
const TTextDecoration& GetDecoration() const;
const CColor& GetColor() const;
const CColor& GetHighlight() const;
bool Empty() const;
@ -554,6 +628,7 @@ namespace NSCSS
CDigit m_oIndent;
CString m_oAlign;
CColor m_oColor;
CColor m_oHighlight;
};
class CIndent
@ -561,33 +636,44 @@ namespace NSCSS
public:
CIndent();
void Clear();
static void Equation(CIndent &oFirstMargin, CIndent &oSecondMargin);
bool Equals() const;
void SetPermisson(bool bPermission);
bool AddValue (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool AddLeft (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool AddTop (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool AddRight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool AddBottom (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
void UpdateAll(double dFontSize);
void UpdateLeft(double dFontSize);
void UpdateTop(double dFontSize);
void UpdateRight(double dFontSize);
void UpdateBottom(double dFontSize);
bool SetValues (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetTop (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetTop (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetRight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetRight (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetBottom (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetBottom (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetLeft (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetLeft (const double& dValue, unsigned int unLevel, bool bHardMode = false);
void UpdateAll (double dFontSize);
void UpdateTop (double dFontSize);
void UpdateRight (double dFontSize);
void UpdateBottom(double dFontSize);
void UpdateLeft (double dFontSize);
const CDigit& GetLeft () const;
const CDigit& GetTop () const;
const CDigit& GetRight () const;
const CDigit& GetBottom() const;
const CDigit& GetLeft () const;
bool Empty() const;
bool Zero() const;
CIndent& operator+=(const CIndent& oMargin);
bool operator==(const CIndent& oMargin) const;
CIndent& operator+=(const CIndent& oIndent);
bool operator==(const CIndent& oIndent) const;
bool operator!=(const CIndent& oIndent) const;
private:
bool AddValue(CDigit& oValue, const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetValues(const std::wstring& wsTopValue, const std::wstring& wsRightValue, const std::wstring& wsBottomValue, const std::wstring& wsLeftValue, unsigned int unLevel, bool bHardMode = false);
void UpdateSide(CDigit& oSide, double dFontSize);
CDigit m_oLeft;
CDigit m_oTop;
@ -606,6 +692,7 @@ namespace NSCSS
bool SetValue (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetSize (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetSize (const double& dValue, unsigned int unLevel, bool bHardMode = false);
bool SetLineHeight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetFamily (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetStretch (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
@ -623,6 +710,7 @@ namespace NSCSS
const CDigit& GetSize() const;
const CDigit& GetLineHeight() const;
CDigit& GetLineHeight();
const CString& GetFamily() const;
const CString& GetStretch() const;
const CString& GetStyle() const;
@ -642,8 +730,29 @@ namespace NSCSS
CString m_oStyle;
CString m_oVariant;
CString m_oWeight;
};
TTextDecoration m_oTextDecoration;
class CPage
{
public:
CPage();
bool SetMargin (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetSize (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetFooter (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
bool SetHeader (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
const CDigit& GetWidth() const;
const CDigit& GetHeight() const;
const CIndent& GetMargin() const;
const CDigit& GetFooter() const;
const CDigit& GetHeader() const;
private:
CDigit m_oWidth;
CDigit m_oHeight;
CIndent m_oMargin;
CDigit m_oFooter;
CDigit m_oHeader;
};
}
}

View File

@ -1,19 +1,20 @@
#include "CDocumentStyle.h"
#include <iostream>
#include <unordered_set>
#include <wchar.h>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <list>
#define DEFAULT_LINEHEIGHT 240
#define LINEHEIGHTSCALE 10 // Значение LineHeight в OOXML должно быть в 10 раз больше чем указано в стиле
#define LINEHEIGHTCOEF 24 // Используется когда необходимо перевести в twips значение
#define POINTCOEF 20 // Используется для конвертации в OOXML значение интервала между абзацами (Измерение в двадцатых долях от точки)
#define PAGEWIDTH (12240 / POINTCOEF)
#define PAGEHEIGHT (15840 / POINTCOEF)
#define DOUBLE_TO_INTW(dValue) std::to_wstring(static_cast<int>(dValue + 0.5))
#define VALUE_TO_INT(value, unit_measure) \
(NSCSS::UnitMeasure::None != value.GetUnitMeasure()) ? \
value.ToInt(unit_measure) : \
static_cast<int>(NSCSS::CUnitMeasureConverter::ConvertPx(value.ToDouble(), unit_measure, 96) + 0.5)
namespace NSCSS
{
@ -21,24 +22,55 @@ namespace NSCSS
: m_oStyle(oStyle), m_bIsPStyle(bIsPStyle)
{}
bool CheckArrays(const std::vector<std::wstring>& arInitial, const std::set<std::wstring>& arFirst, const std::set<std::wstring>& arSecond)
{
std::unordered_set<std::wstring> arInitialSet(arInitial.begin(), arInitial.end());
std::vector<std::wstring> arCommonElements1;
std::vector<std::wstring> arCommonElements2;
for (const std::wstring& wsValue : arFirst)
{
if (arInitialSet.count(wsValue) > 0)
arCommonElements1.push_back(wsValue);
}
for (const std::wstring& wsValue : arSecond)
{
if (arInitialSet.count(wsValue) > 0)
arCommonElements2.push_back(wsValue);
}
if (arCommonElements1.size() != arCommonElements2.size())
return false;
std::sort(arCommonElements1.begin(), arCommonElements1.end());
std::sort(arCommonElements2.begin(), arCommonElements2.end());
return arCommonElements1 == arCommonElements2;
}
bool CStyleUsed::operator==(const CStyleUsed &oUsedStyle) const
{
return (m_bIsPStyle == oUsedStyle.m_bIsPStyle) && (m_oStyle == oUsedStyle.m_oStyle);
return m_bIsPStyle == oUsedStyle.m_bIsPStyle &&
CheckArrays(Names_Standard_Styles, m_oStyle.GetParentsNamesSet(), oUsedStyle.m_oStyle.GetParentsNamesSet()) &&
m_oStyle == oUsedStyle.m_oStyle;
}
std::wstring CStyleUsed::getId()
{
return m_sId;
if (m_bIsPStyle)
return m_oStyle.GetId();
return m_oStyle.GetId() + L"-c";
}
void CStyleUsed::setId(const std::wstring &sId)
CDocumentStyle::CDocumentStyle() : m_arStandardStyles(Names_Standard_Styles)
{
m_sId = sId;
for (const std::wstring& oNameStandardStyle : Names_Standard_Styles)
m_arStandardStyles.push_back(oNameStandardStyle + L"-c");
}
CDocumentStyle::CDocumentStyle() : m_arStandardStyles({L"a", L"li", L"h1", L"h2", L"h3", L"h4", L"h5", L"h6", L"h1-c",
L"h2-c", L"h3-c", L"h4-c", L"h5-c", L"h6-c", L"p-c", L"p", L"div-c", L"div", L"a-c"}) {}
CDocumentStyle::~CDocumentStyle()
{
m_arStandardStyles. clear();
@ -157,6 +189,7 @@ namespace NSCSS
if (!oParentStyle.Empty())
{
oParentStyle.AddBasicProperties(BProperties::B_BasedOn, L"normal");
oParentStyle.AddBasicProperties(BProperties::B_StyleId, L"(" + oParentStyle.GetStyleId() + L")");
if (!bIsPStyle)
{
@ -271,250 +304,308 @@ namespace NSCSS
oElement.AddBasicProperties(BProperties::B_CustomStyle, L"1");
}
void CDocumentStyle::SetPStyle (const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement)
void CDocumentStyle::SetPStyle (const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite)
{
ConvertStyle(oStyle, oXmlElement, true);
if (oStyle.Empty() && oXmlElement.Empty())
if (!bIsLite)
ConvertStyle(oStyle, oXmlElement, true);
if (oStyle.Empty())
return;
oXmlElement.AddPropertiesInP(PProperties::P_Jc, oStyle.m_oText.GetAlign().ToWString());
const bool bInTable{oStyle.HaveThisParent(L"table")};
std::wstring wsTextAlign{oStyle.m_oText.GetAlign().ToWString()};
if (wsTextAlign.empty() && bInTable)
wsTextAlign = oStyle.m_oDisplay.GetHAlign().ToWString();
oXmlElement.AddPropertiesInP(PProperties::P_Jc, wsTextAlign);
std::wstring sInfValue;
sInfValue.reserve(64);
//TODO:: проверить Permission в Margin
if (!oStyle.m_oMargin.Empty() || !oStyle.m_oPadding.Empty() /*&& oStyle.m_oMargin.GetPermission()*/)
{
const double dLeftSide = oStyle.m_oMargin.GetLeft() .ToDouble(NSCSS::Twips) + oStyle.m_oPadding.GetLeft() .ToDouble(NSCSS::Twips);
const double dRightSide = oStyle.m_oMargin.GetRight().ToDouble(NSCSS::Twips) + oStyle.m_oPadding.GetRight().ToDouble(NSCSS::Twips);
if (!oStyle.m_oMargin.GetLeft().Empty() && !oStyle.m_oMargin.GetLeft().Zero())
sInfValue += L"w:left=\"" + std::to_wstring(oStyle.m_oMargin.GetLeft().ToInt(NSCSS::Twips)) + L"\" ";
sInfValue += L"w:left=\"" + DOUBLE_TO_INTW(dLeftSide * POINTCOEF) + L"\" ";
sInfValue += L"w:right=\"" + DOUBLE_TO_INTW(dRightSide * POINTCOEF) + L"\" ";
}
if (!oStyle.m_oMargin.GetRight().Empty() && !oStyle.m_oMargin.GetRight().Zero())
sInfValue += L"w:right=\"" + std::to_wstring(oStyle.m_oMargin.GetRight().ToInt(NSCSS::Twips)) + L"\" ";
const double dIndent = oStyle.m_oText.GetIndent().ToDouble(NSCSS::Twips);
if (0. != dIndent)
sInfValue += L"w:firstLine=\"" + DOUBLE_TO_INTW(dIndent) + L"\" ";
const int nIndent = oStyle.m_oText.GetIndent().ToInt(NSCSS::Twips);
if (0 != nIndent)
sInfValue += L"w:firstLine=\"" + std::to_wstring(nIndent) + L"\" ";
oXmlElement.AddPropertiesInP(PProperties::P_Ind, sInfValue);
std::wstring sSpacingValue;
sSpacingValue.reserve(128);
//TODO:: проверить Permission в Margin
if (!oStyle.m_oMargin.Empty() || !oStyle.m_oPadding.Empty()/*&& oStyle.m_oMargin.GetPermission()*/)
{
const double dSpacingBottom = oStyle.m_oMargin.GetBottom().ToDouble(NSCSS::Twips) + oStyle.m_oPadding.GetBottom().ToDouble(NSCSS::Twips);
const double dSpacingTop = oStyle.m_oMargin.GetTop() .ToDouble(NSCSS::Twips) + oStyle.m_oPadding.GetTop() .ToDouble(NSCSS::Twips);;
sSpacingValue += L" w:after=\"" + DOUBLE_TO_INTW(dSpacingBottom * POINTCOEF) + L"\" ";
sSpacingValue += L" w:before=\"" + DOUBLE_TO_INTW(dSpacingTop * POINTCOEF) + L"\" ";
}
else/* if (!oStyle.m_pBorder.Empty() || !oStyle.m_oMargin.GetPermission())*/
sSpacingValue += L"w:after=\"0\" w:before=\"0\"";
if (!oStyle.m_oMargin.GetTop().Empty() && !oStyle.m_oMargin.GetTop().Zero())
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"0\"";
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"0\"";
std::wstring wsLineHeight;
if (!oStyle.m_oFont.GetLineHeight().Empty())
{
double dLineHeight = oStyle.m_oFont.GetLineHeight().ToDouble(NSCSS::Twips, LINEHEIGHTCOEF) * LINEHEIGHTSCALE;
if (!oStyle.m_oMargin.GetBottom().Empty() && !oStyle.m_oMargin.GetBottom().Zero())
sSpacingValue += L" w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"0\"";
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"0\"";
if (NSCSS::None == oStyle.m_oFont.GetLineHeight().GetUnitMeasure())
dLineHeight *= LINEHEIGHTCOEF;
if (0. != dLineHeight)
wsLineHeight = DOUBLE_TO_INTW(dLineHeight);
}
if (!wsLineHeight.empty())
if (!oStyle.m_oFont.GetLineHeight().Empty() && !oStyle.m_oFont.GetLineHeight().Zero())
{
sSpacingValue += L" w:line=\"" + wsLineHeight + L"\" w:lineRule=\"auto\"";
const std::wstring wsLine{std::to_wstring(oStyle.m_oFont.GetLineHeight().ToInt(NSCSS::Twips, DEFAULT_LINEHEIGHT))};
const std::wstring wsLineRule{(NSCSS::Percent == oStyle.m_oFont.GetLineHeight().GetUnitMeasure() ? L"auto" : L"atLeast")};
sSpacingValue += L" w:line=\"" + wsLine + L"\" w:lineRule=\"" + wsLineRule + L"\"";
}
// else if (!oStyle.m_oBorder.Empty())
// {
// sSpacingValue += L" w:line=\"" + std::to_wstring(static_cast<short int>(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Twips) * 2 * POINTCOEF + 0.5f)) + L"\" w:lineRule=\"auto\"";
// }
else if (!oStyle.m_oBorder.Empty())
sSpacingValue += L" w:line=\"240\" w:lineRule=\"auto\" ";
else if (oStyle.m_oFont.GetLineHeight().Zero() || bInTable)
sSpacingValue += L" w:lineRule=\"auto\" w:line=\"240\"";
if (!sSpacingValue.empty())
{
oXmlElement.AddPropertiesInP(PProperties::P_Spacing, sSpacingValue);
oXmlElement.AddPropertiesInP(PProperties::P_ContextualSpacing, L"true");
}
if (!oStyle.m_oBackground.Empty())
{
const std::wstring wsColor = oStyle.m_oBackground.GetColor().ToWString();
if (wsColor != L"ffffff")
oXmlElement.AddPropertiesInP(PProperties::P_Shd, wsColor);
}
if (!oStyle.m_oBackground.Empty() && !bInTable)
oXmlElement.AddPropertiesInP(PProperties::P_Shd, oStyle.m_oBackground.IsNone() ? L"auto" : oStyle.m_oBackground.GetColor().ToWString());
if (!oStyle.m_oBorder.Empty())
if (!oStyle.m_oBorder.Empty() && !bInTable)
{
if (oStyle.m_oBorder.EqualSides())
{
const std::wstring sBorderColor = oStyle.m_oBorder.GetLeftBorder().GetColor().ToWString();
const std::wstring sBorderStyle = oStyle.m_oBorder.GetLeftBorder().GetStyle().ToWString();
const std::wstring sBorderWidth = oStyle.m_oBorder.GetLeftBorder().GetWidth().ToWString();
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"0\" w:sz=\"" +
sBorderWidth + L"\" w:val=\"" + sBorderStyle + L"\"";
oXmlElement.AddPropertiesInP(PProperties::P_TopBorder, sBorder);
oXmlElement.AddPropertiesInP(PProperties::P_LeftBorder, sBorder);
oXmlElement.AddPropertiesInP(PProperties::P_BottomBorder, sBorder);
oXmlElement.AddPropertiesInP(PProperties::P_RightBorder, sBorder);
SetBorderStyle(oStyle, oXmlElement, PProperties::P_TopBorder);
SetBorderStyle(oStyle, oXmlElement, PProperties::P_LeftBorder);
SetBorderStyle(oStyle, oXmlElement, PProperties::P_BottomBorder);
SetBorderStyle(oStyle, oXmlElement, PProperties::P_RightBorder);
}
else
{
if (!oStyle.m_oBorder.GetTopBorder().Empty())
{
const std::wstring sBorderColor = oStyle.m_oBorder.GetTopBorder().GetColor().ToWString();
const std::wstring sBorderStyle = oStyle.m_oBorder.GetTopBorder().GetStyle().ToWString();
const std::wstring sBorderWidth = oStyle.m_oBorder.GetTopBorder().GetWidth().ToWString();
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"4\" w:sz=\"" +
sBorderWidth + L"\" w:val=\"" + sBorderStyle + L"\"";
oXmlElement.AddPropertiesInP(PProperties::P_TopBorder, sBorder);
}
SetBorderStyle(oStyle, oXmlElement, PProperties::P_TopBorder);
if (!oStyle.m_oBorder.GetRightBorder().Empty())
{
const std::wstring sBorderColor = oStyle.m_oBorder.GetRightBorder().GetColor().ToWString();
const std::wstring sBorderStyle = oStyle.m_oBorder.GetRightBorder().GetStyle().ToWString();
const std::wstring sBorderWidth = oStyle.m_oBorder.GetRightBorder().GetWidth().ToWString();
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"4\" w:sz=\"" +
sBorderWidth + L"\" w:val=\"" + sBorderStyle + L"\"";
oXmlElement.AddPropertiesInP(PProperties::P_RightBorder, sBorder);
}
SetBorderStyle(oStyle, oXmlElement, PProperties::P_RightBorder);
if (!oStyle.m_oBorder.GetBottomBorder().Empty())
{
const std::wstring sBorderColor = oStyle.m_oBorder.GetBottomBorder().GetColor().ToWString();
const std::wstring sBorderStyle = oStyle.m_oBorder.GetBottomBorder().GetStyle().ToWString();
const std::wstring sBorderWidth = oStyle.m_oBorder.GetBottomBorder().GetWidth().ToWString();
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"4\" w:sz=\"" +
sBorderWidth + L"\" w:val=\"" + sBorderStyle + L"\"";
oXmlElement.AddPropertiesInP(PProperties::P_BottomBorder, sBorder);
}
SetBorderStyle(oStyle, oXmlElement, PProperties::P_BottomBorder);
if (!oStyle.m_oBorder.GetLeftBorder().Empty())
{
const std::wstring sBorderColor = oStyle.m_oBorder.GetLeftBorder().GetColor().ToWString();
const std::wstring sBorderStyle = oStyle.m_oBorder.GetLeftBorder().GetStyle().ToWString();
const std::wstring sBorderWidth = oStyle.m_oBorder.GetLeftBorder().GetWidth().ToWString();
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"4\" w:sz=\"" +
sBorderWidth + L"\" w:val=\"" + sBorderStyle + L"\"";
oXmlElement.AddPropertiesInP(PProperties::P_LeftBorder, sBorder);
}
SetBorderStyle(oStyle, oXmlElement, PProperties::P_LeftBorder);
}
}
}
void CDocumentStyle::SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement)
void CDocumentStyle::SetBorderStyle(const CCompiledStyle &oStyle, CXmlElement &oXmlElement, const PProperties &enBorderProperty)
{
ConvertStyle(oStyle, oXmlElement, false);
const NSCSS::NSProperties::CBorderSide* pBorder = NULL;
const NSCSS::NSProperties::CDigit* pPadding = NULL;
switch(enBorderProperty)
{
case PProperties::P_BottomBorder:
{
pBorder = &oStyle.m_oBorder.GetBottomBorder();
pPadding = &oStyle.m_oPadding.GetBottom();
break;
}
case PProperties::P_LeftBorder:
{
pBorder = &oStyle.m_oBorder.GetLeftBorder();
pPadding = &oStyle.m_oPadding.GetLeft();
break;
}
case PProperties::P_RightBorder:
{
pBorder = &oStyle.m_oBorder.GetRightBorder();
pPadding = &oStyle.m_oPadding.GetRight();
break;
}
case PProperties::P_TopBorder:
{
pBorder = &oStyle.m_oBorder.GetTopBorder();
pPadding = &oStyle.m_oPadding.GetTop();
break;
}
default:
return;
}
oXmlElement.AddPropertiesInP(enBorderProperty, CalculateBorderStyle(*pBorder, pPadding));
}
std::wstring CDocumentStyle::CalculateBorderStyle(const NSProperties::CBorderSide &oBorder, const NSProperties::CDigit *pPadding)
{
if (oBorder.Empty())
return L"";
std::wstring wsColor = oBorder.GetColor().ToWString();
std::wstring wsStyle = oBorder.GetStyle().ToWString();
int nWidth = static_cast<int>(std::round(oBorder.GetWidth().ToDouble(Point) * 8.));
if (L"double" == wsStyle)
nWidth /= 3; // в ooxml double граница формируется из трёх линий
if (nWidth <= 3)
nWidth = 2;
else if (nWidth <= 5)
nWidth = 4;
else if (nWidth <= 7)
nWidth = 6;
else if (nWidth <= 9)
nWidth = 8;
else if (nWidth <= 15)
nWidth = 12;
else if (nWidth <= 21)
nWidth = 18;
else if (nWidth <= 29)
nWidth = 24;
else if (nWidth <= 41)
nWidth = 36;
else
nWidth = 48;
if (wsColor.empty())
wsColor = L"auto";
if (wsStyle.empty())
wsStyle = L"single";
int nSpace{0};
if (NULL != pPadding && !pPadding->Empty() && !pPadding->Zero())
nSpace = pPadding->ToInt(NSCSS::Point);
return L"w:val=\"" + wsStyle + L"\" w:sz=\"" + std::to_wstring(nWidth) + + L"\" w:space=\"" + std::to_wstring(nSpace) + L"\" w:color=\"" + wsColor + L"\"";
}
void CDocumentStyle::SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite)
{
if (!bIsLite)
ConvertStyle(oStyle, oXmlElement, false);
if (oStyle.Empty() && oXmlElement.Empty())
return;
if (!oStyle.m_oFont.GetSize().Empty())
oXmlElement.AddPropertiesInR(RProperties::R_Sz, DOUBLE_TO_INTW(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Twips)));
oXmlElement.AddPropertiesInR(RProperties::R_Sz, std::to_wstring(static_cast<int>(oStyle.m_oFont.GetSize().ToDouble(NSCSS::Point) * 2. + 0.5))); // Значения шрифта увеличивает на 2
if (oStyle.m_oText.GetDecoration().m_oLine.Underline())
oXmlElement.AddPropertiesInR(RProperties::R_U, (!oStyle.m_oText.GetDecoration().m_oStyle.Empty()) ? oStyle.m_oText.GetDecoration().m_oStyle.ToWString() : L"single");
if (!oStyle.m_oBackground.GetColor().Empty() && !oStyle.m_oBackground.GetColor().None() && !oStyle.m_oBackground.GetColor().Url())
oXmlElement.AddPropertiesInR(RProperties::R_Shd, oStyle.m_oBackground.GetColor().ToWString());
const std::wstring wsHighlight{oStyle.m_oText.GetHighlight().EquateToColor({{{0, 0, 0}, L"black"}, {{0, 0, 255}, L"blue"}, {{0, 255, 255}, L"cyan"},
{{0, 255, 0}, L"green"}, {{255, 0, 255}, L"magenta"}, {{255, 0, 0}, L"red"},
{{255, 255, 0}, L"yellow"}, {{255, 255, 255}, L"white"}, {{0, 0, 139}, L"darkBlue"},
{{0, 139, 139}, L"darkCyan"}, {{0, 100, 0}, L"darkGreen"}, {{139, 0, 139}, L"darkMagenta"},
{{139, 0, 0}, L"darkRed"}, {{128, 128, 0}, L"darkYellow"},{{169, 169, 169}, L"darkGray"},
{{211, 211, 211}, L"lightGray"}})};
if (L"none" != wsHighlight)
oXmlElement.AddPropertiesInR(RProperties::R_Highlight, wsHighlight);
oXmlElement.AddPropertiesInR(RProperties::R_Highlight, oStyle.m_oBackground.GetColor().ToWString());
oXmlElement.AddPropertiesInR(RProperties::R_Color, oStyle.m_oText.GetColor().ToWString());
oXmlElement.AddPropertiesInR(RProperties::R_U, (oStyle.m_oText.GetDecoration().m_oLine.Underline()) ? L"underline" : L"");
std::wstring wsFontFamily{oStyle.m_oFont.GetFamily().ToWString()};
if (L"sans-serif" == wsFontFamily)
wsFontFamily = L"Arial";
else if (L"serif" == wsFontFamily)
wsFontFamily = L"Times New Roman";
oXmlElement.AddPropertiesInR(RProperties::R_RFonts, oStyle.m_oFont.GetFamily().ToWString());
oXmlElement.AddPropertiesInR(RProperties::R_I, oStyle.m_oFont.GetStyle().ToWString());
oXmlElement.AddPropertiesInR(RProperties::R_B, oStyle.m_oFont.GetWeight().ToWString());
oXmlElement.AddPropertiesInR(RProperties::R_SmallCaps, oStyle.m_oFont.GetVariant().ToWString());
}
void CDocumentStyle::WriteRStyle (const NSCSS::CCompiledStyle& oStyle)
bool CDocumentStyle::WriteRStyle(const NSCSS::CCompiledStyle& oStyle)
{
Clear();
if(oStyle.GetId().empty())
{
m_sId = L"normal";
return;
}
return false;
CStyleUsed structStyle(oStyle, false);
std::list<CStyleUsed>::iterator oItem = std::find(m_arStyleUsed.begin(), m_arStyleUsed.end(), structStyle);
std::vector<CStyleUsed>::iterator oItem = std::find(m_arStyleUsed.begin(), m_arStyleUsed.end(), structStyle);
if (oItem != m_arStyleUsed.end())
{
m_sId = (*oItem).getId();
return;
return true;
}
CXmlElement oXmlElement;
SetRStyle(oStyle, oXmlElement);
if (!oStyle.Empty() || !oXmlElement.Empty())
{
structStyle.setId(oXmlElement.GetStyleId());
m_arStyleUsed.push_back(structStyle);
m_sStyle += oXmlElement.GetRStyle();
}
}
void CDocumentStyle::WriteLitePStyle(const CCompiledStyle &oStyle)
{
if (oStyle.Empty())
return;
CXmlElement oXmlElement;
SetPStyle(oStyle, oXmlElement);
if (!oXmlElement.Empty())
m_sStyle += oXmlElement.GetPStyle(true);
}
void CDocumentStyle::WriteLiteRStyle(const CCompiledStyle &oStyle)
{
if (oStyle.Empty())
return;
CXmlElement oXmlElement;
SetRStyle(oStyle, oXmlElement);
if (!oXmlElement.Empty())
m_sStyle += oXmlElement.GetRStyle(true);
if (oXmlElement.Empty())
return false;
m_arStyleUsed.push_back(structStyle);
m_sStyle += oXmlElement.GetRStyle();
return true;
}
void CDocumentStyle::WritePStyle (const NSCSS::CCompiledStyle& oStyle)
bool CDocumentStyle::WriteLitePStyle(const CCompiledStyle &oStyle)
{
Clear();
if (oStyle.Empty())
return false;
CXmlElement oXmlElement;
SetPStyle(oStyle, oXmlElement, true);
if (oXmlElement.Empty())
return false;
m_sStyle += oXmlElement.GetPStyle(true);
return true;
}
bool CDocumentStyle::WriteLiteRStyle(const CCompiledStyle &oStyle)
{
Clear();
if (oStyle.Empty())
return false;
CXmlElement oXmlElement;
SetRStyle(oStyle, oXmlElement, true);
if (oXmlElement.Empty())
return false;
m_sStyle += oXmlElement.GetRStyle(true);
return true;
}
bool CDocumentStyle::WritePStyle(const NSCSS::CCompiledStyle& oStyle)
{
Clear();
if(oStyle.GetId().empty())
{
m_sId = L"normal";
return;
}
return false;
CStyleUsed structStyle(oStyle, true);
std::list<CStyleUsed>::iterator oItem = std::find(m_arStyleUsed.begin(), m_arStyleUsed.end(), structStyle);
std::vector<CStyleUsed>::iterator oItem = std::find(m_arStyleUsed.begin(), m_arStyleUsed.end(), structStyle);
if (oItem != m_arStyleUsed.end())
{
m_sId = (*oItem).getId();
return;
return true;
}
CXmlElement oXmlElement;
SetPStyle(oStyle, oXmlElement);
if (!oStyle.Empty() || !oXmlElement.Empty())
{
structStyle.setId(oXmlElement.GetStyleId());
m_arStyleUsed.push_back(structStyle);
m_sStyle += oXmlElement.GetPStyle();
}
if (oXmlElement.Empty())
return false;
m_arStyleUsed.push_back(structStyle);
m_sStyle += oXmlElement.GetPStyle();
return true;
}
}

View File

@ -12,7 +12,6 @@ namespace NSCSS
{
CCompiledStyle m_oStyle;
bool m_bIsPStyle;
std::wstring m_sId;
public:
CStyleUsed(const CCompiledStyle& oStyle, bool bIsPStyle);
@ -20,18 +19,19 @@ namespace NSCSS
bool operator==(const CStyleUsed& oUsedStyle) const;
std::wstring getId();
void setId(const std::wstring& sId);
};
static const std::vector<std::wstring> Names_Standard_Styles = {L"a", L"li", L"h1", L"h2", L"h3", L"h4", L"h5", L"h6",L"p", L"div"};
class CSSCALCULATOR_EXPORT CDocumentStyle
{
typedef NSConstValues::NSProperties::BasicProperties BProperties;
typedef NSConstValues::NSProperties::ParagraphProperties PProperties;
typedef NSConstValues::NSProperties::RunnerProperties RProperties;
std::list<std::wstring> m_arStandardStylesUsed;
std::list<std::wstring> m_arStandardStyles;
std::list<CStyleUsed> m_arStyleUsed;
std::vector<std::wstring> m_arStandardStylesUsed;
std::vector<std::wstring> m_arStandardStyles;
std::vector<CStyleUsed> m_arStyleUsed;
std::wstring m_sStyle;
std::wstring m_sId;
@ -40,17 +40,18 @@ namespace NSCSS
void CreateStandardStyle (const std::wstring& sNameStyle, CXmlElement& oElement);
void ConvertStyle (const NSCSS::CCompiledStyle& oStyle, CXmlElement& oElement, bool bIsPStyle);
void SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement);
void SetPStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement);
void SetRStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite = false);
void SetPStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, bool bIsLite = false);
void SetBorderStyle(const NSCSS::CCompiledStyle& oStyle, CXmlElement& oXmlElement, const PProperties& enBorderProperty);
public:
CDocumentStyle();
~CDocumentStyle();
void WritePStyle(const NSCSS::CCompiledStyle& oStyle);
void WriteRStyle(const NSCSS::CCompiledStyle& oStyle);
void WriteLitePStyle(const NSCSS::CCompiledStyle& oStyle);
void WriteLiteRStyle(const NSCSS::CCompiledStyle& oStyle);
bool WritePStyle(const NSCSS::CCompiledStyle& oStyle);
bool WriteRStyle(const NSCSS::CCompiledStyle& oStyle);
bool WriteLitePStyle(const NSCSS::CCompiledStyle& oStyle);
bool WriteLiteRStyle(const NSCSS::CCompiledStyle& oStyle);
void SetStyle(const std::wstring& sStyle);
void SetId (const std::wstring& sId);
@ -59,6 +60,8 @@ namespace NSCSS
std::wstring GetIdAndClear();
void Clear();
static std::wstring CalculateBorderStyle(const NSCSS::NSProperties::CBorderSide& oBorder, const NSCSS::NSProperties::CDigit* pPadding = NULL);
};
}
#endif // CDOCUMENTSTYLE_H

View File

@ -27,7 +27,7 @@ CXmlElement::CXmlElement(const std::wstring& sNameDefaultElement)
bool CXmlElement::Empty() const
{
return m_mBasicValues.empty() && m_mPStyleValues.empty() && m_mRStyleValues.empty();
return m_mPStyleValues.empty() && m_mRStyleValues.empty() && GetBasedOn().empty();
}
void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
@ -35,7 +35,19 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
if (!Empty())
Clear();
if (sNameDefaultElement == L"li")
/* if (sNameDefaultElement == L"p")
{
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"paragraph");
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"p");
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Normal (Web)");
AddBasicProperties(CSSProperties::BasicProperties::B_BasedOn, L"normal");
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"99");
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddBasicProperties(CSSProperties::BasicProperties::B_SemiHidden, L"true");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else */if (sNameDefaultElement == L"li")
{
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"paragraph");
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"li");
@ -55,7 +67,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h1-c");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"0");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:after=\"0\" w:before=\"480\"");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else if (sNameDefaultElement == L"h2")
{
@ -66,7 +78,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h2-c");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"1");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:after=\"0\" w:before=\"400\"");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else if (sNameDefaultElement == L"h3")
{
@ -77,7 +89,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h3-c");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"2");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:after=\"0\" w:before=\"360\"");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else if (sNameDefaultElement == L"h4")
{
@ -88,7 +100,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h4-c");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"3");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:after=\"0\" w:before=\"320\"");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else if (sNameDefaultElement == L"h5")
{
@ -99,7 +111,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h5-c");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"4");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:after=\"0\" w:before=\"280\"");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else if (sNameDefaultElement == L"h6")
@ -111,7 +123,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h6-c");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_OutlineLvl, L"5");
AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:after=\"0\" w:before=\"280\"");
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
}
else if (sNameDefaultElement == L"h1-c")
{
@ -122,9 +134,9 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"9");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h1");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"44");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"48");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Kern, L"36");
}
else if (sNameDefaultElement == L"h2-c")
{
@ -136,9 +148,8 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h2");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"33");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"36");
}
else if (sNameDefaultElement == L"h3-c")
{
@ -150,9 +161,8 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h3");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"26");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"27");
}
else if (sNameDefaultElement == L"h4-c")
{
@ -164,9 +174,8 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h4");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"24");
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"22");
}
else if (sNameDefaultElement == L"h5-c")
{
@ -178,9 +187,8 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h5");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"20");
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"18");
}
else if (sNameDefaultElement == L"h6-c")
{
@ -192,38 +200,16 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"h6");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"15");
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
}
else if (sNameDefaultElement == L"p-c")
{
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"p-c");
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Paragraph character");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"p");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
}
else if (sNameDefaultElement == L"p")
{
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"paragraph");
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"p");
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Paragraph");
AddBasicProperties(CSSProperties::BasicProperties::B_BasedOn, L"normal");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"p-c");
}
else if (sNameDefaultElement == L"div-c")
/*else if (sNameDefaultElement == L"div-c")
{
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"div-c");
AddBasicProperties(CSSProperties::BasicProperties::B_CustomStyle, L"1");
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Div character");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"div");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
}
else if (sNameDefaultElement == L"div")
{
@ -233,7 +219,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Div paragraph");
AddBasicProperties(CSSProperties::BasicProperties::B_BasedOn, L"normal");
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"div-c");
}
}*/
else if (sNameDefaultElement == L"a-c")
{
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
@ -242,9 +228,9 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
AddBasicProperties(CSSProperties::BasicProperties::B_UiPriority, L"99");
AddBasicProperties(CSSProperties::BasicProperties::B_UnhideWhenUsed, L"true");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"24");
AddPropertiesInR(CSSProperties::RunnerProperties::R_Color, L"0000FF");
AddPropertiesInR(CSSProperties::RunnerProperties::R_U, L"single");
AddPropertiesInR(CSSProperties::RunnerProperties::R_RFonts, DEFAULTFONTNAME);
}
else if (sNameDefaultElement == L"a")
{
@ -312,7 +298,7 @@ CXmlElement& CXmlElement::operator=(const CXmlElement& oElement)
return *this;
}
bool CXmlElement::operator==(const CXmlElement &oElement)
bool CXmlElement::operator==(const CXmlElement &oElement) const
{
return m_mBasicValues == oElement.m_mBasicValues &&
m_mPStyleValues == oElement.m_mPStyleValues &&
@ -364,22 +350,22 @@ std::wstring CXmlElement::ConvertPStyle(bool bIsLite) const
case CSSProperties::ParagraphProperties::P_TopBorder:
{
sPBdr += L"<w:top" + oItem.second + L"/>";
sPBdr += L"<w:top " + oItem.second + L"/>";
break;
}
case CSSProperties::ParagraphProperties::P_LeftBorder:
{
sPBdr += L"<w:left" + oItem.second + L"/>";
sPBdr += L"<w:left " + oItem.second + L"/>";
break;
}
case CSSProperties::ParagraphProperties::P_BottomBorder:
{
sPBdr += L"<w:bottom" + oItem.second + L"/>";
sPBdr += L"<w:bottom " + oItem.second + L"/>";
break;
}
case CSSProperties::ParagraphProperties::P_RightBorder:
{
sPBdr += L"<w:right" + oItem.second + L"/>";
sPBdr += L"<w:right " + oItem.second + L"/>";
break;
}
case CSSProperties::ParagraphProperties::P_KeepLines:
@ -429,8 +415,8 @@ std::wstring CXmlElement::ConvertRStyle(bool bIsLite) const
}
case CSSProperties::RunnerProperties::R_Sz:
{
sRStyle += L"<w:sz w:val=\"" + oItem.second +
L"\"/>" + L"<w:szCs w:val=\"" + oItem.second + L"\"/>";
sRStyle += L"<w:sz w:val=\"" + oItem.second + L"\"/>" +
L"<w:szCs w:val=\"" + oItem.second + L"\"/>";
break;
}
case CSSProperties::RunnerProperties::R_B:
@ -462,11 +448,18 @@ std::wstring CXmlElement::ConvertRStyle(bool bIsLite) const
sRStyle += L"<w:u w:val=\"" + oItem.second + L"\"/>";
break;
}
// case CSSProperties::RunnerProperties::R_Highlight:
// {
// sRStyle += L"<w:highlight w:val=\"" + oItem.second + L"\"/>";
// break;
// }
case CSSProperties::RunnerProperties::R_Highlight:
{
if (!oItem.second.empty())
sRStyle += L"<w:highlight w:val=\"" + oItem.second + L"\"/>";
break;
}
case CSSProperties::RunnerProperties::R_Shd:
{
if (!oItem.second.empty())
sRStyle += L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" + oItem.second + L"\"/>";
break;
}
case CSSProperties::RunnerProperties::R_SmallCaps:
{
if (oItem.second == L"smallCaps")
@ -475,6 +468,11 @@ std::wstring CXmlElement::ConvertRStyle(bool bIsLite) const
sRStyle += L"<w:smallCaps w:val=\"false\"/>";
break;
}
case CSSProperties::RunnerProperties::R_Kern:
{
sRStyle += L"<w:kern w:val=\"" + oItem.second + L"\"/>";
break;
}
default:
break;
}
@ -519,7 +517,8 @@ std::wstring CXmlElement::ConvertBasicInfoStyle() const
}
case CSSProperties::BasicProperties::B_UnhideWhenUsed:
{
sBasicInfo += L"<w:unhideWhenUsed/>";
if (L"true" == oItem.second)
sBasicInfo += L"<w:unhideWhenUsed/>";
break;
}
case CSSProperties::BasicProperties::B_UiPriority:
@ -527,6 +526,12 @@ std::wstring CXmlElement::ConvertBasicInfoStyle() const
sBasicInfo += L"<w:uiPriority w:val=\"" + oItem.second + L"\"/>";
break;
}
case CSSProperties::BasicProperties::B_SemiHidden:
{
if (L"true" == oItem.second)
sBasicInfo += L"<w:semiHidden/>";
break;
}
default:
break;
}
@ -598,7 +603,7 @@ std::wstring CXmlElement::GetPStyle(bool bIsLite) const
{
if (bIsLite)
return ConvertPStyle(true);
return GetStyle(true, true, false);
}
@ -606,7 +611,7 @@ std::wstring CXmlElement::GetRStyle(bool bIsLite) const
{
if (bIsLite)
return ConvertRStyle(true);
return GetStyle(true, false, true);
}

View File

@ -47,7 +47,7 @@ public:
CXmlElement& operator+=(const CXmlElement& oElement);
CXmlElement& operator= (const CXmlElement& oelement);
bool operator== (const CXmlElement& oElement);
bool operator== (const CXmlElement& oElement) const;
};
#endif // CXMLELEMENT_H

View File

@ -5,7 +5,6 @@ sys.path.append('../../../../build_tools/scripts')
import config
import base
import os
import build
base_directory = os.getcwd()

View File

@ -11,7 +11,9 @@
#include "../../../DesktopEditor/common/File.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/StringBuilder.h"
#include "../../../DesktopEditor/xml/include/xmlutils.h"
#include "../../../UnicodeConverter/UnicodeConverter.h"
#include "../../../HtmlFile2/src/StringFinder.h"
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|";
@ -20,8 +22,27 @@ static std::string special_handling = "|html|body|";
static std::string no_entity_sub = ""; //"|style|";
static std::string treat_like_inline = "|p|";
static void prettyprint(GumboNode*, NSStringUtils::CStringBuilderA& oBuilder);
static std::string mhtTohtml(std::string& sFileContent);
static std::vector<std::string> html_tags = {"div","span","a","img","p","h1","h2","h3","h4","h5","h6",
"ul", "ol", "li","td","tr","table","thead","tbody","tfoot","th",
"br","form","input","button","section","nav","header","footer",
"main","figure","figcaption","strong","em","i", "b", "u","pre",
"code","blockquote","hr","script","link","meta","style","title",
"head","body","html","legend","optgroup","option","select","dl",
"dt","dd","time","data","abbr","address","area","base","bdi",
"bdo","cite","col","iframe","video","source","track","textarea",
"label","fieldset","colgroup","del","ins","details","summary",
"dialog","embed","kbd","map","mark","menu","meter","object",
"output","param","progress","q","samp","small","sub","sup","var",
"wbr","acronym","applet","article","aside","audio","basefont",
"bgsound","big","blink","canvas","caption","center","command",
"comment","datalist","dfn","dir","font","frame","frameset",
"hgroup","isindex","keygen","marquee","nobr","noembed","noframes",
"noscript","plaintext","rp","rt","ruby","s","strike","tt","xmp"};
static std::vector<std::string> unchecked_nodes_new = {"svg"};
static void prettyprint(GumboNode*, NSStringUtils::CStringBuilderA& oBuilder, bool bCheckValidNode = true);
static std::string mhtTohtml(const std::string &sFileContent);
// Заменяет в строке s все символы s1 на s2
static void replace_all(std::string& s, const std::string& s1, const std::string& s2)
@ -34,70 +55,40 @@ static void replace_all(std::string& s, const std::string& s1, const std::string
}
}
static bool IsUnckeckedNodes(const std::string& sValue)
{
return unchecked_nodes_new.end() != std::find(unchecked_nodes_new.begin(), unchecked_nodes_new.end(), sValue);
}
static std::wstring htmlToXhtml(std::string& sFileContent, bool bNeedConvert)
{
// Распознование кодировки
if (bNeedConvert)
{
size_t posEncoding = sFileContent.find("charset=");
if (posEncoding == std::string::npos)
posEncoding = sFileContent.find("encoding=");
if (posEncoding != std::string::npos)
{
posEncoding = sFileContent.find("=", posEncoding) + 1;
char quoteSymbol = '\"';
if(sFileContent[posEncoding] == '\"' || sFileContent[posEncoding] == '\'')
{
quoteSymbol = sFileContent[posEncoding];
posEncoding += 1;
}
{ // Определение кодировки
std::string sEncoding = NSStringFinder::FindPropety(sFileContent, "charset", {"="}, {";", "\\n", "\\r", " ", "\""}).m_sValue;
size_t posEnd = sFileContent.find(quoteSymbol, posEncoding);
if (std::string::npos != posEnd)
{
std::string sEncoding = sFileContent.substr(posEncoding, posEnd - posEncoding);
if (sEncoding != "utf-8" && sEncoding != "UTF-8")
{
NSUnicodeConverter::CUnicodeConverter oConverter;
sFileContent = U_TO_UTF8(oConverter.toUnicode(sFileContent, sEncoding.c_str()));
}
}
if (sEncoding.empty())
sEncoding = NSStringFinder::FindPropety(sFileContent, "encoding", {"="}, {";", "\\n", "\\r", " "}).m_sValue;
if (!sEncoding.empty() && !NSStringFinder::Equals("utf-8", sEncoding))
{
NSUnicodeConverter::CUnicodeConverter oConverter;
sFileContent = U_TO_UTF8(oConverter.toUnicode(sFileContent, sEncoding.c_str()));
}
}
// Избавление от <a/>
size_t posA = sFileContent.find("<a ");
while(posA != std::string::npos)
{
size_t nBegin = sFileContent.find('<', posA + 1);
size_t nEnd = sFileContent.find("/>", posA);
if(nEnd < nBegin)
sFileContent.replace(nEnd, 2, "></a>");
posA = sFileContent.find("<a ", nBegin);
}
// Избавление от <title/>
posA = sFileContent.find("<title/>");
while (posA != std::string::npos)
{
sFileContent.replace(posA, 8, "<title></title>");
posA = sFileContent.find("<title/>", posA);
}
// Избавление от <script/>
posA = sFileContent.find("<script");
while (posA != std::string::npos)
{
size_t nEnd = 0;
size_t nEnd1 = sFileContent.find("/>", posA);
size_t nEnd2 = sFileContent.find("</script>", posA);
if (nEnd1 != std::string::npos)
nEnd = nEnd1 + 2;
if (nEnd2 != std::string::npos && (nEnd == 0 || (nEnd > 0 && nEnd2 < nEnd)))
nEnd = nEnd2 + 9;
// Избавляемся от лишних символов до <...
boost::regex oRegex("<[a-zA-Z]");
boost::match_results<typename std::string::const_iterator> oResult;
sFileContent.erase(posA, nEnd - posA);
if (boost::regex_search(sFileContent, oResult, oRegex))
sFileContent.erase(0, oResult.position());
posA = sFileContent.find("<script", posA);
}
//Избавление от <a ... />
while (NSStringFinder::RemoveEmptyTag(sFileContent, "a"));
//Избавление от <title ... />
while (NSStringFinder::RemoveEmptyTag(sFileContent, "title"));
//Избавление от <script ... />
while (NSStringFinder::RemoveEmptyTag(sFileContent, "script"));
// Gumbo
GumboOptions options = kGumboDefaultOptions;
@ -120,7 +111,7 @@ static std::string Base64ToString(const std::string& sContent, const std::string
if (TRUE == NSBase64::Base64Decode(sContent.c_str(), nSrcLen, pData, &nDecodeLen))
{
std::wstring sConvert;
if(!sCharset.empty() && sCharset != "utf-8" && sCharset != "UTF-8")
if(!sCharset.empty() && NSStringFinder::Equals<std::string>("utf-8", sCharset))
{
NSUnicodeConverter::CUnicodeConverter oConverter;
sConvert = oConverter.toUnicode(reinterpret_cast<char *>(pData), (unsigned)nDecodeLen, sCharset.data());
@ -208,174 +199,125 @@ static std::string QuotedPrintableDecode(const std::string& sContent, std::strin
return sRes.GetData();
}
static void ReadMht(std::string& sFileContent, size_t& nFound, size_t& nNextFound, const std::string& sBoundary,
std::map<std::string, std::string>& sRes, NSStringUtils::CStringBuilderA& oRes)
static void ReadMht(const std::string& sMhtContent, std::map<std::string, std::string>& sRes, NSStringUtils::CStringBuilderA& oRes)
{
// Content
size_t nContentTag = sFileContent.find("\n\n", nFound);
if(nContentTag == std::string::npos || nContentTag > nNextFound)
{
nContentTag = sFileContent.find("\r\r", nFound);
if(nContentTag == std::string::npos || nContentTag > nNextFound)
{
nContentTag = sFileContent.find("\r\n\r\n", nFound);
if(nContentTag == std::string::npos || nContentTag > nNextFound)
{
nFound = nNextFound;
return;
}
else
nContentTag += 4;
}
else
nContentTag += 2;
}
else
nContentTag += 2;
size_t unContentPosition = 0, unCharsetBegin = 0, unCharsetEnd = std::string::npos;
NSStringFinder::TFoundedData<char> oData;
// Content-Type
size_t nTag = sFileContent.find("Content-Type: ", nFound);
if(nTag == std::string::npos || nTag > nContentTag)
oData = NSStringFinder::FindPropety(sMhtContent, "content-type", {":"}, {";", "\\n", "\\r"});
const std::string sContentType{oData.m_sValue};
if (sContentType.empty())
return;
if (NSStringFinder::Equals(sContentType, "multipart/alternative"))
{
nFound = nNextFound;
oRes.WriteString(mhtTohtml(sMhtContent.substr(oData.m_unEndPosition, sMhtContent.length() - oData.m_unEndPosition)));
return;
}
size_t nTagEnd = sFileContent.find_first_of(";\n\r", nTag);
nTag += 14;
if(nTagEnd == std::string::npos || nTagEnd > nContentTag)
{
nFound = nNextFound;
return;
}
std::string sContentType = sFileContent.substr(nTag, nTagEnd - nTag);
if(sContentType == "multipart/alternative")
nContentTag = nFound;
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
unCharsetBegin = oData.m_unEndPosition;
// name
std::string sName;
nTag = sFileContent.find(" name=", nFound);
if(nTag != std::string::npos && nTag < nContentTag)
// std::string sName = NSStringFinder::FindPropety(sMhtContent, "name", {"="}, {";", "\\n", "\\r"}, 0, unLastPosition);
// unContentPosition = std::max(unContentPosition, unLastPosition);
// Content-Location
oData = NSStringFinder::FindPropety(sMhtContent, "content-location", {":"}, {";", "\\n", "\\r"});
std::string sContentLocation{oData.m_sValue};
if (!oData.Empty())
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
// Content-ID
oData = NSStringFinder::FindPropety(sMhtContent, "content-id", {":"}, {";", "\\n", "\\r"});
std::string sContentID{oData.m_sValue};
if (!oData.Empty())
{
nTagEnd = sFileContent.find_first_of(";\n\r", nTag);
nTag += 6;
if(nTagEnd != std::string::npos && nTagEnd < nContentTag)
sName = sFileContent.substr(nTag, nTagEnd - nTag);
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
unCharsetEnd = std::min(unCharsetEnd, oData.m_unBeginPosition);
NSStringFinder::CutInside<std::string>(sContentID, "<", ">");
}
if (sContentLocation.empty() && !sContentID.empty())
sContentLocation = "cid:" + sContentID;
// Content-Transfer-Encoding
oData = NSStringFinder::FindPropety(sMhtContent, "content-transfer-encoding", {":"}, {";", "\\n", "\\r"});
const std::string sContentEncoding{oData.m_sValue};
if (!oData.Empty())
{
unContentPosition = std::max(unContentPosition, oData.m_unEndPosition);
unCharsetEnd = std::min(unCharsetEnd, oData.m_unBeginPosition);
}
// charset
std::string sCharset;
nTag = sFileContent.find("charset=", nFound);
if(nTag != std::string::npos && nTag < nContentTag)
{
nTagEnd = sFileContent.find_first_of(";\n\r", nTag);
nTag += 8;
if(nTagEnd != std::string::npos && nTagEnd < nContentTag)
{
if(sFileContent[nTag] == '\"')
{
nTag++;
nTagEnd--;
}
sCharset = sFileContent.substr(nTag, nTagEnd - nTag);
}
}
std::string sCharset = "utf-8";
// Content-Location
std::string sContentLocation;
nTag = sFileContent.find("Content-Location: ", nFound);
if(nTag != std::string::npos && nTag < nContentTag)
if (std::string::npos != unCharsetEnd && unCharsetBegin < unCharsetEnd)
{
nTagEnd = sFileContent.find_first_of(";\n\r", nTag);
nTag += 18;
if(nTagEnd != std::string::npos && nTagEnd < nContentTag)
sContentLocation = sFileContent.substr(nTag, nTagEnd - nTag);
}
if (sContentLocation.empty())
{
// Content-ID
std::string sContentID;
nTag = sFileContent.find("Content-ID: <", nFound);
if(nTag != std::string::npos && nTag < nContentTag)
{
nTagEnd = sFileContent.find_first_of(">", nTag);
nTag += 13;
if(nTagEnd != std::string::npos && nTagEnd < nContentTag)
sContentID = sFileContent.substr(nTag, nTagEnd - nTag);
}
if (!sContentID.empty())
sContentLocation = "cid:" + sContentID;
}
// Content-Transfer-Encoding
std::string sContentEncoding;
nTag = sFileContent.find("Content-Transfer-Encoding: ", nFound);
if(nTag != std::string::npos && nTag < nContentTag)
{
nTagEnd = sFileContent.find_first_of(";\n\r", nTag);
nTag += 27;
if(nTagEnd != std::string::npos && nTagEnd < nContentTag)
sContentEncoding = sFileContent.substr(nTag, nTagEnd - nTag);
sCharset = NSStringFinder::FindPropety(sMhtContent.substr(unCharsetBegin, unCharsetEnd - unCharsetBegin), "charset", {"="}, {";", "\\n", "\\r"}).m_sValue;
NSStringFinder::CutInside<std::string>(sCharset, "\"");
}
// Content
nTagEnd = nNextFound - 2;
if(nTagEnd == std::string::npos || nTagEnd < nContentTag)
{
nFound = nNextFound;
return;
}
std::string sContent = sFileContent.substr(nContentTag, nTagEnd - nContentTag);
std::string sContent = sMhtContent.substr(unContentPosition, sMhtContent.length() - unContentPosition);
// Удаляем лишнее
sFileContent.erase(0, nNextFound);
nFound = sFileContent.find(sBoundary);
std::wstring sExtention = NSFile::GetFileExtention(UTF8_TO_U(sName));
std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
// std::wstring sExtention = NSFile::GetFileExtention(UTF8_TO_U(sName));
// std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
// Основной документ
if(sContentType == "multipart/alternative")
if (NSStringFinder::Equals(sContentType, "multipart/alternative"))
oRes.WriteString(mhtTohtml(sContent));
else if((sContentType.find("text") != std::string::npos && (sExtention.empty() || sExtention == L"htm" || sExtention == L"html" || sExtention
== L"xhtml" || sExtention == L"css")) || (sContentType == "application/octet-stream" && (sContentLocation.find("css") !=
std::string::npos)))
else if ((NSStringFinder::Find(sContentType, "text") /*&& (sExtention.empty() || NSStringFinder::EqualOf(sExtention, {L"htm", L"html", L"xhtml", L"css"}))*/)
|| (NSStringFinder::Equals(sContentType, "application/octet-stream") && NSStringFinder::Find(sContentLocation, "css")))
{
// Стили заключаются в тэг <style>
if(sContentType == "text/css" || sExtention == L"css" || sContentLocation.find("css") != std::string::npos)
const bool bAddTagStyle = NSStringFinder::Equals(sContentType, "text/css") /*|| NSStringFinder::Equals(sExtention, L"css")*/ || NSStringFinder::Find(sContentLocation, "css");
if (bAddTagStyle)
oRes.WriteString("<style>");
if(sContentEncoding == "Base64" || sContentEncoding == "base64")
oRes.WriteString(Base64ToString(sContent, sCharset));
else if(sContentEncoding == "8bit" || sContentEncoding == "7bit" || sContentEncoding.empty())
if (NSStringFinder::Equals(sContentEncoding, "base64"))
sContent = Base64ToString(sContent, sCharset);
else if (NSStringFinder::EqualOf(sContentEncoding, {"8bit", "7bit"}) || sContentEncoding.empty())
{
if (sCharset != "utf-8" && sCharset != "UTF-8" && !sCharset.empty())
if (!NSStringFinder::Equals(sCharset, "utf-8") && !sCharset.empty())
{
NSUnicodeConverter::CUnicodeConverter oConverter;
sContent = U_TO_UTF8(oConverter.toUnicode(sContent, sCharset.data()));
}
oRes.WriteString(sContent);
}
else if(sContentEncoding == "quoted-printable" || sContentEncoding == "Quoted-Printable")
else if (NSStringFinder::Equals(sContentEncoding, "quoted-printable"))
{
sContent = QuotedPrintableDecode(sContent, sCharset);
if (sCharset != "utf-8" && sCharset != "UTF-8" && !sCharset.empty())
if (!NSStringFinder::Equals(sCharset, "utf-8") && !sCharset.empty())
{
NSUnicodeConverter::CUnicodeConverter oConverter;
sContent = U_TO_UTF8(oConverter.toUnicode(sContent, sCharset.data()));
}
oRes.WriteString(sContent);
}
if(sContentType == "text/css" || sExtention == L"css" || sContentLocation.find("css") != std::string::npos)
if (NSStringFinder::Equals(sContentType, "text/html"))
sContent = U_TO_UTF8(htmlToXhtml(sContent, false));
oRes.WriteString(sContent);
if(bAddTagStyle)
oRes.WriteString("</style>");
}
// Картинки
else if((sContentType.find("image") != std::string::npos || sExtention == L"gif" || sContentType == "application/octet-stream") &&
(sContentEncoding == "Base64" || sContentEncoding == "base64"))
else if ((NSStringFinder::Find(sContentType, "image") /*|| NSStringFinder::Equals(sExtention, L"gif")*/ || NSStringFinder::Equals(sContentType, "application/octet-stream")) &&
NSStringFinder::Equals(sContentEncoding, "base64"))
{
if(sExtention == L"ico" || sContentType.find("ico") != std::string::npos)
sContentType = "image/jpg";
else if(sExtention == L"gif")
sContentType = "image/gif";
// if (NSStringFinder::Equals(sExtention, L"ico") || NSStringFinder::Find(sContentType, "ico"))
// sContentType = "image/jpg";
// else if(NSStringFinder::Equals(sExtention, L"gif"))
// sContentType = "image/gif";
int nSrcLen = (int)sContent.length();
int nDecodeLen = NSBase64::Base64DecodeGetRequiredLength(nSrcLen);
BYTE* pData = new BYTE[nDecodeLen];
@ -385,50 +327,46 @@ static void ReadMht(std::string& sFileContent, size_t& nFound, size_t& nNextFoun
}
}
static std::string mhtTohtml(std::string& sFileContent)
static std::string mhtTohtml(const std::string& sFileContent)
{
std::map<std::string, std::string> sRes;
NSStringUtils::CStringBuilderA oRes;
// Поиск boundary
size_t nFound = sFileContent.find("boundary=");
if(nFound == std::string::npos)
NSStringFinder::TFoundedData<char> oData{NSStringFinder::FindPropety(sFileContent, "boundary", {"="}, {"\\r", "\\n", "\""})};
size_t nFound{oData.m_unEndPosition};
std::string sBoundary{oData.m_sValue};
if (sBoundary.empty())
{
size_t nFoundEnd = sFileContent.length();
nFound = 0;
ReadMht(sFileContent, nFound, nFoundEnd, "no", sRes, oRes);
ReadMht(sFileContent.substr(nFound, nFoundEnd), sRes, oRes);
return oRes.GetData();
}
size_t nFoundEnd = sFileContent.find_first_of(";\n\r", nFound);
if(nFoundEnd == std::string::npos)
return "";
nFound += 9;
if(sFileContent[nFound] == '\"')
{
nFound++;
nFoundEnd--;
}
if(nFound > nFoundEnd)
return "";
std::string sBoundary = sFileContent.substr(nFound, nFoundEnd - nFound);
NSStringFinder::CutInside<std::string>(sBoundary, "\"");
size_t nFoundEnd{nFound};
sBoundary = "--" + sBoundary;
size_t nBoundaryLength = sBoundary.length();
// Удаляем лишнее
nFound = sFileContent.find(sBoundary, nFoundEnd);
sFileContent.erase(0, nFound);
nFound = sFileContent.find(sBoundary, nFound) + nBoundaryLength;
// Цикл по boundary
nFound = 0;
while(nFound != std::string::npos)
{
// Выход по --boundary--
if(sFileContent[nFound + nBoundaryLength + 1] == '-')
break;
nFoundEnd = sFileContent.find(sBoundary, nFound + nBoundaryLength);
if(nFoundEnd == std::string::npos)
break;
ReadMht(sFileContent, nFound, nFoundEnd, sBoundary, sRes, oRes);
ReadMht(sFileContent.substr(nFound, nFoundEnd - nFound), sRes, oRes);
nFound = sFileContent.find(sBoundary, nFoundEnd);
}
std::string sFile = oRes.GetData();
for(const std::pair<std::string, std::string>& item : sRes)
{
@ -440,10 +378,18 @@ static std::string mhtTohtml(std::string& sFileContent)
while(found != std::string::npos)
{
size_t fq = sFile.find_last_of("\"\'>=", found);
if (std::string::npos == fq)
break;
char ch = sFile[fq];
if(ch != '\"' && ch != '\'')
fq++;
size_t tq = sFile.find_first_of("\"\'<> ", found) + 1;
if (std::string::npos == tq)
break;
if(sFile[tq] != '\"' && sFile[tq] != '\'')
tq--;
if(ch != '>')
@ -456,6 +402,7 @@ static std::string mhtTohtml(std::string& sFileContent)
found = sFile.find(sName, tq);
}
}
return sFile;
}
@ -587,7 +534,7 @@ static void build_attributes(const GumboVector* attribs, bool no_entities, NSStr
}
}
static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA& contents)
static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA& contents, bool bCheckValidNode)
{
std::string key = "|" + get_tag_name(node) + "|";
bool no_entity_substitution = no_entity_sub.find(key) != std::string::npos;
@ -618,7 +565,7 @@ static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA
contents.WriteString(val);
}
else if ((child->type == GUMBO_NODE_ELEMENT) || (child->type == GUMBO_NODE_TEMPLATE))
prettyprint(child, contents);
prettyprint(child, contents, bCheckValidNode);
else if (child->type == GUMBO_NODE_WHITESPACE)
{
if (keep_whitespace || is_inline || is_like_inline)
@ -633,23 +580,33 @@ static void prettyprint_contents(GumboNode* node, NSStringUtils::CStringBuilderA
}
}
static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder)
static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilder, bool bCheckValidNode)
{
// special case the document node
if (node->type == GUMBO_NODE_DOCUMENT)
{
build_doctype(node, oBuilder);
prettyprint_contents(node, oBuilder);
prettyprint_contents(node, oBuilder, bCheckValidNode);
return;
}
std::string tagname = get_tag_name(node);
if (bCheckValidNode)
bCheckValidNode = !IsUnckeckedNodes(tagname);
if (bCheckValidNode && html_tags.end() == std::find(html_tags.begin(), html_tags.end(), tagname))
{
prettyprint_contents(node, oBuilder, bCheckValidNode);
return;
}
std::string close = "";
std::string closeTag = "";
std::string tagname = get_tag_name(node);
std::string key = "|" + tagname + "|";
bool is_empty_tag = empty_tags.find(key) != std::string::npos;
bool no_entity_substitution = no_entity_sub.find(key) != std::string::npos;
// determine closing tag type
if (is_empty_tag)
close = "/";
@ -665,7 +622,7 @@ static void prettyprint(GumboNode* node, NSStringUtils::CStringBuilderA& oBuilde
oBuilder.WriteString(close + ">");
// prettyprint your contents
prettyprint_contents(node, oBuilder);
prettyprint_contents(node, oBuilder, bCheckValidNode);
oBuilder.WriteString(closeTag);
}

View File

@ -33,6 +33,7 @@
#include "../../../../Common/3dParty/hunspell/hunspell/src/hunspell/hunspell.h"
#include "../../../../DesktopEditor/common/StringExt.h"
#include "../../../../DesktopEditor/common/Directory.h"
#include <iostream>
bool CheckCaret(std::vector<std::wstring>& words)
{
@ -85,11 +86,36 @@ std::wstring CheckWord(Hunhandle* pDic, const std::wstring& sWord, const bool& b
return sResult;
}
#if defined(_WIN32) || defined(_WIN64)
#define USE_WCHAR_ARGC
#endif
#ifdef USE_WCHAR_ARGC
std::wstring GetParam(wchar_t* arg)
{
return std::wstring(arg);
}
#else
std::wstring GetParam(char* arg)
{
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE *)arg, (LONG)strlen(arg));
}
#endif
#ifdef USE_WCHAR_ARGC
int wmain(int argc, wchar_t *argv[])
#else
int main(int argc, char *argv[])
#endif
{
std::wstring sSrcDir = NSFile::GetProcessDirectory() + L"/../src";
std::wstring sDstDir = NSFile::GetProcessDirectory() + L"/../dst";
std::wstring sDictionariesDir = NSFile::GetProcessDirectory() + L"/../../../../../../dictionaries";
if (argc > 1) sSrcDir = GetParam(argv[1]);
if (argc > 2) sDstDir = GetParam(argv[2]);
if (argc > 3) sDictionariesDir = GetParam(argv[3]);
std::vector<std::wstring> arSrcFiles = NSDirectory::GetFiles(sSrcDir);
for (int i = 0, len = (int)arSrcFiles.size(); i < len; ++i)
@ -125,6 +151,8 @@ int main(int argc, char *argv[])
Hunspell_destroy(pDictionary);
NSFile::CFileBinary::SaveToFile(sFileDst, sResult, true);
std::cout << "[" << (i + 1) << " of " << (int)arSrcFiles.size() << "] " << U_TO_UTF8(sName) << std::endl;
}
return 0;

View File

@ -6,7 +6,7 @@
QT -= core gui
TARGET = test
TARGET = dictionariestester
CONFIG += console
CONFIG -= app_bundle
@ -22,8 +22,7 @@ include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
ADD_DEPENDENCY(UnicodeConverter kernel hunspell)
core_windows:LIBS += -lgdi32 -ladvapi32 -luser32 -lshell32
core_linux:LIBS += -lz
SOURCES += main.cpp
DESTDIR = $$PWD/build
DESTDIR = $$CORE_BUILDS_BINARY_PATH

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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