Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / qa / unit / export-tests-ooxml2.cxx
blobed6568d0bc1f1adc3869af6d3bcb30eb5a07ad2e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include "sdmodeltestbase.hxx"
11 #include <comphelper/propertysequence.hxx>
12 #include <editeng/flditem.hxx>
14 #include <svx/svdomedia.hxx>
15 #include <svx/svdotable.hxx>
16 #include <svx/svdpage.hxx>
17 #include <docmodel/uno/UnoGradientTools.hxx>
19 #include <com/sun/star/animations/TransitionType.hpp>
20 #include <com/sun/star/animations/TransitionSubType.hpp>
21 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
22 #include <com/sun/star/drawing/FillStyle.hpp>
23 #include <com/sun/star/style/LineSpacing.hpp>
24 #include <com/sun/star/style/LineSpacingMode.hpp>
25 #include <com/sun/star/text/XTextColumns.hpp>
27 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
29 #include <rtl/character.hxx>
30 #include <o3tl/string_view.hxx>
32 using namespace css;
33 using namespace css::animations;
35 namespace
37 bool checkBeginWithNumber(std::u16string_view aStr)
39 sal_Unicode aChar = (aStr.size() > 1) ? aStr[0] : '\0';
40 return aChar == '.' || aChar == '-' || rtl::isAsciiDigit(aChar);
44 #define CPPUNIT_ASSERT_MOTIONPATH(expect, actual) \
45 assertMotionPath(expect, actual, CPPUNIT_SOURCELINE())
47 static void assertMotionPath(std::u16string_view rStr1, std::u16string_view rStr2,
48 const CppUnit::SourceLine& rSourceLine)
50 sal_Int32 nIdx1 = 0;
51 sal_Int32 nIdx2 = 0;
53 OString sMessage
54 = "Motion path values mismatch.\nExpect: " + OUStringToOString(rStr1, RTL_TEXTENCODING_UTF8)
55 + "\nActual: " + OUStringToOString(rStr2, RTL_TEXTENCODING_UTF8);
57 while (nIdx1 != -1 && nIdx2 != -1)
59 OUString aToken1(o3tl::getToken(rStr1, 0, ' ', nIdx1));
60 OUString aToken2(o3tl::getToken(rStr2, 0, ' ', nIdx2));
62 if (checkBeginWithNumber(aToken1) && checkBeginWithNumber(aToken2))
63 assertDoubleEquals(aToken1.toDouble(), aToken2.toDouble(), DBL_EPSILON, rSourceLine,
64 std::string(sMessage));
65 else
66 assertEquals(aToken1, aToken2, rSourceLine, std::string(sMessage));
68 assertEquals(sal_Int32(-1), nIdx1, rSourceLine, std::string(sMessage));
69 assertEquals(sal_Int32(-1), nIdx2, rSourceLine, std::string(sMessage));
72 class SdOOXMLExportTest2 : public SdModelTestBase
74 public:
75 SdOOXMLExportTest2()
76 : SdModelTestBase("/sd/qa/unit/data/")
81 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testRepeatBitmapMode)
83 createSdImpressDoc("odp/repeatBitmapMode.odp");
84 save("Impress Office Open XML");
86 xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
87 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "tx", "1269669");
88 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "ty", "186051");
89 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sx", "100000");
90 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sy", "100000");
91 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "algn", "tr");
93 // if the "Scale" setting is checked in the images settings dialog.
94 xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
95 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "tx", "0");
96 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "ty", "0");
97 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sx", "682760");
98 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sy", "639983");
99 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "algn", "ctr");
102 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf153107)
104 createSdImpressDoc("odp/tdf153107.odp");
105 save("Impress Office Open XML");
107 // placeholder
108 xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
109 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "tx",
110 "1879200");
111 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "ty",
112 "83628");
113 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "sx",
114 "264773");
115 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "sy",
116 "91428");
117 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "algn",
118 "ctr");
120 // custom shape
121 xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide1.xml");
122 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "tx",
123 "198000");
124 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "ty",
125 "324000");
126 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "sx",
127 "69743");
128 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "sy",
129 "78709");
130 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "algn",
131 "tl");
133 // polygon
134 xmlDocUniquePtr pXmlDocContent3 = parseExport("ppt/slides/slide1.xml");
135 assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "tx",
136 "2073600");
137 assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "ty",
138 "221760");
139 assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "sx",
140 "182602");
141 assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "sy",
142 "86580");
143 assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "algn",
144 "ctr");
146 // textbox
147 xmlDocUniquePtr pXmlDocContent4 = parseExport("ppt/slides/slide1.xml");
148 assertXPath(pXmlDocContent4, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "tx",
149 "662400");
150 assertXPath(pXmlDocContent4, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "ty",
151 "760320");
152 assertXPath(pXmlDocContent4, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "sx",
153 "202891");
154 assertXPath(pXmlDocContent4, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "sy",
155 "129870");
156 assertXPath(pXmlDocContent4, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "algn",
157 "tl");
160 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf142291)
162 createSdImpressDoc("pptx/tdt142291.pptx");
163 save("Impress Office Open XML");
165 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
166 assertXPath(pXmlDocContent,
167 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
168 "a:tcPr/a:lnL/a:prstDash",
169 "val", "sysDashDotDot");
170 assertXPath(pXmlDocContent,
171 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
172 "a:tcPr/a:lnR/a:prstDash",
173 "val", "dot");
174 assertXPath(pXmlDocContent,
175 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
176 "a:tcPr/a:lnT/a:prstDash",
177 "val", "solid");
178 assertXPath(pXmlDocContent,
179 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
180 "a:tcPr/a:lnB/a:prstDash",
181 "val", "dash");
182 assertXPath(pXmlDocContent,
183 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[2]/"
184 "a:tcPr/a:lnR/a:prstDash",
185 "val", "dashDot");
188 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf151492)
190 createSdImpressDoc("odp/tdf151492.odp");
191 save("Impress Office Open XML");
193 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
194 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn",
195 "idx", "0");
198 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf149697)
200 createSdImpressDoc("pptx/tdf149697.pptx");
201 save("Impress Office Open XML");
203 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
204 assertXPath(pXmlDocContent,
205 "/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", "5");
206 assertXPath(pXmlDocContent,
207 "/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", "4");
209 assertXPath(pXmlDocContent,
210 "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", "3");
212 assertXPath(pXmlDocContent,
213 "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", "1");
216 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf149126)
218 createSdImpressDoc("odp/tdf149126.odp");
219 save("Impress Office Open XML");
221 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
222 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst",
223 "triangle");
226 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf131905)
228 createSdImpressDoc("pptx/tdf131905.pptx");
229 save("Impress Office Open XML");
231 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
232 assertXPath(
233 pXmlDocContent,
234 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[1]/a:tc/a:tcPr",
235 "anchor", "t");
237 assertXPath(
238 pXmlDocContent,
239 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[2]/a:tc/a:tcPr",
240 "anchor", "ctr");
242 assertXPath(
243 pXmlDocContent,
244 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[3]/a:tc/a:tcPr",
245 "anchor", "b");
248 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf93883)
250 createSdImpressDoc("odp/tdf93883.odp");
251 saveAndReload("Impress Office Open XML");
252 uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
253 uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape));
254 uno::Reference<beans::XPropertySet> xPropSet(xParagraph, uno::UNO_QUERY_THROW);
255 CPPUNIT_ASSERT(!xPropSet->getPropertyValue("NumberingLevel").hasValue());
258 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testBnc822341)
260 // Check import / export of embedded text document
261 createSdImpressDoc("odp/bnc822341.odp");
262 save("Impress Office Open XML");
264 // Export an LO specific ole object (imported from an ODP document)
266 xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
267 assertXPath(pXmlDocCT,
268 "/ContentType:Types/ContentType:Override[@ContentType='application/"
269 "vnd.openxmlformats-officedocument.wordprocessingml.document']",
270 "PartName", "/ppt/embeddings/oleObject1.docx");
272 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
273 assertXPath(
274 pXmlDocRels,
275 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
276 "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
278 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
279 assertXPath(pXmlDocContent,
280 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
281 "progId", "Word.Document.12");
283 const SdrPage* pPage = GetPage(1);
285 const SdrObject* pObj = pPage->GetObj(0);
286 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
287 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
290 save("Impress Office Open XML");
292 // Export an MS specific ole object (imported from a PPTX document)
294 xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
295 assertXPath(pXmlDocCT,
296 "/ContentType:Types/ContentType:Override[@ContentType='application/"
297 "vnd.openxmlformats-officedocument.wordprocessingml.document']",
298 "PartName", "/ppt/embeddings/oleObject1.docx");
300 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
301 assertXPath(
302 pXmlDocRels,
303 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
304 "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
306 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
307 assertXPath(pXmlDocContent,
308 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
309 "progId", "Word.Document.12");
311 const SdrPage* pPage = GetPage(1);
313 const SdrObject* pObj = pPage->GetObj(0);
314 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
315 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
319 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testMathObject)
321 // Check import / export of math object
322 createSdImpressDoc("odp/math.odp");
323 save("Impress Office Open XML");
325 // Export an LO specific ole object (imported from an ODP document)
327 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
328 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
329 "Requires", "a14");
330 assertXPathContent(pXmlDocContent,
331 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/"
332 "a14:m/m:oMath/m:r[1]/m:t",
333 "a");
335 const SdrPage* pPage = GetPage(1);
336 const SdrObject* pObj = pPage->GetObj(0);
337 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
338 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
341 save("Impress Office Open XML");
343 // Export an MS specific ole object (imported from a PPTX document)
345 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
346 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
347 "Requires", "a14");
348 assertXPathContent(pXmlDocContent,
349 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/"
350 "a14:m/m:oMath/m:r[1]/m:t",
351 "a");
353 const SdrPage* pPage = GetPage(1);
354 const SdrObject* pObj = pPage->GetObj(0);
355 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
356 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
360 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testMathObjectPPT2010)
362 // Check import / export of math object
363 createSdImpressDoc("pptx/Math.pptx");
364 save("Impress Office Open XML");
366 // Export an MS specific ole object (imported from a PPTX document)
368 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
369 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
370 "Requires", "a14");
371 assertXPathContent(pXmlDocContent,
372 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/"
373 "a14:m/m:oMath/m:sSup/m:e/m:r[1]/m:t",
374 u"\U0001D44E"); // non-BMP char
376 const SdrPage* pPage = GetPage(1);
377 const SdrObject* pObj = pPage->GetObj(0);
378 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
379 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier());
383 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf119015)
385 createSdImpressDoc("pptx/tdf119015.pptx");
386 saveAndReload("Impress Office Open XML");
388 const SdrPage* pPage = GetPage(1);
390 sdr::table::SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
391 CPPUNIT_ASSERT(pTableObj);
392 // The position was previously not properly initialized: (0, 0, 100, 100)
393 CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(6991, 6902), Size(14099, 2000)),
394 pTableObj->GetLogicRect());
395 uno::Reference<table::XTable> xTable(pTableObj->getTable());
397 // Test that we actually have three cells: this threw css.lang.IndexOutOfBoundsException
398 uno::Reference<text::XTextRange> xTextRange(xTable->getCellByPosition(1, 0),
399 uno::UNO_QUERY_THROW);
400 CPPUNIT_ASSERT_EQUAL(OUString("A3"), xTextRange->getString());
403 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf123090)
405 createSdImpressDoc("pptx/tdf123090.pptx");
406 saveAndReload("Impress Office Open XML");
408 const SdrPage* pPage = GetPage(1);
410 sdr::table::SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
411 CPPUNIT_ASSERT(pTableObj);
413 uno::Reference<table::XTable> xTable(pTableObj->getTable());
415 // Test that we actually have two cells: this threw css.lang.IndexOutOfBoundsException
416 uno::Reference<text::XTextRange> xTextRange(xTable->getCellByPosition(1, 0),
417 uno::UNO_QUERY_THROW);
418 CPPUNIT_ASSERT_EQUAL(OUString("aaa"), xTextRange->getString());
420 sal_Int32 nWidth;
421 uno::Reference<css::table::XTableColumns> xColumns(xTable->getColumns(), uno::UNO_SET_THROW);
422 uno::Reference<beans::XPropertySet> xRefColumn(xColumns->getByIndex(1), uno::UNO_QUERY_THROW);
423 xRefColumn->getPropertyValue("Width") >>= nWidth;
424 CPPUNIT_ASSERT_EQUAL(sal_Int32(9136), nWidth);
427 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf126324)
429 createSdImpressDoc("pptx/tdf126324.pptx");
430 saveAndReload("Impress Office Open XML");
431 uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY);
432 uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
433 CPPUNIT_ASSERT(xPage.is());
434 uno::Reference<beans::XPropertySet> xShape(getShape(0, xPage));
435 CPPUNIT_ASSERT(xShape.is());
436 uno::Reference<text::XText> xText
437 = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText();
438 CPPUNIT_ASSERT_EQUAL(OUString("17"), xText->getString());
441 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf119187)
443 // load document
444 createSdImpressDoc("pptx/tdf119187.pptx");
446 //Check For Import and Export Both
447 for (sal_uInt32 i = 0; i < 2; i++)
449 // get shape properties
450 const SdrPage* pPage = GetPage(1);
451 CPPUNIT_ASSERT(pPage);
452 SdrObject* pObj = pPage->GetObj(0);
453 CPPUNIT_ASSERT(pObj);
454 const sdr::properties::BaseProperties& rProperties = pObj->GetProperties();
456 // check text vertical alignment
457 const SdrTextVertAdjustItem& rSdrTextVertAdjustItem
458 = rProperties.GetItem(SDRATTR_TEXT_VERTADJUST);
459 const SdrTextVertAdjust eTVA = rSdrTextVertAdjustItem.GetValue();
460 CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_TOP, eTVA);
461 saveAndReload("Impress Office Open XML");
465 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf132472)
467 createSdImpressDoc("pptx/tdf132472.pptx");
468 const SdrPage* pPage = GetPage(1);
470 sdr::table::SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
471 CPPUNIT_ASSERT(pTableObj);
473 uno::Reference<table::XCellRange> xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
474 uno::Reference<beans::XPropertySet> xCell;
475 Color nColor;
477 xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
478 xCell->getPropertyValue("FillColor") >>= nColor;
479 CPPUNIT_ASSERT_EQUAL(Color(0x729fcf), nColor);
481 uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, xCell));
482 uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
483 uno::Reference<beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY);
484 xPropSet->getPropertyValue("CharColor") >>= nColor;
486 // Without the fix in place, this test would have failed with
487 // - Expected: Color: R:0 G:0 B:0 A:0
488 // - Actual : Color: R:255 G:255 B:255 A:0
489 CPPUNIT_ASSERT_EQUAL(COL_BLACK, nColor);
492 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf80224)
494 createSdImpressDoc("odp/tdf80224.odp");
495 saveAndReload("Impress Office Open XML");
496 uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
498 uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape));
499 uno::Reference<beans::XPropertySet> xPropSet(xParagraph->getStart(), uno::UNO_QUERY_THROW);
501 Color nCharColor;
502 xPropSet->getPropertyValue("CharColor") >>= nCharColor;
503 CPPUNIT_ASSERT_EQUAL(Color(0x6562ac), nCharColor);
506 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf91378)
508 //Check For Import and Export Both
509 createSdImpressDoc("pptx/tdf91378.pptx");
510 for (sal_uInt32 i = 0; i < 2; i++)
512 uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(
513 mxComponent, uno::UNO_QUERY);
514 uno::Reference<document::XDocumentProperties> xProps
515 = xDocumentPropertiesSupplier->getDocumentProperties();
516 uno::Reference<beans::XPropertySet> xUDProps(xProps->getUserDefinedProperties(),
517 uno::UNO_QUERY);
518 OUString propValue;
519 xUDProps->getPropertyValue("Testing") >>= propValue;
520 CPPUNIT_ASSERT(propValue.isEmpty());
521 saveAndReload("Impress Office Open XML");
525 static bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> const& xDoc,
526 sal_Int32 nSlideNumber, sal_Int16 nExpectedTransitionType,
527 sal_Int16 nExpectedTransitionSubType,
528 bool bExpectedDirection = true)
530 sal_Int32 nSlideIndex = nSlideNumber - 1;
532 CPPUNIT_ASSERT_MESSAGE("Slide/Page index out of range",
533 nSlideIndex < xDoc->getDrawPages()->getCount());
535 uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(nSlideIndex),
536 uno::UNO_QUERY_THROW);
537 uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
539 sal_Int16 nTransitionType = 0;
540 xPropSet->getPropertyValue("TransitionType") >>= nTransitionType;
542 if (nExpectedTransitionType != nTransitionType)
544 std::cerr << "Transition type: " << nTransitionType << " " << nExpectedTransitionType
545 << std::endl;
546 return false;
549 sal_Int16 nTransitionSubtype = 0;
550 xPropSet->getPropertyValue("TransitionSubtype") >>= nTransitionSubtype;
551 if (nExpectedTransitionSubType != nTransitionSubtype)
553 std::cerr << "Transition Subtype: " << nTransitionSubtype << " "
554 << nExpectedTransitionSubType << std::endl;
555 return false;
558 bool bDirection = false;
559 xPropSet->getPropertyValue("TransitionDirection") >>= bDirection;
561 if (bExpectedDirection != bDirection)
563 std::cerr << "Transition Direction: " << (bExpectedDirection ? "normal" : "reversed") << " "
564 << (bDirection ? "normal" : "reversed") << std::endl;
565 return false;
568 return true;
571 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testExportTransitionsPPTX)
573 createSdImpressDoc("AllTransitions.odp");
574 saveAndReload("Impress Office Open XML");
575 uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY_THROW);
577 // WIPE TRANSITIONS
578 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 01, TransitionType::BARWIPE,
579 TransitionSubType::TOPTOBOTTOM, false));
580 CPPUNIT_ASSERT(
581 checkTransitionOnPage(xDoc, 02, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT));
582 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 03, TransitionType::BARWIPE,
583 TransitionSubType::LEFTTORIGHT, false));
584 CPPUNIT_ASSERT(
585 checkTransitionOnPage(xDoc, 04, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM));
587 // CUT THROUGH BLACK
588 CPPUNIT_ASSERT(
589 checkTransitionOnPage(xDoc, 31, TransitionType::BARWIPE, TransitionSubType::FADEOVERCOLOR));
591 // COMB
592 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 41, TransitionType::PUSHWIPE,
593 TransitionSubType::COMBHORIZONTAL));
594 CPPUNIT_ASSERT(
595 checkTransitionOnPage(xDoc, 42, TransitionType::PUSHWIPE, TransitionSubType::COMBVERTICAL));
597 // OUTSIDE TURNING CUBE
598 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 57, TransitionType::MISCSHAPEWIPE,
599 TransitionSubType::CORNERSOUT));
600 // INSIDE TURNING CUBE
601 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 60, TransitionType::MISCSHAPEWIPE,
602 TransitionSubType::CORNERSIN));
604 // FALL
605 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 61, TransitionType::MISCSHAPEWIPE,
606 TransitionSubType::LEFTTORIGHT));
608 // VORTEX
609 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 70, TransitionType::MISCSHAPEWIPE,
610 TransitionSubType::VERTICAL));
612 // RIPPLE
613 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 71, TransitionType::MISCSHAPEWIPE,
614 TransitionSubType::HORIZONTAL));
616 // GLITTER
617 CPPUNIT_ASSERT(
618 checkTransitionOnPage(xDoc, 72, TransitionType::MISCSHAPEWIPE, TransitionSubType::DIAMOND));
620 // HONEYCOMB
621 CPPUNIT_ASSERT(
622 checkTransitionOnPage(xDoc, 73, TransitionType::MISCSHAPEWIPE, TransitionSubType::HEART));
624 // NEWSFLASH
625 CPPUNIT_ASSERT(
626 checkTransitionOnPage(xDoc, 74, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
628 // OVAL VERTICAL - cannot be exported to PPTX so fallback to circle
629 //CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::VERTICAL));
630 CPPUNIT_ASSERT(
631 checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::CIRCLE));
634 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testPresetShapesExport)
636 createSdImpressDoc("odp/preset-shapes-export.odp");
637 const char* sShapeTypeAndValues[] = {
638 "wedgeEllipseCallout",
639 "adj1",
640 "val 45310",
641 "adj2",
642 "val 97194",
643 "wedgeRoundRectCallout",
644 "adj1",
645 "val 46694",
646 "adj2",
647 "val 129726",
648 "adj3",
649 "val 16667",
650 "wedgeRectCallout",
651 "adj1",
652 "val 40037",
653 "adj2",
654 "val 111694",
655 "smileyFace",
656 "adj",
657 "val -9282",
658 "can",
659 "adj",
660 "val 50000",
661 "frame",
662 "adj1",
663 "val 10490",
664 "donut",
665 "adj",
666 "val 9601",
667 "bevel",
668 "adj",
669 "val 42592",
670 "foldedCorner",
671 "adj",
672 "val 10750",
673 "verticalScroll",
674 "adj",
675 "val 25000",
676 "horizontalScroll",
677 "adj",
678 "val 25000",
679 "cube",
680 "adj",
681 "val 85129",
682 "bracketPair",
683 "adj",
684 "val 50000",
685 "sun",
686 "adj",
687 "val 12500",
688 "bracePair",
689 "adj",
690 "val 25000",
691 "cloudCallout",
692 "adj1",
693 "val 77611",
694 "adj2",
695 "val -47819",
696 "borderCallout1",
697 "adj1",
698 "val 18750",
699 "adj2",
700 "val -8333",
701 "adj3",
702 "val 170013",
703 "adj4",
704 "val 143972",
705 "borderCallout2",
706 "adj1",
707 "val 18750",
708 "adj2",
709 "val -8333",
710 "adj3",
711 "val 113768",
712 "adj4",
713 "val -81930",
714 "adj5",
715 "val -22375",
716 "adj6",
717 "val -134550",
718 "blockArc",
719 "adj1",
720 "val 12975429",
721 "adj2",
722 "val 19424571",
723 "adj3",
724 "val 3770",
727 save("Impress Office Open XML");
729 xmlDocUniquePtr pXmlDocCT = parseExport("ppt/slides/slide1.xml");
730 const OString sPattern(
731 "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]");
732 const OString sT("_T_");
733 const OString sN("_N_");
734 const OString sPropertyName("name");
735 const OString sPropertyFmla("fmla");
737 size_t i = 0;
738 while (i < SAL_N_ELEMENTS(sShapeTypeAndValues))
740 OString sType(sShapeTypeAndValues[i++]);
741 for (size_t j = 1; i < SAL_N_ELEMENTS(sShapeTypeAndValues)
742 && o3tl::starts_with(sShapeTypeAndValues[i], "adj");
743 ++j)
745 OString sXPath = sPattern.replaceFirst(sT, sType).replaceFirst(sN, OString::number(j));
746 assertXPath(pXmlDocCT, sXPath, sPropertyName,
747 OUString::createFromAscii(sShapeTypeAndValues[i++]));
748 assertXPath(pXmlDocCT, sXPath, sPropertyFmla,
749 OUString::createFromAscii(sShapeTypeAndValues[i++]));
754 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf92527)
756 // We draw a diamond in an empty document.
757 // If custom shape has name and preset information in OOXML, should be export as preset shape.
758 createSdImpressDoc("empty.fodp");
759 uno::Reference<drawing::XDrawPage> xPage1(getPage(0));
760 uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
761 uno::Reference<drawing::XShape> xShape1(
762 xFactory->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY);
763 xPage1->add(xShape1);
764 xShape1->setSize(awt::Size(10000, 10000));
765 xShape1->setPosition(awt::Point(1000, 1000));
766 uno::Sequence<beans::PropertyValue> aShapeGeometry(comphelper::InitPropertySequence({
767 { "Type", uno::Any(OUString("diamond")) },
768 }));
769 uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY);
770 xPropertySet1->setPropertyValue("CustomShapeGeometry", uno::Any(aShapeGeometry));
772 saveAndReload("Impress Office Open XML");
774 uno::Reference<drawing::XDrawPagesSupplier> xDoc2(mxComponent, uno::UNO_QUERY_THROW);
775 uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0),
776 uno::UNO_QUERY_THROW);
777 uno::Reference<drawing::XShape> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY_THROW);
778 uno::Reference<beans::XPropertySet> xPropertySet2(xShape2, uno::UNO_QUERY_THROW);
779 uno::Sequence<beans::PropertyValue> aProps;
780 xPropertySet2->getPropertyValue("CustomShapeGeometry") >>= aProps;
781 uno::Sequence<beans::PropertyValue> aPathProps;
782 for (beans::PropertyValue const& rProp : std::as_const(aProps))
784 if (rProp.Name == "Path")
785 aPathProps = rProp.Value.get<uno::Sequence<beans::PropertyValue>>();
787 uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
788 for (beans::PropertyValue const& rProp : std::as_const(aPathProps))
790 if (rProp.Name == "Coordinates")
791 aCoordinates
792 = rProp.Value.get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>();
795 // 4 coordinate pairs
796 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCoordinates.getLength());
799 namespace
801 void matchNumberFormat(int nPage, uno::Reference<text::XTextField> const& xField)
803 uno::Reference<beans::XPropertySet> xPropSet(xField, uno::UNO_QUERY_THROW);
804 sal_Int32 nNumFmt;
805 xPropSet->getPropertyValue("NumberFormat") >>= nNumFmt;
806 switch (nPage)
808 case 0: // 13/02/96 (StdSmall)
809 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
810 sal_Int32(SvxDateFormat::StdSmall), nNumFmt);
811 break;
812 case 1: // 13/02/1996
813 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
814 sal_Int32(SvxDateFormat::B), nNumFmt);
815 break;
816 case 2: // Tuesday, June 29, 2021 (StdBig)
817 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
818 sal_Int32(SvxDateFormat::StdBig), nNumFmt);
819 break;
820 case 3: // 13:49:38 (Standard)
821 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
822 sal_Int32(SvxTimeFormat::Standard), nNumFmt);
823 break;
824 case 4: // 13:49
825 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
826 sal_Int32(SvxTimeFormat::HH24_MM), nNumFmt);
827 break;
828 case 5: // 01:49 PM
829 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
830 sal_Int32(SvxTimeFormat::HH12_MM), nNumFmt);
831 break;
832 case 6: // 01:49:38 PM
833 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
834 sal_Int32(SvxTimeFormat::HH12_MM_SS), nNumFmt);
835 break;
836 case 7: // June 29, 2021
837 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
838 sal_Int32(SvxDateFormat::D), nNumFmt);
839 break;
840 case 8: // Jun 29, 2021
841 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
842 sal_Int32(SvxDateFormat::C), nNumFmt);
843 break;
848 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testDatetimeFieldNumberFormat)
850 createSdImpressDoc("odp/numfmt.odp");
852 saveAndReload("Impress Office Open XML");
854 for (sal_uInt16 i = 0; i <= 8; ++i)
856 matchNumberFormat(i, getTextFieldFromPage(0, 0, 0, i));
860 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testDatetimeFieldNumberFormatPPTX)
862 createSdImpressDoc("pptx/numfmt.pptx");
864 saveAndReload("Impress Office Open XML");
866 for (sal_uInt16 i = 0; i <= 8; ++i)
868 matchNumberFormat(i, getTextFieldFromPage(0, 0, 0, i));
872 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testSlideNumberField)
874 createSdImpressDoc("odp/slidenum_field.odp");
876 saveAndReload("Impress Office Open XML");
878 uno::Reference<text::XTextField> xField = getTextFieldFromPage(0, 0, 0, 0);
879 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is());
882 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testSlideNumberFieldPPTX)
884 createSdImpressDoc("pptx/slidenum_field.pptx");
886 saveAndReload("Impress Office Open XML");
888 uno::Reference<text::XTextField> xField = getTextFieldFromPage(0, 0, 0, 0);
889 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is());
892 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testSlideCountField)
894 createSdImpressDoc("odp/slidecount_field.odp");
896 saveAndReload("Impress Office Open XML");
898 uno::Reference<text::XTextField> xField = getTextFieldFromPage(0, 0, 0, 0);
899 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is());
902 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testSlideNameField)
904 createSdImpressDoc("odp/slidename_field.odp");
906 saveAndReload("Impress Office Open XML");
908 uno::Reference<text::XTextField> xField = getTextFieldFromPage(0, 0, 0, 0);
909 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is());
912 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testExtFileField)
914 createSdImpressDoc("odp/extfile_field.odp");
916 saveAndReload("Impress Office Open XML");
918 for (sal_uInt16 i = 0; i <= 3; ++i)
920 uno::Reference<text::XTextField> xField = getTextFieldFromPage(0, 0, i, 0);
921 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is());
923 uno::Reference<beans::XPropertySet> xPropSet(xField, uno::UNO_QUERY_THROW);
924 sal_Int32 nNumFmt;
925 xPropSet->getPropertyValue("FileFormat") >>= nNumFmt;
926 switch (i)
928 case 0: // Path/File name
929 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(0), nNumFmt);
930 break;
931 case 1: // Path
932 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(1), nNumFmt);
933 break;
934 case 2: // File name without extension
935 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(2), nNumFmt);
936 break;
937 case 3: // File name with extension
938 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(3), nNumFmt);
943 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testAuthorField)
945 createSdImpressDoc("odp/author_field.odp");
947 saveAndReload("Impress Office Open XML");
949 uno::Reference<text::XTextField> xField = getTextFieldFromPage(0, 0, 0, 0);
950 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is());
953 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf99224)
955 createSdImpressDoc("odp/tdf99224.odp");
956 saveAndReload("Impress Office Open XML");
957 uno::Reference<drawing::XDrawPage> xPage = getPage(0);
958 // This was 0: the image with text was lost on export.
959 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xPage->getCount());
962 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf92076)
964 createSdImpressDoc("odp/tdf92076.odp");
965 saveAndReload("Impress Office Open XML");
966 uno::Reference<drawing::XDrawPage> xPage = getPage(0);
967 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xPage->getCount());
970 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf59046)
972 createSdImpressDoc("odp/tdf59046.odp");
973 save("Impress Office Open XML");
974 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
975 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
978 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf133502)
980 createSdImpressDoc("odp/tdf133502.odp");
981 save("Impress Office Open XML");
982 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/comments/comment1.xml");
984 assertXPathContent(pXmlDocRels, "/p:cmLst/p:cm/p:text", "Test for creator-initials");
986 // Without the fix in place, the comment position would have been 0,0
987 assertXPath(pXmlDocRels, "/p:cmLst/p:cm/p:pos", "x", "2032");
988 assertXPath(pXmlDocRels, "/p:cmLst/p:cm/p:pos", "y", "1029");
991 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf105739)
993 // Gradient was lost during saving to ODP
994 createSdImpressDoc("pptx/tdf105739.pptx");
995 save("impress8");
996 uno::Reference<drawing::XDrawPage> xPage = getPage(0);
997 uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
998 uno::Any aAny = xPropSet->getPropertyValue("Background");
999 CPPUNIT_ASSERT(aAny.hasValue());
1000 if (aAny.hasValue())
1002 uno::Reference<beans::XPropertySet> aXBackgroundPropSet;
1003 aAny >>= aXBackgroundPropSet;
1005 // Test fill type
1006 drawing::FillStyle aFillStyle(drawing::FillStyle_NONE);
1007 aXBackgroundPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
1008 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_GRADIENT), static_cast<int>(aFillStyle));
1010 // Test gradient properties
1011 com::sun::star::awt::Gradient2 aFillGradient;
1012 aXBackgroundPropSet->getPropertyValue("FillGradient") >>= aFillGradient;
1014 // MCGR: Use the completely imported gradient to check for correctness
1015 const basegfx::BColorStops aColorStops
1016 = model::gradient::getColorStopsFromUno(aFillGradient.ColorStops);
1018 CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size());
1019 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0));
1020 CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(1.0, 0.0, 0.0));
1021 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0));
1022 CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(),
1023 basegfx::BColor(0.0, 0.69019607843137254, 0.31372549019607843));
1024 CPPUNIT_ASSERT_EQUAL(int(awt::GradientStyle_LINEAR), static_cast<int>(aFillGradient.Style));
1028 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testPageBitmapWithTransparency)
1030 createSdImpressDoc("pptx/page_transparent_bitmap.pptx");
1032 saveAndReload("impress8");
1033 uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY);
1034 CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one page", static_cast<sal_Int32>(1),
1035 xDoc->getDrawPages()->getCount());
1037 uno::Reference<drawing::XDrawPage> xPage(getPage(0));
1039 uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
1040 uno::Any aAny = xPropSet->getPropertyValue("Background");
1041 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny.hasValue());
1043 uno::Reference<beans::XPropertySet> aXBackgroundPropSet;
1044 aAny >>= aXBackgroundPropSet;
1045 sal_Int32 nTransparence;
1046 aAny = aXBackgroundPropSet->getPropertyValue("FillTransparence");
1047 aAny >>= nTransparence;
1048 CPPUNIT_ASSERT_EQUAL_MESSAGE("Slide background transparency is wrong", sal_Int32(49),
1049 nTransparence);
1052 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testPptmContentType)
1054 createSdImpressDoc("pptm/macro.pptm");
1055 save("Impress MS PowerPoint 2007 XML VBA");
1057 // Assert that the content type is the one of PPTM
1058 xmlDocUniquePtr pXmlContentType = parseExport("[Content_Types].xml");
1059 assertXPath(pXmlContentType,
1060 "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
1061 "ContentType", "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");
1064 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf111798)
1066 createSdImpressDoc("odp/tdf111798.odp");
1067 save("Impress Office Open XML");
1068 xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
1070 const OUString data[][11] = { { "2700000", "2458080", "2414880", "1439640", "1440000", "gd[1]",
1071 "adj1", "val 50000", "gd[2]", "adj2", "val 25000" },
1072 { "2700000", "6778080", "2414880", "1439640", "1440000", "gd[1]",
1073 "adj1", "val 50000", "gd[2]", "adj2", "val 25006" } };
1075 for (size_t nShapeIndex = 0; nShapeIndex < SAL_N_ELEMENTS(data); nShapeIndex++)
1077 size_t nDataIndex = 0;
1079 const OString sSpPr
1080 = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex + 1) + "]/p:spPr";
1081 const OString sXfrm = sSpPr + "/a:xfrm";
1082 assertXPath(pXmlDoc, sXfrm, "rot", data[nShapeIndex][nDataIndex++]);
1083 const OString sOff = sXfrm + "/a:off";
1084 assertXPath(pXmlDoc, sOff, "x", data[nShapeIndex][nDataIndex++]);
1085 assertXPath(pXmlDoc, sOff, "y", data[nShapeIndex][nDataIndex++]);
1086 const OString sExt = sXfrm + "/a:ext";
1087 assertXPath(pXmlDoc, sExt, "cx", data[nShapeIndex][nDataIndex++]);
1088 assertXPath(pXmlDoc, sExt, "cy", data[nShapeIndex][nDataIndex++]);
1090 while (nDataIndex < SAL_N_ELEMENTS(data[nShapeIndex]))
1092 const OString sGd
1093 = sSpPr + "/a:prstGeom/a:avLst/a:" + data[nShapeIndex][nDataIndex++].toUtf8() + "";
1094 assertXPath(pXmlDoc, sGd, "name", data[nShapeIndex][nDataIndex++]);
1095 assertXPath(pXmlDoc, sGd, "fmla", data[nShapeIndex][nDataIndex++]);
1100 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testPptmVBAStream)
1102 createSdImpressDoc("pptm/macro.pptm");
1103 save("Impress MS PowerPoint 2007 XML VBA");
1105 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
1106 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
1107 maTempFile.GetURL());
1108 // This failed: VBA stream was not roundtripped
1109 CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/vbaProject.bin"));
1112 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf111863)
1114 createSdImpressDoc("pptx/tdf111863.pptx");
1115 save("Impress Office Open XML");
1117 // check that transition attribute didn't change from 'out' to 'in'
1118 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1119 assertXPath(pXmlDocContent,
1120 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
1121 "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect",
1122 "transition", "out");
1125 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf111518)
1127 createSdImpressDoc("pptx/tdf111518.pptx");
1128 save("Impress Office Open XML");
1130 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
1131 OUString sActual = getXPath(pXmlDocRels,
1132 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1133 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1134 "p:par/p:cTn/p:childTnLst/p:animMotion",
1135 "path");
1136 CPPUNIT_ASSERT_MOTIONPATH(u"M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E", sActual);
1139 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf100387)
1141 createSdImpressDoc("odp/tdf100387.odp");
1142 save("Impress Office Open XML");
1143 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1145 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn",
1146 "dur", "indefinite");
1147 assertXPath(
1148 pXmlDocContent,
1149 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]/p:cTn",
1150 "fill", "hold");
1151 assertXPath(pXmlDocContent,
1152 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1153 "p:par[1]/p:cTn/p:childTnLst/p:par/p:cTn",
1154 "fill", "hold");
1156 assertXPath(pXmlDocContent,
1157 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1158 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1159 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1160 "st", "0");
1161 assertXPath(pXmlDocContent,
1162 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1163 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1164 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1165 "end", "0");
1167 assertXPath(pXmlDocContent,
1168 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1169 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1170 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1171 "st", "1");
1172 assertXPath(pXmlDocContent,
1173 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1174 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1175 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1176 "end", "1");
1178 assertXPath(pXmlDocContent,
1179 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1180 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1181 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1182 "st", "2");
1183 assertXPath(pXmlDocContent,
1184 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1185 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1186 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1187 "end", "2");
1190 // tdf#126746 Add support for Line Caps import and export
1191 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testClosingShapesAndLineCaps)
1193 createSdImpressDoc("odp/closed-shapes.odp");
1194 save("Impress Office Open XML");
1195 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1196 assertXPath(pXmlDocContent,
1197 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt",
1199 assertXPath(pXmlDocContent,
1200 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt",
1202 assertXPath(pXmlDocContent,
1203 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[2]/a:pt",
1205 assertXPath(pXmlDocContent,
1206 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 1);
1207 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln", "cap", "rnd");
1208 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln/a:miter", 1);
1210 assertXPath(pXmlDocContent,
1211 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1212 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln", "cap", "rnd");
1213 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln/a:miter", 1);
1215 assertXPath(pXmlDocContent,
1216 "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1217 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln", "cap", "rnd");
1218 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln/a:miter", 1);
1220 assertXPath(pXmlDocContent,
1221 "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1222 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln", "cap", "sq");
1223 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln/a:round", 1);
1225 assertXPath(pXmlDocContent,
1226 "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1227 assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln",
1228 "cap"); // by default it is "flat" cap style
1229 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln/a:bevel", 1);
1231 assertXPath(pXmlDocContent,
1232 "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1233 assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln",
1234 "cap"); // by default it is "flat" cap style
1235 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:ln/a:round", 1);
1238 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testRotateFlip)
1240 createSdImpressDoc("odp/rotate_flip.odp");
1241 save("Impress Office Open XML");
1242 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1244 const OUString data[][4] = { // flipH flipV x y
1245 { "0", "1", "1170000", "1035720" },
1246 { "1", "1", "7108560", "1036440" },
1247 { "1", "0", "4140000", "1036440" }
1250 const OUString points[][2]
1251 = { { "221", "293" }, { "506", "12" }, { "367", "0" }, { "29", "406" },
1252 { "431", "347" }, { "145", "645" }, { "99", "520" }, { "0", "861" },
1253 { "326", "765" }, { "209", "711" }, { "640", "233" }, { "640", "233" } };
1255 for (size_t nShapeIndex = 0; nShapeIndex < SAL_N_ELEMENTS(data); nShapeIndex++)
1257 size_t nDataIndex = 0;
1259 const OString sSpPr
1260 = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex + 1) + "]/p:spPr";
1261 const OString sXfrm = sSpPr + "/a:xfrm";
1262 if (data[nShapeIndex][nDataIndex++] == "1")
1263 assertXPath(pXmlDocContent, sXfrm, "flipH", "1");
1264 if (data[nShapeIndex][nDataIndex++] == "1")
1265 assertXPath(pXmlDocContent, sXfrm, "flipV", "1");
1266 assertXPath(pXmlDocContent, sXfrm, "rot", "20400000");
1267 const OString sOff = sXfrm + "/a:off";
1268 assertXPath(pXmlDocContent, sOff, "x", data[nShapeIndex][nDataIndex++]);
1269 assertXPath(pXmlDocContent, sOff, "y", data[nShapeIndex][nDataIndex++]);
1270 const OString sExt = sXfrm + "/a:ext";
1271 assertXPath(pXmlDocContent, sExt, "cx", "1800000");
1272 assertXPath(pXmlDocContent, sExt, "cy", "3600000");
1274 for (size_t nPointIndex = 0; nPointIndex < SAL_N_ELEMENTS(points); nPointIndex++)
1276 const OString sPt = sSpPr + "/a:custGeom/a:pathLst/a:path/a:lnTo["
1277 + OString::number(nPointIndex + 1) + "]/a:pt";
1278 assertXPath(pXmlDocContent, sPt, "x", points[nPointIndex][0]);
1279 assertXPath(pXmlDocContent, sPt, "y", points[nPointIndex][1]);
1281 assertXPath(pXmlDocContent, sSpPr + "/a:custGeom/a:pathLst/a:path/a:close", 1);
1285 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf106867)
1287 createSdImpressDoc("pptx/tdf106867.pptx");
1288 save("Impress Office Open XML");
1290 const SdrPage* pPage = GetPage(1);
1292 // first check that we have the media object
1293 const SdrMediaObj* pMediaObj = dynamic_cast<SdrMediaObj*>(pPage->GetObj(2));
1294 CPPUNIT_ASSERT_MESSAGE("no media object", pMediaObj != nullptr);
1295 CPPUNIT_ASSERT_EQUAL(OUString("vnd.sun.star.Package:ppt/media/media1.avi"),
1296 pMediaObj->getURL());
1298 // additional checks of the output file
1299 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
1300 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
1301 maTempFile.GetURL());
1302 // check that the document contains the video stream
1303 CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/media/media1.avi"));
1305 // both the ooxml and the extended markup
1306 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1307 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile");
1308 assertXPath(pXmlDocContent,
1309 "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media");
1311 // target the shape with the video in the command
1312 assertXPath(pXmlDocContent,
1313 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
1314 "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/"
1315 "p:cBhvr/p:tgtEl/p:spTgt",
1316 "spid", "42");
1319 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112280)
1321 createSdImpressDoc("pptx/tdf112280.pptx");
1322 save("Impress Office Open XML");
1324 // check the animRot value
1325 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1326 assertXPath(pXmlDocContent,
1327 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
1328 "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animRot",
1329 "by", "21600000");
1332 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112088)
1334 createSdImpressDoc("pptx/tdf112088.pptx");
1335 save("Impress Office Open XML");
1337 // check gradient stops
1338 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1339 assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst",
1343 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112333)
1345 createSdImpressDoc("pptx/tdf112333.pptx");
1346 save("Impress Office Open XML");
1348 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1350 OUString sTo = getXPath(pXmlDocContent,
1351 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1352 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/"
1353 "p:cTn/p:childTnLst/p:set[1]/p:to/p:strVal",
1354 "val");
1355 CPPUNIT_ASSERT_EQUAL(OUString("solid"), sTo);
1357 OUString sAttributeName = getXPathContent(
1358 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1359 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1360 "p:childTnLst/p:set[1]/p:cBhvr/p:attrNameLst/p:attrName");
1361 CPPUNIT_ASSERT_EQUAL(OUString("fill.type"), sAttributeName);
1363 sTo = getXPath(pXmlDocContent,
1364 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1365 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1366 "p:set[2]/p:to/p:strVal",
1367 "val");
1368 CPPUNIT_ASSERT_EQUAL(OUString("true"), sTo);
1370 sAttributeName = getXPathContent(
1371 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1372 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1373 "p:childTnLst/p:set[2]/p:cBhvr/p:attrNameLst/p:attrName");
1374 CPPUNIT_ASSERT_EQUAL(OUString("fill.on"), sAttributeName);
1376 sTo = getXPath(pXmlDocContent,
1377 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1378 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1379 "p:animClr/p:to/a:srgbClr",
1380 "val");
1381 CPPUNIT_ASSERT_EQUAL(OUString("0563c1"), sTo);
1383 sAttributeName = getXPathContent(
1384 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1385 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1386 "p:childTnLst/p:animClr/p:cBhvr/p:attrNameLst/p:attrName");
1387 CPPUNIT_ASSERT_EQUAL(OUString("fillcolor"), sAttributeName);
1390 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112552)
1392 // Background fill was not displayed, but it was because of the wrong geometry
1393 createSdImpressDoc("odp/tdf112552.odp");
1394 save("Impress Office Open XML");
1396 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1397 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path",
1398 "w", "21600");
1399 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path",
1400 "h", "21600");
1401 assertXPath(pXmlDocContent,
1402 "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt",
1403 "x", "21600");
1404 assertXPath(pXmlDocContent,
1405 "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt",
1406 "y", "0");
1409 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112557)
1411 // Subtitle shape should be skipped by export.
1412 createSdImpressDoc("odp/tdf112557.odp");
1413 save("Impress Office Open XML");
1415 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slideMasters/slideMaster1.xml");
1416 assertXPath(pXmlDocContent, "/p:sldMaster/p:cSld/p:spTree/p:sp", 2); // title and object
1419 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf128049)
1421 createSdImpressDoc("odp/tdf128049.odp");
1422 save("Impress Office Open XML");
1424 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1425 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom", 0);
1426 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom", "prst",
1427 "noSmoking");
1428 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom/a:avLst/a:gd",
1429 "name", "adj");
1430 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom/a:avLst/a:gd",
1431 "fmla", "val 12500");
1434 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf106026)
1436 createSdImpressDoc("odp/tdf106026.odp");
1437 save("Impress Office Open XML");
1439 xmlDocUniquePtr pXmlMasterContent = parseExport("ppt/slideMasters/slideMaster1.xml");
1440 assertXPath(pXmlMasterContent,
1441 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr/a:spcBef/a:spcPts", "val",
1442 "1417");
1443 assertXPath(pXmlMasterContent,
1444 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:spcBef/a:spcPts", "val",
1445 "1134");
1446 assertXPath(pXmlMasterContent,
1447 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[3]/a:pPr/a:spcBef/a:spcPts", "val",
1448 "850");
1449 assertXPath(pXmlMasterContent,
1450 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[4]/a:pPr/a:spcBef/a:spcPts", "val",
1451 "567");
1452 assertXPath(pXmlMasterContent,
1453 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[5]/a:pPr/a:spcBef/a:spcPts", "val",
1454 "283");
1455 assertXPath(pXmlMasterContent,
1456 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[6]/a:pPr/a:spcBef/a:spcPts", "val",
1457 "283");
1458 assertXPath(pXmlMasterContent,
1459 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[7]/a:pPr/a:spcBef/a:spcPts", "val",
1460 "283");
1462 xmlDocUniquePtr pXmlSlideContent = parseExport("ppt/slides/slide1.xml");
1463 assertXPath(pXmlSlideContent,
1464 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:spcAft/a:spcPts", "val",
1465 "11339");
1466 assertXPath(pXmlSlideContent,
1467 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:spcAft/a:spcPts", "val",
1468 "11339");
1469 assertXPath(pXmlSlideContent,
1470 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:spcAft/a:spcPts", "val",
1471 "11339");
1474 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112334)
1476 createSdImpressDoc("pptx/tdf112334.pptx");
1477 save("Impress Office Open XML");
1479 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1481 OUString sAttributeName = getXPathContent(
1482 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1483 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1484 "p:childTnLst/p:animClr[1]/p:cBhvr/p:attrNameLst/p:attrName");
1485 CPPUNIT_ASSERT_EQUAL(OUString("style.color"), sAttributeName);
1488 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112089)
1490 createSdImpressDoc("pptx/tdf112089.pptx");
1491 save("Impress Office Open XML");
1493 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1495 OUString sID = getXPath(
1496 pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
1497 OUString sTarget = getXPath(pXmlDocContent,
1498 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1499 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1500 "p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt",
1501 "spid");
1502 CPPUNIT_ASSERT_EQUAL(sID, sTarget);
1505 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112086)
1507 createSdImpressDoc("pptx/tdf112086.pptx");
1508 save("Impress Office Open XML");
1510 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1512 OUString sVal = getXPath(pXmlDocContent,
1513 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1514 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/"
1515 "p:cTn/p:childTnLst/p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal",
1516 "val");
1517 CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal);
1519 OUString sAttributeName = getXPathContent(
1520 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1521 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1522 "p:childTnLst/p:anim[1]/p:cBhvr/p:attrNameLst/p:attrName");
1523 CPPUNIT_ASSERT_EQUAL(OUString("ppt_w"), sAttributeName);
1525 sVal = getXPath(pXmlDocContent,
1526 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1527 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1528 "p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal",
1529 "val");
1530 CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal);
1532 sAttributeName = getXPathContent(
1533 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1534 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1535 "p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
1536 CPPUNIT_ASSERT_EQUAL(OUString("ppt_h"), sAttributeName);
1539 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112647)
1541 createSdImpressDoc("odp/tdf112647.odp");
1542 saveAndReload("Impress Office Open XML");
1543 uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
1544 uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, xShape));
1545 uno::Reference<beans::XPropertySet> xPropSet(xParagraph, uno::UNO_QUERY_THROW);
1547 css::style::LineSpacing aLineSpacing;
1548 xPropSet->getPropertyValue("ParaLineSpacing") >>= aLineSpacing;
1549 CPPUNIT_ASSERT_EQUAL(sal_Int16(css::style::LineSpacingMode::FIX), aLineSpacing.Mode);
1550 CPPUNIT_ASSERT_EQUAL(sal_Int16(2117), aLineSpacing.Height);
1553 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testGroupRotation)
1555 createSdImpressDoc("odp/group_rotation.odp");
1556 save("Impress Office Open XML");
1558 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1559 assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm",
1560 "rot");
1561 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot",
1562 "20400000");
1563 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot",
1564 "20400000");
1567 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf104788)
1569 createSdImpressDoc("pptx/tdf104788.pptx");
1570 save("Impress Office Open XML");
1572 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide6.xml");
1574 OUString sVal = getXPath(pXmlDocContent,
1575 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1576 "p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1577 "p:par/p:cTn/p:childTnLst/p:anim[2]",
1578 "to");
1579 CPPUNIT_ASSERT_EQUAL(-1.0, sVal.toDouble());
1581 OUString sAttributeName = getXPathContent(
1582 pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1583 "p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1584 "p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
1585 CPPUNIT_ASSERT_EQUAL(OUString("xshear"), sAttributeName);
1588 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testSmartartRotation2)
1590 createSdImpressDoc("pptx/smartart-rotation2.pptx");
1592 // clear SmartArt data to check how group shapes with double-rotated children are exported, not smartart
1593 // NOTE: Resetting the GrabBag data is a *very* indirect way to reset the SmartArt functionality.
1594 // Since this worked before and there is not (yet?) a better way to do it using UNO API, I added
1595 // code to support this for now
1596 uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0));
1597 uno::Sequence<beans::PropertyValue> aInteropGrabBag;
1598 xShape->setPropertyValue("InteropGrabBag", uno::Any(aInteropGrabBag));
1600 save("Impress Office Open XML");
1602 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1603 assertXPathContent(pXmlDocContent,
1604 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", "Text");
1605 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot",
1606 "10800000");
1607 double dX = getXPath(pXmlDocContent,
1608 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "x")
1609 .toDouble();
1610 double dY = getXPath(pXmlDocContent,
1611 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "y")
1612 .toDouble();
1613 CPPUNIT_ASSERT_DOUBLES_EQUAL(2276280.0, dX, dX * .001);
1614 CPPUNIT_ASSERT_DOUBLES_EQUAL(3158280.0, dY, dY * .001);
1617 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf91999_rotateShape)
1619 createSdImpressDoc("pptx/tdf91999_rotateShape.pptx");
1620 save("Impress Office Open XML");
1622 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1623 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name",
1624 "CustomShape 2");
1625 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", "10800000");
1626 double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "x")
1627 .toDouble();
1628 double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "y")
1629 .toDouble();
1630 CPPUNIT_ASSERT_DOUBLES_EQUAL(2960640.0, dX, dX * .001);
1631 CPPUNIT_ASSERT_DOUBLES_EQUAL(1449000.0, dY, dY * .001);
1634 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf114845_rotateShape)
1636 createSdImpressDoc("pptx/tdf114845_rotateShape.pptx");
1637 save("Impress Office Open XML");
1639 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1640 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvPr", "name",
1641 "Straight Arrow Connector 9");
1642 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm", "flipV", "1");
1643 double dX
1644 = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm/a:off", "x")
1645 .toDouble();
1646 double dY
1647 = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm/a:off", "y")
1648 .toDouble();
1649 CPPUNIT_ASSERT_DOUBLES_EQUAL(4059000.0, dX, dX * .001);
1650 CPPUNIT_ASSERT_DOUBLES_EQUAL(3287520.0, dY, dY * .001);
1653 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testGroupsPosition)
1655 createSdImpressDoc("pptx/group.pptx");
1656 save("Impress Office Open XML");
1658 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1659 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off",
1660 "x", "5004000");
1661 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off",
1662 "y", "3310560");
1663 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off",
1664 "x", "7760160");
1665 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off",
1666 "y", "3310560");
1669 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testGroupsRotatedPosition)
1671 createSdImpressDoc("pptx/group-rot.pptx");
1672 save("Impress Office Open XML");
1674 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1675 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x",
1676 "2857320");
1677 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y",
1678 "4026960");
1681 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testAccentColor)
1683 createSdImpressDoc("pptx/accent-color.pptx");
1684 save("Impress Office Open XML");
1686 xmlDocUniquePtr pXmlDocContent1 = parseExport("ppt/slides/slide1.xml");
1687 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val",
1688 "accent6");
1689 xmlDocUniquePtr pXmlDocContent2 = parseExport("ppt/slides/slide2.xml");
1690 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val",
1691 "accent6");
1692 xmlDocUniquePtr pXmlDocTheme1 = parseExport("ppt/theme/theme1.xml");
1693 assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
1694 "70ad47");
1695 xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
1696 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
1697 "deb340");
1699 // Without the accompanying fix in place, this test would have failed with:
1700 // - Expected: Motyw pakietu Office
1701 // - Actual : Office Theme
1702 // i.e. the theme and color scheme name was lost on export.
1703 assertXPath(pXmlDocTheme1, "/a:theme", "name", "Motyw pakietu Office");
1704 assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme", "name", "Pakiet Office");
1707 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testThemeColors)
1709 createSdImpressDoc("pptx/tdf84205.pptx");
1710 save("Impress Office Open XML");
1712 xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme1.xml");
1713 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
1714 "44546a");
1715 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val",
1716 "a5a5a5");
1719 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf111785)
1721 createSdImpressDoc("odp/tdf111785.odp");
1722 save("Impress Office Open XML");
1724 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
1726 // Without the fix in place, this test would have failed with
1727 // - Expected: ed1c24
1728 // - Actual : ffffff
1729 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:pattFill/a:bgClr/a:srgbClr",
1730 "val", "ed1c24");
1733 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf118825)
1735 createSdImpressDoc("odp/tdf118825-motionpath.odp");
1736 save("Impress Office Open XML");
1737 xmlDocUniquePtr pXmlDocContent = parseExport("ppt/slides/slide1.xml");
1739 CPPUNIT_ASSERT_MOTIONPATH(
1740 u"M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 "
1741 u"0.0704264795523803 -0.00370117418637049 0.0831071428571428 -0.00819047619047622 C "
1742 u"0.0953550597998766 -0.0125265741339082 0.107821870086751 -0.010397536991717 "
1743 u"0.120321428571429 -0.0115555555555556 C 0.133179018681433 -0.0127467438724762 "
1744 u"0.151318627483861 -0.0158700272533852 0.1585 0.00539682539682542 C 0.16478291361998 "
1745 u"0.0240029898688431 0.15828642886492 0.0483806254341085 0.161392857142857 "
1746 u"0.0698412698412698 C 0.165179286017685 0.0959996731216037 0.17453898927982 "
1747 u"0.119735912694626 0.187142857142857 0.132634920634921 C 0.199788991845377 "
1748 u"0.145577185161529 0.215607110490848 0.142889773028431 0.230107142857143 "
1749 u"0.142857142857143 C 0.243821417584191 0.142826280916829 0.257716514999779 "
1750 u"0.142685979556724 0.271142857142857 0.137777777777778 C 0.286895094567923 "
1751 u"0.132019309914514 0.302318190711873 0.122962218306185 0.317928571428571 0.11568253968254 "
1752 u"C 0.333496771884548 0.108422531222479 0.348787823719556 0.0990570571890929 "
1753 u"0.363714285714286 0.0885079365079364 C 0.374930683062651 0.080580865157908 "
1754 u"0.385357142857143 0.0693333333333332 0.396178571428571 0.0596825396825396 L "
1755 u"0.404785714285714 0.0410158730158729 L 0.401892857142857 0.0342222222222221 E",
1756 getXPath(pXmlDocContent, "(//p:animMotion)[1]", "path"));
1757 CPPUNIT_ASSERT_MOTIONPATH(u"M 0.025 0.0571428571428571 L 0.0821428571428571 0.184126984126984 "
1758 u"L -0.175 0.234920634920635 L -0.246428571428571 "
1759 u"-0.0190476190476191 L -0.0821428571428573 -0.133333333333333 E",
1760 getXPath(pXmlDocContent, "(//p:animMotion)[2]", "path"));
1761 CPPUNIT_ASSERT_MOTIONPATH(
1762 u"M -0.0107142857142857 0.00634920634920635 C -0.110714285714286 0.501587301587301 "
1763 u"-0.153571428571429 -0.00634920634920635 -0.246428571428572 0.184126984126984 C "
1764 u"-0.339285714285715 0.374603174603175 -0.296428571428572 0.514285714285714 "
1765 u"-0.267857142857143 0.603174603174603 C -0.239285714285715 0.692063492063492 "
1766 u"0.0607142857142858 0.590476190476191 0.0607142857142858 0.590476190476191 E",
1767 getXPath(pXmlDocContent, "(//p:animMotion)[3]", "path"));
1768 CPPUNIT_ASSERT_MOTIONPATH(u"M 0.0535714285714286 -0.0444444444444444 L 0.132142857142857 "
1769 u"-0.0444444444444444 L 0.132142857142857 -0.146031746031746 L "
1770 u"0.0964285714285715 -0.146031746031746 E",
1771 getXPath(pXmlDocContent, "(//p:animMotion)[4]", "path"));
1774 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTextColumns_tdf140852)
1776 // The document defines two columns in slideLayout12.xml, but explicitly redefines
1777 // in slide1.xml. Here we check that the redefinition in the slide takes precedence.
1779 createSdImpressDoc("pptx/tdf140852.pptx");
1781 uno::Reference<drawing::XDrawPage> xPage(getPage(0));
1782 uno::Reference<container::XIndexAccess> xIndexAccess(xPage, uno::UNO_QUERY_THROW);
1783 uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
1784 uno::Reference<beans::XPropertySet> xProps(xShape, uno::UNO_QUERY_THROW);
1785 uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xProps));
1786 CPPUNIT_ASSERT_EQUAL(OUString("Training will be treated as part of sharing the sweet when "
1787 "it comes to serving ice cream"),
1788 xParagraph->getString());
1789 uno::Reference<text::XTextColumns> xCols(xProps->getPropertyValue("TextColumns"),
1790 uno::UNO_QUERY_THROW);
1791 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCols->getColumnCount());
1792 uno::Reference<beans::XPropertySet> xColProps(xCols, uno::UNO_QUERY_THROW);
1793 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(1000)),
1794 xColProps->getPropertyValue("AutomaticDistance"));
1796 save("Impress Office Open XML");
1799 uno::Reference<drawing::XDrawPage> xPage(getPage(0));
1800 uno::Reference<container::XIndexAccess> xIndexAccess(xPage, uno::UNO_QUERY_THROW);
1801 uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
1802 uno::Reference<beans::XPropertySet> xProps(xShape, uno::UNO_QUERY_THROW);
1803 uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xProps));
1804 CPPUNIT_ASSERT_EQUAL(OUString("Training will be treated as part of sharing the sweet when "
1805 "it comes to serving ice cream"),
1806 xParagraph->getString());
1807 uno::Reference<text::XTextColumns> xCols(xProps->getPropertyValue("TextColumns"),
1808 uno::UNO_QUERY_THROW);
1809 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCols->getColumnCount());
1810 uno::Reference<beans::XPropertySet> xColProps(xCols, uno::UNO_QUERY_THROW);
1811 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(1000)),
1812 xColProps->getPropertyValue("AutomaticDistance"));
1815 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
1816 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "numCol", "1");
1817 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "spcCol",
1818 "360000");
1821 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTextColumns_3columns)
1823 createSdImpressDoc("pptx/3columns.pptx");
1825 uno::Reference<drawing::XDrawPage> xPage(getPage(0));
1826 uno::Reference<container::XIndexAccess> xIndexAccess(xPage, uno::UNO_QUERY_THROW);
1827 uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
1828 uno::Reference<beans::XPropertySet> xProps(xShape, uno::UNO_QUERY_THROW);
1829 uno::Reference<text::XTextColumns> xCols(xProps->getPropertyValue("TextColumns"),
1830 uno::UNO_QUERY_THROW);
1831 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCols->getColumnCount());
1832 uno::Reference<beans::XPropertySet> xColProps(xCols, uno::UNO_QUERY_THROW);
1833 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(300)),
1834 xColProps->getPropertyValue("AutomaticDistance"));
1835 // Scale value may be unstable; just test that the text is actually scaled
1836 double fScale;
1837 CPPUNIT_ASSERT(xProps->getPropertyValue("TextFitToSizeScale") >>= fScale);
1838 CPPUNIT_ASSERT_GREATER(0.0, fScale);
1839 CPPUNIT_ASSERT_LESS(100.0, fScale);
1842 save("Impress Office Open XML");
1845 uno::Reference<drawing::XDrawPage> xPage(getPage(0));
1846 uno::Reference<container::XIndexAccess> xIndexAccess(xPage, uno::UNO_QUERY_THROW);
1847 uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW);
1848 uno::Reference<beans::XPropertySet> xProps(xShape, uno::UNO_QUERY_THROW);
1849 uno::Reference<text::XTextColumns> xCols(xProps->getPropertyValue("TextColumns"),
1850 uno::UNO_QUERY_THROW);
1851 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCols->getColumnCount());
1852 uno::Reference<beans::XPropertySet> xColProps(xCols, uno::UNO_QUERY_THROW);
1853 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(300)),
1854 xColProps->getPropertyValue("AutomaticDistance"));
1855 // Scale value may be unstable; just test that the text is actually scaled
1856 double fScale;
1857 CPPUNIT_ASSERT(xProps->getPropertyValue("TextFitToSizeScale") >>= fScale);
1858 CPPUNIT_ASSERT_GREATER(0.0, fScale);
1859 CPPUNIT_ASSERT_LESS(100.0, fScale);
1862 xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
1863 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "numCol", "3");
1864 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "spcCol",
1865 "108000");
1868 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf59323_slideFooters)
1870 createSdImpressDoc("pptx/tdf59323.pptx");
1872 save("Impress Office Open XML");
1874 uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY_THROW);
1875 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDoc->getDrawPages()->getCount());
1877 for (int nPageIndex = 0; nPageIndex < 3; nPageIndex++)
1879 uno::Reference<drawing::XDrawPage> xPage(getPage(0));
1880 uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
1881 CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsFooterVisible").get<bool>());
1882 CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsDateTimeVisible").get<bool>());
1883 CPPUNIT_ASSERT_EQUAL(true, xPropSet->getPropertyValue("IsPageNumberVisible").get<bool>());
1886 // Test placeholder indexes
1887 xmlDocUniquePtr pXmlDocMaster = parseExport("ppt/slideMasters/slideMaster1.xml");
1888 assertXPath(pXmlDocMaster, "//p:ph [@type='dt']", "idx", "1");
1889 assertXPath(pXmlDocMaster, "//p:ph [@type='ftr']", "idx", "2");
1890 assertXPath(pXmlDocMaster, "//p:ph [@type='sldNum']", "idx", "3");
1892 xmlDocUniquePtr pXmlDocSlide1 = parseExport("ppt/slides/slide1.xml");
1893 assertXPath(pXmlDocSlide1, "//p:ph [@type='dt']", "idx", "1");
1894 assertXPath(pXmlDocSlide1, "//p:ph [@type='ftr']", "idx", "2");
1895 assertXPath(pXmlDocSlide1, "//p:ph [@type='sldNum']", "idx", "3");
1897 // Test if datetime fields have text in them
1898 // This is needed for backwards compatibility
1899 assertXPath(pXmlDocSlide1, "//a:fld [@type='datetime1']/a:t");
1901 // tdf#143316: Without the fix in place, this test would have failed with
1902 // - Expected: 1
1903 // - Actual : 0
1904 assertXPath(pXmlDocSlide1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:fld/a:rPr");
1907 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf53970)
1909 // Embedded media file
1911 createSdImpressDoc("odp/tdf53970.odp");
1912 saveAndReload("Impress Office Open XML");
1914 // Without fix in place, the media shape was lost on export.
1915 CPPUNIT_ASSERT(getPage(0)->hasElements());
1918 // Linked media file
1920 createSdImpressDoc("odp/tdf53970_linked.odp");
1921 save("Impress Office Open XML");
1923 xmlDocUniquePtr pXmlRels = parseExport("ppt/slides/_rels/slide1.xml.rels");
1924 CPPUNIT_ASSERT(pXmlRels);
1925 assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);
1927 uno::Reference<beans::XPropertySet> xShape(getShape(0, getPage(0)));
1928 CPPUNIT_ASSERT(xShape.is());
1929 OUString sVideoURL;
1931 // Without fix in place, the media shape was imported as an image after export
1932 // and this test would have failed with exception of type com.sun.star.beans.UnknownPropertyException
1933 CPPUNIT_ASSERT_MESSAGE("MediaURL property is not set",
1934 xShape->getPropertyValue("MediaURL") >>= sVideoURL);
1935 CPPUNIT_ASSERT_MESSAGE("MediaURL is empty", !sVideoURL.isEmpty());
1939 CPPUNIT_PLUGIN_IMPLEMENT();
1941 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */