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 <tools/color.hxx>
12 #include <comphelper/sequenceashashmap.hxx>
13 #include <editeng/eeitem.hxx>
14 #include <editeng/editobj.hxx>
15 #include <editeng/numitem.hxx>
16 #include <docmodel/uno/UnoGradientTools.hxx>
17 #include <officecfg/Office/Common.hxx>
19 #include <svx/xlineit0.hxx>
20 #include <svx/xlndsit.hxx>
21 #include <svx/svdoole2.hxx>
22 #include <svx/svdotable.hxx>
24 #include <com/sun/star/awt/FontUnderline.hpp>
25 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
26 #include <com/sun/star/drawing/FillStyle.hpp>
27 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28 #include <com/sun/star/lang/Locale.hpp>
29 #include <com/sun/star/text/GraphicCrop.hpp>
30 #include <com/sun/star/text/WritingMode2.hpp>
34 class SdOOXMLExportTest4
: public SdModelTestBase
38 : SdModelTestBase(u
"/sd/qa/unit/data/"_ustr
)
43 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf160591
)
45 createSdImpressDoc("pptx/tdf160591.pptx");
46 save(u
"Impress Office Open XML"_ustr
);
49 xmlDocUniquePtr pXmlDoc1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
51 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val",
54 // Master slide ColorMap
55 xmlDocUniquePtr pXmlDoc2
= parseExport(u
"ppt/slideMasters/slideMaster1.xml"_ustr
);
56 assertXPath(pXmlDoc2
, "/p:sldMaster/p:clrMap", "bg1", u
"dk1");
57 assertXPath(pXmlDoc2
, "/p:sldMaster/p:clrMap", "tx1", u
"lt1");
58 assertXPath(pXmlDoc2
, "/p:sldMaster/p:clrMap", "bg2", u
"dk2");
59 assertXPath(pXmlDoc2
, "/p:sldMaster/p:clrMap", "tx2", u
"lt2");
61 // Master slide background
62 assertXPath(pXmlDoc2
, "/p:sldMaster/p:cSld/p:bg/p:bgPr/a:solidFill/a:schemeClr", "val", u
"dk1");
65 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testSmartArtPreserve
)
67 createSdImpressDoc("pptx/smartart-preserve.pptx");
68 save(u
"Impress Office Open XML"_ustr
);
70 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
71 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr");
73 "//p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/dgm:relIds");
75 "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext",
76 "uri", u
"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}");
77 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/"
78 "p:extLst/p:ext/p14:modId");
80 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
83 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/layout1.xml'])[1]", "Type",
84 u
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout");
86 pXmlDocRels
, "(/rels:Relationships/rels:Relationship[@Target='../diagrams/data1.xml'])[1]",
87 "Type", u
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData");
90 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/colors1.xml'])[1]", "Type",
91 u
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors");
94 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/quickStyle1.xml'])[1]", "Type",
95 u
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle");
97 xmlDocUniquePtr pXmlContentType
= parseExport(u
"[Content_Types].xml"_ustr
);
98 assertXPath(pXmlContentType
,
99 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/layout1.xml']",
101 u
"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml");
102 assertXPath(pXmlContentType
,
103 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/data1.xml']",
105 u
"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml");
106 assertXPath(pXmlContentType
,
107 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/colors1.xml']",
109 u
"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml");
112 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/quickStyle1.xml']",
113 "ContentType", u
"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml");
116 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125346
)
118 // There are two themes in the test document, make sure we use the right theme
120 createSdImpressDoc("pptx/tdf125346.pptx");
121 save(u
"Impress Office Open XML"_ustr
);
123 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
124 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
126 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
127 xPropSet
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
128 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
131 xPropSet
->getPropertyValue(u
"FillColor"_ustr
) >>= nFillColor
;
132 CPPUNIT_ASSERT_EQUAL(Color(0x90C226), nFillColor
);
135 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125346_2
)
137 // There are two themes in the test document, make sure we use the right theme
138 // Test more slides with different themes
140 createSdImpressDoc("pptx/tdf125346_2.pptx");
141 save(u
"Impress Office Open XML"_ustr
);
144 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
145 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
147 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
148 xPropSet
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
149 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
152 xPropSet
->getPropertyValue(u
"FillColor"_ustr
) >>= nFillColor
;
153 CPPUNIT_ASSERT_EQUAL(Color(0x90C226), nFillColor
);
157 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 1));
158 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
160 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
161 xPropSet
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
162 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
165 xPropSet
->getPropertyValue(u
"FillColor"_ustr
) >>= nFillColor
;
166 CPPUNIT_ASSERT_EQUAL(Color(0x052F61), nFillColor
);
170 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 2));
171 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
173 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
174 xPropSet
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
175 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
178 xPropSet
->getPropertyValue(u
"FillColor"_ustr
) >>= nFillColor
;
179 CPPUNIT_ASSERT_EQUAL(Color(0x90C226), nFillColor
);
183 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125360
)
185 // Check whether the changed fill transparency is exported correctly.
186 // Color is defined by shape style
188 createSdImpressDoc("pptx/tdf125360.pptx");
190 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
192 xShape
->setPropertyValue(u
"FillTransparence"_ustr
, uno::Any(static_cast<sal_Int32
>(23)));
194 save(u
"Impress Office Open XML"_ustr
);
196 xShape
.set(getShapeFromPage(0, 0));
198 sal_Int32 nTransparence
= 0;
199 xShape
->getPropertyValue(u
"FillTransparence"_ustr
) >>= nTransparence
;
200 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
203 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125360_1
)
205 // Check whether the changed fill transparency is exported correctly.
206 // Color is defined by color scheme
208 createSdImpressDoc("pptx/tdf125360_1.pptx");
210 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
212 xShape
->setPropertyValue(u
"FillTransparence"_ustr
, uno::Any(static_cast<sal_Int32
>(23)));
214 save(u
"Impress Office Open XML"_ustr
);
216 xShape
.set(getShapeFromPage(0, 0));
218 sal_Int32 nTransparence
= 0;
219 xShape
->getPropertyValue(u
"FillTransparence"_ustr
) >>= nTransparence
;
220 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
223 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125360_2
)
225 // Check whether the changed fill transparency is exported correctly.
226 // Color is defined by color scheme with a transparency
228 createSdImpressDoc("pptx/tdf125360_2.pptx");
230 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
232 sal_Int32 nTransparence
= 0;
233 xShape
->getPropertyValue(u
"FillTransparence"_ustr
) >>= nTransparence
;
234 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(82), nTransparence
);
236 xShape
->setPropertyValue(u
"FillTransparence"_ustr
, uno::Any(static_cast<sal_Int32
>(23)));
238 save(u
"Impress Office Open XML"_ustr
);
240 xShape
.set(getShapeFromPage(0, 0));
243 xShape
->getPropertyValue(u
"FillTransparence"_ustr
) >>= nTransparence
;
244 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
247 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125551
)
249 createSdImpressDoc("pptx/tdf125551.pptx");
250 save(u
"Impress Office Open XML"_ustr
);
252 uno::Reference
<drawing::XShapes
> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY
);
253 uno::Reference
<drawing::XShape
> xShapeBg(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
255 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1024), xShapeBg
->getPosition().X
);
256 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(576), xShapeBg
->getPosition().Y
);
257 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(10816), xShapeBg
->getSize().Width
);
258 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8588), xShapeBg
->getSize().Height
);
261 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf136830
)
263 createSdImpressDoc("pptx/tdf136830.pptx");
264 save(u
"Impress Office Open XML"_ustr
);
266 // Without the fix in place, the X position of the shapes would have been 0
267 uno::Reference
<drawing::XShapes
> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY
);
269 uno::Reference
<drawing::XShape
> xShape1(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
270 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(14134), xShape1
->getPosition().X
);
271 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(-5321), xShape1
->getPosition().Y
);
273 uno::Reference
<drawing::XShape
> xShape2(xGroupShape
->getByIndex(1), uno::UNO_QUERY
);
274 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8085), xShape2
->getPosition().X
);
275 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8085), xShape2
->getPosition().Y
);
277 uno::Reference
<drawing::XShape
> xShape3(xGroupShape
->getByIndex(2), uno::UNO_QUERY
);
278 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8283), xShape3
->getPosition().X
);
279 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(4620), xShape3
->getPosition().Y
);
282 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf126234
)
284 createSdImpressDoc("pptx/tdf126234.pptx");
285 save(u
"Impress Office Open XML"_ustr
);
287 // check relative size of the bullet, 400% is a legitimate value for MS Office document
288 // Without a fix, it will fail to set the size correctly
289 const SdrPage
* pPage
= GetPage(1);
290 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pPage
->GetObj(0));
291 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
292 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
293 const SvxNumBulletItem
* pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
294 CPPUNIT_ASSERT(pNumFmt
);
295 CPPUNIT_ASSERT_EQUAL(sal_uInt16(400), pNumFmt
->GetNumRule().GetLevel(0).GetBulletRelSize());
298 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf126741
)
300 createSdImpressDoc("pptx/tdf126741.pptx");
301 save(u
"Impress Office Open XML"_ustr
);
303 // dash dot dot line style import fix
304 // The original fixed values are replaced with the percent values, because
305 // with fix for tdf#127166 the MS Office preset styles are correctly detected.
306 const SdrPage
* pPage
= GetPage(1);
307 SdrObject
* const pObj
= pPage
->GetObj(0);
308 CPPUNIT_ASSERT(pObj
);
310 const XLineStyleItem
& rStyleItem
= pObj
->GetMergedItem(XATTR_LINESTYLE
);
311 const XLineDashItem
& rDashItem
= pObj
->GetMergedItem(XATTR_LINEDASH
);
313 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH
, rStyleItem
.GetValue());
314 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem
.GetDashValue().GetDots());
315 CPPUNIT_ASSERT_EQUAL(800.0, rDashItem
.GetDashValue().GetDotLen());
316 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem
.GetDashValue().GetDashes());
317 CPPUNIT_ASSERT_EQUAL(100.0, rDashItem
.GetDashValue().GetDashLen());
318 CPPUNIT_ASSERT_EQUAL(300.0, rDashItem
.GetDashValue().GetDistance());
321 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf127372
)
323 createSdImpressDoc("odp/tdf127372.odp");
324 saveAndReload(u
"Impress Office Open XML"_ustr
);
325 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
326 awt::Gradient2 aTransparenceGradient
;
327 xShape
->getPropertyValue(u
"FillTransparenceGradient"_ustr
) >>= aTransparenceGradient
;
329 // MCGR: Use the completely imported gradient to check for correctness
330 const basegfx::BColorStops aColorStops
331 = model::gradient::getColorStopsFromUno(aTransparenceGradient
.ColorStops
);
333 CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops
.size());
334 CPPUNIT_ASSERT_EQUAL(0.0, aColorStops
[0].getStopOffset());
335 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(aColorStops
[0].getStopColor()));
336 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 1.0));
337 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(aColorStops
[1].getStopColor()));
340 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf127379
)
342 createSdImpressDoc("odp/tdf127379.odp");
343 saveAndReload(u
"Impress Office Open XML"_ustr
);
344 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
345 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDoc
->getDrawPages()->getCount());
347 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
348 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
350 uno::Any aAny
= xPropSet
->getPropertyValue(u
"Background"_ustr
);
351 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny
.hasValue());
352 uno::Reference
<beans::XPropertySet
> aXBackgroundPropSet
;
353 aAny
>>= aXBackgroundPropSet
;
355 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
356 aXBackgroundPropSet
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
357 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, aFillStyle
);
359 awt::Gradient2 aGradient
;
360 CPPUNIT_ASSERT(aXBackgroundPropSet
->getPropertyValue(u
"FillGradient"_ustr
) >>= aGradient
);
362 // MCGR: Use the completely imported gradient to check for correctness
363 const basegfx::BColorStops aColorStops
364 = model::gradient::getColorStopsFromUno(aGradient
.ColorStops
);
366 CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops
.size());
367 CPPUNIT_ASSERT_EQUAL(0.0, aColorStops
[0].getStopOffset());
368 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED
, Color(aColorStops
[0].getStopColor()));
369 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 1.0));
370 CPPUNIT_ASSERT_EQUAL(Color(0x2a6099), Color(aColorStops
[1].getStopColor()));
373 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf98603
)
375 createSdImpressDoc("pptx/tdf98603.pptx");
376 saveAndReload(u
"Impress Office Open XML"_ustr
);
377 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
378 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
379 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
380 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
381 css::lang::Locale aLocale
;
382 xPropSet
->getPropertyValue(u
"CharLocaleComplex"_ustr
) >>= aLocale
;
383 CPPUNIT_ASSERT_EQUAL(u
"he"_ustr
, aLocale
.Language
);
384 CPPUNIT_ASSERT_EQUAL(u
"IL"_ustr
, aLocale
.Country
);
387 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf128213
)
389 createSdImpressDoc("pptx/tdf128213.pptx");
390 save(u
"Impress Office Open XML"_ustr
);
392 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
393 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm", "rot");
396 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf79082
)
398 createSdImpressDoc("pptx/tdf79082.pptx");
399 save(u
"Impress Office Open XML"_ustr
);
401 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
402 assertXPath(pXmlDocContent
,
403 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", "pos",
405 assertXPath(pXmlDocContent
,
406 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", "algn",
409 assertXPath(pXmlDocContent
,
410 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]", "pos",
412 assertXPath(pXmlDocContent
,
413 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]", "algn",
416 assertXPath(pXmlDocContent
,
417 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]", "pos",
419 assertXPath(pXmlDocContent
,
420 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]", "algn",
423 assertXPath(pXmlDocContent
,
424 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]", "pos",
426 assertXPath(pXmlDocContent
,
427 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]", "algn",
430 assertXPath(pXmlDocContent
,
431 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]", "pos",
433 assertXPath(pXmlDocContent
,
434 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]", "algn",
438 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf129372
)
440 //Without the fix in place, it would crash at import time
442 createSdImpressDoc("pptx/tdf129372.pptx");
443 saveAndReload(u
"Impress Office Open XML"_ustr
);
444 const SdrPage
* pPage
= GetPage(1);
446 const SdrObject
* pObj
= pPage
->GetObj(0);
447 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
448 CPPUNIT_ASSERT_EQUAL(SdrObjKind::CustomShape
, pObj
->GetObjIdentifier());
451 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testShapeGlowEffect
)
453 createSdImpressDoc("pptx/shape-glow-effect.pptx");
454 saveAndReload(u
"Impress Office Open XML"_ustr
);
455 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
456 sal_Int32 nRadius
= -1;
457 xShape
->getPropertyValue(u
"GlowEffectRadius"_ustr
) >>= nRadius
;
458 CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius
); // 139700 EMU = 388.0556 mm/100
460 xShape
->getPropertyValue(u
"GlowEffectColor"_ustr
) >>= nColor
;
461 CPPUNIT_ASSERT_EQUAL(Color(0xFFC000), nColor
);
462 sal_Int16 nTransparency
;
463 xShape
->getPropertyValue(u
"GlowEffectTransparency"_ustr
) >>= nTransparency
;
464 CPPUNIT_ASSERT_EQUAL(sal_Int16(60), nTransparency
);
467 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testShapeTextGlowEffect
)
469 createSdImpressDoc("pptx/shape-text-glow-effect.pptx");
470 saveAndReload(u
"Impress Office Open XML"_ustr
);
471 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
472 sal_Int32 nRadius
= -1;
473 xShape
->getPropertyValue(u
"GlowTextEffectRadius"_ustr
) >>= nRadius
;
474 CPPUNIT_ASSERT_EQUAL(sal_Int32(706), nRadius
); // 20 pt = 706 mm/100
476 xShape
->getPropertyValue(u
"GlowTextEffectColor"_ustr
) >>= nColor
;
477 CPPUNIT_ASSERT_EQUAL(Color(0x4EA72E), nColor
);
478 sal_Int16 nTransparency
;
479 xShape
->getPropertyValue(u
"GlowTextEffectTransparency"_ustr
) >>= nTransparency
;
480 CPPUNIT_ASSERT_EQUAL(sal_Int16(5), nTransparency
);
483 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testUnderline
)
485 createSdImpressDoc("underline.fodp");
487 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
488 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xShape
));
489 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
490 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
493 xPropSet
->getPropertyValue(u
"CharColor"_ustr
) >>= nColor
;
494 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED
, nColor
);
496 xPropSet
->getPropertyValue(u
"CharUnderlineColor"_ustr
) >>= nColor
;
497 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, nColor
);
499 sal_Int16 nUnderline
;
500 xPropSet
->getPropertyValue(u
"CharUnderline"_ustr
) >>= nUnderline
;
501 CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::DOUBLE
, nUnderline
);
503 saveAndReload(u
"Impress Office Open XML"_ustr
);
505 xShape
.set(getShapeFromPage(0, 0));
506 xParagraph
.set(getParagraphFromShape(0, xShape
));
507 xRun
.set(getRunFromParagraph(0, xParagraph
));
508 xPropSet
.set(xRun
, uno::UNO_QUERY_THROW
);
510 xPropSet
->getPropertyValue(u
"CharColor"_ustr
) >>= nColor
;
511 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED
, nColor
);
513 xPropSet
->getPropertyValue(u
"CharUnderlineColor"_ustr
) >>= nColor
;
514 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, nColor
);
516 xPropSet
->getPropertyValue(u
"CharUnderline"_ustr
) >>= nUnderline
;
517 CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::DOUBLE
, nUnderline
);
520 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf119087
)
522 createSdImpressDoc("pptx/tdf119087.pptx");
523 saveAndReload(u
"Impress Office Open XML"_ustr
);
524 // This would fail both on export validation, and reloading the saved pptx file.
526 // Get first paragraph of the text
527 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
528 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
529 // Get first run of the paragraph
530 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
531 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
533 Color nColor
= COL_AUTO
;
534 xPropSet
->getPropertyValue(u
"CharColor"_ustr
) >>= nColor
;
535 CPPUNIT_ASSERT_EQUAL(Color(0x00B050), nColor
);
538 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf131554
)
540 createSdImpressDoc("pptx/tdf131554.pptx");
541 saveAndReload(u
"Impress Office Open XML"_ustr
);
542 uno::Reference
<drawing::XShape
> xShape(getShapeFromPage(1, 0), uno::UNO_QUERY
);
543 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(5622), xShape
->getPosition().X
);
544 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(13251), xShape
->getPosition().Y
);
547 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf132282
)
549 createSdImpressDoc("pptx/tdf132282.pptx");
550 saveAndReload(u
"Impress Office Open XML"_ustr
);
551 uno::Reference
<drawing::XShape
> xShape(getShapeFromPage(0, 0), uno::UNO_QUERY
);
552 // Without the fix in place, the position would be 0,0, height = 1 and width = 1
553 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1736), xShape
->getPosition().X
);
554 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(763), xShape
->getPosition().Y
);
555 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(30523), xShape
->getSize().Width
);
556 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2604), xShape
->getSize().Height
);
559 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf132201EffectOrder
)
561 createSdImpressDoc("pptx/effectOrder.pptx");
562 save(u
"Impress Office Open XML"_ustr
);
563 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
564 assertXPathChildren(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst", 2);
565 // The relative order of effects is important: glow must be before shadow
566 CPPUNIT_ASSERT_EQUAL(0, getXPathPosition(pXmlDocContent
,
567 "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst",
569 CPPUNIT_ASSERT_EQUAL(1, getXPathPosition(pXmlDocContent
,
570 "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst",
574 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testShapeSoftEdgeEffect
)
576 createSdImpressDoc("pptx/shape-soft-edges.pptx");
577 saveAndReload(u
"Impress Office Open XML"_ustr
);
578 auto xShapeProps(getShapeFromPage(0, 0));
579 sal_Int32 nRadius
= -1;
580 xShapeProps
->getPropertyValue(u
"SoftEdgeRadius"_ustr
) >>= nRadius
;
581 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRadius
); // 18 pt
583 xShapeProps
.set(getShapeFromPage(1, 0));
584 xShapeProps
->getPropertyValue(u
"SoftEdgeRadius"_ustr
) >>= nRadius
;
585 CPPUNIT_ASSERT_EQUAL(sal_Int32(353), nRadius
); // 10 pt
588 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testShapeShadowBlurEffect
)
590 createSdImpressDoc("pptx/shape-blur-effect.pptx");
591 saveAndReload(u
"Impress Office Open XML"_ustr
);
592 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
593 bool bHasShadow
= false;
594 xShape
->getPropertyValue(u
"Shadow"_ustr
) >>= bHasShadow
;
595 CPPUNIT_ASSERT(bHasShadow
);
596 sal_Int32 nRadius
= -1;
597 xShape
->getPropertyValue(u
"ShadowBlur"_ustr
) >>= nRadius
;
598 CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius
); // 11 pt
601 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf119223
)
603 createSdImpressDoc("odp/tdf119223.odp");
604 save(u
"Impress Office Open XML"_ustr
);
606 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
607 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeCustomShape']");
609 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomePicture']");
611 assertXPath(pXmlDocRels
, "//mc:Choice/p:sp/p:nvSpPr/p:cNvPr[@name='SomeFormula']");
613 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeLine']");
615 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeTextbox']");
617 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeTable']");
619 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeGroup']");
622 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf128213ShapeRot
)
624 createSdImpressDoc("pptx/tdf128213-shaperot.pptx");
625 save(u
"Impress Office Open XML"_ustr
);
627 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
629 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:scene3d");
630 assertXPath(pXmlDocRels
,
631 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", "rev",
635 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125560_textDeflate
)
637 createSdImpressDoc("pptx/ShapePlusImage.pptx");
639 // This problem did not affect the pptx export, only the ODP so assert that
640 save(u
"impress8"_ustr
);
642 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"content.xml"_ustr
);
643 assertXPath(pXmlDocRels
,
644 "/office:document-content/office:body/office:presentation/draw:page/"
645 "draw:custom-shape/draw:enhanced-geometry",
646 "type", u
"mso-spt161");
649 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf125560_textInflateTop
)
651 createSdImpressDoc("pptx/ShapeTextInflateTop.pptx");
653 // This problem did not affect the pptx export, only the ODP so assert that
654 save(u
"impress8"_ustr
);
656 xmlDocUniquePtr pXmlDocRels
= parseExport(u
"content.xml"_ustr
);
657 assertXPath(pXmlDocRels
,
658 "/office:document-content/office:body/office:presentation/draw:page/"
659 "draw:custom-shape/draw:enhanced-geometry",
660 "type", u
"mso-spt164");
663 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf142235_TestPlaceholderTextAlignment
)
665 createSdImpressDoc("odp/placeholder-box-textalignment.odp");
667 save(u
"Impress Office Open XML"_ustr
);
669 xmlDocUniquePtr pXml1
= parseExport(u
"ppt/slides/slide2.xml"_ustr
);
670 xmlDocUniquePtr pXml2
= parseExport(u
"ppt/slides/slide3.xml"_ustr
);
672 // Without the fix in place many of these asserts failed, because alignment was bad.
674 assertXPath(pXml1
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", u
"t");
675 assertXPath(pXml2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", u
"t");
678 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf96061_textHighlight
)
680 createSdImpressDoc("pptx/tdf96061.pptx");
682 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
683 uno::Reference
<text::XTextRange
> const xParagraph1(getParagraphFromShape(0, xShape
));
684 uno::Reference
<text::XTextRange
> xRun1(getRunFromParagraph(0, xParagraph1
));
685 uno::Reference
<beans::XPropertySet
> xPropSet1(xRun1
, uno::UNO_QUERY_THROW
);
688 xPropSet1
->getPropertyValue(u
"CharBackColor"_ustr
) >>= aColor
;
689 CPPUNIT_ASSERT_EQUAL(COL_YELLOW
, aColor
);
691 uno::Reference
<text::XTextRange
> const xParagraph2(getParagraphFromShape(1, xShape
));
692 uno::Reference
<text::XTextRange
> xRun2(getRunFromParagraph(0, xParagraph2
));
693 uno::Reference
<beans::XPropertySet
> xPropSet2(xRun2
, uno::UNO_QUERY_THROW
);
694 xPropSet2
->getPropertyValue(u
"CharBackColor"_ustr
) >>= aColor
;
695 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, aColor
);
697 saveAndReload(u
"Impress Office Open XML"_ustr
);
699 uno::Reference
<beans::XPropertySet
> xShape2(getShapeFromPage(0, 0));
700 uno::Reference
<text::XTextRange
> const xParagraph3(getParagraphFromShape(0, xShape2
));
701 uno::Reference
<text::XTextRange
> xRun3(getRunFromParagraph(0, xParagraph3
));
702 uno::Reference
<beans::XPropertySet
> xPropSet3(xRun3
, uno::UNO_QUERY_THROW
);
703 xPropSet3
->getPropertyValue(u
"CharBackColor"_ustr
) >>= aColor
;
704 CPPUNIT_ASSERT_EQUAL(COL_YELLOW
, aColor
);
706 uno::Reference
<text::XTextRange
> const xParagraph4(getParagraphFromShape(1, xShape2
));
707 uno::Reference
<text::XTextRange
> xRun4(getRunFromParagraph(0, xParagraph4
));
708 uno::Reference
<beans::XPropertySet
> xPropSet4(xRun4
, uno::UNO_QUERY_THROW
);
709 xPropSet4
->getPropertyValue(u
"CharBackColor"_ustr
) >>= aColor
;
710 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, aColor
);
713 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf143222_embeddedWorksheet
)
715 // Check import of embedded worksheet in slide.
717 createSdImpressDoc("pptx/tdf143222.pptx");
719 const SdrPage
* pPage
= GetPage(1);
720 const SdrOle2Obj
* pOleObj
= static_cast<SdrOle2Obj
*>(pPage
->GetObj(0));
721 CPPUNIT_ASSERT_MESSAGE("no object", pOleObj
!= nullptr);
723 // Without the fix we lost the graphic of ole object.
724 const Graphic
* pGraphic
= pOleObj
->GetGraphic();
725 CPPUNIT_ASSERT_MESSAGE("no graphic", pGraphic
!= nullptr);
726 CPPUNIT_ASSERT_MESSAGE("no graphic", !pGraphic
->IsNone());
728 // Check export of embedded worksheet in slide.
729 saveAndReload(u
"Impress Office Open XML"_ustr
);
732 pOleObj
= static_cast<SdrOle2Obj
*>(pPage
->GetObj(0));
733 CPPUNIT_ASSERT_MESSAGE("no object after the export", pOleObj
!= nullptr);
735 pGraphic
= pOleObj
->GetGraphic();
736 CPPUNIT_ASSERT_MESSAGE("no graphic after the export", pGraphic
!= nullptr);
737 CPPUNIT_ASSERT_MESSAGE("no graphic after the export", !pGraphic
->IsNone());
740 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf143315
)
742 createSdImpressDoc("ppt/tdf143315-WordartWithoutBullet.ppt");
744 save(u
"Impress Office Open XML"_ustr
);
746 xmlDocUniquePtr pXml
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
748 // Without the fix in place, this would have failed with
751 // - In <file:///tmp/lu161922zcvd.tmp>, XPath '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr' unexpected 'marL' attribute
753 assertXPathNoAttribute(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr", "marL");
754 assertXPathNoAttribute(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr", "indent");
755 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buClr", 0);
756 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buSzPct", 0);
757 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buFont", 0);
758 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buChar", 0);
761 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf147121
)
764 createSdImpressDoc("pptx/tdf147121.pptx");
766 // Get the second line props of the placeholder
767 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
768 uno::Reference
<beans::XPropertySet
> xShape(xPage
->getByIndex(0), uno::UNO_QUERY_THROW
);
769 uno::Reference
<beans::XPropertySet
> xRun(
770 getRunFromParagraph(2, getParagraphFromShape(0, xShape
)), uno::UNO_QUERY_THROW
);
772 // Save the font size
773 const auto nFontSizeBefore
= xRun
->getPropertyValue(u
"CharHeight"_ustr
).get
<float>() * 100;
775 save(u
"Impress Office Open XML"_ustr
);
778 xmlDocUniquePtr pXml
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
779 const auto nFontSizeAfter
780 = getXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:br[1]/a:rPr", "sz").toFloat();
782 // The font size was not saved before now it must be equal with the saved one.
783 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font size", nFontSizeBefore
, nFontSizeAfter
);
786 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf140912_PicturePlaceholder
)
788 // Given a graphic placeholder with a custom prompt:
789 createSdImpressDoc("pptx/tdfpictureplaceholder.pptx");
791 uno::Reference
<beans::XPropertySet
> xShapeProps(getShapeFromPage(0, 0));
792 bool isEmptyPresentationObject
= false;
793 // Without the fix, it would not be imported as empty presentation object;
794 // the text would be treated as its content.
795 xShapeProps
->getPropertyValue(u
"IsEmptyPresentationObject"_ustr
) >>= isEmptyPresentationObject
;
796 CPPUNIT_ASSERT(isEmptyPresentationObject
);
798 // If we supported custom prompt text, here we would also test "String" property,
799 // which would be equal to "Insert Image".
802 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testEnhancedPathViewBox
)
804 createSdImpressDoc("odp/tdf147978_enhancedPath_viewBox.odp");
805 saveAndReload(u
"Impress Office Open XML"_ustr
);
806 auto xShapeProps(getShapeFromPage(0, 0));
807 awt::Rectangle aBoundRectangle
;
808 xShapeProps
->getPropertyValue(u
"BoundRect"_ustr
) >>= aBoundRectangle
;
809 // The shape has a Bézier curve which does not touch the right edge. Prior to the fix the curve
810 // was stretched to touch the edge, resulting in 5098 curve width instead of 2045.
811 CPPUNIT_ASSERT_EQUAL(sal_Int32(2045), aBoundRectangle
.Width
);
814 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf74670
)
816 createSdImpressDoc("odp/tdf74670.odp");
817 save(u
"Impress Office Open XML"_ustr
);
819 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
820 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
),
821 maTempFile
.GetURL());
822 const uno::Sequence
<OUString
> aNames(xNameAccess
->getElementNames());
824 for (const auto& rElementName
: aNames
)
825 if (rElementName
.startsWith("ppt/media/image"))
828 // Without the accompanying fix in place, this test would have failed with:
831 // i.e. the embedded picture would have been saved twice.
832 CPPUNIT_ASSERT_EQUAL(1, nImageFiles
);
835 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf109169_OctagonBevel
)
837 // The document has a shape 'Octagon Bevel'. It consists of an octagon with 8 points and eight
838 // facets with 4 points each, total 8+8*4=40 points. Without the patch it was exported as
839 // rectangle and thus had 4 points.
841 createSdImpressDoc("odp/tdf109169_Octagon.odp");
842 saveAndReload(u
"Impress Office Open XML"_ustr
);
844 auto xPropSet(getShapeFromPage(0, 0));
845 auto aGeomPropSeq
= xPropSet
->getPropertyValue(u
"CustomShapeGeometry"_ustr
)
846 .get
<uno::Sequence
<beans::PropertyValue
>>();
847 comphelper::SequenceAsHashMap
aCustomShapeGeometry(aGeomPropSeq
);
848 auto aPathSeq((aCustomShapeGeometry
[u
"Path"_ustr
]).get
<uno::Sequence
<beans::PropertyValue
>>());
849 comphelper::SequenceAsHashMap
aPath(aPathSeq
);
850 auto aCoordinates((aPath
[u
"Coordinates"_ustr
])
851 .get
<uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
>>());
852 CPPUNIT_ASSERT_EQUAL(sal_Int32(40), aCoordinates
.getLength());
855 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf109169_DiamondBevel
)
857 // The document has a shape 'Diamond Bevel'. It consists of a diamond with 4 points and four
858 // facets with 4 points each, total 4+4*4=20 points. Without the patch it was exported as
859 // rectangle and thus had 4 points.
861 createSdImpressDoc("odp/tdf109169_Diamond.odp");
862 saveAndReload(u
"Impress Office Open XML"_ustr
);
864 auto xPropSet(getShapeFromPage(0, 0));
865 auto aGeomPropSeq
= xPropSet
->getPropertyValue(u
"CustomShapeGeometry"_ustr
)
866 .get
<uno::Sequence
<beans::PropertyValue
>>();
867 comphelper::SequenceAsHashMap
aCustomShapeGeometry(aGeomPropSeq
);
868 auto aPathSeq((aCustomShapeGeometry
[u
"Path"_ustr
]).get
<uno::Sequence
<beans::PropertyValue
>>());
869 comphelper::SequenceAsHashMap
aPath(aPathSeq
);
870 auto aCoordinates((aPath
[u
"Coordinates"_ustr
])
871 .get
<uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
>>());
872 CPPUNIT_ASSERT_EQUAL(sal_Int32(20), aCoordinates
.getLength());
875 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf144092_emptyShapeTextProps
)
877 // Document contains one shape and one table. Both without any text but with
878 // text properties contained inside endParaRPr - The import and export
879 // of endParaRPr for empty cells and shapes are tested here
880 createSdImpressDoc("pptx/tdf144092-emptyShapeTextProps.pptx");
881 saveAndReload(u
"Impress Office Open XML"_ustr
);
884 // check text properties of empty shape
885 uno::Reference
<beans::XPropertySet
> xRectShapeProps(getShapeFromPage(1, 0));
886 CPPUNIT_ASSERT_EQUAL(u
"Calibri"_ustr
,
887 xRectShapeProps
->getPropertyValue(u
"CharFontName"_ustr
).get
<OUString
>());
888 CPPUNIT_ASSERT_EQUAL(float(196),
889 xRectShapeProps
->getPropertyValue(u
"CharHeight"_ustr
).get
<float>());
890 xRectShapeProps
->getPropertyValue(u
"CharColor"_ustr
) >>= aColor
;
891 CPPUNIT_ASSERT_EQUAL(Color(0x70AD47), aColor
);
893 const SdrPage
* pPage
= GetPage(1);
894 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
895 CPPUNIT_ASSERT(pTableObj
);
896 uno::Reference
<table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
897 uno::Reference
<beans::XPropertySet
> xCell
;
899 // check text properties of empty cells
900 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
901 xCell
->getPropertyValue(u
"CharColor"_ustr
) >>= aColor
;
902 CPPUNIT_ASSERT_EQUAL(COL_WHITE
, aColor
);
904 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
905 xCell
->getPropertyValue(u
"CharColor"_ustr
) >>= aColor
;
906 CPPUNIT_ASSERT_EQUAL(Color(0x70AD47), aColor
);
907 CPPUNIT_ASSERT_EQUAL(float(96), xCell
->getPropertyValue(u
"CharHeight"_ustr
).get
<float>());
910 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf149551_tbrl90
)
912 // The document contains a shape with writing mode TB_RL90. That is the same as vert="vert" in
913 // OOXML. Without the patch it was not possible to use this writing mode at all.
915 createSdImpressDoc("odp/tdf149551_tbrl90.odp");
917 // Test, that the shape has writing mode TB_RL90.
918 uno::Reference
<beans::XPropertySet
> xShapeProps(getShapeFromPage(0, 0));
919 sal_Int16 eWritingMode
;
920 xShapeProps
->getPropertyValue(u
"WritingMode"_ustr
) >>= eWritingMode
;
921 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90
, eWritingMode
);
923 // Test, that it is exported to vert="vert"
924 save(u
"Impress Office Open XML"_ustr
);
925 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
926 assertXPath(pXmlDoc
, "//a:bodyPr", "vert", u
"vert");
928 // Test, that the shape has writing mode TB_RL90 after read from pptx
929 uno::Reference
<beans::XPropertySet
> xShapeProps2(getShapeFromPage(0, 0));
930 sal_Int16 eWritingMode2
;
931 xShapeProps2
->getPropertyValue(u
"WritingMode"_ustr
) >>= eWritingMode2
;
932 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90
, eWritingMode2
);
934 // Test, that it is written to odp with loext:writing-mode="tb-rl90"
935 save(u
"impress8"_ustr
);
936 pXmlDoc
= parseExport(u
"content.xml"_ustr
);
939 "//style:style[@style:name='gr1']/style:graphic-properties[@loext:writing-mode='tb-rl90']");
942 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf149551_btlr
)
944 // The document contains a shape with writing mode BT_LR. That is the same as vert="vert270" in
945 // OOXML. Without the patch it was not possible to use this writing mode at all for shapes.
947 createSdImpressDoc("odp/tdf149551_btlr.odp");
949 // Test, that the shape has writing mode BT_LR.
950 uno::Reference
<beans::XPropertySet
> xShapeProps(getShapeFromPage(0, 0));
951 sal_Int16 eWritingMode
;
952 xShapeProps
->getPropertyValue(u
"WritingMode"_ustr
) >>= eWritingMode
;
953 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, eWritingMode
);
955 // Test, that it is exported to vert="vert270"
956 save(u
"Impress Office Open XML"_ustr
);
957 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
958 assertXPath(pXmlDoc
, "//a:bodyPr", "vert", u
"vert270");
960 // Test, that the shape has writing mode BT_LR after read from pptx
961 uno::Reference
<beans::XPropertySet
> xShapeProps2(getShapeFromPage(0, 0));
962 sal_Int16 eWritingMode2
;
963 xShapeProps2
->getPropertyValue(u
"WritingMode"_ustr
) >>= eWritingMode2
;
964 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, eWritingMode2
);
966 // Test, that it is written to odp with loext:writing-mode="bt-lr"
967 save(u
"impress8"_ustr
);
968 pXmlDoc
= parseExport(u
"content.xml"_ustr
);
971 "//style:style[@style:name='gr1']/style:graphic-properties[@loext:writing-mode='bt-lr']");
974 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf94122_autoColor
)
976 // Document contains three pages, with different scenarios for automatic
977 // color export to pptx.
978 // - First page: Page background light, automatic colored text on a FillType_NONE shape
979 // - Second page: Page background dark, automatic colored text on a FillType_NONE shape
980 // - Third page: Page background light, automatic colored text on a dark colored fill
981 // and another automatic colored text on a light colored fill
983 createSdImpressDoc("odp/tdf94122_autocolor.odp");
985 save(u
"Impress Office Open XML"_ustr
);
987 // Without the accompanying fix in place, these tests would have failed with:
990 // - In ..., XPath '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr' number of nodes is incorrect
991 // i.e. automatic color wasn't resolved & exported
993 xmlDocUniquePtr pXmlDocContent1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
994 assertXPath(pXmlDocContent1
,
995 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val",
998 xmlDocUniquePtr pXmlDocContent2
= parseExport(u
"ppt/slides/slide2.xml"_ustr
);
999 assertXPath(pXmlDocContent2
,
1000 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val",
1003 xmlDocUniquePtr pXmlDocContent3
= parseExport(u
"ppt/slides/slide3.xml"_ustr
);
1004 assertXPath(pXmlDocContent3
,
1005 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr",
1007 assertXPath(pXmlDocContent3
,
1008 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr",
1012 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf124333
)
1014 // Document contains one rectangle and one embedded OLE object.
1016 createSdImpressDoc("pptx/ole.pptx");
1018 // Without the fix in place, the number of shapes was 3.
1019 CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect", sal_Int32(2),
1020 getPage(0)->getCount());
1022 saveAndReload(u
"Impress Office Open XML"_ustr
);
1024 // Check number of shapes after export.
1025 CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect after export", sal_Int32(2),
1026 getPage(0)->getCount());
1029 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testAutofittedTextboxIndent
)
1031 createSdImpressDoc("odp/autofitted-textbox-indent.odp");
1033 save(u
"Impress Office Open XML"_ustr
);
1035 // Check that the indent hasn't changed and wasn't scaled when exporting
1036 // (the behaviour changed).
1038 xmlDocUniquePtr pXmlDocContent1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1039 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr", "marL",
1043 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf151622_oleIcon
)
1045 createSdImpressDoc("odp/ole_icon.odp");
1047 save(u
"Impress Office Open XML"_ustr
);
1049 xmlDocUniquePtr pXml
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1051 // Without the accompanying fix in place, this test would have failed with:
1052 // - Expression: prop
1053 // - In ..., XPath '//p:oleObj' no attribute 'showAsIcon' exist
1054 // i.e. show as icon option wasn't exported.
1055 assertXPath(pXml
, "//p:oleObj", "showAsIcon", u
"1");
1058 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf152436
)
1060 createSdImpressDoc("pptx/ole-emf_min.pptx");
1061 saveAndReload(u
"Impress Office Open XML"_ustr
);
1063 // Check number of shapes after export.
1064 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount());
1067 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testLinkedOLE
)
1069 createSdImpressDoc("odp/linked_ole.odp");
1071 save(u
"Impress Office Open XML"_ustr
);
1073 xmlDocUniquePtr pXml
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1075 // Without the accompanying fix in place, this test would have failed with:
1078 // - In<>, XPath '//p:oleObj' number of nodes is incorrect
1079 // i.e. the linked ole object wasn't exported.
1080 assertXPath(pXml
, "//p:oleObj", 1);
1083 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf102261_testParaTabStopDefaultDistance
)
1085 createSdImpressDoc("pptx/tdf102261_testParaTabStopDefaultDistance.pptx");
1086 saveAndReload(u
"Impress Office Open XML"_ustr
);
1088 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1090 uno::Reference
<beans::XPropertySet
> xPropSet(getParagraphFromShape(0, xShape
),
1091 uno::UNO_QUERY_THROW
);
1092 CPPUNIT_ASSERT_EQUAL(
1094 xPropSet
->getPropertyValue(u
"ParaTabStopDefaultDistance"_ustr
).get
<sal_Int32
>());
1097 uno::Reference
<beans::XPropertySet
> xPropSet(getParagraphFromShape(1, xShape
),
1098 uno::UNO_QUERY_THROW
);
1099 CPPUNIT_ASSERT_EQUAL(
1101 xPropSet
->getPropertyValue(u
"ParaTabStopDefaultDistance"_ustr
).get
<sal_Int32
>());
1105 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testNotesAuthorDate
)
1107 createSdImpressDoc("pptx/pres-with-notes.pptx");
1109 auto pBatch(comphelper::ConfigurationChanges::create());
1110 // 1. Remove all personal info, but keep note info
1111 officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true, pBatch
);
1112 officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::set(true,
1116 saveAndReload(u
"Impress Office Open XML"_ustr
);
1118 xmlDocUniquePtr pXml
= parseExport(u
"ppt/commentAuthors.xml"_ustr
);
1119 assertXPath(pXml
, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u
"Hans Wurst");
1120 assertXPath(pXml
, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u
"Max Muster");
1122 pXml
= parseExport(u
"ppt/comments/comment1.xml"_ustr
);
1123 assertXPath(pXml
, "/p:cmLst/p:cm", "dt", u
"2024-06-13T12:03:08.000000000");
1125 // 2. Remove all personal info
1126 officecfg::Office::Common::Security::Scripting::KeepNoteAuthorDateInfoOnSaving::set(false,
1129 saveAndReload(u
"Impress Office Open XML"_ustr
);
1131 pXml
= parseExport(u
"ppt/commentAuthors.xml"_ustr
);
1132 assertXPath(pXml
, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u
"Author1");
1133 assertXPath(pXml
, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u
"Author2");
1135 pXml
= parseExport(u
"ppt/comments/comment1.xml"_ustr
);
1136 assertXPathNoAttribute(pXml
, "/p:cmLst/p:cm", "dt");
1139 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTableCellVerticalPropertyRoundtrip
)
1141 createSdImpressDoc("pptx/tcPr-vert-roundtrip.pptx");
1142 saveAndReload(u
"Impress Office Open XML"_ustr
);
1144 xmlDocUniquePtr pXml
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1146 assertXPath(pXml
, "(//a:tcPr)[1]", "vert", u
"vert");
1147 assertXPath(pXml
, "(//a:tcPr)[2]", "vert", u
"vert270");
1148 assertXPath(pXml
, "(//a:tcPr)[3]", "vert", u
"wordArtVert");
1151 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf157740_slideMasters
)
1153 createSdImpressDoc("pptx/tdf157740.pptx");
1154 saveAndReload(u
"Impress Office Open XML"_ustr
);
1156 // The original file has 1 slide master and 7 slide layouts in that master
1157 xmlDocUniquePtr pXmlDocContent
= parseExport(u
"ppt/presentation.xml"_ustr
);
1158 assertXPath(pXmlDocContent
, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1);
1160 pXmlDocContent
= parseExport(u
"ppt/slideMasters/slideMaster1.xml"_ustr
);
1161 assertXPath(pXmlDocContent
, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId", 7);
1164 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf159931_slideLayouts
)
1166 createSdImpressDoc("odp/repeatBitmapMode.odp");
1167 save(u
"Impress Office Open XML"_ustr
);
1169 xmlDocUniquePtr pXmlDocRels1
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
1170 xmlDocUniquePtr pXmlDocRels2
= parseExport(u
"ppt/slides/_rels/slide2.xml.rels"_ustr
);
1172 assertXPath(pXmlDocRels1
, "(/rels:Relationships/rels:Relationship[@Type='http://"
1173 "schemas.openxmlformats.org/officeDocument/2006/relationships/"
1176 // the relative target e.g. "../slideLayouts/slideLayout2.xml"
1177 OUString sRelativeLayoutPath1
1178 = getXPathContent(pXmlDocRels1
, "(/rels:Relationships/rels:Relationship[@Type='http://"
1179 "schemas.openxmlformats.org/officeDocument/2006/"
1180 "relationships/slideLayout'])/@Target");
1182 assertXPath(pXmlDocRels2
, "(/rels:Relationships/rels:Relationship[@Type='http://"
1183 "schemas.openxmlformats.org/officeDocument/2006/relationships/"
1186 // the relative target e.g. "../slideLayouts/slideLayout1.xml"
1187 OUString sRelativeLayoutPath2
1188 = getXPathContent(pXmlDocRels2
, "(/rels:Relationships/rels:Relationship[@Type='http://"
1189 "schemas.openxmlformats.org/officeDocument/2006/"
1190 "relationships/slideLayout'])/@Target");
1192 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
1193 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
),
1194 maTempFile
.GetURL());
1196 // Check that the referenced slideLayout files exist
1197 // Without the accompanying fix in place, this test would have failed with:
1198 // equality assertion failed
1201 // i.e. the referenced slideLayout file was missing on export.
1202 OUString sSlideLayoutName1
= sRelativeLayoutPath1
.getToken(2, '/');
1203 OUString sSlideLayoutName2
= sRelativeLayoutPath2
.getToken(2, '/');
1205 CPPUNIT_ASSERT_EQUAL(true,
1206 bool(xNameAccess
->hasByName("ppt/slideLayouts/" + sSlideLayoutName1
)));
1207 CPPUNIT_ASSERT_EQUAL(true,
1208 bool(xNameAccess
->hasByName("ppt/slideLayouts/" + sSlideLayoutName2
)));
1211 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testTdf163483_export_math_fallback
)
1213 createSdImpressDoc("odp/formula.fodp");
1215 // Before export-and-reload, there is a formula on page.
1217 auto xProps
= getShapeFromPage(0, 0);
1218 auto xInfo
= xProps
->getPropertyValue(u
"Model"_ustr
).queryThrow
<css::lang::XServiceInfo
>();
1219 CPPUNIT_ASSERT(xInfo
->supportsService(u
"com.sun.star.formula.FormulaProperties"_ustr
));
1221 // tdf#164101: check that the size is imported correctly
1222 css::awt::Size formulaSize
= xProps
.queryThrow
<css::drawing::XShape
>()->getSize();
1223 CPPUNIT_ASSERT_EQUAL(sal_Int32(1553), formulaSize
.Width
);
1224 CPPUNIT_ASSERT_EQUAL(sal_Int32(528), formulaSize
.Height
);
1226 CPPUNIT_ASSERT_THROW(getShapeFromPage(0, 1),
1227 css::lang::IndexOutOfBoundsException
); // Only one shape on page
1230 saveAndReload(u
"Impress Office Open XML"_ustr
);
1232 // After save-and-reload, there must still be a single shape; now it's a fallback image.
1233 // When we start to import formulas from PPTX, that will be formula.
1235 // Without the fix, this threw IndexOutOfBoundsException, because there was no fallback,
1236 // and no shape got imported.
1237 auto xInfo
= getShapeFromPage(0, 0).queryThrow
<css::lang::XServiceInfo
>();
1238 CPPUNIT_ASSERT(xInfo
->supportsService(u
"com.sun.star.drawing.CustomShape"_ustr
));
1240 css::awt::Size formulaSize
= xInfo
.queryThrow
<css::drawing::XShape
>()->getSize();
1241 // The fallback image size after the roundtrip may be a bit different - allow some tolerance
1242 CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1553), formulaSize
.Width
, 1);
1243 CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(528), formulaSize
.Height
, 1);
1245 CPPUNIT_ASSERT_THROW(getShapeFromPage(0, 1),
1246 css::lang::IndexOutOfBoundsException
); // Only one shape on page
1249 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1251 const OUString cNvPr_id
= getXPath(
1252 pXmlDoc
, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:nvSpPr/p:cNvPr",
1255 // Check that the alternate content is exported
1258 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback/p:sp/p:spPr/a:blipFill/a:blip",
1261 // Its cNvPr_id must be the same
1262 assertXPath(pXmlDoc
,
1263 "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback/p:sp/p:nvSpPr/p:cNvPr",
1267 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testPlaceHolderFitHeightToText
)
1269 createSdImpressDoc("pptx/tdf160487.pptx");
1270 saveAndReload(u
"Impress Office Open XML"_ustr
);
1271 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(1, 0));
1272 bool bTextAutoGrowHeight
= false;
1273 xShape
->getPropertyValue(u
"TextAutoGrowHeight"_ustr
) >>= bTextAutoGrowHeight
;
1274 CPPUNIT_ASSERT_MESSAGE("PlaceHolder Fit height to text should be true.", bTextAutoGrowHeight
);
1277 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4
, testDeduplicateMasters
)
1279 createSdImpressDoc("pptx/onemaster-twolayouts.pptx");
1280 saveAndReload("Impress Office Open XML");
1282 // Check that the document still has one master and two layouts
1283 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/presentation.xml");
1284 assertXPath(pXmlDocContent
, "/p:presentation/p:sldMasterIdLst/p:sldMasterId"_ostr
, 1);
1285 pXmlDocContent
= parseExport("ppt/slideMasters/slideMaster1.xml");
1286 assertXPath(pXmlDocContent
, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId"_ostr
, 2);
1288 // Check that both background colors have been preserved
1289 uno::Reference
<drawing::XMasterPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
1290 CPPUNIT_ASSERT(xDoc
.is());
1291 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDoc
->getMasterPages()->getCount());
1293 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getMasterPages()->getByIndex(0),
1294 uno::UNO_QUERY_THROW
);
1295 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
1296 uno::Any aAny
= xPropSet
->getPropertyValue("Background");
1297 CPPUNIT_ASSERT(aAny
.hasValue());
1298 uno::Reference
<beans::XPropertySet
> aXBackgroundPropSet
;
1299 aAny
>>= aXBackgroundPropSet
;
1301 CPPUNIT_ASSERT(aXBackgroundPropSet
->getPropertyValue("FillColor") >>= nColor
);
1302 CPPUNIT_ASSERT_EQUAL(Color(0x0E2841), nColor
);
1304 uno::Reference
<drawing::XDrawPage
> xPage1(xDoc
->getMasterPages()->getByIndex(1),
1305 uno::UNO_QUERY_THROW
);
1306 uno::Reference
<beans::XPropertySet
> xPropSet1(xPage1
, uno::UNO_QUERY
);
1307 aAny
= xPropSet1
->getPropertyValue("Background");
1308 CPPUNIT_ASSERT(aAny
.hasValue());
1309 aAny
>>= aXBackgroundPropSet
;
1310 CPPUNIT_ASSERT(aXBackgroundPropSet
->getPropertyValue("FillColor") >>= nColor
);
1311 CPPUNIT_ASSERT_EQUAL(Color(0x000000), nColor
);
1314 CPPUNIT_PLUGIN_IMPLEMENT();
1316 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */