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/processfactory.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 <rsc/rscsfx.hxx>
32 #include <svx/svdoutl.hxx>
33 #include <svx/svdotext.hxx>
34 #include <svx/svdoashp.hxx>
35 #include <svx/svdograf.hxx>
36 #include <svx/svdogrp.hxx>
37 #include <svx/svdomedia.hxx>
38 #include <svx/svdoole2.hxx>
39 #include <svx/xflclit.hxx>
40 #include <animations/animationnodehelper.hxx>
41 #include <unotools/mediadescriptor.hxx>
42 #include <rtl/ustring.hxx>
44 #include <com/sun/star/drawing/XDrawPage.hpp>
45 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
46 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
47 #include <com/sun/star/animations/XAnimationNode.hpp>
48 #include <com/sun/star/animations/XAnimate.hpp>
49 #include <com/sun/star/beans/XPropertySet.hpp>
50 #include <com/sun/star/chart/XChartDocument.hpp>
51 #include <com/sun/star/chart2/XChartDocument.hpp>
52 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
53 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
54 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
55 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
56 #include <com/sun/star/chart2/data/XDataSequence.hpp>
57 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
58 #include <com/sun/star/awt/XBitmap.hpp>
59 #include <com/sun/star/awt/FontDescriptor.hpp>
60 #include <com/sun/star/graphic/XGraphic.hpp>
61 #include <com/sun/star/frame/XStorable.hpp>
62 #include <com/sun/star/drawing/FillStyle.hpp>
63 #include <com/sun/star/text/WritingMode2.hpp>
64 #include <com/sun/star/text/XTextField.hpp>
65 #include <com/sun/star/table/BorderLine2.hpp>
66 #include <com/sun/star/table/XTable.hpp>
67 #include <com/sun/star/table/XMergeableCell.hpp>
69 #include <svx/svdotable.hxx>
70 #include <com/sun/star/table/XTable.hpp>
71 #include <com/sun/star/table/XMergeableCell.hpp>
73 #include <config_features.h>
74 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
76 using namespace ::com::sun::star
;
78 class SdExportTest
: public SdModelTestBase
82 void testBnc870233_1();
83 void testBnc870233_2();
86 void testMediaEmbedding();
91 void testBnc862510_5();
92 void testBnc822347_EmptyBullet();
95 void testSwappedOutImageExport();
96 void testLinkedGraphicRT();
97 void testImageWithSpecialID();
98 void testTableCellFillProperties();
99 void testBulletStartNumber();
100 void testLineStyle();
101 void testCellLeftAndRightMargin();
102 void testRightToLeftParaghraph();
103 void testTextboxWithHyperlink();
104 void testTableCellBorder();
105 void testBulletColor();
106 void testBulletCharAndFont();
107 void testBulletMarginAndIndentation();
108 void testParaMarginAndindentation();
112 void testBnc822341();
116 CPPUNIT_TEST_SUITE(SdExportTest
);
117 CPPUNIT_TEST(testFdo90607
);
118 CPPUNIT_TEST(testN821567
);
119 CPPUNIT_TEST(testBnc870233_1
);
120 CPPUNIT_TEST(testBnc870233_2
);
121 CPPUNIT_TEST(testN828390_4
);
122 CPPUNIT_TEST(testN828390_5
);
123 CPPUNIT_TEST(testMediaEmbedding
);
124 CPPUNIT_TEST(testFdo71961
);
125 CPPUNIT_TEST(testFdo84043
);
126 CPPUNIT_TEST(testN828390
);
127 CPPUNIT_TEST(testBnc880763
);
128 CPPUNIT_TEST(testBnc862510_5
);
129 CPPUNIT_TEST(testBnc822347_EmptyBullet
);
130 CPPUNIT_TEST(testFdo83751
);
131 CPPUNIT_TEST(testFdo79731
);
132 CPPUNIT_TEST(testSwappedOutImageExport
);
133 CPPUNIT_TEST(testLinkedGraphicRT
);
134 CPPUNIT_TEST(testImageWithSpecialID
);
135 CPPUNIT_TEST(testTableCellFillProperties
);
136 CPPUNIT_TEST(testBulletStartNumber
);
137 CPPUNIT_TEST(testLineStyle
);
138 CPPUNIT_TEST(testCellLeftAndRightMargin
);
139 CPPUNIT_TEST(testRightToLeftParaghraph
);
140 CPPUNIT_TEST(testTextboxWithHyperlink
);
141 CPPUNIT_TEST(testTableCellBorder
);
142 CPPUNIT_TEST(testBulletColor
);
143 CPPUNIT_TEST(testBulletCharAndFont
);
144 CPPUNIT_TEST(testBulletMarginAndIndentation
);
145 CPPUNIT_TEST(testParaMarginAndindentation
);
148 CPPUNIT_TEST(testBnc822341
);
150 CPPUNIT_TEST(testTdf80224
);
151 CPPUNIT_TEST_SUITE_END();
154 void SdExportTest::testN821567()
157 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX
);
159 xDocShRef
= saveAndReload( xDocShRef
, ODP
);
160 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
161 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
162 CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc
->getDrawPages()->getCount() == 1 );
163 uno::Reference
< drawing::XDrawPage
> xPage(
164 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
166 uno::Reference
< beans::XPropertySet
> xPropSet( xPage
, uno::UNO_QUERY
);
167 uno::Any aAny
= xPropSet
->getPropertyValue( OUString("Background") );
170 uno::Reference
< beans::XPropertySet
> aXBackgroundPropSet
;
171 aAny
>>= aXBackgroundPropSet
;
172 aAny
= aXBackgroundPropSet
->getPropertyValue( OUString("FillBitmapName"));
175 CPPUNIT_ASSERT_MESSAGE("Slide Background is not exported properly", !bgImage
.isEmpty());
177 xDocShRef
->DoClose();
182 void checkFontAttributes(const SdrTextObj
* pObj
, sal_uInt32 nColor
,
183 bool bCheckWeight
, FontWeight eWeight
, bool bCheckItalic
, FontItalic eItalic
)
185 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= NULL
);
186 const EditTextObject
& aEdit
= pObj
->GetOutlinerParaObject()->GetTextObject();
187 std::vector
<EECharAttrib
> rLst
;
188 aEdit
.GetCharAttribs(0, rLst
);
189 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
191 const SvxColorItem
*pCharColor
= dynamic_cast<const SvxColorItem
*>((*it
).pAttr
);
194 CPPUNIT_ASSERT_EQUAL( nColor
, pCharColor
->GetValue().GetColor());
199 const SvxWeightItem
*pWeight
= dynamic_cast<const SvxWeightItem
*>((*it
).pAttr
);
202 CPPUNIT_ASSERT_EQUAL( eWeight
, pWeight
->GetWeight());
208 const SvxPostureItem
*pPosture
= dynamic_cast<const SvxPostureItem
*>((*it
).pAttr
);
211 CPPUNIT_ASSERT_EQUAL( eItalic
, pPosture
->GetPosture());
220 void SdExportTest::testBnc870233_1()
222 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX
);
223 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
225 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
226 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
227 const SdrPage
*pPage
= pDoc
->GetPage (1);
228 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
230 // The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones)
232 // First shape has red, bold font
234 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 0 ) );
235 checkFontAttributes(pObj
, sal_uInt32(0xff0000),
236 true, WEIGHT_BOLD
, true, ITALIC_NONE
);
239 // Second shape has blue, italic font
241 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 1 ) );
242 checkFontAttributes(pObj
, sal_uInt32(0x0000ff),
243 true, WEIGHT_NORMAL
, true, ITALIC_NORMAL
);
246 xDocShRef
->DoClose();
249 void SdExportTest::testBnc870233_2()
251 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX
);
252 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
254 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
255 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
256 const SdrPage
*pPage
= pDoc
->GetPage (1);
257 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
259 // The problem was in some SmartArts font color was wrong
261 // First smart art has blue font color (direct formatting)
263 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 0 ) );
264 checkFontAttributes(pObj
, sal_uInt32(0x0000ff),
265 false, WEIGHT_DONTKNOW
, false, ITALIC_NONE
);
268 // Second smart art has "dk2" font color (style)
270 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 1 ) );
271 checkFontAttributes(pObj
, sal_uInt32(0x1F497D),
272 false, WEIGHT_DONTKNOW
, false, ITALIC_NONE
);
275 // Third smart art has white font color (style)
277 const SdrTextObj
*pObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj( 2 ) );
278 checkFontAttributes(pObj
, sal_uInt32(0xffffff),
279 false, WEIGHT_DONTKNOW
, false, ITALIC_NONE
);
282 xDocShRef
->DoClose();
285 void SdExportTest::testN828390_4()
287 bool bPassed
= false;
288 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP
);
290 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
292 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
293 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
294 const SdrPage
*pPage
= pDoc
->GetPage(1);
295 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
297 std::vector
<EECharAttrib
> rLst
;
298 SdrObject
*pObj
= pPage
->GetObj(0);
299 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
300 CPPUNIT_ASSERT( pTxtObj
);
301 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
302 aEdit
.GetCharAttribs(1, rLst
);
303 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
305 const SvxFontHeightItem
* pFontHeight
= dynamic_cast<const SvxFontHeightItem
*>((*it
).pAttr
);
307 CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight
->GetHeight() == 1129 );
308 const SvxFontItem
*pFont
= dynamic_cast<const SvxFontItem
*>((*it
).pAttr
);
311 CPPUNIT_ASSERT_MESSAGE( "Font is wrong", pFont
->GetFamilyName() == "Arial");
314 const SvxWeightItem
*pWeight
= dynamic_cast<const SvxWeightItem
*>((*it
).pAttr
);
316 CPPUNIT_ASSERT_MESSAGE( "Font Weight is wrong", pWeight
->GetWeight() == WEIGHT_BOLD
);
319 CPPUNIT_ASSERT(bPassed
);
321 xDocShRef
->DoClose();
324 void SdExportTest::testN828390_5()
326 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP
);
328 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
330 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
331 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
332 const SdrPage
*pPage
= pDoc
->GetPage(1);
333 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
335 SdrObject
*pObj
= pPage
->GetObj(0);
336 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
337 CPPUNIT_ASSERT( pTxtObj
);
338 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
339 const SvxNumBulletItem
*pNumFmt
= dynamic_cast<const SvxNumBulletItem
*>(aEdit
.GetPool()->GetItem2(EE_PARA_NUMBULLET
, 5));
340 CPPUNIT_ASSERT( pNumFmt
);
341 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's relative size is wrong!", pNumFmt
->GetNumRule()->GetLevel(1).GetBulletRelSize(), sal_uInt16(75) ); // != 25
344 xDocShRef
->DoClose();
347 void SdExportTest::testMediaEmbedding()
349 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP
);
351 #if HAVE_FEATURE_GLTF
352 xDocShRef
= saveAndReload( xDocShRef
, ODP
);
355 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
356 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
357 const SdrPage
*pPage
= pDoc
->GetPage (1);
358 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
360 #if HAVE_FEATURE_GLTF
361 // First object is a glTF model
362 SdrMediaObj
*pModelObj
= dynamic_cast<SdrMediaObj
*>( pPage
->GetObj( 2 ));
363 CPPUNIT_ASSERT_MESSAGE( "missing model", pModelObj
!= NULL
);
364 CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Models/duck/duck.json" ), pModelObj
->getMediaProperties().getURL());
365 CPPUNIT_ASSERT_EQUAL( OUString( "model/vnd.gltf+json" ), pModelObj
->getMediaProperties().getMimeType());
367 // If glTF is not supported, then the fallback image is imported
368 SdrGrafObj
*pGrafic
= dynamic_cast<SdrGrafObj
*>( pPage
->GetObj( 2 ));
369 CPPUNIT_ASSERT_MESSAGE( "Could not load glTF fallback image", pGrafic
!= NULL
);
370 CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Models/Fallbacks/duck.png" ), pGrafic
->GetGrafStreamURL());
373 // Second object is a sound
374 SdrMediaObj
*pMediaObj
= dynamic_cast<SdrMediaObj
*>( pPage
->GetObj( 3 ));
375 CPPUNIT_ASSERT_MESSAGE( "missing media object", pMediaObj
!= NULL
);
376 CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Media/button-1.wav" ), pMediaObj
->getMediaProperties().getURL());
377 CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj
->getMediaProperties().getMimeType());
379 xDocShRef
->DoClose();
382 void SdExportTest::testFdo84043()
384 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/fdo84043.odp"), ODP
);
385 xDocShRef
= saveAndReload( xDocShRef
, ODP
);
387 // the bug was duplicate attributes, causing crash in a build with asserts
388 SdDrawDocument
const* pDoc
= xDocShRef
->GetDoc();
389 CPPUNIT_ASSERT_MESSAGE("no document", pDoc
!= nullptr);
390 SdrPage
const* pPage
= pDoc
->GetPage(1);
391 CPPUNIT_ASSERT_MESSAGE("no page", pPage
!= nullptr);
392 SdrObject
const* pShape
= pPage
->GetObj(1);
393 CPPUNIT_ASSERT_MESSAGE("no shape", pShape
!= nullptr);
396 void SdExportTest::testFdo71961()
398 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP
);
400 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
402 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
403 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
404 const SdrPage
*pPage
= pDoc
->GetPage (1);
405 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
407 // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
408 // (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
409 SdrObjCustomShape
*pTxtObj
= dynamic_cast<SdrObjCustomShape
*>( pPage
->GetObj( 1 ));
410 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
411 CPPUNIT_ASSERT_EQUAL( OUString( "Text to be always wrapped" ), pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
412 CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem
&>(pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
))).GetValue());
414 pTxtObj
= dynamic_cast<SdrObjCustomShape
*>( pPage
->GetObj( 2 ));
415 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
416 CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape non-wrapped text" ), pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
417 CPPUNIT_ASSERT_EQUAL( false, (static_cast<const SdrOnOffItem
&>(pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
))).GetValue());
419 pTxtObj
= dynamic_cast<SdrObjCustomShape
*>( pPage
->GetObj( 3 ));
420 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
421 CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape wrapped text" ), pTxtObj
->GetOutlinerParaObject()->GetTextObject().GetText(0));
422 CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem
&>(pTxtObj
->GetMergedItem(SDRATTR_TEXT_WORDWRAP
))).GetValue());
424 xDocShRef
->DoClose();
427 void SdExportTest::testN828390()
429 bool bPassed
= false;
430 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX
);
432 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
434 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
435 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
436 const SdrPage
*pPage
= pDoc
->GetPage(1);
437 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
439 std::vector
<EECharAttrib
> rLst
;
441 SdrObject
*pObj
= pPage
->GetObj(0);
442 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pObj
);
443 CPPUNIT_ASSERT( pTxtObj
);
444 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
445 aEdit
.GetCharAttribs(0, rLst
);
446 for( std::vector
<EECharAttrib
>::reverse_iterator it
= rLst
.rbegin(); it
!=rLst
.rend(); ++it
)
448 const SvxEscapementItem
*pFontEscapement
= dynamic_cast<const SvxEscapementItem
*>((*it
).pAttr
);
451 if( pFontEscapement
->GetEsc() == -25 )
459 CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed
);
461 xDocShRef
->DoClose();
464 void SdExportTest::testBnc880763()
466 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX
);
467 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
469 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
470 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
471 const SdrPage
*pPage
= pDoc
->GetPage (1);
472 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
474 // Check z-order of the two shapes, use background color to identify them
475 // First object in the background has blue background color
476 const SdrObject
*pObj
= dynamic_cast<SdrObject
*>( pPage
->GetObj( 0 ) );
477 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= NULL
);
478 CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff),(static_cast< const XColorItem
& >(pObj
->GetMergedItem(XATTR_FILLCOLOR
))).GetColorValue().GetColor());
480 // Second object at the front has green background color
481 pObj
= dynamic_cast<SdrObject
*>( pPage
->GetObj( 1 ) );
482 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= NULL
);
483 CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem
& >(pObj
->GetMergedItem(XATTR_FILLCOLOR
))).GetColorValue().GetColor());
485 xDocShRef
->DoClose();
488 void SdExportTest::testBnc862510_5()
490 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX
);
491 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
493 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
494 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
495 const SdrPage
*pPage
= pDoc
->GetPage (1);
496 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
498 // Same as testBnc870237, but here we check the horizontal spacing
499 const SdrObject
* pObj
= dynamic_cast<SdrObject
*>( pPage
->GetObj( 1 ) );
500 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= NULL
);
501 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem
& >(pObj
->GetMergedItem(SDRATTR_TEXT_UPPERDIST
))).GetValue());
502 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem
& >(pObj
->GetMergedItem(SDRATTR_TEXT_LOWERDIST
))).GetValue());
503 CPPUNIT_ASSERT_EQUAL( sal_Int32(7510), (static_cast< const SdrMetricItem
& >(pObj
->GetMergedItem(SDRATTR_TEXT_RIGHTDIST
))).GetValue());
504 CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem
& >(pObj
->GetMergedItem(SDRATTR_TEXT_LEFTDIST
))).GetValue());
506 xDocShRef
->DoClose();
509 // In numbering a bullet could be defined as empty (no character).
510 // When exporting to OOXML make sure that the bullet is ignored and
511 // not written into the file.
512 void SdExportTest::testBnc822347_EmptyBullet()
514 sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP
);
515 xDocShRef
= saveAndReload(xDocShRef
, PPTX
);
517 SdDrawDocument
* pDoc
= xDocShRef
->GetDoc();
518 SdrOutliner
* pOutliner
= pDoc
->GetInternalOutliner();
519 const SdrPage
* pPage
= pDoc
->GetPage(1);
520 SdrObject
* pObject
= pPage
->GetObj(0);
521 SdrTextObj
* pTextObject
= dynamic_cast<SdrTextObj
*>(pObject
);
522 CPPUNIT_ASSERT(pTextObject
);
524 OutlinerParaObject
* pOutlinerParagraphObject
= pTextObject
->GetOutlinerParaObject();
525 const EditTextObject
& aEdit
= pOutlinerParagraphObject
->GetTextObject();
527 OUString sText
= aEdit
.GetText(0);
528 CPPUNIT_ASSERT_EQUAL(OUString("M3 Feature Test"), sText
);
530 pOutliner
->SetText(*pOutlinerParagraphObject
);
531 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner
->GetParagraphCount());
533 const sal_Int16 nDepth
= pOutliner
->GetDepth(0);
535 CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), nDepth
); // depth >= 0 means that the paragraph has bullets enabled
537 xDocShRef
->DoClose();
540 //Bullets not having any text following them are not getting exported to pptx correctly.
541 void SdExportTest::testFdo90607()
543 sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX
);
544 xDocShRef
= saveAndReload(xDocShRef
, PPTX
);
546 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
547 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
549 uno::Reference
< drawing::XDrawPage
> xPage(
550 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
551 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
552 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
554 const SdrPage
*pPage
= pDoc
->GetPage(1);
555 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
556 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(1) );
557 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
558 OutlinerParaObject
* pOutlinerParagraphObject
= pTxtObj
->GetOutlinerParaObject();
559 const sal_Int16 nDepth
= pOutlinerParagraphObject
->GetDepth(0);
560 CPPUNIT_ASSERT_MESSAGE("not equal", nDepth
!= -1);
561 xDocShRef
->DoClose();
564 void SdExportTest::testFdo83751()
566 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX
);
567 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
569 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
570 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
572 uno::Reference
<document::XDocumentPropertiesSupplier
> xDocumentPropertiesSupplier( xDocShRef
->GetModel(), uno::UNO_QUERY
);
573 uno::Reference
<document::XDocumentProperties
> xProps( xDocumentPropertiesSupplier
->getDocumentProperties(), uno::UNO_QUERY
);
574 uno::Reference
<beans::XPropertySet
> xUDProps( xProps
->getUserDefinedProperties(), uno::UNO_QUERY
);
576 xUDProps
->getPropertyValue(OUString("Testing")) >>= propValue
;
577 CPPUNIT_ASSERT_EQUAL(OUString("Document"), propValue
);
578 xDocShRef
->DoClose();
581 void SdExportTest::testFdo79731()
583 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP
);
584 xDocShRef
= saveAndReload(xDocShRef
, PPTX
);
585 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
586 CPPUNIT_ASSERT(pDoc
);
587 xDocShRef
->DoClose();
590 void SdExportTest::testSwappedOutImageExport()
592 // Problem was with the swapped out images, which were not swapped in during export.
593 const sal_Int32 vFormats
[] = {
599 // Set cache size to a very small value to make sure one of the images is swapped out
600 std::shared_ptr
< comphelper::ConfigurationChanges
> xBatch(comphelper::ConfigurationChanges::create());
601 officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), xBatch
);
604 for( size_t nExportFormat
= 0; nExportFormat
< SAL_N_ELEMENTS(vFormats
); ++nExportFormat
)
606 // Load the original file with one image
607 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_two_images.odp"), ODP
);
608 const OString sFailedMessage
= OString("Failed on filter: ") + OString(aFileFormats
[vFormats
[nExportFormat
]].pFilterName
);
610 // Export the document and import again for a check
611 uno::Reference
< lang::XComponent
> xComponent(xDocShRef
->GetModel(), uno::UNO_QUERY
);
612 uno::Reference
<frame::XStorable
> xStorable(xComponent
, uno::UNO_QUERY
);
613 utl::MediaDescriptor aMediaDescriptor
;
614 aMediaDescriptor
["FilterName"] <<= OStringToOUString(OString(aFileFormats
[vFormats
[nExportFormat
]].pFilterName
), RTL_TEXTENCODING_UTF8
);
616 utl::TempFile aTempFile
;
617 aTempFile
.EnableKillingFile();
618 xStorable
->storeToURL(aTempFile
.GetURL(), aMediaDescriptor
.getAsConstPropertyValueList());
619 xComponent
.set(xStorable
, uno::UNO_QUERY
);
620 xComponent
->dispose();
621 xDocShRef
= loadURL(aTempFile
.GetURL(), nExportFormat
);
623 // Check whether graphic exported well after it was swapped out
624 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(xDocShRef
->GetModel(), uno::UNO_QUERY
);
625 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), xDrawPagesSupplier
->getDrawPages()->getCount() == 2 );
626 uno::Reference
< drawing::XDrawPage
> xDrawPage( xDrawPagesSupplier
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
628 uno::Reference
<drawing::XShape
> xImage(xDrawPage
->getByIndex(2), uno::UNO_QUERY
);
629 uno::Reference
< beans::XPropertySet
> XPropSet( xImage
, uno::UNO_QUERY_THROW
);
633 XPropSet
->getPropertyValue("GraphicURL") >>= sURL
;
634 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), sURL
!= "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
638 uno::Reference
<graphic::XGraphic
> xGraphic
;
639 XPropSet
->getPropertyValue("Graphic") >>= xGraphic
;
640 uno::Reference
<awt::XBitmap
> xBitmap(xGraphic
, uno::UNO_QUERY
);
641 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), xBitmap
.is());
642 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(610), xBitmap
->getSize().Width
);
643 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(381), xBitmap
->getSize().Height
);
647 xDrawPage
.set(xDrawPagesSupplier
->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW
);
648 xImage
.set(xDrawPage
->getByIndex(1), uno::UNO_QUERY
);
649 XPropSet
.set( xImage
, uno::UNO_QUERY_THROW
);
653 XPropSet
->getPropertyValue("GraphicURL") >>= sURL
;
654 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), sURL
!= "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
658 uno::Reference
<graphic::XGraphic
> xGraphic
;
659 XPropSet
->getPropertyValue("Graphic") >>= xGraphic
;
660 uno::Reference
<awt::XBitmap
> xBitmap(xGraphic
, uno::UNO_QUERY
);
661 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), xBitmap
.is());
662 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(900), xBitmap
->getSize().Width
);
663 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(600), xBitmap
->getSize().Height
);
665 xDocShRef
->DoClose();
669 void SdExportTest::testLinkedGraphicRT()
671 // Problem was with linked images
672 const sal_Int32 vFormats
[] = {
675 // PPTX, -> this fails now, need a fix
678 for( size_t nExportFormat
= 0; nExportFormat
< SAL_N_ELEMENTS(vFormats
); ++nExportFormat
)
680 // Load the original file with one image
681 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP
);
682 const OString sFailedMessage
= OString("Failed on filter: ") + OString(aFileFormats
[vFormats
[nExportFormat
]].pFilterName
);
684 // Export the document and import again for a check
685 uno::Reference
< lang::XComponent
> xComponent(xDocShRef
->GetModel(), uno::UNO_QUERY
);
686 uno::Reference
<frame::XStorable
> xStorable(xComponent
, uno::UNO_QUERY
);
687 utl::MediaDescriptor aMediaDescriptor
;
688 aMediaDescriptor
["FilterName"] <<= OStringToOUString(OString(aFileFormats
[vFormats
[nExportFormat
]].pFilterName
), RTL_TEXTENCODING_UTF8
);
690 utl::TempFile aTempFile
;
691 aTempFile
.EnableKillingFile();
692 xStorable
->storeToURL(aTempFile
.GetURL(), aMediaDescriptor
.getAsConstPropertyValueList());
693 xComponent
.set(xStorable
, uno::UNO_QUERY
);
694 xComponent
->dispose();
695 xDocShRef
= loadURL(aTempFile
.GetURL(), nExportFormat
);
697 // Check whether graphic imported well after export
698 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
699 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), pDoc
!= NULL
);
700 const SdrPage
*pPage
= pDoc
->GetPage(1);
701 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), pPage
!= NULL
);
702 SdrGrafObj
* pObject
= dynamic_cast<SdrGrafObj
*>(pPage
->GetObj(2));
703 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), pObject
!= NULL
);
704 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), pObject
->IsLinkedGraphic() );
706 const GraphicObject
& rGraphicObj
= pObject
->GetGraphicObject(true);
707 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), !rGraphicObj
.IsSwappedOut());
708 CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage
.getStr(), GRAPHIC_BITMAP
, rGraphicObj
.GetGraphic().GetType());
709 CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage
.getStr(), sal_uLong(864900), rGraphicObj
.GetSizeBytes());
711 xDocShRef
->DoClose();
715 void SdExportTest::testImageWithSpecialID()
717 // Check how LO handles when the imported graphic's ID is different from that one
718 // which is generated by LO.
719 const sal_Int32 vFormats
[] = {
725 // Trigger swap out mechanism to test swapped state factor too.
726 std::shared_ptr
< comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
727 officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch
);
730 for( size_t nExportFormat
= 0; nExportFormat
< SAL_N_ELEMENTS(vFormats
); ++nExportFormat
)
732 // Load the original file
733 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/odp/images_with_special_IDs.odp"), ODP
);
734 const OString sFailedMessage
= OString("Failed on filter: ") + OString(aFileFormats
[vFormats
[nExportFormat
]].pFilterName
);
736 // Export the document and import again for a check
737 uno::Reference
< lang::XComponent
> xComponent(xDocShRef
->GetModel(), uno::UNO_QUERY
);
738 uno::Reference
<frame::XStorable
> xStorable(xComponent
, uno::UNO_QUERY
);
739 utl::MediaDescriptor aMediaDescriptor
;
740 aMediaDescriptor
["FilterName"] <<= OStringToOUString(OString(aFileFormats
[vFormats
[nExportFormat
]].pFilterName
), RTL_TEXTENCODING_UTF8
);
742 utl::TempFile aTempFile
;
743 aTempFile
.EnableKillingFile();
744 xStorable
->storeToURL(aTempFile
.GetURL(), aMediaDescriptor
.getAsConstPropertyValueList());
745 xComponent
.set(xStorable
, uno::UNO_QUERY
);
746 xComponent
->dispose();
747 xDocShRef
= loadURL(aTempFile
.GetURL(), nExportFormat
);
749 // Check whether graphic was exported well
750 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(xDocShRef
->GetModel(), uno::UNO_QUERY
);
751 CPPUNIT_ASSERT_MESSAGE( sFailedMessage
.getStr(), xDrawPagesSupplier
->getDrawPages()->getCount() == 2 );
752 uno::Reference
< drawing::XDrawPage
> xDrawPage( xDrawPagesSupplier
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
754 uno::Reference
<drawing::XShape
> xImage(xDrawPage
->getByIndex(2), uno::UNO_QUERY
);
755 uno::Reference
< beans::XPropertySet
> XPropSet( xImage
, uno::UNO_QUERY_THROW
);
759 XPropSet
->getPropertyValue("GraphicURL") >>= sURL
;
760 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), sURL
!= "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
764 uno::Reference
<graphic::XGraphic
> xGraphic
;
765 XPropSet
->getPropertyValue("Graphic") >>= xGraphic
;
766 uno::Reference
<awt::XBitmap
> xBitmap(xGraphic
, uno::UNO_QUERY
);
767 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), xBitmap
.is());
768 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(610), xBitmap
->getSize().Width
);
769 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(381), xBitmap
->getSize().Height
);
773 xDrawPage
.set(xDrawPagesSupplier
->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW
);
774 xImage
.set(xDrawPage
->getByIndex(1), uno::UNO_QUERY
);
775 XPropSet
.set( xImage
, uno::UNO_QUERY_THROW
);
779 XPropSet
->getPropertyValue("GraphicURL") >>= sURL
;
780 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), sURL
!= "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
784 uno::Reference
<graphic::XGraphic
> xGraphic
;
785 XPropSet
->getPropertyValue("Graphic") >>= xGraphic
;
786 uno::Reference
<awt::XBitmap
> xBitmap(xGraphic
, uno::UNO_QUERY
);
787 CPPUNIT_ASSERT_MESSAGE(sFailedMessage
.getStr(), xBitmap
.is());
788 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(900), xBitmap
->getSize().Width
);
789 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage
.getStr(), static_cast<sal_Int32
>(600), xBitmap
->getSize().Height
);
791 xDocShRef
->DoClose();
794 void SdExportTest::testTableCellFillProperties()
796 std::shared_ptr
< comphelper::ConfigurationChanges
> batch(comphelper::ConfigurationChanges::create());
797 officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch
);
800 // Load the original file
801 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP
);
803 // Export the document and import again for a check
804 uno::Reference
< lang::XComponent
> xComponent(xDocShRef
->GetModel(), uno::UNO_QUERY
);
805 uno::Reference
<frame::XStorable
> xStorable(xComponent
, uno::UNO_QUERY
);
806 utl::MediaDescriptor aMediaDescriptor
;
807 aMediaDescriptor
["FilterName"] <<= OStringToOUString(OString(aFileFormats
[PPTX
].pFilterName
), RTL_TEXTENCODING_UTF8
);
809 utl::TempFile aTempFile
;
810 aTempFile
.EnableKillingFile();
811 xStorable
->storeToURL(aTempFile
.GetURL(), aMediaDescriptor
.getAsConstPropertyValueList());
812 xComponent
.set(xStorable
, uno::UNO_QUERY
);
813 xComponent
->dispose();
814 xDocShRef
= loadURL(aTempFile
.GetURL(), PPTX
);
816 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
817 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
818 const SdrPage
*pPage
= pDoc
->GetPage(1);
819 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
821 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
822 CPPUNIT_ASSERT( pTableObj
);
823 uno::Reference
< table::XCellRange
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
824 uno::Reference
< beans::XPropertySet
> xCell
;
826 // Test Solid fill color
828 xCell
.set(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
829 xCell
->getPropertyValue("FillColor") >>= nColor
;
830 CPPUNIT_ASSERT_EQUAL(sal_Int32(6750207), nColor
);
832 // Test Picture fill type for cell
833 drawing::FillStyle
aFillStyle( drawing::FillStyle_NONE
);
834 xCell
.set(xTable
->getCellByPosition(0, 1), uno::UNO_QUERY_THROW
);
835 xCell
->getPropertyValue("FillStyle") >>= aFillStyle
;
836 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP
, aFillStyle
);
838 // Test Gradient fill type for cell
839 xCell
.set(xTable
->getCellByPosition(1, 0), uno::UNO_QUERY_THROW
);
840 xCell
->getPropertyValue("FillStyle") >>= aFillStyle
;
841 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT
, aFillStyle
);
843 xDocShRef
->DoClose();
846 void SdExportTest::testBulletStartNumber()
848 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX
);
849 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
851 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
852 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
854 uno::Reference
< drawing::XDrawPage
> xPage(
855 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
856 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
857 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
859 const SdrPage
*pPage
= pDoc
->GetPage(1);
860 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
861 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
862 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
863 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
864 const SvxNumBulletItem
*pNumFmt
= dynamic_cast<const SvxNumBulletItem
*>(aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
));
865 CPPUNIT_ASSERT(pNumFmt
);
866 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's start number is wrong!", sal_Int16(pNumFmt
->GetNumRule()->GetLevel(0).GetStart()), sal_Int16(3) );
867 xDocShRef
->DoClose();
870 void SdExportTest::testLineStyle()
872 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX
);
873 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
875 SdDrawDocument
const* pDoc
= xDocShRef
->GetDoc();
876 CPPUNIT_ASSERT_MESSAGE("no document", pDoc
!= nullptr);
877 SdrPage
const* pPage
= pDoc
->GetPage(1);
878 CPPUNIT_ASSERT_MESSAGE("no page", pPage
!= nullptr);
879 SdrObject
const* pShape
= pPage
->GetObj(0);
880 CPPUNIT_ASSERT_MESSAGE("no shape", pShape
!= nullptr);
882 const XLineStyleItem
& rStyleItem
= dynamic_cast<const XLineStyleItem
&>(
883 pShape
->GetMergedItem(XATTR_LINESTYLE
));
884 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong style",drawing::LineStyle_SOLID
, rStyleItem
.GetValue());
886 xDocShRef
->DoClose();
889 void SdExportTest::testRightToLeftParaghraph()
891 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX
);
893 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
895 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
896 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
898 uno::Reference
< drawing::XDrawPage
> xPage(
899 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
901 uno::Reference
< beans::XPropertySet
> xShape(
902 xPage
->getByIndex(0), uno::UNO_QUERY
);
903 CPPUNIT_ASSERT_MESSAGE( "no shape", xShape
.is() );
905 // Get first paragraph
906 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY
)->getText();
907 CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText
.is() );
908 uno::Reference
<container::XEnumerationAccess
> paraEnumAccess
;
909 paraEnumAccess
.set(xText
, uno::UNO_QUERY
);
910 uno::Reference
<container::XEnumeration
> paraEnum
= paraEnumAccess
->createEnumeration();
911 uno::Reference
<text::XTextRange
> const xParagraph(paraEnum
->nextElement(),
912 uno::UNO_QUERY_THROW
);
913 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
915 sal_Int16 nWritingMode
= 0;
916 xPropSet
->getPropertyValue( "WritingMode" ) >>= nWritingMode
;
917 CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB
, nWritingMode
);
919 xDocShRef
->DoClose();
922 void SdExportTest::testTextboxWithHyperlink()
924 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX
);
926 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
928 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
929 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
931 uno::Reference
< drawing::XDrawPage
> xPage(
932 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
934 uno::Reference
< beans::XPropertySet
> xShape(
935 xPage
->getByIndex(0), uno::UNO_QUERY
);
936 CPPUNIT_ASSERT_MESSAGE( "no shape", xShape
.is() );
938 // Get first paragraph
939 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY
)->getText();
940 CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText
.is() );
941 uno::Reference
<container::XEnumerationAccess
> paraEnumAccess
;
942 paraEnumAccess
.set(xText
, uno::UNO_QUERY
);
943 uno::Reference
<container::XEnumeration
> paraEnum
= paraEnumAccess
->createEnumeration();
944 uno::Reference
<text::XTextRange
> const xParagraph(paraEnum
->nextElement(),
945 uno::UNO_QUERY_THROW
);
947 // first chunk of text
948 uno::Reference
<container::XEnumerationAccess
> xRunEnumAccess(xParagraph
, uno::UNO_QUERY
);
949 uno::Reference
<container::XEnumeration
> xRunEnum
= xRunEnumAccess
->createEnumeration();
950 uno::Reference
<text::XTextRange
> xRun(xRunEnum
->nextElement(), uno::UNO_QUERY
);
951 uno::Reference
< beans::XPropertySet
> xPropSet( xRun
, uno::UNO_QUERY_THROW
);
953 uno::Reference
<text::XTextField
> xField
;
954 xPropSet
->getPropertyValue("TextField") >>= xField
;
955 CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField
.is() );
957 xPropSet
.set(xField
, uno::UNO_QUERY
);
959 xPropSet
->getPropertyValue("URL") >>= aURL
;
960 CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", OUString("http://www.xkcd.com/"), aURL
);
962 xDocShRef
->DoClose();
965 void SdExportTest::testBulletColor()
967 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX
);
969 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
971 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
972 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
974 uno::Reference
< drawing::XDrawPage
> xPage(
975 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
976 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
977 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
979 const SdrPage
*pPage
= pDoc
->GetPage(1);
980 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
982 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
983 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
985 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
986 const SvxNumBulletItem
*pNumFmt
= dynamic_cast<const SvxNumBulletItem
*>(aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
));
987 CPPUNIT_ASSERT(pNumFmt
);
988 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt
->GetNumRule()->GetLevel(0).GetBulletColor().GetColor());
991 void SdExportTest::testBulletCharAndFont()
993 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP
);
994 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
995 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc( xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
996 uno::Reference
< drawing::XDrawPage
> xPage( xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
997 uno::Reference
< drawing::XShape
> xShape(xPage
->getByIndex(0), uno::UNO_QUERY
);
998 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY_THROW
)->getText();
999 uno::Reference
<container::XEnumerationAccess
> paraEnumAccess
;
1000 paraEnumAccess
.set(xText
, uno::UNO_QUERY
);
1001 uno::Reference
<container::XEnumeration
> paraEnum
= paraEnumAccess
->createEnumeration();
1002 uno::Reference
<text::XTextRange
> const xParagraph(paraEnum
->nextElement(), uno::UNO_QUERY_THROW
);
1003 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
1004 uno::Reference
<container::XIndexAccess
> xLevels(xPropSet
->getPropertyValue("NumberingRules"), uno::UNO_QUERY
);
1005 uno::Sequence
<beans::PropertyValue
> aProps
;
1006 xLevels
->getByIndex(0) >>= aProps
; // 1st level
1007 OUString
sBulletChar(sal_Unicode(0xf06c));
1008 for (int i
= 0; i
< aProps
.getLength(); ++i
)
1010 const beans::PropertyValue
& rProp
= aProps
[i
];
1011 if (rProp
.Name
== "BulletChar")
1012 CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletChar incorrect.", sBulletChar
,rProp
.Value
.get
<OUString
>());
1013 if (rProp
.Name
== "BulletFont")
1015 awt::FontDescriptor aFontDescriptor
;
1016 rProp
.Value
>>= aFontDescriptor
;
1017 CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletFont incorrect.", OUString("Wingdings"),aFontDescriptor
.Name
);
1020 xDocShRef
->DoClose();
1025 void SdExportTest::testBnc822341()
1027 // Check import / export of embedded text document
1028 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP
);
1029 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1031 // Export an LO specific ole object (imported from an ODP document)
1033 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1034 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
1035 const SdrPage
*pPage
= pDoc
->GetPage(1);
1036 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
1038 const SdrObject
* pObj
= dynamic_cast<SdrObject
*>( pPage
->GetObj(0) );
1039 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= NULL
);
1040 CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier() );
1043 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1045 // Export an MS specific ole object (imported from a PPTX document)
1047 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1048 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
1049 const SdrPage
*pPage
= pDoc
->GetPage(1);
1050 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
1052 const SdrObject
* pObj
= dynamic_cast<SdrObject
*>( pPage
->GetObj(0) );
1053 CPPUNIT_ASSERT_MESSAGE( "no object", pObj
!= NULL
);
1054 CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16
>(OBJ_OLE2
), pObj
->GetObjIdentifier() );
1057 xDocShRef
->DoClose();
1062 void SdExportTest::testBulletMarginAndIndentation()
1064 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX
);
1066 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1068 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
1069 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1070 uno::Reference
< drawing::XDrawPage
> xPage(
1071 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1072 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1073 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
1075 const SdrPage
*pPage
= pDoc
->GetPage(1);
1076 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
1078 SdrTextObj
*pTxtObj
= dynamic_cast<SdrTextObj
*>( pPage
->GetObj(0) );
1079 CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj
!= NULL
);
1081 const EditTextObject
& aEdit
= pTxtObj
->GetOutlinerParaObject()->GetTextObject();
1082 const SvxNumBulletItem
*pNumFmt
= dynamic_cast<const SvxNumBulletItem
*>(aEdit
.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET
));
1083 CPPUNIT_ASSERT(pNumFmt
);
1085 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's left margin is wrong!", sal_uInt32(1000),sal_uInt32(pNumFmt
->GetNumRule()->GetLevel(0).GetAbsLSpace()) ); // left margin is 0.79 cm
1086 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's indentation is wrong!", sal_Int32(-998),sal_Int32(pNumFmt
->GetNumRule()->GetLevel(0). GetFirstLineOffset()));
1089 void SdExportTest::testParaMarginAndindentation()
1091 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX
);
1093 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1095 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
1096 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1098 uno::Reference
< drawing::XDrawPage
> xPage(
1099 xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1101 uno::Reference
< beans::XPropertySet
> xShape(
1102 xPage
->getByIndex(0), uno::UNO_QUERY
);
1103 CPPUNIT_ASSERT_MESSAGE( "no shape", xShape
.is() );
1105 // Get first paragraph
1106 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY
)->getText();
1107 CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText
.is() );
1108 uno::Reference
<container::XEnumerationAccess
> paraEnumAccess
;
1109 paraEnumAccess
.set(xText
, uno::UNO_QUERY
);
1110 uno::Reference
<container::XEnumeration
> paraEnum
= paraEnumAccess
->createEnumeration();
1111 uno::Reference
<text::XTextRange
> const xParagraph(paraEnum
->nextElement(),
1112 uno::UNO_QUERY_THROW
);
1113 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
, uno::UNO_QUERY_THROW
);
1115 sal_Int32 nParaLeftMargin
= 0;
1116 xPropSet
->getPropertyValue( "ParaLeftMargin" ) >>= nParaLeftMargin
;
1117 CPPUNIT_ASSERT_EQUAL(sal_uInt32(1000), sal_uInt32(nParaLeftMargin
));
1119 sal_Int32 nParaFirstLineIndent
= 0;
1120 xPropSet
->getPropertyValue( "ParaFirstLineIndent" ) >>= nParaFirstLineIndent
;
1121 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1268), sal_Int32(nParaFirstLineIndent
));
1123 xDocShRef
->DoClose();
1126 void SdExportTest::testCellLeftAndRightMargin()
1128 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX
);
1129 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1130 sal_Int32 nLeftMargin
, nRightMargin
;
1132 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(
1133 xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1135 uno::Reference
< drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1136 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1137 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
1139 const SdrPage
*pPage
= pDoc
->GetPage(1);
1140 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
1142 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1143 CPPUNIT_ASSERT( pTableObj
);
1145 uno::Reference
< com::sun::star::table::XTable
> xTable (pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
1146 uno::Reference
< com::sun::star::table::XMergeableCell
> xCell( xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
1147 uno::Reference
< beans::XPropertySet
> xCellPropSet(xCell
, uno::UNO_QUERY_THROW
);
1149 uno::Any aLeftMargin
= xCellPropSet
->getPropertyValue("TextLeftDistance");
1150 aLeftMargin
>>= nLeftMargin
;
1152 uno::Any aRightMargin
= xCellPropSet
->getPropertyValue("TextRightDistance");
1153 aRightMargin
>>= nRightMargin
;
1155 // Convert values to EMU
1156 nLeftMargin
= oox::drawingml::convertHmmToEmu( nLeftMargin
);
1157 nRightMargin
= oox::drawingml::convertHmmToEmu( nRightMargin
);
1159 CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nLeftMargin
);
1160 CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nRightMargin
);
1162 xDocShRef
->DoClose();
1165 void SdExportTest::testTableCellBorder()
1167 ::sd::DrawDocShellRef xDocShRef
= loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX
);
1168 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1170 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc(xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1172 uno::Reference
< drawing::XDrawPage
> xPage(xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1173 SdDrawDocument
*pDoc
= xDocShRef
->GetDoc();
1174 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc
!= NULL
);
1176 const SdrPage
*pPage
= pDoc
->GetPage(1);
1177 CPPUNIT_ASSERT_MESSAGE( "no page", pPage
!= NULL
);
1179 sdr::table::SdrTableObj
*pTableObj
= dynamic_cast<sdr::table::SdrTableObj
*>(pPage
->GetObj(0));
1180 CPPUNIT_ASSERT( pTableObj
);
1182 table::BorderLine2 aBorderLine
;
1184 uno::Reference
< table::XTable
> xTable(pTableObj
->getTable(), uno::UNO_QUERY_THROW
);
1185 uno::Reference
< com::sun::star::table::XMergeableCell
> xCell(xTable
->getCellByPosition(0, 0), uno::UNO_QUERY_THROW
);
1186 uno::Reference
< beans::XPropertySet
> xCellPropSet (xCell
, uno::UNO_QUERY_THROW
);
1188 xCellPropSet
->getPropertyValue("LeftBorder") >>= aBorderLine
;
1189 sal_Int32 nLeftBorder
= aBorderLine
.LineWidth
;
1190 // While importing the table cell border line width, it converts EMU->Hmm then divided result by 2.
1191 // To get original value of LineWidth need to multiple by 2.
1192 nLeftBorder
= nLeftBorder
* 2 ;
1193 nLeftBorder
= oox::drawingml::convertHmmToEmu( nLeftBorder
);
1194 CPPUNIT_ASSERT(nLeftBorder
);
1195 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine
.Color
);
1197 xCellPropSet
->getPropertyValue("RightBorder") >>= aBorderLine
;
1198 sal_Int32 nRightBorder
= aBorderLine
.LineWidth
;
1199 nRightBorder
= nRightBorder
* 2 ;
1200 nRightBorder
= oox::drawingml::convertHmmToEmu( nRightBorder
);
1201 CPPUNIT_ASSERT(nRightBorder
);
1202 CPPUNIT_ASSERT_EQUAL(util::Color(16777215), aBorderLine
.Color
);
1204 xCellPropSet
->getPropertyValue("TopBorder") >>= aBorderLine
;
1205 sal_Int32 nTopBorder
= aBorderLine
.LineWidth
;
1206 nTopBorder
= nTopBorder
* 2 ;
1207 nTopBorder
= oox::drawingml::convertHmmToEmu( nTopBorder
);
1208 CPPUNIT_ASSERT(nTopBorder
);
1209 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine
.Color
);
1212 xCellPropSet
->getPropertyValue("BottomBorder") >>= aBorderLine
;
1213 sal_Int32 nBottomBorder
= aBorderLine
.LineWidth
;
1214 nBottomBorder
= nBottomBorder
* 2 ;
1215 nBottomBorder
= oox::drawingml::convertHmmToEmu( nBottomBorder
);
1216 CPPUNIT_ASSERT(nBottomBorder
);
1217 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine
.Color
);
1219 xDocShRef
->DoClose();
1222 void SdExportTest::testTdf80224()
1224 ::sd::DrawDocShellRef xDocShRef
= loadURL( getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP
);
1225 xDocShRef
= saveAndReload( xDocShRef
, PPTX
);
1226 uno::Reference
< drawing::XDrawPagesSupplier
> xDoc( xDocShRef
->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW
);
1227 uno::Reference
< drawing::XDrawPage
> xPage( xDoc
->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW
);
1228 uno::Reference
< drawing::XShape
> xShape(xPage
->getByIndex(0), uno::UNO_QUERY
);
1229 uno::Reference
<text::XText
> xText
= uno::Reference
<text::XTextRange
>(xShape
, uno::UNO_QUERY_THROW
)->getText();
1230 uno::Reference
<container::XEnumerationAccess
> paraEnumAccess
;
1231 paraEnumAccess
.set(xText
, uno::UNO_QUERY
);
1232 uno::Reference
<container::XEnumeration
> paraEnum
= paraEnumAccess
->createEnumeration();
1233 uno::Reference
<text::XTextRange
> const xParagraph(paraEnum
->nextElement(), uno::UNO_QUERY_THROW
);
1234 uno::Reference
< beans::XPropertySet
> xPropSet( xParagraph
->getStart(), uno::UNO_QUERY_THROW
);
1235 sal_Int32 nCharColor
;
1236 xPropSet
->getPropertyValue("CharColor") >>= nCharColor
;
1237 CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor
);
1238 xDocShRef
->DoClose();
1241 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest
);
1243 CPPUNIT_PLUGIN_IMPLEMENT();
1245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */