1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <swmodeltestbase.hxx>
12 #include <com/sun/star/awt/FontUnderline.hpp>
13 #include <com/sun/star/awt/FontWeight.hpp>
14 #include <com/sun/star/beans/NamedValue.hpp>
15 #include <com/sun/star/style/LineSpacing.hpp>
16 #include <com/sun/star/style/LineSpacingMode.hpp>
17 #include <com/sun/star/table/ShadowFormat.hpp>
18 #include <com/sun/star/text/RelOrientation.hpp>
19 #include <com/sun/star/text/TableColumnSeparator.hpp>
20 #include <com/sun/star/text/XDependentTextField.hpp>
21 #include <com/sun/star/text/XDocumentIndex.hpp>
22 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
23 #include <com/sun/star/text/XFootnotesSupplier.hpp>
24 #include <com/sun/star/text/XFootnote.hpp>
25 #include <com/sun/star/text/XTextContentAppend.hpp>
26 #include <com/sun/star/text/XTextDocument.hpp>
27 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
28 #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
29 #include <com/sun/star/text/XTextTable.hpp>
30 #include <com/sun/star/text/XTextTablesSupplier.hpp>
32 #include <comphelper/sequenceashashmap.hxx>
33 #include <oox/drawingml/drawingmltypes.hxx>
34 #include <unotools/fltrcfg.hxx>
35 #include <o3tl/string_view.hxx>
37 using namespace com::sun::star
;
39 class Test
: public SwModelTestBase
42 Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
45 DECLARE_OOXMLEXPORT_TEST(Tdf130907
, "tdf130907.docx")
47 uno::Reference
<text::XTextRange
> xPara1
= getParagraph(2);
48 CPPUNIT_ASSERT(xPara1
.is());
49 uno::Reference
<beans::XPropertySet
> xFormula1Props(xPara1
, uno::UNO_QUERY
);
50 CPPUNIT_ASSERT(xFormula1Props
.is());
52 xFormula1Props
->getPropertyValue("ParaAdjust") >>= nHOri1
;
53 CPPUNIT_ASSERT_EQUAL_MESSAGE("The alignment of the equation is not left!",
54 sal_Int16(style::ParagraphAdjust::ParagraphAdjust_LEFT
), nHOri1
);
56 uno::Reference
<text::XTextRange
> xPara2
= getParagraph(3);
57 CPPUNIT_ASSERT(xPara2
.is());
58 uno::Reference
<beans::XPropertySet
> xFormula2Props(xPara2
, uno::UNO_QUERY
);
59 CPPUNIT_ASSERT(xFormula2Props
.is());
61 xFormula2Props
->getPropertyValue("ParaAdjust") >>= nHOri2
;
62 CPPUNIT_ASSERT_EQUAL_MESSAGE("The alignment of the equation is not center!",
63 sal_Int16(style::ParagraphAdjust::ParagraphAdjust_CENTER
), nHOri2
);
65 uno::Reference
<text::XTextRange
> xPara3
= getParagraph(5);
66 CPPUNIT_ASSERT(xPara3
.is());
67 uno::Reference
<beans::XPropertySet
> xFormula3Props(xPara3
, uno::UNO_QUERY
);
68 CPPUNIT_ASSERT(xFormula3Props
.is());
70 xFormula3Props
->getPropertyValue("ParaAdjust") >>= nHOri3
;
71 CPPUNIT_ASSERT_EQUAL_MESSAGE("The alignment of the equation is not right!",
72 sal_Int16(style::ParagraphAdjust::ParagraphAdjust_RIGHT
), nHOri3
);
75 CPPUNIT_TEST_FIXTURE(Test
, testTdf128197
)
77 createSwDoc("128197_compat14.docx");
78 xmlDocUniquePtr pLayout14
= parseLayoutDump();
79 sal_Int32 nHeight14
= getXPath(pLayout14
, "//page[1]/body/txt[1]/infos/bounds", "height").toInt32();
81 createSwDoc("128197_compat15.docx");
82 xmlDocUniquePtr pLayout15
= parseLayoutDump();
83 sal_Int32 nHeight15
= getXPath(pLayout15
, "//page[1]/body/txt[1]/infos/bounds", "height").toInt32();
85 // In compat mode=14 second line has size of the shape thus entire paragraph height is smaller
86 // So nHeight14 < nHeight15
87 CPPUNIT_ASSERT_LESS(nHeight15
, nHeight14
);
90 CPPUNIT_TEST_FIXTURE(Test
, testTdf135595_HFtableWrap
)
92 loadAndReload("tdf135595_HFtableWrap.odt");
93 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
94 sal_Int32 nRowHeight
= getXPath(pXmlDoc
, "//page[1]/header/tab/row/infos/bounds", "height").toInt32();
95 // tdf#77794: always force bLayoutInCell from false to true for MSO2013+
96 // The fly is supposed to be inside the cell. Before, height was 998. Now it is 2839.
97 CPPUNIT_ASSERT_MESSAGE("Image must be contained inside the table cell", nRowHeight
> 2000);
100 DECLARE_OOXMLEXPORT_TEST(testTdf135943_shapeWithText_L0c15
,
101 "tdf135943_shapeWithText_LayoutInCell0_compat15.docx")
103 // With compat15, layoutinCell ought to be ignored/forced to true.
104 // HOWEVER, currently only the shape is correctly placed, while its text is un-synced separately.
105 // So to prevent this ugly mess, just leave everything together in the historical (wrong) spot.
106 xmlDocUniquePtr pDump
= parseLayoutDump();
107 sal_Int32 nFrameLeft
= getXPath(pDump
, "//anchored/SwAnchoredDrawObject/bounds", "left").toInt32();
108 sal_Int32 nFrameRight
= getXPath(pDump
, "//anchored/SwAnchoredDrawObject/bounds", "right").toInt32();
109 sal_Int32 nTextLeft
= getXPath(pDump
, "//anchored/fly/infos/bounds", "left").toInt32();
110 sal_Int32 nTextRight
= getXPath(pDump
, "//anchored/fly/infos/bounds", "right").toInt32();
111 // The text must be inside of its frame boundaries
112 CPPUNIT_ASSERT(nFrameRight
>= nTextRight
);
113 CPPUNIT_ASSERT(nFrameLeft
<= nTextLeft
);
114 // LayoutInCell: The text must fit inside cell A1 //cell[1]/info/bounds/right = 4703
115 //CPPUNIT_ASSERT(nTextRight < 4704);
117 uno::Reference
<beans::XPropertySet
> xShapeProperties(getShape(1), uno::UNO_QUERY
);
119 xShapeProperties
->getPropertyValue("IsFollowingTextFlow") >>= bValue
;
120 CPPUNIT_ASSERT_EQUAL_MESSAGE("YOU FIXED ME? LayoutInCell ought to be true", false, bValue
);
123 DECLARE_OOXMLEXPORT_TEST(testTdf135595_HFtableWrap_c12
, "tdf135595_HFtableWrap_c12.docx")
125 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
126 // tdf#104596: ignore wrap exception apparently does not apply if it is not "layout in table cell".
127 // Should be only one page. Row height should be two lines at 722, not wrapped to three lines at 998.
128 sal_Int32 nRowHeight
= getXPath(pXmlDoc
, "//header/tab/row/infos/bounds", "height").toInt32();
129 CPPUNIT_ASSERT_MESSAGE("Text must not wrap around header image", nRowHeight
< 800);
132 DECLARE_OOXMLEXPORT_TEST(testTdf151704_thinColumnHeight
, "tdf151704_thinColumnHeight.docx")
134 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
135 sal_Int32 nRowHeightT1
= getXPath(
136 pXmlDoc
, "//page[1]/body/tab[1]/row/cell/tab[1]/row[1]/infos/bounds", "height").toInt32();
137 sal_Int32 nRowHeightT2
= getXPath(
138 pXmlDoc
, "//page[2]/body/tab/row[1]/infos/bounds", "height").toInt32();
139 CPPUNIT_ASSERT_EQUAL_MESSAGE("Same row height in both tables", nRowHeightT1
, nRowHeightT2
);
142 DECLARE_OOXMLEXPORT_TEST(testTdf123622
, "tdf123622.docx")
144 uno::Reference
<beans::XPropertySet
> XPropsRight(getShape(1),uno::UNO_QUERY
);
145 sal_Int16 nRelativePosR
= 0;
146 XPropsRight
->getPropertyValue("HoriOrientRelation")>>=nRelativePosR
;
147 CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape inside the margin", sal_Int16(4), nRelativePosR
);
149 uno::Reference
<beans::XPropertySet
> XPropsLeft(getShape(2), uno::UNO_QUERY
);
150 sal_Int16 nRelativePosL
= 0;
151 XPropsLeft
->getPropertyValue("HoriOrientRelation") >>= nRelativePosL
;
152 CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape inside the margin", sal_Int16(3), nRelativePosL
);
155 CPPUNIT_TEST_FIXTURE(Test
, testTdf78749
)
157 loadAndReload("tdf78749.docx");
158 //Shape lost the background image before, now check if it still has...
159 auto xShape
= getShape(1);
160 uno::Reference
<beans::XPropertySet
> xShpProps(xShape
, uno::UNO_QUERY
);
161 OUString aPropertyVal
;
162 xShpProps
->getPropertyValue("FillBitmapName") >>= aPropertyVal
;
163 CPPUNIT_ASSERT(!aPropertyVal
.isEmpty());
166 CPPUNIT_TEST_FIXTURE(Test
, testTdf128207
)
168 loadAndSave("tdf128207.docx");
169 //There was the charts on each other, because their horizontal and vertical position was 0!
170 xmlDocUniquePtr p_XmlDoc
= parseExport("word/document.xml");
171 CPPUNIT_ASSERT(p_XmlDoc
);
172 assertXPathContent(p_XmlDoc
, "/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset", "4445");
175 CPPUNIT_TEST_FIXTURE(Test
, testTdf123873
)
177 loadAndSave("tdf123873.docx");
178 //OLE Object were overlapped due to missing wrap import
179 xmlDocUniquePtr p_XmlDoc
= parseExport("word/document.xml");
180 CPPUNIT_ASSERT(p_XmlDoc
);
182 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom");
185 CPPUNIT_TEST_FIXTURE(Test
, Tdf133065
)
187 loadAndSave("tdf133065.odt");
188 CPPUNIT_ASSERT_EQUAL(7, getShapes());
189 CPPUNIT_ASSERT_EQUAL(3, getPages());
190 auto pxmldoc
= parseExport("word/document.xml");
191 CPPUNIT_ASSERT(pxmldoc
);
194 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[3]/w:r[2]/w:object/v:shape/w10:wrap", "type");
195 CPPUNIT_ASSERT(aVal
.indexOf("square") > -1);
196 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[3]/w:r[2]/w:object/v:shape/w10:wrap", "side");
197 CPPUNIT_ASSERT(aVal
.indexOf("left") > -1);
199 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[8]/w:r[2]/w:object/v:shape/w10:wrap", "type");
200 CPPUNIT_ASSERT(aVal
.indexOf("square") > -1);
201 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[8]/w:r[2]/w:object/v:shape/w10:wrap", "side");
202 CPPUNIT_ASSERT(aVal
.indexOf("right") > -1);
204 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[12]/w:r[2]/w:object/v:shape/w10:wrap", "type");
205 CPPUNIT_ASSERT(aVal
.indexOf("square") > -1);
206 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[12]/w:r[2]/w:object/v:shape/w10:wrap", "side");
207 CPPUNIT_ASSERT(aVal
.indexOf("largest") > -1);
209 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[20]/w:r[2]/w:object/v:shape/w10:wrap", "type");
210 CPPUNIT_ASSERT(aVal
.indexOf("topAndBottom") > -1);
212 aVal
= getXPath(pxmldoc
, "/w:document/w:body/w:p[24]/w:r[2]/w:object/v:shape/w10:wrap", "type");
213 CPPUNIT_ASSERT(aVal
.indexOf("square") > -1);
216 DECLARE_OOXMLEXPORT_TEST(testTdf130814model
, "tdf130814.docx")
218 CPPUNIT_ASSERT_EQUAL(Color(0x1F497D), getProperty
<Color
>(getRun(getParagraph(2), 1), "CharColor"));
219 CPPUNIT_ASSERT_EQUAL(double(16), getProperty
<double>(getRun(getParagraph(2), 1), "CharHeight"));
220 CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::SINGLE
, getProperty
<sal_Int16
>(getRun(getParagraph(2), 1), "CharUnderline"));
221 CPPUNIT_ASSERT_EQUAL(OUString("Candara"), getProperty
<OUString
>(getRun(getParagraph(2), 1), "CharFontName"));
222 CPPUNIT_ASSERT_EQUAL(OUString("Arial Unicode MS"), getProperty
<OUString
>(getRun(getParagraph(2), 1), "CharFontNameAsian"));
225 CPPUNIT_TEST_FIXTURE(Test
, testTdf107020
)
227 loadAndSave("tdf107020.docx");
230 xmlDocUniquePtr p_XmlDoc
= parseExport("word/document.xml");
231 CPPUNIT_ASSERT(p_XmlDoc
);
233 p_XmlDoc
, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:srcRect", "l", "4910");
235 p_XmlDoc
, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:srcRect", "t", "27183");
237 p_XmlDoc
, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:srcRect", "r", "57638");
239 p_XmlDoc
, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:srcRect", "b", "48360");
242 CPPUNIT_TEST_FIXTURE(Test
, testTdf130814ooxml
)
244 loadAndSave("tdf130814.docx");
245 xmlDocUniquePtr p_XmlDoc
= parseExport("word/document.xml");
246 CPPUNIT_ASSERT(p_XmlDoc
);
248 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:rFonts", "eastAsia", "Arial Unicode MS");
250 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:rFonts", "ascii", "Candara");
252 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:rFonts", "hAnsi", "Candara");
254 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:color", "val", "1F497D");
256 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:sz", "val", "32");
258 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:szCs", "val", "32");
260 p_XmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:u", "val", "single");
263 DECLARE_OOXMLEXPORT_TEST(testTdf129888vml
, "tdf129888vml.docx")
265 //the line shape has anchor in the first cell however it has to
266 //be positioned to an another cell. To reach this we must handle
267 //the o:allowincell attribute of the shape, and its position has
268 //to be calculated from the page frame instead of the table:
270 uno::Reference
<beans::XPropertySet
> xShapeProperties(getShape(1), uno::UNO_QUERY
);
272 xShapeProperties
->getPropertyValue("IsFollowingTextFlow") >>= bValue
;
273 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888vml The line shape has bad place!",
277 DECLARE_OOXMLEXPORT_TEST(testTdf129888dml
, "tdf129888dml.docx")
279 //the shape has anchor in the first cell however it has to
280 //be positioned to the right side of the page. To reach this we must handle
281 //the layoutInCell attribute of the shape, and its position has
282 //to be calculated from the page frame instead of the table:
284 uno::Reference
<beans::XPropertySet
> xShapeProperties(getShape(1), uno::UNO_QUERY
);
286 xShapeProperties
->getPropertyValue("IsFollowingTextFlow") >>= bValue
;
287 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888dml The shape has bad place!",
291 CPPUNIT_TEST_FIXTURE(Test
, testTdf130120
)
293 loadAndSave("tdf130120.docx");
294 // Text for exporting the allowincell attribute:
295 xmlDocUniquePtr p_XmlDoc
= parseExport("word/document.xml");
296 assertXPath(p_XmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/"
297 "mc:Choice/w:drawing/wp:anchor", "layoutInCell", "0");
300 CPPUNIT_TEST_FIXTURE(Test
, Tdf133030
)
302 loadAndSave("tdf133030.docx");
303 auto pExport
= parseExport("word/document.xml");
304 CPPUNIT_ASSERT(pExport
);
306 assertXPath(pExport
, "/w:document/w:body/w:p[3]/m:oMathPara/m:oMathParaPr/m:jc", "val", "center");
307 assertXPath(pExport
, "/w:document/w:body/w:p[5]/m:oMathPara/m:oMathParaPr/m:jc", "val", "left");
308 assertXPath(pExport
, "/w:document/w:body/w:p[7]/m:oMathPara/m:oMathParaPr/m:jc", "val", "right");
311 DECLARE_OOXMLEXPORT_TEST(testTdf87569v
, "tdf87569_vml.docx")
313 //the original tdf87569 sample has vml shapes...
314 uno::Reference
<beans::XPropertySet
> xShapeProperties(getShape(1), uno::UNO_QUERY
);
316 xShapeProperties
->getPropertyValue("IsFollowingTextFlow") >>= bValue
;
317 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_vml: The Shape is not in the table!",
321 DECLARE_OOXMLEXPORT_TEST(testTdf133000_numStyleFormatting
, "tdf133000_numStyleFormatting.docx")
323 // Paragraph style's LeftMargin should not override numbering's Left Margin
324 xmlDocUniquePtr pDump
= parseLayoutDump();
325 assertXPathContent(pDump
, "/root/page[1]/body/txt[2]", "First line");
326 const sal_Int32 nLevel1Margin
= getXPath(pDump
, "//page[1]/body/txt[2]/infos/prtBounds", "left").toInt32();
327 assertXPathContent(pDump
, "/root/page[1]/body/txt[4]", "One sublevel");
328 const sal_Int32 nLevel2Margin
= getXPath(pDump
, "//page[1]/body/txt[4]/infos/prtBounds", "left").toInt32();
329 CPPUNIT_ASSERT( nLevel1Margin
< nLevel2Margin
);
332 DECLARE_OOXMLEXPORT_TEST(testTdf134260
, "tdf134260.docx")
334 // Without the accompanying fix in place, this test would have failed with:
339 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
341 CPPUNIT_ASSERT_EQUAL(
343 comphelper::SequenceAsHashMap(xNum1Levels
->getByIndex(0))["ListtabStopPosition"]
347 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(2), "NumberingRules");
349 CPPUNIT_ASSERT_EQUAL(
351 comphelper::SequenceAsHashMap(xNum2Levels
->getByIndex(0))["ListtabStopPosition"]
355 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(3), "NumberingRules");
357 CPPUNIT_ASSERT_EQUAL(
359 comphelper::SequenceAsHashMap(xNum3Levels
->getByIndex(0))["ListtabStopPosition"]
363 DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering
, "arabic-zero-numbering.docx")
366 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
367 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
368 // Without the accompanying fix in place, this test would have failed with:
371 // i.e. numbering type was ARABIC, not ARABIC_ZERO.
372 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO
),
373 aMap
["NumberingType"].get
<sal_uInt16
>());
376 DECLARE_ODFEXPORT_TEST(testArabicZero3Numbering
, "arabic-zero3-numbering.docx")
379 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
380 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
381 // Without the accompanying fix in place, this test would have failed with:
384 // i.e. numbering type was ARABIC, not ARABIC_ZERO3.
385 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO3
),
386 aMap
["NumberingType"].get
<sal_uInt16
>());
389 DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering
, "arabic-zero4-numbering.docx")
392 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
393 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
394 // Without the accompanying fix in place, this test would have failed with:
397 // i.e. numbering type was ARABIC, not ARABIC_ZERO4.
398 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO4
),
399 aMap
["NumberingType"].get
<sal_uInt16
>());
402 DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering
, "arabic-zero5-numbering.docx")
405 = getProperty
<uno::Reference
<container::XIndexAccess
>>(getParagraph(1), "NumberingRules");
406 comphelper::SequenceAsHashMap
aMap(xNumberingRules
->getByIndex(0));
407 // Without the accompanying fix in place, this test would have failed with:
410 // i.e. numbering type was ARABIC, not ARABIC_ZERO5.
411 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing
<sal_uInt16
>(style::NumberingType::ARABIC_ZERO5
),
412 aMap
["NumberingType"].get
<sal_uInt16
>());
415 CPPUNIT_TEST_FIXTURE(Test
, testArabicZeroNumberingFootnote
)
417 // Create a document, set footnote numbering type to ARABIC_ZERO.
419 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
420 uno::Reference
<beans::XPropertySet
> xFootnoteSettings
421 = xFootnotesSupplier
->getFootnoteSettings();
422 sal_uInt16 nNumberingType
= style::NumberingType::ARABIC_ZERO
;
423 xFootnoteSettings
->setPropertyValue("NumberingType", uno::Any(nNumberingType
));
425 // Insert a footnote.
426 uno::Reference
<lang::XMultiServiceFactory
> xFactory(mxComponent
, uno::UNO_QUERY
);
427 uno::Reference
<text::XTextContent
> xFootnote(
428 xFactory
->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY
);
429 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
430 uno::Reference
<text::XTextContentAppend
> xTextContentAppend(xTextDocument
->getText(),
432 xTextContentAppend
->appendTextContent(xFootnote
, {});
434 saveAndReload("Office Open XML Text");
436 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
437 // Without the accompanying fix in place, this test would have failed with:
438 // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect
439 // because the exporter had no idea what markup to use for ARABIC_ZERO.
440 assertXPath(pXmlDoc
, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "decimalZero");
443 CPPUNIT_TEST_FIXTURE(Test
, testChicagoNumberingFootnote
)
445 // Create a document, set footnote numbering type to SYMBOL_CHICAGO.
447 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
448 uno::Reference
<beans::XPropertySet
> xFootnoteSettings
449 = xFootnotesSupplier
->getFootnoteSettings();
450 sal_uInt16 nNumberingType
= style::NumberingType::SYMBOL_CHICAGO
;
451 xFootnoteSettings
->setPropertyValue("NumberingType", uno::Any(nNumberingType
));
453 // Insert a footnote.
454 uno::Reference
<lang::XMultiServiceFactory
> xFactory(mxComponent
, uno::UNO_QUERY
);
455 uno::Reference
<text::XTextContent
> xFootnote(
456 xFactory
->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY
);
457 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
458 uno::Reference
<text::XTextContentAppend
> xTextContentAppend(xTextDocument
->getText(),
460 xTextContentAppend
->appendTextContent(xFootnote
, {});
462 saveAndReload("Office Open XML Text");
464 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
465 // Without the accompanying fix in place, this test would have failed with:
466 // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect
467 // because the exporter had no idea what markup to use for SYMBOL_CHICAGO.
468 assertXPath(pXmlDoc
, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "chicago");
471 CPPUNIT_TEST_FIXTURE(Test
, testListNotCountedIndent
)
473 loadAndReload("list_notcounted_indent.fodt");
474 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
475 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId", "val", "0");
477 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[1]/w:pPr/w:ind", "start", "0");
478 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[1]/w:pPr/w:ind", "end", "0");
479 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[1]/w:pPr/w:ind", "hanging", "0");
480 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:numId", "val", "2");
481 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:pPr/w:ind", 0);
482 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[3]/w:pPr/w:numPr/w:numId", "val", "0");
484 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[3]/w:pPr/w:ind", "start", "720");
485 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[3]/w:pPr/w:ind", "hanging", "0");
486 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[4]/w:pPr/w:numPr/w:numId", "val", "0");
488 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[4]/w:pPr/w:ind", "start", "0");
489 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[4]/w:pPr/w:ind", "end", "0");
490 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[4]/w:pPr/w:ind", "hanging", "0");
491 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[5]/w:pPr/w:numPr/w:numId", "val", "0");
493 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[5]/w:pPr/w:ind", "start", "0");
494 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[5]/w:pPr/w:ind", "end", "0");
495 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[5]/w:pPr/w:ind", "hanging", "0");
498 DECLARE_OOXMLEXPORT_TEST(testTdf87569d
, "tdf87569_drawingml.docx")
500 //if the original tdf87569 sample is upgraded it will have drawingml shapes...
501 uno::Reference
<beans::XPropertySet
> xShapeProperties(getShape(1), uno::UNO_QUERY
);
503 xShapeProperties
->getPropertyValue("IsFollowingTextFlow") >>= bValue
;
504 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_drawingml: The Shape is not in the table!",
508 CPPUNIT_TEST_FIXTURE(Test
, testTdf130610
)
510 loadAndReload("tdf130610_bold_in_2_styles.ott");
511 CPPUNIT_ASSERT_EQUAL(1, getPages());
512 // check character properties
514 uno::Reference
<beans::XPropertySet
> xStyle(
515 getStyles("CharacterStyles")->getByName("WollMuxRoemischeZiffer"),
517 CPPUNIT_ASSERT_EQUAL_MESSAGE("Bold", awt::FontWeight::BOLD
, getProperty
<float>(xStyle
, "CharWeight"));
520 // check paragraph properties
522 uno::Reference
<beans::XPropertySet
> xStyle(
523 getStyles("ParagraphStyles")->getByName("WollMuxVerfuegungspunkt"),
525 CPPUNIT_ASSERT_EQUAL_MESSAGE("Bold", awt::FontWeight::BOLD
, getProperty
<float>(xStyle
, "CharWeight"));
528 // check inline text properties
532 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
533 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r/w:rPr/w:b");
538 CPPUNIT_TEST_FIXTURE(Test
, testTdf121045
)
540 loadAndSave("tdf121045.docx");
541 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
542 CPPUNIT_ASSERT(pXmlDoc
);
543 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:sz", "val", "20");
544 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:szCs", "val", "20");
545 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[1]/w:fldChar", "fldCharType", "begin");
546 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:instrText", 1);
547 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[3]/w:fldChar", "fldCharType", "separate");
548 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[5]/w:fldChar", "fldCharType", "end");
549 // form control keeps its direct formatted font size
550 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:rPr/w:sz", "val", "20");
551 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:rPr/w:szCs", "val", "20");
552 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[3]/w:rPr/w:sz", "val", "20");
553 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[3]/w:rPr/w:szCs", "val", "20");
554 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[4]/w:rPr/w:sz", "val", "20");
555 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[4]/w:rPr/w:szCs", "val", "20");
556 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[5]/w:rPr/w:sz", "val", "20");
557 assertXPath(pXmlDoc
, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[5]/w:rPr/w:szCs", "val", "20");
560 DECLARE_OOXMLEXPORT_TEST(testTdf78352
, "tdf78352.docx")
562 CPPUNIT_ASSERT_EQUAL(1, getPages());
564 // Ensure that width of first tab is close to zero (previous value was ~1000 twips)
565 int nWidth
= parseDump("/root/page/body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']", "width").toInt32();
566 CPPUNIT_ASSERT_LESS(150, nWidth
);
569 CPPUNIT_TEST_FIXTURE(Test
, testTdf81567
)
571 loadAndReload("tdf81567.odt");
572 CPPUNIT_ASSERT_EQUAL(1, getPages());
573 CPPUNIT_ASSERT_EQUAL(2, getShapes());
575 int nFrameWidth
= parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "width").toInt32();
576 CPPUNIT_ASSERT_EQUAL(2371, nFrameWidth
);
578 int nFrameHeight
= parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "height").toInt32();
579 CPPUNIT_ASSERT_EQUAL(3520, nFrameHeight
);
581 int nFrameTop
= parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "top").toInt32();
582 CPPUNIT_ASSERT_EQUAL(1518, nFrameTop
);
584 int nImageWidth
= parseDump("/root/page/body/txt/anchored/fly/txt/anchored/fly/infos/bounds", "width").toInt32();
585 CPPUNIT_ASSERT_EQUAL(2370, nImageWidth
);
587 int nImageHeight
= parseDump("/root/page/body/txt/anchored/fly/txt/anchored/fly/infos/bounds", "height").toInt32();
588 CPPUNIT_ASSERT_EQUAL(1605, nImageHeight
);
590 // Check the image is at the top of the frame
591 // Without the fix in place, this test would have failed with:
594 int nImageTop
= parseDump("/root/page/body/txt/anchored/fly/txt/anchored/fly/infos/bounds", "top").toInt32();
595 CPPUNIT_ASSERT_EQUAL(1638, nImageTop
);
598 CPPUNIT_TEST_FIXTURE(Test
, testTdf92472
)
600 loadAndSave("tdf92472.docx");
601 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
602 CPPUNIT_ASSERT(pXmlDoc
);
603 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:sz", "val", "20");
604 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:szCs", "val", "20");
605 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[1]/w:fldChar", "fldCharType", "begin");
606 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText", 1);
607 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[3]/w:fldChar", "fldCharType", "separate");
608 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[5]/w:fldChar", "fldCharType", "end");
609 // form control keeps its direct formatted font size
610 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[2]/w:rPr/w:sz", "val", "20");
611 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[2]/w:rPr/w:szCs", "val", "20");
612 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[3]/w:rPr/w:sz", "val", "20");
613 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[3]/w:rPr/w:szCs", "val", "20");
614 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[4]/w:rPr/w:sz", "val", "20");
615 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[4]/w:rPr/w:szCs", "val", "20");
616 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[5]/w:rPr/w:sz", "val", "20");
617 assertXPath(pXmlDoc
, "/w:document/w:body/w:p[2]/w:r[5]/w:rPr/w:szCs", "val", "20");
620 CPPUNIT_TEST_FIXTURE(Test
, Tdf133035
)
622 loadAndSave("tdf133035.docx");
623 auto pxml
= parseExport("word/document.xml");
624 CPPUNIT_ASSERT(pxml
);
625 OUString aXmlVal
= getXPath(pxml
, "/w:document/w:body/w:p[1]/w:r[1]/w:object/v:shape", "style");
626 CPPUNIT_ASSERT(aXmlVal
.indexOf("margin-left:186.6pt") > -1);
629 DECLARE_OOXMLEXPORT_TEST(testTdf131260
, "tdf131260.docx")
631 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
632 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(),
634 // Without the accompanying fix in place, this test would have failed with:
637 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTables
->getCount());
639 DECLARE_OOXMLEXPORT_TEST(testTdf120315
, "tdf120315.docx")
641 // tdf#120315 cells of the second column weren't vertically merged
642 // because their horizontal positions are different a little bit
643 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
644 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(),
646 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
647 uno::Reference
<table::XTableRows
> xTableRows
= xTextTable
->getRows();
648 CPPUNIT_ASSERT_EQUAL(getProperty
<uno::Sequence
<text::TableColumnSeparator
>>(
649 xTableRows
->getByIndex(0), "TableColumnSeparators")[0]
651 getProperty
<uno::Sequence
<text::TableColumnSeparator
>>(
652 xTableRows
->getByIndex(1), "TableColumnSeparators")[2]
656 DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults
, "tdf108350_noFontdefaults.docx")
658 uno::Reference
< container::XNameAccess
> paragraphStyles
= getStyles("ParagraphStyles");
659 uno::Reference
< beans::XPropertySet
> xStyleProps(paragraphStyles
->getByName("NoParent"), uno::UNO_QUERY
);
660 CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), getProperty
<OUString
>(xStyleProps
, "CharFontName"));
661 //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty<float>(xStyleProps, "CharHeight"));
664 CPPUNIT_TEST_FIXTURE(Test
, testTdf123116_oversizedRowSplit
)
666 loadAndReload("tdf123116_oversizedRowSplit.odt");
667 // Intentionally require a very non-backward-compatible, natural continuation of the table
668 // instead of an ugly "page break" like MS Word does (and LO used to do).
669 CPPUNIT_ASSERT_EQUAL_MESSAGE("Row splits over 4 pages", 4, getPages());
672 DECLARE_OOXMLEXPORT_TEST(testPageContentBottom
, "page-content-bottom.docx")
674 uno::Reference
<beans::XPropertySet
> xShape(getShape(1), uno::UNO_QUERY
);
675 sal_Int16 nExpected
= text::RelOrientation::PAGE_PRINT_AREA_BOTTOM
;
676 // Without the accompanying fix in place, this test would have failed with:
677 // - Expected: 10 (PAGE_PRINT_AREA_BOTTOM)
678 // - Actual : 0 (FRAME)
679 // i.e. the bottom-of-body relation was lost.
680 CPPUNIT_ASSERT_EQUAL(nExpected
, getProperty
<sal_Int16
>(xShape
, "VertOrientRelation"));
683 CPPUNIT_TEST_FIXTURE(Test
, testTdf129522_removeShadowStyle
)
685 loadAndReload("tdf129522_removeShadowStyle.odt");
686 CPPUNIT_ASSERT_EQUAL(1, getPages());
687 uno::Reference
< container::XNameAccess
> paragraphStyles
= getStyles("ParagraphStyles");
688 uno::Reference
< beans::XPropertySet
> xStyleProps(paragraphStyles
->getByName("Shadow"), uno::UNO_QUERY_THROW
);
689 table::ShadowFormat aShadow
= getProperty
<table::ShadowFormat
>(xStyleProps
, "ParaShadowFormat");
690 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT
, aShadow
.Location
);
692 // Shadows were inherited regardless of whether the style disabled them.
693 xStyleProps
.set(paragraphStyles
->getByName("Shadow-removed"), uno::UNO_QUERY_THROW
);
694 aShadow
= getProperty
<table::ShadowFormat
>(xStyleProps
, "ParaShadowFormat");
695 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE
, aShadow
.Location
);
697 uno::Reference
< container::XNameAccess
> characterStyles
= getStyles("CharacterStyles");
698 xStyleProps
.set(characterStyles
->getByName("CharShadow"), uno::UNO_QUERY_THROW
);
699 aShadow
= getProperty
<table::ShadowFormat
>(xStyleProps
, "CharShadowFormat");
700 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT
, aShadow
.Location
);
702 xStyleProps
.set(characterStyles
->getByName("CharShadow-removed"), uno::UNO_QUERY_THROW
);
703 aShadow
= getProperty
<table::ShadowFormat
>(xStyleProps
, "CharShadowFormat");
704 CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_NONE
, aShadow
.Location
);
707 DECLARE_OOXMLEXPORT_TEST(testTdf130167_spilloverHeaderShape
, "testTdf130167_spilloverHeader.docx")
709 uno::Reference
<text::XTextGraphicObjectsSupplier
> xTextGraphicObjectsSupplier(mxComponent
, uno::UNO_QUERY
);
710 uno::Reference
<container::XIndexAccess
> xNameAccess(
711 xTextGraphicObjectsSupplier
->getGraphicObjects(), uno::UNO_QUERY
);
712 // graphics from discarded headers were being added to the text body. Reduced from 5 to 2 shapes overall.
713 // CPPUNIT_ASSERT(xNameAccess->getCount() <= 4); -> What about hidden headers?
714 CPPUNIT_ASSERT_LESS(sal_Int32(9), xNameAccess
->getCount());
717 DECLARE_OOXMLEXPORT_TEST(testTdf124986
, "tdf124986.docx")
719 // Load a document with SET fields, where the SET fields contain leading/trailing quotation marks and spaces.
720 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
721 uno::Reference
<container::XEnumerationAccess
> xFieldsAccess(xTextFieldsSupplier
->getTextFields());
722 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
724 while (xFields
->hasMoreElements())
726 uno::Reference
<lang::XServiceInfo
> xServiceInfo(xFields
->nextElement(), uno::UNO_QUERY
);
727 uno::Reference
<beans::XPropertySet
> xPropertySet(xServiceInfo
, uno::UNO_QUERY
);
728 if (xServiceInfo
->supportsService("com.sun.star.text.TextField.SetExpression"))
731 xPropertySet
->getPropertyValue("Content") >>= aValue
;
732 CPPUNIT_ASSERT_EQUAL(OUString("demo"), aValue
);
737 DECLARE_OOXMLEXPORT_TEST(testTdf83309
, "tdf83309.docx")
739 // Important: bug case had 4 pages
740 CPPUNIT_ASSERT_EQUAL(2, getPages());
742 // First paragraph does not have tab before
743 // (same applies to all paragraphs in doc, but lets assume they are
745 OUString sNodeType
= parseDump("(/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*)[1]", "type");
746 CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Text"), sNodeType
);
748 // tdf148380: creation-date field in header.xml was unsupported on export
749 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(mxComponent
, uno::UNO_QUERY
);
750 auto xFieldsAccess(xTextFieldsSupplier
->getTextFields());
751 uno::Reference
<container::XEnumeration
> xFields(xFieldsAccess
->createEnumeration());
752 uno::Reference
<text::XTextField
> xField(xFields
->nextElement(), uno::UNO_QUERY
);
753 CPPUNIT_ASSERT_EQUAL(OUString("8/31/14 10:26 AM"), xField
->getPresentation(false));
756 CPPUNIT_TEST_FIXTURE(Test
, testTdf121661
)
758 loadAndSave("tdf121661.docx");
759 xmlDocUniquePtr pXmlSettings
= parseExport("word/settings.xml");
760 assertXPath(pXmlSettings
, "/w:settings/w:hyphenationZone", "val", "851");
763 uno::Reference
<beans::XPropertySet
> xStyle(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY
);
765 CPPUNIT_ASSERT_GREATER( static_cast<sal_Int16
>(0), getProperty
<sal_Int16
>(xStyle
, "ParaHyphenationZone"));
768 DECLARE_OOXMLEXPORT_TEST(testTdf149421
, "tdf121661.docx")
770 uno::Reference
<beans::XPropertySet
> xStyle(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY
);
772 CPPUNIT_ASSERT_GREATER( static_cast<sal_Int16
>(0), getProperty
<sal_Int16
>(xStyle
, "ParaHyphenationZone"));
776 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(851), getProperty
<sal_Int16
>(xStyle
, "ParaHyphenationZone"));
777 // modify hyphenation zone (note: only hyphenation zone set in Standard paragraph style
778 // is exported, according to the document-level hyphenation settings of OOXML)
779 xStyle
->setPropertyValue("ParaHyphenationZone", uno::Any(static_cast<sal_Int16
>(2000)));
783 // check the export of the modified hyphenation zone
784 CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16
>(2000), getProperty
<sal_Int16
>(xStyle
, "ParaHyphenationZone"));
788 CPPUNIT_TEST_FIXTURE(Test
, testTdf121658
)
790 loadAndSave("tdf121658.docx");
791 xmlDocUniquePtr pXmlSettings
= parseExport("word/settings.xml");
792 assertXPath(pXmlSettings
, "/w:settings/w:doNotHyphenateCaps");
795 CPPUNIT_TEST_FIXTURE(Test
, testTableStyleConfNested
)
797 loadAndSave("table-style-conf-nested.docx");
798 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
799 CPPUNIT_ASSERT(pXmlDoc
);
800 // Without the accompanying fix in place, this test would have failed, as the custom table cell
801 // border properties were lost, so the outer A2 cell started to have borders, not present in the
803 assertXPath(pXmlDoc
, "//w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders/w:top", "val", "nil");
806 CPPUNIT_TEST_FIXTURE(Test
, testTdf133771
)
808 // Create the doc model.
809 createSwDoc("tdf133771.odt", /*pPassword*/ "test");
811 CPPUNIT_ASSERT_EQUAL(OUString("Password Protected"), getParagraph(1)->getString());
813 // Without the fix in place, this test would have failed with
814 // "An uncaught exception of type com.sun.star.io.IOException"
816 save("Office Open XML Text");
817 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
818 CPPUNIT_ASSERT(pXmlDoc
);
819 assertXPathContent(pXmlDoc
, "//w:body/w:p/w:r/w:t", "Password Protected");
822 CPPUNIT_TEST_FIXTURE(Test
, testZeroLineSpacing
)
824 // Create the doc model.
826 uno::Reference
<beans::XPropertySet
> xParagraph(getParagraph(1), uno::UNO_QUERY
);
827 style::LineSpacing aSpacing
;
828 aSpacing
.Mode
= style::LineSpacingMode::MINIMUM
;
830 xParagraph
->setPropertyValue("ParaLineSpacing", uno::Any(aSpacing
));
833 save("Office Open XML Text");
834 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
835 CPPUNIT_ASSERT(pXmlDoc
);
837 // Without the accompanying fix in place, this test would have failed with:
838 // - Expected: atLeast
840 // i.e. the minimal linespacing was lost on export.
841 assertXPath(pXmlDoc
, "/w:document/w:body/w:p/w:pPr/w:spacing", "lineRule", "atLeast");
842 assertXPath(pXmlDoc
, "/w:document/w:body/w:p/w:pPr/w:spacing", "line", "0");
845 CPPUNIT_TEST_FIXTURE(Test
, testSemiTransparentText
)
847 // Create an in-memory empty document.
850 // Set text to half-transparent and type a character.
851 uno::Reference
<beans::XPropertySet
> xParagraph(getParagraph(1), uno::UNO_QUERY
);
852 CPPUNIT_ASSERT(xParagraph
.is());
853 sal_Int16 nTransparence
= 75;
854 xParagraph
->setPropertyValue("CharTransparence", uno::Any(nTransparence
));
855 uno::Reference
<text::XTextRange
> xTextRange(xParagraph
, uno::UNO_QUERY
);
856 CPPUNIT_ASSERT(xTextRange
.is());
857 xTextRange
->setString("x");
860 save("Office Open XML Text");
861 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
862 CPPUNIT_ASSERT(pXmlDoc
);
863 double fValue
= getXPath(
865 "/w:document/w:body/w:p/w:r/w:rPr/w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha",
868 sal_Int16 nActual
= basegfx::fround(fValue
/ oox::drawingml::PER_PERCENT
);
870 // Without the accompanying fix in place, this test would have failed, as the w14:textFill
871 // element was missing.
872 CPPUNIT_ASSERT_EQUAL(nTransparence
, nActual
);
875 DECLARE_OOXMLEXPORT_TEST(testTdf147485
, "Tdf147485.docx")
877 // Before the fix this was impossible.
878 CPPUNIT_ASSERT_EQUAL(1, getPages());
881 DECLARE_OOXMLEXPORT_TEST(testTdf149546
, "tdf149546.docx")
883 // Before the fix this was impossible.
884 CPPUNIT_ASSERT_EQUAL(1, getPages());
887 CPPUNIT_TEST_FIXTURE(Test
, testUserField
)
889 // Create an in-memory empty document with a user field.
891 uno::Reference
<lang::XMultiServiceFactory
> xFactory(mxComponent
, uno::UNO_QUERY
);
892 uno::Reference
<text::XDependentTextField
> xField(
893 xFactory
->createInstance("com.sun.star.text.TextField.User"), uno::UNO_QUERY
);
894 uno::Reference
<beans::XPropertySet
> xMaster(
895 xFactory
->createInstance("com.sun.star.text.FieldMaster.User"), uno::UNO_QUERY
);
896 xMaster
->setPropertyValue("Name", uno::Any(OUString("foo")));
897 xField
->attachTextFieldMaster(xMaster
);
898 xField
->getTextFieldMaster()->setPropertyValue("Content", uno::Any(OUString("bar")));
899 uno::Reference
<text::XTextDocument
> xDocument(mxComponent
, uno::UNO_QUERY
);
900 uno::Reference
<text::XText
> xText
= xDocument
->getText();
901 xText
->insertTextContent(xText
->createTextCursor(), xField
, /*bAbsorb=*/false);
904 save("Office Open XML Text");
905 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
906 CPPUNIT_ASSERT(pXmlDoc
);
908 // Without the accompanying fix in place, this test would have failed, the user field was
909 // exported as <w:t>User Field foo = bar</w:t>.
910 assertXPathContent(pXmlDoc
, "//w:p/w:r[2]/w:instrText", " DOCVARIABLE foo ");
911 assertXPathContent(pXmlDoc
, "//w:p/w:r[4]/w:t", "bar");
913 // Make sure that not only the variables, but also their values are written.
914 pXmlDoc
= parseExport("word/settings.xml");
915 CPPUNIT_ASSERT(pXmlDoc
);
916 assertXPath(pXmlDoc
, "//w:docVars/w:docVar", "name", "foo");
917 assertXPath(pXmlDoc
, "//w:docVars/w:docVar", "val", "bar");
920 CPPUNIT_TEST_FIXTURE(Test
, testHighlightEdit_numbering
)
922 // Create the doc model.
923 createSwDoc("tdf135774_numberingCRProps.docx");
925 // This only affects when saving as w:highlight - which is not the default since 7.0.
926 SvtFilterOptions
& rOpt
= SvtFilterOptions::Get();
927 bool bWasExportToShade
= rOpt
.IsCharBackground2Shading();
928 rOpt
.SetCharBackground2Highlighting();
930 //Simulate a user editing the char background color of the paragraph 2 marker (CR)
931 uno::Reference
<beans::XPropertySet
> properties(getParagraph(2), uno::UNO_QUERY
);
932 uno::Sequence
<beans::NamedValue
> aListAutoFormat
;
933 CPPUNIT_ASSERT(properties
->getPropertyValue("ListAutoFormat") >>= aListAutoFormat
);
934 comphelper::SequenceAsHashMap
aMap(properties
->getPropertyValue("ListAutoFormat"));
935 // change the background color to RES_CHRATR_BACKGROUND.
936 aMap
["CharBackColor"] <<= static_cast<sal_Int32
>(0xff00ff);
937 // Two attributes can affect character background. Highlight has priority, and is only there for MS compatibility,
938 // so clear any potential highlight set earlier, or override any coming via a style.
939 aMap
["CharHighlight"] <<= static_cast<sal_Int32
>(COL_TRANSPARENT
);
941 uno::Sequence
<beans::PropertyValue
> aGrabBag
;
942 aMap
["CharInteropGrabBag"] >>= aGrabBag
;
943 for (beans::PropertyValue
& rProp
: asNonConstRange(aGrabBag
))
945 // The shading is no longer defined from import, so clear that flag.
946 // BackColor 0xff00ff will now attempt to export as highlight, since we set that in SvtFilterOptions.
947 if (rProp
.Name
== "CharShadingMarker")
948 rProp
.Value
<<= false;
950 aMap
["CharInteropGrabBag"] <<= aGrabBag
;
952 aMap
>> aListAutoFormat
;
953 properties
->setPropertyValue("ListAutoFormat", uno::Any(aListAutoFormat
));
956 save("Office Open XML Text");
958 // Paragraph 2 should have only one w:highlight written per w:rPr. Without the fix, there were two.
959 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
960 assertXPath(pXmlDoc
, "//w:body/w:p[2]/w:pPr/w:rPr/w:highlight", "val", "none");
961 // Visually, the "none" highlight means the bullet point should not have a character background.
963 if (bWasExportToShade
)
964 rOpt
.SetCharBackground2Shading();
967 CPPUNIT_TEST_FIXTURE(Test
, testTdf132766
)
969 loadAndSave("tdf132766.docx");
970 xmlDocUniquePtr pXmlDoc
= parseExport("word/numbering.xml");
971 CPPUNIT_ASSERT(pXmlDoc
);
973 // Ensure that for list=1 and level=0 we wrote correct bullet char and correct font
974 assertXPath(pXmlDoc
, "//w:numbering/w:abstractNum[@w:abstractNumId='1']/w:lvl[@w:ilvl='0']/w:lvlText",
976 assertXPath(pXmlDoc
, "//w:numbering/w:abstractNum[@w:abstractNumId='1']/w:lvl[@w:ilvl='0']/w:rPr/w:rFonts",
978 assertXPath(pXmlDoc
, "//w:numbering/w:abstractNum[@w:abstractNumId='1']/w:lvl[@w:ilvl='0']/w:rPr/w:rFonts",
980 assertXPath(pXmlDoc
, "//w:numbering/w:abstractNum[@w:abstractNumId='1']/w:lvl[@w:ilvl='0']/w:rPr/w:rFonts",
984 CPPUNIT_TEST_FIXTURE(Test
, testTdf128245
)
986 loadAndSave("tdf128245.docx");
987 xmlDocUniquePtr pXmlDoc
= parseExport("word/numbering.xml");
988 CPPUNIT_ASSERT(pXmlDoc
);
990 assertXPath(pXmlDoc
, "//w:num[@w:numId='1']/w:abstractNumId", "val", "1");
991 assertXPath(pXmlDoc
, "//w:num[@w:numId='2']/w:abstractNumId", "val", "2");
992 assertXPath(pXmlDoc
, "//w:num[@w:numId='3']/w:abstractNumId", "val", "3");
993 assertXPath(pXmlDoc
, "//w:num[@w:numId='4']/w:abstractNumId", "val", "1");
994 assertXPath(pXmlDoc
, "//w:num[@w:numId='4']/w:lvlOverride[@w:ilvl='0']", "ilvl", "0");
995 assertXPath(pXmlDoc
, "//w:num[@w:numId='4']/w:lvlOverride/w:startOverride", "val", "1");
996 assertXPath(pXmlDoc
, "//w:num[@w:numId='4']/w:lvlOverride[@w:ilvl='1']", 0);
999 DECLARE_OOXMLEXPORT_TEST(testTdf124367
, "tdf124367.docx")
1001 uno::Reference
<text::XTextTablesSupplier
> xTablesSupplier(mxComponent
, uno::UNO_QUERY
);
1002 uno::Reference
<container::XIndexAccess
> xTables(xTablesSupplier
->getTextTables(),
1004 uno::Reference
<text::XTextTable
> xTextTable(xTables
->getByIndex(0), uno::UNO_QUERY
);
1005 uno::Reference
<table::XTableRows
> xTableRows
= xTextTable
->getRows();
1006 // it was 2761 at the first import, and 2760 at the second import, due to incorrect rounding
1007 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(2762),
1008 getProperty
<uno::Sequence
<text::TableColumnSeparator
>>(
1009 xTableRows
->getByIndex(2), "TableColumnSeparators")[0]
1013 CPPUNIT_TEST_FIXTURE(Test
, testTdf95189
)
1015 loadAndReload("tdf95189.docx");
1017 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(1), uno::UNO_QUERY
);
1018 CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1021 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(2), uno::UNO_QUERY
);
1022 CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1025 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(3), uno::UNO_QUERY
);
1026 CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1029 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(4), uno::UNO_QUERY
);
1030 CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1033 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(5), uno::UNO_QUERY
);
1034 CPPUNIT_ASSERT_EQUAL(OUString("3"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1037 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(6), uno::UNO_QUERY
);
1038 CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1041 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(7), uno::UNO_QUERY
);
1042 CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1046 CPPUNIT_TEST_FIXTURE(Test
, testTdf128820
)
1048 loadAndSave("tdf128820.fodt");
1049 // Import of exported DOCX failed because of wrong namespace used for wsp element
1050 // Now test the exported XML, in case we stop failing opening invalid files
1051 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1052 CPPUNIT_ASSERT(pXml
);
1053 // The parent wpg:wgp element has three children: wpg:cNvGrpSpPr, wpg:grpSpPr, and wpg:wsp
1054 // (if we start legitimately exporting additional children, this needs to be adjusted to check
1055 // all those, to make sure we don't export wrong elements).
1056 assertXPathChildren(pXml
,
1057 "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
1058 "wp:inline/a:graphic/a:graphicData/wpg:wgp",
1061 "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/"
1062 "a:graphic/a:graphicData/wpg:wgp/wpg:cNvGrpSpPr");
1064 "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/"
1065 "a:graphic/a:graphicData/wpg:wgp/wpg:grpSpPr");
1066 // This one was pic:wsp instead of wps:wsp
1068 "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/"
1069 "a:graphic/a:graphicData/wpg:wgp/wps:wsp");
1072 CPPUNIT_TEST_FIXTURE(Test
, testTdf128889
)
1074 loadAndSave("tdf128889.fodt");
1075 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1076 CPPUNIT_ASSERT(pXml
);
1077 // There was an w:r (with w:br) as an invalid child of first paragraph's w:pPr
1078 assertXPath(pXml
, "/w:document/w:body/w:p[1]/w:pPr/w:r", 0);
1079 assertXPath(pXml
, "/w:document/w:body/w:p[1]/w:r", 2);
1080 // Check that the break is in proper - last - position
1081 assertXPath(pXml
, "/w:document/w:body/w:p[1]/w:r[2]/w:br", "type", "page");
1084 CPPUNIT_TEST_FIXTURE(Test
, testTdf132754
)
1086 loadAndReload("tdf132754.docx");
1088 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(1), uno::UNO_QUERY
);
1089 CPPUNIT_ASSERT_EQUAL(OUString("0.0.0."), getProperty
<OUString
>(xPara
, "ListLabelString"));
1092 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(2), uno::UNO_QUERY
);
1093 CPPUNIT_ASSERT_EQUAL(OUString("0.0.1."), getProperty
<OUString
>(xPara
, "ListLabelString"));
1096 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(3), uno::UNO_QUERY
);
1097 CPPUNIT_ASSERT_EQUAL(OUString("0.0.2."), getProperty
<OUString
>(xPara
, "ListLabelString"));
1101 DECLARE_OOXMLEXPORT_TEST(testTdf129353
, "tdf129353.docx")
1103 CPPUNIT_ASSERT_EQUAL(8, getParagraphs());
1104 getParagraph(1, "(Verne, 1870)");
1105 getParagraph(2, "Bibliography");
1106 getParagraph(4, "Christie, A. (1922). The Secret Adversary. ");
1107 CPPUNIT_ASSERT_EQUAL(OUString(), getParagraph(8)->getString());
1109 uno::Reference
<text::XDocumentIndexesSupplier
> xIndexSupplier(mxComponent
, uno::UNO_QUERY
);
1110 uno::Reference
<container::XIndexAccess
> xIndexes
= xIndexSupplier
->getDocumentIndexes();
1111 uno::Reference
<text::XDocumentIndex
> xIndex(xIndexes
->getByIndex(0), uno::UNO_QUERY
);
1112 uno::Reference
<text::XTextRange
> xTextRange
= xIndex
->getAnchor();
1113 uno::Reference
<text::XText
> xText
= xTextRange
->getText();
1114 uno::Reference
<text::XTextCursor
> xTextCursor
= xText
->createTextCursor();
1115 xTextCursor
->gotoRange(xTextRange
->getStart(), false);
1116 xTextCursor
->gotoRange(xTextRange
->getEnd(), true);
1117 OUString
aIndexString(convertLineEnd(xTextCursor
->getString(), LineEnd::LINEEND_LF
));
1119 // Check that all the pre-rendered entries are correct, including trailing spaces
1120 CPPUNIT_ASSERT_EQUAL(OUString("\n" // starting with an empty paragraph
1121 "Christie, A. (1922). The Secret Adversary. \n"
1123 "Verne, J. G. (1870). Twenty Thousand Leagues Under the Sea. \n"
1124 ""), // ending with an empty paragraph
1128 CPPUNIT_TEST_FIXTURE(Test
, testTdf77796
)
1130 loadAndSave("tdf77796.docx");
1131 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1132 CPPUNIT_ASSERT(pXml
);
1133 // cell paddings from table style
1134 assertXPath(pXml
, "/w:document/w:body/w:tbl/w:tblPr/w:tblCellMar/w:start", "w", "5");
1135 assertXPath(pXml
, "/w:document/w:body/w:tbl/w:tblPr/w:tblCellMar/w:top", "w", "240");
1136 assertXPath(pXml
, "/w:document/w:body/w:tbl/w:tblPr/w:tblCellMar/w:bottom", "w", "480");
1138 assertXPath(pXml
, "/w:document/w:body/w:tbl/w:tblPr/w:tblCellMar/w:end", "w", "108");
1141 CPPUNIT_TEST_FIXTURE(Test
, testTdf128290
)
1143 loadAndSave("tdf128290.odt");
1144 CPPUNIT_ASSERT_EQUAL(1, getPages());
1145 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1146 CPPUNIT_ASSERT(pXml
);
1147 assertXPath(pXml
, "/w:document/w:body/w:tbl/w:tblPr/w:tblLayout", "type", "fixed");
1150 DECLARE_OOXMLEXPORT_TEST(testTdf120394
, "tdf120394.docx")
1152 CPPUNIT_ASSERT_EQUAL(1, getPages());
1154 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(1), uno::UNO_QUERY
);
1155 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1156 CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1159 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(2), uno::UNO_QUERY
);
1160 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(1), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1161 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty
<OUString
>(xPara
, "ListLabelString"));
1164 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(3), uno::UNO_QUERY
);
1165 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(1), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1166 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty
<OUString
>(xPara
, "ListLabelString"));
1169 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(5), uno::UNO_QUERY
);
1170 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(2), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1171 CPPUNIT_ASSERT_EQUAL(OUString("1.2.1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1175 DECLARE_OOXMLEXPORT_TEST(testTdf133605
, "tdf133605.docx")
1177 CPPUNIT_ASSERT_EQUAL(1, getPages());
1179 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(3), uno::UNO_QUERY
);
1180 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1181 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty
<OUString
>(xPara
, "ListLabelString"));
1184 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(4), uno::UNO_QUERY
);
1185 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(1), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1186 CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty
<OUString
>(xPara
, "ListLabelString"));
1189 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(5), uno::UNO_QUERY
);
1190 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(2), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1191 CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1194 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(6), uno::UNO_QUERY
);
1195 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(3), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1196 CPPUNIT_ASSERT_EQUAL(OUString("(a)"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1200 DECLARE_OOXMLEXPORT_TEST(testTdf133605_2
, "tdf133605_2.docx")
1202 // About the same document as tdf133605.docx, but number definition has level definitions in random order
1203 CPPUNIT_ASSERT_EQUAL(1, getPages());
1205 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(3), uno::UNO_QUERY
);
1206 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1207 CPPUNIT_ASSERT_EQUAL(OUString(), getProperty
<OUString
>(xPara
, "ListLabelString"));
1210 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(4), uno::UNO_QUERY
);
1211 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(1), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1212 CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty
<OUString
>(xPara
, "ListLabelString"));
1215 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(5), uno::UNO_QUERY
);
1216 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(2), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1217 CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1220 uno::Reference
<beans::XPropertySet
> xPara(getParagraph(6), uno::UNO_QUERY
);
1221 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(3), getProperty
<sal_Int16
>(xPara
, "NumberingLevel"));
1222 CPPUNIT_ASSERT_EQUAL(OUString("(a)"), getProperty
<OUString
>(xPara
, "ListLabelString"));
1226 CPPUNIT_TEST_FIXTURE(Test
, testTdf123757
)
1228 loadAndSave("tdf123757.docx");
1229 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1230 CPPUNIT_ASSERT(pXml
);
1231 assertXPath(pXml
, "/w:document/w:body/w:tbl", 2);
1234 CPPUNIT_TEST_FIXTURE(Test
, testTdf141172
)
1236 loadAndSave("tdf141172.docx");
1237 xmlDocUniquePtr pXml
= parseExport("word/endnotes.xml");
1238 CPPUNIT_ASSERT(pXml
);
1239 // This was 1 (lost table during copying endnote content)
1240 assertXPath(pXml
, "/w:endnotes/w:endnote/w:tbl", 2);
1243 CPPUNIT_TEST_FIXTURE(Test
, testTdf141548
)
1245 loadAndSave("tdf141548.docx");
1246 xmlDocUniquePtr pXml
= parseExport("word/endnotes.xml");
1247 CPPUNIT_ASSERT(pXml
);
1248 // This was 0 (lost text content of the run with endnoteRef)
1249 assertXPath(pXml
, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t", 2);
1250 assertXPathContent(pXml
, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t[1]", "another endnote");
1251 assertXPathContent(pXml
, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t[2]", "new line");
1254 CPPUNIT_TEST_FIXTURE(Test
, testTdf143399
)
1256 loadAndSave("tdf143399.docx");
1257 xmlDocUniquePtr pXml
= parseExport("word/footnotes.xml");
1258 CPPUNIT_ASSERT(pXml
);
1259 // These were 0 (lost text content of documents both with footnotes and endnotes)
1260 assertXPath(pXml
, "/w:footnotes/w:footnote[3]/w:p/w:r[3]/w:t", 1);
1261 assertXPathContent(pXml
, "/w:footnotes/w:footnote[3]/w:p/w:r[3]/w:t", "Footnotes_graphic2");
1262 assertXPath(pXml
, "/w:footnotes/w:footnote[4]/w:p/w:r[3]/w:t", 1);
1263 assertXPathContent(pXml
, "/w:footnotes/w:footnote[4]/w:p/w:r[3]/w:t", "Footnotes_graphic");
1265 xmlDocUniquePtr pXml2
= parseExport("word/endnotes.xml");
1266 CPPUNIT_ASSERT(pXml
);
1267 // This was 0 (lost text content of the run with endnoteRef)
1268 assertXPath(pXml2
, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t", 1);
1269 assertXPathContent(pXml2
, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t[1]", "Endnotes");
1272 CPPUNIT_TEST_FIXTURE(Test
, testTdf143583
)
1274 loadAndSave("tdf143583_emptyParaAtEndOfFootnote.docx");
1275 xmlDocUniquePtr pXml
= parseExport("word/footnotes.xml");
1276 CPPUNIT_ASSERT(pXml
);
1277 assertXPath(pXml
, "/w:footnotes/w:footnote[3]/w:p", 2);
1279 assertXPath(pXml
, "/w:footnotes/w:footnote[4]/w:p", 2);
1281 assertXPath(pXml
, "/w:footnotes/w:footnote[5]/w:p", 3);
1283 assertXPath(pXml
, "/w:footnotes/w:footnote[6]/w:p", 3);
1286 CPPUNIT_TEST_FIXTURE(Test
, testTdf152203
)
1288 loadAndSave("tdf152203.docx");
1289 xmlDocUniquePtr pXml
= parseExport("word/footnotes.xml");
1290 CPPUNIT_ASSERT(pXml
);
1292 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
1293 uno::Reference
<container::XIndexAccess
> xFootnotes
= xFootnotesSupplier
->getFootnotes();
1294 uno::Reference
<text::XTextRange
> xLastFootnote(xFootnotes
->getByIndex(5), uno::UNO_QUERY
);
1295 // This was "Footnote for pg5" (replaced footnotes)
1296 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg 6"), xLastFootnote
->getString().trim() );
1298 uno::Reference
<text::XTextRange
> xLastButOne(xFootnotes
->getByIndex(4), uno::UNO_QUERY
);
1299 // This was "Footnote for pg 6" (replaced footnotes)
1300 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg5"), xLastButOne
->getString().trim() );
1303 CPPUNIT_TEST_FIXTURE(Test
, testTdf152506
)
1305 loadAndSave("tdf152506.docx");
1306 xmlDocUniquePtr pXml
= parseExport("word/footnotes.xml");
1307 CPPUNIT_ASSERT(pXml
);
1309 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
1310 uno::Reference
<container::XIndexAccess
> xFootnotes
= xFootnotesSupplier
->getFootnotes();
1311 uno::Reference
<text::XTextRange
> xLastFootnote(xFootnotes
->getByIndex(1), uno::UNO_QUERY
);
1312 // This was "Footnote for pg5" (replaced footnotes)
1313 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg 6"), xLastFootnote
->getString().trim() );
1315 uno::Reference
<text::XTextRange
> xLastButOne(xFootnotes
->getByIndex(0), uno::UNO_QUERY
);
1316 // This was "Footnote for pg 6" (replaced footnotes)
1317 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg5"), xLastButOne
->getString().trim() );
1320 CPPUNIT_TEST_FIXTURE(Test
, testTdf153255
)
1322 loadAndSave("tdf153255.docx");
1323 xmlDocUniquePtr pXml
= parseExport("word/footnotes.xml");
1324 CPPUNIT_ASSERT(pXml
);
1326 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
1327 uno::Reference
<container::XIndexAccess
> xFootnotes
= xFootnotesSupplier
->getFootnotes();
1328 uno::Reference
<text::XTextRange
> xLastFootnote(xFootnotes
->getByIndex(5), uno::UNO_QUERY
);
1329 // This was "Footnote for pg2" (replaced footnotes)
1330 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg 6"), xLastFootnote
->getString().trim() );
1332 uno::Reference
<text::XTextRange
> xLastButOne(xFootnotes
->getByIndex(4), uno::UNO_QUERY
);
1333 // This was "Footnote for pg 6" (replaced footnotes)
1334 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg5"), xLastButOne
->getString().trim() );
1336 // check all the remaining footnotes
1338 uno::Reference
<text::XTextRange
> xFootnote1(xFootnotes
->getByIndex(0), uno::UNO_QUERY
);
1339 // This was "Footnote for pg3" (replaced footnotes)
1340 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg1"), xFootnote1
->getString().trim() );
1342 uno::Reference
<text::XTextRange
> xFootnote2(xFootnotes
->getByIndex(1), uno::UNO_QUERY
);
1343 // This was "Footnote for pg5" (replaced footnotes)
1344 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg2"), xFootnote2
->getString().trim() );
1346 uno::Reference
<text::XTextRange
> xFootnote3(xFootnotes
->getByIndex(2), uno::UNO_QUERY
);
1347 // This was "Footnote for pg4." (replaced footnotes)
1348 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg3"), xFootnote3
->getString().trim() );
1350 uno::Reference
<text::XTextRange
> xFootnote4(xFootnotes
->getByIndex(3), uno::UNO_QUERY
);
1351 // This was "Footnote for pg1" (replaced footnotes)
1352 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg4."), xFootnote4
->getString().trim() );
1355 CPPUNIT_TEST_FIXTURE(Test
, testTdf153804
)
1357 loadAndSave("tdf153804.docx");
1358 xmlDocUniquePtr pXml
= parseExport("word/footnotes.xml");
1359 CPPUNIT_ASSERT(pXml
);
1361 uno::Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(mxComponent
, uno::UNO_QUERY
);
1362 uno::Reference
<container::XIndexAccess
> xFootnotes
= xFootnotesSupplier
->getFootnotes();
1363 uno::Reference
<text::XTextRange
> xLastFootnote(xFootnotes
->getByIndex(1), uno::UNO_QUERY
);
1365 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg 6"), xLastFootnote
->getString().trim() );
1367 uno::Reference
<text::XTextRange
> xLastButOne(xFootnotes
->getByIndex(0), uno::UNO_QUERY
);
1369 CPPUNIT_ASSERT_EQUAL( OUString("Footnote for pg5"), xLastButOne
->getString().trim() );
1372 // skip test for macOS (missing fonts?)
1373 #if !defined(MACOSX)
1374 DECLARE_OOXMLEXPORT_TEST(testTdf146346
, "tdf146346.docx")
1376 // This was 2 (by bad docDefault vertical margins around tables in footnotes)
1377 CPPUNIT_ASSERT_EQUAL(1, getPages());
1379 // only first page has table
1380 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1382 // check first page: all tables on the first page
1383 assertXPath(pXmlDoc
, "/root/page[1]//anchored/fly", 8);
1384 assertXPath(pXmlDoc
, "/root/page[1]//anchored/fly/tab", 8);
1387 // Without the accompanying fix in place, this test would have failed with:
1390 // i.e. unwanted lower margin in the floating table's anchor paragraph in the footnote created a
1392 assertXPath(pXmlDoc
, "/root/page[2]", 0);
1396 DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter
, "cont-sect-break-header-footer.docx")
1398 // Load a document with a continuous section break on page 2.
1399 CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 1"),
1400 parseDump("/root/page[1]/header/txt/text()"));
1401 CPPUNIT_ASSERT_EQUAL(OUString("First page footer, section 1"),
1402 parseDump("/root/page[1]/footer/txt/text()"));
1403 // Make sure the header stays like this; if we naively just update the page style name of the
1404 // first para on page 2, then this would be 'Header, section 2', which is incorrect.
1405 CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"),
1406 parseDump("/root/page[2]/header/txt/text()"));
1407 CPPUNIT_ASSERT_EQUAL(OUString("First page footer, section 2"),
1408 parseDump("/root/page[2]/footer/txt/text()"));
1409 // This is inherited from page 2.
1410 CPPUNIT_ASSERT_EQUAL(OUString("Header, section 2"),
1411 parseDump("/root/page[3]/header/txt/text()"));
1412 // Without the accompanying fix in place, this test would have failed with:
1415 // - xpath should match exactly 1 node
1416 // i.e. the footer had no text (inherited from page 2), while the correct behavior is to provide
1417 // the own footer text.
1418 CPPUNIT_ASSERT_EQUAL(OUString("Footer, section 3"),
1419 parseDump("/root/page[3]/footer/txt/text()"));
1421 // Without the export fix in place, the import-export-import test would have failed with:
1422 // - Expected: Header, section 2
1423 // - Actual : First page header, section 2
1424 // i.e. both the header and the footer on page 3 was wrong.
1426 // Additional problem: top margin on page 3 was wrong.
1429 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1430 // Without the accompanying fix in place, this test would have failed with:
1433 // i.e. the top margin on page 3 was too large and now matches the value from the input
1435 assertXPath(pXml
, "/w:document/w:body/w:sectPr/w:pgMar", "top", "2200");
1439 CPPUNIT_TEST_FIXTURE(Test
, testHyphenationAuto
)
1441 loadAndReload("hyphenation.odt");
1442 CPPUNIT_ASSERT_EQUAL(1, getPages());
1443 // Explicitly set hyphenation=auto on document level
1444 xmlDocUniquePtr pXmlSettings
= parseExport("word/settings.xml");
1445 CPPUNIT_ASSERT(pXmlSettings
);
1446 assertXPath(pXmlSettings
, "/w:settings/w:autoHyphenation", "val", "true");
1448 // Second paragraph has explicitly enabled hyphenation
1449 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1450 CPPUNIT_ASSERT(pXml
);
1451 assertXPath(pXml
, "/w:document/w:body/w:p[2]/w:pPr/w:suppressAutoHyphens", "val", "false");
1453 // Default paragraph style explicitly disables hyphens
1454 xmlDocUniquePtr pXmlStyles
= parseExport("word/styles.xml");
1455 CPPUNIT_ASSERT(pXmlStyles
);
1456 assertXPath(pXmlStyles
, "/w:styles/w:docDefaults/w:pPrDefault/w:pPr/w:suppressAutoHyphens", "val", "true");
1459 CPPUNIT_TEST_FIXTURE(Test
, testStrikeoutGroupShapeText
)
1461 loadAndSave("tdf131776_StrikeoutGroupShapeText.docx");
1462 // tdf#131776: Check if strikeout is used in shape group texts
1463 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1465 // double strike (dstrike)
1466 // no "val" attribute
1467 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1468 "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
1469 assertXPathNoAttribute(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1470 "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
1471 // "val" attribute is true, this is used in this test file. However, LO is going to export this element without the "val" attribute
1472 // because if the element appears, but without an attribute its "val" true by default.
1473 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1474 "wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
1475 assertXPathNoAttribute(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1476 "wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
1477 // "val" attribute is false (this was missing, resulting the regression)
1478 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1479 "wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val", "false");
1481 // simple strike (strike)
1482 // no "val" attribute
1483 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1484 "wps:wsp[4]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
1485 assertXPathNoAttribute(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1486 "wps:wsp[4]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
1487 // "val" attribute is true, this is used in this test file. However, LO is going to export this element without the "val" attribute
1488 // because if the element appears, but without an attribute its "val" true by default.
1489 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1490 "wps:wsp[5]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
1491 assertXPathNoAttribute(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1492 "wps:wsp[5]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
1493 // "val" attribute is false
1494 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
1495 "wps:wsp[6]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val", "false");
1498 CPPUNIT_TEST_FIXTURE(Test
, testTdf131539
)
1500 loadAndSave("tdf131539.odt");
1501 CPPUNIT_ASSERT_EQUAL(2, getShapes());
1502 CPPUNIT_ASSERT_EQUAL(1, getPages());
1503 //The positions of OLE objects were not exported, check if now it is exported correctly
1504 xmlDocUniquePtr p_XmlDoc
= parseExport("word/document.xml");
1505 CPPUNIT_ASSERT(p_XmlDoc
);
1506 OUString aXmlVal
= getXPath(p_XmlDoc
, "/w:document/w:body/w:p[4]/w:r[1]/w:object/v:shape", "style");
1507 // This data was missing
1508 CPPUNIT_ASSERT(aXmlVal
.indexOf("margin-left:139.95")>-1);
1511 CPPUNIT_TEST_FIXTURE(Test
, testLineWidthRounding
)
1513 loadAndSave("tdf126363_LineWidthRounding.docx");
1514 // tdf#126363: check if line with stays the same after export
1515 xmlDocUniquePtr pXml
= parseExport("word/document.xml");
1516 // this was 57240 (it differs from the original 57150, losing the preset line width)
1517 assertXPath(pXml
, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "57150");
1520 CPPUNIT_TEST_FIXTURE(Test
, testTdf108505
)
1522 loadAndReload("tdf108505.docx");
1523 uno::Reference
<text::XTextRange
> xParagraph
= getParagraph(3);
1524 uno::Reference
<text::XTextRange
> xText
1525 = getRun(xParagraph
, 1, "Wrong font when alone on the line");
1527 // Without the fix in place this would have become Times New Roman
1528 CPPUNIT_ASSERT_EQUAL(
1529 OUString("Trebuchet MS"),
1530 getProperty
<OUString
>(xText
, "CharFontName"));
1533 CPPUNIT_TEST_FIXTURE(Test
, testRelativeAnchorHeightFromTopMarginHasHeader
)
1535 loadAndReload("tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx");
1536 // tdf#123324 The height was set relative to page print area top,
1537 // but this was handled relative to page height.
1538 // Note: page print area top = margin + header height.
1539 // In this case the header exists.
1540 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1541 assertXPath(pXmlDoc
, "//anchored/SwAnchoredDrawObject/bounds", "height", "2551");
1544 CPPUNIT_TEST_FIXTURE(Test
, testRelativeAnchorHeightFromTopMarginNoHeader
)
1546 loadAndReload("tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx");
1547 // tdf#123324 The height was set relative from top margin, but this was handled relative from page height.
1548 // Note: the MSO Word margin = LO margin + LO header height.
1549 // In this case the header does not exist, so MSO Word margin and LO Writer margin are the same.
1551 // tdf#123324 The height was set relative to page print area top,
1552 // but this was handled relative to page height.
1553 // Note: page print area top = margin + header height.
1554 // In this case the header does not exist, so OpenDocument and OOXML margins are the same.
1555 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1556 assertXPath(pXmlDoc
, "//anchored/SwAnchoredDrawObject/bounds", "height", "2551");
1559 CPPUNIT_TEST_FIXTURE(Test
, testTdf64531
)
1561 loadAndReload("tdf64531.docx");
1562 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
1563 OString sPathToTabs
= "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:pPr/w:tabs/";
1564 assertXPath(pXmlDoc
, sPathToTabs
+"w:tab[1]", "pos","720");
1565 assertXPath(pXmlDoc
, sPathToTabs
+"w:tab[2]", "pos","12950");
1568 DECLARE_OOXMLEXPORT_TEST(testVmlShapeTextWordWrap
, "tdf97618_testVmlShapeTextWordWrap.docx")
1570 // tdf#97618 The text wrapping of a shape was not handled in a canvas.
1571 // TODO: fix export too
1574 xmlDocUniquePtr pXmlDoc
= parseLayoutDump();
1577 // The bound rect of shape will be wider if wrap does not work (the wrong value is 3167).
1578 assertXPath(pXmlDoc
, "//anchored/SwAnchoredDrawObject/bounds", "width", "2500");
1581 DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX
, "tdf97517_testVmlLineShapeMirroredX.docx")
1583 // tdf#97517 The "flip:x" was not handled for VML line shapes.
1586 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
1587 OUString sStyle
= getXPath(pXmlDoc
,
1588 "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
1590 CPPUNIT_ASSERT(sStyle
.indexOf("flip:x") > 0);
1593 DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredY
, "tdf137678_testVmlLineShapeMirroredY.docx")
1595 // tdf#137678 The "flip:y" was not handled for VML line shapes.
1598 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
1599 OUString sStyle
= getXPath(pXmlDoc
,
1600 "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
1602 CPPUNIT_ASSERT(sStyle
.indexOf("flip:y") > 0);
1605 CPPUNIT_TEST_FIXTURE(Test
, testVmlLineShapeRotated
)
1607 loadAndSave("tdf137765_testVmlLineShapeRotated.docx");
1608 // tdf#137765 The "rotation" (in style attribute) was not handled correctly for VML line shapes.
1609 xmlDocUniquePtr pXmlDoc
= parseExport("word/document.xml");
1610 // it was 1.55pt,279.5pt
1611 assertXPath(pXmlDoc
,
1612 "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
1615 // it was 25.5pt,317.8pt
1616 assertXPath(pXmlDoc
,
1617 "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
1619 "36.05pt,300.55pt");
1622 CPPUNIT_PLUGIN_IMPLEMENT();
1624 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */