Compare commits

..

278 Commits

Author SHA1 Message Date
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
ec8a674be4 OdfFormatReader - fix bug #45530 2020-06-10 18:03:21 +03:00
f917165411 Fix bug 45556 2020-06-10 11:29:54 +03:00
f4b46d144d [x2t] Fix CPresetColorVal::FromStringIgnoreCase 2020-06-09 18:39:03 +03:00
add0ab9dd3 [ios] Fixed icu project 2020-06-08 18:34:10 +03:00
afedec1dd2 fix #45282 2020-06-03 08:36:33 +03:00
75386cab65 DocxFormat - fix bug #45504 2020-06-02 19:12:34 +03:00
7df59d9491 [ios] Fixed boost and icu paths 2020-05-29 14:55:22 +03:00
dcda192c0a Merge remote-tracking branch 'origin/hotfix/v5.5.4' into develop 2020-05-27 20:04:17 +03:00
961bde6723 RtfFormatReader - fix bug #45439, fix bug #45477 2020-05-27 20:02:12 +03:00
2261de2884 Fix build without UNICODE
(cherry picked from commit 4503678e2c)
2020-05-26 12:33:36 +03:00
7bc4ab9655 Use boost 1.72 2020-05-26 12:32:02 +03:00
5e6d2f12d5 x2t - bin reader - fix error 2020-05-25 19:35:52 +03:00
fb7d20c7e0 Merge pull request #257 from ONLYOFFICE/feature/fixFor554
Feature/fix for554
2020-05-25 16:22:34 +00:00
60ba4407b9 . 2020-05-25 19:02:32 +03:00
ba518d7c85 . 2020-05-25 18:26:26 +03:00
a045f57430 . 2020-05-25 18:24:18 +03:00
b10274c65d x2t - fix users files; fix bug #45439 2020-05-25 17:21:05 +03:00
567ecfb5e2 [ios][documents] fixed build 2020-05-24 23:34:19 +03:00
cd62b1d5c0 [ios][documents] fonts 2020-05-24 23:29:31 +03:00
7a32e5f163 [ios][documents] fonts 2020-05-22 23:04:14 +03:00
a79fa0a2c5 RtfReader - fix bug #45439 2020-05-22 14:56:37 +03:00
2c64e08e3c v5.5.3 2020-05-22 11:25:18 +03:00
c1e4a2ce33 v5.5.3 2020-05-22 11:21:42 +03:00
c277590e3b . 2020-05-21 10:39:29 +03:00
42c89ac604 .. 2020-05-21 06:26:12 +03:00
bfc691741a [x2t] Fix bug 45081 2020-05-20 19:13:03 +03:00
517e71a6fb [android][se] fix nCodePage for Encodings 2020-05-20 16:16:19 +03:00
ab68837a90 [ios][documents] fixed build for fonts 2020-05-20 12:38:53 +03:00
ba122b98f0 [ios][documents] fixed build for fonts 2020-05-20 12:38:29 +03:00
8900c58bd3 [ios][documents] universal fonts 2020-05-19 19:42:24 +03:00
6573ce860e [ios][documents] universal fonts 2020-05-19 18:30:31 +03:00
681935eb68 . 2020-05-18 16:37:05 +03:00
afd58646be Update gitignore 2020-05-15 09:44:07 +03:00
4503678e2c Fix build without UNICODE 2020-05-14 16:44:06 +03:00
1bc81c9be9 OdfFormtReader - fix quick displayed mode for styles 2020-05-14 10:26:50 +03:00
1cffeea6ab [test] Update test apps 2020-05-13 19:00:19 +03:00
d4b91d828a Add decryption support 2020-05-12 11:11:35 +03:00
5e36f80c93 Server app for encrypt files 2020-05-12 10:11:26 +03:00
49a1a2d6a1 Fix linux/macos build 2020-05-12 09:25:04 +03:00
6389bd4d3d Server app for encrypt files 2020-05-11 16:43:09 +03:00
92c2aa3d06 Developing... 2020-05-08 16:45:25 +03:00
a25ecc22fb Merge pull request #254 from ONLYOFFICE/feature/crypto
Feature/crypto
2020-05-07 18:35:52 +03:00
8417eedf84 Refactoring 2020-05-07 12:51:05 +03:00
89e88c03c4 XlsxFormat - x15 connection 2020-05-06 18:01:16 +03:00
785f5ae1db . 2020-05-06 17:31:03 +03:00
aaf3fb5652 OpenSSL add aes methods for desktop 2020-05-06 11:13:49 +03:00
6bdcfe53de Add openssl to windows version ooxmlsignature 2020-05-06 10:41:15 +03:00
ee091e7ca9 [x2t] Fix writing corrupted docx
any docx file with chart in group shape
2020-05-06 10:30:07 +03:00
4eb58cd967 Developing... 2020-05-05 22:08:48 +03:00
d0df8d17a1 Test example for openssl 2020-05-05 21:35:13 +03:00
8751075b26 Fix boost.pri 2020-05-01 18:49:44 +03:00
d1b70c416a Fix android armv7 build 2020-04-30 11:05:12 +03:00
f9c71dff07 [x2t] For opening XLSX_FLAT via xml 2020-04-29 16:50:55 +03:00
8b49cc5463 DocFormat - fix bug #45301 2020-04-29 14:12:13 +03:00
fbd4ad1565 . 2020-04-29 13:08:41 +03:00
45b3b568b6 . 2020-04-29 12:40:39 +03:00
a654eb9396 . 2020-04-28 18:46:38 +03:00
7ab24309ee Fix windows build 2020-04-28 16:44:33 +03:00
10b087b946 fix build ios 2020-04-28 14:55:07 +03:00
baa9a19b70 x2t - fix bug #45282 2020-04-28 14:34:16 +03:00
5a416e201a . 2020-04-28 14:19:34 +03:00
3d814e7b40 Merge pull request #253 from ONLYOFFICE/hotfix/v5.5.2 2020-04-27 18:37:39 +03:00
5eb1fac52c Merge branch 'develop' of github.com:ONLYOFFICE/core into develop 2020-04-27 16:47:58 +03:00
987396b426 [x2t] Fix build 2020-04-27 13:50:00 +03:00
9caaab8942 Fix build bugs (android) 2020-04-27 12:25:56 +03:00
52e558103b Fix boost build for ios 2020-04-27 12:06:54 +03:00
7c723b6c2a . 2020-04-27 11:51:23 +03:00
0e782ab80f Merge pull request #252 from ONLYOFFICE/feature/slicer
Feature/slicer
2020-04-26 11:25:14 +03:00
2e2218d495 [x2t] Add x14:dxfs; other fixes for slicer 2020-04-26 11:22:29 +03:00
5f44b7fea0 Developing 2020-04-24 14:56:49 +03:00
824c59cbd8 [x2t] Add reading/writing of all slicer xml 2020-04-24 12:13:53 +03:00
06b4a03ebc . 2020-04-24 12:09:53 +03:00
1cb65a3f4f . 2020-04-24 11:38:31 +03:00
7259801cd5 [x2t] Add SlicerCache 2020-04-24 10:59:24 +03:00
1256f87df0 [x2t] Fix CWorksheet::fromXML 2020-04-24 09:55:16 +03:00
4512d9e22c [ios][pe] coauth themes thumbnails 2020-04-22 22:50:03 +03:00
49d51257ba Refactoring copying files on windows 2020-04-22 13:22:16 +03:00
7d5f2a4d41 Fix ios build 2020-04-20 09:56:51 +03:00
46df190a44 Fix previous commit 2020-04-19 16:53:27 +03:00
13d7538d4e Merge remote-tracking branch 'origin/feature/develop-and' into develop
Add support android build
2020-04-19 15:37:56 +03:00
f912aa1fb5 Merge remote-tracking branch 'origin/hotfix/v5.5.2' into develop 2020-04-18 08:12:19 +03:00
bb65549dc1 RtfFormat - fix bug #45195 (#250) 2020-04-17 15:56:01 +03:00
a99eaf1ec4 . 2020-04-16 22:57:11 +03:00
a25e9e98c8 . 2020-04-16 19:42:18 +03:00
6015132652 Merge remote-tracking branch 'origin/hotfix/v5.5.2' into develop 2020-04-16 18:11:40 +03:00
ac0c16e475 Merge remote-tracking branch 'origin/hotfix/v5.5.2' into develop
#	without XlsxSerializerCom/Reader/CSVReader.cpp
2020-04-16 18:06:23 +03:00
5294089fd0 [builder] Stop work with local resources in web mode (#249) 2020-04-16 17:37:14 +03:00
3ec24e5e39 RtfFormat - fix bug #45166 2020-04-16 16:32:25 +03:00
dc44dc5e84 RtfFormat - fix bug #45150 2020-04-16 16:32:25 +03:00
cf76de8811 . 2020-04-16 16:32:25 +03:00
86421d8235 DocxFormat - fix bug #44709 2020-04-16 16:32:25 +03:00
5e77e96e5f [x2t] Fix bug 45171 (#248) 2020-04-16 15:52:16 +03:00
2f4296001a [ios] retrieve query url parametr 2020-04-15 22:30:41 +03:00
1ba171c2fe Merge branch 'develop' of github.com:ONLYOFFICE/core into develop 2020-04-15 18:49:00 +03:00
75e64e8c1d Merge pull request #247 from ONLYOFFICE/hotfix/v5.5.1
v5.5.1r2
2020-04-15 14:31:53 +03:00
916c61483d v5.5.1r2 2020-04-15 14:18:32 +03:00
0bf013e118 [x2t] For bug 45150.
Write gridAfter and wAfter independently
2020-04-15 14:15:28 +03:00
973b89609d v5.5.1r2 2020-04-15 13:04:24 +03:00
93d96145b9 . 2020-04-14 11:51:02 +03:00
cb48a131ce DocxFormat - fix bug #44709 2020-04-13 11:21:00 +03:00
a0c0171d12 Set small fontscache size by allfontsgen working... (#244) 2020-04-11 12:12:50 +03:00
736476f9cc OdfFormat - fix bug #45088 2020-04-09 19:31:36 +03:00
d5c5c4b8cf v5.5.1 2020-04-09 12:40:22 +03:00
8e0e8e96af . 2020-04-09 10:37:03 +03:00
23b4fb4722 . 2020-04-08 11:37:05 +03:00
93f6d44759 . 2020-04-07 21:52:10 +03:00
23546dc602 . 2020-04-07 16:13:37 +03:00
89976b31dd . 2020-04-07 15:19:40 +03:00
60904a6df0 Fix windows xp support for non-console apps (#240) 2020-04-06 12:08:03 +03:00
07295de852 . 2020-04-06 11:29:15 +03:00
72315d1229 Add sort to application fonts list (#239) 2020-04-06 10:51:12 +03:00
fef5735437 . 2020-04-04 16:15:32 +03:00
61f4ef0f3c . 2020-04-04 11:23:37 +03:00
e3c66e7f54 . 2020-04-04 08:54:50 +03:00
91918313b4 Merge remote-tracking branch 'origin/hotfix/v5.5.1' into develop 2020-04-02 13:19:23 +03:00
abb5fd1ec1 x2t - fix bug #44957 (#238) 2020-04-02 13:16:09 +03:00
fd6beb0044 return error from abnormal zip (#237) 2020-04-02 11:46:00 +03:00
3e8816786a . 2020-04-01 18:57:07 +03:00
1b6eff5cb7 Fix writing sdk version when linking binary files (macos) (#236) 2020-04-01 10:38:33 +03:00
f018582446 Merge remote-tracking branch 'origin/hotfix/v5.5.1' into develop 2020-04-01 09:19:34 +03:00
4fc6511b37 . (#235) 2020-03-31 19:00:41 +03:00
52ff8af2be Feature/year (#234)
* Correct year detect on windows

* Remove qmake message
2020-03-31 15:15:17 +03:00
d29475b6fb Update base.pri (#233) 2020-03-30 17:45:42 +03:00
32e7193212 [x2t] Fix bug 44934 (#232) 2020-03-28 19:39:47 +03:00
23fc146eca Fix wget/curl parameters injection 2020-03-24 13:38:10 +03:00
c4ac29a97d . 2020-03-23 19:11:32 +03:00
9c24d4a4bb . 2020-03-20 16:22:20 +03:00
bd579b8004 Merge remote-tracking branch 'origin/hotfix/v5.5.1' into develop 2020-03-20 16:14:53 +03:00
7fd9e52bc3 Merge pull request #230 from ONLYOFFICE/feature/fix_bug_v5.5.1
fix bug in zip
2020-03-19 18:22:53 +03:00
dd13f9f24c fix bug in zip 2020-03-19 18:21:00 +03:00
a2d9c972c1 . 2020-03-19 15:53:22 +03:00
0fe3c3ece5 Merge pull request #228 from ONLYOFFICE/feature/fix_bug_v5.5.1
XlsxFormat - fix bug #44840
2020-03-19 12:56:48 +03:00
963d2f9589 . 2020-03-18 19:34:23 +03:00
d5574186b1 . 2020-03-18 19:29:13 +03:00
5d148a6d0d Set htmlfileinternal path to doctrenderer.config 2020-03-18 18:28:56 +03:00
d7af2cb41d Remove path to HtmlFileInternal from x2t xml params 2020-03-18 18:09:52 +03:00
ed5bfb7b27 Add gitignore file 2020-03-18 16:33:25 +03:00
b81e988da5 XlsxFormat - fix bug #44840 2020-03-18 15:15:26 +03:00
a7c868d3d1 Remove unused files 2020-03-18 09:55:30 +03:00
d34d80788b . 2020-03-17 18:57:30 +03:00
a381305a9f . 2020-03-17 16:25:18 +03:00
bb022c49bd Fix xp build 2020-03-16 17:54:21 +03:00
31e8a1cbdd Fix previous commit 2020-03-16 17:27:31 +03:00
a19074993d Fix xp artifacts 2020-03-16 17:23:27 +03:00
2621ff9b5c . 2020-03-14 13:31:10 +03:00
0a1c718cc0 Refactoring 2020-03-13 17:49:15 +03:00
751e39960c . 2020-03-12 14:18:04 +03:00
bc0bb1a721 Add constant for display nonprinting characters in native 2020-03-11 16:20:57 +03:00
fb5da5e4ff Extend event types for native 2020-03-11 11:37:54 +03:00
addd684e4a Revert "fix build"
This reverts commit 293f3c6cef.
2020-03-11 11:28:27 +03:00
293f3c6cef fix build 2020-03-11 11:25:02 +03:00
61a157a3c4 Update gitignore 2020-03-11 09:23:06 +03:00
a7ba4c471e [x2t] For bug 44756
Fixed opening docx with special tblpPr values
2020-03-10 14:42:50 +03:00
d9d161655c DocFormat - fix bug #44776 2020-03-06 15:21:22 +03:00
8c18843b58 [android][se] fix find oEncodindId 2020-03-05 16:31:15 +03:00
04d796d760 [x2t] For bug 44689
Fix DurableId generation. Numbers greater than 0x7FFFFFFE cause MS Office errors(ST_LongHexNumber by spec)
2020-03-05 13:24:22 +03:00
12c427b11e Merge branch 'hotfix/v5.5.1' of github.com:ONLYOFFICE/core into hotfix/v5.5.1 2020-03-05 12:05:12 +03:00
9415983797 Merge feature/pre5.5.1 into hotfix/v5.5.1 2020-03-05 12:04:10 +03:00
e82ea1bc5c Merge pull request #227 from ONLYOFFICE/feature/pre5.5.1
Feature/pre5.5.1
2020-03-05 11:23:06 +03:00
b100cb3927 Xlsx 2003 XML Document 2020-03-04 20:08:40 +03:00
2b3a0cd5b3 v5.5.0 2020-03-04 18:33:54 +03:00
49f4bdb933 v5.5.0 2020-03-04 18:09:03 +03:00
911fe73f58 Update gitignore 2020-03-04 13:21:55 +03:00
a577378a1e Merge pull request #225 from ONLYOFFICE/feature/pre_hotfix5.5.1
Hide openssl symbols
2020-03-04 10:14:56 +03:00
997bf0b887 Hide openssl symbols 2020-03-03 19:10:03 +03:00
428a2652de . 2020-02-27 18:27:30 +03:00
0580375bf4 x2t - fix bug #44640 2020-02-27 18:24:09 +03:00
51c1b7d21a Fix common apps (#224) 2020-02-27 15:09:14 +03:00
c8fbd13a31 Merge remote-tracking branch 'origin/release/v5.5.0' into develop 2020-02-26 11:56:37 +03:00
4b0ce196e8 [x2t] Fxi bug 44611 (#223) 2020-02-25 22:53:48 +03:00
ddacd8f2b0 . 2020-02-25 20:12:00 +03:00
49597e16ab Add defines for comments 2020-02-25 14:39:29 +03:00
7a713f925f App for server work with crypto files 2020-02-21 18:37:58 +03:00
d64bfc230a . 2020-02-21 15:23:18 +03:00
938d593fc4 . 2020-02-21 11:55:14 +03:00
b96189c213 [android][xt2] Fix overwrite document 2020-02-21 11:45:11 +03:00
987e6b6e76 [android][xt2] Open password odf document 2020-02-21 11:45:11 +03:00
a39652e1eb . 2020-02-20 19:46:11 +03:00
f62781de18 OdfFormatReader - embedded audio 2020-02-20 16:37:36 +03:00
aefef93e21 icu for ios (#221)
Co-authored-by: Alexey.Musinov <alexey.musinov@gmail.com>
2020-02-19 19:05:23 +03:00
4d4142f3ae . 2020-02-19 16:52:17 +03:00
22f9c5188d . 2020-02-18 19:24:53 +03:00
1781318bad [android] Fix overwrite document 2020-02-18 17:43:21 +03:00
b936394a68 Add defines of events for track reviews on mobile native 2020-02-18 09:20:25 +03:00
38926d086c icu for ios 2020-02-17 19:37:40 +03:00
f49d3756ea icu for ios 2020-02-17 17:39:57 +03:00
dcb0621e5f . 2020-02-17 15:53:33 +03:00
5a5a444f42 . 2020-02-14 18:27:39 +03:00
9b608b2f76 . 2020-02-14 14:42:14 +03:00
2c04e9fb57 Fix windows flags (#220) 2020-02-13 19:41:15 +03:00
4142577664 . 2020-02-13 18:32:22 +03:00
30e92bab83 icu for ios 2020-02-13 16:54:29 +03:00
6957af8450 icu for ios 2020-02-13 16:28:48 +03:00
9ba350035f Extend types of comment events 2020-02-12 16:55:20 +03:00
f356755725 build icu for ios 2020-02-12 16:20:18 +03:00
d865ec0b59 Extend types of comment events 2020-02-11 17:58:57 +03:00
2cdbcf4017 Add defines for read of comments 2020-02-10 13:31:17 +03:00
319a66181a . 2020-02-10 12:52:17 +03:00
e6007815a2 [x2t] Fix bug 44466 (#219)
Move m_oFirstLine, m_oHanging from CTwipsMeasure(unsigned) to CSignedTwipsMeasure
2020-02-07 18:39:20 +03:00
e4090bb123 . 2020-02-06 16:32:04 +03:00
b9d6e370ca OdfFormatWriter - fix bug #44403 2020-02-03 17:44:11 +03:00
0b5e521f0d DocxReader - fix bug #44364 2020-01-31 15:27:15 +03:00
593e18225e . 2020-01-30 19:07:57 +03:00
c064daed08 . 2020-01-30 17:51:52 +03:00
838d506af6 Word 2003 XML Document 2020-01-28 18:46:28 +03:00
56482f0524 Feature/build ios (#218)
* Fix build on ios in debug mode

* Fix ios build
2020-01-28 14:19:20 +03:00
dbf78d4c9f . 2020-01-27 18:04:50 +03:00
e1ec5066f5 . 2020-01-27 18:04:36 +03:00
70cefc0467 OdfFormatWriter - fix bug #44226 2020-01-27 18:02:47 +03:00
3b4d6147b3 [android] add field message for error 2020-01-26 15:12:06 +03:00
8114811bce Merge pull request #217 from ONLYOFFICE/release/v5.5.0
Release/v5.5.0
2020-01-22 10:38:27 +03:00
006d79851a OdfFormatWriter - fix bug #44193 2020-01-20 18:47:34 +03:00
656b443af7 . 2020-01-20 18:46:19 +03:00
fa472b3d9f OdfFormatWriter - fix bug #44190 2020-01-20 16:54:57 +03:00
b901073171 Remove travis build (#216)
This speed up PR process (requested by @K0R0L)
This build is deprecated, since build of project is moved
to another tool - `build_tool` since v5.5.0
And this config is never worked
See:
https://github.com/ONLYOFFICE/core/pull/29#issuecomment-306773327
2020-01-20 14:39:07 +03:00
03404d74a4 Merge pull request #215 from ONLYOFFICE/feature/fixBoost
Feature/fix boost
2020-01-20 14:21:13 +03:00
2154cb1dba Update boost build script for ios 2020-01-20 13:58:57 +03:00
f3fb3f7ca7 Fix build 2020-01-20 12:07:31 +03:00
3d154f9915 . 2020-01-16 20:20:08 +03:00
20090072ae Add new method (#214) 2020-01-16 18:17:27 +03:00
7a0c3c9bfa Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2020-01-15 18:31:10 +03:00
0cfb79f2aa OdfFormat - ... 2020-01-15 18:30:27 +03:00
405e5a4aaa XlsFormat - fix after testing 2020-01-15 18:29:45 +03:00
45cfdde703 Fix ios build 2020-01-15 18:25:19 +03:00
5fe7642ad7 Merge pull request #213 from ONLYOFFICE/release/v5.5.0
Add functionality to base.pri (#212)
2020-01-15 17:51:38 +03:00
bd85ec1b10 Add functionality to base.pri (#212) 2020-01-15 16:55:09 +03:00
18d61f9f14 Merge pull request #211 from ONLYOFFICE/release/v5.5.0
Release/v5.5.0
2020-01-15 15:50:05 +03:00
cee502b855 Add CopyDirectory method (#210) 2020-01-15 15:45:18 +03:00
524eac388e [x2t] For bug 38945 (#209)
For comments without author
2020-01-14 16:12:55 +03:00
9197a889a2 Fix build on ios in debug mode 2020-01-13 14:11:16 +03:00
0daaf560ae [x2t] For bug 44039 (#208)
Abs negative comment coordinates and offset as Excel does
2020-01-09 17:01:20 +03:00
e7c87085a7 Fix metafile to raster sizes (#207) 2020-01-09 15:37:39 +03:00
1b445aa3bb . 2020-01-09 10:41:41 +03:00
9a5cb77ca0 developing... 2020-01-07 19:08:08 +03:00
0e17401c16 Merge remote-tracking branch 'origin/release/v5.5.0' into develop 2019-12-25 18:51:40 +03:00
00b16d548c . 2019-12-25 18:50:37 +03:00
b277385d4f . 2019-12-24 19:18:05 +03:00
93108c244a v5.4.2 2019-11-27 12:23:13 +03:00
8d6249f9a5 developing... 2019-10-30 20:16:59 +03:00
669 changed files with 35813 additions and 14770 deletions

3
.gitignore vendored
View File

@ -3,6 +3,7 @@ dictionaries/
LicenceManager/
Common/boost_1_58_0
Common/3dParty/boost/boost_1_58_0
Common/3dParty/boost/boost.data
Common/3dParty/boost/ios
Common/3dParty/boost/osx
Common/3dParty/icu/icu
@ -11,6 +12,8 @@ Common/3dParty/icu/win_32
Common/3dParty/icu/linux_64
Common/3dParty/icu/linux_32
Common/3dParty/icu/mac_64
Common/3dParty/icu/ios
Common/3dParty/icu/mac-build
Common/3dParty/cef/win_64
Common/3dParty/cef/win_32
Common/3dParty/cef/linux_64

View File

@ -1,14 +0,0 @@
language: cpp
compiler: gcc
dist: trusty
addons:
apt:
packages:
- p7zip-full
script:
- exit 0
# Build fails anyway. See explanation in
# https://github.com/ONLYOFFICE/core/pull/29#issuecomment-306773327
- cd Common/3dParty && ./make.sh
- cd ../../
- make

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 );
@ -1406,19 +1406,26 @@ 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);
}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 +1438,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

@ -96,9 +96,12 @@ namespace DocFileFormat
break;
}
}
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
//std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
//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)
{
switch (iter->OpCode)
{

View File

@ -225,8 +225,11 @@ namespace DocFileFormat
documentMapping->m_document->nWordVersion);
std::list<CharacterPropertyExceptions*>* chpxs = documentMapping->m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
tapx.Convert( &trpMapping );
if (chpxs)
{
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
tapx.Convert( &trpMapping );
}
documentMapping->_lastValidPapx = papxBackup;
documentMapping->_lastValidSepx = sepxBackup;

View File

@ -1116,7 +1116,14 @@ namespace DocFileFormat
m_context->_doc->Convert(&textboxMapping);
m_pXmlWriter->WriteString(textboxMapping.getOLEObject());
std::wstring sOleXml = textboxMapping.getOLEObject();
if (false == sOleXml.empty())
m_pXmlWriter->WriteString(sOleXml);
else
{
m_pXmlWriter->WriteString(txtBoxWrapper.GetXmlString());
}
}
//ShapeType
@ -1792,6 +1799,9 @@ namespace DocFileFormat
if (dAngle < -360.0)
dAngle += 360.0;
if (dAngle > 360.0)
dAngle -= 360.0;
if ((dAngle >= 45.0 && dAngle <= 135.0) || (dAngle >= 225.0 && dAngle <= 315.0) || (dAngle <= -45.0 && dAngle >= -135.0) || (dAngle <= -225.0 && dAngle >= -315.0))
twistDimensions = true;
}

View File

@ -29,10 +29,9 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef COMMENTS_WRITER
#define COMMENTS_WRITER
#pragma once
#include "../../XlsxSerializerCom/Common/Common.h"
#include "HeaderFooterWriter.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
namespace Writers
@ -49,8 +48,9 @@ namespace Writers
class CommentsWriter
{
std::wstring m_sDir;
std::wstring m_sFileName;
public:
std::wstring m_sComment;
std::wstring m_sComment;
std::wstring m_sCommentExt;
std::wstring m_sCommentsIds;
std::wstring m_sPeople;
@ -73,6 +73,10 @@ namespace Writers
m_sDocumentCommentsIds = sDocumentCommentsIds;
m_sDocumentPeople = sDocumentPeople;
}
std::wstring getFilename()
{
return OOX::FileTypes::Comments.DefaultFileName().GetPath();
}
void Write()
{
std::wstring sDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR;
@ -156,5 +160,4 @@ namespace Writers
}
};
}
#endif // #ifndef COMMENTS_WRITER
}

View File

@ -29,8 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef HEADER_FOOTER_WRITER
#define HEADER_FOOTER_WRITER
#pragma once
#include "../../XlsxSerializerCom/Common/Common.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
@ -60,8 +59,8 @@ namespace Writers
std::wstring rId;
SimpleTypes::EHdrFtr eType;
};
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
static std::wstring g_string_xml_start = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
static std::wstring g_string_xmlns = L"xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
@ -78,35 +77,19 @@ xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_hdr_End = _T("</w:hdr>");
mc:Ignorable=\"w14 w15 wp14\">";
static std::wstring g_string_hdr_Start = g_string_xml_start + L"<w:hdr " + g_string_xmlns;
static std::wstring g_string_hdr_End = L"</w:hdr>";
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_ftr_End = _T("</w:ftr>");
static std::wstring g_string_ftr_Start = g_string_xml_start + L"<w:ftr " + g_string_xmlns;
static std::wstring g_string_ftr_End = L"</w:ftr>";
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
static std::wstring g_string_footnotes_Start = g_string_xml_start + L"<w:footnotes " + g_string_xmlns;
static std::wstring g_string_footnotes_End = L"</w:footnotes>";
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
static std::wstring g_string_endnotes_Start = g_string_xml_start + L"<w:endnotes " + g_string_xmlns;
static std::wstring g_string_endnotes_End = L"</w:endnotes>";
class HeaderFooterWriter
{
@ -133,17 +116,17 @@ mc:Ignorable=\"w14 w15 wp14\">");
for(size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
{
HdrFtrItem* pHeader = m_aHeaders[i];
WriteItem(_T("header"), pHeader->m_sFilename, pHeader->Header, true);
WriteItem(L"header", pHeader->m_sFilename, pHeader->Header, true);
}
for(size_t i = 0, length = m_aFooters.size(); i < length; ++i)
{
HdrFtrItem* pFooter = m_aFooters[i];
WriteItem(_T("footer"), pFooter->m_sFilename, pFooter->Header, false);
WriteItem(L"footer", pFooter->m_sFilename, pFooter->Header, false);
}
}
void WriteItem( std::wstring sHeader, std::wstring& sFilename, ContentWriter& m_oWriter, bool bHeader)
{
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
@ -186,7 +169,7 @@ mc:Ignorable=\"w14 w15 wp14\">");
}
std::wstring getFilename()
{
return _T("footnotes.xml");
return L"footnotes.xml";
}
bool IsEmpty()
{
@ -208,7 +191,7 @@ mc:Ignorable=\"w14 w15 wp14\">");
std::wstring sFilename = getFilename();
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath);
@ -219,7 +202,7 @@ mc:Ignorable=\"w14 w15 wp14\">");
}
std::wstring getFilename()
{
return _T("endnotes.xml");
return L"endnotes.xml";
}
bool IsEmpty()
{
@ -227,4 +210,3 @@ mc:Ignorable=\"w14 w15 wp14\">");
}
};
}
#endif // #ifndef HEADER_FOOTER_WRITER

View File

@ -31,8 +31,7 @@
*/
#pragma once
#ifndef READER_CLASSES
#define READER_CLASSES
#include "HeaderFooterWriter.h"
#include "../../Common/DocxFormat/Source/XML/Utils.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
@ -100,6 +99,7 @@ public:
bSectionType = false;
bPageNumStart = false;
bRtlGutter = false;
bGutter = false;
}
std::wstring Write()
{
@ -732,7 +732,9 @@ public:
}
if(bFontSizeCs)
{
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
if(false == bFontSize)
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
}
if(bHighLight)
{
@ -1769,9 +1771,9 @@ public:
if(bGridAfter && nGridAfter > 0)
{
writer.WriteString(L"<w:grid" + sName + L" w:val=\"" + std::to_wstring(nGridAfter) + L"\"/>");
if(oAfterWidth.bW)
oAfterWidth.Write(writer, _T("w:w") + sName);
}
if(oAfterWidth.bW)
oAfterWidth.Write(writer, _T("w:w") + sName);
}
};
class WriteHyperlink
@ -1903,12 +1905,19 @@ public:
m_nId += nCount;
return nRes;
}
int getCurrentId()
{
return m_nId;
}
};
class CComment{
class CComment
{
private:
IdCounter& m_oParaIdCounter;
IdCounter& m_oFormatIdCounter;
public:
void *pBinary_DocumentTableReader;
int IdOpen;
int IdFormat;
std::wstring UserName;
@ -1920,8 +1929,10 @@ public:
bool Solved;
unsigned int DurableId;
std::wstring Text;
std::wstring m_sParaId;
std::wstring m_sParaIdParent;
std::wstring sContent;
std::wstring sParaId;
std::wstring sParaIdParent;
std::vector<CComment*> replies;
bool bIdOpen;
@ -1992,8 +2003,8 @@ public:
int nId = pComment->m_oParaIdCounter.getNextId();
pComment->m_sParaId = XmlUtils::IntToString(nId, L"%08X");
sRes += L"<w:p w14:paraId=\"" + pComment->m_sParaId + L"\" w14:textId=\"" + pComment->m_sParaId + L"\">";
pComment->sParaId = XmlUtils::IntToString(nId, L"%08X");
sRes += L"<w:p w14:paraId=\"" + pComment->sParaId + L"\" w14:textId=\"" + pComment->sParaId + L"\">";
sRes += L"<w:pPr><w:spacing w:line=\"240\" w:after=\"0\" w:lineRule=\"auto\" w:before=\"0\"/><w:ind w:firstLine=\"0\" w:left=\"0\" w:right=\"0\"/><w:jc w:val=\"left\"/></w:pPr><w:r><w:rPr><w:rFonts w:eastAsia=\"Arial\" w:ascii=\"Arial\" w:hAnsi=\"Arial\" w:cs=\"Arial\"/><w:sz w:val=\"22\"/></w:rPr><w:t xml:space=\"preserve\">";
sRes += sPart;
sRes += L"</w:t></w:r></w:p>";
@ -2035,49 +2046,58 @@ public:
sRes += L"\"";
}
sRes += L">";
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
if (false == pComment->sContent.empty())
{
wchar_t cToken = sText[i];
if('\n' == cToken)
{
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
nPrevIndex = i + 1;
}
sRes += pComment->sContent;
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
sRes += L"</w:comment>";
else
{
//old comments
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
{
wchar_t cToken = sText[i];
if('\n' == cToken)
{
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
nPrevIndex = i + 1;
}
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
}
sRes += L"</w:comment>";
return sRes;
}
static std::wstring writeContentExt(CComment* pComment)
{
std::wstring sRes;
if(!pComment->m_sParaId.empty())
if(false == pComment->sParaId.empty())
{
std::wstring sDone(L"0");
if(pComment->bSolved && pComment->Solved)
sDone = _T("1");
if(!pComment->m_sParaIdParent.empty())
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" \
w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>";
if(!pComment->sParaIdParent.empty())
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->sParaId + L"\" \
w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>";
else
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
//расставляем paraIdParent
for(size_t i = 0; i < pComment->replies.size(); i++)
pComment->replies[i]->m_sParaIdParent = pComment->m_sParaId;
pComment->replies[i]->sParaIdParent = pComment->sParaId;
}
return sRes;
}
static std::wstring writeContentsIds(CComment* pComment)
{
std::wstring sRes;
if(!pComment->m_sParaId.empty() && pComment->bDurableId)
if(!pComment->sParaId.empty() && pComment->bDurableId)
{
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->m_sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
}
return sRes;
}
@ -2109,8 +2129,8 @@ class CComments
public:
IdCounter m_oFormatIdCounter;
IdCounter m_oParaIdCounter;
public:
CComments():m_oParaIdCounter(1)
CComments() : m_oParaIdCounter(1)
{
}
~CComments()
@ -3127,4 +3147,3 @@ public:
}
};
}
#endif // #ifndef READER_CLASSES

View File

@ -3353,22 +3353,40 @@ int Binary_OtherTableReader::ReadImageMapContent(BYTE type, long length, void* p
}
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):Binary_CommonReader(poBufferedStream)
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
{
}
int Binary_CommentsTableReader::Read()
{
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Writers::ContentWriter oContentWriter;
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, oContentWriter, &m_oComments);
oBinary_DocumentTableReader.m_bUsedParaIdCounter = true;
int res = c_oSerConstants::ReadOk;
READ_TABLE_DEF(res, this->ReadComments, NULL);
READ_TABLE_DEF(res, this->ReadComments, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
FILE_SEPARATOR_STR + m_oFileWriter.m_oCommentsWriter.getFilename() + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
return res;
};
}
int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSer_CommentsType::Comment == type )
{
CComment* pComment = new CComment(m_oComments.m_oParaIdCounter, m_oComments.m_oFormatIdCounter);
pComment->pBinary_DocumentTableReader = poResult;
READ1_DEF(length, res, this->ReadCommentContent, pComment);
if(pComment->bIdOpen && NULL == m_oComments.get(pComment->IdOpen))
m_oComments.add(pComment);
else
@ -3377,11 +3395,12 @@ int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poRes
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
CComment* pComment = static_cast<CComment*>(poResult);
if ( c_oSer_CommentsType::Id == type )
{
pComment->bIdOpen = true;
@ -3431,28 +3450,55 @@ int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void*
pComment->bDurableId = true;
pComment->DurableId = m_oBufferedStream.GetULong();
}
else if ( c_oSer_CommentsType::CommentContent == type )
{
READ1_DEF(length, res, this->ReadCommentContentExt, pComment->pBinary_DocumentTableReader);
Binary_DocumentTableReader* doc_reader = (Binary_DocumentTableReader*)pComment->pBinary_DocumentTableReader;
pComment->sContent = doc_reader->m_oDocumentWriter.m_oContent.GetData();
doc_reader->m_oDocumentWriter.m_oContent.Clear();
int nId = doc_reader->m_pComments->m_oParaIdCounter.getCurrentId();
pComment->sParaId = XmlUtils::IntToString(nId, L"%08X");
}
else if ( c_oSer_CommentsType::Replies == type )
{
READ1_DEF(length, res, this->ReadReplies, &pComment->replies);
READ1_DEF(length, res, this->ReadReplies, pComment);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int Binary_CommentsTableReader::ReadCommentContentExt(BYTE type, long length, void* poResult)
{
Binary_DocumentTableReader* pBinary_DocumentTableReader = static_cast<Binary_DocumentTableReader*>(poResult);
if (!pBinary_DocumentTableReader) return c_oSerConstants::ReadOk;
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
}
int Binary_CommentsTableReader::ReadReplies(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
std::vector<CComment*>* paComments = static_cast<std::vector<CComment*>*>(poResult);
CComment* pCommentParent = static_cast<CComment*>(poResult);
if ( c_oSer_CommentsType::Comment == type )
{
CComment* pNewComment = new CComment(m_oComments.m_oParaIdCounter, m_oComments.m_oFormatIdCounter);
pNewComment->pBinary_DocumentTableReader = pCommentParent->pBinary_DocumentTableReader;
READ1_DEF(length, res, this->ReadCommentContent, pNewComment);
paComments->push_back(pNewComment);
pNewComment->sParaIdParent = pCommentParent->sParaId;
pCommentParent->replies.push_back(pNewComment);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
Binary_SettingsTableReader::Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, OOX::CSettingsCustom& oSettingsCustom):
@ -4204,6 +4250,7 @@ Binary_DocumentTableReader::Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileR
, m_oMath_rPr(m_oFontTableWriter.m_mapFonts)
, m_pComments(pComments)
{
m_bUsedParaIdCounter = false;
m_byteLastElemType = c_oSerParType::Content;
m_pCurWriter = NULL;
}
@ -4237,9 +4284,19 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void
m_byteLastElemType = c_oSerParType::Par;
m_oCur_pPr.ClearNoAttack();
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p>")));
if (m_bUsedParaIdCounter && m_pComments)
{
int nId = m_pComments->m_oParaIdCounter.getNextId();
std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X");
m_oDocumentWriter.m_oContent.WriteString(L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">");
}
else
{
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:p>"));
}
READ1_DEF(length, res, this->ReadParagraph, NULL);
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:p>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:p>"));
}
else if(c_oSerParType::Table == type)
{
@ -7367,17 +7424,27 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR
else if(c_oSerRunType::table == type)
{
//todo
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:p>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:tbl>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:p>"));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:tbl>"));
READ1_DEF(length, res, this->ReadDocTable, &m_oDocumentWriter.m_oContent);
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:tbl>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:tbl>"));
if (m_bUsedParaIdCounter && m_pComments)
{
int nId = m_pComments->m_oParaIdCounter.getNextId();
std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X");
m_oDocumentWriter.m_oContent.WriteString(L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">");
}
else
{
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:p>"));
}
if(m_oCur_pPr.GetCurSize() > 0)
{
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:pPr>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:pPr>"));
m_oDocumentWriter.m_oContent.Write(m_oCur_pPr);
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:pPr>")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:pPr>"));
}
}
else if(c_oSerRunType::fldstart_deprecated == type)
@ -7769,7 +7836,7 @@ int Binary_DocumentTableReader::ReadCell(BYTE type, long length, void* poResult)
//Потому что если перед </tc> не идет <p>, то документ считается невалидным
if(c_oSerParType::Par != oBinary_DocumentTableReader.m_byteLastElemType)
{
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p />")));
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p/>")));
}
}
else
@ -8907,14 +8974,15 @@ int Binary_DocumentTableReader::ReadDropDownList(BYTE type, long length, void* p
}
Binary_NotesTableReader::Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote):
Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_pComments(pComments),m_bIsFootnote(bIsFootnote)
Binary_NotesTableReader::Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote)
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter), m_pComments(pComments), m_bIsFootnote(bIsFootnote)
{
}
int Binary_NotesTableReader::Read()
{
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
std::wstring sFilename;
std::wstring sFilename;
Writers::ContentWriter* pContentWriter = NULL;
if(m_bIsFootnote)
{

View File

@ -226,12 +226,14 @@ public:
class Binary_CommentsTableReader : public Binary_CommonReader
{
public:
CComments m_oComments;
public:
CComments m_oComments;
Writers::FileWriter& m_oFileWriter;
Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
int Read();
int ReadComments(BYTE type, long length, void* poResult);
int ReadCommentContent(BYTE type, long length, void* poResult);
int ReadCommentContentExt(BYTE type, long length, void* poResult);
int ReadReplies(BYTE type, long length, void* poResult);
};
class Binary_SettingsTableReader : public Binary_CommonReader
@ -279,18 +281,21 @@ private:
Binary_pPrReader oBinary_pPrReader;
Binary_rPrReader oBinary_rPrReader;
Binary_tblPrReader oBinary_tblPrReader;
NSStringUtils::CStringBuilder* m_pCurWriter;
NSStringUtils::CStringBuilder* m_pCurWriter;
rPr m_oCur_rPr;
rPr m_oMath_rPr;
NSStringUtils::CStringBuilder m_oCur_pPr;
NSStringUtils::CStringBuilder m_oCur_pPr;
BYTE m_byteLastElemType;
CComments* m_pComments;
public:
CComments* m_pComments;
Writers::ContentWriter& m_oDocumentWriter;
Writers::MediaWriter& m_oMediaWriter;
bool m_bUsedParaIdCounter;
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments);
~Binary_DocumentTableReader();
int Read();
NSStringUtils::CStringBuilder& GetRunStringWriter();
int ReadDocumentContentOut(long length);

View File

@ -805,7 +805,8 @@ extern int g_nCurFormatVersion;
Replies = 9,
OOData = 10,
DurableId = 11,
ProviderId = 12
ProviderId = 12,
CommentContent = 13
};}
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
{

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"
@ -1260,14 +1261,14 @@ void Binary_pPrWriter::WriteSectPr (OOX::Logic::CSectionProperty* pSectPr)
WritePageSettings(pSectPr);
m_oBcw.WriteItemEnd(nCurPos);
//Header
if(pSectPr->m_arrHeaderReference.size() > 0)
if(false == pSectPr->m_arrHeaderReference.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_secPrType::headers);
WriteHeaderFooter(pSectPr, pSectPr->m_arrHeaderReference, true);
m_oBcw.WriteItemEnd(nCurPos);
}
//Footer
if(pSectPr->m_arrFooterReference.size() > 0)
if(false == pSectPr->m_arrFooterReference.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerProp_secPrType::footers);
WriteHeaderFooter(pSectPr, pSectPr->m_arrFooterReference, false);
@ -1431,11 +1432,30 @@ void Binary_pPrWriter::WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr,
const ComplexTypes::Word::CHdrFtrRef& oRef = *aRefs[i];
if( oRef.m_oType.IsInit() && oRef.m_oId.IsInit())
{
smart_ptr<OOX::File> oFile = m_oBinaryHeaderFooterTableWriter->m_oDocumentRels->Find(oRef.m_oId->GetValue());
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
int nIndex = 0;
OOX::CHdrFtr* pHdrFtr = NULL;
OOX::CDocxFlat *docx_flat = dynamic_cast<OOX::CDocxFlat*>(m_oBinaryHeaderFooterTableWriter->m_oParamsWriter.m_pMain);
if (docx_flat)
{
std::map<std::wstring, OOX::CHdrFtr*>::iterator pFind = docx_flat->m_mapHeadersFooters.find(oRef.m_oId->GetValue());
if (pFind != docx_flat->m_mapHeadersFooters.end())
{
pHdrFtr = pFind->second;
}
}
else
{
smart_ptr<OOX::File> oFile = m_oBinaryHeaderFooterTableWriter->m_oDocumentRels->Find(oRef.m_oId->GetValue());
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
{
pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
}
}
if (pHdrFtr)
{
int nIndex = 0;
OOX::CHdrFtr* pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
if(bHdr)
{
nIndex = (int)m_oBinaryHeaderFooterTableWriter->m_aHeaders.size();
@ -3140,9 +3160,9 @@ void BinaryDocumentTableWriter::WriteDocumentContent(const std::vector<OOX::Writ
}
}
}
void BinaryDocumentTableWriter::WriteBackground (OOX::Logic::CBackground* pBackground)
void BinaryDocumentTableWriter::WriteBackground (OOX::WritingElement* pElement)
{
if (pBackground == NULL) return;
if (pElement == NULL) return;
std::wstring sXml;
//if (pBackground->m_oDrawing.IsInit())
@ -3150,19 +3170,34 @@ void BinaryDocumentTableWriter::WriteBackground (OOX::Logic::CBackground* pBackg
// sXml = pBackground->m_oDrawing->m_sXml.get2();
//}
//else
if (pBackground->m_oBackground.IsInit())
{
sXml = pBackground->m_oBackground->toXML();
}
OOX::Logic::CBackground *pBackground = dynamic_cast<OOX::Logic::CBackground*>(pElement);
OOX::Logic::CBgPict *pBgPict = dynamic_cast<OOX::Logic::CBgPict*>(pElement);
if (pBackground->m_oColor.IsInit())
if (pBackground)
{
m_oBcw.WriteColor(c_oSerBackgroundType::Color, pBackground->m_oColor.get());
if (pBackground->m_oBackground.IsInit())
{
sXml = pBackground->m_oBackground->toXML();
}
if (pBackground->m_oColor.IsInit())
{
m_oBcw.WriteColor(c_oSerBackgroundType::Color, pBackground->m_oColor.get());
}
if (pBackground->m_oThemeColor.IsInit())
{
m_oBcw.WriteThemeColor(c_oSerBackgroundType::ColorTheme, pBackground->m_oColor, pBackground->m_oThemeColor, pBackground->m_oThemeTint, pBackground->m_oThemeShade);
}
}
if (pBackground->m_oThemeColor.IsInit())
if (pBgPict)
{
m_oBcw.WriteThemeColor(c_oSerBackgroundType::ColorTheme, pBackground->m_oColor, pBackground->m_oThemeColor, pBackground->m_oThemeTint, pBackground->m_oThemeShade);
if (pBgPict->m_oBackground.IsInit())
{
sXml = pBgPict->m_oBackground->toXML();
}
if (pBgPict->m_oColor.IsInit())
{
m_oBcw.WriteColor(c_oSerBackgroundType::Color, pBgPict->m_oColor.get());
}
}
if (!sXml.empty())
@ -3214,6 +3249,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:
@ -3254,6 +3318,22 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile)
// m_oParamsWriter.m_pFontProcessor->setFontTable(oDocx.m_pFontTable);
oBinaryDocumentEmbTableWriter.WriteDocumentContent(oDocx.m_pDocument->m_arrItems);
}
else
{
OOX::CDocxFlat oDocxFlat = OOX::CDocxFlat(OOX::CPath(sResultDocxDir));
if (oDocxFlat.m_pDocument.IsInit())
{
ParamsDocumentWriter oParamsDocumentWriterEmb(oDocxFlat.m_pDocument.GetPointer());
ParamsWriter oParamsWriterEmb( m_oParamsWriter.m_pCBufferedStream,
m_oParamsWriter.m_pFontProcessor,
m_oParamsWriter.m_pOfficeDrawingConverter,
m_oParamsWriter.m_pEmbeddedFontsManager);
BinaryDocumentTableWriter oBinaryDocumentEmbTableWriter(oParamsWriterEmb, oParamsDocumentWriterEmb, &oParamsWriterEmb.m_mapIgnoreComments, NULL);
oBinaryDocumentEmbTableWriter.WriteDocumentContent(oDocxFlat.m_pDocument->m_arrItems);
}
}
}
NSDirectory::DeleteDirectory(sResultDocxDir);
}
@ -3876,6 +3956,10 @@ void BinaryDocumentTableWriter::WriteHyperlink(OOX::Logic::CHyperlink* pHyperlin
sLink = pHyperlinkFile->Uri().GetPath();
}
}
else if (pHyperlink->m_sDestinition.IsInit())
{
sLink = *pHyperlink->m_sDestinition;
}
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Hyperlink);
WriteHyperlinkContent(sLink, pHyperlink);
@ -3895,14 +3979,14 @@ void BinaryDocumentTableWriter::WriteHyperlinkContent(std::wstring& sLink, OOX::
if(pHyperlink->m_sAnchor.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::Anchor);
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sAnchor.get2());
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sAnchor);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Tooltip
if(pHyperlink->m_sTooltip.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::Tooltip);
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sTooltip.get2());
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sTooltip);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//History
@ -3916,14 +4000,14 @@ void BinaryDocumentTableWriter::WriteHyperlinkContent(std::wstring& sLink, OOX::
if(pHyperlink->m_sDocLocation.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::DocLocation);
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sDocLocation.get2());
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sDocLocation);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//TgtFrame
if(pHyperlink->m_sTgtFrame.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::TgtFrame);
m_oBcw.m_oStream.WriteStringW3(pHyperlink->m_sTgtFrame.get2());
m_oBcw.m_oStream.WriteStringW3(*pHyperlink->m_sTgtFrame);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Content
@ -5899,9 +5983,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;
@ -5911,28 +5995,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)
{
@ -5959,12 +6046,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)
{
@ -7440,17 +7540,33 @@ void BinaryDocumentTableWriter::WriteDropDownList(const OOX::Logic::CSdtDropDown
}
BinaryCommentsTableWriter::BinaryCommentsTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter)
BinaryCommentsTableWriter::BinaryCommentsTableWriter(ParamsWriter& oParamsWriter) :
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
{
};
void BinaryCommentsTableWriter::Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments)
{
ParamsDocumentWriter oParamsDocumentWriter(&oComments);
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
m_pOfficeDrawingConverter->ClearShapeTypes();
int nStart = m_oBcw.WriteItemWithLengthStart();
WriteCommentsContent(oComments, pCommentsExt, pPeople, pCommentsIds, mapIgnoreComments);
WriteCommentsContent(oComments, pCommentsExt, pPeople, pCommentsIds, mapIgnoreComments, oParamsDocumentWriter);
m_oBcw.WriteItemWithLengthEnd(nStart);
m_pOfficeDrawingConverter->SetRels(oldRels);
}
void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments)
void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments, ParamsDocumentWriter& oParamsDocumentWriter)
{
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
m_pOfficeDrawingConverter->ClearShapeTypes();
std::map<std::wstring, OOX::CPerson*> mapAuthorToUserId;
std::map<unsigned int, CCommentWriteTemp*> mapParaIdToComment;
std::vector<CCommentWriteTemp*> aCommentsToWrite;
@ -7556,7 +7672,7 @@ void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments,
if(NULL != pCommentWriteTemp && NULL != pCommentWriteTemp->pComment && pCommentWriteTemp->pComment->m_oId.IsInit() && mapIgnoreComments.end() == mapIgnoreComments.find(pCommentWriteTemp->pComment->m_oId->GetValue()))
{
int nStart = m_oBcw.WriteItemStart(c_oSer_CommentsType::Comment);
WriteComment(*aCommentsToWrite[i]);
WriteComment(*aCommentsToWrite[i], oBinaryDocumentTableWriter);
m_oBcw.WriteItemEnd(nStart);
}
}
@ -7564,7 +7680,7 @@ void BinaryCommentsTableWriter::WriteCommentsContent(OOX::CComments& oComments,
for(size_t i = 0, length = aCommentsToWrite.size(); i < length; ++i)
delete aCommentsToWrite[i];
};
void BinaryCommentsTableWriter::WriteComment(CCommentWriteTemp& oComment)
void BinaryCommentsTableWriter::WriteComment(CCommentWriteTemp& oComment, BinaryDocumentTableWriter & oBinaryDocumentTableWriter)
{
int nCurPos = 0;
OOX::CComment* pComment = oComment.pComment;
@ -7622,28 +7738,34 @@ void BinaryCommentsTableWriter::WriteComment(CCommentWriteTemp& oComment)
}
else
{
nDurableId = XmlUtils::GenerateInt();
//numbers greater than 0x7FFFFFFE cause MS Office errors(ST_LongHexNumber by spec)
nDurableId = XmlUtils::GenerateInt() & 0x7FFFFFFF;
nDurableId = (0x7FFFFFFF != nDurableId) ? nDurableId : nDurableId - 1;
}
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::DurableId);
m_oBcw.m_oStream.WriteULONG(nDurableId);
m_oBcw.WriteItemEnd(nCurPos);
//----------------------------
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::CommentContent);
oBinaryDocumentTableWriter.WriteDocumentContent(pComment->m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
//----------------------------
if(oComment.aReplies.size() > 0)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::Replies);
WriteReplies(oComment.aReplies);
WriteReplies(oComment.aReplies, oBinaryDocumentTableWriter);
m_oBcw.WriteItemEnd(nCurPos);
}
}
};
void BinaryCommentsTableWriter::WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp)
void BinaryCommentsTableWriter::WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp, BinaryDocumentTableWriter & oBinaryDocumentTableWriter)
{
int nCurPos = 0;
for(size_t i = 0, length = aCommentWriteTemp.size(); i < length; i++)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_CommentsType::Comment);
WriteComment(*aCommentWriteTemp[i]);
WriteComment(*aCommentWriteTemp[i], oBinaryDocumentTableWriter);
m_oBcw.WriteItemEnd(nCurPos);
}
}
@ -8194,7 +8316,7 @@ void BinarySettingsTableWriter::WriteCompatSetting(const OOX::Settings::CCompatS
}
BinaryNotesTableWriter::BinaryNotesTableWriter(ParamsWriter& oParamsWriter):
m_oBcw(oParamsWriter),m_oParamsWriter(oParamsWriter),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter)
{
}
void BinaryNotesTableWriter::WriteFootnotes(OOX::CFootnotes& oFootnotes)
@ -8319,111 +8441,160 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
{
NSBinPptxRW::CBinaryFileWriter& oBufferedStream = m_oBcw.m_oStream;
OOX::CDocx oDocx = OOX::CDocx(OOX::CPath(sDir));
OOX::CDocx *pDocx = new OOX::CDocx(OOX::CPath(sDir));
OOX::CDocxFlat *pDocxFlat = NULL;
m_oParamsWriter.m_poTheme = oDocx.m_pTheme;
m_oParamsWriter.m_oSettings = oDocx.m_pSettings;
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;
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(oDocx.m_pTheme);
oBufferedStream.m_pTheme->AddRef();
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(pDocx->m_pTheme);
oBufferedStream.m_pTheme->AddRef();
if(NULL != oDocx.m_pFontTable)
m_oParamsWriter.m_pFontProcessor->setFontTable(oDocx.m_pFontTable);
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;
}
else
{
if (pDocx) delete pDocx; pDocx = NULL;
//ищем первый SectPr и расставляем pageBreak
pDocxFlat = new OOX::CDocxFlat(OOX::CPath(sDir));
if ((pDocxFlat) && (pDocxFlat->m_pDocument.IsInit()))
{
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();
}
}
if (pFontTable)
m_oParamsWriter.m_pFontProcessor->setFontTable(pFontTable);
if (oDocx.m_pDocument == NULL) return;
OOX::Logic::CSectionProperty* pFirstSectPr = oDocx.m_pDocument->m_oSectPr.GetPointer();
//ищем первый SectPr и расставляем pageBreak
if (pDocument == NULL)
{
if (pDocx) delete pDocx; pDocx = NULL;
if (pDocxFlat) delete pDocxFlat; pDocxFlat = NULL;
return;
}
OOX::Logic::CSectionProperty* pFirstSectPr = pDocument->m_oSectPr.GetPointer();
this->WriteMainTableStart();
int nCurPos = 0;
//Write Settings
if(NULL != oDocx.m_pSettings)
OOX::CSettingsCustom oSettingsCustom;
if ((pDocx) && (pDocx->m_pSettings))
{
std::wstring sSettings = oDocx.GetCustomSettings();
OOX::CSettingsCustom oSettingsCustom;
if(!sSettings.empty())
std::wstring sSettings = pDocx->GetCustomSettings();
if(false == sSettings.empty())
{
oSettingsCustom.FromXml(sSettings);
}
}
if (pSettings)
{
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
oBinarySettingsTableWriter.Write(*oDocx.m_pSettings, oSettingsCustom);
oBinarySettingsTableWriter.Write(*pSettings, oSettingsCustom);
this->WriteTableEnd(nCurPos);
}
//Write Comments
if(NULL != oDocx.m_pComments)
if (pComments)
{
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Comments);
oBinaryCommentsTableWriter.Write(*oDocx.m_pComments, oDocx.m_pCommentsExt, oDocx.m_pPeople, oDocx.m_pCommentsIds, m_oParamsWriter.m_mapIgnoreComments);
oBinaryCommentsTableWriter.Write(*pComments, (pDocx ? pDocx->m_pCommentsExt : NULL),
(pDocx ? pDocx->m_pPeople : NULL),
(pDocx ? pDocx->m_pCommentsIds : NULL),
m_oParamsWriter.m_mapIgnoreComments);
this->WriteTableEnd(nCurPos);
}
if(NULL != oDocx.m_pDocumentComments)
if ((pDocx) && (pDocx->m_pDocumentComments))
{
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::DocumentComments);
oBinaryCommentsTableWriter.Write(*oDocx.m_pDocumentComments, oDocx.m_pDocumentCommentsExt, oDocx.m_pDocumentPeople, oDocx.m_pDocumentCommentsIds, m_oParamsWriter.m_mapIgnoreComments);
oBinaryCommentsTableWriter.Write(*pDocx->m_pDocumentComments, pDocx->m_pDocumentCommentsExt, pDocx->m_pDocumentPeople, pDocx->m_pDocumentCommentsIds, m_oParamsWriter.m_mapIgnoreComments);
this->WriteTableEnd(nCurPos);
}
//Write StyleTable
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
if(NULL != oDocx.m_pStyles)
if (pStyles)
{
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
oBinaryStyleTableWriter.Write(*oDocx.m_pStyles);
oBinaryStyleTableWriter.Write(*pStyles);
this->WriteTableEnd(nCurPos);
}
//Write Numbering
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
if(NULL != oDocx.m_pNumbering)
if (pNumbering)
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
oBinaryNumberingTableWriter.Write(*oDocx.m_pNumbering);
oBinaryNumberingTableWriter.Write(*pNumbering);
this->WriteTableEnd(nCurPos);
}
BinDocxRW::BinaryNotesTableWriter oBinaryNotesWriter(m_oParamsWriter);
//Write Footnotes
if(NULL != oDocx.m_pFootnotes)
if ((pDocx) && (pDocx->m_pFootnotes))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Footnotes);
oBinaryNotesWriter.WriteFootnotes(*oDocx.m_pFootnotes);
oBinaryNotesWriter.WriteFootnotes(*pDocx->m_pFootnotes);
this->WriteTableEnd(nCurPos);
}
//Write Endnotes
if(NULL != oDocx.m_pEndnotes)
if ((pDocx) && (pDocx->m_pEndnotes))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Endnotes);
oBinaryNotesWriter.WriteEndnotes(*oDocx.m_pEndnotes);
oBinaryNotesWriter.WriteEndnotes(*pDocx->m_pEndnotes);
this->WriteTableEnd(nCurPos);
}
//Write App
if(NULL != oDocx.m_pApp)
if ((pDocx) && (pDocx->m_pApp))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::App);
oDocx.m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
pDocx->m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
this->WriteTableEnd(nCurPos);
}
if(NULL != oDocx.m_pCore)
if ((pDocx) && (pDocx->m_pCore))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Core);
oDocx.m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
pDocx->m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
this->WriteTableEnd(nCurPos);
}
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, oDocx.m_pDocument, &m_oParamsWriter.m_mapIgnoreComments);
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, pDocument, &m_oParamsWriter.m_mapIgnoreComments);
//Write DocumentTable
ParamsDocumentWriter oParamsDocumentWriter(oDocx.m_pDocument);
ParamsDocumentWriter oParamsDocumentWriter(pDocument);
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
m_oParamsWriter.m_pMain = pMain;
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
@ -8432,23 +8603,30 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
m_oParamsWriter.m_pOfficeDrawingConverter->ClearShapeTypes();
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
oBinaryDocumentTableWriter.pBackground = oDocx.m_pDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.poDocument = oDocx.m_pDocument;
oBinaryDocumentTableWriter.pJsaProject = oDocx.m_pJsaProject;
oBinaryDocumentTableWriter.poDocument = pDocument;
oBinaryDocumentTableWriter.pJsaProject = pDocx ? pDocx->m_pJsaProject : NULL;
if (pDocx)
{
oBinaryDocumentTableWriter.pBackground = dynamic_cast<OOX::WritingElement*>(pDocument->m_oBackground.GetPointer());
}
else if (pDocxFlat)
{
oBinaryDocumentTableWriter.pBackground = dynamic_cast<OOX::WritingElement*>(pDocxFlat->m_oBgPict.GetPointer());
}
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba
if(NULL != oDocx.m_pVbaProject)
if ((pDocx) && (pDocx->m_pVbaProject))
{
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::VbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
oBinaryDocumentTableWriter.WriteVbaProject(*pDocx->m_pVbaProject);
this->WriteTableEnd(nCurPos);
}
// Write content
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
oBinaryDocumentTableWriter.Write(oDocx.m_pDocument->m_arrItems);
oBinaryDocumentTableWriter.Write(pDocument->m_arrItems);
this->WriteTableEnd(nCurPos);
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::HdrFtr);
@ -8463,6 +8641,9 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
WriteTableEnd(nCurPos);
}
this->WriteMainTableEnd();
if (pDocx) delete pDocx; pDocx = NULL;
if (pDocxFlat) delete pDocxFlat; pDocxFlat = NULL;
}
void BinaryFileWriter::ParagraphAddBreak(OOX::Logic::CParagraph* pParagraph)
{

View File

@ -35,16 +35,14 @@
#include "BinReaderWriterDefines.h"
#include "../../Common/DocxFormat/Source/DocxFormat/DocxFlat.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Comments.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Styles.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
@ -76,6 +74,7 @@ namespace BinDocxRW
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
OOX::Document* m_pMain;
OOX::CSettings* m_oSettings;
PPTX::Theme* m_poTheme;
@ -83,8 +82,9 @@ namespace BinDocxRW
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_pCurRels = NULL;
@ -129,7 +129,6 @@ namespace BinDocxRW
class BinaryHeaderFooterTableWriter
{
BinaryCommonWriter m_oBcw;
ParamsWriter& m_oParamsWriter;
OOX::CSettings* m_oSettings;
PPTX::Theme* m_poTheme;
@ -137,14 +136,16 @@ namespace BinDocxRW
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
std::map<int, bool>* m_mapIgnoreComments;
public:
OOX::IFileContainer* m_oDocumentRels;
std::vector<OOX::CHdrFtr*> m_aHeaders;
std::vector<SimpleTypes::EHdrFtr> m_aHeaderTypes;
std::vector<OOX::Logic::CSectionProperty*> m_aHeaderSectPrs;
std::vector<OOX::CHdrFtr*> m_aFooters;
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
public:
ParamsWriter& m_oParamsWriter;
OOX::IFileContainer* m_oDocumentRels;
std::vector<OOX::CHdrFtr*> m_aHeaders;
std::vector<SimpleTypes::EHdrFtr> m_aHeaderTypes;
std::vector<OOX::Logic::CSectionProperty*> m_aHeaderSectPrs;
std::vector<OOX::CHdrFtr*> m_aFooters;
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRel, std::map<int, bool>* mapIgnoreComments);
void Write();
void WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr);
@ -303,7 +304,7 @@ namespace BinDocxRW
public:
Binary_tblPrWriter btblPrs;
OOX::Logic::CSectionProperty* pSectPr;
OOX::Logic::CBackground * pBackground;
OOX::WritingElement* pBackground;
OOX::CDocument* poDocument;
OOX::JsaProject* pJsaProject;
@ -315,7 +316,7 @@ namespace BinDocxRW
void WriteVbaProject(OOX::VbaProject& oVbaProject);
void Write(std::vector<OOX::WritingElement*> & aElems);
void WriteDocumentContent(const std::vector<OOX::WritingElement*> & aElems);
void WriteBackground (OOX::Logic::CBackground* pBackground);
void WriteBackground (OOX::WritingElement* pBackground);
void WriteParapraph(OOX::Logic::CParagraph& par, OOX::Logic::CParagraphProperty* pPr);
void WriteParagraphContent(const std::vector<OOX::WritingElement*> & content, bool bHyperlink = false);
void WriteDel(const OOX::Logic::CDel& oDel);
@ -439,7 +440,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);
@ -489,12 +490,14 @@ namespace BinDocxRW
std::vector<CCommentWriteTemp*> aReplies;
};
BinaryCommonWriter m_oBcw;
ParamsWriter& m_oParamsWriter;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
public:
BinaryCommentsTableWriter(ParamsWriter& oParamsWriter);
void Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments);
void WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments);
void WriteComment(CCommentWriteTemp& oComment);
void WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp);
void WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments, ParamsDocumentWriter& oParamsDocumentWriter);
void WriteComment(CCommentWriteTemp& oComment, BinaryDocumentTableWriter & oBinaryDocumentTableWriter);
void WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp, BinaryDocumentTableWriter & oBinaryDocumentTableWriter);
};
class BinarySettingsTableWriter
{

View File

@ -163,8 +163,7 @@ namespace BinXlsxRW{
toXlsxSheetdata(pWorksheet, *it->second, aSharedStrings);
OOX::Spreadsheet::CSheet* pSheet = new OOX::Spreadsheet::CSheet();
pSheet->m_oName.Init();
pSheet->m_oName->append(sSheetName);
pSheet->m_oName = sSheetName;
pSheet->m_oSheetId.Init();
pSheet->m_oSheetId->SetValue(nSheetId++);
@ -212,8 +211,7 @@ namespace BinXlsxRW{
for (boost::unordered_map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); ++it)
{
OOX::Spreadsheet::CNumFmt* pNumFmt = new OOX::Spreadsheet::CNumFmt();
pNumFmt->m_oFormatCode.Init();
pNumFmt->m_oFormatCode->append(it->first);
pNumFmt->m_oFormatCode = (it->first);
pNumFmt->m_oNumFmtId.Init();
pNumFmt->m_oNumFmtId->SetValue(NUMID_START + it->second);
oXlsx.m_pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);

View File

@ -64,7 +64,7 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
RELEASEOBJECT(m_pParamsWriter);
RELEASEOBJECT(m_pCurFileWriter);
}
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath)
{
OOX::CPath pathMain(sSrcFileName);
@ -105,6 +105,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
oDrawingConverter.SetDstPath(pathMain.GetDirectory() + FILE_SEPARATOR_STR + L"word");
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
oDrawingConverter.SetTempPath(sTempPath);
m_pParamsWriter = new ParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);

View File

@ -63,7 +63,7 @@ namespace BinDocxRW
virtual ~CDocxSerializer();
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sThemePath, const std::wstring& sMediaPath, const std::wstring& sEmbedPath);
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath);
bool CreateDocxFolders(std::wstring strDirectory, std::wstring& sThemePath, std::wstring& sMediaPath, std::wstring& sEmbedPath);

View File

@ -148,7 +148,7 @@ public:
{
case 'M':
{
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"MINYS"))
if ((pos + 5 <= size) && (expr.substr(pos, 5) == L"MINYS"))
{
result += L"-"; pos += 5;
}
@ -159,7 +159,7 @@ public:
}break;
case 'T':
{
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"ТОСHKA"))
if ((pos + 6 <= size) && (expr.substr(pos, 6) == L"ТОСHKA"))
{
result += L"."; pos += 6;
}
@ -170,7 +170,7 @@ public:
}break;
case 'V':
{
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"VOSKL"))
if ((pos + 5 <= size) && (expr.substr(pos, 5) == L"VOSKL"))
{
result += L"!"; pos += 5;
}
@ -181,11 +181,11 @@ public:
}break;
case 'S':
{
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
{
result += L"("; pos += 8;
}
else if ((pos + 9 < size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
else if ((pos + 9 <= size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
{
result += L")"; pos += 9;
}
@ -196,15 +196,15 @@ public:
}break;
case 'K':
{
if ((pos + 9 < size) && (expr.substr(pos, 9) == L"KVADRATIN"))
if ((pos + 9 <= size) && (expr.substr(pos, 9) == L"KVADRATIN"))
{
result += L"["; pos += 9;
}
else if ((pos + 10 < size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
else if ((pos + 10 <= size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
{
result += L"]"; pos += 10;
}
else if ((pos + 8 < size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
else if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
{
result += L"\""; pos += 8;
}
@ -215,7 +215,7 @@ public:
}break;
case 'P':
{
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"PROBEL"))
if ((pos + 6 <= size) && (expr.substr(pos, 6) == L"PROBEL"))
{
result += L" "; pos += 6;
}
@ -226,7 +226,7 @@ public:
}break;
case 'A':
{
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"APOSTROF"))
if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"APOSTROF"))
{
result += L"'"; pos += 8;
}

View File

@ -260,6 +260,9 @@ enum ElementType
typeStyleFooterLeft,
typeStyleFootnoteSep,
typeLoextHeaderFirst,
typeLoextFooterFirst,
typeStyleSectionProperties,
typeStyleHeaderStyle,
typeStyleFooterStyle,
@ -598,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

@ -646,23 +646,30 @@ void docx_conversion_context::add_new_run(std::wstring parentStyleId)
std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, bool draw)
{
hyperlinks::_type_place type = hyperlinks::document_place;
if (current_process_comment_ == true) type = hyperlinks::comment_place;
else if (current_process_note_ == footNote || current_process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
else if (current_process_note_ == endNote || current_process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
oox::_rels_type_place type_place = get_type_place();
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
return hyperlinks_.add(href_correct, type, draw);
return hyperlinks_.add(href_correct, type_place, draw);
}
hyperlinks::_ref docx_conversion_context::last_hyperlink()
{
return hyperlinks_.last();
}
_rels_type_place docx_conversion_context::get_type_place()
{
if (current_process_comment_) return oox::comment_place;
if (current_process_note_ == footNote ||
current_process_note_ == footNoteRefSet) return oox::footnote_place;
if (current_process_note_ == endNote ||
current_process_note_ == endNoteRefSet ) return oox::endnote_place;
if (process_headers_footers_) return oox::header_footer_place;
void docx_conversion_context::dump_hyperlinks(rels & Rels, hyperlinks::_type_place type)
return oox::document_place;
}
void docx_conversion_context::dump_hyperlinks(rels & Rels, _rels_type_place type)
{
hyperlinks_.dump_rels(Rels, type);
}
@ -728,9 +735,12 @@ void docx_conversion_context::end_document()
////////////////////////////////////////////////////////////////////////////
dump_bibliography();
dump_hyperlinks (notes_context_.footnotesRels(), hyperlinks::footnote_place);
dump_hyperlinks (notes_context_.endnotesRels(), hyperlinks::endnote_place);
dump_hyperlinks (notes_context_.footnotesRels(), oox::footnote_place);
dump_hyperlinks (notes_context_.endnotesRels(), oox::endnote_place);
get_mediaitems()->dump_rels(notes_context_.footnotesRels(), oox::footnote_place);
get_mediaitems()->dump_rels(notes_context_.endnotesRels(), oox::endnote_place);
output_document_->get_word_files().set_notes(notes_context_);
////////////////////////
for (size_t i = 0; i < charts_.size(); i++)
@ -898,21 +908,25 @@ namespace
}
}
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type)
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type, bool &bDisplayed)
{
if (!DisplayName.empty())
bDisplayed = true;
if (false == DisplayName.empty())
return DisplayName;
if (!Name.empty())
if (false == Name.empty())
{
bDisplayed = false;
return Name;
}
else
{
switch(Type)
{
case odf_types::style_family::Paragraph:
return L"Normal";
break;
default:
bDisplayed = false;
return std::wstring(L"DStyle_") + boost::lexical_cast<std::wstring>(odf_types::style_family( Type) );
}
}
@ -1113,11 +1127,9 @@ void docx_conversion_context::process_styles()
for (size_t i = 0; i < arStyles.size(); i++)
{
if (!arStyles[i]->is_automatic() &&
(
arStyles[i]->type() == odf_types::style_family::Paragraph ||
arStyles[i]->type() == odf_types::style_family::Text
))
if (false == arStyles[i]->is_automatic() &&
(arStyles[i]->type() == odf_types::style_family::Paragraph ||
arStyles[i]->type() == odf_types::style_family::Text))
{
const std::wstring id = styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(arStyles[i]->type()) << L"\"";
@ -1127,7 +1139,8 @@ void docx_conversion_context::process_styles()
}
_Wostream << L">";
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
bool bDisplayed = (arStyles[i]->type() == odf_types::style_family::Paragraph);
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type(), bDisplayed);
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
@ -1136,12 +1149,13 @@ void docx_conversion_context::process_styles()
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
}
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
else if (false == arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
{
bDisplayed = false;
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
}
else
if (bDisplayed)
{
_Wostream << L"<w:qFormat/>";
}
@ -1993,8 +2007,8 @@ namespace
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
rels internal_rels;
Context.get_mediaitems()->dump_rels(internal_rels);
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
Context.get_mediaitems()->dump_rels(internal_rels, oox::header_footer_place);
Context.dump_hyperlinks(internal_rels, oox::header_footer_place);
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
}

View File

@ -798,10 +798,12 @@ public:
std::wstring add_hyperlink (const std::wstring & href, bool drawing);
hyperlinks::_ref last_hyperlink ();
void dump_hyperlinks (rels & Rels, hyperlinks::_type_place type);
void dump_hyperlinks (rels & Rels, _rels_type_place type);
void dump_headers_footers (rels & Rels) const;
void dump_notes (rels & Rels) const;
_rels_type_place get_type_place();
void dump_bibliography();
std::wstring dump_settings_document();

View File

@ -195,6 +195,86 @@ void _docx_drawing::serialize_text(std::wostream & strm)
serialize_bodyPr(strm, L"wps");
}
//--------------------------------------------------------------------
void docx_serialize_media_child(std::wostream & strm, _docx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pic:pic")
{
CP_XML_ATTR(L"xmlns:pic",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
{
CP_XML_NODE(L"pic:nvPicPr")
{
CP_XML_NODE(L"pic:cNvPr")
{
CP_XML_ATTR(L"id", val.id + 1);
CP_XML_ATTR(L"name", val.name);
//oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"pic:cNvPicPr")
{
CP_XML_NODE(L"a:picLocks") CP_XML_ATTR(L"noChangeAspect",1);
}
CP_XML_NODE(L"pic:nvPr")
{
std::wstring strNode;
if (val.type == typeVideo) strNode = L"a:videoFile";
else if (val.type == typeAudio) strNode = L"a:audioFile";
if (false == strNode.empty())
{
CP_XML_NODE(strNode)
{
CP_XML_ATTR(L"r:link", val.objectId);
}
}
if (false == val.extId.empty())
{
CP_XML_NODE(L"a:extLst")
{
CP_XML_NODE(L"a:ext")
{
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
CP_XML_NODE(L"wp15:media")
{
CP_XML_ATTR(L"xmlns:wp15", L"http://schemas.microsoft.com/office/word/2012/wordprocessingDrawing");
if (val.extExternal)
{
CP_XML_ATTR(L"r:link", val.extId);
}
else
{
CP_XML_ATTR(L"r:embed", val.extId);
}
}
}
}
}
}
}
}
val.fill.bitmap->name_space = L"pic";
oox_serialize_fill(CP_XML_STREAM(), val.fill);
CP_XML_NODE(L"pic:spPr")
{
val.serialize_xfrm(CP_XML_STREAM());
CP_XML_NODE(L"a:prstGeom")
{
CP_XML_ATTR(L"prst", L"rect");
CP_XML_NODE(L"a:avLst");
}
oox_serialize_ln(CP_XML_STREAM(), val.additional);
oox_serialize_effects(CP_XML_STREAM(), val.additional);
}
}
}
}
//--------------------------------------------------------------------
void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
{
@ -211,6 +291,8 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
//CP_XML_ATTR(L"desc text",L"");
CP_XML_ATTR(L"id", val.id + 1);
CP_XML_ATTR(L"name", val.name);
//oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"pic:cNvPicPr")
{
@ -346,6 +428,11 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR(L"uri", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
docx_serialize_group_child(CP_XML_STREAM(), val);
}
else if (val.type == typeAudio || val.type == typeVideo || val.type == typeMedia)
{
CP_XML_ATTR(L"uri",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
docx_serialize_media_child(CP_XML_STREAM(), val);
}
else if (val.type == typeImage)
{
CP_XML_ATTR(L"uri",L"http://schemas.openxmlformats.org/drawingml/2006/picture");

View File

@ -144,9 +144,9 @@ void word_files::write(const std::wstring & RootPath)
void word_files::update_rels(docx_conversion_context & Context)
{
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels(), oox::document_place);
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), oox::document_place);
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
}

View File

@ -51,7 +51,7 @@ struct drawing_object_description
{
bool bNotes_;
oox::RelsType type_;
oox::_rels_type type_;
std::wstring name_;
std::wstring descriptor_;

View File

@ -31,7 +31,6 @@
*/
#include "hyperlinks.h"
#include "oox_rels.h"
#include <xml/utils.h>
@ -48,7 +47,7 @@ hyperlinks::_ref hyperlinks::last()
return r;
}
std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing)
std::wstring hyperlinks::add(const std::wstring & href, _rels_type_place type_place, bool drawing)
{
std::wstring id = std::wstring(L"rHpId") + std::to_wstring(hrefs_.size() + 1);
@ -60,14 +59,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place,
}
void hyperlinks::dump_rels(rels & Rels, _type_place type)
void hyperlinks::dump_rels(rels & Rels, _rels_type_place type_place)
{
size_t i = 0;
for (size_t i = 0; i < hrefs_.size(); i++)
{
if (hrefs_[i].used_rels)continue; // уже использовали этот релс
if (hrefs_[i].type_place == type)
if (hrefs_[i].type_place == type_place)
{
Rels.add( relationship(hrefs_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hrefs_[i].href, L"External" ) );
hrefs_[i].used_rels = true;

View File

@ -31,40 +31,29 @@
*/
#pragma once
#include <vector>
#include <string>
#include "oox_rels.h"
namespace cpdoccore {
namespace oox {
class rels;
class hyperlinks
{
public:
enum _type_place
{
document_place,
endnote_place,
footnote_place,
comment_place
};
struct _ref
{
std::wstring href;
_type_place type_place;
bool drawing;
std::wstring id;
bool used_rels;
std::wstring href;
_rels_type_place type_place;
bool drawing;
std::wstring id;
bool used_rels;
};
std::wstring add(const std::wstring & href, _type_place type_place, bool drawing);
std::wstring add(const std::wstring & href, _rels_type_place type_place, bool drawing);
_ref last();
void dump_rels(rels & Rels, _type_place type);
void dump_rels(rels & Rels, _rels_type_place type_place);
private:

View File

@ -41,13 +41,6 @@
namespace cpdoccore {
namespace utils {
namespace
{
class Error : public std::exception {};
class LoadFontError : public Error {};
class MeasureError : public Error {};
}
std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager)
{
if (pFontManager == NULL) return std::pair<float, float>(7,8);
@ -73,7 +66,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
// return std::pair<float, float>(7,8);
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))//
return std::pair<float, float>(7,8);
TBBox box;
@ -96,7 +89,8 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
if (box.fMaxY - box.fMinY < minHeight) minHeight = box.fMaxY - box.fMinY;
}
double width = (minWidth + 2 * maxWidth) /36. /3.;
double width = (minWidth + 2 * maxWidth) /36. /3.;
//double width = (minWidth + 2 * maxWidth) / 5./*/36.*/ /3.;
return std::pair<float, float>(width, maxHeight);
}

View File

@ -59,18 +59,10 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot)
return NSFile::CFileBinary::Exists(resultPath) || NSDirectory::Exists(mediaPath);
}
mediaitems::item::item( std::wstring const & _href,
RelsType _type,
std::wstring const & _outputName,
bool _mediaInternal,
std::wstring const & _Id
)
: href(_href),
type(_type),
outputName(_outputName),
mediaInternal(_mediaInternal),
Id(_Id),
valid(true) //вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
mediaitems::item::item(std::wstring const & _href,_rels_type _type, std::wstring const & _outputName,
bool _mediaInternal, std::wstring const & _Id, _rels_type_place type_place_)
: href(_href), type(_type), outputName(_outputName), mediaInternal(_mediaInternal), Id(_Id), valid(true), type_place(type_place_)
//вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
{
count_add = 1;
count_used = 0;
@ -102,13 +94,13 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
applicationFonts_->InitializeFromFolder(pathFonts);
}
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, _rels_type_place type_place)
{
std::wstring ref;
return add_or_find(href, type, isInternal, ref);
return add_or_find(href, type, isInternal, ref, type_place);
}
std::wstring static get_default_file_name(RelsType type)
std::wstring static get_default_file_name(_rels_type type)
{
switch (type)
{
@ -136,7 +128,7 @@ std::wstring static get_default_file_name(RelsType type)
return L"";
}
}
std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType type, bool & isInternal, size_t Num)
std::wstring mediaitems::create_file_name(const std::wstring & uri, _rels_type type, bool & isInternal, size_t Num)
{
if (uri.empty()) return L"";
@ -206,7 +198,7 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
return XmlUtils::GetLower(sExt);
}
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref)
std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, std::wstring & ref, _rels_type_place type_place)
{
bool isMediaInternal = true;
std::wstring sub_path = L"media/";
@ -254,6 +246,8 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
std::wstring id;
for (size_t i = 0 ; i < items_.size(); i++)
{
if (items_[i].type_place != type_place) continue;
if ((items_[i].href == inputPath && !inputPath.empty()) || (items_[i].type == type && inputPath.empty()))
{
id = items_[i].Id;
@ -313,13 +307,18 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
count_shape++;
}
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath), isMediaInternal, id) );
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath), isMediaInternal, id, type_place) );
}
ref = outputPath;
isInternal = isMediaInternal;
return id;
}
void mediaitems::add_rels(bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, _rels_type_place type_place)
{
items_.push_back( item(L"", type, ref, isInternal, rid, type_place) );
}
std::wstring mediaitems::add_control_props(std::wstring & oox_target)
{
const bool isMediaInternal = true;
@ -330,10 +329,10 @@ std::wstring mediaitems::add_control_props(std::wstring & oox_target)
oox_target = std::wstring(L"ctrlProp") + std::to_wstring(count_control) + L".xml";
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId) );
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId, oox::document_place) );
return rId;
}
void mediaitems::dump_rels(rels & Rels)
void mediaitems::dump_rels(rels & Rels, _rels_type_place type_place)
{
for (size_t i = 0; i < items_.size(); i++)
{
@ -341,8 +340,10 @@ void mediaitems::dump_rels(rels & Rels)
if ( items_[i].type == typeShape ) continue;
if ( items_[i].type == typeGroupShape ) continue;
if (items_[i].type_place != type_place) continue;
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
Rels.add( relationship(
items_[i].Id,
get_rel_type (items_[i].type),

View File

@ -46,25 +46,28 @@ namespace oox {
class mediaitems
{
public:
mediaitems(const std::wstring & odfPacket);
virtual ~mediaitems();
struct item
{
item( std::wstring const & _href,
RelsType _type,
std::wstring const & _outputName,
bool _mediaInternal,
std::wstring const & _Id);
item( std::wstring const & href,
_rels_type type,
std::wstring const & outputName,
bool mediaInternal,
std::wstring const & Id,
_rels_type_place type_place);
std::wstring href;
RelsType type;
std::wstring outputName;
bool mediaInternal;
bool valid;
std::wstring Id;
int count_used;
int count_add;
std::wstring href;
_rels_type type;
_rels_type_place type_place;
std::wstring outputName;
bool mediaInternal;
bool valid;
std::wstring Id;
int count_used;
int count_add;
};
typedef std::vector< item > items_array;
@ -83,15 +86,17 @@ public:
void set_font_directory(std::wstring pathFonts);
NSFonts::IApplicationFonts *applicationFonts() {return applicationFonts_;}
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal);//возможны ссылки на один и тот же объект
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref);
std::wstring add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, _rels_type_place type_place);//возможны ссылки на один и тот же объект
std::wstring add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, std::wstring & ref, _rels_type_place type_place);
void add_rels(bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, _rels_type_place type_place);
std::wstring add_control_props (std::wstring & oox_target);
void dump_rels(rels & Rels);
items_array & items() { return items_; }
void dump_rels(rels & Rels, _rels_type_place type);
items_array & items() { return items_; }
static std::wstring get_rel_type(RelsType type)
static std::wstring get_rel_type(_rels_type type)
{
switch (type)
{
@ -111,7 +116,7 @@ public:
return L"";
}
}
static RelsType detectMediaType(const std::wstring & fileName)
static _rels_type detectMediaType(const std::wstring & fileName)
{
size_t pos = fileName.rfind(L".");
@ -139,7 +144,7 @@ public:
}
private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring create_file_name (const std::wstring & uri, _rels_type type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (const std::wstring &fileName);
items_array items_;

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

@ -65,7 +65,7 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
{
bool isInternal = true;
std::wstring ref;
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref, oox::chart_place);
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
}
@ -75,7 +75,7 @@ void oox_chart_context::set_externalData(const std::wstring & href)
bool isInternal = true;
std::wstring href_out;
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out);
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out, oox::chart_place);
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
}
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)

View File

@ -45,7 +45,6 @@
namespace cpdoccore {
namespace oox {
class oox_chart_context;
typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
@ -67,9 +66,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)
{

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

@ -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_)
@ -466,7 +484,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 +518,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

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

@ -77,7 +77,7 @@ namespace oox {
std::wstring hId;
std::wstring hRef;
RelsType typeRels;
_rels_type typeRels;
bool highlightClick;
};
class _oox_drawing
@ -86,7 +86,7 @@ namespace oox {
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), hidden(false), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
{
}
RelsType type;
_rels_type type;
bool inGroup;
size_t id;

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

@ -389,16 +389,18 @@ void media::write(const std::wstring & RootPath)
items[i].type == typeAudio ||
items[i].type == typeVideo ))
{
std::wstring & file_name = items[i].href;
std::wstring &file_name = items[i].href;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
if (file_name.empty()) continue;
CImageFileFormatChecker svmFileChecker;
if (svmFileChecker.isSvmFile(file_name))
{
ConvertSvmToImage(file_name, file_name_out, appFonts_);
}
else
NSFile::CFileBinary::Copy(items[i].href, file_name_out);
NSFile::CFileBinary::Copy(file_name, file_name_out);
}
}

View File

@ -40,7 +40,7 @@
namespace cpdoccore {
namespace oox {
enum RelsType
enum _rels_type
{
typeUnknown = 0,
typeDefault,
@ -63,10 +63,18 @@ enum RelsType
typeControlProps,
typeChartUserShapes
};
enum _rels_type_place
{
document_place,
endnote_place,
footnote_place,
comment_place,
header_footer_place,
chart_place
};
struct _rel
{
_rel(bool is_internal_, std::wstring const & rid_, std::wstring const & ref_, RelsType const & type_) :
_rel(bool is_internal_, std::wstring const & rid_, std::wstring const & ref_, _rels_type const & type_) :
is_internal(is_internal_),
rid(rid_),
ref(ref_),
@ -76,7 +84,7 @@ struct _rel
bool is_internal;
std::wstring rid;
std::wstring ref;
RelsType type;
_rels_type type;
};
class relationship : public xml::element_impl<relationship>

View File

@ -34,29 +34,69 @@
#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")
@ -65,32 +105,11 @@ void oox_title::oox_serialize(std::wostream & _Wostream)
}
CP_XML_NODE(L"a:r")
{
CP_XML_NODE(L"a:rPr")
{
_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 +117,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

@ -50,7 +50,7 @@ public:
bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type)
_rels_type type)
{
pptx_drawings_.push_back(d);
@ -79,7 +79,7 @@ public:
bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type)
_rels_type type)
{
bool present = false;
@ -153,7 +153,7 @@ void pptx_drawings::add(_pptx_drawing const & d,
bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type)
_rels_type type)
{
impl_->add(d, isInternal, rid, ref, type);
}
@ -161,7 +161,7 @@ void pptx_drawings::add(/**/
bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type)
_rels_type type)
{
impl_->add(isInternal, rid, ref, type);
}

View File

@ -56,13 +56,13 @@ public:
bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type
_rels_type type
);
void add(/**/
bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type
_rels_type type
);
bool empty() const;

View File

@ -82,11 +82,11 @@ public:
bool header, footer, date_time, slideNum;
void add_drawing(_pptx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
void add_drawing(_pptx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
{
pptx_drawings_->add(d, isInternal, rid, ref, type);
}
void add_additional_rels (bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
void add_additional_rels (bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
{
pptx_drawings_->add(isInternal, rid, ref, type);
}
@ -359,7 +359,7 @@ void pptx_slide_context::add_background(_oox_fill & fill)
bool isMediaInternal = false;
std::wstring ref;
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
}
impl_->background_fill_ = fill;
@ -413,7 +413,7 @@ void pptx_slide_context::start_action(std::wstring action)
impl_->object_description_.action_.highlightClick = true;
}
}
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
void pptx_slide_context::set_link(std::wstring link, _rels_type typeRels)
{
++hlinks_size_;
@ -423,7 +423,7 @@ void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
{
bool isMediaInternal = true;
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef, oox::document_place);
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
}
else
@ -578,7 +578,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
std::wstring ref;/// это ссылка на выходной внешний объект
bool isMediaInternal = false;
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
drawing.fill.bitmap->isInternal = isMediaInternal;
if (drawing.type == typeShape)
@ -586,7 +586,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
isMediaInternal = true;
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
@ -601,7 +601,7 @@ void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _
std::wstring ref;
bool isMediaInternal = true;
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
}
@ -610,7 +610,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
{
std::wstring ref;
bool isMediaInternal = true;
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref, oox::document_place);
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
@ -625,12 +625,12 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
if (drawing.fill.bitmap)
{
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
}
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
////////////////////////////////////////////////////////////////
_CP_OPT(std::wstring) sPlaceHolderType;
@ -653,7 +653,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
std::wstring ref, ref_image;
bool isMediaInternal = true, isMediaInternal_image = true;
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
drawing.objectProgId = obj.descriptor_;
if (!drawing.fill.bitmap)
@ -664,7 +664,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
}
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image, oox::document_place);
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
@ -676,7 +676,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref, oox::document_place);
drawing.extId = L"ext" + drawing.objectId;
drawing.extExternal = !isMediaInternal;
@ -687,7 +687,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
}
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image, oox::document_place);
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
@ -725,7 +725,7 @@ mediaitems_ptr & pptx_slide_context::get_mediaitems()
return impl_->get_mediaitems();
}
void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
{
impl_->add_additional_rels(isInternal, rid, ref, type);
}

View File

@ -91,7 +91,7 @@ public:
void end_frame();
void start_action (std::wstring action);
void set_link (std::wstring link, RelsType typeRels = typeHyperlink);
void set_link (std::wstring link, _rels_type typeRels = typeHyperlink);
void end_action ();
void start_table();
@ -123,7 +123,7 @@ public:
void add_rels( bool isInternal,
std::wstring const & rid,
std::wstring const & ref,
RelsType type);
_rels_type type);
void set_footer();
void set_header();

View File

@ -390,7 +390,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
{
bool isMediaInternal = true;
std::wstring ref;
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref, oox::document_place);
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
}
oox::oox_serialize_fill(CP_XML_STREAM(), fill);

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

@ -36,7 +36,7 @@ namespace oox {
struct XlsxCellType
{
enum type { null, b, n, e, s, str, inlineStr };
enum type { null, b, n, e, s, str, inlineStr, d };
};
int odf_string_to_build_in(const int value_type);

View File

@ -70,7 +70,7 @@ public:
return std::pair<std::wstring, std::wstring>(fileName, rId);
}
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_)
{
const std::wstring id = std::to_wstring(next_drawing_id_++);
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
@ -108,7 +108,7 @@ xlsx_drawing_context_handle::~xlsx_drawing_context_handle()
{
}
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_)
{
return impl_->add_drawing_xml(content, drawings, type_);
}
@ -626,14 +626,14 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
std::wstring ref;/// это ссылка на выходной внешний объект
bool isMediaInternal = false;
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
if (drawing.type == typeShape)
{
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, false, false);//собственно это не объект, а доп рел и ref объекта
isMediaInternal=true;
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
@ -651,7 +651,7 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
std::wstring ref;
bool isMediaInternal = true;
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
if (drawing.inGroup)
@ -691,7 +691,7 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
}
else
{
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref, oox::document_place);
drawing.objectProgId = obj.descriptor_;
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
@ -705,7 +705,7 @@ void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_
std::wstring ref;
bool isMediaInternal = true;
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref, oox::document_place);
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
}
@ -725,7 +725,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
std::wstring ref;
bool isMediaInternal = true;
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref, oox::document_place);
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
}
@ -756,7 +756,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
std::wstring ref;
bool isMediaInternal = true;
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref, oox::document_place);
bool in_sheet = (obj.type_== typeOleObject || obj.type_== typeMsObject) ? true : false;
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet, false);//собственно это не объект, а доп рел и ref объекта
@ -798,7 +798,7 @@ void xlsx_drawing_context::start_action(std::wstring action)
impl_->object_description_.action_.enabled = true;
}
void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
void xlsx_drawing_context::set_link(std::wstring link, _rels_type typeRels)
{//hyprelinks only
++hlinks_size_;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);

View File

@ -62,7 +62,7 @@ public:
xlsx_drawing_context_handle(mediaitems_ptr & items);
~xlsx_drawing_context_handle();
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_ = typeDefault);
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings);
const std::vector<drawing_elm> & content() const;
@ -152,7 +152,7 @@ public:
void process_objects(xlsx_table_metrics & table_metrics);
void start_action(std::wstring action);
void set_link(std::wstring link, RelsType typeRels = typeHyperlink);
void set_link(std::wstring link, _rels_type typeRels = typeHyperlink);
void end_action();
private:

View File

@ -44,7 +44,7 @@ namespace oox {
class xlsx_drawings::Impl
{
public:
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel )//объект
{
if ( type == typeControlProps || type == typeComment)
{
@ -72,7 +72,7 @@ public:
drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
}
}
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel) //не объект
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel) //не объект
{
bool present = false;
@ -305,12 +305,12 @@ xlsx_drawings::~xlsx_drawings()
}
void xlsx_drawings::add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid,
std::wstring const & ref, RelsType type, bool sheet_rel)
std::wstring const & ref, _rels_type type, bool sheet_rel)
{
impl_->add(d, isInternal, rid, ref, type, sheet_rel);
}
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel)
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel)
{
impl_->add(isInternal, rid, ref, type, sheet_rel, vml_rel);
}

View File

@ -46,14 +46,14 @@ typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
struct drawing_elm
{
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, RelsType const & _type)
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, _rels_type const & _type)
: filename(_filename), content(_content), drawings(_drawings), type(_type)
{}
std::wstring filename;
std::wstring content;
xlsx_drawings_ptr drawings;
RelsType type;
_rels_type type;
};
class _xlsx_drawing;
@ -65,8 +65,8 @@ public:
~xlsx_drawings ();
static xlsx_drawings_ptr create(bool inGroup);
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel = false );
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel);
bool empty() const;
bool vml_empty() const;

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

@ -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);
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,14 +109,14 @@ 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,
@ -248,7 +247,7 @@ 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,
@ -258,7 +257,7 @@ size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, 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,
@ -266,7 +265,7 @@ size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content
{
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, 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);
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);
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

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

@ -175,7 +175,9 @@ std::wstring cellType2Str(XlsxCellType::type type)
{
switch(type)
{
case XlsxCellType::b:
case XlsxCellType::d:
return L"d";
case XlsxCellType::b:
return L"b";
case XlsxCellType::n:
return L"n";

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"", true);
}
@ -670,7 +670,7 @@ std::pair<float,float> 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

@ -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)
@ -303,31 +303,31 @@ 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)
{
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 +366,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 +397,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;
@ -431,15 +435,22 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
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 +464,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 +476,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,7 +491,7 @@ 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);
}
@ -500,15 +511,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 +532,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 +554,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 +563,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 +608,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 +627,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 +652,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 +667,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 +778,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 +805,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 +874,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 +965,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;

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_;
@ -258,6 +260,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 +289,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 +315,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 +323,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

@ -149,18 +149,19 @@ void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
void common_draw_fill_attlist::apply_from(const common_draw_fill_attlist & Other)
{
_CP_APPLY_PROP2(draw_fill_);
_CP_APPLY_PROP2(draw_fill_image_name_);
_CP_APPLY_PROP2(draw_fill_image_name_);
_CP_APPLY_PROP2(draw_fill_gradient_name_);
_CP_APPLY_PROP2(draw_fill_hatch_name_);
_CP_APPLY_PROP2(draw_opacity_name_);
_CP_APPLY_PROP2(draw_fill_color_);
_CP_APPLY_PROP2(draw_opacity_);
_CP_APPLY_PROP2(draw_image_opacity_);
_CP_APPLY_PROP2(draw_fill_hatch_solid_);
_CP_APPLY_PROP2(style_repeat_);
_CP_APPLY_PROP2(draw_fill_color_);
_CP_APPLY_PROP2(draw_fill_image_width_);
_CP_APPLY_PROP2(draw_fill_image_height_);
@ -202,6 +203,10 @@ void common_vertical_margin_attlist::add_attributes( const xml::attributes_wc_pt
}
void common_vertical_margin_attlist::serialize(CP_ATTR_NODE)
{
double v = 0;
if (fo_margin_top_)
v = fo_margin_top_->get_length().get_value_unit(length::pt);
CP_XML_ATTR_OPT(L"fo:margin-top", fo_margin_top_);
CP_XML_ATTR_OPT(L"fo:margin-bottom", fo_margin_bottom_);
}
@ -277,7 +282,7 @@ void common_page_number_attlist::add_attributes( const xml::attributes_wc_ptr &
CP_APPLY_ATTR(L"style:first-page-number", str2);
if ((str2) && (*str2 != L"continue"))
{
style_first_page_number_ = XmlUtils::GetInteger(*str1);
style_first_page_number_ = XmlUtils::GetInteger(*str2);
}
}
void common_page_number_attlist::apply_from(const common_page_number_attlist & Other)

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 );
}
}

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