1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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 */
9 #include <officecfg/Office/Common.hxx>
10 #include "sdmodeltestbase.hxx"
11 #include <comphelper/propertysequence.hxx>
12 #include <comphelper/sequence.hxx>
13 #include <editeng/eeitem.hxx>
14 #include <editeng/editobj.hxx>
15 #include <editeng/outlobj.hxx>
16 #include <editeng/numitem.hxx>
17 #include <editeng/unoprnms.hxx>
18
19 #include <svx/svdotext.hxx>
20 #include <svx/svdomedia.hxx>
21 #include <svx/xlineit0.hxx>
22 #include <svx/xlndsit.hxx>
23 #include <rtl/ustring.hxx>
24
25 #include <com/sun/star/drawing/XDrawPage.hpp>
26 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
27 #include <com/sun/star/animations/TransitionType.hpp>
28 #include <com/sun/star/animations/TransitionSubType.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/awt/Gradient.hpp>
31 #include <com/sun/star/awt/Rectangle.hpp>
32 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
33 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
34 #include <com/sun/star/drawing/FillStyle.hpp>
35 #include <com/sun/star/style/LineSpacing.hpp>
36 #include <com/sun/star/style/LineSpacingMode.hpp>
37 #include <com/sun/star/frame/XLoadable.hpp>
38
39 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
40
41 #include <sdpage.hxx>
42 #include <cfloat>
43 #include <rtl/character.hxx>
44
45 using namespace css;
46 using namespace css::animations;
47
48 namespace {
49
checkBeginWithNumber(const OUString & rStr)50 bool checkBeginWithNumber(const OUString& rStr)
51 {
52 sal_Unicode aChar = (rStr.getLength() > 1) ? rStr[0] : '\0';
53 return aChar == '.' || aChar == '-' || rtl::isAsciiDigit(aChar);
54 }
55
56 }
57
58 #define CPPUNIT_ASSERT_MOTIONPATH(expect, actual) \
59 assertMotionPath(expect, actual, CPPUNIT_SOURCELINE())
60
assertMotionPath(const OUString & rStr1,const OUString & rStr2,const CppUnit::SourceLine & rSourceLine)61 static void assertMotionPath(const OUString &rStr1, const OUString &rStr2, const CppUnit::SourceLine &rSourceLine)
62 {
63 sal_Int32 nIdx1 = 0;
64 sal_Int32 nIdx2 = 0;
65
66 OString sMessage = OUStringToOString("Motion path values mismatch.\nExpect: " + rStr1 +
67 "\nActual: " + rStr2, RTL_TEXTENCODING_UTF8);
68
69 while(nIdx1 != -1 && nIdx2 != -1)
70 {
71 OUString aToken1 = rStr1.getToken(0, ' ', nIdx1);
72 OUString aToken2 = rStr2.getToken(0, ' ', nIdx2);
73
74 if (checkBeginWithNumber(aToken1) && checkBeginWithNumber(aToken2))
75 assertDoubleEquals(aToken1.toDouble(), aToken2.toDouble(), DBL_EPSILON, rSourceLine, sMessage.getStr());
76 else
77 assertEquals(aToken1, aToken2, rSourceLine, sMessage.getStr());
78 }
79 assertEquals(sal_Int32(-1), nIdx1, rSourceLine, sMessage.getStr());
80 assertEquals(sal_Int32(-1), nIdx2, rSourceLine, sMessage.getStr());
81 }
82
83 class SdOOXMLExportTest2 : public SdModelTestBaseXML
84 {
85 public:
86 void testTdf93883();
87 void testTdf91378();
88 void testBnc822341();
89 void testMathObject();
90 void testMathObjectPPT2010();
91 void testTdf80224();
92 void testExportTransitionsPPTX();
93 void testPresetShapesExport();
94 void testTdf92527();
95 void testDatetimeFieldNumberFormat();
96 void testDatetimeFieldNumberFormatPPTX();
97 void testSlideNumberField();
98 void testSlideNumberFieldPPTX();
99 void testSlideCountField();
100 void testSlideNameField();
101 void testExtFileField();
102 void testAuthorField();
103 void testTdf99224();
104 void testTdf92076();
105 void testTdf59046();
106 void testTdf105739();
107 void testPageBitmapWithTransparency();
108 void testPptmContentType();
109 void testTdf111798();
110 void testPptmVBAStream();
111 void testTdf111863();
112 void testTdf111518();
113 void testTdf100387();
114 void testClosingShapesAndLineCaps();
115 void testRotateFlip();
116 void testTdf106867();
117 void testTdf112280();
118 void testTdf112088();
119 void testTdf112333();
120 void testTdf112552();
121 void testTdf112557();
122 void testTdf112334();
123 void testTdf112089();
124 void testTdf112086();
125 void testTdf112647();
126 void testGroupRotation();
127 void testTdf104788();
128 void testSmartartRotation2();
129 void testTdf91999_rotateShape();
130 void testTdf114845_rotateShape();
131 void testGroupsPosition();
132 void testGroupsRotatedPosition();
133 void testAccentColor();
134 void testThemeColors();
135 void testTdf114848();
136 void testTdf68759();
137 void testTdf127901();
138 void testTdf90626();
139 void testTdf107608();
140 void testTdf111786();
141 void testFontScale();
142 void testShapeAutofitPPTX();
143 void testLegacyShapeAutofitPPTX();
144 void testTdf115394();
145 void testTdf115394Zero();
146 void testTdf115005();
147 int testTdf115005_FallBack_Images(bool bAddReplacementImages);
148 void testTdf115005_FallBack_Images_On();
149 void testTdf115005_FallBack_Images_Off();
150 void testTdf118806();
151 void testTdf111789();
152 void testTdf100348_convert_Fontwork2TextWarp();
153 void testTdf1225573_FontWorkScaleX();
154 void testTdf99497_keepAppearanceOfCircleKind();
155 /// SmartArt animated elements
156 void testTdf104792();
157 void testTdf90627();
158 void testTdf104786();
159 void testTdf118783();
160 void testTdf104789();
161 void testOpenDocumentAsReadOnly();
162 void testTdf118835();
163 void testTdf118768();
164 void testTdf118836();
165 void testTdf116350TextEffects();
166 void testTdf128096();
167 void testTdf120573();
168 void testTdf118825();
169 void testTdf119118();
170 void testTdf99213();
171 void testPotxExport();
172 void testTdf44223();
173 void testSmartArtPreserve();
174 void testTdf125346();
175 void testTdf125346_2();
176 void testTdf125360();
177 void testTdf125360_1();
178 void testTdf125360_2();
179 void testTdf125551();
180 void testTdf126234();
181 void testTdf126741();
182 void testTdf127372();
183 void testTdf127379();
184 void testTdf98603();
185 void testTdf79082();
186 void testTdf119087();
187 void testTdf131554();
188 void testTdf132282();
189
190 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
191
192 CPPUNIT_TEST(testTdf93883);
193 CPPUNIT_TEST(testTdf91378);
194 CPPUNIT_TEST(testBnc822341);
195 CPPUNIT_TEST(testMathObject);
196 CPPUNIT_TEST(testMathObjectPPT2010);
197 CPPUNIT_TEST(testTdf80224);
198 CPPUNIT_TEST(testExportTransitionsPPTX);
199 CPPUNIT_TEST(testPresetShapesExport);
200 CPPUNIT_TEST(testTdf92527);
201 CPPUNIT_TEST(testDatetimeFieldNumberFormat);
202 CPPUNIT_TEST(testDatetimeFieldNumberFormatPPTX);
203 CPPUNIT_TEST(testSlideNumberField);
204 CPPUNIT_TEST(testSlideNumberFieldPPTX);
205 CPPUNIT_TEST(testSlideCountField);
206 CPPUNIT_TEST(testSlideNameField);
207 CPPUNIT_TEST(testExtFileField);
208 CPPUNIT_TEST(testAuthorField);
209 CPPUNIT_TEST(testTdf99224);
210 CPPUNIT_TEST(testTdf92076);
211 CPPUNIT_TEST(testTdf59046);
212 CPPUNIT_TEST(testTdf105739);
213 CPPUNIT_TEST(testPageBitmapWithTransparency);
214 CPPUNIT_TEST(testPptmContentType);
215 CPPUNIT_TEST(testTdf111798);
216 CPPUNIT_TEST(testPptmVBAStream);
217 CPPUNIT_TEST(testTdf111863);
218 CPPUNIT_TEST(testTdf111518);
219 CPPUNIT_TEST(testTdf100387);
220 CPPUNIT_TEST(testClosingShapesAndLineCaps);
221 CPPUNIT_TEST(testRotateFlip);
222 CPPUNIT_TEST(testTdf106867);
223 CPPUNIT_TEST(testTdf112280);
224 CPPUNIT_TEST(testTdf112088);
225 CPPUNIT_TEST(testTdf112333);
226 CPPUNIT_TEST(testTdf112552);
227 CPPUNIT_TEST(testTdf112557);
228 CPPUNIT_TEST(testTdf112334);
229 CPPUNIT_TEST(testTdf112089);
230 CPPUNIT_TEST(testTdf112086);
231 CPPUNIT_TEST(testTdf112647);
232 CPPUNIT_TEST(testGroupRotation);
233 CPPUNIT_TEST(testTdf104788);
234 CPPUNIT_TEST(testSmartartRotation2);
235 CPPUNIT_TEST(testTdf91999_rotateShape);
236 CPPUNIT_TEST(testTdf114845_rotateShape);
237 CPPUNIT_TEST(testGroupsPosition);
238 CPPUNIT_TEST(testGroupsRotatedPosition);
239 CPPUNIT_TEST(testAccentColor);
240 CPPUNIT_TEST(testThemeColors);
241 CPPUNIT_TEST(testTdf114848);
242 CPPUNIT_TEST(testTdf68759);
243 CPPUNIT_TEST(testTdf127901);
244 CPPUNIT_TEST(testTdf90626);
245 CPPUNIT_TEST(testTdf107608);
246 CPPUNIT_TEST(testTdf111786);
247 CPPUNIT_TEST(testFontScale);
248 CPPUNIT_TEST(testShapeAutofitPPTX);
249 CPPUNIT_TEST(testLegacyShapeAutofitPPTX);
250 CPPUNIT_TEST(testTdf115394);
251 CPPUNIT_TEST(testTdf115394Zero);
252 CPPUNIT_TEST(testTdf115005);
253 CPPUNIT_TEST(testTdf115005_FallBack_Images_On);
254 CPPUNIT_TEST(testTdf115005_FallBack_Images_Off);
255 CPPUNIT_TEST(testTdf118806);
256 CPPUNIT_TEST(testTdf111789);
257 CPPUNIT_TEST(testTdf100348_convert_Fontwork2TextWarp);
258 CPPUNIT_TEST(testTdf1225573_FontWorkScaleX);
259 CPPUNIT_TEST(testTdf99497_keepAppearanceOfCircleKind);
260 CPPUNIT_TEST(testTdf104792);
261 CPPUNIT_TEST(testTdf90627);
262 CPPUNIT_TEST(testTdf104786);
263 CPPUNIT_TEST(testTdf118783);
264 CPPUNIT_TEST(testTdf104789);
265 CPPUNIT_TEST(testOpenDocumentAsReadOnly);
266 CPPUNIT_TEST(testTdf118835);
267 CPPUNIT_TEST(testTdf118768);
268 CPPUNIT_TEST(testTdf118836);
269 CPPUNIT_TEST(testTdf116350TextEffects);
270 CPPUNIT_TEST(testTdf128096);
271 CPPUNIT_TEST(testTdf120573);
272 CPPUNIT_TEST(testTdf118825);
273 CPPUNIT_TEST(testTdf119118);
274 CPPUNIT_TEST(testTdf99213);
275 CPPUNIT_TEST(testPotxExport);
276 CPPUNIT_TEST(testTdf44223);
277 CPPUNIT_TEST(testSmartArtPreserve);
278 CPPUNIT_TEST(testTdf125346);
279 CPPUNIT_TEST(testTdf125346_2);
280 CPPUNIT_TEST(testTdf125360);
281 CPPUNIT_TEST(testTdf125360_1);
282 CPPUNIT_TEST(testTdf125360_2);
283 CPPUNIT_TEST(testTdf125551);
284 CPPUNIT_TEST(testTdf126234);
285 CPPUNIT_TEST(testTdf126741);
286 CPPUNIT_TEST(testTdf127372);
287 CPPUNIT_TEST(testTdf127379);
288 CPPUNIT_TEST(testTdf98603);
289 CPPUNIT_TEST(testTdf79082);
290 CPPUNIT_TEST(testTdf119087);
291 CPPUNIT_TEST(testTdf131554);
292 CPPUNIT_TEST(testTdf132282);
293
294 CPPUNIT_TEST_SUITE_END();
295
registerNamespaces(xmlXPathContextPtr & pXmlXPathCtx)296 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
297 {
298 static const struct { char const * pPrefix; char const * pURI; } namespaces[] =
299 {
300 // OOXML
301 { "ContentType", "http://schemas.openxmlformats.org/package/2006/content-types" },
302 { "rels", "http://schemas.openxmlformats.org/package/2006/relationships" },
303 { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
304 { "v", "urn:schemas-microsoft-com:vml" },
305 { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
306 { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
307 { "m", "http://schemas.openxmlformats.org/officeDocument/2006/math" },
308 { "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture" },
309 { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
310 { "p", "http://schemas.openxmlformats.org/presentationml/2006/main" },
311 { "p14", "http://schemas.microsoft.com/office/powerpoint/2010/main" },
312 { "r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
313 { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
314 { "a14", "http://schemas.microsoft.com/office/drawing/2010/main" },
315 { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
316 { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
317 { "dgm", "http://schemas.openxmlformats.org/drawingml/2006/diagram" },
318 };
319 for (size_t i = 0; i < SAL_N_ELEMENTS(namespaces); ++i)
320 {
321 xmlXPathRegisterNs(pXmlXPathCtx,
322 reinterpret_cast<xmlChar const *>(namespaces[i].pPrefix),
323 reinterpret_cast<xmlChar const *>(namespaces[i].pURI));
324 }
325 }
326
327 };
328
testTdf93883()329 void SdOOXMLExportTest2::testTdf93883()
330 {
331 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf93883.odp"), ODP);
332 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
333 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
334 uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
335 uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
336 CPPUNIT_ASSERT(!xPropSet->getPropertyValue("NumberingLevel").hasValue());
337 }
338
testBnc822341()339 void SdOOXMLExportTest2::testBnc822341()
340 {
341 // Check import / export of embedded text document
342 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP);
343 utl::TempFile tempFile1;
344 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile1 );
345
346 // Export an LO specific ole object (imported from an ODP document)
347 {
348 xmlDocPtr pXmlDocCT = parseExport(tempFile1, "[Content_Types].xml");
349 assertXPath(pXmlDocCT,
350 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
351 "PartName",
352 "/ppt/embeddings/oleObject1.docx");
353
354 xmlDocPtr pXmlDocRels = parseExport(tempFile1, "ppt/slides/_rels/slide1.xml.rels");
355 assertXPath(pXmlDocRels,
356 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
357 "Type",
358 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
359
360 xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
361 assertXPath(pXmlDocContent,
362 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
363 "progId",
364 "Word.Document.12");
365
366 const SdrPage *pPage = GetPage( 1, xDocShRef.get() );
367
368 const SdrObject* pObj = pPage->GetObj(0);
369 CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
370 CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
371 }
372
373 utl::TempFile tempFile2;
374 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile2 );
375
376 // Export an MS specific ole object (imported from a PPTX document)
377 {
378 xmlDocPtr pXmlDocCT = parseExport(tempFile2, "[Content_Types].xml");
379 assertXPath(pXmlDocCT,
380 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
381 "PartName",
382 "/ppt/embeddings/oleObject1.docx");
383
384 xmlDocPtr pXmlDocRels = parseExport(tempFile2, "ppt/slides/_rels/slide1.xml.rels");
385 assertXPath(pXmlDocRels,
386 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
387 "Type",
388 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
389
390 xmlDocPtr pXmlDocContent = parseExport(tempFile2, "ppt/slides/slide1.xml");
391 assertXPath(pXmlDocContent,
392 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
393 "progId",
394 "Word.Document.12");
395
396 SdDrawDocument *pDoc = xDocShRef->GetDoc();
397 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
398 const SdrPage *pPage = pDoc->GetPage(1);
399 CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
400
401 const SdrObject* pObj = pPage->GetObj(0);
402 CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
403 CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
404 }
405
406 xDocShRef->DoClose();
407 }
408
testMathObject()409 void SdOOXMLExportTest2::testMathObject()
410 {
411 // Check import / export of math object
412 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP);
413 utl::TempFile tempFile1;
414 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile1);
415
416 // Export an LO specific ole object (imported from an ODP document)
417 {
418 xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
419 assertXPath(pXmlDocContent,
420 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
421 "Requires",
422 "a14");
423 assertXPathContent(pXmlDocContent,
424 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t",
425 "a");
426
427 const SdrPage *pPage = GetPage(1, xDocShRef);
428 const SdrObject* pObj = pPage->GetObj(0);
429 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
430 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
431 }
432
433 utl::TempFile tempFile2;
434 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile2 );
435
436 // Export an MS specific ole object (imported from a PPTX document)
437 {
438 xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
439 assertXPath(pXmlDocContent,
440 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
441 "Requires",
442 "a14");
443 assertXPathContent(pXmlDocContent,
444 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t",
445 "a");
446
447 const SdrPage *pPage = GetPage(1, xDocShRef);
448 const SdrObject* pObj = pPage->GetObj(0);
449 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
450 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
451 }
452
453 xDocShRef->DoClose();
454 }
455
testMathObjectPPT2010()456 void SdOOXMLExportTest2::testMathObjectPPT2010()
457 {
458 // Check import / export of math object
459 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX);
460 utl::TempFile tempFile1;
461 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile1);
462
463 // Export an MS specific ole object (imported from a PPTX document)
464 {
465 xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml");
466 assertXPath(pXmlDocContent,
467 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
468 "Requires",
469 "a14");
470 assertXPathContent(pXmlDocContent,
471 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:sSup/m:e/m:r[1]/m:t",
472 u"\U0001D44E"); // non-BMP char
473
474 const SdrPage *pPage = GetPage(1, xDocShRef);
475 const SdrObject* pObj = pPage->GetObj(0);
476 CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr);
477 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier());
478 }
479
480 xDocShRef->DoClose();
481 }
482
testTdf80224()483 void SdOOXMLExportTest2::testTdf80224()
484 {
485 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP);
486 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
487 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
488
489 uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
490 uno::Reference< beans::XPropertySet > xPropSet( xParagraph->getStart(), uno::UNO_QUERY_THROW );
491
492 sal_Int32 nCharColor;
493 xPropSet->getPropertyValue("CharColor") >>= nCharColor;
494 CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor);
495 xDocShRef->DoClose();
496 }
497
testTdf91378()498 void SdOOXMLExportTest2::testTdf91378()
499 {
500
501 //Check For Import and Export Both
502 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf91378.pptx"), PPTX);
503 for( sal_uInt32 i=0;i<2;i++)
504 {
505 SdDrawDocument *pDoc = xDocShRef->GetDoc();
506 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
507 uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY );
508 uno::Reference<document::XDocumentProperties> xProps = xDocumentPropertiesSupplier->getDocumentProperties();
509 uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY );
510 OUString propValue;
511 xUDProps->getPropertyValue("Testing") >>= propValue;
512 CPPUNIT_ASSERT(propValue.isEmpty());
513 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
514 }
515 xDocShRef->DoClose();
516 }
517
checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> const & xDoc,sal_Int32 nSlideNumber,sal_Int16 nExpectedTransitionType,sal_Int16 nExpectedTransitionSubType,bool bExpectedDirection=true)518 static bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> const & xDoc, sal_Int32 nSlideNumber,
519 sal_Int16 nExpectedTransitionType, sal_Int16 nExpectedTransitionSubType,
520 bool bExpectedDirection = true)
521 {
522 sal_Int32 nSlideIndex = nSlideNumber - 1;
523
524 CPPUNIT_ASSERT_MESSAGE("Slide/Page index out of range", nSlideIndex < xDoc->getDrawPages()->getCount());
525
526 uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(nSlideIndex), uno::UNO_QUERY_THROW);
527 uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
528
529 sal_Int16 nTransitionType = 0;
530 xPropSet->getPropertyValue("TransitionType") >>= nTransitionType;
531
532 if (nExpectedTransitionType != nTransitionType)
533 {
534 std::cerr << "Transition type: " << nTransitionType << " " << nExpectedTransitionType << std::endl;
535 return false;
536 }
537
538 sal_Int16 nTransitionSubtype = 0;
539 xPropSet->getPropertyValue("TransitionSubtype") >>= nTransitionSubtype;
540 if (nExpectedTransitionSubType != nTransitionSubtype)
541 {
542 std::cerr << "Transition Subtype: " << nTransitionSubtype << " " << nExpectedTransitionSubType << std::endl;
543 return false;
544 }
545
546 bool bDirection = false;
547 xPropSet->getPropertyValue("TransitionDirection") >>= bDirection;
548
549 if (bExpectedDirection != bDirection)
550 {
551 std::cerr << "Transition Direction: " << (bExpectedDirection ? "normal" : "reversed")
552 << " " << (bDirection ? "normal" : "reversed") << std::endl;
553 return false;
554 }
555
556 return true;
557 }
558
testExportTransitionsPPTX()559 void SdOOXMLExportTest2::testExportTransitionsPPTX()
560 {
561 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP);
562 xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
563 uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
564
565 // WIPE TRANSITIONS
566 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 01, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM, false));
567 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 02, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT));
568 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 03, TransitionType::BARWIPE, TransitionSubType::LEFTTORIGHT, false));
569 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 04, TransitionType::BARWIPE, TransitionSubType::TOPTOBOTTOM));
570
571 // CUT THROUGH BLACK
572 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 31, TransitionType::BARWIPE, TransitionSubType::FADEOVERCOLOR));
573
574 // COMB
575 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 41, TransitionType::PUSHWIPE, TransitionSubType::COMBHORIZONTAL));
576 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 42, TransitionType::PUSHWIPE, TransitionSubType::COMBVERTICAL));
577
578 // OUTSIDE TURNING CUBE
579 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 57, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSOUT));
580 // INSIDE TURNING CUBE
581 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 60, TransitionType::MISCSHAPEWIPE, TransitionSubType::CORNERSIN));
582
583 // FALL
584 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 61, TransitionType::MISCSHAPEWIPE, TransitionSubType::LEFTTORIGHT));
585
586 // VORTEX
587 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 70, TransitionType::MISCSHAPEWIPE, TransitionSubType::VERTICAL));
588
589 // RIPPLE
590 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 71, TransitionType::MISCSHAPEWIPE, TransitionSubType::HORIZONTAL));
591
592 // GLITTER
593 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::MISCSHAPEWIPE, TransitionSubType::DIAMOND));
594
595 // HONEYCOMB
596 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 73, TransitionType::MISCSHAPEWIPE, TransitionSubType::HEART));
597
598 // NEWSFLASH
599 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 74, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
600
601 // OVAL VERTICAL - cannot be exported to PPTX so fallback to circle
602 //CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::VERTICAL));
603 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::CIRCLE));
604
605 xDocShRef->DoClose();
606 }
607
testPresetShapesExport()608 void SdOOXMLExportTest2::testPresetShapesExport()
609 {
610 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/preset-shapes-export.odp"), ODP);
611 const sal_Char *sShapeTypeAndValues[] =
612 {
613 "wedgeEllipseCallout",
614 "adj1","val 45310",
615 "adj2","val 97194",
616 "wedgeRoundRectCallout",
617 "adj1","val 46694",
618 "adj2","val 129726",
619 "adj3","val 16667",
620 "wedgeRectCallout",
621 "adj1","val 40037",
622 "adj2","val 111694",
623 "smileyFace",
624 "adj","val -9282",
625 "can",
626 "adj","val 50000",
627 "frame",
628 "adj1","val 10490",
629 "donut",
630 "adj","val 9601",
631 "bevel",
632 "adj","val 42587",
633 "foldedCorner",
634 "adj","val 10750",
635 "verticalScroll",
636 "adj","val 25000",
637 "horizontalScroll",
638 "adj","val 25000",
639 "cube",
640 "adj","val 85129",
641 "bracketPair",
642 "adj","val 50000",
643 "sun",
644 "adj","val 12500",
645 "bracePair",
646 "adj","val 25000",
647 "cloudCallout",
648 "adj1","val 77611",
649 "adj2","val -47819",
650 "borderCallout1",
651 "adj1","val 18750",
652 "adj2","val -8333",
653 "adj3","val 170013",
654 "adj4","val 143972",
655 "borderCallout2",
656 "adj1","val 18750",
657 "adj2","val -8333",
658 "adj3","val 113768",
659 "adj4","val -81930",
660 "adj5","val -22375",
661 "adj6","val -134550",
662 "blockArc",
663 "adj1","val 13020000",
664 "adj2","val 19380000",
665 "adj3","val 3773",
666 };
667
668 utl::TempFile tempFile;
669 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile );
670
671 xmlDocPtr pXmlDocCT = parseExport(tempFile, "ppt/slides/slide1.xml");
672 const OString sPattern( "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]" );
673 const OString sT( "_T_" );
674 const OString sN( "_N_" );
675 const OString sPropertyName("name");
676 const OString sPropertyFmla("fmla");
677
678 size_t i = 0;
679 while(i < SAL_N_ELEMENTS( sShapeTypeAndValues )) {
680 OString sType( sShapeTypeAndValues[ i++ ] );
681 for ( size_t j = 1 ; i < SAL_N_ELEMENTS( sShapeTypeAndValues ) && OString(sShapeTypeAndValues[i]).startsWith("adj") ; ++j ) {
682 OString sXPath= sPattern.replaceFirst( sT, sType).replaceFirst( sN, OString::number(j) );
683 assertXPath(pXmlDocCT, sXPath, sPropertyName , OUString::createFromAscii(sShapeTypeAndValues[ i++ ]) );
684 assertXPath(pXmlDocCT, sXPath, sPropertyFmla , OUString::createFromAscii(sShapeTypeAndValues[ i++ ]) );
685 }
686 }
687 }
688
testTdf92527()689 void SdOOXMLExportTest2::testTdf92527()
690 {
691 // We draw a diamond in an empty document. A newly created diamond shape does not have
692 // CustomShapeGeometry - Path - Segments property, and previously DrawingML exporter
693 // did not export custom shapes which did not have CustomShapeGeometry - Path - Segments property.
694 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/empty.fodp"), FODG );
695 uno::Reference<css::lang::XMultiServiceFactory> xFactory(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY);
696 uno::Reference<drawing::XShape> xShape1(xFactory->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY);
697 uno::Reference<drawing::XDrawPagesSupplier> xDoc1(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
698 uno::Reference<drawing::XDrawPage> xPage1(xDoc1->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
699 xPage1->add(xShape1);
700 xShape1->setSize(awt::Size(10000, 10000));
701 xShape1->setPosition(awt::Point(1000, 1000));
702 uno::Sequence<beans::PropertyValue> aShapeGeometry(comphelper::InitPropertySequence(
703 {
704 {"Type", uno::makeAny(OUString("diamond"))},
705 }));
706 uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY);
707 xPropertySet1->setPropertyValue("CustomShapeGeometry", uno::makeAny(aShapeGeometry));
708
709 xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
710
711 uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
712 uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
713 uno::Reference<drawing::XShape> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY_THROW);
714 uno::Reference< beans::XPropertySet > xPropertySet2( xShape2, uno::UNO_QUERY_THROW );
715 uno::Sequence<beans::PropertyValue> aProps;
716 xPropertySet2->getPropertyValue("CustomShapeGeometry") >>= aProps;
717 uno::Sequence<beans::PropertyValue> aPathProps;
718 for (int i = 0; i < aProps.getLength(); ++i)
719 {
720 const beans::PropertyValue& rProp = aProps[i];
721 if (rProp.Name == "Path")
722 aPathProps = rProp.Value.get< uno::Sequence<beans::PropertyValue> >();
723 }
724 uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
725 for (int i = 0; i < aPathProps.getLength(); ++i)
726 {
727 const beans::PropertyValue& rProp = aPathProps[i];
728 if (rProp.Name == "Coordinates")
729 aCoordinates = rProp.Value.get< uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
730 }
731
732 // 5 coordinate pairs, 1 MoveTo, 4 LineTo
733 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates.getLength());
734 xDocShRef->DoClose();
735 }
736
737 namespace {
738
matchNumberFormat(int nPage,uno::Reference<text::XTextField> const & xField)739 void matchNumberFormat( int nPage, uno::Reference< text::XTextField > const & xField)
740 {
741 uno::Reference< beans::XPropertySet > xPropSet( xField, uno::UNO_QUERY_THROW );
742 sal_Int32 nNumFmt;
743 xPropSet->getPropertyValue("NumberFormat") >>= nNumFmt;
744 switch( nPage )
745 {
746 case 0: // 13/02/96
747 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(2), nNumFmt);
748 break;
749 case 1: // 13/02/1996
750 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(5), nNumFmt);
751 break;
752 case 2: // 13 February 1996
753 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(3), nNumFmt);
754 break;
755 case 3: // 13:49:38
756 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(2), nNumFmt);
757 break;
758 case 4: // 13:49
759 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(3), nNumFmt);
760 break;
761 case 5: // 01:49 PM
762 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(6), nNumFmt);
763 break;
764 case 6: // 01:49:38 PM
765 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(7), nNumFmt);
766 }
767 }
768
769 }
770
testDatetimeFieldNumberFormat()771 void SdOOXMLExportTest2::testDatetimeFieldNumberFormat()
772 {
773 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP);
774
775 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
776
777 for(sal_uInt16 i = 0; i <= 6; ++i)
778 {
779 matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
780 }
781
782 xDocShRef->DoClose();
783 }
784
testDatetimeFieldNumberFormatPPTX()785 void SdOOXMLExportTest2::testDatetimeFieldNumberFormatPPTX()
786 {
787 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX);
788
789 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
790
791 for(sal_uInt16 i = 0; i <= 6; ++i)
792 {
793 matchNumberFormat( i, getTextFieldFromPage(0, 0, 0, i, xDocShRef) );
794 }
795
796 xDocShRef->DoClose();
797 }
798
testSlideNumberField()799 void SdOOXMLExportTest2::testSlideNumberField()
800 {
801 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP);
802
803 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
804
805 uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
806 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
807
808 xDocShRef->DoClose();
809 }
810
testSlideNumberFieldPPTX()811 void SdOOXMLExportTest2::testSlideNumberFieldPPTX()
812 {
813 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX);
814
815 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
816
817 uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
818 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
819
820 xDocShRef->DoClose();
821 }
822
testSlideCountField()823 void SdOOXMLExportTest2::testSlideCountField()
824 {
825 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP);
826
827 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
828
829 uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
830 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
831
832 xDocShRef->DoClose();
833 }
834
testSlideNameField()835 void SdOOXMLExportTest2::testSlideNameField()
836 {
837 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP);
838
839 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
840
841 uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
842 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
843
844 xDocShRef->DoClose();
845 }
846
testExtFileField()847 void SdOOXMLExportTest2::testExtFileField()
848 {
849 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP);
850
851 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
852
853 for(sal_uInt16 i = 0; i <= 3; ++i)
854 {
855 uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, i, 0, xDocShRef);
856 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
857
858 uno::Reference< beans::XPropertySet > xPropSet( xField, uno::UNO_QUERY_THROW );
859 sal_Int32 nNumFmt;
860 xPropSet->getPropertyValue("FileFormat") >>= nNumFmt;
861 switch( i )
862 {
863 case 0: // Path/File name
864 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(0), nNumFmt);
865 break;
866 case 1: // Path
867 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(1), nNumFmt);
868 break;
869 case 2: // File name without extension
870 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(2), nNumFmt);
871 break;
872 case 3: // File name with extension
873 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(3), nNumFmt);
874 }
875 }
876
877 xDocShRef->DoClose();
878 }
879
testAuthorField()880 void SdOOXMLExportTest2::testAuthorField()
881 {
882 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP);
883
884 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
885
886 uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef);
887 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
888
889 xDocShRef->DoClose();
890 }
891
testTdf99224()892 void SdOOXMLExportTest2::testTdf99224()
893 {
894 sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP);
895 xShell = saveAndReload(xShell.get(), PPTX);
896 uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
897 // This was 0: the image with text was lost on export.
898 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xPage->getCount());
899 xShell->DoClose();
900 }
901
testTdf92076()902 void SdOOXMLExportTest2::testTdf92076()
903 {
904 sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf92076.odp"), ODP);
905 xShell = saveAndReload(xShell.get(), PPTX);
906 uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
907 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xPage->getCount());
908 xShell->DoClose();
909 }
910
testTdf59046()911 void SdOOXMLExportTest2::testTdf59046()
912 {
913 sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf59046.odp"), ODP);
914 utl::TempFile tempFile;
915 xShell = saveAndReload(xShell.get(), PPTX, &tempFile);
916 xShell->DoClose();
917 xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml");
918 assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
919 }
920
testTdf105739()921 void SdOOXMLExportTest2::testTdf105739()
922 {
923 // Gradient was lost during saving to ODP
924 sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf105739.pptx"), PPTX);
925 utl::TempFile tempFile;
926 xShell = saveAndReload(xShell.get(), ODP, &tempFile);
927 uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell);
928 uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY);
929 uno::Any aAny = xPropSet->getPropertyValue("Background");
930 CPPUNIT_ASSERT(aAny.hasValue());
931 if (aAny.hasValue())
932 {
933 uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
934 aAny >>= aXBackgroundPropSet;
935
936 // Test fill type
937 drawing::FillStyle aFillStyle(drawing::FillStyle_NONE);
938 aXBackgroundPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
939 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_GRADIENT), static_cast<int>(aFillStyle));
940
941 // Test gradient properties
942 com::sun::star::awt::Gradient aFillGradient;
943 aXBackgroundPropSet->getPropertyValue("FillGradient") >>= aFillGradient;
944 CPPUNIT_ASSERT_EQUAL(int(awt::GradientStyle_LINEAR), static_cast<int>(aFillGradient.Style));
945 CPPUNIT_ASSERT_EQUAL(util::Color(0xff0000), aFillGradient.StartColor);
946 CPPUNIT_ASSERT_EQUAL(util::Color(0x00b050), aFillGradient.EndColor);
947 }
948
949 xShell->DoClose();
950 }
951
testPageBitmapWithTransparency()952 void SdOOXMLExportTest2::testPageBitmapWithTransparency()
953 {
954 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx"), PPTX );
955
956 xDocShRef = saveAndReload( xDocShRef.get(), ODP );
957 uno::Reference< drawing::XDrawPagesSupplier > xDoc(
958 xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
959 CPPUNIT_ASSERT_EQUAL_MESSAGE( "There should be exactly one page", static_cast<sal_Int32>(1), xDoc->getDrawPages()->getCount() );
960
961 uno::Reference< drawing::XDrawPage > xPage( getPage( 0, xDocShRef ) );
962
963 uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY );
964 uno::Any aAny = xPropSet->getPropertyValue( "Background" );
965 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny.hasValue());
966
967 uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
968 aAny >>= aXBackgroundPropSet;
969 sal_Int32 nTransparence;
970 aAny = aXBackgroundPropSet->getPropertyValue( "FillTransparence" );
971 aAny >>= nTransparence;
972 CPPUNIT_ASSERT_EQUAL_MESSAGE("Slide background transparency is wrong", sal_Int32(49), nTransparence);
973
974 xDocShRef->DoClose();
975 }
976
testPptmContentType()977 void SdOOXMLExportTest2::testPptmContentType()
978 {
979 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptm/macro.pptm"), PPTM);
980 utl::TempFile tempFile;
981 xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile);
982
983 // Assert that the content type is the one of PPTM
984 xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml");
985 assertXPath(pXmlContentType,
986 "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
987 "ContentType",
988 "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");
989
990 xDocShRef->DoClose();
991 }
992
testTdf111798()993 void SdOOXMLExportTest2::testTdf111798()
994 {
995 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf111798.odp"), ODP);
996 utl::TempFile tempFile;
997 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
998 xDocShRef->DoClose();
999 xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
1000
1001 const OUString data[][29] =
1002 {
1003 {
1004 "2700000", "2458080", "2414880", "1439640", "1440000",
1005 "moveTo", "0", "3000",
1006 "lnTo[1]", "3000", "3000",
1007 "lnTo[2]", "3000", "4000",
1008 "lnTo[3]", "4000", "2000",
1009 "lnTo[4]", "3000", "0",
1010 "lnTo[5]", "3000", "1000",
1011 "lnTo[6]", "0", "1000",
1012 "lnTo[7]", "0", "3000"
1013 },
1014 {
1015 "2700000", "6778080", "2414880", "1439640", "1440000",
1016 "moveTo", "3000", "0",
1017 "lnTo[1]", "3000", "3000",
1018 "lnTo[2]", "4000", "3000",
1019 "lnTo[3]", "2000", "4000",
1020 "lnTo[4]", "0", "3000",
1021 "lnTo[5]", "1000", "3000",
1022 "lnTo[6]", "1000", "0",
1023 "lnTo[7]", "3000", "0"
1024 }
1025 };
1026
1027 for (size_t nShapeIndex = 0; nShapeIndex < SAL_N_ELEMENTS(data); nShapeIndex++)
1028 {
1029 size_t nDataIndex = 0;
1030
1031 const OString sSpPr = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex + 1) + "]/p:spPr";
1032 const OString sXfrm = sSpPr + "/a:xfrm";
1033 assertXPath(pXmlDoc, sXfrm, "rot", data[nShapeIndex][nDataIndex++]);
1034 const OString sOff = sXfrm + "/a:off";
1035 assertXPath(pXmlDoc, sOff, "x", data[nShapeIndex][nDataIndex++]);
1036 assertXPath(pXmlDoc, sOff, "y", data[nShapeIndex][nDataIndex++]);
1037 const OString sExt = sXfrm + "/a:ext";
1038 assertXPath(pXmlDoc, sExt, "cx", data[nShapeIndex][nDataIndex++]);
1039 assertXPath(pXmlDoc, sExt, "cy", data[nShapeIndex][nDataIndex++]);
1040
1041 while (nDataIndex < SAL_N_ELEMENTS(data[nShapeIndex]))
1042 {
1043 const OString sPt = sSpPr + "/a:custGeom/a:pathLst/a:path/a:" + data[nShapeIndex][nDataIndex++].toUtf8() + "/a:pt";
1044 assertXPath(pXmlDoc, sPt, "x", data[nShapeIndex][nDataIndex++]);
1045 assertXPath(pXmlDoc, sPt, "y", data[nShapeIndex][nDataIndex++]);
1046 }
1047 }
1048 }
1049
testPptmVBAStream()1050 void SdOOXMLExportTest2::testPptmVBAStream()
1051 {
1052 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptm/macro.pptm"), PPTM);
1053 utl::TempFile tempFile;
1054 xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile);
1055
1056 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL());
1057 // This failed: VBA stream was not roundtripped
1058 CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/vbaProject.bin"));
1059
1060 xDocShRef->DoClose();
1061 }
1062
testTdf111863()1063 void SdOOXMLExportTest2::testTdf111863()
1064 {
1065 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf111863.pptx"), PPTX);
1066 utl::TempFile tempFile;
1067 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1068 xDocShRef->DoClose();
1069
1070 // check that transition attribute didn't change from 'out' to 'in'
1071 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1072 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect",
1073 "transition", "out");
1074 }
1075
testTdf111518()1076 void SdOOXMLExportTest2::testTdf111518()
1077 {
1078 sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf111518.pptx"), PPTX);
1079 utl::TempFile tempFile;
1080 tempFile.EnableKillingFile(false);
1081 xShell = saveAndReload(xShell.get(), PPTX, &tempFile);
1082 xShell->DoClose();
1083
1084 xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml");
1085 OUString sExpect = "M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E";
1086 OUString sActual = getXPath(pXmlDocRels,
1087 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animMotion",
1088 "path");
1089 CPPUNIT_ASSERT_MOTIONPATH(sExpect, sActual);
1090 }
1091
testTdf100387()1092 void SdOOXMLExportTest2::testTdf100387()
1093 {
1094
1095 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf100387.odp"), ODP);
1096 utl::TempFile tempFile;
1097 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1098 xDocShRef->DoClose();
1099 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1100
1101 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn", "dur", "indefinite");
1102 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]/p:cTn", "fill", "hold");
1103 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]/p:cTn/p:childTnLst/p:par/p:cTn", "fill", "hold");
1104
1105 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1106 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "st", "0");
1107 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1108 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "0");
1109
1110 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1111 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "st", "1");
1112 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1113 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "1");
1114
1115 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1116 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "st", "2");
1117 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1118 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "2");
1119 }
1120
1121 // tdf#126746 Add support for Line Caps import and export
testClosingShapesAndLineCaps()1122 void SdOOXMLExportTest2::testClosingShapesAndLineCaps()
1123 {
1124 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/closed-shapes.odp"), ODP);
1125 utl::TempFile tempFile;
1126 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1127 xDocShRef->DoClose();
1128 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1129 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt", 1);
1130 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", 1);
1131 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[2]/a:pt", 1);
1132 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 1);
1133 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln", "cap", "rnd");
1134 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln/a:miter", 1);
1135
1136 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1137 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln", "cap", "rnd");
1138 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln/a:miter", 1);
1139
1140 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1141 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln", "cap", "rnd");
1142 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln/a:miter", 1);
1143
1144 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1145 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln", "cap", "sq");
1146 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln/a:round", 1);
1147
1148 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1149 assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln", "cap"); // by default it is "flat" cap style
1150 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln/a:bevel", 1);
1151
1152 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1153 assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln", "cap"); // by default it is "flat" cap style
1154 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:ln/a:round", 1);
1155 }
1156
testRotateFlip()1157 void SdOOXMLExportTest2::testRotateFlip()
1158 {
1159 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/rotate_flip.odp"), ODP);
1160 utl::TempFile tempFile;
1161 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1162 xDocShRef->DoClose();
1163 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1164
1165 const OUString data[][4] =
1166 {// flipH flipV x y
1167 { "0", "1", "1170000", "1035720" },
1168 { "1", "1", "7108560", "1036440" },
1169 { "1", "0", "4140000", "1036440" }
1170 };
1171
1172 const OUString points[][2] = { {"221", "293"}, {"506", "12" }, {"367", "0" }, {"29", "406"}, {"431", "347"}, {"145", "645"},
1173 {"99", "520"}, {"0", "861"}, {"326", "765"}, {"209", "711"}, {"640", "233"}, {"640", "233"} };
1174
1175 for (size_t nShapeIndex = 0; nShapeIndex < SAL_N_ELEMENTS(data); nShapeIndex++)
1176 {
1177 size_t nDataIndex = 0;
1178
1179 const OString sSpPr = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex + 1) + "]/p:spPr";
1180 const OString sXfrm = sSpPr + "/a:xfrm";
1181 if(data[nShapeIndex][nDataIndex++] == "1")
1182 assertXPath(pXmlDocContent, sXfrm, "flipH", "1");
1183 if(data[nShapeIndex][nDataIndex++] == "1")
1184 assertXPath(pXmlDocContent, sXfrm, "flipV", "1");
1185 assertXPath(pXmlDocContent, sXfrm, "rot", "20400000");
1186 const OString sOff = sXfrm + "/a:off";
1187 assertXPath(pXmlDocContent, sOff, "x", data[nShapeIndex][nDataIndex++]);
1188 assertXPath(pXmlDocContent, sOff, "y", data[nShapeIndex][nDataIndex++]);
1189 const OString sExt = sXfrm + "/a:ext";
1190 assertXPath(pXmlDocContent, sExt, "cx", "1800000");
1191 assertXPath(pXmlDocContent, sExt, "cy", "3600000");
1192
1193 for (size_t nPointIndex = 0; nPointIndex < SAL_N_ELEMENTS(points); nPointIndex++)
1194 {
1195 const OString sPt = sSpPr + "/a:custGeom/a:pathLst/a:path/a:lnTo[" + OString::number(nPointIndex + 1) + "]/a:pt";
1196 assertXPath(pXmlDocContent, sPt, "x", points[nPointIndex][0]);
1197 assertXPath(pXmlDocContent, sPt, "y", points[nPointIndex][1]);
1198 }
1199 assertXPath(pXmlDocContent, sSpPr + "/a:custGeom/a:pathLst/a:path/a:close", 1);
1200 }
1201 }
1202
testTdf106867()1203 void SdOOXMLExportTest2::testTdf106867()
1204 {
1205 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf106867.pptx"), PPTX);
1206 utl::TempFile tempFile;
1207 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1208
1209 const SdrPage *pPage = GetPage(1, xDocShRef.get());
1210
1211 // first check that we have the media object
1212 const SdrMediaObj* pMediaObj = dynamic_cast<SdrMediaObj*>(pPage->GetObj(2));
1213 CPPUNIT_ASSERT_MESSAGE("no media object", pMediaObj != nullptr);
1214 CPPUNIT_ASSERT_EQUAL(OUString("vnd.sun.star.Package:ppt/media/media1.avi"), pMediaObj->getURL());
1215
1216 xDocShRef->DoClose();
1217
1218 // additional checks of the output file
1219 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL());
1220 // check that the document contains the video stream
1221 CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/media/media1.avi"));
1222
1223 // both the ooxml and the extended markup
1224 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1225 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile");
1226 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media");
1227
1228 // target the shape with the video in the command
1229 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/p:cBhvr/p:tgtEl/p:spTgt",
1230 "spid", "42");
1231 }
1232
testTdf112280()1233 void SdOOXMLExportTest2::testTdf112280()
1234 {
1235 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112280.pptx"), PPTX);
1236 utl::TempFile tempFile;
1237 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1238 xDocShRef->DoClose();
1239
1240 // check the animRot value
1241 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1242 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animRot",
1243 "by", "21600000");
1244 }
1245
testTdf112088()1246 void SdOOXMLExportTest2::testTdf112088()
1247 {
1248 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112088.pptx"), PPTX);
1249 utl::TempFile tempFile;
1250 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1251 xDocShRef->DoClose();
1252
1253 // check gradient stops
1254 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1255 assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst", 2);
1256 }
1257
testTdf112333()1258 void SdOOXMLExportTest2::testTdf112333()
1259 {
1260 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112333.pptx"), PPTX);
1261 utl::TempFile tempFile;
1262 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1263 xDocShRef->DoClose();
1264
1265 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1266
1267 OUString sTo = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set[1]/p:to/p:strVal", "val");
1268 CPPUNIT_ASSERT_EQUAL(OUString("solid"), sTo);
1269
1270 OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set[1]/p:cBhvr/p:attrNameLst/p:attrName");
1271 CPPUNIT_ASSERT_EQUAL(OUString("fill.type"), sAttributeName);
1272
1273 sTo = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set[2]/p:to/p:strVal", "val");
1274 CPPUNIT_ASSERT_EQUAL(OUString("true"), sTo);
1275
1276 sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set[2]/p:cBhvr/p:attrNameLst/p:attrName");
1277 CPPUNIT_ASSERT_EQUAL(OUString("fill.on"), sAttributeName);
1278
1279 sTo = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animClr/p:to/a:srgbClr", "val");
1280 CPPUNIT_ASSERT_EQUAL(OUString("0563c1"), sTo);
1281
1282 sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animClr/p:cBhvr/p:attrNameLst/p:attrName");
1283 CPPUNIT_ASSERT_EQUAL(OUString("fillcolor"), sAttributeName);
1284 }
1285
testTdf112552()1286 void SdOOXMLExportTest2::testTdf112552()
1287 {
1288 // Background fill was not displayed, but it was because of the wrong geometry
1289 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf112552.odp"), ODP);
1290 utl::TempFile tempFile;
1291 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1292
1293 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1294 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "w", "21600");
1295 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "h", "21600");
1296 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", "x", "21600");
1297 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", "y", "0");
1298 xDocShRef->DoClose();
1299 }
1300
testTdf112557()1301 void SdOOXMLExportTest2::testTdf112557()
1302 {
1303 // Subtitle shape should be skipped by export.
1304 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf112557.odp"), ODP);
1305 utl::TempFile tempFile;
1306 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1307
1308 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml");
1309 assertXPath(pXmlDocContent, "/p:sldMaster/p:cSld/p:spTree/p:sp", 2); // title and object
1310 xDocShRef->DoClose();
1311 }
1312
testTdf112334()1313 void SdOOXMLExportTest2::testTdf112334()
1314 {
1315 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112334.pptx"), PPTX);
1316 utl::TempFile tempFile;
1317 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1318 xDocShRef->DoClose();
1319
1320 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1321
1322 OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animClr[1]/p:cBhvr/p:attrNameLst/p:attrName");
1323 CPPUNIT_ASSERT_EQUAL(OUString("style.color"), sAttributeName);
1324 }
1325
testTdf112089()1326 void SdOOXMLExportTest2::testTdf112089()
1327 {
1328 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112089.pptx"), PPTX);
1329 utl::TempFile tempFile;
1330 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1331 xDocShRef->DoClose();
1332
1333 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1334
1335 OUString sID = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
1336 OUString sTarget = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt", "spid");
1337 CPPUNIT_ASSERT_EQUAL(sID, sTarget);
1338 }
1339
testTdf112086()1340 void SdOOXMLExportTest2::testTdf112086()
1341 {
1342 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112086.pptx"), PPTX);
1343 utl::TempFile tempFile;
1344 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1345 xDocShRef->DoClose();
1346
1347 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1348
1349 OUString sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal", "val");
1350 CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal);
1351
1352 OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[1]/p:cBhvr/p:attrNameLst/p:attrName");
1353 CPPUNIT_ASSERT_EQUAL(OUString("ppt_w"), sAttributeName);
1354
1355 sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal", "val");
1356 CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal);
1357
1358 sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
1359 CPPUNIT_ASSERT_EQUAL(OUString("ppt_h"), sAttributeName);
1360 xDocShRef->DoClose();
1361 }
1362
testTdf112647()1363 void SdOOXMLExportTest2::testTdf112647()
1364 {
1365 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf112647.odp"), ODP);
1366 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
1367 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
1368 uno::Reference<text::XTextRange> xParagraph( getParagraphFromShape( 0, xShape ) );
1369 uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
1370
1371 css::style::LineSpacing aLineSpacing;
1372 xPropSet->getPropertyValue("ParaLineSpacing") >>= aLineSpacing;
1373 CPPUNIT_ASSERT_EQUAL(sal_Int16(css::style::LineSpacingMode::FIX), aLineSpacing.Mode);
1374 CPPUNIT_ASSERT_EQUAL(sal_Int16(2117), aLineSpacing.Height);
1375 xDocShRef->DoClose();
1376 }
1377
testGroupRotation()1378 void SdOOXMLExportTest2::testGroupRotation()
1379 {
1380 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/group_rotation.odp"), ODP);
1381 utl::TempFile tempFile;
1382 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1383 xDocShRef->DoClose();
1384
1385 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1386 assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm", "rot");
1387 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot", "20400000");
1388 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot", "20400000");
1389 }
1390
testTdf104788()1391 void SdOOXMLExportTest2::testTdf104788()
1392 {
1393 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104788.pptx"), PPTX);
1394 utl::TempFile tempFile;
1395 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1396 xDocShRef->DoClose();
1397
1398 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide6.xml");
1399
1400 OUString sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]", "to");
1401 CPPUNIT_ASSERT_EQUAL(-1.0, sVal.toDouble());
1402
1403 OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
1404 CPPUNIT_ASSERT_EQUAL(OUString("xshear"), sAttributeName);
1405 xDocShRef->DoClose();
1406 }
1407
testSmartartRotation2()1408 void SdOOXMLExportTest2::testSmartartRotation2()
1409 {
1410 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-rotation2.pptx"), PPTX);
1411
1412 // clear SmartArt data to check how group shapes with double-rotated children are exported, not smartart
1413 uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
1414 uno::Sequence<beans::PropertyValue> aInteropGrabBag;
1415 xShape->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag));
1416
1417 utl::TempFile tempFile;
1418 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1419 xDocShRef->DoClose();
1420
1421 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1422 assertXPathContent(pXmlDocContent,
1423 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", "Text");
1424 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot", "10800000");
1425 double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "x").toDouble();
1426 double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "y").toDouble();
1427 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2276280.0, dX, dX * .001);
1428 CPPUNIT_ASSERT_DOUBLES_EQUAL( 3158280.0, dY, dY * .001);
1429 }
1430
testTdf91999_rotateShape()1431 void SdOOXMLExportTest2::testTdf91999_rotateShape()
1432 {
1433 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx"), PPTX);
1434 utl::TempFile tempFile;
1435 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1436 xDocShRef->DoClose();
1437
1438 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1439 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name", "CustomShape 2");
1440 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", "10800000");
1441 double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "x").toDouble();
1442 double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "y").toDouble();
1443 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2960640.0, dX, dX * .001);
1444 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1449000.0, dY, dY * .001);
1445 }
1446
testTdf114845_rotateShape()1447 void SdOOXMLExportTest2::testTdf114845_rotateShape()
1448 {
1449 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx"), PPTX);
1450 utl::TempFile tempFile;
1451 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1452 xDocShRef->DoClose();
1453
1454 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1455 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr", "name", "CustomShape 5");
1456 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm", "flipV", "1");
1457 double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "x").toDouble();
1458 double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "y").toDouble();
1459 CPPUNIT_ASSERT_DOUBLES_EQUAL( 4059000.0, dX, dX * .001);
1460 CPPUNIT_ASSERT_DOUBLES_EQUAL( 3287520.0, dY, dY * .001);
1461 }
1462
testGroupsPosition()1463 void SdOOXMLExportTest2::testGroupsPosition()
1464 {
1465 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group.pptx"), PPTX);
1466 utl::TempFile tempFile;
1467 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1468 xDocShRef->DoClose();
1469
1470 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1471 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "5004000");
1472 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "3310560");
1473 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "7760160");
1474 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "3310560");
1475 }
1476
testGroupsRotatedPosition()1477 void SdOOXMLExportTest2::testGroupsRotatedPosition()
1478 {
1479 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group-rot.pptx"), PPTX);
1480 utl::TempFile tempFile;
1481 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1482 xDocShRef->DoClose();
1483
1484 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1485 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "2857320");
1486 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "4026960");
1487 }
1488
testAccentColor()1489 void SdOOXMLExportTest2::testAccentColor()
1490 {
1491 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/accent-color.pptx"), PPTX);
1492 utl::TempFile tempFile;
1493 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1494 xDocShRef->DoClose();
1495
1496 xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
1497 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val", "accent6");
1498 xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
1499 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val", "accent6");
1500 xmlDocPtr pXmlDocTheme1 = parseExport(tempFile, "ppt/theme/theme1.xml");
1501 assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "70ad47");
1502 xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml");
1503 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "deb340");
1504 }
1505
testThemeColors()1506 void SdOOXMLExportTest2::testThemeColors()
1507 {
1508 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf84205.pptx"), PPTX);
1509 utl::TempFile tempFile;
1510 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1511 xDocShRef->DoClose();
1512
1513 xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml");
1514 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "44546a");
1515 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val", "a5a5a5");
1516 }
1517
testTdf114848()1518 void SdOOXMLExportTest2::testTdf114848()
1519 {
1520 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114848.pptx"), PPTX);
1521 utl::TempFile tempFile;
1522 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1523 xDocShRef->DoClose();
1524
1525 xmlDocPtr pXmlDocTheme1 = parseExport(tempFile, "ppt/theme/theme1.xml");
1526 assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d");
1527 xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml");
1528 assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d");
1529 }
1530
testTdf68759()1531 void SdOOXMLExportTest2::testTdf68759()
1532 {
1533 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf68759.odp"), ODP);
1534 utl::TempFile tempFile;
1535 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1536 xDocShRef->DoClose();
1537
1538 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1539 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "x", "1687320");
1540 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "y", "1615320");
1541 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "flipH", "1");
1542 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "rot", "9600000");
1543 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "x", "3847320");
1544 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "y", "1614600");
1545 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm", "flipH", "1");
1546 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "x", "5934960");
1547 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "y", "1615320");
1548
1549 }
1550
testTdf127901()1551 void SdOOXMLExportTest2::testTdf127901()
1552 {
1553 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf127901.odp"), ODP);
1554 utl::TempFile tempFile;
1555 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1556 xDocShRef->DoClose();
1557
1558 xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
1559 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright", "70000");
1560 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast", "-70000");
1561
1562 xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
1563 assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1);
1564
1565 xmlDocPtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml");
1566 assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel", "thresh", "50000");
1567
1568 }
1569
testTdf90626()1570 void SdOOXMLExportTest2::testTdf90626()
1571 {
1572 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf90626.odp"), ODP);
1573 utl::TempFile tempFile;
1574 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1575 xDocShRef->DoClose();
1576
1577 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1578 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:buSzPct", "val", "100000");
1579 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buSzPct", "val", "150568");
1580 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:buSzPct", "val", "100000");
1581 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[4]/a:pPr/a:buSzPct", "val", "150568");
1582 }
1583
testTdf107608()1584 void SdOOXMLExportTest2::testTdf107608()
1585 {
1586 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf107608.pptx"), PPTX);
1587 utl::TempFile tempFile;
1588 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1589
1590 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
1591 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW );
1592
1593 drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
1594 xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
1595 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH, aFillStyle);
1596
1597 bool bBackgroundFill = false;
1598 xPropSet->getPropertyValue("FillBackground") >>= bBackgroundFill;
1599 CPPUNIT_ASSERT(bBackgroundFill);
1600
1601 sal_Int32 nBackgroundColor;
1602 xPropSet->getPropertyValue("FillColor") >>= nBackgroundColor;
1603 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x92D050), nBackgroundColor);
1604
1605 xDocShRef->DoClose();
1606 }
1607
testTdf111786()1608 void SdOOXMLExportTest2::testTdf111786()
1609 {
1610 // Export line transparency with the color
1611 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf111786.pptx"), PPTX);
1612 utl::TempFile tempFile;
1613 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1614
1615 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
1616 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW );
1617
1618 sal_uInt32 nLineColor;
1619 xPropSet->getPropertyValue("LineColor") >>= nLineColor;
1620 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0x3465A4), nLineColor);
1621
1622 sal_Int16 nTransparency;
1623 xPropSet->getPropertyValue("LineTransparence") >>= nTransparency;
1624 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(33), nTransparency);
1625
1626 xDocShRef->DoClose();
1627 }
1628
testFontScale()1629 void SdOOXMLExportTest2::testFontScale()
1630 {
1631 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/font-scale.pptx"), PPTX);
1632 utl::TempFile tempFile;
1633 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1634 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1635
1636 // Rounding errors possible, approximate value
1637 OUString sScale = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:normAutofit", "fontScale");
1638 if (sScale != "73000" && sScale != "72000" && sScale != "74000")
1639 CPPUNIT_ASSERT_EQUAL(OUString("73000"), sScale);
1640
1641 xDocShRef->DoClose();
1642 }
1643
testShapeAutofitPPTX()1644 void SdOOXMLExportTest2::testShapeAutofitPPTX()
1645 {
1646 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/testShapeAutofit.pptx"), PPTX);
1647 utl::TempFile tempFile;
1648 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1649 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1650 CPPUNIT_ASSERT(pXmlDocContent);
1651
1652 // TextAutoGrowHeight --> "Resize shape to fit text" --> true
1653 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:spAutoFit", 1);
1654 // TextAutoGrowHeight --> "Resize shape to fit text" --> false
1655 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
1656 }
1657
testLegacyShapeAutofitPPTX()1658 void SdOOXMLExportTest2::testLegacyShapeAutofitPPTX()
1659 {
1660 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp"), ODP);
1661 utl::TempFile tempFile;
1662 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1663 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1664 CPPUNIT_ASSERT(pXmlDocContent);
1665
1666 // Text in a legacy rectangle
1667 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:noAutofit", 1);
1668 // Text in (closed) Polygon
1669 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
1670 // Text in a legacy ellipse
1671 assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr/a:noAutofit", 1);
1672 }
1673
testTdf115394()1674 void SdOOXMLExportTest2::testTdf115394()
1675 {
1676 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394.pptx"), PPTX);
1677 utl::TempFile tempFile;
1678 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1679 double fTransitionDuration;
1680
1681 // Slow in MS formats
1682 SdPage* pPage1 = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard);
1683 fTransitionDuration = pPage1->getTransitionDuration();
1684 CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration);
1685
1686 // Medium in MS formats
1687 SdPage* pPage2 = xDocShRef->GetDoc()->GetSdPage(1, PageKind::Standard);
1688 fTransitionDuration = pPage2->getTransitionDuration();
1689 CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration);
1690
1691 // Fast in MS formats
1692 SdPage* pPage3 = xDocShRef->GetDoc()->GetSdPage(2, PageKind::Standard);
1693 fTransitionDuration = pPage3->getTransitionDuration();
1694 CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration);
1695
1696 // Custom values
1697 SdPage* pPage4 = xDocShRef->GetDoc()->GetSdPage(3, PageKind::Standard);
1698 fTransitionDuration = pPage4->getTransitionDuration();
1699 CPPUNIT_ASSERT_EQUAL(0.25, fTransitionDuration);
1700
1701 SdPage* pPage5 = xDocShRef->GetDoc()->GetSdPage(4, PageKind::Standard);
1702 fTransitionDuration = pPage5->getTransitionDuration();
1703 CPPUNIT_ASSERT_EQUAL(4.25, fTransitionDuration);
1704
1705 xDocShRef->DoClose();
1706 }
1707
testTdf115394Zero()1708 void SdOOXMLExportTest2::testTdf115394Zero()
1709 {
1710 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394-zero.pptx"), PPTX);
1711 utl::TempFile tempFile;
1712 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1713 double fTransitionDuration;
1714
1715 SdPage* pPage = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard);
1716 fTransitionDuration = pPage->getTransitionDuration();
1717 CPPUNIT_ASSERT_EQUAL(0.01, fTransitionDuration);
1718
1719 xDocShRef->DoClose();
1720 }
1721
testTdf115005()1722 void SdOOXMLExportTest2::testTdf115005()
1723 {
1724 sd::DrawDocShellRef xDocShRefOriginal = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf115005.odp"), ODP);
1725 utl::TempFile tempFile;
1726 sd::DrawDocShellRef xDocShRefResaved = saveAndReload(xDocShRefOriginal.get(), ODP, &tempFile);
1727
1728 // additional checks of the output file
1729 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL());
1730
1731 // check that the document contains original vector images
1732 const uno::Sequence<OUString> names = xNameAccess->getElementNames();
1733 int nSVMFiles = 0;
1734 for (int i=0; i<names.getLength(); i++)
1735 {
1736 if(names[i].endsWith(".svm"))
1737 nSVMFiles++;
1738 }
1739 CPPUNIT_ASSERT_EQUAL(3, nSVMFiles);
1740 }
1741
testTdf115005_FallBack_Images(bool bAddReplacementImages)1742 int SdOOXMLExportTest2::testTdf115005_FallBack_Images(bool bAddReplacementImages)
1743 {
1744 sd::DrawDocShellRef xDocShRefOriginal = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf115005_no_fallback_images.odp"), ODP);
1745
1746 // check if fallback images were not created if AddReplacementImages=true/false
1747 // set AddReplacementImages
1748 {
1749 std::shared_ptr<comphelper::ConfigurationChanges> batch( comphelper::ConfigurationChanges::create() );
1750 if ( !officecfg::Office::Common::Save::Graphic::AddReplacementImages::isReadOnly() )
1751 officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(bAddReplacementImages, batch);
1752 batch->commit();
1753 }
1754
1755 // save the file with already set options
1756 utl::TempFile tempFile;
1757 sd::DrawDocShellRef xDocShRefResaved = saveAndReload(xDocShRefOriginal.get(), ODP, &tempFile);
1758
1759 // additional checks of the output file
1760 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL());
1761
1762 // check that the document contains original vector images
1763 const uno::Sequence<OUString> names = xNameAccess->getElementNames();
1764 int nSVMFiles = 0;
1765 int nPNGFiles = 0;
1766 for (int i=0; i<names.getLength(); i++)
1767 {
1768 if(names[i].endsWith(".svm"))
1769 nSVMFiles++;
1770 if(names[i].endsWith(".png"))
1771 nPNGFiles++;
1772 }
1773
1774 // check results
1775 CPPUNIT_ASSERT_EQUAL(1, nSVMFiles);
1776 return nPNGFiles;
1777 }
1778
testTdf115005_FallBack_Images_On()1779 void SdOOXMLExportTest2::testTdf115005_FallBack_Images_On()
1780 {
1781 const int nPNGFiles = testTdf115005_FallBack_Images(true);
1782 CPPUNIT_ASSERT_EQUAL(1, nPNGFiles);
1783 }
1784
testTdf115005_FallBack_Images_Off()1785 void SdOOXMLExportTest2::testTdf115005_FallBack_Images_Off()
1786 {
1787 const int nPNGFiles = testTdf115005_FallBack_Images(false);
1788 CPPUNIT_ASSERT_EQUAL(0, nPNGFiles);
1789 }
1790
testTdf118806()1791 void SdOOXMLExportTest2::testTdf118806()
1792 {
1793 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118806.odp"), ODP);
1794 utl::TempFile tempFile;
1795 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1796
1797 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1798 assertXPath(pXmlDocContent, "//p:animMotion", "origin", "layout");
1799
1800 xDocShRef->DoClose();
1801 }
1802
testTdf111789()1803 void SdOOXMLExportTest2::testTdf111789()
1804 {
1805 // Shadow properties were not exported for text shapes.
1806 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf111789.pptx"), PPTX);
1807 utl::TempFile tempFile;
1808 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1809
1810 // First text shape has some shadow
1811 {
1812 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
1813 bool bHasShadow = false;
1814 xShape->getPropertyValue("Shadow") >>= bHasShadow;
1815 CPPUNIT_ASSERT(bHasShadow);
1816 double fShadowDist = 0.0;
1817 xShape->getPropertyValue("ShadowXDistance") >>= fShadowDist;
1818 CPPUNIT_ASSERT_EQUAL(static_cast<double>(273), fShadowDist);
1819 xShape->getPropertyValue("ShadowYDistance") >>= fShadowDist;
1820 CPPUNIT_ASSERT_EQUAL(static_cast<double>(273), fShadowDist);
1821 sal_Int32 nColor = 0;
1822 xShape->getPropertyValue("ShadowColor") >>= nColor;
1823 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xFF0000), nColor);
1824 sal_Int32 nTransparency = 0;
1825 xShape->getPropertyValue("ShadowTransparence") >>= nTransparency;
1826 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(7), nTransparency);
1827 }
1828
1829 // Second text shape has no shadow
1830 {
1831 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 1, 0, xDocShRef ) );
1832 bool bHasShadow = false;
1833 xShape->getPropertyValue("Shadow") >>= bHasShadow;
1834 CPPUNIT_ASSERT(!bHasShadow);
1835 }
1836
1837 xDocShRef->DoClose();
1838 }
1839
testTdf104792()1840 void SdOOXMLExportTest2::testTdf104792()
1841 {
1842 ::sd::DrawDocShellRef xDocShRef = loadURL(
1843 m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx"), PPTX);
1844 utl::TempFile tempFile;
1845 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1846
1847 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1848 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[1]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:set/p:cBhvr/p:tgtEl/p:spTgt", 1);
1849
1850 xDocShRef->DoClose();
1851 }
1852
testTdf90627()1853 void SdOOXMLExportTest2::testTdf90627()
1854 {
1855 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf90627.odp"), ODP);
1856 utl::TempFile tempFile;
1857 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1858
1859 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1860 // Don't export empty endCondLst without cond.
1861 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:endCondLst[not(*)]", 0);
1862
1863 xDocShRef->DoClose();
1864 }
1865
testTdf104786()1866 void SdOOXMLExportTest2::testTdf104786()
1867 {
1868 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104786.pptx"), PPTX);
1869 utl::TempFile tempFile;
1870 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1871
1872 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide2.xml");
1873 // Don't export empty 'to'
1874 assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst/p:set[2]/p:to", 0);
1875
1876 xDocShRef->DoClose();
1877 }
1878
testTdf118783()1879 void SdOOXMLExportTest2::testTdf118783()
1880 {
1881 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118783.odp"), ODP);
1882 utl::TempFile tempFile;
1883 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1884 xDocShRef->DoClose();
1885
1886 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1887 OUString sAttributeName = getXPathContent(pXmlDocContent, "//p:animRot/p:cBhvr/p:attrNameLst/p:attrName");
1888 CPPUNIT_ASSERT_EQUAL(OUString("r"), sAttributeName);
1889 xDocShRef->DoClose();
1890 }
1891
testTdf104789()1892 void SdOOXMLExportTest2::testTdf104789()
1893 {
1894 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104789.pptx"), PPTX);
1895 utl::TempFile tempFile;
1896 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1897
1898 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1899 OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName");
1900 CPPUNIT_ASSERT_EQUAL(OUString("style.opacity"), sAttributeName);
1901
1902 xDocShRef->DoClose();
1903 }
1904
testOpenDocumentAsReadOnly()1905 void SdOOXMLExportTest2::testOpenDocumentAsReadOnly()
1906 {
1907 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/open-as-read-only.pptx"), PPTX);
1908 CPPUNIT_ASSERT(xDocShRef->IsSecurityOptOpenReadOnly());
1909 utl::TempFile tempFile;
1910 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1911 CPPUNIT_ASSERT(xDocShRef->IsSecurityOptOpenReadOnly());
1912 xDocShRef->DoClose();
1913 }
1914
testTdf118835()1915 void SdOOXMLExportTest2::testTdf118835()
1916 {
1917 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118835.odp"), ODP);
1918 utl::TempFile tempFile;
1919 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1920
1921 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1922 assertXPath(pXmlDocContent, "(//p:animClr)[1]", "clrSpc", "rgb");
1923 assertXPathContent(pXmlDocContent, "(//p:animClr)[1]//p:attrName", "style.color");
1924 assertXPath(pXmlDocContent, "(//p:animClr)[1]//p:to/a:srgbClr", "val", "ed1c24");
1925
1926 assertXPath(pXmlDocContent, "(//p:animClr)[2]", "clrSpc", "rgb");
1927 assertXPathContent(pXmlDocContent, "(//p:animClr)[2]//p:attrName", "stroke.color");
1928 assertXPath(pXmlDocContent, "(//p:animClr)[2]//p:to/a:srgbClr", "val", "333399");
1929
1930 assertXPath(pXmlDocContent, "(//p:animClr)[3]", "clrSpc", "rgb");
1931 assertXPathContent(pXmlDocContent, "(//p:animClr)[3]//p:attrName", "fillcolor");
1932 assertXPath(pXmlDocContent, "(//p:animClr)[3]//p:to/a:srgbClr", "val", "fcd3c1");
1933
1934 assertXPath(pXmlDocContent, "(//p:animClr)[5]", "clrSpc", "hsl");
1935 assertXPathContent(pXmlDocContent, "(//p:animClr)[5]//p:attrName", "fillcolor");
1936 assertXPath(pXmlDocContent, "(//p:animClr)[5]//p:by/p:hsl", "h", "10800000");
1937 assertXPath(pXmlDocContent, "(//p:animClr)[5]//p:by/p:hsl", "s", "0");
1938 assertXPath(pXmlDocContent, "(//p:animClr)[5]//p:by/p:hsl", "l", "0");
1939
1940 xDocShRef->DoClose();
1941 }
1942
testTdf118768()1943 void SdOOXMLExportTest2::testTdf118768()
1944 {
1945 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118768-brake.odp"), ODP);
1946 utl::TempFile tempFile;
1947 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1948
1949 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1950 assertXPath(pXmlDocContent, "//p:anim[1]", "from", "(-#ppt_w/2)");
1951 assertXPath(pXmlDocContent, "//p:anim[1]", "to", "(#ppt_x)");
1952 assertXPath(pXmlDocContent, "//p:anim[2]", "from", "0");
1953
1954 assertXPath(pXmlDocContent, "//p:anim[2]", "to", "-1");
1955 assertXPath(pXmlDocContent, "//p:anim[2]/p:cBhvr/p:cTn", "autoRev", "1");
1956
1957 assertXPath(pXmlDocContent, "//p:anim[3]", "by", "(#ppt_h/3+#ppt_w*0.1)");
1958 assertXPath(pXmlDocContent, "//p:anim[3]/p:cBhvr/p:cTn", "autoRev", "1");
1959 xDocShRef->DoClose();
1960 }
1961
testTdf118836()1962 void SdOOXMLExportTest2::testTdf118836()
1963 {
1964 sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118836.odp"), ODP);
1965 utl::TempFile tempFile;
1966 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
1967
1968 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
1969 assertXPath(pXmlDocContent, "//p:animScale/p:by", "x", "250000");
1970 assertXPath(pXmlDocContent, "//p:animScale/p:by", "y", "250000");
1971 xDocShRef->DoClose();
1972 }
1973
getAdjustmentValue(const uno::Reference<beans::XPropertySet> & xSet)1974 static double getAdjustmentValue( const uno::Reference<beans::XPropertySet>& xSet )
1975 {
1976 auto aGeomPropSeq = xSet->getPropertyValue( "CustomShapeGeometry" )
1977 .get<uno::Sequence<beans::PropertyValue>>();
1978 auto aGeomPropVec
1979 = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(
1980 aGeomPropSeq );
1981
1982 const OUString sName = "AdjustmentValues";
1983 auto aIterator = std::find_if(
1984 aGeomPropVec.begin(), aGeomPropVec.end(),
1985 [sName]( const beans::PropertyValue& rValue ) { return rValue.Name == sName; } );
1986
1987 if (aIterator != aGeomPropVec.end())
1988 {
1989 uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustment;
1990 double fResult = 0.0;
1991 aIterator->Value >>= aAdjustment;
1992 aAdjustment[0].Value >>= fResult;
1993 return fResult;
1994 }
1995
1996 return -1.0;
1997 }
1998
getScaleXValue(const uno::Reference<beans::XPropertySet> & xSet)1999 static bool getScaleXValue(const uno::Reference<beans::XPropertySet>& xSet)
2000 {
2001 bool bScaleX = false;
2002
2003 auto aGeomPropSeq = xSet->getPropertyValue("CustomShapeGeometry")
2004 .get<uno::Sequence<beans::PropertyValue>>();
2005 auto aGeomPropVec
2006 = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(
2007 aGeomPropSeq);
2008
2009 const OUString sName = "TextPath";
2010 auto aIterator = std::find_if(
2011 aGeomPropVec.begin(), aGeomPropVec.end(),
2012 [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; });
2013
2014 if (aIterator != aGeomPropVec.end())
2015 {
2016 uno::Sequence<beans::PropertyValue> aTextPathProperties;
2017 aIterator->Value >>= aTextPathProperties;
2018 const OUString sScaleX = "ScaleX";
2019 auto aIterator2 = std::find_if(
2020 aTextPathProperties.begin(), aTextPathProperties.end(),
2021 [sScaleX](const beans::PropertyValue& rValue) { return rValue.Name == sScaleX; });
2022
2023 if (aIterator2 != aTextPathProperties.end())
2024 {
2025 aIterator2->Value >>= bScaleX;
2026 }
2027 }
2028
2029 return bScaleX;
2030 }
2031
testTdf116350TextEffects()2032 void SdOOXMLExportTest2::testTdf116350TextEffects()
2033 {
2034 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf116350-texteffects.pptx" ), PPTX );
2035
2036 // Default angle for ArchUp
2037 uno::Reference<beans::XPropertySet> xShape0( getShapeFromPage( 0, 0, xDocShRef ) );
2038 double fAdjust = getAdjustmentValue( xShape0 );
2039 CPPUNIT_ASSERT_EQUAL( 180.0, fAdjust );
2040
2041 bool bScaleX = getScaleXValue( xShape0 );
2042 CPPUNIT_ASSERT_EQUAL( true, bScaleX );
2043
2044 // Default angle for ArchDown
2045 uno::Reference<beans::XPropertySet> xShape14( getShapeFromPage( 14, 0, xDocShRef ) );
2046 fAdjust = getAdjustmentValue( xShape14 );
2047 CPPUNIT_ASSERT_EQUAL( 0.0, fAdjust );
2048
2049 bScaleX = getScaleXValue( xShape14 );
2050 CPPUNIT_ASSERT_EQUAL( true, bScaleX );
2051
2052 // Angle directly set
2053 uno::Reference<beans::XPropertySet> xShape1( getShapeFromPage( 1, 0, xDocShRef ) );
2054 fAdjust = getAdjustmentValue( xShape1 );
2055 CPPUNIT_ASSERT_EQUAL( 213.25, fAdjust );
2056
2057 bScaleX = getScaleXValue( xShape1 );
2058 CPPUNIT_ASSERT_EQUAL( true, bScaleX );
2059
2060 // Export
2061 utl::TempFile tempFile;
2062 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile );
2063
2064 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2065 assertXPath(pXmlDocContent, "//p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textArchUp");
2066 assertXPath(pXmlDocContent, "//p:sp[14]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textCircle");
2067 assertXPath(pXmlDocContent, "//p:sp[14]/p:spPr/a:solidFill/a:srgbClr", 0);
2068
2069 xDocShRef->DoClose();
2070 }
2071
testTdf128096()2072 void SdOOXMLExportTest2::testTdf128096()
2073 {
2074 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf128096.odp"), ODP);
2075 utl::TempFile tempFile;
2076 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2077 xDocShRef->DoClose();
2078
2079 xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
2080 assertXPath(pXmlDocContent1, "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val", "ffff00");
2081
2082 // Check that underlined content is also highlighted
2083 xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
2084 assertXPath(pXmlDocContent2, "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val", "ffff00");
2085 }
testTdf120573()2086 void SdOOXMLExportTest2::testTdf120573()
2087 {
2088 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf120573.pptx" ), PPTX );
2089 utl::TempFile tempFile;
2090 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile );
2091
2092 xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
2093 assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:audioFile", 1);
2094 assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile", 0);
2095
2096 xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels");
2097 assertXPath(pXmlDocRels,
2098 "(/rels:Relationships/rels:Relationship[@Target='../media/media1.wav'])[1]",
2099 "Type",
2100 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
2101
2102 xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml");
2103 assertXPath(pXmlContentType,
2104 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.wav']",
2105 "ContentType",
2106 "audio/x-wav");
2107 }
2108
testTdf118825()2109 void SdOOXMLExportTest2::testTdf118825()
2110 {
2111 const OUString sPath1 = "M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 0.0704264795523803 -0.00370117418637049 0.0831071428571428 -0.00819047619047622 C 0.0953550597998766 -0.0125265741339082 0.107821870086751 -0.010397536991717 0.120321428571429 -0.0115555555555556 C 0.133179018681433 -0.0127467438724762 0.151318627483861 -0.0158700272533852 0.1585 0.00539682539682542 C 0.16478291361998 0.0240029898688431 0.15828642886492 0.0483806254341085 0.161392857142857 0.0698412698412698 C 0.165179286017685 0.0959996731216037 0.17453898927982 0.119735912694626 0.187142857142857 0.132634920634921 C 0.199788991845377 0.145577185161529 0.215607110490848 0.142889773028431 0.230107142857143 0.142857142857143 C 0.243821417584191 0.142826280916829 0.257716514999779 0.142685979556724 0.271142857142857 0.137777777777778 C 0.286895094567923 0.132019309914514 0.302318190711873 0.122962218306185 0.317928571428571 0.11568253968254 C 0.333496771884547 0.108422531222479 0.348787823719556 0.0990570571890929 0.363714285714286 0.0885079365079364 C 0.374930683062651 0.080580865157908 0.385357142857143 0.0693333333333332 0.396178571428571 0.0596825396825396 L 0.404785714285714 0.0410158730158729 L 0.401892857142857 0.0342222222222221 E";
2112
2113 const OUString sPath2 = "M 0.025 0.0571428571428571 L 0.0821428571428571 0.184126984126984 L -0.175 0.234920634920635 L -0.246428571428571 -0.0190476190476191 L -0.0821428571428573 -0.133333333333333 E";
2114
2115 const OUString sPath3 = "M -0.0107142857142857 0.00634920634920635 C -0.110714285714286 0.501587301587301 -0.153571428571429 -0.00634920634920635 -0.246428571428572 0.184126984126984 C -0.339285714285715 0.374603174603175 -0.296428571428572 0.514285714285714 -0.267857142857143 0.603174603174603 C -0.239285714285715 0.692063492063493 0.0607142857142858 0.590476190476191 0.0607142857142858 0.590476190476191 E";
2116
2117 const OUString sPath4 = "M 0.0535714285714286 -0.0444444444444444 L 0.132142857142857 -0.0444444444444444 L 0.132142857142857 -0.146031746031746 L 0.0964285714285715 -0.146031746031746 E";
2118
2119 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118825-motionpath.odp"), ODP);
2120 utl::TempFile tempFile;
2121 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2122 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2123
2124
2125 CPPUNIT_ASSERT_MOTIONPATH(sPath1, getXPath(pXmlDocContent, "(//p:animMotion)[1]", "path"));
2126 CPPUNIT_ASSERT_MOTIONPATH(sPath2, getXPath(pXmlDocContent, "(//p:animMotion)[2]", "path"));
2127 CPPUNIT_ASSERT_MOTIONPATH(sPath3, getXPath(pXmlDocContent, "(//p:animMotion)[3]", "path"));
2128 CPPUNIT_ASSERT_MOTIONPATH(sPath4, getXPath(pXmlDocContent, "(//p:animMotion)[4]", "path"));
2129 xDocShRef->DoClose();
2130 }
2131
testTdf119118()2132 void SdOOXMLExportTest2::testTdf119118()
2133 {
2134 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf119118.pptx" ), PPTX);
2135 utl::TempFile tempFile;
2136 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2137 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2138 assertXPath(pXmlDocContent, "//p:iterate", "type", "lt");
2139 assertXPath(pXmlDocContent, "//p:tmAbs", "val", "200");
2140 xDocShRef->DoClose();
2141 }
2142
testTdf99213()2143 void SdOOXMLExportTest2::testTdf99213()
2144 {
2145 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc( "sd/qa/unit/data/odp/tdf99213-target-missing.odp" ), ODP);
2146 utl::TempFile tempFile;
2147 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2148 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2149 // Number of nodes with p:attrNameLst was 3, including one that missed tgtEl
2150 assertXPath(pXmlDocContent, "//p:attrNameLst", 2);
2151 // Timenode that miss its target element should be filtered.
2152 assertXPath(pXmlDocContent, "//p:attrNameLst/preceding-sibling::p:tgtEl", 2);
2153 xDocShRef->DoClose();
2154 }
2155
testPotxExport()2156 void SdOOXMLExportTest2::testPotxExport()
2157 {
2158 // Create new document
2159 sd::DrawDocShellRef xDocShRef
2160 = new sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED, false, DocumentType::Draw);
2161 uno::Reference<frame::XLoadable> xLoadable(xDocShRef->GetModel(), uno::UNO_QUERY);
2162 CPPUNIT_ASSERT(xLoadable.is());
2163 xLoadable->initNew();
2164
2165 // Export as a POTM template
2166 utl::TempFile tempFile;
2167 xDocShRef = saveAndReload(xDocShRef.get(), POTX, &tempFile);
2168 xDocShRef->DoClose();
2169
2170 // Load and check content type
2171 xmlDocPtr pContentTypes = parseExport(tempFile, "[Content_Types].xml");
2172 CPPUNIT_ASSERT(pContentTypes);
2173 assertXPath(pContentTypes, "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
2174 "ContentType", "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml");
2175 }
2176
testTdf44223()2177 void SdOOXMLExportTest2::testTdf44223()
2178 {
2179 utl::TempFile tempFile;
2180 ::sd::DrawDocShellRef xDocShRef
2181 = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf44223.pptx"), PPTX);
2182 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2183
2184 std::shared_ptr<SvStream> const pStream1(parseExportStream(tempFile, "ppt/media/audio1.wav"));
2185 CPPUNIT_ASSERT_EQUAL(sal_uInt64(11140), pStream1->remainingSize());
2186
2187 std::shared_ptr<SvStream> const pStream2(parseExportStream(tempFile, "ppt/media/audio2.wav"));
2188 CPPUNIT_ASSERT_EQUAL(sal_uInt64(28074), pStream2->remainingSize());
2189
2190 xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml");
2191 assertXPath(pXmlContentType,
2192 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio1.wav']",
2193 "ContentType",
2194 "audio/x-wav");
2195
2196 assertXPath(pXmlContentType,
2197 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio2.wav']",
2198 "ContentType",
2199 "audio/x-wav");
2200
2201 xmlDocPtr pDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml");
2202
2203 // Start condition: 0s after timenode id 5 begins.
2204 assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt", "begin");
2205 assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", "0");
2206 assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond/p:tn", "val", "5");
2207
2208 xmlDocPtr pDoc2 = parseExport(tempFile, "ppt/slides/slide2.xml");
2209 assertXPath(pDoc2 , "//p:transition/p:sndAc/p:stSnd/p:snd[@r:embed]", 2);
2210
2211 xmlDocPtr pRels1 = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels");
2212 assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Type",
2213 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
2214 assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Target", "../media/audio1.wav");
2215
2216 xDocShRef->DoClose();
2217 }
2218
testSmartArtPreserve()2219 void SdOOXMLExportTest2::testSmartArtPreserve()
2220 {
2221 ::sd::DrawDocShellRef xDocShRef
2222 = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-preserve.pptx"), PPTX);
2223 utl::TempFile tempFile;
2224 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2225
2226 xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
2227 assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr");
2228 assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/dgm:relIds");
2229 assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext",
2230 "uri", "{D42A27DB-BD31-4B8C-83A1-F6EECF244321}");
2231 assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext/p14:modId");
2232
2233 xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels");
2234 assertXPath(pXmlDocRels,
2235 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/layout1.xml'])[1]", "Type",
2236 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout");
2237 assertXPath(pXmlDocRels,
2238 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/data1.xml'])[1]", "Type",
2239 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData");
2240 assertXPath(pXmlDocRels,
2241 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/colors1.xml'])[1]", "Type",
2242 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors");
2243 assertXPath(pXmlDocRels,
2244 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/quickStyle1.xml'])[1]", "Type",
2245 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle");
2246
2247 xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml");
2248 assertXPath(pXmlContentType,
2249 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/layout1.xml']",
2250 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml");
2251 assertXPath(pXmlContentType,
2252 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/data1.xml']",
2253 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml");
2254 assertXPath(pXmlContentType,
2255 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/colors1.xml']",
2256 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml");
2257 assertXPath(pXmlContentType,
2258 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/quickStyle1.xml']",
2259 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml");
2260
2261 xDocShRef->DoClose();
2262 }
2263
testTdf125346()2264 void SdOOXMLExportTest2::testTdf125346()
2265 {
2266 // There are two themes in the test document, make sure we use the right theme
2267 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125346.pptx"), PPTX);
2268 utl::TempFile tempFile;
2269 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2270
2271 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
2272 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW );
2273
2274 drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
2275 xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
2276 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle);
2277
2278 sal_Int32 nFillColor;
2279 xPropSet->getPropertyValue("FillColor") >>= nFillColor;
2280 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90C226), nFillColor);
2281
2282 xDocShRef->DoClose();
2283 }
2284
testTdf125346_2()2285 void SdOOXMLExportTest2::testTdf125346_2()
2286 {
2287 // There are two themes in the test document, make sure we use the right theme
2288 // Test more slides with different themes
2289 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125346_2.pptx"), PPTX);
2290 utl::TempFile tempFile;
2291 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2292
2293 {
2294 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
2295 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW );
2296
2297 drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
2298 xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
2299 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle);
2300
2301 sal_Int32 nFillColor;
2302 xPropSet->getPropertyValue("FillColor") >>= nFillColor;
2303 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90C226), nFillColor);
2304 }
2305
2306 {
2307 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 1, xDocShRef ) );
2308 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW );
2309
2310 drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
2311 xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
2312 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle);
2313
2314 sal_Int32 nFillColor;
2315 xPropSet->getPropertyValue("FillColor") >>= nFillColor;
2316 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x052F61), nFillColor);
2317 }
2318
2319 {
2320 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 2, xDocShRef ) );
2321 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW );
2322
2323 drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
2324 xPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
2325 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle);
2326
2327 sal_Int32 nFillColor;
2328 xPropSet->getPropertyValue("FillColor") >>= nFillColor;
2329 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90C226), nFillColor);
2330 }
2331
2332 xDocShRef->DoClose();
2333 }
2334
testTdf125360()2335 void SdOOXMLExportTest2::testTdf125360()
2336 {
2337 // Check whether the changed fill transparency is exported correctly.
2338 // Color is defined by shape style
2339 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360.pptx"), PPTX);
2340
2341 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
2342
2343 xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32>(23)));
2344
2345 utl::TempFile tempFile;
2346 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2347
2348 xShape.set( getShapeFromPage( 0, 0, xDocShRef ) );
2349
2350 sal_Int32 nTransparence = 0;
2351 xShape->getPropertyValue("FillTransparence") >>= nTransparence;
2352 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(23), nTransparence);
2353
2354 xDocShRef->DoClose();
2355 }
2356
testTdf125360_1()2357 void SdOOXMLExportTest2::testTdf125360_1()
2358 {
2359 // Check whether the changed fill transparency is exported correctly.
2360 // Color is defined by color scheme
2361 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_1.pptx"), PPTX);
2362
2363 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
2364
2365 xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32>(23)));
2366
2367 utl::TempFile tempFile;
2368 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2369
2370 xShape.set( getShapeFromPage( 0, 0, xDocShRef ) );
2371
2372 sal_Int32 nTransparence = 0;
2373 xShape->getPropertyValue("FillTransparence") >>= nTransparence;
2374 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(23), nTransparence);
2375
2376 xDocShRef->DoClose();
2377 }
2378
testTdf125360_2()2379 void SdOOXMLExportTest2::testTdf125360_2()
2380 {
2381 // Check whether the changed fill transparency is exported correctly.
2382 // Color is defined by color scheme with a transparency
2383 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_2.pptx"), PPTX);
2384
2385 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
2386
2387 sal_Int32 nTransparence = 0;
2388 xShape->getPropertyValue("FillTransparence") >>= nTransparence;
2389 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(82), nTransparence);
2390
2391 xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32>(23)));
2392
2393 utl::TempFile tempFile;
2394 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2395
2396 xShape.set( getShapeFromPage( 0, 0, xDocShRef ) );
2397
2398 nTransparence = 0;
2399 xShape->getPropertyValue("FillTransparence") >>= nTransparence;
2400 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(23), nTransparence);
2401
2402 xDocShRef->DoClose();
2403 }
2404
testTdf125551()2405 void SdOOXMLExportTest2::testTdf125551()
2406 {
2407 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125551.pptx"), PPTX);
2408 utl::TempFile tempFile;
2409 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2410
2411 uno::Reference<drawing::XShapes> xGroupShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
2412 uno::Reference<drawing::XShape> xShapeBg(xGroupShape->getByIndex(0), uno::UNO_QUERY);
2413
2414 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1024), xShapeBg->getPosition().X);
2415 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(576), xShapeBg->getPosition().Y);
2416 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(10815), xShapeBg->getSize().Width);
2417 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8587), xShapeBg->getSize().Height);
2418 }
2419
testTdf100348_convert_Fontwork2TextWarp()2420 void SdOOXMLExportTest2::testTdf100348_convert_Fontwork2TextWarp()
2421 {
2422 ::sd::DrawDocShellRef xDocShRef = loadURL(
2423 m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp"), ODP);
2424 utl::TempFile tempFile;
2425 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2426
2427 // Resulting pptx has to contain the TextWarp shape
2428 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2429 const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp");
2430 assertXPath(pXmlDocContent, sPathStart + "[@prst='textWave1']");
2431 const OString sPathAdj(sPathStart + "/a:avLst/a:gd");
2432 assertXPath(pXmlDocContent, sPathAdj + "[@name='adj1' and @fmla='val 18750']");
2433 assertXPath(pXmlDocContent, sPathAdj + "[@name='adj2' and @fmla='val -7500']");
2434
2435 // Reloading has to get the Fontwork shape back
2436 // TextPath makes a custom shape to a Fontwork shape, so must exist
2437 uno::Reference<beans::XPropertySet> xShapeWavePropSet(getShapeFromPage(0, 0, xDocShRef));
2438 auto aGeomPropSeq = xShapeWavePropSet->getPropertyValue("CustomShapeGeometry")
2439 .get<uno::Sequence<beans::PropertyValue>>();
2440 auto aGeomPropVec
2441 = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq);
2442 OUString sName = "TextPath";
2443 auto aIterator = std::find_if(
2444 aGeomPropVec.begin(), aGeomPropVec.end(),
2445 [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; });
2446 CPPUNIT_ASSERT_MESSAGE("No TextPath", aIterator != aGeomPropVec.end());
2447
2448 // Type has to be same as in original document on roundtrip.
2449 sName = "Type";
2450 auto aIterator2 = std::find_if(
2451 aGeomPropVec.begin(), aGeomPropVec.end(),
2452 [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; });
2453 CPPUNIT_ASSERT_MESSAGE("No Type", aIterator2 != aGeomPropVec.end());
2454 OUString sOwnName;
2455 aIterator2->Value >>= sOwnName;
2456 CPPUNIT_ASSERT_EQUAL(OUString("fontwork-wave"), sOwnName);
2457
2458 // Adjustmentvalues need to be the same.
2459 sName = "AdjustmentValues";
2460 auto aIterator3 = std::find_if(
2461 aGeomPropVec.begin(), aGeomPropVec.end(),
2462 [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; });
2463 CPPUNIT_ASSERT_MESSAGE("No AdjustmentValues", aIterator3 != aGeomPropVec.end());
2464 uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjValueSeq;
2465 aIterator3->Value >>= aAdjValueSeq;
2466 double fAdj1;
2467 aAdjValueSeq[0].Value >>= fAdj1;
2468 double fAdj2;
2469 aAdjValueSeq[1].Value >>= fAdj2;
2470 CPPUNIT_ASSERT_EQUAL(4050.0, fAdj1); // odp values, not pptx values
2471 CPPUNIT_ASSERT_EQUAL(9180.0, fAdj2);
2472
2473 xDocShRef->DoClose();
2474 }
2475
testTdf1225573_FontWorkScaleX()2476 void SdOOXMLExportTest2::testTdf1225573_FontWorkScaleX()
2477 {
2478 const OUString sPath("/sd/qa/unit/data/pptx/tdf125573_FontWorkScaleX.pptx");
2479 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(sPath), PPTX);
2480 utl::TempFile tempFile;
2481 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2482
2483 // Error was, that attribute 'fromWordArt' was ignored
2484 // ensure, resulting pptx has fromWordArt="1" on textArchDown shape
2485 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2486 const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr");
2487 assertXPath(pXmlDocContent, sPathStart + "[@fromWordArt='1']");
2488
2489 // Error was, that text in legacy shapes of category "Follow Path" was not scaled to the path.
2490 uno::Reference<beans::XPropertySet> xShapeArchProps(getShapeFromPage(0, 0, xDocShRef));
2491 awt::Rectangle aBoundRectArch;
2492 xShapeArchProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRectArch;
2493 // difference should be zero, but allow some range for stroke thickness
2494 CPPUNIT_ASSERT_LESS(static_cast<long>(50), labs(aBoundRectArch.Width - 13081));
2495
2496 // Error was, that text in shapes of category "Warp" was not scaled to the path.
2497 uno::Reference<beans::XPropertySet> xShapeWaveProps(getShapeFromPage(0, 1, xDocShRef));
2498 awt::Rectangle aBoundRectWave;
2499 xShapeWaveProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRectWave;
2500 // difference should be zero, but allow some range for stroke thickness
2501 CPPUNIT_ASSERT_LESS(static_cast<long>(50), labs(aBoundRectWave.Width - 11514));
2502
2503 xDocShRef->DoClose();
2504 }
2505
testTdf126234()2506 void SdOOXMLExportTest2::testTdf126234()
2507 {
2508 sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126234.pptx"), PPTX );
2509 utl::TempFile tempFile;
2510 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2511
2512 // check relative size of the bullet, 400% is a legitimate value for MS Office document
2513 // Without a fix, it will fail to set the size correctly
2514 const SdrPage *pPage = GetPage( 1, xDocShRef );
2515 SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
2516 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
2517 const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
2518 const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET);
2519 CPPUNIT_ASSERT(pNumFmt);
2520 CPPUNIT_ASSERT_EQUAL(sal_uInt16(400), pNumFmt->GetNumRule()->GetLevel(0).GetBulletRelSize());
2521
2522 xDocShRef->DoClose();
2523 }
2524
testTdf126741()2525 void SdOOXMLExportTest2::testTdf126741()
2526 {
2527 sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126741.pptx"), PPTX );
2528 utl::TempFile tempFile;
2529 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2530
2531 // dash dot dot line style import fix
2532 // The original fixed values are replaced with the percent values, because
2533 // with fix for tdf#127166 the MS Office preset styles are correctly detected.
2534 const SdrPage *pPage = GetPage( 1, xDocShRef );
2535 SdrObject *const pObj = pPage->GetObj(0);
2536 CPPUNIT_ASSERT(pObj);
2537
2538 const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
2539 pObj->GetMergedItem(XATTR_LINESTYLE));
2540 const XLineDashItem& rDashItem = dynamic_cast<const XLineDashItem&>(
2541 pObj->GetMergedItem(XATTR_LINEDASH));
2542
2543 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue());
2544 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem.GetDashValue().GetDots());
2545 CPPUNIT_ASSERT_EQUAL(sal_uInt32(800), rDashItem.GetDashValue().GetDotLen());
2546 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem.GetDashValue().GetDashes());
2547 CPPUNIT_ASSERT_EQUAL(sal_uInt32(100), rDashItem.GetDashValue().GetDashLen());
2548 CPPUNIT_ASSERT_EQUAL(sal_uInt32(300), rDashItem.GetDashValue().GetDistance());
2549
2550 xDocShRef->DoClose();
2551 }
2552
testTdf99497_keepAppearanceOfCircleKind()2553 void SdOOXMLExportTest2::testTdf99497_keepAppearanceOfCircleKind()
2554 {
2555 // Error was, that all CircleKind were exported to 'ellipse'.
2556 // Resulting pptx has to contain the customshapes of the corresponding kind
2557 // slide 1 ARC -> arc, slide 2 CUT -> chord, slide 3 SECTION -> pie
2558 // Adjustment values need to exist and their values need to correspond to the
2559 // original angles. Shape 'arc' needs to be unfilled.
2560 const OUString sPath("/sd/qa/unit/data/odp/tdf99497_CircleKind.odp");
2561 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(sPath), ODP);
2562 utl::TempFile tempFile;
2563 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
2564
2565 // slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> exists
2566 xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
2567 const OString sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
2568 assertXPath(pXmlDocContent1, sPathStart1 + "[@prst='arc']");
2569 const OString sPathAdj1(sPathStart1 + "/a:avLst/a:gd");
2570 assertXPath(pXmlDocContent1, sPathAdj1 + "[@name='adj1' and @fmla='val 20493903']");
2571 assertXPath(pXmlDocContent1, sPathAdj1 + "[@name='adj2' and @fmla='val 5400000']");
2572 assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
2573
2574 // slide 2 270° -> adj1 = 5400000, 180° -> adj2 = 10800000
2575 xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
2576 const OString sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
2577 assertXPath(pXmlDocContent2, sPathStart2 + "[@prst='chord']");
2578 const OString sPathAdj2(sPathStart2 + "/a:avLst/a:gd");
2579 assertXPath(pXmlDocContent2, sPathAdj2 + "[@name='adj1' and @fmla='val 5400000']");
2580 assertXPath(pXmlDocContent2, sPathAdj2 + "[@name='adj2' and @fmla='val 10800000']");
2581
2582 // slide 3 120° -> adj1 = 12600000, 30° -> adj2 = 20946396
2583 xmlDocPtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml");
2584 const OString sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
2585 assertXPath(pXmlDocContent3, sPathStart3 + "[@prst='pie']");
2586 const OString sPathAdj3(sPathStart3 + "/a:avLst/a:gd");
2587 assertXPath(pXmlDocContent3, sPathAdj3 + "[@name='adj1' and @fmla='val 12600000']");
2588 assertXPath(pXmlDocContent3, sPathAdj3 + "[@name='adj2' and @fmla='val 20946396']");
2589
2590 xDocShRef->DoClose();
2591 }
2592
testTdf127372()2593 void SdOOXMLExportTest2::testTdf127372()
2594 {
2595 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf127372.odp"), ODP);
2596 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
2597 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
2598 awt::Gradient aTransparenceGradient;
2599 xShape->getPropertyValue("FillTransparenceGradient") >>= aTransparenceGradient;
2600 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aTransparenceGradient.StartColor);
2601 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aTransparenceGradient.EndColor);
2602 }
2603
testTdf127379()2604 void SdOOXMLExportTest2::testTdf127379()
2605 {
2606 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf127379.odp"), ODP);
2607 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
2608 uno::Reference< drawing::XDrawPagesSupplier > xDoc(
2609 xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
2610 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDoc->getDrawPages()->getCount() );
2611
2612 uno::Reference< drawing::XDrawPage > xPage( getPage( 0, xDocShRef ) );
2613 uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY );
2614
2615 uno::Any aAny = xPropSet->getPropertyValue( "Background" );
2616 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny.hasValue());
2617 uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
2618 aAny >>= aXBackgroundPropSet;
2619
2620 drawing::FillStyle aFillStyle(drawing::FillStyle_NONE);
2621 aXBackgroundPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
2622 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, aFillStyle);
2623
2624 awt::Gradient aGradient;
2625 CPPUNIT_ASSERT(aXBackgroundPropSet->getPropertyValue("FillGradient") >>= aGradient);
2626 CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFF0000), aGradient.StartColor);
2627 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x2A6099), aGradient.EndColor);
2628 }
2629
testTdf98603()2630 void SdOOXMLExportTest2::testTdf98603()
2631 {
2632 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf98603.pptx"), PPTX);
2633 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
2634 uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
2635 uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, xShape));
2636 uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
2637 uno::Reference< beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY_THROW);
2638 css::lang::Locale aLocale;
2639 xPropSet->getPropertyValue("CharLocaleComplex") >>= aLocale;
2640 CPPUNIT_ASSERT_EQUAL(OUString("he"), aLocale.Language);
2641 CPPUNIT_ASSERT_EQUAL(OUString("IL"), aLocale.Country);
2642 }
2643
testTdf79082()2644 void SdOOXMLExportTest2::testTdf79082()
2645 {
2646 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf79082.pptx"), PPTX);
2647 utl::TempFile tempFile;
2648 xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile );
2649
2650 xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
2651 assertXPath(pXmlDocContent,
2652 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]",
2653 "pos",
2654 "360000");
2655 assertXPath(pXmlDocContent,
2656 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]",
2657 "algn",
2658 "l");
2659
2660 assertXPath(pXmlDocContent,
2661 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]",
2662 "pos",
2663 "756000");
2664 assertXPath(pXmlDocContent,
2665 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]",
2666 "algn",
2667 "l");
2668
2669 assertXPath(pXmlDocContent,
2670 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]",
2671 "pos",
2672 "1440000");
2673 assertXPath(pXmlDocContent,
2674 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]",
2675 "algn",
2676 "ctr");
2677
2678 assertXPath(pXmlDocContent,
2679 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]",
2680 "pos",
2681 "1800000");
2682 assertXPath(pXmlDocContent,
2683 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]",
2684 "algn",
2685 "r");
2686
2687 assertXPath(pXmlDocContent,
2688 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]",
2689 "pos",
2690 "3240000");
2691 assertXPath(pXmlDocContent,
2692 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]",
2693 "algn",
2694 "dec");
2695
2696 xDocShRef->DoClose();
2697 }
2698
testTdf119087()2699 void SdOOXMLExportTest2::testTdf119087()
2700 {
2701 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf119087.pptx"), PPTX);
2702 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
2703 // This would fail both on export validation, and reloading the saved pptx file.
2704 }
2705
testTdf131554()2706 void SdOOXMLExportTest2::testTdf131554()
2707 {
2708 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf131554.pptx"), PPTX);
2709 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
2710 uno::Reference<drawing::XShape> xShape(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY);
2711 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5622), xShape->getPosition().X);
2712 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(13251), xShape->getPosition().Y);
2713 }
2714
testTdf132282()2715 void SdOOXMLExportTest2::testTdf132282()
2716 {
2717 ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf132282.pptx"), PPTX);
2718 xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
2719 uno::Reference<drawing::XShape> xShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
2720 // Without the fix in place, the position would be 0,0, height = 1 and width = 1
2721 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1736), xShape->getPosition().X);
2722 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(763), xShape->getPosition().Y);
2723 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(30523), xShape->getSize().Width);
2724 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2604), xShape->getSize().Height);
2725 }
2726
2727 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
2728
2729 CPPUNIT_PLUGIN_IMPLEMENT();
2730
2731 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
2732