2 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of the LibreOffice project.
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #include <officecfg/Office/Common.hxx>
12 #include "sdmodeltestbase.hxx"
13 #include <comphelper/sequence.hxx>
14 #include <comphelper/sequenceashashmap.hxx>
15 #include <editeng/eeitem.hxx>
16 #include <editeng/editobj.hxx>
17 #include <editeng/numitem.hxx>
18 #include <editeng/unoprnms.hxx>
19 #include <docmodel/uno/UnoGradientTools.hxx>
21 #include <svx/xlineit0.hxx>
22 #include <svx/xlndsit.hxx>
23 #include <svx/svdoole2.hxx>
24 #include <svx/svdotable.hxx>
26 #include <com/sun/star/awt/FontUnderline.hpp>
27 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
28 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
29 #include <com/sun/star/drawing/FillStyle.hpp>
30 #include <com/sun/star/lang/Locale.hpp>
31 #include <com/sun/star/text/GraphicCrop.hpp>
32 #include <com/sun/star/text/WritingMode2.hpp>
36 class SdOOXMLExportTest3
: public SdModelTestBase
40 : SdModelTestBase("/sd/qa/unit/data/")
44 int testTdf115005_FallBack_Images(bool bAddReplacementImages
);
47 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf153105
)
49 createSdImpressDoc("odp/tdf153105.odp");
50 save("Impress Office Open XML");
52 xmlDocUniquePtr pXmlDoc1
= parseExport("ppt/slides/slide1.xml");
53 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:stretch/a:fillRect", "l",
55 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:stretch/a:fillRect", "t",
57 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:stretch/a:fillRect", "r",
59 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:bg/p:bgPr/a:blipFill/a:stretch/a:fillRect", "b",
63 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf92222
)
65 createSdImpressDoc("pptx/tdf92222.pptx");
66 save("Impress Office Open XML");
68 xmlDocUniquePtr pXmlDocTheme
= parseExport("ppt/theme/theme1.xml");
69 assertXPath(pXmlDocTheme
, "/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[1]", "w",
71 assertXPath(pXmlDocTheme
, "/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[2]", "w",
73 assertXPath(pXmlDocTheme
, "/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[3]", "w",
77 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf129430
)
79 createSdImpressDoc("odp/tdf129430.odp");
80 save("Impress Office Open XML");
82 xmlDocUniquePtr pXmlDoc1
= parseExport("ppt/slides/slide1.xml");
83 assertXPath(pXmlDoc1
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:lnSpc/a:spcPct",
87 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf114848
)
89 createSdImpressDoc("pptx/tdf114848.pptx");
90 save("Impress Office Open XML");
92 xmlDocUniquePtr pXmlDocTheme1
= parseExport("ppt/theme/theme1.xml");
93 assertXPath(pXmlDocTheme1
, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
97 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf147586
)
99 createSdImpressDoc("pptx/tdf147586.pptx");
100 save("Impress Office Open XML");
102 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
103 // Without the fix in place, this test would have failed with
104 // - Expected: 227fc7
106 assertXPath(pXmlDocContent
,
107 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p[1]/a:pPr/a:buClr/a:srgbClr", "val",
109 assertXPath(pXmlDocContent
,
110 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p[2]/a:pPr/a:buClr/a:srgbClr", "val",
114 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf68759
)
116 createSdImpressDoc("odp/tdf68759.odp");
117 save("Impress Office Open XML");
119 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
120 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "x",
122 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "y",
124 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "flipH", "1");
125 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "rot", "9600000");
126 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "x",
128 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "y",
130 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm", "flipH", "1");
131 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "x",
133 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "y",
137 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf127901
)
139 createSdImpressDoc("odp/tdf127901.odp");
140 save("Impress Office Open XML");
142 xmlDocUniquePtr pXmlDocContent1
= parseExport("ppt/slides/slide1.xml");
143 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright",
145 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast",
148 xmlDocUniquePtr pXmlDocContent2
= parseExport("ppt/slides/slide2.xml");
149 assertXPath(pXmlDocContent2
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1);
151 xmlDocUniquePtr pXmlDocContent3
= parseExport("ppt/slides/slide3.xml");
152 assertXPath(pXmlDocContent3
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel",
156 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf48735
)
158 createSdImpressDoc("odp/tdf48735.odp");
159 save("Impress Office Open XML");
161 xmlDocUniquePtr pXmlDocContent1
= parseExport("ppt/slides/slide1.xml");
162 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "b", "23627");
163 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "l", "23627");
164 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "r", "23627");
165 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "t", "18842");
168 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf90626
)
170 createSdImpressDoc("odp/tdf90626.odp");
171 save("Impress Office Open XML");
173 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
174 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:buSzPct",
176 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buSzPct",
178 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:buSzPct",
180 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[4]/a:pPr/a:buSzPct",
184 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf107608
)
186 createSdImpressDoc("pptx/tdf107608.pptx");
187 save("Impress Office Open XML");
189 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
190 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
192 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
193 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
194 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH
, aFillStyle
);
196 bool bBackgroundFill
= false;
197 xPropSet
->getPropertyValue("FillBackground") >>= bBackgroundFill
;
198 CPPUNIT_ASSERT(bBackgroundFill
);
200 Color nBackgroundColor
;
201 xPropSet
->getPropertyValue("FillColor") >>= nBackgroundColor
;
202 CPPUNIT_ASSERT_EQUAL(Color(0x92D050), nBackgroundColor
);
205 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf111786
)
207 // Export line transparency with the color
209 createSdImpressDoc("pptx/tdf111786.pptx");
210 save("Impress Office Open XML");
212 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
213 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
216 xPropSet
->getPropertyValue("LineColor") >>= nLineColor
;
217 CPPUNIT_ASSERT_EQUAL(Color(0x3465A4), nLineColor
);
219 sal_Int16 nTransparency
;
220 xPropSet
->getPropertyValue("LineTransparence") >>= nTransparency
;
221 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(33), nTransparency
);
224 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testFontScale
)
226 createSdImpressDoc("pptx/font-scale.pptx");
227 save("Impress Office Open XML");
228 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
230 // Rounding errors possible, approximate value (+/- 1%)
231 OUString sScale
= getXPath(
232 pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:normAutofit", "fontScale");
233 CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(81111), sScale
.toInt32(), 1000);
236 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testShapeAutofitPPTX
)
238 createSdImpressDoc("pptx/testShapeAutofit.pptx");
239 save("Impress Office Open XML");
240 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
241 CPPUNIT_ASSERT(pXmlDocContent
);
243 // TextAutoGrowHeight --> "Resize shape to fit text" --> true
244 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:spAutoFit", 1);
245 // TextAutoGrowHeight --> "Resize shape to fit text" --> false
246 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
249 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testLegacyShapeAutofitPPTX
)
251 createSdImpressDoc("odp/testLegacyShapeAutofit.odp");
252 save("Impress Office Open XML");
253 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
254 CPPUNIT_ASSERT(pXmlDocContent
);
256 // Text in a legacy rectangle
257 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:noAutofit", 1);
258 // Text in (closed) Polygon
259 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
260 // Text in a legacy ellipse
261 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr/a:noAutofit", 1);
264 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf115394
)
266 createSdImpressDoc("pptx/tdf115394.pptx");
267 save("Impress Office Open XML");
269 SdXImpressDocument
* pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
270 CPPUNIT_ASSERT(pXImpressDocument
);
271 SdDrawDocument
* pDoc
= pXImpressDocument
->GetDoc();
273 double fTransitionDuration
;
275 // Slow in MS formats
276 SdPage
* pPage1
= pDoc
->GetSdPage(0, PageKind::Standard
);
277 fTransitionDuration
= pPage1
->getTransitionDuration();
278 CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration
);
280 // Medium in MS formats
281 SdPage
* pPage2
= pDoc
->GetSdPage(1, PageKind::Standard
);
282 fTransitionDuration
= pPage2
->getTransitionDuration();
283 CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration
);
285 // Fast in MS formats
286 SdPage
* pPage3
= pDoc
->GetSdPage(2, PageKind::Standard
);
287 fTransitionDuration
= pPage3
->getTransitionDuration();
288 CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration
);
291 SdPage
* pPage4
= pDoc
->GetSdPage(3, PageKind::Standard
);
292 fTransitionDuration
= pPage4
->getTransitionDuration();
293 CPPUNIT_ASSERT_EQUAL(0.25, fTransitionDuration
);
295 SdPage
* pPage5
= pDoc
->GetSdPage(4, PageKind::Standard
);
296 fTransitionDuration
= pPage5
->getTransitionDuration();
297 CPPUNIT_ASSERT_EQUAL(4.25, fTransitionDuration
);
300 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf115394Zero
)
302 createSdImpressDoc("pptx/tdf115394-zero.pptx");
303 save("Impress Office Open XML");
304 double fTransitionDuration
;
306 SdXImpressDocument
* pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
307 CPPUNIT_ASSERT(pXImpressDocument
);
308 SdDrawDocument
* pDoc
= pXImpressDocument
->GetDoc();
309 SdPage
* pPage
= pDoc
->GetSdPage(0, PageKind::Standard
);
310 fTransitionDuration
= pPage
->getTransitionDuration();
311 CPPUNIT_ASSERT_EQUAL(0.01, fTransitionDuration
);
314 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf115005
)
316 createSdImpressDoc("odp/tdf115005.odp");
319 // additional checks of the output file
320 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
321 = packages::zip::ZipFileAccess::createWithURL(mxComponentContext
, maTempFile
.GetURL());
323 // check that the document contains original vector images
324 const uno::Sequence
<OUString
> names
= xNameAccess
->getElementNames();
326 for (OUString
const& s
: names
)
328 if (s
.endsWith(".svm"))
331 CPPUNIT_ASSERT_EQUAL(3, nSVMFiles
);
334 int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool bAddReplacementImages
)
336 createSdImpressDoc("odp/tdf115005_no_fallback_images.odp");
338 // check if fallback images were not created if AddReplacementImages=true/false
339 // set AddReplacementImages
341 std::shared_ptr
<comphelper::ConfigurationChanges
> batch(
342 comphelper::ConfigurationChanges::create());
343 if (!officecfg::Office::Common::Save::Graphic::AddReplacementImages::isReadOnly())
344 officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(
345 bAddReplacementImages
, batch
);
349 // save the file with already set options
352 // additional checks of the output file
353 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
354 = packages::zip::ZipFileAccess::createWithURL(mxComponentContext
, maTempFile
.GetURL());
356 // check that the document contains original vector images
357 const uno::Sequence
<OUString
> names
= xNameAccess
->getElementNames();
360 for (OUString
const& n
: names
)
362 if (n
.endsWith(".svm"))
364 if (n
.endsWith(".png") && n
!= "Thumbnails/thumbnail.png") // Ignore the thumbnail
369 CPPUNIT_ASSERT_EQUAL(1, nSVMFiles
);
373 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf115005_FallBack_Images_On
)
375 const int nPNGFiles
= testTdf115005_FallBack_Images(true);
376 CPPUNIT_ASSERT_EQUAL(1, nPNGFiles
);
379 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf115005_FallBack_Images_Off
)
381 const int nPNGFiles
= testTdf115005_FallBack_Images(false);
382 CPPUNIT_ASSERT_EQUAL(0, nPNGFiles
);
385 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf118806
)
387 createSdImpressDoc("odp/tdf118806.odp");
388 save("Impress Office Open XML");
390 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
391 assertXPath(pXmlDocContent
, "//p:animMotion", "origin", "layout");
394 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf130058
)
396 createSdImpressDoc("pptx/tdf130058.pptx");
397 save("Impress Office Open XML");
399 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
400 bool bHasShadow
= false;
401 xShape
->getPropertyValue("Shadow") >>= bHasShadow
;
402 CPPUNIT_ASSERT(bHasShadow
);
403 double fShadowDist
= 0.0;
404 xShape
->getPropertyValue("ShadowXDistance") >>= fShadowDist
;
405 CPPUNIT_ASSERT_EQUAL(static_cast<double>(0), fShadowDist
);
406 xShape
->getPropertyValue("ShadowYDistance") >>= fShadowDist
;
407 CPPUNIT_ASSERT_EQUAL(static_cast<double>(141), fShadowDist
);
409 xShape
->getPropertyValue("ShadowColor") >>= nColor
;
410 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, nColor
);
411 sal_Int32 nTransparency
= 0;
412 xShape
->getPropertyValue("ShadowTransparence") >>= nTransparency
;
413 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(57), nTransparency
);
414 double fShadowSizeX
= 0.0;
415 xShape
->getPropertyValue("ShadowSizeX") >>= fShadowSizeX
;
416 CPPUNIT_ASSERT_EQUAL(static_cast<double>(1000), fShadowSizeX
);
417 double fShadowSizeY
= 0.0;
418 xShape
->getPropertyValue("ShadowSizeY") >>= fShadowSizeY
;
419 CPPUNIT_ASSERT_EQUAL(static_cast<double>(1000), fShadowSizeY
);
422 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf111789
)
424 // Shadow properties were not exported for text shapes.
426 createSdImpressDoc("pptx/tdf111789.pptx");
427 save("Impress Office Open XML");
429 // First text shape has some shadow
431 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
432 bool bHasShadow
= false;
433 xShape
->getPropertyValue("Shadow") >>= bHasShadow
;
434 CPPUNIT_ASSERT(bHasShadow
);
435 double fShadowDist
= 0.0;
436 xShape
->getPropertyValue("ShadowXDistance") >>= fShadowDist
;
437 CPPUNIT_ASSERT_EQUAL(static_cast<double>(274), fShadowDist
);
438 xShape
->getPropertyValue("ShadowYDistance") >>= fShadowDist
;
439 CPPUNIT_ASSERT_EQUAL(static_cast<double>(274), fShadowDist
);
441 xShape
->getPropertyValue("ShadowColor") >>= nColor
;
442 CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), nColor
);
443 sal_Int32 nTransparency
= 0;
444 xShape
->getPropertyValue("ShadowTransparence") >>= nTransparency
;
445 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(7), nTransparency
);
446 double fShadowSizeX
= 0.0;
447 xShape
->getPropertyValue("ShadowSizeX") >>= fShadowSizeX
;
448 CPPUNIT_ASSERT_EQUAL(static_cast<double>(100000), fShadowSizeX
);
449 double fShadowSizeY
= 0.0;
450 xShape
->getPropertyValue("ShadowSizeY") >>= fShadowSizeY
;
451 CPPUNIT_ASSERT_EQUAL(static_cast<double>(100000), fShadowSizeY
);
454 // Second text shape has no shadow
456 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(1, 0));
457 bool bHasShadow
= false;
458 xShape
->getPropertyValue("Shadow") >>= bHasShadow
;
459 CPPUNIT_ASSERT(!bHasShadow
);
463 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf145162
)
465 createSdImpressDoc("pptx/tdf145162.pptx");
466 save("Impress Office Open XML");
467 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
469 assertXPath(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
470 // Before the fix, that tag was missing so PP put bullet to each para.
473 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testZeroIndentExport
)
475 // Load the bugdoc and save to pptx then.
477 createSdImpressDoc("odp/testZeroIndent.odp");
478 save("Impress Office Open XML");
479 // There are 3 slides, get them
480 xmlDocUniquePtr pSlide1
= parseExport("ppt/slides/slide1.xml");
481 xmlDocUniquePtr pSlide2
= parseExport("ppt/slides/slide2.xml");
482 xmlDocUniquePtr pSlide3
= parseExport("ppt/slides/slide3.xml");
484 CPPUNIT_ASSERT(pSlide1
);
485 CPPUNIT_ASSERT(pSlide2
);
486 CPPUNIT_ASSERT(pSlide3
);
488 // Each slide has 3 paragraphs, one full line, an empty and a normal para.
489 // Check the indent and bullet. These have to match with PP. Before the fix,
490 // they were different.
491 assertXPath(pSlide1
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
493 assertXPath(pSlide2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:buNone");
494 assertXPath(pSlide2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr", "indent", "0");
495 assertXPath(pSlide2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
496 assertXPath(pSlide2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr", "indent", "0");
497 assertXPath(pSlide2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:buNone");
498 assertXPath(pSlide2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr", "indent", "0");
500 assertXPath(pSlide3
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr", "indent", "0");
501 assertXPath(pSlide3
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
502 assertXPath(pSlide3
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr", "indent", "0");
503 assertXPath(pSlide3
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr", "indent", "0");
506 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf100348_convert_Fontwork2TextWarp
)
508 createSdImpressDoc("odp/tdf100348_Fontwork2TextWarp.odp");
509 save("Impress Office Open XML");
511 // Resulting pptx has to contain the TextWarp shape
512 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
513 const OString
sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp");
514 assertXPath(pXmlDocContent
, sPathStart
+ "[@prst='textWave1']");
515 const OString
sPathAdj(sPathStart
+ "/a:avLst/a:gd");
516 assertXPath(pXmlDocContent
, sPathAdj
+ "[@name='adj1' and @fmla='val 18750']");
517 assertXPath(pXmlDocContent
, sPathAdj
+ "[@name='adj2' and @fmla='val -7500']");
519 // Reloading has to get the Fontwork shape back
520 // TextPath makes a custom shape to a Fontwork shape, so must exist
521 uno::Reference
<beans::XPropertySet
> xShapeWavePropSet(getShapeFromPage(0, 0));
522 auto aGeomPropSeq
= xShapeWavePropSet
->getPropertyValue("CustomShapeGeometry")
523 .get
<uno::Sequence
<beans::PropertyValue
>>();
525 = comphelper::sequenceToContainer
<std::vector
<beans::PropertyValue
>>(aGeomPropSeq
);
526 OUString sName
= "TextPath";
527 auto aIterator
= std::find_if(
528 aGeomPropVec
.begin(), aGeomPropVec
.end(),
529 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
530 CPPUNIT_ASSERT_MESSAGE("No TextPath", aIterator
!= aGeomPropVec
.end());
532 // Type has to be same as in original document on roundtrip.
534 auto aIterator2
= std::find_if(
535 aGeomPropVec
.begin(), aGeomPropVec
.end(),
536 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
537 CPPUNIT_ASSERT_MESSAGE("No Type", aIterator2
!= aGeomPropVec
.end());
539 aIterator2
->Value
>>= sOwnName
;
540 CPPUNIT_ASSERT_EQUAL(OUString("fontwork-wave"), sOwnName
);
542 // Adjustmentvalues need to be the same.
543 sName
= "AdjustmentValues";
544 auto aIterator3
= std::find_if(
545 aGeomPropVec
.begin(), aGeomPropVec
.end(),
546 [sName
](const beans::PropertyValue
& rValue
) { return rValue
.Name
== sName
; });
547 CPPUNIT_ASSERT_MESSAGE("No AdjustmentValues", aIterator3
!= aGeomPropVec
.end());
548 uno::Sequence
<drawing::EnhancedCustomShapeAdjustmentValue
> aAdjValueSeq
;
549 aIterator3
->Value
>>= aAdjValueSeq
;
551 aAdjValueSeq
[0].Value
>>= fAdj1
;
553 aAdjValueSeq
[1].Value
>>= fAdj2
;
554 CPPUNIT_ASSERT_EQUAL(4050.0, fAdj1
); // odp values, not pptx values
555 CPPUNIT_ASSERT_EQUAL(9180.0, fAdj2
);
558 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125573_FontWorkScaleX
)
560 createSdImpressDoc("pptx/tdf125573_FontWorkScaleX.pptx");
561 save("Impress Office Open XML");
563 // Error was, that attribute 'fromWordArt' was ignored
564 // ensure, resulting pptx has fromWordArt="1" on textArchDown shape
565 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
566 assertXPath(pXmlDocContent
,
567 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr[@fromWordArt='1']");
569 // Error was, that text in legacy shapes of category "Follow Path" was not scaled to the path.
570 uno::Reference
<beans::XPropertySet
> xShapeArchProps(getShapeFromPage(0, 0));
571 awt::Rectangle aBoundRectArch
;
572 xShapeArchProps
->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT
) >>= aBoundRectArch
;
573 // BoundRect is DPI dependent, thus allow some range.
574 // Expected width is 13139 in 96dpi and is 13106 in 120 dpi, for example
575 // (Without fix Expected less than: 85 Actual : 10432)
576 CPPUNIT_ASSERT_LESS(sal_Int32(85), std::abs(aBoundRectArch
.Width
- 13139));
578 // Error was, that text in shapes of category "Warp" was not scaled to the path.
579 uno::Reference
<beans::XPropertySet
> xShapeWaveProps(getShapeFromPage(0, 1));
580 awt::Rectangle aBoundRectWave
;
581 xShapeWaveProps
->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT
) >>= aBoundRectWave
;
582 // BoundRect is DPI dependent, thus allow some range.
583 // Expected with is 11576 in 96dpt and is 11578 in 120dpi, for example
584 CPPUNIT_ASSERT_LESS(sal_Int32(85), std::abs(aBoundRectWave
.Width
- 11576));
587 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf99497_keepAppearanceOfCircleKind
)
589 // Error was, that all CircleKind were exported to 'ellipse'.
590 // Resulting pptx has to contain the customshapes of the corresponding kind
591 // slide 1 ARC -> arc, slide 2 CUT -> chord, slide 3 SECTION -> pie
592 // Adjustment values need to exist and their values need to correspond to the
593 // original angles. Shape 'arc' needs to be unfilled.
594 createSdImpressDoc("odp/tdf99497_CircleKind.odp");
595 save("Impress Office Open XML");
597 // slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> exists
598 xmlDocUniquePtr pXmlDocContent1
= parseExport("ppt/slides/slide1.xml");
599 const OString
sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
600 assertXPath(pXmlDocContent1
, sPathStart1
+ "[@prst='arc']");
601 const OString
sPathAdj1(sPathStart1
+ "/a:avLst/a:gd");
602 assertXPath(pXmlDocContent1
, sPathAdj1
+ "[@name='adj1' and @fmla='val 20493903']");
603 assertXPath(pXmlDocContent1
, sPathAdj1
+ "[@name='adj2' and @fmla='val 5400000']");
604 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
606 // slide 2 270° -> adj1 = 5400000, 180° -> adj2 = 10800000
607 xmlDocUniquePtr pXmlDocContent2
= parseExport("ppt/slides/slide2.xml");
608 const OString
sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
609 assertXPath(pXmlDocContent2
, sPathStart2
+ "[@prst='chord']");
610 const OString
sPathAdj2(sPathStart2
+ "/a:avLst/a:gd");
611 assertXPath(pXmlDocContent2
, sPathAdj2
+ "[@name='adj1' and @fmla='val 5400000']");
612 assertXPath(pXmlDocContent2
, sPathAdj2
+ "[@name='adj2' and @fmla='val 10800000']");
614 // slide 3 120° -> adj1 = 12600000, 30° -> adj2 = 20946396
615 xmlDocUniquePtr pXmlDocContent3
= parseExport("ppt/slides/slide3.xml");
616 const OString
sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom");
617 assertXPath(pXmlDocContent3
, sPathStart3
+ "[@prst='pie']");
618 const OString
sPathAdj3(sPathStart3
+ "/a:avLst/a:gd");
619 assertXPath(pXmlDocContent3
, sPathAdj3
+ "[@name='adj1' and @fmla='val 12600000']");
620 assertXPath(pXmlDocContent3
, sPathAdj3
+ "[@name='adj2' and @fmla='val 20946396']");
623 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf104792
)
625 createSdImpressDoc("pptx/tdf104792-smart-art-animation.pptx");
626 save("Impress Office Open XML");
628 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
629 assertXPath(pXmlDocContent
,
630 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/"
631 "p:par[1]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/"
632 "p:childTnLst[1]/p:set/p:cBhvr/p:tgtEl/p:spTgt",
636 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf90627
)
638 createSdImpressDoc("odp/tdf90627.odp");
639 save("Impress Office Open XML");
641 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
642 // Don't export empty endCondLst without cond.
643 assertXPath(pXmlDocContent
,
644 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/"
645 "p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/"
646 "p:endCondLst[not(*)]",
650 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf104786
)
652 createSdImpressDoc("pptx/tdf104786.pptx");
653 save("Impress Office Open XML");
655 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide2.xml");
656 // Don't export empty 'to'
657 assertXPath(pXmlDocContent
,
658 "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/"
659 "p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/"
660 "p:childTnLst/p:set[2]/p:to",
664 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf118783
)
666 createSdImpressDoc("odp/tdf118783.odp");
667 save("Impress Office Open XML");
669 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
670 OUString sAttributeName
671 = getXPathContent(pXmlDocContent
, "//p:animRot/p:cBhvr/p:attrNameLst/p:attrName");
672 CPPUNIT_ASSERT_EQUAL(OUString("r"), sAttributeName
);
675 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf104789
)
677 createSdImpressDoc("pptx/tdf104789.pptx");
678 save("Impress Office Open XML");
680 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
681 OUString sAttributeName
= getXPathContent(
682 pXmlDocContent
, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/"
683 "p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/"
684 "p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName");
685 CPPUNIT_ASSERT_EQUAL(OUString("style.opacity"), sAttributeName
);
688 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testOpenDocumentAsReadOnly
)
690 createSdImpressDoc("pptx/open-as-read-only.pptx");
691 SdXImpressDocument
* pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
692 CPPUNIT_ASSERT(pXImpressDocument
);
693 sd::DrawDocShell
* pDocShell
= pXImpressDocument
->GetDocShell();
694 CPPUNIT_ASSERT(pDocShell
->IsSecurityOptOpenReadOnly());
695 save("Impress Office Open XML");
696 pXImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
697 CPPUNIT_ASSERT(pXImpressDocument
);
698 pDocShell
= pXImpressDocument
->GetDocShell();
699 CPPUNIT_ASSERT(pDocShell
->IsSecurityOptOpenReadOnly());
702 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf118835
)
704 createSdImpressDoc("odp/tdf118835.odp");
705 save("Impress Office Open XML");
707 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
708 assertXPath(pXmlDocContent
, "(//p:animClr)[1]", "clrSpc", "rgb");
709 assertXPathContent(pXmlDocContent
, "(//p:animClr)[1]//p:attrName", "style.color");
710 assertXPath(pXmlDocContent
, "(//p:animClr)[1]//p:to/a:srgbClr", "val", "ed1c24");
712 assertXPath(pXmlDocContent
, "(//p:animClr)[2]", "clrSpc", "rgb");
713 assertXPathContent(pXmlDocContent
, "(//p:animClr)[2]//p:attrName", "stroke.color");
714 assertXPath(pXmlDocContent
, "(//p:animClr)[2]//p:to/a:srgbClr", "val", "333399");
716 assertXPath(pXmlDocContent
, "(//p:animClr)[3]", "clrSpc", "rgb");
717 assertXPathContent(pXmlDocContent
, "(//p:animClr)[3]//p:attrName", "fillcolor");
718 assertXPath(pXmlDocContent
, "(//p:animClr)[3]//p:to/a:srgbClr", "val", "fcd3c1");
720 assertXPath(pXmlDocContent
, "(//p:animClr)[5]", "clrSpc", "hsl");
721 assertXPathContent(pXmlDocContent
, "(//p:animClr)[5]//p:attrName", "fillcolor");
722 assertXPath(pXmlDocContent
, "(//p:animClr)[5]//p:by/p:hsl", "h", "10800000");
723 assertXPath(pXmlDocContent
, "(//p:animClr)[5]//p:by/p:hsl", "s", "0");
724 assertXPath(pXmlDocContent
, "(//p:animClr)[5]//p:by/p:hsl", "l", "0");
727 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf118768
)
729 createSdImpressDoc("odp/tdf118768-brake.odp");
730 save("Impress Office Open XML");
732 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
733 assertXPath(pXmlDocContent
, "//p:anim[1]", "from", "(-#ppt_w/2)");
734 assertXPath(pXmlDocContent
, "//p:anim[1]", "to", "(#ppt_x)");
735 assertXPath(pXmlDocContent
, "//p:anim[2]", "from", "0");
737 assertXPath(pXmlDocContent
, "//p:anim[2]", "to", "-1");
738 assertXPath(pXmlDocContent
, "//p:anim[2]/p:cBhvr/p:cTn", "autoRev", "1");
740 assertXPath(pXmlDocContent
, "//p:anim[3]", "by", "(#ppt_h/3+#ppt_w*0.1)");
741 assertXPath(pXmlDocContent
, "//p:anim[3]/p:cBhvr/p:cTn", "autoRev", "1");
744 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf118836
)
746 createSdImpressDoc("odp/tdf118836.odp");
747 save("Impress Office Open XML");
749 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
750 assertXPath(pXmlDocContent
, "//p:animScale/p:by", "x", "250000");
751 assertXPath(pXmlDocContent
, "//p:animScale/p:by", "y", "250000");
754 static double getAdjustmentValue(const uno::Reference
<beans::XPropertySet
>& xSet
)
757 = xSet
->getPropertyValue("CustomShapeGeometry").get
<uno::Sequence
<beans::PropertyValue
>>();
759 = comphelper::sequenceToContainer
<std::vector
<beans::PropertyValue
>>(aGeomPropSeq
);
761 auto aIterator
= std::find_if(
762 aGeomPropVec
.begin(), aGeomPropVec
.end(),
763 [](const beans::PropertyValue
& rValue
) { return rValue
.Name
== "AdjustmentValues"; });
765 if (aIterator
!= aGeomPropVec
.end())
767 uno::Sequence
<drawing::EnhancedCustomShapeAdjustmentValue
> aAdjustment
;
768 double fResult
= 0.0;
769 aIterator
->Value
>>= aAdjustment
;
770 aAdjustment
[0].Value
>>= fResult
;
777 static bool getScaleXValue(const uno::Reference
<beans::XPropertySet
>& xSet
)
779 bool bScaleX
= false;
782 = xSet
->getPropertyValue("CustomShapeGeometry").get
<uno::Sequence
<beans::PropertyValue
>>();
784 = comphelper::sequenceToContainer
<std::vector
<beans::PropertyValue
>>(aGeomPropSeq
);
786 auto aIterator
= std::find_if(
787 aGeomPropVec
.begin(), aGeomPropVec
.end(),
788 [](const beans::PropertyValue
& rValue
) { return rValue
.Name
== "TextPath"; });
790 if (aIterator
!= aGeomPropVec
.end())
792 uno::Sequence
<beans::PropertyValue
> aTextPathProperties
;
793 aIterator
->Value
>>= aTextPathProperties
;
794 auto aIterator2
= std::find_if(
795 std::cbegin(aTextPathProperties
), std::cend(aTextPathProperties
),
796 [](const beans::PropertyValue
& rValue
) { return rValue
.Name
== "ScaleX"; });
798 if (aIterator2
!= std::cend(aTextPathProperties
))
800 aIterator2
->Value
>>= bScaleX
;
807 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf116350TextEffects
)
809 createSdImpressDoc("pptx/tdf116350-texteffects.pptx");
811 // Default angle for ArchUp
812 uno::Reference
<beans::XPropertySet
> xShape0(getShapeFromPage(0, 0));
813 double fAdjust
= getAdjustmentValue(xShape0
);
814 CPPUNIT_ASSERT_EQUAL(180.0, fAdjust
);
816 bool bScaleX
= getScaleXValue(xShape0
);
817 CPPUNIT_ASSERT_EQUAL(true, bScaleX
);
819 // Default angle for ArchDown
820 uno::Reference
<beans::XPropertySet
> xShape14(getShapeFromPage(14, 0));
821 fAdjust
= getAdjustmentValue(xShape14
);
822 CPPUNIT_ASSERT_EQUAL(0.0, fAdjust
);
824 bScaleX
= getScaleXValue(xShape14
);
825 CPPUNIT_ASSERT_EQUAL(true, bScaleX
);
827 // Angle directly set
828 uno::Reference
<beans::XPropertySet
> xShape1(getShapeFromPage(1, 0));
829 fAdjust
= getAdjustmentValue(xShape1
);
830 CPPUNIT_ASSERT_EQUAL(213.25, fAdjust
);
832 bScaleX
= getScaleXValue(xShape1
);
833 CPPUNIT_ASSERT_EQUAL(true, bScaleX
);
836 save("Impress Office Open XML");
838 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
839 assertXPath(pXmlDocContent
, "//p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textArchUp");
840 assertXPath(pXmlDocContent
, "//p:sp[14]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textCircle");
841 assertXPath(pXmlDocContent
, "//p:sp[14]/p:spPr/a:solidFill/a:srgbClr", 0);
844 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf128096
)
846 createSdImpressDoc("odp/tdf128096.odp");
847 save("Impress Office Open XML");
849 xmlDocUniquePtr pXmlDocContent1
= parseExport("ppt/slides/slide1.xml");
850 assertXPath(pXmlDocContent1
,
851 "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val",
854 // Check that underlined content is also highlighted
855 xmlDocUniquePtr pXmlDocContent2
= parseExport("ppt/slides/slide2.xml");
856 assertXPath(pXmlDocContent2
,
857 "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val",
860 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf120573
)
862 createSdImpressDoc("pptx/tdf120573.pptx");
863 save("Impress Office Open XML");
865 xmlDocUniquePtr pXmlDoc
= parseExport("ppt/slides/slide1.xml");
866 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:audioFile", 1);
867 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile", 0);
869 xmlDocUniquePtr pXmlDocRels
= parseExport("ppt/slides/_rels/slide1.xml.rels");
870 assertXPath(pXmlDocRels
,
871 "(/rels:Relationships/rels:Relationship[@Target='../media/media1.wav'])[1]", "Type",
872 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
874 xmlDocUniquePtr pXmlContentType
= parseExport("[Content_Types].xml");
875 assertXPath(pXmlContentType
,
876 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.wav']",
877 "ContentType", "audio/x-wav");
880 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf119118
)
882 createSdImpressDoc("pptx/tdf119118.pptx");
883 save("Impress Office Open XML");
884 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
885 assertXPath(pXmlDocContent
, "//p:iterate", "type", "lt");
886 assertXPath(pXmlDocContent
, "//p:tmAbs", "val", "200");
889 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf99213
)
891 createSdImpressDoc("odp/tdf99213-target-missing.odp");
892 save("Impress Office Open XML");
893 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
894 // Number of nodes with p:attrNameLst was 3, including one that missed tgtEl
895 assertXPath(pXmlDocContent
, "//p:attrNameLst", 2);
896 // Timenode that miss its target element should be filtered.
897 assertXPath(pXmlDocContent
, "//p:attrNameLst/preceding-sibling::p:tgtEl", 2);
900 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testPotxExport
)
902 // Create new document
903 createSdImpressDoc();
905 // Export as a POTM template
906 save("Impress Office Open XML Template");
908 // Load and check content type
909 xmlDocUniquePtr pContentTypes
= parseExport("[Content_Types].xml");
910 CPPUNIT_ASSERT(pContentTypes
);
911 assertXPath(pContentTypes
,
912 "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']",
914 "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml");
917 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf44223
)
919 createSdImpressDoc("pptx/tdf44223.pptx");
920 save("Impress Office Open XML");
922 std::unique_ptr
<SvStream
> const pStream1(
923 parseExportStream(maTempFile
.GetURL(), "ppt/media/audio1.wav"));
924 CPPUNIT_ASSERT_EQUAL(sal_uInt64(11140), pStream1
->remainingSize());
926 std::unique_ptr
<SvStream
> const pStream2(
927 parseExportStream(maTempFile
.GetURL(), "ppt/media/audio2.wav"));
928 CPPUNIT_ASSERT_EQUAL(sal_uInt64(28074), pStream2
->remainingSize());
930 xmlDocUniquePtr pXmlContentType
= parseExport("[Content_Types].xml");
931 assertXPath(pXmlContentType
,
932 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio1.wav']",
933 "ContentType", "audio/x-wav");
935 assertXPath(pXmlContentType
,
936 "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio2.wav']",
937 "ContentType", "audio/x-wav");
939 xmlDocUniquePtr pDoc1
= parseExport("ppt/slides/slide1.xml");
941 // tdf#124230 all nodes were under p:childTnLst, but event triggered nodes need
942 // to be under p:subTnLst, especially for audio to work correctly.
943 // Start condition: 0s after timenode id 5 begins.
944 assertXPath(pDoc1
, "//p:subTnLst/p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt",
946 assertXPath(pDoc1
, "//p:subTnLst/p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", "0");
947 assertXPath(pDoc1
, "//p:subTnLst/p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond/p:tn", "val",
950 xmlDocUniquePtr pDoc2
= parseExport("ppt/slides/slide2.xml");
951 assertXPath(pDoc2
, "//p:transition/p:sndAc/p:stSnd/p:snd[@r:embed]", 2);
953 xmlDocUniquePtr pRels1
= parseExport("ppt/slides/_rels/slide1.xml.rels");
954 assertXPath(pRels1
, "//rels:Relationship[@Id='rId1']", "Type",
955 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
956 assertXPath(pRels1
, "//rels:Relationship[@Id='rId1']", "Target", "../media/audio1.wav");
959 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf135843
)
961 createSdImpressDoc("pptx/tdf135843_export.pptx");
962 save("Impress Office Open XML");
964 xmlDocUniquePtr pXmlDoc
= parseExport("ppt/slides/slide1.xml");
965 const OString
sPathStart("/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl");
966 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[1]/a:tc[1]/a:tcPr/a:lnL/a:solidFill");
967 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[1]/a:tc[1]/a:tcPr/a:lnR/a:solidFill");
968 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[1]/a:tc[1]/a:tcPr/a:lnT/a:solidFill");
969 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[1]/a:tc[1]/a:tcPr/a:lnB/a:solidFill");
971 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[2]/a:tc[1]/a:tcPr/a:lnL/a:solidFill");
972 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[2]/a:tc[1]/a:tcPr/a:lnR/a:solidFill");
973 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[2]/a:tc[1]/a:tcPr/a:lnT/a:solidFill");
974 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[2]/a:tc[1]/a:tcPr/a:lnB/a:solidFill");
976 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[3]/a:tc[1]/a:tcPr/a:lnL/a:solidFill");
977 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[3]/a:tc[1]/a:tcPr/a:lnR/a:solidFill");
978 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[3]/a:tc[1]/a:tcPr/a:lnT/a:solidFill");
979 assertXPath(pXmlDoc
, sPathStart
+ "/a:tr[3]/a:tc[1]/a:tcPr/a:lnB/a:solidFill");
982 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testSmartArtPreserve
)
984 createSdImpressDoc("pptx/smartart-preserve.pptx");
985 save("Impress Office Open XML");
987 xmlDocUniquePtr pXmlDoc
= parseExport("ppt/slides/slide1.xml");
988 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr");
990 "//p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/dgm:relIds");
992 "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext",
993 "uri", "{D42A27DB-BD31-4B8C-83A1-F6EECF244321}");
994 assertXPath(pXmlDoc
, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/"
995 "p:extLst/p:ext/p14:modId");
997 xmlDocUniquePtr pXmlDocRels
= parseExport("ppt/slides/_rels/slide1.xml.rels");
1000 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/layout1.xml'])[1]", "Type",
1001 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout");
1003 pXmlDocRels
, "(/rels:Relationships/rels:Relationship[@Target='../diagrams/data1.xml'])[1]",
1004 "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData");
1007 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/colors1.xml'])[1]", "Type",
1008 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors");
1011 "(/rels:Relationships/rels:Relationship[@Target='../diagrams/quickStyle1.xml'])[1]", "Type",
1012 "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle");
1014 xmlDocUniquePtr pXmlContentType
= parseExport("[Content_Types].xml");
1015 assertXPath(pXmlContentType
,
1016 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/layout1.xml']",
1018 "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml");
1019 assertXPath(pXmlContentType
,
1020 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/data1.xml']",
1022 "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml");
1023 assertXPath(pXmlContentType
,
1024 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/colors1.xml']",
1026 "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml");
1029 "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/quickStyle1.xml']",
1030 "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml");
1033 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125346
)
1035 // There are two themes in the test document, make sure we use the right theme
1037 createSdImpressDoc("pptx/tdf125346.pptx");
1038 save("Impress Office Open XML");
1040 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1041 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
1043 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
1044 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
1045 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
1048 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
1049 CPPUNIT_ASSERT_EQUAL(Color(0x90C226), nFillColor
);
1052 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125346_2
)
1054 // There are two themes in the test document, make sure we use the right theme
1055 // Test more slides with different themes
1057 createSdImpressDoc("pptx/tdf125346_2.pptx");
1058 save("Impress Office Open XML");
1061 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1062 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
1064 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
1065 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
1066 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
1069 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
1070 CPPUNIT_ASSERT_EQUAL(Color(0x90C226), nFillColor
);
1074 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 1));
1075 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
1077 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
1078 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
1079 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
1082 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
1083 CPPUNIT_ASSERT_EQUAL(Color(0x052F61), nFillColor
);
1087 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 2));
1088 uno::Reference
<beans::XPropertySet
> xPropSet(xShape
, uno::UNO_SET_THROW
);
1090 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
1091 xPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
1092 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID
, aFillStyle
);
1095 xPropSet
->getPropertyValue("FillColor") >>= nFillColor
;
1096 CPPUNIT_ASSERT_EQUAL(Color(0x90C226), nFillColor
);
1100 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125360
)
1102 // Check whether the changed fill transparency is exported correctly.
1103 // Color is defined by shape style
1105 createSdImpressDoc("pptx/tdf125360.pptx");
1107 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1109 xShape
->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32
>(23)));
1111 save("Impress Office Open XML");
1113 xShape
.set(getShapeFromPage(0, 0));
1115 sal_Int32 nTransparence
= 0;
1116 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
1117 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
1120 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125360_1
)
1122 // Check whether the changed fill transparency is exported correctly.
1123 // Color is defined by color scheme
1125 createSdImpressDoc("pptx/tdf125360_1.pptx");
1127 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1129 xShape
->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32
>(23)));
1131 save("Impress Office Open XML");
1133 xShape
.set(getShapeFromPage(0, 0));
1135 sal_Int32 nTransparence
= 0;
1136 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
1137 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
1140 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125360_2
)
1142 // Check whether the changed fill transparency is exported correctly.
1143 // Color is defined by color scheme with a transparency
1145 createSdImpressDoc("pptx/tdf125360_2.pptx");
1147 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1149 sal_Int32 nTransparence
= 0;
1150 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
1151 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(82), nTransparence
);
1153 xShape
->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32
>(23)));
1155 save("Impress Office Open XML");
1157 xShape
.set(getShapeFromPage(0, 0));
1160 xShape
->getPropertyValue("FillTransparence") >>= nTransparence
;
1161 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(23), nTransparence
);
1164 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125551
)
1166 createSdImpressDoc("pptx/tdf125551.pptx");
1167 save("Impress Office Open XML");
1169 uno::Reference
<drawing::XShapes
> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY
);
1170 uno::Reference
<drawing::XShape
> xShapeBg(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1172 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1024), xShapeBg
->getPosition().X
);
1173 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(576), xShapeBg
->getPosition().Y
);
1174 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(10816), xShapeBg
->getSize().Width
);
1175 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8588), xShapeBg
->getSize().Height
);
1178 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf136830
)
1180 createSdImpressDoc("pptx/tdf136830.pptx");
1181 save("Impress Office Open XML");
1183 // Without the fix in place, the X position of the shapes would have been 0
1184 uno::Reference
<drawing::XShapes
> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY
);
1186 uno::Reference
<drawing::XShape
> xShape1(xGroupShape
->getByIndex(0), uno::UNO_QUERY
);
1187 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(14134), xShape1
->getPosition().X
);
1188 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(-5321), xShape1
->getPosition().Y
);
1190 uno::Reference
<drawing::XShape
> xShape2(xGroupShape
->getByIndex(1), uno::UNO_QUERY
);
1191 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8085), xShape2
->getPosition().X
);
1192 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8085), xShape2
->getPosition().Y
);
1194 uno::Reference
<drawing::XShape
> xShape3(xGroupShape
->getByIndex(2), uno::UNO_QUERY
);
1195 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(8283), xShape3
->getPosition().X
);
1196 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(4620), xShape3
->getPosition().Y
);
1199 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf126234
)
1201 createSdImpressDoc("pptx/tdf126234.pptx");
1202 save("Impress Office Open XML");
1204 // check relative size of the bullet, 400% is a legitimate value for MS Office document
1205 // Without a fix, it will fail to set the size correctly
1206 const SdrPage
* pPage
= GetPage(1);
1207 SdrTextObj
* pTxtObj
= DynCastSdrTextObj(pPage
->GetObj(0));
1208 CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj
!= nullptr);
1209 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
1210 const SvxNumBulletItem
* pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
1211 CPPUNIT_ASSERT(pNumFmt
);
1212 CPPUNIT_ASSERT_EQUAL(sal_uInt16(400), pNumFmt
->GetNumRule().GetLevel(0).GetBulletRelSize());
1215 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf126741
)
1217 createSdImpressDoc("pptx/tdf126741.pptx");
1218 save("Impress Office Open XML");
1220 // dash dot dot line style import fix
1221 // The original fixed values are replaced with the percent values, because
1222 // with fix for tdf#127166 the MS Office preset styles are correctly detected.
1223 const SdrPage
* pPage
= GetPage(1);
1224 SdrObject
* const pObj
= pPage
->GetObj(0);
1225 CPPUNIT_ASSERT(pObj
);
1227 const XLineStyleItem
& rStyleItem
= pObj
->GetMergedItem(XATTR_LINESTYLE
);
1228 const XLineDashItem
& rDashItem
= pObj
->GetMergedItem(XATTR_LINEDASH
);
1230 CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH
, rStyleItem
.GetValue());
1231 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem
.GetDashValue().GetDots());
1232 CPPUNIT_ASSERT_EQUAL(800.0, rDashItem
.GetDashValue().GetDotLen());
1233 CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem
.GetDashValue().GetDashes());
1234 CPPUNIT_ASSERT_EQUAL(100.0, rDashItem
.GetDashValue().GetDashLen());
1235 CPPUNIT_ASSERT_EQUAL(300.0, rDashItem
.GetDashValue().GetDistance());
1238 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf127372
)
1240 createSdImpressDoc("odp/tdf127372.odp");
1241 saveAndReload("Impress Office Open XML");
1242 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1243 awt::Gradient2 aTransparenceGradient
;
1244 xShape
->getPropertyValue("FillTransparenceGradient") >>= aTransparenceGradient
;
1246 // MCGR: Use the completely imported gradient to check for correctness
1247 const basegfx::BColorStops aColorStops
1248 = model::gradient::getColorStopsFromUno(aTransparenceGradient
.ColorStops
);
1250 CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops
.size());
1251 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[0].getStopOffset(), 0.0));
1252 CPPUNIT_ASSERT_EQUAL(aColorStops
[0].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0));
1253 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 1.0));
1254 CPPUNIT_ASSERT_EQUAL(aColorStops
[1].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0));
1257 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf127379
)
1259 createSdImpressDoc("odp/tdf127379.odp");
1260 saveAndReload("Impress Office Open XML");
1261 uno::Reference
<drawing::XDrawPagesSupplier
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
1262 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDoc
->getDrawPages()->getCount());
1264 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1265 uno::Reference
<beans::XPropertySet
> xPropSet(xPage
, uno::UNO_QUERY
);
1267 uno::Any aAny
= xPropSet
->getPropertyValue("Background");
1268 CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny
.hasValue());
1269 uno::Reference
<beans::XPropertySet
> aXBackgroundPropSet
;
1270 aAny
>>= aXBackgroundPropSet
;
1272 drawing::FillStyle
aFillStyle(drawing::FillStyle_NONE
);
1273 aXBackgroundPropSet
->getPropertyValue("FillStyle") >>= aFillStyle
;
1274 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, aFillStyle
);
1276 awt::Gradient2 aGradient
;
1277 CPPUNIT_ASSERT(aXBackgroundPropSet
->getPropertyValue("FillGradient") >>= aGradient
);
1279 // MCGR: Use the completely imported gradient to check for correctness
1280 const basegfx::BColorStops aColorStops
1281 = model::gradient::getColorStopsFromUno(aGradient
.ColorStops
);
1283 CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops
.size());
1284 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[0].getStopOffset(), 0.0));
1285 CPPUNIT_ASSERT_EQUAL(aColorStops
[0].getStopColor(), basegfx::BColor(1.0, 0.0, 0.0));
1286 CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops
[1].getStopOffset(), 1.0));
1287 CPPUNIT_ASSERT_EQUAL(
1288 aColorStops
[1].getStopColor(),
1289 basegfx::BColor(0.16470588235294117, 0.37647058823529411, 0.59999999999999998));
1292 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf98603
)
1294 createSdImpressDoc("pptx/tdf98603.pptx");
1295 saveAndReload("Impress Office Open XML");
1296 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1297 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
1298 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
1299 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
1300 css::lang::Locale aLocale
;
1301 xPropSet
->getPropertyValue("CharLocaleComplex") >>= aLocale
;
1302 CPPUNIT_ASSERT_EQUAL(OUString("he"), aLocale
.Language
);
1303 CPPUNIT_ASSERT_EQUAL(OUString("IL"), aLocale
.Country
);
1306 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf128213
)
1308 createSdImpressDoc("pptx/tdf128213.pptx");
1309 save("Impress Office Open XML");
1311 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
1312 assertXPathNoAttribute(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm", "rot");
1315 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf79082
)
1317 createSdImpressDoc("pptx/tdf79082.pptx");
1318 save("Impress Office Open XML");
1320 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
1321 assertXPath(pXmlDocContent
,
1322 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", "pos",
1324 assertXPath(pXmlDocContent
,
1325 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", "algn", "l");
1327 assertXPath(pXmlDocContent
,
1328 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]", "pos",
1330 assertXPath(pXmlDocContent
,
1331 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[2]", "algn", "l");
1333 assertXPath(pXmlDocContent
,
1334 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]", "pos",
1336 assertXPath(pXmlDocContent
,
1337 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[3]", "algn",
1340 assertXPath(pXmlDocContent
,
1341 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]", "pos",
1343 assertXPath(pXmlDocContent
,
1344 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[4]", "algn", "r");
1346 assertXPath(pXmlDocContent
,
1347 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]", "pos",
1349 assertXPath(pXmlDocContent
,
1350 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[5]", "algn",
1354 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf129372
)
1356 //Without the fix in place, it would crash at import time
1358 createSdImpressDoc("pptx/tdf129372.pptx");
1359 saveAndReload("Impress Office Open XML");
1360 const SdrPage
* pPage
= GetPage(1);
1362 const SdrObject
* pObj
= pPage
->GetObj(0);
1363 CPPUNIT_ASSERT_MESSAGE("no object", pObj
!= nullptr);
1364 CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2
, pObj
->GetObjIdentifier());
1367 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testShapeGlowEffect
)
1369 createSdImpressDoc("pptx/shape-glow-effect.pptx");
1370 saveAndReload("Impress Office Open XML");
1371 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1372 sal_Int32 nRadius
= -1;
1373 xShape
->getPropertyValue("GlowEffectRadius") >>= nRadius
;
1374 CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius
); // 139700 EMU = 388.0556 mm/100
1376 xShape
->getPropertyValue("GlowEffectColor") >>= nColor
;
1377 CPPUNIT_ASSERT_EQUAL(Color(0xFFC000), nColor
);
1378 sal_Int16 nTransparency
;
1379 xShape
->getPropertyValue("GlowEffectTransparency") >>= nTransparency
;
1380 CPPUNIT_ASSERT_EQUAL(sal_Int16(60), nTransparency
);
1383 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testUnderline
)
1385 createSdImpressDoc("underline.fodp");
1387 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1388 uno::Reference
<text::XTextRange
> xParagraph(getParagraphFromShape(0, xShape
));
1389 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
1390 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
1393 xPropSet
->getPropertyValue("CharColor") >>= nColor
;
1394 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED
, nColor
);
1396 xPropSet
->getPropertyValue("CharUnderlineColor") >>= nColor
;
1397 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, nColor
);
1399 sal_Int16 nUnderline
;
1400 xPropSet
->getPropertyValue("CharUnderline") >>= nUnderline
;
1401 CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::DOUBLE
, nUnderline
);
1403 saveAndReload("Impress Office Open XML");
1405 xShape
.set(getShapeFromPage(0, 0));
1406 xParagraph
.set(getParagraphFromShape(0, xShape
));
1407 xRun
.set(getRunFromParagraph(0, xParagraph
));
1408 xPropSet
.set(xRun
, uno::UNO_QUERY_THROW
);
1410 xPropSet
->getPropertyValue("CharColor") >>= nColor
;
1411 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED
, nColor
);
1413 xPropSet
->getPropertyValue("CharUnderlineColor") >>= nColor
;
1414 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, nColor
);
1416 xPropSet
->getPropertyValue("CharUnderline") >>= nUnderline
;
1417 CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::DOUBLE
, nUnderline
);
1420 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf119087
)
1422 createSdImpressDoc("pptx/tdf119087.pptx");
1423 saveAndReload("Impress Office Open XML");
1424 // This would fail both on export validation, and reloading the saved pptx file.
1426 // Get first paragraph of the text
1427 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1428 uno::Reference
<text::XTextRange
> const xParagraph(getParagraphFromShape(0, xShape
));
1429 // Get first run of the paragraph
1430 uno::Reference
<text::XTextRange
> xRun(getRunFromParagraph(0, xParagraph
));
1431 uno::Reference
<beans::XPropertySet
> xPropSet(xRun
, uno::UNO_QUERY_THROW
);
1433 Color nColor
= COL_AUTO
;
1434 xPropSet
->getPropertyValue("CharColor") >>= nColor
;
1435 CPPUNIT_ASSERT_EQUAL(Color(0x00B050), nColor
);
1438 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf131554
)
1440 createSdImpressDoc("pptx/tdf131554.pptx");
1441 saveAndReload("Impress Office Open XML");
1442 uno::Reference
<drawing::XShape
> xShape(getShapeFromPage(1, 0), uno::UNO_QUERY
);
1443 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(5622), xShape
->getPosition().X
);
1444 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(13251), xShape
->getPosition().Y
);
1447 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf132282
)
1449 createSdImpressDoc("pptx/tdf132282.pptx");
1450 saveAndReload("Impress Office Open XML");
1451 uno::Reference
<drawing::XShape
> xShape(getShapeFromPage(0, 0), uno::UNO_QUERY
);
1452 // Without the fix in place, the position would be 0,0, height = 1 and width = 1
1453 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1736), xShape
->getPosition().X
);
1454 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(763), xShape
->getPosition().Y
);
1455 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(30523), xShape
->getSize().Width
);
1456 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2604), xShape
->getSize().Height
);
1459 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf132201EffectOrder
)
1461 createSdImpressDoc("pptx/effectOrder.pptx");
1462 save("Impress Office Open XML");
1463 xmlDocUniquePtr pXmlDocContent
= parseExport("ppt/slides/slide1.xml");
1464 assertXPathChildren(pXmlDocContent
, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst", 2);
1465 // The relative order of effects is important: glow must be before shadow
1466 CPPUNIT_ASSERT_EQUAL(0, getXPathPosition(pXmlDocContent
,
1467 "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst",
1469 CPPUNIT_ASSERT_EQUAL(1, getXPathPosition(pXmlDocContent
,
1470 "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst",
1474 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testShapeSoftEdgeEffect
)
1476 createSdImpressDoc("pptx/shape-soft-edges.pptx");
1477 saveAndReload("Impress Office Open XML");
1478 auto xShapeProps(getShapeFromPage(0, 0));
1479 sal_Int32 nRadius
= -1;
1480 xShapeProps
->getPropertyValue("SoftEdgeRadius") >>= nRadius
;
1481 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRadius
); // 18 pt
1484 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testShapeShadowBlurEffect
)
1486 createSdImpressDoc("pptx/shape-blur-effect.pptx");
1487 saveAndReload("Impress Office Open XML");
1488 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1489 bool bHasShadow
= false;
1490 xShape
->getPropertyValue("Shadow") >>= bHasShadow
;
1491 CPPUNIT_ASSERT(bHasShadow
);
1492 sal_Int32 nRadius
= -1;
1493 xShape
->getPropertyValue("ShadowBlur") >>= nRadius
;
1494 CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius
); // 11 pt
1497 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf119223
)
1499 createSdImpressDoc("odp/tdf119223.odp");
1500 save("Impress Office Open XML");
1502 xmlDocUniquePtr pXmlDocRels
= parseExport("ppt/slides/slide1.xml");
1503 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeCustomShape']");
1505 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomePicture']");
1507 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeFormula']");
1509 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeLine']");
1511 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeTextbox']");
1513 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeTable']");
1515 assertXPath(pXmlDocRels
, "//p:cNvPr[@name='SomeGroup']");
1518 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf128213ShapeRot
)
1520 createSdImpressDoc("pptx/tdf128213-shaperot.pptx");
1521 save("Impress Office Open XML");
1523 xmlDocUniquePtr pXmlDocRels
= parseExport("ppt/slides/slide1.xml");
1525 assertXPath(pXmlDocRels
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:scene3d");
1526 assertXPath(pXmlDocRels
,
1527 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", "rev",
1531 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125560_textDeflate
)
1533 createSdImpressDoc("pptx/ShapePlusImage.pptx");
1535 // This problem did not affect the pptx export, only the ODP so assert that
1538 xmlDocUniquePtr pXmlDocRels
= parseExport("content.xml");
1539 assertXPath(pXmlDocRels
,
1540 "/office:document-content/office:body/office:presentation/draw:page/"
1541 "draw:custom-shape/draw:enhanced-geometry",
1542 "type", "mso-spt161");
1545 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf125560_textInflateTop
)
1547 createSdImpressDoc("pptx/ShapeTextInflateTop.pptx");
1549 // This problem did not affect the pptx export, only the ODP so assert that
1552 xmlDocUniquePtr pXmlDocRels
= parseExport("content.xml");
1553 assertXPath(pXmlDocRels
,
1554 "/office:document-content/office:body/office:presentation/draw:page/"
1555 "draw:custom-shape/draw:enhanced-geometry",
1556 "type", "mso-spt164");
1559 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf142235_TestPlaceholderTextAlignment
)
1561 createSdImpressDoc("odp/placeholder-box-textalignment.odp");
1563 save("Impress Office Open XML");
1565 xmlDocUniquePtr pXml1
= parseExport("ppt/slides/slide2.xml");
1566 xmlDocUniquePtr pXml2
= parseExport("ppt/slides/slide3.xml");
1568 // Without the fix in place many of these asserts failed, because alignment was bad.
1570 assertXPath(pXml1
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", "t");
1571 assertXPath(pXml2
, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", "t");
1574 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf96061_textHighlight
)
1576 createSdImpressDoc("pptx/tdf96061.pptx");
1578 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1579 uno::Reference
<text::XTextRange
> const xParagraph1(getParagraphFromShape(0, xShape
));
1580 uno::Reference
<text::XTextRange
> xRun1(getRunFromParagraph(0, xParagraph1
));
1581 uno::Reference
<beans::XPropertySet
> xPropSet1(xRun1
, uno::UNO_QUERY_THROW
);
1584 xPropSet1
->getPropertyValue("CharBackColor") >>= aColor
;
1585 CPPUNIT_ASSERT_EQUAL(COL_YELLOW
, aColor
);
1587 uno::Reference
<text::XTextRange
> const xParagraph2(getParagraphFromShape(1, xShape
));
1588 uno::Reference
<text::XTextRange
> xRun2(getRunFromParagraph(0, xParagraph2
));
1589 uno::Reference
<beans::XPropertySet
> xPropSet2(xRun2
, uno::UNO_QUERY_THROW
);
1590 xPropSet2
->getPropertyValue("CharBackColor") >>= aColor
;
1591 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, aColor
);
1593 saveAndReload("Impress Office Open XML");
1595 uno::Reference
<beans::XPropertySet
> xShape2(getShapeFromPage(0, 0));
1596 uno::Reference
<text::XTextRange
> const xParagraph3(getParagraphFromShape(0, xShape2
));
1597 uno::Reference
<text::XTextRange
> xRun3(getRunFromParagraph(0, xParagraph3
));
1598 uno::Reference
<beans::XPropertySet
> xPropSet3(xRun3
, uno::UNO_QUERY_THROW
);
1599 xPropSet3
->getPropertyValue("CharBackColor") >>= aColor
;
1600 CPPUNIT_ASSERT_EQUAL(COL_YELLOW
, aColor
);
1602 uno::Reference
<text::XTextRange
> const xParagraph4(getParagraphFromShape(1, xShape2
));
1603 uno::Reference
<text::XTextRange
> xRun4(getRunFromParagraph(0, xParagraph4
));
1604 uno::Reference
<beans::XPropertySet
> xPropSet4(xRun4
, uno::UNO_QUERY_THROW
);
1605 xPropSet4
->getPropertyValue("CharBackColor") >>= aColor
;
1606 CPPUNIT_ASSERT_EQUAL(COL_AUTO
, aColor
);
1609 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf143222_embeddedWorksheet
)
1611 // Check import of embedded worksheet in slide.
1613 createSdImpressDoc("pptx/tdf143222.pptx");
1615 const SdrPage
* pPage
= GetPage(1);
1616 const SdrOle2Obj
* pOleObj
= static_cast<SdrOle2Obj
*>(pPage
->GetObj(0));
1617 CPPUNIT_ASSERT_MESSAGE("no object", pOleObj
!= nullptr);
1619 // Without the fix we lost the graphic of ole object.
1620 const Graphic
* pGraphic
= pOleObj
->GetGraphic();
1621 CPPUNIT_ASSERT_MESSAGE("no graphic", pGraphic
!= nullptr);
1623 // Check export of embedded worksheet in slide.
1624 saveAndReload("Impress Office Open XML");
1627 pOleObj
= static_cast<SdrOle2Obj
*>(pPage
->GetObj(0));
1628 CPPUNIT_ASSERT_MESSAGE("no object after the export", pOleObj
!= nullptr);
1630 pGraphic
= pOleObj
->GetGraphic();
1631 CPPUNIT_ASSERT_MESSAGE("no graphic after the export", pGraphic
!= nullptr);
1634 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf143315
)
1636 createSdImpressDoc("ppt/tdf143315-WordartWithoutBullet.ppt");
1638 save("Impress Office Open XML");
1640 xmlDocUniquePtr pXml
= parseExport("ppt/slides/slide1.xml");
1642 // Without the fix in place, this would have failed with
1644 // - Actual : 216000
1645 // - In <file:///tmp/lu161922zcvd.tmp>, XPath '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr' unexpected 'marL' attribute
1647 assertXPathNoAttribute(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr", "marL");
1648 assertXPathNoAttribute(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr", "indent");
1649 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buClr", 0);
1650 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buSzPct", 0);
1651 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buFont", 0);
1652 assertXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buChar", 0);
1655 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf147121
)
1658 createSdImpressDoc("pptx/tdf147121.pptx");
1660 // Get the second line props of the placeholder
1661 uno::Reference
<drawing::XDrawPage
> xPage(getPage(0));
1662 uno::Reference
<beans::XPropertySet
> xShape(xPage
->getByIndex(0), uno::UNO_QUERY_THROW
);
1663 uno::Reference
<beans::XPropertySet
> xRun(
1664 getRunFromParagraph(2, getParagraphFromShape(0, xShape
)), uno::UNO_QUERY_THROW
);
1666 // Save the font size
1667 const auto nFontSizeBefore
= xRun
->getPropertyValue("CharHeight").get
<float>() * 100;
1669 save("Impress Office Open XML");
1672 xmlDocUniquePtr pXml
= parseExport("ppt/slides/slide1.xml");
1673 const auto nFontSizeAfter
1674 = getXPath(pXml
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:br[1]/a:rPr", "sz").toFloat();
1676 // The font size was not saved before now it must be equal with the saved one.
1677 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font size", nFontSizeBefore
, nFontSizeAfter
);
1680 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf140912_PicturePlaceholder
)
1682 // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
1683 // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
1684 // -8490 in the test below turns into -8014 on my Windows box with 150% scaling.
1685 if (!IsDefaultDPI())
1688 createSdImpressDoc("pptx/tdfpictureplaceholder.pptx");
1690 uno::Reference
<beans::XPropertySet
> xShapeProps(getShapeFromPage(0, 0));
1691 bool bTextContourFrame
= true;
1692 xShapeProps
->getPropertyValue("TextContourFrame") >>= bTextContourFrame
;
1693 CPPUNIT_ASSERT_EQUAL(false, bTextContourFrame
);
1695 text::GraphicCrop aGraphicCrop
;
1696 xShapeProps
->getPropertyValue("GraphicCrop") >>= aGraphicCrop
;
1697 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(-8490), aGraphicCrop
.Top
);
1700 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testEnhancedPathViewBox
)
1702 createSdImpressDoc("odp/tdf147978_enhancedPath_viewBox.odp");
1703 saveAndReload("Impress Office Open XML");
1704 auto xShapeProps(getShapeFromPage(0, 0));
1705 awt::Rectangle aBoundRectangle
;
1706 xShapeProps
->getPropertyValue("BoundRect") >>= aBoundRectangle
;
1707 // The shape has a Bézier curve which does not touch the right edge. Prior to the fix the curve
1708 // was stretched to touch the edge, resulting in 5098 curve width instead of 2045.
1709 CPPUNIT_ASSERT_EQUAL(sal_Int32(2045), aBoundRectangle
.Width
);
1712 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf74670
)
1714 createSdImpressDoc("odp/tdf74670.odp");
1715 save("Impress Office Open XML");
1717 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
1718 = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory
),
1719 maTempFile
.GetURL());
1720 const uno::Sequence
<OUString
> aNames(xNameAccess
->getElementNames());
1721 int nImageFiles
= 0;
1722 for (const auto& rElementName
: aNames
)
1723 if (rElementName
.startsWith("ppt/media/image"))
1726 // Without the accompanying fix in place, this test would have failed with:
1729 // i.e. the embedded picture would have been saved twice.
1730 CPPUNIT_ASSERT_EQUAL(1, nImageFiles
);
1733 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf109169_OctagonBevel
)
1735 // The document has a shape 'Octagon Bevel'. It consists of an octagon with 8 points and eight
1736 // facets with 4 points each, total 8+8*4=40 points. Without the patch it was exported as
1737 // rectangle and thus had 4 points.
1739 createSdImpressDoc("odp/tdf109169_Octagon.odp");
1740 saveAndReload("Impress Office Open XML");
1742 auto xPropSet(getShapeFromPage(0, 0));
1743 auto aGeomPropSeq
= xPropSet
->getPropertyValue("CustomShapeGeometry")
1744 .get
<uno::Sequence
<beans::PropertyValue
>>();
1745 comphelper::SequenceAsHashMap
aCustomShapeGeometry(aGeomPropSeq
);
1746 auto aPathSeq((aCustomShapeGeometry
["Path"]).get
<uno::Sequence
<beans::PropertyValue
>>());
1747 comphelper::SequenceAsHashMap
aPath(aPathSeq
);
1749 (aPath
["Coordinates"]).get
<uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
>>());
1750 CPPUNIT_ASSERT_EQUAL(sal_Int32(40), aCoordinates
.getLength());
1753 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf109169_DiamondBevel
)
1755 // The document has a shape 'Diamond Bevel'. It consists of a diamond with 4 points and four
1756 // facets with 4 points each, total 4+4*4=20 points. Without the patch it was exported as
1757 // rectangle and thus had 4 points.
1759 createSdImpressDoc("odp/tdf109169_Diamond.odp");
1760 saveAndReload("Impress Office Open XML");
1762 auto xPropSet(getShapeFromPage(0, 0));
1763 auto aGeomPropSeq
= xPropSet
->getPropertyValue("CustomShapeGeometry")
1764 .get
<uno::Sequence
<beans::PropertyValue
>>();
1765 comphelper::SequenceAsHashMap
aCustomShapeGeometry(aGeomPropSeq
);
1766 auto aPathSeq((aCustomShapeGeometry
["Path"]).get
<uno::Sequence
<beans::PropertyValue
>>());
1767 comphelper::SequenceAsHashMap
aPath(aPathSeq
);
1769 (aPath
["Coordinates"]).get
<uno::Sequence
<drawing::EnhancedCustomShapeParameterPair
>>());
1770 CPPUNIT_ASSERT_EQUAL(sal_Int32(20), aCoordinates
.getLength());
1773 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf144092_emptyShapeTextProps
)
1775 // Document contains one shape and one table. Both without any text but with
1776 // text properties contained inside endParaRPr - The import and export
1777 // of endParaRPr for empty cells and shapes are tested here
1778 createSdImpressDoc("pptx/tdf144092-emptyShapeTextProps.pptx");
1779 saveAndReload("Impress Office Open XML");
1782 // check text properties of empty shape
1783 uno::Reference
<beans::XPropertySet
> xRectShapeProps(getShapeFromPage(1, 0));
1784 CPPUNIT_ASSERT_EQUAL(OUString("Calibri"),
1785 xRectShapeProps
->getPropertyValue("CharFontName").get
<OUString
>());
1786 CPPUNIT_ASSERT_EQUAL(float(196), xRectShapeProps
->getPropertyValue("CharHeight").get
<float>());
1787 xRectShapeProps
->getPropertyValue("CharColor") >>= aColor
;
1788 CPPUNIT_ASSERT_EQUAL(Color(0x70AD47), aColor
);
1790 const SdrPage
* pPage
= GetPage(1);
1791 sdr::table::SdrTableObj
* pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1792 CPPUNIT_ASSERT(pTableObj
);
1793 uno::Reference
<table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
1794 uno::Reference
<beans::XPropertySet
> xCell
;
1796 // check text properties of empty cells
1797 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
1798 xCell
->getPropertyValue("CharColor") >>= aColor
;
1799 CPPUNIT_ASSERT_EQUAL(Color(0xFFFFFF), aColor
);
1801 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
1802 xCell
->getPropertyValue("CharColor") >>= aColor
;
1803 CPPUNIT_ASSERT_EQUAL(Color(0x70AD47), aColor
);
1804 CPPUNIT_ASSERT_EQUAL(float(96), xCell
->getPropertyValue("CharHeight").get
<float>());
1807 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf149551_tbrl90
)
1809 // The document contains a shape with writing mode TB_RL90. That is the same as vert="vert" in
1810 // OOXML. Without the patch it was not possible to use this writing mode at all.
1812 createSdImpressDoc("odp/tdf149551_tbrl90.odp");
1814 // Test, that the shape has writing mode TB_RL90.
1815 uno::Reference
<beans::XPropertySet
> xShapeProps(getShapeFromPage(0, 0));
1816 sal_Int16 eWritingMode
;
1817 xShapeProps
->getPropertyValue("WritingMode") >>= eWritingMode
;
1818 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90
, eWritingMode
);
1820 // Test, that it is exported to vert="vert"
1821 save("Impress Office Open XML");
1822 xmlDocUniquePtr pXmlDoc
= parseExport("ppt/slides/slide1.xml");
1823 assertXPath(pXmlDoc
, "//a:bodyPr", "vert", "vert");
1825 // Test, that the shape has writing mode TB_RL90 after read from pptx
1826 uno::Reference
<beans::XPropertySet
> xShapeProps2(getShapeFromPage(0, 0));
1827 sal_Int16 eWritingMode2
;
1828 xShapeProps2
->getPropertyValue("WritingMode") >>= eWritingMode2
;
1829 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90
, eWritingMode2
);
1831 // Test, that it is written to odp with loext:writing-mode="tb-rl90"
1833 pXmlDoc
= parseExport("content.xml");
1836 "//style:style[@style:name='gr1']/style:graphic-properties[@loext:writing-mode='tb-rl90']");
1839 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf149551_btlr
)
1841 // The document contains a shape with writing mode BT_LR. That is the same as vert="vert270" in
1842 // OOXML. Without the patch it was not possible to use this writing mode at all for shapes.
1844 createSdImpressDoc("odp/tdf149551_btlr.odp");
1846 // Test, that the shape has writing mode BT_LR.
1847 uno::Reference
<beans::XPropertySet
> xShapeProps(getShapeFromPage(0, 0));
1848 sal_Int16 eWritingMode
;
1849 xShapeProps
->getPropertyValue("WritingMode") >>= eWritingMode
;
1850 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, eWritingMode
);
1852 // Test, that it is exported to vert="vert270"
1853 save("Impress Office Open XML");
1854 xmlDocUniquePtr pXmlDoc
= parseExport("ppt/slides/slide1.xml");
1855 assertXPath(pXmlDoc
, "//a:bodyPr", "vert", "vert270");
1857 // Test, that the shape has writing mode BT_LR after read from pptx
1858 uno::Reference
<beans::XPropertySet
> xShapeProps2(getShapeFromPage(0, 0));
1859 sal_Int16 eWritingMode2
;
1860 xShapeProps2
->getPropertyValue("WritingMode") >>= eWritingMode2
;
1861 CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR
, eWritingMode2
);
1863 // Test, that it is written to odp with loext:writing-mode="bt-lr"
1865 pXmlDoc
= parseExport("content.xml");
1868 "//style:style[@style:name='gr1']/style:graphic-properties[@loext:writing-mode='bt-lr']");
1871 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf94122_autoColor
)
1873 // Document contains three pages, with different scenarios for automatic
1874 // color export to pptx.
1875 // - First page: Page background light, automatic colored text on a FillType_NONE shape
1876 // - Second page: Page background dark, automatic colored text on a FillType_NONE shape
1877 // - Third page: Page background light, automatic colored text on a dark colored fill
1878 // and another automatic colored text on a light colored fill
1880 createSdImpressDoc("odp/tdf94122_autocolor.odp");
1882 save("Impress Office Open XML");
1884 // Without the accompanying fix in place, these tests would have failed with:
1887 // - 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
1888 // i.e. automatic color wasn't resolved & exported
1890 xmlDocUniquePtr pXmlDocContent1
= parseExport("ppt/slides/slide1.xml");
1891 assertXPath(pXmlDocContent1
,
1892 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val",
1895 xmlDocUniquePtr pXmlDocContent2
= parseExport("ppt/slides/slide2.xml");
1896 assertXPath(pXmlDocContent2
,
1897 "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val",
1900 xmlDocUniquePtr pXmlDocContent3
= parseExport("ppt/slides/slide3.xml");
1901 assertXPath(pXmlDocContent3
,
1902 "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr",
1904 assertXPath(pXmlDocContent3
,
1905 "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr",
1909 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf124333
)
1911 // Document contains one rectangle and one embedded OLE object.
1913 createSdImpressDoc("pptx/ole.pptx");
1915 // Without the fix in place, the number of shapes was 3.
1916 CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect", sal_Int32(2),
1917 getPage(0)->getCount());
1919 saveAndReload("Impress Office Open XML");
1921 // Check number of shapes after export.
1922 CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect after export", sal_Int32(2),
1923 getPage(0)->getCount());
1926 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testAutofittedTextboxIndent
)
1928 createSdImpressDoc("odp/autofitted-textbox-indent.odp");
1930 save("Impress Office Open XML");
1932 // Check that the indent hasn't changed and wasn't scaled when exporting
1933 // (the behaviour changed).
1935 xmlDocUniquePtr pXmlDocContent1
= parseExport("ppt/slides/slide1.xml");
1936 assertXPath(pXmlDocContent1
, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr", "marL",
1940 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf151622_oleIcon
)
1942 createSdImpressDoc("odp/ole_icon.odp");
1944 save("Impress Office Open XML");
1946 xmlDocUniquePtr pXml
= parseExport("ppt/slides/slide1.xml");
1948 // Without the accompanying fix in place, this test would have failed with:
1949 // - Expression: prop
1950 // - In ..., XPath '//p:oleObj' no attribute 'showAsIcon' exist
1951 // i.e. show as icon option wasn't exported.
1952 assertXPath(pXml
, "//p:oleObj", "showAsIcon", "1");
1955 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf152436
)
1957 createSdImpressDoc("pptx/ole-emf_min.pptx");
1958 saveAndReload("Impress Office Open XML");
1960 // Check number of shapes after export.
1961 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount());
1964 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testLinkedOLE
)
1966 createSdImpressDoc("odp/linked_ole.odp");
1968 save("Impress Office Open XML");
1970 xmlDocUniquePtr pXml
= parseExport("ppt/slides/slide1.xml");
1972 // Without the accompanying fix in place, this test would have failed with:
1975 // - In<>, XPath '//p:oleObj' number of nodes is incorrect
1976 // i.e. the linked ole object wasn't exported.
1977 assertXPath(pXml
, "//p:oleObj", 1);
1980 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTdf102261_testParaTabStopDefaultDistance
)
1982 createSdImpressDoc("pptx/tdf102261_testParaTabStopDefaultDistance.pptx");
1983 saveAndReload("Impress Office Open XML");
1985 uno::Reference
<beans::XPropertySet
> xShape(getShapeFromPage(0, 0));
1987 uno::Reference
<beans::XPropertySet
> xPropSet(getParagraphFromShape(0, xShape
),
1988 uno::UNO_QUERY_THROW
);
1989 CPPUNIT_ASSERT_EQUAL(
1991 xPropSet
->getPropertyValue("ParaTabStopDefaultDistance").get
<sal_Int32
>());
1994 uno::Reference
<beans::XPropertySet
> xPropSet(getParagraphFromShape(1, xShape
),
1995 uno::UNO_QUERY_THROW
);
1996 CPPUNIT_ASSERT_EQUAL(
1998 xPropSet
->getPropertyValue("ParaTabStopDefaultDistance").get
<sal_Int32
>());
2002 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3
, testTableCellVerticalPropertyRoundtrip
)
2004 createSdImpressDoc("pptx/tcPr-vert-roundtrip.pptx");
2005 saveAndReload("Impress Office Open XML");
2007 xmlDocUniquePtr pXml
= parseExport("ppt/slides/slide1.xml");
2009 assertXPath(pXml
, "(//a:tcPr)[1]", "vert", "vert");
2010 assertXPath(pXml
, "(//a:tcPr)[2]", "vert", "vert270");
2011 assertXPath(pXml
, "(//a:tcPr)[3]", "vert", "wordArtVert");
2014 CPPUNIT_PLUGIN_IMPLEMENT();
2016 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */