1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include "sdmodeltestbase.hxx"
11 #include <comphelper/propertysequence.hxx>
12 #include <editeng/flditem.hxx>
14 #include <svx/svdomedia.hxx>
15 #include <svx/svdotable.hxx>
16 #include <svx/svdpage.hxx>
17 #include <docmodel/uno/UnoGradientTools.hxx>
19 #include <com/sun/star/animations/TransitionType.hpp>
20 #include <com/sun/star/animations/TransitionSubType.hpp>
21 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
22 #include <com/sun/star/drawing/FillStyle.hpp>
23 #include <com/sun/star/style/LineSpacing.hpp>
24 #include <com/sun/star/style/LineSpacingMode.hpp>
25 #include <com/sun/star/text/XTextColumns.hpp>
27 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
29 #include <rtl/character.hxx>
30 #include <o3tl/string_view.hxx>
33 using namespace css::animations
;
37 bool checkBeginWithNumber(std::u16string_view aStr
)
39 sal_Unicode aChar
= (aStr
.size() > 1) ? aStr
[0] : '\0';
40 return aChar
== '.' || aChar
== '-' || rtl::isAsciiDigit(aChar
);
44 #define CPPUNIT_ASSERT_MOTIONPATH(expect, actual) \
45 assertMotionPath(expect, actual, CPPUNIT_SOURCELINE())
47 static void assertMotionPath(std::u16string_view rStr1
, std::u16string_view rStr2
,
48 const CppUnit::SourceLine
& rSourceLine
)
54 = "Motion path values mismatch.\nExpect: " + OUStringToOString(rStr1
, RTL_TEXTENCODING_UTF8
)
55 + "\nActual: " + OUStringToOString(rStr2
, RTL_TEXTENCODING_UTF8
);
57 while (nIdx1
!= -1 && nIdx2
!= -1)
59 OUString
aToken1(o3tl::getToken(rStr1
, 0, ' ', nIdx1
));
60 OUString
aToken2(o3tl::getToken(rStr2
, 0, ' ', nIdx2
));
62 if (checkBeginWithNumber(aToken1
) && checkBeginWithNumber(aToken2
))
63 assertDoubleEquals(aToken1
.toDouble(), aToken2
.toDouble(), DBL_EPSILON
, rSourceLine
,
64 std::string(sMessage
));
66 assertEquals(aToken1
, aToken2
, rSourceLine
, std::string(sMessage
));
68 assertEquals(sal_Int32(-1), nIdx1
, rSourceLine
, std::string(sMessage
));
69 assertEquals(sal_Int32(-1), nIdx2
, rSourceLine
, std::string(sMessage
));
72 class SdOOXMLExportTest2
: public SdModelTestBase
76 : SdModelTestBase(u
"/sd/qa/unit/data/"_ustr
)
81 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testRepeatBitmapMode
)
83 // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
84 // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
87 createSdImpressDoc("odp/repeatBitmapMode.odp");
88 save(u
"Impress Office Open XML"_ustr
);
90 xmlDocUniquePtr pXmlDocContent1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
91 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "tx", u
"1269669");
92 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "ty", u
"186051");
93 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sx", u
"100000");
94 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sy", u
"100000");
95 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "algn", u
"tr");
97 // if the "Scale" setting is checked in the images settings dialog.
98 xmlDocUniquePtr pXmlDocContent2
= parseExport(u
"ppt/slides/slide2.xml"_ustr
);
99 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "tx", u
"0");
100 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "ty", u
"0");
101 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sx", u
"682760");
102 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "sy", u
"639983");
103 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:tile", "algn", u
"ctr");
106 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf153107
)
108 createSdImpressDoc("odp/tdf153107.odp");
109 save(u
"Impress Office Open XML"_ustr
);
112 xmlDocUniquePtr pXmlDocContent1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
113 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "tx",
115 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "ty",
117 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "sx",
119 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "sy",
121 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:blipFill/a:tile", "algn",
125 xmlDocUniquePtr pXmlDocContent2
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
126 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "tx",
128 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "ty",
130 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "sx",
132 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "sy",
134 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:blipFill/a:tile", "algn",
138 xmlDocUniquePtr pXmlDocContent3
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
139 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "tx",
141 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "ty",
143 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "sx",
145 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "sy",
147 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:blipFill/a:tile", "algn",
151 xmlDocUniquePtr pXmlDocContent4
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
152 assertXPath(pXmlDocContent4
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "tx",
154 assertXPath(pXmlDocContent4
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "ty",
156 assertXPath(pXmlDocContent4
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "sx",
158 assertXPath(pXmlDocContent4
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "sy",
160 assertXPath(pXmlDocContent4
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:blipFill/a:tile", "algn",
164 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf142291
)
166 createSdImpressDoc("pptx/tdt142291.pptx");
167 save(u
"Impress Office Open XML"_ustr
);
169 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
170 assertXPath(pXmlDocContent
,
171 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
172 "a:tcPr/a:lnL/a:prstDash",
173 "val", u
"sysDashDotDot");
174 assertXPath(pXmlDocContent
,
175 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
176 "a:tcPr/a:lnR/a:prstDash",
178 assertXPath(pXmlDocContent
,
179 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
180 "a:tcPr/a:lnT/a:prstDash",
182 assertXPath(pXmlDocContent
,
183 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
184 "a:tcPr/a:lnB/a:prstDash",
186 assertXPath(pXmlDocContent
,
187 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[2]/"
188 "a:tcPr/a:lnR/a:prstDash",
192 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf151492
)
194 createSdImpressDoc("odp/tdf151492.odp");
195 save(u
"Impress Office Open XML"_ustr
);
197 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
198 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn",
202 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf149697
)
204 createSdImpressDoc("pptx/tdf149697.pptx");
205 save(u
"Impress Office Open XML"_ustr
);
207 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
208 assertXPath(pXmlDocContent
,
209 "/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", u
"5");
210 assertXPath(pXmlDocContent
,
211 "/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", u
"4");
213 assertXPath(pXmlDocContent
,
214 "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", u
"3");
216 assertXPath(pXmlDocContent
,
217 "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", u
"1");
220 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf149126
)
222 createSdImpressDoc("odp/tdf149126.odp");
223 save(u
"Impress Office Open XML"_ustr
);
225 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
226 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst",
230 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf131905
)
232 createSdImpressDoc("pptx/tdf131905.pptx");
233 save(u
"Impress Office Open XML"_ustr
);
235 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
238 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[1]/a:tc/a:tcPr",
243 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[2]/a:tc/a:tcPr",
248 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[3]/a:tc/a:tcPr",
252 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf93883
)
254 createSdImpressDoc("odp/tdf93883.odp");
255 saveAndReload(u
"Impress Office Open XML"_ustr
);
256 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
257 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
258 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
, uno::UNO_QUERY_THROW
);
259 CPPUNIT_ASSERT(!xPropSet
->getPropertyValue(u
"NumberingLevel"_ustr
).hasValue());
262 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testBnc822341
)
264 // Check import / export of embedded text document
265 createSdImpressDoc("odp/bnc822341.odp");
266 save(u
"Impress Office Open XML"_ustr
);
268 // Export an LO specific ole object (imported from an ODP document)
270 xmlDocUniquePtr pXmlDocCT
= parseExport(u
"[Content_Types].xml"_ustr
);
271 assertXPath(pXmlDocCT
,
272 "/ContentType:Types/ContentType:Override[@ContentType='application/"
273 "vnd.openxmlformats-officedocument.wordprocessingml.document']",
274 "PartName", u
"/ppt/embeddings/oleObject1.docx");
276 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
279 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
280 "Type", u
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
282 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
283 assertXPath(pXmlDocContent
,
284 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
285 "progId", u
"Word.Document.12");
287 const SdrPage
* pPage
= GetPage(1);
289 const SdrObject
* pObj
= pPage
->GetObj(0);
290 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
291 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2
, pObj
->GetObjIdentifier());
294 save(u
"Impress Office Open XML"_ustr
);
296 // Export an MS specific ole object (imported from a PPTX document)
298 xmlDocUniquePtr pXmlDocCT
= parseExport(u
"[Content_Types].xml"_ustr
);
299 assertXPath(pXmlDocCT
,
300 "/ContentType:Types/ContentType:Override[@ContentType='application/"
301 "vnd.openxmlformats-officedocument.wordprocessingml.document']",
302 "PartName", u
"/ppt/embeddings/oleObject1.docx");
304 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
307 "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']",
308 "Type", u
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
310 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
311 assertXPath(pXmlDocContent
,
312 "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj",
313 "progId", u
"Word.Document.12");
315 const SdrPage
* pPage
= GetPage(1);
317 const SdrObject
* pObj
= pPage
->GetObj(0);
318 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
319 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2
, pObj
->GetObjIdentifier());
323 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testMathObject
)
325 // Check import / export of math object
326 createSdImpressDoc("odp/math.odp");
327 save(u
"Impress Office Open XML"_ustr
);
329 // Export an LO specific ole object (imported from an ODP document)
331 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
332 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
334 assertXPathContent(pXmlDocContent
,
335 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/"
336 "a14:m/m:oMath/m:r[1]/m:t",
339 const SdrPage
* pPage
= GetPage(1);
340 const SdrObject
* pObj
= pPage
->GetObj(0);
341 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
342 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2
, pObj
->GetObjIdentifier());
345 save(u
"Impress Office Open XML"_ustr
);
347 // Export an MS specific ole object (imported from a PPTX document)
349 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
350 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
352 assertXPathContent(pXmlDocContent
,
353 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/"
354 "a14:m/m:oMath/m:r[1]/m:t",
357 const SdrPage
* pPage
= GetPage(1);
358 const SdrObject
* pObj
= pPage
->GetObj(0);
359 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
360 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2
, pObj
->GetObjIdentifier());
364 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testMathExportNonBMP
)
366 // Check import / export of math object
367 createSdImpressDoc("odp/Math.fodp");
368 save(u
"Impress Office Open XML"_ustr
);
370 // Export an MS specific ole object
372 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
373 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice",
375 assertXPathContent(pXmlDocContent
,
376 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/"
377 "a14:m/m:oMath/m:sSup/m:e/m:r[1]/m:t",
378 u
"\U0001D44E"); // non-BMP char
380 const SdrPage
* pPage
= GetPage(1);
381 const SdrObject
* pObj
= pPage
->GetObj(0);
382 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
383 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2
, pObj
->GetObjIdentifier());
387 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf119015
)
389 createSdImpressDoc("pptx/tdf119015.pptx");
390 saveAndReload(u
"Impress Office Open XML"_ustr
);
392 const SdrPage
* pPage
= GetPage(1);
394 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
395 CPPUNIT_ASSERT(pTableObj
);
396 // The position was previously not properly initialized: (0, 0, 100, 100)
397 CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(6991, 6902), Size(14099, 2000)),
398 pTableObj
->GetLogicRect());
399 uno::Reference
<table::XTable
> xTable(pTableObj
->getTable());
401 // Test that we actually have three cells: this threw css.lang.IndexOutOfBoundsException
402 uno::Reference
<text::XTextRange
> xTextRange(xTable
->getCellByPosition(1, 0),
403 uno::UNO_QUERY_THROW
);
404 CPPUNIT_ASSERT_EQUAL(u
"A3"_ustr
, xTextRange
->getString());
407 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf123090
)
409 createSdImpressDoc("pptx/tdf123090.pptx");
410 saveAndReload(u
"Impress Office Open XML"_ustr
);
412 const SdrPage
* pPage
= GetPage(1);
414 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
415 CPPUNIT_ASSERT(pTableObj
);
417 uno::Reference
<table::XTable
> xTable(pTableObj
->getTable());
419 // Test that we actually have two cells: this threw css.lang.IndexOutOfBoundsException
420 uno::Reference
<text::XTextRange
> xTextRange(xTable
->getCellByPosition(1, 0),
421 uno::UNO_QUERY_THROW
);
422 CPPUNIT_ASSERT_EQUAL(u
"aaa"_ustr
, xTextRange
->getString());
425 uno::Reference
<css::table::XTableColumns
> xColumns(xTable
->getColumns(), uno::UNO_SET_THROW
);
426 uno::Reference
<beans::XPropertySet
> xRefColumn(xColumns
->getByIndex(1), uno::UNO_QUERY_THROW
);
427 xRefColumn
->getPropertyValue(u
"Width"_ustr
) >>= nWidth
;
428 CPPUNIT_ASSERT_EQUAL(sal_Int32(9136), nWidth
);
431 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf126324
)
433 createSdImpressDoc("pptx/tdf126324.pptx");
434 saveAndReload(u
"Impress Office Open XML"_ustr
);
435 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
436 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
437 CPPUNIT_ASSERT(xPage
.is());
438 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, xPage
));
439 CPPUNIT_ASSERT(xShape
.is());
440 uno::Reference
<text::XText
> xText
441 = uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY_THROW
)->getText();
442 CPPUNIT_ASSERT_EQUAL(u
"17"_ustr
, xText
->getString());
445 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf119187
)
448 createSdImpressDoc("pptx/tdf119187.pptx");
450 //Check For Import and Export Both
451 for (sal_uInt32 i
= 0; i
< 2; i
++)
453 // get shape properties
454 const SdrPage
* pPage
= GetPage(1);
455 CPPUNIT_ASSERT(pPage
);
456 SdrObject
* pObj
= pPage
->GetObj(0);
457 CPPUNIT_ASSERT(pObj
);
458 const sdr::properties::BaseProperties
& rProperties
= pObj
->GetProperties();
460 // check text vertical alignment
461 const SdrTextVertAdjustItem
& rSdrTextVertAdjustItem
462 = rProperties
.GetItem(SDRATTR_TEXT_VERTADJUST
);
463 const SdrTextVertAdjust eTVA
= rSdrTextVertAdjustItem
.GetValue();
464 CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_TOP
, eTVA
);
465 saveAndReload(u
"Impress Office Open XML"_ustr
);
469 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf132472
)
471 createSdImpressDoc("pptx/tdf132472.pptx");
472 const SdrPage
* pPage
= GetPage(1);
474 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
475 CPPUNIT_ASSERT(pTableObj
);
477 uno::Reference
<table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
478 uno::Reference
<beans::XPropertySet
> xCell
;
481 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
482 xCell
->getPropertyValue(u
"FillColor"_ustr
) >>= nColor
;
483 CPPUNIT_ASSERT_EQUAL(Color(0x729fcf), nColor
);
485 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xCell
));
486 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
487 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY
);
488 xPropSet
->getPropertyValue(u
"CharColor"_ustr
) >>= nColor
;
490 // Without the fix in place, this test would have failed with
491 // - Expected: Color: R:0 G:0 B:0 A:0
492 // - Actual : Color: R:255 G:255 B:255 A:0
493 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, nColor
);
496 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf80224
)
498 createSdImpressDoc("odp/tdf80224.odp");
499 saveAndReload(u
"Impress Office Open XML"_ustr
);
500 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
502 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
503 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
->getStart(), uno::UNO_QUERY_THROW
);
506 xPropSet
->getPropertyValue(u
"CharColor"_ustr
) >>= nCharColor
;
507 CPPUNIT_ASSERT_EQUAL(Color(0x6562ac), nCharColor
);
510 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf91378
)
512 //Check For Import and Export Both
513 createSdImpressDoc("pptx/tdf91378.pptx");
514 for (sal_uInt32 i
= 0; i
< 2; i
++)
516 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier(
517 mxComponent
, uno::UNO_QUERY
);
518 uno::Reference
<document::XDocumentProperties
> xProps
519 = xDocumentPropertiesSupplier
->getDocumentProperties();
520 uno::Reference
<beans::XPropertySet
> xUDProps(xProps
->getUserDefinedProperties(),
523 xUDProps
->getPropertyValue(u
"Testing"_ustr
) >>= propValue
;
524 CPPUNIT_ASSERT(propValue
.isEmpty());
525 saveAndReload(u
"Impress Office Open XML"_ustr
);
529 static bool checkTransitionOnPage(uno::Reference
<drawing::XDrawPagesSupplier
> const& xDoc
,
530 sal_Int32 nSlideNumber
, sal_Int16 nExpectedTransitionType
,
531 sal_Int16 nExpectedTransitionSubType
,
532 bool bExpectedDirection
= true)
534 sal_Int32 nSlideIndex
= nSlideNumber
- 1;
536 CPPUNIT_ASSERT_MESSAGE("Slide/Page index out of range",
537 nSlideIndex
< xDoc
->getDrawPages()->getCount());
539 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(nSlideIndex
),
540 uno::UNO_QUERY_THROW
);
541 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
543 sal_Int16 nTransitionType
= 0;
544 xPropSet
->getPropertyValue(u
"TransitionType"_ustr
) >>= nTransitionType
;
546 if (nExpectedTransitionType
!= nTransitionType
)
548 std::cerr
<< "Transition type: " << nTransitionType
<< " " << nExpectedTransitionType
553 sal_Int16 nTransitionSubtype
= 0;
554 xPropSet
->getPropertyValue(u
"TransitionSubtype"_ustr
) >>= nTransitionSubtype
;
555 if (nExpectedTransitionSubType
!= nTransitionSubtype
)
557 std::cerr
<< "Transition Subtype: " << nTransitionSubtype
<< " "
558 << nExpectedTransitionSubType
<< std::endl
;
562 bool bDirection
= false;
563 xPropSet
->getPropertyValue(u
"TransitionDirection"_ustr
) >>= bDirection
;
565 if (bExpectedDirection
!= bDirection
)
567 std::cerr
<< "Transition Direction: " << (bExpectedDirection
? "normal" : "reversed") << " "
568 << (bDirection
? "normal" : "reversed") << std::endl
;
575 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testExportTransitionsPPTX
)
577 createSdImpressDoc("AllTransitions.odp");
578 saveAndReload(u
"Impress Office Open XML"_ustr
);
579 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
582 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 01, TransitionType::BARWIPE
,
583 TransitionSubType::TOPTOBOTTOM
, false));
585 checkTransitionOnPage(xDoc
, 02, TransitionType::BARWIPE
, TransitionSubType::LEFTTORIGHT
));
586 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 03, TransitionType::BARWIPE
,
587 TransitionSubType::LEFTTORIGHT
, false));
589 checkTransitionOnPage(xDoc
, 04, TransitionType::BARWIPE
, TransitionSubType::TOPTOBOTTOM
));
593 checkTransitionOnPage(xDoc
, 31, TransitionType::BARWIPE
, TransitionSubType::FADEOVERCOLOR
));
596 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 41, TransitionType::PUSHWIPE
,
597 TransitionSubType::COMBHORIZONTAL
));
599 checkTransitionOnPage(xDoc
, 42, TransitionType::PUSHWIPE
, TransitionSubType::COMBVERTICAL
));
601 // OUTSIDE TURNING CUBE
602 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 57, TransitionType::MISCSHAPEWIPE
,
603 TransitionSubType::CORNERSOUT
));
604 // INSIDE TURNING CUBE
605 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 60, TransitionType::MISCSHAPEWIPE
,
606 TransitionSubType::CORNERSIN
));
609 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 61, TransitionType::MISCSHAPEWIPE
,
610 TransitionSubType::LEFTTORIGHT
));
613 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 70, TransitionType::MISCSHAPEWIPE
,
614 TransitionSubType::VERTICAL
));
617 CPPUNIT_ASSERT(checkTransitionOnPage(xDoc
, 71, TransitionType::MISCSHAPEWIPE
,
618 TransitionSubType::HORIZONTAL
));
622 checkTransitionOnPage(xDoc
, 72, TransitionType::MISCSHAPEWIPE
, TransitionSubType::DIAMOND
));
626 checkTransitionOnPage(xDoc
, 73, TransitionType::MISCSHAPEWIPE
, TransitionSubType::HEART
));
630 checkTransitionOnPage(xDoc
, 74, TransitionType::ZOOM
, TransitionSubType::ROTATEIN
));
632 // OVAL VERTICAL - cannot be exported to PPTX so fallback to circle
633 //CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 76, TransitionType::ELLIPSEWIPE, TransitionSubType::VERTICAL));
635 checkTransitionOnPage(xDoc
, 76, TransitionType::ELLIPSEWIPE
, TransitionSubType::CIRCLE
));
638 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testPresetShapesExport
)
640 createSdImpressDoc("odp/preset-shapes-export.odp");
641 const char* sShapeTypeAndValues
[] = {
642 "wedgeEllipseCallout",
647 "wedgeRoundRectCallout",
731 save(u
"Impress Office Open XML"_ustr
);
733 xmlDocUniquePtr pXmlDocCT
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
734 static constexpr OStringLiteral
sT("_T_");
735 static constexpr OStringLiteral
sN("_N_");
738 while (i
< SAL_N_ELEMENTS(sShapeTypeAndValues
))
740 OString
sType(sShapeTypeAndValues
[i
++]);
741 for (size_t j
= 1; i
< SAL_N_ELEMENTS(sShapeTypeAndValues
)
742 && o3tl::starts_with(sShapeTypeAndValues
[i
], "adj");
746 = "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]"_ostr
747 .replaceFirst(sT
, sType
)
748 .replaceFirst(sN
, OString::number(j
));
749 assertXPath(pXmlDocCT
, sXPath
, "name",
750 OUString::createFromAscii(sShapeTypeAndValues
[i
++]));
751 assertXPath(pXmlDocCT
, sXPath
, "fmla",
752 OUString::createFromAscii(sShapeTypeAndValues
[i
++]));
757 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf92527
)
759 // We draw a diamond in an empty document.
760 // If custom shape has name and preset information in OOXML, should be export as preset shape.
761 createSdImpressDoc("empty.fodp");
762 uno::Reference
<drawing::XDrawPage
> xPage1(getPage(0));
763 uno::Reference
<css::lang::XMultiServiceFactory
> xFactory(mxComponent
, uno::UNO_QUERY
);
764 uno::Reference
<drawing::XShape
> xShape1(
765 xFactory
->createInstance(u
"com.sun.star.drawing.CustomShape"_ustr
), uno::UNO_QUERY
);
766 xPage1
->add(xShape1
);
767 xShape1
->setSize(awt::Size(10000, 10000));
768 xShape1
->setPosition(awt::Point(1000, 1000));
769 uno::Sequence
<beans::PropertyValue
> aShapeGeometry(comphelper::InitPropertySequence({
770 { "Type", uno::Any(u
"diamond"_ustr
) },
772 uno::Reference
<beans::XPropertySet
> xPropertySet1(xShape1
, uno::UNO_QUERY
);
773 xPropertySet1
->setPropertyValue(u
"CustomShapeGeometry"_ustr
, uno::Any(aShapeGeometry
));
775 saveAndReload(u
"Impress Office Open XML"_ustr
);
777 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc2(mxComponent
, uno::UNO_QUERY_THROW
);
778 uno::Reference
<drawing::XDrawPage
> xPage2(xDoc2
->getDrawPages()->getByIndex(0),
779 uno::UNO_QUERY_THROW
);
780 uno::Reference
<drawing::XShape
> xShape2(xPage2
->getByIndex(0), uno::UNO_QUERY_THROW
);
781 uno::Reference
<beans::XPropertySet
> xPropertySet2(xShape2
, uno::UNO_QUERY_THROW
);
782 uno::Sequence
<beans::PropertyValue
> aProps
;
783 xPropertySet2
->getPropertyValue(u
"CustomShapeGeometry"_ustr
) >>= aProps
;
784 uno::Sequence
<beans::PropertyValue
> aPathProps
;
785 for (beans::PropertyValue
const& rProp
: aProps
)
787 if (rProp
.Name
== "Path")
788 aPathProps
= rProp
.Value
.get
<uno::Sequence
<beans::PropertyValue
>>();
790 uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
> aCoordinates
;
791 for (beans::PropertyValue
const& rProp
: aPathProps
)
793 if (rProp
.Name
== "Coordinates")
795 = rProp
.Value
.get
<uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
>>();
798 // 4 coordinate pairs
799 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCoordinates
.getLength());
804 void matchNumberFormat(int nPage
, uno::Reference
<text::XTextField
> const& xField
)
806 uno::Reference
<beans::XPropertySet
> xPropSet(xField
, uno::UNO_QUERY_THROW
);
808 xPropSet
->getPropertyValue(u
"NumberFormat"_ustr
) >>= nNumFmt
;
811 case 0: // 13/02/96 (StdSmall)
812 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
813 sal_Int32(SvxDateFormat::StdSmall
), nNumFmt
);
815 case 1: // 13/02/1996
816 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
817 sal_Int32(SvxDateFormat::B
), nNumFmt
);
819 case 2: // Tuesday, June 29, 2021 (StdBig)
820 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
821 sal_Int32(SvxDateFormat::StdBig
), nNumFmt
);
823 case 3: // 13:49:38 (Standard)
824 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
825 sal_Int32(SvxTimeFormat::Standard
), nNumFmt
);
828 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
829 sal_Int32(SvxTimeFormat::HH24_MM
), nNumFmt
);
832 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
833 sal_Int32(SvxTimeFormat::HH12_MM
), nNumFmt
);
835 case 6: // 01:49:38 PM
836 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Time fields don't match",
837 sal_Int32(SvxTimeFormat::HH12_MM_SS
), nNumFmt
);
839 case 7: // June 29, 2021
840 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
841 sal_Int32(SvxDateFormat::D
), nNumFmt
);
843 case 8: // Jun 29, 2021
844 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number formats of Date fields don't match",
845 sal_Int32(SvxDateFormat::C
), nNumFmt
);
851 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testDatetimeFieldNumberFormat
)
853 createSdImpressDoc("odp/numfmt.odp");
855 saveAndReload(u
"Impress Office Open XML"_ustr
);
857 for (sal_uInt16 i
= 0; i
<= 8; ++i
)
859 matchNumberFormat(i
, getTextFieldFromPage(0, 0, 0, i
));
863 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testDatetimeFieldNumberFormatPPTX
)
865 createSdImpressDoc("pptx/numfmt.pptx");
867 saveAndReload(u
"Impress Office Open XML"_ustr
);
869 for (sal_uInt16 i
= 0; i
<= 8; ++i
)
871 matchNumberFormat(i
, getTextFieldFromPage(0, 0, 0, i
));
875 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testSlideNumberField
)
877 createSdImpressDoc("odp/slidenum_field.odp");
879 saveAndReload(u
"Impress Office Open XML"_ustr
);
881 uno::Reference
<text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0);
882 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
885 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testSlideNumberFieldPPTX
)
887 createSdImpressDoc("pptx/slidenum_field.pptx");
889 saveAndReload(u
"Impress Office Open XML"_ustr
);
891 uno::Reference
<text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0);
892 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
895 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testSlideCountField
)
897 createSdImpressDoc("odp/slidecount_field.odp");
899 saveAndReload(u
"Impress Office Open XML"_ustr
);
901 uno::Reference
<text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0);
902 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
905 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testSlideNameField
)
907 createSdImpressDoc("odp/slidename_field.odp");
909 saveAndReload(u
"Impress Office Open XML"_ustr
);
911 uno::Reference
<text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0);
912 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
915 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testExtFileField
)
917 createSdImpressDoc("odp/extfile_field.odp");
919 saveAndReload(u
"Impress Office Open XML"_ustr
);
921 for (sal_uInt16 i
= 0; i
<= 3; ++i
)
923 uno::Reference
<text::XTextField
> xField
= getTextFieldFromPage(0, 0, i
, 0);
924 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
926 uno::Reference
<beans::XPropertySet
> xPropSet(xField
, uno::UNO_QUERY_THROW
);
928 xPropSet
->getPropertyValue(u
"FileFormat"_ustr
) >>= nNumFmt
;
931 case 0: // Path/File name
932 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(0), nNumFmt
);
935 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(1), nNumFmt
);
937 case 2: // File name without extension
938 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(2), nNumFmt
);
940 case 3: // File name with extension
941 CPPUNIT_ASSERT_EQUAL_MESSAGE("File formats don't match", sal_Int32(3), nNumFmt
);
946 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testAuthorField
)
948 createSdImpressDoc("odp/author_field.odp");
950 saveAndReload(u
"Impress Office Open XML"_ustr
);
952 uno::Reference
<text::XTextField
> xField
= getTextFieldFromPage(0, 0, 0, 0);
953 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
956 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf99224
)
958 createSdImpressDoc("odp/tdf99224.odp");
959 saveAndReload(u
"Impress Office Open XML"_ustr
);
960 uno::Reference
<drawing::XDrawPage
> xPage
= getPage(0);
961 // This was 0: the image with text was lost on export.
962 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1), xPage
->getCount());
965 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf92076
)
967 createSdImpressDoc("odp/tdf92076.odp");
968 saveAndReload(u
"Impress Office Open XML"_ustr
);
969 uno::Reference
<drawing::XDrawPage
> xPage
= getPage(0);
970 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2), xPage
->getCount());
973 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf59046
)
975 createSdImpressDoc("odp/tdf59046.odp");
976 save(u
"Impress Office Open XML"_ustr
);
977 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
978 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
981 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf133502
)
983 createSdImpressDoc("odp/tdf133502.odp");
984 save(u
"Impress Office Open XML"_ustr
);
985 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/comments/comment1.xml"_ustr
);
987 assertXPathContent(pXmlDocRels
, "/p:cmLst/p:cm/p:text", u
"Test for creator-initials");
989 // Without the fix in place, the comment position would have been 0,0
990 assertXPath(pXmlDocRels
, "/p:cmLst/p:cm/p:pos", "x", u
"2032");
991 assertXPath(pXmlDocRels
, "/p:cmLst/p:cm/p:pos", "y", u
"1029");
994 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf105739
)
996 // Gradient was lost during saving to ODP
997 createSdImpressDoc("pptx/tdf105739.pptx");
998 save(u
"impress8"_ustr
);
999 uno::Reference
<drawing::XDrawPage
> xPage
= getPage(0);
1000 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
1001 uno::Any aAny
= xPropSet
->getPropertyValue(u
"Background"_ustr
);
1002 CPPUNIT_ASSERT(aAny
.hasValue());
1003 if (aAny
.hasValue())
1005 uno::Reference
<beans::XPropertySet
> aXBackgroundPropSet
;
1006 aAny
>>= aXBackgroundPropSet
;
1009 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
1010 aXBackgroundPropSet
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
1011 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_GRADIENT
), static_cast<int>(aFillStyle
));
1013 // Test gradient properties
1014 css::awt::Gradient2 aFillGradient
;
1015 aXBackgroundPropSet
->getPropertyValue(u
"FillGradient"_ustr
) >>= aFillGradient
;
1017 // MCGR: Use the completely imported gradient to check for correctness
1018 const basegfx::BColorStops aColorStops
1019 = model::gradient::getColorStopsFromUno(aFillGradient
.ColorStops
);
1021 CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops
.size());
1022 CPPUNIT_ASSERT_EQUAL(0.0, aColorStops
[0].getStopOffset());
1023 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED
, Color(aColorStops
[0].getStopColor()));
1024 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 1.0));
1025 CPPUNIT_ASSERT_EQUAL(Color(0x00b050), Color(aColorStops
[1].getStopColor()));
1026 CPPUNIT_ASSERT_EQUAL(int(awt::GradientStyle_LINEAR
), static_cast<int>(aFillGradient
.Style
));
1030 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testPageBitmapWithTransparency
)
1032 createSdImpressDoc("pptx/page_transparent_bitmap.pptx");
1034 saveAndReload(u
"impress8"_ustr
);
1035 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
1036 CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one page", static_cast<sal_Int32
>(1),
1037 xDoc
->getDrawPages()->getCount());
1039 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1041 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
1042 uno::Any aAny
= xPropSet
->getPropertyValue(u
"Background"_ustr
);
1043 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny
.hasValue());
1045 uno::Reference
<beans::XPropertySet
> aXBackgroundPropSet
;
1046 aAny
>>= aXBackgroundPropSet
;
1047 sal_Int32 nTransparence
;
1048 aAny
= aXBackgroundPropSet
->getPropertyValue(u
"FillTransparence"_ustr
);
1049 aAny
>>= nTransparence
;
1050 CPPUNIT_ASSERT_EQUAL_MESSAGE("Slide background transparency is wrong", sal_Int32(49),
1054 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testPptmContentType
)
1056 createSdImpressDoc("pptm/macro.pptm");
1057 save(u
"Impress MS PowerPoint 2007 XML VBA"_ustr
);
1059 // Assert that the content type is the one of PPTM
1060 xmlDocUniquePtr pXmlContentType
= parseExport(u
"[Content_Types].xml"_ustr
);
1061 assertXPath(pXmlContentType
,
1062 "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
1063 "ContentType", u
"application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");
1066 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf111798
)
1068 createSdImpressDoc("odp/tdf111798.odp");
1069 save(u
"Impress Office Open XML"_ustr
);
1070 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1072 const std::u16string_view data
[][11]
1073 = { { u
"2700000", u
"2458080", u
"2414880", u
"1439640", u
"1440000", u
"gd[1]", u
"adj1",
1074 u
"val 50000", u
"gd[2]", u
"adj2", u
"val 25000" },
1075 { u
"2700000", u
"6778080", u
"2414880", u
"1439640", u
"1440000", u
"gd[1]", u
"adj1",
1076 u
"val 50000", u
"gd[2]", u
"adj2", u
"val 25006" } };
1078 for (size_t nShapeIndex
= 0; nShapeIndex
< SAL_N_ELEMENTS(data
); nShapeIndex
++)
1080 size_t nDataIndex
= 0;
1083 = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex
+ 1) + "]/p:spPr";
1084 const OString sXfrm
= sSpPr
+ "/a:xfrm";
1085 assertXPath(pXmlDoc
, sXfrm
, "rot", data
[nShapeIndex
][nDataIndex
++]);
1086 const OString sOff
= sXfrm
+ "/a:off";
1087 assertXPath(pXmlDoc
, sOff
, "x", data
[nShapeIndex
][nDataIndex
++]);
1088 assertXPath(pXmlDoc
, sOff
, "y", data
[nShapeIndex
][nDataIndex
++]);
1089 const OString sExt
= sXfrm
+ "/a:ext";
1090 assertXPath(pXmlDoc
, sExt
, "cx", data
[nShapeIndex
][nDataIndex
++]);
1091 assertXPath(pXmlDoc
, sExt
, "cy", data
[nShapeIndex
][nDataIndex
++]);
1093 while (nDataIndex
< SAL_N_ELEMENTS(data
[nShapeIndex
]))
1096 = sSpPr
+ "/a:prstGeom/a:avLst/a:"
1097 + OUStringToOString(data
[nShapeIndex
][nDataIndex
++], RTL_TEXTENCODING_UTF8
);
1098 assertXPath(pXmlDoc
, sGd
, "name", data
[nShapeIndex
][nDataIndex
++]);
1099 assertXPath(pXmlDoc
, sGd
, "fmla", data
[nShapeIndex
][nDataIndex
++]);
1104 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testPptmVBAStream
)
1106 createSdImpressDoc("pptm/macro.pptm");
1107 save(u
"Impress MS PowerPoint 2007 XML VBA"_ustr
);
1109 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
1110 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
),
1111 maTempFile
.GetURL());
1112 // This failed: VBA stream was not roundtripped
1113 CPPUNIT_ASSERT(xNameAccess
->hasByName(u
"ppt/vbaProject.bin"_ustr
));
1116 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf111863
)
1118 createSdImpressDoc("pptx/tdf111863.pptx");
1119 save(u
"Impress Office Open XML"_ustr
);
1121 // check that transition attribute didn't change from 'out' to 'in'
1122 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1123 assertXPath(pXmlDocContent
,
1124 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
1125 "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect",
1126 "transition", u
"out");
1129 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf111518
)
1131 createSdImpressDoc("pptx/tdf111518.pptx");
1132 save(u
"Impress Office Open XML"_ustr
);
1134 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1135 OUString sActual
= getXPath(pXmlDocRels
,
1136 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1137 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1138 "p:par/p:cTn/p:childTnLst/p:animMotion",
1140 CPPUNIT_ASSERT_MOTIONPATH(u
"M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E", sActual
);
1143 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf100387
)
1145 createSdImpressDoc("odp/tdf100387.odp");
1146 save(u
"Impress Office Open XML"_ustr
);
1147 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1149 assertXPath(pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn",
1150 "dur", u
"indefinite");
1153 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]/p:cTn",
1155 assertXPath(pXmlDocContent
,
1156 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1157 "p:par[1]/p:cTn/p:childTnLst/p:par/p:cTn",
1160 assertXPath(pXmlDocContent
,
1161 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1162 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1163 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1165 assertXPath(pXmlDocContent
,
1166 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]"
1167 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1168 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1171 assertXPath(pXmlDocContent
,
1172 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1173 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1174 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1176 assertXPath(pXmlDocContent
,
1177 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]"
1178 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1179 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1182 assertXPath(pXmlDocContent
,
1183 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1184 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1185 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1187 assertXPath(pXmlDocContent
,
1188 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[3]"
1189 "/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/"
1190 "p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg",
1194 // tdf#126746 Add support for Line Caps import and export
1195 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testClosingShapesAndLineCaps
)
1197 createSdImpressDoc("odp/closed-shapes.odp");
1198 save(u
"Impress Office Open XML"_ustr
);
1199 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1200 assertXPath(pXmlDocContent
,
1201 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt",
1203 assertXPath(pXmlDocContent
,
1204 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt",
1206 assertXPath(pXmlDocContent
,
1207 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[2]/a:pt",
1209 assertXPath(pXmlDocContent
,
1210 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 1);
1211 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln", "cap", u
"rnd");
1212 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln/a:miter", 1);
1214 assertXPath(pXmlDocContent
,
1215 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1216 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln", "cap", u
"rnd");
1217 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln/a:miter", 1);
1219 assertXPath(pXmlDocContent
,
1220 "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1221 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln", "cap", u
"rnd");
1222 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln/a:miter", 1);
1224 assertXPath(pXmlDocContent
,
1225 "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1226 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln", "cap", u
"sq");
1227 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln/a:round", 1);
1229 assertXPath(pXmlDocContent
,
1230 "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1231 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln",
1232 "cap"); // by default it is "flat" cap style
1233 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln/a:bevel", 1);
1235 assertXPath(pXmlDocContent
,
1236 "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
1237 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln",
1238 "cap"); // by default it is "flat" cap style
1239 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:ln/a:round", 1);
1242 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testRotateFlip
)
1244 createSdImpressDoc("odp/rotate_flip.odp");
1245 save(u
"Impress Office Open XML"_ustr
);
1246 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1248 const std::u16string_view data
[][4] = { // flipH flipV x y
1249 { u
"0", u
"1", u
"1170000", u
"1035720" },
1250 { u
"1", u
"1", u
"7108560", u
"1036440" },
1251 { u
"1", u
"0", u
"4140000", u
"1036440" }
1254 const std::u16string_view points
[][2]
1255 = { { u
"221", u
"293" }, { u
"506", u
"12" }, { u
"367", u
"0" }, { u
"29", u
"406" },
1256 { u
"431", u
"347" }, { u
"145", u
"645" }, { u
"99", u
"520" }, { u
"0", u
"861" },
1257 { u
"326", u
"765" }, { u
"209", u
"711" }, { u
"640", u
"233" }, { u
"640", u
"233" } };
1259 for (size_t nShapeIndex
= 0; nShapeIndex
< SAL_N_ELEMENTS(data
); nShapeIndex
++)
1261 size_t nDataIndex
= 0;
1264 = "/p:sld/p:cSld/p:spTree/p:sp[" + OString::number(nShapeIndex
+ 1) + "]/p:spPr";
1265 const OString sXfrm
= sSpPr
+ "/a:xfrm";
1266 if (data
[nShapeIndex
][nDataIndex
++] == u
"1")
1267 assertXPath(pXmlDocContent
, sXfrm
, "flipH", u
"1");
1268 if (data
[nShapeIndex
][nDataIndex
++] == u
"1")
1269 assertXPath(pXmlDocContent
, sXfrm
, "flipV", u
"1");
1270 assertXPath(pXmlDocContent
, sXfrm
, "rot", u
"20400000");
1271 const OString sOff
= sXfrm
+ "/a:off";
1272 assertXPath(pXmlDocContent
, sOff
, "x", data
[nShapeIndex
][nDataIndex
++]);
1273 assertXPath(pXmlDocContent
, sOff
, "y", data
[nShapeIndex
][nDataIndex
++]);
1274 const OString sExt
= sXfrm
+ "/a:ext";
1275 assertXPath(pXmlDocContent
, sExt
, "cx", u
"1800000");
1276 assertXPath(pXmlDocContent
, sExt
, "cy", u
"3600000");
1278 for (size_t nPointIndex
= 0; nPointIndex
< SAL_N_ELEMENTS(points
); nPointIndex
++)
1280 const OString sPt
= sSpPr
+ "/a:custGeom/a:pathLst/a:path/a:lnTo["
1281 + OString::number(nPointIndex
+ 1) + "]/a:pt";
1282 assertXPath(pXmlDocContent
, sPt
, "x", points
[nPointIndex
][0]);
1283 assertXPath(pXmlDocContent
, sPt
, "y", points
[nPointIndex
][1]);
1285 assertXPath(pXmlDocContent
, sSpPr
+ "/a:custGeom/a:pathLst/a:path/a:close", 1);
1289 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf106867
)
1291 createSdImpressDoc("pptx/tdf106867.pptx");
1292 save(u
"Impress Office Open XML"_ustr
);
1294 const SdrPage
* pPage
= GetPage(1);
1296 // first check that we have the media object
1297 const SdrMediaObj
* pMediaObj
= dynamic_cast<SdrMediaObj
*>(pPage
->GetObj(2));
1298 CPPUNIT_ASSERT_MESSAGE("no media object", pMediaObj
!= nullptr);
1299 CPPUNIT_ASSERT_EQUAL(u
"vnd.sun.star.Package:ppt/media/media1.avi"_ustr
, pMediaObj
->getURL());
1301 // additional checks of the output file
1302 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
1303 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
),
1304 maTempFile
.GetURL());
1305 // check that the document contains the video stream
1306 CPPUNIT_ASSERT(xNameAccess
->hasByName(u
"ppt/media/media1.avi"_ustr
));
1308 // both the ooxml and the extended markup
1309 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1310 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile");
1311 assertXPath(pXmlDocContent
,
1312 "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media");
1314 // target the shape with the video in the command
1315 assertXPath(pXmlDocContent
,
1316 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
1317 "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/"
1318 "p:cBhvr/p:tgtEl/p:spTgt",
1322 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112280
)
1324 createSdImpressDoc("pptx/tdf112280.pptx");
1325 save(u
"Impress Office Open XML"_ustr
);
1327 // check the animRot value
1328 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1329 assertXPath(pXmlDocContent
,
1330 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
1331 "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animRot",
1335 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112088
)
1337 createSdImpressDoc("pptx/tdf112088.pptx");
1338 save(u
"Impress Office Open XML"_ustr
);
1340 // check gradient stops
1341 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1342 assertXPathChildren(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst",
1346 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112333
)
1348 createSdImpressDoc("pptx/tdf112333.pptx");
1349 save(u
"Impress Office Open XML"_ustr
);
1351 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1353 OUString sTo
= getXPath(pXmlDocContent
,
1354 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1355 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/"
1356 "p:cTn/p:childTnLst/p:set[1]/p:to/p:strVal",
1358 CPPUNIT_ASSERT_EQUAL(u
"solid"_ustr
, sTo
);
1360 OUString sAttributeName
= getXPathContent(
1361 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1362 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1363 "p:childTnLst/p:set[1]/p:cBhvr/p:attrNameLst/p:attrName");
1364 CPPUNIT_ASSERT_EQUAL(u
"fill.type"_ustr
, sAttributeName
);
1366 sTo
= getXPath(pXmlDocContent
,
1367 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1368 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1369 "p:set[2]/p:to/p:strVal",
1371 CPPUNIT_ASSERT_EQUAL(u
"true"_ustr
, sTo
);
1373 sAttributeName
= getXPathContent(
1374 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1375 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1376 "p:childTnLst/p:set[2]/p:cBhvr/p:attrNameLst/p:attrName");
1377 CPPUNIT_ASSERT_EQUAL(u
"fill.on"_ustr
, sAttributeName
);
1379 sTo
= getXPath(pXmlDocContent
,
1380 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1381 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1382 "p:animClr/p:to/a:srgbClr",
1384 CPPUNIT_ASSERT_EQUAL(u
"0563c1"_ustr
, sTo
);
1386 sAttributeName
= getXPathContent(
1387 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1388 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1389 "p:childTnLst/p:animClr/p:cBhvr/p:attrNameLst/p:attrName");
1390 CPPUNIT_ASSERT_EQUAL(u
"fillcolor"_ustr
, sAttributeName
);
1393 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112552
)
1395 // Background fill was not displayed, but it was because of the wrong geometry
1396 createSdImpressDoc("odp/tdf112552.odp");
1397 save(u
"Impress Office Open XML"_ustr
);
1399 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1400 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path",
1402 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path",
1404 assertXPath(pXmlDocContent
,
1405 "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt",
1407 assertXPath(pXmlDocContent
,
1408 "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt",
1412 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112557
)
1414 // Subtitle shape should be skipped by export.
1415 createSdImpressDoc("odp/tdf112557.odp");
1416 save(u
"Impress Office Open XML"_ustr
);
1418 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slideMasters/slideMaster1.xml"_ustr
);
1419 assertXPath(pXmlDocContent
, "/p:sldMaster/p:cSld/p:spTree/p:sp", 2); // title and object
1422 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf128049
)
1424 createSdImpressDoc("odp/tdf128049.odp");
1425 save(u
"Impress Office Open XML"_ustr
);
1427 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1428 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom", 0);
1429 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom", "prst",
1431 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom/a:avLst/a:gd",
1433 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom/a:avLst/a:gd",
1434 "fmla", u
"val 12500");
1437 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf106026
)
1439 createSdImpressDoc("odp/tdf106026.odp");
1440 save(u
"Impress Office Open XML"_ustr
);
1442 xmlDocUniquePtr pXmlMasterContent
= parseExport(u
"ppt/slideMasters/slideMaster1.xml"_ustr
);
1443 assertXPath(pXmlMasterContent
,
1444 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr/a:spcBef/a:spcPts", "val",
1446 assertXPath(pXmlMasterContent
,
1447 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:spcBef/a:spcPts", "val",
1449 assertXPath(pXmlMasterContent
,
1450 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[3]/a:pPr/a:spcBef/a:spcPts", "val",
1452 assertXPath(pXmlMasterContent
,
1453 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[4]/a:pPr/a:spcBef/a:spcPts", "val",
1455 assertXPath(pXmlMasterContent
,
1456 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[5]/a:pPr/a:spcBef/a:spcPts", "val",
1458 assertXPath(pXmlMasterContent
,
1459 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[6]/a:pPr/a:spcBef/a:spcPts", "val",
1461 assertXPath(pXmlMasterContent
,
1462 "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[7]/a:pPr/a:spcBef/a:spcPts", "val",
1465 xmlDocUniquePtr pXmlSlideContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1466 assertXPath(pXmlSlideContent
,
1467 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:spcAft/a:spcPts", "val",
1469 assertXPath(pXmlSlideContent
,
1470 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:spcAft/a:spcPts", "val",
1472 assertXPath(pXmlSlideContent
,
1473 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:spcAft/a:spcPts", "val",
1477 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112334
)
1479 createSdImpressDoc("pptx/tdf112334.pptx");
1480 save(u
"Impress Office Open XML"_ustr
);
1482 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1484 OUString sAttributeName
= getXPathContent(
1485 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1486 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1487 "p:childTnLst/p:animClr[1]/p:cBhvr/p:attrNameLst/p:attrName");
1488 CPPUNIT_ASSERT_EQUAL(u
"style.color"_ustr
, sAttributeName
);
1491 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112089
)
1493 createSdImpressDoc("pptx/tdf112089.pptx");
1494 save(u
"Impress Office Open XML"_ustr
);
1496 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1498 OUString sID
= getXPath(
1499 pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
1500 OUString sTarget
= getXPath(pXmlDocContent
,
1501 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1502 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1503 "p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt",
1505 CPPUNIT_ASSERT_EQUAL(sID
, sTarget
);
1508 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112086
)
1510 createSdImpressDoc("pptx/tdf112086.pptx");
1511 save(u
"Impress Office Open XML"_ustr
);
1513 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1515 OUString sVal
= getXPath(pXmlDocContent
,
1516 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1517 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/"
1518 "p:cTn/p:childTnLst/p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal",
1520 CPPUNIT_ASSERT_EQUAL(u
"0"_ustr
, sVal
);
1522 OUString sAttributeName
= getXPathContent(
1523 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1524 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1525 "p:childTnLst/p:anim[1]/p:cBhvr/p:attrNameLst/p:attrName");
1526 CPPUNIT_ASSERT_EQUAL(u
"ppt_w"_ustr
, sAttributeName
);
1528 sVal
= getXPath(pXmlDocContent
,
1529 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1530 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1531 "p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal",
1533 CPPUNIT_ASSERT_EQUAL(u
"0"_ustr
, sVal
);
1535 sAttributeName
= getXPathContent(
1536 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1537 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1538 "p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
1539 CPPUNIT_ASSERT_EQUAL(u
"ppt_h"_ustr
, sAttributeName
);
1542 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf112647
)
1544 createSdImpressDoc("odp/tdf112647.odp");
1545 saveAndReload(u
"Impress Office Open XML"_ustr
);
1546 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1547 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xShape
));
1548 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
, uno::UNO_QUERY_THROW
);
1550 css::style::LineSpacing aLineSpacing
;
1551 xPropSet
->getPropertyValue(u
"ParaLineSpacing"_ustr
) >>= aLineSpacing
;
1552 CPPUNIT_ASSERT_EQUAL(sal_Int16(css::style::LineSpacingMode::FIX
), aLineSpacing
.Mode
);
1553 CPPUNIT_ASSERT_EQUAL(sal_Int16(2117), aLineSpacing
.Height
);
1556 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testGroupRotation
)
1558 createSdImpressDoc("odp/group_rotation.odp");
1559 save(u
"Impress Office Open XML"_ustr
);
1561 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1562 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm",
1564 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot",
1566 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot",
1570 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf104788
)
1572 createSdImpressDoc("pptx/tdf104788.pptx");
1573 save(u
"Impress Office Open XML"_ustr
);
1575 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide6.xml"_ustr
);
1577 OUString sVal
= getXPath(pXmlDocContent
,
1578 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1579 "p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/"
1580 "p:par/p:cTn/p:childTnLst/p:anim[2]",
1582 CPPUNIT_ASSERT_EQUAL(-1.0, sVal
.toDouble());
1584 OUString sAttributeName
= getXPathContent(
1585 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
1586 "p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
1587 "p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
1588 CPPUNIT_ASSERT_EQUAL(u
"xshear"_ustr
, sAttributeName
);
1591 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testSmartartRotation2
)
1593 createSdImpressDoc("pptx/smartart-rotation2.pptx");
1595 // clear SmartArt data to check how group shapes with double-rotated children are exported, not smartart
1596 // NOTE: Resetting the GrabBag data is a *very* indirect way to reset the SmartArt functionality.
1597 // Since this worked before and there is not (yet?) a better way to do it using UNO API, I added
1598 // code to support this for now
1599 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1600 uno::Sequence
<beans::PropertyValue
> aInteropGrabBag
;
1601 xShape
->setPropertyValue(u
"InteropGrabBag"_ustr
, uno::Any(aInteropGrabBag
));
1603 save(u
"Impress Office Open XML"_ustr
);
1605 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1606 assertXPathContent(pXmlDocContent
,
1607 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", u
"Text");
1608 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot",
1610 double dX
= getXPath(pXmlDocContent
,
1611 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "x")
1613 double dY
= getXPath(pXmlDocContent
,
1614 "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "y")
1616 CPPUNIT_ASSERT_DOUBLES_EQUAL(2276280.0, dX
, dX
* .001);
1617 CPPUNIT_ASSERT_DOUBLES_EQUAL(3158280.0, dY
, dY
* .001);
1620 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf91999_rotateShape
)
1622 createSdImpressDoc("pptx/tdf91999_rotateShape.pptx");
1623 save(u
"Impress Office Open XML"_ustr
);
1625 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1626 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name",
1628 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", u
"10800000");
1629 double dX
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "x")
1631 double dY
= getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "y")
1633 CPPUNIT_ASSERT_DOUBLES_EQUAL(2960640.0, dX
, dX
* .001);
1634 CPPUNIT_ASSERT_DOUBLES_EQUAL(1449000.0, dY
, dY
* .001);
1637 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf114845_rotateShape
)
1639 createSdImpressDoc("pptx/tdf114845_rotateShape.pptx");
1640 save(u
"Impress Office Open XML"_ustr
);
1642 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1643 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:nvCxnSpPr/p:cNvPr", "name",
1644 u
"Straight Arrow Connector 9");
1645 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm", "flipV", u
"1");
1647 = getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm/a:off", "x")
1650 = getXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:xfrm/a:off", "y")
1652 CPPUNIT_ASSERT_DOUBLES_EQUAL(4059000.0, dX
, dX
* .001);
1653 CPPUNIT_ASSERT_DOUBLES_EQUAL(3287520.0, dY
, dY
* .001);
1656 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testGroupsPosition
)
1658 createSdImpressDoc("pptx/group.pptx");
1659 save(u
"Impress Office Open XML"_ustr
);
1661 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1662 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off",
1664 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off",
1666 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off",
1668 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off",
1672 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testGroupsRotatedPosition
)
1674 createSdImpressDoc("pptx/group-rot.pptx");
1675 save(u
"Impress Office Open XML"_ustr
);
1677 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1678 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x",
1680 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y",
1684 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testAccentColor
)
1686 createSdImpressDoc("pptx/accent-color.pptx");
1687 save(u
"Impress Office Open XML"_ustr
);
1689 xmlDocUniquePtr pXmlDocContent1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1690 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val",
1692 xmlDocUniquePtr pXmlDocContent2
= parseExport(u
"ppt/slides/slide2.xml"_ustr
);
1693 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val",
1695 xmlDocUniquePtr pXmlDocTheme1
= parseExport(u
"ppt/theme/theme1.xml"_ustr
);
1696 assertXPath(pXmlDocTheme1
, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
1698 xmlDocUniquePtr pXmlDocTheme2
= parseExport(u
"ppt/theme/theme12.xml"_ustr
);
1699 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
1702 // Without the accompanying fix in place, this test would have failed with:
1703 // - Expected: Motyw pakietu Office
1704 // - Actual : Office Theme
1705 // i.e. the theme and color scheme name was lost on export.
1706 assertXPath(pXmlDocTheme1
, "/a:theme", "name", u
"Motyw pakietu Office");
1707 assertXPath(pXmlDocTheme1
, "/a:theme/a:themeElements/a:clrScheme", "name", u
"Pakiet Office");
1710 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testThemeColors
)
1712 createSdImpressDoc("pptx/tdf84205.pptx");
1713 save(u
"Impress Office Open XML"_ustr
);
1715 xmlDocUniquePtr pXmlDocTheme2
= parseExport(u
"ppt/theme/theme1.xml"_ustr
);
1716 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
1718 assertXPath(pXmlDocTheme2
, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val",
1722 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf111785
)
1724 createSdImpressDoc("odp/tdf111785.odp");
1725 save(u
"Impress Office Open XML"_ustr
);
1727 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1729 // Without the fix in place, this test would have failed with
1730 // - Expected: ed1c24
1731 // - Actual : ffffff
1732 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:pattFill/a:bgClr/a:srgbClr",
1736 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf118825
)
1738 createSdImpressDoc("odp/tdf118825-motionpath.odp");
1739 save(u
"Impress Office Open XML"_ustr
);
1740 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1742 CPPUNIT_ASSERT_MOTIONPATH(
1743 u
"M 0.0449285714285714 0.00368253968253968 C 0.0575714285714285 -0.00095238095238096 "
1744 u
"0.0704264795523803 -0.00370117418637049 0.0831071428571428 -0.00819047619047622 C "
1745 u
"0.0953550597998766 -0.0125265741339082 0.107821870086751 -0.010397536991717 "
1746 u
"0.120321428571429 -0.0115555555555556 C 0.133179018681433 -0.0127467438724762 "
1747 u
"0.151318627483861 -0.0158700272533852 0.1585 0.00539682539682542 C 0.16478291361998 "
1748 u
"0.0240029898688431 0.15828642886492 0.0483806254341085 0.161392857142857 "
1749 u
"0.0698412698412698 C 0.165179286017685 0.0959996731216037 0.17453898927982 "
1750 u
"0.119735912694626 0.187142857142857 0.132634920634921 C 0.199788991845377 "
1751 u
"0.145577185161529 0.215607110490848 0.142889773028431 0.230107142857143 "
1752 u
"0.142857142857143 C 0.243821417584191 0.142826280916829 0.257716514999779 "
1753 u
"0.142685979556724 0.271142857142857 0.137777777777778 C 0.286895094567923 "
1754 u
"0.132019309914514 0.302318190711873 0.122962218306185 0.317928571428571 0.11568253968254 "
1755 u
"C 0.333496771884548 0.108422531222479 0.348787823719556 0.0990570571890929 "
1756 u
"0.363714285714286 0.0885079365079364 C 0.374930683062651 0.080580865157908 "
1757 u
"0.385357142857143 0.0693333333333332 0.396178571428571 0.0596825396825396 L "
1758 u
"0.404785714285714 0.0410158730158729 L 0.401892857142857 0.0342222222222221 E",
1759 getXPath(pXmlDocContent
, "(//p:animMotion)[1]", "path"));
1760 CPPUNIT_ASSERT_MOTIONPATH(u
"M 0.025 0.0571428571428571 L 0.0821428571428571 0.184126984126984 "
1761 u
"L -0.175 0.234920634920635 L -0.246428571428571 "
1762 u
"-0.0190476190476191 L -0.0821428571428573 -0.133333333333333 E",
1763 getXPath(pXmlDocContent
, "(//p:animMotion)[2]", "path"));
1764 CPPUNIT_ASSERT_MOTIONPATH(
1765 u
"M -0.0107142857142857 0.00634920634920635 C -0.110714285714286 0.501587301587301 "
1766 u
"-0.153571428571429 -0.00634920634920635 -0.246428571428572 0.184126984126984 C "
1767 u
"-0.339285714285715 0.374603174603175 -0.296428571428572 0.514285714285714 "
1768 u
"-0.267857142857143 0.603174603174603 C -0.239285714285715 0.692063492063492 "
1769 u
"0.0607142857142858 0.590476190476191 0.0607142857142858 0.590476190476191 E",
1770 getXPath(pXmlDocContent
, "(//p:animMotion)[3]", "path"));
1771 CPPUNIT_ASSERT_MOTIONPATH(u
"M 0.0535714285714286 -0.0444444444444444 L 0.132142857142857 "
1772 u
"-0.0444444444444444 L 0.132142857142857 -0.146031746031746 L "
1773 u
"0.0964285714285715 -0.146031746031746 E",
1774 getXPath(pXmlDocContent
, "(//p:animMotion)[4]", "path"));
1777 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTextColumns_tdf140852
)
1779 // The document defines two columns in slideLayout12.xml, but explicitly redefines
1780 // in slide1.xml. Here we check that the redefinition in the slide takes precedence.
1782 createSdImpressDoc("pptx/tdf140852.pptx");
1784 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1785 uno::Reference
<container::XIndexAccess
> xIndexAccess(xPage
, uno::UNO_QUERY_THROW
);
1786 uno::Reference
<drawing::XShape
> xShape(xIndexAccess
->getByIndex(0), uno::UNO_QUERY_THROW
);
1787 uno::Reference
<beans::XPropertySet
> xProps(xShape
, uno::UNO_QUERY_THROW
);
1788 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xProps
));
1789 CPPUNIT_ASSERT_EQUAL(u
"Training will be treated as part of sharing the sweet when "
1790 "it comes to serving ice cream"_ustr
,
1791 xParagraph
->getString());
1792 uno::Reference
<text::XTextColumns
> xCols(xProps
->getPropertyValue(u
"TextColumns"_ustr
),
1793 uno::UNO_QUERY_THROW
);
1794 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCols
->getColumnCount());
1795 uno::Reference
<beans::XPropertySet
> xColProps(xCols
, uno::UNO_QUERY_THROW
);
1796 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(1000)),
1797 xColProps
->getPropertyValue(u
"AutomaticDistance"_ustr
));
1799 save(u
"Impress Office Open XML"_ustr
);
1802 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1803 uno::Reference
<container::XIndexAccess
> xIndexAccess(xPage
, uno::UNO_QUERY_THROW
);
1804 uno::Reference
<drawing::XShape
> xShape(xIndexAccess
->getByIndex(0), uno::UNO_QUERY_THROW
);
1805 uno::Reference
<beans::XPropertySet
> xProps(xShape
, uno::UNO_QUERY_THROW
);
1806 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xProps
));
1807 CPPUNIT_ASSERT_EQUAL(u
"Training will be treated as part of sharing the sweet when "
1808 "it comes to serving ice cream"_ustr
,
1809 xParagraph
->getString());
1810 uno::Reference
<text::XTextColumns
> xCols(xProps
->getPropertyValue(u
"TextColumns"_ustr
),
1811 uno::UNO_QUERY_THROW
);
1812 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCols
->getColumnCount());
1813 uno::Reference
<beans::XPropertySet
> xColProps(xCols
, uno::UNO_QUERY_THROW
);
1814 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(1000)),
1815 xColProps
->getPropertyValue(u
"AutomaticDistance"_ustr
));
1818 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1819 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "numCol", u
"1");
1820 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "spcCol",
1824 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTextColumns_3columns
)
1826 createSdImpressDoc("pptx/3columns.pptx");
1828 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1829 uno::Reference
<container::XIndexAccess
> xIndexAccess(xPage
, uno::UNO_QUERY_THROW
);
1830 uno::Reference
<drawing::XShape
> xShape(xIndexAccess
->getByIndex(0), uno::UNO_QUERY_THROW
);
1831 uno::Reference
<beans::XPropertySet
> xProps(xShape
, uno::UNO_QUERY_THROW
);
1832 uno::Reference
<text::XTextColumns
> xCols(xProps
->getPropertyValue(u
"TextColumns"_ustr
),
1833 uno::UNO_QUERY_THROW
);
1834 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCols
->getColumnCount());
1835 uno::Reference
<beans::XPropertySet
> xColProps(xCols
, uno::UNO_QUERY_THROW
);
1836 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(300)),
1837 xColProps
->getPropertyValue(u
"AutomaticDistance"_ustr
));
1838 // Scale value may be unstable; just test that the text is actually scaled
1840 CPPUNIT_ASSERT(xProps
->getPropertyValue(u
"TextFitToSizeFontScale"_ustr
) >>= fFontScale
);
1841 CPPUNIT_ASSERT_GREATER(0.0, fFontScale
);
1842 CPPUNIT_ASSERT_LESS(100.0, fFontScale
);
1845 save(u
"Impress Office Open XML"_ustr
);
1848 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1849 uno::Reference
<container::XIndexAccess
> xIndexAccess(xPage
, uno::UNO_QUERY_THROW
);
1850 uno::Reference
<drawing::XShape
> xShape(xIndexAccess
->getByIndex(0), uno::UNO_QUERY_THROW
);
1851 uno::Reference
<beans::XPropertySet
> xProps(xShape
, uno::UNO_QUERY_THROW
);
1852 uno::Reference
<text::XTextColumns
> xCols(xProps
->getPropertyValue(u
"TextColumns"_ustr
),
1853 uno::UNO_QUERY_THROW
);
1854 CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCols
->getColumnCount());
1855 uno::Reference
<beans::XPropertySet
> xColProps(xCols
, uno::UNO_QUERY_THROW
);
1856 CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(300)),
1857 xColProps
->getPropertyValue(u
"AutomaticDistance"_ustr
));
1858 // Scale value may be unstable; just test that the text is actually scaled
1860 CPPUNIT_ASSERT(xProps
->getPropertyValue(u
"TextFitToSizeFontScale"_ustr
) >>= fFontScale
);
1861 CPPUNIT_ASSERT_GREATER(0.0, fFontScale
);
1862 CPPUNIT_ASSERT_LESS(100.0, fFontScale
);
1865 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1866 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "numCol", u
"3");
1867 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "spcCol",
1871 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf59323_slideFooters
)
1873 createSdImpressDoc("pptx/tdf59323.pptx");
1875 save(u
"Impress Office Open XML"_ustr
);
1877 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
1878 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDoc
->getDrawPages()->getCount());
1880 for (int nPageIndex
= 0; nPageIndex
< 3; nPageIndex
++)
1882 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1883 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
1884 CPPUNIT_ASSERT_EQUAL(true, xPropSet
->getPropertyValue(u
"IsFooterVisible"_ustr
).get
<bool>());
1885 CPPUNIT_ASSERT_EQUAL(true,
1886 xPropSet
->getPropertyValue(u
"IsDateTimeVisible"_ustr
).get
<bool>());
1887 CPPUNIT_ASSERT_EQUAL(true,
1888 xPropSet
->getPropertyValue(u
"IsPageNumberVisible"_ustr
).get
<bool>());
1891 // Test placeholder indexes
1892 xmlDocUniquePtr pXmlDocMaster
= parseExport(u
"ppt/slideMasters/slideMaster1.xml"_ustr
);
1893 assertXPath(pXmlDocMaster
, "//p:ph [@type='dt']", "idx", u
"1");
1894 assertXPath(pXmlDocMaster
, "//p:ph [@type='ftr']", "idx", u
"2");
1895 assertXPath(pXmlDocMaster
, "//p:ph [@type='sldNum']", "idx", u
"3");
1897 xmlDocUniquePtr pXmlDocSlide1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1898 assertXPath(pXmlDocSlide1
, "//p:ph [@type='dt']", "idx", u
"1");
1899 assertXPath(pXmlDocSlide1
, "//p:ph [@type='ftr']", "idx", u
"2");
1900 assertXPath(pXmlDocSlide1
, "//p:ph [@type='sldNum']", "idx", u
"3");
1902 // Test if datetime fields have text in them
1903 // This is needed for backwards compatibility
1904 assertXPath(pXmlDocSlide1
, "//a:fld [@type='datetime1']/a:t");
1906 // tdf#143316: Without the fix in place, this test would have failed with
1909 assertXPath(pXmlDocSlide1
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:fld/a:rPr");
1912 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2
, testTdf53970
)
1914 // Embedded media file
1916 createSdImpressDoc("odp/tdf53970.odp");
1917 saveAndReload(u
"Impress Office Open XML"_ustr
);
1919 // Without fix in place, the media shape was lost on export.
1920 CPPUNIT_ASSERT(getPage(0)->hasElements());
1923 // Linked media file
1925 createSdImpressDoc("odp/tdf53970_linked.odp");
1926 save(u
"Impress Office Open XML"_ustr
);
1928 xmlDocUniquePtr pXmlRels
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
1929 CPPUNIT_ASSERT(pXmlRels
);
1930 assertXPath(pXmlRels
, "/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);
1932 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, getPage(0)));
1933 CPPUNIT_ASSERT(xShape
.is());
1936 // Without fix in place, the media shape was imported as an image after export
1937 // and this test would have failed with exception of type com.sun.star.beans.UnknownPropertyException
1938 CPPUNIT_ASSERT_MESSAGE("MediaURL property is not set",
1939 xShape
->getPropertyValue(u
"MediaURL"_ustr
) >>= sVideoURL
);
1940 CPPUNIT_ASSERT_MESSAGE("MediaURL is empty", !sVideoURL
.isEmpty());
1944 CPPUNIT_PLUGIN_IMPLEMENT();
1946 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */