From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- sw/qa/extras/ooxmlimport/data/105975.docx | Bin 0 -> 12783 bytes sw/qa/extras/ooxmlimport/data/WordArt.docx | Bin 0 -> 10417 bytes sw/qa/extras/ooxmlimport/data/bnc773061.docx | Bin 0 -> 8872 bytes sw/qa/extras/ooxmlimport/data/bnc779620.docx | Bin 0 -> 10299 bytes sw/qa/extras/ooxmlimport/data/bnc821804.docx | Bin 0 -> 5601 bytes sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx | Bin 0 -> 22765 bytes .../data/dml-groupshape-paraadjust.docx | Bin 0 -> 17764 bytes sw/qa/extras/ooxmlimport/data/fdo43641.docx | Bin 0 -> 11966 bytes sw/qa/extras/ooxmlimport/data/fdo75722-dml.docx | Bin 0 -> 15469 bytes sw/qa/extras/ooxmlimport/data/fdo75722-vml.docx | Bin 0 -> 10146 bytes sw/qa/extras/ooxmlimport/data/fdo76583.docx | Bin 0 -> 14007 bytes sw/qa/extras/ooxmlimport/data/fdo87488.docx | Bin 0 -> 26418 bytes .../data/floating-table-section-columns.docx | Bin 0 -> 5668 bytes .../data/groupshape-child-rotation.docx | Bin 0 -> 15960 bytes .../ooxmlimport/data/groupshape-fontname.docx | Bin 0 -> 61000 bytes sw/qa/extras/ooxmlimport/data/groupshape-line.docx | Bin 0 -> 10291 bytes .../ooxmlimport/data/groupshape-relsize.docx | Bin 0 -> 20145 bytes sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx | Bin 0 -> 10742 bytes sw/qa/extras/ooxmlimport/data/image-hyperlink.docx | Bin 0 -> 13467 bytes sw/qa/extras/ooxmlimport/data/image-lazy-read.docx | Bin 0 -> 9392 bytes sw/qa/extras/ooxmlimport/data/ink.docx | Bin 0 -> 14339 bytes sw/qa/extras/ooxmlimport/data/line-rotation.docx | Bin 0 -> 14772 bytes sw/qa/extras/ooxmlimport/data/line-wps-only.docx | Bin 0 -> 8721 bytes .../ooxmlimport/data/math-malformed_xml.docx | Bin 0 -> 4320 bytes sw/qa/extras/ooxmlimport/data/n751017.docx | Bin 0 -> 10194 bytes sw/qa/extras/ooxmlimport/data/n751077.docx | Bin 0 -> 22131 bytes sw/qa/extras/ooxmlimport/data/n757890.docx | Bin 0 -> 11098 bytes sw/qa/extras/ooxmlimport/data/n758883.docx | Bin 0 -> 11896 bytes sw/qa/extras/ooxmlimport/data/n760764.docx | Bin 0 -> 10079 bytes .../extras/ooxmlimport/data/n764745-alignment.docx | Bin 0 -> 5635 bytes sw/qa/extras/ooxmlimport/data/n766477.docx | Bin 0 -> 10104 bytes sw/qa/extras/ooxmlimport/data/n773061.docx | Bin 0 -> 7081 bytes sw/qa/extras/ooxmlimport/data/n775899.docx | Bin 0 -> 10264 bytes sw/qa/extras/ooxmlimport/data/n777345.docx | Bin 0 -> 9360 bytes sw/qa/extras/ooxmlimport/data/n778140.docx | Bin 0 -> 9564 bytes sw/qa/extras/ooxmlimport/data/n779627.docx | Bin 0 -> 30152 bytes sw/qa/extras/ooxmlimport/data/n779627b.docx | Bin 0 -> 5805 bytes sw/qa/extras/ooxmlimport/data/n780645.docx | Bin 0 -> 4014 bytes sw/qa/extras/ooxmlimport/data/n782061.docx | Bin 0 -> 12654 bytes sw/qa/extras/ooxmlimport/data/n820504.docx | Bin 0 -> 23684 bytes sw/qa/extras/ooxmlimport/data/n820788.docx | Bin 0 -> 10267 bytes .../extras/ooxmlimport/data/numbering-circle.docx | Bin 0 -> 4952 bytes sw/qa/extras/ooxmlimport/data/ole-anchor.docx | Bin 0 -> 12393 bytes .../ooxmlimport/data/strict-lockedcanvas.docx | Bin 0 -> 12345 bytes sw/qa/extras/ooxmlimport/data/table_width.docx | Bin 0 -> 6572 bytes sw/qa/extras/ooxmlimport/data/tdf100072.docx | Bin 0 -> 7034 bytes sw/qa/extras/ooxmlimport/data/tdf100830.docx | Bin 0 -> 22171 bytes sw/qa/extras/ooxmlimport/data/tdf101626.docx | Bin 0 -> 12420 bytes sw/qa/extras/ooxmlimport/data/tdf101627.docx | Bin 0 -> 45695 bytes sw/qa/extras/ooxmlimport/data/tdf103664.docx | Bin 0 -> 11444 bytes sw/qa/extras/ooxmlimport/data/tdf103931.docx | Bin 0 -> 3542 bytes sw/qa/extras/ooxmlimport/data/tdf104167.docx | Bin 0 -> 10909 bytes sw/qa/extras/ooxmlimport/data/tdf105127.docx | Bin 0 -> 10430 bytes sw/qa/extras/ooxmlimport/data/tdf105143.docx | Bin 0 -> 13098 bytes sw/qa/extras/ooxmlimport/data/tdf105975.docx | Bin 0 -> 12754 bytes sw/qa/extras/ooxmlimport/data/tdf106606.docx | Bin 0 -> 73530 bytes sw/qa/extras/ooxmlimport/data/tdf107784.docx | Bin 0 -> 14852 bytes sw/qa/extras/ooxmlimport/data/tdf108350.docx | Bin 0 -> 1271 bytes sw/qa/extras/ooxmlimport/data/tdf108408.docx | Bin 0 -> 1298 bytes .../data/tdf108545_embeddedDocxIcon.docx | Bin 0 -> 28843 bytes sw/qa/extras/ooxmlimport/data/tdf108714.docx | Bin 0 -> 1376 bytes sw/qa/extras/ooxmlimport/data/tdf108806.docx | Bin 0 -> 1315 bytes sw/qa/extras/ooxmlimport/data/tdf108849.docx | Bin 0 -> 1360 bytes sw/qa/extras/ooxmlimport/data/tdf109053.docx | Bin 0 -> 12195 bytes .../ooxmlimport/data/tdf109316_dropCaps.docx | Bin 0 -> 13058 bytes sw/qa/extras/ooxmlimport/data/tdf109524.docx | Bin 0 -> 1291 bytes sw/qa/extras/ooxmlimport/data/tdf111550.docx | Bin 0 -> 1362 bytes sw/qa/extras/ooxmlimport/data/tdf112443.docx | Bin 0 -> 26990 bytes sw/qa/extras/ooxmlimport/data/tdf113182.docx | Bin 0 -> 12561 bytes sw/qa/extras/ooxmlimport/data/tdf113946.docx | Bin 0 -> 15580 bytes sw/qa/extras/ooxmlimport/data/tdf114212.docx | Bin 0 -> 4791 bytes sw/qa/extras/ooxmlimport/data/tdf114217.docx | Bin 0 -> 11524 bytes sw/qa/extras/ooxmlimport/data/tdf115094.docx | Bin 0 -> 15064 bytes sw/qa/extras/ooxmlimport/data/tdf115094v2.docx | Bin 0 -> 32186 bytes sw/qa/extras/ooxmlimport/data/tdf115719b.docx | Bin 0 -> 19843 bytes sw/qa/extras/ooxmlimport/data/tdf115883.docx | Bin 0 -> 33313 bytes sw/qa/extras/ooxmlimport/data/tdf117843.docx | Bin 0 -> 26926 bytes sw/qa/extras/ooxmlimport/data/tdf118693.docx | Bin 0 -> 26072 bytes .../data/tdf119039_bad_embedded_compound.docx | Bin 0 -> 13876 bytes sw/qa/extras/ooxmlimport/data/tdf119200.docx | Bin 0 -> 20728 bytes sw/qa/extras/ooxmlimport/data/tdf120547.docx | Bin 0 -> 40512 bytes sw/qa/extras/ooxmlimport/data/tdf120548.docx | Bin 0 -> 13745 bytes sw/qa/extras/ooxmlimport/data/tdf120551.docx | Bin 0 -> 31758 bytes sw/qa/extras/ooxmlimport/data/tdf121203.docx | Bin 0 -> 12702 bytes sw/qa/extras/ooxmlimport/data/tdf121440.docx | Bin 0 -> 23209 bytes sw/qa/extras/ooxmlimport/data/tdf121664.docx | Bin 0 -> 12709 bytes sw/qa/extras/ooxmlimport/data/tdf121804.docx | Bin 0 -> 17629 bytes sw/qa/extras/ooxmlimport/data/tdf122224.docx | Bin 0 -> 19306 bytes sw/qa/extras/ooxmlimport/data/tdf122717.docx | Bin 0 -> 4940 bytes sw/qa/extras/ooxmlimport/data/tdf123386.docx | Bin 0 -> 14928 bytes sw/qa/extras/ooxmlimport/data/tdf123389.docx | Bin 0 -> 13649 bytes sw/qa/extras/ooxmlimport/data/tdf124398.docx | Bin 0 -> 79734 bytes sw/qa/extras/ooxmlimport/data/tdf124600.docx | Bin 0 -> 15746 bytes sw/qa/extras/ooxmlimport/data/tdf124670.docx | Bin 0 -> 1434 bytes sw/qa/extras/ooxmlimport/data/tdf124754.docx | Bin 0 -> 20960 bytes sw/qa/extras/ooxmlimport/data/tdf125038.docx | Bin 0 -> 12690 bytes sw/qa/extras/ooxmlimport/data/tdf125038b.docx | Bin 0 -> 12649 bytes sw/qa/extras/ooxmlimport/data/tdf125038c.docx | Bin 0 -> 12677 bytes sw/qa/extras/ooxmlimport/data/tdf126114.docx | Bin 0 -> 16877 bytes sw/qa/extras/ooxmlimport/data/tdf126426.docx | Bin 0 -> 15785 bytes sw/qa/extras/ooxmlimport/data/tdf127778.docx | Bin 0 -> 23220 bytes sw/qa/extras/ooxmlimport/data/tdf127825.docx | Bin 0 -> 13297 bytes sw/qa/extras/ooxmlimport/data/tdf128076.docx | Bin 0 -> 18928 bytes sw/qa/extras/ooxmlimport/data/tdf129237.docx | Bin 0 -> 13162 bytes sw/qa/extras/ooxmlimport/data/tdf129659.docx | Bin 0 -> 18584 bytes sw/qa/extras/ooxmlimport/data/tdf129912.docx | Bin 0 -> 19435 bytes sw/qa/extras/ooxmlimport/data/tdf130214.docx | Bin 0 -> 23057 bytes sw/qa/extras/ooxmlimport/data/tdf130804.docx | Bin 0 -> 182772 bytes .../data/tdf131841_HighlightColorGroupedShape.docx | Bin 0 -> 20448 bytes sw/qa/extras/ooxmlimport/data/tdf133448.docx | Bin 0 -> 92038 bytes sw/qa/extras/ooxmlimport/data/tdf133647.docx | Bin 0 -> 14536 bytes .../extras/ooxmlimport/data/tdf133647_unicode.docx | Bin 0 -> 20920 bytes sw/qa/extras/ooxmlimport/data/tdf134572.docx | Bin 0 -> 21846 bytes .../ooxmlimport/data/tdf136952_pgBreak3.docx | Bin 0 -> 5145 bytes .../data/tdf143219_ContourWrap_rotate.docx | Bin 0 -> 19636 bytes .../data/tdf143475_rotatedWord2007image.docx | Bin 0 -> 30338 bytes .../data/tdf143475_rotatedWord2007imageInline.docx | Bin 0 -> 29345 bytes .../data/tdf143476_lockedCanvas_image_line.docx | Bin 0 -> 11649 bytes .../data/tdf143476_lockedCanvas_position.docx | Bin 0 -> 278044 bytes .../data/tdf143476_lockedCanvas_twoShapes.docx | Bin 0 -> 22179 bytes .../data/tdf152200-bad_fldChar_end.docx | Bin 0 -> 10153 bytes sw/qa/extras/ooxmlimport/data/tdf43017.docx | Bin 0 -> 14890 bytes .../data/tdf48658_transparentOLEheader.docx | Bin 0 -> 181161 bytes sw/qa/extras/ooxmlimport/data/tdf60351.docx | Bin 0 -> 26060 bytes .../ooxmlimport/data/tdf74367_MarginsZeroed.docx | Bin 0 -> 12600 bytes .../ooxmlimport/data/tdf75573_lostTable.docx | Bin 0 -> 25590 bytes .../ooxmlimport/data/tdf75573_page1frame.docx | Bin 0 -> 29488 bytes sw/qa/extras/ooxmlimport/data/tdf76446.docx | Bin 0 -> 10135 bytes sw/qa/extras/ooxmlimport/data/tdf82824.docx | Bin 0 -> 24581 bytes sw/qa/extras/ooxmlimport/data/tdf85232.docx | Bin 0 -> 24373 bytes sw/qa/extras/ooxmlimport/data/tdf85523.docx | Bin 0 -> 21015 bytes sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx | Bin 0 -> 13857 bytes sw/qa/extras/ooxmlimport/data/tdf95755.docx | Bin 0 -> 16864 bytes sw/qa/extras/ooxmlimport/data/tdf95970.docx | Bin 0 -> 13092 bytes sw/qa/extras/ooxmlimport/data/tdf96218.docx | Bin 0 -> 41900 bytes sw/qa/extras/ooxmlimport/data/tdf96674.docx | Bin 0 -> 14947 bytes sw/qa/extras/ooxmlimport/data/tdf97038.docx | Bin 0 -> 64161 bytes sw/qa/extras/ooxmlimport/data/tdf98882.docx | Bin 0 -> 18390 bytes sw/qa/extras/ooxmlimport/data/tdf99135.docx | Bin 0 -> 12122 bytes sw/qa/extras/ooxmlimport/data/testfdo90720.docx | Bin 0 -> 11844 bytes sw/qa/extras/ooxmlimport/data/text-copy.docx | Bin 0 -> 16288 bytes .../extras/ooxmlimport/data/textbox-wps-only.docx | Bin 0 -> 13988 bytes .../data/unbalanced-columns-compat.docx | Bin 0 -> 10118 bytes sw/qa/extras/ooxmlimport/data/vml-adjustments.docx | Bin 0 -> 12987 bytes sw/qa/extras/ooxmlimport/data/xml_space.docx | Bin 0 -> 1309 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 1860 ++++++++++++++++++++ sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 954 ++++++++++ 147 files changed, 2814 insertions(+) create mode 100644 sw/qa/extras/ooxmlimport/data/105975.docx create mode 100644 sw/qa/extras/ooxmlimport/data/WordArt.docx create mode 100644 sw/qa/extras/ooxmlimport/data/bnc773061.docx create mode 100644 sw/qa/extras/ooxmlimport/data/bnc779620.docx create mode 100644 sw/qa/extras/ooxmlimport/data/bnc821804.docx create mode 100644 sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx create mode 100644 sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx create mode 100644 sw/qa/extras/ooxmlimport/data/fdo43641.docx create mode 100644 sw/qa/extras/ooxmlimport/data/fdo75722-dml.docx create mode 100644 sw/qa/extras/ooxmlimport/data/fdo75722-vml.docx create mode 100644 sw/qa/extras/ooxmlimport/data/fdo76583.docx create mode 100644 sw/qa/extras/ooxmlimport/data/fdo87488.docx create mode 100644 sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx create mode 100644 sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx create mode 100644 sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx create mode 100644 sw/qa/extras/ooxmlimport/data/groupshape-line.docx create mode 100644 sw/qa/extras/ooxmlimport/data/groupshape-relsize.docx create mode 100644 sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx create mode 100644 sw/qa/extras/ooxmlimport/data/image-hyperlink.docx create mode 100644 sw/qa/extras/ooxmlimport/data/image-lazy-read.docx create mode 100644 sw/qa/extras/ooxmlimport/data/ink.docx create mode 100644 sw/qa/extras/ooxmlimport/data/line-rotation.docx create mode 100644 sw/qa/extras/ooxmlimport/data/line-wps-only.docx create mode 100644 sw/qa/extras/ooxmlimport/data/math-malformed_xml.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n751017.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n751077.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n757890.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n758883.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n760764.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n764745-alignment.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n766477.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n773061.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n775899.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n777345.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n778140.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n779627.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n779627b.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n780645.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n782061.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n820504.docx create mode 100644 sw/qa/extras/ooxmlimport/data/n820788.docx create mode 100644 sw/qa/extras/ooxmlimport/data/numbering-circle.docx create mode 100644 sw/qa/extras/ooxmlimport/data/ole-anchor.docx create mode 100644 sw/qa/extras/ooxmlimport/data/strict-lockedcanvas.docx create mode 100644 sw/qa/extras/ooxmlimport/data/table_width.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf100072.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf100830.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf101626.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf101627.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf103664.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf103931.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf104167.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf105127.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf105143.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf105975.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf106606.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf107784.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf108350.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf108408.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf108714.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf108806.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf108849.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf109053.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf109524.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf111550.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf112443.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf113182.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf113946.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf114212.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf114217.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf115094.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf115094v2.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf115719b.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf115883.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf117843.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf118693.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf119200.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf120547.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf120548.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf120551.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf121203.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf121440.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf121664.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf121804.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf122224.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf122717.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf123386.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf123389.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf124398.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf124600.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf124670.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf124754.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf125038.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf125038b.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf125038c.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf126114.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf126426.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf127778.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf127825.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf128076.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf129237.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf129659.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf129912.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf130214.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf130804.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf131841_HighlightColorGroupedShape.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf133448.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf133647.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf133647_unicode.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf134572.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf143219_ContourWrap_rotate.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007image.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007imageInline.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_image_line.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_position.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_twoShapes.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf152200-bad_fldChar_end.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf43017.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf60351.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf75573_page1frame.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf76446.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf82824.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf85232.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf85523.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf95755.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf95970.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf96218.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf96674.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf97038.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf98882.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf99135.docx create mode 100644 sw/qa/extras/ooxmlimport/data/testfdo90720.docx create mode 100644 sw/qa/extras/ooxmlimport/data/text-copy.docx create mode 100644 sw/qa/extras/ooxmlimport/data/textbox-wps-only.docx create mode 100644 sw/qa/extras/ooxmlimport/data/unbalanced-columns-compat.docx create mode 100644 sw/qa/extras/ooxmlimport/data/vml-adjustments.docx create mode 100644 sw/qa/extras/ooxmlimport/data/xml_space.docx create mode 100644 sw/qa/extras/ooxmlimport/ooxmlimport.cxx create mode 100644 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx (limited to 'sw/qa/extras/ooxmlimport') diff --git a/sw/qa/extras/ooxmlimport/data/105975.docx b/sw/qa/extras/ooxmlimport/data/105975.docx new file mode 100644 index 000000000..b902aa168 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/105975.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/WordArt.docx b/sw/qa/extras/ooxmlimport/data/WordArt.docx new file mode 100644 index 000000000..3960a15aa Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/WordArt.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/bnc773061.docx b/sw/qa/extras/ooxmlimport/data/bnc773061.docx new file mode 100644 index 000000000..6a7baf6c6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc773061.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/bnc779620.docx b/sw/qa/extras/ooxmlimport/data/bnc779620.docx new file mode 100644 index 000000000..23c126d7c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc779620.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/bnc821804.docx b/sw/qa/extras/ooxmlimport/data/bnc821804.docx new file mode 100644 index 000000000..9ec2e0738 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc821804.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx b/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx new file mode 100644 index 000000000..a93703c75 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx b/sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx new file mode 100644 index 000000000..fc0989552 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/fdo43641.docx b/sw/qa/extras/ooxmlimport/data/fdo43641.docx new file mode 100644 index 000000000..90622f817 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo43641.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/fdo75722-dml.docx b/sw/qa/extras/ooxmlimport/data/fdo75722-dml.docx new file mode 100644 index 000000000..ec0b85e49 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo75722-dml.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/fdo75722-vml.docx b/sw/qa/extras/ooxmlimport/data/fdo75722-vml.docx new file mode 100644 index 000000000..72562c824 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo75722-vml.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/fdo76583.docx b/sw/qa/extras/ooxmlimport/data/fdo76583.docx new file mode 100644 index 000000000..9382e295f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo76583.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/fdo87488.docx b/sw/qa/extras/ooxmlimport/data/fdo87488.docx new file mode 100644 index 000000000..2bd51b65f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo87488.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx new file mode 100644 index 000000000..50bb7accb Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/floating-table-section-columns.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx b/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx new file mode 100644 index 000000000..d401c1817 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx b/sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx new file mode 100644 index 000000000..025f737e0 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-fontname.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-line.docx b/sw/qa/extras/ooxmlimport/data/groupshape-line.docx new file mode 100644 index 000000000..5ee2dca88 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-line.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-relsize.docx b/sw/qa/extras/ooxmlimport/data/groupshape-relsize.docx new file mode 100644 index 000000000..5aca9585e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-relsize.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx b/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx new file mode 100644 index 000000000..072984779 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx b/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx new file mode 100644 index 000000000..ab0b53bb2 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/image-lazy-read.docx b/sw/qa/extras/ooxmlimport/data/image-lazy-read.docx new file mode 100644 index 000000000..faf80e41d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/image-lazy-read.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/ink.docx b/sw/qa/extras/ooxmlimport/data/ink.docx new file mode 100644 index 000000000..0b953d00e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/ink.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/line-rotation.docx b/sw/qa/extras/ooxmlimport/data/line-rotation.docx new file mode 100644 index 000000000..a2450c0c1 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/line-rotation.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/line-wps-only.docx b/sw/qa/extras/ooxmlimport/data/line-wps-only.docx new file mode 100644 index 000000000..465f4bd6e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/line-wps-only.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/math-malformed_xml.docx b/sw/qa/extras/ooxmlimport/data/math-malformed_xml.docx new file mode 100644 index 000000000..53d64b039 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/math-malformed_xml.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n751017.docx b/sw/qa/extras/ooxmlimport/data/n751017.docx new file mode 100644 index 000000000..cdd81cf84 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n751017.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n751077.docx b/sw/qa/extras/ooxmlimport/data/n751077.docx new file mode 100644 index 000000000..62304e17c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n751077.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n757890.docx b/sw/qa/extras/ooxmlimport/data/n757890.docx new file mode 100644 index 000000000..f70368a94 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n757890.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n758883.docx b/sw/qa/extras/ooxmlimport/data/n758883.docx new file mode 100644 index 000000000..1562496e4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n758883.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n760764.docx b/sw/qa/extras/ooxmlimport/data/n760764.docx new file mode 100644 index 000000000..5e479e2bf Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n760764.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n764745-alignment.docx b/sw/qa/extras/ooxmlimport/data/n764745-alignment.docx new file mode 100644 index 000000000..d29e980e5 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n764745-alignment.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n766477.docx b/sw/qa/extras/ooxmlimport/data/n766477.docx new file mode 100644 index 000000000..a144463b7 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n766477.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n773061.docx b/sw/qa/extras/ooxmlimport/data/n773061.docx new file mode 100644 index 000000000..e0d60019d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n773061.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n775899.docx b/sw/qa/extras/ooxmlimport/data/n775899.docx new file mode 100644 index 000000000..754e3e186 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n775899.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n777345.docx b/sw/qa/extras/ooxmlimport/data/n777345.docx new file mode 100644 index 000000000..7e70b1426 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n777345.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n778140.docx b/sw/qa/extras/ooxmlimport/data/n778140.docx new file mode 100644 index 000000000..5029ffe37 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n778140.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n779627.docx b/sw/qa/extras/ooxmlimport/data/n779627.docx new file mode 100644 index 000000000..0993208fc Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n779627.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n779627b.docx b/sw/qa/extras/ooxmlimport/data/n779627b.docx new file mode 100644 index 000000000..187371520 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n779627b.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n780645.docx b/sw/qa/extras/ooxmlimport/data/n780645.docx new file mode 100644 index 000000000..35ad11f35 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n780645.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n782061.docx b/sw/qa/extras/ooxmlimport/data/n782061.docx new file mode 100644 index 000000000..9d8218be4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n782061.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n820504.docx b/sw/qa/extras/ooxmlimport/data/n820504.docx new file mode 100644 index 000000000..3cc2bfaa2 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n820504.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/n820788.docx b/sw/qa/extras/ooxmlimport/data/n820788.docx new file mode 100644 index 000000000..759c4085d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n820788.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/numbering-circle.docx b/sw/qa/extras/ooxmlimport/data/numbering-circle.docx new file mode 100644 index 000000000..b8c1da3d6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/numbering-circle.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/ole-anchor.docx b/sw/qa/extras/ooxmlimport/data/ole-anchor.docx new file mode 100644 index 000000000..11df2393b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/ole-anchor.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/strict-lockedcanvas.docx b/sw/qa/extras/ooxmlimport/data/strict-lockedcanvas.docx new file mode 100644 index 000000000..d31be7e92 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/strict-lockedcanvas.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/table_width.docx b/sw/qa/extras/ooxmlimport/data/table_width.docx new file mode 100644 index 000000000..02b77c97d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table_width.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf100072.docx b/sw/qa/extras/ooxmlimport/data/tdf100072.docx new file mode 100644 index 000000000..02b885b9a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf100072.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf100830.docx b/sw/qa/extras/ooxmlimport/data/tdf100830.docx new file mode 100644 index 000000000..6c4321790 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf100830.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf101626.docx b/sw/qa/extras/ooxmlimport/data/tdf101626.docx new file mode 100644 index 000000000..8cbf8036d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf101626.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf101627.docx b/sw/qa/extras/ooxmlimport/data/tdf101627.docx new file mode 100644 index 000000000..0a1efd8f4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf101627.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf103664.docx b/sw/qa/extras/ooxmlimport/data/tdf103664.docx new file mode 100644 index 000000000..4d299a66e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf103664.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf103931.docx b/sw/qa/extras/ooxmlimport/data/tdf103931.docx new file mode 100644 index 000000000..094fe1ba9 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf103931.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf104167.docx b/sw/qa/extras/ooxmlimport/data/tdf104167.docx new file mode 100644 index 000000000..3bd881ba0 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf104167.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf105127.docx b/sw/qa/extras/ooxmlimport/data/tdf105127.docx new file mode 100644 index 000000000..3cdfa7fb3 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf105127.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf105143.docx b/sw/qa/extras/ooxmlimport/data/tdf105143.docx new file mode 100644 index 000000000..aa4bf40af Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf105143.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf105975.docx b/sw/qa/extras/ooxmlimport/data/tdf105975.docx new file mode 100644 index 000000000..f9407df88 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf105975.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf106606.docx b/sw/qa/extras/ooxmlimport/data/tdf106606.docx new file mode 100644 index 000000000..cb085d260 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf106606.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf107784.docx b/sw/qa/extras/ooxmlimport/data/tdf107784.docx new file mode 100644 index 000000000..2dc868246 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf107784.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf108350.docx b/sw/qa/extras/ooxmlimport/data/tdf108350.docx new file mode 100644 index 000000000..b62b3e127 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108350.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf108408.docx b/sw/qa/extras/ooxmlimport/data/tdf108408.docx new file mode 100644 index 000000000..dcd1ecf8b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108408.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx b/sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx new file mode 100644 index 000000000..2e5429ce7 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108545_embeddedDocxIcon.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf108714.docx b/sw/qa/extras/ooxmlimport/data/tdf108714.docx new file mode 100644 index 000000000..69c454796 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108714.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf108806.docx b/sw/qa/extras/ooxmlimport/data/tdf108806.docx new file mode 100644 index 000000000..007b10ae6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108806.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf108849.docx b/sw/qa/extras/ooxmlimport/data/tdf108849.docx new file mode 100644 index 000000000..6f3664374 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108849.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf109053.docx b/sw/qa/extras/ooxmlimport/data/tdf109053.docx new file mode 100644 index 000000000..f700c4d6a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf109053.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx b/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx new file mode 100644 index 000000000..207c789a2 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf109524.docx b/sw/qa/extras/ooxmlimport/data/tdf109524.docx new file mode 100644 index 000000000..534245b8f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf109524.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf111550.docx b/sw/qa/extras/ooxmlimport/data/tdf111550.docx new file mode 100644 index 000000000..6e13df351 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf111550.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf112443.docx b/sw/qa/extras/ooxmlimport/data/tdf112443.docx new file mode 100644 index 000000000..385ce514c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf112443.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf113182.docx b/sw/qa/extras/ooxmlimport/data/tdf113182.docx new file mode 100644 index 000000000..9f35ec3d4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113182.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf113946.docx b/sw/qa/extras/ooxmlimport/data/tdf113946.docx new file mode 100644 index 000000000..060df76ec Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113946.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf114212.docx b/sw/qa/extras/ooxmlimport/data/tdf114212.docx new file mode 100644 index 000000000..c8985c918 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf114212.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf114217.docx b/sw/qa/extras/ooxmlimport/data/tdf114217.docx new file mode 100644 index 000000000..49f1ce164 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf114217.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf115094.docx b/sw/qa/extras/ooxmlimport/data/tdf115094.docx new file mode 100644 index 000000000..38d84d88e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115094.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf115094v2.docx b/sw/qa/extras/ooxmlimport/data/tdf115094v2.docx new file mode 100644 index 000000000..49a7c9194 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115094v2.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx new file mode 100644 index 000000000..7d91108bc Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf115883.docx b/sw/qa/extras/ooxmlimport/data/tdf115883.docx new file mode 100644 index 000000000..f90ac638d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115883.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf117843.docx b/sw/qa/extras/ooxmlimport/data/tdf117843.docx new file mode 100644 index 000000000..501e85bfe Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf117843.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf118693.docx b/sw/qa/extras/ooxmlimport/data/tdf118693.docx new file mode 100644 index 000000000..4e832398b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf118693.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx b/sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx new file mode 100644 index 000000000..c0cda280d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf119200.docx b/sw/qa/extras/ooxmlimport/data/tdf119200.docx new file mode 100644 index 000000000..eafe186fd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf119200.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf120547.docx b/sw/qa/extras/ooxmlimport/data/tdf120547.docx new file mode 100644 index 000000000..9d3cf3072 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf120547.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf120548.docx b/sw/qa/extras/ooxmlimport/data/tdf120548.docx new file mode 100644 index 000000000..60943645e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf120548.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf120551.docx b/sw/qa/extras/ooxmlimport/data/tdf120551.docx new file mode 100644 index 000000000..0fc0057c4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf120551.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf121203.docx b/sw/qa/extras/ooxmlimport/data/tdf121203.docx new file mode 100644 index 000000000..5aa3b2ed7 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf121203.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf121440.docx b/sw/qa/extras/ooxmlimport/data/tdf121440.docx new file mode 100644 index 000000000..023599aec Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf121440.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf121664.docx b/sw/qa/extras/ooxmlimport/data/tdf121664.docx new file mode 100644 index 000000000..7ba8e86b5 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf121664.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf121804.docx b/sw/qa/extras/ooxmlimport/data/tdf121804.docx new file mode 100644 index 000000000..af3f0d247 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf121804.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf122224.docx b/sw/qa/extras/ooxmlimport/data/tdf122224.docx new file mode 100644 index 000000000..14518403c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf122224.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf122717.docx b/sw/qa/extras/ooxmlimport/data/tdf122717.docx new file mode 100644 index 000000000..9a2098272 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf122717.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf123386.docx b/sw/qa/extras/ooxmlimport/data/tdf123386.docx new file mode 100644 index 000000000..1278068dd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf123386.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf123389.docx b/sw/qa/extras/ooxmlimport/data/tdf123389.docx new file mode 100644 index 000000000..4245464b8 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf123389.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf124398.docx b/sw/qa/extras/ooxmlimport/data/tdf124398.docx new file mode 100644 index 000000000..4d1855347 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124398.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf124600.docx b/sw/qa/extras/ooxmlimport/data/tdf124600.docx new file mode 100644 index 000000000..16c4ceb2b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124600.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf124670.docx b/sw/qa/extras/ooxmlimport/data/tdf124670.docx new file mode 100644 index 000000000..d804efa5a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124670.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf124754.docx b/sw/qa/extras/ooxmlimport/data/tdf124754.docx new file mode 100644 index 000000000..2f7f4e14b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124754.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf125038.docx b/sw/qa/extras/ooxmlimport/data/tdf125038.docx new file mode 100644 index 000000000..b4dd622f9 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf125038.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf125038b.docx b/sw/qa/extras/ooxmlimport/data/tdf125038b.docx new file mode 100644 index 000000000..3aa189dad Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf125038b.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf125038c.docx b/sw/qa/extras/ooxmlimport/data/tdf125038c.docx new file mode 100644 index 000000000..10234b864 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf125038c.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf126114.docx b/sw/qa/extras/ooxmlimport/data/tdf126114.docx new file mode 100644 index 000000000..33e039568 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf126114.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf126426.docx b/sw/qa/extras/ooxmlimport/data/tdf126426.docx new file mode 100644 index 000000000..d77051365 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf126426.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf127778.docx b/sw/qa/extras/ooxmlimport/data/tdf127778.docx new file mode 100644 index 000000000..a706d5757 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf127778.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf127825.docx b/sw/qa/extras/ooxmlimport/data/tdf127825.docx new file mode 100644 index 000000000..2caf612fd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf127825.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf128076.docx b/sw/qa/extras/ooxmlimport/data/tdf128076.docx new file mode 100644 index 000000000..69490a145 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf128076.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf129237.docx b/sw/qa/extras/ooxmlimport/data/tdf129237.docx new file mode 100644 index 000000000..cb3f4d298 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129237.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf129659.docx b/sw/qa/extras/ooxmlimport/data/tdf129659.docx new file mode 100644 index 000000000..38bd040d5 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129659.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf129912.docx b/sw/qa/extras/ooxmlimport/data/tdf129912.docx new file mode 100644 index 000000000..d87255ffd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129912.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf130214.docx b/sw/qa/extras/ooxmlimport/data/tdf130214.docx new file mode 100644 index 000000000..4344e1c6e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf130214.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf130804.docx b/sw/qa/extras/ooxmlimport/data/tdf130804.docx new file mode 100644 index 000000000..401f23de8 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf130804.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf131841_HighlightColorGroupedShape.docx b/sw/qa/extras/ooxmlimport/data/tdf131841_HighlightColorGroupedShape.docx new file mode 100644 index 000000000..2fa41570a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf131841_HighlightColorGroupedShape.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf133448.docx b/sw/qa/extras/ooxmlimport/data/tdf133448.docx new file mode 100644 index 000000000..d9e3af068 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf133448.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf133647.docx b/sw/qa/extras/ooxmlimport/data/tdf133647.docx new file mode 100644 index 000000000..fb525446c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf133647.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf133647_unicode.docx b/sw/qa/extras/ooxmlimport/data/tdf133647_unicode.docx new file mode 100644 index 000000000..d5749f89d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf133647_unicode.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf134572.docx b/sw/qa/extras/ooxmlimport/data/tdf134572.docx new file mode 100644 index 000000000..7ab509b5f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf134572.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx b/sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx new file mode 100644 index 000000000..3f3c1d37d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf143219_ContourWrap_rotate.docx b/sw/qa/extras/ooxmlimport/data/tdf143219_ContourWrap_rotate.docx new file mode 100644 index 000000000..8922882df Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf143219_ContourWrap_rotate.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007image.docx b/sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007image.docx new file mode 100644 index 000000000..48506f4ec Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007image.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007imageInline.docx b/sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007imageInline.docx new file mode 100644 index 000000000..42c489425 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf143475_rotatedWord2007imageInline.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_image_line.docx b/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_image_line.docx new file mode 100644 index 000000000..9a5c87e34 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_image_line.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_position.docx b/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_position.docx new file mode 100644 index 000000000..a63615a31 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_position.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_twoShapes.docx b/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_twoShapes.docx new file mode 100644 index 000000000..6e654f3d3 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf143476_lockedCanvas_twoShapes.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf152200-bad_fldChar_end.docx b/sw/qa/extras/ooxmlimport/data/tdf152200-bad_fldChar_end.docx new file mode 100644 index 000000000..7f77c8d66 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf152200-bad_fldChar_end.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf43017.docx b/sw/qa/extras/ooxmlimport/data/tdf43017.docx new file mode 100644 index 000000000..c3372e11a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf43017.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx b/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx new file mode 100644 index 000000000..5b6649c37 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf60351.docx b/sw/qa/extras/ooxmlimport/data/tdf60351.docx new file mode 100644 index 000000000..b61294dfd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf60351.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx b/sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx new file mode 100644 index 000000000..9b9eb1c43 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx b/sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx new file mode 100644 index 000000000..8ddb6619e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf75573_lostTable.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf75573_page1frame.docx b/sw/qa/extras/ooxmlimport/data/tdf75573_page1frame.docx new file mode 100644 index 000000000..d6bc29d36 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf75573_page1frame.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf76446.docx b/sw/qa/extras/ooxmlimport/data/tdf76446.docx new file mode 100644 index 000000000..7ba6db35f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf76446.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf82824.docx b/sw/qa/extras/ooxmlimport/data/tdf82824.docx new file mode 100644 index 000000000..65e5d4bc6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf82824.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf85232.docx b/sw/qa/extras/ooxmlimport/data/tdf85232.docx new file mode 100644 index 000000000..35e8a8881 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf85232.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf85523.docx b/sw/qa/extras/ooxmlimport/data/tdf85523.docx new file mode 100644 index 000000000..cd31ae43e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf85523.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx b/sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx new file mode 100644 index 000000000..11e6511ca Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf95755.docx b/sw/qa/extras/ooxmlimport/data/tdf95755.docx new file mode 100644 index 000000000..194c43199 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf95755.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf95970.docx b/sw/qa/extras/ooxmlimport/data/tdf95970.docx new file mode 100644 index 000000000..501ef361a Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf95970.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf96218.docx b/sw/qa/extras/ooxmlimport/data/tdf96218.docx new file mode 100644 index 000000000..a6a269f82 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf96218.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf96674.docx b/sw/qa/extras/ooxmlimport/data/tdf96674.docx new file mode 100644 index 000000000..752479c2e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf96674.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf97038.docx b/sw/qa/extras/ooxmlimport/data/tdf97038.docx new file mode 100644 index 000000000..8295d5199 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf97038.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf98882.docx b/sw/qa/extras/ooxmlimport/data/tdf98882.docx new file mode 100644 index 000000000..53c1098dc Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf98882.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf99135.docx b/sw/qa/extras/ooxmlimport/data/tdf99135.docx new file mode 100644 index 000000000..7ac383692 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf99135.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/testfdo90720.docx b/sw/qa/extras/ooxmlimport/data/testfdo90720.docx new file mode 100644 index 000000000..a4e8ba945 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/testfdo90720.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/text-copy.docx b/sw/qa/extras/ooxmlimport/data/text-copy.docx new file mode 100644 index 000000000..03c0563b3 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/text-copy.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/textbox-wps-only.docx b/sw/qa/extras/ooxmlimport/data/textbox-wps-only.docx new file mode 100644 index 000000000..b2fd2654c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/textbox-wps-only.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/unbalanced-columns-compat.docx b/sw/qa/extras/ooxmlimport/data/unbalanced-columns-compat.docx new file mode 100644 index 000000000..da980c81d Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/unbalanced-columns-compat.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/vml-adjustments.docx b/sw/qa/extras/ooxmlimport/data/vml-adjustments.docx new file mode 100644 index 000000000..eac08e966 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/vml-adjustments.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/xml_space.docx b/sw/qa/extras/ooxmlimport/data/xml_space.docx new file mode 100644 index 000000000..305c135fd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/xml_space.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx new file mode 100644 index 000000000..6e22f8b9c --- /dev/null +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -0,0 +1,1860 @@ +/* -*- 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 + +#ifdef MACOSX +#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#include +#include +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlimport/data/"; + +class Test : public SwModelTestBase +{ +public: + Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") + { + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testImageHyperlink) +{ + load(mpTestDocumentPath, "image-hyperlink.docx"); + OUString URL = getProperty(getShape(1), "HyperLinkURL"); + CPPUNIT_ASSERT_EQUAL(OUString("http://www.libreoffice.org/"), URL); +} + +CPPUNIT_TEST_FIXTURE(Test, testMathMalformedXml) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "math-malformed_xml.docx"; + mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, {}); + CPPUNIT_ASSERT(!mxComponent.is()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf103931) +{ + load(mpTestDocumentPath, "tdf103931.docx"); + uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + // This was 2, the last (empty) section of the document was lost on import. + // (import test only: Columns/Sections do not round-trip well) + CPPUNIT_ASSERT_EQUAL(static_cast(3), xTextSections->getCount()); +} + +CPPUNIT_TEST_FIXTURE(Test, testN751017) +{ + load(mpTestDocumentPath, "n751017.docx"); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xMasters(xTextFieldsSupplier->getTextFieldMasters()); + // Make sure we have a variable named foo. + CPPUNIT_ASSERT(xMasters->hasByName("com.sun.star.text.FieldMaster.SetExpression.foo")); + + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + bool bFoundSet(false), bFoundGet(false); + while (xFields->hasMoreElements()) + { + uno::Reference xServiceInfo(xFields->nextElement(), uno::UNO_QUERY); + uno::Reference xPropertySet(xServiceInfo, uno::UNO_QUERY); + sal_Int16 nValue = 0; + OUString aValue; + if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression")) + { + bFoundSet = true; + uno::Reference xDependentTextField(xServiceInfo, uno::UNO_QUERY); + uno::Reference xMasterProps(xDependentTextField->getTextFieldMaster()); + + // First step: did we set foo to "bar"? + xMasterProps->getPropertyValue("Name") >>= aValue; + CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue); + xPropertySet->getPropertyValue("SubType") >>= nValue; + CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue); + xPropertySet->getPropertyValue("Content") >>= aValue; + CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue); + } + else if (xServiceInfo->supportsService("com.sun.star.text.TextField.GetExpression")) + { + // Second step: check the value of foo. + bFoundGet = true; + xPropertySet->getPropertyValue("Content") >>= aValue; + CPPUNIT_ASSERT_EQUAL(OUString("foo"), aValue); + xPropertySet->getPropertyValue("SubType") >>= nValue; + CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue); + xPropertySet->getPropertyValue("CurrentPresentation") >>= aValue; + CPPUNIT_ASSERT_EQUAL(OUString("bar"), aValue); + } + } + CPPUNIT_ASSERT(bFoundSet); + CPPUNIT_ASSERT(bFoundGet); +} + +CPPUNIT_TEST_FIXTURE(Test, testN757890) +{ + load(mpTestDocumentPath, "n757890.docx"); + // The w:pStyle token affected the text outside the textbox. + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + OUString aValue; + xPara->getPropertyValue("ParaStyleName") >>= aValue; + CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aValue); + + // This wasn't centered + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + sal_Int16 nValue; + xFrame->getPropertyValue("HoriOrient") >>= nValue; + CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, nValue); +} + +CPPUNIT_TEST_FIXTURE(Test, testN751077) +{ + load(mpTestDocumentPath, "n751077.docx"); +/* +xray ThisComponent.DrawPage(1).getByIndex(0).String +xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName +*/ + uno::Reference xShapes(getShape(2), uno::UNO_QUERY); + uno::Reference xShape(xShapes->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("TEXT1\n"), xShape->getString()); + // we want to test the textbox is on the first page (it was put onto another page without the fix), + // use a small trick and instead of checking the page layout, check the page style + uno::Reference xTextContent(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty(xTextContent->getAnchor(), "PageStyleName")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf129237) +{ + load(mpTestDocumentPath, "tdf129237.docx"); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess1->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("title new"), xEnumerationAccess1->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess2->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("MoM is supreme"), xEnumerationAccess2->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess3->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("MY PATNA IS BEST IN THE WORLD"), xEnumerationAccess3->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess4(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess4->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("Title New"), xEnumerationAccess4->getPresentation(false).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf134572) +{ + load(mpTestDocumentPath, "tdf134572.docx"); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + // Without the fix in place, this test would have failed with + // - Expected: RK - Risk / EH&S + // - Actual : [Responsible Office] + uno::Reference xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("RK - Risk / EH&S"), xEnumerationAccess1->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + // - Expected: Choose an item. + // - Actual : A.M. + uno::Reference xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Choose an item."), xEnumerationAccess2->getPresentation(false).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf128076) +{ + load(mpTestDocumentPath, "tdf128076.docx"); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("User Field adres = Test"), xEnumerationAccess->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("Test"), xEnumerationAccess->getPresentation(false).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testfdo90720) +{ + load(mpTestDocumentPath, "testfdo90720.docx"); + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + uno::Reference textbox(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + uno::Reference properties(textbox, uno::UNO_QUERY); + sal_Int32 fill_transperence; + properties->getPropertyValue( "FillTransparence" ) >>= fill_transperence; + CPPUNIT_ASSERT_EQUAL( sal_Int32(100), fill_transperence ); +} + +CPPUNIT_TEST_FIXTURE(Test, testN760764) +{ + load(mpTestDocumentPath, "n760764.docx"); + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum(xParaEnumAccess->createEnumeration()); + uno::Reference xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference xRunEnum(xRunEnumAccess->createEnumeration()); + + // Access the second run, which is a textfield + xRunEnum->nextElement(); + uno::Reference xRun(xRunEnum->nextElement(), uno::UNO_QUERY); + float fValue; + xRun->getPropertyValue("CharHeight") >>= fValue; + // This used to be 11, as character properties were ignored. + CPPUNIT_ASSERT_EQUAL(8.f, fValue); +} + +CPPUNIT_TEST_FIXTURE(Test, testN764745) +{ + load(mpTestDocumentPath, "n764745-alignment.docx"); +/* +shape = ThisComponent.DrawPage.getByIndex(0) +xray shape.AnchorType +xray shape.AnchorPosition.X +xray ThisComponent.StyleFamilies.PageStyles.Default.Width +*/ + uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY); + // The paragraph is right-aligned and the picture does not explicitly specify position, + // so check it's anchored as character and in the right side of the document. + text::TextContentAnchorType anchorType; + xPropertySet->getPropertyValue("AnchorType") >>= anchorType; + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, anchorType); + awt::Point pos; + xPropertySet->getPropertyValue("AnchorPosition") >>= pos; + uno::Reference styleFamiliesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference styleFamilies = styleFamiliesSupplier->getStyleFamilies(); + uno::Reference pageStyles; + styleFamilies->getByName("PageStyles") >>= pageStyles; + uno::Reference defaultStyle; + pageStyles->getByName("Standard") >>= defaultStyle; + uno::Reference styleProperties( defaultStyle, uno::UNO_QUERY ); + sal_Int32 width = 0; + styleProperties->getPropertyValue( "Width" ) >>= width; + CPPUNIT_ASSERT( pos.X > width / 2 ); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf115719b) +{ + load(mpTestDocumentPath, "tdf115719b.docx"); + // This was 0, 4th (last) paragraph had no increased spacing. + CPPUNIT_ASSERT(getProperty(getParagraph(4), "ParaTopMargin") > 0); +} + +CPPUNIT_TEST_FIXTURE(Test, testN766477) +{ + load(mpTestDocumentPath, "n766477.docx"); + /* + * The problem was that the checkbox was not checked. + * + * oParas = ThisComponent.Text.createEnumeration + * oPara = oParas.nextElement + * oRuns = oPara.createEnumeration + * oRun = oRuns.nextElement + * xray oRun.Bookmark.Parameters.ElementNames(0) 'Checkbox_Checked + */ + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum(xParaEnumAccess->createEnumeration()); + uno::Reference xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference xRunEnum(xRunEnumAccess->createEnumeration()); + uno::Reference xRun(xRunEnum->nextElement(), uno::UNO_QUERY); + uno::Reference xFormField(xRun->getPropertyValue("Bookmark"), uno::UNO_QUERY); + uno::Reference xParameters(xFormField->getParameters()); + uno::Sequence aElementNames(xParameters->getElementNames()); + CPPUNIT_ASSERT_EQUAL(OUString("Checkbox_Checked"), aElementNames[0]); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf130804) +{ + load(mpTestDocumentPath, "tdf130804.docx"); + OUString flyHeight = parseDump("/root/page/body/txt[1]/infos/bounds", "height"); + OUString txtHeight = parseDump("/root/page/body/txt[1]/anchored/fly/infos/bounds", "height"); + + //Without the fix in place, txtHeight would have been flyHeight + 55 + CPPUNIT_ASSERT_EQUAL(flyHeight, txtHeight); + + // Also check the bookmark portion is ignored in the next paragraph + OUString aTop = parseDump("/root/page/body/txt[2]/infos/prtBounds", "top"); + CPPUNIT_ASSERT_EQUAL(OUString("240"), aTop); +} + +CPPUNIT_TEST_FIXTURE(Test, testN758883) +{ + load(mpTestDocumentPath, "n758883.docx"); + /* + * The problem was that direct formatting of the paragraph was not applied + * to the numbering. This is easier to test using a layout dump. + */ + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt/Special[1]", "nHeight", "220"); + + // check the bookmark portions are of the expected height + assertXPath(pXmlDoc, "/root/page/body/txt/Special[2]", "nType", "PortionType::Bookmark"); + assertXPath(pXmlDoc, "/root/page/body/txt/Special[2]", "nHeight", "253"); + assertXPath(pXmlDoc, "/root/page/body/txt/Special[3]", "nType", "PortionType::Bookmark"); + assertXPath(pXmlDoc, "/root/page/body/txt/Special[3]", "nHeight", "253"); + + /* + * Next problem was that the page margin contained the width of the page border as well. + * + * xray ThisComponent.StyleFamilies.PageStyles.Default.LeftMargin + */ + uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + sal_Int32 nValue = 0; + xPropertySet->getPropertyValue("LeftMargin") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(847), nValue); + + // No assert for the 3rd problem: see the comment in the test doc. + + /* + * 4th problem: Wrap type of the textwrape was not 'through'. + * + * xray ThisComponent.DrawPage(0).Surround ' was 2, should be 1 + */ + xPropertySet.set(getShape(1), uno::UNO_QUERY); + text::WrapTextMode eValue; + xPropertySet->getPropertyValue("Surround") >>= eValue; + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, eValue); + + /* + * 5th problem: anchor type of the second textbox was wrong. + * + * xray ThisComponent.DrawPage(1).AnchorType ' was 1, should be 4 + */ + xPropertySet.set(getShape(2), uno::UNO_QUERY); + text::TextContentAnchorType eAnchorType; + xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType; + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType); + + // 6th problem: xray ThisComponent.DrawPage(2).AnchorType ' was 2, should be 4 + xPropertySet.set(getShape(3), uno::UNO_QUERY); + xPropertySet->getPropertyValue("AnchorType") >>= eAnchorType; + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf74367_MarginsZeroed) +{ + load(mpTestDocumentPath, "tdf74367_MarginsZeroed.docx"); + // Do not import page borders with 'None' style, or else it will change the page margins. + uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + sal_Int32 nValue = 0; + xPropertySet->getPropertyValue("TopMargin") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue); + xPropertySet->getPropertyValue("RightMargin") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue); + xPropertySet->getPropertyValue("BottomMargin") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue); + xPropertySet->getPropertyValue("LeftMargin") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue); +} + +CPPUNIT_TEST_FIXTURE(Test, testBnc773061) +{ + load(mpTestDocumentPath, "bnc773061.docx"); + uno::Reference< text::XTextRange > paragraph = getParagraph( 1 ); + uno::Reference< text::XTextRange > normal = getRun( paragraph, 1, "Normal " ); + uno::Reference< text::XTextRange > raised = getRun( paragraph, 2, "Raised" ); + uno::Reference< text::XTextRange > lowered = getRun( paragraph, 4, "Lowered" ); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( normal, "CharEscapement" )); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 50 ), getProperty< sal_Int32 >( raised, "CharEscapement" )); + CPPUNIT_ASSERT_EQUAL( sal_Int32( -25 ), getProperty< sal_Int32 >( lowered, "CharEscapement" )); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( normal, "CharEscapementHeight" )); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( raised, "CharEscapementHeight" )); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 100 ), getProperty< sal_Int32 >( lowered, "CharEscapementHeight" )); +} + +CPPUNIT_TEST_FIXTURE(Test, testN775899) +{ + load(mpTestDocumentPath, "n775899.docx"); + /* + * The problem was that a floating table wasn't imported as a frame, then it contained fake paragraphs. + * + * ThisComponent.TextFrames.Count ' was 0 + * oParas = ThisComponent.TextFrames(0).Text.createEnumeration + * oPara = oParas.nextElement + * oPara.supportsService("com.sun.star.text.TextTable") 'was a fake paragraph + * oParas.hasMoreElements 'was true + */ + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xFrame->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference xServiceInfo(xParaEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_True, xServiceInfo->supportsService("com.sun.star.text.TextTable")); + + CPPUNIT_ASSERT_EQUAL(sal_False, xParaEnum->hasMoreElements()); +} + +CPPUNIT_TEST_FIXTURE(Test, testN777345) +{ + load(mpTestDocumentPath, "n777345.docx"); + // The problem was that v:imagedata inside v:rect was ignored. + uno::Reference xSupplier(getShape(1), uno::UNO_QUERY); + uno::Reference xGraphic = xSupplier->getReplacementGraphic(); + Graphic aGraphic(xGraphic); + BitmapEx aBitmap = aGraphic.GetBitmapEx(); + CPPUNIT_ASSERT_EQUAL( Size( 17, 16 ), aBitmap.GetSizePixel()); + CPPUNIT_ASSERT_EQUAL( COL_BLACK, aBitmap.GetPixelColor( 0, 0 )); + CPPUNIT_ASSERT_EQUAL( COL_BLACK, aBitmap.GetPixelColor( 16, 15 )); + CPPUNIT_ASSERT_EQUAL( Color( 153, 0, 0 ), aBitmap.GetPixelColor( 16, 0 )); + CPPUNIT_ASSERT_EQUAL( Color( 153, 0, 0 ), aBitmap.GetPixelColor( 0, 15 )); +} + +CPPUNIT_TEST_FIXTURE(Test, testN778140) +{ + load(mpTestDocumentPath, "n778140.docx"); + /* + * The problem was that the paragraph top/bottom margins were incorrect due + * to unhandled w:doNotUseHTMLParagraphAutoSpacing. + */ + CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty(getParagraph(1), "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(176), getProperty(getParagraph(1), "ParaBottomMargin")); +} + +CPPUNIT_TEST_FIXTURE(Test, testInk) +{ + load(mpTestDocumentPath, "ink.docx"); + /* + * The problem was that ~nothing was imported, except an empty CustomShape. + * + * xray ThisComponent.DrawPage(0).supportsService("com.sun.star.drawing.OpenBezierShape") + */ + uno::Reference xServiceInfo(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.OpenBezierShape")); +} + +CPPUNIT_TEST_FIXTURE(Test, testN779627) +{ + load(mpTestDocumentPath, "n779627.docx"); + /* + * The problem was that the table left position was based on the tableCellMar left value + * even for nested tables, while it shouldn't. + */ + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + uno::Reference xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Any aValue = xTableProperties->getPropertyValue("LeftMargin"); + sal_Int32 nLeftMargin; + aValue >>= nLeftMargin; + // only border width considered. + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Left margin shouldn't take tableCellMar into account in nested tables", + sal_Int32(9), nLeftMargin); + + /* + * Another problem tested with this document is the loading of the shapes + * anchored to a hidden header or footer + */ + CPPUNIT_ASSERT_EQUAL(2, getShapes()); +} + +CPPUNIT_TEST_FIXTURE(Test, testN779627b) +{ + load(mpTestDocumentPath, "n779627b.docx"); + /* + * Another problem tested with the original n779627.docx document (before removing its unnecessary + * shape loading) is that the roundrect is centered vertically and horizontally. + */ + uno::Reference xShapeProperties( getShape(1), uno::UNO_QUERY ); + uno::Reference xShapeDescriptor(xShapeProperties, uno::UNO_QUERY); + // If this goes wrong, probably the index of the shape is changed and the test should be adjusted. + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.RectangleShape"), xShapeDescriptor->getShapeType()); + sal_Int16 nValue; + xShapeProperties->getPropertyValue("HoriOrient") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally", text::HoriOrientation::CENTER, nValue); + xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to page", text::RelOrientation::PAGE_FRAME, nValue); + xShapeProperties->getPropertyValue("VertOrient") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically", text::VertOrientation::CENTER, nValue); + xShapeProperties->getPropertyValue("VertOrientRelation") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered vertically relatively to page", text::RelOrientation::PAGE_FRAME, nValue); +} + +CPPUNIT_TEST_FIXTURE(Test, testN782061) +{ + load(mpTestDocumentPath, "n782061.docx"); + /* + * The problem was that the character escapement in the second run was -58. + */ + CPPUNIT_ASSERT_EQUAL(sal_Int32(-9), getProperty(getRun(getParagraph(1), 2), "CharEscapement")); +} + +CPPUNIT_TEST_FIXTURE(Test, testN773061) +{ + load(mpTestDocumentPath, "n773061.docx"); +// xray ThisComponent.TextFrames(0).LeftBorderDistance + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( xFrame, "LeftBorderDistance" ) ); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( xFrame, "TopBorderDistance" ) ); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( xFrame, "RightBorderDistance" ) ); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), getProperty< sal_Int32 >( xFrame, "BottomBorderDistance" ) ); +} + +CPPUNIT_TEST_FIXTURE(Test, testN780645) +{ + load(mpTestDocumentPath, "n780645.docx"); + // The problem was that when the number of cells didn't match the grid, we + // didn't take care of direct cell widths. + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference xTableRows = xTextTable->getRows(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(2135), getProperty< uno::Sequence >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); // was 1999 +} + +CPPUNIT_TEST_FIXTURE(Test, testWordArtResizing) +{ + load(mpTestDocumentPath, "WordArt.docx"); + /* The Word-Arts and watermarks were getting resized automatically, It was as if they were + getting glued to the fallback geometry(the sdrObj) and were getting bound to the font size. + The test-case ensures the original height and width of the word-art is not changed while importing*/ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + uno::Reference xShape(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(10105), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4755), xShape->getSize().Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testGroupshapeLine) +{ + load(mpTestDocumentPath, "groupshape-line.docx"); + /* + * Another fallout from n#792778, this time first the lines inside a + * groupshape wasn't imported, then the fix broke the size/position of + * non-groupshape lines. Test both here. + * + * xray ThisComponent.DrawPage.Count ' 2 shapes + * xray ThisComponent.DrawPage(0).Position 'x: 2656, y: 339 + * xray ThisComponent.DrawPage(0).Size ' width: 3270, height: 1392 + * xray ThisComponent.DrawPage(1).getByIndex(0).Position 'x: 1272, y: 2286 + * xray ThisComponent.DrawPage(1).getByIndex(0).Size 'width: 10160, height: 0 + */ + CPPUNIT_ASSERT_EQUAL(2, getShapes()); + + uno::Reference xShape(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2656), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(339), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3270), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1392), xShape->getSize().Height); + + uno::Reference xGroupShape(getShape(2), uno::UNO_QUERY); + xShape.set(xGroupShape->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1272), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2286), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(10160), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getSize().Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testGroupshapeChildRotation) +{ + load(mpTestDocumentPath, "groupshape-child-rotation.docx"); + // The problem was that (due to incorrect handling of rotation inside + // groupshapes), the first child wasn't in the top left corner of an inline + // groupshape. + uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY); + uno::Reference xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-5741), xShape->getPosition().Y); + +#if HAVE_MORE_FONTS + xShape.set(xGroupShape->getByIndex(4), uno::UNO_QUERY); + // This was true, a VML textbox without had + // auto-grow on. + CPPUNIT_ASSERT(!getProperty(xShape, "TextAutoGrowHeight")); + // Paragraph Style Normal should provide the font name - which slightly affects the shape's height (was 686) + uno::Reference xText = uno::Reference(xShape, uno::UNO_QUERY_THROW)->getText(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Font", OUString("Times New Roman"), getProperty(getRun(xText, 1), "CharFontName")); +#endif + + uno::Reference xShapeDescriptor(xGroupShape->getByIndex(5), uno::UNO_QUERY); + // This was com.sun.star.drawing.RectangleShape, all shape text in a single line. + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.TextShape"), xShapeDescriptor->getShapeType()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTableWidth) +{ + load(mpTestDocumentPath, "table_width.docx"); + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + // Relative width wasn't recognized during import. + CPPUNIT_ASSERT_EQUAL(true, getProperty(xTables->getByIndex(0), "IsWidthRelative")); + + uno::Reference xFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFrames(xFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty(xFrames->getByIndex(0), "FrameWidthPercent")); +} + +CPPUNIT_TEST_FIXTURE(Test, testN820788) +{ + load(mpTestDocumentPath, "n820788.docx"); + // The problem was that AutoSize was not enabled for the text frame. + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + // This was text::SizeType::FIX. + CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty(xFrame, "SizeType")); +} + +CPPUNIT_TEST_FIXTURE(Test, testN820504) +{ + load(mpTestDocumentPath, "n820504.docx"); + uno::Reference xFamiliesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFamiliesAccess = xFamiliesSupplier->getStyleFamilies(); + uno::Reference xStylesAccess(xFamiliesAccess->getByName("ParagraphStyles"), uno::UNO_QUERY); + uno::Reference xStyle(xStylesAccess->getByName("Default Paragraph Style"), uno::UNO_QUERY); + // The problem was that the CharColor was set to AUTO (-1) even if we have some default char color set + CPPUNIT_ASSERT_EQUAL(Color(0x3da7bb), getProperty(xStyle, "CharColor")); + + // Also, the groupshape was anchored at-page instead of at-character + // (that's incorrect as Word only supports at-character and as-character). + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); +} + +CPPUNIT_TEST_FIXTURE(Test, testFdo43641) +{ + load(mpTestDocumentPath, "fdo43641.docx"); + uno::Reference xGroupLockedCanvas(getShape(1), uno::UNO_QUERY); + uno::Reference xGroupShape(xGroupLockedCanvas->getByIndex(0), uno::UNO_QUERY); + uno::Reference xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY); + // This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect. + // File cx=928694EMU = 2579.7Hmm, round up 2580Hmm. Currently off by 1. + CPPUNIT_ASSERT_EQUAL(sal_Int32(2581), xLine->getSize().Width); +} + +CPPUNIT_TEST_FIXTURE(Test, testGroupshapeSdt) +{ + load(mpTestDocumentPath, "groupshape-sdt.docx"); + // All problems here are due to the groupshape: we have a drawinglayer rectangle, not a writer textframe. + uno::Reference xOuterGroupShape(getShape(1), uno::UNO_QUERY); + uno::Reference xInnerGroupShape(xOuterGroupShape->getByIndex(0), uno::UNO_QUERY); + uno::Reference xShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY); + // Border distances were not implemented, this was 0. + CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty(xShape, "TextUpperDistance")); + // Sdt field result wasn't imported, this was "". + CPPUNIT_ASSERT_EQUAL(OUString("placeholder text"), xShape->getString()); + // w:spacing was ignored in oox, this was 0. + CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning")); +} + +static void lcl_countTextFrames(const css::uno::Reference< lang::XComponent >& xComponent, + sal_Int32 nExpected ) +{ + uno::Reference xTextFramesSupplier(xComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( nExpected, xIndexAccess->getCount()); +} + +CPPUNIT_TEST_FIXTURE(Test, testBnc779620) +{ + load(mpTestDocumentPath, "bnc779620.docx"); + // The problem was that the floating table was imported as a non-floating one. + lcl_countTextFrames( mxComponent, 1 ); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf105127) +{ + load(mpTestDocumentPath, "tdf105127.docx"); + auto aPolyPolygon = getProperty(getShape(1), "PolyPolygonBezier"); + // tdf#106792 These values were wrong all the time due to a missing + // conversion in SvxShapePolyPolygon::getPropertyValueImpl. There was no + // ForceMetricTo100th_mm -> the old results were in twips due to the + // object residing in Writer. The UNO API by definition is in 100thmm, + // thus I will correct the value here. + CPPUNIT_ASSERT_EQUAL(static_cast(5719), aPolyPolygon.Coordinates[0][0].Y); // was: 3257 +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf105143) +{ + load(mpTestDocumentPath, "tdf105143.docx"); + OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); + // This was 6272, i.e. the shape was moved up (incorrect position) to be + // inside the page rectangle. + CPPUNIT_ASSERT_EQUAL(OUString("6731"), aTop); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf105975) +{ + load(mpTestDocumentPath, "105975.docx"); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xMasters(xTextFieldsSupplier->getTextFieldMasters()); + // Make sure we have a variable named TEST_VAR. + CPPUNIT_ASSERT(xMasters->hasByName("com.sun.star.text.FieldMaster.SetExpression.TEST_VAR")); +} + +CPPUNIT_TEST_FIXTURE(Test, testfdo76583) +{ + load(mpTestDocumentPath, "fdo76583.docx"); + // The problem was that the floating table was imported as a non-floating one. + // floating tables are imported as text frames, therefore the document should + // exactly 1 text frame. + lcl_countTextFrames( mxComponent, 1 ); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf105975formula) +{ + load(mpTestDocumentPath, "tdf105975.docx"); + // Make sure the field contains a formula with 10 + 15 + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("10+15"), xEnumerationAccess->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("25"), xEnumerationAccess->getPresentation(false).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf133647) +{ + load(mpTestDocumentPath, "tdf133647.docx"); + /* Tests that argument lists, cell references, and cell ranges are translated correctly + * when importing table formulae from MS Word */ + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("SUM(1|2|3)"), xEnumerationAccess1->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("6"), xEnumerationAccess1->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("sum(|)"), xEnumerationAccess2->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("3"), xEnumerationAccess2->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("(SUM(|5)*(2+7))*(3+SUM(1|))"), xEnumerationAccess3->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("432"), xEnumerationAccess3->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess4(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1+(SUM(1|2))"), xEnumerationAccess4->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("4"), xEnumerationAccess4->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess5(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("3*(2+SUM()+7)"), xEnumerationAccess5->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("45"), xEnumerationAccess5->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess6(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("(1+2)*SUM(|)"), xEnumerationAccess6->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("21"), xEnumerationAccess6->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess7(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("SUM(|5||6)"), xEnumerationAccess7->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("17"), xEnumerationAccess7->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess8(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("SUM()"), xEnumerationAccess8->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("7"), xEnumerationAccess8->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess9(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("SUM(|)"), xEnumerationAccess9->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("3"), xEnumerationAccess9->getPresentation(false).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf123386) +{ + load(mpTestDocumentPath, "tdf123386.docx"); + /* Tests that argument lists, cell references, and cell ranges are translated correctly + * when importing table formulae from MS Word */ + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(" L 2"), xEnumerationAccess1->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess1->getPresentation(false).trim()); + + /* Ensures non-cell references passed to DEFINED() are preserved. + * Doesn't test the display string because LO doesn't support DEFINED(). */ + uno::Reference xEnumerationAccess10(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((1) AND (DEFINED(ABC1)))"), xEnumerationAccess10->getPresentation(true).trim()); + + uno::Reference xEnumerationAccess9(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("NOT(TRUE)"), xEnumerationAccess9->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("0"), xEnumerationAccess9->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess8(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((TRUE) OR (FALSE))"), xEnumerationAccess8->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess8->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess7(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("(( EQ 1) OR ( EQ 2))"), xEnumerationAccess7->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess7->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess6(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((( L 1)) AND (( NEQ 2)))"), xEnumerationAccess6->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("0"), xEnumerationAccess6->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess5(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("(( EQ 1) AND ( EQ 2))"), xEnumerationAccess5->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess5->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess4(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(" NEQ 3"), xEnumerationAccess4->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess4->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(" EQ 3"), xEnumerationAccess3->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess3->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(" G 1"), xEnumerationAccess2->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess2->getPresentation(false).trim()); + +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf133647_unicode) +{ + load(mpTestDocumentPath, "tdf133647_unicode.docx"); + /* Tests that non-ASCII characters in formulas are preserved when importing from MS Word */ + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + xFields->nextElement(); + xFields->nextElement(); + xFields->nextElement(); + + uno::Reference xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(u"defined(預期結果)"), xEnumerationAccess1->getPresentation(true).trim()); + + uno::Reference xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(u"defined(نتيجةمتوقعة)"), xEnumerationAccess2->getPresentation(true).trim()); + + uno::Reference xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(u"defined(ExpectedResult)"), xEnumerationAccess3->getPresentation(true).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf123389) +{ + load(mpTestDocumentPath, "tdf123389.docx"); + /* Tests that argument lists, cell references, and cell ranges are translated correctly + * when importing table formulae from MS Word */ + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((2.345) ROUND (1))"), xEnumerationAccess1->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("2.3"), xEnumerationAccess1->getPresentation(false).trim()); + + uno::Reference xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("(() ROUND (2))"), xEnumerationAccess2->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("2.35"), xEnumerationAccess2->getPresentation(false).trim()); +} + + +CPPUNIT_TEST_FIXTURE(Test, testTdf107784) +{ + load(mpTestDocumentPath, "tdf107784.docx"); + // Make sure the field displays the citation's title and not the identifier + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Bibliography entry"), xEnumerationAccess->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("(Smith, 1950)"), xEnumerationAccess->getPresentation(false).trim()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf115883) +{ + load(mpTestDocumentPath, "tdf115883.docx"); + // Import failed due to an unhandled exception when getting the Surround + // property of a not yet inserted frame. +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf75573) +{ + load(mpTestDocumentPath, "tdf75573_page1frame.docx"); + // the problem was that the frame was discarded + // when an unrelated, unused, odd-header was flagged as discardable + lcl_countTextFrames( mxComponent, 1 ); + + // the frame should be on page 1 + CPPUNIT_ASSERT_EQUAL( OUString("lorem ipsum"), parseDump("/root/page[1]/body/section/txt/anchored/fly/txt[1]/text()") ); + + // the "Proprietary" style should set the vertical and horizontal anchors to the page + uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty(xPropertySet, "VertOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty(xPropertySet, "HoriOrientRelation")); + + // the frame should be located near the bottom[23186]/center[2955] of the page + CPPUNIT_ASSERT(sal_Int32(20000) < getProperty(xPropertySet, "VertOrientPosition")); + CPPUNIT_ASSERT(sal_Int32(2500) < getProperty(xPropertySet, "HoriOrientPosition")); + + css::uno::Reference m_xTextFactory(mxComponent, uno::UNO_QUERY); + uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + uno::Any aProtect = xSettings->getPropertyValue("ProtectForm"); + bool bProt = true; + aProtect >>= bProt; + CPPUNIT_ASSERT(!bProt); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf75573_lostTable) +{ + load(mpTestDocumentPath, "tdf75573_lostTable.docx"); + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("# of tables", sal_Int32(1), xTables->getCount() ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("# of frames/shapes", 0, getShapes() ); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("# of pages", 3, getPages() ); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf109316_dropCaps) +{ + load(mpTestDocumentPath, "tdf109316_dropCaps.docx"); + uno::Reference xSet(getParagraph(1), uno::UNO_QUERY); + css::style::DropCapFormat aDropCap = getProperty(xSet,"DropCapFormat"); + CPPUNIT_ASSERT_EQUAL( sal_Int8(2), aDropCap.Lines ); + CPPUNIT_ASSERT_EQUAL( sal_Int8(1), aDropCap.Count ); + CPPUNIT_ASSERT_EQUAL( sal_Int16(1270), aDropCap.Distance ); + + xSet.set(getParagraph(2), uno::UNO_QUERY); + aDropCap = getProperty(xSet,"DropCapFormat"); + CPPUNIT_ASSERT_EQUAL( sal_Int8(3), aDropCap.Lines ); + CPPUNIT_ASSERT_EQUAL( sal_Int8(1), aDropCap.Count ); + CPPUNIT_ASSERT_EQUAL( sal_Int16(508), aDropCap.Distance ); + + xSet.set(getParagraph(3), uno::UNO_QUERY); + aDropCap = getProperty(xSet,"DropCapFormat"); + CPPUNIT_ASSERT_EQUAL( sal_Int8(4), aDropCap.Lines ); + CPPUNIT_ASSERT_EQUAL( sal_Int8(7), aDropCap.Count ); + CPPUNIT_ASSERT_EQUAL( sal_Int16(0), aDropCap.Distance ); +} + +CPPUNIT_TEST_FIXTURE(Test, lineWpsOnly) +{ + load(mpTestDocumentPath, "line-wps-only.docx"); + uno::Reference xShape = getShape(1); + // Check position, it was -7223 as it was set after the CustomShapeGeometry property. + CPPUNIT_ASSERT_EQUAL(sal_Int32(210), xShape->getPosition().X); +} + +CPPUNIT_TEST_FIXTURE(Test, lineRotation) +{ + load(mpTestDocumentPath, "line-rotation.docx"); + uno::Reference xShape = getShape(3); + // This was 5096: the line was shifted towards the bottom, so the end of + // the 3 different lines wasn't at the same point. + CPPUNIT_ASSERT_EQUAL(sal_Int32(4808), xShape->getPosition().Y); +} + +CPPUNIT_TEST_FIXTURE(Test, textboxWpsOnly) +{ + load(mpTestDocumentPath, "textbox-wps-only.docx"); + uno::Reference xFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Hello world!"), xFrame->getString()); + // Position wasn't horizontally centered. + CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty(xFrame, "HoriOrient")); + + // Position was the default (hori center, vert top) for the textbox. + xFrame.set(getShape(2), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2173), getProperty(xFrame, "HoriOrientPosition")); +#ifdef MACOSX + // FIXME: The assert below fails wildly on a Retina display + NSScreen* nsScreen = [ NSScreen mainScreen ]; + CGFloat scaleFactor = [ nsScreen backingScaleFactor ]; // for instance on the 5K Retina iMac, + // [NSScreen mainScreen].frame.size is 2560x1440, + // while real display size is 5120x2880 + if ( nsScreen.frame.size.width * scaleFactor > 4000 ) + return; +#endif + CPPUNIT_ASSERT_EQUAL(sal_Int32(2805), getProperty(xFrame, "VertOrientPosition")); +} + +CPPUNIT_TEST_FIXTURE(Test, testGroupshapeRelsize) +{ + load(mpTestDocumentPath, "groupshape-relsize.docx"); + // This was 43760, i.e. the height of the groupshape was larger than the page height, which is obviously incorrect. + CPPUNIT_ASSERT_EQUAL(oox::drawingml::convertEmuToHmm(9142730), getShape(1)->getSize().Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testOleAnchor) +{ + load(mpTestDocumentPath, "ole-anchor.docx"); + // This was AS_CHARACTER, even if the VML style explicitly contains "position:absolute". + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); + // This was DYNAMIC, even if the default is THROUGH and there is no w10:wrap element in the bugdoc. + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, getProperty(getShape(1), "Surround")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf48658_transparentOLEheader) +{ + load(mpTestDocumentPath, "tdf48658_transparentOLEheader.docx"); + // The problem was that the shape in the header was hidden in the background. + // The round-tripped document was always fine (even before the fix) but the shape numbers change, so import-only test. + CPPUNIT_ASSERT_EQUAL(true, getProperty(getShape(1), "Opaque")); +} + +CPPUNIT_TEST_FIXTURE(Test, testDMLGroupShapeParaAdjust) +{ + load(mpTestDocumentPath, "dml-groupshape-paraadjust.docx"); + // Paragraph adjustment inside a group shape was not imported + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference xText = uno::Reference(xGroup->getByIndex(1), uno::UNO_QUERY_THROW)->getText(); + // 2nd line is adjusted to the right + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty(getRun(getParagraphOfText(2, xText), 1), "ParaAdjust")); + // 3rd line has no adjustment + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty(getRun(getParagraphOfText(3, xText), 1), "ParaAdjust")); + // 4th line is adjusted to center + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), getProperty(getRun(getParagraphOfText(4, xText), 1), "ParaAdjust")); + // 5th line has no adjustment + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty(getRun(getParagraphOfText(5, xText), 1), "ParaAdjust")); + // 6th line is justified + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_BLOCK), getProperty(getRun(getParagraphOfText(6, xText), 1), "ParaAdjust")); + // 7th line has no adjustment + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty(getRun(getParagraphOfText(7, xText), 1), "ParaAdjust")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf99135) +{ + load(mpTestDocumentPath, "tdf99135.docx"); + // This was 0, crop was ignored on VML import. + CPPUNIT_ASSERT_EQUAL(static_cast(1825), getProperty(getShape(1), "GraphicCrop").Bottom); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf85523) +{ + load(mpTestDocumentPath, "tdf85523.docx"); + auto xTextField = getProperty< uno::Reference >(getRun(getParagraph(1), 7), "TextField"); + auto xText = getProperty< uno::Reference >(xTextField, "TextRange"); + // This was "commentX": an unexpected extra char was added at the comment end. + getParagraphOfText(1, xText, "comment"); +} + +CPPUNIT_TEST_FIXTURE(Test, testStrictLockedcanvas) +{ + load(mpTestDocumentPath, "strict-lockedcanvas.docx"); + // locked canvas shape was missing. + getShape(1); +} + +CPPUNIT_TEST_FIXTURE(Test, testFdo75722vml) +{ + load(mpTestDocumentPath, "fdo75722-vml.docx"); + uno::Reference xShape = getShape(1); + awt::Point aPos = xShape->getPosition(); + awt::Size aSize = xShape->getSize(); + sal_Int64 nRot = getProperty(xShape, "RotateAngle"); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(3720), aPos.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-392), aPos.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5457), aSize.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3447), aSize.Height); + CPPUNIT_ASSERT_EQUAL(sal_Int64(3100), nRot); +} + +CPPUNIT_TEST_FIXTURE(Test, testFdo75722dml) +{ + load(mpTestDocumentPath, "fdo75722-dml.docx"); + uno::Reference xShape = getShape(1); + awt::Point aPos = xShape->getPosition(); + awt::Size aSize = xShape->getSize(); + sal_Int64 nRot = getProperty(xShape, "RotateAngle"); + + // a slight difference regarding vml file is tolerated due to rounding errors + CPPUNIT_ASSERT_EQUAL(sal_Int32(3720), aPos.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-397), aPos.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5457), aSize.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3447), aSize.Height); + CPPUNIT_ASSERT_EQUAL(sal_Int64(3128), nRot); +} + +CPPUNIT_TEST_FIXTURE(Test, testUnbalancedColumnsCompat) +{ + load(mpTestDocumentPath, "unbalanced-columns-compat.docx"); + uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + // This was false, we ignored the relevant compat setting to make this non-last section unbalanced. + CPPUNIT_ASSERT_EQUAL(true, getProperty(xTextSections->getByIndex(0), "DontBalanceTextColumns")); +} + +CPPUNIT_TEST_FIXTURE(Test, testFloatingTableSectionColumns) +{ + load(mpTestDocumentPath, "floating-table-section-columns.docx"); + OUString tableWidth = parseDump("/root/page[1]/body/section/column[2]/body/txt/anchored/fly/tab/infos/bounds", "width"); + // table width was restricted by a column + CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 ); +} + +static OString dateTimeToString( const util::DateTime& dt ) +{ + return DateTimeToOString( DateTime( Date( dt.Day, dt.Month, dt.Year ), tools::Time( dt.Hours, dt.Minutes, dt.Seconds ))); +} + +CPPUNIT_TEST_FIXTURE(Test, testBnc821804) +{ + load(mpTestDocumentPath, "bnc821804.docx"); + CPPUNIT_ASSERT_EQUAL( OUString( "TITLE" ), getRun( getParagraph( 1 ), 1 )->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(1), 1), "RedlineType")); + // Redline information (SwXRedlinePortion) are separate "runs" apparently. + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(1), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(1), 2), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown1"),getProperty(getRun(getParagraph(1), 2), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:46:00Z"),dateTimeToString(getProperty(getRun(getParagraph(1), 2), "RedlineDateTime"))); + // So only the 3rd run is actual text (and the two runs have been merged into one, not sure why, but that shouldn't be a problem). + CPPUNIT_ASSERT_EQUAL(OUString(" (1st run of an insert) (2nd run of an insert)"), getRun(getParagraph(1),3)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(1), 3), "RedlineType")); + // And the end SwXRedlinePortion of the redline. + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(1), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown1"),getProperty(getRun(getParagraph(1), 4), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:46:00Z"),dateTimeToString(getProperty(getRun(getParagraph(1), 4), "RedlineDateTime"))); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(1), 4), "IsStart")); + + CPPUNIT_ASSERT_EQUAL(OUString("Normal text"), getRun(getParagraph(2),1)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(2), 1), "RedlineType")); + + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(3), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(3), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown2"),getProperty(getRun(getParagraph(3), 1), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:47:00Z"),dateTimeToString(getProperty(getRun(getParagraph(3), 1), "RedlineDateTime"))); + CPPUNIT_ASSERT_EQUAL(OUString("Deleted"), getRun(getParagraph(3),2)->getString()); + + // This is both inserted and formatted, so there are two SwXRedlinePortion "runs". Given that the redlines overlap and Writer core + // doesn't officially expect that (even though it copes, the redline info will be split depending on how Writer deal with it). + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(4), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(4), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(4), 1), "IsStart")); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(4), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty(getRun(getParagraph(4), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(4), 2), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("Inserted and formatted"), getRun(getParagraph(4),3)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(4), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(4), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(4), 4), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString(" and this is only formatted"), getRun(getParagraph(4),5)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(4), 6), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty(getRun(getParagraph(4), 6), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(4), 6), "IsStart")); + + CPPUNIT_ASSERT_EQUAL(OUString("Normal text"), getRun(getParagraph(5),1)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(5), 1), "RedlineType")); + + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(6), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Format"),getProperty(getRun(getParagraph(6), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(6), 1), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown5"),getProperty(getRun(getParagraph(6), 1), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T10:02:00Z"),dateTimeToString(getProperty(getRun(getParagraph(6), 1), "RedlineDateTime"))); + CPPUNIT_ASSERT_EQUAL(OUString("Formatted run"), getRun(getParagraph(6),2)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(6), 3), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Format"),getProperty(getRun(getParagraph(6), 3), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(6), 3), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString(" and normal text here "), getRun(getParagraph(6),4)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(6), 4), "RedlineType")); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(6), 5), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(6), 5), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(6), 5), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown6"),getProperty(getRun(getParagraph(6), 5), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OString("2006-08-29T09:48:00Z"),dateTimeToString(getProperty(getRun(getParagraph(6), 5), "RedlineDateTime"))); + CPPUNIT_ASSERT_EQUAL(OUString("and inserted again"), getRun(getParagraph(6),6)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(6), 7), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(6), 7), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(6), 7), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString(" and normal text again "), getRun(getParagraph(6),8)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(6), 8), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Format"),getProperty(getRun(getParagraph(6), 9), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(6), 9), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown7"),getProperty(getRun(getParagraph(6), 9), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OUString("and formatted"), getRun(getParagraph(6),10)->getString()); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(6), 11), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString(" and normal."), getRun(getParagraph(6),12)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(6), 12), "RedlineType")); + + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(7), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(7), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(7), 1), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown8"),getProperty(getRun(getParagraph(7), 1), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OUString("One insert."), getRun(getParagraph(7),2)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(7), 3), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(7), 3), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(7), 3), "IsStart")); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(7), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(7), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(7), 4), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("unknown9"),getProperty(getRun(getParagraph(7), 4), "RedlineAuthor")); + CPPUNIT_ASSERT_EQUAL(OUString("Second insert."), getRun(getParagraph(7),5)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(7), 6), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(7), 6), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(7), 6), "IsStart")); + + // Overlapping again. + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(8), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(8), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(8), 1), "IsStart")); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(8), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty(getRun(getParagraph(8), 2), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(8), 1), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("Deleted and formatted"), getRun(getParagraph(8),3)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(8), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(8), 4), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(8), 4), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString(" and this is only formatted"), getRun(getParagraph(8),5)->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty(getRun(getParagraph(8), 6), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(8), 6), "IsStart")); + + CPPUNIT_ASSERT_EQUAL(OUString("Normal text"), getRun(getParagraph(9),1)->getString()); + CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(9), 1), "RedlineType")); + + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(10), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty(getRun(getParagraph(10), 1), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(10), 1), "IsStart")); + CPPUNIT_ASSERT_EQUAL(OUString("This is only formatted."), getRun(getParagraph(10),2)->getString()); + CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(10), 3), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(OUString("ParagraphFormat"),getProperty(getRun(getParagraph(10), 3), "RedlineType")); + CPPUNIT_ASSERT_EQUAL(false,getProperty(getRun(getParagraph(10), 3), "IsStart")); +} + +CPPUNIT_TEST_FIXTURE(Test, testFdo87488) +{ + // The shape on the right (index 0, CustomShape within a + // GroupShape) is rotated 90 degrees clockwise and contains text + // rotated 90 degrees anticlockwise. Must be read with SmartArt + // enabled in preTest above, otherwise it gets converted to a + // StarView MetaFile. + SvtFilterOptions::Get().SetSmartArt2Shape(true); + comphelper::ScopeGuard g([] { SvtFilterOptions::Get().SetSmartArt2Shape(false); }); + load(mpTestDocumentPath, "fdo87488.docx"); + uno::Reference group(getShape(1), uno::UNO_QUERY); + { + uno::Reference text(group->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("text2"), text->getString()); + } + { + uno::Reference props(group->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(props->getPropertyValue("RotateAngle"), + uno::Any(sal_Int32(270 * 100))); + comphelper::SequenceAsHashMap geom(props->getPropertyValue("CustomShapeGeometry")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(90), geom["TextPreRotateAngle"].get()); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf85232) +{ + load(mpTestDocumentPath, "tdf85232.docx"); + uno::Reference xShapes(getShapeByName(u"Group 219"), uno::UNO_QUERY); + uno::Reference xShape(xShapes->getByIndex(1), uno::UNO_QUERY); + uno::Reference xShapeDescriptor = xShape; + // Make sure we're not testing the ellipse child. + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.LineShape"), xShapeDescriptor->getShapeType()); + + // This was 2900: horizontal position of the line was incorrect, the 3 children were not connected visually. + CPPUNIT_ASSERT_EQUAL(static_cast(2265), xShape->getPosition().X); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf95755) +{ + load(mpTestDocumentPath, "tdf95755.docx"); + /* + * The problem was that the width of a second table with single cell was discarded + * and resulted in too wide table + */ + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference xTableProperties(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Any aValue = xTableProperties->getPropertyValue("Width"); + sal_Int32 nWidth; + aValue >>= nWidth; + CPPUNIT_ASSERT_EQUAL(sal_Int32(10659), nWidth); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf60351) +{ + load(mpTestDocumentPath, "tdf60351.docx"); + // Get the first image in the document and check its contour polygon. + // It should contain 6 points. Check their coordinates. + uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY); + // test for TODO: if paragraph's background becomes bottommost [better yet: wraps around shape], then remove this hack + CPPUNIT_ASSERT_EQUAL_MESSAGE("HACK ALERT: Shape is in foreground", true, getProperty(xPropertySet, "Opaque")); + + css::drawing::PointSequenceSequence aPolyPolygon; + xPropertySet->getPropertyValue("ContourPolyPolygon") >>= aPolyPolygon; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aPolyPolygon.getLength()); + const css::drawing::PointSequence& aPolygon = aPolyPolygon[0]; + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), aPolygon.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[0].X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[0].Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(316), aPolygon[1].X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[1].Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(316), aPolygon[2].X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(316), aPolygon[2].Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(158), aPolygon[3].X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(298), aPolygon[3].Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[4].X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(316), aPolygon[4].Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[5].X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[5].Y); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf95970) +{ + load(mpTestDocumentPath, "tdf95970.docx"); + // First shape: the rotation should be -12.94 deg, it should be mirrored. + // Proper color order of image on test doc (left->right): + // top row: green->red + // bottom row: yellow->blue + uno::Reference xShape(getShape(1), uno::UNO_SET_THROW); + uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY_THROW); + sal_Int32 aRotate = 0; + xPropertySet->getPropertyValue("RotateAngle") >>= aRotate; + CPPUNIT_ASSERT_EQUAL(sal_Int32(34706), aRotate); + bool bIsMirrored = false; + xPropertySet->getPropertyValue("IsMirrored") >>= bIsMirrored; + CPPUNIT_ASSERT(bIsMirrored); + drawing::HomogenMatrix3 aTransform; + xPropertySet->getPropertyValue("Transformation") >>= aTransform; + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column1, 4767.0507250872988)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column2, -1269.0985325236848)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column3, 696.73611111111109)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column1, 1095.3035265135941)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column2, 5523.4525711162969)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column3, 672.04166666666663)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column1, 0.0)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column2, 0.0)); + CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column3, 1.0)); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf96674) +{ + load(mpTestDocumentPath, "tdf96674.docx"); + uno::Reference xShape = getShape(1); + CPPUNIT_ASSERT(xShape.is()); + awt::Size aActualSize(xShape->getSize()); + // Width was 3493: the vertical line was horizontal. + CPPUNIT_ASSERT(aActualSize.Width < aActualSize.Height); + CPPUNIT_ASSERT(aActualSize.Height > 0); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf122717) +{ + load(mpTestDocumentPath, "tdf122717.docx"); + uno::Reference xShape = getShape(1); + CPPUNIT_ASSERT(xShape.is()); + awt::Size aActualSize(xShape->getSize()); + // Without the fix in place, this test would have failed with + // - Expected: 2 + // - Actual : 8160 + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aActualSize.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8160), aActualSize.Height); + +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf98882) +{ + load(mpTestDocumentPath, "tdf98882.docx"); + sal_Int32 nFlyHeight = parseDump("//anchored/fly/infos/bounds", "height").toInt32(); + sal_Int32 nContentHeight = parseDump("//notxt/infos/bounds", "height").toInt32(); + // The content height was 600, not 360, so the frame and the content height did not match. + CPPUNIT_ASSERT_EQUAL(nFlyHeight, nContentHeight); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf100830) +{ + load(mpTestDocumentPath, "tdf100830.docx"); + // FillTransparence wasn't imported, this was 0. + CPPUNIT_ASSERT_EQUAL(static_cast(30), getProperty(getShape(1), "FillTransparence")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf103664) +{ + load(mpTestDocumentPath, "tdf103664.docx"); + // Wingdings symbols were displayed as rectangles + uno::Reference xPara(getParagraph(1)); + CPPUNIT_ASSERT_EQUAL(u'\xf020', xPara->getString()[0] ); + CPPUNIT_ASSERT_EQUAL(u'\xf0fc', xPara->getString()[1] ); + CPPUNIT_ASSERT_EQUAL(u'\xf0dc', xPara->getString()[2] ); + CPPUNIT_ASSERT_EQUAL(u'\xf081', xPara->getString()[3] ); + + uno::Reference xRun(getRun(xPara,1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, "CharFontName")); + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, "CharFontNameAsian")); + CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, "CharFontNameComplex")); + + // Make sure these special characters are imported as symbols + CPPUNIT_ASSERT_EQUAL(awt::CharSet::SYMBOL, getProperty(xRun, "CharFontCharSet")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf82824) +{ + load(mpTestDocumentPath, "tdf82824.docx"); + // This was text::TextContentAnchorType_AS_CHARACTER, wasn't handled on import for the chart. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf96218) +{ + load(mpTestDocumentPath, "tdf96218.docx"); + // Image had a bad position because layoutInCell attribute was not ignored + CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf101626) +{ + load(mpTestDocumentPath, "tdf101626.docx"); + // Transform soft-hyphen to hard-hyphen as list bulletChar to avoid missing symbols in export + uno::Reference xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence aProps; + xLevels->getByIndex(0) >>= aProps; // 1st level + + for (beans::PropertyValue const & rProp : std::as_const(aProps)) + { + if (rProp.Name == "BulletChar") + { + // the bulletChar has to be 0x2d! + CPPUNIT_ASSERT_EQUAL(OUString("\x2d"), rProp.Value.get()); + return; + } + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf106606) +{ + load(mpTestDocumentPath, "tdf106606.docx" ); + auto FindGraphicBitmapPropertyInNumStyle = [&]( OUString rStyleName ) + { + uno::Reference xPropertySet( getStyles( "NumberingStyles" )->getByName( rStyleName ), uno::UNO_QUERY ); + uno::Reference xLevels( xPropertySet->getPropertyValue( "NumberingRules" ), uno::UNO_QUERY ); + uno::Sequence aProps; + xLevels->getByIndex( 0 ) >>= aProps; // 1st level + + for ( beans::PropertyValue const & rProp : std::as_const(aProps)) + { + // If the image was prematurely removed from cache when processed for previous numbering list, then the sequence hasn't the property. + if ( rProp.Name == "GraphicBitmap" ) + return true; + } + return false; + }; + + // The document has two numbering lists with a picture + CPPUNIT_ASSERT( FindGraphicBitmapPropertyInNumStyle("WWNum1") ); + CPPUNIT_ASSERT( FindGraphicBitmapPropertyInNumStyle("WWNum2") ); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf101627) +{ + load(mpTestDocumentPath, "tdf101627.docx"); + // Do not shrink the textbox in the footer + uno::Reference xFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFrame->getString().startsWith( "1" ) ); + CPPUNIT_ASSERT_EQUAL(sal_Int32(466), getProperty(xFrame, "Height")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf133448) +{ + load(mpTestDocumentPath, "tdf133448.docx"); + auto xGraphic = getProperty>(getShape(1), "Graphic"); + Graphic aGraphic(xGraphic); + uno::Reference xGraphicDescriptor(xGraphic, uno::UNO_QUERY_THROW); + awt::Size aSizePixel; + CPPUNIT_ASSERT(xGraphicDescriptor->getPropertyValue("SizePixel") >>= aSizePixel); + + //Without the fix in place, the graphic's size is 0x0 + CPPUNIT_ASSERT_GREATER(sal_Int32(0), aSizePixel.Width); + CPPUNIT_ASSERT_GREATER(sal_Int32(0), aSizePixel.Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf100072) +{ + load(mpTestDocumentPath, "tdf100072.docx"); + uno::Reference xShape = getShape(1); + + // Ensure that shape has non-zero height + CPPUNIT_ASSERT(xShape->getSize().Height > 0); + + // Ensure that shape left corner is within page (positive) + CPPUNIT_ASSERT(xShape->getPosition().X > 0); + + // Save the first shape to a metafile. + uno::Reference xGraphicExporter = drawing::GraphicExportFilter::create(comphelper::getProcessComponentContext()); + uno::Reference xSourceDoc(xShape, uno::UNO_QUERY); + xGraphicExporter->setSourceDocument(xSourceDoc); + + SvMemoryStream aStream; + uno::Reference xOutputStream(new utl::OStreamWrapper(aStream)); + uno::Sequence aDescriptor( comphelper::InitPropertySequence({ + { "OutputStream", uno::Any(xOutputStream) }, + { "FilterName", uno::Any(OUString("SVM")) } + })); + xGraphicExporter->filter(aDescriptor); + aStream.Seek(STREAM_SEEK_TO_BEGIN); + + // Read it back and dump it as an XML file. + Graphic aGraphic; + TypeSerializer aSerializer(aStream); + aSerializer.readGraphic(aGraphic); + const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile(); + MetafileXmlDump dumper; + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, rMetaFile); + + // Get first polyline rightside x coordinate + sal_Int32 nFirstEnd = getXPath(pXmlDoc, "(//polyline)[1]/point[2]", "x").toInt32(); + + // Get last stroke x coordinate + sal_Int32 nSecondEnd = getXPath(pXmlDoc, "(//polyline)[last()]/point[2]", "x").toInt32(); + + // Assert that the difference is less than half point. + CPPUNIT_ASSERT_MESSAGE("Shape line width does not match", abs(nFirstEnd - nSecondEnd) < 10); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf76446) +{ + load(mpTestDocumentPath, "tdf76446.docx"); + uno::Reference xShape = getShape(1); + sal_Int64 nRot = getProperty(xShape, "RotateAngle"); + CPPUNIT_ASSERT_EQUAL(sal_Int64(3128), nRot); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108350) +{ + load(mpTestDocumentPath, "tdf108350.docx"); + // For OOXML without explicit font information, font needs to be Calibri 11 pt + uno::Reference xPara(getParagraph(1)); + uno::Reference xRun(getRun(xPara, 1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty(xRun, "CharFontName")); + CPPUNIT_ASSERT_EQUAL(double(11), getProperty(xRun, "CharHeight")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108408) +{ + load(mpTestDocumentPath, "tdf108408.docx"); + // Font size must consider units specifications; previously ignored and only used + // integer part as half-pt size, i.e. 10 pt (20 half-pt) instead of 20 pt + uno::Reference xPara(getParagraph(1)); + uno::Reference xRun(getRun(xPara, 1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(double(20), getProperty(xRun, "CharHeight")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108806) +{ + load(mpTestDocumentPath, "tdf108806.docx"); + // tdf#108806:The CRLF in the text contents of XML must be converted to single spaces. + CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); + uno::Reference< text::XTextRange > paragraph = getParagraph(1); + CPPUNIT_ASSERT_EQUAL( + OUString("First part of a line (before CRLF). Second part of the same line (after CRLF)."), + paragraph->getString()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf87533_bidi) +{ + load(mpTestDocumentPath, "tdf87533_bidi.docx"); + // "w:bidi" (specified inside Default paragraph properties) should not be ignored + static const OUStringLiteral writingMode = u"WritingMode"; //getPropertyName(PROP_WRITING_MODE); + + // check: "Default Style" master-style has RTL + { + const uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Default Page Style"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(text::WritingMode2::RL_TB), getProperty(xPropertySet, writingMode)); + } + + // check: "Standard" master-style has RTL + { + const uno::Reference xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(text::WritingMode2::RL_TB), getProperty(xPropertySet, writingMode)); + } + + // check: style of the first paragraph has RTL + // it has missing usage of the => this property should be taken from style + { + const uno::Reference xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(text::WritingMode2::RL_TB), getProperty(xPara, writingMode)); + } + + // check: style of the first paragraph has LTR + // it has + { + const uno::Reference xPara(getParagraph(2), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(text::WritingMode2::LR_TB), getProperty(xPara, writingMode)); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testVmlAdjustments) +{ + load(mpTestDocumentPath, "vml-adjustments.docx"); + uno::Reference xPropertySet(getShape(1), uno::UNO_QUERY); + comphelper::SequenceAsHashMap aGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry")); + uno::Sequence aAdjustmentValues = + aGeometry["AdjustmentValues"].get>(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aAdjustmentValues.getLength()); + drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue = *std::cbegin(aAdjustmentValues); + CPPUNIT_ASSERT_EQUAL(sal_Int32(17639), aAdjustmentValue.Value.get()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108714) +{ + load(mpTestDocumentPath, "tdf108714.docx"); + CPPUNIT_ASSERT_EQUAL(6, getParagraphs()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break is absent - we lost bug-to-bug compatibility with Word", 4, getPages()); + + // The second (empty) paragraph must be at first page, despite the element was before it. + // That's because Word treats such break as first element in first run of following paragraph: + // + // + // + // + // + // + // + // + // is equal to + // + // + // + // + // + // + // + // which emits page break after that empty paragraph. + + uno::Reference< text::XTextRange > paragraph = getParagraph(1); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 1"), paragraph->getString()); + style::BreakType breakType = getProperty(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType); + + paragraph = getParagraph(2); + CPPUNIT_ASSERT_EQUAL(OUString(), paragraph->getString()); + breakType = getProperty(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType); + + paragraph = getParagraph(3); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 3"), paragraph->getString()); + breakType = getProperty(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); + + paragraph = getParagraph(4); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 4"), paragraph->getString()); + breakType = getProperty(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); + + // A table with immediately following break + // Line breaks in block and paragraph levels must be taken into account + // Several successive out-of-place w:br's must produce required amount of breaks + uno::Reference table = getParagraphOrTable(5); + getCell(table, "A1", "\n\n\n\nParagraph 5 in table"); + breakType = getProperty(table, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType); + + paragraph = getParagraph(6); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 6"), paragraph->getString()); + breakType = getProperty(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf136952_pgBreak3) +{ + load(mpTestDocumentPath, "tdf136952_pgBreak3.docx"); + // The original 6 page ODT was designed to visually exaggerate the problems + // of emulating LO's followed-by-page-style into MSWord's sections. + // While much has been improved, there are extra pages present, which still need fixing. + xmlDocUniquePtr pDump = parseLayoutDump(); + + //Do not lose the page::breakAfter. This SHOULD be on page 4, but sadly it is not. + //The key part of this test is that the page starts with "Lorem ipsum" + //Prior to this, there was no page break, and so it was in the middle of a page. + CPPUNIT_ASSERT(getXPath(pDump, "//page[6]/body/txt[1]/Text[1]", "Portion").startsWith("Lorem ipsum")); +} + + +CPPUNIT_TEST_FIXTURE(Test, testImageLazyRead) +{ + load(mpTestDocumentPath, "image-lazy-read.docx"); + auto xGraphic = getProperty>(getShape(1), "Graphic"); + Graphic aGraphic(xGraphic); + // This failed, import loaded the graphic, it wasn't lazy-read. + CPPUNIT_ASSERT(!aGraphic.isAvailable()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108995) +{ + load(mpTestDocumentPath, "xml_space.docx"); + CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); + // We need to take xml:space attribute into account + uno::Reference< text::XTextRange > paragraph = getParagraph(1); + CPPUNIT_ASSERT_EQUAL(OUString("\tA\t\tline with\txml:space=\"preserve\" \n" + "A line without xml:space"), + paragraph->getString()); +} + +CPPUNIT_TEST_FIXTURE(Test, testGroupShapeTextHighlight) +{ + load(mpTestDocumentPath, "tdf131841_HighlightColorGroupedShape.docx"); + // tdf#131841 Highlight color of text in grouped shapes was not imported. + + // These are the possible highlight colors in MSO Word. Check that we import them properly. + const std::vector xColors { + 0xFFFF00UL, // yellow + 0x00FF00UL, // green + 0x00FFFFUL, // cyan + 0xFF00FFUL, // magenta + 0x0000FFUL, // blue + 0xFF0000UL, // red + 0x000080UL, // dark blue + 0x008080UL, // dark cyan + 0x008000UL, // dark green + 0x800080UL, // dark magenta + 0x800000UL, // dark red + 0x808000UL, // dark yellow + 0x808080UL, // dark grey + 0xC0C0C0UL, // light grey + 0x000000UL // black + }; + + // The grouped shape, consists of 15 rectangles. + uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY); + + // Iterate through all of the rectangles and check the colors of the texts. + // They should correspond to the list above. + for (size_t idx = 0; idx < xColors.size(); ++idx) + { + uno::Reference xTextRange(xGroupShape->getByIndex(idx), uno::UNO_QUERY); + uno::Reference firstParagraph = getParagraphOfText(1, xTextRange->getText()); + uno::Reference firstRun = getRun(firstParagraph, 1); + uno::Reference props(firstRun, uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(xColors[idx], props->getPropertyValue("CharHighlight").get()); + } +} + +// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx new file mode 100644 index 000000000..d96ca84ab --- /dev/null +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -0,0 +1,954 @@ +/* -*- 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/. + */ + +#ifdef MACOSX +#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#include +#include +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/extras/ooxmlimport/data/", "Office Open XML Text") + { + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_twoShapes) +{ + // Given a lockedCanvas in a docx document with compatibility to Word version 12 (2007). + // It contains two shapes. Error was, that the lockedCanvas was not imported as group at all, + // and only one shape was imported and that one was scaled to lockedCanvas area. + load(mpTestDocumentPath, "tdf143476_lockedCanvas_twoShapes.docx"); + // The group shape corresponds to the lockedCanvas. + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroup.is()); + CPPUNIT_ASSERT_EQUAL(static_cast(2), xGroup->getCount()); + uno::Reference xShape(xGroup->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(14200), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1120), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1928), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1593), xShape->getSize().Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_position) +{ + // Given a lockedCanvas in a docx document with compatibility to Word version 12 (2007). + // Tests fix for regression introduced by 3262fc5ef3bde5b158909d11ccb008161ea95519 + // Error was, that the imported shape had wrong position. + load(mpTestDocumentPath, "tdf143476_lockedCanvas_position.docx"); + // The group shape corresponds to the lockedCanvas. + uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY); + // Without fix in place the test failed with position 185|947. + CPPUNIT_ASSERT_EQUAL(sal_Int32(2351), xGroupShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(26), xGroupShape->getPosition().Y); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_image_line) +{ + // Given a lockedCanvas in a docx document with compatibility to Word version 12 (2007). + // It contains an image and a line. Error was, that both were not imported. + load(mpTestDocumentPath, "tdf143476_lockedCanvas_image_line.docx"); + CPPUNIT_ASSERT_MESSAGE("No shapes imported", getShapes() > 0); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf143475rotatedWord2007imageInline) +{ + // Given a docx document with compatibility to Word version 12 (2007), which has a shape + // rotated by 75deg. Similar to testTdf143475rotatedWord2007image but with inline anchored + // shape, as in bug report. + load(mpTestDocumentPath, "tdf143475_rotatedWord2007imageInline.docx"); + + // Word 2007 does not swap width and height for rotated images as done in later versions. + // This was not considered and lead to wrong distance to text on import and wrong effectExtent + // on export. + // Import fails without fix with left: expected 1258 actual -743 ; right expected 1256 actual -743; + // top: expected 14 actual 2013; bottom: expected 0 actual 1960; + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1258), getProperty(getShape(1), "LeftMargin"), + 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1256), + getProperty(getShape(1), "RightMargin"), 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(14), getProperty(getShape(1), "TopMargin"), + 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(0), getProperty(getShape(1), "BottomMargin"), + 1); + + // Because LO made the same error on export, which inverts the import error, import-export-cycle + // does not fail without the patch. Therefore no export test. +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf143475rotatedWord2007image) +{ + // Given a docx document with compatibility to Word version 12 (2007), which has a shape + // rotated by 75deg. + load(mpTestDocumentPath, "tdf143475_rotatedWord2007image.docx"); + + // Word 2007 does not swap width and height for rotated images as done in later versions. + // This was not considered and lead to wrong distance to text on import and wrong effectExtent + // on export. + // Import fails without fix with left: expected 1252 actual -746 ; right expected 1256 actual -743; + // top: expected 12 actual 2013; bottom: expected 0 actual 1960; + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1252), getProperty(getShape(1), "LeftMargin"), + 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1256), + getProperty(getShape(1), "RightMargin"), 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(12), getProperty(getShape(1), "TopMargin"), + 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(0), getProperty(getShape(1), "BottomMargin"), + 1); + + // Because LO made the same error on export, which inverts the import error, import-export-cycle + // does not fail without the patch. Therefore no export test. +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf143219ContourWrapRotate) +{ + load(mpTestDocumentPath, "tdf143219_ContourWrap_rotate.docx"); + const uno::Reference xShape = getShape(1); + const uno::Reference xShapeProps(xShape, uno::UNO_QUERY_THROW); + sal_Int32 nWrapDistanceLeft = -1; + sal_Int32 nWrapDistanceRight = -1; + sal_Int32 nWrapDistanceTop = -1; + sal_Int32 nWrapDistanceBottom = -1; + xShapeProps->getPropertyValue("LeftMargin") >>= nWrapDistanceLeft; + xShapeProps->getPropertyValue("RightMargin") >>= nWrapDistanceRight; + xShapeProps->getPropertyValue("TopMargin") >>= nWrapDistanceTop; + xShapeProps->getPropertyValue("BottomMargin") >>= nWrapDistanceBottom; + // Word and Writer use different concepts for contour wrap. LO needs wrap margins to + // approximate Word's rendering. + // Without the fix in place left and right margin were too large, top and bottom margin too + // small. The test would have failed + // ... with expected 182 actual 1005. + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("LeftMargin", 182, nWrapDistanceLeft, 1); + // ... with expected 183 actual 1005 + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("RightMargin", 183, nWrapDistanceRight, 1); + // ... with expected 42 actual 0 + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("TopMargin", 42, nWrapDistanceTop, 1); + // ... with expected 41 actual 0 + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("BottomMargin", 41, nWrapDistanceBottom, 1); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108545_embeddedDocxIcon) +{ + load(mpTestDocumentPath, "tdf108545_embeddedDocxIcon.docx"); + uno::Reference xSupplier(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(embed::Aspects::MSOLE_ICON, xSupplier->getAspect()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf121203) +{ + load(mpTestDocumentPath, "tdf121203.docx"); + // We imported the date field + uno::Reference xTextPortion(getRun(getParagraph(1), 1), uno::UNO_QUERY); + OUString aPortionType; + xTextPortion->getPropertyValue("TextPortionType") >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aPortionType); + + // Custom sdt date content is imported correctly + uno::Reference xContentControl; + xTextPortion->getPropertyValue("ContentControl") >>= xContentControl; + uno::Reference xContentControlProps(xContentControl, uno::UNO_QUERY); + bool bDate{}; + xContentControlProps->getPropertyValue("Date") >>= bDate; + CPPUNIT_ASSERT(bDate); + + OUString sDateFormat; + xContentControlProps->getPropertyValue("DateFormat") >>= sDateFormat; + + OUString sLang; + xContentControlProps->getPropertyValue("DateLanguage") >>= sLang; + + uno::Reference xContentControlEnumAccess(xContentControl, + uno::UNO_QUERY); + uno::Reference xContentControlEnum + = xContentControlEnumAccess->createEnumeration(); + uno::Reference xTextPortionRange(xContentControlEnum->nextElement(), + uno::UNO_QUERY); + OUString sCurrentDate = xTextPortionRange->getString(); + CPPUNIT_ASSERT_EQUAL(OUString("dd-MMM-yy"), sDateFormat); + CPPUNIT_ASSERT_EQUAL(OUString("en-GB"), sLang); + CPPUNIT_ASSERT_EQUAL(OUString("17-Oct-2018 09:00"), sCurrentDate); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf109053) +{ + load(mpTestDocumentPath, "tdf109053.docx"); + // Table was imported into a text frame which led to a one page document + // Originally the table takes two pages, so Writer should import it accordingly. + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf121664) +{ + load(mpTestDocumentPath, "tdf121664.docx"); + uno::Reference xLineNumbering(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT(xLineNumbering.is()); + // Without the accompanying fix in place, numbering did not restart on the + // second page. + CPPUNIT_ASSERT( + getProperty(xLineNumbering->getLineNumberingProperties(), "RestartAtEachPage")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf108849) +{ + load(mpTestDocumentPath, "tdf108849.docx"); + // sectPr element that is child element of body must be the last child. However, Word accepts it + // in wrong places, and we should do the same (bug-to-bug compatibility) without creating extra sections. + CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Misplaced body-level sectPr's create extra sections!", 2, + getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf97038) +{ + load(mpTestDocumentPath, "tdf97038.docx"); + // Without the accompanying fix in place, this test would have failed, as the importer lost the + // fLayoutInCell shape property for wrap-though shapes. + CPPUNIT_ASSERT(getProperty(getShapeByName(u"Kep2"), "IsFollowingTextFlow")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf114212) +{ + load(mpTestDocumentPath, "tdf114212.docx"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1428 + // - Actual : 387 + OUString aTop = parseDump("//anchored/fly[1]/infos/bounds", "top"); + CPPUNIT_ASSERT_EQUAL(OUString("1428"), aTop); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf109524) +{ + load(mpTestDocumentPath, "tdf109524.docx"); + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); + // The table should have a small width (just to hold the short text in its single cell). + // Until it's correctly implemented, we assign it 100% relative width. + // Previously, the table (without explicitly set width) had huge actual width + // and extended far outside of page's right border. + CPPUNIT_ASSERT_EQUAL(true, getProperty(xTables->getByIndex(0), "IsWidthRelative")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(100), + getProperty(xTables->getByIndex(0), "RelativeWidth")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf120547) +{ + load(mpTestDocumentPath, "tdf120547.docx"); + uno::Reference xGroupShape = getShape(1); + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast(3), xGroup->getCount()); + + awt::Point aPosGroup = xGroupShape->getPosition(); + awt::Size aSizeGroup = xGroupShape->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosGroup.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosGroup.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9091), aSizeGroup.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(27940), aSizeGroup.Height); + + // Without the fix in place, this test would have failed at many places + // as the three shapes in the group would have had an incorrect position, + // an incorrect width or an incorrect height. + + uno::Reference xShape1(xGroup->getByIndex(0), uno::UNO_QUERY_THROW); + awt::Point aPosShape1 = xShape1->getPosition(); + awt::Size aSizeShape1 = xShape1->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosShape1.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosShape1.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9066), aSizeShape1.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(27905), aSizeShape1.Height); + + uno::Reference xShape2(xGroup->getByIndex(1), uno::UNO_QUERY_THROW); + awt::Point aPosShape2 = xShape2->getPosition(); + awt::Size aSizeShape2 = xShape2->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosShape2.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(20745), aPosShape2.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9066), aSizeShape2.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7195), aSizeShape2.Height); + + // The second shape is a group of 3 shapes + uno::Reference xGroup2(xGroup->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast(3), xGroup2->getCount()); + + uno::Reference xShape3(xGroup->getByIndex(2), uno::UNO_QUERY_THROW); + awt::Point aPosShape3 = xShape3->getPosition(); + awt::Size aSizeShape3 = xShape3->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosShape3.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPosShape3.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9091), aSizeShape3.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8073), aSizeShape3.Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf118693) +{ + load(mpTestDocumentPath, "tdf118693.docx"); + uno::Reference xGroupShape = getShape(1); + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast(2), xGroup->getCount()); + + awt::Point aPosGroup = xGroupShape->getPosition(); + awt::Size aSizeGroup = xGroupShape->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(10162), aPosGroup.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(118), aPosGroup.Y); + // As of LO7.2 width by 1 too small, height by 2 too small. Reason unclear. + CPPUNIT_ASSERT_EQUAL(sal_Int32(6368), aSizeGroup.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4981), aSizeGroup.Height); + + // Without the fix in place, this test would have failed at many places + // as the first shape in the group would have had an incorrect position, + // an incorrect width or an incorrect height. + + uno::Reference xShape1(xGroup->getByIndex(0), uno::UNO_QUERY_THROW); + awt::Point aPosShape1 = xShape1->getPosition(); + awt::Size aSizeShape1 = xShape1->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(12861), aPosShape1.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(146), aPosShape1.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3669), aSizeShape1.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4912), aSizeShape1.Height); + + uno::Reference xShape2(xGroup->getByIndex(1), uno::UNO_QUERY_THROW); + awt::Point aPosShape2 = xShape2->getPosition(); + awt::Size aSizeShape2 = xShape2->getSize(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(10162), aPosShape2.X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(118), aPosShape2.Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4595), aSizeShape2.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4981), aSizeShape2.Height); +} + +CPPUNIT_TEST_FIXTURE(Test, testGroupShapeFontName) +{ + load(mpTestDocumentPath, "groupshape-fontname.docx"); + // Font names inside a group shape were not imported + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference xText + = uno::Reference(xGroup->getByIndex(1), uno::UNO_QUERY_THROW)->getText(); + + CPPUNIT_ASSERT_EQUAL( + OUString("Calibri"), + getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontName")); + CPPUNIT_ASSERT_EQUAL( + OUString("Calibri"), + getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameComplex")); + CPPUNIT_ASSERT_EQUAL( + OUString(""), + getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf124600) +{ + load(mpTestDocumentPath, "tdf124600.docx"); + // uno::Reference xShape = getShape(1); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 0 + // - Actual : 318 + // i.e. the shape had an unexpected left margin, but not in Word. + // Regina: LO needs a left margin to get the same rendering as Word, because Word aligns the + // shape with the outer edge of the border, but LibreOffice aligns with the snap rectangle. + // Expected: 0 is wrong. ToDo: The current margin is wrong and needs to be fixed. Then activate + // the test again with the correct margin. + // CPPUNIT_ASSERT_EQUAL(static_cast(0), + // getProperty(xShape, "HoriOrientPosition")); + + // Make sure that "Shape 1 text" (anchored in the header) has the same left margin as the body + // text. + OUString aShapeTextLeft = parseDump("/root/page/header/txt/anchored/fly/infos/bounds", "left"); + OUString aBodyTextLeft = parseDump("/root/page/body/txt/infos/bounds", "left"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1701 + // - Actual : 1815 + // i.e. there was a >0 left margin on the text of the shape, resulting in incorrect horizontal + // position. + CPPUNIT_ASSERT_DOUBLES_EQUAL(aBodyTextLeft.toDouble(), aShapeTextLeft.toDouble(), 1.0); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf120548) +{ + load(mpTestDocumentPath, "tdf120548.docx"); + // Without the accompanying fix in place, this test would have failed with 'Expected: 00ff0000; + // Actual: ffffffff', i.e. the numbering portion was black, not red. + CPPUNIT_ASSERT_EQUAL(OUString("00ff0000"), + parseDump("//Special[@nType='PortionType::Number']/SwFont", "color")); +} + +CPPUNIT_TEST_FIXTURE(Test, test120551) +{ + load(mpTestDocumentPath, "tdf120551.docx"); + auto nHoriOrientPosition = getProperty(getShape(1), "HoriOrientPosition"); + // Without the accompanying fix in place, this test would have failed with + // 'Expected: 430, Actual : -2542'. + // CPPUNIT_ASSERT_EQUAL(static_cast(430), nHoriOrientPosition); + // File 140335EMU = 389,8Hmm + CPPUNIT_ASSERT_EQUAL(static_cast(390), nHoriOrientPosition); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf111550) +{ + load(mpTestDocumentPath, "tdf111550.docx"); + // The test document has following ill-formed structure: + // + // + // ... + // + // + // + // + // [outer:A2] + // + // + // + // + // + // + // + // [inner:A1] + // + // + // + // + // + // + // + // + // + // + // i.e., a as direct child of inside another table. + // Word accepts that illegal OOXML, and treats it as equal to + // + // + // ... + // + // + // + // + // + // + // + // [outer:A2] + // + // + // + // [inner:A1] + // + // + // + // + // + // + // + // + // + // i.e., moves all contents of the outer paragraph into the inner table's first paragraph. + + CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); + + uno::Reference outerTable = getParagraphOrTable(1); + getCell(outerTable, "A1", "[outer:A1]"); + uno::Reference cellA2(getCell(outerTable, "A2"), uno::UNO_QUERY_THROW); + uno::Reference innerTable = getParagraphOrTable(1, cellA2); + getCell(innerTable, "A1", "[outer:A2]\n[inner:A1]"); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf117843) +{ + load(mpTestDocumentPath, "tdf117843.docx"); + uno::Reference xPageStyles = getStyles("PageStyles"); + uno::Reference xPageStyle(xPageStyles->getByName("Standard"), uno::UNO_QUERY); + uno::Reference xHeaderText + = getProperty>(xPageStyle, "HeaderText"); + // This was 4025, increased top paragraph margin was unexpected. + CPPUNIT_ASSERT_EQUAL( + static_cast(0), + getProperty(getParagraphOfText(1, xHeaderText), "ParaTopMargin")); +} + +// related tdf#124754 +CPPUNIT_TEST_FIXTURE(Test, testTdf43017) +{ + load(mpTestDocumentPath, "tdf43017.docx"); + uno::Reference xParagraph = getParagraph(1); + uno::Reference xText = getRun(xParagraph, 2, "kick the bucket"); + + // Ensure that hyperlink text color is not blue (0x0000ff), but default (-1) + CPPUNIT_ASSERT_EQUAL_MESSAGE("Hyperlink color should be black!", sal_Int32(-1), + getProperty(xText, "CharColor")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf127778) +{ + load(mpTestDocumentPath, "tdf127778.docx"); + xmlDocUniquePtr pLayout = parseLayoutDump(); + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 0 + // - Actual : 1 + // i.e. the 2nd page had an unexpected header. + assertXPath(pLayout, "//page[2]/header", 0); +} + +// related tdf#43017 +CPPUNIT_TEST_FIXTURE(Test, testTdf124754) +{ + load(mpTestDocumentPath, "tdf124754.docx"); + uno::Reference textbox(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(1, getParagraphs(textbox)); + + uno::Reference xParagraph = getParagraphOfText(1, textbox); + uno::Reference xText = getRun(xParagraph, 2); + + // Ensure that hyperlink text color is not black + CPPUNIT_ASSERT_EQUAL_MESSAGE("Hyperlink color should be not black!", sal_Int32(353217), + getProperty(xText, "CharColor")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTextCopy) +{ + load(mpTestDocumentPath, "text-copy.docx"); + // The document has a header on the second page that is copied as part of the import process. + // The header has a single paragraph: make sure shapes anchored to it are not lost. + // Note that the single paragraph itself has no text portions. + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference xPara; + while (xParaEnum->hasMoreElements()) + { + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + } + auto aPageStyleName = getProperty(xPara, "PageStyleName"); + uno::Reference xPageStyle( + getStyles("PageStyles")->getByName(aPageStyleName), uno::UNO_QUERY); + auto xHeaderText = getProperty>(xPageStyle, "HeaderText"); + uno::Reference xHeaderPara = getParagraphOfText(1, xHeaderText); + auto aTextPortionType = getProperty(getRun(xHeaderPara, 1), "TextPortionType"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: Frame + // - Actual : Text + // i.e. the second page's header had no anchored shapes. + CPPUNIT_ASSERT_EQUAL(OUString("Frame"), aTextPortionType); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf112443) +{ + load(mpTestDocumentPath, "tdf112443.docx"); + // the position of the flying text frame should be off page + // 30624 below its anchor + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + SwRootFrame* pRootFrame = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + const SwRect aPageRect = pRootFrame->getFrameArea(); + const SwRect aShapeRect(getShape(1)->getPosition().X, getShape(1)->getPosition().Y, + getShape(1)->getSize().Width, getShape(1)->getSize().Height); + CPPUNIT_ASSERT_MESSAGE("The textframe must be off-page!", !aPageRect.Contains(aShapeRect)); + + //OUString aTop = parseDump("//anchored/fly[1]/infos/bounds", "top"); + //CPPUNIT_ASSERT_EQUAL(sal_Int32(30624), aTop.toInt32() ); +} + +// DOCX: Textbox wrap differs in MSO and LO +// Both should layout text regardless of existing text box +// and as result only one page should be generated. +CPPUNIT_TEST_FIXTURE(Test, testTdf113182) +{ + load(mpTestDocumentPath, "tdf113182.docx"); + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testBtlrFrameVml) +{ + load(mpTestDocumentPath, "btlr-frame-vml.docx"); + uno::Reference xTextFrame(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextFrame.is()); + + auto nActual = getProperty(xTextFrame, "WritingMode"); + // Without the accompanying fix in place, this test would have failed with 'Expected: 5; Actual: + // 4', i.e. writing direction was inherited from page, instead of explicit btlr. + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf124398) +{ + load(mpTestDocumentPath, "tdf124398.docx"); + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroup.is()); + // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual: + // 1', i.e. the chart children of the group shape was lost. + CPPUNIT_ASSERT_EQUAL(static_cast(2), xGroup->getCount()); + + uno::Reference xShape(xGroup->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.OLE2Shape"), xShape->getShapeType()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf104167) +{ + load(mpTestDocumentPath, "tdf104167.docx"); + // Make sure that heading 1 paragraphs start on a new page. + uno::Any xStyle = getStyles("ParagraphStyles")->getByName("Heading 1"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 4 + // - Actual : 0 + // i.e. the was lost on import. + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, + getProperty(xStyle, "BreakType")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf113946) +{ + load(mpTestDocumentPath, "tdf113946.docx"); + OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); + // tdf#106792 Checked loading of tdf113946.docx. Before the change, the expected + // value of this test was "1696". Opening the file shows a single short line anchored + // at the doc start. Only diff is that in 'old' version it is slightly rotated, in 'new' + // version line is strict horizontal. Checked against MSWord2013, there the line + // is also not rotated -> the change is to the better, correct the expected result here. + CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf121804) +{ + load(mpTestDocumentPath, "tdf121804.docx"); + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference xShape(xGroup->getByIndex(0), uno::UNO_QUERY); + uno::Reference xFirstPara = getParagraphOfText(1, xShape->getText()); + uno::Reference xFirstRun = getRun(xFirstPara, 1); + CPPUNIT_ASSERT_EQUAL(static_cast(0), + getProperty(xFirstRun, "CharEscapement")); + // This failed with a NoSuchElementException, super/subscript property was + // lost on import, so the whole paragraph was a single run. + uno::Reference xSecondRun = getRun(xFirstPara, 2); + CPPUNIT_ASSERT_EQUAL(static_cast(14000), + getProperty(xSecondRun, "CharEscapement")); + uno::Reference xThirdRun = getRun(xFirstPara, 3); + CPPUNIT_ASSERT_EQUAL(static_cast(-14000), + getProperty(xThirdRun, "CharEscapement")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf114217) +{ + load(mpTestDocumentPath, "tdf114217.docx"); + // This was 1, multi-page table was imported as a floating one. + CPPUNIT_ASSERT_EQUAL(0, getShapes()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf119200) +{ + load(mpTestDocumentPath, "tdf119200.docx"); + auto xPara = getParagraph(1); + // Check that we import MathType functional symbols as symbols, not functions with missing args + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2208 } {}"), getFormula(getRun(xPara, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2209 } {}"), getFormula(getRun(xPara, 2))); + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2282 } {}"), getFormula(getRun(xPara, 3))); + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2283 } {}"), getFormula(getRun(xPara, 4))); + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2284 } {}"), getFormula(getRun(xPara, 5))); + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2286 } {}"), getFormula(getRun(xPara, 6))); + CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2287 } {}"), getFormula(getRun(xPara, 7))); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf115094) +{ + load(mpTestDocumentPath, "tdf115094.docx"); + // anchor of graphic has to be the text in the text frame + // xray ThisComponent.DrawPage(1).Anchor.Text + uno::Reference xShape(getShape(2), uno::UNO_QUERY); + uno::Reference xText1 = xShape->getAnchor()->getText(); + + // xray ThisComponent.TextTables(0).getCellByName("A1") + uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTablesSupplier->getTextTables(), + uno::UNO_QUERY); + uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference xText2(xTable->getCellByName("A1"), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL(xText1.get(), xText2.get()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf115094v2) +{ + load(mpTestDocumentPath, "tdf115094v2.docx"); + // layoutInCell="1" combined with + + CPPUNIT_ASSERT(getProperty(getShapeByName(u"Grafik 18"), "IsFollowingTextFlow")); + CPPUNIT_ASSERT(getProperty(getShapeByName(u"Grafik 19"), "IsFollowingTextFlow")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf122224) +{ + load(mpTestDocumentPath, "tdf122224.docx"); + uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); + uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference xCell(xTable->getCellByName("A2"), uno::UNO_QUERY_THROW); + // This was "** Expression is faulty **", because of the unnecessary DOCX number format string + CPPUNIT_ASSERT_EQUAL(OUString("2000"), xCell->getString()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf121440) +{ + load(mpTestDocumentPath, "tdf121440.docx"); + // Insert some text in front of footnote + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + SwRootFrame* pLayout(pWrtShell->GetLayout()); + CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); + pWrtShell->Insert("test"); + + // Ensure that inserted text is not superscripted + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Inserted text should be not a superscript!", static_cast(0), + getProperty(getRun(getParagraph(1), 1), "CharEscapement")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf124670) +{ + load(mpTestDocumentPath, "tdf124670.docx"); + CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); + // We need to take xml:space attribute into account, even in w:document element + uno::Reference paragraph = getParagraph(1); + CPPUNIT_ASSERT_EQUAL( + OUString("You won't believe, but that's how it was in markup of original bugdoc!"), + paragraph->getString()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf126114) +{ + load(mpTestDocumentPath, "tdf126114.docx"); + // The problem was that after the drop-down form field, also the placeholder string + // was imported as text. Beside the duplication of the field, it also caused a crash. + // the word is from replacement of the drop-down field in ModelToViewHelper + CPPUNIT_ASSERT_EQUAL(OUString("gehuwd\n"), getBodyText()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf127825) +{ + load(mpTestDocumentPath, "tdf127825.docx"); + // The document has a shape with Japanese-style text in it. The shape has relative size and also + // has automatic height. + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + SwRootFrame* pLayout = pWrtShell->GetLayout(); + CPPUNIT_ASSERT(pLayout); + SwFrame* pPage = pLayout->GetLower(); + CPPUNIT_ASSERT(pPage); + SwFrame* pBody = pPage->GetLower(); + CPPUNIT_ASSERT(pBody); + SwFrame* pText = pBody->GetLower(); + CPPUNIT_ASSERT(pText); + CPPUNIT_ASSERT(pText->GetDrawObjs()); + const SwSortedObjs& rDrawObjs = *pText->GetDrawObjs(); + CPPUNIT_ASSERT(rDrawObjs.size()); + + // Without the accompanying fix in place, this overlapped the footer area, not the body area. + CPPUNIT_ASSERT(rDrawObjs[0]->GetObjRect().Overlaps(pBody->getFrameArea())); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf103345) +{ + load(mpTestDocumentPath, "numbering-circle.docx"); + uno::Reference xPropertySet( + getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference xLevels( + xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence aProps; + xLevels->getByIndex(0) >>= aProps; // 1st level + + for (beans::PropertyValue const& prop : std::as_const(aProps)) + { + if (prop.Name == "NumberingType") + { + CPPUNIT_ASSERT_EQUAL(style::NumberingType::CIRCLE_NUMBER, prop.Value.get()); + return; + } + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf125038) +{ + load(mpTestDocumentPath, "tdf125038.docx"); + OUString aActual = getParagraph(1)->getString(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: phone:... + // - Actual : result1result2phone:... + // i.e. the result if the inner MERGEFIELD fields ended up in the body text. + CPPUNIT_ASSERT_EQUAL(OUString("phone: \t1234567890"), aActual); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf125038b) +{ + load(mpTestDocumentPath, "tdf125038b.docx"); + // Load a document with an IF field, where the IF field command contains a paragraph break. + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParagraphAccess(xTextDocument->getText(), + uno::UNO_QUERY); + uno::Reference xParagraphs = xParagraphAccess->createEnumeration(); + CPPUNIT_ASSERT(xParagraphs->hasMoreElements()); + uno::Reference xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: phone: 1234 + // - Actual : + // i.e. the first paragraph was empty and the second paragraph had the content. + CPPUNIT_ASSERT_EQUAL(OUString("phone: 1234"), xParagraph->getString()); + CPPUNIT_ASSERT(xParagraphs->hasMoreElements()); + xParagraphs->nextElement(); + + // Without the accompanying fix in place, this test would have failed with: + // - Expression: !xParagraphs->hasMoreElements() + // i.e. the document had 3 paragraphs, while only 2 was expected. + CPPUNIT_ASSERT(!xParagraphs->hasMoreElements()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf125038c) +{ + load(mpTestDocumentPath, "tdf125038c.docx"); + OUString aActual = getParagraph(1)->getString(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: email: test@test.test + // - Actual : email: + // I.e. the result of the MERGEFIELD field inside an IF field was lost. + CPPUNIT_ASSERT_EQUAL(OUString("email: test@test.test"), aActual); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf130214) +{ + load(mpTestDocumentPath, "tdf130214.docx"); + // Currently this file imports with errors because of tdf#126435; it must not segfault on load +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf129659) +{ + load(mpTestDocumentPath, "tdf129659.docx"); + // don't crash on footnote with page break +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf129912) +{ + load(mpTestDocumentPath, "tdf129912.docx"); + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + // Goto*FootnoteAnchor iterates the footnotes in a ring, so we need the amount of footnotes to stop the loop + sal_Int32 nCount = pWrtShell->GetDoc()->GetFootnoteIdxs().size(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), nCount); + + // the expected footnote labels + // TODO: the 5th label is actually wrong (missing the "PR" after the symbol part), but the "b" is there?! + static constexpr OUStringLiteral pLabel5 = u"\uF0D1\uF031\uF032b"; + const OUString sFootnoteLabels[] + = { OUString(u'\xF0A7'), "1", "2", OUString(u'\xF020'), pLabel5 }; + CPPUNIT_ASSERT_EQUAL(sal_Int32(SAL_N_ELEMENTS(sFootnoteLabels)), nCount); + + pWrtShell->GotoPrevFootnoteAnchor(); + nCount--; + while (nCount >= 0) + { + SwFormatFootnote aFootnoteNote; + CPPUNIT_ASSERT(pWrtShell->GetCurFootnote(&aFootnoteNote)); + OUString sNumStr = aFootnoteNote.GetNumStr(); + if (sNumStr.isEmpty()) + sNumStr = OUString::number(aFootnoteNote.GetNumber()); + CPPUNIT_ASSERT_EQUAL(sFootnoteLabels[nCount], sNumStr); + pWrtShell->GotoPrevFootnoteAnchor(); + nCount--; + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf126426) +{ + load(mpTestDocumentPath, "tdf126426.docx"); + + uno::Reference xGroup(getShape(1), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroup->getCount()); + + // get second shape in group + uno::Reference xRange(xGroup->getByIndex(1), uno::UNO_QUERY_THROW); + uno::Reference xParaEnumAccess(xRange, uno::UNO_QUERY_THROW); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); + uno::Reference xRunEnumAccess(xPara, uno::UNO_QUERY_THROW); + + uno::Reference xRunEnum = xRunEnumAccess->createEnumeration(); + { + // Text before: was before this bugfix + uno::Reference xRun(xRunEnum->nextElement(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("Some text "), xRun->getString()); + } + { + // Link and this content was completely missing before + uno::Reference xRun(xRunEnum->nextElement(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("Link"), xRun->getString()); + auto aURL = getProperty(xRun, "HyperLinkURL"); + CPPUNIT_ASSERT_EQUAL(OUString("http://libreoffice.org/"), aURL); + } + { + // Need to ensure that text following hyperlink is still default color (-1) + uno::Reference xRun(xRunEnum->nextElement(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString(" and something more."), xRun->getString()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty(xRun, "CharColor")); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf119039) +{ + load(mpTestDocumentPath, "tdf119039_bad_embedded_compound.docx"); + // Should not crash/hang because of problematic embedded compound +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf152200) +{ + load(mpTestDocumentPath, "tdf152200-bad_fldChar_end.docx"); + // Should not crash/hang because of wrong placement of ending fldChar +} + +// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3