Compare commits

..

677 Commits

Author SHA1 Message Date
187bf8823a x2t - version up 2018-06-21 11:28:58 +03:00
cd7c85967c Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-21 11:19:45 +03:00
045b00ad5a x2t - version up 2018-06-21 11:17:42 +03:00
9b5784e344 . 2018-06-20 19:37:32 +03:00
2b6650dde1 Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-20 18:56:53 +03:00
ff8ecb2d2f RtfFormat - fix users files 2018-06-20 18:54:06 +03:00
5893b93e3a XlsFormatFile - fix users files 2018-06-19 13:48:57 +03:00
92313e106d OdfReader - .. bibliography sources 2018-06-18 19:30:06 +03:00
c462f522d6 x2t - fix bugs #37945, #37946 2018-06-18 15:57:38 +03:00
5feb4b7b82 [x2t] Revert toXML2 2018-06-18 15:37:18 +03:00
678ec98721 . 2018-06-18 13:34:40 +03:00
c17fa8462d x2t - add document ID for crypt ooxml 2018-06-18 13:24:59 +03:00
04eda04870 Add StopNoJoin method to BaseThread 2018-06-15 11:46:21 +03:00
cd9cc22185 OdfReader - convert bibliography 2018-06-09 19:03:22 +03:00
f01eb91316 * [x2t] Add to/from binary conversion for LvlLegacy 2018-06-09 16:58:29 +03:00
b9216e9bdc OdfFormatReader - convert tables of indexes 2018-06-08 19:20:18 +03:00
0295ef2d54 RtfFormatReader - fix bug #37902 2018-06-07 18:01:45 +03:00
797b745b35 [s2t] Fix open file with unknown picture format
As result, different file names were obtained in binary and file system
2018-06-07 14:42:45 +03:00
253c24cf03 [x2t] Fix bug #36574 2018-06-07 14:31:14 +03:00
02e8649a61 . 2018-06-06 19:32:16 +03:00
447dc81426 [ios][x2t] enable txt format 2018-06-06 16:02:57 +03:00
0f3c883d24 . 2018-06-06 15:24:54 +03:00
0b16b9a7f9 . 2018-06-05 19:35:00 +03:00
37c276b736 [x2t] Fix bug #37892 2018-06-04 18:46:13 +03:00
7014faa9a1 . 2018-06-04 15:27:48 +03:00
93287c84c8 OdfFormatReader - meta data file, new convert tabs stop 2018-06-04 15:24:49 +03:00
dafcbacfaf [ios][x2t] add version property 2018-06-04 13:48:09 +03:00
41ea42459a . 2018-06-01 19:23:56 +03:00
bc68323506 . 2018-06-01 19:20:35 +03:00
1c73ff0c3f Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-01 18:18:31 +03:00
5a8c9069be OdfFormatReader - fix users file 2018-06-01 18:17:56 +03:00
4ba2e1fa6d x2t - split version info in separate file 2018-06-01 16:11:13 +03:00
95af281145 x2t - write embedded ms package with zero offsets 2018-05-31 17:29:44 +03:00
00fb2ba7bb [ios][x2t] update converter 2018-05-31 14:44:14 +03:00
0f65e36517 Merge branch 'feature/graphics' into develop 2018-05-31 11:39:29 +03:00
aa1af73fda x2t version up 2018-05-30 19:20:18 +03:00
1610978821 [ios][se][pe] fixed build 2018-05-30 18:08:43 +03:00
20faf24556 RtfFormatWriter - add comments (fix bug #37807) 2018-05-30 16:37:41 +03:00
ae90e4ae96 Merge pull request #87 from ONLYOFFICE/feature/onlypass
Feature/onlypass
2018-05-30 13:58:42 +03:00
6fae9115ea Merge branch 'hotfix/v5.1.5' into feature/onlypass 2018-05-30 13:58:29 +03:00
c14a21b2da Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-05-30 13:21:14 +03:00
b952692225 . 2018-05-30 12:50:50 +03:00
23249e69f9 . 2018-05-29 19:53:13 +03:00
09f6c3f4e8 . 2018-05-29 19:03:58 +03:00
111ceff368 [ios][x2t] update converter 2018-05-29 18:55:18 +03:00
867b0634f3 Fix bug #36423
Fix problem with the clip in the EMF
2018-05-29 18:33:49 +03:00
f9c27275a7 . 2018-05-29 17:01:34 +03:00
dd12ee0b9e Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-05-29 16:24:03 +03:00
de83971832 [x2t] Fix dependence of docx comments with empty text 2018-05-29 16:01:50 +03:00
0d158e46b5 OdfFormatWriter - extending number formats 2018-05-29 16:03:08 +03:00
dde6b8bdc7 . 2018-05-29 14:15:32 +03:00
b66bb0d63f RtfFormatReader - add commetns 2018-05-29 14:14:33 +03:00
d666da2697 OdfFormatReader - fix bug #37832 2018-05-28 13:35:45 +03:00
8e35f9b063 [ios][x2t] fixed build 2018-05-25 12:25:37 +03:00
25268b706d OdfFormatreader - content of illustrations 2018-05-24 18:40:01 +03:00
97ff1efba8 XlsFormat -fix issue 308 2018-05-24 17:52:21 +03:00
1879ce8dbb v5.1.4 2018-05-24 15:34:46 +03:00
50ff5fc0b2 v5.1.4 2018-05-24 15:32:34 +03:00
537e774f79 . 2018-05-24 15:08:20 +03:00
6d3761c20b XlsFormatReader - fix arrow 2018-05-24 12:18:43 +03:00
ee41b4ccb2 [x2t] Replace XmlUtils::CStringWriter with NSStringUtils::CStringBuilder 2018-05-24 12:00:53 +03:00
7b0f902c0f [x2t] Turn on DeleteNoUnicode option for bug #37789 2018-05-23 20:32:03 +03:00
e6039f7f6f OdfFormatReader - convert table content to sdt table content 2018-05-23 19:28:29 +03:00
1c2b86519e [bug] Fix bug 37565 2018-05-23 16:38:24 +03:00
755119c825 fix bug #35107 2018-05-23 15:24:40 +03:00
3a73480437 fix bug #37537 2018-05-23 14:51:05 +03:00
323d1b44cd openssl 2018-05-23 13:36:26 +03:00
a99a195c68 OdfFormatReader - convert form elements aka field elements (in editor visualization is worse) 2018-05-22 17:43:30 +03:00
0d979b8033 OdfFormatReader - convert form elements aka sdt elements 2018-05-22 16:23:42 +03:00
dd3b671e57 . 2018-05-21 19:47:31 +03:00
74bd059607 OdfFormatReader - forms, controls 2018-05-21 19:46:56 +03:00
83fa44edcd Use system libcurl 2018-05-21 18:12:06 +03:00
80fe4c0164 Add dependency for pdfwriter project 2018-05-21 13:35:32 +03:00
04f7527f9e OdfFormatReader - restore xlsx table chart from cache - bug #37705 2018-05-19 16:34:14 +03:00
d92aa1f793 [x2t] Add lvlOverride to binary 2018-05-18 20:21:51 +03:00
af4e135fe2 . 2018-05-18 16:22:44 +03:00
a5ef8c01b3 PdfWriter - encrypt in AES256 2018-05-18 15:28:31 +03:00
1b7f35b317 . 2018-05-18 11:22:56 +03:00
4079dea224 [bug] builder crash 2018-05-17 16:56:10 +03:00
2ead42a513 Build on linux 2018-05-17 15:32:23 +03:00
427046cb8f Fix build on mac 2018-05-17 12:14:12 +03:00
f4c112d523 Merge pull request #84 from ONLYOFFICE/feature/remove_function_pointers
Feature/remove function pointers
2018-05-16 20:37:14 +03:00
b082ffe20c PdfReader - decrypt files revision 6(fix bug #17002) 2018-05-16 18:24:41 +03:00
c589a6c947 [x2t] Remove name collision in READ1_DEF, READ2_DEF, READ_TABLE_DEF. For Bug #36436 2018-05-16 16:41:05 +03:00
e60cc05b6e Downgrade icu to v58.2
ICU58 is the last version that works on Windows XP and Windows Vista.
2018-05-16 12:20:15 +03:00
15b08aeebf [x2t] Remove function pointers at CComment. For Bug #36436 2018-05-15 17:52:29 +03:00
672129c242 [x2t] Remove function pointers at Binary_CommonReader.ReadTable. For Bug #36436 2018-05-15 17:52:29 +03:00
92689a7a57 [x2t] Remove function pointers at Binary_CommonReader.Read1. For Bug #36436 2018-05-15 17:52:28 +03:00
31ebd7b14c [x2t] Remove function pointers at Binary_CommonReader.Read2. For Bug #36436 2018-05-15 17:52:28 +03:00
1695668a6f [x2t] Remove function pointers at Binary_CommonReader.ReadTable. For Bug #36436 2018-05-15 17:52:27 +03:00
77dfd5c12a [x2t] Remove function pointers at Binary_CommonReader.Read2. For Bug #36436 2018-05-15 17:52:27 +03:00
e600fe93b7 [x2t] Remove function pointers at Binary_CommonReader.Read1. For Bug #36436 2018-05-15 17:52:27 +03:00
889a1f827a Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop 2018-05-15 16:48:11 +03:00
8cd55fb9c4 OdfFormatReader - fix bug #37746 2018-05-15 16:47:14 +03:00
01b9309f09 x2t - fix bug #37740 2018-05-15 13:39:22 +03:00
d3a4f00f76 Add curl source to gitignore 2018-05-11 19:45:49 +03:00
f65196d95b Revert wrong merge 2018-05-11 19:07:10 +03:00
3ee5d685c2 Fix build error 2018-05-11 18:32:51 +03:00
c0cd75dbd5 Move curl.pri to kernel.pro 2018-05-11 18:05:24 +03:00
a69453af4b Merge branch 'hotfix/v5.1.4' into develop 2018-05-11 17:36:59 +03:00
3adcfecfb9 Bug with draw combo fonts 2018-05-10 20:11:04 +03:00
a7d2191649 Add static libcurl (#81) 2018-05-10 19:23:59 +03:00
db50e87fe0 [x2t] Add customStyle style property to binary 2018-05-10 18:10:01 +03:00
36bdc7376a Change lib name 2018-05-10 14:24:16 +03:00
1321211336 . 2018-05-10 14:06:57 +03:00
8c834c5041 Remove curl 2018-05-10 12:41:47 +03:00
c75aacaed8 Add cryptopp project 2018-05-10 12:04:44 +03:00
a4445cacaa PdfReader builds (windows) 2018-05-10 09:43:34 +03:00
d6ad9e84e2 Export CorrentPathW function in kernel library 2018-05-10 09:11:23 +03:00
d9687387f9 PdfReader - decrypt files (up to rev.5) 2018-05-08 18:44:57 +03:00
eaa01c7995 Merge remote-tracking branch 'origin/feature/static-libcurl' into develop 2018-05-08 13:00:39 +03:00
597f360336 . 2018-05-08 13:00:17 +03:00
d502206726 Add static libcurl 2018-05-08 12:18:15 +03:00
d0d90c641c Add building static libcurl 2018-05-08 10:59:50 +03:00
14fa14de3f RtfFormatReader - fix bug 37500 2018-05-07 19:26:38 +03:00
cced8f4912 x2t - fix bug 37670 2018-05-07 17:32:35 +03:00
2e40b96ed9 . 2018-05-05 13:17:39 +03:00
50ee7d7cc1 x2t - fix linux build 2018-05-04 17:44:23 +03:00
f9b54bffd4 Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop
# Conflicts:
#	DesktopEditor/common/Directory.h
#	DesktopEditor/common/File.h
2018-05-04 16:12:30 +03:00
a52a8e982e Merge pull request #80 from ONLYOFFICE/feature/desktop(5.1.3+)
Feature/desktop(5.1.3+)
2018-05-04 13:53:59 +03:00
128529ba80 x2t - from https://github.com/ONLYOFFICE/core/pull/65. 2018-05-03 19:44:09 +03:00
a571c88798 PdfReader - test project, fix image renderer 2018-05-03 18:12:51 +03:00
34bb84a792 [ios][x2t] fixed build 2018-05-03 16:50:50 +03:00
92d0d0d7ea . 2018-05-03 16:39:24 +03:00
449e3fc131 . 2018-05-03 16:18:33 +03:00
ce9fdb33b5 OdfFormatWriter - encrypted 2018-05-03 16:11:49 +03:00
2591f0a202 x2t - update crypto++ 2018-05-03 12:36:33 +03:00
6bc04fc06f . 2018-04-30 15:33:58 +03:00
047850dbd6 OdfFormatWriter - encryption 2018-04-29 17:22:44 +03:00
465b903ec5 Remove inline methods 2018-04-28 17:48:38 +03:00
6afa54ebef x2t - fix users files 2018-04-28 17:04:49 +03:00
27a0e77ef1 [bugs] Crypto bugs 2018-04-28 15:08:38 +03:00
c7b45910f8 . 2018-04-28 13:31:44 +03:00
ab1abb96fe [ios][x2t] fixed build 2018-04-28 12:09:15 +03:00
566d9e68e4 OdfFormatReader - decrypt 2018-04-27 20:23:32 +03:00
243b8eccdd [ios][x2t] fixed build 2018-04-27 19:55:37 +03:00
76b682063e x2t - save comments for presentation (undelete ms office) 2018-04-27 19:11:58 +03:00
effdab1ff4 Add not sha1 algorithms to sign/verify providers 2018-04-27 19:01:51 +03:00
658040f77b [ios][x2t] up test project 2018-04-27 18:01:47 +03:00
48aa99af83 Merge pull request #79 from ONLYOFFICE/feature/konovalovsergey-patch-1
[x2t] Bump compatibilityMode setting
2018-04-27 17:42:09 +03:00
a1b738fc42 Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop 2018-04-27 16:28:03 +03:00
00e9ce56df x2t - fix bug 37579 & bug 37589 2018-04-27 16:00:25 +03:00
2a4ce1f93f x2t - decrtypt Open Office Document 2018-04-27 15:42:25 +03:00
261e48227d Bugs 2018-04-26 18:29:39 +03:00
29e3f90ebf v5.1.3 2018-04-26 18:23:51 +03:00
d4a70d306f x2t - fix bug 37589 2018-04-26 18:15:11 +03:00
b9b843f25d Windows: add long file names support (x2t) 2018-04-26 13:45:02 +03:00
d7e2bedc6b Openssl errors 2018-04-25 16:51:10 +03:00
234459f37c x2t - fix bug 37579 2018-04-25 12:21:46 +03:00
58cd45f4ee [x2t] Bump compatibilityMode setting
Prevent opening files in compatibility mode in Word 2016.
2018-04-24 18:52:25 +03:00
33f7ee49df Bugs 2018-04-24 17:45:58 +03:00
e7ed48af49 . 2018-04-24 13:02:29 +03:00
cbd79c902e Merge branch 'origin/hotfix/v5.1.3' into develop 2018-04-24 12:03:39 +03:00
40c24b1577 . 2018-04-24 11:48:35 +03:00
95a49140cb Windows: add long file names support 2018-04-23 17:17:19 +03:00
aad12cf471 New scheme for openssl certificate selection 2018-04-23 17:17:19 +03:00
f0ffb7f14c x2t fix after testing (#76) 2018-04-20 18:46:45 +03:00
da329135e1 . 2018-04-20 16:40:19 +03:00
60ca9a2347 [ios][x2t] fixed build 2018-04-20 16:24:24 +03:00
5fdace28d2 Merge remote-tracking branch 'origin/hotfix/v5.1.3' into develop 2018-04-20 13:38:36 +03:00
85549c5b20 . 2018-04-20 13:35:30 +03:00
4c8bc2227a x2t - fix after testing (#75) 2018-04-20 12:05:39 +03:00
23ca735f23 Add not used String::format 2018-04-20 11:19:07 +03:00
4acefb020f Remove not required defines 2018-04-19 17:50:31 +03:00
684d697cae Remove xml2, agg, freestyle include folders from projects 2018-04-19 16:37:04 +03:00
1aa604c584 Remove dll-based projects from solution 2018-04-19 16:21:11 +03:00
51569b626f Fix build on macOS 2018-04-19 16:10:29 +03:00
89d7eb559d Switch to X2tSLN dependency 2018-04-19 15:30:06 +03:00
f6b3a78fe8 . 2018-04-19 15:16:16 +03:00
1900e2f0a0 . 2018-04-19 15:08:19 +03:00
d0e1785086 . 2018-04-19 14:47:58 +03:00
221d1ecbb5 x2t - fix test projects 2018-04-19 14:20:49 +03:00
2fc3b140d0 Fix build on macOS 2018-04-19 14:02:40 +03:00
bdb2ca8241 Merge remote-tracking branch 'origin/feature/core_dll' into develop 2018-04-19 13:20:07 +03:00
4055201322 . 2018-04-19 13:17:24 +03:00
5b305ec75d Correct previous commit 2018-04-19 12:00:24 +03:00
433686c01f Fix linux builds error 2018-04-19 11:59:40 +03:00
ccfc921883 x2t linux build 2018-04-19 10:08:08 +03:00
6b0d6fe890 AllFontsGen builds 2018-04-18 18:39:00 +03:00
5ae20c58ed Remove unused project 2018-04-18 18:16:33 +03:00
7b45fb8931 x2t worked version 2018-04-18 18:05:59 +03:00
d0ffc6f555 x2t 2018-04-18 17:39:28 +03:00
54e5bb8419 Remove OfficeUtils project 2018-04-18 17:28:01 +03:00
f7bb1766c0 Update project dependency 2018-04-18 17:02:08 +03:00
f0bb87ba14 . 2018-04-18 13:40:13 +03:00
a484dc1fd7 . 2018-04-18 13:27:33 +03:00
19cc78060c x2t builds 2018-04-18 13:16:10 +03:00
2682eda9c6 x2t builds (not complete) 2018-04-18 12:42:54 +03:00
8d750adb7b x2t (not complete) 2018-04-17 19:10:48 +03:00
c517b3ac19 fix 5.1.3 after used icu6 (#73) 2018-04-17 13:59:21 +03:00
f57b28cd24 PdfReader builds 2018-04-17 13:40:11 +03:00
b8215e9e82 Merge remote-tracking branch 'origin/hotfix/v5.1.3' into develop 2018-04-17 13:09:27 +03:00
f6305fca21 DocFormatReader - fix user file (table in table) 2018-04-17 12:50:15 +03:00
4cb984684d HtmlFile builds 2018-04-17 12:06:02 +03:00
903d903aad doctrenderer builds 2018-04-17 11:59:12 +03:00
fe53ae9b11 XpsFile builds 2018-04-17 11:27:14 +03:00
8ca218d600 PdfWriter & DjvuFile builds 2018-04-17 11:00:32 +03:00
87a9542fc7 [ios][x2t] support csv 2018-04-16 18:45:21 +03:00
48a1f01220 DocFormatReader- fix users file (table) (#71) 2018-04-16 17:59:44 +03:00
8a2923e534 Use only major version for icu numbering 2018-04-16 17:10:55 +03:00
0ab7e55add Recover icu paths for windows 2018-04-16 17:10:55 +03:00
cb1cb43a0b Fix the target chosing 2018-04-16 17:10:55 +03:00
0ca3432d05 Add icu installation to local folder on linux 2018-04-16 17:10:55 +03:00
50208be48d Add icu building from source on linux 2018-04-16 17:10:55 +03:00
c796f4a0f6 . 2018-04-16 17:10:55 +03:00
618da3c8cc UnicodeConverter - fix build with icu 6.0 win32&win64 2018-04-16 17:10:55 +03:00
9b4568e81a Restore icu version 2018-04-16 17:10:55 +03:00
752acf1e46 Refactore fetching icu 2018-04-16 17:10:55 +03:00
d9afc49bb3 Change devenv to msbuild 2018-04-16 17:10:55 +03:00
4c6ba8ed41 Add icu building from source code on windows 2018-04-16 17:10:55 +03:00
a0b32c1523 21 2018-04-16 16:49:30 +03:00
a2cc70233e remove cximage from PdfWriter 2018-04-16 16:43:34 +03:00
42c35a9803 20 2018-04-16 15:02:52 +03:00
a395420d59 DocFormatReader - fix user file(table) 2018-04-16 14:50:51 +03:00
c4ca4b5613 x2t - fix linux build 2018-04-16 14:46:22 +03:00
8100a2860f 19 2018-04-16 14:14:31 +03:00
dd83971001 Use only major version for icu numbering (#69) 2018-04-16 12:43:07 +03:00
c4abf6d149 18 2018-04-16 12:32:59 +03:00
c749cbf081 17 2018-04-16 10:14:24 +03:00
c7accf4370 16 2018-04-16 09:26:46 +03:00
b49e43c4cb [x2t] Fix bug 37146 2018-04-13 20:17:13 +03:00
322bc72ad1 15 2018-04-13 19:00:52 +03:00
33bf2df39d 14 2018-04-13 18:32:17 +03:00
aa344408b0 14 2018-04-13 18:25:55 +03:00
2a5d29c874 13 2018-04-13 18:09:02 +03:00
50ae01723c OdfFormatWriter - fix paragraph shading 2018-04-13 18:08:24 +03:00
c05ea1bd21 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-04-13 10:26:37 +03:00
887905570a OdfFormatReader - read crypted files and decrypt it (template only) 2018-04-13 10:26:13 +03:00
ce76a7b075 [ios][x3t] support csv 2018-04-12 17:12:02 +03:00
6dda731502 PptFormatReader - fix after testing 2018-04-12 13:05:42 +03:00
3e9e70655c 12 2018-04-12 11:59:58 +03:00
ed9a6e7e5c 13 2018-04-11 18:53:29 +03:00
284b04574a 12 2018-04-11 18:21:02 +03:00
67eb5ac139 11 2018-04-11 17:41:48 +03:00
563014f8d7 10 2018-04-11 17:29:54 +03:00
290d845d7a 9 2018-04-11 17:20:13 +03:00
935e9396af 8 2018-04-11 15:17:28 +03:00
4de2649dcd 8 2018-04-11 15:07:12 +03:00
a8bcd38bce v5.1.2 2018-04-11 14:26:30 +03:00
46bc4e5e96 7 2018-04-11 14:26:29 +03:00
56475b7e8a 6 2018-04-11 14:14:02 +03:00
69a69d9fc2 5 2018-04-11 14:06:59 +03:00
b470120075 x2t version 2.4.531 2018-04-11 11:59:36 +03:00
7d2f96d284 4 2018-04-11 11:51:43 +03:00
0de5fb6bfc x2t - extended convert by UnicodeConverter 2018-04-10 19:58:48 +03:00
e753476826 3 2018-04-10 19:01:28 +03:00
983873d010 2 2018-04-10 18:53:17 +03:00
af037642dd 1 2018-04-10 18:24:49 +03:00
68122490bf . 2018-04-10 16:28:14 +03:00
4833c652d8 x2t version 2.4.520 2018-04-10 16:01:13 +03:00
af0e9be136 PptFormatReader - new converting group shapes 2018-04-10 15:02:31 +03:00
d987233335 Merge pull request #67 from ONLYOFFICE/feature/icu60
Feature/icu60
2018-04-09 18:38:50 +03:00
5f100d4ea0 [ios][x2t] icu fixed 2018-04-09 17:49:56 +03:00
d4e34e244f [ios][x2t] remove warnings 2018-04-09 14:20:56 +03:00
4b8bc2c8e7 OoxmlFormat - convert border in vml shape 2018-04-06 14:19:58 +03:00
b04f44ee2c [ios][x2t] icu fixed 2018-04-06 13:24:37 +03:00
fb3b6aff47 . 2018-04-06 12:59:54 +03:00
531460e37d Merge remote-tracking branch 'origin/hotfix/v5.1.2' into develop 2018-04-06 11:47:42 +03:00
09407b08ba UnicodeConverter - restore icu 55.1 builds for iMac 2018-04-06 11:40:57 +03:00
83bc1b18b6 fix RtfFileReader for iMac 2018-04-05 19:49:20 +03:00
56279f7465 Merge remote-tracking branch 'origin/hotfix/v5.1.2' into develop 2018-04-05 19:05:56 +03:00
566eeb06ae x2t version 2.4.526 2018-04-05 19:03:28 +03:00
7dc6d70b8a Merge remote-tracking branch 'origin/hotfix/v5.1.2' into develop 2018-04-05 18:28:00 +03:00
f5c359650f x2t - fix build 2018-04-05 18:23:06 +03:00
d665d9449e Merge remote-tracking branch 'origin/hotfix/v5.1.2' into develop 2018-04-05 17:50:30 +03:00
3c93563027 . 2018-04-05 17:43:59 +03:00
b525e1deb4 Merge commit '992e62b8c8efa40aede48e3e6732fe6da38171fe' into develop 2018-04-05 17:39:21 +03:00
d5b80e2fa3 x2t - fix https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/87#issuecomment-374490389 2018-04-05 17:34:39 +03:00
2bc2039c01 . 2018-04-05 17:28:17 +03:00
a0fdb1cbcc PptFormatReader - fix shape geometry in files from newest ms office 2018-04-05 17:27:02 +03:00
664007983d x2t fix mac build 2018-04-05 17:14:05 +03:00
a15aee3244 v5.1.1 2018-04-05 15:55:18 +03:00
5e034e2877 Recover icu paths for windows 2018-04-05 12:43:57 +03:00
8d77cdaf24 Merge branch 'feature/icu55-build' into feature/icu60 2018-04-04 18:24:19 +03:00
e73b5c29b2 Fix the target chosing 2018-04-04 18:23:17 +03:00
6a3b4d12a5 Add icu installation to local folder on linux 2018-04-04 16:36:25 +03:00
992e62b8c8 Add icu building from source on linux 2018-04-04 14:25:53 +03:00
021e01af4e . 2018-04-04 14:05:25 +03:00
55a1a2ca59 Merge branch 'feature/icu60' of https://github.com/ONLYOFFICE/core into feature/icu60 2018-04-04 13:15:10 +03:00
e644ef4062 UnicodeConverter - fix build with icu 6.0 win32&win64 2018-04-04 13:14:34 +03:00
05bf38a35d x2t 2.4.525 linux build 2018-04-04 12:21:40 +03:00
45d51a0002 Restore icu version 2018-04-04 12:15:26 +03:00
247f0a7d89 Refactore fetching icu 2018-04-04 12:09:58 +03:00
7c621a4a81 Change devenv to msbuild 2018-04-03 19:57:02 +03:00
62ba68aaa8 Add icu building from source code on windows 2018-04-03 18:25:01 +03:00
0a816a2d6d Check a certificate of trust 2018-04-03 17:50:04 +03:00
c64a33f42d DocFormatReader - add older version format 2018-04-03 15:28:08 +03:00
0599018f99 Merge remote-tracking branch 'origin/hotfix/v5.1.1' into develop 2018-04-03 15:25:05 +03:00
bf8bea5d07 Merge pull request #63 from ONLYOFFICE/hotfix/v5.1.1_fix_users_files
x2t -fix users files
2018-04-02 17:19:50 +03:00
d9bd1cdb32 x2t -fix users files 2018-04-02 17:14:46 +03:00
e1a8bd3b3d [draw] Fix gradient bug 2018-03-30 13:59:50 +03:00
a8f7a1f044 [ios][x2t] fixed build 2018-03-30 10:56:08 +03:00
17e8cfcaa8 [changelog] Add to develop
Add changelog to develop
2018-03-29 18:23:32 +03:00
5d4bdccbac [changelog] Add changelog
Create CHANGELOG.md for hotfix/v5.1.1
2018-03-29 18:20:59 +03:00
5c43b5743d [changelog] Add changelog
Create CHANGELOG.md for hotfix/v5.1.1
2018-03-29 18:01:22 +03:00
0af0739792 [ios][se] disable log 2018-03-29 14:42:56 +03:00
a2034c19c7 Merge remote-tracking branch 'origin/hotfix/v5.1.1' into develop
* origin/hotfix/v5.1.1:
  .
  x2t - fix bug #37323
2018-03-28 13:41:53 +03:00
5ae24e7e32 . 2018-03-28 13:08:56 +03:00
cc69c8c1b4 x2t - fix bug #37323 2018-03-28 13:03:56 +03:00
d0b2acb6b3 v5.1.0 2018-03-28 12:06:40 +03:00
7df5ff1aeb DocFormatReader - add word doc without compound storage(earlier 1995) 2018-03-27 16:43:48 +03:00
7ea2b40585 Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-03-26 16:20:33 +03:00
163fc24ad6 . 2018-03-23 19:06:04 +03:00
a7058f0dbd . 2018-03-23 18:55:06 +03:00
bac1fee526 x2t - fix bug #37212 2018-03-22 15:30:22 +03:00
eeb7d2ce09 fix bug #37250 2018-03-20 17:57:01 +03:00
4bbca69cf0 x2t - convert otf to odf 2018-03-19 18:31:01 +03:00
dd43fe62d9 x2t - fix write override theme chart in docx from binary 2018-03-19 15:54:03 +03:00
5631c4d57d Fix bug #36796
Fix the problem with saving in PDF italic/bold font in case when we do not have native italic/bold font file.
2018-03-19 12:19:13 +03:00
7fd99856c4 x2t fix linux build 2018-03-17 17:32:28 +03:00
88cde2bbfb RtfFormatReader - add system convertation text with codepage (in addition icu) 2018-03-17 16:25:14 +03:00
61cadf944f . 2018-03-16 19:58:37 +03:00
b86c6785dd Add functions for detection font style to CFontFile 2018-03-16 19:03:05 +03:00
1322918d6b OdfFormatReader - extended convert field 2018-03-16 17:33:04 +03:00
9c602642e1 . 2018-03-15 17:23:38 +03:00
d55edaad17 [x2t] For ott, ots, otp 2018-03-15 16:12:21 +03:00
7dc887ff51 DocxFormat - fix write bookmarks 2018-03-15 14:51:13 +03:00
140b511c7e x2t - add convertation from open office template 2018-03-15 14:49:10 +03:00
eade6a9377 OoxmlFormat - fix 3d shapes convert 2018-03-15 11:42:58 +03:00
020557281c x2t - fix bug #37219 2018-03-14 17:37:41 +03:00
01f30301ed RtfFormatReader - fix errors content after testing 2018-03-14 17:03:28 +03:00
758ae9a1da [x2t][feat] Add open/save link style 2018-03-13 19:57:05 +03:00
99bcce647c [ios][pe] add event 2018-03-13 17:40:35 +03:00
dcf6fadcad Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-03-12 19:27:00 +03:00
7ed3410362 x2t - fix convert vml text auto shape to ooxml 2018-03-12 19:24:57 +03:00
0b3c1b8d55 Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-03-12 17:46:44 +03:00
628cb55e9b DocFormatReader - fix bug #36342 2018-03-12 17:30:50 +03:00
b6ad4dd76c Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-03-12 10:51:52 +03:00
bbb46566d6 OdfFormatReader - fix length rigth tab, fix list level adjastment in style 2018-03-09 15:27:45 +03:00
a17fa6ea9a x2t fix linux build 2018-03-09 14:06:20 +03:00
bb7f417889 x2t - ooxml - fix 3d wordArt 2018-03-07 18:30:55 +03:00
e6adb77560 x2t ooxml convert 3d shape
XlsFormat - convert ooxml shapes from extened properties
2018-03-07 17:32:09 +03:00
fa94d74a1d Fix v8 artifact path 2018-03-06 19:11:01 +03:00
cd83fa27b9 [x2t] Fix bug #37056 2018-03-06 17:35:46 +03:00
1db705b00d x2t fix build msvc2015 & qt 5.9 (and upper) 2018-03-06 11:17:10 +03:00
45237ad7d4 [fonts] Remove font pick by fontformat 2018-03-05 17:54:09 +03:00
d44aa0d28a x2t - fix bug #36524 2018-03-05 17:47:05 +03:00
405396afca Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-03-05 17:07:17 +03:00
3ec6827f76 Change MSVC version number 2018-03-05 16:50:12 +03:00
dfc92584f7 x2t -fix test projects 2018-03-05 16:48:06 +03:00
743488b7a5 Fix build failing on visual studio 2015 2018-03-05 14:45:44 +03:00
fca8c8b09c x2t - graphics - fix build for qt 5.9 and msvc2015 2018-03-04 14:57:11 +03:00
2b36fe96a2 x2t - fix compiler for msvc2015 2018-03-02 15:17:36 +03:00
ed90117493 [ios][x2t] fixed xlsx 2018-03-02 14:26:29 +03:00
f0cd60b93c Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-03-02 11:12:28 +03:00
ca9e385bbc x2t version 2.4.520 2018-03-01 20:02:57 +03:00
cfe9398ff0 RtfFormatReader - fix convert document from consultant+ 2018-03-01 20:01:04 +03:00
16728b5195 Escape to build openssl twice 2018-03-01 17:25:47 +03:00
c53b93b24c Merge pull request #61 from ONLYOFFICE/feature/update-copyright
Update copyright to 2018
2018-03-01 16:00:51 +03:00
c3cd1afa85 Update copyright to 2018 2018-03-01 14:30:24 +03:00
84f1c05d5f [v8] reset to no use shapshot 2018-03-01 11:57:53 +03:00
49aa15a751 Merge remote-tracking branch 'origin/release/v5.1.0' into develop 2018-02-28 19:59:59 +03:00
0c5410df72 x2t - metafile test 2018-02-28 19:58:41 +03:00
9b3c92d5f5 x2t - fix errors content after tesing rtf->docx, xls->xlsx 2018-02-28 19:57:56 +03:00
a4881cd241 [fonts] Fix bug with font selection 2018-02-28 15:05:01 +03:00
4b6a14f617 Fix launching featch_linux_correct.sh 2018-02-28 14:48:43 +03:00
c4013d747c Fix shell syntax 2018-02-28 14:07:04 +03:00
98e31947cc OdfFormatWriter - fix bug #37016 2018-02-28 12:38:08 +03:00
86378add6a Merge branch 'release/v5.1.0' of github.com:ONLYOFFICE/core into release/v5.1.0 2018-02-27 19:54:53 +03:00
d00536d05d Disable paralell build 2018-02-27 18:36:30 +03:00
377d79cfc6 Remove multithread make use MAKEFLAGS instead 2018-02-27 17:03:54 +03:00
cfe59582fc x2t - convert bigest meta file in raster without svg 2018-02-27 11:50:19 +03:00
2256d3ae5d [v8] switch to external_snapshot lib 2018-02-27 06:07:47 +03:00
a8b57060ce [v8] correct libs 2018-02-27 04:02:21 +03:00
655dd97626 Merge pull request #60 from ONLYOFFICE/feature/v8_6.0
Feature/v8 6.0
2018-02-27 13:18:52 +03:00
451b4920c7 Merge branch 'release/v5.1.0' into feature/v8_6.0 2018-02-27 13:18:26 +03:00
b214dc93d8 XlsFormatReader - fix convert elements chart; fix convert color scale cond. format 2018-02-26 19:37:14 +03:00
a2d0c4ad7d Fix build 3rd-party on macOS 2018-02-26 14:57:24 +03:00
43f29d2877 [bug] Fix bug 35691 2018-02-26 13:29:37 +03:00
5f5f22a0f0 Merge branch 'release/v5.1.0' of https://github.com/ONLYOFFICE/core into release/v5.1.0 2018-02-26 12:03:27 +03:00
5256afe04c x2t version up 2.4.519 2018-02-26 12:05:13 +03:00
b9080eb9c2 XlsFormat - workbook protections 2018-02-24 14:08:58 +03:00
5649fb3e2e RtfFormat; XlsFormat - extended chart layouts for series, titles 2018-02-24 12:54:55 +03:00
348b8e4045 [x2t][feat] Add Word app version in Editor.bin 2018-02-22 18:32:27 +03:00
2087e9f195 [fonts] AllFontsGen 2018-02-22 18:13:47 +03:00
ccd84e1850 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-02-22 17:43:29 +03:00
08ca56873e RtfFormatWriter - fix shapes size (for previous) 2018-02-22 17:42:54 +03:00
72761a21e3 x2t fix linux build 2018-02-22 17:41:05 +03:00
9e5a1f004e Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-02-22 17:30:51 +03:00
57fea23de4 RtfFormatWriter - convert ooxml chart to ole object 2018-02-22 16:27:45 +03:00
bc67fc8e55 . 2018-02-21 17:36:28 +03:00
4aae1b21e9 RtfFormatWriter - fix write ole object 2018-02-21 17:34:16 +03:00
ae69f892f1 XlsFormatReader - fix users file - fix layout plot area chart from newest format 2018-02-21 15:23:46 +03:00
93d8634ca3 x2t fix linux compaund. version up to 2.4.518 2018-02-21 14:42:59 +03:00
bdd4b68f43 XlsFormat - fix users file - chart title & bevel shape 2018-02-21 12:28:48 +03:00
a9a674c895 RtfFormatReaderWriter - convert ole object. 2018-02-21 12:06:17 +03:00
ed575b3b68 [x2t][config] Rename m_oInputLimits param 2018-02-20 16:20:58 +03:00
016d46d030 [x2t][feat] Add m_oInput param to limit commpressed/uncommpressed size of zip 2018-02-20 14:56:20 +03:00
486685e4b4 [feat] Add COfficeUtils::GetFilesSize to determine commpressed/uncommpressed size of archive 2018-02-20 14:54:31 +03:00
26a6a77b8d [fonts] New scheme AllFontsGen 2018-02-19 19:08:52 +03:00
90aa7973ed [fonts] New scheme AllFontsGen 2018-02-19 17:19:29 +03:00
b2363c02c0 [allfontsgen] Log 2018-02-16 17:01:57 +03:00
32b59120aa Escape building HtmlFileInternal on Mac OS 2018-02-16 12:57:06 +03:00
7186b56b64 DocFormatReader - fix table mapping 2018-02-16 11:54:24 +03:00
6247490047 RtfFormatReader - fix ole xls chart
RtfFormatWriter - fix table bounds
2018-02-15 19:20:19 +03:00
f30e14c421 Add mac support 2018-02-15 18:54:26 +03:00
e340a2af22 Fix typo 2018-02-15 17:24:49 +03:00
6a5cddf0ce Add multi thread building v8 on mac 2018-02-15 17:13:05 +03:00
312728fe9a Fix typo 2018-02-15 17:00:44 +03:00
182da130da RtfFormatWriter - fix table layouts 2018-02-14 20:01:13 +03:00
eb3ba8c42e RtfFormatWriter - fix table padding 2018-02-13 19:47:23 +03:00
dec099b19b [x2t] Fix bug #36922 2018-02-13 19:24:28 +03:00
21762360ac RtfFormatWriter - fix linux build 2018-02-13 12:13:42 +03:00
563fe88842 [x2t][UnicodeConverter] Change UTF-16,UTF-32 encoding name to UTF-16LE
As described in http://unicode.org/faq/utf_bom.html#gen6 UTF-16,UTF-32 requires BOM
2018-02-13 11:33:32 +03:00
0e085fbb13 RtfFormatWriter - fix text in ooxml shapes, expand properties ooxml shapes 2018-02-12 19:54:28 +03:00
ed409e745a fix bug #36905 2018-02-12 19:44:59 +03:00
4bc58482b3 [ios][x2t] fixed build project 2018-02-12 14:55:08 +03:00
89ee039a05 RtfFormatReader - fix convert shapes 2018-02-08 11:11:49 +03:00
5d5b1202c7 fix for ms office editor. bug 36869. 2018-02-07 17:57:11 +03:00
c7646fd813 Changed main default fonts 2018-02-07 17:09:40 +03:00
b1d406b448 fix xdr xfrm in graphiicFrame 2018-02-07 15:36:51 +03:00
ea37eab86e . 2018-02-07 13:15:58 +03:00
d045609523 DocFormatReader - fix shape 2018-02-06 20:13:06 +03:00
9336448ca9 fix bug 36861 2018-02-06 17:55:37 +03:00
5830e7824a fix bug #36740 - for csv preview remove error return 2018-02-06 17:35:11 +03:00
821feb51b5 . 2018-02-06 15:59:20 +03:00
547979cd9b bug: fix open CBulletColor with no UniColor 2018-02-06 14:22:27 +03:00
c4481eb125 DocFormatReader - adding decrypt for format 1995, adding xor method decrypting 2018-02-06 13:55:59 +03:00
ad0f2c89e0 fix bug #35277
XlsFormatReader - adding decrypt for format 1995, adding xor method decrypting
2018-02-05 17:38:14 +03:00
e15c75b6aa add sha-256 hash agrorithm 2018-02-05 13:52:29 +03:00
b2fb7f0fe7 . 2018-02-05 12:52:24 +03:00
410e5ebd75 . 2018-02-05 12:11:35 +03:00
9c57088ef1 RtfFormatWriter - add application property for info
OdfFormatWriter - ods - fix theme color in font
2018-02-03 18:55:49 +03:00
24230e12a3 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-02-02 18:26:11 +03:00
2acef0d4a2 . 2018-02-02 18:25:30 +03:00
aca5ffa36f add standard priority to "Wingdings" font-family 2018-02-02 16:58:10 +03:00
4fc3726f37 fix read strict ooxml textbox (namespace wne) 2018-02-02 15:08:11 +03:00
2682e1fbac Ooxml - fix vml image without image 2018-02-02 14:52:15 +03:00
f5c3ae779b . 2018-02-02 13:59:58 +03:00
068c60afa0 fix bug #36740 - extending error code
x2t version 2.4.515
2018-02-01 19:33:59 +03:00
5b8ca5b417 OdfFormatWriter - write columns table parts in formulas as ref 2018-02-01 18:55:57 +03:00
acfd12ea30 fix bug #36740 2018-02-01 16:42:34 +03:00
a04b83cada . 2018-02-01 12:28:46 +03:00
a7bf12c052 . 2018-01-31 18:17:45 +03:00
5c01b23dee . 2018-01-30 20:09:22 +03:00
db11b75a2e x2t version 2.4.514 2018-01-30 19:37:10 +03:00
2ba4c18cdf bug: initialize m_pWorkbookComments 2018-01-30 17:22:39 +03:00
b264f20f29 . 2018-01-30 15:21:05 +03:00
5e04ea62f7 fix operation priority 2018-01-30 14:44:52 +03:00
3d1db63c0e bug: bug on save onlyoffice extention for comments in xlsx 2018-01-29 19:51:06 +03:00
f124d18256 bug: save nil shading to docx 2018-01-29 18:14:23 +03:00
9bffb65dcb x2t 2.4.512 2018-01-29 15:46:08 +03:00
2fbcc3832f feat: add workbookComments, presentationComments 2018-01-26 20:37:27 +03:00
97b4311e95 . 2018-01-26 19:18:41 +03:00
228b3a52e9 . 2018-01-26 17:55:04 +03:00
2f2236646d Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - data validation (type dropdown list)
  no squares
  fix previous commit
  font by symbol table
2018-01-26 17:08:57 +03:00
30603d0561 build fixed 2018-01-26 17:08:51 +03:00
933af771b7 OdfFormatReader - data validation (type dropdown list) 2018-01-26 14:45:24 +03:00
c04a537d69 no squares 2018-01-26 13:55:24 +03:00
e49d78db47 fix previous commit 2018-01-26 11:39:56 +03:00
99ec420ee5 font by symbol table 2018-01-26 11:36:19 +03:00
f764b034a1 . 2018-01-25 18:33:12 +03:00
73fe023460 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-25 18:26:55 +03:00
242af3c80e . 2018-01-25 18:26:14 +03:00
7756e4b8bd . 2018-01-25 18:17:46 +03:00
56a1d1f627 x2t -fix appVersion 2018-01-25 18:16:15 +03:00
11bd4ff61d . 2018-01-25 17:20:56 +03:00
93a06d7f86 . 2018-01-25 17:18:40 +03:00
76d2d429b7 x2t version 2.4.511 2018-01-25 17:07:43 +03:00
c6de37dbad . 2018-01-25 17:02:31 +03:00
d022e669f0 . 2018-01-25 15:57:17 +03:00
184e79bae1 . 2018-01-25 15:52:14 +03:00
e6581671c8 . 2018-01-25 15:27:06 +03:00
e0a1c688bf . 2018-01-24 19:28:04 +03:00
9e0b301179 write verion x2t to converted files 2018-01-24 18:25:23 +03:00
8680fb2e0e . 2018-01-24 15:45:10 +03:00
c7c605a970 fix bug #31327
convert script text in toggle property in simple text
2018-01-23 19:34:07 +03:00
23d648d92d fix bug #36409 2018-01-23 16:53:40 +03:00
b098c98dbb x2t version 2.4.510 2018-01-23 16:23:09 +03:00
b88726beaf fix bug #36514 2018-01-23 14:09:55 +03:00
b2d3e5e194 . 2018-01-22 19:21:57 +03:00
a8315efae0 . 2018-01-22 18:26:40 +03:00
3781cf6774 . 2018-01-22 17:45:21 +03:00
7e36d47991 fix bug #8010
OdfFormatReader - dropdown & user fields
2018-01-22 15:09:23 +03:00
419a01bd09 fix bug #36725 2018-01-22 11:21:28 +03:00
804a01cab3 x2t version 2.4.509 2018-01-20 15:22:31 +03:00
931d6aa17c . 2018-01-20 14:24:40 +03:00
2861539949 . 2018-01-19 19:33:12 +03:00
281dad68fb . 2018-01-19 14:42:32 +03:00
04ba432cde x2t version 2.4.508 2018-01-19 14:14:33 +03:00
61c943a3b2 up 2018-01-19 13:46:06 +03:00
9fdc7641b3 . 2018-01-18 15:24:33 +03:00
1029ee9101 OoxToBinary - modify preparing to binary write 2018-01-18 15:13:21 +03:00
9ef5bec2a5 [ios] fixed build 2018-01-17 12:43:03 +03:00
93132eb8a0 x2t version 2.4.506 2018-01-17 11:18:24 +03:00
9828c25e51 . 2018-01-16 19:45:34 +03:00
db1204288b OdfFormatWriter - keeping current font size 2018-01-15 18:16:41 +03:00
26c3d37be5 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-01-15 17:57:45 +03:00
077ea08368 OdfFormatWriter - text position (%) 2018-01-15 17:57:32 +03:00
98eab74e97 . 2018-01-15 17:51:30 +03:00
2a7e88ca76 v5.0.7 2018-01-15 15:19:37 +03:00
44491bbbb4 v5.0.7 2018-01-15 15:18:16 +03:00
369596b860 OdfFormatWriter - fix dropCap, sections 2018-01-13 14:59:56 +03:00
15af8f561a OdfFormatWriter - fix picture size from placeholder 2018-01-12 17:02:33 +03:00
58f8d13d71 . 2018-01-12 13:57:26 +03:00
d6413057e2 x2t version 2.4.505
OOXML - add external audio, video; add sound effects for shapes; fix chart theme override, clrmap; convert canvas drawingML
RtfWriter - add image scaling from DrawingML
fix convert from google csv
2018-01-12 12:54:22 +03:00
008382213b Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
Conflicts:
	Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
2018-01-12 12:13:38 +03:00
dd5b4a719b x2t version 2.4.504 2018-01-12 12:03:44 +03:00
3d198bc211 for xlsx comments: Tahoma 9, User name in comment body 2018-01-11 20:43:10 +03:00
05ff75eeb2 fix bug #36652 2018-01-11 17:41:37 +03:00
d44ef86319 . 2018-01-11 11:35:45 +03:00
2f42dc2c35 . 2018-01-09 17:57:27 +03:00
597414ea6b DocFormatFile - fix users file (1995) without codepage 2017-12-26 13:08:02 +03:00
7f06ce7064 . 2017-12-26 11:21:39 +03:00
adf39680b6 OdfFormatWriter - extendede condition conditional formatting (x14) 2017-12-25 20:06:22 +03:00
ce77d478e3 x2t version 2.4.498 2017-12-25 15:42:59 +03:00
e1e14ae243 . 2017-12-25 13:52:57 +03:00
4f6e364225 . 2017-12-25 13:48:50 +03:00
26c02c5766 . 2017-12-23 19:33:05 +03:00
0d8c668f95 OdfFormat, fix bug 36596 (only for onlyoffice editors) 2017-12-23 17:34:20 +03:00
310cff0dfe change non-defined temp directory to unique 2017-12-23 14:48:44 +03:00
7f6611ab21 .. 2017-12-23 14:35:52 +03:00
bb37e348f5 . 2017-12-23 13:26:11 +03:00
6b5e03df5e . 2017-12-23 12:29:40 +03:00
d0e0109560 . 2017-12-22 15:10:45 +03:00
dc33f7f197 fix WriteAutoFilter error 2017-12-21 19:06:21 +03:00
85f4aa5679 fix error in sheetViews toXML 2017-12-21 17:28:55 +03:00
d2c5ea026f OOXML - fix ole object read 2017-12-21 13:52:17 +03:00
419ec7ed33 x2t version up 2017-12-20 19:17:15 +03:00
5f7d9eea02 x2t - optimization read ooxml files 2017-12-20 18:33:35 +03:00
709ee1942d fix bug #36568 2017-12-19 16:31:54 +03:00
5039cec847 diagramm save error 2017-12-19 15:09:10 +03:00
e59eff3a16 fix user file 2017-12-18 18:57:05 +03:00
2206b3b366 Remove unused code 2017-12-18 16:43:12 +03:00
a2d37e8a22 OdfFormaReader - fix 3d charts with 2 axis 2017-12-16 16:24:51 +03:00
b13eba5f01 x2t optimization rels 2017-12-15 17:05:47 +03:00
a48058c7d5 merge from 5.0.7 2017-12-15 14:52:11 +03:00
ab76aff379 . 2017-12-15 14:49:54 +03:00
b8b8a14268 fix bug 36524 (fix MathType equation) 2017-12-15 14:47:57 +03:00
e5ef749718 . 2017-12-15 12:24:35 +03:00
5d524369b8 . 2017-12-14 19:31:33 +03:00
e78fc0befc x2t - fix users files 2017-12-14 16:46:29 +03:00
d9986d09cd x2t - fix users file 2017-12-13 19:15:13 +03:00
bd67f4bf1c . 2017-12-13 15:13:37 +03:00
475bfaf93d Merge remote-tracking branch 'origin/hotfix/v5.0.7' into develop 2017-12-13 15:12:19 +03:00
1a8af4d8ed x2t - fix users file 2017-12-13 15:11:16 +03:00
cdf8dc7a4c Changed cef update condition 2017-12-13 12:55:54 +03:00
d71552bddd Merge remote-tracking branch 'origin/hotfix/v5.0.7' into develop
# Conflicts:
#	ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
2017-12-13 12:40:08 +03:00
548c5ab608 x2t - fix users files 2017-12-13 11:59:49 +03:00
6a01384023 . 2017-12-13 00:01:15 +03:00
d70f36e36d DocFormat - fix users files 2017-12-12 19:41:50 +03:00
f65984f079 . 2017-12-12 19:41:16 +03:00
5b48a7a330 DocFormat - fix users file, add data form field 2017-12-12 19:10:08 +03:00
1496aece57 v8 (mac os) 2017-12-12 19:06:09 +03:00
60cf51ad0d Move ASCDOCUMENTSCORE to separated target 2017-12-12 16:30:44 +03:00
8e7231b322 removed unused code 2017-12-12 12:43:33 +03:00
2b339b6842 Cherrypick from develop 2017-12-12 12:43:03 +03:00
fb0dbfc231 Cherrypick from develop 2017-12-12 12:40:28 +03:00
756613e883 Merge pull request #56 from ONLYOFFICE/hotfix/v5.0.7
for b599a6bc43 to fix build error
2017-12-11 20:17:01 +03:00
ede03fafea for b599a6bc43 to fix build error 2017-12-11 19:52:44 +03:00
bdec91bfd5 Merge remote-tracking branch 'origin/hotfix/v5.0.7' into develop 2017-12-11 18:44:50 +03:00
260c2edd21 . 2017-12-11 18:42:11 +03:00
3eeec8fc67 RtfFormat - fix users file 2017-12-11 18:39:37 +03:00
ba6c7e8151 Merge remote-tracking branch 'origin/feature/v5.0.7.1' into develop 2017-12-11 14:05:03 +03:00
41a213491e fix image content type 2017-12-11 13:45:28 +03:00
b599a6bc43 Add open/save JsaProject.bin for OnlyOffice Macros 2017-12-11 13:31:48 +03:00
a0fd139027 Merge pull request #55 from ONLYOFFICE/feature/v5.0.7.1
Feature/v5.0.7.1
2017-12-06 18:54:01 +03:00
48852bc618 removed unused code 2017-12-06 18:51:58 +03:00
20b781cb7e pdf checker bug 2017-12-06 18:50:09 +03:00
704b3b709f update cef if newer version exist 2017-12-06 18:21:58 +03:00
e4674915c2 Update cef if exist newer version 2017-12-06 17:19:46 +03:00
51fe936e5f ... 2017-12-06 12:18:06 +03:00
d8b177411f x2t - options for check macro in file 2017-12-05 16:56:50 +03:00
717b628055 ... 2017-12-05 14:37:10 +03:00
e4f94646b6 x2t version up 2017-12-05 10:54:43 +03:00
dcec7447e4 XlsFormat - apply theme style from format office 2010 and later 2017-12-04 19:24:27 +03:00
5f12552f78 XlsFormat - theme 2017-12-03 16:09:35 +03:00
d293769c1f XlsFormat .. 2017-12-02 17:31:10 +03:00
b45e772a50 remove stub for hyperlink without link 2017-12-01 18:34:04 +03:00
fdb7716abc builder error (save to pdf & open file by url) 2017-12-01 14:23:21 +03:00
f72d6dfe0e XlsFormat-... 2017-11-30 20:04:08 +03:00
23029a6a92 Change cef number 2017-11-30 16:28:48 +03:00
eda8e4d13f add c_oSerCellTypes::ValueText for cell value; Read1 error with empty length 2017-11-30 14:18:46 +03:00
64f578e59f XlsFormat - ... 2017-11-29 19:32:21 +03:00
16c57b50cc XlsFormat - table parts 2017-11-29 14:48:02 +03:00
83c0ba9dab XlsFormat - table parts 2017-11-28 19:41:16 +03:00
a2443dadeb use external directory for fonts 2017-11-28 19:17:30 +03:00
789bb1d4b3 add open/save bookmarks 2017-11-28 17:49:14 +03:00
4138ae5ce2 add save to odp 2017-11-28 17:29:12 +03:00
239b5dbf11 fix bug #36451 (ole object old style in master slide) 2017-11-28 17:01:03 +03:00
c046776b9c Merge branch 'hotfix/v5.0.5' into develop
# Conflicts:
#	X2tConverter/src/cextracttools.h
2017-11-27 18:14:40 +03:00
055a02570b XlsFormat - ... 2017-11-27 17:44:55 +03:00
e7bbbec0de v5.0.5 2017-11-27 17:06:49 +03:00
1e2e5996f3 . 2017-11-23 19:40:37 +03:00
875717acd4 Add m_sSavePassword (m_sPassword - only for open) 2017-11-23 18:40:31 +03:00
033feeaf9d fix bug #18178 2017-11-23 18:16:44 +03:00
de336e5f96 Merge remote-tracking branch 'origin/hotfix/v5.0.5' into develop 2017-11-23 17:43:20 +03:00
82b3dbdae6 OdfFormatReader - fix users files 2017-11-23 17:42:09 +03:00
d1227f7759 x2t - add native commands for crypt file 2017-11-23 17:28:28 +03:00
4d134387f9 . 2017-11-23 17:15:06 +03:00
3f8600dfb7 XlsFormat - attachedToolbar,refactoring 2017-11-23 15:34:55 +03:00
511f043d63 . 2017-11-23 14:26:49 +03:00
69a41343c2 build with clang++ 2017-11-23 10:55:04 +03:00
578327bab6 XlsFormat - split sheets by type (ala original file) 2017-11-22 20:05:03 +03:00
52908908a5 fix linux build 2017-11-22 11:44:33 +03:00
24d9b99a44 Merge remote-tracking branch 'origin/hotfix/v5.0.5' into develop 2017-11-21 18:10:56 +03:00
dce58b628f fix bug #36322 2017-11-21 18:10:05 +03:00
f42cb4580c fix users files
XlsFormat olap hierarchy
...
2017-11-21 17:02:22 +03:00
52777e36cb refactoring 2017-11-21 12:49:32 +03:00
7b7e9f3e6e . 2017-11-20 16:21:58 +03:00
d39fa156e7 fix build 2017-11-20 15:47:40 +03:00
48bf40919c fix... 2017-11-17 19:33:38 +03:00
fd53a987be fix bug #36272 2017-11-17 19:02:51 +03:00
b4d298542a fix bug #36251 2017-11-17 15:58:19 +03:00
bae854027b fix bug #36380
Problem with picture in footnote
2017-11-17 13:18:20 +03:00
9723c379dd . 2017-11-17 12:44:51 +03:00
e8d8b2e56c . 2017-11-17 12:27:58 +03:00
adb84b0f05 x2t version up 2017-11-17 12:01:51 +03:00
a4ee30d031 fix bug #36201 2017-11-17 11:44:07 +03:00
e05194b277 Move ASCDOCUMENTSCORE to separated target 2017-11-16 18:14:37 +03:00
21f7f6ed5b fix bug #36335 2017-11-15 13:28:19 +03:00
80863ae25b v5.0.4 2017-11-13 17:46:10 +03:00
07562a9582 v5.0.4 2017-11-13 17:44:36 +03:00
6da196e426 fix bug #36311 2017-11-13 11:48:28 +03:00
d220cc8c79 removed stubs on writing tblLayout 2017-11-09 19:56:04 +03:00
f53c3d9f50 Merge pull request #51 from ONLYOFFICE/feature/pre5.0.4
pdf reader bug
2017-11-07 10:40:46 +03:00
fa98f22e3d fixed crush on Revision: 069544bf6c 2017-11-03 19:07:29 +03:00
e01c09bcc9 XlsFormat - olap .. 2017-11-03 15:36:15 +03:00
069544bf6c tab leader 2017-11-02 19:09:00 +03:00
b0f0f656af Merge pull request #50 from ONLYOFFICE/feature/bug36176
fix bug 36176
2017-11-02 18:00:26 +03:00
99191e65b0 XlsFormat - fix connections (oleDb, query...) 2017-11-02 15:39:18 +03:00
fb41720817 for bug 35900 (CWorkbookPr::toXml) 2017-11-02 13:31:14 +03:00
406c290be4 . 2017-11-01 15:40:15 +03:00
5ae4d7f819 XlsFormat - ... 2017-11-01 13:43:24 +03:00
e69c1677b2 v5.0.3 2017-10-31 18:49:25 +03:00
4d836c180a XlsFormat - mso storage (customXml) 2017-10-31 17:40:49 +03:00
e08b6542d4 XlsFormat - ctrlProps 2017-10-31 15:15:44 +03:00
e1340c63ec pdf reader bug 2017-10-30 15:06:43 +03:00
4b122c0b94 . 2017-10-30 13:47:16 +03:00
867438833b fix bug 36176 2017-10-30 13:40:57 +03:00
8b80aa94b7 XlsFormat - .. 2017-10-27 19:51:00 +03:00
f960fc60bb removed all stubs for FldChar 2017-10-27 19:05:06 +03:00
64213746b0 XlsFormat - query tables 2017-10-26 18:18:09 +03:00
09941c67ac . 2017-10-26 17:16:29 +03:00
c2605bb582 x2t - vps 2017-10-26 12:55:06 +03:00
ab2703c825 XlsFormat - vps 2017-10-26 11:04:35 +03:00
08ce8cb3f5 XlsFormat ... 2017-10-26 10:47:36 +03:00
5efe043ab3 refactoring 2017-10-25 18:34:05 +03:00
f2af1ccd36 refactoring 2017-10-25 18:22:51 +03:00
113d5b4ca3 refactoring 2017-10-25 18:10:59 +03:00
d3461dd3cb refactor 2017-10-25 17:54:27 +03:00
e95a0fb765 XlsFormat - activeX objects 2017-10-25 11:48:53 +03:00
c5ce1e27e4 x2t version up 2017-10-21 14:01:11 +03:00
7ecc7fa1df compaund file stream in unicode 2017-10-21 13:28:29 +03:00
c46cd9e6e5 Merge pull request #48 from ONLYOFFICE/hotfix/v5.0.3
Hotfix/v5.0.3
2017-10-20 17:45:01 +03:00
e299e59d11 fix write compaund files 2017-10-20 15:52:09 +03:00
1e0f4d6fdb XlsFormat - developers controls (buttons, options, ....), fix vba stream 2017-10-19 17:39:00 +03:00
4dae8f50fa Merge pull request #47 from ONLYOFFICE/feature/ooxmlsign
Feature/ooxmlsign
2017-10-18 19:08:30 +03:00
9cc5ed1db0 . 2017-10-18 19:03:58 +03:00
6d1dd9c420 ms crypto bug 2017-10-18 18:58:04 +03:00
a038e1562f XlsFormat - control objects 2017-10-18 14:38:31 +03:00
549e3dc579 Merge pull request #46 from ONLYOFFICE/feature/crypt
crypto fix padding size
2017-10-17 13:01:29 +03:00
8440b18223 crypto fix padding size 2017-10-17 12:57:47 +03:00
9c7a03fdc5 OdfFormatWriter - add ole objects 2017-10-17 11:40:37 +03:00
9272b27a69 crypto fix padding size 2017-10-16 19:37:18 +03:00
ef57330a79 . 2017-10-16 19:20:28 +03:00
d35619eeae Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t binary - fix convert ole without vml drawing
  OdsFormat - fix absolute anchor for ole
  XlsFormat - activeX, controls & ole embedded & links
  xml string as second command-line param(first - path to xml)
  .
  --all-fonts-path param
  Added empty files
  v8 (windows correct)
  Added docbuilder target
2017-10-16 17:53:40 +03:00
b38c552cc5 fixed serialize 2017-10-16 17:53:31 +03:00
1b91ee579c x2t binary - fix convert ole without vml drawing 2017-10-16 14:22:53 +03:00
337c92e522 OdsFormat - fix absolute anchor for ole 2017-10-16 12:22:30 +03:00
8fe1eb7525 XlsFormat - activeX, controls & ole embedded & links 2017-10-16 11:28:46 +03:00
1deb2a6905 Merge 2017-10-13 14:44:53 +03:00
470eddf2b1 Merge 2017-10-13 14:43:33 +03:00
69a787411c xml string as second command-line param(first - path to xml) 2017-10-13 13:51:27 +03:00
ffeb03e0d0 Merge pull request #44 from ONLYOFFICE/develop
_MSC_VER >= 1900 build
2017-10-11 16:33:40 +03:00
cf4d74a7e3 v8 6.0 windows 2017-10-11 16:24:05 +03:00
90c0633212 . 2017-10-09 19:12:47 +03:00
3ea4898939 . 2017-10-09 18:56:49 +03:00
1d00c343c6 Merge pull request #43 from ONLYOFFICE/develop
speed logger
2017-10-09 17:29:58 +03:00
2a408f0e2b . 2017-10-09 17:24:01 +03:00
3813be21c7 --all-fonts-path param 2017-10-09 15:11:30 +03:00
047d0567e1 mac worked version 2017-10-09 13:16:52 +03:00
68c8c0cb29 Merge pull request #42 from ONLYOFFICE/feature/docbuilder
Feature/docbuilder
2017-10-06 11:57:57 +03:00
ab0c5703a5 Added empty files 2017-10-06 11:04:59 +03:00
e22b63347f v8 (windows correct) 2017-10-05 18:13:52 +03:00
438ba3aded v5.0.1 2017-10-05 14:46:28 +03:00
29b002ca80 Added docbuilder target 2017-10-04 14:56:03 +03:00
7025 changed files with 152067 additions and 410589 deletions

7
.gitignore vendored
View File

@ -13,6 +13,11 @@ Common/3dParty/cef/win_32
Common/3dParty/cef/linux_64
Common/3dParty/cef/linux_32
Common/3dParty/cef/mac_64
Common/3dParty/curl/win_64
Common/3dParty/curl/win_32
Common/3dParty/curl/linux_64
Common/3dParty/curl/linux_32
Common/3dParty/curl/mac_64
Common/3dParty/v8/v8
Common/3dParty/v8/depot_tools
Common/3dParty/v8/win_64
@ -40,6 +45,8 @@ ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_i.c
ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
ASCOfficeXlsFile2/win32/dlldata.c
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
X2tConverter/**/Makefile.*
*.7z
*.obj
*.pdb
*.tlb

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -58,6 +58,9 @@
#include <boost/format.hpp>
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
#define GETBIT(from, num) ((from & (1 << num)) != 0)
namespace DocFileFormat
{
typedef unsigned char Bool8;
@ -638,14 +641,12 @@ namespace DocFileFormat
else
{
std::string sCodePage;
for (int i = 0; i < UNICODE_CONVERTER_ENCODINGS_COUNT; ++i)
std::map<int, std::string>::const_iterator pFind = NSUnicodeConverter::mapEncodingsICU.find(code_page);
if (pFind != NSUnicodeConverter::mapEncodingsICU.end())
{
if (code_page == NSUnicodeConverter::Encodings[i].WindowsCodePage)
{
sCodePage = NSUnicodeConverter::Encodings[i].Name;
break;
}
sCodePage = pFind->second;
}
if (sCodePage.empty())
sCodePage = "CP1250"/* + std::to_string(code_page)*/;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -393,7 +393,7 @@ namespace XMLTools
else
{
std::string s(m_str.begin(), m_str.end());
file.WriteFile((unsigned char*)s.c_str(), s.length());
file.WriteFile((unsigned char*)s.c_str(), (DWORD)s.length());
}
file.CloseFile();
return true;

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -41,7 +41,7 @@ namespace DocFileFormat
public:
AnnotationOwnerList(FileInformationBlock* fib, POLE::Stream* tableStream) : std::vector<std::wstring>()
{
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_bOlderVersion);
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_nWordVersion);
if (fib->m_FibWord97.fcGrpXstAtnOwners > reader.GetSize()) return;

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -40,7 +40,7 @@ namespace DocFileFormat
//read the user initials (LPXCharBuffer9)
if (reader->olderVersion)
if (reader->nWordVersion > 0)
{
short cch = reader->ReadByte();

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -41,9 +41,9 @@ namespace DocFileFormat
static const int STRUCTURE_SIZE = 30;
static const int STRUCTURE_SIZE_OLD = 20;
static const int GetSize(bool bOldVersion)
static const int GetSize(int nWordVersion)
{
return bOldVersion ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
inline std::wstring GetUserInitials() const

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -118,70 +118,78 @@ namespace DocFileFormat
public:
/// Creates a new BorderCode with default values
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
{
}
/// Parses the unsigned char for a BRC
BorderCode( unsigned char* bytes, int size ):
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
{
if ( FormatUtils::ArraySum( bytes, size ) == ( size * 255 ) )
{
this->fNil = true;
fNil = true;
}
else if ( size == 8 )
{
//it's a border code of Word 2000/2003
this->cv = FormatUtils::BytesToInt32( bytes, 0, size );
this->ico = std::wstring( Global::ColorIdentifier[0] );
cv = FormatUtils::BytesToInt32( bytes, 0, size );
ico = std::wstring( Global::ColorIdentifier[0] );
this->dptLineWidth = bytes[4];
this->brcType = bytes[5];
dptLineWidth = bytes[4];
brcType = bytes[5];
short val = FormatUtils::BytesToInt16( bytes, 6, size );
this->dptSpace = val & 0x001F;
dptSpace = val & 0x001F;
//not sure if this is correct, the values from the spec are definitly wrong:
this->fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
this->fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
}
else if ( size == 4 )
{
//it's a border code of Word 97
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
this->dptLineWidth = (unsigned char)( val & 0x00FF );
this->brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
dptLineWidth = (unsigned char)( val & 0x00FF );
brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
val = FormatUtils::BytesToUInt16( bytes, 2, size );
this->ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorIdentifier[0][0], 17, 12 );
this->dptSpace = ( val & 0x1F00 ) >> 8;
ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorNameIdentifier[0][0], 17, 12 );
dptSpace = ( val & 0x1F00 ) >> 8;
}
else
else if (size == 2)
{
//throw new ByteParseException("Cannot parse the struct BRC, the length of the struct doesn't match");
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
dptLineWidth = GETBITS(val, 0, 2);
brcType = GETBITS(val, 3, 4);
fShadow = GETBIT(val, 5);
ico = FormatUtils::MapValueToWideString(GETBITS(val, 6, 10), &Global::ColorNameIdentifier[0][0], 17, 12 );
dptSpace = GETBITS(val, 11, 15);
}
}
BorderCode( const BorderCode& bc )
{
if ( this != &bc )
{
this->cv = bc.cv;
this->dptLineWidth = bc.dptLineWidth;
this->brcType = bc.brcType;
this->ico = bc.ico;
this->dptSpace = bc.dptSpace;
this->fShadow = bc.fShadow;
this->fFrame = bc.fFrame;
this->fNil = bc.fNil;
cv = bc.cv;
dptLineWidth = bc.dptLineWidth;
brcType = bc.brcType;
ico = bc.ico;
dptSpace = bc.dptSpace;
fShadow = bc.fShadow;
fFrame = bc.fFrame;
fNil = bc.fNil;
}
}
bool operator == ( const BorderCode& bc )
{
if ( ( this->cv == bc.cv ) && ( this->dptLineWidth == bc.dptLineWidth ) && ( this->brcType == bc.brcType ) &&
( this->ico == bc.ico ) && ( this->dptSpace == bc.dptSpace ) && ( this->fShadow == bc.fShadow ) &&
( this->fFrame == bc.fFrame ) && ( this->fNil == bc.fNil ) )
if ( ( cv == bc.cv ) && ( dptLineWidth == bc.dptLineWidth ) && ( brcType == bc.brcType ) &&
( ico == bc.ico ) && ( dptSpace == bc.dptSpace ) && ( fShadow == bc.fShadow ) &&
( fFrame == bc.fFrame ) && ( fNil == bc.fNil ) )
{
return true;
}

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -129,355 +129,360 @@ namespace DocFileFormat
parent->AppendChild( *webHidden );
RELEASEOBJECT( webHidden );
}
std::list<SinglePropertyModifier>::iterator end = sprms->end();
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
if ((sprms) && (!sprms->empty()))
{
int nProperty = 0; //for unknown test
switch ( (int)( iter->OpCode ) )
std::list<SinglePropertyModifier>::iterator end = sprms->end();
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
{
case sprmOldCIstd :
case sprmCIstd : // style id
int nProperty = 0; //for unknown test
switch ( (int)( iter->OpCode ) )
{
if (_isRunStyleNeeded && !_webHidden)
case sprmOldCIstd :
case sprmCIstd : // style id
{
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if (_currentIstd < _doc->Styles->Styles->size())
if (_isRunStyleNeeded && !_webHidden)
{
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if (_currentIstd < _doc->Styles->Styles->size())
{
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
}
}
}break;
case sprmCFBiDi :
appendFlagElement( parent, *iter, L"rtl", true );
_isRTL = true;
break;
case sprmOldCFBold :
case sprmCFBold :
appendFlagElement( parent, *iter, L"b", true );
break;
case sprmCFBoldBi :
appendFlagElement( parent, *iter, L"bCs", true );
break;
case sprmOldCFCaps :
case sprmCFCaps :
appendFlagElement( parent, *iter, L"caps", true );
break;
case sprmCFComplexScripts :
appendFlagElement( parent, *iter, L"cs", true );
break;
case sprmCFDStrike :
appendFlagElement( parent, *iter, L"dstrike", true );
break;
case sprmCFEmboss :
appendFlagElement( parent, *iter, L"emboss", true );
break;
case sprmCFImprint :
appendFlagElement( parent, *iter, L"imprint", true );
break;
case sprmOldCFItalic :
case sprmCFItalic :
appendFlagElement( parent, *iter, L"i", true );
break;
case sprmCFItalicBi:
appendFlagElement( parent, *iter, L"iCs", true );
break;
case 0x0875:
appendFlagElement( parent, *iter, L"noProof", true );
break;
case sprmOldCFOutline:
case sprmCFOutline:
appendFlagElement( parent, *iter, L"outline", true );
break;
case sprmOldCFShadow:
case sprmCFShadow:
appendFlagElement( parent, *iter, L"shadow", true );
break;
case sprmOldCFSmallCaps:
case sprmCFSmallCaps:
appendFlagElement( parent, *iter, L"smallCaps", true );
break;
case sprmCFSpecVanish:
appendFlagElement( parent, *iter, L"specVanish", true );
break;
case sprmOldCFStrike:
case sprmCFStrike:
appendFlagElement( parent, *iter, L"strike", true );
break;
case sprmOldCFVanish:
case sprmCFVanish:
appendFlagElement( parent, *iter, L"vanish", true );
break;
case 0x0811:
appendFlagElement( parent, *iter, L"webHidden", true );
break;
case sprmOldCIss:
case sprmCIss:
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break;
case sprmCRgLid0_80:
case sprmCRgLid0:
{ //latin
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmOldCLid:
case sprmCRgLid1_80:
case sprmCRgLid1:
{ //east asia
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCLidBi:
{
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCBrc80:
case sprmCBrc:
{ //borders
XMLTools::XMLElement bdr( L"w:bdr" );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bdr );
parent->AppendChild( bdr );
}break;
case sprmCShd80:
case sprmCShd:
{ //shading
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
appendShading( parent, desc );
}break;
case sprmOldCIco:
case sprmCIco:
case sprmCIcoBi:
{//color
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
}break;
case sprmCCv:
{
std::wstringstream sstream;
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
colorVal->SetValue(sstream.str());
}break;
case sprmCOldHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
}break;
case sprmCHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
}break;
case sprmOldCDxaSpace:
case sprmCDxaSpace:
{
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCFtcBi :
{//default from FontTable
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
if( nIndex < _doc->FontTable->Data.size() )
{
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
if (ffn)
m_sDefaultFont = ffn->xszFtn;
}
}break;
case sprmCHpsBi :
{
appendValueElement( parent, L"szCs",
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}
break;
// Font Size in points (2~3276) default 20-half-points
case sprmOldCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
true );
}break;
case sprmCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
}break;
case sprmCMajority :
{ //for complex props
}break;
case sprmOldCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmOldCHpsKern:
case sprmCHpsKern:
{
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmOldCFtc:
case sprmCRgFtc0:
{ // font family
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sAsciiFont = ffn->xszFtn;
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii );
}
}break;
case sprmCRgFtc1:
{
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sEastAsiaFont = ffn->xszFtn;
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
rFonts->AppendAttribute( *eastAsia );
RELEASEOBJECT( eastAsia );
}
}
}break;
break;
case sprmCFBiDi :
appendFlagElement( parent, *iter, L"rtl", true );
_isRTL = true;
break;
case sprmOldCFBold :
case sprmCFBold :
appendFlagElement( parent, *iter, L"b", true );
break;
case sprmCFBoldBi :
appendFlagElement( parent, *iter, L"bCs", true );
break;
case sprmOldCFCaps :
case sprmCFCaps :
appendFlagElement( parent, *iter, L"caps", true );
break;
case sprmCFComplexScripts :
appendFlagElement( parent, *iter, L"cs", true );
break;
case sprmCFDStrike :
appendFlagElement( parent, *iter, L"dstrike", true );
break;
case sprmCFEmboss :
appendFlagElement( parent, *iter, L"emboss", true );
break;
case sprmCFImprint :
appendFlagElement( parent, *iter, L"imprint", true );
break;
case sprmOldCFItalic :
case sprmCFItalic :
appendFlagElement( parent, *iter, L"i", true );
break;
case sprmCFItalicBi:
appendFlagElement( parent, *iter, L"iCs", true );
break;
case 0x0875:
appendFlagElement( parent, *iter, L"noProof", true );
break;
case sprmOldCFOutline:
case sprmCFOutline:
appendFlagElement( parent, *iter, L"outline", true );
break;
case sprmOldCFShadow:
case sprmCFShadow:
appendFlagElement( parent, *iter, L"shadow", true );
break;
case sprmOldCFSmallCaps:
case sprmCFSmallCaps:
appendFlagElement( parent, *iter, L"smallCaps", true );
break;
case sprmCFSpecVanish:
appendFlagElement( parent, *iter, L"specVanish", true );
break;
case sprmOldCFStrike:
case sprmCFStrike:
appendFlagElement( parent, *iter, L"strike", true );
break;
case sprmOldCFVanish:
case sprmCFVanish:
appendFlagElement( parent, *iter, L"vanish", true );
break;
case 0x0811:
appendFlagElement( parent, *iter, L"webHidden", true );
break;
case sprmOldCIss:
case sprmCIss:
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break;
case sprmCRgLid0_80:
case sprmCRgLid0:
{ //latin
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmOldCLid:
case sprmCRgLid1_80:
case sprmCRgLid1:
{ //east asia
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCLidBi:
{
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCBrc80:
case sprmCBrc:
{ //borders
XMLTools::XMLElement bdr( L"w:bdr" );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bdr );
parent->AppendChild( bdr );
}break;
case sprmCShd80:
case sprmCShd:
{ //shading
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
appendShading( parent, desc );
}break;
case sprmOldCIco:
case sprmCIco:
case sprmCIcoBi:
{//color
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
}break;
case sprmCCv:
{
std::wstringstream sstream;
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
colorVal->SetValue(sstream.str());
}break;
case sprmCOldHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ), true );
}break;
case sprmCHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ), true );
}break;
case sprmOldCDxaSpace:
case sprmCDxaSpace:
{
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCFtcBi :
{//default from FontTable
SHORT nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
if( nIndex < _doc->FontTable->Data.size() )
case sprmCRgFtc2:
{
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
if (ffn)
m_sDefaultFont = ffn->xszFtn;
}
}break;
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
case sprmCHpsBi :
{
appendValueElement( parent, L"szCs",
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}
break;
// Font Size in points (2~3276) default 20-half-points
case sprmOldCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
true );
}break;
case sprmCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
}break;
case sprmCMajority :
{ //for complex props
}break;
case sprmOldCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmOldCHpsKern:
case sprmCHpsKern:
{
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmOldCFtc:
case sprmCRgFtc0:
{ // font family
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sAsciiFont = ffn->xszFtn;
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii );
}
}break;
case sprmCRgFtc1:
{
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sEastAsiaFont = ffn->xszFtn;
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
rFonts->AppendAttribute( *eastAsia );
RELEASEOBJECT( eastAsia );
}
}
break;
case sprmCRgFtc2:
{
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_shAnsiFont = ffn->xszFtn;
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
rFonts->AppendAttribute( *ansi );
RELEASEOBJECT( ansi );
}
}break;
case sprmOldCKul:
case sprmCKul:
{ //Underlining
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
}
break;
case sprmCCharScale:
{ //char width
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCSfxText:
{ //animation
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
}break;
case sprmCIdctHint:
{
switch(iter->Arguments[0])
{
case 0: break; // default
case 1: break; // eastAsia
case 2: break; // cs
case 0xFF: break; //No ST_Hint equivalent
}
}break;
case sprmCPbiIBullet:
{
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
if (nIndex >=0)
{
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
if (it != _doc->PictureBulletsCPsMap.end())
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
{
//добавить
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_shAnsiFont = ffn->xszFtn;
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
rFonts->AppendAttribute( *ansi );
RELEASEOBJECT( ansi );
}
}break;
case sprmOldCKul:
case sprmCKul:
{ //Underlining
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
}
}break;
break;
case sprmCPbiGrf:
{
//used picture bullet
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
case sprmCCharScale:
{ //char width
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCSfxText:
{ //animation
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
}break;
}break;
case sprmCIdctHint:
{
switch(iter->Arguments[0])
{
case 0: break; // default
case 1: break; // eastAsia
case 2: break; // cs
case 0xFF: break; //No ST_Hint equivalent
}
case sprmCRsidProp:
case sprmCRsidText:
break;
}break;
default:
if (iter->argumentsSize == 2)
{
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}else
if (iter->argumentsSize == 1)
{
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
case sprmCPbiIBullet:
{
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
if (nIndex >=0)
{
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
if (it != _doc->PictureBulletsCPsMap.end())
{
//добавить
}
}
}break;
case sprmCPbiGrf:
{
//used picture bullet
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}break;
case sprmCRsidProp:
case sprmCRsidText:
break;
default:
if (iter->argumentsSize == 2)
{
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}else
if (iter->argumentsSize == 1)
{
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
}
break;
}
break;
}
}

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,19 +35,188 @@
namespace DocFileFormat
{
class CharacterPropertyExceptions: public PropertyExceptions
{
public:
/// Creates a CHPX wich doesn't modify anything.
/// The grpprl list is empty
CharacterPropertyExceptions(): PropertyExceptions()
{
}
class CharacterPropertyExceptions: public PropertyExceptions
{
public:
/// Creates a CHPX wich doesn't modify anything.
/// The grpprl list is empty
CharacterPropertyExceptions(): PropertyExceptions()
{
}
/// Parses the bytes to retrieve a CHPX
CharacterPropertyExceptions( unsigned char* bytes, int size, bool oldVersion) :
PropertyExceptions( bytes, size, oldVersion )
{
}
};
/// Parses the bytes to retrieve a CHPX
CharacterPropertyExceptions( unsigned char* bytes, int size, int nWordVersion) :
PropertyExceptions( bytes, size, nWordVersion )
{
if (nWordVersion > 1)
{
RELEASEOBJECT( grpprl );
grpprl = new std::list<SinglePropertyModifier>();
MemoryStream oStream(bytes, size);
int pos = 0;
if (nWordVersion == 3)
{
if (pos + 2 > size) return;
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
unsigned char val;
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
bool fsIco = GETBIT(fChar, 10);
bool fsFtc = GETBIT(fChar, 11);
bool fsHps = GETBIT(fChar, 12);
bool fsKul = GETBIT(fChar, 13);
bool fsPos = GETBIT(fChar, 14);
bool fsSpace = GETBIT(fChar, 15);
if (pos + 2 > size) return;
int fff = oStream.ReadUInt16(); pos += 2;//?????
if (pos + 2 > size) return;
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
if (pos + 1 > size) return;
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
if (hps > 0)
{
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
}
if (pos + 1 > size) return;
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
if (pos + 2 > size) return;
unsigned short fText = oStream.ReadUInt16(); pos += 2;
unsigned short qpsSpace = GETBITS(fText, 0, 5);
unsigned char wSpare2 = GETBITS(fText, 6, 7);
unsigned char ico = GETBITS(fText, 8, 11);
unsigned char kul = GETBITS(fText, 12, 14);
bool fSysVanish = GETBIT(fChar, 15);
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
//sizeof(CHP) == 12 == 0xC
if (pos + 4 > size) return;
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
if (pos + 1 > size) return;
unsigned char fnPic = oStream.ReadByte(); pos += 1;
if (pos + 2 > size) return;
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
}
else if (nWordVersion == 2)
{
if (pos + 2 > size) return;
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
unsigned char val;
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCIbstRMark, 1, &val));
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
val = GETBIT(fChar, 10); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
val = GETBIT(fChar, 11); grpprl->push_back(SinglePropertyModifier(sprmOldCFObj, 1, &val));
val = GETBIT(fChar, 12); grpprl->push_back(SinglePropertyModifier(sprmCFBoldBi, 1, &val));
val = GETBIT(fChar, 13); grpprl->push_back(SinglePropertyModifier(sprmCFItalicBi, 1, &val));
val = GETBIT(fChar, 14); grpprl->push_back(SinglePropertyModifier(sprmCFBiDi, 1, &val));
val = GETBIT(fChar, 15); grpprl->push_back(SinglePropertyModifier(sprmCFDiacColor, 1, &val));
if (pos + 2 > size) return;
unsigned short fChar2 = oStream.ReadUInt16(); pos += 2;
bool fsIco = GETBIT(fChar2, 0);
bool fsFtc = GETBIT(fChar2, 1);
bool fsHps = GETBIT(fChar2, 2);
bool fsKul = GETBIT(fChar2, 3);
bool fsPos = GETBIT(fChar2, 4);
bool fsSpace = GETBIT(fChar2, 5);
bool fsLid = GETBIT(fChar2, 6);
bool fsIcoBi = GETBIT(fChar2, 7);
bool fsFtcBi = GETBIT(fChar2, 8);
bool fsHpsBi = GETBIT(fChar2, 9);
bool fsLidBi = GETBIT(fChar2, 10);
if (pos + 2 > size) return;
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
if (pos + 1 > size) return;
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
if (hps > 0)
{
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
}
if (pos + 1 > size) return;
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
if (pos + 2 > size) return;
unsigned short fText = oStream.ReadUInt16(); pos += 2;
unsigned short qpsSpace = GETBITS(fText, 0, 5);
unsigned char wSpare2 = GETBITS(fText, 6, 7);
unsigned char ico = GETBITS(fText, 8, 11);
unsigned char kul = GETBITS(fText, 12, 14);
bool fSysVanish = GETBIT(fChar, 15);
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
//if (pos + 1 > size) return;
//unsigned char icoBi = oStream.ReadUInt16(); pos += 1;//wSpare3
if (pos + 2 > size) return;
unsigned short lid = oStream.ReadUInt16(); pos += 2;
grpprl->push_back(SinglePropertyModifier(sprmOldCLid, 2, (BYTE*)&lid));
if (pos + 2 > size) return;
unsigned short ftcBi = oStream.ReadUInt16(); pos += 2;
grpprl->push_back(SinglePropertyModifier(sprmCFtcBi, 4, (BYTE*)&ftcBi));
//if (pos + 2 > size) return;
//unsigned short hpsBi = oStream.ReadUInt16(); pos += 2;
//grpprl->push_back(SinglePropertyModifier(sprmCHpsBi, 4, (BYTE*)&hpsBi));
//if (pos + 2 > size) return;
//unsigned short lidBi = oStream.ReadUInt16(); pos += 2;
//grpprl->push_back(SinglePropertyModifier(sprmCLidBi, 2, (BYTE*)&lidBi));
if (pos + 4 > size) return;
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
if (pos + 1 > size) return;
unsigned char fnPic = oStream.ReadByte(); pos += 1;
if (pos + 2 > size) return;
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
}
}
}
};
}

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -72,10 +72,14 @@ namespace DocFileFormat
{
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
unsigned short index_author = atrdPre10->GetAuthorIndex();
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
if (index_author < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
{
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( index_author ) ));
}
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->GetUserInitials());
//!!!TODO!!!
@ -95,7 +99,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx(fc);
TableInfo tai(papx);
TableInfo tai(papx, m_document->nWordVersion);
if ( tai.fInTable )
{
@ -107,7 +111,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph(cp);
cp = writeParagraph(cp, 0x7fffffff);
}
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -69,8 +69,13 @@ namespace OpenXmlContentTypes
static const wchar_t* Tiff = L"image/tiff";
static const wchar_t* Wmf = L"image/x-wmf";
static const wchar_t* Bmp = L"image/bmp";
static const wchar_t* Pcz = L"image/x-pcz";
}
namespace DocPrContentTypes
{
static const wchar_t* App = L"application/vnd.openxmlformats-officedocument.extended-properties+xml";
static const wchar_t* Core = L"application/vnd.openxmlformats-package.core-properties+xml";
}
namespace WordprocessingMLContentTypes
{
// WordprocessingML content types
@ -136,7 +141,7 @@ namespace OpenXmlNamespaces
namespace OpenXmlRelationshipTypes
{
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const wchar_t* ExtendedProperties = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
static const wchar_t* Theme = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
@ -158,6 +163,7 @@ namespace OpenXmlRelationshipTypes
static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
static const wchar_t* VbaProject = L"http://schemas.microsoft.com/office/2006/relationships/vbaProject";
static const wchar_t* Hyperlink = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
}
namespace MicrosoftWordRelationshipTypes

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -47,30 +47,17 @@ namespace DocFileFormat
virtual ~ConversionContext()
{
}
// Adds a new RSID to the set
inline void AddRsid(const std::wstring& rsid)
{
if (AllRsids.find(rsid) == AllRsids.end())
AllRsids.insert(rsid);
}
inline WordDocument* GetDocument()
{
return _doc;
}
inline WordprocessingDocument* GetXmlDocument()
{
return _docx;
}
public:
WordprocessingDocument* _docx;
WordDocument* _doc;
/// A set thta contains all revision ids.
std::set<std::wstring> AllRsids;
};
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -63,8 +63,16 @@ namespace DocFileFormat
{
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
{
if (!doc || !docx) return S_FALSE;
ConversionContext context( doc, docx );
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
doc->FontTable->Convert( &fontTableMapping );
}
//Write styles.xml
if (doc->Styles)
{
@ -107,14 +115,6 @@ namespace DocFileFormat
return S_FALSE;
}
}
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
doc->FontTable->Convert( &fontTableMapping );
}
if ( progress != NULL )
{
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000 );

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -59,29 +59,30 @@ namespace DocFileFormat
short wdy;
public:
/// Creates a new DateAndTime with default values
DateAndTime()
{
setDefaultValues();
}
/// Parses the unsigned char sto retrieve a DateAndTime
DateAndTime( unsigned char* bytes, int size )
{
if ( size == 4 )
{
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
}
else
{
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
}
}
DateAndTime()
{
setDefaultValues();
}
DateAndTime( unsigned int val )
{
DateAndTime((unsigned char*)&val, 4);
}
DateAndTime( unsigned char* bytes, int size )
{
if ( size == 4 )
{
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
}
else
{
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
}
}
#if defined(_WIN32) || defined(_WIN64)
SYSTEMTIME ToSYSTEMTIME()
{

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -39,10 +39,12 @@
#include "../Common/TextMark.h"
#include "../Common/FormatUtils.h"
#include <boost/algorithm/string.hpp>
namespace DocFileFormat
{
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
_fldCharCounter(0), AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
_endnoteNr(0), _commentNr(0), _caller(caller)
{
m_document = NULL;
@ -50,17 +52,15 @@ namespace DocFileFormat
m_bInternalXmlWriter = false;
_writeWebHidden = false;
_writeInstrText = false;
_isSectionPageBreak = 0;
_isTextBoxContent = false;
//--------------------------------------------
_embeddedObject = false;
_writeInstrText = false;
}
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
_fldCharCounter(0), AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0),
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0),
_commentNr(0), _caller(caller)
{
m_document = NULL;
@ -68,7 +68,6 @@ namespace DocFileFormat
m_bInternalXmlWriter = false;
_writeWebHidden = false;
_writeInstrText = false;
_isSectionPageBreak = 0;
_isTextBoxContent = false;
_embeddedObject = false;
@ -88,7 +87,12 @@ namespace DocFileFormat
int DocumentMapping::getCurrentSection(int cp)
{
//if cp is the last char of a section, the next section will start at cp +1
int current = 0;
size_t current = 0;
if (m_document->SectionPlex->CharacterPositions.empty())
{
return cp;
}
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
{
@ -107,7 +111,7 @@ namespace DocFileFormat
{
if ( !m_document->ListPlex ) return -1;
for (int i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
for (size_t i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
{
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
{
@ -141,7 +145,7 @@ namespace DocFileFormat
// Writes a Paragraph that starts at the given cp and
// ends at the next paragraph end mark or section end mark
int DocumentMapping::writeParagraph(int cp)
int DocumentMapping::writeParagraph(int cp, int cpEnd)
{
//search the paragraph end
int cpParaEnd = cp;
@ -171,7 +175,7 @@ namespace DocFileFormat
{
cpParaEnd++;
return writeParagraph(cp, cpParaEnd, false);
return writeParagraph(cp, (std::min)(cpEnd, cpParaEnd), false);
}
}
@ -187,8 +191,8 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos(cp);
int fcEnd = m_document->FindFileCharPos(cpEnd);
if (fc < 0 || fcEnd < 0)
return 0;
if (fc < 0 || fcEnd < 0 || fc == fcEnd)
return -1;
ParagraphPropertyExceptions* papx = findValidPapx(fc);
@ -382,7 +386,7 @@ namespace DocFileFormat
int DocumentMapping::writeRun (std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp)
{
int cp = initialCp;
int result_cp = cp + chars->size();
int result_cp = cp + (int)chars->size();
if ((_skipRuns <= 0) && (chars->size() > 0))
{
@ -496,7 +500,7 @@ namespace DocFileFormat
{
textType = std::wstring(L"delText");
}
else if (_writeInstrText)
else if ((!_fieldLevels.empty()) && (_fieldLevels.back().bBegin && !_fieldLevels.back().bSeparate))
{
textType = std::wstring(L"instrText");
}
@ -534,8 +538,7 @@ namespace DocFileFormat
}
else if (TextMark::PageBreakOrSectionMark == code)
{
//write page break, section breaks are written by writeParagraph() method
if (/*!isSectionEnd(c)*/_isSectionPageBreak == 0)
if (_isSectionPageBreak == 0)
{
writeTextElement(text, textType);
@ -560,31 +563,43 @@ namespace DocFileFormat
}
else if (TextMark::FieldBeginMark == code)
{
_fieldLevels.push_back(fieldLevels());
int cpFieldStart = initialCp + i;
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
std::wstring f;
if (cpFieldEnd < m_document->Text->size())
f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
std::wstring f, sFieldString;
if (cpFieldEnd < (int)m_document->Text->size())
sFieldString = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
std::wstring EMBED ( L" EMBED" );
std::wstring LINK ( L" LINK" );
std::wstring FORM ( L" FORM" );
std::wstring Excel ( L" Excel" );
std::wstring Word ( L" Word" );
std::wstring opendocument(L" opendocument" );
std::wstring Equation ( L" Equation" );
std::wstring MERGEFORMAT( L" MERGEFORMAT" );
std::wstring QUOTE ( L" QUOTE" );
std::vector<std::wstring> arField;
boost::algorithm::split(arField, sFieldString, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
std::wstring EMBED ( L"EMBED" );
std::wstring embed ( L"embed" );
std::wstring LINK ( L"LINK" );
std::wstring FORM ( L"FORM" );
std::wstring Excel ( L"Excel" );
std::wstring Word ( L"Word" );
std::wstring opendocument(L"opendocument" );
std::wstring Equation ( L"Equation" );
std::wstring MERGEFORMAT( L"MERGEFORMAT" );
std::wstring QUOTE ( L"QUOTE" );
std::wstring chart ( L"Chart" );
std::wstring PBrush ( L" PBrush" );
std::wstring TOC ( L" TOC" );
std::wstring HYPERLINK ( L" HYPERLINK" );
std::wstring PAGEREF ( L" PAGEREF" );
std::wstring PBrush ( L"PBrush" );
std::wstring TOC ( L"TOC" );
std::wstring HYPERLINK ( L"HYPERLINK" );
std::wstring PAGEREF ( L"PAGEREF" );
std::wstring PAGE ( L"PAGE" );
if (arField.empty() == false)
f = arField[0];
else
f = sFieldString;
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end();
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end() ||
search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end();
bool bLINK = search( f.begin(), f.end(), LINK.begin(), LINK.end()) != f.end();
bool bOpendocument = search( f.begin(), f.end(), opendocument.begin(), opendocument.end()) != f.end();
bool bFORM = search( f.begin(), f.end(), FORM.begin(), FORM.end()) != f.end();
@ -592,33 +607,59 @@ namespace DocFileFormat
bool bExcel = search( f.begin(), f.end(), Excel.begin(), Excel.end()) != f.end();
bool bWord = search( f.begin(), f.end(), Word.begin(), Word.end()) != f.end();
bool bHYPERLINK = search( f.begin(), f.end(), HYPERLINK.begin(), HYPERLINK.end()) != f.end();
bool bPAGEREF = search( f.begin(), f.end(), PAGEREF.begin(), PAGEREF.end()) != f.end();
bool bQUOTE = search( f.begin(), f.end(), QUOTE.begin(), QUOTE.end()) != f.end();
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
bool bPAGE = !bPAGEREF && search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
bool bPAGE = search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
bool bTOC = search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end();
bool bPAGEREF = false;
if (bHYPERLINK && arField.size() > 1)
{
std::wstring f1 = arField[1];
bPAGEREF = search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end();
}
if (bTOC)
_bContentWrite = true;
if ( bFORM )
{
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
std::wstring FORMTEXT ( L" FORMTEXT" );
std::wstring FORMCHECKBOX ( L" FORMCHECKBOX" );
std::wstring FORMDROPDOWN ( L" FORMDROPDOWN" );
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" );
m_pXmlWriter->WriteNodeEnd( L"", true, false );
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
bool bFORMTEXT = search( f.begin(), f.end(), FORMTEXT.begin(), FORMTEXT.end()) != f.end();
bool bFORMCHECKBOX = search( f.begin(), f.end(), FORMCHECKBOX.begin(), FORMCHECKBOX.end()) != f.end();
bool bFORMDROPDOWN = search( f.begin(), f.end(), FORMDROPDOWN.begin(), FORMDROPDOWN.end()) != f.end();
/*if (cpPic < cpFieldEnd)
if (bFORMTEXT || bFORMCHECKBOX || bFORMDROPDOWN)
{
int fcPic = _doc.PieceTable.FileCharacterPositions[cpPic];
CharacterPropertyExceptions chpxPic = _doc.GetCharacterPropertyExceptions(fcPic, fcPic + 1)[0];
NilPicfAndBinData npbd = new NilPicfAndBinData(chpxPic, _doc.DataStream);
FormFieldData ffdata = new FormFieldData(npbd.binData);
ffdata.Convert(new FormFieldDataMapping(m_pXmlWriter));
}*/
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
if (cpPic < cpFieldEnd)
{
int fcPic = m_document->FindFileCharPos( cpPic );
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
if (chpxs)
{
CharacterPropertyExceptions* chpxSep = chpxs->front();
FormFieldData ffdata (2, chpxSep, m_document->DataStream, false);
FormFieldDataMapping data_mapping(m_pXmlWriter, m_context, _caller);
ffdata.Convert(&data_mapping);
RELEASEOBJECT( chpxs );
}
}
}
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
_writeInstrText = true;
_fldCharCounter++;
_fieldLevels.back().bBegin = true;
}
else if ( ( bMERGEFORMAT || bExcel || bWord || bOpendocument )
&&
@ -632,61 +673,72 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
_writeInstrText = true;
_fldCharCounter++;
_fieldLevels.back().bBegin = true;
}
else if ( (bHYPERLINK && bPAGEREF) || bPAGE)
else if (bHYPERLINK && bPAGEREF)
{
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
std::vector<std::wstring> toc;
if ((search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end()) || bPAGE)
{
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
m_pXmlWriter->WriteNodeEnd( L"", true );
if (arField.size() > 1)
f = arField[1];
_writeInstrText = true;
_fldCharCounter++;
if ( _bContentWrite )
{
m_pXmlWriter->WriteNodeBegin( L"w:fldChar", true );
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
m_pXmlWriter->WriteNodeEnd( L"", true );
_fieldLevels.back().bBegin = true;
}
else
{
while ( cpFieldSep2 < cpFieldEnd)
for (size_t i = 1; i < arField.size(); i++)
{
cpFieldSep2 = searchNextTextMark(m_document->Text, cpFieldSep1 + 1, TextMark::FieldSeparator);
std::wstring f1( ( m_document->Text->begin() + cpFieldSep1 ), ( m_document->Text->begin() + cpFieldSep2 + 1 ) );
toc.push_back(f1);
if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
{
int d = f1.find(PAGEREF);
std::wstring f1 = arField[1];
int d = (int)f1.find(PAGEREF);
if (d > 0)
{
_writeWebHidden = true;
std::wstring _writeTocLink =f1.substr(d + 9);
d = _writeTocLink.find(L" ");
d = (int)_writeTocLink.find(L" ");
_writeTocLink = _writeTocLink.substr(0, d);
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
_writeAfterRun += _writeTocLink;
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
//if (_writeInstrText == true)
//{
// m_pXmlWriter->WriteNodeBegin( L"w:fldChar" ), true );
// m_pXmlWriter->WriteAttribute( L"w:fldCharType" ), L"separate" );
// m_pXmlWriter->WriteNodeEnd( L"" ), true );
//}
_writeInstrText = false;
break;
//cp = cpFieldSep1;
}
cpFieldSep1 = cpFieldSep2;
//cpFieldSep1 = cpFieldSep2;
}
_skipRuns = 5; //with separator
}
}
else if ( bEMBED || bLINK || bQUOTE)
//else if ( bHYPERLINK )
//{//todooo - выделение гиперссылки отдельно
// std::vector<std::wstring> arRefs;
// boost::algorithm::split(arRefs, f, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
//
// std::wstring sLink = arRefs[2];
// m_pXmlWriter->WriteNodeBegin( L"w:hyperlink", true );
// int relID = m_context->_docx->RegisterHyperlink(_caller, sLink);
// m_pXmlWriter->WriteAttribute( L"r:id", L"rId"+ FormatUtils::IntToWideString( relID ) );
// m_pXmlWriter->WriteAttribute( L"w:history", 1 );
// m_pXmlWriter->WriteNodeEnd( L"", true, false );
// if (arRefs.size() > 2)
// {
// writeTextElement(arRefs[3].substr(1, arRefs[3].length() - 2), textType);
// }
// m_pXmlWriter->WriteNodeEnd( L"w:hyperlink", false, true );
// _skipRuns = 1;
//}
else if ( bEMBED || (bLINK && !bHYPERLINK)|| bQUOTE)
{
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
@ -714,9 +766,9 @@ namespace DocFileFormat
if (!m_shapeIdOwner.empty()) //4571833.doc
oVmlMapper.m_shapeId = m_shapeIdOwner;
if (m_document->bOlderVersion)
{
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
if (m_document->nWordVersion > 0)
{
OleObject ole ( chpxObj, m_document);
oleWriter.WriteNodeBegin (L"w:object", true);
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
@ -732,7 +784,7 @@ namespace DocFileFormat
}
else
{
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
oleWriter.WriteNodeBegin (L"w:object", true);
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
@ -750,7 +802,7 @@ namespace DocFileFormat
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
CharacterPropertyExceptions* chpxSep = chpxs->front();
OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion);
OleObject ole ( chpxSep, m_document);
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
if (oVmlMapper.m_isEmbedded)
@ -790,15 +842,16 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( L"w:fldCharType", L"begin" );
m_pXmlWriter->WriteNodeEnd( L"", true );
_writeInstrText = true;
_fldCharCounter++;
_fieldLevels.back().bBegin = true;
}
}
else if (TextMark::FieldSeparator == code)
{
if (_fldCharCounter > 0)
if (!_fieldLevels.empty())
{
XMLTools::XMLElement elem( L"w:fldChar" );
_fieldLevels.back().bSeparate = true;
XMLTools::XMLElement elem( L"w:fldChar" );
elem.AppendAttribute( L"w:fldCharType", L"separate" );
m_pXmlWriter->WriteString( elem.GetXMLString() );
@ -807,26 +860,34 @@ namespace DocFileFormat
}
else if (TextMark::FieldEndMark == code)
{
if (_fldCharCounter > 0)
{
XMLTools::XMLElement elem( L"w:fldChar" );
elem.AppendAttribute( L"w:fldCharType", L"end" );
if (!_fieldLevels.empty())
{
if (!text.empty())
{
writeTextElement(text, textType);
text.clear();
}
if (_fieldLevels.back().bBegin)
{
_fieldLevels.back().bEnd = true;
XMLTools::XMLElement elem( L"w:fldChar" );
elem.AppendAttribute( L"w:fldCharType", L"end" );
m_pXmlWriter->WriteString( elem.GetXMLString());
m_pXmlWriter->WriteString( elem.GetXMLString());
}
_fldCharCounter--;
_fieldLevels.pop_back();
}
if (_writeWebHidden)
{
_writeAfterRun = std::wstring (L"</w:hyperlink>");
}
_writeWebHidden = false;
if ( _fldCharCounter == 0 )
{
_writeInstrText = false;
}
_writeWebHidden = false;
_embeddedObject = false;
if (_fieldLevels.empty())
_bContentWrite = false;
}
else if ((TextMark::Symbol == code) && fSpec)
{
@ -852,7 +913,7 @@ namespace DocFileFormat
if (pSpa)
{
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->bOlderVersion);
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
if (pShape)
@ -874,9 +935,9 @@ namespace DocFileFormat
}
}
}
else if ((TextMark::Picture == code) && fSpec )
else if (TextMark::Picture == code && fSpec)
{
PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
PictureDescriptor oPicture (chpx, m_document->nWordVersion > 0 ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
bool isInline = _isTextBoxContent;
@ -912,7 +973,7 @@ namespace DocFileFormat
if (oVmlMapper.m_isEmbedded)
{
OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion);
OleObject ole ( chpx, m_document);
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
ole.isEquation = oVmlMapper.m_isEquation;
@ -1113,20 +1174,7 @@ namespace DocFileFormat
if ( fc >= nMinVal )
{
ret = m_document->AllPapx->find(nMinVal)->second;
//? if (!ret && m_document->AllPapx->size() > 0)
//? {
//? map<int, ParagraphPropertyExceptions*>::iterator it = m_document->AllPapx->end();
//? it--;
//? do
//? {
//? if (it->first < nMinVal && it->second)
//? break;
//? it--;
//? }
//? while(it != m_document->AllPapx->begin());
//?
//? ret = it->second;
//? }
_lastValidPapx = ret;
}
}
@ -1173,21 +1221,23 @@ namespace DocFileFormat
int fc2 = m_document->FindFileCharPos( cp );
int fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
//build the table grid
std::vector<short>* grid = buildTableGrid( cp, nestingLevel );
std::vector<short> grid;
buildTableGrid( cp, nestingLevel, grid);
//find first row end
int fcRowEnd = findRowEndFc( cp, nestingLevel );
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
//start table
m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
//Convert it
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, grid );
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid);
row1Tapx.Convert( tpMapping );
@ -1200,11 +1250,11 @@ namespace DocFileFormat
//only convert the cells with the given nesting level
while ( tai.iTap == nestingLevel )
{
cp = writeTableRow( cp, grid, nestingLevel );
cp = writeTableRow( cp, &grid, nestingLevel );
//?fc = m_document->FindFileCharPos(cp );
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
}
}
else
@ -1213,92 +1263,151 @@ namespace DocFileFormat
//convert until the end of table is reached
while ( tai.fInTable )
{
cp = writeTableRow( cp, grid, nestingLevel );
cp = writeTableRow( cp, &grid, nestingLevel );
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
}
}
//close w:tbl
m_pXmlWriter->WriteNodeEnd( L"w:tbl" );
RELEASEOBJECT( grid );
return cp;
}
// Builds a list that contains the width of the several columns of the table.
std::vector<short>* DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel)
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid)
{
ParagraphPropertyExceptions* backup = _lastValidPapx;
std::vector<short> boundaries;
std::vector<short>* grid = new std::vector<short>();
std::map<short, short> boundaries;
int cp = initialCp;
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
int fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
ParagraphPropertyExceptions* papx_prev = NULL;
short max_boundary = -1;
bool fEndNestingLevel = false;
unsigned int iTap_current = 1;
while ( tai.fInTable )
{
//check all SPRMs of this TAPX
iTap_current = 1;
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
//find the tDef SPRM
if ( iter->OpCode == sprmTDefTable || iter->OpCode == sprmOldTDefTable)
DWORD code = iter->OpCode;
switch(iter->OpCode)
{
unsigned char itcMac = iter->Arguments[0];
for (int i = 0; i < itcMac; i++)
case sprmPFInnerTableCell:
case sprmPFInnerTtp:
{
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
fEndNestingLevel = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}break;
if ( find( boundaries.begin(), boundaries.end(), boundary1 ) == boundaries.end() )
case sprmPItap:
{
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
}break;
}
}
if (nestingLevel == iTap_current)
{
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
//find the tDef SPRM
DWORD code = iter->OpCode;
switch(iter->OpCode)
{
case sprmTDefTable:
case sprmOldTDefTable:
{
boundaries.push_back( boundary1 );
}
unsigned char itcMac = iter->Arguments[0];
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
short boundary1, boundary2;
for (unsigned char i = 0; i < itcMac; i++)
{
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
if ( find( boundaries.begin(), boundaries.end(), boundary2 ) == boundaries.end() )
{
boundaries.push_back( boundary2 );
}
AddBoundary(boundary1, boundary2, boundaries);
}
if (max_boundary < boundary2)
max_boundary = boundary2;
AddBoundary(boundary2, max_boundary, boundaries);
}break;
}
}
}
if (nestingLevel > 1 && fEndNestingLevel && !boundaries.empty())
break;
//get the next papx
papx = findValidPapx( fcRowEnd );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
if (papx_prev && papx_prev == papx )
break;//file(12).doc
papx_prev = papx;
}
//build the grid based on the boundaries
sort( boundaries.begin(), boundaries.end() );
}
if ( !boundaries.empty() )
{
for ( unsigned int i = 0; i < ( boundaries.size() - 1 ); i++ )
for ( std::map<short, short>::iterator it = boundaries.begin(); it != boundaries.end(); ++it)
{
grid->push_back( boundaries[i + 1] - boundaries[i] );
grid.push_back( it->second );
}
}
_lastValidPapx = backup;
return grid;
return true;
}
void DocumentMapping::AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries)
{
if (boundary2 - boundary1 < 3)
return;
std::map<short, short>::iterator pFind = boundaries.find(boundary1);
while(true)
{
if (pFind == boundaries.end())
{
boundaries.insert(std::make_pair(boundary1, boundary2 - boundary1));
break;
}
else if (pFind->second != boundary2 - boundary1)
{
if (pFind->second > boundary2 - boundary1)
{
short new_size = boundary2 - boundary1;
boundary1 = boundary2;
boundary2 = pFind->second + pFind->first;
pFind->second = new_size;
}
else
{
boundary1 = pFind->second + pFind->first;
}
pFind = boundaries.find(boundary1);
}
else
break;
}
}
// Finds the FC of the next row end mark.
@ -1308,7 +1417,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
if ( nestingLevel > 1 )
{
@ -1324,7 +1433,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
cp++;
}
@ -1347,7 +1456,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
cp++;
}
}
@ -1366,7 +1475,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
if ( nestingLevel > 1 )
{
@ -1386,7 +1495,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
cp++;
}
@ -1409,7 +1518,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
cp++;
}
}
@ -1424,14 +1533,14 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
//start w:tr
m_pXmlWriter->WriteNodeBegin( L"w:tr" );
//convert the properties
int fcRowEnd = findRowEndFc( cp, nestingLevel );
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
TableRowPropertiesMapping* trpMapping = new TableRowPropertiesMapping( m_pXmlWriter, *(chpxs->begin()) );
@ -1455,7 +1564,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos(cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
}
}
else
@ -1472,7 +1581,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
}
}
@ -1491,15 +1600,10 @@ namespace DocFileFormat
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel )
{
int cp = initialCp;
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
//find cell end
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//convert the properties
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, gridIndex, cellIndex );
XMLTools::CStringXmlWriter writerTcPr;
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( &writerTcPr, grid, gridIndex, cellIndex, nestingLevel );
if ( tapx != NULL )
{
@ -1508,8 +1612,19 @@ namespace DocFileFormat
gridIndex = gridIndex + tcpMapping->GetGridSpan();
bool bCoverCell = tcpMapping->IsCoverCell();
RELEASEOBJECT( tcpMapping );
if (bCoverCell)
{
return cpCellEnd;
}
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
m_pXmlWriter->WriteString(writerTcPr.GetXmlString());
//write the paragraphs of the cell
while ( cp < cpCellEnd )
{
@ -1517,7 +1632,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
//cp = writeParagraph(cp);
@ -1537,7 +1652,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
cp = writeParagraph( cp, 0x7fffffff );
}
}
@ -1556,7 +1671,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( initialCp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
while ( !tai.fInnerTableCell )
{
@ -1565,7 +1680,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cpCellEnd );
papx = findValidPapx( fc );
tai = TableInfo( papx );
tai = TableInfo( papx, m_document->nWordVersion );
}
cpCellEnd++;
@ -1686,13 +1801,8 @@ namespace DocFileFormat
// Checks if the CHPX is special
bool DocumentMapping::isSpecial(CharacterPropertyExceptions* chpx)
{
/*
for (list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
{
short value = FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize);
int c = 0;
}
*/
if (!chpx) return false;
if (!chpx->grpprl) return false;
for (std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
{
@ -1762,6 +1872,11 @@ namespace DocFileFormat
{
SectionPropertyExceptions* ret = NULL;
if (!m_document->AllSepx)
{
return ret;
}
try
{
ret = m_document->AllSepx->operator [](cp);

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -48,6 +48,8 @@
#include "OleObjectMapping.h"
#include "ConversionContext.h"
#include "IMapping.h"
#include "FormFieldData.h"
#include "FormFieldDataMapping.h"
namespace DocFileFormat
{
@ -85,7 +87,7 @@ namespace DocFileFormat
bool isSectionEnd ( int cp );
// Writes a Paragraph that starts at the given cp and
// ends at the next paragraph end mark or section end mark
int writeParagraph( int cp );
int writeParagraph( int cp, int cpEnd );
// Writes a Paragraph that starts at the given cpStart and
// ends at the given cpEnd
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
@ -108,7 +110,7 @@ namespace DocFileFormat
// Writes the table starts at the given cp value
int writeTable ( int initialCp, unsigned int nestingLevel );
// Builds a list that contains the width of the several columns of the table.
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid);
// Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
// Finds the FC of the next row end mark.
@ -133,6 +135,8 @@ namespace DocFileFormat
// Searches the given vector for the next FieldEnd character.
int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark );
Symbol getSymbol ( const CharacterPropertyExceptions* chpx );
void AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries);
//----------------------------------------------------------------------------------------------------------------------
bool m_bInternalXmlWriter;
@ -152,11 +156,19 @@ namespace DocFileFormat
int _commentNr;
bool _isTextBoxContent;
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues
bool _writeInstrText;
bool _writeWebHidden;
unsigned int _fldCharCounter;
std::wstring _writeAfterRun;
std::wstring _lastOLEObject;
int _cacheListNum;
struct fieldLevels
{
bool bBegin = false;
bool bSeparate = false;
//bool bInstrText = false;
bool bEnd = false;
};
std::vector<fieldLevels> _fieldLevels;
bool _bContentWrite;
};
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -48,22 +48,89 @@ namespace DocFileFormat
{
Initialize();
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_bOlderVersion);
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_nWordVersion);
//setDefaultCompatibilityOptions( fib->m_FibBase.nFib );
unsigned int size = fib->m_FibWord97.lcbDop;
unsigned char* bytes = tStream.ReadBytes( size, true );
unsigned int size = fib->m_FibWord97.lcbDop;
unsigned char* bytes = NULL;
try
{
if ( size > 0 )
if (fib->m_nWordVersion == 2)
{
unsigned char* Temp = tStream.ReadBytes(size, true);
tStream.Seek(fib->m_FibWord97.fcDop, 0);
delete []Temp;
unsigned char flags1 = tStream.ReadByte();
fFacingPages = GETBIT(flags1, 0);
fWindowControl = GETBIT(flags1, 1);
Fpc = GETBITS(flags1, 5, 6);
bool fWide = GETBIT(flags1, 7);
grpfIhdt = tStream.ReadByte();
unsigned short flags2 = tStream.ReadUInt16();
rncFtn = GETBIT(flags2, 0);
nFtn = GETBITS(flags2, 1, 15);
unsigned char irmBar = tStream.ReadByte();
unsigned char flags3 = tStream.ReadByte();
unsigned char irmProps = GETBITS(flags3, 0, 6);
fRevMarking = GETBIT(flags3, 7);
unsigned short flags4 = tStream.ReadUInt16();
fBackup = GETBIT(flags4, 0);
fExactWords = GETBIT(flags4, 1);
fPagHidden = GETBIT(flags4, 2);
fPagResults = GETBIT(flags4, 3);
fLockAtn = GETBIT(flags4, 4);
fMirrorMargins = GETBIT(flags4, 5);
bool fKeepFileFormat = GETBIT(flags4, 6);
fDflttrueType = GETBIT(flags4, 7);
fPagSuppressTopSpacing = GETBIT(flags4, 8);
fMaybeRTLTables = GETBIT(flags4, 9);
bool fSpares = tStream.ReadUInt16();
dxaTab = tStream.ReadUInt16();
wSpare = tStream.ReadUInt16();//ftcDefaultBi
dxaHotZ = tStream.ReadUInt16();
wSpare2 = tStream.ReadUInt16();
wSpare3 = tStream.ReadUInt16();
dttmCreated = DateAndTime( tStream.ReadUInt32() );
dttmRevised = DateAndTime( tStream.ReadUInt32() );
dttmLastPrint = DateAndTime( tStream.ReadUInt32() );
nRevision = tStream.ReadUInt16();
tmEdited = tStream.ReadUInt32();
cWords = tStream.ReadUInt32();
cCh = tStream.ReadUInt32();
cPg = tStream.ReadUInt16();
unsigned short rgwSpareDocSum[2];
rgwSpareDocSum[0] = tStream.ReadUInt16();
rgwSpareDocSum[1] = tStream.ReadUInt16();
}
else if ( size > 0 )
{
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
bytes = tStream.ReadBytes( size, true );
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
fWindowControl = FormatUtils::GetBitFromBytes( bytes, 2, 1 );
fPMHMainDoc = FormatUtils::GetBitFromBytes( bytes, 2, 2 );
grfSuppression = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 3, 2 );
Fpc = (short)(short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
Fpc = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
grpfIhdt = FormatUtils::BytesToUChar( bytes, 1, size );
rncFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 0, 2 );
nFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 2, 14 );
@ -545,6 +612,7 @@ namespace DocFileFormat
fSwapBordersFacingPgs = false;
dxaTab = 0;
wSpare = 0;
wSpare3 = 0;
dxaHotZ = 0;
cConsecHypLim = 0;
wSpare2 = 0;

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -177,7 +177,8 @@ namespace DocFileFormat
unsigned short cConsecHypLim;
// Reserved
unsigned short wSpare2;
// Date and time document was created
unsigned short wSpare3;
// Date and time document was created
DateAndTime dttmCreated;
// Date and time document was last revised
DateAndTime dttmRevised;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,143 +35,148 @@
namespace DocFileFormat
{
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream )
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream ) : bStandard(false), bXOR(false), bAES(false)
{
VirtualStreamReader tStream( tableStream, 0, fib->m_bOlderVersion);
VirtualStreamReader tStream( tableStream, 0, fib->m_nWordVersion);
if (fib->m_FibBase.fObfuscation)
if (fib->m_FibBase.fObfuscation || fib->m_nWordVersion > 0)
{
//xor
return;
}
unsigned short vMajor = tStream.ReadUInt16();
unsigned short vMinor = tStream.ReadUInt16();
if(0x0001 == vMajor) // RC4 encryption header structure
{// fib->m_FibBase.lKey == 52
bStandard = true;
crypt_data_rc4.Salt.b1 = tStream.ReadUInt32();
crypt_data_rc4.Salt.b2 = tStream.ReadUInt32();
crypt_data_rc4.Salt.b3 = tStream.ReadUInt32();
crypt_data_rc4.Salt.b4 = tStream.ReadUInt32();
bXOR = true;
crypt_data_rc4.EncryptedVerifier.b1 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b2 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b3 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b4 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b1 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b2 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b3 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b4 = tStream.ReadUInt32();
crypt_data_xor.key = fib->m_FibBase.lKey >> 16;
crypt_data_xor.hash = fib->m_FibBase.lKey - (crypt_data_xor.key << 16);
}
else
{
bStandard = false;
crypt_data_aes.bAgile = false;
unsigned short vMajor = tStream.ReadUInt16();
unsigned short vMinor = tStream.ReadUInt16();
unsigned short flags = tStream.ReadUInt32();
unsigned char *pDataRead = NULL;
if(0x0001 == vMajor) // RC4 encryption header structure
{// fib->m_FibBase.lKey == 52
bStandard = true;
bool fCryptoAPI = GETBIT(flags, 1);
bool fDocProps = GETBIT(flags, 2);
bool fExternal = GETBIT(flags, 3);
bool fAES = GETBIT(flags, 4);
//EncryptionHeader
int HeaderSize = tStream.ReadUInt32();
int Flags = tStream.ReadUInt32();
int SizeExtra = tStream.ReadUInt32();
int AlgID = tStream.ReadUInt32();
int AlgIDHash = tStream.ReadUInt32();
int KeySize = tStream.ReadUInt32();
int ProviderType= tStream.ReadUInt32();
int Reserved1 = tStream.ReadUInt32();
int Reserved2 = tStream.ReadUInt32();
int pos = tStream.GetPosition();
int size = tStream.GetSize();
std::vector<char> dataCSPName;
while(pos < size - 1)
crypt_data_rc4.Salt.b1 = tStream.ReadUInt32();
crypt_data_rc4.Salt.b2 = tStream.ReadUInt32();
crypt_data_rc4.Salt.b3 = tStream.ReadUInt32();
crypt_data_rc4.Salt.b4 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b1 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b2 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b3 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifier.b4 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b1 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b2 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b3 = tStream.ReadUInt32();
crypt_data_rc4.EncryptedVerifierHash.b4 = tStream.ReadUInt32();
}
else
{
dataCSPName.push_back(tStream.ReadByte());
dataCSPName.push_back(tStream.ReadByte());
if (dataCSPName[dataCSPName.size() - 1] == 0 && dataCSPName[dataCSPName.size() - 2] == 0)
bAES = true;
crypt_data_aes.bAgile = false;
unsigned short flags = tStream.ReadUInt32();
unsigned char *pDataRead = NULL;
bool fCryptoAPI = GETBIT(flags, 1);
crypt_data_aes.fDocProps = GETBIT(flags, 2);
bool fExternal = GETBIT(flags, 3);
bool fAES = GETBIT(flags, 4);
//EncryptionHeader
int HeaderSize = tStream.ReadUInt32();
int Flags = tStream.ReadUInt32();
int SizeExtra = tStream.ReadUInt32();
int AlgID = tStream.ReadUInt32();
int AlgIDHash = tStream.ReadUInt32();
int KeySize = tStream.ReadUInt32();
int ProviderType= tStream.ReadUInt32();
int Reserved1 = tStream.ReadUInt32();
int Reserved2 = tStream.ReadUInt32();
int pos = tStream.GetPosition();
int size = tStream.GetSize();
std::vector<char> dataCSPName;
while(pos < size - 1)
{
dataCSPName.push_back(tStream.ReadByte());
dataCSPName.push_back(tStream.ReadByte());
if (dataCSPName[dataCSPName.size() - 1] == 0 && dataCSPName[dataCSPName.size() - 2] == 0)
{
break;
}
pos+=2;//unicode null-terminate string
}
//EncryptionVerifier
crypt_data_aes.saltSize = tStream.ReadUInt32();
pDataRead = tStream.ReadBytes(crypt_data_aes.saltSize, true);
if (pDataRead)
{
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
delete pDataRead;
}
pDataRead = tStream.ReadBytes(0x10, true);
if (pDataRead)
{
crypt_data_aes.encryptedVerifierInput = std::string((char*)pDataRead, 0x10);
delete pDataRead;
}
crypt_data_aes.hashSize = tStream.ReadUInt32();
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
pDataRead = tStream.ReadBytes(szEncryptedVerifierHash, true);
if (pDataRead)
{
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
delete pDataRead;
}
pos = tStream.GetPosition();
//------------------------------------------------------------------------------------------
switch(AlgIDHash)
{
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
case 0x0000:
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
}
crypt_data_aes.spinCount = 0;
switch(AlgID)
{
case 0x0000:
if (fAES) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
if (fCryptoAPI) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
crypt_data_aes.keySize = KeySize / 8;
case 0x6801:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
crypt_data_aes.keySize = KeySize / 8;
if (crypt_data_aes.keySize == 0) crypt_data_aes.keySize = 5; // 40 bit
break;
case 0x660E:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
crypt_data_aes.keySize = 128 /8;
break;
case 0x660F:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
crypt_data_aes.keySize = 192 /8;
break;
case 0x6610:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
crypt_data_aes.keySize = 256 /8;
break;
}
pos+=2;//unicode null-terminate string
}
//EncryptionVerifier
crypt_data_aes.saltSize = tStream.ReadUInt32();
pDataRead = tStream.ReadBytes(crypt_data_aes.saltSize, true);
if (pDataRead)
{
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
delete pDataRead;
}
pDataRead = tStream.ReadBytes(0x10, true);
if (pDataRead)
{
crypt_data_aes.encryptedVerifierInput = std::string((char*)pDataRead, 0x10);
delete pDataRead;
}
crypt_data_aes.hashSize = tStream.ReadUInt32();
int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20;
pDataRead = tStream.ReadBytes(szEncryptedVerifierHash, true);
if (pDataRead)
{
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
delete pDataRead;
//switch(ProviderType)
//{
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
//}
}
pos = tStream.GetPosition();
//------------------------------------------------------------------------------------------
switch(AlgIDHash)
{
case 0x8003: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::MD5; break;
case 0x0000:
case 0x8004: crypt_data_aes.hashAlgorithm = CRYPT_METHOD::SHA1; break;
}
crypt_data_aes.spinCount = 0;
switch(AlgID)
{
case 0x0000:
if (fAES) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
if (fCryptoAPI) crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
crypt_data_aes.keySize = KeySize / 8;
case 0x6801:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4;
crypt_data_aes.keySize = KeySize / 8;
if (crypt_data_aes.keySize == 0) crypt_data_aes.keySize = 5; // 40 bit
break;
case 0x660E:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
crypt_data_aes.keySize = 128 /8;
break;
case 0x660F:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
crypt_data_aes.keySize = 192 /8;
break;
case 0x6610:
crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB;
crypt_data_aes.keySize = 256 /8;
break;
}
//switch(ProviderType)
//{
// case 0x0001: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::RC4; break;
// case 0x0018: crypt_data_aes.cipherAlgorithm = CRYPT_METHOD::AES_ECB; break;
//}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -52,6 +52,10 @@ namespace DocFileFormat
private:
CRYPT::_rc4CryptData crypt_data_rc4;
CRYPT::_ecmaCryptData crypt_data_aes;
CRYPT::_xorCryptData crypt_data_xor;
bool bStandard;
bool bXOR;
bool bAES;
};
}

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -79,7 +79,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
if ( tai.fInTable )
{
@ -91,7 +91,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
cp = writeParagraph( cp, 0x7fffffff );
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -69,14 +69,22 @@ namespace DocFileFormat
newObject->prq = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x03 );
newObject->fTrueType = FormatUtils::BitmaskToBool ( ffid, 0x04 );
newObject->ff = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x70 );
newObject->wWeight = reader->ReadInt16();
newObject->chs = reader->ReadByte();
//int sz_fonts = 150; //.. нужно генерить уникальное todooo
int szAlt = 0;
if (reader->nWordVersion == 2)
{
newObject->wWeight = reader->ReadByte();
}
else
{
newObject->wWeight = reader->ReadInt16();
newObject->chs = reader->ReadByte();
int szAlt = reader->ReadByte();
szAlt = reader->ReadByte();
}
if (!reader->olderVersion)
if (reader->nWordVersion == 0)
{
//read the 10 bytes panose
newObject->panoseSize = 10;
@ -97,7 +105,7 @@ namespace DocFileFormat
unsigned char *bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
if (reader->olderVersion)
if (reader->nWordVersion > 0)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszFtn), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250 );
}
@ -131,7 +139,7 @@ namespace DocFileFormat
bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
if (reader->olderVersion)
if (reader->nWordVersion > 0)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszAlt), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250);
}
@ -151,7 +159,7 @@ namespace DocFileFormat
{
long strStart = reader->GetPosition();
if (reader->olderVersion)
if (reader->nWordVersion > 0)
{//ansi string only
while ( reader->ReadByte() != 0 )
{

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -48,7 +48,8 @@ namespace DocFileFormat
class FontFamilyName: public ByteStructure
{
friend class CharacterPropertiesMapping;
friend class WordDocument;
friend class CharacterPropertiesMapping;
friend class DocumentMapping;
friend class FontTableMapping;
friend class StyleSheetMapping;

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,32 +34,30 @@
namespace DocFileFormat
{
FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
FontTableMapping::FontTableMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
{
_ctx = ctx;
}
/*========================================================================================================*/
FontTableMapping::~FontTableMapping()
{
RELEASEOBJECT (m_pXmlWriter);
}
/*========================================================================================================*/
void FontTableMapping::Apply( IVisitable* visited )
{
StringTable<FontFamilyName>* table = static_cast<StringTable<FontFamilyName>*>( visited );
this->_ctx->_docx->RegisterFontTable();
_ctx->_docx->RegisterFontTable();
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
m_pXmlWriter->WriteNodeBegin( L"w:fonts", TRUE );
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
int sz_fonts = table->Data.size();
int sz_fonts = table->Data.size();
int users_fonts = 0;
for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ )
@ -140,6 +138,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( L"w:fonts");
this->_ctx->_docx->FontTableXML = std::wstring( m_pXmlWriter->GetXmlString() );
_ctx->_docx->FontTableXML = m_pXmlWriter->GetXmlString() ;
}
}

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -71,7 +71,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
if ( tai.fInTable )
{
@ -89,7 +89,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
cp = writeParagraph( cp, 0x7fffffff );
}
}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -81,7 +81,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
if ( tai.fInTable )
{
@ -93,7 +93,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
cp = writeParagraph( cp, 0x7fffffff );
}
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
cp++;

View File

@ -0,0 +1,170 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "FormFieldData.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
namespace DocFileFormat
{
std::wstring readXstz(VirtualStreamReader *reader)
{
if (!reader) return L"";
unsigned short flags, cch, chTerm;
cch = reader->ReadUInt16();
std::wstring ret;
if (cch > 0)
{
std::shared_ptr<unsigned char>data = std::shared_ptr<unsigned char>(reader->ReadBytes(cch * 2, true));
#if defined(_WIN32) || defined(_WIN64)
ret = std::wstring((wchar_t*)data.get(), cch );
#else
ret = convertUtf16ToWString((UTF16*)data.get(), cch );
#endif
}
chTerm = reader->ReadUInt16();
return ret;
};
void FormFieldData::_HFD::read(VirtualStreamReader *reader)
{
if (!reader) return;
}
void FormFieldData::_FFData::read(VirtualStreamReader *reader)
{
if (!reader) return;
bExist = true;
unsigned short flags;
version = reader->ReadUInt32();
flags = reader->ReadUInt16();
iType = GETBITS(flags, 0, 1);
iRes = GETBITS(flags, 2, 6);
fOwnHelp = GETBIT(flags, 7);
fOwnStat = GETBIT(flags, 8);
fProt = GETBIT(flags, 9);
iSize = GETBIT(flags, 10);
iTypeTxt = GETBITS(flags, 11, 13);
fRecalc = GETBIT(flags, 14);
fHasListBox = GETBIT(flags, 15);
cch_field = reader->ReadUInt16();
hps = reader->ReadUInt16();
xstzName = readXstz(reader);
xstzTextDef = readXstz(reader);
wDef = reader->ReadUInt16();
xstzTextFormat = readXstz(reader);
xstzHelpText = readXstz(reader);
xstzStatText = readXstz(reader);
xstzEntryMcr = readXstz(reader);
xstzExitMcr = readXstz(reader);
}
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion )
{
binary_data_size = 0;
if (!chpx) return;
int fc = -1;
bool bNilPICFAndBinData = false;
for ( std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
{
switch ( iter->OpCode)
{
case sprmCFSpec:
{
}
break;
case sprmCFFldVanish:
{
}
break;
case sprmCPicLocation:
{
fc = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
}
break;
case sprmCRsidText:
{
rsid = FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize), L"%08x");
}
break;
case sprmCFData:
{
bNilPICFAndBinData = true; // or bPICFAndOfficeArtData - shape, pic, ole
}
break;
}
}
if (fc >= 0 && bNilPICFAndBinData)
{
VirtualStreamReader reader(stream, fc, nWordVersion);
int sz_stream = reader.GetSize();
int lcb = reader.ReadUInt32();
int cbHeader = reader.ReadUInt16();
if (cbHeader != 0x44) return;
//ignored
reader.ReadBytes(62, false);
switch(type)
{
case 1:
HFD.read(&reader);
case 2:
FFData.read(&reader);
break;
default:
binary_data_size = lcb - cbHeader;
binary_data = std::shared_ptr<unsigned char>(reader.ReadBytes(binary_data_size, true));
break;
}
}
}
}

View File

@ -0,0 +1,126 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "IVisitable.h"
#include "CharacterPropertyExceptions.h"
#include "StructuredStorageReader.h"
#include "VirtualStreamReader.h"
namespace DocFileFormat
{
class FormFieldData : public IVisitable
{
public:
struct _HFD
{
bool bExist = false;
bool fNew = false;
bool fNoHist = false;
bool fImageMap = false;
bool fLocation = false;
bool fTooltip = false;
std::wstring clsid;
_UINT32 streamVersion = 0;
bool hlstmfHasMoniker = false;
bool hlstmfIsAbsolute = false;
bool hlstmfSiteGaveDisplayName = false;
bool hlstmfHasLocationStr = false;
bool hlstmfHasDisplayName = false;
bool hlstmfHasGUID = false;
bool hlstmfHasCreationTime = false;
bool hlstmfHasFrameName = false;
bool hlstmfMonikerSavedAsStr = false;
bool hlstmfAbsFromGetdataRel = false;
std::wstring displayName;
std::wstring targetFrameName;
std::wstring moniker;
std::wstring oleMoniker_clsid;
std::wstring oleMoniker_data;
std::wstring location;
std::wstring guid;
_UINT64 fileTime = 0;
void read(VirtualStreamReader* reader);
};
struct _FFData
{
bool bExist = false;
_UINT32 version = 0;
unsigned char iType = 0;
unsigned char iRes = 0;
bool fOwnHelp = false;
bool fOwnStat = false;
bool fProt = false;
bool iSize = false;
unsigned char iTypeTxt = 0;
bool fRecalc = false;
bool fHasListBox = false;
unsigned short cch_field = 0;
unsigned short hps = 0;
std::wstring xstzName;
std::wstring xstzTextDef;
unsigned short wDef = 0;
std::wstring xstzTextFormat;
std::wstring xstzHelpText;
std::wstring xstzStatText;
std::wstring xstzEntryMcr;
std::wstring xstzExitMcr;
//STTB hsttbDropList;
void read(VirtualStreamReader* reader);
};
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion );
virtual ~FormFieldData() {}
private:
friend class FormFieldDataMapping;
std::wstring name;
std::wstring rsid;
_FFData FFData;
_HFD HFD;
std::shared_ptr<unsigned char> binary_data;
int binary_data_size;
};
}

View File

@ -0,0 +1,87 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "ConversionContext.h"
#include "FormFieldData.h"
#include "AbstractOpenXmlMapping.h"
#include "IMapping.h"
namespace DocFileFormat
{
class FormFieldDataMapping: public AbstractOpenXmlMapping, public IMapping
{
public:
FormFieldDataMapping(XMLTools::CStringXmlWriter* writer, ConversionContext* context, IMapping* caller)
: AbstractOpenXmlMapping(writer), m_context(NULL),_caller(NULL)
{
m_context = context;
_caller = caller;
}
virtual void Apply(IVisitable* visited)
{
FormFieldData* ffData = static_cast<FormFieldData*>(visited);
if ( ffData == NULL ) return;
if (ffData->FFData.bExist)
{
m_pXmlWriter->WriteNodeBegin( L"w:ffData");
m_pXmlWriter->WriteNodeBegin( L"w:name", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.xstzName);
m_pXmlWriter->WriteNodeEnd(L"w:name", true, true );
m_pXmlWriter->WriteNodeBegin( L"w:calcOnExit", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.fRecalc);
m_pXmlWriter->WriteNodeEnd(L"w:calcOnExit", true, true );
m_pXmlWriter->WriteNodeBegin( L"w:textInput");
m_pXmlWriter->WriteNodeBegin( L"w:maxLength", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.cch_field);
m_pXmlWriter->WriteNodeEnd(L"w:maxLength", true, true );
m_pXmlWriter->WriteNodeEnd( L"w:textInput" );
m_pXmlWriter->WriteNodeEnd( L"w:ffData" );
}
}
private:
ConversionContext* m_context;
IMapping* _caller;
};
}

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -52,8 +52,8 @@ namespace DocFileFormat
/*========================================================================================================*/
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion ):
FormattedDiskPage(), rgb(NULL), grpchpxSize(NULL), grpchpx(NULL)
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion ):
FormattedDiskPage(), rgb(NULL), grpchpxSize(0), grpchpx(NULL)
{
Type = Character;
WordStream = wordStream;
@ -80,7 +80,6 @@ namespace DocFileFormat
j += 4;
}
//create arrays
grpchpxSize = crun;
rgb = new unsigned char[crun];
grpchpx = new CharacterPropertyExceptions*[grpchpxSize];
@ -104,11 +103,10 @@ namespace DocFileFormat
//read the bytes of chpx
chpx = new unsigned char[cb];
//Array.Copy(bytes, (wordOffset * 2) + 1, chpx, 0, chpx.Length);
memcpy( chpx, ( bytes + (wordOffset * 2) + 1 ), cb );
//parse CHPX and fill grpchpx
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, oldVersion);
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, nWordVersion);
RELEASEARRAYOBJECTS( chpx );
}
@ -139,7 +137,7 @@ namespace DocFileFormat
}
//there are n offsets and n-1 fkp's in the bin table
if (fib->m_bOlderVersion)
if (fib->m_nWordVersion > 0)
{
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBteChpx - 8 ) / 6 ) + 1;
@ -162,7 +160,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
}
}
else
@ -178,7 +176,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
}
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -50,7 +50,7 @@ namespace DocFileFormat
public:
virtual ~FormattedDiskPageCHPX();
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion );
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion );
/// Parses the 0Table (or 1Table) for FKP _entries containing CHPX
static std::list<FormattedDiskPageCHPX*>* GetAllCHPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream );
};

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -52,59 +52,53 @@ namespace DocFileFormat
/*========================================================================================================*/
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex):
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex):
FormattedDiskPage(), rgbx(NULL), grppapxSize(0), grppapx(NULL)
{
Type = Paragraph;
WordStream = wordStream;
{
Type = Paragraph;
WordStream = wordStream;
//read the 512 bytes (FKP)
unsigned char* bytes = NULL;
bytes = new unsigned char[512];
WordStream->seek( offset);
WordStream->read( bytes, 512);
//read the 512 bytes (FKP)
unsigned char* bytes = NULL;
bytes = new unsigned char[512];
//get the count
crun = bytes[511];
WordStream->seek( offset);
WordStream->read( bytes, 512);
//create and fill the array with the adresses
rgfcSize = crun + 1;
rgfc = new int[rgfcSize];
//get the count
crun = bytes[511];
int j = 0;
//create and fill the array with the adresses
rgfcSize = crun + 1;
rgfc = new int[rgfcSize];
int j = 0;
for ( unsigned int i = 0; i < rgfcSize; i++ )
{
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
j += 4;
}
for ( unsigned int i = 0; i < rgfcSize; i++ )
{
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
j += 4;
}
rgbx = new BX[crun];
grppapxSize = crun;
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
//create arrays
rgbx = new BX[crun];
grppapxSize = crun;
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
for ( unsigned int i = 0; i < grppapxSize; i++ )
{
grppapx[i] = NULL;
}
for ( unsigned int i = 0; i < grppapxSize; i++ )
{
grppapx[i] = NULL;
}
j = 4 * ( crun + 1 );
j = 4 * ( crun + 1 );
//read the 12 for PHE
unsigned char* phe = NULL;
phe = new unsigned char[12];
unsigned char* papx = NULL;
unsigned char phe[12];
for ( int i = 0; i < crun; i++ )
for ( unsigned char i = 0; i < crun; i++ )
{
BX bx;
bx.wordOffset = bytes[j];
j++;
if (fComplex || !oldVersion)
if (fComplex || nWordVersion == 0)
{
memcpy( phe, ( bytes + j), 12 );
@ -113,6 +107,13 @@ namespace DocFileFormat
j += 12;
}
else if (nWordVersion == 2)
{
memcpy( phe, ( bytes + bx.wordOffset * 2 + j + 1), 6);
//fill the rgbx array
bx.phe = ParagraphHeight( phe, 6, false );
}
else
{
memcpy( phe, ( bytes + j), 6);
@ -126,29 +127,27 @@ namespace DocFileFormat
if ( bx.wordOffset != 0 )
{
//read first unsigned char of PAPX
//PAPX is stored in a FKP; so the first unsigned char is a count of words
unsigned char padbyte = 0;
unsigned char cw = bytes[bx.wordOffset * 2];
//if that unsigned char is zero, it's a pad unsigned char, and the word count is the following unsigned char
if ( cw == 0 )
{
padbyte = 1;
cw = bytes[bx.wordOffset * 2 + 1];
}
if ( cw != 0 )
{
int sz = cw * 2;
//read the bytes for papx
papx = new unsigned char[cw * 2];
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), ( cw * 2 ) );
unsigned char* papx = new unsigned char[sz];
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), sz );
//parse PAPX and fill grppapx
grppapx[i] = new ParagraphPropertyExceptions( papx, ( cw * 2 ), dataStream, oldVersion );
grppapx[i] = new ParagraphPropertyExceptions( papx, sz, dataStream, nWordVersion );
RELEASEARRAYOBJECTS( papx );
}
}
else
{
@ -157,7 +156,6 @@ namespace DocFileFormat
}
}
RELEASEARRAYOBJECTS( phe );
RELEASEARRAYOBJECTS( bytes );
}
@ -179,7 +177,7 @@ namespace DocFileFormat
//there are n offsets and n-1 fkp's in the bin table
if (fib->m_bOlderVersion && fib->m_FibBase.fComplex == false)
if (fib->m_nWordVersion > 0 && fib->m_FibBase.fComplex == false)
{
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBtePapx - 8 ) / 6 ) + 1;
@ -202,7 +200,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
}
//if (PAPXlist->back()->rgfc[PAPXlist->back()->rgfcSize-1] < last)
@ -226,7 +224,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
}
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -63,7 +63,7 @@ namespace DocFileFormat
public:
virtual ~FormattedDiskPagePAPX();
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex);
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex);
/// Parses the 0Table (or 1Table) for FKP _entries containing PAPX
static std::list<FormattedDiskPagePAPX*>* GetAllPAPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream, POLE::Stream* dataStream);
/// Returns a list of all PAPX FCs between they given boundaries.

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -38,10 +38,30 @@ namespace Global
static const wchar_t ColorIdentifier[17][12] =
{
L"auto",
L"000000",//L"black",
L"0000FF",//L"blue",
L"00FFFF",//L"cyan",
L"00FF00",// L"green",
L"FF00FF",//L"magenta",
L"FF0000",//L"red",
L"FFFF00",//L"yellow",
L"FFFFFF",//L"white",
L"darkBlue",
L"darkCyan",
L"darkGreen",
L"darkMagenta",
L"darkRed",
L"darkYellow",
L"darkGray",
L"lightGray"
};
static const wchar_t ColorNameIdentifier[17][12] =
{
L"auto",
L"black",
L"blue",
L"cyan",
L"green",
L"green",
L"magenta",
L"red",
L"yellow",
@ -55,7 +75,6 @@ namespace Global
L"darkGray",
L"lightGray"
};
static const wchar_t UnderlineCode[56][16] =
{
L"none",

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -38,110 +38,83 @@ namespace DocFileFormat
{
HeaderAndFooterTable::HeaderAndFooterTable (FileInformationBlock* fib, POLE::Stream* pTableStream)
{
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_bOlderVersion);
m_nCurrentIndex = 0;
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_nWordVersion);
if (fib->m_FibWord97.fcPlcfHdd > tableReader.GetSize()) return;
unsigned int tableSize = fib->m_FibWord97.lcbPlcfHdd / 4;//in bytes
if ( ( tableSize > 0 ) && ( fib->m_RgLw97.ccpHdr > 0 ) )
if ( tableSize < 1 || fib->m_RgLw97.ccpHdr <1 )
return;
int* table = new int[tableSize];
for (unsigned int i = 0; i < tableSize; ++i)
{
int* table = new int[tableSize];
for (unsigned int i = 0; i < tableSize; ++i)
{
table[i] = tableReader.ReadInt32();
}
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
//the first 6 _entries are about footnote and endnote formatting
//so skip these _entries
int pos = (fib->m_FibBase.fComplex || !fib->m_bOlderVersion) ? 6 : 0;
int count = ( tableSize - pos - 2) / 6;
for (int i = 0; i < count; ++i)
{
//Even Header
if ( table[pos] == table[pos + 1] )
{
m_arEvenHeaders.push_back( NULL );
}
else
{
m_arEvenHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//Odd Header
if ( table[pos] == table[pos + 1] )
{
m_arOddHeaders.push_back( NULL );
}
else
{
m_arOddHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//Even Footer
if ( table[pos] == table[pos + 1] )
{
m_arEvenFooters.push_back( NULL );
}
else
{
m_arEvenFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//Odd Footer
if ( table[pos] == table[pos + 1] )
{
m_arOddFooters.push_back( NULL );
}
else
{
m_arOddFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//First Page Header
if ( table[pos] == table[pos + 1] )
{
m_arFirstHeaders.push_back (NULL);
}
else
{
m_arFirstHeaders.push_back (new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ));
}
pos++;
if (pos >= tableSize)
break;
//First Page Footers
if ( table[pos] == table[pos + 1] )
{
m_arFirstFooters.push_back( NULL );
}
else
{
m_arFirstFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
}
RELEASEARRAYOBJECTS(table);
table[i] = tableReader.ReadInt32();
}
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
int count = 0;
int pos = (fib->m_FibBase.fComplex || fib->m_nWordVersion == 0) ? 6 : 0;
//the first 6 _entries are about footnote and endnote formatting -Word97 so skip these
std::vector<std::vector<CharacterRange*>*> arHeadersFooters;
if (fib->m_nWordVersion == 2)
{
count = ( tableSize - 1);
}
else
{
count = ( tableSize - pos - 1) / 6;
arHeadersFooters.push_back(&m_arEvenHeaders);
arHeadersFooters.push_back(&m_arOddHeaders);
arHeadersFooters.push_back(&m_arEvenFooters);
arHeadersFooters.push_back(&m_arOddFooters);
arHeadersFooters.push_back(&m_arFirstHeaders);
arHeadersFooters.push_back(&m_arFirstFooters);
}
for (int i = 0; i < count; ++i)
{
//Even Header
if (fib->m_nWordVersion == 2)
{
if ( table[pos] == table[pos + 1] )
{
m_arCommonHeadersFooters.push_back( NULL );
}
else
{
m_arCommonHeadersFooters.push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
}
pos++;
}
else
{
for (size_t j = 0; j < 6; j++)
{
if ( table[pos] == table[pos + 1] )
{
arHeadersFooters[j]->push_back( NULL );
}
else
{
arHeadersFooters[j]->push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
}
pos++;
if (pos >= tableSize) break;
}
}
if (pos >= tableSize) break;
}
RELEASEARRAYOBJECTS(table);
}
HeaderAndFooterTable::~HeaderAndFooterTable()
@ -152,5 +125,7 @@ namespace DocFileFormat
for_each (m_arFirstHeaders.begin(), m_arFirstHeaders.end(), DeleteDynamicObject());
for_each (m_arOddFooters.begin(), m_arOddFooters.end(), DeleteDynamicObject());
for_each (m_arOddHeaders.begin(), m_arOddHeaders.end(), DeleteDynamicObject());
for_each (m_arCommonHeadersFooters.begin(), m_arCommonHeadersFooters.end(), DeleteDynamicObject());
}
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,10 +34,12 @@
#include "CharacterRange.h"
#include "FileInformationBlock.h"
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex) {\
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex)\
{\
if (m_ar##NAME.empty()) return NULL; \
if (nIndex < (int)m_ar##NAME.size()) return m_ar##NAME[nIndex];\
return NULL; } \
return NULL; \
}\
namespace DocFileFormat
{
@ -54,8 +56,17 @@ namespace DocFileFormat
GET_CHARS_RANGE (EvenFooters);
GET_CHARS_RANGE (OddFooters);
inline CharacterRange* GetNextHeaderFooter()
{
if (m_nCurrentIndex < m_arCommonHeadersFooters.size())
return m_arCommonHeadersFooters[m_nCurrentIndex++];
return NULL;
}
private:
size_t m_nCurrentIndex;
std::vector<CharacterRange*> m_arCommonHeadersFooters;
std::vector<CharacterRange*> m_arFirstHeaders;
std::vector<CharacterRange*> m_arEvenHeaders;
std::vector<CharacterRange*> m_arOddHeaders;

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -71,7 +71,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
TableInfo tai( papx, m_document->nWordVersion );
if ( tai.fInTable )
{
@ -84,7 +84,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
cp = writeParagraph( cp, 0x7fffffff );
}
}

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -33,6 +33,9 @@
#include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
#define GETBIT(from, num) ((from & (1 << num)) != 0)
namespace DocFileFormat
{
class IVisitable

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -152,37 +152,53 @@ namespace DocFileFormat
}
OutlineListDescriptor::OutlineListDescriptor( unsigned char * data, int length )
{
int pos = 0;
if (length < 212)
{
//int sz = FormatUtils::BytesToUChar(data, 0, length);
int pos = 0;
for (int i = 0 ; i < 9; i++)
{
lvl[i].Parse(data + pos, length - pos);
pos += 16;
for (int i = 0 ; i < 9; i++)
{
lvl[i].Parse(data + pos, 1);
pos += 1;
}
}
else
{
int pos = 0;
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
short strLen = length - pos;
while (strLen > 0)
{
if (data[strLen + 20 - 1] != 0)
break;
strLen--;
for (int i = 0 ; i < 9; i++)
{
lvl[i].Parse(data + pos, length - pos);
pos += 16;
}
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
short strLen = length - pos;
while (strLen > 0)
{
if (data[strLen + 20 - 1] != 0)
break;
strLen--;
}
if (strLen > 0)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
}
}
if (strLen > 0)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
}
}
ByteStructure* OutlineListDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
{
unsigned char *data = reader->ReadBytes(212, true);
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, 212);
int sz = GetSize(reader->nWordVersion);
unsigned char *data = reader->ReadBytes(sz, true);
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, sz);
delete []data;

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -143,8 +143,13 @@ namespace DocFileFormat
std::wstring xst; //64 chars ansi
public:
static const int STRUCTURE_SIZE = 212;
static const int STRUCTURE_SIZE_OLD = 10;
public:
static const int GetSize(int nWordVersion)
{
return (nWordVersion == 2) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ~OutlineListDescriptor();

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -49,7 +49,7 @@ namespace DocFileFormat
{
if ( fib->m_FibWord97.lcbPlfLfo > 0 )
{
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_bOlderVersion);
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_nWordVersion);
if (fib->m_FibWord97.fcPlfLfo > reader.GetSize()) return;

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -77,7 +77,7 @@ namespace DocFileFormat
//this papx has no istd, so use PX to parse it
unsigned char *bytes = reader->ReadBytes( cbGrpprlPapx, true );
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->olderVersion);
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->nWordVersion);
grpprlPapx = new ParagraphPropertyExceptions( *(px->grpprl) );
RELEASEOBJECT( px );
@ -85,7 +85,7 @@ namespace DocFileFormat
//read the group of chpx sprms
bytes = reader->ReadBytes( cbGrpprlChpx, true );
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->olderVersion );
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->nWordVersion );
RELEASEARRAYOBJECTS( bytes );
//read the number text
@ -116,6 +116,10 @@ namespace DocFileFormat
void NumberingLevelDescriptor::Parse(unsigned char * data, int length )
{
if (length < 16)
{
return;
}
bEnabled = true;
nfc = FormatUtils::BytesToUChar(data, 0, length);

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -45,7 +45,7 @@ namespace DocFileFormat
{
if ( fib->m_FibWord97.lcbPlfLst > 0 )
{
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_bOlderVersion);
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_nWordVersion);
if (fib->m_FibWord97.fcPlfLst > reader.GetSize()) return;

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -110,7 +110,7 @@ namespace DocFileFormat
int countText = m_document->FIB->m_RgLw97.ccpText;
int countTextRel = m_document->FIB->m_RgLw97.ccpText - 1;
while (cp < countText)
while (cp < countText && cp >= 0)
{
fc = m_document->FindFileCharPos(cp);
@ -120,7 +120,7 @@ namespace DocFileFormat
if (papx)
{
TableInfo tai(papx);
TableInfo tai(papx, m_document->nWordVersion);
if (tai.fInTable)
{
int cpStart = cp;
@ -135,7 +135,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph(cp);
cp = writeParagraph(cp, countTextRel);
}
}
else

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -124,7 +124,7 @@ public:
if (m_Data)
{
rdByte = m_Data[m_Position];
rdByte = (m_Position < m_Size) ? m_Data[m_Position] : 0;
m_Position += sizeof(rdByte);
}

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -38,8 +38,8 @@ namespace DocFileFormat
{
if (m_context)
{
m_document = m_context->GetDocument();
m_xmldocument = m_context->GetXmlDocument();
m_document = m_context->_doc;
m_xmldocument = m_context->_docx;
}
}
@ -338,9 +338,9 @@ namespace DocFileFormat
}
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, bool bOlderVersion)
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, int nWordVersion)
{
if (bOlderVersion && nfc > 5)
if (nWordVersion > 0 && nfc > 5)
{
if (nfc == 0xff) return std::wstring( L"bullet");
else return std::wstring( L"none");
@ -582,7 +582,7 @@ namespace DocFileFormat
// The style id is used for a reverse reference.
// It can happen that the reference points to the wrong style.
if (styleIndex != ListData::ISTD_NIL)
if (styleIndex != ListData::ISTD_NIL && styleIndex < m_document->Styles->Styles->size())
{
m_pXmlWriter->WriteNodeBegin( L"w:pStyle", TRUE );
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId(m_document->Styles->Styles->at(styleIndex))));
@ -633,7 +633,7 @@ namespace DocFileFormat
if ((chpxs != NULL) && (!chpxs->empty()))
{
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->FIB->m_bOlderVersion);
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->nWordVersion);
if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL))
{

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -65,7 +65,7 @@ namespace DocFileFormat
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
/// Converts the number format code of the binary format.
static std::wstring GetNumberFormatWideString(int nfc, bool bOlderVersion = false);
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
virtual ~NumberingMapping();

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -60,7 +60,7 @@ namespace DocFileFormat
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
{
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_bOlderVersion);
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
if (pFIB->m_FibWord97.fcDggInfo > oStearmReader.GetSize()) return;

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -110,6 +110,11 @@ namespace DocFileFormat
unused2 = Reader->ReadByte();
unused3 = Reader->ReadByte();
if (btMacOS != btWin32)
{
btWin32 = btMacOS = (Global::BlipType)this->Instance;
}
if (BodySize > 0x24)
{
Blip = RecordFactory::ReadRecord(Reader, 0);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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