1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
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>
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>
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>
39 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
43 #include <rtl/character.hxx>
46 using namespace css::animations
;
50 bool checkBeginWithNumber(const OUString
& rStr
)
52 sal_Unicode aChar
= (rStr
.getLength() > 1) ? rStr
[0] : '\0';
53 return aChar
== '.' || aChar
== '-' || rtl::isAsciiDigit(aChar
);
58 #define CPPUNIT_ASSERT_MOTIONPATH(expect, actual) \
59 assertMotionPath(expect, actual, CPPUNIT_SOURCELINE())
61 static void assertMotionPath(const OUString
&rStr1
, const OUString
&rStr2
, const CppUnit::SourceLine
&rSourceLine
)
66 OString sMessage
= OUStringToOString("Motion path values mismatch.\nExpect: " + rStr1
+
67 "\nActual: " + rStr2
, RTL_TEXTENCODING_UTF8
);
69 while(nIdx1
!= -1 && nIdx2
!= -1)
71 OUString aToken1
= rStr1
.getToken(0, ' ', nIdx1
);
72 OUString aToken2
= rStr2
.getToken(0, ' ', nIdx2
);
74 if (checkBeginWithNumber(aToken1
) && checkBeginWithNumber(aToken2
))
75 assertDoubleEquals(aToken1
.toDouble(), aToken2
.toDouble(), DBL_EPSILON
, rSourceLine
, sMessage
.getStr());
77 assertEquals(aToken1
, aToken2
, rSourceLine
, sMessage
.getStr());
79 assertEquals(sal_Int32(-1), nIdx1
, rSourceLine
, sMessage
.getStr());
80 assertEquals(sal_Int32(-1), nIdx2
, rSourceLine
, sMessage
.getStr());
83 class SdOOXMLExportTest2
: public SdModelTestBaseXML
89 void testMathObject();
90 void testMathObjectPPT2010();
92 void testExportTransitionsPPTX();
93 void testPresetShapesExport();
95 void testDatetimeFieldNumberFormat();
96 void testDatetimeFieldNumberFormatPPTX();
97 void testSlideNumberField();
98 void testSlideNumberFieldPPTX();
99 void testSlideCountField();
100 void testSlideNameField();
101 void testExtFileField();
102 void testAuthorField();
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();
137 void testTdf127901();
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();
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();
171 void testPotxExport();
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();
186 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2
);
188 CPPUNIT_TEST(testTdf93883
);
189 CPPUNIT_TEST(testTdf91378
);
190 CPPUNIT_TEST(testBnc822341
);
191 CPPUNIT_TEST(testMathObject
);
192 CPPUNIT_TEST(testMathObjectPPT2010
);
193 CPPUNIT_TEST(testTdf80224
);
194 CPPUNIT_TEST(testExportTransitionsPPTX
);
195 CPPUNIT_TEST(testPresetShapesExport
);
196 CPPUNIT_TEST(testTdf92527
);
197 CPPUNIT_TEST(testDatetimeFieldNumberFormat
);
198 CPPUNIT_TEST(testDatetimeFieldNumberFormatPPTX
);
199 CPPUNIT_TEST(testSlideNumberField
);
200 CPPUNIT_TEST(testSlideNumberFieldPPTX
);
201 CPPUNIT_TEST(testSlideCountField
);
202 CPPUNIT_TEST(testSlideNameField
);
203 CPPUNIT_TEST(testExtFileField
);
204 CPPUNIT_TEST(testAuthorField
);
205 CPPUNIT_TEST(testTdf99224
);
206 CPPUNIT_TEST(testTdf92076
);
207 CPPUNIT_TEST(testTdf59046
);
208 CPPUNIT_TEST(testTdf105739
);
209 CPPUNIT_TEST(testPageBitmapWithTransparency
);
210 CPPUNIT_TEST(testPptmContentType
);
211 CPPUNIT_TEST(testTdf111798
);
212 CPPUNIT_TEST(testPptmVBAStream
);
213 CPPUNIT_TEST(testTdf111863
);
214 CPPUNIT_TEST(testTdf111518
);
215 CPPUNIT_TEST(testTdf100387
);
216 CPPUNIT_TEST(testClosingShapesAndLineCaps
);
217 CPPUNIT_TEST(testRotateFlip
);
218 CPPUNIT_TEST(testTdf106867
);
219 CPPUNIT_TEST(testTdf112280
);
220 CPPUNIT_TEST(testTdf112088
);
221 CPPUNIT_TEST(testTdf112333
);
222 CPPUNIT_TEST(testTdf112552
);
223 CPPUNIT_TEST(testTdf112557
);
224 CPPUNIT_TEST(testTdf112334
);
225 CPPUNIT_TEST(testTdf112089
);
226 CPPUNIT_TEST(testTdf112086
);
227 CPPUNIT_TEST(testTdf112647
);
228 CPPUNIT_TEST(testGroupRotation
);
229 CPPUNIT_TEST(testTdf104788
);
230 CPPUNIT_TEST(testSmartartRotation2
);
231 CPPUNIT_TEST(testTdf91999_rotateShape
);
232 CPPUNIT_TEST(testTdf114845_rotateShape
);
233 CPPUNIT_TEST(testGroupsPosition
);
234 CPPUNIT_TEST(testGroupsRotatedPosition
);
235 CPPUNIT_TEST(testAccentColor
);
236 CPPUNIT_TEST(testThemeColors
);
237 CPPUNIT_TEST(testTdf114848
);
238 CPPUNIT_TEST(testTdf68759
);
239 CPPUNIT_TEST(testTdf127901
);
240 CPPUNIT_TEST(testTdf90626
);
241 CPPUNIT_TEST(testTdf107608
);
242 CPPUNIT_TEST(testTdf111786
);
243 CPPUNIT_TEST(testFontScale
);
244 CPPUNIT_TEST(testShapeAutofitPPTX
);
245 CPPUNIT_TEST(testLegacyShapeAutofitPPTX
);
246 CPPUNIT_TEST(testTdf115394
);
247 CPPUNIT_TEST(testTdf115394Zero
);
248 CPPUNIT_TEST(testTdf115005
);
249 CPPUNIT_TEST(testTdf115005_FallBack_Images_On
);
250 CPPUNIT_TEST(testTdf115005_FallBack_Images_Off
);
251 CPPUNIT_TEST(testTdf118806
);
252 CPPUNIT_TEST(testTdf111789
);
253 CPPUNIT_TEST(testTdf100348_convert_Fontwork2TextWarp
);
254 CPPUNIT_TEST(testTdf1225573_FontWorkScaleX
);
255 CPPUNIT_TEST(testTdf99497_keepAppearanceOfCircleKind
);
256 CPPUNIT_TEST(testTdf104792
);
257 CPPUNIT_TEST(testTdf90627
);
258 CPPUNIT_TEST(testTdf104786
);
259 CPPUNIT_TEST(testTdf118783
);
260 CPPUNIT_TEST(testTdf104789
);
261 CPPUNIT_TEST(testOpenDocumentAsReadOnly
);
262 CPPUNIT_TEST(testTdf118835
);
263 CPPUNIT_TEST(testTdf118768
);
264 CPPUNIT_TEST(testTdf118836
);
265 CPPUNIT_TEST(testTdf116350TextEffects
);
266 CPPUNIT_TEST(testTdf128096
);
267 CPPUNIT_TEST(testTdf120573
);
268 CPPUNIT_TEST(testTdf118825
);
269 CPPUNIT_TEST(testTdf119118
);
270 CPPUNIT_TEST(testTdf99213
);
271 CPPUNIT_TEST(testPotxExport
);
272 CPPUNIT_TEST(testTdf44223
);
273 CPPUNIT_TEST(testSmartArtPreserve
);
274 CPPUNIT_TEST(testTdf125346
);
275 CPPUNIT_TEST(testTdf125346_2
);
276 CPPUNIT_TEST(testTdf125360
);
277 CPPUNIT_TEST(testTdf125360_1
);
278 CPPUNIT_TEST(testTdf125360_2
);
279 CPPUNIT_TEST(testTdf125551
);
280 CPPUNIT_TEST(testTdf126234
);
281 CPPUNIT_TEST(testTdf126741
);
282 CPPUNIT_TEST(testTdf127372
);
283 CPPUNIT_TEST(testTdf127379
);
284 CPPUNIT_TEST(testTdf98603
);
286 CPPUNIT_TEST_SUITE_END();
288 virtual void registerNamespaces(xmlXPathContextPtr
& pXmlXPathCtx
) override
290 static const struct { char const * pPrefix
; char const * pURI
; } namespaces
[] =
293 { "ContentType", "http://schemas.openxmlformats.org/package/2006/content-types" },
294 { "rels", "http://schemas.openxmlformats.org/package/2006/relationships" },
295 { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
296 { "v", "urn:schemas-microsoft-com:vml" },
297 { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
298 { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
299 { "m", "http://schemas.openxmlformats.org/officeDocument/2006/math" },
300 { "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture" },
301 { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
302 { "p", "http://schemas.openxmlformats.org/presentationml/2006/main" },
303 { "p14", "http://schemas.microsoft.com/office/powerpoint/2010/main" },
304 { "r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
305 { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
306 { "a14", "http://schemas.microsoft.com/office/drawing/2010/main" },
307 { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
308 { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
309 { "dgm", "http://schemas.openxmlformats.org/drawingml/2006/diagram" },
311 for (size_t i
= 0; i
< SAL_N_ELEMENTS(namespaces
); ++i
)
313 xmlXPathRegisterNs(pXmlXPathCtx
,
314 reinterpret_cast<xmlChar
const *>(namespaces
[i
].pPrefix
),
315 reinterpret_cast<xmlChar
const *>(namespaces
[i
].pURI
));
321 void SdOOXMLExportTest2::testTdf93883()
323 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf93883.odp"), ODP
);
324 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
325 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
326 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
327 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
328 CPPUNIT_ASSERT(!xPropSet
->getPropertyValue("NumberingLevel").hasValue());
331 void SdOOXMLExportTest2::testBnc822341()
333 // Check import / export of embedded text document
334 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP
);
335 utl::TempFile tempFile1
;
336 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
, &tempFile1
);
338 // Export an LO specific ole object (imported from an ODP document)
340 xmlDocPtr pXmlDocCT
= parseExport(tempFile1
, "[Content_Types].xml");
341 assertXPath(pXmlDocCT
,
342 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
344 "/ppt/embeddings/oleObject1.docx");
346 xmlDocPtr pXmlDocRels
= parseExport(tempFile1
, "ppt/slides/_rels/slide1.xml.rels");
347 assertXPath(pXmlDocRels
,
348 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
350 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
352 xmlDocPtr pXmlDocContent
= parseExport(tempFile1
, "ppt/slides/slide1.xml");
353 assertXPath(pXmlDocContent
,
354 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
358 const SdrPage
*pPage
= GetPage( 1, xDocShRef
.get() );
360 const SdrObject
* pObj
= pPage
->GetObj(0);
361 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
362 CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier() );
365 utl::TempFile tempFile2
;
366 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
, &tempFile2
);
368 // Export an MS specific ole object (imported from a PPTX document)
370 xmlDocPtr pXmlDocCT
= parseExport(tempFile2
, "[Content_Types].xml");
371 assertXPath(pXmlDocCT
,
372 "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']",
374 "/ppt/embeddings/oleObject1.docx");
376 xmlDocPtr pXmlDocRels
= parseExport(tempFile2
, "ppt/slides/_rels/slide1.xml.rels");
377 assertXPath(pXmlDocRels
,
378 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
380 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
382 xmlDocPtr pXmlDocContent
= parseExport(tempFile2
, "ppt/slides/slide1.xml");
383 assertXPath(pXmlDocContent
,
384 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
388 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
389 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
390 const SdrPage
*pPage
= pDoc
->GetPage(1);
391 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= nullptr );
393 const SdrObject
* pObj
= pPage
->GetObj(0);
394 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
395 CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier() );
398 xDocShRef
->DoClose();
401 void SdOOXMLExportTest2::testMathObject()
403 // Check import / export of math object
404 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP
);
405 utl::TempFile tempFile1
;
406 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile1
);
408 // Export an LO specific ole object (imported from an ODP document)
410 xmlDocPtr pXmlDocContent
= parseExport(tempFile1
, "ppt/slides/slide1.xml");
411 assertXPath(pXmlDocContent
,
412 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
415 assertXPathContent(pXmlDocContent
,
416 "/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",
419 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
420 const SdrObject
* pObj
= pPage
->GetObj(0);
421 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
422 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier());
425 utl::TempFile tempFile2
;
426 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
, &tempFile2
);
428 // Export an MS specific ole object (imported from a PPTX document)
430 xmlDocPtr pXmlDocContent
= parseExport(tempFile1
, "ppt/slides/slide1.xml");
431 assertXPath(pXmlDocContent
,
432 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
435 assertXPathContent(pXmlDocContent
,
436 "/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",
439 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
440 const SdrObject
* pObj
= pPage
->GetObj(0);
441 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
442 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier());
445 xDocShRef
->DoClose();
448 void SdOOXMLExportTest2::testMathObjectPPT2010()
450 // Check import / export of math object
451 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX
);
452 utl::TempFile tempFile1
;
453 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile1
);
455 // Export an MS specific ole object (imported from a PPTX document)
457 xmlDocPtr pXmlDocContent
= parseExport(tempFile1
, "ppt/slides/slide1.xml");
458 assertXPath(pXmlDocContent
,
459 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
462 assertXPathContent(pXmlDocContent
,
463 "/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",
464 u
"\U0001D44E"); // non-BMP char
466 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
467 const SdrObject
* pObj
= pPage
->GetObj(0);
468 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
469 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier());
472 xDocShRef
->DoClose();
475 void SdOOXMLExportTest2::testTdf80224()
477 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP
);
478 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
479 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
481 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
482 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
->getStart(), uno::UNO_QUERY_THROW
);
484 sal_Int32 nCharColor
;
485 xPropSet
->getPropertyValue("CharColor") >>= nCharColor
;
486 CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor
);
487 xDocShRef
->DoClose();
490 void SdOOXMLExportTest2::testTdf91378()
493 //Check For Import and Export Both
494 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf91378.pptx"), PPTX
);
495 for( sal_uInt32 i
=0;i
<2;i
++)
497 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
498 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
499 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier( xDocShRef
->GetModel(), uno::UNO_QUERY
);
500 uno::Reference
<document::XDocumentProperties
> xProps
= xDocumentPropertiesSupplier
->getDocumentProperties();
501 uno::Reference
<beans::XPropertySet
> xUDProps( xProps
->getUserDefinedProperties(), uno::UNO_QUERY
);
503 xUDProps
->getPropertyValue("Testing") >>= propValue
;
504 CPPUNIT_ASSERT(propValue
.isEmpty());
505 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
507 xDocShRef
->DoClose();
510 static bool checkTransitionOnPage(uno::Reference
<drawing::XDrawPagesSupplier
> const & xDoc
, sal_Int32 nSlideNumber
,
511 sal_Int16 nExpectedTransitionType
, sal_Int16 nExpectedTransitionSubType
,
512 bool bExpectedDirection
= true)
514 sal_Int32 nSlideIndex
= nSlideNumber
- 1;
516 CPPUNIT_ASSERT_MESSAGE("Slide/Page index out of range", nSlideIndex
< xDoc
->getDrawPages()->getCount());
518 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(nSlideIndex
), uno::UNO_QUERY_THROW
);
519 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
521 sal_Int16 nTransitionType
= 0;
522 xPropSet
->getPropertyValue("TransitionType") >>= nTransitionType
;
524 if (nExpectedTransitionType
!= nTransitionType
)
526 std::cerr
<< "Transition type: " << nTransitionType
<< " " << nExpectedTransitionType
<< std::endl
;
530 sal_Int16 nTransitionSubtype
= 0;
531 xPropSet
->getPropertyValue("TransitionSubtype") >>= nTransitionSubtype
;
532 if (nExpectedTransitionSubType
!= nTransitionSubtype
)
534 std::cerr
<< "Transition Subtype: " << nTransitionSubtype
<< " " << nExpectedTransitionSubType
<< std::endl
;
538 bool bDirection
= false;
539 xPropSet
->getPropertyValue("TransitionDirection") >>= bDirection
;
541 if (bExpectedDirection
!= bDirection
)
543 std::cerr
<< "Transition Direction: " << (bExpectedDirection
? "normal" : "reversed")
544 << " " << (bDirection
? "normal" : "reversed") << std::endl
;
551 void SdOOXMLExportTest2::testExportTransitionsPPTX()
553 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP
);
554 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
);
555 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
558 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 01, TransitionType::BARWIPE
, TransitionSubType::TOPTOBOTTOM
, false));
559 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 02, TransitionType::BARWIPE
, TransitionSubType::LEFTTORIGHT
));
560 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 03, TransitionType::BARWIPE
, TransitionSubType::LEFTTORIGHT
, false));
561 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 04, TransitionType::BARWIPE
, TransitionSubType::TOPTOBOTTOM
));
564 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 31, TransitionType::BARWIPE
, TransitionSubType::FADEOVERCOLOR
));
567 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 41, TransitionType::PUSHWIPE
, TransitionSubType::COMBHORIZONTAL
));
568 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 42, TransitionType::PUSHWIPE
, TransitionSubType::COMBVERTICAL
));
570 // OUTSIDE TURNING CUBE
571 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 57, TransitionType::MISCSHAPEWIPE
, TransitionSubType::CORNERSOUT
));
572 // INSIDE TURNING CUBE
573 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 60, TransitionType::MISCSHAPEWIPE
, TransitionSubType::CORNERSIN
));
576 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 61, TransitionType::MISCSHAPEWIPE
, TransitionSubType::LEFTTORIGHT
));
579 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 70, TransitionType::MISCSHAPEWIPE
, TransitionSubType::VERTICAL
));
582 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 71, TransitionType::MISCSHAPEWIPE
, TransitionSubType::HORIZONTAL
));
585 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 72, TransitionType::MISCSHAPEWIPE
, TransitionSubType::DIAMOND
));
588 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 73, TransitionType::MISCSHAPEWIPE
, TransitionSubType::HEART
));
591 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 74, TransitionType::ZOOM
, TransitionSubType::ROTATEIN
));
593 // OVAL VERTICAL - cannot be exported to PPTX so fallback to circle
594 //CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::VERTICAL));
595 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 76, TransitionType::ELLIPSEWIPE
, TransitionSubType::CIRCLE
));
597 xDocShRef
->DoClose();
600 void SdOOXMLExportTest2::testPresetShapesExport()
602 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/preset-shapes-export.odp"), ODP
);
603 const sal_Char
*sShapeTypeAndValues
[] =
605 "wedgeEllipseCallout",
608 "wedgeRoundRectCallout",
653 "adj6","val -134550",
655 "adj1","val 13020000",
656 "adj2","val 19380000",
660 utl::TempFile tempFile
;
661 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
, &tempFile
);
663 xmlDocPtr pXmlDocCT
= parseExport(tempFile
, "ppt/slides/slide1.xml");
664 const OString
sPattern( "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]" );
665 const OString
sT( "_T_" );
666 const OString
sN( "_N_" );
667 const OString
sPropertyName("name");
668 const OString
sPropertyFmla("fmla");
671 while(i
< SAL_N_ELEMENTS( sShapeTypeAndValues
)) {
672 OString
sType( sShapeTypeAndValues
[ i
++ ] );
673 for ( size_t j
= 1 ; i
< SAL_N_ELEMENTS( sShapeTypeAndValues
) && OString(sShapeTypeAndValues
[i
]).startsWith("adj") ; ++j
) {
674 OString sXPath
= sPattern
.replaceFirst( sT
, sType
).replaceFirst( sN
, OString::number(j
) );
675 assertXPath(pXmlDocCT
, sXPath
, sPropertyName
, OUString::createFromAscii(sShapeTypeAndValues
[ i
++ ]) );
676 assertXPath(pXmlDocCT
, sXPath
, sPropertyFmla
, OUString::createFromAscii(sShapeTypeAndValues
[ i
++ ]) );
681 void SdOOXMLExportTest2::testTdf92527()
683 // We draw a diamond in an empty document. A newly created diamond shape does not have
684 // CustomShapeGeometry - Path - Segments property, and previously DrawingML exporter
685 // did not export custom shapes which did not have CustomShapeGeometry - Path - Segments property.
686 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/empty.fodp"), FODG
);
687 uno::Reference
<css::lang::XMultiServiceFactory
> xFactory(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY
);
688 uno::Reference
<drawing::XShape
> xShape1(xFactory
->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY
);
689 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc1(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
690 uno::Reference
<drawing::XDrawPage
> xPage1(xDoc1
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
691 xPage1
->add(xShape1
);
692 xShape1
->setSize(awt::Size(10000, 10000));
693 xShape1
->setPosition(awt::Point(1000, 1000));
694 uno::Sequence
<beans::PropertyValue
> aShapeGeometry(comphelper::InitPropertySequence(
696 {"Type", uno::makeAny(OUString("diamond"))},
698 uno::Reference
<beans::XPropertySet
> xPropertySet1(xShape1
, uno::UNO_QUERY
);
699 xPropertySet1
->setPropertyValue("CustomShapeGeometry", uno::makeAny(aShapeGeometry
));
701 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
);
703 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc2(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
704 uno::Reference
<drawing::XDrawPage
> xPage2(xDoc2
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
705 uno::Reference
<drawing::XShape
> xShape2(xPage2
->getByIndex(0), uno::UNO_QUERY_THROW
);
706 uno::Reference
< beans::XPropertySet
> xPropertySet2( xShape2
, uno::UNO_QUERY_THROW
);
707 uno::Sequence
<beans::PropertyValue
> aProps
;
708 xPropertySet2
->getPropertyValue("CustomShapeGeometry") >>= aProps
;
709 uno::Sequence
<beans::PropertyValue
> aPathProps
;
710 for (int i
= 0; i
< aProps
.getLength(); ++i
)
712 const beans::PropertyValue
& rProp
= aProps
[i
];
713 if (rProp
.Name
== "Path")
714 aPathProps
= rProp
.Value
.get
< uno::Sequence
<beans::PropertyValue
> >();
716 uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
> aCoordinates
;
717 for (int i
= 0; i
< aPathProps
.getLength(); ++i
)
719 const beans::PropertyValue
& rProp
= aPathProps
[i
];
720 if (rProp
.Name
== "Coordinates")
721 aCoordinates
= rProp
.Value
.get
< uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
> >();
724 // 5 coordinate pairs, 1 MoveTo, 4 LineTo
725 CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates
.getLength());
726 xDocShRef
->DoClose();
731 void matchNumberFormat( int nPage
, uno::Reference
< text::XTextField
> const & xField
)
733 uno::Reference
< beans::XPropertySet
> xPropSet( xField
, uno::UNO_QUERY_THROW
);
735 xPropSet
->getPropertyValue("NumberFormat") >>= nNumFmt
;
739 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(2), nNumFmt
);
741 case 1: // 13/02/1996
742 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(5), nNumFmt
);
744 case 2: // 13 February 1996
745 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match", sal_Int32(3), nNumFmt
);
748 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(2), nNumFmt
);
751 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(3), nNumFmt
);
754 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(6), nNumFmt
);
756 case 6: // 01:49:38 PM
757 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match", sal_Int32(7), nNumFmt
);
763 void SdOOXMLExportTest2::testDatetimeFieldNumberFormat()
765 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP
);
767 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
769 for(sal_uInt16 i
= 0; i
<= 6; ++i
)
771 matchNumberFormat( i
, getTextFieldFromPage(0, 0, 0, i
, xDocShRef
) );
774 xDocShRef
->DoClose();
777 void SdOOXMLExportTest2::testDatetimeFieldNumberFormatPPTX()
779 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX
);
781 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
783 for(sal_uInt16 i
= 0; i
<= 6; ++i
)
785 matchNumberFormat( i
, getTextFieldFromPage(0, 0, 0, i
, xDocShRef
) );
788 xDocShRef
->DoClose();
791 void SdOOXMLExportTest2::testSlideNumberField()
793 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP
);
795 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
797 uno::Reference
< text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0, xDocShRef
);
798 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
800 xDocShRef
->DoClose();
803 void SdOOXMLExportTest2::testSlideNumberFieldPPTX()
805 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX
);
807 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
809 uno::Reference
< text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0, xDocShRef
);
810 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
812 xDocShRef
->DoClose();
815 void SdOOXMLExportTest2::testSlideCountField()
817 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP
);
819 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
821 uno::Reference
< text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0, xDocShRef
);
822 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
824 xDocShRef
->DoClose();
827 void SdOOXMLExportTest2::testSlideNameField()
829 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP
);
831 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
833 uno::Reference
< text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0, xDocShRef
);
834 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
836 xDocShRef
->DoClose();
839 void SdOOXMLExportTest2::testExtFileField()
841 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP
);
843 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
845 for(sal_uInt16 i
= 0; i
<= 3; ++i
)
847 uno::Reference
< text::XTextField
> xField
= getTextFieldFromPage(0, 0, i
, 0, xDocShRef
);
848 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
850 uno::Reference
< beans::XPropertySet
> xPropSet( xField
, uno::UNO_QUERY_THROW
);
852 xPropSet
->getPropertyValue("FileFormat") >>= nNumFmt
;
855 case 0: // Path/File name
856 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(0), nNumFmt
);
859 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(1), nNumFmt
);
861 case 2: // File name without extension
862 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(2), nNumFmt
);
864 case 3: // File name with extension
865 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(3), nNumFmt
);
869 xDocShRef
->DoClose();
872 void SdOOXMLExportTest2::testAuthorField()
874 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP
);
876 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
878 uno::Reference
< text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0, xDocShRef
);
879 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
881 xDocShRef
->DoClose();
884 void SdOOXMLExportTest2::testTdf99224()
886 sd::DrawDocShellRef xShell
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP
);
887 xShell
= saveAndReload(xShell
.get(), PPTX
);
888 uno::Reference
<drawing::XDrawPage
> xPage
= getPage(0, xShell
);
889 // This was 0: the image with text was lost on export.
890 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1), xPage
->getCount());
894 void SdOOXMLExportTest2::testTdf92076()
896 sd::DrawDocShellRef xShell
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf92076.odp"), ODP
);
897 xShell
= saveAndReload(xShell
.get(), PPTX
);
898 uno::Reference
<drawing::XDrawPage
> xPage
= getPage(0, xShell
);
899 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2), xPage
->getCount());
903 void SdOOXMLExportTest2::testTdf59046()
905 sd::DrawDocShellRef xShell
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf59046.odp"), ODP
);
906 utl::TempFile tempFile
;
907 xShell
= saveAndReload(xShell
.get(), PPTX
, &tempFile
);
909 xmlDocPtr pXmlDocRels
= parseExport(tempFile
, "ppt/slides/slide1.xml");
910 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
913 void SdOOXMLExportTest2::testTdf105739()
915 // Gradient was lost during saving to ODP
916 sd::DrawDocShellRef xShell
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf105739.pptx"), PPTX
);
917 utl::TempFile tempFile
;
918 xShell
= saveAndReload(xShell
.get(), ODP
, &tempFile
);
919 uno::Reference
<drawing::XDrawPage
> xPage
= getPage(0, xShell
);
920 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
921 uno::Any aAny
= xPropSet
->getPropertyValue("Background");
922 CPPUNIT_ASSERT(aAny
.hasValue());
925 uno::Reference
< beans::XPropertySet
> aXBackgroundPropSet
;
926 aAny
>>= aXBackgroundPropSet
;
929 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
930 aXBackgroundPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
931 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_GRADIENT
), static_cast<int>(aFillStyle
));
933 // Test gradient properties
934 com::sun::star::awt::Gradient aFillGradient
;
935 aXBackgroundPropSet
->getPropertyValue("FillGradient") >>= aFillGradient
;
936 CPPUNIT_ASSERT_EQUAL(int(awt::GradientStyle_LINEAR
), static_cast<int>(aFillGradient
.Style
));
937 CPPUNIT_ASSERT_EQUAL(util::Color(0xff0000), aFillGradient
.StartColor
);
938 CPPUNIT_ASSERT_EQUAL(util::Color(0x00b050), aFillGradient
.EndColor
);
944 void SdOOXMLExportTest2::testPageBitmapWithTransparency()
946 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx"), PPTX
);
948 xDocShRef
= saveAndReload( xDocShRef
.get(), ODP
);
949 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
950 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
951 CPPUNIT_ASSERT_EQUAL_MESSAGE( "There should be exactly one page", static_cast<sal_Int32
>(1), xDoc
->getDrawPages()->getCount() );
953 uno::Reference
< drawing::XDrawPage
> xPage( getPage( 0, xDocShRef
) );
955 uno::Reference
< beans::XPropertySet
> xPropSet( xPage
, uno::UNO_QUERY
);
956 uno::Any aAny
= xPropSet
->getPropertyValue( "Background" );
957 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny
.hasValue());
959 uno::Reference
< beans::XPropertySet
> aXBackgroundPropSet
;
960 aAny
>>= aXBackgroundPropSet
;
961 sal_Int32 nTransparence
;
962 aAny
= aXBackgroundPropSet
->getPropertyValue( "FillTransparence" );
963 aAny
>>= nTransparence
;
964 CPPUNIT_ASSERT_EQUAL_MESSAGE("Slide background transparency is wrong", sal_Int32(49), nTransparence
);
966 xDocShRef
->DoClose();
969 void SdOOXMLExportTest2::testPptmContentType()
971 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptm/macro.pptm"), PPTM
);
972 utl::TempFile tempFile
;
973 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTM
, &tempFile
);
975 // Assert that the content type is the one of PPTM
976 xmlDocPtr pXmlContentType
= parseExport(tempFile
, "[Content_Types].xml");
977 assertXPath(pXmlContentType
,
978 "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
980 "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");
982 xDocShRef
->DoClose();
985 void SdOOXMLExportTest2::testTdf111798()
987 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf111798.odp"), ODP
);
988 utl::TempFile tempFile
;
989 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
990 xDocShRef
->DoClose();
991 xmlDocPtr pXmlDoc
= parseExport(tempFile
, "ppt/slides/slide1.xml");
993 const OUString data
[][29] =
996 "2700000", "2458080", "2414880", "1439640", "1440000",
997 "moveTo", "0", "3000",
998 "lnTo[1]", "3000", "3000",
999 "lnTo[2]", "3000", "4000",
1000 "lnTo[3]", "4000", "2000",
1001 "lnTo[4]", "3000", "0",
1002 "lnTo[5]", "3000", "1000",
1003 "lnTo[6]", "0", "1000",
1004 "lnTo[7]", "0", "3000"
1007 "2700000", "6778080", "2414880", "1439640", "1440000",
1008 "moveTo", "3000", "0",
1009 "lnTo[1]", "3000", "3000",
1010 "lnTo[2]", "4000", "3000",
1011 "lnTo[3]", "2000", "4000",
1012 "lnTo[4]", "0", "3000",
1013 "lnTo[5]", "1000", "3000",
1014 "lnTo[6]", "1000", "0",
1015 "lnTo[7]", "3000", "0"
1019 for (size_t nShapeIndex
= 0; nShapeIndex
< SAL_N_ELEMENTS(data
); nShapeIndex
++)
1021 size_t nDataIndex
= 0;
1023 const OString sSpPr
= "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex
+ 1) + "]/p:spPr";
1024 const OString sXfrm
= sSpPr
+ "/a:xfrm";
1025 assertXPath(pXmlDoc
, sXfrm
, "rot", data
[nShapeIndex
][nDataIndex
++]);
1026 const OString sOff
= sXfrm
+ "/a:off";
1027 assertXPath(pXmlDoc
, sOff
, "x", data
[nShapeIndex
][nDataIndex
++]);
1028 assertXPath(pXmlDoc
, sOff
, "y", data
[nShapeIndex
][nDataIndex
++]);
1029 const OString sExt
= sXfrm
+ "/a:ext";
1030 assertXPath(pXmlDoc
, sExt
, "cx", data
[nShapeIndex
][nDataIndex
++]);
1031 assertXPath(pXmlDoc
, sExt
, "cy", data
[nShapeIndex
][nDataIndex
++]);
1033 while (nDataIndex
< SAL_N_ELEMENTS(data
[nShapeIndex
]))
1035 const OString sPt
= sSpPr
+ "/a:custGeom/a:pathLst/a:path/a:" + data
[nShapeIndex
][nDataIndex
++].toUtf8() + "/a:pt";
1036 assertXPath(pXmlDoc
, sPt
, "x", data
[nShapeIndex
][nDataIndex
++]);
1037 assertXPath(pXmlDoc
, sPt
, "y", data
[nShapeIndex
][nDataIndex
++]);
1042 void SdOOXMLExportTest2::testPptmVBAStream()
1044 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptm/macro.pptm"), PPTM
);
1045 utl::TempFile tempFile
;
1046 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTM
, &tempFile
);
1048 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
), tempFile
.GetURL());
1049 // This failed: VBA stream was not roundtripped
1050 CPPUNIT_ASSERT(xNameAccess
->hasByName("ppt/vbaProject.bin"));
1052 xDocShRef
->DoClose();
1055 void SdOOXMLExportTest2::testTdf111863()
1057 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf111863.pptx"), PPTX
);
1058 utl::TempFile tempFile
;
1059 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1060 xDocShRef
->DoClose();
1062 // check that transition attribute didn't change from 'out' to 'in'
1063 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1064 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",
1065 "transition", "out");
1068 void SdOOXMLExportTest2::testTdf111518()
1070 sd::DrawDocShellRef xShell
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf111518.pptx"), PPTX
);
1071 utl::TempFile tempFile
;
1072 tempFile
.EnableKillingFile(false);
1073 xShell
= saveAndReload(xShell
.get(), PPTX
, &tempFile
);
1076 xmlDocPtr pXmlDocRels
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1077 OUString sExpect
= "M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E";
1078 OUString sActual
= getXPath(pXmlDocRels
,
1079 "/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",
1081 CPPUNIT_ASSERT_MOTIONPATH(sExpect
, sActual
);
1084 void SdOOXMLExportTest2::testTdf100387()
1087 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf100387.odp"), ODP
);
1088 utl::TempFile tempFile
;
1089 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1090 xDocShRef
->DoClose();
1091 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1093 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn", "dur", "indefinite");
1094 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");
1095 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");
1097 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1098 "/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");
1099 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1100 "/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");
1102 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1103 "/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");
1104 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1105 "/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");
1107 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
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", "st", "2");
1109 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1110 "/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");
1113 // tdf#126746 Add support for Line Caps import and export
1114 void SdOOXMLExportTest2::testClosingShapesAndLineCaps()
1116 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/closed-shapes.odp"), ODP
);
1117 utl::TempFile tempFile
;
1118 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1119 xDocShRef
->DoClose();
1120 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1121 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt", 1);
1122 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);
1123 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);
1124 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 1);
1125 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln", "cap", "rnd");
1126 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln/a:miter", 1);
1128 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1129 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln", "cap", "rnd");
1130 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln/a:miter", 1);
1132 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1133 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln", "cap", "rnd");
1134 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln/a:miter", 1);
1136 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1137 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln", "cap", "sq");
1138 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln/a:round", 1);
1140 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1141 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln", "cap"); // by default it is "flat" cap style
1142 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln/a:bevel", 1);
1144 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1145 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln", "cap"); // by default it is "flat" cap style
1146 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:ln/a:round", 1);
1149 void SdOOXMLExportTest2::testRotateFlip()
1151 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/rotate_flip.odp"), ODP
);
1152 utl::TempFile tempFile
;
1153 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1154 xDocShRef
->DoClose();
1155 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1157 const OUString data
[][4] =
1159 { "0", "1", "1170000", "1035720" },
1160 { "1", "1", "7108560", "1036440" },
1161 { "1", "0", "4140000", "1036440" }
1164 const OUString points
[][2] = { {"221", "293"}, {"506", "12" }, {"367", "0" }, {"29", "406"}, {"431", "347"}, {"145", "645"},
1165 {"99", "520"}, {"0", "861"}, {"326", "765"}, {"209", "711"}, {"640", "233"}, {"640", "233"} };
1167 for (size_t nShapeIndex
= 0; nShapeIndex
< SAL_N_ELEMENTS(data
); nShapeIndex
++)
1169 size_t nDataIndex
= 0;
1171 const OString sSpPr
= "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex
+ 1) + "]/p:spPr";
1172 const OString sXfrm
= sSpPr
+ "/a:xfrm";
1173 if(data
[nShapeIndex
][nDataIndex
++] == "1")
1174 assertXPath(pXmlDocContent
, sXfrm
, "flipH", "1");
1175 if(data
[nShapeIndex
][nDataIndex
++] == "1")
1176 assertXPath(pXmlDocContent
, sXfrm
, "flipV", "1");
1177 assertXPath(pXmlDocContent
, sXfrm
, "rot", "20400000");
1178 const OString sOff
= sXfrm
+ "/a:off";
1179 assertXPath(pXmlDocContent
, sOff
, "x", data
[nShapeIndex
][nDataIndex
++]);
1180 assertXPath(pXmlDocContent
, sOff
, "y", data
[nShapeIndex
][nDataIndex
++]);
1181 const OString sExt
= sXfrm
+ "/a:ext";
1182 assertXPath(pXmlDocContent
, sExt
, "cx", "1800000");
1183 assertXPath(pXmlDocContent
, sExt
, "cy", "3600000");
1185 for (size_t nPointIndex
= 0; nPointIndex
< SAL_N_ELEMENTS(points
); nPointIndex
++)
1187 const OString sPt
= sSpPr
+ "/a:custGeom/a:pathLst/a:path/a:lnTo[" + OString::number(nPointIndex
+ 1) + "]/a:pt";
1188 assertXPath(pXmlDocContent
, sPt
, "x", points
[nPointIndex
][0]);
1189 assertXPath(pXmlDocContent
, sPt
, "y", points
[nPointIndex
][1]);
1191 assertXPath(pXmlDocContent
, sSpPr
+ "/a:custGeom/a:pathLst/a:path/a:close", 1);
1195 void SdOOXMLExportTest2::testTdf106867()
1197 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf106867.pptx"), PPTX
);
1198 utl::TempFile tempFile
;
1199 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1201 const SdrPage
*pPage
= GetPage(1, xDocShRef
.get());
1203 // first check that we have the media object
1204 const SdrMediaObj
* pMediaObj
= dynamic_cast<SdrMediaObj
*>(pPage
->GetObj(2));
1205 CPPUNIT_ASSERT_MESSAGE("no media object", pMediaObj
!= nullptr);
1206 CPPUNIT_ASSERT_EQUAL(OUString("vnd.sun.star.Package:ppt/media/media1.avi"), pMediaObj
->getURL());
1208 xDocShRef
->DoClose();
1210 // additional checks of the output file
1211 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
), tempFile
.GetURL());
1212 // check that the document contains the video stream
1213 CPPUNIT_ASSERT(xNameAccess
->hasByName("ppt/media/media1.avi"));
1215 // both the ooxml and the extended markup
1216 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1217 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile");
1218 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media");
1220 // target the shape with the video in the command
1221 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",
1225 void SdOOXMLExportTest2::testTdf112280()
1227 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112280.pptx"), PPTX
);
1228 utl::TempFile tempFile
;
1229 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1230 xDocShRef
->DoClose();
1232 // check the animRot value
1233 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1234 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",
1238 void SdOOXMLExportTest2::testTdf112088()
1240 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112088.pptx"), PPTX
);
1241 utl::TempFile tempFile
;
1242 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1243 xDocShRef
->DoClose();
1245 // check gradient stops
1246 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1247 assertXPathChildren(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst", 2);
1250 void SdOOXMLExportTest2::testTdf112333()
1252 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112333.pptx"), PPTX
);
1253 utl::TempFile tempFile
;
1254 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1255 xDocShRef
->DoClose();
1257 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1259 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");
1260 CPPUNIT_ASSERT_EQUAL(OUString("solid"), sTo
);
1262 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");
1263 CPPUNIT_ASSERT_EQUAL(OUString("fill.type"), sAttributeName
);
1265 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");
1266 CPPUNIT_ASSERT_EQUAL(OUString("true"), sTo
);
1268 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");
1269 CPPUNIT_ASSERT_EQUAL(OUString("fill.on"), sAttributeName
);
1271 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");
1272 CPPUNIT_ASSERT_EQUAL(OUString("0563c1"), sTo
);
1274 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");
1275 CPPUNIT_ASSERT_EQUAL(OUString("fillcolor"), sAttributeName
);
1278 void SdOOXMLExportTest2::testTdf112552()
1280 // Background fill was not displayed, but it was because of the wrong geometry
1281 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf112552.odp"), ODP
);
1282 utl::TempFile tempFile
;
1283 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1285 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1286 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "w", "21600");
1287 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "h", "21600");
1288 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");
1289 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");
1290 xDocShRef
->DoClose();
1293 void SdOOXMLExportTest2::testTdf112557()
1295 // Subtitle shape should be skipped by export.
1296 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf112557.odp"), ODP
);
1297 utl::TempFile tempFile
;
1298 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1300 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slideMasters/slideMaster1.xml");
1301 assertXPath(pXmlDocContent
, "/p:sldMaster/p:cSld/p:spTree/p:sp", 2); // title and object
1302 xDocShRef
->DoClose();
1305 void SdOOXMLExportTest2::testTdf112334()
1307 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112334.pptx"), PPTX
);
1308 utl::TempFile tempFile
;
1309 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1310 xDocShRef
->DoClose();
1312 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1314 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");
1315 CPPUNIT_ASSERT_EQUAL(OUString("style.color"), sAttributeName
);
1318 void SdOOXMLExportTest2::testTdf112089()
1320 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112089.pptx"), PPTX
);
1321 utl::TempFile tempFile
;
1322 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1323 xDocShRef
->DoClose();
1325 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1327 OUString sID
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
1328 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");
1329 CPPUNIT_ASSERT_EQUAL(sID
, sTarget
);
1332 void SdOOXMLExportTest2::testTdf112086()
1334 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112086.pptx"), PPTX
);
1335 utl::TempFile tempFile
;
1336 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1337 xDocShRef
->DoClose();
1339 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1341 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");
1342 CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal
);
1344 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");
1345 CPPUNIT_ASSERT_EQUAL(OUString("ppt_w"), sAttributeName
);
1347 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");
1348 CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal
);
1350 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");
1351 CPPUNIT_ASSERT_EQUAL(OUString("ppt_h"), sAttributeName
);
1352 xDocShRef
->DoClose();
1355 void SdOOXMLExportTest2::testTdf112647()
1357 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf112647.odp"), ODP
);
1358 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
1359 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1360 uno::Reference
<text::XTextRange
> xParagraph( getParagraphFromShape( 0, xShape
) );
1361 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
1363 css::style::LineSpacing aLineSpacing
;
1364 xPropSet
->getPropertyValue("ParaLineSpacing") >>= aLineSpacing
;
1365 CPPUNIT_ASSERT_EQUAL(sal_Int16(css::style::LineSpacingMode::FIX
), aLineSpacing
.Mode
);
1366 CPPUNIT_ASSERT_EQUAL(sal_Int16(2117), aLineSpacing
.Height
);
1367 xDocShRef
->DoClose();
1370 void SdOOXMLExportTest2::testGroupRotation()
1372 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/group_rotation.odp"), ODP
);
1373 utl::TempFile tempFile
;
1374 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1375 xDocShRef
->DoClose();
1377 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1378 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm", "rot");
1379 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot", "20400000");
1380 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot", "20400000");
1383 void SdOOXMLExportTest2::testTdf104788()
1385 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104788.pptx"), PPTX
);
1386 utl::TempFile tempFile
;
1387 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1388 xDocShRef
->DoClose();
1390 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide6.xml");
1392 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");
1393 CPPUNIT_ASSERT_EQUAL(-1.0, sVal
.toDouble());
1395 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");
1396 CPPUNIT_ASSERT_EQUAL(OUString("xshear"), sAttributeName
);
1397 xDocShRef
->DoClose();
1400 void SdOOXMLExportTest2::testSmartartRotation2()
1402 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/smartart-rotation2.pptx"), PPTX
);
1404 // clear SmartArt data to check how group shapes with double-rotated children are exported, not smartart
1405 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
));
1406 uno::Sequence
<beans::PropertyValue
> aInteropGrabBag
;
1407 xShape
->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag
));
1409 utl::TempFile tempFile
;
1410 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1411 xDocShRef
->DoClose();
1413 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1414 assertXPathContent(pXmlDocContent
,
1415 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", "Text");
1416 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot", "10800000");
1417 double dX
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "x").toDouble();
1418 double dY
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "y").toDouble();
1419 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2276280.0, dX
, dX
* .001);
1420 CPPUNIT_ASSERT_DOUBLES_EQUAL( 3158280.0, dY
, dY
* .001);
1423 void SdOOXMLExportTest2::testTdf91999_rotateShape()
1425 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx"), PPTX
);
1426 utl::TempFile tempFile
;
1427 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1428 xDocShRef
->DoClose();
1430 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1431 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name", "CustomShape 2");
1432 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", "10800000");
1433 double dX
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "x").toDouble();
1434 double dY
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "y").toDouble();
1435 CPPUNIT_ASSERT_DOUBLES_EQUAL( 2960640.0, dX
, dX
* .001);
1436 CPPUNIT_ASSERT_DOUBLES_EQUAL( 1449000.0, dY
, dY
* .001);
1439 void SdOOXMLExportTest2::testTdf114845_rotateShape()
1441 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx"), PPTX
);
1442 utl::TempFile tempFile
;
1443 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1444 xDocShRef
->DoClose();
1446 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1447 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr", "name", "CustomShape 5");
1448 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm", "flipV", "1");
1449 double dX
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "x").toDouble();
1450 double dY
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "y").toDouble();
1451 CPPUNIT_ASSERT_DOUBLES_EQUAL( 4059000.0, dX
, dX
* .001);
1452 CPPUNIT_ASSERT_DOUBLES_EQUAL( 3287520.0, dY
, dY
* .001);
1455 void SdOOXMLExportTest2::testGroupsPosition()
1457 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/group.pptx"), PPTX
);
1458 utl::TempFile tempFile
;
1459 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1460 xDocShRef
->DoClose();
1462 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1463 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "5004000");
1464 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "3310560");
1465 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "7760160");
1466 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "3310560");
1469 void SdOOXMLExportTest2::testGroupsRotatedPosition()
1471 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/group-rot.pptx"), PPTX
);
1472 utl::TempFile tempFile
;
1473 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1474 xDocShRef
->DoClose();
1476 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1477 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "2857320");
1478 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "4026960");
1481 void SdOOXMLExportTest2::testAccentColor()
1483 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/accent-color.pptx"), PPTX
);
1484 utl::TempFile tempFile
;
1485 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1486 xDocShRef
->DoClose();
1488 xmlDocPtr pXmlDocContent1
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1489 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val", "accent6");
1490 xmlDocPtr pXmlDocContent2
= parseExport(tempFile
, "ppt/slides/slide2.xml");
1491 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val", "accent6");
1492 xmlDocPtr pXmlDocTheme1
= parseExport(tempFile
, "ppt/theme/theme1.xml");
1493 assertXPath(pXmlDocTheme1
, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "70ad47");
1494 xmlDocPtr pXmlDocTheme2
= parseExport(tempFile
, "ppt/theme/theme2.xml");
1495 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "deb340");
1498 void SdOOXMLExportTest2::testThemeColors()
1500 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf84205.pptx"), PPTX
);
1501 utl::TempFile tempFile
;
1502 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1503 xDocShRef
->DoClose();
1505 xmlDocPtr pXmlDocTheme2
= parseExport(tempFile
, "ppt/theme/theme2.xml");
1506 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "44546a");
1507 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val", "a5a5a5");
1510 void SdOOXMLExportTest2::testTdf114848()
1512 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf114848.pptx"), PPTX
);
1513 utl::TempFile tempFile
;
1514 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1515 xDocShRef
->DoClose();
1517 xmlDocPtr pXmlDocTheme1
= parseExport(tempFile
, "ppt/theme/theme1.xml");
1518 assertXPath(pXmlDocTheme1
, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d");
1519 xmlDocPtr pXmlDocTheme2
= parseExport(tempFile
, "ppt/theme/theme2.xml");
1520 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d");
1523 void SdOOXMLExportTest2::testTdf68759()
1525 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf68759.odp"), ODP
);
1526 utl::TempFile tempFile
;
1527 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1528 xDocShRef
->DoClose();
1530 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1531 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "x", "1687320");
1532 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "y", "1615320");
1533 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "flipH", "1");
1534 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "rot", "9600000");
1535 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "x", "3847320");
1536 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "y", "1614600");
1537 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm", "flipH", "1");
1538 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "x", "5934960");
1539 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "y", "1615320");
1543 void SdOOXMLExportTest2::testTdf127901()
1545 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf127901.odp"), ODP
);
1546 utl::TempFile tempFile
;
1547 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1548 xDocShRef
->DoClose();
1550 xmlDocPtr pXmlDocContent1
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1551 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright", "70000");
1552 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast", "-70000");
1554 xmlDocPtr pXmlDocContent2
= parseExport(tempFile
, "ppt/slides/slide2.xml");
1555 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1);
1557 xmlDocPtr pXmlDocContent3
= parseExport(tempFile
, "ppt/slides/slide3.xml");
1558 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel", "thresh", "50000");
1562 void SdOOXMLExportTest2::testTdf90626()
1564 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf90626.odp"), ODP
);
1565 utl::TempFile tempFile
;
1566 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1567 xDocShRef
->DoClose();
1569 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1570 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:buSzPct", "val", "100000");
1571 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buSzPct", "val", "150568");
1572 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:buSzPct", "val", "100000");
1573 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[4]/a:pPr/a:buSzPct", "val", "150568");
1576 void SdOOXMLExportTest2::testTdf107608()
1578 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf107608.pptx"), PPTX
);
1579 utl::TempFile tempFile
;
1580 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1582 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1583 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
, uno::UNO_SET_THROW
);
1585 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
1586 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
1587 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, aFillStyle
);
1589 bool bBackgroundFill
= false;
1590 xPropSet
->getPropertyValue("FillBackground") >>= bBackgroundFill
;
1591 CPPUNIT_ASSERT(bBackgroundFill
);
1593 sal_Int32 nBackgroundColor
;
1594 xPropSet
->getPropertyValue("FillColor") >>= nBackgroundColor
;
1595 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0x92D050), nBackgroundColor
);
1597 xDocShRef
->DoClose();
1600 void SdOOXMLExportTest2::testTdf111786()
1602 // Export line transparency with the color
1603 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf111786.pptx"), PPTX
);
1604 utl::TempFile tempFile
;
1605 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1607 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1608 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
, uno::UNO_SET_THROW
);
1610 sal_uInt32 nLineColor
;
1611 xPropSet
->getPropertyValue("LineColor") >>= nLineColor
;
1612 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32
>(0x3465A4), nLineColor
);
1614 sal_Int16 nTransparency
;
1615 xPropSet
->getPropertyValue("LineTransparence") >>= nTransparency
;
1616 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(33), nTransparency
);
1618 xDocShRef
->DoClose();
1621 void SdOOXMLExportTest2::testFontScale()
1623 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/font-scale.pptx"), PPTX
);
1624 utl::TempFile tempFile
;
1625 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1626 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1628 // Rounding errors possible, approximate value
1629 OUString sScale
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:normAutofit", "fontScale");
1630 if (sScale
!= "73000" && sScale
!= "72000" && sScale
!= "74000")
1631 CPPUNIT_ASSERT_EQUAL(OUString("73000"), sScale
);
1633 xDocShRef
->DoClose();
1636 void SdOOXMLExportTest2::testShapeAutofitPPTX()
1638 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/testShapeAutofit.pptx"), PPTX
);
1639 utl::TempFile tempFile
;
1640 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1641 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1642 CPPUNIT_ASSERT(pXmlDocContent
);
1644 // TextAutoGrowHeight --> "Resize shape to fit text" --> true
1645 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:spAutoFit", 1);
1646 // TextAutoGrowHeight --> "Resize shape to fit text" --> false
1647 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
1650 void SdOOXMLExportTest2::testLegacyShapeAutofitPPTX()
1652 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp"), ODP
);
1653 utl::TempFile tempFile
;
1654 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1655 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1656 CPPUNIT_ASSERT(pXmlDocContent
);
1658 // Text in a legacy rectangle
1659 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:noAutofit", 1);
1660 // Text in (closed) Polygon
1661 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
1662 // Text in a legacy ellipse
1663 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr/a:noAutofit", 1);
1666 void SdOOXMLExportTest2::testTdf115394()
1668 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394.pptx"), PPTX
);
1669 utl::TempFile tempFile
;
1670 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1671 double fTransitionDuration
;
1673 // Slow in MS formats
1674 SdPage
* pPage1
= xDocShRef
->GetDoc()->GetSdPage(0, PageKind::Standard
);
1675 fTransitionDuration
= pPage1
->getTransitionDuration();
1676 CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration
);
1678 // Medium in MS formats
1679 SdPage
* pPage2
= xDocShRef
->GetDoc()->GetSdPage(1, PageKind::Standard
);
1680 fTransitionDuration
= pPage2
->getTransitionDuration();
1681 CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration
);
1683 // Fast in MS formats
1684 SdPage
* pPage3
= xDocShRef
->GetDoc()->GetSdPage(2, PageKind::Standard
);
1685 fTransitionDuration
= pPage3
->getTransitionDuration();
1686 CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration
);
1689 SdPage
* pPage4
= xDocShRef
->GetDoc()->GetSdPage(3, PageKind::Standard
);
1690 fTransitionDuration
= pPage4
->getTransitionDuration();
1691 CPPUNIT_ASSERT_EQUAL(0.25, fTransitionDuration
);
1693 SdPage
* pPage5
= xDocShRef
->GetDoc()->GetSdPage(4, PageKind::Standard
);
1694 fTransitionDuration
= pPage5
->getTransitionDuration();
1695 CPPUNIT_ASSERT_EQUAL(4.25, fTransitionDuration
);
1697 xDocShRef
->DoClose();
1700 void SdOOXMLExportTest2::testTdf115394Zero()
1702 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394-zero.pptx"), PPTX
);
1703 utl::TempFile tempFile
;
1704 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1705 double fTransitionDuration
;
1707 SdPage
* pPage
= xDocShRef
->GetDoc()->GetSdPage(0, PageKind::Standard
);
1708 fTransitionDuration
= pPage
->getTransitionDuration();
1709 CPPUNIT_ASSERT_EQUAL(0.01, fTransitionDuration
);
1711 xDocShRef
->DoClose();
1714 void SdOOXMLExportTest2::testTdf115005()
1716 sd::DrawDocShellRef xDocShRefOriginal
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf115005.odp"), ODP
);
1717 utl::TempFile tempFile
;
1718 sd::DrawDocShellRef xDocShRefResaved
= saveAndReload(xDocShRefOriginal
.get(), ODP
, &tempFile
);
1720 // additional checks of the output file
1721 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
), tempFile
.GetURL());
1723 // check that the document contains original vector images
1724 const uno::Sequence
<OUString
> names
= xNameAccess
->getElementNames();
1726 for (int i
=0; i
<names
.getLength(); i
++)
1728 if(names
[i
].endsWith(".svm"))
1731 CPPUNIT_ASSERT_EQUAL(3, nSVMFiles
);
1734 int SdOOXMLExportTest2::testTdf115005_FallBack_Images(bool bAddReplacementImages
)
1736 sd::DrawDocShellRef xDocShRefOriginal
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf115005_no_fallback_images.odp"), ODP
);
1738 // check if fallback images were not created if AddReplacementImages=true/false
1739 // set AddReplacementImages
1741 std::shared_ptr
<comphelper::ConfigurationChanges
> batch( comphelper::ConfigurationChanges::create() );
1742 if ( !officecfg::Office::Common::Save::Graphic::AddReplacementImages::isReadOnly() )
1743 officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(bAddReplacementImages
, batch
);
1747 // save the file with already set options
1748 utl::TempFile tempFile
;
1749 sd::DrawDocShellRef xDocShRefResaved
= saveAndReload(xDocShRefOriginal
.get(), ODP
, &tempFile
);
1751 // additional checks of the output file
1752 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
), tempFile
.GetURL());
1754 // check that the document contains original vector images
1755 const uno::Sequence
<OUString
> names
= xNameAccess
->getElementNames();
1758 for (int i
=0; i
<names
.getLength(); i
++)
1760 if(names
[i
].endsWith(".svm"))
1762 if(names
[i
].endsWith(".png"))
1767 CPPUNIT_ASSERT_EQUAL(1, nSVMFiles
);
1771 void SdOOXMLExportTest2::testTdf115005_FallBack_Images_On()
1773 const int nPNGFiles
= testTdf115005_FallBack_Images(true);
1774 CPPUNIT_ASSERT_EQUAL(1, nPNGFiles
);
1777 void SdOOXMLExportTest2::testTdf115005_FallBack_Images_Off()
1779 const int nPNGFiles
= testTdf115005_FallBack_Images(false);
1780 CPPUNIT_ASSERT_EQUAL(0, nPNGFiles
);
1783 void SdOOXMLExportTest2::testTdf118806()
1785 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf118806.odp"), ODP
);
1786 utl::TempFile tempFile
;
1787 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1789 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1790 assertXPath(pXmlDocContent
, "//p:animMotion", "origin", "layout");
1792 xDocShRef
->DoClose();
1795 void SdOOXMLExportTest2::testTdf111789()
1797 // Shadow properties were not exported for text shapes.
1798 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf111789.pptx"), PPTX
);
1799 utl::TempFile tempFile
;
1800 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1802 // First text shape has some shadow
1804 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
1805 bool bHasShadow
= false;
1806 xShape
->getPropertyValue("Shadow") >>= bHasShadow
;
1807 CPPUNIT_ASSERT(bHasShadow
);
1808 double fShadowDist
= 0.0;
1809 xShape
->getPropertyValue("ShadowXDistance") >>= fShadowDist
;
1810 CPPUNIT_ASSERT_EQUAL(static_cast<double>(273), fShadowDist
);
1811 xShape
->getPropertyValue("ShadowYDistance") >>= fShadowDist
;
1812 CPPUNIT_ASSERT_EQUAL(static_cast<double>(273), fShadowDist
);
1813 sal_Int32 nColor
= 0;
1814 xShape
->getPropertyValue("ShadowColor") >>= nColor
;
1815 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0xFF0000), nColor
);
1816 sal_Int32 nTransparency
= 0;
1817 xShape
->getPropertyValue("ShadowTransparence") >>= nTransparency
;
1818 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(7), nTransparency
);
1821 // Second text shape has no shadow
1823 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 1, 0, xDocShRef
) );
1824 bool bHasShadow
= false;
1825 xShape
->getPropertyValue("Shadow") >>= bHasShadow
;
1826 CPPUNIT_ASSERT(!bHasShadow
);
1829 xDocShRef
->DoClose();
1832 void SdOOXMLExportTest2::testTdf104792()
1834 ::sd::DrawDocShellRef xDocShRef
= loadURL(
1835 m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx"), PPTX
);
1836 utl::TempFile tempFile
;
1837 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1839 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1840 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);
1842 xDocShRef
->DoClose();
1845 void SdOOXMLExportTest2::testTdf90627()
1847 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf90627.odp"), ODP
);
1848 utl::TempFile tempFile
;
1849 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1851 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1852 // Don't export empty endCondLst without cond.
1853 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);
1855 xDocShRef
->DoClose();
1858 void SdOOXMLExportTest2::testTdf104786()
1860 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104786.pptx"), PPTX
);
1861 utl::TempFile tempFile
;
1862 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1864 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide2.xml");
1865 // Don't export empty 'to'
1866 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);
1868 xDocShRef
->DoClose();
1871 void SdOOXMLExportTest2::testTdf118783()
1873 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf118783.odp"), ODP
);
1874 utl::TempFile tempFile
;
1875 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1876 xDocShRef
->DoClose();
1878 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1879 OUString sAttributeName
= getXPathContent(pXmlDocContent
, "//p:animRot/p:cBhvr/p:attrNameLst/p:attrName");
1880 CPPUNIT_ASSERT_EQUAL(OUString("r"), sAttributeName
);
1881 xDocShRef
->DoClose();
1884 void SdOOXMLExportTest2::testTdf104789()
1886 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf104789.pptx"), PPTX
);
1887 utl::TempFile tempFile
;
1888 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1890 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1891 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");
1892 CPPUNIT_ASSERT_EQUAL(OUString("style.opacity"), sAttributeName
);
1894 xDocShRef
->DoClose();
1897 void SdOOXMLExportTest2::testOpenDocumentAsReadOnly()
1899 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/open-as-read-only.pptx"), PPTX
);
1900 CPPUNIT_ASSERT(xDocShRef
->IsSecurityOptOpenReadOnly());
1901 utl::TempFile tempFile
;
1902 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1903 CPPUNIT_ASSERT(xDocShRef
->IsSecurityOptOpenReadOnly());
1904 xDocShRef
->DoClose();
1907 void SdOOXMLExportTest2::testTdf118835()
1909 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf118835.odp"), ODP
);
1910 utl::TempFile tempFile
;
1911 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1913 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1914 assertXPath(pXmlDocContent
, "(//p:animClr)[1]", "clrSpc", "rgb");
1915 assertXPathContent(pXmlDocContent
, "(//p:animClr)[1]//p:attrName", "style.color");
1916 assertXPath(pXmlDocContent
, "(//p:animClr)[1]//p:to/a:srgbClr", "val", "ed1c24");
1918 assertXPath(pXmlDocContent
, "(//p:animClr)[2]", "clrSpc", "rgb");
1919 assertXPathContent(pXmlDocContent
, "(//p:animClr)[2]//p:attrName", "stroke.color");
1920 assertXPath(pXmlDocContent
, "(//p:animClr)[2]//p:to/a:srgbClr", "val", "333399");
1922 assertXPath(pXmlDocContent
, "(//p:animClr)[3]", "clrSpc", "rgb");
1923 assertXPathContent(pXmlDocContent
, "(//p:animClr)[3]//p:attrName", "fillcolor");
1924 assertXPath(pXmlDocContent
, "(//p:animClr)[3]//p:to/a:srgbClr", "val", "fcd3c1");
1926 assertXPath(pXmlDocContent
, "(//p:animClr)[5]", "clrSpc", "hsl");
1927 assertXPathContent(pXmlDocContent
, "(//p:animClr)[5]//p:attrName", "fillcolor");
1928 assertXPath(pXmlDocContent
, "(//p:animClr)[5]//p:by/p:hsl", "h", "10800000");
1929 assertXPath(pXmlDocContent
, "(//p:animClr)[5]//p:by/p:hsl", "s", "0");
1930 assertXPath(pXmlDocContent
, "(//p:animClr)[5]//p:by/p:hsl", "l", "0");
1932 xDocShRef
->DoClose();
1935 void SdOOXMLExportTest2::testTdf118768()
1937 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf118768-brake.odp"), ODP
);
1938 utl::TempFile tempFile
;
1939 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1941 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1942 assertXPath(pXmlDocContent
, "//p:anim[1]", "from", "(-#ppt_w/2)");
1943 assertXPath(pXmlDocContent
, "//p:anim[1]", "to", "(#ppt_x)");
1944 assertXPath(pXmlDocContent
, "//p:anim[2]", "from", "0");
1946 assertXPath(pXmlDocContent
, "//p:anim[2]", "to", "-1");
1947 assertXPath(pXmlDocContent
, "//p:anim[2]/p:cBhvr/p:cTn", "autoRev", "1");
1949 assertXPath(pXmlDocContent
, "//p:anim[3]", "by", "(#ppt_h/3+#ppt_w*0.1)");
1950 assertXPath(pXmlDocContent
, "//p:anim[3]/p:cBhvr/p:cTn", "autoRev", "1");
1951 xDocShRef
->DoClose();
1954 void SdOOXMLExportTest2::testTdf118836()
1956 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf118836.odp"), ODP
);
1957 utl::TempFile tempFile
;
1958 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
1960 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
1961 assertXPath(pXmlDocContent
, "//p:animScale/p:by", "x", "250000");
1962 assertXPath(pXmlDocContent
, "//p:animScale/p:by", "y", "250000");
1963 xDocShRef
->DoClose();
1966 static double getAdjustmentValue( const uno::Reference
<beans::XPropertySet
>& xSet
)
1968 auto aGeomPropSeq
= xSet
->getPropertyValue( "CustomShapeGeometry" )
1969 .get
<uno::Sequence
<beans::PropertyValue
>>();
1971 = comphelper::sequenceToContainer
<std::vector
<beans::PropertyValue
>>(
1974 const OUString sName
= "AdjustmentValues";
1975 auto aIterator
= std::find_if(
1976 aGeomPropVec
.begin(), aGeomPropVec
.end(),
1977 [sName
]( const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; } );
1979 if (aIterator
!= aGeomPropVec
.end())
1981 uno::Sequence
<drawing::EnhancedCustomShapeAdjustmentValue
> aAdjustment
;
1982 double fResult
= 0.0;
1983 aIterator
->Value
>>= aAdjustment
;
1984 aAdjustment
[0].Value
>>= fResult
;
1991 static bool getScaleXValue(const uno::Reference
<beans::XPropertySet
>& xSet
)
1993 bool bScaleX
= false;
1995 auto aGeomPropSeq
= xSet
->getPropertyValue("CustomShapeGeometry")
1996 .get
<uno::Sequence
<beans::PropertyValue
>>();
1998 = comphelper::sequenceToContainer
<std::vector
<beans::PropertyValue
>>(
2001 const OUString sName
= "TextPath";
2002 auto aIterator
= std::find_if(
2003 aGeomPropVec
.begin(), aGeomPropVec
.end(),
2004 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
2006 if (aIterator
!= aGeomPropVec
.end())
2008 uno::Sequence
<beans::PropertyValue
> aTextPathProperties
;
2009 aIterator
->Value
>>= aTextPathProperties
;
2010 const OUString sScaleX
= "ScaleX";
2011 auto aIterator2
= std::find_if(
2012 aTextPathProperties
.begin(), aTextPathProperties
.end(),
2013 [sScaleX
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sScaleX
; });
2015 if (aIterator2
!= aTextPathProperties
.end())
2017 aIterator2
->Value
>>= bScaleX
;
2024 void SdOOXMLExportTest2::testTdf116350TextEffects()
2026 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc( "sd/qa/unit/data/pptx/tdf116350-texteffects.pptx" ), PPTX
);
2028 // Default angle for ArchUp
2029 uno::Reference
<beans::XPropertySet
> xShape0( getShapeFromPage( 0, 0, xDocShRef
) );
2030 double fAdjust
= getAdjustmentValue( xShape0
);
2031 CPPUNIT_ASSERT_EQUAL( 180.0, fAdjust
);
2033 bool bScaleX
= getScaleXValue( xShape0
);
2034 CPPUNIT_ASSERT_EQUAL( true, bScaleX
);
2036 // Default angle for ArchDown
2037 uno::Reference
<beans::XPropertySet
> xShape14( getShapeFromPage( 14, 0, xDocShRef
) );
2038 fAdjust
= getAdjustmentValue( xShape14
);
2039 CPPUNIT_ASSERT_EQUAL( 0.0, fAdjust
);
2041 bScaleX
= getScaleXValue( xShape14
);
2042 CPPUNIT_ASSERT_EQUAL( true, bScaleX
);
2044 // Angle directly set
2045 uno::Reference
<beans::XPropertySet
> xShape1( getShapeFromPage( 1, 0, xDocShRef
) );
2046 fAdjust
= getAdjustmentValue( xShape1
);
2047 CPPUNIT_ASSERT_EQUAL( 213.25, fAdjust
);
2049 bScaleX
= getScaleXValue( xShape1
);
2050 CPPUNIT_ASSERT_EQUAL( true, bScaleX
);
2053 utl::TempFile tempFile
;
2054 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
, &tempFile
);
2056 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2057 assertXPath(pXmlDocContent
, "//p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textArchUp");
2058 assertXPath(pXmlDocContent
, "//p:sp[14]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textCircle");
2059 assertXPath(pXmlDocContent
, "//p:sp[14]/p:spPr/a:solidFill/a:srgbClr", 0);
2061 xDocShRef
->DoClose();
2064 void SdOOXMLExportTest2::testTdf128096()
2066 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf128096.odp"), ODP
);
2067 utl::TempFile tempFile
;
2068 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2069 xDocShRef
->DoClose();
2071 xmlDocPtr pXmlDocContent1
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2072 assertXPath(pXmlDocContent1
, "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val", "ffff00");
2074 // Check that underlined content is also highlighted
2075 xmlDocPtr pXmlDocContent2
= parseExport(tempFile
, "ppt/slides/slide2.xml");
2076 assertXPath(pXmlDocContent2
, "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val", "ffff00");
2078 void SdOOXMLExportTest2::testTdf120573()
2080 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc( "sd/qa/unit/data/pptx/tdf120573.pptx" ), PPTX
);
2081 utl::TempFile tempFile
;
2082 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
, &tempFile
);
2084 xmlDocPtr pXmlDoc
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2085 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:audioFile", 1);
2086 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile", 0);
2088 xmlDocPtr pXmlDocRels
= parseExport(tempFile
, "ppt/slides/_rels/slide1.xml.rels");
2089 assertXPath(pXmlDocRels
,
2090 "(/rels:Relationships/rels:Relationship[@Target='../media/media1.wav'])[1]",
2092 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
2094 xmlDocPtr pXmlContentType
= parseExport(tempFile
, "[Content_Types].xml");
2095 assertXPath(pXmlContentType
,
2096 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.wav']",
2101 void SdOOXMLExportTest2::testTdf118825()
2103 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";
2105 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";
2107 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";
2109 const OUString sPath4
= "M 0.0535714285714286 -0.0444444444444444 L 0.132142857142857 -0.0444444444444444 L 0.132142857142857 -0.146031746031746 L 0.0964285714285715 -0.146031746031746 E";
2111 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/tdf118825-motionpath.odp"), ODP
);
2112 utl::TempFile tempFile
;
2113 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2114 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2117 CPPUNIT_ASSERT_MOTIONPATH(sPath1
, getXPath(pXmlDocContent
, "(//p:animMotion)[1]", "path"));
2118 CPPUNIT_ASSERT_MOTIONPATH(sPath2
, getXPath(pXmlDocContent
, "(//p:animMotion)[2]", "path"));
2119 CPPUNIT_ASSERT_MOTIONPATH(sPath3
, getXPath(pXmlDocContent
, "(//p:animMotion)[3]", "path"));
2120 CPPUNIT_ASSERT_MOTIONPATH(sPath4
, getXPath(pXmlDocContent
, "(//p:animMotion)[4]", "path"));
2121 xDocShRef
->DoClose();
2124 void SdOOXMLExportTest2::testTdf119118()
2126 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc( "sd/qa/unit/data/pptx/tdf119118.pptx" ), PPTX
);
2127 utl::TempFile tempFile
;
2128 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2129 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2130 assertXPath(pXmlDocContent
, "//p:iterate", "type", "lt");
2131 assertXPath(pXmlDocContent
, "//p:tmAbs", "val", "200");
2132 xDocShRef
->DoClose();
2135 void SdOOXMLExportTest2::testTdf99213()
2137 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc( "sd/qa/unit/data/odp/tdf99213-target-missing.odp" ), ODP
);
2138 utl::TempFile tempFile
;
2139 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2140 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2141 // Number of nodes with p:attrNameLst was 3, including one that missed tgtEl
2142 assertXPath(pXmlDocContent
, "//p:attrNameLst", 2);
2143 // Timenode that miss its target element should be filtered.
2144 assertXPath(pXmlDocContent
, "//p:attrNameLst/preceding-sibling::p:tgtEl", 2);
2145 xDocShRef
->DoClose();
2148 void SdOOXMLExportTest2::testPotxExport()
2150 // Create new document
2151 sd::DrawDocShellRef xDocShRef
2152 = new sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED
, false, DocumentType::Draw
);
2153 uno::Reference
<frame::XLoadable
> xLoadable(xDocShRef
->GetModel(), uno::UNO_QUERY
);
2154 CPPUNIT_ASSERT(xLoadable
.is());
2155 xLoadable
->initNew();
2157 // Export as a POTM template
2158 utl::TempFile tempFile
;
2159 xDocShRef
= saveAndReload(xDocShRef
.get(), POTX
, &tempFile
);
2160 xDocShRef
->DoClose();
2162 // Load and check content type
2163 xmlDocPtr pContentTypes
= parseExport(tempFile
, "[Content_Types].xml");
2164 CPPUNIT_ASSERT(pContentTypes
);
2165 assertXPath(pContentTypes
, "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
2166 "ContentType", "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml");
2169 void SdOOXMLExportTest2::testTdf44223()
2171 utl::TempFile tempFile
;
2172 ::sd::DrawDocShellRef xDocShRef
2173 = loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf44223.pptx"), PPTX
);
2174 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2176 std::shared_ptr
<SvStream
> const pStream1(parseExportStream(tempFile
, "ppt/media/audio1.wav"));
2177 CPPUNIT_ASSERT_EQUAL(sal_uInt64(11140), pStream1
->remainingSize());
2179 std::shared_ptr
<SvStream
> const pStream2(parseExportStream(tempFile
, "ppt/media/audio2.wav"));
2180 CPPUNIT_ASSERT_EQUAL(sal_uInt64(28074), pStream2
->remainingSize());
2182 xmlDocPtr pXmlContentType
= parseExport(tempFile
, "[Content_Types].xml");
2183 assertXPath(pXmlContentType
,
2184 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio1.wav']",
2188 assertXPath(pXmlContentType
,
2189 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio2.wav']",
2193 xmlDocPtr pDoc1
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2195 // Start condition: 0s after timenode id 5 begins.
2196 assertXPath(pDoc1
, "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt", "begin");
2197 assertXPath(pDoc1
, "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", "0");
2198 assertXPath(pDoc1
, "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond/p:tn", "val", "5");
2200 xmlDocPtr pDoc2
= parseExport(tempFile
, "ppt/slides/slide2.xml");
2201 assertXPath(pDoc2
, "//p:transition/p:sndAc/p:stSnd/p:snd[@r:embed]", 2);
2203 xmlDocPtr pRels1
= parseExport(tempFile
, "ppt/slides/_rels/slide1.xml.rels");
2204 assertXPath(pRels1
, "//rels:Relationship[@Id='rId1']", "Type",
2205 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
2206 assertXPath(pRels1
, "//rels:Relationship[@Id='rId1']", "Target", "../media/audio1.wav");
2208 xDocShRef
->DoClose();
2211 void SdOOXMLExportTest2::testSmartArtPreserve()
2213 ::sd::DrawDocShellRef xDocShRef
2214 = loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/smartart-preserve.pptx"), PPTX
);
2215 utl::TempFile tempFile
;
2216 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2218 xmlDocPtr pXmlDoc
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2219 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr");
2220 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/dgm:relIds");
2221 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext",
2222 "uri", "{D42A27DB-BD31-4B8C-83A1-F6EECF244321}");
2223 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext/p14:modId");
2225 xmlDocPtr pXmlDocRels
= parseExport(tempFile
, "ppt/slides/_rels/slide1.xml.rels");
2226 assertXPath(pXmlDocRels
,
2227 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/layout1.xml'])[1]", "Type",
2228 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout");
2229 assertXPath(pXmlDocRels
,
2230 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/data1.xml'])[1]", "Type",
2231 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData");
2232 assertXPath(pXmlDocRels
,
2233 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/colors1.xml'])[1]", "Type",
2234 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors");
2235 assertXPath(pXmlDocRels
,
2236 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/quickStyle1.xml'])[1]", "Type",
2237 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle");
2239 xmlDocPtr pXmlContentType
= parseExport(tempFile
, "[Content_Types].xml");
2240 assertXPath(pXmlContentType
,
2241 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/layout1.xml']",
2242 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml");
2243 assertXPath(pXmlContentType
,
2244 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/data1.xml']",
2245 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml");
2246 assertXPath(pXmlContentType
,
2247 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/colors1.xml']",
2248 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml");
2249 assertXPath(pXmlContentType
,
2250 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/quickStyle1.xml']",
2251 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml");
2253 xDocShRef
->DoClose();
2256 void SdOOXMLExportTest2::testTdf125346()
2258 // There are two themes in the test document, make sure we use the right theme
2259 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf125346.pptx"), PPTX
);
2260 utl::TempFile tempFile
;
2261 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2263 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
2264 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
, uno::UNO_SET_THROW
);
2266 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
2267 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
2268 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
2270 sal_Int32 nFillColor
;
2271 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
2272 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0x90C226), nFillColor
);
2274 xDocShRef
->DoClose();
2277 void SdOOXMLExportTest2::testTdf125346_2()
2279 // There are two themes in the test document, make sure we use the right theme
2280 // Test more slides with different themes
2281 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf125346_2.pptx"), PPTX
);
2282 utl::TempFile tempFile
;
2283 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2286 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
2287 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
, uno::UNO_SET_THROW
);
2289 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
2290 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
2291 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
2293 sal_Int32 nFillColor
;
2294 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
2295 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0x90C226), nFillColor
);
2299 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 1, xDocShRef
) );
2300 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
, uno::UNO_SET_THROW
);
2302 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
2303 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
2304 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
2306 sal_Int32 nFillColor
;
2307 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
2308 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0x052F61), nFillColor
);
2312 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 2, xDocShRef
) );
2313 uno::Reference
< beans::XPropertySet
> xPropSet( xShape
, uno::UNO_SET_THROW
);
2315 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
2316 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
2317 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
2319 sal_Int32 nFillColor
;
2320 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
2321 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(0x90C226), nFillColor
);
2324 xDocShRef
->DoClose();
2327 void SdOOXMLExportTest2::testTdf125360()
2329 // Check whether the changed fill transparency is exported correctly.
2330 // Color is defined by shape style
2331 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360.pptx"), PPTX
);
2333 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
2335 xShape
->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32
>(23)));
2337 utl::TempFile tempFile
;
2338 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2340 xShape
.set( getShapeFromPage( 0, 0, xDocShRef
) );
2342 sal_Int32 nTransparence
= 0;
2343 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
2344 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
2346 xDocShRef
->DoClose();
2349 void SdOOXMLExportTest2::testTdf125360_1()
2351 // Check whether the changed fill transparency is exported correctly.
2352 // Color is defined by color scheme
2353 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_1.pptx"), PPTX
);
2355 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
2357 xShape
->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32
>(23)));
2359 utl::TempFile tempFile
;
2360 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2362 xShape
.set( getShapeFromPage( 0, 0, xDocShRef
) );
2364 sal_Int32 nTransparence
= 0;
2365 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
2366 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
2368 xDocShRef
->DoClose();
2371 void SdOOXMLExportTest2::testTdf125360_2()
2373 // Check whether the changed fill transparency is exported correctly.
2374 // Color is defined by color scheme with a transparency
2375 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_2.pptx"), PPTX
);
2377 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
2379 sal_Int32 nTransparence
= 0;
2380 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
2381 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(82), nTransparence
);
2383 xShape
->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32
>(23)));
2385 utl::TempFile tempFile
;
2386 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2388 xShape
.set( getShapeFromPage( 0, 0, xDocShRef
) );
2391 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
2392 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
2394 xDocShRef
->DoClose();
2397 void SdOOXMLExportTest2::testTdf125551()
2399 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf125551.pptx"), PPTX
);
2400 utl::TempFile tempFile
;
2401 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2403 uno::Reference
<drawing::XShapes
> xGroupShape(getShapeFromPage(0, 0, xDocShRef
), uno::UNO_QUERY
);
2404 uno::Reference
<drawing::XShape
> xShapeBg(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
2406 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1024), xShapeBg
->getPosition().X
);
2407 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(576), xShapeBg
->getPosition().Y
);
2408 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(10815), xShapeBg
->getSize().Width
);
2409 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8587), xShapeBg
->getSize().Height
);
2412 void SdOOXMLExportTest2::testTdf100348_convert_Fontwork2TextWarp()
2414 ::sd::DrawDocShellRef xDocShRef
= loadURL(
2415 m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp"), ODP
);
2416 utl::TempFile tempFile
;
2417 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2419 // Resulting pptx has to contain the TextWarp shape
2420 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2421 const OString
sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp");
2422 assertXPath(pXmlDocContent
, sPathStart
+ "[@prst='textWave1']");
2423 const OString
sPathAdj(sPathStart
+ "/a:avLst/a:gd");
2424 assertXPath(pXmlDocContent
, sPathAdj
+ "[@name='adj1' and @fmla='val 18750']");
2425 assertXPath(pXmlDocContent
, sPathAdj
+ "[@name='adj2' and @fmla='val -7500']");
2427 // Reloading has to get the Fontwork shape back
2428 // TextPath makes a custom shape to a Fontwork shape, so must exist
2429 uno::Reference
<beans::XPropertySet
> xShapeWavePropSet(getShapeFromPage(0, 0, xDocShRef
));
2430 auto aGeomPropSeq
= xShapeWavePropSet
->getPropertyValue("CustomShapeGeometry")
2431 .get
<uno::Sequence
<beans::PropertyValue
>>();
2433 = comphelper::sequenceToContainer
<std::vector
<beans::PropertyValue
>>(aGeomPropSeq
);
2434 OUString sName
= "TextPath";
2435 auto aIterator
= std::find_if(
2436 aGeomPropVec
.begin(), aGeomPropVec
.end(),
2437 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
2438 CPPUNIT_ASSERT_MESSAGE("No TextPath", aIterator
!= aGeomPropVec
.end());
2440 // Type has to be same as in original document on roundtrip.
2442 auto aIterator2
= std::find_if(
2443 aGeomPropVec
.begin(), aGeomPropVec
.end(),
2444 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
2445 CPPUNIT_ASSERT_MESSAGE("No Type", aIterator2
!= aGeomPropVec
.end());
2447 aIterator2
->Value
>>= sOwnName
;
2448 CPPUNIT_ASSERT_EQUAL(OUString("fontwork-wave"), sOwnName
);
2450 // Adjustmentvalues need to be the same.
2451 sName
= "AdjustmentValues";
2452 auto aIterator3
= std::find_if(
2453 aGeomPropVec
.begin(), aGeomPropVec
.end(),
2454 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
2455 CPPUNIT_ASSERT_MESSAGE("No AdjustmentValues", aIterator3
!= aGeomPropVec
.end());
2456 uno::Sequence
<drawing::EnhancedCustomShapeAdjustmentValue
> aAdjValueSeq
;
2457 aIterator3
->Value
>>= aAdjValueSeq
;
2459 aAdjValueSeq
[0].Value
>>= fAdj1
;
2461 aAdjValueSeq
[1].Value
>>= fAdj2
;
2462 CPPUNIT_ASSERT_EQUAL(4050.0, fAdj1
); // odp values, not pptx values
2463 CPPUNIT_ASSERT_EQUAL(9180.0, fAdj2
);
2465 xDocShRef
->DoClose();
2468 void SdOOXMLExportTest2::testTdf1225573_FontWorkScaleX()
2470 const OUString
sPath("/sd/qa/unit/data/pptx/tdf125573_FontWorkScaleX.pptx");
2471 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc(sPath
), PPTX
);
2472 utl::TempFile tempFile
;
2473 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2475 // Error was, that attribute 'fromWordArt' was ignored
2476 // ensure, resulting pptx has fromWordArt="1" on textArchDown shape
2477 xmlDocPtr pXmlDocContent
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2478 const OString
sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr");
2479 assertXPath(pXmlDocContent
, sPathStart
+ "[@fromWordArt='1']");
2481 // Error was, that text in legacy shapes of category "Follow Path" was not scaled to the path.
2482 uno::Reference
<beans::XPropertySet
> xShapeArchProps(getShapeFromPage(0, 0, xDocShRef
));
2483 awt::Rectangle aBoundRectArch
;
2484 xShapeArchProps
->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT
) >>= aBoundRectArch
;
2485 // difference should be zero, but allow some range for stroke thickness
2486 CPPUNIT_ASSERT_LESS(static_cast<long>(50), labs(aBoundRectArch
.Width
- 13081));
2488 // Error was, that text in shapes of category "Warp" was not scaled to the path.
2489 uno::Reference
<beans::XPropertySet
> xShapeWaveProps(getShapeFromPage(0, 1, xDocShRef
));
2490 awt::Rectangle aBoundRectWave
;
2491 xShapeWaveProps
->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT
) >>= aBoundRectWave
;
2492 // difference should be zero, but allow some range for stroke thickness
2493 CPPUNIT_ASSERT_LESS(static_cast<long>(50), labs(aBoundRectWave
.Width
- 11514));
2495 xDocShRef
->DoClose();
2498 void SdOOXMLExportTest2::testTdf126234()
2500 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126234.pptx"), PPTX
);
2501 utl::TempFile tempFile
;
2502 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2504 // check relative size of the bullet, 400% is a legitimate value for MS Office document
2505 // Without a fix, it will fail to set the size correctly
2506 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
2507 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
2508 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
2509 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
2510 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
2511 CPPUNIT_ASSERT(pNumFmt
);
2512 CPPUNIT_ASSERT_EQUAL(sal_uInt16(400), pNumFmt
->GetNumRule()->GetLevel(0).GetBulletRelSize());
2514 xDocShRef
->DoClose();
2517 void SdOOXMLExportTest2::testTdf126741()
2519 sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf126741.pptx"), PPTX
);
2520 utl::TempFile tempFile
;
2521 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2523 // dash dot dot line style import fix
2524 // The original fixed values are replaced with the percent values, because
2525 // with fix for tdf#127166 the MS Office preset styles are correctly detected.
2526 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
2527 SdrObject
*const pObj
= pPage
->GetObj(0);
2528 CPPUNIT_ASSERT(pObj
);
2530 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
2531 pObj
->GetMergedItem(XATTR_LINESTYLE
));
2532 const XLineDashItem
& rDashItem
= dynamic_cast<const XLineDashItem
&>(
2533 pObj
->GetMergedItem(XATTR_LINEDASH
));
2535 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH
, rStyleItem
.GetValue());
2536 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem
.GetDashValue().GetDots());
2537 CPPUNIT_ASSERT_EQUAL(sal_uInt32(800), rDashItem
.GetDashValue().GetDotLen());
2538 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem
.GetDashValue().GetDashes());
2539 CPPUNIT_ASSERT_EQUAL(sal_uInt32(100), rDashItem
.GetDashValue().GetDashLen());
2540 CPPUNIT_ASSERT_EQUAL(sal_uInt32(300), rDashItem
.GetDashValue().GetDistance());
2542 xDocShRef
->DoClose();
2545 void SdOOXMLExportTest2::testTdf99497_keepAppearanceOfCircleKind()
2547 // Error was, that all CircleKind were exported to 'ellipse'.
2548 // Resulting pptx has to contain the customshapes of the corresponding kind
2549 // slide 1 ARC -> arc, slide 2 CUT -> chord, slide 3 SECTION -> pie
2550 // Adjustment values need to exist and their values need to correspond to the
2551 // original angles. Shape 'arc' needs to be unfilled.
2552 const OUString
sPath("/sd/qa/unit/data/odp/tdf99497_CircleKind.odp");
2553 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc(sPath
), ODP
);
2554 utl::TempFile tempFile
;
2555 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
2557 // slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> exists
2558 xmlDocPtr pXmlDocContent1
= parseExport(tempFile
, "ppt/slides/slide1.xml");
2559 const OString
sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
2560 assertXPath(pXmlDocContent1
, sPathStart1
+ "[@prst='arc']");
2561 const OString
sPathAdj1(sPathStart1
+ "/a:avLst/a:gd");
2562 assertXPath(pXmlDocContent1
, sPathAdj1
+ "[@name='adj1' and @fmla='val 20493903']");
2563 assertXPath(pXmlDocContent1
, sPathAdj1
+ "[@name='adj2' and @fmla='val 5400000']");
2564 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
2566 // slide 2 270° -> adj1 = 5400000, 180° -> adj2 = 10800000
2567 xmlDocPtr pXmlDocContent2
= parseExport(tempFile
, "ppt/slides/slide2.xml");
2568 const OString
sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
2569 assertXPath(pXmlDocContent2
, sPathStart2
+ "[@prst='chord']");
2570 const OString
sPathAdj2(sPathStart2
+ "/a:avLst/a:gd");
2571 assertXPath(pXmlDocContent2
, sPathAdj2
+ "[@name='adj1' and @fmla='val 5400000']");
2572 assertXPath(pXmlDocContent2
, sPathAdj2
+ "[@name='adj2' and @fmla='val 10800000']");
2574 // slide 3 120° -> adj1 = 12600000, 30° -> adj2 = 20946396
2575 xmlDocPtr pXmlDocContent3
= parseExport(tempFile
, "ppt/slides/slide3.xml");
2576 const OString
sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
2577 assertXPath(pXmlDocContent3
, sPathStart3
+ "[@prst='pie']");
2578 const OString
sPathAdj3(sPathStart3
+ "/a:avLst/a:gd");
2579 assertXPath(pXmlDocContent3
, sPathAdj3
+ "[@name='adj1' and @fmla='val 12600000']");
2580 assertXPath(pXmlDocContent3
, sPathAdj3
+ "[@name='adj2' and @fmla='val 20946396']");
2582 xDocShRef
->DoClose();
2585 void SdOOXMLExportTest2::testTdf127372()
2587 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf127372.odp"), ODP
);
2588 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
2589 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
2590 awt::Gradient aTransparenceGradient
;
2591 xShape
->getPropertyValue("FillTransparenceGradient") >>= aTransparenceGradient
;
2592 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aTransparenceGradient
.StartColor
);
2593 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aTransparenceGradient
.EndColor
);
2596 void SdOOXMLExportTest2::testTdf127379()
2598 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/tdf127379.odp"), ODP
);
2599 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
2600 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
2601 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
2602 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDoc
->getDrawPages()->getCount() );
2604 uno::Reference
< drawing::XDrawPage
> xPage( getPage( 0, xDocShRef
) );
2605 uno::Reference
< beans::XPropertySet
> xPropSet( xPage
, uno::UNO_QUERY
);
2607 uno::Any aAny
= xPropSet
->getPropertyValue( "Background" );
2608 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny
.hasValue());
2609 uno::Reference
< beans::XPropertySet
> aXBackgroundPropSet
;
2610 aAny
>>= aXBackgroundPropSet
;
2612 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
2613 aXBackgroundPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
2614 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, aFillStyle
);
2616 awt::Gradient aGradient
;
2617 CPPUNIT_ASSERT(aXBackgroundPropSet
->getPropertyValue("FillGradient") >>= aGradient
);
2618 CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFF0000), aGradient
.StartColor
);
2619 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x2A6099), aGradient
.EndColor
);
2622 void SdOOXMLExportTest2::testTdf98603()
2624 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/tdf98603.pptx"), PPTX
);
2625 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
2626 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0, xDocShRef
));
2627 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
2628 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
2629 uno::Reference
< beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
2630 css::lang::Locale aLocale
;
2631 xPropSet
->getPropertyValue("CharLocaleComplex") >>= aLocale
;
2632 CPPUNIT_ASSERT_EQUAL(OUString("he"), aLocale
.Language
);
2633 CPPUNIT_ASSERT_EQUAL(OUString("IL"), aLocale
.Country
);
2636 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2
);
2638 CPPUNIT_PLUGIN_IMPLEMENT();
2640 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */