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 <officecfg/Office/Common.hxx>
11 #include "sdmodeltestbase.hxx"
12 #include <tools/color.hxx>
13 #include <Outliner.hxx>
14 #include <editeng/eeitem.hxx>
15 #include <editeng/editobj.hxx>
16 #include <editeng/fhgtitem.hxx>
17 #include <editeng/escapementitem.hxx>
18 #include <editeng/colritem.hxx>
19 #include <editeng/fontitem.hxx>
20 #include <editeng/wghtitem.hxx>
21 #include <editeng/numitem.hxx>
22 #include <editeng/postitem.hxx>
24 #include <oox/drawingml/drawingmltypes.hxx>
26 #include <svx/svdoashp.hxx>
27 #include <svx/svdogrp.hxx>
28 #include <svx/xflclit.hxx>
29 #include <svx/xlineit0.hxx>
30 #include <svx/sdooitm.hxx>
31 #include <svx/sdmetitm.hxx>
33 #include <com/sun/star/awt/FontDescriptor.hpp>
34 #include <com/sun/star/drawing/FillStyle.hpp>
35 #include <com/sun/star/drawing/LineDash.hpp>
36 #include <com/sun/star/text/WritingMode2.hpp>
37 #include <com/sun/star/table/BorderLine2.hpp>
38 #include <com/sun/star/table/XMergeableCell.hpp>
40 #include <docmodel/uno/UnoGradientTools.hxx>
41 #include <svx/svdotable.hxx>
42 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
43 #include <rtl/uri.hxx>
44 #include <vcl/filter/PngImageReader.hxx>
48 class SdOOXMLExportTest1
: public SdModelTestBase
52 : SdModelTestBase(u
"/sd/qa/unit/data/"_ustr
)
59 template <typename ItemValue
, typename ItemType
>
60 void checkFontAttributes(const SdrTextObj
* pObj
, ItemValue nVal
, sal_uInt32 nId
)
62 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
63 const EditTextObject
& aEdit
= pObj
->GetOutlinerParaObject()->GetTextObject();
64 std::vector
<EECharAttrib
> rLst
;
65 aEdit
.GetCharAttribs(0, rLst
);
66 for (std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!= rLst
.rend(); ++it
)
68 const ItemType
* pAttrib
= dynamic_cast<const ItemType
*>((*it
).pAttr
);
69 if (pAttrib
&& pAttrib
->Which() == nId
)
71 CPPUNIT_ASSERT_EQUAL(nVal
, static_cast<ItemValue
>(pAttrib
->GetValue()));
77 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf152335
)
79 createSdImpressDoc("pptx/tdf152335.pptx");
80 save(u
"Impress Office Open XML"_ustr
);
82 xmlDocUniquePtr pXmlDocTheme
= parseExport(u
"ppt/theme/theme1.xml"_ustr
);
84 pXmlDocTheme
, "/a:theme/a:themeElements/a:fmtScheme/a:effectStyleLst/a:effectStyle[3]", 1);
87 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf149803
)
89 createSdImpressDoc("pptx/tdf149803.pptx");
90 save(u
"Impress Office Open XML"_ustr
);
92 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
93 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp", "useBgFill", u
"1");
96 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf149311
)
98 createSdImpressDoc("odp/tdf149311.odp");
99 save(u
"Impress Office Open XML"_ustr
);
101 xmlDocUniquePtr pRelsDoc
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
103 assertXPath(pRelsDoc
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
107 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf149128
)
109 createSdImpressDoc("odp/tdf149128.odp");
110 save(u
"Impress Office Open XML"_ustr
);
112 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
113 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id",
115 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx",
117 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "id",
119 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx",
123 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf66228
)
125 createSdImpressDoc("odp/tdf66228.odp");
126 save(u
"Impress Office Open XML"_ustr
);
128 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
129 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:spPr/a:prstGeom", "prst",
133 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf147919
)
135 createSdImpressDoc("odp/tdf147919.odp");
136 save(u
"Impress Office Open XML"_ustr
);
138 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
139 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[1]/p:spPr/a:prstGeom", "prst",
142 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:prstGeom/a:avLst/a:gd", "name",
144 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[2]/p:spPr/a:prstGeom", "prst",
147 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[3]/p:spPr/a:xfrm", "flipH", u
"1");
148 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[3]/p:spPr/a:xfrm", "rot", u
"16200000");
149 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[3]/p:spPr/a:prstGeom/a:avLst/a:gd[1]",
151 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[3]/p:spPr/a:prstGeom/a:avLst/a:gd[2]",
153 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[3]/p:spPr/a:prstGeom", "prst",
156 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:xfrm", "flipH", u
"1");
157 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:xfrm", "flipV", u
"1");
158 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:xfrm", "rot", u
"10800000");
159 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:prstGeom/a:avLst/a:gd[1]",
161 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:prstGeom/a:avLst/a:gd[2]",
163 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:prstGeom/a:avLst/a:gd[3]",
165 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[4]/p:spPr/a:prstGeom", "prst",
168 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[5]/p:spPr/a:xfrm", "flipH", u
"1");
169 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[5]/p:spPr/a:xfrm", "rot", u
"16200000");
170 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[5]/p:spPr/a:prstGeom", "prst",
171 u
"curvedConnector2");
173 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[6]/p:spPr/a:xfrm", "flipH", u
"1");
174 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[6]/p:spPr/a:xfrm", "rot", u
"16200000");
175 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[6]/p:spPr/a:prstGeom/a:avLst/a:gd", "name",
177 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[6]/p:spPr/a:prstGeom", "prst",
178 u
"curvedConnector3");
180 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[7]/p:spPr/a:xfrm", "flipH", u
"1");
181 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[7]/p:spPr/a:xfrm", "flipV", u
"1");
182 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[7]/p:spPr/a:xfrm", "rot", u
"10800000");
183 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[7]/p:spPr/a:prstGeom/a:avLst/a:gd[1]",
185 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[7]/p:spPr/a:prstGeom/a:avLst/a:gd[2]",
187 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[7]/p:spPr/a:prstGeom", "prst",
188 u
"curvedConnector4");
190 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[8]/p:spPr/a:xfrm", "flipV", u
"1");
191 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[8]/p:spPr/a:xfrm", "rot", u
"16200000");
192 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[8]/p:spPr/a:prstGeom/a:avLst/a:gd[1]",
194 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[8]/p:spPr/a:prstGeom/a:avLst/a:gd[2]",
196 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[8]/p:spPr/a:prstGeom/a:avLst/a:gd[3]",
198 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:cxnSp[8]/p:spPr/a:prstGeom", "prst",
199 u
"curvedConnector5");
202 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf130165
)
204 createSdImpressDoc("pptx/tdf146223.pptx");
205 save(u
"Impress Office Open XML"_ustr
);
207 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
208 assertXPath(pXmlDoc
, "/p:sld", "showMasterSp", u
"0");
211 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf124781
)
213 createSdImpressDoc("odp/tdf124781.odp");
214 save(u
"Impress Office Open XML"_ustr
);
216 xmlDocUniquePtr pXmlDoc1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
217 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:r[2]/a:rPr", "baseline",
220 xmlDocUniquePtr pXmlDoc2
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
221 assertXPath(pXmlDoc2
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:r[2]/a:rPr", "baseline",
225 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf144914
)
227 createSdImpressDoc("pptx/tdf144616.pptx");
228 save(u
"Impress Office Open XML"_ustr
);
230 xmlDocUniquePtr pXmlDoc1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
231 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
232 u
"ppaction://hlinkshowjump?jump=firstslide");
234 xmlDocUniquePtr pXmlDoc2
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
235 assertXPath(pXmlDoc2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
236 u
"ppaction://hlinkshowjump?jump=lastslide");
238 xmlDocUniquePtr pXmlDoc3
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
239 assertXPath(pXmlDoc3
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
240 u
"ppaction://hlinkshowjump?jump=nextslide");
242 xmlDocUniquePtr pXmlDoc4
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
243 assertXPath(pXmlDoc4
, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
244 u
"ppaction://hlinkshowjump?jump=previousslide");
246 xmlDocUniquePtr pXmlDoc5
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
247 assertXPath(pXmlDoc5
, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
248 u
"ppaction://hlinksldjump");
249 xmlDocUniquePtr pRelsDoc5
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
250 assertXPath(pRelsDoc5
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
253 xmlDocUniquePtr pXmlDoc6
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
254 assertXPath(pXmlDoc6
, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:nvSpPr/p:cNvPr/a:hlinkClick", "action",
255 u
"ppaction://hlinkshowjump?jump=endshow");
257 xmlDocUniquePtr pXmlDoc7
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
258 assertXPath(pXmlDoc7
, "/p:sld/p:cSld/p:spTree/p:sp[7]/p:nvSpPr/p:cNvPr/a:hlinkClick", "id",
260 xmlDocUniquePtr pRelsDoc7
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
261 assertXPath(pRelsDoc7
, "/rels:Relationships/rels:Relationship[@Id='rId2']", "Target",
262 u
"http://www.example.com/");
265 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf124232
)
267 createSdImpressDoc("pptx/tdf141704.pptx");
268 save(u
"Impress Office Open XML"_ustr
);
270 xmlDocUniquePtr pXmlDoc1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
271 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
272 u
"ppaction://hlinkshowjump?jump=lastslide");
274 xmlDocUniquePtr pXmlDoc2
= parseExport(u
"ppt/slides/slide2.xml"_ustr
);
275 assertXPath(pXmlDoc2
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
276 u
"ppaction://hlinkshowjump?jump=nextslide");
278 xmlDocUniquePtr pXmlDoc3
= parseExport(u
"ppt/slides/slide3.xml"_ustr
);
279 assertXPath(pXmlDoc3
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
280 u
"ppaction://hlinkshowjump?jump=previousslide");
282 xmlDocUniquePtr pXmlDoc4
= parseExport(u
"ppt/slides/slide4.xml"_ustr
);
283 assertXPath(pXmlDoc4
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "id",
285 xmlDocUniquePtr pRelsDoc4
= parseExport(u
"ppt/slides/_rels/slide4.xml.rels"_ustr
);
286 assertXPath(pRelsDoc4
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
287 u
"http://www.example.com/");
289 xmlDocUniquePtr pXmlDoc5
= parseExport(u
"ppt/slides/slide5.xml"_ustr
);
290 assertXPath(pXmlDoc5
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
291 u
"ppaction://hlinksldjump");
292 xmlDocUniquePtr pRelsDoc5
= parseExport(u
"ppt/slides/_rels/slide5.xml.rels"_ustr
);
293 assertXPath(pRelsDoc5
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
296 xmlDocUniquePtr pXmlDoc6
= parseExport(u
"ppt/slides/slide6.xml"_ustr
);
297 assertXPath(pXmlDoc6
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
298 u
"ppaction://hlinkshowjump?jump=endshow");
300 xmlDocUniquePtr pXmlDoc7
= parseExport(u
"ppt/slides/slide7.xml"_ustr
);
301 assertXPath(pXmlDoc7
, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:cNvPr/a:hlinkClick", "action",
302 u
"ppaction://hlinkshowjump?jump=firstslide");
305 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf143624
)
307 createSdImpressDoc("pptx/tdf143624.pptx");
308 save(u
"Impress Office Open XML"_ustr
);
310 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/presProps.xml"_ustr
);
312 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr", "useTimings", u
"0");
314 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr", "showNarration", u
"1");
317 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf142648
)
319 createSdImpressDoc("pptx/tdf142648.pptx");
321 uno::Reference
<drawing::XDrawPagesSupplier
> xDPS(mxComponent
, uno::UNO_QUERY_THROW
);
322 uno::Reference
<drawing::XDrawPages
> xDrawPages(xDPS
->getDrawPages(), uno::UNO_SET_THROW
);
323 uno::Reference
<drawing::XDrawPage
> xDrawPage
;
324 xDrawPages
->getByIndex(0) >>= xDrawPage
;
325 uno::Reference
<container::XNamed
> xNamed(xDrawPage
, uno::UNO_QUERY_THROW
);
326 xNamed
->setName(u
"#Slide 1"_ustr
);
328 save(u
"Impress Office Open XML"_ustr
);
330 xmlDocUniquePtr pRelsDoc
= parseExport(u
"ppt/slides/_rels/slide2.xml.rels"_ustr
);
332 assertXPath(pRelsDoc
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
336 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf47365
)
338 createSdImpressDoc("pptx/loopNoPause.pptx");
339 save(u
"Impress Office Open XML"_ustr
);
341 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/presProps.xml"_ustr
);
343 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr", "loop", u
"1");
345 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr", "showNarration", u
"1");
348 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf125071
)
350 createSdImpressDoc("pptx/tdf125071.pptx");
351 save(u
"Impress Office Open XML"_ustr
);
353 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/presentation.xml"_ustr
);
355 assertXPath(pXmlDoc
, "/p:presentation/p:custShowLst/p:custShow[1]", "name", u
"Custom1");
356 assertXPath(pXmlDoc
, "/p:presentation/p:custShowLst/p:custShow[2]", "name", u
"Custom2");
359 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf54037
)
361 createSdImpressDoc("pptx/tdf54037.pptx");
362 save(u
"Impress Office Open XML"_ustr
);
364 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
365 xmlDocUniquePtr pRelsDoc
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
367 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:r/a:rPr/a:hlinkClick",
368 "action", u
"ppaction://hlinksldjump");
370 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:r/a:rPr/a:hlinkClick",
371 "action", u
"ppaction://hlinkshowjump?jump=nextslide");
373 assertXPath(pRelsDoc
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
377 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf127237
)
379 createSdImpressDoc("pptx/tdf127237.pptx");
380 saveAndReload(u
"impress8"_ustr
);
382 const SdrPage
* pPage
= GetPage(1);
383 CPPUNIT_ASSERT(pPage
!= nullptr);
385 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
386 CPPUNIT_ASSERT(pTableObj
!= nullptr);
387 uno::Reference
<table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
390 uno::Reference
<beans::XPropertySet
> xCell(xTable
->getCellByPosition(0, 0),
391 uno::UNO_QUERY_THROW
);
392 xCell
->getPropertyValue(u
"FillColor"_ustr
) >>= nFillColor
;
393 CPPUNIT_ASSERT_EQUAL(Color(0x0070C0), nFillColor
);
396 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBnc887230
)
398 createSdImpressDoc("pptx/bnc887230.pptx");
399 saveAndReload(u
"Impress Office Open XML"_ustr
);
401 const SdrPage
* pPage
= GetPage(1);
403 const SdrTextObj
* pObj
= DynCastSdrTextObj(pPage
->GetObj(0));
404 // Without the fix in place, this test would have failed with
406 //- Actual : 13421823
407 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, COL_LIGHTBLUE
, EE_CHAR_COLOR
);
410 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBnc870233_1
)
412 createSdImpressDoc("pptx/bnc870233_1.pptx");
413 saveAndReload(u
"Impress Office Open XML"_ustr
);
415 const SdrPage
* pPage
= GetPage(1);
417 // The problem was all shapes had the same font (the last parsed font attributes overwrote all previous ones)
419 // First shape has red, bold font
421 const SdrTextObj
* pObj
= DynCastSdrTextObj(pPage
->GetObj(0));
422 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, COL_LIGHTRED
, EE_CHAR_COLOR
);
423 checkFontAttributes
<FontWeight
, SvxWeightItem
>(pObj
, WEIGHT_BOLD
, EE_CHAR_WEIGHT
);
426 // Second shape has blue, italic font
428 const SdrTextObj
* pObj
= DynCastSdrTextObj(pPage
->GetObj(1));
429 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, COL_LIGHTBLUE
, EE_CHAR_COLOR
);
430 checkFontAttributes
<FontItalic
, SvxPostureItem
>(pObj
, ITALIC_NORMAL
, EE_CHAR_ITALIC
);
434 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBnc870233_2
)
436 createSdImpressDoc("pptx/bnc870233_2.pptx");
437 saveAndReload(u
"Impress Office Open XML"_ustr
);
439 const SdrPage
* pPage
= GetPage(1);
441 // The problem was in some SmartArts font color was wrong
443 // First smart art has blue font color (direct formatting)
445 const SdrObjGroup
* pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(0));
446 CPPUNIT_ASSERT(pObjGroup
);
447 const SdrTextObj
* pObj
= DynCastSdrTextObj(pObjGroup
->GetSubList()->GetObj(1));
448 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, COL_LIGHTBLUE
, EE_CHAR_COLOR
);
451 // Second smart art has "dk2" font color (style)
453 const SdrObjGroup
* pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(1));
454 CPPUNIT_ASSERT(pObjGroup
);
455 const SdrTextObj
* pObj
= DynCastSdrTextObj(pObjGroup
->GetSubList()->GetObj(1));
456 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, Color(0x1f497d), EE_CHAR_COLOR
);
459 // Third smart art has white font color (style)
461 const SdrObjGroup
* pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(2));
462 CPPUNIT_ASSERT(pObjGroup
);
463 const SdrTextObj
* pObj
= DynCastSdrTextObj(pObjGroup
->GetSubList()->GetObj(1));
464 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, COL_WHITE
, EE_CHAR_COLOR
);
468 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testN828390_4
)
470 bool bPassed
= false;
471 createSdImpressDoc("n828390_4.odp");
473 saveAndReload(u
"Impress Office Open XML"_ustr
);
475 const SdrPage
* pPage
= GetPage(1);
477 std::vector
<EECharAttrib
> rLst
;
478 SdrObject
* pObj
= pPage
->GetObj(0);
479 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pObj
);
480 CPPUNIT_ASSERT(pTxtObj
);
481 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
482 aEdit
.GetCharAttribs(0, rLst
);
483 for (std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!= rLst
.rend();
486 const SvxFontHeightItem
* pFontHeight
487 = dynamic_cast<const SvxFontHeightItem
*>((*it
).pAttr
);
488 if (pFontHeight
&& (*it
).nStart
== 19)
489 CPPUNIT_ASSERT_EQUAL_MESSAGE("Font height is wrong", static_cast<sal_uInt32
>(1129),
490 pFontHeight
->GetHeight());
491 const SvxFontItem
* pFont
= dynamic_cast<const SvxFontItem
*>((*it
).pAttr
);
494 CPPUNIT_ASSERT_EQUAL_MESSAGE("Font is wrong", u
"Arial"_ustr
,
495 pFont
->GetFamilyName());
498 const SvxWeightItem
* pWeight
= dynamic_cast<const SvxWeightItem
*>((*it
).pAttr
);
499 if (pWeight
&& (*it
).nStart
== 18)
500 CPPUNIT_ASSERT_EQUAL_MESSAGE("Font Weight is wrong", WEIGHT_BOLD
,
501 pWeight
->GetWeight());
504 CPPUNIT_ASSERT(bPassed
);
507 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testN828390_5
)
509 createSdImpressDoc("n828390_5.odp");
511 saveAndReload(u
"Impress Office Open XML"_ustr
);
513 const SdrPage
* pPage
= GetPage(1);
515 SdrObject
* pObj
= pPage
->GetObj(0);
516 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pObj
);
517 CPPUNIT_ASSERT(pTxtObj
);
518 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
519 const SvxNumBulletItem
& rNumFmt
= aEdit
.GetParaAttribs(3).Get(EE_PARA_NUMBULLET
);
520 CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet's relative size is wrong!", sal_uInt16(75),
521 rNumFmt
.GetNumRule().GetLevel(1).GetBulletRelSize()); // != 25
525 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testLostPlaceholders
)
527 createSdImpressDoc("pptx/LostPlaceholder.odp");
529 SdXImpressDocument
* pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
530 CPPUNIT_ASSERT(pXImpressDocument
);
531 SdDrawDocument
* pDoc
= pXImpressDocument
->GetDoc();
532 CPPUNIT_ASSERT(pDoc
);
533 auto pPage
= pDoc
->GetPage(1);
534 CPPUNIT_ASSERT(pPage
);
535 auto pObj
= pPage
->GetObj(1);
536 CPPUNIT_ASSERT(pObj
);
537 uno::Reference
<drawing::XShape
> xShp(pObj
->getUnoShape(), uno::UNO_QUERY
);
538 CPPUNIT_ASSERT(xShp
);
540 CPPUNIT_ASSERT_EQUAL_MESSAGE(
541 "Wrong ShapeType!", u
"com.sun.star.presentation.OutlinerShape"_ustr
, xShp
->getShapeType());
542 uno::Reference
<beans::XPropertySet
> xShpProps(xShp
, uno::UNO_QUERY
);
543 // Without the fix in place there will be the following error:
544 // Expected: com.sun.star.presentation.OutlinerShape
545 // Actual: com.sun.star.drawing.CustomShape
547 CPPUNIT_ASSERT_EQUAL_MESSAGE(
548 "It must be a placeholder!", true,
549 xShpProps
->getPropertyValue(u
"IsPresentationObject"_ustr
).get
<bool>());
550 // Without the fix in place this will the following:
555 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testPlaceholderFillAndOutlineExport
)
557 createSdImpressDoc("pptx/LostPlaceholderFill.odp");
564 for (int i
= 1; i
<= 2; i
++)
566 SdXImpressDocument
* pXImpressDocument
567 = dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
568 CPPUNIT_ASSERT(pXImpressDocument
);
569 SdDrawDocument
* pDoc
= pXImpressDocument
->GetDoc();
570 CPPUNIT_ASSERT(pDoc
);
571 auto pPage
= pDoc
->GetPage(1);
572 CPPUNIT_ASSERT(pPage
);
573 auto pObj
= pPage
->GetObj(1);
574 CPPUNIT_ASSERT(pObj
);
576 uno::Reference
<drawing::XShape
> xShp(pObj
->getUnoShape(), uno::UNO_QUERY
);
577 CPPUNIT_ASSERT(xShp
);
579 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong ShapeType!",
580 u
"com.sun.star.presentation.OutlinerShape"_ustr
,
581 xShp
->getShapeType());
582 uno::Reference
<beans::XPropertySet
> xShpProps(xShp
, uno::UNO_QUERY
);
583 CPPUNIT_ASSERT_EQUAL_MESSAGE(
584 "It must be a placeholder!", true,
585 xShpProps
->getPropertyValue(u
"IsPresentationObject"_ustr
).get
<bool>());
589 aFillStyle
= xShpProps
->getPropertyValue(u
"FillStyle"_ustr
);
590 aFillColor
= xShpProps
->getPropertyValue(u
"FillColor"_ustr
);
592 aLineStyle
= xShpProps
->getPropertyValue(u
"LineStyle"_ustr
);
593 aLineColor
= xShpProps
->getPropertyValue(u
"LineColor"_ustr
);
595 saveAndReload(u
"Impress Office Open XML"_ustr
);
600 CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder fillstyle has not been exported!",
602 xShpProps
->getPropertyValue(u
"FillStyle"_ustr
));
603 CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder fillcolor has not been exported!",
605 xShpProps
->getPropertyValue(u
"FillColor"_ustr
));
607 CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder linestyle has not been exported!",
609 xShpProps
->getPropertyValue(u
"LineStyle"_ustr
));
610 CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder linecolor has not been exported!",
612 xShpProps
->getPropertyValue(u
"LineColor"_ustr
));
618 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testFdo71961
)
620 createSdImpressDoc("fdo71961.odp");
622 saveAndReload(u
"Impress Office Open XML"_ustr
);
623 const SdrPage
* pPage
= GetPage(1);
625 // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
626 // (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
627 auto pTxtObj
= pPage
->GetObj(1);
628 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
629 CPPUNIT_ASSERT_EQUAL(u
"Text to be always wrapped"_ustr
,
630 pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
631 CPPUNIT_ASSERT_EQUAL(true, pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
).GetValue());
633 pTxtObj
= dynamic_cast<SdrObjCustomShape
*>(pPage
->GetObj(2));
634 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
635 CPPUNIT_ASSERT_EQUAL(u
"Custom shape non-wrapped text"_ustr
,
636 pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
637 CPPUNIT_ASSERT_EQUAL(false, pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
).GetValue());
639 pTxtObj
= dynamic_cast<SdrObjCustomShape
*>(pPage
->GetObj(3));
640 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
641 CPPUNIT_ASSERT_EQUAL(u
"Custom shape wrapped text"_ustr
,
642 pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
643 CPPUNIT_ASSERT_EQUAL(true, pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
).GetValue());
646 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testN828390
)
648 bool bPassed
= false;
649 createSdImpressDoc("pptx/n828390.pptx");
651 saveAndReload(u
"Impress Office Open XML"_ustr
);
653 const SdrPage
* pPage
= GetPage(1);
655 std::vector
<EECharAttrib
> rLst
;
657 SdrObject
* pObj
= pPage
->GetObj(0);
658 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pObj
);
659 CPPUNIT_ASSERT(pTxtObj
);
660 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
661 aEdit
.GetCharAttribs(0, rLst
);
662 bPassed
= std::any_of(rLst
.rbegin(), rLst
.rend(), [](const EECharAttrib
& rCharAttr
) {
663 const SvxEscapementItem
* pFontEscapement
664 = dynamic_cast<const SvxEscapementItem
*>(rCharAttr
.pAttr
);
665 return pFontEscapement
&& (pFontEscapement
->GetEsc() == -25);
668 CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed
);
671 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBnc880763
)
673 createSdImpressDoc("pptx/bnc880763.pptx");
674 saveAndReload(u
"Impress Office Open XML"_ustr
);
676 const SdrPage
* pPage
= GetPage(1);
678 // Check z-order of the two shapes, use background color to identify them
679 // First object in the background has blue background color
680 const SdrObjGroup
* pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(0));
681 CPPUNIT_ASSERT(pObjGroup
);
682 const SdrObject
* pObj
= pObjGroup
->GetSubList()->GetObj(1);
683 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
684 CPPUNIT_ASSERT_EQUAL(
686 (static_cast<const XColorItem
&>(pObj
->GetMergedItem(XATTR_FILLCOLOR
))).GetColorValue());
688 // Second object at the front has green background color
689 pObj
= pPage
->GetObj(1);
690 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
691 CPPUNIT_ASSERT_EQUAL(
693 (static_cast<const XColorItem
&>(pObj
->GetMergedItem(XATTR_FILLCOLOR
))).GetColorValue());
696 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBnc862510_5
)
698 createSdImpressDoc("pptx/bnc862510_5.pptx");
699 saveAndReload(u
"Impress Office Open XML"_ustr
);
701 const SdrPage
* pPage
= GetPage(1);
703 // Same as testBnc870237, but here we check the horizontal spacing
704 const SdrObjGroup
* pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(0));
705 CPPUNIT_ASSERT(pObjGroup
);
706 const SdrObject
* pObj
= pObjGroup
->GetSubList()->GetObj(2);
707 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
708 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_UPPERDIST
).GetValue());
709 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_LOWERDIST
).GetValue());
710 CPPUNIT_ASSERT_EQUAL(sal_Int32(7510), pObj
->GetMergedItem(SDRATTR_TEXT_RIGHTDIST
).GetValue());
711 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_LEFTDIST
).GetValue());
714 // In numbering a bullet could be defined as empty (no character).
715 // When exporting to OOXML make sure that the bullet is ignored and
716 // not written into the file.
717 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBnc822347_EmptyBullet
)
719 createSdImpressDoc("bnc822347_EmptyBullet.odp");
720 saveAndReload(u
"Impress Office Open XML"_ustr
);
722 SdXImpressDocument
* pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
723 CPPUNIT_ASSERT(pXImpressDocument
);
724 SdDrawDocument
* pDoc
= pXImpressDocument
->GetDoc();
725 SdrOutliner
* pOutliner
= pDoc
->GetInternalOutliner();
726 const SdrPage
* pPage
= pDoc
->GetPage(1);
727 SdrObject
* pObject
= pPage
->GetObj(0);
728 SdrTextObj
* pTextObject
= DynCastSdrTextObj(pObject
);
729 CPPUNIT_ASSERT(pTextObject
);
731 OutlinerParaObject
* pOutlinerParagraphObject
= pTextObject
->GetOutlinerParaObject();
732 const EditTextObject
& aEdit
= pOutlinerParagraphObject
->GetTextObject();
734 OUString sText
= aEdit
.GetText(0);
735 CPPUNIT_ASSERT_EQUAL(u
"M3 Feature Test"_ustr
, sText
);
737 pOutliner
->SetText(*pOutlinerParagraphObject
);
738 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner
->GetParagraphCount());
740 const sal_Int16 nDepth
= pOutliner
->GetDepth(0);
742 CPPUNIT_ASSERT_EQUAL(sal_Int16(-1),
743 nDepth
); // depth >= 0 means that the paragraph has bullets enabled
746 //Bullets not having any text following them are not getting exported to pptx correctly.
747 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testFdo90607
)
749 createSdImpressDoc("fdo90607.pptx");
750 saveAndReload(u
"Impress Office Open XML"_ustr
);
752 const SdrPage
* pPage
= GetPage(1);
753 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pPage
->GetObj(1));
754 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
755 OutlinerParaObject
* pOutlinerParagraphObject
= pTxtObj
->GetOutlinerParaObject();
756 const sal_Int16 nDepth
= pOutlinerParagraphObject
->GetDepth(0);
757 CPPUNIT_ASSERT_MESSAGE("not equal", nDepth
!= -1);
760 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testFdo83751
)
762 createSdImpressDoc("pptx/fdo83751.pptx");
763 saveAndReload(u
"Impress Office Open XML"_ustr
);
765 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier(
766 mxComponent
, uno::UNO_QUERY
);
767 uno::Reference
<document::XDocumentProperties
> xProps
768 = xDocumentPropertiesSupplier
->getDocumentProperties();
769 uno::Reference
<beans::XPropertySet
> xUDProps(xProps
->getUserDefinedProperties(),
772 xUDProps
->getPropertyValue(u
"Testing"_ustr
) >>= propValue
;
773 CPPUNIT_ASSERT_EQUAL(u
"Document"_ustr
, propValue
);
776 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testFdo79731
)
778 createSdImpressDoc("fdo79731.odp");
779 saveAndReload(u
"Impress Office Open XML"_ustr
);
780 SdXImpressDocument
* pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
781 CPPUNIT_ASSERT(pXImpressDocument
);
782 SdDrawDocument
* pDoc
= pXImpressDocument
->GetDoc();
783 CPPUNIT_ASSERT(pDoc
);
786 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTableCellFillProperties
)
788 // Load the original file
789 createSdImpressDoc("odp/Table_with_Cell_Fill.odp");
791 // Export the document and import again for a check
792 saveAndReload(u
"Impress Office Open XML"_ustr
);
794 const SdrPage
* pPage
= GetPage(1);
796 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
797 CPPUNIT_ASSERT(pTableObj
);
798 uno::Reference
<table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
799 uno::Reference
<beans::XPropertySet
> xCell
;
801 // Test Solid fill color
803 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
804 xCell
->getPropertyValue(u
"FillColor"_ustr
) >>= nColor
;
805 CPPUNIT_ASSERT_EQUAL(Color(0x66ffff), nColor
);
807 // Test Picture fill type for cell
808 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
809 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
810 xCell
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
811 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_BITMAP
), static_cast<int>(aFillStyle
));
813 // Test Gradient fill type for cell
814 xCell
.set(xTable
->getCellByPosition(1, 0), uno::UNO_QUERY_THROW
);
815 xCell
->getPropertyValue(u
"FillStyle"_ustr
) >>= aFillStyle
;
816 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_GRADIENT
), static_cast<int>(aFillStyle
));
819 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBulletStartNumber
)
821 createSdImpressDoc("pptx/n90255.pptx");
822 saveAndReload(u
"Impress Office Open XML"_ustr
);
824 const SdrPage
* pPage
= GetPage(1);
825 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pPage
->GetObj(0));
826 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
827 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
828 const SvxNumBulletItem
* pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
829 CPPUNIT_ASSERT(pNumFmt
);
830 CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet's start number is wrong!", sal_Int16(3),
831 sal_Int16(pNumFmt
->GetNumRule().GetLevel(0).GetStart()));
834 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testLineStyle
)
836 createSdImpressDoc("pptx/lineStyle.pptx");
837 saveAndReload(u
"Impress Office Open XML"_ustr
);
839 const SdrPage
* pPage
= GetPage(1);
840 SdrObject
const* pShape
= pPage
->GetObj(0);
841 CPPUNIT_ASSERT_MESSAGE("no shape", pShape
!= nullptr);
843 const XLineStyleItem
& rStyleItem
= pShape
->GetMergedItem(XATTR_LINESTYLE
);
844 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong style", int(drawing::LineStyle_SOLID
),
845 static_cast<int>(rStyleItem
.GetValue()));
848 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf134862
)
850 createSdImpressDoc("pptx/tdf134862.pptx");
851 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
853 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xShape
));
854 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
, uno::UNO_QUERY_THROW
);
856 sal_Int16 nWritingMode
= 0;
857 xPropSet
->getPropertyValue(u
"WritingMode"_ustr
) >>= nWritingMode
;
859 // Without the fix in place, this test would have failed here
860 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB
,
863 saveAndReload(u
"Impress Office Open XML"_ustr
);
865 xShape
.set(getShapeFromPage(0, 0));
867 xParagraph
.set(getParagraphFromShape(0, xShape
));
868 xPropSet
.set(xParagraph
, uno::UNO_QUERY_THROW
);
871 xPropSet
->getPropertyValue(u
"WritingMode"_ustr
) >>= nWritingMode
;
872 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB
,
876 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testRightToLeftParaghraph
)
878 createSdImpressDoc("pptx/rightToLeftParagraph.pptx");
880 saveAndReload(u
"Impress Office Open XML"_ustr
);
881 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
883 // Get first paragraph
884 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
885 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
, uno::UNO_QUERY_THROW
);
887 sal_Int16 nWritingMode
= 0;
888 xPropSet
->getPropertyValue(u
"WritingMode"_ustr
) >>= nWritingMode
;
889 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB
,
893 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTextboxWithHyperlink
)
895 createSdImpressDoc("pptx/hyperlinktest.pptx");
897 saveAndReload(u
"Impress Office Open XML"_ustr
);
898 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
900 // Get first paragraph
901 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
903 // first chunk of text
904 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
905 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
907 uno::Reference
<text::XTextField
> xField
;
908 xPropSet
->getPropertyValue(u
"TextField"_ustr
) >>= xField
;
909 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
911 xPropSet
.set(xField
, uno::UNO_QUERY
);
913 xPropSet
->getPropertyValue(u
"URL"_ustr
) >>= aURL
;
914 CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", u
"http://www.xkcd.com/"_ustr
, aURL
);
917 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf136911
)
919 createSdImpressDoc("ppt/tdf136911.ppt");
921 saveAndReload(u
"Impress Office Open XML"_ustr
);
922 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
924 // Get second paragraph
925 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
927 // first chunk of text
928 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
929 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
931 uno::Reference
<text::XTextField
> xField
;
932 xPropSet
->getPropertyValue(u
"TextField"_ustr
) >>= xField
;
933 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is());
935 xPropSet
.set(xField
, uno::UNO_QUERY
);
937 xPropSet
->getPropertyValue(u
"URL"_ustr
) >>= aURL
;
938 CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", u
"http://google.com"_ustr
, aURL
);
941 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBulletColor
)
943 createSdImpressDoc("pptx/bulletColor.pptx");
945 saveAndReload(u
"Impress Office Open XML"_ustr
);
947 const SdrPage
* pPage
= GetPage(1);
949 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pPage
->GetObj(0));
950 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
952 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
953 const SvxNumBulletItem
* pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
954 CPPUNIT_ASSERT(pNumFmt
);
955 CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet's color is wrong!", COL_LIGHTRED
,
956 pNumFmt
->GetNumRule().GetLevel(0).GetBulletColor());
959 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBulletCharAndFont
)
961 createSdImpressDoc("odp/bulletCharAndFont.odp");
962 saveAndReload(u
"Impress Office Open XML"_ustr
);
964 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
965 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
966 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
, uno::UNO_QUERY_THROW
);
968 uno::Reference
<container::XIndexAccess
> xLevels(
969 xPropSet
->getPropertyValue(u
"NumberingRules"_ustr
), uno::UNO_QUERY
);
970 uno::Sequence
<beans::PropertyValue
> aProps
;
971 xLevels
->getByIndex(0) >>= aProps
; // 1st level
972 OUString
sBulletChar(u
'\xf06c');
973 for (beans::PropertyValue
const& rProp
: aProps
)
975 if (rProp
.Name
== "BulletChar")
976 CPPUNIT_ASSERT_EQUAL_MESSAGE("BulletChar incorrect.", sBulletChar
,
977 rProp
.Value
.get
<OUString
>());
978 if (rProp
.Name
== "BulletFont")
980 awt::FontDescriptor aFontDescriptor
;
981 rProp
.Value
>>= aFontDescriptor
;
982 CPPUNIT_ASSERT_EQUAL_MESSAGE("BulletFont incorrect.", u
"Wingdings"_ustr
,
983 aFontDescriptor
.Name
);
988 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testBulletMarginAndIndentation
)
990 createSdImpressDoc("pptx/bulletMarginAndIndent.pptx");
991 saveAndReload(u
"Impress Office Open XML"_ustr
);
993 const SdrPage
* pPage
= GetPage(1);
995 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pPage
->GetObj(0));
996 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
998 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
999 const SvxNumBulletItem
* pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
1000 CPPUNIT_ASSERT(pNumFmt
);
1002 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1003 "Bullet's left margin is wrong!", sal_Int32(1000),
1004 pNumFmt
->GetNumRule().GetLevel(0).GetAbsLSpace()); // left margin is 0.79 cm
1005 CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet's indentation is wrong!", sal_Int32(-1000),
1006 pNumFmt
->GetNumRule().GetLevel(0).GetFirstLineOffset());
1009 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testParaMarginAndindentation
)
1011 createSdImpressDoc("pptx/paraMarginAndIndentation.pptx");
1013 saveAndReload(u
"Impress Office Open XML"_ustr
);
1014 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1016 // Get first paragraph
1017 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
1018 uno::Reference
<beans::XPropertySet
> xPropSet(xParagraph
, uno::UNO_QUERY_THROW
);
1020 sal_Int32 nParaLeftMargin
= 0;
1021 xPropSet
->getPropertyValue(u
"ParaLeftMargin"_ustr
) >>= nParaLeftMargin
;
1022 CPPUNIT_ASSERT_EQUAL(sal_uInt32(1000), sal_uInt32(nParaLeftMargin
));
1024 sal_Int32 nParaFirstLineIndent
= 0;
1025 xPropSet
->getPropertyValue(u
"ParaFirstLineIndent"_ustr
) >>= nParaFirstLineIndent
;
1026 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1270), nParaFirstLineIndent
);
1029 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testCellLeftAndRightMargin
)
1031 createSdImpressDoc("pptx/n90223.pptx");
1032 saveAndReload(u
"Impress Office Open XML"_ustr
);
1033 sal_Int32 nLeftMargin
, nRightMargin
;
1035 const SdrPage
* pPage
= GetPage(1);
1037 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1038 CPPUNIT_ASSERT(pTableObj
);
1040 uno::Reference
<css::table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_SET_THROW
);
1041 uno::Reference
<css::table::XMergeableCell
> xCell(xTable
->getCellByPosition(0, 0),
1042 uno::UNO_QUERY_THROW
);
1043 uno::Reference
<beans::XPropertySet
> xCellPropSet(xCell
, uno::UNO_QUERY_THROW
);
1045 uno::Any aLeftMargin
= xCellPropSet
->getPropertyValue(u
"TextLeftDistance"_ustr
);
1046 CPPUNIT_ASSERT(aLeftMargin
>>= nLeftMargin
);
1048 uno::Any aRightMargin
= xCellPropSet
->getPropertyValue(u
"TextRightDistance"_ustr
);
1049 CPPUNIT_ASSERT(aRightMargin
>>= nRightMargin
);
1051 // Convert values to EMU
1052 nLeftMargin
= oox::drawingml::convertHmmToEmu(nLeftMargin
);
1053 nRightMargin
= oox::drawingml::convertHmmToEmu(nRightMargin
);
1055 CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nLeftMargin
);
1056 CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nRightMargin
);
1059 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testMergedCells
)
1061 createSdImpressDoc("odp/cellspan.odp");
1062 saveAndReload(u
"Impress Office Open XML"_ustr
);
1063 const SdrPage
* pPage
= GetPage(1);
1065 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1067 CPPUNIT_ASSERT(pTableObj
);
1068 uno::Reference
<table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_SET_THROW
);
1069 uno::Reference
<text::XTextRange
> xText1(xTable
->getCellByPosition(3, 0), uno::UNO_QUERY_THROW
);
1070 CPPUNIT_ASSERT_EQUAL(u
"0,3"_ustr
, xText1
->getString());
1072 uno::Reference
<text::XTextRange
> xText2(xTable
->getCellByPosition(3, 2), uno::UNO_QUERY_THROW
);
1073 CPPUNIT_ASSERT_EQUAL(u
"2,3"_ustr
, xText2
->getString());
1076 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTableCellBorder
)
1078 createSdImpressDoc("pptx/n90190.pptx");
1079 saveAndReload(u
"Impress Office Open XML"_ustr
);
1081 const SdrPage
* pPage
= GetPage(1);
1083 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1084 CPPUNIT_ASSERT(pTableObj
);
1086 table::BorderLine2 aBorderLine
;
1088 uno::Reference
<table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_SET_THROW
);
1089 uno::Reference
<css::table::XMergeableCell
> xCell(xTable
->getCellByPosition(0, 0),
1090 uno::UNO_QUERY_THROW
);
1091 uno::Reference
<beans::XPropertySet
> xCellPropSet(xCell
, uno::UNO_QUERY_THROW
);
1093 xCellPropSet
->getPropertyValue(u
"LeftBorder"_ustr
) >>= aBorderLine
;
1094 // While importing the table cell border line width, it converts EMU->Hmm then divided result by 2.
1095 // To get original value of LineWidth need to multiple by 2.
1096 sal_Int32 nLeftBorder
= aBorderLine
.LineWidth
* 2;
1097 nLeftBorder
= oox::drawingml::convertHmmToEmu(nLeftBorder
);
1098 CPPUNIT_ASSERT(nLeftBorder
);
1099 CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), Color(ColorTransparency
, aBorderLine
.Color
));
1101 xCellPropSet
->getPropertyValue(u
"RightBorder"_ustr
) >>= aBorderLine
;
1102 sal_Int32 nRightBorder
= aBorderLine
.LineWidth
* 2;
1103 nRightBorder
= oox::drawingml::convertHmmToEmu(nRightBorder
);
1104 CPPUNIT_ASSERT(nRightBorder
);
1105 CPPUNIT_ASSERT_EQUAL(COL_WHITE
, Color(ColorTransparency
, aBorderLine
.Color
));
1107 xCellPropSet
->getPropertyValue(u
"TopBorder"_ustr
) >>= aBorderLine
;
1108 sal_Int32 nTopBorder
= aBorderLine
.LineWidth
* 2;
1109 nTopBorder
= oox::drawingml::convertHmmToEmu(nTopBorder
);
1110 CPPUNIT_ASSERT(nTopBorder
);
1111 CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), Color(ColorTransparency
, aBorderLine
.Color
));
1113 xCellPropSet
->getPropertyValue(u
"BottomBorder"_ustr
) >>= aBorderLine
;
1114 sal_Int32 nBottomBorder
= aBorderLine
.LineWidth
* 2;
1115 nBottomBorder
= oox::drawingml::convertHmmToEmu(nBottomBorder
);
1116 CPPUNIT_ASSERT(nBottomBorder
);
1117 CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), Color(ColorTransparency
, aBorderLine
.Color
));
1120 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf111884
)
1122 createSdImpressDoc("pptx/tdf111884.pptx");
1123 saveAndReload(u
"Impress Office Open XML"_ustr
);
1125 const SdrPage
* pPage
= GetPage(1);
1126 SdrObject
const* pShape
= pPage
->GetObj(2);
1127 CPPUNIT_ASSERT_MESSAGE("no shape", pShape
!= nullptr);
1129 // must be a group shape
1130 CPPUNIT_ASSERT_EQUAL(SdrObjKind::Group
, pShape
->GetObjIdentifier());
1133 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf112633
)
1135 // Load document and export it to a temporary file
1136 createSdImpressDoc("pptx/tdf112633.pptx");
1137 save(u
"Impress Office Open XML"_ustr
);
1139 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1140 xmlDocUniquePtr pRelsDoc
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
1142 // Check image with artistic effect exists in the slide
1143 assertXPath(pXmlDoc
,
1144 "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/"
1145 "a14:imgLayer/a14:imgEffect/a14:artisticPencilGrayscale",
1146 "pencilSize", u
"80");
1148 // Check there is a relation with the .wdp file that contains the backed up image
1149 OUString sEmbedId1
= getXPath(pXmlDoc
,
1150 "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:extLst/"
1151 "a:ext/a14:imgProps/a14:imgLayer",
1153 OUString sXmlPath
= "/rels:Relationships/rels:Relationship[@Id='" + sEmbedId1
+ "']";
1154 assertXPath(pRelsDoc
, OUStringToOString(sXmlPath
, RTL_TEXTENCODING_UTF8
), "Target",
1155 u
"../media/hdphoto1.wdp");
1157 // Check the .wdp file exists
1158 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
1159 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
),
1160 maTempFile
.GetURL());
1161 CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess
->hasByName(u
"ppt/media/hdphoto1.wdp"_ustr
)));
1164 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf128952
)
1166 createSdImpressDoc("pptx/tdf128952.pptx");
1167 save(u
"Impress Office Open XML"_ustr
);
1169 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1171 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", "x", u
"360");
1172 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", "y", u
"-360");
1173 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:ext", "cx", u
"1919880");
1174 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:ext", "cy", u
"1462680");
1177 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf127090
)
1179 createSdImpressDoc("pptx/tdf127090.odp");
1180 save(u
"Impress Office Open XML"_ustr
);
1182 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1184 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr", "rot", u
"-5400000");
1187 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testCustomXml
)
1189 // Load document and export it to a temporary file
1190 createSdImpressDoc("pptx/customxml.pptx");
1191 save(u
"Impress Office Open XML"_ustr
);
1193 xmlDocUniquePtr pXmlDoc
= parseExport(u
"customXml/item1.xml"_ustr
);
1194 CPPUNIT_ASSERT(pXmlDoc
);
1195 xmlDocUniquePtr pRelsDoc
= parseExport(u
"customXml/_rels/item1.xml.rels"_ustr
);
1196 CPPUNIT_ASSERT(pRelsDoc
);
1198 // Check there is a relation to itemProps1.xml.
1199 assertXPath(pRelsDoc
, "/rels:Relationships/rels:Relationship", 1);
1200 assertXPath(pRelsDoc
, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
1203 std::unique_ptr
<SvStream
> pStream
1204 = parseExportStream(maTempFile
.GetURL(), u
"ddp/ddpfile.xen"_ustr
);
1205 CPPUNIT_ASSERT(pStream
);
1208 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf94238
)
1210 // Load document and export it to a temporary file.
1211 createSdImpressDoc("pptx/tdf94238.pptx");
1212 save(u
"Impress Office Open XML"_ustr
);
1213 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
1214 CPPUNIT_ASSERT(xDoc
.is());
1216 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
1217 CPPUNIT_ASSERT(xPage
.is());
1219 uno::Reference
<beans::XPropertySet
> xShape(getShape(0, xPage
));
1220 CPPUNIT_ASSERT(xShape
.is());
1222 awt::Gradient2 aGradient
;
1223 CPPUNIT_ASSERT(xShape
->getPropertyValue(u
"FillGradient"_ustr
) >>= aGradient
);
1225 // Without the accompanying fix in place, this test would have failed with
1226 // the following details:
1227 // - aGradient.Style was awt::GradientStyle_ELLIPTICAL
1228 // - aGradient.YOffset was 70
1229 // - aGradient.Border was 0
1230 CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RADIAL
, aGradient
.Style
);
1231 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(100), aGradient
.YOffset
);
1232 // MCGR: 39->0 no border needed anymore with ooxml import
1233 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(0), aGradient
.Border
);
1235 // MCGR: Use the completely imported gradient to check for correctness
1236 const basegfx::BColorStops aColorStops
1237 = model::gradient::getColorStopsFromUno(aGradient
.ColorStops
);
1239 // Without the accompanying fix in place, this test would have failed with
1240 // 'Expected: 0, Actual : 10592673', i.e. the start color of the gradient
1242 CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops
.size());
1243 CPPUNIT_ASSERT_EQUAL(0.0, aColorStops
[0].getStopOffset());
1244 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(aColorStops
[0].getStopColor()));
1245 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 0.39000000000000001));
1246 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(aColorStops
[1].getStopColor()));
1247 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[2].getStopOffset(), 1.0));
1248 CPPUNIT_ASSERT_EQUAL(Color(0x8b8b8b), Color(aColorStops
[2].getStopColor()));
1251 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testPictureTransparency
)
1253 // Load document and export it to a temporary file.
1254 createSdImpressDoc("odp/image_transparency.odp");
1255 save(u
"Impress Office Open XML"_ustr
);
1256 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
1257 CPPUNIT_ASSERT(xDoc
.is());
1259 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
1260 CPPUNIT_ASSERT(xPage
.is());
1262 uno::Reference
<beans::XPropertySet
> xGraphicShape(getShape(0, xPage
));
1263 CPPUNIT_ASSERT(xGraphicShape
.is());
1265 sal_Int16 nTransparency
= 0;
1266 CPPUNIT_ASSERT(xGraphicShape
->getPropertyValue(u
"Transparency"_ustr
) >>= nTransparency
);
1267 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(51), nTransparency
);
1270 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf125554
)
1272 createSdImpressDoc("pptx/tdf125554.pptx");
1273 saveAndReload(u
"Impress Office Open XML"_ustr
);
1275 uno::Reference
<beans::XPropertySet
> xShape
= getShapeFromPage(0, 0);
1276 uno::Any aFillTransparenceGradientName
1277 = xShape
->getPropertyValue(u
"FillTransparenceGradientName"_ustr
);
1278 CPPUNIT_ASSERT(aFillTransparenceGradientName
.has
<OUString
>());
1279 // Without the accompanying fix in place, this test would have failed, i.e. the transparency of
1280 // the shape has no gradient, so it looked like a solid fill instead of a gradient fill.
1281 CPPUNIT_ASSERT(!aFillTransparenceGradientName
.get
<OUString
>().isEmpty());
1284 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testRoundtripOwnLineStyles
)
1286 // Load odp document and read the LineDash values.
1287 createSdImpressDoc("odp/LineStylesOwn.odp");
1288 uno::Reference
<drawing::XDrawPagesSupplier
> xDocodp(mxComponent
, uno::UNO_QUERY
);
1289 CPPUNIT_ASSERT(xDocodp
.is());
1290 uno::Reference
<drawing::XDrawPage
> xPageodp(xDocodp
->getDrawPages()->getByIndex(0),
1292 CPPUNIT_ASSERT(xPageodp
.is());
1293 drawing::LineDash aLineDashodp
[10];
1294 for (sal_uInt16 i
= 0; i
< 10; i
++)
1296 uno::Reference
<beans::XPropertySet
> xShapeodp(getShape(i
, xPageodp
));
1297 CPPUNIT_ASSERT(xShapeodp
.is());
1298 xShapeodp
->getPropertyValue(u
"LineDash"_ustr
) >>= aLineDashodp
[i
];
1301 // Save to pptx, reload and compare the LineDash values
1302 save(u
"Impress Office Open XML"_ustr
);
1303 uno::Reference
<drawing::XDrawPagesSupplier
> xDocpptx(mxComponent
, uno::UNO_QUERY
);
1304 CPPUNIT_ASSERT(xDocpptx
.is());
1305 uno::Reference
<drawing::XDrawPage
> xPagepptx(xDocpptx
->getDrawPages()->getByIndex(0),
1307 CPPUNIT_ASSERT(xPagepptx
.is());
1309 for (sal_uInt16 i
= 0; i
< 10; i
++)
1311 drawing::LineDash aLineDashpptx
;
1312 uno::Reference
<beans::XPropertySet
> xShapepptx(getShape(i
, xPagepptx
));
1313 CPPUNIT_ASSERT(xShapepptx
.is());
1314 xShapepptx
->getPropertyValue(u
"LineDash"_ustr
) >>= aLineDashpptx
;
1315 bool bIsSameLineDash
= (aLineDashodp
[i
].Style
== aLineDashpptx
.Style
1316 && aLineDashodp
[i
].Dots
== aLineDashpptx
.Dots
1317 && aLineDashodp
[i
].DotLen
== aLineDashpptx
.DotLen
1318 && aLineDashodp
[i
].Dashes
== aLineDashpptx
.Dashes
1319 && aLineDashodp
[i
].DashLen
== aLineDashpptx
.DashLen
1320 && aLineDashodp
[i
].Distance
== aLineDashpptx
.Distance
);
1321 CPPUNIT_ASSERT_MESSAGE("LineDash differ", bIsSameLineDash
);
1325 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testRoundtripPrstDash
)
1327 // load and save document, compare prstDash values in saved document with original.
1328 createSdImpressDoc("pptx/presetDashDot.pptx");
1329 save(u
"Impress Office Open XML"_ustr
);
1331 const OUString sOriginal
[]
1332 = { u
"dash"_ustr
, u
"dashDot"_ustr
, u
"dot"_ustr
, u
"lgDash"_ustr
,
1333 u
"lgDashDot"_ustr
, u
"lgDashDotDot"_ustr
, u
"sysDash"_ustr
, u
"sysDashDot"_ustr
,
1334 u
"sysDashDotDot"_ustr
, u
"sysDot"_ustr
};
1335 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1336 static constexpr OStringLiteral sStart
= "/p:sld/p:cSld/p:spTree/p:sp[";
1337 static constexpr OStringLiteral sEnd
= "]/p:spPr/a:ln/a:prstDash";
1338 for (sal_uInt16 i
= 0; i
< 10; i
++)
1340 OString sXmlPath
= sStart
+ OString::number(i
+ 1) + sEnd
;
1341 OUString sResaved
= getXPath(pXmlDoc
, sXmlPath
, "val");
1342 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong prstDash", sOriginal
[i
], sResaved
);
1345 // tdf#126746: Make sure that dash-dot pattern starts with the longer dash, as defined in OOXML
1346 // Make sure Style is drawing::DashStyle_RECTRELATIVE
1347 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY
);
1348 CPPUNIT_ASSERT(xDoc
.is());
1349 uno::Reference
<drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY
);
1350 CPPUNIT_ASSERT(xPage
.is());
1351 for (sal_uInt16 i
= 0; i
< 10; i
++)
1353 drawing::LineDash aLineDash
;
1354 uno::Reference
<beans::XPropertySet
> xShape(getShape(i
, xPage
));
1355 CPPUNIT_ASSERT(xShape
.is());
1356 xShape
->getPropertyValue(u
"LineDash"_ustr
) >>= aLineDash
;
1357 CPPUNIT_ASSERT_MESSAGE("First dash is short", aLineDash
.DotLen
>= aLineDash
.DashLen
);
1358 bool bIsRectRelative
= aLineDash
.Style
== drawing::DashStyle_RECTRELATIVE
;
1359 CPPUNIT_ASSERT_MESSAGE("not RECTRELATIVE", bIsRectRelative
);
1363 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testDashOnHairline
)
1365 // load and save document, make sure the custDash has 11 child elements.
1366 createSdImpressDoc("odp/tdf127267DashOnHairline.odp");
1367 save(u
"Impress Office Open XML"_ustr
);
1369 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1370 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:ln/a:custDash/a:ds", 11);
1373 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testNarrationNonMediaShape
)
1375 createSdImpressDoc("pptx/narration-non-media-shape.pptx");
1376 // Without the accompanying fix in place, this test would have failed,
1377 // beans::UnknownPropertyException was thrown.
1378 saveAndReload(u
"Impress Office Open XML"_ustr
);
1381 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testCustomshapeBitmapfillSrcrect
)
1383 createSdImpressDoc("pptx/customshape-bitmapfill-srcrect.pptx");
1384 save(u
"Impress Office Open XML"_ustr
);
1386 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1389 // We are preventing the side effect of DOCX improvement to PPTX case.
1390 // Without the accompanying fix in place, this test would have failed with:
1393 // - XPath '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect' number of nodes is incorrect
1394 // i.e. <a:srcRect> was exported as <a:fillRect> in <a:stretch>, which made part of the image
1397 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect");
1400 // Original values of attribute of l and r in xml files: <a:srcRect l="4393" r="4393"/>
1401 // No core feature for handling this. We add support to import filter. We crop the bitmap
1402 // physically during import and shouldn't export the l r t b attributes anymore. In the
1403 // future if we add core feature to LibreOffice, we should change the control value with
1406 assertXPathNoAttribute(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "l");
1407 assertXPathNoAttribute(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "r");
1408 assertXPathNoAttribute(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "t");
1409 assertXPathNoAttribute(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "b");
1412 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf100348FontworkBitmapFill
)
1414 createSdImpressDoc("odp/tdf100348_FontworkBitmapFill.odp");
1415 save(u
"Impress Office Open XML"_ustr
);
1417 // Make sure the fontwork shape has a blip bitmap fill and a colored outline.
1418 // Without the patch, fill and outline were black.
1419 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1420 static constexpr OString
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr"_ostr
);
1421 assertXPath(pXmlDoc
, sPathStart
+ "/a:blipFill/a:blip", 1);
1422 assertXPath(pXmlDoc
, sPathStart
+ "/a:ln/a:solidFill/a:srgbClr", "val", u
"ffbf00");
1425 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf100348FontworkGradientGlow
)
1427 createSdImpressDoc("odp/tdf100348_FontworkGradientGlow.odp");
1428 save(u
"Impress Office Open XML"_ustr
);
1430 // Make sure the fontwork shape has a gradient fill and a colored glow.
1431 // Without the patch, fill was black and no glow applied.
1432 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1433 static constexpr OString
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr"_ostr
);
1434 assertXPath(pXmlDoc
, sPathStart
+ "/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", u
"8d281e");
1435 assertXPath(pXmlDoc
, sPathStart
+ "/a:effectLst/a:glow", "rad", u
"63360");
1436 assertXPath(pXmlDoc
, sPathStart
+ "/a:effectLst/a:glow/a:srgbClr", "val", u
"ff4500");
1439 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf128345FullTransparentGradient
)
1441 createSdImpressDoc("odp/tdf128345_FullTransparentGradient.odp");
1442 save(u
"Impress Office Open XML"_ustr
);
1444 // Make sure the shape has no fill. Without the patch, fill was solid red.
1445 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1446 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
1449 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf128345GradientLinear
)
1451 createSdImpressDoc("odp/tdf128345_GradientLinear.odp");
1452 save(u
"Impress Office Open XML"_ustr
);
1454 // Make sure the shape has a lin fill. Without the patch, fill was solid red.
1455 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1456 static constexpr OString
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill"_ostr
);
1457 assertXPath(pXmlDoc
, sPathStart
+ "/a:lin", "ang", u
"3600000");
1458 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs", 2);
1459 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[1]", "pos", u
"25000");
1460 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[1]/a:srgbClr", "val", u
"ff0000");
1461 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", u
"20000");
1462 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[2]", "pos", u
"100000");
1463 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[2]/a:srgbClr", "val", u
"ff0000");
1464 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", u
"80000");
1467 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf128345GradientRadial
)
1469 createSdImpressDoc("odp/tdf128345_GradientRadial.odp");
1470 save(u
"Impress Office Open XML"_ustr
);
1472 // Make sure the shape has transparency. In OOXML alpha means 'opacity' with default
1473 // 100000 for full opak, so only the full transparency with val 0 should be written.
1474 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1475 static constexpr OString
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill"_ostr
);
1476 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs", 2);
1477 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[1]/a:srgbClr", "val", u
"ff0000");
1478 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 0);
1479 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[2]/a:srgbClr", "val", u
"ffffff");
1480 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", u
"0");
1483 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf128345GradientAxial
)
1485 // Without the patch, symmetric linear gradient with full transparence outside and
1486 // full opak in the middle were imported as full transparent.
1487 createSdImpressDoc("odp/tdf128345_GradientAxial.odp");
1488 saveAndReload(u
"Impress Office Open XML"_ustr
);
1489 uno::Reference
<beans::XPropertySet
> xShapePropSet(getShapeFromPage(0, 0));
1491 awt::Gradient2 aTransparenceGradient
;
1492 xShapePropSet
->getPropertyValue(u
"FillTransparenceGradient"_ustr
) >>= aTransparenceGradient
;
1494 // MCGR: Use the completely imported gradient to check for correctness
1495 const basegfx::BColorStops aColorStops
1496 = model::gradient::getColorStopsFromUno(aTransparenceGradient
.ColorStops
);
1498 CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops
.size());
1499 CPPUNIT_ASSERT_EQUAL(0.0, aColorStops
[0].getStopOffset());
1500 CPPUNIT_ASSERT_EQUAL(COL_WHITE
, Color(aColorStops
[0].getStopColor()));
1501 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 0.5));
1502 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, Color(aColorStops
[1].getStopColor()));
1503 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[2].getStopOffset(), 1.0));
1504 CPPUNIT_ASSERT_EQUAL(COL_WHITE
, Color(aColorStops
[2].getStopColor()));
1505 CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR
, aTransparenceGradient
.Style
);
1508 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf134969TransparencyOnColorGradient
)
1510 createSdImpressDoc("odp/tdf134969_TransparencyOnColorGradient.odp");
1511 save(u
"Impress Office Open XML"_ustr
);
1513 // Make sure the shape has a transparency in gradient stops.
1514 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1515 static constexpr OString
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill"_ostr
);
1516 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs", 2);
1517 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", u
"60000");
1518 assertXPath(pXmlDoc
, sPathStart
+ "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", u
"60000");
1521 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testArcTo
)
1523 createSdImpressDoc("pptx/arc-validiert.pptx");
1524 save(u
"Impress Office Open XML"_ustr
);
1526 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1527 static constexpr const char* sPath("//a:custGeom/a:pathLst/a:path/a:arcTo");
1528 assertXPath(pXmlDoc
, sPath
, "wR", u
"3");
1529 assertXPath(pXmlDoc
, sPath
, "hR", u
"3");
1530 assertXPath(pXmlDoc
, sPath
, "stAng", u
"1800000");
1531 assertXPath(pXmlDoc
, sPath
, "swAng", u
"2700000");
1534 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testNarrationMimeType
)
1536 createSdImpressDoc("pptx/narration.pptx");
1537 save(u
"Impress Office Open XML"_ustr
);
1538 xmlDocUniquePtr pXmlDoc
= parseExport(u
"[Content_Types].xml"_ustr
);
1539 // Without the accompanying fix in place, this test would have failed with:
1540 // - Expected: audio/mp4
1541 // - Actual : application/vnd.sun.star.media
1542 // i.e. the mime type of the narration was incorrect.
1543 assertXPath(pXmlDoc
,
1544 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.m4a']",
1545 "ContentType", u
"audio/mp4");
1547 // Check if the bitmap of the media shape is exported correctly.
1548 xmlDocUniquePtr pSlideDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1550 = getXPath(pSlideDoc
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip", "embed");
1551 xmlDocUniquePtr pRelsDoc
= parseExport(u
"ppt/slides/_rels/slide1.xml.rels"_ustr
);
1552 OUString aImagePath
= "/rels:Relationships/rels:Relationship[@Id='" + aImageId
+ "']";
1553 // Something like ../media/image2.png.
1554 OUString aImageStreamName
= getXPath(pRelsDoc
, aImagePath
.toUtf8(), "Target");
1555 OUString aImageAbsName
1556 = rtl::Uri::convertRelToAbs(u
"file:///ppt/slides/"_ustr
, aImageStreamName
);
1557 // Something like ppt/media/image2.png.
1558 OUString aImageRelName
;
1559 CPPUNIT_ASSERT(aImageAbsName
.startsWith("file:///", &aImageRelName
));
1560 std::unique_ptr
<SvStream
> pImageStream
= parseExportStream(maTempFile
.GetURL(), aImageRelName
);
1561 vcl::PngImageReader
aReader(*pImageStream
);
1562 BitmapEx aBitmapEx
= aReader
.read();
1563 // Without the accompanying fix in place, this test would have failed with:
1566 // i.e. the bitmap of the narration was lost, some default placeholder was exported instead.
1567 CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long
>(256), aBitmapEx
.GetSizePixel().Height());
1569 // Without the accompanying fix in place, this test would have failed with:
1572 // i.e. p:blipFill was missing its a:stretch child element, so the shape was invisible.
1573 assertXPath(pSlideDoc
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:stretch/a:fillRect", 1);
1575 // Without the accompanying fix in place, this test would have failed with:
1576 // - ... no attribute 'cmd' exist
1577 // i.e. '<p:cmd type="call">' was written instead of '<p:cmd type="call" cmd="playFrom(0.0)">'.
1578 assertXPath(pSlideDoc
, "//p:cmd", "cmd", u
"playFrom(0.0)");
1580 // Without the accompanying fix in place, this test would have failed with:
1583 // i.e. <p:childTnLst> had no <p:audio> children, the whole audio animation node was lost.
1584 assertXPath(pSlideDoc
, "//p:childTnLst/p:audio/p:cMediaNode", 1);
1586 // Without the accompanying fix in place, this test would have failed with:
1587 // - ... no attribute 'showWhenStopped' exist
1588 // i.e. <p:cMediaNode> had the default visibility -> bitmap was visible during slideshow.
1589 assertXPath(pSlideDoc
, "//p:childTnLst/p:audio/p:cMediaNode", "showWhenStopped", u
"0");
1591 // Without the accompanying fix in place, this test would have failed with:
1592 // - ... no attribute 'isNarration' exist
1593 // i.e. <p:audio> was not a narration -> could not mass-remove narrations on the UI.
1594 assertXPath(pSlideDoc
, "//p:childTnLst/p:audio", "isNarration", u
"1");
1597 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf150316
)
1599 createSdImpressDoc("odp/tdf150316.odp");
1600 save(u
"Impress Office Open XML"_ustr
);
1602 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1603 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:pPr", "indent", u
"-343080");
1606 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf140865Wordart3D
)
1608 createSdImpressDoc("pptx/tdf140865Wordart3D.pptx");
1609 save(u
"Impress Office Open XML"_ustr
);
1610 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1612 // without the fix in place a:sp3d was lost on round trip, and so extrusion was lost.
1613 static constexpr OString
sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr"_ostr
);
1614 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d", "extrusionH", u
"342900");
1615 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d", "contourW", u
"12700");
1616 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d/a:bevelT", "w", u
"114300");
1617 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d/a:bevelT", "h", u
"38100");
1618 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d/a:bevelT", "prst", u
"softRound");
1619 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d/a:bevelB", "h", u
"152400");
1620 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d/a:extrusionClr/a:srgbClr", "val", u
"990000");
1621 assertXPath(pXmlDoc
, sPathStart
+ "/a:sp3d/a:contourClr/a:srgbClr", "val", u
"009876");
1624 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf124457
)
1626 createSdImpressDoc("pptx/tdf124457.pptx");
1627 save(u
"Impress Office Open XML"_ustr
);
1629 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1631 assertXPath(pXmlDoc
,
1632 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1633 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par[1]/p:cTn",
1634 "repeatCount", u
"3000");
1636 assertXPath(pXmlDoc
,
1637 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/"
1638 "p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par[2]/p:cTn",
1639 "repeatCount", u
"indefinite");
1642 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf143126
)
1644 createSdImpressDoc("pptx/tdf143126.pptx");
1645 save(u
"Impress Office Open XML"_ustr
);
1647 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/presProps.xml"_ustr
);
1649 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr", "showNarration", u
"1");
1650 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr/p:sldRg", "st", u
"2");
1651 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr/p:sldRg", "end", u
"3");
1654 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf143129
)
1656 createSdImpressDoc("pptx/tdf143129.pptx");
1657 save(u
"Impress Office Open XML"_ustr
);
1659 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/presProps.xml"_ustr
);
1661 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr", "showNarration", u
"1");
1662 assertXPath(pXmlDoc
, "/p:presentationPr/p:showPr/p:custShow", "id", u
"0");
1665 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf118045
)
1667 createSdImpressDoc("odp/tdf118045.odp");
1668 save(u
"Impress Office Open XML"_ustr
);
1670 xmlDocUniquePtr pXmlDoc1
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1671 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:lnSpc/a:spcPct", "val",
1675 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf137675
)
1677 createSdImpressDoc("pptx/tdf137675.pptx");
1678 save(u
"Impress Office Open XML"_ustr
);
1680 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1681 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "fill",
1685 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1
, testTdf151134
)
1687 createSdImpressDoc("pptx/tdf151134.odp");
1688 save(u
"Impress Office Open XML"_ustr
);
1690 xmlDocUniquePtr pXmlDoc
= parseExport(u
"ppt/slides/slide1.xml"_ustr
);
1691 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", "lIns", u
"91440");
1694 CPPUNIT_PLUGIN_IMPLEMENT();
1696 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */