LCOV - code coverage report
Current view: top level - sd/qa/unit - export-tests.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 648 648 100.0 %
Date: 2015-06-13 12:38:46 Functions: 41 42 97.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  */
       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>
      26             : 
      27             : #include <oox/drawingml/drawingmltypes.hxx>
      28             : 
      29             : #include <rsc/rscsfx.hxx>
      30             : 
      31             : 
      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>
      43             : 
      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/graphic/XGraphic.hpp>
      60             : #include <com/sun/star/frame/XStorable.hpp>
      61             : #include <com/sun/star/drawing/FillStyle.hpp>
      62             :  #include <com/sun/star/text/WritingMode2.hpp>
      63             : #include <com/sun/star/table/BorderLine2.hpp>
      64             : #include <com/sun/star/table/XTable.hpp>
      65             : #include <com/sun/star/table/XMergeableCell.hpp>
      66             : 
      67             : #include <svx/svdotable.hxx>
      68             : #include <com/sun/star/table/XTable.hpp>
      69             : #include <com/sun/star/table/XMergeableCell.hpp>
      70             : 
      71             : #include <config_features.h>
      72             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      73             : 
      74             : using namespace ::com::sun::star;
      75             : 
      76          84 : class SdExportTest : public SdModelTestBase
      77             : {
      78             : public:
      79             :     void testN821567();
      80             :     void testBnc870233_1();
      81             :     void testBnc870233_2();
      82             :     void testN828390_4();
      83             :     void testN828390_5();
      84             :     void testMediaEmbedding();
      85             :     void testFdo71961();
      86             :     void testFdo84043();
      87             :     void testN828390();
      88             :     void testBnc880763();
      89             :     void testBnc862510_5();
      90             :     void testBnc822347_EmptyBullet();
      91             :     void testFdo83751();
      92             :     void testFdo79731();
      93             :     void testSwappedOutImageExport();
      94             :     void testLinkedGraphicRT();
      95             :     void testImageWithSpecialID();
      96             :     void testTableCellFillProperties();
      97             :     void testBulletStartNumber();
      98             :     void testLineStyle();
      99             :     void testCellLeftAndRightMargin();
     100             :     void testRightToLeftParaghraph();
     101             :     void testTableCellBorder();
     102             :     void testBulletColor();
     103             :     void testBulletMarginAndIndentation();
     104             :     void testParaMarginAndindentation();
     105             : 
     106             :     void testFdo90607();
     107             : #if !defined WNT
     108             :     void testBnc822341();
     109             : #endif
     110             : 
     111           2 :     CPPUNIT_TEST_SUITE(SdExportTest);
     112           1 :     CPPUNIT_TEST(testFdo90607);
     113           1 :     CPPUNIT_TEST(testN821567);
     114           1 :     CPPUNIT_TEST(testBnc870233_1);
     115           1 :     CPPUNIT_TEST(testBnc870233_2);
     116           1 :     CPPUNIT_TEST(testN828390_4);
     117           1 :     CPPUNIT_TEST(testN828390_5);
     118           1 :     CPPUNIT_TEST(testMediaEmbedding);
     119           1 :     CPPUNIT_TEST(testFdo71961);
     120           1 :     CPPUNIT_TEST(testFdo84043);
     121           1 :     CPPUNIT_TEST(testN828390);
     122           1 :     CPPUNIT_TEST(testBnc880763);
     123           1 :     CPPUNIT_TEST(testBnc862510_5);
     124           1 :     CPPUNIT_TEST(testBnc822347_EmptyBullet);
     125           1 :     CPPUNIT_TEST(testFdo83751);
     126           1 :     CPPUNIT_TEST(testFdo79731);
     127           1 :     CPPUNIT_TEST(testSwappedOutImageExport);
     128           1 :     CPPUNIT_TEST(testLinkedGraphicRT);
     129           1 :     CPPUNIT_TEST(testImageWithSpecialID);
     130           1 :     CPPUNIT_TEST(testTableCellFillProperties);
     131           1 :     CPPUNIT_TEST(testBulletStartNumber);
     132           1 :     CPPUNIT_TEST(testLineStyle);
     133           1 :     CPPUNIT_TEST(testCellLeftAndRightMargin);
     134           1 :     CPPUNIT_TEST(testRightToLeftParaghraph);
     135           1 :     CPPUNIT_TEST(testTableCellBorder);
     136           1 :     CPPUNIT_TEST(testBulletColor);
     137           1 :     CPPUNIT_TEST(testBulletMarginAndIndentation);
     138           1 :     CPPUNIT_TEST(testParaMarginAndindentation);
     139             : 
     140             : #if !defined WNT
     141           1 :     CPPUNIT_TEST(testBnc822341);
     142             : #endif
     143           5 :     CPPUNIT_TEST_SUITE_END();
     144             : };
     145             : 
     146           1 : void SdExportTest::testN821567()
     147             : {
     148           1 :     OUString bgImage;
     149           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX );
     150             : 
     151           1 :     xDocShRef = saveAndReload( xDocShRef, ODP );
     152             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     153           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     154           1 :     CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
     155             :     uno::Reference< drawing::XDrawPage > xPage(
     156           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     157             : 
     158           2 :     uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY );
     159           2 :     uno::Any aAny = xPropSet->getPropertyValue( OUString("Background") );
     160           1 :     if(aAny.hasValue())
     161             :     {
     162           1 :         uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
     163           1 :         aAny >>= aXBackgroundPropSet;
     164           1 :         aAny = aXBackgroundPropSet->getPropertyValue( OUString("FillBitmapName"));
     165           1 :         aAny >>= bgImage;
     166             :     }
     167           1 :     CPPUNIT_ASSERT_MESSAGE("Slide Background is not exported properly", !bgImage.isEmpty());
     168             : 
     169           2 :     xDocShRef->DoClose();
     170           1 : }
     171             : 
     172             : namespace {
     173             : 
     174           5 : void checkFontAttributes(const SdrTextObj* pObj, sal_uInt32 nColor,
     175             :         bool bCheckWeight, FontWeight eWeight, bool bCheckItalic, FontItalic eItalic)
     176             : {
     177           5 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     178           5 :     const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject();
     179           5 :     std::vector<EECharAttrib> rLst;
     180           5 :     aEdit.GetCharAttribs(0, rLst);
     181          93 :     for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     182             :     {
     183          88 :         const SvxColorItem *pCharColor = dynamic_cast<const SvxColorItem *>((*it).pAttr);
     184          88 :         if( pCharColor )
     185             :         {
     186           5 :             CPPUNIT_ASSERT_EQUAL( nColor, pCharColor->GetValue().GetColor());
     187             :         }
     188             : 
     189          88 :         if(bCheckWeight)
     190             :         {
     191          34 :             const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
     192          34 :             if( pWeight )
     193             :             {
     194           6 :                 CPPUNIT_ASSERT_EQUAL( eWeight, pWeight->GetWeight());
     195             :             }
     196             :         }
     197             : 
     198          88 :         if(bCheckItalic)
     199             :         {
     200          34 :             const SvxPostureItem *pPosture = dynamic_cast<const SvxPostureItem *>((*it).pAttr);
     201          34 :             if( pPosture )
     202             :             {
     203           6 :                 CPPUNIT_ASSERT_EQUAL( eItalic, pPosture->GetPosture());
     204             :             }
     205             :         }
     206           5 :     }
     207             : 
     208           5 : }
     209             : 
     210             : }
     211             : 
     212           1 : void SdExportTest::testBnc870233_1()
     213             : {
     214           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
     215           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     216             : 
     217           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     218           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     219           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     220           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     221             : 
     222             :     // The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones)
     223             : 
     224             :     // First shape has red, bold font
     225             :     {
     226           1 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
     227             :         checkFontAttributes(pObj, sal_uInt32(0xff0000),
     228           1 :                 true, WEIGHT_BOLD, true, ITALIC_NONE);
     229             :     }
     230             : 
     231             :     // Second shape has blue, italic font
     232             :     {
     233           1 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
     234             :         checkFontAttributes(pObj, sal_uInt32(0x0000ff),
     235           1 :                 true, WEIGHT_NORMAL, true, ITALIC_NORMAL);
     236             :     }
     237             : 
     238           1 :     xDocShRef->DoClose();
     239           1 : }
     240             : 
     241           1 : void SdExportTest::testBnc870233_2()
     242             : {
     243           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX);
     244           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     245             : 
     246           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     247           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     248           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     249           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     250             : 
     251             :     // The problem was in some SmartArts font color was wrong
     252             : 
     253             :     // First smart art has blue font color (direct formatting)
     254             :     {
     255           1 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
     256             :         checkFontAttributes(pObj, sal_uInt32(0x0000ff),
     257           1 :                 false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
     258             :     }
     259             : 
     260             :     // Second smart art has "dk2" font color (style)
     261             :     {
     262           1 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) );
     263             :         checkFontAttributes(pObj, sal_uInt32(0x1F497D),
     264           1 :                 false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
     265             :     }
     266             : 
     267             :     // Third smart art has white font color (style)
     268             :     {
     269           1 :         const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 2 ) );
     270             :         checkFontAttributes(pObj, sal_uInt32(0xffffff),
     271           1 :                 false, WEIGHT_DONTKNOW, false, ITALIC_NONE);
     272             :     }
     273             : 
     274           1 :     xDocShRef->DoClose();
     275           1 : }
     276             : 
     277           1 : void SdExportTest::testN828390_4()
     278             : {
     279           1 :     bool bPassed = false;
     280           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP );
     281             : 
     282           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     283             : 
     284           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     285           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     286           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     287           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     288             :     {
     289           1 :         std::vector<EECharAttrib> rLst;
     290           1 :         SdrObject *pObj = pPage->GetObj(0);
     291           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     292           1 :         CPPUNIT_ASSERT( pTxtObj );
     293           1 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     294           1 :         aEdit.GetCharAttribs(1, rLst);
     295          16 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     296             :         {
     297          15 :             const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
     298          15 :             if( pFontHeight )
     299           3 :                 CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 1129 );
     300          15 :             const SvxFontItem *pFont = dynamic_cast<const SvxFontItem *>((*it).pAttr);
     301          15 :             if( pFont )
     302             :             {
     303           1 :                 CPPUNIT_ASSERT_MESSAGE( "Font is wrong", pFont->GetFamilyName() == "Arial");
     304           1 :                 bPassed = true;
     305             :             }
     306          15 :             const SvxWeightItem *pWeight = dynamic_cast<const SvxWeightItem *>((*it).pAttr);
     307          15 :             if( pWeight )
     308           3 :                 CPPUNIT_ASSERT_MESSAGE( "Font Weight is wrong", pWeight->GetWeight() == WEIGHT_BOLD);
     309           1 :         }
     310             :     }
     311           1 :     CPPUNIT_ASSERT(bPassed);
     312             : 
     313           1 :     xDocShRef->DoClose();
     314           1 : }
     315             : 
     316           1 : void SdExportTest::testN828390_5()
     317             : {
     318           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP );
     319             : 
     320           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     321             : 
     322           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     323           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     324           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     325           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     326             :     {
     327           1 :         SdrObject *pObj = pPage->GetObj(0);
     328           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     329           1 :         CPPUNIT_ASSERT( pTxtObj );
     330           1 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     331           1 :         const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5));
     332           1 :         CPPUNIT_ASSERT( pNumFmt );
     333           1 :         CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's relative size is wrong!", pNumFmt->GetNumRule()->GetLevel(1).GetBulletRelSize(), sal_uInt16(75) ); // != 25
     334             :     }
     335             : 
     336           1 :     xDocShRef->DoClose();
     337           1 : }
     338             : 
     339           1 : void SdExportTest::testMediaEmbedding()
     340             : {
     341           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP);
     342             : 
     343             : #if HAVE_FEATURE_GLTF
     344           1 :     xDocShRef = saveAndReload( xDocShRef, ODP );
     345             : #endif
     346             : 
     347           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     348           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     349           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     350           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     351             : 
     352             : #if HAVE_FEATURE_GLTF
     353             :     // First object is a glTF model
     354           1 :     SdrMediaObj *pModelObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 2 ));
     355           1 :     CPPUNIT_ASSERT_MESSAGE( "missing model", pModelObj != NULL);
     356           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Models/duck/duck.json" ), pModelObj->getMediaProperties().getURL());
     357           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "model/vnd.gltf+json" ), pModelObj->getMediaProperties().getMimeType());
     358             : #else
     359             :     // If glTF is not supported, then the fallback image is imported
     360             :     SdrGrafObj *pGrafic = dynamic_cast<SdrGrafObj*>( pPage->GetObj( 2 ));
     361             :     CPPUNIT_ASSERT_MESSAGE( "Could not load glTF fallback image", pGrafic != NULL);
     362             :     CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Models/Fallbacks/duck.png" ), pGrafic->GetGrafStreamURL());
     363             : #endif
     364             : 
     365             :     // Second object is a sound
     366           1 :     SdrMediaObj *pMediaObj = dynamic_cast<SdrMediaObj*>( pPage->GetObj( 3 ));
     367           1 :     CPPUNIT_ASSERT_MESSAGE( "missing media object", pMediaObj != NULL);
     368           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "vnd.sun.star.Package:Media/button-1.wav" ), pMediaObj->getMediaProperties().getURL());
     369           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "application/vnd.sun.star.media" ), pMediaObj->getMediaProperties().getMimeType());
     370             : 
     371           1 :     xDocShRef->DoClose();
     372           1 : }
     373             : 
     374           1 : void SdExportTest::testFdo84043()
     375             : {
     376           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo84043.odp"), ODP);
     377           1 :     xDocShRef = saveAndReload( xDocShRef, ODP );
     378             : 
     379             :     // the bug was duplicate attributes, causing crash in a build with asserts
     380           1 :     SdDrawDocument const* pDoc = xDocShRef->GetDoc();
     381           1 :     CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr);
     382           1 :     SdrPage const* pPage = pDoc->GetPage(1);
     383           1 :     CPPUNIT_ASSERT_MESSAGE("no page", pPage != nullptr);
     384           1 :     SdrObject const* pShape = pPage->GetObj(1);
     385           1 :     CPPUNIT_ASSERT_MESSAGE("no shape", pShape != nullptr);
     386           1 : }
     387             : 
     388           1 : void SdExportTest::testFdo71961()
     389             : {
     390           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP);
     391             : 
     392           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     393             : 
     394           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     395           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     396           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     397           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     398             : 
     399             :     // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
     400             :     // (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
     401           1 :     SdrObjCustomShape *pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 1 ));
     402           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     403           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Text to be always wrapped" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
     404           1 :     CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
     405             : 
     406           1 :     pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 2 ));
     407           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     408           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape non-wrapped text" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
     409           1 :     CPPUNIT_ASSERT_EQUAL( false, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
     410             : 
     411           1 :     pTxtObj = dynamic_cast<SdrObjCustomShape *>( pPage->GetObj( 3 ));
     412           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     413           1 :     CPPUNIT_ASSERT_EQUAL( OUString( "Custom shape wrapped text" ), pTxtObj->GetOutlinerParaObject()->GetTextObject().GetText(0));
     414           1 :     CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrOnOffItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
     415             : 
     416           1 :     xDocShRef->DoClose();
     417           1 : }
     418             : 
     419           1 : void SdExportTest::testN828390()
     420             : {
     421           1 :     bool bPassed = false;
     422           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX );
     423             : 
     424           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     425             : 
     426           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     427           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     428           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     429           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     430             :     {
     431           1 :         std::vector<EECharAttrib> rLst;
     432             :         // Get the object
     433           1 :         SdrObject *pObj = pPage->GetObj(0);
     434           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     435           1 :         CPPUNIT_ASSERT( pTxtObj );
     436           1 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     437           1 :         aEdit.GetCharAttribs(0, rLst);
     438           7 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     439             :         {
     440           7 :             const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
     441           7 :             if(pFontEscapement)
     442             :             {
     443           2 :                 if( pFontEscapement->GetEsc() == -25 )
     444             :                 {
     445           1 :                     bPassed = true;
     446           1 :                     break;
     447             :                 }
     448             :             }
     449           1 :         }
     450             :     }
     451           1 :     CPPUNIT_ASSERT_MESSAGE("Subscript not exported properly", bPassed);
     452             : 
     453           1 :     xDocShRef->DoClose();
     454           1 : }
     455             : 
     456           1 : void SdExportTest::testBnc880763()
     457             : {
     458           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX);
     459           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     460             : 
     461           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     462           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     463           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     464           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     465             : 
     466             :     // Check z-order of the two shapes, use background color to identify them
     467             :     // First object in the background has blue background color
     468           1 :     const SdrObject *pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 0 ) );
     469           1 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     470           1 :     CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x0000ff),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
     471             : 
     472             :     // Second object at the front has green background color
     473           1 :     pObj = dynamic_cast<SdrObject *>( pPage->GetObj( 1 ) );
     474           1 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     475           1 :     CPPUNIT_ASSERT_EQUAL( sal_uInt32(0x00ff00),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue().GetColor());
     476             : 
     477           1 :     xDocShRef->DoClose();
     478           1 : }
     479             : 
     480           1 : void SdExportTest::testBnc862510_5()
     481             : {
     482           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX);
     483           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     484             : 
     485           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     486           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     487           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     488           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     489             : 
     490             :     // Same as testBnc870237, but here we check the horizontal spacing
     491           1 :     const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj( 1 ) );
     492           1 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     493           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue());
     494           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue());
     495           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(7510), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST))).GetValue());
     496           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST))).GetValue());
     497             : 
     498           1 :     xDocShRef->DoClose();
     499           1 : }
     500             : 
     501             : // In numbering a bullet could be defined as empty (no character).
     502             : // When exporting to OOXML make sure that the bullet is ignored and
     503             : // not written into the file.
     504           1 : void SdExportTest::testBnc822347_EmptyBullet()
     505             : {
     506           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP);
     507           1 :     xDocShRef = saveAndReload(xDocShRef, PPTX);
     508             : 
     509           1 :     SdDrawDocument* pDoc = xDocShRef->GetDoc();
     510           1 :     SdrOutliner* pOutliner = pDoc->GetInternalOutliner();
     511           1 :     const SdrPage* pPage = pDoc->GetPage(1);
     512           1 :     SdrObject* pObject = pPage->GetObj(0);
     513           1 :     SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pObject);
     514           1 :     CPPUNIT_ASSERT(pTextObject);
     515             : 
     516           1 :     OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
     517           1 :     const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
     518             : 
     519           2 :     OUString sText = aEdit.GetText(0);
     520           1 :     CPPUNIT_ASSERT_EQUAL(OUString("M3 Feature Test"), sText);
     521             : 
     522           1 :     pOutliner->SetText(*pOutlinerParagraphObject);
     523           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner->GetParagraphCount());
     524             : 
     525           1 :     const sal_Int16 nDepth = pOutliner->GetDepth(0);
     526             : 
     527           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), nDepth); // depth >= 0 means that the paragraph has bullets enabled
     528             : 
     529           2 :     xDocShRef->DoClose();
     530           1 : }
     531             : 
     532             : //Bullets not having  any text following them are not getting exported to pptx correctly.
     533           1 : void SdExportTest::testFdo90607()
     534             : {
     535           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX);
     536           1 :     xDocShRef = saveAndReload(xDocShRef, PPTX);
     537             : 
     538             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     539           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     540             : 
     541             :     uno::Reference< drawing::XDrawPage > xPage(
     542           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     543           1 :      SdDrawDocument *pDoc = xDocShRef->GetDoc();
     544           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     545             : 
     546           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     547           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     548           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(1) );
     549           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     550           1 :     OutlinerParaObject* pOutlinerParagraphObject = pTxtObj->GetOutlinerParaObject();
     551           1 :     const sal_Int16 nDepth = pOutlinerParagraphObject->GetDepth(0);
     552           1 :     CPPUNIT_ASSERT_MESSAGE("not equal", nDepth != -1);
     553           2 :     xDocShRef->DoClose();
     554           1 : }
     555             : 
     556           1 : void SdExportTest::testFdo83751()
     557             : {
     558           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX);
     559           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     560             : 
     561           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     562           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     563             : 
     564           2 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY );
     565           2 :     uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY );
     566           2 :     uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY );
     567           2 :     OUString propValue;
     568           1 :     xUDProps->getPropertyValue(OUString("Testing")) >>= propValue;
     569           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Document"), propValue);
     570           2 :     xDocShRef->DoClose();
     571           1 : }
     572             : 
     573           1 : void SdExportTest::testFdo79731()
     574             : {
     575           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP);
     576           1 :     xDocShRef = saveAndReload(xDocShRef, PPTX);
     577           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     578           1 :     CPPUNIT_ASSERT(pDoc);
     579           1 :     xDocShRef->DoClose();
     580           1 : }
     581             : 
     582           1 : void SdExportTest::testSwappedOutImageExport()
     583             : {
     584             :     // Problem was with the swapped out images, which were not swapped in during export.
     585             :     const sal_Int32 vFormats[] = {
     586             :         ODP,
     587             :         PPT,
     588             :         PPTX,
     589           1 :     };
     590             : 
     591             :     // Set cache size to a very small value to make sure one of the images is swapped out
     592           1 :     std::shared_ptr< comphelper::ConfigurationChanges > xBatch(comphelper::ConfigurationChanges::create());
     593           1 :     officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), xBatch);
     594           1 :     xBatch->commit();
     595             : 
     596           4 :     for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat )
     597             :     {
     598             :         // Load the original file with one image
     599           3 :         ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_two_images.odp"), ODP);
     600           6 :         const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
     601             : 
     602             :         // Export the document and import again for a check
     603           6 :         uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
     604           6 :         uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
     605           6 :         utl::MediaDescriptor aMediaDescriptor;
     606           3 :         aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
     607             : 
     608           6 :         utl::TempFile aTempFile;
     609           3 :         aTempFile.EnableKillingFile();
     610           3 :         xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
     611           3 :         xComponent.set(xStorable, uno::UNO_QUERY);
     612           3 :         xComponent->dispose();
     613           3 :         xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
     614             : 
     615             :         // Check whether graphic exported well after it was swapped out
     616           6 :         uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY);
     617           3 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), xDrawPagesSupplier->getDrawPages()->getCount() == 2 );
     618           6 :         uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     619             : 
     620           6 :         uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(2), uno::UNO_QUERY);
     621           6 :         uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
     622             :         // Check URL
     623             :         {
     624           3 :             OUString sURL;
     625           3 :             XPropSet->getPropertyValue("GraphicURL") >>= sURL;
     626           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
     627             :         }
     628             :         // Check size
     629             :         {
     630           3 :             uno::Reference<graphic::XGraphic> xGraphic;
     631           3 :             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
     632           6 :             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
     633           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
     634           3 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
     635           6 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
     636             :         }
     637             : 
     638             :         // Second Image
     639           3 :         xDrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
     640           3 :         xImage.set(xDrawPage->getByIndex(1), uno::UNO_QUERY);
     641           3 :         XPropSet.set( xImage, uno::UNO_QUERY_THROW );
     642             :         // Check URL
     643             :         {
     644           3 :             OUString sURL;
     645           3 :             XPropSet->getPropertyValue("GraphicURL") >>= sURL;
     646           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
     647             :         }
     648             :         // Check size
     649             :         {
     650           3 :             uno::Reference<graphic::XGraphic> xGraphic;
     651           3 :             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
     652           6 :             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
     653           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
     654           3 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
     655           6 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(600), xBitmap->getSize().Height );
     656             :         }
     657           3 :         xDocShRef->DoClose();
     658           4 :     }
     659           1 : }
     660             : 
     661           1 : void SdExportTest::testLinkedGraphicRT()
     662             : {
     663             :     // Problem was with linked images
     664             :     const sal_Int32 vFormats[] = {
     665             :         ODP,
     666             :         PPT,
     667             : //      PPTX, -> this fails now, need a fix
     668           1 :     };
     669             : 
     670           3 :     for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat )
     671             :     {
     672             :         // Load the original file with one image
     673           2 :         ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP);
     674           4 :         const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
     675             : 
     676             :         // Export the document and import again for a check
     677           4 :         uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
     678           4 :         uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
     679           4 :         utl::MediaDescriptor aMediaDescriptor;
     680           2 :         aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
     681             : 
     682           4 :         utl::TempFile aTempFile;
     683           2 :         aTempFile.EnableKillingFile();
     684           2 :         xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
     685           2 :         xComponent.set(xStorable, uno::UNO_QUERY);
     686           2 :         xComponent->dispose();
     687           2 :         xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
     688             : 
     689             :         // Check whether graphic imported well after export
     690           2 :         SdDrawDocument *pDoc = xDocShRef->GetDoc();
     691           2 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != NULL );
     692           2 :         const SdrPage *pPage = pDoc->GetPage(1);
     693           2 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pPage != NULL );
     694           2 :         SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(2));
     695           2 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject != NULL );
     696           2 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pObject->IsLinkedGraphic() );
     697             : 
     698           2 :         const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true);
     699           2 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), !rGraphicObj.IsSwappedOut());
     700           2 :         CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), GRAPHIC_BITMAP, rGraphicObj.GetGraphic().GetType());
     701           2 :         CPPUNIT_ASSERT_EQUAL_MESSAGE( sFailedMessage.getStr(), sal_uLong(864900), rGraphicObj.GetSizeBytes());
     702             : 
     703           2 :         xDocShRef->DoClose();
     704           2 :     }
     705           1 : }
     706             : 
     707           1 : void SdExportTest::testImageWithSpecialID()
     708             : {
     709             :     // Check how LO handles when the imported graphic's ID is different from that one
     710             :     // which is generated by LO.
     711             :     const sal_Int32 vFormats[] = {
     712             :         ODP,
     713             :         PPT,
     714             :         PPTX,
     715           1 :     };
     716             : 
     717             :     // Trigger swap out mechanism to test swapped state factor too.
     718           1 :     std::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
     719           1 :     officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch);
     720           1 :     batch->commit();
     721             : 
     722           4 :     for( size_t nExportFormat = 0; nExportFormat < SAL_N_ELEMENTS(vFormats); ++nExportFormat )
     723             :     {
     724             :         // Load the original file
     725           3 :         ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/images_with_special_IDs.odp"), ODP);
     726           6 :         const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
     727             : 
     728             :         // Export the document and import again for a check
     729           6 :         uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
     730           6 :         uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
     731           6 :         utl::MediaDescriptor aMediaDescriptor;
     732           3 :         aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8);
     733             : 
     734           6 :         utl::TempFile aTempFile;
     735           3 :         aTempFile.EnableKillingFile();
     736           3 :         xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
     737           3 :         xComponent.set(xStorable, uno::UNO_QUERY);
     738           3 :         xComponent->dispose();
     739           3 :         xDocShRef = loadURL(aTempFile.GetURL(), nExportFormat);
     740             : 
     741             :         // Check whether graphic was exported well
     742           6 :         uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY);
     743           3 :         CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), xDrawPagesSupplier->getDrawPages()->getCount() == 2 );
     744           6 :         uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     745             : 
     746           6 :         uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(2), uno::UNO_QUERY);
     747           6 :         uno::Reference< beans::XPropertySet > XPropSet( xImage, uno::UNO_QUERY_THROW );
     748             :         // Check URL
     749             :         {
     750           3 :             OUString sURL;
     751           3 :             XPropSet->getPropertyValue("GraphicURL") >>= sURL;
     752           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
     753             :         }
     754             :         // Check size
     755             :         {
     756           3 :             uno::Reference<graphic::XGraphic> xGraphic;
     757           3 :             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
     758           6 :             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
     759           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
     760           3 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(610), xBitmap->getSize().Width );
     761           6 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(381), xBitmap->getSize().Height );
     762             :         }
     763             : 
     764             :         // Second Image
     765           3 :         xDrawPage.set(xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
     766           3 :         xImage.set(xDrawPage->getByIndex(1), uno::UNO_QUERY);
     767           3 :         XPropSet.set( xImage, uno::UNO_QUERY_THROW );
     768             :         // Check URL
     769             :         {
     770           3 :             OUString sURL;
     771           3 :             XPropSet->getPropertyValue("GraphicURL") >>= sURL;
     772           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), sURL != "vnd.sun.star.GraphicObject:00000000000000000000000000000000");
     773             :         }
     774             :         // Check size
     775             :         {
     776           3 :             uno::Reference<graphic::XGraphic> xGraphic;
     777           3 :             XPropSet->getPropertyValue("Graphic") >>= xGraphic;
     778           6 :             uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
     779           3 :             CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
     780           3 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(900), xBitmap->getSize().Width );
     781           6 :             CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(600), xBitmap->getSize().Height );
     782             :         }
     783           3 :         xDocShRef->DoClose();
     784           4 :     }
     785           1 : }
     786           1 : void SdExportTest::testTableCellFillProperties()
     787             : {
     788           1 :     std::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
     789           1 :     officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch);
     790           1 :     batch->commit();
     791             : 
     792             :     // Load the original file
     793           2 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP);
     794             : 
     795             :     // Export the document and import again for a check
     796           2 :     uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
     797           2 :     uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
     798           2 :     utl::MediaDescriptor aMediaDescriptor;
     799           1 :     aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8);
     800             : 
     801           2 :     utl::TempFile aTempFile;
     802           1 :     aTempFile.EnableKillingFile();
     803           1 :     xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
     804           1 :     xComponent.set(xStorable, uno::UNO_QUERY);
     805           1 :     xComponent->dispose();
     806           1 :     xDocShRef = loadURL(aTempFile.GetURL(), PPTX);
     807             : 
     808           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     809           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     810           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     811           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     812             : 
     813           1 :     sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
     814           1 :     CPPUNIT_ASSERT( pTableObj );
     815           2 :     uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
     816           2 :     uno::Reference< beans::XPropertySet > xCell;
     817             : 
     818             :     // Test Solid fill color
     819             :     sal_Int32 nColor;
     820           1 :     xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
     821           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     822           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6750207), nColor);
     823             : 
     824             :     // Test Picture fill type for cell
     825           1 :     drawing::FillStyle aFillStyle( drawing::FillStyle_NONE );
     826           1 :     xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
     827           1 :     xCell->getPropertyValue("FillStyle") >>= aFillStyle;
     828           1 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, aFillStyle);
     829             : 
     830             :     // Test Gradient fill type for cell
     831           1 :     xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW);
     832           1 :     xCell->getPropertyValue("FillStyle") >>= aFillStyle;
     833           1 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, aFillStyle);
     834             : 
     835           2 :     xDocShRef->DoClose();
     836           1 : }
     837             : 
     838           1 : void SdExportTest::testBulletStartNumber()
     839             : {
     840           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX );
     841           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     842             : 
     843             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     844           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     845             : 
     846             :     uno::Reference< drawing::XDrawPage > xPage(
     847           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     848           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     849           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     850             : 
     851           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     852           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     853           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
     854           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     855           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     856           1 :     const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET));
     857           1 :     CPPUNIT_ASSERT(pNumFmt);
     858           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's start number is wrong!", sal_Int16(pNumFmt->GetNumRule()->GetLevel(0).GetStart()), sal_Int16(3) );
     859           2 :     xDocShRef->DoClose();
     860           1 : }
     861             : 
     862           1 : void SdExportTest::testLineStyle()
     863             : {
     864           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX);
     865           1 :      xDocShRef = saveAndReload( xDocShRef, PPTX );
     866             : 
     867           1 :     SdDrawDocument const* pDoc = xDocShRef->GetDoc();
     868           1 :     CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr);
     869           1 :     SdrPage const* pPage = pDoc->GetPage(1);
     870           1 :     CPPUNIT_ASSERT_MESSAGE("no page", pPage != nullptr);
     871           1 :     SdrObject const* pShape = pPage->GetObj(0);
     872           1 :     CPPUNIT_ASSERT_MESSAGE("no shape", pShape != nullptr);
     873             : 
     874             :     const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
     875           1 :                 pShape->GetMergedItem(XATTR_LINESTYLE));
     876           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong style",drawing::LineStyle_SOLID, rStyleItem.GetValue());
     877             : 
     878           1 :     xDocShRef->DoClose();
     879           1 : }
     880             : 
     881           1 : void SdExportTest::testRightToLeftParaghraph()
     882             : {
     883           1 :         ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX);
     884             : 
     885           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     886             : 
     887             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     888           2 :     xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     889             : 
     890             :     uno::Reference< drawing::XDrawPage > xPage(
     891           2 :     xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     892             : 
     893             :     uno::Reference< beans::XPropertySet > xShape(
     894           2 :     xPage->getByIndex(0), uno::UNO_QUERY );
     895           1 :     CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
     896             : 
     897             :     // Get first paragraph
     898           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
     899           1 :     CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
     900           2 :     uno::Reference<container::XEnumerationAccess> paraEnumAccess;
     901           1 :     paraEnumAccess.set(xText, uno::UNO_QUERY);
     902           2 :     uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
     903           1 :     uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
     904           2 :                 uno::UNO_QUERY_THROW);
     905           2 :     uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
     906             : 
     907           1 :     sal_Int16 nWritingMode = 0;
     908           1 :     xPropSet->getPropertyValue( "WritingMode" ) >>= nWritingMode;
     909           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB, nWritingMode);
     910             : 
     911           2 :     xDocShRef->DoClose();
     912           1 : }
     913             : 
     914           1 : void SdExportTest::testBulletColor()
     915             : {
     916           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX );
     917             : 
     918           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     919             : 
     920             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     921           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     922             : 
     923             :     uno::Reference< drawing::XDrawPage > xPage(
     924           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     925           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     926           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     927             : 
     928           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     929           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     930             : 
     931           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
     932           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     933             : 
     934           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     935           1 :     const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET));
     936           1 :     CPPUNIT_ASSERT(pNumFmt);
     937           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt->GetNumRule()->GetLevel(0).GetBulletColor().GetColor());
     938           1 : }
     939             : 
     940             : #if !defined WNT
     941             : 
     942           1 : void SdExportTest::testBnc822341()
     943             : {
     944             :     // Check import / export of embedded text document
     945           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP);
     946           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     947             : 
     948             :     // Export an LO specific ole object (imported from an ODP document)
     949             :     {
     950           1 :         SdDrawDocument *pDoc = xDocShRef->GetDoc();
     951           1 :         CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     952           1 :         const SdrPage *pPage = pDoc->GetPage(1);
     953           1 :         CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     954             : 
     955           1 :         const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
     956           1 :         CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     957           1 :         CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
     958             :     }
     959             : 
     960           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     961             : 
     962             :     // Export an MS specific ole object (imported from a PPTX document)
     963             :     {
     964           1 :         SdDrawDocument *pDoc = xDocShRef->GetDoc();
     965           1 :         CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     966           1 :         const SdrPage *pPage = pDoc->GetPage(1);
     967           1 :         CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     968             : 
     969           1 :         const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
     970           1 :         CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     971           1 :         CPPUNIT_ASSERT_EQUAL( static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier() );
     972             :     }
     973             : 
     974           1 :     xDocShRef->DoClose();
     975           1 : }
     976             : 
     977             : #endif
     978             : 
     979           1 : void SdExportTest::testBulletMarginAndIndentation()
     980             : {
     981           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX );
     982             : 
     983           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
     984             : 
     985             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     986           2 :     xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     987             :     uno::Reference< drawing::XDrawPage > xPage(
     988           2 :     xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     989           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     990           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     991             : 
     992           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     993           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     994             : 
     995           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
     996           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     997             : 
     998           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     999           1 :     const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET));
    1000           1 :     CPPUNIT_ASSERT(pNumFmt);
    1001             : 
    1002           1 :     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
    1003           2 :     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's indentation is wrong!", sal_Int32(-998),sal_Int32(pNumFmt->GetNumRule()->GetLevel(0). GetFirstLineOffset()));
    1004           1 : }
    1005             : 
    1006           1 : void SdExportTest::testParaMarginAndindentation()
    1007             : {
    1008           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX);
    1009             : 
    1010           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
    1011             : 
    1012             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
    1013           2 :     xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1014             : 
    1015             :     uno::Reference< drawing::XDrawPage > xPage(
    1016           2 :     xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1017             : 
    1018             :     uno::Reference< beans::XPropertySet > xShape(
    1019           2 :     xPage->getByIndex(0), uno::UNO_QUERY );
    1020           1 :     CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
    1021             : 
    1022             :     // Get first paragraph
    1023           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1024           1 :     CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
    1025           2 :     uno::Reference<container::XEnumerationAccess> paraEnumAccess;
    1026           1 :     paraEnumAccess.set(xText, uno::UNO_QUERY);
    1027           2 :     uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
    1028           1 :     uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
    1029           2 :                 uno::UNO_QUERY_THROW);
    1030           2 :     uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
    1031             : 
    1032           1 :     sal_Int32 nParaLeftMargin = 0;
    1033           1 :     xPropSet->getPropertyValue( "ParaLeftMargin" ) >>= nParaLeftMargin;
    1034           1 :     CPPUNIT_ASSERT_EQUAL(sal_uInt32(1000), sal_uInt32(nParaLeftMargin));
    1035             : 
    1036           1 :     sal_Int32 nParaFirstLineIndent = 0;
    1037           1 :     xPropSet->getPropertyValue( "ParaFirstLineIndent" ) >>= nParaFirstLineIndent;
    1038           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(-1268), sal_Int32(nParaFirstLineIndent));
    1039             : 
    1040           2 :     xDocShRef->DoClose();
    1041           1 : }
    1042             : 
    1043           1 : void SdExportTest::testCellLeftAndRightMargin()
    1044             : {
    1045           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX);
    1046           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
    1047             :     sal_Int32 nLeftMargin, nRightMargin;
    1048             : 
    1049             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
    1050           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1051             : 
    1052           2 :     uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1053           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1054           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1055             : 
    1056           1 :     const SdrPage *pPage = pDoc->GetPage(1);
    1057           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
    1058             : 
    1059           1 :     sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
    1060           1 :     CPPUNIT_ASSERT( pTableObj );
    1061             : 
    1062           2 :     uno::Reference< com::sun::star::table::XTable > xTable (pTableObj->getTable(), uno::UNO_QUERY_THROW);
    1063           2 :     uno::Reference< com::sun::star::table::XMergeableCell > xCell( xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
    1064           2 :     uno::Reference< beans::XPropertySet > xCellPropSet(xCell, uno::UNO_QUERY_THROW);
    1065             : 
    1066           2 :     uno::Any aLeftMargin = xCellPropSet->getPropertyValue("TextLeftDistance");
    1067           1 :     aLeftMargin >>= nLeftMargin ;
    1068             : 
    1069           2 :     uno::Any aRightMargin = xCellPropSet->getPropertyValue("TextRightDistance");
    1070           1 :     aRightMargin >>= nRightMargin ;
    1071             : 
    1072             :     // Convert values to EMU
    1073           1 :     nLeftMargin  =  oox::drawingml::convertHmmToEmu( nLeftMargin );
    1074           1 :     nRightMargin =  oox::drawingml::convertHmmToEmu( nRightMargin );
    1075             : 
    1076           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nLeftMargin);
    1077           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(45720), nRightMargin);
    1078             : 
    1079           2 :     xDocShRef->DoClose();
    1080           1 : }
    1081             : 
    1082           1 : void SdExportTest::testTableCellBorder()
    1083             : {
    1084           1 :     ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX);
    1085           1 :     xDocShRef = saveAndReload( xDocShRef, PPTX );
    1086             : 
    1087           2 :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1088             : 
    1089           2 :     uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1090           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1091           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1092             : 
    1093           1 :     const SdrPage *pPage = pDoc->GetPage(1);
    1094           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
    1095             : 
    1096           1 :     sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
    1097           1 :     CPPUNIT_ASSERT( pTableObj );
    1098             : 
    1099           1 :     table::BorderLine2 aBorderLine;
    1100             : 
    1101           2 :     uno::Reference< table::XTable > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
    1102           2 :     uno::Reference< com::sun::star::table::XMergeableCell > xCell(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
    1103           2 :     uno::Reference< beans::XPropertySet > xCellPropSet (xCell, uno::UNO_QUERY_THROW);
    1104             : 
    1105           1 :     xCellPropSet->getPropertyValue("LeftBorder") >>= aBorderLine;
    1106           1 :     sal_Int32 nLeftBorder = aBorderLine.LineWidth ;
    1107             : // While importing the table cell border line width, it converts EMU->Hmm then divided result by 2.
    1108             : // To get original value of LineWidth need to multiple by 2.
    1109           1 :     nLeftBorder = nLeftBorder * 2 ;
    1110           1 :     nLeftBorder = oox::drawingml::convertHmmToEmu( nLeftBorder );
    1111           1 :     CPPUNIT_ASSERT(nLeftBorder);
    1112           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
    1113             : 
    1114           1 :     xCellPropSet->getPropertyValue("RightBorder") >>= aBorderLine;
    1115           1 :     sal_Int32 nRightBorder = aBorderLine.LineWidth ;
    1116           1 :     nRightBorder = nRightBorder * 2 ;
    1117           1 :     nRightBorder = oox::drawingml::convertHmmToEmu( nRightBorder );
    1118           1 :     CPPUNIT_ASSERT(nRightBorder);
    1119           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(16777215), aBorderLine.Color);
    1120             : 
    1121           1 :     xCellPropSet->getPropertyValue("TopBorder") >>= aBorderLine;
    1122           1 :     sal_Int32 nTopBorder = aBorderLine.LineWidth ;
    1123           1 :     nTopBorder = nTopBorder * 2 ;
    1124           1 :     nTopBorder = oox::drawingml::convertHmmToEmu( nTopBorder );
    1125           1 :     CPPUNIT_ASSERT(nTopBorder);
    1126           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
    1127             : 
    1128             : 
    1129           1 :     xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine;
    1130           1 :     sal_Int32 nBottomBorder = aBorderLine.LineWidth ;
    1131           1 :     nBottomBorder = nBottomBorder * 2 ;
    1132           1 :     nBottomBorder = oox::drawingml::convertHmmToEmu( nBottomBorder );
    1133           1 :     CPPUNIT_ASSERT(nBottomBorder);
    1134           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
    1135             : 
    1136           2 :     xDocShRef->DoClose();
    1137           1 : }
    1138             : 
    1139           1 : CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
    1140             : 
    1141           4 : CPPUNIT_PLUGIN_IMPLEMENT();
    1142             : 
    1143             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11