diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sw/qa/extras/ww8export | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
206 files changed, 3829 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/all_gaps_word.doc b/sw/qa/extras/ww8export/data/all_gaps_word.doc Binary files differnew file mode 100644 index 000000000..d5c61a6c4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/all_gaps_word.doc diff --git a/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc Binary files differnew file mode 100644 index 000000000..c198c4aa4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc diff --git a/sw/qa/extras/ww8export/data/bnc636128.doc b/sw/qa/extras/ww8export/data/bnc636128.doc Binary files differnew file mode 100644 index 000000000..5f92c3e2e --- /dev/null +++ b/sw/qa/extras/ww8export/data/bnc636128.doc diff --git a/sw/qa/extras/ww8export/data/bnc787942.doc b/sw/qa/extras/ww8export/data/bnc787942.doc Binary files differnew file mode 100644 index 000000000..06b2c39f2 --- /dev/null +++ b/sw/qa/extras/ww8export/data/bnc787942.doc diff --git a/sw/qa/extras/ww8export/data/bnc821208.doc b/sw/qa/extras/ww8export/data/bnc821208.doc Binary files differnew file mode 100644 index 000000000..cfe76806e --- /dev/null +++ b/sw/qa/extras/ww8export/data/bnc821208.doc diff --git a/sw/qa/extras/ww8export/data/bnc863018b.doc b/sw/qa/extras/ww8export/data/bnc863018b.doc Binary files differnew file mode 100644 index 000000000..c9744b856 --- /dev/null +++ b/sw/qa/extras/ww8export/data/bnc863018b.doc diff --git a/sw/qa/extras/ww8export/data/bordercolours.doc b/sw/qa/extras/ww8export/data/bordercolours.doc Binary files differnew file mode 100644 index 000000000..c442223ea --- /dev/null +++ b/sw/qa/extras/ww8export/data/bordercolours.doc diff --git a/sw/qa/extras/ww8export/data/bordercolours.odt b/sw/qa/extras/ww8export/data/bordercolours.odt Binary files differnew file mode 100644 index 000000000..f34d595f3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/bordercolours.odt diff --git a/sw/qa/extras/ww8export/data/btlr-cell.doc b/sw/qa/extras/ww8export/data/btlr-cell.doc Binary files differnew file mode 100644 index 000000000..f99e9e67e --- /dev/null +++ b/sw/qa/extras/ww8export/data/btlr-cell.doc diff --git a/sw/qa/extras/ww8export/data/btlr-frame.odt b/sw/qa/extras/ww8export/data/btlr-frame.odt Binary files differnew file mode 100644 index 000000000..31cb03849 --- /dev/null +++ b/sw/qa/extras/ww8export/data/btlr-frame.odt diff --git a/sw/qa/extras/ww8export/data/cell-bg-color.odt b/sw/qa/extras/ww8export/data/cell-bg-color.odt Binary files differnew file mode 100644 index 000000000..3565f40c2 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cell-bg-color.odt diff --git a/sw/qa/extras/ww8export/data/charborder.odt b/sw/qa/extras/ww8export/data/charborder.odt Binary files differnew file mode 100644 index 000000000..0829c0348 --- /dev/null +++ b/sw/qa/extras/ww8export/data/charborder.odt diff --git a/sw/qa/extras/ww8export/data/checkbox_control.odt b/sw/qa/extras/ww8export/data/checkbox_control.odt Binary files differnew file mode 100644 index 000000000..b5281b30e --- /dev/null +++ b/sw/qa/extras/ww8export/data/checkbox_control.odt diff --git a/sw/qa/extras/ww8export/data/cjklist30.doc b/sw/qa/extras/ww8export/data/cjklist30.doc Binary files differnew file mode 100644 index 000000000..48f22cf79 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist30.doc diff --git a/sw/qa/extras/ww8export/data/cjklist31.doc b/sw/qa/extras/ww8export/data/cjklist31.doc Binary files differnew file mode 100644 index 000000000..4a7d3e7e1 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist31.doc diff --git a/sw/qa/extras/ww8export/data/cjklist34.doc b/sw/qa/extras/ww8export/data/cjklist34.doc Binary files differnew file mode 100644 index 000000000..551fc8952 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist34.doc diff --git a/sw/qa/extras/ww8export/data/cjklist35.doc b/sw/qa/extras/ww8export/data/cjklist35.doc Binary files differnew file mode 100644 index 000000000..33d247029 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cjklist35.doc diff --git a/sw/qa/extras/ww8export/data/clearing-break.doc b/sw/qa/extras/ww8export/data/clearing-break.doc Binary files differnew file mode 100644 index 000000000..87b51128d --- /dev/null +++ b/sw/qa/extras/ww8export/data/clearing-break.doc diff --git a/sw/qa/extras/ww8export/data/comment-export.odt b/sw/qa/extras/ww8export/data/comment-export.odt Binary files differnew file mode 100644 index 000000000..66873d869 --- /dev/null +++ b/sw/qa/extras/ww8export/data/comment-export.odt diff --git a/sw/qa/extras/ww8export/data/commented-table.doc b/sw/qa/extras/ww8export/data/commented-table.doc Binary files differnew file mode 100644 index 000000000..049c7e3a4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/commented-table.doc diff --git a/sw/qa/extras/ww8export/data/comments-nested.doc b/sw/qa/extras/ww8export/data/comments-nested.doc Binary files differnew file mode 100644 index 000000000..339a15b11 --- /dev/null +++ b/sw/qa/extras/ww8export/data/comments-nested.doc diff --git a/sw/qa/extras/ww8export/data/cp1000044.doc b/sw/qa/extras/ww8export/data/cp1000044.doc Binary files differnew file mode 100644 index 000000000..ea30cc002 --- /dev/null +++ b/sw/qa/extras/ww8export/data/cp1000044.doc diff --git a/sw/qa/extras/ww8export/data/fdo36868.doc b/sw/qa/extras/ww8export/data/fdo36868.doc Binary files differnew file mode 100644 index 000000000..382c6b267 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo36868.doc diff --git a/sw/qa/extras/ww8export/data/fdo42144.odt b/sw/qa/extras/ww8export/data/fdo42144.odt Binary files differnew file mode 100644 index 000000000..be9490079 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo42144.odt diff --git a/sw/qa/extras/ww8export/data/fdo45724.odt b/sw/qa/extras/ww8export/data/fdo45724.odt Binary files differnew file mode 100644 index 000000000..45c6d9a58 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo45724.odt diff --git a/sw/qa/extras/ww8export/data/fdo46020.odt b/sw/qa/extras/ww8export/data/fdo46020.odt Binary files differnew file mode 100644 index 000000000..478c931b2 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo46020.odt diff --git a/sw/qa/extras/ww8export/data/fdo53985.doc b/sw/qa/extras/ww8export/data/fdo53985.doc Binary files differnew file mode 100644 index 000000000..0c8f278dc --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo53985.doc diff --git a/sw/qa/extras/ww8export/data/fdo56513.doc b/sw/qa/extras/ww8export/data/fdo56513.doc Binary files differnew file mode 100644 index 000000000..f5be1c3cd --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo56513.doc diff --git a/sw/qa/extras/ww8export/data/fdo59530.doc b/sw/qa/extras/ww8export/data/fdo59530.doc Binary files differnew file mode 100644 index 000000000..90bd4ce04 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo59530.doc diff --git a/sw/qa/extras/ww8export/data/fdo66304-1.odt b/sw/qa/extras/ww8export/data/fdo66304-1.odt Binary files differnew file mode 100644 index 000000000..c3fb9bcfa --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo66304-1.odt diff --git a/sw/qa/extras/ww8export/data/fdo68963.doc b/sw/qa/extras/ww8export/data/fdo68963.doc Binary files differnew file mode 100644 index 000000000..b31741f7c --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo68963.doc diff --git a/sw/qa/extras/ww8export/data/fdo68967.doc b/sw/qa/extras/ww8export/data/fdo68967.doc Binary files differnew file mode 100644 index 000000000..05271c3d8 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo68967.doc diff --git a/sw/qa/extras/ww8export/data/fdo77454.doc b/sw/qa/extras/ww8export/data/fdo77454.doc Binary files differnew file mode 100644 index 000000000..4e2d7b2ad --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo77454.doc diff --git a/sw/qa/extras/ww8export/data/fdo77844.doc b/sw/qa/extras/ww8export/data/fdo77844.doc Binary files differnew file mode 100644 index 000000000..cd7368d5d --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo77844.doc diff --git a/sw/qa/extras/ww8export/data/fdo80333.doc b/sw/qa/extras/ww8export/data/fdo80333.doc Binary files differnew file mode 100644 index 000000000..773a922ba --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo80333.doc diff --git a/sw/qa/extras/ww8export/data/fdo81102.doc b/sw/qa/extras/ww8export/data/fdo81102.doc Binary files differnew file mode 100644 index 000000000..e8a550768 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo81102.doc diff --git a/sw/qa/extras/ww8export/data/first-header-footer.doc b/sw/qa/extras/ww8export/data/first-header-footer.doc Binary files differnew file mode 100644 index 000000000..023c49486 --- /dev/null +++ b/sw/qa/extras/ww8export/data/first-header-footer.doc diff --git a/sw/qa/extras/ww8export/data/gutter-left.doc b/sw/qa/extras/ww8export/data/gutter-left.doc Binary files differnew file mode 100644 index 000000000..0d76e8748 --- /dev/null +++ b/sw/qa/extras/ww8export/data/gutter-left.doc diff --git a/sw/qa/extras/ww8export/data/gutter-top.doc b/sw/qa/extras/ww8export/data/gutter-top.doc Binary files differnew file mode 100644 index 000000000..07ffa3945 --- /dev/null +++ b/sw/qa/extras/ww8export/data/gutter-top.doc diff --git a/sw/qa/extras/ww8export/data/i120158.doc b/sw/qa/extras/ww8export/data/i120158.doc Binary files differnew file mode 100644 index 000000000..6adf3ec13 --- /dev/null +++ b/sw/qa/extras/ww8export/data/i120158.doc diff --git a/sw/qa/extras/ww8export/data/image-comment-at-char.doc b/sw/qa/extras/ww8export/data/image-comment-at-char.doc Binary files differnew file mode 100644 index 000000000..e0d5e2cba --- /dev/null +++ b/sw/qa/extras/ww8export/data/image-comment-at-char.doc diff --git a/sw/qa/extras/ww8export/data/list-nolevel.doc b/sw/qa/extras/ww8export/data/list-nolevel.doc Binary files differnew file mode 100644 index 000000000..04e34996f --- /dev/null +++ b/sw/qa/extras/ww8export/data/list-nolevel.doc diff --git a/sw/qa/extras/ww8export/data/mailmerge.doc b/sw/qa/extras/ww8export/data/mailmerge.doc Binary files differnew file mode 100644 index 000000000..6ed882769 --- /dev/null +++ b/sw/qa/extras/ww8export/data/mailmerge.doc diff --git a/sw/qa/extras/ww8export/data/msobrightnesscontrast.doc b/sw/qa/extras/ww8export/data/msobrightnesscontrast.doc Binary files differnew file mode 100644 index 000000000..675d6d370 --- /dev/null +++ b/sw/qa/extras/ww8export/data/msobrightnesscontrast.doc diff --git a/sw/qa/extras/ww8export/data/n325936.doc b/sw/qa/extras/ww8export/data/n325936.doc Binary files differnew file mode 100644 index 000000000..23d0f6025 --- /dev/null +++ b/sw/qa/extras/ww8export/data/n325936.doc diff --git a/sw/qa/extras/ww8export/data/n652364.doc b/sw/qa/extras/ww8export/data/n652364.doc Binary files differnew file mode 100644 index 000000000..f7a0fe0d5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/n652364.doc diff --git a/sw/qa/extras/ww8export/data/n750255.doc b/sw/qa/extras/ww8export/data/n750255.doc Binary files differnew file mode 100644 index 000000000..c0475c4ed --- /dev/null +++ b/sw/qa/extras/ww8export/data/n750255.doc diff --git a/sw/qa/extras/ww8export/data/n757118.doc b/sw/qa/extras/ww8export/data/n757118.doc Binary files differnew file mode 100644 index 000000000..2c6948521 --- /dev/null +++ b/sw/qa/extras/ww8export/data/n757118.doc diff --git a/sw/qa/extras/ww8export/data/n757905.doc b/sw/qa/extras/ww8export/data/n757905.doc Binary files differnew file mode 100644 index 000000000..0fb7b097c --- /dev/null +++ b/sw/qa/extras/ww8export/data/n757905.doc diff --git a/sw/qa/extras/ww8export/data/n757910.doc b/sw/qa/extras/ww8export/data/n757910.doc Binary files differnew file mode 100644 index 000000000..49a0e59f8 --- /dev/null +++ b/sw/qa/extras/ww8export/data/n757910.doc diff --git a/sw/qa/extras/ww8export/data/n760294.doc b/sw/qa/extras/ww8export/data/n760294.doc Binary files differnew file mode 100644 index 000000000..04960d060 --- /dev/null +++ b/sw/qa/extras/ww8export/data/n760294.doc diff --git a/sw/qa/extras/ww8export/data/n816603.doc b/sw/qa/extras/ww8export/data/n816603.doc Binary files differnew file mode 100644 index 000000000..9186f628f --- /dev/null +++ b/sw/qa/extras/ww8export/data/n816603.doc diff --git a/sw/qa/extras/ww8export/data/n823651.doc b/sw/qa/extras/ww8export/data/n823651.doc Binary files differnew file mode 100644 index 000000000..51b383c42 --- /dev/null +++ b/sw/qa/extras/ww8export/data/n823651.doc diff --git a/sw/qa/extras/ww8export/data/new-page-styles.doc b/sw/qa/extras/ww8export/data/new-page-styles.doc Binary files differnew file mode 100644 index 000000000..c3886fd6b --- /dev/null +++ b/sw/qa/extras/ww8export/data/new-page-styles.doc diff --git a/sw/qa/extras/ww8export/data/object_cross_reference.odt b/sw/qa/extras/ww8export/data/object_cross_reference.odt Binary files differnew file mode 100644 index 000000000..9eaca352b --- /dev/null +++ b/sw/qa/extras/ww8export/data/object_cross_reference.odt diff --git a/sw/qa/extras/ww8export/data/ooo92948-1.doc b/sw/qa/extras/ww8export/data/ooo92948-1.doc Binary files differnew file mode 100644 index 000000000..f355eaa26 --- /dev/null +++ b/sw/qa/extras/ww8export/data/ooo92948-1.doc diff --git a/sw/qa/extras/ww8export/data/page-border.doc b/sw/qa/extras/ww8export/data/page-border.doc Binary files differnew file mode 100644 index 000000000..c2dec4fed --- /dev/null +++ b/sw/qa/extras/ww8export/data/page-border.doc diff --git a/sw/qa/extras/ww8export/data/redline-export-1.odt b/sw/qa/extras/ww8export/data/redline-export-1.odt Binary files differnew file mode 100644 index 000000000..31aacce47 --- /dev/null +++ b/sw/qa/extras/ww8export/data/redline-export-1.odt diff --git a/sw/qa/extras/ww8export/data/redline-export-2.odt b/sw/qa/extras/ww8export/data/redline-export-2.odt Binary files differnew file mode 100644 index 000000000..2aca5eee4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/redline-export-2.odt diff --git a/sw/qa/extras/ww8export/data/redline-export-3.odt b/sw/qa/extras/ww8export/data/redline-export-3.odt Binary files differnew file mode 100644 index 000000000..6d0d80a08 --- /dev/null +++ b/sw/qa/extras/ww8export/data/redline-export-3.odt diff --git a/sw/qa/extras/ww8export/data/rtl-gutter.doc b/sw/qa/extras/ww8export/data/rtl-gutter.doc Binary files differnew file mode 100644 index 000000000..37cbf8707 --- /dev/null +++ b/sw/qa/extras/ww8export/data/rtl-gutter.doc diff --git a/sw/qa/extras/ww8export/data/shapes-line-ellipse.doc b/sw/qa/extras/ww8export/data/shapes-line-ellipse.doc Binary files differnew file mode 100644 index 000000000..184881c00 --- /dev/null +++ b/sw/qa/extras/ww8export/data/shapes-line-ellipse.doc diff --git a/sw/qa/extras/ww8export/data/table_cross_reference.odt b/sw/qa/extras/ww8export/data/table_cross_reference.odt Binary files differnew file mode 100644 index 000000000..95f33139c --- /dev/null +++ b/sw/qa/extras/ww8export/data/table_cross_reference.odt diff --git a/sw/qa/extras/ww8export/data/table_cross_reference_custom_format.odt b/sw/qa/extras/ww8export/data/table_cross_reference_custom_format.odt Binary files differnew file mode 100644 index 000000000..1c41e364c --- /dev/null +++ b/sw/qa/extras/ww8export/data/table_cross_reference_custom_format.odt diff --git a/sw/qa/extras/ww8export/data/tdf100961_fixedDateTime.doc b/sw/qa/extras/ww8export/data/tdf100961_fixedDateTime.doc Binary files differnew file mode 100644 index 000000000..86f0e478d --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf100961_fixedDateTime.doc diff --git a/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc Binary files differnew file mode 100644 index 000000000..206f48309 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc diff --git a/sw/qa/extras/ww8export/data/tdf102334.doc b/sw/qa/extras/ww8export/data/tdf102334.doc Binary files differnew file mode 100644 index 000000000..d007257cf --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf102334.doc diff --git a/sw/qa/extras/ww8export/data/tdf104239_chapterNumberTortureTest.doc b/sw/qa/extras/ww8export/data/tdf104239_chapterNumberTortureTest.doc Binary files differnew file mode 100644 index 000000000..dc8f65e76 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104239_chapterNumberTortureTest.doc diff --git a/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc b/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc Binary files differnew file mode 100644 index 000000000..2e237b2e3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104239_chapterNumbering.doc diff --git a/sw/qa/extras/ww8export/data/tdf104239_chapterNumberingLevels.doc b/sw/qa/extras/ww8export/data/tdf104239_chapterNumberingLevels.doc Binary files differnew file mode 100644 index 000000000..8a7583c32 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104239_chapterNumberingLevels.doc diff --git a/sw/qa/extras/ww8export/data/tdf104239_numbering.doc b/sw/qa/extras/ww8export/data/tdf104239_numbering.doc Binary files differnew file mode 100644 index 000000000..ee8ad09e4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104239_numbering.doc diff --git a/sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc b/sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc Binary files differnew file mode 100644 index 000000000..c5deb4857 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104239_sharedOutlineNumId.doc diff --git a/sw/qa/extras/ww8export/data/tdf104334.doc b/sw/qa/extras/ww8export/data/tdf104334.doc Binary files differnew file mode 100644 index 000000000..877caff0c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104334.doc diff --git a/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc b/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc Binary files differnew file mode 100644 index 000000000..17fba7945 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104596_wrapInHeaderTable.doc diff --git a/sw/qa/extras/ww8export/data/tdf104805.doc b/sw/qa/extras/ww8export/data/tdf104805.doc Binary files differnew file mode 100644 index 000000000..a2dd81dd0 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf104805.doc diff --git a/sw/qa/extras/ww8export/data/tdf105570.doc b/sw/qa/extras/ww8export/data/tdf105570.doc Binary files differnew file mode 100644 index 000000000..1bace7709 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf105570.doc diff --git a/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt Binary files differnew file mode 100644 index 000000000..af5e225ea --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt diff --git a/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx b/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx Binary files differnew file mode 100644 index 000000000..a222f5881 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx diff --git a/sw/qa/extras/ww8export/data/tdf106291.doc b/sw/qa/extras/ww8export/data/tdf106291.doc Binary files differnew file mode 100644 index 000000000..893004d46 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106291.doc diff --git a/sw/qa/extras/ww8export/data/tdf106541_cancelOutline.doc b/sw/qa/extras/ww8export/data/tdf106541_cancelOutline.doc Binary files differnew file mode 100644 index 000000000..6b3f016f3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106541_cancelOutline.doc diff --git a/sw/qa/extras/ww8export/data/tdf106541_inheritChapterNumbering.doc b/sw/qa/extras/ww8export/data/tdf106541_inheritChapterNumbering.doc Binary files differnew file mode 100644 index 000000000..f56b9d6b6 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106541_inheritChapterNumbering.doc diff --git a/sw/qa/extras/ww8export/data/tdf106541_inheritChapterNumberingB.doc b/sw/qa/extras/ww8export/data/tdf106541_inheritChapterNumberingB.doc Binary files differnew file mode 100644 index 000000000..0ff47ca3e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106541_inheritChapterNumberingB.doc diff --git a/sw/qa/extras/ww8export/data/tdf106541_inheritOutlineNumbering.doc b/sw/qa/extras/ww8export/data/tdf106541_inheritOutlineNumbering.doc Binary files differnew file mode 100644 index 000000000..2fe243fe8 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf106541_inheritOutlineNumbering.doc diff --git a/sw/qa/extras/ww8export/data/tdf107773.doc b/sw/qa/extras/ww8export/data/tdf107773.doc Binary files differnew file mode 100644 index 000000000..31c7b7c5c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf107773.doc diff --git a/sw/qa/extras/ww8export/data/tdf108072.doc b/sw/qa/extras/ww8export/data/tdf108072.doc Binary files differnew file mode 100644 index 000000000..03e8b2a53 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf108072.doc diff --git a/sw/qa/extras/ww8export/data/tdf108448_endNote.odt b/sw/qa/extras/ww8export/data/tdf108448_endNote.odt Binary files differnew file mode 100644 index 000000000..bc4a751a8 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf108448_endNote.odt diff --git a/sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc b/sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc Binary files differnew file mode 100644 index 000000000..536e92fd4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf108518_CRnumformatting.doc diff --git a/sw/qa/extras/ww8export/data/tdf111480.doc b/sw/qa/extras/ww8export/data/tdf111480.doc Binary files differnew file mode 100644 index 000000000..888126066 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf111480.doc diff --git a/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc b/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc Binary files differnew file mode 100644 index 000000000..64ea6521e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc diff --git a/sw/qa/extras/ww8export/data/tdf112118.doc b/sw/qa/extras/ww8export/data/tdf112118.doc Binary files differnew file mode 100644 index 000000000..f1aaa9b54 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf112118.doc diff --git a/sw/qa/extras/ww8export/data/tdf112346.doc b/sw/qa/extras/ww8export/data/tdf112346.doc Binary files differnew file mode 100644 index 000000000..af0cca219 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf112346.doc diff --git a/sw/qa/extras/ww8export/data/tdf112517_maxSprms.doc b/sw/qa/extras/ww8export/data/tdf112517_maxSprms.doc Binary files differnew file mode 100644 index 000000000..95de03d3b --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf112517_maxSprms.doc diff --git a/sw/qa/extras/ww8export/data/tdf112535.doc b/sw/qa/extras/ww8export/data/tdf112535.doc Binary files differnew file mode 100644 index 000000000..4eea19ecd --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf112535.doc diff --git a/sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.doc b/sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.doc Binary files differnew file mode 100644 index 000000000..c7d9823b0 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.doc diff --git a/sw/qa/extras/ww8export/data/tdf114308.doc b/sw/qa/extras/ww8export/data/tdf114308.doc Binary files differnew file mode 100644 index 000000000..36e6c7ec6 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf114308.doc diff --git a/sw/qa/extras/ww8export/data/tdf115896_layoutInCell.doc b/sw/qa/extras/ww8export/data/tdf115896_layoutInCell.doc Binary files differnew file mode 100644 index 000000000..c7e6fc680 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf115896_layoutInCell.doc diff --git a/sw/qa/extras/ww8export/data/tdf116194.doc b/sw/qa/extras/ww8export/data/tdf116194.doc Binary files differnew file mode 100644 index 000000000..ca1edf68d --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf116194.doc diff --git a/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt b/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt Binary files differnew file mode 100644 index 000000000..1ae65f788 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt diff --git a/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt b/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt Binary files differnew file mode 100644 index 000000000..c1598eb71 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt diff --git a/sw/qa/extras/ww8export/data/tdf117217_largeTableBackgrounds.odt b/sw/qa/extras/ww8export/data/tdf117217_largeTableBackgrounds.odt Binary files differnew file mode 100644 index 000000000..bbb1eaab3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf117217_largeTableBackgrounds.odt diff --git a/sw/qa/extras/ww8export/data/tdf117503.docx b/sw/qa/extras/ww8export/data/tdf117503.docx Binary files differnew file mode 100644 index 000000000..f817f035b --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf117503.docx diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc b/sw/qa/extras/ww8export/data/tdf117885.doc Binary files differnew file mode 100644 index 000000000..bf8d0ef03 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf117885.doc diff --git a/sw/qa/extras/ww8export/data/tdf118133.docx b/sw/qa/extras/ww8export/data/tdf118133.docx Binary files differnew file mode 100644 index 000000000..613aa1bd7 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf118133.docx diff --git a/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc Binary files differnew file mode 100644 index 000000000..99d15e20c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc b/sw/qa/extras/ww8export/data/tdf118412.doc Binary files differnew file mode 100644 index 000000000..ef9b26cb3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf118412.doc diff --git a/sw/qa/extras/ww8export/data/tdf118564.doc b/sw/qa/extras/ww8export/data/tdf118564.doc Binary files differnew file mode 100644 index 000000000..4040e05e2 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf118564.doc diff --git a/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc Binary files differnew file mode 100644 index 000000000..c50bf46c0 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc diff --git a/sw/qa/extras/ww8export/data/tdf120003.doc b/sw/qa/extras/ww8export/data/tdf120003.doc Binary files differnew file mode 100644 index 000000000..c544fa5a9 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf120003.doc diff --git a/sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.doc b/sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.doc Binary files differnew file mode 100644 index 000000000..713cdc336 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.doc diff --git a/sw/qa/extras/ww8export/data/tdf120394.doc b/sw/qa/extras/ww8export/data/tdf120394.doc Binary files differnew file mode 100644 index 000000000..2ee9058a5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf120394.doc diff --git a/sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odt b/sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odt Binary files differnew file mode 100644 index 000000000..ecd5841a8 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odt diff --git a/sw/qa/extras/ww8export/data/tdf120711.doc b/sw/qa/extras/ww8export/data/tdf120711.doc Binary files differnew file mode 100644 index 000000000..90e7c05ce --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf120711.doc diff --git a/sw/qa/extras/ww8export/data/tdf121110_absJustify.doc b/sw/qa/extras/ww8export/data/tdf121110_absJustify.doc Binary files differnew file mode 100644 index 000000000..0b9f581d4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf121110_absJustify.doc diff --git a/sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docx b/sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docx Binary files differnew file mode 100644 index 000000000..434d182eb --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docx diff --git a/sw/qa/extras/ww8export/data/tdf122425_2.doc b/sw/qa/extras/ww8export/data/tdf122425_2.doc Binary files differnew file mode 100644 index 000000000..8debcddc1 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf122425_2.doc diff --git a/sw/qa/extras/ww8export/data/tdf122429_header.doc b/sw/qa/extras/ww8export/data/tdf122429_header.doc Binary files differnew file mode 100644 index 000000000..37afc067b --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf122429_header.doc diff --git a/sw/qa/extras/ww8export/data/tdf122460_header.odt b/sw/qa/extras/ww8export/data/tdf122460_header.odt Binary files differnew file mode 100644 index 000000000..420121dc9 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf122460_header.odt diff --git a/sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.doc b/sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.doc Binary files differnew file mode 100644 index 000000000..f8321e96e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.doc diff --git a/sw/qa/extras/ww8export/data/tdf124937.doc b/sw/qa/extras/ww8export/data/tdf124937.doc Binary files differnew file mode 100644 index 000000000..eb1ab2d9e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf124937.doc diff --git a/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt Binary files differnew file mode 100644 index 000000000..31b0fab8d --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt diff --git a/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc b/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc Binary files differnew file mode 100644 index 000000000..21cd47a4c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc diff --git a/sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odt b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odt Binary files differnew file mode 100644 index 000000000..95987d456 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odt diff --git a/sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odt b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odt Binary files differnew file mode 100644 index 000000000..d98fae0ad --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odt diff --git a/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt Binary files differnew file mode 100644 index 000000000..c382c9aa6 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt diff --git a/sw/qa/extras/ww8export/data/tdf128501.doc b/sw/qa/extras/ww8export/data/tdf128501.doc Binary files differnew file mode 100644 index 000000000..3313e397a --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128501.doc diff --git a/sw/qa/extras/ww8export/data/tdf128605.doc b/sw/qa/extras/ww8export/data/tdf128605.doc Binary files differnew file mode 100644 index 000000000..2bbfe6b73 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128605.doc diff --git a/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt b/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt Binary files differnew file mode 100644 index 000000000..917dc96d4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt diff --git a/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc Binary files differnew file mode 100644 index 000000000..d9b16ca53 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc diff --git a/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc b/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc Binary files differnew file mode 100644 index 000000000..9fa798ea3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc diff --git a/sw/qa/extras/ww8export/data/tdf129247.docx b/sw/qa/extras/ww8export/data/tdf129247.docx Binary files differnew file mode 100644 index 000000000..a5ea1c1c1 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf129247.docx diff --git a/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt Binary files differnew file mode 100644 index 000000000..7ced9fc64 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt diff --git a/sw/qa/extras/ww8export/data/tdf130262.doc b/sw/qa/extras/ww8export/data/tdf130262.doc Binary files differnew file mode 100644 index 000000000..fb60beacd --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf130262.doc diff --git a/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc b/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc Binary files differnew file mode 100644 index 000000000..1b8a29e0e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc diff --git a/sw/qa/extras/ww8export/data/tdf132726.odt b/sw/qa/extras/ww8export/data/tdf132726.odt Binary files differnew file mode 100644 index 000000000..c8106c2b5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf132726.odt diff --git a/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc b/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc Binary files differnew file mode 100644 index 000000000..6fa503680 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc diff --git a/sw/qa/extras/ww8export/data/tdf134264.docx b/sw/qa/extras/ww8export/data/tdf134264.docx Binary files differnew file mode 100644 index 000000000..5acb4cf4e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf134264.docx diff --git a/sw/qa/extras/ww8export/data/tdf134570.doc b/sw/qa/extras/ww8export/data/tdf134570.doc Binary files differnew file mode 100644 index 000000000..17f7842d7 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf134570.doc diff --git a/sw/qa/extras/ww8export/data/tdf134948.odt b/sw/qa/extras/ww8export/data/tdf134948.odt Binary files differnew file mode 100644 index 000000000..a6227fb5e --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf134948.odt diff --git a/sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc b/sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc Binary files differnew file mode 100644 index 000000000..a2ae57def --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf135672_tableGrows.doc diff --git a/sw/qa/extras/ww8export/data/tdf136620.odt b/sw/qa/extras/ww8export/data/tdf136620.odt Binary files differnew file mode 100644 index 000000000..bb8536ec9 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf136620.odt diff --git a/sw/qa/extras/ww8export/data/tdf136814.odt b/sw/qa/extras/ww8export/data/tdf136814.odt Binary files differnew file mode 100644 index 000000000..2318de04b --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf136814.odt diff --git a/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt b/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt Binary files differnew file mode 100644 index 000000000..8c9996361 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt diff --git a/sw/qa/extras/ww8export/data/tdf138345_paraCharHighlight.doc b/sw/qa/extras/ww8export/data/tdf138345_paraCharHighlight.doc Binary files differnew file mode 100644 index 000000000..3da7e9286 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf138345_paraCharHighlight.doc diff --git a/sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc b/sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc Binary files differnew file mode 100644 index 000000000..c45a6c25f --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf139495_tinyHeader.doc diff --git a/sw/qa/extras/ww8export/data/tdf142760.doc b/sw/qa/extras/ww8export/data/tdf142760.doc Binary files differnew file mode 100644 index 000000000..1e90532fe --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf142760.doc diff --git a/sw/qa/extras/ww8export/data/tdf142840.odt b/sw/qa/extras/ww8export/data/tdf142840.odt Binary files differnew file mode 100644 index 000000000..27af4cdb5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf142840.odt diff --git a/sw/qa/extras/ww8export/data/tdf147861_customField.doc b/sw/qa/extras/ww8export/data/tdf147861_customField.doc Binary files differnew file mode 100644 index 000000000..f18d65f40 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf147861_customField.doc diff --git a/sw/qa/extras/ww8export/data/tdf148380_createField.doc b/sw/qa/extras/ww8export/data/tdf148380_createField.doc Binary files differnew file mode 100644 index 000000000..79c5e59c5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf148380_createField.doc diff --git a/sw/qa/extras/ww8export/data/tdf148380_fldLocked.doc b/sw/qa/extras/ww8export/data/tdf148380_fldLocked.doc Binary files differnew file mode 100644 index 000000000..cee6982ee --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf148380_fldLocked.doc diff --git a/sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.doc b/sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.doc Binary files differnew file mode 100644 index 000000000..f7afd4191 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.doc diff --git a/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc b/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc Binary files differnew file mode 100644 index 000000000..08ba2f9d5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc diff --git a/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc Binary files differnew file mode 100644 index 000000000..5e4fcdd76 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc diff --git a/sw/qa/extras/ww8export/data/tdf38778_properties_in_run_for_field.doc b/sw/qa/extras/ww8export/data/tdf38778_properties_in_run_for_field.doc Binary files differnew file mode 100644 index 000000000..960fe50da --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf38778_properties_in_run_for_field.doc diff --git a/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt Binary files differnew file mode 100644 index 000000000..9585041de --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt diff --git a/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt b/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt Binary files differnew file mode 100644 index 000000000..019e19f24 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt diff --git a/sw/qa/extras/ww8export/data/tdf46441-2.odt b/sw/qa/extras/ww8export/data/tdf46441-2.odt Binary files differnew file mode 100644 index 000000000..ed73406c5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf46441-2.odt diff --git a/sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.doc b/sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.doc Binary files differnew file mode 100644 index 000000000..747136d47 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.doc diff --git a/sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odt b/sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odt Binary files differnew file mode 100644 index 000000000..7f77f6d39 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odt diff --git a/sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.doc b/sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.doc Binary files differnew file mode 100644 index 000000000..367f7873d --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.doc diff --git a/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc b/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc Binary files differnew file mode 100644 index 000000000..a5293f29f --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc diff --git a/sw/qa/extras/ww8export/data/tdf59896.doc b/sw/qa/extras/ww8export/data/tdf59896.doc Binary files differnew file mode 100644 index 000000000..a3c724299 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf59896.doc diff --git a/sw/qa/extras/ww8export/data/tdf60378_mergedBorders.doc b/sw/qa/extras/ww8export/data/tdf60378_mergedBorders.doc Binary files differnew file mode 100644 index 000000000..3278f4631 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf60378_mergedBorders.doc diff --git a/sw/qa/extras/ww8export/data/tdf70838.odt b/sw/qa/extras/ww8export/data/tdf70838.odt Binary files differnew file mode 100644 index 000000000..65d20ecb6 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf70838.odt diff --git a/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt Binary files differnew file mode 100644 index 000000000..556f2564c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt diff --git a/sw/qa/extras/ww8export/data/tdf73056_cellMargins.doc b/sw/qa/extras/ww8export/data/tdf73056_cellMargins.doc Binary files differnew file mode 100644 index 000000000..7ae12d452 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf73056_cellMargins.doc diff --git a/sw/qa/extras/ww8export/data/tdf74328.doc b/sw/qa/extras/ww8export/data/tdf74328.doc Binary files differnew file mode 100644 index 000000000..a82978547 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf74328.doc diff --git a/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc Binary files differnew file mode 100644 index 000000000..ac811a8f3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc diff --git a/sw/qa/extras/ww8export/data/tdf75748_inheritChapterNumberingC.doc b/sw/qa/extras/ww8export/data/tdf75748_inheritChapterNumberingC.doc Binary files differnew file mode 100644 index 000000000..7f393612c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf75748_inheritChapterNumberingC.doc diff --git a/sw/qa/extras/ww8export/data/tdf76349_textboxMargins.doc b/sw/qa/extras/ww8export/data/tdf76349_textboxMargins.doc Binary files differnew file mode 100644 index 000000000..95bc59807 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf76349_textboxMargins.doc diff --git a/sw/qa/extras/ww8export/data/tdf77964.doc b/sw/qa/extras/ww8export/data/tdf77964.doc Binary files differnew file mode 100644 index 000000000..6ef50ab15 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf77964.doc diff --git a/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt b/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt Binary files differnew file mode 100644 index 000000000..e512f0907 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf79186_noLayoutInCell.odt diff --git a/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx b/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx Binary files differnew file mode 100644 index 000000000..55d1a1f22 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx diff --git a/sw/qa/extras/ww8export/data/tdf79553_lineNumbers.doc b/sw/qa/extras/ww8export/data/tdf79553_lineNumbers.doc Binary files differnew file mode 100644 index 000000000..260f5ce18 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf79553_lineNumbers.doc diff --git a/sw/qa/extras/ww8export/data/tdf79639.doc b/sw/qa/extras/ww8export/data/tdf79639.doc Binary files differnew file mode 100644 index 000000000..1a996b62b --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf79639.doc diff --git a/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc b/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc Binary files differnew file mode 100644 index 000000000..ad70ff641 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc diff --git a/sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.doc b/sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.doc Binary files differnew file mode 100644 index 000000000..6e509a190 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.doc diff --git a/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc b/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc Binary files differnew file mode 100644 index 000000000..16f32e3e3 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc diff --git a/sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.doc b/sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.doc Binary files differnew file mode 100644 index 000000000..71f9adf4a --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.doc diff --git a/sw/qa/extras/ww8export/data/tdf81705_outlineLevel.doc b/sw/qa/extras/ww8export/data/tdf81705_outlineLevel.doc Binary files differnew file mode 100644 index 000000000..55d188356 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf81705_outlineLevel.doc diff --git a/sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.doc b/sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.doc Binary files differnew file mode 100644 index 000000000..ef6415f16 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.doc diff --git a/sw/qa/extras/ww8export/data/tdf91083.odt b/sw/qa/extras/ww8export/data/tdf91083.odt Binary files differnew file mode 100644 index 000000000..e4f55e58a --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf91083.odt diff --git a/sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odt b/sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odt Binary files differnew file mode 100644 index 000000000..19a1ac843 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odt diff --git a/sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odt b/sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odt Binary files differnew file mode 100644 index 000000000..d3a13baf4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odt diff --git a/sw/qa/extras/ww8export/data/tdf91687.doc b/sw/qa/extras/ww8export/data/tdf91687.doc Binary files differnew file mode 100644 index 000000000..d1c1e0a0c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf91687.doc diff --git a/sw/qa/extras/ww8export/data/tdf92281.doc b/sw/qa/extras/ww8export/data/tdf92281.doc Binary files differnew file mode 100644 index 000000000..2893eb37a --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf92281.doc diff --git a/sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odt b/sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odt Binary files differnew file mode 100644 index 000000000..e3143ec04 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odt diff --git a/sw/qa/extras/ww8export/data/tdf94326_notOutlineNumbering.doc b/sw/qa/extras/ww8export/data/tdf94326_notOutlineNumbering.doc Binary files differnew file mode 100644 index 000000000..2df22e931 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf94326_notOutlineNumbering.doc diff --git a/sw/qa/extras/ww8export/data/tdf94386.odt b/sw/qa/extras/ww8export/data/tdf94386.odt Binary files differnew file mode 100644 index 000000000..0e8d0bd0d --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf94386.odt diff --git a/sw/qa/extras/ww8export/data/tdf95321.doc b/sw/qa/extras/ww8export/data/tdf95321.doc Binary files differnew file mode 100644 index 000000000..8b85472b5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf95321.doc diff --git a/sw/qa/extras/ww8export/data/tdf95576.doc b/sw/qa/extras/ww8export/data/tdf95576.doc Binary files differnew file mode 100644 index 000000000..a8a601885 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf95576.doc diff --git a/sw/qa/extras/ww8export/data/tdf96277.doc b/sw/qa/extras/ww8export/data/tdf96277.doc Binary files differnew file mode 100644 index 000000000..904b2da13 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf96277.doc diff --git a/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc b/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc Binary files differnew file mode 100644 index 000000000..c643b96a4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc diff --git a/sw/qa/extras/ww8export/data/tdf99100.doc b/sw/qa/extras/ww8export/data/tdf99100.doc Binary files differnew file mode 100644 index 000000000..6352ae355 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf99100.doc diff --git a/sw/qa/extras/ww8export/data/tdf99120.doc b/sw/qa/extras/ww8export/data/tdf99120.doc Binary files differnew file mode 100644 index 000000000..a93721c57 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf99120.doc diff --git a/sw/qa/extras/ww8export/data/tdf99197_defaultLTR.doc b/sw/qa/extras/ww8export/data/tdf99197_defaultLTR.doc Binary files differnew file mode 100644 index 000000000..721b68882 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf99197_defaultLTR.doc diff --git a/sw/qa/extras/ww8export/data/tdf99474.odt b/sw/qa/extras/ww8export/data/tdf99474.odt Binary files differnew file mode 100644 index 000000000..7530488bb --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf99474.odt diff --git a/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc b/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc Binary files differnew file mode 100644 index 000000000..101b02a0b --- /dev/null +++ b/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc diff --git a/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc b/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc Binary files differnew file mode 100644 index 000000000..35f6371fb --- /dev/null +++ b/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc diff --git a/sw/qa/extras/ww8export/data/transparent-text.doc b/sw/qa/extras/ww8export/data/transparent-text.doc Binary files differnew file mode 100644 index 000000000..b458db29c --- /dev/null +++ b/sw/qa/extras/ww8export/data/transparent-text.doc diff --git a/sw/qa/extras/ww8export/data/tscp.doc b/sw/qa/extras/ww8export/data/tscp.doc Binary files differnew file mode 100644 index 000000000..9830b288c --- /dev/null +++ b/sw/qa/extras/ww8export/data/tscp.doc diff --git a/sw/qa/extras/ww8export/data/zoom.doc b/sw/qa/extras/ww8export/data/zoom.doc Binary files differnew file mode 100644 index 000000000..70548966d --- /dev/null +++ b/sw/qa/extras/ww8export/data/zoom.doc diff --git a/sw/qa/extras/ww8export/data/zoomtype.doc b/sw/qa/extras/ww8export/data/zoomtype.doc Binary files differnew file mode 100644 index 000000000..882375416 --- /dev/null +++ b/sw/qa/extras/ww8export/data/zoomtype.doc diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx new file mode 100644 index 000000000..835154122 --- /dev/null +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -0,0 +1,1570 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <string_view> + +#include <swmodeltestbase.hxx> + +#include <com/sun/star/awt/FontWeight.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/form/validation/XValidatableFormComponent.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/table/BorderLine2.hpp> +#include <com/sun/star/table/ShadowFormat.hpp> +#include <com/sun/star/table/TableBorder.hpp> +#include <com/sun/star/table/TableBorder2.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/text/XFormField.hpp> +#include <com/sun/star/text/XTextFramesSupplier.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/view/DocumentZoomType.hpp> +#include <com/sun/star/rdf/URI.hpp> +#include <com/sun/star/rdf/Statement.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/text/XPageCursor.hpp> + +#include <config_fonts.h> +#include <editeng/ulspitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/request.hxx> +#include <comphelper/processfactory.hxx> +#include <tools/UnitConversion.hxx> + +#include <cmdid.h> +#include <envimg.hxx> +#include <swmodule.hxx> +#include <view.hxx> +#include <wrtsh.hxx> +#include <fmtsrnd.hxx> +#include <frameformats.hxx> +#include <grfatr.hxx> +#include <pagedesc.hxx> +#include <ndgrf.hxx> +#include <bordertest.hxx> +#include <IDocumentSettingAccess.hxx> +#include <docsh.hxx> +#include <unotxdoc.hxx> +#include <o3tl/string_view.hxx> + +class Test : public SwModelTestBase +{ +public: + Test() : SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97") {} + + bool mustTestImportOf(const char* filename) const override + { + // If the testcase is stored in some other format, it's pointless to test. + return o3tl::ends_with(filename, ".doc"); + } + + /** + * Validation handling + */ + bool mustValidate(const char* filename) const override + { + const std::vector<const char*> aDenylist = + { + // the following doc exports currently don't pass binary validation + "tdf56321_flipImage_both.doc", + "cjklist30.doc", + "cjklist31.doc", + "cjklist34.doc", + "cjklist35.doc", + "fdo77454.doc", + "new-page-styles.doc", + "tdf36117_verticalAdjustment.doc", + "bnc636128.doc", + "tdf92281.doc", + "fdo59530.doc", + "fdo56513.doc", + "tscp.doc", + "zoom.doc", + "comments-nested.doc", + "commented-table.doc", + "zoomtype.doc", + "n325936.doc", + "first-header-footer.doc" + }; + + // Don't bother with non-.doc files; weed out denylisted .doc files + return (o3tl::ends_with(filename, ".doc") && std::find(aDenylist.begin(), aDenylist.end(), filename) == aDenylist.end()); + } +protected: + + virtual void postLoad(const char* pFilename) override + { + if (pFilename == std::string_view("tdf94386.odt")) + { + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + + // emulate the behavior from tdf#94386 - insert an envelope to the + // document + SfxItemSet aSet(pWrtShell->GetView().GetCurShell()->GetPool(), svl::Items<FN_ENVELOP, FN_ENVELOP>); + aSet.Put(SwEnvItem()); + SfxRequest aRequest(FN_ENVELOP, SfxCallMode::SYNCHRON, aSet); + SW_MOD()->ExecOther(aRequest); + } + } +}; + +DECLARE_WW8EXPORT_TEST(testN757910, "n757910.doc") +{ + // The internal margin was larger than 0.28cm + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + sal_Int32 nValue = 0; + xPropertySet->getPropertyValue("LeftBorderDistance") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(280), nValue); + + // The border width was zero + table::BorderLine2 aBorder; + xPropertySet->getPropertyValue("LeftBorder") >>= aBorder; + CPPUNIT_ASSERT(aBorder.LineWidth > 0); +} + +DECLARE_WW8EXPORT_TEST(testN760294, "n760294.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + table::TableBorder aTableBorder; + xTable->getPropertyValue("TableBorder") >>= aTableBorder; + CPPUNIT_ASSERT_EQUAL(aTableBorder.TopLine.InnerLineWidth, aTableBorder.TopLine.OuterLineWidth); + CPPUNIT_ASSERT_EQUAL(aTableBorder.TopLine.InnerLineWidth, aTableBorder.TopLine.LineDistance); +} + +DECLARE_WW8EXPORT_TEST(testN750255, "n750255.doc") +{ +/* +Column break without columns on the page is a page break, so check those paragraphs +are on page 2 (page style 'Convert 1') and page 3 (page style 'Convert 2') +enum = ThisComponent.Text.createEnumeration +enum.nextElement +para1 = enum.nextElement +xray para1.String +xray para1.PageStyleName +para2 = enum.nextElement +xray para2.String +xray para2.PageStyleName +*/ + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); + // list of paragraphs + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + // go to 1st paragraph + (void) paraEnum->nextElement(); + // get the 2nd and 3rd paragraph + uno::Reference<uno::XInterface> paragraph1(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<uno::XInterface> paragraph2(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> text1(paragraph1, uno::UNO_QUERY); + uno::Reference<text::XTextRange> text2(paragraph2, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( OUString( "one" ), text1->getString()); + CPPUNIT_ASSERT_EQUAL( OUString( "two" ), text2->getString()); + uno::Reference<beans::XPropertySet> paragraphProperties1(paragraph1, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> paragraphProperties2(paragraph2, uno::UNO_QUERY); + OUString pageStyle1, pageStyle2; + paragraphProperties1->getPropertyValue( "PageStyleName" ) >>= pageStyle1; + paragraphProperties2->getPropertyValue( "PageStyleName" ) >>= pageStyle2; + CPPUNIT_ASSERT_EQUAL( OUString( "Convert 1" ), pageStyle1 ); + CPPUNIT_ASSERT_EQUAL( OUString( "Convert 2" ), pageStyle2 ); + +} + +DECLARE_WW8EXPORT_TEST(testN652364, "n652364.doc") +{ +/* +Related to 750255 above, column break with columns on the page however should be a column break. +enum = ThisComponent.Text.createEnumeration +enum.nextElement +para1 = enum.nextElement +xray para1.String +xray para1.PageStyleName +enum.nextElement +para2 = enum.nextElement +xray para2.String +xray para2.PageStyleName +*/ + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); + // list of paragraphs + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + // get the 2nd and 4th paragraph + (void) paraEnum->nextElement(); + uno::Reference<uno::XInterface> paragraph1(paraEnum->nextElement(), uno::UNO_QUERY); + (void) paraEnum->nextElement(); + uno::Reference<uno::XInterface> paragraph2(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> text1(paragraph1, uno::UNO_QUERY); + uno::Reference<text::XTextRange> text2(paragraph2, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( OUString( "text1" ), text1->getString()); + CPPUNIT_ASSERT_EQUAL( OUString( "text2" ), text2->getString()); + uno::Reference<beans::XPropertySet> paragraphProperties1(paragraph1, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> paragraphProperties2(paragraph2, uno::UNO_QUERY); + OUString pageStyle1, pageStyle2; + paragraphProperties1->getPropertyValue( "PageStyleName" ) >>= pageStyle1; + paragraphProperties2->getPropertyValue( "PageStyleName" ) >>= pageStyle2; + // "Standard" is the style for the first page (2nd is "Convert 1"). + CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle1 ); + CPPUNIT_ASSERT_EQUAL( OUString( "Standard" ), pageStyle2 ); +} + +DECLARE_WW8EXPORT_TEST(testN757118, "n757118.doc") +{ +/* +Two pairs of horizontal rules (one absolute width, one relative width) +have the same width (full page width, half page width). +xray ThisComponent.DrawPage.getByIndex(0).BoundRect +*/ + uno::Reference<drawing::XShape> rule1 = getShape(1), rule2 = getShape(2), rule3 = getShape(3), rule4 = getShape(4); + uno::Reference<beans::XPropertySet> ruleProperties1(rule1, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> ruleProperties2(rule2, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> ruleProperties3(rule3, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> ruleProperties4(rule4, uno::UNO_QUERY); + awt::Rectangle boundRect1, boundRect2, boundRect3, boundRect4; + ruleProperties1->getPropertyValue( "BoundRect" ) >>= boundRect1; + ruleProperties2->getPropertyValue( "BoundRect" ) >>= boundRect2; + ruleProperties3->getPropertyValue( "BoundRect" ) >>= boundRect3; + ruleProperties4->getPropertyValue( "BoundRect" ) >>= boundRect4; + // compare, allow for < 5 differences because of rounding errors + CPPUNIT_ASSERT( abs( boundRect1.Width - boundRect3.Width ) < 5 ); + CPPUNIT_ASSERT( abs( boundRect2.Width - boundRect4.Width ) < 5 ); +} + +DECLARE_WW8EXPORT_TEST(testTdf75539_relativeWidth, "tdf75539_relativeWidth.doc") +{ + //divide everything by 10 to give a margin of error for rounding etc. + sal_Int32 pageWidth = parseDump("/root/page[1]/body/infos/bounds", "width").toInt32()/10; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Page width", sal_Int32(9354/10), pageWidth); + CPPUNIT_ASSERT_EQUAL_MESSAGE("100% width line", pageWidth, parseDump("/root/page[1]/body/txt[2]/Special", "nWidth").toInt32()/10); + CPPUNIT_ASSERT_EQUAL_MESSAGE("50% width line", pageWidth/2, parseDump("/root/page[1]/body/txt[4]/Special", "nWidth").toInt32()/10); + CPPUNIT_ASSERT_EQUAL_MESSAGE("25% width line", pageWidth/4, parseDump("/root/page[1]/body/txt[6]/Special", "nWidth").toInt32()/10); + CPPUNIT_ASSERT_EQUAL_MESSAGE("10% width line", pageWidth/10, parseDump("/root/page[1]/body/txt[8]/Special", "nWidth").toInt32()/10); +} + +DECLARE_WW8EXPORT_TEST(testN757905, "n757905.doc") +{ + // The problem was that the paragraph had only a single fly + // (as-character-anchored), and the height of that was smaller than the + // paragraph height. When in Word-compat mode, we should take the max of + // the two, not just the height of the fly. + + OUString aHeight = parseDump("/root/page/body/txt/infos/bounds", "height"); + CPPUNIT_ASSERT(sal_Int32(31) < aHeight.toInt32()); +} + +DECLARE_WW8EXPORT_TEST(testAllGapsWord, "all_gaps_word.doc") +{ + BorderTest borderTest; + BorderTest::testTheBorders(mxComponent, true); +} + +DECLARE_WW8EXPORT_TEST(testI120158, "i120158.doc") +{ + // See https://bz.apache.org/ooo/show_bug.cgi?id=120158 + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> paraEnumAccess(textDocument->getText(), uno::UNO_QUERY); + // list of paragraphs + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + // get contents of 1st paragraph as text + uno::Reference<uno::XInterface> paragraph0(paraEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> text0(paragraph0, uno::UNO_QUERY); + OUString sFieldResult = text0->getString(); + CPPUNIT_ASSERT(sFieldResult.endsWith("AM") || sFieldResult.endsWith("PM")); +} + +DECLARE_WW8EXPORT_TEST(testN816603, "n816603.doc") +{ + // Bugdoc was 5 pages in Word, 1 in Writer due to pointlessly wrapping the + // table in a frame. Exact layout may depend on fonts available, etc. -- + // but at least make sure that our table spans over multiple pages now. + CPPUNIT_ASSERT(getPages() > 1); +} + +DECLARE_WW8EXPORT_TEST(testPageBorder, "page-border.doc") +{ + // Page border was missing (LineWidth was 0), due to wrong interpretation of pgbApplyTo. + table::BorderLine2 aBorder = getProperty<table::BorderLine2>(getStyles("PageStyles")->getByName("Standard"), "TopBorder"); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(convertTwipToMm100(6 * 20)), aBorder.LineWidth); +} + +DECLARE_WW8EXPORT_TEST(testN823651, "n823651.doc") +{ + // Character height was 10pt instead of 7.5pt in the header. + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<text::XText> xText = getProperty< uno::Reference<text::XTextRange> >(xStyle, "HeaderTextFirst")->getText(); + CPPUNIT_ASSERT_EQUAL(7.5f, getProperty<float>(getParagraphOfText(1, xText), "CharHeight")); +} + +DECLARE_WW8EXPORT_TEST(testFdo36868, "fdo36868.doc") +{ + OUString aText = parseDump("/root/page/body/txt[3]/Special[@nType='PortionType::Number']", "rText"); + // This was 1.1. + CPPUNIT_ASSERT_EQUAL(OUString("2.1"), aText); +} + +DECLARE_WW8EXPORT_TEST(testListNolevel, "list-nolevel.doc") +{ + // Similar to fdo#36868, numbering portions had wrong values. + OUString aText = parseDump("/root/page/body/txt[1]/Special[@nType='PortionType::Number']", "rText"); + // PortionType::Number was completely missing. + CPPUNIT_ASSERT_EQUAL(OUString("1."), aText); +} + +DECLARE_WW8EXPORT_TEST(testHeaderApoTable, "ooo92948-1.doc") +{ + // the problem was that a table anchored in the header was split across + // 3 text frames and quite messed up + + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<text::XText> xFrame(xIndexAccess->getByIndex(1), uno::UNO_QUERY); + +// uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>(getStyles("PageStyles")->getByName("Standard"), "HeaderTextFirst"); +// uno::Reference<text::XTextRange> xPara(getParagraphOfText(9, xHeaderText)); +//TODO why does this not work +// uno::Reference<beans::XPropertySet> xFrame(getParagraphAnchoredObject(1, xPara)); + + uno::Reference<text::XTextContent> xTable(getParagraphOrTable(1, xFrame)); + getCell(xTable, "A1", "Aan" SAL_NEWLINE_STRING "Recipient" SAL_NEWLINE_STRING "Recipient" SAL_NEWLINE_STRING); + getCell(xTable, "A2", "Kopie aan" SAL_NEWLINE_STRING); + getCell(xTable, "A3", "Datum" SAL_NEWLINE_STRING "31 juli 2008"); + getCell(xTable, "A4", "Locatie" SAL_NEWLINE_STRING "Locationr"); + getCell(xTable, "A5", "Van" SAL_NEWLINE_STRING "Sender "); + getCell(xTable, "A6", "Directie" SAL_NEWLINE_STRING "Department"); + getCell(xTable, "A7", "Telefoon" SAL_NEWLINE_STRING "Phone"); +} + +DECLARE_WW8EXPORT_TEST(testBnc821208, "bnc821208.doc") +{ + // WW8Num1z0 earned a Symbol font, turning numbers into rectangles. + uno::Reference<beans::XPropertyState> xPropertyState(getStyles("CharacterStyles")->getByName("WW8Num1z0"), uno::UNO_QUERY); + beans::PropertyState ePropertyState = xPropertyState->getPropertyState("CharFontName"); + // This was beans::PropertyState_DIRECT_VALUE. + CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, ePropertyState); + + // Background of the numbering itself should have been the default, was yellow (0xffff00). + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xPropertyState, "CharBackColor")); +} + +DECLARE_WW8EXPORT_TEST(testCp1000044, "cp1000044.doc") +{ + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); + // It wasn't possible to fill out this form. + CPPUNIT_ASSERT_EQUAL(false, bool(xStorable->isReadonly())); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT_EQUAL( true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) ); + + uno::Sequence<beans::PropertyValue> aGrabBag = getProperty< uno::Sequence<beans::PropertyValue> >(mxComponent, "InteropGrabBag"); + sal_Int32 nPasswordHash = 0; + for ( sal_Int32 i = 0; i < aGrabBag.getLength(); ++i ) + { + if ( aGrabBag[i].Name == "FormPasswordHash" ) + aGrabBag[i].Value >>= nPasswordHash; + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Password Hash", sal_Int32(609995782), nPasswordHash); +} + +DECLARE_WW8EXPORT_TEST(testBorderColours, "bordercolours.doc") +{ + // The following 6 colours can only be represented with WW9 (Word 2000) + // BRC (BoRder Control) structures. We can tell that they have been + // exported/imported using a WW8 (Word '97) BRC if they instead come + // through as one of the 16 colours listed at this link: + // http://msdn.microsoft.com/en-us/library/dd773060.aspx + table::BorderLine2 expectedTop(0xFA670C, 0, 53, 0, 1, 53); + table::BorderLine2 expectedLeft(0xD99594, 0, 79, 0, 0, 79); + table::BorderLine2 expectedRight(0xB2A1C7, 53, 53, 53, 3, 159); + table::BorderLine2 expectedBottom(0xB6DDE8, 0, 106, 0, 14, 106); + table::BorderLine2 expectedDashedRed(0xFA670C, 0, 53, 0, 2, 53); + table::BorderLine2 expectedDoubleGreen(0xC2D69B, 26, 106, 26, 4, 159); + + // Paragraph border + uno::Reference<text::XBookmarksSupplier> bookmarksSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> bookmarks = + bookmarksSupplier->getBookmarks(); + uno::Reference<text::XTextContent> bookmark( + bookmarks->getByName("ParagraphBorder"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> anchor(bookmark->getAnchor()); + table::BorderLine2 border; + border = getProperty<table::BorderLine2>(anchor, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(anchor, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(anchor, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); + + // Page border + OUString pageStyleName = getProperty<OUString>(anchor, "PageStyleName"); + uno::Reference<style::XStyle> pageStyle( + getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY); + border = getProperty<table::BorderLine2>(pageStyle, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(pageStyle, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(pageStyle, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(pageStyle, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); + + // Character border + bookmark.set(bookmarks->getByName("CharBorder"), uno::UNO_QUERY); + anchor = bookmark->getAnchor(); + border = getProperty<table::BorderLine2>(anchor, "CharTopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "CharLeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "CharRightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "CharBottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + + // Table border + uno::Reference<text::XTextTablesSupplier> tablesSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> tables = + tablesSupplier->getTextTables(); + uno::Reference<text::XTextTable> table( + tables->getByName("Table1"), uno::UNO_QUERY); + table::TableBorder2 tableBorder = getProperty<table::TableBorder2>( + table, "TableBorder2"); + CPPUNIT_ASSERT_EQUAL(expectedTop.Color, tableBorder.TopLine.Color); + CPPUNIT_ASSERT_EQUAL(expectedLeft.Color, tableBorder.LeftLine.Color); + CPPUNIT_ASSERT_EQUAL(expectedRight.Color, tableBorder.RightLine.Color); + CPPUNIT_ASSERT_EQUAL(expectedBottom.Color, tableBorder.BottomLine.Color); + + // Table cells + uno::Reference<table::XCell> cell = + table->getCellByName("A2"); + border = getProperty<table::BorderLine2>(cell, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(cell, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); + + cell = table->getCellByName("B2"); + border = getProperty<table::BorderLine2>(cell, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + border = getProperty<table::BorderLine2>(cell, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + + cell = table->getCellByName("C2"); + border = getProperty<table::BorderLine2>(cell, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + border = getProperty<table::BorderLine2>(cell, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDashedRed, border); + border = getProperty<table::BorderLine2>(cell, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + + // Picture border + // (#if'd out as they are not yet imported with correct colours) +#if 0 + bookmark.set(bookmarks->getByName("PictureBorder"),uno::UNO_QUERY); + anchor = bookmark->getAnchor(); + border = getProperty<table::BorderLine2>(anchor, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(anchor, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(anchor, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); +#endif +} + +DECLARE_WW8EXPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.doc") +{ + uno::Reference<drawing::XShape> image = getShape(1); + uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY); + uno::Reference<graphic::XGraphic> graphic; + imageProperties->getPropertyValue( "Graphic" ) >>= graphic; + Graphic vclGraphic(graphic); + BitmapEx bitmap(vclGraphic.GetBitmapEx()); + CPPUNIT_ASSERT_EQUAL( tools::Long(58), bitmap.GetSizePixel().Width()); + CPPUNIT_ASSERT_EQUAL( tools::Long(320), bitmap.GetSizePixel().Height()); + CPPUNIT_ASSERT_EQUAL( Color(206,206,206), bitmap.GetPixelColor(16,27)); + CPPUNIT_ASSERT_EQUAL( Color(206,206,206), bitmap.GetPixelColor(22,48)); +} + +DECLARE_WW8EXPORT_TEST(testTdf95321, "tdf95321.doc") +{ + // The problem was that there should be content in the second cell + // but there wasn't. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Second Column"), uno::Reference<text::XTextRange>(xTable->getCellByName("B1"), uno::UNO_QUERY_THROW)->getString()); +} + +DECLARE_WW8EXPORT_TEST(testFdo77844, "fdo77844.doc") +{ + uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles"); + + // get a page cursor + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor( + xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + + // check that the first page has no header + xCursor->jumpToFirstPage(); + OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + uno::Reference<style::XStyle> pageStyle( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + bool headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(!headerIsOn); + + // check that the second page has a header + xCursor->jumpToPage(2); + pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + pageStyle.set( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); + + // check that the third page has a header + xCursor->jumpToPage(3); + pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + pageStyle.set( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); + + // check that the fourth page has no header + // (#if'd out as this is not yet imported correctly) +#if 0 + xCursor->jumpToPage(4); + pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + pageStyle.set( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(!headerIsOn); +#endif +} + +DECLARE_WW8EXPORT_TEST(testFdp80333, "fdo80333.doc") +{ + // Despite there is no character border, border shadow was imported + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); + const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); +} + +DECLARE_WW8EXPORT_TEST(testFdo81102, "fdo81102.doc") +{ + // get page style at beginning of document + uno::Reference<text::XTextDocument> textDocument( + mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextRange> start = + textDocument->getText()->getStart(); + OUString pageStyleName = getProperty<OUString>(start, "PageStyleName"); + uno::Reference<style::XStyle> pageStyle( + getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY); + + // check that left and right pages do not share the same header + bool headerIsShared = getProperty<bool>(pageStyle, "HeaderIsShared"); + CPPUNIT_ASSERT(!headerIsShared); +} + +DECLARE_WW8EXPORT_TEST(testBnc787942, "bnc787942.doc") +{ + // The frame ended up on the second page instead of first. + + // this is on page 1 in Word + parseDump("/root/page[1]/body/txt[4]/anchored"); +} + +DECLARE_WW8EXPORT_TEST(testLayoutHanging, "fdo68967.doc") +{ + // This must not hang in layout +} + +#if HAVE_MORE_FONTS +DECLARE_WW8EXPORT_TEST(testfdo68963, "fdo68963.doc") +{ + // The problem was that the text was not displayed. + CPPUNIT_ASSERT ( !parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText").isEmpty() ); + CPPUNIT_ASSERT_EQUAL( OUString("Topic 1"), parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText") ); + // all crossreference bookmarks should have a target. Shouldn't be any "Reference source not found" in the xml + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), parseDump("/root/page/body/txt[24]/Special[2]","rText").indexOf("Reference source not found")); +} +#endif + +DECLARE_WW8EXPORT_TEST(testTdf99100, "tdf99100.doc") +{ + uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Standard"), "HeaderText"); + auto xField = getProperty< uno::Reference<lang::XServiceInfo> >(getRun(getParagraphOfText(1, xHeaderText), 2), "TextField"); + // This failed: the second text portion wasn't a field. + CPPUNIT_ASSERT(xField.is()); + CPPUNIT_ASSERT(xField->supportsService("com.sun.star.text.textfield.Chapter")); +} + +DECLARE_WW8EXPORT_TEST(testTdf74328, "tdf74328.doc") +{ +/* +reading page numbers at sections > 255, in this case 256 +*/ + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextCursor> xTextCursor = textDocument->getText()->createTextCursor( ); + uno::Reference<beans::XPropertySet> xProps(xTextCursor, uno::UNO_QUERY); + uno::Any aOffset = xProps->getPropertyValue("PageNumberOffset"); + sal_Int16 nOffset = 0; + aOffset >>= nOffset; + CPPUNIT_ASSERT_EQUAL(sal_Int16(256), nOffset); +} + +DECLARE_WW8EXPORT_TEST(testTdf95576, "tdf95576.doc") +{ + // The first three paragraphs in this document (which are headings) + // should have zero indent and first line indent + for (int nPara = 1; nPara <= 3; ++nPara) { + std::cout << "nPara = " << nPara << "\n"; + auto xPara = getParagraph(nPara); + + // get the numbering rules effective at this paragraph + uno::Reference<container::XIndexReplace> xNumRules = + getProperty< uno::Reference<container::XIndexReplace> >( + xPara, "NumberingRules"); + + // get the numbering level of this paragraph, and the properties + // associated with that numbering level + int numLevel = getProperty<sal_Int32>(xPara, "NumberingLevel"); + uno::Sequence< beans::PropertyValue > aPropertyValues; + xNumRules->getByIndex(numLevel) >>= aPropertyValues; + + // Now look through these properties for the indent and + // first line indent settings + sal_Int32 nIndentAt = -1; + sal_Int32 nFirstLineIndent = -1; + for(int j = 0 ; j< aPropertyValues.getLength() ; ++j) + { + auto aProp = aPropertyValues[j]; + std::cout << "Prop.Name: " << aProp.Name << "\n"; + if (aProp.Name == "FirstLineIndent") { + nFirstLineIndent = aProp.Value.get<sal_Int32>(); + } else if (aProp.Name == "IndentAt") { + nIndentAt = aProp.Value.get<sal_Int32>(); + } + } + + // The indent and first line indent should be zero + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nIndentAt); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nFirstLineIndent); + } +} + +DECLARE_WW8EXPORT_TEST(testTdf59896, "tdf59896.doc") +{ + // This was awt::FontWeight::NORMAL, i.e. the first run wasn't bold, when it should be bold + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight")); +} + +DECLARE_WW8EXPORT_TEST(testTdf102334, "tdf102334.doc") +{ + // This was false, i.e. the first run wasn't hidden, when it should have been + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getRun(getParagraph(7), 1), "CharHidden")); +} + +DECLARE_WW8EXPORT_TEST(testTdf128605, "tdf128605.doc") +{ + OUString aPara1PageStyleName = getProperty<OUString>(getParagraph(1), "PageStyleName"); + OUString aPara2PageStyleName = getProperty<OUString>(getParagraph(2), "PageStyleName"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: Standard + // - Actual : Convert 1 + // i.e. the continuous section break resulted in an unwanted page break. + CPPUNIT_ASSERT_EQUAL(aPara1PageStyleName, aPara2PageStyleName); +} + +DECLARE_WW8EXPORT_TEST(testTdf112535, "tdf112535.doc") +{ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc->GetSpzFrameFormats()); + + SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats(); + CPPUNIT_ASSERT(!rFormats.empty()); + + const SwFrameFormat* pFormat = rFormats[0]; + CPPUNIT_ASSERT(pFormat); + + // Without the accompanying fix in place, this test would have failed: auto-contour was enabled + // in Writer, but not in Word. + CPPUNIT_ASSERT(!pFormat->GetSurround().IsContour()); +} + +DECLARE_WW8EXPORT_TEST(testTdf106291, "tdf106291.doc") +{ + // Table cell was merged vertically instead of horizontally -> had incorrect dimensions + OUString cellWidth = parseDump("/root/page[1]/body/tab/row/cell[1]/infos/bounds", "width"); + OUString cellHeight = parseDump("/root/page[1]/body/tab/row/cell[1]/infos/bounds", "height"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8650), cellWidth.toInt32()); + CPPUNIT_ASSERT(cellHeight.toInt32() > 200); // height might depend on font size +} + +DECLARE_WW8EXPORT_TEST(testTransparentText, "transparent-text.doc") +{ + uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( + getStyles("PageStyles")->getByName("Standard"), "HeaderText"); + uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(3, xHeaderText); + // Without the accompanying fix in place, this test would have failed: transparency was set to + // 100%, so the text was not readable. + sal_Int32 nExpected(COL_BLACK); + sal_Int32 nActual(getProperty<sal_Int16>(xParagraph, "CharTransparence")); + CPPUNIT_ASSERT_EQUAL(nExpected, nActual); +} + +DECLARE_WW8EXPORT_TEST( testTdf105570, "tdf105570.doc" ) +{ + /***** + * MS-DOC specification ( https://msdn.microsoft.com/en-us/library/cc313153 ) + * ch. 2.6.3, sprmTTableHeader: + * A Bool8 value that specifies that the current table row is a header row. + * If the value is 0x01 but sprmTTableHeader is not applied with a value of 0x01 + * for a previous row in the same table, then this property MUST be ignored. + * + * The document have three tables with three rows. + * Table 1 has { 1, 0, 0 } values of the "repeat as header row" property for each row + * Table 2 has { 1, 1, 0 } + * Table 3 has { 0, 1, 1 } + ****/ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwShellCursor* pShellCursor = pWrtShell->getShellCursor( false ); + SwNodeIndex aIdx = pShellCursor->Start()->nNode; + + // Find first table + SwTableNode* pTableNd = aIdx.GetNode().FindTableNode(); + + CPPUNIT_ASSERT_EQUAL( sal_uInt16(1), pTableNd->GetTable().GetRowsToRepeat() ); + + // Go to next table + aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 ); + while ( nullptr == (pTableNd = aIdx.GetNode().GetTableNode()) ) ++aIdx; + + CPPUNIT_ASSERT_EQUAL( sal_uInt16(2), pTableNd->GetTable().GetRowsToRepeat() ); + + // Go to next table + aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 ); + while ( nullptr == (pTableNd = aIdx.GetNode().GetTableNode()) ) ++aIdx; + + // As first row hasn't sprmTTableHeader set, all following must be ignored, so no rows must be repeated + CPPUNIT_ASSERT_EQUAL( sal_uInt16(0), pTableNd->GetTable().GetRowsToRepeat() ); +} + +DECLARE_WW8EXPORT_TEST(testTdf112346, "tdf112346.doc") +{ + // This was 1, multi-page table was imported as a floating one. + CPPUNIT_ASSERT_EQUAL(0, getShapes()); +} + +DECLARE_WW8EXPORT_TEST(testTdf79639, "tdf79639.doc") +{ + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // as the floating table in the header wasn't converted to a TextFrame. + CPPUNIT_ASSERT_EQUAL(1, getShapes()); +} + +DECLARE_WW8EXPORT_TEST(testTdf122425_2, "tdf122425_2.doc") +{ + // This is for graphic objects in headers/footers + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false); + // There is one fly frame in the document: the text box + CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size()); + for (const auto& rPosFlyFrame : aPosFlyFrames) + { + const SwFrameFormat& rFormat = rPosFlyFrame->GetFormat(); + const SfxPoolItem* pItem = nullptr; + + // Check for correct explicitly-set values of UL spacings. Previously this was "DEFAULT", + // and resulted in inherited values (114 = 2 mm) used. + CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_UL_SPACE, false, &pItem)); + auto pUL = static_cast<const SvxULSpaceItem*>(pItem); + CPPUNIT_ASSERT(pUL); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pUL->GetUpper()); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pUL->GetLower()); + } +} + +DECLARE_WW8EXPORT_TEST(testTdf130262, "tdf130262.doc") +{ + // We had an infinite layout loop +} + +DECLARE_WW8EXPORT_TEST(testTdf38778, "tdf38778_properties_in_run_for_field.doc") +{ + CPPUNIT_ASSERT_EQUAL(10.0f, getProperty<float>(getRun(getParagraph(1), 1), "CharHeight")); + CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName")); +} + +DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc") +{ + /* + * The problem was that the transparent background of the drawing in the + * header was exported as non-transparent. + * + * xray ThisComponent.DrawPage(0).BackColorTransparency + */ + + CPPUNIT_ASSERT_EQUAL(Color(0x000064), getProperty< Color >(getShape(1), "BackColorTransparency")); +} + +DECLARE_WW8EXPORT_TEST(testTscp, "tscp.doc") +{ + uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext()); + uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, "urn:bails"); + uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(mxComponent, uno::UNO_QUERY); + uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = xDocumentMetadataAccess->getMetadataGraphsWithType(xType); + // This failed, no graphs had the urn:bails type. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aGraphNames.getLength()); + uno::Reference<rdf::XURI> xGraphName = aGraphNames[0]; + uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName); + + // No RDF statement on the first paragraph. + uno::Reference<rdf::XResource> xParagraph(getParagraph(1), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>()); + CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(xStatements->hasMoreElements())); + + // 3 RDF statements on the second paragraph. + xParagraph.set(getParagraph(2), uno::UNO_QUERY); + std::map<OUString, OUString> aExpectedStatements = + { + {"urn:bails:ExportControl:BusinessAuthorization:Identifier", "urn:example:tscp:1"}, + {"urn:bails:ExportControl:BusinessAuthorizationCategory:Identifier", "urn:example:tscp:1:confidential"}, + {"urn:bails:ExportControl:Authorization:StartValidity", "2015-11-27"} + }; + std::map<OUString, OUString> aActualStatements; + xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>()); + while (xStatements->hasMoreElements()) + { + rdf::Statement aStatement = xStatements->nextElement().get<rdf::Statement>(); + aActualStatements[aStatement.Predicate->getNamespace() + aStatement.Predicate->getLocalName()] = aStatement.Object->getStringValue(); + } + CPPUNIT_ASSERT(bool(aExpectedStatements == aActualStatements)); + + // No RDF statement on the third paragraph. + xParagraph.set(getParagraph(3), uno::UNO_QUERY); + xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>()); + CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(xStatements->hasMoreElements())); +} + +DECLARE_WW8EXPORT_TEST(testFdo45724, "fdo45724.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // The text and background color of the control shape was not correct. + uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY); + uno::Reference<form::validation::XValidatableFormComponent> xComponent(xControlShape->getControl(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xComponent, "BackgroundColor")); + CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>()); +} + +DECLARE_WW8EXPORT_TEST(testTdf136620, "tdf136620.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + uno::Reference<drawing::XShape> xShape = getShape(1); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(5636), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1826), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6630), xShape->getSize().Height); + + // Without the fix in place, this test would have failed with + // - Expected: 5853 + // - Actual : 850 + CPPUNIT_ASSERT_EQUAL(sal_Int32(5853), xShape->getSize().Width); +} + +DECLARE_WW8EXPORT_TEST(testFdo46020, "fdo46020.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // The footnote in that document wasn't exported, check that it is actually exported + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); +} + +DECLARE_WW8EXPORT_TEST(testFirstHeaderFooter, "first-header-footer.doc") +{ + // Test import and export of a section's headerf/footerf properties. + + // The document has 6 pages. Note that we don't test if 4 or just 2 page + // styles are created, the point is that layout should be correct. + CPPUNIT_ASSERT_EQUAL(OUString("First page header"), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First page footer"), parseDump("/root/page[1]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page header"), parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page footer"), parseDump("/root/page[2]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page header"), parseDump("/root/page[3]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer"), parseDump("/root/page[3]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First page header2"), parseDump("/root/page[4]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First page footer 2"), parseDump("/root/page[4]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page header 2"), parseDump("/root/page[5]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer 2"), parseDump("/root/page[5]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page header 2"), parseDump("/root/page[6]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"), parseDump("/root/page[6]/footer/txt/text()")); +} + +DECLARE_WW8EXPORT_TEST(testZoom, "zoom.doc") +{ + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings()); + sal_Int16 nValue = 0; + xPropertySet->getPropertyValue("ZoomValue") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue); +} + +DECLARE_WW8EXPORT_TEST(testZoomType, "zoomtype.doc") +{ + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings()); + sal_Int16 nValue = 0; + xPropertySet->getPropertyValue("ZoomType") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(view::DocumentZoomType::PAGE_WIDTH), nValue); +} + +DECLARE_WW8EXPORT_TEST(test56513, "fdo56513.doc") +{ + CPPUNIT_ASSERT_EQUAL(OUString("This is the header of the first section"), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header of the second section"), parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header of the second section"), parseDump("/root/page[3]/header/txt/text()")); +} + +DECLARE_WW8EXPORT_TEST(testNewPageStylesTable, "new-page-styles.doc") +{ + CPPUNIT_ASSERT_EQUAL(OUString("Sigma Space Performance Goals and Results (Page 1)*"), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Sigma Space Performance Assessment (Page 2)****"), parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Sigma Space Performance Goals: Next Year (Page 3)*******"), parseDump("/root/page[3]/header/txt/text()")); +} + +DECLARE_WW8EXPORT_TEST(testFdo42144, "fdo42144.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // Footer wasn't disabled -- instead empty footer was exported. + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStyle, "FooterIsOn")); +} + +DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); + // WW8 has just one border attribute (sprmCBrc) for text border so all side has + // the same border + // Border + { + const table::BorderLine2 aTopBorder = getProperty<table::BorderLine2>(xRun,"CharTopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF3333,0,318,0,0,318), aTopBorder); + CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharLeftBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharBottomBorder")); + CPPUNIT_ASSERT_BORDER_EQUAL(aTopBorder, getProperty<table::BorderLine2>(xRun,"CharRightBorder")); + } + + // Padding (dptSpace) it is constant 0 + { + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharTopBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharLeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharBottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun,"CharRightBorderDistance")); + } + + // Shadow (fShadow) + /* WW8 use just one bool value for shadow so the next conversions + are made during an export-import round + color: any -> black + location: any -> bottom-right + width: any -> border width */ + { + const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color)); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth); + } +} + +DECLARE_WW8EXPORT_TEST(testTdf41542_imagePadding, "tdf41542_imagePadding.odt") +{ + CPPUNIT_ASSERT_EQUAL(3, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // borderlessImage - image WITHOUT BORDERS : simulate padding with -crop + text::GraphicCrop crop = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop"); + CPPUNIT_ASSERT( crop.Left != 0 ); + CPPUNIT_ASSERT( crop.Right != 0 ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top ); + CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right ); + + // borderedImage - image WITH BORDERS : simulate padding with -crop + crop = getProperty<text::GraphicCrop>(getShape(3), "GraphicCrop"); + CPPUNIT_ASSERT( crop.Left != 0 ); + CPPUNIT_ASSERT( crop.Right != 0 ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Top ); + CPPUNIT_ASSERT_EQUAL( crop.Right, crop.Bottom ); + CPPUNIT_ASSERT_EQUAL( crop.Left, crop.Right ); +} + +DECLARE_WW8EXPORT_TEST(testFdo77454, "fdo77454.doc") +{ + { + // check negative crops round-trip (with border/padding of 1) + text::GraphicCrop const crop = + getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop"); + CPPUNIT_ASSERT(abs(sal_Int32( -439) - crop.Left) <= 2); + CPPUNIT_ASSERT(abs(sal_Int32(-7040) - crop.Right) <= 2); + CPPUNIT_ASSERT(abs(sal_Int32( -220) - crop.Top) <= 2); + CPPUNIT_ASSERT(abs(sal_Int32(-7040) - crop.Bottom) <= 2); + } + + { + // check positive crops round-trip (with padding of 1) + text::GraphicCrop const crop = + getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop"); + CPPUNIT_ASSERT(abs(sal_Int32( 326) - crop.Left) <= 3); + CPPUNIT_ASSERT(abs(sal_Int32(1208) - crop.Right) <= 3); + CPPUNIT_ASSERT(abs(sal_Int32(1635) - crop.Top) <= 3); + CPPUNIT_ASSERT(abs(sal_Int32( 95) - crop.Bottom) <= 3); + } +} + +DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc") +{ + // See ooxmlexport's testFdo38244(). + // Test comment range feature. + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + xRunEnum->nextElement(); + uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType")); + xRunEnum->nextElement(); + xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType")); + + // Test initials. + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials")); + + // Test commented text range which spans over more text nodes + // Comment starts in the second paragraph + xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xRunEnum = xRunEnumAccess->createEnumeration(); + xRunEnum->nextElement(); + xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), getProperty<OUString>(xPropertySet, "TextPortionType")); + // Comment ends in the third paragraph + xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xRunEnum = xRunEnumAccess->createEnumeration(); + xRunEnum->nextElement(); + xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), getProperty<OUString>(xPropertySet, "TextPortionType")); +} + +DECLARE_WW8EXPORT_TEST(testCommentsNested, "comments-nested.doc") +{ + uno::Reference<beans::XPropertySet> xOuter = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"); + CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content")); + + uno::Reference<beans::XPropertySet> xInner = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField"); + CPPUNIT_ASSERT_EQUAL(OUString("Inner"), getProperty<OUString>(xInner, "Content")); +} + +DECLARE_WW8EXPORT_TEST(testBorderColoursExport, "bordercolours.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // This is very close to testBorderColours in ww8import.cxx, but for export + + // The following 6 colours can only be represented with WW9 (Word 2000) + // BRC (BoRder Control) structures. We can tell that they have been + // exported/imported using a WW8 (Word '97) BRC if they instead come + // through as one of the 16 colours listed at this link: + // http://msdn.microsoft.com/en-us/library/dd773060.aspx + table::BorderLine2 expectedTop(0xFA670C, 0, 53, 0, 1, 53); + table::BorderLine2 expectedLeft(0xD99594, 0, 79, 0, 0, 79); + table::BorderLine2 expectedRight(0xB2A1C7, 53, 53, 53, 3, 159); + table::BorderLine2 expectedBottom(0xB6DDE8, 0, 106, 0, 14, 106); + table::BorderLine2 expectedDashedRed(0xFA670C, 0, 53, 0, 2, 53); + table::BorderLine2 expectedDoubleGreen(0xC2D69B, 26, 106, 26, 4, 159); + + // Paragraph border + uno::Reference<text::XBookmarksSupplier> bookmarksSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> bookmarks = + bookmarksSupplier->getBookmarks(); + uno::Reference<text::XTextContent> bookmark( + bookmarks->getByName("ParagraphBorder"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> anchor(bookmark->getAnchor()); + table::BorderLine2 border; + border = getProperty<table::BorderLine2>(anchor, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(anchor, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(anchor, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); + + // Page border + OUString pageStyleName = getProperty<OUString>(anchor, "PageStyleName"); + uno::Reference<style::XStyle> pageStyle( + getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY); + border = getProperty<table::BorderLine2>(pageStyle, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(pageStyle, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(pageStyle, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(pageStyle, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); + + // Character border + bookmark.set(bookmarks->getByName("CharBorder"), uno::UNO_QUERY); + anchor = bookmark->getAnchor(); + border = getProperty<table::BorderLine2>(anchor, "CharTopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "CharLeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "CharRightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "CharBottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + + // Table border + uno::Reference<text::XTextTablesSupplier> tablesSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> tables = + tablesSupplier->getTextTables(); + uno::Reference<text::XTextTable> table( + tables->getByName("Table1"), uno::UNO_QUERY); + table::TableBorder2 tableBorder = getProperty<table::TableBorder2>( + table, "TableBorder2"); + CPPUNIT_ASSERT_EQUAL(expectedTop.Color, tableBorder.TopLine.Color); + CPPUNIT_ASSERT_EQUAL(expectedLeft.Color, tableBorder.LeftLine.Color); + CPPUNIT_ASSERT_EQUAL(expectedRight.Color, tableBorder.RightLine.Color); +#if 0 + // #if'd out because the "fine dashed" border line style for table borders + // does not seem to save or load correctly in odt format at present + CPPUNIT_ASSERT_EQUAL(expectedBottom.Color, tableBorder.BottomLine.Color); +#endif + + // Table cells + uno::Reference<table::XCell> cell = + table->getCellByName("A2"); + border = getProperty<table::BorderLine2>(cell, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(cell, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); +#if 0 + // #if'd out because the "fine dashed" border line style for table borders + // does not seem to save or load correctly in odt format at present + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); +#endif + + cell = table->getCellByName("B2"); + border = getProperty<table::BorderLine2>(cell, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + border = getProperty<table::BorderLine2>(cell, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + + cell = table->getCellByName("C2"); + border = getProperty<table::BorderLine2>(cell, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + border = getProperty<table::BorderLine2>(cell, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDashedRed, border); + border = getProperty<table::BorderLine2>(cell, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedDoubleGreen, border); + + // Picture border + // (#if'd out as they are not yet exported with correct colours) +#if 0 + bookmark.set(bookmarks->getByName("PictureBorder"),uno::UNO_QUERY); + anchor = bookmark->getAnchor(); + border = getProperty<table::BorderLine2>(anchor, "TopBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); + border = getProperty<table::BorderLine2>(anchor, "LeftBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); + border = getProperty<table::BorderLine2>(anchor, "RightBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedRight, border); + border = getProperty<table::BorderLine2>(anchor, "BottomBorder"); + CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); +#endif +} + +DECLARE_WW8EXPORT_TEST(testRedlineExport1, "redline-export-1.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextRange> xParagraph = getParagraph(1); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + //there must be no redline information on the first line before and after reloading + while (xRunEnum->hasMoreElements()) + { + uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(false, hasProperty(xRun, "RedlineType")); + } +} + +DECLARE_WW8EXPORT_TEST(testRedlineExport2, "redline-export-2.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + //there must be redline information on the first portion of the third paragraph before and after reloading + CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(3), 1), "RedlineType")); +} + +DECLARE_WW8EXPORT_TEST(testRedlineExport3, "redline-export-3.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + //there must be redline information just on the para-break boundary between para one and two + CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(1), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(1), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true, hasProperty(getRun(getParagraph(2), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(2), 2), "RedlineType")); +} + +DECLARE_WW8EXPORT_TEST(testCellBgColor, "cell-bg-color.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(Color(0xCC0000), getProperty<Color>(xTable->getCellByName("A1"), "BackColor")); +} + +DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc") +{ + // Import / export of FFData.cch was missing. + uno::Reference<text::XFormField> xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(1), 2), "Bookmark"); + uno::Reference<container::XNameContainer> xParameters = xFormField->getParameters(); + // This resulted in a container.NoSuchElementException. + CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), xParameters->getByName("MaxLength").get<sal_uInt16>()); +} + + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist30, "cjklist30.doc") +{ + sal_Int16 numFormat = getNumberingTypeOfParagraph(1); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::TIAN_GAN_ZH, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist31, "cjklist31.doc") +{ + sal_Int16 numFormat = getNumberingTypeOfParagraph(1); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::DI_ZI_ZH, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist34, "cjklist34.doc") +{ + sal_Int16 numFormat = getNumberingTypeOfParagraph(1); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH_TW, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testWw8Cjklist35, "cjklist35.doc") +{ + sal_Int16 numFormat = getNumberingTypeOfParagraph(1); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testTdf118564, "tdf118564.doc") +{ + sal_Int16 numFormat = getNumberingTypeOfParagraph(3); + CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat); +} + +DECLARE_WW8EXPORT_TEST(testTdf92281, "tdf92281.doc") +{ + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty<OUString>(xRun, "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty<OUString>(xRun, "CharFontNameAsian")); + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty<OUString>(xRun, "CharFontNameComplex")); + + uno::Reference<text::XText> xXText = getParagraph(1)->getText(); + uno::Reference<text::XTextCursor> xCursor = xXText->createTextCursor(); + + xCursor->goRight( 5 , false ); + uno::Reference< beans::XPropertySet > xPropSet(xCursor, uno::UNO_QUERY); + static constexpr OUStringLiteral aFontname = u"\u65B0\u7D30\u660E\u9AD4;PMingLiU"; + CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty<OUString>(xPropSet, "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString(aFontname), getProperty<OUString>(xPropSet, "CharFontNameAsian")); + CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), getProperty<OUString>(xPropSet, "CharFontNameComplex")); +} + +DECLARE_WW8EXPORT_TEST(testCommentedTable, "commented-table.doc") +{ + // Document has a non-trivial commented text range, as the range contains a table. + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<text::XTextContent> xField(xFields->nextElement(), uno::UNO_QUERY); + // After first import, there was an off-by-one during import, so this was "efore.\nA1\nB1\nAfte". (Notice the additional "e" prefix.) + // After export and import, things got worse, this was "\nA1\nB1\nAfte". + CPPUNIT_ASSERT_EQUAL(OUString("fore." SAL_NEWLINE_STRING "A1" SAL_NEWLINE_STRING "B1" SAL_NEWLINE_STRING "Afte"), xField->getAnchor()->getString()); +} + +DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment.doc") +{ + //Preserve the page vertical alignment setting for .doc + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc); + + SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 ); + drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment(); + CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_CENTER, nVA ); + + pDesc = &pDoc->GetPageDesc( 1 ); + nVA = pDesc->GetVerticalAdjustment(); + CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_TOP, nVA ); + + pDesc = &pDoc->GetPageDesc( 2 ); + nVA = pDesc->GetVerticalAdjustment(); + CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BOTTOM, nVA ); + + pDesc = &pDoc->GetPageDesc( 3 ); + nVA = pDesc->GetVerticalAdjustment(); + CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BLOCK, nVA ); +} + +DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc") +{ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc); + + for (SwNodeOffset n(0); ; n++) + { + SwNode* pNode = pDoc->GetNodes()[ n ]; + if (SwGrfNode *pGrfNode = pNode->GetGrfNode()) + { + CPPUNIT_ASSERT_EQUAL(int(MirrorGraph::Both), static_cast<int>(pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue())); + break; + } + } +} + +DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + struct TextPortionInfo { + OUString sKind; + OUString sText; + int nAnnotationID; + }; + + const TextPortionInfo aTextPortions[] = { + {OUString("Annotation"), OUString("Comment on [A...A]"), 0}, + {OUString("Text"), OUString("[A xx "), 0}, + {OUString("Annotation"), OUString("Comment on [B...B]"), 1}, + {OUString("Text"), OUString("[B x "), 0}, + {OUString("Annotation"), OUString("Comment on [C..C]"), 2}, + {OUString("Text"), OUString("[C x B]"), 0}, + {OUString("AnnotationEnd"), OUString(), 1}, + {OUString("Text"), OUString(" x C]"), 0}, + {OUString("AnnotationEnd"), OUString(), 2}, + {OUString("Text"), OUString(" xx A]"), 0}, + {OUString("AnnotationEnd"), OUString(), 0}, + {OUString("Text"), OUString(" Comment on a point"), 0}, + {OUString("Annotation"), OUString("Comment on point"), 3}, + {OUString("Text"), OUString("x "), 0}, + {OUString("Annotation"), OUString("Comment on AA...BB"), 4}, + {OUString("Annotation"), OUString("Comment on AAAAAA"), 5}, + {OUString("Text"), OUString("AAAAAA"), 0}, + {OUString("AnnotationEnd"), OUString(), 5}, + {OUString("Text"), OUString(" BBBBBB"), 0}, + {OUString("AnnotationEnd"), OUString(), 4} + }; + + OUString sNames[6]; + + const int nNumberOfTextPortions = SAL_N_ELEMENTS(aTextPortions); + + uno::Reference<text::XTextRange> xPara = getParagraph(1); + + for (int i = 0; i < nNumberOfTextPortions; ++i) + { + OUString sKind = aTextPortions[i].sKind; + uno::Reference<text::XTextRange> xRun = getRun(xPara, i + 1); + uno::Reference<beans::XPropertySet> xPropertySet(xRun, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sKind, getProperty<OUString>(xPropertySet, "TextPortionType")); + + if (sKind == "Text") + { + // Check if textportion has the correct text + CPPUNIT_ASSERT_EQUAL(aTextPortions[i].sText, xRun->getString()); + } + else if (sKind == "Annotation") + { + // Check if the comment text is correct and save the name of the comment + uno::Reference<beans::XPropertySet> xComment = getProperty< uno::Reference<beans::XPropertySet> >(xRun, "TextField"); + CPPUNIT_ASSERT_EQUAL(aTextPortions[i].sText, getProperty<OUString>(xComment, "Content")); + sNames[aTextPortions[i].nAnnotationID] = getProperty<OUString>(xComment, "Name"); + } + else // if (sKind == OUString("AnnotationEnd")) + { + // Check if the correct Annotation ends here (by Name) + uno::Reference<container::XNamed> xBookmark(getProperty< uno::Reference<beans::XPropertySet> >(xRun, "Bookmark"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sNames[aTextPortions[i].nAnnotationID], xBookmark->getName()); + } + } +} + +#if HAVE_MORE_FONTS +DECLARE_WW8EXPORT_TEST(testTableKeep, "tdf91083.odt") +{ + CPPUNIT_ASSERT_EQUAL(7, getPages()); + //emulate table "keep with next" -do not split table + CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[3]/body/tab[1]/row[2]/cell[1]/txt[1]") ); + CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[6]/body/tab[1]/row[2]/cell[1]/txt[1]") ); +} +#endif + +DECLARE_WW8EXPORT_TEST(tesTdf91083_tableKeep2, "tdf91083_tableKeep2.odt") +{ + //emulate table "keep with next" - split large row in order to keep with previous paragraph + CPPUNIT_ASSERT_EQUAL_MESSAGE("Table doesn't split, so it starts on page 2", + OUString("0"), parseDump("count(//page[1]//tab)") ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Page 2 starts with a paragraph/title, not a table", + OUString("KeepWithNext"), parseDump("//page[2]/body/txt[1]") ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Table sticks with previous paragraph, so it starts on page 2", + OUString("1"), parseDump("count(//page[2]//tab)") ); + CPPUNIT_ASSERT_MESSAGE("Row itself splits, not the table at a row boundary", + "Cell 2" != parseDump("//page[3]//tab//row[2]/cell[1]/txt[1]") ); +} + +DECLARE_WW8EXPORT_TEST(tesTdf91083_tableKeep3, "tdf91083_tableKeep3.odt") +{ + CPPUNIT_ASSERT_EQUAL(3, getPages()); + //emulate table "keep with next" - split single row table in order to keep with previous paragraph + CPPUNIT_ASSERT_EQUAL_MESSAGE("Table doesn't split, so it starts on page 2", + OUString("0"), parseDump("count(//page[1]//tab)") ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Table sticks with previous paragraph, so it starts on page 2", + OUString("1"), parseDump("count(//page[2]//tab)") ); +} + +DECLARE_WW8EXPORT_TEST(testTdf76349_textboxMargins, "tdf76349_textboxMargins.doc") +{ + // textboxes without borders were losing their spacing items in round-tripping + CPPUNIT_ASSERT( 0 < parseDump("/root/page/body/txt/anchored/fly/infos/prtBounds", "left").toInt32() ); + + uno::Reference<drawing::XShape> xShape = getShape(1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Textbox background color", Color(0xD8, 0xD8, 0xD8), getProperty<Color>(xShape, "BackColor")); +} + +DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt") +{ + //the save must survive without asserting +} + +DECLARE_WW8EXPORT_TEST(testClearFramePams, "tdf46441-2.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + //the save must survive without asserting +} + +DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt") +{ + // check that the first and next page use different page styles + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor( + xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + + xCursor->jumpToFirstPage(); + OUString firstPageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + xCursor->jumpToLastPage(); + OUString lastPageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + CPPUNIT_ASSERT(firstPageStyleName != lastPageStyleName); + + uno::Reference<beans::XPropertySet> xFirstPropertySet(getStyles("PageStyles")->getByName(firstPageStyleName), uno::UNO_QUERY); + awt::Size fSize; + xFirstPropertySet->getPropertyValue("Size") >>= fSize; + + uno::Reference<beans::XPropertySet> xNextPropertySet(getStyles("PageStyles")->getByName(lastPageStyleName), uno::UNO_QUERY); + awt::Size lSize; + xNextPropertySet->getPropertyValue("Size") >>= lSize; + + CPPUNIT_ASSERT((fSize.Width != lSize.Width)); + CPPUNIT_ASSERT((fSize.Height != lSize.Height)); +} + +DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // The bullet colour of paragraph #3 should be COL_AUTO + auto xPara = getParagraph(3); + uno::Reference<container::XIndexReplace> xNumRules = + getProperty< uno::Reference<container::XIndexReplace> >( + xPara, "NumberingRules"); + + int numLevel = getProperty<sal_Int32>(xPara, "NumberingLevel"); + uno::Sequence< beans::PropertyValue > aPropertyValues; + xNumRules->getByIndex(numLevel) >>= aPropertyValues; + OUString charStyleName; + for(int j = 0 ; j< aPropertyValues.getLength() ; ++j) + { + auto aProp = aPropertyValues[j]; + if (aProp.Name == "CharStyleName") { + charStyleName = aProp.Value.get<OUString>(); + break; + } + } + CPPUNIT_ASSERT(charStyleName.getLength()); + uno::Reference<beans::XPropertySet> xStyle( + getStyles("CharacterStyles")->getByName(charStyleName), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xStyle, "CharColor")); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx new file mode 100644 index 000000000..40311d9e5 --- /dev/null +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -0,0 +1,1104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/text/XDependentTextField.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/text/XFootnote.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/XFootnotesSupplier.hpp> +#include <com/sun/star/text/XEndnotesSupplier.hpp> + +#include <svx/svdpage.hxx> + +#include <ftninfo.hxx> +#include <drawdoc.hxx> +#include <IDocumentDrawModelAccess.hxx> +#include <docsh.hxx> +#include <unotxdoc.hxx> +#include <o3tl/string_view.hxx> + +class Test : public SwModelTestBase +{ +public: + Test() : SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97") {} + + bool mustTestImportOf(const char* filename) const override + { + // If the testcase is stored in some other format, it's pointless to test. + return o3tl::ends_with(filename, ".doc"); + } + +}; +DECLARE_WW8EXPORT_TEST(testTdf99120, "tdf99120.doc") +{ + CPPUNIT_ASSERT_EQUAL(OUString("Section 1, odd."), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Section 1, even."), parseDump("/root/page[2]/header/txt/text()")); + // This failed: the header was empty on the 3rd page, as the first page header was shown. + CPPUNIT_ASSERT_EQUAL(OUString("Section 2, odd."), parseDump("/root/page[3]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Section 2, even."), parseDump("/root/page[4]/header/txt/text()")); +} + +DECLARE_WW8EXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPadding.odt") +{ + // the page style's borderless padding should force this to 3 pages, not 1 + CPPUNIT_ASSERT_EQUAL( 3, getPages() ); +} + +DECLARE_WW8EXPORT_TEST(testTdf60378_mergedBorders, "tdf60378_mergedBorders.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + + // The border width was zero + table::BorderLine2 aBorder = getProperty<table::BorderLine2>(xTable->getCellByName("B2"), "RightBorder"); + CPPUNIT_ASSERT(aBorder.LineWidth > 0); +} + +DECLARE_WW8EXPORT_TEST(testTdf55528_relativeTableWidth, "tdf55528_relativeTableWidth.doc") +{ + + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Table relative width percent", sal_Int16(98), getProperty<sal_Int16>(xTable, "RelativeWidth")); + } + +DECLARE_WW8EXPORT_TEST(testTdf128700_relativeTableWidth, "tdf128700_relativeTableWidth.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + + // Since the table has been converted into a floating frame, the relative width either needed to be transferred + // onto the frame, or else just thrown out. Otherwise it becomes relative to the size of the frame. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Floated table can't use relative width", sal_Int16(0), getProperty<sal_Int16>(xTable, "RelativeWidth")); +} + +DECLARE_WW8EXPORT_TEST(testTdf116436_tableBackground, "tdf116436_tableBackground.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<table::XCell> xCell = xTable->getCellByName("A1"); + CPPUNIT_ASSERT_EQUAL(Color(0xF8DF7C), getProperty<Color>(xCell, "BackColor")); + xCell.set(xTable->getCellByName("A6")); + CPPUNIT_ASSERT_EQUAL(Color(0x81D41A), getProperty<Color>(xCell, "BackColor")); + xCell.set(xTable->getCellByName("B6")); + CPPUNIT_ASSERT_EQUAL(Color(0xFFFBCC), getProperty<Color>(xCell, "BackColor")); +} + +DECLARE_WW8EXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.doc") +{ + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty<text::WrapTextMode>(getShape(1), "Surround")); + + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::VertOrientation::BOTTOM, getProperty<sal_Int16>(xTable->getCellByName("A1"), "VertOrient")); + + //For MSO compatibility, the image should be at the top of the cell, not at the bottom - despite VertOrientation::BOTTOM + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + sal_Int32 nFlyTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/txt/anchored/fly/infos/bounds", "top").toInt32(); + CPPUNIT_ASSERT_MESSAGE("FlyTop should be 3820, not 6623", nFlyTop < 4000); + sal_Int32 nTextTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[2]/txt[1]/infos/bounds", "top").toInt32(); + CPPUNIT_ASSERT_MESSAGE("TextTop should be 5388", nTextTop > 4000); +} + +DECLARE_WW8EXPORT_TEST(testTdf49102_mergedCellNumbering, "tdf49102_mergedCellNumbering.doc") +{ + CPPUNIT_ASSERT_EQUAL( OUString("2."), parseDump("/root/page/body/tab/row[4]/cell/txt/Special[@nType='PortionType::Number']", "rText") ); +} + +DECLARE_WW8EXPORT_TEST(testTdf55427_footnote2endnote, "tdf55427_footnote2endnote.odt") +{ + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("ParagraphStyles")->getByName("Footnote"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote style is rose color", Color(0xFF007F), getProperty< Color >(xPageStyle, "CharColor")); + xPageStyle.set(getStyles("ParagraphStyles")->getByName("Endnote"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote style is cyan3 color", Color(0x2BD0D2), getProperty< Color >(xPageStyle, "CharColor")); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + // The footnote numbering type of ARABIC will not transfer over when those footnotes are converted to endnotes. + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote numbering type", SVX_NUM_ARABIC, pDoc->GetFootnoteInfo().m_aFormat.GetNumberingType() ); + // The original document has a real endnote using ROMAN_LOWER numbering, so that setting MUST remain unchanged. + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote numbering type", SVX_NUM_ROMAN_LOWER, pDoc->GetEndNoteInfo().m_aFormat.GetNumberingType() ); + + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); + + uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xEndnotes = xEndnotesSupplier->getEndnotes(); + uno::Reference<text::XFootnote> xEndnote; + xEndnotes->getByIndex(0) >>= xEndnote; + uno::Reference<text::XText> xEndnoteText; + xEndnotes->getByIndex(0) >>= xEndnoteText; + + // ODT footnote-at-document-end's closest DOC match is an endnote, so the two imports will not exactly match by design. + if (!mbExported) + { + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original footnote count", sal_Int32(5), xFootnotes->getCount() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote count", sal_Int32(1), xEndnotes->getCount() ); + + uno::Reference<text::XFootnote> xFootnote; + xFootnotes->getByIndex(0) >>= xFootnote; + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original footnote's number", OUString("1"), xFootnote->getAnchor()->getString() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote's number", OUString("i"), xEndnote->getAnchor()->getString() ); + + uno::Reference<text::XText> xFootnoteText; + xFootnotes->getByIndex(0) >>= xFootnoteText; + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original footnote style", OUString("Footnote"), getProperty<OUString>(getParagraphOfText(1, xFootnoteText), "ParaStyleName") ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote style", OUString("Endnote"), getProperty<OUString>(getParagraphOfText(1, xEndnoteText), "ParaStyleName") ); + } + else + { + // These asserted items are major differences in the conversion from footnote to endnote, NOT necessary conditions for a proper functioning document. + CPPUNIT_ASSERT_EQUAL_MESSAGE( "At-Document-End footnotes were converted into endnotes", sal_Int32(0), xFootnotes->getCount() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "At-Document-End footnotes became endnotes", sal_Int32(6), xEndnotes->getCount() ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "converted footnote's number", OUString("i"), xEndnote->getAnchor()->getString() ); + xEndnotes->getByIndex(4) >>= xEndnote; + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote's new number", OUString("v"), xEndnote->getAnchor()->getString() ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "retained footnote style", OUString("Footnote"), getProperty<OUString>(getParagraphOfText(1, xEndnoteText), "ParaStyleName") ); + xEndnotes->getByIndex(4) >>= xEndnoteText; + CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote style", OUString("Endnote"), getProperty<OUString>(getParagraphOfText(1, xEndnoteText), "ParaStyleName") ); + } +} + +DECLARE_WW8EXPORT_TEST(testTdf107931_KERN_DocEnabled_disabledDefStyle, "testTdf107931_KERN_DocEnabled_disabledDefStyle.doc") +{ + // Paragraph 3: the default style has kerning disabled + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(3), 1), "CharAutoKerning")); + // Paragraph 4: style with kerning disabled + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(4), 1), "CharAutoKerning")); + // Paragraph 5: style with kerning enabled + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(5), 1), "CharAutoKerning")); + // Paragraph 6: directly applied character properties: kerning disabled + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(6), 1), "CharAutoKerning")); + // Paragraph 7: directly applied character properties: kerning enabled + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(7), 1), "CharAutoKerning")); +} + +DECLARE_WW8EXPORT_TEST(testTdf107931_KERN_enabledDefStyle, "testTdf107931_KERN_enabledDefStyle.doc") +{ + // Paragraph 3: the default style has kerning enabled + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(3), 1), "CharAutoKerning")); + // Paragraph 4: style with kerning disabled + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(4), 1), "CharAutoKerning")); + // Paragraph 5: style with kerning enabled + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(5), 1), "CharAutoKerning")); + // Paragraph 6: directly applied character properties: kerning disabled + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(6), 1), "CharAutoKerning")); + // Paragraph 7: directly applied character properties: kerning enabled + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(7), 1), "CharAutoKerning")); +} + +DECLARE_WW8EXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.doc") +{ + // the paragraph style should set table's text-flow break-before-page + CPPUNIT_ASSERT_EQUAL( 2, getPages() ); +} + +DECLARE_WW8EXPORT_TEST(testTdf96277, "tdf96277.doc") +{ + // mismatch between anchoring at paragraph and ULSpacing to Page + CPPUNIT_ASSERT_EQUAL( 1, getPages() ); +} + +DECLARE_WW8EXPORT_TEST(testBnc863018b, "bnc863018b.doc") +{ + // The whitespace above the table should allow text to flow between the table anchor and the table. + // Since it doesn't, don't add the whitespace. + CPPUNIT_ASSERT_EQUAL( 1, getPages() ); +} + +DECLARE_WW8EXPORT_TEST(testTdf112517_maxSprms, "tdf112517_maxSprms.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( sal_Int32(28), xTable->getRows()->getCount() ); +} + +DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, "tdf108448_endNote.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xEndnotes = xEndnotesSupplier->getEndnotes(); + uno::Reference<text::XText> xEndnote; + xEndnotes->getByIndex(0) >>= xEndnote; + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in Endnote i", 1, getParagraphs(xEndnote) ); +} + +DECLARE_WW8EXPORT_TEST(testTdf106062_nonHangingFootnote, "tdf106062_nonHangingFootnote.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); + uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); + // This failed, tab between the footnote number and the footnote content was lost on import. + CPPUNIT_ASSERT_MESSAGE( "Footnote starts with a tab", xTextRange->getString().startsWith("\t") ); +} + +DECLARE_WW8EXPORT_TEST(testTdf116570_exportFootnote, "tdf116570_exportFootnote.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); + uno::Reference<text::XText> xFootnoteText; + xFootnotes->getByIndex(0) >>= xFootnoteText; + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in first footnote", 2, getParagraphs(xFootnoteText) ); +} + +DECLARE_WW8EXPORT_TEST(testTdf80635_pageRightRTL, "tdf80635_pageRightRTL.doc") +{ + // tdf#80635 - transfer the float orientation to the table. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTable, "HoriOrient")); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", tools::Long(3500), getProperty<tools::Long>(xTable, "LeftMargin"), 100); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Did you fix me? Text probably should wrap here", 2, getPages() ); + // If so, replace test with the table set to a greater preferred width so that the text shouldn't wrap +} + +DECLARE_WW8EXPORT_TEST(testTdf80635_marginRTL, "tdf80635_marginRightRTL.doc") +{ + // tdf#80635 - transfer the float orientation to the table. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + if ( !mbExported ) + CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::RIGHT, getProperty<sal_Int16>(xTable, "HoriOrient")); +} + +DECLARE_WW8EXPORT_TEST(testTdf80635_marginLeft, "tdf80635_marginLeft.doc") +{ + // tdf#80635 - transfer the float orientation to the table. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + // This was just the GetMinLeft of -199 + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", tools::Long(-2950), getProperty<tools::Long>(xTable, "LeftMargin"), 100); +} + +DECLARE_WW8EXPORT_TEST(testTdf80635_pageLeft, "tdf80635_pageLeft.doc") +{ + // tdf#80635 - transfer the float orientation to the table. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + // This was just the GetMinLeft of -199 + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", tools::Long(-2750), getProperty<tools::Long>(xTable, "LeftMargin"), 100); +} + +DECLARE_WW8EXPORT_TEST(testTdf99197_defaultLTR, "tdf99197_defaultLTR.doc") +{ + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Default Paragraph style, LTR", + text::WritingMode2::LR_TB, getProperty<sal_Int16>(getParagraph(1), "WritingMode") ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "myDefaultStyle - no base style, LTR", + text::WritingMode2::LR_TB, getProperty<sal_Int16>(getParagraph(2), "WritingMode") ); +} + +DECLARE_WW8EXPORT_TEST(testTdf107773, "tdf107773.doc") +{ + // This was 1, multi-page table was imported as a floating one. + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + // tdf#80635 - transfer the float orientation to the table. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient")); +} + +DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJustification.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Right To Left writing mode", text::WritingMode2::RL_TB, getProperty<sal_Int16>(xTable, "WritingMode")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTable, "HoriOrient")); + CPPUNIT_ASSERT_MESSAGE("Table Indent", getProperty<tools::Long>(xTable, "LeftMargin") > 3000); + CPPUNIT_ASSERT_MESSAGE("Table Indent is 3750", getProperty<tools::Long>(xTable, "LeftMargin") < 4000 ); + CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_RIGHT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOrTable(2), "ParaAdjust")) ); +} + +DECLARE_WW8EXPORT_TEST(testTdf98620_rtlJustify, "tdf98620_rtlJustify.doc") +{ + CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_RIGHT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")) ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Right To Left style", text::WritingMode2::RL_TB, getProperty<sal_Int16>(getParagraph(1), "WritingMode")); +} + +DECLARE_WW8EXPORT_TEST(testTdf121110_absJustify, "tdf121110_absJustify.doc") +{ + CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_RIGHT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")) ); + CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_LEFT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(3), "ParaAdjust")) ); +} + +DECLARE_WW8EXPORT_TEST(testTdf106174_rtlParaAlign, "tdf106174_rtlParaAlign.docx") +{ + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), getProperty<sal_Int16>(getParagraph(2), "ParaAdjust")); + uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Another paragraph aligned to right"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(xPropertySet, "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(3), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(4), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(5), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getParagraph(6), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(7), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(8), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getParagraph(9), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getParagraph(10), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(11), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getParagraph(12), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getParagraph(13), "ParaAdjust")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getParagraph(14), "ParaAdjust")); +} + +DECLARE_WW8EXPORT_TEST(testTdf119232_startEvenPage, "tdf119232_startEvenPage.doc") +{ + CPPUNIT_ASSERT_EQUAL(sal_Int16(2), getProperty<sal_Int16>(getParagraph(1), "PageNumberOffset")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc") +{ + // Prefix was "." instead of empty, so the second paragraph was + // rendered as ".1" instead of "1.". + // Unittest modified due to Prefix/Suffix support obsolete + uno::Reference<beans::XPropertySet> xPara(getParagraph(2), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104334, "tdf104334.doc") +{ + // This failed with a container::NoSuchElementException: STYLEREF was + // mapped to SwChapterField, and the field result was "This is a Heading 1" + // instead of just "1". + CPPUNIT_ASSERT_EQUAL(OUString("1"), getRun(getParagraph(2), 4)->getString()); +} + +DECLARE_WW8EXPORT_TEST(testTdf108072, "tdf108072.doc") +{ + // The property IsSplitAllowed was imported from an obsolete property, sprmTFCantSplit90 + // instead of sprmTFCantSplit. sprmTFCantSplit90 is set to true for merged rows, so + // for merged rows incorrect settings were imported, which prevented them from breaking over pages. + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTableRows = xTable->getRows(); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTableRows->getByIndex(0), "IsSplitAllowed")); +} + +DECLARE_WW8EXPORT_TEST(testTdf123321, "shapes-line-ellipse.doc") +{ + // These are the 3 lines in which 1st and 3rd one were disappearing before + uno::Reference<drawing::XShape> l1 = getShape(7); + uno::Reference<drawing::XShape> l2 = getShape(8); + uno::Reference<drawing::XShape> l3 = getShape(9); + + // first line (smallest) + // Fails without the fix: Expected: 423, Actual: 2 + CPPUNIT_ASSERT_EQUAL(sal_Int32(423), l1->getSize().Height); + // Fails without the fix: Expected: 0, Actual: 2 + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), l1->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7908), l1->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(37), l1->getPosition().Y); + + // second line (larger) + CPPUNIT_ASSERT_EQUAL(sal_Int32(2542), l2->getSize().Height); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), l2->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7916), l2->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(289), l2->getPosition().Y); + + // third line (largest) + // Fails without the fix: Expected: 7027, Actual: 2 + CPPUNIT_ASSERT_EQUAL(sal_Int32(7027), l3->getSize().Height); + // Fails without the fix: Expected: 0, Actual: 2 + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), l3->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7911), l3->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(231), l3->getPosition().Y); +} + +DECLARE_WW8EXPORT_TEST(testTdf91687, "tdf91687.doc") +{ + // Exported Watermarks were resized + uno::Reference<drawing::XShape> xWatermark = getShape(1); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(5172), xWatermark->getSize().Height); + CPPUNIT_ASSERT_EQUAL(sal_Int32(18105), xWatermark->getSize().Width); +} + +DECLARE_WW8EXPORT_TEST(testTdf114308, "tdf114308.doc") +{ + // Watermark with no additional padding + uno::Reference<drawing::XShape> xWatermark = getShape(1); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(8729), xWatermark->getSize().Height); +} + +DECLARE_WW8EXPORT_TEST(testTdf111480, "tdf111480.doc") +{ + // Circular text was imported horizontally + uno::Reference<drawing::XShape> xText = getShape(1); + + CPPUNIT_ASSERT(xText->getSize().Height > 11000); + CPPUNIT_ASSERT(xText->getSize().Width > 11000); +} + +DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + tools::Rectangle aRect = pPage->GetObj(0)->GetSnapRect(); + CPPUNIT_ASSERT(aRect.GetHeight() > aRect.GetWidth()); +} + +DECLARE_WW8EXPORT_TEST(testTdf70838b_verticalRotation, "tdf70838b_verticalRotation.odt") +{ + CPPUNIT_ASSERT_EQUAL(3, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + tools::Rectangle aGroupShape = pPage->GetObj(0)->GetSnapRect(); + tools::Rectangle aLine = pPage->GetObj(2)->GetSnapRect(); + + CPPUNIT_ASSERT_MESSAGE("Smiley faces are round", aGroupShape.GetHeight() > aGroupShape.GetWidth()); + CPPUNIT_ASSERT_MESSAGE("Line is taller, not wider", aLine.GetHeight() > aLine.GetWidth()); +} + +DECLARE_WW8EXPORT_TEST( testTdf129247, "tdf129247.docx" ) +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // Without the fix in place, the checkbox wouldn't be exported + CPPUNIT_ASSERT_EQUAL(1, getShapes()); +} + +DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" ) +{ + CPPUNIT_ASSERT_EQUAL(2, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // First check box anchored as a floating object + uno::Reference<drawing::XControlShape> xControlShape; + if(!mbExported) + xControlShape.set(getShape(1), uno::UNO_QUERY); + else + xControlShape.set(getShape(2), uno::UNO_QUERY); + CPPUNIT_ASSERT(xControlShape.is()); + + // Check whether we have the right control + uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); + uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService( "com.sun.star.form.component.CheckBox"))); + CPPUNIT_ASSERT_EQUAL(OUString("Floating Checkbox"), getProperty<OUString>(xPropertySet, "Label")); + + // Check anchor type + uno::Reference<beans::XPropertySet> xPropertySet2(xControlShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); + + // Second check box anchored inline / as character + if(!mbExported) + xControlShape.set(getShape(2), uno::UNO_QUERY); + else + xControlShape.set(getShape(1), uno::UNO_QUERY); + + // Check whether we have the right control + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); + xServiceInfo.set(xPropertySet, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.CheckBox"))); + CPPUNIT_ASSERT_EQUAL(OUString("Inline Checkbox"), getProperty<OUString>(xPropertySet, "Label")); + + // Check anchor type + xPropertySet2.set(xControlShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); +} + +DECLARE_WW8EXPORT_TEST( testTdf115896_layoutInCell, "tdf115896_layoutInCell.doc" ) +{ + // Check anchor type - was anchored to page because of unknown version of Word + uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet,"AnchorType")); +} + +DECLARE_WW8EXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.doc") +{ + uno::Reference<beans::XPropertySet> xTextField = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"); + CPPUNIT_ASSERT(xTextField.is()); + uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY_THROW); + uno::Reference<text::XDependentTextField> xDependent(xTextField, uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.Database")); + OUString sValue; + xTextField->getPropertyValue("Content") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString(u"«Name»"), sValue); + + uno::Reference<beans::XPropertySet> xFiledMaster = xDependent->getTextFieldMaster(); + uno::Reference<lang::XServiceInfo> xFiledMasterServiceInfo(xFiledMaster, uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xFiledMasterServiceInfo->supportsService("com.sun.star.text.fieldmaster.Database")); + + // Defined properties: DataBaseName, Name, DataTableName, DataColumnName, DependentTextFields, DataCommandType, InstanceName, DataBaseURL + CPPUNIT_ASSERT(xFiledMaster->getPropertyValue("Name") >>= sValue); + CPPUNIT_ASSERT_EQUAL(OUString("Name"), sValue); + CPPUNIT_ASSERT(xFiledMaster->getPropertyValue("DataColumnName") >>= sValue); + CPPUNIT_ASSERT_EQUAL(OUString("Name"), sValue); + CPPUNIT_ASSERT(xFiledMaster->getPropertyValue("InstanceName") >>= sValue); + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.text.fieldmaster.DataBase.Name"), sValue); +} + +DECLARE_OOXMLEXPORT_TEST( testTableCrossReference, "table_cross_reference.odt" ) +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // tdf#42346: Cross references to tables were not saved + // MSO uses simple bookmarks for referencing table caption, so we do the same by export + if (!mbExported) + return; + + // Check whether we have all the necessary bookmarks exported and imported back + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xBookmarksByIdx->getCount()); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_number_only")); + + // Check bookmark text ranges + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table 1: Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table 1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); + } + + // Check reference fields + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + CPPUNIT_ASSERT(xFields->hasMoreElements()); + + sal_uInt16 nIndex = 0; + while (xFields->hasMoreElements()) + { + uno::Reference<lang::XServiceInfo> xServiceInfo(xFields->nextElement(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, uno::UNO_QUERY); + switch (nIndex) + { + // Full reference to table caption + case 0: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Table 1: Table caption"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_full"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + // Reference to table number + case 1: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("1"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_number_only"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + // Reference to caption only + case 2: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_caption_only"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + // Reference to category and number + case 3: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Table 1"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_label_and_number"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + // Reference to page of the table + case 4: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("1"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_full"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + // Page style reference / exported as simple page reference + case 5: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("1"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_full"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + // Above / below reference + case 6: + { + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.GetReference")); + OUString sValue; + sal_Int16 nValue; + xPropertySet->getPropertyValue("CurrentPresentation") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("above"), sValue); + xPropertySet->getPropertyValue("SourceName") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString("Ref_Table0_full"), sValue); + xPropertySet->getPropertyValue("SequenceNumber") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nValue); + break; + } + default: + break; + } + ++nIndex; + } + CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), nIndex); +} + +DECLARE_OOXMLEXPORT_TEST( testTableCrossReferenceCustomFormat, "table_cross_reference_custom_format.odt" ) +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // tdf#42346: Cross references to tables were not saved + // Check also captions with custom formatting + if (!mbExported) + return; + + // Check whether we have all the necessary bookmarks exported and imported back + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(16), xBookmarksByIdx->getCount()); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_number_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table1_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table1_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table1_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table1_number_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table2_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table2_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table2_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table2_number_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table3_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table3_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table3_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table3_number_only")); + + // Check bookmark text ranges + // First table's caption + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1. Table: Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1. Table"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); + } + // Second table's caption + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table1_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("2. TableTable caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table1_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("2. Table"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table1_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table1_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("2"), xRange->getString()); + } + // Third table's caption + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table2_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("3) Table Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table2_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("3) Table"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table2_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table2_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("3"), xRange->getString()); + } + // Fourth table's caption + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table3_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table 4- Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table3_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table 4"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table3_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table3_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("4"), xRange->getString()); + } +} + +DECLARE_OOXMLEXPORT_TEST( testObjectCrossReference, "object_cross_reference.odt" ) +{ + CPPUNIT_ASSERT_EQUAL(2, getPages()); + // tdf#42346: Cross references to objects were not saved + // MSO uses simple bookmarks for referencing table caption, so we do the same by export + if (!mbExported) + return; + + // Check whether we have all the necessary bookmarks exported and imported back + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(15), xBookmarksByIdx->getCount()); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Drawing0_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Drawing0_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Drawing0_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Drawing0_number_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Drawing1_full")); + + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Illustration0_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Illustration0_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Illustration0_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Illustration0_number_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Illustration1_caption_only")); + + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Text0_full")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Text0_label_and_number")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Text0_caption_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Text0_number_only")); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Text1_label_and_number")); + + // Check bookmark text ranges + // Cross references to shapes + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Drawing0_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Drawing 1: A rectangle"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Drawing0_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Drawing 1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Drawing0_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("A rectangle"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Drawing0_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Drawing1_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Drawing 2: a circle"), xRange->getString()); + } + + // Cross references to pictures + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Illustration0_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Illustration 1: A picture"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Illustration0_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Illustration 1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Illustration0_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("A picture"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Illustration0_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Illustration1_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("an other image"), xRange->getString()); + } + + // Cross references to text frames + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Text0_full"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Text 1: A frame"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Text0_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Text 1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Text0_caption_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("A frame"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Text0_number_only"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); + } + { + uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Text1_label_and_number"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); + CPPUNIT_ASSERT_EQUAL(OUString("Text 2"), xRange->getString()); + } +} + +DECLARE_WW8EXPORT_TEST(testTdf112118_DOC, "tdf112118.doc") +{ + static const struct { + const char* styleName; + struct { + const char* sideName; + sal_Int32 nMargin; + sal_Int32 nBorderDistance; + sal_Int32 nBorderWidth; + } sideParams[4]; + } styleParams[] = { // Margin (MS-style), border distance, border width + { + "Standard", + { + { "Top", 496, 847, 159 }, // 851 twip, 24 pt (from text), 4.5 pt + { "Left", 2083, 706, 212 }, // 1701 twip, 20 pt (from text), 6.0 pt + { "Bottom", 1401, 564, 35 }, // 1134 twip, 16 pt (from text), 1.0 pt + { "Right", 3471, 423, 106 } // 2268 twip, 12 pt (from text), 3.0 pt + } + }, + { + "Convert 1", + { + { "Top", 847, 496, 159 }, // 851 twip, 24 pt (from edge), 4.5 pt + { "Left", 706, 2083, 212 }, // 1701 twip, 20 pt (from edge), 6.0 pt + { "Bottom", 564, 1401, 35 }, // 1134 twip, 16 pt (from edge), 1.0 pt + { "Right", 423, 3471, 106 } // 2268 twip, 12 pt (from edge), 3.0 pt + } + } + }; + auto xStyles = getStyles("PageStyles"); + + for (const auto& style : styleParams) + { + const OUString sName = OUString::createFromAscii(style.styleName); + uno::Reference<beans::XPropertySet> xStyle(xStyles->getByName(sName), uno::UNO_QUERY_THROW); + for (const auto& side : style.sideParams) + { + const OUString sSide = OUString::createFromAscii(side.sideName); + const OString sStage = style.styleName + OString::Concat(" ") + side.sideName; + + sal_Int32 nMargin = getProperty<sal_Int32>(xStyle, sSide + "Margin"); + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " margin width").getStr(), + side.nMargin, nMargin); + + sal_Int32 nBorderDistance = getProperty<sal_Int32>(xStyle, sSide + "BorderDistance"); + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " border distance").getStr(), + side.nBorderDistance, nBorderDistance); + + table::BorderLine aBorder = getProperty<table::BorderLine>(xStyle, sSide + "Border"); + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " border width").getStr(), + side.nBorderWidth, + sal_Int32(aBorder.OuterLineWidth + aBorder.InnerLineWidth + aBorder.LineDistance)); + + // Check that AUTO border color is imported as black + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " border color").getStr(), + sal_Int32(COL_BLACK), aBorder.Color); + } + } +} + +DECLARE_WW8EXPORT_TEST(testTdf117503, "tdf117503.docx") +{ + // This was 3, first page + standard page styles were not merged together + // on export. + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc") +{ + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + /* Get the vertical position of the paragraph containing the text "Start" */ + sal_Int32 nParaA_Top = getXPath(pXmlDoc, + "/root/page/body/column[1]/body/txt[text()='Start']/infos/bounds", "top" + ).toInt32(); + + /* Get the vertical position of the paragraph containing the text "Top B" */ + sal_Int32 nParaB_Top = getXPath(pXmlDoc, + "/root/page/body/column[2]/body/txt[text()='Top B']/infos/bounds", "top" + ).toInt32(); + + /* These two paragraphs are supposed to be at the top of the left + * and right columns respectively. Check that they actually line up: */ + CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top); +} + +DECLARE_WW8EXPORT_TEST(testTdf118133, "tdf118133.docx") +{ + // This was 0, doc import + doc export resulted in lost image due to broken + // lazy-loading of tiff images. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(15240), getShape(1)->getSize().Width); +} + +DECLARE_WW8EXPORT_TEST(testTdf118412, "tdf118412.doc") +{ + /* Check that the first page's bottom margin is 1.251cm (not 2.540cm) */ + OUString sPageStyleName = getProperty<OUString>(getParagraph(1), "PageStyleName"); + uno::Reference<style::XStyle> xPageStyle( + getStyles("PageStyles")->getByName(sPageStyleName), uno::UNO_QUERY); + sal_Int32 nBottomMargin = getProperty<sal_Int32>(xPageStyle, "BottomMargin"); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1251), nBottomMargin); +} + +CPPUNIT_TEST_FIXTURE(Test, testContentControlExport) +{ + // Given a document with a (rich text) content control: + mxComponent = loadFromDesktop("private:factory/swriter"); + uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XText> xText = xTextDocument->getText(); + uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); + xText->insertString(xCursor, "test", /*bAbsorb=*/false); + xCursor->gotoStart(/*bExpand=*/false); + xCursor->gotoEnd(/*bExpand=*/true); + uno::Reference<text::XTextContent> xContentControl( + xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); + + // When saving that document to DOC and loading it back: + reload("MS Word 97", ""); + + // Then make sure the dummy character at the end is filtered out: + OUString aBodyText = getBodyText(); + // Without the accompanying fix in place, this test would have failed: + // - Expected: test + // - Actual : test<space> + // i.e. the CH_TXTATR_BREAKWORD at the end was written, then the import replaced that with a + // space. + CPPUNIT_ASSERT_EQUAL(OUString("test"), aBodyText); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx new file mode 100644 index 000000000..067d3486e --- /dev/null +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -0,0 +1,1104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/LineDash.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/table/ShadowFormat.hpp> +#include <com/sun/star/text/XFormField.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/text/XTextContentAppend.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/text/XTextSectionsSupplier.hpp> +#include <com/sun/star/text/XFootnotesSupplier.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XLineNumberingProperties.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> + +#include <comphelper/sequenceashashmap.hxx> + +#include <IDocumentSettingAccess.hxx> +#include <docsh.hxx> +#include <unotxdoc.hxx> +#include <formatlinebreak.hxx> +#include <o3tl/string_view.hxx> + +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97") + { + } + + bool mustTestImportOf(const char* filename) const override + { + // If the testcase is stored in some other format, it's pointless to test. + return o3tl::ends_with(filename, ".doc"); + } +}; + +DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.doc") +{ + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT( xStorable->isReadonly() ); + + uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + // The problem was that section protection was being enabled in addition to being read-only. + // This created an explicit section with protection. There should be just the default, non-explicit section. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), xSections->getCount()); + + // tdf#127862: page fill color (in this case white) was lost + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle")); + + // tdf#136983 + uno::Reference<document::XDocumentPropertiesSupplier> xDPS(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Last printed date", sal_Int16(2009), xDPS->getDocumentProperties()->getPrintDate().Year); +} + +DECLARE_WW8EXPORT_TEST(testTdf100961_fixedDateTime, "tdf100961_fixedDateTime.doc") +{ + // This should be a fixed date/time field, not the current time. + getParagraph(1, "05.01.19 04:06:08"); + + css::uno::Reference<css::text::XTextFieldsSupplier> xSupplier(mxComponent, + css::uno::UNO_QUERY_THROW); + auto xFieldsAccess(xSupplier->getTextFields()); + auto xFields(xFieldsAccess->createEnumeration()); + + css::uno::Reference<css::uno::XInterface> xField(xFields->nextElement(), css::uno::UNO_QUERY); + // Check fixed property was imported and date value was parsed correctly + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xField, "IsFixed")); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xField, "IsDate")); + auto datetime = getProperty<css::util::DateTime>(xField, "DateTimeValue"); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), datetime.Day); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), datetime.Month); + CPPUNIT_ASSERT_EQUAL(sal_Int16(2019), datetime.Year); + + xField.set(xFields->nextElement(), css::uno::UNO_QUERY); + // Check fixed property was imported and time value was parsed correctly + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xField, "IsFixed")); + CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xField, "IsDate")); + datetime = getProperty<css::util::DateTime>(xField, "DateTimeValue"); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), datetime.Hours); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(6), datetime.Minutes); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), datetime.Seconds); +} + +DECLARE_WW8EXPORT_TEST(testTdf147861_customField, "tdf147861_customField.doc") +{ + // These should each be specific values, not a shared DocProperty + getParagraph(1, "CustomEditedTitle"); // edited + // A couple of \x0\x0 at the end of the import variable thwart an equality comparison + CPPUNIT_ASSERT(getParagraph(2)->getString().startsWith(" INSERT Custom Title here")); + getParagraph(3, "My Title"); // edited + + // Verify that these are fields, and not just plain text + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("CustomEditedTitle"), xField->getPresentation(false)); + // The " (fixed)" part is unnecessary, but it must be consistent across a round-trip + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xField->getPresentation(true)); +} + +DECLARE_WW8EXPORT_TEST(testTdf148380_createField, "tdf148380_createField.doc") +{ + // Verify that these are fields, and not just plain text + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY); + // This should NOT be "Lorenzo Chavez", or a real date since the user hand-modified the result. + CPPUNIT_ASSERT_EQUAL(OUString("Myself - that's who"), xField->getPresentation(false)); + xField.set(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("yesterday at noon"), xField->getPresentation(false)); +} + +DECLARE_WW8EXPORT_TEST(testTdf148380_fldLocked, "tdf148380_fldLocked.doc") +{ + getParagraph(2, "4/5/2022 4:29:00 PM"); + getParagraph(4, "1/23/4567 8:9:10 PM"); + + // Verify that these are fields, and not just plain text + // (import only, since export thankfully just dumps these fixed fields as plain text + if (mbExported) + return; + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY); + // This should NOT be updated at FILEOPEN to match the last modified time - it is locked. + CPPUNIT_ASSERT_EQUAL(OUString("4/5/2022 4:29:00 PM"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Modified (fixed)"), xField->getPresentation(true)); + xField.set(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1/23/4567 8:9:10 PM"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Last printed (fixed)"), xField->getPresentation(true)); +} + +DECLARE_WW8EXPORT_TEST(testTdf138345_paraCharHighlight, "tdf138345_paraCharHighlight.doc") +{ + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(9), 1, "A side benefit is that "), uno::UNO_QUERY_THROW); + // Paragraph style paraNoCharBackground cancel paraCharBackground using COL_TRANSPARENT. + // Before this fix, the paragraph was by default covered with a yellow CharHighlight. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO), getProperty<sal_Int32>(xRun, "CharHighlight")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO), getProperty<sal_Int32>(xRun, "CharBackColor")); + + xRun.set(getRun(getParagraph(9), 2), uno::UNO_QUERY_THROW); + // Character style formatting must not contain a highlight setting at all. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO), getProperty<sal_Int32>(xRun, "CharHighlight")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO), getProperty<sal_Int32>(xRun, "CharBackColor")); + + //tdf#118711 - don't explicitly specify the default page style at the beginning of the document + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104596_wrapInHeaderTable, "tdf104596_wrapInHeaderTable.doc") +{ + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + sal_Int32 nRowHeight = getXPath(pXmlDoc, "//header/tab/row[1]/infos/bounds", "height").toInt32(); + // The fly is supposed to be no-wrap, so the text should come underneath it, not wrap-through, + // thus making the row much higher. Before, height was 706. Now it is 1067. + CPPUNIT_ASSERT_MESSAGE("Text must wrap under green box", nRowHeight > 1000); +} + +DECLARE_WW8EXPORT_TEST(testGutterLeft, "gutter-left.doc") +{ + uno::Reference<beans::XPropertySet> xPageStyle; + getStyles("PageStyles")->getByName("Standard") >>= xPageStyle; + sal_Int32 nGutterMargin{}; + xPageStyle->getPropertyValue("GutterMargin") >>= nGutterMargin; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1270 + // - Actual : 0 + // i.e. gutter margin was lost. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin); +} + +CPPUNIT_TEST_FIXTURE(Test, testGutterTop) +{ + load(mpTestDocumentPath, "gutter-top.doc"); + reload(mpFilter, "gutter-top.doc"); + uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xSettings( + xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + bool bGutterAtTop{}; + xSettings->getPropertyValue("GutterAtTop") >>= bGutterAtTop; + // Without the accompanying fix in place, this test would have failed, because the gutter was + // at the left. + CPPUNIT_ASSERT(bGutterAtTop); +} + +DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc") +{ + auto xNumberingRules + = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules"); + comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0)); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 64 + // - Actual : 4 + // i.e. numbering type was ARABIC, not ARABIC_ZERO. + CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(style::NumberingType::ARABIC_ZERO), + aMap["NumberingType"].get<sal_uInt16>()); +} + +DECLARE_WW8EXPORT_TEST(testTdf128501, "tdf128501.doc") +{ + if (!mbExported) + { + uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor = getShape(1); + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShapeDescriptor->getShapeType()); + } + else + { + uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor = getShape(1); + // Without the fix in place, this test would have failed with + // - Expected: FrameShape + // - Actual : com.sun.star.drawing.CustomShape + CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType()); + } +} + +CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote) +{ + // Create a document, set footnote numbering type to ARABIC_ZERO. + loadURL("private:factory/swriter", nullptr); + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFootnoteSettings + = xFootnotesSupplier->getFootnoteSettings(); + sal_uInt16 nNumberingType = style::NumberingType::ARABIC_ZERO; + xFootnoteSettings->setPropertyValue("NumberingType", uno::Any(nNumberingType)); + + // Insert a footnote. + uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContent> xFootnote( + xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY); + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), + uno::UNO_QUERY); + xTextContentAppend->appendTextContent(xFootnote, {}); + + reload("MS Word 97", ""); + xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY); + sal_uInt16 nExpected = style::NumberingType::ARABIC_ZERO; + auto nActual = getProperty<sal_uInt16>(xFootnotesSupplier->getFootnoteSettings(), "NumberingType"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 64 + // - Actual : 4 + // i.e. the numbering type was ARABIC, not ARABIC_ZERO. + CPPUNIT_ASSERT_EQUAL(nExpected, nActual); +} + +CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote) +{ + // Create a document, set footnote numbering type to SYMBOL_CHICAGO. + loadURL("private:factory/swriter", nullptr); + uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFootnoteSettings + = xFootnotesSupplier->getFootnoteSettings(); + sal_uInt16 nNumberingType = style::NumberingType::SYMBOL_CHICAGO; + xFootnoteSettings->setPropertyValue("NumberingType", uno::Any(nNumberingType)); + + // Insert a footnote. + uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContent> xFootnote( + xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY); + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), + uno::UNO_QUERY); + xTextContentAppend->appendTextContent(xFootnote, {}); + + reload("MS Word 97", ""); + xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY); + sal_uInt16 nExpected = style::NumberingType::SYMBOL_CHICAGO; + auto nActual = getProperty<sal_uInt16>(xFootnotesSupplier->getFootnoteSettings(), "NumberingType"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 63 + // - Actual : 4 + // i.e. the numbering type was ARABIC, not SYMBOL_CHICAGO. + CPPUNIT_ASSERT_EQUAL(nExpected, nActual); +} + +DECLARE_WW8EXPORT_TEST(testHyperLinkURLSaving, "tdf120003.doc") +{ + OUString URL = getProperty<OUString>(getShape(1), "HyperLinkURL"); + // Without the fix in place, this test would have failed with + // - Expected: https://www.libreoffice.org/ + // - Actual : tps://www.libreoffice.org/ + CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org/"), URL); +} + +DECLARE_WW8EXPORT_TEST(testdf79553_lineNumbers, "tdf79553_lineNumbers.doc") +{ + bool bValue = false; + sal_Int32 nValue = -1; + + uno::Reference< text::XTextDocument > xtextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference< text::XLineNumberingProperties > xLineProperties( xtextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropertySet = xLineProperties->getLineNumberingProperties(); + + xPropertySet->getPropertyValue("IsOn") >>= bValue; + CPPUNIT_ASSERT_EQUAL(true, bValue); + + xPropertySet->getPropertyValue("Distance") >>= nValue; + CPPUNIT_ASSERT_MESSAGE("automatic distance", nValue > 0); +} + +DECLARE_WW8EXPORT_TEST(testTdf138302_restartNumbering, "tdf138302_restartNumbering.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<beans::XPropertySet> xPara(getParagraph(8), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString")); + + + // tdf#143982: automatic tables should export as something better than just left-and-size + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + + CPPUNIT_ASSERT(getProperty<bool>(xTable, "IsWidthRelative")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xTable, "RelativeWidth")); +} + +DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") +{ + uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles"); + uno::Reference<style::XStyle> pageStyle(pageStyles->getByName("Default Page Style"), uno::UNO_QUERY); + bool headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); +} + +DECLARE_WW8EXPORT_TEST(testTdf122460_header, "tdf122460_header.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles"); + uno::Reference<style::XStyle> pageStyle(pageStyles->getByName("Default Page Style"), uno::UNO_QUERY); + bool headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); +} + +DECLARE_WW8EXPORT_TEST(testTdf139495_tinyHeader, "tdf139495_tinyHeader.doc") +{ + // In Word 2003, this is one page, but definitely not six pages. + CPPUNIT_ASSERT(getPages() < 3); +} + +DECLARE_WW8EXPORT_TEST(testTdf124937, "tdf124937.doc") +{ + // Check it doesn't crash at import time + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables were imported. + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Compatibility: Protect form", true, pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) ); + + uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xSections->getCount()); // The first paragraph wasn't counted as a section. + + uno::Reference<beans::XPropertySet> xSect(xSections->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section1 is protected", true, getProperty<bool>(xSect, "IsProtected")); + xSect.set(xSections->getByIndex(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section4 is protected", false, getProperty<bool>(xSect, "IsProtected")); +} + +DECLARE_WW8EXPORT_TEST(testTdf73056_cellMargins, "tdf73056_cellMargins.doc") +{ + uno::Reference< text::XTextTablesSupplier > xTablesSupplier( mxComponent, uno::UNO_QUERY ); + uno::Reference< container::XIndexAccess > xTables( xTablesSupplier->getTextTables(), uno::UNO_QUERY ); + uno::Reference< text::XTextTable > xTable1( xTables->getByIndex( 0 ), uno::UNO_QUERY ); + uno::Reference< table::XCell > xCell = xTable1->getCellByName( "B4" ); + + // only the first cell with specific margins was processed, leaving the rest at table defaults. Was 0. + uno::Reference< beans::XPropertySet > xPropSet( xCell, uno::UNO_QUERY_THROW ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "bottom cell spacing to contents", + sal_Int32(101), getProperty<sal_Int32>(xPropSet, "BottomBorderDistance" ) ); +} + +DECLARE_WW8EXPORT_TEST(testTdf135672_tableGrows, "tdf135672_tableGrows.doc") +{ + auto const xTable(getParagraphOrTable(1)); + // This would shift left every round-trip. First time was -259, next -418. + CPPUNIT_ASSERT_EQUAL(sal_Int32(-101), getProperty<sal_Int32>(xTable, "LeftMargin")); + + // This would grow every round-trip. First time was 11118, next 11435 + CPPUNIT_ASSERT_EQUAL(sal_Int32(10800), getProperty<sal_Int32>(xTable, "Width")); +} + +DECLARE_WW8EXPORT_TEST(testTdf79435_legacyInputFields, "tdf79435_legacyInputFields.docx") +{ + //using .docx input file to verify cross-format compatibility. + uno::Reference<text::XFormField> xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(5), 3), "Bookmark"); + uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters()); + + OUString sTmp; + // Too often the string reader can fail during import - fix that first to prevent round-tripping garbage. + // (for example BR-1010B.doc from tdf#48097) + //xParameters->getByName("EntryMacro") >>= sTmp; + //CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp); + //xParameters->getByName("Help") >>= sTmp; + //CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp); + //xParameters->getByName("ExitMacro") >>= sTmp; + //CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp); + xParameters->getByName("Description") >>= sTmp; + CPPUNIT_ASSERT_EQUAL(OUString("StatusHelp"), sTmp); + //xParameters->getByName("Content") >>= sTmp; + //CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp); + //xParameters->getByName("Format") >>= sTmp; + //CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp); + + sal_uInt16 nMaxLength = 0; + xParameters->getByName("MaxLength") >>= nMaxLength; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Max Length", sal_uInt16(10), nMaxLength); + + // too bad this is based on character runs - just found try trial and error. + xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(6), 2), "Bookmark"); + xParameters.set(xFormField->getParameters()); + xParameters->getByName("Type") >>= sTmp; + CPPUNIT_ASSERT_EQUAL(OUString("calculated"), sTmp); + + xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(7), 2), "Bookmark"); + xParameters.set(xFormField->getParameters()); + xParameters->getByName("Type") >>= sTmp; + CPPUNIT_ASSERT_EQUAL(OUString("currentDate"), sTmp); + + xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(7), 7), "Bookmark"); + xParameters.set(xFormField->getParameters()); + xParameters->getByName("Type") >>= sTmp; + CPPUNIT_ASSERT_EQUAL(OUString("currentTime"), sTmp); + + xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(8), 2), "Bookmark"); + xParameters.set(xFormField->getParameters()); + xParameters->getByName("Type") >>= sTmp; + CPPUNIT_ASSERT_EQUAL(OUString("number"), sTmp); + + xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(8), 7), "Bookmark"); + xParameters.set(xFormField->getParameters()); + xParameters->getByName("Type") >>= sTmp; + CPPUNIT_ASSERT_EQUAL(OUString("date"), sTmp); +} + +DECLARE_WW8EXPORT_TEST(testTdf134264, "tdf134264.docx") +{ + // Without the fix in place, ADDRESSBLOCK fields would have been lost after RT + CPPUNIT_ASSERT_EQUAL(OUString("MF"), getParagraph(1)->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("M19"), getParagraph(2)->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("1815"), getParagraph(3)->getString()); +} + +DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, "tdf120225_textControlCrossRef.doc") +{ + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + xRunEnum->nextElement(); + uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType")); + uno::Reference<container::XNamed> xBookmark(getProperty< uno::Reference<beans::XPropertySet> >(xPropertySet, "Bookmark"), uno::UNO_QUERY_THROW); + + // Critical test: does TextField's bookmark name match cross-reference? + const OUString& sTextFieldName( xBookmark->getName() ); + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + CPPUNIT_ASSERT(xFields->hasMoreElements()); + xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sTextFieldName, getProperty<OUString>(xPropertySet, "SourceName")); + + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); + // TextFields should not be turned into real bookmarks. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xBookmarksByIdx->getCount()); + + // The actual name isn't critical, but if it fails, it is worth asking why. + CPPUNIT_ASSERT_EQUAL(OUString("Text1"), sTextFieldName); +} + +DECLARE_WW8EXPORT_TEST(testTdf134948, "tdf134948.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Only 1 paragraph", 1, getParagraphs()); +} + +DECLARE_WW8EXPORT_TEST(testTdf132726, "tdf132726.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 1, "What sentence has a yellow background? "); + CPPUNIT_ASSERT_EQUAL( COL_AUTO, getProperty<Color>(xRun, "CharBackColor")); + + xRun = getRun(getParagraph(1), 2, "Why, this sentence of course"); + CPPUNIT_ASSERT_EQUAL( COL_YELLOW, getProperty<Color>(xRun, "CharBackColor")); +} + +DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextRange> xPara = getParagraph(2); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Normal text "), "CharEscapement"), 0); + // Negative escapements (subscripts) were decreasing by 1% every round-trip due to bad manual rounding. + // This should be roughly .2*35% of the ORIGINAL (non-reduced) size. However, during export the + // proportional height has to be changed into direct formatting, which then changes the relative percent. + // In this case, a 24pt font, proportional at 65% becomes roughly a 16pt font. + // Thus an escapement of 7% (1.68pt) becomes roughly 10.5% for the 16pt font. + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Subscript", -10.f, getProperty<float>(getRun(xPara, 2), "CharEscapement"), 1); +} + +DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement2, "tdf127316_autoEscapement2.odt") +{ + CPPUNIT_ASSERT_EQUAL(2, getPages()); + uno::Reference<text::XTextRange> xPara = getParagraph(1); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Base1"), "CharEscapement"), 0); + // Font is 80% of 40pt or 32pt, original escapement is 6.4pt, so round-trip escapement is 20%. + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.f, getProperty<float>(getRun(xPara, 2,"AutoSuperscript"), "CharEscapement"), 1); + xPara.set( getParagraph(3) ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1, "Base3"), "CharEscapement"), 0); + // font is 20% of 40pt or 8pt, original escapement is 25.6pt, so round-trip escapement is 320%. + CPPUNIT_ASSERT_DOUBLES_EQUAL(320.f, getProperty<float>(getRun(xPara, 2,"AutoSuperscript"), "CharEscapement"), 3); +} + +DECLARE_WW8EXPORT_TEST(testTdf120412_proportionalEscapement, "tdf120412_proportionalEscapement.odt") +{ + uno::Reference<text::XTextRange> xPara = getParagraph(2); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 2, "Base"), "CharEscapement"), 0); + // Import was limiting to 100%. And export based the position on the original height, not the proportional height. + CPPUNIT_ASSERT_DOUBLES_EQUAL( 150.f, getProperty<float>(getRun(xPara, 3,"Super"), "CharEscapement"), 2); + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +DECLARE_WW8EXPORT_TEST(testTdf133453_realFontSize, "tdf133453_realFontSize.doc") +{ + CPPUNIT_ASSERT_EQUAL( -95.f, getProperty<float>(getRun(getParagraph(1), 2, "2"), "CharEscapement") ); +} + +DECLARE_WW8EXPORT_TEST(testTdf116194, "tdf116194.doc") +{ + CPPUNIT_ASSERT_EQUAL( Color(0xc00000), getProperty<Color>(getRun(getParagraph(1), 1), "CharColor")); +} + +DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.docx") +{ + uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Numbering - First level"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(Color(0xb8cce4), getProperty<Color>(xStyle, "ParaBackColor"));//R:184 G:204 B:228 + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle, "FillStyle")); + + uno::Reference<text::XTextRange> xText(getParagraph(12)); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xText, "ParaBackColor")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle")); +} + +DECLARE_WW8EXPORT_TEST(testTdf128608_fillStyleNoneB, "tdf128608_fillStyleNoneB.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextRange> xText(getParagraph(1)); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xText, "ParaBackColor")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle")); +} + +DECLARE_WW8EXPORT_TEST(testTdf132094_transparentPageImage, "tdf132094_transparentPageImage.doc") +{ + uno::Reference<drawing::XShape> image (getShape(1), uno::UNO_QUERY); + // Don't add fillstyle when none is set. + // Well, ok, at least make it transparent if you do uselessly set a solid color... + const bool bFillNone = drawing::FillStyle_NONE == getProperty<drawing::FillStyle>(image, "FillStyle"); + const bool bTransparent = sal_Int16(0) != getProperty<sal_Int16>(image, "FillTransparence"); + CPPUNIT_ASSERT_MESSAGE("no background fill", bTransparent || bFillNone); +} + +DECLARE_WW8EXPORT_TEST(testTdf112618_textbox_no_bg, "tdf112618_textbox_no_bg.doc") +{ + Color nTransparence = getProperty<Color>(getShape(2), "FillTransparence"); + CPPUNIT_ASSERT_EQUAL(Color(0x000064), nTransparence); + CPPUNIT_ASSERT_EQUAL(nTransparence, getProperty<Color>(getShape(2), "BackColorTransparency")); +} + +DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, "tdf101826_xattrTextBoxFill.doc") +{ + //Basic 1 Color Fill: gradient from yellow(FFFF00) to brown(767600) currently saves as mid-color + CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty<Color>(getShape(1), "BackColor")); + //Basic 2 Color Fill: gradient from yellow(FFFF00) to green(00B050) currently saves as mid-color + CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty<Color>(getShape(4), "BackColor")); + //Basic Picture Fill: Tux image + CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(getShape(5), "FillStyle")); +} + +DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc") +{ + uno::Reference<text::XTextRange> xText(getParagraph(12)); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xText, "ParaBackColor")); +} + +DECLARE_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt") +{ + CPPUNIT_ASSERT_EQUAL(6, getPages()); + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle")); +} + +DECLARE_WW8EXPORT_TEST(testTdf128608_tableParaBackColor, "tdf128608_tableParaBackColor.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A4"), uno::UNO_QUERY); + + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + // ParaBackColor doesn't seem to be used in this case, but keep it here to make sure it stays as AUTO. + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xPara, "ParaBackColor")); + // No paragraph background colour/fill. (The cell background colour should be used.) + CPPUNIT_ASSERT_EQUAL_MESSAGE("No fillstyle", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xPara, "FillStyle")); +} + +DECLARE_WW8EXPORT_TEST(testTdf117217_largeTableBackgrounds, "tdf117217_largeTableBackgrounds.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + // Cell 22: light-red == 16711680 + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("V1"), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("light red", Color(0xE0C2CD), getProperty<Color>(xCell, "BackColor")); + xCell.set(xTable->getCellByName("Z1"), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("light red", Color(0xE0C2CD), getProperty<Color>(xCell, "BackColor")); +} + +DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(defaultStyle, "TopMargin")); +} + +DECLARE_WW8EXPORT_TEST(testTdf108518_CRnumformatting, "tdf108518_CRnumformatting.doc") +{ + CPPUNIT_ASSERT_EQUAL(OUString("6.2.3."), parseDump("//body/txt[4]/Special[@nType='PortionType::Number']", "rText")); + //Without this fix in place, it would become 200 (and non-bold). + CPPUNIT_ASSERT_EQUAL(OUString("220"), parseDump("//body/txt[4]/Special[@nType='PortionType::Number']", "nHeight")); +} + +DECLARE_WW8EXPORT_TEST(testTdf120711_joinedParagraphWithChangeTracking, "tdf120711.doc") +{ + sal_Int16 numFormat = getNumberingTypeOfParagraph(5); + // last paragraph is not a list item + CPPUNIT_ASSERT(style::NumberingType::CHAR_SPECIAL != numFormat); +} + +DECLARE_WW8EXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); + uno::Reference< beans::XPropertySet > xStyleProps(paragraphStyles->getByName("Shadow"), uno::UNO_QUERY_THROW); + table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + + // Shadows were inherited regardless of whether the style disabled them. + xStyleProps.set(paragraphStyles->getByName("Shadow-removed"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "ParaShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); + + uno::Reference< container::XNameAccess > characterStyles = getStyles("CharacterStyles"); + xStyleProps.set(characterStyles->getByName("CharShadow"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + + xStyleProps.set(characterStyles->getByName("CharShadow-removed"), uno::UNO_QUERY_THROW); + aShadow = getProperty<table::ShadowFormat>(xStyleProps, "CharShadowFormat"); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE, aShadow.Location); +} + +DECLARE_WW8EXPORT_TEST(testTdf81705_outlineLevel, "tdf81705_outlineLevel.doc") +{ + // direct formatting resets outline level to body text (0) + CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph C", sal_uInt16(0), getProperty<sal_uInt16>(getParagraph(3), "OutlineLevel")); + // myStyle sets outline level to 1. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph D", sal_uInt16(1), getProperty<sal_uInt16>(getParagraph(4), "OutlineLevel")); +} + +DECLARE_WW8EXPORT_TEST(testBtlrCell, "btlr-cell.doc") +{ + // Without the accompanying fix in place, this test would have failed, as + // the btlr text direction in the A1 cell was lost on DOC import and + // export. + uno::Reference<text::XTextTablesSupplier> xSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xTables = xSupplier->getTextTables(); + uno::Reference<text::XTextTable> xTable(xTables->getByName("Table1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xA1(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, getProperty<sal_Int16>(xA1, "WritingMode")); + + uno::Reference<beans::XPropertySet> xB1(xTable->getCellByName("B1"), uno::UNO_QUERY); + auto nActual = getProperty<sal_Int16>(xB1, "WritingMode"); + CPPUNIT_ASSERT(nActual == text::WritingMode2::LR_TB || nActual == text::WritingMode2::CONTEXT); + + uno::Reference<beans::XPropertySet> xC1(xTable->getCellByName("C1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty<sal_Int16>(xC1, "WritingMode")); +} + +DECLARE_WW8EXPORT_TEST(testTdf118375export, "tdf118375_240degClockwise.doc") +{ + // The input document has one custom shape, which is rotated 240deg. Check + // that it has the same position as in Word. + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier.is()); + uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages()); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is()); + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is()); + uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps.is()); + sal_Int32 nPosX = {}, nPosY = {}; + CPPUNIT_ASSERT(xShapeProps->getPropertyValue("HoriOrientPosition") >>= nPosX); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue("VertOrientPosition") >>= nPosY); + // Allow some tolerance because rounding errors through integer arithmetic + // in rotation. + CPPUNIT_ASSERT_DOUBLES_EQUAL(5200.0, static_cast<double>(nPosX), 1.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1152.0, static_cast<double>(nPosY), 1.0); +} + +DECLARE_WW8EXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.doc") +{ + uno::Reference<text::XTextRange> xPara = getParagraph(1); + CPPUNIT_ASSERT_EQUAL(OUString("Text"), + getProperty<OUString>(getRun(xPara, 1), "TextPortionType")); + // Without the accompanying fix in place, this test would have failed with 'Expected: + // Annotation; Actual: Frame', i.e. the comment start before the image was lost. + CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), + getProperty<OUString>(getRun(xPara, 2), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Frame"), + getProperty<OUString>(getRun(xPara, 3), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"), + getProperty<OUString>(getRun(xPara, 4), "TextPortionType")); + CPPUNIT_ASSERT_EQUAL(OUString("Text"), + getProperty<OUString>(getRun(xPara, 5), "TextPortionType")); +} + +DECLARE_WW8EXPORT_TEST(testTdf126708emf, "tdf126708_containsemf.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + auto xShape = getShape(1); + // First check the size of the EMF graphic contained in the shape. + auto xGraphic = getProperty< uno::Reference<graphic::XGraphic> >( + xShape, "Graphic"); + auto xSize = getProperty<awt::Size>(xGraphic, "Size100thMM"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8501), xSize.Height); + CPPUNIT_ASSERT_EQUAL(sal_Int32(18939), xSize.Width); + + // Now check that the shape itself has a decent size. + // This size varies slightly when round tripping through doc format. + xSize = getProperty<awt::Size>(xShape, "Size"); + CPPUNIT_ASSERT(abs(xSize.Height - 7629) <= 6); + CPPUNIT_ASSERT(abs(xSize.Width - 17000) <= 6); +} + +DECLARE_WW8EXPORT_TEST(testBtlrFrame, "btlr-frame.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + if (!mbExported) + { + return; + } + + // Without the accompanying fix in place, this test would have failed with a + // beans.UnknownPropertyException, as the writing direction was lost, so the default direction + // resulted in a conversion to a Writer text frame. + uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(9000), getProperty<sal_Int32>(xFrame, "RotateAngle")); +} + +DECLARE_WW8EXPORT_TEST(testPresetDash, "tdf127166_prstDash_Word97.doc") +{ + // Error was, that the 'sys' preset dash styles were neither imported not + // exported, the mixed styles had wrong dash-dot order, they were imported + // with absolute values. + const drawing::LineDash dashParams[] = + { + {drawing::DashStyle_RECTRELATIVE, 1, 400, 0, 0, 300}, // dash + {drawing::DashStyle_RECTRELATIVE, 1, 400, 1, 100, 300}, // dashDot + {drawing::DashStyle_RECTRELATIVE, 1, 100, 0, 0, 300}, // dot + {drawing::DashStyle_RECTRELATIVE, 1, 800, 0, 0, 300}, // lgDash + {drawing::DashStyle_RECTRELATIVE, 1, 800, 1, 100, 300}, // lgDashDot + {drawing::DashStyle_RECTRELATIVE, 1, 800, 2, 100, 300}, // lgDashDotDot + {drawing::DashStyle_RECTRELATIVE, 1, 300, 0, 0, 100}, // sysDash + {drawing::DashStyle_RECTRELATIVE, 1, 300, 1, 100, 100}, // sysDashDot + {drawing::DashStyle_RECTRELATIVE, 1, 300, 2, 100, 100}, // sysDashDotDot + {drawing::DashStyle_RECTRELATIVE, 1, 100, 0, 0, 100} // sysDot + }; + drawing::LineDash aPresetLineDash; + drawing::LineDash aShapeLineDash; + for (sal_uInt16 i = 0; i < 10; i++) + { + aPresetLineDash = dashParams[i]; + uno::Reference<drawing::XShape> xShape = getShape(i+1); + aShapeLineDash = getProperty<drawing::LineDash>(xShape, "LineDash"); + bool bIsEqual = aPresetLineDash.Style == aShapeLineDash.Style + && aPresetLineDash.Dots == aShapeLineDash.Dots + && aPresetLineDash.DotLen == aShapeLineDash.DotLen + && aPresetLineDash.Dashes == aShapeLineDash.Dashes + && aPresetLineDash.DashLen == aShapeLineDash.DashLen + && aPresetLineDash.Distance == aShapeLineDash.Distance; + CPPUNIT_ASSERT_MESSAGE("LineDash differ", bIsEqual); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) +{ + auto verify = [this]() { + uno::Reference<beans::XPropertySet> xStandard( + getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT(getProperty<bool>(xStandard, "RtlGutter")); + }; + + // Given a document with RTL gutter, when loading it: + load(mpTestDocumentPath, "rtl-gutter.doc"); + // Then make sure the section's gutter is still RTL: + // Without the accompanying fix in place, this test would have failed as the SPRM was missing. + verify(); + reload(mpFilter, "rtl-gutter.doc"); + verify(); +} + +DECLARE_WW8EXPORT_TEST(testTdf94326_notOutlineNumbering, "tdf94326_notOutlineNumbering.doc") +{ + // The directly applied numbering list must not be lost. + uno::Reference<beans::XPropertySet> xPara(getParagraph(2, u"ОБЩИЕ ПОЛОЖЕНИЯ"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf106541_cancelOutline, "tdf106541_cancelOutline.doc") +{ + // The ability to cancel numbering must not be lost. + uno::Reference<beans::XPropertySet> xPara(getParagraph(1, "Cancelled by style"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(2, "Cancelled by inherited style"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(4, "Cancelled by direct paragraph formatting"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104239_chapterNumbering, "tdf104239_chapterNumbering.doc") +{ + uno::Reference<text::XChapterNumberingSupplier> xNumberingSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xNumberingRules = xNumberingSupplier->getChapterNumberingRules(); + + comphelper::SequenceAsHashMap hashMap(xNumberingRules->getByIndex(0)); + CPPUNIT_ASSERT(hashMap["HeadingStyleName"].get<OUString>().match("Heading 1")); + sal_uInt16 nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N; + CPPUNIT_ASSERT_EQUAL(nNumberingType, hashMap["NumberingType"].get<sal_uInt16>()); + + hashMap = xNumberingRules->getByIndex(5); + CPPUNIT_ASSERT(hashMap["HeadingStyleName"].get<OUString>().match("Heading 6")); + nNumberingType = style::NumberingType::ARABIC; + CPPUNIT_ASSERT_EQUAL(nNumberingType, hashMap["NumberingType"].get<sal_uInt16>()); +} + +DECLARE_WW8EXPORT_TEST(testTdf106541_inheritChapterNumbering, "tdf106541_inheritChapterNumbering.doc") +{ + // The level and numbering are inherited from Heading 1. + uno::Reference<beans::XPropertySet> xPara(getParagraph(3, "Letter A"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("a."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf106541_inheritChapterNumberingB, "tdf106541_inheritChapterNumberingB.doc") +{ + // The level and numbering are inherited from Heading 1. + uno::Reference<beans::XPropertySet> xPara(getParagraph(1, "Chapter 1, level 1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(2, "Chapter 1, level 2"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf75748_inheritChapterNumberingC, "tdf75748_inheritChapterNumberingC.doc") +{ + uno::Reference<beans::XPropertySet> xPara(getParagraph(5, "Inherited from Heading 3"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("II.B.1."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104239_numbering, "tdf104239_numbering.doc") +{ + // The paragraph starts with "paraksta Pieņemšanas". [Roundtrip by Word 2016 avoids the problem.] + uno::Reference<beans::XPropertySet> xPara(getParagraph(51), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("3.3.1."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104239_chapterNumberingLevels, "tdf104239_chapterNumberingLevels.doc") +{ + uno::Reference<beans::XPropertySet> xPara(getParagraph(1, "Heading 1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Article I."), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(2, "Heading 2"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(3, "Heading 3"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("First"), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(4, "Heading 4"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(8, "Heading 9"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.1.1.1.1.1.1.1."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104239_chapterNumberTortureTest, "tdf104239_chapterNumberTortureTest.doc") +{ + // There is no point in identifying what the wrong values where in this test, + //because EVERYTHING was wrong, and MANY different fixes are required to solve the problems. + uno::Reference<beans::XPropertySet> xPara(getParagraph(1, "No numId in style or paragraph"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(2, "Paragraph cancels numbering(0)"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(3, "First numbered line"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1st.i.a.1.I"), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(7, "inheritOnly: inherit outlineLvl and listLvl."), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("2nd.ii"), getProperty<OUString>(xPara, "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPara, "NumberingLevel")); // Level 2 + xPara.set(getParagraph(9, "outline with Body listLvl(9)."), uno::UNO_QUERY); + if (!mbExported) + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(10, "outline with Body listLvl(9) #2."), uno::UNO_QUERY); + if (!mbExported) + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(11, "direct formatting - Body listLvl(9)."), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); + xPara.set(getParagraph(12, "direct numId, inherit listLvl."), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("2nd.ii.a.1.I"), getProperty<OUString>(xPara, "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(4), getProperty<sal_Int16>(xPara, "NumberingLevel")); // Level 5 + xPara.set(getParagraph(13, "Style numId0 cancels inherited numbering."), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf106541_inheritOutlineNumbering, "tdf106541_inheritOutlineNumbering.doc") +{ + // The level and numbering are inherited from Level2. + uno::Reference<beans::XPropertySet> xPara(getParagraph(2, "This should be a sub-point."), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf104239_sharedOutlineNumId, "tdf104239_sharedOutlineNumId.doc") +{ + uno::Reference<beans::XPropertySet> xPara(getParagraph(5, "Principes"), uno::UNO_QUERY); + // This was ".1." previously. + CPPUNIT_ASSERT_EQUAL(OUString("2.1."), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf120394, "tdf120394.doc") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(5), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(8), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(9), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.2"), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(10), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(xPara, "ListLabelString")); + } +} + +DECLARE_WW8EXPORT_TEST(testTdf142760, "tdf142760.doc") +{ + // Without the fix in place, this test would have failed with + // - Expected: 2 + // - Actual : 6 + CPPUNIT_ASSERT_EQUAL(2, getPages()); + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); +} + +DECLARE_WW8EXPORT_TEST(testTdf134570, "tdf134570.doc") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString")); +} + +DECLARE_WW8EXPORT_TEST(testTdf136814, "tdf136814.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + sal_Int32 nBorderDistance = static_cast<sal_Int32>(106); + + CPPUNIT_ASSERT_EQUAL(nBorderDistance, getProperty<sal_Int32>(xStyle, "TopBorderDistance")); + CPPUNIT_ASSERT_EQUAL(nBorderDistance, getProperty<sal_Int32>(xStyle, "RightBorderDistance")); + CPPUNIT_ASSERT_EQUAL(nBorderDistance, getProperty<sal_Int32>(xStyle, "BottomBorderDistance")); + CPPUNIT_ASSERT_EQUAL(nBorderDistance, getProperty<sal_Int32>(xStyle, "LeftBorderDistance")); +} + +DECLARE_WW8EXPORT_TEST(testTdf79186_noLayoutInCell, "tdf79186_noLayoutInCell.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "IsFollowingTextFlow")); +} + +CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) +{ + auto verify = [this]() { + uno::Reference<container::XEnumerationAccess> xParagraph(getParagraph(1), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xPortions = xParagraph->createEnumeration(); + xPortions->nextElement(); + xPortions->nextElement(); + // Without the accompanying fix in place, this test would have failed with: + // An uncaught exception of type com.sun.star.container.NoSuchElementException + // i.e. the first para was just a fly + text portion, the clearing break was lost. + uno::Reference<beans::XPropertySet> xPortion(xPortions->nextElement(), uno::UNO_QUERY); + OUString aPortionType; + xPortion->getPropertyValue("TextPortionType") >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aPortionType); + uno::Reference<text::XTextContent> xLineBreak; + xPortion->getPropertyValue("LineBreak") >>= xLineBreak; + sal_Int16 eClear{}; + uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY); + xLineBreakProps->getPropertyValue("Clear") >>= eClear; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(SwLineBreakClear::ALL), eClear); + }; + + // Given a document with a clearing break: + // When loading that file: + load(mpTestDocumentPath, "clearing-break.doc"); + // Then make sure that the clear property of the break is not ignored: + verify(); + reload(mpFilter, "clearing-break.doc"); + // Make sure that the clear property of the break is not ignored during export: + verify(); +} + +DECLARE_WW8EXPORT_TEST(testTdf142840, "tdf142840.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); + + // Ensure space are replaced by underscore in bookmark name (it was working before, but ensure this) + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xBookmarksByIdx->getCount()); + CPPUNIT_ASSERT(xBookmarksByName->hasByName("Chapter_1")); + CPPUNIT_ASSERT(!xBookmarksByName->hasByName("Chapter 1")); + + // And hyperlink is referring bookmark with underscore also (this was broken) + CPPUNIT_ASSERT_EQUAL(OUString("#Chapter_1"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx new file mode 100644 index 000000000..7a19938ca --- /dev/null +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/XTextDocument.hpp> + +#include <comphelper/sequenceashashmap.hxx> +#include <o3tl/string_view.hxx> + +#include <docsh.hxx> +#include <IDocumentSettingAccess.hxx> +#include <unotxdoc.hxx> + +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97") + { + } + + bool mustTestImportOf(const char* filename) const override + { + // If the testcase is stored in some other format, it's pointless to test. + return o3tl::ends_with(filename, ".doc"); + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testTdf77964) +{ + loadAndReload("tdf77964.doc"); + // both images were loading as AT_PARA instead of AS_CHAR. Image2 visually had text wrapping. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty<text::TextContentAnchorType>(getShapeByName(u"Image2"), "AnchorType")); +} + + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |