Compare commits

..

313 Commits

Author SHA1 Message Date
1a3a73d0ec . 2019-07-10 14:57:44 +03:00
5a82c47fa0 [x2t] Fix build 2019-07-10 00:36:08 +03:00
65f7a4a170 Merge pull request #172 from ONLYOFFICE/feature/comments
Feature/comments
2019-07-09 20:03:59 +03:00
413424bf62 Merge hotfix/v5.3.3 into develop 2019-07-09 19:39:31 +03:00
01499a21f3 Fix mac timers (#170) 2019-07-09 16:06:10 +03:00
a9215a867b . 2019-07-08 18:22:22 +03:00
e9fd8205fa . 2019-07-08 17:06:27 +03:00
f30a3c4ae8 x2t - fix bug #42030 2019-07-08 13:17:44 +03:00
615179f9da [x2t] Add ThreadedComments to Editor.bin 2019-07-05 20:11:22 +03:00
2fc5a4f37a . 2019-07-05 12:15:34 +03:00
25af6b2ecf x2t - fix bug #41757 2019-07-05 12:02:41 +03:00
f0fdf9f86e [x2t] Add w16cid:commentsIds to Editor.bin 2019-07-04 14:20:37 +03:00
5d5e7bce72 Speed up cloning openssl (#169)
Before:
```
real    3m6,793s
user    0m28,249s
sys     0m5,641s
```

After:
```
real    0m13,834s
user    0m2,169s
sys     0m0,838s
```
2019-07-04 11:42:54 +03:00
58903d92e1 [ios][odfconverter] fix crash 2019-07-03 18:41:19 +03:00
b7ea6bb376 . 2019-07-03 16:49:36 +03:00
a1007d4522 . 2019-07-03 13:42:24 +03:00
4b68d3294c . 2019-07-02 16:12:51 +03:00
24b44f6b03 [x2t] Fix writing m:oMath inside w:hyperlink 2019-07-02 14:02:16 +03:00
9f20ee6fef . 2019-07-01 18:48:47 +03:00
14921ca98d Fix building for xp (#168) 2019-07-01 14:03:21 +03:00
663bf866ed . 2019-07-01 12:57:57 +03:00
4894639c09 Build icu with only xp target (#167) 2019-06-28 10:41:31 +03:00
2314452d5a [x2t] Fix build 2019-06-28 00:16:41 +03:00
22c8ae9d0e Merge pull request #166 from ONLYOFFICE/feature/sheet-data
Feature/sheet data
2019-06-27 20:25:29 +03:00
996fa5c84d [x2t] Fix <w:t> elem with run content inside(<w:t>6<w:cr/>6</w:t>) 2019-06-27 20:20:20 +03:00
59d2dd2840 . 2019-06-27 12:24:51 +03:00
3727c2e982 Fix boost download error 2019-06-26 18:53:10 +03:00
1b67ebe9a6 [s2t] Add some optimization for xls->Editor.bin convertion 2019-06-26 16:30:50 +03:00
967ab71adc XLsFormat - fix bug #41967 2019-06-26 15:37:01 +03:00
d7c7dadbba [x2t] Use one CCell object while xml->binary convertion 2019-06-25 20:22:24 +03:00
a48322f1cc [x2t] Fix CStreamBinaryWriter 2019-06-25 20:20:28 +03:00
bd41922f66 OdfFormatWriter - fix bug #41956 2019-06-25 17:55:49 +03:00
ccd73c8c68 [ios][x2t] fixed build 2019-06-25 15:33:38 +03:00
5b6659f816 [android][x2t] fix build 2019-06-25 14:40:02 +03:00
a5122a6a47 Remove inline flag (#165) 2019-06-24 18:34:22 +03:00
7a4cf11c62 [x2t] Revert some merged files in 2019-06-24 17:31:42 +03:00
9b9d7df4e2 Merge remote-tracking branch 'remotes/origin/hotfix/v5.3.3' into develop
# Conflicts:
#	Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.h
2019-06-24 15:05:16 +03:00
c9330ee0f1 Feature/bug 41890 (#164)
* [x2t] Decode xlsx escaped chars

* [x2t] Fix bug #41890, #36575. Add CStringBuilder::WriteEncodeXmlStringHHHH
2019-06-24 14:56:02 +03:00
2214362426 Fix boost download error 2019-06-24 14:51:39 +03:00
bdce91fccf Merge hotfix/v5.3.2 into develop 2019-06-21 18:38:23 +03:00
dd65f70fcb [ios][x2t] add support bitcode 2019-06-21 16:23:32 +03:00
bf600c6eb0 Core/mac build (#161) 2019-06-21 12:54:00 +03:00
0db6728463 Fix 3rdparty building 2019-06-20 14:32:51 +03:00
03bccc6b10 [x2t] Fix CCell::parseRefA; Fix CSV opening 2019-06-20 11:58:16 +03:00
09c43b1179 Remove curl & add errors to bat files (#159) 2019-06-19 17:20:12 +03:00
e6134405cb Merge remote-tracking branch 'origin/feature/fix_v5.3.1' into develop 2019-06-19 12:22:30 +03:00
0499c6ff4f Merge pull request #158 from ONLYOFFICE/feature/binary-sheet-data
Feature/binary sheet data
2019-06-18 18:36:40 +03:00
1860c19539 [x2t] Fix Editor.bin->xlsx drawing convertion 2019-06-18 17:09:15 +03:00
2d5015bcf2 Revert "[x2t] Move c_oSerWorksheetsTypes::XlsbPos record in Editor.bin"
This reverts commit c0d16ed7c3.
2019-06-18 15:33:53 +03:00
390ab3bcc8 [ios] add constants (#157) 2019-06-18 13:46:28 +03:00
c0d16ed7c3 [x2t] Move c_oSerWorksheetsTypes::XlsbPos record in Editor.bin 2019-06-17 19:05:25 +03:00
075f70c220 Fix prefious commit (#156) 2019-06-17 16:17:14 +03:00
6abf1613ec Fix mac build (#155) 2019-06-17 15:58:07 +03:00
0abc21d4ee Merge pull request #154 from ONLYOFFICE/ios/fixed-build
Fix ios build
2019-06-17 14:13:41 +03:00
7a7cdab770 up 2019-06-17 14:10:11 +03:00
7c6218ccb5 [x2t] Add Cell::fromXMLtoXLSB for performance reasons. Add other fixes 2019-06-14 18:05:01 +03:00
34c5a4b3af [x2t] Improve performance on xlsx->Editor.bin convertion 2019-06-11 20:24:24 +03:00
9256b0f9a3 [x2t] Fixes 2019-06-10 20:09:52 +03:00
ce370581a8 [android] add system initialize path 2019-06-10 13:15:48 +03:00
39647894a8 [android] add system setup fonts 2019-06-10 13:06:05 +03:00
3d456bcc80 [x2t] Fixes 2019-06-07 20:04:11 +03:00
7ae3c6f2ea Fix bug with svg (#153) 2019-06-07 15:22:15 +03:00
404058354e [x2t] Write SheetData to to Editor.bin on xml reading 2019-06-06 20:21:18 +03:00
d398488f3d OdfFormatWriter - fix bug #41789 2019-06-06 13:50:37 +03:00
35bd2803a4 v5.3.1 2019-06-06 12:32:18 +03:00
c312a2b868 XlsFormat - fix bug #41779 2019-06-05 16:44:37 +03:00
08f75771b9 Merge pull request #151 from ONLYOFFICE/gutter
Gutter
2019-06-04 13:36:23 +03:00
060f695fb1 . 2019-06-03 18:15:53 +03:00
de3261521e Merge 5.3.1 => develop 2019-06-03 13:40:34 +03:00
e7bf661432 Fix bug #41495 (#149)
Fix the problem with rendering WMF files
2019-05-31 17:32:12 +03:00
6470a3a8a4 fix bug #38183 2019-05-30 19:13:26 +03:00
14aed88307 . 2019-05-30 12:54:19 +03:00
132f770d28 . 2019-05-29 20:12:21 +03:00
8f5318a9a2 . 2019-05-29 20:07:35 +03:00
635265eaa2 Feature/pre5.3.1 (#146)
* Fix bug with fonts installed not for all users

* Fix compilation error with gcc >=5

* Fix  build for xp
2019-05-29 15:29:19 +03:00
038a687d01 . 2019-05-28 17:03:39 +03:00
69e8ea6f4b . 2019-05-28 13:33:10 +03:00
1393de8057 v5.3.0 2019-05-27 17:21:45 +03:00
7636ff79cc v5.3.0 2019-05-27 17:05:18 +03:00
2092aef589 [ios][odf] fixed build 2019-05-27 13:58:50 +03:00
eff937699b . 2019-05-27 13:39:25 +03:00
3efc1f0432 [ios][x2t] fixed build 2019-05-27 13:01:12 +03:00
69fee1ae0b . 2019-05-23 20:03:25 +03:00
a0cc6b6274 OdfFormatWriter - ...; fix vml comment 2019-05-23 17:28:24 +03:00
31eb395858 OdfFormat - ... 2019-05-21 19:05:00 +03:00
ed1019a004 Not writing transparency group in pdfa mode 2019-05-20 17:09:22 +03:00
4e554d128a Merge pull request #143 from ONLYOFFICE/feature/tester
Feature/tester
2019-05-20 14:39:17 +03:00
b8d441a327 Fix remove exe 2019-05-20 14:34:24 +03:00
8fb809bf4a tester 2019-05-20 14:22:26 +03:00
cabf6ab32a [x2t] Add Gutter to Editor.bin
For bug 40990
2019-05-20 13:57:14 +03:00
35c4d70cf5 Fix bug 41615 2019-05-20 11:57:52 +03:00
58952393f0 OdfFormat - data validations 2019-05-19 17:12:43 +03:00
688d5972ea [x2t] Change write order to Editor.bin 2019-05-17 20:00:11 +03:00
81176e851c [x2t] Add PageSetup properties to Editor.bin 2019-05-17 19:55:47 +03:00
0b987aeed2 Add variable for xp support 2019-05-17 15:00:16 +03:00
c7315e2f21 OdfFormatReader -... 2019-05-16 19:43:29 +03:00
aefb229343 [x2t] Fix typo (Core props) 2019-05-16 18:25:10 +03:00
ac080b3485 Merge commit 'eb9d69d1ec6f23036a820992cd1957463851ef04' into develop 2019-05-16 15:41:55 +03:00
eb9d69d1ec Fix svg bug 2019-05-15 19:28:02 +03:00
eb4ffee9e7 OdfFormat - ... 2019-05-15 19:07:34 +03:00
763347d8ec OdfFormatWriter -.. 2019-05-15 16:35:29 +03:00
9670d021c2 x2t - fix bug #41503 2019-05-14 19:22:20 +03:00
232115e684 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-05-14 14:08:38 +03:00
79f18355fe x2t - fix bug #41515 2019-05-13 15:27:03 +03:00
f86055c713 Epub images bug (xml files) 2019-05-08 12:51:29 +03:00
ea82bea6f1 . 2019-04-29 15:21:20 +03:00
28f5b1251a XlsxFormat - fix bug #41458 2019-04-29 14:20:41 +03:00
39fbf06511 PptFormatReader - fix bug #40482 2019-04-29 14:20:41 +03:00
a265d82dda Merge remote-tracking branch 'origin/feature/fix_v5.3' into develop 2019-04-27 17:30:36 +03:00
e68b550d1e OdfFormatReader - fix bug #41408 2019-04-27 17:14:31 +03:00
0821edca07 OdfFormatReader - fix bug #41408 2019-04-27 16:26:46 +03:00
bc4faa26b9 Fix linux build 2019-04-26 17:06:30 +03:00
668a89bbd1 Merge pull request #132 from ONLYOFFICE/feature/svg
Feature/svg
2019-04-26 16:50:48 +03:00
832d35dc17 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-04-26 16:39:58 +03:00
2d21d334cf OdfFormatReader - fix bug #41408 2019-04-26 16:36:56 +03:00
b23bc97fdb Fix bugs 2019-04-25 18:26:02 +03:00
f4df80ebf3 OdfFormatReader - fix bug #41409 2019-04-25 17:30:06 +03:00
230c51689d DocFormatReader - fix bug #41378 2019-04-24 15:48:41 +03:00
799fcbc342 [ios][x2t] fixed build 2019-04-24 15:39:43 +03:00
1d25f72ac9 SVG full support 2019-04-24 14:14:34 +03:00
9bfb0321b2 svg position support 2019-04-24 11:45:07 +03:00
6c1bdc6ff8 . 2019-04-23 19:27:56 +03:00
826be463f5 PdfWriter: Making full-transparent image pixels white 2019-04-23 18:10:07 +03:00
469ce9aafb [ios][x2t] fixed build 2019-04-23 18:07:50 +03:00
29bb606d04 . 2019-04-23 14:17:10 +03:00
8f8995cbe7 . 2019-04-23 11:00:39 +03:00
fb1ae2c79a . 2019-04-23 10:45:51 +03:00
0f4d594248 . 2019-04-22 18:56:37 +03:00
152d05d5a5 . 2019-04-22 18:40:22 +03:00
942767eb79 . 2019-04-22 17:08:37 +03:00
5c070f0475 . 2019-04-22 16:50:53 +03:00
17c68ae414 OdfFormatWriter - ... 2019-04-22 13:16:23 +03:00
ab45804644 . 2019-04-19 18:50:12 +03:00
5f7288f66f . 2019-04-19 17:41:29 +03:00
b308f53e76 . 2019-04-19 14:45:55 +03:00
0982b8fb11 OdfFormatWriter - .. 2019-04-18 20:01:12 +03:00
4cca54900d . 2019-04-18 18:46:34 +03:00
b66ed403e1 . 2019-04-18 18:22:08 +03:00
692fe69426 OdfFormatWriter - controls 2019-04-18 12:24:36 +03:00
428b5971e8 . 2019-04-17 18:55:31 +03:00
32193b8a04 x2t - for bug 41281 2019-04-17 18:01:14 +03:00
5bb1de7dbd Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-04-17 13:29:49 +03:00
97531fe80f OdfFormatReader - fix bug #41258 2019-04-17 12:06:54 +03:00
84755143fa . 2019-04-16 17:55:33 +03:00
37ab11c58a OdfFormatWriter - fix user file 2019-04-16 17:28:50 +03:00
22cdeaf821 Fix build error 2019-04-16 16:59:58 +03:00
ee4d2079dc Update videoplayerlib path 2019-04-16 12:46:09 +03:00
68606f4cb0 Change docbuilder path 2019-04-15 19:13:36 +03:00
dbb11a480e Move docbuilder to core 2019-04-15 18:31:47 +03:00
6c29f811d9 x2t - fixed bug #40823 2019-04-15 14:15:57 +03:00
eb157610d3 DocFormatReader - fix bug #41172 2019-04-15 12:06:30 +03:00
89ac698d35 . 2019-04-15 11:30:23 +03:00
e1d910f952 . 2019-04-13 12:04:23 +03:00
ef7331d803 [x2t] Add MoveFromRangeStart to Editor.bin in all levels(body, p ...) 2019-04-12 19:01:29 +03:00
5bb3ca6aff Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2019-04-12 18:38:53 +03:00
bae655ba49 GetTickCount on MacOS 2019-04-12 18:38:42 +03:00
e4b4949471 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-04-12 18:32:21 +03:00
2bfcfbf21c . 2019-04-12 18:31:41 +03:00
1266382747 . 2019-04-12 14:17:34 +03:00
287059a891 x2t - fix users files 2019-04-11 19:54:04 +03:00
966809a8f2 x2t - bin - read/write activeX(convert to control) 2019-04-11 17:15:29 +03:00
d8f8720d05 [x2t] Fix writing to Editor.bin. For bug 40914. 2019-04-11 16:31:55 +03:00
aa8471b024 [x2t] Fix reading from Editor.bin 2019-04-08 19:52:54 +03:00
27c9b40ad3 [ios][x2t] fixed build 2019-04-05 11:53:33 +03:00
699eb731b4 x2t - bin - form controls read/write 2019-04-04 20:02:26 +03:00
0eb032a281 . 2019-04-04 15:38:02 +03:00
f89174ded5 . 2019-04-04 14:02:02 +03:00
ff1d53637a x2t - bin - writing xlsx controls 2019-04-02 18:44:10 +03:00
e825b4359f Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-04-02 17:14:46 +03:00
d11b74007d . 2019-04-02 12:16:22 +03:00
45d5f3b130 . 2019-04-01 18:48:43 +03:00
25022ceecc XlsxFormat - ctrlProps 2019-04-01 18:25:53 +03:00
1a7476e465 x2t - XlsxFormat - fix bug #40316 - queryTables, connections, dataValidations 2019-03-31 17:19:47 +03:00
0edc2729e8 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-28 12:23:48 +03:00
d898f0ef2f OdfFormatW - ... 2019-03-27 18:35:33 +03:00
d51f004b11 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-27 13:49:34 +03:00
c645ed6aeb OdfFormatW - ... 2019-03-27 13:46:53 +03:00
79aa50d712 [x2t] Add OutlineLevelCol, OutlineLevelRow to Editor.bin 2019-03-25 19:56:24 +03:00
3dcb378de7 . 2019-03-25 19:24:44 +03:00
87c4ebe1d4 x2t - ... 2019-03-25 16:18:54 +03:00
fdef699b9b [ios][x2t] fixed build 2019-03-25 15:14:24 +03:00
498d58e856 x2t - ... 2019-03-25 13:50:29 +03:00
441aa277e3 XlsFormat - fixbug #40932 2019-03-25 13:15:18 +03:00
e8c314e535 . 2019-03-21 13:54:38 +03:00
12c8cf112a . 2019-03-21 13:51:57 +03:00
c9fb5cbe4d x2t - ... 2019-03-21 13:09:52 +03:00
8573513168 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-20 18:53:57 +03:00
4e337b5ef1 XlsFormat - fix user file 2019-03-20 18:49:38 +03:00
7e0e30d00f [x2t] Fix xlsx->Editor.bin conversion with invalid cell refs
<x:c r="2:1" instead of "B1"
2019-03-20 14:00:05 +03:00
72c4727a1e XlsFormat - fix bug #40895 2019-03-20 12:54:00 +03:00
29c197f383 XlsFormat - fix bug #40879 2019-03-19 19:49:40 +03:00
c07bd58bda XlsFormat -... 2019-03-18 19:58:20 +03:00
ae9a7f7fad [zlib] Fix 7-zip Warning: Headers error
Problem in header field: "last mod file date".
tm_sec = tm_min = tm_hour = tm_mday = tm_mon = tm_year = 0; is considered as 0 Jan 1980 (0x00200000 in file)
default value of tm_mon should be -1 (zip64local_TmzDateToDosDate tm_mon+1)
2019-03-15 19:26:57 +03:00
1157d6f97f . 2019-03-15 17:27:25 +03:00
5483547ee7 . 2019-03-15 15:47:26 +03:00
b9608771a9 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-15 14:51:35 +03:00
b3d219ef58 . 2019-03-15 14:50:29 +03:00
46a6e35a35 . 2019-03-15 14:48:53 +03:00
cfea717d20 XlsxFormat - dataValidation (+x14) 2019-03-14 19:53:11 +03:00
ae45b240a3 XlsFormat - ... 2019-03-14 19:44:37 +03:00
0ec79f2c2d . 2019-03-14 13:46:42 +03:00
6f0d22c3a4 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-14 12:06:08 +03:00
8d074cadf8 OdfFormatReader - ... 2019-03-14 12:04:44 +03:00
4a3b56d0d5 OdfFormatReader - .. 2019-03-14 12:03:22 +03:00
195e9079db Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-13 19:09:19 +03:00
8e8fd1096f . 2019-03-13 19:07:50 +03:00
b60811fd0d DocxFormat - read/write ooxml chart_ex 2019-03-13 16:30:09 +03:00
9eb82fa85e DocFormatReader - fix bug #40841 2019-03-13 14:06:10 +03:00
6d6cbd51c3 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-12 15:50:06 +03:00
9e0ff699aa . 2019-03-12 15:48:57 +03:00
9c1b107998 Merge remote-tracking branch 'origin/release/v5.3.0' into develop 2019-03-07 18:31:50 +03:00
c0d38c97f8 DocFormat - fix bug #40798 2019-03-07 18:30:28 +03:00
f2e003b12c [ios][pe] spellcheck 2019-03-07 18:15:22 +03:00
ee43592691 OdfFormatReader - chart user shapes from odf chart group 2019-03-06 19:02:38 +03:00
a1b2979f0f . 2019-03-05 18:46:37 +03:00
00328e88b2 [ios] spellcheck 2019-03-05 17:27:02 +03:00
ed2878a8cc . 2019-03-05 12:14:31 +03:00
bc18304827 OdfFormatReader .. 2019-03-04 12:25:20 +03:00
8d59eeabd5 . 2019-03-04 11:52:21 +03:00
df894c0193 Fix build 2019-03-01 13:11:27 +03:00
655c393a1b Add videoplayerlib 2019-03-01 12:23:08 +03:00
06b25e1cc6 . 2019-02-28 19:54:49 +03:00
e4ed9cade7 [x2t] Fix convertion to json 2019-02-28 18:02:48 +03:00
47dc96ba3c [ios][x2t] up formats 2019-02-28 17:32:20 +03:00
3c4154b3ac x2t - refactoring for build 2019-02-28 16:56:37 +03:00
455c8b3836 [ios][x2t] up formats 2019-02-28 15:08:17 +03:00
a9252192e8 x2t - fix bug #40731 2019-02-28 11:52:08 +03:00
e31f101021 x2t - refactoring build 2019-02-27 16:11:08 +03:00
f34660291a Add param to base.pri 2019-02-27 15:53:21 +03:00
cebfe04802 . 2019-02-27 13:10:46 +03:00
746490cea1 . 2019-02-27 12:55:30 +03:00
18df04b508 [ios][x2t] up formats 2019-02-27 12:01:43 +03:00
0bd1fb972f OdfFormatWriter - group color to shapes 2019-02-27 11:06:46 +03:00
7b92c7d079 [ios][x2t] up formats 2019-02-26 19:42:39 +03:00
7e3aebe79c split docx format build 2019-02-25 16:49:56 +03:00
34fc112d0e DocFormat - fix user file 2019-02-25 14:22:42 +03:00
2d219d5a74 PptxFormat - fix bug #40690 2019-02-22 16:44:47 +03:00
9d30e3ecab XlsxFormat - connections & query tables 2019-02-22 16:44:06 +03:00
c6de9b9e52 [x2t] Add GradientFill to Editor.bin 2019-02-22 16:04:40 +03:00
affc65c679 [ios][x2t] up formats 2019-02-21 17:34:38 +03:00
2cff8d9804 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2019-02-21 14:58:47 +03:00
28f8de794f . 2019-02-21 14:58:36 +03:00
daac90f8dc OdfFormatWriter - fix bullet char 2019-02-21 14:57:11 +03:00
30adbb0a24 . 2019-02-21 14:53:21 +03:00
94e59cfc82 [ios][x2t] up formats 2019-02-20 18:59:27 +03:00
9794d714d3 OdfFormat -fix table content 2019-02-20 16:07:37 +03:00
8d80005bab . 2019-02-19 19:46:37 +03:00
a4d22be862 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2019-02-19 14:26:12 +03:00
3f615c2ece XlsxFormat - condit.format ext with dxf 2019-02-19 14:24:47 +03:00
95e1a1edf9 [x2t] Fix typo 2019-02-19 12:06:13 +03:00
f7f9346286 Enable curl/wget external downloaders in linux/ (remove dependency to libcurl by default) 2019-02-19 11:35:56 +03:00
c0c6baf636 XlsxFormat - read/write iconSet ext 2019-02-18 19:24:00 +03:00
ccbc044f11 . 2019-02-18 17:38:05 +03:00
a8668df5fd XlsxFormat - read/write dataBar ext 2019-02-18 12:52:55 +03:00
cc228f3393 XlsxFormat - read/write ext conditional formating 2019-02-18 11:25:09 +03:00
19904acd30 XlsFormat - fix bug #40601 2019-02-15 18:02:02 +03:00
30d175144a . 2019-02-15 11:14:23 +03:00
acf15abe41 XlsxFormat - add threaded comments 2019-02-13 18:38:25 +03:00
5a7fc7f548 Skip build error for tests 2019-02-13 16:11:50 +03:00
e7326556e0 PptFormat - fix bug #40393 2019-02-13 14:29:21 +03:00
c589d8fe8a [ios][x2t] up formats 2019-02-13 13:59:04 +03:00
a28e8f1357 [ios][x2t] up formats 2019-02-13 13:48:07 +03:00
8b7bb944bc Rework GM_Compatible mode, fix bug with flipped images, fix bug with storing matrix transform for the clip 2019-02-12 17:51:05 +03:00
14ee946069 . 2019-02-12 17:30:58 +03:00
7aebdd8ec5 . 2019-02-12 17:15:07 +03:00
977baafc03 x2t - fix bug #40531 2019-02-12 16:22:41 +03:00
31b854bc70 [x2t] Add decimalSymbol, listSeparator to Editor.bin 2019-02-12 12:20:47 +03:00
e274dc50d7 [x2t] Save comment to document and to text into different files(docx) 2019-02-11 20:11:50 +03:00
d153db627b [ios][x2t] up formats 2019-02-11 19:09:33 +03:00
9cc6bc14c5 [ios][x2t] up formats 2019-02-11 18:36:35 +03:00
775c57be5d . 2019-02-11 17:26:05 +03:00
da37aeb039 . 2019-02-11 17:13:19 +03:00
751c6647a2 OdfFormatWrite - write templates 2019-02-11 15:05:44 +03:00
ec2344ccd5 OdfFormat - fix bug #40149 2019-02-10 16:02:20 +03:00
0494882541 Fix previous commit 2019-02-08 18:41:05 +03:00
07b0ba71d9 Add WriteData method & add feature to send js variables to builder native methods 2019-02-08 17:14:23 +03:00
299ef4873f XlsFormat - .. 2019-02-08 14:58:52 +03:00
93c7819106 OdfFormat - .. 2019-02-08 14:56:15 +03:00
16c3f81dee OdfFormat - fix bug #40505 2019-02-08 14:20:28 +03:00
7fc67bdadf DocxFormat - fix bug #40505 2019-02-08 13:30:17 +03:00
31deb60343 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2019-02-07 19:30:26 +03:00
7e83e168db PptFormat - fix bug #40114 2019-02-07 19:29:51 +03:00
a4c0fbe4ea Fix bug #40340
Add support of a GM_COMPATIBLE mode for a text. Also fixed the problem with clipping by the path with specified a world-transform
2019-02-07 19:05:00 +03:00
ae0f5867dd [ios][x2t] up formats 2019-02-07 18:44:52 +03:00
0dd4fc9c14 x2t - doc/ppt/xls format - small refactoring (rename namespaces) 2019-02-07 18:23:41 +03:00
3a92ef2395 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2019-02-06 18:11:35 +03:00
23c9a65fcb PptFormat - fix bug #40482 2019-02-06 18:10:39 +03:00
ba55f1436d [ios][x2t] up formats 2019-02-06 18:02:00 +03:00
f1c1d62a4d [x2t] Fix writing corrupted pptx 2019-02-06 13:03:11 +03:00
c2bdec6bde Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2019-02-05 20:39:34 +03:00
93d0ebfa09 . 2019-02-05 20:39:24 +03:00
6f881e2066 XlsFormat - fix bugs #40461, #40459 2019-02-05 20:36:11 +03:00
564b7f9c29 v5.2.8 2019-02-05 16:23:16 +03:00
8be0d7f2b3 [x2t] Add "created", "MODIFIED" environments to rev:8f332c3c09437f0d89b8d0a843655b6b02eb1329 2019-02-05 15:45:18 +03:00
cbbb4c19de . 2019-02-05 12:23:10 +03:00
f4e0ce53b4 [x2t] For linux build 8f332c3c09 2019-02-05 11:24:36 +03:00
8f332c3c09 [x2t] Add app.xml, core.xml to Editor.bin 2019-02-04 20:04:37 +03:00
4721a4a96b [ios][x2t] up 2019-02-04 15:43:57 +03:00
44a0c65637 [ios][x2t] boost.framework build and odf_file projects 2019-02-02 15:05:44 +03:00
4de7090c78 [x2t] Fix writing corrupted xlsx
Change firstHeader firstFooter order
2019-01-31 13:47:34 +03:00
6f09ec71f9 . 2019-01-30 12:18:25 +03:00
b122d75f34 DocFormat - fix bug #40363 2019-01-29 19:58:40 +03:00
ed613f7ec1 x2t - fix bug #39977 2019-01-25 15:12:38 +03:00
e0bc06d3db OdfFormatReader - ... 2019-01-25 14:29:47 +03:00
366f16aa4f Merge remote-tracking branch 'origin/hotfix/v5.2.8' into develop 2019-01-25 13:35:27 +03:00
662c687520 . 2019-01-25 13:33:35 +03:00
efc70421e2 [ios] up 2019-01-25 11:05:14 +03:00
7522ad9167 Fix bug 40283 2019-01-25 10:28:43 +03:00
f7922fcea8 . 2019-01-24 19:32:23 +03:00
19dabff8e6 Refactoring 2019-01-24 16:19:42 +03:00
84bd16951f Fix bug #39966
Fix the problem with embedding non-bolded fonts. Improve check whether the font is bold
2019-01-24 15:39:42 +03:00
8996935a10 XlsFormat - fix bug #40178 2019-01-23 18:47:25 +03:00
87c999474d XlsFormat - write default theme 2019-01-23 17:16:42 +03:00
1038 changed files with 86260 additions and 43595 deletions

6
.gitignore vendored
View File

@ -3,6 +3,8 @@ dictionaries/
LicenceManager/
Common/boost_1_58_0
Common/3dParty/boost/boost_1_58_0
Common/3dParty/boost/ios
Common/3dParty/boost/osx
Common/3dParty/icu/win_64
Common/3dParty/icu/win_32
Common/3dParty/icu/linux_64
@ -61,4 +63,6 @@ X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
*.zip
*.tar.gz
**/*.build/
*.dat
*.txt
*.log

View File

@ -769,12 +769,18 @@ namespace DocFileFormat
return bytes;
}
static inline std::wstring IntToWideString(int value)
static inline std::wstring IntToWideString(unsigned int value)
{
return (std::to_wstring(value));
}
static inline std::wstring IntToWideString(int value)
{
return (std::to_wstring(value));
}
static inline std::wstring SizeTToWideString(size_t value)
{
return (std::to_wstring((unsigned int)value));
}
static inline std::wstring DoubleToWideString(double value)
{
std::wstringstream src;

View File

@ -87,15 +87,14 @@ namespace DocFileFormat
}
else
{
m_nDTTM = reader->ReadUInt32();
m_nDTTM = DateAndTime(reader->ReadUInt32());
reader->ReadUInt16(); //padding1
m_nDepth = reader->ReadUInt32();
m_nDiatrdParent = reader->ReadUInt32();
unsigned int flag = reader->ReadUInt32();
m_fInkAtn = GETBIT(flag, 1);
}
return static_cast<ByteStructure*>(newObject);
}
}

View File

@ -32,6 +32,7 @@
#pragma once
#include "ByteStructure.h"
#include "DateAndTime.h"
namespace DocFileFormat
{
@ -72,7 +73,7 @@ namespace DocFileFormat
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
AnnotationReferenceExDescriptor() : m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
{
}
@ -82,7 +83,7 @@ namespace DocFileFormat
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
unsigned int m_nDTTM;
DateAndTime m_nDTTM;
unsigned int m_nDepth;
unsigned int m_nDiatrdParent;
bool m_fInkAtn;

View File

@ -85,9 +85,11 @@ namespace DocFileFormat
if (author_str)
{
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
rPrChange.AppendAttribute( author );
}
XMLTools::XMLAttribute date( L"w:date", _revisionData->Dttm.getString());
rPrChange.AppendAttribute( date );
//convert revision stack
convertSprms( _revisionData->Changes, &rPrChange );

View File

@ -85,34 +85,31 @@ namespace DocFileFormat
for (size_t index = 0; index < count; ++index)
{
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
AnnotationReferenceExDescriptor* atrdPost10 = NULL;
if ((m_document->AnnotationsReferenceExPlex) && (index < m_document->AnnotationsReferenceExPlex->Elements.size()))
{
atrdPost10 = static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]);
}
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
if (atrdPre10->m_BookmarkId < 0)
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
{
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
}
else
{
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 ));
}
if (atrdPost10)
{
//!!!TODO!!!
/*//ATRDpost10 is optional and not saved in all files
if (doc.AnnotationReferenceExtraTable != null &&
doc.AnnotationReferenceExtraTable.Count > index)
{
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
atrdPost10.Date.Convert(new DateMapping(_writer));
}*/
m_pXmlWriter->WriteAttribute( L"w:date", atrdPost10->m_nDTTM.getString());
}
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
{
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
}
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
m_pXmlWriter->WriteAttribute( L"w:initials", FormatUtils::XmlEncode(atrdPre10->m_UserInitials));

View File

@ -83,6 +83,14 @@ namespace DocFileFormat
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
}
}
std::wstring getString()
{
return std::to_wstring(yr) + L"-" + (mon < 9 ? L"0" : L"" ) + std::to_wstring(mon) + L"-" +
(dom < 9 ? L"0" : L"" ) + std::to_wstring(dom) + L"T" +
(hr < 9 ? L"0" : L"" ) + std::to_wstring(hr) + L":" +
(mint < 9 ? L"0" : L"" )+ std::to_wstring(mint) + L"Z";
}
#if defined(_WIN32) || defined(_WIN64)
SYSTEMTIME ToSYSTEMTIME()
{

View File

@ -406,8 +406,8 @@ namespace DocFileFormat
//if it's a inserted run
m_pXmlWriter->WriteNodeBegin(L"w:ins", true);
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
m_pXmlWriter->WriteNodeEnd(L"", true, false);
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
}
//start run
@ -716,7 +716,7 @@ namespace DocFileFormat
RELEASEOBJECT( chpxs );
}
}
oleWriter.WriteString( _lastOLEObject );
oleWriter.WriteString( _lastOLEObject ); _lastOLEObject.clear();
oleWriter.WriteNodeEnd( L"w:object" );
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
@ -800,8 +800,9 @@ namespace DocFileFormat
}
}
XMLTools::XMLElement elem(L"w:br");
elem.AppendAttribute(L"w:type", L"textWrapping");
elem.AppendAttribute(L"w:clear", L"all");
//СЗ в МРФ Техноград о предоставлении ТП 1 квартал 2019_MO_Q31.doc
//elem.AppendAttribute(L"w:type", L"textWrapping");
//elem.AppendAttribute(L"w:clear", L"all");
m_pXmlWriter->WriteString(elem.GetXMLString());
}
@ -912,6 +913,7 @@ namespace DocFileFormat
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlexHeader->GetStruct(headerCp));
}
bool bPicture = false;
if (pSpa)
{
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
@ -925,6 +927,8 @@ namespace DocFileFormat
pShape->Convert(&oVmlWriter);
m_pXmlWriter->WriteNodeEnd (L"w:pict");
bPicture = true;
}
if (!pSpa->primitives.empty())
@ -933,8 +937,13 @@ namespace DocFileFormat
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
pSpa->primitives.Convert(&oVmlWriter);
m_pXmlWriter->WriteNodeEnd (L"w:pict");
bPicture = true;
}
}
if ((false == _fieldLevels.empty()) && (_fieldLevels.back().bSeparate))
_fieldLevels.back().bResult = bPicture;
}
else if (TextMark::Picture == code && fSpec)
{
@ -1004,10 +1013,23 @@ namespace DocFileFormat
oPicture.shapeContainer->Convert(&oVmlMapper);
}
pictWriter.WriteNodeEnd (L"w:pict");
pictWriter.WriteNodeEnd (L"w:pict");
if (!bFormula)
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
{
if (false == _fieldLevels.empty())
{
if (_fieldLevels.back().bSeparate && !_fieldLevels.back().bResult) //ege15.doc
{
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
_fieldLevels.back().bResult = true;
}
}
else
{
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
}
}
}
}
@ -1058,7 +1080,15 @@ namespace DocFileFormat
else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size()))
{
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr++ ));
int index = _commentNr++;
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index - 1]);
if (atrdPre10->m_BookmarkId < 0)
index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(index));
m_pXmlWriter->WriteNodeEnd( L"", true );
}
}
@ -1771,7 +1801,7 @@ namespace DocFileFormat
if (m_document->AnnotStartEndCPs[i].second == cp)
{
result = writeAnnotationEnd(i + 1);
_commentNr = i + 1;
//_commentNr = i + 1;
}
}

View File

@ -161,6 +161,7 @@ namespace DocFileFormat
{
bool bBegin = false;
bool bSeparate = false;
bool bResult = false;
//bool bInstrText = false;
bool bEnd = false;
};

View File

@ -31,7 +31,6 @@
*/
#include "MainDocumentMapping.h"
#include "OfficeDrawing/FillStyleBooleanProperties.h"
namespace DocFileFormat
{
@ -88,10 +87,11 @@ namespace DocFileFormat
m_document->DocProperties->bDisplayBackgroundShape = true;
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeBackgound();
OptionEntryPtr boolFill = pShape->ExtractOption(fillStyleBooleanProperties);
ODRAW::OfficeArtFOPTEPtr boolFill = pShape->ExtractOption(fillStyleBooleanProperties);
FillStyleBooleanProperties booleans(boolFill ? boolFill->op : 0);
if (booleans.fUsefFilled && !booleans.fFilled)
ODRAW::FillStyleBooleanProperties* booleans = dynamic_cast<ODRAW::FillStyleBooleanProperties*>(boolFill.get());
if (booleans && (booleans->fUsefFilled && !booleans->fFilled))
{
bFilled = false;
}

View File

@ -92,7 +92,7 @@ namespace DocFileFormat
{
//start abstractNum
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( i /*+ 1 */));
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( i /*+ 1 */));
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
//nsid
@ -140,7 +140,7 @@ namespace DocFileFormat
{
//start abstractNum
m_pXmlWriter->WriteNodeBegin( L"w:abstractNum", TRUE );
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
m_pXmlWriter->WriteAttribute( L"w:abstractNumId", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
////nsid
@ -169,7 +169,7 @@ namespace DocFileFormat
//start num
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(i + 1));
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(i + 1));
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
int index = FindIndexbyId( rglst->listData, lfo->lsid );
@ -205,12 +205,12 @@ namespace DocFileFormat
for (size_t i = 0; i < rglst->listNumbering.size(); ++i)
{
m_pXmlWriter->WriteNodeBegin( L"w:num", TRUE );
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::IntToWideString(rglst->listNumbering[i]->id));
m_pXmlWriter->WriteAttribute( L"w:numId", FormatUtils::SizeTToWideString(rglst->listNumbering[i]->id));
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
m_pXmlWriter->WriteNodeBegin( L"w:abstractNumId", TRUE );
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::IntToWideString( rglst->listNumbering[i]->id ));
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::SizeTToWideString( rglst->listNumbering[i]->id ));
m_pXmlWriter->WriteNodeEnd( L"", TRUE );
m_pXmlWriter->WriteNodeEnd(L"w:num");
@ -285,7 +285,7 @@ namespace DocFileFormat
newResult = find_if((result + 1), lvl->xst.end(), &NumberingMapping::IsPlaceholder);
ret += L"%";
ret += FormatUtils::IntToWideString(*result + 1);
ret += FormatUtils::SizeTToWideString(*result + 1);
ret += std::wstring((result + 1), newResult);
result = newResult;
}

View File

@ -89,7 +89,7 @@ namespace DocFileFormat
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
if (group)
{
group->Index = i;
group->Index = (int)i;
}
}
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)

View File

@ -1,80 +0,0 @@
/*
* (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
namespace DocFileFormat
{
// 2.3.7.43 Fill Style Boolean Properties - [MS-ODRAW] — v20130726
class FillStyleBooleanProperties
{
public:
FillStyleBooleanProperties(unsigned int op)
{
fNoFillHitTest = FormatUtils::BitmaskToBool(op, 0x1);
fillUseRect = FormatUtils::BitmaskToBool(op, 0x1 << 1);
fillShape = FormatUtils::BitmaskToBool(op, 0x1 << 2);
fHitTestFill = FormatUtils::BitmaskToBool(op, 0x1 << 3);
fFilled = FormatUtils::BitmaskToBool(op, 0x1 << 4);
fUseShapeAnchor = FormatUtils::BitmaskToBool(op, 0x1 << 5);
fRecolorFillAsPicture = FormatUtils::BitmaskToBool(op, 0x1 << 6);
// 0x1 << 7-15 is ununsed
fUsefNoFillHitTest = FormatUtils::BitmaskToBool(op, 0x1 << 16);
fUsefillUseRect = FormatUtils::BitmaskToBool(op, 0x1 << 17);
fUsefillShape = FormatUtils::BitmaskToBool(op, 0x1 << 18);
fUseHitTestFill = FormatUtils::BitmaskToBool(op, 0x1 << 19);
fUsefFilled = FormatUtils::BitmaskToBool(op, 0x1 << 20);
fUsefUseShapeAnchor = FormatUtils::BitmaskToBool(op, 0x1 << 21);
fUsefRecolorFillAsPicture = FormatUtils::BitmaskToBool(op, 0x1 << 22);
}
public:
bool fNoFillHitTest;
bool fillUseRect;
bool fillShape;
bool fHitTestFill;
bool fFilled;
bool fUseShapeAnchor;
bool fRecolorFillAsPicture;
bool fUsefNoFillHitTest;
bool fUsefillUseRect;
bool fUsefillShape;
bool fUseHitTestFill;
bool fUsefFilled;
bool fUsefUseShapeAnchor;
bool fUsefRecolorFillAsPicture;
};
}

View File

@ -1,114 +0,0 @@
/*
* (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
namespace DocFileFormat
{
// 2.3.6.31 Geometry Boolean Properties - [MS-ODRAW] — v20130726
class GeometryTextBooleanProperties
{
public:
GeometryTextBooleanProperties(unsigned int op)
{
gtextFStrikethrough = FormatUtils::BitmaskToBool(op, 0x1);
gtextFSmallcaps = FormatUtils::BitmaskToBool(op, 0x1 << 1);
gtextFShadow = FormatUtils::BitmaskToBool(op, 0x1 << 2);
gtextFUnderline = FormatUtils::BitmaskToBool(op, 0x1 << 3);
gtextFItalic = FormatUtils::BitmaskToBool(op, 0x1 << 4);
gtextFBold = FormatUtils::BitmaskToBool(op, 0x1 << 5);
gtextFDxMeasure = FormatUtils::BitmaskToBool(op, 0x1 << 6);
gtextFNormalize = FormatUtils::BitmaskToBool(op, 0x1 << 7);
gtextFBestFit = FormatUtils::BitmaskToBool(op, 0x1 << 8);
gtextFShrinkFit = FormatUtils::BitmaskToBool(op, 0x1 << 9);
gtextFStretch = FormatUtils::BitmaskToBool(op, 0x1 << 10);
gtextFTight = FormatUtils::BitmaskToBool(op, 0x1 << 11);
gtextFKern = FormatUtils::BitmaskToBool(op, 0x1 << 12);
gtextFVertical = FormatUtils::BitmaskToBool(op, 0x1 << 13);
fGtext = FormatUtils::BitmaskToBool(op, 0x1 << 14);
gtextFReverseRows = FormatUtils::BitmaskToBool(op, 0x1 << 15);
fUsegtextFSStrikeThrough = FormatUtils::BitmaskToBool(op, 0x1 << 16);
fUsegtextFSmallcaps = FormatUtils::BitmaskToBool(op, 0x1 << 17);
fUsegtextFShadow = FormatUtils::BitmaskToBool(op, 0x1 << 18);
fUsegtextFUnderline = FormatUtils::BitmaskToBool(op, 0x1 << 19);
fUsegtextFItalic = FormatUtils::BitmaskToBool(op, 0x1 << 20);
fUsegtextFBold = FormatUtils::BitmaskToBool(op, 0x1 << 21);
fUsegtextFDxMeasure = FormatUtils::BitmaskToBool(op, 0x1 << 22);
fUsegtextFNormalize = FormatUtils::BitmaskToBool(op, 0x1 << 23);
fUsegtextFBestFit = FormatUtils::BitmaskToBool(op, 0x1 << 24);
fUsegtextFShrinkFit = FormatUtils::BitmaskToBool(op, 0x1 << 25);
fUsegtextFStretch = FormatUtils::BitmaskToBool(op, 0x1 << 26);
fUsegtextFTight = FormatUtils::BitmaskToBool(op, 0x1 << 27);
fUsegtextFKern = FormatUtils::BitmaskToBool(op, 0x1 << 28);
fUsegtextFVertical = FormatUtils::BitmaskToBool(op, 0x1 << 29);
fUsefGtext = FormatUtils::BitmaskToBool(op, 0x1 << 30);
fUsegtextFReverseRows = FormatUtils::BitmaskToBool(op, 0x40000000);
}
public:
bool gtextFStrikethrough;
bool gtextFSmallcaps;
bool gtextFShadow;
bool gtextFUnderline;
bool gtextFItalic;
bool gtextFBold;
bool gtextFDxMeasure;
bool gtextFNormalize;
bool gtextFBestFit;
bool gtextFShrinkFit;
bool gtextFStretch;
bool gtextFTight;
bool gtextFKern;
bool gtextFVertical;
bool fGtext;
bool gtextFReverseRows;
bool fUsegtextFSStrikeThrough;
bool fUsegtextFSmallcaps;
bool fUsegtextFShadow;
bool fUsegtextFUnderline;
bool fUsegtextFItalic;
bool fUsegtextFBold;
bool fUsegtextFDxMeasure;
bool fUsegtextFNormalize;
bool fUsegtextFBestFit;
bool fUsegtextFShrinkFit;
bool fUsegtextFStretch;
bool fUsegtextFTight;
bool fUsegtextFKern;
bool fUsegtextFVertical;
bool fUsefGtext;
bool fUsegtextFReverseRows;
};
}

View File

@ -1,126 +0,0 @@
/*
* (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
namespace DocFileFormat
{
// 2.3.4.44 Group Shape Boolean Properties - [MS-ODRAW] — v20130726
class GroupShapeBooleanProperties
{
public:
GroupShapeBooleanProperties(unsigned int op)
{
fPrint = FormatUtils::BitmaskToBool(op, 0x1);
fHidden = FormatUtils::BitmaskToBool(op, 0x2);
fOneD = FormatUtils::BitmaskToBool(op, 0x4);
fIsButton = FormatUtils::BitmaskToBool(op, 0x8);
fOnDblClickNotify = FormatUtils::BitmaskToBool(op, 0x10);
fBehindDocument = FormatUtils::BitmaskToBool(op, 0x20);
fEditedWrap = FormatUtils::BitmaskToBool(op, 0x40);
fScriptAnchor = FormatUtils::BitmaskToBool(op, 0x80);
fReallyHidden = FormatUtils::BitmaskToBool(op, 0x100);
fAllowOverlap = FormatUtils::BitmaskToBool(op, 0x200);
fUserDrawn = FormatUtils::BitmaskToBool(op, 0x400);
fHorizRule = FormatUtils::BitmaskToBool(op, 0x800);
fNoshadeHR = FormatUtils::BitmaskToBool(op, 0x1000);
fStandardHR = FormatUtils::BitmaskToBool(op, 0x2000);
fIsBullet = FormatUtils::BitmaskToBool(op, 0x4000);
fLayoutInCell = FormatUtils::BitmaskToBool(op, 0x8000);
fUsefPrint = FormatUtils::BitmaskToBool(op, 0x10000);
fUsefHidden = FormatUtils::BitmaskToBool(op, 0x20000);
fUsefOneD = FormatUtils::BitmaskToBool(op, 0x40000);
fUsefIsButton = FormatUtils::BitmaskToBool(op, 0x80000);
fUsefOnDblClickNotify = FormatUtils::BitmaskToBool(op, 0x100000);
fUsefBehindDocument = FormatUtils::BitmaskToBool(op, 0x200000);
fUsefEditedWrap = FormatUtils::BitmaskToBool(op, 0x400000);
fUsefScriptAnchor = FormatUtils::BitmaskToBool(op, 0x800000);
fUsefReallyHidden = FormatUtils::BitmaskToBool(op, 0x1000000);
fUsefAllowOverlap = FormatUtils::BitmaskToBool(op, 0x2000000);
fUsefUserDrawn = FormatUtils::BitmaskToBool(op, 0x4000000);
fUsefHorizRule = FormatUtils::BitmaskToBool(op, 0x8000000);
fUsefNoshadeHR = FormatUtils::BitmaskToBool(op, 0x10000000);
fUsefStandardHR = FormatUtils::BitmaskToBool(op, 0x20000000);
fUsefIsBullet = FormatUtils::BitmaskToBool(op, 0x40000000);
fUsefLayoutInCell = FormatUtils::BitmaskToBool(op, 0x80000000);
}
public:
bool fPrint;
bool fHidden;
bool fOneD;
bool fIsButton;
bool fOnDblClickNotify;
bool fBehindDocument;
bool fEditedWrap;
bool fScriptAnchor;
bool fReallyHidden;
bool fAllowOverlap;
bool fUserDrawn;
bool fHorizRule;
bool fNoshadeHR;
bool fStandardHR;
bool fIsBullet;
bool fLayoutInCell;
bool fUsefPrint;
bool fUsefHidden;
bool fUsefOneD;
bool fUsefIsButton;
bool fUsefOnDblClickNotify;
bool fUsefBehindDocument;
bool fUsefEditedWrap;
bool fUsefScriptAnchor;
bool fUsefReallyHidden;
bool fUsefAllowOverlap;
bool fUsefUserDrawn;
bool fUsefHorizRule;
bool fUsefNoshadeHR;
bool fUsefStandardHR;
bool fUsefIsBullet;
bool fUsefLayoutInCell;
};
}

View File

@ -1,91 +0,0 @@
/*
* (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
namespace DocFileFormat
{
// 2.3.8.38 Line Style Boolean Properties - [MS-ODRAW] — v20130726
class LineStyleBooleanProperties
{
public:
LineStyleBooleanProperties(unsigned int op)
{
fNoLineDrawDash = FormatUtils::BitmaskToBool(op, 0x1);
fLineFillShape = FormatUtils::BitmaskToBool(op, 0x2);
fHitTestLine = FormatUtils::BitmaskToBool(op, 0x4);
fLine = FormatUtils::BitmaskToBool(op, 0x8);
fArrowheadsOK = FormatUtils::BitmaskToBool(op, 0x10);
fInsetPenOK = FormatUtils::BitmaskToBool(op, 0x20);
fInsetPen = FormatUtils::BitmaskToBool(op, 0x40);
//Reserved 0x80 0x100
fLineOpaqueBackColor = FormatUtils::BitmaskToBool(op, 0x200);
//Unused 0x400 0x800 0x1000 0x2000 0x4000 0x8000
fUsefNoLineDrawDash = FormatUtils::BitmaskToBool(op, 0x10000);
fUsefLineFillShape = FormatUtils::BitmaskToBool(op, 0x20000);
fUsefHitTestLine = FormatUtils::BitmaskToBool(op, 0x40000);
fUsefLine = FormatUtils::BitmaskToBool(op, 0x80000);
fUsefArrowheadsOK = FormatUtils::BitmaskToBool(op, 0x100000);
fUsefInsetPenOK = FormatUtils::BitmaskToBool(op, 0x200000);
fUsefInsetPen = FormatUtils::BitmaskToBool(op, 0x400000);
//Reserved 0x800000 0x1000000
fUsefLineOpaqueBackColor = FormatUtils::BitmaskToBool(op, 0x2000000);
}
public:
bool fNoLineDrawDash;
bool fLineFillShape;
bool fHitTestLine;
bool fLine;
bool fArrowheadsOK;
bool fInsetPenOK;
bool fInsetPen;
bool fLineOpaqueBackColor;
bool fUsefNoLineDrawDash;
bool fUsefLineFillShape;
bool fUsefHitTestLine;
bool fUsefLine;
bool fUsefArrowheadsOK;
bool fUsefInsetPenOK;
bool fUsefInsetPen;
bool fUsefLineOpaqueBackColor;
};
}

View File

@ -1,280 +0,0 @@
/*
* (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 "PathSegment.h"
namespace DocFileFormat
{
struct _guides
{
unsigned char type;
unsigned char param_type1;
unsigned char param_type2;
unsigned char param_type3;
WORD param1;
WORD param2;
WORD param3;
};
class PathParser
{
public:
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
{
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
{
unsigned short nElems = FormatUtils::BytesToUInt16(pSegmentInfo, 0, pSegmentInfoSize);
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize);
unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, pSegmentInfoSize);
unsigned short cbElement = 4;
int offset = 6;
if (cb == 0xfff0)
cbElement = 2;
if (nElems == 0)
{
nElems = (pSegmentInfoSize - offset) / cbElement;
}
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cbElement), pSegmentInfoSize - offset));
m_arSegments.push_back (oSegment);
}
if ((long)pSegmentInfoSize < (long)(cb * nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
}
if ((NULL != pVertices) && (pVerticesSize > 0))
{
unsigned short nElems = FormatUtils::BytesToUInt16(pVertices, 0, pVerticesSize);
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
unsigned short cbElement = 4;
if (cb == 0xfff0)
cbElement = 2;
int offset = 6;
for (unsigned short i = 0; i < nElems; ++i)
{
POINT point;
if (cbElement == 4)
{
point.x = FormatUtils::BytesToInt32(pVertices + offset, 0, pVerticesSize - offset);
point.y = FormatUtils::BytesToInt32(pVertices + offset + cbElement, 0 , pVerticesSize - offset);
}
else
{
point.x = FormatUtils::BytesToInt16(pVertices + offset, 0, pVerticesSize - offset);
point.y = FormatUtils::BytesToInt16(pVertices + offset + cbElement, 0 , pVerticesSize - offset);
}
offset += cbElement * 2;
LONG lMinF = (LONG)0x80000000;
if (lMinF <= point.x)
{
int index = (DWORD)point.x - 0x80000000;
if (index >= 0 && index < (int)guides.size())
{
point.x = guides[index].param3;
}
}
if (lMinF <= point.y)
{
int index = (DWORD)point.y - 0x80000000;
if (index >= 0 && index < (int)guides.size())
{
point.y = guides[index].param3;
}
}
if ((size_t)point.y > 0xffff)
{
point.y &= 0xffff;
}
if ((size_t)point.x > 0xffff)
{
point.x &= 0xffff;
}
m_arPoints.push_back(point);
}
}
}
inline std::wstring GetVmlPath () const
{
if ((0 == m_arSegments.size()) && (0 == m_arPoints.size()))
return std::wstring(L"");
std::wstring strVmlPath;
int valuePointer = 0;
if (0 == m_arSegments.size())
{
for (size_t i = 0; i < m_arPoints.size(); ++i)
{
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[i].x);
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[i].y);
++valuePointer;
}
strVmlPath += L"xe";
return strVmlPath;
}
int cc = 0;
std::vector<PathSegment>::const_iterator end = m_arSegments.end();
for (std::vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != end; ++iter, cc++)
{
switch (iter->Type)
{
case PathSegment::msopathLineTo:
{
for (int i = 0; i < iter->Count; ++i)
{
if (valuePointer + 1 > (int)m_arPoints.size())
{
break;
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
++valuePointer;
//break;
}
else
{
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
++valuePointer;
}
}
}
break;
case PathSegment::msopathCurveTo:
{
for (int i = 0; i < iter->Count; ++i)
{
if (valuePointer + 3 > (int)m_arPoints.size())
break;
strVmlPath += L"c";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
}
}
break;
case PathSegment::msopathMoveTo:
{
if (valuePointer < (int)m_arPoints.size())
{
strVmlPath += L"m";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
++valuePointer;
}
}
break;
case PathSegment::msopathClose:
{
strVmlPath += L"x";
}
break;
case PathSegment::msopathEnd:
{
strVmlPath += L"e";
}
break;
case PathSegment::msopathEscape:
{
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
strVmlPath += L"nf";
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
strVmlPath += L"ns";
}
case PathSegment::msopathClientEscape:
case PathSegment::msopathInvalid:
{
//ignore escape segments and invalid segments
}
break;
}
}
// end the path
if ( !strVmlPath.empty() && ( strVmlPath[strVmlPath.size() - 1] != L'e' ) )
strVmlPath +=L"e";
return strVmlPath;
}
private:
std::vector<POINT> m_arPoints;
std::vector<PathSegment> m_arSegments;
};
}

View File

@ -1,101 +0,0 @@
/*
* (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
namespace DocFileFormat
{
class PathSegment
{
public:
enum MSOPATHTYPE
{
msopathLineTo,
msopathCurveTo,
msopathMoveTo,
msopathClose,
msopathEnd,
msopathEscape,
msopathClientEscape,
msopathInvalid
};
enum MSOPATHESCAPE
{
msopathEscapeExtension = 0x00000000,
msopathEscapeAngleEllipseTo = 0x00000001,
msopathEscapeAngleEllipse = 0x00000002,
msopathEscapeArcTo = 0x00000003,
msopathEscapeArc = 0x00000004,
msopathEscapeClockwiseArcTo = 0x00000005,
msopathEscapeClockwiseArc = 0x00000006,
msopathEscapeEllipticalQuadrantX = 0x00000007,
msopathEscapeEllipticalQuadrantY = 0x00000008,
msopathEscapeQuadraticBezier = 0x00000009,
msopathEscapeNoFill = 0x0000000A,
msopathEscapeNoLine = 0x0000000B,
msopathEscapeAutoLine = 0x0000000C,
msopathEscapeAutoCurve = 0x0000000D,
msopathEscapeCornerLine = 0x0000000E,
msopathEscapeCornerCurve = 0x0000000F,
msopathEscapeSmoothLine = 0x00000010,
msopathEscapeSmoothCurve = 0x00000011,
msopathEscapeSymmetricLine = 0x00000012,
msopathEscapeSymmetricCurve = 0x00000013,
msopathEscapeFreeform = 0x00000014,
msopathEscapeFillColor = 0x00000015,
msopathEscapeLineColor = 0x00000016
};
PathSegment (unsigned short segment): Type(msopathInvalid), Count(0), EscapeCode(msopathEscapeExtension), VertexCount(0)
{
Type = (MSOPATHTYPE)FormatUtils::BitmaskToInt (segment, 0xE000);
if (msopathEscape == Type)
{
EscapeCode = (MSOPATHESCAPE)FormatUtils::BitmaskToInt (segment, 0x1F00);
VertexCount = FormatUtils::BitmaskToInt (segment, 0x00FF);
}
else
{
Count = FormatUtils::BitmaskToInt (segment, 0x1FFF);
}
}
public:
MSOPATHTYPE Type;
int Count;
int VertexCount;
MSOPATHESCAPE EscapeCode;
};
}

View File

@ -1,97 +0,0 @@
/*
* (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 "../../Common/FormatUtils.h"
namespace DocFileFormat
{
// 2.3.20.1 Protection Boolean Properties - [MS-ODRAW] — v20130726
class ProtectionBooleanProperties
{
public:
ProtectionBooleanProperties(unsigned int op)
{
fLockAgainstGrouping = FormatUtils::BitmaskToBool(op,0x1);
fLockAdjustHandles = FormatUtils::BitmaskToBool(op,0x2);
fLockText = FormatUtils::BitmaskToBool(op,0x4);
fLockVertices = FormatUtils::BitmaskToBool(op,0x8);
fLockCropping = FormatUtils::BitmaskToBool(op,0x10);
fLockAgainstSelect = FormatUtils::BitmaskToBool(op,0x20);
fLockPosition = FormatUtils::BitmaskToBool(op,0x30);
fLockAspectRatio = FormatUtils::BitmaskToBool(op,0x40);
fLockRotation = FormatUtils::BitmaskToBool(op,0x100);
fLockAgainstUngrouping = FormatUtils::BitmaskToBool(op,0x200);
//unused 0x400 0x800 0x1000 0x2000 0x4000 0x8000
fUsefLockAgainstGrouping = FormatUtils::BitmaskToBool(op,0x10000);
fUsefLockAdjustHandles = FormatUtils::BitmaskToBool(op,0x20000);
fUsefLockText = FormatUtils::BitmaskToBool(op,0x40000);
fUsefLockVertices = FormatUtils::BitmaskToBool(op,0x80000);
fUsefLockCropping = FormatUtils::BitmaskToBool(op,0x100000);
fUsefLockAgainstSelect = FormatUtils::BitmaskToBool(op,0x200000);
fUsefLockPosition = FormatUtils::BitmaskToBool(op,0x400000);
fUsefLockAspectRatio = FormatUtils::BitmaskToBool(op,0x800000);
fUsefLockRotation = FormatUtils::BitmaskToBool(op,0x1000000);
fUsefLockAgainstUngrouping = FormatUtils::BitmaskToBool(op,0x2000000);
}
bool fLockAgainstGrouping;
bool fLockAdjustHandles;
bool fLockText;
bool fLockVertices;
bool fLockCropping;
bool fLockAgainstSelect;
bool fLockPosition;
bool fLockAspectRatio;
bool fLockRotation;
bool fLockAgainstUngrouping;
bool fUsefLockAgainstGrouping;
bool fUsefLockAdjustHandles;
bool fUsefLockText;
bool fUsefLockVertices;
bool fUsefLockCropping;
bool fUsefLockAgainstSelect;
bool fUsefLockPosition;
bool fUsefLockAspectRatio;
bool fUsefLockRotation;
bool fUsefLockAgainstUngrouping;
};
}

View File

@ -75,9 +75,9 @@ namespace DocFileFormat
}
else
{
for ( std::vector<Record*>::const_iterator iter1 = this->Children.begin(); iter1 != this->Children.end(); iter1++ )
for ( size_t j = 0; j < this->Children.size(); ++j)
{
ShapeOptions* sh_options = dynamic_cast<ShapeOptions*>( *iter1 );
ShapeOptions* sh_options = dynamic_cast<ShapeOptions*>( this->Children[j] );
if (sh_options)
{
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
@ -101,16 +101,17 @@ namespace DocFileFormat
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
}
OptionEntryPtr ExtractOption(const PropertyId & prop) const
ODRAW::OfficeArtFOPTEPtr ExtractOption(const PropertyId & prop) const
{
OptionEntryPtr ret;
ODRAW::OfficeArtFOPTEPtr ret;
for ( size_t i = 0; i < this->Children.size(); ++i )
{
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( this->Children[i] );
if ( opt == NULL ) continue;
std::map<PropertyId, OptionEntryPtr>::iterator pFind = opt->OptionsByID.find(prop);
std::map<PropertyId, ODRAW::OfficeArtFOPTEPtr>::iterator pFind = opt->OptionsByID.find(prop);
if (pFind != opt->OptionsByID.end())
{
ret = pFind->second;
@ -119,9 +120,9 @@ namespace DocFileFormat
return ret;
}
std::vector<OptionEntryPtr> ExtractOptions() const
std::vector<ODRAW::OfficeArtFOPTEPtr> ExtractOptions() const
{
std::vector<OptionEntryPtr> ret;
std::vector<ODRAW::OfficeArtFOPTEPtr> ret;
//build the list of all option entries of this shape
for ( size_t i = 0; i < this->Children.size(); ++i )

View File

@ -32,6 +32,7 @@
#pragma once
#include "Record.h"
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtRGFOPTE.h"
namespace DocFileFormat
{
@ -526,21 +527,6 @@ namespace DocFileFormat
LineDashing_LongDashDotDotGEL
} LineDashing;
struct OptionEntry
{
OptionEntry() : pid(PropertyId_left), fBid(false), fComplex(false), op(0)
{
}
PropertyId pid;
bool fBid;
bool fComplex;
unsigned int op;
std::shared_ptr<unsigned char> opComplex;
};
typedef std::shared_ptr<OptionEntry> OptionEntryPtr;
class ShapeOptions: public Record
{
public:
@ -548,9 +534,9 @@ namespace DocFileFormat
static const unsigned short TYPE_CODE_0xF121 = 0xF121;
static const unsigned short TYPE_CODE_0xF122 = 0xF122;
std::vector<OptionEntryPtr> Options;
std::map<PropertyId, OptionEntryPtr> OptionsByID;
std::vector<ODRAW::OfficeArtFOPTEPtr> Options;
std::map<PropertyId, ODRAW::OfficeArtFOPTEPtr> OptionsByID;
ShapeOptions() : Record()
{
}
@ -563,41 +549,24 @@ namespace DocFileFormat
{
long pos = Reader->GetPosition();
//parse the flags and the simple values
// parse the flags and the simple values
for (unsigned int i = 0; i < instance; ++i)
{
OptionEntryPtr entry = std::shared_ptr<OptionEntry>(new OptionEntry());
unsigned short flag = Reader->ReadUInt16();
ODRAW::OfficeArtFOPTEPtr fopte = ODRAW::OfficeArtFOPTE::load_and_create(Reader);
if (!fopte)continue;
entry->pid = (PropertyId)FormatUtils::BitmaskToInt (flag, 0x3FFF);
entry->fBid = FormatUtils::BitmaskToBool (flag, 0x4000);
entry->fComplex = FormatUtils::BitmaskToBool (flag, 0x8000);
entry->op = Reader->ReadUInt32();
Options.push_back( entry );
Options.push_back(fopte);
}
// complex load
//parse the complex values & sorted by pid
for (unsigned int i = 0; i < instance; ++i)
for(size_t i = 0; i < Options.size(); ++i)
{
if (Options[i]->fComplex && Options[i]->op > 0)
{
unsigned int size = Options[i]->op;
if (Options[i]->pid == 0x0145 ||
Options[i]->pid == 0x0146 ||
Options[i]->pid == 0x0197 ||
Options[i]->pid == 0x0156 ||
Options[i]->pid == 0x0155 ||
Options[i]->pid == 0x0151 ||
Options[i]->pid == 0x0152 ||
Options[i]->pid == 0x0157 ||
Options[i]->pid == 0x0158)//mso arrays
size += 6;
Options[i]->opComplex = std::shared_ptr<unsigned char>(Reader->ReadBytes( size, true ));
if(Options[i]->fComplex && Options[i]->op > 0)
{
Options[i]->ReadComplexData(Reader);
}
OptionsByID.insert(std::make_pair(Options[i]->pid, Options[i]));
OptionsByID.insert(std::make_pair((PropertyId)Options[i]->opid, Options[i]));
}
Reader->Seek(( pos + size ), 0/*STREAM_SEEK_SET*/);

View File

@ -31,13 +31,15 @@
*/
#pragma once
#include "ProtectionBooleanProperties.h"
#include "../IVisitable.h"
#include "../../Common/XmlTools.h"
#include <boost/shared_ptr.hpp>
#include <list>
namespace ODRAW
{
class OfficeArtFOPTE;
typedef boost::shared_ptr<OfficeArtFOPTE> OfficeArtFOPTEPtr;
}
namespace DocFileFormat
{
enum MSOSPT
@ -274,9 +276,6 @@ namespace DocFileFormat
position = pos;
xrange = xRange;
}
public:
std::wstring position;
std::wstring xrange;
std::wstring switchHandle;
@ -289,7 +288,7 @@ namespace DocFileFormat
{
public:
ShapeType (unsigned int typeCode) : Filled(true), Stroked(true), Lock(0), TypeCode(typeCode), Joins(miter), ShapeConcentricFill(false)
ShapeType (unsigned int typeCode) : Filled(true), Stroked(true), TypeCode(typeCode), Joins(miter), ShapeConcentricFill(false)
{
}
@ -301,8 +300,7 @@ namespace DocFileFormat
{
return TypeCode;
}
public:
/// This string describes a sequence of commands that define the shapes path.
/// This string describes both the pSegmentInfo array and pVertices array in the shapes geometry properties.
std::wstring Path;
@ -344,7 +342,7 @@ namespace DocFileFormat
bool Stroked;
/// Speicfies the locked properties of teh shape.
/// By default nothing is locked.
ProtectionBooleanProperties Lock;
ODRAW::OfficeArtFOPTEPtr Lock;
///
std::wstring Textpath;

View File

@ -60,9 +60,9 @@ namespace DocFileFormat
this->Filled = false;
this->Stroked = false;
//pictures have a lock on the aspect ratio by default
this->Lock.fUsefLockAspectRatio = true;
this->Lock.fLockAspectRatio = true;
// //pictures have a lock on the aspect ratio by default
//this->Lock.fUsefLockAspectRatio = true;
// this->Lock.fLockAspectRatio = true;
}
void SetType(unsigned int nType)
{

View File

@ -85,19 +85,19 @@ namespace DocFileFormat
struct ImageFileStructure
{
ImageFileStructure()
ImageFileStructure(const std::wstring& _ext, boost::shared_array<unsigned char> _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), size(_size), blipType(_blipType)
{
}
ImageFileStructure(const std::wstring& _ext, const std::vector<unsigned char>& _data, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), data(_data), blipType(_blipType)
ImageFileStructure(const std::wstring& _ext, unsigned char* _data, unsigned int _size, Global::BlipType _blipType = Global::msoblipUNKNOWN) : ext(_ext), size(_size), blipType(_blipType)
{
data = boost::shared_array<unsigned char>(new unsigned char[size]);
memcpy(data.get(), _data, size);
}
std::wstring ext;
std::vector<unsigned char> data;
Global::BlipType blipType;
std::wstring ext;
boost::shared_array<unsigned char> data;
unsigned int size;
Global::BlipType blipType;
};
struct OleObjectFileStructure

View File

@ -33,6 +33,8 @@
#include "PictureDescriptor.h"
#include "OfficeDrawing/MetafilePictBlip.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#ifndef MM_ISOTROPIC
#define MM_ISOTROPIC 7
#endif
@ -41,6 +43,111 @@
#define MM_ANISOTROPIC 8
#endif
namespace ImageHelper
{
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
{
Global::_BlipType result = Global::msoblipERROR;
CBgraFrame oFrame;
int offset = 0, biSizeImage = 0;
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
if (!header) return result;
result = Global::msoblipDIB;
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
{
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
if (header_core->bcSize != 12)
{
result = Global::msoblipWMF;
}
else
{
offset = 12; //sizeof(BITMAPCOREHEADER)
oFrame.put_Height (header_core->bcHeight );
oFrame.put_Width (header_core->bcWidth );
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
// header_core->bcWidth++;
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
int stride = -(size - offset) / header_core->bcHeight;
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
biSizeImage = size - offset;
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
{
result = Global::msoblipPNG;
}
}
}
else
{
offset = 40; //sizeof(BITMAPINFOHEADER)
oFrame.put_Height (header->biHeight );
oFrame.put_Width (header->biWidth );
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
// header->biWidth++;
int stride = -(size - offset) / header->biHeight;
if (-stride >= header->biWidth && header->biBitCount >= 24)
{
result = Global::msoblipPNG;
}
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
}
//------------------------------------------------------------------------------------------
if (result == Global::msoblipPNG)
{
oFrame.put_Data((unsigned char*)data + offset);
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
result = Global::msoblipERROR;
oFrame.put_Data(NULL);
}
else if (result == Global::msoblipWMF)
{
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + L".wmf"))
{
file.WriteFile((BYTE*)data, size);
file.CloseFile();
}
}
else if (biSizeImage > 0)
{
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + L".bmp"))
{
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
file.WriteFile((BYTE*)data, size);
file.CloseFile();
}
}
return result;
}
}
namespace DocFileFormat
{
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset

View File

@ -134,3 +134,34 @@ namespace DocFileFormat
int embeddedDataSize;
};
}
namespace ImageHelper
{
struct __BITMAPINFOHEADER
{
_UINT32 biSize;
_INT32 biWidth;
_INT32 biHeight;
_UINT16 biPlanes;
_UINT16 biBitCount;
_UINT32 biCompression;
_UINT32 biSizeImage;
_INT32 biXPelsPerMeter;
_INT32 biYPelsPerMeter;
_UINT32 biClrUsed;
_UINT32 biClrImportant;
};
struct __BITMAPCOREHEADER
{
_UINT32 bcSize; /* used to get to color table */
_UINT16 bcWidth;
_UINT16 bcHeight;
_UINT16 bcPlanes;
_UINT16 bcBitCount;
};
Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name);
}

View File

@ -67,7 +67,7 @@ namespace DocFileFormat
XMLTools::XMLAttribute layoutType ( L"w:type", L"fixed");
bool bLayoutFixed = true;
short tblIndent = 0;
_CP_OPT(short) tblIndent;
short gabHalf = 0;
short marginLeft = 0;
short marginRight = 0;
@ -98,8 +98,7 @@ namespace DocFileFormat
//For this cases we can calculate the indent of the table by getting the
//first boundary of the TDef and adding the padding of the cells
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
tblIndent += gabHalf;
tblIndent = gabHalf + FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
//If there follows a real sprmTWidthIndent, this value will be overwritten
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
@ -404,11 +403,11 @@ namespace DocFileFormat
}
//indent
if ( tblIndent != 0 )
if ( tblIndent )
{
XMLTools::XMLElement tblInd( L"w:tblInd");
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( tblIndent ) );
XMLTools::XMLAttribute tblIndW( L"w:w", FormatUtils::IntToWideString( *tblIndent ) );
tblInd.AppendAttribute( tblIndW );
XMLTools::XMLAttribute tblIndType( L"w:type", L"dxa");

View File

@ -33,9 +33,6 @@
#include "VMLPictureMapping.h"
#include "VMLShapeMapping.h"
#include "OfficeDrawing/GeometryBooleanProperties.h"
#include "OfficeDrawing/GeometryTextBooleanProperties.h"
#include "OfficeDrawing/GroupShapeBooleanProperties.h"
#include "OfficeDrawing/MetafilePictBlip.h"
#include "../../DesktopEditor/common/StringExt.h"
@ -44,30 +41,10 @@
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h"
using namespace DocFileFormat;
typedef struct
{
DWORD iType; // Record type EMR_HEADER
DWORD nSize; // Record size in bytes. This may be greater
// than the sizeof(ENHMETAHEADER).
RECT rclBounds; // Inclusive-inclusive bounds in device units
RECT rclFrame; // Inclusive-inclusive Picture Frame .01mm unit
DWORD dSignature; // Signature. Must be ENHMETA_SIGNATURE.
DWORD nVersion; // Version number
DWORD nBytes; // Size of the metafile in bytes
DWORD nRecords; // Number of records in the metafile
WORD nHandles; // Number of handles in the handle table
// Handle index zero is reserved.
WORD sReserved; // Reserved. Must be zero.
DWORD nDescription; // Number of chars in the unicode desc string
// This is 0 if there is no description string
DWORD offDescription; // Offset to the metafile description record.
// This is 0 if there is no description string
DWORD nPalEntries; // Number of entries in the metafile palette.
SIZE szlDevice; // Size of the reference device in pels
SIZE szlMillimeters; // Size of the reference device in millimeters
} ENHMETAHEADER3;
namespace DocFileFormat
{
@ -243,15 +220,12 @@ namespace DocFileFormat
return res;
}
//---------------------------------------------------------------
void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
void VMLPictureMapping::appendStyleProperty(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
{
if ( b != NULL )
{
b->operator += ( propName );
b->operator += ( L":" );
b->operator += ( propValue );
b->operator +=( L";" );
}
style += ( propName );
style += ( L":" );
style += ( propValue );
style +=( L";" );
}
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
@ -302,7 +276,7 @@ namespace DocFileFormat
std::wstring strHeight = FormatUtils::DoubleToWideString( height.ToPoints() );
std::wstring strStyle;
std::vector<OptionEntryPtr> options;
std::vector<ODRAW::OfficeArtFOPTEPtr> options;
PictureFrameType type;
Shape* pShape = NULL;
@ -318,6 +292,7 @@ namespace DocFileFormat
type.Convert( vmlShapeTypeMapping );
RELEASEOBJECT( vmlShapeTypeMapping );
}
else if (pict->embeddedData)
{
@ -342,33 +317,37 @@ namespace DocFileFormat
for (size_t i = 0; i < options.size(); i++)
{
OptionEntryPtr & iter = options[i];
switch ( iter->pid )
ODRAW::OfficeArtFOPTEPtr & iter = options[i];
switch ( iter->opid )
{
case wzEquationXML:
{
m_isEquation = true;
m_isEmbedded = true;
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
if (ParseEmbeddedEquation( m_embeddedData, m_equationXml))
ODRAW::XmlString *pXml = dynamic_cast<ODRAW::XmlString*>(iter.get());
if (pXml)
{
m_isEmbedded = false;
m_isEquation = true;
m_isEmbedded = true;
m_embeddedData = pXml->data;
if (ParseEmbeddedEquation( m_embeddedData, m_equationXml))
{
m_isEmbedded = false;
}
}
}break;
case metroBlob:
{
//встроенная неведомая хуйня
m_isBlob = true;
m_isEmbedded = true;
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
//{
// m_isEmbedded = false;
//}
{//встроенная неведомая хуйня
ODRAW::MetroBlob* blob = dynamic_cast<ODRAW::MetroBlob*>(iter.get());
if (blob)
{
m_isBlob = true;
m_isEmbedded = true;
//if (ParseEmbeddedBlob( blob->data.first, blob->data.second)) // todoooo
//{
// m_isEmbedded = false;
//}
}
}break;
//BORDERS
case borderBottomColor:
@ -439,41 +418,41 @@ namespace DocFileFormat
std::wstring v = strHeight;
strHeight = strWidth; strWidth = v;
appendStyleProperty(&strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
appendStyleProperty(strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
}break;
case posh:
{
appendStyleProperty(&strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
appendStyleProperty(strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
}break;
case posrelh:
{
appendStyleProperty(&strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
}break;
case posv:
{
appendStyleProperty(&strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
appendStyleProperty(strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
}break;
case posrelv:
{
appendStyleProperty(&strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
}break;
case groupShapeBooleans:
{
GroupShapeBooleanProperties groupShapeBooleans(iter->op);
ODRAW::GroupShapeBooleanProperties* booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties*>(iter.get());
if (groupShapeBooleans.fUsefBehindDocument && groupShapeBooleans.fBehindDocument)
if (booleans->fUsefBehindDocument && booleans->fBehindDocument)
{
//The shape is behind the text, so the z-index must be negative.
appendStyleProperty(&strStyle, L"z-index", L"-1" );
appendStyleProperty(strStyle, L"z-index", L"-1" );
}
//else if (!m_isInlinePicture)
//{
// appendStyleProperty( &strStyle, L"z-index", FormatUtils::IntToWideString(zIndex + 0x7ffff));
//}
if (groupShapeBooleans.fHidden && groupShapeBooleans.fUsefHidden)
if (booleans->fHidden && booleans->fUsefHidden)
{
appendStyleProperty(&strStyle, L"visibility", L"hidden");
appendStyleProperty(strStyle, L"visibility", L"hidden");
}
}break;
default:
@ -518,7 +497,8 @@ namespace DocFileFormat
appendValueAttribute(m_imageData, L"o:title", L"" );
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
}
else
m_isPictureBroken = true;
{//borders
writePictureBorder( L"bordertop", pict->brcTop );
@ -577,10 +557,10 @@ namespace DocFileFormat
pict->embeddedDataSize += lLenHeader;
delete []pict->embeddedData;
pict->embeddedData = newData;
}
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
pict->embeddedData, pict->embeddedDataSize, Global::msoblipDIB));
m_nImageId = m_context->_docx->RegisterImage(m_caller, btWin32);
result = true;
@ -597,26 +577,44 @@ namespace DocFileFormat
if (metaBlip)
{//decompress inside MetafilePictBlip
unsigned char *newData = NULL;
int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<unsigned char>(newData, (newData + newDataSize))));
RELEASEARRAYOBJECTS(newData);
}
}
break;
unsigned int newDataSize = metaBlip->oMetaFile.ToBuffer(newData);
boost::shared_array<unsigned char> arData(newData);
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), arData, newDataSize));
}
}break;
case Global::msoblipDIB:
{//user_manual_v52.doc
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
if (bitBlip)
{
std::wstring file_name = m_context->_doc->m_sTempFolder + L"tmp_image";
oBlipEntry->btWin32 = ImageHelper::SaveImageToFileFromDIB(bitBlip->m_pvBits, bitBlip->pvBitsSize, file_name);
if (oBlipEntry->btWin32 == Global::msoblipPNG)
{
unsigned char* pData = NULL;
DWORD nData = 0;
if (NSFile::CFileBinary::ReadAllBytes(file_name, &pData, nData))
{
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipPNG),
boost::shared_array<unsigned char>(pData), nData, Global::msoblipPNG));
break;
}
}
}
}//в случае ошибки конвертации -храним оригинальный dib
case Global::msoblipJPEG:
case Global::msoblipCMYKJPEG:
case Global::msoblipPNG:
case Global::msoblipTIFF:
case Global::msoblipDIB:
{
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
if (bitBlip)
{
m_context->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
bitBlip->m_pvBits, bitBlip->pvBitsSize, oBlipEntry->btWin32));
}
}break;

View File

@ -56,7 +56,7 @@ namespace DocFileFormat
private:
/// Writes a border element
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
void appendStyleProperty( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
bool ParseEmbeddedBlob(const std::string & xmlString, std::wstring & newXmlString);
std::wstring GetShapeID(const Shape* pShape) const;
@ -74,6 +74,7 @@ namespace DocFileFormat
bool m_isBullete;
bool m_isEquation;
bool m_isEmbedded;
bool m_isPictureBroken;
std::string m_embeddedData;
std::wstring m_equationXml;
std::wstring m_blobXml;

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,6 @@
#include "OfficeDrawing/ChildAnchor.h"
#include "OfficeDrawing/ClientAnchor.h"
#include "OfficeDrawing/Shapetypes/LineType.h"
#include "OfficeDrawing/PathParser.h"
#include "OfficeDrawing/MetafilePictBlip.h"
#include "OfficeDrawing/BitmapBlip.h"
@ -68,6 +67,7 @@ namespace DocFileFormat
static std::wstring mapHorizontalPositionRelative(int hRel );
bool m_isBullete;
bool m_isPictureBroken;
std::wstring m_shapeId;
private:
@ -80,18 +80,19 @@ namespace DocFileFormat
void WriteShape (const ShapeContainer* pContainer);
std::wstring GenShapeId(const Shape* pShape) const;
bool copyPicture( const BlipStoreEntry* bse );
bool copyPicture( BlipStoreEntry* bse );
std::wstring GetTargetExt( Global::BlipType _type ) const;
void AppendDimensionToStyle ( std::wstring* style, const PictureDescriptor* pict, bool twistDimensions ) const;
void AppendDimensionToStyle ( std::wstring* style, const Spa* pSpa, bool twistDimensions ) const;
void AppendDimensionToStyle ( std::wstring* style, const ChildAnchor* anchor, bool twistDimensions ) const;
void appendStyleProperty ( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
void AppendDimensionToStyle ( std::wstring& style, const PictureDescriptor* pict, bool twistDimensions ) const;
void AppendDimensionToStyle ( std::wstring& style, const Spa* pSpa, bool twistDimensions ) const;
void AppendDimensionToStyle ( std::wstring& style, const ChildAnchor* anchor, bool twistDimensions ) const;
void appendStyleProperty ( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
void appendStylePropertyFirst( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
std::wstring getTextboxAnchor( unsigned int anchor ) const;
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
void AppendOptionsToStyle ( std::wstring* style, const std::vector<OptionEntryPtr>& options, int zIndex ) const;
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
void AppendOptionsToStyle ( std::wstring& style, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
int UpdateFromGuides(const int val) const;
@ -100,7 +101,7 @@ namespace DocFileFormat
std::wstring getArrowLength ( unsigned int op ) const;
std::wstring getArrowWidth ( unsigned int op ) const;
std::wstring getFillMethod ( unsigned int p ) const;
std::wstring getFillColorString( const unsigned char* p, unsigned int size ) const;
std::wstring getFillColorString( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
std::wstring getFillType ( unsigned int p ) const;
std::wstring getShadowType ( unsigned int p ) const;
@ -114,16 +115,16 @@ namespace DocFileFormat
std::wstring GetLineFrom (const ChildAnchor* pAnchor) const;
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
std::wstring GetWrapCoords ( const OptionEntryPtr& pOpt ) const;
std::vector<std::wstring> GetTextRectangles ( const OptionEntryPtr& pOpt ) const;
std::wstring GetConnectAngles ( const OptionEntryPtr& pOpt ) const;
std::wstring GetConnectLocs ( const OptionEntryPtr& pOpt ) const;
void GetGuides ( const OptionEntryPtr& pOpt );
std::wstring GetWrapCoords ( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
std::vector<std::wstring> GetTextRectangles ( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
std::wstring GetConnectAngles ( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
std::wstring GetConnectLocs ( const ODRAW::OfficeArtFOPTEPtr& pOpt ) const;
void GetGuides ( const ODRAW::OfficeArtFOPTEPtr& pOpt );
int m_nAdjValues[8];
std::vector<_guides> m_arrGuides;
std::vector<ODRAW::MSOSG> m_arrGuides;
bool m_isInlineShape;
mutable bool m_isInlineShape;
Spa* m_pSpa;
IMapping* m_pCaller;
BlipStoreContainer* m_pBlipStore;

View File

@ -33,6 +33,7 @@
#include "VMLShapeTypeMapping.h"
#include "OfficeDrawing/Shapetypes/OvalType.h"
#include "OfficeDrawing/Shapetypes/WordArtText.h"
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPTE.h"
namespace DocFileFormat
{
@ -170,13 +171,18 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( L"", true );
//Lock
if ( ( pShape->Lock.fUsefLockAspectRatio ) && ( pShape->Lock.fLockAspectRatio ) )
//Lock ???
ODRAW::ProtectionBooleanProperties *prot = dynamic_cast<ODRAW::ProtectionBooleanProperties*>(pShape->Lock.get());
if ((prot) && (prot->fUsefLockAspectRatio))
{
appendValueAttribute( _lock, L"aspectratio", L"t" );
appendValueAttribute( _lock, L"aspectratio", prot->fLockAspectRatio ? L"t" : L"f" );
}
else
{
appendValueAttribute( _lock, L"aspectratio", L"t");
}
if ( _lock->GetAttributeCount() > 1 )
if ( _lock->GetAttributeCount() > 0 )
{
m_pXmlWriter->WriteString( _lock->GetXMLString() );
}

View File

@ -84,7 +84,7 @@ namespace DocFileFormat
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), AnnotationsFieldsPlex(NULL),
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
@ -353,7 +353,7 @@ namespace DocFileFormat
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed,FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion);
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion);
@ -387,10 +387,13 @@ namespace DocFileFormat
}
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion);
AnnotationsFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldAtn, FIB->m_FibWord97.lcbPlcfFldAtn, nWordVersion);
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
if (m_pCallFunc)
@ -872,6 +875,7 @@ namespace DocFileFormat
RELEASEOBJECT(FootnoteDocumentFieldsPlex);
RELEASEOBJECT(EndnoteDocumentFieldsPlex);
RELEASEOBJECT(HeadersAndFootersDocumentFieldsPlex);
RELEASEOBJECT(AnnotationsFieldsPlex);
RELEASEOBJECT(HeaderStoriesPlex);
RELEASEOBJECT(IndividualCommentsPlex);
RELEASEOBJECT(AnnotationsReferencePlex);

View File

@ -224,6 +224,7 @@ namespace DocFileFormat
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
Plex<FieldCharacter> *AnnotationsFieldsPlex;
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
Plex<EmptyStructure> *AutoTextPlex;

View File

@ -32,7 +32,6 @@
#include "WordprocessingDocument.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/SystemUtils.h"
@ -40,136 +39,6 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
namespace ImageHelper
{
struct __BITMAPINFOHEADER
{
_UINT32 biSize;
_INT32 biWidth;
_INT32 biHeight;
_UINT16 biPlanes;
_UINT16 biBitCount;
_UINT32 biCompression;
_UINT32 biSizeImage;
_INT32 biXPelsPerMeter;
_INT32 biYPelsPerMeter;
_UINT32 biClrUsed;
_UINT32 biClrImportant;
};
struct __BITMAPCOREHEADER
{
_UINT32 bcSize; /* used to get to color table */
_UINT16 bcWidth;
_UINT16 bcHeight;
_UINT16 bcPlanes;
_UINT16 bcBitCount;
};
inline Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
{
Global::_BlipType result = Global::msoblipERROR;
CBgraFrame oFrame;
int offset = 0, biSizeImage = 0;
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
if (!header) return result;
result = Global::msoblipDIB;
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
{
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
if (header_core->bcSize != 12)
{
result = Global::msoblipWMF;
}
else
{
offset = 12; //sizeof(BITMAPCOREHEADER)
oFrame.put_Height (header_core->bcHeight );
oFrame.put_Width (header_core->bcWidth );
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
// header_core->bcWidth++;
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
int stride = -(size - offset) / header_core->bcHeight;
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
biSizeImage = size - offset;
if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
{
result = Global::msoblipPNG;
}
}
}
else
{
offset = 40; //sizeof(BITMAPINFOHEADER)
oFrame.put_Height (header->biHeight );
oFrame.put_Width (header->biWidth );
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
// header->biWidth++;
int stride = -(size - offset) / header->biHeight;
if (-stride >= header->biWidth && header->biBitCount >= 24)
{
result = Global::msoblipPNG;
}
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
}
//------------------------------------------------------------------------------------------
if (result == Global::msoblipPNG)
{
oFrame.put_Data((unsigned char*)data + offset);
if (!oFrame.SaveFile(file_name + L".png", 4/*CXIMAGE_FORMAT_PNG*/))
result = Global::msoblipERROR;
oFrame.put_Data(NULL);
}
else if (result == Global::msoblipWMF)
{
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + L".wmf"))
{
file.WriteFile((BYTE*)data, size);
file.CloseFile();
}
}
else if (biSizeImage > 0)
{
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + L".bmp"))
{
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
file.WriteFile((BYTE*)data, size);
file.CloseFile();
}
}
return result;
}
}
namespace DocFileFormat
{
WordprocessingDocument::WordprocessingDocument(const std::wstring & _pathOutput, const WordDocument* _docFile) :
@ -275,24 +144,7 @@ namespace DocFileFormat
for (std::list<ImageFileStructure>::iterator iter = ImagesList.begin(); iter != ImagesList.end(); ++iter)
{
unsigned char* bytes = NULL;
bytes = new unsigned char[iter->data.size()];
if (bytes)
{
copy(iter->data.begin(), iter->data.end(), bytes);
if (Global::msoblipDIB == iter->blipType)
{//user_manual_v52.doc
std::wstring file_name = pathMedia + FILE_SEPARATOR_STR + L"image" + FormatUtils::IntToWideString(i++);
iter->blipType = ImageHelper::SaveImageToFileFromDIB(bytes, iter->data.size(), file_name);
}
else
{
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)bytes, (unsigned int)iter->data.size());
}
RELEASEARRAYOBJECTS(bytes);
}
SaveToFile(pathMedia, std::wstring(L"image" ) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)iter->data.get(), iter->size);
}
}

View File

@ -208,28 +208,19 @@ HEADERS += \
../../DocDocxConverter/OfficeDrawing/ChildAnchor.h \
../../DocDocxConverter/OfficeDrawing/ClientAnchor.h \
../../DocDocxConverter/OfficeDrawing/ClientData.h \
../../DocDocxConverter/OfficeDrawing/DiagramBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/DrawingContainer.h \
../../DocDocxConverter/OfficeDrawing/DrawingGroup.h \
../../DocDocxConverter/OfficeDrawing/DrawingGroupRecord.h \
../../DocDocxConverter/OfficeDrawing/DrawingRecord.h \
../../DocDocxConverter/OfficeDrawing/FillStyleBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/GeometryBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/GeometryTextBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/GroupContainer.h \
../../DocDocxConverter/OfficeDrawing/GroupShapeBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/GroupShapeRecord.h \
../../DocDocxConverter/OfficeDrawing/LineStyleBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/MetafilePictBlip.h \
../../DocDocxConverter/OfficeDrawing/OfficeArtClientTextbox.h \
../../DocDocxConverter/OfficeDrawing/PathParser.h \
../../DocDocxConverter/OfficeDrawing/PathSegment.h \
../../DocDocxConverter/OfficeDrawing/ProtectionBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/Record.h \
../../DocDocxConverter/OfficeDrawing/RecordFactory.h \
../../DocDocxConverter/OfficeDrawing/RegularContainer.h \
../../DocDocxConverter/OfficeDrawing/ShadowStyleBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/threeDBooleanProperties.h \
../../DocDocxConverter/OfficeDrawing/Shape.h \
../../DocDocxConverter/OfficeDrawing/ShapeContainer.h \
../../DocDocxConverter/OfficeDrawing/ShapeOptions.h \

View File

@ -775,10 +775,6 @@
RelativePath="..\..\DocDocxConverter\OfficeDrawing\ClientData.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\DiagramBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\DrawingContainer.h"
>
@ -795,34 +791,14 @@
RelativePath="..\..\DocDocxConverter\OfficeDrawing\DrawingRecord.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\FillStyleBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\GeometryBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\GeometryTextBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\GroupContainer.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\GroupShapeBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\GroupShapeRecord.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\LineStyleBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\MetafilePictBlip.h"
>
@ -831,18 +807,6 @@
RelativePath="..\..\DocDocxConverter\OfficeDrawing\OfficeArtClientTextbox.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\PathParser.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\PathSegment.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\ProtectionBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\Record.cpp"
>
@ -863,10 +827,6 @@
RelativePath="..\..\DocDocxConverter\OfficeDrawing\RegularContainer.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\ShadowStyleBooleanProperties.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OfficeDrawing\Shape.h"
>

View File

@ -2,20 +2,17 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"

View File

@ -345,6 +345,14 @@
RelativePath="..\..\DesktopEditor\common\Base64.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\BinaryReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\BinaryWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>

View File

@ -33,6 +33,7 @@
#define COMMENTS_WRITER
#include "../../XlsxSerializerCom/Common/Common.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
namespace Writers
{
@ -40,6 +41,8 @@ namespace Writers
static std::wstring g_string_comment_End = _T("</w:comments>");
static std::wstring g_string_commentExt_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w15:commentsEx 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\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_commentExt_End = _T("</w15:commentsEx>");
static std::wstring g_string_commentsIds_Start = _T("<w16cid:commentsIds mc:Ignorable=\"w16cid\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\">");
static std::wstring g_string_commentsIds_End = _T("</w16cid:commentsIds>");
static std::wstring g_string_people_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w15:people 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\" mc:Ignorable=\"w14 w15 wp14\">");
static std::wstring g_string_people_End = _T("</w15:people>");
@ -49,22 +52,33 @@ namespace Writers
public:
std::wstring m_sComment;
std::wstring m_sCommentExt;
std::wstring m_sCommentsIds;
std::wstring m_sPeople;
std::wstring m_sDocumentComment;
std::wstring m_sDocumentCommentExt;
std::wstring m_sDocumentCommentsIds;
std::wstring m_sDocumentPeople;
CommentsWriter(std::wstring sDir) : m_sDir(sDir)
{
}
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sPeople)
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sCommentsIds, std::wstring& sPeople, std::wstring& sDocumentComment, std::wstring& sDocumentCommentExt, std::wstring& sDocumentCommentsIds, std::wstring& sDocumentPeople)
{
m_sComment = sComment;
m_sCommentExt = sCommentExt;
m_sCommentsIds = sCommentsIds;
m_sPeople = sPeople;
m_sDocumentComment = sDocumentComment;
m_sDocumentCommentExt = sDocumentCommentExt;
m_sDocumentCommentsIds = sDocumentCommentsIds;
m_sDocumentPeople = sDocumentPeople;
}
void Write()
{
std::wstring sDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR;
if(false == m_sComment.empty())
{
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("comments.xml");
OOX::CPath filePath = sDir + OOX::FileTypes::Comments.DefaultFileName().GetPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
@ -76,21 +90,70 @@ namespace Writers
if(false == m_sCommentExt.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("commentsExtended.xml"));
oFile.CreateFileW(sDir + OOX::FileTypes::CommentsExt.DefaultFileName().GetPath());
oFile.WriteStringUTF8(g_string_commentExt_Start);
oFile.WriteStringUTF8(m_sCommentExt);
oFile.WriteStringUTF8(g_string_commentExt_End);
oFile.CloseFile();
}
if(false == m_sCommentsIds.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sDir + OOX::FileTypes::CommentsIds.DefaultFileName().GetPath());
oFile.WriteStringUTF8(g_string_commentsIds_Start);
oFile.WriteStringUTF8(m_sCommentsIds);
oFile.WriteStringUTF8(g_string_commentsIds_End);
oFile.CloseFile();
}
if(false == m_sPeople.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("people.xml"));
oFile.CreateFileW(sDir + OOX::FileTypes::People.DefaultFileName().GetPath());
oFile.WriteStringUTF8(g_string_people_Start);
oFile.WriteStringUTF8(m_sPeople);
oFile.WriteStringUTF8(g_string_people_End);
oFile.CloseFile();
}
if(false == m_sDocumentComment.empty())
{
OOX::CPath filePath = sDir + OOX::FileTypes::DocumentComments.DefaultFileName().GetPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(g_string_comment_Start);
oFile.WriteStringUTF8(m_sDocumentComment);
oFile.WriteStringUTF8(g_string_comment_End);
oFile.CloseFile();
}
if(false == m_sDocumentCommentExt.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sDir + OOX::FileTypes::DocumentCommentsExt.DefaultFileName().GetPath());
oFile.WriteStringUTF8(g_string_commentExt_Start);
oFile.WriteStringUTF8(m_sDocumentCommentExt);
oFile.WriteStringUTF8(g_string_commentExt_End);
oFile.CloseFile();
}
if(false == m_sDocumentCommentsIds.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sDir + OOX::FileTypes::DocumentCommentsIds.DefaultFileName().GetPath());
oFile.WriteStringUTF8(g_string_commentsIds_Start);
oFile.WriteStringUTF8(m_sDocumentCommentsIds);
oFile.WriteStringUTF8(g_string_commentsIds_End);
oFile.CloseFile();
}
if(false == m_sDocumentPeople.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sDir + OOX::FileTypes::DocumentPeople.DefaultFileName().GetPath());
oFile.WriteStringUTF8(g_string_people_Start);
oFile.WriteStringUTF8(m_sDocumentPeople);
oFile.WriteStringUTF8(g_string_people_End);
oFile.CloseFile();
}
}
};
}

View File

@ -58,6 +58,11 @@ namespace NSBinPptxRW
{
class CDrawingConverter;
}
namespace OOX
{
class CApp;
class CCore;
}
namespace Writers
{
@ -87,6 +92,8 @@ namespace Writers
std::wstring m_sThemePath;
int m_nDocPrIndex;
BinDocxRW::CComments* m_pComments;
OOX::CApp* m_pApp;
OOX::CCore* m_pCore;
FileWriter (std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath)
: m_pDrawingConverter(pDrawingConverter), m_sThemePath(sThemePath), m_bSaveChartAsImg(bSaveChartAsImg),
@ -105,9 +112,16 @@ namespace Writers
m_oWebSettingsWriter (sDirOutput),
m_nDocPrIndex(0),
m_pComments(NULL),
m_oCustomXmlWriter (sDirOutput, pDrawingConverter)
m_oCustomXmlWriter (sDirOutput, pDrawingConverter),
m_pApp (NULL),
m_pCore (NULL)
{
}
~FileWriter()
{
RELEASEOBJECT(m_pApp);
RELEASEOBJECT(m_pCore);
}
int getNextDocPr()
{
m_nDocPrIndex++;

View File

@ -29,6 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef READER_CLASSES
#define READER_CLASSES
@ -60,6 +62,8 @@ public:
std::wstring pgBorders;
std::wstring footnotePr;
std::wstring endnotePr;
bool RtlGutter;
long Gutter;
bool bW;
bool bH;
@ -74,6 +78,8 @@ public:
bool bEvenAndOddHeaders;
bool bSectionType;
bool bPageNumStart;
bool bRtlGutter;
bool bGutter;
SectPr()
{
sHeaderFooterReference = _T("");
@ -92,6 +98,7 @@ public:
bEvenAndOddHeaders = false;
bSectionType = false;
bPageNumStart = false;
bRtlGutter = false;
}
std::wstring Write()
{
@ -150,7 +157,9 @@ public:
sRes += L" w:header=\"" + std::to_wstring(Header) + L"\"";
if(bFooter)
sRes += L" w:footer=\"" + std::to_wstring(Footer) + L"\"";
sRes += L" w:gutter=\"0\"/>";
if(bGutter)
sRes += L" w:gutter=\"" + std::to_wstring(Gutter) + L"\"";
sRes += L"/>";
}
if(!pgBorders.empty())
sRes += pgBorders;
@ -158,6 +167,14 @@ public:
if(bPageNumStart)
sRes += L"<w:pgNumType w:start=\"" + std::to_wstring(PageNumStart) + L"\"/>";
if(bRtlGutter)
{
if(RtlGutter)
sRes += L"<w:rtlGutter/>";
else
sRes += L"<w:rtlGutter w:val=\"0\"/>";
}
if(!cols.empty())
sRes += cols;
sRes += L"<w:docGrid w:linePitch=\"360\"/>";
@ -1479,14 +1496,25 @@ public:
std::wstring sFormat;
switch(Format)
{
case numbering_numfmt_None:sFormat = _T("none");break;
case numbering_numfmt_Bullet:sFormat = _T("bullet");break;
case numbering_numfmt_Decimal:sFormat = _T("decimal");break;
case numbering_numfmt_LowerRoman:sFormat = _T("lowerRoman");break;
case numbering_numfmt_UpperRoman:sFormat = _T("upperRoman");break;
case numbering_numfmt_LowerLetter:sFormat = _T("lowerLetter");break;
case numbering_numfmt_UpperLetter:sFormat = _T("upperLetter");break;
case numbering_numfmt_DecimalZero:sFormat = _T("decimalZero");break;
case numbering_numfmt_None: sFormat = L"none"; break;
case numbering_numfmt_Bullet: sFormat = L"bullet"; break;
case numbering_numfmt_Decimal: sFormat = L"decimal"; break;
case numbering_numfmt_LowerRoman: sFormat = L"lowerRoman"; break;
case numbering_numfmt_UpperRoman: sFormat = L"upperRoman"; break;
case numbering_numfmt_LowerLetter: sFormat = L"lowerLetter"; break;
case numbering_numfmt_UpperLetter: sFormat = L"upperLetter"; break;
case numbering_numfmt_DecimalZero: sFormat = L"decimalZero"; break;
default:
{
Format -= 0x2008;
if (Format >= 0)
{
SimpleTypes::CNumberFormat<> numFormat;
numFormat.SetValue((SimpleTypes::ENumberFormat)Format);
sFormat = numFormat.ToString();
}
}break;
}
if(!sFormat.empty())
{
@ -1878,6 +1906,7 @@ public:
std::wstring Date;
std::wstring OOData;
bool Solved;
unsigned int DurableId;
std::wstring Text;
std::wstring m_sParaId;
std::wstring m_sParaIdParent;
@ -1886,12 +1915,14 @@ public:
bool bIdOpen;
bool bIdFormat;
bool bSolved;
bool bDurableId;
public:
CComment(IdCounter& oParaIdCounter, IdCounter& oFormatIdCounter):m_oParaIdCounter(oParaIdCounter),m_oFormatIdCounter(oFormatIdCounter)
{
bIdOpen = false;
bIdFormat = false;
bSolved = false;
bDurableId = false;
}
~CComment()
{
@ -1928,15 +1959,6 @@ public:
}
return sRes;
}
std::wstring writeTemplates(bool isExt)
{
std::wstring sRes;
sRes += isExt ? writeContentExt(this) : writeContent(this);
for(size_t i = 0; i < replies.size(); ++i)
sRes += isExt ? writeContentExt(replies[i]) : writeContent(replies[i]);
return sRes;
}
static std::wstring writeRef(CComment* pComment, const std::wstring& sBefore, const std::wstring& sRef, const std::wstring& sAfter)
{
std::wstring sRes;
@ -1950,7 +1972,7 @@ public:
sRes += (sAfter);
return sRes;
}
static bool writeContentWritePart(CComment* pComment, std::wstring& sText, int nPrevIndex, int nCurIndex, bool bFirst, std::wstring& sRes)
static void writeContentWritePart(CComment* pComment, std::wstring& sText, int nPrevIndex, int nCurIndex, std::wstring& sRes)
{
std::wstring sPart;
if(nPrevIndex < nCurIndex)
@ -1958,17 +1980,11 @@ public:
int nId = pComment->m_oParaIdCounter.getNextId();
std::wstring sId = XmlUtils::IntToString(nId, L"%08X");
if(bFirst)
{
bFirst = false;
pComment->m_sParaId = sId;
}
sRes += L"<w:p w14:paraId=\"" + sId + L"\" w14:textId=\"" + sId + L"\">";
pComment->m_sParaId = XmlUtils::IntToString(nId, L"%08X");
sRes += L"<w:p w14:paraId=\"" + pComment->m_sParaId + L"\" w14:textId=\"" + pComment->m_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>";
return bFirst;
}
static std::wstring writeContent(CComment* pComment)
{
@ -2022,18 +2038,17 @@ public:
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
{
wchar_t cToken = sText[i];
if('\n' == cToken)
{
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
nPrevIndex = i + 1;
}
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
sRes += L"</w:comment>";
return sRes;
}
@ -2056,6 +2071,15 @@ w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L
}
return sRes;
}
static std::wstring writeContentsIds(CComment* pComment)
{
std::wstring sRes;
if(!pComment->m_sParaId.empty() && pComment->bDurableId)
{
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->m_sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
}
return sRes;
}
static std::wstring writePeople(CComment* pComment)
{
std::wstring sRes;
@ -2123,7 +2147,9 @@ public:
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += it->second->writeTemplates(false);
sRes += CComment::writeContent(it->second);
for(size_t i = 0; i < it->second->replies.size(); ++i)
sRes += CComment::writeContent(it->second->replies[i]);
}
return sRes;
}
@ -2132,7 +2158,20 @@ public:
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += it->second->writeTemplates(true);
sRes += CComment::writeContentExt(it->second);
for(size_t i = 0; i < it->second->replies.size(); ++i)
sRes += CComment::writeContentExt(it->second->replies[i]);
}
return sRes;
}
std::wstring writeContentsIds()
{
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += CComment::writeContentsIds(it->second);
for(size_t i = 0; i < it->second->replies.size(); ++i)
sRes += CComment::writeContentsIds(it->second->replies[i]);
}
return sRes;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
namespace Writers
{
static std::wstring g_string_set_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><w:settings xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\">");
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"15\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val=\".\"/><w:listSeparator w:val=\",\"/>");
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"15\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults>");
static std::wstring g_string_set_End = _T("</w:settings>");
class SettingWriter

View File

@ -34,8 +34,9 @@
#include "BinReaderWriterDefines.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_OMath.h"
#include "../../Common/DocxFormat/Source/MathEquation/OutputDev.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_OMath.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Shared.h"
#include <stack>
namespace MathEquation

View File

@ -146,7 +146,8 @@ extern int g_nCurFormatVersion;
Background = 12,
VbaProject = 13,
App = 15,
Core = 16
Core = 16,
DocumentComments = 17
};}
namespace c_oSerSigTypes{enum c_oSerSigTypes
{
@ -466,7 +467,8 @@ extern int g_nCurFormatVersion;
cols = 8,
pgBorders = 9,
footnotePr = 10,
endnotePr = 11
endnotePr = 11,
rtlGutter = 12
};}
namespace c_oSerProp_secPrSettingsType{enum c_oSerProp_secPrSettingsType
{
@ -523,7 +525,11 @@ extern int g_nCurFormatVersion;
Sdt = 10,
BookmarkStart = 11,
BookmarkEnd = 12,
tblGrid_ItemTwips = 13
tblGrid_ItemTwips = 13,
MoveFromRangeStart = 14,
MoveFromRangeEnd = 15,
MoveToRangeStart = 16,
MoveToRangeEnd = 17
};}
namespace c_oSerRunType{enum c_oSerRunType
{
@ -777,7 +783,8 @@ extern int g_nCurFormatVersion;
RightTwips = 8,
BottomTwips = 9,
HeaderTwips = 10,
FooterTwips = 11
FooterTwips = 11,
GutterTwips = 12
};}
namespace c_oSer_ColorType{enum c_oSer_ColorType
{
@ -796,7 +803,8 @@ extern int g_nCurFormatVersion;
QuoteText = 7,
Solved = 8,
Replies = 9,
OOData = 10
OOData = 10,
DurableId = 11
};}
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
{
@ -809,7 +817,15 @@ extern int g_nCurFormatVersion;
SdtGlobalColor = 6,
SdtGlobalShowHighlight = 7,
Compat = 8,
DefaultTabStopTwips = 9
DefaultTabStopTwips = 9,
DecimalSymbol = 10,
ListSeparator = 11,
GutterAtTop = 12,
MirrorMargins = 13,
PrintTwoOnOne = 14,
BookFoldPrinting = 15,
BookFoldPrintingSheets = 16,
BookFoldRevPrinting = 17
};}
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
{
@ -976,7 +992,11 @@ extern int g_nCurFormatVersion;
columnbreak = 64,
ARPr = 65,
BookmarkStart = 66,
BookmarkEnd = 67
BookmarkEnd = 67,
MoveFromRangeStart = 68,
MoveFromRangeEnd = 69,
MoveToRangeStart = 70,
MoveToRangeEnd = 71
};}
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -260,8 +260,7 @@ namespace BinXlsxRW{
{
OOX::Spreadsheet::CTableFile* pTable = new OOX::Spreadsheet::CTableFile(NULL);
pTable->m_oTable.Init();
pTable->m_oTable->m_oDisplayName.Init();
pTable->m_oTable->m_oDisplayName->append(L"Table1");
pTable->m_oTable->m_oDisplayName = L"Table1";
pTable->m_oTable->m_oRef.Init();
pTable->m_oTable->m_oRef->SetValue(OOX::Spreadsheet::CCell::combineRef(m_nRow1 - 1, m_nCol1 - 1) + L":" + OOX::Spreadsheet::CCell::combineRef(m_nRow2 - 1, m_nCol2 - 1));
pTable->m_oTable->m_oTotalsRowCount.Init();
@ -278,13 +277,20 @@ namespace BinXlsxRW{
pTable->m_oTable->m_oTableStyleInfo->m_oShowColumnStripes.Init();
pTable->m_oTable->m_oTableStyleInfo->m_oShowColumnStripes->FromBool(false);
pTable->m_oTable->m_oTableColumns.Init();
for(size_t i = 0; i < m_aTableNames.size(); ++i)
{
OOX::Spreadsheet::CTableColumn* pTableColumn = new OOX::Spreadsheet::CTableColumn();
pTableColumn->m_oId.Init();
pTableColumn->m_oId->SetValue((unsigned int)i + 1);
pTableColumn->m_oName.Init();
pTableColumn->m_oName->append(m_aTableNames[i]);
if (!pTableColumn->m_oId.IsInit())
{
pTableColumn->m_oId.Init();
pTableColumn->m_oId->SetValue((unsigned int)i + 1);
}
if (!pTableColumn->m_oName.IsInit())
{
pTableColumn->m_oName = m_aTableNames[i];
}
pTable->m_oTable->m_oTableColumns->m_arrItems.push_back(pTableColumn);
}
pTable->m_oTable->m_oTableColumns->m_oCount.Init();

View File

@ -30,15 +30,20 @@
*
*/
#include "DocxSerializer.h"
#include "../BinWriter/BinWriters.h"
#include "../BinReader/Readers.h"
#include "../../ASCOfficePPTXFile/ASCOfficeDrawingConverter.h"
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
#include "FontProcessor.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Path.h"
#include "../../DesktopEditor/common/SystemUtils.h"
#include "../BinWriter/BinWriters.h"
#include "../BinReader/Readers.h"
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
@ -296,33 +301,28 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
OOX::CPath DocProps = std::wstring(_T("docProps"));
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
if (NULL != m_pCurFileWriter->m_pApp)
{
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
if (sApplication.empty())
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
pApp->SetApplication(sApplication);
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore(NULL);
if (pCore)
m_pCurFileWriter->m_pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
}
else
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes);
delete pCore;
}
OOX::CApp pApp(NULL);
pApp.SetDefaults();
pApp.write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
}
if (NULL != m_pCurFileWriter->m_pCore)
{
m_pCurFileWriter->m_pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes);
}
else
{
OOX::CCore pCore(NULL);
pCore.SetDefaults();
pCore.write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes);
}
/////////////////////////////////////////////////////////////////////////////////////
m_pCurFileWriter->Write();
pContentTypes->Write(sDstPath);

View File

@ -32,6 +32,8 @@ SOURCES += \
../../XlsxSerializerCom/Reader/ChartFromToBinary.cpp \
../../XlsxSerializerCom/Reader/CommonWriter.cpp \
../../XlsxSerializerCom/Reader/CSVReader.cpp \
../../XlsxSerializerCom/Reader/BinaryWriter.cpp \
../../XlsxSerializerCom/Writer/BinaryReader.cpp \
../../XlsxSerializerCom/Writer/CSVWriter.cpp \
../../OfficeCryptReader/source/ECMACryptFile.cpp \
../../OfficeCryptReader/source/CryptTransform.cpp \

View File

@ -55,6 +55,8 @@
8A404FD5208A01CE00F2D5CF /* FileDownloader_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */; };
8AB24BFD213004E400E80DDD /* CustormXmlWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */; };
8AB24BFE213004E400E80DDD /* CustormXmlWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */; };
8AE10E6E222824F400A542DE /* BinaryWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AE10E6D222824F400A542DE /* BinaryWriter.cpp */; };
8AE10E702228251000A542DE /* BinaryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AE10E6F2228251000A542DE /* BinaryReader.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -107,6 +109,8 @@
8A404FD4208A01CE00F2D5CF /* FileDownloader_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader_private.h; path = ../../../Common/FileDownloader/FileDownloader_private.h; sourceTree = "<group>"; };
8AB24BFB213004E300E80DDD /* CustormXmlWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustormXmlWriter.cpp; sourceTree = "<group>"; };
8AB24BFC213004E300E80DDD /* CustormXmlWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustormXmlWriter.h; sourceTree = "<group>"; };
8AE10E6D222824F400A542DE /* BinaryWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinaryWriter.cpp; sourceTree = "<group>"; };
8AE10E6F2228251000A542DE /* BinaryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinaryReader.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -215,6 +219,7 @@
isa = PBXGroup;
children = (
17E17F211AC4549B00BEA2EA /* BinaryWriter.h */,
8AE10E6D222824F400A542DE /* BinaryWriter.cpp */,
17E17F221AC4549B00BEA2EA /* ChartFromToBinary.cpp */,
17E17F231AC4549B00BEA2EA /* ChartFromToBinary.h */,
17E17F241AC4549B00BEA2EA /* CommonWriter.cpp */,
@ -230,6 +235,7 @@
children = (
17E17F2D1AC4549B00BEA2EA /* BinaryCommonReader.h */,
17E17F2E1AC4549B00BEA2EA /* BinaryReader.h */,
8AE10E6F2228251000A542DE /* BinaryReader.cpp */,
17E17F2F1AC4549B00BEA2EA /* CSVWriter.cpp */,
17E17F301AC4549B00BEA2EA /* CSVWriter.h */,
);
@ -336,6 +342,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 17E17ED31AC453F800BEA2EA;
@ -362,11 +369,13 @@
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
8AE10E702228251000A542DE /* BinaryReader.cpp in Sources */,
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
8A404FD3208A01AF00F2D5CF /* FileDownloader.cpp in Sources */,
8AE10E6E222824F400A542DE /* BinaryWriter.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -376,7 +385,7 @@
17C1FEC01ACC42C4006B99B3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_BITCODE = NO;
ENABLE_BITCODE = YES;
EXECUTABLE_PREFIX = lib;
GCC_ENABLE_CPP_EXCEPTIONS = YES;
GCC_ENABLE_CPP_RTTI = YES;
@ -408,7 +417,7 @@
17C1FEC11ACC42C4006B99B3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_BITCODE = NO;
ENABLE_BITCODE = YES;
EXECUTABLE_PREFIX = lib;
GCC_ENABLE_CPP_EXCEPTIONS = YES;
GCC_ENABLE_CPP_RTTI = YES;

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
BlueprintName = "ASCOfficeDocxFile2Lib"
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
BlueprintName = "ASCOfficeDocxFile2Lib"
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
BlueprintName = "ASCOfficeDocxFile2Lib"
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -14,8 +14,8 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "17E17EDB1AC453F800BEA2EA"
BuildableName = "libASCOfficeDocxFile2Lib.a"
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
BlueprintName = "ASCOfficeDocxFile2Lib"
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
</BuildableReference>
@ -23,27 +23,30 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "17E17EDB1AC453F800BEA2EA"
BuildableName = "libASCOfficeDocxFile2Lib.a"
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
BlueprintName = "ASCOfficeDocxFile2Lib"
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
</BuildableReference>
@ -52,16 +55,16 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "17E17EDB1AC453F800BEA2EA"
BuildableName = "libASCOfficeDocxFile2Lib.a"
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
BlueprintName = "ASCOfficeDocxFile2Lib"
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
</BuildableReference>

View File

@ -92,8 +92,9 @@ public:
std::wstring convert_conditional_formula(std::wstring const & expr);
// Лист1!$A$1 -> $Лист1.$A$1
std::wstring convert_named_ref (std::wstring const & expr);
std::wstring convert_named_ref(std::wstring const & expr);
std::wstring convert_named_formula(std::wstring const & expr);
bool is_simple_ref(std::wstring const & expr);
std::wstring get_table_name();

View File

@ -122,27 +122,64 @@ namespace formulasconvert {
XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
//XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
//XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
XmlUtils::replace_all( expr, L"PROBEL", L" ");
XmlUtils::replace_all( expr, L"APOSTROF", L"'");
XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
//XmlUtils::replace_all( expr, L"APOSTROF", L"'");
//XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
}
static void replace_tmp(std::wstring &expr)
{
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
XmlUtils::replace_all( expr, L"!", L"VOSKL");
// XmlUtils::replace_all( expr, L".", L"ТОСHKA");
// XmlUtils::replace_all( expr, L"!", L"VOSKL");
XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
// XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
// XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
//XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
//XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
XmlUtils::replace_all( expr, L" ", L"PROBEL");
// XmlUtils::replace_all( expr, L"'", L"APOSTROF");
// XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
// //XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
// //XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
//
// XmlUtils::replace_all( expr, L" ", L"PROBEL");
//// XmlUtils::replace_all( expr, L"'", L"APOSTROF");
//// XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
std::wstring result;
size_t pos = 0, size = expr.length();
while(pos < size)
{
switch(expr[pos])
{
case '.':
{
result += L"ТОСHKA";
}break;
case '!':
{
result += L"VOSKL";
}break;
case '(':
{
result += L"SCOBCAIN";
}break;
case ')':
{
result += L"SCOBCAOUT";
}break;
case ' ':
{
result += L"PROBEL";
}break;
default:
{
result += expr[pos];
}break;
}
pos++;
}
expr = result;
}
static std::wstring convert_scobci(boost::wsmatch const & what)
{
@ -210,25 +247,41 @@ namespace formulasconvert {
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
{
std::wstring workstr = expr;
workstr = boost::regex_replace(
workstr,
boost::wregex(L"('.*?')|(\".*?\")"),
&convert_scobci, boost::match_default | boost::format_all);
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
boost::algorithm::split(splitted, workstr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
bool res = false;
if (splitted.size() == 2)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[1];
res = true;
}
if (splitted.size() == 3)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[2];
return true;
res = true;
}
if (splitted.size() == 4)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[3];
return true;
res = true;
}
return false;
replace_tmp_back( table );
return res;
}
bool odf2oox_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)

View File

@ -133,34 +133,202 @@ public:
}
static void oox_replace_tmp_back(std::wstring &expr)
{
XmlUtils::replace_all( expr, L"ТОСHKA", L".");
XmlUtils::replace_all( expr, L"VOSKL", L"!");
std::wstring result;
XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
size_t pos = 0, size = expr.length();
XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
XmlUtils::replace_all( expr, L"PROBEL", L" ");
XmlUtils::replace_all( expr, L"APOSTROF", L"'");
XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
while(pos < size)
{
if (pos + 5 >= size)
{
result += expr[pos++];
continue;
}
switch(expr[pos])
{
case 'M':
{
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"MINYS"))
{
result += L"-"; pos += 5;
}
else
{
result += expr[pos++];
}
}break;
case 'T':
{
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"ТОСHKA"))
{
result += L"."; pos += 6;
}
else
{
result += expr[pos++];
}
}break;
case 'V':
{
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"VOSKL"))
{
result += L"!"; pos += 5;
}
else
{
result += expr[pos++];
}
}break;
case 'S':
{
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"))
{
result += L")"; pos += 9;
}
else
{
result += expr[pos++];
}
}break;
case 'K':
{
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"))
{
result += L"]"; pos += 10;
}
else if ((pos + 8 < size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
{
result += L"\""; pos += 8;
}
else
{
result += expr[pos++];
}
}break;
case 'P':
{
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"PROBEL"))
{
result += L" "; pos += 6;
}
else
{
result += expr[pos++];
}
}break;
case 'A':
{
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"APOSTROF"))
{
result += L"'"; pos += 8;
}
else
{
result += expr[pos++];
}
}break;
default:
{
result += expr[pos++];
}break;
}
}
expr = result;
//XmlUtils::replace_all( expr, L"MINYS", L"-");
//XmlUtils::replace_all( expr, L"ТОСHKA", L".");
//XmlUtils::replace_all( expr, L"VOSKL", L"!");
//XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
//XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
//XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
//XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
//
//XmlUtils::replace_all( expr, L"PROBEL", L" ");
//XmlUtils::replace_all( expr, L"APOSTROF", L"'");
//XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
}
static void oox_replace_tmp(std::wstring &expr)
{
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
XmlUtils::replace_all( expr, L"!", L"VOSKL");
std::wstring result;
XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
size_t pos = 0, size = expr.length();
XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
XmlUtils::replace_all( expr, L" ", L"PROBEL");
XmlUtils::replace_all( expr, L"'", L"APOSTROF");
XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
while(pos < size)
{
switch(expr[pos])
{
case '-':
{
result += L"MINYS";
}break;
case '.':
{
result += L"ТОСHKA";
}break;
case '!':
{
result += L"VOSKL";
}break;
case '(':
{
result += L"SCOBCAIN";
}break;
case ')':
{
result += L"SCOBCAOUT";
}break;
case '[':
{
result += L"KVADRATIN";
}break;
case ']':
{
result += L"KVADRATOUT";
}break;
case ' ':
{
result += L"PROBEL";
}break;
case '\'':
{
result += L"APOSTROF";
}break;
case '\"':
{
result += L"KAVYCHKA";
}break;
default:
{
result += expr[pos];
}break;
}
pos++;
}
expr = result;
//XmlUtils::replace_all( expr, L"-", L"MINYS");
//XmlUtils::replace_all( expr, L".", L"ТОСHKA");
//XmlUtils::replace_all( expr, L"!", L"VOSKL");
//XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
//XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
//XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
//XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
//
//XmlUtils::replace_all( expr, L" ", L"PROBEL");
//XmlUtils::replace_all( expr, L"'", L"APOSTROF");
//XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
}
static bool is_forbidden1(const std::wstring & formula)
@ -174,6 +342,7 @@ public:
}
void replace_named_ref(std::wstring & expr);
void replace_named_formula(std::wstring & expr);
bool is_simple_ref(std::wstring const & expr);
static bool isFindBaseCell_;
@ -188,14 +357,14 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
if ((0 == expr.find(L"KAVYCHKA")) && (expr.length() - 8 == expr.rfind(L"KAVYCHKA") ))
return;
boost::wregex re(L"([:$!])+");
boost::wregex re(L"(([:$!])+)|(\\S+\\d+)");
boost::wsmatch result;
bool b = boost::regex_search(expr, result, re);
if (b)
{
boost::wregex re1(L"(\\$?[^\']+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
boost::wregex re1(L"(\\$?[^\\']+\\!)?([a-zA-Z$]+\\d*)(\\:[a-zA-Z$]+\\d*)?");
// $ Sheet2 ! $ A1 : $ B5
// $ Sheet2 ! $ A : $ A
// $ Sheet2 ! $ 1 : $ 1
@ -238,9 +407,11 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
{
table_name_ = sheet + L".$A$1";
table_name_ = L"$" + sheet + L".$A$1";
}
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
if (!c2.empty() && c2.substr(0, 1) == L":")
c2 = c2.substr(1);
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
@ -281,10 +452,12 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
{
table_name_ = sheet + L".$A$1";
table_name_ = L"$" + sheet + L".$A$1";
}
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
if (!c2.empty() && c2.substr(0, 1) == L":")
c2 = c2.substr(1);
s = sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"");
}
@ -310,6 +483,19 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
expr = convert_formula(expr);
isFindBaseCell_ = false;
}
bool oox2odf_converter::Impl::is_simple_ref(std::wstring const & expr)
{
if (expr.find(L"(") != std::wstring::npos) return false;
if (expr.find(L" ") != std::wstring::npos) return false;
if (expr.find(L";") != std::wstring::npos) return false;
boost::wsmatch match;
if (boost::regex_search(expr, match, boost::wregex(L"([\\w]+\\!)?\\$?[a-zA-Z]+\\$?\\d+(\\:\\$?[a-zA-Z]+\\$?\\d+)?")))
{
return true;
}
return false;
}
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
{
@ -644,6 +830,11 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
impl_->replace_named_formula(workstr);
return workstr;
}
bool oox2odf_converter::is_simple_ref(std::wstring const & expr)
{
return impl_->is_simple_ref(expr);
}
std::wstring oox2odf_converter::get_table_name()
{
return impl_->table_name_;

View File

@ -63,8 +63,9 @@ public:
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
virtual void add_text (const std::wstring & Text) = 0;
virtual void add_space (const std::wstring & Text) = 0;
};

View File

@ -468,6 +468,7 @@ enum ElementType
typeDrawHandle,
typeDrawEquation,
typeDrawEnhancedGeometry,
typeDrawGluePoint,
typeDr3dScene,
typeDr3dLight,
@ -506,6 +507,7 @@ enum ElementType
typeFormTime,
typeFormValueRange,
typeFormItem,
typeFormOption,
typeDrawPage,
typePresentationFooterDecl,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ASCOfficeOdfFile.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1 @@
DO NOT REMOVE FOLDER FOR XCODE

View File

@ -82,6 +82,11 @@ bool read_doc_element::read_sax( xml::sax * Reader )
}
break;
case xml::typeWhitespace:
{
const std::wstring value = Reader->value();
add_space(value);
}
break;
case xml::typeText:
{
const std::wstring value = Reader->value();

View File

@ -47,6 +47,7 @@
#include "../odf/style_graphic_properties.h"
#include "docx_package.h"
#include "xlsx_package.h"
#include "oox_rels.h"
#include "logging.h"
@ -130,7 +131,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
}
//----------------------------------------------------------------------------------------------------------------
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf_document) :
last_dump_page_properties_ (true),
next_dump_page_properties_ (false),
page_break_ (false),
@ -143,19 +144,22 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
text_tracked_context_ (*this),
table_context_ (*this),
output_document_ (NULL),
process_note_ (noNote),
current_process_note_ (noNote),
new_list_style_number_ (0),
current_margin_left_ (0),
current_outline_level_ (-1),
is_rtl_ (false),
is_delete_text_ (false),
delayed_converting_ (false),
process_headers_footers_ (false),
process_comment_ (false),
mediaitems_ (OdfDocument->get_folder() ),
math_context_ (OdfDocument->odf_context().fontContainer(), false),
odf_document_ (OdfDocument)
current_process_comment_ (false),
odf_document_ (_odf_document),
math_context_ (_odf_document->odf_context().fontContainer(), false)
{
streams_man_ = streams_man::create(temp_stream_);
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
chart_drawing_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
streams_man_ = streams_man::create(temp_stream_);
}
docx_conversion_context::~docx_conversion_context()
{
@ -166,7 +170,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
}
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
{
mediaitems_.set_font_directory(pathFonts);
mediaitems_->set_font_directory(pathFonts);
}
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
{
@ -369,6 +373,9 @@ void docx_conversion_context::start_index_content()
sInstrText += L" \\n "+ std::to_wstring(table_content_context_.min_outline_level) + L"-" +
std::to_wstring(table_content_context_.max_outline_level);
}
else if (table_content_context_.type_table_content == 1)
sInstrText += L" \\o";
if (false == table_content_context_.outline_level_styles.empty())
{
sInstrText += L" \\t \"";
@ -615,9 +622,9 @@ std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, b
{
hyperlinks::_type_place type = hyperlinks::document_place;
if (process_comment_ == true) type = hyperlinks::comment_place;
else if (process_note_ == footNote || process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
else if (process_note_ == endNote || process_note_ == endNoteRefSet ) type = hyperlinks::endnote_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;
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
@ -681,11 +688,14 @@ void docx_conversion_context::end_document()
{
output_stream() << L"</w:document>";
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
output_document_->get_word_files().set_media ( mediaitems_);
output_document_->get_word_files().set_comments ( comments_context_);
output_document_->get_word_files().set_headers_footers( headers_footers_);
output_document_->get_word_files().set_headers_footers( headers_footers_);
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content(), chart_drawing_handle_->content_vml());
output_document_->get_word_files().set_drawings(drawings);
package::content_types_file & content_file_ = output_document_->get_content_types_file();
content_file_.set_media( mediaitems_);
@ -852,9 +862,12 @@ namespace
}
}
std::wstring StyleDisplayName(const std::wstring & Name, odf_types::style_family::type Type)
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type)
{
if (!Name.empty())
if (!DisplayName.empty())
return DisplayName;
if (!Name.empty())
return Name;
else
{
@ -930,8 +943,8 @@ mc:Ignorable=\"w14 wp14\">";
for (size_t i = 0; i < numIds.size(); i++)
{
strm << L"<w:num w:numId=\"" << numIds[i] << L"\" >";
strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\" />";
strm << L"<w:num w:numId=\"" << numIds[i] << L"\">";
strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\"/>";
strm << L"</w:num>";
}
@ -957,19 +970,19 @@ void docx_conversion_context::process_fonts()
if (!arFonts[i]) continue;
if (arFonts[i]->name().empty()) continue;
strm << L"<w:font w:name=\"" << arFonts[i]->name() << L"\" >";
strm << L"<w:font w:name=\"" << arFonts[i]->name() << L"\">";
if (!arFonts[i]->charset().empty())
strm << L"<w:charset w:val=\"" << arFonts[i]->charset() <<"\" />";
strm << L"<w:charset w:val=\"" << arFonts[i]->charset() <<"\"/>";
if (!arFonts[i]->family().empty())
strm << L"<w:family w:val=\"" << arFonts[i]->family() << "\" />";
strm << L"<w:family w:val=\"" << arFonts[i]->family() << "\"/>";
if (!arFonts[i]->pitch().empty())
strm << L"<w:pitch w:val=\"" << arFonts[i]->pitch() << "\" />";
strm << L"<w:pitch w:val=\"" << arFonts[i]->pitch() << "\"/>";
if (!arFonts[i]->alt_name().empty())
strm << L"<w:altName w:val=\"" << arFonts[i]->alt_name() << "\" />";
strm << L"<w:altName w:val=\"" << arFonts[i]->alt_name() << "\"/>";
strm << L"</w:font>";
}
@ -992,7 +1005,7 @@ void docx_conversion_context::process_styles()
_Wostream << L"xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ";
_Wostream << L"xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" ";
_Wostream << L"xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" ";
_Wostream << L"mc:Ignorable=\"w14\"> ";
_Wostream << L"mc:Ignorable=\"w14\">";
if (odf_reader::odf_document * doc = root())
{
@ -1062,30 +1075,34 @@ void docx_conversion_context::process_styles()
}
_Wostream << L">";
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->type());
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
_Wostream << L"<w:name w:val=\"" << displayName << L"\" />";
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
{
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
}
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
{
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
}
else
{
_Wostream << L"<w:qFormat/>";
}
if (odf_reader::style_instance * next = arStyles[i]->next())
{
const std::wstring nextId = styles_map_.get(next->name(), next->type());
_Wostream << L"<w:next w:val=\"" << nextId << "\" />";
_Wostream << L"<w:next w:val=\"" << nextId << "\"/>";
}
else if (arStyles[i]->is_default())
{
// self
_Wostream << L"<w:next w:val=\"" << id << "\" />";
_Wostream << L"<w:next w:val=\"" << id << "\"/>";
}
if (odf_reader::style_content * content = arStyles[i]->content())
@ -1334,6 +1351,7 @@ void docx_conversion_context::end_automatic_style()
in_automatic_style_ = false;
automatic_parent_style_.clear();
tabs_context_.clear();
current_outline_level_ = -1;
}
bool docx_conversion_context::in_automatic_style()
@ -1452,7 +1470,7 @@ void docx_conversion_context::end_text_list_style()
text_list_style_name_ = L"";
}
const std::wstring & docx_conversion_context::get_text_list_style_name()
std::wstring docx_conversion_context::get_text_list_style_name()
{
return text_list_style_name_;
}
@ -1478,9 +1496,9 @@ void docx_conversion_context::end_list()
list_style_stack_.pop_back();
}
const std::wstring docx_conversion_context::current_list_style() const
std::wstring docx_conversion_context::current_list_style()
{
if (!list_style_stack_.empty())
if (false == list_style_stack_.empty())
return list_style_stack_.back();
else
return L"";
@ -1533,6 +1551,93 @@ int docx_conversion_context::process_text_attr(odf_reader::text::paragraph_attrs
push_text_properties(styleContent->get_style_text_properties());
return 1;
}
int docx_conversion_context::process_paragraph_style(const std::wstring & style_name)
{
if (style_name.empty()) return 0;
if (odf_reader::style_instance * styleInst =
root()->odf_context().styleContainer().style_by_name(style_name, odf_types::style_family::Paragraph, process_headers_footers_))
{
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
if (font_size > 0) current_fontSize.push_back(font_size);
process_page_break_after(styleInst);
if (styleInst->is_automatic())
{
if (odf_reader::style_content * styleContent = styleInst->content())
{
std::wstring id;
//office_element_ptr parent_tab_stops_;
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
{
std::wstring parent_name = parentStyleContent->name();
id = styles_map_.get( parent_name, parentStyleContent->type() );
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
{
table_content_context_.set_current_level(parent_name);
}
}
start_automatic_style(id);
calc_tab_stops(styleInst, get_tabs_context());
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
if (properties.style_writing_mode_)
{
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
switch(type)
{
case odf_types::writing_mode::RlTb:
case odf_types::writing_mode::TbRl:
case odf_types::writing_mode::Rl:
set_rtl(true);
break;
default:
set_rtl(false);
}
}
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
styleContent->docx_convert(*this);
end_automatic_style();
//push_text_properties(styleContent->get_style_text_properties());
return 1;
}
}
else
{
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
output_stream() << L"<w:pPr>";
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!get_text_tracked_context().dumpPPr_.empty())
{
output_stream() << get_text_tracked_context().dumpPPr_;
get_text_tracked_context().dumpPPr_.clear();
}
serialize_list_properties(output_stream());
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
{
output_stream() << L"<w:rPr>";
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
get_text_tracked_context().dumpRPrInsDel_.clear();
output_stream() << L"</w:rPr>";
}
output_stream() << L"</w:pPr>";
return 2;
}
}
return 0;
}
int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_attrs *Attr)
{
if (!Attr) return 0;
@ -1553,18 +1658,22 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
if (odf_reader::style_instance * styleInst =
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_)
)
{
process_page_break_after(styleInst);
if (styleInst->is_automatic())
{
if (odf_reader::style_content * styleContent = styleInst->content())
{
std::wstring id;
{
double font_size = odf_reader::text_format_properties_content::process_font_size_impl(odf_types::font_size(odf_types::percent(100.0)), styleInst);
if (font_size > 0) current_fontSize.push_back(font_size);
process_page_break_after(styleInst);
if (styleInst->is_automatic())
{
if (odf_reader::style_content * styleContent = styleInst->content())
{
std::wstring id;
//office_element_ptr parent_tab_stops_;
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
{
std::wstring parent_name = parentStyleContent->name();
id = styles_map_.get( parent_name, parentStyleContent->type() );
id = styles_map_.get( parent_name, parentStyleContent->type() );
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
{
@ -1572,7 +1681,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
}
}
start_automatic_style(id);
start_automatic_style(id);
calc_tab_stops(styleInst, get_tabs_context());
@ -1593,12 +1702,15 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
}
}
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
{
set_outline_level(*Attr->outline_level_ - 1);
}
styleContent->docx_convert(*this);
end_automatic_style();
push_text_properties(styleContent->get_style_text_properties());
push_text_properties(styleContent->get_style_text_properties());
if (!get_section_context().dump_.empty()
&& !get_table_context().in_table()
@ -1614,6 +1726,8 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
output_stream() << L"</w:pPr>";
finish_paragraph();
start_paragraph();
//process_paragraph_style(Context.get_current_paragraph_style()); ??
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
{
output_stream() << L"<w:pPr>";
@ -1632,65 +1746,59 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
output_stream() << L"</w:pPr>";
}
}
else if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
{
output_stream() << L"<w:pPr>";
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\"/>";
output_stream() << L"</w:pPr>";
}
return 1;
}
}
else
{
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
output_stream() << L"<w:pPr>";
//todooo причесать
if (!get_section_context().dump_.empty()
&& !get_table_context().in_table()
&& (get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
}
}
else
{
const std::wstring id = styles_map_.get( styleInst->name(), styleInst->type() );
output_stream() << L"<w:pPr>";
//todooo причесать
if (!get_section_context().dump_.empty()
&& !get_table_context().in_table()
&& (get_process_note() == oox::docx_conversion_context::noNote)
&& !in_drawing)
{
if (is_paragraph_header() )
{
if (is_paragraph_header() )
{
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
output_stream() << L"</w:pPr>";
finish_paragraph();
start_paragraph();
output_stream() << L"<w:pPr>";
}
else
{
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
}
output_stream() << L"</w:pPr>";
finish_paragraph();
start_paragraph();
output_stream() << L"<w:pPr>";
}
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!get_text_tracked_context().dumpPPr_.empty())
else
{
output_stream() << get_text_tracked_context().dumpPPr_;
get_text_tracked_context().dumpPPr_.clear();
output_stream() << get_section_context().dump_;
get_section_context().dump_.clear();
}
}
serialize_list_properties(output_stream());
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
{
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
}
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
{
output_stream() << L"<w:rPr>";
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
get_text_tracked_context().dumpRPrInsDel_.clear();
output_stream() << L"</w:rPr>";
}
output_stream() << L"</w:pPr>";
if (!get_text_tracked_context().dumpPPr_.empty())
{
output_stream() << get_text_tracked_context().dumpPPr_;
get_text_tracked_context().dumpPPr_.clear();
}
serialize_list_properties(output_stream());
if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
{
output_stream() << L"<w:outlineLvl w:val=\"" << *Attr->outline_level_ - 1 << L"\" />";
}
if (!get_text_tracked_context().dumpRPrInsDel_.empty())
{
output_stream() << L"<w:rPr>";
output_stream() << get_text_tracked_context().dumpRPrInsDel_;
get_text_tracked_context().dumpRPrInsDel_.clear();
output_stream() << L"</w:rPr>";
}
output_stream() << L"</w:pPr>";
return 2;
}
}
@ -1741,28 +1849,27 @@ void docx_conversion_context::process_page_break_after(const odf_reader::style_i
}
void docx_conversion_context::serialize_list_properties(std::wostream & strm)
{
if (!list_style_stack_.empty())
if (list_style_stack_.empty()) return;
if (first_element_list_item_)
{
if (first_element_list_item_)
{
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
const int id = root()->odf_context().listStyleContainer().id_by_name( current_list_style() );
CP_XML_WRITER(strm)
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:numPr")
{
CP_XML_NODE(L"w:numPr")
CP_XML_NODE(L"w:ilvl")
{
CP_XML_NODE(L"w:ilvl")
{
CP_XML_ATTR(L"w:val", (list_style_stack_.size() - 1));
}
CP_XML_NODE(L"w:numId")
{
CP_XML_ATTR(L"w:val", id );
}
CP_XML_ATTR(L"w:val", (list_style_stack_.size() - 1));
}
CP_XML_NODE(L"w:numId")
{
CP_XML_ATTR(L"w:val", id );
}
}
first_element_list_item_ = false;
}
}
first_element_list_item_ = false;
}
}
@ -1818,7 +1925,7 @@ namespace
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
rels internal_rels;
Context.get_mediaitems().dump_rels(internal_rels);
Context.get_mediaitems()->dump_rels(internal_rels);
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
@ -1928,12 +2035,12 @@ void notes_context::dump_rels(rels & Rels) const
void docx_conversion_context::add_note_reference ()
{
if (process_note_ == footNote || process_note_ == endNote)
if (current_process_note_ == footNote || current_process_note_ == endNote)
{
add_element_to_run(_T(""));
output_stream() << ((process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
output_stream() << ((current_process_note_ == footNote) ? L"<w:footnoteRef />" : L"<w:endnoteRef />");
finish_run();
process_note_ = (NoteType) (process_note_ + 1); //add ref set
current_process_note_ = (NoteType) (current_process_note_ + 1); //add ref set
}
}
@ -1982,7 +2089,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id)
void docx_conversion_context::start_changes()
{
if (map_current_changes_.empty()) return;
if (process_comment_) return;
if (current_process_comment_) return;
text_tracked_context_.dumpPPr_.clear();
text_tracked_context_.dumpRPr_.clear();
@ -2081,7 +2188,7 @@ void docx_conversion_context::start_changes()
void docx_conversion_context::end_changes()
{
if (process_comment_) return;
if (current_process_comment_) return;
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
{

View File

@ -42,6 +42,7 @@
#include "docx_table_context.h"
#include "oox_conversion_context.h"
#include "oox_chart_context.h"
#include "xlsx_drawing_context.h"
#include "headers_footers.h"
#include "hyperlinks.h"
@ -734,7 +735,7 @@ class docx_conversion_context : boost::noncopyable
public:
enum NoteType { noNote, footNote, footNoteRefSet, endNote, endNoteRefSet };
docx_conversion_context(odf_reader::odf_document * OdfDocument);
docx_conversion_context(odf_reader::odf_document * _odf_document);
~docx_conversion_context();
void set_output_document (package::docx_document * document);
@ -829,6 +830,7 @@ public:
bool process_page_properties(std::wostream & strm);
void process_section (std::wostream & strm, odf_reader::style_columns * columns = NULL);
int process_paragraph_style (const std::wstring & style_name);
int process_paragraph_attr (odf_reader::text::paragraph_attrs *attr);
int process_text_attr (odf_reader::text::paragraph_attrs *Attr);
void process_page_break_after(const odf_reader::style_instance *styleInst);
@ -872,8 +874,8 @@ public:
void start_text_list_style (const std::wstring & StyleName);
void end_text_list_style ();
const std::wstring & get_text_list_style_name();
const std::wstring current_list_style () const;
std::wstring get_text_list_style_name();
std::wstring current_list_style();
void start_list (const std::wstring & StyleName, bool Continue = false);
void end_list ();
@ -887,7 +889,7 @@ public:
styles_map * get_style_map() { return &styles_map_; }
mediaitems & get_mediaitems() {return mediaitems_;}
mediaitems_ptr & get_mediaitems() {return mediaitems_;}
styles_context & get_styles_context() { return styles_context_; }
drawing_context & get_drawing_context() { return drawing_context_; }
comments_context & get_comments_context() { return comments_context_; }
@ -897,8 +899,9 @@ public:
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
forms_context & get_forms_context() { return forms_context_; }
tabs_context & get_tabs_context() { return tabs_context_;}
table_content_context & get_table_content_context() { return table_content_context_;}
table_content_context & get_table_content_context() { return table_content_context_;}
xlsx_drawing_context_handle_ptr & get_chart_drawing_handle() { return chart_drawing_handle_;}
void set_drawing_text_props (const std::wstring &props);
@ -910,23 +913,32 @@ public:
StreamsManPtr get_stream_man() const { return streams_man_; }
void set_stream_man(StreamsManPtr Sm) { streams_man_ = Sm; }
void set_rtl(bool val) { is_rtl_ = val; }
bool get_rtl() const {return is_rtl_;}
void set_rtl(bool val) { is_rtl_ = val; }
bool get_rtl() const {return is_rtl_;}
double get_current_fontSize() {return current_fontSize.empty() ? 0 : current_fontSize.back();}
void pop_current_fontSize() {if (!current_fontSize.empty()) current_fontSize.pop_back();}
void set_margin_left(int val) {current_margin_left_ = val;}
int get_margin_left() {return current_margin_left_;}
void set_process_note (NoteType Val) { process_note_ = Val; }
NoteType get_process_note () const { return process_note_; }
void set_outline_level(int val) {current_outline_level_ = val;}
int get_outline_level() {return current_outline_level_;}
void set_process_note (NoteType Val) { current_process_note_ = Val; }
NoteType get_process_note () const { return current_process_note_; }
void add_note_reference ();
void start_paragraph_style(const std::wstring& style_name) {paragraph_style_stack_.push_back(style_name);}
void end_paragraph_style() { if (!paragraph_style_stack_.empty()) paragraph_style_stack_.pop_back();}
std::wstring get_current_paragraph_style() {return paragraph_style_stack_.empty() ? L"" : paragraph_style_stack_.back();}
oox_chart_context & current_chart();
void start_chart(std::wstring name);
void end_chart ();
void start_comment () {process_comment_ = true;}
void end_comment () {process_comment_ = false;}
bool process_comment_;
void start_comment () {current_process_comment_ = true;}
void end_comment () {current_process_comment_ = false;}
void start_math_formula ();
void end_math_formula ();
@ -945,7 +957,7 @@ public:
headers_footers & get_headers_footers() { return headers_footers_; }
header_footer_context & get_header_footer_context() { return header_footer_context_; }
drop_cap_context & get_drop_cap_context() {return drop_cap_context_;}
drop_cap_context & get_drop_cap_context() { return drop_cap_context_; }
styles_map styles_map_;
bool process_headers_footers_;
@ -956,6 +968,7 @@ public:
void end_changes();
void add_jsaProject(const std::string &content);
private:
struct _context_state
@ -982,6 +995,8 @@ private:
std::wstringstream settings_xml_;
std::wstringstream meta_xml_;
xlsx_drawing_context_handle_ptr chart_drawing_handle_;
styles_context styles_context_;
math_context math_context_;
drawing_context drawing_context_;
@ -1004,18 +1019,18 @@ private:
std::vector<odf_reader::_property> settings_properties_;
hyperlinks hyperlinks_;
mediaitems mediaitems_;
mediaitems_ptr mediaitems_;
std::vector<oox_chart_context_ptr> charts_;
headers_footers headers_footers_;
std::wstring automatic_parent_style_;
std::wstring current_master_page_name_;
std::wstring text_list_style_name_;
std::vector<std::wstring> list_style_stack_;
std::vector<std::wstring> fields_names_stack_;
std::wstring automatic_parent_style_;
std::wstring current_master_page_name_;
std::wstring text_list_style_name_;
std::vector<std::wstring> paragraph_style_stack_;
std::vector<std::wstring> list_style_stack_;
std::vector<std::wstring> fields_names_stack_;
bool first_element_list_item_;
bool first_element_list_item_;
bool page_break_after_;
bool page_break_before_;
@ -1029,10 +1044,13 @@ private:
bool is_delete_text_;
bool is_rtl_; // right-to-left
std::wstring current_alphabetic_index_;
int current_margin_left_;
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
NoteType process_note_;
NoteType current_process_note_;
bool current_process_comment_;
std::vector<double> current_fontSize;
std::wstring current_alphabetic_index_;
int current_margin_left_;
int current_outline_level_;
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
std::vector<odf_reader::office_element*> delayed_elements_;

View File

@ -151,7 +151,6 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
break;
case odf_types::style_wrap::Left:
case odf_types::style_wrap::Right:
case odf_types::style_wrap::Dynamic:
serialize_wrap_square(strm, val);
break;
case odf_types::style_wrap::RunThrough:
@ -160,6 +159,7 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
case odf_types::style_wrap::None:
serialize_wrap_top_bottom(strm, val);
break;
case odf_types::style_wrap::Dynamic:
default:
CP_XML_NODE(L"wp:wrapTopAndBottom");
break;

View File

@ -102,7 +102,11 @@ void word_files::write(const std::wstring & RootPath)
{
embeddings_->write( path );
}
if (drawings_)
{
drawings_->set_main_document(get_main_document());
drawings_->write( path );
}
if (headers_footers_)
{
headers_footers_->write( path );
@ -140,22 +144,22 @@ 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());
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
}
void word_files::set_media(mediaitems & _Mediaitems)
void word_files::set_media(mediaitems_ptr & _mediaitems)
{
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
if (_mediaitems->count_image + _mediaitems->count_media > 0)
{
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
}
if (_Mediaitems.count_object > 0)
if (_mediaitems->count_object > 0)
{
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
embeddings_ = element_ptr( new embeddings(_mediaitems) );
embeddings_->set_main_document( get_main_document() );
}
}
@ -195,6 +199,10 @@ void word_files::add_jsaProject(const std::string &content)
{
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
}
void word_files::set_drawings(element_ptr Element)
{
drawings_ = Element;
}
void word_files::set_headers_footers(headers_footers & HeadersFooters)
{
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);

View File

@ -137,10 +137,11 @@ public:
void set_numbering (element_ptr Element);
void set_settings (element_ptr Element);
bool has_numbering ();
void set_media (mediaitems & mediaitems_);
void set_media (mediaitems_ptr & mediaitems_);
void set_headers_footers(headers_footers & HeadersFooters);
void set_notes (notes_context & notesContext);
void set_comments (comments_context & commentsContext);
void set_drawings (element_ptr Element);
void add_charts(chart_content_ptr chart);
void add_jsaProject(const std::string &content);
@ -163,6 +164,7 @@ private:
element_ptr settings_;
element_ptr comments_;
element_ptr jsaProject_;
element_ptr drawings_;
};

View File

@ -62,6 +62,9 @@ struct drawing_object_description
double anchor_x_;
double anchor_y_;
_CP_OPT(_INT32) owner_cx_;
_CP_OPT(_INT32) owner_cy_;
_action_desc action_;
std::vector<_hlink_desc> hlinks_;

View File

@ -73,7 +73,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"xxxxx" , 0, 0)))
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
return std::pair<float, float>(7,8);
TBBox box;
@ -96,7 +96,7 @@ 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) /3. /5.;
double width = (minWidth + 2 * maxWidth) /36. /3.;
return std::pair<float, float>(width, maxHeight);
}

View File

@ -101,6 +101,7 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
if (applicationFonts_)
applicationFonts_->InitializeFromFolder(pathFonts);
}
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
{
std::wstring ref;
@ -193,7 +194,14 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
CImageFileFormatChecker image_checker;
sExt = image_checker.DetectFormatByData(buffer, buffer_size);
if (!sExt.empty()) sExt = std::wstring(L".") + sExt;
if (sExt.empty())
{
size_t n = fileName.rfind(L".");
if (n != std::wstring::npos)
sExt = XmlUtils::GetLower(fileName.substr(n));
}
else sExt = std::wstring(L".") + sExt;
}
return XmlUtils::GetLower(sExt);
}
@ -329,6 +337,10 @@ void mediaitems::dump_rels(rels & Rels)
{
for (size_t i = 0; i < items_.size(); i++)
{
if ( items_[i].type == typeUnknown ) continue;
if ( items_[i].type == typeShape ) continue;
if ( items_[i].type == typeGroupShape ) continue;
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
Rels.add( relationship(
@ -338,7 +350,7 @@ void mediaitems::dump_rels(rels & Rels)
items_[i].mediaInternal ? L"" : L"External" )
);
items_[i].count_used++;
}
}
}

View File

@ -123,19 +123,21 @@ public:
if (sExt == L"wmv") return typeVideo;
if (sExt == L"avi") return typeVideo;
if (sExt == L"wmv") return typeVideo;
if (sExt == L"wma") return typeAudio;
if (sExt == L"wav") return typeAudio;
if (sExt == L"mp3") return typeAudio;
if (sExt == L"m4a") return typeAudio;
if (sExt == L"m4v") return typeVideo;
if (sExt == L"mp4") return typeVideo;
if (sExt == L"mov") return typeVideo;
if (sExt == L"mkv") return typeVideo;
if (sExt == L"webm") return typeVideo;
if (sExt == L"wmv") return typeVideo;
if (sExt == L"wma") return typeAudio;
if (sExt == L"wav") return typeAudio;
if (sExt == L"mp3") return typeAudio;
if (sExt == L"m4a") return typeAudio;
return typeMedia;
}
private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (const std::wstring &fileName);
@ -146,6 +148,7 @@ private:
NSFonts::IApplicationFonts *applicationFonts_;
};
typedef _CP_PTR(mediaitems) mediaitems_ptr;
}
}

View File

@ -122,6 +122,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
oox_chart_shape shape;
_CP_OPT(bool) boolVal;
_CP_OPT(std::wstring) strVal;
_CP_OPT(double) doubleVal;
oox_title title;
title.set_content(content_.title_);//todo нужно задать понармальному layout
@ -146,7 +147,23 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
CP_XML_ATTR(L"val", "minMax");//default
}
}
odf_reader::GetProperty(content_.properties_,L"logarithmic",boolVal);
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
if (doubleVal)
{
CP_XML_NODE(L"c:max")
{
CP_XML_ATTR(L"val", *doubleVal);
}
}
odf_reader::GetProperty(content_.properties_,L"minimum", doubleVal);
if (doubleVal)
{
CP_XML_NODE(L"c:min")
{
CP_XML_ATTR(L"val", *doubleVal);
}
}
odf_reader::GetProperty(content_.properties_,L"logarithmic", boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_NODE(L"c:logBase")

View File

@ -53,7 +53,7 @@ public:
std::wstring drawingId_;
};
oox_chart_context::oox_chart_context(mediaitems & m, std::wstring name) :
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) :
impl_(new oox_chart_context::Impl( name)), mediaitems_(m)
{
@ -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);
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
}
@ -75,9 +75,15 @@ 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);
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
}
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)
{
bool isInternal = true;
userShapesId_ = link.second;
rels_.push_back(_rel(isInternal, userShapesId_, link.first, typeChartUserShapes));
}
std::wostream & oox_chart_context::chartData()
{
return impl_->chartData_;
@ -116,6 +122,15 @@ void oox_chart_context::dump_rels(rels & Rels)
(r.is_internal ? L"" : L"External"))
);
}
else if (r.type == typeChartUserShapes)
{
Rels.add(relationship(
r.rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes",
r.is_internal ? std::wstring(L"../drawings/") + r.ref : r.ref,
(r.is_internal ? L"" : L"External"))
);
}
}
}
@ -226,6 +241,13 @@ void oox_chart_context::serialize(std::wostream & strm)
}
}
}
if (userShapesId_.empty() == false)
{
CP_XML_NODE(L"c:userShapes")
{
CP_XML_ATTR(L"r:id", userShapesId_);
}
}
}
}
}

View File

@ -53,7 +53,7 @@ typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
class oox_chart_context
{
public:
oox_chart_context(mediaitems & mediaitems_, std::wstring name);
oox_chart_context(mediaitems_ptr & mediaitems_, std::wstring name);
~oox_chart_context();
std::wostream & chartData();
@ -83,6 +83,8 @@ public:
}
}
void set_externalData(const std::wstring & href);
void set_userShapes(std::pair<std::wstring, std::wstring> &link);
void add_chart(int type)
{
plot_area_.add_chart(type);
@ -128,7 +130,7 @@ private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
mediaitems &mediaitems_;
mediaitems_ptr mediaitems_;
std::vector<_rel> rels_;
cpdoccore::oox::oox_title title_;
@ -137,6 +139,7 @@ private:
std::wstring pivot_source_;
std::wstring externalDataId_;
std::wstring userShapesId_;
std::vector<odf_reader::_property> graphic_properties_;
_oox_fill fill_;

View File

@ -59,12 +59,19 @@ oox_chart_series::oox_chart_series()
bLocalTable_ = false;
labelPosEnabled_ = true;
}
void oox_chart_series::setName(std::wstring &value)
void oox_chart_series::setName(const std::wstring &value)
{
name_=value;
name_ = value;
}
void oox_chart_series::setLabels(const std::wstring &formula, std::vector<std::wstring> & cash)
{
formulasconvert::odf2oox_converter converter;
void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & formatCode, bool link_to_source)
label_.present = true;
label_.formula = converter.convert_chart_distance(formula);
label_.str_cache = cash;
}
void oox_chart_series::setFormula(int ind, const std::wstring &value, const std::wstring & formatCode, bool link_to_source)
{
formulasconvert::odf2oox_converter converter;
@ -137,6 +144,7 @@ void oox_chart_series::parse_properties()
data_labels_->set_position(*intVal);
}
}
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{
values_[ind].present = true;
@ -215,6 +223,44 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
shape.set(content_.graphic_properties_, content_.fill_);
shape.oox_serialize(_Wostream);
if (label_.present)
{
CP_XML_NODE(L"c:tx")
{
CP_XML_NODE(L"c:strRef")
{
if (!label_.formula.empty())
{
CP_XML_NODE(L"c:f")
{
CP_XML_STREAM() << label_.formula;
}
}
if (false == label_.str_cache.empty())
{
CP_XML_NODE(L"c:strCache")
{
CP_XML_NODE(L"c:ptCount")
{
CP_XML_ATTR(L"val", label_.str_cache.size());
}
for (size_t i = 0; i < label_.str_cache.size(); i++)
{
CP_XML_NODE(L"c:pt")
{
CP_XML_ATTR(L"idx", i);
CP_XML_NODE(L"c:v")
{
CP_XML_STREAM() << label_.str_cache[i];
}
}
}
}
}
}
}
}
for (int i = 0; i < 5; i++)
{
if (values_[i].present)

View File

@ -56,17 +56,20 @@ public:
virtual void oox_serialize(std::wostream & _Wostream) = 0;
bool labelPosEnabled_;
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
_oox_chart_values values_[5]; //cat, common, x, y, bubble,
_oox_strRef label_; //tx (Series Text) §21.2.2.215
int id_;
std::wstring name_; //tx (Series Text) §21.2.2.215
std::wstring name_;
int iSymbolMarkerType_;
bool bLocalTable_;
_CP_OPT(oox_data_labels) data_labels_;
void setName(std::wstring &value);
void setName(const std::wstring &value);
void setFormula (int ind, std::wstring & value, std::wstring & formatCode, bool link_to_source);
void setFormula (int ind, const std::wstring & value, const std::wstring & formatCode, bool link_to_source);
void setValues (int ind, std::vector<std::wstring> & values);
void setLabels (const std::wstring &formula, std::vector<std::wstring> & values);
void parse_properties();
void set_cache_only (bool val);

View File

@ -55,21 +55,21 @@ struct _oox_numLit
struct _oox_strRef
{
bool present;
bool present = false;
std::wstring formula;
int str_cache_count;
int str_cache_count = 0;
std::vector<std::wstring> str_cache;
};
struct _oox_numRef
{
bool present;
bool present = false;
std::wstring formula;
std::wstring formatCode;
bool link_to_source;
int num_cache_count;
bool link_to_source = false;
int num_cache_count = 0;
std::vector<std::wstring> num_cache;
};

View File

@ -131,7 +131,16 @@ static const std::wstring _ooxDashStyle[]=
L"dashDot",
L"sysDashDotDot"
};
static const std::wstring _vmlDashStyle[]=
{
L"none",
L"solid",
L"dot",
L"dash",
L"dash",
L"dashdot",
L"shortdashdotdot"
};
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw, const std::wstring &ns)
{
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
@ -152,7 +161,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
odf_reader::GetProperty(prop, L"stroke" , iStroke);
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
if ((!strStrokeColor && !iStroke && !dStrokeWidth) && !always_draw)return;
CP_XML_WRITER(strm)
@ -224,6 +233,69 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
}
}
}
void vml_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
{
_CP_OPT(std::wstring) strStrokeColor;
_CP_OPT(int) iStroke;
_CP_OPT(double) dStrokeWidth;
_CP_OPT(double) dStrokeOpacity;
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop, L"wordArt", bWordArt);
odf_reader::GetProperty(prop, L"stroke-color" , strStrokeColor);
odf_reader::GetProperty(prop, L"stroke" , iStroke);
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
if (!strStrokeColor && !iStroke && !dStrokeWidth) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:stroke")
{
std::wstring color, dash_style ;
if (strStrokeColor) color = *strStrokeColor;
if (iStroke)
{
if (iStroke.get() != 0 ) dash_style = _vmlDashStyle[iStroke.get()];
}
if ((dStrokeWidth) && (*dStrokeWidth >= 0))
{
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
if (val < 10) val = 12700;
CP_XML_ATTR(L"weight", val);
}
if (false == color.empty())
{
CP_XML_ATTR(L"color", L"#" + color);
}
if (!dash_style.empty() && dash_style != L"solid")
{
CP_XML_ATTR(L"dashstyle", dash_style);
}
//odf_reader::GetProperty(prop,L"marker-start", strVal);
//if (strVal)
//{
//}
//odf_reader::GetProperty(prop,L"marker-end",strVal);
//if (strVal)
//{
//}
CP_XML_ATTR(L"startarrow", L"block");
CP_XML_ATTR(L"startarrowwidth", L"medium");
CP_XML_ATTR(L"startarrowlength", L"medium");
CP_XML_ATTR(L"joinstyle", L"round");
CP_XML_ATTR(L"endcap", L"flat");
}
}
}
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset, const std::wstring &ns)
{
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
@ -377,8 +449,7 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
}
else if ((bFitToSize) && (*bFitToSize))
{
CP_XML_NODE(L"a:noAutofit");
//CP_XML_NODE(L"a:spAutoFit")
CP_XML_NODE(L"a:normAutofit");
//{
// CP_XML_ATTR(L"lnSpcReduction", 10000);
//}

View File

@ -124,6 +124,7 @@ namespace oox {
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset, const std::wstring &ns = L"a");
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
void vml_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val);
}
}

View File

@ -245,7 +245,7 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.gradient->colors.empty())
{
CP_XML_ATTR(L"color2", val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
CP_XML_ATTR(L"color2", L"#" + val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
std::wstring colors_value;
for (size_t i = 0; i < val.gradient->colors.size(); i++)
@ -404,6 +404,27 @@ void vml_serialize_background (std::wostream & strm, const _oox_fill & val, cons
}
}
void vml_serialize_fill (std::wostream & strm, const _oox_fill & val)
{
switch (val.type)
{
case 0:
break;
case 1:
vml_serialize_solid_fill(strm, val);
break;
case 2:
vml_serialize_bitmap_fill(strm, val);
break;
case 3:
vml_serialize_gradient_fill(strm, val);
break;
case 4:
//vml_serialize_hatch_fill(strm, val);
break;
}
}
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
{
switch (val.type)

View File

@ -154,5 +154,6 @@ namespace oox {
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
void vml_serialize_fill (std::wostream & strm, const _oox_fill & val);
}
}

View File

@ -75,6 +75,7 @@ static std::wstring get_mime_type(const std::wstring & extension)
else if (L"tiff" == extension) return L"image/x-tiff";
else if (L"pdf" == extension) return L"application/pdf";
else if (L"bmp" == extension) return L"image/bmp";
else if (L"wdp" == extension) return L"image/vnd.ms-photo";
else if (L"wav" == extension) return L"audio/wav";
else if (L"mp3" == extension) return L"audio/mpeg";
@ -172,6 +173,26 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
return true;
}
void content_types_file::set_media(mediaitems_ptr & _Mediaitems)
{
std::vector<mediaitems::item> & items_ = _Mediaitems->items();
for (size_t i = 0; i < items_.size(); i++)
{
if ((items_[i].type == typeImage ||
items_[i].type == typeMedia ||
items_[i].type == typeVideo ||
items_[i].type == typeAudio) && items_[i].mediaInternal)
{
int n = items_[i].outputName.rfind(L".");
if (n > 0)
{
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
}
}
}
}
void content_types_file::set_media(mediaitems & _Mediaitems)
{
@ -348,7 +369,7 @@ void docProps_files::write(const std::wstring & RootPath)
////////////
media::media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaitems_(_Mediaitems), appFonts_(pAppFonts)
media::media(mediaitems_ptr & _mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaItems_(_mediaitems), appFonts_(pAppFonts)
{
}
@ -357,7 +378,8 @@ void media::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
NSDirectory::CreateDirectory(path.c_str());
mediaitems::items_array & items = mediaitems_.items();
mediaitems::items_array & items = mediaItems_->items();
for (size_t i = 0; i < items.size(); i++ )
{
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
@ -380,7 +402,7 @@ void media::write(const std::wstring & RootPath)
}
//------------------------------------------------------------------------------------------------------------
charts::charts(mediaitems & _ChartsItems) : chartsitems_(_ChartsItems)
charts::charts(mediaitems_ptr & _chartsItems) : chartsItems_(_chartsItems)
{
}
@ -389,7 +411,7 @@ void charts::write(const std::wstring & RootPath)
}
//--------------------------------------------------------------------------------------------------------------
embeddings::embeddings(mediaitems & _EmbeddingsItems) : embeddingsitems_(_EmbeddingsItems)
embeddings::embeddings(mediaitems_ptr & _EmbeddingsItems) : embeddingsItems_(_EmbeddingsItems)
{
}
void embeddings::write(const std::wstring & RootPath)
@ -399,7 +421,8 @@ void embeddings::write(const std::wstring & RootPath)
content_types_file & content_types = get_main_document()->get_content_types_file();
mediaitems::items_array & items = embeddingsitems_.items();
mediaitems::items_array & items = embeddingsItems_->items();
for (size_t i = 0; i < items.size(); i++ )
{
if ( items[i].mediaInternal && items[i].valid &&

View File

@ -51,6 +51,7 @@ namespace cpdoccore {
namespace oox {
class mediaitems;
typedef _CP_PTR(mediaitems) mediaitems_ptr;
namespace package {
@ -81,16 +82,17 @@ inline element::~element()
class content_types_file : public element
{
public:
content_types_file ();
void write (const std::wstring & RootPath);
bool add_or_find_default (const std::wstring & extension);
bool add_or_find_override(const std::wstring & fileName);
void set_media (mediaitems & _Mediaitems);
content_type * content ();
content_types_file ();
void write (const std::wstring & RootPath);
bool add_or_find_default (const std::wstring & extension);
bool add_or_find_override(const std::wstring & fileName);
void set_media (mediaitems & _Mediaitems);
void set_media (mediaitems_ptr & _Mediaitems);
content_type* content ();
private:
content_type content_type_content_;
std::wstring filename_;
std::wstring filename_;
};
class simple_element;
@ -189,8 +191,8 @@ public:
std::wstring str() { return content_.str(); }
static _CP_PTR(chart_content) create();
private:
std::wstringstream content_;
rels_file_ptr rels_;
std::wstringstream content_;
rels_file_ptr rels_;
};
//------------------------------------------------------------------------
class document : public element
@ -228,39 +230,39 @@ private:
class media : public element
{
public:
media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
media(mediaitems_ptr & _mediaItems, NSFonts::IApplicationFonts *pAppFonts);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems & mediaitems_;
NSFonts::IApplicationFonts * appFonts_;
mediaitems_ptr mediaItems_;
NSFonts::IApplicationFonts* appFonts_;
};
class charts : public element
{
public:
charts(mediaitems & _ChartsItems);
charts(mediaitems_ptr & _chartsItems);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems & chartsitems_;
mediaitems_ptr chartsItems_;
};
class embeddings : public element
{
public:
embeddings(mediaitems & _EmbeddingsItems);
embeddings(mediaitems_ptr & _embeddingsItems);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems & embeddingsitems_;
mediaitems_ptr embeddingsItems_;
};
} // namespace package

View File

@ -43,6 +43,7 @@ namespace oox {
enum RelsType
{
typeUnknown = 0,
typeDefault,
typeImage,
typeChart,
typeShape,
@ -59,7 +60,8 @@ enum RelsType
typeExternalLink,
typeActiveX,
typeControl,
typeControlProps
typeControlProps,
typeChartUserShapes
};
struct _rel
@ -71,10 +73,10 @@ struct _rel
type(type_)
{}
bool is_internal;
std::wstring rid;
std::wstring ref;
RelsType type;
bool is_internal;
std::wstring rid;
std::wstring ref;
RelsType type;
};
class relationship : public xml::element_impl<relationship>

View File

@ -46,13 +46,13 @@ void oox_chart::set_cache_only (bool val)
}
void oox_chart::set_formula_series(int ind, std::wstring val, std::wstring formatCode, bool link_to_source)
void oox_chart::set_formula_series(int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source)
{
oox_series_ptr & current_ptr = series_.back();
current_ptr->setFormula(ind, val, formatCode, link_to_source);
}
void oox_chart::set_name(std::wstring val)
void oox_chart::set_name(const std::wstring& val)
{
oox_series_ptr & current_ptr = series_.back();
current_ptr->setName(val);
@ -68,6 +68,13 @@ void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
oox_series_ptr & current_ptr = series_.back();
current_ptr->setValues (ind, val);
}
void oox_chart::set_label_series(const std::wstring& formula, std::vector<std::wstring> & cash)
{
if (formula.empty() && cash.empty()) return;
oox_series_ptr & current_ptr = series_.back();
current_ptr->setLabels (formula, cash);
}
void oox_chart::set_properties(std::vector<odf_reader::_property> g)
{
_CP_OPT(int) iVal;

View File

@ -78,9 +78,10 @@ public:
virtual void add_series(int id){}
void set_cache_only (bool val);
void set_formula_series (int ind, std::wstring val, std::wstring formatCode, bool link_to_source);
void set_formula_series (int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source);
void set_values_series (int ind, std::vector<std::wstring> & val);
void set_name (std::wstring val);
void set_label_series (const std::wstring& formula, std::vector<std::wstring> & val);
void set_name (const std::wstring& val);
void set_content_series (odf_reader::chart::series & content);
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}

View File

@ -51,7 +51,7 @@ public:
{
}
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments)
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, pptx_comments_ptr comments)
{
const std::wstring file_id = std::to_wstring(next_file_id_++);

View File

@ -83,7 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
{
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
pptx_slide_context_.get_mediaitems()->set_font_directory(pathFonts);
}
void pptx_conversion_context::process_layouts()

View File

@ -133,7 +133,7 @@ public:
pptx_table_context & get_table_context() { return pptx_table_context_; }
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
mediaitems_ptr & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
//void start_hyperlink(const std::wstring & styleName);
//void end_hyperlink(std::wstring const & href);

View File

@ -509,15 +509,15 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
{
notesMaster_files_.add_slide(slide);
}
void ppt_files::set_media(mediaitems & _Mediaitems)
void ppt_files::set_media(mediaitems_ptr & _mediaitems)
{
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
if (_mediaitems->count_image + _mediaitems->count_media > 0)
{
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
}
if (_Mediaitems.count_object > 0)
if (_mediaitems->count_object > 0)
{
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
embeddings_ = element_ptr( new embeddings(_mediaitems) );
}
}
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)

View File

@ -217,7 +217,7 @@ public:
void add_notes (slide_content_ptr sheet);
void add_notesMaster(slide_content_ptr sheet);
void set_media(mediaitems & _Mediaitems);
void set_media(mediaitems_ptr & _mediaitems);
void add_charts(chart_content_ptr chart);
void add_theme (pptx_xml_theme_ptr theme);

View File

@ -65,8 +65,10 @@ public:
bool onClick;
};
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket), odfPacket_(odfPacket)
Impl(const std::wstring & _odfPacket) : odfPacket_(_odfPacket)
{
mediaitems_ = boost::make_shared<mediaitems>(odfPacket_);
clear();
}
@ -88,7 +90,7 @@ public:
{
pptx_drawings_->add(isInternal, rid, ref, type);
}
mediaitems & get_mediaitems() { return mediaitems_; }
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
bool empty() const
{
@ -138,7 +140,7 @@ private:
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
size_t rId_;
mediaitems mediaitems_;
mediaitems_ptr mediaitems_;
pptx_drawings_ptr pptx_drawings_;
pptx_drawings_ptr pptx_notes_drawings_;
};
@ -357,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);
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
}
impl_->background_fill_ = fill;
@ -421,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);
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
}
else
@ -493,6 +495,10 @@ void pptx_slide_context::set_image(const std::wstring & path)
impl_->object_description_.type_ = typeImage;
impl_->object_description_.xlink_href_ = path;
}
else if (impl_->object_description_.type_ == typeImage && impl_->object_description_.xlink_href_.rfind(L".svg") != std::wstring::npos)
{
impl_->object_description_.xlink_href_ = path;
}
else if (impl_->use_image_replacement_)
{
impl_->object_description_.fill_.type = 2;
@ -562,7 +568,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
}
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems().applicationFonts());
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems()->applicationFonts());
drawing.fill.bitmap->bStretch = true;
if ((sColorMode) && (*sColorMode == L"greyscale"))
@ -572,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);
drawing.fill.bitmap->isInternal = isMediaInternal;
if (drawing.type == typeShape)
@ -580,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);
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
@ -595,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);
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
}
@ -604,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);
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
@ -619,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);
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);
////////////////////////////////////////////////////////////////
_CP_OPT(std::wstring) sPlaceHolderType;
@ -647,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);
drawing.objectProgId = obj.descriptor_;
if (!drawing.fill.bitmap)
@ -658,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);
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
@ -670,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);
drawing.extId = L"ext" + drawing.objectId;
drawing.extExternal = !isMediaInternal;
@ -681,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);
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
@ -714,7 +720,7 @@ void pptx_slide_context::dump_rels(rels & Rels)
impl_->get_drawings()->dump_rels(Rels);
}
mediaitems & pptx_slide_context::get_mediaitems()
mediaitems_ptr & pptx_slide_context::get_mediaitems()
{
return impl_->get_mediaitems();
}

View File

@ -116,7 +116,7 @@ public:
void process_drawings();
mediaitems & get_mediaitems();
mediaitems_ptr & get_mediaitems();
void add_background (_oox_fill & fill);

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);
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
}
oox::oox_serialize_fill(CP_XML_STREAM(), fill);

View File

@ -39,14 +39,14 @@
namespace cpdoccore {
namespace oox {
unsigned int hex_string_to_int(std::wstring str)
{
unsigned int x;
std::wstringstream ss;
ss << std::hex << str;
ss >> x;
return x;
}
unsigned int hex_string_to_int(std::wstring str)
{
unsigned int x;
std::wstringstream ss;
ss << std::hex << str;
ss >> x;
return x;
}
class xlsx_comments::Impl
{
@ -82,6 +82,7 @@ public:
{
CP_XML_ATTR(L"ref", c.ref_);
CP_XML_ATTR(L"authorId", c.author_);
CP_XML_ATTR(L"shapeId", 0);
CP_XML_NODE(L"text")
{
@ -94,127 +95,6 @@ public:
}
}
}
void serialize_vml(std::wostream & strm) const
{
_CP_OPT(std::wstring) strVal;
_CP_OPT(double) dVal;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"xml")
{
CP_XML_ATTR(L"xmlns:v", L"urn:schemas-microsoft-com:vml");
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
for (size_t i = 0; i < xlsx_comment_.size(); i++)
{
const _xlsx_comment & c = xlsx_comment_[i];
std::wstring str_fill_color_ = L"00003f";
if (odf_reader::GetProperty(c.graphicProperties_,L"fill-color",strVal))
str_fill_color_ = strVal.get();
CP_XML_NODE(L"v:shapetype")
{
CP_XML_ATTR(L"id", L"shapetype_202");
CP_XML_ATTR(L"coordsize", L"21600,21600");
CP_XML_ATTR(L"o:spt", L"202");
CP_XML_ATTR(L"path", L"m,l,21600l21600,21600l21600,xe");
CP_XML_NODE(L"v:stroke")
{
CP_XML_ATTR(L"joinstyle", L"miter");
}
CP_XML_NODE(L"v:path")
{
CP_XML_ATTR(L"gradientshapeok", L"t");
CP_XML_ATTR(L"o:connecttype", L"rect");
}
}
CP_XML_NODE(L"v:shape")
{
if( hex_string_to_int(str_fill_color_) !=0 )
{
CP_XML_ATTR(L"fillcolor", std::wstring(L"#") + str_fill_color_);
}//иначе это полная прозрачность
CP_XML_ATTR(L"id", L"shape_0");
std::wstring style = std::wstring(L"position:absolute;");
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
CP_XML_ATTR(L"style",style);
CP_XML_ATTR(L"type", L"shapetype_202");
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
//{
// CP_XML_ATTR(L"opacity", boost::lexical_cast<std::wstring>((int)(100.-dVal.get())) + L"%");
//}
//CP_XML_NODE(L"v:shadow")
//{
// CP_XML_ATTR(L"color", L"black");
// CP_XML_ATTR(L"obscured", L"t");
// CP_XML_ATTR(L"on", L"t");
//}
CP_XML_NODE(L"v:wrap")
{
CP_XML_ATTR(L"v:type", L"none");
}
CP_XML_NODE(L"v:fill")
{
CP_XML_ATTR(L"detectmouseclick", L"t");
if( hex_string_to_int(str_fill_color_) !=0 )
{
CP_XML_ATTR(L"color", std::wstring(L"#") + str_fill_color_);
CP_XML_ATTR(L"color2", std::wstring(L"#") + str_fill_color_);
CP_XML_ATTR(L"type", L"solid");
}//иначе это полная прозрачность
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
//{
// CP_XML_ATTR(L"opacity", (dVal.get())/100.);
// //CP_XML_ATTR(L"opacity2",(dVal.get())/100.);
//}
}
CP_XML_NODE(L"v:stroke")
{
if (odf_reader::GetProperty(c.graphicProperties_,L"stroke-color",strVal))
CP_XML_ATTR(L"color", std::wstring(L"#") + strVal.get());
else
CP_XML_ATTR(L"color",L"#3465af"); //синенький
if (odf_reader::GetProperty(c.graphicProperties_,L"stroke-opacity",dVal))
{
CP_XML_ATTR(L"opacity",(100.-dVal.get())/100.);
}
CP_XML_ATTR(L"endcap", L"flat");
CP_XML_ATTR(L"joinstyle", L"round");
CP_XML_ATTR(L"startarrow", L"block");
CP_XML_ATTR(L"v:startarrowwidth", L"medium");
CP_XML_ATTR(L"startarrowlength", L"medium");
}
CP_XML_NODE(L"x:ClientData")
{
CP_XML_ATTR(L"ObjectType", L"Note");
CP_XML_NODE(L"x:MoveWithCells"){}
CP_XML_NODE(L"x:SizeWithCells"){}
CP_XML_NODE(L"x:AutoFill"){CP_XML_CONTENT("False");}
CP_XML_NODE(L"x:Row"){CP_XML_CONTENT(c.row_);}
CP_XML_NODE(L"x:Column"){CP_XML_CONTENT(c.col_);}
}
}
}
}
}
}
bool empty() const
{
return ( xlsx_comment_.empty());
@ -264,11 +144,6 @@ void xlsx_serialize(std::wostream & _Wostream, xlsx_comments const & val)
val.impl_->serialize(_Wostream);
}
void xlsx_serialize_vml(std::wostream & _Wostream, xlsx_comments const & val)
{
val.impl_->serialize_vml(_Wostream);
}
xlsx_comments_ptr xlsx_comments::create()
{
return boost::make_shared<xlsx_comments>();

View File

@ -42,38 +42,24 @@ namespace oox {
struct _xlsx_comment
{
size_t left_, top_;
size_t width_, height_;
std::wstring ref_;
int col_;
int row_;
bool visibly_;
std::vector<odf_reader::_property> graphicProperties_;
std::wstring author_;
std::wstring content_;
};
//class rels;
class xlsx_comments;
typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
struct comment_elm
{
comment_elm(std::wstring const & _filename, std::wstring const & _vml_filename, std::wstring const & _content, std::wstring const & _vml_content, xlsx_comments_ptr _comments)
: filename(_filename), content(_content), comments(_comments),vml_filename(_vml_filename),vml_content(_vml_content)
comment_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_comments_ptr _comments)
: filename(_filename), content(_content), comments(_comments)
{}
xlsx_comments_ptr comments;
std::wstring filename;
std::wstring content;
std::wstring vml_filename;
std::wstring vml_content;
};
class xlsx_comments
@ -87,10 +73,7 @@ public:
void add(_xlsx_comment & d);
bool empty() const;
friend void docx_serialize(std::wostream & _Wostream, xlsx_comments const & val);
friend void xlsx_serialize(std::wostream & _Wostream, xlsx_comments const & val);
friend void xlsx_serialize_vml(std::wostream & _Wostream, xlsx_comments const & val);
private:
class Impl;

View File

@ -36,7 +36,6 @@
#include "../odf/datatypes/length.h"
#include "xlsx_utils.h"
//#include <formulasconvert.h>
namespace cpdoccore { namespace oox {
@ -46,32 +45,22 @@ typedef _CP_PTR(xlsx_comments) xlsx_comments_ptr;
class xlsx_comments_context_handle::Impl
{
public:
Impl()
: next_comments_id_(1) ,next_file_id_(1)
Impl() : next_comments_id_(1), next_file_id_(1)
{
}
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
{
const std::wstring file_id = std::to_wstring(next_file_id_++);
const std::wstring file_id = std::to_wstring(next_file_id_++);
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml";
const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments));
comments_.push_back(comment_elm(fileName, content, comments));
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId);
}
std::pair<std::wstring, std::wstring> get_vml_drawing_xml()
{
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId);
}
const std::vector<comment_elm> & content() const
{
return comments_;
@ -89,25 +78,17 @@ xlsx_comments_context_handle::xlsx_comments_context_handle()
: impl_(new xlsx_comments_context_handle::Impl())
{
}
xlsx_comments_context_handle::~xlsx_comments_context_handle()
{
}
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
{
return impl_->add_comments_xml(content,vml_content, comments);
return impl_->add_comments_xml(content, comments);
}
std::pair<std::wstring, std::wstring> xlsx_comments_context_handle::get_vml_drawing_xml()
{
return impl_->get_vml_drawing_xml();
}
const std::vector<comment_elm> & xlsx_comments_context_handle::content() const
{
return impl_->content();
}
class xlsx_comments_context::Impl
{
public:
@ -127,10 +108,6 @@ public:
{
xlsx_serialize(strm, *xlsx_comments_);
}
void serialize_vml(std::wostream & strm)
{
xlsx_serialize_vml(strm, *xlsx_comments_);
}
bool empty() const
{
return xlsx_comments_->empty();
@ -154,40 +131,20 @@ xlsx_comments_context::~xlsx_comments_context()
{
}
void xlsx_comments_context::start_comment (double width_pt, double height_pt, double x_pt, double y_pt)
void xlsx_comments_context::start_comment(const std::wstring & ref)
{
impl_->current_.ref_ = L"";
impl_->current_.width_ = width_pt;
impl_->current_.height_ = height_pt;
impl_->current_.left_ = x_pt;
impl_->current_.top_ = y_pt;
impl_->current_.visibly_ = false;
impl_->current_.ref_ = ref;
}
void xlsx_comments_context::add_content(std::wstring content)
void xlsx_comments_context::add_content(const std::wstring & content)
{
impl_->current_.content_ = content;
}
void xlsx_comments_context::add_author(std::wstring author)
void xlsx_comments_context::add_author(const std::wstring & author)
{
impl_->current_.author_ = author;
}
void xlsx_comments_context::set_visibly(bool Val)
void xlsx_comments_context::end_comment()
{
impl_->current_.visibly_ = Val;
}
std::vector<odf_reader::_property> & xlsx_comments_context::get_draw_properties()
{
return impl_->current_.graphicProperties_;
}
void xlsx_comments_context::end_comment(std::wstring ref,int col, int row)
{
impl_->current_.ref_ = ref;
impl_->current_.col_ = col;
impl_->current_.row_ = row;
impl_->add_comment(impl_->current_);
}
@ -200,11 +157,6 @@ void xlsx_comments_context::serialize(std::wostream & strm)
{
impl_->serialize(strm);
}
void xlsx_comments_context::serialize_vml(std::wostream & strm)
{
impl_->serialize_vml(strm);
}
xlsx_comments_ptr xlsx_comments_context::get_comments()
{
return impl_->get_comments();

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