LCOV - code coverage report
Current view: top level - sd/qa/unit - import-tests.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 668 673 99.3 %
Date: 2015-06-13 12:38:46 Functions: 46 48 95.8 %
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             : 
      10             : #include <config_poppler.h>
      11             : 
      12             : #include "sdmodeltestbase.hxx"
      13             : 
      14             : #include <svl/stritem.hxx>
      15             : #include <editeng/editobj.hxx>
      16             : #include <editeng/outlobj.hxx>
      17             : #include <editeng/ulspitem.hxx>
      18             : #include <editeng/fhgtitem.hxx>
      19             : #include <editeng/escapementitem.hxx>
      20             : #include <editeng/colritem.hxx>
      21             : #include <editeng/fontitem.hxx>
      22             : #include <editeng/wghtitem.hxx>
      23             : #include <editeng/numitem.hxx>
      24             : #include <editeng/lrspitem.hxx>
      25             : #include <editeng/postitem.hxx>
      26             : #include <rsc/rscsfx.hxx>
      27             : 
      28             : #include <sfx2/sfxsids.hrc>
      29             : #include <svl/stritem.hxx>
      30             : #include <svx/svdotext.hxx>
      31             : #include <svx/svdoashp.hxx>
      32             : #include <svx/svdograf.hxx>
      33             : #include <svx/svdogrp.hxx>
      34             : #include <svx/svdomedia.hxx>
      35             : #include <svx/svdoole2.hxx>
      36             : #include <svx/svdotable.hxx>
      37             : #include <svx/xflclit.hxx>
      38             : #include <svx/xlineit0.hxx>
      39             : #include <svx/xlnclit.hxx>
      40             : #include <svx/xlnwtit.hxx>
      41             : #include <animations/animationnodehelper.hxx>
      42             : #include <sax/tools/converter.hxx>
      43             : 
      44             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      45             : #include <com/sun/star/drawing/XDrawPage.hpp>
      46             : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
      47             : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
      48             : #include <com/sun/star/animations/XAnimationNode.hpp>
      49             : #include <com/sun/star/animations/XAnimate.hpp>
      50             : #include <com/sun/star/beans/XPropertySet.hpp>
      51             : #include <com/sun/star/chart/XChartDocument.hpp>
      52             : #include <com/sun/star/chart2/XChartDocument.hpp>
      53             : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
      54             : #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
      55             : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
      56             : #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
      57             : #include <com/sun/star/chart2/data/XDataSequence.hpp>
      58             : #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
      59             : #include <com/sun/star/table/BorderLine2.hpp>
      60             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      61             : #include <com/sun/star/table/XTableRows.hpp>
      62             : 
      63             : #include <stlpool.hxx>
      64             : 
      65             : using namespace ::com::sun::star;
      66             : 
      67             : /// Impress import filters tests.
      68         102 : class SdImportTest : public SdModelTestBase
      69             : {
      70             : public:
      71             :     void testDocumentLayout();
      72             :     void testSmoketest();
      73             :     void testN759180();
      74             :     void testN778859();
      75             :     void testMasterPageStyleParent();
      76             :     void testFdo64512();
      77             :     void testFdo71075();
      78             :     void testN828390_2();
      79             :     void testN828390_3();
      80             :     void testFdo68594();
      81             :     void testFdo72998();
      82             :     void testFdo77027();
      83             :     void testStrictOOXML();
      84             :     void testN862510_1();
      85             :     void testN862510_2();
      86             :     void testN862510_4();
      87             :     void testBnc870237();
      88             :     void testBnc887225();
      89             :     void testBnc480256();
      90             :     void testBnc591147();
      91             :     void testCreationDate();
      92             :     void testBnc584721_1();
      93             :     void testBnc584721_2();
      94             :     void testBnc584721_3();
      95             :     void testBnc584721_4();
      96             :     void testBnc904423();
      97             :     void testShapeLineStyle();
      98             :     void testBnc862510_6();
      99             :     void testBnc862510_7();
     100             : #if ENABLE_PDFIMPORT
     101             :     void testPDFImport();
     102             :     void testPDFImportSkipImages();
     103             : #endif
     104             :     void testBulletSuffix();
     105             :     void testBnc910045();
     106             :     void testRowHeight();
     107             : 
     108           2 :     CPPUNIT_TEST_SUITE(SdImportTest);
     109             : 
     110           1 :     CPPUNIT_TEST(testDocumentLayout);
     111           1 :     CPPUNIT_TEST(testSmoketest);
     112           1 :     CPPUNIT_TEST(testN759180);
     113           1 :     CPPUNIT_TEST(testN778859);
     114           1 :     CPPUNIT_TEST(testMasterPageStyleParent);
     115           1 :     CPPUNIT_TEST(testFdo64512);
     116           1 :     CPPUNIT_TEST(testFdo71075);
     117           1 :     CPPUNIT_TEST(testN828390_2);
     118           1 :     CPPUNIT_TEST(testN828390_3);
     119           1 :     CPPUNIT_TEST(testFdo68594);
     120           1 :     CPPUNIT_TEST(testFdo72998);
     121           1 :     CPPUNIT_TEST(testFdo77027);
     122           1 :     CPPUNIT_TEST(testStrictOOXML);
     123           1 :     CPPUNIT_TEST(testN862510_1);
     124           1 :     CPPUNIT_TEST(testN862510_2);
     125           1 :     CPPUNIT_TEST(testN862510_4);
     126           1 :     CPPUNIT_TEST(testBnc870237);
     127           1 :     CPPUNIT_TEST(testBnc887225);
     128           1 :     CPPUNIT_TEST(testBnc480256);
     129           1 :     CPPUNIT_TEST(testBnc591147);
     130           1 :     CPPUNIT_TEST(testCreationDate);
     131           1 :     CPPUNIT_TEST(testBnc584721_1);
     132           1 :     CPPUNIT_TEST(testBnc584721_2);
     133           1 :     CPPUNIT_TEST(testBnc584721_3);
     134           1 :     CPPUNIT_TEST(testBnc584721_4);
     135           1 :     CPPUNIT_TEST(testBnc904423);
     136           1 :     CPPUNIT_TEST(testShapeLineStyle);
     137           1 :     CPPUNIT_TEST(testBnc862510_6);
     138           1 :     CPPUNIT_TEST(testBnc862510_7);
     139             : #if ENABLE_PDFIMPORT
     140           1 :     CPPUNIT_TEST(testPDFImport);
     141           1 :     CPPUNIT_TEST(testPDFImportSkipImages);
     142             : #endif
     143           1 :     CPPUNIT_TEST(testBulletSuffix);
     144           1 :     CPPUNIT_TEST(testBnc910045);
     145           1 :     CPPUNIT_TEST(testRowHeight);
     146             : 
     147           5 :     CPPUNIT_TEST_SUITE_END();
     148             : };
     149             : 
     150             : /** Test document against a reference XML dump of shapes.
     151             : 
     152             : If you want to update one of these tests, or add a new one, set the nUpdateMe
     153             : to the index of the test, and the dump XML's will be created (or rewritten)
     154             : instead of checking. Use with care - when the test is failing, first find out
     155             : why, instead of just updating .xml's blindly.
     156             : 
     157             : Example: Let's say you are adding a test called fdoABCD.pptx.  You'll place it
     158             : to the data/ subdirectory, and will add an entry to aFilesToCompare below,
     159             : the 3rd parameter is for export test - can be -1 (don't export), ODP, PPT or PPTX
     160             : like:
     161             : 
     162             :         { "fdoABCD.pptx", "xml/fdoABCD_", PPTX },
     163             : 
     164             : and will count the index in the aFilesToCompare structure (1st is 0, 2nd is 1,
     165             : etc.)  Temporarily you'll set nUpdateMe to this index (instead of -1), and run
     166             : 
     167             : make sd
     168             : 
     169             : This will generate the sd/qa/unit/data/xml/fdoABCD_*.xml for you.  Now you
     170             : will change nUpdateMe back to -1, and commit your fdoABCD.pptx test, the
     171             : xml/fdoABCD_*.xml dumps, and the aFilesToCompare addition in one commit.
     172             : 
     173             : As the last step, you will revert your fix and do 'make sd' again, to check
     174             : that without your fix, the unit test breaks.  Then clean up, and push :-)
     175             : 
     176             : NOTE: This approach is suitable only for tests of fixes that actually change
     177             : the layout - best to check by reverting your fix locally after having added
     178             : the test, and re-running; it should break.
     179             : */
     180           1 : void SdImportTest::testDocumentLayout()
     181             : {
     182             :     struct { const char *pInput, *pDump; sal_Int32 nFormat; sal_Int32 nExportType; } aFilesToCompare[] =
     183             :     {
     184             :         { "odp/shapes-test.odp", "xml/shapes-test_page", ODP, -1 },
     185             :         { "fdo47434.pptx", "xml/fdo47434_", PPTX, -1 },
     186             :         { "n758621.ppt", "xml/n758621_", PPT, -1 },
     187             :         { "fdo64586.ppt", "xml/fdo64586_", PPT, -1 },
     188             :         { "n819614.pptx", "xml/n819614_", PPTX, -1 },
     189             :         { "n820786.pptx", "xml/n820786_", PPTX, -1 },
     190             :         { "n762695.pptx", "xml/n762695_", PPTX, -1 },
     191             :         { "n593612.pptx", "xml/n593612_", PPTX, -1 },
     192             :         { "fdo71434.pptx", "xml/fdo71434_", PPTX, -1 },
     193             :         { "n902652.pptx", "xml/n902652_", PPTX, -1 },
     194             :         { "tdf90403.pptx", "xml/tdf90403_", PPTX, -1 },
     195             :         { "tdf90338.odp", "xml/tdf90338_", ODP, PPTX },
     196             :         // { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX, PPTX }, // Example
     197           1 :     };
     198             : 
     199          13 :     for ( int i = 0; i < static_cast< int >( SAL_N_ELEMENTS( aFilesToCompare ) ); ++i )
     200             :     {
     201          12 :         int nUpdateMe = -1; // index of test we want to update; supposedly only when the test is created
     202             : 
     203          12 :         sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ), aFilesToCompare[i].nFormat );
     204          12 :         if( aFilesToCompare[i].nExportType >= 0 )
     205           1 :             xDocShRef = saveAndReload( xDocShRef, aFilesToCompare[i].nExportType );
     206             :         compareWithShapesDump( xDocShRef,
     207          24 :                 getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ),
     208          24 :                 i == nUpdateMe );
     209          12 :     }
     210           1 : }
     211             : 
     212           1 : void SdImportTest::testSmoketest()
     213             : {
     214           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/smoketest.pptx"), PPTX);
     215             : 
     216           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     217           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     218             : 
     219             :     // cf. SdrModel svx/svdmodel.hxx ...
     220             : 
     221           1 :     CPPUNIT_ASSERT_MESSAGE( "wrong page count", pDoc->GetPageCount() == 3);
     222             : 
     223           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     224           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     225             : 
     226           1 :     const size_t nObjs = pPage->GetObjCount();
     227           4 :     for (size_t i = 0; i < nObjs; i++)
     228             :     {
     229           3 :         SdrObject *pObj = pPage->GetObj(i);
     230           3 :         SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
     231           3 :         SdrTextObj *pTxt = dynamic_cast<SdrTextObj *>( pObj );
     232             :         (void)pTxt; (void)eKind;
     233             :     }
     234             : 
     235           1 :     CPPUNIT_ASSERT_MESSAGE( "changed", !pDoc->IsChanged() );
     236             : 
     237           1 :     xDocShRef->DoClose();
     238           1 : }
     239             : 
     240           1 : void SdImportTest::testN759180()
     241             : {
     242           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/n759180.pptx"), PPTX);
     243             : 
     244           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     245           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     246           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     247           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     248             : 
     249             :     //sal_uIntPtr nObjs = pPage->GetObjCount();
     250             :     //for (sal_uIntPtr i = 0; i < nObjs; i++)
     251             :     {
     252             :         // Get the object
     253           1 :         SdrObject *pObj = pPage->GetObj(0);
     254           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     255           1 :         CPPUNIT_ASSERT(pTxtObj);
     256           1 :         std::vector<EECharAttrib> rLst;
     257           1 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     258           1 :         const SvxULSpaceItem *pULSpace = dynamic_cast<const SvxULSpaceItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_ULSPACE));
     259           1 :         CPPUNIT_ASSERT(pULSpace);
     260           1 :         CPPUNIT_ASSERT_MESSAGE( "Para bottom spacing is wrong!", pULSpace->GetLower() == 0 );
     261           1 :         aEdit.GetCharAttribs(1, rLst);
     262           2 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     263             :         {
     264           2 :             const SvxFontHeightItem * pFontHeight = dynamic_cast<const SvxFontHeightItem *>((*it).pAttr);
     265           2 :             if(pFontHeight)
     266             :             {
     267             :                 // nStart == 9
     268             :                 // font height = 5 => 5*2540/72
     269           1 :                 CPPUNIT_ASSERT_MESSAGE( "Font height is wrong", pFontHeight->GetHeight() == 176 );
     270           1 :                 break;
     271             :             }
     272           1 :         }
     273             :     }
     274             : 
     275           1 :     xDocShRef->DoClose();
     276           1 : }
     277             : 
     278           1 : void SdImportTest::testN862510_1()
     279             : {
     280           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_1.pptx"), PPTX );
     281             : 
     282           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     283           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     284           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     285           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     286             :     {
     287           1 :         std::vector<EECharAttrib> rLst;
     288           1 :         SdrObject *pObj = pPage->GetObj( 0 );
     289           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     290           1 :         CPPUNIT_ASSERT( pTxtObj );
     291           1 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     292           1 :         aEdit.GetCharAttribs( 0, rLst );
     293          17 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     294             :         {
     295          16 :             const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>( (*it).pAttr );
     296          16 :             CPPUNIT_ASSERT_MESSAGE( "Baseline attribute not handled properly", !( pFontEscapement && pFontEscapement->GetProp() != 100 ) );
     297           1 :         }
     298             :     }
     299             : 
     300           1 :     xDocShRef->DoClose();
     301           1 : }
     302             : 
     303           1 : void SdImportTest::testN862510_2()
     304             : {
     305           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx"), PPTX );
     306             : 
     307           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     308           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     309           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     310           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     311             :     {
     312           1 :         SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 0 ) );
     313           1 :         CPPUNIT_ASSERT( pGrpObj );
     314           1 :         SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) );
     315           1 :         CPPUNIT_ASSERT( pObj );
     316           1 :         CPPUNIT_ASSERT_MESSAGE( "Wrong Text Rotation!", pObj->GetExtraTextRotation( true ) == 90 );
     317             :     }
     318             : 
     319           1 :     xDocShRef->DoClose();
     320           1 : }
     321             : 
     322           1 : void SdImportTest::testN862510_4()
     323             : {
     324           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx"), PPTX );
     325             : 
     326           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     327           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     328           1 :     const SdrPage *pPage = pDoc->GetPage( 1 );
     329           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     330             :     {
     331           1 :         std::vector<EECharAttrib> rLst;
     332           1 :         SdrObject *pObj = pPage->GetObj( 0 );
     333           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     334           1 :         CPPUNIT_ASSERT( pTxtObj );
     335           1 :         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     336           1 :         aEdit.GetCharAttribs( 0, rLst );
     337          17 :         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it != rLst.rend(); ++it )
     338             :         {
     339          16 :             const SvxColorItem *pC = dynamic_cast<const SvxColorItem *>( (*it).pAttr );
     340          16 :             CPPUNIT_ASSERT_MESSAGE( "gradfill for text color not handled!", !( pC && pC->GetValue().GetColor() == 0 ) );
     341           1 :         }
     342             :     }
     343             : 
     344           1 :     xDocShRef->DoClose();
     345           1 : }
     346             : 
     347           1 : void SdImportTest::testN828390_2()
     348             : {
     349           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_2.pptx"), PPTX );
     350             : 
     351           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     352           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     353           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     354           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     355             : 
     356           1 :     SdrObject *pObj = pPage->GetObj(0);
     357           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     358           1 :     CPPUNIT_ASSERT( pTxtObj );
     359           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     360           1 :     CPPUNIT_ASSERT(aEdit.GetText(0) == "Linux  ");
     361           1 :     CPPUNIT_ASSERT(aEdit.GetText(1) == "Standard Platform");
     362             : 
     363           1 :     xDocShRef->DoClose();
     364           1 : }
     365             : 
     366           1 : void SdImportTest::testN828390_3()
     367             : {
     368           1 :     bool bPassed = true;
     369           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n828390_3.pptx"), PPTX );
     370             : 
     371           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     372           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     373           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     374           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     375             : 
     376           1 :     SdrObject *pObj = pPage->GetObj(0);
     377           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     378           1 :     CPPUNIT_ASSERT( pTxtObj );
     379           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     380           2 :     std::vector<EECharAttrib> rLst;
     381           1 :     aEdit.GetCharAttribs(1, rLst);
     382          17 :     for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
     383             :     {
     384          16 :         const SvxEscapementItem *pFontEscapement = dynamic_cast<const SvxEscapementItem *>((*it).pAttr);
     385          16 :         if(pFontEscapement)
     386             :         {
     387           1 :             if( pFontEscapement->GetEsc() != 0 )
     388             :             {
     389           0 :                 bPassed = false;
     390           0 :                 break;
     391             :             }
     392             :         }
     393             :     }
     394           1 :     CPPUNIT_ASSERT_MESSAGE("CharEscapment not imported properly", bPassed);
     395             : 
     396           2 :     xDocShRef->DoClose();
     397           1 : }
     398             : 
     399           1 : void SdImportTest::testMasterPageStyleParent()
     400             : {
     401           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/masterpage_style_parent.odp"), ODP );
     402             : 
     403           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     404           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     405           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     406           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     407             : 
     408           1 :     SdStyleSheetPool *const pPool(pDoc->GetSdStyleSheetPool());
     409             : 
     410           1 :     int parents(0);
     411           2 :     SfxStyleSheetIterator iter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
     412          29 :     for (SfxStyleSheetBase * pStyle = iter.First(); pStyle; pStyle = iter.Next())
     413             :     {
     414          28 :         OUString const name(pStyle->GetName());
     415          56 :         OUString const parent(pStyle->GetParent());
     416          28 :         if (!parent.isEmpty())
     417             :         {
     418          16 :             ++parents;
     419             :             // check that parent exists
     420             :             SfxStyleSheetBase *const pParentStyle(
     421          16 :                     pPool->Find(parent, SD_STYLE_FAMILY_MASTERPAGE));
     422          16 :             CPPUNIT_ASSERT(pParentStyle);
     423          16 :             CPPUNIT_ASSERT_EQUAL(pParentStyle->GetName(), parent);
     424             :             // check that parent has the same master page as pStyle
     425          16 :             CPPUNIT_ASSERT(parent.indexOf(SD_LT_SEPARATOR) != -1);
     426          16 :             CPPUNIT_ASSERT(name.indexOf(SD_LT_SEPARATOR) != -1);
     427          32 :             CPPUNIT_ASSERT_EQUAL(
     428             :                     parent.copy(0, parent.indexOf(SD_LT_SEPARATOR)),
     429          16 :                     name.copy(0, name.indexOf(SD_LT_SEPARATOR)));
     430             :         }
     431          28 :     }
     432             :     // check that there are actually parents...
     433           1 :     CPPUNIT_ASSERT_EQUAL(16, parents);
     434             : 
     435           2 :     xDocShRef->DoClose();
     436           1 : }
     437             : 
     438           1 : void SdImportTest::testN778859()
     439             : {
     440           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"), PPTX);
     441             : 
     442           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     443           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     444           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     445           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     446             :     {
     447             :         // Get the object
     448           1 :         SdrObject *pObj = pPage->GetObj(1);
     449           1 :         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     450           1 :         CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     451           1 :         CPPUNIT_ASSERT(!pTxtObj->IsAutoFit());
     452             :     }
     453             : 
     454           1 :     xDocShRef->DoClose();
     455           1 : }
     456             : 
     457           1 : void SdImportTest::testFdo68594()
     458             : {
     459           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/ppt/fdo68594.ppt"), PPT);
     460             : 
     461           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     462           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     463           1 :     const SdrPage *pPage = &(pDoc->GetPage (1)->TRG_GetMasterPage());
     464           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     465           1 :     SdrObject *pObj = pPage->GetObj(1);
     466           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     467           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     468           1 :     const SvxColorItem *pC = dynamic_cast<const SvxColorItem *>(&pTxtObj->GetMergedItem(EE_CHAR_COLOR));
     469           1 :     CPPUNIT_ASSERT_MESSAGE( "no color item", pC != NULL);
     470             :     // Color should be black
     471           1 :     CPPUNIT_ASSERT_MESSAGE( "Placeholder color mismatch", pC->GetValue().GetColor() == 0);
     472             : 
     473           1 :     xDocShRef->DoClose();
     474           1 : }
     475             : 
     476           1 : void SdImportTest::testFdo72998()
     477             : {
     478           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/cshapes.pptx"), PPTX);
     479             : 
     480           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     481           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     482           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     483           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     484             :     {
     485           1 :         SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>(pPage->GetObj(2));
     486           1 :         CPPUNIT_ASSERT( pObj );
     487           1 :         const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
     488           1 :         const ::com::sun::star::uno::Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( OUString( "ViewBox" ) );
     489           1 :         CPPUNIT_ASSERT_MESSAGE( "Missing ViewBox", pViewBox );
     490           1 :         com::sun::star::awt::Rectangle aViewBox;
     491           1 :         CPPUNIT_ASSERT( (*pViewBox >>= aViewBox ) );
     492           1 :         CPPUNIT_ASSERT_MESSAGE( "Width should be zero - for forcing scale to 1", !aViewBox.Width );
     493           1 :         CPPUNIT_ASSERT_MESSAGE( "Height should be zero - for forcing scale to 1", !aViewBox.Height );
     494             :     }
     495             : 
     496           1 :     xDocShRef->DoClose();
     497           1 : }
     498             : 
     499             : // FIXME copypasta
     500           0 : std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
     501             : {
     502           0 :     rStrm << "Color: R:" << rColor.GetRed() << " G:" << rColor.GetGreen() << " B: " << rColor.GetBlue();
     503           0 :     return rStrm;
     504             : }
     505             : 
     506           1 : void SdImportTest::testFdo77027()
     507             : {
     508           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/fdo77027.odp"), ODP);
     509             : 
     510           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     511           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     512           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     513           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     514             :     {
     515           1 :         SdrOle2Obj *const pObj = dynamic_cast<SdrOle2Obj*>(pPage->GetObj(0));
     516           1 :         CPPUNIT_ASSERT(pObj);
     517             : 
     518             :         // check that the fill style/color was actually imported
     519             :         const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
     520           1 :                 pObj->GetMergedItem(XATTR_FILLSTYLE));
     521           1 :         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
     522             :         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
     523           1 :                 pObj->GetMergedItem(XATTR_FILLCOLOR));
     524           1 :         CPPUNIT_ASSERT_EQUAL(Color(0xff6600), rColorItem.GetColorValue());
     525             :     }
     526             : 
     527           1 :     xDocShRef->DoClose();
     528           1 : }
     529             : 
     530           1 : void SdImportTest::testFdo64512()
     531             : {
     532           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"), ODP);
     533             : 
     534             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     535           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     536           1 :     CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
     537             : 
     538             :     uno::Reference< drawing::XDrawPage > xPage(
     539           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     540           1 :     CPPUNIT_ASSERT_MESSAGE( "no exactly three shapes", xPage->getCount() == 3 );
     541             : 
     542             :     uno::Reference< beans::XPropertySet > xConnectorShape(
     543           2 :         xPage->getByIndex(2), uno::UNO_QUERY );
     544           1 :     CPPUNIT_ASSERT_MESSAGE( "no connector shape", xConnectorShape.is() );
     545             : 
     546             :     uno::Reference< beans::XPropertySet > xSvgShape(
     547           2 :         xConnectorShape->getPropertyValue("StartShape"), uno::UNO_QUERY );
     548           1 :     CPPUNIT_ASSERT_MESSAGE( "no start shape", xSvgShape.is() );
     549             : 
     550             :     uno::Reference< beans::XPropertySet > xCustomShape(
     551           2 :         xConnectorShape->getPropertyValue("EndShape"), uno::UNO_QUERY );
     552           1 :     CPPUNIT_ASSERT_MESSAGE( "no end shape", xCustomShape.is() );
     553             : 
     554             :     uno::Reference< animations::XAnimationNodeSupplier > xAnimNodeSupplier(
     555           2 :         xPage, uno::UNO_QUERY_THROW );
     556             :     uno::Reference< animations::XAnimationNode > xRootNode(
     557           2 :         xAnimNodeSupplier->getAnimationNode() );
     558           2 :     std::vector< uno::Reference< animations::XAnimationNode > > aAnimVector;
     559           1 :     anim::create_deep_vector(xRootNode, aAnimVector);
     560           1 :     CPPUNIT_ASSERT_MESSAGE( "not 8 animation nodes", aAnimVector.size() == 8 );
     561             : 
     562             :     uno::Reference< animations::XAnimate > xNode(
     563           2 :         aAnimVector[7], uno::UNO_QUERY_THROW );
     564             :     uno::Reference< drawing::XShape > xTargetShape(
     565           2 :         xNode->getTarget(), uno::UNO_QUERY_THROW );
     566           2 :     CPPUNIT_ASSERT_MESSAGE( "inner node not referencing svg shape",
     567           1 :                             xTargetShape != xSvgShape );
     568             : 
     569           2 :     xDocShRef->DoClose();
     570           1 : }
     571             : 
     572             : // Unit test for importing charts
     573           1 : void SdImportTest::testFdo71075()
     574             : {
     575           1 :     double values[] = { 12.0, 13.0, 14.0 };
     576           1 :     ::com::sun::star::uno::Any aAny;
     577           2 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71075.odp"), ODP);
     578             : 
     579           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     580           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     581           2 :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     582           2 :     uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     583           2 :     uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
     584           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() );
     585             : 
     586           2 :     uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
     587           1 :     aAny = xPropSet->getPropertyValue( OUString("Model") );
     588           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load shape", aAny.hasValue() );
     589             : 
     590           2 :     uno::Reference< chart::XChartDocument > xChartDoc;
     591           1 :     aAny >>= xChartDoc;
     592           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChartDoc.is() );
     593           2 :     uno::Reference< chart2::XChartDocument > xChart2Doc( xChartDoc, uno::UNO_QUERY );
     594           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart2Doc.is() );
     595             : 
     596           2 :     uno::Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xChart2Doc->getFirstDiagram(), uno::UNO_QUERY );
     597           2 :     uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xBCooSysCnt->getCoordinateSystems());
     598           2 :     uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[0], uno::UNO_QUERY );
     599             : 
     600           2 :     uno::Reference< chart2::XDataSeriesContainer > xDSCnt( xCTCnt->getChartTypes()[0], uno::UNO_QUERY );
     601           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load data series", xDSCnt.is() );
     602           2 :     uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
     603           1 :     CPPUNIT_ASSERT_MESSAGE( "Invalid Series count", aSeriesSeq.getLength() == 1);
     604           2 :     uno::Reference< chart2::data::XDataSource > xSource( aSeriesSeq[0], uno::UNO_QUERY );
     605           2 :     uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(xSource->getDataSequences());
     606           1 :     CPPUNIT_ASSERT_MESSAGE( "Invalid Series count", aSeqCnt.getLength() == 1);
     607           2 :     uno::Reference< chart2::data::XDataSequence > xValueSeq( aSeqCnt[0]->getValues() );
     608           1 :     CPPUNIT_ASSERT_MESSAGE( "Invalid Data count", xValueSeq->getData().getLength() == sizeof(values)/(sizeof(double)));
     609           2 :     uno::Reference< chart2::data::XNumericalDataSequence > xNumSeq( xValueSeq, uno::UNO_QUERY );
     610           2 :     uno::Sequence< double > aValues( xNumSeq->getNumericalData());
     611           4 :     for(sal_Int32 i=0;i<xValueSeq->getData().getLength();i++)
     612           3 :         CPPUNIT_ASSERT_MESSAGE( "Invalid Series count", aValues.getConstArray()[i] == values[i]);
     613             : 
     614           2 :     xDocShRef->DoClose();
     615           1 : }
     616             : 
     617           1 : void SdImportTest::testStrictOOXML()
     618             : {
     619           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/strict_ooxml.pptx"), PPTX);
     620             : 
     621           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     622           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     623           2 :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     624           2 :     uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     625           2 :     uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
     626           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() );
     627             : 
     628           2 :     xDocShRef->DoClose();
     629           1 : }
     630             : 
     631           1 : void SdImportTest::testBnc870237()
     632             : {
     633           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"), PPTX);
     634             : 
     635           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     636           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     637           1 :     const SdrPage *pPage = pDoc->GetPage (1);
     638           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     639             : 
     640             :     // Simulate a:ext inside dsp:txXfrm with changing the lower distance
     641           1 :     const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 0 ) );
     642           1 :     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
     643           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue());
     644           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue());
     645           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST))).GetValue());
     646           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrMetricItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST))).GetValue());
     647             : 
     648           1 :     xDocShRef->DoClose();
     649           1 : }
     650             : 
     651           1 : void SdImportTest::testCreationDate()
     652             : {
     653           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71434.pptx"), PPTX);
     654           2 :     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY);
     655           2 :     uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
     656           1 :     util::DateTime aDate = xDocumentProperties->getCreationDate();
     657           2 :     OUStringBuffer aBuffer;
     658           1 :     sax::Converter::convertDateTime(aBuffer, aDate, 0);
     659             :     // Metadata wasn't imported, this was 0000-00-00.
     660           1 :     CPPUNIT_ASSERT_EQUAL(OUString("2013-11-09T10:37:56"), aBuffer.makeStringAndClear());
     661           2 :     xDocShRef->DoClose();
     662           1 : }
     663             : 
     664           1 : void SdImportTest::testBnc887225()
     665             : {
     666           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx"), PPTX );
     667             :     // In the document, lastRow and lastCol table properties are used.
     668             :     // Make sure styles are set properly for individual cells.
     669             : 
     670           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     671           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     672           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     673           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     674             : 
     675           1 :     sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(2));
     676           1 :     CPPUNIT_ASSERT( pTableObj );
     677           2 :     uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
     678           2 :     uno::Reference< beans::XPropertySet > xCell;
     679             :     sal_Int32 nColor;
     680             : 
     681           1 :     xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
     682           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     683           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
     684             : 
     685           1 :     xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
     686           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     687           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
     688             : 
     689           1 :     xCell.set(xTable->getCellByPosition(1, 1), uno::UNO_QUERY_THROW);
     690           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     691           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(13754095), nColor);
     692             : 
     693           1 :     xCell.set(xTable->getCellByPosition(1, 2), uno::UNO_QUERY_THROW);
     694           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     695           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(15331319), nColor);
     696             : 
     697           1 :     xCell.set(xTable->getCellByPosition(1, 4), uno::UNO_QUERY_THROW);
     698           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     699           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
     700             : 
     701           1 :     xCell.set(xTable->getCellByPosition(3, 2), uno::UNO_QUERY_THROW);
     702           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     703           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
     704             : 
     705           1 :     xCell.set(xTable->getCellByPosition(3, 4), uno::UNO_QUERY_THROW);
     706           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     707           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(6003669), nColor);
     708             : 
     709           2 :     xDocShRef->DoClose();
     710           1 : }
     711             : 
     712           1 : void SdImportTest::testBnc480256()
     713             : {
     714           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc480256.pptx"), PPTX);
     715             :     // In the document, there are two tables with table background properties.
     716             :     // Make sure colors are set properly for individual cells.
     717             : 
     718             :     // TODO: If you are working on improving table background support, expect
     719             :     // this unit test to fail. In that case, feel free to change the numbers.
     720             : 
     721           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     722           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     723           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     724           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     725             : 
     726             :     sdr::table::SdrTableObj *pTableObj;
     727           2 :     uno::Reference< table::XCellRange > xTable;
     728           2 :     uno::Reference< beans::XPropertySet > xCell;
     729             :     sal_Int32 nColor;
     730           1 :     table::BorderLine2 aBorderLine;
     731             : 
     732           1 :     pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
     733           1 :     CPPUNIT_ASSERT( pTableObj );
     734           1 :     xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
     735             : 
     736           1 :     xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
     737           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     738           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(10208238), nColor);
     739           1 :     xCell->getPropertyValue("LeftBorder") >>= aBorderLine;
     740           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color);
     741             : 
     742           1 :     xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
     743           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     744           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(13032959), nColor);
     745           1 :     xCell->getPropertyValue("TopBorder") >>= aBorderLine;
     746           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color);
     747             : 
     748           1 :     pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(1));
     749           1 :     CPPUNIT_ASSERT( pTableObj );
     750           1 :     xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
     751             : 
     752           1 :     xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
     753           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     754           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(7056614), nColor);
     755           1 :     xCell->getPropertyValue("LeftBorder") >>= aBorderLine;
     756           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(12505062), aBorderLine.Color);
     757             : 
     758           1 :     xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
     759           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
     760           1 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4626400), nColor);
     761             : 
     762           1 :     xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW);
     763           1 :     xCell->getPropertyValue("BottomBorder") >>= aBorderLine;
     764           1 :     CPPUNIT_ASSERT_EQUAL(util::Color(0), aBorderLine.Color);
     765             : 
     766           2 :     xDocShRef->DoClose();
     767           1 : }
     768             : 
     769           1 : void SdImportTest::testBnc584721_1()
     770             : {
     771             :     // Title text shape on the master page contained wrong text.
     772             : 
     773           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX);
     774             : 
     775           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     776           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     777           1 :     const SdrPage *pPage = &(pDoc->GetPage (1)->TRG_GetMasterPage());
     778           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     779           1 :     SdrObject *pObj = pPage->GetObj(0);
     780           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
     781           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     782           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     783           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Click to edit Master title style"), aEdit.GetText(0));
     784           1 :     xDocShRef->DoClose();
     785           1 : }
     786             : 
     787           1 : void SdImportTest::testBnc584721_2()
     788             : {
     789             :     // Import created an extra/unneeded outliner shape on the master slide next to the imported title shape.
     790             : 
     791           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX);
     792             : 
     793           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     794           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     795           1 :     const SdrPage *pPage = &(pDoc->GetPage(1)->TRG_GetMasterPage());
     796           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     797           1 :     CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
     798             : 
     799           1 :     xDocShRef->DoClose();
     800           1 : }
     801             : 
     802           1 : void SdImportTest::testBnc584721_3()
     803             : {
     804             :     // Subtitle was simply skipped on master slides.
     805             :     // Check whether the second shape is a subtitle shape with the right text.
     806             : 
     807           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_3.pptx"), PPTX);
     808             : 
     809           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     810           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     811           1 :     const SdrPage *pPage = &(pDoc->GetPage(1)->TRG_GetMasterPage());
     812           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     813           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(1) );
     814           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
     815             : 
     816             :     // Check the shape type
     817           2 :     uno::Reference< drawing::XShape > xShape( pTxtObj->getUnoShape(), uno::UNO_QUERY );
     818           1 :     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.presentation.SubtitleShape"), xShape->getShapeType());
     819             : 
     820             :     // Check the text
     821           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     822           1 :     CPPUNIT_ASSERT_EQUAL(OUString("Click to edit Master subtitle style"), aEdit.GetText(0));
     823             : 
     824           2 :     xDocShRef->DoClose();
     825           1 : }
     826             : 
     827           1 : void SdImportTest::testBnc591147()
     828             : {
     829           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc591147.pptx"), PPTX);
     830             : 
     831             :     // In the document, there are two slides with media files.
     832             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     833           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     834           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(2), xDoc->getDrawPages()->getCount() );
     835             : 
     836             :     // First page has video file inserted
     837             :     uno::Reference< drawing::XDrawPage > xPage(
     838           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
     839           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xPage->getCount() );
     840             : 
     841           2 :     uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
     842           2 :     uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
     843           2 :     OUString sVideoURL("emptyURL");
     844           1 :     bool bSucess = xPropSet->getPropertyValue("MediaURL") >>= sVideoURL;
     845           1 :     CPPUNIT_ASSERT_MESSAGE( "MediaURL property is not set", bSucess );
     846           1 :     CPPUNIT_ASSERT_MESSAGE("MediaURL is empty", !sVideoURL.isEmpty());
     847             : 
     848             :     // Second page has audio file inserted
     849           1 :     xPage.set( xDoc->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
     850           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xPage->getCount() );
     851             : 
     852           1 :     xShape.set( xPage->getByIndex(0), uno::UNO_QUERY_THROW );
     853           1 :     xPropSet.set( xShape, uno::UNO_QUERY_THROW );
     854           2 :     OUString sAudioURL("emptyURL");
     855           1 :     bSucess = xPropSet->getPropertyValue("MediaURL") >>= sAudioURL;
     856           1 :     CPPUNIT_ASSERT_MESSAGE( "MediaURL property is not set", bSucess );
     857           1 :     CPPUNIT_ASSERT_MESSAGE("MediaURL is empty", !sAudioURL.isEmpty());
     858             : 
     859           1 :     CPPUNIT_ASSERT_MESSAGE( "sAudioURL and sVideoURL should not be equal", sAudioURL != sVideoURL );
     860             : 
     861           2 :     xDocShRef->DoClose();
     862           1 : }
     863             : 
     864           1 : void SdImportTest::testBnc584721_4()
     865             : {
     866             :     // Black text was imported as white because of wrong caching mechanism
     867             : 
     868           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_4.pptx"), PPTX);
     869             : 
     870             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
     871           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
     872             : 
     873             :     uno::Reference< drawing::XDrawPage > xPage(
     874           2 :         xDoc->getDrawPages()->getByIndex(1), uno::UNO_QUERY_THROW );
     875             : 
     876             :     uno::Reference< beans::XPropertySet > xShape(
     877           2 :         xPage->getByIndex(1), uno::UNO_QUERY );
     878           1 :     CPPUNIT_ASSERT_MESSAGE( "no text shape", xShape.is() );
     879             : 
     880             :     // Get first paragraph of the text
     881           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
     882           1 :     CPPUNIT_ASSERT_MESSAGE( "no text shape", xText.is() );
     883           2 :     uno::Reference<container::XEnumerationAccess> paraEnumAccess;
     884           1 :     paraEnumAccess.set(xText, uno::UNO_QUERY);
     885           2 :     uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
     886           1 :     uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
     887           2 :                 uno::UNO_QUERY_THROW);
     888             : 
     889             :     // Get first run of the paragraph
     890           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
     891           2 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
     892           2 :     uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
     893           2 :     uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
     894             :     sal_Int32 nCharColor;
     895           1 :     xPropSet->getPropertyValue( "CharColor" ) >>= nCharColor;
     896             : 
     897             :     // Color should be black
     898           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(COL_BLACK), nCharColor );
     899             : 
     900           2 :     xDocShRef->DoClose();
     901           1 : }
     902             : 
     903           1 : void SdImportTest::testBnc904423()
     904             : {
     905             :     // Here the problem was that different fill properties were applied in wrong order on the shape
     906             :     // Right order: 1) master slide fill style, 2) theme, 3) direct formatting
     907           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/bnc904423.pptx"), PPTX);
     908             : 
     909           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     910           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     911           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     912           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     913             : 
     914             :     // First shape's background color is defined on master slide
     915             :     {
     916           1 :         SdrObject *const pObj = pPage->GetObj(0);
     917           1 :         CPPUNIT_ASSERT(pObj);
     918             : 
     919             :         const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
     920           1 :                 pObj->GetMergedItem(XATTR_FILLSTYLE));
     921           1 :         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
     922             :         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
     923           1 :                 pObj->GetMergedItem(XATTR_FILLCOLOR));
     924           1 :         CPPUNIT_ASSERT_EQUAL(ColorData(0x00CC99), rColorItem.GetColorValue().GetColor());
     925             :     }
     926             : 
     927             :     // Second shape's background color is defined by theme
     928             :     {
     929           1 :         SdrObject *const pObj = pPage->GetObj(1);
     930           1 :         CPPUNIT_ASSERT(pObj);
     931             : 
     932             :         const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
     933           1 :                 pObj->GetMergedItem(XATTR_FILLSTYLE));
     934           1 :         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
     935             :         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
     936           1 :                 pObj->GetMergedItem(XATTR_FILLCOLOR));
     937           1 :         CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor());
     938             :     }
     939             : 
     940             :     // Third shape's background color is defined by direct formatting
     941             :     {
     942           1 :         SdrObject *const pObj = pPage->GetObj(2);
     943           1 :         CPPUNIT_ASSERT(pObj);
     944             : 
     945             :         const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
     946           1 :                 pObj->GetMergedItem(XATTR_FILLSTYLE));
     947           1 :         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
     948             :         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
     949           1 :                 pObj->GetMergedItem(XATTR_FILLCOLOR));
     950           1 :         CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
     951             :     }
     952             : 
     953           1 :     xDocShRef->DoClose();
     954           1 : }
     955             : 
     956           1 : void SdImportTest::testShapeLineStyle()
     957             : {
     958             :     // Here the problem was that different line properties were applied in wrong order on the shape
     959             :     // Right order: 1) master slide line style, 2) theme, 3) direct formatting
     960           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/ShapeLineProperties.pptx"), PPTX);
     961             : 
     962           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
     963           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
     964           1 :     const SdrPage *pPage = pDoc->GetPage(1);
     965           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     966             : 
     967             :     // First shape's line style is defined on master slide
     968             :     {
     969           1 :         SdrObject *const pObj = pPage->GetObj(0);
     970           1 :         CPPUNIT_ASSERT(pObj);
     971             : 
     972             :         const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
     973           1 :                 pObj->GetMergedItem(XATTR_LINESTYLE));
     974           1 :         CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue());
     975             : 
     976             :         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
     977           1 :                 pObj->GetMergedItem(XATTR_LINECOLOR));
     978           1 :         CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
     979             : 
     980             :         const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
     981           1 :                 pObj->GetMergedItem(XATTR_LINEWIDTH));
     982           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(132), rWidthItem.GetValue());
     983             :     }
     984             : 
     985             :     // Second shape's line style is defined by theme
     986             :     {
     987           1 :         SdrObject *const pObj = pPage->GetObj(1);
     988           1 :         CPPUNIT_ASSERT(pObj);
     989             : 
     990             :         const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
     991           1 :                 pObj->GetMergedItem(XATTR_LINESTYLE));
     992           1 :         CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, rStyleItem.GetValue());
     993             : 
     994             :         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
     995           1 :                 pObj->GetMergedItem(XATTR_LINECOLOR));
     996           1 :         CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor());
     997             : 
     998             :         const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
     999           1 :                 pObj->GetMergedItem(XATTR_LINEWIDTH));
    1000           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(35), rWidthItem.GetValue());
    1001             :     }
    1002             : 
    1003             :     // Third shape's line style is defined by direct formatting
    1004             :     {
    1005           1 :         SdrObject *const pObj = pPage->GetObj(2);
    1006           1 :         CPPUNIT_ASSERT(pObj);
    1007             : 
    1008             :         const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
    1009           1 :                 pObj->GetMergedItem(XATTR_LINESTYLE));
    1010           1 :         CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, rStyleItem.GetValue());
    1011             : 
    1012             :         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
    1013           1 :                 pObj->GetMergedItem(XATTR_LINECOLOR));
    1014           1 :         CPPUNIT_ASSERT_EQUAL(ColorData(0x7030A0), rColorItem.GetColorValue().GetColor());
    1015             : 
    1016             :         const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
    1017           1 :                 pObj->GetMergedItem(XATTR_LINEWIDTH));
    1018           1 :         CPPUNIT_ASSERT_EQUAL(sal_Int32(176), rWidthItem.GetValue());
    1019             :     }
    1020             : 
    1021           1 :     xDocShRef->DoClose();
    1022           1 : }
    1023             : 
    1024           1 : void SdImportTest::testBnc862510_6()
    1025             : {
    1026             :     // Black text was imported instead of gray
    1027           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_6.pptx"), PPTX);
    1028             : 
    1029             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
    1030           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1031             : 
    1032             :     uno::Reference< drawing::XDrawPage > xPage(
    1033           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1034             : 
    1035             :     uno::Reference< beans::XPropertySet > xShape(
    1036           2 :         xPage->getByIndex(0), uno::UNO_QUERY );
    1037           1 :     CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
    1038             : 
    1039             :     // Get first paragraph of the text
    1040           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1041           1 :     CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
    1042           2 :     uno::Reference<container::XEnumerationAccess> paraEnumAccess;
    1043           1 :     paraEnumAccess.set(xText, uno::UNO_QUERY);
    1044           2 :     uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
    1045           1 :     uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
    1046           2 :                 uno::UNO_QUERY_THROW);
    1047             : 
    1048             :     // Get first run of the paragraph
    1049           2 :     uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
    1050           2 :     uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
    1051           2 :     uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
    1052           2 :     uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
    1053             :     sal_Int32 nCharColor;
    1054           1 :     xPropSet->getPropertyValue( "CharColor" ) >>= nCharColor;
    1055             : 
    1056             :     // Color should be gray
    1057           1 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(0x8B8B8B), nCharColor );
    1058             : 
    1059           2 :     xDocShRef->DoClose();
    1060           1 : }
    1061             : 
    1062           1 : void SdImportTest::testBnc862510_7()
    1063             : {
    1064             :     // Title shape's text was aligned to left instead of center.
    1065           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_7.pptx"), PPTX);
    1066             : 
    1067             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
    1068           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1069             : 
    1070             :     uno::Reference< drawing::XDrawPage > xPage(
    1071           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1072             : 
    1073             :     uno::Reference< beans::XPropertySet > xShape(
    1074           2 :         xPage->getByIndex(0), uno::UNO_QUERY );
    1075           1 :     CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
    1076             : 
    1077             :     // Get first paragraph
    1078           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1079           1 :     CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
    1080           2 :     uno::Reference<container::XEnumerationAccess> paraEnumAccess;
    1081           1 :     paraEnumAccess.set(xText, uno::UNO_QUERY);
    1082           2 :     uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
    1083           1 :     uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
    1084           2 :                 uno::UNO_QUERY_THROW);
    1085           2 :     uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
    1086             : 
    1087           1 :     sal_Int16 nParaAdjust = 0;
    1088           1 :     xPropSet->getPropertyValue( "ParaAdjust" ) >>= nParaAdjust;
    1089           1 :     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
    1090             : 
    1091           2 :     xDocShRef->DoClose();
    1092           1 : }
    1093             : 
    1094             : #if ENABLE_PDFIMPORT
    1095             : 
    1096           1 : void SdImportTest::testPDFImport()
    1097             : {
    1098           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF);
    1099           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1100           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1101           2 :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1102           2 :     uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1103           1 :     CPPUNIT_ASSERT_MESSAGE( "no exactly two shapes", xPage->getCount() == 2 );
    1104             : 
    1105           2 :     uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
    1106           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() );
    1107           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1108           1 :     CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
    1109             : 
    1110           2 :     xDocShRef->DoClose();
    1111           1 : }
    1112             : 
    1113           1 : void SdImportTest::testPDFImportSkipImages()
    1114             : {
    1115           1 :     SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() );
    1116           1 :     pParams->Put( SfxStringItem ( SID_FILE_FILTEROPTIONS, OUString("SkipImages") ) );
    1117             : 
    1118           1 :     sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF, pParams);
    1119           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1120           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1121           2 :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1122           2 :     uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1123           1 :     CPPUNIT_ASSERT_MESSAGE( "no exactly one shape", xPage->getCount() == 1 );
    1124             : 
    1125           2 :     uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW );
    1126           1 :     CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() );
    1127           2 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1128           1 :     CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
    1129             : 
    1130           2 :     xDocShRef->DoClose();
    1131           1 : }
    1132             : 
    1133             : #endif
    1134             : 
    1135           1 : void SdImportTest::testBulletSuffix()
    1136             : {
    1137           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n83889.pptx"), PPTX );
    1138             : 
    1139             :     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
    1140           2 :         xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
    1141             : 
    1142             :     uno::Reference< drawing::XDrawPage > xPage(
    1143           2 :         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
    1144           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1145           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1146             : 
    1147             :     // check suffix of the char bullet
    1148           1 :     const SdrPage *pPage = pDoc->GetPage(1);
    1149           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
    1150           1 :     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
    1151           1 :     CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
    1152           1 :     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
    1153           1 :     const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(1).GetItem(EE_PARA_NUMBULLET));
    1154           1 :     CPPUNIT_ASSERT(pNumFmt);
    1155           1 :     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's suffix is wrong!", OUString(pNumFmt->GetNumRule()->GetLevel(0).GetSuffix()), OUString("") );
    1156           2 :     xDocShRef->DoClose();
    1157           1 : }
    1158             : 
    1159           1 : void SdImportTest::testBnc910045()
    1160             : {
    1161             :     // Problem with table style which defines cell color with fill style
    1162           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc910045.pptx"), PPTX );
    1163             : 
    1164           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1165           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1166           1 :     const SdrPage *pPage = pDoc->GetPage(1);
    1167           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
    1168             : 
    1169           1 :     sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
    1170           1 :     CPPUNIT_ASSERT( pTableObj );
    1171           2 :     uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
    1172           2 :     uno::Reference< beans::XPropertySet > xCell;
    1173             :     sal_Int32 nColor;
    1174             : 
    1175           1 :     xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
    1176           1 :     xCell->getPropertyValue("FillColor") >>= nColor;
    1177           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(5210557), nColor);
    1178           1 : }
    1179             : 
    1180           1 : void SdImportTest::testRowHeight()
    1181             : {
    1182           1 :     sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n80340.pptx"), PPTX );
    1183             : 
    1184           1 :     SdDrawDocument *pDoc = xDocShRef->GetDoc();
    1185           1 :     CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
    1186             : 
    1187           1 :     const SdrPage *pPage = pDoc->GetPage(1);
    1188           1 :     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
    1189             : 
    1190           1 :     sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
    1191           1 :     CPPUNIT_ASSERT( pTableObj );
    1192             : 
    1193             :     sal_Int32 nHeight;
    1194           2 :     const OUString sHeight("Height");
    1195           2 :     uno::Reference< com::sun::star::table::XTable > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
    1196           2 :     uno::Reference< com::sun::star::table::XTableRows > xRows( xTable->getRows(), uno::UNO_QUERY_THROW);
    1197           2 :     uno::Reference< beans::XPropertySet > xRefRow( xRows->getByIndex(0), uno::UNO_QUERY_THROW );
    1198           1 :     xRefRow->getPropertyValue( sHeight ) >>= nHeight;
    1199           2 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(508), nHeight);
    1200           1 : }
    1201             : 
    1202           1 : CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
    1203             : 
    1204           4 : CPPUNIT_PLUGIN_IMPLEMENT();
    1205             : 
    1206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11