summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/ww8export
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sw/qa/extras/ww8export
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/extras/ww8export')
-rw-r--r--sw/qa/extras/ww8export/data/all_gaps_word.docbin0 -> 32256 bytes
-rw-r--r--sw/qa/extras/ww8export/data/arabic-zero-numbering.docbin0 -> 10752 bytes
-rw-r--r--sw/qa/extras/ww8export/data/bnc636128.docbin0 -> 26112 bytes
-rw-r--r--sw/qa/extras/ww8export/data/bnc787942.docbin0 -> 24064 bytes
-rw-r--r--sw/qa/extras/ww8export/data/bnc821208.docbin0 -> 30208 bytes
-rw-r--r--sw/qa/extras/ww8export/data/bnc863018b.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/extras/ww8export/data/bordercolours.docbin0 -> 29696 bytes
-rw-r--r--sw/qa/extras/ww8export/data/bordercolours.odtbin0 -> 24601 bytes
-rw-r--r--sw/qa/extras/ww8export/data/btlr-cell.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/extras/ww8export/data/btlr-frame.odtbin0 -> 8564 bytes
-rw-r--r--sw/qa/extras/ww8export/data/cell-bg-color.odtbin0 -> 10180 bytes
-rw-r--r--sw/qa/extras/ww8export/data/charborder.odtbin0 -> 8053 bytes
-rw-r--r--sw/qa/extras/ww8export/data/checkbox_control.odtbin0 -> 9601 bytes
-rw-r--r--sw/qa/extras/ww8export/data/cjklist30.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/cjklist31.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/cjklist34.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/cjklist35.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/data/comment-export.odtbin0 -> 9709 bytes
-rw-r--r--sw/qa/extras/ww8export/data/commented-table.docbin0 -> 27136 bytes
-rw-r--r--sw/qa/extras/ww8export/data/comments-nested.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/data/cp1000044.docbin0 -> 26112 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo36868.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo42144.odtbin0 -> 9425 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo45724.odtbin0 -> 13499 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo46020.odtbin0 -> 12611 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo53985.docbin0 -> 39936 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo56513.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo59530.docbin0 -> 10240 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo66304-1.odtbin0 -> 54780 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo68963.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo68967.docbin0 -> 99328 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo77454.docbin0 -> 11776 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo77844.docbin0 -> 28672 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo80333.docbin0 -> 24064 bytes
-rw-r--r--sw/qa/extras/ww8export/data/fdo81102.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/first-header-footer.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/data/i120158.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/data/image-comment-at-char.docbin0 -> 24064 bytes
-rw-r--r--sw/qa/extras/ww8export/data/list-nolevel.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/data/mailmerge.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/data/msobrightnesscontrast.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n325936.docbin0 -> 24576 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n652364.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n750255.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n757118.docbin0 -> 35840 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n757905.docbin0 -> 28160 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n757910.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n760294.docbin0 -> 26112 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n816603.docbin0 -> 67072 bytes
-rw-r--r--sw/qa/extras/ww8export/data/n823651.docbin0 -> 30720 bytes
-rw-r--r--sw/qa/extras/ww8export/data/new-page-styles.docbin0 -> 38912 bytes
-rw-r--r--sw/qa/extras/ww8export/data/object_cross_reference.odtbin0 -> 35667 bytes
-rw-r--r--sw/qa/extras/ww8export/data/ooo92948-1.docbin0 -> 43008 bytes
-rw-r--r--sw/qa/extras/ww8export/data/page-border.docbin0 -> 22016 bytes
-rw-r--r--sw/qa/extras/ww8export/data/redline-export-1.odtbin0 -> 12833 bytes
-rw-r--r--sw/qa/extras/ww8export/data/redline-export-2.odtbin0 -> 10363 bytes
-rw-r--r--sw/qa/extras/ww8export/data/redline-export-3.odtbin0 -> 10403 bytes
-rw-r--r--sw/qa/extras/ww8export/data/table_cross_reference.odtbin0 -> 10251 bytes
-rw-r--r--sw/qa/extras/ww8export/data/table_cross_reference_custom_format.odtbin0 -> 12087 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.docbin0 -> 55296 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf102334.docbin0 -> 28672 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf104334.docbin0 -> 25600 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf104805.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odtbin0 -> 14255 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docxbin0 -> 5266 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf107773.docbin0 -> 29184 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf108072.docbin0 -> 28672 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf108448_endNote.odtbin0 -> 10911 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf111480.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.docbin0 -> 24576 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf112118.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf112517_maxSprms.docbin0 -> 49152 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.docbin0 -> 27136 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf114308.docbin0 -> 27136 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf115896_layoutInCell.docbin0 -> 31232 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf116194.docbin0 -> 12288 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf116436_tableBackground.odtbin0 -> 10745 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odtbin0 -> 16416 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf117503.docxbin0 -> 23567 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf117885.docbin0 -> 50688 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf118133.docxbin0 -> 23359 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf118375_240degClockwise.docbin0 -> 19456 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf118412.docbin0 -> 51200 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf118564.docbin0 -> 28160 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf119232_startEvenPage.docbin0 -> 30720 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.docbin0 -> 27136 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf120394.docbin0 -> 30208 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odtbin0 -> 11092 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf120711.docbin0 -> 25600 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf121110_absJustify.docbin0 -> 19456 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docxbin0 -> 53968 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf122429_header.docbin0 -> 122368 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf122460_header.odtbin0 -> 9753 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.docbin0 -> 33792 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf126708_containsemf.odtbin0 -> 13315 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odtbin0 -> 11475 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odtbin0 -> 14195 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odtbin0 -> 38808 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odtbin0 -> 11105 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.docbin0 -> 113152 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.docbin0 -> 67072 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odtbin0 -> 14253 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.docbin0 -> 78336 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf133453_realFontSize.docbin0 -> 10752 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf134570.docbin0 -> 39936 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.docbin0 -> 15872 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf37778_readonlySection.docbin0 -> 29696 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf38778_properties_in_run_for_field.docbin0 -> 25600 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odtbin0 -> 15669 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf41542_imagePadding.odtbin0 -> 17926 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf46441-2.odtbin0 -> 14672 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.docbin0 -> 17408 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odtbin0 -> 13291 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.docbin0 -> 24576 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf56321_flipImage_both.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf59896.docbin0 -> 12288 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf60378_mergedBorders.docbin0 -> 45056 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf70838.odtbin0 -> 9257 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odtbin0 -> 11231 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf73056_cellMargins.docbin0 -> 25088 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf74328.docbin0 -> 44032 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf75539_relativeWidth.docbin0 -> 50176 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf76349_textboxMargins.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docxbin0 -> 12593 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf79553_lineNumbers.docbin0 -> 77312 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf80635_marginLeft.docbin0 -> 47104 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.docbin0 -> 25088 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf80635_pageLeft.docbin0 -> 36352 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.docbin0 -> 25088 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.docbin0 -> 27136 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf91083.odtbin0 -> 19865 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odtbin0 -> 15980 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odtbin0 -> 13658 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf91687.docbin0 -> 23552 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf92281.docbin0 -> 26112 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odtbin0 -> 11939 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf94386.odtbin0 -> 8163 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf95321.docbin0 -> 27648 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf95576.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf96277.docbin0 -> 48128 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf98620_rtlJustify.docbin0 -> 9216 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf99100.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf99120.docbin0 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf99197_defaultLTR.docbin0 -> 19968 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tdf99474.odtbin0 -> 9375 bytes
-rw-r--r--sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.docbin0 -> 10240 bytes
-rw-r--r--sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/data/tscp.docbin0 -> 10240 bytes
-rw-r--r--sw/qa/extras/ww8export/data/zoom.docbin0 -> 9216 bytes
-rw-r--r--sw/qa/extras/ww8export/data/zoomtype.docbin0 -> 9216 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx1407
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx1041
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx616
155 files changed, 3064 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
new file mode 100644
index 000000000..d5c61a6c4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/all_gaps_word.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc
new file mode 100644
index 000000000..c198c4aa4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/bnc636128.doc b/sw/qa/extras/ww8export/data/bnc636128.doc
new file mode 100644
index 000000000..5f92c3e2e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/bnc636128.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/bnc787942.doc b/sw/qa/extras/ww8export/data/bnc787942.doc
new file mode 100644
index 000000000..06b2c39f2
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/bnc787942.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/bnc821208.doc b/sw/qa/extras/ww8export/data/bnc821208.doc
new file mode 100644
index 000000000..cfe76806e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/bnc821208.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/bnc863018b.doc b/sw/qa/extras/ww8export/data/bnc863018b.doc
new file mode 100644
index 000000000..c9744b856
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/bnc863018b.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/bordercolours.doc b/sw/qa/extras/ww8export/data/bordercolours.doc
new file mode 100644
index 000000000..c442223ea
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/bordercolours.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/bordercolours.odt b/sw/qa/extras/ww8export/data/bordercolours.odt
new file mode 100644
index 000000000..f34d595f3
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/bordercolours.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/btlr-cell.doc b/sw/qa/extras/ww8export/data/btlr-cell.doc
new file mode 100644
index 000000000..f99e9e67e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/btlr-cell.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/btlr-frame.odt b/sw/qa/extras/ww8export/data/btlr-frame.odt
new file mode 100644
index 000000000..31cb03849
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/btlr-frame.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/cell-bg-color.odt b/sw/qa/extras/ww8export/data/cell-bg-color.odt
new file mode 100644
index 000000000..3565f40c2
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cell-bg-color.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/charborder.odt b/sw/qa/extras/ww8export/data/charborder.odt
new file mode 100644
index 000000000..0829c0348
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/charborder.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/checkbox_control.odt b/sw/qa/extras/ww8export/data/checkbox_control.odt
new file mode 100644
index 000000000..b5281b30e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/checkbox_control.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/cjklist30.doc b/sw/qa/extras/ww8export/data/cjklist30.doc
new file mode 100644
index 000000000..48f22cf79
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cjklist30.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/cjklist31.doc b/sw/qa/extras/ww8export/data/cjklist31.doc
new file mode 100644
index 000000000..4a7d3e7e1
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cjklist31.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/cjklist34.doc b/sw/qa/extras/ww8export/data/cjklist34.doc
new file mode 100644
index 000000000..551fc8952
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cjklist34.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/cjklist35.doc b/sw/qa/extras/ww8export/data/cjklist35.doc
new file mode 100644
index 000000000..33d247029
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cjklist35.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/comment-export.odt b/sw/qa/extras/ww8export/data/comment-export.odt
new file mode 100644
index 000000000..66873d869
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/comment-export.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/commented-table.doc b/sw/qa/extras/ww8export/data/commented-table.doc
new file mode 100644
index 000000000..049c7e3a4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/commented-table.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/comments-nested.doc b/sw/qa/extras/ww8export/data/comments-nested.doc
new file mode 100644
index 000000000..339a15b11
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/comments-nested.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/cp1000044.doc b/sw/qa/extras/ww8export/data/cp1000044.doc
new file mode 100644
index 000000000..ea30cc002
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cp1000044.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo36868.doc b/sw/qa/extras/ww8export/data/fdo36868.doc
new file mode 100644
index 000000000..382c6b267
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo36868.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo42144.odt b/sw/qa/extras/ww8export/data/fdo42144.odt
new file mode 100644
index 000000000..be9490079
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo42144.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo45724.odt b/sw/qa/extras/ww8export/data/fdo45724.odt
new file mode 100644
index 000000000..45c6d9a58
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo45724.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo46020.odt b/sw/qa/extras/ww8export/data/fdo46020.odt
new file mode 100644
index 000000000..478c931b2
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo46020.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo53985.doc b/sw/qa/extras/ww8export/data/fdo53985.doc
new file mode 100644
index 000000000..0c8f278dc
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo53985.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo56513.doc b/sw/qa/extras/ww8export/data/fdo56513.doc
new file mode 100644
index 000000000..f5be1c3cd
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo56513.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo59530.doc b/sw/qa/extras/ww8export/data/fdo59530.doc
new file mode 100644
index 000000000..90bd4ce04
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo59530.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo66304-1.odt b/sw/qa/extras/ww8export/data/fdo66304-1.odt
new file mode 100644
index 000000000..c3fb9bcfa
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo66304-1.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo68963.doc b/sw/qa/extras/ww8export/data/fdo68963.doc
new file mode 100644
index 000000000..b31741f7c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo68963.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo68967.doc b/sw/qa/extras/ww8export/data/fdo68967.doc
new file mode 100644
index 000000000..05271c3d8
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo68967.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo77454.doc b/sw/qa/extras/ww8export/data/fdo77454.doc
new file mode 100644
index 000000000..4e2d7b2ad
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo77454.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo77844.doc b/sw/qa/extras/ww8export/data/fdo77844.doc
new file mode 100644
index 000000000..cd7368d5d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo77844.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo80333.doc b/sw/qa/extras/ww8export/data/fdo80333.doc
new file mode 100644
index 000000000..773a922ba
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo80333.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/fdo81102.doc b/sw/qa/extras/ww8export/data/fdo81102.doc
new file mode 100644
index 000000000..e8a550768
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo81102.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/first-header-footer.doc b/sw/qa/extras/ww8export/data/first-header-footer.doc
new file mode 100644
index 000000000..023c49486
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/first-header-footer.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/i120158.doc b/sw/qa/extras/ww8export/data/i120158.doc
new file mode 100644
index 000000000..6adf3ec13
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/i120158.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/image-comment-at-char.doc b/sw/qa/extras/ww8export/data/image-comment-at-char.doc
new file mode 100644
index 000000000..e0d5e2cba
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/image-comment-at-char.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/list-nolevel.doc b/sw/qa/extras/ww8export/data/list-nolevel.doc
new file mode 100644
index 000000000..04e34996f
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/list-nolevel.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/mailmerge.doc b/sw/qa/extras/ww8export/data/mailmerge.doc
new file mode 100644
index 000000000..6ed882769
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/mailmerge.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/msobrightnesscontrast.doc b/sw/qa/extras/ww8export/data/msobrightnesscontrast.doc
new file mode 100644
index 000000000..675d6d370
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/msobrightnesscontrast.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n325936.doc b/sw/qa/extras/ww8export/data/n325936.doc
new file mode 100644
index 000000000..23d0f6025
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n325936.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n652364.doc b/sw/qa/extras/ww8export/data/n652364.doc
new file mode 100644
index 000000000..f7a0fe0d5
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n652364.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n750255.doc b/sw/qa/extras/ww8export/data/n750255.doc
new file mode 100644
index 000000000..c0475c4ed
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n750255.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n757118.doc b/sw/qa/extras/ww8export/data/n757118.doc
new file mode 100644
index 000000000..2c6948521
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n757118.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n757905.doc b/sw/qa/extras/ww8export/data/n757905.doc
new file mode 100644
index 000000000..0fb7b097c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n757905.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n757910.doc b/sw/qa/extras/ww8export/data/n757910.doc
new file mode 100644
index 000000000..49a0e59f8
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n757910.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n760294.doc b/sw/qa/extras/ww8export/data/n760294.doc
new file mode 100644
index 000000000..04960d060
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n760294.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n816603.doc b/sw/qa/extras/ww8export/data/n816603.doc
new file mode 100644
index 000000000..9186f628f
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n816603.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/n823651.doc b/sw/qa/extras/ww8export/data/n823651.doc
new file mode 100644
index 000000000..51b383c42
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/n823651.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/new-page-styles.doc b/sw/qa/extras/ww8export/data/new-page-styles.doc
new file mode 100644
index 000000000..c3886fd6b
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/new-page-styles.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/object_cross_reference.odt b/sw/qa/extras/ww8export/data/object_cross_reference.odt
new file mode 100644
index 000000000..9eaca352b
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/object_cross_reference.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/ooo92948-1.doc b/sw/qa/extras/ww8export/data/ooo92948-1.doc
new file mode 100644
index 000000000..f355eaa26
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/ooo92948-1.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/page-border.doc b/sw/qa/extras/ww8export/data/page-border.doc
new file mode 100644
index 000000000..c2dec4fed
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/page-border.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/redline-export-1.odt b/sw/qa/extras/ww8export/data/redline-export-1.odt
new file mode 100644
index 000000000..31aacce47
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/redline-export-1.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/redline-export-2.odt b/sw/qa/extras/ww8export/data/redline-export-2.odt
new file mode 100644
index 000000000..2aca5eee4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/redline-export-2.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/redline-export-3.odt b/sw/qa/extras/ww8export/data/redline-export-3.odt
new file mode 100644
index 000000000..6d0d80a08
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/redline-export-3.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/table_cross_reference.odt b/sw/qa/extras/ww8export/data/table_cross_reference.odt
new file mode 100644
index 000000000..95f33139c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/table_cross_reference.odt
Binary files differ
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
new file mode 100644
index 000000000..1c41e364c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/table_cross_reference_custom_format.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc
new file mode 100644
index 000000000..206f48309
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf102334.doc b/sw/qa/extras/ww8export/data/tdf102334.doc
new file mode 100644
index 000000000..d007257cf
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf102334.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf104334.doc b/sw/qa/extras/ww8export/data/tdf104334.doc
new file mode 100644
index 000000000..877caff0c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf104334.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf104805.doc b/sw/qa/extras/ww8export/data/tdf104805.doc
new file mode 100644
index 000000000..a2dd81dd0
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf104805.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt
new file mode 100644
index 000000000..af5e225ea
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx b/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx
new file mode 100644
index 000000000..a222f5881
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf107773.doc b/sw/qa/extras/ww8export/data/tdf107773.doc
new file mode 100644
index 000000000..31c7b7c5c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf107773.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf108072.doc b/sw/qa/extras/ww8export/data/tdf108072.doc
new file mode 100644
index 000000000..03e8b2a53
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf108072.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf108448_endNote.odt b/sw/qa/extras/ww8export/data/tdf108448_endNote.odt
new file mode 100644
index 000000000..bc4a751a8
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf108448_endNote.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf111480.doc b/sw/qa/extras/ww8export/data/tdf111480.doc
new file mode 100644
index 000000000..888126066
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf111480.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc b/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc
new file mode 100644
index 000000000..64ea6521e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf112118.doc b/sw/qa/extras/ww8export/data/tdf112118.doc
new file mode 100644
index 000000000..f1aaa9b54
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf112118.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf112517_maxSprms.doc b/sw/qa/extras/ww8export/data/tdf112517_maxSprms.doc
new file mode 100644
index 000000000..95de03d3b
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf112517_maxSprms.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.doc b/sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.doc
new file mode 100644
index 000000000..c7d9823b0
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf112618_textbox_no_bg.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf114308.doc b/sw/qa/extras/ww8export/data/tdf114308.doc
new file mode 100644
index 000000000..36e6c7ec6
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf114308.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf115896_layoutInCell.doc b/sw/qa/extras/ww8export/data/tdf115896_layoutInCell.doc
new file mode 100644
index 000000000..c7e6fc680
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf115896_layoutInCell.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf116194.doc b/sw/qa/extras/ww8export/data/tdf116194.doc
new file mode 100644
index 000000000..ca1edf68d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf116194.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt b/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt
new file mode 100644
index 000000000..1ae65f788
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt b/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt
new file mode 100644
index 000000000..c1598eb71
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf116570_exportFootnote.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf117503.docx b/sw/qa/extras/ww8export/data/tdf117503.docx
new file mode 100644
index 000000000..f817f035b
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf117503.docx
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc b/sw/qa/extras/ww8export/data/tdf117885.doc
new file mode 100644
index 000000000..bf8d0ef03
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf117885.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf118133.docx b/sw/qa/extras/ww8export/data/tdf118133.docx
new file mode 100644
index 000000000..613aa1bd7
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf118133.docx
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc
new file mode 100644
index 000000000..99d15e20c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc b/sw/qa/extras/ww8export/data/tdf118412.doc
new file mode 100644
index 000000000..ef9b26cb3
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf118412.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf118564.doc b/sw/qa/extras/ww8export/data/tdf118564.doc
new file mode 100644
index 000000000..4040e05e2
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf118564.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc
new file mode 100644
index 000000000..c50bf46c0
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.doc b/sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.doc
new file mode 100644
index 000000000..713cdc336
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf120225_textControlCrossRef.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf120394.doc b/sw/qa/extras/ww8export/data/tdf120394.doc
new file mode 100644
index 000000000..2ee9058a5
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf120394.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odt b/sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odt
new file mode 100644
index 000000000..ecd5841a8
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf120412_proportionalEscapement.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf120711.doc b/sw/qa/extras/ww8export/data/tdf120711.doc
new file mode 100644
index 000000000..90e7c05ce
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf120711.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf121110_absJustify.doc b/sw/qa/extras/ww8export/data/tdf121110_absJustify.doc
new file mode 100644
index 000000000..0b9f581d4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf121110_absJustify.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docx b/sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docx
new file mode 100644
index 000000000..434d182eb
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf121111_fillStyleNone.docx
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf122429_header.doc b/sw/qa/extras/ww8export/data/tdf122429_header.doc
new file mode 100644
index 000000000..37afc067b
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf122429_header.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf122460_header.odt b/sw/qa/extras/ww8export/data/tdf122460_header.odt
new file mode 100644
index 000000000..420121dc9
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf122460_header.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.doc b/sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.doc
new file mode 100644
index 000000000..f8321e96e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf123433_fillStyleStop.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt
new file mode 100644
index 000000000..31b0fab8d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf126708_containsemf.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc b/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc
new file mode 100644
index 000000000..21cd47a4c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odt b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odt
new file mode 100644
index 000000000..95987d456
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odt b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odt
new file mode 100644
index 000000000..d98fae0ad
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf127316_autoEscapement2.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt
new file mode 100644
index 000000000..c382c9aa6
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt b/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt
new file mode 100644
index 000000000..917dc96d4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf128608_fillStyleNoneB.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc
new file mode 100644
index 000000000..d9b16ca53
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf128608_tableParaBackColor.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc b/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc
new file mode 100644
index 000000000..9fa798ea3
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt
new file mode 100644
index 000000000..7ced9fc64
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf129522_removeShadowStyle.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc b/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc
new file mode 100644
index 000000000..1b8a29e0e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc b/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc
new file mode 100644
index 000000000..6fa503680
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf133453_realFontSize.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf134570.doc b/sw/qa/extras/ww8export/data/tdf134570.doc
new file mode 100644
index 000000000..17f7842d7
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf134570.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.doc b/sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.doc
new file mode 100644
index 000000000..f7afd4191
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf36117_verticalAdjustment.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc b/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc
new file mode 100644
index 000000000..08ba2f9d5
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc
new file mode 100644
index 000000000..5e4fcdd76
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc
Binary files differ
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
new file mode 100644
index 000000000..960fe50da
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf38778_properties_in_run_for_field.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt
new file mode 100644
index 000000000..9585041de
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt b/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt
new file mode 100644
index 000000000..019e19f24
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf41542_imagePadding.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf46441-2.odt b/sw/qa/extras/ww8export/data/tdf46441-2.odt
new file mode 100644
index 000000000..ed73406c5
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf46441-2.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.doc b/sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.doc
new file mode 100644
index 000000000..747136d47
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf49102_mergedCellNumbering.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odt b/sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odt
new file mode 100644
index 000000000..7f77f6d39
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf55427_footnote2endnote.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.doc b/sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.doc
new file mode 100644
index 000000000..367f7873d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf55528_relativeTableWidth.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc b/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc
new file mode 100644
index 000000000..a5293f29f
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf59896.doc b/sw/qa/extras/ww8export/data/tdf59896.doc
new file mode 100644
index 000000000..a3c724299
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf59896.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf60378_mergedBorders.doc b/sw/qa/extras/ww8export/data/tdf60378_mergedBorders.doc
new file mode 100644
index 000000000..3278f4631
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf60378_mergedBorders.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf70838.odt b/sw/qa/extras/ww8export/data/tdf70838.odt
new file mode 100644
index 000000000..65d20ecb6
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf70838.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt
new file mode 100644
index 000000000..556f2564c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf73056_cellMargins.doc b/sw/qa/extras/ww8export/data/tdf73056_cellMargins.doc
new file mode 100644
index 000000000..7ae12d452
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf73056_cellMargins.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf74328.doc b/sw/qa/extras/ww8export/data/tdf74328.doc
new file mode 100644
index 000000000..a82978547
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf74328.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc
new file mode 100644
index 000000000..ac811a8f3
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf75539_relativeWidth.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf76349_textboxMargins.doc b/sw/qa/extras/ww8export/data/tdf76349_textboxMargins.doc
new file mode 100644
index 000000000..95bc59807
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf76349_textboxMargins.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx b/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx
new file mode 100644
index 000000000..55d1a1f22
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf79553_lineNumbers.doc b/sw/qa/extras/ww8export/data/tdf79553_lineNumbers.doc
new file mode 100644
index 000000000..260f5ce18
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf79553_lineNumbers.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc b/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc
new file mode 100644
index 000000000..ad70ff641
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.doc b/sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.doc
new file mode 100644
index 000000000..6e509a190
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf80635_marginRightRTL.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc b/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc
new file mode 100644
index 000000000..16f32e3e3
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.doc b/sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.doc
new file mode 100644
index 000000000..71f9adf4a
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf80635_pageRightRTL.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.doc b/sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.doc
new file mode 100644
index 000000000..ef6415f16
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf89377_tableWithBreakBeforeParaStyle.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf91083.odt b/sw/qa/extras/ww8export/data/tdf91083.odt
new file mode 100644
index 000000000..e4f55e58a
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91083.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odt b/sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odt
new file mode 100644
index 000000000..19a1ac843
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91083_tableKeep2.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odt b/sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odt
new file mode 100644
index 000000000..d3a13baf4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91083_tableKeep3.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf91687.doc b/sw/qa/extras/ww8export/data/tdf91687.doc
new file mode 100644
index 000000000..d1c1e0a0c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91687.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf92281.doc b/sw/qa/extras/ww8export/data/tdf92281.doc
new file mode 100644
index 000000000..2893eb37a
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf92281.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odt b/sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odt
new file mode 100644
index 000000000..e3143ec04
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf94009_zeroPgMargin.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf94386.odt b/sw/qa/extras/ww8export/data/tdf94386.odt
new file mode 100644
index 000000000..0e8d0bd0d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf94386.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf95321.doc b/sw/qa/extras/ww8export/data/tdf95321.doc
new file mode 100644
index 000000000..8b85472b5
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf95321.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf95576.doc b/sw/qa/extras/ww8export/data/tdf95576.doc
new file mode 100644
index 000000000..a8a601885
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf95576.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf96277.doc b/sw/qa/extras/ww8export/data/tdf96277.doc
new file mode 100644
index 000000000..904b2da13
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf96277.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc b/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc
new file mode 100644
index 000000000..c643b96a4
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf99100.doc b/sw/qa/extras/ww8export/data/tdf99100.doc
new file mode 100644
index 000000000..6352ae355
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf99100.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf99120.doc b/sw/qa/extras/ww8export/data/tdf99120.doc
new file mode 100644
index 000000000..a93721c57
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf99120.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf99197_defaultLTR.doc b/sw/qa/extras/ww8export/data/tdf99197_defaultLTR.doc
new file mode 100644
index 000000000..721b68882
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf99197_defaultLTR.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tdf99474.odt b/sw/qa/extras/ww8export/data/tdf99474.odt
new file mode 100644
index 000000000..7530488bb
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf99474.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc b/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc
new file mode 100644
index 000000000..101b02a0b
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc b/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc
new file mode 100644
index 000000000..35f6371fb
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/tscp.doc b/sw/qa/extras/ww8export/data/tscp.doc
new file mode 100644
index 000000000..9830b288c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tscp.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/zoom.doc b/sw/qa/extras/ww8export/data/zoom.doc
new file mode 100644
index 000000000..70548966d
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/zoom.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/zoomtype.doc b/sw/qa/extras/ww8export/data/zoomtype.doc
new file mode 100644
index 000000000..882375416
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/zoomtype.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
new file mode 100644
index 000000000..b1ca07971
--- /dev/null
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -0,0 +1,1407 @@
+/* -*- 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/text/XDependentTextField.hpp>
+
+#include <IDocumentSettingAccess.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/XBitmap.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 <vcl/svapp.hxx>
+#include <grfatr.hxx>
+#include <pagedesc.hxx>
+#include <ndgrf.hxx>
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+
+#include <cmdid.h>
+#include <envimg.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+
+#include <config_features.h>
+
+#include <bordertest.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 OString(filename).endsWith(".doc");
+ }
+
+ /**
+ * Validation handling
+ */
+ bool mustValidate(const char* filename) const override
+ {
+ const std::vector<const char*> aBlacklist =
+ {
+ // 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 blacklisted .doc files
+ return (OString(filename).endsWith(".doc") && std::find(aBlacklist.begin(), aBlacklist.end(), filename) == aBlacklist.end());
+ }
+protected:
+
+ virtual void postLoad(const char* pFilename) override
+ {
+ if (OString(pFilename) == "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;
+ uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(58), bitmap->getSize().Width );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(320), bitmap->getSize().Height );
+ const uno::Sequence< sal_Int8 > data = bitmap->getDIB(); // as .bmp data
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(20278), data.getLength());
+ CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b0])); // -50 = 206 pixel value
+ CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b1]));
+ CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b2]));
+ CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b3]));
+ CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b4]));
+}
+
+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(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
+ */
+
+ sal_Int32 nValue = getProperty< sal_Int32 >(getShape(1), "BackColorTransparency");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue);
+}
+
+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, Color(getProperty<sal_uInt32>(xComponent, "BackgroundColor")));
+ CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>());
+}
+
+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(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 && crop.Right != 0 );
+ CPPUNIT_ASSERT( crop.Left == crop.Top && crop.Right == crop.Bottom && crop.Left == crop.Right );
+
+ // borderedImage - image WITH BORDERS : simulate padding with -crop
+ crop = getProperty<text::GraphicCrop>(getShape(3), "GraphicCrop");
+ CPPUNIT_ASSERT( crop.Left != 0 && crop.Right != 0 );
+ CPPUNIT_ASSERT( crop.Left == crop.Top && crop.Right == crop.Bottom && 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(sal_Int32(0xCC0000), getProperty<sal_Int32>(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);
+ const sal_Unicode aFontname[14] = { 26032, 32048, 26126, 39636, ';' , 'P' , 'M', 'i', 'n', 'g', 'L', 'i', 'U' , 0 };
+ 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 (int 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")
+{
+ //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) && (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);
+ Color charColor(getProperty<util::Color>(xStyle, "CharColor"));
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(COL_AUTO), sal_uInt32(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..8c29d0446
--- /dev/null
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -0,0 +1,1041 @@
+/* -*- 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 <ftninfo.hxx>
+#include <svx/svdpage.hxx>
+#include <drawdoc.hxx>
+#include <IDocumentDrawModelAccess.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 OString(filename).endsWith(".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(sal_Int32(0xF8DF7C), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell.set(xTable->getCellByName("A6"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x81D41A), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell.set(xTable->getCellByName("B6"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFBCC), getProperty<sal_Int32>(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", sal_Int32(0xFF007F), getProperty< sal_Int32 >(xPageStyle, "CharColor") );
+ xPageStyle.set(getStyles("ParagraphStyles")->getByName("Endnote"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote style is cyan3 color", sal_Int32(0x2BD0D2), getProperty< sal_Int32 >(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", long(3500), getProperty<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", long(-2950), getProperty<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", long(-2750), getProperty<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<long>(xTable, "LeftMargin") > 3000);
+ CPPUNIT_ASSERT_MESSAGE("Table Indent is 3750", getProperty<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")
+{
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aNumberingRule;
+ xLevels->getByIndex(1) >>= aNumberingRule; // 2nd level
+ for (const auto& rPair : std::as_const(aNumberingRule))
+ {
+ if (rPair.Name == "Prefix")
+ // This was "." instead of empty, so the second paragraph was
+ // rendered as ".1" instead of "1.".
+ CPPUNIT_ASSERT_EQUAL(OUString(), rPair.Value.get<OUString>());
+ else if (rPair.Name == "Suffix")
+ CPPUNIT_ASSERT_EQUAL(OUString("."), rPair.Value.get<OUString>());
+ }
+}
+
+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(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( 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::fromUtf8(u8"«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 + OStringLiteral(" ") + 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_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..a663a0340
--- /dev/null
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -0,0 +1,616 @@
+/* -*- 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 <IDocumentSettingAccess.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/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/text/XTextContentAppend.hpp>
+
+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 OString(filename).endsWith(".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(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(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+ aMap["NumberingType"].get<sal_uInt16>());
+}
+
+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::makeAny(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::makeAny(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(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(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(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(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(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(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(192,0,0), Color(getProperty<sal_uInt32>(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(184,204,228), Color(getProperty<sal_uInt32>(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, Color(getProperty<sal_uInt32>(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, Color(getProperty<sal_uInt32>(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")
+{
+ sal_uInt16 nTransparence = getProperty<sal_Int16>(getShape(2), "FillTransparence");
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(100), nTransparence);
+ CPPUNIT_ASSERT_EQUAL(nTransparence, getProperty<sal_uInt16>(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, Color(getProperty<sal_uInt32>(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, Color(getProperty<sal_uInt32>(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(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(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(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);
+ }
+}
+
+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(CHAR_ZWSP), 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(CHAR_ZWSP), 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(CHAR_ZWSP), getProperty<OUString>(xPara, "ListLabelString"));
+ }
+}
+
+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"));
+ }
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */