1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #include <officecfg/Office/Common.hxx>
10 #include "sdmodeltestbase.hxx"
11 #include <Outliner.hxx>
12 #include <comphelper/propertysequence.hxx>
13 #include <svl/stritem.hxx>
14 #include <editeng/editobj.hxx>
15 #include <editeng/outlobj.hxx>
16 #include <editeng/ulspitem.hxx>
17 #include <editeng/fhgtitem.hxx>
18 #include <editeng/escapementitem.hxx>
19 #include <editeng/colritem.hxx>
20 #include <editeng/fontitem.hxx>
21 #include <editeng/wghtitem.hxx>
22 #include <editeng/numitem.hxx>
23 #include <editeng/lrspitem.hxx>
24 #include <editeng/postitem.hxx>
25 #include <editeng/bulletitem.hxx>
27 #include <oox/drawingml/drawingmltypes.hxx>
29 #include <svl/style.hxx>
31 #include <svx/svdoutl.hxx>
32 #include <svx/svdotext.hxx>
33 #include <svx/svdoashp.hxx>
34 #include <svx/svdograf.hxx>
35 #include <svx/svdogrp.hxx>
36 #include <svx/svdomedia.hxx>
37 #include <svx/svdoole2.hxx>
38 #include <svx/xflclit.hxx>
39 #include <animations/animationnodehelper.hxx>
40 #include <unotools/mediadescriptor.hxx>
41 #include <rtl/ustring.hxx>
43 #include <vcl/opengl/OpenGLWrapper.hxx>
45 #include <com/sun/star/drawing/XDrawPage.hpp>
46 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
47 #include <com/sun/star/beans/XPropertySet.hpp>
48 #include <com/sun/star/chart/XChartDocument.hpp>
49 #include <com/sun/star/chart2/XChartDocument.hpp>
50 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
51 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
52 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
53 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
54 #include <com/sun/star/chart2/data/XDataSequence.hpp>
55 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
56 #include <com/sun/star/awt/XBitmap.hpp>
57 #include <com/sun/star/awt/FontDescriptor.hpp>
58 #include <com/sun/star/graphic/XGraphic.hpp>
59 #include <com/sun/star/frame/XStorable.hpp>
60 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
61 #include <com/sun/star/drawing/FillStyle.hpp>
62 #include <com/sun/star/text/WritingMode2.hpp>
63 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
64 #include <com/sun/star/table/BorderLine2.hpp>
65 #include <com/sun/star/table/XTable.hpp>
66 #include <com/sun/star/table/XMergeableCell.hpp>
68 #include <svx/svdotable.hxx>
69 #include <config_features.h>
70 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
73 using namespace css::animations
;
75 class SdOOXMLExportTest1
: public SdModelTestBaseXML
79 void testBnc870233_1();
80 void testBnc870233_2();
86 void testBnc862510_5();
87 void testBnc822347_EmptyBullet();
90 void testTableCellFillProperties();
91 void testBulletStartNumber();
93 void testCellLeftAndRightMargin();
94 void testRightToLeftParaghraph();
95 void testTextboxWithHyperlink();
96 void testMergedCells();
97 void testTableCellBorder();
98 void testBulletColor();
99 void testBulletCharAndFont();
100 void testBulletMarginAndIndentation();
101 void testParaMarginAndindentation();
102 void testTdf111884();
103 void testTdf112633();
104 void testCustomXml();
106 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1
);
108 CPPUNIT_TEST(testFdo90607
);
109 CPPUNIT_TEST(testBnc870233_1
);
110 CPPUNIT_TEST(testBnc870233_2
);
111 CPPUNIT_TEST(testN828390_4
);
112 CPPUNIT_TEST(testN828390_5
);
113 CPPUNIT_TEST(testFdo71961
);
114 CPPUNIT_TEST(testN828390
);
115 CPPUNIT_TEST(testBnc880763
);
116 CPPUNIT_TEST(testBnc862510_5
);
117 CPPUNIT_TEST(testBnc822347_EmptyBullet
);
118 CPPUNIT_TEST(testFdo83751
);
119 CPPUNIT_TEST(testFdo79731
);
120 CPPUNIT_TEST(testTableCellFillProperties
);
121 CPPUNIT_TEST(testBulletStartNumber
);
122 CPPUNIT_TEST(testLineStyle
);
123 CPPUNIT_TEST(testCellLeftAndRightMargin
);
124 CPPUNIT_TEST(testRightToLeftParaghraph
);
125 CPPUNIT_TEST(testTextboxWithHyperlink
);
126 CPPUNIT_TEST(testMergedCells
);
127 CPPUNIT_TEST(testTableCellBorder
);
128 CPPUNIT_TEST(testBulletColor
);
129 CPPUNIT_TEST(testBulletCharAndFont
);
130 CPPUNIT_TEST(testBulletMarginAndIndentation
);
131 CPPUNIT_TEST(testParaMarginAndindentation
);
132 CPPUNIT_TEST(testTdf111884
);
133 CPPUNIT_TEST(testTdf112633
);
134 CPPUNIT_TEST(testCustomXml
);
136 CPPUNIT_TEST_SUITE_END();
138 virtual void registerNamespaces(xmlXPathContextPtr
& pXmlXPathCtx
) override
140 struct { char const * pPrefix
; char const * pURI
; } namespaces
[] =
143 { "ContentType", "http://schemas.openxmlformats.org/package/2006/content-types" },
144 { "rels", "http://schemas.openxmlformats.org/package/2006/relationships" },
145 { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
146 { "v", "urn:schemas-microsoft-com:vml" },
147 { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
148 { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
149 { "m", "http://schemas.openxmlformats.org/officeDocument/2006/math" },
150 { "pic", "http://schemas.openxmlformats.org/drawingml/2006/picture" },
151 { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
152 { "p", "http://schemas.openxmlformats.org/presentationml/2006/main" },
153 { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
154 { "a14", "http://schemas.microsoft.com/office/drawing/2010/main" },
155 { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
156 { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
158 for (size_t i
= 0; i
< SAL_N_ELEMENTS(namespaces
); ++i
)
160 xmlXPathRegisterNs(pXmlXPathCtx
,
161 reinterpret_cast<xmlChar
const *>(namespaces
[i
].pPrefix
),
162 reinterpret_cast<xmlChar
const *>(namespaces
[i
].pURI
));
169 template< typename ItemValue
, typename ItemType
>
170 void checkFontAttributes( const SdrTextObj
* pObj
, ItemValue nVal
)
172 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
173 const EditTextObject
& aEdit
= pObj
->GetOutlinerParaObject()->GetTextObject();
174 std::vector
<EECharAttrib
> rLst
;
175 aEdit
.GetCharAttribs(0, rLst
);
176 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
178 const ItemType
* pAttrib
= dynamic_cast<const ItemType
*>((*it
).pAttr
);
181 CPPUNIT_ASSERT_EQUAL( nVal
, static_cast<ItemValue
>(pAttrib
->GetValue()));
188 void SdOOXMLExportTest1::testBnc870233_1()
190 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX
);
191 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
193 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
195 // The problem was all shapes had the same font (the last parsed font attributes overwrote all previous ones)
197 // First shape has red, bold font
199 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 0 ) );
200 checkFontAttributes
<Color
, SvxColorItem
>( pObj
, Color(0xff0000) );
201 checkFontAttributes
<FontWeight
, SvxWeightItem
>( pObj
, WEIGHT_BOLD
);
204 // Second shape has blue, italic font
206 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 1 ) );
207 checkFontAttributes
<Color
, SvxColorItem
>( pObj
, Color(0x0000ff) );
208 checkFontAttributes
<FontItalic
, SvxPostureItem
>( pObj
, ITALIC_NORMAL
);
211 xDocShRef
->DoClose();
214 void SdOOXMLExportTest1::testBnc870233_2()
216 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX
);
217 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
219 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
221 // The problem was in some SmartArts font color was wrong
223 // First smart art has blue font color (direct formatting)
225 const SdrObjGroup
*pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(0));
226 CPPUNIT_ASSERT(pObjGroup
);
227 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>(pObjGroup
->GetSubList()->GetObj(0));
228 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, Color(0x0000ff));
231 // Second smart art has "dk2" font color (style)
233 const SdrObjGroup
*pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(2)); // FIXME should be 1, smartart import creates an additional empty group for some reason
234 CPPUNIT_ASSERT(pObjGroup
);
235 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>(pObjGroup
->GetSubList()->GetObj(0));
236 checkFontAttributes
<Color
, SvxColorItem
>( pObj
, Color(0x1F497D) );
239 // Third smart art has white font color (style)
241 const SdrObjGroup
*pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(4)); // FIXME should be 2, smartart import creates an additional empty group for some reason
242 CPPUNIT_ASSERT(pObjGroup
);
243 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>(pObjGroup
->GetSubList()->GetObj(0));
244 checkFontAttributes
<Color
, SvxColorItem
>(pObj
, Color(0xffffff));
247 xDocShRef
->DoClose();
250 void SdOOXMLExportTest1::testN828390_4()
252 bool bPassed
= false;
253 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP
);
255 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
257 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
259 std::vector
<EECharAttrib
> rLst
;
260 SdrObject
*pObj
= pPage
->GetObj(0);
261 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
262 CPPUNIT_ASSERT( pTxtObj
);
263 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
264 aEdit
.GetCharAttribs(0, rLst
);
265 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
267 const SvxFontHeightItem
* pFontHeight
= dynamic_cast<const SvxFontHeightItem
*>((*it
).pAttr
);
268 if( pFontHeight
&& (*it
).nStart
== 18 )
269 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font height is wrong", static_cast<sal_uInt32
>(1129), pFontHeight
->GetHeight() );
270 const SvxFontItem
*pFont
= dynamic_cast<const SvxFontItem
*>((*it
).pAttr
);
273 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font is wrong", OUString("Arial"), pFont
->GetFamilyName() );
276 const SvxWeightItem
*pWeight
= dynamic_cast<const SvxWeightItem
*>((*it
).pAttr
);
277 if( pWeight
&& (*it
).nStart
== 18 )
278 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font Weight is wrong", WEIGHT_BOLD
, pWeight
->GetWeight() );
281 CPPUNIT_ASSERT(bPassed
);
283 xDocShRef
->DoClose();
286 void SdOOXMLExportTest1::testN828390_5()
288 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP
);
290 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
292 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
294 SdrObject
*pObj
= pPage
->GetObj(0);
295 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
296 CPPUNIT_ASSERT( pTxtObj
);
297 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
298 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetPool()->GetItem2(EE_PARA_NUMBULLET
, 5);
299 CPPUNIT_ASSERT( pNumFmt
);
300 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's relative size is wrong!", pNumFmt
->GetNumRule()->GetLevel(1).GetBulletRelSize(), sal_uInt16(75) ); // != 25
303 xDocShRef
->DoClose();
306 void SdOOXMLExportTest1::testFdo71961()
308 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP
);
310 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
311 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
313 // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
314 // (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
315 SdrObjCustomShape
*pTxtObj
= dynamic_cast<SdrObjCustomShape
*>( pPage
->GetObj( 1 ));
316 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
317 CPPUNIT_ASSERT_EQUAL( OUString( "Text to be always wrapped" ), pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
318 CPPUNIT_ASSERT_EQUAL( true, pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
).GetValue());
320 pTxtObj
= dynamic_cast<SdrObjCustomShape
*>( pPage
->GetObj( 2 ));
321 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
322 CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape non-wrapped text" ), pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
323 CPPUNIT_ASSERT_EQUAL( false, pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
).GetValue());
325 pTxtObj
= dynamic_cast<SdrObjCustomShape
*>( pPage
->GetObj( 3 ));
326 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
327 CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape wrapped text" ), pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
328 CPPUNIT_ASSERT_EQUAL( true, pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
).GetValue());
330 xDocShRef
->DoClose();
333 void SdOOXMLExportTest1::testN828390()
335 bool bPassed
= false;
336 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX
);
338 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
340 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
342 std::vector
<EECharAttrib
> rLst
;
344 SdrObject
*pObj
= pPage
->GetObj(0);
345 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
346 CPPUNIT_ASSERT( pTxtObj
);
347 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
348 aEdit
.GetCharAttribs(0, rLst
);
349 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
351 const SvxEscapementItem
*pFontEscapement
= dynamic_cast<const SvxEscapementItem
*>((*it
).pAttr
);
354 if( pFontEscapement
->GetEsc() == -25 )
362 CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed
);
364 xDocShRef
->DoClose();
367 void SdOOXMLExportTest1::testBnc880763()
369 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX
);
370 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
372 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
374 // Check z-order of the two shapes, use background color to identify them
375 // First object in the background has blue background color
376 const SdrObjGroup
*pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(0));
377 CPPUNIT_ASSERT(pObjGroup
);
378 const SdrObject
*pObj
= pObjGroup
->GetSubList()->GetObj(0);
379 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
380 CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff),(static_cast< const XColorItem
& >(pObj
->GetMergedItem(XATTR_FILLCOLOR
))).GetColorValue().GetColor());
382 // Second object at the front has green background color
383 pObj
= pPage
->GetObj(2); // FIXME should be 1, smartart import creates an additional empty group for some reason
384 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
385 CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem
& >(pObj
->GetMergedItem(XATTR_FILLCOLOR
))).GetColorValue().GetColor());
387 xDocShRef
->DoClose();
390 void SdOOXMLExportTest1::testBnc862510_5()
392 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX
);
393 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
395 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
397 // Same as testBnc870237, but here we check the horizontal spacing
398 const SdrObjGroup
*pObjGroup
= dynamic_cast<SdrObjGroup
*>(pPage
->GetObj(0));
399 CPPUNIT_ASSERT(pObjGroup
);
400 const SdrObject
* pObj
= pObjGroup
->GetSubList()->GetObj(1);
401 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= nullptr);
402 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_UPPERDIST
).GetValue());
403 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_LOWERDIST
).GetValue());
404 CPPUNIT_ASSERT_EQUAL( sal_Int32(7510), pObj
->GetMergedItem(SDRATTR_TEXT_RIGHTDIST
).GetValue());
405 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj
->GetMergedItem(SDRATTR_TEXT_LEFTDIST
).GetValue());
407 xDocShRef
->DoClose();
410 // In numbering a bullet could be defined as empty (no character).
411 // When exporting to OOXML make sure that the bullet is ignored and
412 // not written into the file.
413 void SdOOXMLExportTest1::testBnc822347_EmptyBullet()
415 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP
);
416 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
418 SdDrawDocument
* pDoc
= xDocShRef
->GetDoc();
419 SdrOutliner
* pOutliner
= pDoc
->GetInternalOutliner();
420 const SdrPage
* pPage
= pDoc
->GetPage(1);
421 SdrObject
* pObject
= pPage
->GetObj(0);
422 SdrTextObj
* pTextObject
= dynamic_cast<SdrTextObj
*>(pObject
);
423 CPPUNIT_ASSERT(pTextObject
);
425 OutlinerParaObject
* pOutlinerParagraphObject
= pTextObject
->GetOutlinerParaObject();
426 const EditTextObject
& aEdit
= pOutlinerParagraphObject
->GetTextObject();
428 OUString sText
= aEdit
.GetText(0);
429 CPPUNIT_ASSERT_EQUAL(OUString("M3 Feature Test"), sText
);
431 pOutliner
->SetText(*pOutlinerParagraphObject
);
432 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner
->GetParagraphCount());
434 const sal_Int16 nDepth
= pOutliner
->GetDepth(0);
436 CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), nDepth
); // depth >= 0 means that the paragraph has bullets enabled
438 xDocShRef
->DoClose();
441 //Bullets not having any text following them are not getting exported to pptx correctly.
442 void SdOOXMLExportTest1::testFdo90607()
444 sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX
);
445 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
447 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
448 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(1) );
449 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
450 OutlinerParaObject
* pOutlinerParagraphObject
= pTxtObj
->GetOutlinerParaObject();
451 const sal_Int16 nDepth
= pOutlinerParagraphObject
->GetDepth(0);
452 CPPUNIT_ASSERT_MESSAGE("not equal", nDepth
!= -1);
453 xDocShRef
->DoClose();
456 void SdOOXMLExportTest1::testFdo83751()
458 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX
);
459 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
461 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
462 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= nullptr );
464 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier( xDocShRef
->GetModel(), uno::UNO_QUERY
);
465 uno::Reference
<document::XDocumentProperties
> xProps( xDocumentPropertiesSupplier
->getDocumentProperties(), uno::UNO_QUERY
);
466 uno::Reference
<beans::XPropertySet
> xUDProps( xProps
->getUserDefinedProperties(), uno::UNO_QUERY
);
468 xUDProps
->getPropertyValue("Testing") >>= propValue
;
469 CPPUNIT_ASSERT_EQUAL(OUString("Document"), propValue
);
470 xDocShRef
->DoClose();
473 void SdOOXMLExportTest1::testFdo79731()
475 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP
);
476 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
477 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
478 CPPUNIT_ASSERT(pDoc
);
479 xDocShRef
->DoClose();
482 void SdOOXMLExportTest1::testTableCellFillProperties()
484 std::shared_ptr
< comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
485 officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch
);
488 // Load the original file
489 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP
);
491 // Export the document and import again for a check
492 uno::Reference
< lang::XComponent
> xComponent(xDocShRef
->GetModel(), uno::UNO_QUERY
);
493 uno::Reference
<frame::XStorable
> xStorable(xComponent
, uno::UNO_QUERY
);
494 utl::MediaDescriptor aMediaDescriptor
;
495 aMediaDescriptor
["FilterName"] <<= OStringToOUString(OString(aFileFormats
[PPTX
].pFilterName
), RTL_TEXTENCODING_UTF8
);
497 utl::TempFile aTempFile
;
498 aTempFile
.EnableKillingFile();
499 xStorable
->storeToURL(aTempFile
.GetURL(), aMediaDescriptor
.getAsConstPropertyValueList());
500 xComponent
.set(xStorable
, uno::UNO_QUERY
);
501 xComponent
->dispose();
502 xDocShRef
= loadURL(aTempFile
.GetURL(), PPTX
);
504 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
506 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
507 CPPUNIT_ASSERT( pTableObj
);
508 uno::Reference
< table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
509 uno::Reference
< beans::XPropertySet
> xCell
;
511 // Test Solid fill color
513 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
514 xCell
->getPropertyValue("FillColor") >>= nColor
;
515 CPPUNIT_ASSERT_EQUAL(sal_Int32(6750207), nColor
);
517 // Test Picture fill type for cell
518 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
519 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
520 xCell
->getPropertyValue("FillStyle") >>= aFillStyle
;
521 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_BITMAP
), static_cast<int>(aFillStyle
));
523 // Test Gradient fill type for cell
524 xCell
.set(xTable
->getCellByPosition(1, 0), uno::UNO_QUERY_THROW
);
525 xCell
->getPropertyValue("FillStyle") >>= aFillStyle
;
526 CPPUNIT_ASSERT_EQUAL(int(drawing::FillStyle_GRADIENT
), static_cast<int>(aFillStyle
));
528 xDocShRef
->DoClose();
531 void SdOOXMLExportTest1::testBulletStartNumber()
533 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX
);
534 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
536 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
537 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
538 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
539 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
540 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
541 CPPUNIT_ASSERT(pNumFmt
);
542 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's start number is wrong!", sal_Int16(pNumFmt
->GetNumRule()->GetLevel(0).GetStart()), sal_Int16(3) );
543 xDocShRef
->DoClose();
546 void SdOOXMLExportTest1::testLineStyle()
548 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX
);
549 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
551 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
552 SdrObject
const* pShape
= pPage
->GetObj(0);
553 CPPUNIT_ASSERT_MESSAGE("no shape", pShape
!= nullptr);
555 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
556 pShape
->GetMergedItem(XATTR_LINESTYLE
));
557 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong style", int(drawing::LineStyle_SOLID
), static_cast<int>(rStyleItem
.GetValue()));
559 xDocShRef
->DoClose();
562 void SdOOXMLExportTest1::testRightToLeftParaghraph()
564 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX
);
566 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
567 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
569 // Get first paragraph
570 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
571 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
573 sal_Int16 nWritingMode
= 0;
574 xPropSet
->getPropertyValue( "WritingMode" ) >>= nWritingMode
;
575 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB
, nWritingMode
);
577 xDocShRef
->DoClose();
580 void SdOOXMLExportTest1::testTextboxWithHyperlink()
582 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX
);
584 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
585 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
587 // Get first paragraph
588 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
590 // first chunk of text
591 uno::Reference
<text::XTextRange
> xRun( getRunFromParagraph( 0, xParagraph
) );
592 uno::Reference
< beans::XPropertySet
> xPropSet( xRun
, uno::UNO_QUERY_THROW
);
594 uno::Reference
<text::XTextField
> xField
;
595 xPropSet
->getPropertyValue("TextField") >>= xField
;
596 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
598 xPropSet
.set(xField
, uno::UNO_QUERY
);
600 xPropSet
->getPropertyValue("URL") >>= aURL
;
601 CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", OUString("http://www.xkcd.com/"), aURL
);
603 xDocShRef
->DoClose();
606 void SdOOXMLExportTest1::testBulletColor()
608 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX
);
610 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
612 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
614 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
615 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
617 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
618 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
619 CPPUNIT_ASSERT(pNumFmt
);
620 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt
->GetNumRule()->GetLevel(0).GetBulletColor().GetColor());
622 xDocShRef
->DoClose();
625 void SdOOXMLExportTest1::testBulletCharAndFont()
627 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP
);
628 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
630 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
631 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
632 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
634 uno::Reference
<container::XIndexAccess
> xLevels(xPropSet
->getPropertyValue("NumberingRules"), uno::UNO_QUERY
);
635 uno::Sequence
<beans::PropertyValue
> aProps
;
636 xLevels
->getByIndex(0) >>= aProps
; // 1st level
637 OUString
sBulletChar(u
'\xf06c');
638 for (int i
= 0; i
< aProps
.getLength(); ++i
)
640 const beans::PropertyValue
& rProp
= aProps
[i
];
641 if (rProp
.Name
== "BulletChar")
642 CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletChar incorrect.", sBulletChar
,rProp
.Value
.get
<OUString
>());
643 if (rProp
.Name
== "BulletFont")
645 awt::FontDescriptor aFontDescriptor
;
646 rProp
.Value
>>= aFontDescriptor
;
647 CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletFont incorrect.", OUString("Wingdings"),aFontDescriptor
.Name
);
650 xDocShRef
->DoClose();
653 void SdOOXMLExportTest1::testBulletMarginAndIndentation()
655 ::sd::DrawDocShellRef xDocShRef
= loadURL( m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX
);
656 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
658 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
660 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
661 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= nullptr);
663 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
664 const SvxNumBulletItem
*pNumFmt
= aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
);
665 CPPUNIT_ASSERT(pNumFmt
);
667 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's left margin is wrong!", short(1000),pNumFmt
->GetNumRule()->GetLevel(0).GetAbsLSpace() ); // left margin is 0.79 cm
668 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's indentation is wrong!", sal_Int32(-998),sal_Int32(pNumFmt
->GetNumRule()->GetLevel(0). GetFirstLineOffset()));
670 xDocShRef
->DoClose();
673 void SdOOXMLExportTest1::testParaMarginAndindentation()
675 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX
);
677 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
678 uno::Reference
< beans::XPropertySet
> xShape( getShapeFromPage( 0, 0, xDocShRef
) );
680 // Get first paragraph
681 uno::Reference
<text::XTextRange
> const xParagraph( getParagraphFromShape( 0, xShape
) );
682 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
684 sal_Int32 nParaLeftMargin
= 0;
685 xPropSet
->getPropertyValue( "ParaLeftMargin" ) >>= nParaLeftMargin
;
686 CPPUNIT_ASSERT_EQUAL(sal_uInt32(1000), sal_uInt32(nParaLeftMargin
));
688 sal_Int32 nParaFirstLineIndent
= 0;
689 xPropSet
->getPropertyValue( "ParaFirstLineIndent" ) >>= nParaFirstLineIndent
;
690 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1268), nParaFirstLineIndent
);
692 xDocShRef
->DoClose();
695 void SdOOXMLExportTest1::testCellLeftAndRightMargin()
697 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX
);
698 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
699 sal_Int32 nLeftMargin
, nRightMargin
;
701 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
703 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
704 CPPUNIT_ASSERT( pTableObj
);
706 uno::Reference
< css::table::XTable
> xTable (pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
707 uno::Reference
< css::table::XMergeableCell
> xCell( xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
708 uno::Reference
< beans::XPropertySet
> xCellPropSet(xCell
, uno::UNO_QUERY_THROW
);
710 uno::Any aLeftMargin
= xCellPropSet
->getPropertyValue("TextLeftDistance");
711 aLeftMargin
>>= nLeftMargin
;
713 uno::Any aRightMargin
= xCellPropSet
->getPropertyValue("TextRightDistance");
714 aRightMargin
>>= nRightMargin
;
716 // Convert values to EMU
717 nLeftMargin
= oox::drawingml::convertHmmToEmu( nLeftMargin
);
718 nRightMargin
= oox::drawingml::convertHmmToEmu( nRightMargin
);
720 CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nLeftMargin
);
721 CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nRightMargin
);
723 xDocShRef
->DoClose();
726 void SdOOXMLExportTest1::testMergedCells()
728 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/odp/cellspan.odp"), ODP
);
729 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
730 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
732 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
734 CPPUNIT_ASSERT( pTableObj
);
735 uno::Reference
< table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
736 uno::Reference
< text::XTextRange
> xText1(xTable
->getCellByPosition(3, 0), uno::UNO_QUERY_THROW
);
737 CPPUNIT_ASSERT_EQUAL( OUString("0,3"), xText1
->getString() );
739 uno::Reference
< text::XTextRange
> xText2(xTable
->getCellByPosition(3, 2), uno::UNO_QUERY_THROW
);
740 CPPUNIT_ASSERT_EQUAL( OUString("2,3"), xText2
->getString() );
743 void SdOOXMLExportTest1::testTableCellBorder()
745 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX
);
746 xDocShRef
= saveAndReload( xDocShRef
.get(), PPTX
);
748 const SdrPage
*pPage
= GetPage( 1, xDocShRef
);
750 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
751 CPPUNIT_ASSERT( pTableObj
);
753 table::BorderLine2 aBorderLine
;
755 uno::Reference
< table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
756 uno::Reference
< css::table::XMergeableCell
> xCell(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
757 uno::Reference
< beans::XPropertySet
> xCellPropSet (xCell
, uno::UNO_QUERY_THROW
);
759 xCellPropSet
->getPropertyValue("LeftBorder") >>= aBorderLine
;
760 sal_Int32 nLeftBorder
= aBorderLine
.LineWidth
;
761 // While importing the table cell border line width, it converts EMU->Hmm then divided result by 2.
762 // To get original value of LineWidth need to multiple by 2.
763 nLeftBorder
= nLeftBorder
* 2 ;
764 nLeftBorder
= oox::drawingml::convertHmmToEmu( nLeftBorder
);
765 CPPUNIT_ASSERT(nLeftBorder
);
766 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine
.Color
);
768 xCellPropSet
->getPropertyValue("RightBorder") >>= aBorderLine
;
769 sal_Int32 nRightBorder
= aBorderLine
.LineWidth
;
770 nRightBorder
= nRightBorder
* 2 ;
771 nRightBorder
= oox::drawingml::convertHmmToEmu( nRightBorder
);
772 CPPUNIT_ASSERT(nRightBorder
);
773 CPPUNIT_ASSERT_EQUAL(util::Color(16777215), aBorderLine
.Color
);
775 xCellPropSet
->getPropertyValue("TopBorder") >>= aBorderLine
;
776 sal_Int32 nTopBorder
= aBorderLine
.LineWidth
;
777 nTopBorder
= nTopBorder
* 2 ;
778 nTopBorder
= oox::drawingml::convertHmmToEmu( nTopBorder
);
779 CPPUNIT_ASSERT(nTopBorder
);
780 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine
.Color
);
783 xCellPropSet
->getPropertyValue("BottomBorder") >>= aBorderLine
;
784 sal_Int32 nBottomBorder
= aBorderLine
.LineWidth
;
785 nBottomBorder
= nBottomBorder
* 2 ;
786 nBottomBorder
= oox::drawingml::convertHmmToEmu( nBottomBorder
);
787 CPPUNIT_ASSERT(nBottomBorder
);
788 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine
.Color
);
790 xDocShRef
->DoClose();
793 void SdOOXMLExportTest1::testTdf111884()
795 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf111884.pptx"), PPTX
);
796 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
);
798 const SdrPage
*pPage
= GetPage(1, xDocShRef
);
799 SdrObject
const* pShape
= pPage
->GetObj(2);
800 CPPUNIT_ASSERT_MESSAGE("no shape", pShape
!= nullptr);
802 // must be a group shape
803 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16
>(OBJ_GRUP
), pShape
->GetObjIdentifier());
805 xDocShRef
->DoClose();
808 void SdOOXMLExportTest1::testTdf112633()
810 // Load document and export it to a temporary file
811 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/tdf112633.pptx"), PPTX
);
812 utl::TempFile tempFile
;
813 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
814 xDocShRef
->DoClose();
816 xmlDocPtr pXmlDoc
= parseExport(tempFile
, "ppt/slides/slide1.xml");
817 xmlDocPtr pRelsDoc
= parseExport(tempFile
, "ppt/slides/_rels/slide1.xml.rels");
819 // Check image with artistic effect exists in the slide
820 assertXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/"
821 "a14:imgLayer/a14:imgEffect/a14:artisticPencilGrayscale",
824 // Check there is a relation with the .wdp file that contains the backed up image
825 OUString sEmbedId1
= getXPath(pXmlDoc
, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:extLst/"
826 "a:ext/a14:imgProps/a14:imgLayer", "embed");
827 OUString sXmlPath
= "/rels:Relationships/rels:Relationship[@Id='" + sEmbedId1
+ "']";
828 assertXPath(pRelsDoc
, OUStringToOString( sXmlPath
, RTL_TEXTENCODING_UTF8
), "Target", "../media/hdphoto1.wdp");
830 // Check the .wdp file exists
831 uno::Reference
<packages::zip::XZipFileAccess2
> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(
832 comphelper::getComponentContext(m_xSFactory
), tempFile
.GetURL());
833 CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess
->hasByName("ppt/media/hdphoto1.wdp")));
836 void SdOOXMLExportTest1::testCustomXml()
838 // Load document and export it to a temporary file
839 ::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories
.getURLFromSrc("sd/qa/unit/data/pptx/customxml.pptx"), PPTX
);
840 utl::TempFile tempFile
;
841 xDocShRef
= saveAndReload(xDocShRef
.get(), PPTX
, &tempFile
);
842 xDocShRef
->DoClose();
844 xmlDocPtr pXmlDoc
= parseExport(tempFile
, "customXml/item1.xml");
845 CPPUNIT_ASSERT(pXmlDoc
);
846 xmlDocPtr pRelsDoc
= parseExport(tempFile
, "customXml/_rels/item1.xml.rels");
847 CPPUNIT_ASSERT(pRelsDoc
);
849 // Check there is a relation to itemProps1.xml.
850 const OUString sXmlPath
= "/rels:Relationships/rels:Relationship[@Id='rId1']";
851 assertXPath(pRelsDoc
, OUStringToOString(sXmlPath
, RTL_TEXTENCODING_UTF8
), "Target", "itemProps1.xml");
853 std::shared_ptr
<SvStream
> pStream
= parseExportStream(tempFile
, "ddp/ddpfile.xen");
854 CPPUNIT_ASSERT(pStream
);
857 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1
);
859 CPPUNIT_PLUGIN_IMPLEMENT();
861 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */