Compare commits

..

220 Commits

Author SHA1 Message Date
ec882b6ecd Merge pull request #405 from ONLYOFFICE/fixBug47276
Fix bug47276
2020-11-08 10:09:20 +03:00
4bcab7e8ce . 2020-11-08 10:09:58 +03:00
13c9a5e872 Fix bug 47276 2020-11-08 10:07:13 +03:00
2368e794ba Merge branch hotfix/v6.0.1 into master 2020-10-28 14:09:27 +00:00
d297d7852c Merge pull request #373 from ONLYOFFICE/fix/bugsY
Fix typo
2020-10-18 14:46:27 +03:00
84221f619e Fix typo 2020-10-18 14:46:47 +03:00
7b55e13263 Merge pull request #372 from ONLYOFFICE/fix/bugsY
Fix linux build
2020-10-17 17:11:38 +03:00
7d32d74022 Fix linux build 2020-10-17 17:10:56 +03:00
46a7372ccf Merge pull request #371 from ONLYOFFICE/fix/bugsY
Fix 41
2020-10-16 11:56:39 +03:00
5f0f6ec9bc Fix 41 2020-10-15 21:04:15 +03:00
251a3e58b0 Fix typo 2020-10-15 18:55:57 +03:00
c5b5fbb763 Merge pull request #370 from ONLYOFFICE/fix/bugsY
Fix typo
2020-10-15 18:55:11 +03:00
214c2e00f1 Merge pull request #369 from ONLYOFFICE/fix/bugsY
Fix typo
2020-10-15 13:55:26 +03:00
4d316781ec Fix typo 2020-10-15 13:54:43 +03:00
47a453a745 Merge pull request #361 from ONLYOFFICE/fix/bugsY
Fix/bugs y
2020-10-13 20:47:11 +03:00
8b594be2ab Fix 2/3 "problem 41" 2020-10-13 20:45:34 +03:00
88cf60a3ed Fix 25 errors 2020-10-13 20:11:21 +03:00
9a9d60031e Merge pull request #355 from ONLYOFFICE/feature/pre6.0.1
Feature/pre6.0.1
2020-10-08 13:45:24 +03:00
8bc803850d Merge pull request #349 from ONLYOFFICE/fix/v6.0.1-fix_bugs_1
Fix/v6.0.1 fix bugs 1
2020-09-30 21:46:08 +03:00
5c36946442 Merge branch release/v6.0.0 into master 2020-09-30 14:59:42 +00:00
a3d52549d3 x2t - fixed check images from download 2020-09-30 17:47:51 +03:00
6ecdc4acfd x2t - fix bugs 2020-09-30 15:34:11 +03:00
66a6b7a111 Fix 2020-09-30 15:19:20 +03:00
a09de43723 . 2020-09-30 13:54:01 +03:00
b17d5e860f Fix 34, 35, 37 2020-09-30 13:52:41 +03:00
4cd2bd34ce Fix spaces 2020-09-25 14:15:51 +03:00
0b3502afdd Fix build on macOS with xcode 12+ 2020-09-25 13:54:40 +03:00
829fa21ecb Fix build with new windows sdk 2020-09-25 12:05:39 +03:00
91c50e6620 Merge pull request #340 from ONLYOFFICE/fix/standardtester
Fix standardtester update script
2020-09-22 15:32:10 +03:00
b6da6093b8 Fix standardtester update script 2020-09-22 15:32:08 +03:00
96c8cf69ff Merge pull request #339 from ONLYOFFICE/fix/v6.0.0_fix_bugs2
OdfFormat - fix bug #45590
2020-09-21 21:19:46 +03:00
8f4d8feffa OdfFormat - fix bug #45590 2020-09-21 21:18:05 +03:00
4c708ce8f1 Merge pull request #337 from ONLYOFFICE/fix/allfonts_version
Add version to allfonts.js
2020-09-21 21:10:27 +03:00
c3657a6b95 Add version to allfonts.js 2020-09-21 21:09:53 +03:00
379a452cca Merge pull request #336 from ONLYOFFICE/fix/bug46677
Fix bug 46677
2020-09-21 19:43:58 +03:00
af166c1db3 Fix bug 46677 2020-09-21 19:44:24 +03:00
62746194c0 Merge pull request #335 from ONLYOFFICE/fix/v6.0.0_fix_bugs2
x2t - fix bug #46662
2020-09-21 08:31:59 +03:00
36da9596c3 x2t - fix bug #46662 2020-09-21 08:28:22 +03:00
7c459a1235 Merge pull request #334 from ONLYOFFICE/fix/fontsBuilder
Use ApplicationFontsWorker in builder
2020-09-20 11:03:15 +03:00
28dfa20cf4 Use ApplicationFontsWorker in builder 2020-09-20 11:03:05 +03:00
0176766ede Merge pull request #331 from ONLYOFFICE/fix/bugFontsEA
.
2020-09-18 19:14:54 +03:00
3c87ae665f . 2020-09-18 15:49:50 +03:00
d6711bf478 Merge pull request #329 from ONLYOFFICE/fix/v6.0.0-fix_bugs
OdfFormat - fix bug #46149, fix bug #37705
2020-09-17 10:58:02 +03:00
2a8fd22d52 OdfFormat - fix bug #46149, fix bug #37705 2020-09-16 15:45:09 +03:00
d041646709 Merge pull request #327 from ONLYOFFICE/fix/bug34733
Fix bug 34733
2020-09-14 19:38:45 +03:00
ad28973882 Fix bug 34733 2020-09-14 19:35:47 +03:00
11d271014b Merge pull request #326 from ONLYOFFICE/fix/v6.0.0-fix_bugs
x2t - fix bug #22793
2020-09-14 15:48:27 +03:00
cb38fae383 x2t - fix bug #22793 2020-09-14 12:23:25 +03:00
0d14c7a5fc Merge pull request #325 from ONLYOFFICE/fix/v6.0.0-fix_bugs
x2t - binary - fix pptx theme
2020-09-13 20:30:46 +03:00
915478c1a0 x2t - binary - fix pptx theme 2020-09-13 20:28:55 +03:00
c4cc96e7e5 Merge pull request #324 from ONLYOFFICE/fix/v6.0.0-fix_bugs
PptFormat - fix bug #46195
2020-09-11 11:12:40 +03:00
a68a7b4d7b PptFormat - fix bug #46195 2020-09-11 11:10:33 +03:00
80919a4a69 Merge pull request #322 from ONLYOFFICE/fix/v6.0.0-fix_bugs
fix build
2020-09-10 11:34:23 +03:00
d6fa93f72d fix build 2020-09-10 11:32:33 +03:00
ae8fc6b167 Merge pull request #320 from ONLYOFFICE/fix/v6.0.0-flat_ooxml
OdfFormat - fix bug #46487
2020-09-09 18:40:29 +03:00
218bb347f0 Merge pull request #319 from ONLYOFFICE/fix/v6.0.0-flat_ooxml
Fix/v6.0.0 flat ooxml
2020-09-09 18:23:08 +03:00
0123c54f1a OdfFormat - fix bug #46487 2020-09-09 16:33:49 +03:00
0d45d9843c Merge pull request #316 from ONLYOFFICE/fix/mac_ios
Fix build on mac/ios
2020-09-09 16:18:09 +03:00
e43ee93e1d Fix build on mac/ios 2020-09-09 16:14:36 +03:00
cd8adbe83b x2t - ooxml flat - fix gzip image 2020-09-09 11:32:55 +03:00
6456fa802a OdfFormat - fix section 2020-09-09 11:32:08 +03:00
cb051ec67d Merge branch hotfix/v5.6.4 into master 2020-09-08 08:13:46 +00:00
770020089b Merge pull request #314 from ONLYOFFICE/fix/emptyDash
Fix bug 46350
2020-09-08 11:07:12 +03:00
d68bf5ab38 Fix bug 46350 2020-09-08 11:00:04 +03:00
6e3cb9e7ef Merge pull request #313 from ONLYOFFICE/fix/calcOnePage
Fix/calc one page
2020-09-07 15:36:27 +03:00
7c0ba8b45f . 2020-09-07 15:36:36 +03:00
935483f3d0 Send json params to calculate function (as to GetPDF) 2020-09-07 15:31:18 +03:00
ea04067abf DocxFormat - fix image in zip and read sub-section 2020-09-04 10:57:40 +03:00
75f74b7e41 Merge pull request #312 from ONLYOFFICE/fix/v6.0.0-from-v5.6.4
Fix/v6.0.0 from v5.6.4
2020-09-04 06:37:50 +03:00
5906e23c98 Merge remote-tracking branch 'origin/hotfix/v5.6.4' into fix/v6.0.0-from-v5.6.4 2020-09-04 06:35:23 +03:00
8ae9952294 Merge pull request #311 from ONLYOFFICE/fix/v6.0.0_files_tests
Fix/v6.0.0 files tests
2020-09-03 17:45:07 +03:00
7d86f3e860 OdfFormat - fix bug #45218 2020-09-03 17:42:50 +03:00
1b89d50c20 x2t - binary -fix bug #46433 2020-09-03 17:41:36 +03:00
3033c59eaa Merge pull request #310 from ONLYOFFICE/fix/v5.6.4-bin3
Fix/v5.6.4 bin3
2020-09-03 17:26:14 +03:00
874cbb62d2 Merge pull request #309 from ONLYOFFICE/fix/bug43650
Fix bug 43650
2020-09-03 16:12:57 +03:00
9e2b51ec6d Fix bug 43650 2020-09-03 16:12:25 +03:00
c455f1b420 TxtFormat - fix bug #46437 2020-09-02 21:52:10 +03:00
7fdb44a93f x2t - fix bug #46436 2020-09-02 21:46:02 +03:00
e53ba81da3 x2t - fix bug #46434 2020-09-02 21:35:25 +03:00
da1f604f09 Merge pull request #308 from ONLYOFFICE/fix/v5.6.4-bin2
x2t - fix bug #46353
2020-09-02 18:31:59 +03:00
68e791c2fd x2t - fix bug #46353 2020-09-02 18:30:46 +03:00
30cdf52611 Merge pull request #307 from ONLYOFFICE/fix/v5.6.4-bin2
x2t - fix bug #46353
2020-09-01 10:37:42 +03:00
83f1a9e068 x2t - fix bug #46353 2020-09-01 10:35:41 +03:00
df3382c616 Merge pull request #305 from ONLYOFFICE/fix/v5.6.4_bin
x2t - fix #46353
2020-08-31 19:52:58 +03:00
70c886cd9a x2t - fix #46353 2020-08-31 19:51:30 +03:00
0d8c21af22 Merge branch 'hotfix/v5.6.4' into fix/v6.0.0_files_tests 2020-08-31 09:53:27 +03:00
8cb6415915 Merge pull request #303 from ONLYOFFICE/fix/v5.6.4_bin
x2t - fix bug #46348
2020-08-31 09:45:12 +03:00
279eaed9c8 x2t - fix bug #46348 2020-08-31 09:43:51 +03:00
7d5f8c2f99 Merge branch 'hotfix/v5.6.4' into fix/v6.0.0_files_tests 2020-08-31 08:41:13 +03:00
f2c69ba9a4 Merge remote-tracking branch 'origin/hotfix/v5.6.4' into fix/v6.0.0_files_tests 2020-08-31 08:10:28 +03:00
078aa9c5e7 Merge pull request #302 from ONLYOFFICE/fix/bug-46384
[x2t] Fix bug 46384
2020-08-30 16:08:23 +03:00
b76463f8d1 [x2t] Fix bug 46384
Fix omitted break statement in switch
2020-08-30 16:06:00 +03:00
a2110b9947 Merge pull request #301 from ONLYOFFICE/fix/bug-46352
[x2t] Fix bug 46352
2020-08-28 14:30:47 +03:00
de2c16ed7c [x2t] Fix bug 46352
Fix out_of_range while binary reading
2020-08-28 14:25:31 +03:00
5aa32a21f6 Merge pull request #300 from ONLYOFFICE/fix/v5.6.4_bin
x2t - binary - fix bug #46352
2020-08-28 13:07:30 +03:00
bec0a59ac1 x2t - binary - fix bug #46352 2020-08-28 13:05:18 +03:00
9024feaf5d Merge pull request #299 from ONLYOFFICE/fix/v5.6.4_bin
x2t - binary - fix bug #46353
2020-08-28 12:49:33 +03:00
078d3bc991 x2t - binary - fix bug #46353 2020-08-28 12:47:24 +03:00
55be5be654 Merge pull request #298 from ONLYOFFICE/fix/v6.0.0_files_tests
Fix/v6.0.0 files tests
2020-08-26 21:53:31 +03:00
fbe5ce3dd6 OdfFormat - fix bug #46149 2020-08-26 21:51:57 +03:00
410be67daa . 2020-08-26 19:01:58 +03:00
c260db3d3d OdfFormat - fix after testing 2020-08-26 14:32:51 +03:00
2cb0628f17 . 2020-08-26 13:32:34 +03:00
4d7479d4c9 OdfFormat - fix bug #45590 2020-08-25 12:53:13 +03:00
c0570d8ae1 Merge pull request #295 from ONLYOFFICE/fix/v6.0.0_files_tests
.
2020-08-24 10:25:47 +03:00
7812ad4c88 . 2020-08-24 10:24:31 +03:00
9c9726e6e3 Fix bug #45498
Fix the problem with reading WmfRect object
2020-08-21 10:31:31 +03:00
f4c869c423 Merge pull request #293 from ONLYOFFICE/fix/v6.0.0_files_tests
OdfFormat - fix bug #46255
2020-08-21 09:58:00 +03:00
0bdd1efb6d OdfFormat - fix bug #46255 2020-08-21 09:55:18 +03:00
ce566cb1b5 Merge pull request #292 from ONLYOFFICE/fix/v6.0.0_files_tests
Fix/v6.0.0 files tests
2020-08-21 08:57:33 +03:00
c9f367e269 OdfFormat - fix bug #45218 2020-08-21 08:56:26 +03:00
0d4f9dd5ce Merge branch 'release/v6.0.0' into fix/v6.0.0_files_tests 2020-08-20 16:35:36 +03:00
60c24619a8 OdfFormat - fix after testing 2020-08-20 16:34:37 +03:00
fd432c92af Merge pull request #291 from ONLYOFFICE/fix/v6.0.0_files_tests
Fix/v6.0.0 files tests
2020-08-19 14:33:05 +03:00
d6274ff045 . 2020-08-19 14:31:55 +03:00
4859ab54b7 . 2020-08-19 12:47:36 +03:00
749da667eb Merge pull request #290 from ONLYOFFICE/fix/v6.0.0_files_tests
Fix/v6.0.0 files tests
2020-08-19 12:06:40 +03:00
cbe7ea1497 PptFormat - fix after testing 2020-08-19 12:04:55 +03:00
aa7943cd73 OdfFormat - fix bugs #45218, #46207 2020-08-19 12:00:22 +03:00
1472c3e2c4 Fix bug #46164
Fix the problem with PDF/A conformance
2020-08-17 16:24:28 +03:00
997ab10074 Merge pull request #286 from ONLYOFFICE/fix/v6.0.0_files_tests
OdfFormat - fix bug #46060
2020-08-14 18:23:08 +03:00
465a45aa43 . 2020-08-14 13:58:50 +03:00
55a2f2a4a7 XLsFormat - fix bug #46137, #45869 2020-08-14 13:57:25 +03:00
228f8cacf6 XlsFormat - fix bug #46088 2020-08-11 12:32:31 +03:00
244b9acc9a OdfFormat - fix bug #46076 2020-08-11 11:37:56 +03:00
86182e7c54 OdfFormat - fix bug #46060 2020-08-10 11:34:28 +03:00
27398b5ccd Merge branch hotfix/v5.6.2 into release/v6.0.0 2020-08-07 08:01:04 +00:00
ef6af5a1ae Merge branch hotfix/v5.6.1 into master 2020-08-05 09:19:35 +00:00
52bcc587ba Merge pull request #279 from ONLYOFFICE/hotfix/v5.6.1
Hotfix/v5.6.1
2020-08-03 12:05:37 +03:00
6e5fe1202e Merge pull request #278 from ONLYOFFICE/fix/fixXP
Fix xp build
2020-08-03 12:00:48 +03:00
0005b20095 Fix xp build 2020-08-03 11:29:19 +03:00
d48faa778b Merge pull request #277 from ONLYOFFICE/fix/v6.0.0_pole
.
2020-08-03 10:41:10 +03:00
1eb51d9a39 . 2020-07-31 13:49:17 +03:00
6570319bfe Merge pull request #276 from ONLYOFFICE/fix/v6.0.0_pole
.
2020-07-30 10:03:49 +03:00
14ad7ac534 . 2020-07-30 09:04:54 +03:00
a7da029138 Merge branch hotfix/v5.6.0 into release/v6.0.0 2020-07-28 13:31:44 +00:00
82cdd75365 Merge branch hotfix/v5.6.0 into master 2020-07-28 13:31:16 +00:00
3410e157e0 Merge pull request #272 from ONLYOFFICE/feature/fixIOSBoost
Fix ios build
2020-07-21 16:02:46 +03:00
92d0edeb48 Fix ios build 2020-07-21 15:55:55 +03:00
e6928330d4 Fix bug #35500
Fix reading PDF fields with specified value equals to the default value
2020-07-17 15:42:07 +03:00
6522a682e0 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2020-07-16 17:30:37 +03:00
a63adfcb97 OdfFormat - fix bug #45862 2020-07-16 17:21:37 +03:00
bc91a3a19c Implement saving internal links 2020-07-16 10:24:35 +03:00
46bd3427f8 DocFormat - fix bug #45851 2020-07-15 13:01:35 +03:00
ec24932bf3 Revert "."
This reverts commit 6785d185c8.
2020-07-14 11:47:50 +03:00
be67e37ff7 Revert "."
This reverts commit 81a7416403.
2020-07-14 11:47:42 +03:00
671f9f543a Revert "."
This reverts commit 6d8ac07e60.
2020-07-14 11:47:34 +03:00
9174529906 Revert "."
This reverts commit d1e399ba83.
2020-07-14 11:47:26 +03:00
76044dfa68 Revert "."
This reverts commit eb699347d4.
2020-07-14 11:46:43 +03:00
a7c6eeeced Revert "."
This reverts commit d10a0ccadd.
2020-07-14 11:46:31 +03:00
5ce6fa0288 Revert "."
This reverts commit 8c605dca1c.
2020-07-14 11:46:17 +03:00
6785d185c8 . 2020-07-14 08:31:14 +03:00
81a7416403 . 2020-07-13 11:06:45 +03:00
6d8ac07e60 . 2020-07-13 10:44:44 +03:00
d1e399ba83 . 2020-07-13 09:13:43 +03:00
72edd021d0 [test] Update test apps 2020-07-13 01:31:40 +03:00
1d8860f73e Fix bug #35032
Implement saving hyperlinks
2020-07-10 18:15:28 +03:00
ce397b13f6 Fix bug with redirects in downloads 2020-07-10 16:31:37 +03:00
206f53f0c1 . 2020-07-10 10:35:05 +03:00
eb699347d4 . 2020-07-10 10:29:42 +03:00
d10a0ccadd . 2020-07-10 10:21:36 +03:00
8c605dca1c . 2020-07-10 10:10:54 +03:00
52ac2a7524 PptxFormat - fix bug #45817 2020-07-09 17:57:49 +03:00
4b961b000f OdfFormat - fix bug #45814 2020-07-09 12:50:40 +03:00
b691f7bf0b Fix bug #31382
Simple variant for transparency group
2020-07-08 16:07:38 +03:00
04240aa8df Fix bug #25374
Implement matte color support for images with specified smask
2020-07-08 10:22:45 +03:00
9d065c546a x2t - fix #45244, ... 2020-07-07 13:34:42 +03:00
3a7bc3a5fa Merge pull request #266 from ONLYOFFICE/hotfix/v5.5.4
Hotfix/v5.5.4
2020-07-06 18:38:34 +03:00
d197c0da15 . 2020-07-06 16:55:04 +03:00
1fed9b0aed OdfFormat - fix bug #45088 2020-07-06 16:41:57 +03:00
0e7a8c1af9 Fix rpath instead runpath 2020-07-06 16:14:41 +03:00
a52bcb3205 Fix previous commit 2020-07-06 14:05:06 +03:00
b57bf58068 Use std::vector in CArray realization. Deprecated class! 2020-07-06 13:50:43 +03:00
618e61e012 Fix previous commit 2020-07-06 11:43:02 +03:00
d70bf7d361 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2020-07-06 09:30:13 +03:00
a0f4d06ca7 [x2t] Set encoding and delimiter for empty txt, csv instead of NEED_PARAMS error
The main purpose - to show right error in case of presentation download error
2020-07-06 02:46:13 +03:00
c835a0741e Fix rendering dashed lines 2020-07-05 12:37:01 +03:00
a8ee916ffa Fix android build & work 2020-07-05 10:04:34 +03:00
b8442ce2fb x2t - BinaryWriter - fix bug #45244 2020-07-04 21:24:16 +03:00
26ea36f242 . 2020-07-04 14:12:23 +03:00
6b89ec979d PptFormat - fix bug #45424 2020-07-04 07:45:31 +03:00
802dfe7da6 Merge pull request #265 from ONLYOFFICE/hotfix/v5.5.4
Hotfix/v5.5.4
2020-07-03 11:44:51 +03:00
7be6410a13 Fix fonts selection 2020-07-03 11:25:24 +03:00
76375da047 x2t - BinWriter - fix bug #45744 2020-07-03 10:12:39 +03:00
528806df30 Fix bug #32339
Fix the problem with color of the mask
2020-07-03 09:47:02 +03:00
46fdd6aaa7 . 2020-07-02 21:38:12 +03:00
dbe8fe29f7 For bug #32615
Implement reading page labels
2020-07-02 15:30:51 +03:00
468bf90f9f XlsFormat - fix bug #45737 2020-07-02 08:11:26 +03:00
84789d2083 Fix base pri 2020-07-01 21:52:28 +03:00
1ef73f12a4 Change font selection algorithm 2020-07-01 13:03:19 +03:00
9706ca50d5 Fix bug #39097
Implement color mask for images
2020-07-01 10:52:39 +03:00
7fba804f17 Fix bug #19078
Fix the problem with reading CID to GID map for CIDType2 fonts
2020-07-01 10:52:32 +03:00
d4f9eecbba Fix bug #45319 2020-07-01 10:52:23 +03:00
9719490d68 Fix bug #39097
Implement color mask for images
2020-07-01 10:36:49 +03:00
4ac26edee1 Fix bug #19078
Fix the problem with reading CID to GID map for CIDType2 fonts
2020-06-30 12:57:57 +03:00
839b1bee9f Fix bug #45319 2020-06-30 12:45:04 +03:00
245dfe198a Fix bug 45336 2020-06-29 11:55:04 +03:00
9aad184fca Add android script 2020-06-27 15:21:09 +03:00
8fc7db8e4e . 2020-06-26 06:30:17 +03:00
f3a807b65e TxtFormat - fix bug #45695 2020-06-25 20:39:15 +03:00
bbe07b8166 OdfFormat - .... 2020-06-25 12:37:25 +03:00
546ba267ac OdfFormat - fix bug #45593 2020-06-24 22:33:18 +03:00
7d2e0db0c0 OdfFormat - fix bug #45594 2020-06-24 07:33:47 +03:00
3b8c1c1f01 Merge pull request #258 from ONLYOFFICE/hotfix/v5.5.4
Hotfix/v5.5.4
2020-06-23 20:53:24 +03:00
d49bed47b6 Fix bug 31323 2020-06-23 11:15:50 +03:00
52b9a4b683 . 2020-06-23 08:10:46 +03:00
6d949ed6bf . 2020-06-23 05:08:29 +03:00
61973714b9 x2t - fix bug #45535 2020-06-22 19:57:08 +03:00
4b2656b07c OdfFormat - fix bug #45616 2020-06-22 16:34:09 +03:00
9c5e79619a DocFormatReader - fix bug #44864 2020-06-19 10:03:51 +03:00
302f3aa7b6 [test] Update test apps 2020-06-18 15:53:56 +03:00
daf05b4410 [x2t] For opening DOCX_FLAT via xml 2020-06-18 12:59:43 +03:00
a103fc00b5 . 2020-06-17 13:14:04 +03:00
f9de7868c5 [ios][documents] color schemas event 2020-06-17 12:33:17 +03:00
e72a4f2c76 RtfFormatReader - fix bug #45619 2020-06-16 22:00:10 +03:00
374d005e14 OdfFormatReader - fix bug #45626 2020-06-16 21:16:15 +03:00
b95065fd70 Openssl build for windows xp 2020-06-16 15:28:10 +03:00
106880b7f4 [test] Update test apps 2020-06-15 18:04:04 +03:00
de9d2b303d [x2t] Fix writing corrupted xlsx 2020-06-15 18:01:54 +03:00
4082244e80 . 2020-06-15 12:23:51 +03:00
577 changed files with 22694 additions and 5796 deletions

View File

@ -1344,7 +1344,7 @@ namespace DocFileFormat
{
ParagraphPropertyExceptions* backup = _lastValidPapx;
std::map<short, short> boundaries;
std::map<short, short> mapBoundaries;
int cp = initialCp;
int fc = m_document->FindFileCharPos( cp );
@ -1388,7 +1388,8 @@ namespace DocFileFormat
}
if (nestingLevel == iTap_current)
{
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
bool bPresent = false; //118854.doc
for ( std::list<SinglePropertyModifier>::reverse_iterator iter = papx->grpprl->rbegin(); !bPresent && iter != papx->grpprl->rend(); iter++ )
{
//find the tDef SPRM
DWORD code = iter->OpCode;
@ -1406,19 +1407,27 @@ namespace DocFileFormat
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
AddBoundary(boundary1, boundary2, boundaries);
//if (boundary1 < 0) boundary1 = 0;
//if (boundary2 < 0) boundary2 = 0;
mapBoundaries.insert(std::make_pair(boundary1, 0));
mapBoundaries.insert(std::make_pair(boundary2, 0));
//AddBoundary(boundary1, boundary2, mapBoundaries);
}
if (max_boundary < boundary2)
max_boundary = boundary2;
AddBoundary(boundary2, max_boundary, boundaries);
mapBoundaries.insert(std::make_pair(boundary2, 0));
mapBoundaries.insert(std::make_pair(max_boundary, 0));
//AddBoundary(boundary2, max_boundary, mapBoundaries);
bPresent = true;
}break;
default:
break;
}
}
}
if (nestingLevel != iTap_current && fEndNestingLevel && !boundaries.empty())
if (nestingLevel != iTap_current && fEndNestingLevel && !mapBoundaries.empty())
break;
//get the next papx
papx = findValidPapx( fcRowEnd );
@ -1431,11 +1440,16 @@ namespace DocFileFormat
}
if ( !boundaries.empty() )
if ( !mapBoundaries.empty() )
{
for ( std::map<short, short>::iterator it = boundaries.begin(); it != boundaries.end(); ++it)
std::map<short, short>::iterator it = mapBoundaries.begin();
std::map<short, short>::iterator it_next = it; it_next++;
for ( ; it_next != mapBoundaries.end(); ++it_next, ++it)
{
grid.push_back( it->second );
int sz = it_next->first - it->first;
if (sz > 2)
grid.push_back( it_next->first - it->first );
}
}
_lastValidPapx = backup;

View File

@ -77,13 +77,13 @@ namespace DocFileFormat
}
StringTable( VirtualStreamReader *reader, int code_page_ ):
code_page(code_page_), fExtend(false), cbData(0), cbExtra(0), DataExtra(NULL)
code_page(code_page_), fExtend(false), cbData(0), cbExtra(0)
{
parse( reader, (unsigned int)reader->GetPosition(), 0, false );
}
StringTable( POLE::Stream* tableStream, unsigned int fc, unsigned int lcb, int nWordVersion, bool bReadExta = false) :
code_page(1250), fExtend(false), cbData(0), cbExtra(0), DataExtra(NULL)
code_page(1250), fExtend(false), cbData(0), cbExtra(0)
{
if ( lcb > 0 )
{

View File

@ -96,97 +96,100 @@ namespace DocFileFormat
break;
}
}
//std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
//for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
std::list<SinglePropertyModifier>::const_iterator end = tapx->grpprl->end();
for (std::list<SinglePropertyModifier>::const_iterator iter = tapx->grpprl->begin(); iter != end; ++iter)
bool bPresentDefTable = false;
for (std::list<SinglePropertyModifier>::reverse_iterator iter = tapx->grpprl->rbegin(); iter != tapx->grpprl->rend(); ++iter)
{
switch (iter->OpCode)
{
case sprmOldTDefTable:
case sprmTDefTable:
{
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
int cc = tdef.numberOfColumns;
_tGrid = tdef.rgdxaCenter;
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)];
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
if ( _tcDef.vertMerge == Global::fvmMerge )
if (!bPresentDefTable) //118854.doc
{
appendValueElement( _tcPr, L"vMerge", L"continue", false );
}
else if ( _tcDef.vertMerge == Global::fvmRestart )
{
appendValueElement( _tcPr, L"vMerge", L"restart", false );
}
bPresentDefTable = true;
appendValueElement( _tcPr, L"vAlign", FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ), false );
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
int cc = tdef.numberOfColumns;
if ( _tcDef.fFitText )
{
appendValueElement( _tcPr, L"tcFitText", L"", false );
}
_tGrid = tdef.rgdxaCenter;
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)];
if ( _tcDef.fNoWrap )
{
appendValueElement( _tcPr, L"noWrap", L"", true );
}
//int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
//int ind1 = ind;
//while (ind1 < tdef.rgdxaCenter.size() - 1)
//{
// int sz = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind1 ] ;
// if (sz > 1)
// break;
// ind1++;
//}
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
if (tdef.rgTc80[_cellIndex].horzMerge == 1)
{
for (size_t i = _cellIndex; i < tdef.rgTc80.size(); i++)
if ( _tcDef.vertMerge == Global::fvmMerge )
{
if (tdef.rgTc80[i].horzMerge < 1)
break;
nComputedCellWidth += tdef.rgdxaCenter[ i + 1] - tdef.rgdxaCenter[ i ] ;
_gridSpan++;
appendValueElement( _tcPr, L"vMerge", L"continue", false );
}
else if ( _tcDef.vertMerge == Global::fvmRestart )
{
appendValueElement( _tcPr, L"vMerge", L"restart", false );
}
}
else if (tdef.rgTc80[_cellIndex].horzMerge == 2)
{//skip cover cell
_gridSpan = 1;
nComputedCellWidth = 0;
_bCoverCell = true;
}
else
{
_gridSpan = 1;
appendValueElement( _tcPr, L"vAlign", FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ), false );
nComputedCellWidths += (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ 0 ]);
nComputedCellWidth += tdef.rgTc80[ _cellIndex].wWidth > 1 ? tdef.rgTc80[ _cellIndex].wWidth : (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ]);
//Технические_Требования_1_287_ДИТ.DOC
if ( _tcDef.fFitText )
{
appendValueElement( _tcPr, L"tcFitText", L"", false );
}
}
if ( _tcDef.fNoWrap )
{
appendValueElement( _tcPr, L"noWrap", L"", true );
}
//int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
//int ind1 = ind;
//while (ind1 < tdef.rgdxaCenter.size() - 1)
//{
// int sz = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind1 ] ;
// if (sz > 1)
// break;
// ind1++;
//}
if (!IsTableBordersDefined(tapx->grpprl))
{
RELEASEOBJECT(_brcTop);
_brcTop = new BorderCode(*_tcDef.brcTop);
if (tdef.rgTc80[_cellIndex].horzMerge == 1)
{
for (size_t i = _cellIndex; i < tdef.rgTc80.size(); i++)
{
if (tdef.rgTc80[i].horzMerge < 1)
break;
nComputedCellWidth += tdef.rgdxaCenter[ i + 1] - tdef.rgdxaCenter[ i ] ;
_gridSpan++;
}
}
else if (tdef.rgTc80[_cellIndex].horzMerge == 2)
{//skip cover cell
_gridSpan = 1;
nComputedCellWidth = 0;
_bCoverCell = true;
RELEASEOBJECT(_brcLeft);
_brcLeft = new BorderCode(*_tcDef.brcLeft);
}
else
{
_gridSpan = 1;
RELEASEOBJECT(_brcRight);
_brcRight = new BorderCode(*_tcDef.brcRight);
nComputedCellWidths += (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ 0 ]);
nComputedCellWidth += tdef.rgTc80[ _cellIndex].wWidth > 1 ? tdef.rgTc80[ _cellIndex].wWidth : (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ]);
//Технические_Требования_1_287_ДИТ.DOC
RELEASEOBJECT(_brcBottom);
_brcBottom = new BorderCode(*_tcDef.brcBottom);
}
if (!IsTableBordersDefined(tapx->grpprl))
{
RELEASEOBJECT(_brcTop);
_brcTop = new BorderCode(*_tcDef.brcTop);
RELEASEOBJECT(_brcLeft);
_brcLeft = new BorderCode(*_tcDef.brcLeft);
RELEASEOBJECT(_brcRight);
_brcRight = new BorderCode(*_tcDef.brcRight);
RELEASEOBJECT(_brcBottom);
_brcBottom = new BorderCode(*_tcDef.brcBottom);
}
}
}
break;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="DocFormatTest"
ProjectGUID="{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
RootNamespace="PptFormatTest"
@ -397,6 +397,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\FileWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>

View File

@ -0,0 +1,91 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "FileWriter.h"
#include "ReaderClasses.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
namespace Writers
{
FileWriter::FileWriter(std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath)
:
m_oFontTableWriter (sDirOutput, sFontDir, bNoFontDir),
m_oDocumentWriter (sDirOutput, m_oHeaderFooterWriter),
m_oMediaWriter (sDirOutput),
m_oStylesWriter (sDirOutput, nVersion),
m_oNumberingWriter (sDirOutput),
m_oHeaderFooterWriter (sDirOutput),
m_oFootnotesWriter (sDirOutput),
m_oEndnotesWriter (sDirOutput),
m_oSettingWriter (sDirOutput, m_oHeaderFooterWriter),
m_oCommentsWriter (sDirOutput),
m_oChartWriter (sDirOutput),
m_oDocumentRelsWriter (sDirOutput),
m_oWebSettingsWriter (sDirOutput),
m_oCustomXmlWriter (sDirOutput, pDrawingConverter),
m_pDrawingConverter (pDrawingConverter),
m_bSaveChartAsImg (bSaveChartAsImg),
m_sThemePath (sThemePath),
m_nDocPrIndex (0),
m_pComments (NULL),
m_pApp (NULL),
m_pCore (NULL)
{
}
FileWriter::~FileWriter()
{
RELEASEOBJECT(m_pApp);
RELEASEOBJECT(m_pCore);
}
void FileWriter::Write()
{
m_oCommentsWriter.Write();
m_oChartWriter.Write();
m_oStylesWriter.Write();
m_oNumberingWriter.Write();
m_oFontTableWriter.Write();
m_oHeaderFooterWriter.Write();
m_oFootnotesWriter.Write();
m_oEndnotesWriter.Write();
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
m_oSettingWriter.Write();
m_oWebSettingsWriter.Write();
//Document пишем после HeaderFooter, чтобы заполнить sectPr
m_oDocumentWriter.Write();
//Rels и ContentTypes пишем в конце
m_oDocumentRelsWriter.Write();
}
}

View File

@ -29,8 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef FILE_WRITER
#define FILE_WRITER
#pragma once
#include "../../DesktopEditor/common/Path.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
@ -95,57 +94,15 @@ namespace Writers
OOX::CApp* m_pApp;
OOX::CCore* m_pCore;
FileWriter (std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath)
: m_pDrawingConverter(pDrawingConverter), m_sThemePath(sThemePath), m_bSaveChartAsImg(bSaveChartAsImg),
m_oFontTableWriter (sDirOutput, sFontDir, bNoFontDir),
m_oHeaderFooterWriter (sDirOutput),
m_oFootnotesWriter (sDirOutput),
m_oEndnotesWriter (sDirOutput),
m_oMediaWriter (sDirOutput),
m_oStylesWriter (sDirOutput, nVersion),
m_oNumberingWriter (sDirOutput),
m_oDocumentWriter (sDirOutput, m_oHeaderFooterWriter),
m_oSettingWriter (sDirOutput, m_oHeaderFooterWriter),
m_oCommentsWriter (sDirOutput),
m_oChartWriter (sDirOutput),
m_oDocumentRelsWriter (sDirOutput),
m_oWebSettingsWriter (sDirOutput),
m_nDocPrIndex(0),
m_pComments(NULL),
m_oCustomXmlWriter (sDirOutput, pDrawingConverter),
m_pApp (NULL),
m_pCore (NULL)
{
}
~FileWriter()
{
RELEASEOBJECT(m_pApp);
RELEASEOBJECT(m_pCore);
}
FileWriter (std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath);
~FileWriter();
int getNextDocPr()
{
m_nDocPrIndex++;
return m_nDocPrIndex;
}
void Write()
{
m_oCommentsWriter.Write();
m_oChartWriter.Write();
m_oStylesWriter.Write();
m_oNumberingWriter.Write();
m_oFontTableWriter.Write();
m_oHeaderFooterWriter.Write();
m_oFootnotesWriter.Write();
m_oEndnotesWriter.Write();
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
m_oSettingWriter.Write();
m_oWebSettingsWriter.Write();
//Document пишем после HeaderFooter, чтобы заполнить sectPr
m_oDocumentWriter.Write();
//Rels и ContentTypes пишем в конце
m_oDocumentRelsWriter.Write();
}
void Write();
};
}
#endif // #ifndef FILE_WRITER

View File

@ -112,7 +112,9 @@ public:
long read1defCurPos = 0;\
while(read1defCurPos < (long)stLen)\
{\
BYTE read1defType = m_oBufferedStream.GetUChar();\
BYTE read1defType = 0;\
if (false == m_oBufferedStream.GetUCharWithResult(&read1defType))\
break;\
long read1defLength = m_oBufferedStream.GetLong();\
res = fReadFunction(read1defType, read1defLength, arg);\
if(res == c_oSerConstants::ReadUnknown)\
@ -129,7 +131,9 @@ public:
long read2defCurPos = 0;\
while(read2defCurPos < (long)stLen)\
{\
BYTE read2defType = m_oBufferedStream.GetUChar();\
BYTE read2defType = 0;\
if (false == m_oBufferedStream.GetUCharWithResult(&read2defType))\
break;\
long read2defLenType = m_oBufferedStream.GetUChar();\
int read2defCurPosShift = 2;\
int read2defRealLen;\
@ -1431,8 +1435,7 @@ int Binary_pPrReader::ReadFootnotePr(BYTE type, long length, void* poResult)
else if( c_oSerNotes::PrStart == type )
{
pFtnProps->m_oNumStart.Init();
pFtnProps->m_oNumStart->m_oVal.Init();
pFtnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
pFtnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
}
else if( c_oSerNotes::PrFntPos == type )
{
@ -1462,8 +1465,7 @@ int Binary_pPrReader::ReadEndnotePr(BYTE type, long length, void* poResult)
else if( c_oSerNotes::PrStart == type )
{
pEdnProps->m_oNumStart.Init();
pEdnProps->m_oNumStart->m_oVal.Init();
pEdnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
pEdnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
}
else if( c_oSerNotes::PrEndPos == type )
{
@ -3294,7 +3296,14 @@ int Binary_OtherTableReader::ReadOtherContent(BYTE type, long length, void* poRe
else if(c_oSerOtherTableTypes::DocxTheme == type)
{
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme(NULL);
pTheme->fromPPTY(&m_oBufferedStream);
try
{
pTheme->fromPPTY(&m_oBufferedStream);
}
catch(...)
{
//todooo в отдельный лог
}
NSBinPptxRW::CXmlWriter xmlWriter;
pTheme->toXmlWriter(&xmlWriter);
m_oFileWriter.m_oTheme.m_sContent = xmlWriter.GetXmlString();
@ -3801,8 +3810,7 @@ int Binary_SettingsTableReader::ReadFootnotePr(BYTE type, long length, void* poR
else if( c_oSerNotes::PrStart == type )
{
pFtnProps->m_oNumStart.Init();
pFtnProps->m_oNumStart->m_oVal.Init();
pFtnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
pFtnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
}
else if( c_oSerNotes::PrFntPos == type )
{
@ -3840,8 +3848,7 @@ int Binary_SettingsTableReader::ReadEndnotePr(BYTE type, long length, void* poRe
else if( c_oSerNotes::PrStart == type )
{
pEdnProps->m_oNumStart.Init();
pEdnProps->m_oNumStart->m_oVal.Init();
pEdnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
pEdnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
}
else if( c_oSerNotes::PrEndPos == type )
{
@ -4770,8 +4777,7 @@ int Binary_DocumentTableReader::ReadFFData(BYTE type, long length, void* poResul
else if ( c_oSerFFData::Label == type )
{
pFFData->m_oLabel.Init();
pFFData->m_oLabel->m_oVal.Init();
pFFData->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetLong());
pFFData->m_oLabel->m_oVal = m_oBufferedStream.GetLong();
}
else if ( c_oSerFFData::Name == type )
{
@ -4836,20 +4842,18 @@ int Binary_DocumentTableReader::ReadDDList(BYTE type, long length, void* poResul
if ( c_oSerFFData::DLDefault == type )
{
pDDList->m_oDefault.Init();
pDDList->m_oDefault->m_oVal.Init();
pDDList->m_oDefault->m_oVal->SetValue(m_oBufferedStream.GetLong());
pDDList->m_oDefault->m_oVal = m_oBufferedStream.GetLong();
}
else if ( c_oSerFFData::DLResult == type )
{
pDDList->m_oResult.Init();
pDDList->m_oResult->m_oVal.Init();
pDDList->m_oResult->m_oVal->SetValue(m_oBufferedStream.GetLong());
pDDList->m_oResult->m_oVal = m_oBufferedStream.GetLong();
}
else if ( c_oSerFFData::DLListEntry == type )
{
ComplexTypes::Word::String* pVal = new ComplexTypes::Word::String();
pVal->m_sVal.Init();
pVal->m_sVal->append(m_oBufferedStream.GetString3(length));
pVal->m_sVal = m_oBufferedStream.GetString3(length);
pDDList->m_arrListEntry.push_back(pVal);
}
else
@ -4901,20 +4905,17 @@ int Binary_DocumentTableReader::ReadTextInput(BYTE type, long length, void* poRe
if ( c_oSerFFData::TIDefault == type )
{
pTextInput->m_oDefault.Init();
pTextInput->m_oDefault->m_sVal.Init();
pTextInput->m_oDefault->m_sVal->append(m_oBufferedStream.GetString3(length));
pTextInput->m_oDefault->m_sVal = m_oBufferedStream.GetString3(length);
}
else if ( c_oSerFFData::TIFormat == type )
{
pTextInput->m_oFormat.Init();
pTextInput->m_oFormat->m_sVal.Init();
pTextInput->m_oFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
pTextInput->m_oFormat->m_sVal = m_oBufferedStream.GetString3(length);
}
else if ( c_oSerFFData::TIMaxLength == type )
{
pTextInput->m_oMaxLength.Init();
pTextInput->m_oMaxLength->m_oVal.Init();
pTextInput->m_oMaxLength->m_oVal->SetValue(m_oBufferedStream.GetLong());
pTextInput->m_oMaxLength->m_oVal = m_oBufferedStream.GetLong();
}
else if ( c_oSerFFData::TIType == type )
{
@ -8681,8 +8682,7 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
else if (c_oSerSdt::Alias == type)
{
pSdtPr->m_oAlias.Init();
pSdtPr->m_oAlias->m_sVal.Init();
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
pSdtPr->m_oAlias->m_sVal = m_oBufferedStream.GetString3(length);
}
else if (c_oSerSdt::Appearance == type)
{
@ -8730,14 +8730,12 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
else if (c_oSerSdt::Id == type)
{
pSdtPr->m_oId.Init();
pSdtPr->m_oId->m_oVal.Init();
pSdtPr->m_oId->m_oVal->SetValue(m_oBufferedStream.GetULong());
pSdtPr->m_oId->m_oVal = m_oBufferedStream.GetULong();
}
else if (c_oSerSdt::Label == type)
{
pSdtPr->m_oLabel.Init();
pSdtPr->m_oLabel->m_oVal.Init();
pSdtPr->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetULong());
pSdtPr->m_oLabel->m_oVal = m_oBufferedStream.GetULong();
}
else if (c_oSerSdt::Lock == type)
{
@ -8748,8 +8746,7 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
{
pSdtPr->m_oPlaceHolder.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal.Init();
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal->append(m_oBufferedStream.GetString3(length));
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal = m_oBufferedStream.GetString3(length);
}
else if (c_oSerSdt::RPr == type)
{
@ -8770,8 +8767,7 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
else if (c_oSerSdt::Tag == type)
{
pSdtPr->m_oTag.Init();
pSdtPr->m_oTag->m_sVal.Init();
pSdtPr->m_oTag->m_sVal->append(m_oBufferedStream.GetString3(length));
pSdtPr->m_oTag->m_sVal = m_oBufferedStream.GetString3(length);
}
else if (c_oSerSdt::Temporary == type)
{
@ -8910,8 +8906,7 @@ int Binary_DocumentTableReader::ReadSdtPrDate(BYTE type, long length, void* poRe
else if (c_oSerSdt::DateFormat == type)
{
pDate->m_oDateFormat.Init();
pDate->m_oDateFormat->m_sVal.Init();
pDate->m_oDateFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
pDate->m_oDateFormat->m_sVal = m_oBufferedStream.GetString3(length);
}
else if (c_oSerSdt::Lid == type)
{
@ -8936,14 +8931,12 @@ int Binary_DocumentTableReader::ReadDocPartList(BYTE type, long length, void* po
if (c_oSerSdt::DocPartCategory == type)
{
pDocPart->m_oDocPartCategory.Init();
pDocPart->m_oDocPartCategory->m_sVal.Init();
pDocPart->m_oDocPartCategory->m_sVal->append(m_oBufferedStream.GetString3(length));
pDocPart->m_oDocPartCategory->m_sVal = m_oBufferedStream.GetString3(length);
}
else if (c_oSerSdt::DocPartGallery == type)
{
pDocPart->m_oDocPartGallery.Init();
pDocPart->m_oDocPartGallery->m_sVal.Init();
pDocPart->m_oDocPartGallery->m_sVal->append(m_oBufferedStream.GetString3(length));
pDocPart->m_oDocPartGallery->m_sVal = m_oBufferedStream.GetString3(length);
}
else if (c_oSerSdt::DocPartUnique == type)
{
@ -9084,7 +9077,18 @@ BinaryFileReader::BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinar
}
int BinaryFileReader::ReadFile()
{
return ReadMainTable();
long res = c_oSerConstants::ReadOk;
try
{
res = ReadMainTable();
}
catch(...)
{
res = c_oSerConstants::ErrorStream;
}
return res;
}
int BinaryFileReader::ReadMainTable()
{

View File

@ -43,8 +43,9 @@
#include "../../OfficeUtils/src/OfficeUtils.h"
#ifndef _IOS
#include "../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
#include "../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
#endif
#include "../../HtmlFile/HtmlFile.h"
#include "../../ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h"
@ -367,7 +368,11 @@ template<typename T> void BinaryCommonWriter::WriteTrackRevision(const T& elem)
BinaryHeaderFooterTableWriter::BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels, std::map<int, bool>* mapIgnoreComments):
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_poTheme(oParamsWriter.m_poTheme), m_oFontProcessor(*oParamsWriter.m_pFontProcessor), m_oSettings(oParamsWriter.m_oSettings), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter), m_oDocumentRels(oDocumentRels),m_mapIgnoreComments(mapIgnoreComments)
m_oBcw(oParamsWriter),
m_oParamsWriter(oParamsWriter),
m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),
m_oDocumentRels(oDocumentRels),
m_mapIgnoreComments(mapIgnoreComments)
{
}
void BinaryHeaderFooterTableWriter::Write()
@ -441,7 +446,7 @@ void BinaryHeaderFooterTableWriter::WriteHdrFtrItem(OOX::Logic::CSectionProperty
m_oBcw.m_oStream.WriteLONG(g_nFormatVersion);
}
Binary_rPrWriter::Binary_rPrWriter(ParamsWriter& oParamsWriter) :m_oBcw(oParamsWriter), m_poTheme(oParamsWriter.m_poTheme), m_oFontProcessor(*oParamsWriter.m_pFontProcessor), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
Binary_rPrWriter::Binary_rPrWriter(ParamsWriter& oParamsWriter) :m_oBcw(oParamsWriter), m_pTheme(oParamsWriter.m_pTheme), m_oFontProcessor(*oParamsWriter.m_pFontProcessor), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
{
}
void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
@ -492,7 +497,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
std::wstring sFontCS;
const ComplexTypes::Word::CFonts& oFont = rPr->m_oRFonts.get();
if(NULL != m_poTheme && oFont.m_oAsciiTheme.IsInit())
if(NULL != m_pTheme && oFont.m_oAsciiTheme.IsInit())
{
const SimpleTypes::ETheme& eTheme = oFont.m_oAsciiTheme.get().GetValue();
switch(eTheme)
@ -500,11 +505,11 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
case SimpleTypes::themeMajorAscii:
case SimpleTypes::themeMajorBidi:
case SimpleTypes::themeMajorEastAsia:
case SimpleTypes::themeMajorHAnsi: sFontAscii = m_poTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMajorHAnsi: sFontAscii = m_pTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMinorAscii:
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi: sFontAscii = m_poTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
case SimpleTypes::themeMinorHAnsi: sFontAscii = m_pTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
default:
break;
}
@ -512,7 +517,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
else if(oFont.m_sAscii.IsInit())
sFontAscii = oFont.m_sAscii.get();
if(NULL != m_poTheme && oFont.m_oHAnsiTheme.IsInit())
if(NULL != m_pTheme && oFont.m_oHAnsiTheme.IsInit())
{
const SimpleTypes::ETheme& eTheme = oFont.m_oHAnsiTheme.get().GetValue();
switch(eTheme)
@ -520,18 +525,18 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
case SimpleTypes::themeMajorAscii:
case SimpleTypes::themeMajorBidi:
case SimpleTypes::themeMajorEastAsia:
case SimpleTypes::themeMajorHAnsi: sFontHAnsi = m_poTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMajorHAnsi: sFontHAnsi = m_pTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMinorAscii:
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi: sFontHAnsi = m_poTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
case SimpleTypes::themeMinorHAnsi: sFontHAnsi = m_pTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
default:
break;
}
}
else if(oFont.m_sHAnsi.IsInit())
sFontHAnsi = oFont.m_sHAnsi.get();
if(NULL != m_poTheme && oFont.m_oCsTheme.IsInit())
if(NULL != m_pTheme && oFont.m_oCsTheme.IsInit())
{
const SimpleTypes::ETheme& eTheme = oFont.m_oCsTheme.get().GetValue();
switch(eTheme)
@ -539,17 +544,17 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
case SimpleTypes::themeMajorAscii:
case SimpleTypes::themeMajorBidi:
case SimpleTypes::themeMajorEastAsia:
case SimpleTypes::themeMajorHAnsi: sFontCS = m_poTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMajorHAnsi: sFontCS = m_pTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMinorAscii:
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi: sFontCS = m_poTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
case SimpleTypes::themeMinorHAnsi: sFontCS = m_pTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
default: break;
}
}
else if(oFont.m_sCs.IsInit())
sFontCS = oFont.m_sCs.get();
if(NULL != m_poTheme && oFont.m_oEastAsiaTheme.IsInit())
if(NULL != m_pTheme && oFont.m_oEastAsiaTheme.IsInit())
{
const SimpleTypes::ETheme& eTheme = oFont.m_oEastAsiaTheme.get().GetValue();
switch(eTheme)
@ -557,11 +562,11 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
case SimpleTypes::themeMajorAscii:
case SimpleTypes::themeMajorBidi:
case SimpleTypes::themeMajorEastAsia:
case SimpleTypes::themeMajorHAnsi: sFontAE = m_poTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMajorHAnsi: sFontAE = m_pTheme->themeElements.fontScheme.majorFont.latin.typeface; break;
case SimpleTypes::themeMinorAscii:
case SimpleTypes::themeMinorBidi:
case SimpleTypes::themeMinorEastAsia:
case SimpleTypes::themeMinorHAnsi: sFontAE = m_poTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
case SimpleTypes::themeMinorHAnsi: sFontAE = m_pTheme->themeElements.fontScheme.minorFont.latin.typeface; break;
default: break;
}
}
@ -820,22 +825,68 @@ void Binary_rPrWriter::Write_rPrChange(const OOX::Logic::CRPrChange& rPrChange)
Binary_pPrWriter::Binary_pPrWriter(ParamsWriter& oParamsWriter, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter):
m_oBcw(oParamsWriter),brPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_oBinaryHeaderFooterTableWriter(oBinaryHeaderFooterTableWriter)
m_oParamsWriter(oParamsWriter),
m_oBcw(oParamsWriter),
brPrs(oParamsWriter),
m_oBinaryHeaderFooterTableWriter(oBinaryHeaderFooterTableWriter)
{
}
std::wstring Binary_pPrWriter::AddEmbeddedStyle(const std::wstring & sStyleId)
{
if (sStyleId.empty()) return L"";
std::wstring sNewStyleId;
std::map<std::wstring, size_t>::iterator pPair = m_oParamsWriter.m_pEmbeddedStyles->m_mapStyleNames.find(sStyleId);
if (pPair != m_oParamsWriter.m_pEmbeddedStyles->m_mapStyleNames.end())
{
OOX::CStyle* style = m_oParamsWriter.m_pEmbeddedStyles->m_arrStyle[pPair->second];
sNewStyleId = L"EmbeddedStyle" + std::to_wstring(m_oParamsWriter.m_pEmbeddedStyles->m_mapEmbeddedStyleNames.size() + 1) + L"_" + sStyleId;
m_oParamsWriter.m_pStyles->m_mapStyleNames.insert(std::make_pair(sNewStyleId, m_oParamsWriter.m_pStyles->m_arrStyle.size()));
m_oParamsWriter.m_pStyles->m_arrStyle.push_back(new OOX::CStyle(*style));
style = m_oParamsWriter.m_pStyles->m_arrStyle.back();
style->m_sStyleId = sNewStyleId;
if (style->m_oBasedOn.IsInit() && style->m_oBasedOn->m_sVal.IsInit())
style->m_oBasedOn->m_sVal = AddEmbeddedStyle(*style->m_oBasedOn->m_sVal);
m_oParamsWriter.m_pStyles->m_mapEmbeddedStyleNames.back().insert(std::make_pair(sStyleId, sNewStyleId));
}
return sNewStyleId;
}
void Binary_pPrWriter::Write_pPr(const OOX::Logic::CParagraphProperty& pPr)
{
int nCurPos = 0;
//Стили надо писать первыми, потому что применение стиля при открытии уничтажаются настройки параграфа
//ParaStyle
std::wstring sStyleId;
if(false != pPr.m_oPStyle.IsInit())
if (false != pPr.m_oPStyle.IsInit())
{
sStyleId = pPr.m_oPStyle.get().ToString2();
if (m_oParamsWriter.m_pEmbeddedStyles)
{
std::map<std::wstring, std::wstring>::iterator pFind = m_oParamsWriter.m_pStyles->m_mapEmbeddedStyleNames.back().find(sStyleId);
if (pFind == m_oParamsWriter.m_pStyles->m_mapEmbeddedStyleNames.back().end())
{
sStyleId = AddEmbeddedStyle(sStyleId);
}
else
{
sStyleId = pFind->second;
}
}
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::ParaStyle);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
m_oBcw.m_oStream.WriteStringW(sStyleId);
}
}
//Списки надо писать после стилей, т.к. при открытии в методах добавления списка проверяются стили
//Списки могут быть заданы с стилях.Это надо учитывать.
//NumPr
@ -980,7 +1031,7 @@ void Binary_pPrWriter::Write_pPr(const OOX::Logic::CParagraphProperty& pPr)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::outlineLvl);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(pPr.m_oOutlineLvl->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*pPr.m_oOutlineLvl->m_oVal);
}
//SectPr
if(NULL != m_oBinaryHeaderFooterTableWriter && pPr.m_oSectPr.IsInit())
@ -1123,30 +1174,75 @@ void Binary_pPrWriter::WriteTabItem(const ComplexTypes::Word::CTabStop& TabItem,
}
void Binary_pPrWriter::WriteNumPr(const OOX::Logic::CNumPr& numPr, const OOX::Logic::CParagraphProperty& pPr)
{
int nCurPos = 0;
if(false != numPr.m_oNumID.IsInit())
int nCurPos = 0, listNum = numPr.m_oNumID.IsInit() ? numPr.m_oNumID->m_oVal.get_value_or(0) : -1;
if (m_oParamsWriter.m_pEmbeddedNumbering && listNum >= 0)
{
const ComplexTypes::Word::CDecimalNumber& oCurNum = numPr.m_oNumID.get();
if(oCurNum.m_oVal.IsInit())
std::map<int, int>::iterator pFind = m_oParamsWriter.m_pNumbering->m_mapEmbeddedNames.back().find(listNum);
if (pFind == m_oParamsWriter.m_pNumbering->m_mapEmbeddedNames.back().end())
{
//pos
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::numPr_id);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(oCurNum.m_oVal->GetValue());
if ((m_oParamsWriter.m_pEmbeddedNumbering->m_arrNum[listNum - 1]) && (m_oParamsWriter.m_pEmbeddedNumbering->m_arrNum[listNum - 1]->m_oNumId.IsInit()))
{
int abstractNumId = 0;
if ((m_oParamsWriter.m_pEmbeddedNumbering->m_arrNum[listNum - 1]) && (m_oParamsWriter.m_pEmbeddedNumbering->m_arrNum[listNum - 1]->m_oAbstractNumId.IsInit()) &&
(m_oParamsWriter.m_pEmbeddedNumbering->m_arrNum[listNum - 1]->m_oAbstractNumId->m_oVal.IsInit()))
{
abstractNumId = *m_oParamsWriter.m_pEmbeddedNumbering->m_arrNum[listNum - 1]->m_oAbstractNumId->m_oVal;
}
OOX::Numbering::CAbstractNum *abstractNum = NULL;
if (abstractNumId < m_oParamsWriter.m_pEmbeddedNumbering->m_arrAbstractNum.size())
{
abstractNum = m_oParamsWriter.m_pEmbeddedNumbering->m_arrAbstractNum[abstractNumId];
}
if (abstractNum)
{
abstractNumId = m_oParamsWriter.m_pNumbering->m_arrAbstractNum.size();
m_oParamsWriter.m_pNumbering->m_arrAbstractNum.push_back(new OOX::Numbering::CAbstractNum());
abstractNum->copy(m_oParamsWriter.m_pNumbering->m_arrAbstractNum.back());
m_oParamsWriter.m_pNumbering->m_arrAbstractNum.back()->m_oAbstractNumId = abstractNumId;
int listNumNew = m_oParamsWriter.m_pNumbering->m_arrNum.size() + 1;
m_oParamsWriter.m_pNumbering->m_mapEmbeddedNames.back().insert(std::make_pair(listNum, listNumNew));
m_oParamsWriter.m_pNumbering->m_arrNum.push_back(new OOX::Numbering::CNum());
m_oParamsWriter.m_pNumbering->m_arrNum.back()->m_oNumId = listNumNew;
m_oParamsWriter.m_pNumbering->m_arrNum.back()->m_oAbstractNumId.Init();
m_oParamsWriter.m_pNumbering->m_arrNum.back()->m_oAbstractNumId->m_oVal = abstractNumId;
listNum = listNumNew;
}
}
}
else
{
listNum = pFind->second;
}
}
if(false != numPr.m_oIlvl.IsInit())
if (listNum >= 0)
{
//pos
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::numPr_id);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(listNum);
}
if (false != numPr.m_oIlvl.IsInit())
{
const ComplexTypes::Word::CDecimalNumber& oCurLvl = numPr.m_oIlvl.get();
if(oCurLvl.m_oVal.IsInit())
if (oCurLvl.m_oVal.IsInit())
{
//type
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::numPr_lvl);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(oCurLvl.m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*oCurLvl.m_oVal);
}
}
if(numPr.m_oIns.IsInit())
if (numPr.m_oIns.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::numPr_Ins);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
@ -1322,9 +1418,10 @@ void Binary_pPrWriter::WritePageSettings(OOX::Logic::CSectionProperty* pSectPr)
{
bool titlePg = false;
bool EvenAndOddHeaders = false;
if(NULL != pSectPr && pSectPr->m_oTitlePg.IsInit() && SimpleTypes::onoffTrue == pSectPr->m_oTitlePg->m_oVal.GetValue())
if (NULL != pSectPr && pSectPr->m_oTitlePg.IsInit() && SimpleTypes::onoffTrue == pSectPr->m_oTitlePg->m_oVal.GetValue())
titlePg = true;
if(NULL != m_oSettings && m_oSettings->m_oEvenAndOddHeaders.IsInit() && SimpleTypes::onoffTrue == m_oSettings->m_oEvenAndOddHeaders.get().m_oVal.GetValue())
if (m_oParamsWriter.m_pSettings && m_oParamsWriter.m_pSettings->m_oEvenAndOddHeaders.IsInit() && SimpleTypes::onoffTrue == m_oParamsWriter.m_pSettings->m_oEvenAndOddHeaders.get().m_oVal.GetValue())
EvenAndOddHeaders = true;
//titlePg
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_secPrSettingsType::titlePg);
@ -1655,7 +1752,7 @@ void Binary_pPrWriter::WriteNotePr(const nullable<ComplexTypes::Word::CNumFmt>&
if(numStart.IsInit() && numStart->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::PrStart);
m_oBcw.m_oStream.WriteLONG(numStart->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*numStart->m_oVal);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(NULL != ftnPos && ftnPos->IsInit() && (*ftnPos)->m_oVal.IsInit())
@ -1712,13 +1809,13 @@ void Binary_tblPrWriter::WriteTblPr(OOX::Logic::CTableProperty* p_tblPr)
if(tblPr.m_oTblStyleRowBandSize.IsInit() && tblPr.m_oTblStyleRowBandSize->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::RowBandSize);
m_oBcw.m_oStream.WriteLONG(tblPr.m_oTblStyleRowBandSize->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*tblPr.m_oTblStyleRowBandSize->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
if(tblPr.m_oTblStyleColBandSize.IsInit() && tblPr.m_oTblStyleColBandSize->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_tblPrType::ColBandSize);
m_oBcw.m_oStream.WriteLONG(tblPr.m_oTblStyleColBandSize->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*tblPr.m_oTblStyleColBandSize->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
//Jc
@ -2009,7 +2106,7 @@ void Binary_tblPrWriter::WriteAfter(const nullable<ComplexTypes::Word::CDecimalN
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::GridAfter);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(GridAfter->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*GridAfter->m_oVal);
}
//WAfter
if(WAfter.IsInit())
@ -2025,7 +2122,7 @@ void Binary_tblPrWriter::WriteBefore(const nullable<ComplexTypes::Word::CDecimal
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::GridBefore);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(GridBefore->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*GridBefore->m_oVal);
}
//WBefore
if(WBefore.IsInit())
@ -2116,7 +2213,7 @@ void Binary_tblPrWriter::WriteCellPr(OOX::Logic::CTableCellProperties* cellPr)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_cellPrType::GridSpan);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(cellPr->m_oGridSpan->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*cellPr->m_oGridSpan->m_oVal);
}
//Shd
if(cellPr->m_oShd.IsInit())
@ -2391,7 +2488,7 @@ void BinaryStyleTableWriter::WriteStyle(const OOX::CStyle& style)
if(false != style.m_sStyleId.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_sts::Style_Id);
m_oBcw.m_oStream.WriteStringW(style.m_sStyleId.get2());
m_oBcw.m_oStream.WriteStringW(*style.m_sStyleId);
}
//Name
std::wstring sName;
@ -2453,7 +2550,7 @@ void BinaryStyleTableWriter::WriteStyle(const OOX::CStyle& style)
if(false != style.m_oUiPriority.IsInit() && style.m_oUiPriority->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_sts::Style_uiPriority);
m_oBcw.m_oStream.WriteLONG(style.m_oUiPriority->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*style.m_oUiPriority->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
//hidden
@ -2664,13 +2761,13 @@ void BinaryNumberingTableWriter::WriteNum(const OOX::Numbering::CNum& num)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::Num_ANumId);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(num.m_oAbstractNumId->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*num.m_oAbstractNumId->m_oVal);
}
if (num.m_oNumId.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::Num_NumId);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(num.m_oNumId->GetValue());
m_oBcw.m_oStream.WriteLONG(*num.m_oNumId);
}
for (size_t i = 0; i < num.m_arrLvlOverride.size(); ++i)
{
@ -2688,13 +2785,13 @@ void BinaryNumberingTableWriter::WriteLvlOverride(const OOX::Numbering::CNumLvl&
if(numLvl.m_oIlvl.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::ILvl);
m_oBcw.m_oStream.WriteLONG(numLvl.m_oIlvl->GetValue());
m_oBcw.m_oStream.WriteLONG(*numLvl.m_oIlvl);
m_oBcw.WriteItemEnd(nCurPos);
}
if(numLvl.m_oStartOverride.IsInit() && numLvl.m_oStartOverride->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::StartOverride);
m_oBcw.m_oStream.WriteLONG(numLvl.m_oStartOverride->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*numLvl.m_oStartOverride->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
if(numLvl.m_oLvl.IsInit())
@ -2713,7 +2810,8 @@ void BinaryNumberingTableWriter::WriteAbstractNums(const OOX::CNumbering& number
for(size_t i = 0, length = numbering.m_arrAbstractNum.size(); i < length; ++i)
{
const OOX::Numbering::CAbstractNum& num = *numbering.m_arrAbstractNum[i];
if(false != num.m_oAbstractNumId.IsInit())
if (false != num.m_oAbstractNumId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::AbstractNum);
WriteAbstractNum(num, nRealCount, numbering.m_arrNum);
@ -2729,7 +2827,7 @@ void BinaryNumberingTableWriter::WriteAbstractNum(const OOX::Numbering::CAbstrac
if(num.m_oAbstractNumId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::AbstractNum_Id);
m_oBcw.m_oStream.WriteLONG(num.m_oAbstractNumId->GetValue());
m_oBcw.m_oStream.WriteLONG(*num.m_oAbstractNumId);
m_oBcw.WriteItemEnd(nCurPos);
}
@ -2757,9 +2855,12 @@ void BinaryNumberingTableWriter::WriteAbstractNum(const OOX::Numbering::CAbstrac
}
//Lvl
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::AbstractNum_Lvls);
WriteLevels(num.m_arrLvl, num.m_oAbstractNumId.get().GetValue(), aNums);
m_oBcw.WriteItemEnd(nCurPos);
if (false != num.m_oAbstractNumId.IsInit() && false == num.m_arrLvl.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerNumTypes::AbstractNum_Lvls);
WriteLevels(num.m_arrLvl, *num.m_oAbstractNumId, aNums);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryNumberingTableWriter::WriteLevels(const std::vector<OOX::Numbering::CLvl*>& lvls, int nAId, const std::vector<OOX::Numbering::CNum*>& aNums)
{
@ -2812,7 +2913,7 @@ void BinaryNumberingTableWriter::WriteLevel(const OOX::Numbering::CLvl& lvl)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Restart);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(oVal.m_oVal.get().GetValue());
m_oBcw.m_oStream.WriteLONG(*oVal.m_oVal);
}
}
//Start
@ -2823,7 +2924,7 @@ void BinaryNumberingTableWriter::WriteLevel(const OOX::Numbering::CLvl& lvl)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Start);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(oVal.m_oVal.get().GetValue());
m_oBcw.m_oStream.WriteLONG(*oVal.m_oVal);
}
}
//Suff
@ -2848,7 +2949,7 @@ void BinaryNumberingTableWriter::WriteLevel(const OOX::Numbering::CLvl& lvl)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_PStyle);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
m_oBcw.m_oStream.WriteStringW(lvl.m_oPStyle->m_sVal.get2());
m_oBcw.m_oStream.WriteStringW(*lvl.m_oPStyle->m_sVal);
}
//ParaPr
if(false != lvl.m_oPPr.IsInit())
@ -2877,7 +2978,7 @@ void BinaryNumberingTableWriter::WriteLevel(const OOX::Numbering::CLvl& lvl)
{
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::ILvl);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(lvl.m_oIlvl->GetValue());
m_oBcw.m_oStream.WriteLONG(*lvl.m_oIlvl);
}
if(lvl.m_oTentative.IsInit())
{
@ -2998,7 +3099,7 @@ void BinaryOtherTableWriter::WriteOtherContent()
}
BinaryDocumentTableWriter::BinaryDocumentTableWriter(ParamsWriter& oParamsWriter, ParamsDocumentWriter& oParamsDocumentWriter, std::map<int, bool>* mapIgnoreComments, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter):
m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter), m_oBcw(oParamsWriter),bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter),brPrs(oParamsWriter),btblPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter), m_oBcw(oParamsWriter), bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter), brPrs(oParamsWriter), btblPrs(oParamsWriter), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
{
pBackground = NULL;
pSectPr = NULL;
@ -3248,6 +3349,35 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile)
result = (S_OK == rtfConvert.ConvertRtfToOOX(file_name_inp, sResultDocxDir));
}break;
case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML:
{
std::wstring sResultDoctDir = NSDirectory::CreateDirectoryWithUniqueName(oAltChunkFile.filename().GetDirectory());
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
std::vector<std::wstring> arFiles;
arFiles.push_back(file_name_inp);
try
{
CHtmlFile oHtmlFile;
if (0 == oHtmlFile.Convert(arFiles, sResultDoctDir))
{
BinDocxRW::CDocxSerializer oCDocxSerializer;
std::wstring sXmlOptions;
std::wstring sThemePath; // will be filled by 'CreateDocxFolders' method
std::wstring sMediaPath; // will be filled by 'CreateDocxFolders' method
std::wstring sEmbedPath; // will be filled by 'CreateDocxFolders' method
oCDocxSerializer.CreateDocxFolders (sResultDocxDir, sThemePath, sMediaPath, sEmbedPath);
result = oCDocxSerializer.loadFromFile (sResultDoctFileEditor, sResultDocxDir, sXmlOptions, sThemePath, sMediaPath, sEmbedPath);
}
}
catch(...)
{
}
NSDirectory::DeleteDirectory(sResultDoctDir);
}break;
#endif
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM:
@ -3275,8 +3405,30 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile)
m_oParamsWriter.m_pOfficeDrawingConverter,
m_oParamsWriter.m_pEmbeddedFontsManager);
oParamsWriterEmb.m_poTheme = oDocx.m_pTheme;
oParamsWriterEmb.m_oSettings = oDocx.m_pSettings;
if (!m_oParamsWriter.m_pStyles)
{
m_oParamsWriter.m_pStyles = new OOX::CStyles(NULL);
m_oParamsWriter.m_bLocalStyles = true;
}
if (!m_oParamsWriter.m_pNumbering)
{
m_oParamsWriter.m_pNumbering = new OOX::CNumbering(NULL);
m_oParamsWriter.m_bLocalNumbering = true;
}
std::map<std::wstring, std::wstring> mapItemStyles;
m_oParamsWriter.m_pStyles->m_mapEmbeddedStyleNames.push_back(mapItemStyles);
std::map<int, int> mapItemNumbering;
m_oParamsWriter.m_pNumbering->m_mapEmbeddedNames.push_back(mapItemNumbering);
oParamsWriterEmb.m_pStyles = m_oParamsWriter.m_pStyles;
oParamsWriterEmb.m_pNumbering = m_oParamsWriter.m_pNumbering;
oParamsWriterEmb.m_pEmbeddedStyles = oDocx.m_pStyles;
oParamsWriterEmb.m_pEmbeddedNumbering = oDocx.m_pNumbering;
oParamsWriterEmb.m_pTheme = oDocx.m_pTheme;
oParamsWriterEmb.m_pSettings = oDocx.m_pSettings;
oParamsWriterEmb.m_pCurRels = oParamsDocumentWriterEmb.m_pRels;
BinaryDocumentTableWriter oBinaryDocumentEmbTableWriter(oParamsWriterEmb, oParamsDocumentWriterEmb, &oParamsWriterEmb.m_mapIgnoreComments, NULL);
@ -3300,6 +3452,15 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile)
m_oParamsWriter.m_pOfficeDrawingConverter,
m_oParamsWriter.m_pEmbeddedFontsManager);
std::map<std::wstring, std::wstring> mapItem;
m_oParamsWriter.m_pStyles->m_mapEmbeddedStyleNames.push_back(mapItem);
oParamsWriterEmb.m_pStyles = m_oParamsWriter.m_pStyles;
oParamsWriterEmb.m_pNumbering = m_oParamsWriter.m_pNumbering;
oParamsWriterEmb.m_pEmbeddedStyles = oDocxFlat.m_pStyles.GetPointer();
oParamsWriterEmb.m_pEmbeddedNumbering = oDocxFlat.m_pNumbering.GetPointer();
BinaryDocumentTableWriter oBinaryDocumentEmbTableWriter(oParamsWriterEmb, oParamsDocumentWriterEmb, &oParamsWriterEmb.m_mapIgnoreComments, NULL);
oBinaryDocumentEmbTableWriter.WriteDocumentContent(oDocxFlat.m_pDocument->m_arrItems);
}
@ -3319,7 +3480,6 @@ void BinaryDocumentTableWriter::WriteParapraph(OOX::Logic::CParagraph& par, OOX:
bpPrs.Write_pPr(*pPr);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Content
m_oBcw.m_oStream.WriteBYTE(c_oSerParType::Content);
nCurPos = m_oBcw.WriteItemWithLengthStart();
@ -3719,7 +3879,7 @@ void BinaryDocumentTableWriter::WriteFFData(const OOX::Logic::CFFData& oFFData)
if(oFFData.m_oLabel.IsInit() && oFFData.m_oLabel->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::Label);
m_oBcw.m_oStream.WriteLONG(oFFData.m_oLabel->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*oFFData.m_oLabel->m_oVal);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oFFData.m_oName.IsInit() && oFFData.m_oName->m_oVal.IsInit())
@ -3781,13 +3941,13 @@ void BinaryDocumentTableWriter::WriteDDList(const OOX::Logic::CFFDDList& oDDList
if(oDDList.m_oDefault.IsInit() && oDDList.m_oDefault->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLDefault);
m_oBcw.m_oStream.WriteLONG(oDDList.m_oDefault->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*oDDList.m_oDefault->m_oVal);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oDDList.m_oResult.IsInit() && oDDList.m_oResult->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::DLResult);
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*oDDList.m_oResult->m_oVal);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
for(size_t i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
@ -3851,7 +4011,7 @@ void BinaryDocumentTableWriter::WriteTextInput(const OOX::Logic::CFFTextInput& o
if(oTextInput.m_oMaxLength.IsInit() && oTextInput.m_oMaxLength->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFFData::TIMaxLength);
m_oBcw.m_oStream.WriteLONG(oTextInput.m_oMaxLength->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*oTextInput.m_oMaxLength->m_oVal);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if(oTextInput.m_oType.IsInit() && oTextInput.m_oType->m_oVal.IsInit())
@ -5953,9 +6113,9 @@ void BinaryDocumentTableWriter::WriteText(const std::wstring& text, BYTE type)
m_oBcw.m_pEmbeddedFontsManager->CheckString(text);
}
}
void BinaryDocumentTableWriter::WriteDrawingPptx(OOX::WritingElement* item)
bool BinaryDocumentTableWriter::WriteDrawingPptx(OOX::WritingElement* item)
{
if (item == NULL) return;
if (item == NULL) return false;
OOX::EElementType pElementType = item->getType();
std::wstring* pXml = NULL;
@ -5965,28 +6125,31 @@ void BinaryDocumentTableWriter::WriteDrawingPptx(OOX::WritingElement* item)
m_oBcw.m_oStream.ClearCurShapePositionAndSizes();
bool res = true;
if(OOX::et_mc_alternateContent == pElementType)
{
OOX::WritingElement* we = NULL;
OOX::Logic::CAlternateContent* pAlternateContent = static_cast<OOX::Logic::CAlternateContent*>(item);
if(pAlternateContent->m_arrChoiceItems.size() > 0)
if (pAlternateContent)
{
we = pAlternateContent->m_arrChoiceItems[0];
if(OOX::et_w_drawing == pAlternateContent->m_arrChoiceItems[0]->getType())
if (false == pAlternateContent->m_arrChoiceItems.empty())
{
we = pAlternateContent->m_arrChoiceItems[0];
}
}
res = WriteDrawingPptx(we);
if (we == NULL)
{
if(pAlternateContent->m_arrChoiceItems.size() > 0)
if (res == false || we == NULL)
{
if (false == pAlternateContent->m_arrFallbackItems.empty())
{
we = pAlternateContent->m_arrFallbackItems[0];
res = WriteDrawingPptx(we);
}
}
}
WriteDrawingPptx(we);
}
else if(OOX::et_w_drawing == pElementType)
{
@ -6013,12 +6176,25 @@ void BinaryDocumentTableWriter::WriteDrawingPptx(OOX::WritingElement* item)
WriteDrawing(pXml, NULL, NULL);
m_oBcw.WriteItemEnd(nCurPos);
}
else if (pGraphicDrawing || pGraphic)
{
if ((pGraphic) && (pGraphic->contentPart.IsInit()))
{
//todooo разобрать по типам вставок
res = false;
}
else
{
int nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::pptxDrawing);
WriteDrawing(NULL, pGraphicDrawing, pGraphic);
m_oBcw.WriteItemEnd(nCurPos);
}
}
else
{
int nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::pptxDrawing);
WriteDrawing(NULL, pGraphicDrawing, pGraphic);
m_oBcw.WriteItemEnd(nCurPos);
res = false;
}
return res;
}
void BinaryDocumentTableWriter::WriteDrawing(std::wstring* pXml, OOX::Logic::CDrawing* pDrawing, PPTX::Logic::GraphicFrame *pGraphic)
{
@ -6876,7 +7052,7 @@ int BinaryDocumentTableWriter::GetColsCount(const std::vector<OOX::WritingElemen
OOX::Logic::CTableCellProperties* tcPr = static_cast<OOX::Logic::CTableCellProperties*>(item2);
if(tcPr->m_oGridSpan.IsInit() && tcPr->m_oGridSpan->m_oVal.IsInit())
{
int nGridSpan = tcPr->m_oGridSpan->m_oVal->GetValue();
int nGridSpan = *tcPr->m_oGridSpan->m_oVal;
if(nGridSpan > 0)
nColCount += nGridSpan;
}
@ -7262,13 +7438,13 @@ void BinaryDocumentTableWriter::WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
if(oStdPr.m_oId.IsInit() && oStdPr.m_oId->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Id);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oId->m_oVal->GetValue());
m_oBcw.m_oStream.WriteULONG(*oStdPr.m_oId->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oLabel.IsInit() && oStdPr.m_oLabel->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Label);
m_oBcw.m_oStream.WriteULONG(oStdPr.m_oLabel->m_oVal->GetValue());
m_oBcw.m_oStream.WriteULONG(*oStdPr.m_oLabel->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
if(oStdPr.m_oLock.IsInit())
@ -7819,7 +7995,7 @@ void BinarySettingsTableWriter::WriteSettingsContent(OOX::CSettings& oSettings,
if(oSettings.m_oBookFoldPrintingSheets.IsInit() && oSettings.m_oBookFoldPrintingSheets->m_oVal.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::BookFoldPrintingSheets);
m_oBcw.m_oStream.WriteLONG(oSettings.m_oBookFoldPrintingSheets->m_oVal->GetValue());
m_oBcw.m_oStream.WriteLONG(*oSettings.m_oBookFoldPrintingSheets->m_oVal);
m_oBcw.WriteItemEnd(nCurPos);
}
if(oSettings.m_oBookFoldRevPrinting.IsInit())
@ -8400,16 +8576,13 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
OOX::Document *pMain = NULL;
OOX::CDocument *pDocument = NULL;
OOX::CStyles *pStyles = NULL;
OOX::CFontTable *pFontTable = NULL;
OOX::CNumbering *pNumbering = NULL;
OOX::CComments *pComments = NULL;
OOX::CSettings *pSettings = NULL;
if ((pDocx) && (pDocx->m_pDocument))
{
m_oParamsWriter.m_poTheme = pDocx->m_pTheme;
m_oParamsWriter.m_oSettings = pDocx->m_pSettings;
m_oParamsWriter.m_pTheme = pDocx->m_pTheme;
m_oParamsWriter.m_pSettings = pDocx->m_pSettings;
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(pDocx->m_pTheme);
oBufferedStream.m_pTheme->AddRef();
@ -8417,11 +8590,12 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
pMain = dynamic_cast<OOX::Document*>(pDocx);
pDocument = pDocx->m_pDocument;
pStyles = pDocx->m_pStyles;
pFontTable = pDocx->m_pFontTable;
pNumbering = pDocx->m_pNumbering;
pComments = pDocx->m_pComments;
pSettings = pDocx->m_pSettings;
m_oParamsWriter.m_pSettings = pDocx->m_pSettings;
m_oParamsWriter.m_pStyles = pDocx->m_pStyles;
m_oParamsWriter.m_pNumbering = pDocx->m_pNumbering;
}
else
{
@ -8433,11 +8607,12 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
pMain = dynamic_cast<OOX::Document*>(pDocxFlat);
pDocument = pDocxFlat->m_pDocument.GetPointer();
pStyles = pDocxFlat->m_pStyles.GetPointer();
pFontTable = pDocxFlat->m_pFontTable.GetPointer();
pNumbering = pDocxFlat->m_pNumbering.GetPointer();
pComments = &pDocxFlat->m_oComments;
pSettings = pDocxFlat->m_pSettings.GetPointer();
m_oParamsWriter.m_pSettings = pDocxFlat->m_pSettings.GetPointer();
m_oParamsWriter.m_pStyles = pDocxFlat->m_pStyles.GetPointer();
m_oParamsWriter.m_pNumbering = pDocxFlat->m_pNumbering.GetPointer();
}
}
if (pFontTable)
@ -8468,11 +8643,11 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
}
}
if (pSettings)
if (m_oParamsWriter.m_pSettings)
{
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
oBinarySettingsTableWriter.Write(*pSettings, oSettingsCustom);
oBinarySettingsTableWriter.Write(*m_oParamsWriter.m_pSettings, oSettingsCustom);
this->WriteTableEnd(nCurPos);
}
@ -8495,23 +8670,6 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
this->WriteTableEnd(nCurPos);
}
//Write StyleTable
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
if (pStyles)
{
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
oBinaryStyleTableWriter.Write(*pStyles);
this->WriteTableEnd(nCurPos);
}
//Write Numbering
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
if (pNumbering)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
oBinaryNumberingTableWriter.Write(*pNumbering);
this->WriteTableEnd(nCurPos);
}
BinDocxRW::BinaryNotesTableWriter oBinaryNotesWriter(m_oParamsWriter);
//Write Footnotes
if ((pDocx) && (pDocx->m_pFootnotes))
@ -8570,14 +8728,6 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
}
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba
if ((pDocx) && (pDocx->m_pVbaProject))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*pDocx->m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
// Write content
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(pDocument->m_arrItems);
@ -8587,15 +8737,48 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
oBinaryHeaderFooterTableWriter.Write();
this->WriteTableEnd(nCurPos);
if(NULL != m_oParamsWriter.m_poTheme)
if(NULL != m_oParamsWriter.m_pTheme)
{
int nCurPos = WriteTableStart(c_oSerTableTypes::Other);
BinaryOtherTableWriter oBinaryOtherTableWriter(m_oParamsWriter, m_oParamsWriter.m_poTheme);
BinaryOtherTableWriter oBinaryOtherTableWriter(m_oParamsWriter, m_oParamsWriter.m_pTheme);
oBinaryOtherTableWriter.Write();
WriteTableEnd(nCurPos);
}
this->WriteMainTableEnd();
//Write Vba
if ((pDocx) && (pDocx->m_pVbaProject))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*pDocx->m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
//Write StyleTable
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
if (m_oParamsWriter.m_pStyles)
{
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
oBinaryStyleTableWriter.Write(*m_oParamsWriter.m_pStyles);
this->WriteTableEnd(nCurPos);
}
//Write Numbering
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
if (m_oParamsWriter.m_pNumbering)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
oBinaryNumberingTableWriter.Write(*m_oParamsWriter.m_pNumbering);
this->WriteTableEnd(nCurPos);
}
this->WriteMainTableEnd();
if (m_oParamsWriter.m_bLocalStyles)
delete m_oParamsWriter.m_pStyles;
if (m_oParamsWriter.m_bLocalNumbering)
delete m_oParamsWriter.m_pNumbering;
if (pDocx) delete pDocx; pDocx = NULL;
if (pDocxFlat) delete pDocxFlat; pDocxFlat = NULL;
}

View File

@ -75,25 +75,41 @@ namespace BinDocxRW
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
OOX::Document* m_pMain;
OOX::CSettings* m_oSettings;
PPTX::Theme* m_poTheme;
OOX::CSettings* m_pSettings;
PPTX::Theme* m_pTheme;
OOX::CStyles* m_pStyles;
OOX::CNumbering* m_pNumbering;
bool m_bLocalStyles;
bool m_bLocalNumbering;
OOX::CStyles* m_pEmbeddedStyles;
OOX::CNumbering* m_pEmbeddedNumbering;
OOX::IFileContainer* m_pCurRels;
std::map<int, bool> m_mapIgnoreComments;
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
m_pCBufferedStream(pCBufferedStream), m_pFontProcessor(pFontProcessor), m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
m_pCBufferedStream(pCBufferedStream), m_pFontProcessor(pFontProcessor), m_pOfficeDrawingConverter(pOfficeDrawingConverter), m_pEmbeddedFontsManager(pEmbeddedFontsManager)
{
m_pMain = NULL;
m_oSettings = NULL;
m_poTheme = NULL;
m_pSettings = NULL;
m_pTheme = NULL;
m_pCurRels = NULL;
m_pStyles = NULL;
m_pNumbering = NULL;
m_pEmbeddedStyles = NULL;
m_pEmbeddedNumbering = NULL;
m_bLocalStyles = m_bLocalNumbering = false;
}
};
class ParamsDocumentWriter
{
public:
OOX::IFileContainer* m_pRels;
OOX::IFileContainer* m_pRels;
ParamsDocumentWriter(OOX::IFileContainer* pRels) : m_pRels(pRels)
{
@ -129,10 +145,7 @@ namespace BinDocxRW
class BinaryHeaderFooterTableWriter
{
BinaryCommonWriter m_oBcw;
OOX::CSettings* m_oSettings;
PPTX::Theme* m_poTheme;
DocWrapper::FontProcessor& m_oFontProcessor;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
std::map<int, bool>* m_mapIgnoreComments;
public:
@ -162,7 +175,7 @@ namespace BinDocxRW
{
BinaryCommonWriter m_oBcw;
public:
PPTX::Theme* m_poTheme;
PPTX::Theme* m_pTheme;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
DocWrapper::FontProcessor& m_oFontProcessor;
@ -174,7 +187,8 @@ namespace BinDocxRW
{
BinaryCommonWriter m_oBcw;
Binary_rPrWriter brPrs;
OOX::CSettings* m_oSettings;
ParamsWriter& m_oParamsWriter;
public:
BinaryHeaderFooterTableWriter* m_oBinaryHeaderFooterTableWriter;
@ -202,6 +216,9 @@ namespace BinDocxRW
const nullable<ComplexTypes::Word::CDecimalNumber>& numStart, nullable<ComplexTypes::Word::CFtnPos>* ftnPos,
nullable<ComplexTypes::Word::CEdnPos>* endPos, std::vector<OOX::CFtnEdnSepRef*>* refs);
void WriteNumFmt(const ComplexTypes::Word::CNumFmt& oNumFmt);
private:
std::wstring AddEmbeddedStyle(const std::wstring & styleId);
};
class Binary_tblPrWriter
{
@ -292,12 +309,12 @@ namespace BinDocxRW
{
private:
ParamsWriter& m_oParamsWriter;
ParamsDocumentWriter& m_oParamsDocumentWriter;
BinaryCommonWriter m_oBcw;
Binary_pPrWriter bpPrs;
Binary_rPrWriter brPrs;
std::wstring m_sCurParStyle;
OOX::CSettings* m_oSettings;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
std::map<int, bool>* m_mapIgnoreComments;
@ -440,7 +457,7 @@ namespace BinDocxRW
void WriteRunContent(std::vector<OOX::WritingElement*>::iterator &start, std::vector<OOX::WritingElement*>::iterator &end, bool bHyperlink = false);
void WriteNoteRef(const nullable<SimpleTypes::COnOff<>>& oCustomMarkFollows, const nullable<SimpleTypes::CDecimalNumber<>>& oId);
void WriteText(const std::wstring& text, BYTE type);
void WriteDrawingPptx(OOX::WritingElement* item);
bool WriteDrawingPptx(OOX::WritingElement* item);
void WriteDrawing(std::wstring* pXml, OOX::Logic::CDrawing* pDrawing, PPTX::Logic::GraphicFrame *pGraphic);
void WriteNvGraphicFramePr(const PPTX::Logic::NvGraphicFramePr& oGraphicFramePr);
void WriteDocPr(const PPTX::Logic::CNvPr& oDocPr);

View File

@ -202,7 +202,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
bool bValidFormat = false;
std::wstring sSignature(g_sFormatSignature);
int nSigLength = (int)sSignature.length();
if((int)nBase64DataSize > nSigLength)
if ((int)nBase64DataSize > nSigLength)
{
std::string sCurSig((char*)pBase64Data, nSigLength);
if(sSignature == std::wstring(sCurSig.begin(), sCurSig.end()))
@ -217,7 +218,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
int nType = 0;
std::string version = "";
std::string dst_len = "";
while (true)
while (nIndex < nBase64DataSize)
{
nIndex++;
BYTE _c = pBase64Data[nIndex];

View File

@ -174,8 +174,15 @@ namespace BinXlsxRW{
BinXlsxRW::SaveParams oSaveParams(sDrawingsPath, sThemePath, m_pExternalDrawingConverter->GetContentTypes());
OOX::Spreadsheet::CChartSpace oChartSpace(NULL);
BinXlsxRW::BinaryChartReader oBinaryChartReader(*pReader, oSaveParams, m_pExternalDrawingConverter);
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace);
try
{
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace);
}
catch(...)
{
//todooo
}
if(oChartSpace.isValid())
{

View File

@ -38,7 +38,8 @@ SOURCES += \
../../OfficeCryptReader/source/ECMACryptFile.cpp \
../../OfficeCryptReader/source/CryptTransform.cpp \
../BinReader/Readers.cpp \
../BinReader/CustormXmlWriter.cpp
../BinReader/CustormXmlWriter.cpp \
../BinReader/FileWriter.cpp
HEADERS += ../DocWrapper/DocxSerializer.h \
../DocWrapper/FontProcessor.h \

View File

@ -615,10 +615,8 @@ namespace formulasconvert {
cells_out.append(cells[j]);
cells_out.append(L":");
}
size_t res1 = sheet.find(L"-");
size_t res2 = sheet.find(L"'");
if (res1 != std::wstring::npos && res2 != std::wstring::npos && !(res2 == 0))
if (sheet.find(L"-") != std::wstring::npos && sheet.find(L"'") == std::wstring::npos && sheet.find(L"\"") == std::wstring::npos)
{
sheet = L"'" + sheet + L"'";
}

View File

@ -601,6 +601,7 @@ enum ElementType
typeChartStockRangeLine,
typeChartRegressionCurve,
typeChartEquation,
typeChartDateScale,
typeStyleChartProperties,

View File

@ -217,6 +217,7 @@ SOURCES += \
../src/odf/datatypes/bibliography.cpp \
../src/odf/datatypes/commandtype.cpp \
../src/odf/datatypes/styleprint.cpp \
../src/odf/datatypes/charttimeunit.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
@ -478,6 +479,7 @@ HEADERS += \
../src/odf/datatypes/chartlabelposition.h \
../src/odf/datatypes/grandtotal.h \
../src/odf/datatypes/styleprint.h \
../src/odf/datatypes/charttimeunit.h \
../src/docx/docx_content_type.h \
../src/docx/docx_conversion_context.h \
../src/docx/docx_conversion_state.h \

View File

@ -131,3 +131,4 @@
#include "../src/odf/datatypes/stylenumformat.cpp"
#include "../src/odf/datatypes/bibliography.cpp"
#include "../src/odf/datatypes/styleprint.cpp"
#include "../src/odf/datatypes/charttimeunit.cpp"

View File

@ -1201,7 +1201,7 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
int count_columns = 1;
bool sep_columns = false;
oox::section_context::_section & section = get_section_context().get();
oox::section_context::_section & section = get_section_context().get_last();
if (!columns)
{
@ -1299,7 +1299,7 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
}
bool docx_conversion_context::process_page_properties(std::wostream & strm)
{
if (is_next_dump_page_properties() || get_section_context().get().is_dump_)
if (is_next_dump_page_properties() || get_section_context().get_last().is_dump_)
{
std::wstring pageProperties = get_page_properties();
odf_reader::page_layout_instance * page_layout_instance_ = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
@ -1477,14 +1477,14 @@ bool docx_conversion_context::get_page_break_before()
void docx_conversion_context::add_page_properties(const std::wstring & StyleName)
{
section_context::_section & s = section_context_.get();
section_context::_section & s = section_context_.get_last();
s.page_properties_.push_back( StyleName);
}
std::wstring docx_conversion_context::get_page_properties()
{
section_context::_section & s = section_context_.get();
section_context::_section & s = section_context_.get_last();
if (s.page_properties_.size() > 1) return s.page_properties_[1];
else if (s.page_properties_.size() == 1) return s.page_properties_[0];
@ -1492,7 +1492,7 @@ std::wstring docx_conversion_context::get_page_properties()
}
void docx_conversion_context::remove_page_properties()
{
section_context::_section & s = section_context_.get();
section_context::_section & s = section_context_.get_last();
if (s.page_properties_.size() > 1)
{
@ -1988,7 +1988,34 @@ void section_context::add_section(const std::wstring & SectionName, const std::w
_section newSec(SectionName, Style, PageProperties );
sections_.push_back(newSec);
}
section_context::_section & section_context::get_first()
{
if (sections_.empty())
return main_section_;
else
return sections_[0];
}
section_context::_section & section_context::get_last()
{
if (sections_.empty())
return main_section_;
else
return sections_.back();
}
void section_context::remove_section()
{
if (sections_.empty()) return;
sections_.pop_back();
//sections_.erase(sections_.begin(), sections_.begin() + 1);
if (sections_.empty())
{
//после оканчания разметки секциями и начале (возобновлении) основного раздела нужен разрыв (хотя настройки страницы могут и не поменяться)
//щас разрыв на текущей странице
//todooo проверить - может типо если следующий будет заголовок - разорвать
main_section_.is_dump_ = false;
}
}
namespace
{
// обработка Header/Footer

View File

@ -324,11 +324,10 @@ public:
struct _section
{
_section() {is_dump_ = false;}
_section() : is_dump_(false){}
_section(const std::wstring & SectionName, const std::wstring & Style, const std::wstring & PageProperties)
_section(const std::wstring & SectionName, const std::wstring & Style, const std::wstring & PageProperties) : is_dump_(false)
{
is_dump_ = false;
name_ = SectionName;
style_ = Style;
page_properties_.push_back(PageProperties);
@ -340,7 +339,7 @@ public:
std::vector<std::wstring> page_properties_;
bool is_dump_;
bool is_dump_ = false;
};
void add_section(const std::wstring & SectionName, const std::wstring & Style, const std::wstring & PageProperties);
@ -349,27 +348,12 @@ public:
{
return sections_.empty();
}
_section & get()
{
if (sections_.empty())
return main_section_;
else
return sections_[0];
}
void remove_section()
{
if (sections_.empty()) return;
_section & get_first();
_section & get_last();
sections_.erase(sections_.begin(), sections_.begin() + 1);
if (sections_.empty())
{
//после оканчания разметки секциями и начале (возобновлении) основного раздела нужен разрыв (хотя настройки страницы могут и не поменяться)
//щас разрыв на текущей странице
//todooo проверить - может типо если следующий будет заголовок - разорвать
main_section_.is_dump_ = false;
}
}
std::wstring dump_;
void remove_section();
std::wstring dump_;
private:
_section main_section_;

View File

@ -34,32 +34,30 @@
#include <boost/lexical_cast.hpp>
#include <logging.h>
#include <float.h>
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
namespace cpdoccore {
namespace utils {
std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager)
std::pair<double, double> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager)
{
if (pFontManager == NULL) return std::pair<float, float>(7,8);
if (pFontManager == NULL) return std::pair<double, double>(7., 8.);
int hr = FALSE;
int hr = FALSE;
if (FALSE == (hr = pFontManager->LoadFontByName(fontName, fontSize, fontStyle, dpi, dpi )))
{
if (FALSE == (hr = pFontManager->LoadFontByName(L"Arial", fontSize, fontStyle, dpi, dpi )))
{
return std::pair<float, float>(7, 8);
return std::pair<double, double>(7, 8);
}
}
float maxWidth = 0;
float maxHeight = 0;
double maxWidth = 0;
double maxHeight = 0;
float minWidth = 0xffff;
float minHeight = 0xffff;
double minWidth = 0xffffffff;
double minHeight = 0xfffffff;
// for (int i = 0; i <= 9; ++i)
{
@ -67,7 +65,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
// return std::pair<float, float>(7,8);
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))//
return std::pair<float, float>(7,8);
return std::pair<double, double>(7., 8.);
TBBox box;
try
@ -75,12 +73,12 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
box = pFontManager->MeasureString();
}catch(...)
{
return std::pair<float, float>(7,8);
return std::pair<double, double>(7.,8.);
}
if (box.fMaxX < -0xffff+1 || box.fMaxY < -0xffff+1 ||
box.fMinX > 0xffff-1 || box.fMinY > 0xffff-1)
return std::pair<float, float>(7,8);
return std::pair<double, double>(7., 8. );
if (box.fMaxX - box.fMinX > maxWidth) maxWidth = box.fMaxX - box.fMinX;
if (box.fMaxY - box.fMinY > maxHeight) maxHeight = box.fMaxY - box.fMinY;
@ -91,11 +89,11 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
double width = (minWidth + 2 * maxWidth) /36. /3.;
//double width = (minWidth + 2 * maxWidth) / 5./*/36.*/ /3.;
return std::pair<float, float>(width, maxHeight);
return std::pair<double, double>(width, maxHeight);
}
std::pair<float, float> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts)
std::pair<double, double> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts)
{
try
{
@ -105,7 +103,7 @@ std::pair<float, float> GetMaxDigitSizePixels(const std::wstring & fontName, dou
{
NSFonts::IFontManager *pFontManager = appFonts->GenerateFontManager();
std::pair<float, float> val = GetMaxDigitSizePixelsImpl(fontName, fontSize, dpi, fontStyle, pFontManager);
std::pair<double, double> val = GetMaxDigitSizePixelsImpl(fontName, fontSize, dpi, fontStyle, pFontManager);
if (pFontManager)
{
@ -120,7 +118,7 @@ std::pair<float, float> GetMaxDigitSizePixels(const std::wstring & fontName, dou
{
// TODO: default value!
}
return std::pair<float, float>(7, 8);
return std::pair<double, double>(7., 8.);
}
}

View File

@ -42,7 +42,7 @@ namespace NSFonts
namespace cpdoccore {
namespace utils {
std::pair<float, float> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts);
std::pair<double, double> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts);
}
}

View File

@ -137,7 +137,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:orientation")
{
odf_reader::GetProperty(content_.properties_,L"reverse-direction",boolVal);
odf_reader::GetProperty(content_.properties_, L"reverse-direction",boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_ATTR(L"val", "maxMin");
@ -147,7 +147,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
CP_XML_ATTR(L"val", "minMax");//default
}
}
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
odf_reader::GetProperty(content_.properties_, L"maximum", doubleVal);
if (doubleVal)
{
CP_XML_NODE(L"c:max")
@ -189,16 +189,31 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
}
//oox_serialize_ln(_Wostream, content_.graphic_properties_);
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
_CP_OPT(bool) bLinkData;
_CP_OPT(int) nTypeFormat;
odf_reader::GetProperty(content_.properties_, L"num_format", strVal);
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", boolVal);
odf_reader::GetProperty(content_.properties_, L"num_format", strNumFormat);
odf_reader::GetProperty(content_.properties_, L"percentage_num_format", strPercentFormat);
odf_reader::GetProperty(content_.properties_, L"data-label-number", nTypeFormat);
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", bLinkData);
if ((strVal) && (strVal->length() > 1))
std::wstring formatCode;
if ((nTypeFormat) && (*nTypeFormat == 2) && strPercentFormat)
{
formatCode = *strPercentFormat;
}
else if ((strNumFormat) && (strNumFormat->length() > 1))
{
formatCode = *strNumFormat;
}
if (formatCode.length() > 1)
{
CP_XML_NODE(L"c:numFmt")
{
CP_XML_ATTR(L"formatCode", *strVal);
CP_XML_ATTR(L"sourceLinked", boolVal.get_value_or(true));
CP_XML_ATTR(L"formatCode", formatCode);
CP_XML_ATTR(L"sourceLinked", bLinkData.get_value_or(true));
}
}
@ -228,7 +243,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
{
shape.oox_serialize(CP_XML_STREAM());
}
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal);
odf_reader::GetProperty(content_.properties_, L"display_label",boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_NODE(L"c:minorTickMark")
@ -241,7 +256,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
title.oox_serialize(_Wostream);
odf_reader::GetProperty(content_.properties_,L"display_label", boolVal);
odf_reader::GetProperty(content_.properties_, L"display_label", boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_NODE(L"c:tickLblPos")
@ -250,7 +265,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
}
}
shape.set(content_.graphic_properties_,content_.fill_) ;
shape.set(content_.graphic_properties_, content_.fill_) ;
shape.oox_serialize(_Wostream);
oox_serialize_default_text(_Wostream, content_.text_properties_);

View File

@ -41,22 +41,8 @@
namespace cpdoccore {
namespace oox {
class oox_chart_context::Impl
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) : mediaitems_(m), no_used_local_tables_(false)
{
public:
Impl(std::wstring name){}
std::wstring name_;
std::wstringstream chartData_;
std::wstring drawingName_;
std::wstring drawingId_;
};
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) :
impl_(new oox_chart_context::Impl( name)), mediaitems_(m)
{
}
void oox_chart_context::reset_fill(oox::_oox_fill &f)
@ -84,10 +70,6 @@ void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &li
userShapesId_ = link.second;
rels_.push_back(_rel(isInternal, userShapesId_, link.first, typeChartUserShapes));
}
std::wostream & oox_chart_context::chartData()
{
return impl_->chartData_;
}
void oox_chart_context::dump_rels(rels & Rels)
{
@ -146,9 +128,12 @@ void oox_chart_context::serialize(std::wostream & strm)
CP_XML_NODE(L"c:lang")
{
CP_XML_ATTR(L"val",L"en-US");
CP_XML_ATTR(L"val", L"en-US");
}
CP_XML_NODE(L"c:roundedCorners")
{
CP_XML_ATTR(L"val", 0);
}
if (pivot_source_.empty() == false)
{
set_cache_only(true);

View File

@ -45,7 +45,6 @@
namespace cpdoccore {
namespace oox {
class oox_chart_context;
typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
@ -56,8 +55,6 @@ public:
oox_chart_context(mediaitems_ptr & mediaitems_, std::wstring name);
~oox_chart_context();
std::wostream & chartData();
void reset_fill(oox::_oox_fill &fill_);
void serialize(std::wostream & strm);
@ -67,9 +64,10 @@ public:
{
pivot_source_ = source;
}
void set_title(odf_reader::chart::title & t)
void set_title(odf_reader::chart::title & t, odf_reader::chart::title & sub)
{
title_.set_content(t);
title_.set_sub_content(sub);
}
void add_axis(int type, odf_reader::chart::axis & content)
{
@ -125,12 +123,10 @@ public:
plot_area_.properties_3d_ = prop_3d;
plot_area_.fill_ = fill;
}
bool no_used_local_tables_;
void set_cache_only (bool val);
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
mediaitems_ptr mediaitems_;
std::vector<_rel> rels_;
@ -145,18 +141,6 @@ private:
std::vector<odf_reader::_property> graphic_properties_;
_oox_fill fill_;
};
//autoTitleDeleted (Auto Title Is Deleted) §21.2.2.7
//backWall (Back Wall) §21.2.2.11
//dispBlanksAs (Display Blanks As) §21.2.2.42
//extLst (Chart Extensibility) §21.2.2.64
//floor (Floor) §21.2.2.69
//legend (Legend) §21.2.2.93
//pivotFmts (Pivot Formats) §21.2.2.143
//plotArea (Plot Area) §21.2.2.145
//plotVisOnly (Plot Visible Only) §21.2.2.146
//showDLblsOverMax (Show Data Labels over Maximum) §21.2.2.180
//sideWall (Side Wall) §21.2.2.191
//title (Title) §21.2.2.210
//view3D (View In 3D)
}
}

View File

@ -40,7 +40,7 @@
namespace cpdoccore {
namespace oox {
class oox_chart_legend: boost::noncopyable
class oox_chart_legend : boost::noncopyable
{
public:
oox_chart_legend(){}

View File

@ -55,9 +55,9 @@ oox_chart_series::oox_chart_series()
values_[3].type = L"c:yVal";
values_[4].type = L"c:bubbleSize";//заместо оси х!!!!
iSymbolMarkerType_ = 0;
bLocalTable_ = false;
labelPosEnabled_ = true;
iSymbolMarkerType_ = 0;
bCacheOnly_ = false;
labelPosEnabled_ = true;
}
void oox_chart_series::setName(const std::wstring &value)
{
@ -93,7 +93,7 @@ void oox_chart_series::setFormula(int ind, const std::wstring &value, const std:
void oox_chart_series::set_cache_only (bool val)
{
bLocalTable_ = val;
bCacheOnly_ = val;
}
void oox_chart_series::parse_properties()
@ -127,14 +127,32 @@ void oox_chart_series::parse_properties()
data_labels_->set_showCatName(*boolVal);
}
odf_reader::GetProperty(content_.properties_, L"data-label-number", intVal);
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
_CP_OPT(bool) bLinkData;
_CP_OPT(int) nTypeFormat;
if (intVal)
odf_reader::GetProperty(content_.properties_, L"num_format", strNumFormat);
odf_reader::GetProperty(content_.properties_, L"percentage_num_format", strPercentFormat);
odf_reader::GetProperty(content_.properties_, L"data-label-number", nTypeFormat);
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", bLinkData);
std::wstring formatCode = strNumFormat.get_value_or(L"");
if (nTypeFormat)
{
if (!data_labels_) data_labels_ = oox_data_labels();
if (*intVal == 1) data_labels_->set_showVal(true);
if (*intVal == 2) data_labels_->set_showPercent(true);
if (*nTypeFormat == 1) data_labels_->set_showVal(true);
if (*nTypeFormat == 2)
{
data_labels_->set_showPercent(true);
if (strPercentFormat)
formatCode = *strPercentFormat;
}
}
if (false == formatCode.empty())
{
if (!data_labels_) data_labels_ = oox_data_labels();
data_labels_->set_formatCode(formatCode, bLinkData.get_value_or(true));
}
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
if (intVal && labelPosEnabled_)
@ -149,8 +167,14 @@ void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{
values_[ind].present = true;
if (ind == 0) values_[ind].strRef_.present = true;
else values_[ind].numRef_.present = true;
if (ind == 0)
{
values_[ind].strRef_.present = true;
}
else
{
values_[ind].numRef_.present = true;
}
for (size_t i = 0; i < values.size(); i++)
{
@ -227,37 +251,45 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:tx")
{
CP_XML_NODE(L"c:strRef")
if (false == label_.formula.empty())
{
if (!label_.formula.empty())
CP_XML_NODE(L"c:strRef")
{
CP_XML_NODE(L"c:f")
{
CP_XML_STREAM() << label_.formula;
}
}
if (false == label_.str_cache.empty())
{
CP_XML_NODE(L"c:strCache")
if (false == label_.str_cache.empty())
{
CP_XML_NODE(L"c:ptCount")
CP_XML_NODE(L"c:strCache")
{
CP_XML_ATTR(L"val", label_.str_cache.size());
}
for (size_t i = 0; i < label_.str_cache.size(); i++)
{
CP_XML_NODE(L"c:pt")
CP_XML_NODE(L"c:ptCount")
{
CP_XML_ATTR(L"idx", i);
CP_XML_NODE(L"c:v")
CP_XML_ATTR(L"val", label_.str_cache.size());
}
for (size_t i = 0; i < label_.str_cache.size(); i++)
{
CP_XML_NODE(L"c:pt")
{
CP_XML_STREAM() << label_.str_cache[i];
CP_XML_ATTR(L"idx", i);
CP_XML_NODE(L"c:v")
{
CP_XML_STREAM() << label_.str_cache[i];
}
}
}
}
}
}
}
else if (false == label_.str_cache.empty())
{
CP_XML_NODE(L"c:v")
{
CP_XML_STREAM() << label_.str_cache[0];
}
}
}
}
@ -265,7 +297,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
if (values_[i].present)
{
if (bLocalTable_)
if (bCacheOnly_)
{
if (values_[i].numRef_.present && values_[i].numRef_.num_cache_count == 0)
{
@ -279,16 +311,13 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
CP_XML_NODE(values_[i].type)
{
if (values_[i].numRef_.present && !bLocalTable_)
if (values_[i].numRef_.present && false == values_[i].numRef_.formula.empty())
{
CP_XML_NODE(L"c:numRef")
{
CP_XML_NODE(L"c:f")
{
if (values_[i].numRef_.formula.empty())
CP_XML_CONTENT(L"label");
else
CP_XML_CONTENT(values_[i].numRef_.formula);
CP_XML_CONTENT(values_[i].numRef_.formula);
}
if (values_[i].numRef_.num_cache_count > 0)
@ -364,16 +393,13 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
}
}
else if (values_[i].strRef_.present && !bLocalTable_)
else if (values_[i].strRef_.present && false == values_[i].strRef_.formula.empty())
{
CP_XML_NODE(L"c:strRef")
{
CP_XML_NODE(L"c:f")
{
if (values_[i].strRef_.formula.empty())
CP_XML_CONTENT(L"label");
else
CP_XML_CONTENT(values_[i].strRef_.formula);
CP_XML_CONTENT(values_[i].strRef_.formula);
}
CP_XML_NODE(L"c:strCache")
{
@ -466,7 +492,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
}
if (!content_.text_properties_.empty())
if (!content_.text_properties_)
{
if (!data_labels_) data_labels_ = oox_data_labels();
@ -500,7 +526,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
shape.oox_serialize(CP_XML_STREAM());
}
if (!content_.points_[i].text_properties_.empty())
if (!content_.points_[i].text_properties_)
{
if (!data_labels_) data_labels_ = oox_data_labels();

View File

@ -62,7 +62,9 @@ public:
int id_;
std::wstring name_;
int iSymbolMarkerType_;
bool bLocalTable_;
bool bCacheOnly_; // used embedded or only cache values
_CP_OPT(oox_data_labels) data_labels_;
void setName(const std::wstring &value);

View File

@ -36,11 +36,16 @@
#include "oox_chart_shape.h"
#include "oox_drawing.h"
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
namespace cpdoccore {
namespace oox {
void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
{
if (!bEnabled) return;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:spPr")
@ -52,15 +57,16 @@ void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
}
void oox_chart_shape::set(std::vector<odf_reader::_property> & prop,_oox_fill & fill)
void oox_chart_shape::set(std::vector<odf_reader::_property> & prop, _oox_fill & fill)
{
bEnabled = true;
content_ = prop;
fill_ = fill;
}
void oox_serialize_default_text(std::wostream & _Wostream, std::vector<odf_reader::_property>& properties)
void oox_serialize_default_text(std::wostream & _Wostream, odf_reader::text_format_properties_content_ptr properties)
{
if (properties.size() < 1)return;
if (!properties) return;
CP_XML_WRITER(_Wostream)
{
@ -72,27 +78,8 @@ void oox_serialize_default_text(std::wostream & _Wostream, std::vector<odf_reade
{
CP_XML_NODE(L"a:pPr")
{
CP_XML_NODE(L"a:defRPr")
{
_CP_OPT(double) dVal;
_CP_OPT(int) iVal;
_CP_OPT(std::wstring) sVal;
if (odf_reader::GetProperty(properties, L"font-size",dVal))
CP_XML_ATTR(L"sz", (int)(dVal.get()*100));
if ((odf_reader::GetProperty(properties, L"font-style",iVal)) && (*iVal >0))
CP_XML_ATTR(L"i", "true");
if ((odf_reader::GetProperty(properties, L"font-weight",iVal)) && (*iVal >0))
CP_XML_ATTR(L"b", "true");
if (odf_reader::GetProperty(properties, L"font-color",sVal))
CP_XML_NODE(L"a:solidFill")
{
CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val", sVal.get());}
}
}
odf_reader::fonts_container fonts;
properties->oox_serialize(CP_XML_STREAM(), true, fonts, true);
}
}

View File

@ -39,19 +39,27 @@
#include "oox_drawing_fills.h"
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
}
namespace oox {
void oox_serialize_default_text(std::wostream & _Wostream, std::vector<odf_reader::_property>& properties);
void oox_serialize_default_text(std::wostream & _Wostream, odf_reader::text_format_properties_content_ptr properties);
class oox_chart_shape : boost::noncopyable
{
public:
oox_chart_shape(){}
oox_chart_shape() : bEnabled ( false) {}
~oox_chart_shape(){}
void set(std::vector<odf_reader::_property> & prop,_oox_fill & fill);
void oox_serialize(std::wostream & _Wostream);
bool bEnabled;
private:
std::vector<odf_reader::_property> content_;
_oox_fill fill_;

View File

@ -49,18 +49,19 @@ oox_data_labels::oox_data_labels()//подписи на значениях
showPercent_ = false;
showSerName_ = false;
showVal_ = false;
linkData_ = true;
position_ = -1; //not set
}
void oox_data_labels::set_common_dLbl ( std::vector<odf_reader::_property> & text_properties)
void oox_data_labels::set_common_dLbl ( odf_reader::text_format_properties_content_ptr text_properties)
{
textPr_ = text_properties;
}
void oox_data_labels::add_dLbl(int ind, std::vector<odf_reader::_property> & text_properties)
void oox_data_labels::add_dLbl(int ind, odf_reader::text_format_properties_content_ptr text_properties)
{
dLbls_.insert(std::pair<int, std::vector<odf_reader::_property>>(ind, text_properties));
dLbls_.insert(std::make_pair(ind, text_properties));
}
void oox_data_labels::oox_serialize(std::wostream & _Wostream)
@ -69,9 +70,17 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:dLbls")
{
if (false == formatCode_.empty())
{
CP_XML_NODE(L"c:numFmt")
{
CP_XML_ATTR(L"formatCode", formatCode_);
CP_XML_ATTR(L"sourceLinked", linkData_);
}
}
oox_serialize_default_text(CP_XML_STREAM(), textPr_);
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
for (std::map<int, odf_reader::text_format_properties_content_ptr>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
{
CP_XML_NODE(L"c:dLbl")
{

View File

@ -41,6 +41,13 @@
#include <xml/attributes.h>
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
}
namespace oox {
class oox_data_labels
@ -58,14 +65,22 @@ public:
void set_showPercent (bool Val){showPercent_ = Val;}
void set_showSerName (bool Val){showSerName_ = Val;}
void set_showVal (bool Val){showVal_ = Val;}
void set_formatCode (std::wstring & formatCode, bool linkData)
{
formatCode_ = formatCode;
linkData_ = linkData;
}
void set_position (int Val){position_ = Val;}
void add_dLbl (int ind, std::vector<odf_reader::_property> & text_properties);
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
void add_dLbl (int ind, odf_reader::text_format_properties_content_ptr text_properties);
void set_common_dLbl ( odf_reader::text_format_properties_content_ptr text_properties);
private:
std::wstring formatCode_;
bool linkData_;
bool showBubbleSize_; // (Show Bubble Size) §21.2.2.178
bool showCatName_; // (Show Category Name) §21.2.2.179
bool showLeaderLines_; // (Show Leader Lines) §21.2.2.183
@ -76,8 +91,8 @@ private:
int position_;
std::vector<odf_reader::_property> textPr_;
std::map<int, std::vector<odf_reader::_property>> dLbls_;
odf_reader::text_format_properties_content_ptr textPr_;
std::map<int, odf_reader::text_format_properties_content_ptr> dLbls_;
//delete (Delete) §21.2.2.40

View File

@ -170,7 +170,8 @@ void oox_serialize_effects(std::wostream & strm, const std::vector<odf_reader::_
double offsetY = dShadowOffsetY.get_value_or(0);
double dist = sqrt(offsetX * offsetX + offsetY * offsetY);
double dir = (offsetX > 0 ? atan(offsetY / offsetX) : 0) * 180. / 3.1415926;
double dir = atan(offsetY / offsetX) * 180. / 3.1415926;
if (dir < 0) dir += 360;
CP_XML_ATTR(L"dist", (int)(dist));
CP_XML_ATTR(L"dir", (int)(dir * 60000));

View File

@ -125,7 +125,7 @@ namespace oox {
//////////////////////////////////////////////////////////////////////////////
struct _oox_fill
{
_oox_fill() : type(-1){}
int type = -1;
oox_gradient_fill_ptr gradient;
oox_hatch_fill_ptr hatch;
@ -133,11 +133,10 @@ namespace oox {
oox_solid_fill_ptr solid;
_CP_OPT(double) opacity;
int type;
void clear()
{
type=-1;
type = -1;
opacity = boost::none;
gradient.reset();

View File

@ -36,13 +36,6 @@
#include <CPScopedPtr.h>
#include "../odf/chart_objects.h"
namespace cpdoccore {
namespace odf_reader
{
//class style_table_cell_properties_attlist;
}
}
namespace cpdoccore {
namespace oox {
@ -58,8 +51,6 @@ public:
//size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default);
void oox_serialize(std::wostream & _Wostream);/* const;*/
};
}

View File

@ -96,7 +96,10 @@ void oox_plot_area::add_axis(int type, odf_reader::chart::axis & content)
axis_.push_back(ax);
}
void oox_plot_area::set_no_local_table (bool val)
{
no_used_local_tables_ = val;
}
void oox_plot_area::reset_cross_axis()//обязательно после всех добавлений
{
for (size_t i = 0; i < axis_.size(); i++)

View File

@ -45,7 +45,7 @@ namespace oox {
class oox_plot_area: boost::noncopyable
{
public:
oox_plot_area(){}
oox_plot_area() : no_used_local_tables_(false) {}
~oox_plot_area(){}
std::vector<oox_chart_ptr> charts_;
@ -65,22 +65,12 @@ public:
void add_chart (int type);
void add_axis (int type, odf_reader::chart::axis & content);
//void set_content_series (odf_reader::chart::series & content);
void set_no_local_table (bool val); //whithout embedded tables
//void set_content_series (odf_reader::chart::series & content);
private:
void reset_cross_axis();//обязательно после всех добавлений
//variable charts
//catAx (Category Axis Data) §21.2.2.25
//dateAx (Date Axis) §21.2.2.39
//serAx (Series Axis) §21.2.2.175
//valAx (Value Axis) §21.2.2.226
//extLst (Chart Extensibility) §21.2.2.64
//layout (Layout) §21.2.2.88
//spPr (Shape Properties) §21.2.2.197
//dTable (Data Table) §21.2.2.54
void reset_cross_axis(); //обязательно после всех добавлений
bool no_used_local_tables_;
};

View File

@ -34,63 +34,81 @@
#include <boost/functional.hpp>
#include <CPOptional.h>
#include <xml/simple_xml_writer.h>
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
namespace cpdoccore {
namespace oox {
void oox_title::oox_content_serialize(std::wostream & _Wostream, odf_reader::chart::title & content)
{
if (content_.content_.empty()) return;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"a:p")
{
CP_XML_NODE(L"a:pPr")
{
CP_XML_NODE(L"a:defRPr"){}
}
CP_XML_NODE(L"a:r")
{
//odf_reader::fonts_container & fonts = context.fontContainer();
odf_reader::fonts_container fonts;
if (content.text_properties_)
content.text_properties_->oox_serialize(CP_XML_STREAM(), true, fonts);
CP_XML_NODE(L"a:t")
{
CP_XML_CONTENT(content.content_);
}
}
}
}
}
void oox_title::oox_serialize(std::wostream & _Wostream)
{
if (content_.content_.length() < 1)
{
//возможен шаблон txPr
return;
}
if (!content_.bEnabled && !sub_.bEnabled) return;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:title")
{
CP_XML_NODE(L"c:tx")
if (false == content_.content_.empty() || false == sub_.content_.empty())
{
CP_XML_NODE(L"c:rich")
CP_XML_NODE(L"c:tx")
{
CP_XML_NODE(L"c:rich")
{
CP_XML_NODE(L"a:bodyPr"){}
CP_XML_NODE(L"a:lstStyle"){}
oox_content_serialize(CP_XML_STREAM(), content_);
oox_content_serialize(CP_XML_STREAM(), sub_);
}
}
}
else if (content_.text_properties_)
{
CP_XML_NODE(L"c:txPr")
{
CP_XML_NODE(L"a:bodyPr"){}
CP_XML_NODE(L"a:lstStyle"){}
CP_XML_NODE(L"a:p")
{
CP_XML_NODE(L"a:pPr")
{
CP_XML_NODE(L"a:defRPr"){}
}
CP_XML_NODE(L"a:r")
{
CP_XML_NODE(L"a:rPr")
CP_XML_NODE(L"a:defRPr")
{
_CP_OPT(double) dVal;
_CP_OPT(std::wstring) sVal;
_CP_OPT(int) iVal;
if (odf_reader::GetProperty(content_.text_properties_,L"font-size",dVal))
CP_XML_ATTR(L"sz", (int)(dVal.get()*100));
if ((odf_reader::GetProperty(content_.text_properties_,L"font-style",iVal)) && (*iVal >0))
CP_XML_ATTR(L"i", "true");
if ((odf_reader::GetProperty(content_.text_properties_,L"font-weight",iVal)) && (*iVal >0))
CP_XML_ATTR(L"b", "true");
if (odf_reader::GetProperty(content_.text_properties_,L"font-color",sVal))
CP_XML_NODE(L"a:solidFill")
{
CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val", sVal.get());}
}
}
CP_XML_NODE(L"a:t")
{
CP_XML_CONTENT(content_.content_);
//odf_reader::fonts_container & fonts = context.fontContainer();
odf_reader::fonts_container fonts;
content_.text_properties_->oox_serialize(CP_XML_STREAM(), true, fonts);
}
}
}
}
}
}
layout_.oox_serialize(CP_XML_STREAM());
@ -98,8 +116,13 @@ void oox_title::oox_serialize(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", 0);
}
oox_chart_shape shape;
shape.set(content_.graphic_properties_, content_.fill_);
shape.oox_serialize(CP_XML_STREAM());
}
}
}
}
}

View File

@ -55,9 +55,17 @@ public:
{
content_ = t;
}
void set_sub_content(odf_reader::chart::title & t)
{
sub_ = t;
}
private:
void oox_content_serialize(std::wostream & _Wostream, odf_reader::chart::title & content);
cpdoccore::oox::oox_layout layout_;
odf_reader::chart::title content_;
odf_reader::chart::title sub_;
//extLst (Chart Extensibility) §21.2.2.64
//layout (Layout) §21.2.2.88

View File

@ -32,7 +32,6 @@
#include <xml/simple_xml_writer.h>
#include "oox_types_chart.h"
#include "oox_chart_shape.h"
namespace cpdoccore {
namespace oox {
@ -59,8 +58,9 @@ void oox_chart::set_name(const std::wstring& val)
}
void oox_chart::set_content_series(odf_reader::chart::series & content)
{
series_.back()->content_=content;
series_.back()->content_= content;
}
void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
{
if (val.empty())return;
@ -467,7 +467,21 @@ void oox_stock_chart::set_properties(std::vector<odf_reader::_property> g)
oox_chart::set_properties(g);
odf_reader::GetProperty(g, L"japanese-candle-stick",bCandleStick);
odf_reader::GetProperty(g, L"japanese-candle-stick", bCandleStick);
}
void oox_stock_chart::set_stock_gain_marke(odf_reader::chart::simple & obj)
{
if (!obj.bEnabled) return;
}
void oox_stock_chart::set_stock_loss_marker(odf_reader::chart::simple & obj)
{
if (!obj.bEnabled) return;
}
void oox_stock_chart::set_stock_range_line(odf_reader::chart::simple & obj)
{
if (!obj.bEnabled) return;
range_line.set(obj.graphic_properties_, obj.fill_);
}
void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
{
@ -480,10 +494,13 @@ void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
{
oox_serialize_common(CP_XML_STREAM());
//CP_XML_NODE(L"c:hiLowLines")//hiLowLines (High Low Lines) §21.2.2.80
//{
// //shape.oox_serialize(CP_XML_STREAM());
//}
if (range_line.bEnabled)
{
CP_XML_NODE(L"c:hiLowLines")
{
range_line.oox_serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"c:upDownBars")
{
CP_XML_NODE(L"c:gapWidth")

View File

@ -31,11 +31,9 @@
*/
#pragma once
#include <iosfwd>
#include <boost/noncopyable.hpp>
#include <CPScopedPtr.h>
#include <CPSharedPtr.h>
#include "oox_chart_shape.h"
#include "xlsx_color.h"
#include "oox_chart_series.h"
@ -84,6 +82,9 @@ public:
void set_name (const std::wstring& val);
void set_content_series (odf_reader::chart::series & content);
virtual void set_stock_gain_marke(odf_reader::chart::simple & obj){}
virtual void set_stock_loss_marker(odf_reader::chart::simple & obj){}
virtual void set_stock_range_line(odf_reader::chart::simple & obj){}
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}
//void set_showCatName(bool Val){data_labels_.set_showCatName(Val);}
//void set_showLeaderLines(bool Val){data_labels_.set_showLeaderLines(Val);}
@ -349,6 +350,9 @@ class oox_stock_chart: public oox_chart
static _CP_PTR(oox_chart) create();
virtual void set_stock_gain_marke(odf_reader::chart::simple & obj);
virtual void set_stock_loss_marker(odf_reader::chart::simple & obj);
virtual void set_stock_range_line(odf_reader::chart::simple & obj);
_CP_OPT(bool) bCandleStick;
@ -357,6 +361,7 @@ class oox_stock_chart: public oox_chart
_oox_fill fill_;
oox_chart_shape range_line;
//dropLines (Drop Lines) §21.2.2.53
//hiLowLines (High Low Lines) §21.2.2.80
//ser (Line Chart Series) §21.2.2.171

View File

@ -208,7 +208,7 @@ void pptx_conversion_context::start_document()
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::Presentation));
instances.push_back(odfContext.styleContainer().style_by_name(L"Default",odf_types::style_family::Presentation,false));
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
odf_reader::text_format_properties_content_ptr textFormatProperties = calc_text_properties_content(instances);
odf_reader::paragraph_format_properties parFormatProperties = calc_paragraph_properties_content(instances);
process_masters_ = false;

View File

@ -42,9 +42,9 @@
#include <xml/utils.h>
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
#include "../odf/calcs_styles.h"
#include "../odf/style_text_properties.h"
namespace cpdoccore {
namespace oox {
@ -269,7 +269,11 @@ void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::
else if (para_style) get_styles_context().start_process_style(para_style);
else get_styles_context().start_process_style(baseStyle);
propertiesOut.apply_from(calc_text_properties_content(instances));
odf_reader::text_format_properties_content_ptr text_props = calc_text_properties_content(instances);
if (text_props)
{
propertiesOut.apply_from(*text_props.get());
}
}
void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_properties & propertiesOut, int Level)

View File

@ -88,7 +88,7 @@ bool is_default(const xlsx_alignment & rVal)
}
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
const odf_reader::text_format_properties_content * textProp,
const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{

View File

@ -39,9 +39,10 @@ namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
class paragraph_format_properties;
class style_table_cell_properties_attlist;
}
}
@ -71,7 +72,7 @@ struct xlsx_alignment
};
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
const odf_reader::text_format_properties_content * textProp,
const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);

View File

@ -107,22 +107,26 @@ void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring &
{
CP_XML_NODE( ns_title + (ns_title.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
{
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"col")
{
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"col")
CP_XML_NODE(L"xdr:col")
{
CP_XML_CONTENT(position.col);
}
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"colOff")
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"colOff")
CP_XML_NODE(L"xdr:colOff")
{
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
}
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"row")
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"row")
CP_XML_NODE(L"xdr:row")
{
CP_XML_CONTENT(position.row);
}
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"rowOff")
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"rowOff")
CP_XML_NODE(L"xdr:rowOff")
{
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
}

View File

@ -65,7 +65,7 @@ xlsx_dxfs::~xlsx_dxfs()
{
}
size_t xlsx_dxfs::dxfId( const odf_reader::text_format_properties_content * textProp,
size_t xlsx_dxfs::dxfId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::graphic_format_properties * graphProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{

View File

@ -35,11 +35,14 @@
#include <string>
#include <CPScopedPtr.h>
#include <boost/shared_ptr.hpp>
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
class graphic_format_properties;
class paragraph_format_properties;
class style_table_cell_properties_attlist;
@ -53,7 +56,7 @@ namespace oox {
xlsx_dxfs();
~xlsx_dxfs();
size_t dxfId( const odf_reader::text_format_properties_content * textProp,
size_t dxfId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::graphic_format_properties * graphProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);

View File

@ -32,6 +32,10 @@
#include "xlsx_fill.h"
#include "xlsx_fills.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_table_properties.h"
#include "../odf/style_paragraph_properties.h"
#include <xml/simple_xml_writer.h>
#include <boost/functional.hpp>
@ -87,7 +91,7 @@ size_t xlsx_fills::size() const
return impl_->fills_.size();
}
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content * textProp,
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp, bool default_set)
{
@ -95,7 +99,7 @@ size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content * t
return fillId(textProp, parProp, cellProp,default_set, is_default);
}
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content * textProp,
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
bool default_set, bool & is_default)

View File

@ -40,7 +40,9 @@
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
class paragraph_format_properties;
class style_table_cell_properties_attlist;
}
@ -57,11 +59,11 @@ namespace oox {
public:
size_t size() const;
size_t fillId( const odf_reader::text_format_properties_content * textProp,
size_t fillId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp, bool default_set);
size_t fillId( const odf_reader::text_format_properties_content * textProp,
size_t fillId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp, bool default_set,bool & is_default);

View File

@ -263,19 +263,19 @@ std::size_t hash_value(xlsx_font const & val)
//----------------------------------------------------------------------------------
XlsxFontCharset GetXlsxFontCharset(const odf_reader::text_format_properties_content * textProp)
XlsxFontCharset GetXlsxFontCharset(const odf_reader::text_format_properties_content_ptr textProp)
{
// TODO
return XCHARSET_EMPTY;
}
XlsxFontFamily GetXlsxFontFamily(const odf_reader::text_format_properties_content * textProp)
XlsxFontFamily GetXlsxFontFamily(const odf_reader::text_format_properties_content_ptr textProp)
{
// TODO
return XFAMILY_EMPTY;
}
xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content * textProp,
xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{

View File

@ -41,8 +41,10 @@
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
class paragraph_format_properties;
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
class paragraph_format_properties;
class style_table_cell_properties_attlist;
}
}
@ -104,7 +106,7 @@ namespace oox {
struct xlsx_font
{
xlsx_font () {};
xlsx_font ( const odf_reader::text_format_properties_content * textProp,
xlsx_font ( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);

View File

@ -48,7 +48,7 @@ public:
size_t size() const;
size_t fontId( const odf_reader::text_format_properties_content * textProp,
size_t fontId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);
@ -99,7 +99,7 @@ void xlsx_fonts::Impl::serialize(std::wostream & _Wostream) const
}
}
size_t xlsx_fonts::Impl::fontId(const odf_reader::text_format_properties_content * textProp,
size_t xlsx_fonts::Impl::fontId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{
@ -123,7 +123,7 @@ size_t xlsx_fonts::Impl::fontId(const odf_reader::text_format_properties_content
//}
/*
int xlsx_fonts::Impl::getIndex(const odf_reader::text_format_properties_content * textProp,
int xlsx_fonts::Impl::getIndex(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp) const
{
@ -160,7 +160,7 @@ void xlsx_fonts::serialize(std::wostream & _Wostream) const
return impl_->serialize(_Wostream);
}
size_t xlsx_fonts::fontId(const odf_reader::text_format_properties_content * textProp,
size_t xlsx_fonts::fontId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{

View File

@ -33,12 +33,15 @@
#include <iosfwd>
#include <CPScopedPtr.h>
#include <boost/shared_ptr.hpp>
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
class paragraph_format_properties;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
class paragraph_format_properties;
class style_table_cell_properties_attlist;
}
}
@ -57,7 +60,7 @@ namespace oox {
public:
size_t size() const;
size_t fontId( const odf_reader::text_format_properties_content * textProp,
size_t fontId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);
const xlsx_font & getFont(size_t id) const;

View File

@ -30,62 +30,160 @@
*
*/
#include <vector>
#include <map>
#include <xml/utils.h>
#include <xml/simple_xml_writer.h>
#include "xlsx_numFmts.h"
#include "../odf/datatypes/officevaluetype.h"
namespace cpdoccore {
namespace oox {
struct xlsx_num_fmts::Impl
class xlsx_num_fmts::Impl
{
std::vector<std::wstring> formats_;
private:
struct _desc
{
std::wstring code;
unsigned int id;
};
std::vector<_desc> arrFormats;
std::map<unsigned int, size_t> mapIdsFormat;
std::map<std::wstring, size_t> mapFormatsCode;
static size_t transform_id(size_t id)
{
return id + 164;
}
unsigned int last_custom_id = 164;
size_t num_format_id(const std::wstring & format_code);
unsigned int add(const std::wstring & format_code, unsigned int id);
public:
unsigned int add_or_find(const std::wstring & format_code, char type);
void serialize(std::wostream & _Wostream) const;
};
size_t xlsx_num_fmts::Impl::num_format_id(const std::wstring & format_code)
unsigned int xlsx_num_fmts::Impl::add(const std::wstring & format_code, unsigned int id)
{
for (size_t i = 0; i < formats_.size(); ++i)
{
if (formats_[i] == format_code)
return transform_id(i);
}
std::map<unsigned int, size_t>::iterator pFind = mapIdsFormat.find(id);
formats_.push_back(format_code);
return transform_id(formats_.size() - 1);
if (pFind == mapIdsFormat.end())
{
mapIdsFormat.insert(std::make_pair(id, arrFormats.size()));
mapFormatsCode.insert(std::make_pair(format_code, arrFormats.size()));
_desc desc = {format_code, id};
arrFormats.push_back(desc);
}
else
{
//занято id для format_code -> следующий если есть берем
id = add(format_code, ++id);
}
return id;
}
unsigned int xlsx_num_fmts::Impl::add_or_find(const std::wstring & format_code, char format_code_type)
{
if (format_code.empty()) return 0;
std::map<std::wstring, size_t>::iterator pFind = mapFormatsCode.find(format_code);
if (pFind != mapFormatsCode.end())
{
return arrFormats[pFind->second].id;
}
else
{
unsigned int id = 0;
if (format_code_type == odf_types::office_value_type::Currency)
{
if (std::wstring::npos != format_code.find(L"#,##0.00"))
{
if (std::wstring::npos != format_code.find(L"[Red]")) id = 8; // "€"#,##0.00;[Red]\-"€"#,##0.00
else id = 7; // "€"#,##0.00;\-"€"#,##0.00
}
else
id = last_custom_id++;
}
else if (format_code_type == odf_types::office_value_type::Date)
{
if (std::wstring::npos != format_code.find(L"mm-dd-yy")) id = 14;
else if (std::wstring::npos != format_code.find(L"d-mmm-yy")) id = 15;
else if (std::wstring::npos != format_code.find(L"d-mmm")) id = 16;
else if (std::wstring::npos != format_code.find(L"mmm-yy")) id = 17;
else if (std::wstring::npos != format_code.find(L"m/d/yy h:mm")) id = 22;
else
id = last_custom_id++;
}
else if (format_code_type == odf_types::office_value_type::Time)
{
if (std::wstring::npos != format_code.find(L"h:mm AM/PM")) id = 18;
else if (std::wstring::npos != format_code.find(L"h:mm:ss AM/PM")) id = 19;
else if (std::wstring::npos != format_code.find(L"h:mm")) id = 20;
else if (std::wstring::npos != format_code.find(L"h:mm:ss")) id = 21;
else if (std::wstring::npos != format_code.find(L"m/d/yy h:mm")) id = 22;
else
id = last_custom_id++;
}
else if (format_code_type == odf_types::office_value_type::Scientific)
{
if (std::wstring::npos != format_code.find(L"0.00E+00")) id = 11;
else
id = last_custom_id++;
}
else if (format_code_type == odf_types::office_value_type::Fraction)
{
if (std::wstring::npos != format_code.find(L"??/??")) id = 13;
else if (std::wstring::npos != format_code.find(L"?/?")) id = 12;
else
id = last_custom_id++;
}
else if (format_code_type == odf_types::office_value_type::Percentage)
{
if (std::wstring::npos != format_code.find(L"0.00%")) id = 10;
else if (std::wstring::npos != format_code.find(L"0%")) id = 9;
else
id = last_custom_id++;
}
else
{
id = last_custom_id++;
}
return add(format_code, id);
}
}
void xlsx_num_fmts::Impl::serialize(std::wostream & strm) const
{
CP_XML_WRITER(strm)
{
CP_XML_NODE (L"numFmts")
{
CP_XML_ATTR (L"formatCode", arrFormats.size());
for (size_t i = 0; i < arrFormats.size(); ++i)
{
CP_XML_NODE(L"numFmt")
{
CP_XML_ATTR (L"numFmtId", arrFormats[i].id);
CP_XML_ATTR (L"formatCode", arrFormats[i].code);
}
}
}
}
}
//-----------------------------------------------------------------------------------------------------------------
xlsx_num_fmts::xlsx_num_fmts() : impl_(new xlsx_num_fmts::Impl())
{
}
xlsx_num_fmts::~xlsx_num_fmts()
{}
size_t xlsx_num_fmts::num_format_id(const std::wstring & format_code)
{
return impl_->num_format_id(format_code);
}
void xlsx_num_fmts::serialize(std::wostream & _Wostream) const
unsigned int xlsx_num_fmts::add_or_find(const std::wstring & format_code, char format_code_type)
{
_Wostream << L"<numFmts count=\"" << impl_->formats_.size() << L"\">";
for (size_t i = 0; i < impl_->formats_.size(); ++i)
{
_Wostream << L"<numFmt formatCode=\"" << xml::utils::replace_text_to_xml(impl_->formats_[i]) <<
L"\" numFmtId=\"" << impl_->transform_id(i) << "\" />";
}
_Wostream << L"</numFmts>";
return impl_->add_or_find(format_code, format_code_type);
}
void xlsx_num_fmts::serialize(std::wostream & strm) const
{
impl_->serialize(strm);
}
}
}

View File

@ -46,12 +46,12 @@ namespace oox {
public:
xlsx_num_fmts();
~xlsx_num_fmts();
public:
size_t num_format_id(const std::wstring & format_code);
void serialize(std::wostream & _Wostream) const;
unsigned int add_or_find(const std::wstring & format_code, char format_code_type);
void serialize(std::wostream & strm) const;
private:
struct Impl;
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
};
}

View File

@ -55,7 +55,6 @@ public:
Impl(): in_convert_style_(false)
{}
public:
std::wstring current_style_name_;
std::wstringstream stream_;
@ -64,9 +63,14 @@ public:
current_style_name_ = L"";
stream_.str(std::wstring());
in_convert_style_ = false;
type_ = odf_types::office_value_type::Custom;
}
std::wstring last_format_;
std::wstring last_date_format_ = L"yyyy.mmmm.dd";
std::wstring last_time_format_ = L"hh:mm:ss";
odf_types::office_value_type type_ = odf_types::office_value_type::Custom;
bool in_convert_style_;
};
@ -81,7 +85,7 @@ num_format_context::~num_format_context()
void num_format_context::start_format(const std::wstring & style_name)
{
impl_->reset_current();
impl_->reset_current();
impl_->current_style_name_ = style_name;
impl_->in_convert_style_ = true;
}
@ -94,19 +98,38 @@ std::wostream & num_format_context::output()
void num_format_context::end_format()
{
impl_->last_format_ = impl_->stream_.str();
impl_->reset_current();
if (impl_->type_ == odf_types::office_value_type::Date)
impl_->last_date_format_ = impl_->last_format_;
if (impl_->type_ == odf_types::office_value_type::Time)
impl_->last_time_format_ = impl_->last_format_;
}
std::wstring num_format_context::get_last_format() const
{
return impl_->last_format_;
}
std::wstring num_format_context::get_last_date_format() const
{
return impl_->last_date_format_;
}
std::wstring num_format_context::get_last_time_format() const
{
return impl_->last_time_format_;
}
void num_format_context::start_complex_format()
{
impl2_->complex_number_format_.reset();
}
odf_types::office_value_type::type num_format_context::type() const
{
return impl_->type_.get_type();
}
void num_format_context::type(odf_types::office_value_type::type t)
{
impl_->type_ = t;
}
void num_format_context::add_format(std::wstring const & cond, std::wstring const & format)
{
impl2_->complex_number_format_.add_format(cond, format);

View File

@ -36,6 +36,8 @@
#include <boost/noncopyable.hpp>
#include <CPScopedPtr.h>
#include "../odf/datatypes/officevaluetype.h"
namespace cpdoccore {
namespace odf_reader
{
@ -55,6 +57,11 @@ public:
void end_format();
std::wstring get_last_format() const;
std::wstring get_last_date_format() const;
std::wstring get_last_time_format() const;
odf_types::office_value_type::type type() const;
void type(odf_types::office_value_type::type t);
void start_complex_format();
void add_format(std::wstring const & cond, std::wstring const & format);
@ -62,6 +69,8 @@ public:
//std::wstring default_data_style(int type);
odf_reader::odf_read_context & odf_context_;
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;

View File

@ -227,6 +227,8 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->header_footer_.str();
CP_XML_STREAM() << impl_->breaks_.str();
if (false == impl_->drawingId_.empty())
{
CP_XML_NODE(L"drawing")
@ -263,10 +265,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
}
}
CP_XML_STREAM() << impl_->picture_background_.str();
//или тут ??? headerFooter
CP_XML_STREAM() << impl_->breaks_.str();
}
}
}

View File

@ -1513,12 +1513,15 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value, bool sh
//XmlUtils::replace_all(value, L" ", L"");
//XmlUtils::replace_all(value, L"\x00A0", L"");
}
if (oox::IsNumber(value))
std::wstring strNumber = oox::GetNumberFromString(value);
if (false == strNumber.empty())
{
try
{
XmlUtils::replace_all(value, L",", L".");
dVal = boost::lexical_cast<double>(value);
XmlUtils::replace_all(strNumber, L" ", L"");
XmlUtils::replace_all(strNumber, L",", L".");
dVal = boost::lexical_cast<double>(strNumber);
}
catch(...)
{
@ -1529,7 +1532,7 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value, bool sh
node_name = L"n";
_INT64 iVal = *dVal;
if (abs(iVal - *dVal) > 0.00001)
if ( *dVal - iVal > 0.00001)
{
value = std::to_wstring(*dVal);
impl_->current_.fields.back().bNumber = true;

View File

@ -29,10 +29,6 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../odf/style_text_properties.h"
#include "../odf/style_paragraph_properties.h"
#include "xlsxconversioncontext.h"
#include "xlsx_fonts.h"
#include "xlsx_xf.h"
@ -43,6 +39,9 @@
#include "xlsx_cell_styles.h"
#include "xlsx_numFmts.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_paragraph_properties.h"
#include <boost/unordered_set.hpp>
#include <boost/functional.hpp>
@ -58,13 +57,13 @@ public:
size_t size() const;
size_t xfId( const odf_reader::text_format_properties_content * textProp,
size_t xfId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible);
const std::wstring &num_format, odf_types::office_value_type::type num_format_type, bool default_set, bool & is_visible);
size_t dxfId( const odf_reader::text_format_properties_content * textProp,
size_t dxfId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::graphic_format_properties * graphProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);
@ -110,19 +109,21 @@ size_t xlsx_style_manager::Impl::size() const
return cellXfs_.size();
}
size_t xlsx_style_manager::Impl::dxfId( const odf_reader::text_format_properties_content * textProp,
const odf_reader::graphic_format_properties * graphProp,
size_t xlsx_style_manager::Impl::dxfId( const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::graphic_format_properties * graphProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{
return dxfs_.dxfId(textProp, graphProp, cellProp);
}
size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content * textProp,
size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible )
const std::wstring &num_format, odf_types::office_value_type::type num_format_type,
bool default_set, bool & is_visible )
{
bool is_visible_set = is_visible;
const size_t fontId = fonts_.fontId(textProp, parProp, cellProp);
@ -147,7 +148,7 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
xfRecord.applyBorder = true;
xfRecord.borderId = borderId;
xfRecord.applyFill = true; // TODO
xfRecord.applyFill = true;
xfRecord.fillId = fillId;
xfRecord.applyFont = true;
@ -155,10 +156,10 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
xfRecord.applyProtection = false; // TODO
if (!num_format.empty())
if (false == num_format.empty())
{
xfRecord.applyNumberForm = true;
xfRecord.numFmtId = numFmts_.num_format_id(num_format);
xfRecord.numFmtId = numFmts_.add_or_find(num_format, num_format_type);
}
else
if (xlxsCellFormat &&
@ -248,25 +249,25 @@ size_t xlsx_style_manager::size() const
return impl_->size();
}
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content * textProp,
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set)
const std::wstring &num_format, char num_format_type, bool default_set)
{
bool is_visible;
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, default_set, is_visible);
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, (odf_types::office_value_type::type) num_format_type, default_set, is_visible);
}
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content * textProp,
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible)
const std::wstring &num_format, char num_format_type, bool default_set, bool & is_visible)
{
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, default_set,is_visible);
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, (odf_types::office_value_type::type)num_format_type, default_set,is_visible);
}
size_t xlsx_style_manager::dxfId(const odf_reader::text_format_properties_content * textProp,
size_t xlsx_style_manager::dxfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::graphic_format_properties * graphProp,
const odf_reader::style_table_cell_properties_attlist * cellProp)
{

View File

@ -38,10 +38,12 @@
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
class graphic_format_properties;
class paragraph_format_properties;
class style_table_cell_properties_attlist;
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
}
namespace oox {
@ -55,19 +57,19 @@ public:
xlsx_style_manager(xlsx_conversion_context *context);
size_t size() const;
size_t xfId(const odf_reader::text_format_properties_content * textProp,
size_t xfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set,bool & is_visible);
const std::wstring &num_format, char num_format_type, bool default_set, bool & is_visible);
size_t xfId(const odf_reader::text_format_properties_content * textProp,
size_t xfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set);
const std::wstring &num_format, char num_format_type, bool default_set);
size_t dxfId(const odf_reader::text_format_properties_content * textProp,
size_t dxfId(const odf_reader::text_format_properties_content_ptr textProp,
const odf_reader::graphic_format_properties * graphProp,
const odf_reader::style_table_cell_properties_attlist * cellProp);

View File

@ -137,7 +137,7 @@ void xlsx_table_context::end_database_range()
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
{
if (index < 0 || index > xlsx_data_ranges_.size()) return;
if (index < 0 || index > (int)xlsx_data_ranges_.size()) return;
size_t col = state()->current_column();
size_t row = state()->current_row();

View File

@ -41,15 +41,14 @@
#include <xml/utils.h>
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_paragraph_properties.h"
#include "../odf/calcs_styles.h"
#include "../odf/style_paragraph_properties.h"
#include "../odf/style_text_properties.h"
namespace cpdoccore {
namespace oox {
class xlsx_text_context::Impl: boost::noncopyable
{
public:
@ -65,7 +64,7 @@ public:
std::wstring end_span2();
void start_cell_content();
void set_cell_text_properties( odf_reader::text_format_properties_content * text_properties);
void set_cell_text_properties( odf_reader::text_format_properties_content_ptr text_properties);
int end_cell_content();
void start_comment_content();
@ -100,10 +99,11 @@ private:
bool only_text;
odf_reader::styles_container & styles_;
odf_reader::text_format_properties_content * text_properties_cell_;
odf_reader::styles_container * local_styles_ptr_;
std::wstring dump_paragraph();
odf_reader::text_format_properties_content_ptr text_properties_cell_;
std::wstring dump_paragraph();
std::wstring dump_run();
void write_rPr(std::wostream & strm);
@ -281,10 +281,14 @@ void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, std::wstri
if (paraStyle) instances.push_back(paraStyle);
if (textStyle) instances.push_back(textStyle);
propertiesOut.apply_from(calc_text_properties_content(instances));
odf_reader::text_format_properties_content_ptr text_props = calc_text_properties_content(instances);
if (text_props)
{
propertiesOut.apply_from(*text_props.get());
}
}
void xlsx_text_context::Impl::set_cell_text_properties(odf_reader::text_format_properties_content * text_properties)
void xlsx_text_context::Impl::set_cell_text_properties(odf_reader::text_format_properties_content_ptr text_properties)
{
text_properties_cell_ = text_properties;
}
@ -324,11 +328,24 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
{
CP_XML_NODE(L"rPr")
{
if (text_properties_.fo_font_family_)
if (text_properties_.fo_font_weight_)
{
CP_XML_NODE(L"rFont")
CP_XML_NODE(L"b")
{
CP_XML_ATTR(L"val", text_properties_.fo_font_family_.get());
if (text_properties_.fo_font_weight_->get_type() > 0)
CP_XML_ATTR(L"val", "true");
else
CP_XML_ATTR(L"val", "false");
}
}
if (text_properties_.fo_font_style_)
{
CP_XML_NODE(L"i")
{
if (text_properties_.fo_font_style_->get_type() > 0)
CP_XML_ATTR(L"val", "true");
else
CP_XML_ATTR(L"val", "false");
}
}
if (text_properties_.fo_font_size_)
@ -345,24 +362,11 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
CP_XML_ATTR(L"rgb", text_properties_.fo_color_->get_hex_value());
}
}
if (text_properties_.fo_font_style_)
if (text_properties_.fo_font_family_)
{
CP_XML_NODE(L"i")
CP_XML_NODE(L"rFont")
{
if (text_properties_.fo_font_style_->get_type() > 0)
CP_XML_ATTR(L"val", "true");
else
CP_XML_ATTR(L"val", "false");
}
}
if (text_properties_.fo_font_weight_)
{
CP_XML_NODE(L"b")
{
if (text_properties_.fo_font_weight_->get_type() > 0)
CP_XML_ATTR(L"val", "true");
else
CP_XML_ATTR(L"val", "false");
CP_XML_ATTR(L"val", text_properties_.fo_font_family_.get());
}
}
}
@ -582,7 +586,7 @@ void xlsx_text_context::set_local_styles_container(odf_reader::styles_container*
return impl_->set_local_styles_container(local_styles_);
}
void xlsx_text_context::set_cell_text_properties(odf_reader::text_format_properties_content *text_properties)
void xlsx_text_context::set_cell_text_properties(odf_reader::text_format_properties_content_ptr text_properties)
{
return impl_->set_cell_text_properties(text_properties);
}

View File

@ -46,6 +46,7 @@ namespace odf_reader
typedef boost::shared_ptr<styles_container> styles_container_ptr;
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
};
namespace oox {
@ -58,7 +59,7 @@ public:
~xlsx_text_context ();
void set_local_styles_container (odf_reader::styles_container *local_styles_);
void set_cell_text_properties (odf_reader::text_format_properties_content *text_properties);
void set_cell_text_properties (odf_reader::text_format_properties_content_ptr text_properties);
void start_paragraph(const std::wstring & styleName);
void end_paragraph();

View File

@ -51,7 +51,18 @@ bool IsNumber(const std::wstring &value)
return boost::regex_search(value/*.begin(), value.end(), results*/, rule);
}
std::wstring GetNumberFromString(const std::wstring &value)
{
boost::wregex rule(L"^\\s*\\-{0,1}[0-9]*[.,]{0,1}[0-9]*\\s*$");
boost::match_results<std::wstring::const_iterator> results;
if (boost::regex_match(value, results, rule))
{
return (results[0].str());
}
else
return L"";
}
std::wstring getColAddress(size_t col)
{
static const size_t r = (L'Z' - L'A' + 1);
@ -165,10 +176,11 @@ bool parseBoolVal(const std::wstring & str)
{
std::wstring s = str;
boost::algorithm::to_lower(s);
if (L"true" == str || L"1" == str)
return true;
else
if (L"false" == str || L"0" == str)
return false;
else
return true;
}
std::wstring cellType2Str(XlsxCellType::type type)

View File

@ -41,6 +41,7 @@ namespace cpdoccore {
namespace oox {
bool IsNumber(const std::wstring &value);
std::wstring GetNumberFromString(const std::wstring &value);
std::wstring getColAddress(size_t col);
std::wstring getRowAddress(size_t row);

View File

@ -122,7 +122,7 @@ void xlsx_conversion_context::start_document()
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell));
instances.push_back(odfContext.styleContainer().style_by_name(L"Default", odf_types::style_family::TableCell, false));
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
odf_reader::text_format_properties_content_ptr textFormatProperties = calc_text_properties_content(instances);
odf_reader::paragraph_format_properties parFormatProperties = calc_paragraph_properties_content(instances);
odf_reader::style_table_cell_properties_attlist cellFormatProperties = calc_table_cell_properties(instances);
@ -131,7 +131,7 @@ void xlsx_conversion_context::start_document()
cellFormat.set_cell_type(XlsxCellType::s);
cellFormat.set_num_format(oox::odf_string_to_build_in(0));
default_style_ = get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, L"", true);
default_style_ = get_style_manager().xfId(textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, L"", 0, true);
}
@ -665,12 +665,12 @@ int xlsx_conversion_context::get_current_cell_style_id()
return get_table_context().get_current_cell_style_id();
}
std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
std::pair<double, double> xlsx_conversion_context::getMaxDigitSize()
{
if (maxDigitSize_.first <= 0.1)
{
std::wstring font_name;
int font_size;
int font_size = 10;
std::vector<const odf_reader::style_instance *> instances;
@ -687,31 +687,32 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
if (inst) instances.push_back(inst);
}
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
odf_reader::text_format_properties_content_ptr textFormatProperties = calc_text_properties_content(instances);
if (textFormatProperties.fo_font_family_)
font_name = textFormatProperties.fo_font_family_.get();
else
if (textFormatProperties)
{
std::wstring style_font_name;
if (textFormatProperties.style_font_name_) style_font_name = textFormatProperties.style_font_name_.get();
else if (textFormatProperties.style_font_name_complex_) style_font_name = textFormatProperties.style_font_name_complex_.get();
else if (textFormatProperties.style_font_name_asian_) style_font_name = textFormatProperties.style_font_name_asian_.get();
odf_reader::fonts_container & fonts = odf_document_->odf_context().fontContainer();
odf_reader::font_instance * font = fonts.font_by_style_name(style_font_name);
if (font)
if (textFormatProperties->fo_font_family_)
font_name = textFormatProperties->fo_font_family_.get();
else
{
font_name = font->name();
std::wstring style_font_name;
if (textFormatProperties->style_font_name_) style_font_name = textFormatProperties->style_font_name_.get();
else if (textFormatProperties->style_font_name_complex_) style_font_name = textFormatProperties->style_font_name_complex_.get();
else if (textFormatProperties->style_font_name_asian_) style_font_name = textFormatProperties->style_font_name_asian_.get();
odf_reader::fonts_container & fonts = odf_document_->odf_context().fontContainer();
odf_reader::font_instance * font = fonts.font_by_style_name(style_font_name);
if (font)
{
font_name = font->name();
}
}
if ((textFormatProperties->fo_font_size_) && (textFormatProperties->fo_font_size_->get_type() == odf_types::font_size::Length))
font_size = (int)(0.5 + textFormatProperties->fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
}
if (font_name.empty()) font_name = L"Arial";
if ((textFormatProperties.fo_font_size_) && (textFormatProperties.fo_font_size_->get_type() == odf_types::font_size::Length))
font_size = (int)(0.5 + textFormatProperties.fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
else
font_size =10;
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_->applicationFonts());
}
return maxDigitSize_;

View File

@ -163,7 +163,7 @@ public:
return odf_document_;
}
std::pair<float,float> getMaxDigitSize();
std::pair<double, double> getMaxDigitSize();
void process_styles();
@ -207,7 +207,7 @@ private:
std::vector<std::wstring> table_parts_;
std::wstringstream defaultOutput_;
std::pair<float,float> maxDigitSize_;
std::pair<double, double> maxDigitSize_;
num_format_context num_format_context_;
size_t default_style_;
mediaitems_ptr mediaitems_;

View File

@ -276,11 +276,11 @@ void calcext_condition::xlsx_convert(oox::xlsx_conversion_context & Context)
instStyle = Context.root()->odf_context().styleContainer().style_by_display_name(style_name, style_family::TableCell, false);
if (instStyle)
{
text_format_properties_content textFormats = calc_text_properties_content (instStyle);
text_format_properties_content_ptr textFormats = calc_text_properties_content (instStyle);
graphic_format_properties graphicFormats = calc_graphic_properties_content (instStyle);
style_table_cell_properties_attlist cellFormats = calc_table_cell_properties (instStyle);
int dxfId = Context.get_style_manager().dxfId(&textFormats, &graphicFormats, &cellFormats);
int dxfId = Context.get_style_manager().dxfId(textFormats, &graphicFormats, &cellFormats);
Context.set_conditional_format_dxf(dxfId);
}
Context.end_conditional_format_rule();

View File

@ -39,18 +39,21 @@ namespace cpdoccore {
namespace odf_reader {
text_format_properties_content calc_text_properties_content(const std::vector<const style_text_properties*> & textProps)
text_format_properties_content_ptr calc_text_properties_content(const std::vector<const style_text_properties*> & textProps)
{
text_format_properties_content result;
for (size_t i = 0; i < textProps.size(); i++)
if (textProps.empty()) return text_format_properties_content_ptr();
text_format_properties_content_ptr result = boost::make_shared<text_format_properties_content>();
for (size_t i = 0; i < textProps.size(); i++)
{
if (textProps[i])
result.apply_from(textProps[i]->content());
result->apply_from(textProps[i]->content());
}
return result;
}
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance)
text_format_properties_content_ptr calc_text_properties_content(const style_instance * styleInstance)
{
std::vector<const style_text_properties*> textProps;
@ -67,12 +70,19 @@ text_format_properties_content calc_text_properties_content(const style_instance
return calc_text_properties_content(textProps);
}
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances)
text_format_properties_content_ptr calc_text_properties_content(const std::vector<const style_instance *> & styleInstances)
{
text_format_properties_content result;
if (styleInstances.empty()) return text_format_properties_content_ptr();
text_format_properties_content_ptr result = boost::make_shared<text_format_properties_content>();
for (size_t i = 0; i < styleInstances.size(); i++)
{
result.apply_from(calc_text_properties_content(styleInstances[i]));
text_format_properties_content_ptr props = calc_text_properties_content(styleInstances[i]);
if (props)
{
result->apply_from(*props.get());
}
}
return result;
}

View File

@ -51,8 +51,8 @@ namespace cpdoccore
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances);
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance);
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
text_format_properties_content_ptr calc_text_properties_content(const style_instance * styleInstance);
text_format_properties_content_ptr calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
paragraph_format_properties calc_paragraph_properties_content(const style_instance * styleInstance);
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances);

View File

@ -80,11 +80,11 @@ using namespace chart;
void object_odf_context::set_pivot_source(std::wstring const & val)
{
bPivotChart_ = true;
if (val.empty()) return;
pivot_source_ = val;
if (pivot_source_.empty() == false)
{
bPivotChart_ = true;
}
}
void object_odf_context::set_width(double valPt)
@ -184,6 +184,8 @@ void object_odf_context::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.start_chart(L"");
oox::oox_chart_context & chart = Context.current_chart();
chart.no_used_local_tables_ = true;
oox_convert(chart);
Context.end_chart();
@ -303,31 +305,33 @@ void object_odf_context::calc_cache_series(std::wstring adress, std::vector<std:
{
int col = pFind->second.col;
int row = pFind->second.row;
if (col == 0 || row == 0)
//if (col == 0 || row == 0)
{
for (size_t i = 0; i < cash_values.size(); i++)
{
if (col == 0)
{
if (cash_values[i].col == col)
//if (col == 0)
//{
if (cash_values[i].col == col && cash_values[i].row != 0)
{
if (cash_values[i].val == L"NaN")
cash_values[i].val.clear();
cash.push_back(cash_values[i].val);
}
}
if (row == 0)
{
if (cash_values[i].row == row)
{
cash.push_back(cash_values[i].val);
}
}
//}
//if (row == 0)
//{
// if (cash_values[i].row == row)
// {
// cash.push_back(cash_values[i].val);
// }
//}
}
}
else
{
cash.push_back(pFind->second.val);
}
//else
//{
// cash.push_back(pFind->second.val);
//}
}
}
else
@ -366,7 +370,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
{
chart_context.set_pivot_chart (pivot_source_);
chart_context.set_title (title_);
chart_context.set_title (title_, sub_title_);
chart_context.set_wall (wall_);
chart_context.set_floor (floor_);
chart_context.set_legend (legend_);
@ -397,6 +401,10 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
if (!current) continue;
current->set_stock_gain_marke(stock_gain_marker_);
current->set_stock_loss_marker(stock_loss_marker_);
current->set_stock_range_line(stock_range_line_);
if (1 == series_.size())
{
current->varyColors_ = false;
@ -427,19 +435,40 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
calc_cache_series (series_[i].cell_range_address_, cell_cash);
calc_cache_series (series_[i].label_cell_address_, label_cash);
if (chart_context.no_used_local_tables_ && false == table_name_.empty())
{//убрать ссылки на локальную таблицу кэшей
if (std::wstring::npos != series_[i].cell_range_address_.find(table_name_))
{
series_[i].cell_range_address_.clear();
}
if (std::wstring::npos != series_[i].label_cell_address_.find(table_name_))
{
series_[i].label_cell_address_.clear();
}
}
if (false == categories_.empty())
{//вычищать от локальных ссылок нельзя. может использоваться в последующих сериях
calc_cache_series (categories_[0], cat_cash);
}
std::wstring formatCode = L"General";
_CP_OPT(std::wstring) strVal;
_CP_OPT(bool) boolVal;
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
_CP_OPT(int) nTypeFormat;
_CP_OPT(bool) bLinkData;
odf_reader::GetProperty(series_[i].properties_, L"num_format", strVal);
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", boolVal);
odf_reader::GetProperty(series_[i].properties_, L"num_format", strNumFormat);
odf_reader::GetProperty(series_[i].properties_, L"percentage_num_format", strPercentFormat);
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", bLinkData);
odf_reader::GetProperty(series_[i].properties_, L"data-label-number", nTypeFormat);
if ((strVal) && (strVal->length() > 1))
if ((nTypeFormat) && (*nTypeFormat == 2) && strPercentFormat)
{
formatCode = *strVal;
formatCode = *strPercentFormat;
}
else if ((strNumFormat) && (strNumFormat->length() > 1))
{
formatCode = *strNumFormat;
}
if (false == series_[i].label_cell_address_.empty())
@ -453,11 +482,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
if (last_set_type == chart_bubble)
{ //bubble(x)
if (!bPivotChart_)
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(4, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(true));
current->set_values_series (4, domain_cash);
//y
if (!bPivotChart_)
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
current->set_values_series (3, cell_cash);
}
else
@ -465,14 +494,14 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
if (false == domain_cash.empty() || false == cash_values.empty())
{
if (!bPivotChart_)
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(2, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(true));
current->set_values_series (2, domain_cash);
}
//y
if (false == cell_cash.empty() || false == cash_values.empty())
{
if (!bPivotChart_)
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
current->set_values_series (3, cell_cash);
}
}
@ -480,14 +509,23 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
else
{ //common
if (!bPivotChart_)
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
current->set_values_series(1, cell_cash);
}
if (categories_.empty() == false)//названия
{
if (!bPivotChart_)
if (categories_.empty() == false)//названия
{
if (chart_context.no_used_local_tables_)
{
if ( bPivotChart_ || table_name_.empty() || std::wstring::npos == categories_[0].find(table_name_))
{
current->set_formula_series(0, categories_[0], L"General", true);
}
}
else
{
current->set_formula_series(0, categories_[0], L"General", true);
}
current->set_values_series(0, cat_cash);
}
current->set_name(series_[i].name_);
@ -500,15 +538,10 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
bool x_enabled = false;
bool y_enabled = false;
bool z_enabled = false;
bool is3D = false;
_CP_OPT(bool) boolVal;
odf_reader::GetProperty(plot_area_.properties_, L"three-dimensional", boolVal);
_CP_OPT(bool) bIs3D;
odf_reader::GetProperty(plot_area_.properties_, L"three-dimensional", bIs3D);
if ((boolVal) && (*boolVal))
{
is3D = true;
}
for (size_t i = 0; i < axises_.size(); i++)
{
@ -526,7 +559,10 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
if (class_ == chart_stock && a.type_ == 3 )
a.type_ = 4; //шкала дат.
if (is3D) a.type_ = 1; // шкала категорий
if (bIs3D.get_value_or(false))
{
a.type_ = 1; // шкала категорий
}
x_enabled = true;
}
@ -545,7 +581,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
}
else if (a.dimension_ == L"z")
{
is3D = true;
bIs3D = true;
continue;
a.type_ = 2;
z_enabled = true;
@ -554,7 +590,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
chart_context.add_axis(a.type_, a);
}
if (is3D)
if (bIs3D.get_value_or(false))
{
if (!z_enabled)
{
@ -599,8 +635,9 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
const style_chart_properties *properties = Content->get_style_chart_properties();
std::wstring data_style_name = styleInst->data_style_name();
if (!data_style_name.empty())
std::wstring percentage_data_style_name = styleInst->percentage_data_style_name();
if (false == data_style_name.empty())
{
office_element_ptr elm = number_styles_.find_by_style_name(data_style_name);
number_style_base *number_style = dynamic_cast<number_style_base*>(elm.get());
@ -617,7 +654,23 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
propertiesOut.push_back(p);
}
}
if (false == percentage_data_style_name.empty())
{
office_element_ptr elm = number_styles_.find_by_style_name(percentage_data_style_name);
number_style_base *number_style = dynamic_cast<number_style_base*>(elm.get());
if (number_style)
{
num_format_context_.start_complex_format();
number_style->oox_convert(num_format_context_);
num_format_context_.end_complex_format();
std::wstring num_format = num_format_context_.get_last_format();
_property p(L"percentage_num_format", num_format);
propertiesOut.push_back(p);
}
}
if (!properties)return;
for (size_t i = 0; i < properties->content_.size(); i++)
@ -626,13 +679,12 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
}
}
}
void process_build_object::ApplyTextProperties(std::wstring style, std::vector<_property> & propertiesOut)
void process_build_object::ApplyTextProperties(std::wstring style, text_format_properties_content_ptr &propertiesOut)
{
style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart, false/*Context.process_headers_footers_*/);
if(styleInst)
{
text_format_properties_content properties = calc_text_properties_content(styleInst);
properties.apply_to(propertiesOut);
propertiesOut = calc_text_properties_content(styleInst);
}
}
void process_build_object::ApplyGraphicProperties(std::wstring style, std::vector<_property> & propertiesOut, oox::_oox_fill & fill)
@ -642,7 +694,7 @@ void process_build_object::ApplyGraphicProperties(std::wstring style, std::vecto
{
graphic_format_properties properties = calc_graphic_properties_content(styleInst);
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_ , draw_styles_ , fill);
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_ , draw_styles_ , fill, false, false);
if (fill.bitmap)
{
@ -753,6 +805,7 @@ void process_build_object::visit(chart_title& val)
t.content_ = v.str();
}
ApplyTextProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.text_properties_);
ApplyGraphicProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.graphic_properties_, t.fill_);
///////////////////////////////////////////////////////////////////////////////////////
if (val.attlist_.common_draw_position_attlist_.svg_x_)
@ -779,6 +832,9 @@ void process_build_object::visit(chart_subtitle & val)
val.text_p_->text_to_stream(v, false);
t.content_ = v.str();
ApplyTextProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.text_properties_);
ApplyGraphicProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.graphic_properties_, t.fill_);
if (val.attlist_.common_draw_position_attlist_.svg_x_)
{
t.pos_x = val.attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
@ -845,7 +901,6 @@ void process_build_object::visit(chart_plot_area& val)
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.plot_area_.text_properties_);
}
void process_build_object::visit(chart_axis& val)
{
object_odf_context_.start_axis(val.attlist_.chart_dimension_.get_value_or(L""),
@ -937,13 +992,34 @@ void process_build_object::visit(chart_data_point & val)
}
void process_build_object::visit(chart_mean_value & val)
{
object_odf_context_.series_.back().mean_value_.bEnabled = true;
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.properties_);
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.graphic_properties_, object_odf_context_.series_.back().mean_value_.fill_);
}
void process_build_object::visit(chart_date_scale & val)
{
object_odf_context_.axises_.back().type_ = 4;
}
void process_build_object::visit(chart_error_indicator & val)
{
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_,object_odf_context_.series_.back().error_indicator_.fill_ );
}
object_odf_context_.series_.back().error_indicator_.bEnabled = true;
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_, object_odf_context_.series_.back().error_indicator_.fill_ );
}
void process_build_object::visit(chart_stock_range_line & val)
{
object_odf_context_.stock_range_line_.bEnabled = true;
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_range_line_.graphic_properties_, object_odf_context_.stock_range_line_.fill_ );
}
void process_build_object::visit(chart_stock_loss_marker & val)
{
object_odf_context_.stock_loss_marker_.bEnabled = true;
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_loss_marker_.graphic_properties_, object_odf_context_.stock_loss_marker_.fill_ );
}
void process_build_object::visit(chart_stock_gain_marker & val)
{
object_odf_context_.stock_gain_marker_.bEnabled = true;
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_gain_marker_.graphic_properties_, object_odf_context_.stock_gain_marker_.fill_ );
}
void process_build_object::visit(chart_regression_curve & val)
{
oox::_oox_fill fill;
@ -972,7 +1048,8 @@ void process_build_object::visit(chart_categories& val)
{
if (object_odf_context_.in_axis_)
{
object_odf_context_.axises_.back().type_ = 1;
if (object_odf_context_.axises_.back().type_ != 4)
object_odf_context_.axises_.back().type_ = 1;
object_odf_context_.axises_.back().bCategories_ = true;
}
@ -982,6 +1059,7 @@ void process_build_object::visit(chart_categories& val)
void process_build_object::visit(table_table& val)
{
object_odf_context_.table_table_ = &val;
object_odf_context_.table_name_ = val.attlist_.table_name_.get_value_or(L"");
ACCEPT_ALL_CONTENT(val.table_columns_and_groups_.content_);
ACCEPT_ALL_CONTENT(val.table_rows_and_groups_.content_);

View File

@ -45,8 +45,6 @@
#include "visitor.h"
#include "chart_objects.h"
#include "office_document.h"
#include "office_body.h"
#include "office_chart.h"
@ -56,8 +54,9 @@
#include "table.h"
#include "odfcontext.h"
namespace cpdoccore {
#include "chart_objects.h"
namespace cpdoccore {
namespace odf_reader {
namespace {
@ -187,7 +186,6 @@ public:
std::wstring domain_cell_range_adress2_;
chart::title title_;
office_element_ptr_array title_odf_context_;
chart::title sub_title_;
chart::legend legend_;
@ -198,6 +196,10 @@ public:
chart::simple footer_;
chart::simple stock_gain_marker_;
chart::simple stock_loss_marker_;
chart::simple stock_range_line_;
std::vector<_property> chart_properties_;
std::vector<_property> chart_graphic_properties_;
oox::_oox_fill chart_fill_;
@ -249,6 +251,7 @@ class process_build_object
public visitor<chart_axis>,
public visitor<chart_categories>,
public visitor<chart_date_scale>,
public visitor<chart_grid>,
public visitor<chart_series>,
@ -258,6 +261,9 @@ class process_build_object
public visitor<chart_regression_curve>,
public visitor<chart_equation>,
public visitor<chart_error_indicator>,
public visitor<chart_stock_range_line>,
public visitor<chart_stock_loss_marker>,
public visitor<chart_stock_gain_marker>,
public visitor<chart_wall>,
public visitor<chart_floor>,
@ -284,9 +290,10 @@ public:
private:
void ApplyChartProperties(std::wstring style, std::vector<_property> & propertiesOut);
void ApplyTextProperties(std::wstring style, std::vector<_property> & propertiesOut);
void ApplyGraphicProperties(std::wstring style, std::vector<_property> & propertiesOut, oox::_oox_fill & fill);
void ApplyTextProperties(std::wstring style, text_format_properties_content_ptr & propertiesOut);
bool visit_table(std::wstring const & name);
void visit_column(unsigned int repeated);
bool visit_rows(unsigned int repeated);
@ -309,7 +316,7 @@ public:
virtual void visit(chart_subtitle & val);
virtual void visit(chart_footer & val);
virtual void visit(chart_legend & val);
virtual void visit(chart_plot_area& val);
virtual void visit(chart_plot_area & val);
virtual void visit(chart_axis & val);
virtual void visit(chart_series & val);
virtual void visit(chart_domain & val);
@ -317,11 +324,16 @@ public:
virtual void visit(chart_mean_value & val);
virtual void visit(chart_error_indicator & val);
virtual void visit(chart_regression_curve & val);
virtual void visit(chart_stock_range_line & val);
virtual void visit(chart_stock_loss_marker & val);
virtual void visit(chart_stock_gain_marker & val);
virtual void visit(chart_equation & val);
virtual void visit(chart_categories & val);
virtual void visit(chart_grid & val);
virtual void visit(chart_wall & val);
virtual void visit(chart_floor & val);
virtual void visit(chart_date_scale & val);
virtual void visit(table_table & val);
virtual void visit(table_table_rows & val);

View File

@ -31,18 +31,18 @@
*/
#pragma once
#include <xml/attributes.h>
#include "../docx/oox_drawing_fills.h"
//описание всяких графических объектов ( вложенная мелочевка) которые используются в xlsx & odf_reader -
#include <xml/attributes.h>
namespace cpdoccore {
namespace odf_reader {
class text_format_properties_content;
class text_format_properties_content;
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
namespace chart {
enum oox_typeconvert {docx,xlsx,pptx};
enum oox_typeconvert {docx, xlsx, pptx};
enum class_type
{
@ -61,37 +61,29 @@ namespace chart {
chart_filled_radar
};
struct title
{
title() : bEnabled(false), pos_x(0), pos_y(0) {}
bool bEnabled;
std::wstring content_;
std::vector<_property> text_properties_;
double pos_x;
double pos_y;
} ;
struct simple
{
simple() : bEnabled(false) {}
bool bEnabled;
bool bEnabled = false;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_;
oox::_oox_fill fill_;
text_format_properties_content_ptr text_properties_;
std::vector<_property> graphic_properties_;
oox::_oox_fill fill_;
};
struct title : public simple
{
std::wstring content_;
double pos_x = 0;
double pos_y = 0;
};
struct treadline
{
bool bEquation;
bool bREquation;
bool bEquation = false;
bool bREquation = false;
std::vector<_property> line_properties_;
simple equation_properties_;
treadline(){bEquation = false; bREquation = false;}
};
struct legend : public simple
{
@ -107,17 +99,16 @@ namespace chart {
};
struct axis: public simple
{
axis() : bCategories_(false), type_(3) {}
struct grid
{
enum grid_type {major, minor};
grid_type type_;
grid_type type_ = major;
std::wstring style_name_;
std::vector<_property> graphic_properties_;
};
bool bCategories_;
bool bCategories_ = false;
title title_;
@ -125,7 +116,7 @@ namespace chart {
std::wstring chart_name_;
std::wstring style_name_;
std::vector<grid> grids_;
int type_;
int type_ = 3;
};
struct series : public simple
{

View File

@ -78,7 +78,6 @@ anchor_type anchor_type::parse(const std::wstring & Str)
return anchor_type( AsChar );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return anchor_type( Page );
}
}

View File

@ -64,7 +64,6 @@ border_model border_model::parse(const std::wstring & Str)
return border_model( Separating );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return border_model( Collapsing );
}
}

View File

@ -69,7 +69,6 @@ chart_error_category chart_error_category::parse(const std::wstring & Str)
return chart_error_category( constant );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_error_category( none );
}
}

View File

@ -59,7 +59,6 @@ chart_interpolation chart_interpolation::parse(const std::wstring & Str)
return chart_interpolation( bSpline );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_interpolation( none );
}
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_CHARTINTERPOLATION_H_
#define _CPDOCCORE_ODF_CHARTINTERPOLATION_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -76,5 +72,3 @@ private:
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_interpolation);
}
#endif

View File

@ -60,7 +60,6 @@ chart_label_arrangement chart_label_arrangement::parse(const std::wstring & Str)
return chart_label_arrangement( stagger_odd );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_label_arrangement( side_by_side );
}
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_CHARTLABELARRANGEMENT_H_
#define _CPDOCCORE_ODF_CHARTLABELARRANGEMENT_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -76,5 +72,3 @@ private:
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_label_arrangement);
}
#endif

View File

@ -66,7 +66,6 @@ chart_regression_type chart_regression_type::parse(const std::wstring & Str)
return chart_regression_type( power );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_regression_type( none );
}
}

View File

@ -29,18 +29,13 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_CHARTREGRESSION_TYPE_H_
#define _CPDOCCORE_ODF_CHARTREGRESSION_TYPE_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class chart_regression_type
@ -74,5 +69,3 @@ private:
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_regression_type);
}
#endif

View File

@ -58,7 +58,6 @@ chart_series_source chart_series_source::parse(const std::wstring & Str)
return chart_series_source( rows );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_series_source( columns );
}
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_CHARTSERIESSOURCE_H_
#define _CPDOCCORE_ODF_CHARTSERIESSOURCE_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -75,5 +71,3 @@ private:
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_series_source);
}
#endif

View File

@ -84,7 +84,6 @@ chart_symbol_type chart_symbol_type::parse(const std::wstring & Str)
return chart_symbol_type( namedSymbol );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_symbol_type( noneSymbol );
}
}
@ -126,7 +125,6 @@ chart_symbol_name chart_symbol_name::parse(const std::wstring & Str)
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_symbol_name( squareSymbol );
}
}

View File

@ -29,12 +29,9 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_CHARTSYMBOL_H_
#define _CPDOCCORE_ODF_CHARTSYMBOL_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -122,7 +119,5 @@ private:
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_symbol_type);
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_symbol_name);
}
#endif

View File

@ -0,0 +1,65 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "charttimeunit.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const chart_time_unit & _Val)
{
switch(_Val.get_type())
{
case chart_time_unit::days: _Wostream << L"days"; break;
case chart_time_unit::months: _Wostream << L"months"; break;
case chart_time_unit::years: _Wostream << L"years"; break;
}
return _Wostream;
}
chart_time_unit chart_time_unit::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"days")
return chart_time_unit( days );
else if (tmp == L"months")
return chart_time_unit( months );
else if (tmp == L"years")
return chart_time_unit( years );
else
{
return chart_time_unit( months );
}
}
} }

View File

@ -0,0 +1,74 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class chart_time_unit
{
public:
enum type
{
days,
months,
years
};
chart_time_unit() {}
chart_time_unit(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static chart_time_unit parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const chart_time_unit & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::chart_time_unit);
}

View File

@ -63,7 +63,6 @@ direction direction::parse(const std::wstring & Str)
return direction( Ttb );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return direction( Ltr );
}
}

View File

@ -81,7 +81,6 @@ draw_fill draw_fill::parse(const std::wstring & Str)
return draw_fill( hatch );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return draw_fill( solid );
}
}

View File

@ -75,7 +75,6 @@ drop_cap_length drop_cap_length::parse(const std::wstring & Str)
{
}
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return drop_cap_length( 1 );
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_DROPCAPLENGTH_H_
#define _CPDOCCORE_ODF_DROPCAPLENGTH_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -85,5 +81,3 @@ std::wostream & operator << (std::wostream & _Wostream, const drop_cap_length &
APPLY_PARSE_XML_ATTRIBUTES(odf_types::drop_cap_length);
}
#endif

View File

@ -81,7 +81,6 @@ fill_image_ref_point fill_image_ref_point::parse(const std::wstring & Str)
return fill_image_ref_point( bottom_right );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return fill_image_ref_point( center );
}
}

View File

@ -68,7 +68,6 @@ fo_break fo_break::parse(const std::wstring & Str)
return fo_break( Page );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return fo_break( Auto );
}
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_FOBREAK_H_
#define _CPDOCCORE_ODF_FOBREAK_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -78,4 +74,3 @@ APPLY_PARSE_XML_ATTRIBUTES(odf_types::fo_break);
}
#endif

View File

@ -83,7 +83,6 @@ font_family_generic font_family_generic::parse(const std::wstring & Str)
return font_family_generic( System );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return font_family_generic( Roman );
}
}

View File

@ -29,18 +29,12 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_FONTFAMILYGENERIC_H_
#define _CPDOCCORE_ODF_FONTFAMILYGENERIC_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class font_family_generic
@ -81,4 +75,3 @@ APPLY_PARSE_XML_ATTRIBUTES(odf_types::font_family_generic);
}
#endif // #ifndef _CPDOCCORE_ODF_FONTFAMILYGENERIC_H_

View File

@ -63,7 +63,6 @@ font_pitch font_pitch::parse(const std::wstring & Str)
return font_pitch( Variable );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return font_pitch( Fixed );
}
}

View File

@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_FONTPITCH_H_
#define _CPDOCCORE_ODF_FONTPITCH_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
@ -76,5 +72,3 @@ std::wostream & operator << (std::wostream & _Wostream, const font_pitch & _Val)
APPLY_PARSE_XML_ATTRIBUTES(odf_types::font_pitch);
}
#endif // #ifndef _CPDOCCORE_ODF_FONTPITCH_H_

View File

@ -68,7 +68,6 @@ font_relief font_relief::parse(const std::wstring & Str)
return font_relief( Engraved );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return font_relief( None );
}
}

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